diff --git a/.eslintrc.json b/.eslintrc.json index 7570404a..3cb575cc 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -31,11 +31,11 @@ ], "pathGroups": [ { - "pattern": "@pollum-io/**", + "pattern": "syscoin/**", "group": "index" } ], - "pathGroupsExcludedImportTypes": ["@pollum-io/**"], + "pathGroupsExcludedImportTypes": ["syscoin/**"], "newlines-between": "always", "alphabetize": { "order": "asc", diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 767b2cb2..055b4f23 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -9,11 +9,100 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: '16' - check-latest: true - - run: yarn install + node-version-file: '.nvmrc' + - name: Install pinned Yarn + run: npm install --global yarn@1.22.22 --ignore-scripts + - run: yarn install --frozen-lockfile + - name: Install keyring source-test dependencies + run: | + for package in sysweb3-core sysweb3-network sysweb3-utils sysweb3-keyring; do + yarn --cwd "packages/$package" install --frozen-lockfile --ignore-scripts + done - run: | touch .env echo SEED_LAW_COOK=${{ secrets.SEED_LAW_COOK }} >> .env echo SEED_PEACE_GLOBE=${{ secrets.SEED_PEACE_GLOBE }} >> .env echo SEED_SWALLOW_HEALTH=${{ secrets.SEED_SWALLOW_HEALTH }} >> .env + - name: Validate transaction signing and RPC regressions + working-directory: packages/sysweb3-keyring + timeout-minutes: 10 + # Existing unit fixtures leave timers/listeners after completion. + # --forceExit retains Jest's failure exit status; it does not skip tests. + run: | + NODE_ENV=test node ../../node_modules/jest/bin/jest.js --config jest.config.js --runInBand --silent --forceExit \ + test/unit/transactions/ethereum-fee-data.spec.ts \ + test/unit/providers-rpc-integrity.spec.ts \ + test/unit/transactions/ethereum-transactions.spec.ts \ + test/unit/transactions/ethereum-hardware-context.spec.ts \ + test/unit/transactions/ethereum-send-context.spec.ts \ + test/unit/transactions/prepared-evm.spec.ts \ + test/unit/transactions/ethereum-submission-boundary.spec.ts \ + test/unit/transactions/ethereum-cancellation-identity.spec.ts \ + test/unit/transactions/ethereum-cancellation-fee-consent.spec.ts \ + test/unit/transactions/evm-local-signer.spec.ts \ + test/unit/transactions/ethereum-replacement.spec.ts \ + test/unit/transactions/syscoin-transactions.spec.ts \ + test/unit/transactions/software-boundary.spec.ts \ + test/unit/transactions/native-sweep.spec.ts + - name: Validate network RPC regressions + working-directory: packages/sysweb3-network + run: | + NODE_ENV=test node ../../node_modules/jest/bin/jest.js --config jest.config.js --runInBand --silent + - name: Build keyring and validate vault custody + run: | + node node_modules/typescript/bin/tsc -p packages/sysweb3-keyring/tsconfig.json + node node_modules/typescript/bin/tsc -p packages/sysweb3-keyring/tsconfig-ledger-host.json + cd packages/sysweb3-keyring + # The initialization fixtures retain their existing hardware timers. + # forceExit preserves the test result; it does not skip assertions. + NODE_ENV=test node ../../node_modules/jest/bin/jest.js --config jest.config.js --runInBand --silent --forceExit \ + test/unit/storage-core.spec.ts \ + test/unit/keyring-manager/software-entry.spec.ts \ + test/unit/keyring-manager/software-indexed-hd.spec.ts \ + test/unit/keyring-manager/initialization.spec.ts \ + test/unit/keyring-manager/unlock-errors.spec.ts \ + test/unit/keyring-manager/vault-kdf-compatibility.spec.ts \ + test/unit/keyring-manager/storage-adapter.spec.ts \ + test/unit/keyring-manager/private-records.spec.ts + node test/software-entry-runtime.cjs + - name: Validate hardware transport and signing regressions + working-directory: packages/sysweb3-keyring + timeout-minutes: 10 + # The preceding build produces the plain-Node Connect protocol fixture. + run: | + NODE_ENV=test node ../../node_modules/jest/bin/jest.js --config jest.config.js --runInBand --silent \ + test/unit/hardware/trezor-connect-adapter.spec.ts \ + test/unit/hardware/trezor-manager-lifecycle.spec.ts \ + test/unit/hardware/trezor-suite-connect.spec.ts \ + test/unit/hardware/trezor-address.spec.ts \ + test/unit/hardware/trezor-witness.spec.ts \ + test/unit/hardware/trezor-transaction-invariants.spec.ts \ + test/unit/hardware/trezor.spec.ts \ + test/unit/hardware/ledger-dmk-session.spec.ts \ + test/unit/hardware/ledger-dmk-utxo.spec.ts \ + test/unit/hardware/ledger-dmk-evm.spec.ts \ + test/unit/hardware/ledger-authority-boundary.spec.ts \ + test/unit/hardware/ledger-output-map.spec.ts \ + test/unit/hardware/ledger.spec.ts \ + test/unit/hardware/ledger-finalized-inputs.spec.ts \ + test/unit/hardware/current-ledger-devices.spec.ts \ + test/unit/ledger/bitcoin_client/policy.spec.ts \ + test/unit/ledger/bitcoin_client/psbtv2.p2wpkh.spec.ts + - name: Validate watch-only descriptor regressions + working-directory: packages/sysweb3-keyring + run: | + NODE_ENV=test node ../../node_modules/jest/bin/jest.js --config jest.config.js --runInBand --silent \ + test/unit/keyring-manager/import-watchonly.spec.ts \ + test/unit/keyring-manager/watch-descriptor-lifecycle.spec.ts \ + test/unit/utils/watch-descriptor.spec.ts + - name: Validate offline public BIP84 account entry + working-directory: packages/sysweb3-keyring + run: | + NODE_ENV=test node ../../node_modules/jest/bin/jest.js --config jest.config.js --runInBand --silent \ + test/unit/utils/public-bip84.spec.ts \ + test/unit/transactions/bip84-native-plan.spec.ts \ + test/unit/keyring-manager/software-utxo-account.spec.ts \ + test/unit/transactions/prepared-bip84.spec.ts \ + test/unit/keyring-manager/prepared-bip84-signing.spec.ts + node ../../scripts/package/copy + node test/public-bip84-package.cjs diff --git a/.github/workflows/sentry.yml b/.github/workflows/sentry.yml new file mode 100644 index 00000000..19e10f61 --- /dev/null +++ b/.github/workflows/sentry.yml @@ -0,0 +1,33 @@ +name: Sentry protocol SDK +on: + pull_request: + paths: + - '.nvmrc' + - 'packages/sysweb3-sentry/**' + - '.github/workflows/sentry.yml' + push: + branches: [master, main] + paths: + - '.nvmrc' + - 'packages/sysweb3-sentry/**' + - '.github/workflows/sentry.yml' +permissions: + contents: read +jobs: + sentry-protocol: + runs-on: ubuntu-latest + timeout-minutes: 10 + defaults: + run: + working-directory: packages/sysweb3-sentry + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + - uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + cache: npm + cache-dependency-path: packages/sysweb3-sentry/package-lock.json + - run: npm ci --ignore-scripts --workspaces=false + - run: npm test diff --git a/.husky/pre-commit b/.husky/pre-commit index 56ac4d63..df744ac8 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,9 +1,9 @@ #!/bin/sh . "$(dirname "$0")/_/husky.sh" -# Load nvm if it exists +# Load nvm commands without replacing the caller's selected Node runtime. export NVM_DIR="$HOME/.nvm" -[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" +[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" --no-use -# Now yarn should be able to find node +# Yarn enforces the private repository's development engine requirement. yarn lint-staged diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 00000000..63f87c20 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +26.12.1 diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 00000000..671b64f2 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,269 @@ +# CLAUDE.md + +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. + +## Development Commands + +### Building + +```bash +# Build all packages +yarn build + +# Build specific package +cd packages/sysweb3-core && yarn build +cd packages/sysweb3-keyring && yarn build +cd packages/sysweb3-network && yarn build +cd packages/sysweb3-utils && yarn build +``` + +### Testing + +```bash +# Run all tests +yarn test + +# Run tests for specific package +cd packages/sysweb3-keyring && yarn test + +# Run specific test file +yarn test keyring-manager.spec.ts + +# Run tests in watch mode +yarn test --watch + +# Run tests with coverage +yarn test --coverage +``` + +### Linting and Type Checking + +```bash +# Run linting +yarn lint +yarn lint:fix # Auto-fix issues + +# Type checking +yarn type-check + +# Format code +yarn format +``` + +## Architecture Overview + +SysWeb3 is a multi-chain JavaScript/TypeScript library organized as a monorepo with four core packages: + +### Package Dependencies + +``` +sysweb3-network (base layer - no internal deps) + ↓ +sysweb3-core (depends on network) + ↓ +sysweb3-utils (depends on network) + ↓ +sysweb3-keyring (depends on core, network, utils) +``` + +### Key Architectural Patterns + +1. **Multi-Chain Support**: The system supports both UTXO-based chains (Bitcoin, Syscoin) and account-based chains (Ethereum, EVM-compatible). Network switching is handled through the `INetworkType` enum. + +2. **HD Wallet Architecture**: Uses BIP32/BIP44/BIP84 standards for hierarchical deterministic wallets. The `SyscoinHDSigner` manages UTXO accounts while Ethereum uses standard derivation paths. + +3. **Hardware Wallet Abstraction**: Trezor and Ledger support is abstracted through `TrezorKeyring` and `LedgerKeyring` classes, providing a unified interface. + +4. **State Management**: The `KeyringManager` maintains wallet state including accounts, networks, and balances. State persistence is handled through encrypted vault storage. + +5. **Network Synchronization**: Critical logic in `shouldUpdateHDSigner()` determines when HD signers need recreation based on network parameter changes (testnet/mainnet, SLIP44, blockbook URL). + +### Critical Components + +1. **KeyringManager** (`packages/sysweb3-keyring/src/keyring-manager.ts`): Central orchestrator for all wallet operations. Handles account creation, network switching, and transaction signing. + +2. **Network RPC Validation** (`packages/sysweb3-network/src/rpc.ts`): Validates both Ethereum and Bitcoin-like RPC endpoints. Critical for ensuring correct network configuration. + +3. **Transaction Handlers**: Separate implementations for Syscoin (`SyscoinTransactions`) and Ethereum (`EthereumTransactions`) transaction creation and signing. + +4. **Storage Layer** (`packages/sysweb3-keyring/src/storage.ts`): Handles encrypted vault operations for secure key storage. + +### Performance Considerations + +1. **Balance Fetching**: Only fetch balances for the active account to reduce network calls +2. **HD Signer Caching**: Reuse HD signers when network parameters haven't changed +3. **Parallel Operations**: Use Promise.all for concurrent network requests where possible +4. **Memory Management**: Clean up unused signers when switching networks + +### Security Best Practices + +1. **Imported Accounts**: Single-address accounts (WIF imports) cannot perform HD operations +2. **Password Validation**: Always validate passwords before sensitive operations +3. **State Isolation**: Proper cleanup in test environments to prevent state contamination +4. **Error Handling**: Never expose sensitive data in error messages + +## Common Development Tasks + +### Adding a New Network + +1. Add network configuration to `packages/sysweb3-network/src/networks.ts` +2. Update chain validation in `packages/sysweb3-network/src/rpc.ts` +3. Add network-specific tests +4. Update TypeScript types if needed + +### Debugging Network Issues + +1. Check `shouldUpdateHDSigner()` logic for HD signer recreation +2. Verify network parameters (chainId, slip44) +3. Validate RPC endpoint with `validateSysRpc()` or `validateEthRpc()` +4. Check blockbook URL format for UTXO chains + +### Testing Hardware Wallets + +Hardware wallet tests use mocks by default. See test setup in: + +- `packages/sysweb3-keyring/test/__mocks__/ledger-mock.js` +- `packages/sysweb3-keyring/test/__mocks__/trezor-mock.js` + +# Multi-Keyring Architecture: Single Active Keyring Model + +## Overview + +The multi-keyring architecture has been updated to follow a **single active unlocked keyring** model for enhanced security and clean state management. + +## Storage Separation by slip44 + +### Vault Storage + +Each keyring now stores its vault data in a slip44-specific location: + +- **Syscoin (slip44=57)**: `vault-57` +- **Ethereum (slip44=60)**: `vault-60` +- **Bitcoin (slip44=0)**: `vault-0` +- **Litecoin (slip44=2)**: `vault-2` +- etc. + +This ensures complete isolation between different network types. The vault contains: + +- `mnemonic`: The encrypted seed phrase (shared across all keyrings from the same seed) + +### Global Settings Storage (Managed by Pali) + +Settings that are shared across all keyrings are stored separately by Pali's MainController: + +- **`global-settings`**: Contains: + - `hasEncryptedVault`: Global vault status (true if any vault exists) + - `advancedSettings`: User preferences shared across all networks + - `coinsList`: Cached token/asset lists +- **`vault-keys`**: Password hash and salt (shared for all keyrings) + +### Redux State + +Stored separately under the `'state'` key and contains UI state, account data, network settings, etc. + +### Storage Keys Summary + +- `sysweb3-vault-{slip44}` - Encrypted mnemonics per slip44 (actual Chrome storage keys) +- `sysweb3-vault-keys` - Password hash/salt (shared) +- `sysweb3-global-settings` - Global settings (managed by Pali) +- `sysweb3-state` - Redux state + +Note: The keyring package only manages vault storage. Global wallet settings are managed by Pali's MainController. + +### Migration Support + +The storage layer includes automatic migration: + +1. If a slip44-specific vault doesn't exist, it checks for the legacy global `vault` +2. If found, it migrates the data to the slip44-specific location +3. This ensures backward compatibility while moving to the new architecture + +## Key Principles + +### 1. **One Unlocked Keyring at a Time** + +- Only the active keyring should be unlocked +- All other keyrings remain locked +- This prevents cross-keyring state contamination and provides clear security boundaries + +### 2. **Session Transfer on Switch** + +- When switching between keyrings (different slip44), session data is transferred +- The previous keyring is locked immediately after session transfer +- This ensures continuity while maintaining security + +### 3. **Fail-Fast on Locked Target** + +- If switching to a locked keyring and no session can be transferred, the operation fails +- This forces explicit unlock and prevents silent failures + +## Implementation Details + +### Key Methods Updated: + +#### `switchActiveKeyring()` + +```typescript +// Handles the complete keyring switching flow: +// 1. Check if session transfer is needed (different slip44 + current unlocked) +// 2. Create target keyring if it doesn't exist +// 3. Transfer session from current to target keyring +// 4. Lock the previous keyring +// 5. Set up network on the new active keyring +// 6. Lock all other keyrings as a safety measure +``` + +#### `unlockFromController()` + +```typescript +// When unlocking: +// 1. Unlock the active keyring with password +// 2. Lock all other keyrings to maintain single-active principle +// 3. Continue with normal unlock flow +``` + +#### `lockWallet()` + +```typescript +// When locking: +// Lock ALL keyrings, not just the active one +// This ensures complete security when user explicitly locks +``` + +## Benefits + +1. **Security**: Clear boundaries - only one keyring has access to sensitive data at a time +2. **Simplicity**: No complex state synchronization between multiple unlocked keyrings +3. **Predictability**: Always know which keyring is active and unlocked +4. **Memory Efficiency**: Only one set of decrypted keys in memory + +## Edge Cases Handled + +1. **Creating new keyring**: Session is automatically transferred from existing unlocked keyring +2. **Switching to same slip44**: No session transfer needed, just network setup +3. **No unlocked keyring**: Switching fails with clear error message +4. **Explicit lock**: All keyrings are locked for complete security + +## Session Data Transfer + +The session data includes: + +- `sessionPassword`: The encrypted session password +- `sessionMnemonic`: The encrypted mnemonic +- `sessionMainMnemonic`: The main account mnemonic +- `currentSessionSalt`: The salt for session encryption + +This data is transferred atomically to prevent partial states. + +## Future Considerations + +1. **Performance**: Session transfer is fast (just copying encrypted data) +2. **UX**: Users experience seamless network switching without re-entering passwords +3. **Multi-device**: This architecture supports future multi-device scenarios cleanly + +### Session Management + +The KeyringManager uses encrypted session storage for temporary runtime data: + +- `sessionPassword`: The hashed password for the current session +- `sessionMnemonic`: The encrypted mnemonic phrase diff --git a/README.md b/README.md index 0ecd1eca..94323bf2 100644 --- a/README.md +++ b/README.md @@ -6,24 +6,21 @@ SysWeb3 is a JavaScript API for Syscoin multi-chain, providing a collection of u This monorepo contains the following packages: -- **@pollum-io/sysweb3-keyring**: A keyring manager for UTXO and Web3 wallets, providing functions for handling wallets, addresses, accounts, transactions, and Trezor wallet integration. -- **@pollum-io/sysweb3-network**: A network management tool for multi-chain accounts, offering functions to validate RPC URLs and manage network configurations. -- **@pollum-io/sysweb3-utils**: A helper library for multi-chain accounts, providing TypeScript interfaces and utility functions for contract interactions, token validation, and more. -- **@pollum-io/sysweb3-core**: A localStorage manager for private keys, offering browser interaction functions for setting, getting, and deleting storage. +- **@sidhujag/sysweb3-keyring**: A keyring manager for UTXO and Web3 wallets, providing functions for handling wallets, addresses, accounts, transactions, and Trezor wallet integration. +- **@sidhujag/sysweb3-network**: A network management tool for multi-chain accounts, offering functions to validate RPC URLs and manage network configurations. +- **@sidhujag/sysweb3-utils**: A helper library for multi-chain accounts, providing TypeScript interfaces and utility functions for contract interactions, token validation, and more. +- **@sidhujag/sysweb3-core**: A localStorage manager for private keys, offering browser interaction functions for setting, getting, and deleting storage. ## Setup -### Prerequisites - -- Node.js 10 or later -- Yarn v1 or v2 - ### Installation -To install the packages, run: +Install the published packages with your application's package manager. Browser +consumers do not require a Node.js runtime; Node consumers must satisfy the +requirements of the packages and dependencies they use. ```bash -yarn add @pollum-io/sysweb3-keyring @pollum-io/sysweb3-network @pollum-io/sysweb3-utils @pollum-io/sysweb3-core +yarn add @sidhujag/sysweb3-keyring @sidhujag/sysweb3-network @sidhujag/sysweb3-utils @sidhujag/sysweb3-core ``` ## Usage @@ -33,7 +30,7 @@ yarn add @pollum-io/sysweb3-keyring @pollum-io/sysweb3-network @pollum-io/sysweb The SysWeb3 Keyring package provides functions for managing accounts, addresses, and transactions. Here's a simple example: ```js -import sysweb3 from '@pollum-io/sysweb3-keyring'; +import sysweb3 from '@sidhujag/sysweb3-keyring'; console.log(sysweb3); // Outputs available functions like Web3Accounts, SyscoinAddress, initialize, TrezorTransactions, etc. @@ -44,7 +41,7 @@ console.log(sysweb3); The SysWeb3 Network package offers functions for network management. Example: ```js -import sysweb3 from '@pollum-io/sysweb3-network'; +import sysweb3 from '@sidhujag/sysweb3-network'; console.log(sysweb3); // Outputs functions like validateCurrentRpcUrl, validateSysRpc, setSignerNetwork, etc. @@ -55,7 +52,7 @@ console.log(sysweb3); The SysWeb3 Utils package provides utility functions for multi-chain accounts. Example: ```js -import sysweb3 from '@pollum-io/sysweb3-utils'; +import sysweb3 from '@sidhujag/sysweb3-utils'; console.log(sysweb3); // Outputs functions like isValidSYSAddress, isValidEthereumAddress, getNftImage, createContractUsingAbi, etc. @@ -66,7 +63,7 @@ console.log(sysweb3); The SysWeb3 Core package offers browser interaction functions. Example: ```js -import sysweb3 from '@pollum-io/sysweb3-core'; +import sysweb3 from '@sidhujag/sysweb3-core'; console.log(sysweb3); // Outputs functions like useLocalStorageClient, getStateStorageDb, etc. @@ -74,6 +71,10 @@ console.log(sysweb3); ## Development +Use Node.js 26.12.1, pinned in `.nvmrc`, and Yarn 1.22.22 for repository builds and +tests. Run `nvm install && nvm use` before installing dependencies. This build +toolchain pin does not change the published SDK packages' runtime requirements. + ### Scripts - `yarn format`: Format code using Prettier. diff --git a/docs/npm-publish-guide.md b/docs/npm-publish-guide.md new file mode 100644 index 00000000..56571fb1 --- /dev/null +++ b/docs/npm-publish-guide.md @@ -0,0 +1,213 @@ +# Publishing sysweb3 Packages to npm under @syscoin + +This guide explains how to publish the sysweb3 packages to npm under the `@syscoin` organization scope. + +## Prerequisites + +1. **npm Account**: You need an npm account with publish access to the `@syscoin` organization +2. **Node.js**: Version 14 or higher +3. **Yarn**: Version 1.x installed globally + +## Step 1: Run the Migration Script + +First, update all package names from the incorrect format to the proper npm scoped format: + +```bash +cd sysweb3 +node scripts/migrate-to-syscoin-npm.js +``` + +This script will: + +- Update all package names from `syscoin/package-name` to `@sidhujag/package-name` +- Update inter-package dependencies to use the new names +- Update pali-wallet's package.json to reference the new names + +## Step 2: Build All Packages + +Build all packages with their updated names: + +```bash +cd sysweb3 +yarn build:all +``` + +This builds all packages in the correct order: + +1. sysweb3-core +2. sysweb3-network +3. sysweb3-utils +4. sysweb3-keyring + +## Step 3: Login to npm + +Login to npm with your account that has access to the @syscoin organization: + +```bash +npm login --scope=@syscoin +``` + +## Step 4: Verify Package Contents (Optional but Recommended) + +Before publishing, verify what will be published for each package: + +```bash +cd packages/sysweb3-core +yarn release:preflight + +cd ../sysweb3-network +yarn release:preflight + +cd ../sysweb3-utils +yarn release:preflight + +cd ../sysweb3-keyring +yarn release:preflight +``` + +## Step 5: Publish to npm + +### Option A: Publish All at Once + +From the sysweb3 root directory: + +```bash +cd sysweb3 +yarn publish:all +``` + +### Option B: Publish Individually + +If you prefer to publish packages one by one: + +```bash +# Publish core first +cd packages/sysweb3-core +yarn release:npm + +# Then network +cd ../sysweb3-network +yarn release:npm + +# Then utils +cd ../sysweb3-utils +yarn release:npm + +# Finally keyring +cd ../sysweb3-keyring +yarn release:npm +``` + +## Step 6: Update pali-wallet to Use npm Packages + +After publishing, update pali-wallet to use the npm packages instead of local file references: + +```bash +cd pali-wallet + +# Remove local symlinks +rm -rf node_modules/@syscoin + +# Install from npm +yarn add @sidhujag/sysweb3-core@latest @sidhujag/sysweb3-network@latest @sidhujag/sysweb3-utils@latest @sidhujag/sysweb3-keyring@latest +``` + +## Version Management + +### Updating Version Numbers + +Before publishing, update version numbers in each package's package.json: + +```bash +# Example: bump patch version +cd packages/sysweb3-core +npm version patch + +# Or manually edit package.json +``` + +### Version Strategy + +- **Patch**: Bug fixes (1.0.1 → 1.0.2) +- **Minor**: New features, backward compatible (1.0.0 → 1.1.0) +- **Major**: Breaking changes (1.0.0 → 2.0.0) + +## Troubleshooting + +### Permission Denied Error + +If you get a permission error when publishing: + +```bash +npm ERR! 403 Forbidden - You do not have permission to publish "@sidhujag/package-name" +``` + +Make sure: + +1. You're logged in: `npm whoami` +2. You have publish access to @syscoin org +3. The package doesn't already exist with that exact version + +### Package Already Exists + +If a version already exists, bump the version number: + +```bash +cd packages/sysweb3-core +npm version patch +yarn release:npm +``` + +### Build Errors + +If you encounter build errors: + +```bash +# Clean and rebuild +cd sysweb3 +rm -rf packages/*/dist +yarn build:all +``` + +## CI/CD Integration + +For automated publishing, you can use GitHub Actions with npm tokens: + +1. Generate an npm token: https://www.npmjs.com/settings/YOUR_USERNAME/tokens +2. Add it as a GitHub secret: `NPM_TOKEN` +3. Use in GitHub Actions workflow + +## Security Notes + +- Never commit npm tokens or credentials +- Use 2FA on your npm account +- Regularly rotate npm tokens +- Review package contents before publishing + +## Summary + +The complete publishing flow: + +```bash +# 1. Migrate package names +cd sysweb3 +node scripts/migrate-to-syscoin-npm.js + +# 2. Build everything +yarn build:all + +# 3. Login to npm +npm login --scope=@syscoin + +# 4. Publish +yarn publish:all + +# 5. Success! 🎉 +``` + +Your packages are now available at: + +- https://www.npmjs.com/package/@sidhujag/sysweb3-core +- https://www.npmjs.com/package/@sidhujag/sysweb3-network +- https://www.npmjs.com/package/@sidhujag/sysweb3-utils +- https://www.npmjs.com/package/@sidhujag/sysweb3-keyring diff --git a/jest.config.json b/jest.config.json index 2bd4b328..5099ba7b 100644 --- a/jest.config.json +++ b/jest.config.json @@ -14,9 +14,12 @@ "isomorphic-fetch": "/__mocks__/isomorphic-fetch.js" }, "setupFilesAfterEnv": ["/jest.setup.js"], - "globals": { - "ts-jest": { - "isolatedModules": true - } + "transform": { + "^.+\\.tsx?$": [ + "ts-jest", + { + "isolatedModules": true + } + ] } } diff --git a/jest.setup.js b/jest.setup.js index d32979d0..e63baf9b 100644 --- a/jest.setup.js +++ b/jest.setup.js @@ -9,174 +9,6 @@ global.localStorage = { clear: jest.fn(), }; -// Mock ethers providers -jest.mock('ethers', () => { - const actual = jest.requireActual('ethers'); - - class MockJsonRpcProvider { - _isProvider = true; - _events = []; - _emitted = { block: -2 }; - disableCcipRead = false; - anyNetwork = false; - _networkPromise = Promise.resolve({ chainId: 80001, name: 'mumbai' }); - _maxInternalBlockNumber = -1024; - _lastBlockNumber = -2; - _maxFilterBlockRange = 10; - _pollingInterval = 4000; - _fastQueryDate = 0; - connection = { url: 'http://localhost:8545' }; - _nextId = 42; - - constructor() {} - - async getNetwork() { - return { chainId: 80001, name: 'mumbai' }; - } - - async getBalance() { - return actual.BigNumber.from('1000000000000000000'); - } - - async getBlock(blockTag) { - // Return a mock block for testing - return { - number: 12345, - timestamp: Math.floor(Date.now() / 1000), - baseFeePerGas: actual.BigNumber.from('20000000000'), - gasLimit: actual.BigNumber.from('30000000'), - gasUsed: actual.BigNumber.from('21000'), - transactions: [], - hash: '0x1234567890123456789012345678901234567890123456789012345678901234', - }; - } - - async getFeeData() { - return { - maxFeePerGas: actual.BigNumber.from('40000000000'), - maxPriorityFeePerGas: actual.BigNumber.from('2000000000'), - gasPrice: actual.BigNumber.from('20000000000'), - }; - } - - async getCode(address) { - const contracts = [ - '0x0c702f78b889f25e3347fb978345f7ecf4f3861c', - '0xd19018f7946d518d316bb10fdff118c28835cf7a', - '0xaa54a8e8bdea1aa7e2ed7e5f681c798a8ed7e5ab', - '0x07865c6e87b9f70255377e024ace6630c1eaa37f', - '0x1297228a708602b796fa16e9a7683db9cde09436', - '0x628a9db47d7aeb6cf80ebf8c441bb72a83ddb08e', - '0x68b3465833fb72a70ecdf485e0e4c7bd8665fc45', - '0xa6fa4fb5f76172d178d61b04b0ecd319c5d1c0aa', - ]; - - // Normalize address for comparison - if (!address || typeof address !== 'string') return '0x'; - const normalizedAddress = address.toLowerCase().trim(); - const isContract = contracts.some( - (c) => normalizedAddress === c.toLowerCase() - ); - - // Debug logging - if ( - address - .toLowerCase() - .includes('0x0c702f78b889f25e3347fb978345f7ecf4f3861c') - ) { - console.log('getCode debug:', { - address, - normalizedAddress, - isContract, - }); - } - - return isContract ? '0x608060405234801561001057600080fd5b50' : '0x'; - } - - async call() { - return '0x0000000000000000000000000000000000000000000000000000000000000001'; - } - - async estimateGas() { - return actual.BigNumber.from('21000'); - } - - async getGasPrice() { - return actual.BigNumber.from('20000000000'); - } - - async getTransactionCount() { - return 0; - } - - async sendTransaction(tx) { - return { - hash: '0x1234567890123456789012345678901234567890123456789012345678901234', - wait: async () => ({ - status: 1, - transactionHash: - '0x1234567890123456789012345678901234567890123456789012345678901234', - }), - }; - } - } - - return { - ...actual, - providers: { - ...actual.providers, - JsonRpcProvider: MockJsonRpcProvider, - }, - Contract: jest.fn().mockImplementation((address, abi, provider) => { - const lowerAddress = address.toLowerCase(); - - // Determine contract type based on address - const erc721Addresses = ['0x0c702f78b889f25e3347fb978345f7ecf4f3861c']; - const erc1155Addresses = ['0xaa54a8e8bdea1aa7e2ed7e5f681c798a8ed7e5ab']; - const erc20Addresses = ['0xa6fa4fb5f76172d178d61b04b0ecd319c5d1c0aa']; - - const isERC721 = erc721Addresses.some( - (a) => a.toLowerCase() === lowerAddress - ); - const isERC1155 = erc1155Addresses.some( - (a) => a.toLowerCase() === lowerAddress - ); - const isERC20 = erc20Addresses.some( - (a) => a.toLowerCase() === lowerAddress - ); - - return { - balanceOf: jest.fn().mockImplementation(async (_addr) => { - // For ERC721 NFT, return 0 for first address, 1 for second - if ( - isERC721 && - lowerAddress === '0x0c702f78b889f25e3347fb978345f7ecf4f3861c' - ) { - return actual.BigNumber.from('0'); - } - return actual.BigNumber.from('1'); - }), - supportsInterface: jest.fn().mockImplementation(async (interfaceId) => { - if (!isERC721 && !isERC1155) { - throw new Error('Contract does not support supportsInterface'); - } - if (interfaceId === '0x80ac58cd' && isERC721) return true; // ERC721 - if (interfaceId === '0xd9b67a26' && isERC1155) return true; // ERC1155 - return false; - }), - ownerOf: jest - .fn() - .mockResolvedValue('0x1234567890123456789012345678901234567890'), - tokenURI: jest.fn().mockResolvedValue('https://example.com/token/1'), - symbol: jest.fn().mockResolvedValue('TEST'), - name: jest.fn().mockResolvedValue('Test Token'), - decimals: jest.fn().mockResolvedValue(18), - }; - }), - }; -}); - // Mock crypto for tests global.crypto = { randomBytes: (size) => Buffer.alloc(size, 1), @@ -209,7 +41,7 @@ afterAll(() => { }); // Mock sysweb3 storage -jest.mock('@pollum-io/sysweb3-core', () => { +jest.mock('@sidhujag/sysweb3-core', () => { const mockStorage = { vault: null, set: jest.fn((key, value) => { diff --git a/package.json b/package.json index fa491f44..ac99e43e 100644 --- a/package.json +++ b/package.json @@ -1,14 +1,16 @@ { - "name": "@pollum-io/sysweb3", + "name": "@sidhujag/sysweb3", "version": "1.0.34", "description": "Syscoin Web3 JavaScript API", "author": "Pali Wallet", "email": "support@syscoin.org", "license": "MIT", - "homepage": "https://github.com/Pollum-io/sysweb3#readme", + "homepage": "https://github.com/syscoin/sysweb3#readme", "engines": { - "yarn": ">= 1.0.0" + "node": ">=26.12.1 <27", + "yarn": ">=1.22.22 <2" }, + "packageManager": "yarn@1.22.22", "private": true, "workspaces": [ "packages/*/dist/*" @@ -19,49 +21,36 @@ "lint:fix": "eslint . --ext .ts --fix", "prepare": "husky install", "test": "jest", - "type-check": "tsc --pretty --noEmit" + "type-check": "tsc --pretty --noEmit", + "build:all": "cd packages/sysweb3-core && yarn publishCode && cd ../sysweb3-network && yarn publishCode && cd ../sysweb3-utils && yarn publishCode && cd ../sysweb3-keyring && yarn publishCode", + "publish:all": "cd packages/sysweb3-core && yarn release:npm && cd ../sysweb3-network && yarn release:npm && cd ../sysweb3-utils && yarn release:npm && cd ../sysweb3-keyring && yarn release:npm" }, "lint-staged": { "*.ts": "eslint --cache --fix" }, "repository": { "type": "git", - "url": "git+https://github.com/Pollum-io/sysweb3.git" + "url": "git+https://github.com/syscoin/sysweb3.git" }, "bugs": { - "url": "https://github.com/Pollum-io/sysweb3/issues" + "url": "https://github.com/syscoin/sysweb3/issues" }, "devDependencies": { "@babel/core": "^7.17.4", "@babel/preset-env": "^7.16.11", "@babel/preset-typescript": "^7.16.7", - "@types/crypto-js": "^4.1.0", - "@types/jest": "^27.4.0", - "@types/lodash": "^4.14.178", - "@types/node": "^17.0.13", - "@typescript-eslint/eslint-plugin": "^5.10.1", - "@typescript-eslint/parser": "^5.10.1", - "dotenv": "^16.0.3", - "eslint": "^8.7.0", - "eslint-config-airbnb-base": "^15.0.0", + "@typescript-eslint/eslint-plugin": "^7.18.0", + "@typescript-eslint/parser": "^7.18.0", + "eslint": "^8.57.1", "eslint-config-prettier": "^8.5.0", "eslint-plugin-import": "^2.25.4", "eslint-plugin-prettier": "^4.0.0", "husky": "^7.0.4", "isomorphic-fetch": "^3.0.0", - "jest": "^27.5.1", + "jest": "^29.7.0", "lint-staged": "^12.4.1", - "minimist": "1.2.6", "prettier": "^2.6.0", - "prettier-eslint": "^13.0.0", - "standard-version": "^9.3.2", - "ts-jest": "^27.1.3", - "ts-node": "^10.4.0", - "tslib": "^2.4.0", - "typescript": "^4.6.2" - }, - "dependencies": { - "@ledgerhq/devices": "^8.4.5", - "ethers": "^5.7.2" + "ts-jest": "^29.4.0", + "typescript": "^5.3.3" } } diff --git a/packages/sysweb3-core/package.json b/packages/sysweb3-core/package.json index 7e384216..bce5d061 100644 --- a/packages/sysweb3-core/package.json +++ b/packages/sysweb3-core/package.json @@ -1,12 +1,12 @@ { - "name": "@pollum-io/sysweb3-core", - "version": "1.0.27", + "name": "@sidhujag/sysweb3-core", + "version": "1.0.29", "description": "The localStorage Manager For PrivKeys", "main": "cjs/index.js", "types": "types/index.d.ts", "repository": { "type": "git", - "url": "git+https://github.com/Pollum-io/sysweb3.git" + "url": "git+https://github.com/syscoin/sysweb3.git" }, "author": "Pali Wallet", "license": "MIT", @@ -19,13 +19,14 @@ "build": "tsc && tsc -p tsconfig.json", "prerelease": "yarn build", "copy": "node ../../scripts/package/copy", - "release:npm": "yarn publish ./dist --access=public --no-git-tag-version", + "release:npm": "yarn publish ./dist --access public --no-git-tag-version", "release:preflight": "yarn pack ./dist --dry-run", "publishCode": "yarn prebuild && yarn prerelease && yarn copy && yarn release:npm", "type-check": "tsc --pretty --noEmit", "localTest": "yarn prebuild && yarn build && yarn copy" }, "devDependencies": { - "rimraf": "^6.0.1" + "rimraf": "^6.1.2", + "typescript": "5.9.3" } } diff --git a/packages/sysweb3-core/readme.md b/packages/sysweb3-core/readme.md index fc9f309b..580fd4be 100644 --- a/packages/sysweb3-core/readme.md +++ b/packages/sysweb3-core/readme.md @@ -13,15 +13,15 @@ For use this library, is nice to have: For install, you can follow these commands: -- `yarn add @pollum-io/sysweb3-core` -- `npm install @pollum-io/sysweb3-core` +- `yarn add @sidhujag/sysweb3-core` +- `npm install @sidhujag/sysweb3-core` ## Usage The sysweb3-core was builded to have a really simple usability. For example, you can import package and console it to know what kind of functions you'll find: ```js -import sysweb3 from '@pollum-io/sysweb3-core'; +import sysweb3 from '@sidhujag/sysweb3-core'; console.log(sysweb3); @@ -40,6 +40,26 @@ These methods are just some of the ones available in our library. Feel free to explore the possibilities. We hope you enjoy it. +## Conditional creation + +`createManyIfAbsent(items)` creates a set of prefixed records only when all of +them are absent, returning `true` for the creator and `false` when a record +already exists. Write failures reject its promise. + +- The built-in memory client checks and commits synchronously. +- Native `chrome.storage.local` or `browser.storage.local` clients require + `navigator.locks`. A lock named for the captured storage prefix covers the + complete read, absence check, and awaited batch write. This coordinates + contexts in the same extension origin and storage partition. +- Custom clients must implement `createItemsIfAbsent(items)`, accepting the + prefixed, JSON-serialized values and returning `boolean | Promise`. + That method must enforce the absence check and commit atomically in the + backend. A separate read followed by an ordinary write does not satisfy it. + +There is no unlocked or sequential fallback. Backends shared across different +origins or storage partitions need their own atomic implementation or a single +owner. Existing `get`, `set`, `setMany`, and delete behavior is unchanged. + ## License MIT License diff --git a/packages/sysweb3-core/src/index.ts b/packages/sysweb3-core/src/index.ts index 59c03109..6c2f4a3b 100644 --- a/packages/sysweb3-core/src/index.ts +++ b/packages/sysweb3-core/src/index.ts @@ -2,14 +2,22 @@ import { parseJsonRecursively } from './utils'; interface IStateStorageClient { getItem(key: string): string | null; - removeItem(key: string): void; - setItem(key: string, value: string): void; + removeItem(key: string): void | Promise; + setItem(key: string, value: string): void | Promise; + // Optional all-or-nothing batch for clients without a native set(items). + setItems?(items: Record): void | Promise; + // Backend-enforced atomic creation: false means at least one key exists. + createItemsIfAbsent?( + items: Record + ): boolean | Promise; } export interface IKeyValueDb { - deleteItem(key: string): void; + deleteItem(key: string): void | Promise; get(key: string): any; - set(key: string, value: any): void; + set(key: string, value: any): void | Promise; + setMany(items: Record): void | Promise; + createManyIfAbsent(items: Record): Promise; setClient(client?: IStateStorageClient): void; setPrefix(prefix: string): void; } @@ -40,11 +48,91 @@ const StateStorageDb = ( if (!storageClient) return; if ('set' in storageClient) { - storageClient.set({ [keyPrefix + key]: value }); - return; + return storageClient.set({ [keyPrefix + key]: value }); } - storageClient.setItem(keyPrefix + key, JSON.stringify(value)); + return storageClient.setItem(keyPrefix + key, JSON.stringify(value)); + }; + + const setMany = (items: Record) => { + // Never emulate an atomic write with a sequence of setItem calls. + // Chrome storage and the built-in memory client can commit the whole batch. + if (storageClient && typeof storageClient.set === 'function') { + const prefixed = Object.fromEntries( + Object.entries(items).map(([key, value]) => [keyPrefix + key, value]) + ); + return storageClient.set(prefixed); + } + if (storageClient && typeof storageClient.setItems === 'function') { + const serialized = Object.fromEntries( + Object.entries(items).map(([key, value]) => [ + keyPrefix + key, + JSON.stringify(value), + ]) + ); + return storageClient.setItems(serialized); + } + throw new Error('Storage adapter does not support atomic batch writes'); + }; + + const createManyIfAbsent = async ( + items: Record + ): Promise => { + // Capture the target before waiting so a later setClient/setPrefix cannot + // move the check and write to different storage namespaces. + const client = storageClient; + const prefix = keyPrefix; + const entries = Object.entries(items).map(([key, value]) => [ + prefix + key, + value, + ]); + if (client && typeof client.createItemsIfAbsent === 'function') { + const serialized = Object.fromEntries( + entries.map(([key, value]) => [key, JSON.stringify(value)]) + ); + const created = await client.createItemsIfAbsent(serialized); + if (typeof created !== 'boolean') + throw new Error('Atomic storage creation returned an invalid result'); + return created; + } + + const globals = globalThis as any; + const nativeLocal = + client && + (client === globals.chrome?.storage?.local || + client === globals.browser?.storage?.local); + const locks = globals.navigator?.locks; + if ( + !nativeLocal || + typeof client.get !== 'function' || + typeof client.set !== 'function' || + typeof locks?.request !== 'function' + ) { + throw new Error('Storage adapter does not support atomic creation'); + } + + // Web Locks coordinate extension contexts in the same origin/storage + // partition. Custom/shared backends must supply their own atomic method. + return locks.request( + `sysweb3:create:${prefix}`, + { mode: 'exclusive' }, + async () => { + const keys = entries.map(([key]) => key); + const existing = await client.get(keys); + if (!existing || typeof existing !== 'object') + throw new Error( + 'Atomic storage creation could not read existing keys' + ); + if ( + keys.some( + (key) => existing[key] !== undefined && existing[key] !== null + ) + ) + return false; + await client.set(Object.fromEntries(entries)); + return true; + } + ); }; const get = async (key: string): Promise => { @@ -68,17 +156,18 @@ const StateStorageDb = ( const deleteItem = (key: string) => { if (!storageClient) return; if ('remove' in storageClient) { - storageClient.remove(keyPrefix + key); - return; + return storageClient.remove(keyPrefix + key); } - storageClient.removeItem(keyPrefix + key); + return storageClient.removeItem(keyPrefix + key); }; return { setClient, setPrefix, set, + setMany, + createManyIfAbsent, get, deleteItem, }; @@ -91,6 +180,21 @@ const MemoryStorageClient = (): IStateStorageClient => { memory[key] = value; }; + const setItems = (items: Record) => { + Object.assign(memory, items); + }; + + const createItemsIfAbsent = (items: Record) => { + if ( + Object.keys(items).some( + (key) => memory[key] !== undefined && memory[key] !== null + ) + ) + return false; + Object.assign(memory, items); + return true; + }; + const getItem = (key: string): any => memory[key]; const removeItem = (key: string) => { @@ -99,6 +203,8 @@ const MemoryStorageClient = (): IStateStorageClient => { return { setItem, + setItems, + createItemsIfAbsent, getItem, removeItem, }; diff --git a/packages/sysweb3-core/yarn.lock b/packages/sysweb3-core/yarn.lock index 4a9b5b02..3ffc4658 100644 --- a/packages/sysweb3-core/yarn.lock +++ b/packages/sysweb3-core/yarn.lock @@ -14,122 +14,24 @@ dependencies: "@isaacs/balanced-match" "^4.0.1" -"@isaacs/cliui@^8.0.2": - version "8.0.2" - resolved "https://registry.yarnpkg.com/@isaacs/cliui/-/cliui-8.0.2.tgz#b37667b7bc181c168782259bab42474fbf52b550" - integrity sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA== +glob@^13.0.0: + version "13.0.0" + resolved "https://registry.yarnpkg.com/glob/-/glob-13.0.0.tgz#9d9233a4a274fc28ef7adce5508b7ef6237a1be3" + integrity sha512-tvZgpqk6fz4BaNZ66ZsRaZnbHvP/jG3uKJvAZOwEVUL4RTA5nJeeLYfyN9/VA8NX/V3IBG+hkeuGpKjvELkVhA== dependencies: - string-width "^5.1.2" - string-width-cjs "npm:string-width@^4.2.0" - strip-ansi "^7.0.1" - strip-ansi-cjs "npm:strip-ansi@^6.0.1" - wrap-ansi "^8.1.0" - wrap-ansi-cjs "npm:wrap-ansi@^7.0.0" - -ansi-regex@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" - integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== - -ansi-regex@^6.0.1: - version "6.1.0" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-6.1.0.tgz#95ec409c69619d6cb1b8b34f14b660ef28ebd654" - integrity sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA== - -ansi-styles@^4.0.0: - version "4.3.0" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" - integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== - dependencies: - color-convert "^2.0.1" - -ansi-styles@^6.1.0: - version "6.2.1" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-6.2.1.tgz#0e62320cf99c21afff3b3012192546aacbfb05c5" - integrity sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug== - -color-convert@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" - integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== - dependencies: - color-name "~1.1.4" - -color-name@~1.1.4: - version "1.1.4" - resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" - integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== - -cross-spawn@^7.0.6: - version "7.0.6" - resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.6.tgz#8a58fe78f00dcd70c370451759dfbfaf03e8ee9f" - integrity sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA== - dependencies: - path-key "^3.1.0" - shebang-command "^2.0.0" - which "^2.0.1" - -eastasianwidth@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/eastasianwidth/-/eastasianwidth-0.2.0.tgz#696ce2ec0aa0e6ea93a397ffcf24aa7840c827cb" - integrity sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA== - -emoji-regex@^8.0.0: - version "8.0.0" - resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" - integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== - -emoji-regex@^9.2.2: - version "9.2.2" - resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-9.2.2.tgz#840c8803b0d8047f4ff0cf963176b32d4ef3ed72" - integrity sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg== - -foreground-child@^3.3.1: - version "3.3.1" - resolved "https://registry.yarnpkg.com/foreground-child/-/foreground-child-3.3.1.tgz#32e8e9ed1b68a3497befb9ac2b6adf92a638576f" - integrity sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw== - dependencies: - cross-spawn "^7.0.6" - signal-exit "^4.0.1" - -glob@^11.0.0: - version "11.0.3" - resolved "https://registry.yarnpkg.com/glob/-/glob-11.0.3.tgz#9d8087e6d72ddb3c4707b1d2778f80ea3eaefcd6" - integrity sha512-2Nim7dha1KVkaiF4q6Dj+ngPPMdfvLJEOpZk/jKiUAkqKebpGAWQXAq9z1xu9HKu5lWfqw/FASuccEjyznjPaA== - dependencies: - foreground-child "^3.3.1" - jackspeak "^4.1.1" - minimatch "^10.0.3" + minimatch "^10.1.1" minipass "^7.1.2" - package-json-from-dist "^1.0.0" path-scurry "^2.0.0" -is-fullwidth-code-point@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" - integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== - -isexe@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" - integrity sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw== - -jackspeak@^4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/jackspeak/-/jackspeak-4.1.1.tgz#96876030f450502047fc7e8c7fcf8ce8124e43ae" - integrity sha512-zptv57P3GpL+O0I7VdMJNBZCu+BPHVQUk55Ft8/QCJjTVxrnJHuVuX/0Bl2A6/+2oyR/ZMEuFKwmzqqZ/U5nPQ== - dependencies: - "@isaacs/cliui" "^8.0.2" - lru-cache@^11.0.0: - version "11.1.0" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-11.1.0.tgz#afafb060607108132dbc1cf8ae661afb69486117" - integrity sha512-QIXZUBJUx+2zHUdQujWejBkcD9+cs94tLn0+YL8UrCh+D5sCXZ4c7LaEH48pNwRY3MLDgqUFyhlCyjJPf1WP0A== + version "11.2.4" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-11.2.4.tgz#ecb523ebb0e6f4d837c807ad1abaea8e0619770d" + integrity sha512-B5Y16Jr9LB9dHVkh6ZevG+vAbOsNOYCX+sXvFWFu7B3Iz5mijW3zdbMyhsh8ANd2mSWBYdJgnqi+mL7/LrOPYg== -minimatch@^10.0.3: - version "10.0.3" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-10.0.3.tgz#cf7a0314a16c4d9ab73a7730a0e8e3c3502d47aa" - integrity sha512-IPZ167aShDZZUMdRk66cyQAW3qr0WzbHkPdMYa8bzZhlHhO3jALbKdxcaak7W9FfT2rZNpQuUu4Od7ILEpXSaw== +minimatch@^10.1.1: + version "10.1.1" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-10.1.1.tgz#e6e61b9b0c1dcab116b5a7d1458e8b6ae9e73a55" + integrity sha512-enIvLvRAFZYXJzkCYG5RKmPfrFArdLv+R+lbQ53BmIMLIry74bjKzX6iHAm8WYamJkhSSEabrWN5D97XnKObjQ== dependencies: "@isaacs/brace-expansion" "^5.0.0" @@ -138,118 +40,28 @@ minipass@^7.1.2: resolved "https://registry.yarnpkg.com/minipass/-/minipass-7.1.2.tgz#93a9626ce5e5e66bd4db86849e7515e92340a707" integrity sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw== -package-json-from-dist@^1.0.0: +package-json-from-dist@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz#4f1471a010827a86f94cfd9b0727e36d267de505" integrity sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw== -path-key@^3.1.0: - version "3.1.1" - resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" - integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== - path-scurry@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/path-scurry/-/path-scurry-2.0.0.tgz#9f052289f23ad8bf9397a2a0425e7b8615c58580" - integrity sha512-ypGJsmGtdXUOeM5u93TyeIEfEhM6s+ljAhrk5vAvSx8uyY/02OvrZnA0YNGUrPXfpJMgI1ODd3nwz8Npx4O4cg== + version "2.0.1" + resolved "https://registry.yarnpkg.com/path-scurry/-/path-scurry-2.0.1.tgz#4b6572376cfd8b811fca9cd1f5c24b3cbac0fe10" + integrity sha512-oWyT4gICAu+kaA7QWk/jvCHWarMKNs6pXOGWKDTr7cw4IGcUbW+PeTfbaQiLGheFRpjo6O9J0PmyMfQPjH71oA== dependencies: lru-cache "^11.0.0" minipass "^7.1.2" -rimraf@^6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-6.0.1.tgz#ffb8ad8844dd60332ab15f52bc104bc3ed71ea4e" - integrity sha512-9dkvaxAsk/xNXSJzMgFqqMCuFgt2+KsOFek3TMLfo8NCPfWpBmqwyNn5Y+NX56QUYfCtsyhF3ayiboEoUmJk/A== - dependencies: - glob "^11.0.0" - package-json-from-dist "^1.0.0" - -shebang-command@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" - integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA== - dependencies: - shebang-regex "^3.0.0" - -shebang-regex@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" - integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== - -signal-exit@^4.0.1: - version "4.1.0" - resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-4.1.0.tgz#952188c1cbd546070e2dd20d0f41c0ae0530cb04" - integrity sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw== - -"string-width-cjs@npm:string-width@^4.2.0": - version "4.2.3" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" - integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.1" - -string-width@^4.1.0: - version "4.2.3" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" - integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.1" - -string-width@^5.0.1, string-width@^5.1.2: - version "5.1.2" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-5.1.2.tgz#14f8daec6d81e7221d2a357e668cab73bdbca794" - integrity sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA== +rimraf@^6.1.2: + version "6.1.2" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-6.1.2.tgz#9a0f3cea2ab853e81291127422116ecf2a86ae89" + integrity sha512-cFCkPslJv7BAXJsYlK1dZsbP8/ZNLkCAQ0bi1hf5EKX2QHegmDFEFA6QhuYJlk7UDdc+02JjO80YSOrWPpw06g== dependencies: - eastasianwidth "^0.2.0" - emoji-regex "^9.2.2" - strip-ansi "^7.0.1" + glob "^13.0.0" + package-json-from-dist "^1.0.1" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" - integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== - dependencies: - ansi-regex "^5.0.1" - -strip-ansi@^6.0.0, strip-ansi@^6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" - integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== - dependencies: - ansi-regex "^5.0.1" - -strip-ansi@^7.0.1: - version "7.1.0" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45" - integrity sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ== - dependencies: - ansi-regex "^6.0.1" - -which@^2.0.1: - version "2.0.2" - resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" - integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== - dependencies: - isexe "^2.0.0" - -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" - integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== - dependencies: - ansi-styles "^4.0.0" - string-width "^4.1.0" - strip-ansi "^6.0.0" - -wrap-ansi@^8.1.0: - version "8.1.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214" - integrity sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ== - dependencies: - ansi-styles "^6.1.0" - string-width "^5.0.1" - strip-ansi "^7.0.1" +typescript@5.9.3: + version "5.9.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.9.3.tgz#5b4f59e15310ab17a216f5d6cf53ee476ede670f" + integrity sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw== diff --git a/packages/sysweb3-keyring/.npmignore b/packages/sysweb3-keyring/.npmignore new file mode 100644 index 00000000..d5cee272 --- /dev/null +++ b/packages/sysweb3-keyring/.npmignore @@ -0,0 +1,6 @@ +# Source tests are checked in the repository, not shipped to consumers. +**/__tests__/** +**/test/** +**/tests/** +**/*.test.* +**/*.spec.* diff --git a/packages/sysweb3-keyring/CHANGELOG.md b/packages/sysweb3-keyring/CHANGELOG.md new file mode 100644 index 00000000..b39e1ab2 --- /dev/null +++ b/packages/sysweb3-keyring/CHANGELOG.md @@ -0,0 +1,156 @@ +# Changelog + +## 2.2.0 + +- Expose dependency-free `cjs/evm-fees` for the existing standard EVM fee recommendation and make `EthereumTransactions` use the same implementation. +- Keep observed legacy/EIP-1559 behavior, zero tips, configured floors/multipliers, and unsupported-method-only history fallback. Add uint256/history bounds, snapshot options, synchronous host guards and cancellation checks for restricted hosts. + +## 2.1.0 + +- Add the standalone `cjs/public-bip84` entry for strict Bitcoin/Syscoin mainnet account parsing and native SegWit address derivation. It returns public data only; an account public key does not prove ancestry or ownership. +- Add `SoftwareKeyring.deriveBip84HdPublicAccount` for guarded public derivation from an unlocked software HD wallet, without selecting accounts, writing storage or discovering addresses. +- Add the standalone `cjs/bip84-native` planner for bounded native-coin P2WPKH transactions with explicit parent data, change, RBF and exact fee limits. Asset, special and coinbase parents are excluded. +- Add `SoftwareKeyring.signPreparedBip84Transaction` for the selected Bitcoin/Syscoin mainnet HD account. It binds the account, network and synchronous host guard, verifies the rebuilt transaction and signatures, and returns immutable signed bytes, identifiers and exact fee/size data. +- These offline APIs do not unlock, access a provider, persist records or broadcast. Hosts still own input eligibility, fresh approval, change reservations and durable journaling before broadcast. Existing vault, EVM, generic PSBT and hardware APIs remain unchanged; native and live qualification remain separate. + +## 2.0.0 + +- Add `SoftwareKeyring.deriveEvmHdRuntimeAccount` for host-allocated Ethereum BIP44 indices. It returns the existing password-encrypted runtime account record without installing an account, writing storage or querying a network. The method binds session, selection and network identity and requires a synchronous host guard. Hosts must strip encrypted `xprv` before producing public metadata. + +- Add `SoftwareKeyring.signPreparedEvmTransaction` for offline signing of fully specified legacy/EIP-1559 envelopes. The request binds the selected software account and exact network/endpoint, requires synchronous host admission, validates all signed fields and recovered identity, and returns immutable signed bytes plus their local hash. It never estimates fees, resolves names, fills fields or broadcasts; hosts must durably retain the result before submission and reconcile uncertain broadcasts by hash. + +- Breaking: Ledger signing requires an explicitly injected semantic `LedgerHost`. Raw LedgerJS transports/clients are removed; use the isolated browser ESM host entry for device access. +- Adopt current Device Management Kit and Ethereum signer packages while preserving the custom Syscoin/Bitcoin protocol. Serialize device operations and reject stale, wrong-account, malformed and mismatched-sighash responses. +- Disable remote Ledger metadata/transaction checks/telemetry by default. Require fresh per-intent consent for transaction/typed-data signing that may fall back to blind signing. +- Bind receive addresses to public account derivation, preserve on-device approval for unusual paths, and snapshot queued UTXO requests before connection awaits. +- Existing software-only entry, vault formats and account derivation remain compatible. Host/device and native-runtime qualification are separate requirements. + +- Remove the legacy Trezor UTXO library. Reuse Bitcoinjs address decoding with a checksum-verified two-byte-version compatibility path, and encode witness vectors with the public CompactSize codec. + +- Move Trezor hardware integration to Connect 10.0.1 and remove the redundant direct Connect Web dependency. +- Load the browser transport only inside a supported MV3 extension. Preserve CommonJS/ESM and software-entry imports without browser globals or device initialization. +- Preserve the existing SDK failure payload while retaining Connect error codes; stop retrying cancellations, disconnects and unsupported hosts/coins. +- Replace removed Connect device events with status updates from request outcomes and disposal. Immediate physical unplug notifications are no longer exposed by upstream. +- Reject pending calls locally on lock/disposal and discard late responses. Defer remote cleanup while requests are outstanding; return `HARDWARE_SIGNER_BUSY` until they settle rather than opening another approval prompt. +- Normalize Trezor hexadecimal recovery values without mutating signed responses; preserve approved transaction and session checks. +- Physical device qualification and consuming-extension Suite Web permissions remain release gates. + +## 1.0.628 + +- Add the `cjs/software` entry with explicit asynchronous host storage and an opaque wallet-authority handle. Software keyrings do not load browser hardware transports or global storage. +- Keep the legacy `KeyringManager` entry and normal device defaults. The software entry rejects unavailable hardware, storage rebinding, direct session injection and cross-authority session transfer. +- Expose reusable vault persistence and software transaction cores with typed deep imports. Preserve vault encryption formats, KDF profiles, private-record domains and account derivation. +- Move Pali's existing cancellation fee-consent safeguards into source: optional unsigned preview and selected payer, required approved fee ceiling for sending, and final populated-envelope validation. +- Preserve the original value of a MAX-send replacement; return `REPLACEMENT_VALUE_WOULD_CHANGE` if the higher fee cannot be funded without reducing it. +- Add an optional synchronous final validator to local transaction sending. Promise/thenable decisions are rejected before signing; the existing five-argument call remains supported. +- Exclude compiled test fixtures from the published package; runtime code and declarations are unchanged. + +### Cancellation callers + +A cancellation send now requires `approvedMaximumFee` (decimal wei), in addition to the existing synchronous `assertCurrentContext` and `validateOriginal` callbacks. `previewOnly: true` returns `maximumFee` without requesting credentials, device signing or broadcast. After the user deliberately reviews and approves that fee ceiling, pass the approved value when sending; a later higher fee is rejected. `targetAccount` selects the supported outer payer while the host's selected-account context remains guarded. + +Pali already enforces these rules through its 1.0.627 package patch. It may remove that patch only when adopting this release and validating the actual installed package. + +### Host integration limits + +The software entry is a low-level SDK, not a native-wallet security boundary by itself. The host must invalidate its authorization generation immediately on lock/background, clear late unlock results, and control public-state publication. Native cryptographic/storage adapters, biometrics, device behavior and full mobile functionality still require their own implementation and qualification. See `docs/software-entry.md` and `docs/storage-core.md` in the source repository. + +## 1.0.626 + +- Add an optional synchronous host guard to formatted EVM transaction submission. The SDK captures it once and rechecks it with the existing account, network and session guards before signing and broadcast. +- Reject asynchronous or invalid host guards before signing. Preserve acknowledged transaction results and the existing classification of ambiguous broadcast failures. + +## 1.0.625 + +- Add session-bound encryption for application-owned private records using native HKDF-SHA256 and AES-256-GCM, without exporting the wallet root or encryption keys. +- Authenticate record domain, ID, version and profile; reject asynchronous results when the source session is locked, replaced or transferred. +- Keep storage and backups in the host application. Random records require their encrypted backups; the seed alone cannot recreate missing records. + +## 1.0.622 + +- Bind EVM cancellation to its captured account, network, provider and available wallet-session guard. Reject context changes after RPC reads, after hardware approval, and before signing or broadcasting. +- Require a fourth `cancelSentTransaction` argument with a synchronous `assertCurrentContext` host callback. Missing or invalid context is rejected before RPC, key or device access. Hosts whose selected account differs from a temporary keyring gas-payer selection must guard their real selection and session with this callback. +- Preserve cancellation's original/fallback nonce, zero-value self-transfer, fixed 42000 gas limit and exact replacement fee arithmetic for software, Ledger and Trezor accounts. Keep an acknowledged transaction hash if context changes after submission. +- Automated tests use deterministic public fixture keys, fake RPC providers and simulated device responses. They do not establish physical-device certification or live-network transaction acceptance. + +### Required cancellation caller migration + +Cancellation has one guarded entry point. Callers must supply the original transaction hash, an explicit fee-mode value, the original nonce or `undefined`, and a context guard that throws synchronously if their approved account, network or wallet session changes: + +```ts +await keyring.ethereumTransaction.cancelSentTransaction( + originalHash, + isLegacy, + originalNonce, + { assertCurrentContext } +); +``` + +The former two/three-argument cancellation call is rejected. The host guard supplements the SDK's captured keyring context; it is not a second execution path. This release changes no deployed smart-account contract, storage layout or account migration mechanism. + +## 1.0.617 + +- Preserve valid zero-priority EIP-1559 fees and supported BigNumberish fee overrides without silently changing the transaction fee model. +- Separate actual network gas prices from fee recommendations; only use fee history for a confirmed unsupported priority-fee RPC, and retain RPC integrity checks. +- Preserve zero priority quotes in cancellation and use exact integer replacement arithmetic. Correct dist-only, no-hook release preflight. +- Fee/RPC source validation: 373 tests passed. No new wallet RPC method or fee-bound capability is introduced. + +## 1.0.615 + +### Current hardware connection support + +- Enable Trezor Connect's stable automatic Suite Desktop route and identify Pali Wallet in its permission prompt. Safe 7 requires this Suite flow; the legacy popup remains available through Connect's established fallback for older devices. +- Retain the production Connect origin and current transports. No beta Suite Web bridge, custom pairing state or dependency upgrade is introduced. +- Add compatibility tests for Nano Gen5, Flex and Stax through the installed Ledger WebHID library. The declared WebHID minimum already includes these model identifiers. + +### Host integration and validation limits + +For Safe 7, open the current Trezor Suite Desktop, select and unlock the intended device/wallet, then approve Pali's request in Suite. The host must permit `ws://127.0.0.1:21335/connect-ws` in `connect-src`; allow this exact local endpoint rather than a broad `ws:` or localhost wildcard. Browser local-network permission must also permit the connection. Without Suite available, stable Connect can fall back to the legacy popup, which cannot serve Safe 7. + +The current Safe family is Safe 3, Safe 5 and Safe 7. Future devices require support from Trezor's SDK and Suite; this release does not certify unannounced models. Ledger coverage is for USB/WebHID, including Nano Gen5, Flex and Stax, and retains existing signing protocols. Separate device-app availability, including the Syscoin app, must be checked per device model. + +Automated validation exercises the actual installed Connect bundle and Ledger WebHID/model resolution with simulated browser/device I/O. This establishes host routing and protocol compatibility, not physical device signing, firmware certification or live transaction acceptance. The replacement signing protections from 1.0.614 remain intact. + +## 1.0.614 + +### EVM Speed Up signing + +- Authenticate the original signed transaction against its requested hash, selected gas payer and configured chain before credential or device access. Support signed types 0, 1 and 2; reject unsupported envelopes and unprotected legacy originals. +- Derive type-0/type-2 fee mode from the signed envelope. Preserve type-1 access lists; `isLegacy: true` retains type 1 for software/Ledger, while false converts it to type 2 using its signed gas price as the fee baseline. Trezor type-1 preservation is rejected before prompting; conversion to type 2 remains supported. +- Preview the maximum execution gas fee without signing or broadcasting. Sending requires an explicit approved ceiling. Final construction cannot exceed it, including when a zero-fee original needs a fresh RPC estimate. +- Select a local outer gas payer with `targetAccount` for smart-account replacements without changing the active account. Capture the provider and signed body across asynchronous work; check returned hardware signatures against the selected payer. +- Add an optional local-signing context check immediately before signing. Existing `beforeBroadcast` arguments keep their position and behavior. + +### Required caller migration + +The old two-argument `sendTransactionWithEditedFee(hash, isLegacy)` send now throws `Replacement fee approval required`. Hosts must preview, show the maximum fee to the user, obtain approval, then send with that exact ceiling in decimal wei: + +```ts +const preview = await keyring.ethereumTransaction.sendTransactionWithEditedFee( + originalHash, + isLegacy, + { previewOnly: true, assertCurrentContext } +); +if (preview.error || preview.maximumFee === undefined) { + throw new Error('Replacement preview unavailable'); +} + +// Host UI displays this execution gas fee in the network's native currency. +// Approval is valid only for this original transaction and captured context. +if (await requestUserApproval(preview.maximumFee)) { + await keyring.ethereumTransaction.sendTransactionWithEditedFee( + originalHash, + isLegacy, + { + approvedMaximumFee: preview.maximumFee, + assertCurrentContext, + } + ); +} +``` + +`assertCurrentContext` is supplied by the host and must throw when the account, network, provider or unlock session changes, or the original is mined or superseded. Invalidate the quote when the approval UI closes. For smart accounts, pass the same outer payer `{ type, id }` as `targetAccount` to both calls, plus the host's `validateOriginal` and `beforeBroadcast` guards. Authentication and fee limits apply without these optional callbacks; session and UI lifecycle checks rely on the host supplying them. Do not persist signing payloads or approvals. + +The ceiling is `gasLimit × gasPrice` for type 0/1, or `gasLimit × maxFeePerGas` for type 2. It covers execution gas, not separate chain-specific fee components. Existing max-send value adjustment and contract-call rejection are retained. This change applies to Speed Up; `cancelSentTransaction` and ordinary sends retain their existing contracts. + +Ledger/Trezor dependencies, transports, initialization and signing wrapper APIs are unchanged. Automated tests use real signature reconstruction and protocol serialization with mocked device I/O. Physical device signing, firmware compatibility and live broadcasts remain unverified by this release candidate. diff --git a/packages/sysweb3-keyring/README.md b/packages/sysweb3-keyring/README.md new file mode 100644 index 00000000..1bacf251 --- /dev/null +++ b/packages/sysweb3-keyring/README.md @@ -0,0 +1,507 @@ +# Sysweb3-keyring + +A stateless, multi-chain keyring manager for Syscoin and Ethereum-based networks. + +## Overview + +The sysweb3-keyring provides a unified interface for managing accounts, transactions, and hardware wallets across Syscoin (UTXO) and Ethereum (EVM) networks. The KeyringManager operates statelessly, relying on external state providers (like Redux) for account and network data. + +## Key Features + +- **Stateless Architecture**: No internal state storage - integrates with external state management +- **Multi-Chain Support**: Handles both UTXO (Syscoin) and EVM (Ethereum) networks +- **Hardware Wallet Support**: Trezor and Ledger integration +- **Secure Session Management**: Encrypted private key handling with session transfer +- **Transaction Management**: Full transaction lifecycle support for both network types + +## Vault encryption compatibility + +New vaults require WebCrypto and use PBKDF2-HMAC-SHA-512 (900,000 production +iterations) with AES-256-GCM. Missing WebCrypto rejects the operation without +writing a weaker fallback vault. Restore WebCrypto availability before retrying +an unmarked legacy vault. + +Historical fallback vaults used a 20,000-iteration key that also encrypted their +persisted account keys. After authenticating such a CBC vault, the keyring records +the explicit `pbkdf2-sha512-20000` compatibility profile and rewraps the vault with +AES-GCM. This preserves existing account access across restart; it is **not** a +full rekey of those account records to 900,000 iterations. The profile is written +before rewrapping, so interruption of either write remains recoverable. Arbitrary +KDF profiles or parameters are rejected. + +Storage clients must return their asynchronous write/delete promises. The core +adapter preserves them so rejected writes do not silently advance vault migration. +Fresh wallet creation additionally requires conditional batch creation. Native +`chrome.storage.local` and `browser.storage.local` use a prefix-scoped Web Lock +around the absence check and awaited write, coordinating contexts in the same +extension origin and storage partition. Custom clients must provide an atomic +`createItemsIfAbsent(items)` backend operation over prefixed, JSON-serialized +values; the built-in memory client provides this operation synchronously. +There is no sequential or unlocked fallback. A backend shared across storage +partitions needs its own atomic implementation or a single owner. + +### Release order for 1.0.613 + +Publish `@sidhujag/sysweb3-core@1.0.29` before `@sidhujag/sysweb3-keyring@1.0.613`. +The updated lock entry describes that intended dependency; its integrity is +intentionally absent until publication. Regenerate and verify the lockfile from +the published registry artifacts before a clean registry installation. Local +validation uses the built package tarballs and does not establish publication. + +## Installation + +```bash +npm install @sidhujag/sysweb3-keyring +# or +yarn add @sidhujag/sysweb3-keyring +``` + +## Usage + +### Basic Setup + +```javascript +import { KeyringManager } from '@sidhujag/sysweb3-keyring'; + +// Create a vault state getter function (e.g., from Redux store) +const vaultStateGetter = () => store.getState().vault; + +// Initialize the keyring manager +const keyringManager = await KeyringManager.createInitialized( + seedPhrase, + password, + vaultStateGetter +); +``` + +### Offline BIP84 public account derivation + +The standalone public entry accepts a bare **mainnet xpub or zpub** for a depth-3 +account whose child number is hardened. It derives only native SegWit P2WPKH +addresses at `/0/index` (receive) or `/1/index` (change), with a nonhardened index +from 0 through 2,147,483,647. Choose `bitcoin` or `syscoin` explicitly. Testnet +versions, private keys, descriptors, origin/path suffixes and arbitrary networks +are rejected. Requests must be plain own-data objects with exactly the documented +fields; inherited properties, getters and extra fields are rejected. Existing +generic watch-descriptor and keyring APIs are unchanged. + +```typescript +import { + parseBip84PublicAccount, + deriveBip84PublicAddress, +} from '@sidhujag/sysweb3-keyring/cjs/public-bip84'; + +const account = parseBip84PublicAccount({ + network: 'syscoin', + accountKey: exportedPublicAccountKey, +}); +const receive = deriveBip84PublicAddress({ + network: account.network, + accountKey: account.canonicalKey, + branch: 0, + index: 0, +}); +// receive.address, receive.scriptPubKey; no keyring or provider required. +``` + +The canonical account identity is the tuple `(network, policy, canonicalKey)`. +`policy` is `bip84-p2wpkh`; `canonicalKey` normalizes xpub/zpub aliases to zpub. +`accountIndex` is the encoded hardened child number minus 2^31. Key serialization +and depth cannot prove the original purpose, coin type, full ancestry or ownership. +In particular, the same public key can be encoded for either supported network; +network selection changes the address encoding and identity, not the derived +witness program. Require the user to verify their source wallet's BIP84 account +and network, and compare a known receive address before using a watch account. + +Calls are synchronous and stateless: one key of at most 112 Base58 characters, +one account parse and two requested child derivations per address; no range scan, +cache, fetch, storage, RNG or wallet signing. The upstream BIP32 factory runs +deterministic ECC known-vector self-tests at module initialization (including +fixed-fixture signatures); it never receives a wallet private key here. The +underlying BIP32 implementation can retry an invalid child internally; a returned index mismatch is rejected instead +of silently changing the requested path. There is no wall-clock guarantee for +pathological library retries. Successful outputs are frozen objects containing +only strings and numbers (including a frozen nested account), never a BIP32 node. +Invalid input throws `PublicBip84Error` with a constant `INVALID_INPUT`, +`INVALID_ACCOUNT` or `INVALID_DERIVATION` code and no echoed key. + +An account public key reveals all nonhardened receive and change addresses and +allows their activity to be linked. It cannot spend funds on its own, but remains +privacy-sensitive. The API performs no discovery or history lookup. A consuming +wallet must obtain informed consent before sharing an account key or derived +addresses with an indexer, own explicit discovery/page/concurrency bounds, and +label partial or unavailable history honestly. This library slice does not +implement or qualify a complete mobile watch-account feature. + +### Development BIP84 native-transfer foundation + +`SoftwareKeyring.deriveBip84HdPublicAccount(request, { assertCurrent })` derives +an explicit HD index for a captured Bitcoin/Syscoin mainnet context and returns +only frozen public account and receive-address data. It requires an already +unlocked software host; it does not select accounts, update a catalogue, store an +xprv, discover addresses or contact a provider. The host must supply a synchronous +revision/consent guard and recheck it after awaiting the operation. Labels and +currency strings do not choose the derivation path. + +The standalone `@sidhujag/sysweb3-keyring/cjs/bip84-native` entry exports +`prepareBip84NativeTransaction` and its types. It builds exact unsigned version-2 +bytes from a bounded immutable plan: one P2WPKH recipient, optional verified +branch-1 change, explicit RBF, locktime zero, full previous transaction data and +integer fee limits. Parent transactions must be ordinary version 1/2 and +non-coinbase. All SYS special/asset parents are excluded even when a selected +output appears to be native change. Missing provider asset metadata is not proof +that an output is safe to spend. + +The planner allows at most 64 inputs/parents, 1,000,000 bytes per parent and +2,000,000 aggregate parent bytes. Before decoding any parent, it also enforces +an aggregate budget of 8,192 decoded components: parent inputs, outputs, witness +vectors and witness items each consume one component, including empty items. +This is a wallet resource policy, not a consensus limit; large scripts remain +subject to the separate byte limits. Wallet policy additionally caps absolute fees +at 10,000,000 satoshis and fee rate at 1,000 sat/vB; callers must provide limits +no higher than those ceilings. Maximum signature size is used only to reject +fees that cannot possibly satisfy the rate ceiling; the prepared signer checks +that ceiling again using the actual finalized virtual size. Zero fee is arithmetic-valid, not a relay guarantee. +Oversized valid parents are unavailable to this initial planner; no data is +truncated or silently omitted. Returned bytes/data are public and privacy-sensitive. + +This is a development foundation, **not a native UTXO sending capability**. +`SoftwareKeyring.signPreparedBip84Transaction(request, { assertCurrent })` (added in 2.1.0) +signs only the selected HD account's exact prepared plan. It requires the SDK +selected type/index, requested account and seed-derived canonical public key to +agree. The mandatory synchronous host guard additionally binds fresh approval, +monotonic revision and review expiry. It rebuilds the plan, verifies complete +low-S SIGHASH_ALL signatures and exact unsigned bytes, and checks the final fee +against actual virtual size. It performs no unlock, storage, discovery or +broadcast and returns only frozen signed bytes, identifiers and fee/size data. +It does not consume or create per-account encrypted xprvs. The host still owns +canonical-chain/unspent checks, confirmed-input eligibility, protected collateral +and pending outpoint reservations, change-index persistence, fresh authentication, +review cancellation and eventual journal-before-broadcast behavior. Full parent +bytes prove an outpoint's content, not chain membership, maturity or spendability. +Existing generic PSBT, EVM and hardware APIs are unchanged. Native and live +qualification remain future work. + +### Account Management + +```javascript +// Get active account +const activeAccount = keyringManager.getActiveAccount(); + +// Create new account +const newAccount = await keyringManager.addNewAccount('My Account'); + +// Switch active account +await keyringManager.setActiveAccount(accountId, KeyringAccountType.HDAccount); + +// Import account from private key +const importedAccount = await keyringManager.importAccount( + privateKey, + 'Imported Account' +); +``` + +### Network Management + +```javascript +// Set network (automatically switches between UTXO/EVM signers) +await keyringManager.setSignerNetwork(networkConfig); + +// Get current network +const network = keyringManager.getNetwork(); +``` + +### Transaction Operations + +#### Syscoin (UTXO) Transactions + +```javascript +// Estimate transaction fee +const feeEstimate = + await keyringManager.syscoinTransaction.getEstimateSysTransactionFee({ + txOptions: {}, + amount: 1.0, + receivingAddress: 'sys1q...', + feeRate: 0.00001, + token: null, + }); + +// Sign PSBT +const signedPsbt = await keyringManager.syscoinTransaction.signPSBT({ + psbt: psbtData, + isTrezor: false, + isLedger: false, +}); + +// Get addresses +const receivingAddress = await keyringManager.updateReceivingAddress(); +const changeAddress = await keyringManager.getNewChangeAddress(); +``` + +#### Ethereum (EVM) Transactions + +```javascript +// Send transaction +const txHash = await keyringManager.ethereumTransaction.sendTransaction({ + to: '0x...', + value: '1000000000000000000', // 1 ETH in wei + gasLimit: '21000', + gasPrice: '20000000000', // 20 gwei +}); + +// Sign message +const signature = await keyringManager.ethereumTransaction.signPersonalMessage([ + '0x48656c6c6f', // "Hello" in hex + accountAddress, +]); +``` + +### Hardware Wallet Support + +Trezor uses `@trezor/connect-webextension` 10.0.1. The hardware adapter loads it +only when a supported MV3 extension invokes Trezor; ordinary Node CommonJS/ESM +imports and the software entry do not initialize browser transports. Unsupported +hosts reject hardware operations instead of falling back to software signing. + +The extension must configure `externally_connectable` for +`https://suite.trezor.io/*` and host access to that origin, as required by the +[published Connect 10 webextension package](https://www.npmjs.com/package/@trezor/connect-webextension/v/10.0.1). +Connect selects Suite Desktop or the Suite Web popup. The old Connect 9 iframe, +content script, and `connectSrc` settings are not part of this integration. + +Connect 10 does not expose the old device event emitter. SDK connection status +and cached model information update from request results and disposal; they are +not immediate physical unplug notifications. Disposal immediately rejects pending +SDK operations and fences late replies. Suite Web may leave its popup open; a +late approval there is discarded locally rather than treated as a fresh approval. +When an underlying request is still active, transport cleanup is deferred to avoid +triggering an automatic fallback popup. New initialization fails with +`HARDWARE_SIGNER_BUSY` until that request settles; local lock/disposal does not +wait for the remote prompt. An upstream transport failure can still trigger remote +fallback UI while that old request is pending; the local SDK will reject its result. +A failed or cancelled operation +never authorizes a cached transaction, and terminal disconnect/unsupported-host +errors are not retried. Device pairing, display verification, signing, and +reconnection still require physical-device qualification in the consuming host. + +```javascript +// Import Trezor account +const trezorAccount = await keyringManager.importTrezorAccount( + 'Trezor Account' +); + +// Import Ledger account +const ledgerAccount = await keyringManager.importLedgerAccount( + false, + 'Ledger Account' +); +``` + +### State Management Integration + +The KeyringManager requires a `vaultStateGetter` function that returns the current vault state: + +```javascript +// Example with Redux +const vaultStateGetter = () => ({ + accounts: { + [KeyringAccountType.HDAccount]: { + /* account data */ + }, + [KeyringAccountType.Imported]: { + /* imported accounts */ + }, + }, + activeAccount: { id: 0, type: KeyringAccountType.HDAccount }, + activeNetwork: { + /* network config */ + }, + // ... other vault state +}); + +// The keyring manager will call this function to get current state +const keyringManager = new KeyringManager(); +keyringManager.setVaultStateGetter(vaultStateGetter); +``` + +## Architecture + +The stateless design means: + +- **No Internal State**: The KeyringManager doesn't store account or network data +- **External State Provider**: Relies on your application's state management (Redux, Context, etc.) +- **Session Management**: Private keys are encrypted and managed securely in memory +- **Multi-Instance Support**: Multiple KeyringManager instances can operate independently + +## API Reference + +### KeyringManager + +Main class for keyring operations: + +- `createInitialized(seedPhrase, password, vaultStateGetter)` - Create and initialize keyring +- `addNewAccount(label?)` - Create new HD account +- `setActiveAccount(id, type)` - Switch active account +- `importAccount(privateKey, label?)` - Import account from private key +- `setSignerNetwork(network)` - Set active network +- `unlock(password)` - Unlock keyring +- `lockWallet()` - Lock keyring + +### Transaction Managers + +- `syscoinTransaction` - UTXO transaction operations +- `ethereumTransaction` - EVM transaction operations + +For application-specific approval rules, pass an optional third argument to +`ethereumTransaction.sendFormattedTransaction(params, isLegacy, { assertCurrent })`. +The guard must return `undefined` synchronously or throw to deny the operation. +It supplements the SDK's account, network and session checks and is rechecked +after asynchronous preparation, immediately before signing, and before broadcast. +It is not called after a broadcast acknowledgement to reclassify a sent transaction. + +### Hardware Wallet Support + +- `importTrezorAccount(label?)` - Import Trezor account +- `importLedgerAccount(isConnected, label?)` - Import Ledger account + +### Encrypted private records + +An unlocked keyring can seal small application records without returning its +mnemonic or a derived encryption key: + +```typescript +const domain = 'org.example.wallet.private-records.v1'; +const recordId = crypto.randomUUID(); +const profileId = await keyringManager.getPrivateRecordProfileId(); +const envelope = await keyringManager.encryptPrivateRecord({ + domain, + recordId, + plaintext: new TextEncoder().encode('application-owned private data'), +}); +// Store or back up only envelope; storage is owned by the calling application. +const plaintext = await keyringManager.decryptPrivateRecord({ + domain, + recordId, + envelope, +}); +// Consume the bytes, then clear them when no longer needed. +plaintext.fill(0); +``` + +`IEncryptedPrivateRecord` contains only `version: 1`, `domain`, `recordId`, +`profileId`, a base64 nonce and base64 ciphertext including its authentication +tag. All application metadata should be encrypted inside `plaintext`. Domains +and record IDs are 1–128 ASCII characters: an alphanumeric first character, +followed by alphanumerics or `.`, `_`, `:`, `/`, `-`. Records may contain 0–65536 +bytes. `MAX_PRIVATE_RECORD_BYTES` and `MAX_PRIVATE_RECORD_LABEL_BYTES` export +these bounds. + +The API uses native WebCrypto HKDF-SHA256 and AES-256-GCM, with a fresh random +96-bit nonce and a 128-bit tag. The authenticated tuple binds the format version, +domain, record ID and profile ID. Profile and encryption derivations have +separate HKDF labels. The root material is the NFKD-normalized mnemonic or +extended private key already held by the unlocked session; derivation does not +depend on the selected account, network or password. Rewrapping the same root +with a new password therefore preserves access to these records. + +Each operation rejects if its source session is locked, replaced or transferred +before completion, even if the same buffers are later transferred back. These +methods do not read or write wallet storage. Callers remain responsible for +record IDs, persistence, backup, rollback detection and clearing returned bytes. +**The seed alone cannot restore randomly generated records: their encrypted +backups are also required.** Temporary byte buffers are cleared; JavaScript +strings and native cryptographic allocations remain subject to runtime garbage +collection rather than guaranteed memory erasure. + +## Security + +- `initializeSession`, `initializeWalletSecurely`, and the initialization factories create a new wallet only when both vault records are absent. Use `unlock()` to restore an existing wallet. Repeating initialization on a matching live session verifies the stored wallet without rewriting it. +- Fresh vault salt and ciphertext are created together only if both are absent, through the core conditional-creation operation. Native extension contexts sharing an origin/storage partition are coordinated by Web Locks; custom backends must provide atomic `createItemsIfAbsent`. Unsupported adapters are rejected before writing. Existing or incomplete records are preserved. +- UTXO signing authenticates the selected account's paths, public keys and spent scripts. A joint PSBT may include unfinished inputs for another signer: their HD/path hints are removed before the selected private signer runs, then their public metadata is restored to the returned partial PSBT. Another account in the same wallet remains unsigned. At least one unfinished input must authenticate to the selected account; a wholly finalized PSBT retains its existing handling. Standard P2WSH, wrapped P2WSH and P2SH multisig preserve external cosigner signatures and continuation. Hardware paths and single-address imports can reject unsupported joint inputs rather than widening signing authority. +- Hardware signing preserves already-finalized external inputs without requesting their private derivations. Trezor receives them as `EXTERNAL` inputs; Ledger retains their final scripts in PSBTv2 and skips signing/finalizing them again. Unfinished foreign hardware inputs remain unsupported. +- Persisted wallet and account secrets are encrypted; plaintext signing material is used in memory +- Session data is cleared when the keyring is locked +- Hardware wallet integration follows device security models +- Secure memory management with explicit cleanup + +## License + +MIT License + +### Ledger platform host + +Ledger device access uses the Device Management Kit. The regular and software +entries do not load a Ledger transport or device SDK. Browser integrations must +create the heavy host from `@sidhujag/sysweb3-keyring/esm/ledger-host` in a visible +extension page and inject its semantic `LedgerHost` port into the wallet authority: + +```ts +// Visible device page only: +import { createLedgerDmkHost } from '@sidhujag/sysweb3-keyring/esm/ledger-host'; +const host = createLedgerDmkHost({ + confirmBlindSigning: async (intent, signal) => { + // Show the exact immutable intent and an explicit blind-signing warning. + // Return true only after a fresh user decision; cancellation must return false. + return showTrustedWalletConfirmation(intent, signal); + }, +}); + +// Wallet authority: use a secured semantic port to that page, not a raw APDU port. +const wallet = new KeyringManager(undefined, authorizedLedgerHostPort); +``` + +Use only the ESM host entry with a browser bundler and its required platform +polyfills. `cjs/ledger-host` is not a supported entry. A service worker cannot own +the WebHID device picker. The platform must bind the host to its own trusted page, +revoke pending operations on lock/close, and never expose this port to dapps. +A missing host fails with `HARDWARE_SIGNER_UNAVAILABLE`; there is no legacy +LedgerJS fallback. Pass either a shared hardware manager or a Ledger host to +`KeyringManager`, not both. + +The default host performs no remote metadata lookup, transaction checks, or +signing telemetry. The current Ethereum signer library can fall back to blind +signing, so transaction and typed-data signing require per-request approval +through the trusted `confirmBlindSigning` callback. Omitting it fails closed. +Personal-message signing and address retrieval remain available offline. +Signatures are checked against the expected account; UTXO signatures must also +match the approved PSBT and its requested sighash coverage. The custom UTXO host +supports the existing Syscoin and Bitcoin app protocols. Physical-device and +firmware qualification remain separate from source and mocked-device tests. + + +## Shared standard EVM fees + +`cjs/evm-fees` is a dependency-free read-only entry. Both the existing +`EthereumTransactions.getFeeDataWithDynamicMaxPriorityFeePerGas` method and +restricted hosts use the same calculation: + +```ts +import { getEvmFeeData } from '@sidhujag/sysweb3-keyring/cjs/evm-fees'; + +const fees = await getEvmFeeData(readOnlyProvider, { + signal, + assertCurrent: () => assertSameAccountAndNetwork(), +}); +``` + +The reader supplies only `getGasPrice()`, `getBlock('latest')`, and +`send('eth_maxPriorityFeePerGas' | 'eth_feeHistory', params)`. It must validate +its RPC responses and bind its endpoint/chain; this helper does not instantiate +a provider, estimate gas, select an account, sign or broadcast. The host must +retain request deadlines and perform its ordinary account/network/session +checks before signing. + +Results are frozen bigint fields: `gasPrice`, `maxFeePerGas`, and +`maxPriorityFeePerGas`, with `baseFeePerGas` only when the observed header has +that field. An absent base fee produces the existing legacy zero sentinels for +the two EIP-1559 fields. A zero base fee or zero tip remains valid EIP-1559 data. +An explicitly unsupported priority method may use actual recent fee-history +rewards; other failures never turn into fallback fees. Quantities and calculated +fees are bounded to uint256, history to the requested five blocks, and no +signing authority or dependencies are loaded by this entry. + +The optional `minPriorityFee` and whole-percent `feeMultiplier` preserve the +existing configured recommendation policy (default multiplier 250). Options +are snapshotted before asynchronous reads. The synchronous `assertCurrent` +callback must return `undefined`; an async callback is rejected. Cancellation +rejects pending discovery without permitting later results to produce a quote. diff --git a/packages/sysweb3-keyring/docs/software-entry.md b/packages/sysweb3-keyring/docs/software-entry.md new file mode 100644 index 00000000..22eeabd6 --- /dev/null +++ b/packages/sysweb3-keyring/docs/software-entry.md @@ -0,0 +1,229 @@ +# Software keyring host boundary + +`@sidhujag/sysweb3-keyring/cjs/software` provides `SoftwareKeyring` and +`createSoftwareKeyringHost`. It shares the existing account derivation, encrypted +vault, private-record and transaction engines. It does not initialize Ledger, +Trezor, browser transports, global storage or the hardware-manager singleton. +The existing package root and `KeyringManager(sharedHardwareWalletManager?)` +remain the browser compatibility entry, including `createInitialized`. + +## Host storage and identity + +Create one opaque host with `createSoftwareKeyringHost(storage)`, then share that +same handle among the authority's EVM and per-SLIP44 UTXO keyrings. The storage +port requires asynchronous `get`, `set`, `deleteItem`, and atomic +`createManyIfAbsent`. The factory binds the vault persistence to that storage and +keeps both in a private WeakMap. A structurally similar or mixed-storage object +is rejected before any storage operation. There is no default backend or +fallback to browser storage. The software entry rejects `setStorage` even if the +backend implements the legacy `setClient` method. The host must keep its original +port bound to the same wallet; externally mutating that port is trusted host +behavior outside the SDK boundary. + +A host is one wallet authority, not a global SDK setting. Different hosts have +different session identities, even if the caller supplies the same storage +object. Session transfers require the same authority identity, storage and bound +persistence objects, and reject before modifying +either session if their authority identities differ. Direct buffer injection +through the legacy `receiveSessionOwnership` method is rejected by software +instances; same-authority transfers use a private checked handoff. Trusted low-level consumers +of `KeyringCore` supply an explicit authority identity, storage, and matching +bound vault persistence; they must not share the identity between different +wallets. The legacy wrapper uses one module-scoped identity and persistence. + +The in-process persistence mutex is shared by the host's keyrings. Independent +hosts or processes do not share that mutex. The backend must implement a real +atomic absent-check-and-complete-write for `createManyIfAbsent`; read-then-write +is insufficient. Restore an existing wallet with `unlock`, not initialization. +The encrypted record schemas, PBKDF2 profiles and private-record crypto remain +unchanged. + +```ts +import { + SoftwareKeyring, + createSoftwareKeyringHost, +} from '@sidhujag/sysweb3-keyring/cjs/software'; + +const host = createSoftwareKeyringHost(walletStorage); +const keyring = new SoftwareKeyring(host); +keyring.setVaultStateGetter(() => currentVaultState); +// The outer authority owns authentication, lifecycle and state publication. +``` + +`SoftwareKeyring` has no device signers. Existing hardware account records may be +read, but signing or device-address confirmation fails with +`HARDWARE_SIGNER_UNAVAILABLE`. EVM hardware admission runs before a private-key +getter, provider access or broadcast. The UTXO engine retains its corresponding +explicit hardware-port gate. No unavailable device falls back to seed signing. + +## Required outer authority + +This is a low-level SDK entry, not a qualified native custody host. In particular, +the extraction preserves the existing asynchronous unlock lifecycle: a lock does +not cancel an already-running unlock operation. A native authority must retire +its authorization generation immediately when backgrounded, locked or disposed, +call `lockWallet` immediately, and reject/clear any session recreated by a late +unlock before publishing success or permitting an operation. It must not wait +for unlock completion before enforcing background lock. The outer authority +also owns approval expiry, account/network change admission, and concurrency +across keyrings. Existing signing context guards remain in the shared engine. + +Native secure storage, entropy/WebCrypto/Buffer compatibility, biometric policy, +backup flows and React Native bundler/device qualification are separate work. +Do not claim this Node-verified entry establishes those properties. + +## Prepared EVM signing (2.0.0) + +`SoftwareKeyring.signPreparedEvmTransaction(request, { assertCurrent })` signs a +complete type-0 or type-2 transaction synchronously. It does not contact an RPC, +estimate fees, select a nonce, resolve names, fill omitted fields or broadcast. +Only an unlocked software HD/imported account is supported. Hardware, +smart-account and watch-only records reject before key use. + +```ts +const signed = keyring.signPreparedEvmTransaction( + { + account: { + id: 0, + type: 'HDAccount', + expectedAddress: reviewedAddress, + }, + network: { + kind: 'ethereum', + chainId: '1', + slip44: 60, + url: reviewedRpcUrl, + }, + transaction: { + type: 2, + from: reviewedAddress, + to: reviewedRecipient, + chainId: '1', + nonce: '7', + value: '1000000000000000', + gasLimit: '21000', + data: '0x', + maxFeePerGas: '30000000000', + maxPriorityFeePerGas: '1000000000', + }, + }, + { + // Host-owned check: reject expired/replaced approval, lock, account/network + // change, or a conflicting pending submission. Must return undefined. + assertCurrent() { + assertReviewStillCurrent(); + }, + } +); +``` + +All quantities are canonical unsigned decimal strings. Nonce is limited to +`Number.MAX_SAFE_INTEGER`; gas limit to uint64; value and fee arithmetic to +uint256. Type 0 requires `gasPrice` and rejects EIP-1559 fields; type 2 requires +both maximum and priority fees and rejects `gasPrice`. Recipient and sender +must be nonzero hex addresses. Valid address casing is normalized, but invalid +mixed-case checksums reject. Calldata is even-length `0x` hex, at most 16 KiB. +Contract creation, access lists and other transaction types are unsupported. +Unknown, hidden, accessor and asynchronous field values reject. + +The request is detached before host callbacks. Its account, address, chain, +SLIP44 and exact configured endpoint must match the selected keyring context. +`assertCurrent` must be synchronous and return `undefined`; returning a Promise +rejects rather than deferring consent. The shared keyring also checks its +session/account/network identity before and after signing. The decoded signed +envelope, recovered sender, unsigned digest and transaction hash are verified +against the admitted request. The returned object and canonical transaction +fields are frozen. + +**Returned signed bytes are already authorized transactions.** Anyone receiving +those bytes can submit them. A later lock cannot invalidate a returned signature. +Keep them inside the host authority and do not send them to telemetry, logs, +ordinary UI state or arbitrary application callbacks. + +The host owns durable submission and recovery: + +1. Check balance, chain identity, fees, nonce, review expiry and explicit user + authorization before signing; this signing API does not establish those facts. +2. Durably store the signed bytes and locally computed hash before network I/O. + Use bounded journal fields: raw transaction, hash and a small public summary. + Avoid duplicating the full calldata in the same record; a maximum-size result + serialized wholesale can exceed a 64 KiB host storage-record limit. +3. Durably mark submission attempted, recheck current authority, and broadcast + those exact bytes. If journal persistence fails, do not broadcast. +4. Verify the returned hash against `signed.hash`. On timeout, lost acknowledgement + or restart, reconcile that local hash. An uncertain broadcast is not a failed + transaction and must not trigger a newly signed transaction automatically. + +The endpoint field binds configuration identity only. No network is contacted +by this API, so it cannot authenticate that endpoint or establish its live chain. +JS private-key strings retain the existing best-effort lifetime guarantees; +this API does not promise provable memory erasure. + +## Validation + +`test/unit/keyring-manager/software-entry.spec.ts` covers independent encrypted +stores, restart and lock/unlock, stable injected UTXO ports, forged handles, +cross-authority and same-authority transfers, and EVM operations with absent +device capabilities. Existing legacy initialization, vault/KDF and hardware +transaction tests exercise the compatibility wrapper. + +After building, run `node test/software-entry-runtime.cjs` from the package +folder. Pass an alternate absolute path to the unpacked `cjs/software.js` as its +argument to verify packed output. This plain Node probe uses no Jest mocks or +TypeScript loader: it rejects global-DI/device module loads and any timers or fetch calls, then +exercises separate encrypted stores, software message and prepared-transaction signing, lock/unlock, +missing-device rejection and restart with browser globals absent. Test KDF +iterations are reduced by the existing test configuration; production KDF +qualification remains covered separately. + + +## Indexed Ethereum HD runtime accounts + +`deriveEvmHdRuntimeAccount({ index }, { assertCurrent })` derives the existing +Ethereum BIP44 path for a nonhardened index between 0 and 0x7fffffff. The caller +allocates indices and persists its account catalogue; this method does neither. +It requires an unlocked software session on an Ethereum/SLIP-44 60 network and +rejects changed session, selection or network identity, including changes made +by the synchronous host guard. The selected account record may be absent during +initial hydration. No arbitrary derivation path, hardware access, RPC or storage +operation is introduced. + +The result is an `EncryptedEvmHdRuntimeAccount`, matching the internal account +record returned by `createFirstAccount` and `addNewAccount`. Its `xprv` is +password-encrypted runtime signing state, not public metadata. Never send that +field to UI, a public snapshot or a public account catalogue. Store only the +explicit public identity/label fields required by the host, and regenerate the +runtime record after authentication. No plaintext private key, phrase or +password is returned. Account signing remains subject to the existing prepared +transaction context and approval checks. + + +## Prepared BIP84 native signing (2.1.0) + +`SoftwareKeyring.signPreparedBip84Transaction(request, { assertCurrent })` returns +an asynchronous frozen result containing raw transaction bytes, display-order +`txid`/`wtxid`, the reviewed unsigned bytes, exact `feeSatoshis` and actual +`virtualSize`. Only Bitcoin/Syscoin mainnet HD native P2WPKH spends supported by +the standalone planner are admitted; asset/special/coinbase parents are excluded. + +The request is `{ account: { type: 'HDAccount', index, expectedAccountKey }, +prepared }`. `expectedAccountKey` is the planner's canonical account zpub. +The SDK selected account must exist and have that same type/index/public key; +public derivation of an arbitrary index does not select or authorize it. Keys +are derived once from the existing authenticated seed, not a caller PSBT or +per-account xprv. The method never unlocks, selects accounts, reads/writes +storage, calls a provider or broadcasts. It rebuilds the prepared plan, permits +only fully verified low-S SIGHASH_ALL witnesses and checks final unsigned bytes +and exact BigInt fee against actual finalized vsize. Existing generic PSBT, +EVM and hardware paths are unchanged. + +The host must supply a synchronous guard returning exactly undefined, bind a +monotonic revision and fresh approval to the complete review, enforce expiry, +canonical/unspent/protected-input eligibility and change reservations, and check +again after awaiting. Account/network A-B-A must revoke the review. The shared +BIP84 operation gate rejects reentrancy. Failure never locks a replacement +runtime. Owned private buffers are cleared when possible; JavaScript strings, +SJS seed internals and cryptographic-library copies cannot be promised zeroized. +Returned signed bytes cannot be revoked; the host must journal before broadcast. +This SDK API does not establish mobile custody, relay eligibility, native or +live qualification. diff --git a/packages/sysweb3-keyring/docs/storage-core.md b/packages/sysweb3-keyring/docs/storage-core.md new file mode 100644 index 00000000..aa8648d1 --- /dev/null +++ b/packages/sysweb3-keyring/docs/storage-core.md @@ -0,0 +1,48 @@ +# Host-owned vault persistence + +`src/storage-core.ts` exports `createVaultPersistence(storage)`, `VaultStoragePort`, +`VaultPersistence`, and `VaultAuthenticationError`. Import this module directly +from `@sidhujag/sysweb3-keyring/cjs/storage-core` (or the explicit `.js` +path) when a host must avoid the package root's hardware and process-global storage +initialization. This extraction does not make `KeyringManager` or the package +root suitable for native use; they retain their current dependencies. + +Create one persistence object per wallet authority and share it across that +wallet's network keyrings. Its mutex orders its own reads and writes. Separate +objects do not share a mutex, even if they receive the same storage port. A host +must not accidentally create independent authorities that update the same +vault. Cross-process coordination is the storage backend's responsibility. + +The required port methods are asynchronous: + +- `get(key)` returns the logical stored value, or an absent value, and rejects on + storage failure. Do not return an empty value when a read failed. +- `set(key, value)` resolves only after the backend reports write completion and + rejects failures, including uncertain commit acknowledgements. +- `createManyIfAbsent(items)` conditionally commits the entire batch only when + all supplied keys are absent. It returns exactly `true` on completion or + `false` when an existing record prevented creation, and rejects other failures. + This operation must be atomic across all clients of the same namespace. A + sequential absence check plus individual writes does not satisfy the contract. + Neither an instance mutex nor a batch write alone supplies this guarantee. + +Keys are the existing logical names, `vault` and `vault-keys`; host prefixing is +outside this module. `vault` remains a JSON string containing the version 4 +AES-GCM envelope. Initial `vault-keys` remains `{ salt }`. A host adapter that +serializes these logical values must deserialize them once on read, without +rewriting the record format. There is no default storage or fallback backend. +The legacy `storage.ts` wrapper still captures `sysweb3Di` storage once and +exposes its original singleton functions and the exact same authentication +error constructor. + +Encryption, legacy CBC reads, KDF ownership, and record schema are unchanged. +New writes require the existing WebCrypto AES-GCM and secure-random interfaces. +The core accepts the existing derived 32-byte hex key; it does not derive or +retain a session key. Missing crypto and backend failures remain operational +errors. A failed write may have committed if its acknowledgement was lost; +callers must reconcile persistent state rather than assuming rollback. + +This is a shared-code boundary, not a native custody qualification. A native +adapter still needs durable atomic storage, qualified crypto and random-source +behavior, lifecycle/session integration, and device testing before handling +real wallet secrets. diff --git a/packages/sysweb3-keyring/examples/basic-usage.js b/packages/sysweb3-keyring/examples/basic-usage.js index f93ecff3..752d8f9f 100644 --- a/packages/sysweb3-keyring/examples/basic-usage.js +++ b/packages/sysweb3-keyring/examples/basic-usage.js @@ -2,7 +2,7 @@ * Basic usage example of the stateless KeyringManager */ -import { KeyringManager, KeyringAccountType } from '@pollum-io/sysweb3-keyring'; +import { KeyringManager, KeyringAccountType } from '@sidhujag/sysweb3-keyring'; // Example state structure (similar to Redux store) let vaultState = { diff --git a/packages/sysweb3-keyring/jest.config.js b/packages/sysweb3-keyring/jest.config.js index 49b6a274..600ac340 100644 --- a/packages/sysweb3-keyring/jest.config.js +++ b/packages/sysweb3-keyring/jest.config.js @@ -3,13 +3,16 @@ module.exports = { testEnvironment: 'node', moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], transform: { - '^.+\\.(ts|tsx)$': 'ts-jest', + '^.+\\.(ts|tsx)$': [ + 'ts-jest', + {}, + ], }, testMatch: ['**/test/**/*.spec.ts'], moduleNameMapper: { - '^@pollum-io/sysweb3-utils$': '/../sysweb3-utils/src', - '^@pollum-io/sysweb3-network$': '/../sysweb3-network/src', - '^@pollum-io/sysweb3-core$': '/../sysweb3-core/src', + '^@sidhujag/sysweb3-utils$': '/../sysweb3-utils/src', + '^@sidhujag/sysweb3-network$': '/../sysweb3-network/src', + '^@sidhujag/sysweb3-core$': '/../sysweb3-core/src', '^@ledgerhq/devices/hid-framing$': '/test/__mocks__/ledger-mock.js', '^@ledgerhq/hw-transport-webhid$': diff --git a/packages/sysweb3-keyring/package.json b/packages/sysweb3-keyring/package.json index 83c7ef2d..933f7249 100644 --- a/packages/sysweb3-keyring/package.json +++ b/packages/sysweb3-keyring/package.json @@ -1,12 +1,76 @@ { - "name": "@pollum-io/sysweb3-keyring", - "version": "1.0.491", + "name": "@sidhujag/sysweb3-keyring", + "version": "2.2.0", "description": "Keyring Manager for UTXO and Web3 Wallets", "main": "cjs/index.js", "types": "types/index.d.ts", + "typesVersions": { + "*": { + "cjs/storage-core": [ + "types/storage-core.d.ts" + ], + "cjs/storage-core.js": [ + "types/storage-core.d.ts" + ], + "cjs/transactions/syscoin-core": [ + "types/transactions/syscoin-core.d.ts" + ], + "cjs/transactions/syscoin-core.js": [ + "types/transactions/syscoin-core.d.ts" + ], + "cjs/transactions/ethereum": [ + "types/transactions/ethereum.d.ts" + ], + "cjs/transactions/ethereum.js": [ + "types/transactions/ethereum.d.ts" + ], + "cjs/software": [ + "types/software.d.ts" + ], + "cjs/software.js": [ + "types/software.d.ts" + ], + "cjs/keyring-core": [ + "types/keyring-core.d.ts" + ], + "cjs/keyring-core.js": [ + "types/keyring-core.d.ts" + ], + "esm/ledger-host": [ + "types/ledger-host.d.ts" + ], + "esm/ledger-host.js": [ + "types/ledger-host.d.ts" + ], + "cjs/ledger/host-types": [ + "types/ledger/host-types.d.ts" + ], + "cjs/ledger/host-types.js": [ + "types/ledger/host-types.d.ts" + ], + "cjs/public-bip84": [ + "types/public-bip84.d.ts" + ], + "cjs/public-bip84.js": [ + "types/public-bip84.d.ts" + ], + "cjs/bip84-native": [ + "types/bip84-native.d.ts" + ], + "cjs/bip84-native.js": [ + "types/bip84-native.d.ts" + ], + "cjs/evm-fees": [ + "types/evm-fees.d.ts" + ], + "cjs/evm-fees.js": [ + "types/evm-fees.d.ts" + ] + } + }, "repository": { "type": "git", - "url": "git+https://github.com/Pollum-io/sysweb3.git" + "url": "git+https://github.com/syscoin/sysweb3.git" }, "author": "Pali Wallet", "license": "MIT", @@ -16,11 +80,11 @@ }, "scripts": { "prebuild": "rimraf dist/", - "build": "tsc && tsc -p tsconfig.json", + "build": "tsc && tsc -p tsconfig-ledger-host.json", "prerelease": "yarn build", "copy": "node ../../scripts/package/copy", "release:npm": "yarn publish ./dist --access=public --no-git-tag-version", - "release:preflight": "yarn pack ./dist --dry-run", + "release:preflight": "npm pack ./dist --dry-run --json --ignore-scripts", "publishCode": "yarn prebuild && yarn prerelease && yarn copy && yarn release:npm", "type-check": "tsc --pretty --noEmit", "localTest": "yarn prebuild && yarn build && yarn copy", @@ -29,41 +93,42 @@ "test:coverage": "jest --coverage" }, "dependencies": { - "@bitcoinerlab/descriptors": "^2.0.1", - "@bitcoinerlab/secp256k1": "^1.0.5", - "@ledgerhq/hw-app-eth": "^6.45.12", - "@ledgerhq/hw-transport-webhid": "^6.30.4", - "@ledgerhq/logs": "^6.10.1", - "@pollum-io/sysweb3-core": "^1.0.27", - "@pollum-io/sysweb3-network": "^1.0.96", - "@pollum-io/sysweb3-utils": "^1.1.237", - "@trezor/connect-web": "^9.1.5", - "@trezor/connect-webextension": "^9.6.2", - "@trezor/utxo-lib": "^1.0.12", + "@bitcoinerlab/secp256k1": "^1.2.0", + "@ledgerhq/context-module": "2.8.0", + "@ledgerhq/device-management-kit": "1.11.0", + "@ledgerhq/device-signer-kit-ethereum": "1.18.2", + "@ledgerhq/device-transport-kit-web-hid": "1.2.4", + "@metamask/eth-sig-util": "^8.2.0", + "@sidhujag/sysweb3-core": "^1.0.29", + "@sidhujag/sysweb3-network": "^1.0.109", + "@sidhujag/sysweb3-utils": "^1.1.280", + "@trezor/connect-webextension": "10.0.1", + "bip32": "^5.0.1", "bip32-path": "^0.4.2", - "bip39": "^3.0.4", - "bip84": "^0.2.7", "bitcoin-ops": "^1.4.1", - "bitcoinjs-lib": "^6.1.5", + "bitcoinjs-lib": "^7.0.5", "bs58check": "^3.0.1", - "coinselectsyscoin": "^1.1.8", "crypto-js": "^4.1.1", - "dotenv": "^16.4.5", - "eth-json-rpc-filters": "^4.2.2", - "eth-sig-util": "^3.0.1", - "ethereumjs-util": "^7.1.5", - "ethers": "^5.7.2", - "ledger-bitcoin": "^0.2.3", - "lodash": "^4.17.21", - "satoshi-bitcoin": "^1.0.5", - "syscoinjs-lib": "^1.0.242", - "syscointx-js": "^1.0.118", - "zksync-ethers": "5" + "ethers": "^6.17.0", + "rxjs": "7.8.2", + "varuint-bitcoin": "^2.0.0" + }, + "peerDependencies": { + "syscoinjs-lib": "^1.0.276" }, "devDependencies": { "@types/crypto-js": "^4.1.3", - "@types/lodash": "^4.14.200", + "@types/jest": "^29.5.0", "@types/node": "^20.8.10", - "rimraf": "^6.0.1" + "dotenv": "^16.0.3", + "rimraf": "^6.0.1", + "syscoinjs-lib": "^1.0.276", + "tslib": "^2.8.1", + "typescript": "^5.3.3", + "wif": "^5.0.0" + }, + "resolutions": { + "axios": "^1.18.1", + "jws": "^4.0.1" } } diff --git a/packages/sysweb3-keyring/readme.md b/packages/sysweb3-keyring/readme.md deleted file mode 100644 index 3564e033..00000000 --- a/packages/sysweb3-keyring/readme.md +++ /dev/null @@ -1,201 +0,0 @@ -# Sysweb3-keyring - -A stateless, multi-chain keyring manager for Syscoin and Ethereum-based networks. - -## Overview - -The sysweb3-keyring provides a unified interface for managing accounts, transactions, and hardware wallets across Syscoin (UTXO) and Ethereum (EVM) networks. The KeyringManager operates statelessly, relying on external state providers (like Redux) for account and network data. - -## Key Features - -- **Stateless Architecture**: No internal state storage - integrates with external state management -- **Multi-Chain Support**: Handles both UTXO (Syscoin) and EVM (Ethereum) networks -- **Hardware Wallet Support**: Trezor and Ledger integration -- **Secure Session Management**: Encrypted private key handling with session transfer -- **Transaction Management**: Full transaction lifecycle support for both network types - -## Installation - -```bash -npm install @pollum-io/sysweb3-keyring -# or -yarn add @pollum-io/sysweb3-keyring -``` - -## Usage - -### Basic Setup - -```javascript -import { KeyringManager } from '@pollum-io/sysweb3-keyring'; - -// Create a vault state getter function (e.g., from Redux store) -const vaultStateGetter = () => store.getState().vault; - -// Initialize the keyring manager -const keyringManager = await KeyringManager.createInitialized( - seedPhrase, - password, - vaultStateGetter -); -``` - -### Account Management - -```javascript -// Get active account -const activeAccount = keyringManager.getActiveAccount(); - -// Create new account -const newAccount = await keyringManager.addNewAccount('My Account'); - -// Switch active account -await keyringManager.setActiveAccount(accountId, KeyringAccountType.HDAccount); - -// Import account from private key -const importedAccount = await keyringManager.importAccount( - privateKey, - 'Imported Account' -); -``` - -### Network Management - -```javascript -// Set network (automatically switches between UTXO/EVM signers) -await keyringManager.setSignerNetwork(networkConfig); - -// Get current network -const network = keyringManager.getNetwork(); -``` - -### Transaction Operations - -#### Syscoin (UTXO) Transactions - -```javascript -// Estimate transaction fee -const feeEstimate = - await keyringManager.syscoinTransaction.getEstimateSysTransactionFee({ - txOptions: {}, - amount: 1.0, - receivingAddress: 'sys1q...', - feeRate: 0.00001, - token: null, - }); - -// Sign PSBT -const signedPsbt = await keyringManager.syscoinTransaction.signPSBT({ - psbt: psbtData, - isTrezor: false, - isLedger: false, -}); - -// Get addresses -const receivingAddress = await keyringManager.updateReceivingAddress(); -const changeAddress = await keyringManager.getNewChangeAddress(); -``` - -#### Ethereum (EVM) Transactions - -```javascript -// Send transaction -const txHash = await keyringManager.ethereumTransaction.sendTransaction({ - to: '0x...', - value: '1000000000000000000', // 1 ETH in wei - gasLimit: '21000', - gasPrice: '20000000000', // 20 gwei -}); - -// Sign message -const signature = await keyringManager.ethereumTransaction.signPersonalMessage([ - '0x48656c6c6f', // "Hello" in hex - accountAddress, -]); -``` - -### Hardware Wallet Support - -```javascript -// Import Trezor account -const trezorAccount = await keyringManager.importTrezorAccount( - 'Trezor Account' -); - -// Import Ledger account -const ledgerAccount = await keyringManager.importLedgerAccount( - false, - 'Ledger Account' -); -``` - -### State Management Integration - -The KeyringManager requires a `vaultStateGetter` function that returns the current vault state: - -```javascript -// Example with Redux -const vaultStateGetter = () => ({ - accounts: { - [KeyringAccountType.HDAccount]: { - /* account data */ - }, - [KeyringAccountType.Imported]: { - /* imported accounts */ - }, - }, - activeAccount: { id: 0, type: KeyringAccountType.HDAccount }, - activeNetwork: { - /* network config */ - }, - // ... other vault state -}); - -// The keyring manager will call this function to get current state -const keyringManager = new KeyringManager(); -keyringManager.setVaultStateGetter(vaultStateGetter); -``` - -## Architecture - -The stateless design means: - -- **No Internal State**: The KeyringManager doesn't store account or network data -- **External State Provider**: Relies on your application's state management (Redux, Context, etc.) -- **Session Management**: Private keys are encrypted and managed securely in memory -- **Multi-Instance Support**: Multiple KeyringManager instances can operate independently - -## API Reference - -### KeyringManager - -Main class for keyring operations: - -- `createInitialized(seedPhrase, password, vaultStateGetter)` - Create and initialize keyring -- `addNewAccount(label?)` - Create new HD account -- `setActiveAccount(id, type)` - Switch active account -- `importAccount(privateKey, label?)` - Import account from private key -- `setSignerNetwork(network)` - Set active network -- `unlock(password)` - Unlock keyring -- `lockWallet()` - Lock keyring - -### Transaction Managers - -- `syscoinTransaction` - UTXO transaction operations -- `ethereumTransaction` - EVM transaction operations - -### Hardware Wallet Support - -- `importTrezorAccount(label?)` - Import Trezor account -- `importLedgerAccount(isConnected, label?)` - Import Ledger account - -## Security - -- Private keys are encrypted and stored in memory only -- Session data is cleared when the keyring is locked -- Hardware wallet integration follows device security models -- Secure memory management with explicit cleanup - -## License - -MIT License diff --git a/packages/sysweb3-keyring/src/bip84-native.ts b/packages/sysweb3-keyring/src/bip84-native.ts new file mode 100644 index 00000000..6d6fc20e --- /dev/null +++ b/packages/sysweb3-keyring/src/bip84-native.ts @@ -0,0 +1,12 @@ +/** Pure native-coin BIP84 transfer preparation, without a wallet or provider. */ +export { + Bip84NativeError, + prepareBip84NativeTransaction, +} from './transactions/bip84-native-plan'; +export type { + Bip84NativeErrorCode, + Bip84NetworkBinding, + Bip84Guard, + Bip84NativePlan, + PreparedBip84NativeTransaction, +} from './transactions/bip84-native-plan'; diff --git a/packages/sysweb3-keyring/src/declare.d.ts b/packages/sysweb3-keyring/src/declare.d.ts index ee1f2e64..95bc46b7 100644 --- a/packages/sysweb3-keyring/src/declare.d.ts +++ b/packages/sysweb3-keyring/src/declare.d.ts @@ -1,10 +1,6 @@ declare module 'syscoinjs-lib'; -declare module 'bip84'; -declare module 'syscointx-js'; -declare module '@pollum-io/sysweb3-core'; -declare module 'coinselectsyscoin'; +declare module '@sidhujag/sysweb3-core'; declare module 'bip32-path'; -declare module 'satoshi-bitcoin'; interface Window { pali: Readonly; } diff --git a/packages/sysweb3-keyring/src/ethers-subpaths.d.ts b/packages/sysweb3-keyring/src/ethers-subpaths.d.ts new file mode 100644 index 00000000..5d8de06e --- /dev/null +++ b/packages/sysweb3-keyring/src/ethers-subpaths.d.ts @@ -0,0 +1,35 @@ +declare module 'ethers/contract' { + export { Contract } from 'ethers'; +} + +declare module 'ethers/address' { + export { getAddress } from 'ethers'; +} + +declare module 'ethers/crypto' { + export { Signature, keccak256 } from 'ethers'; +} + +declare module 'ethers/providers' { + export { FeeData, JsonRpcProvider } from 'ethers'; + export type { JsonRpcPayload, Networkish } from 'ethers'; +} + +declare module 'ethers/transaction' { + export { Transaction } from 'ethers'; +} + +declare module 'ethers/utils' { + export { + FetchRequest, + dataSlice, + formatEther, + formatUnits, + getBigInt, + hexlify, + isHexString, + parseEther, + parseUnits, + } from 'ethers'; + export type { BytesLike } from 'ethers'; +} diff --git a/packages/sysweb3-keyring/src/ethers-v6.ts b/packages/sysweb3-keyring/src/ethers-v6.ts new file mode 100644 index 00000000..f4e91ddf --- /dev/null +++ b/packages/sysweb3-keyring/src/ethers-v6.ts @@ -0,0 +1,301 @@ +import { getAddress } from 'ethers/address'; +import { Contract as EthersContract } from 'ethers/contract'; +import { Signature, keccak256 } from 'ethers/crypto'; +import { JsonRpcProvider, type Networkish } from 'ethers/providers'; +import { Transaction } from 'ethers/transaction'; +import { + dataSlice, + formatEther as formatEtherBase, + formatUnits as formatUnitsBase, + hexlify, + isHexString, + parseEther as ethersParseEther, + parseUnits as ethersParseUnits, + type BytesLike, +} from 'ethers/utils'; + +export { + JsonRpcProvider, + getAddress, + dataSlice, + hexlify, + isHexString, + keccak256, + type BytesLike, + type Networkish, +}; + +export type TransactionRequest = Record; +export type TransactionResponse = any; +export const Contract: any = EthersContract; + +export type BigNumberish = + | bigint + | number + | string + | BigNumberCompat + | { _hex?: string; hex?: string; toString?: () => string }; + +export type Deferrable = { + [K in keyof T]: T[K] | Promise; +}; + +const strip0x = (value: string) => + value.startsWith('0x') || value.startsWith('0X') ? value.slice(2) : value; + +const toBigIntValue = (value: BigNumberish | null | undefined): bigint => { + if (value == null) return 0n; + if (value instanceof BigNumberCompat) return value.value; + if (typeof value === 'bigint') return value; + if (typeof value === 'number') return BigInt(Math.trunc(value)); + if (typeof value === 'string') { + if (value === '') return 0n; + return BigInt(value); + } + + const hex = value._hex ?? value.hex; + if (hex) return BigInt(hex); + + if (value.toString) return BigInt(value.toString()); + return 0n; +}; + +export class BigNumberCompat { + readonly _isBigNumber = true; + readonly value: bigint; + + private constructor(value: BigNumberish | null | undefined) { + this.value = toBigIntValue(value); + } + + static from(value: BigNumberish | null | undefined) { + return new BigNumberCompat(value); + } + + static isBigNumber(value: unknown): value is BigNumberCompat { + return ( + value instanceof BigNumberCompat || Boolean((value as any)?._isBigNumber) + ); + } + + get _hex() { + return this.toHexString(); + } + + get hex() { + return this.toHexString(); + } + + add(value: BigNumberish) { + return BigNumberCompat.from(this.value + toBigIntValue(value)); + } + + sub(value: BigNumberish) { + return BigNumberCompat.from(this.value - toBigIntValue(value)); + } + + mul(value: BigNumberish) { + return BigNumberCompat.from(this.value * toBigIntValue(value)); + } + + div(value: BigNumberish) { + return BigNumberCompat.from(this.value / toBigIntValue(value)); + } + + eq(value: BigNumberish) { + return this.value === toBigIntValue(value); + } + + lt(value: BigNumberish) { + return this.value < toBigIntValue(value); + } + + gt(value: BigNumberish) { + return this.value > toBigIntValue(value); + } + + isZero() { + return this.value === 0n; + } + + isNegative() { + return this.value < 0n; + } + + toBigInt() { + return this.value; + } + + toNumber() { + return Number(this.value); + } + + toHexString() { + const sign = this.value < 0n ? '-' : ''; + const abs = this.value < 0n ? -this.value : this.value; + const hex = abs.toString(16); + return `${sign}0x${hex.length % 2 ? `0${hex}` : hex}`; + } + + toString() { + return this.value.toString(); + } + + toJSON() { + return { + type: 'BigNumber', + hex: this.toHexString(), + }; + } +} + +export { BigNumberCompat as BigNumber }; +export const Zero = BigNumberCompat.from(0); + +export const parseUnits = (value: string, unit?: string | number) => + BigNumberCompat.from(ethersParseUnits(value, unit)); + +export const parseEther = (value: string) => + BigNumberCompat.from(ethersParseEther(value)); + +export const formatUnits = (value: BigNumberish, unit?: string | number) => + formatUnitsBase(toBigIntValue(value), unit); + +export const formatEther = (value: BigNumberish) => + formatEtherBase(toBigIntValue(value)); + +export const resolveProperties = async >( + value: Deferrable +): Promise => { + const entries = await Promise.all( + Object.entries(value).map(async ([key, entry]) => [key, await entry]) + ); + return Object.fromEntries(entries) as T; +}; + +export const shallowCopy = >(value: T): T => ({ + ...value, +}); + +export const toQuantityHex = (value: BigNumberish) => + BigNumberCompat.from(value).toHexString(); + +export const normalizeTxValue = (value: any): any => { + if (value == null) return value; + if (value instanceof BigNumberCompat) return value.toBigInt(); + if (typeof value === 'bigint') return value; + if (typeof value === 'number') { + if (!Number.isSafeInteger(value)) { + throw new Error('unsafe numeric transaction value'); + } + return BigInt(value); + } + if (typeof value === 'string') { + if (value === '') return 0n; + return value.startsWith('0x') || value.startsWith('0X') + ? BigInt(value) + : BigInt(value); + } + const hex = value._hex ?? value.hex; + if (hex) return BigInt(hex); + return value; +}; + +export const normalizeTransactionRequest = (tx: Record) => { + const normalized = { ...tx }; + if (normalized.type != null) { + normalized.type = Number(normalizeTxValue(normalized.type)); + } + for (const field of [ + 'chainId', + 'gasLimit', + 'gasPrice', + 'maxFeePerGas', + 'maxPriorityFeePerGas', + 'nonce', + 'value', + ]) { + if (normalized[field] != null) + normalized[field] = normalizeTxValue(normalized[field]); + } + return normalized; +}; + +export const serializeTransaction = ( + tx: Record, + signature?: { r: string; s: string; v?: number; recoveryParam?: number } +) => { + if (tx.type === 0 && tx.accessList != null) { + throw new Error('legacy transactions do not support accessList'); + } + + const txForSerialization = { ...tx }; + if ( + txForSerialization.type == null && + txForSerialization.accessList != null && + txForSerialization.maxFeePerGas == null && + txForSerialization.maxPriorityFeePerGas == null + ) { + txForSerialization.type = 1; + } + + if ( + txForSerialization.type === 2 && + txForSerialization.gasPrice != null && + txForSerialization.maxFeePerGas != null + ) { + const gasPrice = normalizeTxValue(txForSerialization.gasPrice); + const maxFeePerGas = normalizeTxValue(txForSerialization.maxFeePerGas); + if (gasPrice !== maxFeePerGas) { + throw new Error('mismatch EIP-1559 gasPrice != maxFeePerGas'); + } + } + + const transaction = Transaction.from( + normalizeTransactionRequest(txForSerialization) + ); + if (!signature) return transaction.unsignedSerialized; + + transaction.signature = Signature.from( + signature.v != null + ? { + r: signature.r, + s: signature.s, + v: signature.v, + } + : { + r: signature.r, + s: signature.s, + yParity: (signature.recoveryParam ?? 0) as 0 | 1, + } + ); + return transaction.serialized; +}; + +export const arrayify = (value: BytesLike) => + Buffer.from(strip0x(hexlify(value)), 'hex'); + +export const hexZeroPad = (value: BytesLike, length: number) => { + const hex = strip0x(hexlify(value)); + return `0x${hex.padStart(length * 2, '0')}`; +}; + +export const joinSignature = (signature: { + r: string; + s: string; + v?: number; + recoveryParam?: number; +}) => + Signature.from( + signature.v != null + ? { + r: signature.r, + s: signature.s, + v: signature.v, + } + : { + r: signature.r, + s: signature.s, + yParity: (signature.recoveryParam ?? 0) as 0 | 1, + } + ).serialized; diff --git a/packages/sysweb3-keyring/src/evm-fees.ts b/packages/sysweb3-keyring/src/evm-fees.ts new file mode 100644 index 00000000..96856306 --- /dev/null +++ b/packages/sysweb3-keyring/src/evm-fees.ts @@ -0,0 +1,230 @@ +/** Standard EVM fee discovery shared by extension and restricted native hosts. */ +export interface EvmFeeReader { + getGasPrice(): Promise; + getBlock(tag: 'latest'): Promise<{ baseFeePerGas?: unknown } | null>; + send( + method: 'eth_maxPriorityFeePerGas' | 'eth_feeHistory', + params: unknown[] + ): Promise; + readonly signal?: AbortSignal; +} + +export interface EvmFeeOptions { + /** The host retains responsibility for chain, endpoint and account binding. */ + assertCurrent?: () => void; + signal?: AbortSignal; + minPriorityFee?: unknown; + /** Positive, whole percentage; the existing recommendation uses 250. */ + feeMultiplier?: number; +} + +export type EvmFeeData = Readonly<{ + gasPrice: bigint; + /** Absent only when the observed header has no base-fee field. */ + baseFeePerGas?: bigint; + maxFeePerGas: bigint; + maxPriorityFeePerGas: bigint; +}>; + +const MAX_FEE = (1n << 256n) - 1n; + +/** Accept the SDK's existing BigNumberish forms without permissive zero coercion. */ +export function parseEvmFeeQuantity( + value: unknown, + label = 'fee quantity' +): bigint { + if (value !== null && typeof value === 'object') { + const object = value as { + _hex?: unknown; + hex?: unknown; + toString?: () => unknown; + }; + value = + object._hex ?? + object.hex ?? + (typeof object.toString === 'function' ? object.toString() : undefined); + if (typeof value !== 'string') throw new Error(`Invalid ${label}`); + } + if ( + !( + (typeof value === 'string' && + value.length <= 80 && + /^(?:0x[\da-f]+|\d+)$/i.test(value)) || + (typeof value === 'number' && + Number.isSafeInteger(value) && + value >= 0) || + (typeof value === 'bigint' && value >= 0n) + ) + ) + throw new Error(`Invalid ${label}`); + const quantity = BigInt(value as string | number | bigint); + if (quantity > MAX_FEE) throw new Error(`Invalid ${label}`); + return quantity; +} + +function unsupportedPriorityMethod(error: any): boolean { + const unsupportedCode = (code: unknown) => code === -32601 || code === 4200; + if (unsupportedCode(error?.code)) return true; + if (!['UNKNOWN_ERROR', 'UNSUPPORTED_OPERATION'].includes(error?.code)) + return false; + if ( + error?.operation != null && + error.operation !== 'eth_maxPriorityFeePerGas' + ) + return false; + return [ + { cause: error.error, payload: error.payload }, + { cause: error.info?.error, payload: error.info?.payload }, + ].some( + ({ cause, payload }) => + cause?.name !== 'AbortError' && + unsupportedCode(cause?.code) && + payload?.method === 'eth_maxPriorityFeePerGas' && + Array.isArray(payload.params) && + payload.params.length === 0 + ); +} + +/** + * No signer, transport, network registry or provider implementation is imported. + * Reads are serialized and guarded; RPC failures never become fabricated fees. + */ +export async function getEvmFeeData( + reader: EvmFeeReader, + options: EvmFeeOptions = {} +): Promise { + const signals = [options.signal, reader.signal].filter( + (signal): signal is AbortSignal => signal !== undefined + ); + const assertCurrent = options.assertCurrent; + const check = () => { + if (signals.some((signal) => signal.aborted)) { + const error = new Error('EVM fee discovery aborted'); + error.name = 'AbortError'; + throw error; + } + if (assertCurrent) { + const result: unknown = assertCurrent(); + if (result !== undefined) { + // A void callback type also accepts async functions. Never await one. + void Promise.resolve(result).catch(() => undefined); + throw new Error('EVM fee guard must be synchronous'); + } + } + if (signals.some((signal) => signal.aborted)) { + const error = new Error('EVM fee discovery aborted'); + error.name = 'AbortError'; + throw error; + } + }; + check(); + const minPriorityFee = + options.minPriorityFee == null + ? undefined + : parseEvmFeeQuantity(options.minPriorityFee, 'minimum priority fee'); + // Retain the existing zero/absent override behavior. + const multiplier = options.feeMultiplier || 250; + if (!Number.isSafeInteger(multiplier) || multiplier < 1) + throw new Error('Invalid fee multiplier'); + const getGasPrice = reader.getGasPrice.bind(reader); + const getBlock = reader.getBlock.bind(reader); + const send = reader.send.bind(reader); + const read = async (operation: () => Promise): Promise => { + check(); + let cleanup = () => undefined; + try { + const interrupted = new Promise((_, reject) => { + const abort = () => { + const error = new Error('EVM fee discovery aborted'); + error.name = 'AbortError'; + reject(error); + }; + signals.forEach((signal) => + signal.addEventListener('abort', abort, { once: true }) + ); + cleanup = () => { + signals.forEach((signal) => + signal.removeEventListener('abort', abort) + ); + return undefined; + }; + }); + // No asynchronous gap between the current-owner check and dispatch. + const result = await Promise.race([operation(), interrupted]); + check(); + return result; + } catch (error) { + check(); + throw error; + } finally { + cleanup(); + } + }; + + const gasPrice = parseEvmFeeQuantity(await read(getGasPrice), 'gas price'); + const block = await read(() => getBlock('latest')); + if (!block) throw new Error('Block not found'); + if (typeof block !== 'object' || Array.isArray(block)) + throw new Error('Invalid block'); + const rawBaseFee = block.baseFeePerGas; + if (rawBaseFee == null) { + check(); + return Object.freeze({ + gasPrice, + maxFeePerGas: 0n, + maxPriorityFeePerGas: 0n, + }); + } + const baseFeePerGas = parseEvmFeeQuantity(rawBaseFee, 'base fee'); + let maxPriorityFeePerGas: bigint; + try { + maxPriorityFeePerGas = parseEvmFeeQuantity( + await read(() => send('eth_maxPriorityFeePerGas', [])), + 'priority fee' + ); + } catch (error) { + check(); + if ( + error?.code === 'SYSWEB3_RPC_RESPONSE_INVALID' || + error?.name === 'AbortError' || + !unsupportedPriorityMethod(error) + ) + throw error; + const history = await read(() => + send('eth_feeHistory', ['0x5', 'latest', [25, 50, 75]]) + ); + const rewards = (history as { reward?: unknown } | null)?.reward; + if (!Array.isArray(rewards) || rewards.length < 1 || rewards.length > 5) + throw new Error('Priority fee history unavailable'); + const recentFees = rewards + .map((reward: unknown) => { + if (!Array.isArray(reward) || reward.length !== 3) + throw new Error('Invalid priority fee history'); + const parsed = reward.map((value) => + parseEvmFeeQuantity(value, 'priority fee history') + ); + return parsed[1]; + }) + .sort((a, b) => (a < b ? -1 : a > b ? 1 : 0)); + maxPriorityFeePerGas = + (recentFees[Math.floor(recentFees.length / 2)] * 150n) / 100n; + } + if (minPriorityFee !== undefined && maxPriorityFeePerGas < minPriorityFee) + maxPriorityFeePerGas = minPriorityFee; + const baseline = (gasPrice * 120n) / 100n; + const calculated = + (baseFeePerGas * BigInt(multiplier)) / 100n + maxPriorityFeePerGas; + let maxFeePerGas = calculated > baseline ? calculated : baseline; + const minimum = (maxPriorityFeePerGas * 120n) / 100n; + if (maxFeePerGas < minimum) maxFeePerGas = minimum; + if (maxFeePerGas === 0n) throw new Error('Invalid EIP-1559 maximum fee'); + parseEvmFeeQuantity(maxFeePerGas, 'maximum fee'); + parseEvmFeeQuantity(maxPriorityFeePerGas, 'priority fee'); + check(); + return Object.freeze({ + gasPrice, + baseFeePerGas, + maxFeePerGas, + maxPriorityFeePerGas, + }); +} diff --git a/packages/sysweb3-keyring/src/hardware-wallet-manager-singleton.ts b/packages/sysweb3-keyring/src/hardware-wallet-manager-singleton.ts new file mode 100644 index 00000000..ce69c440 --- /dev/null +++ b/packages/sysweb3-keyring/src/hardware-wallet-manager-singleton.ts @@ -0,0 +1,34 @@ +import { HardwareWalletManager } from './hardware-wallet-manager'; + +/** + * Singleton wrapper for HardwareWalletManager to ensure a single instance + * is shared across all KeyringManager instances. This prevents "device already open" + * errors when multiple networks try to connect to the same Ledger device. + */ +class HardwareWalletManagerSingleton { + private static instance: HardwareWalletManager | null = null; + + /** + * Get the shared HardwareWalletManager instance + * Creates one if it doesn't exist + */ + static getInstance(): HardwareWalletManager { + if (!HardwareWalletManagerSingleton.instance) { + HardwareWalletManagerSingleton.instance = new HardwareWalletManager(); + } + return HardwareWalletManagerSingleton.instance; + } + + /** + * Reset the singleton instance (useful for testing) + */ + static resetInstance(): void { + if (HardwareWalletManagerSingleton.instance) { + // Clean up any existing connections + HardwareWalletManagerSingleton.instance.destroy(); + HardwareWalletManagerSingleton.instance = null; + } + } +} + +export { HardwareWalletManagerSingleton }; \ No newline at end of file diff --git a/packages/sysweb3-keyring/src/hardware-wallet-manager.ts b/packages/sysweb3-keyring/src/hardware-wallet-manager.ts index 87e36e1c..d3f349c8 100644 --- a/packages/sysweb3-keyring/src/hardware-wallet-manager.ts +++ b/packages/sysweb3-keyring/src/hardware-wallet-manager.ts @@ -1,9 +1,10 @@ -import Transport from '@ledgerhq/hw-transport'; -import HIDTransport from '@ledgerhq/hw-transport-webhid'; -import { listen } from '@ledgerhq/logs'; -import TrezorConnect from '@trezor/connect-webextension'; import { EventEmitter } from 'events'; +import { ledgerCancelledError, ledgerHostError } from './ledger/host-types'; +import TrezorConnect, { subscribeTrezorEvents } from './trezor/connect'; + +import type { LedgerHost } from './ledger/host-types'; + export enum HardwareWalletType { LEDGER = 'ledger', TREZOR = 'trezor', @@ -17,7 +18,6 @@ export enum ConnectionStatus { } interface ConnectionPoolEntry { - transport?: Transport | null; status: ConnectionStatus; lastActivity: number; retryCount: number; @@ -49,7 +49,11 @@ export interface HardwareWalletStatus { export class HardwareWalletManager extends EventEmitter { private connectionPool: Map = new Map(); private statusMonitorInterval: NodeJS.Timeout | null = null; - private readonly CONNECTION_TIMEOUT = 30000; // 30 seconds + private unsubscribeTrezor?: () => void; + private lifecycleGeneration = 0; + private trezorInitialization?: object; + private destruction?: Promise; + private ledgerInitialization?: Promise; private readonly IDLE_TIMEOUT = 5 * 60 * 1000; // 5 minutes private readonly STATUS_CHECK_INTERVAL = 5000; // 5 seconds @@ -60,121 +64,121 @@ export class HardwareWalletManager extends EventEmitter { backoffMultiplier: 2, }; - constructor() { + constructor(private readonly ledgerHost?: LedgerHost) { super(); + this.observeTrezor(); this.startStatusMonitoring(); + } - // Set up Ledger debug logging - if (process.env.NODE_ENV === 'development') { - listen((log) => { - console.log(`[Ledger] ${log.type}: ${log.message}`); - }); - } + private observeTrezor(): void { + if (this.unsubscribeTrezor) return; + this.unsubscribeTrezor = subscribeTrezorEvents((event) => { + if (event.type === 'disconnected') { + // Our pre-init disposal and Connect initialization invalidate the + // adapter too. Keep this attempt owned until it settles or is revoked. + if ( + this.connectionPool.get('trezor-default')?.status === + ConnectionStatus.CONNECTING + ) + return; + this.handleDisconnect('trezor-default', HardwareWalletType.TREZOR); + } + }); } - /** - * Get or create a Ledger connection with retry logic - */ - async getLedgerConnection(): Promise { - const key = `${HardwareWalletType.LEDGER}-default`; - const existing = this.connectionPool.get(key); + /** Raw transports are deliberately unavailable through the semantic host boundary. */ + async getLedgerConnection(): Promise { + throw ledgerHostError( + 'HARDWARE_SIGNER_UNAVAILABLE', + 'Ledger requires a semantic LedgerHost; raw Ledger transports are not supported' + ); + } - if (existing?.transport && existing.status === ConnectionStatus.CONNECTED) { - existing.lastActivity = Date.now(); - return existing.transport; + private async initializeLedger(): Promise { + const host = this.ledgerHost; + if (!host) { + throw ledgerHostError( + 'HARDWARE_SIGNER_UNAVAILABLE', + 'A semantic LedgerHost is required to connect Ledger' + ); } + if (this.destruction) throw ledgerCancelledError(); + this.startStatusMonitoring(); + const key = `${HardwareWalletType.LEDGER}-default`; + if (host.getStatus().connected) { + const existing = this.connectionPool.get(key); + if (existing) existing.lastActivity = Date.now(); + return; + } + if (this.ledgerInitialization) return this.ledgerInitialization; - return this.createLedgerConnectionWithRetry(key); - } - - /** - * Create Ledger connection with exponential backoff retry - */ - private async createLedgerConnectionWithRetry( - key: string - ): Promise { + const generation = this.lifecycleGeneration; const entry: ConnectionPoolEntry = { status: ConnectionStatus.CONNECTING, lastActivity: Date.now(), retryCount: 0, }; this.connectionPool.set(key, entry); - - let lastError: Error | undefined; - - for (let attempt = 0; attempt <= this.retryConfig.maxRetries; attempt++) { - try { - this.emit('connectionAttempt', { + const isCurrent = () => + generation === this.lifecycleGeneration && + this.connectionPool.get(key) === entry && + !this.destruction; + const assertCurrent = () => { + if (!isCurrent()) throw ledgerCancelledError(); + }; + // Install the shared promise before any observer can re-enter this method. + const pending = Promise.resolve().then(async () => { + assertCurrent(); + this.emit('connectionAttempt', { + type: HardwareWalletType.LEDGER, + attempt: 1, + maxAttempts: 1, + }); + assertCurrent(); + // Device selection happens in the visible host, never by a background chooser. + await host.connect({ useGrantedDevices: true }); + assertCurrent(); + if (!host.getStatus().connected) + throw ledgerHostError( + 'HARDWARE_SIGNER_UNAVAILABLE', + 'Connect a Ledger device in the Ledger window' + ); + entry.status = ConnectionStatus.CONNECTED; + entry.lastActivity = Date.now(); + this.emit('connected', { type: HardwareWalletType.LEDGER }); + assertCurrent(); + }); + this.ledgerInitialization = pending; + try { + await pending; + } catch (error) { + if (isCurrent()) { + entry.status = ConnectionStatus.ERROR; + entry.error = error as Error; + this.emit('connectionFailed', { type: HardwareWalletType.LEDGER, - attempt: attempt + 1, - maxAttempts: this.retryConfig.maxRetries + 1, + error: entry.error.message, }); - - const transport = await this.createLedgerTransport(); - - entry.transport = transport; - entry.status = ConnectionStatus.CONNECTED; - entry.retryCount = 0; - entry.error = undefined; - - this.emit('connected', { type: HardwareWalletType.LEDGER }); - - // Set up disconnect handler - transport.on('disconnect', () => { - this.handleDisconnect(key, HardwareWalletType.LEDGER); - }); - - return transport; - } catch (error) { - lastError = error as Error; - entry.retryCount = attempt + 1; - entry.error = lastError; - - if (attempt < this.retryConfig.maxRetries) { - const delay = this.calculateBackoffDelay(attempt); - - this.emit('retrying', { - type: HardwareWalletType.LEDGER, - attempt: attempt + 1, - nextRetryIn: delay, - error: lastError.message, - }); - - await this.delay(delay); - } } + throw error; + } finally { + if (this.ledgerInitialization === pending) + this.ledgerInitialization = undefined; } - - entry.status = ConnectionStatus.ERROR; - this.emit('connectionFailed', { - type: HardwareWalletType.LEDGER, - error: lastError?.message, - }); - - throw new Error( - `Failed to connect to Ledger after ${ - this.retryConfig.maxRetries + 1 - } attempts: ${lastError?.message || 'Unknown error'}` - ); - } - - /** - * Create Ledger transport with timeout - */ - private async createLedgerTransport(): Promise { - return Promise.race([ - HIDTransport.create(), - this.createTimeoutPromise( - this.CONNECTION_TIMEOUT, - 'Ledger connection timeout' - ), - ]); } /** * Initialize Trezor with retry logic */ async initializeTrezor(): Promise { + if (this.destruction) { + throw Object.assign(new Error('Trezor connection is closing'), { + code: 'Method_Interrupted', + }); + } + const generation = this.lifecycleGeneration; + this.observeTrezor(); + this.startStatusMonitoring(); const key = `${HardwareWalletType.TREZOR}-default`; const existing = this.connectionPool.get(key); @@ -184,29 +188,50 @@ export class HardwareWalletManager extends EventEmitter { } // Check if we're already trying to connect - if (existing?.status === ConnectionStatus.CONNECTING) { + if ( + this.trezorInitialization || + existing?.status === ConnectionStatus.CONNECTING + ) { console.log( '[HardwareWalletManager] Trezor connection already in progress' ); // Wait a bit and check again await this.delay(1000); + if (generation !== this.lifecycleGeneration || this.destruction) + return false; const updated = this.connectionPool.get(key); return updated?.status === ConnectionStatus.CONNECTED || false; } - return this.initializeTrezorWithRetry(key); + const owner = {}; + this.trezorInitialization = owner; + try { + return await this.initializeTrezorWithRetry(key, owner, generation); + } finally { + if (this.trezorInitialization === owner) + this.trezorInitialization = undefined; + } } /** * Initialize Trezor with exponential backoff retry */ - private async initializeTrezorWithRetry(key: string): Promise { + private async initializeTrezorWithRetry( + key: string, + owner: object, + generation: number + ): Promise { const entry: ConnectionPoolEntry = { status: ConnectionStatus.CONNECTING, lastActivity: Date.now(), retryCount: 0, }; this.connectionPool.set(key, entry); + const isCurrent = () => + generation === this.lifecycleGeneration && + this.trezorInitialization === owner && + this.connectionPool.get(key) === entry && + !this.destruction; let lastError: Error | undefined; @@ -217,14 +242,16 @@ export class HardwareWalletManager extends EventEmitter { }; for (let attempt = 0; attempt <= trezorRetryConfig.maxRetries; attempt++) { + if (!isCurrent()) return false; try { this.emit('connectionAttempt', { type: HardwareWalletType.TREZOR, attempt: attempt + 1, maxAttempts: trezorRetryConfig.maxRetries + 1, }); + if (!isCurrent()) return false; - // Dispose any existing iframe before initialization + // Dispose the previous Suite connection before initialization try { await TrezorConnect.dispose(); } catch (disposeError) { @@ -233,20 +260,19 @@ export class HardwareWalletManager extends EventEmitter { disposeError ); } + if (!isCurrent()) return false; await TrezorConnect.init({ manifest: { + appName: 'Pali Wallet', appUrl: 'https://paliwallet.com/', email: 'support@syscoin.org', }, - lazyLoad: true, - popup: true, - connectSrc: 'https://connect.trezor.io/9/', - _extendWebextensionLifetime: true, - transports: ['BridgeTransport', 'WebUsbTransport'], debug: false, // Disable debug mode to prevent extra logs - coreMode: 'popup', // Use popup mode for webUSB support in Chrome extension + // Connect chooses Suite Desktop, then the supported Suite Web fallback. + coreMode: 'auto', }); + if (!isCurrent()) return false; entry.status = ConnectionStatus.CONNECTED; entry.retryCount = 0; @@ -254,16 +280,22 @@ export class HardwareWalletManager extends EventEmitter { this.emit('connected', { type: HardwareWalletType.TREZOR }); - // Set up device event listeners - TrezorConnect.on('DEVICE_EVENT', (event: any) => { - if (event.type === 'device-disconnect') { - this.handleDisconnect(key, HardwareWalletType.TREZOR); - } - }); - - return true; + return isCurrent(); } catch (error) { + // Teardown or a newer owner revoked this attempt. Its continuation + // must not mutate status, retry, or dispose the newer connection. + if (!isCurrent()) return false; lastError = error as Error; + if ((lastError as any).code === 'HARDWARE_SIGNER_BUSY') { + entry.status = ConnectionStatus.ERROR; + entry.error = lastError; + this.emit('connectionFailed', { + type: HardwareWalletType.TREZOR, + error: lastError.message, + }); + throw lastError; + } + if ((lastError as any).code === 'HARDWARE_SIGNER_UNAVAILABLE') break; // Check if already initialized - this is actually OK if ( @@ -275,12 +307,13 @@ export class HardwareWalletManager extends EventEmitter { try { // Test the connection with a simple call const testResponse = await TrezorConnect.getFeatures(); + if (!isCurrent()) return false; if (testResponse.success) { entry.status = ConnectionStatus.CONNECTED; entry.retryCount = 0; entry.error = undefined; this.emit('connected', { type: HardwareWalletType.TREZOR }); - return true; + return isCurrent(); } } catch (testError) { console.log( @@ -288,10 +321,12 @@ export class HardwareWalletManager extends EventEmitter { testError ); } + if (!isCurrent()) return false; // If test failed, dispose and retry try { await TrezorConnect.dispose(); + if (!isCurrent()) return false; await this.delay(500); } catch (disposeError) { console.log( @@ -299,6 +334,7 @@ export class HardwareWalletManager extends EventEmitter { disposeError ); } + if (!isCurrent()) return false; } entry.retryCount = attempt + 1; @@ -316,6 +352,7 @@ export class HardwareWalletManager extends EventEmitter { // Try to dispose and reinitialize try { await TrezorConnect.dispose(); + if (!isCurrent()) return false; await this.delay(2000); // Wait 2 seconds before retry } catch (disposeError) { console.log( @@ -323,14 +360,11 @@ export class HardwareWalletManager extends EventEmitter { disposeError ); } + if (!isCurrent()) return false; } // Don't retry if user cancelled - if ( - lastError.message.includes('Popup closed') || - lastError.message.includes('cancelled') || - lastError.message.includes('denied') - ) { + if (this.isUserCancellationError(lastError)) { console.log( '[HardwareWalletManager] User cancelled Trezor connection' ); @@ -348,15 +382,18 @@ export class HardwareWalletManager extends EventEmitter { }); await this.delay(delay); + if (!isCurrent()) return false; } } } + if (!isCurrent()) return false; entry.status = ConnectionStatus.ERROR; this.emit('connectionFailed', { type: HardwareWalletType.TREZOR, error: lastError?.message, }); + if (!isCurrent()) return false; // Clean up on failure try { @@ -378,7 +415,6 @@ export class HardwareWalletManager extends EventEmitter { const entry = this.connectionPool.get(key); if (entry) { entry.status = ConnectionStatus.DISCONNECTED; - entry.transport = null; this.emit('disconnected', { type }); } } @@ -400,20 +436,34 @@ export class HardwareWalletManager extends EventEmitter { * Check all connections and clean up idle ones */ private async checkAllConnections(): Promise { + const generation = this.lifecycleGeneration; + const isCurrent = () => + generation === this.lifecycleGeneration && !this.destruction; + if (!isCurrent()) return; const now = Date.now(); const statuses: HardwareWalletStatus[] = []; for (const [key, entry] of this.connectionPool.entries()) { + if (!isCurrent()) return; const type = key.startsWith(HardwareWalletType.LEDGER) ? HardwareWalletType.LEDGER : HardwareWalletType.TREZOR; + if ( + type === HardwareWalletType.LEDGER && + entry.status === ConnectionStatus.CONNECTED && + !this.ledgerHost?.getStatus().connected + ) { + this.handleDisconnect(key, type); + } + // Clean up idle connections if ( entry.status === ConnectionStatus.CONNECTED && now - entry.lastActivity > this.IDLE_TIMEOUT ) { - await this.closeConnection(key); + await this.closeConnection(key, entry); + if (!isCurrent()) return; continue; } @@ -429,7 +479,7 @@ export class HardwareWalletManager extends EventEmitter { statuses.push(status); } - this.emit('statusUpdate', statuses); + if (isCurrent()) this.emit('statusUpdate', statuses); } /** @@ -442,10 +492,20 @@ export class HardwareWalletManager extends EventEmitter { const ledgerEntry = this.connectionPool.get( `${HardwareWalletType.LEDGER}-default` ); + const ledgerConnected = + !this.destruction && this.ledgerHost?.getStatus().connected === true; statuses.push({ type: HardwareWalletType.LEDGER, - status: ledgerEntry?.status || ConnectionStatus.DISCONNECTED, - connected: ledgerEntry?.status === ConnectionStatus.CONNECTED, + status: this.destruction + ? ConnectionStatus.DISCONNECTED + : ledgerConnected + ? ConnectionStatus.CONNECTED + : ledgerEntry?.status === ConnectionStatus.CONNECTING + ? ConnectionStatus.CONNECTING + : ledgerEntry?.status === ConnectionStatus.ERROR + ? ConnectionStatus.ERROR + : ConnectionStatus.DISCONNECTED, + connected: ledgerConnected, lastSeen: ledgerEntry?.lastActivity, error: ledgerEntry?.error?.message, }); @@ -469,6 +529,10 @@ export class HardwareWalletManager extends EventEmitter { * Check if a specific device is connected */ isConnected(type: HardwareWalletType): boolean { + if (type === HardwareWalletType.LEDGER) + return ( + !this.destruction && this.ledgerHost?.getStatus().connected === true + ); const key = `${type}-default`; const entry = this.connectionPool.get(key); return entry?.status === ConnectionStatus.CONNECTED; @@ -479,7 +543,7 @@ export class HardwareWalletManager extends EventEmitter { */ async ensureConnection(type: HardwareWalletType): Promise { if (type === HardwareWalletType.LEDGER) { - await this.getLedgerConnection(); + await this.initializeLedger(); } else if (type === HardwareWalletType.TREZOR) { const initialized = await this.initializeTrezor(); if (!initialized) { @@ -491,8 +555,11 @@ export class HardwareWalletManager extends EventEmitter { /** * Close a specific connection */ - private async closeConnection(key: string): Promise { - const entry = this.connectionPool.get(key); + private async closeConnection( + key: string, + entry = this.connectionPool.get(key) + ): Promise { + if (!entry || this.connectionPool.get(key) !== entry) return; // Handle Trezor connections if (key.startsWith(HardwareWalletType.TREZOR)) { @@ -503,34 +570,74 @@ export class HardwareWalletManager extends EventEmitter { } } - // Handle Ledger connections - if (entry?.transport) { + if (key.startsWith(HardwareWalletType.LEDGER)) { try { - await entry.transport.close(); + await this.ledgerHost?.disconnect(); } catch (error) { - console.error('Error closing transport:', error); + console.error('Error disconnecting Ledger host:', error); } } - this.connectionPool.delete(key); + if (this.connectionPool.get(key) === entry) this.connectionPool.delete(key); } /** * Close all connections and stop monitoring */ - async destroy(): Promise { + destroy(): Promise { + if (this.destruction) return this.destruction; + // Revoke pending initialization synchronously, before closing any transport. + this.lifecycleGeneration++; + this.trezorInitialization = undefined; + this.ledgerInitialization = undefined; + this.unsubscribeTrezor?.(); + this.unsubscribeTrezor = undefined; // Stop monitoring if (this.statusMonitorInterval) { clearInterval(this.statusMonitorInterval); this.statusMonitorInterval = null; } - // Close all connections - for (const key of this.connectionPool.keys()) { - await this.closeConnection(key); + const entries = [...this.connectionPool.entries()]; + const trezor = this.connectionPool.get('trezor-default'); + if (trezor) trezor.status = ConnectionStatus.DISCONNECTED; + let resolve!: () => void; + let reject!: (reason: unknown) => void; + const destruction = new Promise((done, failed) => { + resolve = done; + reject = failed; + }); + this.destruction = destruction; + // Revoke Trezor first, then Ledger in this same call stack. Awaiting either + // cleanup before revoking the other could admit an already-queued response. + const trezorCleanup = entries + .filter(([key]) => key.startsWith(HardwareWalletType.TREZOR)) + .map(([key, entry]) => this.closeConnection(key, entry)); + let ledgerCleanup: Promise; + try { + ledgerCleanup = Promise.resolve(this.ledgerHost?.disconnect()).catch( + (error) => { + console.error('Error disconnecting Ledger host:', error); + } + ); + } catch (error) { + console.error('Error disconnecting Ledger host:', error); + ledgerCleanup = Promise.resolve(); } - - this.removeAllListeners(); + const close = async () => { + try { + await Promise.all([...trezorCleanup, ledgerCleanup]); + for (const [key, entry] of entries) { + if (this.connectionPool.get(key) === entry) + this.connectionPool.delete(key); + } + this.removeAllListeners(); + } finally { + if (this.destruction === destruction) this.destruction = undefined; + } + }; + void close().then(resolve, reject); + return destruction; } /** @@ -547,15 +654,6 @@ export class HardwareWalletManager extends EventEmitter { return Math.round(delay + jitter); } - /** - * Create a timeout promise - */ - private createTimeoutPromise(ms: number, message: string): Promise { - return new Promise((_, reject) => { - setTimeout(() => reject(new Error(message)), ms); - }); - } - /** * Delay helper */ @@ -580,6 +678,11 @@ export class HardwareWalletManager extends EventEmitter { } catch (error) { lastError = error as Error; + // Do not retry on explicit user cancellations (Ledger/Trezor) + if (this.isUserCancellationError(lastError)) { + throw lastError; + } + if (attempt < config.maxRetries) { const delay = this.calculateBackoffDelay(attempt); @@ -601,4 +704,74 @@ export class HardwareWalletManager extends EventEmitter { }` ); } + + /** + * Detects common user-cancellation errors to avoid pointless retries + */ + private isUserCancellationError(err: Error): boolean { + const message = (err?.message || '').toLowerCase(); + const name = (err as any)?.name || ''; + const statusCode = (err as any)?.statusCode; + const code = (err as any)?.code; + if ( + code === 'HARDWARE_REQUEST_CANCELLED' || + code === 'HARDWARE_CLEAR_SIGNING_UNAVAILABLE' || + code === 'HARDWARE_ACCOUNT_MISMATCH' || + code === 'LEDGER_INVALID_REQUEST' || + code === 'LEDGER_INVALID_RESPONSE' || + code === 'LEDGER_INVALID_SIGNATURE' || + code === 'HARDWARE_SIGNER_UNAVAILABLE' || + code === 'HARDWARE_SIGNER_BUSY' || + code === 'Method_Cancel' || + code === 'Method_Interrupted' || + code === 'Method_PermissionsNotGranted' || + code === 'Method_Unsupported' || + code === 'Method_UnsupportedCoinForHost' || + code === 'Device_Disconnected' || + code === 'Device_NotFound' || + code === 'Device_CallInProgress' || + code === 'Transport_Missing' || + code === 'Desktop_ConnectionMissing' || + code === 'Browser_LocalNetworkPermissionMissing' + ) + return true; + + // Ledger: 0x6985 (Conditions of use not satisfied) on rejection + if (statusCode === 0x6985) return true; + + // Message-based heuristics across vendors + if ( + message.includes('0x6985') || + (message.includes('condition') && + message.includes('not') && + message.includes('satisf')) || + message.includes('not allowed') || + message.includes('permission denied') || + message.includes('permissions not granted') || + message.includes('user rejected') || + message.includes('denied by the user') || + message.includes('failure_actioncancelled') || + message.includes('denied') || + message.includes('rejected') || + message.includes('refused') || + message.includes('cancelled') || + message.includes('canceled') || + message.includes('popup closed') + ) { + return true; + } + + // Name-based checks (align with frontend utilities) + if ( + name === 'NotAllowedError' || + name === 'AbortError' || + name === 'UserCancel' || + name === 'TransportError' || + name === 'DOMException' + ) { + return true; + } + + return false; + } } diff --git a/packages/sysweb3-keyring/src/index.ts b/packages/sysweb3-keyring/src/index.ts index efa3e457..0d6b28f9 100644 --- a/packages/sysweb3-keyring/src/index.ts +++ b/packages/sysweb3-keyring/src/index.ts @@ -1,12 +1,26 @@ export * from './transactions'; -export * from './trezor'; export * from './types'; export * from './storage'; export * from './signers'; export * from './initial-state'; export * from './keyring-manager'; +export { + MAX_PRIVATE_RECORD_BYTES, + MAX_PRIVATE_RECORD_LABEL_BYTES, +} from './private-records'; +export type { + IDecryptPrivateRecordParams, + IEncryptedPrivateRecord, + IEncryptPrivateRecordParams, +} from './private-records'; export * from './providers'; export * from './utils/derivation-paths'; export * from './network-utils'; export * from './hardware-wallet-manager'; +export * from './hardware-wallet-manager-singleton'; export { PsbtUtils } from './utils/psbt'; +export { invalidateBlockbookAccountCache } from './utils/blockbook-cache'; +export { + deriveDescriptorAddress, + descriptorChecksum, +} from './utils/watch-descriptor'; diff --git a/packages/sysweb3-keyring/src/initial-state.ts b/packages/sysweb3-keyring/src/initial-state.ts index d69c015f..a1e9b49c 100644 --- a/packages/sysweb3-keyring/src/initial-state.ts +++ b/packages/sysweb3-keyring/src/initial-state.ts @@ -1,6 +1,7 @@ +import { INetworkType } from '@sidhujag/sysweb3-network'; + import { getDefaultUTXONetworks } from './network-utils'; import { IKeyringAccountState } from './types'; -import { INetworkType } from '@pollum-io/sysweb3-network'; export const initialActiveHdAccountState: IKeyringAccountState = { address: '', diff --git a/packages/sysweb3-keyring/src/keyring-core.ts b/packages/sysweb3-keyring/src/keyring-core.ts new file mode 100644 index 00000000..c8b51219 --- /dev/null +++ b/packages/sysweb3-keyring/src/keyring-core.ts @@ -0,0 +1,3789 @@ +import ecc from '@bitcoinerlab/secp256k1'; +import { + INetwork, + INetworkType, + getNetworkConfig, +} from '@sidhujag/sysweb3-network'; +import { BIP32Factory } from 'bip32'; +import { Psbt } from 'bitcoinjs-lib'; +import bs58check from 'bs58check'; +import crypto from 'crypto'; +import CryptoJS from 'crypto-js'; +import mapValues from 'lodash/mapValues'; +import omit from 'lodash/omit'; +import * as syscoinjs from 'syscoinjs-lib'; +import * as BIP84 from 'syscoinjs-lib/bip84-replacement'; + +// Reference embedded bitcoinjs from syscoinjs-lib +// eslint-disable-next-line @typescript-eslint/no-explicit-any +const bjs: any = (syscoinjs.utils as any).bitcoinjs; + +const LEGACY_ENCRYPTION_KDF = 'pbkdf2-sha512-20000'; +const SLH_DSA_DERIVATION_VERSION = 1; +// Preserve Pali v1 SLH derivation: first 32 bytes of the account-scoped HMAC. +// Pali expands this setup secret into the 48-byte SLH skSeed/skPrf/pkSeed tuple. +const SLH_DSA_SETUP_SECRET_HEX_LENGTH = 64; +const SLH_DSA_PARAMETER_SET = 'SLH-DSA-SHA2-128-24'; + +import { getAddress, isHexString } from './ethers-v6'; +import { + initialActiveImportedAccountState, + initialActiveLedgerAccountState, + initialActiveTrezorAccountState, +} from './initial-state'; +import { + decryptPrivateRecordBytes, + encryptPrivateRecordBytes, + privateRecordProfileId, + IDecryptPrivateRecordParams, + IEncryptedPrivateRecord, + IEncryptPrivateRecordParams, +} from './private-records'; +import { + deriveBip84PublicAddress, + parseBip84PublicAccount, +} from './public-bip84'; +import { getSyscoinSigners, SyscoinHDSigner } from './signers'; +import { snapshotEvmHdIndex } from './software-hd-account'; +import { + snapshotBip84HdPublicRequest, + Bip84HdPublicRequest, + Bip84HdPublicResult, +} from './software-utxo-account'; +import { VaultAuthenticationError } from './storage-core'; +import { + bip84Profile, + Bip84Guard, + Bip84NativeError, + snapshotBip84Guard, +} from './transactions/bip84-native-plan'; +import { EthereumTransactions } from './transactions/ethereum'; +import { + deriveEvmAccountFromMnemonic, + privateKeyToAccount, +} from './transactions/evm-local-signer'; +import { + clearBip84PrivateNodes, + PreparedBip84SigningRequest, + SignedBip84NativeTransaction, + signValidatedBip84Plan, + snapshotPreparedBip84Request, +} from './transactions/prepared-bip84'; +import { + preparedEvmGuard, + signPreparedEvmEnvelope, + snapshotPreparedEvmRequest, +} from './transactions/prepared-evm'; +import { + SyscoinTransactionsCore, + createHardwareSignerUnavailableError, + type ISyscoinHardwareSigners, +} from './transactions/syscoin-core'; +import { + IKeyringAccountState, + ICreateSmartAccountParams, + ISyscoinTransactions, + KeyringAccountType, + IEthereumTransactions, + IEvmReplacementOptions, +} from './types'; +import { fetchBackendAccountCached as fetchBlockbookAccountCached } from './utils/blockbook-cache'; +import { + getAddressDerivationPath, + isEvmCoin, + convertExtendedKeyVersion, +} from './utils/derivation-paths'; +import { + assertPsbtAccountScope, + createPsbtDerivationGuard, +} from './utils/psbt-account-scope'; +import { deriveDescriptorAddress } from './utils/watch-descriptor'; + +import type { LedgerKeyring } from './ledger'; +import type { + EncryptedEvmHdRuntimeAccount, + EvmHdRuntimeAccountOptions, + EvmHdRuntimeAccountRequest, +} from './software-hd-account'; +import type { VaultPersistence, VaultStoragePort } from './storage-core'; +import type { + PreparedEvmSigningOptions, + PreparedSoftwareEvmSigningRequest, + SignedPreparedEvmTransaction, +} from './transactions/prepared-evm'; +import type { TrezorKeyring } from './trezor'; + +/** Explicit asynchronous host storage; no browser or global DI fallback. */ +export interface KeyringStoragePort extends VaultStoragePort { + get(key: string): Promise; + deleteItem(key: string): Promise; + /** Legacy adapter capability; fixed native hosts can omit it. */ + setClient?(client: any): void; +} + +/** Only the device capabilities consumed by the wallet authority. */ +export interface KeyringLedgerSigner { + destroy: LedgerKeyring['destroy']; + evm: Pick< + LedgerKeyring['evm'], + | 'getEvmAddressAndPubKey' + | 'signTypedData' + | 'signPersonalMessage' + | 'signEVMTransaction' + >; + utxo: Pick; + verifyUtxoAddress: LedgerKeyring['verifyUtxoAddress']; +} + +export type KeyringTrezorSigner = Pick< + TrezorKeyring, + | 'destroy' + | 'getAccountInfo' + | 'getPublicKey' + | 'signTypedData' + | 'signMessage' + | 'signEthTransaction' + | 'verifyUtxoAddress' +>; + +export interface KeyringCoreDependencies< + TLedger extends KeyringLedgerSigner | undefined, + TTrezor extends KeyringTrezorSigner | undefined +> { + /** Immutable identity shared only by keyrings in the same wallet authority. */ + authority: object; + storage: KeyringStoragePort; + /** Must be bound to this authority's storage and shared across its keyrings. */ + vaultPersistence: VaultPersistence; + ledgerSigner: TLedger; + trezorSigner: TTrezor; + /** Trusted host adapters; absent device capabilities fail closed. */ + syscoinHardwareSigners?: ISyscoinHardwareSigners; +} + +export interface ISysAccount { + address: string; + label?: string; + xprv?: string; + xpub: string; +} + +// Dynamic ETH HD path generation - will be computed as needed + +/** + * Secure Buffer implementation for sensitive data + * Provides explicit memory clearing capability + */ +class SecureBuffer { + private buffer: Buffer | null; + private _isCleared = false; + + constructor(data: string | Buffer) { + if (typeof data === 'string') { + this.buffer = Buffer.from(data, 'utf8'); + } else { + this.buffer = Buffer.from(data); + } + } + + get(): Buffer { + if (this._isCleared || !this.buffer) { + throw new Error('SecureBuffer has been cleared'); + } + return Buffer.from(this.buffer); // Return copy + } + + toString(): string { + if (this._isCleared || !this.buffer) { + throw new Error('SecureBuffer has been cleared'); + } + return this.buffer.toString('utf8'); + } + + clear(): void { + if (!this._isCleared && this.buffer) { + // Zeroing must not depend on a working platform random source. + this.buffer.fill(0); + this.buffer = null; + this._isCleared = true; + } + } + + isCleared(): boolean { + return this._isCleared; + } +} + +export class KeyringCore< + TLedger extends KeyringLedgerSigner | undefined = + | KeyringLedgerSigner + | undefined, + TTrezor extends KeyringTrezorSigner | undefined = + | KeyringTrezorSigner + | undefined +> { + public trezorSigner: TTrezor; + public ledgerSigner: TLedger; + // NOTE: activeChain removed - now derived from vault.activeNetwork.kind + public initialTrezorAccountState: IKeyringAccountState; + public initialLedgerAccountState: IKeyringAccountState; + public utf8Error: boolean; + //transactions objects + public ethereumTransaction: IEthereumTransactions; + public syscoinTransaction: ISyscoinTransactions; + private readonly authority: object; + private readonly storage: KeyringStoragePort; + private readonly vaultPersistence: VaultPersistence; + private readonly syscoinHardwareSigners: ISyscoinHardwareSigners; + + // Store getter function for accessing Redux state + private getVaultState: (() => any) | null = null; + + // Method to inject store getter from Pali side + public setVaultStateGetter = (getter: () => any) => { + this.getVaultState = getter; + }; + + // Helper method to get current vault state + private getVault = () => { + if (!this.getVaultState) { + throw new Error( + 'Vault state getter not configured. Call setVaultStateGetter() first.' + ); + } + + const vault = this.getVaultState(); + + // DEFENSIVE CHECK: Ensure vault state is properly structured + if (!vault) { + throw new Error( + 'Vault state is undefined. Ensure Redux store is properly initialized with vault state.' + ); + } + + if (!vault.activeNetwork) { + throw new Error( + 'Vault state is missing activeNetwork. Ensure vault state is properly initialized before keyring operations.' + ); + } + + if (!vault.activeAccount) { + throw new Error( + 'Vault state is missing activeAccount. Ensure vault state is properly initialized before keyring operations.' + ); + } + + return vault; + }; + + // Helper to get active chain from vault state (replaces this.activeChain) + private getActiveChain = (): INetworkType => { + return this.getVault().activeNetwork.kind; + }; + + private accountAddressExists = ( + accounts: Record>, + address: string, + caseInsensitive = false + ): boolean => { + const expectedAddress = caseInsensitive ? address.toLowerCase() : address; + + return Object.values(accounts || {}).some((accountsByType) => + Object.values(accountsByType || {}).some((account) => { + if (!account?.address) { + return false; + } + + const accountAddress = caseInsensitive + ? account.address.toLowerCase() + : account.address; + + return accountAddress === expectedAddress; + }) + ); + }; + + // Secure session data - using Buffers that can be explicitly cleared + private sessionPassword: SecureBuffer | null = null; + private sessionMnemonic: SecureBuffer | null = null; // can be a mnemonic or a zprv, can be changed to a zprv when using an imported wallet + private privateRecordSessionRevision = 0; + private bip84Operation: object | undefined; + + constructor(dependencies: KeyringCoreDependencies) { + if ( + !dependencies || + typeof dependencies.authority !== 'object' || + dependencies.authority === null + ) { + throw new TypeError('Keyring core requires an explicit wallet authority'); + } + if ( + typeof dependencies.vaultPersistence?.getDecryptedVault !== 'function' || + typeof dependencies.vaultPersistence?.setEncryptedVault !== 'function' + ) { + throw new TypeError('Keyring core requires bound vault persistence'); + } + this.authority = dependencies.authority; + this.storage = dependencies.storage; + this.vaultPersistence = dependencies.vaultPersistence; + this.ledgerSigner = dependencies.ledgerSigner; + this.trezorSigner = dependencies.trezorSigner; + this.syscoinHardwareSigners = { ...dependencies.syscoinHardwareSigners }; + this.writeUtf8Diagnostic(false); + this.utf8Error = false; + this.initialTrezorAccountState = initialActiveTrezorAccountState; + this.initialLedgerAccountState = initialActiveLedgerAccountState; + this.syscoinTransaction = this.createSyscoinTransactions(); + this.ethereumTransaction = new EthereumTransactions( + this.getNetwork, + this.getDecryptedPrivateKey, + this.getAccountsState, + this.ledgerSigner, + this.trezorSigner, + this.capturePsbtSigningContext + ); + } + + private createSyscoinTransactions = () => + new SyscoinTransactionsCore( + this.getSigner, + this.getReadOnlySigner, + this.getAccountsState, + this.getAddress, + this.syscoinHardwareSigners, + this.capturePsbtSigningContext + ); + + private requireLedgerSigner = (): KeyringLedgerSigner => { + if (!this.ledgerSigner) + throw createHardwareSignerUnavailableError('Ledger'); + return this.ledgerSigner; + }; + + private requireTrezorSigner = (): KeyringTrezorSigner => { + if (!this.trezorSigner) + throw createHardwareSignerUnavailableError('Trezor'); + return this.trezorSigner; + }; + + // Convenience method for complete setup after construction + public async initialize( + seed: string, + password: string, + network?: INetwork + ): Promise { + // Set the network if provided (this is crucial for proper address derivation) + if (network) { + await this.setSignerNetwork(network); + } + + // Use the new secure initialization method (eliminates temporary plaintext storage) + const account = await this.initializeWalletSecurely(seed, password); + + // NOTE: Active account management is now handled by vault state/Redux + // No need to explicitly set active account - it's managed externally + + return account; + } + + // ===================================== PUBLIC METHODS - KEYRING MANAGER FOR HD - SYS ALL ===================================== // + + public setStorage = (client: any) => { + if (!this.storage.setClient) { + throw new Error('Storage replacement is unavailable in this host'); + } + this.storage.setClient(client); + }; + + public validateAccountType = (account: IKeyringAccountState) => { + return account.isImported === true + ? KeyringAccountType.Imported + : KeyringAccountType.HDAccount; + }; + + public isUnlocked = () => + !!this.sessionPassword && !this.sessionPassword.isCleared(); + + public lockWallet = async () => { + this.privateRecordSessionRevision++; + // Clear secure session data + if (this.sessionPassword) { + this.sessionPassword.clear(); + this.sessionPassword = null; + } + if (this.sessionMnemonic) { + this.sessionMnemonic.clear(); + this.sessionMnemonic = null; + } + + // Clear transaction handlers that may hold HD signers + if (this.syscoinTransaction) { + // Replace with empty object to clear references + this.syscoinTransaction = {} as ISyscoinTransactions; + } + // NOTE: We intentionally don't clear ethereumTransaction here because + // polling needs the web3Provider even when the wallet is locked. + + // Clean up hardware wallet connections (await to ensure HID is released) + if (this.ledgerSigner) { + try { + await this.ledgerSigner.destroy(); + } catch (_) { + // ignore + } + } + if (this.trezorSigner) { + try { + await this.trezorSigner.destroy(); + } catch (_) { + // ignore + } + } + }; + + // Direct secure transfer of session data to another keyring + public transferSessionTo = ( + targetKeyring: Pick + ): void => { + if (!this.isUnlocked()) { + throw new Error('Source keyring must be unlocked to transfer session'); + } + + // Cross-wallet transfers must fail before either keyring's buffers change. + if ( + !(targetKeyring instanceof KeyringCore) || + targetKeyring.authority !== this.authority || + targetKeyring.storage !== this.storage || + targetKeyring.vaultPersistence !== this.vaultPersistence + ) { + throw new Error( + 'Cannot transfer session between different wallet authorities' + ); + } + if (targetKeyring === this) return; + + // Transfer ownership of our buffers to the target + if (!this.sessionPassword || !this.sessionMnemonic) { + throw new Error('Session data is missing during transfer'); + } + this.privateRecordSessionRevision++; + + targetKeyring.acceptSessionFrom(this); + + // Null out our references (do NOT clear buffers - target owns them now) + this.sessionPassword = null; + this.sessionMnemonic = null; + }; + + // The checked transfer path never dispatches through a public host receiver. + private acceptSessionFrom = (source: KeyringCore): void => { + if ( + source.authority !== this.authority || + source.storage !== this.storage || + source.vaultPersistence !== this.vaultPersistence + ) { + throw new Error( + 'Cannot transfer session between different wallet authorities' + ); + } + if (!source.sessionPassword || !source.sessionMnemonic) { + throw new Error('Session data is missing during transfer'); + } + this.replaceSessionBuffers(source.sessionPassword, source.sessionMnemonic); + }; + + // Legacy trusted-host API. SoftwareKeyring disables direct buffer injection. + public receiveSessionOwnership = ( + sessionPassword: SecureBuffer, + sessionMnemonic: SecureBuffer + ): void => this.replaceSessionBuffers(sessionPassword, sessionMnemonic); + + private replaceSessionBuffers = ( + sessionPassword: SecureBuffer, + sessionMnemonic: SecureBuffer + ): void => { + this.privateRecordSessionRevision++; + // Clear any existing data first + if (this.sessionPassword) { + this.sessionPassword.clear(); + } + if (this.sessionMnemonic) { + this.sessionMnemonic.clear(); + } + + // Take ownership of the actual SecureBuffer objects + // No copying - these are the original objects + this.sessionPassword = sessionPassword; + this.sessionMnemonic = sessionMnemonic; + }; + + public addNewAccount = async ( + label?: string + ): Promise => { + // Check if wallet is unlocked + if (!this.isUnlocked()) { + throw new Error('Wallet must be unlocked to add new accounts'); + } + + // addNewAccount should only create accounts from the main seed + // For importing accounts (including zprvs), use importAccount + if (this.getActiveChain() === INetworkType.Syscoin) { + return await this.addNewAccountToSyscoinChain(label); + } else { + // EVM chainType + return await this.addNewAccountToEth(label); + } + }; + + public createSmartAccount = async ({ + address, + deriveAccount, + label, + metadata, + }: ICreateSmartAccountParams): Promise => { + const vault = this.getVault(); + const { accounts } = vault; + + const smartAccounts = accounts[KeyringAccountType.SmartAccount] || {}; + const nextId = this.getNextAccountId(smartAccounts); + const derived = deriveAccount + ? await deriveAccount(nextId) + : { address, metadata }; + if (!derived.address) { + throw new Error('Smart account address is required'); + } + + if (this.accountAddressExists(accounts, derived.address, true)) { + throw new Error('Account already exists on your Wallet.'); + } + + return { + address: derived.address, + balances: { + [INetworkType.Syscoin]: 0, + [INetworkType.Ethereum]: 0, + }, + id: nextId, + isImported: false, + isLedgerWallet: false, + isSmartAccount: true, + isTrezorWallet: false, + label: label || `Smart Account ${nextId + 1}`, + smartAccount: derived.metadata, + xprv: '', + xpub: derived.address, + }; + }; + + /** + * Returns canLogin:false only when the first vault authentication fails. + * Storage, platform and session restoration failures reject so callers do + * not charge a failed password attempt for an operational error. + */ + public async unlock(password: string): Promise<{ + canLogin: boolean; + needsAccountCreation?: boolean; + }> { + let authenticated = false; + try { + const vaultKeys = await this.storage.get('vault-keys'); + + if (!vaultKeys) { + throw new Error( + 'Vault keys not found. Reload the wallet and try again.' + ); + } + // v4: Validate password by deriving the session key once and decrypting the vault with it. + // This avoids an extra KDF pass just for a stored verifier. + const { salt } = vaultKeys; + + // Derive session encryption key (in-memory only) used to encrypt/decrypt xprv fields + // IMPORTANT: This MUST NOT be the same value as the stored verifier above. + let sessionPasswordKey = await this.deriveStoredSessionKey( + password, + vaultKeys + ); + // Handle migration from old vault format with currentSessionSalt + if (vaultKeys.currentSessionSalt) { + console.log( + '[KeyringManager] Detected old vault format, handling session migration...' + ); + + // The old format used currentSessionSalt for session data encryption + // We need to use it temporarily to decrypt the mnemonic correctly + const oldSessionPassword = this.encryptSHA512( + password, + vaultKeys.currentSessionSalt + ); + + // v3 CBC vaults use the raw password; migrated GCM vaults use the + // derived key. Selecting by stored format also permits a safe retry + // if the vault write succeeded but the metadata write was interrupted. + const { mnemonic } = await this.vaultPersistence.getDecryptedVault( + sessionPasswordKey, + password + ); + authenticated = true; + + const isValidSecret = (value: unknown): value is string => { + if (typeof value !== 'string' || !value) return false; + if (this.isSeedValid(value)) return true; + // Imported extended private keys can also be stored as the secret. + if (!/^(xprv|yprv|zprv|tprv|uprv|vprv)/.test(value)) return false; + try { + const decoded = bs58check.decode(value); + return ( + decoded.length === 78 && + decoded[45] === 0 && + ecc.isPrivate(decoded.subarray(46)) + ); + } catch { + return false; + } + }; + + let decryptedMnemonic = mnemonic; + if (!isValidSecret(decryptedMnemonic) && typeof mnemonic === 'string') { + for (const legacyKey of [password, oldSessionPassword]) { + try { + const candidate = CryptoJS.AES.decrypt( + mnemonic, + legacyKey + ).toString(CryptoJS.enc.Utf8); + if (isValidSecret(candidate)) { + decryptedMnemonic = candidate; + break; + } + } catch (error) { + if (error?.message !== 'Malformed UTF-8 data') throw error; + } + } + } + if (!isValidSecret(decryptedMnemonic)) { + throw new Error( + 'Legacy vault secret could not be recovered. Existing vault preserved.' + ); + } + + // Do not change either stored record until a valid secret is recovered. + await this.vaultPersistence.setEncryptedVault( + { mnemonic: decryptedMnemonic }, + sessionPasswordKey + ); + console.log('[KeyringManager] Vault mnemonic format normalized'); + + // Remove currentSessionSalt from vault-keys (v4 keeps only the salt on disk) + const migratedVaultKeys = { + salt: vaultKeys.salt, + }; + await this.storage.set('vault-keys', migratedVaultKeys); + console.log('[KeyringManager] Old vault format migration completed'); + } + + // v4 vault is encrypted with the derived session password key (PBKDF2 output). + // If the password is wrong, this will throw and we return canLogin:false below. + let decryptedVault: any; + let legacyProfile = vaultKeys.keyDerivation === LEGACY_ENCRYPTION_KDF; + try { + decryptedVault = await this.vaultPersistence.getDecryptedVault( + sessionPasswordKey + ); + } catch (error) { + // Only the historical CBC fallback used the 20k key without metadata. + // Never try it for GCM, malformed records, or platform/storage failures. + const rawVault = + error instanceof VaultAuthenticationError && + !vaultKeys.keyDerivation && + !vaultKeys.currentSessionSalt + ? await this.storage.get('vault') + : undefined; + if (typeof rawVault !== 'string' || rawVault.trim().startsWith('{')) { + throw error; + } + const legacyKey = await this.deriveLegacySessionKey(password, salt); + decryptedVault = await this.vaultPersistence.getDecryptedVault( + legacyKey + ); + authenticated = true; + sessionPasswordKey = legacyKey; + // Keep the historical account wrapping key. Persist its profile before + // GCM rewrapping so either interrupted write remains recoverable. + await this.storage.set('vault-keys', { + ...vaultKeys, + keyDerivation: LEGACY_ENCRYPTION_KDF, + }); + legacyProfile = true; + } + authenticated = true; + if (legacyProfile && this.hasWebCrypto()) { + const storedVault = await this.storage.get('vault'); + if ( + typeof storedVault === 'string' && + !storedVault.trim().startsWith('{') + ) { + // A failed earlier rewrap can leave the authenticated profile plus + // CBC. Retry that write without changing the account wrapping key. + await this.vaultPersistence.setEncryptedVault( + decryptedVault, + sessionPasswordKey + ); + } + } + + // If session data missing or corrupted, recreate from vault + if (!this.sessionMnemonic) { + await this.recreateSessionFromVault(sessionPasswordKey); + } + + // Re-initialize syscoin transaction handler if it was cleared on lock. + // `lockWallet()` intentionally replaces it with a plain object to drop signer references, + // so we must restore the real class instance on unlock. + if ( + !this.syscoinTransaction || + typeof (this.syscoinTransaction as any).getRecommendedFee !== 'function' + ) { + this.syscoinTransaction = this.createSyscoinTransactions(); + } + + // NOTE: Active account management is now handled by vault state/Redux + // No need to explicitly set active account after unlock - it's managed externally + const vault = this.getVault(); + if (vault.activeAccount?.id !== undefined && vault.activeAccount?.type) { + // Check if the active account actually exists in the accounts map + const accountType = vault.activeAccount.type; + const accountId = vault.activeAccount.id; + const accountExists = vault.accounts?.[accountType]?.[accountId]; + + if (!accountExists) { + console.log( + `[KeyringManager] Active account ${accountType}:${accountId} not found in accounts map. This may indicate a migration from old vault format.` + ); + // Signal that accounts need to be created after migration + return { + canLogin: true, + needsAccountCreation: true, + }; + } + + console.log( + `[KeyringManager] Active account ${vault.activeAccount.id} available after unlock` + ); + } + + return { + canLogin: true, + }; + } catch (error) { + if (!authenticated && error instanceof VaultAuthenticationError) { + return { canLogin: false }; + } + if (authenticated) { + // lockWallet clears secret buffers synchronously; hardware cleanup + // is best effort and must not hide the original operational error. + void this.lockWallet().catch(() => undefined); + } + throw error; + } + } + + public getNewChangeAddress = async (): Promise => { + const vault = this.getVault(); + const { accounts, activeAccount } = vault; + const account = accounts[activeAccount.type]?.[activeAccount.id]; + if (!account) { + throw new Error('Active account not found'); + } + const { xpub, isImported, address } = account as any; + // For imported single-address accounts, always return the single address + const looksLikeSingleAddress = + isImported && + xpub === address && + !this.isDescriptor(xpub) && + !this.isXpubLike(xpub); + if (looksLikeSingleAddress) return address; + return await this.getAddress(xpub, true); // Don't skip increment - get next unused + }; + + public getChangeAddress = async (id: number): Promise => { + const vault = this.getVault(); + const { accounts, activeAccount } = vault; + const account = accounts[activeAccount.type]?.[id]; + if (!account) { + throw new Error(`Account with id ${id} not found`); + } + const { xpub, isImported, address } = account as any; + if ( + isImported && + xpub === address && + !this.isDescriptor(xpub) && + !this.isXpubLike(xpub) + ) + return address; + return await this.getAddress(xpub, true); + }; + + public getPubkey = async ( + id: number, + isChangeAddress: boolean + ): Promise => { + const vault = this.getVault(); + const { accounts, activeAccount } = vault; + const account = accounts[activeAccount.type]?.[id]; + if (!account) { + throw new Error(`Account with id ${id} not found`); + } + const { xpub, isImported, address } = account as any; + // Guard: single-address imported are watch-only + if (isImported && xpub === address) { + throw new Error( + 'Public key not available for single-address imported accounts' + ); + } + // Guard: descriptor/xpub watch-only (no xprv and not hardware) + if (this.isWatchOnlyAccount(account as any)) { + throw new Error('Public key not available for watch-only accounts'); + } + return await this.getCurrentAddressPubkey(xpub, isChangeAddress); + }; + + public getBip32Path = async ( + id: number, + isChangeAddress: boolean + ): Promise => { + const vault = this.getVault(); + const { accounts, activeAccount } = vault; + const account = accounts[activeAccount.type]?.[id]; + if (!account) { + throw new Error(`Account with id ${id} not found`); + } + const { xpub, isImported, address } = account as any; + // Guard: single-address imported are watch-only + if (isImported && xpub === address) { + throw new Error( + 'BIP32 path not available for single-address imported accounts' + ); + } + // Guard: descriptor/xpub watch-only (no xprv and not hardware) + if (this.isWatchOnlyAccount(account as any)) { + throw new Error('BIP32 path not available for watch-only accounts'); + } + return await this.getCurrentAddressBip32Path(xpub, isChangeAddress); + }; + + public updateReceivingAddress = async (): Promise => { + const vault = this.getVault(); + const { accounts, activeAccount } = vault; + const account = accounts[activeAccount.type]?.[activeAccount.id]; + if (!account) { + throw new Error('Active account not found'); + } + const { xpub, isImported, address } = account as any; + if ( + isImported && + xpub === address && + !this.isDescriptor(xpub) && + !this.isXpubLike(xpub) + ) + return address; + const nextAddress = await this.getAddress(xpub, false); + // NOTE: Address updates should be dispatched to Redux store, not updated here + // The calling code should handle the Redux dispatch + return nextAddress; + }; + + public getAccountById = ( + id: number, + accountType: KeyringAccountType + ): Omit => { + const vault = this.getVault(); + const accounts = vault.accounts[accountType]; + + const account = accounts[id]; + + if (!account) { + throw new Error('Account not found'); + } + + return omit(account as IKeyringAccountState, 'xprv'); + }; + + public getPrivateKeyByAccountId = async ( + id: number, + accountType: KeyringAccountType, + pwd: string + ): Promise => { + try { + // Validate password using vault salt (same pattern as getSeed) + if (!this.sessionPassword) { + throw new Error('Unlock wallet first'); + } + + // Get vault salt for password validation + const vaultKeys = await this.storage.get('vault-keys'); + if (!vaultKeys || !vaultKeys.salt) { + throw new Error('Vault keys not found'); + } + + const genPwd = await this.deriveStoredSessionKey(pwd, vaultKeys); + if (this.getSessionPasswordString() !== genPwd) { + throw new Error('Invalid password'); + } + + const vault = this.getVault(); + const account = vault.accounts[accountType][id]; + if (!account) { + throw new Error('Account not found'); + } + + // Decrypt the stored private key using secure method + const decryptedPrivateKey = this.withSecureData((sessionPwd) => { + const decrypted = CryptoJS.AES.decrypt( + (account as IKeyringAccountState).xprv, + sessionPwd + ).toString(CryptoJS.enc.Utf8); + + if (!decrypted) { + throw new Error( + 'Failed to decrypt private key. Invalid password or corrupted data.' + ); + } + + return decrypted; + }); + + // NOTE: Returning decrypted private key as string is necessary for compatibility + // Callers should handle this sensitive data carefully + return decryptedPrivateKey; + } catch (error) { + this.validateAndHandleErrorByMessage(error.message); + throw error; + } + }; + + public getActiveAccount = (): { + activeAccount: Omit; + activeAccountType: KeyringAccountType; + } => { + const vault = this.getVault(); + const { accounts, activeAccount } = vault; + const activeAccountId = activeAccount.id; + const activeAccountType = activeAccount.type; + + return { + activeAccount: omit( + accounts[activeAccountType][activeAccountId] as IKeyringAccountState, + 'xprv' + ), + activeAccountType, + }; + }; + + private isDescriptor = (s: string): boolean => + /^(addr|pkh|wpkh|sh|wsh|tr|combo|multi|sortedmulti)\s*\(/i.test(s || ''); + + private isXpubLike = (s: string): boolean => + /^(xpub|tpub|zpub|vpub)/i.test(s || ''); + + private isWatchOnlyAccount(a: IKeyringAccountState): boolean { + if (a.isLedgerWallet || a.isTrezorWallet) return false; + if (!a.xprv || a.xprv === '') { + if (a.xpub === a.address) return true; // single-address imported + if (this.isXpubLike(a.xpub) || this.isDescriptor(a.xpub)) return true; // xpub/descriptor watch-only + } + return false; + } + + public getEncryptedXprv = (hd: SyscoinHDSigner) => { + return this.withSecureData((sessionPwd) => { + return CryptoJS.AES.encrypt( + this.getSysActivePrivateKey(hd), + sessionPwd + ).toString(); + }); + }; + + public getSeed = async (pwd: string) => { + if (!this.sessionPassword) { + throw new Error('Unlock wallet first'); + } + + // Get vault salt for password validation (consistent with getPrivateKeyByAccountId) + const vaultKeys = await this.storage.get('vault-keys'); + if (!vaultKeys || !vaultKeys.salt) { + throw new Error('Vault keys not found'); + } + + const genPwd = await this.deriveStoredSessionKey(pwd, vaultKeys); + if (this.getSessionPasswordString() !== genPwd) { + throw new Error('Invalid password'); + } + // v4 vault is encrypted with the derived session password key (PBKDF2 output) + let { mnemonic } = await this.vaultPersistence.getDecryptedVault(genPwd); + + if (!mnemonic) { + throw new Error('Mnemonic not found in vault or is empty'); + } + + // Try to detect if mnemonic is encrypted or plain text + const isLikelyPlainMnemonic = + mnemonic.includes(' ') && + (mnemonic.split(' ').length === 12 || mnemonic.split(' ').length === 24); + + if (!isLikelyPlainMnemonic) { + try { + mnemonic = CryptoJS.AES.decrypt(mnemonic, pwd).toString( + CryptoJS.enc.Utf8 + ); + } catch (decryptError) { + // If decryption fails, assume mnemonic is already decrypted + console.warn( + 'Mnemonic decryption failed in getSeed, using as-is:', + decryptError.message + ); + } + } + + if (!mnemonic) { + throw new Error( + 'Failed to decrypt mnemonic or mnemonic is empty after decryption' + ); + } + + return mnemonic; + }; + + public deriveSLHDSASetupSecretForAccount = async ({ + accountIndex, + }: { + accountIndex: number; + }): Promise<{ + derivationLabel: string; + setupSecretHex: string; + }> => { + if (!this.sessionPassword) { + throw new Error('Unlock wallet first'); + } + + const mnemonic = this.getDecryptedMnemonic(); + const normalizedMnemonic = mnemonic.normalize('NFKD'); + const seed = CryptoJS.PBKDF2( + normalizedMnemonic, + `mnemonic`.normalize('NFKD'), + { + hasher: CryptoJS.algo.SHA512, + iterations: 2048, + keySize: 512 / 32, + } + ); + const derivationLabel = `PALI/${SLH_DSA_PARAMETER_SET}/v${SLH_DSA_DERIVATION_VERSION}/account/${accountIndex}`; + const digest = CryptoJS.HmacSHA512( + derivationLabel, + CryptoJS.enc.Hex.parse(seed.toString(CryptoJS.enc.Hex)) + ); + + return { + derivationLabel, + setupSecretHex: digest + .toString(CryptoJS.enc.Hex) + .slice(0, SLH_DSA_SETUP_SECRET_HEX_LENGTH), + }; + }; + + public encryptSLHDSASessionState = (plainText: string): string => { + return this.withSecureData((sessionPwd) => + CryptoJS.AES.encrypt(plainText, sessionPwd).toString() + ); + }; + + public decryptSLHDSASessionState = (cipherText: string): string => { + return this.withSecureData((sessionPwd) => { + const plainText = CryptoJS.AES.decrypt(cipherText, sessionPwd).toString( + CryptoJS.enc.Utf8 + ); + if (!plainText) { + throw new Error('Failed to decrypt SLH-DSA session state'); + } + return plainText; + }); + }; + + private privateRecordSession() { + const password = this.sessionPassword; + const mnemonic = this.sessionMnemonic; + const revision = this.privateRecordSessionRevision; + const assertCurrent = () => { + if ( + !password || + !mnemonic || + password.isCleared() || + mnemonic.isCleared() || + this.sessionPassword !== password || + this.sessionMnemonic !== mnemonic || + this.privateRecordSessionRevision !== revision + ) { + throw new Error('Private record session changed'); + } + }; + assertCurrent(); + const root = this.getDecryptedMnemonic().normalize('NFKD'); + if (!root || root.length > 4096) + throw new Error('Invalid private record root'); + return { secret: new TextEncoder().encode(root), assertCurrent }; + } + + /** Stable local profile identifier; never an account address or a key. */ + public async getPrivateRecordProfileId(): Promise { + const session = this.privateRecordSession(); + try { + const profile = await privateRecordProfileId( + session.secret, + session.assertCurrent + ); + session.assertCurrent(); + return profile; + } finally { + session.secret.fill(0); + } + } + + /** Encrypt caller-owned bytes; persistence and encrypted backup belong to the caller. */ + public async encryptPrivateRecord( + params: IEncryptPrivateRecordParams + ): Promise { + const session = this.privateRecordSession(); + try { + const envelope = await encryptPrivateRecordBytes( + session.secret, + params, + session.assertCurrent + ); + session.assertCurrent(); + return envelope; + } finally { + session.secret.fill(0); + } + } + + public async decryptPrivateRecord( + params: IDecryptPrivateRecordParams + ): Promise { + const session = this.privateRecordSession(); + let plaintext: Uint8Array | undefined; + try { + plaintext = await decryptPrivateRecordBytes( + session.secret, + params, + session.assertCurrent + ); + session.assertCurrent(); + return plaintext; + } catch (error) { + plaintext?.fill(0); + throw error; + } finally { + session.secret.fill(0); + } + } + + public setSignerNetwork = async ( + network: INetwork + ): Promise<{ + activeChain?: INetworkType; + success: boolean; + }> => { + // With multi-keyring architecture, each keyring is dedicated to specific slip44 + if ( + INetworkType.Ethereum !== network.kind && + INetworkType.Syscoin !== network.kind + ) { + throw new Error('Unsupported chain'); + } + + // Validate network/chain type compatibility + if ( + network.kind === INetworkType.Ethereum && + this.getActiveChain() === INetworkType.Syscoin + ) { + throw new Error('Cannot use Ethereum chain type with Syscoin network'); + } + if ( + network.kind === INetworkType.Syscoin && + this.getActiveChain() === INetworkType.Ethereum + ) { + throw new Error('Cannot use Syscoin chain type with Ethereum network'); + } + + // CRITICAL: Prevent UTXO-to-UTXO network switching within same keyring + // Each UTXO network should have its own KeyringManager instance based on slip44 + const vault = this.getVault(); + if (this.getActiveChain() === INetworkType.Syscoin && vault.activeNetwork) { + const currentSlip44 = vault.activeNetwork.slip44; + const newSlip44 = network.slip44; + + if (currentSlip44 !== newSlip44) { + throw new Error( + `Cannot switch between different UTXO networks within the same keyring. ` + + `Current network uses slip44=${currentSlip44}, target network uses slip44=${newSlip44}. ` + + `Each UTXO network requires a separate KeyringManager instance.` + ); + } + } + + try { + // With multi-keyring architecture: + // - UTXO: Each keyring is dedicated to one network (slip44), so this is only called during initialization + // - EVM: All EVM networks share slip44=60, so network can change within the same keyring + + if (network.kind === INetworkType.Syscoin) { + // For UTXO networks: validate that active account exists (accounts should be created via addNewAccount/initialize) + const accountId = vault.activeAccount.id || 0; + const accountType = + vault.activeAccount.type || KeyringAccountType.HDAccount; + const accounts = vault.accounts[accountType]; + + if (!accounts[accountId] || !accounts[accountId].xpub) { + throw new Error( + `Active account ${accountType}:${accountId} does not exist. Create accounts using addNewAccount() or initializeWalletSecurely() first.` + ); + } + + // No additional setup needed - on-demand signers will be created when needed + } else if (network.kind === INetworkType.Ethereum) { + // For EVM networks: we primarily need a correct provider for the active network. + // Active account validation can be temporarily inconsistent during network switching + // (e.g., placeholder activeAccount like Trezor:0 before accounts hydrate), and provider + // setup does not depend on it. So treat missing active account as a warning, not a hard error. + const accountId = vault.activeAccount.id || 0; + const accountType = + vault.activeAccount.type || KeyringAccountType.HDAccount; + const accounts = vault.accounts[accountType]; + + if (!accounts?.[accountId]) { + console.warn( + `[KeyringManager] Active account ${accountType}:${accountId} not found while setting EVM network; continuing to set provider` + ); + } + + // Set up EVM provider for network switching + await this.setSignerEVM(network); + } + + return { + success: true, + }; + } catch (err) { + console.log('ERROR setSignerNetwork', { + err, + }); + + this.validateAndHandleErrorByMessage(err.message); + + //Rollback to previous values + console.error('Set Signer Network failed with', err); + return { success: false }; + } + }; + + public forgetMainWallet = async (pwd: string) => { + const vaultKeys = await this.storage.get('vault-keys'); + if (!vaultKeys || !vaultKeys.salt) { + throw new Error('Vault keys not found'); + } + const genPwd = await this.deriveStoredSessionKey(pwd, vaultKeys); + if (!this.sessionPassword) { + throw new Error('Unlock wallet first'); + } else if (this.getSessionPasswordString() !== genPwd) { + throw new Error('Invalid password'); + } + + await this.clearTemporaryLocalKeys(); + }; + + public importWeb3Account = (mnemonicOrPrivKey: string) => { + // Check if it's a hex string (Ethereum private key) + if (isHexString(mnemonicOrPrivKey)) { + return privateKeyToAccount(mnemonicOrPrivKey); + } + + // Check if it's a zprv/tprv (Syscoin private key) + const zprvPrefixes = ['zprv', 'tprv', 'vprv', 'xprv']; + if (zprvPrefixes.some((prefix) => mnemonicOrPrivKey.startsWith(prefix))) { + throw new Error( + 'Syscoin extended private keys (zprv/tprv) should be imported using importAccount, not importWeb3Account' + ); + } + + // Otherwise, assume it's a mnemonic + return deriveEvmAccountFromMnemonic( + mnemonicOrPrivKey, + getAddressDerivationPath('eth', 60, 0, false, 0) + ); + }; + + public getAccountXpub = (): string => { + const vault = this.getVault(); + const { activeAccount } = vault; + const account = vault.accounts[activeAccount.type]?.[activeAccount.id]; + if (!account) { + throw new Error('Active account not found'); + } + return account.xpub; + }; + + public isSeedValid = (seedPhrase: string) => + BIP84.validateMnemonic(seedPhrase); + + public createNewSeed = (wordCount?: number) => { + // Map BIP39 word counts to entropy strength + const wordCountToStrength: Record = { + 12: 128, + 15: 160, + 18: 192, + 21: 224, + 24: 256, + }; + const strength = wordCount ? wordCountToStrength[wordCount] : 128; + return strength + ? BIP84.generateMnemonic(strength) + : BIP84.generateMnemonic(); + }; + + public getUTXOState = () => { + const vault = this.getVault(); + if (vault.activeNetwork.kind !== INetworkType.Syscoin) { + throw new Error('Cannot get state in a ethereum network'); + } + + const utxOAccounts = mapValues(vault.accounts.HDAccount, (value) => + omit(value, 'xprv') + ); + + return { + ...vault, + accounts: { + [KeyringAccountType.HDAccount]: utxOAccounts, + [KeyringAccountType.Imported]: {}, + [KeyringAccountType.Trezor]: {}, + [KeyringAccountType.Ledger]: {}, + }, + }; + }; + + public async importTrezorAccount(label?: string) { + const vault = this.getVault(); + const currency = vault.activeNetwork.currency; + if (!currency) { + throw new Error('Active network currency is not defined'); + } + + // Use getNextAccountId to filter out placeholder accounts + const nextIndex = this.getNextAccountId( + vault.accounts[KeyringAccountType.Trezor] + ); + + const importedAccount = await this._createTrezorAccount( + currency, + vault.activeNetwork.slip44, + nextIndex + ); + importedAccount.label = label ? label : `Trezor ${importedAccount.id + 1}`; + + // NOTE: Account creation should be dispatched to Redux store, not updated here + // The calling code should handle the Redux dispatch + // Return the created account for Pali to add to store + return importedAccount; + } + + public async importLedgerAccount(label?: string) { + try { + const vault = this.getVault(); + const currency = vault.activeNetwork.currency; + if (!currency) { + throw new Error('Active network currency is not defined'); + } + + // Use getNextAccountId to filter out placeholder accounts + const nextIndex = this.getNextAccountId( + vault.accounts[KeyringAccountType.Ledger] + ); + + const importedAccount = await this._createLedgerAccount( + currency, + vault.activeNetwork.slip44, + nextIndex + ); + importedAccount.label = label + ? label + : `Ledger ${importedAccount.id + 1}`; + + // NOTE: Account creation should be dispatched to Redux store, not updated here + // The calling code should handle the Redux dispatch + // Return the created account for Pali to add to store + return importedAccount; + } catch (error) { + console.log({ error }); + throw error; + } + } + + public getActiveUTXOAccountState = () => { + const vault = this.getVault(); + const { activeAccount } = vault; + return { + ...vault.accounts.HDAccount[activeAccount.id], + xprv: undefined, + }; + }; + + public getNetwork = () => this.getVault().activeNetwork; + + public createEthAccount = (privateKey: string) => + privateKeyToAccount(privateKey); + + // Helper to get current account data from backend + private fetchCurrentAccountData = async ( + xpub: string, + isChangeAddress: boolean + ) => { + const vault = this.getVault(); + const { activeNetwork } = vault; + + // Use read-only signer for backend calls - works for all account types including hardware wallets + const { main } = this.getReadOnlySigner(); + const options = 'tokens=used&details=tokens'; + + // In-flight deduplicated: concurrent callers within a send flow + // (fee estimation, PSBT creation, signing) share a single request + const { tokens } = await fetchBlockbookAccountCached( + main.blockbookURL, + xpub, + options + ); + + const { receivingIndex, changeIndex } = + this.setLatestIndexesFromXPubTokens(tokens); + + // Get network configuration for BIP84 using network-provided pub type macros + const networkConfig = getNetworkConfig( + activeNetwork.slip44, + activeNetwork.currency + ); + + const pubTypes = networkConfig?.types?.zPubType; + if (!pubTypes) { + throw new Error('Missing zPubType in network configuration'); + } + const networks = networkConfig.networks; + + const currentAccount = new BIP84.fromZPub(xpub, pubTypes, networks); + + const addressIndex = isChangeAddress ? changeIndex : receivingIndex; + + return { + currentAccount, + addressIndex, + main, + }; + }; + + public getAddress = async ( + xpub: string, + isChangeAddress: boolean, + options?: { forceIndex0?: boolean } + ) => { + if (this.isDescriptor(xpub)) { + // The BIP84 history scanner below cannot choose a descriptor's next + // unused index. Import can derive index zero locally, but rotation must + // not reinterpret a descriptor as a BIP84 extended key. + if (!options?.forceIndex0) { + throw new Error( + 'Address rotation is not supported for watch-only descriptors' + ); + } + return deriveDescriptorAddress(xpub, this.getVault().activeNetwork, { + change: isChangeAddress, + }); + } + const { currentAccount, addressIndex } = await this.fetchCurrentAccountData( + xpub, + isChangeAddress + ); + + const effectiveIndex = options?.forceIndex0 ? 0 : addressIndex; + + const address = currentAccount.getAddress( + effectiveIndex, + isChangeAddress, + 84 + ) as string; + + return address; + }; + + public getCurrentAddressPubkey = async ( + xpub: string, + isChangeAddress: boolean + ): Promise => { + const { currentAccount, addressIndex } = await this.fetchCurrentAccountData( + xpub, + isChangeAddress + ); + + // BIP84 returns the public key as a hex string directly + return currentAccount.getPublicKey(addressIndex, isChangeAddress); + }; + + public getCurrentAddressBip32Path = async ( + xpub: string, + isChangeAddress: boolean + ): Promise => { + const vault = this.getVault(); + const { activeAccount, activeNetwork } = vault; + + const { addressIndex } = await this.fetchCurrentAccountData( + xpub, + isChangeAddress + ); + + // Use the utility function to generate the proper derivation path + const coinShortcut = activeNetwork.currency.toLowerCase(); // e.g., 'sys', 'btc' + const path = getAddressDerivationPath( + coinShortcut, + activeNetwork.slip44, + activeAccount.id, + isChangeAddress, + addressIndex + ); + + return path; + }; + + public logout = () => { + this.lockWallet(); + }; + + public async importAccount( + privKey: string, + label?: string, + options?: { utxoAddressType?: 'p2wpkh' | 'p2pkh' | 'p2tr' } + ) { + // Check if wallet is unlocked + if (!this.isUnlocked()) { + throw new Error('Wallet must be unlocked to import accounts'); + } + + const importedAccount = await this._getPrivateKeyAccountInfos( + privKey, + label, + options + ); + + // NOTE: Account creation should be dispatched to Redux store, not updated here + // The calling code should handle the Redux dispatch + // Return the created account for Pali to add to store + return importedAccount; + } + + // Import a WIF on UTXO networks and force legacy P2PKH address/type. + // Keeps it as a single-address Imported account, storing the address in both xpub and address. + + public async importWatchOnly(identifier: string, label?: string) { + // Validate via Blockbook and create a watch-only Imported account + const vault = this.getVault(); + const { accounts, activeNetwork } = vault; + + if (!identifier || typeof identifier !== 'string') { + throw new Error('Identifier is required'); + } + + const isXpub = this.isXpubLike(identifier); + const isDesc = this.isDescriptor(identifier); + const isAddress = !isXpub && !isDesc; + + // Compute address field + let addressToStore = identifier; + if (isDesc) { + // Keep the descriptor as the history reference, never as a recipient. + // Backend-provided address metadata must not select the deposit address. + addressToStore = deriveDescriptorAddress(identifier, activeNetwork); + } else if (isXpub) { + // Minimal approach: treat any extended pubkey as BIP84 by converting to zpub/vpub + const { types } = getNetworkConfig( + activeNetwork.slip44, + activeNetwork.currency || 'Syscoin' + ); + const target = + activeNetwork.slip44 === 1 + ? (types.zPubType as any).testnet.vpub + : types.zPubType.mainnet.zpub; + const bip84Key = convertExtendedKeyVersion(identifier, target); + addressToStore = await this.getAddress(bip84Key, false, { + forceIndex0: true, + }); + } + + // Validate duplicates across all account buckets, including passkey smart accounts. + if ( + this.accountAddressExists(accounts, addressToStore) || + ((isXpub || isDesc) && + Object.values(accounts || {}).some((bucket) => + Object.values(bucket || {}).some( + (account) => account?.xpub === identifier + ) + )) + ) { + throw new Error('Account already exists on your Wallet.'); + } + // Confirm with Blockbook + const options = 'details=basic'; + // Validate against Blockbook directly to capture precise error details (e.g., checksum mismatch) + const baseUrl = activeNetwork.url.replace(/\/$/, ''); + const path = isXpub || isDesc ? '/api/v2/xpub/' : '/api/v2/address/'; + const url = `${baseUrl}${path}${encodeURIComponent(identifier)}?${options}`; + let res: any = null; + try { + const response = await fetch(url); + if (!response.ok) { + let errorText = response.statusText || 'Request failed'; + try { + const bodyText = await response.text(); + if (bodyText) { + try { + const json = JSON.parse(bodyText); + if (json && json.error) { + errorText = json.error; + } else { + errorText = bodyText; + } + } catch { + errorText = bodyText; + } + } + } catch (parseError) { + // ignore body parse error; fall back to statusText + } + throw new Error(errorText); + } + res = await response.json(); + } catch (e: any) { + throw new Error(e?.message || 'Identifier validation failed'); + } + if (!res) { + throw new Error('Identifier not found on the active network'); + } + + const id = this.getNextAccountId(accounts[KeyringAccountType.Imported]); + const defaultLabel = label || `Watch-only ${id + 1}`; + + const balances = { syscoin: 0, ethereum: 0 }; + + const watchOnlyAccount = { + ...initialActiveImportedAccountState, + address: addressToStore, + label: defaultLabel, + id, + balances, + isImported: true, + xprv: '', + xpub: isAddress ? addressToStore : identifier, + assets: { + syscoin: [], + ethereum: [], + }, + } as IKeyringAccountState; + + return watchOnlyAccount; + } + + public validateZprv(zprv: string, targetNetwork?: INetwork) { + // Use the active network if targetNetwork is not provided + const networkToValidateAgainst = + targetNetwork || this.getVault().activeNetwork; + + if (!networkToValidateAgainst) { + throw new Error('No network available for validation'); + } + + try { + // Check if it looks like an extended key based on known prefixes + const knownExtendedKeyPrefixes = [ + 'xprv', + 'xpub', + 'yprv', + 'ypub', + 'zprv', + 'zpub', + 'tprv', + 'tpub', + 'uprv', + 'upub', + 'vprv', + 'vpub', + ]; + const prefix = zprv.substring(0, 4); + const looksLikeExtendedKey = knownExtendedKeyPrefixes.includes(prefix); + + // Only check prefix validity if it looks like an extended key + if (looksLikeExtendedKey) { + const validBip84Prefixes = ['zprv', 'vprv']; // zprv for mainnet, vprv for testnet + if (!validBip84Prefixes.includes(prefix)) { + throw new Error( + `Invalid key prefix '${prefix}'. Only BIP84 keys (zprv/vprv) are supported for UTXO imports. BIP44 keys (xprv/tprv) are not supported.` + ); + } + } else { + // Not an extended key format + throw new Error('Not an extended private key'); + } + + const bip32 = BIP32Factory(ecc); + const decoded = bs58check.decode(zprv); + + if (decoded.length !== 78) { + throw new Error('Invalid length for a BIP-32 key'); + } + + // Get network configuration for the target network + const { networks, types } = getNetworkConfig( + networkToValidateAgainst.slip44, + networkToValidateAgainst.currency || 'Bitcoin' + ); + + // For BIP84 (zprv/zpub), we need to use the correct magic bytes from zPubType + // Determine key type: zprv = mainnet key, vprv = testnet key + const keyIsTestnet = prefix === 'vprv'; + + // Determine target network type: testnet networks typically have slip44 1 + const targetIsTestnet = networkToValidateAgainst.slip44 === 1; + + // Cross-network validation: reject if key type doesn't match target network + if (keyIsTestnet && !targetIsTestnet) { + throw new Error( + `Extended private key is not compatible with ${networkToValidateAgainst.label}. ` + + `This appears to be a testnet key (${prefix}) but the target network is mainnet.` + ); + } + + if (!keyIsTestnet && targetIsTestnet) { + throw new Error( + `Extended private key is not compatible with ${networkToValidateAgainst.label}. ` + + `This appears to be a mainnet key (${prefix}) but the target network is testnet.` + ); + } + + const pubTypes = keyIsTestnet + ? (types.zPubType as any).testnet + : types.zPubType.mainnet; + const baseNetwork = keyIsTestnet ? networks.testnet : networks.mainnet; + + const network = { + ...baseNetwork, + bip32: { + public: parseInt(pubTypes.vpub || pubTypes.zpub, 16), + private: parseInt(pubTypes.vprv || pubTypes.zprv, 16), + }, + }; + + // Validate that the key prefix matches the expected network format + // This ensures the key was generated for a compatible network + const expectedPrefixes = ['zprv', 'vprv', 'xprv', 'yprv']; // Accept various BIP32/84 formats + if (!expectedPrefixes.includes(prefix)) { + throw new Error( + `Invalid extended private key prefix: ${prefix}. Expected one of: ${expectedPrefixes.join( + ', ' + )}` + ); + } + + // Strict network matching - only allow keys that match the target network + let node; + try { + node = bip32.fromBase58(zprv, network); + } catch (e) { + throw new Error( + `Extended private key is not compatible with ${networkToValidateAgainst.label}. Please use a key generated for this specific network.` + ); + } + + if (!node.privateKey) { + throw new Error('Private key not found in extended private key'); + } + if (!ecc.isPrivate(node.privateKey)) { + throw new Error('Invalid private key for secp256k1 curve'); + } + + return { + isValid: true, + node, + network, + message: 'The extended private key is valid for this network.', + }; + } catch (error) { + return { isValid: false, message: error.message }; + } + } + + public validateWif(wif: string, targetNetwork?: INetwork) { + // Use the active network if targetNetwork is not provided + const networkToValidateAgainst = + targetNetwork || this.getVault().activeNetwork; + + if (!networkToValidateAgainst) { + throw new Error('No network available for validation'); + } + + try { + // Get bitcoinjs network for the target network (Syscoin/BTC etc.) + const { networks } = getNetworkConfig( + networkToValidateAgainst.slip44, + networkToValidateAgainst.currency || 'Bitcoin' + ); + + const isTestnet = networkToValidateAgainst.slip44 === 1; + const bitcoinNetwork = isTestnet ? networks.testnet : networks.mainnet; + + // Try to parse the WIF for the given network + const keyPair = (syscoinjs.utils as any).bitcoinjs.ECPair.fromWIF( + wif, + bitcoinNetwork + ); + if (!keyPair || !keyPair.privateKey) + throw new Error('Invalid WIF private key'); + + // Derive an address based on network capability + // Try different address types to ensure the key can derive addresses + let address: string | undefined; + try { + // Try P2TR (Taproot) first if bech32 is supported + if ((bitcoinNetwork as any).bech32) { + try { + address = bjs.payments.p2wpkh({ + pubkey: keyPair.publicKey, + network: bitcoinNetwork, + }).address as string | undefined; + } catch (e) { + // P2TR might not be supported, try P2WPKH + } + } + if (!address) { + address = bjs.payments.p2pkh({ + pubkey: keyPair.publicKey, + network: bitcoinNetwork, + }).address as string | undefined; + } + } catch (e) { + // ignore and handle below + } + if (!address) throw new Error('Failed to derive address from WIF'); + + return { isValid: true }; + } catch (error) { + return { isValid: false, message: error.message }; + } + } + + /** + * PRIVATE METHODS + */ + + // ===================================== AUXILIARY METHOD - FOR TRANSACTIONS CLASSES ===================================== // + private getDecryptedPrivateKey = ( + targetAccount?: IEvmReplacementOptions['targetAccount'] + ): { + address: string; + decryptedPrivateKey: string; + } => { + try { + const vault = this.getVault(); + const { accounts } = vault; + const activeAccount = targetAccount || vault.activeAccount; + const activeAccountId = activeAccount.id; + const activeAccountType = activeAccount.type; + const isLedger = activeAccountType === KeyringAccountType.Ledger; + const isTrezor = activeAccountType === KeyringAccountType.Trezor; + + const isHardwareWallet = isTrezor || isLedger; + + if (!this.sessionPassword) + throw new Error('Wallet is locked cant proceed with transaction'); + + const activeAccountData = accounts[activeAccountType][activeAccountId]; + if (!activeAccountData) { + throw new Error( + `Active account (${activeAccountType}:${activeAccountId}) not found. Account switching may be in progress.` + ); + } + + const { xprv, address } = activeAccountData; + if (isLedger || activeAccountData.isLedgerWallet) + this.requireLedgerSigner(); + if (isTrezor || activeAccountData.isTrezorWallet) + this.requireTrezorSigner(); + + if (isHardwareWallet) { + return { + address, + decryptedPrivateKey: '', + }; + } + + if (!xprv) { + throw new Error( + `Private key not found for account ${activeAccountType}:${activeAccountId}. Account may not be fully initialized.` + ); + } + + let decryptedPrivateKey: string; + try { + decryptedPrivateKey = this.withSecureData((sessionPwd) => { + return CryptoJS.AES.decrypt(xprv, sessionPwd).toString( + CryptoJS.enc.Utf8 + ); + }); + } catch (decryptError) { + throw new Error( + `Failed to decrypt private key for account ${activeAccountType}:${activeAccountId}. The wallet may be locked or corrupted.` + ); + } + + if (!decryptedPrivateKey) { + throw new Error( + `Decrypted private key is empty for account ${activeAccountType}:${activeAccountId}. Invalid password or corrupted data.` + ); + } + + // For EVM accounts, validate that the derived address matches the stored address + // This helps catch account switching race conditions early + if (this.getActiveChain() === INetworkType.Ethereum) { + try { + const derivedAccount = privateKeyToAccount(decryptedPrivateKey); + if (derivedAccount.address.toLowerCase() !== address.toLowerCase()) { + throw new Error( + `Address mismatch for account ${activeAccountType}:${activeAccountId}. Expected ${address} but derived ${derivedAccount.address}. Account switching may be in progress.` + ); + } + } catch (addressError) { + throw new Error( + `Failed to validate EVM address for account ${activeAccountType}:${activeAccountId}: ${addressError.message}` + ); + } + } + + return { + address, + decryptedPrivateKey, + }; + } catch (error) { + const vaultForLogging = this.getVault(); + const isTestEnv = + typeof process !== 'undefined' && process?.env?.NODE_ENV === 'test'; + if (!isTestEnv) { + console.error('ERROR getDecryptedPrivateKey', { + error: error.message, + activeChain: this.getActiveChain(), + vault: { + activeAccountId: vaultForLogging?.activeAccount?.id, + activeAccountType: vaultForLogging?.activeAccount?.type, + }, + }); + } + this.validateAndHandleErrorByMessage(error.message); + throw error; + } + }; + + private capturePsbtSigningContext = (): (() => void) => { + const session = this.sessionPassword; + const vault = this.getVault(); + const selected = { ...vault.activeAccount }; + const account = vault.accounts[selected.type]?.[selected.id]; + const identity = { address: account?.address, xpub: account?.xpub }; + const network = { ...vault.activeNetwork }; + const assertCurrent = () => { + const current = this.getVault(); + const currentAccount = current.accounts[selected.type]?.[selected.id]; + if ( + !session || + session.isCleared() || + this.sessionPassword !== session || + current.activeAccount.id !== selected.id || + current.activeAccount.type !== selected.type || + currentAccount?.address !== identity.address || + currentAccount?.xpub !== identity.xpub || + current.activeNetwork.kind !== network.kind || + current.activeNetwork.chainId !== network.chainId || + current.activeNetwork.slip44 !== network.slip44 || + current.activeNetwork.url !== network.url + ) { + throw new Error('Wallet signing context changed'); + } + }; + assertCurrent(); + return assertCurrent; + }; + + /** Fixed-profile public UTXO derivation; private material remains operation-local. */ + protected async deriveSoftwareBip84HdPublicAccount( + input: Bip84HdPublicRequest, + options: Bip84Guard + ): Promise { + if (this.bip84Operation) throw new Bip84NativeError('BUSY'); + const operation = {}; + this.bip84Operation = operation; + const nodes: import('bip32').BIP32Interface[] = []; + try { + const session = this.sessionPassword; + const mnemonic = this.sessionMnemonic; + const revision = this.privateRecordSessionRevision; + const vault = this.getVault(); + const selected = { ...vault.activeAccount }; + const selectedAccount = vault.accounts[selected.type]?.[selected.id]; + const identity = { + address: selectedAccount?.address, + xpub: selectedAccount?.xpub, + }; + const network = { ...vault.activeNetwork }; + const request = snapshotBip84HdPublicRequest(input); + const hostGuard = snapshotBip84Guard(options); + const profile = bip84Profile(request.network.network); + const assertCurrent = () => { + const current = this.getVault(); + const account = current.accounts[selected.type]?.[selected.id]; + if ( + !session || + session.isCleared() || + this.sessionPassword !== session || + !mnemonic || + mnemonic.isCleared() || + this.sessionMnemonic !== mnemonic || + this.privateRecordSessionRevision !== revision || + this.bip84Operation !== operation || + selected.type !== KeyringAccountType.HDAccount || + current.activeAccount.type !== selected.type || + current.activeAccount.id !== selected.id || + account?.address !== identity.address || + account?.xpub !== identity.xpub || + account?.isLedgerWallet || + account?.isTrezorWallet || + account?.isSmartAccount || + network.kind !== INetworkType.Syscoin || + network.chainId !== profile.chainId || + network.slip44 !== profile.slip44 || + network.url !== request.network.endpoint || + current.activeNetwork.kind !== network.kind || + current.activeNetwork.chainId !== network.chainId || + current.activeNetwork.slip44 !== network.slip44 || + current.activeNetwork.url !== network.url + ) + throw new Bip84NativeError('CANCELLED'); + }; + const guard = () => { + assertCurrent(); + hostGuard(); + assertCurrent(); + }; + guard(); + const config = getNetworkConfig(profile.slip44, profile.currency); + const { hd } = getSyscoinSigners({ + mnemonic: this.getDecryptedMnemonic(), + rpc: { + formattedNetwork: { ...network, currency: profile.currency }, + networkConfig: { + networks: config.networks, + types: { + xPubType: config.types.xPubType, + zPubType: config.types.zPubType, + }, + }, + }, + }); + let node = hd.getRootNode(); + nodes.push(node); + for (const child of [84, profile.slip44, request.accountIndex]) { + node = node.deriveHardened(child); + nodes.push(node); + if (node.index !== child + 0x80000000) + throw new Bip84NativeError('ACCOUNT_MISMATCH'); + } + const account = parseBip84PublicAccount({ + network: request.network.network, + accountKey: node.neutered().toBase58(), + }); + if (account.accountIndex !== request.accountIndex) + throw new Bip84NativeError('ACCOUNT_MISMATCH'); + const receive = deriveBip84PublicAddress({ + network: request.network.network, + accountKey: account.canonicalKey, + branch: 0, + index: 0, + }); + guard(); + return Object.freeze({ + type: 'HDAccount', + accountIndex: request.accountIndex, + account, + receive, + }); + } catch (error) { + if (error instanceof Bip84NativeError) throw error; + throw new Bip84NativeError('INVALID_REQUEST'); + } finally { + // Only buffers owned by this operation; library/JS copies are not claimed zeroized. + for (const node of nodes) node.privateKey?.fill(0); + if (this.bip84Operation === operation) this.bip84Operation = undefined; + } + } + + /** Fixed selected-account native signing. No storage, discovery or broadcast. */ + protected async signPreparedSoftwareBip84Transaction( + input: PreparedBip84SigningRequest, + options: Bip84Guard + ): Promise { + if (this.bip84Operation) throw new Bip84NativeError('BUSY'); + const operation = {}; + this.bip84Operation = operation; + const nodes: import('bip32').BIP32Interface[] = []; + try { + const session = this.sessionPassword; + const mnemonic = this.sessionMnemonic; + const revision = this.privateRecordSessionRevision; + const vault = this.getVault(); + const selected = { ...vault.activeAccount }; + const selectedAccount = vault.accounts[selected.type]?.[selected.id]; + const identity = { + id: selectedAccount?.id, + address: selectedAccount?.address, + xpub: selectedAccount?.xpub, + }; + const network = { ...vault.activeNetwork }; + const { account, validated } = snapshotPreparedBip84Request(input); + const hostGuard = snapshotBip84Guard(options); + const profile = bip84Profile(validated.prepared.plan.network.network); + const assertCurrent = () => { + const current = this.getVault(); + const active = current.accounts[selected.type]?.[selected.id]; + if ( + !session || + session.isCleared() || + this.sessionPassword !== session || + !mnemonic || + mnemonic.isCleared() || + this.sessionMnemonic !== mnemonic || + this.privateRecordSessionRevision !== revision || + this.bip84Operation !== operation || + selected.type !== KeyringAccountType.HDAccount || + selected.id !== account.index || + current.activeAccount.type !== selected.type || + current.activeAccount.id !== selected.id || + !active || + active.id !== account.index || + active.id !== identity.id || + active.address !== identity.address || + active.xpub !== identity.xpub || + active.isImported || + active.isLedgerWallet || + active.isTrezorWallet || + active.isSmartAccount || + network.kind !== INetworkType.Syscoin || + network.chainId !== profile.chainId || + network.slip44 !== profile.slip44 || + network.url !== validated.prepared.plan.network.endpoint || + current.activeNetwork.kind !== network.kind || + current.activeNetwork.chainId !== network.chainId || + current.activeNetwork.slip44 !== network.slip44 || + current.activeNetwork.url !== network.url + ) + throw new Bip84NativeError('CANCELLED'); + }; + const guard = () => { + assertCurrent(); + hostGuard(); + assertCurrent(); + }; + guard(); + if ( + typeof identity.xpub !== 'string' || + parseBip84PublicAccount({ + network: validated.prepared.plan.network.network, + accountKey: identity.xpub, + }).canonicalKey !== account.expectedAccountKey + ) + throw new Bip84NativeError('ACCOUNT_MISMATCH'); + const words = this.getDecryptedMnemonic(); + if (!BIP84.validateMnemonic(words)) + throw new Bip84NativeError('ACCOUNT_MISMATCH'); + guard(); + const config = getNetworkConfig(profile.slip44, profile.currency); + const { hd } = getSyscoinSigners({ + mnemonic: words, + rpc: { + formattedNetwork: { ...network, currency: profile.currency }, + networkConfig: { + networks: config.networks, + types: { + xPubType: config.types.xPubType, + zPubType: config.types.zPubType, + }, + }, + }, + }); + let node = hd.getRootNode(); + nodes.push(node); + for (const child of [84, profile.slip44, account.index]) { + guard(); + node = node.deriveHardened(child); + nodes.push(node); + if (node.index !== child + 0x80000000) + throw new Bip84NativeError('ACCOUNT_MISMATCH'); + } + guard(); + return signValidatedBip84Plan(validated, node, guard); + } catch (error) { + if (error instanceof Bip84NativeError) throw error; + throw new Bip84NativeError('INVALID_REQUEST'); + } finally { + clearBip84PrivateNodes(nodes); + if (this.bip84Operation === operation) this.bip84Operation = undefined; + } + } + + /** Fixed-path derivation for an authenticated software host; no persistence. */ + protected async deriveSoftwareEvmHdRuntimeAccount( + input: EvmHdRuntimeAccountRequest, + options: EvmHdRuntimeAccountOptions + ): Promise { + // Capture the session and selection before inspecting caller-owned objects. + // Hydration may have no account records yet; account existence is not a guard. + const session = this.sessionPassword; + const mnemonic = this.sessionMnemonic; + const revision = this.privateRecordSessionRevision; + const vault = this.getVault(); + const selected = { ...vault.activeAccount }; + const network = { ...vault.activeNetwork }; + const assertCurrent = () => { + const current = this.getVault(); + if ( + !session || + session.isCleared() || + this.sessionPassword !== session || + !mnemonic || + mnemonic.isCleared() || + this.sessionMnemonic !== mnemonic || + this.privateRecordSessionRevision !== revision || + network.kind !== INetworkType.Ethereum || + network.slip44 !== 60 || + !Number.isSafeInteger(network.chainId) || + network.chainId <= 0 || + typeof network.url !== 'string' || + !network.url || + current.activeAccount.id !== selected.id || + current.activeAccount.type !== selected.type || + current.activeNetwork.kind !== network.kind || + current.activeNetwork.chainId !== network.chainId || + current.activeNetwork.slip44 !== network.slip44 || + current.activeNetwork.url !== network.url + ) + throw new Error( + 'Ethereum HD derivation context changed or is unsupported' + ); + }; + assertCurrent(); + const index = snapshotEvmHdIndex(input); + const hostGuard = preparedEvmGuard(options); + hostGuard(); + assertCurrent(); + const account = await this.setDerivedWeb3Accounts( + index, + `Account ${index + 1}` + ); + hostGuard(); + assertCurrent(); + return account; + } + + /** The software facade owns this public capability; no device fallback. */ + protected signPreparedSoftwareEvmTransaction( + input: PreparedSoftwareEvmSigningRequest, + options: PreparedEvmSigningOptions + ): SignedPreparedEvmTransaction { + // Capture authority before parsing caller data or invoking host callbacks. + const assertSession = this.capturePsbtSigningContext(); + const vault = this.getVault(); + const selected = { ...vault.activeAccount }; + const selectedAccount = vault.accounts[selected.type]?.[selected.id]; + const encryptedKey = selectedAccount?.xprv; + const request = snapshotPreparedEvmRequest(input); + const hostGuard = preparedEvmGuard(options); + const assertCurrent = () => { + assertSession(); + const current = this.getVault(); + const account = current.accounts[selected.type]?.[selected.id]; + if ( + (selected.type !== KeyringAccountType.HDAccount && + selected.type !== KeyringAccountType.Imported) || + !account || + account.id !== selected.id || + account.isLedgerWallet || + account.isTrezorWallet || + account.isSmartAccount || + typeof encryptedKey !== 'string' || + encryptedKey.length === 0 || + account.xprv !== encryptedKey || + request.account.type !== selected.type || + request.account.id !== selected.id || + request.account.expectedAddress !== getAddress(account.address) || + current.activeNetwork.kind !== INetworkType.Ethereum || + current.activeNetwork.slip44 !== 60 || + !Number.isSafeInteger(current.activeNetwork.chainId) || + current.activeNetwork.chainId <= 0 || + BigInt(current.activeNetwork.chainId).toString() !== + request.network.chainId || + current.activeNetwork.url !== request.network.url + ) + throw new Error( + 'Prepared EVM signing context changed or is unsupported' + ); + }; + assertCurrent(); + hostGuard(); + assertCurrent(); + const key = this.getDecryptedPrivateKey(); + if (getAddress(key.address) !== request.account.expectedAddress) + throw new Error('Prepared EVM signer address mismatch'); + assertCurrent(); + const signed = signPreparedEvmEnvelope( + request.transaction, + key.decryptedPrivateKey + ); + hostGuard(); + assertCurrent(); + return signed; + } + + private getSigner = (): { + hd: any; // SyscoinHDSigner or WIFSigner wrapper with sign(psbt) + main: any; // syscoinjs-lib Syscoin instance + } => { + if (!this.sessionPassword) { + throw new Error('Wallet is locked cant proceed with transaction'); + } + if (this.getActiveChain() !== INetworkType.Syscoin) { + throw new Error('Switch to UTXO chain'); + } + + const vault = this.getVault(); + const { activeAccount } = vault; + const accountId = activeAccount.id; + const accountType = activeAccount.type; + const assertCurrent = this.capturePsbtSigningContext(); + + // Determine signer type: HD or WIF single-address + let signerForUse: any; + if (accountType === KeyringAccountType.HDAccount) { + signerForUse = this.createOnDemandUTXOSigner(accountId); + } else if (accountType === KeyringAccountType.Imported) { + // Decrypt stored key material + const decrypted = this.withSecureData((sessionPwd) => { + const account = vault.accounts[KeyringAccountType.Imported][accountId]; + const res = CryptoJS.AES.decrypt(account.xprv, sessionPwd).toString( + CryptoJS.enc.Utf8 + ); + if (!res) throw new Error('Failed to decrypt imported account key'); + return res; + }); + + if (this.isZprv(decrypted)) { + signerForUse = this.createFreshUTXOSigner(decrypted, accountId); + } else { + // Treat as WIF single-address signer wrapper exposing sign(psbt) + const network = vault.activeNetwork; + const { networks } = getNetworkConfig(network.slip44, network.currency); + const isTestnet = network.slip44 === 1; + const bitcoinjsNetwork = isTestnet + ? networks.testnet + : networks.mainnet; + + signerForUse = { + sign: async (psbt: Psbt) => { + return await (syscoinjs.utils as any).signWithWIF( + psbt, + decrypted, + bitcoinjsNetwork + ); + }, + }; + } + } else { + throw new Error( + `Unsupported account type for UTXO signing: ${accountType}` + ); + } + + const scope = { + account: vault.accounts[accountType][accountId], + accountId, + accountType, + network: vault.activeNetwork, + }; + if (typeof signerForUse.getRootNode === 'function') { + const getRootNode = signerForUse.getRootNode.bind(signerForUse); + const guardPath = createPsbtDerivationGuard(scope); + signerForUse.getRootNode = () => { + const root = getRootNode(); + const scopedRoot = Object.create(root); + scopedRoot.derivePath = (path: string) => { + guardPath(path); + return root.derivePath(path); + }; + return scopedRoot; + }; + } + const sign = signerForUse.sign.bind(signerForUse); + signerForUse.sign = async (psbt: Psbt) => { + assertCurrent(); + assertPsbtAccountScope(psbt, scope); + const result = await sign(psbt); + assertCurrent(); + return result; + }; + + // Create syscoinjs instance with current network (no need to attach signer for signing flow) + const network = vault.activeNetwork; + const networkConfig = getNetworkConfig(network.slip44, network.currency); + const isTestnet = network.slip44 === 1; + const bitcoinjsNetwork = isTestnet + ? networkConfig?.networks?.testnet + : networkConfig?.networks?.mainnet; + + const syscoinMainSigner = new syscoinjs.SyscoinJSLib( + null, + network.url, + bitcoinjsNetwork + ); + + return { + hd: signerForUse, + main: syscoinMainSigner, + }; + }; + + // Read-only version that works when wallet is locked + private getReadOnlySigner = (): { + main: any; // syscoinjs-lib Syscoin instance (read-only) + } => { + if (this.getActiveChain() !== INetworkType.Syscoin) { + throw new Error('Switch to UTXO chain'); + } + + // Create syscoinjs instance without HD signer for read-only operations + const vault = this.getVault(); + const network = vault.activeNetwork; + const networkConfig = getNetworkConfig(network.slip44, network.currency); + const isTestnet = network.slip44 === 1; + const bitcoinjsNetwork = isTestnet + ? networkConfig?.networks?.testnet + : networkConfig?.networks?.mainnet; + + const syscoinMainSigner = new syscoinjs.SyscoinJSLib( + null, // No HD signer needed for read-only operations + network.url, + bitcoinjsNetwork + ); + + return { + main: syscoinMainSigner, + }; + }; + + private writeUtf8Diagnostic(hasUtf8Error: boolean): void { + try { + void Promise.resolve( + this.storage.set('utf8Error', { hasUtf8Error }) + ).catch(() => undefined); + } catch { + // This diagnostic must not interrupt authentication or become an + // unhandled rejection when an asynchronous storage client is offline. + } + } + + private validateAndHandleErrorByMessage(message: string) { + const utf8ErrorMessage = 'Malformed UTF-8 data'; + if ( + message.includes(utf8ErrorMessage) || + message.toLowerCase().includes(utf8ErrorMessage.toLowerCase()) + ) { + this.writeUtf8Diagnostic(true); + } + } + + private getAccountsState = () => { + const vault = this.getVault(); + const { accounts, activeAccount, activeNetwork } = vault; + return { + activeAccountId: activeAccount.id, + accounts, + activeAccountType: activeAccount.type, + activeNetwork, + }; + }; + + /** + * + * @param password + * @param salt + * @returns derived key: hex string + */ + private encryptSHA512 = (password: string, salt: string): string => { + // Session/encryption key derivation (used to encrypt/decrypt xprv in-memory and persisted state). + // PBKDF2 with SHA-512, 20,000 iterations (prod default), 256-bit output. + // NOTE: Tests override iterations to keep CI fast. + const isTestEnv = + typeof process !== 'undefined' && process?.env?.NODE_ENV === 'test'; + const iterations = + Number.parseInt(process?.env?.SYSWEB3_PBKDF2_ENC_ITERS || '', 10) || + (isTestEnv ? 1_000 : 20_000); + const key = CryptoJS.PBKDF2(password, CryptoJS.enc.Hex.parse(salt), { + keySize: 256 / 32, // 256 bits + iterations, + hasher: CryptoJS.algo.SHA512, + }); + return key.toString(); + }; + + private hasWebCrypto = (): boolean => { + // MV3 service worker & extension pages: globalThis.crypto.subtle exists. + // Jest tests mock global.crypto without subtle -> fallback to CryptoJS. + return !!(globalThis as any)?.crypto?.subtle; + }; + + private hexToBytes = (hex: string): Uint8Array => { + const clean = (hex || '').trim(); + if (!/^[0-9a-fA-F]*$/.test(clean) || clean.length % 2 !== 0) { + throw new Error('Invalid hex string'); + } + const out = new Uint8Array(clean.length / 2); + for (let i = 0; i < out.length; i++) { + out[i] = parseInt(clean.slice(i * 2, i * 2 + 2), 16); + } + return out; + }; + + private bytesToHex = (bytes: ArrayBuffer): string => { + const u8 = new Uint8Array(bytes); + let hex = ''; + for (let i = 0; i < u8.length; i++) { + hex += u8[i].toString(16).padStart(2, '0'); + } + return hex; + }; + + private getEncIterations = (): number => { + const isTestEnv = + typeof process !== 'undefined' && process?.env?.NODE_ENV === 'test'; + return ( + Number.parseInt(process?.env?.SYSWEB3_PBKDF2_ENC_ITERS || '', 10) || + (isTestEnv ? 1_000 : 900_000) + ); + }; + + private async pbkdf2WebCryptoHex(params: { + password: string; + saltHex: string; + iterations: number; + lengthBytes: number; + hash: 'SHA-256' | 'SHA-512'; + }): Promise { + const subtle = (globalThis as any).crypto.subtle as SubtleCrypto; + const enc = new TextEncoder(); + const passBytes = enc.encode(params.password); + const saltBytes = this.hexToBytes(params.saltHex); + + const keyMaterial = await subtle.importKey( + 'raw', + passBytes as unknown as BufferSource, + { name: 'PBKDF2' }, + false, + ['deriveBits'] + ); + + const bits = await subtle.deriveBits( + { + name: 'PBKDF2', + salt: saltBytes as unknown as BufferSource, + iterations: params.iterations, + hash: params.hash, + }, + keyMaterial, + params.lengthBytes * 8 + ); + + return this.bytesToHex(bits); + } + + private async encryptSHA512Async( + password: string, + salt: string + ): Promise { + if (this.hasWebCrypto()) { + // Match CryptoJS PBKDF2 output format: hex string + return await this.pbkdf2WebCryptoHex({ + password, + saltHex: salt, + iterations: this.getEncIterations(), + lengthBytes: 32, // 256-bit + hash: 'SHA-512', + }); + } + + throw new Error('WebCrypto is required for vault key derivation'); + } + + private async deriveLegacySessionKey( + password: string, + salt: string + ): Promise { + if (this.hasWebCrypto()) { + return this.pbkdf2WebCryptoHex({ + password, + saltHex: salt, + iterations: 20_000, + lengthBytes: 32, + hash: 'SHA-512', + }); + } + // Read compatibility only; new vault writes still require WebCrypto. + return CryptoJS.PBKDF2(password, CryptoJS.enc.Hex.parse(salt), { + keySize: 256 / 32, + iterations: 20_000, + hasher: CryptoJS.algo.SHA512, + }).toString(); + } + + private async deriveStoredSessionKey( + password: string, + vaultKeys: any + ): Promise { + if (vaultKeys.keyDerivation === LEGACY_ENCRYPTION_KDF) { + return this.deriveLegacySessionKey(password, vaultKeys.salt); + } + if (vaultKeys.keyDerivation !== undefined) { + throw new Error('Unsupported vault key derivation profile'); + } + return this.encryptSHA512Async(password, vaultKeys.salt); + } + + private getSysActivePrivateKey = (hd: SyscoinHDSigner) => { + if (hd === null) throw new Error('No HD Signer'); + + const accountIndex = hd.Signer.accountIndex; + + // Verify the account exists now + if (!hd.Signer.accounts.has(accountIndex)) { + throw new Error(`Account at index ${accountIndex} could not be created`); + } + + return hd.Signer.accounts.get(accountIndex).getAccountPrivateKey(); + }; + + private getInitialAccountData = ({ + label, + signer, + sysAccount, + xprv, + }: { + label?: string; + signer: any; + sysAccount: ISysAccount; + xprv: string; + }) => { + const { address, xpub } = sysAccount; + + return { + id: signer.Signer.accountIndex, + label: label || `Account ${signer.Signer.accountIndex + 1}`, + xpub, + xprv, + address, + isTrezorWallet: false, + isLedgerWallet: false, + isImported: false, + }; + }; + + private async _createTrezorAccount( + coin: string, + slip44: number, + index: number, + label?: string + ) { + const vault = this.getVault(); + const { accounts } = vault; + + // For EVM networks, Trezor expects 'eth' regardless of the network's currency + const trezorCoin = slip44 === 60 ? 'eth' : coin; + + const { descriptor, balance: _balance } = + await this.requireTrezorSigner().getAccountInfo({ + coin: trezorCoin, + slip44, + index, + }); + const xpub = descriptor; + const balance = _balance; + + let ethPubKey = ''; + + const isEVM = isEvmCoin(coin, slip44); + + // For EVM networks, we need to get the actual address from Trezor + let address: string; + if (isEVM) { + // For EVM, the descriptor from getAccountInfo is the address + address = xpub; + + // Get the public key for EVM + const response = await this.requireTrezorSigner().getPublicKey({ + coin: trezorCoin, + slip44, + index: +index, + }); + ethPubKey = response.publicKey; + } else { + // For UTXO, use the xpub to derive the address + // Always use first receive address (index 0) for imported account display + address = await this.getAddress(xpub, false, { forceIndex0: true }); + } + + if (this.accountAddressExists(accounts, address, isEVM)) + throw new Error('Account already exists on your Wallet.'); + if (!xpub || !address) + throw new Error( + 'Something wrong happened. Please, try again or report it' + ); + + // Use getNextAccountId to properly handle placeholder accounts + const id = this.getNextAccountId(accounts[KeyringAccountType.Trezor]); + + // Convert balance from satoshis to SYS safely + // Using string manipulation to avoid precision loss + let syscoinBalance = 0; + if (!isEVM && balance) { + const balanceStr = balance.toString(); + // Handle conversion without division to preserve precision + if (balanceStr.length > 8) { + // Has whole SYS part + const wholePart = balanceStr.slice(0, -8); + const decimalPart = balanceStr.slice(-8); + syscoinBalance = parseFloat(`${wholePart}.${decimalPart}`); + } else { + // Less than 1 SYS + const paddedBalance = balanceStr.padStart(8, '0'); + syscoinBalance = parseFloat(`0.${paddedBalance}`); + } + } + + const trezorAccount = { + ...this.initialTrezorAccountState, + balances: { + syscoin: isEVM ? 0 : syscoinBalance, + ethereum: 0, + }, + address, + label: label ? label : `Trezor ${id + 1}`, + id, + xprv: '', + xpub: isEVM ? ethPubKey : xpub, + assets: { + syscoin: [], + ethereum: [], + }, + } as IKeyringAccountState; + + return trezorAccount; + } + + private async _createLedgerAccount( + coin: string, + slip44: number, + index: number, + label?: string + ) { + const vault = this.getVault(); + const { accounts } = vault; + let xpub; + let address = ''; + if (isEvmCoin(coin, slip44)) { + const { address: ethAddress, publicKey } = + await this.requireLedgerSigner().evm.getEvmAddressAndPubKey({ + accountIndex: index, + }); + address = ethAddress; + xpub = publicKey; + } else { + const ledgerXpub = await this.requireLedgerSigner().utxo.getXpub({ + index: index, + coin, + slip44, + }); + + // Convert device-returned extended key to BIP84 zpub/vpub for storage/backend usage + const { types } = getNetworkConfig(slip44, coin); + const bip84Target = + slip44 === 1 + ? (types.zPubType as any).testnet.vpub + : types.zPubType.mainnet.zpub; + xpub = convertExtendedKeyVersion(ledgerXpub, bip84Target); + + // Always use first receive address (index 0) for imported account display + address = await this.getAddress(xpub, false, { forceIndex0: true }); + } + + if (this.accountAddressExists(accounts, address, isEvmCoin(coin, slip44))) + throw new Error('Account already exists on your Wallet.'); + if (!xpub || !address) + throw new Error( + 'Something wrong happened. Please, try again or report it' + ); + + // Use getNextAccountId to properly handle placeholder accounts + const id = this.getNextAccountId(accounts[KeyringAccountType.Ledger]); + + const currentBalances = { syscoin: 0, ethereum: 0 }; + + const ledgerAccount = { + ...this.initialLedgerAccountState, + balances: currentBalances, + address, + label: label ? label : `Ledger ${id + 1}`, + id, + xprv: '', + xpub, + assets: { + syscoin: [], + ethereum: [], + }, + } as IKeyringAccountState; + + return ledgerAccount; + } + + private getFormattedBackendAccount = async ({ + signer, + }: { + signer: SyscoinHDSigner; + }): Promise => { + // MUCH SIMPLER: Just use the signer directly - no BIP84 needed! + // Get address directly from the signer (always correct for current network) + const address = signer.createAddress(0, false, 84) as string; + const xpub = signer.getAccountXpub(); + + return { + address, + xpub, + }; + }; + private setLatestIndexesFromXPubTokens = function (tokens) { + let changeIndexInternal = -1, + receivingIndexInternal = -1; + if (tokens) { + tokens.forEach((token) => { + if (!token.transfers || !token.path) { + return { + changeIndex: changeIndexInternal + 1, + receivingIndex: receivingIndexInternal + 1, + }; + } + const transfers = parseInt(token.transfers, 10); + if (token.path && transfers > 0) { + const splitPath = token.path.split('/'); + if (splitPath.length >= 6) { + const change = parseInt(splitPath[4], 10); + const index = parseInt(splitPath[5], 10); + if (change === 1) { + if (index > changeIndexInternal) { + changeIndexInternal = index; + } + } else if (index > receivingIndexInternal) { + receivingIndexInternal = index; + } + } + } + }); + } + return { + changeIndex: changeIndexInternal + 1, + receivingIndex: receivingIndexInternal + 1, + }; + }; + + // Common helper method for UTXO account creation + private async createUTXOAccountAtIndex(accountId: number, label?: string) { + try { + // Create fresh signer just for this account creation operation + const freshHDSigner = this.createOnDemandUTXOSigner(accountId); + + const sysAccount = await this.getFormattedBackendAccount({ + signer: freshHDSigner, + }); + + const encryptedXprv = this.getEncryptedXprv(freshHDSigner); + + // Generate network-aware label if none provided + const vault = this.getVault(); + const network = vault.activeNetwork; + const defaultLabel = this.generateNetworkAwareLabel(accountId, network); + + return { + ...this.getInitialAccountData({ + label: label || defaultLabel, + signer: freshHDSigner, + sysAccount, + xprv: encryptedXprv, + }), + balances: { syscoin: 0, ethereum: 0 }, + } as IKeyringAccountState; + } catch (error) { + console.log('ERROR createUTXOAccountAtIndex', { + error, + }); + this.validateAndHandleErrorByMessage(error.message); + throw error; + } + } + + private async addNewAccountToSyscoinChain(label?: string) { + try { + // Get next available account ID + const vault = this.getVault(); + const accounts = vault.accounts[KeyringAccountType.HDAccount]; + const nextId = this.getNextAccountId(accounts); + + return await this.createUTXOAccountAtIndex(nextId, label); + } catch (error) { + console.log('ERROR addNewAccountToSyscoinChain', { + error, + }); + this.validateAndHandleErrorByMessage(error.message); + throw error; + } + } + + private async addNewAccountToEth(label?: string) { + try { + // Get next available account ID + const vault = this.getVault(); + const accounts = vault.accounts[KeyringAccountType.HDAccount]; + const nextId = this.getNextAccountId(accounts); + + // EVM accounts should use generic labels since they work across all EVM networks + const defaultLabel = `Account ${nextId + 1}`; + + const newAccount = await this.setDerivedWeb3Accounts( + nextId, + label || defaultLabel + ); + + return newAccount; + } catch (error) { + console.log('ERROR addNewAccountToEth', { + error, + }); + this.validateAndHandleErrorByMessage(error.message); + throw error; + } + } + + // Helper method to get next available account ID - fills gaps when accounts are deleted + private getNextAccountId(accounts: any): number { + const existingIds = Object.values(accounts) + .filter((account: any) => { + // Only count accounts that have been properly initialized + // Placeholder accounts have empty addresses/xprv/xpub + return account && account.address && account.xpub; + }) + .map((account: any) => account.id) + .filter((id) => !isNaN(id)) + .sort((a, b) => a - b); // Sort to find gaps efficiently + + if (existingIds.length === 0) { + return 0; + } + + // Find the first gap in the sequence + for (let i = 0; i < existingIds.length; i++) { + if (existingIds[i] !== i) { + // Found a gap at position i + return i; + } + } + + // No gaps found, return next sequential ID + return existingIds.length; + } + + private getBasicWeb3AccountInfo = (id: number, label?: string) => { + return { + id, + isTrezorWallet: false, + isLedgerWallet: false, + label: label ? label : `Account ${id + 1}`, + }; + }; + + private setDerivedWeb3Accounts = async ( + id: number, + label: string + ): Promise => { + try { + // For account creation, derive from mnemonic (since account doesn't exist yet) + const mnemonic = this.getDecryptedMnemonic(); + const derivationPath = getAddressDerivationPath('eth', 60, 0, false, id); + const derivedAccount = deriveEvmAccountFromMnemonic( + mnemonic, + derivationPath + ); + + const basicAccountInfo = this.getBasicWeb3AccountInfo(id, label); + + const createdAccount = { + address: derivedAccount.address, + xpub: derivedAccount.publicKey, + xprv: this.withSecureData((sessionPwd) => { + return CryptoJS.AES.encrypt( + derivedAccount.privateKey, + sessionPwd + ).toString(); + }), + isImported: false, + ...basicAccountInfo, + balances: { syscoin: 0, ethereum: 0 }, + }; + + // NOTE: Account creation should be dispatched to Redux store, not stored here + // Return the account data for Pali to add to store + return createdAccount; + } catch (error) { + console.log('ERROR setDerivedWeb3Accounts', { + error, + }); + this.validateAndHandleErrorByMessage(error.message); + throw error; + } + }; + + private setSignerEVM = async (network: INetwork): Promise => { + const abortController = new AbortController(); + try { + // With multi-keyring architecture, this is only called on EVM keyrings + this.ethereumTransaction.setWeb3Provider(network); + abortController.abort(); + } catch (error) { + abortController.abort(); + throw new Error(`SetSignerEVM: Failed with ${error}`); + } + }; + + private clearTemporaryLocalKeys = async () => { + // Clear the vault completely. + // For v4, the vault is encrypted with a derived key, so the safest wipe is to delete the stored blob. + await this.storage.deleteItem('vault'); + + // Remove vault-keys from storage so no vault exists at all + await this.storage.deleteItem('vault-keys'); + + console.log('[KeyringManager] Temporary local keys cleared'); + this.logout(); + }; + + private async recreateSessionFromVault( + saltedHashPassword: string + ): Promise { + try { + // v4 vault is encrypted with the derived session password key (PBKDF2 output) + // `saltedHashPassword` is the derived session password key passed by caller. + const { mnemonic } = await this.vaultPersistence.getDecryptedVault( + saltedHashPassword + ); + + if (!mnemonic) { + throw new Error('Mnemonic not found in vault'); + } + + // Encrypt session data with sessionPassword hash for consistency + // This allows keyring manager to decrypt with this.sessionPassword + this.privateRecordSessionRevision++; + this.sessionPassword = new SecureBuffer(saltedHashPassword); + // Encrypt the mnemonic with session password for consistency with the rest of the code + const encryptedMnemonic = CryptoJS.AES.encrypt( + mnemonic, + saltedHashPassword + ).toString(); + this.sessionMnemonic = new SecureBuffer(encryptedMnemonic); + console.log('[KeyringManager] Session data recreated from vault'); + } catch (error) { + console.error('ERROR recreateSessionFromVault', { error }); + throw error; + } + } + + private async _getPrivateKeyAccountInfos( + privKey: string, + label?: string, + options?: { utxoAddressType?: 'p2wpkh' | 'p2pkh' | 'p2tr' } + ) { + const vault = this.getVault(); + const { accounts } = vault; + let importedAccountValue: { + address: string; + privateKey: string; + publicKey: string; + } | null = null; + + const balances = { + syscoin: 0, + ethereum: 0, + }; + + // Try to validate as extended private key first + const networkToUse = vault.activeNetwork; + const zprvValidation = this.validateZprv(privKey, networkToUse); + + // Check if we're on an EVM network (slip44 = 60) or UTXO network + const isEvmNetwork = networkToUse.slip44 === 60; + + if (zprvValidation.isValid) { + // This is a valid UTXO extended private key + if (isEvmNetwork) { + throw new Error( + 'Cannot import UTXO private key on EVM network. Please switch to a UTXO network (Bitcoin/Syscoin) first.' + ); + } + const { node, network } = zprvValidation; + + if (!node || !network) { + throw new Error('Failed to validate extended private key'); + } + + // Always use index 0 for consistency + const nodeChild = node.derivePath(`0/0`); + if (!nodeChild) { + throw new Error('Failed to derive child node'); + } + + // Choose address type based on options or default to p2wpkh + let addrObj; + if (options?.utxoAddressType === 'p2pkh') { + addrObj = bjs.payments.p2pkh({ + pubkey: nodeChild.publicKey, + network, + }); + } else if (options?.utxoAddressType === 'p2tr') { + // For taproot, use x-only public key (32 bytes instead of 33) + const xOnly = + nodeChild.publicKey.length === 33 + ? nodeChild.publicKey.slice(1, 33) + : nodeChild.publicKey; + addrObj = bjs.payments.p2tr({ + internalPubkey: xOnly, + network, + }); + } else { + // Default to SegWit (p2wpkh) + addrObj = bjs.payments.p2wpkh({ + pubkey: nodeChild.publicKey, + network, + }); + } + + const { address } = addrObj; + if (!address) { + throw new Error('Failed to generate address'); + } + + importedAccountValue = { + address, + // IMPORTANT: Store BIP84 extended *public* key (zpub/vpub), not device-style xpub/tpub. + // Blockbook derives different address branches depending on version bytes. + // Using zpub/vpub ensures UTXO discovery and `input.path` match BIP84 (m/84'/slip44'/...), + // which is required for HD signing. + publicKey: (() => { + try { + const { types } = getNetworkConfig( + networkToUse.slip44, + networkToUse.currency || 'Bitcoin' + ); + const target = + networkToUse.slip44 === 1 + ? (types.zPubType as any).testnet.vpub + : types.zPubType.mainnet.zpub; + return convertExtendedKeyVersion( + node.neutered().toBase58(), + target + ); + } catch (_e) { + // Fall back to the default neutered key if conversion fails. + return node.neutered().toBase58(); + } + })(), + privateKey: privKey, + }; + + balances.syscoin = 0; + } else { + // If not a valid zprv/vprv, on UTXO networks try WIF + const isEvmNetwork = networkToUse.slip44 === 60; + let handledAsUtxo = false; + if (!isEvmNetwork) { + const wifValidation = this.validateWif(privKey, networkToUse); + if (wifValidation.isValid) { + // Create address from WIF and treat as single-address imported account + const { networks } = getNetworkConfig( + networkToUse.slip44, + networkToUse.currency || 'Bitcoin' + ); + const isTestnet = networkToUse.slip44 === 1; + const bitcoinNetwork = isTestnet + ? networks.testnet + : networks.mainnet; + + const keyPair = (syscoinjs.utils as any).bitcoinjs.ECPair.fromWIF( + privKey, + bitcoinNetwork + ); + // Choose address type based on options or default behavior + let addrObj; + if (options?.utxoAddressType === 'p2pkh') { + addrObj = bjs.payments.p2pkh({ + pubkey: keyPair.publicKey, + network: bitcoinNetwork, + }); + } else if (options?.utxoAddressType === 'p2tr') { + // For taproot, use x-only public key (32 bytes instead of 33) + const xOnly = + keyPair.publicKey.length === 33 + ? keyPair.publicKey.slice(1, 33) + : keyPair.publicKey; + addrObj = bjs.payments.p2tr({ + internalPubkey: xOnly, + network: bitcoinNetwork, + }); + } else { + // Default to SegWit (p2wpkh) + addrObj = bjs.payments.p2wpkh({ + pubkey: keyPair.publicKey, + network: bitcoinNetwork, + }); + } + const address = addrObj.address; + if (!address) { + throw new Error('Failed to generate address from WIF'); + } + + importedAccountValue = { + address, + // For single-address WIF accounts, store xpub as the address marker + publicKey: address, + privateKey: privKey, + }; + + // Set UTXO balance bucket + balances.syscoin = 0; + handledAsUtxo = true; + + // Proceed to account creation below + } else if (!isEvmNetwork && wifValidation.message) { + // Provide useful feedback on UTXO network if WIF was attempted and failed + // Continue to EVM handling only if actually EVM network + } + } + + // Check if the validation failed due to network mismatch + if ( + zprvValidation.message && + zprvValidation.message.includes('Network mismatch') + ) { + throw new Error(zprvValidation.message); + } + + // Check if the validation failed due to invalid key prefix (only for known extended key formats) + if ( + zprvValidation.message && + zprvValidation.message.includes('Invalid key prefix') + ) { + throw new Error(zprvValidation.message); + } + + // Check if it failed parsing as an extended key + if ( + zprvValidation.message && + zprvValidation.message.includes('Failed to parse extended private key') + ) { + throw new Error(zprvValidation.message); + } + + // Check if it looks like an extended key that failed validation + const knownExtendedKeyPrefixes = [ + 'xprv', + 'xpub', + 'yprv', + 'ypub', + 'zprv', + 'zpub', + 'tprv', + 'tpub', + 'uprv', + 'upub', + 'vprv', + 'vpub', + ]; + const prefix = privKey.substring(0, 4); + const looksLikeExtendedKey = knownExtendedKeyPrefixes.includes(prefix); + + if (looksLikeExtendedKey) { + // This looks like a UTXO extended key, but it failed validation + // Don't try to import it as an EVM key + if (isEvmNetwork) { + throw new Error( + 'Cannot import UTXO private key on EVM network. Please switch to a UTXO network (Bitcoin/Syscoin) first.' + ); + } + // For UTXO networks, throw the original validation error + throw new Error( + zprvValidation.message || 'Invalid extended private key' + ); + } + + // If it's not an extended key and not a valid WIF, treat it as an Ethereum private key + // But first check if we're on an EVM network + if (!isEvmNetwork && !handledAsUtxo) { + throw new Error( + 'Cannot import EVM private key on UTXO network. Please switch to an EVM network first.' + ); + } + + if (!handledAsUtxo) { + const hexPrivateKey = + privKey.slice(0, 2) === '0x' ? privKey : `0x${privKey}`; + + // Validate it's a valid hex string (32 bytes = 64 hex chars) + if ( + !/^0x[0-9a-fA-F]{64}$/.test(hexPrivateKey) && + !/^[0-9a-fA-F]{64}$/.test(privKey) + ) { + throw new Error( + 'Invalid private key format. Expected 32-byte hex string or extended private key.' + ); + } + + importedAccountValue = + this.ethereumTransaction.importAccount(hexPrivateKey); + + balances.ethereum = 0; + } + } + + if (!importedAccountValue) { + throw new Error( + 'Invalid private key format. Expected WIF, extended private key, or 32-byte hex.' + ); + } + + const { address, publicKey, privateKey } = importedAccountValue; + + // Validate duplicates across all account buckets, including passkey smart accounts. + if (this.accountAddressExists(accounts, address, isEvmNetwork)) + throw new Error( + 'Account already exists, try again with another Private Key.' + ); + + const id = this.getNextAccountId(accounts[KeyringAccountType.Imported]); + const defaultLabel: string = label || `Imported ${id + 1}`; + return { + ...initialActiveImportedAccountState, + address, + label: defaultLabel, + id, + balances, + isImported: true, + xprv: this.withSecureData((sessionPwd) => { + return CryptoJS.AES.encrypt(privateKey, sessionPwd).toString(); + }), + xpub: publicKey, + assets: { + syscoin: [], + ethereum: [], + }, + } as IKeyringAccountState; + } + + // NEW: On-demand signer creation methods + + /** + * Common method to decrypt mnemonic from session + * Eliminates code duplication across multiple methods + */ + private getDecryptedMnemonic(): string { + if (!this.sessionMnemonic || !this.sessionPassword) { + throw new Error('Session information not available'); + } + + const mnemonic = this.withSecureData((sessionPwd, sessionMnemonic) => { + const decrypted = CryptoJS.AES.decrypt( + sessionMnemonic, + sessionPwd + ).toString(CryptoJS.enc.Utf8); + + if (!decrypted) { + throw new Error('Failed to decrypt mnemonic'); + } + + return decrypted; + }); + + return mnemonic; + } + + /** + * Creates network RPC config from current active network without making RPC calls + * Common utility for all on-demand signer creation + */ + private createNetworkRpcConfig() { + const network = this.getVault().activeNetwork; + + return { + formattedNetwork: network, + networkConfig: getNetworkConfig(network.slip44, network.currency), + }; + } + + /** + * Common signer creation logic - takes decrypted mnemonic/zprv and creates fresh signer + * OPTIMIZED: No RPC call needed - uses network config directly + */ + private createFreshUTXOSigner( + mnemonicOrZprv: string, + accountId: number + ): SyscoinHDSigner { + // Create signer using network config directly (no RPC call) + const rpcConfig = this.createNetworkRpcConfig(); + // Type assertion to match getSyscoinSigners expected interface + const { hd } = getSyscoinSigners({ + mnemonic: mnemonicOrZprv, + rpc: rpcConfig as any, + }); + + // Create account at the specified index and set it as active + // Note: createAccountAtIndex is synchronous despite TypeScript types + hd.createAccountAtIndex(accountId, 84); + + // Verify the account was created correctly + if (!hd.Signer.accounts.has(accountId)) { + throw new Error(`Failed to create account at index ${accountId}`); + } + + // Verify the correct account is active + if (hd.Signer.accountIndex !== accountId) { + throw new Error( + `Account index mismatch: expected ${accountId}, got ${hd.Signer.accountIndex}` + ); + } + + return hd; + } + + /** + * Creates a fresh UTXO signer for HD accounts derived from the main seed + * OPTIMIZED: No RPC call needed - uses network config directly + */ + private createOnDemandUTXOSigner(accountId: number): SyscoinHDSigner { + // Use common method to avoid code duplication + const mnemonic = this.getDecryptedMnemonic(); + return this.createFreshUTXOSigner(mnemonic, accountId); + } + + // NEW: Helper methods for HD signer management + private isZprv(key: string): boolean { + const zprvPrefixes = ['zprv', 'tprv', 'vprv', 'xprv']; + return zprvPrefixes.some((prefix) => key.startsWith(prefix)); + } + // NEW: Separate session initialization from account creation + public initializeSession = async ( + seedPhrase: string, + password: string + ): Promise => { + // Validate inputs first + if (!BIP84.validateMnemonic(seedPhrase)) { + throw new Error('Invalid Seed'); + } + + const [vault, vaultKeys] = await Promise.all([ + this.storage.get('vault'), + this.storage.get('vault-keys'), + ]); + const hasVault = vault !== undefined && vault !== null; + const hasVaultKeys = vaultKeys !== undefined && vaultKeys !== null; + const livePassword = this.sessionPassword; + const liveMnemonic = this.sessionMnemonic; + + // Only an already-unlocked, matching session may repeat initialization. + // Restoring any existing wallet must use unlock(), never rewrite its vault. + if ( + livePassword && + liveMnemonic && + !livePassword.isCleared() && + !liveMnemonic.isCleared() + ) { + if (!hasVault || !hasVaultKeys || !vaultKeys.salt) { + throw new Error( + 'Cannot initialize a new vault over existing wallet storage' + ); + } + const sessionPasswordSaltedHash = await this.deriveStoredSessionKey( + password, + vaultKeys + ); + if ( + livePassword === this.sessionPassword && + liveMnemonic === this.sessionMnemonic && + sessionPasswordSaltedHash === this.getSessionPasswordString() + ) { + // Same password - check if it's the same mnemonic to ensure full idempotency + let currentMnemonic: string | undefined; + try { + currentMnemonic = this.withSecureData( + (sessionPwd, sessionMnemonic) => { + return CryptoJS.AES.decrypt(sessionMnemonic, sessionPwd).toString( + CryptoJS.enc.Utf8 + ); + } + ); + } catch (error) { + // If we can't decrypt, fall through to error + } + if (currentMnemonic === seedPhrase) { + const storedVault = await this.vaultPersistence.getDecryptedVault( + sessionPasswordSaltedHash + ); + if ( + livePassword === this.sessionPassword && + liveMnemonic === this.sessionMnemonic && + !livePassword.isCleared() && + !liveMnemonic.isCleared() && + storedVault?.mnemonic === seedPhrase + ) { + // This is a read-only identity check, not a second vault write. + return; + } + } + } + + // Different password or mnemonic - this is not a simple re-initialization + throw new Error( + 'Wallet already initialized with different parameters. Unlock the existing wallet or explicitly remove it before starting setup.' + ); + } + + if (hasVault || hasVaultKeys) { + throw new Error( + 'Cannot initialize a new vault over existing wallet storage' + ); + } + + const salt = crypto.randomBytes(16).toString('hex'); + // v4 stores only the salt on disk. A genuinely fresh initialization always + // commits its own salt and ciphertext together under the vault mutex. + const sessionPasswordSaltedHash = await this.deriveStoredSessionKey( + password, + { salt } + ); + + // Encrypt and store vault (mnemonic storage) - now uses single vault for all networks + await this.vaultPersistence.setEncryptedVault( + { + mnemonic: seedPhrase, // Store plain mnemonic - setEncryptedVault will encrypt the entire vault + }, + // v4 vault is encrypted with the derived session password key (PBKDF2 output) + sessionPasswordSaltedHash, + { salt } + ); + + await this.recreateSessionFromVault(sessionPasswordSaltedHash); + }; + + // NEW: Create first account without signer setup + public createFirstAccount = async ( + label?: string + ): Promise => { + if (!this.sessionPassword || !this.sessionMnemonic) { + throw new Error( + 'Session must be initialized first. Call initializeSession.' + ); + } + + const vault = this.getVault(); + const network = vault.activeNetwork; + + if (network.kind === INetworkType.Syscoin) { + // UTXO accounts get network-aware labels since each network has separate keyrings + const defaultLabel = label || this.generateNetworkAwareLabel(0, network); + + // Create UTXO account using on-demand signer + const freshHDSigner = this.createOnDemandUTXOSigner(0); + + const sysAccount = await this.getFormattedBackendAccount({ + signer: freshHDSigner, + }); + + const encryptedXprv = this.getEncryptedXprv(freshHDSigner); + + return { + ...this.getInitialAccountData({ + label: defaultLabel, + signer: freshHDSigner, + sysAccount, + xprv: encryptedXprv, + }), + balances: { syscoin: 0, ethereum: 0 }, + } as IKeyringAccountState; + } else { + // EVM accounts get generic labels since they work across all EVM networks + const defaultLabel = label || 'Account 1'; + return await this.setDerivedWeb3Accounts(0, defaultLabel); + } + }; + + public initializeWalletSecurely = async ( + seedPhrase: string, + password: string + ): Promise => { + // Use new separated approach + await this.initializeSession(seedPhrase, password); + return await this.createFirstAccount(); + }; + // Helper methods for secure buffer operations + private getSessionPasswordString(): string { + if (!this.sessionPassword || this.sessionPassword.isCleared()) { + throw new Error('Session password not available'); + } + // WARNING: This exposes sensitive data as a string + // Use only for CryptoJS operations that require string input + return this.sessionPassword.toString(); + } + + private getSessionMnemonicString(): string { + if (!this.sessionMnemonic || this.sessionMnemonic.isCleared()) { + throw new Error('Session mnemonic not available'); + } + // WARNING: This exposes sensitive data as a string + // Use only for CryptoJS operations that require string input + return this.sessionMnemonic.toString(); + } + + // Secure method to perform cryptographic operations without exposing strings + private withSecureData( + operation: (password: string, mnemonic: string) => T + ): T { + if (!this.sessionPassword || !this.sessionMnemonic) { + throw new Error('Session data not available'); + } + + // Perform operation with minimal exposure + const result = operation( + this.getSessionPasswordString(), + this.getSessionMnemonicString() + ); + + // Clear any temporary variables if needed + return result; + } + + private generateNetworkAwareLabel( + accountId: number, + network: INetwork + ): string { + // Generate concise network-specific labels using actual network config + const { label, chainId, kind, currency } = network; + + // Create a shortened network identifier based on actual network configurations + let networkPrefix = ''; + + if (kind === INetworkType.Syscoin) { + // UTXO networks (slip44 = 57 for mainnet, 1 for testnet) + if (chainId === 57) { + networkPrefix = 'SYS'; // Syscoin UTXO Mainnet + } else if (chainId === 5700) { + networkPrefix = 'SYS-T'; // Syscoin UTXO Testnet (slip44=1) + } else { + // Other UTXO networks - use currency shortcut (e.g., "btc" -> "BTC") + if (currency) { + networkPrefix = currency.toUpperCase(); + } else { + // Fallback to first word from label if no currency + const firstWord = label.split(' ')[0]; + networkPrefix = + firstWord.length > 6 ? firstWord.substring(0, 6) : firstWord; + } + } + } else { + // EVM networks (all use slip44=60) + if (chainId === 1) { + networkPrefix = 'ETH'; // Ethereum Mainnet + } else if (chainId === 11155111) { + networkPrefix = 'ETH-T'; // Ethereum Sepolia Testnet + } else if (chainId === 137) { + networkPrefix = 'POLY'; // Polygon Mainnet + } else if (chainId === 80001) { + networkPrefix = 'POLY-T'; // Polygon Mumbai Testnet + } else if (chainId === 57) { + networkPrefix = 'NEVM'; // Syscoin NEVM Mainnet + } else if (chainId === 5700) { + networkPrefix = 'NEVM-T'; // Syscoin NEVM Testnet + } else if (chainId === 570) { + networkPrefix = 'ROLLUX'; // Rollux Mainnet + } else if (chainId === 57000) { + networkPrefix = 'ROLLUX-T'; // Rollux Testnet + } else { + // Other EVM networks - use currency shortcut if available + if (currency) { + // Check if it's a testnet network + if ( + label.toLowerCase().includes('testnet') || + label.toLowerCase().includes('test') + ) { + networkPrefix = `${currency.toUpperCase()}-T`; + } else { + networkPrefix = currency.toUpperCase(); + } + } else { + // Fallback to extracting meaningful prefix from label + const firstWord = label.split(' ')[0]; + if ( + firstWord.toLowerCase().includes('testnet') || + firstWord.toLowerCase().includes('test') + ) { + const baseWord = label.split(' ')[0]; + networkPrefix = `${baseWord.substring(0, 4).toUpperCase()}-T`; + } else { + networkPrefix = + firstWord.length > 6 + ? firstWord.substring(0, 6).toUpperCase() + : firstWord.toUpperCase(); + } + } + } + } + + return `${networkPrefix} ${accountId + 1}`; + } + + /** + * Clean up all resources + */ + public async destroy(): Promise { + await this.lockWallet(); + + // Clear any remaining references + this.ethereumTransaction = {} as EthereumTransactions; + this.syscoinTransaction = {} as ISyscoinTransactions; + } +} diff --git a/packages/sysweb3-keyring/src/keyring-manager.ts b/packages/sysweb3-keyring/src/keyring-manager.ts index 459aa935..3bbc0034 100644 --- a/packages/sysweb3-keyring/src/keyring-manager.ts +++ b/packages/sysweb3-keyring/src/keyring-manager.ts @@ -1,2287 +1,67 @@ -import ecc from '@bitcoinerlab/secp256k1'; -import { BIP32Factory } from 'bip32'; -import { generateMnemonic, validateMnemonic } from 'bip39'; -import BIP84 from 'bip84'; -import * as bjs from 'bitcoinjs-lib'; -import bs58check from 'bs58check'; -import crypto from 'crypto'; -import CryptoJS from 'crypto-js'; -import { ethers } from 'ethers'; -import mapValues from 'lodash/mapValues'; -import omit from 'lodash/omit'; -import * as syscoinjs from 'syscoinjs-lib'; +import * as sysweb3 from '@sidhujag/sysweb3-core'; -import { - initialActiveImportedAccountState, - initialActiveLedgerAccountState, - initialActiveTrezorAccountState, -} from './initial-state'; +import { HardwareWalletManager } from './hardware-wallet-manager'; +import { HardwareWalletManagerSingleton } from './hardware-wallet-manager-singleton'; +import { KeyringCore } from './keyring-core'; import { LedgerKeyring } from './ledger'; -import { getSyscoinSigners, SyscoinHDSigner } from './signers'; import { getDecryptedVault, setEncryptedVault } from './storage'; -import { EthereumTransactions, SyscoinTransactions } from './transactions'; -import { TrezorKeyring } from './trezor'; import { - IKeyringAccountState, - ISyscoinTransactions, - KeyringAccountType, - IEthereumTransactions, - IKeyringManager, -} from './types'; -import { getAddressDerivationPath, isEvmCoin } from './utils/derivation-paths'; -import * as sysweb3 from '@pollum-io/sysweb3-core'; -import { - INetwork, - INetworkType, - getNetworkConfig, -} from '@pollum-io/sysweb3-network'; - -export interface ISysAccount { - address: string; - label?: string; - xprv?: string; - xpub: string; -} - -// Dynamic ETH HD path generation - will be computed as needed - -/** - * Secure Buffer implementation for sensitive data - * Provides explicit memory clearing capability - */ -class SecureBuffer { - private buffer: Buffer | null; - private _isCleared = false; - - constructor(data: string | Buffer) { - if (typeof data === 'string') { - this.buffer = Buffer.from(data, 'utf8'); - } else { - this.buffer = Buffer.from(data); - } - } - - get(): Buffer { - if (this._isCleared || !this.buffer) { - throw new Error('SecureBuffer has been cleared'); - } - return Buffer.from(this.buffer); // Return copy - } - - toString(): string { - if (this._isCleared || !this.buffer) { - throw new Error('SecureBuffer has been cleared'); - } - return this.buffer.toString('utf8'); - } - - clear(): void { - if (!this._isCleared && this.buffer) { - // Overwrite with random data first - crypto.randomFillSync(this.buffer); - // Then fill with zeros - this.buffer.fill(0); - this.buffer = null; - this._isCleared = true; - } - } - - isCleared(): boolean { - return this._isCleared; - } -} - -export class KeyringManager implements IKeyringManager { - public trezorSigner: TrezorKeyring; - public ledgerSigner: LedgerKeyring; - // NOTE: activeChain removed - now derived from vault.activeNetwork.kind - public initialTrezorAccountState: IKeyringAccountState; - public initialLedgerAccountState: IKeyringAccountState; - public utf8Error: boolean; - //transactions objects - public ethereumTransaction: IEthereumTransactions; - public syscoinTransaction: ISyscoinTransactions; - private storage: any; // Should be IKeyValueDb but import issue - provides deleteItem(), get(), set(), setClient(), setPrefix() + createLedgerPsbtSigner, + createTrezorPsbtSigner, +} from './transactions/hardware-psbt'; +import { TrezorKeyring } from './trezor'; - // Store getter function for accessing Redux state - private getVaultState: (() => any) | null = null; +import type { IKeyringManager } from './types'; +import type { LedgerHost } from './ledger/host-types'; - // Method to inject store getter from Pali side - public setVaultStateGetter = (getter: () => any) => { - this.getVaultState = getter; - }; +export type { ISysAccount } from './keyring-core'; - // Helper method to get current vault state - private getVault = () => { - if (!this.getVaultState) { - throw new Error( - 'Vault state getter not configured. Call setVaultStateGetter() first.' - ); - } +const legacyAuthority = Object.freeze({}); +const legacyVaultPersistence = { getDecryptedVault, setEncryptedVault }; - const vault = this.getVaultState(); - - // DEFENSIVE CHECK: Ensure vault state is properly structured - if (!vault) { - throw new Error( - 'Vault state is undefined. Ensure Redux store is properly initialized with vault state.' - ); - } - - if (!vault.activeNetwork) { - throw new Error( - 'Vault state is missing activeNetwork. Ensure vault state is properly initialized before keyring operations.' - ); - } - - if (!vault.activeAccount) { +/** Existing browser entry. Native/software hosts must use the software entry. */ +export class KeyringManager + extends KeyringCore + implements IKeyringManager +{ + constructor( + sharedHardwareWalletManager?: HardwareWalletManager, + ledgerHost?: LedgerHost + ) { + if (sharedHardwareWalletManager && ledgerHost) { throw new Error( - 'Vault state is missing activeAccount. Ensure vault state is properly initialized before keyring operations.' - ); - } - - return vault; - }; - - // Helper to get active chain from vault state (replaces this.activeChain) - private getActiveChain = (): INetworkType => { - return this.getVault().activeNetwork.kind; - }; - - // Secure session data - using Buffers that can be explicitly cleared - private sessionPassword: SecureBuffer | null = null; - private sessionMnemonic: SecureBuffer | null = null; // can be a mnemonic or a zprv, can be changed to a zprv when using an imported wallet - - constructor() { - this.storage = sysweb3.sysweb3Di.getStateStorageDb(); - // Don't initialize secure buffers in constructor - they're created on unlock - this.storage.set('utf8Error', { - hasUtf8Error: false, + 'Supply a shared hardware manager or a Ledger host, not both' + ); + } + const storage = sysweb3.sysweb3Di.getStateStorageDb(); + const hardwareManager = + sharedHardwareWalletManager || + (ledgerHost + ? new HardwareWalletManager(ledgerHost) + : HardwareWalletManagerSingleton.getInstance()); + const trezorSigner = new TrezorKeyring(); + const ledgerSigner = new LedgerKeyring(hardwareManager, ledgerHost); + super({ + authority: legacyAuthority, + storage, + vaultPersistence: legacyVaultPersistence, + ledgerSigner, + trezorSigner, + syscoinHardwareSigners: { + ledger: createLedgerPsbtSigner(ledgerSigner), + trezor: createTrezorPsbtSigner(trezorSigner), + }, }); - - // NOTE: activeChain is now derived from vault state, not stored locally - // NOTE: No more persistent signers - use getSigner() for fresh on-demand signers - - this.utf8Error = false; - // sessionMnemonic is initialized as null - created on unlock - this.initialTrezorAccountState = initialActiveTrezorAccountState; - this.initialLedgerAccountState = initialActiveLedgerAccountState; - this.trezorSigner = new TrezorKeyring(this.getSigner); - this.ledgerSigner = new LedgerKeyring(); - - // this.syscoinTransaction = SyscoinTransactions(); - this.syscoinTransaction = new SyscoinTransactions( - this.getSigner, - this.getReadOnlySigner, - this.getAccountsState, - this.getAddress, - this.ledgerSigner, - this.trezorSigner - ); - this.ethereumTransaction = new EthereumTransactions( - this.getNetwork, - this.getDecryptedPrivateKey, - this.getAccountsState, - this.ledgerSigner, - this.trezorSigner - ); } - // Static factory method for creating a fully initialized KeyringManager with slip44 support public static async createInitialized( seed: string, password: string, vaultStateGetter: () => any ): Promise { - const keyringManager = new KeyringManager(); - - // Set the vault state getter - keyringManager.setVaultStateGetter(vaultStateGetter); - - // Use the new secure initialization method (eliminates temporary plaintext storage) - await keyringManager.initializeWalletSecurely(seed, password); - - // NOTE: Active account management is now handled by vault state/Redux - // No need to explicitly set active account - it's managed externally - - return keyringManager; - } - - // Convenience method for complete setup after construction - public async initialize( - seed: string, - password: string, - network?: INetwork - ): Promise { - // Set the network if provided (this is crucial for proper address derivation) - if (network) { - await this.setSignerNetwork(network); - } - - // Use the new secure initialization method (eliminates temporary plaintext storage) - const account = await this.initializeWalletSecurely(seed, password); - - // NOTE: Active account management is now handled by vault state/Redux - // No need to explicitly set active account - it's managed externally - - return account; - } - - // ===================================== PUBLIC METHODS - KEYRING MANAGER FOR HD - SYS ALL ===================================== // - - public setStorage = (client: any) => this.storage.setClient(client); - - public validateAccountType = (account: IKeyringAccountState) => { - return account.isImported === true - ? KeyringAccountType.Imported - : KeyringAccountType.HDAccount; - }; - - public isUnlocked = () => - !!this.sessionPassword && !this.sessionPassword.isCleared(); - - public lockWallet = () => { - // Clear secure session data - if (this.sessionPassword) { - this.sessionPassword.clear(); - this.sessionPassword = null; - } - if (this.sessionMnemonic) { - this.sessionMnemonic.clear(); - this.sessionMnemonic = null; - } - - // Clean up hardware wallet connections - if (this.ledgerSigner) { - this.ledgerSigner.destroy().catch((error) => { - console.error('Error destroying Ledger connection:', error); - }); - } - if (this.trezorSigner) { - this.trezorSigner.destroy().catch((error) => { - console.error('Error destroying Trezor connection:', error); - }); - } - }; - - // Direct secure transfer of session data to another keyring - public transferSessionTo = (targetKeyring: IKeyringManager): void => { - if (!this.isUnlocked()) { - throw new Error('Source keyring must be unlocked to transfer session'); - } - - // Cast to access the receiveSessionOwnership method - const targetKeyringImpl = targetKeyring as unknown as KeyringManager; - - // Transfer ownership of our buffers to the target - if (!this.sessionPassword || !this.sessionMnemonic) { - throw new Error('Session data is missing during transfer'); - } - - targetKeyringImpl.receiveSessionOwnership( - this.sessionPassword, - this.sessionMnemonic - ); - - // Null out our references (do NOT clear buffers - target owns them now) - this.sessionPassword = null; - this.sessionMnemonic = null; - }; - - // Private method for zero-copy transfer - takes ownership of buffers - public receiveSessionOwnership = ( - sessionPassword: SecureBuffer, - sessionMnemonic: SecureBuffer - ): void => { - // Clear any existing data first - if (this.sessionPassword) { - this.sessionPassword.clear(); - } - if (this.sessionMnemonic) { - this.sessionMnemonic.clear(); - } - - // Take ownership of the actual SecureBuffer objects - // No copying - these are the original objects - this.sessionPassword = sessionPassword; - this.sessionMnemonic = sessionMnemonic; - }; - - public addNewAccount = async ( - label?: string - ): Promise => { - // Check if wallet is unlocked - if (!this.isUnlocked()) { - throw new Error('Wallet must be unlocked to add new accounts'); - } - - // addNewAccount should only create accounts from the main seed - // For importing accounts (including zprvs), use importAccount - if (this.getActiveChain() === INetworkType.Syscoin) { - return await this.addNewAccountToSyscoinChain(label); - } else { - // EVM chainType - return await this.addNewAccountToEth(label); - } - }; - - public async unlock(password: string): Promise<{ - canLogin: boolean; - needsAccountCreation?: boolean; - }> { - try { - const vaultKeys = await this.storage.get('vault-keys'); - - if (!vaultKeys) { - return { - canLogin: false, - }; - } - // FIRST: Validate password against stored hash - const { hash, salt } = vaultKeys; - const saltedHashPassword = this.encryptSHA512(password, salt); - - if (saltedHashPassword !== hash) { - // Password is wrong - return immediately - return { - canLogin: false, - }; - } - // Handle migration from old vault format with currentSessionSalt - if (vaultKeys.currentSessionSalt) { - console.log( - '[KeyringManager] Detected old vault format, handling session migration...' - ); - - // The old format used currentSessionSalt for session data encryption - // We need to use it temporarily to decrypt the mnemonic correctly - const oldSessionPassword = this.encryptSHA512( - password, - vaultKeys.currentSessionSalt - ); - - // Get the vault and check if mnemonic needs migration - const { mnemonic } = await getDecryptedVault(password); - - if (mnemonic) { - // Check if mnemonic is double-encrypted (old format behavior) - const isLikelyPlainMnemonic = - mnemonic.includes(' ') && - (mnemonic.split(' ').length === 12 || - mnemonic.split(' ').length === 24); - - let decryptedMnemonic = mnemonic; - if (!isLikelyPlainMnemonic) { - try { - // Try to decrypt with raw password first (as vault stores it) - decryptedMnemonic = CryptoJS.AES.decrypt( - mnemonic, - password - ).toString(CryptoJS.enc.Utf8); - } catch (e) { - console.warn( - '[KeyringManager] Failed to decrypt mnemonic with password, trying old session password' - ); - // If that fails, try with old session password - try { - decryptedMnemonic = CryptoJS.AES.decrypt( - mnemonic, - oldSessionPassword - ).toString(CryptoJS.enc.Utf8); - } catch (e2) { - // If both fail, assume it's already decrypted - decryptedMnemonic = mnemonic; - } - } - } - - // Re-save the vault with properly formatted mnemonic (single encryption) - await setEncryptedVault({ mnemonic: decryptedMnemonic }, password); - console.log('[KeyringManager] Vault mnemonic format normalized'); - } - - // Remove currentSessionSalt from vault-keys - const migratedVaultKeys = { - hash: vaultKeys.hash, - salt: vaultKeys.salt, - }; - await this.storage.set('vault-keys', migratedVaultKeys); - console.log('[KeyringManager] Old vault format migration completed'); - } - - // If session data missing or corrupted, recreate from vault - if (!this.sessionMnemonic) { - await this.recreateSessionFromVault(password, saltedHashPassword); - } - - // NOTE: Active account management is now handled by vault state/Redux - // No need to explicitly set active account after unlock - it's managed externally - const vault = this.getVault(); - if (vault.activeAccount?.id !== undefined && vault.activeAccount?.type) { - // Check if the active account actually exists in the accounts map - const accountType = vault.activeAccount.type; - const accountId = vault.activeAccount.id; - const accountExists = vault.accounts?.[accountType]?.[accountId]; - - if (!accountExists) { - console.log( - `[KeyringManager] Active account ${accountType}:${accountId} not found in accounts map. This may indicate a migration from old vault format.` - ); - // Signal that accounts need to be created after migration - return { - canLogin: true, - needsAccountCreation: true, - }; - } - - console.log( - `[KeyringManager] Active account ${vault.activeAccount.id} available after unlock` - ); - } - - return { - canLogin: true, - }; - } catch (error) { - console.log('ERROR unlock', { - error, - }); - return { - canLogin: false, - }; - } - } - - public getNewChangeAddress = async (): Promise => { - const vault = this.getVault(); - const { accounts, activeAccount } = vault; - const account = accounts[activeAccount.type]?.[activeAccount.id]; - if (!account) { - throw new Error('Active account not found'); - } - const { xpub } = account; - return await this.getAddress(xpub, true); // Don't skip increment - get next unused - }; - - public getChangeAddress = async (id: number): Promise => { - const vault = this.getVault(); - const { accounts, activeAccount } = vault; - const account = accounts[activeAccount.type]?.[id]; - if (!account) { - throw new Error(`Account with id ${id} not found`); - } - const { xpub } = account; - - return await this.getAddress(xpub, true); - }; - - public getPubkey = async ( - id: number, - isChangeAddress: boolean - ): Promise => { - const vault = this.getVault(); - const { accounts, activeAccount } = vault; - const account = accounts[activeAccount.type]?.[id]; - if (!account) { - throw new Error(`Account with id ${id} not found`); - } - const { xpub } = account; - - return await this.getCurrentAddressPubkey(xpub, isChangeAddress); - }; - - public getBip32Path = async ( - id: number, - isChangeAddress: boolean - ): Promise => { - const vault = this.getVault(); - const { accounts, activeAccount } = vault; - const account = accounts[activeAccount.type]?.[id]; - if (!account) { - throw new Error(`Account with id ${id} not found`); - } - const { xpub } = account; - - return await this.getCurrentAddressBip32Path(xpub, isChangeAddress); - }; - - public updateReceivingAddress = async (): Promise => { - const vault = this.getVault(); - const { accounts, activeAccount } = vault; - const account = accounts[activeAccount.type]?.[activeAccount.id]; - if (!account) { - throw new Error('Active account not found'); - } - const { xpub } = account; - - const address = await this.getAddress(xpub, false); - // NOTE: Address updates should be dispatched to Redux store, not updated here - // The calling code should handle the Redux dispatch - return address; - }; - - public getAccountById = ( - id: number, - accountType: KeyringAccountType - ): Omit => { - const vault = this.getVault(); - const accounts = vault.accounts[accountType]; - - const account = accounts[id]; - - if (!account) { - throw new Error('Account not found'); - } - - return omit(account as IKeyringAccountState, 'xprv'); - }; - - public getPrivateKeyByAccountId = async ( - id: number, - accountType: KeyringAccountType, - pwd: string - ): Promise => { - try { - // Validate password using vault salt (same pattern as getSeed) - if (!this.sessionPassword) { - throw new Error('Unlock wallet first'); - } - - // Get vault salt for password validation - const vaultKeys = await this.storage.get('vault-keys'); - if (!vaultKeys || !vaultKeys.salt) { - throw new Error('Vault keys not found'); - } - - const genPwd = this.encryptSHA512(pwd, vaultKeys.salt); - if (this.getSessionPasswordString() !== genPwd) { - throw new Error('Invalid password'); - } - - const vault = this.getVault(); - const account = vault.accounts[accountType][id]; - if (!account) { - throw new Error('Account not found'); - } - - // Decrypt the stored private key (works for both HD and imported accounts) - const decryptedPrivateKey = CryptoJS.AES.decrypt( - (account as IKeyringAccountState).xprv, - this.getSessionPasswordString() - ).toString(CryptoJS.enc.Utf8); - - if (!decryptedPrivateKey) { - throw new Error( - 'Failed to decrypt private key. Invalid password or corrupted data.' - ); - } - - return decryptedPrivateKey; - } catch (error) { - console.log('ERROR getPrivateKeyByAccountId', { - error, - }); - this.validateAndHandleErrorByMessage(error.message); - throw error; - } - }; - - public getActiveAccount = (): { - activeAccount: Omit; - activeAccountType: KeyringAccountType; - } => { - const vault = this.getVault(); - const { accounts, activeAccount } = vault; - const activeAccountId = activeAccount.id; - const activeAccountType = activeAccount.type; - - return { - activeAccount: omit( - accounts[activeAccountType][activeAccountId] as IKeyringAccountState, - 'xprv' - ), - activeAccountType, - }; - }; - - public getEncryptedXprv = (hd: SyscoinHDSigner) => { - return CryptoJS.AES.encrypt( - this.getSysActivePrivateKey(hd), - this.getSessionPasswordString() - ).toString(); - }; - - public getSeed = async (pwd: string) => { - if (!this.sessionPassword) { - throw new Error('Unlock wallet first'); - } - - // Get vault salt for password validation (consistent with getPrivateKeyByAccountId) - const vaultKeys = await this.storage.get('vault-keys'); - if (!vaultKeys || !vaultKeys.salt) { - throw new Error('Vault keys not found'); - } - - const genPwd = this.encryptSHA512(pwd, vaultKeys.salt); - if (this.getSessionPasswordString() !== genPwd) { - throw new Error('Invalid password'); - } - let { mnemonic } = await getDecryptedVault(pwd); - - if (!mnemonic) { - throw new Error('Mnemonic not found in vault or is empty'); - } - - // Try to detect if mnemonic is encrypted or plain text - const isLikelyPlainMnemonic = - mnemonic.includes(' ') && - (mnemonic.split(' ').length === 12 || mnemonic.split(' ').length === 24); - - if (!isLikelyPlainMnemonic) { - try { - mnemonic = CryptoJS.AES.decrypt(mnemonic, pwd).toString( - CryptoJS.enc.Utf8 - ); - } catch (decryptError) { - // If decryption fails, assume mnemonic is already decrypted - console.warn( - 'Mnemonic decryption failed in getSeed, using as-is:', - decryptError.message - ); - } - } - - if (!mnemonic) { - throw new Error( - 'Failed to decrypt mnemonic or mnemonic is empty after decryption' - ); - } - - return mnemonic; - }; - - public setSignerNetwork = async ( - network: INetwork - ): Promise<{ - activeChain?: INetworkType; - success: boolean; - }> => { - // With multi-keyring architecture, each keyring is dedicated to specific slip44 - if ( - INetworkType.Ethereum !== network.kind && - INetworkType.Syscoin !== network.kind - ) { - throw new Error('Unsupported chain'); - } - - // Validate network/chain type compatibility - if ( - network.kind === INetworkType.Ethereum && - this.getActiveChain() === INetworkType.Syscoin - ) { - throw new Error('Cannot use Ethereum chain type with Syscoin network'); - } - if ( - network.kind === INetworkType.Syscoin && - this.getActiveChain() === INetworkType.Ethereum - ) { - throw new Error('Cannot use Syscoin chain type with Ethereum network'); - } - - // CRITICAL: Prevent UTXO-to-UTXO network switching within same keyring - // Each UTXO network should have its own KeyringManager instance based on slip44 - const vault = this.getVault(); - if (this.getActiveChain() === INetworkType.Syscoin && vault.activeNetwork) { - const currentSlip44 = vault.activeNetwork.slip44; - const newSlip44 = network.slip44; - - if (currentSlip44 !== newSlip44) { - throw new Error( - `Cannot switch between different UTXO networks within the same keyring. ` + - `Current network uses slip44=${currentSlip44}, target network uses slip44=${newSlip44}. ` + - `Each UTXO network requires a separate KeyringManager instance.` - ); - } - } - - try { - // With multi-keyring architecture: - // - UTXO: Each keyring is dedicated to one network (slip44), so this is only called during initialization - // - EVM: All EVM networks share slip44=60, so network can change within the same keyring - - if (network.kind === INetworkType.Syscoin) { - // For UTXO networks: validate that active account exists (accounts should be created via addNewAccount/initialize) - const accountId = vault.activeAccount.id || 0; - const accountType = - vault.activeAccount.type || KeyringAccountType.HDAccount; - const accounts = vault.accounts[accountType]; - - if (!accounts[accountId] || !accounts[accountId].xpub) { - throw new Error( - `Active account ${accountType}:${accountId} does not exist. Create accounts using addNewAccount() or initializeWalletSecurely() first.` - ); - } - - // No additional setup needed - on-demand signers will be created when needed - } else if (network.kind === INetworkType.Ethereum) { - // For EVM networks: validate that active account exists - const accountId = vault.activeAccount.id || 0; - const accountType = - vault.activeAccount.type || KeyringAccountType.HDAccount; - const accounts = vault.accounts[accountType]; - - if (!accounts[accountId] || !accounts[accountId].xpub) { - throw new Error( - `Active account ${accountType}:${accountId} does not exist. Create accounts using addNewAccount() or initializeWalletSecurely() first.` - ); - } - - // Set up EVM provider for network switching - await this.setSignerEVM(network); - } - - return { - success: true, - }; - } catch (err) { - console.log('ERROR setSignerNetwork', { - err, - }); - - this.validateAndHandleErrorByMessage(err.message); - - //Rollback to previous values - console.error('Set Signer Network failed with', err); - return { success: false }; - } - }; - - public forgetMainWallet = async (pwd: string) => { - const vaultKeys = await this.storage.get('vault-keys'); - if (!vaultKeys || !vaultKeys.salt) { - throw new Error('Vault keys not found'); - } - const genPwd = this.encryptSHA512(pwd, vaultKeys.salt); - if (!this.sessionPassword) { - throw new Error('Unlock wallet first'); - } else if (this.getSessionPasswordString() !== genPwd) { - throw new Error('Invalid password'); - } - - await this.clearTemporaryLocalKeys(pwd); - }; - - public importWeb3Account = (mnemonicOrPrivKey: string) => { - // Check if it's a hex string (Ethereum private key) - if (ethers.utils.isHexString(mnemonicOrPrivKey)) { - return new ethers.Wallet(mnemonicOrPrivKey); - } - - // Check if it's a zprv/tprv (Syscoin private key) - const zprvPrefixes = ['zprv', 'tprv', 'vprv', 'xprv']; - if (zprvPrefixes.some((prefix) => mnemonicOrPrivKey.startsWith(prefix))) { - throw new Error( - 'Syscoin extended private keys (zprv/tprv) should be imported using importAccount, not importWeb3Account' - ); - } - - // Otherwise, assume it's a mnemonic - const account = ethers.Wallet.fromMnemonic(mnemonicOrPrivKey); - - return account; - }; - - public getAccountXpub = (): string => { - const vault = this.getVault(); - const { activeAccount } = vault; - const account = vault.accounts[activeAccount.type]?.[activeAccount.id]; - if (!account) { - throw new Error('Active account not found'); - } - return account.xpub; - }; - - public isSeedValid = (seedPhrase: string) => validateMnemonic(seedPhrase); - - public createNewSeed = () => generateMnemonic(); - - public getUTXOState = () => { - const vault = this.getVault(); - if (vault.activeNetwork.kind !== INetworkType.Syscoin) { - throw new Error('Cannot get state in a ethereum network'); - } - - const utxOAccounts = mapValues(vault.accounts.HDAccount, (value) => - omit(value, 'xprv') - ); - - return { - ...vault, - accounts: { - [KeyringAccountType.HDAccount]: utxOAccounts, - [KeyringAccountType.Imported]: {}, - [KeyringAccountType.Trezor]: {}, - [KeyringAccountType.Ledger]: {}, - }, - }; - }; - - public async importTrezorAccount(label?: string) { - const vault = this.getVault(); - const currency = vault.activeNetwork.currency; - if (!currency) { - throw new Error('Active network currency is not defined'); - } - - // Use getNextAccountId to filter out placeholder accounts - const nextIndex = this.getNextAccountId( - vault.accounts[KeyringAccountType.Trezor] - ); - - const importedAccount = await this._createTrezorAccount( - currency, - vault.activeNetwork.slip44, - nextIndex - ); - importedAccount.label = label ? label : `Trezor ${importedAccount.id + 1}`; - - // NOTE: Account creation should be dispatched to Redux store, not updated here - // The calling code should handle the Redux dispatch - // Return the created account for Pali to add to store - return importedAccount; - } - - public async importLedgerAccount(label?: string) { - try { - const vault = this.getVault(); - const currency = vault.activeNetwork.currency; - if (!currency) { - throw new Error('Active network currency is not defined'); - } - - // Use getNextAccountId to filter out placeholder accounts - const nextIndex = this.getNextAccountId( - vault.accounts[KeyringAccountType.Ledger] - ); - - const importedAccount = await this._createLedgerAccount( - currency, - vault.activeNetwork.slip44, - nextIndex - ); - importedAccount.label = label - ? label - : `Ledger ${importedAccount.id + 1}`; - - // NOTE: Account creation should be dispatched to Redux store, not updated here - // The calling code should handle the Redux dispatch - // Return the created account for Pali to add to store - return importedAccount; - } catch (error) { - console.log({ error }); - throw error; - } - } - - public getActiveUTXOAccountState = () => { - const vault = this.getVault(); - const { activeAccount } = vault; - return { - ...vault.accounts.HDAccount[activeAccount.id], - xprv: undefined, - }; - }; - - public getNetwork = () => this.getVault().activeNetwork; - - public createEthAccount = (privateKey: string) => - new ethers.Wallet(privateKey); - - // Helper to get current account data from backend - private fetchCurrentAccountData = async ( - xpub: string, - isChangeAddress: boolean - ) => { - const vault = this.getVault(); - const { activeNetwork } = vault; - - // Use read-only signer for backend calls - works for all account types including hardware wallets - const { main } = this.getReadOnlySigner(); - const options = 'tokens=used&details=tokens'; - - const { tokens } = await syscoinjs.utils.fetchBackendAccount( - main.blockbookURL, - xpub, - options, - true, - undefined - ); - - const { receivingIndex, changeIndex } = - this.setLatestIndexesFromXPubTokens(tokens); - - // Get network configuration for BIP84 - const networkConfig = getNetworkConfig( - activeNetwork.slip44, - activeNetwork.currency - ); - - // BIP84 needs pubTypes and networks config - // For read-only operations, we construct these from networkConfig - const pubTypes = networkConfig?.types?.zPubType || { - mainnet: { zprv: 0x04b2430c, zpub: 0x04b24746 }, - testnet: { vprv: 0x045f18bc, vpub: 0x045f1cf6 }, - }; - const networks = networkConfig?.networks || { - mainnet: {}, - testnet: {}, - }; - - const currentAccount = new BIP84.fromZPub(xpub, pubTypes, networks); - - const addressIndex = isChangeAddress ? changeIndex : receivingIndex; - - return { - currentAccount, - addressIndex, - main, - }; - }; - - public getAddress = async (xpub: string, isChangeAddress: boolean) => { - const { currentAccount, addressIndex } = await this.fetchCurrentAccountData( - xpub, - isChangeAddress - ); - - const address = currentAccount.getAddress( - addressIndex, - isChangeAddress, - 84 - ) as string; - - return address; - }; - - public getCurrentAddressPubkey = async ( - xpub: string, - isChangeAddress: boolean - ): Promise => { - const { currentAccount, addressIndex } = await this.fetchCurrentAccountData( - xpub, - isChangeAddress - ); - - // BIP84 returns the public key as a hex string directly - return currentAccount.getPublicKey(addressIndex, isChangeAddress); - }; - - public getCurrentAddressBip32Path = async ( - xpub: string, - isChangeAddress: boolean - ): Promise => { - const vault = this.getVault(); - const { activeAccount, activeNetwork } = vault; - - const { addressIndex } = await this.fetchCurrentAccountData( - xpub, - isChangeAddress - ); - - // Use the utility function to generate the proper derivation path - const coinShortcut = activeNetwork.currency.toLowerCase(); // e.g., 'sys', 'btc' - const path = getAddressDerivationPath( - coinShortcut, - activeNetwork.slip44, - activeAccount.id, - isChangeAddress, - addressIndex - ); - - return path; - }; - - public logout = () => { - this.lockWallet(); - }; - - public async importAccount(privKey: string, label?: string) { - // Check if wallet is unlocked - if (!this.isUnlocked()) { - throw new Error('Wallet must be unlocked to import accounts'); - } - - const importedAccount = await this._getPrivateKeyAccountInfos( - privKey, - label - ); - - // NOTE: Account creation should be dispatched to Redux store, not updated here - // The calling code should handle the Redux dispatch - // Return the created account for Pali to add to store - return importedAccount; - } - - public validateZprv(zprv: string, targetNetwork?: INetwork) { - // Use the active network if targetNetwork is not provided - const networkToValidateAgainst = - targetNetwork || this.getVault().activeNetwork; - - if (!networkToValidateAgainst) { - throw new Error('No network available for validation'); - } - - try { - // Check if it looks like an extended key based on known prefixes - const knownExtendedKeyPrefixes = [ - 'xprv', - 'xpub', - 'yprv', - 'ypub', - 'zprv', - 'zpub', - 'tprv', - 'tpub', - 'uprv', - 'upub', - 'vprv', - 'vpub', - ]; - const prefix = zprv.substring(0, 4); - const looksLikeExtendedKey = knownExtendedKeyPrefixes.includes(prefix); - - // Only check prefix validity if it looks like an extended key - if (looksLikeExtendedKey) { - const validBip84Prefixes = ['zprv', 'vprv']; // zprv for mainnet, vprv for testnet - if (!validBip84Prefixes.includes(prefix)) { - throw new Error( - `Invalid key prefix '${prefix}'. Only BIP84 keys (zprv/vprv) are supported for UTXO imports. BIP44 keys (xprv/tprv) are not supported.` - ); - } - } else { - // Not an extended key format - throw new Error('Not an extended private key'); - } - - const bip32 = BIP32Factory(ecc); - const decoded = bs58check.decode(zprv); - - if (decoded.length !== 78) { - throw new Error('Invalid length for a BIP-32 key'); - } - - // Get network configuration for the target network - const { networks, types } = getNetworkConfig( - networkToValidateAgainst.slip44, - networkToValidateAgainst.currency || 'Bitcoin' - ); - - // For BIP84 (zprv/zpub), we need to use the correct magic bytes from zPubType - // Determine key type: zprv = mainnet key, vprv = testnet key - const keyIsTestnet = prefix === 'vprv'; - - // Determine target network type: testnet networks typically have chainId 5700+ or slip44 1 - const targetIsTestnet = - networkToValidateAgainst.chainId >= 5700 || - networkToValidateAgainst.slip44 === 1; - - // Cross-network validation: reject if key type doesn't match target network - if (keyIsTestnet && !targetIsTestnet) { - throw new Error( - `Extended private key is not compatible with ${networkToValidateAgainst.label}. ` + - `This appears to be a testnet key (${prefix}) but the target network is mainnet.` - ); - } - - if (!keyIsTestnet && targetIsTestnet) { - throw new Error( - `Extended private key is not compatible with ${networkToValidateAgainst.label}. ` + - `This appears to be a mainnet key (${prefix}) but the target network is testnet.` - ); - } - - const pubTypes = keyIsTestnet - ? (types.zPubType as any).testnet - : types.zPubType.mainnet; - const baseNetwork = keyIsTestnet ? networks.testnet : networks.mainnet; - - const network = { - ...baseNetwork, - bip32: { - public: parseInt(pubTypes.vpub || pubTypes.zpub, 16), - private: parseInt(pubTypes.vprv || pubTypes.zprv, 16), - }, - }; - - // Validate that the key prefix matches the expected network format - // This ensures the key was generated for a compatible network - const expectedPrefixes = ['zprv', 'vprv', 'xprv', 'yprv']; // Accept various BIP32/84 formats - if (!expectedPrefixes.includes(prefix)) { - throw new Error( - `Invalid extended private key prefix: ${prefix}. Expected one of: ${expectedPrefixes.join( - ', ' - )}` - ); - } - - // Strict network matching - only allow keys that match the target network - let node; - try { - node = bip32.fromBase58(zprv, network); - } catch (e) { - throw new Error( - `Extended private key is not compatible with ${networkToValidateAgainst.label}. Please use a key generated for this specific network.` - ); - } - - if (!node.privateKey) { - throw new Error('Private key not found in extended private key'); - } - if (!ecc.isPrivate(node.privateKey)) { - throw new Error('Invalid private key for secp256k1 curve'); - } - - return { - isValid: true, - node, - network, - message: 'The extended private key is valid for this network.', - }; - } catch (error) { - return { isValid: false, message: error.message }; - } - } - - /** - * PRIVATE METHODS - */ - - // ===================================== AUXILIARY METHOD - FOR TRANSACTIONS CLASSES ===================================== // - private getDecryptedPrivateKey = (): { - address: string; - decryptedPrivateKey: string; - } => { - try { - const vault = this.getVault(); - const { accounts, activeAccount } = vault; - const activeAccountId = activeAccount.id; - const activeAccountType = activeAccount.type; - if (!this.sessionPassword) - throw new Error('Wallet is locked cant proceed with transaction'); - - const activeAccountData = accounts[activeAccountType][activeAccountId]; - if (!activeAccountData) { - throw new Error( - `Active account (${activeAccountType}:${activeAccountId}) not found. Account switching may be in progress.` - ); - } - - const { xprv, address } = activeAccountData; - if (!xprv) { - throw new Error( - `Private key not found for account ${activeAccountType}:${activeAccountId}. Account may not be fully initialized.` - ); - } - - let decryptedPrivateKey: string; - try { - decryptedPrivateKey = CryptoJS.AES.decrypt( - xprv, - this.getSessionPasswordString() - ).toString(CryptoJS.enc.Utf8); - } catch (decryptError) { - throw new Error( - `Failed to decrypt private key for account ${activeAccountType}:${activeAccountId}. The wallet may be locked or corrupted.` - ); - } - - if (!decryptedPrivateKey) { - throw new Error( - `Decrypted private key is empty for account ${activeAccountType}:${activeAccountId}. Invalid password or corrupted data.` - ); - } - - // For EVM accounts, validate that the derived address matches the stored address - // This helps catch account switching race conditions early - if (this.getActiveChain() === INetworkType.Ethereum) { - try { - const derivedWallet = new ethers.Wallet(decryptedPrivateKey); - if (derivedWallet.address.toLowerCase() !== address.toLowerCase()) { - throw new Error( - `Address mismatch for account ${activeAccountType}:${activeAccountId}. Expected ${address} but derived ${derivedWallet.address}. Account switching may be in progress.` - ); - } - } catch (ethersError) { - throw new Error( - `Failed to validate EVM address for account ${activeAccountType}:${activeAccountId}: ${ethersError.message}` - ); - } - } - - return { - address, - decryptedPrivateKey, - }; - } catch (error) { - const vaultForLogging = this.getVault(); - console.error('ERROR getDecryptedPrivateKey', { - error: error.message, - activeChain: this.getActiveChain(), - vault: { - activeAccountId: vaultForLogging?.activeAccount?.id, - activeAccountType: vaultForLogging?.activeAccount?.type, - }, - }); - this.validateAndHandleErrorByMessage(error.message); - throw error; - } - }; - - private getSigner = (): { - hd: SyscoinHDSigner; - main: any; //TODO: Type this following syscoinJSLib interface - } => { - if (!this.sessionPassword) { - throw new Error('Wallet is locked cant proceed with transaction'); - } - if (this.getActiveChain() !== INetworkType.Syscoin) { - throw new Error('Switch to UTXO chain'); - } - - // Create fresh on-demand signer for active account (now synchronous!) - const freshHDSigner = this.createOnDemandSignerForActiveAccount(); - - // Create fresh syscoinjs instance with current network - const vault = this.getVault(); - const network = vault.activeNetwork; - const networkConfig = getNetworkConfig(network.slip44, network.currency); - - const syscoinMainSigner = new syscoinjs.SyscoinJSLib( - freshHDSigner, - network.url, - networkConfig?.networks?.mainnet || undefined - ); - - return { - hd: freshHDSigner, - main: syscoinMainSigner, - }; - }; - - // Read-only version that works when wallet is locked - private getReadOnlySigner = (): { - main: any; //TODO: Type this following syscoinJSLib interface - } => { - if (this.getActiveChain() !== INetworkType.Syscoin) { - throw new Error('Switch to UTXO chain'); - } - - // Create syscoinjs instance without HD signer for read-only operations - const vault = this.getVault(); - const network = vault.activeNetwork; - const networkConfig = getNetworkConfig(network.slip44, network.currency); - - const syscoinMainSigner = new syscoinjs.SyscoinJSLib( - null, // No HD signer needed for read-only operations - network.url, - networkConfig?.networks?.mainnet || undefined - ); - - return { - main: syscoinMainSigner, - }; - }; - - private validateAndHandleErrorByMessage(message: string) { - const utf8ErrorMessage = 'Malformed UTF-8 data'; - if ( - message.includes(utf8ErrorMessage) || - message.toLowerCase().includes(utf8ErrorMessage.toLowerCase()) - ) { - this.storage.set('utf8Error', { hasUtf8Error: true }); - } - } - - private getAccountsState = () => { - const vault = this.getVault(); - const { accounts, activeAccount, activeNetwork } = vault; - return { - activeAccountId: activeAccount.id, - accounts, - activeAccountType: activeAccount.type, - activeNetwork, - }; - }; - - /** - * - * @param password - * @param salt - * @returns hash: string - */ - private encryptSHA512 = (password: string, salt: string) => - crypto.createHmac('sha512', salt).update(password).digest('hex'); - - private getSysActivePrivateKey = (hd: SyscoinHDSigner) => { - if (hd === null) throw new Error('No HD Signer'); - - const accountIndex = hd.Signer.accountIndex; - - // Verify the account exists now - if (!hd.Signer.accounts.has(accountIndex)) { - throw new Error(`Account at index ${accountIndex} could not be created`); - } - - return hd.Signer.accounts.get(accountIndex).getAccountPrivateKey(); - }; - - private getInitialAccountData = ({ - label, - signer, - sysAccount, - xprv, - }: { - label?: string; - signer: any; - sysAccount: ISysAccount; - xprv: string; - }) => { - const { address, xpub } = sysAccount; - - return { - id: signer.Signer.accountIndex, - label: label || `Account ${signer.Signer.accountIndex + 1}`, - xpub, - xprv, - address, - isTrezorWallet: false, - isLedgerWallet: false, - isImported: false, - }; - }; - - private async _createTrezorAccount( - coin: string, - slip44: number, - index: number, - label?: string - ) { - const vault = this.getVault(); - const { accounts } = vault; - let xpub, balance; - - // For EVM networks, Trezor expects 'eth' regardless of the network's currency - const trezorCoin = slip44 === 60 ? 'eth' : coin; - - try { - const { descriptor, balance: _balance } = - await this.trezorSigner.getAccountInfo({ - coin: trezorCoin, - slip44, - index, - }); - xpub = descriptor; - balance = _balance; - } catch (e) { - throw new Error(e); - } - let ethPubKey = ''; - - const isEVM = isEvmCoin(coin, slip44); - - // For EVM networks, we need to get the actual address from Trezor - let address: string; - if (isEVM) { - // For EVM, the descriptor from getAccountInfo is the address - address = xpub; - - // Get the public key for EVM - const response = await this.trezorSigner.getPublicKey({ - coin: trezorCoin, - slip44, - index: +index, - }); - ethPubKey = response.publicKey; - } else { - // For UTXO, use the xpub to derive the address - address = await this.getAddress(xpub, false); - } - - const accountAlreadyExists = - Object.values( - accounts[KeyringAccountType.Ledger] as IKeyringAccountState[] - ).some((account) => account.address === address) || - Object.values( - accounts[KeyringAccountType.Trezor] as IKeyringAccountState[] - ).some((account) => account.address === address) || - Object.values( - accounts[KeyringAccountType.HDAccount] as IKeyringAccountState[] - ).some((account) => account.address === address) || - Object.values( - accounts[KeyringAccountType.Imported] as IKeyringAccountState[] - ).some((account) => account.address === address); - - if (accountAlreadyExists) - throw new Error('Account already exists on your Wallet.'); - if (!xpub || !address) - throw new Error( - 'Something wrong happened. Please, try again or report it' - ); - - // Use getNextAccountId to properly handle placeholder accounts - const id = this.getNextAccountId(accounts[KeyringAccountType.Trezor]); - - const trezorAccount = { - ...this.initialTrezorAccountState, - balances: { - syscoin: isEVM ? 0 : +balance / 1e8, - ethereum: 0, - }, - address, - label: label ? label : `Trezor ${id + 1}`, - id, - xprv: '', - xpub: isEVM ? ethPubKey : xpub, - assets: { - syscoin: [], - ethereum: [], - }, - } as IKeyringAccountState; - - return trezorAccount; - } - - private async _createLedgerAccount( - coin: string, - slip44: number, - index: number, - label?: string - ) { - const vault = this.getVault(); - const { accounts } = vault; - let xpub; - let address = ''; - if (isEvmCoin(coin, slip44)) { - const { address: ethAddress, publicKey } = - await this.ledgerSigner.evm.getEvmAddressAndPubKey({ - accountIndex: index, - }); - address = ethAddress; - xpub = publicKey; - } else { - try { - const ledgerXpub = await this.ledgerSigner.utxo.getXpub({ - index: index, - coin, - slip44, - }); - xpub = ledgerXpub; - // Use the generic getAddress method like Trezor does - no need to query device again - address = await this.getAddress(xpub, false); - } catch (e) { - throw new Error(e); - } - } - - const accountAlreadyExists = - Object.values( - accounts[KeyringAccountType.Ledger] as IKeyringAccountState[] - ).some((account) => account.address === address) || - Object.values( - accounts[KeyringAccountType.Trezor] as IKeyringAccountState[] - ).some((account) => account.address === address) || - Object.values( - accounts[KeyringAccountType.HDAccount] as IKeyringAccountState[] - ).some((account) => account.address === address) || - Object.values( - accounts[KeyringAccountType.Imported] as IKeyringAccountState[] - ).some((account) => account.address === address); - - if (accountAlreadyExists) - throw new Error('Account already exists on your Wallet.'); - if (!xpub || !address) - throw new Error( - 'Something wrong happened. Please, try again or report it' - ); - - // Use getNextAccountId to properly handle placeholder accounts - const id = this.getNextAccountId(accounts[KeyringAccountType.Ledger]); - - const currentBalances = { syscoin: 0, ethereum: 0 }; - - const ledgerAccount = { - ...this.initialLedgerAccountState, - balances: currentBalances, - address, - label: label ? label : `Ledger ${id + 1}`, - id, - xprv: '', - xpub, - assets: { - syscoin: [], - ethereum: [], - }, - } as IKeyringAccountState; - - return ledgerAccount; - } - - private getFormattedBackendAccount = async ({ - signer, - }: { - signer: SyscoinHDSigner; - }): Promise => { - // MUCH SIMPLER: Just use the signer directly - no BIP84 needed! - // Get address directly from the signer (always correct for current network) - const address = signer.createAddress(0, false, 84) as string; - const xpub = signer.getAccountXpub(); - - return { - address, - xpub, - }; - }; - private setLatestIndexesFromXPubTokens = function (tokens) { - let changeIndexInternal = -1, - receivingIndexInternal = -1; - if (tokens) { - tokens.forEach((token) => { - if (!token.transfers || !token.path) { - return { - changeIndex: changeIndexInternal + 1, - receivingIndex: receivingIndexInternal + 1, - }; - } - const transfers = parseInt(token.transfers, 10); - if (token.path && transfers > 0) { - const splitPath = token.path.split('/'); - if (splitPath.length >= 6) { - const change = parseInt(splitPath[4], 10); - const index = parseInt(splitPath[5], 10); - if (change === 1) { - if (index > changeIndexInternal) { - changeIndexInternal = index; - } - } else if (index > receivingIndexInternal) { - receivingIndexInternal = index; - } - } - } - }); - } - return { - changeIndex: changeIndexInternal + 1, - receivingIndex: receivingIndexInternal + 1, - }; - }; - - // Common helper method for UTXO account creation - private async createUTXOAccountAtIndex(accountId: number, label?: string) { - try { - // Create fresh signer just for this account creation operation - const freshHDSigner = this.createOnDemandUTXOSigner(accountId); - - const sysAccount = await this.getFormattedBackendAccount({ - signer: freshHDSigner, - }); - - const encryptedXprv = this.getEncryptedXprv(freshHDSigner); - - // Generate network-aware label if none provided - const vault = this.getVault(); - const network = vault.activeNetwork; - const defaultLabel = this.generateNetworkAwareLabel(accountId, network); - - return { - ...this.getInitialAccountData({ - label: label || defaultLabel, - signer: freshHDSigner, - sysAccount, - xprv: encryptedXprv, - }), - balances: { syscoin: 0, ethereum: 0 }, - } as IKeyringAccountState; - } catch (error) { - console.log('ERROR createUTXOAccountAtIndex', { - error, - }); - this.validateAndHandleErrorByMessage(error.message); - throw error; - } - } - - private async addNewAccountToSyscoinChain(label?: string) { - try { - // Get next available account ID - const vault = this.getVault(); - const accounts = vault.accounts[KeyringAccountType.HDAccount]; - const nextId = this.getNextAccountId(accounts); - - return await this.createUTXOAccountAtIndex(nextId, label); - } catch (error) { - console.log('ERROR addNewAccountToSyscoinChain', { - error, - }); - this.validateAndHandleErrorByMessage(error.message); - throw error; - } - } - - private async addNewAccountToEth(label?: string) { - try { - // Get next available account ID - const vault = this.getVault(); - const accounts = vault.accounts[KeyringAccountType.HDAccount]; - const nextId = this.getNextAccountId(accounts); - - // EVM accounts should use generic labels since they work across all EVM networks - const defaultLabel = `Account ${nextId + 1}`; - - const newAccount = await this.setDerivedWeb3Accounts( - nextId, - label || defaultLabel - ); - - return newAccount; - } catch (error) { - console.log('ERROR addNewAccountToEth', { - error, - }); - this.validateAndHandleErrorByMessage(error.message); - throw error; - } - } - - // Helper method to get next available account ID - fills gaps when accounts are deleted - private getNextAccountId(accounts: any): number { - const existingIds = Object.values(accounts) - .filter((account: any) => { - // Only count accounts that have been properly initialized - // Placeholder accounts have empty addresses/xprv/xpub - return account && account.address && account.xpub; - }) - .map((account: any) => account.id) - .filter((id) => !isNaN(id)) - .sort((a, b) => a - b); // Sort to find gaps efficiently - - if (existingIds.length === 0) { - return 0; - } - - // Find the first gap in the sequence - for (let i = 0; i < existingIds.length; i++) { - if (existingIds[i] !== i) { - // Found a gap at position i - return i; - } - } - - // No gaps found, return next sequential ID - return existingIds.length; - } - - private getBasicWeb3AccountInfo = (id: number, label?: string) => { - return { - id, - isTrezorWallet: false, - isLedgerWallet: false, - label: label ? label : `Account ${id + 1}`, - }; - }; - - private setDerivedWeb3Accounts = async ( - id: number, - label: string - ): Promise => { - try { - // For account creation, derive from mnemonic (since account doesn't exist yet) - const mnemonic = this.getDecryptedMnemonic(); - const hdNode = ethers.utils.HDNode.fromMnemonic(mnemonic); - const derivationPath = getAddressDerivationPath('eth', 60, 0, false, id); - const derivedAccount = hdNode.derivePath(derivationPath); - - const basicAccountInfo = this.getBasicWeb3AccountInfo(id, label); - - const createdAccount = { - address: derivedAccount.address, - xpub: derivedAccount.publicKey, - xprv: CryptoJS.AES.encrypt( - derivedAccount.privateKey, - this.getSessionPasswordString() - ).toString(), - isImported: false, - ...basicAccountInfo, - balances: { syscoin: 0, ethereum: 0 }, - }; - - // NOTE: Account creation should be dispatched to Redux store, not stored here - // Return the account data for Pali to add to store - return createdAccount; - } catch (error) { - console.log('ERROR setDerivedWeb3Accounts', { - error, - }); - this.validateAndHandleErrorByMessage(error.message); - throw error; - } - }; - - private setSignerEVM = async (network: INetwork): Promise => { - const abortController = new AbortController(); - try { - // With multi-keyring architecture, this is only called on EVM keyrings - this.ethereumTransaction.setWeb3Provider(network); - abortController.abort(); - } catch (error) { - abortController.abort(); - throw new Error(`SetSignerEVM: Failed with ${error}`); - } - }; - - private clearTemporaryLocalKeys = async (pwd: string) => { - // Clear the vault completely (set empty mnemonic) - await setEncryptedVault( - { - mnemonic: '', - }, - pwd - ); - - // Remove vault-keys from storage so no vault exists at all - await this.storage.deleteItem('vault-keys'); - - console.log('[KeyringManager] Temporary local keys cleared'); - this.logout(); - }; - - private async recreateSessionFromVault( - password: string, - saltedHashPassword: string - ): Promise { - try { - const { mnemonic } = await getDecryptedVault(password); - - if (!mnemonic) { - throw new Error('Mnemonic not found in vault'); - } - - // Encrypt session data with sessionPassword hash for consistency - // This allows keyring manager to decrypt with this.sessionPassword - this.sessionPassword = new SecureBuffer(saltedHashPassword); - // Encrypt the mnemonic with session password for consistency with the rest of the code - const encryptedMnemonic = CryptoJS.AES.encrypt( - mnemonic, - saltedHashPassword - ).toString(); - this.sessionMnemonic = new SecureBuffer(encryptedMnemonic); - console.log('[KeyringManager] Session data recreated from vault'); - } catch (error) { - console.error('ERROR recreateSessionFromVault', { error }); - throw error; - } - } - - private async _getPrivateKeyAccountInfos(privKey: string, label?: string) { - const vault = this.getVault(); - const { accounts } = vault; - let importedAccountValue: { - address: string; - privateKey: string; - publicKey: string; - }; - - const balances = { - syscoin: 0, - ethereum: 0, - }; - - // Try to validate as extended private key first, regardless of prefix - const networkToUse = vault.activeNetwork; - const zprvValidation = this.validateZprv(privKey, networkToUse); - - if (zprvValidation.isValid) { - const { node, network } = zprvValidation; - - if (!node || !network) { - throw new Error('Failed to validate extended private key'); - } - - // Always use index 0 for consistency - const nodeChild = node.derivePath(`0/0`); - if (!nodeChild) { - throw new Error('Failed to derive child node'); - } - - const { address } = bjs.payments.p2wpkh({ - pubkey: nodeChild.publicKey, - network, - }); - - if (!address) { - throw new Error('Failed to generate address'); - } - - importedAccountValue = { - address, - publicKey: node.neutered().toBase58(), - privateKey: privKey, - }; - - balances.syscoin = 0; - } else { - // Check if the validation failed due to network mismatch - if ( - zprvValidation.message && - zprvValidation.message.includes('Network mismatch') - ) { - throw new Error(zprvValidation.message); - } - - // Check if the validation failed due to invalid key prefix (only for known extended key formats) - if ( - zprvValidation.message && - zprvValidation.message.includes('Invalid key prefix') - ) { - throw new Error(zprvValidation.message); - } - - // Check if it failed parsing as an extended key - if ( - zprvValidation.message && - zprvValidation.message.includes('Failed to parse extended private key') - ) { - throw new Error(zprvValidation.message); - } - - // If it's not an extended key, treat it as an Ethereum private key - const hexPrivateKey = - privKey.slice(0, 2) === '0x' ? privKey : `0x${privKey}`; - - // Validate it's a valid hex string (32 bytes = 64 hex chars) - if ( - !/^0x[0-9a-fA-F]{64}$/.test(hexPrivateKey) && - !/^[0-9a-fA-F]{64}$/.test(privKey) - ) { - throw new Error( - 'Invalid private key format. Expected 32-byte hex string or extended private key.' - ); - } - - importedAccountValue = - this.ethereumTransaction.importAccount(hexPrivateKey); - - balances.ethereum = 0; - } - - const { address, publicKey, privateKey } = importedAccountValue; - - //Validate if account already exists - const accountAlreadyExists = - (accounts[KeyringAccountType.Imported] && - Object.values( - accounts[KeyringAccountType.Imported] as IKeyringAccountState[] - ).some((account) => account.address === address)) || - Object.values( - accounts[KeyringAccountType.HDAccount] as IKeyringAccountState[] - ).some((account) => account.address === address); //Find a way to verify if private Key is not par of seed wallet derivation path - - if (accountAlreadyExists) - throw new Error( - 'Account already exists, try again with another Private Key.' - ); - - const id = this.getNextAccountId(accounts[KeyringAccountType.Imported]); - - // Generate appropriate label based on account type - const network = vault.activeNetwork; - let defaultLabel: string; - if (zprvValidation.isValid) { - // UTXO imported account - use network-aware label - const networkPrefix = network.label; - defaultLabel = label || `${networkPrefix} Imported ${id + 1}`; - } else { - // EVM imported account - use generic label - defaultLabel = label || `Imported ${id + 1}`; - } - - return { - ...initialActiveImportedAccountState, - address, - label: defaultLabel, - id, - balances, - isImported: true, - xprv: CryptoJS.AES.encrypt( - privateKey, - this.getSessionPasswordString() - ).toString(), - xpub: publicKey, - assets: { - syscoin: [], - ethereum: [], - }, - } as IKeyringAccountState; - } - - // NEW: On-demand signer creation methods - - /** - * Common method to decrypt mnemonic from session - * Eliminates code duplication across multiple methods - */ - private getDecryptedMnemonic(): string { - if (!this.sessionMnemonic || !this.sessionPassword) { - throw new Error('Session information not available'); - } - - const mnemonic = CryptoJS.AES.decrypt( - this.getSessionMnemonicString(), - this.getSessionPasswordString() - ).toString(CryptoJS.enc.Utf8); - - if (!mnemonic) { - throw new Error('Failed to decrypt mnemonic'); - } - - return mnemonic; - } - - /** - * Creates network RPC config from current active network without making RPC calls - * Common utility for all on-demand signer creation - */ - private createNetworkRpcConfig() { - const network = this.getVault().activeNetwork; - - return { - formattedNetwork: network, - networkConfig: getNetworkConfig(network.slip44, network.currency), - }; - } - - /** - * Common signer creation logic - takes decrypted mnemonic/zprv and creates fresh signer - * OPTIMIZED: No RPC call needed - uses network config directly - */ - private createFreshUTXOSigner( - mnemonicOrZprv: string, - accountId: number - ): SyscoinHDSigner { - // Create signer using network config directly (no RPC call) - const rpcConfig = this.createNetworkRpcConfig(); - // Type assertion to match getSyscoinSigners expected interface - const { hd } = getSyscoinSigners({ - mnemonic: mnemonicOrZprv, - rpc: rpcConfig as any, - }); - - // Create account at the specified index and set it as active - // Note: createAccountAtIndex is synchronous despite TypeScript types - hd.createAccountAtIndex(accountId, 84); - - // Verify the account was created correctly - if (!hd.Signer.accounts.has(accountId)) { - throw new Error(`Failed to create account at index ${accountId}`); - } - - // Verify the correct account is active - if (hd.Signer.accountIndex !== accountId) { - throw new Error( - `Account index mismatch: expected ${accountId}, got ${hd.Signer.accountIndex}` - ); - } - - return hd; - } - - /** - * Creates a fresh UTXO signer for HD accounts derived from the main seed - * OPTIMIZED: No RPC call needed - uses network config directly - */ - private createOnDemandUTXOSigner(accountId: number): SyscoinHDSigner { - // Use common method to avoid code duplication - const mnemonic = this.getDecryptedMnemonic(); - return this.createFreshUTXOSigner(mnemonic, accountId); - } - - /** - * Creates a fresh UTXO signer for imported accounts from stored zprv - * OPTIMIZED: No RPC call needed - uses network config directly - */ - private createOnDemandUTXOSignerFromImported( - accountId: number - ): SyscoinHDSigner { - if (!this.sessionPassword) { - throw new Error('Session password not available'); - } - - const vault = this.getVault(); - const account = vault.accounts[KeyringAccountType.Imported][accountId]; - - if (!account) { - throw new Error(`Imported account ${accountId} not found`); - } - - // Decrypt the stored zprv - const zprv = CryptoJS.AES.decrypt( - account.xprv, - this.getSessionPasswordString() - ).toString(CryptoJS.enc.Utf8); - - if (!zprv) { - throw new Error('Failed to decrypt imported account private key'); - } - - if (!this.isZprv(zprv)) { - throw new Error('Imported account does not contain a valid zprv'); - } - - return this.createFreshUTXOSigner(zprv, accountId); - } - - /** - * Common method to create on-demand signer for active account - * Handles account type determination and delegates to appropriate method - */ - private createOnDemandSignerForActiveAccount(): SyscoinHDSigner { - const vault = this.getVault(); - const { activeAccount } = vault; - const accountId = activeAccount.id; - const accountType = activeAccount.type; - - if (accountType === KeyringAccountType.HDAccount) { - return this.createOnDemandUTXOSigner(accountId); - } else if (accountType === KeyringAccountType.Imported) { - return this.createOnDemandUTXOSignerFromImported(accountId); - } else { - throw new Error( - `Unsupported account type for UTXO signing: ${accountType}` - ); - } - } - - // NEW: Helper methods for HD signer management - private isZprv(key: string): boolean { - const zprvPrefixes = ['zprv', 'tprv', 'vprv', 'xprv']; - return zprvPrefixes.some((prefix) => key.startsWith(prefix)); - } - // NEW: Separate session initialization from account creation - public initializeSession = async ( - seedPhrase: string, - password: string - ): Promise => { - // Validate inputs first - if (!validateMnemonic(seedPhrase)) { - throw new Error('Invalid Seed'); - } - - let foundVaultKeys = true; - let salt = ''; - const vaultKeys = await this.storage.get('vault-keys'); - if (!vaultKeys || !vaultKeys.salt) { - foundVaultKeys = false; - salt = crypto.randomBytes(16).toString('hex'); - } else { - salt = vaultKeys.salt; - } - - const sessionPasswordSaltedHash = this.encryptSHA512(password, salt); - if (!foundVaultKeys) { - // Store vault-keys using the storage abstraction - await this.storage.set('vault-keys', { - hash: sessionPasswordSaltedHash, - salt, - }); - } - - // Check if already initialized with the same password (idempotent behavior) - if (this.sessionPassword) { - if (sessionPasswordSaltedHash === this.getSessionPasswordString()) { - // Same password - check if it's the same mnemonic to ensure full idempotency - try { - const currentMnemonic = CryptoJS.AES.decrypt( - this.getSessionMnemonicString(), - this.getSessionPasswordString() - ).toString(CryptoJS.enc.Utf8); - - if (currentMnemonic === seedPhrase) { - // Same mnemonic and password - already initialized - return; - } - } catch (error) { - // If we can't decrypt, fall through to error - } - } - - // Different password or mnemonic - this is not a simple re-initialization - throw new Error( - 'Wallet already initialized with different parameters. Create a new keyring instance for different parameters.' - ); - } - - // Encrypt and store vault (mnemonic storage) - now uses single vault for all networks - await setEncryptedVault( - { - mnemonic: seedPhrase, // Store plain mnemonic - setEncryptedVault will encrypt the entire vault - }, - password - ); - - await this.recreateSessionFromVault(password, sessionPasswordSaltedHash); - }; - - // NEW: Create first account without signer setup - public createFirstAccount = async ( - label?: string - ): Promise => { - if (!this.sessionPassword || !this.sessionMnemonic) { - throw new Error( - 'Session must be initialized first. Call initializeSession.' - ); - } - - const vault = this.getVault(); - const network = vault.activeNetwork; - - if (network.kind === INetworkType.Syscoin) { - // UTXO accounts get network-aware labels since each network has separate keyrings - const defaultLabel = label || this.generateNetworkAwareLabel(0, network); - - // Create UTXO account using on-demand signer - const freshHDSigner = this.createOnDemandUTXOSigner(0); - - const sysAccount = await this.getFormattedBackendAccount({ - signer: freshHDSigner, - }); - - const encryptedXprv = this.getEncryptedXprv(freshHDSigner); - - return { - ...this.getInitialAccountData({ - label: defaultLabel, - signer: freshHDSigner, - sysAccount, - xprv: encryptedXprv, - }), - balances: { syscoin: 0, ethereum: 0 }, - } as IKeyringAccountState; - } else { - // EVM accounts get generic labels since they work across all EVM networks - const defaultLabel = label || 'Account 1'; - return await this.setDerivedWeb3Accounts(0, defaultLabel); - } - }; - - public initializeWalletSecurely = async ( - seedPhrase: string, - password: string - ): Promise => { - // Use new separated approach - await this.initializeSession(seedPhrase, password); - return await this.createFirstAccount(); - }; - // Helper methods for secure buffer operations - private getSessionPasswordString(): string { - if (!this.sessionPassword || this.sessionPassword.isCleared()) { - throw new Error('Session password not available'); - } - return this.sessionPassword.toString(); - } - - private getSessionMnemonicString(): string { - if (!this.sessionMnemonic || this.sessionMnemonic.isCleared()) { - throw new Error('Session mnemonic not available'); - } - return this.sessionMnemonic.toString(); - } - - private generateNetworkAwareLabel( - accountId: number, - network: INetwork - ): string { - // Generate concise network-specific labels using actual network config - const { label, chainId, kind, currency } = network; - - // Create a shortened network identifier based on actual network configurations - let networkPrefix = ''; - - if (kind === INetworkType.Syscoin) { - // UTXO networks (slip44 = 57 for mainnet, 1 for testnet) - if (chainId === 57) { - networkPrefix = 'SYS'; // Syscoin UTXO Mainnet - } else if (chainId === 5700) { - networkPrefix = 'SYS-T'; // Syscoin UTXO Testnet (slip44=1) - } else { - // Other UTXO networks - use currency shortcut (e.g., "btc" -> "BTC") - if (currency) { - networkPrefix = currency.toUpperCase(); - } else { - // Fallback to first word from label if no currency - const firstWord = label.split(' ')[0]; - networkPrefix = - firstWord.length > 6 ? firstWord.substring(0, 6) : firstWord; - } - } - } else { - // EVM networks (all use slip44=60) - if (chainId === 1) { - networkPrefix = 'ETH'; // Ethereum Mainnet - } else if (chainId === 11155111) { - networkPrefix = 'ETH-T'; // Ethereum Sepolia Testnet - } else if (chainId === 137) { - networkPrefix = 'POLY'; // Polygon Mainnet - } else if (chainId === 80001) { - networkPrefix = 'POLY-T'; // Polygon Mumbai Testnet - } else if (chainId === 57) { - networkPrefix = 'NEVM'; // Syscoin NEVM Mainnet - } else if (chainId === 5700) { - networkPrefix = 'NEVM-T'; // Syscoin NEVM Testnet - } else if (chainId === 570) { - networkPrefix = 'ROLLUX'; // Rollux Mainnet - } else if (chainId === 57000) { - networkPrefix = 'ROLLUX-T'; // Rollux Testnet - } else { - // Other EVM networks - use currency shortcut if available - if (currency) { - // Check if it's a testnet network - if ( - label.toLowerCase().includes('testnet') || - label.toLowerCase().includes('test') - ) { - networkPrefix = `${currency.toUpperCase()}-T`; - } else { - networkPrefix = currency.toUpperCase(); - } - } else { - // Fallback to extracting meaningful prefix from label - const firstWord = label.split(' ')[0]; - if ( - firstWord.toLowerCase().includes('testnet') || - firstWord.toLowerCase().includes('test') - ) { - const baseWord = label.split(' ')[0]; - networkPrefix = `${baseWord.substring(0, 4).toUpperCase()}-T`; - } else { - networkPrefix = - firstWord.length > 6 - ? firstWord.substring(0, 6).toUpperCase() - : firstWord.toUpperCase(); - } - } - } - } - - return `${networkPrefix} ${accountId + 1}`; - } - - /** - * Clean up all resources - */ - public async destroy(): Promise { - this.lockWallet(); - - // Clear any remaining references - this.ethereumTransaction = {} as EthereumTransactions; - this.syscoinTransaction = {} as SyscoinTransactions; + const keyring = new KeyringManager(); + keyring.setVaultStateGetter(vaultStateGetter); + await keyring.initializeWalletSecurely(seed, password); + return keyring; } } diff --git a/packages/sysweb3-keyring/src/ledger-host.ts b/packages/sysweb3-keyring/src/ledger-host.ts new file mode 100644 index 00000000..3948d102 --- /dev/null +++ b/packages/sysweb3-keyring/src/ledger-host.ts @@ -0,0 +1,66 @@ +/** Heavy browser host entry. Do not import from the wallet worker or software entry. */ +import { + DeviceManagementKitBuilder, + type DeviceManagementKit, +} from '@ledgerhq/device-management-kit'; +import { webHidTransportFactory } from '@ledgerhq/device-transport-kit-web-hid'; + +import { createLedgerEvmAdapter } from './ledger/dmk-evm'; +import { LedgerDmkSession } from './ledger/dmk-session'; +import { createLedgerUtxoAdapter } from './ledger/dmk-utxo'; +import { ledgerHostError } from './ledger/host-types'; + +import type { LedgerHost, LedgerEvmConfig } from './ledger/host-types'; + +export interface LedgerDmkHostConfig extends LedgerEvmConfig { + /** Platform-owned DMK, allowing a future host to register its own transports. */ + dmk?: object; +} + +export function createLedgerDmkHost( + config: LedgerDmkHostConfig = {} +): LedgerHost { + const candidate = + config.dmk ?? + new DeviceManagementKitBuilder() + .addTransport(webHidTransportFactory) + .build(); + for (const method of [ + 'connect', + 'disconnect', + 'executeDeviceAction', + 'startDiscovering', + 'listenToAvailableDevices', + 'getDeviceSessionState', + ]) { + if (typeof (candidate as Record)[method] !== 'function') + throw ledgerHostError( + 'LEDGER_INVALID_HOST', + 'Invalid Ledger device manager' + ); + } + // Keep upstream exports-only types out of this public declaration. A trusted + // platform supplies its concrete DMK here; dapps cannot select this object. + const dmk = candidate as DeviceManagementKit; + const session = new LedgerDmkSession(dmk); + return { + connect: (request, options) => session.connect(request, options), + disconnect: () => session.disconnect(), + getStatus: () => session.getStatus(), + evm: createLedgerEvmAdapter(session, config), + utxo: createLedgerUtxoAdapter(session), + }; +} + +export type { + LedgerEvmConfig, + LedgerBlindSigningIntent, + LedgerHost, + LedgerEvmHost, + LedgerUtxoHost, + LedgerUtxoAccount, + LedgerPartialSignature, + LedgerTypedData, + LedgerOperationOptions, + LedgerProgress, +} from './ledger/host-types'; diff --git a/packages/sysweb3-keyring/src/ledger/bitcoin_client/index.ts b/packages/sysweb3-keyring/src/ledger/bitcoin_client/index.ts index a029eef4..d93d42df 100644 --- a/packages/sysweb3-keyring/src/ledger/bitcoin_client/index.ts +++ b/packages/sysweb3-keyring/src/ledger/bitcoin_client/index.ts @@ -7,13 +7,8 @@ import { } from './lib/policy'; import { PsbtV2 } from './lib/psbtv2'; -export { - AppClient, - PsbtV2, - DefaultDescriptorTemplate, - DefaultWalletPolicy, - PartialSignature, - WalletPolicy, -}; +export { AppClient, PsbtV2, WalletPolicy, DefaultWalletPolicy }; + +export type { DefaultDescriptorTemplate, PartialSignature }; export default AppClient; diff --git a/packages/sysweb3-keyring/src/ledger/bitcoin_client/lib/appClient.ts b/packages/sysweb3-keyring/src/ledger/bitcoin_client/lib/appClient.ts index 523787e6..ba464d74 100644 --- a/packages/sysweb3-keyring/src/ledger/bitcoin_client/lib/appClient.ts +++ b/packages/sysweb3-keyring/src/ledger/bitcoin_client/lib/appClient.ts @@ -1,8 +1,3 @@ -import * as descriptors from '@bitcoinerlab/descriptors'; -import * as secp256k1 from '@bitcoinerlab/secp256k1'; -const { Descriptor } = descriptors.DescriptorsFactory(secp256k1); -import Transport from '@ledgerhq/hw-transport'; - import { pathElementsToBuffer, pathStringToArray } from './bip32'; import { ClientCommandInterpreter } from './clientCommands'; import { MerkelizedPsbt } from './merkelizedPsbt'; @@ -10,13 +5,24 @@ import { hashLeaf, Merkle } from './merkle'; import { WalletPolicy } from './policy'; import { PsbtV2 } from './psbtv2'; import { createVarint, parseVarint } from './varint'; -import { findCoin, getNetworkConfigFromCoin } from '@pollum-io/sysweb3-network'; const CLA_BTC = 0xe1; const CLA_FRAMEWORK = 0xf8; const CURRENT_PROTOCOL_VERSION = 1; // supported from version 2.1.0 of the app +/** The Bitcoin protocol needs APDU exchange only, not a vendor transport class. */ +export interface BitcoinAppTransport { + send( + cla: number, + ins: number, + p1: number, + p2: number, + data?: Buffer, + acceptedStatusCodes?: number[] + ): Promise; +} + enum BitcoinIns { GET_PUBKEY = 0x00, REGISTER_WALLET = 0x02, @@ -80,9 +86,9 @@ function makePartialSignature( * https://github.com/LedgerHQ/app-bitcoin-new/blob/master/doc/bitcoin.md */ export class AppClient { - readonly transport: Transport; + readonly transport: BitcoinAppTransport; - constructor(transport: Transport) { + constructor(transport: BitcoinAppTransport) { this.transport = transport; } @@ -125,9 +131,9 @@ export class AppClient { * @returns an object with app name, version and device status flags. */ public async getAppAndVersion(): Promise<{ - flags: number | Buffer; name: string; version: string; + flags: number | Buffer; }> { const r = await this.transport.send(0xb0, 0x01, 0x00, 0x00); let i = 0; @@ -158,7 +164,10 @@ export class AppClient { * @param display `false` to silently retrieve a pubkey for a standard path, `true` to display the path on screen * @returns the base58-encoded serialized extended pubkey (xpub) */ - async getExtendedPubkey(path: string, display = false): Promise { + async getExtendedPubkey( + path: string, + display: boolean = false + ): Promise { const pathElements = pathStringToArray(path); if (pathElements.length > 6) { throw new Error('Path too long. At most 6 levels allowed.'); @@ -207,16 +216,6 @@ export class AppClient { const walletId = response.subarray(0, 32); const walletHMAC = response.subarray(32); - // sanity check: derive and validate the first address with a 3rd party - const firstAddrDevice = await this.getWalletAddress( - walletPolicy, - walletHMAC, - 0, - 0, - false - ); - await this.validateAddress(firstAddrDevice, walletPolicy, 0, 0); - return [walletId, walletHMAC]; } @@ -267,7 +266,6 @@ export class AppClient { ); const address = response.toString('ascii'); - await this.validateAddress(address, walletPolicy, change, addressIndex); return address; } @@ -413,109 +411,6 @@ export class AppClient { return result.toString('base64'); } - - /* Performs any additional check on the generated address before returning it.*/ - private async validateAddress( - address: string, - walletPolicy: WalletPolicy, - change: number, - addressIndex: number - ) { - if (change !== 0 && change !== 1) - throw new Error('Change can only be 0 or 1'); - const isChange: boolean = change === 1; - if (addressIndex < 0 || !Number.isInteger(addressIndex)) - throw new Error('Invalid address index'); - const appAndVer = await this.getAppAndVersion(); - - // Map Ledger app names to network configurations - const network = this.getNetworkFromAppName(appAndVer.name); - if (!network) { - throw new Error( - `Unsupported Ledger app: ${appAndVer.name}. Please install the correct app for your network.` - ); - } - - let expression = walletPolicy.descriptorTemplate; - // Replace change: - expression = expression.replace(/\/\*\*/g, `/<0;1>/*`); - const regExpMN = new RegExp(`/<(\\d+);(\\d+)>`, 'g'); - let matchMN; - while ((matchMN = regExpMN.exec(expression)) !== null) { - const [M, N] = [parseInt(matchMN[1], 10), parseInt(matchMN[2], 10)]; - expression = expression.replace(`/<${M};${N}>`, `/${isChange ? N : M}`); - } - // Replace index: - expression = expression.replace(/\/\*/g, `/${addressIndex}`); - // Replace origin in reverse order to prevent - // misreplacements, e.g., @10 being mistaken for @1 and leaving a 0. - for (let i = walletPolicy.keys.length - 1; i >= 0; i--) - expression = expression.replace( - new RegExp(`@${i}`, 'g'), - walletPolicy.keys[i] - ); - let thirdPartyValidationApplicable = true; - let thirdPartyGeneratedAddress = ''; - try { - thirdPartyGeneratedAddress = new Descriptor({ - expression, - network, - }).getAddress(); - } catch (err) { - // Note: @bitcoinerlab/descriptors@1.0.x does not support Tapscript yet. - // These are the supported descriptors: - // - pkh(KEY) - // - wpkh(KEY) - // - sh(wpkh(KEY)) - // - sh(SCRIPT) - // - wsh(SCRIPT) - // - sh(wsh(SCRIPT)), where - // SCRIPT is any of the (non-tapscript) fragments in: https://bitcoin.sipa.be/miniscript/ - // - // Other expressions are not supported and third party validation would not be applicable: - thirdPartyValidationApplicable = false; - } - if ( - thirdPartyValidationApplicable && - address !== thirdPartyGeneratedAddress - ) - console.log( - `Third party address validation mismatch: ${address} != ${thirdPartyGeneratedAddress}` - ); - } - - /** - * Maps Ledger app names to network configurations - * This allows support for multiple UTXO networks beyond just Syscoin - */ - private getNetworkFromAppName(appName: string): any { - // Extract the coin name from the app name - // Ledger apps typically follow the pattern: "Bitcoin", "Bitcoin Test", "Litecoin", etc. - const isTestnet = appName.toLowerCase().includes('test'); - const baseName = appName.replace(/\s+Test$/i, '').trim(); - - try { - // Use findCoin to look up the coin by name - const coin = findCoin({ name: baseName }); - - if (!coin) { - console.error(`No coin found for Ledger app: ${appName}`); - return null; - } - - // Get the network configuration from the coin - const networkConfig = getNetworkConfigFromCoin(coin); - - // Return the appropriate network (mainnet or testnet) - // For testnets, the network config is the same as mainnet in coins.ts - return isTestnet - ? networkConfig.networks.testnet - : networkConfig.networks.mainnet; - } catch (error) { - console.error(`Failed to get network config for ${appName}:`, error); - return null; - } - } } export default AppClient; diff --git a/packages/sysweb3-keyring/src/ledger/bitcoin_client/lib/bip32.ts b/packages/sysweb3-keyring/src/ledger/bitcoin_client/lib/bip32.ts index ba3f94ce..3fdf5daf 100644 --- a/packages/sysweb3-keyring/src/ledger/bitcoin_client/lib/bip32.ts +++ b/packages/sysweb3-keyring/src/ledger/bitcoin_client/lib/bip32.ts @@ -1,4 +1,4 @@ -import bippath from 'bip32-path'; // TODO: get rid of this dependency +import bippath from 'bip32-path'; import bs58check from 'bs58check'; export function pathElementsToBuffer(paths: readonly number[]): Buffer { diff --git a/packages/sysweb3-keyring/src/ledger/bitcoin_client/lib/clientCommands.ts b/packages/sysweb3-keyring/src/ledger/bitcoin_client/lib/clientCommands.ts index 1a1860c8..315208a4 100644 --- a/packages/sysweb3-keyring/src/ledger/bitcoin_client/lib/clientCommands.ts +++ b/packages/sysweb3-keyring/src/ledger/bitcoin_client/lib/clientCommands.ts @@ -1,5 +1,13 @@ /* eslint-disable camelcase */ -import { crypto } from 'bitcoinjs-lib'; +import CryptoJS from 'crypto-js'; + +// Helper function for SHA256 hashing (browser-compatible) +function sha256(data: Buffer): Buffer { + const wordArray = CryptoJS.lib.WordArray.create(data); + const hash = CryptoJS.SHA256(wordArray); + const hashBuffer = Buffer.from(hash.toString(CryptoJS.enc.Hex), 'hex'); + return hashBuffer; +} import { BufferReader } from './buffertools'; import { hashLeaf, Merkle } from './merkle'; @@ -309,7 +317,7 @@ export class ClientCommandInterpreter { } addKnownPreimage(preimage: Buffer): void { - this.preimages.set(crypto.sha256(preimage).toString('hex'), preimage); + this.preimages.set(sha256(preimage).toString('hex'), preimage); } addKnownList(elements: readonly Buffer[]): void { @@ -329,7 +337,8 @@ export class ClientCommandInterpreter { addKnownWalletPolicy(wp: WalletPolicy): void { this.addKnownPreimage(wp.serialize()); this.addKnownList(wp.keys.map((k) => Buffer.from(k, 'ascii'))); - this.addKnownPreimage(Buffer.from(wp.descriptorTemplate)); + // Use ASCII to match policy serialization hashing and device expectations + this.addKnownPreimage(Buffer.from(wp.descriptorTemplate, 'ascii')); } execute(request: Buffer): Buffer { diff --git a/packages/sysweb3-keyring/src/ledger/bitcoin_client/lib/merkle.ts b/packages/sysweb3-keyring/src/ledger/bitcoin_client/lib/merkle.ts index cb6b9faa..2b6162e9 100644 --- a/packages/sysweb3-keyring/src/ledger/bitcoin_client/lib/merkle.ts +++ b/packages/sysweb3-keyring/src/ledger/bitcoin_client/lib/merkle.ts @@ -1,4 +1,12 @@ -import { crypto } from 'bitcoinjs-lib'; +import CryptoJS from 'crypto-js'; + +// Helper function for SHA256 hashing (browser-compatible) +function sha256(data: Buffer): Buffer { + const wordArray = CryptoJS.lib.WordArray.create(data); + const hash = CryptoJS.SHA256(wordArray); + const hashBuffer = Buffer.from(hash.toString(CryptoJS.enc.Hex), 'hex'); + return hashBuffer; +} /** * This class implements the merkle tree used by Ledger Bitcoin app v2+, @@ -10,10 +18,7 @@ export class Merkle { private rootNode: Node; private leafNodes: Node[]; private h: (buf: Buffer) => Buffer; - constructor( - leaves: Buffer[], - hasher: (buf: Buffer) => Buffer = crypto.sha256 - ) { + constructor(leaves: Buffer[], hasher: (buf: Buffer) => Buffer = sha256) { this.leaves = leaves; this.h = hasher; const nodes = this.calculateRoot(leaves); @@ -71,7 +76,7 @@ export class Merkle { export function hashLeaf( buf: Buffer, - hashFunction: (buf: Buffer) => Buffer = crypto.sha256 + hashFunction: (buf: Buffer) => Buffer = sha256 ): Buffer { return hashConcat(Buffer.from([0]), buf, hashFunction); } diff --git a/packages/sysweb3-keyring/src/ledger/bitcoin_client/lib/policy.ts b/packages/sysweb3-keyring/src/ledger/bitcoin_client/lib/policy.ts index 9f768649..bfc8595b 100644 --- a/packages/sysweb3-keyring/src/ledger/bitcoin_client/lib/policy.ts +++ b/packages/sysweb3-keyring/src/ledger/bitcoin_client/lib/policy.ts @@ -1,4 +1,12 @@ -import { crypto } from 'bitcoinjs-lib'; +import CryptoJS from 'crypto-js'; + +// Helper function for SHA256 hashing (browser-compatible) +function sha256(data: Buffer): Buffer { + const wordArray = CryptoJS.lib.WordArray.create(data); + const hash = CryptoJS.SHA256(wordArray); + const hashBuffer = Buffer.from(hash.toString(CryptoJS.enc.Hex), 'hex'); + return hashBuffer; +} import { BufferWriter } from './buffertools'; import { hashLeaf, Merkle } from './merkle'; @@ -37,7 +45,7 @@ export class WalletPolicy { * Returns the unique 32-bytes id of this wallet policy. */ getId(): Buffer { - return crypto.sha256(this.serialize()); + return sha256(this.serialize()); } /** @@ -56,8 +64,8 @@ export class WalletPolicy { // length of descriptor template buf.writeVarInt(this.descriptorTemplate.length); - // sha256 hash of descriptor template - buf.writeSlice(crypto.sha256(Buffer.from(this.descriptorTemplate))); + // sha256 hash of descriptor template (ASCII to match device expectations) + buf.writeSlice(sha256(Buffer.from(this.descriptorTemplate, 'ascii'))); // number of keys buf.writeVarInt(this.keys.length); diff --git a/packages/sysweb3-keyring/src/ledger/bitcoin_client/lib/psbtv2.ts b/packages/sysweb3-keyring/src/ledger/bitcoin_client/lib/psbtv2.ts index 0ab75947..4c694cdf 100644 --- a/packages/sysweb3-keyring/src/ledger/bitcoin_client/lib/psbtv2.ts +++ b/packages/sysweb3-keyring/src/ledger/bitcoin_client/lib/psbtv2.ts @@ -2,7 +2,7 @@ /* eslint-disable camelcase */ /* eslint-disable @typescript-eslint/no-non-null-assertion */ -import * as bjs from 'bitcoinjs-lib'; +import * as syscoinjs from 'syscoinjs-lib'; import { BufferReader, @@ -12,6 +12,7 @@ import { } from './buffertools'; import { sanitizeBigintToNumber } from './varint'; +import type { Psbt } from 'bitcoinjs-lib'; export enum psbtGlobal { UNSIGNED_TX = 0x00, XPUB = 0x01, @@ -388,7 +389,9 @@ export class PsbtV2 { if (psbtVersion == 0) { // if PSBTv0, we parse the PSBT_GLOBAL_UNSIGNED_TX field const txRaw = this.getGlobal(psbtGlobal.UNSIGNED_TX); - const tx = bjs.Transaction.fromBuffer(txRaw); + const tx = (syscoinjs.utils as any).bitcoinjs.Transaction.fromBuffer( + txRaw + ); nInputs = tx.ins.length; nOutputs = tx.outs.length; } else { @@ -422,7 +425,7 @@ export class PsbtV2 { // Convert PsbtV0 to PsbtV2 by parsing the PSBT_GLOBAL_UNSIGNED_TX field // and filling in the corresponding fields. const txRaw = this.getGlobal(psbtGlobal.UNSIGNED_TX); - const tx = bjs.Transaction.fromBuffer(txRaw); + const tx = (syscoinjs.utils as any).bitcoinjs.Transaction.fromBuffer(txRaw); this.setGlobalPsbtVersion(2); this.setGlobalTxVersion(tx.version); @@ -431,14 +434,17 @@ export class PsbtV2 { this.setGlobalOutputCount(tx.outs.length); for (let i = 0; i < tx.ins.length; i++) { - this.setInputPreviousTxId(i, tx.ins[i].hash); + // Defensive copy to ensure Buffer instance and immutability + this.setInputPreviousTxId(i, Buffer.from(tx.ins[i].hash)); this.setInputOutputIndex(i, tx.ins[i].index); this.setInputSequence(i, tx.ins[i].sequence); } for (let i = 0; i < tx.outs.length; i++) { - this.setOutputAmount(i, tx.outs[i].value); - this.setOutputScript(i, tx.outs[i].script); + // Use Number for amount (tx.outs[i].value is a number in bitcoinjs Transaction) + this.setOutputAmount(i, Number(tx.outs[i].value)); + // Defensive copy for script buffer + this.setOutputScript(i, Buffer.from(tx.outs[i].script)); } // PSBT_GLOBAL_UNSIGNED_TX must be removed in a valid PSBTv2 @@ -455,11 +461,41 @@ export class PsbtV2 { * Note: This method supports all the policies that the Ledger is able to * sign, with the exception of taproot: tr(@0). */ - fromBitcoinJS(psbtBJS: bjs.Psbt): PsbtV2 { + fromBitcoinJS(psbtBJS: Psbt | string | Buffer | any): PsbtV2 { + const bjs: any = (syscoinjs.utils as any).bitcoinjs; + // Be liberal in what we accept in tests: Psbt instance, base64 string, Buffer, or wrapper + let psbtObj: any = psbtBJS; + if (!psbtObj || !psbtObj.data) { + try { + if (typeof psbtBJS === 'string') { + psbtObj = bjs.Psbt.fromBase64(psbtBJS); + } else if (Buffer.isBuffer(psbtBJS)) { + psbtObj = bjs.Psbt.fromBuffer(psbtBJS); + } else if (psbtBJS && typeof psbtBJS.toBase64 === 'function') { + psbtObj = bjs.Psbt.fromBase64(psbtBJS.toBase64()); + } + } catch (e) { + // Ignore parse errors; we'll fall back to a minimal psbt shell below + void e; + } + } + if (!psbtObj || !psbtObj.data) { + // Lenient fallback for tests with mocked psbt: create a minimal shell + psbtObj = { + version: 2, + locktime: 0, + data: { inputs: [] }, + txInputs: [], + txOutputs: [], + } as any; + } function isTaprootInput(input: any): boolean { let isP2TR; try { - bjs.payments.p2tr({ output: input.witnessUtxo.script }); + // Use bitcoinjs from syscoinjs-lib to avoid direct dependency + (syscoinjs.utils as any).bitcoinjs.payments.p2tr({ + output: input.witnessUtxo.script, + }); isP2TR = true; } catch (err) { isP2TR = false; @@ -476,36 +512,48 @@ export class PsbtV2 { ); } this.setGlobalPsbtVersion(2); - this.setGlobalTxVersion(psbtBJS.version); - this.setGlobalInputCount(psbtBJS.data.inputs.length); - this.setGlobalOutputCount(psbtBJS.txOutputs.length); - if (psbtBJS.locktime !== undefined) - this.setGlobalFallbackLocktime(psbtBJS.locktime); - psbtBJS.data.inputs.forEach((input, index) => { - if (isTaprootInput(input)) + this.setGlobalTxVersion(psbtObj.version); + this.setGlobalInputCount(psbtObj.data.inputs.length); + this.setGlobalOutputCount(psbtObj.txOutputs.length); + if (psbtObj.locktime !== undefined) + this.setGlobalFallbackLocktime(psbtObj.locktime); + psbtObj.data.inputs.forEach((input, index) => { + const finalized = input.finalScriptSig || input.finalScriptWitness; + if (!finalized && isTaprootInput(input)) throw new Error(`Taproot inputs not supported`); - this.setInputPreviousTxId(index, psbtBJS.txInputs[index].hash); - if (psbtBJS.txInputs[index].sequence !== undefined) - // @ts-ignore - this.setInputSequence(index, psbtBJS.txInputs[index].sequence); - this.setInputOutputIndex(index, psbtBJS.txInputs[index].index); + this.setInputPreviousTxId( + index, + Buffer.from(psbtObj.txInputs[index].hash) + ); + if (psbtObj.txInputs[index].sequence !== undefined) + this.setInputSequence(index, psbtObj.txInputs[index].sequence); + this.setInputOutputIndex(index, psbtObj.txInputs[index].index); if (input.sighashType !== undefined) this.setInputSighashType(index, input.sighashType); if (input.nonWitnessUtxo) - this.setInputNonWitnessUtxo(index, input.nonWitnessUtxo); + this.setInputNonWitnessUtxo(index, Buffer.from(input.nonWitnessUtxo)); if (input.witnessUtxo) { this.setInputWitnessUtxo( index, - input.witnessUtxo.value, - input.witnessUtxo.script + Number(input.witnessUtxo.value), + Buffer.from(input.witnessUtxo.script) ); } if (input.witnessScript) - this.setInputWitnessScript(index, input.witnessScript); + this.setInputWitnessScript(index, Buffer.from(input.witnessScript)); if (input.redeemScript) - this.setInputRedeemScript(index, input.redeemScript); - // @ts-ignore - psbtBJS.data.inputs[index].bip32Derivation.forEach((derivation) => { + this.setInputRedeemScript(index, Buffer.from(input.redeemScript)); + if (input.finalScriptSig) + this.setInputFinalScriptsig(index, Buffer.from(input.finalScriptSig)); + if (input.finalScriptWitness) + this.setInputFinalScriptwitness( + index, + Buffer.from(input.finalScriptWitness) + ); + // Finalized external entries have no signing hints, even if a caller + // reattached them after finalization. Keep only their completed scripts. + if (finalized) return; + (input.bip32Derivation || []).forEach((derivation) => { if (!/^m\//i.test(derivation.path)) throw new Error(`Invalid input bip32 derivation`); const pathArray = derivation.path @@ -516,15 +564,15 @@ export class PsbtV2 { ); this.setInputBip32Derivation( index, - derivation.pubkey, - derivation.masterFingerprint, + Buffer.from(derivation.pubkey), + Buffer.from(derivation.masterFingerprint), pathArray ); }); }); - psbtBJS.txOutputs.forEach((output, index) => { - this.setOutputAmount(index, output.value); - this.setOutputScript(index, output.script); + psbtObj.txOutputs.forEach((output, index) => { + this.setOutputAmount(index, Number(output.value)); + this.setOutputScript(index, Buffer.from(output.script)); }); return this; } diff --git a/packages/sysweb3-keyring/src/ledger/dmk-evm.ts b/packages/sysweb3-keyring/src/ledger/dmk-evm.ts new file mode 100644 index 00000000..a6d40a4e --- /dev/null +++ b/packages/sysweb3-keyring/src/ledger/dmk-evm.ts @@ -0,0 +1,349 @@ +import { + ClearSignContextType, + type ContextModule, +} from '@ledgerhq/context-module'; +import { + SignerEthBuilder, + type Signature as DeviceSignature, + type TypedData, +} from '@ledgerhq/device-signer-kit-ethereum'; +import { TypedDataUtils, SignTypedDataVersion } from '@metamask/eth-sig-util'; +import { + computeAddress, + getAddress, + hashMessage, + recoverAddress, + Signature, + Transaction, +} from 'ethers'; + +import { + ledgerHostError, + type LedgerEvmHost, + type LedgerTypedData, + type LedgerBlindSigningIntent, + type LedgerEvmConfig, +} from './host-types'; + +import type { LedgerDmkOperation, LedgerDmkSession } from './dmk-session'; + +export type { LedgerBlindSigningIntent, LedgerEvmConfig } from './host-types'; + +const invalid = (message: string) => + ledgerHostError('LEDGER_INVALID_REQUEST', message); +const unavailable = () => + ledgerHostError( + 'HARDWARE_CLEAR_SIGNING_UNAVAILABLE', + 'This Ledger operation requires explicit approval because clear signing is not guaranteed' + ); + +/** No remote metadata, transaction checks, or signing telemetry by default. */ +export const offlineLedgerContext: ContextModule = Object.freeze({ + getContexts: async () => [], + getFieldContext: async () => ({ + type: ClearSignContextType.ERROR as const, + error: unavailable(), + }), + getTypedDataFilters: async () => ({ + type: 'error' as const, + error: unavailable(), + }), + report: async () => undefined, + signReport: async () => undefined, +}); + +const accountPath = (index: number): string => { + if (!Number.isSafeInteger(index) || index < 0 || index > 0x7fffffff) + throw invalid('Invalid Ledger address index'); + // Preserve the existing Ledger wallet layout: account 0, address index i. + return `44'/60'/0'/0/${index}`; +}; + +const hexBytes = (value: string, label: string): Uint8Array => { + if (typeof value !== 'string') throw invalid(`Invalid ${label}`); + const hex = value.replace(/^0x/i, ''); + if (!/^(?:[0-9a-f]{2})*$/i.test(hex)) throw invalid(`Invalid ${label}`); + return Uint8Array.from(Buffer.from(hex, 'hex')); +}; + +const expectedAddress = (value: string): string => { + try { + return getAddress(value); + } catch { + throw invalid('Invalid expected Ledger address'); + } +}; + +function copyTypedValue( + value: unknown, + seen = new WeakSet(), + depth = 0 +): any { + if (depth > 64) throw invalid('Typed data nesting is too deep'); + if (typeof value === 'bigint') return value.toString(); + if (value === null || typeof value === 'string' || typeof value === 'boolean') + return value; + if (typeof value === 'number') { + if (!Number.isFinite(value)) throw invalid('Invalid typed data number'); + return value; + } + if (value instanceof Uint8Array) + return `0x${Buffer.from(value).toString('hex')}`; + if (typeof value !== 'object' || value === undefined) + throw invalid('Invalid typed data value'); + if (seen.has(value)) throw invalid('Circular typed data'); + const prototype = Object.getPrototypeOf(value); + if ( + !Array.isArray(value) && + prototype !== Object.prototype && + prototype !== null + ) + throw invalid('Invalid typed data object'); + seen.add(value); + try { + if (Array.isArray(value)) + return value.map((item) => copyTypedValue(item, seen, depth + 1)); + const result: Record = Object.create(null); + for (const key of Object.keys(value)) { + const descriptor = Object.getOwnPropertyDescriptor(value, key)!; + if (!('value' in descriptor)) + throw invalid('Typed data accessors are not supported'); + if (descriptor.value !== undefined) + result[key] = copyTypedValue(descriptor.value, seen, depth + 1); + } + return result; + } finally { + seen.delete(value); + } +} + +function freezeDeep(value: T): T { + if (value && typeof value === 'object') { + for (const child of Object.values(value)) freezeDeep(child); + Object.freeze(value); + } + return value; +} + +const normalizeSignature = ( + output: DeviceSignature, + digest: string, + address: string +) => { + try { + if ( + !/^0x[0-9a-f]{64}$/i.test(output.r) || + !/^0x[0-9a-f]{64}$/i.test(output.s) || + !Number.isSafeInteger(output.v) || + output.v < 0 + ) + throw new Error('Malformed signature'); + const signature = Signature.from(output); + if ( + recoverAddress(digest, signature).toLowerCase() !== address.toLowerCase() + ) + throw new Error('Wrong signer'); + return { + signature, + r: output.r.slice(2), + s: output.s.slice(2), + v: output.v.toString(16), + }; + } catch { + throw ledgerHostError( + 'LEDGER_INVALID_SIGNATURE', + 'Ledger returned an invalid signature for this request' + ); + } +}; + +const signerFor = (operation: LedgerDmkOperation) => + new SignerEthBuilder({ dmk: operation.dmk, sessionId: operation.sessionId }) + .withContextModule(offlineLedgerContext) + .build(); + +type Signer = ReturnType; +async function verifySigner( + operation: LedgerDmkOperation, + signer: Signer, + path: string, + expected: string +) { + const output = await operation.runAction(() => + signer.getAddress(path, { checkOnDevice: false }) + ); + operation.assertCurrent(); + try { + const publicKey = output.publicKey.startsWith('0x') + ? output.publicKey + : `0x${output.publicKey}`; + if ( + getAddress(output.address) !== expected || + computeAddress(publicKey) !== expected + ) + throw new Error('Wrong device account'); + } catch { + throw ledgerHostError( + 'HARDWARE_ACCOUNT_MISMATCH', + 'Ledger account does not match the approved request' + ); + } +} + +async function approveBlindCapability( + operation: LedgerDmkOperation, + config: LedgerEvmConfig, + intent: LedgerBlindSigningIntent +) { + operation.assertCurrent(); + const approved = await config.confirmBlindSigning!( + freezeDeep(intent), + operation.signal + ); + operation.assertCurrent(); + if (approved !== true) throw unavailable(); +} + +/** EVM facade preserves existing SDK signature formats and performs no broadcast. */ +export function createLedgerEvmAdapter( + session: LedgerDmkSession, + config: LedgerEvmConfig = {} +): LedgerEvmHost { + const policy = Object.freeze({ + confirmBlindSigning: config.confirmBlindSigning, + }); + return { + async getAddress(request, options) { + const path = accountPath(request.accountIndex); + const checkOnDevice = request.checkOnDevice === true; + const chainId = request.chainId; + if ( + chainId !== undefined && + (!Number.isSafeInteger(chainId) || chainId <= 0) + ) + throw invalid('Invalid Ledger chain ID'); + return session.runExclusive(async (operation) => { + const signer = signerFor(operation); + const output = await operation.runAction(() => + signer.getAddress(path, { checkOnDevice, chainId }) + ); + operation.assertCurrent(); + try { + const address = getAddress(output.address); + const publicKey = output.publicKey.replace(/^0x/i, ''); + if (computeAddress(`0x${publicKey}`) !== address) + throw new Error('Invalid public key'); + return { address, publicKey }; + } catch { + throw ledgerHostError( + 'LEDGER_INVALID_RESPONSE', + 'Ledger returned an invalid address or public key' + ); + } + }, options); + }, + + async signTransaction(request, options) { + if (!policy.confirmBlindSigning) throw unavailable(); + const path = accountPath(request.accountIndex); + const address = expectedAddress(request.expectedAddress); + const bytes = hexBytes(request.unsignedTxHex, 'unsigned transaction'); + let transaction: Transaction; + try { + transaction = Transaction.from( + `0x${Buffer.from(bytes).toString('hex')}` + ); + if ( + transaction.signature || + transaction.chainId <= 0n || + transaction.chainId > + BigInt(Math.floor((Number.MAX_SAFE_INTEGER - 36) / 2)) + ) + throw new Error('Unsupported transaction'); + } catch { + throw invalid('Invalid unsigned Ledger transaction'); + } + const unsignedTxHex = transaction.unsignedSerialized; + const digest = transaction.unsignedHash; + const intent: LedgerBlindSigningIntent = { + kind: 'transaction', + accountIndex: request.accountIndex, + derivationPath: path, + expectedAddress: address, + unsignedTxHex, + chainId: transaction.chainId.toString(), + digest, + }; + return session.runExclusive(async (operation) => { + const signer = signerFor(operation); + await verifySigner(operation, signer, path, address); + await approveBlindCapability(operation, policy, intent); + const output = await operation.runAction(() => + signer.signTransaction( + path, + hexBytes(unsignedTxHex, 'unsigned transaction') + ) + ); + operation.assertCurrent(); + const { r, s, v } = normalizeSignature(output, digest, address); + return { r, s, v }; + }, options); + }, + + async signPersonalMessage(request, options) { + const path = accountPath(request.accountIndex); + const address = expectedAddress(request.expectedAddress); + const bytes = hexBytes(request.messageHex, 'personal message'); + const digest = hashMessage(bytes); + return session.runExclusive(async (operation) => { + const signer = signerFor(operation); + await verifySigner(operation, signer, path, address); + // Strings in the DSK use ASCII encoding; pass the reviewed bytes directly. + const output = await operation.runAction(() => + signer.signMessage(path, bytes) + ); + operation.assertCurrent(); + return normalizeSignature(output, digest, address).signature.serialized; + }, options); + }, + + async signTypedData(request, options) { + if (!policy.confirmBlindSigning) throw unavailable(); + const path = accountPath(request.accountIndex); + const address = expectedAddress(request.expectedAddress); + if (request.version !== 'V3' && request.version !== 'V4') + throw invalid('Ledger supports typed data V3 and V4 only'); + let data: LedgerTypedData, digest: string; + try { + data = copyTypedValue(request.data); + digest = `0x${TypedDataUtils.eip712Hash( + data as any, + request.version as SignTypedDataVersion.V3 | SignTypedDataVersion.V4 + ).toString('hex')}`; + } catch { + throw invalid('Invalid Ledger typed data for the requested version'); + } + const intent: LedgerBlindSigningIntent = { + kind: 'typed-data', + accountIndex: request.accountIndex, + derivationPath: path, + expectedAddress: address, + version: request.version, + data: copyTypedValue(data), + digest, + }; + return session.runExclusive(async (operation) => { + const signer = signerFor(operation); + await verifySigner(operation, signer, path, address); + await approveBlindCapability(operation, policy, intent); + // The DSK parser may add EIP712Domain; do not expose that mutation to callers or approval UI. + const deviceData = copyTypedValue(data) as TypedData; + const output = await operation.runAction(() => + signer.signTypedData(path, deviceData) + ); + operation.assertCurrent(); + return normalizeSignature(output, digest, address).signature.serialized; + }, options); + }, + }; +} diff --git a/packages/sysweb3-keyring/src/ledger/dmk-session.ts b/packages/sysweb3-keyring/src/ledger/dmk-session.ts new file mode 100644 index 00000000..f433e1a9 --- /dev/null +++ b/packages/sysweb3-keyring/src/ledger/dmk-session.ts @@ -0,0 +1,351 @@ +import { + ledgerCancelledError, + ledgerHostError, + type LedgerOperationOptions, +} from './host-types'; + +import type { + DeviceManagementKit, + DiscoveredDevice, +} from '@ledgerhq/device-management-kit'; +import type { Observable, Subscription } from 'rxjs'; + +type Action = { + observable: Observable< + | { status: 'not-started' | 'stopped' } + | { + status: 'pending'; + intermediateValue: { requiredUserInteraction: string; step?: string }; + } + | { status: 'completed'; output: Output } + | { status: 'error'; error: unknown } + >; + cancel(): void; +}; + +export interface LedgerDmkOperation { + readonly dmk: DeviceManagementKit; + readonly sessionId: string; + readonly generation: number; + readonly signal: AbortSignal; + assertCurrent(): void; + runAction(createAction: () => Action): Promise; +} + +/** One owner and one semantic operation at a time, across EVM and UTXO apps. */ +export class LedgerDmkSession { + private generation = 0; + private sessionId: string | undefined; + private queue: Promise = Promise.resolve(); + private activeCancel: (() => void) | undefined; + private activeAbort: AbortController | undefined; + private closing: Promise = Promise.resolve(); + private stateSubscription: Subscription | undefined; + private connectionAttempt: Promise | undefined; + private connectionAbort: AbortController | undefined; + private readonly invalidationListeners = new Set<() => void>(); + + constructor(readonly dmk: DeviceManagementKit) {} + + getStatus() { + return { connected: this.sessionId !== undefined }; + } + + onInvalidated(listener: () => void): () => void { + this.invalidationListeners.add(listener); + return () => this.invalidationListeners.delete(listener); + } + + private invalidate(): void { + this.generation++; + for (const listener of this.invalidationListeners) listener(); + } + + /** Device selection belongs to the visible host, never to a dapp request. */ + connect( + request: { useGrantedDevices?: boolean } = {}, + options: LedgerOperationOptions = {} + ): Promise { + if (options.signal?.aborted) return Promise.reject(ledgerCancelledError()); + if (this.sessionId) return Promise.resolve(); + if (this.connectionAttempt) + return Promise.reject( + ledgerHostError( + 'HARDWARE_SIGNER_BUSY', + 'Ledger connection is already pending' + ) + ); + const controller = new AbortController(); + this.connectionAbort = controller; + const abort = () => controller.abort(); + options.signal?.addEventListener('abort', abort, { once: true }); + const attempt = this.connectDevice(request, controller.signal); + this.connectionAttempt = attempt; + return attempt.finally(() => { + options.signal?.removeEventListener('abort', abort); + if (this.connectionAttempt === attempt) + this.connectionAttempt = undefined; + if (this.connectionAbort === controller) this.connectionAbort = undefined; + }); + } + + private async connectDevice( + request: { useGrantedDevices?: boolean }, + signal: AbortSignal + ): Promise { + const generation = this.generation; + let subscription: Subscription | undefined; + const device = await new Promise((resolve, reject) => { + let settled = false; + const timer = request.useGrantedDevices + ? setTimeout( + () => + finish( + ledgerHostError( + 'HARDWARE_SIGNER_UNAVAILABLE', + 'Select a Ledger device in the Ledger window' + ) + ), + 3000 + ) + : undefined; + const finish = (error?: unknown, selected?: DiscoveredDevice) => { + if (settled) return; + settled = true; + if (timer) clearTimeout(timer); + subscription?.unsubscribe(); + signal.removeEventListener('abort', onAbort); + if (error) reject(error); + else resolve(selected!); + }; + const onAbort = () => finish(ledgerCancelledError()); + signal.addEventListener('abort', onAbort, { once: true }); + // Calling startDiscovering synchronously preserves the click's activation. + const discovery: Observable = + request.useGrantedDevices + ? this.dmk.listenToAvailableDevices({}) + : this.dmk.startDiscovering({}); + subscription = discovery.subscribe({ + next: (value) => { + const devices = Array.isArray(value) ? value : [value]; + if (!devices.length) return; + if (devices.length !== 1) { + finish( + ledgerHostError( + 'HARDWARE_SIGNER_AMBIGUOUS', + 'Select one Ledger device in the Ledger window' + ) + ); + return; + } + finish(undefined, devices[0]); + }, + error: (error) => finish(error), + complete: () => { + if (!settled) + finish( + ledgerHostError( + 'HARDWARE_SIGNER_UNAVAILABLE', + 'No Ledger device selected' + ) + ); + }, + }); + if (settled) subscription?.unsubscribe(); + }); + if (generation !== this.generation || signal.aborted) + throw ledgerCancelledError(); + await this.closing; + const sessionId = await this.dmk.connect({ device }); + if (generation !== this.generation || signal.aborted) { + await this.dmk.disconnect({ sessionId }).catch(() => undefined); + throw ledgerCancelledError(); + } + this.sessionId = sessionId; + this.stateSubscription = this.dmk + .getDeviceSessionState({ sessionId }) + .subscribe({ + complete: () => { + if (this.sessionId === sessionId) { + this.sessionId = undefined; + this.invalidate(); + this.activeAbort?.abort(); + this.activeCancel?.(); + } + }, + }); + } + + /** Cancel revokes the result and closes I/O; it cannot undo on-device approval. */ + disconnect(): Promise { + this.invalidate(); + this.connectionAbort?.abort(); + const sessionId = this.sessionId; + this.sessionId = undefined; + this.activeAbort?.abort(); + this.activeAbort = undefined; + this.activeCancel?.(); + this.activeCancel = undefined; + this.stateSubscription?.unsubscribe(); + this.stateSubscription = undefined; + this.closing = this.closing.then(async () => { + if (sessionId) + await this.dmk.disconnect({ sessionId }).catch(() => undefined); + }); + return this.closing; + } + + runExclusive( + operation: (session: LedgerDmkOperation) => Promise, + options: LedgerOperationOptions = {} + ): Promise { + const generation = this.generation; + const run = async () => { + await this.closing; + const sessionId = this.sessionId; + const assertCurrent = () => { + if (generation !== this.generation || options.signal?.aborted) + throw ledgerCancelledError(); + if (!sessionId || this.sessionId !== sessionId) + throw ledgerHostError( + 'HARDWARE_SIGNER_UNAVAILABLE', + 'Connect a Ledger device first' + ); + }; + assertCurrent(); + const controller = new AbortController(); + this.activeAbort = controller; + let rejectCancellation: (error: Error) => void = () => undefined; + const cancelled = new Promise((_, reject) => { + rejectCancellation = reject; + }); + controller.signal.addEventListener( + 'abort', + () => rejectCancellation(ledgerCancelledError()), + { once: true } + ); + const onAbort = () => { + rejectCancellation(ledgerCancelledError()); + void this.disconnect(); + }; + options.signal?.addEventListener('abort', onAbort, { once: true }); + try { + assertCurrent(); + const context: LedgerDmkOperation = { + dmk: this.dmk, + sessionId: sessionId!, + generation, + signal: controller.signal, + assertCurrent, + runAction: (createAction: () => Action) => { + assertCurrent(); + return this.awaitAction(createAction(), assertCurrent, options); + }, + }; + const result = await Promise.race([operation(context), cancelled]); + assertCurrent(); + return result; + } finally { + options.signal?.removeEventListener('abort', onAbort); + if (this.activeAbort === controller) this.activeAbort = undefined; + } + }; + const result = this.queue.then(run, run); + this.queue = result.catch(() => undefined); + return result; + } + + runAction( + createAction: (session: LedgerDmkOperation) => Action, + options?: LedgerOperationOptions + ): Promise { + return this.runExclusive( + (session) => session.runAction(() => createAction(session)), + options + ); + } + + private awaitAction( + action: Action, + assertCurrent: () => void, + options: LedgerOperationOptions + ): Promise { + return new Promise((resolve, reject) => { + let settled = false; + const subscription: { current?: Subscription } = {}; + const finish = (error?: unknown, output?: Output) => { + if (settled) return; + settled = true; + subscription.current?.unsubscribe(); + if (this.activeCancel === cancel) this.activeCancel = undefined; + if (error) reject(error); + else resolve(output as Output); + }; + const cancel = () => { + // cancel() may synchronously emit Stopped. Revoke this callback first + // so that a stale-state observer cannot recursively cancel it. + if (this.activeCancel === cancel) this.activeCancel = undefined; + try { + action.cancel(); + } catch { + // The generation is already revoked; cleanup cannot revive it. + } finally { + finish(ledgerCancelledError()); + } + }; + this.activeCancel = cancel; + subscription.current = action.observable.subscribe({ + next: (state) => { + try { + assertCurrent(); + options.onProgress?.({ + status: state.status, + ...(state.status === 'pending' + ? { + requiredUserInteraction: + state.intermediateValue.requiredUserInteraction, + ...(typeof state.intermediateValue.step === 'string' + ? { step: state.intermediateValue.step } + : {}), + } + : {}), + }); + switch (state.status) { + case 'completed': + finish(undefined, state.output); + break; + case 'error': + finish( + state.error ?? + ledgerHostError( + 'LEDGER_ACTION_FAILED', + 'Ledger action failed' + ) + ); + break; + case 'stopped': + finish(ledgerCancelledError()); + break; + } + } catch (error) { + // A broken progress consumer must not release our queue while the + // device still has a signing operation in flight. + void this.disconnect(); + finish(error); + } + }, + error: (error) => finish(error), + complete: () => { + if (!settled) + finish( + ledgerHostError( + 'LEDGER_INCOMPLETE_ACTION', + 'Ledger action ended without a result' + ) + ); + }, + }); + if (settled) subscription.current.unsubscribe(); + }); + } +} diff --git a/packages/sysweb3-keyring/src/ledger/dmk-utxo.ts b/packages/sysweb3-keyring/src/ledger/dmk-utxo.ts new file mode 100644 index 00000000..5c1c062c --- /dev/null +++ b/packages/sysweb3-keyring/src/ledger/dmk-utxo.ts @@ -0,0 +1,484 @@ +import { + ApduBuilder, + CallTaskInAppDeviceAction, + CommandResultFactory, + DeviceExchangeError, + DmkResultFactory, + InvalidResponseFormatError, + UserInteractionRequired, + isSuccessCommandResult, + type ApduResponse, + type Command, + type DmkError, + type InternalApi, +} from '@ledgerhq/device-management-kit'; +import { getNetworkConfig } from '@sidhujag/sysweb3-network'; +import { address, payments } from 'bitcoinjs-lib'; +import bs58check from 'bs58check'; +import * as syscoinjs from 'syscoinjs-lib'; + +import { + AppClient, + type BitcoinAppTransport, +} from './bitcoin_client/lib/appClient'; +import { WalletPolicy } from './bitcoin_client/lib/policy'; +import { PsbtV2 } from './bitcoin_client/lib/psbtv2'; +import { DESCRIPTOR } from './consts'; +import { LedgerDmkSession, type LedgerDmkOperation } from './dmk-session'; +import { + ledgerHostError, + type LedgerOperationOptions, + type LedgerUtxoAccount, + type LedgerUtxoHost, +} from './host-types'; +import { prepareLedgerPsbt } from './prepare-psbt'; +import { + getAccountDerivationPath, + getAddressDerivationPath, +} from '../utils/derivation-paths'; +import { + assertPsbtAccountScope, + parsePsbtAccountXpub, + type PsbtAccountScope, +} from '../utils/psbt-account-scope'; + +export class LedgerProtocolError extends DeviceExchangeError { + readonly statusCode: number; + readonly code: string; + + constructor(statusCode: number) { + super({ + tag: 'LedgerProtocolError', + errorCode: statusCode, + message: `Ledger returned status 0x${statusCode + .toString(16) + .padStart(4, '0')}`, + }); + this.statusCode = statusCode; + this.code = + statusCode === 0x6985 + ? 'HARDWARE_REQUEST_REJECTED' + : 'LEDGER_DEVICE_ERROR'; + } +} + +/** Preserves the existing Bitcoin/Syscoin APDU contract, including 0xe000. */ +export class LedgerBitcoinCommand implements Command { + readonly name = 'PaliBitcoinProtocol'; + + constructor( + private readonly cla: number, + private readonly ins: number, + private readonly p1: number, + private readonly p2: number, + private readonly data: Uint8Array = new Uint8Array(), + private readonly acceptedStatusCodes: number[] = [0x9000] + ) {} + + getApdu() { + const builder = new ApduBuilder({ + cla: this.cla, + ins: this.ins, + p1: this.p1, + p2: this.p2, + }); + builder.addBufferToData(this.data); + if (builder.getErrors().length) throw new Error('Invalid Ledger APDU'); + return builder.build(); + } + + parseResponse(response: ApduResponse) { + if (response.statusCode.length !== 2) + return CommandResultFactory({ + error: new InvalidResponseFormatError('Invalid Ledger status word'), + }); + const status = (response.statusCode[0] << 8) | response.statusCode[1]; + if (!this.acceptedStatusCodes.includes(status)) + return CommandResultFactory({ + error: new LedgerProtocolError(status), + }); + return CommandResultFactory({ + data: Buffer.concat([ + Buffer.from(response.data), + Buffer.from(response.statusCode), + ]), + }); + } +} + +/** Must be used inside a single DeviceAction; public dmk.sendCommand would requeue. */ +export function createBitcoinAppTransport( + internalApi: InternalApi, + assertCurrent: () => void +): BitcoinAppTransport { + return { + async send(cla, ins, p1, p2, data, acceptedStatusCodes) { + assertCurrent(); + const response = await internalApi.sendCommand( + new LedgerBitcoinCommand(cla, ins, p1, p2, data, acceptedStatusCodes) + ); + assertCurrent(); + if (!isSuccessCommandResult(response)) throw response.error; + return response.data; + }, + }; +} + +const childIndex = (value: number) => { + if (!Number.isSafeInteger(value) || value < 0 || value >= 0x80000000) + throw ledgerHostError( + 'LEDGER_INVALID_REQUEST', + 'Invalid Ledger account or address index' + ); +}; + +export function ledgerUtxoApp(request: LedgerUtxoAccount): string { + childIndex(request.accountIndex); + const currency = request.currency.toLowerCase(); + if ( + ['sys', 'tsys', 'syscoin'].includes(currency) && + [1, 57].includes(request.slip44) + ) + return 'Syscoin'; + if ( + ['btc', 'tbtc', 'bitcoin'].includes(currency) && + [0, 1].includes(request.slip44) + ) + return request.slip44 === 1 ? 'Bitcoin Test' : 'Bitcoin'; + throw ledgerHostError( + 'HARDWARE_SIGNER_UNAVAILABLE', + 'This Ledger UTXO app is not supported' + ); +} + +const publicKeyPayload = (xpub: string) => { + const payload = Buffer.from(bs58check.decode(xpub)); + if (payload.length !== 78 || ![2, 3].includes(payload[45])) + throw ledgerHostError( + 'LEDGER_INVALID_REQUEST', + 'Invalid Ledger account public key' + ); + return payload.subarray(4); // Ignore only the public version (xpub/zpub/vpub). +}; + +const checkedReceivingAddress = ( + xpub: string, + request: LedgerUtxoAccount, + deviceAddress: string +): string => { + try { + const testnet = request.slip44 === 1; + // Resolve the selected app's network explicitly; a mainnet currency alias + // with slip44 1 must not select the network helper's name-only fallback. + const coin = + ledgerUtxoApp(request) === 'Syscoin' + ? testnet + ? 'tSYS' + : 'SYS' + : testnet + ? 'tBTC' + : 'BTC'; + const config = getNetworkConfig(request.slip44, coin); + const network = testnet ? config.networks.testnet : config.networks.mainnet; + const publicKey = parsePsbtAccountXpub(xpub).derive(0).derive(0).publicKey; + const expected = payments.p2wpkh({ pubkey: publicKey, network }); + if ( + !expected.address || + !expected.output || + !Buffer.from(address.toOutputScript(deviceAddress, network)).equals( + Buffer.from(expected.output) + ) + ) + throw new Error('Address does not match the account'); + return expected.address; + } catch { + throw ledgerHostError( + 'LEDGER_INVALID_RESPONSE', + 'Ledger returned an address that does not match the account' + ); + } +}; + +const asDmkError = (error: unknown): DmkError => { + if (error && typeof error === 'object' && '_tag' in error) + return error as DmkError; + return Object.assign( + error instanceof Error ? error : new Error(String(error)), + { _tag: 'LedgerUtxoError' } + ); +}; + +export function createLedgerUtxoAdapter( + session: LedgerDmkSession +): LedgerUtxoHost { + const hmacs = new Map(); + session.onInvalidated(() => hmacs.clear()); + let cacheGeneration = -1; + + const run = async ( + request: Request, + interaction: UserInteractionRequired, + task: ( + client: AppClient, + operation: LedgerDmkOperation, + approved: Readonly + ) => Promise, + options?: LedgerOperationOptions + ): Promise => { + const approved = Object.freeze({ ...request }); + const appName = ledgerUtxoApp(approved); + return session.runExclusive( + (operation) => + operation.runAction(() => { + if (cacheGeneration !== operation.generation) { + hmacs.clear(); + cacheGeneration = operation.generation; + } + return operation.dmk.executeDeviceAction({ + sessionId: operation.sessionId, + deviceAction: new CallTaskInAppDeviceAction({ + input: { + appName, + skipOpenApp: false, + requiredUserInteraction: interaction, + task: async (internalApi: InternalApi) => { + try { + const client = new AppClient( + createBitcoinAppTransport( + internalApi, + operation.assertCurrent + ) + ); + const value = await task(client, operation, approved); + operation.assertCurrent(); + return DmkResultFactory({ data: value }); + } catch (error) { + return DmkResultFactory({ + error: asDmkError(error), + }); + } + }, + }, + }), + }); + }), + options + ); + }; + + const accountXpub = async ( + client: AppClient, + path: string + ): Promise => { + try { + return await client.getExtendedPubkey(path, false); + } catch (error) { + // GET_EXTENDED_PUBKEY returns SW_NOT_SUPPORTED for a path that + // requires on-device display. Never retry denial or transport errors. + if ((error as { statusCode?: number })?.statusCode !== 0x6a82) + throw error; + return client.getExtendedPubkey(path, true); + } + }; + + const account = async ( + client: AppClient, + request: LedgerUtxoAccount, + expectedXpub?: string + ) => { + const path = getAccountDerivationPath( + request.currency, + request.slip44, + request.accountIndex + ); + const fingerprint = await client.getMasterFingerprint(); + if (!/^[0-9a-f]{8}$/i.test(fingerprint)) + throw new Error('Invalid Ledger fingerprint'); + const xpub = await accountXpub(client, path); + const payload = publicKeyPayload(xpub); + if (expectedXpub && !payload.equals(publicKeyPayload(expectedXpub))) + throw ledgerHostError( + 'HARDWARE_ACCOUNT_MISMATCH', + 'Connected Ledger does not match the approved account' + ); + const policy = new WalletPolicy( + request.currency.toLowerCase(), + DESCRIPTOR, + [`[${fingerprint}${path.slice(1)}]${xpub}`] + ); + return { fingerprint, xpub, policy }; + }; + + const register = async ( + client: AppClient, + fingerprint: string, + policy: WalletPolicy, + options?: LedgerOperationOptions + ) => { + const key = `${fingerprint}|${policy.getId().toString('hex')}`; + const existing = hmacs.get(key); + if (existing) return existing; + options?.onProgress?.({ + status: 'pending', + requiredUserInteraction: 'register-wallet', + }); + const [id, hmac] = await client.registerWallet(policy); + if (!id.equals(policy.getId()) || hmac.length !== 32) + throw new Error('Invalid Ledger wallet registration'); + hmacs.set(key, hmac); + return hmac; + }; + + return { + getXpub: (request, options) => + run( + request, + request.checkOnDevice + ? UserInteractionRequired.VerifyAddress + : UserInteractionRequired.None, + (client, _operation, approved) => + client.getExtendedPubkey( + getAccountDerivationPath( + approved.currency, + approved.slip44, + approved.accountIndex + ), + !!approved.checkOnDevice + ), + options + ), + getAddress: (request, options) => + run( + request, + request.checkOnDevice + ? UserInteractionRequired.VerifyAddress + : UserInteractionRequired.None, + async (client, _operation, approved) => { + const { fingerprint, xpub, policy } = await account(client, approved); + const hmac = await register(client, fingerprint, policy, options); + const deviceAddress = await client.getWalletAddress( + policy, + hmac, + 0, + 0, + !!approved.checkOnDevice + ); + return checkedReceivingAddress(xpub, approved, deviceAddress); + }, + options + ), + getAccount: (request, options) => + run( + request, + request.checkOnDevice + ? UserInteractionRequired.VerifyAddress + : UserInteractionRequired.None, + async (client, _operation, approved) => { + const { fingerprint, xpub, policy } = await account(client, approved); + const hmac = await register(client, fingerprint, policy, options); + const deviceAddress = await client.getWalletAddress( + policy, + hmac, + 0, + 0, + !!approved.checkOnDevice + ); + const address = checkedReceivingAddress( + xpub, + approved, + deviceAddress + ); + return { fingerprint, xpub, address }; + }, + options + ), + signMessage: (request, options) => + run( + request, + UserInteractionRequired.SignPersonalMessage, + async (client, _operation, approved) => { + publicKeyPayload(approved.accountXpub); + await account(client, approved, approved.accountXpub); + childIndex(approved.addressIndex ?? 0); + return client.signMessage( + Buffer.from(approved.message), + getAddressDerivationPath( + approved.currency, + approved.slip44, + approved.accountIndex, + !!approved.change, + approved.addressIndex ?? 0 + ) + ); + }, + options + ), + signPsbt: async (request, options) => { + if (!request.psbtBase64 || request.psbtBase64.length > 4 * 1024 * 1024) + return Promise.reject( + ledgerHostError('LEDGER_INVALID_REQUEST', 'Invalid Ledger PSBT') + ); + const encoded = Buffer.from(request.psbtBase64, 'base64'); + if (encoded.toString('base64') !== request.psbtBase64) + return Promise.reject( + ledgerHostError( + 'LEDGER_INVALID_REQUEST', + 'Invalid Ledger PSBT encoding' + ) + ); + // Preserve the Syscoin fork's transaction and asset serialization. + const psbt = (syscoinjs.utils as any).bitcoinjs.Psbt.fromBase64( + request.psbtBase64 + ); + const scope = { + account: { address: '', xpub: request.accountXpub }, + accountId: request.accountIndex, + accountType: 'Ledger', + network: { currency: request.currency, slip44: request.slip44 }, + } as PsbtAccountScope; + assertPsbtAccountScope(psbt, scope); + return run( + request, + UserInteractionRequired.SignTransaction, + async (client, _operation, approved) => { + const { fingerprint, policy } = await account( + client, + approved, + approved.accountXpub + ); + prepareLedgerPsbt( + psbt, + approved.accountXpub, + approved.accountIndex, + approved.currency, + approved.slip44, + fingerprint + ); + assertPsbtAccountScope(psbt, scope); + const hmac = await register(client, fingerprint, policy, options); + options?.onProgress?.({ + status: 'pending', + requiredUserInteraction: 'sign-transaction', + }); + const signatures = await client.signPsbt( + new PsbtV2().fromBitcoinJS(psbt), + policy, + hmac + ); + return { + fingerprint, + signatures: signatures.map(([inputIndex, signature]) => ({ + inputIndex, + pubkeyHex: signature.pubkey.toString('hex'), + signatureHex: signature.signature.toString('hex'), + ...(signature.tapleafHash + ? { tapleafHashHex: signature.tapleafHash.toString('hex') } + : {}), + })), + }; + }, + options + ); + }, + }; +} diff --git a/packages/sysweb3-keyring/src/ledger/host-types.ts b/packages/sysweb3-keyring/src/ledger/host-types.ts new file mode 100644 index 00000000..2aade1d3 --- /dev/null +++ b/packages/sysweb3-keyring/src/ledger/host-types.ts @@ -0,0 +1,155 @@ +/** Serializable Ledger requests. This module must remain free of device SDK imports. */ +export interface LedgerProgress { + status: 'not-started' | 'pending' | 'stopped' | 'completed' | 'error'; + requiredUserInteraction?: string; + step?: string; +} + +export interface LedgerOperationOptions { + signal?: AbortSignal; + onProgress?: (progress: LedgerProgress) => void; +} + +export interface LedgerUtxoAccount { + currency: string; + slip44: number; + accountIndex: number; +} + +export interface LedgerPartialSignature { + inputIndex: number; + pubkeyHex: string; + signatureHex: string; + tapleafHashHex?: string; +} + +export interface LedgerTypedData { + domain: Record; + types: Record; + primaryType: string; + message: Record; +} + +export type LedgerBlindSigningIntent = Readonly< + | { + kind: 'transaction'; + accountIndex: number; + derivationPath: string; + expectedAddress: string; + unsignedTxHex: string; + chainId: string; + digest: string; + } + | { + kind: 'typed-data'; + accountIndex: number; + derivationPath: string; + expectedAddress: string; + version: 'V3' | 'V4'; + data: LedgerTypedData; + digest: string; + } +>; + +/** Trusted host policy, never a field accepted from a dapp request. */ +export interface LedgerEvmConfig { + /** + * The public DSK may fall back to blind signing. The host must disclose that + * limitation and approve this exact intent each time. No callback means deny. + */ + confirmBlindSigning?: ( + intent: LedgerBlindSigningIntent, + signal: AbortSignal + ) => boolean | Promise; +} + +export interface LedgerEvmHost { + getAddress( + request: { + accountIndex: number; + checkOnDevice?: boolean; + chainId?: number; + }, + options?: LedgerOperationOptions + ): Promise<{ address: string; publicKey: string }>; + signTransaction( + request: { + accountIndex: number; + unsignedTxHex: string; + expectedAddress: string; + }, + options?: LedgerOperationOptions + ): Promise<{ r: string; s: string; v: string }>; + signPersonalMessage( + request: { + accountIndex: number; + messageHex: string; + expectedAddress: string; + }, + options?: LedgerOperationOptions + ): Promise; + signTypedData( + request: { + accountIndex: number; + version: 'V3' | 'V4'; + data: LedgerTypedData; + expectedAddress: string; + }, + options?: LedgerOperationOptions + ): Promise; +} + +export interface LedgerUtxoHost { + getXpub( + request: LedgerUtxoAccount & { checkOnDevice?: boolean }, + options?: LedgerOperationOptions + ): Promise; + getAddress( + request: LedgerUtxoAccount & { checkOnDevice?: boolean }, + options?: LedgerOperationOptions + ): Promise; + getAccount( + request: LedgerUtxoAccount & { checkOnDevice?: boolean }, + options?: LedgerOperationOptions + ): Promise<{ xpub: string; fingerprint: string; address: string }>; + signMessage( + request: LedgerUtxoAccount & { + message: string; + addressIndex?: number; + change?: boolean; + accountXpub: string; + }, + options?: LedgerOperationOptions + ): Promise; + signPsbt( + request: LedgerUtxoAccount & { + psbtBase64: string; + accountXpub: string; + }, + options?: LedgerOperationOptions + ): Promise<{ fingerprint: string; signatures: LedgerPartialSignature[] }>; +} + +/** The wallet authority injects this port; an absent host never opens a device. */ +export interface LedgerHost { + connect( + request?: { useGrantedDevices?: boolean }, + options?: LedgerOperationOptions + ): Promise; + disconnect(): Promise; + getStatus(): { connected: boolean }; + readonly evm: LedgerEvmHost; + readonly utxo: LedgerUtxoHost; +} + +export function ledgerHostError( + code: string, + message: string +): Error & { + code: string; +} { + return Object.assign(new Error(message), { code }); +} + +export const ledgerCancelledError = () => + ledgerHostError('HARDWARE_REQUEST_CANCELLED', 'Ledger request cancelled'); diff --git a/packages/sysweb3-keyring/src/ledger/index.ts b/packages/sysweb3-keyring/src/ledger/index.ts index 47dad6fa..990a3b7e 100644 --- a/packages/sysweb3-keyring/src/ledger/index.ts +++ b/packages/sysweb3-keyring/src/ledger/index.ts @@ -1,469 +1,348 @@ -/* eslint-disable camelcase */ -/* eslint-disable import/no-named-as-default */ -/* eslint-disable import/order */ -import Transport from '@ledgerhq/hw-transport'; -import SysUtxoClient, { DefaultWalletPolicy } from './bitcoin_client'; +import { SignTypedDataVersion, TypedDataUtils } from '@metamask/eth-sig-util'; import { - DESCRIPTOR, - RECEIVING_ADDRESS_INDEX, - WILL_NOT_DISPLAY, -} from './consts'; -import { fromBase58 } from '@trezor/utxo-lib/lib/bip32'; -import { IEvmMethods, IUTXOMethods, MessageTypes } from './types'; -import LedgerEthClient, { ledgerService } from '@ledgerhq/hw-app-eth'; -import { TypedDataUtils, TypedMessage, Version } from 'eth-sig-util'; -import { - getAccountDerivationPath, - getAddressDerivationPath, - isEvmCoin, -} from '../utils/derivation-paths'; -import { Transaction } from 'syscoinjs-lib'; + computeAddress, + getAddress, + hashMessage, + recoverAddress, + Signature, + Transaction, +} from 'ethers'; + import { - HardwareWalletManager, + ConnectionStatus, HardwareWalletType, } from '../hardware-wallet-manager'; +import { ledgerCancelledError, ledgerHostError } from './host-types'; + +import type { HardwareWalletManager } from '../hardware-wallet-manager'; +import type { LedgerHost, LedgerTypedData, LedgerUtxoHost } from './host-types'; +import type { IEvmMethods, IUTXOMethods } from './types'; + +const invalidRequest = () => + ledgerHostError('LEDGER_INVALID_REQUEST', 'Invalid Ledger signing request'); +const invalidSignature = () => + ledgerHostError( + 'LEDGER_INVALID_SIGNATURE', + 'Ledger returned an invalid signature for this request' + ); + +const accountIndex = (value: number) => { + if (!Number.isSafeInteger(value) || value < 0 || value > 0x7fffffff) + throw invalidRequest(); + return value; +}; +const hexBytes = (value: string): Uint8Array => { + if (typeof value !== 'string' || !/^(?:0x)?(?:[0-9a-f]{2})*$/i.test(value)) + throw invalidRequest(); + return Uint8Array.from(Buffer.from(value.replace(/^0x/i, ''), 'hex')); +}; +const approvedAddress = (value: string) => { + try { + return getAddress(value); + } catch { + throw invalidRequest(); + } +}; +const checkedSignature = ( + value: string | { r: string; s: string; v: string }, + digest: string, + expected: string +) => { + try { + let signature: Signature; + if (typeof value === 'string') { + if (!/^0x[0-9a-f]{130}$/i.test(value)) throw invalidSignature(); + signature = Signature.from(value); + } else { + if ( + !value || + !/^[0-9a-f]{64}$/i.test(value.r) || + !/^[0-9a-f]{64}$/i.test(value.s) || + !/^[0-9a-f]+$/i.test(value.v) + ) + throw invalidSignature(); + const v = Number.parseInt(value.v, 16); + if (!Number.isSafeInteger(v) || v < 0) throw invalidSignature(); + signature = Signature.from({ r: `0x${value.r}`, s: `0x${value.s}`, v }); + } + if (recoverAddress(digest, signature) !== expected) + throw invalidSignature(); + return signature; + } catch { + throw invalidSignature(); + } +}; +// Detach the approved typed data before connection or host code can await/mutate it. +const copyTypedData = ( + value: unknown, + seen = new WeakSet(), + depth = 0 +): any => { + if (depth > 64) throw invalidRequest(); + if (value === null || typeof value === 'string' || typeof value === 'boolean') + return value; + if (typeof value === 'bigint') return value.toString(); + if (typeof value === 'number') { + if (!Number.isFinite(value)) throw invalidRequest(); + return value; + } + if (value instanceof Uint8Array) + return `0x${Buffer.from(value).toString('hex')}`; + if (!value || typeof value !== 'object' || seen.has(value)) + throw invalidRequest(); + const array = Array.isArray(value); + const prototype = Object.getPrototypeOf(value); + if (!array && prototype !== Object.prototype && prototype !== null) + throw invalidRequest(); + seen.add(value); + try { + const result: any = array ? [] : Object.create(null); + for (const key of Object.keys(value)) { + const descriptor = Object.getOwnPropertyDescriptor(value, key)!; + if (!('value' in descriptor)) throw invalidRequest(); + if (descriptor.value !== undefined) + result[key] = copyTypedData(descriptor.value, seen, depth + 1); + } + return Object.freeze(result); + } finally { + seen.delete(value); + } +}; +/** Small authority-side facade. Device SDKs belong exclusively in ledger-host. */ export class LedgerKeyring { - public ledgerEVMClient!: LedgerEthClient; - public ledgerUtxoClient!: SysUtxoClient; - private hdPath = "m/44'/57'/0'/0/0"; - public evm: IEvmMethods; - public utxo: IUTXOMethods; - public transport: Transport | null = null; - private hardwareWalletManager: HardwareWalletManager; - - constructor() { - this.hardwareWalletManager = new HardwareWalletManager(); - - // Set up event listeners - this.hardwareWalletManager.on('connected', ({ type }) => { - if (type === HardwareWalletType.LEDGER) { - console.log('Ledger connected'); - } - }); - - this.hardwareWalletManager.on('disconnected', ({ type }) => { - if (type === HardwareWalletType.LEDGER) { - console.log('Ledger disconnected'); - this.transport = null; - // Clear clients on disconnect - this.ledgerEVMClient = null as any; - this.ledgerUtxoClient = null as any; - } - }); - - this.hardwareWalletManager.on('connectionFailed', ({ type, error }) => { - if (type === HardwareWalletType.LEDGER) { - console.error('Ledger connection failed:', error); - } - }); - + public readonly evm: IEvmMethods; + public readonly utxo: IUTXOMethods; + private generation = 0; + + // Retain the first constructor position for existing shared-manager callers. + // A manager alone cannot grant a new device capability. + constructor( + private readonly sharedHardwareWalletManager?: HardwareWalletManager, + private readonly host?: LedgerHost + ) { this.evm = { - getEvmAddressAndPubKey: this.getEvmAddressAndPubKey, - signEVMTransaction: this.signEVMTransaction, - signPersonalMessage: this.signPersonalMessage, - signTypedData: this.signTypedData, + getEvmAddressAndPubKey: async (request) => { + const approved = { accountIndex: accountIndex(request.accountIndex) }; + return this.run(async (host, assertCurrent) => { + const result = await host.evm.getAddress(approved); + assertCurrent(); + try { + const address = getAddress(result.address); + const publicKey = result.publicKey.replace(/^0x/i, ''); + if (computeAddress(`0x${publicKey}`) !== address) + throw invalidRequest(); + return { address, publicKey }; + } catch { + throw ledgerHostError( + 'LEDGER_INVALID_RESPONSE', + 'Ledger returned an invalid address or public key' + ); + } + }); + }, + signEVMTransaction: async (request) => { + const index = accountIndex(request.accountIndex); + const expected = approvedAddress(request.expectedAddress); + let transaction: Transaction; + try { + transaction = Transaction.from( + `0x${Buffer.from(hexBytes(request.rawTx)).toString('hex')}` + ); + if (transaction.signature || transaction.chainId <= 0n) + throw invalidRequest(); + } catch { + throw invalidRequest(); + } + const approved = { + accountIndex: index, + expectedAddress: expected, + unsignedTxHex: transaction.unsignedSerialized.replace(/^0x/, ''), + }; + const digest = transaction.unsignedHash; + return this.run(async (host, assertCurrent) => { + const result = await host.evm.signTransaction(approved); + assertCurrent(); + const signature = checkedSignature(result, digest, expected); + if ( + signature.legacyChainId !== null && + signature.legacyChainId !== transaction.chainId + ) + throw invalidSignature(); + return { + r: signature.r.slice(2), + s: signature.s.slice(2), + v: signature.v.toString(16), + }; + }); + }, + signPersonalMessage: async (request) => { + const expected = approvedAddress(request.expectedAddress); + const messageHex = Buffer.from(hexBytes(request.message)).toString( + 'hex' + ); + const digest = hashMessage(hexBytes(messageHex)); + const approved = { + accountIndex: accountIndex(request.accountIndex), + expectedAddress: expected, + messageHex, + }; + return this.run( + async (host) => + checkedSignature( + await host.evm.signPersonalMessage(approved), + digest, + expected + ).serialized + ); + }, + signTypedData: async (request) => { + const { version } = request; + if ( + version !== SignTypedDataVersion.V3 && + version !== SignTypedDataVersion.V4 + ) + throw invalidRequest(); + const expected = approvedAddress(request.expectedAddress); + const index = accountIndex(request.accountIndex); + let data: LedgerTypedData, digest: string; + try { + data = copyTypedData(request.data); + digest = `0x${TypedDataUtils.eip712Hash( + data as any, + version + ).toString('hex')}`; + } catch { + throw invalidRequest(); + } + const approved = { + accountIndex: index, + expectedAddress: expected, + data, + version, + }; + return this.run( + async (host) => + checkedSignature( + await host.evm.signTypedData(approved), + digest, + expected + ).serialized + ); + }, }; - this.utxo = { - getUtxoAddress: this.getUtxoAddress, - getXpub: this.getXpub, + getUtxoAddress: ({ coin, index, slip44 }) => + this.run((host) => + host.utxo.getAddress({ currency: coin, accountIndex: index, slip44 }) + ), + getXpub: ({ coin, index, slip44 }) => + this.run((host) => + host.utxo.getXpub({ + currency: coin, + accountIndex: index, + slip44, + // Import must remain available for paths the device classifies as + // unusual. Ask for its confirmation once, without retrying denial. + checkOnDevice: true, + }) + ), verifyUtxoAddress: this.verifyUtxoAddress, }; } - /** - * Ensure Ledger is connected with automatic retry - * Note: This is automatically called by all operations through executeWithRetry - * External callers don't need to call this directly - */ - public async ensureConnection(): Promise { - await this.hardwareWalletManager.ensureConnection( - HardwareWalletType.LEDGER - ); - this.transport = await this.hardwareWalletManager.getLedgerConnection(); - - // Create clients if transport is available - if (this.transport && (!this.ledgerEVMClient || !this.ledgerUtxoClient)) { - this.ledgerEVMClient = new LedgerEthClient(this.transport); - this.ledgerUtxoClient = new SysUtxoClient(this.transport); - } - } - - private getUtxoAddress = async ({ - coin, - index, // account index - slip44, - showInLedger, - }: { - coin: string; - index: number; - showInLedger?: boolean; - slip44: number; - }) => { - return this.executeWithRetry(async () => { - const fingerprint = await this.ledgerUtxoClient.getMasterFingerprint(); - const xpub = await this.getXpub({ index, coin, slip44 }); - this.setHdPath(coin, index, slip44); - - const xpubWithDescriptor = `[${this.hdPath}]${xpub}`.replace( - 'm', - fingerprint - ); - const walletPolicy = new DefaultWalletPolicy( - DESCRIPTOR, - xpubWithDescriptor + private requireHost(): LedgerHost { + if (!this.host) + throw ledgerHostError( + 'HARDWARE_SIGNER_UNAVAILABLE', + 'Ledger requires an authorized device host' ); - - const address = await this.ledgerUtxoClient.getWalletAddress( - walletPolicy, - null, - RECEIVING_ADDRESS_INDEX, - index, - showInLedger ? showInLedger : WILL_NOT_DISPLAY - ); - - return address; - }, 'getUtxoAddress'); - }; - - public verifyUtxoAddress = async ( - accountIndex: number, - currency: string, - slip44: number - ) => - await this.getUtxoAddress({ - coin: currency, - index: accountIndex, - slip44: slip44, - showInLedger: true, - }); - - private getXpub = async ({ - index, - coin, - slip44, - }: { - coin: string; - index: number; - slip44: number; - }): Promise => { - return this.executeWithRetry(async () => { - this.setHdPath(coin, index, slip44); - const xpub = await this.ledgerUtxoClient.getExtendedPubkey( - this.hdPath, - WILL_NOT_DISPLAY - ); - - // Always return raw xpub - descriptor format is built inline where needed - return xpub; - }, 'getXpub'); - }; - - /** - * Sign a UTXO message - public method used by transaction classes - */ - public signUtxoMessage = async (path: string, message: string) => { - return this.executeWithRetry(async () => { - const bufferMessage = Buffer.from(message); - const signature = await this.ledgerUtxoClient.signMessage( - bufferMessage, - path - ); - return signature; - }, 'signUtxoMessage'); - }; - - private signEVMTransaction = async ({ - rawTx, - accountIndex, - }: { - accountIndex: number; - rawTx: string; - }) => { - return this.executeWithRetry(async () => { - this.setHdPath('eth', accountIndex, 60); - const resolution = await ledgerService.resolveTransaction(rawTx, {}, {}); - - const signature = await this.ledgerEVMClient.signTransaction( - this.hdPath.replace(/^m\//, ''), // Remove 'm/' prefix for EVM - rawTx, - resolution - ); - - return signature; - }, 'signEVMTransaction'); - }; - - private signPersonalMessage = async ({ - message, - accountIndex, - }: { - accountIndex: number; - message: string; - }) => { - return this.executeWithRetry(async () => { - this.setHdPath('eth', accountIndex, 60); - - const signature = await this.ledgerEVMClient.signPersonalMessage( - this.hdPath.replace(/^m\//, ''), // Remove 'm/' prefix for EVM - message - ); - - return `0x${signature.r}${signature.s}${signature.v.toString(16)}`; - }, 'signPersonalMessage'); - }; - - private sanitizeData(data: any): any { - switch (Object.prototype.toString.call(data)) { - case '[object Object]': { - const entries = Object.keys(data).map((k) => [ - k, - this.sanitizeData(data[k]), - ]); - return Object.fromEntries(entries); - } - - case '[object Array]': - return data.map((v: any[]) => this.sanitizeData(v)); - - case '[object BigInt]': - return data.toString(); - - default: - return data; - } + return this.host; } - private transformTypedData = ( - data: TypedMessage, - metamaskV4Compat: boolean - ) => { - if (!metamaskV4Compat) { - throw new Error( - 'Ledger: Only version 4 of typed data signing is supported' - ); - } - - const { types, primaryType, domain, message } = this.sanitizeData(data); - - const domainSeparatorHash = TypedDataUtils.hashStruct( - 'EIP712Domain', - this.sanitizeData(domain), - types, - true - ).toString('hex'); - - let messageHash: string | null = null; - - if (primaryType !== 'EIP712Domain') { - messageHash = TypedDataUtils.hashStruct( - primaryType as string, - this.sanitizeData(message), - types, - true - ).toString('hex'); - } - - return { - domain_separator_hash: domainSeparatorHash, - message_hash: messageHash, - ...data, + private async run( + operation: (host: LedgerHost, assertCurrent: () => void) => Promise + ): Promise { + const generation = this.generation; + const host = this.requireHost(); + // A visible platform host owns discovery, permission and device selection. + if (!host.getStatus().connected) + await host.connect({ useGrantedDevices: true }); + const assertCurrent = () => { + if (generation !== this.generation) throw ledgerCancelledError(); }; - }; - - private getEvmAddressAndPubKey = async ({ - accountIndex, - }: { - accountIndex: number; - }): Promise<{ address: string; publicKey: string }> => { - return this.executeWithRetry(async () => { - this.setHdPath('eth', accountIndex, 60); - const { address, publicKey } = await this.ledgerEVMClient.getAddress( - this.hdPath.replace(/^m\//, '') // Remove 'm/' prefix for EVM - ); - return { address, publicKey }; - }, 'getEvmAddressAndPubKey'); - }; - - private signTypedData = async ({ - version, - data, - accountIndex, - }: { - accountIndex: number; - data: any; - version: Version; - }) => { - return this.executeWithRetry(async () => { - this.setHdPath('eth', accountIndex, 60); - const dataWithHashes = this.transformTypedData(data, version === 'V4'); - - const { domain_separator_hash, message_hash } = dataWithHashes; - - const signature = await this.ledgerEVMClient.signEIP712HashedMessage( - this.hdPath.replace(/^m\//, ''), // Remove 'm/' prefix for EVM - domain_separator_hash, - message_hash ? message_hash : '' - ); - - return `0x${signature.r}${signature.s}${signature.v.toString(16)}`; - }, 'signTypedData'); - }; - - private getMasterFingerprint = async () => { + assertCurrent(); try { - const masterFingerprint = - await this.ledgerUtxoClient.getMasterFingerprint(); - return masterFingerprint; + const result = await operation(host, assertCurrent); + assertCurrent(); + return result; } catch (error) { - console.log('Fingerprint error: ', error); + assertCurrent(); throw error; } - }; - - private setHdPath(coin: string, accountIndex: number, slip44: number) { - if (isEvmCoin(coin, slip44)) { - // For EVM, the "accountIndex" parameter is actually used as the address index - // EVM typically uses account 0, and different addresses are at different address indices - this.hdPath = getAddressDerivationPath( - coin, - slip44, - 0, // account is always 0 for EVM - false, // not a change address - accountIndex // this is actually the address index for EVM - ); - } else { - // For UTXO, use account-level derivation path - this.hdPath = getAccountDerivationPath(coin, slip44, accountIndex); - } } - /** - * Convert PSBT to Ledger format with retry logic - */ - public async convertToLedgerFormat( - psbt: any, - accountXpub: string, - accountId: number, + public ensureConnection = async (): Promise => + this.run(async () => undefined); + + public verifyUtxoAddress = ( + accountIndex: number, currency: string, slip44: number - ): Promise { - return this.executeWithRetry(async () => { - // Ensure Ledger is connected before attempting operations - // This is now handled by executeWithRetry - - // Create BIP32 node from account xpub - const accountNode = fromBase58(accountXpub); - - // Get master fingerprint - const fingerprint = await this.getMasterFingerprint(); - - // Enhance each input with bip32Derivation - for (let i = 0; i < psbt.inputCount; i++) { - const dataInput = psbt.data.inputs[i]; - - // Skip if already has bip32Derivation - if (dataInput.bip32Derivation && dataInput.bip32Derivation.length > 0) { - continue; - } - - // Ensure witnessUtxo is present if nonWitnessUtxo exists - if (!dataInput.witnessUtxo && dataInput.nonWitnessUtxo) { - const txBuffer = dataInput.nonWitnessUtxo; - const tx = Transaction.fromBuffer(txBuffer); - const vout = psbt.txInputs[i].index; - - if (tx.outs[vout]) { - dataInput.witnessUtxo = { - script: tx.outs[vout].script, - value: tx.outs[vout].value, - }; - } - } - - // Extract path from unknownKeyVals - if ( - dataInput.unknownKeyVals && - dataInput.unknownKeyVals.length > 1 && - dataInput.unknownKeyVals[1].key.equals(Buffer.from('path')) - ) { - const fullPath = dataInput.unknownKeyVals[1].value.toString(); - const accountPath = getAccountDerivationPath( - currency, - slip44, - accountId - ); - const relativePath = fullPath - .replace(accountPath, '') - .replace(/^\//, ''); - const derivationTokens = relativePath.split('/').filter((t) => t); - - const derivedAccount = derivationTokens.reduce( - (acc: any, token: string) => { - const index = parseInt(token); - if (isNaN(index)) { - return acc; - } - return acc.derive(index); - }, - accountNode - ); - - const pubkey = derivedAccount.publicKey; - - if (pubkey && Buffer.isBuffer(pubkey)) { - // Add the bip32Derivation that Ledger needs - const bip32Derivation = { - masterFingerprint: Buffer.from(fingerprint, 'hex'), - path: fullPath, - pubkey: pubkey, - }; - - psbt.updateInput(i, { - bip32Derivation: [bip32Derivation], - }); - } - } - } - - return psbt; - }, 'convertToLedgerFormat'); - } + ): Promise => + this.run((host) => + host.utxo.getAddress({ + accountIndex, + currency, + slip44, + checkOnDevice: true, + }) + ); - /** - * Execute operation with automatic retry - */ - private async executeWithRetry( - operation: () => Promise, - operationName: string - ): Promise { - // Ensure connection first - await this.ensureConnection(); + public signUtxoMessage = ( + request: Parameters[0] + ): Promise => { + const approved = Object.freeze({ + currency: request.currency, + slip44: request.slip44, + accountIndex: request.accountIndex, + message: request.message, + addressIndex: request.addressIndex, + change: request.change, + accountXpub: request.accountXpub, + }); + return this.run((host) => host.utxo.signMessage(approved)); + }; - // Use hardware wallet manager's retry mechanism - return this.hardwareWalletManager.retryOperation(operation, operationName, { - maxRetries: 3, - baseDelay: 1000, - maxDelay: 5000, - backoffMultiplier: 2, + public signPsbt = ( + request: Parameters[0] + ): ReturnType => { + const approved = Object.freeze({ + currency: request.currency, + slip44: request.slip44, + accountIndex: request.accountIndex, + accountXpub: request.accountXpub, + psbtBase64: request.psbtBase64, }); - } + return this.run((host) => host.utxo.signPsbt(approved)); + }; - /** - * Get hardware wallet status - */ public getStatus() { - return this.hardwareWalletManager - .getStatus() - .find((s) => s.type === HardwareWalletType.LEDGER); + const connected = this.host?.getStatus().connected === true; + return { + type: HardwareWalletType.LEDGER, + connected, + status: connected + ? ConnectionStatus.CONNECTED + : ConnectionStatus.DISCONNECTED, + }; } - /** - * Clean up resources - */ - public async destroy() { - await this.hardwareWalletManager.destroy(); - this.transport = null; + public async destroy(): Promise { + // Revoke pending responses synchronously, before platform teardown awaits. + this.generation++; + const cleanup = this.sharedHardwareWalletManager?.destroy(); + const disconnect = this.host?.disconnect(); + await Promise.all([cleanup, disconnect]); } } diff --git a/packages/sysweb3-keyring/src/ledger/prepare-psbt.ts b/packages/sysweb3-keyring/src/ledger/prepare-psbt.ts new file mode 100644 index 00000000..fbcf97c4 --- /dev/null +++ b/packages/sysweb3-keyring/src/ledger/prepare-psbt.ts @@ -0,0 +1,181 @@ +import { Buffer } from 'buffer'; +import type { Psbt } from 'bitcoinjs-lib'; +import * as syscoinjs from 'syscoinjs-lib'; + +import { getAccountDerivationPath } from '../utils/derivation-paths'; +import { parsePsbtAccountXpub } from '../utils/psbt-account-scope'; + +const Transaction = (syscoinjs.utils as any).bitcoinjs.Transaction; + +/** Enrich public PSBT metadata only. Callers must also enforce account scope. */ +export function prepareLedgerPsbt( + psbt: Psbt, + accountXpub: string, + accountId: number, + currency: string, + slip44: number, + fingerprint: string +): Psbt { + if (!/^[0-9a-fA-F]{8}$/.test(fingerprint)) + throw new Error('Invalid Ledger master fingerprint'); + const accountNode = parsePsbtAccountXpub(accountXpub); + + // Enhance each input with bip32Derivation + const missingInputDerivations: number[] = []; + for (let i = 0; i < psbt.inputCount; i++) { + const dataInput = psbt.data.inputs[i]; + + // External inputs are already authorized by their final scripts. Do + // not invent wallet derivations or ask the device to sign them again. + if (dataInput.finalScriptSig || dataInput.finalScriptWitness) continue; + + // Skip if already has bip32Derivation + if (dataInput.bip32Derivation && dataInput.bip32Derivation.length > 0) { + // Scope validation has already limited these hints to the approved account. + for (const derivation of dataInput.bip32Derivation) + derivation.masterFingerprint = Buffer.from(fingerprint, 'hex'); + continue; + } + + // Ensure witnessUtxo is present if nonWitnessUtxo exists + if (!dataInput.witnessUtxo && dataInput.nonWitnessUtxo) { + const txBuffer = dataInput.nonWitnessUtxo; + const tx = Transaction.fromBuffer(txBuffer); + const vout = psbt.txInputs[i].index; + + if (tx.outs[vout]) { + dataInput.witnessUtxo = { + script: tx.outs[vout].script, + value: tx.outs[vout].value, + }; + } + } + + // Extract path from unknownKeyVals by searching for the key, not using hardcoded index + let pathFromInput: string | null = null; + if (dataInput.unknownKeyVals && dataInput.unknownKeyVals.length > 0) { + for (const kv of dataInput.unknownKeyVals) { + const keyStr = Buffer.from(kv.key).toString(); + if (keyStr === 'path') { + pathFromInput = Buffer.from(kv.value).toString(); + break; + } + } + } + let bip32Derivation: any = null; + if (pathFromInput) { + const fullPath = pathFromInput; + const accountPath = getAccountDerivationPath(currency, slip44, accountId); + const relativePath = fullPath.replace(accountPath, '').replace(/^\//, ''); + const derivationTokens = relativePath.split('/').filter((t) => t); + + const derivedAccount = derivationTokens.reduce( + (acc: any, token: string) => { + const index = parseInt(token); + if (isNaN(index)) { + return acc; + } + return acc.derive(index); + }, + accountNode + ); + + const rawPubkey = derivedAccount.publicKey; + const pubkeyBuf = Buffer.isBuffer(rawPubkey) + ? rawPubkey + : Buffer.from(rawPubkey); + + if (pubkeyBuf && pubkeyBuf.length === 33) { + // Add the bip32Derivation that Ledger needs + bip32Derivation = { + masterFingerprint: Buffer.from(fingerprint, 'hex'), + path: fullPath, + pubkey: pubkeyBuf, + }; + + psbt.updateInput(i, { + bip32Derivation: [bip32Derivation], + }); + } + } + // Check the updated PSBT state (avoid stale local references) + const updatedInput = psbt.data.inputs[i]; + if ( + !updatedInput.bip32Derivation || + updatedInput.bip32Derivation.length === 0 + ) { + missingInputDerivations.push(i); + } + } + + // Enhance each output with bip32Derivation when it's a change/output owned by the wallet + for (let i = 0; i < psbt.data.outputs.length; i++) { + const dataOutput = psbt.data.outputs[i]; + + // Skip if derivation already present + if (dataOutput.bip32Derivation && dataOutput.bip32Derivation.length > 0) { + continue; + } + + // Extract path from unknownKeyVals by searching for the key 'path' + let pathFromOutput: string | null = null; + if (dataOutput.unknownKeyVals && dataOutput.unknownKeyVals.length > 0) { + for (const kv of dataOutput.unknownKeyVals) { + const keyStr = Buffer.from(kv.key).toString(); + if (keyStr === 'path') { + pathFromOutput = Buffer.from(kv.value).toString(); + break; + } + } + } + if (pathFromOutput) { + let bip32Derivation: any = null; + const fullPath = pathFromOutput; + const accountPath = getAccountDerivationPath(currency, slip44, accountId); + const relativePath = fullPath.replace(accountPath, '').replace(/^\//, ''); + const derivationTokens = relativePath.split('/').filter((t) => t); + + const derivedAccount = derivationTokens.reduce( + (acc: any, token: string) => { + const index = parseInt(token); + if (isNaN(index)) { + return acc; + } + return acc.derive(index); + }, + accountNode + ); + + const rawOutPubkey = derivedAccount.publicKey; + const outPubkeyBuf = Buffer.isBuffer(rawOutPubkey) + ? rawOutPubkey + : Buffer.from(rawOutPubkey); + + if (outPubkeyBuf && outPubkeyBuf.length === 33) { + bip32Derivation = { + masterFingerprint: Buffer.from(fingerprint, 'hex'), + path: fullPath, + pubkey: outPubkeyBuf, + }; + + psbt.updateOutput(i, { + bip32Derivation: [bip32Derivation], + }); + } + // Outputs without valid derivation are allowed (external recipients) + } + } + + // If any wallet-owned inputs/outputs are missing bip32Derivation, fail early with a clear error + if (missingInputDerivations.length > 0) { + const parts: string[] = []; + parts.push(`inputs [${missingInputDerivations.join(', ')}]`); + throw new Error( + `convertToLedgerFormat: Missing bip32Derivation for ${parts.join( + ' and ' + )}. Ensure PSBT includes a 'path' unknownKeyVal or BIP32_DERIVATION for wallet-owned entries.` + ); + } + + return psbt; +} diff --git a/packages/sysweb3-keyring/src/ledger/types.ts b/packages/sysweb3-keyring/src/ledger/types.ts index c7accd2a..c942f28b 100644 --- a/packages/sysweb3-keyring/src/ledger/types.ts +++ b/packages/sysweb3-keyring/src/ledger/types.ts @@ -1,4 +1,4 @@ -import { Version } from 'eth-sig-util'; +import { SignTypedDataVersion } from '@metamask/eth-sig-util'; export interface IUTXOMethods { getUtxoAddress: ({ @@ -50,6 +50,7 @@ export interface IEvmMethods { }: { accountIndex: number; rawTx: string; + expectedAddress: string; }) => Promise<{ r: string; s: string; @@ -61,6 +62,7 @@ export interface IEvmMethods { }: { accountIndex: number; message: string; + expectedAddress: string; }) => Promise; signTypedData: ({ version, @@ -69,6 +71,7 @@ export interface IEvmMethods { }: { accountIndex: number; data: any; - version: Version; + expectedAddress: string; + version: SignTypedDataVersion; }) => Promise; } diff --git a/packages/sysweb3-keyring/src/network-utils.ts b/packages/sysweb3-keyring/src/network-utils.ts index e46d3cba..ac63f886 100644 --- a/packages/sysweb3-keyring/src/network-utils.ts +++ b/packages/sysweb3-keyring/src/network-utils.ts @@ -2,7 +2,7 @@ import { INetwork, INetworkType, coins as utxoCoins, -} from '@pollum-io/sysweb3-network'; +} from '@sidhujag/sysweb3-network'; /** * Generate default UTXO networks from coins.ts data diff --git a/packages/sysweb3-keyring/src/private-records.ts b/packages/sysweb3-keyring/src/private-records.ts new file mode 100644 index 00000000..5b4a23b9 --- /dev/null +++ b/packages/sysweb3-keyring/src/private-records.ts @@ -0,0 +1,254 @@ +/** Versioned, public envelope. Application metadata belongs inside the plaintext. */ +export interface IEncryptedPrivateRecord { + ciphertext: string; + domain: string; + nonce: string; + profileId: string; + recordId: string; + version: 1; +} + +export interface IEncryptPrivateRecordParams { + domain: string; + plaintext: Uint8Array; + recordId: string; +} + +export interface IDecryptPrivateRecordParams { + domain: string; + envelope: IEncryptedPrivateRecord; + recordId: string; +} + +export const MAX_PRIVATE_RECORD_BYTES = 64 * 1024; +export const MAX_PRIVATE_RECORD_LABEL_BYTES = 128; + +const NAMESPACE = 'sysweb3/private-record/v1'; +const NONCE_BYTES = 12; +const TAG_BYTES = 16; +const encoder = new TextEncoder(); +const LABEL_START = /^[A-Za-z0-9]/; +const INVALID_LABEL_CHARACTER = /[^A-Za-z0-9._:/-]/; +const PROFILE = /^0x[0-9a-f]{64}$/; +const BASE64 = + /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/; +type Guard = () => void; + +// Views passed to WebCrypto are owned, non-shared copies. This cast supports +// DOM typings both before and after generic ArrayBufferLike typed arrays. +const bufferSource = (bytes: Uint8Array): BufferSource => + bytes as unknown as BufferSource; + +function cryptoProvider(): Crypto { + if (!globalThis.crypto?.subtle || !globalThis.crypto.getRandomValues) { + throw new Error('Private record cryptography unavailable'); + } + return globalThis.crypto; +} + +function label(value: string): string { + if ( + typeof value !== 'string' || + value.length > MAX_PRIVATE_RECORD_LABEL_BYTES || + !LABEL_START.test(value) || + INVALID_LABEL_CHARACTER.test(value) + ) { + throw new Error('Invalid private record context'); + } + return value; +} + +function encodeBase64(bytes: Uint8Array): string { + return Buffer.from(bytes).toString('base64'); +} + +function decodeBase64(value: string, min: number, max: number): Uint8Array { + if ( + typeof value !== 'string' || + value.length > 4 * Math.ceil(max / 3) || + !BASE64.test(value) + ) { + throw new Error('Invalid private record envelope'); + } + const bytes = new Uint8Array(Buffer.from(value, 'base64')); + if ( + bytes.length < min || + bytes.length > max || + encodeBase64(bytes) !== value + ) { + throw new Error('Invalid private record envelope'); + } + return bytes; +} + +async function importRoot( + secret: Uint8Array, + guard: Guard +): Promise { + const key = await cryptoProvider().subtle.importKey( + 'raw', + bufferSource(secret), + 'HKDF', + false, + ['deriveBits', 'deriveKey'] + ); + guard(); + return key; +} + +async function profileId(key: CryptoKey, guard: Guard): Promise { + const bits = await cryptoProvider().subtle.deriveBits( + { + name: 'HKDF', + hash: 'SHA-256', + salt: bufferSource(encoder.encode(NAMESPACE)), + info: bufferSource( + encoder.encode(JSON.stringify([NAMESPACE, 'profile-id'])) + ), + }, + key, + 256 + ); + guard(); + return `0x${Buffer.from(bits).toString('hex')}`; +} + +async function domainKey( + key: CryptoKey, + domain: string, + guard: Guard +): Promise { + const derived = await cryptoProvider().subtle.deriveKey( + { + name: 'HKDF', + hash: 'SHA-256', + salt: bufferSource(encoder.encode(NAMESPACE)), + info: bufferSource( + encoder.encode(JSON.stringify([NAMESPACE, 'encryption-key', domain])) + ), + }, + key, + { name: 'AES-GCM', length: 256 }, + false, + ['encrypt', 'decrypt'] + ); + guard(); + return derived; +} + +function additionalData(domain: string, recordId: string, profile: string) { + return encoder.encode( + JSON.stringify([NAMESPACE, 1, domain, recordId, profile]) + ); +} + +// Internal helpers accept ephemeral bytes and never access wallet storage. +// Only the envelope types and limits are exported from the package entrypoint. +export async function privateRecordProfileId( + secret: Uint8Array, + guard: Guard +): Promise { + return profileId(await importRoot(secret, guard), guard); +} + +export async function encryptPrivateRecordBytes( + secret: Uint8Array, + params: IEncryptPrivateRecordParams, + guard: Guard +): Promise { + const domain = label(params.domain); + const recordId = label(params.recordId); + if ( + !(params.plaintext instanceof Uint8Array) || + params.plaintext.length > MAX_PRIVATE_RECORD_BYTES + ) { + throw new Error('Invalid private record size'); + } + // Own the input before the first await; caller mutations cannot change it. + const plaintext = new Uint8Array(params.plaintext); + try { + const key = await importRoot(secret, guard); + const profile = await profileId(key, guard); + const aesKey = await domainKey(key, domain, guard); + const nonce = cryptoProvider().getRandomValues(new Uint8Array(NONCE_BYTES)); + const encrypted = await cryptoProvider().subtle.encrypt( + { + name: 'AES-GCM', + iv: bufferSource(nonce), + tagLength: 128, + additionalData: bufferSource(additionalData(domain, recordId, profile)), + }, + aesKey, + bufferSource(plaintext) + ); + guard(); + return { + version: 1, + domain, + recordId, + profileId: profile, + nonce: encodeBase64(nonce), + ciphertext: encodeBase64(new Uint8Array(encrypted)), + }; + } finally { + plaintext.fill(0); + } +} + +export async function decryptPrivateRecordBytes( + secret: Uint8Array, + params: IDecryptPrivateRecordParams, + guard: Guard +): Promise { + const domain = label(params.domain); + const recordId = label(params.recordId); + // Copy primitive fields before awaiting. No caller-owned object is retained. + const envelope = params.envelope && { ...params.envelope }; + if ( + !envelope || + Object.keys(envelope).length !== 6 || + envelope.version !== 1 || + envelope.domain !== domain || + envelope.recordId !== recordId || + typeof envelope.profileId !== 'string' || + envelope.profileId.length !== 66 || + !PROFILE.test(envelope.profileId) + ) { + throw new Error('Invalid private record envelope'); + } + const nonce = decodeBase64(envelope.nonce, NONCE_BYTES, NONCE_BYTES); + const ciphertext = decodeBase64( + envelope.ciphertext, + TAG_BYTES, + MAX_PRIVATE_RECORD_BYTES + TAG_BYTES + ); + const key = await importRoot(secret, guard); + const profile = await profileId(key, guard); + if (profile !== envelope.profileId) { + throw new Error('Private record profile mismatch'); + } + const aesKey = await domainKey(key, domain, guard); + let plaintext: Uint8Array | undefined; + try { + plaintext = new Uint8Array( + await cryptoProvider().subtle.decrypt( + { + name: 'AES-GCM', + iv: bufferSource(nonce), + tagLength: 128, + additionalData: bufferSource( + additionalData(domain, recordId, profile) + ), + }, + aesKey, + bufferSource(ciphertext) + ) + ); + guard(); + return plaintext; + } catch { + plaintext?.fill(0); + guard(); + throw new Error('Private record authentication failed'); + } +} diff --git a/packages/sysweb3-keyring/src/providers.ts b/packages/sysweb3-keyring/src/providers.ts index 5d0f8ffc..5672af70 100644 --- a/packages/sysweb3-keyring/src/providers.ts +++ b/packages/sysweb3-keyring/src/providers.ts @@ -1,19 +1,232 @@ -import { Networkish } from '@ethersproject/networks'; -import { BigNumber, ethers, logger } from 'ethers'; -import { ConnectionInfo, Logger, shallowCopy } from 'ethers/lib/utils'; -import { Provider } from 'zksync-ethers'; +import { FeeData } from 'ethers/providers'; +import { FetchRequest, getBigInt } from 'ethers/utils'; import { handleStatusCodeError } from './errorUtils'; -import { checkError } from './utils'; +import { + BigNumber, + JsonRpcProvider, + normalizeTransactionRequest, + type Networkish, +} from './ethers-v6'; -class BaseProvider extends ethers.providers.JsonRpcProvider { +import type { JsonRpcPayload } from 'ethers/providers'; + +const TRANSACTION_RESPONSE_BIG_NUMBER_FIELDS = new Set([ + 'gasLimit', + 'gasPrice', + 'maxFeePerGas', + 'maxPriorityFeePerGas', + 'value', +]); + +const TRANSACTION_RESPONSE_NUMBER_FIELDS = new Set(['chainId']); + +const TRANSACTION_RECEIPT_BIG_NUMBER_FIELDS = new Set([ + 'blobGasPrice', + 'blobGasUsed', + 'cumulativeGasUsed', + 'effectiveGasPrice', + 'gasPrice', + 'gasUsed', +]); + +const FEE_DATA_CACHE_TTL_MS = 5000; + +// A stale response must never be interpreted as the result of another RPC. +// Keep the sentinel in the message for callers that serialize errors as text. +export class RpcResponseIntegrityError extends Error { + readonly code = 'SYSWEB3_RPC_RESPONSE_INVALID'; + + constructor( + message = 'JSON-RPC response does not match its request', + readonly retryable = true + ) { + super(`[SYSWEB3_RPC_RESPONSE_INVALID] ${message}`); + this.name = 'RpcResponseIntegrityError'; + } +} + +// Only these standard, side-effect-free reads may recover from a stale cache +// entry. Never infer retry eligibility from an RPC method prefix. +const RECOVERABLE_READ_METHODS = new Set([ + 'eth_chainId', + 'net_version', + 'web3_clientVersion', + 'eth_blockNumber', + 'eth_syncing', + 'eth_getBalance', + 'eth_getTransactionCount', + 'eth_getCode', + 'eth_getStorageAt', + 'eth_getProof', + 'eth_call', + 'eth_estimateGas', + 'eth_createAccessList', + 'eth_gasPrice', + 'eth_maxPriorityFeePerGas', + 'eth_feeHistory', + 'eth_getBlockByNumber', + 'eth_getBlockByHash', + 'eth_getBlockTransactionCountByNumber', + 'eth_getBlockTransactionCountByHash', + 'eth_getTransactionByHash', + 'eth_getTransactionByBlockNumberAndIndex', + 'eth_getTransactionByBlockHashAndIndex', + 'eth_getTransactionReceipt', + 'eth_getLogs', +]); + +let rpcRecoveryNonce = 0; +// Shared across provider instances and seeded anew on process restart. These +// numeric correlation IDs are not authorization tokens. +let nextRpcWireId = Math.floor(Math.random() * 2 ** 51); +const reserveRpcWireId = (): number => { + const id = ++nextRpcWireId; + if (!Number.isSafeInteger(id)) { + throw new RpcResponseIntegrityError( + 'RPC request ID range exhausted', + false + ); + } + return id; +}; + +const recoveryUrl = (original: string): string => { + const url = new URL(original); + const token = `${Date.now()}-${++rpcRecoveryNonce}-${Math.random() + .toString(36) + .slice(2)}`; + // Append without reserializing existing query values (including auth data). + url.search += `${url.search ? '&' : '?'}sysweb3_rpc_request=${token}`; + return url.toString(); +}; + +const getChainIdFromNetworkish = (network?: Networkish): number | undefined => { + if (network == null) return undefined; + if (typeof network === 'number') return network; + if (typeof network === 'bigint') return Number(network); + const chainId = (network as { chainId?: bigint | number | string }).chainId; + if (chainId == null) return undefined; + return typeof chainId === 'bigint' ? Number(chainId) : Number(chainId); +}; + +const parseChainId = (chainId: bigint | number | string): number => { + if (typeof chainId === 'number') return chainId; + if (typeof chainId === 'bigint') return Number(chainId); + return Number(BigInt(chainId)); +}; + +const defineValue = (target: any, field: string, value: any) => { + Object.defineProperty(target, field, { + value, + configurable: true, + enumerable: true, + writable: true, + }); +}; + +const wrapBigNumberFields = ( + source: any, + fields: Set, + omittedFields: Set = fields +) => { + if (!source) return source; + const wrapped = Object.create(Object.getPrototypeOf(source)); + const descriptors = Object.getOwnPropertyDescriptors(source); + for (const field of omittedFields) { + delete descriptors[field]; + } + Object.defineProperties(wrapped, descriptors); + + for (const field of fields) { + if (source[field] != null) { + defineValue(wrapped, field, BigNumber.from(source[field])); + } + } + + return wrapped; +}; + +export const wrapTransactionReceipt = (receipt: any) => { + const wrapped = wrapBigNumberFields( + receipt, + TRANSACTION_RECEIPT_BIG_NUMBER_FIELDS + ); + if (!wrapped) return wrapped; + + return new Proxy(wrapped, { + get(target, property, receiver) { + const value = Reflect.get(target, property, receiver); + return typeof value === 'function' ? value.bind(receipt) : value; + }, + }); +}; + +export const wrapTransactionResponse = (transaction: any) => { + if (!transaction) return transaction; + const omittedFields = new Set([ + ...TRANSACTION_RESPONSE_BIG_NUMBER_FIELDS, + ...TRANSACTION_RESPONSE_NUMBER_FIELDS, + 'wait', + ]); + const wrapped = wrapBigNumberFields( + transaction, + TRANSACTION_RESPONSE_BIG_NUMBER_FIELDS, + omittedFields + ); + + for (const field of TRANSACTION_RESPONSE_NUMBER_FIELDS) { + if (transaction[field] != null) { + defineValue(wrapped, field, Number(transaction[field])); + } + } + + if (typeof transaction.wait === 'function') { + defineValue(wrapped, 'wait', async (...args: any[]) => + wrapTransactionReceipt(await transaction.wait(...args)) + ); + } + + return new Proxy(wrapped, { + get(target, property, receiver) { + const value = Reflect.get(target, property, receiver); + return typeof value === 'function' ? value.bind(transaction) : value; + }, + }); +}; + +// Preserve JSON-RPC error details (code, revert data) on thrown errors so +// consumers can decode custom contract errors instead of only seeing +// "execution reverted". +const makeRpcError = (rpcError: { + code?: number; + data?: unknown; + message: string; +}): Error => { + const error = new Error(rpcError.message) as Error & { + code?: number; + data?: unknown; + }; + if (rpcError.code !== undefined) { + error.code = rpcError.code; + } + if (rpcError.data !== undefined) { + error.data = rpcError.data; + } + return error; +}; + +class BaseProvider extends JsonRpcProvider { private isPossibleGetChainId = true; private cooldownTime = 120 * 1000; private rateLimit = 30; private requestCount = 0; private lastRequestTime = 0; private currentChainId = ''; - private currentId = 1; + private feeDataCache: { expiresAt: number; value: any } | null = null; + private feeDataPromise: Promise | null = null; + private readonly configuredChainId?: number; + private chainIdVerificationPromise: Promise | null = null; public isInCooldown = false; public errorMessage: any = ''; public serverHasAnError = false; @@ -27,10 +240,15 @@ class BaseProvider extends ethers.providers.JsonRpcProvider { constructor( signal: AbortSignal, - url?: ConnectionInfo | string, + url?: string | { url: string }, network?: Networkish ) { - super(url, network); + super( + typeof url === 'string' ? url : url?.url, + network, + network == null ? undefined : { staticNetwork: true } + ); + this.configuredChainId = getChainIdFromNetworkish(network); this.signal = signal; this._pendingBatchAggregator = null; this._pendingBatch = null; @@ -95,6 +313,27 @@ class BaseProvider extends ethers.providers.JsonRpcProvider { } }; + async verifyConfiguredChainId(): Promise { + if (this.configuredChainId == null) return; + if (!this.chainIdVerificationPromise) { + this.chainIdVerificationPromise = + this.fetchAndVerifyConfiguredChainId().finally(() => { + this.chainIdVerificationPromise = null; + }); + } + return this.chainIdVerificationPromise; + } + + private async fetchAndVerifyConfiguredChainId(): Promise { + this.isPossibleGetChainId = true; + const actualChainId = parseChainId(await this.send('eth_chainId', [])); + if (actualChainId !== this.configuredChainId) { + throw new Error( + `Configured EVM chainId ${this.configuredChainId} does not match RPC eth_chainId ${actualChainId}` + ); + } + } + private cooldown = async () => { const now = Date.now(); const elapsedTime = now - this.lastRequestTime; @@ -110,217 +349,395 @@ class BaseProvider extends ethers.providers.JsonRpcProvider { }; }; - async perform(method: string, params: any): Promise { - // Legacy networks do not like the type field being passed along (which - // is fair), so we delete type if it is 0 and a non-EIP-1559 network - if (method === 'call' || method === 'estimateGas') { - const tx = params.transaction; - if (tx && tx.type != null && BigNumber.from(tx.type).isZero()) { - // If there are no EIP-1559 properties, it might be non-EIP-1559 - if (tx.maxFeePerGas == null && tx.maxPriorityFeePerGas == null) { - const feeData = await this.getFeeData(); - if ( - feeData.maxFeePerGas == null && - feeData.maxPriorityFeePerGas == null - ) { - // Network doesn't know about EIP-1559 (and hence type) - params = shallowCopy(params); - params.transaction = shallowCopy(tx); - delete params.transaction.type; + private validateRpcResponses( + json: any, + requests: JsonRpcPayload[], + batch: boolean + ): any[] { + if (batch ? !Array.isArray(json) : Array.isArray(json)) { + throw new RpcResponseIntegrityError(); + } + const responses = batch ? json : [json]; + if (responses.length !== requests.length) { + throw new RpcResponseIntegrityError(); + } + const expectedIds = new Set(requests.map((request) => request.id)); + const byId = new Map(); + for (const response of responses) { + if ( + !response || + typeof response !== 'object' || + Array.isArray(response) || + typeof response.id !== 'number' || + !expectedIds.has(response.id) || + byId.has(response.id) + ) { + throw new RpcResponseIntegrityError(); + } + const hasResult = Object.prototype.hasOwnProperty.call( + response, + 'result' + ); + const hasError = Object.prototype.hasOwnProperty.call(response, 'error'); + if ( + response.jsonrpc !== '2.0' || + hasResult === hasError || + (hasError && + (!response.error || + typeof response.error.message !== 'string' || + !Number.isSafeInteger(response.error.code))) + ) { + throw new RpcResponseIntegrityError( + 'Invalid JSON-RPC response envelope', + false + ); + } + byId.set(response.id, response); + } + return requests.map((request) => byId.get(request.id)); + } + + private async requestRpc( + inputs: Array>, + batch: boolean + ): Promise { + const canRecover = inputs.every(({ method }) => + RECOVERABLE_READ_METHODS.has(method) + ); + const originalUrl = this._getConnection().url; + let originalBody = ''; + for (let attempt = 0; attempt < 2; attempt++) { + if (this.signal.aborted) { + throw this.signal.reason || new Error('RPC request aborted'); + } + // Reserve the whole request range before any dispatch or await. + // A recovery must repeat the serialized read, even if its caller mutates + // an input object while the first response is delayed. + const source = + attempt === 0 + ? inputs + : batch + ? JSON.parse(originalBody) + : [JSON.parse(originalBody)]; + const requests: JsonRpcPayload[] = source.map(({ method, params }) => ({ + jsonrpc: '2.0', + method, + params, + id: reserveRpcWireId(), + })); + const options: RequestInit = { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify(batch ? requests : requests[0]), + signal: this.signal, + }; + if (attempt === 0) originalBody = options.body as string; + const json = await this.throttledRequest(async () => { + const response = await fetch( + attempt === 0 ? originalUrl : recoveryUrl(originalUrl), + options + ); + if (!response.ok) { + let errorBody = { error: undefined, message: undefined }; + try { + errorBody = await response.json(); + } catch { + console.warn('No body in request'); } + this.errorMessage = + errorBody.error || errorBody.message || 'No message from Provider'; + handleStatusCodeError(response.status, this.errorMessage); + } + if (response.status !== 200) { + throw new Error(`Unexpected HTTP status code: ${response.status}`); + } + try { + return await response.json(); + } catch (error) { + if (this.signal.aborted || error?.name === 'AbortError') throw error; + throw new RpcResponseIntegrityError( + 'Invalid JSON-RPC JSON response', + false + ); + } + }).catch((error) => { + if ( + attempt === 0 || + error instanceof RpcResponseIntegrityError || + this.signal.aborted || + error?.name === 'AbortError' + ) { + throw error; + } + throw new RpcResponseIntegrityError( + 'JSON-RPC response recovery failed', + false + ); + }); + try { + const responses = this.validateRpcResponses(json, requests, batch); + this.serverHasAnError = false; + return responses; + } catch (error) { + if ( + !(error instanceof RpcResponseIntegrityError) || + !error.retryable || + attempt !== 0 || + !canRecover + ) { + throw error; } } } + throw new RpcResponseIntegrityError(); + } - const args = this.prepareRequest(method, params); - - if (args == null) { - logger.throwError( - method + ' not implemented', - Logger.errors.NOT_IMPLEMENTED, - { operation: method } - ); - } - try { - return await this.send(args[0], args[1]); - } catch (error) { - return checkError(method, error, params); - } + // Ethers uses this primitive for network auto-detection and inherited send. + // Share wire IDs and validation, then restore its caller IDs after correlation. + override async _send( + payload: JsonRpcPayload | Array + ): Promise { + const inputs = Array.isArray(payload) ? payload : [payload]; + if (!inputs.length) return []; + const callerIds = inputs.map(({ id }) => id); + const responses = await this.requestRpc(inputs, Array.isArray(payload)); + return responses.map((response, index) => ({ + ...response, + id: callerIds[index], + })); } override send = async (method: string, params: any[]) => { if (!this.isPossibleGetChainId && method === 'eth_chainId') { return this.currentChainId; } + const [json] = await this.requestRpc([{ method, params }], false); + if (json.error) { + this.errorMessage = json.error.message; + throw makeRpcError(json.error); + } + if (method === 'eth_chainId') { + this.currentChainId = json.result; + this.isPossibleGetChainId = false; + } + return json.result; + }; - const headers = { - 'Content-Type': 'application/json', - }; + async sendBatch(method: string, params: Array): Promise { + if (!params.length) return []; + const responses = await this.requestRpc( + params.map((param) => ({ method, params: param })), + true + ); + return responses.map((json) => { + if (json.error) { + this.errorMessage = json.error.message; + throw makeRpcError(json.error); + } + return json.result; + }); + } - const options: RequestInit = { - method: 'POST', - headers, - body: JSON.stringify({ - jsonrpc: '2.0', - method, - params, - id: this.currentId, - }), - signal: this.signal, - }; + async getGasPrice() { + return BigNumber.from(await this.send('eth_gasPrice', [])); + } - const result = await this.throttledRequest(() => - fetch(this.connection.url, options) - .then(async (response) => { - if (!response.ok) { - let errorBody = { - error: undefined, - message: undefined, - }; - try { - errorBody = await response.json(); - } catch (error) { - console.warn('No body in request', error); - } - this.errorMessage = - errorBody.error || - errorBody.message || - 'No message from Provider'; - handleStatusCodeError(response.status, this.errorMessage); - } - switch (response.status) { - case 200: - return response.json(); - default: - throw { - message: `Unexpected HTTP status code: ${response.status}`, - }; - } - }) - .then((json) => { - if (json.error) { - if (json.error.message.includes('insufficient funds')) { - console.error({ - errorMessage: json.error.message, - }); - this.errorMessage = json.error.message; - throw new Error(json.error.message); - } - this.errorMessage = json.error.message; - console.log({ requestData: { method, params }, error: json.error }); - console.error({ - errorMessage: json.error.message, - }); - throw new Error(json.error.message); - } - if (method === 'eth_chainId') { - this.currentChainId = json.result; - this.isPossibleGetChainId = false; + async getFeeData(): Promise { + const now = Date.now(); + if (this.feeDataCache && this.feeDataCache.expiresAt > now) { + return this.feeDataCache.value; + } + if (this.feeDataPromise) { + return this.feeDataPromise; + } + + this.feeDataPromise = this.fetchFeeData(); + try { + const value = await this.feeDataPromise; + this.feeDataCache = { + expiresAt: Date.now() + FEE_DATA_CACHE_TTL_MS, + value, + }; + return value; + } finally { + this.feeDataPromise = null; + } + } + + private async readFeeData(): Promise { + const network = await this.getNetwork(); + // Ethers tolerates unavailable optional fee methods; keep that behavior, + // but never convert a response-integrity failure into an invented quote. + const optionalFee = async (method: 'getGasPrice' | 'getPriorityFee') => { + try { + return getBigInt(await this._perform({ method }), '%response'); + } catch (error) { + if ( + error?.code === 'SYSWEB3_RPC_RESPONSE_INVALID' || + error?.name === 'AbortError' || + this.signal.aborted + ) + throw error; + return null; + } + }; + const getFeeData = async () => { + const [block, gasPrice, priorityFee] = await Promise.all([ + super.getBlock('latest'), + optionalFee('getGasPrice'), + optionalFee('getPriorityFee'), + ]); + let maxFeePerGas: bigint | null = null; + let maxPriorityFeePerGas: bigint | null = null; + if (block?.baseFeePerGas != null && priorityFee != null) { + maxPriorityFeePerGas = priorityFee; + maxFeePerGas = block.baseFeePerGas * 2n + maxPriorityFeePerGas; + } + return new FeeData(gasPrice, maxFeePerGas, maxPriorityFeePerGas); + }; + // Preserve network-specific fee plugins, including Polygon's fee reader. + const plugin = network.getPlugin( + 'org.ethers.plugins.network.FetchUrlFeeDataPlugin' + ) as any; + if (plugin) { + // Polygon wraps reader failures in SERVER_ERROR. Preserve this + // invocation's integrity/cancellation failure through that wrapper. + let readerFailure: any; + const pluginReader = async () => { + try { + return await getFeeData(); + } catch (error) { + if ( + error?.code === 'SYSWEB3_RPC_RESPONSE_INVALID' || + error?.name === 'AbortError' || + this.signal.aborted + ) { + readerFailure = error; } - this.currentId++; - this.serverHasAnError = false; - return json.result; - }) - ); - return result; - }; + throw error; + } + }; + let result; + try { + result = await plugin.processFunc( + pluginReader, + this, + new FetchRequest(plugin.url) + ); + } catch (error) { + throw readerFailure ?? error; + } + if (readerFailure) throw readerFailure; + return new FeeData( + result.gasPrice, + result.maxFeePerGas, + result.maxPriorityFeePerGas + ); + } + return getFeeData(); + } - async sendBatch(method: string, params: Array): Promise { - // Create batch request array - const requests = params.map((param, index) => ({ - jsonrpc: '2.0', - id: this.currentId + index, - method, - params: param, - })); + private async fetchFeeData(): Promise { + const feeData = await this.readFeeData(); + const maxFeePerGas = + feeData.maxFeePerGas == null + ? null + : BigNumber.from(feeData.maxFeePerGas); + const maxPriorityFeePerGas = + feeData.maxPriorityFeePerGas == null + ? null + : BigNumber.from(feeData.maxPriorityFeePerGas); - this.currentId += requests.length; + if (maxFeePerGas == null || maxPriorityFeePerGas == null) { + const block = await super.getBlock('latest'); + if (!block) throw new Error('Block not found'); + if (block?.baseFeePerGas != null) { + throw new Error('EIP-1559 fee data unavailable'); + } + } - const headers = { - 'Content-Type': 'application/json', - }; + if ( + (maxFeePerGas != null && maxFeePerGas.isNegative()) || + (maxPriorityFeePerGas != null && maxPriorityFeePerGas.isNegative()) || + (maxFeePerGas != null && + maxPriorityFeePerGas != null && + maxPriorityFeePerGas.gt(maxFeePerGas)) + ) + throw new Error('Invalid EIP-1559 fee data'); - const options: RequestInit = { - method: 'POST', - headers, - body: JSON.stringify(requests), - signal: this.signal, + const gasPrice = + feeData.gasPrice == null ? null : BigNumber.from(feeData.gasPrice); + if (gasPrice?.isNegative()) throw new Error('Invalid gas price'); + return { + gasPrice, + maxFeePerGas, + maxPriorityFeePerGas, }; + } - const results = await this.throttledRequest(() => - fetch(this.connection.url, options) - .then(async (response) => { - if (!response.ok) { - let errorBody = { - error: undefined, - message: undefined, - }; - try { - errorBody = await response.json(); - } catch (error) { - console.warn('No body in request', error); - } - this.errorMessage = - errorBody.error || - errorBody.message || - 'No message from Provider'; - handleStatusCodeError(response.status, this.errorMessage); - } - return response.json(); - }) - .then((jsonArray) => { - // Sort results by ID to ensure correct order - const sortedResults = jsonArray.sort((a: any, b: any) => a.id - b.id); - - // Extract results or throw errors - return sortedResults.map((json: any) => { - if (json.error) { - this.errorMessage = json.error.message; - console.error({ - errorMessage: json.error.message, - }); - throw new Error(json.error.message); - } - return json.result; - }); - }) - ); + async getBalance(address: string, blockTag?: any): Promise { + return BigNumber.from(await super.getBalance(address, blockTag)); + } - return results; + private async normalizeLegacyCallRequest(transaction: any) { + const normalized = normalizeTransactionRequest(transaction); + + // Some legacy/non-EIP-1559 RPCs reject a type field on call/estimateGas. + // Preserve the old provider behavior by stripping explicit type 0 only + // when the network does not expose EIP-1559 fee fields. + if ( + normalized?.type === 0 && + normalized.maxFeePerGas == null && + normalized.maxPriorityFeePerGas == null + ) { + const feeData = await this.readFeeData(); + if ( + feeData.maxFeePerGas == null && + feeData.maxPriorityFeePerGas == null + ) { + delete normalized.type; + } + } + + return normalized; } -} -export class CustomJsonRpcProvider extends BaseProvider { - constructor( - signal: AbortSignal, - url?: ConnectionInfo | string, - network?: Networkish - ) { - super(signal, url, network); + async call(transaction: any, blockTag?: any): Promise { + const normalized = await this.normalizeLegacyCallRequest(transaction); + if (blockTag != null) { + normalized.blockTag = blockTag; + } + + return await super.call(normalized); } -} -export class CustomL2JsonRpcProvider extends Provider { - private baseProvider: BaseProvider; + async estimateGas(transaction: any): Promise { + const normalized = await this.normalizeLegacyCallRequest(transaction); - constructor( - signal: AbortSignal, - url?: ConnectionInfo | string, - network?: ethers.providers.Networkish - ) { - super(url, network); - this.baseProvider = new BaseProvider(signal, url, network); + return BigNumber.from(await super.estimateGas(normalized)); + } + + async getBlock(blockHashOrBlockTag: any): Promise { + return await super.getBlock(blockHashOrBlockTag); } - perform(method: string, params: any) { - return this.baseProvider.perform(method, params); + async getTransaction(hash: string): Promise { + return wrapTransactionResponse(await super.getTransaction(hash)); } - send(method: string, params: any[]) { - return this.baseProvider.send(method, params); + async sendTransaction(signedTransaction: string) { + return wrapTransactionResponse( + await this.broadcastTransaction(signedTransaction) + ); } +} - sendBatch(method: string, params: Array): Promise { - return this.baseProvider.sendBatch(method, params); +export class CustomJsonRpcProvider extends BaseProvider { + constructor( + signal: AbortSignal, + url?: string | { url: string }, + network?: Networkish + ) { + super(signal, url, network); } } diff --git a/packages/sysweb3-keyring/src/public-bip84.ts b/packages/sysweb3-keyring/src/public-bip84.ts new file mode 100644 index 00000000..beee8340 --- /dev/null +++ b/packages/sysweb3-keyring/src/public-bip84.ts @@ -0,0 +1,201 @@ +import ecc from '@bitcoinerlab/secp256k1'; +import { BIP32Factory, BIP32Interface } from 'bip32'; +import { address as bitcoinAddress, payments, Network } from 'bitcoinjs-lib'; +import bs58check from 'bs58check'; + +export type Bip84PublicNetwork = 'bitcoin' | 'syscoin'; +export type Bip84PublicAccountRequest = Readonly<{ + network: Bip84PublicNetwork; + accountKey: string; +}>; +export type Bip84PublicAccount = Readonly<{ + network: Bip84PublicNetwork; + policy: 'bip84-p2wpkh'; + canonicalKey: string; + accountIndex: number; +}>; +export type Bip84PublicAddressRequest = Bip84PublicAccountRequest & + Readonly<{ + branch: 0 | 1; + index: number; + }>; +export type Bip84PublicAddress = Readonly<{ + account: Bip84PublicAccount; + branch: 0 | 1; + index: number; + address: string; + scriptPubKey: string; +}>; +export class PublicBip84Error extends Error { + constructor( + public readonly code: + | 'INVALID_INPUT' + | 'INVALID_ACCOUNT' + | 'INVALID_DERIVATION' + ) { + super(code); + this.name = 'PublicBip84Error'; + } +} + +const bip32 = BIP32Factory(ecc); +const HARDENED = 0x80000000; +const XPUB = 0x0488b21e; +const ZPUB = 0x04b24746; +// Fixed mainnet encodings, independent of mutable external network objects. +// These match the Bitcoin/Syscoin registries; no BIP32 node escapes this entry. +const bitcoin = Object.freeze({ + messagePrefix: '\x18Bitcoin Signed Message:\n', + bech32: 'bc', + bip32: Object.freeze({ public: XPUB, private: 0x0488ade4 }), + pubKeyHash: 0x00, + scriptHash: 0x05, + wif: 0x80, +}); +const syscoin = Object.freeze({ + ...bitcoin, + messagePrefix: '\x18Syscoin Signed Message:\n', + bech32: 'sys', + pubKeyHash: 0x3f, +}); +const addressNetworks: Readonly> = + Object.freeze({ bitcoin, syscoin }); +const fail = (code: PublicBip84Error['code']): never => { + throw new PublicBip84Error(code); +}; + +function snapshot( + value: unknown, + keys: readonly string[] +): Record { + try { + if ( + !value || + typeof value !== 'object' || + Array.isArray(value) || + ![Object.prototype, null].includes(Object.getPrototypeOf(value)) || + Reflect.ownKeys(value).length !== keys.length + ) + return fail('INVALID_INPUT'); + const result: Record = {}; + for (const key of keys) { + const descriptor = Object.getOwnPropertyDescriptor(value, key); + if ( + !descriptor || + !descriptor.enumerable || + !Object.prototype.hasOwnProperty.call(descriptor, 'value') + ) + return fail('INVALID_INPUT'); + result[key] = descriptor.value; + } + return result; + } catch { + return fail('INVALID_INPUT'); + } +} + +function parse(input: Record): { + account: Bip84PublicAccount; + node: BIP32Interface; + network: Network; +} { + if (input.network !== 'bitcoin' && input.network !== 'syscoin') + return fail('INVALID_INPUT'); + const { accountKey } = input; + if ( + typeof accountKey !== 'string' || + !/^[1-9A-HJ-NP-Za-km-z]{100,112}$/.test(accountKey) + ) + return fail('INVALID_ACCOUNT'); + try { + const payload = Buffer.from(bs58check.decode(accountKey)); + if ( + payload.length !== 78 || + payload[4] !== 3 || + ![2, 3].includes(payload[45]) + ) + return fail('INVALID_ACCOUNT'); + const version = payload.readUInt32BE(0); + const child = payload.readUInt32BE(9); + if ((version !== XPUB && version !== ZPUB) || child < HARDENED) + return fail('INVALID_ACCOUNT'); + const network = addressNetworks[input.network]; + const node = bip32.fromBase58(accountKey, { + ...network, + bip32: { public: version, private: network.bip32.private }, + }); + if (!node.isNeutered() || node.depth !== 3 || node.index !== child) + return fail('INVALID_ACCOUNT'); + // Change serialization only after all account/public checks succeeded. No + // descriptor, coin path or historical purpose can be proven from this key. + payload.writeUInt32BE(ZPUB, 0); + const account: Bip84PublicAccount = Object.freeze({ + network: input.network, + policy: 'bip84-p2wpkh', + canonicalKey: bs58check.encode(payload), + accountIndex: child - HARDENED, + }); + return { account, node, network }; + } catch { + return fail('INVALID_ACCOUNT'); + } +} + +/** + * Validate one public account and normalize xpub/zpub aliases. The chosen + * network and BIP84 policy are explicit; ancestry/purpose is not attested. + * No keyring, storage, provider, randomness or wallet signing is involved. + * BIP32Factory runs its upstream deterministic ECC self-tests at module load. + */ +export function parseBip84PublicAccount( + request: Bip84PublicAccountRequest +): Bip84PublicAccount { + return parse(snapshot(request, ['network', 'accountKey'])).account; +} + +/** + * Derive only /0/index or /1/index from a validated mainnet account key. + * One bounded input and two child derivations; no discovery, cache or range + * iteration. Callers own scan limits and privacy consent. Returned data is public. + */ +export function deriveBip84PublicAddress( + request: Bip84PublicAddressRequest +): Bip84PublicAddress { + const input = snapshot(request, ['network', 'accountKey', 'branch', 'index']); + if ( + (input.branch !== 0 && input.branch !== 1) || + !Number.isInteger(input.index) || + (input.index as number) < 0 || + (input.index as number) >= HARDENED + ) + return fail('INVALID_INPUT'); + const { account, node, network } = parse(input); + const branch = input.branch; + const index = input.index as number; + try { + const branchNode = node.derive(branch); + if (branchNode.index !== branch) return fail('INVALID_DERIVATION'); + const child = branchNode.derive(index); + // BIP32 implementations can retry an invalid child at index + 1. Such a + // retry must never silently change the address requested by the caller. + if (child.index !== index) return fail('INVALID_DERIVATION'); + const payment = payments.p2wpkh({ pubkey: child.publicKey, network }); + if ( + !payment.address || + !payment.output || + !Buffer.from( + bitcoinAddress.toOutputScript(payment.address, network) + ).equals(Buffer.from(payment.output)) + ) + return fail('INVALID_DERIVATION'); + return Object.freeze({ + account, + branch, + index, + address: payment.address, + scriptPubKey: Buffer.from(payment.output).toString('hex'), + }); + } catch { + return fail('INVALID_DERIVATION'); + } +} diff --git a/packages/sysweb3-keyring/src/signers.ts b/packages/sysweb3-keyring/src/signers.ts index e9856013..f7f578a1 100644 --- a/packages/sysweb3-keyring/src/signers.ts +++ b/packages/sysweb3-keyring/src/signers.ts @@ -1,12 +1,9 @@ +import { BitcoinNetwork, IPubTypes, INetwork } from '@sidhujag/sysweb3-network'; import { BIP32Interface } from 'bip32'; -import { Psbt } from 'bitcoinjs-lib'; import * as syscoinjs from 'syscoinjs-lib'; -import { - BitcoinNetwork, - IPubTypes, - INetwork, -} from '@pollum-io/sysweb3-network'; +import type { Psbt } from 'bitcoinjs-lib'; +// NOTE: Avoid direct bitcoinjs-lib types; rely on syscoinjs's embedded bitcoinjs export const getSyscoinSigners = ({ mnemonic, @@ -138,12 +135,10 @@ export interface SyscoinHDSigner { psbt, isTrezor, isLedger, - pathIn, }: { psbt: any; isTrezor?: boolean; isLedger?: boolean; - pathIn?: string; }) => Promise; getNewChangeAddress: ( skipIncrement?: boolean, @@ -153,7 +148,7 @@ export interface SyscoinHDSigner { mnemonicOrZprv: string; setLatestIndexesFromXPubTokens: (tokens: any) => void; // Made async - sign: (psbt: Psbt, pathIn?: string) => Promise; + sign: (psbt: Psbt) => Promise; // Made async getMasterFingerprint: () => Buffer; } diff --git a/packages/sysweb3-keyring/src/software-hd-account.ts b/packages/sysweb3-keyring/src/software-hd-account.ts new file mode 100644 index 00000000..11dce750 --- /dev/null +++ b/packages/sysweb3-keyring/src/software-hd-account.ts @@ -0,0 +1,40 @@ +import type { IKeyringAccountState } from './types'; + +/** Fixed Ethereum BIP44 address index; not an arbitrary derivation path. */ +export interface EvmHdRuntimeAccountRequest { + readonly index: number; +} + +/** Trusted host guard must return undefined synchronously. */ +export interface EvmHdRuntimeAccountOptions { + assertCurrent: () => void; +} + +/** + * Internal runtime record, matching createFirstAccount/addNewAccount. Contains a + * password-encrypted xprv; never publish it or persist it as a public catalogue. + * No plaintext private key, mnemonic, or password is returned. + */ +export type EncryptedEvmHdRuntimeAccount = IKeyringAccountState; + +export function snapshotEvmHdIndex(value: EvmHdRuntimeAccountRequest): number { + if (!value || typeof value !== 'object' || Array.isArray(value)) { + throw new TypeError('Invalid Ethereum HD account index'); + } + const prototype = Object.getPrototypeOf(value); + const names = Reflect.ownKeys(value); + const index = Object.getOwnPropertyDescriptor(value, 'index'); + if ( + (prototype !== Object.prototype && prototype !== null) || + names.length !== 1 || + names[0] !== 'index' || + !index || + !index.enumerable || + !('value' in index) || + !Number.isSafeInteger(index.value) || + index.value < 0 || + index.value > 0x7fffffff + ) + throw new TypeError('Invalid Ethereum HD account index'); + return index.value; +} diff --git a/packages/sysweb3-keyring/src/software-utxo-account.ts b/packages/sysweb3-keyring/src/software-utxo-account.ts new file mode 100644 index 00000000..b62f17ee --- /dev/null +++ b/packages/sysweb3-keyring/src/software-utxo-account.ts @@ -0,0 +1,27 @@ +import { Bip84PublicAccount, Bip84PublicAddress } from './public-bip84'; +import { + Bip84NetworkBinding, + record, + index, + snapshotBip84Network, +} from './transactions/bip84-native-plan'; + +export type Bip84HdPublicRequest = Readonly<{ + network: Bip84NetworkBinding; + accountIndex: number; +}>; +export type Bip84HdPublicResult = Readonly<{ + type: 'HDAccount'; + accountIndex: number; + account: Bip84PublicAccount; + receive: Bip84PublicAddress; +}>; +export function snapshotBip84HdPublicRequest( + value: unknown +): Bip84HdPublicRequest { + const r = record(value, ['network', 'accountIndex']); + return Object.freeze({ + network: snapshotBip84Network(r.network), + accountIndex: index(r.accountIndex), + }); +} diff --git a/packages/sysweb3-keyring/src/software.ts b/packages/sysweb3-keyring/src/software.ts new file mode 100644 index 00000000..48333b43 --- /dev/null +++ b/packages/sysweb3-keyring/src/software.ts @@ -0,0 +1,167 @@ +/** Software-only entry: explicit host storage, no browser/device initialization. */ +import { KeyringCore } from './keyring-core'; +import { createVaultPersistence } from './storage-core'; + +import type { KeyringStoragePort } from './keyring-core'; +import type { + EncryptedEvmHdRuntimeAccount, + EvmHdRuntimeAccountOptions, + EvmHdRuntimeAccountRequest, +} from './software-hd-account'; +import type { + Bip84HdPublicRequest, + Bip84HdPublicResult, +} from './software-utxo-account'; +import type { VaultPersistence } from './storage-core'; +import type { Bip84Guard } from './transactions/bip84-native-plan'; +import type { + PreparedBip84SigningRequest, + SignedBip84NativeTransaction, +} from './transactions/prepared-bip84'; +import type { + PreparedEvmSigningOptions, + PreparedSoftwareEvmSigningRequest, + SignedPreparedEvmTransaction, +} from './transactions/prepared-evm'; + +declare const softwareHostBrand: unique symbol; +/** Opaque handle minted by createSoftwareKeyringHost; no injectable persistence. */ +export interface SoftwareKeyringHost { + readonly [softwareHostBrand]: true; +} + +const hosts = new WeakMap< + SoftwareKeyringHost, + { + storage: KeyringStoragePort; + vaultPersistence: VaultPersistence; + } +>(); + +/** Create once per wallet authority, then share with its per-network keyrings. */ +export const createSoftwareKeyringHost = ( + storage: KeyringStoragePort +): SoftwareKeyringHost => { + const vaultPersistence = createVaultPersistence(storage); + if (typeof storage.deleteItem !== 'function') { + throw new TypeError('Keyring storage port must provide deleteItem'); + } + const host = Object.freeze({}) as SoftwareKeyringHost; + hosts.set(host, { storage, vaultPersistence }); + return host; +}; + +const requireHost = (host: SoftwareKeyringHost) => { + const dependencies = hosts.get(host); + if (!dependencies) throw new TypeError('Invalid software keyring host'); + return dependencies; +}; + +export class SoftwareKeyring extends KeyringCore { + constructor(host: SoftwareKeyringHost) { + const dependencies = requireHost(host); + super({ + authority: host, + storage: dependencies.storage, + vaultPersistence: dependencies.vaultPersistence, + ledgerSigner: undefined, + trezorSigner: undefined, + }); + } + + /** + * Derive a fixed-path Ethereum HD runtime account without network or storage + * writes. The returned password-encrypted xprv is internal runtime state, + * never a public account/catalogue DTO. The host owns index allocation. + */ + public deriveEvmHdRuntimeAccount( + request: EvmHdRuntimeAccountRequest, + options: EvmHdRuntimeAccountOptions + ): Promise { + return this.deriveSoftwareEvmHdRuntimeAccount(request, options); + } + + /** Derive public BIP84 account data from the live seed; no storage or discovery. */ + public deriveBip84HdPublicAccount( + request: Bip84HdPublicRequest, + options: Bip84Guard + ): Promise { + return this.deriveSoftwareBip84HdPublicAccount(request, options); + } + + /** Sign the selected HD account's exact prepared native transaction offline. */ + public signPreparedBip84Transaction( + request: PreparedBip84SigningRequest, + options: Bip84Guard + ): Promise { + return this.signPreparedSoftwareBip84Transaction(request, options); + } + + /** + * Sign exactly the prepared envelope without RPC, fee/nonce discovery or + * broadcasting. The host must journal the result before submitting it. + * A later lock cannot revoke already returned signed bytes. + */ + public signPreparedEvmTransaction( + request: PreparedSoftwareEvmSigningRequest, + options: PreparedEvmSigningOptions + ): SignedPreparedEvmTransaction { + return this.signPreparedSoftwareEvmTransaction(request, options); + } + + /** Software authorities cannot rebind their backing store after creation. */ + public override setStorage = (client: any): never => { + void client; + throw new Error('Storage replacement is unavailable in this host'); + }; + + /** Sessions may move only through the core's same-authority transfer path. */ + public override receiveSessionOwnership = ( + ...session: Parameters + ): never => { + void session; + throw new Error('Direct session injection is unavailable in this host'); + }; + + public static async createInitialized( + host: SoftwareKeyringHost, + seed: string, + password: string, + vaultStateGetter: () => any + ): Promise { + const keyring = new SoftwareKeyring(host); + keyring.setVaultStateGetter(vaultStateGetter); + await keyring.initializeWalletSecurely(seed, password); + return keyring; + } +} + +export { KeyringAccountType } from './types'; +export { INetworkType } from '@sidhujag/sysweb3-network'; +export type { INetwork } from '@sidhujag/sysweb3-network'; +export type { KeyringStoragePort } from './keyring-core'; +export type { IKeyringAccountState } from './types'; + +export type { + PreparedEvmTransaction, + PreparedEvmSigningOptions, + PreparedSoftwareEvmSigningRequest, + SignedPreparedEvmTransaction, +} from './transactions/prepared-evm'; + +export type { + EncryptedEvmHdRuntimeAccount, + EvmHdRuntimeAccountOptions, + EvmHdRuntimeAccountRequest, +} from './software-hd-account'; + +export type { + Bip84HdPublicRequest, + Bip84HdPublicResult, +} from './software-utxo-account'; +export type { Bip84Guard } from './transactions/bip84-native-plan'; + +export type { + PreparedBip84SigningRequest, + SignedBip84NativeTransaction, +} from './transactions/prepared-bip84'; diff --git a/packages/sysweb3-keyring/src/storage-core.ts b/packages/sysweb3-keyring/src/storage-core.ts new file mode 100644 index 00000000..9f02e2fd --- /dev/null +++ b/packages/sysweb3-keyring/src/storage-core.ts @@ -0,0 +1,305 @@ +import CryptoJS from 'crypto-js'; + +/** A host-owned namespace containing one wallet authority's logical records. */ +export interface VaultStoragePort { + get(key: string): Promise; + set(key: string, value: unknown): Promise; + /** Atomically creates the entire batch only when every key is absent. */ + createManyIfAbsent(items: Record): Promise; +} + +export interface VaultPersistence { + setEncryptedVault( + decryptedVault: any, + pwd: string, + freshVaultKeys?: { salt: string } + ): Promise; + getDecryptedVault(pwd: string, legacyPassword?: string): Promise; +} + +type VaultGcmEnvelopeV4 = { + v: 4; + alg: 'A256GCM'; + iv: string; // hex (12 bytes) + ct: string; // hex (ciphertext + tag) +}; + +// Simple async mutex implementation to prevent concurrent vault operations +class AsyncMutex { + private mutex = Promise.resolve(); + + async runExclusive(callback: () => Promise): Promise { + const oldMutex = this.mutex; + + let release: () => void; + this.mutex = new Promise((resolve) => { + release = resolve; + }); + + await oldMutex; + try { + return await callback(); + } finally { + release!(); + } + } +} + +const isHex = (s: string): boolean => /^[0-9a-fA-F]+$/.test(s); + +const hexToBytes = (hex: string): Uint8Array => { + const clean = (hex || '').trim(); + if (!isHex(clean) || clean.length % 2 !== 0) { + throw new Error('Invalid hex string'); + } + const out = new Uint8Array(clean.length / 2); + for (let i = 0; i < out.length; i++) { + out[i] = parseInt(clean.slice(i * 2, i * 2 + 2), 16); + } + return out; +}; + +const bytesToHex = (bytes: ArrayBuffer): string => { + const u8 = new Uint8Array(bytes); + let hex = ''; + for (let i = 0; i < u8.length; i++) { + hex += u8[i].toString(16).padStart(2, '0'); + } + return hex; +}; + +const maybeParseGcmEnvelope = (raw: any): VaultGcmEnvelopeV4 | null => { + if (!raw || typeof raw !== 'string') return null; + if (!raw.trim().startsWith('{')) return null; + try { + const parsed = JSON.parse(raw) as Partial; + if ( + parsed && + parsed.v === 4 && + parsed.alg === 'A256GCM' && + typeof parsed.iv === 'string' && + typeof parsed.ct === 'string' + ) { + return parsed as VaultGcmEnvelopeV4; + } + return null; + } catch { + return null; + } +}; + +const encryptVaultWebCrypto = async ( + plaintextJson: string, + keyHex: string +): Promise => { + const subtle = (globalThis as any).crypto.subtle as SubtleCrypto; + const iv = new Uint8Array(12); + (globalThis as any).crypto.getRandomValues(iv); + + const keyBytes = hexToBytes(keyHex); + if (keyBytes.length !== 32) { + throw new Error('Vault key must be 32 bytes (hex length 64)'); + } + + const key = await subtle.importKey( + 'raw', + keyBytes as unknown as BufferSource, + { name: 'AES-GCM' }, + false, + ['encrypt'] + ); + + const pt = new TextEncoder().encode(plaintextJson); + const ct = await subtle.encrypt( + { name: 'AES-GCM', iv: iv as unknown as BufferSource }, + key, + pt as unknown as BufferSource + ); + + return { + v: 4, + alg: 'A256GCM', + iv: bytesToHex(iv.buffer), + ct: bytesToHex(ct), + }; +}; + +export class VaultAuthenticationError extends Error { + readonly code = 'INVALID_PASSWORD'; + + constructor() { + super('Failed to decrypt vault - invalid password or corrupted data'); + this.name = 'VaultAuthenticationError'; + } +} + +const invalidPasswordError = () => new VaultAuthenticationError(); + +const decryptVaultWebCrypto = async ( + envelope: VaultGcmEnvelopeV4, + keyHex: string +): Promise => { + const subtle = (globalThis as any)?.crypto?.subtle as + | SubtleCrypto + | undefined; + if (!subtle) { + throw new Error('WebCrypto is required to decrypt this vault'); + } + const keyBytes = hexToBytes(keyHex); + if (keyBytes.length !== 32) { + throw new Error('Vault key must be 32 bytes (hex length 64)'); + } + const key = await subtle.importKey( + 'raw', + keyBytes as unknown as BufferSource, + { name: 'AES-GCM' }, + false, + ['decrypt'] + ); + + const ivBytes = hexToBytes(envelope.iv); + const ctBytes = hexToBytes(envelope.ct); + if (ivBytes.length !== 12 || ctBytes.length < 16) { + throw new Error('Invalid encrypted vault format'); + } + + let pt: ArrayBuffer; + try { + pt = await subtle.decrypt( + { name: 'AES-GCM', iv: ivBytes as unknown as BufferSource }, + key, + ctBytes as unknown as BufferSource + ); + } catch (error) { + // Only a failed authentication tag is a password/ciphertext failure. + // Key import and other platform exceptions must remain operational. + if (error?.name === 'OperationError') { + throw invalidPasswordError(); + } + throw error; + } + return new TextDecoder().decode(pt); +}; + +/** + * Create once per wallet authority and share across its network keyrings. + * The host owns storage durability and cross-context atomic creation. + */ +export const createVaultPersistence = ( + storage: VaultStoragePort +): VaultPersistence => { + if ( + !storage || + typeof storage.get !== 'function' || + typeof storage.set !== 'function' || + typeof storage.createManyIfAbsent !== 'function' + ) { + throw new TypeError( + 'Vault storage port must provide get, set, and createManyIfAbsent methods' + ); + } + const vaultMutex = new AsyncMutex(); + + // Single vault for all networks; derivation remains the keyring's concern. + const setEncryptedVault = async ( + decryptedVault: any, + pwd: string, + freshVaultKeys?: { salt: string } + ) => { + return vaultMutex.runExclusive(async () => { + const plaintext = JSON.stringify(decryptedVault); + + // Writes never downgrade to unauthenticated passphrase AES. Legacy CBC + // remains readable below, but missing WebCrypto is an operational failure. + const canUseWebCrypto = + !!(globalThis as any)?.crypto?.subtle && + !!(globalThis as any)?.crypto?.getRandomValues; + if (!canUseWebCrypto) { + throw new Error('WebCrypto is required for vault encryption'); + } + if (typeof pwd !== 'string' || !isHex(pwd) || pwd.length !== 64) { + throw new Error('Vault key must be 32 bytes (hex length 64)'); + } + const envelope = await encryptVaultWebCrypto(plaintext, pwd); + const toStore = JSON.stringify(envelope); + + if (freshVaultKeys) { + // The host primitive covers the absence check and batch commit + // across all clients that can initialize the same persisted authority. + const created = await storage.createManyIfAbsent({ + 'vault-keys': freshVaultKeys, + vault: toStore, + }); + if (typeof created !== 'boolean') + throw new Error('Atomic storage creation returned an invalid result'); + if (!created) + throw new Error( + 'Cannot initialize a new vault over existing wallet storage' + ); + } else { + // Existing vault updates retain their migration-specific write ordering. + await storage.set('vault', toStore); + } + }); + }; + + const getDecryptedVault = async (pwd: string, legacyPassword?: string) => { + return vaultMutex.runExclusive(async () => { + // Always use single 'vault' key + const vault = await storage.get('vault'); + + if (!vault) { + throw new Error('Vault not found'); + } + + // Prefer WebCrypto AES-GCM when the stored vault is in v4 envelope format. + const maybeEnvelope = maybeParseGcmEnvelope(vault); + if ( + !maybeEnvelope && + typeof vault === 'string' && + vault.trim().startsWith('{') + ) { + // Legacy CBC vaults are base64. A JSON-shaped record must be a valid + // GCM envelope rather than being misreported as a password failure. + throw new Error('Invalid encrypted vault format'); + } + let decryptedVault: string; + if (maybeEnvelope) { + decryptedVault = await decryptVaultWebCrypto(maybeEnvelope, pwd); + } else { + // Legacy CryptoJS passphrase-AES vault (v3 and older v4 canary). + // An interrupted migration can already have written CBC with the + // derived key while the metadata still selects the legacy password. + for (const candidateKey of new Set([legacyPassword ?? pwd, pwd])) { + let plaintext: string; + try { + plaintext = CryptoJS.AES.decrypt( + vault as string, + candidateKey + ).toString(CryptoJS.enc.Utf8); + } catch (error) { + if (error?.message === 'Malformed UTF-8 data') continue; + throw error; + } + if (!plaintext) continue; + try { + return JSON.parse(plaintext); + } catch (error) { + // CBC has no authentication tag; invalid plaintext is the only + // available indication of a bad password/ciphertext. + if (!(error instanceof SyntaxError)) throw error; + } + } + throw invalidPasswordError(); + } + + if (!decryptedVault) { + throw invalidPasswordError(); + } + + return JSON.parse(decryptedVault); + }); + }; + + return { setEncryptedVault, getDecryptedVault }; +}; diff --git a/packages/sysweb3-keyring/src/storage.ts b/packages/sysweb3-keyring/src/storage.ts index 215cd575..f9aeb905 100644 --- a/packages/sysweb3-keyring/src/storage.ts +++ b/packages/sysweb3-keyring/src/storage.ts @@ -1,37 +1,18 @@ -import CryptoJS from 'crypto-js'; +import { sysweb3Di } from '@sidhujag/sysweb3-core'; -import { sysweb3Di } from '@pollum-io/sysweb3-core'; +import { createVaultPersistence } from './storage-core'; +// Preserve the legacy process-wide storage authority. Host-isolated consumers +// import storage-core directly and supply their own asynchronous storage port. const storage = sysweb3Di.getStateStorageDb(); - -// Single vault for all networks - stores the mnemonic and can derive accounts for any slip44 -export const setEncryptedVault = async (decryptedVault: any, pwd: string) => { - const encryptedVault = CryptoJS.AES.encrypt( - JSON.stringify(decryptedVault), - pwd - ); - - // Always use single 'vault' key for all networks - await storage.set('vault', encryptedVault.toString()); -}; - -export const getDecryptedVault = async (pwd: string) => { - // Always use single 'vault' key - const vault = await storage.get('vault'); - - if (!vault) { - throw new Error('Vault not found'); - } - - const decryptedVault = CryptoJS.AES.decrypt(vault, pwd).toString( - CryptoJS.enc.Utf8 - ); - - if (!decryptedVault) { - throw new Error( - 'Failed to decrypt vault - invalid password or corrupted data' - ); - } - - return JSON.parse(decryptedVault); -}; +const persistence = createVaultPersistence({ + get: async (key) => storage.get(key), + set: async (key, value) => { + await storage.set(key, value); + }, + createManyIfAbsent: async (items) => storage.createManyIfAbsent(items), +}); + +export const setEncryptedVault = persistence.setEncryptedVault; +export const getDecryptedVault = persistence.getDecryptedVault; +export { VaultAuthenticationError } from './storage-core'; diff --git a/packages/sysweb3-keyring/src/transactions/__tests__/integration.test.ts b/packages/sysweb3-keyring/src/transactions/__tests__/integration.test.ts index 15418f42..38573bed 100644 --- a/packages/sysweb3-keyring/src/transactions/__tests__/integration.test.ts +++ b/packages/sysweb3-keyring/src/transactions/__tests__/integration.test.ts @@ -95,7 +95,7 @@ describe('PSBT Transaction Flow Integration', () => { describe('Complete Token Transaction Flow', () => { it('should handle token transaction from creation to broadcast', async () => { // Mock token lookup - jest.doMock('@pollum-io/sysweb3-utils', () => ({ + jest.doMock('@sidhujag/sysweb3-utils', () => ({ getAsset: jest.fn().mockResolvedValue({ assetGuid: 'token123', decimals: 8, diff --git a/packages/sysweb3-keyring/src/transactions/__tests__/syscoin.test.ts b/packages/sysweb3-keyring/src/transactions/__tests__/syscoin.test.ts index d7ab27bd..8dcbe3d1 100644 --- a/packages/sysweb3-keyring/src/transactions/__tests__/syscoin.test.ts +++ b/packages/sysweb3-keyring/src/transactions/__tests__/syscoin.test.ts @@ -1,12 +1,12 @@ +import { INetworkType } from '@sidhujag/sysweb3-network'; +import { getAsset } from '@sidhujag/sysweb3-utils'; import * as syscoinjs from 'syscoinjs-lib'; import { KeyringAccountType } from '../../types'; import { SyscoinTransactions } from '../syscoin'; -import { INetworkType } from '@pollum-io/sysweb3-network'; -import { getAsset } from '@pollum-io/sysweb3-utils'; // Mock dependencies -jest.mock('@pollum-io/sysweb3-utils', () => ({ +jest.mock('@sidhujag/sysweb3-utils', () => ({ getAsset: jest.fn(), isBase64: jest.fn().mockReturnValue(true), countDecimals: jest.fn().mockReturnValue(8), diff --git a/packages/sysweb3-keyring/src/transactions/bip84-native-plan.ts b/packages/sysweb3-keyring/src/transactions/bip84-native-plan.ts new file mode 100644 index 00000000..8daba9f9 --- /dev/null +++ b/packages/sysweb3-keyring/src/transactions/bip84-native-plan.ts @@ -0,0 +1,581 @@ +import { + address as bitcoinAddress, + Psbt, + Transaction, + Network, +} from 'bitcoinjs-lib'; +import { decode as decodeVarInt } from 'varuint-bitcoin'; + +import { + deriveBip84PublicAddress, + parseBip84PublicAccount, + Bip84PublicAccount, + Bip84PublicNetwork, +} from '../public-bip84'; + +export type Bip84NetworkBinding = Readonly<{ + network: Bip84PublicNetwork; + endpoint: string; +}>; +export type Bip84Guard = Readonly<{ assertCurrent(): void }>; +export type Bip84NativePlan = Readonly<{ + network: Bip84NetworkBinding; + account: Bip84PublicAccount; + inputs: readonly Readonly<{ + txid: string; + vout: number; + branch: 0 | 1; + index: number; + }>[]; + previousTransactions: readonly Readonly<{ + txid: string; + rawTransaction: string; + }>[]; + recipient: Readonly<{ address: string; valueSatoshis: string }>; + change: Readonly<{ index: number; valueSatoshis: string }> | null; + locktime: 0; + rbf: boolean; + feeLimits: Readonly<{ + maxFeeSatoshis: string; + maxFeeRateSatPerVByte: string; + }>; +}>; +export type PreparedBip84NativeTransaction = Readonly<{ + plan: Bip84NativePlan; + unsignedTransaction: string; + feeSatoshis: string; +}>; +export type Bip84NativeErrorCode = + | 'INVALID_REQUEST' + | 'LIMIT_EXCEEDED' + | 'UNSUPPORTED_NETWORK' + | 'UNSUPPORTED_PARENT' + | 'ACCOUNT_MISMATCH' + | 'INPUT_MISMATCH' + | 'FEE_LIMIT' + | 'SIGNATURE_INVALID' + | 'CANCELLED' + | 'BUSY'; +export class Bip84NativeError extends Error { + constructor(public readonly code: Bip84NativeErrorCode) { + super(code); + this.name = 'Bip84NativeError'; + } +} + +// Resource/consent policy, not consensus or relay limits. +export const LIMITS = Object.freeze({ + inputs: 64, + parentBytes: 1_000_000, + totalParentBytes: 2_000_000, + parentComponents: 8192, + unsignedBytes: 8 * 1024, + signedBytes: 16 * 1024, + psbtBytes: 64 * 1024, + maxFee: 10_000_000n, + maxFeeRate: 1_000n, +}); +const HARDENED = 0x80000000; +const baseNetwork: Network = Object.freeze({ + messagePrefix: '\x18Bitcoin Signed Message:\n', + bech32: 'bc', + bip32: Object.freeze({ public: 0x0488b21e, private: 0x0488ade4 }), + pubKeyHash: 0, + scriptHash: 5, + wif: 128, +}); +const profiles = Object.freeze({ + bitcoin: Object.freeze({ + chainId: 0, + slip44: 0, + currency: 'btc', + maximumMoney: 2_100_000_000_000_000n, + addressNetwork: baseNetwork, + }), + syscoin: Object.freeze({ + chainId: 57, + slip44: 57, + currency: 'sys', + maximumMoney: 999_999_999_999_999_999n, + addressNetwork: Object.freeze({ + ...baseNetwork, + messagePrefix: '\x18Syscoin Signed Message:\n', + bech32: 'sys', + pubKeyHash: 0x3f, + }), + }), +}); +export type Bip84Profile = Readonly<{ + chainId: number; + slip44: number; + currency: string; + maximumMoney: bigint; + addressNetwork: Network; +}>; +export const bip84Profile = (network: Bip84PublicNetwork): Bip84Profile => + profiles[network]; +export const fail = (code: Bip84NativeErrorCode): never => { + throw new Bip84NativeError(code); +}; + +export function record(value: unknown, fields: readonly string[]) { + if ( + !value || + typeof value !== 'object' || + Array.isArray(value) || + ![Object.prototype, null].includes(Object.getPrototypeOf(value)) || + Reflect.ownKeys(value).length !== fields.length + ) + return fail('INVALID_REQUEST'); + const result: Record = Object.create(null); + for (const field of fields) { + const d = Object.getOwnPropertyDescriptor(value, field); + if ( + !d || + !d.enumerable || + !Object.prototype.hasOwnProperty.call(d, 'value') + ) + return fail('INVALID_REQUEST'); + result[field] = d.value; + } + return result; +} +function array(value: unknown): unknown[] { + if (!Array.isArray(value)) return fail('INVALID_REQUEST'); + const length = Object.getOwnPropertyDescriptor(value, 'length')?.value; + if (!Number.isSafeInteger(length) || length < 1) + return fail('INVALID_REQUEST'); + if (length > LIMITS.inputs) return fail('LIMIT_EXCEEDED'); + if (Reflect.ownKeys(value).length !== length + 1) + return fail('INVALID_REQUEST'); + const result: unknown[] = []; + for (let i = 0; i < length; i++) { + const d = Object.getOwnPropertyDescriptor(value, String(i)); + if ( + !d || + !d.enumerable || + !Object.prototype.hasOwnProperty.call(d, 'value') + ) + return fail('INVALID_REQUEST'); + result.push(d.value); + } + return result; +} +export function index(value: unknown): number { + if ( + !Number.isSafeInteger(value) || + (value as number) < 0 || + (value as number) >= HARDENED + ) + return fail('INVALID_REQUEST'); + return value as number; +} +function txid(value: unknown): string { + if (typeof value !== 'string' || !/^[0-9a-f]{64}$/.test(value)) + return fail('INVALID_REQUEST'); + return value; +} +function quantity(value: unknown, max: bigint, positive = false): string { + if (typeof value !== 'string' || !/^(0|[1-9][0-9]{0,18})$/.test(value)) + return fail('INVALID_REQUEST'); + const amount = BigInt(value); + if (amount > max || (positive && amount === 0n)) + return fail('INVALID_REQUEST'); + return value; +} +export function snapshotBip84Network(value: unknown): Bip84NetworkBinding { + const n = record(value, ['network', 'endpoint']); + if (n.network !== 'bitcoin' && n.network !== 'syscoin') + return fail('UNSUPPORTED_NETWORK'); + if ( + typeof n.endpoint !== 'string' || + !n.endpoint || + n.endpoint.length > 2048 || + n.endpoint.trim() !== n.endpoint || + Array.from(n.endpoint).some((character) => { + const code = character.charCodeAt(0); + return code < 32 || code === 127 || (code >= 0xd800 && code <= 0xdfff); + }) + ) + return fail('INVALID_REQUEST'); + return Object.freeze({ network: n.network, endpoint: n.endpoint }); +} +export function snapshotBip84Guard(value: unknown): () => void { + const guard = record(value, ['assertCurrent']).assertCurrent; + if (typeof guard !== 'function') return fail('INVALID_REQUEST'); + return () => { + let result: unknown; + try { + result = guard(); + } catch { + return fail('CANCELLED'); + } + if (result !== undefined) { + if ( + result !== null && + (typeof result === 'object' || typeof result === 'function') + ) + void Promise.resolve(result).catch(() => undefined); + return fail('CANCELLED'); + } + }; +} +function snapshotAccount( + value: unknown, + network: Bip84PublicNetwork +): Bip84PublicAccount { + const a = record(value, [ + 'network', + 'policy', + 'canonicalKey', + 'accountIndex', + ]); + if (a.network !== network || a.policy !== 'bip84-p2wpkh') + return fail('ACCOUNT_MISMATCH'); + let parsed: Bip84PublicAccount; + try { + parsed = parseBip84PublicAccount({ + network, + accountKey: a.canonicalKey as string, + }); + } catch { + return fail('INVALID_REQUEST'); + } + if ( + parsed.canonicalKey !== a.canonicalKey || + parsed.accountIndex !== a.accountIndex + ) + return fail('ACCOUNT_MISMATCH'); + return parsed; +} +function recipientAddress(value: unknown, network: Network): string { + if ( + typeof value !== 'string' || + value.length > 90 || + value !== value.toLowerCase() + ) + return fail('INVALID_REQUEST'); + try { + const script = bitcoinAddress.toOutputScript(value, network); + if ( + script.length !== 22 || + script[0] !== 0 || + script[1] !== 20 || + bitcoinAddress.fromOutputScript(script, network) !== value + ) + return fail('INVALID_REQUEST'); + return value; + } catch { + return fail('INVALID_REQUEST'); + } +} + +/** Bound decoded objects as well as wire bytes before bitcoinjs allocates them. + * One component is an input, output, witness vector or witness item. + */ +function boundedParentEncoding( + bytes: Buffer, + remainingComponents: number +): number { + let offset = 4; + let components = 0; + const charge = (count: number) => { + if (count > remainingComponents - components) return fail('LIMIT_EXCEEDED'); + components += count; + }; + const skip = (length: number) => { + if ( + !Number.isSafeInteger(length) || + length < 0 || + length > bytes.length - offset + ) + return fail('INVALID_REQUEST'); + offset += length; + }; + const compact = () => { + const value = decodeVarInt(bytes, offset); + offset += value.bytes; + if (value.bigintValue > BigInt(bytes.length - offset)) + return fail('INVALID_REQUEST'); + return Number(value.bigintValue); + }; + let inputs = compact(); + let witness = false; + if (inputs === 0) { + if (bytes[offset] !== 1) return fail('INVALID_REQUEST'); + offset++; + witness = true; + inputs = compact(); + } + if (inputs === 0 || inputs > Math.floor((bytes.length - offset) / 41)) + return fail('INVALID_REQUEST'); + charge(inputs); + for (let i = 0; i < inputs; i++) { + skip(36); + skip(compact()); + skip(4); + } + const outputs = compact(); + if (outputs === 0 || outputs > Math.floor((bytes.length - offset) / 9)) + return fail('INVALID_REQUEST'); + charge(outputs); + for (let i = 0; i < outputs; i++) { + skip(8); + skip(compact()); + } + if (witness) { + charge(inputs); + for (let i = 0; i < inputs; i++) { + const items = compact(); + charge(items); + for (let j = 0; j < items; j++) skip(compact()); + } + } + skip(4); + if (offset !== bytes.length) return fail('INVALID_REQUEST'); + return components; +} + +export type ValidatedBip84Plan = { + prepared: PreparedBip84NativeTransaction; + psbt: Psbt; + previousOutputs: readonly Readonly<{ script: Uint8Array; value: bigint }>[]; +}; + +/** Internal result includes owned mutable transaction data; public entry exports only prepare. */ +export function validateBip84NativePlan(value: unknown): ValidatedBip84Plan { + try { + const r = record(value, [ + 'network', + 'account', + 'inputs', + 'previousTransactions', + 'recipient', + 'change', + 'locktime', + 'rbf', + 'feeLimits', + ]); + const network = snapshotBip84Network(r.network); + const profile = bip84Profile(network.network); + const account = snapshotAccount(r.account, network.network); + if (r.locktime !== 0 || typeof r.rbf !== 'boolean') + return fail('INVALID_REQUEST'); + const inputs = Object.freeze( + array(r.inputs).map((v) => { + const i = record(v, ['txid', 'vout', 'branch', 'index']); + if ( + !Number.isSafeInteger(i.vout) || + (i.vout as number) < 0 || + (i.vout as number) > 0xffffffff || + (i.branch !== 0 && i.branch !== 1) + ) + return fail('INVALID_REQUEST'); + return Object.freeze({ + txid: txid(i.txid), + vout: i.vout as number, + branch: i.branch, + index: index(i.index), + }); + }) + ); + let totalParentBytes = 0; + const previousTransactions = Object.freeze( + array(r.previousTransactions) + .map((v) => { + const p = record(v, ['txid', 'rawTransaction']); + const id = txid(p.txid); + if (typeof p.rawTransaction !== 'string') + return fail('INVALID_REQUEST'); + if (p.rawTransaction.length > 2 * LIMITS.parentBytes) + return fail('LIMIT_EXCEEDED'); + if ( + p.rawTransaction.length < 20 || + p.rawTransaction.length % 2 !== 0 || + !/^[0-9a-f]+$/.test(p.rawTransaction) + ) + return fail('INVALID_REQUEST'); + totalParentBytes += p.rawTransaction.length / 2; + if (totalParentBytes > LIMITS.totalParentBytes) + return fail('LIMIT_EXCEEDED'); + return Object.freeze({ txid: id, rawTransaction: p.rawTransaction }); + }) + .sort((a, b) => (a.txid < b.txid ? -1 : a.txid > b.txid ? 1 : 0)) + ); + // Preflight the whole parent set before the first object-heavy decode. + const encodedParents = new Map(); + let parentComponents = 0; + for (const p of previousTransactions) { + if (encodedParents.has(p.txid)) return fail('INVALID_REQUEST'); + const bytes = Buffer.from(p.rawTransaction, 'hex'); + const version = bytes.readInt32LE(0); + if (version !== 1 && version !== 2) return fail('UNSUPPORTED_PARENT'); + parentComponents += boundedParentEncoding( + bytes, + LIMITS.parentComponents - parentComponents + ); + encodedParents.set(p.txid, bytes); + } + const parents = new Map(); + for (const p of previousTransactions) { + const parent = Transaction.fromBuffer(encodedParents.get(p.txid)!); + if (parent.toHex() !== p.rawTransaction || parent.getId() !== p.txid) + return fail('INPUT_MISMATCH'); + if (parent.isCoinbase()) return fail('UNSUPPORTED_PARENT'); + let total = 0n; + for (const output of parent.outs) { + if (output.value < 0n || output.value > profile.maximumMoney) + return fail('INVALID_REQUEST'); + total += output.value; + if (total > profile.maximumMoney) return fail('INVALID_REQUEST'); + } + parents.set(p.txid, parent); + } + const recipientRecord = record(r.recipient, ['address', 'valueSatoshis']); + const recipient = Object.freeze({ + address: recipientAddress( + recipientRecord.address, + profile.addressNetwork + ), + valueSatoshis: quantity( + recipientRecord.valueSatoshis, + profile.maximumMoney, + true + ), + }); + const changeRecord = + r.change === null ? null : record(r.change, ['index', 'valueSatoshis']); + const change = + changeRecord === null + ? null + : Object.freeze({ + index: index(changeRecord.index), + valueSatoshis: quantity( + changeRecord.valueSatoshis, + profile.maximumMoney, + true + ), + }); + const f = record(r.feeLimits, ['maxFeeSatoshis', 'maxFeeRateSatPerVByte']); + const feeLimits = Object.freeze({ + maxFeeSatoshis: quantity(f.maxFeeSatoshis, LIMITS.maxFee), + maxFeeRateSatPerVByte: quantity( + f.maxFeeRateSatPerVByte, + LIMITS.maxFeeRate + ), + }); + const psbt = new Psbt({ network: profile.addressNetwork }); + psbt.setVersion(2); + psbt.setLocktime(0); + const seen = new Set(); + const used = new Set(); + const previousOutputs: { script: Uint8Array; value: bigint }[] = []; + let inputTotal = 0n; + for (const i of inputs) { + const outpoint = `${i.txid}:${i.vout}`; + if (seen.has(outpoint)) return fail('INPUT_MISMATCH'); + seen.add(outpoint); + const previous = parents.get(i.txid)?.outs[i.vout]; + if (!previous) return fail('INPUT_MISMATCH'); + used.add(i.txid); + const derived = deriveBip84PublicAddress({ + network: network.network, + accountKey: account.canonicalKey, + branch: i.branch, + index: i.index, + }); + if (Buffer.from(previous.script).toString('hex') !== derived.scriptPubKey) + return fail('INPUT_MISMATCH'); + inputTotal += previous.value; + if (inputTotal > profile.maximumMoney) return fail('INVALID_REQUEST'); + previousOutputs.push({ + script: Uint8Array.from(previous.script), + value: previous.value, + }); + psbt.addInput({ + hash: i.txid, + index: i.vout, + sequence: r.rbf ? 0xfffffffd : 0xffffffff, + witnessUtxo: { + script: Uint8Array.from(previous.script), + value: previous.value, + }, + sighashType: Transaction.SIGHASH_ALL, + }); + } + if (used.size !== parents.size) return fail('INVALID_REQUEST'); + psbt.addOutput({ + address: recipient.address, + value: BigInt(recipient.valueSatoshis), + }); + let outputTotal = BigInt(recipient.valueSatoshis); + if (change) { + const derived = deriveBip84PublicAddress({ + network: network.network, + accountKey: account.canonicalKey, + branch: 1, + index: change.index, + }); + psbt.addOutput({ + script: Buffer.from(derived.scriptPubKey, 'hex'), + value: BigInt(change.valueSatoshis), + }); + outputTotal += BigInt(change.valueSatoshis); + } + if (outputTotal > profile.maximumMoney) return fail('INVALID_REQUEST'); + const fee = inputTotal - outputTotal; + if (fee < 0n || fee > BigInt(feeLimits.maxFeeSatoshis)) + return fail('FEE_LIMIT'); + const unsignedBytes = psbt.data.globalMap.unsignedTx.toBuffer(); + if ( + unsignedBytes.length > LIMITS.unsignedBytes || + psbt.toBuffer().length > LIMITS.psbtBytes + ) + return fail('LIMIT_EXCEEDED'); + // A valid P2WPKH DER signature (including sighash byte) is at most 73 bytes. + // This only rejects fees that cannot fit the rate cap even at maximum size. + // Signing must check the actual final vsize again before releasing bytes. + const maximumSigned = Transaction.fromBuffer(unsignedBytes); + inputs.forEach((_, i) => + maximumSigned.setWitness(i, [new Uint8Array(73), new Uint8Array(33)]) + ); + if (maximumSigned.toBuffer().length > LIMITS.signedBytes) + return fail('LIMIT_EXCEEDED'); + if ( + fee > + BigInt(maximumSigned.virtualSize()) * + BigInt(feeLimits.maxFeeRateSatPerVByte) + ) + return fail('FEE_LIMIT'); + const plan: Bip84NativePlan = Object.freeze({ + network, + account, + inputs, + previousTransactions, + recipient, + change, + locktime: 0, + rbf: r.rbf, + feeLimits, + }); + return { + prepared: Object.freeze({ + plan, + unsignedTransaction: Buffer.from(unsignedBytes).toString('hex'), + feeSatoshis: fee.toString(), + }), + psbt, + previousOutputs, + }; + } catch (error) { + if (error instanceof Bip84NativeError) throw error; + return fail('INVALID_REQUEST'); + } +} + +/** Pure bounded preparation; returned data carries no signing authorization. */ +export function prepareBip84NativeTransaction( + plan: Bip84NativePlan +): PreparedBip84NativeTransaction { + return validateBip84NativePlan(plan).prepared; +} diff --git a/packages/sysweb3-keyring/src/transactions/ethereum.ts b/packages/sysweb3-keyring/src/transactions/ethereum.ts index 3dd0c45d..08c530e5 100644 --- a/packages/sysweb3-keyring/src/transactions/ethereum.ts +++ b/packages/sysweb3-keyring/src/transactions/ethereum.ts @@ -1,73 +1,242 @@ -import { TransactionResponse } from '@ethersproject/abstract-provider'; -import { EthereumTransactionEIP1559 } from '@trezor/connect-web'; import { - concatSig, decrypt, - SignedMsgParams, - signTypedMessage, + signTypedData as signTypedDataUtil, TypedMessage, - Version, - TypedData, + SignTypedDataVersion, + TypedDataV1, getEncryptionPublicKey, recoverPersonalSignature, - recoverTypedMessage, + recoverTypedSignature, EthEncryptedData, -} from 'eth-sig-util'; +} from '@metamask/eth-sig-util'; +import { INetwork, INetworkType } from '@sidhujag/sysweb3-network'; import { - ecsign, - toBuffer, - stripHexPrefix, - hashPersonalMessage, - toAscii, -} from 'ethereumjs-util'; -import { BigNumber, ethers } from 'ethers'; -import { Deferrable } from 'ethers/lib/utils'; -import floor from 'lodash/floor'; + createContractUsingAbi, + getErc20Abi, + getErc21Abi, + getErc55Abi, +} from '@sidhujag/sysweb3-utils'; +import { Transaction } from 'ethers/transaction'; import omit from 'lodash/omit'; -import { LedgerKeyring } from '../ledger'; -import { CustomJsonRpcProvider, CustomL2JsonRpcProvider } from '../providers'; -import { TrezorKeyring } from '../trezor'; +import { + BigNumber, + Contract, + Deferrable, + TransactionRequest, + TransactionResponse, + Zero, + formatEther, + formatUnits, + isHexString, + normalizeTransactionRequest, + normalizeTxValue, + parseUnits, + resolveProperties, + serializeTransaction, +} from '../ethers-v6'; +import { getEvmFeeData, parseEvmFeeQuantity } from '../evm-fees'; +import { CustomJsonRpcProvider, wrapTransactionResponse } from '../providers'; import { IResponseFromSendErcSignedTransaction, ISendSignedErcTransactionProps, - ISendTransaction, IEthereumTransactions, + IEvmCancellationOptions, + IEvmReplacementOptions, + IEvmSendOptions, SimpleTransactionRequest, KeyringAccountType, accountType, IGasParams, } from '../types'; -import { INetwork, INetworkType } from '@pollum-io/sysweb3-network'; import { - createContractUsingAbi, - getErc20Abi, - getErc21Abi, - getErc55Abi, -} from '@pollum-io/sysweb3-utils'; - -/** - * Chain IDs for zkSync Era networks that require specialized L2 provider functionality. - * These networks use CustomL2JsonRpcProvider (which extends zksync-ethers.Provider) - * instead of CustomJsonRpcProvider. - * - * zkSync Era networks: - * - 324: zkSync Era Mainnet - * - 300: zkSync Era Sepolia Testnet - */ -const L2_NETWORK_CHAIN_IDS = [324, 300]; - -export class EthereumTransactions implements IEthereumTransactions { - private _web3Provider: CustomJsonRpcProvider | CustomL2JsonRpcProvider; - public trezorSigner: TrezorKeyring; - public ledgerSigner: LedgerKeyring; + deriveEvmAccountFromMnemonic, + parsePersonalMessage as parseLocalPersonalMessage, + privateKeyToAccount, + sendLocalEvmTransaction, + signDigestHex, + signPersonalMessage as signLocalPersonalMessage, +} from './evm-local-signer'; +import { getAddressDerivationPath } from '../utils/derivation-paths'; + +import type { LedgerKeyring } from '../ledger'; +import type { TrezorKeyring } from '../trezor'; +import type { EthereumTransactionEIP1559 } from '@trezor/connect-webextension'; + +/** Minimal trusted device capabilities used by EVM transaction routing. */ +export interface EthereumLedgerSigner { + evm: Pick< + LedgerKeyring['evm'], + 'signTypedData' | 'signPersonalMessage' | 'signEVMTransaction' + >; + verifyUtxoAddress: LedgerKeyring['verifyUtxoAddress']; +} + +export type EthereumTrezorSigner = Pick< + TrezorKeyring, + 'signTypedData' | 'signMessage' | 'signEthTransaction' | 'verifyUtxoAddress' +>; + +const hardwareSignerUnavailable = (hardware: string) => + Object.assign(new Error(`${hardware} signer is unavailable in this host`), { + code: 'HARDWARE_SIGNER_UNAVAILABLE', + }); + +const assertHardwareTransactionSender = ( + signedTx: string, + expectedAddress: string +) => { + if ( + Transaction.from(signedTx).from?.toLowerCase() !== + expectedAddress.toLowerCase() + ) { + throw Object.assign( + new Error('Hardware signature does not match the approved account'), + { + code: 'HARDWARE_ACCOUNT_MISMATCH', + } + ); + } +}; + +const stripHexPrefix = (value: string) => { + return value.startsWith('0x') || value.startsWith('0X') + ? value.slice(2) + : value; +}; + +// Connect returns hexadecimal signature fields; normalize their encoding +// without mutating the response or reparsing an already numeric recovery v. +const trezorSignature = (signature: { + r: string; + s: string; + v: string | number; +}) => { + const { r, s, v } = signature; + if (![r, s].every((value) => /^(?:0x)?[0-9a-f]{64}$/i.test(value))) { + throw new Error('Invalid Trezor signature scalar encoding'); + } + if (typeof v === 'string' && !/^(?:0x)?[0-9a-f]+$/i.test(v)) { + throw new Error('Invalid Trezor signature recovery value'); + } + const recovery = typeof v === 'number' ? v : Number.parseInt(v, 16); + if (!Number.isSafeInteger(recovery) || recovery < 0) { + throw new Error('Invalid Trezor signature recovery value'); + } + return { + r: `0x${stripHexPrefix(r)}`, + s: `0x${stripHexPrefix(s)}`, + v: recovery, + }; +}; + +const normalizeEthersOverrideValue = (value: any) => normalizeTxValue(value); + +const nonNegativeFeeQuantity = (value: unknown, label: string): BigNumber => + BigNumber.from(parseEvmFeeQuantity(value, label)); + +const normalizeEthersOverrides = (overrides: Record) => { + const normalized = { ...overrides }; + for (const field of [ + 'gasLimit', + 'gasPrice', + 'maxFeePerGas', + 'maxPriorityFeePerGas', + ]) { + if (normalized[field] != null) { + normalized[field] = normalizeEthersOverrideValue(normalized[field]); + } + } + return normalized; +}; + +/** Bind all replacement input fields to the requested signed transaction. */ +const authenticateReplacementOriginal = ( + transaction: TransactionResponse, + requestedHash: string, + expectedSender: string, + chainId: number +): TransactionResponse => { + const fields = normalizeTransactionRequest(transaction); + if (fields.hash != null) fields.hash = fields.hash.toLowerCase(); + const type = + fields.type ?? + (fields.maxFeePerGas != null ? 2 : fields.accessList != null ? 1 : 0); + if (![0, 1, 2].includes(type)) { + throw new Error('Unsupported replacement transaction type'); + } + fields.signature = fields.signature ?? { + r: fields.r, + s: fields.s, + v: fields.v ?? fields.yParity, + }; + fields.type = type; + fields.data = fields.data ?? fields.input ?? '0x'; + if (type === 2) delete fields.gasPrice; // Not signed in type 2. + const original = Transaction.from(fields); + if ( + !original.signature || + original.hash !== requestedHash || + original.from?.toLowerCase() !== expectedSender || + original.chainId !== BigInt(chainId) + ) { + throw new Error('Original transaction is not authenticated'); + } + // Do not retain mutable RPC fields across subsequent asynchronous work. + return wrapTransactionResponse({ + ...original.toJSON(), + hash: original.hash, + from: original.from, + gasPrice: original.gasPrice ?? 0, + maxFeePerGas: original.maxFeePerGas ?? 0, + maxPriorityFeePerGas: original.maxPriorityFeePerGas ?? 0, + signature: original.signature, + blockNumber: transaction.blockNumber, + }); +}; + +const assertSynchronousOriginalValidation = ( + result: unknown, + message = 'Original transaction validator must be synchronous' +): void => { + if ( + result !== null && + (typeof result === 'object' || typeof result === 'function') && + typeof (result as PromiseLike).then === 'function' + ) { + // A void callback type also accepts async functions. Decline their pending + // decision and consume a later rejection without allowing signing to start. + void Promise.resolve(result).catch(() => undefined); + throw new Error(message); + } +}; + +export class EthereumTransactions< + TLedger extends EthereumLedgerSigner | undefined = LedgerKeyring, + TTrezor extends EthereumTrezorSigner | undefined = TrezorKeyring +> implements IEthereumTransactions +{ + private _web3Provider: CustomJsonRpcProvider; + private _web3ProviderKey?: string; + public trezorSigner: TTrezor; + public ledgerSigner: TLedger; private getNetwork: () => INetwork; + private captureSigningContext?: () => () => void; private abortController: AbortController; - private getDecryptedPrivateKey: () => { + private getDecryptedPrivateKey: ( + targetAccount?: IEvmReplacementOptions['targetAccount'] + ) => { address: string; decryptedPrivateKey: string; }; + // Allow manual override of gas parameters when automatic estimation fails + private gasOverrides: { + minGasLimit?: BigNumber; + minPriorityFee?: BigNumber; + feeMultiplier?: number; + } = {}; + private getState: () => { accounts: { HDAccount: accountType; @@ -82,7 +251,9 @@ export class EthereumTransactions implements IEthereumTransactions { constructor( getNetwork: () => INetwork, - getDecryptedPrivateKey: () => { + getDecryptedPrivateKey: ( + targetAccount?: IEvmReplacementOptions['targetAccount'] + ) => { address: string; decryptedPrivateKey: string; }, @@ -97,11 +268,15 @@ export class EthereumTransactions implements IEthereumTransactions { activeAccountType: KeyringAccountType; activeNetwork: INetwork; }, - ledgerSigner: LedgerKeyring, - trezorSigner: TrezorKeyring + ledgerSigner: TLedger, + trezorSigner: TTrezor, + captureSigningContext?: () => () => void ) { this.getNetwork = getNetwork; - this.getDecryptedPrivateKey = getDecryptedPrivateKey; + this.getDecryptedPrivateKey = (targetAccount) => { + this.assertHardwareSignerAvailable(targetAccount); + return getDecryptedPrivateKey(targetAccount); + }; this.abortController = new AbortController(); // NOTE: Defer network access until vault state getter is initialized @@ -110,29 +285,105 @@ export class EthereumTransactions implements IEthereumTransactions { this.getState = getState; this.trezorSigner = trezorSigner; this.ledgerSigner = ledgerSigner; + this.captureSigningContext = captureSigningContext; } + private requireLedgerSigner = (): EthereumLedgerSigner => { + if (!this.ledgerSigner) throw hardwareSignerUnavailable('Ledger'); + return this.ledgerSigner; + }; + + private requireTrezorSigner = (): EthereumTrezorSigner => { + if (!this.trezorSigner) throw hardwareSignerUnavailable('Trezor'); + return this.trezorSigner; + }; + + private assertHardwareSignerAvailable = ( + targetAccount?: IEvmReplacementOptions['targetAccount'] + ) => { + const state = this.getState(); + const type = targetAccount?.type ?? state.activeAccountType; + const id = targetAccount?.id ?? state.activeAccountId; + const account = state.accounts[type]?.[id]; + if (type === KeyringAccountType.Ledger || account?.isLedgerWallet) + this.requireLedgerSigner(); + if (type === KeyringAccountType.Trezor || account?.isTrezorWallet) + this.requireTrezorSigner(); + }; + + private captureEvmSigningContext = () => { + this.assertHardwareSignerAvailable(); + const { activeAccountType, activeAccountId, accounts, activeNetwork } = + this.getState(); + const selectedAccount = accounts[activeAccountType]?.[activeAccountId]; + if (!selectedAccount) throw new Error('Active account not found'); + const account = { address: selectedAccount.address }; + const network = { ...activeNetwork }; + const assertSession = this.captureSigningContext?.(); + const provider = this.web3Provider; + const assertCurrent = () => { + assertSession?.(); + const current = this.getState(); + const currentAccount = + current.accounts[current.activeAccountType]?.[current.activeAccountId]; + if ( + current.activeAccountId !== activeAccountId || + current.activeAccountType !== activeAccountType || + currentAccount?.address?.toLowerCase() !== + account.address.toLowerCase() || + [current.activeNetwork, this.getNetwork()].some( + (selected) => + selected.kind !== network.kind || + selected.chainId !== network.chainId || + selected.slip44 !== network.slip44 || + selected.url !== network.url + ) || + this.web3Provider !== provider + ) + throw new Error('Wallet signing context changed'); + }; + assertCurrent(); + return { + activeAccount: account, + activeAccountType, + activeAccountId, + activeNetwork: network, + provider, + assertCurrent, + }; + }; + // Getter that automatically ensures providers are initialized when accessed - public get web3Provider(): CustomJsonRpcProvider | CustomL2JsonRpcProvider { + public get web3Provider(): CustomJsonRpcProvider { this.ensureProvidersInitialized(); return this._web3Provider; } // Helper method to ensure providers are initialized when first needed private ensureProvidersInitialized() { - if (!this._web3Provider) { - // Providers not initialized yet, initialize them now - try { - const currentNetwork = this.getNetwork(); + // Keep provider in sync with current network selection. + // Hardware-wallet signing (e.g., Trezor) commits to a chainId; if the provider points at a different + // RPC/network than `activeNetwork`, nodes will reject broadcasts with chain-id mismatch errors. + try { + const currentNetwork = this.getNetwork(); + const currentUrl = currentNetwork?.url; + const currentKey = `${currentNetwork?.chainId ?? 'unknown'}|${ + currentUrl ?? '' + }`; + const needsInit = + !this._web3Provider || + !this._web3ProviderKey || + (currentUrl && this._web3ProviderKey !== currentKey); + if (needsInit) { this.setWeb3Provider(currentNetwork); - } catch (error) { - // If vault state not available yet, providers will be initialized later - // when setWeb3Provider is called explicitly - console.log( - '[EthereumTransactions] Deferring provider initialization:', - error.message - ); } + } catch (error: any) { + // If vault state not available yet, providers will be initialized later + // when setWeb3Provider is called explicitly + console.log( + '[EthereumTransactions] Deferring provider initialization:', + error?.message || error + ); } } @@ -151,8 +402,8 @@ export class EthereumTransactions implements IEthereumTransactions { signTypedData = async ( addr: string, - typedData: TypedData | TypedMessage, - version: Version + typedData: TypedDataV1 | TypedMessage, + version: SignTypedDataVersion ) => { const { address, decryptedPrivateKey } = this.getDecryptedPrivateKey(); const { activeAccountType, accounts, activeAccountId } = this.getState(); @@ -165,14 +416,18 @@ export class EthereumTransactions implements IEthereumTransactions { }; } - const signTypedData = () => { + const signTypedDataLocal = () => { if (addr.toLowerCase() !== address.toLowerCase()) throw { message: 'Decrypting for wrong address, change activeAccount maybe', }; const privKey = Buffer.from(stripHexPrefix(decryptedPrivateKey), 'hex'); - return signTypedMessage(privKey, { data: typedData }, version); + return signTypedDataUtil({ + privateKey: privKey, + data: typedData as any, + version, + }); }; const signTypedDataWithLedger = async () => { @@ -180,9 +435,10 @@ export class EthereumTransactions implements IEthereumTransactions { throw { message: 'Decrypting for wrong address, change activeAccount maybe', }; - return await this.ledgerSigner.evm.signTypedData({ + return await this.requireLedgerSigner().evm.signTypedData({ version, accountIndex: activeAccountId, + expectedAddress: activeAccount.address, data: typedData, }); }; @@ -192,7 +448,7 @@ export class EthereumTransactions implements IEthereumTransactions { throw { message: 'Decrypting for wrong address, change activeAccount maybe', }; - return await this.trezorSigner.signTypedData({ + return await this.requireTrezorSigner().signTypedData({ version, address: addr, data: typedData, @@ -206,21 +462,46 @@ export class EthereumTransactions implements IEthereumTransactions { case KeyringAccountType.Ledger: return await signTypedDataWithLedger(); default: - return signTypedData(); + return signTypedDataLocal(); + } + }; + + // Verify a UTXO address on the connected hardware wallet (Ledger or Trezor) + // Routes to the appropriate device based on activeAccountType + verifyUtxoAddress = async ( + accountIndex: number, + currency: string, + slip44: number + ): Promise => { + const { activeAccountType } = this.getState(); + + switch (activeAccountType) { + case KeyringAccountType.Ledger: + return await this.requireLedgerSigner().verifyUtxoAddress( + accountIndex, + currency, + slip44 + ); + case KeyringAccountType.Trezor: + return await this.requireTrezorSigner().verifyUtxoAddress( + accountIndex, + currency, + slip44 + ); + default: + throw new Error( + 'verifyUtxoAddress is only available for hardware wallet accounts' + ); } }; verifyTypedSignature = ( - data: TypedData | TypedMessage, + data: TypedDataV1 | TypedMessage, signature: string, - version: Version + version: SignTypedDataVersion ) => { try { - const msgParams: SignedMsgParams> = { - data, - sig: signature, - }; - return recoverTypedMessage(msgParams, version); + return recoverTypedSignature({ data: data as any, signature, version }); } catch (error) { throw error; } @@ -251,8 +532,6 @@ export class EthereumTransactions implements IEthereumTransactions { const sign = () => { try { - const bufPriv = toBuffer(decryptedPrivateKey); - // Validate and prepare the message for eth_sign let msgHash: Buffer; @@ -271,9 +550,7 @@ export class EthereumTransactions implements IEthereumTransactions { ); } - const sig = ecsign(msgHash, bufPriv); - const resp = concatSig(toBuffer(sig.v), sig.r, sig.s); - return resp; + return signDigestHex(msgHash, decryptedPrivateKey); } catch (error) { throw error; } @@ -281,10 +558,12 @@ export class EthereumTransactions implements IEthereumTransactions { const signWithLedger = async () => { try { - const response = await this.ledgerSigner.evm.signPersonalMessage({ - accountIndex: activeAccountId, - message: msg, - }); + const response = + await this.requireLedgerSigner().evm.signPersonalMessage({ + accountIndex: activeAccountId, + expectedAddress: activeAccount.address, + message: msg, + }); return response; } catch (error) { throw error; @@ -296,7 +575,7 @@ export class EthereumTransactions implements IEthereumTransactions { // For EVM networks, Trezor expects 'eth' regardless of the network's currency const trezorCoin = activeNetwork.slip44 === 60 ? 'eth' : activeNetwork.currency; - const response: any = await this.trezorSigner.signMessage({ + const response: any = await this.requireTrezorSigner().signMessage({ coin: trezorCoin, address: activeAccount.address, index: activeAccountId, @@ -344,16 +623,15 @@ export class EthereumTransactions implements IEthereumTransactions { const signPersonalMessageWithDefaultWallet = () => { try { - const privateKey = toBuffer(decryptedPrivateKey); - // Handle both hex-encoded and plain text messages for personal_sign let message: Buffer; if (msg.startsWith('0x')) { - // Message is hex-encoded - try { - message = toBuffer(msg); - } catch (error) { - // If hex parsing fails, treat as plain text + const rawHex = stripHexPrefix(msg); + if (rawHex.length % 2 === 0 && isHexString(msg)) { + // Message is valid hex-encoded bytes. + message = Buffer.from(rawHex, 'hex'); + } else { + // Malformed 0x-prefixed strings are literal text, not lossy hex. message = Buffer.from(msg, 'utf8'); } } else { @@ -361,10 +639,7 @@ export class EthereumTransactions implements IEthereumTransactions { message = Buffer.from(msg, 'utf8'); } - const msgHash = hashPersonalMessage(message); - const sig = ecsign(msgHash, privateKey); - const serialized = concatSig(toBuffer(sig.v), sig.r, sig.s); - return serialized; + return signLocalPersonalMessage(message, decryptedPrivateKey); } catch (error) { throw error; } @@ -382,10 +657,12 @@ export class EthereumTransactions implements IEthereumTransactions { messageForLedger = Buffer.from(msg, 'utf8').toString('hex'); } - const response = await this.ledgerSigner.evm.signPersonalMessage({ - accountIndex: activeAccountId, - message: messageForLedger, - }); + const response = + await this.requireLedgerSigner().evm.signPersonalMessage({ + accountIndex: activeAccountId, + expectedAddress: activeAccount.address, + message: messageForLedger, + }); return response; } catch (error) { throw error; @@ -407,7 +684,7 @@ export class EthereumTransactions implements IEthereumTransactions { // For EVM networks, Trezor expects 'eth' regardless of the network's currency const trezorCoin = activeNetwork.slip44 === 60 ? 'eth' : activeNetwork.currency; - const response: any = await this.trezorSigner.signMessage({ + const response: any = await this.requireTrezorSigner().signMessage({ coin: trezorCoin, address: activeAccount.address, index: activeAccountId, @@ -432,7 +709,7 @@ export class EthereumTransactions implements IEthereumTransactions { parsePersonalMessage = (hexMsg: string) => { try { - return toAscii(hexMsg); + return parseLocalPersonalMessage(hexMsg); } catch (error) { throw error; } @@ -440,17 +717,29 @@ export class EthereumTransactions implements IEthereumTransactions { verifyPersonalMessage = (message: string, sign: string) => { try { - const msgParams: SignedMsgParams = { + const msgParams = { data: message, - sig: sign, + signature: sign, }; - return recoverPersonalSignature(msgParams); + return recoverPersonalSignature(msgParams as any); } catch (error) { throw error; } }; getEncryptedPubKey = () => { + const { activeAccountType } = this.getState(); + + // Hardware wallets don't support encryption public key generation + if ( + activeAccountType === KeyringAccountType.Trezor || + activeAccountType === KeyringAccountType.Ledger + ) { + throw new Error( + 'Hardware wallets do not support eth_getEncryptionPublicKey' + ); + } + const { decryptedPrivateKey } = this.getDecryptedPrivateKey(); try { @@ -462,6 +751,16 @@ export class EthereumTransactions implements IEthereumTransactions { // eth_decryptMessage decryptMessage = (msgParams: string[]) => { + const { activeAccountType } = this.getState(); + + // Hardware wallets don't support message decryption + if ( + activeAccountType === KeyringAccountType.Trezor || + activeAccountType === KeyringAccountType.Ledger + ) { + throw new Error('Hardware wallets do not support eth_decrypt'); + } + const { address, decryptedPrivateKey } = this.getDecryptedPrivateKey(); let encryptedData = ''; @@ -478,7 +777,10 @@ export class EthereumTransactions implements IEthereumTransactions { try { const buff = Buffer.from(encryptedData, 'hex'); const cleanData: EthEncryptedData = JSON.parse(buff.toString('utf8')); - const sig = decrypt(cleanData, stripHexPrefix(decryptedPrivateKey)); + const sig = decrypt({ + encryptedData: cleanData, + privateKey: stripHexPrefix(decryptedPrivateKey), + }); return sig; } catch (error) { throw error; @@ -486,7 +788,74 @@ export class EthereumTransactions implements IEthereumTransactions { }; toBigNumber = (aBigNumberish: string | number) => - ethers.BigNumber.from(String(aBigNumberish)); + BigNumber.from(String(aBigNumberish)); + + private toHex0x = (value: any, fieldName: string): string => { + if (value === undefined || value === null) return '0x0'; + if (typeof value === 'string') { + const v = value.trim(); + if (v === '') return '0x0'; + if (v.startsWith('0x')) return v; + return BigNumber.from(v).toHexString(); + } + if (typeof value === 'number') return BigNumber.from(value).toHexString(); + if (BigNumber.isBigNumber(value)) return value.toHexString(); + const maybeHex = (value as any)?._hex ?? (value as any)?.hex ?? value; + try { + return BigNumber.from(maybeHex).toHexString(); + } catch (_e) { + throw new Error( + `Invalid numeric field "${fieldName}" for EVM tx: ${String(value)}` + ); + } + }; + + private resolveEvmFeeParams = async ( + { + gasPrice, + isLegacy = false, + maxFeePerGas, + maxPriorityFeePerGas, + }: { + gasPrice?: any; + isLegacy?: boolean; + maxFeePerGas?: any; + maxPriorityFeePerGas?: any; + }, + provider = this.web3Provider + ) => { + if (isLegacy) { + return { + gasPrice: gasPrice || (await provider.getGasPrice()), + isLegacy: true, + maxFeePerGas: undefined, + maxPriorityFeePerGas: undefined, + }; + } + + if (!maxFeePerGas || maxPriorityFeePerGas == null) { + const feeData = await provider.getFeeData(); + maxFeePerGas = maxFeePerGas || feeData.maxFeePerGas || feeData.gasPrice; + maxPriorityFeePerGas = + maxPriorityFeePerGas ?? feeData.maxPriorityFeePerGas; + + if (!maxFeePerGas || maxPriorityFeePerGas == null) { + return { + gasPrice: feeData.gasPrice || (await provider.getGasPrice()), + isLegacy: true, + maxFeePerGas: undefined, + maxPriorityFeePerGas: undefined, + }; + } + } + + return { + gasPrice: undefined, + isLegacy: false, + maxFeePerGas, + maxPriorityFeePerGas, + }; + }; getData = ({ contractAddress, @@ -504,9 +873,10 @@ export class EthereumTransactions implements IEthereumTransactions { contractAddress, this.web3Provider ); - const data = contract.methods - .transfer(receivingAddress, value) - .encodeABI(); + const data = contract.interface.encodeFunctionData('transfer', [ + receivingAddress, + value, + ]); return data; } catch (error) { @@ -514,35 +884,24 @@ export class EthereumTransactions implements IEthereumTransactions { } }; - getFeeDataWithDynamicMaxPriorityFeePerGas = async () => { - let maxFeePerGas = this.toBigNumber(0); - let maxPriorityFeePerGas = this.toBigNumber(0); - - try { - const block = await this.web3Provider.getBlock('latest'); - if (block && block.baseFeePerGas) { - try { - const ethMaxPriorityFee = await this.web3Provider.send( - 'eth_maxPriorityFeePerGas', - [] - ); - maxPriorityFeePerGas = ethers.BigNumber.from(ethMaxPriorityFee); - maxFeePerGas = block.baseFeePerGas.mul(2).add(maxPriorityFeePerGas); - } catch (e) { - maxPriorityFeePerGas = ethers.BigNumber.from('1500000000'); - maxFeePerGas = block.baseFeePerGas.mul(2).add(maxPriorityFeePerGas); - } - return { maxFeePerGas, maxPriorityFeePerGas }; - } else if (block && !block.baseFeePerGas) { - console.error('Chain doesnt support EIP1559'); - return { maxFeePerGas, maxPriorityFeePerGas }; - } else if (!block) throw new Error('Block not found'); - - return { maxFeePerGas, maxPriorityFeePerGas }; - } catch (error) { - console.error(error); - return { maxFeePerGas, maxPriorityFeePerGas }; - } + getFeeDataWithDynamicMaxPriorityFeePerGas = async ( + provider = this.web3Provider + ) => { + const fee = await getEvmFeeData(provider, { + signal: this.abortController.signal, + minPriorityFee: this.gasOverrides.minPriorityFee, + feeMultiplier: this.gasOverrides.feeMultiplier, + }); + return { + gasPrice: BigNumber.from(fee.gasPrice), + ...(fee.baseFeePerGas === undefined + ? {} + : { + baseFeePerGas: BigNumber.from(fee.baseFeePerGas), + }), + maxFeePerGas: BigNumber.from(fee.maxFeePerGas), + maxPriorityFeePerGas: BigNumber.from(fee.maxPriorityFeePerGas), + }; }; calculateNewGasValues = ( oldTxsParams: IGasParams, @@ -560,12 +919,15 @@ export class EthereumTransactions implements IEthereumTransactions { oldTxsParams; const calculateAndConvertNewValue = (feeValue: number) => { - const calculateValue = String(feeValue * multiplierToUse); + // Apply multiplier for replacement transaction (cancel or speedup) + const newValue = feeValue * multiplierToUse; + + const calculateValue = String(newValue); const convertValueToHex = '0x' + parseInt(calculateValue, 10).toString(16); - return ethers.BigNumber.from(convertValueToHex); + return BigNumber.from(convertValueToHex); }; const maxFeePerGasToNumber = maxFeePerGas?.toNumber(); @@ -576,6 +938,7 @@ export class EthereumTransactions implements IEthereumTransactions { const multiplierToUse = 1.2; //The same calculation we used in the edit fee modal, always using the 0.2 multiplier if (!isLegacy) { + // For EIP-1559 transactions newGasValues.maxFeePerGas = calculateAndConvertNewValue( maxFeePerGasToNumber as number ); @@ -591,12 +954,12 @@ export class EthereumTransactions implements IEthereumTransactions { } if (isForCancel) { - const DEFAULT_GAS_LIMIT_VALUE = '21000'; + const DEFAULT_GAS_LIMIT_VALUE = '42000'; const convertToHex = '0x' + parseInt(DEFAULT_GAS_LIMIT_VALUE, 10).toString(16); - newGasValues.gasLimit = ethers.BigNumber.from(convertToHex); + newGasValues.gasLimit = BigNumber.from(convertToHex); } if (!isForCancel) { @@ -609,30 +972,172 @@ export class EthereumTransactions implements IEthereumTransactions { }; cancelSentTransaction = async ( txHash: string, - isLegacy?: boolean + isLegacy: boolean | undefined, + fallbackNonce: number | undefined, + options: IEvmCancellationOptions ): Promise<{ error?: boolean; isCanceled: boolean; + maximumFee?: string; transaction?: TransactionResponse; }> => { - const tx = (await this.web3Provider.getTransaction( - txHash - )) as Deferrable; + // Cancellation is a signing operation too. Keep its account, network and + // provider fixed across RPC requests and hardware approval. + if (typeof options?.assertCurrentContext !== 'function') { + throw new Error('Cancellation context required'); + } + if (typeof options.validateOriginal !== 'function') { + throw new Error('Cancellation original validator required'); + } + if ( + fallbackNonce !== undefined && + (!Number.isSafeInteger(fallbackNonce) || fallbackNonce < 0) + ) { + throw new Error('Invalid cancellation fallback nonce'); + } + const previewOnly = options.previewOnly === true; + const approvedMaximumFee = options.approvedMaximumFee; + if ( + !previewOnly && + (typeof approvedMaximumFee !== 'string' || + !/^(0|[1-9][0-9]{0,77})$/.test(approvedMaximumFee)) + ) { + throw new Error('Cancellation fee approval required'); + } + const assertHostContext = options.assertCurrentContext; + assertHostContext(); + const state = this.getState(); + const selectedType = state.activeAccountType; + const selectedId = state.activeAccountId; + const selectedAddress = + state.accounts?.[selectedType]?.[selectedId]?.address; + const activeAccountType = options.targetAccount?.type ?? selectedType; + const activeAccountId = options.targetAccount?.id ?? selectedId; + const targetAccount = options.targetAccount + ? { type: activeAccountType, id: activeAccountId } + : undefined; + const activeAccount = { + ...state.accounts?.[activeAccountType]?.[activeAccountId], + }; + const activeNetwork = { ...state.activeNetwork }; + if ( + !selectedAddress || + !activeAccount.address || + (targetAccount && activeAccountType === KeyringAccountType.SmartAccount) + ) { + throw new Error('Cancellation signing account is unavailable'); + } + if (!previewOnly) this.assertHardwareSignerAvailable(targetAccount); + const provider = this.web3Provider; + const assertSession = this.captureSigningContext?.(); + const assertKeyringContext = () => { + assertSession?.(); + const current = this.getState(); + if ( + current.activeAccountType !== selectedType || + current.activeAccountId !== selectedId || + current.accounts?.[selectedType]?.[ + selectedId + ]?.address?.toLowerCase() !== selectedAddress.toLowerCase() || + current.accounts?.[activeAccountType]?.[ + activeAccountId + ]?.address?.toLowerCase() !== activeAccount.address.toLowerCase() || + [current.activeNetwork, this.getNetwork()].some( + (selected) => + selected.kind !== activeNetwork.kind || + selected.chainId !== activeNetwork.chainId || + selected.slip44 !== activeNetwork.slip44 || + selected.url !== activeNetwork.url + ) || + this.web3Provider !== provider + ) { + throw new Error('Wallet signing context changed'); + } + }; + const assertCurrent = () => { + assertHostContext(); + assertKeyringContext(); + }; + assertCurrent(); + const currentEip1559Fees = async () => { + const feeData = await this.getFeeDataWithDynamicMaxPriorityFeePerGas( + provider + ); + assertCurrent(); + const maxFeePerGas = nonNegativeFeeQuantity( + feeData.maxFeePerGas, + 'cancellation maximum fee' + ); + const maxPriorityFeePerGas = nonNegativeFeeQuantity( + feeData.maxPriorityFeePerGas, + 'cancellation priority fee' + ); + if (maxFeePerGas.isZero() || maxPriorityFeePerGas.gt(maxFeePerGas)) { + throw new Error('Invalid cancellation EIP-1559 fees'); + } + return { maxFeePerGas, maxPriorityFeePerGas }; + }; - if (!tx) { - //If we don't find the TX or is already confirmed we send as error true to show this message - //in the alert at Pali + const response = await provider.getTransaction(txHash); + assertCurrent(); + if (response?.blockNumber != null || response?.blockHash != null) { + throw new Error('Original transaction is already mined'); + } + let tx: Deferrable | null = + response === null + ? null + : authenticateReplacementOriginal( + response, + txHash.toLowerCase(), + activeAccount.address.toLowerCase(), + activeNetwork.chainId + ); + assertSynchronousOriginalValidation( + options.validateOriginal(tx as TransactionResponse | null) + ); + assertCurrent(); + + // If transaction not found, create a minimal tx object with current gas prices + // This handles cases where tx with 0 gas never made it to the mempool + if (!tx && fallbackNonce !== undefined) { + // Fetch current network gas prices for the cancellation + if (isLegacy) { + const currentGasPrice = nonNegativeFeeQuantity( + await provider.getGasPrice(), + 'cancellation gas price' + ); + assertCurrent(); + tx = { + from: activeAccount.address, + to: activeAccount.address, + value: Zero, + nonce: fallbackNonce, + gasPrice: currentGasPrice, + gasLimit: BigNumber.from(42000), + data: '0x', + } as Deferrable; + } else { + const feeData = await currentEip1559Fees(); + tx = { + from: activeAccount.address, + to: activeAccount.address, + value: Zero, + nonce: fallbackNonce, + maxFeePerGas: feeData.maxFeePerGas, + maxPriorityFeePerGas: feeData.maxPriorityFeePerGas, + gasLimit: BigNumber.from(42000), + data: '0x', + } as Deferrable; + } + } else if (!tx) { + // No fallback nonce provided and tx not found return { isCanceled: false, error: true, }; } - const { decryptedPrivateKey } = this.getDecryptedPrivateKey(); - const wallet = new ethers.Wallet(decryptedPrivateKey, this.web3Provider); - - let changedTxToCancel: Deferrable; - + // If the original tx has 0 or very low gas price, fetch current network gas prices const oldTxsGasValues: IGasParams = { maxFeePerGas: tx.maxFeePerGas as BigNumber, maxPriorityFeePerGas: tx.maxPriorityFeePerGas as BigNumber, @@ -640,46 +1145,297 @@ export class EthereumTransactions implements IEthereumTransactions { gasLimit: tx.gasLimit as BigNumber, }; - if (!isLegacy) { - const newGasValues = this.calculateNewGasValues( - oldTxsGasValues, - true, - false + if (isLegacy) { + const currentGasPrice = nonNegativeFeeQuantity( + await provider.getGasPrice(), + 'cancellation gas price' ); + assertCurrent(); + if (oldTxsGasValues.gasPrice != null) { + oldTxsGasValues.gasPrice = nonNegativeFeeQuantity( + oldTxsGasValues.gasPrice, + 'original gas price' + ); + } - //We have to send another TX using the same nonce but we can use the From and To for the same address and also - //the value as 0 - changedTxToCancel = { - nonce: tx.nonce, - from: wallet.address, - to: wallet.address, - value: ethers.constants.Zero, - maxFeePerGas: newGasValues.maxFeePerGas, - maxPriorityFeePerGas: newGasValues.maxPriorityFeePerGas, - gasLimit: newGasValues.gasLimit, - }; + if ( + !oldTxsGasValues.gasPrice || + oldTxsGasValues.gasPrice.isZero() || + oldTxsGasValues.gasPrice.lt(currentGasPrice) + ) { + oldTxsGasValues.gasPrice = currentGasPrice; + } } else { - const newGasValues = this.calculateNewGasValues( - oldTxsGasValues, - true, - true - ); - //We have to send another TX using the same nonce but we can use the From and To for the same address and also - //the value as 0 - changedTxToCancel = { - nonce: tx.nonce, - from: wallet.address, - to: wallet.address, - value: ethers.constants.Zero, - gasLimit: newGasValues.gasLimit, - gasPrice: newGasValues.gasPrice, - }; + const { + maxFeePerGas: currentMaxFeePerGas, + maxPriorityFeePerGas: currentMaxPriorityFeePerGas, + } = await currentEip1559Fees(); + if (oldTxsGasValues.maxFeePerGas != null) { + oldTxsGasValues.maxFeePerGas = nonNegativeFeeQuantity( + oldTxsGasValues.maxFeePerGas, + 'original maximum fee' + ); + } + if (oldTxsGasValues.maxPriorityFeePerGas != null) { + oldTxsGasValues.maxPriorityFeePerGas = nonNegativeFeeQuantity( + oldTxsGasValues.maxPriorityFeePerGas, + 'original priority fee' + ); + } + + if ( + !oldTxsGasValues.maxFeePerGas || + oldTxsGasValues.maxFeePerGas.isZero() || + oldTxsGasValues.maxFeePerGas.lt(currentMaxFeePerGas) + ) { + oldTxsGasValues.maxFeePerGas = currentMaxFeePerGas; + } + + if ( + !oldTxsGasValues.maxPriorityFeePerGas || + oldTxsGasValues.maxPriorityFeePerGas.lt(currentMaxPriorityFeePerGas) + ) { + oldTxsGasValues.maxPriorityFeePerGas = currentMaxPriorityFeePerGas; + } + + if ( + oldTxsGasValues.maxFeePerGas.lt(oldTxsGasValues.maxPriorityFeePerGas) + ) { + oldTxsGasValues.maxFeePerGas = oldTxsGasValues.maxPriorityFeePerGas; + } } - const cancelTransaction = async () => { + // Preserve the existing 20% replacement policy with exact integer math. + // Nodes also require a strictly larger cap and tip than an old pending + // transaction; zero/small fees therefore need at least a one-wei bump. + // This is a replacement bump, not a fabricated network priority floor. + const bumpCancelFee = (fee: BigNumber) => { + const percentageBump = fee.mul(120).div(100); + const strictBump = fee.add(1); + return percentageBump.gt(strictBump) ? percentageBump : strictBump; + }; + const newGasValues: IGasParams = { + gasLimit: BigNumber.from(42000), + ...(isLegacy + ? { gasPrice: bumpCancelFee(oldTxsGasValues.gasPrice!) } + : { + maxFeePerGas: bumpCancelFee(oldTxsGasValues.maxFeePerGas!), + maxPriorityFeePerGas: bumpCancelFee( + oldTxsGasValues.maxPriorityFeePerGas! + ), + }), + }; + + const maximumFee = newGasValues.gasLimit!.mul( + isLegacy ? newGasValues.gasPrice! : newGasValues.maxFeePerGas! + ); + assertCurrent(); + if (previewOnly) + return { + isCanceled: false, + error: false, + maximumFee: maximumFee.toString(), + }; + if (maximumFee.gt(approvedMaximumFee!)) + throw new Error('Cancellation fee exceeds approval'); + const assertApprovedEnvelope = (transaction: TransactionRequest) => { + const gas = nonNegativeFeeQuantity( + transaction.gasLimit, + 'cancellation gas limit' + ); + const cap = nonNegativeFeeQuantity( + isLegacy ? transaction.gasPrice : transaction.maxFeePerGas, + 'cancellation maximum fee' + ); + if (!gas.eq(42000) || gas.mul(cap).gt(approvedMaximumFee!)) + throw new Error('Cancellation fee exceeds approval'); + }; + + // Base cancel transaction parameters (same for all wallet types) + const baseCancelTx = { + nonce: tx.nonce, + from: activeAccount.address, + to: activeAccount.address, + value: Zero, + gasLimit: newGasValues.gasLimit, + }; + + const changedTxToCancel: Deferrable = isLegacy + ? { + ...baseCancelTx, + gasPrice: newGasValues.gasPrice, + type: 0, // Force Type 0 for legacy cancel + } + : { + ...baseCancelTx, + maxFeePerGas: newGasValues.maxFeePerGas, + maxPriorityFeePerGas: newGasValues.maxPriorityFeePerGas, + // Don't set type - let ethers auto-detect + }; + + // Ledger cancel handler + const cancelWithLedger = async () => { try { - const transactionResponse = await wallet.sendTransaction( - changedTxToCancel + assertCurrent(); + const resolvedParams = await resolveProperties( + omit(changedTxToCancel, 'from') + ); + assertCurrent(); + const formatParams = { + ...resolvedParams, + nonce: resolvedParams.nonce + ? Number(resolvedParams.nonce.toString()) + : undefined, + }; + const txFormattedForEthers = isLegacy + ? { + ...formatParams, + chainId: activeNetwork.chainId, + type: 0, // Need explicit type for hardware wallet serialization + } + : { + ...formatParams, + chainId: activeNetwork.chainId, + type: 2, // Need explicit type for hardware wallet serialization + }; + + assertApprovedEnvelope(txFormattedForEthers); + const rawTx = serializeTransaction(txFormattedForEthers); + const signature = + await this.requireLedgerSigner().evm.signEVMTransaction({ + rawTx: rawTx.replace('0x', ''), + accountIndex: activeAccountId, + expectedAddress: activeAccount.address, + }); + assertCurrent(); + + const formattedSignature = { + r: `0x${signature.r}`, + s: `0x${signature.s}`, + v: parseInt(signature.v, 16), + }; + + if (signature) { + const signedTx = serializeTransaction( + txFormattedForEthers, + formattedSignature + ); + assertCurrent(); + assertHardwareTransactionSender(signedTx, activeAccount.address); + const transactionResponse = await provider.sendTransaction(signedTx); + + return { + isCanceled: true, + transaction: transactionResponse, + }; + } else { + return { + isCanceled: false, + error: true, + }; + } + } catch (error) { + return { + isCanceled: false, + error: true, + }; + } + }; + + // Trezor cancel handler + const cancelWithTrezor = async () => { + try { + assertCurrent(); + const trezorCoin = + activeNetwork.slip44 === 60 ? 'eth' : activeNetwork.currency; + const formattedTx = await resolveProperties( + omit(changedTxToCancel, 'from') + ); + assertCurrent(); + + const txFormattedForTrezor: any = { + ...formattedTx, + gasLimit: + typeof formattedTx.gasLimit === 'string' + ? formattedTx.gasLimit + : this.toHex0x(formattedTx.gasLimit, 'gasLimit'), + value: '0x0', + nonce: this.toHex0x(formattedTx.nonce, 'nonce'), + chainId: activeNetwork.chainId, + type: isLegacy ? 0 : 2, // Need explicit type for hardware wallet serialization + }; + + if (isLegacy) { + txFormattedForTrezor.gasPrice = + typeof formattedTx.gasPrice === 'string' + ? formattedTx.gasPrice + : this.toHex0x(formattedTx.gasPrice, 'gasPrice'); + } else { + txFormattedForTrezor.maxFeePerGas = + typeof (formattedTx as any).maxFeePerGas === 'string' + ? (formattedTx as any).maxFeePerGas + : this.toHex0x((formattedTx as any).maxFeePerGas, 'maxFeePerGas'); + txFormattedForTrezor.maxPriorityFeePerGas = + typeof (formattedTx as any).maxPriorityFeePerGas === 'string' + ? (formattedTx as any).maxPriorityFeePerGas + : this.toHex0x( + (formattedTx as any).maxPriorityFeePerGas, + 'maxPriorityFeePerGas' + ); + } + + assertApprovedEnvelope(txFormattedForTrezor); + const signature = await this.requireTrezorSigner().signEthTransaction({ + coin: trezorCoin, + tx: txFormattedForTrezor, + index: activeAccountId.toString(), + slip44: activeNetwork.slip44, + }); + assertCurrent(); + + if (signature.success) { + const signedTx = serializeTransaction( + txFormattedForTrezor, + trezorSignature(signature.payload) + ); + assertCurrent(); + assertHardwareTransactionSender(signedTx, activeAccount.address); + const transactionResponse = await provider.sendTransaction(signedTx); + + return { + isCanceled: true, + transaction: transactionResponse, + }; + } else { + return { + isCanceled: false, + error: true, + }; + } + } catch (error) { + return { + isCanceled: false, + error: true, + }; + } + }; + + // Regular wallet cancel handler + const cancelWithPrivateKey = async () => { + try { + assertCurrent(); + const { address, decryptedPrivateKey } = + this.getDecryptedPrivateKey(targetAccount); + if (address?.toLowerCase() !== activeAccount.address.toLowerCase()) { + throw new Error('Wallet signing context changed'); + } + const transactionResponse = await sendLocalEvmTransaction( + provider, + decryptedPrivateKey, + changedTxToCancel, + assertCurrent, + assertCurrent, + assertApprovedEnvelope ); if (transactionResponse) { @@ -693,8 +1449,6 @@ export class EthereumTransactions implements IEthereumTransactions { }; } } catch (error) { - //If we don't find the TX or is already confirmed we send as error true to show this message - //in the alert at Pali return { isCanceled: false, error: true, @@ -702,40 +1456,210 @@ export class EthereumTransactions implements IEthereumTransactions { } }; - return await cancelTransaction(); + // Route based on account type + switch (activeAccountType) { + case KeyringAccountType.Trezor: + return await cancelWithTrezor(); + case KeyringAccountType.Ledger: + return await cancelWithLedger(); + default: + return await cancelWithPrivateKey(); + } }; //TODO: This function needs to be refactored sendFormattedTransaction = async ( params: SimpleTransactionRequest, - isLegacy?: boolean + isLegacy?: boolean, + options?: IEvmSendOptions ) => { - const { activeAccountType, activeAccountId, accounts, activeNetwork } = - this.getState(); - const activeAccount = accounts[activeAccountType][activeAccountId]; + let broadcastAttempted = false; + try { + if ( + options !== undefined && + (!options || typeof options !== 'object' || Array.isArray(options)) + ) + throw new Error('Invalid transaction context options'); + // Capture once; later caller mutations cannot replace this invocation's + // admission decision while chain checks or device approval are pending. + const assertHostCurrent = options?.assertCurrent; + if ( + assertHostCurrent !== undefined && + typeof assertHostCurrent !== 'function' + ) + throw new Error('Invalid transaction context guard'); + return await this.sendFormattedTransactionInternal( + params, + isLegacy, + () => { + broadcastAttempted = true; + }, + assertHostCurrent + ); + } catch (error) { + // A broadcast transport error may mean the node accepted the signed + // transaction. Derive this marker from this invocation, never RPC data. + const submissionError = Object.assign( + new Error(error instanceof Error ? error.message : String(error)), + error, + { transactionNotBroadcast: !broadcastAttempted } + ); + if (error instanceof Error) { + submissionError.name = error.name; + submissionError.stack = error.stack; + } + throw submissionError; + } + }; + + private sendFormattedTransactionInternal = async ( + params: SimpleTransactionRequest, + isLegacy: boolean | undefined, + beforeBroadcast: () => void, + assertHostCurrent?: () => void + ) => { + // Hardware approval may outlive the selected account, network or unlocked + // session. Keep immutable identities and one provider for this invocation. + const { + activeAccount, + activeAccountType, + activeAccountId, + activeNetwork, + provider, + assertCurrent: assertKeyringCurrent, + } = this.captureEvmSigningContext(); + const assertCurrent = () => { + const result: unknown = assertHostCurrent?.(); + if (result !== undefined) { + assertSynchronousOriginalValidation( + result, + 'Transaction context guard must be synchronous' + ); + throw new Error('Transaction context guard must return undefined'); + } + assertKeyringCurrent(); + }; + const assertBeforeBroadcast = () => { + assertCurrent(); + beforeBroadcast(); + }; + assertCurrent(); + + const explicitEip1559 = + params.type != null && BigNumber.from(params.type).eq(2); + const requestedEip1559 = + explicitEip1559 || + params.maxFeePerGas != null || + params.maxPriorityFeePerGas != null; + if (isLegacy && requestedEip1559) + throw new Error('EIP-1559 fees conflict with legacy pricing'); + const validateEip1559Fees = () => { + const maximum = nonNegativeFeeQuantity( + params.maxFeePerGas, + 'maximum fee' + ); + const priority = nonNegativeFeeQuantity( + params.maxPriorityFeePerGas, + 'priority fee' + ); + if (maximum.isZero() || priority.gt(maximum)) + throw new Error('Invalid EIP-1559 fees'); + params.maxFeePerGas = maximum; + params.maxPriorityFeePerGas = priority; + }; + if ( + !isLegacy && + params.maxFeePerGas != null && + params.maxPriorityFeePerGas != null + ) + validateEip1559Fees(); + + // Only apply a minimum gas limit when a network-specific override is set. + // Otherwise keep the user/dapp-approved gas limit unchanged. + if (params.gasLimit && this.gasOverrides.minGasLimit) { + const minGasLimit = this.gasOverrides.minGasLimit; + const currentGasLimit = BigNumber.from(params.gasLimit); + if (currentGasLimit.lt(minGasLimit)) { + params.gasLimit = minGasLimit; + } + } + + const txForEstimation = isLegacy + ? omit( + { + ...params, + from: params.from || activeAccount.address, + }, + ['maxFeePerGas', 'maxPriorityFeePerGas', 'type'] + ) + : omit( + { + ...params, + from: params.from || activeAccount.address, + }, + ['gasPrice'] + ); + if (!params.gasLimit) { + params.gasLimit = await provider.estimateGas(txForEstimation); + assertCurrent(); + } + if (isLegacy) { + if (!params.gasPrice) { + params.gasPrice = await provider.getGasPrice(); + assertCurrent(); + } + } else if ( + params.maxFeePerGas == null || + params.maxPriorityFeePerGas == null + ) { + const feeData = await provider.getFeeData(); + assertCurrent(); + params.maxFeePerGas = params.maxFeePerGas ?? feeData.maxFeePerGas; + params.maxPriorityFeePerGas = + params.maxPriorityFeePerGas ?? feeData.maxPriorityFeePerGas; + if (params.maxFeePerGas == null || params.maxPriorityFeePerGas == null) { + if (requestedEip1559) throw new Error('EIP-1559 fee data unavailable'); + isLegacy = true; + params.gasPrice = feeData.gasPrice ?? (await provider.getGasPrice()); + assertCurrent(); + delete (params as any).maxFeePerGas; + delete (params as any).maxPriorityFeePerGas; + } + } + if (!isLegacy) validateEip1559Fees(); const sendEVMLedgerTransaction = async () => { - const transactionNonce = await this.getRecommendedNonce( - activeAccount.address + assertCurrent(); + const transactionNonce = await provider.getTransactionCount( + activeAccount.address, + 'pending' ); - const formatParams = omit(params, 'from'); //From is not needed we're already passing in the HD derivation path so it can be inferred + assertCurrent(); + const formatParams = isLegacy + ? omit(params, 'from') + : omit(params, ['from', 'gasPrice']); // Strip gasPrice for EIP-1559 const txFormattedForEthers = isLegacy ? { ...formatParams, nonce: transactionNonce, chainId: activeNetwork.chainId, + type: 0, // Force Type 0 for legacy } : { ...formatParams, nonce: transactionNonce, chainId: activeNetwork.chainId, - type: 2, + type: 2, // Need explicit type for hardware wallet serialization }; - const rawTx = ethers.utils.serializeTransaction(txFormattedForEthers); + const rawTx = serializeTransaction(txFormattedForEthers); - const signature = await this.ledgerSigner.evm.signEVMTransaction({ - rawTx: rawTx.replace('0x', ''), - accountIndex: activeAccountId, - }); + const signature = await this.requireLedgerSigner().evm.signEVMTransaction( + { + rawTx: rawTx.replace('0x', ''), + accountIndex: activeAccountId, + expectedAddress: activeAccount.address, + } + ); + assertCurrent(); const formattedSignature = { r: `0x${signature.r}`, @@ -745,11 +1669,13 @@ export class EthereumTransactions implements IEthereumTransactions { if (signature) { try { - const signedTx = ethers.utils.serializeTransaction( + const signedTx = serializeTransaction( txFormattedForEthers, formattedSignature ); - const finalTx = await this.web3Provider.sendTransaction(signedTx); + assertHardwareTransactionSender(signedTx, activeAccount.address); + assertBeforeBroadcast(); + const finalTx = await provider.sendTransaction(signedTx); return finalTx; } catch (error) { @@ -761,94 +1687,94 @@ export class EthereumTransactions implements IEthereumTransactions { }; const sendEVMTrezorTransaction = async () => { - const transactionNonce = await this.getRecommendedNonce( - activeAccount.address + assertCurrent(); + const transactionNonce = await provider.getTransactionCount( + activeAccount.address, + 'pending' ); + assertCurrent(); let txFormattedForTrezor = {}; - const formatParams = omit(params, 'from'); //From is not needed we're already passing in the HD derivation path so it can be inferred + const formatParams = isLegacy + ? omit(params, 'from') + : omit(params, ['from', 'gasPrice']); // Strip gasPrice for EIP-1559 switch (isLegacy) { case true: txFormattedForTrezor = { ...formatParams, - gasLimit: - typeof formatParams.gasLimit === 'string' - ? formatParams.gasLimit - : // @ts-ignore - `${params.gasLimit.hex}`, - value: - typeof formatParams.value === 'string' || - typeof formatParams.value === 'number' - ? `${formatParams.value}` - : // @ts-ignore - `${params.value.hex}`, + gasLimit: this.toHex0x( + (formatParams as any).gasLimit ?? (params as any).gasLimit, + 'gasLimit' + ), + value: this.toHex0x( + (formatParams as any).value ?? (params as any).value, + 'value' + ), nonce: this.toBigNumber(transactionNonce)._hex, chainId: activeNetwork.chainId, + data: (formatParams as any).data ?? '0x', }; break; case false: txFormattedForTrezor = { ...formatParams, - gasLimit: - typeof formatParams.gasLimit === 'string' - ? formatParams.gasLimit - : // @ts-ignore - `${params.gasLimit.hex}`, - maxFeePerGas: - typeof formatParams.maxFeePerGas === 'string' - ? formatParams.maxFeePerGas - : // @ts-ignore - `${params.maxFeePerGas.hex}`, - maxPriorityFeePerGas: - typeof formatParams.maxPriorityFeePerGas === 'string' - ? formatParams.maxPriorityFeePerGas - : // @ts-ignore - `${params.maxPriorityFeePerGas.hex}`, - value: - typeof formatParams.value === 'string' || - typeof formatParams.value === 'number' - ? `${formatParams.value}` - : // @ts-ignore - `${params.value.hex}`, + gasLimit: this.toHex0x( + (formatParams as any).gasLimit ?? (params as any).gasLimit, + 'gasLimit' + ), + maxFeePerGas: this.toHex0x( + (formatParams as any).maxFeePerGas ?? + (params as any).maxFeePerGas, + 'maxFeePerGas' + ), + maxPriorityFeePerGas: this.toHex0x( + (formatParams as any).maxPriorityFeePerGas ?? + (params as any).maxPriorityFeePerGas, + 'maxPriorityFeePerGas' + ), + value: this.toHex0x( + (formatParams as any).value ?? (params as any).value, + 'value' + ), nonce: this.toBigNumber(transactionNonce)._hex, chainId: activeNetwork.chainId, + data: (formatParams as any).data ?? '0x', }; break; default: txFormattedForTrezor = { ...formatParams, - gasLimit: - typeof formatParams.gasLimit === 'string' - ? formatParams.gasLimit - : // @ts-ignore - `${params.gasLimit.hex}`, - maxFeePerGas: - typeof formatParams.maxFeePerGas === 'string' - ? formatParams.maxFeePerGas - : // @ts-ignore - `${params.maxFeePerGas.hex}`, - maxPriorityFeePerGas: - typeof formatParams.maxPriorityFeePerGas === 'string' - ? formatParams.maxPriorityFeePerGas - : // @ts-ignore - `${params.maxPriorityFeePerGas.hex}`, - value: - typeof formatParams.value === 'string' || - typeof formatParams.value === 'number' - ? `${formatParams.value}` - : // @ts-ignore - `${params.value.hex}`, + gasLimit: this.toHex0x( + (formatParams as any).gasLimit ?? (params as any).gasLimit, + 'gasLimit' + ), + maxFeePerGas: this.toHex0x( + (formatParams as any).maxFeePerGas ?? + (params as any).maxFeePerGas, + 'maxFeePerGas' + ), + maxPriorityFeePerGas: this.toHex0x( + (formatParams as any).maxPriorityFeePerGas ?? + (params as any).maxPriorityFeePerGas, + 'maxPriorityFeePerGas' + ), + value: this.toHex0x( + (formatParams as any).value ?? (params as any).value, + 'value' + ), nonce: this.toBigNumber(transactionNonce)._hex, chainId: activeNetwork.chainId, + data: (formatParams as any).data ?? '0x', }; break; } - const signature = await this.trezorSigner.signEthTransaction({ + const signature = await this.requireTrezorSigner().signEthTransaction({ index: `${activeAccountId}`, tx: txFormattedForTrezor as EthereumTransactionEIP1559, coin: activeNetwork.currency, slip44: activeNetwork.slip44, }); + assertCurrent(); if (signature.success) { try { const txFormattedForEthers = isLegacy @@ -856,19 +1782,21 @@ export class EthereumTransactions implements IEthereumTransactions { ...formatParams, nonce: transactionNonce, chainId: activeNetwork.chainId, + type: 0, // Force Type 0 for legacy } : { ...formatParams, nonce: transactionNonce, chainId: activeNetwork.chainId, - type: 2, + type: 2, // Need explicit type for hardware wallet serialization }; - signature.payload.v = parseInt(signature.payload.v, 16); //v parameter must be a number by ethers standards - const signedTx = ethers.utils.serializeTransaction( + const signedTx = serializeTransaction( txFormattedForEthers, - signature.payload + trezorSignature(signature.payload) ); - const finalTx = await this.web3Provider.sendTransaction(signedTx); + assertHardwareTransactionSender(signedTx, activeAccount.address); + assertBeforeBroadcast(); + const finalTx = await provider.sendTransaction(signedTx); return finalTx; } catch (error) { @@ -880,6 +1808,7 @@ export class EthereumTransactions implements IEthereumTransactions { }; const sendEVMTransaction = async () => { + assertCurrent(); const { address, decryptedPrivateKey } = this.getDecryptedPrivateKey(); // Validate that we have the correct private key for the active account to prevent race conditions @@ -890,19 +1819,24 @@ export class EthereumTransactions implements IEthereumTransactions { ); } - const tx: Deferrable = params; - const wallet = new ethers.Wallet(decryptedPrivateKey, this.web3Provider); + // Explicitly set transaction type based on isLegacy flag + // For EIP-1559, ensure gasPrice is not present to avoid ethers throwing + const tx: Deferrable = isLegacy + ? { ...params, type: 0 } // Force Type 0 for legacy transactions + : (omit(params, ['gasPrice']) as Deferrable); // Strip gasPrice for EIP-1559 + try { - const transaction = await wallet.sendTransaction(tx); - const response = await this.web3Provider.getTransaction( - transaction.hash + const transaction = await sendLocalEvmTransaction( + provider, + decryptedPrivateKey, + tx, + assertBeforeBroadcast, + assertCurrent ); - //TODO: more precisely on this lines - if (!response) { - return await this.getTransactionTimestamp(transaction); - } else { - return await this.getTransactionTimestamp(response); - } + // The broadcast response already has the hash. Pending transactions + // have no block number, so a block lookup can fail after a successful + // broadcast and incorrectly report the send as failed. + return transaction; } catch (error) { throw error; } @@ -918,167 +1852,390 @@ export class EthereumTransactions implements IEthereumTransactions { }; sendTransactionWithEditedFee = async ( txHash: string, - isLegacy?: boolean + isLegacy = false, + options: IEvmReplacementOptions = {} ): Promise<{ + maximumFee?: string; error?: boolean; isSpeedUp: boolean; transaction?: TransactionResponse; + code?: string; + message?: string; }> => { - const tx = (await this.web3Provider.getTransaction( - txHash - )) as Deferrable; - + const { + assertCurrentContext, + validateOriginal, + beforeBroadcast, + approvedMaximumFee, + } = options; + const previewOnly = options.previewOnly === true; + if (!previewOnly) this.assertHardwareSignerAvailable(options.targetAccount); + if ( + !previewOnly && + (typeof approvedMaximumFee !== 'string' || + !/^\d{1,78}$/.test(approvedMaximumFee)) + ) { + throw new Error('Replacement fee approval required'); + } + const assertCurrent = () => assertCurrentContext?.(); + const assertBeforeBroadcast = () => { + assertCurrent(); + beforeBroadcast?.(); + assertCurrent(); + }; + const assertSignedSender = (signedTx: string) => { + if (Transaction.from(signedTx).from?.toLowerCase() !== expectedSender) { + throw new Error('Replacement signature does not match account'); + } + }; + assertCurrent(); + const state = this.getState(); + const activeAccountType = + options.targetAccount?.type ?? state.activeAccountType; + const activeAccountId = options.targetAccount?.id ?? state.activeAccountId; + const targetAccount = options.targetAccount + ? { type: activeAccountType, id: activeAccountId } + : undefined; + const activeAccount = { + ...state.accounts?.[activeAccountType]?.[activeAccountId], + }; + const activeNetwork = { ...state.activeNetwork }; + if ( + !activeAccount.address || + (targetAccount && activeAccountType === KeyringAccountType.SmartAccount) + ) { + throw new Error('Replacement signing account is unavailable'); + } + const expectedSender = activeAccount.address.toLowerCase(); + const requestedHash = txHash.toLowerCase(); + const provider = this.web3Provider; + assertCurrent(); + const validateLookup = (transaction: TransactionResponse | null) => { + assertCurrent(); + if (!transaction) return null; + const authenticated = authenticateReplacementOriginal( + transaction, + requestedHash, + expectedSender, + activeNetwork.chainId + ); + const type = authenticated.type; + if (type !== 1) isLegacy = type === 0; + if ( + isLegacy && + type === 1 && + activeAccountType === KeyringAccountType.Trezor + ) { + throw new Error('Trezor does not support type 1 replacement signing'); + } + assertSynchronousOriginalValidation(validateOriginal?.(authenticated)); + assertCurrent(); + return authenticated; + }; + let tx = validateLookup(await provider.getTransaction(txHash)); if (!tx) { - return { - isSpeedUp: false, - error: true, - }; + // Retry a couple of times in case the node hasn't indexed the pending tx yet + for (let attempt = 0; attempt < 2 && !tx; attempt++) { + await new Promise((resolve) => + setTimeout(resolve, 500 * (attempt + 1)) + ); + assertCurrent(); + tx = validateLookup(await provider.getTransaction(txHash)); + } + if (!tx) { + return { + isSpeedUp: false, + error: true, + code: 'TX_NOT_FOUND', + message: 'Original transaction not yet available from RPC provider', + }; + } } - - const { decryptedPrivateKey, address } = this.getDecryptedPrivateKey(); - const wallet = new ethers.Wallet(decryptedPrivateKey, this.web3Provider); - // Check if this might be a max send transaction by comparing total cost to balance - const currentBalance = await this.web3Provider.getBalance(address); - + const currentBalance = await provider.getBalance(activeAccount.address); + assertCurrent(); // Ensure all transaction values are resolved from promises const gasLimit = await Promise.resolve(tx.gasLimit); const gasPrice = await Promise.resolve(tx.gasPrice || 0); - const maxFeePerGas = await Promise.resolve(tx.maxFeePerGas || 0); + const maxFeePerGas = await Promise.resolve( + tx.type === 1 ? tx.gasPrice : tx.maxFeePerGas + ); const maxPriorityFeePerGas = await Promise.resolve( - tx.maxPriorityFeePerGas || 0 + tx.type === 1 ? tx.gasPrice : tx.maxPriorityFeePerGas ); const txValue = await Promise.resolve(tx.value); const txData = await Promise.resolve(tx.data || '0x'); - + assertCurrent(); // Check if this is a contract call (has data) const isContractCall = txData && txData !== '0x' && txData.length > 2; - const originalGasCost = isLegacy ? gasLimit.mul(gasPrice || 0) : gasLimit.mul(maxFeePerGas || 0); const originalTotalCost = txValue.add(originalGasCost); - // If original transaction used >95% of balance, it's likely a max send const balanceThreshold = currentBalance.mul(95).div(100); const isLikelyMaxSend = originalTotalCost.gt(balanceThreshold); - - let txWithEditedFee: Deferrable; - - const oldTxsGasValues: IGasParams = { - maxFeePerGas: maxFeePerGas as BigNumber, - maxPriorityFeePerGas: maxPriorityFeePerGas as BigNumber, - gasPrice: gasPrice as BigNumber, - gasLimit: gasLimit as BigNumber, + const oldTxsGasValues = { + maxFeePerGas: maxFeePerGas, + maxPriorityFeePerGas: maxPriorityFeePerGas, + gasPrice: gasPrice, + gasLimit: gasLimit, }; - - if (!isLegacy) { - const newGasValues = this.calculateNewGasValues( - oldTxsGasValues, - false, - false + // A zero-fee original may need a current estimate; the preview shows it + // and the final candidate must stay within the user's approved ceiling. + if (isLegacy && oldTxsGasValues.gasPrice.isZero()) { + oldTxsGasValues.gasPrice = await provider.getGasPrice(); + assertCurrent(); + } else if (!isLegacy && oldTxsGasValues.maxFeePerGas.isZero()) { + const feeData = await this.getFeeDataWithDynamicMaxPriorityFeePerGas( + provider ); - - let adjustedValue = txValue; - - // For likely max sends, check if we need to adjust value - if ( - isLikelyMaxSend && - newGasValues.gasLimit && - newGasValues.maxFeePerGas - ) { - const newGasCost = newGasValues.gasLimit.mul(newGasValues.maxFeePerGas); - const newTotalCost = txValue.add(newGasCost); - - if (newTotalCost.gt(currentBalance)) { - // If this is a contract call, we cannot adjust the value - if (isContractCall) { - console.error( - '[SpeedUp] Cannot adjust value for contract call - rejecting speedup' - ); - return { - isSpeedUp: false, - error: true, - }; - } - - // For non-contract calls, reduce value to fit within balance - adjustedValue = currentBalance.sub(newGasCost); - - // Ensure we don't go below a minimum threshold (0.0001 ETH) - const minValue = ethers.utils.parseEther('0.0001'); - if (adjustedValue.lt(minValue)) { - console.warn('[SpeedUp] Adjusted value too low, keeping original'); - adjustedValue = txValue; - } - } + assertCurrent(); + oldTxsGasValues.maxFeePerGas = BigNumber.from(feeData.maxFeePerGas || 0); + oldTxsGasValues.maxPriorityFeePerGas = BigNumber.from( + feeData.maxPriorityFeePerGas || 0 + ); + } + const newGasValues = this.calculateNewGasValues( + oldTxsGasValues, + false, + isLegacy + ); + if (!newGasValues.gasLimit!.gt(0)) + throw new Error('Invalid replacement gas limit'); + if ( + !isLegacy && + newGasValues.maxPriorityFeePerGas!.gt(newGasValues.maxFeePerGas!) + ) + throw new Error('Invalid replacement fee'); + const maximumFee = newGasValues.gasLimit!.mul( + isLegacy ? newGasValues.gasPrice! : newGasValues.maxFeePerGas! + ); + if (isLikelyMaxSend && txValue.add(maximumFee).gt(currentBalance)) { + if (isContractCall) { + console.error( + '[SpeedUp] Cannot adjust value for contract call - rejecting speedup' + ); + return { + isSpeedUp: false, + error: true, + code: 'CONTRACT_CALL_MAX_SEND', + message: + 'Cannot speed up a likely max-send contract call; value cannot be adjusted to fit new gas', + }; } - - txWithEditedFee = { - from: tx.from, - to: tx.to, - nonce: tx.nonce, - value: adjustedValue, - data: txData, - maxFeePerGas: newGasValues.maxFeePerGas, - maxPriorityFeePerGas: newGasValues.maxPriorityFeePerGas, - gasLimit: newGasValues.gasLimit, + return { + isSpeedUp: false, + error: true, + code: 'REPLACEMENT_VALUE_WOULD_CHANGE', + message: + 'Add funds before speeding up this transaction; the original amount will not be changed', }; - } else { - const newGasValues = this.calculateNewGasValues( - oldTxsGasValues, - false, - true - ); - - let adjustedValue = txValue; - - // For likely max sends, check if we need to adjust value - if (isLikelyMaxSend && newGasValues.gasLimit && newGasValues.gasPrice) { - const newGasCost = newGasValues.gasLimit.mul(newGasValues.gasPrice); - const newTotalCost = txValue.add(newGasCost); - - if (newTotalCost.gt(currentBalance)) { - // If this is a contract call, we cannot adjust the value - if (isContractCall) { - console.error( - '[SpeedUp] Cannot adjust value for contract call - rejecting speedup' - ); - return { - isSpeedUp: false, - error: true, + } + const txWithEditedFee: TransactionRequest = { + chainId: activeNetwork.chainId, + from: tx.from, + to: tx.to, + nonce: tx.nonce, + value: txValue, + data: txData, + gasLimit: newGasValues.gasLimit, + ...(tx.accessList != null ? { accessList: tx.accessList } : {}), + ...(isLegacy + ? { gasPrice: newGasValues.gasPrice, type: tx.type === 1 ? 1 : 0 } + : { + maxFeePerGas: newGasValues.maxFeePerGas, + maxPriorityFeePerGas: newGasValues.maxPriorityFeePerGas, + }), + }; + if (previewOnly) + return { isSpeedUp: false, maximumFee: maximumFee.toString() }; + if (maximumFee.gt(approvedMaximumFee!)) + throw new Error('Replacement fee exceeds approval'); + // Ledger speedup handler + const speedUpWithLedger = async () => { + try { + const resolvedParams = await resolveProperties( + omit(txWithEditedFee, 'from') + ); + const formatParams = { + ...resolvedParams, + nonce: + resolvedParams.nonce != null + ? Number(resolvedParams.nonce.toString()) + : undefined, + }; + const txFormattedForEthers = isLegacy + ? { + ...formatParams, + chainId: activeNetwork.chainId, + type: txWithEditedFee.type, + } + : { + ...formatParams, + chainId: activeNetwork.chainId, + type: 2, // Need explicit type for hardware wallet serialization }; - } - - // For non-contract calls, reduce value to fit within balance - adjustedValue = currentBalance.sub(newGasCost); - - // Ensure we don't go below a minimum threshold (0.0001 ETH) - const minValue = ethers.utils.parseEther('0.0001'); - if (adjustedValue.lt(minValue)) { - console.warn('[SpeedUp] Adjusted value too low, keeping original'); - adjustedValue = txValue; - } + const rawTx = serializeTransaction(txFormattedForEthers); + assertCurrent(); + const signature = + await this.requireLedgerSigner().evm.signEVMTransaction({ + rawTx: rawTx.replace('0x', ''), + accountIndex: activeAccountId, + expectedAddress: activeAccount.address, + }); + const formattedSignature = { + r: `0x${signature.r}`, + s: `0x${signature.s}`, + v: parseInt(signature.v, 16), + }; + if (signature) { + const signedTx = serializeTransaction( + txFormattedForEthers, + formattedSignature + ); + assertSignedSender(signedTx); + assertHardwareTransactionSender(signedTx, activeAccount.address); + assertBeforeBroadcast(); + const transactionResponse = await provider.sendTransaction(signedTx); + return { + isSpeedUp: true, + transaction: transactionResponse, + }; + } else { + return { + isSpeedUp: false, + error: true, + }; } + } catch (error) { + console.error( + '[SpeedUp] Failed to send replacement transaction with Ledger:', + error + ); + const message = error?.message || String(error); + const lower = message.toLowerCase(); + const code = lower.includes('underpriced') + ? 'REPLACEMENT_UNDERPRICED' + : lower.includes('known transaction') || + lower.includes('already known') + ? 'REPLACEMENT_ALREADY_KNOWN' + : 'REPLACEMENT_SEND_FAILED'; + return { + isSpeedUp: false, + error: true, + code, + message, + }; } - - txWithEditedFee = { - from: tx.from, - to: tx.to, - nonce: tx.nonce, - value: adjustedValue, - data: txData, - gasLimit: newGasValues.gasLimit, - gasPrice: newGasValues.gasPrice, - }; - } - - const sendEditedTransaction = async () => { + }; + // Trezor speedup handler + const speedUpWithTrezor = async () => { try { - const transactionResponse = await wallet.sendTransaction( - txWithEditedFee + const trezorCoin = + activeNetwork.slip44 === 60 ? 'eth' : activeNetwork.currency; + const formattedTx = await resolveProperties( + omit(txWithEditedFee, 'from') + ); + const txFormattedForTrezor: any = { + ...formattedTx, + gasLimit: + typeof formattedTx.gasLimit === 'string' + ? formattedTx.gasLimit + : this.toHex0x(formattedTx.gasLimit, 'gasLimit'), + value: + typeof formattedTx.value === 'string' + ? formattedTx.value + : this.toHex0x(formattedTx.value, 'value'), + nonce: this.toHex0x(formattedTx.nonce, 'nonce'), + chainId: activeNetwork.chainId, + type: isLegacy ? txWithEditedFee.type : 2, + }; + if (formattedTx.data && formattedTx.data !== '0x') { + txFormattedForTrezor.data = formattedTx.data; + } + if (isLegacy) { + txFormattedForTrezor.gasPrice = + typeof formattedTx.gasPrice === 'string' + ? formattedTx.gasPrice + : this.toHex0x(formattedTx.gasPrice, 'gasPrice'); + } else { + txFormattedForTrezor.maxFeePerGas = + typeof formattedTx.maxFeePerGas === 'string' + ? formattedTx.maxFeePerGas + : this.toHex0x(formattedTx.maxFeePerGas, 'maxFeePerGas'); + txFormattedForTrezor.maxPriorityFeePerGas = + typeof formattedTx.maxPriorityFeePerGas === 'string' + ? formattedTx.maxPriorityFeePerGas + : this.toHex0x( + formattedTx.maxPriorityFeePerGas, + 'maxPriorityFeePerGas' + ); + } + assertCurrent(); + const signature = await this.requireTrezorSigner().signEthTransaction({ + coin: trezorCoin, + tx: txFormattedForTrezor, + index: activeAccountId.toString(), + slip44: activeNetwork.slip44, + }); + if (signature.success) { + const signedTx = serializeTransaction( + txFormattedForTrezor, + trezorSignature(signature.payload) + ); + assertSignedSender(signedTx); + assertHardwareTransactionSender(signedTx, activeAccount.address); + assertBeforeBroadcast(); + const transactionResponse = await provider.sendTransaction(signedTx); + return { + isSpeedUp: true, + transaction: transactionResponse, + }; + } else { + return { + isSpeedUp: false, + error: true, + }; + } + } catch (error) { + console.error( + '[SpeedUp] Failed to send replacement transaction with Trezor:', + error + ); + const message = error?.message || String(error); + const lower = message.toLowerCase(); + const code = lower.includes('underpriced') + ? 'REPLACEMENT_UNDERPRICED' + : lower.includes('known transaction') || + lower.includes('already known') + ? 'REPLACEMENT_ALREADY_KNOWN' + : 'REPLACEMENT_SEND_FAILED'; + return { + isSpeedUp: false, + error: true, + code, + message, + }; + } + }; + // Regular wallet speedup handler + const speedUpWithPrivateKey = async () => { + try { + assertCurrent(); + const { address, decryptedPrivateKey } = + this.getDecryptedPrivateKey(targetAccount); + assertCurrent(); + if (address.toLowerCase() !== expectedSender) { + throw new Error('Replacement signing account changed'); + } + const transactionResponse = await sendLocalEvmTransaction( + provider, + decryptedPrivateKey, + txWithEditedFee, + assertBeforeBroadcast, + assertCurrent ); - if (transactionResponse) { return { isSpeedUp: true, @@ -1094,79 +2251,34 @@ export class EthereumTransactions implements IEthereumTransactions { '[SpeedUp] Failed to send replacement transaction:', error ); - //If we don't find the TX or is already confirmed we send as error true to show this message - //in the alert at Pali + const message = error?.message || String(error); + const lower = message.toLowerCase(); + const code = lower.includes('underpriced') + ? 'REPLACEMENT_UNDERPRICED' + : lower.includes('known transaction') || + lower.includes('already known') + ? 'REPLACEMENT_ALREADY_KNOWN' + : lower.includes('insufficient funds') + ? 'INSUFFICIENT_FUNDS_REPLACEMENT' + : 'REPLACEMENT_SEND_FAILED'; return { isSpeedUp: false, error: true, + code, + message, }; } }; - - return await sendEditedTransaction(); - }; - // TODO: refactor this function - sendTransaction = async ({ - sender, - receivingAddress, - amount, - gasLimit, - token, - }: ISendTransaction): Promise => { - const tokenDecimals = token && token.decimals ? token.decimals : 18; - const decimals = this.toBigNumber(tokenDecimals); - - const parsedAmount = ethers.utils.parseEther(String(amount)); - - const { decryptedPrivateKey } = this.getDecryptedPrivateKey(); - - const wallet = new ethers.Wallet(decryptedPrivateKey, this.web3Provider); - - const value = - token && token.contract_address - ? parsedAmount.mul(this.toBigNumber('10').pow(decimals)) - : parsedAmount; - - const data = - token && token.contract_address - ? this.getData({ - contractAddress: token.contract_address, - receivingAddress, - value, - }) - : null; - - // gas price, gas limit e maxPriorityFeePerGas (tip) - const { maxFeePerGas, maxPriorityFeePerGas } = - await this.getFeeDataWithDynamicMaxPriorityFeePerGas(); - - const tx: Deferrable = { - to: receivingAddress, - value, - maxPriorityFeePerGas, - maxFeePerGas, - nonce: await this.web3Provider.getTransactionCount(sender, 'latest'), - type: 2, - chainId: this.web3Provider.network.chainId, - gasLimit: this.toBigNumber(0) || gasLimit, - data, - }; - - tx.gasLimit = await this.web3Provider.estimateGas(tx); - - try { - const transaction = await wallet.sendTransaction(tx); - const response = await this.web3Provider.getTransaction(transaction.hash); - if (!response) { - return await this.getTransactionTimestamp(transaction); - } else { - return await this.getTransactionTimestamp(response); - } - } catch (error) { - throw error; + // Route based on account type + switch (activeAccountType) { + case KeyringAccountType.Trezor: + return await speedUpWithTrezor(); + case KeyringAccountType.Ledger: + return await speedUpWithLedger(); + default: + return await speedUpWithPrivateKey(); } }; - sendSignedErc20Transaction = async ({ receiver, tokenAddress, @@ -1179,50 +2291,63 @@ export class EthereumTransactions implements IEthereumTransactions { gasLimit, saveTrezorTx, }: ISendSignedErcTransactionProps): Promise => { - const { decryptedPrivateKey } = this.getDecryptedPrivateKey(); - const { accounts, activeAccountType, activeAccountId, activeNetwork } = - this.getState(); - const { address: activeAccountAddress } = - accounts[activeAccountType][activeAccountId]; + const { + activeAccount, + activeAccountType, + activeAccountId, + activeNetwork, + provider, + assertCurrent, + } = this.captureEvmSigningContext(); + const activeAccountAddress = activeAccount.address; + ({ gasPrice, isLegacy, maxFeePerGas, maxPriorityFeePerGas } = + await this.resolveEvmFeeParams( + { + gasPrice, + isLegacy, + maxFeePerGas, + maxPriorityFeePerGas, + }, + provider + )); + assertCurrent(); const sendERC20Token = async () => { - const currentWallet = new ethers.Wallet(decryptedPrivateKey); - - const walletSigned = currentWallet.connect(this.web3Provider); - + assertCurrent(); + const { decryptedPrivateKey } = this.getDecryptedPrivateKey(); try { - const _contract = new ethers.Contract( + const _contract = new Contract( tokenAddress, getErc20Abi(), - walletSigned - ); - const calculatedTokenAmount = ethers.BigNumber.from( - decimals - ? ethers.utils.parseUnits( - tokenAmount as string, - this.toBigNumber(decimals as number) - ) - : ethers.utils.parseEther(tokenAmount as string) + provider as any ); + // Preserve zero-decimal tokens: use provided decimals when defined (including 0). + const resolvedDecimals = + decimals === undefined || decimals === null ? 18 : Number(decimals); + const calculatedTokenAmount = parseUnits( + tokenAmount as string, + resolvedDecimals + ).toBigInt(); let transferMethod; if (isLegacy) { const overrides = { - nonce: await this.web3Provider.getTransactionCount( - walletSigned.address, + nonce: await provider.getTransactionCount( + activeAccountAddress, 'pending' ), gasPrice, ...(gasLimit && { gasLimit }), + type: 0, // Explicitly set Type 0 for legacy token transfers }; - transferMethod = await _contract.transfer( + transferMethod = await _contract.transfer.populateTransaction( receiver, calculatedTokenAmount, - overrides + normalizeEthersOverrides(overrides) ); } else { const overrides = { - nonce: await this.web3Provider.getTransactionCount( - walletSigned.address, + nonce: await provider.getTransactionCount( + activeAccountAddress, 'pending' ), maxPriorityFeePerGas, @@ -1230,34 +2355,50 @@ export class EthereumTransactions implements IEthereumTransactions { ...(gasLimit && { gasLimit }), }; - transferMethod = await _contract.transfer( + transferMethod = await _contract.transfer.populateTransaction( receiver, calculatedTokenAmount, - overrides + normalizeEthersOverrides(overrides) ); } - return transferMethod; + return await sendLocalEvmTransaction( + provider, + decryptedPrivateKey, + { + ...transferMethod, + chainId: activeNetwork.chainId, + from: activeAccountAddress, + value: '0x0', + }, + assertCurrent, + assertCurrent + ); } catch (error) { throw error; } }; const sendERC20TokenOnLedger = async () => { - const signer = this.web3Provider.getSigner(activeAccountAddress); - const transactionNonce = await this.getRecommendedNonce( - activeAccountAddress + assertCurrent(); + const transactionNonce = await provider.getTransactionCount( + activeAccountAddress, + 'pending' ); + assertCurrent(); try { - const _contract = new ethers.Contract( + const _contract = new Contract( tokenAddress, getErc20Abi(), - signer + provider as any ); - const calculatedTokenAmount = ethers.BigNumber.from( - ethers.utils.parseEther(tokenAmount as string) - ); + const resolvedDecimals = + decimals === undefined || decimals === null ? 18 : Number(decimals); + const calculatedTokenAmount = parseUnits( + tokenAmount as string, + resolvedDecimals + ).toBigInt(); const txData = _contract.interface.encodeFunctionData('transfer', [ receiver, @@ -1289,17 +2430,20 @@ export class EthereumTransactions implements IEthereumTransactions { data: txData, nonce: transactionNonce, chainId: activeNetwork.chainId, - type: 2, + type: 2, // Need explicit type for hardware wallet serialization }; } - const rawTx = ethers.utils.serializeTransaction(txFormattedForEthers); + const rawTx = serializeTransaction(txFormattedForEthers); - const signature = await this.ledgerSigner.evm.signEVMTransaction({ - rawTx: rawTx.replace('0x', ''), - accountIndex: activeAccountId, - }); + const signature = + await this.requireLedgerSigner().evm.signEVMTransaction({ + rawTx: rawTx.replace('0x', ''), + accountIndex: activeAccountId, + expectedAddress: activeAccount.address, + }); + assertCurrent(); const formattedSignature = { r: `0x${signature.r}`, s: `0x${signature.s}`, @@ -1307,11 +2451,13 @@ export class EthereumTransactions implements IEthereumTransactions { }; if (signature) { try { - const signedTx = ethers.utils.serializeTransaction( + const signedTx = serializeTransaction( txFormattedForEthers, formattedSignature ); - const finalTx = await this.web3Provider.sendTransaction(signedTx); + assertCurrent(); + assertHardwareTransactionSender(signedTx, activeAccount.address); + const finalTx = await provider.sendTransaction(signedTx); saveTrezorTx && saveTrezorTx(finalTx); @@ -1328,20 +2474,25 @@ export class EthereumTransactions implements IEthereumTransactions { }; const sendERC20TokenOnTrezor = async () => { - const signer = this.web3Provider.getSigner(activeAccountAddress); - const transactionNonce = await this.getRecommendedNonce( - activeAccountAddress + assertCurrent(); + const transactionNonce = await provider.getTransactionCount( + activeAccountAddress, + 'pending' ); + assertCurrent(); try { - const _contract = new ethers.Contract( + const _contract = new Contract( tokenAddress, getErc20Abi(), - signer + provider as any ); - const calculatedTokenAmount = ethers.BigNumber.from( - ethers.utils.parseEther(tokenAmount as string) - ); + const resolvedDecimals = + decimals === undefined || decimals === null ? 18 : Number(decimals); + const calculatedTokenAmount = parseUnits( + tokenAmount as string, + resolvedDecimals + ).toBigInt(); const txData = _contract.interface.encodeFunctionData('transfer', [ receiver, @@ -1356,10 +2507,8 @@ export class EthereumTransactions implements IEthereumTransactions { txToBeSignedByTrezor = { to: tokenAddress, value: '0x0', - // @ts-ignore - gasLimit: `${effectiveGasLimit.hex}`, - // @ts-ignore - gasPrice: `${gasPrice}`, + gasLimit: this.toHex0x(effectiveGasLimit, 'gasLimit'), + gasPrice: this.toHex0x(gasPrice, 'gasPrice'), nonce: this.toBigNumber(transactionNonce)._hex, chainId: activeNetwork.chainId, data: txData, @@ -1368,25 +2517,26 @@ export class EthereumTransactions implements IEthereumTransactions { txToBeSignedByTrezor = { to: tokenAddress, value: '0x0', - // @ts-ignore - gasLimit: `${effectiveGasLimit.hex}`, - // @ts-ignore - maxFeePerGas: `${maxFeePerGas.hex}`, - // @ts-ignore - maxPriorityFeePerGas: `${maxPriorityFeePerGas.hex}`, + gasLimit: this.toHex0x(effectiveGasLimit, 'gasLimit'), + maxFeePerGas: this.toHex0x(maxFeePerGas, 'maxFeePerGas'), + maxPriorityFeePerGas: this.toHex0x( + maxPriorityFeePerGas, + 'maxPriorityFeePerGas' + ), nonce: this.toBigNumber(transactionNonce)._hex, chainId: activeNetwork.chainId, data: txData, }; } - const signature = await this.trezorSigner.signEthTransaction({ + const signature = await this.requireTrezorSigner().signEthTransaction({ index: `${activeAccountId}`, tx: txToBeSignedByTrezor, coin: activeNetwork.currency, slip44: activeNetwork.slip44, }); + assertCurrent(); if (signature.success) { try { let txFormattedForEthers; @@ -1411,15 +2561,16 @@ export class EthereumTransactions implements IEthereumTransactions { data: txData, nonce: transactionNonce, chainId: activeNetwork.chainId, - type: 2, + type: 2, // Need explicit type for hardware wallet serialization }; } - signature.payload.v = parseInt(signature.payload.v, 16); //v parameter must be a number by ethers standards - const signedTx = ethers.utils.serializeTransaction( + const signedTx = serializeTransaction( txFormattedForEthers, - signature.payload + trezorSignature(signature.payload) ); - const finalTx = await this.web3Provider.sendTransaction(signedTx); + assertCurrent(); + assertHardwareTransactionSender(signedTx, activeAccount.address); + const finalTx = await provider.sendTransaction(signedTx); saveTrezorTx && saveTrezorTx(finalTx); @@ -1441,7 +2592,7 @@ export class EthereumTransactions implements IEthereumTransactions { case KeyringAccountType.Ledger: return await sendERC20TokenOnLedger(); default: - return await sendERC20Token(); + return (await sendERC20Token()) as any; } }; @@ -1455,74 +2606,110 @@ export class EthereumTransactions implements IEthereumTransactions { gasPrice, gasLimit, }: ISendSignedErcTransactionProps): Promise => { - const { decryptedPrivateKey } = this.getDecryptedPrivateKey(); - const { accounts, activeAccountType, activeAccountId, activeNetwork } = - this.getState(); - const { address: activeAccountAddress } = - accounts[activeAccountType][activeAccountId]; + const { + activeAccount, + activeAccountType, + activeAccountId, + activeNetwork, + provider, + assertCurrent, + } = this.captureEvmSigningContext(); + const activeAccountAddress = activeAccount.address; + if (tokenId === undefined || tokenId === null) { + throw new Error('ERC721 tokenId is required'); + } + ({ gasPrice, isLegacy, maxFeePerGas, maxPriorityFeePerGas } = + await this.resolveEvmFeeParams( + { + gasPrice, + isLegacy, + maxFeePerGas, + maxPriorityFeePerGas, + }, + provider + )); + assertCurrent(); + const normalizedTokenId = BigNumber.from(tokenId).toBigInt(); const sendERC721Token = async () => { - const currentWallet = new ethers.Wallet(decryptedPrivateKey); - const walletSigned = currentWallet.connect(this.web3Provider); + assertCurrent(); + const { decryptedPrivateKey } = this.getDecryptedPrivateKey(); let transferMethod; try { - const _contract = new ethers.Contract( + const _contract = new Contract( tokenAddress, getErc21Abi(), - walletSigned + provider as any ); if (isLegacy) { const overrides = { - nonce: await this.web3Provider.getTransactionCount( - walletSigned.address, + nonce: await provider.getTransactionCount( + activeAccountAddress, 'pending' ), gasPrice, ...(gasLimit && { gasLimit }), + type: 0, // Explicitly set Type 0 for legacy NFT transfers }; - transferMethod = await _contract.transferFrom( - walletSigned.address, + transferMethod = await _contract.transferFrom.populateTransaction( + activeAccountAddress, receiver, - tokenId as number, - overrides + normalizedTokenId, + normalizeEthersOverrides(overrides) ); } else { const overrides = { - nonce: await this.web3Provider.getTransactionCount( - walletSigned.address, + nonce: await provider.getTransactionCount( + activeAccountAddress, 'pending' ), + maxPriorityFeePerGas, + maxFeePerGas, + ...(gasLimit && { gasLimit }), }; - transferMethod = await _contract.transferFrom( - walletSigned.address, + transferMethod = await _contract.transferFrom.populateTransaction( + activeAccountAddress, receiver, - tokenId as number, - overrides + normalizedTokenId, + normalizeEthersOverrides(overrides) ); } - return transferMethod; + return await sendLocalEvmTransaction( + provider, + decryptedPrivateKey, + { + ...transferMethod, + chainId: activeNetwork.chainId, + from: activeAccountAddress, + value: '0x0', + }, + assertCurrent, + assertCurrent + ); } catch (error) { throw error; } }; const sendERC721TokenOnLedger = async () => { - const signer = this.web3Provider.getSigner(activeAccountAddress); - const transactionNonce = await this.getRecommendedNonce( - activeAccountAddress + assertCurrent(); + const transactionNonce = await provider.getTransactionCount( + activeAccountAddress, + 'pending' ); + assertCurrent(); try { - const _contract = new ethers.Contract( + const _contract = new Contract( tokenAddress, getErc21Abi(), - signer + provider as any ); const txData = _contract.interface.encodeFunctionData('transferFrom', [ activeAccountAddress, receiver, - tokenId, + normalizedTokenId, ]); // Use fallback gas limit if not provided (for auto-estimation) @@ -1550,17 +2737,20 @@ export class EthereumTransactions implements IEthereumTransactions { data: txData, nonce: transactionNonce, chainId: activeNetwork.chainId, - type: 2, + type: 2, // Need explicit type for hardware wallet serialization }; } - const rawTx = ethers.utils.serializeTransaction(txFormattedForEthers); + const rawTx = serializeTransaction(txFormattedForEthers); - const signature = await this.ledgerSigner.evm.signEVMTransaction({ - rawTx: rawTx.replace('0x', ''), - accountIndex: activeAccountId, - }); + const signature = + await this.requireLedgerSigner().evm.signEVMTransaction({ + rawTx: rawTx.replace('0x', ''), + accountIndex: activeAccountId, + expectedAddress: activeAccount.address, + }); + assertCurrent(); const formattedSignature = { r: `0x${signature.r}`, s: `0x${signature.s}`, @@ -1569,11 +2759,13 @@ export class EthereumTransactions implements IEthereumTransactions { if (signature) { try { - const signedTx = ethers.utils.serializeTransaction( + const signedTx = serializeTransaction( txFormattedForEthers, formattedSignature ); - const finalTx = await this.web3Provider.sendTransaction(signedTx); + assertCurrent(); + assertHardwareTransactionSender(signedTx, activeAccount.address); + const finalTx = await provider.sendTransaction(signedTx); return finalTx as any; } catch (error) { @@ -1588,20 +2780,22 @@ export class EthereumTransactions implements IEthereumTransactions { }; const sendERC721TokenOnTrezor = async () => { - const signer = this.web3Provider.getSigner(activeAccountAddress); - const transactionNonce = await this.getRecommendedNonce( - activeAccountAddress + assertCurrent(); + const transactionNonce = await provider.getTransactionCount( + activeAccountAddress, + 'pending' ); + assertCurrent(); try { - const _contract = new ethers.Contract( + const _contract = new Contract( tokenAddress, getErc21Abi(), - signer + provider as any ); const txData = _contract.interface.encodeFunctionData('transferFrom', [ activeAccountAddress, receiver, - tokenId, + normalizedTokenId, ]); // Use fallback gas limit if not provided (for auto-estimation) @@ -1612,10 +2806,8 @@ export class EthereumTransactions implements IEthereumTransactions { txToBeSignedByTrezor = { to: tokenAddress, value: '0x0', - // @ts-ignore - gasLimit: `${effectiveGasLimit.hex}`, - // @ts-ignore - gasPrice: `${gasPrice}`, + gasLimit: this.toHex0x(effectiveGasLimit, 'gasLimit'), + gasPrice: this.toHex0x(gasPrice, 'gasPrice'), nonce: this.toBigNumber(transactionNonce)._hex, chainId: activeNetwork.chainId, data: txData, @@ -1625,12 +2817,12 @@ export class EthereumTransactions implements IEthereumTransactions { txToBeSignedByTrezor = { to: tokenAddress, value: '0x0', - // @ts-ignore - gasLimit: `${effectiveGasLimit.hex}`, - // @ts-ignore - maxFeePerGas: `${maxFeePerGas.hex}`, - // @ts-ignore - maxPriorityFeePerGas: `${maxPriorityFeePerGas.hex}`, + gasLimit: this.toHex0x(effectiveGasLimit, 'gasLimit'), + maxFeePerGas: this.toHex0x(maxFeePerGas, 'maxFeePerGas'), + maxPriorityFeePerGas: this.toHex0x( + maxPriorityFeePerGas, + 'maxPriorityFeePerGas' + ), nonce: this.toBigNumber(transactionNonce)._hex, chainId: activeNetwork.chainId, data: txData, @@ -1640,13 +2832,14 @@ export class EthereumTransactions implements IEthereumTransactions { // For EVM networks, Trezor expects 'eth' regardless of the network's currency const trezorCoin = activeNetwork.slip44 === 60 ? 'eth' : activeNetwork.currency; - const signature = await this.trezorSigner.signEthTransaction({ + const signature = await this.requireTrezorSigner().signEthTransaction({ index: `${activeAccountId}`, tx: txToBeSignedByTrezor, coin: trezorCoin, slip44: activeNetwork.slip44, }); + assertCurrent(); if (signature.success) { try { let txFormattedForEthers; @@ -1671,15 +2864,16 @@ export class EthereumTransactions implements IEthereumTransactions { data: txData, nonce: transactionNonce, chainId: activeNetwork.chainId, - type: 2, + type: 2, // Need explicit type for hardware wallet serialization }; } - signature.payload.v = parseInt(signature.payload.v, 16); //v parameter must be a number by ethers standards - const signedTx = ethers.utils.serializeTransaction( + const signedTx = serializeTransaction( txFormattedForEthers, - signature.payload + trezorSignature(signature.payload) ); - const finalTx = await this.web3Provider.sendTransaction(signedTx); + assertCurrent(); + assertHardwareTransactionSender(signedTx, activeAccount.address); + const finalTx = await provider.sendTransaction(signedTx); return finalTx as any; } catch (error) { @@ -1701,7 +2895,7 @@ export class EthereumTransactions implements IEthereumTransactions { case KeyringAccountType.Ledger: return await sendERC721TokenOnLedger(); default: - return await sendERC721Token(); + return (await sendERC721Token()) as any; } }; @@ -1716,58 +2910,108 @@ export class EthereumTransactions implements IEthereumTransactions { gasPrice, gasLimit, }: ISendSignedErcTransactionProps): Promise => { - const { decryptedPrivateKey } = this.getDecryptedPrivateKey(); - const { accounts, activeAccountType, activeAccountId, activeNetwork } = - this.getState(); - const { address: activeAccountAddress } = - accounts[activeAccountType][activeAccountId]; + const { + activeAccount, + activeAccountType, + activeAccountId, + activeNetwork, + provider, + assertCurrent, + } = this.captureEvmSigningContext(); + const activeAccountAddress = activeAccount.address; + ({ gasPrice, isLegacy, maxFeePerGas, maxPriorityFeePerGas } = + await this.resolveEvmFeeParams( + { + gasPrice, + isLegacy, + maxFeePerGas, + maxPriorityFeePerGas, + }, + provider + )); + assertCurrent(); const sendERC1155Token = async () => { - const currentWallet = new ethers.Wallet(decryptedPrivateKey); - const walletSigned = currentWallet.connect(this.web3Provider); + assertCurrent(); + const { decryptedPrivateKey } = this.getDecryptedPrivateKey(); let transferMethod; try { - const _contract = new ethers.Contract( + const _contract = new Contract( tokenAddress, getErc55Abi(), - walletSigned + provider as any ); - const amount = tokenAmount ? parseInt(tokenAmount) : 1; + // Use BigNumber to avoid JS number overflow/precision loss + const amount = BigNumber.from(tokenAmount ?? '1'); - const overrides = {}; + let overrides; + if (isLegacy) { + overrides = { + nonce: await provider.getTransactionCount( + activeAccountAddress, + 'pending' + ), + gasPrice, + ...(gasLimit && { gasLimit }), + type: 0, // Explicitly set Type 0 for legacy ERC1155 transfers + }; + } else { + overrides = { + nonce: await provider.getTransactionCount( + activeAccountAddress, + 'pending' + ), + maxPriorityFeePerGas, + maxFeePerGas, + ...(gasLimit && { gasLimit }), + }; + } - transferMethod = await _contract.safeTransferFrom( - walletSigned.address, + transferMethod = await _contract.safeTransferFrom.populateTransaction( + activeAccountAddress, receiver, tokenId as number, - amount, - [], - overrides + amount.toBigInt(), + '0x', + normalizeEthersOverrides(overrides) + ); + return await sendLocalEvmTransaction( + provider, + decryptedPrivateKey, + { + ...transferMethod, + chainId: activeNetwork.chainId, + from: activeAccountAddress, + value: '0x0', + }, + assertCurrent, + assertCurrent ); - return transferMethod; } catch (error) { throw error; } }; const sendERC1155TokenOnLedger = async () => { - const signer = this.web3Provider.getSigner(activeAccountAddress); - const transactionNonce = await this.getRecommendedNonce( - activeAccountAddress + assertCurrent(); + const transactionNonce = await provider.getTransactionCount( + activeAccountAddress, + 'pending' ); + assertCurrent(); try { - const _contract = new ethers.Contract( + const _contract = new Contract( tokenAddress, getErc55Abi(), - signer + provider as any ); - const amount = tokenAmount ? parseInt(tokenAmount) : 1; + const amount = BigNumber.from(tokenAmount ?? '1'); const txData = _contract.interface.encodeFunctionData( 'safeTransferFrom', - [activeAccountAddress, receiver, tokenId, amount, []] + [activeAccountAddress, receiver, tokenId, amount.toBigInt(), '0x'] ); // Use fallback gas limit if not provided (for auto-estimation) @@ -1795,17 +3039,20 @@ export class EthereumTransactions implements IEthereumTransactions { data: txData, nonce: transactionNonce, chainId: activeNetwork.chainId, - type: 2, + type: 2, // Need explicit type for hardware wallet serialization }; } - const rawTx = ethers.utils.serializeTransaction(txFormattedForEthers); + const rawTx = serializeTransaction(txFormattedForEthers); - const signature = await this.ledgerSigner.evm.signEVMTransaction({ - rawTx: rawTx.replace('0x', ''), - accountIndex: activeAccountId, - }); + const signature = + await this.requireLedgerSigner().evm.signEVMTransaction({ + rawTx: rawTx.replace('0x', ''), + accountIndex: activeAccountId, + expectedAddress: activeAccount.address, + }); + assertCurrent(); const formattedSignature = { r: `0x${signature.r}`, s: `0x${signature.s}`, @@ -1814,11 +3061,13 @@ export class EthereumTransactions implements IEthereumTransactions { if (signature) { try { - const signedTx = ethers.utils.serializeTransaction( + const signedTx = serializeTransaction( txFormattedForEthers, formattedSignature ); - const finalTx = await this.web3Provider.sendTransaction(signedTx); + assertCurrent(); + assertHardwareTransactionSender(signedTx, activeAccount.address); + const finalTx = await provider.sendTransaction(signedTx); return finalTx as any; } catch (error) { @@ -1833,22 +3082,24 @@ export class EthereumTransactions implements IEthereumTransactions { }; const sendERC1155TokenOnTrezor = async () => { - const signer = this.web3Provider.getSigner(activeAccountAddress); - const transactionNonce = await this.getRecommendedNonce( - activeAccountAddress + assertCurrent(); + const transactionNonce = await provider.getTransactionCount( + activeAccountAddress, + 'pending' ); + assertCurrent(); try { - const _contract = new ethers.Contract( + const _contract = new Contract( tokenAddress, getErc55Abi(), - signer + provider as any ); - const amount = tokenAmount ? parseInt(tokenAmount) : 1; + const amount = BigNumber.from(tokenAmount ?? '1'); const txData = _contract.interface.encodeFunctionData( 'safeTransferFrom', - [activeAccountAddress, receiver, tokenId, amount, []] + [activeAccountAddress, receiver, tokenId, amount.toBigInt(), '0x'] ); // Use fallback gas limit if not provided (for auto-estimation) @@ -1859,10 +3110,8 @@ export class EthereumTransactions implements IEthereumTransactions { txToBeSignedByTrezor = { to: tokenAddress, value: '0x0', - // @ts-ignore - gasLimit: `${effectiveGasLimit.hex}`, - // @ts-ignore - gasPrice: `${gasPrice}`, + gasLimit: this.toHex0x(effectiveGasLimit, 'gasLimit'), + gasPrice: this.toHex0x(gasPrice, 'gasPrice'), nonce: this.toBigNumber(transactionNonce)._hex, chainId: activeNetwork.chainId, data: txData, @@ -1871,25 +3120,26 @@ export class EthereumTransactions implements IEthereumTransactions { txToBeSignedByTrezor = { to: tokenAddress, value: '0x0', - // @ts-ignore - gasLimit: `${effectiveGasLimit.hex}`, - // @ts-ignore - maxFeePerGas: `${maxFeePerGas.hex}`, - // @ts-ignore - maxPriorityFeePerGas: `${maxPriorityFeePerGas.hex}`, + gasLimit: this.toHex0x(effectiveGasLimit, 'gasLimit'), + maxFeePerGas: this.toHex0x(maxFeePerGas, 'maxFeePerGas'), + maxPriorityFeePerGas: this.toHex0x( + maxPriorityFeePerGas, + 'maxPriorityFeePerGas' + ), nonce: this.toBigNumber(transactionNonce)._hex, chainId: activeNetwork.chainId, data: txData, }; } - const signature = await this.trezorSigner.signEthTransaction({ + const signature = await this.requireTrezorSigner().signEthTransaction({ index: `${activeAccountId}`, tx: txToBeSignedByTrezor, coin: activeNetwork.currency, slip44: activeNetwork.slip44, }); + assertCurrent(); if (signature.success) { try { let txFormattedForEthers; @@ -1914,15 +3164,16 @@ export class EthereumTransactions implements IEthereumTransactions { data: txData, nonce: transactionNonce, chainId: activeNetwork.chainId, - type: 2, + type: 2, // Need explicit type for hardware wallet serialization }; } - signature.payload.v = parseInt(signature.payload.v, 16); //v parameter must be a number by ethers standards - const signedTx = ethers.utils.serializeTransaction( + const signedTx = serializeTransaction( txFormattedForEthers, - signature.payload + trezorSignature(signature.payload) ); - const finalTx = await this.web3Provider.sendTransaction(signedTx); + assertCurrent(); + assertHardwareTransactionSender(signedTx, activeAccount.address); + const finalTx = await provider.sendTransaction(signedTx); return finalTx as any; } catch (error) { @@ -1944,7 +3195,7 @@ export class EthereumTransactions implements IEthereumTransactions { case KeyringAccountType.Ledger: return await sendERC1155TokenOnLedger(); default: - return await sendERC1155Token(); + return (await sendERC1155Token()) as any; } }; @@ -1960,13 +3211,13 @@ export class EthereumTransactions implements IEthereumTransactions { const gasPrice = (await this.getRecommendedGasPrice(false)) as string; const low = this.toBigNumber(gasPrice) - .mul(ethers.BigNumber.from('8')) - .div(ethers.BigNumber.from('10')) + .mul(BigNumber.from('8')) + .div(BigNumber.from('10')) .toString(); const high = this.toBigNumber(gasPrice) - .mul(ethers.BigNumber.from('11')) - .div(ethers.BigNumber.from('10')) + .mul(BigNumber.from('11')) + .div(BigNumber.from('10')) .toString(); if (type === 'low') return low; @@ -1981,17 +3232,86 @@ export class EthereumTransactions implements IEthereumTransactions { to: toAddress, }); - return Number(ethers.utils.formatUnits(estimated, 'gwei')); + return Number(BigNumber.from(estimated).toString()); } catch (error) { throw error; } }; getTxGasLimit = async (tx: SimpleTransactionRequest) => { + const hasCalldata = Boolean( + tx.data && tx.data !== '0x' && tx.data !== '0x0' + ); + try { - return this.web3Provider.estimateGas(tx); + // First attempt: standard estimation + const estimated = await this.web3Provider.estimateGas(tx); + + // Add 20% buffer to the estimated gas + const withBuffer = estimated.mul(120).div(100); + + // Apply an explicit per-network floor only when configured. + if ( + this.gasOverrides.minGasLimit && + withBuffer.lt(this.gasOverrides.minGasLimit) + ) { + return this.gasOverrides.minGasLimit; + } + + return withBuffer; } catch (error) { - throw error; + if ( + error?.code === 'SYSWEB3_RPC_RESPONSE_INVALID' || + error?.name === 'AbortError' || + this.abortController.signal.aborted + ) + throw error; + console.warn('Gas estimation failed:', error); + + if (hasCalldata) { + const calldataFallback = BigNumber.from('100000'); + if ( + this.gasOverrides.minGasLimit && + calldataFallback.lt(this.gasOverrides.minGasLimit) + ) { + return this.gasOverrides.minGasLimit; + } + + return calldataFallback; + } + + // Try a simpler estimation for basic transfers + try { + const simpleEstimate = await this.web3Provider.estimateGas({ + to: tx.to, + from: tx.from, + value: tx.value || '0x0', + }); + + const withBuffer = simpleEstimate.mul(150).div(100); // 50% buffer for failed estimations + if ( + this.gasOverrides.minGasLimit && + withBuffer.lt(this.gasOverrides.minGasLimit) + ) { + return this.gasOverrides.minGasLimit; + } + + return withBuffer; + } catch (secondError) { + if ( + secondError?.code === 'SYSWEB3_RPC_RESPONSE_INVALID' || + secondError?.name === 'AbortError' || + this.abortController.signal.aborted + ) { + throw secondError; + } + // Ultimate fallback + console.warn( + 'Simple estimation also failed, using default', + secondError + ); + return this.gasOverrides.minGasLimit || BigNumber.from('100000'); + } } }; @@ -2001,8 +3321,8 @@ export class EthereumTransactions implements IEthereumTransactions { if (formatted) { return { - gwei: Number(ethers.utils.formatUnits(gasPriceBN, 'gwei')).toFixed(2), - ethers: ethers.utils.formatEther(gasPriceBN), + gwei: Number(formatUnits(gasPriceBN, 'gwei')).toFixed(2), + ethers: formatEther(gasPriceBN), }; } @@ -2015,29 +3335,14 @@ export class EthereumTransactions implements IEthereumTransactions { getBalance = async (address: string) => { try { const balance = await this.web3Provider.getBalance(address); - const formattedBalance = ethers.utils.formatEther(balance); + const formattedBalance = formatEther(balance); - const roundedBalance = floor(parseFloat(formattedBalance), 4); - - return roundedBalance; + return parseFloat(formattedBalance); // Return full precision } catch (error) { throw error; } }; - private getTransactionTimestamp = async ( - transaction: TransactionResponse - ) => { - const { timestamp } = await this.web3Provider.getBlock( - Number(transaction.blockNumber) - ); - - return { - ...transaction, - timestamp, - } as TransactionResponse; - }; - public setWeb3Provider(network: INetwork) { this.abortController.abort(); this.abortController = new AbortController(); @@ -2053,30 +3358,77 @@ export class EthereumTransactions implements IEthereumTransactions { ); // Clear any existing providers for UTXO networks this._web3Provider = undefined as any; + this._web3ProviderKey = undefined; } else { - // For EVM networks, create normal providers - const isL2Network = L2_NETWORK_CHAIN_IDS.includes(network.chainId); - - const CurrentProvider = isL2Network - ? CustomL2JsonRpcProvider - : CustomJsonRpcProvider; - - this._web3Provider = new CurrentProvider( + this._web3Provider = new CustomJsonRpcProvider( this.abortController.signal, - network.url + network.url, + network.chainId ); + this._web3ProviderKey = `${network.chainId}|${network.url ?? ''}`; } } public importAccount = (mnemonicOrPrivKey: string) => { - if (ethers.utils.isHexString(mnemonicOrPrivKey)) { - return new ethers.Wallet(mnemonicOrPrivKey); + if (isHexString(mnemonicOrPrivKey)) { + return privateKeyToAccount(mnemonicOrPrivKey); } - const { privateKey } = ethers.Wallet.fromMnemonic(mnemonicOrPrivKey); + return deriveEvmAccountFromMnemonic( + mnemonicOrPrivKey, + getAddressDerivationPath('eth', 60, 0, false, 0) + ); + }; + + // Method to configure gas overrides for networks with validation issues + public setGasOverrides(overrides: { + minGasLimit?: string | BigNumber; + minPriorityFee?: string | BigNumber; + feeMultiplier?: number; + }) { + this.gasOverrides = { + minGasLimit: overrides.minGasLimit + ? BigNumber.from(overrides.minGasLimit) + : undefined, + minPriorityFee: overrides.minPriorityFee + ? BigNumber.from(overrides.minPriorityFee) + : undefined, + feeMultiplier: overrides.feeMultiplier, + }; + } + + // Get the current gas overrides + public getGasOverrides() { + return this.gasOverrides; + } - const account = new ethers.Wallet(privateKey); + // Method to get safe fee data that works around network-specific validation issues + public getSafeFeeData = async (forceLegacy: boolean = false) => { + if (forceLegacy) { + // For legacy transactions, just return gas price + const gasPrice = await this.web3Provider.getGasPrice(); + const bufferedGasPrice = gasPrice.mul(110).div(100); // 10% buffer + return { + gasPrice: bufferedGasPrice, + maxFeePerGas: undefined, + maxPriorityFeePerGas: undefined, + }; + } - return account; + const feeData = await this.getFeeDataWithDynamicMaxPriorityFeePerGas(); + if (feeData.baseFeePerGas === undefined) { + // Only an actual pre-London header authorizes legacy selection. + const bufferedGasPrice = feeData.gasPrice.mul(110).div(100); + return { + gasPrice: bufferedGasPrice, + maxFeePerGas: undefined, + maxPriorityFeePerGas: undefined, + }; + } + return { + gasPrice: undefined, + maxFeePerGas: feeData.maxFeePerGas, + maxPriorityFeePerGas: feeData.maxPriorityFeePerGas, + }; }; } diff --git a/packages/sysweb3-keyring/src/transactions/evm-local-signer.ts b/packages/sysweb3-keyring/src/transactions/evm-local-signer.ts new file mode 100644 index 00000000..4d7c543b --- /dev/null +++ b/packages/sysweb3-keyring/src/transactions/evm-local-signer.ts @@ -0,0 +1,257 @@ +import ecc from '@bitcoinerlab/secp256k1'; +import { BIP32Factory } from 'bip32'; +import CryptoJS from 'crypto-js'; +import omit from 'lodash/omit'; +import * as BIP84 from 'syscoinjs-lib/bip84-replacement'; + +import { + arrayify, + dataSlice, + getAddress, + hexlify, + hexZeroPad, + joinSignature, + keccak256, + normalizeTransactionRequest, + resolveProperties, + serializeTransaction, + type Deferrable, + type TransactionRequest, +} from '../ethers-v6'; +import { CustomJsonRpcProvider } from '../providers'; + +const bip32 = BIP32Factory(ecc); + +export type EvmLocalAccount = { + address: string; + privateKey: string; + publicKey: string; +}; + +const strip0x = (value: string) => + value.startsWith('0x') || value.startsWith('0X') ? value.slice(2) : value; + +const toHex = (bytes: Uint8Array) => Buffer.from(bytes).toString('hex'); + +export const normalizePrivateKey = (privateKey: string | Uint8Array) => { + let bytes: Buffer; + if (typeof privateKey === 'string') { + const stripped = strip0x(privateKey); + if (!/^[0-9a-fA-F]{64}$/.test(stripped)) { + throw new Error('Invalid EVM private key'); + } + bytes = Buffer.from(stripped, 'hex'); + } else { + bytes = Buffer.from(privateKey); + } + + if (bytes.length !== 32 || !ecc.isPrivate(bytes)) { + throw new Error('Invalid EVM private key'); + } + + return bytes; +}; + +export const privateKeyToAccount = ( + privateKey: string | Uint8Array +): EvmLocalAccount => { + const privateKeyBytes = normalizePrivateKey(privateKey); + const publicKeyBytes = ecc.pointFromScalar(privateKeyBytes, false); + if (!publicKeyBytes) { + throw new Error('Unable to derive EVM public key'); + } + + const address = getAddress(dataSlice(keccak256(publicKeyBytes.slice(1)), 12)); + + return { + address, + privateKey: `0x${toHex(privateKeyBytes)}`, + publicKey: hexlify(publicKeyBytes), + }; +}; + +export const deriveEvmAccountFromMnemonic = ( + mnemonic: string, + derivationPath: string +): EvmLocalAccount => { + const normalizedMnemonic = mnemonic.normalize('NFKD'); + if (!BIP84.validateMnemonic(normalizedMnemonic)) { + throw new Error('Invalid EVM mnemonic'); + } + + const seedWords = CryptoJS.PBKDF2( + normalizedMnemonic, + 'mnemonic'.normalize('NFKD'), + { + hasher: CryptoJS.algo.SHA512, + iterations: 2048, + keySize: 512 / 32, + } + ); + const seed = Buffer.from(seedWords.toString(CryptoJS.enc.Hex), 'hex'); + const node = bip32.fromSeed(seed).derivePath(derivationPath); + + if (!node.privateKey) { + throw new Error('Unable to derive EVM private key'); + } + + return privateKeyToAccount(node.privateKey); +}; + +export const signDigest = ( + digest: string | Uint8Array, + privateKey: string | Uint8Array +) => { + const digestBytes = + typeof digest === 'string' ? Buffer.from(strip0x(digest), 'hex') : digest; + if (digestBytes.length !== 32) { + throw new Error('EVM signatures require a 32-byte digest'); + } + + const { signature, recoveryId } = ecc.signRecoverable( + Buffer.from(digestBytes), + normalizePrivateKey(privateKey) + ); + + return { + r: hexZeroPad(hexlify(signature.slice(0, 32)), 32), + s: hexZeroPad(hexlify(signature.slice(32, 64)), 32), + recoveryParam: recoveryId, + v: recoveryId + 27, + }; +}; + +export const signDigestHex = ( + digest: string | Uint8Array, + privateKey: string | Uint8Array +) => joinSignature(signDigest(digest, privateKey)); + +export const hashPersonalMessage = (message: Uint8Array) => { + const prefix = Buffer.from( + `\u0019Ethereum Signed Message:\n${message.length}`, + 'utf8' + ); + return keccak256(Buffer.concat([prefix, Buffer.from(message)])); +}; + +export const signPersonalMessage = ( + message: string | Uint8Array, + privateKey: string | Uint8Array +) => { + const messageBytes = + typeof message === 'string' + ? message.startsWith('0x') || message.startsWith('0X') + ? arrayify(message) + : Buffer.from(message, 'utf8') + : message; + + return signDigestHex( + hashPersonalMessage(Buffer.from(messageBytes)), + privateKey + ); +}; + +export const parsePersonalMessage = (hexMessage: string) => + Buffer.from(strip0x(hexMessage), 'hex').toString('utf8'); + +export const signTransaction = ( + transaction: TransactionRequest, + privateKey: string | Uint8Array +) => { + const unsigned = serializeTransaction(transaction); + const digest = keccak256(unsigned); + const signature = signDigest(digest, privateKey); + return serializeTransaction(transaction, signature); +}; + +export const sendLocalEvmTransaction = async ( + provider: CustomJsonRpcProvider, + privateKey: string, + transaction: Deferrable>, + beforeBroadcast?: () => void, + beforeSign?: () => void, + /** Synchronous final-envelope check; throw to reject. Promise results are rejected. */ + validateBeforeSign?: (transaction: TransactionRequest) => void +) => { + const account = privateKeyToAccount(privateKey); + const resolved = await resolveProperties(transaction); + if (resolved.from && !sameAddress(resolved.from, account.address)) { + throw new Error('Transaction from does not match EVM private key'); + } + + await provider.verifyConfiguredChainId(); + + const tx = normalizeTransactionRequest( + omit(resolved, ['from', 'ccipReadEnabled', 'customData']) + ) as TransactionRequest; + + if (!tx.chainId) { + const network = await provider.getNetwork(); + tx.chainId = Number(network.chainId); + } + if (tx.to && typeof tx.to === 'string') { + try { + tx.to = getAddress(tx.to); + } catch { + const resolvedTo = await provider.resolveName(tx.to); + if (!resolvedTo) { + throw new Error( + `Unable to resolve EVM transaction recipient: ${tx.to}` + ); + } + tx.to = getAddress(resolvedTo); + } + } + if (tx.nonce === undefined || tx.nonce === null) { + tx.nonce = await provider.getTransactionCount(account.address, 'pending'); + } + if (!tx.gasLimit) { + tx.gasLimit = await provider.estimateGas({ + ...resolved, + from: account.address, + } as any); + } + if ((tx.type === 0 || tx.type === 1) && tx.gasPrice == null) { + tx.gasPrice = await provider.getGasPrice(); + } else if ( + tx.gasPrice == null && + (tx.maxFeePerGas == null || tx.maxPriorityFeePerGas == null) + ) { + const feeData = await provider.getFeeData(); + if (feeData.maxFeePerGas != null && feeData.maxPriorityFeePerGas != null) { + tx.maxFeePerGas = tx.maxFeePerGas ?? feeData.maxFeePerGas; + tx.maxPriorityFeePerGas = + tx.maxPriorityFeePerGas ?? feeData.maxPriorityFeePerGas; + tx.type = tx.type ?? 2; + } else if (tx.type !== 2) { + tx.gasPrice = feeData.gasPrice ?? (await provider.getGasPrice()); + tx.type = tx.type ?? 0; + } else { + throw new Error('EIP-1559 fee data unavailable'); + } + } + if (!tx.data) { + tx.data = '0x'; + } + if (!tx.value) { + tx.value = '0x0'; + } + + beforeSign?.(); + const validation = validateBeforeSign?.(tx) as unknown; + if ( + validation && + (typeof validation === 'object' || typeof validation === 'function') && + typeof (validation as PromiseLike).then === 'function' + ) { + // Final envelope admission must finish synchronously before signing. + void Promise.resolve(validation).catch(() => undefined); + throw new Error('Transaction validation must be synchronous'); + } + const signedTx = signTransaction(tx, privateKey); + beforeBroadcast?.(); + return provider.sendTransaction(signedTx); +}; + +export const sameAddress = (left: string, right: string) => + getAddress(left).toLowerCase() === getAddress(right).toLowerCase(); diff --git a/packages/sysweb3-keyring/src/transactions/hardware-psbt.ts b/packages/sysweb3-keyring/src/transactions/hardware-psbt.ts new file mode 100644 index 00000000..c34fa4ef --- /dev/null +++ b/packages/sysweb3-keyring/src/transactions/hardware-psbt.ts @@ -0,0 +1,225 @@ +import { verify } from '@bitcoinerlab/secp256k1'; +import { getNetworkConfig } from '@sidhujag/sysweb3-network'; + +import { + createHardwareSignerUnavailableError, + type ISyscoinHardwareSigner, +} from './syscoin-core'; +import { prepareLedgerPsbt } from '../ledger/prepare-psbt'; +import { assertPsbtAccountScope } from '../utils/psbt-account-scope'; + +import type { LedgerKeyring } from '../ledger'; +import type { TrezorKeyring } from '../trezor'; + +/** Legacy device adapter. The software transaction engine never imports it. */ +export function createLedgerPsbtSigner( + ledger: LedgerKeyring +): ISyscoinHardwareSigner { + return async ({ + psbt, + account, + network: activeNetwork, + scope, + assertCurrent, + getRawTransaction, + }) => { + if ( + typeof ledger?.signPsbt !== 'function' || + typeof getRawTransaction !== 'function' + ) { + throw createHardwareSignerUnavailableError('Ledger'); + } + // CRITICAL: Enhance PSBT with required Ledger fields + const accountXpub = account.xpub; + const accountId = account.id; + + // Enrich PSBT with nonWitnessUtxo for Ledger compatibility + const blockbookUrl = activeNetwork.url; + + // Some unit tests mock PSBTs without bitcoinjs-lib internals (data/txInputs). + // Only attempt enrichment when the PSBT looks like a real bitcoinjs-lib Psbt. + const psbtAny: any = psbt as any; + const inputMetas: any[] | undefined = psbtAny?.data?.inputs; + const txInputs: any[] | undefined = psbtAny?.txInputs; + if ( + Array.isArray(inputMetas) && + Array.isArray(txInputs) && + txInputs.length > 0 + ) { + // Fetch and add nonWitnessUtxo where Ledger still needs it. + const txFetchPromises = txInputs.map(async (_txInput, index) => { + try { + // Keep existing previous transactions, and finalized witness + // inputs that already carry the prevout data needed by Ledger. + const input = inputMetas[index]; + if ( + input?.nonWitnessUtxo || + (input?.witnessUtxo && + (input.finalScriptSig || input.finalScriptWitness)) + ) + return { index, success: true }; + const tx = txInputs[index]; + const prevTxId = Buffer.from(tx.hash).reverse().toString('hex'); + + // Fetch the raw transaction + const rawTxResponse = await getRawTransaction(blockbookUrl, prevTxId); + + // Handle different response formats (string, object with 'hex', or object with 'result') + let rawTxHex: string; + if (typeof rawTxResponse === 'string') { + rawTxHex = rawTxResponse; + } else if ( + rawTxResponse && + typeof rawTxResponse === 'object' && + 'hex' in rawTxResponse + ) { + rawTxHex = (rawTxResponse as any).hex; + } else if ( + rawTxResponse && + typeof rawTxResponse === 'object' && + 'result' in rawTxResponse + ) { + rawTxHex = (rawTxResponse as any).result; + } else { + throw new Error( + `Unexpected response format: ${JSON.stringify(rawTxResponse)}` + ); + } + + if (!rawTxHex || typeof rawTxHex !== 'string') { + throw new Error(`Invalid raw transaction hex received`); + } + + // Convert hex to Buffer and add to PSBT + const nonWitnessUtxo = Buffer.from(rawTxHex, 'hex'); + if (nonWitnessUtxo.length === 0) { + throw new Error('Converted buffer is empty'); + } + + psbt.updateInput(index, { nonWitnessUtxo }); + return { index, success: true }; + } catch (error) { + console.error(`[Ledger] Failed to enrich input ${index}:`, error); + return { index, success: false, error }; + } + }); + + // Wait for all inputs to be enriched + const results = await Promise.all(txFetchPromises); + const failedInputs = results.filter((r) => !r.success); + + if (failedInputs.length > 0) { + throw new Error( + `Failed to enrich ${failedInputs.length} of ${results.length} inputs with nonWitnessUtxo. ` + + `Ledger devices require this data for signing.` + ); + } + } + + assertCurrent(); + assertPsbtAccountScope(psbt, scope); + // The host verifies the device xpub and signs in one serialized operation. + const { fingerprint, signatures } = await ledger.signPsbt({ + currency: activeNetwork.currency, + slip44: activeNetwork.slip44, + accountIndex: accountId, + accountXpub, + psbtBase64: psbt.toBase64(), + }); + assertCurrent(); + const enhancedPsbt = prepareLedgerPsbt( + psbt, + accountXpub, + accountId, + activeNetwork.currency, + activeNetwork.slip44, + fingerprint + ); + assertPsbtAccountScope(enhancedPsbt, scope); + for (const entry of signatures) { + if ( + !Number.isSafeInteger(entry.inputIndex) || + entry.inputIndex < 0 || + !/^(02|03)[0-9a-f]{64}$/i.test(entry.pubkeyHex) || + !/^(?:[0-9a-f]{2})+$/i.test(entry.signatureHex) || + entry.tapleafHashHex + ) + throw new Error('Invalid Ledger signature response'); + const partialSig = { + pubkey: Buffer.from(entry.pubkeyHex, 'hex'), + signature: Buffer.from(entry.signatureHex, 'hex'), + }; + const input = enhancedPsbt.data.inputs[entry.inputIndex]; + if ( + !input || + input.finalScriptSig || + input.finalScriptWitness || + !input.bip32Derivation?.some((derivation) => + Buffer.from(derivation.pubkey).equals(partialSig.pubkey) + ) + ) + throw new Error('PSBT input is outside the approved account'); + // An absent PSBT sighash request means SIGHASH_ALL. A valid signature + // with weaker coverage must not silently replace that approval. + const expectedSighash = input.sighashType ?? 0x01; + if ( + partialSig.signature[partialSig.signature.length - 1] !== + expectedSighash + ) + throw new Error( + 'Ledger signature does not match the approved sighash type' + ); + enhancedPsbt.updateInput(entry.inputIndex, { partialSig: [partialSig] }); + if ( + !enhancedPsbt.validateSignaturesOfInput( + entry.inputIndex, + (pubkey, hash, signature) => verify(hash, pubkey, signature), + partialSig.pubkey + ) + ) + throw new Error('Invalid Ledger signature for approved transaction'); + } + + // Preserve external inputs that were finalized before device signing. + enhancedPsbt.data.inputs.forEach((input, index) => { + if (!input.finalScriptSig && !input.finalScriptWitness) + enhancedPsbt.finalizeInput(index); + }); + + return enhancedPsbt; + }; +} + +/** Keep Trezor conversion and signing outside the software-only import graph. */ +export function createTrezorPsbtSigner( + trezor: TrezorKeyring +): ISyscoinHardwareSigner { + return async ({ psbt, network: activeNetwork, assertCurrent }) => { + if ( + typeof trezor?.convertToTrezorFormat !== 'function' || + typeof trezor?.signUtxoTransaction !== 'function' + ) { + throw createHardwareSignerUnavailableError('Trezor'); + } + // Handle Trezor signing for UTXO + // Get network configuration for Trezor + const networkConfig = getNetworkConfig( + activeNetwork.slip44, + activeNetwork.currency + ); + const isTestnet = activeNetwork.slip44 === 1; + const bitcoinjsNetwork = isTestnet + ? networkConfig?.networks?.testnet + : networkConfig?.networks?.mainnet; + + const trezorTx = trezor.convertToTrezorFormat({ + psbt, + coin: activeNetwork.currency.toLowerCase(), + network: bitcoinjsNetwork || undefined, // Pass network config for isScriptHash check + }); + assertCurrent(); + const signedPsbt = await trezor.signUtxoTransaction(trezorTx, psbt); + assertCurrent(); + return signedPsbt; + }; +} diff --git a/packages/sysweb3-keyring/src/transactions/prepared-bip84.ts b/packages/sysweb3-keyring/src/transactions/prepared-bip84.ts new file mode 100644 index 00000000..94769f8f --- /dev/null +++ b/packages/sysweb3-keyring/src/transactions/prepared-bip84.ts @@ -0,0 +1,281 @@ +import ecc from '@bitcoinerlab/secp256k1'; +import { BIP32Interface } from 'bip32'; +import { payments, script, Transaction } from 'bitcoinjs-lib'; + +import { parseBip84PublicAccount } from '../public-bip84'; +import { + bip84Profile, + Bip84NativeError, + fail, + index, + LIMITS, + PreparedBip84NativeTransaction, + record, + validateBip84NativePlan, + ValidatedBip84Plan, +} from './bip84-native-plan'; + +export type PreparedBip84SigningRequest = Readonly<{ + account: Readonly<{ + type: 'HDAccount'; + index: number; + expectedAccountKey: string; + }>; + prepared: PreparedBip84NativeTransaction; +}>; +export type SignedBip84NativeTransaction = Readonly<{ + rawTransaction: string; + txid: string; + wtxid: string; + unsignedTransaction: string; + feeSatoshis: string; + virtualSize: number; +}>; + +/** Private host snapshot. A public prepared DTO never carries signing authority. */ +export function snapshotPreparedBip84Request(input: unknown): { + account: PreparedBip84SigningRequest['account']; + validated: ValidatedBip84Plan; +} { + const r = record(input, ['account', 'prepared']); + const a = record(r.account, ['type', 'index', 'expectedAccountKey']); + const p = record(r.prepared, ['plan', 'unsignedTransaction', 'feeSatoshis']); + if (a.type !== 'HDAccount') return fail('ACCOUNT_MISMATCH'); + const accountIndex = index(a.index); + if ( + typeof a.expectedAccountKey !== 'string' || + a.expectedAccountKey.length > 112 || + typeof p.unsignedTransaction !== 'string' || + p.unsignedTransaction.length > LIMITS.unsignedBytes * 2 || + !/^(?:[0-9a-f]{2})+$/.test(p.unsignedTransaction) || + typeof p.feeSatoshis !== 'string' || + !/^(0|[1-9][0-9]{0,18})$/.test(p.feeSatoshis) + ) + return fail('INVALID_REQUEST'); + const validated = validateBip84NativePlan(p.plan); + if ( + accountIndex !== validated.prepared.plan.account.accountIndex || + a.expectedAccountKey !== validated.prepared.plan.account.canonicalKey + ) + return fail('ACCOUNT_MISMATCH'); + if ( + p.unsignedTransaction !== validated.prepared.unsignedTransaction || + p.feeSatoshis !== validated.prepared.feeSatoshis + ) + return fail('INVALID_REQUEST'); + return { + account: Object.freeze({ + type: 'HDAccount', + index: accountIndex, + expectedAccountKey: a.expectedAccountKey, + }), + validated, + }; +} + +/** Only operation-owned nodes. No session/shared key objects may be supplied. */ +export function clearBip84PrivateNodes(nodes: BIP32Interface[]): void { + while (nodes.length) { + const node = nodes.pop()!; + try { + node.privateKey?.fill(0); + } catch { + // Continue retiring the other owned buffers and the operation token. + // JS/library copies and inaccessible buffers are not claimed zeroized. + } + } +} + +const equal = (left: Uint8Array, right: Uint8Array): boolean => + Buffer.from(left).equals(Buffer.from(right)); + +/** Internally owned PSBT only. No provider, generic SDK signer or partial result. */ +export function signValidatedBip84Plan( + validated: ValidatedBip84Plan, + accountNode: BIP32Interface, + assertCurrent: () => void +): SignedBip84NativeTransaction { + const nodes: BIP32Interface[] = []; + try { + const { prepared, psbt, previousOutputs } = validated; + const { plan } = prepared; + const profile = bip84Profile(plan.network.network); + assertCurrent(); + const derivedAccount = parseBip84PublicAccount({ + network: plan.network.network, + accountKey: accountNode.neutered().toBase58(), + }); + if ( + derivedAccount.canonicalKey !== plan.account.canonicalKey || + derivedAccount.accountIndex !== plan.account.accountIndex + ) + return fail('ACCOUNT_MISMATCH'); + const branches = new Map(); + const children = new Map(); + const publicKeys: Uint8Array[] = []; + for (const [i, input] of plan.inputs.entries()) { + assertCurrent(); + let branch = branches.get(input.branch); + if (!branch) { + branch = accountNode.derive(input.branch); + nodes.push(branch); + if (branch.index !== input.branch) return fail('ACCOUNT_MISMATCH'); + branches.set(input.branch, branch); + } + const path = `${input.branch}/${input.index}`; + let child = children.get(path); + if (!child) { + child = branch.derive(input.index); + nodes.push(child); + if (child.index !== input.index) return fail('ACCOUNT_MISMATCH'); + children.set(path, child); + } + const pubkey = Uint8Array.from(child.publicKey); + const payment = payments.p2wpkh({ + pubkey, + network: profile.addressNetwork, + }); + if ( + pubkey.length !== 33 || + !payment.output || + !equal(payment.output, previousOutputs[i].script) + ) + return fail('INPUT_MISMATCH'); + publicKeys.push(pubkey); + const signer = child; + assertCurrent(); + psbt.signInput( + i, + { + publicKey: pubkey, + sign(hash: Uint8Array) { + assertCurrent(); + const signature = signer.sign(hash); + assertCurrent(); + return signature; + }, + }, + [Transaction.SIGHASH_ALL] + ); + assertCurrent(); + const partial = psbt.data.inputs[i].partialSig; + if ( + !partial || + partial.length !== 1 || + !equal(partial[0].pubkey, pubkey) || + script.signature.decode(partial[0].signature).hashType !== + Transaction.SIGHASH_ALL || + psbt.validateSignaturesOfInput( + i, + (key, hash, signature) => + equal(key, pubkey) && ecc.verify(hash, key, signature, true), + pubkey + ) !== true + ) + return fail('SIGNATURE_INVALID'); + } + // Verify change from the private-derived account as well as the public plan. + if (plan.change) { + assertCurrent(); + const branch = accountNode.neutered().derive(1); + if (branch.index !== 1) return fail('ACCOUNT_MISMATCH'); + const child = branch.derive(plan.change.index); + if (child.index !== plan.change.index) return fail('ACCOUNT_MISMATCH'); + const payment = payments.p2wpkh({ + pubkey: child.publicKey, + network: profile.addressNetwork, + }); + if (!payment.output || !equal(payment.output, psbt.txOutputs[1].script)) + return fail('INPUT_MISMATCH'); + } + if (psbt.toBuffer().length > LIMITS.psbtBytes) + return fail('LIMIT_EXCEEDED'); + assertCurrent(); + for (let i = 0; i < plan.inputs.length; i++) { + psbt.finalizeInput(i); + const input = psbt.data.inputs[i]; + if ( + !(input.finalScriptWitness instanceof Uint8Array) || + input.finalScriptWitness.length === 0 || + (input.finalScriptSig !== undefined && input.finalScriptSig.length > 0) + ) + return fail('SIGNATURE_INVALID'); + } + if (psbt.toBuffer().length > LIMITS.psbtBytes) + return fail('LIMIT_EXCEEDED'); + assertCurrent(); + // SJS overrides fee/extraction helpers. Their success is not our fee proof. + const bytes = psbt.extractTransaction().toBuffer(); + if (bytes.length > LIMITS.signedBytes) return fail('LIMIT_EXCEEDED'); + const transaction = Transaction.fromBuffer(bytes); + if ( + !equal(transaction.toBuffer(), bytes) || + transaction.ins.length !== plan.inputs.length + ) + return fail('SIGNATURE_INVALID'); + for (const [i, input] of transaction.ins.entries()) { + assertCurrent(); + if ( + input.script.length !== 0 || + input.witness.length !== 2 || + !equal(input.witness[1], publicKeys[i]) + ) + return fail('SIGNATURE_INVALID'); + const signature = script.signature.decode(input.witness[0]); + const scriptCode = payments.p2pkh({ pubkey: publicKeys[i] }).output; + if ( + signature.hashType !== Transaction.SIGHASH_ALL || + !scriptCode || + !equal( + script.signature.encode(signature.signature, signature.hashType), + input.witness[0] + ) || + !ecc.verify( + transaction.hashForWitnessV0( + i, + scriptCode, + previousOutputs[i].value, + Transaction.SIGHASH_ALL + ), + publicKeys[i], + signature.signature, + true + ) + ) + return fail('SIGNATURE_INVALID'); + } + const unsigned = transaction.clone(); + unsigned.stripWitnesses(); + if (unsigned.toHex() !== prepared.unsignedTransaction) + return fail('SIGNATURE_INVALID'); + const fee = + previousOutputs.reduce((sum, output) => sum + output.value, 0n) - + transaction.outs.reduce((sum, output) => sum + output.value, 0n); + const virtualSize = transaction.virtualSize(); + if ( + fee < 0n || + fee.toString() !== prepared.feeSatoshis || + fee > LIMITS.maxFee || + fee > BigInt(plan.feeLimits.maxFeeSatoshis) || + !Number.isSafeInteger(virtualSize) || + virtualSize <= 0 || + fee > BigInt(virtualSize) * LIMITS.maxFeeRate || + fee > BigInt(virtualSize) * BigInt(plan.feeLimits.maxFeeRateSatPerVByte) + ) + return fail('FEE_LIMIT'); + assertCurrent(); + return Object.freeze({ + rawTransaction: transaction.toHex(), + txid: transaction.getId(), + wtxid: Buffer.from(transaction.getHash(true)).reverse().toString('hex'), + unsignedTransaction: prepared.unsignedTransaction, + feeSatoshis: fee.toString(), + virtualSize, + }); + } catch (error) { + if (error instanceof Bip84NativeError) throw error; + return fail('SIGNATURE_INVALID'); + } finally { + clearBip84PrivateNodes(nodes); + } +} diff --git a/packages/sysweb3-keyring/src/transactions/prepared-evm.ts b/packages/sysweb3-keyring/src/transactions/prepared-evm.ts new file mode 100644 index 00000000..1305dacf --- /dev/null +++ b/packages/sysweb3-keyring/src/transactions/prepared-evm.ts @@ -0,0 +1,283 @@ +import { getAddress } from 'ethers/address'; +import { keccak256 } from 'ethers/crypto'; +import { Transaction } from 'ethers/transaction'; + +import { signTransaction } from './evm-local-signer'; + +/** + * Fully specified type-0/type-2 transaction. Quantities are canonical decimal + * integer strings, nonce is at most MAX_SAFE_INTEGER, and gasLimit is uint64. + * Addresses must be nonzero hex addresses; valid casing is normalized. Data is + * even-length 0x hex, at most 16 KiB. Contract creation/access lists are omitted. + */ +export type PreparedEvmTransaction = Readonly< + { + from: string; + to: string; + chainId: string; + nonce: string; + value: string; + gasLimit: string; + data: string; + } & ( + | { type: 0; gasPrice: string } + | { type: 2; maxFeePerGas: string; maxPriorityFeePerGas: string } + ) +>; + +export type PreparedSoftwareEvmSigningRequest = Readonly<{ + account: Readonly<{ + id: number; + type: 'HDAccount' | 'Imported'; + expectedAddress: string; + }>; + network: Readonly<{ + kind: 'ethereum'; + chainId: string; + slip44: 60; + /** Exact configured endpoint binding; signing does not contact or authenticate it. */ + url: string; + }>; + transaction: PreparedEvmTransaction; +}>; + +export type PreparedEvmSigningOptions = Readonly<{ + /** Host-owned consent/session/review expiry check. Must return undefined. */ + assertCurrent(): void; +}>; + +export type SignedPreparedEvmTransaction = Readonly<{ + rawTransaction: string; + hash: string; + unsignedHash: string; + from: string; + /** Canonical signed fields, checked against the requested envelope. */ + transaction: PreparedEvmTransaction; +}>; + +const UINT256 = (1n << 256n) - 1n; +const UINT64 = (1n << 64n) - 1n; +const MAX_DATA_BYTES = 16 * 1024; +const invalid = () => new TypeError('Invalid prepared EVM signing request'); + +/** Snapshot values without invoking accessors or accepting hidden fields. */ +function record( + value: unknown, + keys: readonly string[] +): Record { + if (!value || typeof value !== 'object' || Array.isArray(value)) + throw invalid(); + const prototype = Object.getPrototypeOf(value); + if (prototype !== Object.prototype && prototype !== null) throw invalid(); + const names = Reflect.ownKeys(value); + if ( + names.length !== keys.length || + names.some((key) => typeof key !== 'string' || !keys.includes(key)) + ) + throw invalid(); + const result: Record = Object.create(null); + for (const key of keys) { + const descriptor = Object.getOwnPropertyDescriptor(value, key); + if ( + !descriptor || + !descriptor.enumerable || + !Object.prototype.hasOwnProperty.call(descriptor, 'value') + ) + throw invalid(); + result[key] = descriptor.value; + } + return result; +} + +function quantity(value: unknown, maximum = UINT256, positive = false): string { + if (typeof value !== 'string' || !/^(0|[1-9][0-9]{0,77})$/.test(value)) + throw invalid(); + const parsed = BigInt(value); + if (parsed > maximum || (positive && parsed === 0n)) throw invalid(); + return value; +} + +function address(value: unknown): string { + if (typeof value !== 'string' || !/^0x[0-9a-fA-F]{40}$/.test(value)) + throw invalid(); + let canonical: string; + try { + canonical = getAddress(value); + } catch { + throw invalid(); + } + if (/^0x0{40}$/i.test(canonical)) throw invalid(); + return canonical; +} + +export function snapshotPreparedEvmRequest( + input: unknown +): PreparedSoftwareEvmSigningRequest { + const root = record(input, ['account', 'network', 'transaction']); + const account = record(root.account, ['id', 'type', 'expectedAddress']); + if ( + !Number.isSafeInteger(account.id) || + (account.id as number) < 0 || + (account.id as number) > 0x7fffffff || + (account.type !== 'HDAccount' && account.type !== 'Imported') + ) + throw invalid(); + const network = record(root.network, ['kind', 'chainId', 'slip44', 'url']); + if ( + network.kind !== 'ethereum' || + network.slip44 !== 60 || + typeof network.url !== 'string' || + !network.url || + network.url.length > 4096 || + network.url.trim() !== network.url || + // eslint-disable-next-line no-control-regex -- Reject endpoint control characters and lone surrogates. + /[\uD800-\uDFFF\u0000-\u001f\u007f]/u.test(network.url) + ) + throw invalid(); + const chainId = quantity(network.chainId, UINT256, true); + // Read the discriminator from a data property before choosing the exact schema. + if (!root.transaction || typeof root.transaction !== 'object') + throw invalid(); + const typeDescriptor = Object.getOwnPropertyDescriptor( + root.transaction, + 'type' + ); + if ( + !typeDescriptor || + !Object.prototype.hasOwnProperty.call(typeDescriptor, 'value') + ) + throw invalid(); + const type = typeDescriptor.value; + if (type !== 0 && type !== 2) throw invalid(); + const fields = [ + 'type', + 'from', + 'to', + 'chainId', + 'nonce', + 'value', + 'gasLimit', + 'data', + ]; + const transaction = record( + root.transaction, + type === 0 + ? [...fields, 'gasPrice'] + : [...fields, 'maxFeePerGas', 'maxPriorityFeePerGas'] + ); + const from = address(transaction.from); + const expectedAddress = address(account.expectedAddress); + if ( + from !== expectedAddress || + quantity(transaction.chainId, UINT256, true) !== chainId + ) + throw invalid(); + if ( + typeof transaction.data !== 'string' || + transaction.data.length > 2 + 2 * MAX_DATA_BYTES || + !/^0x(?:[0-9a-fA-F]{2})*$/.test(transaction.data) + ) + throw invalid(); + const common = { + from, + to: address(transaction.to), + chainId, + nonce: quantity(transaction.nonce, BigInt(Number.MAX_SAFE_INTEGER)), + value: quantity(transaction.value), + gasLimit: quantity(transaction.gasLimit, UINT64, true), + data: transaction.data.toLowerCase(), + }; + const fees = + type === 0 + ? { type: 0 as const, gasPrice: quantity(transaction.gasPrice) } + : { + type: 2 as const, + maxFeePerGas: quantity(transaction.maxFeePerGas), + maxPriorityFeePerGas: quantity(transaction.maxPriorityFeePerGas), + }; + if ( + fees.type === 2 && + BigInt(fees.maxPriorityFeePerGas) > BigInt(fees.maxFeePerGas) + ) + throw invalid(); + const maximumFee = + BigInt(common.gasLimit) * + BigInt(fees.type === 0 ? fees.gasPrice : fees.maxFeePerGas); + if (maximumFee + BigInt(common.value) > UINT256) throw invalid(); + return Object.freeze({ + account: Object.freeze({ + id: account.id as number, + type: account.type, + expectedAddress, + }), + network: Object.freeze({ + kind: 'ethereum', + chainId, + slip44: 60, + url: network.url, + }), + transaction: Object.freeze({ ...common, ...fees }), + }); +} + +export function preparedEvmGuard(input: unknown): () => void { + const options = record(input, ['assertCurrent']); + if (typeof options.assertCurrent !== 'function') throw invalid(); + const guard = options.assertCurrent; + return () => { + const result: unknown = guard(); + if (result !== undefined) { + // Consume a rejected async guard without allowing it to authorize signing. + if ( + result !== null && + (typeof result === 'object' || typeof result === 'function') + ) + void Promise.resolve(result).catch(() => undefined); + throw new TypeError( + 'Prepared EVM signing guard must return undefined synchronously' + ); + } + }; +} + +/** Internal, network-free signing. The key never becomes part of the result. */ +export function signPreparedEvmEnvelope( + transaction: PreparedEvmTransaction, + privateKey: string +): SignedPreparedEvmTransaction { + const unsigned = { + type: transaction.type, + to: transaction.to, + chainId: BigInt(transaction.chainId), + nonce: Number(transaction.nonce), + value: BigInt(transaction.value), + gasLimit: BigInt(transaction.gasLimit), + data: transaction.data, + ...(transaction.type === 0 + ? { gasPrice: BigInt(transaction.gasPrice) } + : { + maxFeePerGas: BigInt(transaction.maxFeePerGas), + maxPriorityFeePerGas: BigInt(transaction.maxPriorityFeePerGas), + }), + }; + const expected = Transaction.from(unsigned); + const rawTransaction = signTransaction(unsigned, privateKey); + const signed = Transaction.from(rawTransaction); + if ( + !signed.isSigned() || + signed.from !== transaction.from || + signed.unsignedSerialized !== expected.unsignedSerialized || + signed.unsignedHash !== expected.unsignedHash || + signed.hash !== keccak256(rawTransaction) + ) + throw new Error( + 'Prepared EVM signature does not match requested transaction' + ); + return Object.freeze({ + rawTransaction, + hash: signed.hash!, + unsignedHash: signed.unsignedHash, + from: signed.from!, + transaction, + }); +} diff --git a/packages/sysweb3-keyring/src/transactions/syscoin-core.ts b/packages/sysweb3-keyring/src/transactions/syscoin-core.ts new file mode 100644 index 00000000..27c11c08 --- /dev/null +++ b/packages/sysweb3-keyring/src/transactions/syscoin-core.ts @@ -0,0 +1,946 @@ +import { ITxid, txUtils } from '@sidhujag/sysweb3-utils'; +import { Psbt } from 'bitcoinjs-lib'; +import * as syscoinjs from 'syscoinjs-lib'; +// import { BIP_84, ONE_HUNDRED_MILLION, SYSCOIN_BASIC_FEE } from 'utils'; + +import { formatUnits } from '../ethers-v6'; +import { + ISyscoinTransactions, + ISyscoinTransactionFeeQuote, + KeyringAccountType, + accountType, +} from '../types'; +import { fetchBackendAccountCached } from '../utils/blockbook-cache'; +import { + ExcludedOutpoint, + excludedOutpointIds, + filterExcludedUtxos, + assertNoExcludedInputs, +} from '../utils/excluded-utxos'; +import { PsbtUtils } from '../utils/psbt'; +import { + assertPsbtAccountScope, + type PsbtAccountScope, +} from '../utils/psbt-account-scope'; + +import type { SyscoinHDSigner } from '../signers'; +import type { INetwork } from '@sidhujag/sysweb3-network'; + +/** A hardware operation receives only its selected public account/context. */ +export interface ISyscoinHardwareSigningRequest { + readonly account: Readonly<{ id: number; xpub: string }>; + assertCurrent: () => void; + getRawTransaction?: ReturnType['getRawTransaction']; + readonly network: Readonly; + psbt: Psbt; + scope: PsbtAccountScope; +} + +/** + * Trusted wallet-authority adapter, not an untrusted plugin entry point. + * Implementations must preserve the reviewed unsigned transaction and enforce + * device signature/account-scope validation before returning the signed PSBT. + */ +export type ISyscoinHardwareSigner = ( + request: ISyscoinHardwareSigningRequest +) => Promise; + +export interface ISyscoinHardwareSigners { + ledger?: ISyscoinHardwareSigner; + trezor?: ISyscoinHardwareSigner; +} + +export const createHardwareSignerUnavailableError = (hardware: string) => + Object.assign(new Error(`${hardware} signer is unavailable in this host`), { + code: 'HARDWARE_SIGNER_UNAVAILABLE', + }); + +// Recommended fee changes slowly; cache per explorer to avoid hammering +// Blockbook while the user edits amounts on the send screen +const FEE_CACHE_TTL_MS = 60_000; + +const sweepError = (code: string, message: string) => ({ + error: true, + code, + message, +}); + +const sweepAtomicValue = (value: any) => { + const text = + typeof value === 'number' + ? Number.isSafeInteger(value) + ? String(value) + : '' + : typeof value === 'string' || + typeof value === 'bigint' || + syscoinjs.utils.BN.isBN(value) + ? value.toString() + : ''; + if (!/^\d+$/.test(text)) + throw sweepError( + 'INVALID_NATIVE_SWEEP_UTXOS', + 'Invalid native sweep atomic value.' + ); + return new syscoinjs.utils.BN(text); +}; + +type EstimateFeeParams = { + changeAddress: string; + feeRateBN: any; + outputs: { address: string; value: any; subtractFeeFrom?: boolean }[]; + txOptions: any; + xpub: string; + fundingUtxos?: any; +}; + +export class SyscoinTransactionsCore implements ISyscoinTransactions { + // New separated transaction flow for better UX: + // 1. Call getEstimateSysTransactionFee() - creates UNSIGNED PSBT and calculates fee + // 2. Call signPSBT() - signs the PSBT with appropriate wallet (HD/Trezor/Ledger) + // 3. Call sendTransaction() - broadcasts the signed PSBT + // + // This separation allows: + // - Independent error handling for each step + // - Better UX feedback (fee estimation, signing, broadcasting) + // - Hardware wallet compatibility with proper PSBT enhancement + + private getSigner: () => { + hd: SyscoinHDSigner; + main: any; + }; + private getReadOnlySigner: () => { + main: any; + }; + private hardwareSigners: ISyscoinHardwareSigners; + private getState: () => { + accounts: { + HDAccount: accountType; + Imported: accountType; + Ledger: accountType; + Trezor: accountType; + }; + activeAccountId: number; + activeAccountType: KeyringAccountType; + activeNetwork: INetwork; + }; + private getAddress: ( + xpub: string, + isChangeAddress: boolean + ) => Promise; + private captureSigningContext?: () => () => void; + + constructor( + getSyscoinSigner: () => { + hd: SyscoinHDSigner; + main: any; + }, + getReadOnlySigner: () => { + main: any; + }, + getState: () => { + accounts: { + HDAccount: accountType; + Imported: accountType; + Ledger: accountType; + Trezor: accountType; + }; + activeAccountId: number; + activeAccountType: KeyringAccountType; + activeNetwork: INetwork; + }, + getAddress: (xpub: string, isChangeAddress: boolean) => Promise, + hardwareSigners: ISyscoinHardwareSigners = {}, + captureSigningContext?: () => () => void + ) { + this.getSigner = getSyscoinSigner; + this.getReadOnlySigner = getReadOnlySigner; + this.getState = getState; + this.getAddress = getAddress; + this.hardwareSigners = hardwareSigners; + this.captureSigningContext = captureSigningContext; + } + + private getTransactionPSBT = async ( + { + txOptions, + outputs, + changeAddress, + feeRateBN, + xpub, + fundingUtxos, + }: EstimateFeeParams, + main: any + ) => { + try { + // Use syscoinjs-lib directly for transaction creation + const result = await main.createTransaction( + txOptions, + changeAddress, + outputs, + feeRateBN, + xpub, // sysFromXpubOrAddress + ...(fundingUtxos ? [fundingUtxos] : []) + ); + + if (result && result.psbt) { + return { psbt: result.psbt, fee: result.fee }; + } + throw new Error('psbt not found'); + } catch (error) { + // Propagate structured error from syscoinjs-lib + if (error.error && error.code) { + throw error; + } + // Wrap non-structured errors + throw { + error: true, + code: 'TRANSACTION_CREATION_FAILED', + message: error.message || 'Failed to create transaction', + details: error, + }; + } + }; + + public decodeRawTransaction = (psbtOrHex: any, isRawHex = false) => { + const { main } = this.getReadOnlySigner(); + + if (isRawHex) { + // Handle raw transaction hex + const bitcoinTx = + syscoinjs.utils.bitcoinjs.Transaction.fromHex(psbtOrHex); + return main.decodeRawTransaction(bitcoinTx); + } else { + // Handle PSBT format (existing behavior) + const psbtObj = PsbtUtils.fromPali( + psbtOrHex, + this.getState().activeNetwork + ); + return main.decodeRawTransaction(psbtObj); + } + }; + + private feeCache = new Map(); + + public getRecommendedFee = async (explorerUrl: string): Promise => { + const cached = this.feeCache.get(explorerUrl); + if (cached && Date.now() - cached.timestamp < FEE_CACHE_TTL_MS) { + return cached.fee; + } + + const fee = (await syscoinjs.utils.fetchEstimateFee(explorerUrl, 1)) / 1024; + this.feeCache.set(explorerUrl, { fee, timestamp: Date.now() }); + return fee; + }; + + public txUtilsFunctions = () => { + const { getRawTransaction } = txUtils(); + return { + getRawTransaction, + }; + }; + + // Internal method for signing with the HD signer + private signPSBTWithSigner = async ({ + psbt, + signer, + }: { + psbt: Psbt; + signer: any; + }): Promise => await signer.sign(psbt); + + private createNativeSweepPSBT = async ( + { + txOptions, + changeAddress, + receivingAddress, + feeRateBN, + source, + excluded, + }: { + txOptions: any; + changeAddress: string; + receivingAddress: string; + feeRateBN: any; + source: string; + excluded: ReadonlySet; + }, + main: any + ): Promise => { + const raw = await syscoinjs.utils.fetchBackendUTXOS( + main.blockbookURL, + source + ); + const rows = excluded.size + ? filterExcludedUtxos(raw, excluded).utxos + : Array.isArray(raw) + ? raw + : raw?.utxos; + if (!Array.isArray(rows)) + throw sweepError( + 'INVALID_NATIVE_SWEEP_UTXOS', + 'Invalid native sweep UTXO response.' + ); + + const seen = new Set(); + const expected = new Set(); + let gross = new syscoinjs.utils.BN(0); + const utxos: any[] = []; + for (const row of rows) { + const txid = row?.txId ?? row?.txid; + if ( + typeof txid !== 'string' || + !/^[0-9a-fA-F]{64}$/.test(txid) || + !Number.isSafeInteger(row.vout) || + row.vout < 0 || + row.vout > 0xffffffff || + (row.txId !== undefined && + row.txid !== undefined && + row.txId !== row.txid) || + (row.assetInfo != null && + (typeof row.assetInfo !== 'object' || Array.isArray(row.assetInfo))) + ) + throw sweepError( + 'INVALID_NATIVE_SWEEP_UTXOS', + 'Invalid native sweep outpoint.' + ); + const outpoint = `${txid.toLowerCase()}:${row.vout}`; + if (seen.has(outpoint)) + throw sweepError( + 'INVALID_NATIVE_SWEEP_UTXOS', + 'Duplicate native sweep outpoint.' + ); + seen.add(outpoint); + const value = sweepAtomicValue(row.value); + // Native MAX must leave asset carriers and their allocations untouched. + if (row.assetInfo != null) continue; + expected.add(outpoint); + gross = gross.add(value); + utxos.push({ ...row, value }); + } + if (gross.isZero()) + throw sweepError( + 'INSUFFICIENT_FUNDS', + 'No native UTXOs are available to sweep.' + ); + + // The library sanitizes this snapshot once; its optional UTXO argument + // prevents a second funding lookup between resolving MAX and building it. + const result = await main.createTransaction( + txOptions, + changeAddress, + [{ address: receivingAddress, value: gross, subtractFeeFrom: true }], + feeRateBN, + source, + { utxos, assets: new Map() } + ); + const inputs = result.psbt?.txInputs; + const outputs = result.psbt?.txOutputs; + const selected = Array.isArray(inputs) + ? inputs.map( + (input) => + `${Buffer.from(input.hash).reverse().toString('hex')}:${ + input.index + }` + ) + : []; + if ( + selected.length !== expected.size || + new Set(selected).size !== expected.size || + selected.some((outpoint) => !expected.has(outpoint)) || + !Array.isArray(outputs) || + outputs.length !== 1 + ) + throw sweepError( + 'INCOMPLETE_NATIVE_SWEEP', + 'The builder did not preserve the complete native sweep.' + ); + const script = syscoinjs.utils.bitcoinjs.address.toOutputScript( + receivingAddress, + main.network + ); + const recipient = sweepAtomicValue(outputs[0].value); + const fee = sweepAtomicValue(result.fee); + if ( + !Buffer.from(outputs[0].script).equals(Buffer.from(script)) || + recipient.isZero() || + !recipient.add(fee).eq(gross) + ) + throw sweepError( + 'INCOMPLETE_NATIVE_SWEEP', + 'The native sweep amounts do not match its PSBT.' + ); + + return { + psbt: result.psbt, + fee: result.fee, + grossAmount: formatUnits(gross.toString(), 8).replace(/\.0$/, ''), + recipientAmount: formatUnits(recipient.toString(), 8).replace(/\.0$/, ''), + }; + }; + + // Create unsigned PSBT for any transaction type + private createUnsignedPSBT = async ({ + txOptions = {}, + isMax = false, + nativeSweep = false, + amount, + receivingAddress, + feeRateBN, + token = null, + excludedOutpoints = [], + }: { + amount: number | string; // Accept both for safer precision handling + feeRateBN: any; // BigNumber in satoshis/byte + receivingAddress: string; + token?: { guid: string; symbol?: string } | null; + txOptions?: any; + isMax?: boolean | false; + nativeSweep?: boolean; + excludedOutpoints?: readonly ExcludedOutpoint[]; + }): Promise => { + // Ensure RBF is enabled by default if not explicitly set + const finalTxOptions = { rbf: true, ...txOptions }; + const { activeAccountId, accounts, activeAccountType } = this.getState(); + // Use read-only signer since we're just creating an unsigned PSBT + const { main } = this.getReadOnlySigner(); + const account = accounts[activeAccountType]?.[activeAccountId]; + if (!account) { + throw new Error('Active account not found'); + } + const xpub = account.xpub; + const isSingleAddressImported = + activeAccountType === KeyringAccountType.Imported && + xpub === account.address; + + // For imported extended-key accounts we store BIP84 xpubs (zpub/vpub). + // Blockbook derives different address branches depending on version bytes, so preserve xpub as-is. + const sourceForUtxoLookup = isSingleAddressImported + ? account.address + : xpub; + // Convert amount to satoshis (1 SYS = 1e8 satoshis) + // Using BigNumber to prevent precision loss + const amountStr = amount.toString(); + + // Safe conversion without parseFloat to avoid precision loss + // Split the string to handle decimal values properly + const parts = amountStr.split('.'); + const integerPart = parts[0] || '0'; + const decimalPart = parts[1] || ''; + + // Pad or truncate decimal part to 8 places (satoshi precision) + const paddedDecimal = decimalPart.padEnd(8, '0').substring(0, 8); + + // Combine to get satoshis (integer + decimal as one number) + const satoshiStr = integerPart + paddedDecimal; + + // Remove leading zeros but keep at least one digit + const trimmedSatoshis = satoshiStr.replace(/^0+/, '') || '0'; + + const value = new syscoinjs.utils.BN(trimmedSatoshis); + // If this is a single-address imported account (WIF import), use the account.address for both from and change + const changeAddress = isSingleAddressImported + ? account.address + : await this.getAddress(xpub, true); + + try { + const excluded = excludedOutpointIds(excludedOutpoints); + if (nativeSweep) { + return await this.createNativeSweepPSBT( + { + txOptions: finalTxOptions, + changeAddress, + receivingAddress, + feeRateBN, + source: sourceForUtxoLookup, + excluded, + }, + main + ); + } + const fundingUtxos = excluded.size + ? filterExcludedUtxos( + await syscoinjs.utils.fetchBackendUTXOS( + main.blockbookURL, + sourceForUtxoLookup + ), + excluded + ) + : undefined; + if (token && token.guid) { + // Token transaction: use assetAllocationSend + // Create a Map for the asset allocation + const assetMap = new Map(); + assetMap.set(token.guid, { + changeAddress, + outputs: [ + { + value: value as any, + address: receivingAddress, + }, + ], + }); + + // Pass xpub to get back just the PSBT without signing and sending + // syscoinjs-lib will validate asset existence and sufficient balance + const result = await main.assetAllocationSend( + finalTxOptions, + assetMap, + changeAddress, + feeRateBN, + sourceForUtxoLookup, // Pass source (address for WIF imports, zpub/vpub for HD) + ...(fundingUtxos ? [fundingUtxos] : []) + ); + + if (excluded.size) assertNoExcludedInputs(result.psbt, excluded); + + // Return PSBT and fee + return { psbt: result.psbt, fee: result.fee }; + } else { + // Native transaction: use getTransactionPSBT to create unsigned PSBT + const outputs = [ + { + address: receivingAddress, + value: value, // Pass BN object directly + ...(isMax && { subtractFeeFrom: true }), // Only add subtractFeeFrom if isMax is true + }, + ]; + + const result = await this.getTransactionPSBT( + { + txOptions: finalTxOptions, + outputs, + changeAddress, + feeRateBN, + xpub: sourceForUtxoLookup, + fundingUtxos, + }, + main + ); + + if (excluded.size) assertNoExcludedInputs(result.psbt, excluded); + + return result; + } + } catch (error) { + // Re-throw structured errors from syscoinjs-lib + if (error.error && error.code) { + throw error; + } + // Wrap other errors in structured format + throw { + error: true, + code: 'TRANSACTION_CREATION_FAILED', + message: error.message || 'Failed to create unsigned PSBT', + details: error, + }; + } + }; + + // Sign PSBT with appropriate method - separated for better error handling + private signPSBTWithMethod = async ( + psbt: Psbt, + isTrezor: boolean, + isLedger = false + ): Promise => { + const { activeNetwork, activeAccountId, activeAccountType, accounts } = + this.getState(); + const account = accounts[activeAccountType]?.[activeAccountId]; + if (!account) throw new Error('Active account not found'); + // Device choice belongs to the selected account, never to PSBT/caller flags. + isTrezor = + activeAccountType === KeyringAccountType.Trezor || + account.isTrezorWallet === true; + isLedger = + activeAccountType === KeyringAccountType.Ledger || + account.isLedgerWallet === true; + const assertSession = this.captureSigningContext?.() || (() => undefined); + // The adapter gets a detached, immutable public context. It must not be + // able to mutate the wallet state or the baseline used by assertCurrent. + const scope = Object.freeze({ + account: Object.freeze({ address: account.address, xpub: account.xpub }), + accountId: activeAccountId, + accountType: activeAccountType, + network: Object.freeze({ ...activeNetwork }), + }); + const assertCurrent = () => { + assertSession(); + const current = this.getState(); + const selected = + current.accounts[current.activeAccountType]?.[current.activeAccountId]; + if ( + current.activeAccountId !== activeAccountId || + current.activeAccountType !== activeAccountType || + selected?.address !== scope.account.address || + selected?.xpub !== scope.account.xpub || + current.activeNetwork.kind !== scope.network.kind || + current.activeNetwork.chainId !== scope.network.chainId || + current.activeNetwork.slip44 !== scope.network.slip44 || + current.activeNetwork.url !== scope.network.url + ) { + throw new Error('Wallet signing context changed'); + } + }; + assertCurrent(); + const sign = isLedger + ? this.hardwareSigners.ledger + : isTrezor + ? this.hardwareSigners.trezor + : undefined; + if ((isLedger || isTrezor) && typeof sign !== 'function') + throw createHardwareSignerUnavailableError( + isLedger ? 'Ledger' : 'Trezor' + ); + if (isTrezor || isLedger) assertPsbtAccountScope(psbt, scope); + + if (isLedger || isTrezor) { + const signed = await sign!({ + psbt, + account: Object.freeze({ id: account.id, xpub: account.xpub }), + network: scope.network, + scope, + assertCurrent, + ...(isLedger && { + getRawTransaction: this.txUtilsFunctions().getRawTransaction, + }), + }); + assertCurrent(); + return signed; + } else { + // HD signing (seed-based HDAccount or imported BIP84 zprv/vprv account). + // Some Blockbook deployments return UTXOs without per-input derivation `path`, + // which causes bitcoinjs-lib to throw "Need derivation path to sign with HD". + // + // We can recover by enriching PSBT inputs with a proprietary `path` field using + // Blockbook's xpub token list (address -> path mapping), which reliably includes paths. + try { + const account = accounts[activeAccountType]?.[activeAccountId] as any; + const accountXpub = account?.xpub as string | undefined; + const accountAddress = account?.address as string | undefined; + const isSingleAddressImported = + activeAccountType === KeyringAccountType.Imported && + Boolean(accountXpub) && + Boolean(accountAddress) && + accountXpub === accountAddress; + const isImportedExtended = + activeAccountType === KeyringAccountType.Imported && + Boolean(accountXpub) && + !isSingleAddressImported; + + // IMPORTANT: Imported extended keys (zprv/vprv) are typically *account-level* keys. + // syscoinjs-lib signs using the imported key as the BIP32 root, so PSBT `path` must be + // relative (change/index), not the full `m/84'/.../change/index`. If we keep full paths, + // bip32.derivePath can throw, leaving no derivations and causing "Need derivation path". + if (isImportedExtended) { + const inputs: any[] = (psbt as any)?.data?.inputs || []; + for (const input of inputs) { + const unknowns = input?.unknownKeyVals || []; + const pathKv = unknowns.find( + (kv) => kv?.key?.toString?.() === 'path' + ); + if (!pathKv?.value) continue; + const fullPath = String(Buffer.from(pathKv.value).toString()); + const parts = fullPath.split('/').filter(Boolean); + // Expected: m/84'/slip44'/account'/change/index + if (parts.length >= 2) { + const change = parts[parts.length - 2]; + const index = parts[parts.length - 1]; + const rel = `${change}/${index}`; + pathKv.value = Buffer.from(rel); + } + } + } + + const needsAnyPath = (psbt as any)?.data?.inputs?.some((input) => { + const unknowns = input?.unknownKeyVals || []; + return ( + !input.bip32Derivation?.length && + !input.tapBip32Derivation?.length && + !unknowns.some((kv) => kv?.key?.toString?.() === 'path') + ); + }); + + if ( + needsAnyPath && + accountXpub && + !isSingleAddressImported && + typeof (psbt as any).addUnknownKeyValToInput === 'function' + ) { + // Fetch address->path mapping from Blockbook xpub endpoint + // (in-flight deduplicated with the keyring's getAddress lookups) + const blockbookUrl = activeNetwork.url; + const res: any = await fetchBackendAccountCached( + blockbookUrl, + accountXpub, + 'tokens=used&details=tokens' + ); + const tokens: any[] = Array.isArray(res?.tokens) ? res.tokens : []; + const addrToPath = new Map(); + for (const t of tokens) { + if (t?.name && t?.path) { + addrToPath.set(String(t.name), String(t.path)); + } + } + + const inputs: any[] = (psbt as any)?.data?.inputs || []; + for (let i = 0; i < inputs.length; i++) { + const input = inputs[i]; + const unknowns = input?.unknownKeyVals || []; + const hasPath = unknowns.some( + (kv) => kv?.key?.toString?.() === 'path' + ); + if (hasPath) continue; + + const addrKv = unknowns.find( + (kv) => kv?.key?.toString?.() === 'address' + ); + const addr = addrKv?.value + ? String(Buffer.from(addrKv.value).toString()) + : null; + if (!addr) continue; + + const fullPath = addrToPath.get(addr); + if (!fullPath) continue; + + // Imported extended keys are account-level (BIP84 account node), so we must provide a + // path relative to that node (change/index), not the full m/84'/... path. + const pathForSigner = isImportedExtended + ? (() => { + const parts = String(fullPath).split('/').filter(Boolean); + // Expected: m/84'/slip44'/account'/change/index + if (parts.length >= 2) { + const change = parts[parts.length - 2]; + const index = parts[parts.length - 1]; + return `${change}/${index}`; + } + return fullPath; + })() + : fullPath; + + (psbt as any).addUnknownKeyValToInput(i, { + key: Buffer.from('path'), + value: Buffer.from(pathForSigner), + }); + } + } + } catch (_e) { + // Best-effort enrichment; if it fails, fall back to default signing error path. + } + + assertCurrent(); + assertPsbtAccountScope(psbt, scope); + const { hd } = this.getSigner(); + const signedPsbt = await this.signPSBTWithSigner({ + psbt, + signer: hd, + }); + assertCurrent(); + return signedPsbt; + } + }; + + // Create unsigned PSBT and estimate fee - NO SIGNING + public getEstimateSysTransactionFee = async ({ + txOptions = {}, + isMax = false, + nativeSweep = false, + amount, + receivingAddress, + feeRate, + token = null, + excludedOutpoints = [], + }: { + amount: number | string; // Accept both for safer precision handling + feeRate?: number; + receivingAddress: string; + // Optional fee rate in SYS/byte + token?: { guid: string; symbol?: string } | null; + txOptions?: any; + isMax?: boolean | false; + nativeSweep?: boolean; + excludedOutpoints?: readonly ExcludedOutpoint[]; + }) => { + try { + if ( + nativeSweep !== false && + (nativeSweep !== true || isMax !== true || token !== null) + ) + throw sweepError( + 'INVALID_NATIVE_SWEEP', + 'Native sweep requires explicit MAX and a native transaction.' + ); + // Ensure RBF is enabled by default if not explicitly set + const finalTxOptions = { rbf: true, ...txOptions }; + // Use read-only signer since we're just estimating fees and creating unsigned PSBT + const { main } = this.getReadOnlySigner(); + // Step 1: Determine fee rate + let actualFeeRate; + if (feeRate !== undefined) { + actualFeeRate = feeRate; + } else { + actualFeeRate = await this.getRecommendedFee(main.blockbookURL); + } + + // Convert fee rate to satoshis/byte and ensure minimum relay of 1 sat/vB + // Blockbook returns coins per kB; after division by 1024, some testnets + // can yield < 1 sat/vB (e.g., 0.9765625). Round up and clamp to 1 to + // avoid zero-fee transactions due to truncation when converting to BN. + const satPerByte = Math.max(1, Math.ceil(actualFeeRate * 1e8)); + const feeRateBN = new syscoinjs.utils.BN(satPerByte); + + // Step 2: Create unsigned PSBT + const result = await this.createUnsignedPSBT({ + txOptions: finalTxOptions, + isMax, + nativeSweep, + amount, + receivingAddress, + feeRateBN, + token, + excludedOutpoints, + }); + + return { + fee: result.fee / 1e8, + psbt: PsbtUtils.toPali(result.psbt), // Return UNSIGNED PSBT as JSON + ...(nativeSweep + ? { + grossAmount: result.grossAmount, + recipientAmount: result.recipientAmount, + } + : {}), + }; + } catch (error) { + // Pass through structured errors from syscoinjs-lib + if (error.error && error.code) { + // Convert fee from satoshis to SYS if available + if (error.fee !== undefined) { + // If fee is a BN object, convert to number first + if (typeof error.fee === 'object' && error.fee.toNumber) { + error.fee = error.fee.toNumber() / 1e8; + } else { + error.fee = error.fee / 1e8; + } + } + if (error.remainingFee !== undefined) { + // If remainingFee is a BN object, convert to number first + if ( + typeof error.remainingFee === 'object' && + error.remainingFee.toNumber + ) { + error.remainingFee = error.remainingFee.toNumber() / 1e8; + } else { + error.remainingFee = error.remainingFee / 1e8; + } + } + if (error.shortfall !== undefined) { + // If shortfall is a BN object, convert to number first + if (typeof error.shortfall === 'object' && error.shortfall.toNumber) { + error.shortfall = error.shortfall.toNumber() / 1e8; + } else { + error.shortfall = error.shortfall / 1e8; + } + } + throw error; + } + // Wrap other errors + throw { + error: true, + code: 'TRANSACTION_CREATION_FAILED', + message: error.message || 'Failed to estimate transaction fee', + details: error, + }; + } + }; + + // Removed createAndSignSysTransaction - functionality merged into getEstimateSysTransactionFee + + private sendSignedTransaction = async (psbt): Promise => { + try { + // Use read-only signer since we're just broadcasting an already-signed transaction + const { main } = this.getReadOnlySigner(); + // Send the transaction + const result = await main.send(psbt); + + // Extract the transaction ID + const txid = result.extractTransaction().getId(); + return { txid }; + } catch (error) { + // Pass through structured errors + if (error.error && error.code) { + throw error; + } + // Wrap other errors + throw { + error: true, + code: 'TRANSACTION_SEND_FAILED', + message: error.message || 'Failed to send transaction', + details: error, + }; + } + }; + + public signPSBT = async ({ + psbt, + isTrezor = false, + isLedger = false, + }: { + psbt: any; + isTrezor?: boolean; + isLedger?: boolean; + }): Promise => { + const psbtObj = PsbtUtils.fromPali(psbt, this.getState().activeNetwork); + // Scope validation temporarily removes other signers' hints. Preserve the + // public metadata for the next cosigner, without exposing it to our signer. + const cosignerMetadata = psbtObj.data.inputs.map((input, index) => ({ + hash: Buffer.from(psbtObj.txInputs[index].hash), + index: psbtObj.txInputs[index].index, + bip32Derivation: input.bip32Derivation?.map((value) => ({ ...value })), + tapBip32Derivation: input.tapBip32Derivation?.map((value) => ({ + ...value, + })), + path: input.unknownKeyVals + ?.filter((value) => Buffer.from(value.key).toString() === 'path') + .map((value) => ({ + key: Buffer.from(value.key), + value: Buffer.from(value.value), + }))[0], + })); + const signedPsbt = await this.signPSBTWithMethod( + psbtObj, + isTrezor, + isLedger + ); + signedPsbt.data.inputs.forEach((input, index) => { + if (input.finalScriptSig || input.finalScriptWitness) return; + const metadata = cosignerMetadata[index]; + if (!metadata) return; + const signed = signedPsbt.txInputs[index]; + if ( + !signed || + metadata.index !== signed.index || + !metadata.hash.equals(Buffer.from(signed.hash)) + ) + throw new Error('Wallet signing context changed'); + if (metadata.bip32Derivation) + input.bip32Derivation = metadata.bip32Derivation; + if (metadata.tapBip32Derivation) + input.tapBip32Derivation = metadata.tapBip32Derivation; + if (metadata.path) { + input.unknownKeyVals = (input.unknownKeyVals || []).filter( + (value) => Buffer.from(value.key).toString() !== 'path' + ); + input.unknownKeyVals.push(metadata.path); + } + }); + return PsbtUtils.toPali(signedPsbt); + }; + + public sendTransaction = async (psbt: any): Promise => { + if (!psbt) { + throw new Error('Signed PSBT is required for broadcasting.'); + } + return await this.sendSignedTransaction( + PsbtUtils.fromPali(psbt, this.getState().activeNetwork) + ); + }; +} diff --git a/packages/sysweb3-keyring/src/transactions/syscoin.ts b/packages/sysweb3-keyring/src/transactions/syscoin.ts index 8f2bbaea..bbe09e2e 100644 --- a/packages/sysweb3-keyring/src/transactions/syscoin.ts +++ b/packages/sysweb3-keyring/src/transactions/syscoin.ts @@ -1,485 +1,35 @@ -import * as syscoinjs from 'syscoinjs-lib'; -// import { BIP_84, ONE_HUNDRED_MILLION, SYSCOIN_BASIC_FEE } from 'utils'; - -import { LedgerKeyring } from '../ledger'; -import { DefaultWalletPolicy } from '../ledger/bitcoin_client'; -import { SyscoinHDSigner } from '../signers'; -import { TrezorKeyring } from '../trezor'; import { - ISyscoinTransactions, - KeyringAccountType, - accountType, -} from '../types'; -import { getAccountDerivationPath } from '../utils/derivation-paths'; -import { PsbtUtils } from '../utils/psbt'; -import { INetwork } from '@pollum-io/sysweb3-network'; -import { ITxid, txUtils } from '@pollum-io/sysweb3-utils'; - -type EstimateFeeParams = { - changeAddress: string; - feeRateBN: any; - outputs: { address: string; value: any; subtractFeeFrom?: boolean }[]; - txOptions: any; - xpub: string; -}; + createLedgerPsbtSigner, + createTrezorPsbtSigner, +} from './hardware-psbt'; +import { SyscoinTransactionsCore } from './syscoin-core'; -export class SyscoinTransactions implements ISyscoinTransactions { - // New separated transaction flow for better UX: - // 1. Call getEstimateSysTransactionFee() - creates UNSIGNED PSBT and calculates fee - // 2. Call signPSBT() - signs the PSBT with appropriate wallet (HD/Trezor/Ledger) - // 3. Call sendTransaction() - broadcasts the signed PSBT - // - // This separation allows: - // - Independent error handling for each step - // - Better UX feedback (fee estimation, signing, broadcasting) - // - Hardware wallet compatibility with proper PSBT enhancement +import type { LedgerKeyring } from '../ledger'; +import type { TrezorKeyring } from '../trezor'; - private getSigner: () => { - hd: SyscoinHDSigner; - main: any; - }; - private getReadOnlySigner: () => { - main: any; - }; - private trezor: TrezorKeyring; - private ledger: LedgerKeyring; - private getState: () => { - accounts: { - HDAccount: accountType; - Imported: accountType; - Ledger: accountType; - Trezor: accountType; - }; - activeAccountId: number; - activeAccountType: KeyringAccountType; - activeNetwork: INetwork; - }; - private getAddress: ( - xpub: string, - isChangeAddress: boolean - ) => Promise; +type CoreArguments = ConstructorParameters; +/** Legacy constructor: preserve device arguments while composing shared logic. */ +export class SyscoinTransactions extends SyscoinTransactionsCore { constructor( - getSyscoinSigner: () => { - hd: SyscoinHDSigner; - main: any; - }, - getReadOnlySigner: () => { - main: any; - }, - getState: () => { - accounts: { - HDAccount: accountType; - Imported: accountType; - Ledger: accountType; - Trezor: accountType; - }; - activeAccountId: number; - activeAccountType: KeyringAccountType; - activeNetwork: INetwork; - }, - getAddress: (xpub: string, isChangeAddress: boolean) => Promise, + getSyscoinSigner: CoreArguments[0], + getReadOnlySigner: CoreArguments[1], + getState: CoreArguments[2], + getAddress: CoreArguments[3], ledgerSigner: LedgerKeyring, - trezorSigner: TrezorKeyring + trezorSigner: TrezorKeyring, + captureSigningContext?: CoreArguments[5] ) { - this.getSigner = getSyscoinSigner; - this.getReadOnlySigner = getReadOnlySigner; - this.getState = getState; - this.getAddress = getAddress; - this.trezor = trezorSigner; - this.ledger = ledgerSigner; - } - - private getTransactionPSBT = async ({ - txOptions, - outputs, - changeAddress, - xpub, - feeRateBN, - }: EstimateFeeParams) => { - const { main } = this.getSigner(); - - try { - // Use syscoinjs-lib directly for transaction creation - const result = await main.createTransaction( - txOptions, - changeAddress, - outputs, - feeRateBN, - xpub // sysFromXpubOrAddress - ); - - if (result && result.psbt) { - return { psbt: result.psbt, fee: result.fee }; - } - throw new Error('psbt not found'); - } catch (error) { - // Propagate structured error from syscoinjs-lib - if (error.error && error.code) { - throw error; - } - // Wrap non-structured errors - throw { - error: true, - code: 'TRANSACTION_CREATION_FAILED', - message: error.message || 'Failed to create transaction', - details: error, - }; - } - }; - - public decodeRawTransaction = (psbtOrHex: any, isRawHex = false) => { - const { main } = this.getReadOnlySigner(); - - if (isRawHex) { - // Handle raw transaction hex - const bitcoinTx = - syscoinjs.utils.bitcoinjs.Transaction.fromHex(psbtOrHex); - return main.decodeRawTransaction(bitcoinTx); - } else { - // Handle PSBT format (existing behavior) - const psbtObj = PsbtUtils.fromPali(psbtOrHex); - return main.decodeRawTransaction(psbtObj); - } - }; - - public getRecommendedFee = async (explorerUrl: string): Promise => - (await syscoinjs.utils.fetchEstimateFee(explorerUrl, 1)) / 1024; - - public txUtilsFunctions = () => { - const { getRawTransaction } = txUtils(); - return { - getRawTransaction, - }; - }; - - // Internal method for signing with the HD signer - private signPSBTWithSigner = async ({ - psbt, - signer, - pathIn, - }: { - pathIn?: string; - psbt: any; - signer: any; - }): Promise => await signer.sign(psbt, pathIn); - - // Create unsigned PSBT for any transaction type - private createUnsignedPSBT = async ({ - txOptions = {}, - isMax = false, - amount, - receivingAddress, - feeRateBN, - token = null, - }: { - amount: number; - feeRateBN: any; // BigNumber in satoshis/byte - receivingAddress: string; - token?: { guid: string; symbol?: string } | null; - txOptions?: any; - isMax?: boolean | false; - }): Promise<{ psbt: any; fee: number }> => { - // Ensure RBF is enabled by default if not explicitly set - const finalTxOptions = { rbf: true, ...txOptions }; - const { activeAccountId, accounts, activeAccountType } = this.getState(); - const { main } = this.getSigner(); - const account = accounts[activeAccountType]?.[activeAccountId]; - if (!account) { - throw new Error('Active account not found'); - } - const xpub = account.xpub; - const value = new syscoinjs.utils.BN(amount * 1e8); - const changeAddress = await this.getAddress(xpub, true); - - try { - if (token && token.guid) { - // Token transaction: use assetAllocationSend - // Create a Map for the asset allocation - const assetMap = new Map(); - assetMap.set(token.guid, { - changeAddress, - outputs: [ - { - value: value as any, - address: receivingAddress, - }, - ], - }); - - // Pass xpub to get back just the PSBT without signing and sending - // syscoinjs-lib will validate asset existence and sufficient balance - const result = await main.assetAllocationSend( - finalTxOptions, - assetMap, - changeAddress, - feeRateBN, - xpub // Pass xpub to get PSBT back - ); - - // Return PSBT and fee - return { psbt: result.psbt, fee: result.fee }; - } else { - // Native transaction: use getTransactionPSBT to create unsigned PSBT - const outputs = [ - { - address: receivingAddress, - value: value, // Pass BN object directly - ...(isMax && { subtractFeeFrom: true }), // Only add subtractFeeFrom if isMax is true - }, - ]; - - const result = await this.getTransactionPSBT({ - txOptions: finalTxOptions, - outputs, - changeAddress, - feeRateBN, - xpub, - }); - - return result; - } - } catch (error) { - // Re-throw structured errors from syscoinjs-lib - if (error.error && error.code) { - throw error; - } - // Wrap other errors in structured format - throw { - error: true, - code: 'TRANSACTION_CREATION_FAILED', - message: error.message || 'Failed to create unsigned PSBT', - details: error, - }; - } - }; - - // Sign PSBT with appropriate method - separated for better error handling - private signPSBTWithMethod = async ( - psbt: any, - isTrezor: boolean, - isLedger = false, - pathIn = '' - ): Promise => { - const { activeNetwork, activeAccountId, activeAccountType, accounts } = - this.getState(); - - if (isLedger) { - // CRITICAL: Enhance PSBT with required Ledger fields - const account = accounts[activeAccountType]?.[activeAccountId]; - if (!account) { - throw new Error('Active account not found'); - } - const accountXpub = account.xpub; - const accountId = account.id; - const enhancedPsbt = await this.ledger.convertToLedgerFormat( - psbt, - accountXpub, - accountId, - activeNetwork.currency, - activeNetwork.slip44 - ); - - // Get wallet policy for Ledger - const fingerprint = - await this.ledger.ledgerUtxoClient.getMasterFingerprint(); - - // Use dynamic path generation if no path provided - let hdPath = pathIn; - if (!pathIn || pathIn.length === 0) { - hdPath = getAccountDerivationPath( - activeNetwork.currency, - activeNetwork.slip44, - accountId - ); - } - - const xpubWithDescriptor = `[${hdPath}]${accountXpub}`.replace( - 'm', - fingerprint - ); - const walletPolicy = new DefaultWalletPolicy( - 'wpkh(@0/**)', - xpubWithDescriptor - ); - - // Sign the enhanced PSBT with Ledger - const signatureEntries = await this.ledger.ledgerUtxoClient.signPsbt( - enhancedPsbt.toBase64(), - walletPolicy, - null // No HMAC needed for standard policy - ); - - signatureEntries.forEach(([inputIndex, partialSig]) => { - enhancedPsbt.updateInput(inputIndex, { - partialSig: [partialSig], - }); - }); - - // Finalize all inputs - enhancedPsbt.finalizeAllInputs(); - - return enhancedPsbt; - } else if (isTrezor) { - // Handle Trezor signing for UTXO - const trezorTx = this.trezor.convertToTrezorFormat({ - psbt, - pathIn, // Pass pathIn to Trezor - coin: activeNetwork.currency.toLowerCase(), - }); - const signedPsbt = await this.trezor.signUtxoTransaction(trezorTx, psbt); - return signedPsbt; - } else { - const { hd } = this.getSigner(); - const signedPsbt = await this.signPSBTWithSigner({ - psbt, - signer: hd, - pathIn, - }); - return signedPsbt; - } - }; - - // Create unsigned PSBT and estimate fee - NO SIGNING - public getEstimateSysTransactionFee = async ({ - txOptions = {}, - isMax = false, - amount, - receivingAddress, - feeRate, - token = null, - }: { - amount: number; - feeRate?: number; - receivingAddress: string; - // Optional fee rate in SYS/byte - token?: { guid: string; symbol?: string } | null; - txOptions?: any; - isMax?: boolean | false; - }) => { - try { - // Ensure RBF is enabled by default if not explicitly set - const finalTxOptions = { rbf: true, ...txOptions }; - const { main } = this.getSigner(); - // Step 1: Determine fee rate - let actualFeeRate; - if (feeRate !== undefined) { - actualFeeRate = feeRate; - } else { - actualFeeRate = await this.getRecommendedFee(main.blockbookURL); - } - - // Convert fee rate to satoshis/byte for consistent usage - const feeRateBN = new syscoinjs.utils.BN(actualFeeRate * 1e8); - - // Step 2: Create unsigned PSBT - const result = await this.createUnsignedPSBT({ - txOptions: finalTxOptions, - isMax, - amount, - receivingAddress, - feeRateBN, - token, - }); - - return { - fee: result.fee / 1e8, - psbt: PsbtUtils.toPali(result.psbt), // Return UNSIGNED PSBT as JSON - }; - } catch (error) { - // Pass through structured errors from syscoinjs-lib - if (error.error && error.code) { - // Convert fee from satoshis to SYS if available - if (error.fee !== undefined) { - // If fee is a BN object, convert to number first - if (typeof error.fee === 'object' && error.fee.toNumber) { - error.fee = error.fee.toNumber() / 1e8; - } else { - error.fee = error.fee / 1e8; - } - } - if (error.remainingFee !== undefined) { - // If remainingFee is a BN object, convert to number first - if ( - typeof error.remainingFee === 'object' && - error.remainingFee.toNumber - ) { - error.remainingFee = error.remainingFee.toNumber() / 1e8; - } else { - error.remainingFee = error.remainingFee / 1e8; - } - } - if (error.shortfall !== undefined) { - // If shortfall is a BN object, convert to number first - if (typeof error.shortfall === 'object' && error.shortfall.toNumber) { - error.shortfall = error.shortfall.toNumber() / 1e8; - } else { - error.shortfall = error.shortfall / 1e8; - } - } - throw error; - } - // Wrap other errors - throw { - error: true, - code: 'TRANSACTION_CREATION_FAILED', - message: error.message || 'Failed to estimate transaction fee', - details: error, - }; - } - }; - - // Removed createAndSignSysTransaction - functionality merged into getEstimateSysTransactionFee - - private sendSignedTransaction = async (psbt): Promise => { - try { - const { main } = this.getSigner(); - // Send the transaction - const result = await main.send(psbt); - - // Extract the transaction ID - const txid = result.extractTransaction().getId(); - return { txid }; - } catch (error) { - // Pass through structured errors - if (error.error && error.code) { - throw error; - } - // Wrap other errors - throw { - error: true, - code: 'TRANSACTION_SEND_FAILED', - message: error.message || 'Failed to send transaction', - details: error, - }; - } - }; - - public signPSBT = async ({ - psbt, - isTrezor = false, - isLedger = false, - pathIn, - }: { - psbt: any; - isTrezor?: boolean; - isLedger?: boolean; - pathIn?: string; - }): Promise => { - const psbtObj = PsbtUtils.fromPali(psbt); - const signedPsbt = await this.signPSBTWithMethod( - psbtObj, - isTrezor, - isLedger, - pathIn + super( + getSyscoinSigner, + getReadOnlySigner, + getState, + getAddress, + { + ledger: ledgerSigner ? createLedgerPsbtSigner(ledgerSigner) : undefined, + trezor: trezorSigner ? createTrezorPsbtSigner(trezorSigner) : undefined, + }, + captureSigningContext ); - return PsbtUtils.toPali(signedPsbt); - }; - - public sendTransaction = async (psbt: any): Promise => { - if (!psbt) { - throw new Error('Signed PSBT is required for broadcasting.'); - } - return await this.sendSignedTransaction(PsbtUtils.fromPali(psbt)); - }; + } } diff --git a/packages/sysweb3-keyring/src/trezor/connect.ts b/packages/sysweb3-keyring/src/trezor/connect.ts new file mode 100644 index 00000000..e4c6d798 --- /dev/null +++ b/packages/sysweb3-keyring/src/trezor/connect.ts @@ -0,0 +1,263 @@ +import type { + ConnectDynamicSettings, + TrezorConnectPublicAPI, +} from '@trezor/connect-webextension'; + +type Client = TrezorConnectPublicAPI; +const methods = [ + 'getFeatures', + 'getAccountInfo', + 'ethereumGetAddress', + 'ethereumGetPublicKey', + 'getPublicKey', + 'getAddress', + 'signTransaction', + 'ethereumSignTransaction', + 'signMessage', + 'ethereumSignMessage', + 'ethereumSignTypedData', + 'verifyMessage', + 'ethereumVerifyMessage', +] as const; +type Method = (typeof methods)[number]; +type Compatible = T extends { success: false } + ? T & { payload: { error: string; code?: string } } + : T; +type CompatibleCall = FunctionType extends { + (...args: infer A): infer R; + (...args: infer B): infer S; + (...args: infer C): infer T; +} + ? { + (...args: A): Promise>>; + (...args: B): Promise>>; + (...args: C): Promise>>; + } + : never; +type Calls = { [Name in Method]: CompatibleCall }; +type ConnectionEvent = + | { type: 'disconnected' } + | { type: 'model'; model: string }; +const listeners = new Set<(event: ConnectionEvent) => void>(); +let clientPromise: Promise | undefined; +let generation = 0; +let initialized = false; +let cleanupPromise = Promise.resolve(); +let cleanupPending = false; +const inFlight = new Set>(); +const pending = new Set<(error: Error) => void>(); +const interrupted = () => + Object.assign(new Error('Trezor operation cancelled'), { + code: 'Method_Interrupted', + }); +const invalidate = () => { + generation++; + initialized = false; + const error = interrupted(); + for (const reject of pending) reject(error); + pending.clear(); + emit({ type: 'disconnected' }); +}; + +export const subscribeTrezorEvents = ( + listener: (event: ConnectionEvent) => void +): (() => void) => { + listeners.add(listener); + return () => listeners.delete(listener); +}; +const emit = (event: ConnectionEvent) => { + for (const listener of listeners) { + try { + listener(event); + } catch { + // Status observers must not turn a completed device call into a retry. + } + } +}; + +/** Connect 10's webextension module registers Chrome listeners on import. */ +const requireExtensionHost = (): void => { + const chrome = (globalThis as any).chrome; + if ( + !chrome?.runtime?.id || + chrome.runtime.getManifest?.()?.manifest_version !== 3 || + typeof chrome.runtime.onConnect?.addListener !== 'function' || + typeof chrome.runtime.onMessageExternal?.addListener !== 'function' || + typeof chrome.tabs?.get !== 'function' || + typeof chrome.tabs?.create !== 'function' || + typeof chrome.tabs?.update !== 'function' || + typeof chrome.windows?.getCurrent !== 'function' + ) { + throw Object.assign( + new Error('Trezor requires a supported MV3 extension host'), + { code: 'HARDWARE_SIGNER_UNAVAILABLE' } + ); + } +}; +const getClient = (): Promise => { + requireExtensionHost(); + if (!clientPromise) { + clientPromise = import('@trezor/connect-webextension') + .then((module) => module.default) + .catch((error) => { + clientPromise = undefined; + throw error; + }); + } + return clientPromise; +}; + +/** Keep the SDK's established failure payload while preserving Connect 10 codes. */ +const normalize = (response: any, method: Method): any => { + if (response?.success === false) { + const error = response.error; + const code = typeof error?.code === 'string' ? error.code : undefined; + if ( + code === 'Device_Disconnected' || + code === 'Device_NotFound' || + code === 'Desktop_ConnectionMissing' || + code === 'Transport_Missing' + ) { + invalidate(); + } + return { + ...response, + payload: { + error: + typeof error?.message === 'string' + ? error.message + : 'Trezor request failed', + code, + }, + }; + } + const model = + response?.device?.features?.model ?? + (method === 'getFeatures' ? response?.payload?.model : undefined); + if (response?.success === true && typeof model === 'string') { + emit({ type: 'model', model }); + } + return response; +}; +const withClient = async ( + operation: (client: Client) => Promise, + requireInitialized = true +): Promise => { + const captured = generation; + const assertCurrent = () => { + if (captured !== generation) throw interrupted(); + if (requireInitialized && !initialized) { + throw Object.assign(new Error('TrezorConnect not initialized'), { + code: 'Init_NotInitialized', + }); + } + }; + assertCurrent(); + let rejectPending!: (error: Error) => void; + const cancelled = new Promise((_resolve, reject) => { + rejectPending = reject; + }); + pending.add(rejectPending); + try { + const result = await Promise.race([ + (async () => { + await cleanupPromise; + assertCurrent(); + const client = await getClient(); + assertCurrent(); + const request = Promise.resolve(operation(client)); + inFlight.add(request); + try { + return await request; + } finally { + inFlight.delete(request); + } + })(), + cancelled, + ]); + // A late response must not restore a model/status or return a signature. + assertCurrent(); + return result; + } finally { + pending.delete(rejectPending); + } +}; +const calls = Object.fromEntries( + methods.map((method) => [ + method, + async (...args: any[]) => { + const captured = generation; + const response = await withClient((client) => + (client[method] as any)(...args) + ); + if (captured !== generation) throw interrupted(); + return normalize(response, method); + }, + ]) +) as Calls; + +const TrezorConnect: Calls & { + init: Client['init']; + dispose: () => Promise; +} = { + ...calls, + async init(settings: Parameters[0]): Promise { + if (cleanupPending) { + throw Object.assign( + new Error('Previous Trezor request is still pending'), + { + code: 'HARDWARE_SIGNER_BUSY', + } + ); + } + invalidate(); + const captured = generation; + await withClient( + (client) => client.init({ ...settings, env: 'webextension' }), + false + ); + if (captured !== generation) throw interrupted(); + initialized = true; + }, + dispose(): Promise { + // Invalidate synchronously, before waiting for import or remote cleanup. + // Suite Web's upstream dispose is a no-op; local invalidation is required. + invalidate(); + if (cleanupPending) { + return inFlight.size ? Promise.resolve() : cleanupPromise; + } + const loaded = clientPromise; + if (!loaded) return Promise.resolve(); + const outstanding = [...inFlight]; + cleanupPending = true; + cleanupPromise = cleanupPromise + .catch(() => undefined) + .then(async () => { + // Closing Desktop's socket during a raw call makes Connect auto-open + // Suite Web. Let that raw call settle while its result stays fenced. + await Promise.allSettled(outstanding); + const client = await loaded; + // Desktop cancel() discards an internal Promise in Connect 10.0.1; + // do not invoke it or claim that Suite Web's no-op dispose closes UI. + await client.dispose(); + }) + .finally(() => { + cleanupPending = false; + }); + // Deferred cleanup may outlive the caller; preserve its failure for future + // init while preventing an unhandled rejection when the host is locking. + void cleanupPromise.catch(() => undefined); + return outstanding.length ? Promise.resolve() : cleanupPromise; + }, +}; + +export const trezorResponseError = ( + response: { payload?: { error?: string; code?: string } }, + prefix = '' +): Error => + Object.assign( + new Error(prefix + (response.payload?.error || 'Trezor request failed')), + { code: response.payload?.code } + ); + +export default TrezorConnect; diff --git a/packages/sysweb3-keyring/src/trezor/index.ts b/packages/sysweb3-keyring/src/trezor/index.ts index 3507ffab..2b471f85 100644 --- a/packages/sysweb3-keyring/src/trezor/index.ts +++ b/packages/sysweb3-keyring/src/trezor/index.ts @@ -1,35 +1,72 @@ /* eslint-disable camelcase */ -import TrezorConnect, { - AccountInfo, - DEVICE_EVENT, - EthereumTransaction, - EthereumTransactionEIP1559, - // @ts-ignore -} from '@trezor/connect-webextension'; -import { address } from '@trezor/utxo-lib'; +import { + TypedDataUtils, + TypedMessage, + SignTypedDataVersion, + TypedDataV1, +} from '@metamask/eth-sig-util'; import bitcoinops from 'bitcoin-ops'; -import { Transaction, payments, script } from 'bitcoinjs-lib'; +import { Psbt } from 'bitcoinjs-lib'; +import bs58check from 'bs58check'; import { Buffer } from 'buffer'; -import { TypedDataUtils, TypedMessage, Version } from 'eth-sig-util'; -import Web3 from 'web3'; +import * as syscoinjs from 'syscoinjs-lib'; +import TrezorConnect, { + subscribeTrezorEvents, + trezorResponseError, +} from './connect'; +import { serializeWitness } from './witness'; import { HardwareWalletManager, HardwareWalletType, } from '../hardware-wallet-manager'; -import { SyscoinHDSigner } from '../signers'; import { getAccountDerivationPath, getAddressDerivationPath, isEvmCoin, } from '../utils/derivation-paths'; -const { p2wsh } = payments; -const { decompile } = script; -const { fromBase58Check, fromBech32 } = address; +import type { + AccountInfo, + CoinSymbol, + EthereumTransaction, + EthereumTransactionEIP1559, +} from '@trezor/connect-webextension'; + +const bitcoinjs: any = (syscoinjs.utils as any).bitcoinjs; +const { p2wsh } = bitcoinjs.payments; +const { decompile } = bitcoinjs.script; +const { fromBech32 } = bitcoinjs.address; +const fromBase58Check = (value: string) => { + try { + return bitcoinjs.address.fromBase58Check(value); + } catch (error) { + // The former decoder also accepted a two-byte network version. Preserve + // exactly that checksum-verified format without loading the legacy fork. + const payload = bs58check.decode(value); + if (payload.length === 22) { + return { + version: (payload[0] << 8) | payload[1], + hash: payload.subarray(2), + }; + } + throw error; + } +}; const initialHDPath = `m/44'/60'/0'/0/0`; const DELAY_BETWEEN_POPUPS = 2000; // Increased from 1000ms to 2000ms for more reliable operation +const stripHexPrefix = (value: string) => + value.startsWith('0x') || value.startsWith('0X') ? value.slice(2) : value; +const finalizedFields = (input: any) => { + if (!input.finalScriptSig && !input.finalScriptWitness) return null; + return { + scriptSig: Buffer.from(input.finalScriptSig || []).toString('hex'), + witness: input.finalScriptWitness + ? Buffer.from(input.finalScriptWitness).toString('hex') + : '00', + }; +}; export interface TrezorControllerState { hdPath: string; @@ -57,52 +94,68 @@ export class TrezorKeyring { public chainCode: Buffer; public paths: Record = {}; public model?: string; - private getSigner: () => { - hd: SyscoinHDSigner; - main: any; - }; private hardwareWalletManager: HardwareWalletManager; private initialized = false; - - constructor( - getSyscoinSigner: () => { - hd: SyscoinHDSigner; - main: any; + private lifecycleGeneration = 0; + private unsubscribeTrezor?: () => void; + private readonly onTrezorConnected = ({ + type, + }: { + type: HardwareWalletType; + }) => { + if (type === HardwareWalletType.TREZOR) { + console.log('Trezor connected'); + this.initialized = true; } - ) { + }; + private readonly onTrezorDisconnected = ({ + type, + }: { + type: HardwareWalletType; + }) => { + if (type === HardwareWalletType.TREZOR) { + console.log('Trezor disconnected'); + this.initialized = false; + } + }; + + constructor() { this.publicKey = Buffer.from('', 'hex'); this.chainCode = Buffer.from('', 'hex'); this.hdPath = ''; this.paths = {}; - this.getSigner = getSyscoinSigner; this.hardwareWalletManager = new HardwareWalletManager(); - // Set up event listeners - this.hardwareWalletManager.on('connected', ({ type }) => { - if (type === HardwareWalletType.TREZOR) { - console.log('Trezor connected'); - this.initialized = true; - } - }); - - this.hardwareWalletManager.on('disconnected', ({ type }) => { - if (type === HardwareWalletType.TREZOR) { - console.log('Trezor disconnected'); - this.initialized = false; - } - }); + this.observeTrezor(); + } - TrezorConnect.on(DEVICE_EVENT, (event: any) => { - if (event.payload.features) { - this.model = event.payload.features.model; - } - }); + private observeTrezor(): void { + // Manager destruction removes its listeners. Reusing an unlocked keyring + // must restore these same callbacks without multiplying them on each init. + if ( + !this.hardwareWalletManager + .listeners('connected') + .includes(this.onTrezorConnected) + ) + this.hardwareWalletManager.on('connected', this.onTrezorConnected); + if ( + !this.hardwareWalletManager + .listeners('disconnected') + .includes(this.onTrezorDisconnected) + ) + this.hardwareWalletManager.on('disconnected', this.onTrezorDisconnected); + if (!this.unsubscribeTrezor) + this.unsubscribeTrezor = subscribeTrezorEvents((event) => { + if (event.type === 'model') this.model = event.model; + }); } /** * Initialize Trezor script. */ public async init(): Promise { + const generation = this.lifecycleGeneration; + this.observeTrezor(); if (this.initialized) { return true; } @@ -110,8 +163,10 @@ export class TrezorKeyring { // Add a small delay to ensure Chrome extension context is ready // This helps prevent "waiting for handshake" errors await new Promise((resolve) => setTimeout(resolve, 100)); + if (generation !== this.lifecycleGeneration) return false; const result = await this.hardwareWalletManager.initializeTrezor(); + if (generation !== this.lifecycleGeneration) return false; if (result) { this.initialized = true; } @@ -144,17 +199,19 @@ export class TrezorKeyring { // Use hardware wallet manager's retry mechanism with custom config return this.hardwareWalletManager .retryOperation(operation, operationName, trezorRetryConfig) - .catch((error) => { + .catch(async (error) => { // Clean up Trezor state on failure + const message = String(error.message || '').toLowerCase(); if ( - error.message?.includes('Popup closed') || - error.message?.includes('cancelled') || - error.message?.includes('denied') + message.includes('popup closed') || + message.includes('cancelled') || + message.includes('canceled') || + message.includes('denied') ) { this.initialized = false; // Dispose Trezor connection to clean up try { - TrezorConnect.dispose(); + await TrezorConnect.dispose(); } catch (disposeError) { console.log('Failed to dispose Trezor on error:', disposeError); } @@ -199,9 +256,7 @@ export class TrezorKeyring { }); if (!addressResponse.success) { - throw new Error( - addressResponse.payload.error || 'Failed to get EVM address' - ); + throw trezorResponseError(addressResponse); } // Return a compatible AccountInfo structure @@ -218,14 +273,14 @@ export class TrezorKeyring { // For UTXO networks, use the standard getAccountInfo const response = await TrezorConnect.getAccountInfo({ - coin, + coin: coin as CoinSymbol, path: this.hdPath, }); if (response.success) { return response.payload; } - throw new Error(response.payload.error); + throw trezorResponseError(response); }, 'getAccountInfo'); } @@ -240,14 +295,17 @@ export class TrezorKeyring { } /** - * This removes the Trezor Connect iframe from the DOM + * This disposes the active Trezor Suite connection * * @returns void */ public dispose() { + this.lifecycleGeneration++; try { - TrezorConnect.dispose(); + void TrezorConnect.dispose().catch((error) => { + console.log('Error disposing Trezor:', error); + }); this.initialized = false; // Clear any cached data this.publicKey = Buffer.from('', 'hex'); @@ -300,7 +358,7 @@ export class TrezorKeyring { if (success) { return { success, payload }; } - throw new Error(payload.error); + throw trezorResponseError({ payload }); }, 'verifyMessage'); } @@ -354,7 +412,7 @@ export class TrezorKeyring { // For UTXO networks, use standard getPublicKey const { success, payload } = await TrezorConnect.getPublicKey({ - coin: coin, + coin: coin as CoinSymbol, path: this.hdPath, }); @@ -389,40 +447,83 @@ export class TrezorKeyring { * @returns signature object */ - public async signUtxoTransaction(utxoTransaction: any, psbt: any) { - return this.executeWithRetry(async () => { - const { payload, success } = await TrezorConnect.signTransaction( - utxoTransaction - ); - - if (success) { - const tx = Transaction.fromHex(payload.serializedTx); - for (const i of this.range(psbt.data.inputs.length)) { - if (tx.ins[i].witness == null) { - throw new Error( - 'Please move your funds to a Segwit address: https://wiki.trezor.io/Account' - ); - } - const partialSig = [ - { - pubkey: tx.ins[i].witness[1], - signature: tx.ins[i].witness[0], - }, - ]; - psbt.updateInput(i, { partialSig }); - } - try { - if (psbt.validateSignaturesOfAllInputs()) { - psbt.finalizeAllInputs(); - } - } catch (err) { - console.log(err); - } - return psbt; - } else { - throw new Error('Trezor sign failed: ' + payload.error); + public async signUtxoTransaction(utxoTransaction: any, psbt: Psbt) { + // Capture approval before the device await. Witnesses and scriptSigs are + // signatures, but every unsigned transaction field must remain identical. + const unsignedSnapshot = (transaction: any): string => + JSON.stringify({ + version: transaction.version, + locktime: transaction.locktime, + inputs: (transaction.txInputs || transaction.ins).map((input: any) => ({ + hash: Buffer.from(input.hash).toString('hex'), + index: input.index, + sequence: input.sequence, + })), + outputs: (transaction.txOutputs || transaction.outs).map( + (output: any) => ({ + script: Buffer.from(output.script).toString('hex'), + value: output.value.toString(), + }) + ), + }); + const approvedTransaction = unsignedSnapshot(psbt); + const approvedFinalInputs = psbt.data.inputs.map(finalizedFields); + const payload = await this.executeWithRetry(async () => { + const response = await TrezorConnect.signTransaction(utxoTransaction); + if (!response.success) { + throw trezorResponseError(response, 'Trezor sign failed: '); } + return response.payload; }, 'signUtxoTransaction'); + + const tx = bitcoinjs.Transaction.fromHex(payload.serializedTx); + if ( + unsignedSnapshot(tx) !== approvedTransaction || + unsignedSnapshot(psbt) !== approvedTransaction + ) { + throw new Error('Trezor returned a different unsigned transaction'); + } + // Finalized inputs belong to another signer. Neither the device response + // nor concurrent code may replace their approved scripts or witnesses. + if ( + approvedFinalInputs.some((approved, index) => { + const current = finalizedFields(psbt.data.inputs[index]); + if (!approved) return current !== null; + return ( + !current || + current.scriptSig !== approved.scriptSig || + current.witness !== approved.witness || + Buffer.from(tx.ins[index].script).toString('hex') !== + approved.scriptSig || + serializeWitness(tx.ins[index].witness || []).toString('hex') !== + approved.witness + ); + }) + ) { + throw new Error('Trezor changed an already-finalized input'); + } + for (const i of this.range(psbt.data.inputs.length)) { + if (approvedFinalInputs[i]) continue; + if (tx.ins[i].witness == null || tx.ins[i].witness.length !== 2) { + throw new Error( + 'Please move your funds to a Segwit address: https://wiki.trezor.io/Account' + ); + } + const partialSig = [ + { + pubkey: tx.ins[i].witness[1], + signature: tx.ins[i].witness[0], + }, + ]; + psbt.updateInput(i, { partialSig }); + } + + try { + syscoinjs.utils.finalizePSBT(psbt); + } catch (err) { + console.log(err); + } + return psbt; } private setHdPath(coin: string, accountIndex: number, slip44: number) { @@ -460,6 +561,18 @@ export class TrezorKeyring { return addressN; } public isScriptHash(address: string, networkInfo: any) { + if (!networkInfo) { + // If network info is not available, make a best guess based on address format + // This is a fallback for hardware wallet scenarios + if (this.isBech32(address)) { + const decoded = fromBech32(address); + return decoded.data.length === 32; // 32 bytes = P2WSH + } + // For non-bech32, we can't reliably determine without network info + // Default to false (P2PKH) as it's more common + return false; + } + if (!this.isBech32(address)) { const decoded = fromBase58Check(address); if (decoded.version === networkInfo.pubKeyHash) { @@ -504,85 +617,205 @@ export class TrezorKeyring { return false; } - public convertToTrezorFormat({ psbt, pathIn, coin }: any) { - const { hd } = this.getSigner(); + public convertToTrezorFormat({ psbt, coin, network }: any) { const trezortx: any = {}; trezortx.coin = coin; trezortx.version = psbt.version; + trezortx.locktime = psbt.locktime; trezortx.inputs = []; trezortx.outputs = []; for (let i = 0; i < psbt.txInputs.length; i++) { - const scriptTypes = psbt.getInputType(i); const input = psbt.txInputs[i]; const inputItem: any = {}; inputItem.prev_index = input.index; - inputItem.prev_hash = input.hash.reverse().toString('hex'); - if (input.sequence) inputItem.sequence = input.sequence; + const hashBuf = Buffer.from(input.hash); + const prevHashHex = hashBuf.reverse().toString('hex'); // 64-char hex + inputItem.prev_hash = prevHashHex; + if (input.sequence !== undefined) inputItem.sequence = input.sequence; + const dataInput = psbt.data.inputs[i]; - let path = ''; - if ( - pathIn || - (dataInput.unknownKeyVals && - dataInput.unknownKeyVals.length > 1 && - dataInput.unknownKeyVals[1].key.equals(Buffer.from('path')) && - (!dataInput.bip32Derivation || - dataInput.bip32Derivation.length === 0)) - ) { - path = pathIn || dataInput.unknownKeyVals[1].value.toString(); - inputItem.address_n = this.convertToAddressNFormat(path); + + if (dataInput.finalScriptSig || dataInput.finalScriptWitness) { + // A finalized co-signer input is supplied as public transaction data, + // never as a private derivation request to this device. + let prevout = dataInput.witnessUtxo; + if (dataInput.nonWitnessUtxo) { + const previous = bitcoinjs.Transaction.fromBuffer( + Buffer.from(dataInput.nonWitnessUtxo) + ); + const output = previous.outs[input.index]; + if ( + !Buffer.from(previous.getHash()).equals(Buffer.from(input.hash)) || + !output || + (prevout && + (!Buffer.from(prevout.script).equals( + Buffer.from(output.script) + ) || + prevout.value.toString() !== output.value.toString())) + ) { + throw new Error('Trezor external input has an invalid prevout'); + } + prevout = output; + } + if (!prevout || prevout.value === undefined || !prevout.script) { + throw new Error('Trezor external input is missing its prevout'); + } + inputItem.script_type = 'EXTERNAL'; + inputItem.amount = prevout.value.toString(); + inputItem.script_pubkey = Buffer.from(prevout.script).toString('hex'); + if (dataInput.finalScriptSig) + inputItem.script_sig = Buffer.from(dataInput.finalScriptSig).toString( + 'hex' + ); + if (dataInput.finalScriptWitness) + inputItem.witness = Buffer.from( + dataInput.finalScriptWitness + ).toString('hex'); + trezortx.inputs.push(inputItem); + continue; } - switch (scriptTypes) { - case 'multisig': - inputItem.script_type = 'SPENDMULTISIG'; - break; - case 'witnesspubkeyhash': - inputItem.script_type = 'SPENDWITNESS'; - break; - default: - inputItem.script_type = this.isP2WSHScript( - psbt.data.inputs[i].witnessUtxo.script - ? psbt.data.inputs[i].witnessUtxo.script - : '' - ) - ? 'SPENDP2SHWITNESS' - : 'SPENDADDRESS'; - break; + + // Resolve derivation path for this input + let resolvedPath: string | null = null; + const tapDer = + dataInput.tapBip32Derivation && dataInput.tapBip32Derivation.length > 0 + ? dataInput.tapBip32Derivation[0] + : null; + const b32Der = + dataInput.bip32Derivation && dataInput.bip32Derivation.length > 0 + ? dataInput.bip32Derivation[0] + : null; + + if (tapDer && tapDer.path) { + resolvedPath = tapDer.path; + } else if (b32Der && b32Der.path) { + resolvedPath = b32Der.path; + } else if (dataInput.unknownKeyVals && dataInput.unknownKeyVals.length) { + for (const kv of dataInput.unknownKeyVals) { + if (Buffer.isBuffer(kv.key) && kv.key.toString() === 'path') { + resolvedPath = kv.value.toString(); + break; + } + } + } + + if (!resolvedPath) { + throw new Error( + 'convertToTrezorFormat: Missing path (tapBip32Derivation/bip32Derivation/unknownKeyVals)' + ); } + + // Map path to Trezor address_n + inputItem.address_n = this.convertToAddressNFormat(resolvedPath); + + // Coerce witnessUtxo.script to Buffer for downstream helpers + const inScriptBuf = + dataInput && dataInput.witnessUtxo && dataInput.witnessUtxo.script + ? Buffer.isBuffer(dataInput.witnessUtxo.script) + ? dataInput.witnessUtxo.script + : Buffer.from(dataInput.witnessUtxo.script) + : Buffer.alloc(0); + + // Select Trezor script_type (detect Taproot explicitly) + const isTaproot = + inScriptBuf && + inScriptBuf.length === 34 && + inScriptBuf[0] === bitcoinops.OP_1 && + inScriptBuf[1] === 0x20; + + if (isTaproot) { + inputItem.script_type = 'SPENDTAPROOT'; + } else { + const scriptTypes = psbt.getInputType(i); + switch (scriptTypes) { + case 'multisig': + inputItem.script_type = 'SPENDMULTISIG'; + break; + case 'witnesspubkeyhash': + inputItem.script_type = 'SPENDWITNESS'; + break; + default: + inputItem.script_type = this.isP2WSHScript(inScriptBuf) + ? 'SPENDP2SHWITNESS' + : 'SPENDADDRESS'; + break; + } + } + trezortx.inputs.push(inputItem); } for (let i = 0; i < psbt.txOutputs.length; i++) { const output = psbt.txOutputs[i]; const outputItem: any = {}; - const chunks = decompile(output.script); - outputItem.amount = output.value.toString(); + const scriptBuf = Buffer.isBuffer(output.script) + ? output.script + : Buffer.from(output.script || []); + const chunks = decompile(scriptBuf); + + // Debug logging to understand the output structure + console.log(`[Trezor] Processing output ${i}:`, { + value: output.value, + valueType: typeof output.value, + hasAddress: !!output.address, + address: output.address, + scriptLength: output.script?.length, + }); + + // Ensure value exists and convert properly + if (output.value === undefined || output.value === null) { + throw new Error(`Output ${i} has no value`); + } + + // Handle different value types + let amountStr: string; + if (typeof output.value === 'bigint') { + amountStr = output.value.toString(); + } else if (typeof output.value === 'number') { + amountStr = output.value.toString(); + } else if (typeof output.value === 'string') { + amountStr = output.value; + } else { + throw new Error( + `Output ${i} has unexpected value type: ${typeof output.value}` + ); + } + + outputItem.amount = amountStr; if (chunks && chunks[0] === bitcoinops.OP_RETURN) { outputItem.script_type = 'PAYTOOPRETURN'; // @ts-ignore - outputItem.op_return_data = chunks[1].toString('hex'); + outputItem.op_return_data = Buffer.from(chunks[1]).toString('hex'); } else { if (output && this.isBech32(output.address)) { - if ( - output.script.length === 34 && - output.script[0] === 0 && - output.script[1] === 0x20 - ) { - outputItem.script_type = 'PAYTOP2SHWITNESS'; - } else { - outputItem.script_type = 'PAYTOWITNESS'; - } + // Any bech32 witness program (P2WPKH or P2WSH) signs as PAYTOWITNESS + outputItem.script_type = 'PAYTOWITNESS'; } else { - outputItem.script_type = this.isScriptHash( - output.address, - hd.Signer.network - ) + outputItem.script_type = this.isScriptHash(output.address, network) ? 'PAYTOSCRIPTHASH' : 'PAYTOADDRESS'; } if (output.address) outputItem.address = output.address; } + + // Validate that the output has required fields for Trezor + if ( + outputItem.script_type === 'PAYTOADDRESS' || + outputItem.script_type === 'PAYTOSCRIPTHASH' || + outputItem.script_type === 'PAYTOWITNESS' + ) { + if (!outputItem.address) { + console.error( + `[Trezor] Output ${i} missing address for script type ${outputItem.script_type}` + ); + throw new Error( + `Output ${i} requires an address for script type ${outputItem.script_type}` + ); + } + } + trezortx.outputs.push(outputItem); } return trezortx; @@ -621,7 +854,7 @@ export class TrezorKeyring { if (response.success) { return response; } - throw new Error(response.payload.error); + throw trezorResponseError(response); }, 'signEthTransaction'); } @@ -671,12 +904,14 @@ export class TrezorKeyring { message?: string; }) { try { + if (typeof message !== 'string') + throw new Error('Message must be a string'); // Use dynamic path generation instead of hardcoded switch this.setHdPath(coin, index || 0, slip44); const { success, payload } = await TrezorConnect.signMessage({ path: this.hdPath, - coin: coin, - message: message, + coin: coin as CoinSymbol, + message, }); if (success) { @@ -701,7 +936,7 @@ export class TrezorKeyring { TrezorConnect.ethereumSignMessage({ path: this.hdPath, - message: Web3.utils.stripHexPrefix(message), + message: stripHexPrefix(message), hex: true, }) .then((response: any) => { @@ -718,12 +953,12 @@ export class TrezorKeyring { } else { reject( // @ts-ignore - new Error(response.payload.error || 'Unknown error') + trezorResponseError(response) ); } }) .catch((e: any) => { - reject(new Error(e.toString() || 'Unknown error')); + reject(e instanceof Error ? e : new Error(String(e))); }); } catch (error) { reject(error); @@ -756,21 +991,15 @@ export class TrezorKeyring { private _transformTypedData = ( data: TypedMessage, - metamask_v4_compat: boolean + version: SignTypedDataVersion ) => { - if (!metamask_v4_compat) { - throw new Error( - 'Trezor: Only version 4 of typed data signing is supported' - ); - } - const { types, primaryType, domain, message } = this._sanitizeData(data); const domainSeparatorHash = TypedDataUtils.hashStruct( 'EIP712Domain', this._sanitizeData(domain), types, - true + version as SignTypedDataVersion.V3 | SignTypedDataVersion.V4 ).toString('hex'); let messageHash: string | null = null; @@ -780,7 +1009,7 @@ export class TrezorKeyring { primaryType as string, this._sanitizeData(message), types, - true + version as SignTypedDataVersion.V3 | SignTypedDataVersion.V4 ).toString('hex'); } @@ -801,9 +1030,9 @@ export class TrezorKeyring { index, }: { address: string; - data: any; + data: TypedMessage | TypedDataV1; index: number; - version: Version; + version: SignTypedDataVersion; }) { return this.executeWithRetry(async () => { // Wait between popups @@ -812,7 +1041,17 @@ export class TrezorKeyring { this.setHdPath('eth', index, 60); // Use dynamic path generation for ETH (EVM) - typed data is only used for EVM - const dataWithHashes = this._transformTypedData(data, version === 'V4'); + // V1 typed data is not supported by hardware wallets + if (version === SignTypedDataVersion.V1) { + throw new Error( + 'Trezor: V1 typed data signing is not supported. Please use V3 or V4.' + ); + } + + const dataWithHashes = this._transformTypedData( + data as TypedMessage, + version + ); // set default values for signTypedData // Trezor is stricter than @metamask/eth-sig-util in what it accepts @@ -840,7 +1079,7 @@ export class TrezorKeyring { domain, primaryType: primaryType as any, }, - metamask_v4_compat: true, + metamask_v4_compat: version === SignTypedDataVersion.V4, // Trezor 1 only supports blindly signing hashes domain_separator_hash, message_hash: message_hash ? message_hash : '', @@ -853,7 +1092,7 @@ export class TrezorKeyring { return response.payload.signature; } // @ts-ignore - throw new Error(response.payload.error || 'Unknown error'); + throw trezorResponseError(response); }, 'signTypedData'); } @@ -881,7 +1120,7 @@ export class TrezorKeyring { try { const { payload, success } = await TrezorConnect.getAddress({ path: fullPath, - coin: currency, + coin: currency as CoinSymbol, showOnTrezor: true, // This displays the address on device for verification }); if (success) { @@ -907,6 +1146,8 @@ export class TrezorKeyring { * Clean up resources */ public async destroy() { + this.unsubscribeTrezor?.(); + this.unsubscribeTrezor = undefined; try { // First dispose Trezor Connect this.dispose(); diff --git a/packages/sysweb3-keyring/src/trezor/witness.ts b/packages/sysweb3-keyring/src/trezor/witness.ts new file mode 100644 index 00000000..227d4be7 --- /dev/null +++ b/packages/sysweb3-keyring/src/trezor/witness.ts @@ -0,0 +1,25 @@ +import { Buffer } from 'buffer'; +import { encode, encodingLength } from 'varuint-bitcoin'; + +/** Canonical Bitcoin witness-vector encoding (CompactSize count and lengths). */ +export const serializeWitness = (witness: readonly Uint8Array[]): Buffer => { + const stack = witness.map((item) => Buffer.from(item)); + const size = + encodingLength(stack.length) + + stack.reduce( + (total, item) => total + encodingLength(item.length) + item.length, + 0 + ); + const result = Buffer.alloc(size); + let offset = 0; + const writeLength = (value: number) => { + offset += encode(value, result, offset).bytes; + }; + writeLength(stack.length); + for (const item of stack) { + writeLength(item.length); + result.set(item, offset); + offset += item.length; + } + return result; +}; diff --git a/packages/sysweb3-keyring/src/types.ts b/packages/sysweb3-keyring/src/types.ts index fa5c8125..cb52b61c 100644 --- a/packages/sysweb3-keyring/src/types.ts +++ b/packages/sysweb3-keyring/src/types.ts @@ -1,61 +1,113 @@ -import { TransactionResponse } from '@ethersproject/abstract-provider'; -import { TypedData, TypedMessage } from 'eth-sig-util'; -import { ethers, BigNumber, BigNumberish } from 'ethers'; -import { CustomJsonRpcProvider, CustomL2JsonRpcProvider } from 'providers'; import { - EncryptedKeystoreV3Json, - Sign, - SignedTransaction, - TransactionConfig, -} from 'web3-core'; + TypedDataV1, + TypedMessage, + SignTypedDataVersion, +} from '@metamask/eth-sig-util'; +import { INetwork, INetworkType } from '@sidhujag/sysweb3-network'; +import { ITxid } from '@sidhujag/sysweb3-utils'; +import { CustomJsonRpcProvider } from 'providers'; +import { + BigNumber, + BigNumberish, + BytesLike, + TransactionResponse, +} from './ethers-v6'; import { LedgerKeyring } from './ledger'; +import { + IDecryptPrivateRecordParams, + IEncryptedPrivateRecord, + IEncryptPrivateRecordParams, +} from './private-records'; import { SyscoinHDSigner } from './signers'; import { TrezorKeyring } from './trezor'; -import { INetwork, INetworkType } from '@pollum-io/sysweb3-network'; -import { ITxid } from '@pollum-io/sysweb3-utils'; - -export interface ISendTransaction { - amount: number; - gasLimit?: number; - gasPrice?: number; - receivingAddress: string; - sender: string; - token?: any; -} + +export type AccessListish = + | Array<{ address: string; storageKeys: string[] }> + | Array<[string, string[]]> + | Record; + export type SimpleTransactionRequest = { - accessList?: ethers.utils.AccessListish; + accessList?: AccessListish; ccipReadEnabled?: boolean; chainId: number; customData?: Record; - data?: ethers.BytesLike; + data?: BytesLike; from: string; - gasLimit?: ethers.BigNumberish; - gasPrice?: ethers.BigNumberish; + gasLimit?: BigNumberish; + gasPrice?: BigNumberish; - maxFeePerGas: ethers.BigNumberish; - maxPriorityFeePerGas: ethers.BigNumberish; + maxFeePerGas: BigNumberish; + maxPriorityFeePerGas: BigNumberish; - nonce?: ethers.BigNumberish; + nonce?: BigNumberish; r?: string; s?: string; to: string; type?: number; v?: string; - value?: ethers.BigNumberish; + value?: BigNumberish; }; -export declare type Version = 'V1' | 'V2' | 'V3' | 'V4'; +export type EvmLocalAccount = { + address: string; + privateKey: string; + publicKey: string; +}; + +export interface IEvmSendOptions { + /** Synchronous host admission, rechecked immediately before signing and broadcast. */ + assertCurrent?: () => void; +} + +export interface IEvmReplacementOptions { + /** Read-only preview; never requests credentials, a device signature or broadcast. */ + previewOnly?: boolean; + /** Required for sending: maximum execution gas fee in decimal wei approved by the user. */ + approvedMaximumFee?: string; + /** Select the locally controlled outer gas payer for a smart-account transaction. */ + targetAccount?: { id: number; type: KeyringAccountType }; + /** Host guard for the current account, network, session and pending original. */ + assertCurrentContext?: () => void; + /** Synchronous original admission; Promise/thenable returns are rejected, never awaited. */ + validateOriginal?: (transaction: TransactionResponse) => void; + beforeBroadcast?: () => void; +} + +export interface IEvmCancellationOptions { + /** Select the locally controlled outer gas payer for a smart-account transaction. */ + targetAccount?: { id: number; type: KeyringAccountType }; + /** Read-only preview; never requests credentials, a device signature or broadcast. */ + previewOnly?: boolean; + /** Required for sending: maximum execution gas fee in decimal wei approved by the user. */ + approvedMaximumFee?: string; + /** Synchronous host guard for selection or session state outside the keyring. */ + assertCurrentContext: () => void; + /** + * Required synchronous host admission for the reviewed pending original. + * Non-null values contain detached, authenticated signed fields. Null means + * the RPC did not find the original: admit it only when the supplied fallbackNonce + * belongs to trusted, still-current local submission data; otherwise throw. + * Invalid non-null RPC replies never become a null/fallback admission. + * Promise/thenable returns are rejected, never awaited. + */ + validateOriginal: (transaction: TransactionResponse | null) => void; +} + +// Version type is now replaced by SignTypedDataVersion from @metamask/eth-sig-util export interface IEthereumTransactions { cancelSentTransaction: ( txHash: string, - isLegacy?: boolean + isLegacy: boolean | undefined, + fallbackNonce: number | undefined, + options: IEvmCancellationOptions ) => Promise<{ error?: boolean; isCanceled: boolean; + maximumFee?: string; transaction?: TransactionResponse; }>; decryptMessage: (msgParams: string[]) => string; @@ -68,21 +120,24 @@ export interface IEthereumTransactions { apiUrl: string ) => Promise; getFeeByType: (type: string) => Promise; - getFeeDataWithDynamicMaxPriorityFeePerGas: () => Promise; + getFeeDataWithDynamicMaxPriorityFeePerGas: ( + provider?: CustomJsonRpcProvider + ) => Promise; getGasLimit: (toAddress: string) => Promise; getGasOracle?: () => Promise; getRecommendedNonce: (address: string) => Promise; signTypedData: ( addr: string, - typedData: TypedData | TypedMessage, - version: Version + typedData: TypedDataV1 | TypedMessage, + version: SignTypedDataVersion ) => Promise; - sendTransaction: (data: ISendTransaction) => Promise; - importAccount: (mnemonicOrPrivKey: string) => ethers.Wallet; + + importAccount: (mnemonicOrPrivKey: string) => EvmLocalAccount; parsePersonalMessage: (hexMsg: string) => string; sendFormattedTransaction: ( params: SimpleTransactionRequest, - isLegacy?: boolean + isLegacy?: boolean, + options?: IEvmSendOptions ) => Promise; sendSignedErc1155Transaction: ({ receiver, @@ -95,7 +150,7 @@ export interface IEthereumTransactions { maxPriorityFeePerGas, }: ISendSignedErcTransactionProps) => Promise; verifyPersonalMessage: (msg: string, sign: string) => string; - toBigNumber: (aBigNumberish: string | number) => ethers.BigNumber; + toBigNumber: (aBigNumberish: string | number) => BigNumber; sendSignedErc20Transaction: ({ networkUrl, receiver, @@ -112,8 +167,10 @@ export interface IEthereumTransactions { sendTransactionWithEditedFee: ( txHash: string, - isLegacy?: boolean + isLegacy?: boolean, + options?: IEvmReplacementOptions ) => Promise<{ + maximumFee?: string; isSpeedUp: boolean; transaction?: TransactionResponse; error?: boolean; @@ -121,10 +178,16 @@ export interface IEthereumTransactions { signPersonalMessage: (params: string[]) => Promise; verifyTypedSignature: ( - data: TypedData | TypedMessage, + data: TypedDataV1 | TypedMessage, signature: string, - version: Version + version: SignTypedDataVersion ) => string; + // HW-agnostic helper: verify and display UTXO address on device + verifyUtxoAddress: ( + accountIndex: number, + currency: string, + slip44: number + ) => Promise; setWeb3Provider: (network: INetwork) => void; getRecommendedGasPrice: (formatted?: boolean) => Promise< | string @@ -133,54 +196,16 @@ export interface IEthereumTransactions { gwei: string; } >; - web3Provider: CustomJsonRpcProvider | CustomL2JsonRpcProvider; - getTxGasLimit: (tx: SimpleTransactionRequest) => Promise; + web3Provider: CustomJsonRpcProvider; + getTxGasLimit: (tx: SimpleTransactionRequest) => Promise; } -/** - * Error structure for Syscoin transaction operations. - * This interface documents the error format that consumers (like Pali) should expect - * when catching errors from ISyscoinTransactions methods. - * - * @example - * try { - * const result = await syscoinTransaction.getEstimateSysTransactionFee({...}); - * } catch (error: unknown) { - * const sysError = error as ISyscoinTransactionError; - * if (sysError.code === 'INSUFFICIENT_FUNDS') { - * console.log(`Short by ${sysError.shortfall} SYS`); - * } - * } - */ -export interface ISyscoinTransactionError { - error: boolean; - code: - | 'INSUFFICIENT_FUNDS' - | 'INVALID_FEE_RATE' - | 'INVALID_AMOUNT' - | 'INVALID_MEMO' - | 'INVALID_BLOB' - | 'INVALID_OUTPUT_COUNT' - | 'INVALID_ASSET_ALLOCATION' - | 'INVALID_PARENT_NODES' - | 'INVALID_TX_VALUE' - | 'INVALID_RECEIPT_VALUE' - | 'SUBTRACT_FEE_FAILED' - | 'TRANSACTION_CREATION_FAILED' - | 'TRANSACTION_SEND_FAILED'; - message: string; - fee?: number; // in SYS (not satoshis) - remainingFee?: number; // in SYS (not satoshis) - shortfall?: number; // in SYS (not satoshis) - details?: { - inputTotal?: any; // BN object in satoshis - outputTotal?: any; // BN object in satoshis - requiredFee?: any; // BN object in satoshis - message?: string; // Additional context about the error - markedOutputs?: number; // For SUBTRACT_FEE_FAILED - removedOutputs?: number; // For SUBTRACT_FEE_FAILED - guid?: string; // For INVALID_ASSET_ALLOCATION - }; +export interface ISyscoinTransactionFeeQuote { + fee: number; + psbt: any; + /** Exact decimal SYS amounts, present only for an explicit native sweep. */ + grossAmount?: string; + recipientAmount?: string; } export interface ISyscoinTransactions { @@ -191,14 +216,20 @@ export interface ISyscoinTransactions { feeRate, token, isMax, + nativeSweep, + excludedOutpoints, }: { - amount: number; + amount: number | string; feeRate?: number; receivingAddress: string; token?: { guid: string; symbol?: string } | null; txOptions?: any; isMax?: boolean | false; - }) => Promise<{ fee: number; psbt: any }>; // Returns UNSIGNED psbt - may throw ISyscoinTransactionError + /** Resolve explicit native MAX from one current funding snapshot. Requires isMax and token:null. */ + nativeSweep?: boolean; + /** Coin-control exclusions supplied by a trusted wallet policy, not transaction outputs. */ + excludedOutpoints?: readonly { txid: string; vout: number }[]; + }) => Promise; // Returns UNSIGNED psbt - may throw ISyscoinTransactionError getRecommendedFee: (explorerUrl: string) => Promise; decodeRawTransaction: (psbtOrHex: any, isRawHex?: boolean) => any; // Sign PSBT separately @@ -207,11 +238,9 @@ export interface ISyscoinTransactions { psbt, isTrezor, isLedger, - pathIn, }: { isLedger?: boolean; isTrezor?: boolean; - pathIn?: string; psbt: any; }) => Promise; } @@ -219,6 +248,9 @@ export interface ISyscoinTransactions { export interface IKeyringManager { // Core keyring functionality addNewAccount: (label?: string) => Promise; + createSmartAccount: ( + params: ICreateSmartAccountParams + ) => Promise; ethereumTransaction: IEthereumTransactions; forgetMainWallet: (pwd: string) => void; getAccountById: ( @@ -250,16 +282,36 @@ export interface IKeyringManager { syscoinTransaction: ISyscoinTransactions; isSeedValid: (seedPhrase: string) => boolean; getSeed: (pwd: string) => Promise; + getPrivateRecordProfileId: () => Promise; + encryptPrivateRecord: ( + params: IEncryptPrivateRecordParams + ) => Promise; + decryptPrivateRecord: ( + params: IDecryptPrivateRecordParams + ) => Promise; + deriveSLHDSASetupSecretForAccount: (params: { + accountIndex: number; + }) => Promise<{ + derivationLabel: string; + setupSecretHex: string; + }>; + decryptSLHDSASessionState: (cipherText: string) => string; + encryptSLHDSASessionState: (plainText: string) => string; importTrezorAccount: (label?: string) => Promise; utf8Error: boolean; validateZprv: ( zprv: string, targetNetwork?: INetwork ) => IValidateZprvResponse; + validateWif: ( + wif: string, + targetNetwork?: INetwork + ) => { isValid: boolean; message?: string }; // Account management importAccount: ( privKey: string, - label?: string + label?: string, + options?: { utxoAddressType?: 'p2wpkh' | 'p2pkh' } ) => Promise; getNewChangeAddress: () => Promise; getChangeAddress: (id: number) => Promise; @@ -271,7 +323,7 @@ export interface IKeyringManager { activeAccountType: KeyringAccountType; }; importWeb3Account: (mnemonicOrPrivKey: string) => any; - createNewSeed: () => string; + createNewSeed: (wordCount?: number) => string; getUTXOState: () => any; importLedgerAccount: ( label?: string @@ -290,7 +342,7 @@ export interface IKeyringManager { createFirstAccount: (label?: string) => Promise; transferSessionTo: (targetKeyring: IKeyringManager) => void; receiveSessionOwnership: (sessionPassword: any, sessionMnemonic: any) => void; - lockWallet: () => void; + lockWallet: () => Promise; // NEW: Store access for stateless keyring setVaultStateGetter: (getter: () => any) => void; } @@ -299,9 +351,41 @@ export enum KeyringAccountType { HDAccount = 'HDAccount', Imported = 'Imported', Ledger = 'Ledger', + SmartAccount = 'SmartAccount', Trezor = 'Trezor', } +export enum PasskeyBackupStatus { + BackupCapable = 'backupCapable', + DeviceBound = 'deviceBound', + Synced = 'synced', + Unavailable = 'unavailable', +} + +export interface IPasskeyCredentialProfile { + backupStatus?: PasskeyBackupStatus; + credentialId: string; + credentialIdHash: string; + passkeyName: string; + publicKey: { + originHash: string; + originLength: number; + rpIdHash: string; + x: string; + y: string; + }; +} + +export interface ICreateSmartAccountParams { + address?: string; + deriveAccount?: (accountIndex: number) => Promise<{ + address: string; + metadata: TSmartAccountMetadata; + }>; + label?: string; + metadata?: TSmartAccountMetadata; +} + export type IKeyringDApp = { active: boolean; id: number; @@ -317,15 +401,6 @@ export type IKeyringBalances = { [INetworkType.Ethereum]: number; }; -export interface IWeb3Account extends IKeyringAccountState { - encrypt: (password: string) => EncryptedKeystoreV3Json; - sign: (data: string) => Sign; - signTransaction: ( - transactionConfig: TransactionConfig, - callback?: (signTransaction: SignedTransaction) => void - ) => Promise; -} - interface INetworkParams { bech32: string; bip32: { @@ -346,14 +421,16 @@ interface IValidateZprvResponse { node?: any; } -export interface IKeyringAccountState { +export interface IKeyringAccountState { address: string; balances: IKeyringBalances; id: number; isImported: boolean; isLedgerWallet: boolean; + isSmartAccount?: boolean; isTrezorWallet: boolean; label: string; + smartAccount?: TSmartAccountMetadata; xprv: string; xpub: string; } @@ -392,7 +469,7 @@ export interface ISendSignedErcTransactionProps { saveTrezorTx?: (tx: any) => void; tokenAddress: string; tokenAmount?: string; - tokenId?: number; + tokenId?: bigint | number | string; } export interface IResponseFromSendErcSignedTransaction { diff --git a/packages/sysweb3-keyring/src/utils.ts b/packages/sysweb3-keyring/src/utils.ts index df9da4d9..768a56d0 100644 --- a/packages/sysweb3-keyring/src/utils.ts +++ b/packages/sysweb3-keyring/src/utils.ts @@ -1,5 +1,28 @@ -import { logger } from 'ethers'; -import { Logger, isHexString } from 'ethers/lib/utils'; +import { isHexString } from './ethers-v6'; + +const Logger = { + errors: { + CALL_EXCEPTION: 'CALL_EXCEPTION', + INSUFFICIENT_FUNDS: 'INSUFFICIENT_FUNDS', + NONCE_EXPIRED: 'NONCE_EXPIRED', + REPLACEMENT_UNDERPRICED: 'REPLACEMENT_UNDERPRICED', + SERVER_ERROR: 'SERVER_ERROR', + UNPREDICTABLE_GAS_LIMIT: 'UNPREDICTABLE_GAS_LIMIT', + UNSUPPORTED_OPERATION: 'UNSUPPORTED_OPERATION', + }, +}; + +const logger = { + throwError(message: string, code: string, info?: Record): never { + const err = new Error(message) as Error & { + code?: string; + [key: string]: any; + }; + err.code = code; + if (info) Object.assign(err, info); + throw err; + }, +}; const errorGas = ['call', 'estimateGas']; diff --git a/packages/sysweb3-keyring/src/utils/blockbook-cache.ts b/packages/sysweb3-keyring/src/utils/blockbook-cache.ts new file mode 100644 index 00000000..93cf9677 --- /dev/null +++ b/packages/sysweb3-keyring/src/utils/blockbook-cache.ts @@ -0,0 +1,75 @@ +import * as syscoinjs from 'syscoinjs-lib'; + +/** + * In-flight deduplication for Blockbook xpub account fetches used internally + * by the keyring (address-index discovery and PSBT path enrichment, both + * `tokens=used&details=tokens`). + * + * During a send flow several callers (fee estimation, PSBT creation, signing) + * can request the same account data concurrently; collapsing them into a + * single request removes redundant Blockbook round trips. + * + * Deliberately NOT a TTL cache: address/pubkey/path derivation must always + * see fresh indexes, so once a request settles the next caller refetches. + */ + +interface ICacheEntry { + promise: Promise; +} + +const inflightFetches = new Map(); + +const buildKey = (backendUrl: string, xpub: string, options: string) => + `${backendUrl}::${xpub}::${options}`; + +export const fetchBackendAccountCached = ( + backendUrl: string, + xpub: string, + options: string +): Promise => { + const key = buildKey(backendUrl, xpub, options); + + const inflight = inflightFetches.get(key); + if (inflight) { + return inflight.promise; + } + + const promise = Promise.resolve( + (syscoinjs.utils as any).fetchBackendAccount( + backendUrl, + xpub, + options, + true + ) + ); + + inflightFetches.set(key, { promise }); + + // Drop the entry as soon as the request settles so subsequent + // callers always fetch fresh data + const dropEntry = () => { + const entry = inflightFetches.get(key); + if (entry && entry.promise === promise) { + inflightFetches.delete(key); + } + }; + promise.then(dropEntry, dropEntry); + + return promise; +}; + +/** + * Drop in-flight account fetches. Without arguments clears everything; + * with an xpub only that account's entries are dropped (any backend). + */ +export const invalidateBlockbookAccountCache = (xpub?: string) => { + if (!xpub) { + inflightFetches.clear(); + return; + } + for (const key of Array.from(inflightFetches.keys())) { + if (key.includes(`::${xpub}::`)) { + inflightFetches.delete(key); + } + } +}; diff --git a/packages/sysweb3-keyring/src/utils/derivation-paths.ts b/packages/sysweb3-keyring/src/utils/derivation-paths.ts index 35eec8bf..4dd68a76 100644 --- a/packages/sysweb3-keyring/src/utils/derivation-paths.ts +++ b/packages/sysweb3-keyring/src/utils/derivation-paths.ts @@ -1,5 +1,5 @@ // Import coins data from the relative package in the monorepo -import { findCoin } from '@pollum-io/sysweb3-network'; +import { findCoin } from '@sidhujag/sysweb3-network'; /** * Get coin information by coin shortcut or slip44 @@ -109,3 +109,25 @@ export function getAddressDerivationPath( return `m/${bip}'/${slip44}'/${accountIndex}'/${changeValue}/${addressIndex}`; } } + +/** + * Convert an extended key's version bytes to a target version (e.g., xpub->zpub or tpub->vpub) + * - Pass targetVersionHex as a 4-byte hex string (e.g., '04b24746' for zpub, '045f1cf6' for vpub) + */ +export function convertExtendedKeyVersion( + extendedKey: string, + targetVersionHex: string +): string { + try { + // Lazy import to avoid bundling when unused + /* eslint-disable @typescript-eslint/no-var-requires */ + const bs58check = require('bs58check'); + const decoded: Buffer = Buffer.from(bs58check.decode(extendedKey)); + const target = Buffer.from(targetVersionHex, 'hex'); + target.copy(decoded, 0, 0, 4); + return bs58check.encode(decoded); + } catch (e) { + // If conversion fails, return original key + return extendedKey; + } +} diff --git a/packages/sysweb3-keyring/src/utils/excluded-utxos.ts b/packages/sysweb3-keyring/src/utils/excluded-utxos.ts new file mode 100644 index 00000000..31891366 --- /dev/null +++ b/packages/sysweb3-keyring/src/utils/excluded-utxos.ts @@ -0,0 +1,77 @@ +export interface ExcludedOutpoint { + txid: string; + vout: number; +} + +const invalid = () => + Object.assign(new Error('Invalid protected UTXO selection.'), { + error: true, + code: 'INVALID_EXCLUDED_UTXOS', + }); + +export const excludedOutpointIds = ( + outpoints: readonly ExcludedOutpoint[] = [] +): Set => { + if (!Array.isArray(outpoints) || outpoints.length > 1000) throw invalid(); + return new Set( + outpoints.map((entry) => { + if ( + !entry || + typeof entry.txid !== 'string' || + !/^[0-9a-fA-F]{64}$/.test(entry.txid) || + !Number.isSafeInteger(entry.vout) || + entry.vout < 0 || + entry.vout > 0xffffffff + ) + throw invalid(); + return `${entry.txid.toLowerCase()}:${entry.vout}`; + }) + ); +}; + +/** Preserve the backend's asset metadata while removing only reserved outputs. */ +export const filterExcludedUtxos = ( + raw: any, + excluded: ReadonlySet +) => { + const rows = Array.isArray(raw) ? raw : raw?.utxos; + if (!Array.isArray(rows)) throw invalid(); + const utxos = rows.filter((row) => { + const txid = row?.txId ?? row?.txid; + if ( + typeof txid !== 'string' || + !/^[0-9a-fA-F]{64}$/.test(txid) || + !Number.isSafeInteger(row.vout) || + row.vout < 0 || + row.vout > 0xffffffff || + (row.txId !== undefined && + row.txid !== undefined && + (typeof row.txId !== 'string' || + typeof row.txid !== 'string' || + row.txId.toLowerCase() !== row.txid.toLowerCase())) + ) + throw invalid(); + return !excluded.has(`${txid.toLowerCase()}:${row.vout}`); + }); + return Array.isArray(raw) ? { utxos } : { ...raw, utxos }; +}; + +export const assertNoExcludedInputs = ( + psbt: { txInputs: { hash: Uint8Array; index: number }[] }, + excluded: ReadonlySet +) => { + if (!Array.isArray(psbt?.txInputs)) throw invalid(); + for (const input of psbt.txInputs) { + const id = `${Buffer.from(input.hash).reverse().toString('hex')}:${ + input.index + }`; + if (excluded.has(id)) + throw Object.assign( + new Error('This transaction would spend protected collateral.'), + { + error: true, + code: 'PROTECTED_COLLATERAL', + } + ); + } +}; diff --git a/packages/sysweb3-keyring/src/utils/psbt-account-scope.ts b/packages/sysweb3-keyring/src/utils/psbt-account-scope.ts new file mode 100644 index 00000000..a1df4e40 --- /dev/null +++ b/packages/sysweb3-keyring/src/utils/psbt-account-scope.ts @@ -0,0 +1,353 @@ +import * as ecc from '@bitcoinerlab/secp256k1'; +import { getNetworkConfig, INetwork } from '@sidhujag/sysweb3-network'; +import { BIP32Factory } from 'bip32'; +import { address, networks, payments, Psbt, Transaction } from 'bitcoinjs-lib'; + +import { KeyringAccountType } from '../types'; +import { getAccountDerivationPath } from './derivation-paths'; + +const bip32 = BIP32Factory(ecc); +const SCOPE_ERROR = 'PSBT input is outside the approved account'; +const fail = (): never => { + throw new Error(SCOPE_ERROR); +}; +const clearSigningHints = (input: Psbt['data']['inputs'][number]) => { + delete input.bip32Derivation; + delete input.tapBip32Derivation; + input.unknownKeyVals = (input.unknownKeyVals || []).filter( + (field) => Buffer.from(field.key).toString() !== 'path' + ); +}; +const equal = (a?: Uint8Array, b?: Uint8Array) => + Boolean(a && b && Buffer.from(a).equals(Buffer.from(b))); +const childIndex = (value: string): number => { + if (!/^(0|[1-9][0-9]*)$/.test(value)) return fail(); + const index = Number(value); + if (!Number.isSafeInteger(index) || index >= 0x80000000) return fail(); + return index; +}; +export const parsePsbtAccountXpub = (xpub: string) => { + // Account keys use coin-specific xpub/zpub/vpub version bytes. Preserve the + // checked public payload instead of guessing its network from that prefix. + const codec = require('bs58check'); + const payload = Buffer.from((codec.default || codec).decode(xpub)); + if (payload.length !== 78 || (payload[45] !== 2 && payload[45] !== 3)) + return fail(); + return bip32.fromBase58(xpub, { + ...networks.bitcoin, + bip32: { public: payload.readUInt32BE(0), private: 0x0488ade4 }, + }); +}; + +export type PsbtAccountScope = { + account: { address: string; xpub: string }; + accountId: number; + accountType: KeyringAccountType; + network: INetwork; +}; + +export function createPsbtDerivationGuard( + scope: PsbtAccountScope +): (path: string) => string { + const { account, accountId, accountType, network } = scope; + const node = parsePsbtAccountXpub(account.xpub); + const prefix = + accountType === KeyringAccountType.HDAccount + ? `m/84'/${network.slip44}'/${accountId}'` + : getAccountDerivationPath( + network.currency, + network.slip44, + accountType === KeyringAccountType.Imported && node.depth === 3 + ? node.index & 0x7fffffff + : accountId + ); + return (path) => { + let relative = path; + if (relative.startsWith(`${prefix}/`)) + relative = relative.slice(prefix.length + 1); + else if ( + relative.startsWith('m/') || + accountType !== KeyringAccountType.Imported + ) + return fail(); + const parts = relative.split('/'); + if (parts.length !== 2) return fail(); + if (![0, 1].includes(childIndex(parts[0]))) return fail(); + childIndex(parts[1]); + return relative; + }; +} + +/** Verify key ownership from public derivation and the actual spent script. + * Proprietary address metadata is deliberately never an authority here. + */ +export function assertPsbtAccountScope( + psbt: Psbt, + scope: PsbtAccountScope +): void { + const { account, accountType, network } = scope; + const config = getNetworkConfig(network.slip44, network.currency); + const bitcoinNetwork = + network.slip44 === 1 ? config.networks.testnet : config.networks.mainnet; + const singleAddress = + accountType === KeyringAccountType.Imported && + account.xpub === account.address; + const node = singleAddress ? undefined : parsePsbtAccountXpub(account.xpub); + const guardPath = singleAddress + ? undefined + : createPsbtDerivationGuard(scope); + if (!singleAddress && !node?.isNeutered()) return fail(); + if (!Array.isArray(psbt.data?.inputs) || psbt.data.inputs.length === 0) + return fail(); + const derivedKeys = new Map< + string, + { publicKey: Uint8Array; scripts: Array } + >(); + + let ownedInputs = 0; + let hasUnfinishedInputs = false; + psbt.data.inputs.forEach((input, inputIndex) => { + // Finalized co-signer inputs may remain in a PSBT. Remove signing hints so + // even a permissive underlying signer cannot add another signature there. + if (input.finalScriptSig || input.finalScriptWitness) { + clearSigningHints(input); + return; + } + hasUnfinishedInputs = true; + const txInput = psbt.txInputs[inputIndex]; + let spent = input.witnessUtxo; + if (input.nonWitnessUtxo) { + const previous = Transaction.fromBuffer(input.nonWitnessUtxo); + if (!equal(previous.getHash(), txInput.hash)) return fail(); + const output = previous.outs[txInput.index]; + if ( + !output || + (spent && + (!equal(output.script, spent.script) || output.value !== spent.value)) + ) + return fail(); + spent = output; + } + if (!spent) return fail(); + try { + let multisigKeys: Uint8Array[] | undefined; + const multisigScript = input.witnessScript || input.redeemScript; + if (multisigScript) { + try { + // Only standard multisig is supported here. The scripts, not the + // cosigners' supplied derivation metadata, authenticate membership. + const multisig = payments.p2ms({ + output: multisigScript, + network: bitcoinNetwork, + }); + if (!multisig.pubkeys?.length) return fail(); + if (input.witnessScript) { + const witness = payments.p2wsh({ + redeem: multisig, + network: bitcoinNetwork, + }); + if ( + input.redeemScript && + !equal(input.redeemScript, witness.output) + ) + return fail(); + const output = input.redeemScript + ? payments.p2sh({ redeem: witness, network: bitcoinNetwork }) + .output + : witness.output; + if (!equal(output, spent.script)) return fail(); + } else if ( + !equal( + payments.p2sh({ redeem: multisig, network: bitcoinNetwork }) + .output, + spent.script + ) + ) { + // Nested single-key P2WPKH is validated below, not as multisig. + return fail(); + } + multisigKeys = multisig.pubkeys; + } catch { + // A wrapped single-key input has a redeemScript but no multisig. + // Its normal derived-key output check below still authenticates it. + if (input.witnessScript) return fail(); + } + } + if (singleAddress) { + const approvedScript = address.toOutputScript( + account.address, + bitcoinNetwork + ); + if (multisigKeys) { + const ownsKey = multisigKeys.some((pubkey) => { + const witness = payments.p2wpkh({ + pubkey, + network: bitcoinNetwork, + }); + return [ + payments.p2pkh({ pubkey, network: bitcoinNetwork }).output, + witness.output, + payments.p2sh({ redeem: witness, network: bitcoinNetwork }) + .output, + ].some((output) => equal(output, approvedScript)); + }); + if (!ownsKey) return fail(); + delete input.bip32Derivation; + delete input.tapBip32Derivation; + input.unknownKeyVals = (input.unknownKeyVals || []).filter( + (field) => Buffer.from(field.key).toString() !== 'path' + ); + } else if (!equal(spent.script, approvedScript)) return fail(); + ownedInputs += 1; + return; + } + + const derivations = [ + ...(input.bip32Derivation || []), + ...(input.tapBip32Derivation || []), + ]; + const paths: Array<{ + path: string; + pubkey?: Uint8Array; + source: object; + }> = derivations.map((derivation) => ({ + path: derivation.path, + pubkey: derivation.pubkey, + source: derivation, + })); + for (const field of input.unknownKeyVals || []) { + if (Buffer.from(field.key).toString() === 'path') + paths.push({ + path: Buffer.from(field.value).toString(), + pubkey: undefined, + source: field, + }); + } + if (!paths.length) return fail(); + const approvedHints = new Set(); + for (const candidate of paths) { + let relative: string; + try { + relative = guardPath!(candidate.path); + } catch (error) { + if (multisigKeys) continue; + throw error; + } + const parts = relative.split('/'); + if (parts.length !== 2) return fail(); + const branch = childIndex(parts[0]); + const index = childIndex(parts[1]); + if (branch !== 0 && branch !== 1) return fail(); + let derived = derivedKeys.get(relative); + if (!derived) { + const publicKey = node!.derive(branch).derive(index).publicKey; + const p2pkh = payments.p2pkh({ + pubkey: publicKey, + network: bitcoinNetwork, + }); + const p2wpkh = payments.p2wpkh({ + pubkey: publicKey, + network: bitcoinNetwork, + }); + const p2sh = payments.p2sh({ + redeem: p2wpkh, + network: bitcoinNetwork, + }); + derived = { + publicKey, + scripts: [p2pkh.output, p2wpkh.output, p2sh.output], + }; + derivedKeys.set(relative, derived); + } + const { publicKey } = derived; + if ( + candidate.pubkey && + !equal(candidate.pubkey, publicKey) && + !equal(candidate.pubkey, publicKey.slice(1)) + ) { + if (multisigKeys) continue; + return fail(); + } + if (multisigKeys) { + if (!multisigKeys.some((key) => equal(key, publicKey))) continue; + approvedHints.add(candidate.source); + continue; + } + const ordinary = derived.scripts.some((script) => + equal(script, spent!.script) + ); + let taproot = false; + // Key-path signing can reconstruct an omitted internal key from this + // approved derivation. Commit any supplied Merkle root when checking + // the output, but do not infer script-path keys or accept a conflicting + // explicit internal key. + if ( + input.tapInternalKey === undefined + ? !ordinary && + !input.tapLeafScript?.length && + !input.tapScriptSig?.length && + !input.tapBip32Derivation?.some( + (derivation) => derivation.leafHashes.length > 0 + ) + : equal(input.tapInternalKey, publicKey.slice(1)) + ) { + const p2tr = payments.p2tr({ + internalPubkey: publicKey.slice(1), + hash: input.tapMerkleRoot, + network: bitcoinNetwork, + }); + taproot = equal(p2tr.output, spent.script); + } + if (!ordinary && !taproot) return fail(); + } + if (multisigKeys) { + if (!approvedHints.size) return fail(); + // Keep cosigner signatures, but expose only the approved account's paths + // to the underlying signer, including its full-root HD fallback. + if (input.bip32Derivation) + input.bip32Derivation = input.bip32Derivation.filter((value) => + approvedHints.has(value) + ); + if (input.tapBip32Derivation) + input.tapBip32Derivation = input.tapBip32Derivation.filter((value) => + approvedHints.has(value) + ); + if (input.unknownKeyVals) + input.unknownKeyVals = input.unknownKeyVals.filter( + (field) => + Buffer.from(field.key).toString() !== 'path' || + approvedHints.has(field) + ); + } + ownedInputs += 1; + } catch (error) { + if ( + singleAddress || + !(error instanceof Error) || + error.message !== SCOPE_ERROR + ) + throw error; + // A joint PSBT may include inputs for another signer. Hide every HD + // hint before our private signer runs; even another account in this + // wallet must remain unsigned. The public API restores metadata later. + clearSigningHints(input); + } + }); + if (hasUnfinishedInputs && ownedInputs === 0) return fail(); + // An imported extended key is already the account node, so the signer must + // receive only the validated relative children, never another full root path. + if (accountType === KeyringAccountType.Imported && !singleAddress) { + for (const input of psbt.data.inputs) { + for (const derivation of [ + ...(input.bip32Derivation || []), + ...(input.tapBip32Derivation || []), + ]) + derivation.path = guardPath!(derivation.path); + for (const field of input.unknownKeyVals || []) + if (Buffer.from(field.key).toString() === 'path') + field.value = Buffer.from( + guardPath!(Buffer.from(field.value).toString()) + ); + } + } +} diff --git a/packages/sysweb3-keyring/src/utils/psbt.ts b/packages/sysweb3-keyring/src/utils/psbt.ts index cbda296f..03b03ec9 100644 --- a/packages/sysweb3-keyring/src/utils/psbt.ts +++ b/packages/sysweb3-keyring/src/utils/psbt.ts @@ -1,3 +1,4 @@ +import { getNetworkConfig } from '@sidhujag/sysweb3-network'; import * as syscoinjs from 'syscoinjs-lib'; /** @@ -7,10 +8,18 @@ export class PsbtUtils { /** * Import PSBT from Pali's exported format to syscoinjs PSBT object * @param psbtFromPali - PSBT data exported from Pali + * @param network - Optional bitcoinjs network to anchor address/HRP * @returns syscoinjs PSBT object */ - static fromPali(psbtFromPali: any): any { - return syscoinjs.utils.importPsbtFromJson(psbtFromPali).psbt; + static fromPali(psbtFromPali: any, network: any): any { + // Anchor import to the correct bitcoinjs network to preserve address HRP + const networkCfg = getNetworkConfig(network.slip44, network.currency); + const isTestnet = network.slip44 === 1; + const bitcoinjsNetwork = isTestnet + ? networkCfg.networks.testnet + : networkCfg.networks.mainnet; + return syscoinjs.utils.importPsbtFromJson(psbtFromPali, bitcoinjsNetwork) + .psbt; } /** diff --git a/packages/sysweb3-keyring/src/utils/watch-descriptor.ts b/packages/sysweb3-keyring/src/utils/watch-descriptor.ts new file mode 100644 index 00000000..32af13f6 --- /dev/null +++ b/packages/sysweb3-keyring/src/utils/watch-descriptor.ts @@ -0,0 +1,164 @@ +import ecc from '@bitcoinerlab/secp256k1'; +import { + findCoin, + getNetworkConfig, + INetwork, + INetworkType, +} from '@sidhujag/sysweb3-network'; +import { BIP32Factory } from 'bip32'; +import bs58check from 'bs58check'; +import { utils as syscoinUtils } from 'syscoinjs-lib'; + +const bip32 = BIP32Factory(ecc); +const bitcoin = syscoinUtils.bitcoinjs; +const invalid = (): never => { + throw new Error('Unsupported or invalid public watch-only descriptor'); +}; +const childIndex = (value: number): number => { + if (!Number.isInteger(value) || value < 0 || value >= 0x80000000) + return invalid(); + return value; +}; + +// Bitcoin Core's descriptor checksum, also used by Pali's public-input guard. +export const descriptorChecksum = (value: string): string => { + const input = + '0123456789()[],\'/*abcdefgh@:$%{}IJKLMNOPQRSTUVWXYZ&+-.;<=>?!^_|~ijklmnopqrstuvwxyzABCDEFGH`#"\\ '; + const output = 'qpzry9x8gf2tvdw0s3jn54khce6mua7l'; + const generators = [ + 'f5dee51989', + 'a9fdca3312', + '1bab10e32d', + '3706b1677a', + '644d626ffd', + ].map((hex) => BigInt(`0x${hex}`)); + const poly = (current: bigint, next: number) => { + const top = current >> BigInt(35); + let result = + ((current & BigInt('0x7ffffffff')) << BigInt(5)) ^ BigInt(next); + generators.forEach((generator, index) => { + if ((top & (BigInt(1) << BigInt(index))) !== BigInt(0)) + result ^= generator; + }); + return result; + }; + let checksum = BigInt(1), + group = 0, + count = 0; + for (const character of value) { + const position = input.indexOf(character); + if (position < 0) return ''; + checksum = poly(checksum, position & 31); + group = group * 3 + (position >> 5); + if (++count === 3) { + checksum = poly(checksum, group); + group = count = 0; + } + } + if (count) checksum = poly(checksum, group); + for (let index = 0; index < 8; index++) checksum = poly(checksum, 0); + checksum ^= BigInt(1); + return Array.from( + { length: 8 }, + (_, index) => + output[Number((checksum >> BigInt(5 * (7 - index))) & BigInt(31))] + ).join(''); +}; + +/** Derive only the single-key public descriptor forms supported by Blockbook. */ +export const deriveDescriptorAddress = ( + descriptor: string, + network: INetwork, + options?: { change?: boolean; index?: number } +): string => { + if ( + typeof descriptor !== 'string' || + !descriptor || + descriptor.length > 16384 || + /\s/.test(descriptor) || + (options?.change !== undefined && typeof options.change !== 'boolean') + ) + return invalid(); + const parts = descriptor.split('#'); + if ( + parts.length > 2 || + (parts.length === 2 && descriptorChecksum(parts[0]) !== parts[1]) + ) + return invalid(); + + const simple = /^(pkh|wpkh|tr)\(([^()]*)\)$/.exec(parts[0]); + const wrapped = /^sh\(wpkh\(([^()]*)\)\)$/.exec(parts[0]); + if (!simple && !wrapped) return invalid(); + const type = simple?.[1] || 'sh(wpkh)'; + const key = simple?.[2] || wrapped?.[1] || ''; + const parsed = + /^(?:\[([\da-fA-F]{8})\/(\d+)['h]\/(\d+)['h]?\/(\d+)['h]?\])?([1-9A-HJ-NP-Za-km-z]{100,112})(?:\/(\d+|\{\d+(?:,\d+)*\}|<\d+(?:;\d+)*>)\/\*)?$/.exec( + key + ); + if (!parsed) return invalid(); + if (parsed[1]) + parsed.slice(2, 5).forEach((value) => childIndex(Number(value))); + const branches = parsed[6] + ? parsed[6] + .replace(/[{}<>]/g, '') + .split(/[,;]/) + .map((value) => childIndex(Number(value))) + : [0, 1]; + if (branches.length > 10) return invalid(); + const branch = branches[options?.change ? 1 : 0]; + if (branch === undefined) return invalid(); + const index = childIndex(options?.index === undefined ? 0 : options.index); + + if (!network || network.kind !== INetworkType.Syscoin) return invalid(); + const coin = findCoin({ + slip44: network.slip44, + name: network.currency, + exactMatch: true, + }); + if ( + !coin || + (type !== 'pkh' && coin.segwit !== true) || + (type === 'tr' && coin.taproot !== true) + ) + return invalid(); + const config = getNetworkConfig(network.slip44, network.currency); + const addressNetwork = + network.slip44 === 1 ? config.networks.testnet : config.networks.mainnet; + + const payload = Buffer.from(bs58check.decode(parsed[5])); + if (payload.length !== 78 || ![2, 3].includes(payload[45])) return invalid(); + const root = bip32.fromBase58(parsed[5], { + ...addressNetwork, + bip32: { public: payload.readUInt32BE(0), private: 0x0488ade4 }, + }); + if (!root.isNeutered()) return invalid(); + const branchNode = root.derive(branch); + const addressNode = branchNode.derive(index); + // Do not let BIP32's invalid-child retry silently select a different path. + if (branchNode.index !== branch || addressNode.index !== index) + return invalid(); + const pubkey = addressNode.publicKey; + const payment = + type === 'pkh' + ? bitcoin.payments.p2pkh({ pubkey, network: addressNetwork }) + : type === 'wpkh' + ? bitcoin.payments.p2wpkh({ pubkey, network: addressNetwork }) + : type === 'tr' + ? bitcoin.payments.p2tr({ + internalPubkey: pubkey.slice(1), + network: addressNetwork, + }) + : bitcoin.payments.p2sh({ + redeem: bitcoin.payments.p2wpkh({ pubkey, network: addressNetwork }), + network: addressNetwork, + }); + if ( + !payment.address || + !payment.output || + !Buffer.from( + bitcoin.address.toOutputScript(payment.address, addressNetwork) + ).equals(Buffer.from(payment.output)) + ) + return invalid(); + return payment.address; +}; diff --git a/packages/sysweb3-keyring/test/__mocks__/trezor-mock.js b/packages/sysweb3-keyring/test/__mocks__/trezor-mock.js index 2d38a681..c50c4074 100644 --- a/packages/sysweb3-keyring/test/__mocks__/trezor-mock.js +++ b/packages/sysweb3-keyring/test/__mocks__/trezor-mock.js @@ -1,7 +1,9 @@ // Mock for TrezorConnect +// Define a complete mock to prevent "main.send is not a function" errors const TrezorConnect = { - manifest: () => {}, - init: () => Promise.resolve({ success: true }), + manifest: jest.fn(), + cancel: jest.fn(), + init: jest.fn(() => Promise.resolve({ success: true })), getDeviceId: () => Promise.resolve({ success: true, payload: { deviceId: 'mock-device-id' } }), getPublicKey: () => @@ -18,11 +20,27 @@ const TrezorConnect = { success: true, payload: { address: '0x1234567890123456789012345678901234567890' }, }), + getAddress: () => + Promise.resolve({ + success: true, + payload: { + address: 'sys1qmock_trezor_verified_address', + path: "m/44'/57'/0'/0/0", + }, + }), signTransaction: () => Promise.resolve({ success: true, payload: { signedTransaction: '0xsigned' }, }), + ethereumSignTypedData: () => + Promise.resolve({ + success: true, + payload: { + signature: '0xmocked_typed_data_signature', + address: '0x1234567890123456789012345678901234567890', + }, + }), getAccountInfo: () => Promise.resolve({ success: true, @@ -39,9 +57,10 @@ const TrezorConnect = { }, }, }), - on: () => {}, - off: () => {}, - removeAllListeners: () => {}, + on: jest.fn(), + off: jest.fn(), + removeAllListeners: jest.fn(), + dispose: jest.fn(() => Promise.resolve()), DEVICE_EVENT: 'DEVICE_EVENT', DEVICE: { CONNECT: 'device-connect', @@ -55,3 +74,10 @@ const TrezorConnect = { module.exports = TrezorConnect; module.exports.default = TrezorConnect; + +module.exports.subscribeTrezorEvents = jest.fn(() => () => {}); +module.exports.trezorResponseError = (response, prefix = '') => + Object.assign( + new Error(prefix + (response.payload?.error || 'Trezor request failed')), + { code: response.payload?.code } + ); diff --git a/packages/sysweb3-keyring/test/bip84-native-runtime.cjs b/packages/sysweb3-keyring/test/bip84-native-runtime.cjs new file mode 100644 index 00000000..c2513fc6 --- /dev/null +++ b/packages/sysweb3-keyring/test/bip84-native-runtime.cjs @@ -0,0 +1,106 @@ +/* Plain-Node check for the compiled or unpacked public-only entry. */ +'use strict'; +const assert = require('node:assert/strict'); +const path = require('node:path'); +const Module = require('node:module'); +const crypto = require('node:crypto'); +const entry = path.resolve( + process.argv[2] || path.join(__dirname, '../dist/cjs/bip84-native.js') +); +const originalLoad = Module._load; +const originals = []; +const forbid = () => { + throw new Error('Public derivation attempted a host or authority operation'); +}; +const replace = (object, key) => { + const descriptor = Object.getOwnPropertyDescriptor(object, key); + Object.defineProperty(object, key, { configurable: true, value: forbid }); + originals.push(() => + descriptor + ? Object.defineProperty(object, key, descriptor) + : delete object[key] + ); +}; +const forbidden = + /(?:^@(?:ledgerhq|trezor|sidhujag)\/|^syscoinjs-lib$|(?:^|[/\\])(?:storage(?:-core)?|software|providers?|keyring-(?:core|manager)|hardware-wallet-manager)(?:[/\\.]|$)|^(?:node:)?(?:https?|net|tls|fs)(?:\/|$))/; +try { + for (const key of ['fetch', 'setTimeout', 'setInterval']) + replace(global, key); + for (const key of ['window', 'chrome', 'document', 'self', 'localStorage']) { + const descriptor = Object.getOwnPropertyDescriptor(global, key); + Object.defineProperty(global, key, { configurable: true, get: forbid }); + originals.push(() => + descriptor + ? Object.defineProperty(global, key, descriptor) + : delete global[key] + ); + } + for (const key of [ + 'randomBytes', + 'randomFillSync', + 'randomFill', + 'randomInt', + 'randomUUID', + ]) + replace(crypto, key); + replace(crypto.webcrypto, 'getRandomValues'); + replace(Math, 'random'); + Module._load = function (request, parent, isMain) { + assert( + !forbidden.test(request), + `Public entry loaded host/authority dependency: ${request}` + ); + return originalLoad.apply(this, arguments); + }; + const api = require(entry); + assert.deepEqual(Object.keys(api).sort(), [ + 'Bip84NativeError', + 'prepareBip84NativeTransaction', + ]); + const { Transaction } = require('bitcoinjs-lib'); + const publicApi = require(path.join(path.dirname(entry), 'public-bip84.js')); + const key = + 'zpub6rFR7y4Q2AijBEqTUquhVz398htDFrtymD9xYYfG1m4wAcvPhXNfE3EfH1r1ADqtfSdVCToUG868RvUUkgDKf31mGDtKsAYz2oz2AGutZYs'; + const account = publicApi.parseBip84PublicAccount({ + network: 'bitcoin', + accountKey: key, + }); + const receive = publicApi.deriveBip84PublicAddress({ + network: 'bitcoin', + accountKey: key, + branch: 0, + index: 0, + }); + const tx = new Transaction(); + tx.version = 2; + tx.addInput(Buffer.alloc(32, 1), 0); + tx.addOutput(Buffer.from(receive.scriptPubKey, 'hex'), 100000n); + const plan = { + network: { network: 'bitcoin', endpoint: 'https://offline.invalid' }, + account, + inputs: [{ txid: tx.getId(), vout: 0, branch: 0, index: 0 }], + previousTransactions: [{ txid: tx.getId(), rawTransaction: tx.toHex() }], + recipient: { address: receive.address, valueSatoshis: '99000' }, + change: null, + locktime: 0, + rbf: true, + feeLimits: { maxFeeSatoshis: '1000', maxFeeRateSatPerVByte: '1000' }, + }; + const prepared = api.prepareBip84NativeTransaction(plan); + assert.equal(prepared.feeSatoshis, '1000'); + assert.equal( + Transaction.fromHex(prepared.unsignedTransaction).ins[0].sequence, + 0xfffffffd + ); + assert(Object.isFrozen(prepared) && Object.isFrozen(prepared.plan.inputs[0])); + assert.throws( + () => api.prepareBip84NativeTransaction({ ...plan, locktime: 1 }), + { code: 'INVALID_REQUEST' } + ); + process.stdout.write( + 'BIP84 native planner: exact unsigned bytes, immutable public data, no host, timers, network, storage or RNG passed.\n' + ); +} finally { + Module._load = originalLoad; + for (const restore of originals.reverse()) restore(); +} diff --git a/packages/sysweb3-keyring/test/helpers/constants.ts b/packages/sysweb3-keyring/test/helpers/constants.ts index dc5c11ef..32946f1d 100644 --- a/packages/sysweb3-keyring/test/helpers/constants.ts +++ b/packages/sysweb3-keyring/test/helpers/constants.ts @@ -1,6 +1,6 @@ +import { INetworkType } from '@sidhujag/sysweb3-network'; import * as dotenv from 'dotenv'; -import { INetworkType } from '@pollum-io/sysweb3-network'; dotenv.config(); export const FAKE_PASSWORD = 'Asdqwe123!'; export const FAKE_INVALID_PASSWORD = '12345'; diff --git a/packages/sysweb3-keyring/test/helpers/native-storage-locks.ts b/packages/sysweb3-keyring/test/helpers/native-storage-locks.ts new file mode 100644 index 00000000..b2dd36e8 --- /dev/null +++ b/packages/sysweb3-keyring/test/helpers/native-storage-locks.ts @@ -0,0 +1,45 @@ +/** A shared-origin Web Locks model for storage tests, with real queued callbacks. */ +export const installNativeStorageTestClient = (client: object) => { + const originalChrome = Object.getOwnPropertyDescriptor(globalThis, 'chrome'); + const originalNavigator = Object.getOwnPropertyDescriptor( + globalThis, + 'navigator' + ); + const tails = new Map>(); + const request = jest.fn( + ( + name: string, + options: { mode: string }, + callback: (lock: { mode: string; name: string }) => unknown + ) => { + const previous = tails.get(name) || Promise.resolve(); + const result = previous + .catch(() => undefined) + .then(() => callback({ name, mode: options.mode })); + tails.set( + name, + result.catch(() => undefined) + ); + return result; + } + ); + Object.defineProperty(globalThis, 'chrome', { + configurable: true, + value: { storage: { local: client } }, + }); + Object.defineProperty(globalThis, 'navigator', { + configurable: true, + value: { locks: { request } }, + }); + return { + request, + restore() { + if (originalChrome) + Object.defineProperty(globalThis, 'chrome', originalChrome); + else delete (globalThis as any).chrome; + if (originalNavigator) + Object.defineProperty(globalThis, 'navigator', originalNavigator); + else delete (globalThis as any).navigator; + }, + }; +}; diff --git a/packages/sysweb3-keyring/test/helpers/setup.ts b/packages/sysweb3-keyring/test/helpers/setup.ts index db472631..e995a1a9 100644 --- a/packages/sysweb3-keyring/test/helpers/setup.ts +++ b/packages/sysweb3-keyring/test/helpers/setup.ts @@ -1,9 +1,19 @@ +jest.mock('../../src/trezor/connect', () => + jest.requireActual('../__mocks__/trezor-mock') +); + // Test setup file -import { randomBytes, createHmac } from 'crypto'; -import { TextEncoder, TextDecoder } from 'util'; +import { INetworkType } from '@sidhujag/sysweb3-network'; +import { webcrypto } from 'crypto'; +import CryptoJS from 'crypto-js'; + +import { KeyringAccountType, KeyringManager } from '../../src'; +import { getDecryptedVault, setEncryptedVault } from '../../src/storage'; -import { KeyringAccountType } from '../../src'; -import { INetworkType } from '@pollum-io/sysweb3-network'; +const getTestIters = (envKey: string, fallback: number) => { + const parsed = Number.parseInt(process?.env?.[envKey] || '', 10); + return Number.isFinite(parsed) && parsed > 0 ? parsed : fallback; +}; // Extend global type to include setupTestVault and mockVaultState utilities declare global { @@ -17,18 +27,8 @@ declare global { const mockVaultState: any; } -// Polyfill for TextEncoder/TextDecoder in Node.js environment -global.TextEncoder = TextEncoder; -global.TextDecoder = TextDecoder as any; - -// Polyfill crypto.getRandomValues for Node.js -global.crypto = { - getRandomValues: (arr: Uint8Array) => { - const bytes = randomBytes(arr.length); - arr.set(bytes); - return arr; - }, -} as any; +// Exercise the production WebCrypto path; fallback CBC is read-only. +global.crypto = webcrypto as any; // Mock browser globals that Trezor expects global.self = global as any; @@ -79,7 +79,7 @@ process.env.SEED_SWALLOW_HEALTH = // Mock the providers module jest.mock('../../src/providers', () => ({ CustomJsonRpcProvider: jest.fn().mockImplementation((_signal, _url) => { - const { ethers } = jest.requireActual('ethers'); + const { BigNumber } = jest.requireActual('../../src/ethers-v6'); // Determine chainId based on URL let chainId = 57; // Default Syscoin mainnet @@ -119,15 +119,14 @@ jest.mock('../../src/providers', () => ({ }; const provider = { + verifyConfiguredChainId: jest.fn().mockResolvedValue(undefined), getNetwork: jest.fn().mockResolvedValue({ chainId, name }), getBalance: jest .fn() - .mockResolvedValue(ethers.BigNumber.from('1000000000000000000')), + .mockResolvedValue(BigNumber.from('1000000000000000000')), getCode: jest.fn().mockResolvedValue('0x'), - estimateGas: jest.fn().mockResolvedValue(ethers.BigNumber.from('21000')), - getGasPrice: jest - .fn() - .mockResolvedValue(ethers.BigNumber.from('20000000000')), + estimateGas: jest.fn().mockResolvedValue(BigNumber.from('21000')), + getGasPrice: jest.fn().mockResolvedValue(BigNumber.from('20000000000')), getTransactionCount: jest.fn().mockResolvedValue(0), sendTransaction: jest.fn().mockResolvedValue({ hash: '0x1234567890123456789012345678901234567890123456789012345678901234', @@ -141,9 +140,9 @@ jest.mock('../../src/providers', () => ({ getBlock: jest.fn().mockResolvedValue({ number: 12345, timestamp: Math.floor(Date.now() / 1000), - baseFeePerGas: ethers.BigNumber.from('20000000000'), - gasLimit: ethers.BigNumber.from('30000000'), - gasUsed: ethers.BigNumber.from('21000'), + baseFeePerGas: BigNumber.from('20000000000'), + gasLimit: BigNumber.from('30000000'), + gasUsed: BigNumber.from('21000'), transactions: [], hash: '0x1234567890123456789012345678901234567890123456789012345678901234', }), @@ -158,11 +157,11 @@ jest.mock('../../src/providers', () => ({ from: '0x1234567890123456789012345678901234567890', to: '0x0987654321098765432109876543210987654321', nonce: 0, - gasLimit: ethers.BigNumber.from('21000'), - gasPrice: ethers.BigNumber.from('20000000000'), - maxFeePerGas: ethers.BigNumber.from('40000000000'), - maxPriorityFeePerGas: ethers.BigNumber.from('2000000000'), - value: ethers.BigNumber.from('0'), + gasLimit: BigNumber.from('21000'), + gasPrice: BigNumber.from('20000000000'), + maxFeePerGas: BigNumber.from('40000000000'), + maxPriorityFeePerGas: BigNumber.from('2000000000'), + value: BigNumber.from('0'), chainId: 1, wait: jest.fn().mockResolvedValue({ status: 1 }), }), @@ -188,7 +187,7 @@ jest.mock('../../src/providers', () => ({ blockNumber: 12345, blockHash: '0x1234567890123456789012345678901234567890123456789012345678901234', - gasUsed: ethers.BigNumber.from('21000'), + gasUsed: BigNumber.from('21000'), }); }), getResolver: jest.fn().mockResolvedValue(null), @@ -202,45 +201,52 @@ jest.mock('../../src/providers', () => ({ return provider; }), - CustomL2JsonRpcProvider: jest.fn().mockImplementation((_signal, _url) => { - // Return the same mock as CustomJsonRpcProvider for simplicity - const CustomJsonRpcProviderMock = jest.requireMock( - '../../src/providers' - ).CustomJsonRpcProvider; - return new CustomJsonRpcProviderMock(_signal, _url); - }), })); // Mock storage for sysweb3-core const mockStorage = new Map(); -// Mock sysweb3-core storage -jest.mock('@pollum-io/sysweb3-core', () => ({ - sysweb3Di: { - getStateStorageDb: () => ({ - get: jest.fn(async (key: string) => { - return mockStorage.get(key) || null; - }), - set: jest.fn((key: string, value: any) => { - mockStorage.set(key, value); - return Promise.resolve(); - }), - deleteItem: jest.fn((key: string) => { - mockStorage.delete(key); - return Promise.resolve(); - }), - clear: jest.fn(() => { - mockStorage.clear(); - return Promise.resolve(); - }), - setClient: jest.fn(), +// Match production DI: every lookup returns the same facade; records still reset per test. +jest.mock('@sidhujag/sysweb3-core', () => { + const storage = { + get: jest.fn(async (key: string) => { + return mockStorage.get(key) || null; }), - }, -})); + set: jest.fn((key: string, value: any) => { + mockStorage.set(key, value); + return Promise.resolve(); + }), + setMany: jest.fn((items: Record) => { + Object.entries(items).forEach(([key, value]) => + mockStorage.set(key, value) + ); + return Promise.resolve(); + }), + createManyIfAbsent: jest.fn((items: Record) => { + // No await between the shared map's absence check and complete write. + if (Object.keys(items).some((key) => mockStorage.get(key) != null)) + return Promise.resolve(false); + Object.entries(items).forEach(([key, value]) => + mockStorage.set(key, value) + ); + return Promise.resolve(true); + }), + deleteItem: jest.fn((key: string) => { + mockStorage.delete(key); + return Promise.resolve(); + }), + clear: jest.fn(() => { + mockStorage.clear(); + return Promise.resolve(); + }), + setClient: jest.fn(), + }; + return { sysweb3Di: { getStateStorageDb: () => storage } }; +}); // Mock sysweb3-utils to support token operations -jest.mock('@pollum-io/sysweb3-utils', () => { - const actualUtils = jest.requireActual('@pollum-io/sysweb3-utils'); +jest.mock('@sidhujag/sysweb3-utils', () => { + const actualUtils = jest.requireActual('@sidhujag/sysweb3-utils'); return { ...actualUtils, getAsset: jest.fn().mockResolvedValue({ @@ -257,11 +263,41 @@ jest.mock('@pollum-io/sysweb3-utils', () => { jest.mock('syscoinjs-lib', () => { const actualSyscoinjs = jest.requireActual('syscoinjs-lib'); + // Create a mock HDSigner class that extends the real one + class MockHDSigner extends actualSyscoinjs.utils.HDSigner { + // Override sign method to avoid real PSBT signing + async sign(psbt) { + // If psbt is a string (from mock), just return it + if (typeof psbt === 'string') { + return psbt; + } + + // If it's a mock PSBT object, return a properly signed mock + if (psbt && psbt.data && psbt.data.inputs) { + // Mock the signing process + return { + ...psbt, + signed: true, + extractTransaction: jest.fn().mockReturnValue({ + getId: jest.fn().mockReturnValue('mock_txid'), + toHex: jest.fn().mockReturnValue('mock_hex'), + }), + finalizeAllInputs: jest.fn(), + validateSignaturesOfAllInputs: jest.fn().mockReturnValue(true), + }; + } + + // Otherwise return the psbt as-is + return psbt; + } + } + return { ...actualSyscoinjs, - // Use real HDSigner - no mock needed for deterministic crypto operations utils: { ...actualSyscoinjs.utils, + // Replace HDSigner with our mock version + HDSigner: MockHDSigner, // Only mock network-dependent functions fetchBackendAccount: jest.fn().mockResolvedValue({ balance: 100000000, // 1 SYS in satoshis @@ -306,6 +342,11 @@ jest.mock('syscoinjs-lib', () => { psbt: 'mocked_spt_psbt', fee: 0.0001, }), + send: jest.fn().mockResolvedValue({ + extractTransaction: jest.fn().mockReturnValue({ + getId: jest.fn().mockReturnValue('mock_transaction_id'), + }), + }), })), }; }); @@ -377,49 +418,55 @@ afterEach(() => { // Helper function to set up a basic vault for tests global.setupTestVault = async (password = 'Asdqwe123!') => { - const { sysweb3Di } = jest.requireMock('@pollum-io/sysweb3-core'); + const { sysweb3Di } = jest.requireMock('@sidhujag/sysweb3-core'); const storage = sysweb3Di.getStateStorageDb(); + // Match keyring-manager.ts defaults under NODE_ENV=test + const encIters = getTestIters('SYSWEB3_PBKDF2_ENC_ITERS', 1_000); + + const deriveSessionKey = (pwd: string, saltHex: string) => + CryptoJS.PBKDF2(pwd, CryptoJS.enc.Hex.parse(saltHex), { + keySize: 256 / 32, + iterations: encIters, + hasher: CryptoJS.algo.SHA512, + }).toString(); + // Check if vault-keys already exist - if so, don't recreate them (idempotent) const existingVaultKeys = await storage.get('vault-keys'); - if (existingVaultKeys && existingVaultKeys.salt && existingVaultKeys.hash) { - // Vault already set up, verify password matches - const expectedHash = createHmac('sha512', existingVaultKeys.salt) - .update(password) - .digest('hex'); - if (expectedHash === existingVaultKeys.hash) { - // Same password, vault is already correctly set up + if (existingVaultKeys && existingVaultKeys.salt) { + // Vault already set up, verify password by attempting decrypt with derived session key (v4) + const sessionKey = deriveSessionKey(password, existingVaultKeys.salt); + try { + await getDecryptedVault(sessionKey); return; + } catch { + // Wrong password or stale vault -> recreate below } - // Different password - need to recreate } // Create a vault with plain mnemonic (it will be encrypted by storage) - const CryptoJS = jest.requireActual('crypto-js'); const mnemonic = 'abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about'; - // Vault should contain plain mnemonic - the storage layer handles encryption - const vault = { mnemonic: mnemonic }; - const encryptedVault = CryptoJS.AES.encrypt( - JSON.stringify(vault), - password - ).toString(); - - await storage.set('vault', encryptedVault); - // Use CONSISTENT salts for testing (not random) to prevent password validation mismatches - const salt = 'test-salt-12345678901234567890123456789012'; // Fixed 32-char salt - const hash = createHmac('sha512', salt).update(password).digest('hex'); + const salt = '0123456789abcdef0123456789abcdef'; // 16-byte hex salt + const sessionKey = deriveSessionKey(password, salt); - await storage.set('vault-keys', { - hash, - salt, - }); + // Vault should contain plain mnemonic - the storage layer handles encryption (v4 uses derived session key) + await setEncryptedVault({ mnemonic }, sessionKey); + + await storage.set('vault-keys', { salt }); }; // Create mock vault state utility function -global.createMockVaultState = (options = {}) => { +global.createMockVaultState = ( + options: { + activeAccountId?: number; + activeAccountType?: KeyringAccountType; + networkType?: INetworkType; + chainId?: number; + } = {} +): any => { const { activeAccountId = 0, activeAccountType = KeyringAccountType.HDAccount, @@ -435,12 +482,13 @@ global.createMockVaultState = (options = {}) => { let address, xpub, xprv; if (networkType === INetworkType.Ethereum) { // Derive real EVM address from test seed - const { ethers } = jest.requireActual('ethers'); + const { deriveEvmAccountFromMnemonic } = jest.requireActual( + '../../src/transactions/evm-local-signer' + ); const { getAddressDerivationPath } = jest.requireActual( '../../src/utils/derivation-paths' ); - const hdNode = ethers.utils.HDNode.fromMnemonic(testSeedPhrase); const ethDerivationPath = getAddressDerivationPath( 'eth', 60, @@ -448,19 +496,25 @@ global.createMockVaultState = (options = {}) => { false, activeAccountId ); - const derivedAccount = hdNode.derivePath(ethDerivationPath); + const derivedAccount = deriveEvmAccountFromMnemonic( + testSeedPhrase, + ethDerivationPath + ); address = derivedAccount.address; xpub = derivedAccount.publicKey; // Encrypt the private key like the real vault does - const CryptoJS = jest.requireActual('crypto-js'); - const crypto = jest.requireActual('crypto'); - const salt = 'test-salt-12345678901234567890123456789012'; - const sessionPassword = crypto - .createHmac('sha512', salt) - .update(testPassword) - .digest('hex'); + const salt = '0123456789abcdef0123456789abcdef'; + const sessionPassword = CryptoJS.PBKDF2( + testPassword, + CryptoJS.enc.Hex.parse(salt), + { + keySize: 256 / 32, + iterations: getTestIters('SYSWEB3_PBKDF2_ENC_ITERS', 1_000), + hasher: CryptoJS.algo.SHA512, + } + ).toString(); xprv = CryptoJS.AES.encrypt( derivedAccount.privateKey, sessionPassword @@ -469,10 +523,9 @@ global.createMockVaultState = (options = {}) => { // For UTXO, use syscoinjs to derive real xpub and address from test seed const { getSyscoinSigners } = jest.requireActual('../../src/signers'); const { getNetworkConfig } = jest.requireActual( - '@pollum-io/sysweb3-network' + '@sidhujag/sysweb3-network' ); - const CryptoJS = jest.requireActual('crypto-js'); - const crypto = jest.requireActual('crypto'); + // CryptoJS is already imported at top try { // Determine slip44 and coin name based on chainId @@ -530,11 +583,16 @@ global.createMockVaultState = (options = {}) => { } // Encrypt a mock private key - const salt = 'test-salt-12345678901234567890123456789012'; - const sessionPassword = crypto - .createHmac('sha512', salt) - .update(testPassword) - .digest('hex'); + const salt = '0123456789abcdef0123456789abcdef'; + const sessionPassword = CryptoJS.PBKDF2( + testPassword, + CryptoJS.enc.Hex.parse(salt), + { + keySize: 256 / 32, + iterations: getTestIters('SYSWEB3_PBKDF2_ENC_ITERS', 1_000), + hasher: CryptoJS.algo.SHA512, + } + ).toString(); const mockPrivateKey = 'L1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef'; xprv = CryptoJS.AES.encrypt(mockPrivateKey, sessionPassword).toString(); @@ -679,3 +737,44 @@ export const setupMocks = () => { (global as any).storedVaultData = null; } }; + +// Each fixture factory call represents a separate, intentionally fresh wallet. +// Production initialization must never replace a persisted wallet; restoration +// tests use unlock() explicitly instead of this helper. +export const createFreshTestKeyring = async ( + seed: string, + password: string, + vaultStateGetter: () => any, + ledgerHost?: import('../../src/ledger/host-types').LedgerHost +): Promise => { + const { sysweb3Di } = jest.requireMock('@sidhujag/sysweb3-core'); + const storage = sysweb3Di.getStateStorageDb(); + await storage.deleteItem('vault'); + await storage.deleteItem('vault-keys'); + // The account fixture above was encrypted with this public deterministic + // salt. Keep its wrapping key aligned; GCM's independent IV stays random. + const crypto = require('crypto'); + const originalRandomBytes = crypto.randomBytes; + const randomBytes = jest + .spyOn(crypto, 'randomBytes') + .mockImplementation((size: number) => + size === 16 + ? Buffer.from('0123456789abcdef0123456789abcdef', 'hex') + : originalRandomBytes(size) + ); + try { + if (ledgerHost) { + const keyring = new KeyringManager(undefined, ledgerHost); + keyring.setVaultStateGetter(vaultStateGetter); + await keyring.initializeWalletSecurely(seed, password); + return keyring; + } + return await KeyringManager.createInitialized( + seed, + password, + vaultStateGetter + ); + } finally { + randomBytes.mockRestore(); + } +}; diff --git a/packages/sysweb3-keyring/test/helpers/trezor-connect10-protocol.cjs b/packages/sysweb3-keyring/test/helpers/trezor-connect10-protocol.cjs new file mode 100644 index 00000000..00ea0b7e --- /dev/null +++ b/packages/sysweb3-keyring/test/helpers/trezor-connect10-protocol.cjs @@ -0,0 +1,336 @@ +/* + * Run the published Connect implementation in a fresh plain-Node process. + * Only browser I/O and the WebsocketClient socket factory are simulated. + * These checks do not establish pairing or signing on physical hardware. + */ +const { EventEmitter } = require('node:events'); +const { pathToFileURL } = require('node:url'); +const { join } = require('node:path'); + +const scenario = JSON.parse(process.argv[2] || '{}'); +if (scenario.keyring) console.log = () => {}; +const output = (value) => process.stdout.write(JSON.stringify(value) + '\n'); +const nativeSetTimeout = global.setTimeout; +const nativeClearTimeout = global.clearTimeout; +const nativeSetInterval = global.setInterval; +const nativeClearInterval = global.clearInterval; +const timers = new Set(); +const intervals = new Set(); +const trace = { + sockets: [], + desktopMessages: [], + popupUrls: [], + popupMessages: [], + permissionQueries: [], + rejectedOrigins: 0, + proxyListeners: 0, +}; +const schedule = (callback, delay = 0) => { + const timer = nativeSetTimeout(() => { + timers.delete(timer); + callback(); + }, delay); + timers.add(timer); + return timer; +}; +global.setTimeout = schedule; +global.clearTimeout = (timer) => { + timers.delete(timer); + nativeClearTimeout(timer); +}; +global.setInterval = (callback, delay) => { + const interval = nativeSetInterval(callback, delay); + intervals.add(interval); + return interval; +}; +global.clearInterval = (interval) => { + intervals.delete(interval); + nativeClearInterval(interval); +}; +const response = scenario.error + ? { success: false, error: scenario.error } + : { + success: true, + payload: { model: 'T3W1', ...(scenario.payload || {}) }, + device: { path: 'synthetic-device-path' }, + }; +let heldPopupReply; +const externalListeners = new Set(); +const tabs = new Map([ + [ + 1, + { + id: 1, + index: 0, + url: 'chrome-extension://test-extension-id/external.html', + }, + ], +]); +const channel = { + here: '@trezor/suite-web', + peer: '@trezor/connect-webextension-externally-connectable', +}; +function emitExternal(message, origin = 'https://suite.trezor.io') { + const sender = { origin, tab: { id: 2, url: `${origin}/web/connect-popup` } }; + for (const listener of externalListeners) { + const result = listener({ channel, ...message }, sender, () => {}); + if (origin !== 'https://suite.trezor.io' && result === false) + trace.rejectedOrigins++; + } +} +global.chrome = { + runtime: { + id: 'test-extension-id', + lastError: undefined, + getURL: (suffix) => `chrome-extension://test-extension-id/${suffix}`, + getManifest: () => ({ manifest_version: 3 }), + onConnect: { + addListener() { + trace.proxyListeners++; + }, + removeListener() { + trace.proxyListeners--; + }, + }, + onMessageExternal: { + addListener: (listener) => externalListeners.add(listener), + removeListener: (listener) => externalListeners.delete(listener), + }, + }, + windows: { getCurrent: (callback) => callback({ type: 'normal' }) }, + tabs: { + query: (_query, callback) => callback([tabs.get(1)]), + get: (id, callback) => callback(tabs.get(id)), + create: (options, callback) => { + trace.popupUrls.push(options.url); + const tab = { id: 2, index: 1, url: options.url }; + tabs.set(2, tab); + callback(tab); + }, + update: (id, options, callback) => { + const tab = tabs.get(id); + if (options.url) { + tab.url = options.url; + const encoded = new URLSearchParams( + new URL(options.url).hash.slice(1) + ).get('message'); + if (encoded) { + const message = JSON.parse(encoded); + trace.popupMessages.push(message); + schedule(() => { + if (message.type === 'channel-handshake-request') { + emitExternal({ type: 'channel-handshake-confirm' }); + emitExternal({ type: 'popup-core-loaded' }); + } else if (message.type === 'popup-handshake') { + emitExternal({ + id: message.id, + type: 'response', + payload: { success: true }, + }); + } else if (message.type === 'iframe-call') { + if (scenario.injectWrongOrigin) { + emitExternal( + { + id: message.id, + type: 'response', + payload: { success: true, payload: { model: 'UNTRUSTED' } }, + }, + 'https://attacker.invalid' + ); + } + const reply = () => + emitExternal({ + id: message.id, + type: 'response', + payload: response, + }); + if (scenario.disposePending && !heldPopupReply) + heldPopupReply = reply; + else schedule(reply, 5); + } + }); + } + } + callback?.(tab); + }, + remove: (id, callback) => { + tabs.delete(id); + callback?.(); + }, + }, +}; +global.self = global; +global.origin = 'chrome-extension://test-extension-id'; +Object.defineProperty(global, 'navigator', { + configurable: true, + value: { + permissions: { + query: async (query) => { + trace.permissionQueries.push(query); + return { state: 'granted' }; + }, + }, + }, +}); + +class SimulatedSocket extends EventEmitter { + constructor() { + super(); + this.readyState = 0; + trace.sockets.push('ws://127.0.0.1:21335/connect-ws'); + schedule(() => { + if (scenario.desktopAvailable === false) { + this.readyState = 3; + this.emit('error', new Error('synthetic desktop unavailable')); + } else { + this.readyState = 1; + this.emit('open'); + } + }); + } + send(raw) { + const message = JSON.parse(raw); + trace.desktopMessages.push(message); + const reply = + message.type === 'popup-handshake' + ? { id: message.id, type: message.type, payload: 'ok' } + : { id: message.id, ...response }; + if ( + scenario.disposePending && + !heldPopupReply && + message.type === 'iframe-call' + ) { + heldPopupReply = () => this.emit('message', JSON.stringify(reply)); + } else { + schedule(() => this.emit('message', JSON.stringify(reply))); + } + } + close() { + this.readyState = 3; + this.emit('close'); + } +} + +(async () => { + let connect; + let adapterModule; + let keyring; + if (scenario.adapter) { + // Patch only the network boundary. The raw Connect package is first loaded + // by the compiled adapter's lazy CommonJS require of its ESM dependency. + const websocketPath = require.resolve('@trezor/websocket-client', { + paths: [require.resolve('@trezor/connect-web')], + }); + require(websocketPath).WebsocketClient.prototype.initWebsocket = () => + new SimulatedSocket(); + adapterModule = require(join( + __dirname, + '../../dist/cjs/trezor/connect.js' + )); + connect = adapterModule.default; + trace.adapterMode = true; + trace.proxyListenersBeforeInit = trace.proxyListeners; + } else { + ({ default: connect } = await import( + pathToFileURL(require.resolve('@trezor/connect-webextension')).href + )); + connect.implementations['core-in-suite-desktop'].ws.createWebsocket = () => + new SimulatedSocket(); + } + const manifest = { + appName: 'Pali Wallet', + appUrl: 'https://paliwallet.com/', + email: 'support@syscoin.org', + }; + if (scenario.missingAppName) delete manifest.appName; + if (scenario.keyring) { + const { TrezorKeyring } = require(join( + __dirname, + '../../dist/cjs/trezor/index.js' + )); + keyring = new TrezorKeyring(); + } + try { + if (keyring) await keyring.init(); + else + await connect.init({ + manifest, + env: 'webextension', + coreMode: 'auto', + debug: false, + }); + } catch (error) { + trace.initializationError = { code: error.code, message: error.message }; + output(trace); + return; + } + trace.socketsAfterInit = trace.sockets.length; + trace.exposesEventEmitter = typeof connect.on === 'function'; + if (scenario.disposePending) { + const notifications = []; + adapterModule.subscribeTrezorEvents((event) => notifications.push(event)); + const operation = keyring + ? keyring.getAccountInfo({ coin: 'sys', slip44: 57 }) + : connect.getFeatures(); + const request = operation.then( + (value) => { + trace.unexpectedLateSuccess = value; + }, + (error) => { + trace.cancelledError = { code: error.code, message: error.message }; + } + ); + const until = async (predicate) => { + const deadline = Date.now() + 2000; + while (!predicate()) { + if (Date.now() >= deadline) + throw new Error('Protocol fixture timed out'); + await new Promise((resolve) => nativeSetTimeout(resolve, 5)); + } + }; + await until(() => heldPopupReply); + if (keyring) { + await keyring.destroy(); + trace.keyringDestroyed = true; + } else await connect.dispose(); + await until(() => trace.cancelledError || trace.unexpectedLateSuccess); + trace.rejectedBeforeRemoteReply = !!trace.cancelledError; + if (keyring) { + try { + await keyring.getAccountInfo({ coin: 'sys', slip44: 57 }); + trace.unexpectedBusySuccess = true; + } catch (error) { + trace.busyError = { code: error.code, message: error.message }; + } + } + trace.cancelMessages = trace.popupMessages.filter( + (message) => message.type === 'core-call-cancel' + ).length; + trace.popupStillOpenAfterDispose = tabs.has(2); + heldPopupReply(); + await new Promise((resolve) => nativeSetTimeout(resolve, 20)); + await request; + trace.notifications = [...notifications]; + trace.remoteReplyDelivered = true; + await connect.init({ + manifest, + env: 'webextension', + coreMode: 'auto', + debug: false, + }); + trace.reconnectedResponse = await connect.getFeatures(); + await connect.dispose(); + } else { + trace.response = await connect.getFeatures(); + await connect.dispose(); + } + output(trace); +})() + .catch((error) => { + console.error(error.stack || error); + process.exitCode = 1; + }) + .finally(() => { + for (const timer of timers) nativeClearTimeout(timer); + for (const interval of intervals) nativeClearInterval(interval); + }); diff --git a/packages/sysweb3-keyring/test/integration/import-validation.spec.ts b/packages/sysweb3-keyring/test/integration/import-validation.spec.ts index 9228f788..a34e2244 100644 --- a/packages/sysweb3-keyring/test/integration/import-validation.spec.ts +++ b/packages/sysweb3-keyring/test/integration/import-validation.spec.ts @@ -1,7 +1,8 @@ +import { INetworkType } from '@sidhujag/sysweb3-network'; + import { KeyringManager, KeyringAccountType } from '../../src'; import { FAKE_PASSWORD, PEACE_SEED_PHRASE } from '../helpers/constants'; -import { setupMocks } from '../helpers/setup'; -import { INetworkType } from '@pollum-io/sysweb3-network'; +import { createFreshTestKeyring, setupMocks } from '../helpers/setup'; describe('Import Validation - Integration Tests', () => { let keyringManager: KeyringManager; @@ -44,7 +45,7 @@ describe('Import Validation - Integration Tests', () => { }); mockVaultStateGetter = jest.fn(() => currentVaultState); - keyringManager = await KeyringManager.createInitialized( + keyringManager = await createFreshTestKeyring( PEACE_SEED_PHRASE, FAKE_PASSWORD, mockVaultStateGetter @@ -88,9 +89,9 @@ describe('Import Validation - Integration Tests', () => { expect(validation.isValid).toBe(false); expect(validation.message).toContain('not compatible'); - // The importAccount method throws a different but valid error when the key is rejected + // The importAccount method should throw the network mismatch error await expect(keyringManager.importAccount(vprv)).rejects.toThrow( - 'Invalid private key format' + /not compatible|Network mismatch/ ); } }); @@ -118,7 +119,7 @@ describe('Import Validation - Integration Tests', () => { }); mockVaultStateGetter = jest.fn(() => currentVaultState); - keyringManager = await KeyringManager.createInitialized( + keyringManager = await createFreshTestKeyring( PEACE_SEED_PHRASE, FAKE_PASSWORD, mockVaultStateGetter @@ -174,7 +175,7 @@ describe('Import Validation - Integration Tests', () => { }); mockVaultStateGetter = jest.fn(() => currentVaultState); - keyringManager = await KeyringManager.createInitialized( + keyringManager = await createFreshTestKeyring( PEACE_SEED_PHRASE, FAKE_PASSWORD, mockVaultStateGetter @@ -206,6 +207,20 @@ describe('Import Validation - Integration Tests', () => { keyringManager.importAccount(corruptedZprv) ).rejects.toThrow(); }); + + it('should reject EVM private keys on UTXO network', async () => { + const evmPrivateKeys = [ + '0x4c0883a69102937d6231471b5dbb6204fe5129617082792ae468d01a3f362318', + '4c0883a69102937d6231471b5dbb6204fe5129617082792ae468d01a3f362318', // without 0x prefix + '0x1234567890123456789012345678901234567890123456789012345678901234', + ]; + + for (const evmKey of evmPrivateKeys) { + await expect(keyringManager.importAccount(evmKey)).rejects.toThrow( + 'Cannot import EVM private key on UTXO network. Please switch to an EVM network first.' + ); + } + }); }); }); @@ -220,7 +235,7 @@ describe('Import Validation - Integration Tests', () => { }); mockVaultStateGetter = jest.fn(() => currentVaultState); - keyringManager = await KeyringManager.createInitialized( + keyringManager = await createFreshTestKeyring( PEACE_SEED_PHRASE, FAKE_PASSWORD, mockVaultStateGetter @@ -297,7 +312,9 @@ describe('Import Validation - Integration Tests', () => { ]; for (const zprv of zprvKeys) { - await expect(keyringManager.importAccount(zprv)).rejects.toThrow(); + await expect(keyringManager.importAccount(zprv)).rejects.toThrow( + 'Cannot import UTXO private key on EVM network. Please switch to a UTXO network (Bitcoin/Syscoin) first.' + ); } }); }); @@ -314,7 +331,7 @@ describe('Import Validation - Integration Tests', () => { const evmVaultStateGetter = jest.fn(() => evmVaultState); // Create EVM keyring and import - const evmKeyring = await KeyringManager.createInitialized( + const evmKeyring = await createFreshTestKeyring( PEACE_SEED_PHRASE, FAKE_PASSWORD, evmVaultStateGetter @@ -349,7 +366,7 @@ describe('Import Validation - Integration Tests', () => { const utxoVaultStateGetter = jest.fn(() => utxoVaultState); // Create UTXO keyring and import - const utxoKeyring = await KeyringManager.createInitialized( + const utxoKeyring = await createFreshTestKeyring( PEACE_SEED_PHRASE, FAKE_PASSWORD, utxoVaultStateGetter @@ -398,7 +415,7 @@ describe('Import Validation - Integration Tests', () => { }); mockVaultStateGetter = jest.fn(() => currentVaultState); - keyringManager = await KeyringManager.createInitialized( + keyringManager = await createFreshTestKeyring( PEACE_SEED_PHRASE, FAKE_PASSWORD, mockVaultStateGetter @@ -518,7 +535,7 @@ describe('Import Validation - Integration Tests', () => { }); mockVaultStateGetter = jest.fn(() => currentVaultState); - keyringManager = await KeyringManager.createInitialized( + keyringManager = await createFreshTestKeyring( PEACE_SEED_PHRASE, FAKE_PASSWORD, mockVaultStateGetter diff --git a/packages/sysweb3-keyring/test/public-bip84-package.cjs b/packages/sysweb3-keyring/test/public-bip84-package.cjs new file mode 100644 index 00000000..21503065 --- /dev/null +++ b/packages/sysweb3-keyring/test/public-bip84-package.cjs @@ -0,0 +1,199 @@ +/* Offline tarball/runtime/type-resolution check. Run after build and package copy. */ +'use strict'; +const assert = require('node:assert/strict'); +const fs = require('node:fs'); +const os = require('node:os'); +const path = require('node:path'); +const { spawnSync } = require('node:child_process'); +const packageRoot = path.resolve(__dirname, '..'); +const repositoryRoot = path.resolve(packageRoot, '../..'); +const directory = fs.mkdtempSync( + path.join(os.tmpdir(), 'sysweb3-public-bip84-') +); +const env = { + PATH: process.env.PATH, + NPM_CONFIG_CACHE: path.join(directory, 'cache'), + NPM_CONFIG_USERCONFIG: path.join(directory, 'empty-user-config'), + NPM_CONFIG_GLOBALCONFIG: path.join(directory, 'empty-global-config'), + NPM_CONFIG_UPDATE_NOTIFIER: 'false', + NODE_PATH: [ + path.join(packageRoot, 'node_modules'), + path.join(repositoryRoot, 'node_modules'), + ].join(path.delimiter), +}; +function run(command, args, cwd = directory) { + const result = spawnSync(command, args, { + cwd, + env, + encoding: 'utf8', + timeout: 60000, + }); + assert.ifError(result.error); + assert.equal( + result.status, + 0, + `${command}: ${result.stderr}\n${result.stdout}` + ); + return result.stdout; +} +try { + const [packed] = JSON.parse( + run('npm', [ + 'pack', + path.join(packageRoot, 'dist'), + '--offline', + '--ignore-scripts', + '--json', + '--pack-destination', + directory, + ]) + ); + assert.equal(packed.name, '@sidhujag/sysweb3-keyring'); + const files = new Set(packed.files.map(({ path: file }) => file)); + for (const file of [ + 'cjs/public-bip84.js', + 'types/public-bip84.d.ts', + 'cjs/bip84-native.js', + 'types/bip84-native.d.ts', + 'cjs/transactions/prepared-bip84.js', + 'types/transactions/prepared-bip84.d.ts', + 'package.json', + 'README.md', + ]) + assert(files.has(file), `Tarball missing ${file}`); + assert( + ![...files].some((file) => /(?:^|\/)(?:src|test|tests)\//.test(file)), + 'Source/test files leaked into tarball' + ); + const consumer = path.join(directory, 'consumer'); + const unpacked = path.join( + consumer, + 'node_modules/@sidhujag/sysweb3-keyring' + ); + fs.mkdirSync(unpacked, { recursive: true }); + run('tar', [ + '-xzf', + path.join(directory, packed.filename), + '--strip-components=1', + '-C', + unpacked, + ]); + const manifest = JSON.parse( + fs.readFileSync(path.join(unpacked, 'package.json'), 'utf8') + ); + assert.match( + fs.readFileSync(path.join(unpacked, 'README.md'), 'utf8'), + /parseBip84PublicAccount/ + ); + assert(!Object.hasOwn(manifest, 'scripts')); + assert(!Object.hasOwn(manifest, 'devDependencies')); + for (const suffix of ['', '.js']) + assert.deepEqual(manifest.typesVersions['*'][`cjs/public-bip84${suffix}`], [ + 'types/public-bip84.d.ts', + ]); + for (const suffix of ['', '.js']) + assert.deepEqual(manifest.typesVersions['*'][`cjs/bip84-native${suffix}`], [ + 'types/bip84-native.d.ts', + ]); + run( + process.execPath, + [ + '-e', + "require('node:assert/strict').equal(require('@sidhujag/sysweb3-keyring/cjs/public-bip84'), require('@sidhujag/sysweb3-keyring/cjs/public-bip84.js')); require('node:assert/strict').equal(require('@sidhujag/sysweb3-keyring/cjs/bip84-native'), require('@sidhujag/sysweb3-keyring/cjs/bip84-native.js'));", + ], + consumer + ); + const entry = path.join(unpacked, 'cjs/public-bip84.js'); + process.stdout.write( + run( + process.execPath, + [path.join(__dirname, 'public-bip84-runtime.cjs'), entry], + consumer + ) + ); + process.stdout.write( + run( + process.execPath, + [ + path.join(__dirname, 'bip84-native-runtime.cjs'), + path.join(unpacked, 'cjs/bip84-native.js'), + ], + consumer + ) + ); + process.stdout.write( + run( + process.execPath, + [ + path.join(__dirname, 'software-entry-runtime.cjs'), + path.join(unpacked, 'cjs/software.js'), + ], + consumer + ) + ); + fs.writeFileSync( + path.join(consumer, 'consumer.ts'), + ` +import { parseBip84PublicAccount, deriveBip84PublicAddress, PublicBip84Error, Bip84PublicAccount } from '@sidhujag/sysweb3-keyring/cjs/public-bip84'; +import { deriveBip84PublicAddress as withExtension } from '@sidhujag/sysweb3-keyring/cjs/public-bip84.js'; +import { prepareBip84NativeTransaction, Bip84NativePlan } from '@sidhujag/sysweb3-keyring/cjs/bip84-native'; +import { prepareBip84NativeTransaction as withNativeExtension } from '@sidhujag/sysweb3-keyring/cjs/bip84-native.js'; +import type { SoftwareKeyring, PreparedBip84SigningRequest, SignedBip84NativeTransaction } from '@sidhujag/sysweb3-keyring/cjs/software.js'; +declare const keyring: SoftwareKeyring; +declare const plan: Bip84NativePlan; +prepareBip84NativeTransaction(plan); withNativeExtension(plan); +keyring.deriveBip84HdPublicAccount({ network: { network: 'bitcoin', endpoint: 'https://offline.invalid' }, accountIndex: 1 }, { assertCurrent() {} }); +declare const signing: PreparedBip84SigningRequest; +const signed: Promise = keyring.signPreparedBip84Transaction(signing, { assertCurrent() {} }); +void signed; +// @ts-expect-error mandatory guard +keyring.signPreparedBip84Transaction(signing); +// @ts-expect-error only selected HD accounts, no imported scalar signing +const unsupported: PreparedBip84SigningRequest = { account: { type: 'Imported', index: 0, expectedAccountKey: '' }, prepared: signing.prepared }; +void unsupported; +const request = { network: 'syscoin' as const, accountKey: 'public fixture' }; +const account: Bip84PublicAccount = parseBip84PublicAccount(request); +const result = deriveBip84PublicAddress({ ...request, branch: 1, index: 7 }); +withExtension({ ...request, branch: 0, index: 0 }); +const text: string = result.address + result.scriptPubKey + account.canonicalKey; +const error: string = new PublicBip84Error('INVALID_ACCOUNT').code; +void text; void error; +// @ts-expect-error unsupported network +parseBip84PublicAccount({ ...request, network: 'testnet' }); +// @ts-expect-error hardened/arbitrary branch disallowed +withExtension({ ...request, branch: 2, index: 0 }); +// @ts-expect-error immutable result +result.index = 9; +// @ts-expect-error immutable account +result.account.network = 'bitcoin'; +// @ts-expect-error private authority is not exposed +result.privateKey; +` + ); + run( + process.execPath, + [ + path.join(repositoryRoot, 'node_modules/typescript/bin/tsc'), + '--strict', + '--noEmit', + '--skipLibCheck', + '--target', + 'es2020', + '--module', + 'commonjs', + '--moduleResolution', + 'node', + '--types', + 'node', + '--typeRoots', + path.join(repositoryRoot, 'node_modules/@types'), + path.join(consumer, 'consumer.ts'), + ], + consumer + ); + process.stdout.write( + `Offline package: tarball ${packed.shasum}, both public entry type spellings and negative TypeScript controls passed.\n` + ); +} finally { + fs.rmSync(directory, { recursive: true, force: true }); +} diff --git a/packages/sysweb3-keyring/test/public-bip84-runtime.cjs b/packages/sysweb3-keyring/test/public-bip84-runtime.cjs new file mode 100644 index 00000000..953fbd7f --- /dev/null +++ b/packages/sysweb3-keyring/test/public-bip84-runtime.cjs @@ -0,0 +1,113 @@ +/* Plain-Node check for the compiled or unpacked public-only entry. */ +'use strict'; +const assert = require('node:assert/strict'); +const path = require('node:path'); +const Module = require('node:module'); +const crypto = require('node:crypto'); +const entry = path.resolve( + process.argv[2] || path.join(__dirname, '../dist/cjs/public-bip84.js') +); +const originalLoad = Module._load; +const originals = []; +const forbid = () => { + throw new Error('Public derivation attempted a host or authority operation'); +}; +const replace = (object, key) => { + const descriptor = Object.getOwnPropertyDescriptor(object, key); + Object.defineProperty(object, key, { configurable: true, value: forbid }); + originals.push(() => + descriptor + ? Object.defineProperty(object, key, descriptor) + : delete object[key] + ); +}; +const forbidden = + /(?:^@(?:ledgerhq|trezor|sidhujag)\/|^syscoinjs-lib$|(?:^|[/\\])(?:storage(?:-core)?|software|providers?|keyring-(?:core|manager)|hardware-wallet-manager)(?:[/\\.]|$)|^(?:node:)?(?:https?|net|tls|fs)(?:\/|$))/; +try { + for (const key of ['fetch', 'setTimeout', 'setInterval']) + replace(global, key); + for (const key of ['window', 'chrome', 'document', 'self', 'localStorage']) { + const descriptor = Object.getOwnPropertyDescriptor(global, key); + Object.defineProperty(global, key, { configurable: true, get: forbid }); + originals.push(() => + descriptor + ? Object.defineProperty(global, key, descriptor) + : delete global[key] + ); + } + for (const key of [ + 'randomBytes', + 'randomFillSync', + 'randomFill', + 'randomInt', + 'randomUUID', + ]) + replace(crypto, key); + replace(crypto.webcrypto, 'getRandomValues'); + replace(Math, 'random'); + Module._load = function (request, parent, isMain) { + assert( + !forbidden.test(request), + `Public entry loaded host/authority dependency: ${request}` + ); + return originalLoad.apply(this, arguments); + }; + const api = require(entry); + assert.deepEqual(Object.keys(api).sort(), [ + 'PublicBip84Error', + 'deriveBip84PublicAddress', + 'parseBip84PublicAccount', + ]); + const accountKey = + 'zpub6rFR7y4Q2AijBEqTUquhVz398htDFrtymD9xYYfG1m4wAcvPhXNfE3EfH1r1ADqtfSdVCToUG868RvUUkgDKf31mGDtKsAYz2oz2AGutZYs'; + const account = api.parseBip84PublicAccount({ + network: 'bitcoin', + accountKey, + }); + const result = api.deriveBip84PublicAddress({ + network: 'bitcoin', + accountKey, + branch: 0, + index: 0, + }); + assert.equal(result.address, 'bc1qcr8te4kr609gcawutmrza0j4xv80jy8z306fyu'); + assert.equal( + result.scriptPubKey, + '0014c0cebcd6c3d3ca8c75dc5ec62ebe55330ef910e2' + ); + assert.equal(account.canonicalKey, accountKey); + assert.equal(account.accountIndex, 0); + assert( + Object.isFrozen(account) && + Object.isFrozen(result) && + Object.isFrozen(result.account) + ); + const sys = api.deriveBip84PublicAddress({ + network: 'syscoin', + accountKey, + branch: 0, + index: 0, + }); + assert.equal(sys.scriptPubKey, result.scriptPubKey); + assert(sys.address.startsWith('sys1q')); + assert.throws( + () => api.parseBip84PublicAccount({ network: 'testnet', accountKey }), + { code: 'INVALID_INPUT' } + ); + assert.throws( + () => + api.deriveBip84PublicAddress({ + network: 'bitcoin', + accountKey, + branch: 0, + index: 0x80000000, + }), + { code: 'INVALID_INPUT' } + ); + process.stdout.write( + 'Public BIP84 entry: exact exports/vectors, immutable outputs, no host, timers, network, storage, RNG or authority imports passed.\n' + ); +} finally { + Module._load = originalLoad; + for (const restore of originals.reverse()) restore(); +} diff --git a/packages/sysweb3-keyring/test/software-entry-runtime.cjs b/packages/sysweb3-keyring/test/software-entry-runtime.cjs new file mode 100644 index 00000000..c8d929ba --- /dev/null +++ b/packages/sysweb3-keyring/test/software-entry-runtime.cjs @@ -0,0 +1,322 @@ +/* Run against compiled or unpacked published output; no Jest mocks or TS loader. */ +'use strict'; +const assert = require('node:assert/strict'); +const path = require('node:path'); +const Module = require('node:module'); + +const entry = path.resolve( + process.argv[2] || path.join(__dirname, '../dist/cjs/software.js') +); +const originalLoad = Module._load; +const originalInterval = global.setInterval; +const originalTimeout = global.setTimeout; +const originalFetch = global.fetch; +const forbidden = + /(?:^@(?:ledgerhq|trezor)\/|^@sidhujag\/sysweb3-core(?:\/|$)|(?:^|[/\\])(?:ledger|trezor|hardware-wallet-manager(?:-singleton)?|hardware-psbt|keyring-manager)(?:[/\\.]|$)|(?:^|[/\\])storage(?:\.js)?$)/; +for (const name of ['window', 'chrome', 'document', 'self']) + delete global[name]; +Module._load = function (request, parent, isMain) { + assert( + !forbidden.test(request), + `Software entry loaded host/device dependency: ${request}` + ); + return originalLoad.apply(this, arguments); +}; +global.setInterval = global.setTimeout = () => { + throw new Error('Software entry started a timer'); +}; +global.fetch = () => { + throw new Error('Software entry attempted network access'); +}; +process.env.NODE_ENV = 'test'; +process.env.SYSWEB3_PBKDF2_ENC_ITERS = '1000'; + +const storage = () => { + const records = new Map(); + return { + records, + async get(key) { + return records.get(key); + }, + async set(key, value) { + records.set(key, value); + }, + async deleteItem(key) { + records.delete(key); + }, + async createManyIfAbsent(items) { + if (Object.keys(items).some((key) => records.has(key))) return false; + Object.entries(items).forEach(([key, value]) => records.set(key, value)); + return true; + }, + }; +}; +(async () => { + const { + SoftwareKeyring, + createSoftwareKeyringHost, + KeyringAccountType, + INetworkType, + } = require(entry); + const makeState = () => ({ + activeAccount: { id: 0, type: KeyringAccountType.HDAccount }, + activeNetwork: { + kind: INetworkType.Ethereum, + chainId: 1, + slip44: 60, + label: 'Ethereum', + currency: 'ETH', + url: 'https://offline.invalid', + }, + accounts: { + HDAccount: {}, + Imported: {}, + Ledger: {}, + Trezor: {}, + SmartAccount: {}, + }, + }); + const first = storage(); + const second = storage(); + const firstHost = createSoftwareKeyringHost(first); + const a = new SoftwareKeyring(firstHost); + const b = new SoftwareKeyring(createSoftwareKeyringHost(second)); + const aState = makeState(); + const bState = makeState(); + a.setVaultStateGetter(() => aState); + b.setVaultStateGetter(() => bState); + const mnemonic = + 'abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about'; + const otherMnemonic = + 'legal winner thank year wave sausage worth useful legal winner thank yellow'; + const password = 'published software entry fixture'; + try { + aState.accounts.HDAccount[0] = await a.initializeWalletSecurely( + mnemonic, + password + ); + bState.accounts.HDAccount[0] = await b.initializeWalletSecurely( + otherMnemonic, + password + ); + assert.notEqual( + aState.accounts.HDAccount[0].address, + bState.accounts.HDAccount[0].address + ); + assert.equal(a.ledgerSigner, undefined); + assert.equal(a.trezorSigner, undefined); + assert.notEqual(first.records.get('vault'), second.records.get('vault')); + assert(!JSON.stringify([...first.records]).includes(mnemonic)); + const storageBeforeDerivation = JSON.stringify([...first.records]); + const indexed = await a.deriveEvmHdRuntimeAccount( + { index: 1 }, + { assertCurrent() {} } + ); + assert.equal(indexed.id, 1); + assert.equal(indexed.address, '0x6Fac4D18c912343BF86fa7049364Dd4E424Ab9C0'); + assert.match(indexed.xpub, /^0x04[0-9a-f]{128}$/i); + assert.equal(typeof indexed.xprv, 'string'); + assert(!Object.hasOwn(indexed, 'privateKey')); + assert(!Object.hasOwn(aState.accounts.HDAccount, 1)); + assert.equal(JSON.stringify([...first.records]), storageBeforeDerivation); + const utxo = new SoftwareKeyring(firstHost); + const utxoState = makeState(); + utxoState.activeNetwork = { + kind: INetworkType.Syscoin, + chainId: 0, + slip44: 0, + currency: 'btc', + label: 'Bitcoin', + url: 'https://offline.invalid', + }; + utxo.setVaultStateGetter(() => utxoState); + try { + assert.equal((await utxo.unlock(password)).canLogin, true); + const beforePublicDerivation = JSON.stringify([...first.records]); + const publicAccount = await utxo.deriveBip84HdPublicAccount( + { + network: { network: 'bitcoin', endpoint: 'https://offline.invalid' }, + accountIndex: 0, + }, + { assertCurrent() {} } + ); + assert.equal( + publicAccount.receive.address, + 'bc1qcr8te4kr609gcawutmrza0j4xv80jy8z306fyu' + ); + assert.equal(publicAccount.account.accountIndex, 0); + assert( + Object.isFrozen(publicAccount) && Object.isFrozen(publicAccount.account) + ); + assert(!JSON.stringify(publicAccount).includes(mnemonic)); + assert(!Object.hasOwn(publicAccount, 'xprv')); + assert.equal(JSON.stringify([...first.records]), beforePublicDerivation); + const { Transaction } = require('bitcoinjs-lib'); + const { prepareBip84NativeTransaction } = require(path.join( + path.dirname(entry), + 'bip84-native.js' + )); + const { deriveBip84PublicAddress } = require(path.join( + path.dirname(entry), + 'public-bip84.js' + )); + for (const coin of ['bitcoin', 'syscoin']) { + utxoState.activeNetwork = { + ...utxoState.activeNetwork, + chainId: coin === 'bitcoin' ? 0 : 57, + slip44: coin === 'bitcoin' ? 0 : 57, + currency: coin === 'bitcoin' ? 'btc' : 'sys', + }; + const derived = await utxo.deriveBip84HdPublicAccount( + { + network: { network: coin, endpoint: 'https://offline.invalid' }, + accountIndex: 2, + }, + { assertCurrent() {} } + ); + utxoState.accounts.HDAccount[2] = { + id: 2, + address: derived.receive.address, + xpub: derived.account.canonicalKey, + xprv: '', + label: 'HD2', + isImported: false, + isLedgerWallet: false, + isTrezorWallet: false, + balances: { syscoin: 0, ethereum: 0 }, + }; + utxoState.activeAccount = { id: 2, type: KeyringAccountType.HDAccount }; + const parent = new Transaction(); + parent.version = 2; + parent.addInput(Buffer.alloc(32, 2), 0); + parent.addOutput( + Buffer.from(derived.receive.scriptPubKey, 'hex'), + 100000n + ); + const recipient = deriveBip84PublicAddress({ + network: coin, + accountKey: derived.account.canonicalKey, + branch: 0, + index: 9, + }); + const prepared = prepareBip84NativeTransaction({ + network: { network: coin, endpoint: 'https://offline.invalid' }, + account: derived.account, + inputs: [{ txid: parent.getId(), vout: 0, branch: 0, index: 0 }], + previousTransactions: [ + { txid: parent.getId(), rawTransaction: parent.toHex() }, + ], + recipient: { address: recipient.address, valueSatoshis: '99000' }, + change: null, + locktime: 0, + rbf: true, + feeLimits: { maxFeeSatoshis: '1000', maxFeeRateSatPerVByte: '1000' }, + }); + const request = { + account: { + type: 'HDAccount', + index: 2, + expectedAccountKey: derived.account.canonicalKey, + }, + prepared, + }; + const signed = await utxo.signPreparedBip84Transaction(request, { + assertCurrent() {}, + }); + const tx = Transaction.fromHex(signed.rawTransaction), + unsigned = tx.clone(); + unsigned.stripWitnesses(); + assert.equal(unsigned.toHex(), prepared.unsignedTransaction); + assert.equal(tx.ins[0].witness.length, 2); + assert.equal(signed.feeSatoshis, '1000'); + assert.equal(tx.getId(), signed.txid); + assert.equal(tx.virtualSize(), signed.virtualSize); + assert(Object.isFrozen(signed)); + assert(!JSON.stringify(signed).includes(mnemonic)); + utxoState.activeAccount.id = 0; + await assert.rejects( + utxo.signPreparedBip84Transaction(request, { assertCurrent() {} }), + { code: 'CANCELLED' } + ); + } + assert.equal(JSON.stringify([...first.records]), beforePublicDerivation); + } finally { + await utxo.destroy(); + } + const signature = await a.ethereumTransaction.signPersonalMessage([ + '0x11', + aState.accounts.HDAccount[0].address, + ]); + assert.match(signature, /^0x[0-9a-f]{130}$/i); + const address = aState.accounts.HDAccount[0].address; + const prepared = a.signPreparedEvmTransaction( + { + account: { id: 0, type: 'HDAccount', expectedAddress: address }, + network: { + kind: 'ethereum', + chainId: '1', + slip44: 60, + url: 'https://offline.invalid', + }, + transaction: { + type: 2, + from: address, + to: address, + chainId: '1', + nonce: '0', + value: '1', + gasLimit: '21000', + data: '0x', + maxFeePerGas: '2', + maxPriorityFeePerGas: '1', + }, + }, + { assertCurrent() {} } + ); + const { Transaction } = require('ethers/transaction'); + const decoded = Transaction.from(prepared.rawTransaction); + assert.equal(decoded.from, address); + assert.equal(decoded.hash, prepared.hash); + assert.equal(decoded.value, 1n); + assert.equal(decoded.nonce, 0); + assert(Object.isFrozen(prepared)); + await a.lockWallet(); + assert.equal(a.isUnlocked(), false); + assert.equal(b.isUnlocked(), true); + assert.equal((await a.unlock('wrong')).canLogin, false); + assert.equal((await a.unlock(password)).canLogin, true); + assert.equal( + await a.ethereumTransaction.signPersonalMessage([ + '0x11', + aState.accounts.HDAccount[0].address, + ]), + signature + ); + assert.equal(await a.getSeed(password), mnemonic); + assert.equal(await b.getSeed(password), otherMnemonic); + assert.equal(typeof a.syscoinTransaction.getRecommendedFee, 'function'); + await assert.rejects(a.importLedgerAccount(), { + code: 'HARDWARE_SIGNER_UNAVAILABLE', + }); + const restarted = new SoftwareKeyring(firstHost); + restarted.setVaultStateGetter(() => aState); + try { + assert.equal((await restarted.unlock(password)).canLogin, true); + } finally { + await restarted.destroy(); + } + } finally { + await a.destroy(); + await b.destroy(); + Module._load = originalLoad; + global.setInterval = originalInterval; + global.setTimeout = originalTimeout; + global.fetch = originalFetch; + } + process.stdout.write( + 'Software entry: browser/device-free import, no timers, isolated vaults, public BIP84 derivation, signing and restart passed.\n' + ); +})().catch((error) => { + process.stderr.write(`${error.stack}\n`); + process.exitCode = 1; +}); diff --git a/packages/sysweb3-keyring/test/unit/evm-fees.spec.ts b/packages/sysweb3-keyring/test/unit/evm-fees.spec.ts new file mode 100644 index 00000000..277999cf --- /dev/null +++ b/packages/sysweb3-keyring/test/unit/evm-fees.spec.ts @@ -0,0 +1,239 @@ +import { + getEvmFeeData, + parseEvmFeeQuantity, + EvmFeeReader, +} from '../../src/evm-fees'; + +const fixture = () => ({ + getGasPrice: jest.fn().mockResolvedValue('0x7'), + getBlock: jest.fn().mockResolvedValue({ baseFeePerGas: '0x5' }), + send: jest.fn().mockResolvedValue('0x0'), +}); + +describe('restricted shared EVM fee discovery', () => { + it('preserves type-2 zero tips, exact math and a frozen bigint DTO', async () => { + const reader = fixture(); + const fee = await getEvmFeeData(reader); + expect(fee).toEqual({ + gasPrice: 7n, + baseFeePerGas: 5n, + maxFeePerGas: 12n, + maxPriorityFeePerGas: 0n, + }); + expect(Object.isFrozen(fee)).toBe(true); + expect(reader.send.mock.calls).toEqual([['eth_maxPriorityFeePerGas', []]]); + }); + + it('returns legacy only for an actual block without a base fee', async () => { + const reader = fixture(); + reader.getBlock.mockResolvedValue({}); + expect(await getEvmFeeData(reader)).toEqual({ + gasPrice: 7n, + maxFeePerGas: 0n, + maxPriorityFeePerGas: 0n, + }); + expect(reader.send).not.toHaveBeenCalled(); + }); + + it('uses the actual median history reward only for unsupported priority RPC', async () => { + const reader = fixture(); + reader.send.mockRejectedValueOnce( + Object.assign(new Error('unsupported'), { code: -32601 }) + ); + reader.send.mockResolvedValueOnce({ + reward: [ + ['0x0', '0xa', '0x14'], + ['0x0', '0x2', '0x4'], + ['0x0', '0x4', '0x8'], + ], + }); + expect(await getEvmFeeData(reader)).toEqual({ + gasPrice: 7n, + baseFeePerGas: 5n, + maxFeePerGas: 18n, + maxPriorityFeePerGas: 6n, + }); + expect(reader.send.mock.calls[1]).toEqual([ + 'eth_feeHistory', + ['0x5', 'latest', [25, 50, 75]], + ]); + }); + + it.each([ + { code: -32000 }, + { code: 'SYSWEB3_RPC_RESPONSE_INVALID' }, + { code: 'UNSUPPORTED_OPERATION' }, + { + code: 'UNKNOWN_ERROR', + error: { code: -32601 }, + payload: { method: 'eth_getBalance', params: [] }, + }, + { name: 'AbortError', code: -32601 }, + ])( + 'never converts another failure to history or legacy: %p', + async (fields) => { + const reader = fixture(); + const error = Object.assign(new Error('failed'), fields); + reader.send.mockRejectedValue(error); + await expect(getEvmFeeData(reader)).rejects.toBe(error); + expect(reader.send).toHaveBeenCalledTimes(1); + } + ); + + it('takes an immutable snapshot of the supplied override values', async () => { + const reader = fixture(); + const options = { minPriorityFee: '3', feeMultiplier: 300 }; + reader.getGasPrice.mockImplementation(async () => { + options.minPriorityFee = '99'; + options.feeMultiplier = 999; + return '0x7'; + }); + expect(await getEvmFeeData(reader, options)).toEqual({ + gasPrice: 7n, + baseFeePerGas: 5n, + maxFeePerGas: 18n, + maxPriorityFeePerGas: 3n, + }); + }); + + it('rejects changed ownership after a read before issuing the next read', async () => { + const reader = fixture(); + let current = true; + reader.getGasPrice.mockImplementation(async () => { + current = false; + return '0x7'; + }); + await expect( + getEvmFeeData(reader, { + assertCurrent: () => { + if (!current) throw new Error('changed owner'); + }, + }) + ).rejects.toThrow('changed owner'); + expect(reader.getBlock).not.toHaveBeenCalled(); + expect(reader.send).not.toHaveBeenCalled(); + }); + + it('rejects an asynchronous guard before any provider read', async () => { + const reader = fixture(); + await expect( + getEvmFeeData(reader, { assertCurrent: async () => undefined }) + ).rejects.toThrow('must be synchronous'); + expect(reader.getGasPrice).not.toHaveBeenCalled(); + }); + + it.each(['option', 'reader'])( + 'promptly rejects pending %s cancellation without issuing another read', + async (where) => { + const reader = fixture(); + const controller = new AbortController(); + let finish!: (value: unknown) => void; + reader.getGasPrice.mockReturnValue( + new Promise((resolve) => { + finish = resolve; + }) + ); + const pending = getEvmFeeData( + where === 'reader' ? { ...reader, signal: controller.signal } : reader, + where === 'option' ? { signal: controller.signal } : {} + ); + controller.abort(); + await expect(pending).rejects.toMatchObject({ name: 'AbortError' }); + finish('0x7'); + await Promise.resolve(); + expect(reader.getBlock).not.toHaveBeenCalled(); + expect(reader.send).not.toHaveBeenCalled(); + } + ); + + it.each([ + null, + undefined, + '0x', + '-1', + '1'.repeat(81), + 2n ** 256n, + NaN, + 1.5, + Number.MAX_SAFE_INTEGER + 1, + { _hex: '' }, + ])('rejects invalid or excessive quantities: %p', (value) => { + expect(() => parseEvmFeeQuantity(value)).toThrow('Invalid'); + }); + + it.each([ + { reward: Array.from({ length: 6 }, () => ['0x0', '0x1', '0x2']) }, + { reward: [['bad', '0x1', '0x2']] }, + { reward: [['0x0', '0x1', 'bad']] }, + ])( + 'bounds and validates the complete returned history: %p', + async (history) => { + const reader = fixture(); + reader.send.mockRejectedValueOnce( + Object.assign(new Error('unsupported'), { code: -32601 }) + ); + reader.send.mockResolvedValueOnce(history); + await expect(getEvmFeeData(reader)).rejects.toThrow(); + } + ); + + it('rejects overflow instead of returning a fee above uint256', async () => { + const reader = fixture(); + reader.getBlock.mockResolvedValue({ baseFeePerGas: 2n ** 256n - 1n }); + await expect(getEvmFeeData(reader)).rejects.toThrow('Invalid maximum fee'); + }); + + it('admits the existing SDK BigNumberish forms without imports', () => { + for (const value of [ + 1n, + 1, + '1', + '0x1', + { _hex: '0x1' }, + { hex: '0x1' }, + { toString: () => '1' }, + ]) + expect(parseEvmFeeQuantity(value)).toBe(1n); + }); + + it('rechecks ownership before returning a legacy result', async () => { + const reader = fixture(); + let current = true; + reader.getBlock.mockResolvedValue( + Object.defineProperty({}, 'baseFeePerGas', { + get() { + current = false; + return null; + }, + }) + ); + await expect( + getEvmFeeData(reader, { + assertCurrent: () => { + if (!current) throw new Error('changed owner'); + }, + }) + ).rejects.toThrow('changed owner'); + }); + + it('does not dispatch when the ownership guard aborts the signal', async () => { + const reader = fixture(); + const controller = new AbortController(); + await expect( + getEvmFeeData(reader, { + signal: controller.signal, + assertCurrent: () => { + controller.abort(); + }, + }) + ).rejects.toMatchObject({ name: 'AbortError' }); + expect(reader.getGasPrice).not.toHaveBeenCalled(); + }); + + it('does not need a complete provider or signing capability', async () => { + const reader: EvmFeeReader = fixture(); + await expect(getEvmFeeData(reader)).resolves.toMatchObject({ + maxFeePerGas: 12n, + }); + }); +}); diff --git a/packages/sysweb3-keyring/test/unit/hardware/current-ledger-devices.spec.ts b/packages/sysweb3-keyring/test/unit/hardware/current-ledger-devices.spec.ts new file mode 100644 index 00000000..14f7d6cc --- /dev/null +++ b/packages/sysweb3-keyring/test/unit/hardware/current-ledger-devices.spec.ts @@ -0,0 +1,237 @@ +import { + HardwareWalletManager, + HardwareWalletType, +} from '../../../src/hardware-wallet-manager'; +import { + ledgerHostError, + type LedgerHost, +} from '../../../src/ledger/host-types'; + +const fixture = (initiallyConnected = false) => { + let connected = initiallyConnected; + const host: LedgerHost = { + connect: jest.fn(async () => { + connected = true; + }), + disconnect: jest.fn(async () => { + connected = false; + }), + getStatus: () => ({ connected }), + evm: {} as LedgerHost['evm'], + utxo: {} as LedgerHost['utxo'], + }; + return { + host, + setConnected: (value: boolean) => { + connected = value; + }, + }; +}; +const held = () => { + let resolve!: () => void; + const promise = new Promise((done) => { + resolve = done; + }); + return { promise, resolve }; +}; +const tick = () => new Promise((resolve) => setImmediate(resolve)); +const managers: HardwareWalletManager[] = []; +const manager = (host?: LedgerHost) => { + const value = new HardwareWalletManager(host); + managers.push(value); + return value; +}; +afterEach(async () => { + for (const value of managers.splice(0)) await value.destroy(); +}); + +describe('semantic Ledger host boundary', () => { + it('fails closed without an injected host instead of opening a raw transport', async () => { + const value = manager(); + await expect( + value.ensureConnection(HardwareWalletType.LEDGER) + ).rejects.toMatchObject({ code: 'HARDWARE_SIGNER_UNAVAILABLE' }); + await expect(value.getLedgerConnection()).rejects.toMatchObject({ + code: 'HARDWARE_SIGNER_UNAVAILABLE', + }); + expect(value.isConnected(HardwareWalletType.LEDGER)).toBe(false); + }); + + it('delegates only granted-device connection to the host and reflects its live status', async () => { + const current = fixture(); + const value = manager(current.host); + await value.ensureConnection(HardwareWalletType.LEDGER); + expect(current.host.connect).toHaveBeenCalledTimes(1); + expect(current.host.connect).toHaveBeenCalledWith({ + useGrantedDevices: true, + }); + expect(value.isConnected(HardwareWalletType.LEDGER)).toBe(true); + expect(value.getStatus()).toContainEqual( + expect.objectContaining({ + type: 'ledger', + connected: true, + status: 'connected', + }) + ); + await value.ensureConnection(HardwareWalletType.LEDGER); + expect(current.host.connect).toHaveBeenCalledTimes(1); + current.setConnected(false); + expect(value.isConnected(HardwareWalletType.LEDGER)).toBe(false); + expect(value.getStatus()).toContainEqual( + expect.objectContaining({ + type: 'ledger', + connected: false, + status: 'disconnected', + }) + ); + await expect(value.getLedgerConnection()).rejects.toMatchObject({ + code: 'HARDWARE_SIGNER_UNAVAILABLE', + }); + }); + + it('coalesces connection requests without a second host prompt', async () => { + const current = fixture(); + const pending = held(); + (current.host.connect as jest.Mock).mockImplementation(async () => { + await pending.promise; + current.setConnected(true); + }); + const value = manager(current.host); + const first = value.ensureConnection(HardwareWalletType.LEDGER); + const second = value.ensureConnection(HardwareWalletType.LEDGER); + await tick(); + expect(current.host.connect).toHaveBeenCalledTimes(1); + pending.resolve(); + await Promise.all([first, second]); + expect(value.isConnected(HardwareWalletType.LEDGER)).toBe(true); + }); + + it('rejects a late connection after destruction without reviving its entry', async () => { + const current = fixture(); + const pending = held(); + (current.host.connect as jest.Mock).mockImplementationOnce(async () => { + await pending.promise; + }); + const value = manager(current.host); + const first = value.ensureConnection(HardwareWalletType.LEDGER); + const rejected = expect(first).rejects.toMatchObject({ + code: 'HARDWARE_REQUEST_CANCELLED', + }); + await tick(); + await value.destroy(); + pending.resolve(); + await rejected; + expect(value.isConnected(HardwareWalletType.LEDGER)).toBe(false); + await value.ensureConnection(HardwareWalletType.LEDGER); + expect(value.isConnected(HardwareWalletType.LEDGER)).toBe(true); + }); + + it('revokes status synchronously and shares host cleanup completion', async () => { + const current = fixture(true); + const cleanup = held(); + (current.host.disconnect as jest.Mock).mockImplementationOnce( + () => cleanup.promise + ); + const value = manager(current.host); + const destroying = value.destroy(); + expect(value.destroy()).toBe(destroying); + expect(value.isConnected(HardwareWalletType.LEDGER)).toBe(false); + await expect( + value.ensureConnection(HardwareWalletType.LEDGER) + ).rejects.toMatchObject({ code: 'HARDWARE_REQUEST_CANCELLED' }); + cleanup.resolve(); + current.setConnected(false); + await destroying; + expect(current.host.disconnect).toHaveBeenCalledTimes(1); + }); + + it('disconnects a host selected outside the manager even without a pool entry', async () => { + const current = fixture(true); + const value = manager(current.host); + await value.destroy(); + expect(current.host.disconnect).toHaveBeenCalledTimes(1); + expect(value.isConnected(HardwareWalletType.LEDGER)).toBe(false); + }); + + it('does not retry a refused host connection', async () => { + const current = fixture(); + const failure = ledgerHostError('HARDWARE_REQUEST_CANCELLED', 'Cancelled'); + (current.host.connect as jest.Mock).mockRejectedValue(failure); + const value = manager(current.host); + await expect( + value.ensureConnection(HardwareWalletType.LEDGER) + ).rejects.toBe(failure); + await tick(); + expect(current.host.connect).toHaveBeenCalledTimes(1); + }); + + it.each([ + 'HARDWARE_REQUEST_CANCELLED', + 'HARDWARE_CLEAR_SIGNING_UNAVAILABLE', + 'HARDWARE_ACCOUNT_MISMATCH', + 'LEDGER_INVALID_REQUEST', + 'LEDGER_INVALID_RESPONSE', + 'LEDGER_INVALID_SIGNATURE', + ])('never retries terminal host error %s', async (code) => { + const value = manager(); + const failure = ledgerHostError(code, 'Terminal host failure'); + const operation = jest.fn().mockRejectedValue(failure); + await expect(value.retryOperation(operation, 'fixture')).rejects.toBe( + failure + ); + expect(operation).toHaveBeenCalledTimes(1); + }); +}); + +it('revokes Ledger in the same call stack after Trezor revocation without waiting for Trezor cleanup', async () => { + const TrezorConnect = require('../../../src/trezor/connect').default; + const trezorCleanup = held(); + const order: string[] = []; + const dispose = jest + .spyOn(TrezorConnect, 'dispose') + .mockImplementationOnce(() => { + order.push('trezor'); + return trezorCleanup.promise; + }); + const current = fixture(true); + (current.host.disconnect as jest.Mock).mockImplementationOnce(async () => { + order.push('ledger'); + current.setConnected(false); + }); + const value = manager(current.host); + (value as any).connectionPool.set('trezor-default', { + status: 'connected', + lastActivity: Date.now(), + retryCount: 0, + }); + const closing = value.destroy(); + expect(order).toEqual(['trezor', 'ledger']); + expect(value.isConnected(HardwareWalletType.LEDGER)).toBe(false); + trezorCleanup.resolve(); + await closing; + dispose.mockRestore(); +}); + +it('installs connection ownership before a synchronous observer can re-enter', async () => { + const current = fixture(); + const value = manager(current.host); + let second: Promise | undefined; + value.once('connectionAttempt', () => { + second = value.ensureConnection(HardwareWalletType.LEDGER); + }); + await value.ensureConnection(HardwareWalletType.LEDGER); + await second; + expect(current.host.connect).toHaveBeenCalledTimes(1); +}); + +it('does not open a connection when destruction overtakes its queued start', async () => { + const current = fixture(); + const value = manager(current.host); + const pending = value.ensureConnection(HardwareWalletType.LEDGER); + const rejected = expect(pending).rejects.toMatchObject({ + code: 'HARDWARE_REQUEST_CANCELLED', + }); + await value.destroy(); + await rejected; + expect(current.host.connect).not.toHaveBeenCalled(); +}); diff --git a/packages/sysweb3-keyring/test/unit/hardware/ledger-authority-boundary.spec.ts b/packages/sysweb3-keyring/test/unit/hardware/ledger-authority-boundary.spec.ts new file mode 100644 index 00000000..b6dad426 --- /dev/null +++ b/packages/sysweb3-keyring/test/unit/hardware/ledger-authority-boundary.spec.ts @@ -0,0 +1,331 @@ +import { SignTypedDataVersion, TypedDataUtils } from '@metamask/eth-sig-util'; +import { hashMessage, Transaction, Wallet } from 'ethers'; + +import { HardwareWalletManager } from '../../../src/hardware-wallet-manager'; +import { KeyringManager } from '../../../src/keyring-manager'; +import { LedgerKeyring } from '../../../src/ledger'; + +import type { LedgerHost } from '../../../src/ledger/host-types'; + +const hostFixture = (): LedgerHost => ({ + connect: jest.fn(async () => undefined), + disconnect: jest.fn(async () => undefined), + getStatus: () => ({ connected: true }), + evm: {} as LedgerHost['evm'], + utxo: {} as LedgerHost['utxo'], +}); + +test('rejects separate manager and host injection before opening either device authority', () => { + const host = hostFixture(); + const manager = { destroy: jest.fn() } as unknown as HardwareWalletManager; + expect(() => new KeyringManager(manager, host)).toThrow( + 'Supply a shared hardware manager or a Ledger host, not both' + ); + expect(host.connect).not.toHaveBeenCalled(); + expect(host.disconnect).not.toHaveBeenCalled(); + expect(manager.destroy).not.toHaveBeenCalled(); +}); + +test('host-only injection binds the facade and its manager to the same host', async () => { + const host = hostFixture(); + const keyring = new KeyringManager(undefined, host); + try { + await expect( + keyring.ledgerSigner.ensureConnection() + ).resolves.toBeUndefined(); + expect(keyring.ledgerSigner.getStatus().connected).toBe(true); + const manager = (keyring.ledgerSigner as any).sharedHardwareWalletManager; + expect(manager).toBeInstanceOf(HardwareWalletManager); + expect(manager.isConnected('ledger')).toBe(true); + } finally { + await keyring.destroy(); + } + expect(host.disconnect).toHaveBeenCalled(); +}); + +const signingWallet = new Wallet(`0x${'11'.repeat(32)}`); +const otherWallet = new Wallet(`0x${'22'.repeat(32)}`); +const tx = (value = 1, chainId = 1) => + Transaction.from({ + type: 2, + chainId, + nonce: 3, + gasLimit: 21000, + maxFeePerGas: 10, + maxPriorityFeePerGas: 1, + to: otherWallet.address, + value, + }); +const fields = ( + signature: ReturnType +) => ({ + r: signature.r.slice(2), + s: signature.s.slice(2), + v: signature.v.toString(16), +}); +const typed = () => ({ + domain: { name: 'Public fixture', chainId: 1 }, + types: { + EIP712Domain: [ + { name: 'name', type: 'string' }, + { name: 'chainId', type: 'uint256' }, + ], + Message: [{ name: 'value', type: 'string' }], + }, + primaryType: 'Message', + message: { value: 'approved' }, +}); +const typedHash = ( + data: any, + version: SignTypedDataVersion.V3 | SignTypedDataVersion.V4 +) => `0x${TypedDataUtils.eip712Hash(data, version).toString('hex')}`; +const cryptoHost = () => { + const host = hostFixture(); + host.evm = { + getAddress: jest.fn(async () => ({ + address: signingWallet.address, + publicKey: signingWallet.signingKey.publicKey, + })), + signTransaction: jest.fn(async ({ unsignedTxHex }) => + fields( + signingWallet.signingKey.sign( + Transaction.from(`0x${unsignedTxHex}`).unsignedHash + ) + ) + ), + signPersonalMessage: jest.fn(async ({ messageHex }) => + signingWallet.signMessage(Buffer.from(messageHex, 'hex')) + ), + signTypedData: jest.fn( + async ({ data, version }) => + signingWallet.signingKey.sign( + typedHash( + data, + version as SignTypedDataVersion.V3 | SignTypedDataVersion.V4 + ) + ).serialized + ), + }; + return { host, ledger: new LedgerKeyring(undefined, host) }; +}; + +test('validates address/public-key equality at the authority boundary', async () => { + const { host, ledger } = cryptoHost(); + await expect( + ledger.evm.getEvmAddressAndPubKey({ accountIndex: 0 }) + ).resolves.toEqual({ + address: signingWallet.address, + publicKey: signingWallet.signingKey.publicKey.slice(2), + }); + (host.evm.getAddress as jest.Mock).mockResolvedValueOnce({ + address: signingWallet.address, + publicKey: otherWallet.signingKey.publicKey, + }); + await expect( + ledger.evm.getEvmAddressAndPubKey({ accountIndex: 0 }) + ).rejects.toMatchObject({ code: 'LEDGER_INVALID_RESPONSE' }); +}); + +test.each(['valid', 'wrong-account', 'different-transaction', 'wrong-chain-v'])( + 'validates the approved transaction signature (%s)', + async (response) => { + const { host, ledger } = cryptoHost(); + const approved = tx(); + if (response === 'wrong-account') + (host.evm.signTransaction as jest.Mock).mockResolvedValueOnce( + fields(otherWallet.signingKey.sign(approved.unsignedHash)) + ); + if (response === 'different-transaction') + (host.evm.signTransaction as jest.Mock).mockResolvedValueOnce( + fields(signingWallet.signingKey.sign(tx(2).unsignedHash)) + ); + if (response === 'wrong-chain-v') { + const signature = fields( + signingWallet.signingKey.sign(approved.unsignedHash) + ); + signature.v = (Number.parseInt(signature.v, 16) + 12).toString(16); // EIP155 chain 2, approved chain 1. + (host.evm.signTransaction as jest.Mock).mockResolvedValueOnce(signature); + } + const pending = ledger.evm.signEVMTransaction({ + accountIndex: 0, + expectedAddress: signingWallet.address, + rawTx: approved.unsignedSerialized, + }); + if (response === 'valid') + await expect(pending).resolves.toEqual( + fields(signingWallet.signingKey.sign(approved.unsignedHash)) + ); + else + await expect(pending).rejects.toMatchObject({ + code: 'LEDGER_INVALID_SIGNATURE', + }); + } +); + +test.each(['', '00ff80', Buffer.from('Pali 💚').toString('hex')])( + 'verifies exact personal-message bytes %s', + async (message) => { + const { ledger } = cryptoHost(); + await expect( + ledger.evm.signPersonalMessage({ + accountIndex: 0, + expectedAddress: signingWallet.address, + message, + }) + ).resolves.toBe( + await signingWallet.signMessage(Buffer.from(message, 'hex')) + ); + } +); + +test.each(['wrong-account', 'wrong-bytes'])( + 'rejects a personal signature for %s', + async (response) => { + const { host, ledger } = cryptoHost(); + (host.evm.signPersonalMessage as jest.Mock).mockResolvedValueOnce( + (response === 'wrong-account' + ? otherWallet + : signingWallet + ).signingKey.sign( + hashMessage( + Buffer.from(response === 'wrong-bytes' ? '00' : 'ff', 'hex') + ) + ).serialized + ); + await expect( + ledger.evm.signPersonalMessage({ + accountIndex: 0, + expectedAddress: signingWallet.address, + message: 'ff', + }) + ).rejects.toMatchObject({ code: 'LEDGER_INVALID_SIGNATURE' }); + } +); + +test.each([SignTypedDataVersion.V3, SignTypedDataVersion.V4])( + 'validates %s typed-data signature and rejects a different payload', + async (version) => { + const { host, ledger } = cryptoHost(); + const data = typed(); + await expect( + ledger.evm.signTypedData({ + accountIndex: 0, + expectedAddress: signingWallet.address, + version, + data, + }) + ).resolves.toBe( + signingWallet.signingKey.sign(typedHash(data, version)).serialized + ); + (host.evm.signTypedData as jest.Mock).mockResolvedValueOnce( + signingWallet.signingKey.sign( + typedHash({ ...data, message: { value: 'different' } }, version) + ).serialized + ); + await expect( + ledger.evm.signTypedData({ + accountIndex: 0, + expectedAddress: signingWallet.address, + version, + data, + }) + ).rejects.toMatchObject({ code: 'LEDGER_INVALID_SIGNATURE' }); + } +); + +test('captures typed data before pending connection and exposes no mutable approval object', async () => { + const { host, ledger } = cryptoHost(); + let complete!: () => void; + host.getStatus = () => ({ connected: false }); + host.connect = jest.fn( + () => + new Promise((resolve) => { + complete = resolve; + }) + ); + const data = typed(); + const pending = ledger.evm.signTypedData({ + accountIndex: 0, + expectedAddress: signingWallet.address, + version: SignTypedDataVersion.V4, + data, + }); + data.message.value = 'changed after request'; + complete(); + await pending; + const approved = (host.evm.signTypedData as jest.Mock).mock.calls[0][0].data; + expect(approved.message.value).toBe('approved'); + expect(Object.isFrozen(approved.message)).toBe(true); +}); + +test.each(['signPsbt', 'signUtxoMessage'] as const)( + 'captures %s request fields before a pending connection', + async (method) => { + const host = hostFixture(); + const ledger = new LedgerKeyring(undefined, host); + let complete!: () => void; + host.getStatus = () => ({ connected: false }); + host.connect = jest.fn( + () => + new Promise((resolve) => { + complete = resolve; + }) + ); + const request = { + currency: 'tSYS', + slip44: 1, + accountIndex: 0, + accountXpub: 'approved account xpub', + ...(method === 'signPsbt' + ? { psbtBase64: 'approved psbt' } + : { message: 'approved message', addressIndex: 2, change: false }), + }; + const expected = { ...request }; + const sign: jest.Mock = jest.fn(async () => { + return method === 'signPsbt' + ? { fingerprint: '01020304', signatures: [] } + : 'signature'; + }); + if (method === 'signPsbt') host.utxo.signPsbt = sign as any; + else host.utxo.signMessage = sign as any; + const pending = ledger[method](request as any); + Object.assign(request, { + currency: 'BTC', + slip44: 0, + accountIndex: 1, + accountXpub: 'replaced account xpub', + psbtBase64: 'replaced psbt', + message: 'replaced message', + addressIndex: 7, + change: true, + }); + complete(); + await pending; + expect(sign).toHaveBeenCalledWith(expected); + expect(Object.isFrozen(sign.mock.calls[0][0])).toBe(true); + } +); + +test('discards a queued valid personal signature after synchronous destruction', async () => { + const { host, ledger } = cryptoHost(); + let complete!: (signature: string) => void; + (host.evm.signPersonalMessage as jest.Mock).mockReturnValue( + new Promise((resolve) => { + complete = resolve; + }) + ); + const pending = ledger.evm.signPersonalMessage({ + accountIndex: 0, + expectedAddress: signingWallet.address, + message: 'ff', + }); + const rejected = expect(pending).rejects.toMatchObject({ + code: 'HARDWARE_REQUEST_CANCELLED', + }); + await ledger.destroy(); + complete( + signingWallet.signingKey.sign(hashMessage(Buffer.from('ff', 'hex'))) + .serialized + ); + await rejected; +}); diff --git a/packages/sysweb3-keyring/test/unit/hardware/ledger-dmk-evm.spec.ts b/packages/sysweb3-keyring/test/unit/hardware/ledger-dmk-evm.spec.ts new file mode 100644 index 00000000..1fc50239 --- /dev/null +++ b/packages/sysweb3-keyring/test/unit/hardware/ledger-dmk-evm.spec.ts @@ -0,0 +1,471 @@ +import { TypedDataUtils, SignTypedDataVersion } from '@metamask/eth-sig-util'; +import { hashMessage, Signature, Transaction, Wallet } from 'ethers'; + +import { + createLedgerEvmAdapter, + offlineLedgerContext, +} from '../../../src/ledger/dmk-evm'; +import { + ledgerCancelledError, + type LedgerTypedData, +} from '../../../src/ledger/host-types'; + +import type { LedgerDmkSession } from '../../../src/ledger/dmk-session'; + +const mockContexts: unknown[] = []; +const mockSigner = { + getAddress: jest.fn(), + signTransaction: jest.fn(), + signMessage: jest.fn(), + signTypedData: jest.fn(), +}; +jest.mock( + '@ledgerhq/device-signer-kit-ethereum', + () => ({ + SignerEthBuilder: class { + withContextModule(context: unknown) { + mockContexts.push(context); + return this; + } + build() { + return mockSigner; + } + }, + }), + { virtual: true } +); +jest.mock( + '@ledgerhq/context-module', + () => ({ + ClearSignContextType: { ERROR: 'error' }, + }), + { virtual: true } +); + +// Public synthetic key used only to verify fixture signatures locally. +const wallet = new Wallet(`0x${'11'.repeat(32)}`); +const address = wallet.address; +const publicKey = wallet.signingKey.publicKey.slice(2); +const typed = (): LedgerTypedData => ({ + domain: { + name: 'Public fixture', + version: '1', + chainId: 57, + verifyingContract: `0x${'22'.repeat(20)}`, + }, + types: { + EIP712Domain: [ + { name: 'name', type: 'string' }, + { name: 'version', type: 'string' }, + { name: 'chainId', type: 'uint256' }, + { name: 'verifyingContract', type: 'address' }, + ], + Request: [ + { name: 'memo', type: 'string' }, + { name: 'value', type: 'uint256' }, + ], + }, + primaryType: 'Request', + message: { memo: 'Unicode 雪', value: '123456789012345678901234567890' }, +}); +const rawTransaction = (type = 2) => + Transaction.from({ + type, + chainId: 57, + nonce: 3, + to: `0x${'22'.repeat(20)}`, + value: 123n, + gasLimit: 21000n, + ...(type === 0 + ? { gasPrice: 3n } + : { maxFeePerGas: 5n, maxPriorityFeePerGas: 2n }), + }).unsignedSerialized; +const typedDigest = (data: LedgerTypedData, version: 'V3' | 'V4') => + `0x${TypedDataUtils.eip712Hash( + data as any, + version as SignTypedDataVersion.V3 | SignTypedDataVersion.V4 + ).toString('hex')}`; + +const session = () => { + let current = true; + const controller = new AbortController(); + const assertCurrent = () => { + if (!current || controller.signal.aborted) throw ledgerCancelledError(); + }; + const runExclusive = jest.fn(async (run: any) => + run({ + dmk: {}, + sessionId: 'public-fixture', + generation: 1, + signal: controller.signal, + assertCurrent, + runAction: async (createAction: () => Promise) => { + assertCurrent(); + const result = await createAction(); + assertCurrent(); + return result; + }, + }) + ); + return { + value: { runExclusive } as unknown as LedgerDmkSession, + runExclusive, + signal: controller.signal, + cancel: () => { + current = false; + controller.abort(); + }, + }; +}; + +beforeEach(() => { + jest.clearAllMocks(); + mockContexts.length = 0; + mockSigner.getAddress.mockResolvedValue({ address, publicKey }); + mockSigner.signTransaction.mockImplementation( + async (_path: string, bytes: Uint8Array) => { + const tx = Transaction.from(`0x${Buffer.from(bytes).toString('hex')}`); + const signature = wallet.signingKey.sign(tx.unsignedHash); + return { + r: signature.r, + s: signature.s, + v: + tx.type === 0 + ? Number(tx.chainId) * 2 + 35 + signature.yParity + : signature.yParity, + }; + } + ); + mockSigner.signMessage.mockImplementation( + async (_path: string, bytes: Uint8Array) => { + const signature = Signature.from(await wallet.signMessage(bytes)); + return { r: signature.r, s: signature.s, v: signature.v }; + } + ); + mockSigner.signTypedData.mockImplementation( + async (_path: string, data: LedgerTypedData) => { + const signature = wallet.signingKey.sign(typedDigest(data, 'V4')); + return { r: signature.r, s: signature.s, v: signature.v }; + } + ); +}); + +it('preserves address-index derivation and validates the returned public key', async () => { + const host = createLedgerEvmAdapter(session().value); + await expect( + host.getAddress({ accountIndex: 3, checkOnDevice: true, chainId: 57 }) + ).resolves.toEqual({ address, publicKey }); + expect(mockSigner.getAddress).toHaveBeenCalledWith("44'/60'/0'/0/3", { + checkOnDevice: true, + chainId: 57, + }); + mockSigner.getAddress.mockResolvedValueOnce({ + address, + publicKey: `04${'00'.repeat(64)}`, + }); + await expect(host.getAddress({ accountIndex: 0 })).rejects.toMatchObject({ + code: 'LEDGER_INVALID_RESPONSE', + }); +}); + +it('denies transaction and typed signing without trusted per-operation approval', async () => { + const current = session(); + const host = createLedgerEvmAdapter(current.value); + await expect( + host.signTransaction({ + accountIndex: 0, + expectedAddress: address, + unsignedTxHex: rawTransaction(), + }) + ).rejects.toMatchObject({ code: 'HARDWARE_CLEAR_SIGNING_UNAVAILABLE' }); + await expect( + host.signTypedData({ + accountIndex: 0, + expectedAddress: address, + data: typed(), + version: 'V4', + }) + ).rejects.toMatchObject({ code: 'HARDWARE_CLEAR_SIGNING_UNAVAILABLE' }); + expect(current.runExclusive).not.toHaveBeenCalled(); + expect(mockSigner.signTransaction).not.toHaveBeenCalled(); + expect(mockSigner.signTypedData).not.toHaveBeenCalled(); +}); + +it('does not sign when the trusted host declines its exact frozen intent', async () => { + const current = session(); + const approve = jest.fn(async (intent, signal) => { + expect(intent.unsignedTxHex).toBe(rawTransaction()); + expect(intent.derivationPath).toBe("44'/60'/0'/0/4"); + expect(intent.expectedAddress).toBe(address); + expect(signal).toBe(current.signal); + expect(Object.isFrozen(intent)).toBe(true); + return false; + }); + const host = createLedgerEvmAdapter(current.value, { + confirmBlindSigning: approve, + }); + await expect( + host.signTransaction({ + accountIndex: 4, + expectedAddress: address, + unsignedTxHex: rawTransaction(), + }) + ).rejects.toMatchObject({ code: 'HARDWARE_CLEAR_SIGNING_UNAVAILABLE' }); + expect(approve).toHaveBeenCalledTimes(1); + expect(mockSigner.signTransaction).not.toHaveBeenCalled(); +}); + +it.each([0, 2])( + 'retains legacy facade signature encoding for transaction type %s', + async (type) => { + const approve = jest.fn(async () => true); + const host = createLedgerEvmAdapter(session().value, { + confirmBlindSigning: approve, + }); + const result = await host.signTransaction({ + accountIndex: 2, + expectedAddress: address, + unsignedTxHex: rawTransaction(type), + }); + expect(result.r).toMatch(/^[0-9a-f]{64}$/); + expect(result.s).toMatch(/^[0-9a-f]{64}$/); + const expected = wallet.signingKey.sign( + Transaction.from(rawTransaction(type)).unsignedHash + ); + expect(parseInt(result.v, 16)).toBe( + type === 0 ? 57 * 2 + 35 + expected.yParity : expected.yParity + ); + expect(mockSigner.signTransaction).toHaveBeenCalledWith( + "44'/60'/0'/0/2", + expect.any(Uint8Array) + ); + expect(approve).toHaveBeenCalledTimes(1); + } +); + +it.each([ + '', + '00fffe80', + Buffer.from('Unicode 雪 / \u0000', 'utf8').toString('hex'), +])('signs the exact personal-message bytes %s offline', async (messageHex) => { + const host = createLedgerEvmAdapter(session().value); + const result = await host.signPersonalMessage({ + accountIndex: 1, + expectedAddress: address, + messageHex, + }); + expect(result).toBe(await wallet.signMessage(Buffer.from(messageHex, 'hex'))); + expect(mockSigner.signMessage).toHaveBeenCalledWith( + "44'/60'/0'/0/1", + Uint8Array.from(Buffer.from(messageHex, 'hex')) + ); + expect(hashMessage(Buffer.from(messageHex, 'hex'))).toMatch( + /^0x[0-9a-f]{64}$/ + ); + expect(mockContexts).toEqual([offlineLedgerContext]); +}); + +it('has no remote metadata or reporting behavior in the default context', async () => { + const fetch = jest + .spyOn(globalThis, 'fetch') + .mockRejectedValue(new Error('Network forbidden')); + await expect(offlineLedgerContext.getContexts({}, [])).resolves.toEqual([]); + await expect( + offlineLedgerContext.getFieldContext({}, 'error' as any) + ).resolves.toMatchObject({ type: 'error' }); + await expect( + offlineLedgerContext.getTypedDataFilters({} as any) + ).resolves.toMatchObject({ type: 'error' }); + await offlineLedgerContext.report({} as any); + await offlineLedgerContext.signReport?.({} as any); + expect(fetch).not.toHaveBeenCalled(); + fetch.mockRestore(); +}); + +it.each(['V3', 'V4'] as const)( + 'preserves typed-data %s digest and protects caller data from mutation', + async (version) => { + const data = typed(); + const before = JSON.stringify(data); + const approve = jest.fn(async (intent) => { + expect(intent.digest).toBe(typedDigest(data, version)); + expect(Object.isFrozen(intent.data.message)).toBe(true); + return true; + }); + mockSigner.signTypedData.mockImplementationOnce( + async (_path, deviceData) => { + const signature = wallet.signingKey.sign( + typedDigest(deviceData, version) + ); + deviceData.types.AddedByDevice = []; + return { r: signature.r, s: signature.s, v: signature.v }; + } + ); + const host = createLedgerEvmAdapter(session().value, { + confirmBlindSigning: approve, + }); + const result = await host.signTypedData({ + accountIndex: 0, + expectedAddress: address, + version, + data, + }); + expect(result).toBe( + wallet.signingKey.sign(typedDigest(data, version)).serialized + ); + expect(JSON.stringify(data)).toBe(before); + expect(approve).toHaveBeenCalledTimes(1); + } +); + +it('rejects V3 arrays, unsupported versions and malformed bytes before any signing action', async () => { + const host = createLedgerEvmAdapter(session().value, { + confirmBlindSigning: async () => true, + }); + const data = typed(); + data.types.Request = [{ name: 'values', type: 'uint256[]' }]; + data.message = { values: ['1', '2'] }; + await expect( + host.signTypedData({ + accountIndex: 0, + expectedAddress: address, + version: 'V3', + data, + }) + ).rejects.toMatchObject({ code: 'LEDGER_INVALID_REQUEST' }); + await expect( + host.signTypedData({ + accountIndex: 0, + expectedAddress: address, + version: 'V1' as any, + data, + }) + ).rejects.toMatchObject({ code: 'LEDGER_INVALID_REQUEST' }); + await expect( + host.signPersonalMessage({ + accountIndex: 0, + expectedAddress: address, + messageHex: '0x123', + }) + ).rejects.toMatchObject({ code: 'LEDGER_INVALID_REQUEST' }); + expect(mockSigner.signTypedData).not.toHaveBeenCalled(); + expect(mockSigner.signMessage).not.toHaveBeenCalled(); +}); + +it('does not create a signing action after cancellation while host approval is pending', async () => { + const current = session(); + let approve!: (value: boolean) => void; + let notify!: () => void; + const started = new Promise((resolve) => { + notify = resolve; + }); + const host = createLedgerEvmAdapter(current.value, { + confirmBlindSigning: () => { + notify(); + return new Promise((done) => { + approve = done; + }); + }, + }); + const pending = host.signTransaction({ + accountIndex: 0, + expectedAddress: address, + unsignedTxHex: rawTransaction(), + }); + await started; + current.cancel(); + approve(true); + await expect(pending).rejects.toMatchObject({ + code: 'HARDWARE_REQUEST_CANCELLED', + }); + expect(mockSigner.signTransaction).not.toHaveBeenCalled(); +}); + +it('rejects mismatched device identity and a signature from a different key', async () => { + const host = createLedgerEvmAdapter(session().value, { + confirmBlindSigning: async () => true, + }); + await expect( + host.signPersonalMessage({ + accountIndex: 0, + expectedAddress: new Wallet(`0x${'22'.repeat(32)}`).address, + messageHex: '01', + }) + ).rejects.toMatchObject({ code: 'HARDWARE_ACCOUNT_MISMATCH' }); + expect(mockSigner.signMessage).not.toHaveBeenCalled(); + const other = new Wallet(`0x${'22'.repeat(32)}`); + mockSigner.signMessage.mockResolvedValueOnce( + Signature.from(await other.signMessage(Uint8Array.of(1))) + ); + await expect( + host.signPersonalMessage({ + accountIndex: 0, + expectedAddress: address, + messageHex: '01', + }) + ).rejects.toMatchObject({ code: 'LEDGER_INVALID_SIGNATURE' }); +}); + +it('asks the trusted host again for each operation instead of caching approval', async () => { + const confirmBlindSigning = jest.fn(async () => true); + const host = createLedgerEvmAdapter(session().value, { confirmBlindSigning }); + const request = { + accountIndex: 0, + expectedAddress: address, + unsignedTxHex: rawTransaction(), + }; + await host.signTransaction(request); + await host.signTransaction(request); + expect(confirmBlindSigning).toHaveBeenCalledTimes(2); + expect(mockSigner.signTransaction).toHaveBeenCalledTimes(2); +}); + +it('does not let a caller replace the payload while trusted approval is pending', async () => { + let accept!: (value: boolean) => void; + let ready!: () => void; + const started = new Promise((resolve) => { + ready = resolve; + }); + const request = { + accountIndex: 0, + expectedAddress: address, + unsignedTxHex: rawTransaction(0), + }; + const original = request.unsignedTxHex; + const host = createLedgerEvmAdapter(session().value, { + confirmBlindSigning: async (intent) => { + expect(intent.kind).toBe('transaction'); + expect(Object.isFrozen(intent)).toBe(true); + ready(); + return new Promise((resolve) => { + accept = resolve; + }); + }, + }); + const pending = host.signTransaction(request); + await started; + request.accountIndex = 9; + request.unsignedTxHex = rawTransaction(2); + accept(true); + await pending; + expect(mockSigner.signTransaction).toHaveBeenCalledWith( + "44'/60'/0'/0/0", + Uint8Array.from(Buffer.from(original.slice(2), 'hex')) + ); +}); + +it('rejects malformed signature fields instead of exposing a partially formatted signature', async () => { + const host = createLedgerEvmAdapter(session().value); + mockSigner.signMessage.mockResolvedValueOnce({ + r: '0x01', + s: `0x${'22'.repeat(32)}`, + v: 27, + }); + await expect( + host.signPersonalMessage({ + accountIndex: 0, + expectedAddress: address, + messageHex: '01', + }) + ).rejects.toMatchObject({ code: 'LEDGER_INVALID_SIGNATURE' }); +}); diff --git a/packages/sysweb3-keyring/test/unit/hardware/ledger-dmk-session.spec.ts b/packages/sysweb3-keyring/test/unit/hardware/ledger-dmk-session.spec.ts new file mode 100644 index 00000000..49491a49 --- /dev/null +++ b/packages/sysweb3-keyring/test/unit/hardware/ledger-dmk-session.spec.ts @@ -0,0 +1,171 @@ +import { of, Subject } from 'rxjs'; + +import { LedgerDmkSession } from '../../../src/ledger/dmk-session'; + +const tick = async () => { + await Promise.resolve(); + await Promise.resolve(); +}; +const mockDmk = () => { + const state = new Subject(); + const discovered = new Subject(); + const dmk = { + startDiscovering: jest.fn(() => + of({ id: 'selected', transport: 'WEB-HID' }) + ), + listenToAvailableDevices: jest.fn(() => discovered), + connect: jest.fn().mockResolvedValue('session'), + disconnect: jest.fn().mockResolvedValue(undefined), + getDeviceSessionState: jest.fn(() => state), + }; + return { dmk, state, discovered, session: new LedgerDmkSession(dmk as any) }; +}; + +describe('Ledger DMK session ownership', () => { + it('connects the selected device and refuses concurrent pickers', async () => { + const { dmk, session } = mockDmk(); + const pending = new Subject(); + dmk.startDiscovering.mockReturnValue(pending as any); + const connection = session.connect(); + await expect(session.connect()).rejects.toMatchObject({ + code: 'HARDWARE_SIGNER_BUSY', + }); + pending.next({ id: 'chosen', transport: 'WEB-HID' }); + await connection; + expect(dmk.connect).toHaveBeenCalledWith({ + device: { id: 'chosen', transport: 'WEB-HID' }, + }); + await session.disconnect(); + }); + + it('waits past the initial empty granted-device emission and rejects ambiguity', async () => { + const { dmk, discovered, session } = mockDmk(); + const connection = session.connect({ useGrantedDevices: true }); + discovered.next([]); + expect(dmk.connect).not.toHaveBeenCalled(); + discovered.next([{ id: 'one' }, { id: 'two' }]); + await expect(connection).rejects.toMatchObject({ + code: 'HARDWARE_SIGNER_AMBIGUOUS', + }); + expect(dmk.startDiscovering).not.toHaveBeenCalled(); + }); + + it('serializes complete operations rather than their individual APDUs', async () => { + const { session } = mockDmk(); + await session.connect(); + const first = new Subject(); + const second = new Subject(); + const createFirst = jest.fn(() => ({ + observable: first, + cancel: jest.fn(), + })); + const createSecond = jest.fn(() => ({ + observable: second, + cancel: jest.fn(), + })); + const p1 = session.runAction(createFirst); + const p2 = session.runAction(createSecond); + await tick(); + expect(createFirst).toHaveBeenCalledTimes(1); + expect(createSecond).not.toHaveBeenCalled(); + first.next({ status: 'completed', output: 'first' }); + await expect(p1).resolves.toBe('first'); + await tick(); + expect(createSecond).toHaveBeenCalledTimes(1); + second.next({ status: 'completed', output: 'second' }); + await expect(p2).resolves.toBe('second'); + await session.disconnect(); + }); + + it('aborts active I/O, ignores late output, and revokes queued requests', async () => { + const { session, dmk } = mockDmk(); + await session.connect(); + const result = new Subject(); + const cancel = jest.fn(); + const signal = new AbortController(); + const first = session.runAction(() => ({ observable: result, cancel }), { + signal: signal.signal, + }); + const queuedFactory = jest.fn(() => ({ + observable: of({ status: 'completed' as const, output: 'stale' }), + cancel: jest.fn(), + })); + const queued = session.runAction(queuedFactory); + await tick(); + signal.abort(); + result.next({ status: 'completed', output: 'late signature' }); + await expect(first).rejects.toMatchObject({ + code: 'HARDWARE_REQUEST_CANCELLED', + }); + await expect(queued).rejects.toMatchObject({ + code: 'HARDWARE_REQUEST_CANCELLED', + }); + expect(cancel).toHaveBeenCalledTimes(1); + expect(dmk.disconnect).toHaveBeenCalledTimes(1); + expect(queuedFactory).not.toHaveBeenCalled(); + }); + + it('never creates a new device action from a cancelled async continuation', async () => { + const { session } = mockDmk(); + await session.connect(); + let release!: () => void; + const gate = new Promise((resolve) => { + release = resolve; + }); + const factory = jest.fn(() => ({ + observable: of({ status: 'completed' as const, output: 'bad' }), + cancel: jest.fn(), + })); + const pending = session.runExclusive(async (operation) => { + await gate; + return operation.runAction(factory); + }); + await tick(); + await session.disconnect(); + release(); + await expect(pending).rejects.toMatchObject({ + code: 'HARDWARE_REQUEST_CANCELLED', + }); + await tick(); + expect(factory).not.toHaveBeenCalled(); + }); + + it('rejects an observable that completes without a terminal result', async () => { + const { session } = mockDmk(); + await session.connect(); + const result = new Subject(); + const pending = session.runAction(() => ({ + observable: result, + cancel: jest.fn(), + })); + await tick(); + result.complete(); + await expect(pending).rejects.toMatchObject({ + code: 'LEDGER_INCOMPLETE_ACTION', + }); + await session.disconnect(); + }); + + it('closes the session if a progress consumer fails, without recursive cancellation', async () => { + const { session, dmk } = mockDmk(); + await session.connect(); + const result = new Subject(); + const cancel = jest.fn(() => result.next({ status: 'stopped' })); + const pending = session.runAction(() => ({ observable: result, cancel }), { + onProgress: () => { + throw new Error('closed UI'); + }, + }); + await tick(); + result.next({ + status: 'pending', + intermediateValue: { requiredUserInteraction: 'sign-transaction' }, + }); + await expect(pending).rejects.toMatchObject({ + code: 'HARDWARE_REQUEST_CANCELLED', + }); + expect(cancel).toHaveBeenCalledTimes(1); + expect(dmk.disconnect).toHaveBeenCalledTimes(1); + expect(session.getStatus().connected).toBe(false); + }); +}); diff --git a/packages/sysweb3-keyring/test/unit/hardware/ledger-dmk-utxo.spec.ts b/packages/sysweb3-keyring/test/unit/hardware/ledger-dmk-utxo.spec.ts new file mode 100644 index 00000000..0cf32554 --- /dev/null +++ b/packages/sysweb3-keyring/test/unit/hardware/ledger-dmk-utxo.spec.ts @@ -0,0 +1,469 @@ +import { + ApduResponse, + isSuccessCommandResult, +} from '@ledgerhq/device-management-kit'; +import { getNetworkConfig } from '@sidhujag/sysweb3-network'; +import { payments, Psbt, Transaction } from 'bitcoinjs-lib'; +import { from } from 'rxjs'; + +import { AppClient } from '../../../src/ledger/bitcoin_client/lib/appClient'; +import { + createBitcoinAppTransport, + LedgerBitcoinCommand, + ledgerUtxoApp, + createLedgerUtxoAdapter, +} from '../../../src/ledger/dmk-utxo'; + +jest.unmock('syscoinjs-lib'); + +const response = (data: number[], status: number) => + new ApduResponse({ + data: Uint8Array.from(data), + statusCode: Uint8Array.of(status >> 8, status & 255), + }); + +describe('Ledger DMK Syscoin/Bitcoin APDU adapter', () => { + it('preserves exact short APDUs and response status bytes', async () => { + const command = new LedgerBitcoinCommand( + 0xe1, + 4, + 0, + 1, + Uint8Array.of(1, 2, 3), + [0x9000, 0xe000] + ); + expect(Buffer.from(command.getApdu().getRawApdu()).toString('hex')).toBe( + 'e104000103010203' + ); + const parsed = command.parseResponse(response([5, 6], 0xe000)); + expect(isSuccessCommandResult(parsed)).toBe(true); + if (isSuccessCommandResult(parsed)) + expect(parsed.data.toString('hex')).toBe('0506e000'); + expect(() => + new LedgerBitcoinCommand(0xe1, 4, 0, 1, new Uint8Array(256)).getApdu() + ).toThrow(); + }); + + it('preserves user rejection as a non-success status without retrying', async () => { + const sendCommand = jest.fn(async (command) => + command.parseResponse(response([], 0x6985)) + ); + const transport = createBitcoinAppTransport( + { sendCommand } as any, + () => undefined + ); + await expect(transport.send(0xe1, 5, 0, 1)).rejects.toMatchObject({ + statusCode: 0x6985, + code: 'HARDWARE_REQUEST_REJECTED', + }); + expect(sendCommand).toHaveBeenCalledTimes(1); + }); + + it('continues an interrupted exchange in the same internal API', async () => { + const raw: string[] = []; + const sendCommand = jest.fn(async (command) => { + raw.push(Buffer.from(command.getApdu().getRawApdu()).toString('hex')); + return command.parseResponse( + raw.length === 1 ? response([0x40], 0xe000) : response([0xaa], 0x9000) + ); + }); + const client = new AppClient( + createBitcoinAppTransport({ sendCommand } as any, () => undefined) + ); + const execute = jest.fn(() => Buffer.from([0x55])); + const result = await (client as any).makeRequest(4, Buffer.from([0x22]), { + execute, + }); + expect(result.toString('hex')).toBe('aa'); + expect(execute).toHaveBeenCalledWith(Buffer.from([0x40])); + expect(raw).toEqual(['e10400010122', 'f80100000155']); + }); + + it('does not issue a continuation APDU when its generation was revoked', async () => { + let current = true; + const sendCommand = jest.fn(async (command) => { + current = false; + return command.parseResponse(response([0x40], 0xe000)); + }); + const client = new AppClient( + createBitcoinAppTransport({ sendCommand } as any, () => { + if (!current) throw new Error('revoked'); + }) + ); + await expect( + (client as any).makeRequest(4, Buffer.from([]), { execute: jest.fn() }) + ).rejects.toThrow('revoked'); + expect(sendCommand).toHaveBeenCalledTimes(1); + }); + + it('selects Syscoin and the explicit Bitcoin main/test applications', () => { + expect( + ledgerUtxoApp({ currency: 'SYS', slip44: 57, accountIndex: 0 }) + ).toBe('Syscoin'); + expect(ledgerUtxoApp({ currency: 'SYS', slip44: 1, accountIndex: 0 })).toBe( + 'Syscoin' + ); + expect(ledgerUtxoApp({ currency: 'BTC', slip44: 0, accountIndex: 0 })).toBe( + 'Bitcoin' + ); + expect(ledgerUtxoApp({ currency: 'BTC', slip44: 1, accountIndex: 0 })).toBe( + 'Bitcoin Test' + ); + expect(() => + ledgerUtxoApp({ currency: 'SYS', slip44: 60, accountIndex: 0 }) + ).toThrow(); + expect(() => + ledgerUtxoApp({ currency: 'SYS', slip44: 57, accountIndex: -1 }) + ).toThrow(); + }); + + const signingFixture = (currency = 'tSYS', slip44 = 1) => { + const config = getNetworkConfig(slip44, currency); + const actual = jest.requireActual('syscoinjs-lib'); + const hd = new actual.utils.HDSigner( + 'abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about', + null, + slip44 === 1, + config.networks, + slip44, + config.types.zPubType, + 84 + ); + const root = hd.getRootNode(); + const key = root.derivePath(`m/84'/${slip44}'/0'/0/0`); + const payment = payments.p2wpkh({ + pubkey: key.publicKey, + network: slip44 === 1 ? config.networks.testnet : config.networks.mainnet, + }); + const previous = new Transaction(); + previous.addInput(Buffer.alloc(32), 0xffffffff); + previous.addOutput(payment.output!, 100000n); + const psbt = new Psbt({ + network: slip44 === 1 ? config.networks.testnet : config.networks.mainnet, + }); + psbt.addInput({ + hash: previous.getId(), + index: 0, + nonWitnessUtxo: previous.toBuffer(), + witnessUtxo: { script: payment.output!, value: 100000n }, + }); + psbt.addUnknownKeyValToInput(0, { + key: Buffer.from('path'), + value: Buffer.from(`m/84'/${slip44}'/0'/0/0`), + }); + psbt.addOutput({ address: payment.address!, value: 99000n }); + const actions: any[] = []; + const operation = { + generation: 1, + sessionId: 'session', + assertCurrent: jest.fn(), + dmk: { + executeDeviceAction: jest.fn(({ deviceAction }) => { + actions.push(deviceAction); + return { + observable: from( + deviceAction.input.task({}).then((result: any) => { + return result.status === 'SUCCESS' + ? { status: 'completed', output: result.data } + : { status: 'error', error: result.error }; + }) + ), + cancel: jest.fn(), + }; + }), + }, + runAction: async (createAction: () => any) => { + const action = createAction(); + return new Promise((resolve, reject) => + action.observable.subscribe({ + next: (state: any) => { + if (state.status === 'completed') resolve(state.output); + else reject(state.error); + }, + error: reject, + }) + ); + }, + }; + const session: any = { + onInvalidated: jest.fn(), + runExclusive: async (run: any) => run(operation), + }; + const adapter = createLedgerUtxoAdapter(session); + return { + adapter, + actions, + operation, + key, + address: payment.address!, + request: { + currency, + slip44, + accountIndex: 0, + accountXpub: hd.getAccountXpub(), + psbtBase64: psbt.toBase64(), + }, + }; + }; + + describe.each([ + ['SYS', 57], + ['tSYS', 1], + ['BTC', 0], + ['tBTC', 1], + ])('%s account addresses', (currency, slip44) => { + it.each(['getAddress', 'getAccount'] as const)( + '%s binds the device response to receive address 0/0', + async (method) => { + const { adapter, request, address } = signingFixture( + currency as string, + slip44 as number + ); + const fingerprint = jest + .spyOn(AppClient.prototype, 'getMasterFingerprint') + .mockResolvedValue('01020304'); + const xpub = jest + .spyOn(AppClient.prototype, 'getExtendedPubkey') + .mockResolvedValue(request.accountXpub); + const registration = jest + .spyOn(AppClient.prototype, 'registerWallet') + .mockImplementation(async (policy) => [ + policy.getId(), + Buffer.alloc(32, 0x55), + ]); + const deviceAddress = jest + .spyOn(AppClient.prototype, 'getWalletAddress') + .mockResolvedValue(address.toUpperCase()); + try { + const output = await adapter[method]({ + currency: request.currency, + slip44: request.slip44, + accountIndex: request.accountIndex, + checkOnDevice: true, + }); + expect(output).toEqual( + method === 'getAddress' + ? address + : { fingerprint: '01020304', xpub: request.accountXpub, address } + ); + expect(deviceAddress).toHaveBeenCalledWith( + expect.anything(), + Buffer.alloc(32, 0x55), + 0, + 0, + true + ); + } finally { + fingerprint.mockRestore(); + xpub.mockRestore(); + registration.mockRestore(); + deviceAddress.mockRestore(); + } + } + ); + }); + + it.each(['SYS', 'BTC'])( + 'uses the test network for a %s alias with slip44 1', + async (currency) => { + const { adapter, request, address } = signingFixture(`t${currency}`, 1); + const fingerprint = jest + .spyOn(AppClient.prototype, 'getMasterFingerprint') + .mockResolvedValue('01020304'); + const xpub = jest + .spyOn(AppClient.prototype, 'getExtendedPubkey') + .mockResolvedValue(request.accountXpub); + const registration = jest + .spyOn(AppClient.prototype, 'registerWallet') + .mockImplementation(async (policy) => [ + policy.getId(), + Buffer.alloc(32, 0x55), + ]); + const deviceAddress = jest + .spyOn(AppClient.prototype, 'getWalletAddress') + .mockResolvedValue(address); + try { + await expect( + adapter.getAddress({ currency, slip44: 1, accountIndex: 0 }) + ).resolves.toBe(address); + } finally { + fingerprint.mockRestore(); + xpub.mockRestore(); + registration.mockRestore(); + deviceAddress.mockRestore(); + } + } + ); + + it.each(['getAddress', 'getAccount'] as const)( + '%s rejects an unrelated device address', + async (method) => { + const { adapter, request, key } = signingFixture(); + const config = getNetworkConfig(request.slip44, request.currency); + const unrelatedAddress = payments.p2wpkh({ + pubkey: key.derive(1).publicKey, + network: config.networks.testnet, + }).address!; + const fingerprint = jest + .spyOn(AppClient.prototype, 'getMasterFingerprint') + .mockResolvedValue('01020304'); + const xpub = jest + .spyOn(AppClient.prototype, 'getExtendedPubkey') + .mockResolvedValue(request.accountXpub); + const registration = jest + .spyOn(AppClient.prototype, 'registerWallet') + .mockImplementation(async (policy) => [ + policy.getId(), + Buffer.alloc(32, 0x55), + ]); + const deviceAddress = jest + .spyOn(AppClient.prototype, 'getWalletAddress') + .mockResolvedValue(unrelatedAddress); + try { + await expect(adapter[method](request)).rejects.toMatchObject({ + code: 'LEDGER_INVALID_RESPONSE', + }); + } finally { + fingerprint.mockRestore(); + xpub.mockRestore(); + registration.mockRestore(); + deviceAddress.mockRestore(); + } + } + ); + + it.each([0x6a82, 0x6985])( + 'only retries an unusual path status with device display (%s)', + async (statusCode) => { + const { adapter, request, address } = signingFixture(); + const fingerprint = jest + .spyOn(AppClient.prototype, 'getMasterFingerprint') + .mockResolvedValue('01020304'); + const xpub = jest + .spyOn(AppClient.prototype, 'getExtendedPubkey') + .mockRejectedValueOnce( + Object.assign(new Error('device status'), { statusCode }) + ) + .mockResolvedValue(request.accountXpub); + const registration = jest + .spyOn(AppClient.prototype, 'registerWallet') + .mockImplementation(async (policy) => [ + policy.getId(), + Buffer.alloc(32, 0x55), + ]); + const returned = jest + .spyOn(AppClient.prototype, 'getWalletAddress') + .mockResolvedValue(address); + try { + const result = adapter.getAccount(request); + if (statusCode === 0x6a82) { + await expect(result).resolves.toMatchObject({ + xpub: request.accountXpub, + address, + }); + expect(xpub.mock.calls.map((call) => call[1])).toEqual([false, true]); + } else { + await expect(result).rejects.toMatchObject({ statusCode: 0x6985 }); + expect(xpub).toHaveBeenCalledTimes(1); + expect(registration).not.toHaveBeenCalled(); + } + } finally { + fingerprint.mockRestore(); + xpub.mockRestore(); + registration.mockRestore(); + returned.mockRestore(); + } + } + ); + + it('gets identity, registers policy and signs a prepared PSBT inside one app action', async () => { + const { adapter, request, operation, key, actions } = signingFixture(); + const calls: string[] = []; + const fingerprint = jest + .spyOn(AppClient.prototype, 'getMasterFingerprint') + .mockImplementation(async () => { + calls.push('fingerprint'); + return '01020304'; + }); + const xpub = jest + .spyOn(AppClient.prototype, 'getExtendedPubkey') + .mockImplementation(async () => { + calls.push('xpub'); + return request.accountXpub; + }); + const registration = jest + .spyOn(AppClient.prototype, 'registerWallet') + .mockImplementation(async (policy) => { + calls.push('register'); + return [policy.getId(), Buffer.alloc(32, 0x55)]; + }); + const sign = jest + .spyOn(AppClient.prototype, 'signPsbt') + .mockImplementation(async (psbt: any) => { + calls.push('sign'); + expect( + psbt.getInputBip32Derivation(0, Buffer.from(key.publicKey)) + .masterFingerprint + ).toEqual(Buffer.from('01020304', 'hex')); + return [ + [ + 0, + { + pubkey: Buffer.from(key.publicKey), + signature: Buffer.from('abcd', 'hex'), + }, + ], + ]; + }); + try { + const output = await adapter.signPsbt(request); + expect(output).toEqual({ + fingerprint: '01020304', + signatures: [ + { + inputIndex: 0, + pubkeyHex: Buffer.from(key.publicKey).toString('hex'), + signatureHex: 'abcd', + }, + ], + }); + expect(calls).toEqual(['fingerprint', 'xpub', 'register', 'sign']); + expect(operation.dmk.executeDeviceAction).toHaveBeenCalledTimes(1); + expect(actions[0].input.appName).toBe('Syscoin'); + } finally { + fingerprint.mockRestore(); + xpub.mockRestore(); + registration.mockRestore(); + sign.mockRestore(); + } + }); + + it('propagates rejected policy registration without signing or null-HMAC fallback', async () => { + const { adapter, request } = signingFixture(); + const fingerprint = jest + .spyOn(AppClient.prototype, 'getMasterFingerprint') + .mockResolvedValue('01020304'); + const xpub = jest + .spyOn(AppClient.prototype, 'getExtendedPubkey') + .mockResolvedValue(request.accountXpub); + const rejection = Object.assign(new Error('rejected'), { + statusCode: 0x6985, + }); + const registration = jest + .spyOn(AppClient.prototype, 'registerWallet') + .mockRejectedValue(rejection); + const sign = jest.spyOn(AppClient.prototype, 'signPsbt'); + try { + await expect(adapter.signPsbt(request)).rejects.toMatchObject({ + statusCode: 0x6985, + }); + expect(registration).toHaveBeenCalledTimes(1); + expect(sign).not.toHaveBeenCalled(); + } finally { + fingerprint.mockRestore(); + xpub.mockRestore(); + registration.mockRestore(); + sign.mockRestore(); + } + }); +}); diff --git a/packages/sysweb3-keyring/test/unit/hardware/ledger-finalized-inputs.spec.ts b/packages/sysweb3-keyring/test/unit/hardware/ledger-finalized-inputs.spec.ts new file mode 100644 index 00000000..e027f86b --- /dev/null +++ b/packages/sysweb3-keyring/test/unit/hardware/ledger-finalized-inputs.spec.ts @@ -0,0 +1,359 @@ +jest.unmock('syscoinjs-lib'); + +import { getNetworkConfig, INetworkType } from '@sidhujag/sysweb3-network'; +import { payments, Psbt, Transaction } from 'bitcoinjs-lib'; + +import { LedgerKeyring } from '../../../src/ledger'; +import { PsbtV2 } from '../../../src/ledger/bitcoin_client'; +import { prepareLedgerPsbt } from '../../../src/ledger/prepare-psbt'; +import { SyscoinTransactions } from '../../../src/transactions/syscoin'; +import { KeyringAccountType } from '../../../src/types'; +import { PsbtUtils } from '../../../src/utils/psbt'; + +const config = getNetworkConfig(1, 'tSYS'); +const network = config.networks.testnet; +const activeNetwork = { + kind: INetworkType.Syscoin, + chainId: 5700, + slip44: 1, + currency: 'tSYS', + url: 'https://offline.invalid', +}; + +const removeNonWitnessUtxo = (psbt: Psbt, index: number) => { + // bitcoinjs installs a non-configurable cache accessor on the original input. + const input = { ...psbt.data.inputs[index] }; + delete input.nonWitnessUtxo; + psbt.data.inputs[index] = input; +}; + +const fixture = (scriptType = 'p2wpkh', sameWallet = false) => { + const actual = jest.requireActual('syscoinjs-lib'); + const makeHd = (seed: string) => + new actual.utils.HDSigner( + seed, + null, + true, + config.networks, + 1, + config.types.zPubType, + 84 + ); + const hd = makeHd( + 'abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about' + ); + const otherHd = makeHd( + 'legal winner thank year wave sausage worth useful legal winner thank yellow' + ); + const root = hd.getRootNode(); + const foreignRoot = sameWallet ? root : otherHd.getRootNode(); + const path = "m/84'/1'/0'/0/0"; + const foreignPath = "m/84'/1'/1'/0/0"; + const ownedKey = root.derivePath(path); + const foreignKey = foreignRoot.derivePath(foreignPath); + const ownedPayment = payments.p2wpkh({ + pubkey: ownedKey.publicKey, + network, + }); + const foreignWitness = payments.p2wpkh({ + pubkey: foreignKey.publicKey, + network, + }); + const foreignPayment = + scriptType === 'p2pkh' + ? payments.p2pkh({ pubkey: foreignKey.publicKey, network }) + : scriptType === 'p2sh-p2wpkh' + ? payments.p2sh({ redeem: foreignWitness, network }) + : foreignWitness; + const account = { + id: 0, + address: ownedPayment.address!, + xpub: hd.getAccountXpub(), + isLedgerWallet: true, + }; + const previous = new Transaction(); + previous.addInput(Buffer.alloc(32), 0xffffffff); + previous.addOutput(ownedPayment.output!, 100000n); + previous.addOutput(foreignPayment.output!, 100000n); + const psbt = new Psbt({ network }); + [ownedKey, foreignKey].forEach((key, index) => { + psbt.addInput({ + hash: previous.getId(), + index, + nonWitnessUtxo: previous.toBuffer(), + witnessUtxo: { + script: previous.outs[index].script, + value: previous.outs[index].value, + }, + ...(index === 1 && scriptType === 'p2sh-p2wpkh' + ? { redeemScript: foreignWitness.output } + : {}), + bip32Derivation: [ + { + pubkey: key.publicKey, + masterFingerprint: index ? foreignRoot.fingerprint : root.fingerprint, + path: index ? foreignPath : path, + }, + ], + }); + }); + psbt.addOutput({ address: account.address, value: 199000n }); + const unsigned = psbt.clone(); + psbt.signInput(1, foreignKey); + psbt.finalizeInput(1); + const finalScriptSig = psbt.data.inputs[1].finalScriptSig + ? Buffer.from(psbt.data.inputs[1].finalScriptSig) + : undefined; + const finalScriptWitness = psbt.data.inputs[1].finalScriptWitness + ? Buffer.from(psbt.data.inputs[1].finalScriptWitness) + : undefined; + // A sender can reattach hints; they must never reauthorize this input. + psbt.addUnknownKeyValToInput(1, { + key: Buffer.from('path'), + value: Buffer.from(foreignPath), + }); + psbt.updateInput(1, { + bip32Derivation: [ + { + pubkey: foreignKey.publicKey, + masterFingerprint: foreignRoot.fingerprint, + path: foreignPath, + }, + ], + }); + + const fingerprint = Buffer.from(root.fingerprint).toString('hex'); + const devicePsbts: PsbtV2[] = []; + const signPsbt = jest.fn(async (request: any) => { + const prepared = actual.utils.bitcoinjs.Psbt.fromBase64(request.psbtBase64); + prepareLedgerPsbt( + prepared, + account.xpub, + 0, + activeNetwork.currency, + 1, + fingerprint + ); + const v2 = new PsbtV2().fromBitcoinJS(prepared); + devicePsbts.push(v2); + const decoded = new PsbtV2(); + decoded.deserialize(v2.serialize()); + expect(decoded.getGlobalInputCount()).toBe(2); + expect(decoded.getInputFinalScriptsig(1)).toEqual(finalScriptSig); + if (finalScriptWitness) + expect(decoded.getInputFinalScriptwitness(1)).toEqual(finalScriptWitness); + expect( + decoded.getInputBip32Derivation(1, Buffer.from(foreignKey.publicKey)) + ).toBeUndefined(); + expect( + decoded.getInputBip32Derivation(0, Buffer.from(ownedKey.publicKey)) + ).toBeDefined(); + const signed = unsigned.clone(); + signed.signInput(0, ownedKey); + const signature = signed.data.inputs[0].partialSig![0]; + return { + fingerprint, + signatures: [ + { + inputIndex: 0, + pubkeyHex: Buffer.from(signature.pubkey).toString('hex'), + signatureHex: Buffer.from(signature.signature).toString('hex'), + }, + ], + }; + }); + const ledger = new LedgerKeyring(undefined, { + getStatus: () => ({ connected: true }), + connect: jest.fn(), + disconnect: jest.fn(), + evm: {} as any, + utxo: { signPsbt } as any, + }); + const state = { + activeNetwork, + activeAccountId: 0, + activeAccountType: KeyringAccountType.Ledger, + accounts: { + Ledger: { 0: account }, + HDAccount: {}, + Imported: {}, + Trezor: {}, + }, + }; + const getSigner = jest.fn(); + const tx = new SyscoinTransactions( + getSigner, + jest.fn(), + () => state as any, + jest.fn(), + ledger, + {} as any + ); + return { + tx, + psbt, + unsigned, + ownedKey, + foreignKey, + finalScriptSig, + finalScriptWitness, + signPsbt, + devicePsbts, + getSigner, + }; +}; + +describe('Ledger finalized external inputs with real PSBT data', () => { + it.each(['p2wpkh', 'p2sh-p2wpkh'])( + 'signs with finalized external %s witness data when the backend is unavailable', + async (scriptType) => { + const test = fixture(scriptType); + removeNonWitnessUtxo(test.psbt, 1); + const getRawTransaction = jest + .fn() + .mockRejectedValue(new Error('Blockbook unavailable')); + jest + .spyOn(test.tx, 'txUtilsFunctions') + .mockReturnValue({ getRawTransaction }); + + const signed = PsbtUtils.fromPali( + await test.tx.signPSBT({ psbt: PsbtUtils.toPali(test.psbt) }), + activeNetwork + ); + + expect(getRawTransaction).not.toHaveBeenCalled(); + expect(test.signPsbt).toHaveBeenCalledTimes(1); + const devicePsbt = test.devicePsbts[0]; + expect(devicePsbt.getInputNonWitnessUtxo(1)).toBeUndefined(); + expect(devicePsbt.getInputWitnessUtxo(1)).toEqual({ + amount: 100000, + scriptPubKey: Buffer.from(test.psbt.data.inputs[1].witnessUtxo!.script), + }); + expect(signed.data.inputs[0].finalScriptWitness).toBeDefined(); + expect( + signed.data.inputs[1].finalScriptSig + ? Buffer.from(signed.data.inputs[1].finalScriptSig) + : undefined + ).toEqual(test.finalScriptSig); + expect(Buffer.from(signed.data.inputs[1].finalScriptWitness!)).toEqual( + test.finalScriptWitness + ); + expect(signed.data.inputs[1].partialSig).toBeUndefined(); + expect(signed.extractTransaction().ins).toHaveLength(2); + } + ); + + it('still fetches a missing previous transaction for an unfinished input', async () => { + const test = fixture(); + removeNonWitnessUtxo(test.psbt, 0); + const getRawTransaction = jest + .fn() + .mockRejectedValue(new Error('Blockbook unavailable')); + jest + .spyOn(test.tx, 'txUtilsFunctions') + .mockReturnValue({ getRawTransaction }); + await expect( + test.tx.signPSBT({ psbt: PsbtUtils.toPali(test.psbt) }) + ).rejects.toThrow('Failed to enrich 1 of 2 inputs with nonWitnessUtxo'); + expect(getRawTransaction).toHaveBeenCalledTimes(1); + expect(getRawTransaction).toHaveBeenCalledWith( + activeNetwork.url, + Buffer.from(test.psbt.txInputs[0].hash).reverse().toString('hex') + ); + expect(test.signPsbt).not.toHaveBeenCalled(); + }); + + it('still requires previous-output data for a finalized legacy input', async () => { + const test = fixture('p2pkh'); + removeNonWitnessUtxo(test.psbt, 1); + delete test.psbt.data.inputs[1].witnessUtxo; + const getRawTransaction = jest + .fn() + .mockRejectedValue(new Error('Blockbook unavailable')); + jest + .spyOn(test.tx, 'txUtilsFunctions') + .mockReturnValue({ getRawTransaction }); + await expect( + test.tx.signPSBT({ psbt: PsbtUtils.toPali(test.psbt) }) + ).rejects.toThrow('Failed to enrich 1 of 2 inputs with nonWitnessUtxo'); + expect(getRawTransaction).toHaveBeenCalledTimes(1); + expect(getRawTransaction).toHaveBeenCalledWith( + activeNetwork.url, + Buffer.from(test.psbt.txInputs[1].hash).reverse().toString('hex') + ); + expect(test.signPsbt).not.toHaveBeenCalled(); + }); + + it.each(['p2wpkh', 'p2pkh', 'p2sh-p2wpkh'])( + 'preserves finalized %s scripts through device serialization and signing', + async (scriptType) => { + const test = fixture(scriptType); + const signed = PsbtUtils.fromPali( + await test.tx.signPSBT({ psbt: PsbtUtils.toPali(test.psbt) }), + activeNetwork + ); + expect(test.signPsbt).toHaveBeenCalledTimes(1); + expect(test.getSigner).not.toHaveBeenCalled(); + expect(signed.data.inputs[0].finalScriptWitness).toBeDefined(); + expect( + signed.data.inputs[1].finalScriptSig + ? Buffer.from(signed.data.inputs[1].finalScriptSig) + : undefined + ).toEqual(test.finalScriptSig); + expect( + signed.data.inputs[1].finalScriptWitness + ? Buffer.from(signed.data.inputs[1].finalScriptWitness) + : undefined + ).toEqual(test.finalScriptWitness); + expect(signed.data.inputs[1].partialSig).toBeUndefined(); + expect(signed.data.inputs[1].bip32Derivation).toBeUndefined(); + expect(signed.extractTransaction().ins).toHaveLength(2); + } + ); + + it('does not re-sign a finalized input from another account in the same wallet', async () => { + const test = fixture('p2wpkh', true); + const signed = PsbtUtils.fromPali( + await test.tx.signPSBT({ psbt: PsbtUtils.toPali(test.psbt) }), + activeNetwork + ); + expect(Buffer.from(signed.data.inputs[1].finalScriptWitness!)).toEqual( + test.finalScriptWitness + ); + expect(signed.data.inputs[1].partialSig).toBeUndefined(); + expect(test.signPsbt).toHaveBeenCalledTimes(1); + }); + + it('rejects a device response that tries to sign the finalized foreign input', async () => { + const test = fixture(); + const signed = test.unsigned.clone(); + signed.signInput(1, test.foreignKey); + test.signPsbt.mockImplementationOnce(async () => ({ + fingerprint: '12345678', + signatures: [ + { + inputIndex: 1, + pubkeyHex: Buffer.from( + signed.data.inputs[1].partialSig![0].pubkey + ).toString('hex'), + signatureHex: Buffer.from( + signed.data.inputs[1].partialSig![0].signature + ).toString('hex'), + }, + ], + })); + await expect( + test.tx.signPSBT({ psbt: PsbtUtils.toPali(test.psbt) }) + ).rejects.toThrow('PSBT input is outside the approved account'); + }); + + it('keeps unfinished foreign inputs outside the supported hardware path', async () => { + const test = fixture(); + await expect( + test.tx.signPSBT({ psbt: PsbtUtils.toPali(test.unsigned) }) + ).rejects.toThrow('Missing bip32Derivation'); + // The scoped parser strips unsupported foreign hints. The host preparation + // still refuses that unfinished input before producing any signature. + expect(test.signPsbt).toHaveBeenCalledTimes(1); + }); +}); diff --git a/packages/sysweb3-keyring/test/unit/hardware/ledger-output-map.spec.ts b/packages/sysweb3-keyring/test/unit/hardware/ledger-output-map.spec.ts new file mode 100644 index 00000000..c48a7aa4 --- /dev/null +++ b/packages/sysweb3-keyring/test/unit/hardware/ledger-output-map.spec.ts @@ -0,0 +1,73 @@ +import { getNetworkConfig } from '@sidhujag/sysweb3-network'; +import { payments, Psbt } from 'bitcoinjs-lib'; + +import { PsbtV2 } from '../../../src/ledger/bitcoin_client'; +import { prepareLedgerPsbt } from '../../../src/ledger/prepare-psbt'; + +test.each(['proprietary-path', 'existing-derivation'])( + 'does not forward %s output hints into the Ledger device output map', + (hint) => { + const syscoinjs = jest.requireActual('syscoinjs-lib'); + const config = getNetworkConfig(1, 'tSYS'); + const hd = new syscoinjs.utils.HDSigner( + 'abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about', + null, + true, + config.networks, + 1, + config.types.zPubType, + 84 + ); + hd.createAccountAtIndex(0, 84); + const root = hd.getRootNode(); + const child = root.derivePath("m/84'/1'/0'/1/0"); + // Deliberately different from the account-derived key claimed by metadata. + const recipientKey = Buffer.from( + '0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798', + 'hex' + ); + const script = payments.p2wpkh({ pubkey: recipientKey }).output!; + const plain = new Psbt({ network: config.networks.testnet }); + plain.addInput({ + hash: Buffer.alloc(32), + index: 0, + finalScriptSig: Buffer.from([0x51]), + }); + plain.addOutput({ script, value: 1000n }); + const tagged = plain.clone(); + if (hint === 'proprietary-path') { + tagged.addUnknownKeyValToOutput(0, { + key: Buffer.from('path'), + value: Buffer.from("m/84'/1'/0'/1/0"), + }); + } else { + tagged.updateOutput(0, { + bip32Derivation: [ + { + path: "m/84'/1'/0'/1/0", + pubkey: child.publicKey, + masterFingerprint: root.fingerprint, + }, + ], + }); + } + prepareLedgerPsbt( + tagged, + hd.getAccountXpub(), + 0, + 'tSYS', + 1, + Buffer.from(root.fingerprint).toString('hex') + ); + expect(tagged.data.outputs[0].bip32Derivation).toHaveLength(1); + const encoded = new PsbtV2().fromBitcoinJS(tagged); + expect(encoded.getOutputAmount(0)).toBe(1000); + expect(Buffer.from(encoded.getOutputScript(0))).toEqual(Buffer.from(script)); + expect(() => + encoded.getOutputBip32Derivation(0, Buffer.from(child.publicKey)) + ).toThrow(); + expect(encoded.serialize()).toEqual( + new PsbtV2().fromBitcoinJS(plain).serialize() + ); + } +); diff --git a/packages/sysweb3-keyring/test/unit/hardware/ledger.spec.ts b/packages/sysweb3-keyring/test/unit/hardware/ledger.spec.ts index d3d1825f..3cd1e202 100644 --- a/packages/sysweb3-keyring/test/unit/hardware/ledger.spec.ts +++ b/packages/sysweb3-keyring/test/unit/hardware/ledger.spec.ts @@ -1,859 +1,377 @@ +import { SignTypedDataVersion, TypedDataUtils } from '@metamask/eth-sig-util'; +import { INetworkType } from '@sidhujag/sysweb3-network'; +import { Transaction, Wallet } from 'ethers'; + import { KeyringManager, KeyringAccountType } from '../../../src'; +import { LedgerKeyring } from '../../../src/ledger'; import { FAKE_PASSWORD, PEACE_SEED_PHRASE } from '../../helpers/constants'; -import { setupMocks } from '../../helpers/setup'; -import { INetworkType } from '@pollum-io/sysweb3-network'; - -// Use global createMockVaultState -const createMockVaultState = (global as any).createMockVaultState; - -describe('Ledger Hardware Wallet', () => { - let keyringManager: KeyringManager; - let mockVaultStateGetter: jest.Mock; - let currentVaultState: any; +import { createFreshTestKeyring, setupMocks } from '../../helpers/setup'; + +import type { LedgerHost } from '../../../src/ledger/host-types'; + +const wallet = new Wallet(`0x${'11'.repeat(32)}`); +const transactionHex = Transaction.from({ + type: 2, + chainId: 1, + nonce: 0, + gasLimit: 21000, + maxFeePerGas: 100, + maxPriorityFeePerGas: 1, + to: `0x${'22'.repeat(20)}`, + value: 1, +}).unsignedSerialized.slice(2); +const signDigest = (digest: string) => { + const signature = wallet.signingKey.sign(digest); + return { + r: signature.r.slice(2), + s: signature.s.slice(2), + v: signature.v.toString(16), + }; +}; + +const mockHost = () => { + let connected = true; + const host = { + connect: jest.fn(async () => { + connected = true; + }), + disconnect: jest.fn(async () => { + connected = false; + }), + getStatus: jest.fn(() => ({ connected })), + evm: { + getAddress: jest.fn().mockResolvedValue({ + address: wallet.address, + publicKey: wallet.signingKey.publicKey.slice(2), + }), + signTransaction: jest.fn(async ({ unsignedTxHex }) => + signDigest( + Transaction.from(`0x${unsignedTxHex.replace(/^0x/, '')}`).unsignedHash + ) + ), + signPersonalMessage: jest.fn(async ({ messageHex }) => + wallet.signMessage(Buffer.from(messageHex, 'hex')) + ), + signTypedData: jest.fn( + async ({ data, version }) => + wallet.signingKey.sign( + `0x${TypedDataUtils.eip712Hash(data, version).toString('hex')}` + ).serialized + ), + }, + utxo: { + getXpub: jest + .fn() + .mockResolvedValue( + 'zpub6rFR7y4Q2AijBEqTUquhVz398htDFrtymD9xYYfG1m4wAcvPhXNfE3EfH1r1ADqtfSdVCToUG868RvUUkgDKf31mGDtKsAYz2oz2AGutZYs' + ), + getAddress: jest.fn().mockResolvedValue('sys1qmock_ledger_address'), + getAccount: jest.fn(), + signMessage: jest.fn().mockResolvedValue('signed-message'), + signPsbt: jest + .fn() + .mockResolvedValue({ fingerprint: '12345678', signatures: [] }), + }, + }; + return { + host, + setConnected: (value: boolean) => { + connected = value; + }, + }; +}; + +describe('Ledger semantic host integration', () => { + let keyring: KeyringManager; + let state: any; + let fixture: ReturnType; + const additional: KeyringManager[] = []; beforeEach(async () => { setupMocks(); await global.setupTestVault(FAKE_PASSWORD); - - // Set up UTXO vault state - currentVaultState = createMockVaultState({ + fixture = mockHost(); + state = global.createMockVaultState({ activeAccountId: 0, activeAccountType: KeyringAccountType.HDAccount, networkType: INetworkType.Syscoin, chainId: 57, }); - mockVaultStateGetter = jest.fn(() => currentVaultState); - - keyringManager = await KeyringManager.createInitialized( + keyring = await createFreshTestKeyring( PEACE_SEED_PHRASE, FAKE_PASSWORD, - mockVaultStateGetter + () => state, + fixture.host as LedgerHost ); - - // Mock HardwareWalletManager ensureConnection - keyringManager.ledgerSigner.ensureConnection = jest - .fn() - .mockResolvedValue(undefined); - - // Mock transport property - keyringManager.ledgerSigner.transport = {} as any; - - // Mock ledgerUtxoClient for getMasterFingerprint calls - keyringManager.ledgerSigner.ledgerUtxoClient = { - getMasterFingerprint: jest.fn().mockResolvedValue('12345678'), - signPsbt: jest.fn(), - } as any; - - // Mock getAddress to return our mocked addresses - keyringManager.getAddress = jest + keyring.getAddress = jest .fn() .mockResolvedValue('sys1qmock_ledger_address'); }); afterEach(async () => { - // Clean up hardware wallet connections - if (keyringManager) { - await keyringManager.destroy(); - } + for (const item of additional.splice(0)) await item.destroy(); + await keyring?.destroy(); }); - describe('Account Import', () => { - it('should import Ledger account when connected', async () => { - // Mock complete UTXO interface - keyringManager.ledgerSigner.utxo = { - getXpub: jest - .fn() - .mockResolvedValue( - 'zpub6rFR7y4Q2AijBEqTUquhVz398htDFrtymD9xYYfG1m4wAcvPhXNfE3EfH1r1ADqtfSdVCToUG868RvUUkgDKf31mGDtKsAYz2oz2AGutZYs' - ), - getUtxoAddress: jest.fn().mockResolvedValue('sys1qmock_ledger_address'), - verifyUtxoAddress: jest - .fn() - .mockResolvedValue('sys1qmock_ledger_address'), - }; - - const account = await keyringManager.importLedgerAccount('My Ledger'); - - expect(account).toBeDefined(); - if (account) { - expect(account.id).toBe(0); // First imported Ledger account gets ID 0 - expect(account.label).toBe('My Ledger'); - expect(account.isLedgerWallet).toBe(true); - expect(account.isTrezorWallet).toBe(false); - expect(account.isImported).toBe(false); - expect(account.xprv).toBe(''); // Hardware wallets don't expose private keys - expect(account.address).toBe('sys1qmock_ledger_address'); - } + it('imports a UTXO account through the injected host without private keys', async () => { + const account = await keyring.importLedgerAccount('My Ledger'); + expect(account).toMatchObject({ + id: 0, + label: 'My Ledger', + isLedgerWallet: true, + xprv: '', + address: 'sys1qmock_ledger_address', }); - - it('should fail if Ledger connection fails', async () => { - // Mock connection failure in ensureConnection - keyringManager.ledgerSigner.ensureConnection = jest - .fn() - .mockRejectedValue(new Error('Failed to connect to device')); - - await expect(keyringManager.importLedgerAccount()).rejects.toThrow( - 'Failed to connect to device' - ); + expect(fixture.host.utxo.getXpub).toHaveBeenCalledWith({ + currency: state.activeNetwork.currency, + slip44: state.activeNetwork.slip44, + accountIndex: 0, + checkOnDevice: true, }); + }); - it('should handle Ledger import for EVM networks', async () => { - // Set up EVM vault state - const evmVaultState = createMockVaultState({ - activeAccountId: 0, - activeAccountType: KeyringAccountType.HDAccount, - networkType: INetworkType.Ethereum, - chainId: 1, - }); - const evmVaultStateGetter = jest.fn(() => evmVaultState); - - // Create EVM keyring - const evmKeyring = await KeyringManager.createInitialized( - PEACE_SEED_PHRASE, - FAKE_PASSWORD, - evmVaultStateGetter - ); - - // Mock ensureConnection for EVM keyring - evmKeyring.ledgerSigner.ensureConnection = jest - .fn() - .mockResolvedValue(undefined); - - // Mock complete EVM interface - evmKeyring.ledgerSigner.evm = { - getEvmAddressAndPubKey: jest.fn().mockResolvedValue({ - address: '0x742d35Cc6634C0532925a3b844Bc9e7595f2bd9F', - publicKey: '0x04...', - }), - signEVMTransaction: jest.fn().mockResolvedValue({ - r: '123456789abcdef123456789abcdef123456789abcdef123456789abcdef12345678', - s: '987654321fedcba987654321fedcba987654321fedcba987654321fedcba987654', - v: '1c', - }), - signPersonalMessage: jest.fn().mockResolvedValue('0xmocked_signature'), - signTypedData: jest.fn().mockResolvedValue('0xmocked_typed_signature'), - }; - - const account = await evmKeyring.importLedgerAccount('Ledger ETH'); - - expect(account).toBeDefined(); - if (account) { - expect(account.address.startsWith('0x')).toBe(true); - expect(account.isLedgerWallet).toBe(true); - } + it('requests device confirmation for unusual import paths without retrying', async () => { + fixture.host.utxo.getXpub.mockImplementation(async (request) => { + if (!request.checkOnDevice) + throw new Error('Unusual path requires display'); + return 'public-account-key'; }); - - it('should reject duplicate Ledger addresses', async () => { - // Mock getAddress to return the expected addresses - keyringManager.getAddress = jest - .fn() - .mockResolvedValue('sys1q_first_address'); - - // First import with unique address - keyringManager.ledgerSigner.utxo = { - getXpub: jest - .fn() - .mockResolvedValue( - 'zpub6rFR7y4Q2AijBEqTUquhVz398htDFrtymD9xYYfG1m4wAcvPhXNfE3EfH1r1ADqtfSdVCToUG868RvUUkgDKf31mGDtKsAYz2oz2AGutZYs' - ), - getUtxoAddress: jest.fn().mockResolvedValue('sys1q_first_address'), - verifyUtxoAddress: jest.fn().mockResolvedValue('sys1q_first_address'), - }; - - const firstAccount = await keyringManager.importLedgerAccount(); - - // Update vault state with first account - if (firstAccount) { - currentVaultState.accounts[KeyringAccountType.Ledger][firstAccount.id] = - { - id: firstAccount.id, - label: firstAccount.label, - address: firstAccount.address, - xpub: firstAccount.xpub, - xprv: '', - isImported: false, - isTrezorWallet: false, - isLedgerWallet: true, - balances: { syscoin: 0, ethereum: 0 }, - assets: { syscoin: [], ethereum: [] }, - }; - } - - // Mock Ledger returning same address for next account (simulate duplicate) - keyringManager.ledgerSigner.utxo = { - getXpub: jest - .fn() - .mockResolvedValue( - 'zpub6s8HtEQtcu3AmBn9sniSqCAVhx2nJAhb2sd5NDYeYZ1ZJaZx7MAVZZnG1PdCUNJcVJXGbVpGfSYZLgkPSUjLYnJg8UdYvdkfaygcXZKPLy6' - ), - getUtxoAddress: jest.fn().mockResolvedValue('sys1q_first_address'), // Same as first! - verifyUtxoAddress: jest.fn().mockResolvedValue('sys1q_first_address'), - }; - - // Should reject duplicate - this tests the actual business logic - await expect(keyringManager.importLedgerAccount()).rejects.toThrow( - 'Account already exists' - ); + await expect( + keyring.ledgerSigner.utxo.getXpub({ coin: 'sys', slip44: 57, index: 100 }) + ).resolves.toBe('public-account-key'); + expect(fixture.host.utxo.getXpub).toHaveBeenCalledTimes(1); + expect(fixture.host.utxo.getXpub).toHaveBeenCalledWith({ + currency: 'sys', + slip44: 57, + accountIndex: 100, + checkOnDevice: true, }); }); - describe('Account Management', () => { - beforeEach(async () => { - // Mock complete Ledger methods - keyringManager.ledgerSigner.utxo = { - getXpub: jest - .fn() - .mockResolvedValue( - 'zpub6rFR7y4Q2AijBEqTUquhVz398htDFrtymD9xYYfG1m4wAcvPhXNfE3EfH1r1ADqtfSdVCToUG868RvUUkgDKf31mGDtKsAYz2oz2AGutZYs' - ), - getUtxoAddress: jest.fn().mockResolvedValue('sys1qmock_ledger_address'), - verifyUtxoAddress: jest - .fn() - .mockResolvedValue('sys1qmock_ledger_address'), - }; - - // Import a Ledger account - const account = await keyringManager.importLedgerAccount('Test Ledger'); - - // Update vault state with imported account - if (account) { - currentVaultState.accounts[KeyringAccountType.Ledger][account.id] = { - id: account.id, - label: account.label, - address: account.address, - xpub: account.xpub, - xprv: '', - isImported: false, - isTrezorWallet: false, - isLedgerWallet: true, - balances: { syscoin: 0, ethereum: 0 }, - assets: { syscoin: [], ethereum: [] }, - }; - } - }); - - it('should switch to Ledger account', async () => { - // Update vault state to set Ledger as active - currentVaultState.activeAccount = { - id: 0, - type: KeyringAccountType.Ledger, - }; - - // Account switch is handled by vault state update + it('propagates connection failure without retrying', async () => { + fixture.setConnected(false); + fixture.host.connect.mockRejectedValue(new Error('Device unavailable')); + await expect(keyring.importLedgerAccount()).rejects.toThrow( + 'Device unavailable' + ); + expect(fixture.host.connect).toHaveBeenCalledTimes(1); + expect(fixture.host.utxo.getXpub).not.toHaveBeenCalled(); + }); - const { activeAccount, activeAccountType } = - keyringManager.getActiveAccount(); - expect(activeAccountType).toBe(KeyringAccountType.Ledger); - expect(activeAccount.isLedgerWallet).toBe(true); - expect(activeAccount.label).toBe('Test Ledger'); + it('imports an EVM account from the host address and public key', async () => { + const evmState = global.createMockVaultState({ + activeAccountId: 0, + activeAccountType: KeyringAccountType.HDAccount, + networkType: INetworkType.Ethereum, + chainId: 1, }); - - it('should get Ledger account xpub', async () => { - // Update vault state to set Ledger as active - currentVaultState.activeAccount = { - id: 0, - type: KeyringAccountType.Ledger, - }; - - // Account switch is handled by vault state update - - const xpub = keyringManager.getAccountXpub(); - expect(xpub).toBeDefined(); - expect(xpub).toBe( - 'zpub6rFR7y4Q2AijBEqTUquhVz398htDFrtymD9xYYfG1m4wAcvPhXNfE3EfH1r1ADqtfSdVCToUG868RvUUkgDKf31mGDtKsAYz2oz2AGutZYs' - ); + const evm = await createFreshTestKeyring( + PEACE_SEED_PHRASE, + FAKE_PASSWORD, + () => evmState, + fixture.host as LedgerHost + ); + additional.push(evm); + const account = await evm.importLedgerAccount('Ledger ETH'); + expect(account).toMatchObject({ + id: 0, + label: 'Ledger ETH', + isLedgerWallet: true, + xprv: '', + address: wallet.address, }); - - it('should handle mixed account types with Ledger', async () => { - // Add HD account - const hdAccount = await keyringManager.addNewAccount('HD Account 2'); - - // Update vault state with HD account - currentVaultState.accounts[KeyringAccountType.HDAccount][hdAccount.id] = { - id: hdAccount.id, - label: hdAccount.label, - address: hdAccount.address, - xpub: hdAccount.xpub, - xprv: '', - isImported: false, - isTrezorWallet: false, - isLedgerWallet: false, - balances: { syscoin: 0, ethereum: 0 }, - assets: { syscoin: [], ethereum: [] }, - }; - - // Switch between them using actual account IDs - currentVaultState.activeAccount = { - id: 0, - type: KeyringAccountType.HDAccount, - }; - // Account switch is handled by vault state update - expect(keyringManager.getActiveAccount().activeAccountType).toBe( - KeyringAccountType.HDAccount - ); - - // Switch to Ledger account - currentVaultState.activeAccount = { - id: 0, - type: KeyringAccountType.Ledger, - }; - // Account switch is handled by vault state update - expect(keyringManager.getActiveAccount().activeAccountType).toBe( - KeyringAccountType.Ledger - ); + expect(fixture.host.evm.getAddress).toHaveBeenCalledWith({ + accountIndex: 0, }); }); - describe('Transaction Signing', () => { - beforeEach(async () => { - // Complete mock setup for transaction signing tests - keyringManager.ledgerSigner.utxo = { - getXpub: jest - .fn() - .mockResolvedValue( - 'zpub6rFR7y4Q2AijBEqTUquhVz398htDFrtymD9xYYfG1m4wAcvPhXNfE3EfH1r1ADqtfSdVCToUG868RvUUkgDKf31mGDtKsAYz2oz2AGutZYs' - ), - getUtxoAddress: jest.fn().mockResolvedValue('sys1qmock_ledger_address'), - verifyUtxoAddress: jest - .fn() - .mockResolvedValue('sys1qmock_ledger_address'), - }; - - const account = await keyringManager.importLedgerAccount('Signing Test'); - if (account) { - // Update vault state to set Ledger as active - currentVaultState.accounts[KeyringAccountType.Ledger][account.id] = { - id: account.id, - label: account.label, - address: account.address, - xpub: account.xpub, - xprv: '', - isImported: false, - isTrezorWallet: false, - isLedgerWallet: true, - balances: { syscoin: 0, ethereum: 0 }, - assets: { syscoin: [], ethereum: [] }, - }; - currentVaultState.activeAccount = { - id: account.id, - type: KeyringAccountType.Ledger, - }; - - // Account switch is handled by vault state update - } - - // Mock getAddress to return our mocked addresses - keyringManager.getAddress = jest - .fn() - .mockResolvedValue('sys1qmock_ledger_address'); - - // Mock Ledger UTXO client for transaction signing - keyringManager.ledgerSigner.ledgerUtxoClient = { - getMasterFingerprint: jest.fn().mockResolvedValue('12345678'), - signPsbt: jest.fn().mockResolvedValue([ - [ - 0, - { - pubkey: Buffer.from('mock_pubkey'), - signature: Buffer.from('mock_signature'), - }, - ], - ]), - // Add minimal required properties to satisfy interface - transport: {} as any, - makeRequest: jest.fn(), - getAppAndVersion: jest.fn(), - getExtendedPubkey: jest.fn(), - registerWallet: jest.fn(), - getWalletAddress: jest.fn(), - signMessage: jest.fn(), - } as any; - - // Mock convertToLedgerFormat to return a proper PSBT mock with toBase64 method - keyringManager.ledgerSigner.convertToLedgerFormat = jest - .fn() - .mockResolvedValue({ - toBase64: jest - .fn() - .mockReturnValue( - 'cHNidP8BAHECAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAfgAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==' - ), - extractTransaction: jest.fn().mockReturnValue({ - getId: jest.fn().mockReturnValue('mock_transaction_id'), - }), - updateInput: jest.fn(), - finalizeAllInputs: jest.fn(), - }); - }); - - it('should prepare PSBT for Ledger signing', async () => { - // Mock the PSBT parsing to avoid base64 validation issues - const mockSyscoinjs = require('syscoinjs-lib'); - const originalImportPsbtFromJson = mockSyscoinjs.utils.importPsbtFromJson; - mockSyscoinjs.utils.importPsbtFromJson = jest.fn().mockReturnValue({ - psbt: 'mocked_psbt_object', - }); - - const psbtData = { - psbt: 'valid_psbt_data', - assets: [], - }; - - const result = await keyringManager.syscoinTransaction.signPSBT({ - psbt: psbtData, - isTrezor: false, - isLedger: true, - pathIn: undefined, - }); + it('rejects duplicate imported addresses', async () => { + const account = await keyring.importLedgerAccount(); + state.accounts[KeyringAccountType.Ledger][account.id] = account; + await expect(keyring.importLedgerAccount()).rejects.toThrow( + 'Account already exists' + ); + }); - expect(result).toBeDefined(); - // Verify Ledger-specific handling was applied + it('keeps Ledger accounts separate and uses the next account index', async () => { + const first = await keyring.importLedgerAccount(); + state.accounts[KeyringAccountType.Ledger][first.id] = first; + (keyring.getAddress as jest.Mock).mockResolvedValue('sys1q_second_ledger'); + const second = await keyring.importLedgerAccount('Second'); + expect(second.id).toBe(1); + expect(fixture.host.utxo.getXpub).toHaveBeenLastCalledWith( + expect.objectContaining({ accountIndex: 1 }) + ); + expect( + Object.keys(state.accounts[KeyringAccountType.HDAccount]) + ).toHaveLength(1); + expect(state.accounts[KeyringAccountType.HDAccount][0].isLedgerWallet).toBe( + false + ); + }); - // Restore original function - mockSyscoinjs.utils.importPsbtFromJson = originalImportPsbtFromJson; + it('selects the imported account and returns its stored public xpub', async () => { + const account = await keyring.importLedgerAccount('Selected'); + state.accounts[KeyringAccountType.Ledger][account.id] = account; + state.activeAccount = { id: account.id, type: KeyringAccountType.Ledger }; + expect(keyring.getActiveAccount().activeAccount).toMatchObject({ + label: 'Selected', + isLedgerWallet: true, }); + expect(keyring.getAccountXpub()).toBe(account.xpub); + }); - it('should reconnect to Ledger when connection is lost during EVM transaction signing', async () => { - // Set up EVM vault state - const evmVaultState = createMockVaultState({ - activeAccountId: 0, - activeAccountType: KeyringAccountType.Ledger, - networkType: INetworkType.Ethereum, - chainId: 1, - }); - const evmVaultStateGetter = jest.fn(() => evmVaultState); - - // Create EVM keyring with Ledger - const evmKeyring = await KeyringManager.createInitialized( - PEACE_SEED_PHRASE, - FAKE_PASSWORD, - evmVaultStateGetter - ); - - // Mock Ledger as disconnected - evmKeyring.ledgerSigner.transport = null; - evmKeyring.ledgerSigner.ledgerUtxoClient = null as any; - evmKeyring.ledgerSigner.ledgerEVMClient = null as any; - - // Mock transport for reconnection - const mockTransport = { close: jest.fn() } as any; - - // Mock ensureConnection to simulate successful reconnection - evmKeyring.ledgerSigner.ensureConnection = jest - .fn() - .mockImplementation(async () => { - // Simulate successful reconnection - evmKeyring.ledgerSigner.transport = mockTransport; - evmKeyring.ledgerSigner.ledgerUtxoClient = { - getMasterFingerprint: jest.fn().mockResolvedValue('12345678'), - } as any; - evmKeyring.ledgerSigner.ledgerEVMClient = { - signTransaction: jest.fn().mockResolvedValue({ - r: '123456789abcdef', - s: '987654321fedcba', - v: '00', - }), - getAddress: jest.fn().mockResolvedValue({ - address: '0x742D35Cc6634C0532925a3b844bc9e7595f2bd9f', - publicKey: '0x04...', - }), - signPersonalMessage: jest - .fn() - .mockResolvedValue('0xmocked_signature'), - signEIP712HashedMessage: jest - .fn() - .mockResolvedValue('0xmocked_typed_signature'), - } as any; - }); - - // Import Ledger account - const evmAccount = { - id: 0, - label: 'Ledger 1', - address: '0x742D35Cc6634C0532925a3b844bc9e7595f2bd9f', - xpub: 'xpub...', - }; - - evmVaultState.accounts[KeyringAccountType.Ledger][0] = { - id: evmAccount.id, - label: evmAccount.label, - address: evmAccount.address, - xpub: evmAccount.xpub, - xprv: '', - isImported: false, - isTrezorWallet: false, - isLedgerWallet: true, - balances: { syscoin: 0, ethereum: 0 }, - assets: { syscoin: [], ethereum: [] }, - }; - - // Test that Ledger reconnects and signs successfully - const result = await evmKeyring.ledgerSigner.evm.signEVMTransaction({ - rawTx: '0x1234567890', - accountIndex: 0, - }); - - // Verify reconnection happened - expect(evmKeyring.ledgerSigner.ensureConnection).toHaveBeenCalledTimes(1); - - // Verify the signature was returned - expect(result).toEqual({ - r: '123456789abcdef', - s: '987654321fedcba', - v: '00', - }); - - // Verify Ledger is now connected - expect(evmKeyring.ledgerSigner.transport).toBeTruthy(); + it('uses testnet identity without changing the account index', async () => { + const testState = global.createMockVaultState({ + activeAccountId: 0, + activeAccountType: KeyringAccountType.HDAccount, + networkType: INetworkType.Syscoin, + chainId: 5700, }); - - it('should handle EVM transaction signing for Ledger', async () => { - // Set up EVM vault state - const evmVaultState = createMockVaultState({ - activeAccountId: 0, - activeAccountType: KeyringAccountType.HDAccount, - networkType: INetworkType.Ethereum, - chainId: 1, - }); - const evmVaultStateGetter = jest.fn(() => evmVaultState); - - // Create EVM keyring with Ledger - const evmKeyring = await KeyringManager.createInitialized( - PEACE_SEED_PHRASE, - FAKE_PASSWORD, - evmVaultStateGetter - ); - - // Mock ensureConnection - evmKeyring.ledgerSigner.ensureConnection = jest - .fn() - .mockResolvedValue(undefined); - - // Mock Ledger EVM signer - const mockSignEVMTransaction = jest.fn().mockResolvedValue({ - r: '123456789abcdef123456789abcdef123456789abcdef123456789abcdef12345678', - s: '987654321fedcba987654321fedcba987654321fedcba987654321fedcba987654', - v: '00', - }); - - evmKeyring.ledgerSigner.evm = { - getEvmAddressAndPubKey: jest.fn().mockResolvedValue({ - address: '0x742D35Cc6634C0532925a3b844bc9e7595f2bd9f', - publicKey: '0x04...', - }), - signEVMTransaction: mockSignEVMTransaction, - signPersonalMessage: jest.fn().mockResolvedValue('0xmocked_signature'), - signTypedData: jest.fn().mockResolvedValue('0xmocked_typed_signature'), - }; - - // Import Ledger account - const evmAccount = await evmKeyring.importLedgerAccount('EVM Ledger'); - if (evmAccount) { - // Update vault state to set Ledger as active - evmVaultState.accounts[KeyringAccountType.Ledger][evmAccount.id] = { - id: evmAccount.id, - label: evmAccount.label, - address: evmAccount.address, - xpub: evmAccount.xpub, - xprv: '', - isImported: false, - isTrezorWallet: false, - isLedgerWallet: true, - balances: { syscoin: 0, ethereum: 0 }, - assets: { syscoin: [], ethereum: [] }, - }; - evmVaultState.activeAccount = { - id: evmAccount.id, - type: KeyringAccountType.Ledger, - }; - - // Account switch is handled by vault state update - } - - // Test that Ledger signing is called - expect it to fail at serialization but verify Ledger was called - try { - await evmKeyring.ethereumTransaction.sendFormattedTransaction({ - to: '0x742D35Cc6634C0532925a3b844bc9e7595f2bd9f', - value: '0x0', - data: '0x', - gasLimit: '0x5208', - maxFeePerGas: '0x3b9aca00', - maxPriorityFeePerGas: '0x1dcd6500', - chainId: 1, - from: '0x742D35Cc6634C0532925a3b844bc9e7595f2bd9f', - }); - // If it doesn't throw, that's fine too - } catch (error) { - // Expected to fail at signature serialization, but we should have called the Ledger signer - expect(error.message).toContain('value out of range'); - } - - // The important part: verify that Ledger signing was attempted with correct parameters - expect(mockSignEVMTransaction).toHaveBeenCalled(); - expect(mockSignEVMTransaction).toHaveBeenCalledWith({ - rawTx: expect.any(String), // Should be a hex string of the unsigned transaction - accountIndex: expect.any(Number), // Should be the account index - }); + const testnet = await createFreshTestKeyring( + PEACE_SEED_PHRASE, + FAKE_PASSWORD, + () => testState, + fixture.host as LedgerHost + ); + additional.push(testnet); + testnet.getAddress = jest.fn().mockResolvedValue('tsys1qledger'); + await testnet.importLedgerAccount(); + expect(fixture.host.utxo.getXpub).toHaveBeenCalledWith({ + currency: testState.activeNetwork.currency, + slip44: testState.activeNetwork.slip44, + accountIndex: 0, + checkOnDevice: true, }); }); - describe('Network Support', () => { - it('should support Ledger on different UTXO networks', async () => { - // Set up testnet vault state - const testnetVaultState = createMockVaultState({ - activeAccountId: 0, - activeAccountType: KeyringAccountType.HDAccount, - networkType: INetworkType.Syscoin, - chainId: 5700, - }); - const testnetVaultStateGetter = jest.fn(() => testnetVaultState); - - // Test on testnet - const testnetKeyring = await KeyringManager.createInitialized( - PEACE_SEED_PHRASE, - FAKE_PASSWORD, - testnetVaultStateGetter - ); - - // Mock getAddress to return testnet address - testnetKeyring.getAddress = jest - .fn() - .mockResolvedValue('tsys1q_testnet_ledger'); - - // Mock ensureConnection for testnet - testnetKeyring.ledgerSigner.ensureConnection = jest - .fn() - .mockResolvedValue(undefined); - - // Mock testnet Ledger - testnetKeyring.ledgerSigner.utxo = { - getXpub: jest - .fn() - .mockResolvedValue( - 'vpub5YMNvjHGu8MhNvgxNrGV8qZGkb3SVTiCAzqyCV8TbCZrEXrJqsCTMJjEJXBLfmjfFCDPRpGPW59THQMvPDuQejY5cSpfNYVZYcgJaMVZJCG' - ), - getUtxoAddress: jest.fn().mockResolvedValue('tsys1q_testnet_ledger'), - verifyUtxoAddress: jest.fn().mockResolvedValue('tsys1q_testnet_ledger'), - }; - - const account = await testnetKeyring.importLedgerAccount( - 'Testnet Ledger' - ); - if (account) { - expect(account.address.match(/^(sys1|tsys1)/)).toBeTruthy(); - } - }); - - it('should maintain separate Ledger accounts per network', async () => { - // Mock getAddress for mainnet - keyringManager.getAddress = jest - .fn() - .mockResolvedValue('sys1q_mainnet_ledger'); - - // Mock mainnet Ledger - keyringManager.ledgerSigner.utxo = { - getXpub: jest - .fn() - .mockResolvedValue( - 'zpub6rFR7y4Q2AijBEqTUquhVz398htDFrtymD9xYYfG1m4wAcvPhXNfE3EfH1r1ADqtfSdVCToUG868RvUUkgDKf31mGDtKsAYz2oz2AGutZYs' - ), - getUtxoAddress: jest.fn().mockResolvedValue('sys1q_mainnet_ledger'), - verifyUtxoAddress: jest.fn().mockResolvedValue('sys1q_mainnet_ledger'), - }; - - // Import on mainnet - const mainnetAccount = await keyringManager.importLedgerAccount( - 'Mainnet Ledger' - ); - - // Set up testnet vault state - const testnetVaultState = createMockVaultState({ - activeAccountId: 0, - activeAccountType: KeyringAccountType.HDAccount, - networkType: INetworkType.Syscoin, - chainId: 5700, - }); - const testnetVaultStateGetter = jest.fn(() => testnetVaultState); - - // Create testnet keyring - const testnetKeyring = await KeyringManager.createInitialized( - PEACE_SEED_PHRASE, - FAKE_PASSWORD, - testnetVaultStateGetter - ); - - // Mock getAddress for testnet - testnetKeyring.getAddress = jest - .fn() - .mockResolvedValue('tsys1q_testnet_ledger'); - - // Mock ensureConnection for testnet - testnetKeyring.ledgerSigner.ensureConnection = jest - .fn() - .mockResolvedValue(undefined); + it('cannot export a Ledger private key', async () => { + const account = await keyring.importLedgerAccount('Private key isolation'); + state.accounts[KeyringAccountType.Ledger][account.id] = account; + await expect( + keyring.getPrivateKeyByAccountId( + account.id, + KeyringAccountType.Ledger, + FAKE_PASSWORD + ) + ).rejects.toThrow(); + expect(account.xprv).toBe(''); + }); - // Mock testnet Ledger - testnetKeyring.ledgerSigner.utxo = { - getXpub: jest - .fn() - .mockResolvedValue( - 'vpub5YMNvjHGu8MhNvgxNrGV8qZGkb3SVTiCAzqyCV8TbCZrEXrJqsCTMJjEJXBLfmjfFCDPRpGPW59THQMvPDuQejY5cSpfNYVZYcgJaMVZJCG' - ), - getUtxoAddress: jest.fn().mockResolvedValue('tsys1q_testnet_ledger'), - verifyUtxoAddress: jest.fn().mockResolvedValue('tsys1q_testnet_ledger'), - }; + it('does not retry hardware refusal or malformed import output', async () => { + fixture.host.utxo.getXpub.mockRejectedValue(new Error('User rejected')); + await expect(keyring.importLedgerAccount()).rejects.toThrow( + 'User rejected' + ); + expect(fixture.host.utxo.getXpub).toHaveBeenCalledTimes(1); + fixture.host.utxo.getXpub.mockResolvedValue(''); + await expect(keyring.importLedgerAccount()).rejects.toThrow(); + }); +}); - // Import on testnet - const testnetAccount = await testnetKeyring.importLedgerAccount( - 'Testnet Ledger' - ); +describe('Ledger authority facade', () => { + const address = wallet.address; + it('fails closed without an injected host', async () => { + const ledger = new LedgerKeyring(); + await expect( + ledger.evm.getEvmAddressAndPubKey({ accountIndex: 0 }) + ).rejects.toMatchObject({ code: 'HARDWARE_SIGNER_UNAVAILABLE' }); + }); - // Accounts should be independent - if (mainnetAccount && testnetAccount) { - expect(mainnetAccount.address).not.toBe(testnetAccount.address); - expect(mainnetAccount.address.match(/^(sys1|tsys1)/)).toBeTruthy(); - expect(testnetAccount.address.match(/^(sys1|tsys1)/)).toBeTruthy(); - } + it('reconnects only through the authorized host and preserves approved EVM identity', async () => { + const { host, setConnected } = mockHost(); + setConnected(false); + const ledger = new LedgerKeyring(undefined, host as LedgerHost); + const request = { + accountIndex: 2, + rawTx: transactionHex, + expectedAddress: address, + }; + await expect(ledger.evm.signEVMTransaction(request)).resolves.toEqual( + signDigest(Transaction.from(`0x${transactionHex}`).unsignedHash) + ); + expect(host.connect).toHaveBeenCalledWith({ useGrantedDevices: true }); + expect(host.evm.signTransaction).toHaveBeenCalledWith({ + accountIndex: 2, + unsignedTxHex: transactionHex, + expectedAddress: address, }); }); - describe('Error Handling', () => { - it('should handle Ledger communication errors', async () => { - // Mock communication error - keyringManager.ledgerSigner.utxo = { - getXpub: jest - .fn() - .mockRejectedValue(new Error('Ledger device communication error')), - getUtxoAddress: jest.fn(), - verifyUtxoAddress: jest.fn(), - }; - - await expect(keyringManager.importLedgerAccount()).rejects.toThrow( - 'Ledger device communication error' - ); + it('forwards message bytes and typed-data version without changing their payload', async () => { + const { host } = mockHost(); + const ledger = new LedgerKeyring(undefined, host as LedgerHost); + await ledger.evm.signPersonalMessage({ + accountIndex: 1, + message: '00ff', + expectedAddress: address, }); - - it('should handle invalid Ledger responses', async () => { - // Mock invalid response - keyringManager.ledgerSigner.utxo = { - getXpub: jest.fn().mockResolvedValue(null), - getUtxoAddress: jest.fn().mockResolvedValue(null), - verifyUtxoAddress: jest.fn(), - }; - - await expect(keyringManager.importLedgerAccount()).rejects.toThrow( - 'Something wrong happened' - ); + expect(host.evm.signPersonalMessage).toHaveBeenCalledWith({ + accountIndex: 1, + messageHex: '00ff', + expectedAddress: address, }); - - it('should handle Ledger app not open', async () => { - keyringManager.ledgerSigner.utxo = { - getXpub: jest - .fn() - .mockRejectedValue(new Error('Please open Syscoin app on Ledger')), - getUtxoAddress: jest.fn(), - verifyUtxoAddress: jest.fn(), - }; - - await expect(keyringManager.importLedgerAccount()).rejects.toThrow( - 'Please open Syscoin app on Ledger' - ); + const data = { + domain: {}, + types: { EIP712Domain: [] }, + primaryType: 'EIP712Domain', + message: {}, + }; + await ledger.evm.signTypedData({ + accountIndex: 1, + data, + version: SignTypedDataVersion.V4, + expectedAddress: address, + }); + expect(host.evm.signTypedData).toHaveBeenCalledWith({ + accountIndex: 1, + data, + version: 'V4', + expectedAddress: address, }); }); - describe('Security', () => { - it('should not expose private keys for hardware wallets', async () => { - // Mock getAddress - keyringManager.getAddress = jest - .fn() - .mockResolvedValue('sys1q_test_address'); - - keyringManager.ledgerSigner.utxo = { - getXpub: jest - .fn() - .mockResolvedValue( - 'zpub6s8HtEQtcu3AmBn9sniSqCAVhx2nJAhb2sd5NDYeYZ1ZJaZx7MAVZZnG1PdCUNJcVJXGbVpGfSYZLgkPSUjLYnJg8UdYvdkfaygcXZKPLy6' - ), - getUtxoAddress: jest.fn().mockResolvedValue('sys1q_test_address'), - verifyUtxoAddress: jest.fn().mockResolvedValue('sys1q_test_address'), - }; - - const account = await keyringManager.importLedgerAccount('Security Test'); - - expect(account).toBeDefined(); - if (account) { - expect(account.xprv).toBe(''); // Should be empty for hardware wallets - expect(account.isLedgerWallet).toBe(true); + it('rejects legacy typed data before reaching the host', async () => { + const { host } = mockHost(); + const ledger = new LedgerKeyring(undefined, host as LedgerHost); + await expect( + ledger.evm.signTypedData({ + accountIndex: 0, + data: [] as any, + version: SignTypedDataVersion.V1, + expectedAddress: address, + }) + ).rejects.toMatchObject({ code: 'LEDGER_INVALID_REQUEST' }); + expect(host.evm.signTypedData).not.toHaveBeenCalled(); + }); - // Should not be able to get private key for hardware wallet - await expect( - keyringManager.getPrivateKeyByAccountId( - account.id, - KeyringAccountType.Ledger, - FAKE_PASSWORD - ) - ).rejects.toThrow(); - } + it('requires on-device verification for verify address', async () => { + const { host } = mockHost(); + const ledger = new LedgerKeyring(undefined, host as LedgerHost); + await ledger.verifyUtxoAddress(3, 'tSYS', 1); + expect(host.utxo.getAddress).toHaveBeenCalledWith({ + accountIndex: 3, + currency: 'tSYS', + slip44: 1, + checkOnDevice: true, }); + }); - it('should maintain hardware wallet isolation', async () => { - // Mock getAddress - keyringManager.getAddress = jest - .fn() - .mockResolvedValue('sys1q_isolation_address'); - - // Mock and import Ledger account - keyringManager.ledgerSigner.utxo = { - getXpub: jest - .fn() - .mockResolvedValue( - 'zpub6s8HtEQtcu3AmBn9sniSqCAVhx2nJAhb2sd5NDYeYZ1ZJaZx7MAVZZnG1PdCUNJcVJXGbVpGfSYZLgkPSUjLYnJg8UdYvdkfaygcXZKPLy6' - ), - getUtxoAddress: jest.fn().mockResolvedValue('sys1q_isolation_address'), - verifyUtxoAddress: jest - .fn() - .mockResolvedValue('sys1q_isolation_address'), - }; - - const ledgerAccount = await keyringManager.importLedgerAccount( - 'Isolation Test' - ); - - if (ledgerAccount) { - // Update vault state - currentVaultState.accounts[KeyringAccountType.Ledger][ - ledgerAccount.id - ] = { - id: ledgerAccount.id, - label: ledgerAccount.label, - address: ledgerAccount.address, - xpub: ledgerAccount.xpub, - xprv: '', - isImported: false, - isTrezorWallet: false, - isLedgerWallet: true, - balances: { syscoin: 0, ethereum: 0 }, - assets: { syscoin: [], ethereum: [] }, - }; - - // Verify Ledger accounts are completely separate from HD accounts - const hdAccounts = - currentVaultState.accounts[KeyringAccountType.HDAccount]; - const ledgerAccounts = - currentVaultState.accounts[KeyringAccountType.Ledger]; - - expect(Object.keys(hdAccounts)).toHaveLength(1); // Initial HD account - expect(Object.keys(ledgerAccounts)).toHaveLength(1); // One imported Ledger account - - // Verify no cross-contamination of account types - Object.values(hdAccounts).forEach((account: any) => { - expect(account.isLedgerWallet).toBe(false); - }); - - Object.values(ledgerAccounts).forEach((account: any) => { - expect(account.isLedgerWallet).toBe(true); - }); - } + it('invalidates a pending result synchronously when destroyed', async () => { + const { host } = mockHost(); + let resolve!: (value: any) => void; + host.evm.getAddress.mockReturnValue( + new Promise((done) => { + resolve = done; + }) + ); + const ledger = new LedgerKeyring(undefined, host as LedgerHost); + const pending = ledger.evm.getEvmAddressAndPubKey({ accountIndex: 0 }); + await ledger.destroy(); + resolve({ address, publicKey: '04' }); + await expect(pending).rejects.toMatchObject({ + code: 'HARDWARE_REQUEST_CANCELLED', }); + expect(host.disconnect).toHaveBeenCalledTimes(1); }); }); diff --git a/packages/sysweb3-keyring/test/unit/hardware/trezor-address.spec.ts b/packages/sysweb3-keyring/test/unit/hardware/trezor-address.spec.ts new file mode 100644 index 00000000..c5b18448 --- /dev/null +++ b/packages/sysweb3-keyring/test/unit/hardware/trezor-address.spec.ts @@ -0,0 +1,99 @@ +/* eslint-disable camelcase */ +import { bech32 } from 'bech32'; +import bs58check from 'bs58check'; +import { utils } from 'syscoinjs-lib'; + +import { TrezorKeyring } from '../../../src/trezor'; + +const bitcoinjs = (utils as any).bitcoinjs; +const receiver = Object.create(TrezorKeyring.prototype) as TrezorKeyring; +const hash = Buffer.from(Array.from({ length: 20 }, (_, index) => index)); +const bitcoin = { pubKeyHash: 0, scriptHash: 5, bech32: 'bc' }; +const syscoin = { pubKeyHash: 63, scriptHash: 5, bech32: 'sys' }; +const testnet = { pubKeyHash: 111, scriptHash: 196, bech32: 'tb' }; + +it.each([bitcoin, syscoin, testnet])( + 'preserves standard Base58 classifications for %j', + (network) => { + const publicKey = bitcoinjs.address.toBase58Check(hash, network.pubKeyHash); + const script = bitcoinjs.address.toBase58Check(hash, network.scriptHash); + expect(receiver.isScriptHash(publicKey, network)).toBe(false); + expect(receiver.isScriptHash(script, network)).toBe(true); + expect(receiver.isBech32(publicKey)).toBe(false); + expect(receiver.isBech32(script)).toBe(false); + } +); + +it('preserves checksum-verified two-byte versions and leading zero bytes', () => { + const network = { pubKeyHash: 0x1cb8, scriptHash: 0x1cbd }; + for (const [version, expected] of [ + [network.pubKeyHash, false], + [network.scriptHash, true], + ] as const) { + const address = bs58check.encode( + Buffer.concat([Buffer.from([version >>> 8, version & 0xff]), hash]) + ); + expect(receiver.isScriptHash(address, network)).toBe(expected); + } + const leadingZeroVersion = bs58check.encode(Buffer.alloc(22)); + expect(receiver.isScriptHash(leadingZeroVersion, bitcoin)).toBe(false); + expect( + receiver.isScriptHash( + bitcoinjs.address.toBase58Check(Buffer.alloc(20), 0), + bitcoin + ) + ).toBe(false); +}); + +it.each(['bc', 'tb', 'sys', 'tsys'])( + 'preserves SegWit classification for %s', + (prefix) => { + const keyHash = bitcoinjs.address.toBech32(hash, 0, prefix); + const scriptHash = bitcoinjs.address.toBech32( + Buffer.alloc(32, 1), + 0, + prefix + ); + const taproot = bitcoinjs.address.toBech32(Buffer.alloc(32, 2), 1, prefix); + expect(receiver.isBech32(keyHash)).toBe(true); + expect(receiver.isScriptHash(keyHash, { bech32: prefix })).toBe(false); + expect(receiver.isScriptHash(scriptHash, { bech32: prefix })).toBe(true); + // Preserve the existing helper's 32-byte-program classification. + expect(receiver.isScriptHash(taproot, { bech32: prefix })).toBe(true); + expect(receiver.isBech32(keyHash.toUpperCase())).toBe(true); + } +); + +it.each([20, 23])( + 'rejects a checksum-valid Base58 payload of invalid length %i', + (length) => { + const value = bs58check.encode(Buffer.alloc(length)); + expect(() => receiver.isScriptHash(value, bitcoin)).toThrow(TypeError); + expect(() => receiver.isScriptHash(value, bitcoin)).toThrow( + length < 21 ? 'too short' : 'too long' + ); + } +); + +it('rejects invalid checksums, mixed-case Bech32, wrong encodings and invalid script programs', () => { + const value = bitcoinjs.address.toBase58Check(hash, 0); + expect(() => + receiver.isScriptHash( + value.slice(0, -1) + (value.endsWith('1') ? '2' : '1'), + bitcoin + ) + ).toThrow(); + const witness = bitcoinjs.address.toBech32(hash, 0, 'bc'); + expect(receiver.isBech32('B' + witness.slice(1))).toBe(false); + const wrongEncoding = bech32.encode('bc', [ + 1, + ...bech32.toWords(Buffer.alloc(32)), + ]); + expect(receiver.isBech32(wrongEncoding)).toBe(false); + for (const length of [19, 21]) { + const malformed = bitcoinjs.address.toBech32(Buffer.alloc(length), 0, 'bc'); + expect(() => receiver.isScriptHash(malformed, bitcoin)).toThrow( + 'Unknown address type' + ); + } +}); diff --git a/packages/sysweb3-keyring/test/unit/hardware/trezor-connect-adapter.spec.ts b/packages/sysweb3-keyring/test/unit/hardware/trezor-connect-adapter.spec.ts new file mode 100644 index 00000000..7a3d4473 --- /dev/null +++ b/packages/sysweb3-keyring/test/unit/hardware/trezor-connect-adapter.spec.ts @@ -0,0 +1,316 @@ +/* eslint-disable camelcase */ +import ConnectMock from '@trezor/connect-webextension'; + +import { HardwareWalletManager } from '../../../src/hardware-wallet-manager'; + +type AdapterModule = typeof import('../../../src/trezor/connect'); +let adapter: AdapterModule; +const chromeDescriptor = Object.getOwnPropertyDescriptor(globalThis, 'chrome'); +const extensionHost = () => ({ + runtime: { + id: 'synthetic-test-extension', + getManifest: () => ({ manifest_version: 3 }), + onConnect: { addListener: jest.fn() }, + onMessageExternal: { addListener: jest.fn() }, + }, + tabs: { get: jest.fn(), create: jest.fn(), update: jest.fn() }, + windows: { getCurrent: jest.fn() }, +}); + +beforeEach(() => { + jest.restoreAllMocks(); + jest.clearAllMocks(); + jest.isolateModules(() => { + adapter = jest.requireActual('../../../src/trezor/connect'); + }); +}); +afterEach(() => { + if (chromeDescriptor) + Object.defineProperty(globalThis, 'chrome', chromeDescriptor); + else delete (globalThis as any).chrome; +}); + +it.each(['absent', 'incomplete', 'mv2'])( + 'rejects the %s host before calling Connect', + async (host) => { + const chrome: any = extensionHost(); + if (host === 'absent') delete (globalThis as any).chrome; + else { + if (host === 'incomplete') delete chrome.runtime.onMessageExternal; + if (host === 'mv2') + chrome.runtime.getManifest = () => ({ manifest_version: 2 }); + (globalThis as any).chrome = chrome; + } + await expect( + adapter.default.init({ + manifest: { + appName: 'Pali', + appUrl: 'https://paliwallet.com', + email: 'test@example.invalid', + }, + }) + ).rejects.toMatchObject({ code: 'HARDWARE_SIGNER_UNAVAILABLE' }); + expect(ConnectMock.init).not.toHaveBeenCalled(); + await expect(adapter.default.dispose()).resolves.toBeUndefined(); + } +); + +it('loads Connect only for a supported extension and selects its webextension environment', async () => { + (globalThis as any).chrome = extensionHost(); + await adapter.default.init({ + manifest: { + appName: 'Pali', + appUrl: 'https://paliwallet.com', + email: 'test@example.invalid', + }, + coreMode: 'auto', + }); + expect(ConnectMock.init).toHaveBeenCalledWith({ + manifest: { + appName: 'Pali', + appUrl: 'https://paliwallet.com', + email: 'test@example.invalid', + }, + coreMode: 'auto', + env: 'webextension', + }); +}); + +it('preserves Connect 10 cancellation codes and the established SDK failure payload', async () => { + (globalThis as any).chrome = extensionHost(); + await adapter.default.init({ + manifest: { + appName: 'Pali', + appUrl: 'https://paliwallet.com', + email: 'test@example.invalid', + }, + }); + jest.spyOn(ConnectMock, 'getAccountInfo').mockResolvedValueOnce({ + success: false, + error: { code: 'Method_Cancel', message: 'Canceled' }, + } as any); + const result = await adapter.default.getAccountInfo({ + coin: 'sys', + path: "m/84'/57'/0'", + }); + expect(result).toMatchObject({ + success: false, + error: { code: 'Method_Cancel' }, + payload: { code: 'Method_Cancel', error: 'Canceled' }, + }); + if (!result.success) + expect(adapter.trezorResponseError(result)).toMatchObject({ + code: 'Method_Cancel', + message: 'Canceled', + }); +}); + +it('isolates status observers and reports model/disconnection from actual call outcomes', async () => { + (globalThis as any).chrome = extensionHost(); + await adapter.default.init({ + manifest: { + appName: 'Pali', + appUrl: 'https://paliwallet.com', + email: 'test@example.invalid', + }, + }); + const listener = jest.fn(); + adapter.subscribeTrezorEvents(() => { + throw new Error('synthetic observer failure'); + }); + const stop = adapter.subscribeTrezorEvents(listener); + jest.spyOn(ConnectMock, 'getAccountInfo').mockResolvedValueOnce({ + success: true, + payload: { descriptor: 'synthetic' }, + device: { features: { model: 'T3W1' } }, + } as any); + await expect( + adapter.default.getAccountInfo({ coin: 'sys', path: "m/84'/57'/0'" }) + ).resolves.toMatchObject({ success: true }); + expect(listener).toHaveBeenCalledWith({ type: 'model', model: 'T3W1' }); + jest.spyOn(ConnectMock, 'getAccountInfo').mockResolvedValueOnce({ + success: false, + error: { code: 'Device_Disconnected', message: 'Device disconnected' }, + } as any); + await expect( + adapter.default.getAccountInfo({ coin: 'sys', path: "m/84'/57'/0'" }) + ).resolves.toMatchObject({ success: false }); + expect(listener).toHaveBeenCalledWith({ type: 'disconnected' }); + stop(); +}); + +it.each([ + 'Method_Cancel', + 'Method_Interrupted', + 'Method_Unsupported', + 'Method_UnsupportedCoinForHost', + 'Device_Disconnected', + 'Device_NotFound', + 'Transport_Missing', + 'Desktop_ConnectionMissing', + 'Method_PermissionsNotGranted', + 'Browser_LocalNetworkPermissionMissing', + 'HARDWARE_SIGNER_UNAVAILABLE', +])('does not retry terminal %s errors', async (code) => { + const manager = new HardwareWalletManager(); + const operation = jest + .fn() + .mockRejectedValue( + Object.assign(new Error('synthetic terminal error'), { code }) + ); + try { + await expect( + manager.retryOperation(operation, 'synthetic', { + maxRetries: 3, + baseDelay: 0, + }) + ).rejects.toMatchObject({ code }); + expect(operation).toHaveBeenCalledTimes(1); + } finally { + await manager.destroy(); + } +}); + +it('reattaches connection observers after a locked wallet reuses its manager', async () => { + const mock = jest.requireMock('../../../src/trezor/connect'); + const observers = new Set<(event: { type: string }) => void>(); + jest + .spyOn(mock, 'subscribeTrezorEvents') + .mockImplementation((listener: any) => { + observers.add(listener); + return () => observers.delete(listener); + }); + const manager = new HardwareWalletManager(); + try { + expect(await manager.initializeTrezor()).toBe(true); + await manager.destroy(); + expect(observers.size).toBe(0); + expect(await manager.initializeTrezor()).toBe(true); + expect(observers.size).toBe(1); + for (const listener of observers) listener({ type: 'disconnected' }); + expect(manager.getStatus()).toContainEqual( + expect.objectContaining({ type: 'trezor', connected: false }) + ); + } finally { + await manager.destroy(); + } +}); + +it('rejects a pending request immediately on disposal and ignores late approval', async () => { + (globalThis as any).chrome = extensionHost(); + await adapter.default.init({ + manifest: { + appName: 'Pali', + appUrl: 'https://paliwallet.com', + email: 'test@example.invalid', + }, + }); + let approve!: (result: any) => void; + jest.spyOn(ConnectMock, 'getAccountInfo').mockImplementation( + () => + new Promise((resolve) => { + approve = resolve; + }) as any + ); + const observer = jest.fn(); + adapter.subscribeTrezorEvents(observer); + const request = adapter.default.getAccountInfo({ + coin: 'sys', + path: "m/84'/57'/0'", + }); + const rejected = expect(request).rejects.toMatchObject({ + code: 'Method_Interrupted', + }); + await new Promise(setImmediate); + await adapter.default.dispose(); + await rejected; + expect(ConnectMock.cancel).not.toHaveBeenCalled(); + await expect( + adapter.default.init({ + manifest: { + appName: 'Pali', + appUrl: 'https://paliwallet.com', + email: 'test@example.invalid', + }, + }) + ).rejects.toMatchObject({ code: 'HARDWARE_SIGNER_BUSY' }); + expect(ConnectMock.dispose).not.toHaveBeenCalled(); + approve({ + success: true, + payload: { descriptor: 'late' }, + device: { features: { model: 'LATE' } }, + }); + await new Promise(setImmediate); + expect(observer).not.toHaveBeenCalledWith( + expect.objectContaining({ type: 'model' }) + ); + await expect( + adapter.default.getAccountInfo({ coin: 'sys', path: "m/84'/57'/0'" }) + ).rejects.toMatchObject({ code: 'Init_NotInitialized' }); +}); + +it('rejects pending work without invoking unsafe upstream cancellation', async () => { + (globalThis as any).chrome = extensionHost(); + await adapter.default.init({ + manifest: { + appName: 'Pali', + appUrl: 'https://paliwallet.com', + email: 'test@example.invalid', + }, + }); + jest.spyOn(ConnectMock, 'getAccountInfo').mockImplementation( + () => + new Promise(() => { + /* Hold the remote operation until after local disposal. */ + }) as any + ); + jest.spyOn(ConnectMock, 'cancel').mockImplementation(() => { + throw new Error('remote cancellation unavailable'); + }); + const request = adapter.default.getAccountInfo({ + coin: 'sys', + path: "m/84'/57'/0'", + }); + const rejected = expect(request).rejects.toMatchObject({ + code: 'Method_Interrupted', + }); + await new Promise(setImmediate); + await expect(adapter.default.dispose()).resolves.toBeUndefined(); + await rejected; + expect(ConnectMock.dispose).not.toHaveBeenCalled(); + expect(ConnectMock.cancel).not.toHaveBeenCalled(); +}); + +it('does not initialize or send after disposal overtakes a queued import', async () => { + (globalThis as any).chrome = extensionHost(); + const initialization = adapter.default.init({ + manifest: { + appName: 'Pali', + appUrl: 'https://paliwallet.com', + email: 'test@example.invalid', + }, + }); + const rejected = expect(initialization).rejects.toMatchObject({ + code: 'Method_Interrupted', + }); + await adapter.default.dispose(); + await rejected; + expect(ConnectMock.init).not.toHaveBeenCalled(); +}); + +it('preserves a stable busy error through manager initialization without retry', async () => { + jest.spyOn(ConnectMock, 'init').mockRejectedValueOnce( + Object.assign(new Error('Previous Trezor request is still pending'), { + code: 'HARDWARE_SIGNER_BUSY', + }) + ); + const manager = new HardwareWalletManager(); + try { + await expect(manager.initializeTrezor()).rejects.toMatchObject({ + code: 'HARDWARE_SIGNER_BUSY', + }); + expect(ConnectMock.init).toHaveBeenCalledTimes(1); + } finally { + await manager.destroy(); + } +}); diff --git a/packages/sysweb3-keyring/test/unit/hardware/trezor-manager-lifecycle.spec.ts b/packages/sysweb3-keyring/test/unit/hardware/trezor-manager-lifecycle.spec.ts new file mode 100644 index 00000000..ad845e5c --- /dev/null +++ b/packages/sysweb3-keyring/test/unit/hardware/trezor-manager-lifecycle.spec.ts @@ -0,0 +1,339 @@ +/* eslint-disable camelcase */ +import ConnectMock from '@trezor/connect-webextension'; + +import type { HardwareWalletManager } from '../../../src/hardware-wallet-manager'; +import type { LedgerHost } from '../../../src/ledger/host-types'; +import type { TrezorKeyring } from '../../../src/trezor'; + +jest.unmock('../../../src/trezor/connect'); + +type Adapter = typeof import('../../../src/trezor/connect'); +let adapter: Adapter; +let Manager: typeof HardwareWalletManager; +let Keyring: typeof TrezorKeyring; +let managers: HardwareWalletManager[]; +let keyrings: TrezorKeyring[]; +let releaseHeld: (() => void)[]; +const chromeDescriptor = Object.getOwnPropertyDescriptor(globalThis, 'chrome'); +const tick = () => new Promise((resolve) => setImmediate(resolve)); +const held = () => { + let resolve!: () => void; + const promise = new Promise((done) => (resolve = done)); + releaseHeld.push(resolve); + return { promise, resolve }; +}; +const waitFor = async (condition: () => boolean) => { + for (let count = 0; count < 30 && !condition(); count++) await tick(); + expect(condition()).toBe(true); +}; +const manager = (host?: LedgerHost) => { + const value = new Manager(host); + managers.push(value); + return value; +}; +const status = (value: HardwareWalletManager) => + value.getStatus().find((entry) => entry.type === 'trezor')!; + +beforeEach(() => { + jest.restoreAllMocks(); + jest.clearAllMocks(); + managers = []; + keyrings = []; + releaseHeld = []; + (globalThis as any).chrome = { + runtime: { + id: 'synthetic-test-extension', + getManifest: () => ({ manifest_version: 3 }), + onConnect: { addListener: jest.fn() }, + onMessageExternal: { addListener: jest.fn() }, + }, + tabs: { get: jest.fn(), create: jest.fn(), update: jest.fn() }, + windows: { getCurrent: jest.fn() }, + }; + jest.isolateModules(() => { + adapter = jest.requireActual('../../../src/trezor/connect'); + Manager = jest.requireActual( + '../../../src/hardware-wallet-manager' + ).HardwareWalletManager; + Keyring = jest.requireActual('../../../src/trezor').TrezorKeyring; + }); +}); + +afterEach(async () => { + for (const release of releaseHeld) release(); + await tick(); + for (const value of keyrings) await value.destroy(); + for (const value of managers) await value.destroy(); + jest.useRealTimers(); + if (chromeDescriptor) + Object.defineProperty(globalThis, 'chrome', chromeDescriptor); + else delete (globalThis as any).chrome; +}); + +it('keeps initialization ownership while a second caller waits and returns false', async () => { + const initialization = held(); + jest.spyOn(ConnectMock, 'init').mockReturnValueOnce(initialization.promise); + const value = manager(); + const first = value.initializeTrezor(); + await waitFor(() => (ConnectMock.init as jest.Mock).mock.calls.length === 1); + expect(status(value).status).toBe('connecting'); + const delayed = held(); + const delay = jest + .spyOn(value as any, 'delay') + .mockReturnValueOnce(delayed.promise); + const second = value.initializeTrezor(); + expect(delay).toHaveBeenCalledWith(1000); + delayed.resolve(); + await expect(second).resolves.toBe(false); + expect(ConnectMock.init).toHaveBeenCalledTimes(1); + expect(ConnectMock.dispose).not.toHaveBeenCalled(); + initialization.resolve(); + await expect(first).resolves.toBe(true); + expect(status(value).connected).toBe(true); +}); + +it('returns true to a waiting caller once the original initialization succeeds', async () => { + const initialization = held(); + jest.spyOn(ConnectMock, 'init').mockReturnValueOnce(initialization.promise); + const value = manager(); + const first = value.initializeTrezor(); + await waitFor(() => (ConnectMock.init as jest.Mock).mock.calls.length === 1); + const delayed = held(); + jest.spyOn(value as any, 'delay').mockReturnValueOnce(delayed.promise); + const second = value.initializeTrezor(); + initialization.resolve(); + await expect(first).resolves.toBe(true); + delayed.resolve(); + await expect(second).resolves.toBe(true); + expect(ConnectMock.init).toHaveBeenCalledTimes(1); +}); + +it('locks during held initialization without waiting for or reviving its raw result', async () => { + const initialization = held(); + jest.spyOn(ConnectMock, 'init').mockReturnValueOnce(initialization.promise); + const value = manager(); + const connected = jest.fn(); + value.on('connected', connected); + const first = value.initializeTrezor(); + await waitFor(() => (ConnectMock.init as jest.Mock).mock.calls.length === 1); + await value.destroy(); + await expect(first).resolves.toBe(false); + expect(status(value).connected).toBe(false); + expect(connected).not.toHaveBeenCalled(); + await expect(value.initializeTrezor()).rejects.toMatchObject({ + code: 'HARDWARE_SIGNER_BUSY', + }); + initialization.resolve(); + await tick(); + await expect(value.initializeTrezor()).resolves.toBe(true); + expect(ConnectMock.init).toHaveBeenCalledTimes(2); + expect(status(value).connected).toBe(true); +}); + +it('does not retry or clean up a newer connection after destruction during backoff', async () => { + jest.spyOn(ConnectMock, 'init').mockRejectedValueOnce(new Error('temporary')); + const value = manager(); + const backoff = held(); + const delay = jest + .spyOn(value as any, 'delay') + .mockReturnValueOnce(backoff.promise); + const first = value.initializeTrezor(); + await waitFor(() => delay.mock.calls.length === 1); + await value.destroy(); + await expect(value.initializeTrezor()).resolves.toBe(true); + const disposals = (ConnectMock.dispose as jest.Mock).mock.calls.length; + backoff.resolve(); + await expect(first).resolves.toBe(false); + expect(ConnectMock.init).toHaveBeenCalledTimes(2); + expect(ConnectMock.dispose).toHaveBeenCalledTimes(disposals); + expect(status(value).connected).toBe(true); +}); + +it('blocks initialization while cleanup is active and shares destruction completion', async () => { + const value = manager(); + await expect(value.initializeTrezor()).resolves.toBe(true); + const cleanup = held(); + jest.spyOn(ConnectMock, 'dispose').mockReturnValueOnce(cleanup.promise); + const destruction = value.destroy(); + expect(value.destroy()).toBe(destruction); + await expect(value.initializeTrezor()).rejects.toMatchObject({ + code: 'Method_Interrupted', + }); + expect(status(value).connected).toBe(false); + cleanup.resolve(); + await destruction; + await expect(value.initializeTrezor()).resolves.toBe(true); +}); + +it('does not delete a replacement pool entry when old cleanup finishes', async () => { + const value = manager(); + await expect(value.initializeTrezor()).resolves.toBe(true); + const cleanup = held(); + jest.spyOn(ConnectMock, 'dispose').mockReturnValueOnce(cleanup.promise); + const internal = value as any; + const closing = internal.closeConnection('trezor-default'); + await waitFor( + () => (ConnectMock.dispose as jest.Mock).mock.calls.length === 1 + ); + const replacement = { + status: 'connected', + lastActivity: Date.now(), + retryCount: 0, + }; + internal.connectionPool.set('trezor-default', replacement); + cleanup.resolve(); + await closing; + expect(internal.connectionPool.get('trezor-default')).toBe(replacement); +}); + +it('does not publish an old monitor snapshot after destruction begins', async () => { + const cleanup = held(); + const close = jest.fn(() => cleanup.promise); + const value = manager({ + disconnect: close, + getStatus: () => ({ connected: true }), + } as unknown as LedgerHost); + await value.initializeTrezor(); + (value as any).connectionPool.set('ledger-default', { + status: 'connected', + lastActivity: 0, + retryCount: 0, + }); + const observer = jest.fn(); + value.on('statusUpdate', observer); + const checking = (value as any).checkAllConnections(); + await waitFor(() => close.mock.calls.length === 1); + const destruction = value.destroy(); + cleanup.resolve(); + await Promise.all([checking, destruction]); + expect(observer).not.toHaveBeenCalled(); +}); + +it('still invalidates a genuine adapter cancellation during initialization', async () => { + const initialization = held(); + jest.spyOn(ConnectMock, 'init').mockReturnValueOnce(initialization.promise); + const value = manager(); + const first = value.initializeTrezor(); + await waitFor(() => (ConnectMock.init as jest.Mock).mock.calls.length === 1); + await adapter.default.dispose(); + await expect(first).resolves.toBe(false); + expect(status(value).connected).toBe(false); + initialization.resolve(); +}); + +it('does not let an old waiting caller borrow a post-lock connection', async () => { + const initialization = held(); + jest.spyOn(ConnectMock, 'init').mockReturnValueOnce(initialization.promise); + const value = manager(); + const first = value.initializeTrezor(); + await waitFor(() => (ConnectMock.init as jest.Mock).mock.calls.length === 1); + const delayed = held(); + jest.spyOn(value as any, 'delay').mockReturnValueOnce(delayed.promise); + const second = value.initializeTrezor(); + await value.destroy(); + await expect(first).resolves.toBe(false); + initialization.resolve(); + await tick(); + await expect(value.initializeTrezor()).resolves.toBe(true); + delayed.resolve(); + await expect(second).resolves.toBe(false); + expect(status(value).connected).toBe(true); +}); + +it('does not return initialization success when a connected observer destroys it', async () => { + const value = manager(); + value.on('connected', () => { + void value.destroy(); + }); + await expect(value.initializeTrezor()).resolves.toBe(false); + await value.destroy(); + expect(status(value).connected).toBe(false); +}); + +it('revokes a queued Trezor reply synchronously before waiting for Ledger cleanup', async () => { + const ledger = held(); + const value = manager({ + disconnect: () => ledger.promise, + getStatus: () => ({ connected: true }), + } as unknown as LedgerHost); + (value as any).connectionPool.set('ledger-default', { + status: 'connected', + lastActivity: Date.now(), + retryCount: 0, + }); + await expect(value.initializeTrezor()).resolves.toBe(true); + let reply!: (response: any) => void; + jest.spyOn(ConnectMock, 'getAccountInfo').mockImplementationOnce( + () => + new Promise((resolve) => { + reply = resolve; + }) as any + ); + const request = adapter.default.getAccountInfo({ + coin: 'sys', + path: "m/84'/57'/0'", + }); + const rejected = expect(request).rejects.toMatchObject({ + code: 'Method_Interrupted', + }); + await waitFor(() => !!reply); + const observer = jest.fn(); + adapter.subscribeTrezorEvents(observer); + // Queue the raw success first, but do not yield before destroying the owner. + reply({ + success: true, + payload: { descriptor: 'late' }, + device: { features: { model: 'LATE' } }, + }); + const destruction = value.destroy(); + expect(observer).toHaveBeenCalledWith({ type: 'disconnected' }); + await rejected; + expect(observer).not.toHaveBeenCalledWith({ type: 'model', model: 'LATE' }); + let destroyed = false; + void destruction.then(() => { + destroyed = true; + }); + await tick(); + expect(destroyed).toBe(false); + ledger.resolve(); + await destruction; +}); + +it('reattaches exactly one keyring status callback after each lock and reconnect', async () => { + const value = new Keyring(); + keyrings.push(value); + const internal = value as any; + const hardware: HardwareWalletManager = internal.hardwareWalletManager; + for (let cycle = 0; cycle < 3; cycle++) { + await expect(value.init()).resolves.toBe(true); + await expect(value.init()).resolves.toBe(true); + expect(hardware.listenerCount('connected')).toBe(1); + expect(hardware.listenerCount('disconnected')).toBe(1); + expect(internal.initialized).toBe(true); + const previousCalls = (ConnectMock.init as jest.Mock).mock.calls.length; + await adapter.default.dispose(); + expect(internal.initialized).toBe(false); + await value.getAccountInfo({ coin: 'sys', slip44: 57 }); + expect(ConnectMock.init).toHaveBeenCalledTimes(previousCalls + 1); + expect(hardware.listenerCount('connected')).toBe(1); + expect(hardware.listenerCount('disconnected')).toBe(1); + await value.destroy(); + expect(hardware.listenerCount('connected')).toBe(0); + expect(hardware.listenerCount('disconnected')).toBe(0); + } +}); + +it('does not start a keyring initialization after lock overtakes its startup delay', async () => { + jest.useFakeTimers({ doNotFake: ['setImmediate'] }); + const value = new Keyring(); + keyrings.push(value); + const initialization = value.init(); + await value.destroy(); + await jest.advanceTimersByTimeAsync(100); + await expect(initialization).resolves.toBe(false); + expect(ConnectMock.init).not.toHaveBeenCalled(); + expect((value as any).initialized).toBe(false); + const reconnect = value.init(); + await jest.advanceTimersByTimeAsync(100); + await expect(reconnect).resolves.toBe(true); +}); diff --git a/packages/sysweb3-keyring/test/unit/hardware/trezor-suite-connect.spec.ts b/packages/sysweb3-keyring/test/unit/hardware/trezor-suite-connect.spec.ts new file mode 100644 index 00000000..ddcf7f17 --- /dev/null +++ b/packages/sysweb3-keyring/test/unit/hardware/trezor-suite-connect.spec.ts @@ -0,0 +1,204 @@ +import { execFileSync } from 'child_process'; +import { join } from 'path'; + +// Run the installed ESM package in a fresh Node process without Jest's Connect +// mock. Browser I/O and the websocket factory are simulated; no device, network +// or physical Safe 7 compatibility claim is made by these protocol checks. +const runConnect = (scenario: Record = {}) => + JSON.parse( + execFileSync( + process.execPath, + [ + join(__dirname, '../../helpers/trezor-connect10-protocol.cjs'), + JSON.stringify(scenario), + ], + { encoding: 'utf8', timeout: 10000 } + ) + ); + +const manifest = { + appName: 'Pali Wallet', + appUrl: 'https://paliwallet.com/', + email: 'support@syscoin.org', +}; + +describe('Trezor Connect 10 installed package protocol', () => { + it('lazy-loads the real ESM client from the compiled CommonJS adapter', () => { + const result = runConnect({ adapter: true }); + expect(result.adapterMode).toBe(true); + expect(result.proxyListenersBeforeInit).toBe(0); + expect(result.proxyListeners).toBe(1); + expect(result.socketsAfterInit).toBe(1); + expect(result.response).toEqual({ + success: true, + payload: { model: 'T3W1' }, + device: { path: 'synthetic-device-path' }, + }); + expect(result.desktopMessages[1].payload.method).toBe('getFeatures'); + expect(result.popupUrls).toEqual([]); + }); + + it('preserves an actual Connect failure through the compiled CommonJS adapter', () => { + const error = { + code: 'Method_UnsupportedCoinForHost', + message: 'Coin is not supported by Trezor Suite', + }; + const result = runConnect({ adapter: true, error }); + expect(result.response).toEqual({ + success: false, + error, + payload: { error: error.message, code: error.code }, + }); + expect( + result.desktopMessages.filter( + (request: any) => request.type === 'iframe-call' + ) + ).toHaveLength(1); + }); + + it('connects to Suite desktop during initialization and retains device identity', () => { + const result = runConnect(); + expect(result.socketsAfterInit).toBe(1); + expect(result.sockets).toEqual(['ws://127.0.0.1:21335/connect-ws']); + expect(result.response).toEqual({ + success: true, + payload: { model: 'T3W1' }, + device: { path: 'synthetic-device-path' }, + }); + expect(result.permissionQueries).toEqual([ + { name: 'local-network-access' }, + ]); + expect(result.desktopMessages.map((message: any) => message.type)).toEqual([ + 'popup-handshake', + 'iframe-call', + ]); + expect(result.desktopMessages[0].payload.settings).toMatchObject({ + manifest, + version: '10.0.1', + }); + expect(result.desktopMessages[1].payload.method).toBe('getFeatures'); + expect(result.popupUrls).toEqual([]); + expect(result.exposesEventEmitter).toBe(false); + }); + + it('falls back to the fixed Suite Web external-message protocol without script injection', () => { + const result = runConnect({ desktopAvailable: false }); + expect(result.response.success).toBe(true); + expect(result.popupUrls).toEqual([ + 'https://suite.trezor.io/web/connect-popup#extension-id=test-extension-id', + ]); + expect(result.proxyListeners).toBe(1); + expect(result.popupMessages.map((message: any) => message.type)).toEqual([ + 'channel-handshake-request', + 'popup-handshake', + 'iframe-call', + ]); + expect(result.popupMessages[1].payload).toMatchObject({ + manifest, + version: '10.0.1', + }); + expect(result.popupMessages[2].channel).toEqual({ + here: '@trezor/connect-webextension-externally-connectable', + peer: '@trezor/suite-web', + }); + expect(result.popupMessages[2].payload.method).toBe('getFeatures'); + }); + + it('ignores a matching-response-id message from an untrusted popup origin', () => { + const result = runConnect({ + desktopAvailable: false, + injectWrongOrigin: true, + }); + expect(result.rejectedOrigins).toBe(1); + expect(result.response.payload.model).toBe('T3W1'); + }); + + it.each([ + ['Method_Cancel', 'Canceled'], + ['Method_Interrupted', 'Popup closed'], + ['Method_UnsupportedCoinForHost', 'Coin is not supported by Trezor Suite'], + ])( + 'retains a terminal %s error without converting it to a success', + (code, message) => { + const result = runConnect({ error: { code, message } }); + expect(result.response).toEqual({ + success: false, + error: { code, message }, + }); + expect(result.response.payload).toBeUndefined(); + expect( + result.desktopMessages.filter( + (request: any) => request.type === 'iframe-call' + ) + ).toHaveLength(1); + expect(result.popupUrls).toEqual([]); + } + ); + + it('disposes a pending Suite Desktop request without an unhandled cancellation promise', () => { + const result = runConnect({ adapter: true, disposePending: true }); + expect(result.rejectedBeforeRemoteReply).toBe(true); + expect(result.cancelledError).toMatchObject({ code: 'Method_Interrupted' }); + expect(result.unexpectedLateSuccess).toBeUndefined(); + expect( + result.desktopMessages.some( + (message: any) => message.type === 'core-call-cancel' + ) + ).toBe(false); + expect(result.notifications).not.toContainEqual( + expect.objectContaining({ type: 'model' }) + ); + expect(result.remoteReplyDelivered).toBe(true); + expect(result.reconnectedResponse).toMatchObject({ + success: true, + payload: { model: 'T3W1' }, + }); + expect(result.popupUrls).toEqual([]); + }); + + it('rejects a pending Suite Web request locally before any late approval arrives', () => { + const result = runConnect({ + adapter: true, + desktopAvailable: false, + disposePending: true, + }); + expect(result.rejectedBeforeRemoteReply).toBe(true); + expect(result.cancelledError).toMatchObject({ code: 'Method_Interrupted' }); + expect(result.unexpectedLateSuccess).toBeUndefined(); + expect(result.cancelMessages).toBe(0); + expect(result.notifications).toContainEqual({ type: 'disconnected' }); + expect(result.notifications).not.toContainEqual( + expect.objectContaining({ type: 'model' }) + ); + expect(result.remoteReplyDelivered).toBe(true); + expect(result.reconnectedResponse).toMatchObject({ + success: true, + payload: { model: 'T3W1' }, + }); + // Upstream Suite Web dispose is a no-op: local fencing is the guarantee. + expect(result.popupStillOpenAfterDispose).toBe(true); + }); + + it('destroys the full keyring before a held Suite Web approval returns', () => { + const result = runConnect({ + adapter: true, + keyring: true, + desktopAvailable: false, + disposePending: true, + }); + expect(result.keyringDestroyed).toBe(true); + expect(result.busyError).toMatchObject({ code: 'HARDWARE_SIGNER_BUSY' }); + expect(result.unexpectedBusySuccess).toBeUndefined(); + expect(result.rejectedBeforeRemoteReply).toBe(true); + expect(result.cancelledError).toMatchObject({ code: 'Method_Interrupted' }); + expect(result.unexpectedLateSuccess).toBeUndefined(); + expect(result.reconnectedResponse).toMatchObject({ success: true }); + }); + + it('rejects a missing appName before connecting to either host', () => { + const result = runConnect({ missingAppName: true }); + expect(result.initializationError.code).toBe('Init_ManifestMissing'); + expect(result.sockets).toEqual([]); + expect(result.popupUrls).toEqual([]); + }); +}); diff --git a/packages/sysweb3-keyring/test/unit/hardware/trezor-transaction-invariants.spec.ts b/packages/sysweb3-keyring/test/unit/hardware/trezor-transaction-invariants.spec.ts new file mode 100644 index 00000000..952076dc --- /dev/null +++ b/packages/sysweb3-keyring/test/unit/hardware/trezor-transaction-invariants.spec.ts @@ -0,0 +1,369 @@ +/* eslint-disable camelcase */ +import ecc from '@bitcoinerlab/secp256k1'; +import TrezorConnect from '@trezor/connect-webextension'; +import * as syscoinjs from 'syscoinjs-lib'; + +import { TrezorKeyring } from '../../../src/trezor'; + +const bitcoinjs: any = (syscoinjs.utils as any).bitcoinjs; +const privateKey = Buffer.alloc(32, 1); +const publicKey = Buffer.from(ecc.pointFromScalar(privateKey)!); +const signer = { + publicKey, + sign: (hash: Buffer) => Buffer.from(ecc.sign(hash, privateKey)), +}; +const network = bitcoinjs.networks.testnet; +const payment = bitcoinjs.payments.p2wpkh({ pubkey: publicKey, network }); + +const fixture = (locktime = 12345, sequence = 0) => { + const psbt = new bitcoinjs.Psbt({ network }); + psbt.setVersion(2); + psbt.setLocktime(locktime); + psbt.addInput({ + hash: Buffer.alloc(32, 2), + index: 1, + sequence, + witnessUtxo: { script: payment.output, value: 100000n }, + bip32Derivation: [ + { + masterFingerprint: Buffer.alloc(4), + path: "m/84'/1'/0'/0/0", + pubkey: publicKey, + }, + ], + }); + psbt.addOutput({ address: payment.address, value: 99000n }); + return psbt; +}; +const signedTransaction = (psbt: any) => { + const signed = psbt.clone(); + signed.signInput(0, signer); + signed.finalizeAllInputs(); + return signed.extractTransaction().toHex(); +}; +const finalizedExternalFixture = ( + type: 'witness' | 'legacy', + includeNonWitness = true +) => { + const externalPrivateKey = Buffer.alloc(32, 3); + const externalPublicKey = Buffer.from( + ecc.pointFromScalar(externalPrivateKey)! + ); + const externalPayment = + type === 'witness' + ? bitcoinjs.payments.p2wpkh({ pubkey: externalPublicKey, network }) + : bitcoinjs.payments.p2pkh({ pubkey: externalPublicKey, network }); + const previous = new bitcoinjs.Transaction(); + previous.addInput(Buffer.alloc(32, 5), 0xffffffff); + previous.addOutput(externalPayment.output, 100000n); + const psbt = fixture(); + psbt.addInput({ + hash: previous.getId(), + index: 0, + sequence: 0xfffffffd, + ...(includeNonWitness ? { nonWitnessUtxo: previous.toBuffer() } : {}), + ...(type === 'witness' + ? { witnessUtxo: { script: externalPayment.output, value: 100000n } } + : {}), + }); + psbt.addOutput({ address: payment.address, value: 99000n }); + psbt.signInput(1, { + publicKey: externalPublicKey, + sign: (hash: Buffer) => Buffer.from(ecc.sign(hash, externalPrivateKey)), + }); + psbt.finalizeInput(1); + // Even stale metadata must never turn a finalized input into a new signing + // request for a different account on the connected device. + psbt.data.inputs[1].bip32Derivation = [ + { + masterFingerprint: Buffer.alloc(4, 9), + path: "m/84'/1'/9'/0/0", + pubkey: externalPublicKey, + }, + ]; + return { psbt, externalPayment }; +}; +const signedJointTransaction = (psbt: any) => { + const signed = psbt.clone(); + signed.signInput(0, signer); + signed.finalizeInput(0); + return signed.extractTransaction().toHex(); +}; + +describe('Trezor unsigned transaction integrity', () => { + let receiver: TrezorKeyring; + + beforeEach(() => { + receiver = Object.create(TrezorKeyring.prototype); + (receiver as any).executeWithRetry = jest.fn((operation) => operation()); + jest.spyOn(console, 'log').mockImplementation(() => undefined); + }); + afterEach(() => jest.restoreAllMocks()); + + it.each([ + [0, 0xffffffff], + [0, 0xfffffffd], + [0, 0], + [12345, 0xfffffffd], + [12345, 0], + ])( + 'preserves exact locktime %i and sequence %i in the device request', + (locktime, sequence) => { + const psbt = fixture(locktime, sequence); + const before = psbt.toBase64(); + const request = receiver.convertToTrezorFormat({ + psbt, + coin: 'testnet', + network, + }); + expect(request.version).toBe(2); + expect(request.locktime).toBe(locktime); + expect(request.inputs[0].sequence).toBe(sequence); + expect(psbt.toBase64()).toBe(before); + } + ); + + it('accepts a real SegWit signature for the exact approved transaction', async () => { + const psbt = fixture(); + const serializedTx = signedTransaction(psbt); + jest + .spyOn(TrezorConnect, 'signTransaction') + .mockResolvedValue({ success: true, payload: { serializedTx } } as any); + const signed = await receiver.signUtxoTransaction({}, psbt); + expect(signed.extractTransaction().toHex()).toBe(serializedTx); + }); + + it.each([ + 'version', + 'locktime', + 'sequence', + 'outpoint', + 'inputIndex', + 'amount', + 'script', + 'inputCount', + 'outputCount', + ])( + 'rejects a changed %s before importing any device signature', + async (field) => { + const psbt = fixture(); + const tx = bitcoinjs.Transaction.fromHex(signedTransaction(psbt)); + if (field === 'version') tx.version = 1; + if (field === 'locktime') tx.locktime = 0; + if (field === 'sequence') tx.ins[0].sequence = 0xffffffff; + if (field === 'outpoint') tx.ins[0].hash = Buffer.alloc(32, 9); + if (field === 'inputIndex') tx.ins[0].index = 2; + if (field === 'amount') tx.outs[0].value = 98000n; + if (field === 'script') tx.outs[0].script = Buffer.from([0x51]); + if (field === 'inputCount') tx.addInput(Buffer.alloc(32, 3), 0); + if (field === 'outputCount') tx.addOutput(Buffer.from([0x51]), 0n); + jest.spyOn(TrezorConnect, 'signTransaction').mockResolvedValue({ + success: true, + payload: { serializedTx: tx.toHex() }, + } as any); + const update = jest.spyOn(psbt, 'updateInput'); + await expect(receiver.signUtxoTransaction({}, psbt)).rejects.toThrow( + 'different unsigned transaction' + ); + expect(update).not.toHaveBeenCalled(); + expect(TrezorConnect.signTransaction).toHaveBeenCalledTimes(1); + } + ); + + it('rejects even a valid signature over the device-default locktime and sequence', async () => { + const approved = fixture(12345, 0); + const deviceDefault = fixture(0, 0xffffffff); + const serializedTx = signedTransaction(deviceDefault); + jest + .spyOn(TrezorConnect, 'signTransaction') + .mockResolvedValue({ success: true, payload: { serializedTx } } as any); + const update = jest.spyOn(approved, 'updateInput'); + await expect(receiver.signUtxoTransaction({}, approved)).rejects.toThrow( + 'different unsigned transaction' + ); + expect(update).not.toHaveBeenCalled(); + }); + + it.each(['inputs', 'outputs'])('rejects reordered %s', async (field) => { + const psbt = fixture(); + psbt.addInput({ + hash: Buffer.alloc(32, 3), + index: 0, + sequence: 0, + witnessUtxo: { script: payment.output, value: 100000n }, + }); + psbt.addOutput({ script: Buffer.from([0x51]), value: 99000n }); + const signed = psbt.clone(); + signed.signAllInputs(signer); + signed.finalizeAllInputs(); + const tx = signed.extractTransaction(); + if (field === 'inputs') tx.ins.reverse(); + else tx.outs.reverse(); + jest.spyOn(TrezorConnect, 'signTransaction').mockResolvedValue({ + success: true, + payload: { serializedTx: tx.toHex() }, + } as any); + const update = jest.spyOn(psbt, 'updateInput'); + await expect(receiver.signUtxoTransaction({}, psbt)).rejects.toThrow( + 'different unsigned transaction' + ); + expect(update).not.toHaveBeenCalled(); + }); + + it('rejects a PSBT mutated while device approval was pending', async () => { + const psbt = fixture(); + const serializedTx = signedTransaction(psbt); + jest + .spyOn(TrezorConnect, 'signTransaction') + .mockImplementation(async () => { + psbt.setLocktime(999); + return { success: true, payload: { serializedTx } } as any; + }); + const update = jest.spyOn(psbt, 'updateInput'); + await expect(receiver.signUtxoTransaction({}, psbt)).rejects.toThrow( + 'different unsigned transaction' + ); + expect(update).not.toHaveBeenCalled(); + }); + + it.each(['witness', 'legacy'] as const)( + 'maps an already-finalized %s co-signer input to EXTERNAL without a device path', + (type) => { + const { psbt, externalPayment } = finalizedExternalFixture(type); + const before = psbt.toBase64(); + const request = receiver.convertToTrezorFormat({ + psbt, + coin: 'testnet', + network, + }); + expect(request.inputs[0].address_n).toBeDefined(); + expect(request.inputs[1]).toMatchObject({ + prev_hash: Buffer.from(psbt.txInputs[1].hash).reverse().toString('hex'), + prev_index: 0, + sequence: 0xfffffffd, + script_type: 'EXTERNAL', + amount: '100000', + script_pubkey: Buffer.from(externalPayment.output).toString('hex'), + }); + expect(request.inputs[1]).not.toHaveProperty('address_n'); + if (type === 'witness') + expect(request.inputs[1].witness).toBe( + Buffer.from(psbt.data.inputs[1].finalScriptWitness).toString('hex') + ); + else + expect(request.inputs[1].script_sig).toBe( + Buffer.from(psbt.data.inputs[1].finalScriptSig).toString('hex') + ); + expect(psbt.toBase64()).toBe(before); + } + ); + + it('accepts a finalized witness input with its witness prevout only', () => { + const { psbt } = finalizedExternalFixture('witness', false); + const request = receiver.convertToTrezorFormat({ + psbt, + coin: 'testnet', + network, + }); + expect(request.inputs[1].script_type).toBe('EXTERNAL'); + expect(request.inputs[1].amount).toBe('100000'); + expect(request.inputs[1]).not.toHaveProperty('address_n'); + }); + + it.each(['missing', 'contradictory'])( + 'rejects a finalized external input with a %s prevout', + (kind) => { + const { psbt } = finalizedExternalFixture('witness', kind !== 'missing'); + if (kind === 'missing') { + delete psbt.data.inputs[1].witnessUtxo; + } else psbt.data.inputs[1].witnessUtxo.value += 1n; + expect(() => + receiver.convertToTrezorFormat({ psbt, coin: 'testnet', network }) + ).toThrow(/external input/); + } + ); + + it.each(['witness', 'legacy'] as const)( + 'preserves a finalized %s input while importing only the approved device signature', + async (type) => { + const { psbt } = finalizedExternalFixture(type); + const originalScript = psbt.data.inputs[1].finalScriptSig; + const originalWitness = psbt.data.inputs[1].finalScriptWitness; + const serializedTx = signedJointTransaction(psbt); + jest + .spyOn(TrezorConnect, 'signTransaction') + .mockResolvedValue({ success: true, payload: { serializedTx } } as any); + const update = jest.spyOn(psbt, 'updateInput'); + const signed = await receiver.signUtxoTransaction({}, psbt); + expect(update.mock.calls.map(([index]) => index)).toEqual([0]); + expect(signed.data.inputs[1].finalScriptSig).toEqual(originalScript); + expect(signed.data.inputs[1].finalScriptWitness).toEqual(originalWitness); + expect(signed.extractTransaction().toHex()).toBe(serializedTx); + } + ); + + it.each(['witness', 'legacy'] as const)( + 'rejects a changed finalized %s input before importing any signature', + async (type) => { + const { psbt } = finalizedExternalFixture(type); + const tx = bitcoinjs.Transaction.fromHex(signedJointTransaction(psbt)); + if (type === 'witness') tx.ins[1].witness[0][0] ^= 1; + else tx.ins[1].script[0] ^= 1; + jest.spyOn(TrezorConnect, 'signTransaction').mockResolvedValue({ + success: true, + payload: { serializedTx: tx.toHex() }, + } as any); + const update = jest.spyOn(psbt, 'updateInput'); + await expect(receiver.signUtxoTransaction({}, psbt)).rejects.toThrow( + 'changed an already-finalized input' + ); + expect(update).not.toHaveBeenCalled(); + } + ); + + it('rejects finalized input data mutated while the device was signing', async () => { + const { psbt } = finalizedExternalFixture('witness'); + const serializedTx = signedJointTransaction(psbt); + jest + .spyOn(TrezorConnect, 'signTransaction') + .mockImplementation(async () => { + psbt.data.inputs[1].finalScriptWitness = Buffer.from([0]); + return { success: true, payload: { serializedTx } } as any; + }); + const update = jest.spyOn(psbt, 'updateInput'); + await expect(receiver.signUtxoTransaction({}, psbt)).rejects.toThrow( + 'changed an already-finalized input' + ); + expect(update).not.toHaveBeenCalled(); + }); + + it.each(['', 'deadbeef', '00'])( + 'rejects malformed returned transaction %p before changing the PSBT', + async (serializedTx) => { + const psbt = fixture(); + jest + .spyOn(TrezorConnect, 'signTransaction') + .mockResolvedValue({ success: true, payload: { serializedTx } } as any); + const update = jest.spyOn(psbt, 'updateInput'); + await expect(receiver.signUtxoTransaction({}, psbt)).rejects.toThrow(); + expect(update).not.toHaveBeenCalled(); + } + ); + + it.each(['00', 'fd0000', '0101', 'fd010000'])( + 'rejects malformed or noncanonical finalized witness %s', + async (hex) => { + const { psbt } = finalizedExternalFixture('witness'); + const serializedTx = signedJointTransaction(psbt); + psbt.data.inputs[1].finalScriptWitness = Buffer.from(hex, 'hex'); + jest + .spyOn(TrezorConnect, 'signTransaction') + .mockResolvedValue({ success: true, payload: { serializedTx } } as any); + const update = jest.spyOn(psbt, 'updateInput'); + await expect(receiver.signUtxoTransaction({}, psbt)).rejects.toThrow( + 'changed an already-finalized input' + ); + expect(update).not.toHaveBeenCalled(); + } + ); +}); diff --git a/packages/sysweb3-keyring/test/unit/hardware/trezor-witness.spec.ts b/packages/sysweb3-keyring/test/unit/hardware/trezor-witness.spec.ts new file mode 100644 index 00000000..de6f9db4 --- /dev/null +++ b/packages/sysweb3-keyring/test/unit/hardware/trezor-witness.spec.ts @@ -0,0 +1,49 @@ +import { serializeWitness } from '../../../src/trezor/witness'; + +const compactSizes = [ + [0, '00'], + [1, '01'], + [252, 'fc'], + [253, 'fdfd00'], + [65535, 'fdffff'], + [65536, 'fe00000100'], +] as const; + +it.each(compactSizes)( + 'encodes a witness item of %i bytes with canonical CompactSize', + (length, prefix) => { + const value = Buffer.alloc(length, 0x5a); + const expected = Buffer.concat([Buffer.from('01' + prefix, 'hex'), value]); + expect(serializeWitness([value])).toEqual(expected); + } +); + +it.each(compactSizes)( + 'encodes a witness vector of %i empty items with canonical CompactSize', + (length, prefix) => { + expect( + serializeWitness(Array.from({ length }, () => new Uint8Array())) + ).toEqual( + Buffer.concat([Buffer.from(prefix, 'hex'), Buffer.alloc(length)]) + ); + } +); + +it('preserves empty items, byte order and byte ownership', () => { + const item = Uint8Array.from([0, 1, 2]); + const encoded = serializeWitness([ + new Uint8Array(), + Buffer.from([0xab]), + item, + ]); + expect(encoded.toString('hex')).toBe('030001ab03000102'); + item[0] = 0xff; + expect(encoded.toString('hex')).toBe('030001ab03000102'); +}); + +it.each([null, undefined, {}])( + 'rejects a malformed witness item %p', + (value) => { + expect(() => serializeWitness([value as any])).toThrow(/first argument/); + } +); diff --git a/packages/sysweb3-keyring/test/unit/hardware/trezor.spec.ts b/packages/sysweb3-keyring/test/unit/hardware/trezor.spec.ts index 126d2ddd..e8d0f959 100644 --- a/packages/sysweb3-keyring/test/unit/hardware/trezor.spec.ts +++ b/packages/sysweb3-keyring/test/unit/hardware/trezor.spec.ts @@ -1,10 +1,12 @@ +import { INetworkType } from '@sidhujag/sysweb3-network'; + import { KeyringManager, KeyringAccountType } from '../../../src'; import { FAKE_PASSWORD, PEACE_SEED_PHRASE } from '../../helpers/constants'; -import { setupMocks } from '../../helpers/setup'; -import { INetworkType } from '@pollum-io/sysweb3-network'; +import { createFreshTestKeyring, setupMocks } from '../../helpers/setup'; describe('Trezor Hardware Wallet', () => { let keyringManager: KeyringManager; + const additionalKeyrings: KeyringManager[] = []; let mockVaultStateGetter: jest.Mock; let currentVaultState: any; let accountCounter = 0; @@ -26,7 +28,7 @@ describe('Trezor Hardware Wallet', () => { }); mockVaultStateGetter = jest.fn(() => currentVaultState); - keyringManager = await KeyringManager.createInitialized( + keyringManager = await createFreshTestKeyring( PEACE_SEED_PHRASE, FAKE_PASSWORD, mockVaultStateGetter @@ -54,6 +56,7 @@ describe('Trezor Hardware Wallet', () => { }); afterEach(async () => { + for (const keyring of additionalKeyrings.splice(0)) await keyring.destroy(); // Clean up hardware wallet connections if (keyringManager) { await keyringManager.destroy(); @@ -159,11 +162,12 @@ describe('Trezor Hardware Wallet', () => { const evmVaultStateGetter = jest.fn(() => evmVaultState); // Create EVM keyring - const evmKeyring = await KeyringManager.createInitialized( + const evmKeyring = await createFreshTestKeyring( PEACE_SEED_PHRASE, FAKE_PASSWORD, evmVaultStateGetter ); + additionalKeyrings.push(evmKeyring); // Mock Trezor EVM methods with proper EVM address evmKeyring.trezorSigner.getPublicKey = jest.fn().mockResolvedValue({ @@ -393,7 +397,6 @@ describe('Trezor Hardware Wallet', () => { psbt: psbtData, isTrezor: true, isLedger: false, - pathIn: undefined, }); expect(result).toBeDefined(); @@ -449,11 +452,12 @@ describe('Trezor Hardware Wallet', () => { const evmVaultStateGetter = jest.fn(() => evmVaultState); // Create EVM keyring with Trezor - const evmKeyring = await KeyringManager.createInitialized( + const evmKeyring = await createFreshTestKeyring( PEACE_SEED_PHRASE, FAKE_PASSWORD, evmVaultStateGetter ); + additionalKeyrings.push(evmKeyring); // Mock Trezor EVM methods evmKeyring.trezorSigner.getAccountInfo = jest.fn().mockResolvedValue({ @@ -513,11 +517,12 @@ describe('Trezor Hardware Wallet', () => { const testnetVaultStateGetter = jest.fn(() => testnetVaultState); // Test on testnet - const testnetKeyring = await KeyringManager.createInitialized( + const testnetKeyring = await createFreshTestKeyring( PEACE_SEED_PHRASE, FAKE_PASSWORD, testnetVaultStateGetter ); + additionalKeyrings.push(testnetKeyring); const account = await testnetKeyring.importTrezorAccount( 'Testnet Trezor' @@ -541,11 +546,12 @@ describe('Trezor Hardware Wallet', () => { const testnetVaultStateGetter = jest.fn(() => testnetVaultState); // Create testnet keyring - const testnetKeyring = await KeyringManager.createInitialized( + const testnetKeyring = await createFreshTestKeyring( PEACE_SEED_PHRASE, FAKE_PASSWORD, testnetVaultStateGetter ); + additionalKeyrings.push(testnetKeyring); // Import on testnet const testnetAccount = await testnetKeyring.importTrezorAccount( @@ -624,7 +630,6 @@ describe('Trezor Hardware Wallet', () => { psbt: psbtData, isTrezor: true, isLedger: false, - pathIn: undefined, }) ).rejects.toThrow(); }); @@ -743,14 +748,10 @@ describe('Trezor Hardware Wallet', () => { }); it('should verify UTXO address on Trezor device', async () => { - // Mock TrezorConnect.getAddress to simulate device verification - const TrezorConnect = require('@trezor/connect-webextension').default; - TrezorConnect.getAddress = jest.fn().mockResolvedValue({ - success: true, - payload: { - address: 'sys1qmock_trezor_verified_address', - }, - }); + // Mock trezorSigner.verifyAddress to simulate device verification + keyringManager.trezorSigner.verifyUtxoAddress = jest + .fn() + .mockResolvedValue('sys1qmock_trezor_verified_address'); const account = await keyringManager.importTrezorAccount('Verify Test'); @@ -779,12 +780,10 @@ describe('Trezor Hardware Wallet', () => { expect(verifiedAddress).toBe('sys1qmock_trezor_verified_address'); - // Verify that showOnTrezor was set to true - expect(TrezorConnect.getAddress).toHaveBeenCalledWith( - expect.objectContaining({ - showOnTrezor: true, - }) - ); + // Verify that the mock was called + expect( + keyringManager.trezorSigner.verifyUtxoAddress + ).toHaveBeenCalledWith(account.id, 'sys', 57); } }); diff --git a/packages/sysweb3-keyring/test/unit/keyring-manager/account-management.spec.ts b/packages/sysweb3-keyring/test/unit/keyring-manager/account-management.spec.ts index 7fab5108..8cb7b4a8 100644 --- a/packages/sysweb3-keyring/test/unit/keyring-manager/account-management.spec.ts +++ b/packages/sysweb3-keyring/test/unit/keyring-manager/account-management.spec.ts @@ -1,7 +1,8 @@ +import { INetworkType } from '@sidhujag/sysweb3-network'; + import { KeyringManager, KeyringAccountType } from '../../../src'; import { FAKE_PASSWORD, PEACE_SEED_PHRASE } from '../../helpers/constants'; -import { setupMocks } from '../../helpers/setup'; -import { INetworkType } from '@pollum-io/sysweb3-network'; +import { createFreshTestKeyring, setupMocks } from '../../helpers/setup'; describe('KeyringManager - Account Management', () => { let keyringManager: KeyringManager; @@ -26,7 +27,7 @@ describe('KeyringManager - Account Management', () => { mockVaultStateGetter = jest.fn(() => currentVaultState); // Create keyring manager with vault getter - keyringManager = await KeyringManager.createInitialized( + keyringManager = await createFreshTestKeyring( PEACE_SEED_PHRASE, FAKE_PASSWORD, mockVaultStateGetter @@ -187,7 +188,7 @@ describe('KeyringManager - Account Management', () => { }); const mainnetVaultStateGetter = jest.fn(() => mainnetVaultState); - const mainnetKeyring = await KeyringManager.createInitialized( + const mainnetKeyring = await createFreshTestKeyring( PEACE_SEED_PHRASE, FAKE_PASSWORD, mainnetVaultStateGetter @@ -224,7 +225,7 @@ describe('KeyringManager - Account Management', () => { const testnetVaultStateGetter = jest.fn(() => testnetVaultState); - const testnetKeyring = await KeyringManager.createInitialized( + const testnetKeyring = await createFreshTestKeyring( PEACE_SEED_PHRASE, FAKE_PASSWORD, testnetVaultStateGetter @@ -278,7 +279,7 @@ describe('KeyringManager - Account Management', () => { const vaultStateGetter = jest.fn(() => testnetVaultState); - const keyringManager = await KeyringManager.createInitialized( + const keyringManager = await createFreshTestKeyring( PEACE_SEED_PHRASE, FAKE_PASSWORD, vaultStateGetter @@ -480,7 +481,7 @@ describe('KeyringManager - Account Management', () => { expect(imported.isImported).toBe(true); expect(imported.address.startsWith('sys1')).toBe(true); expect(imported.id).toBe(0); - expect(imported.label).toBe('Syscoin Mainnet Imported 1'); + expect(imported.label).toBe('Imported 1'); }); it('should validate zprv before import', async () => { @@ -855,7 +856,7 @@ describe('KeyringManager - Account Management', () => { const nevmTestnetVaultGetter = jest.fn(() => nevmTestnetVaultState); // Create keyring on NEVM Testnet - const nevmKeyring = await KeyringManager.createInitialized( + const nevmKeyring = await createFreshTestKeyring( PEACE_SEED_PHRASE, FAKE_PASSWORD, nevmTestnetVaultGetter @@ -931,7 +932,7 @@ describe('KeyringManager - Account Management', () => { const sysTestnetVaultGetter = jest.fn(() => sysTestnetVaultState); // Create keyring - this should call createFirstAccount internally - const sysKeyring = await KeyringManager.createInitialized( + const sysKeyring = await createFreshTestKeyring( PEACE_SEED_PHRASE, FAKE_PASSWORD, sysTestnetVaultGetter diff --git a/packages/sysweb3-keyring/test/unit/keyring-manager/import-watchonly.spec.ts b/packages/sysweb3-keyring/test/unit/keyring-manager/import-watchonly.spec.ts new file mode 100644 index 00000000..aa7ec267 --- /dev/null +++ b/packages/sysweb3-keyring/test/unit/keyring-manager/import-watchonly.spec.ts @@ -0,0 +1,197 @@ +import { INetworkType } from '@sidhujag/sysweb3-network'; +import bs58check from 'bs58check'; + +import { KeyringManager, KeyringAccountType } from '../../../src'; +import { FAKE_PASSWORD, PEACE_SEED_PHRASE } from '../../helpers/constants'; +import { createFreshTestKeyring, setupMocks } from '../../helpers/setup'; + +const XPUB = + 'xpub6BgBgsespWvERF3LHQu6CnqdvfEvtMcQjYrcRzx53QJjSxarj2afYWcLteoGVky7D3UKDP9QyrLprQ3VCECoY49yfdDEHGCtMMj92pReUsQ'; +const publicPayload = Buffer.from(bs58check.decode(XPUB)); +publicPayload.writeUInt32BE(0x04b24746, 0); +const ZPUB = bs58check.encode(publicPayload); + +describe('Watch-only Import - KeyringManager', () => { + let keyringManager: KeyringManager; + let mockVaultStateGetter: jest.Mock; + let currentVaultState: any; + + beforeEach(async () => { + setupMocks(); + await setupTestVault(FAKE_PASSWORD); + }); + + afterEach(async () => { + await keyringManager?.destroy(); + }); + + describe('Single-address watch-only (address)', () => { + beforeEach(async () => { + currentVaultState = createMockVaultState({ + activeAccountId: 0, + activeAccountType: KeyringAccountType.HDAccount, + networkType: INetworkType.Syscoin, + chainId: 5700, + }); + mockVaultStateGetter = jest.fn(() => currentVaultState); + + keyringManager = await createFreshTestKeyring( + PEACE_SEED_PHRASE, + FAKE_PASSWORD, + mockVaultStateGetter + ); + }); + + it('imports address as watch-only single-address and blocks derivation', async () => { + const addr = 'tsys1qalwlmdxd2ggue4290ekzxl9tetg56neeepgwhk'; + const imported = await (keyringManager as any).importWatchOnly( + addr, + 'Watch-only' + ); + expect(imported.isImported).toBe(true); + // xpub === address marks single-address imported + expect(imported.xpub).toBe(addr); + expect(imported.xprv).toBe(''); + + // Insert into mock vault and activate + currentVaultState.accounts[KeyringAccountType.Imported][imported.id] = { + id: imported.id, + label: imported.label, + address: imported.address, + xpub: imported.xpub, + xprv: imported.xprv, + isImported: true, + isTrezorWallet: false, + isLedgerWallet: false, + balances: { syscoin: 0, ethereum: 0 }, + assets: { syscoin: [], ethereum: [] }, + }; + currentVaultState.activeAccount = { + id: imported.id, + type: KeyringAccountType.Imported, + }; + + // Guards + const changeAddr = await keyringManager.getChangeAddress(imported.id); + expect(changeAddr).toBe(imported.address); + await expect( + keyringManager.getPubkey(imported.id, false) + ).rejects.toThrow(/watch-only|Public key|not available/i); + await expect( + keyringManager.getBip32Path(imported.id, false) + ).rejects.toThrow(/watch-only|BIP32|not available/i); + }); + }); + + describe('XPUB/Descriptor watch-only', () => { + beforeEach(async () => { + currentVaultState = createMockVaultState({ + activeAccountId: 0, + activeAccountType: KeyringAccountType.HDAccount, + networkType: INetworkType.Syscoin, + chainId: 57, + }); + mockVaultStateGetter = jest.fn(() => currentVaultState); + + keyringManager = await createFreshTestKeyring( + PEACE_SEED_PHRASE, + FAKE_PASSWORD, + mockVaultStateGetter + ); + }); + + it('imports xpub-like as watch-only and blocks derivation', async () => { + const xpub = ZPUB; + const imported = await (keyringManager as any).importWatchOnly( + xpub, + 'Watch-only XPUB' + ); + expect(imported.xprv).toBe(''); + expect(imported.xpub).toBe(xpub); + expect(imported.address).toBe( + 'sys1qalwlmdxd2ggue4290ekzxl9tetg56neewnt8yu' + ); + + currentVaultState.accounts[KeyringAccountType.Imported][imported.id] = { + id: imported.id, + label: imported.label, + address: imported.address, + xpub: imported.xpub, + xprv: imported.xprv, + isImported: true, + isTrezorWallet: false, + isLedgerWallet: false, + balances: { syscoin: 0, ethereum: 0 }, + assets: { syscoin: [], ethereum: [] }, + }; + currentVaultState.activeAccount = { + id: imported.id, + type: KeyringAccountType.Imported, + }; + + await expect( + keyringManager.getPubkey(imported.id, false) + ).rejects.toThrow(/watch-only|Public key|not available/i); + await expect( + keyringManager.getBip32Path(imported.id, false) + ).rejects.toThrow(/watch-only|BIP32|not available/i); + }); + + it('imports descriptor as watch-only and blocks derivation', async () => { + const desc = `wpkh(${XPUB}/0/*)`; + const imported = await (keyringManager as any).importWatchOnly( + desc, + 'Watch-only DESC' + ); + expect(imported.xprv).toBe(''); + expect(imported.xpub).toBe(desc); + expect(imported.address).toBe( + 'sys1qalwlmdxd2ggue4290ekzxl9tetg56neewnt8yu' + ); + + currentVaultState.accounts[KeyringAccountType.Imported][imported.id] = { + id: imported.id, + label: imported.label, + address: imported.address, + xpub: imported.xpub, + xprv: imported.xprv, + isImported: true, + isTrezorWallet: false, + isLedgerWallet: false, + balances: { syscoin: 0, ethereum: 0 }, + assets: { syscoin: [], ethereum: [] }, + }; + currentVaultState.activeAccount = { + id: imported.id, + type: KeyringAccountType.Imported, + }; + + await expect( + keyringManager.getPubkey(imported.id, false) + ).rejects.toThrow(/watch-only|Public key|not available/i); + await expect( + keyringManager.getBip32Path(imported.id, false) + ).rejects.toThrow(/watch-only|BIP32|not available/i); + }); + + it('rejects duplicate watch-only import by address', async () => { + const addr = 'sys1qalwlmdxd2ggue4290ekzxl9tetg56neewnt8yu'; + const first = await (keyringManager as any).importWatchOnly(addr, 'WO1'); + currentVaultState.accounts[KeyringAccountType.Imported][first.id] = { + id: first.id, + label: first.label, + address: first.address, + xpub: first.xpub, + xprv: first.xprv, + isImported: true, + isTrezorWallet: false, + isLedgerWallet: false, + balances: { syscoin: 0, ethereum: 0 }, + assets: { syscoin: [], ethereum: [] }, + }; + await expect( + (keyringManager as any).importWatchOnly(addr, 'WO2') + ).rejects.toThrow(/already exists/i); + }); + }); +}); diff --git a/packages/sysweb3-keyring/test/unit/keyring-manager/import-wif.spec.ts b/packages/sysweb3-keyring/test/unit/keyring-manager/import-wif.spec.ts new file mode 100644 index 00000000..dcb5dc43 --- /dev/null +++ b/packages/sysweb3-keyring/test/unit/keyring-manager/import-wif.spec.ts @@ -0,0 +1,132 @@ +import { INetworkType } from '@sidhujag/sysweb3-network'; +import * as syscoinjs from 'syscoinjs-lib'; +import * as wif from 'wif'; + +import { KeyringManager, KeyringAccountType } from '../../../src'; +import { FAKE_PASSWORD, PEACE_SEED_PHRASE } from '../../helpers/constants'; +import { createFreshTestKeyring, setupMocks } from '../../helpers/setup'; + +// Helper to generate deterministic WIFs from a fixed private key for given network +const generateWif = (network: any): string => { + const priv = Buffer.from( + '0101010101010101010101010101010101010101010101010101010101010101', + 'hex' + ); + const version = network.wif; // 0x80 mainnet, 0xef testnet + return wif.encode({ version, privateKey: priv, compressed: true }); +}; + +describe('WIF Import - KeyringManager', () => { + let keyringManager: KeyringManager; + let mockVaultStateGetter: jest.Mock; + let currentVaultState: any; + + beforeEach(async () => { + setupMocks(); + await setupTestVault(FAKE_PASSWORD); + }); + + describe('Syscoin mainnet', () => { + let MAINNET_WIF: string; + + beforeEach(async () => { + currentVaultState = createMockVaultState({ + activeAccountId: 0, + activeAccountType: KeyringAccountType.HDAccount, + networkType: INetworkType.Syscoin, + chainId: 57, + }); + mockVaultStateGetter = jest.fn(() => currentVaultState); + + keyringManager = await createFreshTestKeyring( + PEACE_SEED_PHRASE, + FAKE_PASSWORD, + mockVaultStateGetter + ); + + MAINNET_WIF = generateWif( + (syscoinjs.utils as any).bitcoinjs.networks.bitcoin + ); + }); + + it('validates and imports a mainnet WIF as single-address account', async () => { + const validation = (keyringManager as any).validateWif(MAINNET_WIF); + expect(validation.isValid).toBe(true); + + const imported = await keyringManager.importAccount( + MAINNET_WIF, + 'WIF Import' + ); + expect(imported.isImported).toBe(true); + expect(imported.label).toBe('WIF Import'); + // xpub should equal address to mark single-address mode + expect(imported.xpub).toBe(imported.address); + + // Update mock vault with imported account + currentVaultState.accounts[KeyringAccountType.Imported][imported.id] = { + id: imported.id, + label: imported.label, + address: imported.address, + xpub: imported.xpub, + xprv: imported.xprv, + isImported: true, + isTrezorWallet: false, + isLedgerWallet: false, + balances: { syscoin: 0, ethereum: 0 }, + assets: { syscoin: [], ethereum: [] }, + }; + // Switch active account to the imported one for getter calls + currentVaultState.activeAccount = { + id: imported.id, + type: KeyringAccountType.Imported, + }; + + // Single-address getters behavior + const changeAddr = await keyringManager.getChangeAddress(imported.id); + expect(changeAddr).toBe(imported.address); + await expect( + keyringManager.getPubkey(imported.id, false) + ).rejects.toThrow(/not available|Public key/); + await expect( + keyringManager.getBip32Path(imported.id, false) + ).rejects.toThrow(/not available|BIP32/); + }); + }); + + describe('Syscoin testnet mismatch', () => { + let TESTNET_WIF: string; + + beforeEach(async () => { + currentVaultState = createMockVaultState({ + activeAccountId: 0, + activeAccountType: KeyringAccountType.HDAccount, + networkType: INetworkType.Syscoin, + chainId: 5700, + }); + mockVaultStateGetter = jest.fn(() => currentVaultState); + + keyringManager = await createFreshTestKeyring( + PEACE_SEED_PHRASE, + FAKE_PASSWORD, + mockVaultStateGetter + ); + + TESTNET_WIF = generateWif( + (syscoinjs.utils as any).bitcoinjs.networks.testnet + ); + }); + + it('rejects mainnet WIF on testnet (validateWif false)', async () => { + const mainnetWif = generateWif( + (syscoinjs.utils as any).bitcoinjs.networks.bitcoin + ); + const validation = (keyringManager as any).validateWif(mainnetWif); + expect(validation.isValid).toBe(false); + }); + + it('accepts testnet WIF on testnet', async () => { + const validation = (keyringManager as any).validateWif(TESTNET_WIF); + expect(validation.isValid).toBe(true); + }); + }); +}); diff --git a/packages/sysweb3-keyring/test/unit/keyring-manager/initialization.spec.ts b/packages/sysweb3-keyring/test/unit/keyring-manager/initialization.spec.ts index cda0db7a..ae19f0a9 100644 --- a/packages/sysweb3-keyring/test/unit/keyring-manager/initialization.spec.ts +++ b/packages/sysweb3-keyring/test/unit/keyring-manager/initialization.spec.ts @@ -1,3 +1,5 @@ +import { INetworkType } from '@sidhujag/sysweb3-network'; + import { KeyringManager, KeyringAccountType } from '../../../src'; import { FAKE_PASSWORD, @@ -5,17 +7,14 @@ import { SECOND_FAKE_SEED_PHRASE, } from '../../helpers/constants'; import { setupMocks } from '../../helpers/setup'; -import { INetworkType } from '@pollum-io/sysweb3-network'; describe('KeyringManager Initialization', () => { let keyringManager: KeyringManager; let mockVaultStateGetter: jest.Mock; let currentVaultState: any; - beforeEach(async () => { + beforeEach(() => { setupMocks(); - // Set up vault-keys - await setupTestVault(FAKE_PASSWORD); }); afterEach(async () => { @@ -154,6 +153,9 @@ describe('KeyringManager Initialization', () => { ); // Second EVM keyring with same seed + const storage = (keyring1 as any).storage; + await storage.deleteItem('vault'); + await storage.deleteItem('vault-keys'); const mockVaultStateGetter2 = jest.fn(() => currentVaultState); const keyring2 = await KeyringManager.createInitialized( PEACE_SEED_PHRASE, @@ -379,8 +381,9 @@ describe('KeyringManager Initialization', () => { // After forgetting, wallet should be locked and empty expect(keyringManager.isUnlocked()).toBe(false); - const unlockResult = await keyringManager.unlock(FAKE_PASSWORD); - expect(unlockResult.canLogin).toBe(false); // No vault to unlock + await expect(keyringManager.unlock(FAKE_PASSWORD)).rejects.toThrow( + 'Vault keys not found' + ); // No vault exists; this is not a failed password attempt. }); it('should reject forget wallet with wrong password', async () => { @@ -427,7 +430,7 @@ describe('KeyringManager Initialization', () => { expect(seed).toBe(PEACE_SEED_PHRASE); }); - it("should create vault keys when they don't exist", async () => { + it('should create vault keys when the wallet storage is empty', async () => { // Use a keyring with proper UTXO setup keyringManager = new KeyringManager(); @@ -444,8 +447,10 @@ describe('KeyringManager Initialization', () => { // Get the actual storage instance const keyringStorage = (keyringManager as any).storage; - // Ensure no vault-keys exist initially (clean state) - await keyringStorage.set('vault-keys', null); + // A fresh wallet has neither keys nor ciphertext. Removing only the keys + // would simulate an incomplete existing wallet, which must be preserved. + await keyringStorage.deleteItem('vault'); + await keyringStorage.deleteItem('vault-keys'); // Should create vault-keys and initialize successfully const result = await keyringManager.initializeWalletSecurely( @@ -459,11 +464,8 @@ describe('KeyringManager Initialization', () => { // Verify vault-keys were actually created by checking storage const vaultKeys = await keyringStorage.get('vault-keys'); expect(vaultKeys).toBeDefined(); - expect(vaultKeys.hash).toBeDefined(); expect(vaultKeys.salt).toBeDefined(); - expect(typeof vaultKeys.hash).toBe('string'); expect(typeof vaultKeys.salt).toBe('string'); - expect(vaultKeys.hash.length).toBeGreaterThan(0); expect(vaultKeys.salt.length).toBeGreaterThan(0); // Verify keyring is now unlocked and functional diff --git a/packages/sysweb3-keyring/test/unit/keyring-manager/key-derivation.spec.ts b/packages/sysweb3-keyring/test/unit/keyring-manager/key-derivation.spec.ts index d5b08a3d..9c568976 100644 --- a/packages/sysweb3-keyring/test/unit/keyring-manager/key-derivation.spec.ts +++ b/packages/sysweb3-keyring/test/unit/keyring-manager/key-derivation.spec.ts @@ -1,9 +1,9 @@ -import { ethers } from 'ethers'; +import { INetworkType } from '@sidhujag/sysweb3-network'; import { KeyringManager, KeyringAccountType } from '../../../src'; +import { privateKeyToAccount } from '../../../src/transactions/evm-local-signer'; import { FAKE_PASSWORD, PEACE_SEED_PHRASE } from '../../helpers/constants'; -import { setupMocks } from '../../helpers/setup'; -import { INetworkType } from '@pollum-io/sysweb3-network'; +import { createFreshTestKeyring, setupMocks } from '../../helpers/setup'; describe('KeyringManager - Key Derivation', () => { let keyringManager: KeyringManager; @@ -27,7 +27,7 @@ describe('KeyringManager - Key Derivation', () => { }); mockVaultStateGetter = jest.fn(() => currentVaultState); - keyringManager = await KeyringManager.createInitialized( + keyringManager = await createFreshTestKeyring( PEACE_SEED_PHRASE, FAKE_PASSWORD, mockVaultStateGetter @@ -100,7 +100,7 @@ describe('KeyringManager - Key Derivation', () => { ); // Verify it derives the correct address - const wallet = new ethers.Wallet(privateKey0); + const wallet = privateKeyToAccount(privateKey0); const account = keyringManager.getActiveAccount().activeAccount; expect(wallet.address.toLowerCase()).toBe(account.address.toLowerCase()); }); @@ -158,7 +158,7 @@ describe('KeyringManager - Key Derivation', () => { const vault2StateGetter = jest.fn(() => vault2State); // Create second keyring with same seed - const keyring2 = await KeyringManager.createInitialized( + const keyring2 = await createFreshTestKeyring( PEACE_SEED_PHRASE, FAKE_PASSWORD, vault2StateGetter @@ -220,7 +220,7 @@ describe('KeyringManager - Key Derivation', () => { }); mockVaultStateGetter = jest.fn(() => currentVaultState); - keyringManager = await KeyringManager.createInitialized( + keyringManager = await createFreshTestKeyring( PEACE_SEED_PHRASE, FAKE_PASSWORD, mockVaultStateGetter @@ -289,7 +289,7 @@ describe('KeyringManager - Key Derivation', () => { const testnetVaultStateGetter = jest.fn(() => testnetVaultState); // Create testnet keyring - const testnetKeyring = await KeyringManager.createInitialized( + const testnetKeyring = await createFreshTestKeyring( PEACE_SEED_PHRASE, FAKE_PASSWORD, testnetVaultStateGetter @@ -313,7 +313,7 @@ describe('KeyringManager - Key Derivation', () => { const evmVaultStateGetter = jest.fn(() => evmVaultState); // EVM keyring - const evmKeyring = await KeyringManager.createInitialized( + const evmKeyring = await createFreshTestKeyring( PEACE_SEED_PHRASE, FAKE_PASSWORD, evmVaultStateGetter @@ -329,7 +329,7 @@ describe('KeyringManager - Key Derivation', () => { const utxoVaultStateGetter = jest.fn(() => utxoVaultState); // UTXO keyring - const utxoKeyring = await KeyringManager.createInitialized( + const utxoKeyring = await createFreshTestKeyring( PEACE_SEED_PHRASE, FAKE_PASSWORD, utxoVaultStateGetter @@ -404,7 +404,7 @@ describe('KeyringManager - Key Derivation', () => { }); mockVaultStateGetter = jest.fn(() => currentVaultState); - keyringManager = await KeyringManager.createInitialized( + keyringManager = await createFreshTestKeyring( PEACE_SEED_PHRASE, FAKE_PASSWORD, mockVaultStateGetter @@ -438,10 +438,96 @@ describe('KeyringManager - Key Derivation', () => { expect(retrievedKey).toBe(privateKey); // Verify address matches the private key - const wallet = new ethers.Wallet(privateKey); + const wallet = privateKeyToAccount(privateKey); expect(imported.address.toLowerCase()).toBe(wallet.address.toLowerCase()); }); + it('should normalize EVM private keys without 0x when importing', async () => { + currentVaultState = createMockVaultState({ + activeAccountId: 0, + activeAccountType: KeyringAccountType.HDAccount, + networkType: INetworkType.Ethereum, + chainId: 1, + }); + mockVaultStateGetter = jest.fn(() => currentVaultState); + + keyringManager = await createFreshTestKeyring( + PEACE_SEED_PHRASE, + FAKE_PASSWORD, + mockVaultStateGetter + ); + + const privateKey = + '0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef'; + const imported = await keyringManager.importAccount(privateKey); + + currentVaultState.accounts[KeyringAccountType.Imported][imported.id] = { + id: imported.id, + label: 'Imported 1', + address: imported.address, + xpub: imported.xpub, + xprv: imported.xprv, + isImported: true, + isTrezorWallet: false, + isLedgerWallet: false, + balances: { syscoin: 0, ethereum: 0 }, + assets: { syscoin: [], ethereum: [] }, + }; + + expect(imported.address).toBe( + '0xFCAd0B19bB29D4674531d6f115237E16AfCE377c' + ); + await expect( + keyringManager.getPrivateKeyByAccountId( + imported.id, + KeyringAccountType.Imported, + FAKE_PASSWORD + ) + ).resolves.toBe(`0x${privateKey}`); + }); + + it('should reject invalid EVM private key scalars during import', async () => { + currentVaultState = createMockVaultState({ + activeAccountId: 0, + activeAccountType: KeyringAccountType.HDAccount, + networkType: INetworkType.Ethereum, + chainId: 1, + }); + mockVaultStateGetter = jest.fn(() => currentVaultState); + + keyringManager = await createFreshTestKeyring( + PEACE_SEED_PHRASE, + FAKE_PASSWORD, + mockVaultStateGetter + ); + + await expect( + keyringManager.importAccount(`0x${'00'.repeat(32)}`) + ).rejects.toThrow('Invalid EVM private key'); + }); + + it('should reject EVM private keys on UTXO networks', async () => { + currentVaultState = createMockVaultState({ + activeAccountId: 0, + activeAccountType: KeyringAccountType.HDAccount, + networkType: INetworkType.Syscoin, + chainId: 57, + }); + mockVaultStateGetter = jest.fn(() => currentVaultState); + + keyringManager = await createFreshTestKeyring( + PEACE_SEED_PHRASE, + FAKE_PASSWORD, + mockVaultStateGetter + ); + + await expect( + keyringManager.importAccount( + '0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef' + ) + ).rejects.toThrow('Cannot import EVM private key on UTXO network'); + }); + it('should handle imported zprv for UTXO', async () => { // Set up UTXO vault state currentVaultState = createMockVaultState({ @@ -452,7 +538,7 @@ describe('KeyringManager - Key Derivation', () => { }); mockVaultStateGetter = jest.fn(() => currentVaultState); - keyringManager = await KeyringManager.createInitialized( + keyringManager = await createFreshTestKeyring( PEACE_SEED_PHRASE, FAKE_PASSWORD, mockVaultStateGetter @@ -504,6 +590,10 @@ describe('KeyringManager - Key Derivation', () => { mockVaultStateGetter = jest.fn(() => currentVaultState); keyringManager.setVaultStateGetter(mockVaultStateGetter); + // This case exercises creation, so discard the provisioned test wallet. + const storage = (keyringManager as any).storage; + await storage.deleteItem('vault'); + await storage.deleteItem('vault-keys'); await keyringManager.initializeWalletSecurely( PEACE_SEED_PHRASE, FAKE_PASSWORD @@ -525,7 +615,7 @@ describe('KeyringManager - Key Derivation', () => { }); mockVaultStateGetter = jest.fn(() => currentVaultState); - keyringManager = await KeyringManager.createInitialized( + keyringManager = await createFreshTestKeyring( PEACE_SEED_PHRASE, FAKE_PASSWORD, mockVaultStateGetter @@ -561,7 +651,7 @@ describe('KeyringManager - Key Derivation', () => { const vault2StateGetter = jest.fn(() => vault2State); // Create new keyring and add account with different label - const keyring2 = await KeyringManager.createInitialized( + const keyring2 = await createFreshTestKeyring( PEACE_SEED_PHRASE, FAKE_PASSWORD, vault2StateGetter @@ -605,7 +695,7 @@ describe('KeyringManager - Key Derivation', () => { }); mockVaultStateGetter = jest.fn(() => currentVaultState); - keyringManager = await KeyringManager.createInitialized( + keyringManager = await createFreshTestKeyring( PEACE_SEED_PHRASE, FAKE_PASSWORD, mockVaultStateGetter @@ -653,8 +743,7 @@ describe('KeyringManager - Key Derivation', () => { expect.any(String), // blockbook URL account.xpub, 'tokens=used&details=tokens', - true, - undefined + true ); }); @@ -854,7 +943,7 @@ describe('KeyringManager - Key Derivation', () => { const btcVaultStateGetter = jest.fn(() => btcVaultState); // Create Bitcoin keyring - const btcKeyring = await KeyringManager.createInitialized( + const btcKeyring = await createFreshTestKeyring( PEACE_SEED_PHRASE, FAKE_PASSWORD, btcVaultStateGetter @@ -923,7 +1012,7 @@ describe('KeyringManager - Key Derivation', () => { mockVaultStateGetter = jest.fn(() => currentVaultState); - keyringManager = await KeyringManager.createInitialized( + keyringManager = await createFreshTestKeyring( PEACE_SEED_PHRASE, FAKE_PASSWORD, mockVaultStateGetter diff --git a/packages/sysweb3-keyring/test/unit/keyring-manager/prepared-bip84-signing.spec.ts b/packages/sysweb3-keyring/test/unit/keyring-manager/prepared-bip84-signing.spec.ts new file mode 100644 index 00000000..058d3013 --- /dev/null +++ b/packages/sysweb3-keyring/test/unit/keyring-manager/prepared-bip84-signing.spec.ts @@ -0,0 +1,651 @@ +jest.resetModules(); +jest.unmock('syscoinjs-lib'); +(global as any).window.location = { href: 'http://localhost/' }; + +import ecc from '@bitcoinerlab/secp256k1'; +import { Transaction, payments, script } from 'bitcoinjs-lib'; +import { HDNodeWallet } from 'ethers/wallet'; + +import { + Bip84NativeError, + prepareBip84NativeTransaction, +} from '../../../src/bip84-native'; +import { + deriveBip84PublicAddress, + parseBip84PublicAccount, +} from '../../../src/public-bip84'; +import { + SoftwareKeyring, + createSoftwareKeyringHost, + INetworkType, + KeyringAccountType, +} from '../../../src/software'; + +import type { Bip84NativePlan } from '../../../src/bip84-native'; +import type { Bip84PublicAccount } from '../../../src/public-bip84'; +import type { KeyringStoragePort } from '../../../src/software'; + +const PHRASE = + 'abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about'; +const OTHER_PHRASE = + 'legal winner thank year wave sausage worth useful legal winner thank yellow'; +const PASSWORD = 'public prepared BIP84 fixture password'; +const ENDPOINT = 'https://offline.invalid'; +const noop = () => undefined; +type Coin = 'bitcoin' | 'syscoin'; +const clone = (value: T): T => JSON.parse(JSON.stringify(value)); + +function publicAccount(coin: Coin, index: number, phrase = PHRASE) { + const key = HDNodeWallet.fromPhrase( + phrase, + undefined, + `m/84'/${coin === 'bitcoin' ? 0 : 57}'/${index}'` + ).neuter().extendedKey; + return parseBip84PublicAccount({ network: coin, accountKey: key }); +} + +function makePlan( + coin: Coin, + account: Bip84PublicAccount, + values: readonly bigint[] = [100_000n, 80_000n] +): Bip84NativePlan { + const paths = [ + { branch: 0 as const, index: 3, value: values[0] }, + { branch: 1 as const, index: 5, value: values[1] }, + ]; + const parents = paths.map((input, index) => { + const previous = new Transaction(); + previous.version = 2; + previous.addInput(Buffer.alloc(32, index + 1), 0); + const derived = deriveBip84PublicAddress({ + network: coin, + accountKey: account.canonicalKey, + branch: input.branch, + index: input.index, + }); + previous.addOutput(Buffer.from(derived.scriptPubKey, 'hex'), input.value); + return previous; + }); + return { + network: { network: coin, endpoint: ENDPOINT }, + account, + inputs: paths.map((input, index) => ({ + txid: parents[index].getId(), + vout: 0, + branch: input.branch, + index: input.index, + })), + previousTransactions: parents.map((tx) => ({ + txid: tx.getId(), + rawTransaction: tx.toHex(), + })), + recipient: { + address: deriveBip84PublicAddress({ + network: coin, + accountKey: account.canonicalKey, + branch: 0, + index: 9, + }).address, + valueSatoshis: (values[0] + values[1] - 30_000n).toString(), + }, + change: { index: 7, valueSatoshis: '29000' }, + locktime: 0, + rbf: true, + feeLimits: { maxFeeSatoshis: '1000', maxFeeRateSatPerVByte: '1000' }, + }; +} + +async function fixture(coin: Coin = 'bitcoin', index = 2) { + const records = new Map(); + const storage: KeyringStoragePort = { + get: jest.fn(async (key) => records.get(key)), + set: jest.fn(async (key, value) => { + records.set(key, value); + }), + deleteItem: jest.fn(async (key) => { + records.delete(key); + }), + createManyIfAbsent: jest.fn(async (items) => { + if (Object.keys(items).some((key) => records.has(key))) return false; + Object.entries(items).forEach(([key, value]) => records.set(key, value)); + return true; + }), + }; + const state: any = { + activeAccount: { id: 0, type: KeyringAccountType.HDAccount }, + activeNetwork: { + kind: INetworkType.Syscoin, + chainId: coin === 'bitcoin' ? 0 : 57, + slip44: coin === 'bitcoin' ? 0 : 57, + currency: coin === 'bitcoin' ? 'btc' : 'sys', + label: coin, + url: ENDPOINT, + }, + accounts: { + HDAccount: {}, + Imported: {}, + Ledger: {}, + Trezor: {}, + SmartAccount: {}, + }, + }; + const host = createSoftwareKeyringHost(storage); + const keyring = new SoftwareKeyring(host); + keyring.setVaultStateGetter(() => state); + await keyring.initializeSession(PHRASE, PASSWORD); + // Public derivation deliberately leaves SDK selection at its initial HD0. + const derived = await keyring.deriveBip84HdPublicAccount( + { network: { network: coin, endpoint: ENDPOINT }, accountIndex: index }, + { assertCurrent: noop } + ); + expect(state.activeAccount.id).toBe(0); + const account = derived.account; + const receive = deriveBip84PublicAddress({ + network: coin, + accountKey: account.canonicalKey, + branch: 0, + index: 11, + }); + state.accounts.HDAccount[index] = { + id: index, + label: 'Public runtime account', + address: receive.address, + xpub: account.canonicalKey, + xprv: '', + }; + state.activeAccount.id = index; + const prepared = prepareBip84NativeTransaction(makePlan(coin, account)); + const input = { + account: { + type: 'HDAccount' as const, + index, + expectedAccountKey: account.canonicalKey, + }, + prepared, + }; + for (const fn of [ + storage.get, + storage.set, + storage.deleteItem, + storage.createManyIfAbsent!, + ]) + jest.mocked(fn).mockClear(); + return { coin, index, records, storage, host, state, keyring, input }; +} + +function referenceTransaction( + input: Awaited>['input'] +) { + const tx = Transaction.fromHex(input.prepared.unsignedTransaction); + input.prepared.plan.inputs.forEach((spend, index) => { + const node = HDNodeWallet.fromPhrase( + PHRASE, + undefined, + `m/84'/${input.prepared.plan.network.network === 'bitcoin' ? 0 : 57}'/${ + input.account.index + }'/${spend.branch}/${spend.index}` + ); + const pubkey = Buffer.from( + node.signingKey.compressedPublicKey.slice(2), + 'hex' + ); + const privateKey = Buffer.from(node.privateKey.slice(2), 'hex'); + try { + const parent = input.prepared.plan.previousTransactions.find( + (p) => p.txid === spend.txid + )!; + const value = Transaction.fromHex(parent.rawTransaction).outs[spend.vout] + .value; + const digest = tx.hashForWitnessV0( + index, + payments.p2pkh({ pubkey }).output!, + value, + Transaction.SIGHASH_ALL + ); + tx.setWitness(index, [ + script.signature.encode( + ecc.sign(digest, privateKey), + Transaction.SIGHASH_ALL + ), + pubkey, + ]); + } finally { + privateKey.fill(0); + } + }); + return tx; +} + +it.each(['bitcoin', 'syscoin'] as const)( + 'signs selected %s HD2 using public runtime metadata and exact independently built witnesses', + async (coin) => { + const f = await fixture(coin); + const beforeState = JSON.stringify(f.state); + const beforeRecords = JSON.stringify([...f.records]); + const fetch = jest.spyOn(global, 'fetch').mockImplementation(() => { + throw Error('Forbidden network request'); + }); + const provider = jest.requireMock( + '../../../src/providers' + ).CustomJsonRpcProvider; + provider.mockClear(); + const forbidden = () => { + throw Error('Forbidden transport operation'); + }; + const http = jest + .spyOn(jest.requireActual('node:http'), 'request') + .mockImplementation(forbidden); + const https = jest + .spyOn(jest.requireActual('node:https'), 'request') + .mockImplementation(forbidden); + const dns = jest + .spyOn(jest.requireActual('node:dns'), 'lookup') + .mockImplementation(forbidden); + try { + const result = await f.keyring.signPreparedBip84Transaction(f.input, { + assertCurrent: noop, + }); + const reference = referenceTransaction(f.input); + expect(result.rawTransaction).toBe(reference.toHex()); + expect(result.txid).toBe(reference.getId()); + expect(result.wtxid).toBe( + Buffer.from(reference.getHash(true)).reverse().toString('hex') + ); + expect(result.unsignedTransaction).toBe( + f.input.prepared.unsignedTransaction + ); + expect(result.feeSatoshis).toBe('1000'); + expect(result.virtualSize).toBe(reference.virtualSize()); + const final = Transaction.fromHex(result.rawTransaction); + const stripped = final.clone(); + final.ins.forEach((input, index) => { + expect(input.script.length).toBe(0); + expect(input.witness).toHaveLength(2); + const decoded = script.signature.decode(input.witness[0]); + expect(decoded.hashType).toBe(Transaction.SIGHASH_ALL); + const spend = f.input.prepared.plan.inputs[index]; + const parent = f.input.prepared.plan.previousTransactions.find( + (p) => p.txid === spend.txid + )!; + const value = Transaction.fromHex(parent.rawTransaction).outs[ + spend.vout + ].value; + const hash = final.hashForWitnessV0( + index, + payments.p2pkh({ pubkey: input.witness[1] }).output!, + value, + Transaction.SIGHASH_ALL + ); + expect( + ecc.verify(hash, input.witness[1], decoded.signature, true) + ).toBe(true); + stripped.setWitness(index, []); + }); + expect(stripped.toHex()).toBe(f.input.prepared.unsignedTransaction); + expect(Object.keys(result).sort()).toEqual([ + 'feeSatoshis', + 'rawTransaction', + 'txid', + 'unsignedTransaction', + 'virtualSize', + 'wtxid', + ]); + expect(Object.isFrozen(result)).toBe(true); + expect( + Object.values(result).every( + (value) => typeof value === 'string' || typeof value === 'number' + ) + ).toBe(true); + expect(JSON.stringify(result)).not.toContain(PHRASE); + expect(JSON.stringify(result)).not.toContain(PASSWORD); + expect(result).not.toHaveProperty('privateKey'); + expect(result).not.toHaveProperty('psbt'); + expect(JSON.stringify(f.state)).toBe(beforeState); + expect(JSON.stringify([...f.records])).toBe(beforeRecords); + expect(f.storage.get).not.toHaveBeenCalled(); + expect(f.storage.set).not.toHaveBeenCalled(); + expect(f.storage.deleteItem).not.toHaveBeenCalled(); + expect(f.storage.createManyIfAbsent).not.toHaveBeenCalled(); + expect(fetch).not.toHaveBeenCalled(); + expect(provider).not.toHaveBeenCalled(); + expect(http).not.toHaveBeenCalled(); + expect(https).not.toHaveBeenCalled(); + expect(dns).not.toHaveBeenCalled(); + } finally { + fetch.mockRestore(); + http.mockRestore(); + https.mockRestore(); + dns.mockRestore(); + await f.keyring.destroy(); + } + } +); + +it('keeps SYS input and output arithmetic above Number.MAX_SAFE_INTEGER exact', async () => { + const f = await fixture('syscoin'); + const large = 9_007_199_254_740_993n; + f.input.prepared = prepareBip84NativeTransaction( + makePlan('syscoin', f.input.prepared.plan.account, [large, 80_000n]) + ); + try { + const result = await f.keyring.signPreparedBip84Transaction(f.input, { + assertCurrent: noop, + }); + expect(result.rawTransaction).toBe(referenceTransaction(f.input).toHex()); + const tx = Transaction.fromHex(result.rawTransaction); + expect(tx.outs[0].value).toBe(large + 50_000n); + expect(tx.outs[1].value).toBe(29_000n); + expect( + large + 80_000n - tx.outs.reduce((sum, output) => sum + output.value, 0n) + ).toBe(1_000n); + expect(result.feeSatoshis).toBe('1000'); + } finally { + await f.keyring.destroy(); + } +}); + +it('derives the mnemonic seed once per multi-input operation without retaining a signing cache', async () => { + const f = await fixture(); + const deriveSeed = jest.spyOn( + jest.requireActual('bip39'), + 'mnemonicToSeedSync' + ); + try { + expect(f.input.prepared.plan.inputs).toHaveLength(2); + await f.keyring.signPreparedBip84Transaction(f.input, { + assertCurrent: noop, + }); + expect(deriveSeed).toHaveBeenCalledTimes(1); + await f.keyring.signPreparedBip84Transaction(f.input, { + assertCurrent: noop, + }); + expect(deriveSeed).toHaveBeenCalledTimes(2); + } finally { + deriveSeed.mockRestore(); + await f.keyring.destroy(); + } +}); + +it('does not let the initial SDK HD0 anchor sign a reviewed HD2 plan', async () => { + const f = await fixture(); + const zero = publicAccount('bitcoin', 0); + f.state.accounts.HDAccount[0] = { + ...f.state.accounts.HDAccount[2], + id: 0, + xpub: zero.canonicalKey, + }; + f.state.activeAccount.id = 0; + try { + await expect( + f.keyring.signPreparedBip84Transaction(f.input, { assertCurrent: noop }) + ).rejects.toBeInstanceOf(Bip84NativeError); + expect(f.state.activeAccount.id).toBe(0); + } finally { + await f.keyring.destroy(); + } +}); + +it('rejects a foreign seed account even when the selected record and complete plan agree with it', async () => { + const f = await fixture(); + const foreign = publicAccount('bitcoin', 2, OTHER_PHRASE); + f.state.accounts.HDAccount[2].xpub = foreign.canonicalKey; + const input = { + account: { ...f.input.account, expectedAccountKey: foreign.canonicalKey }, + prepared: prepareBip84NativeTransaction(makePlan('bitcoin', foreign)), + }; + try { + await expect( + f.keyring.signPreparedBip84Transaction(input, { assertCurrent: noop }) + ).rejects.toMatchObject({ code: 'ACCOUNT_MISMATCH' }); + } finally { + await f.keyring.destroy(); + } +}); + +it.each([ + 'missing-record', + 'wrong-record-id', + 'wrong-xpub', + 'isImported', + 'isLedgerWallet', + 'isTrezorWallet', + 'isSmartAccount', +])('refuses invalid selected public runtime state: %s', async (change) => { + const f = await fixture(); + if (change === 'missing-record') delete f.state.accounts.HDAccount[2]; + else if (change === 'wrong-record-id') f.state.accounts.HDAccount[2].id = 1; + else if (change === 'wrong-xpub') + f.state.accounts.HDAccount[2].xpub = publicAccount( + 'bitcoin', + 1 + ).canonicalKey; + else f.state.accounts.HDAccount[2][change] = true; + try { + await expect( + f.keyring.signPreparedBip84Transaction(f.input, { assertCurrent: noop }) + ).rejects.toBeInstanceOf(Bip84NativeError); + } finally { + await f.keyring.destroy(); + } +}); + +it.each([ + KeyringAccountType.Imported, + KeyringAccountType.Ledger, + KeyringAccountType.Trezor, + KeyringAccountType.SmartAccount, +])( + 'refuses selected %s even if it carries matching public HD metadata', + async (type) => { + const f = await fixture(); + f.state.accounts[type][2] = { ...f.state.accounts.HDAccount[2] }; + f.state.activeAccount.type = type; + try { + await expect( + f.keyring.signPreparedBip84Transaction(f.input, { assertCurrent: noop }) + ).rejects.toBeInstanceOf(Bip84NativeError); + } finally { + await f.keyring.destroy(); + } + } +); + +it.each([ + 'account', + 'address', + 'xpub', + 'network', + 'endpoint', + 'slip44', + 'lock', +])( + 'rejects a guard-side %s mutation before releasing signed bytes', + async (change) => { + const f = await fixture(); + try { + await expect( + f.keyring.signPreparedBip84Transaction(f.input, { + assertCurrent() { + if (change === 'account') f.state.activeAccount.id = 0; + if (change === 'address') + f.state.accounts.HDAccount[2].address = 'changed'; + if (change === 'xpub') + f.state.accounts.HDAccount[2].xpub = publicAccount( + 'bitcoin', + 1 + ).canonicalKey; + if (change === 'network') f.state.activeNetwork.chainId = 57; + if (change === 'endpoint') + f.state.activeNetwork.url = 'https://other.invalid'; + if (change === 'slip44') f.state.activeNetwork.slip44 = 57; + if (change === 'lock') void f.keyring.lockWallet(); + }, + }) + ).rejects.toMatchObject({ code: 'CANCELLED' }); + } finally { + await f.keyring.destroy(); + } + } +); + +it('requires a synchronous undefined-returning guard and does not expose its rejection text', async () => { + const f = await fixture(); + try { + for (const value of [ + true, + null, + Promise.resolve(), + Promise.reject(Error('private guard detail')), + ]) { + await expect( + f.keyring.signPreparedBip84Transaction(f.input, { + assertCurrent: () => value, + } as any) + ).rejects.toMatchObject({ code: 'CANCELLED' }); + } + let error: any; + try { + await f.keyring.signPreparedBip84Transaction(f.input, { + assertCurrent() { + throw Error(PHRASE); + }, + }); + } catch (caught) { + error = caught; + } + expect(error).toBeInstanceOf(Bip84NativeError); + expect(error.message).toBe('CANCELLED'); + expect(error).not.toHaveProperty('cause'); + await f.keyring.signPreparedBip84Transaction(f.input, { + assertCurrent: noop, + }); + } finally { + await f.keyring.destroy(); + } +}); + +it('honors a monotonic host revision after account and endpoint values return to their originals', async () => { + const f = await fixture(); + let revision = 0; + const admitted = revision; + try { + await expect( + f.keyring.signPreparedBip84Transaction(f.input, { + assertCurrent() { + f.state.activeAccount.id = 0; + revision++; + f.state.activeNetwork.url = 'https://other.invalid'; + revision++; + f.state.activeAccount.id = 2; + f.state.activeNetwork.url = ENDPOINT; + if (revision !== admitted) throw Error('stale host review'); + }, + }) + ).rejects.toMatchObject({ code: 'CANCELLED' }); + await f.keyring.signPreparedBip84Transaction(f.input, { + assertCurrent: noop, + }); + } finally { + await f.keyring.destroy(); + } +}); + +it('shares admission with reentrant public derivation and signing, then releases only its own token', async () => { + const f = await fixture(); + let nested: Promise[] | undefined; + try { + await f.keyring.signPreparedBip84Transaction(f.input, { + assertCurrent() { + if (!nested) + nested = [ + f.keyring + .deriveBip84HdPublicAccount( + { network: f.input.prepared.plan.network, accountIndex: 2 }, + { assertCurrent: noop } + ) + .catch((error) => error), + f.keyring + .signPreparedBip84Transaction(f.input, { assertCurrent: noop }) + .catch((error) => error), + ]; + }, + }); + for (const result of await Promise.all(nested!)) + expect(result).toMatchObject({ code: 'BUSY' }); + await f.keyring.signPreparedBip84Transaction(f.input, { + assertCurrent: noop, + }); + } finally { + await f.keyring.destroy(); + } +}); + +it('detaches the approved request before a guard mutates caller-owned values', async () => { + const f = await fixture(); + const input: any = clone(f.input); + try { + const result = await f.keyring.signPreparedBip84Transaction(input, { + assertCurrent() { + input.account.index = 3; + input.account.expectedAccountKey = publicAccount( + 'bitcoin', + 3 + ).canonicalKey; + input.prepared.plan.recipient.valueSatoshis = '1'; + input.prepared.unsignedTransaction = '00'; + }, + }); + expect(result.rawTransaction).toBe(referenceTransaction(f.input).toHex()); + } finally { + await f.keyring.destroy(); + } +}); + +it('rejects while locked, permits a new authenticated session, and rejects after disposal', async () => { + const f = await fixture(); + try { + await f.keyring.lockWallet(); + await expect( + f.keyring.signPreparedBip84Transaction(f.input, { assertCurrent: noop }) + ).rejects.toMatchObject({ code: 'CANCELLED' }); + await expect(f.keyring.unlock(PASSWORD)).resolves.toMatchObject({ + canLogin: true, + }); + await f.keyring.signPreparedBip84Transaction(f.input, { + assertCurrent: noop, + }); + await f.keyring.destroy(); + await expect( + f.keyring.signPreparedBip84Transaction(f.input, { assertCurrent: noop }) + ).rejects.toMatchObject({ code: 'CANCELLED' }); + } finally { + await f.keyring.destroy(); + } +}); + +it('does not clear or sign through a session transferred to another same-authority keyring', async () => { + const f = await fixture(); + const replacement = new SoftwareKeyring(f.host); + replacement.setVaultStateGetter(() => f.state); + let moved = false; + try { + await expect( + f.keyring.signPreparedBip84Transaction(f.input, { + assertCurrent() { + if (!moved) { + moved = true; + f.keyring.transferSessionTo(replacement); + } + }, + }) + ).rejects.toMatchObject({ code: 'CANCELLED' }); + expect(replacement.isUnlocked()).toBe(true); + const result = await replacement.signPreparedBip84Transaction(f.input, { + assertCurrent: noop, + }); + expect(result.rawTransaction).toBe(referenceTransaction(f.input).toHex()); + } finally { + await f.keyring.destroy(); + await replacement.destroy(); + } +}); diff --git a/packages/sysweb3-keyring/test/unit/keyring-manager/private-records.spec.ts b/packages/sysweb3-keyring/test/unit/keyring-manager/private-records.spec.ts new file mode 100644 index 00000000..7c520327 --- /dev/null +++ b/packages/sysweb3-keyring/test/unit/keyring-manager/private-records.spec.ts @@ -0,0 +1,456 @@ +import { createDecipheriv, hkdfSync, webcrypto } from 'crypto'; +import CryptoJS from 'crypto-js'; + +import { HardwareWalletManager } from '../../../src/hardware-wallet-manager'; +import { KeyringManager } from '../../../src/keyring-manager'; +import { + IEncryptedPrivateRecord, + MAX_PRIVATE_RECORD_BYTES, +} from '../../../src/private-records'; + +const ROOT = 'synthetic root secret for private record tests'; +const DOMAIN = 'org.syscoin.pali.privacy.notes.v1'; +const RECORD_ID = '4fddac53-c01d-4c8e-8b86-5a37f5430cf1'; +const TEXT = 'synthetic private note and encrypted metadata'; +const bytes = () => new TextEncoder().encode(TEXT); + +class TestBuffer { + private cleared = false; + constructor(private value: string) {} + toString() { + if (this.cleared) throw new Error('cleared test buffer'); + return this.value; + } + isCleared() { + return this.cleared; + } + clear() { + this.value = ''; + this.cleared = true; + } +} + +function installSession( + manager: KeyringManager, + root = ROOT, + password = 'synthetic session wrapping key' +) { + manager.receiveSessionOwnership( + new TestBuffer(password) as any, + new TestBuffer(CryptoJS.AES.encrypt(root, password).toString()) as any + ); +} + +function fixture(root = ROOT, password?: string) { + // The configured test storage is in memory; no initialize/unlock/storage API + // is used to create these synthetic encrypted session buffers. + const manager = new KeyringManager(new HardwareWalletManager()); + (manager as any).ledgerSigner = undefined; + (manager as any).trezorSigner = undefined; + installSession(manager, root, password); + return manager; +} + +const seal = (manager: KeyringManager) => + manager.encryptPrivateRecord({ + domain: DOMAIN, + recordId: RECORD_ID, + plaintext: bytes(), + }); +const open = (manager: KeyringManager, envelope: IEncryptedPrivateRecord) => + manager.decryptPrivateRecord({ + domain: DOMAIN, + recordId: RECORD_ID, + envelope, + }); + +function deferred() { + let resolve!: (value: T) => void; + const promise = new Promise((done) => { + resolve = done; + }); + return { promise, resolve }; +} + +function pauseCrypto(method: keyof SubtleCrypto) { + const started = deferred(); + const release = deferred(); + let captured: unknown; + let input: unknown; + const subtle = new Proxy(webcrypto.subtle, { + get(target, key) { + const original = Reflect.get(target, key); + if (key !== method) { + return typeof original === 'function' + ? original.bind(target) + : original; + } + return async (...args: unknown[]) => { + input = args[2]; + captured = await original.apply(target, args); + started.resolve(); + await release.promise; + return captured; + }; + }, + }); + global.crypto = { + subtle, + getRandomValues: webcrypto.getRandomValues.bind(webcrypto), + } as any; + return { + started: started.promise, + release: () => release.resolve(), + output: () => captured, + input: () => input, + }; +} + +beforeEach(() => { + global.crypto = webcrypto as any; + // No device monitoring is needed for this synthetic session-only fixture. + jest + .spyOn(HardwareWalletManager.prototype as any, 'startStatusMonitoring') + .mockImplementation(() => undefined); +}); +afterEach(() => { + global.crypto = webcrypto as any; + jest.restoreAllMocks(); +}); + +describe('private record custody', () => { + it('matches independent Node HKDF and AES-GCM primitives', async () => { + const manager = fixture(); + const envelope = await seal(manager); + const namespace = 'sysweb3/private-record/v1'; + expect(await manager.getPrivateRecordProfileId()).toBe( + '0x0869e9262d7bd77eec1b7f493e8059a601fbbe70807b6c0742836eb3e1da7224' + ); + const key = Buffer.from( + hkdfSync( + 'sha256', + Buffer.from(ROOT.normalize('NFKD')), + Buffer.from(namespace), + Buffer.from(JSON.stringify([namespace, 'encryption-key', DOMAIN])), + 32 + ) + ); + const ciphertext = Buffer.from(envelope.ciphertext, 'base64'); + const decipher = createDecipheriv( + 'aes-256-gcm', + key, + Buffer.from(envelope.nonce, 'base64') + ); + decipher.setAAD( + Buffer.from( + JSON.stringify([namespace, 1, DOMAIN, RECORD_ID, envelope.profileId]) + ) + ); + decipher.setAuthTag(ciphertext.subarray(-16)); + expect( + Buffer.concat([ + decipher.update(ciphertext.subarray(0, -16)), + decipher.final(), + ]) + ).toEqual(Buffer.from(bytes())); + key.fill(0); + }); + + it('uses stable root identity across account/network and password changes', async () => { + const manager = fixture(); + const getter = jest.fn(() => ({ + activeAccount: { id: 1, type: 'HDAccount' }, + activeNetwork: { chainId: 1, slip44: 60 }, + })); + manager.setVaultStateGetter(getter); + const profile = await manager.getPrivateRecordProfileId(); + const envelope = await seal(manager); + getter.mockReturnValue({ + activeAccount: { id: 2, type: 'Imported' }, + activeNetwork: { chainId: 57, slip44: 57 }, + }); + expect(await manager.getPrivateRecordProfileId()).toBe(profile); + installSession(manager, ROOT, 'a changed session password'); + expect(await manager.getPrivateRecordProfileId()).toBe(profile); + expect(await open(manager, envelope)).toEqual(bytes()); + expect( + await fixture(ROOT, 'another password').getPrivateRecordProfileId() + ).toBe(profile); + expect(getter).not.toHaveBeenCalled(); + }); + + it('uses a fresh 96-bit nonce and returns only the public envelope', async () => { + const manager = fixture(); + const first = await seal(manager); + const second = await seal(manager); + expect(first.profileId).toMatch(/^0x[0-9a-f]{64}$/); + expect(first.nonce).not.toBe(second.nonce); + expect(first.ciphertext).not.toBe(second.ciphertext); + expect(Buffer.from(first.nonce, 'base64')).toHaveLength(12); + expect(Buffer.from(first.ciphertext, 'base64')).toHaveLength( + bytes().length + 16 + ); + expect(Object.keys(first).sort()).toEqual([ + 'ciphertext', + 'domain', + 'nonce', + 'profileId', + 'recordId', + 'version', + ]); + expect(await open(manager, first)).toEqual(bytes()); + expect(await open(manager, second)).toEqual(bytes()); + }); + + it('never reads or writes wallet storage while sealing or opening a record', async () => { + const manager = fixture(); + const storage = (manager as any).storage; + const getSeed = jest.spyOn(manager, 'getSeed'); + jest.clearAllMocks(); + const envelope = await seal(manager); + await manager.getPrivateRecordProfileId(); + await open(manager, envelope); + expect(getSeed).not.toHaveBeenCalled(); + for (const name of [ + 'get', + 'set', + 'setMany', + 'createManyIfAbsent', + 'deleteItem', + ]) { + if (storage[name]) expect(storage[name]).not.toHaveBeenCalled(); + } + }); + + it('copies plaintext and context before asynchronous work begins', async () => { + const manager = fixture(); + const pause = pauseCrypto('importKey'); + const params = { domain: DOMAIN, recordId: RECORD_ID, plaintext: bytes() }; + const pending = manager.encryptPrivateRecord(params); + await pause.started; + params.plaintext.fill(0); + params.domain = 'changed.domain'; + params.recordId = 'changed-id'; + pause.release(); + const envelope = await pending; + global.crypto = webcrypto as any; + expect(envelope.domain).toBe(DOMAIN); + expect(envelope.recordId).toBe(RECORD_ID); + expect(await open(manager, envelope)).toEqual(bytes()); + }); + + it('copies the encrypted envelope before asynchronous decryption', async () => { + const manager = fixture(); + const envelope = await seal(manager); + const pause = pauseCrypto('importKey'); + const pending = open(manager, envelope); + await pause.started; + envelope.domain = 'changed.domain'; + envelope.nonce = ''; + envelope.ciphertext = ''; + pause.release(); + expect(await pending).toEqual(bytes()); + }); + + it.each(['ciphertext', 'nonce'] as const)( + 'rejects tampered %s', + async (field) => { + const manager = fixture(); + const envelope = await seal(manager); + const raw = Buffer.from(envelope[field], 'base64'); + raw[0] ^= 1; + envelope[field] = raw.toString('base64'); + await expect(open(manager, envelope)).rejects.toThrow( + 'authentication failed' + ); + } + ); + + it('authenticates the version, domain, record ID and profile', async () => { + const manager = fixture(); + const envelope = await seal(manager); + await expect( + open(manager, { ...envelope, version: 2 } as any) + ).rejects.toThrow(); + await expect( + manager.decryptPrivateRecord({ + domain: 'another.domain', + recordId: RECORD_ID, + envelope, + }) + ).rejects.toThrow(); + await expect( + manager.decryptPrivateRecord({ + domain: 'another.domain', + recordId: RECORD_ID, + envelope: { ...envelope, domain: 'another.domain' }, + }) + ).rejects.toThrow('authentication failed'); + await expect( + manager.decryptPrivateRecord({ + domain: DOMAIN, + recordId: 'another-id', + envelope: { ...envelope, recordId: 'another-id' }, + }) + ).rejects.toThrow('authentication failed'); + await expect( + open(manager, { ...envelope, profileId: `0x${'00'.repeat(32)}` }) + ).rejects.toThrow('profile mismatch'); + await expect( + open(fixture('different synthetic root'), envelope) + ).rejects.toThrow('profile mismatch'); + }); + + it('accepts empty and maximum-size records but rejects oversized input', async () => { + const manager = fixture(); + for (const plaintext of [ + new Uint8Array(), + new Uint8Array(MAX_PRIVATE_RECORD_BYTES).fill(5), + ]) { + const envelope = await manager.encryptPrivateRecord({ + domain: DOMAIN, + recordId: RECORD_ID, + plaintext, + }); + expect(await open(manager, envelope)).toEqual(plaintext); + } + await expect( + manager.encryptPrivateRecord({ + domain: DOMAIN, + recordId: RECORD_ID, + plaintext: new Uint8Array(MAX_PRIVATE_RECORD_BYTES + 1), + }) + ).rejects.toThrow('size'); + }); + + it.each([ + '', + 'x'.repeat(129), + 'space domain', + 'new' + String.fromCharCode(10) + 'line', + 'trailing' + String.fromCharCode(10), + 'trailing' + String.fromCharCode(13), + String.fromCharCode(0xd800), + 'é', + ])('rejects invalid context %j', async (value) => { + const manager = fixture(); + await expect( + manager.encryptPrivateRecord({ + domain: value, + recordId: RECORD_ID, + plaintext: bytes(), + }) + ).rejects.toThrow('context'); + await expect( + manager.encryptPrivateRecord({ + domain: DOMAIN, + recordId: value, + plaintext: bytes(), + }) + ).rejects.toThrow('context'); + }); + + it('rejects oversized or noncanonical encoded envelopes before decrypting', async () => { + const manager = fixture(); + const envelope = await seal(manager); + for (const change of [ + { nonce: '' }, + { nonce: `${envelope.nonce}\n` }, + { + ciphertext: 'A'.repeat( + 4 * Math.ceil((MAX_PRIVATE_RECORD_BYTES + 16) / 3) + 4 + ), + }, + { ciphertext: 'AA==' }, + { secret: 'unexpected metadata' }, + ]) { + await expect(open(manager, { ...envelope, ...change })).rejects.toThrow( + 'envelope' + ); + } + }); + + it('requires an unlocked session and native WebCrypto', async () => { + const manager = fixture(); + const envelope = await seal(manager); + await manager.lockWallet(); + await expect(manager.getPrivateRecordProfileId()).rejects.toThrow( + 'session changed' + ); + await expect(seal(manager)).rejects.toThrow('session changed'); + await expect(open(manager, envelope)).rejects.toThrow('session changed'); + installSession(manager); + global.crypto = undefined as any; + await expect(seal(manager)).rejects.toThrow('cryptography unavailable'); + }); +}); + +describe('private record async session lifetime', () => { + it.each([ + ['profile', 'importKey'], + ['profile', 'deriveBits'], + ['encrypt', 'importKey'], + ['encrypt', 'deriveBits'], + ['encrypt', 'deriveKey'], + ['encrypt', 'encrypt'], + ['decrypt', 'importKey'], + ['decrypt', 'deriveBits'], + ['decrypt', 'deriveKey'], + ['decrypt', 'decrypt'], + ] as const)('rejects %s after lock during %s', async (operation, method) => { + const manager = fixture(); + const envelope = await seal(manager); + const pause = pauseCrypto(method); + const pending = + operation === 'profile' + ? manager.getPrivateRecordProfileId() + : operation === 'encrypt' + ? seal(manager) + : open(manager, envelope); + await pause.started; + await manager.lockWallet(); + pause.release(); + await expect(pending).rejects.toThrow('session changed'); + if (method === 'decrypt') { + expect( + new Uint8Array(pause.output() as ArrayBuffer).every( + (value) => value === 0 + ) + ).toBe(true); + } + if (method === 'encrypt') { + expect((pause.input() as Uint8Array).every((value) => value === 0)).toBe( + true + ); + } + }); + + it.each(['replace', 'transfer', 'transfer-back'] as const)( + 'rejects a pending result after %s', + async (change) => { + const source = fixture(); + const target = fixture('another root'); + const pause = pauseCrypto('encrypt'); + const pending = seal(source); + await pause.started; + if (change === 'replace') installSession(source); + else { + source.transferSessionTo(target); + if (change === 'transfer-back') target.transferSessionTo(source); + } + pause.release(); + await expect(pending).rejects.toThrow('session changed'); + } + ); + + it('keeps record identity and ciphertext valid after a completed session transfer', async () => { + const source = fixture(); + const target = fixture('another root'); + const profile = await source.getPrivateRecordProfileId(); + const envelope = await seal(source); + source.transferSessionTo(target); + expect(source.isUnlocked()).toBe(false); + expect(await target.getPrivateRecordProfileId()).toBe(profile); + expect(await open(target, envelope)).toEqual(bytes()); + }); +}); diff --git a/packages/sysweb3-keyring/test/unit/keyring-manager/security.spec.ts b/packages/sysweb3-keyring/test/unit/keyring-manager/security.spec.ts index e7da1f2b..9b090c14 100644 --- a/packages/sysweb3-keyring/test/unit/keyring-manager/security.spec.ts +++ b/packages/sysweb3-keyring/test/unit/keyring-manager/security.spec.ts @@ -1,7 +1,8 @@ +import { INetworkType } from '@sidhujag/sysweb3-network'; + import { KeyringManager, KeyringAccountType } from '../../../src'; import { FAKE_PASSWORD, PEACE_SEED_PHRASE } from '../../helpers/constants'; -import { setupMocks } from '../../helpers/setup'; -import { INetworkType } from '@pollum-io/sysweb3-network'; +import { createFreshTestKeyring, setupMocks } from '../../helpers/setup'; describe('KeyringManager - Security', () => { let keyringManager: KeyringManager; @@ -25,7 +26,7 @@ describe('KeyringManager - Security', () => { }); mockVaultStateGetter = jest.fn(() => currentVaultState); - keyringManager = await KeyringManager.createInitialized( + keyringManager = await createFreshTestKeyring( PEACE_SEED_PHRASE, FAKE_PASSWORD, mockVaultStateGetter @@ -64,7 +65,7 @@ describe('KeyringManager - Security', () => { expect(weakPasswords.length).toBeGreaterThan(0); // Placeholder assertion // for (const weakPassword of weakPasswords) { // await expect( - // KeyringManager.createInitialized(PEACE_SEED_PHRASE, weakPassword, INetworkType.Ethereum, mockVaultStateGetter) + // createFreshTestKeyring(PEACE_SEED_PHRASE, weakPassword, INetworkType.Ethereum, mockVaultStateGetter) // ).rejects.toThrow('Password too weak'); // } }); @@ -91,7 +92,7 @@ describe('KeyringManager - Security', () => { }); mockVaultStateGetter = jest.fn(() => currentVaultState); - keyringManager = await KeyringManager.createInitialized( + keyringManager = await createFreshTestKeyring( PEACE_SEED_PHRASE, FAKE_PASSWORD, mockVaultStateGetter @@ -176,7 +177,7 @@ describe('KeyringManager - Security', () => { const evmVaultStateGetter = jest.fn(() => evmVaultState); // EVM should use BIP44 m/44'/60'/0'/0/x - const evmKeyring = await KeyringManager.createInitialized( + const evmKeyring = await createFreshTestKeyring( PEACE_SEED_PHRASE, FAKE_PASSWORD, evmVaultStateGetter @@ -192,7 +193,7 @@ describe('KeyringManager - Security', () => { const utxoVaultStateGetter = jest.fn(() => utxoVaultState); // UTXO should use BIP84 m/84'/57'/0'/0/x for Syscoin - const utxoKeyring = await KeyringManager.createInitialized( + const utxoKeyring = await createFreshTestKeyring( PEACE_SEED_PHRASE, FAKE_PASSWORD, utxoVaultStateGetter @@ -217,7 +218,7 @@ describe('KeyringManager - Security', () => { }); mockVaultStateGetter = jest.fn(() => currentVaultState); - keyringManager = await KeyringManager.createInitialized( + keyringManager = await createFreshTestKeyring( PEACE_SEED_PHRASE, FAKE_PASSWORD, mockVaultStateGetter @@ -251,6 +252,10 @@ describe('KeyringManager - Security', () => { mockVaultStateGetter = jest.fn(() => currentVaultState); keyringManager.setVaultStateGetter(mockVaultStateGetter); + // This case exercises creation, so discard the provisioned test wallet. + const storage = (keyringManager as any).storage; + await storage.deleteItem('vault'); + await storage.deleteItem('vault-keys'); await keyringManager.initializeWalletSecurely( PEACE_SEED_PHRASE, FAKE_PASSWORD @@ -279,7 +284,7 @@ describe('KeyringManager - Security', () => { }); mockVaultStateGetter = jest.fn(() => currentVaultState); - keyringManager = await KeyringManager.createInitialized( + keyringManager = await createFreshTestKeyring( PEACE_SEED_PHRASE, FAKE_PASSWORD, mockVaultStateGetter @@ -290,7 +295,6 @@ describe('KeyringManager - Security', () => { const vaultKeys = await mockStorage.get('vault-keys'); if (vaultKeys) { expect(vaultKeys.salt).toBeDefined(); - expect(vaultKeys.hash).toBeDefined(); expect(vaultKeys.salt.length).toBeGreaterThan(0); } }); @@ -307,7 +311,7 @@ describe('KeyringManager - Security', () => { }); mockVaultStateGetter = jest.fn(() => currentVaultState); - keyringManager = await KeyringManager.createInitialized( + keyringManager = await createFreshTestKeyring( PEACE_SEED_PHRASE, FAKE_PASSWORD, mockVaultStateGetter @@ -341,7 +345,7 @@ describe('KeyringManager - Security', () => { cleanVaultState.accounts[KeyringAccountType.Imported] = {}; const cleanVaultStateGetter = jest.fn(() => cleanVaultState); - keyringManager = await KeyringManager.createInitialized( + keyringManager = await createFreshTestKeyring( PEACE_SEED_PHRASE, FAKE_PASSWORD, cleanVaultStateGetter @@ -400,7 +404,7 @@ describe('KeyringManager - Security', () => { }); mockVaultStateGetter = jest.fn(() => currentVaultState); - keyringManager = await KeyringManager.createInitialized( + keyringManager = await createFreshTestKeyring( PEACE_SEED_PHRASE, FAKE_PASSWORD, mockVaultStateGetter @@ -461,7 +465,7 @@ describe('KeyringManager - Security', () => { currentVaultState.accounts[KeyringAccountType.Imported] = {}; mockVaultStateGetter = jest.fn(() => currentVaultState); - keyringManager = await KeyringManager.createInitialized( + keyringManager = await createFreshTestKeyring( PEACE_SEED_PHRASE, FAKE_PASSWORD, mockVaultStateGetter diff --git a/packages/sysweb3-keyring/test/unit/keyring-manager/software-entry.spec.ts b/packages/sysweb3-keyring/test/unit/keyring-manager/software-entry.spec.ts new file mode 100644 index 00000000..4ae1a901 --- /dev/null +++ b/packages/sysweb3-keyring/test/unit/keyring-manager/software-entry.spec.ts @@ -0,0 +1,390 @@ +import { SignTypedDataVersion } from '@metamask/eth-sig-util'; + +import { KeyringCore } from '../../../src/keyring-core'; +import { + SoftwareKeyring, + createSoftwareKeyringHost, + KeyringAccountType, + INetworkType, +} from '../../../src/software'; +import { createVaultPersistence } from '../../../src/storage-core'; +import { EthereumTransactions } from '../../../src/transactions/ethereum'; + +import type { KeyringStoragePort } from '../../../src/software'; + +const mnemonic = + 'abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about'; +const otherMnemonic = + 'legal winner thank year wave sausage worth useful legal winner thank yellow'; +const password = 'software entry synthetic fixture'; + +function memoryStorage() { + const records = new Map(); + const storage: KeyringStoragePort = { + get: jest.fn(async (key) => records.get(key)), + set: jest.fn(async (key, value) => { + records.set(key, value); + }), + deleteItem: jest.fn(async (key) => { + records.delete(key); + }), + createManyIfAbsent: jest.fn(async (items) => { + if (Object.keys(items).some((key) => records.has(key))) return false; + Object.entries(items).forEach(([key, value]) => records.set(key, value)); + return true; + }), + }; + return { storage, records }; +} + +function vaultState() { + return { + activeAccount: { id: 0, type: KeyringAccountType.HDAccount }, + activeNetwork: { + kind: INetworkType.Ethereum, + chainId: 1, + slip44: 60, + label: 'Ethereum', + currency: 'ETH', + url: 'https://offline.invalid', + }, + accounts: { + HDAccount: {}, + Imported: {}, + Ledger: {}, + Trezor: {}, + SmartAccount: {}, + }, + } as any; +} + +it('binds independent software authorities to their own encrypted storage across lock and restart', async () => { + const first = memoryStorage(); + const second = memoryStorage(); + const firstHost = createSoftwareKeyringHost(first.storage); + const secondHost = createSoftwareKeyringHost(second.storage); + const firstState = vaultState(); + const secondState = vaultState(); + const a = new SoftwareKeyring(firstHost); + const b = new SoftwareKeyring(secondHost); + a.setVaultStateGetter(() => firstState); + b.setVaultStateGetter(() => secondState); + try { + firstState.accounts.HDAccount[0] = await a.initializeWalletSecurely( + mnemonic, + password + ); + secondState.accounts.HDAccount[0] = await b.initializeWalletSecurely( + otherMnemonic, + password + ); + expect(firstState.accounts.HDAccount[0].address).not.toBe( + secondState.accounts.HDAccount[0].address + ); + expect(a.ledgerSigner).toBeUndefined(); + expect(a.trezorSigner).toBeUndefined(); + expect(first.records.get('vault')).not.toBe(second.records.get('vault')); + expect(JSON.stringify([...first.records])).not.toContain(mnemonic); + const firstCiphertext = first.records.get('vault'); + const secondCiphertext = second.records.get('vault'); + await a.lockWallet(); + expect(a.isUnlocked()).toBe(false); + expect(b.isUnlocked()).toBe(true); + expect(await a.unlock('incorrect')).toEqual({ canLogin: false }); + expect(await a.unlock(password)).toEqual({ canLogin: true }); + expect(await a.getSeed(password)).toBe(mnemonic); + expect(await b.getSeed(password)).toBe(otherMnemonic); + expect(typeof a.syscoinTransaction.getRecommendedFee).toBe('function'); + expect(first.records.get('vault')).toBe(firstCiphertext); + expect(second.records.get('vault')).toBe(secondCiphertext); + const restarted = new SoftwareKeyring(firstHost); + restarted.setVaultStateGetter(() => firstState); + try { + expect(await restarted.unlock(password)).toEqual({ canLogin: true }); + expect(await restarted.getSeed(password)).toBe(mnemonic); + expect(() => restarted.setStorage({})).toThrow( + 'Storage replacement is unavailable' + ); + } finally { + await restarted.destroy(); + } + } finally { + await a.destroy(); + await b.destroy(); + } +}); + +it('reuses the explicitly injected Syscoin signer ports after locking and unlocking', async () => { + const { storage } = memoryStorage(); + const ledger = jest.fn(); + const state = vaultState(); + const keyring = new KeyringCore({ + authority: Object.freeze({}), + storage, + vaultPersistence: createVaultPersistence(storage), + ledgerSigner: undefined, + trezorSigner: undefined, + syscoinHardwareSigners: { ledger }, + }); + keyring.setVaultStateGetter(() => state); + try { + state.accounts.HDAccount[0] = await keyring.initializeWalletSecurely( + mnemonic, + password + ); + const before = keyring.syscoinTransaction; + await keyring.lockWallet(); + expect(await keyring.unlock(password)).toEqual({ canLogin: true }); + expect(keyring.syscoinTransaction).not.toBe(before); + expect((keyring.syscoinTransaction as any).hardwareSigners.ledger).toBe( + ledger + ); + } finally { + await keyring.destroy(); + } +}); + +const missingHardwareCases = [ + { name: 'Ledger account', type: KeyringAccountType.Ledger, metadata: {} }, + { name: 'Trezor account', type: KeyringAccountType.Trezor, metadata: {} }, + { + name: 'Ledger metadata', + type: KeyringAccountType.HDAccount, + metadata: { isLedgerWallet: true }, + }, + { + name: 'Trezor metadata', + type: KeyringAccountType.HDAccount, + metadata: { isTrezorWallet: true }, + }, +]; + +describe.each(missingHardwareCases)( + '$name without a host signer', + ({ type, metadata }) => { + const address = `0x${'11'.repeat(20)}`; + let sdk: EthereumTransactions; + let getKey: jest.Mock; + let getNetwork: jest.Mock; + beforeEach(() => { + getKey = jest.fn(() => { + throw new Error('Private key getter must not run'); + }); + getNetwork = jest.fn(() => { + throw new Error('Provider must not initialize'); + }); + sdk = new EthereumTransactions( + getNetwork, + getKey, + () => ({ + activeAccountId: 0, + activeAccountType: type, + activeNetwork: {} as any, + accounts: { [type]: { 0: { address, ...metadata } } } as any, + }), + undefined, + undefined + ); + }); + const operations: Array< + [ + string, + (sdk: EthereumTransactions) => Promise + ] + > = [ + [ + 'typed data', + (sdk) => sdk.signTypedData(address, {} as any, SignTypedDataVersion.V4), + ], + ['personal message', (sdk) => sdk.signPersonalMessage(['0x11', address])], + ['eth_sign', (sdk) => sdk.ethSign([address, '0x11'])], + ['transaction', (sdk) => sdk.sendFormattedTransaction({} as any)], + ['ERC20', (sdk) => sdk.sendSignedErc20Transaction({} as any)], + ['ERC721', (sdk) => sdk.sendSignedErc721Transaction({} as any)], + ['ERC1155', (sdk) => sdk.sendSignedErc1155Transaction({} as any)], + [ + 'cancellation', + (sdk) => + sdk.cancelSentTransaction('0x11', false, undefined, { + approvedMaximumFee: '10', + assertCurrentContext: () => undefined, + validateOriginal: () => undefined, + }), + ], + [ + 'replacement', + (sdk) => + sdk.sendTransactionWithEditedFee('0x11', false, { + approvedMaximumFee: '10', + }), + ], + ]; + it.each(operations)( + 'rejects %s before private keys or provider access', + async (_name, operation) => { + await expect(operation(sdk)).rejects.toMatchObject({ + code: 'HARDWARE_SIGNER_UNAVAILABLE', + }); + expect(getKey).not.toHaveBeenCalled(); + expect(getNetwork).not.toHaveBeenCalled(); + } + ); + } +); + +it.each([KeyringAccountType.Ledger, KeyringAccountType.Trezor])( + 'rejects %s address display without a device', + async (type) => { + const state = vaultState(); + state.activeAccount.type = type; + const keyring = new SoftwareKeyring( + createSoftwareKeyringHost(memoryStorage().storage) + ); + keyring.setVaultStateGetter(() => state); + await expect( + keyring.ethereumTransaction.verifyUtxoAddress(0, 'sys', 57) + ).rejects.toMatchObject({ code: 'HARDWARE_SIGNER_UNAVAILABLE' }); + await keyring.destroy(); + } +); + +it('rejects forged or mixed software hosts before any storage work', () => { + const first = memoryStorage(); + const second = memoryStorage(); + expect( + () => + new SoftwareKeyring({ + storage: first.storage, + vaultPersistence: createVaultPersistence(second.storage), + } as any) + ).toThrow('Invalid software keyring host'); + expect(() => new SoftwareKeyring({} as any)).toThrow( + 'Invalid software keyring host' + ); + expect(first.storage.get).not.toHaveBeenCalled(); + expect(first.storage.set).not.toHaveBeenCalled(); + expect(second.storage.get).not.toHaveBeenCalled(); + expect(second.storage.set).not.toHaveBeenCalled(); +}); + +it('rejects cross-authority session transfer without changing either session, and allows same-host transfers', async () => { + const firstHost = createSoftwareKeyringHost(memoryStorage().storage); + const secondHost = createSoftwareKeyringHost(memoryStorage().storage); + const a = new SoftwareKeyring(firstHost); + const b = new SoftwareKeyring(secondHost); + const sibling = new SoftwareKeyring(firstHost); + const aState = vaultState(); + const bState = vaultState(); + a.setVaultStateGetter(() => aState); + b.setVaultStateGetter(() => bState); + sibling.setVaultStateGetter(() => aState); + try { + aState.accounts.HDAccount[0] = await a.initializeWalletSecurely( + mnemonic, + password + ); + bState.accounts.HDAccount[0] = await b.initializeWalletSecurely( + otherMnemonic, + password + ); + const sourcePassword = (a as any).sessionPassword; + const sourceMnemonic = (a as any).sessionMnemonic; + expect(() => + b.receiveSessionOwnership(sourcePassword, sourceMnemonic) + ).toThrow('Direct session injection is unavailable'); + expect(() => + sibling.receiveSessionOwnership(sourcePassword, sourceMnemonic) + ).toThrow('Direct session injection is unavailable'); + expect((a as any).sessionPassword).toBe(sourcePassword); + expect(() => a.transferSessionTo(b)).toThrow( + 'different wallet authorities' + ); + expect(a.isUnlocked()).toBe(true); + expect(b.isUnlocked()).toBe(true); + expect(await a.getSeed(password)).toBe(mnemonic); + expect(await b.getSeed(password)).toBe(otherMnemonic); + a.transferSessionTo(sibling); + expect(a.isUnlocked()).toBe(false); + expect(sibling.isUnlocked()).toBe(true); + expect(await sibling.getSeed(password)).toBe(mnemonic); + sibling.transferSessionTo(a); + expect(a.isUnlocked()).toBe(true); + expect(sibling.isUnlocked()).toBe(false); + } finally { + await a.destroy(); + await b.destroy(); + await sibling.destroy(); + } +}); + +it('cannot rebind a software host through the legacy storage setter', async () => { + const first = memoryStorage(); + const setClient = jest.fn(); + first.storage.setClient = setClient; + const keyring = new SoftwareKeyring(createSoftwareKeyringHost(first.storage)); + const state = vaultState(); + keyring.setVaultStateGetter(() => state); + try { + state.accounts.HDAccount[0] = await keyring.initializeWalletSecurely( + mnemonic, + password + ); + const before = first.records.get('vault'); + expect(() => keyring.setStorage({})).toThrow( + 'Storage replacement is unavailable' + ); + expect(setClient).not.toHaveBeenCalled(); + expect(first.records.get('vault')).toBe(before); + expect(keyring.isUnlocked()).toBe(true); + expect(await keyring.getSeed(password)).toBe(mnemonic); + } finally { + await keyring.destroy(); + } +}); + +it.each([false, true])( + 'rejects a reused authority token with mismatched storage or persistence (same storage: %s)', + async (sameStorage) => { + const first = memoryStorage(); + const second = sameStorage ? first : memoryStorage(); + const authority = Object.freeze({}); + const a = new KeyringCore({ + authority, + storage: first.storage, + vaultPersistence: createVaultPersistence(first.storage), + ledgerSigner: undefined, + trezorSigner: undefined, + }); + const b = new KeyringCore({ + authority, + storage: second.storage, + vaultPersistence: createVaultPersistence(second.storage), + ledgerSigner: undefined, + trezorSigner: undefined, + }); + const state = vaultState(); + a.setVaultStateGetter(() => state); + b.setVaultStateGetter(() => state); + try { + state.accounts.HDAccount[0] = await a.initializeWalletSecurely( + mnemonic, + password + ); + if (sameStorage) + expect(await b.unlock(password)).toEqual({ canLogin: true }); + else await b.initializeWalletSecurely(otherMnemonic, password); + expect(() => a.transferSessionTo(b)).toThrow( + 'different wallet authorities' + ); + expect(a.isUnlocked()).toBe(true); + expect(b.isUnlocked()).toBe(true); + expect(await a.getSeed(password)).toBe(mnemonic); + expect(await b.getSeed(password)).toBe( + sameStorage ? mnemonic : otherMnemonic + ); + } finally { + await a.destroy(); + await b.destroy(); + } + } +); diff --git a/packages/sysweb3-keyring/test/unit/keyring-manager/software-indexed-hd.spec.ts b/packages/sysweb3-keyring/test/unit/keyring-manager/software-indexed-hd.spec.ts new file mode 100644 index 00000000..f78048cb --- /dev/null +++ b/packages/sysweb3-keyring/test/unit/keyring-manager/software-indexed-hd.spec.ts @@ -0,0 +1,209 @@ +import { + SoftwareKeyring, + createSoftwareKeyringHost, + INetworkType, + KeyringAccountType, +} from '../../../src/software'; + +import type { KeyringStoragePort } from '../../../src/software'; + +const phrase = + 'abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about'; +const password = 'public indexed HD fixture password'; +const current = () => undefined; +async function fixture() { + const records = new Map(); + const storage: KeyringStoragePort = { + get: jest.fn(async (key) => records.get(key)), + set: jest.fn(async (key, value) => { + records.set(key, value); + }), + deleteItem: jest.fn(async (key) => { + records.delete(key); + }), + createManyIfAbsent: jest.fn(async (items) => { + if (Object.keys(items).some((key) => records.has(key))) return false; + Object.entries(items).forEach(([key, value]) => records.set(key, value)); + return true; + }), + }; + const state: any = { + activeAccount: { id: 0, type: KeyringAccountType.HDAccount }, + activeNetwork: { + kind: INetworkType.Ethereum, + chainId: 1, + slip44: 60, + currency: 'ETH', + label: 'Ethereum', + url: 'https://offline.invalid', + }, + accounts: { + HDAccount: {}, + Imported: {}, + Ledger: {}, + Trezor: {}, + SmartAccount: {}, + }, + }; + const keyring = new SoftwareKeyring(createSoftwareKeyringHost(storage)); + keyring.setVaultStateGetter(() => state); + await keyring.initializeSession(phrase, password); + jest.mocked(storage.get).mockClear(); + jest.mocked(storage.set).mockClear(); + jest.mocked(storage.createManyIfAbsent).mockClear(); + const derive = jest.spyOn(keyring as any, 'setDerivedWeb3Accounts'); + return { keyring, state, storage, derive }; +} + +afterEach(() => jest.restoreAllMocks()); + +it('derives exact account 0/1 vectors without installing accounts, storage or network access', async () => { + const f = await fixture(); + const oldFetch = globalThis.fetch; + const fetch = jest.fn(() => { + throw Error('Unexpected network'); + }); + globalThis.fetch = fetch as typeof globalThis.fetch; + try { + const first = await f.keyring.deriveEvmHdRuntimeAccount( + { index: 0 }, + { assertCurrent: current } + ); + const second = await f.keyring.deriveEvmHdRuntimeAccount( + { index: 1 }, + { assertCurrent: current } + ); + expect(first.address).toBe('0x9858EfFD232B4033E47d90003D41EC34EcaEda94'); + expect(second.address).toBe('0x6Fac4D18c912343BF86fa7049364Dd4E424Ab9C0'); + expect(first.id).toBe(0); + expect(second.id).toBe(1); + expect(second.label).toBe('Account 2'); + expect(second.xpub).toMatch(/^0x04[0-9a-fA-F]{128}$/); + expect(second.xprv).toBeTruthy(); + expect(second).not.toHaveProperty('privateKey'); + expect(JSON.stringify(second)).not.toContain(phrase); + expect(JSON.stringify(second)).not.toContain(password); + expect(f.state.accounts.HDAccount).toEqual({}); + expect(f.state.activeAccount.id).toBe(0); + expect(f.storage.get).not.toHaveBeenCalled(); + expect(f.storage.set).not.toHaveBeenCalled(); + expect(f.storage.createManyIfAbsent).not.toHaveBeenCalled(); + expect(fetch).not.toHaveBeenCalled(); + } finally { + globalThis.fetch = oldFetch; + await f.keyring.destroy(); + } +}); + +it.each([-1, 0x80000000, 1.1, NaN, Infinity, '1', null, undefined])( + 'rejects invalid index %p before derivation', + async (index) => { + const f = await fixture(); + try { + await expect( + f.keyring.deriveEvmHdRuntimeAccount({ index } as any, { + assertCurrent: current, + }) + ).rejects.toThrow('Invalid Ethereum HD account index'); + expect(f.derive).not.toHaveBeenCalled(); + } finally { + await f.keyring.destroy(); + } + } +); + +it('rejects extra fields and accessor-backed index before derivation', async () => { + const f = await fixture(); + try { + const getter = jest.fn(() => 1); + const input = Object.defineProperty({}, 'index', { + enumerable: true, + get: getter, + }); + await expect( + f.keyring.deriveEvmHdRuntimeAccount(input as any, { + assertCurrent: current, + }) + ).rejects.toThrow(); + await expect( + f.keyring.deriveEvmHdRuntimeAccount( + { index: 1, path: "m/44'/1'/0'" } as any, + { assertCurrent: current } + ) + ).rejects.toThrow(); + expect(getter).not.toHaveBeenCalled(); + expect(f.derive).not.toHaveBeenCalled(); + } finally { + await f.keyring.destroy(); + } +}); + +it.each(['locked', 'kind', 'slip44'])( + 'rejects %s context before deriving', + async (kind) => { + const f = await fixture(); + try { + if (kind === 'locked') await f.keyring.lockWallet(); + else if (kind === 'kind') + f.state.activeNetwork.kind = INetworkType.Syscoin; + else f.state.activeNetwork.slip44 = 57; + await expect( + f.keyring.deriveEvmHdRuntimeAccount( + { index: 1 }, + { assertCurrent: current } + ) + ).rejects.toThrow('context changed'); + expect(f.derive).not.toHaveBeenCalled(); + } finally { + await f.keyring.destroy(); + } + } +); + +it('rejects an asynchronous host guard before deriving', async () => { + const f = await fixture(); + try { + await expect( + f.keyring.deriveEvmHdRuntimeAccount( + { index: 1 }, + { + assertCurrent: async () => { + throw Error('stale'); + }, + } + ) + ).rejects.toThrow('synchronously'); + expect(f.derive).not.toHaveBeenCalled(); + } finally { + await f.keyring.destroy(); + } +}); + +it.each(['selection', 'network', 'lock'])( + 'does not release a derived result after %s changes', + async (kind) => { + const f = await fixture(); + try { + let calls = 0; + await expect( + f.keyring.deriveEvmHdRuntimeAccount( + { index: 1 }, + { + assertCurrent: () => { + calls++; + if (calls === 2) { + if (kind === 'selection') f.state.activeAccount.id = 1; + else if (kind === 'network') + f.state.activeNetwork.url = 'https://changed.invalid'; + else void f.keyring.lockWallet(); + } + }, + } + ) + ).rejects.toThrow('context changed'); + expect(f.derive).toHaveBeenCalledTimes(1); + } finally { + await f.keyring.destroy(); + } + } +); diff --git a/packages/sysweb3-keyring/test/unit/keyring-manager/software-utxo-account.spec.ts b/packages/sysweb3-keyring/test/unit/keyring-manager/software-utxo-account.spec.ts new file mode 100644 index 00000000..444eb1be --- /dev/null +++ b/packages/sysweb3-keyring/test/unit/keyring-manager/software-utxo-account.spec.ts @@ -0,0 +1,265 @@ +jest.resetModules(); +jest.unmock('syscoinjs-lib'); +(global as any).window.location = { href: 'http://localhost/' }; + +import { HDNodeWallet } from 'ethers/wallet'; + +import { parseBip84PublicAccount } from '../../../src/public-bip84'; +import { + SoftwareKeyring, + createSoftwareKeyringHost, + INetworkType, + KeyringAccountType, +} from '../../../src/software'; + +import type { KeyringStoragePort } from '../../../src/software'; + +const phrase = + 'abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about'; +const password = 'public BIP84 derivation fixture password'; +const noop = () => undefined; +async function fixture(coin: 'bitcoin' | 'syscoin' = 'bitcoin') { + const records = new Map(); + const storage: KeyringStoragePort = { + get: jest.fn(async (key) => records.get(key)), + set: jest.fn(async (key, value) => { + records.set(key, value); + }), + deleteItem: jest.fn(async (key) => { + records.delete(key); + }), + createManyIfAbsent: jest.fn(async (items) => { + if (Object.keys(items).some((key) => records.has(key))) return false; + Object.entries(items).forEach(([key, value]) => records.set(key, value)); + return true; + }), + }; + const state: any = { + activeAccount: { id: 0, type: KeyringAccountType.HDAccount }, + activeNetwork: { + kind: INetworkType.Syscoin, + chainId: coin === 'bitcoin' ? 0 : 57, + slip44: coin === 'bitcoin' ? 0 : 57, + currency: coin === 'bitcoin' ? 'btc' : 'sys', + label: coin, + url: 'https://offline.invalid', + }, + accounts: { + HDAccount: {}, + Imported: {}, + Ledger: {}, + Trezor: {}, + SmartAccount: {}, + }, + }; + const keyring = new SoftwareKeyring(createSoftwareKeyringHost(storage)); + keyring.setVaultStateGetter(() => state); + await keyring.initializeSession(phrase, password); + const request = { + network: { network: coin, endpoint: state.activeNetwork.url }, + accountIndex: 0, + }; + for (const fn of [ + storage.get, + storage.set, + storage.deleteItem, + storage.createManyIfAbsent!, + ]) + jest.mocked(fn).mockClear(); + return { records, storage, state, keyring, request }; +} + +it.each(['bitcoin', 'syscoin'] as const)( + 'derives exact %s account 0 and nonzero vectors with no catalogue/storage/network mutation', + async (coin) => { + const f = await fixture(coin); + const before = JSON.stringify([...f.records]); + const network = JSON.stringify(f.state); + const fetch = jest.spyOn(global, 'fetch').mockImplementation(() => { + throw Error('No network'); + }); + try { + for (const accountIndex of [0, 2]) { + const result = await f.keyring.deriveBip84HdPublicAccount( + { ...f.request, accountIndex }, + { assertCurrent: noop } + ); + const expected = HDNodeWallet.fromPhrase( + phrase, + undefined, + `m/84'/${coin === 'bitcoin' ? 0 : 57}'/${accountIndex}'` + ).neuter().extendedKey; + expect(result.account).toEqual( + parseBip84PublicAccount({ network: coin, accountKey: expected }) + ); + expect(result.receive.branch).toBe(0); + expect(result.receive.index).toBe(0); + expect(result.receive.account).toEqual(result.account); + expect(Object.isFrozen(result)).toBe(true); + expect(Object.isFrozen(result.account)).toBe(true); + expect(Object.isFrozen(result.receive)).toBe(true); + expect(JSON.stringify(result)).not.toContain(phrase); + expect(JSON.stringify(result)).not.toContain(password); + expect(result).not.toHaveProperty('xprv'); + expect(result).not.toHaveProperty('privateKey'); + } + expect(JSON.stringify(f.state)).toBe(network); + expect(JSON.stringify([...f.records])).toBe(before); + expect(f.storage.get).not.toHaveBeenCalled(); + expect(f.storage.set).not.toHaveBeenCalled(); + expect(f.storage.deleteItem).not.toHaveBeenCalled(); + expect(f.storage.createManyIfAbsent).not.toHaveBeenCalled(); + expect(fetch).not.toHaveBeenCalled(); + } finally { + fetch.mockRestore(); + await f.keyring.destroy(); + } + } +); + +it('rejects wrong coin, endpoint and SLIP44 without silently deriving another path', async () => { + const f = await fixture(); + try { + await expect( + f.keyring.deriveBip84HdPublicAccount( + { ...f.request, network: { ...f.request.network, network: 'syscoin' } }, + { assertCurrent: noop } + ) + ).rejects.toMatchObject({ code: 'CANCELLED' }); + await expect( + f.keyring.deriveBip84HdPublicAccount( + { + ...f.request, + network: { ...f.request.network, endpoint: 'https://other.invalid' }, + }, + { assertCurrent: noop } + ) + ).rejects.toMatchObject({ code: 'CANCELLED' }); + f.state.activeNetwork.slip44 = 57; + await expect( + f.keyring.deriveBip84HdPublicAccount(f.request, { assertCurrent: noop }) + ).rejects.toMatchObject({ code: 'CANCELLED' }); + } finally { + await f.keyring.destroy(); + } +}); + +it.each([ + KeyringAccountType.Imported, + KeyringAccountType.Ledger, + KeyringAccountType.Trezor, + KeyringAccountType.SmartAccount, +])('rejects a selected %s kind', async (type) => { + const f = await fixture(); + f.state.activeAccount.type = type; + try { + await expect( + f.keyring.deriveBip84HdPublicAccount(f.request, { assertCurrent: noop }) + ).rejects.toMatchObject({ code: 'CANCELLED' }); + } finally { + await f.keyring.destroy(); + } +}); + +it.each([-1, 0x80000000, 0.5, NaN, Infinity, '0', null])( + 'rejects malformed account index %p', + async (accountIndex) => { + const f = await fixture(); + try { + await expect( + f.keyring.deriveBip84HdPublicAccount( + { ...f.request, accountIndex } as any, + { assertCurrent: noop } + ) + ).rejects.toMatchObject({ code: 'INVALID_REQUEST' }); + } finally { + await f.keyring.destroy(); + } + } +); + +it('rejects a locked or disposed keyring and a reentrant operation without wedging future derivation', async () => { + const f = await fixture(); + let nested: Promise | undefined; + try { + await f.keyring.deriveBip84HdPublicAccount(f.request, { + assertCurrent() { + if (!nested) + nested = f.keyring + .deriveBip84HdPublicAccount(f.request, { assertCurrent: noop }) + .catch((error) => error); + }, + }); + expect(await nested).toMatchObject({ code: 'BUSY' }); + await f.keyring.deriveBip84HdPublicAccount(f.request, { + assertCurrent: noop, + }); + await f.keyring.lockWallet(); + await expect( + f.keyring.deriveBip84HdPublicAccount(f.request, { assertCurrent: noop }) + ).rejects.toMatchObject({ code: 'CANCELLED' }); + await f.keyring.destroy(); + await expect( + f.keyring.deriveBip84HdPublicAccount(f.request, { assertCurrent: noop }) + ).rejects.toMatchObject({ code: 'CANCELLED' }); + } finally { + await f.keyring.destroy(); + } +}); + +it('rejects Promise/value guards and a host-detected A-B-A revision change', async () => { + const f = await fixture(); + try { + for (const result of [ + Promise.resolve(), + Promise.reject(new Error('not authority')), + true, + null, + ]) + await expect( + f.keyring.deriveBip84HdPublicAccount(f.request, { + assertCurrent: () => result, + } as any) + ).rejects.toMatchObject({ code: 'CANCELLED' }); + let revision = 0; + await expect( + f.keyring.deriveBip84HdPublicAccount(f.request, { + assertCurrent() { + const initial = revision; + f.state.activeNetwork.chainId = 57; + revision++; + f.state.activeNetwork.chainId = 0; + revision++; + if (revision !== initial) throw Error('revoked'); + }, + }) + ).rejects.toMatchObject({ code: 'CANCELLED' }); + await f.keyring.deriveBip84HdPublicAccount(f.request, { + assertCurrent: noop, + }); + } finally { + await f.keyring.destroy(); + } +}); + +it('detects guard-side account/lock mutation and does not let caller request mutation retarget derivation', async () => { + const f = await fixture(); + try { + const mutable: any = { ...f.request, accountIndex: 2 }; + const result = await f.keyring.deriveBip84HdPublicAccount(mutable, { + assertCurrent() { + mutable.accountIndex = 3; + }, + }); + expect(result.accountIndex).toBe(2); + await expect( + f.keyring.deriveBip84HdPublicAccount(f.request, { + assertCurrent() { + void f.keyring.lockWallet(); + }, + }) + ).rejects.toMatchObject({ code: 'CANCELLED' }); + } finally { + await f.keyring.destroy(); + } +}); diff --git a/packages/sysweb3-keyring/test/unit/keyring-manager/state-management.spec.ts b/packages/sysweb3-keyring/test/unit/keyring-manager/state-management.spec.ts index 046de391..3d97cfe1 100644 --- a/packages/sysweb3-keyring/test/unit/keyring-manager/state-management.spec.ts +++ b/packages/sysweb3-keyring/test/unit/keyring-manager/state-management.spec.ts @@ -1,7 +1,8 @@ +import { INetworkType, INetwork } from '@sidhujag/sysweb3-network'; + import { KeyringManager, KeyringAccountType } from '../../../src'; import { FAKE_PASSWORD, PEACE_SEED_PHRASE } from '../../helpers/constants'; -import { setupMocks } from '../../helpers/setup'; -import { INetworkType, INetwork } from '@pollum-io/sysweb3-network'; +import { createFreshTestKeyring, setupMocks } from '../../helpers/setup'; describe('KeyringManager - State Management', () => { let keyringManager: KeyringManager; @@ -74,7 +75,7 @@ describe('KeyringManager - State Management', () => { activeNetwork: mockVaultState.networks.syscoin[57], }; - keyringManager = await KeyringManager.createInitialized( + keyringManager = await createFreshTestKeyring( PEACE_SEED_PHRASE, FAKE_PASSWORD, mockVaultStateGetter @@ -94,7 +95,7 @@ describe('KeyringManager - State Management', () => { activeNetwork: mockVaultState.networks.ethereum[1], }; - keyringManager = await KeyringManager.createInitialized( + keyringManager = await createFreshTestKeyring( PEACE_SEED_PHRASE, FAKE_PASSWORD, mockVaultStateGetter @@ -124,7 +125,7 @@ describe('KeyringManager - State Management', () => { activeNetwork: mockVaultState.networks.ethereum[1], }; - keyringManager = await KeyringManager.createInitialized( + keyringManager = await createFreshTestKeyring( PEACE_SEED_PHRASE, FAKE_PASSWORD, mockVaultStateGetter @@ -176,7 +177,7 @@ describe('KeyringManager - State Management', () => { }; const evmVaultGetter = jest.fn(() => evmVaultState); - const evmKeyring = await KeyringManager.createInitialized( + const evmKeyring = await createFreshTestKeyring( PEACE_SEED_PHRASE, FAKE_PASSWORD, evmVaultGetter @@ -189,7 +190,7 @@ describe('KeyringManager - State Management', () => { }; const utxoVaultGetter = jest.fn(() => utxoVaultState); - const utxoKeyring = await KeyringManager.createInitialized( + const utxoKeyring = await createFreshTestKeyring( PEACE_SEED_PHRASE, FAKE_PASSWORD, utxoVaultGetter @@ -208,7 +209,7 @@ describe('KeyringManager - State Management', () => { }); it('should share session data between keyrings', async () => { - const keyring1 = await KeyringManager.createInitialized( + const keyring1 = await createFreshTestKeyring( PEACE_SEED_PHRASE, FAKE_PASSWORD, mockVaultStateGetter @@ -239,7 +240,7 @@ describe('KeyringManager - State Management', () => { describe('State Recovery', () => { it('should handle state recovery after errors', async () => { - keyringManager = await KeyringManager.createInitialized( + keyringManager = await createFreshTestKeyring( PEACE_SEED_PHRASE, FAKE_PASSWORD, mockVaultStateGetter @@ -267,7 +268,7 @@ describe('KeyringManager - State Management', () => { }); it('should handle network switching rollback on failure', async () => { - keyringManager = await KeyringManager.createInitialized( + keyringManager = await createFreshTestKeyring( PEACE_SEED_PHRASE, FAKE_PASSWORD, mockVaultStateGetter @@ -300,7 +301,7 @@ describe('KeyringManager - State Management', () => { describe('State Validation', () => { it('should validate account access through vault state', async () => { - keyringManager = await KeyringManager.createInitialized( + keyringManager = await createFreshTestKeyring( PEACE_SEED_PHRASE, FAKE_PASSWORD, mockVaultStateGetter @@ -321,7 +322,7 @@ describe('KeyringManager - State Management', () => { }); it('should validate active account through vault state', async () => { - keyringManager = await KeyringManager.createInitialized( + keyringManager = await createFreshTestKeyring( PEACE_SEED_PHRASE, FAKE_PASSWORD, mockVaultStateGetter diff --git a/packages/sysweb3-keyring/test/unit/keyring-manager/storage-adapter.spec.ts b/packages/sysweb3-keyring/test/unit/keyring-manager/storage-adapter.spec.ts new file mode 100644 index 00000000..9687589b --- /dev/null +++ b/packages/sysweb3-keyring/test/unit/keyring-manager/storage-adapter.spec.ts @@ -0,0 +1,348 @@ +import { installNativeStorageTestClient } from '../../helpers/native-storage-locks'; + +import type { IKeyValueDb } from '../../../../sysweb3-core/src'; + +const { sysweb3Di } = jest.requireActual('@sidhujag/sysweb3-core'); + +const deferred = () => { + let resolve!: () => void; + let reject!: (error: Error) => void; + const promise = new Promise((yes, no) => { + resolve = yes; + reject = no; + }); + return { promise, resolve, reject }; +}; + +describe('real core asynchronous storage adapter', () => { + const db: IKeyValueDb = sysweb3Di.getStateStorageDb(); + + afterEach(() => db.setClient()); + + it.each(['set', 'remove'])( + 'preserves Chrome %s completion and rejection', + async (method) => { + const write = deferred(); + const client = { [method]: jest.fn(() => write.promise) }; + db.setClient(client as any); + const result = + method === 'set' + ? db.set('vault', 'ciphertext') + : db.deleteItem('vault'); + expect(result).toBe(write.promise); + let settled = false; + const observed = Promise.resolve(result).finally(() => { + settled = true; + }); + await Promise.resolve(); + expect(settled).toBe(false); + const error = new Error('Chrome storage rejected'); + write.reject(error); + await expect(observed).rejects.toBe(error); + expect(client[method]).toHaveBeenCalledWith( + method === 'set' ? { 'sysweb3-vault': 'ciphertext' } : 'sysweb3-vault' + ); + } + ); + + it.each(['setItem', 'removeItem'])( + 'preserves asynchronous %s adapters', + async (method) => { + const write = deferred(); + const client = { [method]: jest.fn(() => write.promise) }; + db.setClient(client as any); + const result = + method === 'setItem' + ? db.set('vault', 'ciphertext') + : db.deleteItem('vault'); + expect(result).toBe(write.promise); + write.resolve(); + await expect(result).resolves.toBeUndefined(); + } + ); + + it('keeps synchronous localStorage clients synchronous', () => { + const client = { + setItem: jest.fn(), + removeItem: jest.fn(), + getItem: jest.fn(), + }; + db.setClient(client); + expect(db.set('vault', { value: 1 })).toBeUndefined(); + expect(client.setItem).toHaveBeenCalledWith('sysweb3-vault', '{"value":1}'); + expect(db.deleteItem('vault')).toBeUndefined(); + expect(client.removeItem).toHaveBeenCalledWith('sysweb3-vault'); + }); + + it('commits a prefixed batch through one native call and awaits rejection', async () => { + const write = deferred(); + const client = { set: jest.fn(() => write.promise) }; + db.setClient(client as any); + db.setPrefix('test'); + try { + const result = db.setMany({ + vault: 'ciphertext', + 'vault-keys': { salt: 'salt' }, + }); + expect(result).toBe(write.promise); + expect(client.set).toHaveBeenCalledTimes(1); + expect(client.set).toHaveBeenCalledWith({ + 'test-vault': 'ciphertext', + 'test-vault-keys': { salt: 'salt' }, + }); + const error = new Error('atomic write rejected'); + write.reject(error); + await expect(result).rejects.toBe(error); + } finally { + db.setPrefix(''); + } + }); + + it('rejects a sequential-only adapter before writing any batch item', () => { + const client = { + setItem: jest.fn(), + getItem: jest.fn(), + removeItem: jest.fn(), + }; + db.setClient(client); + expect(() => + db.setMany({ vault: 'ciphertext', 'vault-keys': { salt: 'salt' } }) + ).toThrow('Storage adapter does not support atomic batch writes'); + expect(client.setItem).not.toHaveBeenCalled(); + }); + + it('supports an atomic batch in the built-in memory client', async () => { + const { sysweb3Di: memoryDi } = jest.requireActual( + '@sidhujag/sysweb3-core' + ); + jest.resetModules(); + const { sysweb3Di: freshDi } = jest.requireActual('@sidhujag/sysweb3-core'); + const memoryDb = freshDi.getStateStorageDb(); + expect(freshDi).not.toBe(memoryDi); + expect( + memoryDb.setMany({ vault: 'ciphertext', 'vault-keys': { salt: 'salt' } }) + ).toBeUndefined(); + await expect(memoryDb.get('vault')).resolves.toBe('ciphertext'); + await expect(memoryDb.get('vault-keys')).resolves.toEqual({ salt: 'salt' }); + }); + + describe('conditional creation across independent clients', () => { + let nativeStorage: + | ReturnType + | undefined; + + const independentDb = (): IKeyValueDb => { + let result!: IKeyValueDb; + jest.isolateModules(() => { + result = jest + .requireActual('@sidhujag/sysweb3-core') + .sysweb3Di.getStateStorageDb(); + }); + return result; + }; + + afterEach(() => { + db.setPrefix(''); + nativeStorage?.restore(); + nativeStorage = undefined; + }); + + it('serializes separate module instances through the same native Web Lock', async () => { + const records: Record = {}; + const entered = deferred(); + const release = deferred(); + const client = { + get: jest.fn(async (keys: string[]) => + Object.fromEntries(keys.map((key) => [key, records[key]])) + ), + set: jest.fn(async (items: Record) => { + entered.resolve(); + await release.promise; + Object.assign(records, items); + }), + }; + nativeStorage = installNativeStorageTestClient(client); + const first = independentDb(); + const second = independentDb(); + first.setClient(client as any); + second.setClient(client as any); + const initial = first.createManyIfAbsent({ + vault: 'first ciphertext', + 'vault-keys': { salt: 'first salt' }, + }); + await entered.promise; + const competing = second.createManyIfAbsent({ + vault: 'second ciphertext', + 'vault-keys': { salt: 'second salt' }, + }); + await Promise.resolve(); + expect(client.get).toHaveBeenCalledTimes(1); + expect(client.set).toHaveBeenCalledTimes(1); + expect(records).toEqual({}); + release.resolve(); + await expect(initial).resolves.toBe(true); + await expect(competing).resolves.toBe(false); + expect(records).toEqual({ + 'sysweb3-vault': 'first ciphertext', + 'sysweb3-vault-keys': { salt: 'first salt' }, + }); + expect(nativeStorage.request).toHaveBeenNthCalledWith( + 1, + 'sysweb3:create:sysweb3-', + { mode: 'exclusive' }, + expect.any(Function) + ); + expect(nativeStorage.request).toHaveBeenCalledTimes(2); + }); + + it.each([false, true])( + 'releases the lock after a failed write (already committed: %p)', + async (commit) => { + const records: Record = {}; + const client = { + get: jest.fn(async (keys: string[]) => + Object.fromEntries(keys.map((key) => [key, records[key]])) + ), + set: jest.fn(async (items: Record) => { + Object.assign(records, items); + }), + }; + nativeStorage = installNativeStorageTestClient(client); + db.setClient(client as any); + client.set.mockImplementationOnce(async (items) => { + if (commit) Object.assign(records, items); + throw new Error('lost write acknowledgement'); + }); + await expect( + db.createManyIfAbsent({ vault: 'first', 'vault-keys': { salt: 'a' } }) + ).rejects.toThrow('lost write acknowledgement'); + await expect( + db.createManyIfAbsent({ + vault: 'second', + 'vault-keys': { salt: 'b' }, + }) + ).resolves.toBe(!commit); + expect(records['sysweb3-vault']).toBe(commit ? 'first' : 'second'); + } + ); + + it.each(['', false, 0, 'ciphertext'])( + 'preserves an existing native record %p without writing', + async (value) => { + const client = { + get: jest.fn(async () => ({ 'sysweb3-vault': value })), + set: jest.fn(), + }; + nativeStorage = installNativeStorageTestClient(client); + db.setClient(client as any); + await expect( + db.createManyIfAbsent({ vault: 'new', 'vault-keys': { salt: 'new' } }) + ).resolves.toBe(false); + expect(client.set).not.toHaveBeenCalled(); + } + ); + + it('fails closed when a native client has no Web Locks support', async () => { + const client = { get: jest.fn(), set: jest.fn() }; + nativeStorage = installNativeStorageTestClient(client); + Object.defineProperty(globalThis, 'navigator', { + configurable: true, + value: {}, + }); + db.setClient(client as any); + await expect(db.createManyIfAbsent({ vault: 'new' })).rejects.toThrow(); + expect(client.get).not.toHaveBeenCalled(); + expect(client.set).not.toHaveBeenCalled(); + }); + + it('does not assume an arbitrary get/set backend shares this origin lock', async () => { + nativeStorage = installNativeStorageTestClient({}); + const remote = { get: jest.fn(), set: jest.fn() }; + db.setClient(remote as any); + await expect(db.createManyIfAbsent({ vault: 'new' })).rejects.toThrow(); + expect(remote.get).not.toHaveBeenCalled(); + expect(remote.set).not.toHaveBeenCalled(); + }); + + it('uses the captured prefix and client if configuration changes while queued', async () => { + const held = deferred(); + const release = deferred(); + const records: Record = {}; + const client = { + get: jest.fn(async (keys: string[]) => + Object.fromEntries(keys.map((key) => [key, records[key]])) + ), + set: jest.fn(async (items: Record) => { + Object.assign(records, items); + }), + }; + nativeStorage = installNativeStorageTestClient(client); + const blocker = nativeStorage.request( + 'sysweb3:create:queued-', + { mode: 'exclusive' }, + async () => { + held.resolve(); + await release.promise; + } + ); + await held.promise; + db.setPrefix('queued'); + db.setClient(client as any); + const creation = db.createManyIfAbsent({ vault: 'queued ciphertext' }); + db.setPrefix('other'); + db.setClient({ get: jest.fn(), set: jest.fn() } as any); + release.resolve(); + await blocker; + await expect(creation).resolves.toBe(true); + expect(records).toEqual({ 'queued-vault': 'queued ciphertext' }); + }); + + it('supports an explicit atomic custom adapter with serialized values', async () => { + const records: Record = {}; + const client = { + getItem: jest.fn((key: string) => records[key]), + setItem: jest.fn(), + removeItem: jest.fn(), + createItemsIfAbsent: jest.fn((items: Record) => { + if (Object.keys(items).some((key) => records[key] != null)) + return false; + Object.assign(records, items); + return true; + }), + }; + db.setClient(client); + await expect( + db.createManyIfAbsent({ + vault: 'ciphertext', + 'vault-keys': { salt: 'a' }, + }) + ).resolves.toBe(true); + expect(client.createItemsIfAbsent).toHaveBeenCalledWith({ + 'sysweb3-vault': '"ciphertext"', + 'sysweb3-vault-keys': '{"salt":"a"}', + }); + await expect(db.get('vault-keys')).resolves.toEqual({ salt: 'a' }); + await expect( + db.createManyIfAbsent({ vault: 'replacement' }) + ).resolves.toBe(false); + expect(client.setItem).not.toHaveBeenCalled(); + }); + + it('keeps the memory client absence check and assignment indivisible', async () => { + const memory = independentDb(); + const results = await Promise.all([ + memory.createManyIfAbsent({ + vault: 'first', + 'vault-keys': { salt: 'a' }, + }), + memory.createManyIfAbsent({ + vault: 'second', + 'vault-keys': { salt: 'b' }, + }), + ]); + expect(results).toEqual([true, false]); + await expect(memory.get('vault')).resolves.toBe('first'); + await expect(memory.get('vault-keys')).resolves.toEqual({ salt: 'a' }); + }); + }); +}); diff --git a/packages/sysweb3-keyring/test/unit/keyring-manager/unlock-errors.spec.ts b/packages/sysweb3-keyring/test/unit/keyring-manager/unlock-errors.spec.ts new file mode 100644 index 00000000..f4f579f3 --- /dev/null +++ b/packages/sysweb3-keyring/test/unit/keyring-manager/unlock-errors.spec.ts @@ -0,0 +1,473 @@ +import { webcrypto } from 'crypto'; +import CryptoJS from 'crypto-js'; + +import type { KeyringManager } from '../../../src'; + +const key = '11'.repeat(32); +const wrongKey = '22'.repeat(32); +const mnemonic = + 'abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about'; + +describe('KeyringManager unlock error classification with real WebCrypto', () => { + const values = new Map(); + const storage = { + async get(name: string) { + return values.get(name); + }, + async set(name: string, value: any) { + values.set(name, value); + }, + }; + let Keyring: typeof KeyringManager; + let getDecryptedVault: typeof import('../../../src/storage').getDecryptedVault; + let setEncryptedVault: typeof import('../../../src/storage').setEncryptedVault; + let sourceCrypto: typeof CryptoJS; + let keyring: KeyringManager; + let internals: any; + let cryptoDescriptor: PropertyDescriptor | undefined; + let locationDescriptor: PropertyDescriptor | undefined; + + beforeAll(() => { + // The shared test setup creates a new storage wrapper per call. Use one + // explicit client here so failures exercise both the manager and storage. + jest.resetModules(); + locationDescriptor = Object.getOwnPropertyDescriptor( + globalThis, + 'location' + ); + Object.defineProperty(globalThis, 'location', { + configurable: true, + value: { href: 'https://wallet.test/' }, + }); + jest.doMock('@sidhujag/sysweb3-core', () => ({ + sysweb3Di: { getStateStorageDb: () => storage }, + })); + jest.isolateModules(() => { + Keyring = require('../../../src').KeyringManager; + ({ + getDecryptedVault, + setEncryptedVault, + } = require('../../../src/storage')); + sourceCrypto = require('crypto-js'); + }); + }); + + afterAll(() => { + if (locationDescriptor) { + Object.defineProperty(globalThis, 'location', locationDescriptor); + } else { + delete (globalThis as any).location; + } + }); + + beforeEach(async () => { + values.clear(); + cryptoDescriptor = Object.getOwnPropertyDescriptor(globalThis, 'crypto'); + Object.defineProperty(globalThis, 'crypto', { + configurable: true, + value: webcrypto, + }); + jest.spyOn(console, 'log').mockImplementation(() => undefined); + jest.spyOn(console, 'error').mockImplementation(() => undefined); + + await storage.set('vault-keys', { salt: '33'.repeat(16) }); + await setEncryptedVault({ mnemonic }, key); + keyring = new Keyring(); + internals = keyring as any; + // Keep the KDF deterministic and fast; vault encryption and authentication + // use Node's real WebCrypto rather than the global test crypto mock. + jest + .spyOn(internals, 'encryptSHA512Async') + .mockImplementation(async (password) => { + return password === 'correct' ? key : wrongKey; + }); + keyring.setVaultStateGetter(() => ({ + activeAccount: { id: 0, type: 'HDAccount' }, + activeNetwork: { kind: 'ethereum' }, + accounts: { HDAccount: { 0: {} } }, + })); + }); + + afterEach(async () => { + await keyring.lockWallet(); + jest.restoreAllMocks(); + if (cryptoDescriptor) { + Object.defineProperty(globalThis, 'crypto', cryptoDescriptor); + } + }); + + it('unlocks a healthy AES-GCM vault', async () => { + await expect(keyring.unlock('correct')).resolves.toEqual({ + canLogin: true, + }); + expect(keyring.isUnlocked()).toBe(true); + }); + + it('returns false for an actual AES-GCM password authentication failure', async () => { + await expect(keyring.unlock('wrong')).resolves.toEqual({ canLogin: false }); + expect(keyring.isUnlocked()).toBe(false); + }); + + it('preserves legacy CBC password rejection and successful unlock', async () => { + await storage.set( + 'vault', + CryptoJS.AES.encrypt(JSON.stringify({ mnemonic }), key).toString() + ); + await expect(keyring.unlock('wrong')).resolves.toEqual({ canLogin: false }); + expect(keyring.isUnlocked()).toBe(false); + await expect(keyring.unlock('correct')).resolves.toEqual({ + canLogin: true, + }); + }); + + it('preserves CBC decrypt platform exceptions as operational failures', async () => { + await storage.set( + 'vault', + CryptoJS.AES.encrypt(JSON.stringify({ mnemonic }), key).toString() + ); + const error = new SyntaxError('CBC platform temporarily unavailable'); + jest.spyOn(sourceCrypto.AES, 'decrypt').mockImplementationOnce(() => { + throw error; + }); + await expect(keyring.unlock('correct')).rejects.toBe(error); + }); + + it('propagates a temporary storage failure and allows a later retry', async () => { + const error = new Error('storage temporarily unavailable'); + jest.spyOn(storage, 'get').mockRejectedValueOnce(error); + await expect(keyring.unlock('correct')).rejects.toBe(error); + await expect(keyring.unlock('correct')).resolves.toEqual({ + canLogin: true, + }); + }); + + it('propagates missing vault keys', async () => { + await storage.set('vault-keys', null); + await expect(keyring.unlock('correct')).rejects.toThrow( + 'Vault keys not found' + ); + }); + + it('propagates a missing encrypted vault', async () => { + await storage.set('vault', null); + await expect(keyring.unlock('correct')).rejects.toThrow('Vault not found'); + }); + + it('propagates a KDF failure', async () => { + const error = new Error('KDF temporarily unavailable'); + internals.encryptSHA512Async.mockRejectedValueOnce(error); + await expect(keyring.unlock('correct')).rejects.toBe(error); + }); + + it.each(['storage', 'kdf'])( + 'does not classify an arbitrary %s error code as vault authentication', + async (origin) => { + const error = Object.assign(new Error('service unavailable'), { + code: 'INVALID_PASSWORD', + }); + if (origin === 'storage') { + jest.spyOn(storage, 'get').mockRejectedValueOnce(error); + } else { + internals.encryptSHA512Async.mockRejectedValueOnce(error); + } + await expect(keyring.unlock('correct')).rejects.toBe(error); + } + ); + + it('cleans up if the vault read after authentication fails', async () => { + const error = new Error('vault read interrupted after authentication'); + const originalGet = storage.get; + let vaultReads = 0; + jest.spyOn(storage, 'get').mockImplementation(async (name) => { + if (name === 'vault' && ++vaultReads === 2) throw error; + return originalGet(name); + }); + const cleanup = jest.spyOn(keyring, 'lockWallet'); + await expect(keyring.unlock('correct')).rejects.toBe(error); + expect(cleanup).toHaveBeenCalledTimes(1); + expect(keyring.isUnlocked()).toBe(false); + }); + + it('clears restored secret buffers if account state fails after authentication', async () => { + const error = new Error('account state not ready'); + let passwordBuffer: any; + let mnemonicBuffer: any; + keyring.setVaultStateGetter(() => { + passwordBuffer = internals.sessionPassword; + mnemonicBuffer = internals.sessionMnemonic; + throw error; + }); + + await expect(keyring.unlock('correct')).rejects.toBe(error); + expect(passwordBuffer.isCleared()).toBe(true); + expect(mnemonicBuffer.isCleared()).toBe(true); + expect(internals.sessionPassword).toBeNull(); + expect(internals.sessionMnemonic).toBeNull(); + expect(keyring.isUnlocked()).toBe(false); + }); + + it('propagates a later authentication failure after the password was accepted', async () => { + const originalGet = storage.get; + const envelope = JSON.parse(await storage.get('vault')); + envelope.ct = '00'.repeat(envelope.ct.length / 2); + let vaultReads = 0; + jest.spyOn(storage, 'get').mockImplementation(async (name) => { + if (name === 'vault' && ++vaultReads === 2) { + return JSON.stringify(envelope); + } + return originalGet(name); + }); + const cleanup = jest.spyOn(keyring, 'lockWallet'); + await expect(keyring.unlock('correct')).rejects.toMatchObject({ + code: 'INVALID_PASSWORD', + }); + expect(cleanup).toHaveBeenCalledTimes(1); + expect(keyring.isUnlocked()).toBe(false); + }); + + it('clears restored secrets even if the platform random source is unavailable', async () => { + const error = new Error('account state not ready'); + let passwordBuffer: any; + let mnemonicBuffer: any; + keyring.setVaultStateGetter(() => { + passwordBuffer = internals.sessionPassword; + mnemonicBuffer = internals.sessionMnemonic; + jest + .spyOn(require('crypto'), 'randomFillSync') + .mockImplementationOnce(() => { + throw new Error('platform random source unavailable'); + }); + throw error; + }); + + await expect(keyring.unlock('correct')).rejects.toBe(error); + expect(passwordBuffer.isCleared()).toBe(true); + expect(mnemonicBuffer.isCleared()).toBe(true); + expect(keyring.isUnlocked()).toBe(false); + }); + + it('propagates a non-authentication WebCrypto decrypt failure', async () => { + const error = new DOMException( + 'crypto service unavailable', + 'InvalidStateError' + ); + jest.spyOn(webcrypto.subtle, 'decrypt').mockRejectedValueOnce(error); + await expect(keyring.unlock('correct')).rejects.toBe(error); + }); + + it('propagates key import OperationError without calling it a bad password', async () => { + const error = new DOMException('key import unavailable', 'OperationError'); + jest.spyOn(webcrypto.subtle, 'importKey').mockRejectedValueOnce(error); + await expect(keyring.unlock('correct')).rejects.toBe(error); + }); + + it.each([ + ['iv', '11'], + ['ct', '11'], + ])( + 'rejects a malformed AES-GCM %s before authentication', + async (field, value) => { + const envelope = JSON.parse(await storage.get('vault')); + envelope[field] = value; + await storage.set('vault', JSON.stringify(envelope)); + await expect(keyring.unlock('correct')).rejects.toThrow( + 'Invalid encrypted vault format' + ); + } + ); + + it.each(['{"v":4', '{"v":4,"alg":"A256GCM","ct":"11"}'])( + 'keeps malformed JSON-shaped vault records operational: %s', + async (vault) => { + await storage.set('vault', vault); + await expect(keyring.unlock('correct')).rejects.toThrow( + 'Invalid encrypted vault format' + ); + } + ); + + it('keeps authenticated AES-GCM plaintext parse failures operational', async () => { + const iv = new Uint8Array(12); + const cryptoKey = await webcrypto.subtle.importKey( + 'raw', + Buffer.from(key, 'hex'), + { name: 'AES-GCM' }, + false, + ['encrypt'] + ); + const ciphertext = await webcrypto.subtle.encrypt( + { name: 'AES-GCM', iv }, + cryptoKey, + new TextEncoder().encode('invalid JSON') + ); + await storage.set( + 'vault', + JSON.stringify({ + v: 4, + alg: 'A256GCM', + iv: Buffer.from(iv).toString('hex'), + ct: Buffer.from(ciphertext).toString('hex'), + }) + ); + await expect(getDecryptedVault(key)).rejects.toBeInstanceOf(SyntaxError); + await expect(keyring.unlock('correct')).rejects.toBeInstanceOf(SyntaxError); + }); + + it.each([true, false])( + 'recovers an interrupted migration with WebCrypto available: %s', + async (webCryptoAvailable) => { + if (!webCryptoAvailable) { + Object.defineProperty(globalThis, 'crypto', { + configurable: true, + value: { getRandomValues: webcrypto.getRandomValues.bind(webcrypto) }, + }); + } + await storage.set('vault-keys', { + salt: '33'.repeat(16), + currentSessionSalt: '44'.repeat(16), + }); + await storage.set( + 'vault', + CryptoJS.AES.encrypt(JSON.stringify({ mnemonic }), 'correct').toString() + ); + if (!webCryptoAvailable) { + const originalVault = await storage.get('vault'); + await expect(keyring.unlock('correct')).rejects.toThrow( + 'WebCrypto is required for vault encryption' + ); + await expect(storage.get('vault')).resolves.toBe(originalVault); + await expect(storage.get('vault-keys')).resolves.toEqual({ + salt: '33'.repeat(16), + currentSessionSalt: '44'.repeat(16), + }); + Object.defineProperty(globalThis, 'crypto', { + configurable: true, + value: webcrypto, + }); + } + const error = new Error('migration storage write unavailable'); + const originalSet = storage.set; + let failMetadataWrite = true; + jest.spyOn(storage, 'set').mockImplementation(async (name, value) => { + if (name === 'vault-keys' && failMetadataWrite) { + failMetadataWrite = false; + throw error; + } + return originalSet(name, value); + }); + const cleanup = jest.spyOn(keyring, 'lockWallet'); + await expect(keyring.unlock('correct')).rejects.toBe(error); + expect(cleanup).toHaveBeenCalledTimes(1); + expect(keyring.isUnlocked()).toBe(false); + const migratedVault = await storage.get('vault'); + expect(JSON.parse(migratedVault).alg).toBe('A256GCM'); + await expect(keyring.unlock('wrong')).resolves.toEqual({ + canLogin: false, + }); + await expect(storage.get('vault')).resolves.toBe(migratedVault); + await expect(storage.get('vault-keys')).resolves.toEqual({ + salt: '33'.repeat(16), + currentSessionSalt: '44'.repeat(16), + }); + await expect(keyring.unlock('correct')).resolves.toEqual({ + canLogin: true, + }); + await expect(storage.get('vault-keys')).resolves.toEqual({ + salt: '33'.repeat(16), + }); + } + ); + + it.each(['password', 'session'])( + 'migrates a double-encrypted legacy mnemonic using its %s key', + async (keyType) => { + const currentSessionSalt = '44'.repeat(16); + await storage.set('vault-keys', { + salt: '33'.repeat(16), + currentSessionSalt, + }); + const innerKey = + keyType === 'password' + ? 'correct' + : internals.encryptSHA512('correct', currentSessionSalt); + const encryptedMnemonic = CryptoJS.AES.encrypt( + mnemonic, + innerKey + ).toString(); + await storage.set( + 'vault', + CryptoJS.AES.encrypt( + JSON.stringify({ mnemonic: encryptedMnemonic }), + 'correct' + ).toString() + ); + if (keyType === 'session') { + const originalDecrypt = sourceCrypto.AES.decrypt; + jest + .spyOn(sourceCrypto.AES, 'decrypt') + .mockImplementation((ciphertext, pwd, config) => { + // A wrong CBC key may return empty text instead of throwing. + if (ciphertext === encryptedMnemonic && pwd === 'correct') { + return sourceCrypto.enc.Utf8.parse(''); + } + return originalDecrypt(ciphertext, pwd, config); + }); + } + + await expect(keyring.unlock('correct')).resolves.toEqual({ + canLogin: true, + }); + await expect(getDecryptedVault(key)).resolves.toEqual({ mnemonic }); + await expect(storage.get('vault-keys')).resolves.toEqual({ + salt: '33'.repeat(16), + }); + } + ); + + it.each([undefined, '', 'not a mnemonic', 'abandon '.repeat(11) + 'abandon'])( + 'preserves both stored records when a legacy secret cannot be recovered: %s', + async (legacySecret) => { + const vaultKeys = { + salt: '33'.repeat(16), + currentSessionSalt: '44'.repeat(16), + }; + const originalVault = CryptoJS.AES.encrypt( + JSON.stringify({ mnemonic: legacySecret }), + 'correct' + ).toString(); + await storage.set('vault-keys', vaultKeys); + await storage.set('vault', originalVault); + const writes = jest.spyOn(storage, 'set'); + + await expect(keyring.unlock('correct')).rejects.toThrow( + 'Existing vault preserved' + ); + expect(writes).not.toHaveBeenCalled(); + await expect(storage.get('vault')).resolves.toBe(originalVault); + await expect(storage.get('vault-keys')).resolves.toEqual(vaultKeys); + expect(keyring.isUnlocked()).toBe(false); + } + ); + + it('preserves a valid imported extended private key during legacy migration', async () => { + const extendedKey = + 'zprvAdGDwa3WySqQoVwVSbYRMKxDhSXpK2wW6wDjekCMdm7TaQ3igf52xRRjYghTvnFurtMm6CMgQivEDJs5ixGSnTtv8usFmkAoTe6XCF5hnpR'; + await storage.set('vault-keys', { + salt: '33'.repeat(16), + currentSessionSalt: '44'.repeat(16), + }); + await storage.set( + 'vault', + CryptoJS.AES.encrypt( + JSON.stringify({ mnemonic: extendedKey }), + 'correct' + ).toString() + ); + await expect(keyring.unlock('correct')).resolves.toEqual({ + canLogin: true, + }); + await expect(getDecryptedVault(key)).resolves.toEqual({ + mnemonic: extendedKey, + }); + }); +}); diff --git a/packages/sysweb3-keyring/test/unit/keyring-manager/vault-kdf-compatibility.spec.ts b/packages/sysweb3-keyring/test/unit/keyring-manager/vault-kdf-compatibility.spec.ts new file mode 100644 index 00000000..04578b3d --- /dev/null +++ b/packages/sysweb3-keyring/test/unit/keyring-manager/vault-kdf-compatibility.spec.ts @@ -0,0 +1,534 @@ +import { pbkdf2Sync, webcrypto } from 'crypto'; +import CryptoJS from 'crypto-js'; + +import { installNativeStorageTestClient } from '../../helpers/native-storage-locks'; + +const password = 'synthetic compatibility password'; +const salt = '33'.repeat(16); +const mnemonic = + 'abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about'; +const accountSecret = '0x' + '42'.repeat(32); +const legacyProfile = 'pbkdf2-sha512-20000'; +const legacyKey = CryptoJS.PBKDF2(password, CryptoJS.enc.Hex.parse(salt), { + keySize: 8, + iterations: 20_000, + hasher: CryptoJS.algo.SHA512, +}).toString(); + +const deferred = () => { + let resolve!: () => void; + const promise = new Promise((done) => { + resolve = done; + }); + return { promise, resolve }; +}; + +describe('production KDF compatibility through the real core adapter', () => { + const data: Record = {}; + let Keyring: any; + let db: any; + let setEncryptedVault: any; + let getDecryptedVault: any; + let ring: any; + let client: any; + let nativeStorage: ReturnType; + let originalCrypto: PropertyDescriptor | undefined; + let originalNodeEnv: string | undefined; + let originalIterations: string | undefined; + let originalLocation: PropertyDescriptor | undefined; + + const installLegacy = () => { + data['sysweb3-vault-keys'] = { salt }; + data['sysweb3-vault'] = CryptoJS.AES.encrypt( + JSON.stringify({ mnemonic }), + legacyKey + ).toString(); + }; + const createRing = () => { + const result = new Keyring(); + result.setVaultStateGetter(() => ({ + activeAccount: { id: 0, type: 'HDAccount' }, + activeNetwork: { kind: 'ethereum' }, + accounts: { + HDAccount: { + 0: { + xprv: CryptoJS.AES.encrypt(accountSecret, legacyKey).toString(), + }, + }, + }, + })); + return result; + }; + + beforeAll(() => { + originalLocation = Object.getOwnPropertyDescriptor(globalThis, 'location'); + Object.defineProperty(globalThis, 'location', { + configurable: true, + value: { href: 'https://wallet.test/' }, + }); + jest.resetModules(); + jest.doMock('@sidhujag/sysweb3-core', () => + jest.requireActual('@sidhujag/sysweb3-core') + ); + jest.isolateModules(() => { + Keyring = require('../../../src').KeyringManager; + db = require('@sidhujag/sysweb3-core').sysweb3Di.getStateStorageDb(); + ({ + setEncryptedVault, + getDecryptedVault, + } = require('../../../src/storage')); + }); + }); + beforeEach(() => { + Object.keys(data).forEach((key) => delete data[key]); + originalCrypto = Object.getOwnPropertyDescriptor(globalThis, 'crypto'); + Object.defineProperty(globalThis, 'crypto', { + configurable: true, + value: webcrypto, + }); + originalNodeEnv = process.env.NODE_ENV; + originalIterations = process.env.SYSWEB3_PBKDF2_ENC_ITERS; + process.env.NODE_ENV = 'production'; + delete process.env.SYSWEB3_PBKDF2_ENC_ITERS; + client = { + get: jest.fn(async (keys: string[]) => + Object.fromEntries(keys.map((key) => [key, data[key]])) + ), + set: jest.fn(async (value: any) => { + Object.assign(data, value); + }), + remove: jest.fn(async (key: string) => { + delete data[key]; + }), + }; + nativeStorage = installNativeStorageTestClient(client); + db.setClient(client); + ring = createRing(); + client.set.mockClear(); + delete data['sysweb3-utf8Error']; + jest.spyOn(console, 'log').mockImplementation(() => undefined); + jest.spyOn(console, 'error').mockImplementation(() => undefined); + }); + afterEach(async () => { + await ring.lockWallet(); + jest.restoreAllMocks(); + db.setClient(); + nativeStorage.restore(); + if (originalCrypto) + Object.defineProperty(globalThis, 'crypto', originalCrypto); + if (originalNodeEnv === undefined) delete process.env.NODE_ENV; + else process.env.NODE_ENV = originalNodeEnv; + if (originalIterations === undefined) + delete process.env.SYSWEB3_PBKDF2_ENC_ITERS; + else process.env.SYSWEB3_PBKDF2_ENC_ITERS = originalIterations; + }); + + afterAll(() => { + if (originalLocation) + Object.defineProperty(globalThis, 'location', originalLocation); + else delete (globalThis as any).location; + }); + + it.each([false, true])( + 'ignores rejected best-effort diagnostics (synchronous: %s)', + async (synchronous) => { + installLegacy(); + const unhandled = jest.fn(); + process.on('unhandledRejection', unhandled); + client.set.mockImplementation((value: any) => { + if ('sysweb3-utf8Error' in value) { + const error = new Error('diagnostic storage offline'); + if (synchronous) throw error; + return Promise.reject(error); + } + Object.assign(data, value); + return Promise.resolve(); + }); + try { + ring = createRing(); + ring.validateAndHandleErrorByMessage('Malformed UTF-8 data'); + await expect(ring.unlock(password)).resolves.toEqual({ + canLogin: true, + }); + await new Promise((resolve) => setImmediate(resolve)); + expect(unhandled).not.toHaveBeenCalled(); + } finally { + process.off('unhandledRejection', unhandled); + } + } + ); + + it('uses 900k PBKDF2/SHA-512 for a new wallet and stores only authenticated encryption', async () => { + await ring.initializeSession(mnemonic, password); + const freshSalt = data['sysweb3-vault-keys'].salt; + const expected = pbkdf2Sync( + password, + Buffer.from(freshSalt, 'hex'), + 900_000, + 32, + 'sha512' + ).toString('hex'); + expect(ring.getSessionPasswordString()).toBe(expected); + expect(expected).not.toBe(legacyKey); + expect(JSON.parse(data['sysweb3-vault']).alg).toBe('A256GCM'); + expect(await getDecryptedVault(expected)).toEqual({ mnemonic }); + }); + + it('publishes a fresh salt and ciphertext together only after the native write succeeds', async () => { + const entered = deferred(); + const release = deferred(); + client.set.mockImplementation(async (value: any) => { + entered.resolve(); + await release.promise; + Object.assign(data, value); + }); + const creation = ring.initializeSession(mnemonic, password); + await entered.promise; + expect(data).toEqual({}); + expect(client.set).toHaveBeenCalledTimes(1); + expect(client.set.mock.calls[0][0]).toEqual({ + 'sysweb3-vault-keys': { salt: expect.stringMatching(/^[a-f0-9]{32}$/) }, + 'sysweb3-vault': expect.any(String), + }); + release.resolve(); + await creation; + expect(JSON.parse(data['sysweb3-vault']).alg).toBe('A256GCM'); + await ring.lockWallet(); + ring = createRing(); + await expect(ring.unlock(password)).resolves.toEqual({ canLogin: true }); + expect(await ring.getSeed(password)).toBe(mnemonic); + }); + + it('leaves no fresh-wallet metadata after a rejected native write and permits a safe retry', async () => { + const error = new Error('native batch quota failure'); + client.set.mockImplementationOnce(async (value: any) => { + // Before the fix, the first standalone salt write succeeded, then + // ciphertext failed. Reject the vault-containing call in both versions. + if ('sysweb3-vault' in value) throw error; + Object.assign(data, value); + }); + client.set.mockImplementationOnce(async () => { + throw error; + }); + await expect(ring.initializeSession(mnemonic, password)).rejects.toBe( + error + ); + expect(data).toEqual({}); + client.set.mockReset().mockImplementation(async (value: any) => { + Object.assign(data, value); + }); + await expect( + ring.initializeSession(mnemonic, password) + ).resolves.toBeUndefined(); + expect(await ring.getSeed(password)).toBe(mnemonic); + }); + + it('does not publish fresh metadata when encryption fails before the batch write', async () => { + const error = new Error('WebCrypto encryption failed'); + jest.spyOn(webcrypto.subtle, 'encrypt').mockRejectedValueOnce(error); + await expect(ring.initializeSession(mnemonic, password)).rejects.toBe( + error + ); + expect(data).toEqual({}); + expect(client.set).not.toHaveBeenCalled(); + }); + + it.each([ + { + 'sysweb3-vault': 'pre-existing ciphertext', + 'sysweb3-vault-keys': { salt }, + }, + { 'sysweb3-vault': 'pre-existing ciphertext' }, + { 'sysweb3-vault-keys': { salt } }, + { 'sysweb3-vault': '' }, + { 'sysweb3-vault-keys': false }, + ])( + 'does not replace existing or incomplete wallet storage %p', + async (stored) => { + Object.assign(data, stored); + const before = { ...data }; + const derive = jest.spyOn(webcrypto.subtle, 'deriveBits'); + const encrypt = jest.spyOn(webcrypto.subtle, 'encrypt'); + await expect(ring.initializeSession(mnemonic, password)).rejects.toThrow( + 'Cannot initialize a new vault over existing wallet storage' + ); + expect(data).toEqual(before); + expect(derive).not.toHaveBeenCalled(); + expect(encrypt).not.toHaveBeenCalled(); + expect(client.set).not.toHaveBeenCalled(); + expect(ring.isUnlocked()).toBe(false); + } + ); + + it('rechecks malformed existing records inside the fresh-vault mutex', async () => { + data['sysweb3-vault'] = false; + await expect( + setEncryptedVault({ mnemonic }, '42'.repeat(32), { salt }) + ).rejects.toThrow( + 'Cannot initialize a new vault over existing wallet storage' + ); + expect(data).toEqual({ 'sysweb3-vault': false }); + expect(client.set).not.toHaveBeenCalled(); + }); + + it('allows only one concurrent initializer to publish a fresh wallet', async () => { + const entered = deferred(); + const release = deferred(); + const secondDerived = deferred(); + const other = createRing(); + const derive = other.deriveStoredSessionKey.bind(other); + jest + .spyOn(other, 'deriveStoredSessionKey') + .mockImplementation(async (...args: any[]) => { + const key = await derive(...args); + secondDerived.resolve(); + return key; + }); + client.set.mockImplementation(async (value: any) => { + if (!('sysweb3-vault' in value)) { + Object.assign(data, value); + return; + } + entered.resolve(); + await release.promise; + Object.assign(data, value); + }); + try { + const first = ring.initializeSession(mnemonic, password); + await entered.promise; + const second = other.initializeSession( + 'legal winner thank year wave sausage worth useful legal winner thank yellow', + 'different fixture password' + ); + const rejected = expect(second).rejects.toThrow( + 'Cannot initialize a new vault over existing wallet storage' + ); + await secondDerived.promise; + release.resolve(); + await first; + await rejected; + expect( + client.set.mock.calls.filter(([value]) => 'sysweb3-vault' in value) + ).toHaveLength(1); + expect(await ring.getSeed(password)).toBe(mnemonic); + expect(other.isUnlocked()).toBe(false); + } finally { + release.resolve(); + await other.destroy(); + } + }); + + it('keeps matching live-session initialization read-only', async () => { + await ring.initializeSession(mnemonic, password); + const before = { ...data }; + client.set.mockClear(); + await expect( + ring.initializeSession(mnemonic, password) + ).resolves.toBeUndefined(); + expect(data).toEqual(before); + expect(client.set).not.toHaveBeenCalled(); + }); + + it('rejects a fresh creation on a sequential-only adapter before any write', async () => { + const sequential = { + getItem: jest.fn(() => null), + setItem: jest.fn(), + removeItem: jest.fn(), + }; + db.setClient(sequential); + await expect(ring.initializeSession(mnemonic, password)).rejects.toThrow( + 'Storage adapter does not support atomic creation' + ); + expect(sequential.setItem).not.toHaveBeenCalled(); + }); + + it('leaves a complete recoverable vault if the batch commits but acknowledgement is lost', async () => { + const error = new Error('write acknowledgement lost'); + client.set.mockImplementationOnce(async (value: any) => { + Object.assign(data, value); + throw error; + }); + await expect(ring.initializeSession(mnemonic, password)).rejects.toBe( + error + ); + expect(data['sysweb3-vault-keys']).toEqual({ salt: expect.any(String) }); + expect(JSON.parse(data['sysweb3-vault']).alg).toBe('A256GCM'); + ring = createRing(); + await expect(ring.unlock(password)).resolves.toEqual({ canLogin: true }); + expect(await ring.getSeed(password)).toBe(mnemonic); + }); + + it('retains legacy account access after WebCrypto appears and after restarting', async () => { + installLegacy(); + await expect(ring.unlock(password)).resolves.toEqual({ canLogin: true }); + expect(data['sysweb3-vault-keys']).toEqual({ + salt, + keyDerivation: legacyProfile, + }); + expect(JSON.parse(data['sysweb3-vault']).alg).toBe('A256GCM'); + expect(await ring.getSeed(password)).toBe(mnemonic); + expect(await ring.getPrivateKeyByAccountId(0, 'HDAccount', password)).toBe( + accountSecret + ); + await ring.lockWallet(); + ring = createRing(); + await expect(ring.unlock(password)).resolves.toEqual({ canLogin: true }); + expect(await ring.getSeed(password)).toBe(mnemonic); + expect(await ring.getPrivateKeyByAccountId(0, 'HDAccount', password)).toBe( + accountSecret + ); + await expect(ring.unlock('wrong password')).resolves.toEqual({ + canLogin: false, + }); + }); + + it('rejects initialization over a persisted compatibility wallet and restores it through unlock', async () => { + installLegacy(); + await ring.unlock(password); + await ring.lockWallet(); + ring = createRing(); + const before = { ...data }; + client.set.mockClear(); + await expect(ring.initializeSession(mnemonic, password)).rejects.toThrow( + 'Cannot initialize a new vault over existing wallet storage' + ); + expect(data).toEqual(before); + expect(client.set).not.toHaveBeenCalled(); + await expect(ring.unlock(password)).resolves.toEqual({ canLogin: true }); + expect(await ring.getPrivateKeyByAccountId(0, 'HDAccount', password)).toBe( + accountSecret + ); + expect(await ring.getSeed(password)).toBe(mnemonic); + }); + + it('requires WebCrypto without changing an unmarked legacy vault, then recovers when restored', async () => { + installLegacy(); + const before = { ...data }; + Object.defineProperty(globalThis, 'crypto', { + configurable: true, + value: { getRandomValues: webcrypto.getRandomValues.bind(webcrypto) }, + }); + await expect(ring.unlock(password)).rejects.toThrow( + 'WebCrypto is required' + ); + expect(data).toEqual(before); + expect(client.set).not.toHaveBeenCalled(); + Object.defineProperty(globalThis, 'crypto', { + configurable: true, + value: webcrypto, + }); + await expect(ring.unlock(password)).resolves.toEqual({ canLogin: true }); + }); + + it('never creates a CBC vault or metadata when WebCrypto is unavailable', async () => { + Object.defineProperty(globalThis, 'crypto', { + configurable: true, + value: {}, + }); + await expect(ring.initializeSession(mnemonic, password)).rejects.toThrow( + 'WebCrypto is required' + ); + await expect(setEncryptedVault({ mnemonic }, legacyKey)).rejects.toThrow( + 'WebCrypto is required' + ); + expect(client.set).not.toHaveBeenCalled(); + expect(data).toEqual({}); + }); + + it('does not let metadata specify arbitrary KDF parameters', async () => { + installLegacy(); + data['sysweb3-vault-keys'].keyDerivation = { iterations: 1 }; + const derive = jest.spyOn(webcrypto.subtle, 'deriveBits'); + await expect(ring.unlock(password)).rejects.toThrow( + 'Unsupported vault key derivation profile' + ); + expect(derive).not.toHaveBeenCalled(); + expect(client.set).not.toHaveBeenCalled(); + }); + + it('does not try the legacy KDF for a corrupted modern GCM vault', async () => { + data['sysweb3-vault-keys'] = { salt }; + await setEncryptedVault({ mnemonic }, legacyKey); + const derive = jest.spyOn(webcrypto.subtle, 'deriveBits'); + await expect(ring.unlock(password)).resolves.toEqual({ canLogin: false }); + expect(derive).toHaveBeenCalledTimes(1); + }); + + it.each(['profile', 'ciphertext'])( + 'keeps legacy recovery possible after a rejected %s write', + async (failure) => { + installLegacy(); + const originalVault = data['sysweb3-vault']; + const error = new Error('asynchronous storage rejection'); + const save = client.set.getMockImplementation(); + client.set.mockImplementationOnce(async (value: any) => { + if (failure === 'profile') throw error; + return save(value); + }); + if (failure === 'ciphertext') client.set.mockRejectedValueOnce(error); + await expect(ring.unlock(password)).rejects.toBe(error); + expect(data['sysweb3-vault']).toBe(originalVault); + expect(data['sysweb3-vault-keys']).toEqual( + failure === 'profile' + ? { salt } + : { salt, keyDerivation: legacyProfile } + ); + await expect(ring.unlock(password)).resolves.toEqual({ canLogin: true }); + expect(JSON.parse(data['sysweb3-vault']).alg).toBe('A256GCM'); + expect( + await ring.getPrivateKeyByAccountId(0, 'HDAccount', password) + ).toBe(accountSecret); + } + ); + + it('awaits the actual Chrome vault write before removing the legacy session salt', async () => { + const oldSalt = '44'.repeat(16); + const oldKey = CryptoJS.PBKDF2(password, CryptoJS.enc.Hex.parse(oldSalt), { + keySize: 8, + iterations: 20_000, + hasher: CryptoJS.algo.SHA512, + }).toString(); + const encryptedMnemonic = CryptoJS.AES.encrypt(mnemonic, oldKey).toString(); + data['sysweb3-vault-keys'] = { salt, currentSessionSalt: oldSalt }; + data['sysweb3-vault'] = CryptoJS.AES.encrypt( + JSON.stringify({ mnemonic: encryptedMnemonic }), + password + ).toString(); + const entered = deferred(); + const release = deferred(); + client.set.mockImplementation(async (value: any) => { + if ('sysweb3-vault' in value) { + entered.resolve(); + await release.promise; + } + Object.assign(data, value); + }); + let settled = false; + const unlock = ring.unlock(password).finally(() => { + settled = true; + }); + await entered.promise; + expect(data['sysweb3-vault-keys']).toEqual({ + salt, + currentSessionSalt: oldSalt, + }); + expect(settled).toBe(false); + release.resolve(); + await expect(unlock).resolves.toEqual({ canLogin: true }); + expect(data['sysweb3-vault-keys']).toEqual({ salt }); + }); + + it('preserves old migration records when the real adapter rejects the vault write', async () => { + data['sysweb3-vault-keys'] = { salt, currentSessionSalt: '44'.repeat(16) }; + data['sysweb3-vault'] = CryptoJS.AES.encrypt( + JSON.stringify({ mnemonic }), + password + ).toString(); + const before = { ...data }; + const error = new Error('Chrome quota write failure'); + client.set.mockRejectedValueOnce(error); + await expect(ring.unlock(password)).rejects.toBe(error); + expect(data).toEqual(before); + await expect(ring.unlock(password)).resolves.toEqual({ canLogin: true }); + }); +}); diff --git a/packages/sysweb3-keyring/test/unit/keyring-manager/watch-descriptor-lifecycle.spec.ts b/packages/sysweb3-keyring/test/unit/keyring-manager/watch-descriptor-lifecycle.spec.ts new file mode 100644 index 00000000..2bdbbc29 --- /dev/null +++ b/packages/sysweb3-keyring/test/unit/keyring-manager/watch-descriptor-lifecycle.spec.ts @@ -0,0 +1,246 @@ +import { INetworkType } from '@sidhujag/sysweb3-network'; +import { address, networks } from 'bitcoinjs-lib'; +import bs58check from 'bs58check'; + +import { KeyringManager } from '../../../src/keyring-manager'; +import { KeyringAccountType } from '../../../src/types'; +import { descriptorChecksum } from '../../../src/utils/watch-descriptor'; +import { FAKE_PASSWORD, PEACE_SEED_PHRASE } from '../../helpers/constants'; +import { createFreshTestKeyring, setupMocks } from '../../helpers/setup'; + +const XPUB = + 'xpub6BgBgsespWvERF3LHQu6CnqdvfEvtMcQjYrcRzx53QJjSxarj2afYWcLteoGVky7D3UKDP9QyrLprQ3VCECoY49yfdDEHGCtMMj92pReUsQ'; +const WPKH = `wpkh(${XPUB})`; +const ADDRESS = 'bc1qalwlmdxd2ggue4290ekzxl9tetg56neexr6amw'; +const BACKEND_ADDRESS = 'bc1qcr8te4kr609gcawutmrza0j4xv80jy8z306fyu'; + +describe('watch descriptor import and address lifecycle', () => { + let manager: KeyringManager; + let vault: any; + let fetchMock: jest.MockedFunction; + + beforeEach(async () => { + setupMocks(); + await setupTestVault(FAKE_PASSWORD); + vault = createMockVaultState({ + networkType: INetworkType.Syscoin, + chainId: 5700, + }); + manager = await createFreshTestKeyring( + PEACE_SEED_PHRASE, + FAKE_PASSWORD, + () => vault + ); + vault.activeNetwork = { + kind: INetworkType.Syscoin, + chainId: 0, + slip44: 0, + currency: 'BTC', + label: 'Bitcoin', + url: 'https://watch-only.invalid/', + }; + fetchMock = jest.mocked(global.fetch); + fetchMock.mockClear(); + expect(() => + address.toOutputScript(BACKEND_ADDRESS, networks.bitcoin) + ).not.toThrow(); + fetchMock.mockImplementation( + async () => + ({ + ok: true, + json: async () => ({ + address: BACKEND_ADDRESS, + tokens: [ + { + type: 'XPUBAddress', + name: BACKEND_ADDRESS, + path: "m/84'/0'/0'/0/0", + }, + ], + }), + } as Response) + ); + }); + + afterEach(async () => { + await manager?.destroy(); + }); + + const activate = (account: any) => { + vault.accounts.Imported[account.id] = account; + vault.activeAccount = { id: account.id, type: KeyringAccountType.Imported }; + }; + + it.each([ + [`pkh(${XPUB})`, '1NsJS4DAHLcegD63trZurmkLm23TRAujXd'], + [`sh(wpkh(${XPUB}))`, '39oRj36VbCJdky8wsPCT5FMQNRUUekuoUr'], + [WPKH, ADDRESS], + [ + `tr(${XPUB})`, + 'bc1p5cyxnuxmeuwuvkwfem96lqzszd02n6xdcjrs20cac6yqjjwudpxqkedrcr', + ], + ])( + 'imports script family case %# with locally bound address', + async (identifier, address) => { + const account = await manager.importWatchOnly( + identifier, + 'Public descriptor' + ); + expect(account).toMatchObject({ + address, + xpub: identifier, + xprv: '', + isImported: true, + label: 'Public descriptor', + isLedgerWallet: false, + isTrezorWallet: false, + }); + expect(fetchMock).toHaveBeenCalledTimes(1); + expect(fetchMock).toHaveBeenCalledWith( + `https://watch-only.invalid/api/v2/xpub/${encodeURIComponent( + identifier + )}?details=basic` + ); + expect(vault.accounts.Imported).toEqual({}); + } + ); + + it('imports the supported Syscoin Testnet tpub descriptor from the Receive reproduction', async () => { + const payload = Buffer.from(bs58check.decode(XPUB)); + payload.writeUInt32BE(0x043587cf, 0); + const tpub = bs58check.encode(payload); + const identifier = `wpkh(${tpub})`; + vault.activeNetwork = { + ...vault.activeNetwork, + chainId: 5700, + slip44: 1, + currency: 'tSYS', + label: 'Syscoin Testnet', + }; + const account = await manager.importWatchOnly(identifier); + expect(account).toMatchObject({ + address: 'tsys1qalwlmdxd2ggue4290ekzxl9tetg56neeepgwhk', + xpub: identifier, + xprv: '', + isImported: true, + }); + expect(fetchMock).toHaveBeenCalledTimes(1); + expect(fetchMock).toHaveBeenCalledWith( + `https://watch-only.invalid/api/v2/xpub/${encodeURIComponent( + identifier + )}?details=basic` + ); + }); + + it('preserves origin, ordered branches and checksum in the history reference', async () => { + const body = `wpkh([d34db33f/84h/0h/0h]${XPUB}/<2;0>/*)`; + const identifier = `${body}#${descriptorChecksum(body)}`; + const account = await manager.importWatchOnly(identifier); + expect(account.address).toBe('bc1qdjk5l8zfe5h5ex7vnhfj7rxu9fnd9d38c8plnx'); + expect(account.xpub).toBe(identifier); + expect(fetchMock).toHaveBeenCalledWith( + `https://watch-only.invalid/api/v2/xpub/${encodeURIComponent( + identifier + )}?details=basic` + ); + }); + + it('derives force-index-zero addresses without backend recipient authority', async () => { + await expect( + manager.getAddress(WPKH, false, { forceIndex0: true }) + ).resolves.toBe(ADDRESS); + await expect( + manager.getAddress(WPKH, true, { forceIndex0: true }) + ).resolves.toBe('bc1qm4y5h28kytu6uftd94vtcjppffk5sx0hgat2c5'); + expect(fetchMock).not.toHaveBeenCalled(); + }); + + it.each([false, true])( + 'refuses descriptor rotation with change=%s', + async (change) => { + await expect(manager.getAddress(WPKH, change)).rejects.toThrow( + /descriptor|rotation|index/i + ); + expect(fetchMock).not.toHaveBeenCalled(); + } + ); + + it.each([false, true])( + 'refuses change and receiving rotation for oldRecord=%s', + async (oldRecord) => { + const account = await manager.importWatchOnly(WPKH); + activate(oldRecord ? { ...account, address: WPKH } : account); + fetchMock.mockClear(); + await expect(manager.getChangeAddress(account.id)).rejects.toThrow( + /descriptor|rotation|index/i + ); + await expect(manager.getNewChangeAddress()).rejects.toThrow( + /descriptor|rotation|index/i + ); + await expect(manager.updateReceivingAddress()).rejects.toThrow( + /descriptor|rotation|index/i + ); + expect(fetchMock).not.toHaveBeenCalled(); + } + ); + + it('retains watch-only derivation guards after address differs from descriptor', async () => { + const account = await manager.importWatchOnly(WPKH); + activate(account); + fetchMock.mockClear(); + await expect(manager.getPubkey(account.id, false)).rejects.toThrow( + /watch-only/i + ); + await expect(manager.getBip32Path(account.id, false)).rejects.toThrow( + /watch-only/i + ); + expect(fetchMock).not.toHaveBeenCalled(); + }); + + it.each([ + `wsh(${XPUB})`, + `${WPKH}#aaaaaaaa`, + 'wpkh(xprv-not-a-public-key)', + `wpkh(${XPUB}/0h/*)`, + `wpkh(${XPUB}/2147483648/*)`, + ])( + 'rejects locally invalid descriptor case %# before HTTP', + async (identifier) => { + await expect(manager.importWatchOnly(identifier)).rejects.toThrow(); + expect(fetchMock).not.toHaveBeenCalled(); + expect(vault.accounts.Imported).toEqual({}); + } + ); + + it('rejects a canonical-address duplicate before querying Blockbook', async () => { + const account = await manager.importWatchOnly(ADDRESS); + activate(account); + fetchMock.mockClear(); + await expect(manager.importWatchOnly(WPKH)).rejects.toThrow( + /already exists/i + ); + expect(fetchMock).not.toHaveBeenCalled(); + }); + + it('rejects an exact-descriptor duplicate from an old invalid address record', async () => { + const account = await manager.importWatchOnly(WPKH); + activate({ ...account, address: WPKH }); + fetchMock.mockClear(); + await expect(manager.importWatchOnly(WPKH)).rejects.toThrow( + /already exists/i + ); + expect(fetchMock).not.toHaveBeenCalled(); + }); + + it('does not import when the backend rejects an otherwise valid descriptor', async () => { + fetchMock.mockResolvedValue({ + ok: false, + statusText: 'Descriptor is unavailable', + text: async () => JSON.stringify({ error: 'Descriptor is unavailable' }), + } as Response); + await expect(manager.importWatchOnly(WPKH)).rejects.toThrow( + 'Descriptor is unavailable' + ); + expect(vault.accounts.Imported).toEqual({}); + }); +}); diff --git a/packages/sysweb3-keyring/test/unit/ledger/bitcoin_client/policy.spec.ts b/packages/sysweb3-keyring/test/unit/ledger/bitcoin_client/policy.spec.ts new file mode 100644 index 00000000..0e70888f --- /dev/null +++ b/packages/sysweb3-keyring/test/unit/ledger/bitcoin_client/policy.spec.ts @@ -0,0 +1,25 @@ +import { ClientCommandInterpreter } from '../../../../src/ledger/bitcoin_client/lib/clientCommands'; +import { WalletPolicy } from '../../../../src/ledger/bitcoin_client/lib/policy'; + +describe('WalletPolicy and ClientCommandInterpreter descriptor handling', () => { + it('uses ASCII bytes for descriptorTemplate in interpreter preimages', () => { + const descriptor = 'wpkh(@0/**)'; + const keys = ['[f23a9bcd/84h/0h/0h]xpub6CUGRU...']; + + const wp = new WalletPolicy('', descriptor, keys); + const cci = new ClientCommandInterpreter(); + + const seen: Buffer[] = []; + const addKnownPreimage = (cci as any).addKnownPreimage.bind(cci); + (cci as any).addKnownPreimage = (buf: Buffer) => { + seen.push(Buffer.from(buf)); + return addKnownPreimage(buf); + }; + + cci.addKnownWalletPolicy(wp); + + const asciiDescriptor = Buffer.from(descriptor, 'ascii'); + const found = seen.some((b) => b.equals(asciiDescriptor)); + expect(found).toBe(true); + }); +}); diff --git a/packages/sysweb3-keyring/test/unit/ledger/bitcoin_client/psbtv2.p2wpkh.spec.ts b/packages/sysweb3-keyring/test/unit/ledger/bitcoin_client/psbtv2.p2wpkh.spec.ts new file mode 100644 index 00000000..9e961075 --- /dev/null +++ b/packages/sysweb3-keyring/test/unit/ledger/bitcoin_client/psbtv2.p2wpkh.spec.ts @@ -0,0 +1,52 @@ +import * as syscoinjs from 'syscoinjs-lib'; + +import { PsbtV2 } from '../../../../src/ledger/bitcoin_client/lib/psbtv2'; + +describe('PsbtV2.fromBitcoinJS for P2WPKH', () => { + it('converts a simple P2WPKH psbt without errors', () => { + const bjs: any = (syscoinjs.utils as any).bitcoinjs; + const psbt = new bjs.Psbt({ network: bjs.networks.bitcoin }); + + // Build P2WPKH using a known 20-byte hash to guarantee a valid scriptPubKey + const pubkey = Buffer.alloc(33, 3); + const hash20 = Buffer.alloc(20, 2); + const p2wpkh = bjs.payments.p2wpkh({ + hash: hash20, + network: bjs.networks.bitcoin, + }); + + // Minimal input/output with witnessUtxo + psbt.addInput({ + hash: Buffer.alloc(32, 1), + index: 0, + witnessUtxo: { + script: p2wpkh.output as Buffer, + value: BigInt(1500), + }, + bip32Derivation: [ + { + masterFingerprint: Buffer.from('deadbeef', 'hex'), + path: "m/84'/0'/0'/0/0", + pubkey, + }, + ], + }); + // Provide script directly to avoid address encoding differences + psbt.addOutput({ script: p2wpkh.output as Buffer, value: BigInt(1000) }); + + const psbtV2 = new PsbtV2().fromBitcoinJS(psbt); + + // Validate a few critical fields were set + expect(psbtV2.getGlobalPsbtVersion()).toBe(2); + expect(psbtV2.getGlobalInputCount()).toBe(1); + expect(psbtV2.getGlobalOutputCount()).toBe(1); + + const utxo = psbtV2.getInputWitnessUtxo(0)!; + expect(utxo.amount).toBe(1500); + expect(Buffer.isBuffer(utxo.scriptPubKey)).toBe(true); + + const deriv = psbtV2.getInputBip32Derivation(0, pubkey)!; + expect(Buffer.isBuffer(deriv.masterFingerprint)).toBe(true); + expect(Array.isArray(deriv.path)).toBe(true); + }); +}); diff --git a/packages/sysweb3-keyring/test/unit/network/network-management.spec.ts b/packages/sysweb3-keyring/test/unit/network/network-management.spec.ts index f24b5cff..c1ba2753 100644 --- a/packages/sysweb3-keyring/test/unit/network/network-management.spec.ts +++ b/packages/sysweb3-keyring/test/unit/network/network-management.spec.ts @@ -1,7 +1,8 @@ +import { INetworkType, INetwork } from '@sidhujag/sysweb3-network'; + import { KeyringManager, KeyringAccountType } from '../../../src'; import { FAKE_PASSWORD, PEACE_SEED_PHRASE } from '../../helpers/constants'; -import { setupMocks } from '../../helpers/setup'; -import { INetworkType, INetwork } from '@pollum-io/sysweb3-network'; +import { createFreshTestKeyring, setupMocks } from '../../helpers/setup'; describe('Network Management', () => { let keyringManager: KeyringManager; @@ -25,7 +26,7 @@ describe('Network Management', () => { }); mockVaultStateGetter = jest.fn(() => currentVaultState); - keyringManager = await KeyringManager.createInitialized( + keyringManager = await createFreshTestKeyring( PEACE_SEED_PHRASE, FAKE_PASSWORD, mockVaultStateGetter @@ -127,7 +128,7 @@ describe('Network Management', () => { }); mockVaultStateGetter = jest.fn(() => currentVaultState); - keyringManager = await KeyringManager.createInitialized( + keyringManager = await createFreshTestKeyring( PEACE_SEED_PHRASE, FAKE_PASSWORD, mockVaultStateGetter @@ -159,7 +160,7 @@ describe('Network Management', () => { }); mockVaultStateGetter = jest.fn(() => currentVaultState); - keyringManager = await KeyringManager.createInitialized( + keyringManager = await createFreshTestKeyring( PEACE_SEED_PHRASE, FAKE_PASSWORD, mockVaultStateGetter @@ -189,7 +190,7 @@ describe('Network Management', () => { }; const syscoinMainnetVaultGetter = jest.fn(() => syscoinMainnetVaultState); - const syscoinKeyring = await KeyringManager.createInitialized( + const syscoinKeyring = await createFreshTestKeyring( PEACE_SEED_PHRASE, FAKE_PASSWORD, syscoinMainnetVaultGetter @@ -210,7 +211,7 @@ describe('Network Management', () => { }; const syscoinTestnetVaultGetter = jest.fn(() => syscoinTestnetVaultState); - const syscoinTestnetKeyring = await KeyringManager.createInitialized( + const syscoinTestnetKeyring = await createFreshTestKeyring( PEACE_SEED_PHRASE, FAKE_PASSWORD, syscoinTestnetVaultGetter @@ -249,7 +250,7 @@ describe('Network Management', () => { }); mockVaultStateGetter = jest.fn(() => currentVaultState); - keyringManager = await KeyringManager.createInitialized( + keyringManager = await createFreshTestKeyring( PEACE_SEED_PHRASE, FAKE_PASSWORD, mockVaultStateGetter @@ -345,7 +346,7 @@ describe('Network Management', () => { }); mockVaultStateGetter = jest.fn(() => currentVaultState); - keyringManager = await KeyringManager.createInitialized( + keyringManager = await createFreshTestKeyring( PEACE_SEED_PHRASE, FAKE_PASSWORD, mockVaultStateGetter diff --git a/packages/sysweb3-keyring/test/unit/providers-rpc-integrity.spec.ts b/packages/sysweb3-keyring/test/unit/providers-rpc-integrity.spec.ts new file mode 100644 index 00000000..bf781f4e --- /dev/null +++ b/packages/sysweb3-keyring/test/unit/providers-rpc-integrity.spec.ts @@ -0,0 +1,1006 @@ +import { BigNumber, JsonRpcProvider } from '../../src/ethers-v6'; + +const { Network } = jest.requireActual('ethers/providers'); +const { FetchRequest } = jest.requireActual('ethers/utils'); + +const { CustomJsonRpcProvider, RpcResponseIntegrityError } = jest.requireActual( + '../../src/providers' +); +const { EthereumTransactions } = jest.requireActual( + '../../src/transactions/ethereum' +); + +const SENTINEL = 'SYSWEB3_RPC_RESPONSE_INVALID'; +const RPC_URL = 'https://rpc.example/v1/token?existing=a%2Fb&space=a%20b'; +const FROM = '0x0000000000000000000000000000000000000001'; +const RUNTIME = `0x${'60'.repeat(512)}`; +const network = { url: RPC_URL, chainId: 5700 }; + +const response = (json: any) => ({ + ok: true, + status: 200, + json: async () => json, +}); +const resultFor = (request: any, result = '0x5208') => ({ + jsonrpc: '2.0', + id: request.id, + result, +}); +const requestsFrom = (fetchMock: jest.Mock) => + fetchMock.mock.calls.map(([, options]) => JSON.parse(options.body)); + +const sdkFor = (provider: any) => { + const sdk = new EthereumTransactions( + () => network, + () => { + throw new Error('This read-only test must not sign'); + }, + () => ({ activeNetwork: network }), + {}, + {} + ); + Object.defineProperty(sdk, 'web3Provider', { get: () => provider }); + return sdk; +}; + +describe('JSON-RPC response correlation', () => { + let fetchMock: jest.Mock; + let originalFetch: typeof fetch; + const providers: any[] = []; + const providerFor = (url = RPC_URL, chainId: number | null = 5700) => { + const provider = new CustomJsonRpcProvider( + new AbortController().signal, + url, + chainId ?? undefined + ); + providers.push(provider); + return provider; + }; + + beforeEach(() => { + originalFetch = global.fetch; + fetchMock = jest.fn(async (_url, options) => + response(resultFor(JSON.parse(options.body))) + ); + global.fetch = fetchMock; + }); + afterEach(() => { + for (const provider of providers.splice(0)) provider.destroy(); + global.fetch = originalFetch; + }); + + it('keeps a healthy read on the original URL with one request', async () => { + await expect( + providerFor().send('eth_getBalance', [FROM, 'latest']) + ).resolves.toBe('0x5208'); + expect(fetchMock).toHaveBeenCalledTimes(1); + expect(fetchMock.mock.calls[0][0]).toBe(RPC_URL); + }); + + it('reserves distinct IDs before concurrent requests settle', async () => { + const deferred: Array<{ request: any; resolve: (value: any) => void }> = []; + fetchMock.mockImplementation( + (_url, options) => + new Promise((resolve) => { + deferred.push({ request: JSON.parse(options.body), resolve }); + }) + ); + const provider = providerFor(); + const first = provider.send('eth_call', [{ data: '0x01' }, 'latest']); + const second = provider.send('eth_call', [{ data: '0x02' }, 'latest']); + expect(deferred).toHaveLength(2); + expect(deferred[0].request.id).not.toBe(deferred[1].request.id); + deferred[1].resolve(response(resultFor(deferred[1].request, '0x02'))); + deferred[0].resolve(response(resultFor(deferred[0].request, '0x01'))); + await expect(Promise.all([first, second])).resolves.toEqual([ + '0x01', + '0x02', + ]); + }); + + it('recovers a replayed deployment call response without treating code as gas', async () => { + let callReply: any; + fetchMock.mockImplementation(async (_url, options) => { + const request = JSON.parse(options.body); + if (request.method === 'eth_call') { + callReply = resultFor(request, RUNTIME); + return response(callReply); + } + if (fetchMock.mock.calls.length === 2) return response(callReply); + return response(resultFor(request)); + }); + const provider = providerFor(); + await expect( + provider.send('eth_call', [{ from: FROM, data: '0x6000' }, 'latest']) + ).resolves.toBe(RUNTIME); + const gas = await sdkFor(provider).getTxGasLimit({ + from: FROM, + data: '0x6000', + }); + expect(gas.toString()).toBe('25200'); + expect(fetchMock).toHaveBeenCalledTimes(3); + const ids = requestsFrom(fetchMock).map((request) => request.id); + expect(new Set(ids).size).toBe(3); + expect(ids.every(Number.isSafeInteger)).toBe(true); + expect(ids[1]).toBe(ids[0] + 1); + expect(ids[2]).toBe(ids[1] + 1); + const retryUrl = new URL(fetchMock.mock.calls[2][0]); + expect(retryUrl.origin).toBe(new URL(RPC_URL).origin); + expect(retryUrl.pathname).toBe('/v1/token'); + expect(retryUrl.searchParams.get('existing')).toBe('a/b'); + expect(retryUrl.searchParams.get('space')).toBe('a b'); + expect(retryUrl.search).toContain('existing=a%2Fb&space=a%20b'); + expect(retryUrl.searchParams.get('sysweb3_rpc_request')).toBeTruthy(); + }); + + it.each([ + { from: FROM, data: '0x6000' }, + { from: FROM, to: FROM, value: '0x0' }, + ])( + 'rejects repeated integrity failures instead of gas fallback: %p', + async (tx) => { + fetchMock.mockResolvedValue( + response({ jsonrpc: '2.0', id: -1, result: RUNTIME }) + ); + await expect( + sdkFor(providerFor()).getTxGasLimit(tx) + ).rejects.toMatchObject({ + code: SENTINEL, + message: expect.stringContaining(SENTINEL), + }); + expect(fetchMock).toHaveBeenCalledTimes(2); + } + ); + + it('does not hide an integrity failure in simple-transfer fallback', async () => { + fetchMock.mockImplementation(async (_url, options) => { + const request = JSON.parse(options.body); + if (fetchMock.mock.calls.length === 1) { + return response({ + jsonrpc: '2.0', + id: request.id, + error: { code: -32000, message: 'estimate failed' }, + }); + } + return response({ jsonrpc: '2.0', id: -1, result: RUNTIME }); + }); + await expect( + sdkFor(providerFor()).getTxGasLimit({ from: FROM, to: FROM }) + ).rejects.toMatchObject({ code: SENTINEL }); + expect(fetchMock).toHaveBeenCalledTimes(3); + }); + + it('preserves a matched RPC error and advances the next request ID', async () => { + fetchMock.mockImplementationOnce(async (_url, options) => { + const request = JSON.parse(options.body); + return response({ + jsonrpc: '2.0', + id: request.id, + error: { code: 3, message: 'execution reverted', data: '0x1234' }, + }); + }); + const provider = providerFor(); + await expect( + provider.send('eth_call', [{ data: '0x01' }, 'latest']) + ).rejects.toMatchObject({ + code: 3, + message: 'execution reverted', + data: '0x1234', + }); + await expect( + provider.send('eth_getBalance', [FROM, 'latest']) + ).resolves.toBe('0x5208'); + const ids = requestsFrom(fetchMock).map((request) => request.id); + expect(ids[1]).toBe(ids[0] + 1); + expect(fetchMock.mock.calls.every(([url]) => url === RPC_URL)).toBe(true); + }); + + it.each([ + 'eth_sendRawTransaction', + 'eth_sendTransaction', + 'personal_sign', + 'eth_sign', + 'eth_signTypedData_v4', + 'wallet_sendCalls', + 'eth_newFilter', + 'eth_uninstallFilter', + 'custom_read', + ])('does not retry an uncertain %s result', async (method) => { + fetchMock.mockResolvedValue( + response({ jsonrpc: '2.0', id: -1, result: '0x1234' }) + ); + await expect(providerFor().send(method, ['0x1234'])).rejects.toMatchObject({ + code: SENTINEL, + }); + expect(fetchMock).toHaveBeenCalledTimes(1); + }); + + it.each([undefined, null, '1', -1])( + 'rejects a missing or nonmatching response ID: %p', + async (id) => { + fetchMock.mockResolvedValue( + response({ jsonrpc: '2.0', id, result: '0x5208' }) + ); + await expect( + providerFor().send('eth_estimateGas', [{ from: FROM }]) + ).rejects.toMatchObject({ code: SENTINEL }); + expect(fetchMock).toHaveBeenCalledTimes(2); + } + ); + + it('checks stale errors before accepting their RPC error classification', async () => { + fetchMock.mockImplementationOnce(async () => + response({ + jsonrpc: '2.0', + id: -1, + error: { code: 3, message: 'execution reverted' }, + }) + ); + await expect( + providerFor().send('eth_getBalance', [FROM, 'latest']) + ).resolves.toBe('0x5208'); + expect(fetchMock).toHaveBeenCalledTimes(2); + }); + + it('never caches a stale chain ID', async () => { + fetchMock.mockImplementationOnce(async () => + response({ jsonrpc: '2.0', id: -1, result: '0x1' }) + ); + fetchMock.mockImplementation(async (_url, options) => + response(resultFor(JSON.parse(options.body), '0x1644')) + ); + const provider = providerFor(); + await expect(provider.send('eth_chainId', [])).resolves.toBe('0x1644'); + await expect(provider.send('eth_chainId', [])).resolves.toBe('0x1644'); + expect(fetchMock).toHaveBeenCalledTimes(2); + }); + + it('accepts reordered batches and restores request order', async () => { + fetchMock.mockImplementation(async (_url, options) => { + const requests = JSON.parse(options.body); + return response( + requests + .map((request: any, index: number) => + resultFor(request, `0x${index + 1}`) + ) + .reverse() + ); + }); + await expect( + providerFor().sendBatch('eth_getBalance', [ + [FROM, 'latest'], + [FROM, 'pending'], + ]) + ).resolves.toEqual(['0x1', '0x2']); + expect(fetchMock).toHaveBeenCalledTimes(1); + }); + + it.each(['missing', 'duplicate', 'foreign', 'string', 'object'])( + 'rejects a %s batch correlation', + async (failure) => { + fetchMock.mockImplementation(async (_url, options) => { + const requests = JSON.parse(options.body); + const replies = requests.map((request: any) => resultFor(request)); + if (failure === 'missing') replies.pop(); + if (failure === 'duplicate') replies[1].id = replies[0].id; + if (failure === 'foreign') replies[1].id = -1; + if (failure === 'string') replies[1].id = String(replies[1].id); + return response(failure === 'object' ? replies[0] : replies); + }); + await expect( + providerFor().sendBatch('eth_getBalance', [ + [FROM, 'latest'], + [FROM, 'pending'], + ]) + ).rejects.toMatchObject({ code: SENTINEL }); + expect(fetchMock).toHaveBeenCalledTimes(2); + } + ); + + it('does not retry a write batch', async () => { + fetchMock.mockResolvedValue(response([])); + await expect( + providerFor().sendBatch('eth_sendRawTransaction', [['0x01'], ['0x02']]) + ).rejects.toMatchObject({ code: SENTINEL }); + expect(fetchMock).toHaveBeenCalledTimes(1); + }); + + it('covers inherited ethers send through the same transport', async () => { + const provider = providerFor(); + fetchMock.mockImplementationOnce(async () => + response({ jsonrpc: '2.0', id: -1, result: '0x1' }) + ); + await expect( + JsonRpcProvider.prototype.send.call(provider, 'eth_blockNumber', []) + ).resolves.toBe('0x5208'); + expect(fetchMock).toHaveBeenCalledTimes(2); + }); + + it('preserves inherited caller IDs while rejecting mixed-batch retries', async () => { + const provider = providerFor(); + fetchMock.mockImplementation(async (_url, options) => { + const requests = JSON.parse(options.body); + return response( + requests.map((request: any) => resultFor(request)).reverse() + ); + }); + await expect( + provider._send([ + { + jsonrpc: '2.0', + id: 101, + method: 'eth_getBalance', + params: [FROM, 'latest'], + }, + { + jsonrpc: '2.0', + id: 102, + method: 'eth_getCode', + params: [FROM, 'latest'], + }, + ]) + ).resolves.toEqual([ + { jsonrpc: '2.0', id: 101, result: '0x5208' }, + { jsonrpc: '2.0', id: 102, result: '0x5208' }, + ]); + fetchMock.mockResolvedValue(response([])); + await expect( + provider._send([ + { + jsonrpc: '2.0', + id: 201, + method: 'eth_getBalance', + params: [FROM, 'latest'], + }, + { + jsonrpc: '2.0', + id: 202, + method: 'eth_sendRawTransaction', + params: ['0x01'], + }, + ]) + ).rejects.toMatchObject({ code: SENTINEL }); + expect(fetchMock).toHaveBeenCalledTimes(2); + }); + + it('validates the initial ethers network auto-detection reply', async () => { + fetchMock.mockResolvedValue( + response({ jsonrpc: '2.0', id: -1, result: '0x1' }) + ); + await expect(providerFor(RPC_URL, null).getNetwork()).rejects.toThrow( + SENTINEL + ); + expect(fetchMock).toHaveBeenCalledTimes(2); + }); + + it("does not reuse another provider instance's wire IDs", async () => { + let oldReply: any; + fetchMock.mockImplementation(async (_url, options) => { + const request = JSON.parse(options.body); + if (fetchMock.mock.calls.length === 1) { + oldReply = resultFor(request, RUNTIME); + return response(oldReply); + } + if (fetchMock.mock.calls.length === 2) return response(oldReply); + return response(resultFor(request)); + }); + await providerFor().send('eth_call', [{ data: '0x6000' }, 'latest']); + const gas = await sdkFor(providerFor()).getTxGasLimit({ data: '0x6000' }); + expect(gas.toString()).toBe('25200'); + const ids = requestsFrom(fetchMock).map((request) => request.id); + expect(new Set(ids).size).toBe(3); + expect(ids.every(Number.isSafeInteger)).toBe(true); + }); + + it('recovers a read batch once using fresh IDs and restores request order', async () => { + fetchMock.mockImplementation(async (_url, options) => { + const requests = JSON.parse(options.body); + if (fetchMock.mock.calls.length === 1) return response([]); + return response( + requests + .map((request: any, index: number) => + resultFor(request, `0x${index + 1}`) + ) + .reverse() + ); + }); + await expect( + providerFor().sendBatch('eth_getBalance', [ + [FROM, 'latest'], + [FROM, 'pending'], + ]) + ).resolves.toEqual(['0x1', '0x2']); + expect(fetchMock).toHaveBeenCalledTimes(2); + const [original, retry] = requestsFrom(fetchMock); + expect( + new Set([...original, ...retry].map((request) => request.id)).size + ).toBe(4); + }); + + it('repeats the original serialized read if its caller mutates a payload', async () => { + let release: (value: any) => void; + fetchMock.mockImplementationOnce( + () => + new Promise((resolve) => { + release = resolve; + }) + ); + const payload = { + jsonrpc: '2.0', + id: 71, + method: 'eth_call', + params: [{ data: '0x6000' }, 'latest'], + }; + const pending = providerFor()._send(payload); + payload.method = 'eth_sendRawTransaction'; + payload.id = 72; + (payload.params[0] as { data: string }).data = '0x01'; + release!(response({ jsonrpc: '2.0', id: -1, result: RUNTIME })); + await expect(pending).resolves.toEqual([ + { jsonrpc: '2.0', id: 71, result: '0x5208' }, + ]); + const retry = requestsFrom(fetchMock)[1]; + expect(retry.method).toBe('eth_call'); + expect(retry.params).toEqual([{ data: '0x6000' }, 'latest']); + }); + + it('preserves path, authentication, fragment and existing query bytes on recovery', async () => { + const url = + 'https://name:password@rpc.example/path/key?token=a%2Fb&space=a%20b#anchor'; + fetchMock.mockImplementationOnce(async () => + response({ jsonrpc: '2.0', id: -1, result: '0x0' }) + ); + await providerFor(url).send('eth_getBalance', [FROM, 'latest']); + const retry = new URL(fetchMock.mock.calls[1][0]); + expect(retry.origin).toBe('https://rpc.example'); + expect(retry.pathname).toBe('/path/key'); + expect(retry.username).toBe('name'); + expect(retry.password).toBe('password'); + expect(retry.hash).toBe('#anchor'); + expect(retry.search).toContain('?token=a%2Fb&space=a%20b&'); + }); + + it('stops recovery if the original AbortSignal is cancelled', async () => { + const controller = new AbortController(); + const provider = new CustomJsonRpcProvider( + controller.signal, + RPC_URL, + 5700 + ); + providers.push(provider); + fetchMock.mockImplementationOnce(async () => { + controller.abort(); + return response({ jsonrpc: '2.0', id: -1, result: '0x0' }); + }); + await expect( + provider.send('eth_getBalance', [FROM, 'latest']) + ).rejects.toMatchObject({ name: 'AbortError' }); + expect(fetchMock).toHaveBeenCalledTimes(1); + }); + + it('rejects malformed HTTP-200 JSON instead of inventing gas', async () => { + fetchMock.mockResolvedValue({ + ok: true, + status: 200, + json: async () => { + throw new SyntaxError('Unexpected end of JSON input'); + }, + }); + await expect( + sdkFor(providerFor()).getTxGasLimit({ data: '0x6000' }) + ).rejects.toMatchObject({ code: SENTINEL }); + expect(fetchMock).toHaveBeenCalledTimes(1); + }); + + it('preserves an aborted response-body read', async () => { + fetchMock.mockResolvedValue({ + ok: true, + status: 200, + json: async () => { + throw new DOMException('Body read aborted', 'AbortError'); + }, + }); + await expect( + providerFor().send('eth_call', [{ data: '0x6000' }, 'latest']) + ).rejects.toMatchObject({ name: 'AbortError' }); + expect(fetchMock).toHaveBeenCalledTimes(1); + }); + + it('keeps an aborted gas quote as cancellation', async () => { + fetchMock.mockRejectedValueOnce( + new DOMException('Estimate aborted', 'AbortError') + ); + await expect( + sdkFor(providerFor()).getTxGasLimit({ data: '0x6000' }) + ).rejects.toMatchObject({ name: 'AbortError' }); + expect(fetchMock).toHaveBeenCalledTimes(1); + }); + + it('keeps cancellation during simple-transfer gas fallback', async () => { + fetchMock.mockImplementationOnce(async (_url, options) => { + const request = JSON.parse(options.body); + return response({ + jsonrpc: '2.0', + id: request.id, + error: { code: -32000, message: 'estimate failed' }, + }); + }); + fetchMock.mockRejectedValueOnce( + new DOMException('Fallback aborted', 'AbortError') + ); + await expect( + sdkFor(providerFor()).getTxGasLimit({ from: FROM, to: FROM }) + ).rejects.toMatchObject({ name: 'AbortError' }); + expect(fetchMock).toHaveBeenCalledTimes(2); + }); + + it('keeps an aborted optional fee quote as cancellation', async () => { + const parentGetBlock = jest + .spyOn(JsonRpcProvider.prototype, 'getBlock') + .mockResolvedValue({ baseFeePerGas: 7n }); + fetchMock.mockImplementation(async (_url, options) => { + const request = JSON.parse(options.body); + if (request.method === 'eth_maxPriorityFeePerGas') + throw new DOMException('Priority fee aborted', 'AbortError'); + return response(resultFor(request, '0x7')); + }); + try { + await expect(providerFor().getFeeData()).rejects.toMatchObject({ + name: 'AbortError', + }); + } finally { + parentGetBlock.mockRestore(); + } + }); + + it('does not invent gas when the allowed recovery request cannot complete', async () => { + fetchMock.mockImplementationOnce(async () => + response({ jsonrpc: '2.0', id: -1, result: RUNTIME }) + ); + fetchMock.mockRejectedValueOnce(new TypeError('Network request failed')); + await expect( + sdkFor(providerFor()).getTxGasLimit({ data: '0x6000' }) + ).rejects.toMatchObject({ code: SENTINEL }); + expect(fetchMock).toHaveBeenCalledTimes(2); + }); + + it.each([1.5, Infinity, NaN])( + 'rejects an invalid error code without recovery: %p', + async (code) => { + fetchMock.mockImplementation(async (_url, options) => { + const request = JSON.parse(options.body); + return response({ + jsonrpc: '2.0', + id: request.id, + error: { code, message: 'invalid error' }, + }); + }); + await expect( + providerFor().send('eth_call', [{ data: '0x01' }, 'latest']) + ).rejects.toMatchObject({ code: SENTINEL }); + expect(fetchMock).toHaveBeenCalledTimes(1); + } + ); + + it.each(['baseline', 'block', 'priority', 'history'])( + 'preserves integrity failure in dynamic fee %s discovery', + async (stage) => { + const integrity = new RpcResponseIntegrityError(); + const provider = { + getGasPrice: jest.fn().mockResolvedValue(BigNumber.from(7)), + getBlock: jest.fn().mockResolvedValue({ baseFeePerGas: 7n }), + send: jest.fn().mockResolvedValue('0x2'), + }; + if (stage === 'baseline') + provider.getGasPrice.mockRejectedValueOnce(integrity); + if (stage === 'block') provider.getBlock.mockRejectedValueOnce(integrity); + if (stage === 'priority') provider.send.mockRejectedValueOnce(integrity); + if (stage === 'history') { + provider.send.mockRejectedValueOnce( + Object.assign(new Error('priority method unavailable'), { + code: -32601, + }) + ); + provider.send.mockRejectedValueOnce(integrity); + } + await expect( + sdkFor(provider).getFeeDataWithDynamicMaxPriorityFeePerGas() + ).rejects.toBe(integrity); + } + ); + + it.each([ + ['direct', 'Method not found', -32601, '0x0', '0'], + ['UNKNOWN_ERROR', 'Method not found', -32601, '0x0', '0'], + [ + 'UNSUPPORTED_OPERATION', + 'the method eth_maxPriorityFeePerGas does not exist', + -32601, + '0x2', + '3', + ], + ['UNKNOWN_ERROR', 'Method not found', 4200, '0x0', '0'], + ])( + 'uses real correlated history after %s unsupported priority normalization', + async (normalization, message, code, reward, expectedTip) => { + const provider = providerFor(); + const sdk = sdkFor(provider); + jest.spyOn(provider, 'getBlock').mockResolvedValue({ baseFeePerGas: 7n }); + if (normalization !== 'direct') { + provider.send = JsonRpcProvider.prototype.send.bind(provider); + const normalize = jest.spyOn(provider, 'getRpcError'); + normalize.mockImplementation((payload: any, error: any) => { + const result = JsonRpcProvider.prototype.getRpcError.call( + provider, + payload, + error + ); + expect(result.code).toBe(normalization); + expect(result.error?.code ?? result.info?.error?.code).toBe(code); + return result; + }); + } + fetchMock.mockImplementation(async (_url, options) => { + const request = JSON.parse(options.body); + if (request.method === 'eth_maxPriorityFeePerGas') { + return response({ + jsonrpc: '2.0', + id: request.id, + error: { code, message }, + }); + } + return response( + resultFor( + request, + request.method === 'eth_feeHistory' + ? { reward: [[reward, reward, reward]] } + : '0x7' + ) + ); + }); + const fee = await sdk.getFeeDataWithDynamicMaxPriorityFeePerGas(); + expect(fee.maxPriorityFeePerGas.toString()).toBe(expectedTip); + expect(fee.gasPrice.toString()).toBe('7'); + expect(requestsFrom(fetchMock).map((request) => request.method)).toEqual([ + 'eth_gasPrice', + 'eth_maxPriorityFeePerGas', + 'eth_feeHistory', + ]); + expect( + new Set(requestsFrom(fetchMock).map((request) => request.id)).size + ).toBe(3); + } + ); + + it.each([ + 'integrity', + 'abort', + 'network', + 'http', + 'rpc-error', + 'generic-unsupported', + ])( + 'does not use history to hide a real inherited-send %s failure', + async (failure) => { + const provider = providerFor(); + provider.send = JsonRpcProvider.prototype.send.bind(provider); + jest.spyOn(provider, 'getBlock').mockResolvedValue({ baseFeePerGas: 7n }); + const networkError = new TypeError('Network request failed'); + fetchMock.mockImplementation(async (_url, options) => { + const request = JSON.parse(options.body); + if (request.method !== 'eth_maxPriorityFeePerGas') + return response(resultFor(request, '0x7')); + if (failure === 'abort') + throw new DOMException('Priority read aborted', 'AbortError'); + if (failure === 'network') throw networkError; + const rpcError = { + jsonrpc: '2.0', + id: failure === 'integrity' ? -1 : request.id, + error: { + code: ['rpc-error', 'generic-unsupported'].includes(failure) + ? -32000 + : -32601, + message: + failure === 'generic-unsupported' + ? 'the method eth_maxPriorityFeePerGas does not exist' + : 'Method not found', + }, + }; + return failure === 'http' + ? { ...response(rpcError), ok: false, status: 503 } + : response(rpcError); + }); + const quote = + sdkFor(provider).getFeeDataWithDynamicMaxPriorityFeePerGas(); + if (failure === 'integrity') + await expect(quote).rejects.toMatchObject({ code: SENTINEL }); + else if (failure === 'abort') + await expect(quote).rejects.toMatchObject({ name: 'AbortError' }); + else if (failure === 'network') + await expect(quote).rejects.toBe(networkError); + else await expect(quote).rejects.toThrow(); + expect( + requestsFrom(fetchMock).some( + (request) => request.method === 'eth_feeHistory' + ) + ).toBe(false); + } + ); + + it.each([ + { + code: 'UNKNOWN_ERROR', + error: { code: -32601 }, + payload: { method: 'eth_getBalance', params: [] }, + }, + { code: 'UNKNOWN_ERROR', error: { code: -32601 } }, + { code: 'UNSUPPORTED_OPERATION', operation: 'eth_maxPriorityFeePerGas' }, + { + code: 'NETWORK_ERROR', + error: { code: -32601 }, + payload: { method: 'eth_maxPriorityFeePerGas', params: [] }, + }, + { + code: 'UNKNOWN_ERROR', + error: { code: -32601 }, + payload: { method: 'eth_maxPriorityFeePerGas', params: ['unexpected'] }, + }, + { + code: 'UNSUPPORTED_OPERATION', + operation: 'eth_getBalance', + info: { + error: { code: -32601 }, + payload: { method: 'eth_maxPriorityFeePerGas', params: [] }, + }, + }, + { + code: 'UNKNOWN_ERROR', + error: { name: 'AbortError', code: -32601 }, + payload: { method: 'eth_maxPriorityFeePerGas', params: [] }, + }, + ])( + 'rejects an unsupported-looking wrapper without the matching priority RPC evidence: %p', + async (error) => { + const provider = { + getGasPrice: jest.fn().mockResolvedValue(BigNumber.from(7)), + getBlock: jest.fn().mockResolvedValue({ baseFeePerGas: 7n }), + send: jest.fn().mockRejectedValue(error), + }; + await expect( + sdkFor(provider).getFeeDataWithDynamicMaxPriorityFeePerGas() + ).rejects.toBe(error); + expect(provider.send).toHaveBeenCalledTimes(1); + } + ); + + it('does not replace an integrity error with legacy fees', async () => { + const provider = { + getGasPrice: jest.fn().mockResolvedValue(BigNumber.from(7)), + }; + const sdk = sdkFor(provider); + const integrity = new RpcResponseIntegrityError(); + jest + .spyOn(sdk, 'getFeeDataWithDynamicMaxPriorityFeePerGas') + .mockRejectedValueOnce(integrity); + await expect(sdk.getSafeFeeData()).rejects.toBe(integrity); + expect(provider.getGasPrice).not.toHaveBeenCalled(); + }); + + it.each(['eth_gasPrice', 'eth_maxPriorityFeePerGas'])( + 'preserves an inherited optional %s integrity failure', + async (method) => { + const parentGetBlock = jest + .spyOn(JsonRpcProvider.prototype, 'getBlock') + .mockResolvedValue({ baseFeePerGas: 7n }); + fetchMock.mockImplementation(async (_url, options) => { + const request = JSON.parse(options.body); + return response( + resultFor({ id: request.method === method ? -1 : request.id }, '0x2') + ); + }); + try { + await expect(providerFor().getFeeData()).rejects.toMatchObject({ + code: SENTINEL, + }); + } finally { + parentGetBlock.mockRestore(); + } + } + ); + + it('does not fabricate a one-gwei priority fee when the method is unsupported', async () => { + const parentGetBlock = jest + .spyOn(JsonRpcProvider.prototype, 'getBlock') + .mockResolvedValue({ baseFeePerGas: 7n }); + fetchMock.mockImplementation(async (_url, options) => { + const request = JSON.parse(options.body); + return response( + request.method === 'eth_maxPriorityFeePerGas' + ? { + jsonrpc: '2.0', + id: request.id, + error: { code: -32601, message: 'unsupported method' }, + } + : resultFor(request, '0x7') + ); + }); + try { + await expect(providerFor().getFeeData()).rejects.toThrow( + 'fee data unavailable' + ); + expect(fetchMock).toHaveBeenCalledTimes(2); + } finally { + parentGetBlock.mockRestore(); + } + }); + + it('preserves network fee plugin discovery and its provider/request arguments', async () => { + const parentGetBlock = jest + .spyOn(JsonRpcProvider.prototype, 'getBlock') + .mockResolvedValue({ baseFeePerGas: 7n }); + const provider = providerFor(); + const plugin = { + url: 'https://fees.example/quote', + processFunc: jest.fn(async (reader, observedProvider, request) => { + expect(observedProvider).toBe(provider); + expect(request.url).toBe('https://fees.example/quote'); + const standard = await reader(); + return { ...standard, maxFeePerGas: 99n, maxPriorityFeePerGas: 11n }; + }), + }; + jest + .spyOn(provider, 'getNetwork') + .mockResolvedValue({ getPlugin: () => plugin }); + try { + await expect(provider.getFeeData()).resolves.toEqual({ + gasPrice: BigNumber.from(21000), + maxFeePerGas: BigNumber.from(99), + maxPriorityFeePerGas: BigNumber.from(11), + }); + expect(plugin.processFunc).toHaveBeenCalledTimes(1); + } finally { + parentGetBlock.mockRestore(); + } + }); + + it.each(['', true, false, Number.MAX_SAFE_INTEGER + 1, null])( + 'keeps ethers fallback for malformed optional gas price: %p', + async (value) => { + const parentGetBlock = jest + .spyOn(JsonRpcProvider.prototype, 'getBlock') + .mockResolvedValue({ baseFeePerGas: 7n }); + fetchMock.mockImplementation(async (_url, options) => { + const request = JSON.parse(options.body); + return response( + resultFor(request, request.method === 'eth_gasPrice' ? value : '0x2') + ); + }); + try { + await expect(providerFor().getFeeData()).resolves.toEqual({ + gasPrice: null, + maxFeePerGas: BigNumber.from(16), + maxPriorityFeePerGas: BigNumber.from(2), + }); + } finally { + parentGetBlock.mockRestore(); + } + } + ); + + it.each(['', true, false, Number.MAX_SAFE_INTEGER + 1, null])( + 'does not invent a quote for malformed optional priority fee: %p', + async (value) => { + const parentGetBlock = jest + .spyOn(JsonRpcProvider.prototype, 'getBlock') + .mockResolvedValue({ baseFeePerGas: 7n }); + fetchMock.mockImplementation(async (_url, options) => { + const request = JSON.parse(options.body); + return response( + resultFor( + request, + request.method === 'eth_maxPriorityFeePerGas' ? value : '0x7' + ) + ); + }); + try { + await expect(providerFor().getFeeData()).rejects.toThrow( + 'fee data unavailable' + ); + } finally { + parentGetBlock.mockRestore(); + } + } + ); + + it.each([0n, 7n])( + 'retains an RPC zero tip on an EIP-1559 header with base fee %p', + async (baseFeePerGas) => { + const parentGetBlock = jest + .spyOn(JsonRpcProvider.prototype, 'getBlock') + .mockResolvedValue({ baseFeePerGas }); + fetchMock.mockImplementation(async (_url, options) => { + const request = JSON.parse(options.body); + return response( + resultFor( + request, + request.method === 'eth_maxPriorityFeePerGas' ? '0x0' : '0x7' + ) + ); + }); + try { + await expect(providerFor().getFeeData()).resolves.toEqual({ + gasPrice: BigNumber.from(7), + maxFeePerGas: BigNumber.from(baseFeePerGas * 2n), + maxPriorityFeePerGas: BigNumber.from(0), + }); + expect(fetchMock).toHaveBeenCalledTimes(2); + } finally { + parentGetBlock.mockRestore(); + } + } + ); + + it.each(['integrity', 'abort'])( + 'preserves %s through the real Polygon fee-plugin wrapper', + async (failure) => { + const parentGetBlock = jest + .spyOn(JsonRpcProvider.prototype, 'getBlock') + .mockResolvedValue({ baseFeePerGas: 7n }); + const gasStation = jest + .spyOn(FetchRequest.prototype, 'send') + .mockResolvedValue({ + bodyJson: { standard: { maxFee: 3, maxPriorityFee: 1 } }, + }); + const provider = providerFor(); + jest.spyOn(provider, 'getNetwork').mockResolvedValue(Network.from(137)); + fetchMock.mockImplementation(async (_url, options) => { + const request = JSON.parse(options.body); + if (request.method === 'eth_maxPriorityFeePerGas') { + if (failure === 'abort') + throw new DOMException('Fee read cancelled', 'AbortError'); + return response(resultFor({ id: -1 }, '0x2')); + } + return response(resultFor(request, '0x7')); + }); + try { + await expect( + sdkFor(provider).getTxGasLimit({ + from: FROM, + data: '0x6000', + type: 0, + }) + ).rejects.toMatchObject( + failure === 'integrity' ? { code: SENTINEL } : { name: 'AbortError' } + ); + expect(gasStation).toHaveBeenCalledTimes(1); + } finally { + gasStation.mockRestore(); + parentGetBlock.mockRestore(); + } + } + ); + + it('retains the real Polygon gas-station fee values on a healthy read', async () => { + const parentGetBlock = jest + .spyOn(JsonRpcProvider.prototype, 'getBlock') + .mockResolvedValue({ baseFeePerGas: 7n }); + const gasStation = jest + .spyOn(FetchRequest.prototype, 'send') + .mockResolvedValue({ + bodyJson: { standard: { maxFee: 3, maxPriorityFee: 1 } }, + }); + const provider = providerFor(); + jest.spyOn(provider, 'getNetwork').mockResolvedValue(Network.from(137)); + try { + await expect(provider.getFeeData()).resolves.toEqual({ + gasPrice: BigNumber.from(21000), + maxFeePerGas: BigNumber.from('3000000000'), + maxPriorityFeePerGas: BigNumber.from('1000000000'), + }); + expect(gasStation).toHaveBeenCalledTimes(1); + } finally { + gasStation.mockRestore(); + parentGetBlock.mockRestore(); + } + }); +}); diff --git a/packages/sysweb3-keyring/test/unit/providers.spec.ts b/packages/sysweb3-keyring/test/unit/providers.spec.ts new file mode 100644 index 00000000..eb46302b --- /dev/null +++ b/packages/sysweb3-keyring/test/unit/providers.spec.ts @@ -0,0 +1,208 @@ +import { + BigNumber, + JsonRpcProvider, + normalizeTransactionRequest, +} from '../../src/ethers-v6'; + +const { CustomJsonRpcProvider, wrapTransactionResponse } = jest.requireActual( + '../../src/providers' +); + +describe('CustomJsonRpcProvider', () => { + it('wraps read-only transaction response numeric fields without redefining them', async () => { + const transaction = { + chainId: 57n, + hash: '0x1234567890123456789012345678901234567890123456789012345678901234', + from: '0x0000000000000000000000000000000000000001', + to: '0x0000000000000000000000000000000000000002', + nonce: 7, + blockNumber: 10, + wait: jest.fn().mockResolvedValue({ + status: 1, + gasUsed: 21000n, + cumulativeGasUsed: 42000n, + gasPrice: 7n, + }), + }; + Object.defineProperty(transaction, 'gasLimit', { + value: 21000n, + enumerable: true, + configurable: false, + }); + + const wrapped = wrapTransactionResponse(transaction); + + expect(wrapped.chainId).toBe(57); + expect(wrapped.gasLimit).toEqual(BigNumber.from(21000)); + expect({ ...wrapped }).toMatchObject({ + chainId: 57, + hash: transaction.hash, + from: transaction.from, + to: transaction.to, + nonce: transaction.nonce, + blockNumber: transaction.blockNumber, + }); + expect(() => JSON.stringify(wrapped)).not.toThrow(); + + const receipt = await wrapped.wait(); + expect(receipt.status).toBe(1); + expect(receipt.gasUsed).toEqual(BigNumber.from(21000)); + expect(receipt.cumulativeGasUsed).toEqual(BigNumber.from(42000)); + expect(receipt.gasPrice).toEqual(BigNumber.from(7)); + expect(() => JSON.stringify(receipt)).not.toThrow(); + expect(transaction.wait).toHaveBeenCalledTimes(1); + }); + + it('normalizes JSON-RPC transaction type values to numbers', () => { + expect(normalizeTransactionRequest({ type: '0x0' }).type).toBe(0); + expect(normalizeTransactionRequest({ type: '0x1' }).type).toBe(1); + }); + + it('rejects unsafe numeric transaction values', () => { + expect(() => + normalizeTransactionRequest({ + gasLimit: Number.MAX_SAFE_INTEGER + 1, + }) + ).toThrow('unsafe numeric transaction value'); + expect(() => + normalizeTransactionRequest({ + nonce: Number.MAX_SAFE_INTEGER + 1, + }) + ).toThrow('unsafe numeric transaction value'); + expect(() => + normalizeTransactionRequest({ + type: Number.MAX_SAFE_INTEGER + 1, + }) + ).toThrow('unsafe numeric transaction value'); + }); + + it('populates EIP-1559 fees for zero-base-fee blocks', async () => { + const parentGetBlock = jest + .spyOn(JsonRpcProvider.prototype, 'getBlock') + .mockResolvedValue({ baseFeePerGas: 0n }); + const provider = new CustomJsonRpcProvider( + new AbortController().signal, + 'https://rpc.example', + 5700 + ); + const providerNetwork = jest + .spyOn(provider, 'getNetwork') + .mockResolvedValue({ getPlugin: () => null }); + const providerPerform = jest + .spyOn(provider, '_perform') + .mockImplementation(async ({ method }) => { + return method === 'getGasPrice' ? '0x7' : '0x2'; + }); + const providerSend = jest.spyOn(provider, 'send').mockResolvedValue('0x2'); + + try { + await expect(provider.getFeeData()).resolves.toEqual({ + gasPrice: BigNumber.from(7), + maxFeePerGas: BigNumber.from(2), + maxPriorityFeePerGas: BigNumber.from(2), + }); + } finally { + parentGetBlock.mockRestore(); + providerNetwork.mockRestore(); + providerPerform.mockRestore(); + providerSend.mockRestore(); + } + }); + + it('coalesces concurrent fee data requests and briefly reuses the result', async () => { + const parentGetBlock = jest + .spyOn(JsonRpcProvider.prototype, 'getBlock') + .mockResolvedValue({ baseFeePerGas: 3n }); + const provider = new CustomJsonRpcProvider( + new AbortController().signal, + 'https://rpc.example', + 5700 + ); + jest + .spyOn(provider, 'getNetwork') + .mockResolvedValue({ getPlugin: () => null }); + const providerPerform = jest + .spyOn(provider, '_perform') + .mockImplementation(async ({ method }) => { + return method === 'getGasPrice' ? '0x7' : '0x3'; + }); + + try { + const [first, second] = await Promise.all([ + provider.getFeeData(), + provider.getFeeData(), + ]); + const third = await provider.getFeeData(); + + expect(parentGetBlock).toHaveBeenCalledTimes(1); + expect(providerPerform).toHaveBeenCalledTimes(2); + expect(first).toEqual({ + gasPrice: BigNumber.from(7), + maxFeePerGas: BigNumber.from(9), + maxPriorityFeePerGas: BigNumber.from(3), + }); + expect(second).toBe(first); + expect(third).toBe(first); + } finally { + parentGetBlock.mockRestore(); + providerPerform.mockRestore(); + } + }); + + it('fetches gas price without running full ethers fee discovery', async () => { + const parentFeeData = jest + .spyOn(JsonRpcProvider.prototype, 'getFeeData') + .mockRejectedValue(new Error('unexpected fee data call')); + const provider = new CustomJsonRpcProvider(new AbortController().signal); + const providerSend = jest.spyOn(provider, 'send').mockResolvedValue('0x07'); + + try { + await expect(provider.getGasPrice()).resolves.toEqual(BigNumber.from(7)); + expect(parentFeeData).not.toHaveBeenCalled(); + expect(providerSend).toHaveBeenCalledWith('eth_gasPrice', []); + } finally { + parentFeeData.mockRestore(); + providerSend.mockRestore(); + } + }); + + it('forwards block tags for balance requests', async () => { + const parentGetBalance = jest + .spyOn(JsonRpcProvider.prototype, 'getBalance') + .mockResolvedValue(123n); + const provider = new CustomJsonRpcProvider(new AbortController().signal); + const address = '0x0000000000000000000000000000000000000001'; + + try { + await expect(provider.getBalance(address, 'pending')).resolves.toEqual( + BigNumber.from(123) + ); + + expect(parentGetBalance).toHaveBeenCalledWith(address, 'pending'); + } finally { + parentGetBalance.mockRestore(); + } + }); + + it('forwards block tags for eth_call requests', async () => { + const parentCall = jest + .spyOn(JsonRpcProvider.prototype, 'call') + .mockResolvedValue('0x'); + const provider = new CustomJsonRpcProvider(new AbortController().signal); + const transaction = { + to: '0x0000000000000000000000000000000000000001', + data: '0x', + }; + + try { + await expect(provider.call(transaction, 'pending')).resolves.toBe('0x'); + + expect(parentCall).toHaveBeenCalledWith({ + ...transaction, + blockTag: 'pending', + }); + } finally { + parentCall.mockRestore(); + } + }); +}); diff --git a/packages/sysweb3-keyring/test/unit/storage-core.spec.ts b/packages/sysweb3-keyring/test/unit/storage-core.spec.ts new file mode 100644 index 00000000..5cb48b63 --- /dev/null +++ b/packages/sysweb3-keyring/test/unit/storage-core.spec.ts @@ -0,0 +1,416 @@ +import { webcrypto } from 'crypto'; +import CryptoJS from 'crypto-js'; + +import { + createVaultPersistence, + VaultAuthenticationError, +} from '../../src/storage-core'; + +import type { VaultStoragePort } from '../../src/storage-core'; + +const key = '11'.repeat(32); +const wrongKey = '22'.repeat(32); +const vault = { mnemonic: 'public test fixture', accounts: { imported: [] } }; + +const deferred = () => { + let resolve!: () => void; + const promise = new Promise((yes) => { + resolve = yes; + }); + return { promise, resolve }; +}; + +const createStorage = () => { + const records = new Map(); + const port: VaultStoragePort = { + get: jest.fn(async (name) => records.get(name)), + set: jest.fn(async (name, value) => { + records.set(name, value); + }), + createManyIfAbsent: jest.fn(async (items) => { + // This test backend's entire conditional commit runs synchronously. + if (Object.keys(items).some((name) => records.has(name))) return false; + Object.entries(items).forEach(([name, value]) => + records.set(name, value) + ); + return true; + }), + }; + return { records, port }; +}; + +describe('host-owned vault persistence', () => { + let cryptoDescriptor: PropertyDescriptor | undefined; + + beforeEach(() => { + cryptoDescriptor = Object.getOwnPropertyDescriptor(globalThis, 'crypto'); + Object.defineProperty(globalThis, 'crypto', { + configurable: true, + value: webcrypto, + }); + }); + + afterEach(() => { + jest.restoreAllMocks(); + if (cryptoDescriptor) { + Object.defineProperty(globalThis, 'crypto', cryptoDescriptor); + } else { + delete (globalThis as any).crypto; + } + }); + + it('imports without loading global storage or hardware modules', () => { + jest.resetModules(); + const unexpectedImport = () => { + throw new Error('Unexpected host dependency'); + }; + jest.doMock('@sidhujag/sysweb3-core', unexpectedImport); + jest.doMock( + '../../src/hardware-wallet-manager-singleton', + unexpectedImport + ); + try { + jest.isolateModules(() => { + expect( + typeof require('../../src/storage-core').createVaultPersistence + ).toBe('function'); + }); + } finally { + jest.dontMock('@sidhujag/sysweb3-core'); + jest.dontMock('../../src/hardware-wallet-manager-singleton'); + } + }); + + it.each(['get', 'set', 'createManyIfAbsent'])( + 'rejects a missing %s port before any vault operation', + (method) => { + const { port } = createStorage(); + expect(() => + createVaultPersistence({ ...port, [method]: undefined } as any) + ).toThrow( + 'Vault storage port must provide get, set, and createManyIfAbsent methods' + ); + expect(port.get).not.toHaveBeenCalled(); + expect(port.set).not.toHaveBeenCalled(); + expect(port.createManyIfAbsent).not.toHaveBeenCalled(); + } + ); + + it.each([null, undefined])('rejects an absent storage port (%s)', (port) => { + expect(() => createVaultPersistence(port as any)).toThrow(TypeError); + }); + + it('keeps independent authorities isolated and preserves the v4 envelope', async () => { + const first = createStorage(); + const second = createStorage(); + const firstVault = createVaultPersistence(first.port); + const secondVault = createVaultPersistence(second.port); + await Promise.all([ + firstVault.setEncryptedVault(vault, key), + secondVault.setEncryptedVault({ owner: 'second' }, key), + ]); + await expect(firstVault.getDecryptedVault(key)).resolves.toEqual(vault); + await expect(secondVault.getDecryptedVault(key)).resolves.toEqual({ + owner: 'second', + }); + const stored = JSON.parse(first.records.get('vault') as string); + expect(Object.keys(stored).sort()).toEqual(['alg', 'ct', 'iv', 'v']); + expect(stored).toMatchObject({ v: 4, alg: 'A256GCM' }); + expect(stored.iv).toMatch(/^[0-9a-f]{24}$/); + expect(stored.ct).toMatch(/^[0-9a-f]+$/); + const cryptoKey = await webcrypto.subtle.importKey( + 'raw', + Buffer.from(key, 'hex'), + 'AES-GCM', + false, + ['decrypt'] + ); + const plaintext = await webcrypto.subtle.decrypt( + { name: 'AES-GCM', iv: Buffer.from(stored.iv, 'hex') }, + cryptoKey, + Buffer.from(stored.ct, 'hex') + ); + expect(JSON.parse(Buffer.from(plaintext).toString('utf8'))).toEqual(vault); + }); + + it('serializes reads and writes through one authority until storage completes', async () => { + const { port } = createStorage(); + const persistence = createVaultPersistence(port); + const entered = deferred(); + const release = deferred(); + const set = port.set; + jest.spyOn(port, 'set').mockImplementationOnce(async (name, value) => { + entered.resolve(); + await release.promise; + await set(name, value); + }); + const first = persistence.setEncryptedVault({ sequence: 1 }, key); + await entered.promise; + const read = persistence.getDecryptedVault(key); + const second = persistence.setEncryptedVault({ sequence: 2 }, key); + await Promise.resolve(); + expect(port.get).not.toHaveBeenCalled(); + expect(port.set).toHaveBeenCalledTimes(1); + release.resolve(); + await first; + await expect(read).resolves.toEqual({ sequence: 1 }); + await second; + await expect(persistence.getDecryptedVault(key)).resolves.toEqual({ + sequence: 2, + }); + }); + + it('does not block a separate authority behind another authority storage read', async () => { + const first = createStorage(); + const second = createStorage(); + const entered = deferred(); + const release = deferred(); + jest.spyOn(first.port, 'get').mockImplementationOnce(async () => { + entered.resolve(); + await release.promise; + return undefined; + }); + const blocked = createVaultPersistence(first.port).getDecryptedVault(key); + const missing = expect(blocked).rejects.toThrow('Vault not found'); + await entered.promise; + const other = createVaultPersistence(second.port); + await other.setEncryptedVault(vault, key); + await expect(other.getDecryptedVault(key)).resolves.toEqual(vault); + release.resolve(); + await missing; + }); + + it('awaits an asynchronous read and preserves storage errors without reclassification', async () => { + const { port } = createStorage(); + const persistence = createVaultPersistence(port); + await persistence.setEncryptedVault(vault, key); + const error = Object.assign(new Error('Storage unavailable'), { + code: 'INVALID_PASSWORD', + }); + jest.spyOn(port, 'get').mockRejectedValueOnce(error); + await expect(persistence.getDecryptedVault(key)).rejects.toBe(error); + await expect(persistence.getDecryptedVault(key)).resolves.toEqual(vault); + }); + + it('propagates a rejected write and releases the authority mutex', async () => { + const { port } = createStorage(); + const persistence = createVaultPersistence(port); + const error = new Error('Write rejected'); + jest.spyOn(port, 'set').mockRejectedValueOnce(error); + await expect(persistence.setEncryptedVault(vault, key)).rejects.toBe(error); + await persistence.setEncryptedVault(vault, key); + await expect(persistence.getDecryptedVault(key)).resolves.toEqual(vault); + }); + + it('does not report success when a committed write loses its acknowledgement', async () => { + const { port, records } = createStorage(); + const persistence = createVaultPersistence(port); + const error = new Error('Commit acknowledgement lost'); + jest.spyOn(port, 'set').mockImplementationOnce(async (name, value) => { + records.set(name, value); + throw error; + }); + await expect(persistence.setEncryptedVault(vault, key)).rejects.toBe(error); + await expect(persistence.getDecryptedVault(key)).resolves.toEqual(vault); + }); + + it('creates vault and salt in exactly one conditional batch and awaits completion', async () => { + const { port, records } = createStorage(); + const persistence = createVaultPersistence(port); + const entered = deferred(); + const release = deferred(); + const create = port.createManyIfAbsent; + jest + .spyOn(port, 'createManyIfAbsent') + .mockImplementationOnce(async (items) => { + entered.resolve(); + await release.promise; + return create(items); + }); + let settled = false; + const pending = persistence + .setEncryptedVault(vault, key, { salt: 'salt' }) + .then(() => { + settled = true; + }); + await entered.promise; + expect(settled).toBe(false); + expect(port.set).not.toHaveBeenCalled(); + expect(port.get).not.toHaveBeenCalled(); + expect(records.size).toBe(0); + expect(port.createManyIfAbsent).toHaveBeenCalledTimes(1); + release.resolve(); + await pending; + expect(records.get('vault-keys')).toEqual({ salt: 'salt' }); + expect(records.get('vault')).toEqual(expect.any(String)); + }); + + it('relies on atomic creation across independent authorities sharing one backend', async () => { + const { port, records } = createStorage(); + const first = createVaultPersistence(port); + const second = createVaultPersistence(port); + const results = await Promise.allSettled([ + first.setEncryptedVault({ owner: 'first' }, key, { salt: 'first' }), + second.setEncryptedVault({ owner: 'second' }, key, { salt: 'second' }), + ]); + expect( + results.filter((result) => result.status === 'fulfilled') + ).toHaveLength(1); + const rejected = results.find( + (result) => result.status === 'rejected' + ) as PromiseRejectedResult; + expect(rejected.reason.message).toBe( + 'Cannot initialize a new vault over existing wallet storage' + ); + const persisted = await first.getDecryptedVault(key); + expect(records.get('vault-keys')).toEqual({ salt: persisted.owner }); + expect(records.size).toBe(2); + expect(port.set).not.toHaveBeenCalled(); + }); + + it.each(['vault', 'vault-keys'])( + 'preserves an existing %s record on conditional create failure', + async (existing) => { + const { port, records } = createStorage(); + records.set(existing, 'existing data'); + await expect( + createVaultPersistence(port).setEncryptedVault(vault, key, { + salt: 'new', + }) + ).rejects.toThrow( + 'Cannot initialize a new vault over existing wallet storage' + ); + expect(Array.from(records.entries())).toEqual([ + [existing, 'existing data'], + ]); + expect(port.set).not.toHaveBeenCalled(); + } + ); + + it('rejects invalid atomic results and never falls back to sequential writes', async () => { + const { port } = createStorage(); + jest.spyOn(port, 'createManyIfAbsent').mockResolvedValueOnce('true' as any); + await expect( + createVaultPersistence(port).setEncryptedVault(vault, key, { + salt: 'salt', + }) + ).rejects.toThrow('Atomic storage creation returned an invalid result'); + expect(port.set).not.toHaveBeenCalled(); + }); + + it('preserves atomic creation failures', async () => { + const { port } = createStorage(); + const error = new Error('Atomic creation unavailable'); + jest.spyOn(port, 'createManyIfAbsent').mockRejectedValueOnce(error); + await expect( + createVaultPersistence(port).setEncryptedVault(vault, key, { + salt: 'salt', + }) + ).rejects.toBe(error); + expect(port.set).not.toHaveBeenCalled(); + }); + + it('does not write or downgrade encryption when WebCrypto is missing', async () => { + const { port } = createStorage(); + Object.defineProperty(globalThis, 'crypto', { + configurable: true, + value: {}, + }); + await expect( + createVaultPersistence(port).setEncryptedVault(vault, key) + ).rejects.toThrow('WebCrypto is required for vault encryption'); + expect(port.set).not.toHaveBeenCalled(); + expect(port.createManyIfAbsent).not.toHaveBeenCalled(); + }); + + it('preserves the authentication error class and rejects a damaged GCM tag', async () => { + const { port, records } = createStorage(); + const persistence = createVaultPersistence(port); + await persistence.setEncryptedVault(vault, key); + await expect( + persistence.getDecryptedVault(wrongKey) + ).rejects.toBeInstanceOf(VaultAuthenticationError); + const envelope = JSON.parse(records.get('vault') as string); + envelope.ct = + envelope.ct.slice(0, -2) + (envelope.ct.endsWith('00') ? '01' : '00'); + records.set('vault', JSON.stringify(envelope)); + await expect(persistence.getDecryptedVault(key)).rejects.toMatchObject({ + name: 'VaultAuthenticationError', + code: 'INVALID_PASSWORD', + message: 'Failed to decrypt vault - invalid password or corrupted data', + }); + }); + + it('preserves malformed-envelope and WebCrypto operational failures', async () => { + const { port, records } = createStorage(); + const persistence = createVaultPersistence(port); + records.set('vault', '{"v":99}'); + await expect(persistence.getDecryptedVault(key)).rejects.toThrow( + 'Invalid encrypted vault format' + ); + await persistence.setEncryptedVault(vault, key); + const error = new Error('Key import unavailable'); + jest.spyOn(webcrypto.subtle, 'importKey').mockRejectedValueOnce(error); + await expect(persistence.getDecryptedVault(key)).rejects.toBe(error); + }); + + it.each(['legacy-password', key])( + 'reads legacy CBC records with either migration key (%s)', + async (storedKey) => { + const { port, records } = createStorage(); + const ciphertext = CryptoJS.AES.encrypt( + JSON.stringify(vault), + storedKey + ).toString(); + records.set('vault', ciphertext); + const persistence = createVaultPersistence(port); + await expect( + persistence.getDecryptedVault(key, 'legacy-password') + ).resolves.toEqual(vault); + expect(records.get('vault')).toBe(ciphertext); + await expect( + persistence.getDecryptedVault(wrongKey, 'incorrect') + ).rejects.toBeInstanceOf(VaultAuthenticationError); + } + ); + + it('keeps legacy wrapper calls on one captured storage authority and the same error class', async () => { + jest.resetModules(); + const first = createStorage(); + const second = createStorage(); + let selected = first.port; + const getStateStorageDb = jest.fn(() => selected); + jest.doMock('@sidhujag/sysweb3-core', () => ({ + sysweb3Di: { getStateStorageDb }, + })); + let legacy!: typeof import('../../src/storage'); + let core!: typeof import('../../src/storage-core'); + try { + jest.isolateModules(() => { + legacy = require('../../src/storage'); + core = require('../../src/storage-core'); + }); + expect(legacy.VaultAuthenticationError).toBe( + core.VaultAuthenticationError + ); + selected = second.port; + await legacy.setEncryptedVault(vault, key, { salt: 'legacy' }); + await expect( + core.createVaultPersistence(first.port).getDecryptedVault(key) + ).resolves.toEqual(vault); + await core + .createVaultPersistence(first.port) + .setEncryptedVault({ owner: 'core' }, key); + await expect(legacy.getDecryptedVault(key)).resolves.toEqual({ + owner: 'core', + }); + await expect(legacy.getDecryptedVault(wrongKey)).rejects.toBeInstanceOf( + core.VaultAuthenticationError + ); + expect(getStateStorageDb).toHaveBeenCalledTimes(1); + expect(second.records.size).toBe(0); + } finally { + jest.dontMock('@sidhujag/sysweb3-core'); + } + }); +}); diff --git a/packages/sysweb3-keyring/test/unit/transactions/bip84-native-plan.spec.ts b/packages/sysweb3-keyring/test/unit/transactions/bip84-native-plan.spec.ts new file mode 100644 index 00000000..b6890c44 --- /dev/null +++ b/packages/sysweb3-keyring/test/unit/transactions/bip84-native-plan.spec.ts @@ -0,0 +1,526 @@ +import { Transaction, address, networks } from 'bitcoinjs-lib'; +import { encode as encodeVarInt } from 'varuint-bitcoin'; + +import { + prepareBip84NativeTransaction, + Bip84NativeError, +} from '../../../src/bip84-native'; +import { + deriveBip84PublicAddress, + parseBip84PublicAccount, +} from '../../../src/public-bip84'; + +import type { Bip84NativePlan } from '../../../src/bip84-native'; + +const key = + 'zpub6rFR7y4Q2AijBEqTUquhVz398htDFrtymD9xYYfG1m4wAcvPhXNfE3EfH1r1ADqtfSdVCToUG868RvUUkgDKf31mGDtKsAYz2oz2AGutZYs'; +const account = parseBip84PublicAccount({ + network: 'bitcoin', + accountKey: key, +}); +const receive = deriveBip84PublicAddress({ + network: 'bitcoin', + accountKey: key, + branch: 0, + index: 0, +}); +function parent(value = 100_000n, version = 2, nonce = 1) { + const tx = new Transaction(); + tx.version = version; + tx.addInput(Buffer.alloc(32, nonce), 0); + tx.addOutput(Buffer.from(receive.scriptPubKey, 'hex'), value); + return tx; +} +function fixture(tx = parent()): Bip84NativePlan { + return { + network: { network: 'bitcoin', endpoint: 'https://offline.invalid' }, + account, + inputs: [{ txid: tx.getId(), vout: 0, branch: 0, index: 0 }], + previousTransactions: [{ txid: tx.getId(), rawTransaction: tx.toHex() }], + recipient: { address: receive.address, valueSatoshis: '90000' }, + change: { index: 4, valueSatoshis: '9000' }, + locktime: 0, + rbf: true, + feeLimits: { maxFeeSatoshis: '1000', maxFeeRateSatPerVByte: '1000' }, + }; +} +const copy = (v: T): T => JSON.parse(JSON.stringify(v)); +function witnessParent( + tx: Transaction, + items: readonly number[], + width?: 4 | 8, + nonempty = false +) { + const count = (n: number) => { + if (!width) return Buffer.from(encodeVarInt(n).buffer).toString('hex'); + const bytes = Buffer.alloc(width + 1); + bytes[0] = width === 4 ? 0xfe : 0xff; + if (width === 4) bytes.writeUInt32LE(n, 1); + else bytes.writeBigUInt64LE(BigInt(n), 1); + return bytes.toString('hex'); + }; + const raw = tx.toHex(); + return ( + raw.slice(0, 8) + + '0001' + + raw.slice(8, -8) + + items.map((n) => count(n) + (nonempty ? '01aa' : '00').repeat(n)).join('') + + raw.slice(-8) + ); +} +function expectResourceRejectionBeforeDecode(plan: Bip84NativePlan) { + const decode = jest.spyOn(Transaction, 'fromBuffer'); + try { + expect(() => prepareBip84NativeTransaction(plan)).toThrow('LIMIT_EXCEEDED'); + expect(decode).not.toHaveBeenCalled(); + } finally { + decode.mockRestore(); + } +} +const expectFailure = (v: unknown, code?: string) => { + expect(() => prepareBip84NativeTransaction(v as Bip84NativePlan)).toThrow( + code || Bip84NativeError + ); +}; + +test('prepares exact ordered outputs, fee, version and sequence with no shared mutable results', () => { + const input = fixture(); + const prepared = prepareBip84NativeTransaction(input); + const tx = Transaction.fromHex(prepared.unsignedTransaction); + expect(prepared.feeSatoshis).toBe('1000'); + expect(tx.version).toBe(2); + expect(tx.locktime).toBe(0); + expect(tx.ins[0].sequence).toBe(0xfffffffd); + expect(tx.outs.map((o) => o.value)).toEqual([90000n, 9000n]); + expect(address.fromOutputScript(tx.outs[1].script, networks.bitcoin)).toBe( + deriveBip84PublicAddress({ + network: 'bitcoin', + accountKey: key, + branch: 1, + index: 4, + }).address + ); + expect(Object.isFrozen(prepared)).toBe(true); + expect(Object.isFrozen(prepared.plan)).toBe(true); + for (const value of [ + prepared.plan.inputs, + prepared.plan.inputs[0], + prepared.plan.previousTransactions, + prepared.plan.previousTransactions[0], + prepared.plan.recipient, + prepared.plan.change, + prepared.plan.feeLimits, + prepared.plan.network, + prepared.plan.account, + ]) + expect(Object.isFrozen(value)).toBe(true); + (input.inputs[0] as any).index = 1; + expect(prepared.plan.inputs[0].index).toBe(0); + expect(() => { + (prepared.plan.inputs[0] as any).index = 7; + }).toThrow(); + expect(prepared).not.toHaveProperty('psbt'); +}); + +test('supports exact SYS encoding and no-change, zero-fee, non-RBF plans', () => { + const sys = parseBip84PublicAccount({ network: 'syscoin', accountKey: key }); + const sysReceive = deriveBip84PublicAddress({ + network: 'syscoin', + accountKey: key, + branch: 0, + index: 0, + }); + const plan = { + ...fixture(), + network: { + network: 'syscoin' as const, + endpoint: 'https://offline.invalid', + }, + account: sys, + recipient: { address: sysReceive.address, valueSatoshis: '100000' }, + change: null, + rbf: false, + feeLimits: { maxFeeSatoshis: '0', maxFeeRateSatPerVByte: '0' }, + }; + const result = prepareBip84NativeTransaction(plan); + expect(result.feeSatoshis).toBe('0'); + expect(Transaction.fromHex(result.unsignedTransaction).ins[0].sequence).toBe( + 0xffffffff + ); +}); + +test.each([80, 85, 128, 137, 138, 139, 140, 141, 142, 0x7400, 3, 0xffffffff])( + 'rejects every special/unknown parent version %i including native change without asset metadata', + (version) => { + const p = parent(100000n, version); + expectFailure(fixture(p), 'UNSUPPORTED_PARENT'); + } +); +test('rejects coinbase regardless of any caller maturity assertion', () => { + const p = parent(); + p.ins[0].hash = new Uint8Array(32); + p.ins[0].index = 0xffffffff; + expectFailure(fixture(p), 'UNSUPPORTED_PARENT'); + expectFailure({ ...fixture(p), confirmations: 10000 }, 'INVALID_REQUEST'); +}); +test.each(['f'.repeat(64), 'A'.repeat(64), '0x' + 'a'.repeat(64)])( + 'rejects incorrect/noncanonical parent ID %s', + (txid) => { + const p = fixture(); + (p.previousTransactions[0] as any).txid = txid; + expectFailure(p); + } +); +test('rejects missing/out-of-range/duplicated/unowned inputs and unused parents', () => { + for (const mutate of [ + (p: any) => { + p.inputs[0].vout = 1; + }, + (p: any) => { + p.inputs[0].txid = 'e'.repeat(64); + }, + (p: any) => { + p.inputs.push({ ...p.inputs[0] }); + }, + (p: any) => { + p.inputs[0].branch = 1; + }, + (p: any) => { + p.inputs[0].index = 1; + }, + (p: any) => { + p.previousTransactions.push({ ...p.previousTransactions[0] }); + }, + (p: any) => { + const other = parent(1n, 2, 2); + p.previousTransactions.push({ + txid: other.getId(), + rawTransaction: other.toHex(), + }); + }, + ]) { + const p = copy(fixture()); + mutate(p); + expectFailure(p); + } +}); +test.each(['00', 'fdffff', '0001'])( + 'rejects malformed transaction count/encoding %s before allocating', + (suffix) => { + const p: any = copy(fixture()); + p.previousTransactions[0].rawTransaction = + '02000000' + suffix + '00'.repeat(20); + expectFailure(p); + } +); + +test('accepts exactly8192 decoded components and rejects the next empty witness item before decoding', () => { + const tx = parent(); + const plan = fixture(tx); + const withItems = (items: number) => ({ + ...plan, + previousTransactions: [ + { txid: tx.getId(), rawTransaction: witnessParent(tx, [items]) }, + ], + }); + // One input, one output and one witness vector leave8189 item slots. + expect(prepareBip84NativeTransaction(withItems(8189)).feeSatoshis).toBe( + '1000' + ); + expectResourceRejectionBeforeDecode(withItems(8190)); + // Original amplification shape remains within the separate1MB wire limit. + expectResourceRejectionBeforeDecode(withItems(900000)); +}); + +test.each([undefined, 4, 8] as const)( + 'bounds empty and nonempty witness counts at every wide CompactSize representation: %s', + (width) => { + const tx = parent(); + for (const nonempty of [false, true]) { + const plan = fixture(tx); + expectResourceRejectionBeforeDecode({ + ...plan, + previousTransactions: [ + { + txid: tx.getId(), + rawTransaction: witnessParent(tx, [8190], width, nonempty), + }, + ], + }); + } + } +); + +test.each(['inputs', 'outputs'] as const)( + 'counts all parent %s separately from selected spend inputs', + (kind) => { + const tx = parent(); + for (let i = 1; i < 8191; i++) { + if (kind === 'inputs') tx.addInput(Buffer.alloc(32, 2), i); + else tx.addOutput(new Uint8Array(0), 0n); + } + expect(prepareBip84NativeTransaction(fixture(tx)).feeSatoshis).toBe('1000'); + if (kind === 'inputs') tx.addInput(Buffer.alloc(32, 2), 8191); + else tx.addOutput(new Uint8Array(0), 0n); + expectResourceRejectionBeforeDecode(fixture(tx)); + } +); + +test('counts witness vectors/items across inputs even when each count fits a single byte', () => { + const tx = parent(); + for (let i = 1; i < 33; i++) tx.addInput(Buffer.alloc(32, 2), i); + const plan = fixture(tx); + expectResourceRejectionBeforeDecode({ + ...plan, + previousTransactions: [ + { + txid: tx.getId(), + rawTransaction: witnessParent(tx, Array(33).fill(255)), + }, + ], + }); +}); + +test('preflights the aggregate component boundary before decoding any parent', () => { + const first = parent(), + second = parent(100000n, 2, 2); + const plan: Bip84NativePlan = { + ...fixture(first), + inputs: [ + { txid: first.getId(), vout: 0, branch: 0, index: 0 }, + { txid: second.getId(), vout: 0, branch: 0, index: 0 }, + ], + previousTransactions: [ + { txid: first.getId(), rawTransaction: witnessParent(first, [4093]) }, + { txid: second.getId(), rawTransaction: witnessParent(second, [4093]) }, + ], + change: { index: 4, valueSatoshis: '109000' }, + }; + expect(prepareBip84NativeTransaction(plan).feeSatoshis).toBe('1000'); + expectResourceRejectionBeforeDecode({ + ...plan, + previousTransactions: [ + plan.previousTransactions[0], + { txid: second.getId(), rawTransaction: witnessParent(second, [4094]) }, + ], + }); +}); +test('rejects trailing bytes and altered parent outputs despite the claimed txid', () => { + const p: any = copy(fixture()); + p.previousTransactions[0].rawTransaction += '00'; + expectFailure(p); + const altered = parent(100001n); + p.previousTransactions[0].rawTransaction = altered.toHex(); + expectFailure(p, 'INPUT_MISMATCH'); +}); +test('accepts canonical witness parents while committing the non-witness txid', () => { + const p = parent(); + p.setWitness(0, [new Uint8Array([1, 2]), new Uint8Array([3])]); + expect(prepareBip84NativeTransaction(fixture(p)).feeSatoshis).toBe('1000'); +}); +test.each([-1, 0x80000000, 1.5, NaN, Infinity, '0'])( + 'rejects malformed child index %p', + (index) => { + const p: any = copy(fixture()); + p.inputs[0].index = index; + expectFailure(p, 'INVALID_REQUEST'); + } +); +test.each(['-1', '01', '1.2', '1e5', '', '10000000000000000000'])( + 'rejects noncanonical/oversized quantities %s', + (value) => { + const p: any = copy(fixture()); + p.recipient.valueSatoshis = value; + expectFailure(p, 'INVALID_REQUEST'); + } +); +test('rejects zero recipient, negative fee, caller fee cap, rate cap and caps above policy', () => { + for (const mutate of [ + (p: any) => { + p.recipient.valueSatoshis = '0'; + }, + (p: any) => { + p.recipient.valueSatoshis = '100001'; + }, + (p: any) => { + p.feeLimits.maxFeeSatoshis = '999'; + }, + (p: any) => { + p.feeLimits.maxFeeRateSatPerVByte = '1'; + }, + (p: any) => { + p.feeLimits.maxFeeSatoshis = '10000001'; + }, + (p: any) => { + p.feeLimits.maxFeeRateSatPerVByte = '1001'; + }, + ]) { + const p: any = copy(fixture()); + mutate(p); + expectFailure(p); + } +}); +test('keeps SYS quantities above Number.MAX_SAFE_INTEGER exact and enforces both money ranges', () => { + const amount = 9007199254740993n; + const p = fixture(parent(amount)); + const sys = { + ...p, + account: parseBip84PublicAccount({ network: 'syscoin', accountKey: key }), + network: { + network: 'syscoin' as const, + endpoint: 'https://offline.invalid', + }, + recipient: { + address: deriveBip84PublicAddress({ + network: 'syscoin', + accountKey: key, + branch: 0, + index: 0, + }).address, + valueSatoshis: (amount - 1000n).toString(), + }, + change: null, + }; + expect(prepareBip84NativeTransaction(sys).feeSatoshis).toBe('1000'); + expectFailure(p, 'INVALID_REQUEST'); + const excessive = parent(1000000000000000000n); + expectFailure( + { + ...sys, + ...fixture(excessive), + network: sys.network, + account: sys.account, + recipient: sys.recipient, + change: null, + }, + 'INVALID_REQUEST' + ); +}); +test('bounds parent bytes before decoding and total bytes before parsing', () => { + const p: any = copy(fixture()); + p.previousTransactions[0].rawTransaction = '00'.repeat(1000001); + expectFailure(p, 'LIMIT_EXCEEDED'); + const big = [1, 2, 3].map((n) => { + const tx = parent(100000n, 2, n); + tx.addOutput(new Uint8Array(700000), 0n); + return tx; + }); + p.previousTransactions = big.map((tx) => ({ + txid: tx.getId(), + rawTransaction: tx.toHex(), + })); + expectFailure(p, 'LIMIT_EXCEEDED'); +}); +test('accepts 64 inputs without scanning child indices, rejects 65, and canonicalizes parent order', () => { + const p = parent(100000n); + for (let i = 1; i < 64; i++) + p.addOutput(Buffer.from(receive.scriptPubKey, 'hex'), 1n); + const plan: any = fixture(p); + plan.inputs = Array.from({ length: 64 }, (_, vout) => ({ + txid: p.getId(), + vout, + branch: 0, + index: 0, + })); + plan.change.valueSatoshis = '9063'; + expect(prepareBip84NativeTransaction(plan).plan.inputs).toHaveLength(64); + plan.inputs.push(plan.inputs[0]); + expectFailure(plan, 'LIMIT_EXCEEDED'); + const q = parent(100000n, 1, 2); + const multi: any = fixture(p); + multi.inputs.push({ txid: q.getId(), vout: 0, branch: 0, index: 0 }); + multi.previousTransactions.push({ + txid: q.getId(), + rawTransaction: q.toHex(), + }); + multi.change.valueSatoshis = '109000'; + const result = prepareBip84NativeTransaction(multi); + expect(result.plan.previousTransactions.map((x) => x.txid)).toEqual( + [p.getId(), q.getId()].sort() + ); +}); +test('rejects wrong network/account/recipient and never accepts a caller change address or sighash', () => { + for (const mutate of [ + (p: any) => { + p.network.network = 'testnet'; + }, + (p: any) => { + p.account.accountIndex = 1; + }, + (p: any) => { + p.account.network = 'syscoin'; + }, + (p: any) => { + p.recipient.address = 'bc1invalid'; + }, + (p: any) => { + p.change.address = receive.address; + }, + (p: any) => { + p.inputs[0].sighashType = 2; + }, + (p: any) => { + p.locktime = 1; + }, + (p: any) => { + p.inputs[0].sequence = 0; + }, + ]) { + const p: any = copy(fixture()); + mutate(p); + expectFailure(p); + } +}); +test('rejects accessors, inherited/extra fields, symbols, sparse/accessor arrays without evaluating getters', () => { + let reads = 0; + const p: any = copy(fixture()); + Object.defineProperty(p, 'account', { + enumerable: true, + get() { + reads++; + return account; + }, + }); + expectFailure(p); + expectFailure(Object.create(fixture())); + expectFailure({ ...fixture(), [Symbol('extra')]: 1 }); + const q: any = copy(fixture()); + delete q.inputs[0]; + expectFailure(q); + const r: any = copy(fixture()); + Object.defineProperty(r.inputs, '0', { + enumerable: true, + get() { + reads++; + return fixture().inputs[0]; + }, + }); + expectFailure(r); + expect(reads).toBe(0); +}); + +test('accepts exactly the parent/aggregate byte ceilings and rejects the next byte', () => { + function sized(nonce: number, bytes: number) { + const tx = parent(100000n, 2, nonce); + tx.addOutput(new Uint8Array(1), 0n); + let padding = bytes - tx.toBuffer().length + 1; + for (let attempt = 0; attempt < 3; attempt++) { + tx.outs[1].script = new Uint8Array(padding); + padding += bytes - tx.toBuffer().length; + } + expect(tx.toBuffer()).toHaveLength(bytes); + return tx; + } + const first = sized(1, 1000000); + const second = sized(2, 1000000); + const input: any = fixture(first); + input.previousTransactions.push({ + txid: second.getId(), + rawTransaction: second.toHex(), + }); + input.inputs.push({ txid: second.getId(), vout: 0, branch: 0, index: 0 }); + input.change.valueSatoshis = '109000'; + expect(prepareBip84NativeTransaction(input).feeSatoshis).toBe('1000'); + const excess = sized(1, 1000001); + expectFailure(fixture(excess), 'LIMIT_EXCEEDED'); +}); diff --git a/packages/sysweb3-keyring/test/unit/transactions/blockbook-cache.spec.ts b/packages/sysweb3-keyring/test/unit/transactions/blockbook-cache.spec.ts new file mode 100644 index 00000000..97c01364 --- /dev/null +++ b/packages/sysweb3-keyring/test/unit/transactions/blockbook-cache.spec.ts @@ -0,0 +1,126 @@ +import * as syscoinjs from 'syscoinjs-lib'; + +import { SyscoinTransactions } from '../../../src/transactions/syscoin'; +import { + fetchBackendAccountCached, + invalidateBlockbookAccountCache, +} from '../../../src/utils/blockbook-cache'; + +const URL = 'https://blockbook.test'; +const XPUB = 'zpub-test-account'; +const OPTIONS = 'tokens=used&details=tokens'; + +const fetchBackendAccountMock = syscoinjs.utils + .fetchBackendAccount as jest.Mock; +const fetchEstimateFeeMock = syscoinjs.utils.fetchEstimateFee as jest.Mock; + +describe('blockbook account cache', () => { + beforeEach(() => { + jest.clearAllMocks(); + invalidateBlockbookAccountCache(); + fetchBackendAccountMock.mockResolvedValue({ + balance: 100000000, + tokens: [{ name: 'addr1', path: "m/84'/57'/0'/0/0" }], + }); + }); + + it('collapses concurrent identical requests into a single fetch', async () => { + let resolveFetch!: (value: any) => void; + fetchBackendAccountMock.mockReturnValueOnce( + new Promise((resolve) => { + resolveFetch = resolve; + }) + ); + + const p1 = fetchBackendAccountCached(URL, XPUB, OPTIONS); + const p2 = fetchBackendAccountCached(URL, XPUB, OPTIONS); + + expect(fetchBackendAccountMock).toHaveBeenCalledTimes(1); + + resolveFetch({ balance: 1, tokens: [] }); + const [first, second] = await Promise.all([p1, p2]); + expect(second).toEqual(first); + }); + + it('refetches once the previous request has settled (no TTL caching)', async () => { + await fetchBackendAccountCached(URL, XPUB, OPTIONS); + await fetchBackendAccountCached(URL, XPUB, OPTIONS); + + expect(fetchBackendAccountMock).toHaveBeenCalledTimes(2); + }); + + it('keys in-flight requests by backend url, xpub and options', async () => { + fetchBackendAccountMock.mockReturnValue(new Promise(() => undefined)); + + fetchBackendAccountCached(URL, XPUB, OPTIONS); + fetchBackendAccountCached(URL, 'zpub-other', OPTIONS); + fetchBackendAccountCached(URL, XPUB, 'details=basic'); + fetchBackendAccountCached(URL, XPUB, OPTIONS); + + expect(fetchBackendAccountMock).toHaveBeenCalledTimes(3); + }); + + it('propagates failures to all deduplicated callers and refetches afterwards', async () => { + fetchBackendAccountMock.mockRejectedValueOnce(new Error('boom')); + + await expect(fetchBackendAccountCached(URL, XPUB, OPTIONS)).rejects.toThrow( + 'boom' + ); + const result = await fetchBackendAccountCached(URL, XPUB, OPTIONS); + + expect(fetchBackendAccountMock).toHaveBeenCalledTimes(2); + expect(result.balance).toBe(100000000); + }); +}); + +describe('getRecommendedFee cache', () => { + const buildTransactions = () => + new SyscoinTransactions( + jest.fn() as any, + jest.fn() as any, + jest.fn() as any, + jest.fn() as any, + {} as any, + {} as any + ); + + beforeEach(() => { + jest.clearAllMocks(); + fetchEstimateFeeMock.mockResolvedValue(10); + }); + + it('caches the recommended fee per explorer url', async () => { + const transactions = buildTransactions(); + + const fee1 = await transactions.getRecommendedFee(URL); + const fee2 = await transactions.getRecommendedFee(URL); + + expect(fetchEstimateFeeMock).toHaveBeenCalledTimes(1); + expect(fee1).toBe(10 / 1024); + expect(fee2).toBe(fee1); + }); + + it('fetches separately for different explorers', async () => { + const transactions = buildTransactions(); + + await transactions.getRecommendedFee(URL); + await transactions.getRecommendedFee('https://other-blockbook.test'); + + expect(fetchEstimateFeeMock).toHaveBeenCalledTimes(2); + }); + + it('refreshes the fee after the TTL expires', async () => { + const transactions = buildTransactions(); + const nowSpy = jest.spyOn(Date, 'now'); + const base = 1_750_000_000_000; + + nowSpy.mockReturnValue(base); + await transactions.getRecommendedFee(URL); + + nowSpy.mockReturnValue(base + 61_000); // TTL is 60s + await transactions.getRecommendedFee(URL); + + expect(fetchEstimateFeeMock).toHaveBeenCalledTimes(2); + nowSpy.mockRestore(); + }); +}); diff --git a/packages/sysweb3-keyring/test/unit/transactions/ethereum-cancellation-fee-consent.spec.ts b/packages/sysweb3-keyring/test/unit/transactions/ethereum-cancellation-fee-consent.spec.ts new file mode 100644 index 00000000..5ab0ca3c --- /dev/null +++ b/packages/sysweb3-keyring/test/unit/transactions/ethereum-cancellation-fee-consent.spec.ts @@ -0,0 +1,402 @@ +// Public deterministic keys; only local signing and in-memory device/RPC fixtures. +jest.resetModules(); +(global as any).window.location = { href: 'http://localhost/' }; + +import { Transaction } from 'ethers/transaction'; +import { Wallet } from 'ethers/wallet'; + +import * as ethersCompat from '../../../src/ethers-v6'; +import { BigNumber, serializeTransaction } from '../../../src/ethers-v6'; +import { EthereumTransactions } from '../../../src/transactions/ethereum'; +import * as localSigner from '../../../src/transactions/evm-local-signer'; +import { KeyringAccountType } from '../../../src/types'; + +// Keep real signed-response normalization; the shared fixture omits it. +jest.mock('../../../src/providers', () => ({ + ...jest.requireActual('../../../src/providers'), + CustomJsonRpcProvider: jest.fn(), +})); + +const wallet = new Wallet(`0x${'11'.repeat(32)}`); +const PAYER = wallet.address; +const SMART = `0x${'22'.repeat(20)}`; +const OTHER = `0x${'33'.repeat(20)}`; +const CHAIN = 5700; +const MAXIMUM_FEE = '5040000'; // 42000 gas * 120 wei. +const routes = [ + { type: KeyringAccountType.HDAccount, id: 3 }, + { type: KeyringAccountType.Ledger, id: 4 }, + { type: KeyringAccountType.Trezor, id: 5 }, +]; +const deferred = () => { + let resolve!: (value: T) => void; + const promise = new Promise((done) => { + resolve = done; + }); + return { promise, resolve }; +}; + +function fixture(legacy: boolean, devices = true) { + const original = Transaction.from({ + type: legacy ? 0 : 2, + chainId: CHAIN, + nonce: 8, + to: OTHER, + value: 7, + data: '0x', + gasLimit: 21000, + ...(legacy + ? { gasPrice: 100 } + : { maxFeePerGas: 100, maxPriorityFeePerGas: 10 }), + }); + original.signature = wallet.signingKey.sign(original.unsignedHash); + const row = { + ...original.toJSON(), + signature: original.signature, + hash: original.hash, + from: PAYER, + nonce: original.nonce, + gasLimit: BigNumber.from(original.gasLimit), + gasPrice: + original.gasPrice == null ? null : BigNumber.from(original.gasPrice), + maxFeePerGas: + original.maxFeePerGas == null + ? null + : BigNumber.from(original.maxFeePerGas), + maxPriorityFeePerGas: + original.maxPriorityFeePerGas == null + ? null + : BigNumber.from(original.maxPriorityFeePerGas), + value: BigNumber.from(original.value), + blockNumber: null, + blockHash: null, + }; + const state: any = { + activeAccountType: KeyringAccountType.SmartAccount, + activeAccountId: 7, + activeNetwork: { + kind: 'ethereum', + chainId: CHAIN, + slip44: 60, + currency: 'tsys', + url: 'https://offline.invalid', + }, + accounts: { + [KeyringAccountType.SmartAccount]: { + 7: { address: SMART }, + 8: { address: OTHER }, + }, + [KeyringAccountType.HDAccount]: { + 3: { address: PAYER }, + 9: { address: OTHER }, + }, + [KeyringAccountType.Ledger]: { 4: { address: PAYER } }, + [KeyringAccountType.Trezor]: { 5: { address: PAYER } }, + }, + }; + const sent: Transaction[] = []; + const provider = { + getTransaction: jest.fn(async () => row), + getGasPrice: jest.fn(async () => BigNumber.from(100)), + getNetwork: jest.fn(async () => ({ chainId: CHAIN })), + verifyConfiguredChainId: jest.fn(async () => undefined), + sendTransaction: jest.fn(async (raw: string) => { + const signed = Transaction.from(raw); + sent.push(signed); + return { hash: signed.hash, from: signed.from, nonce: signed.nonce }; + }), + }; + let currentProvider = provider; + let generation = 0; + const getKey = jest.fn(() => ({ + address: PAYER, + decryptedPrivateKey: wallet.privateKey, + })); + const signature = (transaction: any) => + wallet.signingKey.sign( + Transaction.from( + typeof transaction === 'string' + ? transaction + : serializeTransaction(transaction) + ).unsignedHash + ); + const ledger = { + evm: { + signEVMTransaction: jest.fn(async ({ rawTx }) => { + const signed = signature(`0x${rawTx}`); + return { + r: signed.r.slice(2), + s: signed.s.slice(2), + v: signed.v.toString(16), + }; + }), + }, + }; + const trezor = { + signEthTransaction: jest.fn(async ({ tx }) => { + const signed = signature(tx); + return { + success: true, + payload: { r: signed.r, s: signed.s, v: signed.v }, + }; + }), + }; + const sdk = new EthereumTransactions( + () => state.activeNetwork, + getKey, + () => state, + devices ? (ledger as any) : undefined, + devices ? (trezor as any) : undefined, + () => { + const captured = generation; + return () => { + if (generation !== captured) throw new Error('Session changed'); + }; + } + ); + const providerAccess = jest.fn(() => currentProvider); + Object.defineProperty(sdk, 'web3Provider', { get: providerAccess }); + jest + .spyOn(sdk, 'getFeeDataWithDynamicMaxPriorityFeePerGas') + .mockResolvedValue({ + maxFeePerGas: BigNumber.from(100), + maxPriorityFeePerGas: BigNumber.from(10), + }); + const validateOriginal = jest.fn((value) => { + expect(value.hash).toBe(original.hash); + expect(value.from.toLowerCase()).toBe(PAYER.toLowerCase()); + expect(value.nonce).toBe(8); + }); + const options = (targetAccount = routes[0]) => ({ + targetAccount: { ...targetAccount }, + approvedMaximumFee: MAXIMUM_FEE, + assertCurrentContext: () => undefined, + validateOriginal, + }); + const run = (opts: any = options()) => + sdk.cancelSentTransaction(original.hash!, legacy, undefined, opts); + const noSigning = () => { + expect(getKey).not.toHaveBeenCalled(); + expect(ledger.evm.signEVMTransaction).not.toHaveBeenCalled(); + expect(trezor.signEthTransaction).not.toHaveBeenCalled(); + expect(provider.sendTransaction).not.toHaveBeenCalled(); + }; + return { + sdk, + state, + provider, + providerAccess, + ledger, + trezor, + getKey, + sent, + options, + run, + noSigning, + cycle: () => { + generation += 2; + }, + switchProvider: () => { + currentProvider = { ...provider }; + }, + }; +} + +afterEach(() => jest.restoreAllMocks()); + +describe.each([true, false])( + 'cancellation fee consent (legacy=%s)', + (legacy) => { + it.each(routes)( + 'previews without credentials or devices for target $type', + async (target) => { + const f = fixture(legacy, false); + await expect( + f.run({ + ...f.options(target), + previewOnly: true, + approvedMaximumFee: undefined, + }) + ).resolves.toEqual({ + isCanceled: false, + error: false, + maximumFee: MAXIMUM_FEE, + }); + f.noSigning(); + expect(f.state.activeAccountType).toBe(KeyringAccountType.SmartAccount); + expect(f.state.activeAccountId).toBe(7); + } + ); + + it.each(routes)( + 'signs with approved target $type and leaves selection unchanged', + async (target) => { + const f = fixture(legacy); + await expect(f.run(f.options(target))).resolves.toMatchObject({ + isCanceled: true, + }); + expect(f.sent).toHaveLength(1); + const tx = f.sent[0]; + expect(tx.from).toBe(PAYER); + expect(tx.to).toBe(PAYER); + expect(tx.nonce).toBe(8); + expect(tx.value).toBe(0n); + expect(tx.data).toBe('0x'); + expect(tx.gasLimit).toBe(42000n); + expect(tx.gasLimit * (legacy ? tx.gasPrice! : tx.maxFeePerGas!)).toBe( + BigInt(MAXIMUM_FEE) + ); + expect(f.state.activeAccountType).toBe(KeyringAccountType.SmartAccount); + expect(f.state.activeAccountId).toBe(7); + if (target.type === KeyringAccountType.HDAccount) + expect(f.getKey).toHaveBeenCalledWith(target); + else expect(f.getKey).not.toHaveBeenCalled(); + if (target.type === KeyringAccountType.Ledger) + expect( + f.ledger.evm.signEVMTransaction.mock.calls[0][0].accountIndex + ).toBe(4); + if (target.type === KeyringAccountType.Trezor) + expect(f.trezor.signEthTransaction.mock.calls[0][0].index).toBe('5'); + } + ); + + it.each([undefined, '', '00', '-1', '1.5', '0x100', 1, '9'.repeat(79)])( + 'rejects invalid fee approval %p before RPC or signing', + async (cap) => { + const f = fixture(legacy); + await expect( + f.run({ ...f.options(), approvedMaximumFee: cap }) + ).rejects.toThrow('Cancellation fee approval required'); + expect(f.providerAccess).not.toHaveBeenCalled(); + expect(f.provider.getTransaction).not.toHaveBeenCalled(); + f.noSigning(); + } + ); + + it.each(routes)( + 'rejects an insufficient fee ceiling before target $type credentials', + async (target) => { + const f = fixture(legacy); + await expect( + f.run({ ...f.options(target), approvedMaximumFee: '5039999' }) + ).rejects.toThrow('Cancellation fee exceeds approval'); + f.noSigning(); + } + ); + + it.each(routes.slice(1))( + 'rejects missing target $type hardware before provider access', + async (target) => { + const f = fixture(legacy, false); + await expect(f.run(f.options(target))).rejects.toMatchObject({ + code: 'HARDWARE_SIGNER_UNAVAILABLE', + }); + expect(f.providerAccess).not.toHaveBeenCalled(); + f.noSigning(); + } + ); + + it.each(routes)( + 'validates the final populated gas envelope for target $type', + async (target) => { + const f = fixture(legacy); + const resolve = ethersCompat.resolveProperties; + jest + .spyOn(ethersCompat, 'resolveProperties') + .mockImplementationOnce(async (value) => ({ + ...(await resolve(value)), + gasLimit: BigNumber.from(42001), + })); + const sign = jest.spyOn(localSigner, 'signTransaction'); + await expect(f.run(f.options(target))).resolves.toEqual({ + isCanceled: false, + error: true, + }); + expect(f.ledger.evm.signEVMTransaction).not.toHaveBeenCalled(); + expect(f.trezor.signEthTransaction).not.toHaveBeenCalled(); + expect(sign).not.toHaveBeenCalled(); + expect(f.provider.sendTransaction).not.toHaveBeenCalled(); + } + ); + } +); + +it.each([ + 'selected account', + 'selected address', + 'target address', + 'network', + 'provider', + 'session', +])( + 'rejects changed %s while reading fees without changing selection', + async (change) => { + const f = fixture(true); + const ready = deferred(); + const gate = deferred(); + f.provider.getGasPrice.mockImplementationOnce(() => { + ready.resolve(); + return gate.promise; + }); + const pending = f.run(); + const rejected = expect(pending).rejects.toThrow( + /context changed|Session changed/ + ); + await ready.promise; + if (change === 'selected account') f.state.activeAccountId = 8; + if (change === 'selected address') + f.state.accounts[KeyringAccountType.SmartAccount][7].address = OTHER; + if (change === 'target address') + f.state.accounts[KeyringAccountType.HDAccount][3].address = OTHER; + if (change === 'network') f.state.activeNetwork.chainId++; + if (change === 'provider') f.switchProvider(); + if (change === 'session') f.cycle(); + gate.resolve(BigNumber.from(100)); + await rejected; + f.noSigning(); + } +); + +it('captures preview, fee approval, and target identity before asynchronous work', async () => { + const f = fixture(true, false); + const ready = deferred(); + const gate = deferred(); + f.provider.getGasPrice.mockImplementationOnce(() => { + ready.resolve(); + return gate.promise; + }); + const opts: any = { + ...f.options(routes[1]), + previewOnly: true, + approvedMaximumFee: undefined, + }; + const pending = f.run(opts); + await ready.promise; + opts.previewOnly = false; + opts.approvedMaximumFee = '0'; + opts.targetAccount.id = 99; + gate.resolve(BigNumber.from(100)); + await expect(pending).resolves.toEqual({ + isCanceled: false, + error: false, + maximumFee: MAXIMUM_FEE, + }); + f.noSigning(); +}); + +it('captures the approved fee cap while the network fee changes', async () => { + const f = fixture(true); + const ready = deferred(); + const gate = deferred(); + f.provider.getGasPrice.mockImplementationOnce(() => { + ready.resolve(); + return gate.promise; + }); + const opts = f.options(); + const pending = f.run(opts); + await ready.promise; + opts.approvedMaximumFee = '999999999'; + gate.resolve(BigNumber.from(101)); + await expect(pending).rejects.toThrow('Cancellation fee exceeds approval'); + f.noSigning(); +}); diff --git a/packages/sysweb3-keyring/test/unit/transactions/ethereum-cancellation-identity.spec.ts b/packages/sysweb3-keyring/test/unit/transactions/ethereum-cancellation-identity.spec.ts new file mode 100644 index 00000000..f25b7a79 --- /dev/null +++ b/packages/sysweb3-keyring/test/unit/transactions/ethereum-cancellation-identity.spec.ts @@ -0,0 +1,390 @@ +// Precomputed public fixtures only. Every signing and network boundary is denied. +jest.resetModules(); +(global as any).window.location = { href: 'http://localhost/' }; + +import { Transaction } from 'ethers/transaction'; + +import { BigNumber } from '../../../src/ethers-v6'; +import { EthereumTransactions } from '../../../src/transactions/ethereum'; +import { sendLocalEvmTransaction } from '../../../src/transactions/evm-local-signer'; +import { KeyringAccountType } from '../../../src/types'; + +jest.mock('../../../src/providers', () => ({ + ...jest.requireActual('../../../src/providers'), + CustomJsonRpcProvider: jest.fn(), +})); +jest.mock('../../../src/transactions/evm-local-signer', () => ({ + ...jest.requireActual('../../../src/transactions/evm-local-signer'), + sendLocalEvmTransaction: jest.fn(), +})); + +// These are existing evm-local-signer.spec.ts public vectors, not live accounts. +const RAW_LEGACY = + '0xf865018504a817c800825208942c7536e3605d9c16a7a3d7b1898e529396a65c2301808196a09e45c98f8c125ec111da1ee78c493e4a81c6f395001db83c8d12e15a86bb6699a0395567d28d51d925f906ff930731a589c78138326bcce5687ce2b1697176ae9e'; +const RAW_DYNAMIC = + '0x02f86b018084773594008504a817c800825208942c7536e3605d9c16a7a3d7b1898e529396a65c238080c001a00e649d7c30947b140969ffd55afacebbfb1ad9a3f2598b46c9a7c83ea4b12d71a02e6f269af1511ca6337cc35761707c8459e7781502050ac87a9f8c1fe1e76c31'; +const RAW_ACCESS_LIST = + '0x01f89f01028504a817c800825208942c7536e3605d9c16a7a3d7b1898e529396a65c238080f838f7940000000000000000000000000000000000000001e1a0000000000000000000000000000000000000000000000000000000000000000080a08916200a771d6a544bc65b882ef2d78502b7c0d0822d723d0a9179f580e00dbea07b9ba2f6d11d1b0ac05e52273126193e0c23a7c4edf6bbc6e1d506066808017f'; +const parsed = Transaction.from(RAW_LEGACY); +const PAYER = parsed.from!; +const CHAIN = Number(parsed.chainId); +const HASH = parsed.hash!; +const row = (raw = RAW_LEGACY) => { + const tx = Transaction.from(raw); + return { + ...tx.toJSON(), + hash: tx.hash, + from: tx.from, + signature: tx.signature, + gasPrice: tx.gasPrice == null ? null : BigNumber.from(tx.gasPrice), + maxFeePerGas: + tx.maxFeePerGas == null ? null : BigNumber.from(tx.maxFeePerGas), + maxPriorityFeePerGas: + tx.maxPriorityFeePerGas == null + ? null + : BigNumber.from(tx.maxPriorityFeePerGas), + gasLimit: BigNumber.from(tx.gasLimit), + value: BigNumber.from(tx.value), + blockNumber: null, + blockHash: null, + }; +}; + +describe('cancellation original identity admission', () => { + let sdk: EthereumTransactions; + let state: any; + let provider: any; + let deny: jest.Mock; + let getKey: jest.Mock; + let hostCurrent: boolean; + let validateOriginal: jest.Mock; + const options = () => ({ + approvedMaximumFee: '9'.repeat(78), + assertCurrentContext: () => { + if (!hostCurrent) throw new Error('Host original changed'); + }, + validateOriginal, + }); + const run = (fallback: any = undefined) => + sdk.cancelSentTransaction(HASH, true, fallback, options()); + + beforeEach(() => { + jest.clearAllMocks(); + hostCurrent = true; + deny = jest.fn(() => { + throw new Error('FORBIDDEN_SIGN_OR_NETWORK'); + }); + jest.spyOn(global, 'fetch').mockImplementation(deny); + jest.mocked(sendLocalEvmTransaction).mockImplementation(() => { + throw new Error('UNSIGNED_BOUNDARY_HARD_STOP'); + }); + getKey = jest.fn(() => ({ + address: PAYER, + decryptedPrivateKey: 'not-a-key', + })); + state = { + activeAccountType: KeyringAccountType.HDAccount, + activeAccountId: 0, + accounts: { HDAccount: { 0: { address: PAYER } } }, + activeNetwork: { + kind: 'ethereum', + chainId: CHAIN, + slip44: 60, + url: 'https://synthetic.invalid', + }, + }; + provider = { + getTransaction: jest.fn().mockResolvedValue(row()), + getGasPrice: jest.fn().mockResolvedValue(BigNumber.from(1)), + send: deny, + sendTransaction: deny, + broadcastTransaction: deny, + }; + validateOriginal = jest.fn(); + sdk = new EthereumTransactions( + () => state.activeNetwork, + getKey, + () => state, + { evm: { signEVMTransaction: deny } } as any, + { signEthTransaction: deny } as any + ); + Object.defineProperty(sdk, 'web3Provider', { get: () => provider }); + }); + afterEach(() => jest.restoreAllMocks()); + + it('healthy control: admits the authenticated original only to the denied unsigned boundary', async () => { + expect(await run()).toEqual({ isCanceled: false, error: true }); + expect(sendLocalEvmTransaction).toHaveBeenCalledTimes(1); + expect(jest.mocked(sendLocalEvmTransaction).mock.calls[0][2]).toMatchObject( + { nonce: parsed.nonce, from: PAYER, to: PAYER } + ); + expect(validateOriginal).toHaveBeenCalledTimes(1); + expect(validateOriginal.mock.calls[0][0]).toMatchObject({ + hash: HASH, + from: PAYER, + nonce: parsed.nonce, + }); + expect(validateOriginal.mock.calls[0][0]).not.toBe( + await provider.getTransaction.mock.results[0].value + ); + expect(provider.sendTransaction).not.toHaveBeenCalled(); + }); + + it.each([ + ['hash', { hash: `0x${'22'.repeat(32)}` }], + ['sender', { from: `0x${'33'.repeat(20)}` }], + ['chain', { chainId: CHAIN + 1 }], + ['nonce', { nonce: 19 }], + ['payload', { data: '0x1234' }], + ['unsigned original', { signature: undefined }], + ['unsupported type', { type: 0x7f }], + ['mined original', { blockNumber: 12, blockHash: `0x${'44'.repeat(32)}` }], + ])( + 'rejects invalid %s before fees, credentials, signing or fallback', + async (_label, fields) => { + provider.getTransaction.mockResolvedValue({ ...row(), ...fields }); + await expect(run(parsed.nonce)).rejects.toThrow(); + expect(validateOriginal).not.toHaveBeenCalled(); + expect(provider.getGasPrice).not.toHaveBeenCalled(); + expect(getKey).not.toHaveBeenCalled(); + expect(deny).not.toHaveBeenCalled(); + } + ); + + it('refuses an authenticated different original despite a forged requested hash', async () => { + provider.getTransaction.mockResolvedValue({ + ...row(RAW_DYNAMIC), + hash: HASH, + }); + await expect(run()).rejects.toThrow(); + expect(getKey).not.toHaveBeenCalled(); + expect(deny).not.toHaveBeenCalled(); + }); + + it.each([RAW_DYNAMIC, RAW_ACCESS_LIST])( + 'admits supported authenticated typed original %s', + async (raw) => { + const original = row(raw); + state.activeNetwork.chainId = Number(original.chainId); + state.accounts.HDAccount[0].address = original.from; + provider.getTransaction.mockResolvedValue(original); + jest + .spyOn(sdk, 'getFeeDataWithDynamicMaxPriorityFeePerGas') + .mockResolvedValue({ + maxFeePerGas: BigNumber.from('20000000000'), + maxPriorityFeePerGas: BigNumber.from('2000000000'), + } as any); + expect( + await sdk.cancelSentTransaction( + original.hash!, + false, + undefined, + options() + ) + ).toEqual({ isCanceled: false, error: true }); + expect(validateOriginal).toHaveBeenCalledWith( + expect.objectContaining({ hash: original.hash, nonce: original.nonce }) + ); + expect(sendLocalEvmTransaction).toHaveBeenCalledTimes(1); + expect(deny).not.toHaveBeenCalled(); + } + ); + + it.each([undefined, false, 0, ''])( + 'does not treat malformed non-null lookup %p as a fallback', + async (response) => { + provider.getTransaction.mockResolvedValue(response); + await expect(run(0)).rejects.toThrow(); + expect(validateOriginal).not.toHaveBeenCalled(); + expect(getKey).not.toHaveBeenCalled(); + expect(deny).not.toHaveBeenCalled(); + } + ); + + it.each([-1, 1.5, NaN, Infinity, Number.MAX_SAFE_INTEGER + 1, null, '1'])( + 'rejects invalid fallback nonce %p before lookup', + async (nonce) => { + provider.getTransaction.mockResolvedValue(null); + await expect(run(nonce)).rejects.toThrow( + 'Invalid cancellation fallback nonce' + ); + expect(provider.getTransaction).not.toHaveBeenCalled(); + expect(getKey).not.toHaveBeenCalled(); + expect(deny).not.toHaveBeenCalled(); + } + ); + + it('requires a host original validator before lookup', async () => { + await expect( + sdk.cancelSentTransaction(HASH, true, 0, { + assertCurrentContext: () => undefined, + } as any) + ).rejects.toThrow('Cancellation original validator required'); + expect(provider.getTransaction).not.toHaveBeenCalled(); + expect(getKey).not.toHaveBeenCalled(); + expect(deny).not.toHaveBeenCalled(); + }); + + it('passes explicit null to the host before admitting fallback nonce zero', async () => { + provider.getTransaction.mockResolvedValue(null); + expect(await run(0)).toEqual({ isCanceled: false, error: true }); + expect(validateOriginal).toHaveBeenCalledWith(null); + expect(jest.mocked(sendLocalEvmTransaction).mock.calls[0][2].nonce).toBe(0); + expect(provider.sendTransaction).not.toHaveBeenCalled(); + }); + + it('lets the host reject unavailable-original fallback before fees or credentials', async () => { + provider.getTransaction.mockResolvedValue(null); + validateOriginal.mockImplementation(() => { + throw new Error('Untrusted fallback'); + }); + await expect(run(0)).rejects.toThrow('Untrusted fallback'); + expect(validateOriginal).toHaveBeenCalledWith(null); + expect(provider.getGasPrice).not.toHaveBeenCalled(); + expect(getKey).not.toHaveBeenCalled(); + expect(deny).not.toHaveBeenCalled(); + }); + + it('retains missing-original/no-fallback behavior after explicit null validation', async () => { + provider.getTransaction.mockResolvedValue(null); + expect(await run()).toEqual({ isCanceled: false, error: true }); + expect(validateOriginal).toHaveBeenCalledWith(null); + expect(getKey).not.toHaveBeenCalled(); + expect(deny).not.toHaveBeenCalled(); + }); + + it('checks a changed host original after a delayed fee read', async () => { + provider.getGasPrice.mockImplementation(async () => { + hostCurrent = false; + return BigNumber.from(1); + }); + await expect(run()).rejects.toThrow('Host original changed'); + expect(getKey).not.toHaveBeenCalled(); + expect(deny).not.toHaveBeenCalled(); + }); + + it('rejects a host-disallowed authenticated original before fees or credentials', async () => { + validateOriginal.mockImplementation(() => { + throw new Error('Reviewed nonce changed'); + }); + await expect(run()).rejects.toThrow('Reviewed nonce changed'); + expect(provider.getGasPrice).not.toHaveBeenCalled(); + expect(getKey).not.toHaveBeenCalled(); + expect(deny).not.toHaveBeenCalled(); + }); + + it('keeps the authenticated nonce when the retained RPC object changes during the fee read', async () => { + const original = row(); + provider.getTransaction.mockResolvedValue(original); + provider.getGasPrice.mockImplementation(async () => { + original.nonce = 19; + original.from = `0x${'44'.repeat(20)}`; + return BigNumber.from(1); + }); + expect(await run()).toEqual({ isCanceled: false, error: true }); + expect(jest.mocked(sendLocalEvmTransaction).mock.calls[0][2]).toMatchObject( + { + nonce: parsed.nonce, + from: PAYER, + to: PAYER, + } + ); + expect(deny).not.toHaveBeenCalled(); + }); + + it.each([ + ['lookup', 'resolve'], + ['lookup', 'reject'], + ['fallback', 'resolve'], + ['fallback', 'reject'], + ])( + 'rejects async %s admission before a delayed %s', + async (source, outcome) => { + let release!: () => void; + const held = new Promise((resolve) => { + release = resolve; + }); + const validation = (async () => { + await held; + if (outcome === 'reject') throw new Error('Delayed host rejection'); + })(); + const then = jest.spyOn(validation, 'then'); + validateOriginal.mockReturnValue(validation); + if (source === 'fallback') + provider.getTransaction.mockResolvedValue(null); + try { + await expect( + run(source === 'fallback' ? 0 : undefined) + ).rejects.toThrow('Original transaction validator must be synchronous'); + // The SDK attaches rejection handling before declining asynchronous + // admission, even though the callback has not settled yet. + expect(then).toHaveBeenCalled(); + expect(provider.getGasPrice).not.toHaveBeenCalled(); + expect(getKey).not.toHaveBeenCalled(); + expect(sendLocalEvmTransaction).not.toHaveBeenCalled(); + expect(deny).not.toHaveBeenCalled(); + } finally { + // Only the pre-fix run needs test-owned cleanup. The passing run must + // rely on the SDK's handler for the delayed rejection below. + if (then.mock.calls.length === 0) validation.catch(() => undefined); + release(); + await held; + await Promise.resolve(); + } + } + ); + + it('declines a custom thenable and consumes its eventual rejection', async () => { + const then = jest.fn((_resolve, reject) => + reject(new Error('Thenable rejection')) + ); + validateOriginal.mockReturnValue({ then }); + await expect(run()).rejects.toThrow( + 'Original transaction validator must be synchronous' + ); + await Promise.resolve(); + expect(then).toHaveBeenCalledTimes(1); + expect(provider.getGasPrice).not.toHaveBeenCalled(); + expect(getKey).not.toHaveBeenCalled(); + expect(sendLocalEvmTransaction).not.toHaveBeenCalled(); + expect(deny).not.toHaveBeenCalled(); + }); + + it.each(['resolve', 'reject'])( + 'rejects async speed-up validation before a delayed %s', + async (outcome) => { + let release!: () => void; + const held = new Promise((resolve) => { + release = resolve; + }); + const validation = (async () => { + await held; + if (outcome === 'reject') throw new Error('Delayed speed-up rejection'); + })(); + const then = jest.spyOn(validation, 'then'); + validateOriginal.mockReturnValue(validation); + provider.getBalance = jest + .fn() + .mockResolvedValue(BigNumber.from('1000000000000000000000000')); + try { + await expect( + sdk.sendTransactionWithEditedFee(HASH, true, { + previewOnly: true, + validateOriginal, + }) + ).rejects.toThrow('Original transaction validator must be synchronous'); + expect(then).toHaveBeenCalled(); + expect(provider.getBalance).not.toHaveBeenCalled(); + expect(provider.getGasPrice).not.toHaveBeenCalled(); + expect(getKey).not.toHaveBeenCalled(); + expect(sendLocalEvmTransaction).not.toHaveBeenCalled(); + expect(deny).not.toHaveBeenCalled(); + } finally { + if (then.mock.calls.length === 0) validation.catch(() => undefined); + release(); + await held; + await Promise.resolve(); + } + } + ); +}); diff --git a/packages/sysweb3-keyring/test/unit/transactions/ethereum-fee-data.spec.ts b/packages/sysweb3-keyring/test/unit/transactions/ethereum-fee-data.spec.ts new file mode 100644 index 00000000..f38dd82d --- /dev/null +++ b/packages/sysweb3-keyring/test/unit/transactions/ethereum-fee-data.spec.ts @@ -0,0 +1,745 @@ +jest.resetModules(); +(global as any).window.location = { href: 'http://localhost/' }; +jest.mock('../../../src/transactions/evm-local-signer', () => ({ + ...jest.requireActual('../../../src/transactions/evm-local-signer'), + sendLocalEvmTransaction: jest.fn(), +})); +jest.mock('../../../src/providers', () => ({ + ...jest.requireActual('../../../src/providers'), + CustomJsonRpcProvider: jest.fn(), +})); + +import { INetworkType } from '@sidhujag/sysweb3-network'; +import { spawnSync } from 'child_process'; +import { + mkdirSync, + mkdtempSync, + readFileSync, + readdirSync, + rmSync, + writeFileSync, +} from 'fs'; +import { tmpdir } from 'os'; +import { join } from 'path'; +import { Transaction } from 'ethers/transaction'; +import { Wallet } from 'ethers/wallet'; + +import { BigNumber, normalizeTransactionRequest } from '../../../src/ethers-v6'; +import { EthereumTransactions } from '../../../src/transactions/ethereum'; +import { sendLocalEvmTransaction } from '../../../src/transactions/evm-local-signer'; +import { KeyringAccountType } from '../../../src/types'; + +const originalWallet = new Wallet(`0x${'11'.repeat(32)}`); +const FROM = originalWallet.address; +const TO = `0x${'22'.repeat(20)}`; +let HASH = `0x${'33'.repeat(32)}`; +const network = { + chainId: 5700, + kind: INetworkType.Ethereum, + url: 'https://unit-only.test', +} as any; +const transaction = { + from: FROM, + to: TO, + chainId: 5700, + nonce: 0, + gasLimit: '21000', + value: '0x7', + data: '0x1234', +}; +const localSend = sendLocalEvmTransaction as jest.Mock; +const cancellationOriginal = (fields: any = {}) => { + const tx = Transaction.from({ + type: 2, + chainId: network.chainId, + nonce: 0, + to: TO, + value: 7, + data: '0x1234', + gasLimit: 21000, + maxFeePerGas: (fields.maxFeePerGas ?? 100).toString(), + maxPriorityFeePerGas: (fields.maxPriorityFeePerGas ?? 0).toString(), + }); + tx.signature = originalWallet.signingKey.sign(tx.unsignedHash); + HASH = tx.hash!; + return { + ...tx.toJSON(), + hash: HASH, + from: FROM, + signature: tx.signature, + gasLimit: BigNumber.from(21000), + gasPrice: BigNumber.from(7), + maxFeePerGas: BigNumber.from(tx.maxFeePerGas!), + maxPriorityFeePerGas: BigNumber.from(tx.maxPriorityFeePerGas!), + }; +}; + +describe('package release preflight', () => { + it('inspects only dist without lifecycle hooks, publication or a written tarball', () => { + const manifest = JSON.parse( + readFileSync(join(__dirname, '../../../package.json'), 'utf8') + ); + const [command, ...args] = + manifest.scripts['release:preflight'].split(/\s+/); + // Check before execution: the former Yarn recipe writes a source tarball. + expect(command).toBe('npm'); + expect(args).toEqual([ + 'pack', + './dist', + '--dry-run', + '--json', + '--ignore-scripts', + ]); + const directory = mkdtempSync(join(tmpdir(), 'sysweb3-release-preflight-')); + try { + mkdirSync(join(directory, 'dist', 'cjs'), { recursive: true }); + const scripts = { + prepack: 'node -e "throw new Error(\'lifecycle must not run\')"', + postpack: 'node -e "throw new Error(\'lifecycle must not run\')"', + }; + writeFileSync( + join(directory, 'package.json'), + JSON.stringify({ + name: 'wrong-source-package', + version: '1.0.0', + scripts, + }) + ); + writeFileSync( + join(directory, 'dist', 'package.json'), + JSON.stringify({ + name: 'isolated-dist-fixture', + version: '1.0.1', + main: 'cjs/index.js', + scripts, + }) + ); + writeFileSync( + join(directory, 'dist', 'cjs', 'index.js'), + 'module.exports = {};' + ); + const result = spawnSync(command, args, { + cwd: directory, + encoding: 'utf8', + timeout: 20000, + // No inherited npm auth environment or user/global credential files. + env: { + PATH: process.env.PATH, + NPM_CONFIG_CACHE: join(directory, 'cache'), + NPM_CONFIG_USERCONFIG: join(directory, 'empty-user-config'), + NPM_CONFIG_GLOBALCONFIG: join(directory, 'empty-global-config'), + NPM_CONFIG_UPDATE_NOTIFIER: 'false', + }, + }); + expect(result.error).toBeUndefined(); + expect(result.status).toBe(0); + const [packed] = JSON.parse(result.stdout); + expect(packed).toMatchObject({ + name: 'isolated-dist-fixture', + version: '1.0.1', + }); + expect( + packed.files.map((file: { path: string }) => file.path).sort() + ).toEqual(['cjs/index.js', 'package.json']); + expect(readdirSync(directory).some((file) => file.endsWith('.tgz'))).toBe( + false + ); + expect( + readdirSync(join(directory, 'dist')).some((file) => + file.endsWith('.tgz') + ) + ).toBe(false); + } finally { + rmSync(directory, { recursive: true, force: true }); + } + }); +}); + +function fixture() { + const provider = { + getTransaction: jest.fn().mockResolvedValue(cancellationOriginal()), + getGasPrice: jest.fn().mockResolvedValue(BigNumber.from(7)), + getBlock: jest.fn().mockResolvedValue({ baseFeePerGas: BigNumber.from(5) }), + getFeeData: jest.fn().mockResolvedValue({ + gasPrice: BigNumber.from(7), + maxFeePerGas: BigNumber.from(12), + maxPriorityFeePerGas: BigNumber.from(0), + }), + send: jest.fn().mockResolvedValue('0x0'), + estimateGas: jest.fn().mockResolvedValue(BigNumber.from(21000)), + sendTransaction: jest.fn(), + }; + // This getter and the local sender are mocks, never a library wallet/key. + const getKey = jest.fn(() => ({ + address: FROM, + decryptedPrivateKey: 'unit-test-placeholder', + })); + const sdk = new EthereumTransactions( + () => network, + getKey, + () => + ({ + activeNetwork: network, + activeAccountId: 0, + activeAccountType: KeyringAccountType.HDAccount, + accounts: { + [KeyringAccountType.HDAccount]: { 0: { address: FROM } }, + Imported: {}, + Ledger: {}, + Trezor: {}, + }, + } as any), + {} as any, + {} as any + ); + Object.defineProperty(sdk, 'web3Provider', { get: () => provider }); + return { sdk, provider, getKey }; +} + +beforeEach(() => { + jest.clearAllMocks(); + localSend.mockImplementation( + async (_provider, _key, _tx, beforeBroadcast) => { + beforeBroadcast?.(); + return { hash: HASH }; + } + ); +}); + +describe('actual RPC fee data without a fabricated tip or model switch', () => { + it.each([0, '0x0', '0', BigNumber.from(0)])( + 'retains a valid zero priority fee %p and the actual gas price separately', + async (zero) => { + const { sdk, provider } = fixture(); + provider.send.mockResolvedValue(zero); + const fee: any = await sdk.getFeeDataWithDynamicMaxPriorityFeePerGas(); + expect(fee.maxPriorityFeePerGas.toString()).toBe('0'); + expect(fee.maxFeePerGas.toString()).toBe('12'); + expect(fee.gasPrice.toString()).toBe('7'); + expect(fee.baseFeePerGas.toString()).toBe('5'); + expect(provider.send).toHaveBeenCalledTimes(1); + expect(provider.send).toHaveBeenCalledWith( + 'eth_maxPriorityFeePerGas', + [] + ); + } + ); + + it('preserves a positive tip and existing maximum-fee calculation', async () => { + const { sdk, provider } = fixture(); + provider.send.mockResolvedValue('0x2'); + const fee: any = await sdk.getFeeDataWithDynamicMaxPriorityFeePerGas(); + expect(fee.maxPriorityFeePerGas.toString()).toBe('2'); + expect(fee.maxFeePerGas.toString()).toBe('14'); + expect(fee.gasPrice.toString()).toBe('7'); + }); + + it('classifies a zero base fee as EIP-1559 rather than legacy', async () => { + const { sdk, provider } = fixture(); + provider.getBlock.mockResolvedValue({ baseFeePerGas: BigNumber.from(0) }); + const fee: any = await sdk.getFeeDataWithDynamicMaxPriorityFeePerGas(); + expect(fee.baseFeePerGas.toString()).toBe('0'); + expect(fee.maxPriorityFeePerGas.toString()).toBe('0'); + expect(fee.maxFeePerGas.gt(0)).toBe(true); + }); + + it('uses the legacy sentinel only for an actual header without a base fee', async () => { + const { sdk, provider } = fixture(); + provider.getBlock.mockResolvedValue({} as any); + const fee: any = await sdk.getFeeDataWithDynamicMaxPriorityFeePerGas(); + expect(fee.maxFeePerGas.toString()).toBe('0'); + expect(fee.maxPriorityFeePerGas.toString()).toBe('0'); + expect(fee.gasPrice.toString()).toBe('7'); + expect(fee.baseFeePerGas).toBeUndefined(); + expect(provider.send).not.toHaveBeenCalled(); + }); + + it('preserves an explicitly configured priority floor, rather than inventing one', async () => { + const { sdk } = fixture(); + sdk.setGasOverrides({ minPriorityFee: '2' }); + const fee = await sdk.getFeeDataWithDynamicMaxPriorityFeePerGas(); + expect(fee.maxPriorityFeePerGas.toString()).toBe('2'); + }); + + it.each([null, undefined, 'corrupt', -1, Number.MAX_SAFE_INTEGER + 1])( + 'rejects unavailable or corrupt baseline fee data %p', + async (gasPrice) => { + const { sdk, provider } = fixture(); + provider.getGasPrice.mockResolvedValue(gasPrice as any); + await expect( + sdk.getFeeDataWithDynamicMaxPriorityFeePerGas() + ).rejects.toThrow(); + expect(provider.send).not.toHaveBeenCalled(); + } + ); + + it.each([null, undefined])( + 'does not mistake an absent block %p for legacy support', + async (block) => { + const { sdk, provider } = fixture(); + provider.getBlock.mockResolvedValue(block as any); + await expect( + sdk.getFeeDataWithDynamicMaxPriorityFeePerGas() + ).rejects.toThrow('Block not found'); + expect(provider.send).not.toHaveBeenCalled(); + } + ); + + it('preserves the explicit force-legacy fee recommendation', async () => { + const { sdk, provider } = fixture(); + provider.getGasPrice.mockResolvedValue(BigNumber.from(100)); + const safe = await sdk.getSafeFeeData(true); + expect(safe.gasPrice.toString()).toBe('110'); + expect(safe.maxFeePerGas).toBeUndefined(); + expect(provider.getBlock).not.toHaveBeenCalled(); + expect(provider.send).not.toHaveBeenCalled(); + }); + + it('permits zero observed fee-history rewards when the priority RPC is explicitly unsupported', async () => { + const { sdk, provider } = fixture(); + provider.send.mockRejectedValueOnce( + Object.assign(new Error('unsupported method'), { code: -32601 }) + ); + provider.send.mockResolvedValueOnce({ + reward: [ + ['0x0', '0x0', '0x0'], + ['0x1', '0x0', '0x2'], + ], + }); + const fee = await sdk.getFeeDataWithDynamicMaxPriorityFeePerGas(); + expect(fee.maxPriorityFeePerGas.toString()).toBe('0'); + expect(fee.maxFeePerGas.toString()).toBe('12'); + expect(provider.send).toHaveBeenCalledTimes(2); + }); + + it.each(['gas', 'block', 'priority'])( + 'does not turn a failed %s RPC into zeros, a minimum tip or legacy pricing', + async (stage) => { + const { sdk, provider } = fixture(); + const error = new Error('RPC unavailable'); + if (stage === 'gas') provider.getGasPrice.mockRejectedValue(error); + if (stage === 'block') provider.getBlock.mockRejectedValue(error); + if (stage === 'priority') provider.send.mockRejectedValue(error); + await expect( + sdk.getFeeDataWithDynamicMaxPriorityFeePerGas() + ).rejects.toBe(error); + expect( + provider.send.mock.calls.some(([method]) => method === 'eth_feeHistory') + ).toBe(false); + } + ); + + it.each([null, 'corrupt', '-1', BigNumber.from(-1)])( + 'rejects malformed or negative priority data %p without guessing', + async (priority) => { + const { sdk, provider } = fixture(); + provider.send.mockResolvedValue(priority); + await expect( + sdk.getFeeDataWithDynamicMaxPriorityFeePerGas() + ).rejects.toThrow(); + } + ); + + it.each([ + null, + {}, + { reward: [] }, + { reward: [['0x0']] }, + { reward: [['0x0', '-1', '0x0']] }, + ])( + 'rejects unavailable or malformed history %p without a hardcoded tip', + async (history) => { + const { sdk, provider } = fixture(); + provider.send.mockRejectedValueOnce( + Object.assign(new Error('unsupported method'), { code: -32601 }) + ); + provider.send.mockResolvedValueOnce(history); + await expect( + sdk.getFeeDataWithDynamicMaxPriorityFeePerGas() + ).rejects.toThrow(); + } + ); + + it('getSafeFeeData retains a valid zero-tip EIP-1559 quote', async () => { + const { sdk, provider } = fixture(); + const safe = await sdk.getSafeFeeData(); + expect(safe.maxFeePerGas.toString()).toBe('12'); + expect(safe.maxPriorityFeePerGas.toString()).toBe('0'); + expect(provider.getGasPrice).toHaveBeenCalledTimes(1); + }); + + it('getSafeFeeData preserves discovery failures rather than rereading a different legacy price', async () => { + const { sdk, provider } = fixture(); + const error = new Error('RPC unavailable'); + jest + .spyOn(sdk, 'getFeeDataWithDynamicMaxPriorityFeePerGas') + .mockRejectedValue(error); + await expect(sdk.getSafeFeeData()).rejects.toBe(error); + expect(provider.getGasPrice).not.toHaveBeenCalled(); + }); +}); + +describe('formatted standard transaction fee-model retention', () => { + it.each([ + [{ hex: '0x64' }, { hex: '0x0' }], + [{ _hex: '0x64' }, { _hex: '0x0' }], + [{ toString: () => '100' }, { toString: () => '0' }], + [ + { type: 'BigNumber', hex: '0x64' }, + { type: 'BigNumber', hex: '0x2' }, + ], + ])( + 'accepts the exported object-form BigNumberish fee contract: %p / %p', + async (maximum, priority) => { + const { sdk, provider } = fixture(); + await expect( + sdk.sendFormattedTransaction( + { + ...transaction, + type: 2, + maxFeePerGas: maximum, + maxPriorityFeePerGas: priority, + } as any, + false + ) + ).resolves.toMatchObject({ hash: HASH }); + const sent = localSend.mock.calls[0][2]; + expect(BigNumber.from(sent.maxFeePerGas).toString()).toBe('100'); + expect(BigNumber.from(sent.maxPriorityFeePerGas).toString()).toBe( + BigNumber.from(priority).toString() + ); + expect(normalizeTransactionRequest(sent).maxFeePerGas).toBe(100n); + expect(normalizeTransactionRequest(sent).maxPriorityFeePerGas).toBe( + BigInt(BigNumber.from(priority).toString()) + ); + expect(provider.getFeeData).not.toHaveBeenCalled(); + expect(provider.getGasPrice).not.toHaveBeenCalled(); + } + ); + + it.each([ + { hex: '-0x1' }, + { _hex: '-1' }, + { hex: '' }, + { _hex: 'broken' }, + { hex: 100 }, + { toString: () => '-1' }, + { toString: () => '' }, + {}, + { _isBigNumber: true }, + { _hex: 'broken', hex: '0x64' }, + ])( + 'rejects negative or malformed object-form fees before key access: %p', + async (maximum) => { + const { sdk, getKey } = fixture(); + await expect( + sdk.sendFormattedTransaction( + { + ...transaction, + type: 2, + maxFeePerGas: maximum, + maxPriorityFeePerGas: { hex: '0x0' }, + } as any, + false + ) + ).rejects.toMatchObject({ transactionNotBroadcast: true }); + expect(getKey).not.toHaveBeenCalled(); + expect(localSend).not.toHaveBeenCalled(); + } + ); + + it('does not silently convert an explicit type-2 request through a legacy flag', async () => { + const { sdk, getKey } = fixture(); + await expect( + sdk.sendFormattedTransaction( + { + ...transaction, + type: 2, + maxFeePerGas: '100', + maxPriorityFeePerGas: '0', + } as any, + true + ) + ).rejects.toMatchObject({ transactionNotBroadcast: true }); + expect(getKey).not.toHaveBeenCalled(); + expect(localSend).not.toHaveBeenCalled(); + }); + it.each([0, '0x0', '0', BigNumber.from(0)])( + 'does not downgrade an explicit type-2 zero tip %p or fetch another price', + async (zero) => { + const { sdk, provider } = fixture(); + await expect( + sdk.sendFormattedTransaction( + { + ...transaction, + type: 2, + maxFeePerGas: '100', + maxPriorityFeePerGas: zero, + } as any, + false + ) + ).resolves.toMatchObject({ hash: HASH }); + const sent = localSend.mock.calls[0][2]; + expect(sent.type).toBe(2); + expect(BigNumber.from(sent.maxPriorityFeePerGas).isZero()).toBe(true); + expect(BigNumber.from(sent.maxFeePerGas).toString()).toBe('100'); + expect(provider.getGasPrice).not.toHaveBeenCalled(); + expect(provider.getFeeData).not.toHaveBeenCalled(); + } + ); + + it.each([ + { maxFeePerGas: '0', maxPriorityFeePerGas: '0' }, + { maxFeePerGas: '-1', maxPriorityFeePerGas: '0' }, + { maxFeePerGas: '100', maxPriorityFeePerGas: '-1' }, + { maxFeePerGas: '100', maxPriorityFeePerGas: '101' }, + ])( + 'rejects invalid explicit EIP fees before key access or any signer/send: %p', + async (fields) => { + const { sdk, getKey } = fixture(); + await expect( + sdk.sendFormattedTransaction( + { ...transaction, type: 2, ...fields } as any, + false + ) + ).rejects.toMatchObject({ transactionNotBroadcast: true }); + expect(getKey).not.toHaveBeenCalled(); + expect(localSend).not.toHaveBeenCalled(); + } + ); + + it('refuses unavailable explicit EIP fees instead of silently falling back to legacy', async () => { + const { sdk, provider, getKey } = fixture(); + provider.getFeeData.mockResolvedValue({ + gasPrice: BigNumber.from(7), + maxFeePerGas: null, + maxPriorityFeePerGas: null, + } as any); + await expect( + sdk.sendFormattedTransaction({ ...transaction, type: 2 } as any, false) + ).rejects.toMatchObject({ transactionNotBroadcast: true }); + expect(getKey).not.toHaveBeenCalled(); + expect(localSend).not.toHaveBeenCalled(); + expect(provider.getGasPrice).not.toHaveBeenCalled(); + }); + + it.each([true, false])( + 'retains complete ordinary legacy=%s pricing', + async (legacy) => { + const { sdk, provider } = fixture(); + const fields = legacy + ? { gasPrice: '7' } + : { maxFeePerGas: '100', maxPriorityFeePerGas: '2' }; + await sdk.sendFormattedTransaction( + { ...transaction, ...fields } as any, + legacy + ); + const sent = localSend.mock.calls[0][2]; + if (legacy) expect(BigNumber.from(sent.gasPrice).toString()).toBe('7'); + else + expect(BigNumber.from(sent.maxPriorityFeePerGas).toString()).toBe('2'); + expect(provider.getGasPrice).not.toHaveBeenCalled(); + expect(provider.getFeeData).not.toHaveBeenCalled(); + } + ); +}); + +describe('cancellation recommendations keep base fee separate from replacement tip', () => { + const cancelFields = () => localSend.mock.calls[0][2]; + const contextFor = (sdk: EthereumTransactions, provider: unknown) => ({ + approvedMaximumFee: '9'.repeat(78), + validateOriginal: () => undefined, + assertCurrentContext: () => { + if (sdk.web3Provider !== provider) + throw new Error('Fixture provider changed'); + }, + }); + + it('bumps a zero-tip original by one wei, never by the full gas-price recommendation', async () => { + const { sdk, provider } = fixture(); + await expect( + sdk.cancelSentTransaction( + HASH, + false, + undefined, + contextFor(sdk, provider) + ) + ).resolves.toMatchObject({ isCanceled: true }); + expect(cancelFields().maxFeePerGas.toString()).toBe('120'); + expect(cancelFields().maxPriorityFeePerGas.toString()).toBe('1'); + expect(cancelFields()).toMatchObject({ from: FROM, to: FROM, nonce: 0 }); + expect(provider.getGasPrice).toHaveBeenCalledTimes(1); + }); + + it.each([ + [10, '0x2', '12'], + [10, '0xc', '14'], + [1, '0x0', '2'], + ])( + 'retains the real positive replacement tip bump: original %s / recommendation %s', + async (oldTip, recommendation, expected) => { + const { sdk, provider } = fixture(); + provider.getTransaction.mockResolvedValue( + cancellationOriginal({ + maxPriorityFeePerGas: BigNumber.from(oldTip), + }) + ); + provider.send.mockResolvedValue(recommendation); + await sdk.cancelSentTransaction( + HASH, + false, + undefined, + contextFor(sdk, provider) + ); + expect(cancelFields().maxPriorityFeePerGas.toString()).toBe(expected); + expect(cancelFields().maxFeePerGas.toString()).toBe('120'); + } + ); + + it('keeps exact integer replacement arithmetic above the safe-number range', async () => { + const { sdk, provider } = fixture(); + const oldMaximum = (1n << 60n) + 3n; + provider.getTransaction.mockResolvedValue( + cancellationOriginal({ + maxFeePerGas: BigNumber.from(oldMaximum), + }) + ); + await sdk.cancelSentTransaction( + HASH, + false, + undefined, + contextFor(sdk, provider) + ); + expect(cancelFields().maxFeePerGas.toString()).toBe( + ((oldMaximum * 120n) / 100n).toString() + ); + expect(cancelFields().maxPriorityFeePerGas.toString()).toBe('1'); + }); + + it('uses actual zero-tip fees for a missing-original nonce cancellation without inventing a network tip', async () => { + const { sdk, provider } = fixture(); + provider.getTransaction.mockResolvedValue(null as any); + await expect( + sdk.cancelSentTransaction(HASH, false, 9, contextFor(sdk, provider)) + ).resolves.toMatchObject({ isCanceled: true }); + expect(cancelFields().nonce).toBe(9); + expect(cancelFields().maxPriorityFeePerGas.toString()).toBe('1'); + expect(cancelFields().maxFeePerGas.toString()).toBe('14'); + }); + + it('does not request fees or sign when the original and fallback nonce are both absent', async () => { + const { sdk, provider, getKey } = fixture(); + provider.getTransaction.mockResolvedValue(null as any); + await expect( + sdk.cancelSentTransaction( + HASH, + false, + undefined, + contextFor(sdk, provider) + ) + ).resolves.toEqual({ + isCanceled: false, + error: true, + }); + expect(provider.getGasPrice).not.toHaveBeenCalled(); + expect(getKey).not.toHaveBeenCalled(); + expect(localSend).not.toHaveBeenCalled(); + }); + + it.each(['gas', 'block', 'priority'])( + 'refuses unavailable %s data before cancellation key access', + async (stage) => { + const { sdk, provider, getKey } = fixture(); + const error = new Error('Cancellation fee RPC unavailable'); + if (stage === 'gas') provider.getGasPrice.mockRejectedValue(error); + if (stage === 'block') provider.getBlock.mockRejectedValue(error); + if (stage === 'priority') provider.send.mockRejectedValue(error); + await expect( + sdk.cancelSentTransaction( + HASH, + false, + undefined, + contextFor(sdk, provider) + ) + ).rejects.toBe(error); + expect(getKey).not.toHaveBeenCalled(); + expect(localSend).not.toHaveBeenCalled(); + } + ); + + it.each([ + { maxFeePerGas: null }, + { maxFeePerGas: undefined }, + { maxFeePerGas: 'broken' }, + { maxFeePerGas: BigNumber.from(0) }, + { maxFeePerGas: BigNumber.from(-1) }, + { maxPriorityFeePerGas: null }, + { maxPriorityFeePerGas: undefined }, + { maxPriorityFeePerGas: 'broken' }, + { maxPriorityFeePerGas: BigNumber.from(-1) }, + { + maxFeePerGas: BigNumber.from(1), + maxPriorityFeePerGas: BigNumber.from(2), + }, + ])( + 'rejects missing or corrupt current EIP recommendations without a zero/default substitution: %p', + async (fields) => { + const { sdk, provider, getKey } = fixture(); + jest + .spyOn(sdk, 'getFeeDataWithDynamicMaxPriorityFeePerGas') + .mockResolvedValue({ + gasPrice: BigNumber.from(7), + maxFeePerGas: BigNumber.from(12), + maxPriorityFeePerGas: BigNumber.from(0), + ...fields, + } as any); + await expect( + sdk.cancelSentTransaction( + HASH, + false, + undefined, + contextFor(sdk, provider) + ) + ).rejects.toThrow(); + expect(getKey).not.toHaveBeenCalled(); + expect(localSend).not.toHaveBeenCalled(); + } + ); + + it('preserves a normal positive legacy cancellation price and self-transfer nonce', async () => { + const { sdk, provider } = fixture(); + provider.getGasPrice.mockResolvedValue(BigNumber.from(10)); + await sdk.cancelSentTransaction( + HASH, + true, + undefined, + contextFor(sdk, provider) + ); + expect(cancelFields().gasPrice.toString()).toBe('12'); + expect(cancelFields()).toMatchObject({ + type: 0, + from: FROM, + to: FROM, + nonce: 0, + }); + expect(provider.send).not.toHaveBeenCalled(); + }); + + it.each([null, undefined, 'broken', BigNumber.from(-1)])( + 'rejects corrupt legacy cancellation prices %p before signing', + async (price) => { + const { sdk, provider, getKey } = fixture(); + provider.getGasPrice.mockResolvedValue(price as any); + await expect( + sdk.cancelSentTransaction( + HASH, + true, + undefined, + contextFor(sdk, provider) + ) + ).rejects.toThrow(); + expect(getKey).not.toHaveBeenCalled(); + expect(localSend).not.toHaveBeenCalled(); + } + ); +}); diff --git a/packages/sysweb3-keyring/test/unit/transactions/ethereum-hardware-context.spec.ts b/packages/sysweb3-keyring/test/unit/transactions/ethereum-hardware-context.spec.ts new file mode 100644 index 00000000..4cddb6e5 --- /dev/null +++ b/packages/sysweb3-keyring/test/unit/transactions/ethereum-hardware-context.spec.ts @@ -0,0 +1,1147 @@ +jest.resetModules(); +(global as any).window.location = { href: 'http://localhost/' }; +jest.mock('../../../src/providers', () => ({ + ...jest.requireActual('../../../src/providers'), + CustomJsonRpcProvider: jest.fn(), +})); + +import { Interface } from 'ethers/abi'; +import { Transaction } from 'ethers/transaction'; +import { Wallet } from 'ethers/wallet'; + +import { BigNumber, serializeTransaction } from '../../../src/ethers-v6'; +import { EthereumTransactions } from '../../../src/transactions/ethereum'; +import { KeyringAccountType } from '../../../src/types'; + +// The public key is an offline device response fixture, never a live wallet. +// SDK serialization/context/broadcast classification are real; physical I/O and +// RPC are deterministic in-memory boundaries. Pali additionally tests the real +// Ledger APDU encoder and Trezor adapter against these same signing scenarios. +const wallet = new Wallet(`0x${'11'.repeat(32)}`); +const recipient = `0x${'22'.repeat(20)}`; +const deferred = () => { + let resolve!: (value: T) => void; + const promise = new Promise((done) => (resolve = done)); + return { promise, resolve }; +}; + +describe.each([KeyringAccountType.Ledger, KeyringAccountType.Trezor])( + 'ordinary %s EVM approval context', + (kind) => { + let sdk: EthereumTransactions; + let state: any; + let provider: any; + let otherProvider: any; + let device: jest.Mock; + let getKey: jest.Mock; + let sessionGeneration: number; + let softwareUsed: boolean; + const request = (legacy = false) => ({ + from: wallet.address, + to: recipient, + value: '12345', + data: '0x', + gasLimit: '21000', + ...(legacy + ? { gasPrice: '100' } + : { maxFeePerGas: '100', maxPriorityFeePerGas: '2' }), + }); + const send = (legacy = false) => + sdk.sendFormattedTransaction(request(legacy), legacy); + + beforeEach(() => { + state = { + activeAccountType: kind, + activeAccountId: 0, + activeNetwork: { + kind: 'ethereum', + chainId: 57057, + slip44: 60, + currency: 'tsys', + url: 'https://rpc-a.invalid', + }, + accounts: { + [kind]: { + 0: { id: 0, address: wallet.address }, + 1: { id: 1, address: new Wallet(`0x${'33'.repeat(32)}`).address }, + }, + }, + }; + const makeProvider = () => ({ + getTransactionCount: jest.fn().mockResolvedValue(7), + sendTransaction: jest.fn(async (raw: string) => ({ + hash: Transaction.from(raw).hash, + })), + }); + provider = makeProvider(); + otherProvider = makeProvider(); + device = jest.fn(async (raw: string) => + wallet.signingKey.sign(Transaction.from(raw).unsignedHash) + ); + const ledger: any = { + evm: { + signEVMTransaction: jest.fn(async ({ rawTx }) => { + const signature = await device(`0x${rawTx}`); + return { + r: signature.r.slice(2), + s: signature.s.slice(2), + v: signature.v.toString(16), + }; + }), + }, + }; + const trezor: any = { + signEthTransaction: jest.fn(async ({ tx }) => { + const signature = await device( + serializeTransaction({ + ...tx, + type: tx.gasPrice === undefined ? 2 : 0, + }) + ); + return { + success: true, + payload: { + r: signature.r, + s: signature.s, + v: signature.v.toString(16), + }, + }; + }), + }; + getKey = jest.fn(() => { + throw new Error('Hardware account must not access a software key'); + }); + sessionGeneration = 1; + softwareUsed = false; + sdk = new EthereumTransactions( + () => state.activeNetwork, + getKey, + () => state, + ledger, + trezor, + () => { + const captured = sessionGeneration; + return () => { + if (sessionGeneration !== captured) + throw new Error('Wallet signing context changed'); + }; + } + ); + jest.spyOn(sdk, 'setWeb3Provider').mockImplementation((network: any) => { + (sdk as any)._web3Provider = + network.url === 'https://rpc-a.invalid' ? provider : otherProvider; + (sdk as any)._web3ProviderKey = `${network.chainId}|${network.url}`; + }); + }); + afterEach(() => { + if (!softwareUsed) expect(getKey).not.toHaveBeenCalled(); + jest.restoreAllMocks(); + }); + + it.each([false, true])( + 'preserves exact valid fields and one broadcast (legacy %s)', + async (legacy) => { + const response = await send(legacy); + expect(provider.sendTransaction).toHaveBeenCalledTimes(1); + expect(otherProvider.sendTransaction).not.toHaveBeenCalled(); + const tx = Transaction.from(provider.sendTransaction.mock.calls[0][0]); + expect(tx).toMatchObject({ + from: wallet.address, + to: recipient, + chainId: BigInt(57057), + nonce: 7, + value: BigInt(12345), + gasLimit: BigInt(21000), + data: '0x', + type: legacy ? 0 : 2, + }); + expect(response.hash).toBe(tx.hash); + expect(device).toHaveBeenCalledTimes(1); + } + ); + + it.each([ + 'account', + 'network', + 'in-place network', + 'in-place address', + 'session', + ])('discards a valid signature after pending %s switch', async (change) => { + const entered = deferred(); + const resume = deferred(); + const implementation = device.getMockImplementation()!; + device.mockImplementationOnce(async (raw: string) => { + entered.resolve(); + await resume.promise; + return implementation(raw); + }); + const signing = send(); + const rejection = expect(signing).rejects.toMatchObject({ + transactionNotBroadcast: true, + }); + await entered.promise; + if (change === 'account') state.activeAccountId = 1; + if (change === 'network') + state.activeNetwork = { + ...state.activeNetwork, + url: 'https://rpc-b.invalid', + }; + if (change === 'in-place network') state.activeNetwork.chainId = 1; + if (change === 'in-place address') + state.accounts[kind][0].address = recipient; + if (change === 'session') sessionGeneration += 1; + resume.resolve(); + await rejection; + expect(provider.sendTransaction).not.toHaveBeenCalled(); + expect(otherProvider.sendTransaction).not.toHaveBeenCalled(); + }); + + it('does not ask the device to sign after the account changes during nonce lookup', async () => { + const entered = deferred(); + const nonce = deferred(); + provider.getTransactionCount.mockImplementationOnce(() => { + entered.resolve(); + return nonce.promise; + }); + const signing = send(); + const rejection = expect(signing).rejects.toMatchObject({ + transactionNotBroadcast: true, + }); + await entered.promise; + state.activeAccountId = 1; + nonce.resolve(7); + await rejection; + expect(device).not.toHaveBeenCalled(); + expect(provider.sendTransaction).not.toHaveBeenCalled(); + expect(otherProvider.sendTransaction).not.toHaveBeenCalled(); + }); + + it.each(['estimateGas', 'getFeeData'])( + 'stops before the device after context changes during %s', + async (method) => { + const entered = deferred(); + const read = deferred(); + provider[method] = jest.fn(() => { + entered.resolve(); + return read.promise; + }); + const params: any = request(); + if (method === 'estimateGas') delete params.gasLimit; + else { + delete params.maxFeePerGas; + delete params.maxPriorityFeePerGas; + } + const signing = sdk.sendFormattedTransaction(params, false); + const rejection = expect(signing).rejects.toMatchObject({ + transactionNotBroadcast: true, + }); + await entered.promise; + state.activeNetwork = { + ...state.activeNetwork, + url: 'https://rpc-b.invalid', + }; + read.resolve( + method === 'estimateGas' + ? '21000' + : { maxFeePerGas: '100', maxPriorityFeePerGas: '2' } + ); + await rejection; + expect(device).not.toHaveBeenCalled(); + expect(provider.sendTransaction).not.toHaveBeenCalled(); + expect(otherProvider.sendTransaction).not.toHaveBeenCalled(); + } + ); + + it('retains the acknowledged hash when selection changes only after publication starts', async () => { + const entered = deferred(); + const ack = deferred(); + let hash: string; + provider.sendTransaction.mockImplementationOnce((raw: string) => { + hash = Transaction.from(raw).hash!; + entered.resolve(); + return ack.promise; + }); + const signing = send(); + await entered.promise; + state.activeAccountId = 1; + state.activeNetwork = { + ...state.activeNetwork, + url: 'https://rpc-b.invalid', + }; + ack.resolve({ hash: hash! }); + await expect(signing).resolves.toEqual({ hash: hash! }); + expect(provider.sendTransaction).toHaveBeenCalledTimes(1); + expect(otherProvider.sendTransaction).not.toHaveBeenCalled(); + expect(device).toHaveBeenCalledTimes(1); + }); + + describe.each([ + [ + 'ERC20 zero decimals', + 'sendSignedErc20Transaction', + 'transfer(address,uint256)', + ['2'], + 0, + ], + [ + 'ERC20 eight decimals', + 'sendSignedErc20Transaction', + 'transfer(address,uint256)', + ['200000001'], + 8, + ], + [ + 'ERC721 large id', + 'sendSignedErc721Transaction', + 'transferFrom(address,address,uint256)', + ['9007199254740993'], + 0, + ], + [ + 'ERC1155 large integer', + 'sendSignedErc1155Transaction', + 'safeTransferFrom(address,address,uint256,uint256,bytes)', + ['9007199254740993'], + 0, + ], + ] as const)( + '%s token approval', + (_name, method, fragment, [atomic], decimals) => { + const tokenAddress = `0x${'44'.repeat(20)}`; + const sendToken = (legacy = false) => { + // Model the old hardware getter's real empty-key return, not a fake + // software key. New code must not ask for it on hardware routes at all. + getKey.mockReturnValue({ + address: wallet.address, + decryptedPrivateKey: softwareUsed ? wallet.privateKey : '', + }); + return sdk[method]({ + tokenAddress, + receiver: recipient, + tokenAmount: + method === 'sendSignedErc1155Transaction' + ? atomic + : decimals === 8 + ? '2.00000001' + : '2', + tokenId: '9007199254740993', + decimals, + gasLimit: '200000', + isLegacy: legacy, + ...(legacy + ? { gasPrice: '100' } + : { maxFeePerGas: '100', maxPriorityFeePerGas: '2' }), + }); + }; + + it.each([false, true])( + 'preserves exact standard calldata and fee fields (legacy %s)', + async (legacy) => { + const response = await sendToken(legacy); + expect(provider.sendTransaction).toHaveBeenCalledTimes(1); + const tx = Transaction.from( + provider.sendTransaction.mock.calls[0][0] + ); + expect(tx).toMatchObject({ + from: wallet.address, + to: tokenAddress, + value: BigInt(0), + nonce: 7, + chainId: BigInt(57057), + gasLimit: BigInt(200000), + type: legacy ? 0 : 2, + }); + const parsed = new Interface([ + `function ${fragment}`, + ]).parseTransaction({ data: tx.data })!; + if (method === 'sendSignedErc20Transaction') + expect(Array.from(parsed.args)).toEqual([ + recipient, + BigInt(atomic), + ]); + else if (method === 'sendSignedErc721Transaction') + expect(Array.from(parsed.args)).toEqual([ + wallet.address, + recipient, + BigInt(atomic), + ]); + else + expect(Array.from(parsed.args)).toEqual([ + wallet.address, + recipient, + BigInt('9007199254740993'), + BigInt(atomic), + '0x', + ]); + expect(response.hash).toBe(tx.hash); + expect(device).toHaveBeenCalledTimes(1); + expect(otherProvider.sendTransaction).not.toHaveBeenCalled(); + } + ); + + it.each(['rejection', 'disconnect'])( + 'does not send after device %s', + async (failure) => { + const error = Object.assign( + new Error( + failure === 'rejection' + ? 'User rejected' + : 'Device disconnected' + ), + { + name: failure === 'rejection' ? 'UserCancel' : 'TransportError', + } + ); + device.mockRejectedValueOnce(error); + await expect(sendToken()).rejects.toBe(error); + expect(device).toHaveBeenCalledTimes(1); + expect(provider.sendTransaction).not.toHaveBeenCalled(); + expect(otherProvider.sendTransaction).not.toHaveBeenCalled(); + } + ); + + it.each(['account', 'network', 'session'])( + 'discards the valid signature after pending %s switch', + async (change) => { + const entered = deferred(); + const resume = deferred(); + const implementation = device.getMockImplementation()!; + device.mockImplementationOnce(async (raw: string) => { + entered.resolve(); + await resume.promise; + return implementation(raw); + }); + const signing = sendToken(); + const rejection = expect(signing).rejects.toThrow( + 'Wallet signing context changed' + ); + await entered.promise; + if (change === 'account') state.activeAccountId = 1; + if (change === 'network') + state.activeNetwork = { + ...state.activeNetwork, + url: 'https://rpc-b.invalid', + }; + if (change === 'session') sessionGeneration += 1; + resume.resolve(); + await rejection; + expect(provider.sendTransaction).not.toHaveBeenCalled(); + expect(otherProvider.sendTransaction).not.toHaveBeenCalled(); + } + ); + + it('stops before hardware when selection changes during pending nonce read', async () => { + const entered = deferred(); + const nonce = deferred(); + provider.getTransactionCount.mockImplementationOnce(() => { + entered.resolve(); + return nonce.promise; + }); + const signing = sendToken(); + const rejection = expect(signing).rejects.toThrow( + 'Wallet signing context changed' + ); + await entered.promise; + state.activeAccountId = 1; + nonce.resolve(7); + await rejection; + expect(device).not.toHaveBeenCalled(); + expect(provider.sendTransaction).not.toHaveBeenCalled(); + }); + + if (kind === KeyringAccountType.Ledger) + describe('software route controls (no physical hardware)', () => { + beforeEach(() => { + softwareUsed = true; + state.activeAccountType = KeyringAccountType.HDAccount; + state.accounts.HDAccount = { ...state.accounts[kind] }; + provider.verifyConfiguredChainId = jest + .fn() + .mockResolvedValue(undefined); + }); + + it('retains the real local-signing success path without requesting a device', async () => { + const response = await sendToken(); + expect(getKey).toHaveBeenCalledTimes(1); + expect(device).not.toHaveBeenCalled(); + expect(provider.sendTransaction).toHaveBeenCalledTimes(1); + const tx = Transaction.from( + provider.sendTransaction.mock.calls[0][0] + ); + expect(tx.from).toBe(wallet.address); + expect(response.hash).toBe(tx.hash); + }); + + it.each(['getTransactionCount', 'verifyConfiguredChainId'])( + 'refuses a stale software result after %s is pending', + async (method) => { + const entered = deferred(); + const reply = deferred(); + provider[method].mockImplementationOnce(() => { + entered.resolve(); + return reply.promise; + }); + const signing = sendToken(); + const rejection = expect(signing).rejects.toThrow( + 'Wallet signing context changed' + ); + await entered.promise; + state.activeAccountId = 1; + reply.resolve(method === 'getTransactionCount' ? 7 : undefined); + await rejection; + expect(getKey).toHaveBeenCalledTimes(1); + expect(device).not.toHaveBeenCalled(); + expect(provider.sendTransaction).not.toHaveBeenCalled(); + expect(otherProvider.sendTransaction).not.toHaveBeenCalled(); + } + ); + }); + } + ); + } +); + +describe('EVM cancellation signing context', () => { + // Public deterministic fixtures, never real wallet keys. Software signing and + // device transaction encoders are real; provider and device I/O stay in memory. + const wallet = new Wallet(`0x${'01'.repeat(32)}`); + const otherWallet = new Wallet(`0x${'02'.repeat(32)}`); + const PAYER = wallet.address; + let HASH: string; + const CHAIN = 5700; + const accountTypes = [ + KeyringAccountType.HDAccount, + KeyringAccountType.Imported, + KeyringAccountType.Ledger, + KeyringAccountType.Trezor, + ]; + const deferred = () => { + let resolve!: (value: T) => void; + const promise = new Promise((done) => (resolve = done)); + return { promise, resolve }; + }; + const deviceSignature = (params: any) => { + const tx = Transaction.from( + typeof params === 'string' ? params : serializeTransaction(params) + ); + return wallet.signingKey.sign(tx.unsignedHash); + }; + + let state: any; + let session: object; + let sdk: EthereumTransactions; + let provider: any; + let currentProvider: any; + let getKey: jest.Mock; + let ledger: any; + let trezor: any; + let signed: Transaction[]; + let hostCurrent: boolean; + let assertHostContext: () => void; + + const run = (legacy = true, fallbackNonce?: number) => + sdk.cancelSentTransaction(HASH, legacy, fallbackNonce, { + assertCurrentContext: assertHostContext, + approvedMaximumFee: '9'.repeat(78), + validateOriginal: () => undefined, + }); + const original = (nonce = 7, fields: any = {}) => { + const type = fields.type ?? 2; + const tx = Transaction.from({ + type, + chainId: CHAIN, + nonce, + to: PAYER, + value: 0, + data: '0x', + gasLimit: 21000, + ...(type === 0 + ? { gasPrice: (fields.gasPrice ?? 100).toString() } + : { + maxFeePerGas: (fields.maxFeePerGas ?? 100).toString(), + maxPriorityFeePerGas: ( + fields.maxPriorityFeePerGas ?? 10 + ).toString(), + }), + }); + tx.signature = wallet.signingKey.sign(tx.unsignedHash); + HASH = tx.hash!; + return { + ...tx.toJSON(), + signature: tx.signature, + hash: HASH, + from: PAYER, + nonce, + gasPrice: BigNumber.from(tx.gasPrice ?? fields.gasPrice ?? 100), + maxFeePerGas: + tx.maxFeePerGas === null ? undefined : BigNumber.from(tx.maxFeePerGas), + maxPriorityFeePerGas: + tx.maxPriorityFeePerGas === null + ? undefined + : BigNumber.from(tx.maxPriorityFeePerGas), + gasLimit: BigNumber.from(21000), + }; + }; + const mutate = (change: string) => { + switch (change) { + case 'account': + state.activeAccountId = 1; + break; + case 'account type': + state.activeAccountType = KeyringAccountType.Imported; + break; + case 'address': + state.accounts[state.activeAccountType][0].address = + otherWallet.address; + break; + case 'chain': + state.activeNetwork.chainId += 1; + break; + case 'network kind': + state.activeNetwork.kind = 'syscoin'; + break; + case 'RPC': + state.activeNetwork.url += '/changed'; + break; + case 'slip44': + state.activeNetwork.slip44 += 1; + break; + case 'provider': + currentProvider = { ...provider }; + break; + case 'session': + session = {}; + break; + default: + throw new Error(`Unknown fixture mutation: ${change}`); + } + }; + const changes = [ + 'account', + 'account type', + 'address', + 'chain', + 'network kind', + 'RPC', + 'slip44', + 'provider', + 'session', + ]; + + beforeEach(() => { + signed = []; + session = {}; + hostCurrent = true; + assertHostContext = () => { + if (!hostCurrent) throw new Error('Host selection changed'); + }; + state = { + activeAccountType: KeyringAccountType.HDAccount, + activeAccountId: 0, + activeNetwork: { + chainId: CHAIN, + kind: 'ethereum', + slip44: 60, + currency: 'tsys', + url: 'https://rpc.invalid', + }, + accounts: Object.fromEntries( + accountTypes.map((type) => [ + type, + { 0: { address: PAYER }, 1: { address: otherWallet.address } }, + ]) + ), + }; + provider = { + getTransaction: jest.fn().mockResolvedValue(original()), + getGasPrice: jest.fn().mockResolvedValue(BigNumber.from(100)), + getNetwork: jest.fn().mockResolvedValue({ chainId: CHAIN }), + getTransactionCount: jest.fn().mockResolvedValue(99), + verifyConfiguredChainId: jest.fn().mockResolvedValue(undefined), + sendTransaction: jest.fn(async (raw: string) => { + const tx = Transaction.from(raw); + signed.push(tx); + return { hash: tx.hash, from: tx.from, nonce: tx.nonce }; + }), + }; + currentProvider = provider; + getKey = jest.fn(() => ({ + address: PAYER, + decryptedPrivateKey: wallet.privateKey, + })); + ledger = { + evm: { + signEVMTransaction: jest.fn(async ({ rawTx }) => { + const signature = deviceSignature(`0x${rawTx}`); + return { + r: signature.r.slice(2), + s: signature.s.slice(2), + v: signature.v.toString(16), + }; + }), + }, + }; + trezor = { + signEthTransaction: jest.fn(async ({ tx }) => { + const signature = deviceSignature(tx); + return { + success: true, + payload: { r: signature.r, s: signature.s, v: signature.v }, + }; + }), + }; + sdk = new EthereumTransactions( + () => state.activeNetwork, + getKey, + () => state, + ledger, + trezor, + () => { + const captured = session; + return () => { + if (captured !== session) throw new Error('Session changed'); + }; + } + ); + Object.defineProperty(sdk, 'web3Provider', { + get: () => currentProvider, + }); + jest + .spyOn(sdk, 'getFeeDataWithDynamicMaxPriorityFeePerGas') + .mockResolvedValue({ + gasPrice: BigNumber.from(100), + baseFeePerGas: BigNumber.from(1), + maxFeePerGas: BigNumber.from(100), + maxPriorityFeePerGas: BigNumber.from(10), + }); + }); + + afterEach(() => jest.restoreAllMocks()); + + it.each( + accountTypes.flatMap((type) => + [true, false].flatMap((legacy) => + [0, 7].flatMap((nonce) => + [true, false].map((missing) => ({ type, legacy, nonce, missing })) + ) + ) + ) + )('preserves cancellation payload and exact fees for %j', async (test) => { + state.activeAccountType = test.type; + provider.getTransaction.mockResolvedValue( + test.missing ? null : original(test.nonce, { type: test.legacy ? 0 : 2 }) + ); + sdk.setGasOverrides({ minGasLimit: '99999' }); + const result = await run(test.legacy, test.nonce); + expect(result.isCanceled).toBe(true); + expect(signed).toHaveLength(1); + const tx = signed[0]; + expect(tx.from).toBe(PAYER); + expect(tx.to).toBe(PAYER); + expect(tx.nonce).toBe(test.nonce); + expect(tx.chainId).toBe(BigInt(CHAIN)); + expect(tx.gasLimit).toBe(BigInt(42000)); + expect(tx.value).toBe(BigInt(0)); + expect(tx.data).toBe('0x'); + expect(tx.type).toBe(test.legacy ? 0 : 2); + if (test.legacy) expect(tx.gasPrice).toBe(BigInt(120)); + else { + expect(tx.maxFeePerGas).toBe(BigInt(120)); + expect(tx.maxPriorityFeePerGas).toBe(BigInt(12)); + } + expect(provider.getTransactionCount).not.toHaveBeenCalled(); + if (!test.legacy) + expect( + sdk.getFeeDataWithDynamicMaxPriorityFeePerGas + ).toHaveBeenCalledWith(provider); + if ( + [KeyringAccountType.Ledger, KeyringAccountType.Trezor].includes(test.type) + ) + expect(getKey).not.toHaveBeenCalled(); + }); + + it.each(changes)( + 'rejects changed %s after original lookup, before any signing', + async (change) => { + const held = deferred(); + provider.getTransaction.mockReturnValue(held.promise); + const result = run(); + const rejected = expect(result).rejects.toThrow(); + mutate(change); + held.resolve(original()); + await rejected; + expect(getKey).not.toHaveBeenCalled(); + expect(ledger.evm.signEVMTransaction).not.toHaveBeenCalled(); + expect(trezor.signEthTransaction).not.toHaveBeenCalled(); + expect(provider.sendTransaction).not.toHaveBeenCalled(); + } + ); + + it.each( + [true, false].flatMap((legacy) => + [true, false].map((missing) => ({ legacy, missing })) + ) + )( + 'rejects a changed session after delayed fee lookup for %j', + async ({ legacy, missing }) => { + provider.getTransaction.mockResolvedValue(missing ? null : original()); + const started = deferred(); + const held = deferred(); + const lookup = () => { + started.resolve(); + return held.promise; + }; + if (legacy) provider.getGasPrice.mockImplementation(lookup); + else + jest + .mocked(sdk.getFeeDataWithDynamicMaxPriorityFeePerGas) + .mockImplementation(lookup); + const result = run(legacy, 7); + const rejected = expect(result).rejects.toThrow('Session changed'); + await started.promise; + session = {}; + held.resolve( + legacy + ? BigNumber.from(100) + : { + maxFeePerGas: BigNumber.from(100), + maxPriorityFeePerGas: BigNumber.from(10), + } + ); + await rejected; + expect(getKey).not.toHaveBeenCalled(); + expect(provider.sendTransaction).not.toHaveBeenCalled(); + } + ); + + it.each(changes)( + 'rejects changed %s before software signing after provider preflight', + async (change) => { + const started = deferred(); + const held = deferred(); + provider.verifyConfiguredChainId.mockImplementation(() => { + started.resolve(); + return held.promise; + }); + const result = run(); + await started.promise; + mutate(change); + held.resolve(); + expect(await result).toEqual({ isCanceled: false, error: true }); + expect(provider.sendTransaction).not.toHaveBeenCalled(); + } + ); + + it.each( + [KeyringAccountType.Ledger, KeyringAccountType.Trezor].flatMap((type) => + changes.map((change) => ({ type, change })) + ) + )( + 'does not broadcast delayed hardware approval after %j', + async ({ type, change }) => { + state.activeAccountType = type; + const started = deferred(); + const held = deferred(); + const device = + type === KeyringAccountType.Ledger + ? ledger.evm.signEVMTransaction + : trezor.signEthTransaction; + const implementation = device.getMockImplementation(); + device.mockImplementation(async (params: any) => { + started.resolve(); + await held.promise; + return implementation(params); + }); + const result = run(); + await started.promise; + mutate(change); + held.resolve(); + expect(await result).toEqual({ isCanceled: false, error: true }); + expect(provider.sendTransaction).not.toHaveBeenCalled(); + expect(getKey).not.toHaveBeenCalled(); + } + ); + + it('rejects a private-key lookup returning another account', async () => { + getKey.mockReturnValue({ + address: otherWallet.address, + decryptedPrivateKey: otherWallet.privateKey, + }); + expect(await run()).toEqual({ isCanceled: false, error: true }); + expect(provider.verifyConfiguredChainId).not.toHaveBeenCalled(); + expect(provider.sendTransaction).not.toHaveBeenCalled(); + }); + + it.each(accountTypes)( + 'retains a %s acknowledged hash when context changes after submission', + async (type) => { + state.activeAccountType = type; + provider.sendTransaction.mockImplementation(async (raw: string) => { + state.activeNetwork.chainId += 1; + return { hash: Transaction.from(raw).hash }; + }); + const result = await run(); + expect(result.isCanceled).toBe(true); + expect(result.transaction?.hash).toMatch(/^0x[\da-f]{64}$/); + } + ); + + it('preserves missing-original/no-fallback behavior without signing', async () => { + provider.getTransaction.mockResolvedValue(null); + expect(await run()).toEqual({ isCanceled: false, error: true }); + expect(getKey).not.toHaveBeenCalled(); + expect(provider.sendTransaction).not.toHaveBeenCalled(); + }); + + it.each([true, false])( + 'keeps the one-wei minimum bump (legacy=%s)', + async (legacy) => { + provider.getTransaction.mockResolvedValue({ + ...original(7, { + type: legacy ? 0 : 2, + gasPrice: BigNumber.from(0), + maxFeePerGas: BigNumber.from(1), + maxPriorityFeePerGas: BigNumber.from(0), + }), + }); + provider.getGasPrice.mockResolvedValue(BigNumber.from(0)); + jest + .mocked(sdk.getFeeDataWithDynamicMaxPriorityFeePerGas) + .mockResolvedValue({ + gasPrice: BigNumber.from(0), + baseFeePerGas: BigNumber.from(0), + maxFeePerGas: BigNumber.from(1), + maxPriorityFeePerGas: BigNumber.from(0), + }); + expect((await run(legacy)).isCanceled).toBe(true); + if (legacy) expect(signed[0].gasPrice).toBe(BigInt(1)); + else { + expect(signed[0].maxFeePerGas).toBe(BigInt(2)); + expect(signed[0].maxPriorityFeePerGas).toBe(BigInt(1)); + } + } + ); + + it.each([true, false])( + 'retains large integer fee precision (legacy=%s)', + async (legacy) => { + const large = BigNumber.from('1000000000000000003'); + provider.getTransaction.mockResolvedValue({ + ...original(7, { + type: legacy ? 0 : 2, + gasPrice: large, + maxFeePerGas: large, + }), + }); + expect((await run(legacy)).isCanceled).toBe(true); + const fee = legacy ? signed[0].gasPrice : signed[0].maxFeePerGas; + expect(fee).toBe(BigInt('1200000000000000003')); + } + ); + + it.each([ + { legacy: true, fee: -1 }, + { legacy: true, fee: Number.MAX_SAFE_INTEGER + 1 }, + { legacy: true, fee: 'not-a-fee' }, + { legacy: false, maximum: 0, priority: 0 }, + { legacy: false, maximum: 1, priority: 2 }, + { legacy: false, maximum: 1, priority: -1 }, + { legacy: false, maximum: 'not-a-fee', priority: 0 }, + ])( + 'rejects invalid cancellation fee data %j before signing', + async (test) => { + if (test.legacy) provider.getGasPrice.mockResolvedValue(test.fee); + else { + jest + .mocked(sdk.getFeeDataWithDynamicMaxPriorityFeePerGas) + .mockResolvedValue({ + maxFeePerGas: test.maximum, + maxPriorityFeePerGas: test.priority, + } as any); + } + await expect(run(test.legacy)).rejects.toThrow(); + expect(getKey).not.toHaveBeenCalled(); + expect(ledger.evm.signEVMTransaction).not.toHaveBeenCalled(); + expect(trezor.signEthTransaction).not.toHaveBeenCalled(); + expect(provider.sendTransaction).not.toHaveBeenCalled(); + } + ); + + it.each(['lookup', 'legacy fee', 'dynamic fee'])( + 'does not sign after %s failure', + async (step) => { + const error = new Error('Synthetic unavailable RPC'); + if (step === 'lookup') provider.getTransaction.mockRejectedValue(error); + if (step === 'legacy fee') provider.getGasPrice.mockRejectedValue(error); + if (step === 'dynamic fee') + jest + .mocked(sdk.getFeeDataWithDynamicMaxPriorityFeePerGas) + .mockRejectedValue(error); + await expect(run(step !== 'dynamic fee')).rejects.toBe(error); + expect(getKey).not.toHaveBeenCalled(); + expect(provider.sendTransaction).not.toHaveBeenCalled(); + } + ); + + it.each([KeyringAccountType.Ledger, KeyringAccountType.Trezor])( + 'preserves %s device rejection without broadcast', + async (type) => { + state.activeAccountType = type; + const device = + type === KeyringAccountType.Ledger + ? ledger.evm.signEVMTransaction + : trezor.signEthTransaction; + device.mockRejectedValue(new Error('Synthetic device rejection')); + expect(await run()).toEqual({ isCanceled: false, error: true }); + expect(getKey).not.toHaveBeenCalled(); + expect(provider.sendTransaction).not.toHaveBeenCalled(); + } + ); + + it.each(accountTypes)( + 'checks a host selection hidden by the %s keyring payer selection', + async (type) => { + state.activeAccountType = type; + let hostScope = 'smart-account-a'; + const assertCurrentContext = jest.fn(() => { + if (hostScope !== 'smart-account-a') + throw new Error('Host selection changed'); + }); + const entered = deferred(); + const held = deferred(); + provider.getTransaction.mockImplementation(async () => { + entered.resolve(); + await held.promise; + return original(); + }); + const pending = sdk.cancelSentTransaction(HASH, true, 7, { + assertCurrentContext, + approvedMaximumFee: '9'.repeat(78), + validateOriginal: () => undefined, + }); + const rejected = expect(pending).rejects.toThrow( + 'Host selection changed' + ); + await entered.promise; + hostScope = 'smart-account-b'; + held.resolve(); + await rejected; + expect(state.activeAccountType).toBe(type); + expect(state.activeAccountId).toBe(0); + expect(assertCurrentContext).toHaveBeenCalled(); + expect(getKey).not.toHaveBeenCalled(); + expect(ledger.evm.signEVMTransaction).not.toHaveBeenCalled(); + expect(trezor.signEthTransaction).not.toHaveBeenCalled(); + expect(provider.sendTransaction).not.toHaveBeenCalled(); + } + ); + + it.each(accountTypes)( + 'keeps a %s acknowledged hash after the host selection changes at submission', + async (type) => { + state.activeAccountType = type; + let current = true; + provider.sendTransaction.mockImplementation(async (raw: string) => { + current = false; + return { hash: Transaction.from(raw).hash }; + }); + const result = await sdk.cancelSentTransaction(HASH, true, 7, { + approvedMaximumFee: '9'.repeat(78), + validateOriginal: () => undefined, + assertCurrentContext: () => { + if (!current) throw new Error('Host selection changed'); + }, + }); + expect(result.isCanceled).toBe(true); + expect(result.transaction?.hash).toMatch(/^0x[\da-f]{64}$/); + } + ); + + it.each([KeyringAccountType.Ledger, KeyringAccountType.Trezor])( + 'checks the host guard after a pending %s device response', + async (type) => { + state.activeAccountType = type; + let current = true; + const entered = deferred(); + const held = deferred(); + const device = + type === KeyringAccountType.Ledger + ? ledger.evm.signEVMTransaction + : trezor.signEthTransaction; + const implementation = device.getMockImplementation(); + device.mockImplementation(async (params: any) => { + entered.resolve(); + await held.promise; + return implementation(params); + }); + const pending = sdk.cancelSentTransaction(HASH, true, 7, { + approvedMaximumFee: '9'.repeat(78), + validateOriginal: () => undefined, + assertCurrentContext: () => { + if (!current) throw new Error('Host selection changed'); + }, + }); + await entered.promise; + current = false; + held.resolve(); + expect(await pending).toEqual({ isCanceled: false, error: true }); + expect(provider.sendTransaction).not.toHaveBeenCalled(); + } + ); + + it('checks the host guard before private-key signing after provider preflight', async () => { + let current = true; + provider.verifyConfiguredChainId.mockImplementation(async () => { + current = false; + }); + const result = await sdk.cancelSentTransaction(HASH, true, 7, { + approvedMaximumFee: '9'.repeat(78), + validateOriginal: () => undefined, + assertCurrentContext: () => { + if (!current) throw new Error('Host selection changed'); + }, + }); + expect(result).toEqual({ isCanceled: false, error: true }); + expect(provider.sendTransaction).not.toHaveBeenCalled(); + }); + + it.each([ + undefined, + null, + {}, + { assertCurrentContext: null }, + { assertCurrentContext: true }, + ])( + 'rejects missing or invalid required host context %p before runtime access', + async (options) => { + const capture = jest.spyOn(sdk as any, 'captureEvmSigningContext'); + await expect( + sdk.cancelSentTransaction(HASH, true, 7, options as any) + ).rejects.toThrow('Cancellation context required'); + expect(capture).not.toHaveBeenCalled(); + expect(provider.getTransaction).not.toHaveBeenCalled(); + expect(provider.getGasPrice).not.toHaveBeenCalled(); + expect(getKey).not.toHaveBeenCalled(); + expect(ledger.evm.signEVMTransaction).not.toHaveBeenCalled(); + expect(trezor.signEthTransaction).not.toHaveBeenCalled(); + expect(provider.sendTransaction).not.toHaveBeenCalled(); + } + ); + + it('rejects the former three-argument invocation before runtime access', async () => { + await expect( + (sdk.cancelSentTransaction as any)(HASH, true, 7) + ).rejects.toThrow('Cancellation context required'); + expect(provider.getTransaction).not.toHaveBeenCalled(); + expect(getKey).not.toHaveBeenCalled(); + expect(provider.sendTransaction).not.toHaveBeenCalled(); + }); + + it('rejects an already-stale explicit host context before runtime access', async () => { + hostCurrent = false; + await expect(run()).rejects.toThrow('Host selection changed'); + expect(provider.getTransaction).not.toHaveBeenCalled(); + expect(getKey).not.toHaveBeenCalled(); + expect(provider.sendTransaction).not.toHaveBeenCalled(); + }); +}); diff --git a/packages/sysweb3-keyring/test/unit/transactions/ethereum-replacement.spec.ts b/packages/sysweb3-keyring/test/unit/transactions/ethereum-replacement.spec.ts new file mode 100644 index 00000000..c516d442 --- /dev/null +++ b/packages/sysweb3-keyring/test/unit/transactions/ethereum-replacement.spec.ts @@ -0,0 +1,1671 @@ +// The shared vault setup imports the SDK. Reload it so these test-local +// device and signer mocks govern the source modules used below. +jest.resetModules(); +(global as any).window.location = { href: 'http://localhost/' }; + +import { INetworkType } from '@sidhujag/sysweb3-network'; +import { Transaction } from 'ethers/transaction'; +import { Wallet } from 'ethers/wallet'; + +import { BigNumber, serializeTransaction } from '../../../src/ethers-v6'; +import { KeyringManager } from '../../../src/keyring-manager'; +import { EthereumTransactions } from '../../../src/transactions/ethereum'; +import { + privateKeyToAccount, + sendLocalEvmTransaction, +} from '../../../src/transactions/evm-local-signer'; +import { KeyringAccountType } from '../../../src/types'; + +// Keep the provider's real response normalization, which the shared setup +// omits from its provider mock. All RPCs are supplied by each test. +jest.mock('../../../src/providers', () => ({ + ...jest.requireActual('../../../src/providers'), + CustomJsonRpcProvider: jest.fn(), +})); + +jest.mock('../../../src/transactions/evm-local-signer', () => ({ + ...jest.requireActual('../../../src/transactions/evm-local-signer'), + privateKeyToAccount: jest.fn(), + sendLocalEvmTransaction: jest.fn(), +})); +jest.mock('crypto-js', () => ({ + ...jest.requireActual('crypto-js'), + AES: { ...jest.requireActual('crypto-js').AES, decrypt: jest.fn() }, +})); +jest.mock('syscoinjs-lib', () => ({ + utils: { bitcoinjs: {} }, + networks: { bitcoin: {}, syscoin: {} }, +})); +jest.mock('../../../src/hardware-wallet-manager-singleton', () => ({ + HardwareWalletManagerSingleton: { getInstance: () => ({}) }, +})); +jest.mock('../../../src/ledger', () => ({ + LedgerKeyring: jest.fn(), +})); +jest.mock('../../../src/trezor', () => ({ + TrezorKeyring: jest.fn(), +})); + +const mockAes = jest.requireMock('crypto-js').AES; + +// Deliberately public deterministic test keys, with no provider or live account. +const hardwareWallet = new Wallet(`0x${'11'.repeat(32)}`); +const otherHardwareWallet = new Wallet(`0x${'22'.repeat(32)}`); +const PAYER = hardwareWallet.address; +const SMART = `0x${'22'.repeat(20)}`; +const TARGET = `0x${'33'.repeat(20)}`; +const REPLACEMENT = `0x${'55'.repeat(32)}`; +const CHAIN = 5700; +const APPROVED_MAXIMUM_FEE = '3024000'; +const payer = { type: KeyringAccountType.HDAccount, id: 3 }; +const smart = { type: KeyringAccountType.SmartAccount, id: 7 }; +const response = { hash: REPLACEMENT, from: PAYER, nonce: 8, chainId: CHAIN }; +const ACCESS_LIST = [ + { address: TARGET, storageKeys: [`0x${'66'.repeat(32)}`] }, +]; +const deviceSignature = async (params: any, wallet = hardwareWallet) => { + const tx = Transaction.from( + typeof params === 'string' ? params : serializeTransaction(params) + ); + const signed = await wallet.signTransaction({ + chainId: tx.chainId, + nonce: tx.nonce, + type: tx.type, + to: tx.to, + value: tx.value, + data: tx.data, + gasLimit: tx.gasLimit, + accessList: tx.accessList, + ...(tx.type === 0 || tx.type === 1 + ? { gasPrice: tx.gasPrice } + : { + maxFeePerGas: tx.maxFeePerGas, + maxPriorityFeePerGas: tx.maxPriorityFeePerGas, + }), + }); + const signature = Transaction.from(signed).signature!; + return { r: signature.r, s: signature.s, v: signature.v }; +}; +const transaction = (fields: any = {}, wallet = hardwareWallet) => { + const type = fields.type ?? 2; + const scalar = (value: any) => value.toString(); + const signed = Transaction.from({ + type, + to: fields.to ?? TARGET, + nonce: fields.nonce ?? 8, + chainId: scalar(fields.chainId ?? CHAIN), + value: scalar(fields.value ?? 7), + data: fields.data ?? '0x1234', + gasLimit: scalar(fields.gasLimit ?? 21000), + ...(type === 0 || type === 1 + ? { gasPrice: scalar(fields.gasPrice ?? 100) } + : { + maxFeePerGas: scalar(fields.maxFeePerGas ?? 100), + maxPriorityFeePerGas: scalar(fields.maxPriorityFeePerGas ?? 10), + }), + ...(type === 1 || type === 2 + ? { accessList: fields.accessList ?? [] } + : {}), + }); + signed.signature = wallet.signingKey.sign(signed.unsignedHash); + return { + hash: signed.hash!, + from: signed.from!, + to: signed.to, + type: signed.type, + nonce: signed.nonce, + chainId: Number(signed.chainId), + value: BigNumber.from(signed.value), + data: signed.data, + gasLimit: BigNumber.from(signed.gasLimit), + gasPrice: BigNumber.from(signed.gasPrice ?? signed.maxFeePerGas ?? 0), + maxFeePerGas: + signed.maxFeePerGas === null ? null : BigNumber.from(signed.maxFeePerGas), + maxPriorityFeePerGas: + signed.maxPriorityFeePerGas === null + ? null + : BigNumber.from(signed.maxPriorityFeePerGas), + accessList: signed.accessList, + signature: signed.signature, + ...fields, + }; +}; +const ORIGINAL = transaction().hash; +const unsignedTransaction = (tx: any) => { + const fields = { ...tx }; + delete fields.from; + return Transaction.from(serializeTransaction(fields)); +}; +const deferred = () => { + let resolve!: (value: T) => void; + const promise = new Promise((finish) => (resolve = finish)); + return { promise, resolve }; +}; + +describe('source SDK account-scoped replacement signing', () => { + let state: any; + let sdk: EthereumTransactions; + let provider: any; + let currentProvider: any; + let getKey: jest.Mock; + let ledger: any; + let trezor: any; + let current: boolean; + let beforeBroadcast: jest.Mock; + let validateOriginal: jest.Mock; + + const options = (targetAccount = payer) => ({ + targetAccount, + approvedMaximumFee: APPROVED_MAXIMUM_FEE, + assertCurrentContext: () => { + if (!current) throw new Error('PALI_TRANSACTION_CONTEXT_CHANGED'); + }, + validateOriginal, + beforeBroadcast, + }); + const useOriginal = (original: any) => { + provider.getTransaction.mockResolvedValue(original); + validateOriginal.mockImplementation((tx) => { + if (tx.hash !== original.hash || tx.nonce !== Number(original.nonce)) + throw new Error('Original transaction changed'); + }); + return original.hash as string; + }; + + beforeEach(() => { + jest.clearAllMocks(); + jest.spyOn(console, 'error').mockImplementation(() => undefined); + current = true; + state = { + activeAccountType: smart.type, + activeAccountId: smart.id, + activeNetwork: { + chainId: CHAIN, + kind: INetworkType.Ethereum, + slip44: 60, + currency: 'tsys', + url: 'https://rpc-a.example', + }, + accounts: { + [payer.type]: { [payer.id]: { address: PAYER } }, + [smart.type]: { [smart.id]: { address: SMART } }, + [KeyringAccountType.Ledger]: { 4: { address: PAYER } }, + [KeyringAccountType.Trezor]: { 5: { address: PAYER } }, + }, + }; + provider = { + getTransaction: jest.fn().mockResolvedValue(transaction()), + getNetwork: jest.fn().mockResolvedValue({ chainId: CHAIN }), + getBalance: jest.fn().mockResolvedValue(BigNumber.from('1000000000')), + getGasPrice: jest.fn().mockResolvedValue(BigNumber.from(1000)), + getBlock: jest + .fn() + .mockResolvedValue({ baseFeePerGas: BigNumber.from(50) }), + send: jest.fn().mockResolvedValue('0x2'), + sendTransaction: jest.fn().mockResolvedValue(response), + }; + currentProvider = provider; + getKey = jest.fn().mockReturnValue({ + address: PAYER, + decryptedPrivateKey: 'mocked-private-key', + }); + ledger = { + evm: { + signEVMTransaction: jest.fn(async ({ rawTx }) => { + const signature = await deviceSignature(`0x${rawTx}`); + return { + r: signature.r.slice(2), + s: signature.s.slice(2), + v: signature.v.toString(16), + }; + }), + }, + }; + trezor = { + signEthTransaction: jest.fn(async ({ tx }) => ({ + success: true, + payload: await deviceSignature(tx), + })), + }; + sdk = new EthereumTransactions( + (() => state.activeNetwork) as any, + getKey as any, + (() => state) as any, + ledger as any, + trezor as any + ); + Object.defineProperty(sdk, 'web3Provider', { + configurable: true, + get: () => currentProvider, + }); + beforeBroadcast = jest.fn(); + validateOriginal = jest.fn((tx) => { + if (tx.hash !== ORIGINAL || tx.nonce !== 8) + throw new Error('Original transaction changed'); + }); + jest + .mocked(sendLocalEvmTransaction) + .mockImplementation(async (capturedProvider, _key, _tx, before) => { + await Promise.resolve(); + before?.(); + return capturedProvider.sendTransaction('mocked-signed-transaction'); + }); + }); + afterEach(() => jest.restoreAllMocks()); + + it.each([false, true])( + 'signs through the explicit outer payer without changing the active SmartAccount (legacy=%s)', + async (legacy) => { + const hash = useOriginal(transaction({ type: legacy ? 0 : 2 })); + await expect( + sdk.sendTransactionWithEditedFee(hash, legacy, options()) + ).resolves.toMatchObject({ isSpeedUp: true, transaction: response }); + expect(getKey).toHaveBeenCalledWith(payer); + expect(state.activeAccountType).toBe(smart.type); + expect(state.activeAccountId).toBe(smart.id); + const [, key, tx] = jest.mocked(sendLocalEvmTransaction).mock.calls[0]; + expect(key).toBe('mocked-private-key'); + expect(tx).toMatchObject({ + from: PAYER, + to: TARGET, + nonce: 8, + chainId: CHAIN, + data: '0x1234', + }); + expect(tx.value.toString()).toBe('7'); + expect(tx.gasLimit.toString()).toBe('25200'); + expect((legacy ? tx.gasPrice : tx.maxFeePerGas).toString()).toBe('120'); + expect(beforeBroadcast).toHaveBeenCalledTimes(1); + expect(provider.sendTransaction).toHaveBeenCalledTimes(1); + } + ); + + it('requires explicit fee approval for an ordinary two-argument EOA call', async () => { + state.activeAccountType = payer.type; + state.activeAccountId = payer.id; + await expect( + sdk.sendTransactionWithEditedFee(ORIGINAL, false) + ).rejects.toThrow(); + expect(provider.getTransaction).not.toHaveBeenCalled(); + expect(getKey).not.toHaveBeenCalled(); + expect(provider.sendTransaction).not.toHaveBeenCalled(); + }); + + describe('signed fee previews and captured approval caps', () => { + const expectNoSigning = () => { + expect(getKey).not.toHaveBeenCalled(); + expect(sendLocalEvmTransaction).not.toHaveBeenCalled(); + expect(ledger.evm.signEVMTransaction).not.toHaveBeenCalled(); + expect(trezor.signEthTransaction).not.toHaveBeenCalled(); + expect(beforeBroadcast).not.toHaveBeenCalled(); + expect(provider.sendTransaction).not.toHaveBeenCalled(); + }; + const expectNoFeeRpc = () => { + expect(provider.getBlock).not.toHaveBeenCalled(); + expect(provider.getGasPrice).not.toHaveBeenCalled(); + }; + const zeroFeeOriginal = (type: number) => + transaction({ + type, + ...(type === 0 || type === 1 + ? { gasPrice: BigNumber.from(0) } + : { + maxFeePerGas: BigNumber.from(0), + maxPriorityFeePerGas: BigNumber.from(0), + }), + ...(type ? { accessList: ACCESS_LIST } : {}), + }); + const positiveQuote = () => { + provider.getGasPrice.mockResolvedValue(BigNumber.from(100)); + provider.send.mockResolvedValue('0x19'); + }; + + it.each([ + { type: 0, requestedLegacy: false }, + { type: 2, requestedLegacy: true }, + ])( + 'derives fee mode from the signed original despite poisoned caller mode %j', + async ({ type, requestedLegacy }) => { + const hash = useOriginal( + transaction({ + type, + ...(type === 2 ? { accessList: ACCESS_LIST } : {}), + }) + ); + await expect( + sdk.sendTransactionWithEditedFee(hash, requestedLegacy, options()) + ).resolves.toMatchObject({ isSpeedUp: true }); + const tx = jest.mocked(sendLocalEvmTransaction).mock.calls[0][2]; + expect(unsignedTransaction(tx).type).toBe(type); + expect( + type === 0 ? tx.gasPrice.toString() : tx.maxFeePerGas.toString() + ).toBe('120'); + if (type === 2) expect(tx.accessList).toEqual(ACCESS_LIST); + expectNoFeeRpc(); + expect(provider.sendTransaction).toHaveBeenCalledTimes(1); + } + ); + + it('seeds type1 dynamic fee conversion from signed gasPrice without RPC enrichment', async () => { + const hash = useOriginal( + transaction({ type: 1, accessList: ACCESS_LIST }) + ); + await expect( + sdk.sendTransactionWithEditedFee(hash, false, options()) + ).resolves.toMatchObject({ isSpeedUp: true }); + const tx = jest.mocked(sendLocalEvmTransaction).mock.calls[0][2]; + expect(tx.maxFeePerGas.toString()).toBe('120'); + expect(tx.maxPriorityFeePerGas.toString()).toBe('120'); + expect(tx.accessList).toEqual(ACCESS_LIST); + expectNoFeeRpc(); + }); + + it.each([0, 2])( + 'keeps signed type%s zero fees at zero under a zero cap', + async (type) => { + const hash = useOriginal(zeroFeeOriginal(type)); + provider.getGasPrice.mockResolvedValue(BigNumber.from(0)); + const dynamicQuote = jest + .spyOn(sdk, 'getFeeDataWithDynamicMaxPriorityFeePerGas') + .mockResolvedValue({ + maxFeePerGas: BigNumber.from(0), + maxPriorityFeePerGas: BigNumber.from(0), + }); + const approved = { ...options(), approvedMaximumFee: '0' }; + await expect( + sdk.sendTransactionWithEditedFee(hash, type !== 0, { + ...approved, + previewOnly: true, + }) + ).resolves.toEqual({ isSpeedUp: false, maximumFee: '0' }); + expectNoSigning(); + await expect( + sdk.sendTransactionWithEditedFee(hash, type !== 0, approved) + ).resolves.toMatchObject({ isSpeedUp: true }); + const tx = jest.mocked(sendLocalEvmTransaction).mock.calls[0][2]; + expect((type === 0 ? tx.gasPrice : tx.maxFeePerGas).toString()).toBe( + '0' + ); + if (type === 0) { + expect(provider.getGasPrice).toHaveBeenCalledTimes(2); + expect(dynamicQuote).not.toHaveBeenCalled(); + } else { + expect(dynamicQuote).toHaveBeenCalledTimes(2); + expect(dynamicQuote).toHaveBeenCalledWith(provider); + } + expect(provider.sendTransaction).toHaveBeenCalledTimes(1); + } + ); + + it.each([ + { target: payer, type: 0 }, + { target: payer, type: 1 }, + { target: payer, type: 2 }, + { target: { type: KeyringAccountType.Ledger, id: 4 }, type: 0 }, + { target: { type: KeyringAccountType.Ledger, id: 4 }, type: 1 }, + { target: { type: KeyringAccountType.Ledger, id: 4 }, type: 2 }, + { target: { type: KeyringAccountType.Trezor, id: 5 }, type: 0 }, + { target: { type: KeyringAccountType.Trezor, id: 5 }, type: 1 }, + { target: { type: KeyringAccountType.Trezor, id: 5 }, type: 2 }, + ])( + 'rescues signed zero fees with an approved positive RPC quote for %j', + async ({ target, type }) => { + const hash = useOriginal(zeroFeeOriginal(type)); + positiveQuote(); + const preview = await sdk.sendTransactionWithEditedFee( + hash, + type === 0, + { + ...options(target), + approvedMaximumFee: undefined, + previewOnly: true, + } + ); + const maximumFee = type === 0 ? '3024000' : '4536000'; + expect(preview).toEqual({ isSpeedUp: false, maximumFee }); + expectNoSigning(); + await expect( + sdk.sendTransactionWithEditedFee(hash, type === 0, { + ...options(target), + approvedMaximumFee: preview.maximumFee, + }) + ).resolves.toMatchObject({ isSpeedUp: true, transaction: response }); + const tx = + target.type === payer.type + ? unsignedTransaction( + jest.mocked(sendLocalEvmTransaction).mock.calls[0][2] + ) + : Transaction.from(provider.sendTransaction.mock.calls[0][0]); + expect(tx.type).toBe(type === 0 ? 0 : 2); + expect(tx.nonce).toBe(8); + expect(Number(tx.chainId)).toBe(CHAIN); + expect(tx.to?.toLowerCase()).toBe(TARGET); + expect(tx.value).toBe(BigInt(7)); + expect(tx.data).toBe('0x1234'); + expect(tx.gasLimit).toBe(BigInt(25200)); + if (type === 0) { + expect(tx.gasPrice).toBe(BigInt(120)); + expect(provider.getBlock).not.toHaveBeenCalled(); + } else { + expect(tx.maxFeePerGas).toBe(BigInt(180)); + expect(tx.maxPriorityFeePerGas).toBe(BigInt(30)); + expect(tx.accessList).toEqual(ACCESS_LIST); + expect(provider.send).toHaveBeenCalledWith( + 'eth_maxPriorityFeePerGas', + [] + ); + } + expect(provider.getGasPrice).toHaveBeenCalledTimes(2); + expect(provider.sendTransaction).toHaveBeenCalledTimes(1); + } + ); + + it.each([ + { target: payer, cap: '3024000' }, + { target: payer, cap: '3049199' }, + { target: { type: KeyringAccountType.Ledger, id: 4 }, cap: '3024000' }, + { target: { type: KeyringAccountType.Ledger, id: 4 }, cap: '3049199' }, + { target: { type: KeyringAccountType.Trezor, id: 5 }, cap: '3024000' }, + { target: { type: KeyringAccountType.Trezor, id: 5 }, cap: '3049199' }, + ])( + 'rejects a newer zero-fee rescue quote above the approved cap for %j', + async ({ target, cap }) => { + const hash = useOriginal(zeroFeeOriginal(0)); + positiveQuote(); + await expect( + sdk.sendTransactionWithEditedFee(hash, true, { + ...options(target), + previewOnly: true, + }) + ).resolves.toEqual({ isSpeedUp: false, maximumFee: '3024000' }); + expectNoSigning(); + provider.getGasPrice.mockResolvedValue(BigNumber.from(101)); + await expect( + sdk.sendTransactionWithEditedFee(hash, true, { + ...options(target), + approvedMaximumFee: cap, + }) + ).rejects.toThrow('Replacement fee exceeds approval'); + expect(provider.getGasPrice).toHaveBeenCalledTimes(2); + expectNoSigning(); + } + ); + + it.each([false, true])( + 'rejects a typed rescue quote whose priority exceeds its maximum (preview=%s)', + async (previewOnly) => { + const hash = useOriginal(zeroFeeOriginal(2)); + jest + .spyOn(sdk, 'getFeeDataWithDynamicMaxPriorityFeePerGas') + .mockResolvedValue({ + maxFeePerGas: BigNumber.from(100), + maxPriorityFeePerGas: BigNumber.from(101), + }); + await expect( + sdk.sendTransactionWithEditedFee(hash, false, { + ...options(), + approvedMaximumFee: '999999999999', + previewOnly, + }) + ).rejects.toThrow('Invalid replacement fee'); + expectNoSigning(); + } + ); + + it.each([0, 2])( + 'rechecks context after the type%s zero-fee RPC quote awaits', + async (type) => { + const hash = useOriginal(zeroFeeOriginal(type)); + const pendingQuote = deferred(); + const started = deferred(); + positiveQuote(); + provider.getGasPrice.mockImplementationOnce(() => { + started.resolve(); + return pendingQuote.promise; + }); + const sending = sdk.sendTransactionWithEditedFee(hash, type === 0, { + ...options(), + approvedMaximumFee: '999999999999', + }); + await started.promise; + current = false; + pendingQuote.resolve(BigNumber.from(100)); + await expect(sending).rejects.toThrow( + 'PALI_TRANSACTION_CONTEXT_CHANGED' + ); + expectNoSigning(); + } + ); + + it.each(['0', '3024000'])( + 'captures approved cap %s before a deferred zero-fee RPC quote', + async (cap) => { + const hash = useOriginal(zeroFeeOriginal(0)); + const pendingQuote = deferred(); + const started = deferred(); + provider.getGasPrice.mockImplementationOnce(() => { + started.resolve(); + return pendingQuote.promise; + }); + const approved = { ...options(), approvedMaximumFee: cap }; + const sending = sdk.sendTransactionWithEditedFee(hash, true, approved); + await started.promise; + approved.approvedMaximumFee = cap === '0' ? '999999999999' : '0'; + pendingQuote.resolve(BigNumber.from(100)); + if (cap === '0') { + await expect(sending).rejects.toThrow( + 'Replacement fee exceeds approval' + ); + expectNoSigning(); + } else { + await expect(sending).resolves.toMatchObject({ isSpeedUp: true }); + expect(provider.sendTransaction).toHaveBeenCalledTimes(1); + } + } + ); + + it.each([ + undefined, + null, + '', + '-1', + '1.5', + 'NaN', + '1e4', + '0x100', + 3024000, + '9'.repeat(79), + ])( + 'rejects missing or invalid approved cap %j before lookup or signer access', + async (approvedMaximumFee) => { + await expect( + sdk.sendTransactionWithEditedFee(ORIGINAL, false, { + ...options(), + approvedMaximumFee, + } as any) + ).rejects.toThrow(); + expect(provider.getTransaction).not.toHaveBeenCalled(); + expect(provider.getBalance).not.toHaveBeenCalled(); + expectNoSigning(); + } + ); + + it.each([ + { type: payer.type, id: payer.id }, + { type: KeyringAccountType.Ledger, id: 4 }, + { type: KeyringAccountType.Trezor, id: 5 }, + ])('bounds the final fee before signing through %j', async (target) => { + await expect( + sdk.sendTransactionWithEditedFee(ORIGINAL, false, { + ...options(target), + approvedMaximumFee: '3023999', + }) + ).rejects.toThrow(); + expectNoSigning(); + await expect( + sdk.sendTransactionWithEditedFee(ORIGINAL, false, options(target)) + ).resolves.toMatchObject({ isSpeedUp: true }); + const tx = + target.type === payer.type + ? unsignedTransaction( + jest.mocked(sendLocalEvmTransaction).mock.calls[0][2] + ) + : Transaction.from(provider.sendTransaction.mock.calls[0][0]); + const maximumFee = tx.gasLimit * (tx.maxFeePerGas ?? tx.gasPrice!); + expect(maximumFee.toString()).toBe(APPROVED_MAXIMUM_FEE); + expect(maximumFee <= BigInt(APPROVED_MAXIMUM_FEE)).toBe(true); + expectNoFeeRpc(); + expect(provider.sendTransaction).toHaveBeenCalledTimes(1); + }); + + it.each([ + { target: payer, type: 0 }, + { target: payer, type: 1 }, + { target: payer, type: 2 }, + { target: { type: KeyringAccountType.Ledger, id: 4 }, type: 0 }, + { target: { type: KeyringAccountType.Ledger, id: 4 }, type: 1 }, + { target: { type: KeyringAccountType.Ledger, id: 4 }, type: 2 }, + { target: { type: KeyringAccountType.Trezor, id: 5 }, type: 0 }, + { target: { type: KeyringAccountType.Trezor, id: 5 }, type: 1 }, + { target: { type: KeyringAccountType.Trezor, id: 5 }, type: 2 }, + ])( + 'previews the exact maximum fee without credentials or devices for %j', + async ({ target, type }) => { + const hash = useOriginal(transaction({ type })); + await expect( + sdk.sendTransactionWithEditedFee(hash, type === 0, { + ...options(target), + approvedMaximumFee: undefined, + previewOnly: true, + }) + ).resolves.toEqual({ + isSpeedUp: false, + maximumFee: APPROVED_MAXIMUM_FEE, + }); + expectNoSigning(); + expectNoFeeRpc(); + } + ); + + it('rejects a signed zero gas limit before final signing', async () => { + const hash = useOriginal(transaction({ gasLimit: BigNumber.from(0) })); + await expect( + sdk.sendTransactionWithEditedFee(hash, false, options()) + ).rejects.toThrow(); + expectNoSigning(); + expectNoFeeRpc(); + }); + + it.each(['3023999', APPROVED_MAXIMUM_FEE])( + 'captures approved cap %s before deferred balance work', + async (cap) => { + const pendingBalance = deferred(); + const started = deferred(); + provider.getBalance.mockImplementationOnce(() => { + started.resolve(); + return pendingBalance.promise; + }); + const approved = { ...options(), approvedMaximumFee: cap }; + const sending = sdk.sendTransactionWithEditedFee( + ORIGINAL, + false, + approved + ); + await started.promise; + approved.approvedMaximumFee = + cap === APPROVED_MAXIMUM_FEE ? '0' : '999999999999'; + pendingBalance.resolve(BigNumber.from('1000000000')); + if (cap === APPROVED_MAXIMUM_FEE) { + await expect(sending).resolves.toMatchObject({ isSpeedUp: true }); + expect(provider.sendTransaction).toHaveBeenCalledTimes(1); + } else { + await expect(sending).rejects.toThrow(); + expectNoSigning(); + } + } + ); + + it('captures preview mode before deferred balance work', async () => { + const pendingBalance = deferred(); + const started = deferred(); + provider.getBalance.mockImplementationOnce(() => { + started.resolve(); + return pendingBalance.promise; + }); + const preview = { ...options(), previewOnly: true }; + const sending = sdk.sendTransactionWithEditedFee( + ORIGINAL, + false, + preview + ); + await started.promise; + preview.previewOnly = false; + pendingBalance.resolve(BigNumber.from('1000000000')); + await expect(sending).resolves.toEqual({ + isSpeedUp: false, + maximumFee: APPROVED_MAXIMUM_FEE, + }); + expectNoSigning(); + }); + }); + + describe.each(['scoped', 'ordinary'] as const)( + 'authenticated originals through the %s API', + (caller) => { + const send = (hash: string, legacy = false) => { + if (caller === 'ordinary') { + state.activeAccountType = payer.type; + state.activeAccountId = payer.id; + return sdk.sendTransactionWithEditedFee(hash, legacy, { + approvedMaximumFee: APPROVED_MAXIMUM_FEE, + }); + } + return sdk.sendTransactionWithEditedFee(hash, legacy, options()); + }; + const expectNoSigning = () => { + expect(provider.getBalance).not.toHaveBeenCalled(); + expect(getKey).not.toHaveBeenCalled(); + expect(sendLocalEvmTransaction).not.toHaveBeenCalled(); + expect(ledger.evm.signEVMTransaction).not.toHaveBeenCalled(); + expect(trezor.signEthTransaction).not.toHaveBeenCalled(); + expect(beforeBroadcast).not.toHaveBeenCalled(); + expect(provider.sendTransaction).not.toHaveBeenCalled(); + }; + + it.each([ + { type: 0, raw: false }, + { type: 1, raw: false }, + { type: 2, raw: false }, + { type: 0, raw: true }, + { type: 1, raw: true }, + { type: 2, raw: true }, + ])( + 'accepts the signed original representation %j', + async ({ type, raw }) => { + const original: any = transaction({ + type, + ...(type ? { accessList: ACCESS_LIST } : {}), + }); + if (raw) { + const signature = Transaction.from( + serializeTransaction(original, original.signature) + ).signature!; + original.r = signature.r; + original.s = signature.s; + original.v = Number(signature.networkV ?? signature.v); + delete original.signature; + } + const hash = useOriginal(original); + await expect(send(hash, type !== 2)).resolves.toMatchObject({ + isSpeedUp: true, + transaction: response, + }); + const tx = jest.mocked(sendLocalEvmTransaction).mock.calls[0][2]; + expect(tx.nonce).toBe(8); + expect(tx.value.toString()).toBe('7'); + expect(tx.data).toBe('0x1234'); + if (type) expect(tx.accessList).toEqual(ACCESS_LIST); + if (type === 1) expect(tx.type).toBe(1); + expect(provider.sendTransaction).toHaveBeenCalledTimes(1); + } + ); + + it('accepts an ethers-style type2 original with null derived gasPrice', async () => { + const original = transaction(); + const hash = useOriginal({ ...original, gasPrice: null }); + await expect(send(hash)).resolves.toMatchObject({ isSpeedUp: true }); + const tx = jest.mocked(sendLocalEvmTransaction).mock.calls[0][2]; + expect(tx.maxFeePerGas.toString()).toBe('120'); + expect(tx.data).toBe('0x1234'); + expect(provider.sendTransaction).toHaveBeenCalledTimes(1); + }); + + it.each([1, 2])( + 'accepts raw RPC parity v for signed type%s', + async (type) => { + const original: any = transaction({ type }); + original.r = original.signature.r; + original.s = original.signature.s; + original.v = original.signature.yParity; + delete original.signature; + const hash = useOriginal(original); + await expect(send(hash, type === 1)).resolves.toMatchObject({ + isSpeedUp: true, + }); + expect(provider.sendTransaction).toHaveBeenCalledTimes(1); + } + ); + + it.each([ + { type: 0, encoding: 'decimal' }, + { type: 0, encoding: 'hex' }, + { type: 2, encoding: 'decimal' }, + { type: 2, encoding: 'hex' }, + ])( + 'accepts equivalent numeric fields and raw signature v %j', + async ({ type, encoding }) => { + const original: any = transaction({ type }); + const signature = Transaction.from( + serializeTransaction(original, original.signature) + ).signature!; + original.r = signature.r; + original.s = signature.s; + original.v = signature.networkV ?? signature.v; + delete original.signature; + const fields = [ + 'type', + 'nonce', + 'chainId', + 'value', + 'gasLimit', + 'v', + ...(type === 0 + ? ['gasPrice'] + : ['maxFeePerGas', 'maxPriorityFeePerGas']), + ]; + for (const field of fields) { + const number = BigInt(original[field].toString()); + original[field] = + encoding === 'hex' + ? `0x${number.toString(16)}` + : number.toString(); + } + const hash = useOriginal(original); + await expect(send(hash, type === 0)).resolves.toMatchObject({ + isSpeedUp: true, + }); + const tx = jest.mocked(sendLocalEvmTransaction).mock.calls[0][2]; + expect(tx.nonce).toBe(8); + expect(Number(tx.chainId)).toBe(CHAIN); + expect(tx.value.toString()).toBe('7'); + expect((type === 0 ? tx.gasPrice : tx.maxFeePerGas).toString()).toBe( + '120' + ); + expect(provider.sendTransaction).toHaveBeenCalledTimes(1); + } + ); + + it.each([ + ['missing signature', { signature: undefined }], + [ + 'zero signature', + { + signature: undefined, + r: `0x${'00'.repeat(32)}`, + s: `0x${'00'.repeat(32)}`, + v: 27, + }, + ], + ['incomplete signature', { signature: undefined, v: 27 }], + ['different hash', { hash: REPLACEMENT }], + ['different sender', { from: TARGET }], + ['different chain', { chainId: 1 }], + [ + 'substituted signature', + { signature: transaction({}, otherHardwareWallet).signature }, + ], + ['substituted supported type', { type: 1 }], + ['substituted nonce', { nonce: 9 }], + ['substituted recipient', { to: SMART }], + ['substituted value', { value: BigNumber.from(8) }], + ['substituted calldata', { data: '0x5678' }], + ['substituted gas limit', { gasLimit: BigNumber.from(22000) }], + ['substituted max fee', { maxFeePerGas: BigNumber.from(101) }], + [ + 'substituted priority fee', + { maxPriorityFeePerGas: BigNumber.from(11) }, + ], + ['substituted access list', { accessList: ACCESS_LIST }], + ['unsupported blob type', { type: 3 }], + ['unsupported authorization type', { type: 4 }], + ])( + 'rejects %s before balance, credentials, or devices', + async (_label, fields) => { + provider.getTransaction.mockResolvedValue({ + ...transaction(), + ...fields, + }); + await expect(send(ORIGINAL)).rejects.toThrow(); + expectNoSigning(); + } + ); + + it('rejects a substituted legacy gas price before credentials or devices', async () => { + const original = transaction({ type: 0 }); + const hash = useOriginal(original); + provider.getTransaction.mockResolvedValue({ + ...original, + gasPrice: BigNumber.from(101), + }); + await expect(send(hash, true)).rejects.toThrow(); + expectNoSigning(); + }); + + it.each([0, 1])( + 'rejects an intact signed original on incompatible chain %s before signer access', + async (chainId) => { + const hash = useOriginal( + transaction({ chainId, ...(chainId === 0 ? { type: 0 } : {}) }) + ); + await expect(send(hash, chainId === 0)).rejects.toThrow(); + expectNoSigning(); + } + ); + + it('rejects an intact signed original from another payer before signer access', async () => { + const hash = useOriginal(transaction({}, otherHardwareWallet)); + await expect(send(hash)).rejects.toThrow(); + expectNoSigning(); + }); + + it.each([false, true])( + 'authenticates a transaction first found on retry (tampered=%s)', + async (tampered) => { + jest.useFakeTimers(); + try { + provider.getTransaction + .mockResolvedValueOnce(null) + .mockResolvedValueOnce({ + ...transaction(), + ...(tampered ? { data: '0x5678' } : {}), + }); + const pending = send(ORIGINAL); + const assertion = tampered + ? expect(pending).rejects.toThrow() + : expect(pending).resolves.toMatchObject({ isSpeedUp: true }); + await jest.advanceTimersByTimeAsync(500); + await assertion; + expect(provider.getTransaction).toHaveBeenCalledTimes(2); + if (tampered) expectNoSigning(); + else expect(provider.sendTransaction).toHaveBeenCalledTimes(1); + } finally { + jest.useRealTimers(); + } + } + ); + + it('detaches the authenticated body before deferred balance work', async () => { + const original: any = transaction({ + accessList: JSON.parse(JSON.stringify(ACCESS_LIST)), + }); + const expectedAccessList = JSON.parse( + JSON.stringify(original.accessList) + ); + const hash = useOriginal(original); + const pendingBalance = deferred(); + const started = deferred(); + provider.getBalance.mockImplementationOnce(() => { + started.resolve(); + return pendingBalance.promise; + }); + const pending = send(hash); + await started.promise; + Object.assign(original, { + hash: REPLACEMENT, + from: SMART, + to: SMART, + nonce: 9, + chainId: 1, + value: BigNumber.from(8), + data: '0x5678', + gasLimit: BigNumber.from(1), + maxFeePerGas: BigNumber.from(1), + maxPriorityFeePerGas: BigNumber.from(1), + signature: undefined, + }); + original.accessList[0].storageKeys[0] = `0x${'77'.repeat(32)}`; + pendingBalance.resolve(BigNumber.from('1000000000')); + await expect(pending).resolves.toMatchObject({ isSpeedUp: true }); + const tx = jest.mocked(sendLocalEvmTransaction).mock.calls[0][2]; + expect(tx).toMatchObject({ + from: PAYER, + to: TARGET, + nonce: 8, + chainId: CHAIN, + data: '0x1234', + accessList: expectedAccessList, + }); + expect(tx.value.toString()).toBe('7'); + expect(tx.gasLimit.toString()).toBe('25200'); + expect(tx.maxFeePerGas.toString()).toBe('120'); + expect(provider.sendTransaction).toHaveBeenCalledTimes(1); + }); + } + ); + + it.each([ + { type: payer.type, id: 99 }, + { type: smart.type, id: smart.id }, + ])( + 'rejects unavailable signing target %j before RPC/signing', + async (target) => { + await expect( + sdk.sendTransactionWithEditedFee(ORIGINAL, false, options(target)) + ).rejects.toThrow('Replacement signing account is unavailable'); + expect(provider.getTransaction).not.toHaveBeenCalled(); + expect(getKey).not.toHaveBeenCalled(); + expect(provider.sendTransaction).not.toHaveBeenCalled(); + } + ); + + it.each([ + { from: TARGET }, + { chainId: 1 }, + { hash: REPLACEMENT }, + { nonce: 9 }, + ])( + 'rejects incompatible original lookup %j before signing', + async (fields) => { + provider.getTransaction.mockResolvedValue({ + ...transaction(), + ...fields, + }); + await expect( + sdk.sendTransactionWithEditedFee(ORIGINAL, false, options()) + ).rejects.toThrow(); + expect(getKey).not.toHaveBeenCalled(); + expect(sendLocalEvmTransaction).not.toHaveBeenCalled(); + expect(provider.sendTransaction).not.toHaveBeenCalled(); + } + ); + + it.each(['lookup', 'balance'])( + 'rejects stale context after deferred %s before signing', + async (phase) => { + const pending = deferred(); + const started = deferred(); + if (phase === 'lookup') + provider.getTransaction.mockImplementationOnce(() => { + started.resolve(); + return pending.promise; + }); + if (phase === 'balance') + provider.getBalance.mockImplementationOnce(() => { + started.resolve(); + return pending.promise; + }); + const sending = sdk.sendTransactionWithEditedFee( + ORIGINAL, + false, + options() + ); + await started.promise; + current = false; + pending.resolve( + phase === 'lookup' ? transaction() : BigNumber.from(1000) + ); + await expect(sending).rejects.toThrow('PALI_TRANSACTION_CONTEXT_CHANGED'); + expect(getKey).not.toHaveBeenCalled(); + expect(provider.sendTransaction).not.toHaveBeenCalled(); + } + ); + + it('rejects a context change at credential handoff before invoking the local sender', async () => { + getKey.mockImplementationOnce(() => { + current = false; + return { address: PAYER, decryptedPrivateKey: 'mocked-private-key' }; + }); + await expect( + sdk.sendTransactionWithEditedFee(ORIGINAL, false, options()) + ).resolves.toMatchObject({ isSpeedUp: false, error: true }); + expect(sendLocalEvmTransaction).not.toHaveBeenCalled(); + expect(provider.sendTransaction).not.toHaveBeenCalled(); + }); + + it('rejects a different decrypted signer before invoking the local sender', async () => { + getKey.mockReturnValue({ + address: TARGET, + decryptedPrivateKey: 'mocked-key', + }); + await expect( + sdk.sendTransactionWithEditedFee(ORIGINAL, false, options()) + ).resolves.toMatchObject({ isSpeedUp: false, error: true }); + expect(sendLocalEvmTransaction).not.toHaveBeenCalled(); + expect(provider.sendTransaction).not.toHaveBeenCalled(); + }); + + it('checks context after local signing work and before broadcast', async () => { + jest + .mocked(sendLocalEvmTransaction) + .mockImplementationOnce(async (capturedProvider, _key, _tx, before) => { + await Promise.resolve(); + current = false; + before?.(); + return capturedProvider.sendTransaction('mocked-signed-transaction'); + }); + await expect( + sdk.sendTransactionWithEditedFee(ORIGINAL, false, options()) + ).resolves.toMatchObject({ isSpeedUp: false, error: true }); + expect(beforeBroadcast).not.toHaveBeenCalled(); + expect(provider.sendTransaction).not.toHaveBeenCalled(); + }); + + it('rechecks context if the broadcast hook changes it', async () => { + beforeBroadcast.mockImplementation(() => (current = false)); + await expect( + sdk.sendTransactionWithEditedFee(ORIGINAL, false, options()) + ).resolves.toMatchObject({ isSpeedUp: false, error: true }); + expect(beforeBroadcast).toHaveBeenCalledTimes(1); + expect(provider.sendTransaction).not.toHaveBeenCalled(); + }); + + it('keeps acknowledged success after context changes while broadcast is in flight', async () => { + provider.sendTransaction.mockImplementationOnce(async () => { + current = false; + return response; + }); + await expect( + sdk.sendTransactionWithEditedFee(ORIGINAL, false, options()) + ).resolves.toMatchObject({ isSpeedUp: true, transaction: response }); + expect(provider.sendTransaction).toHaveBeenCalledTimes(1); + }); + + it('uses the captured provider for signed zero-fee quote and broadcast', async () => { + const hash = useOriginal( + transaction({ + maxFeePerGas: BigNumber.from(0), + maxPriorityFeePerGas: BigNumber.from(0), + }) + ); + const otherProvider = { getBalance: jest.fn(), sendTransaction: jest.fn() }; + const quote = jest + .spyOn(sdk, 'getFeeDataWithDynamicMaxPriorityFeePerGas') + .mockResolvedValue({ + maxFeePerGas: BigNumber.from(0), + maxPriorityFeePerGas: BigNumber.from(0), + }); + provider.getBalance.mockImplementationOnce(async () => { + currentProvider = otherProvider; + return BigNumber.from('1000000000'); + }); + await expect( + sdk.sendTransactionWithEditedFee(hash, false, { + ...options(), + approvedMaximumFee: '0', + }) + ).resolves.toMatchObject({ isSpeedUp: true, transaction: response }); + expect(quote).toHaveBeenCalledWith(provider); + expect(provider.getBlock).not.toHaveBeenCalled(); + expect(provider.getGasPrice).not.toHaveBeenCalled(); + expect(provider.sendTransaction).toHaveBeenCalledTimes(1); + expect(otherProvider.sendTransaction).not.toHaveBeenCalled(); + }); + + it.each([ + { type: KeyringAccountType.Ledger, id: 4, legacy: false, originalType: 2 }, + { type: KeyringAccountType.Trezor, id: 5, legacy: false, originalType: 2 }, + { type: KeyringAccountType.Ledger, id: 4, legacy: true, originalType: 0 }, + { type: KeyringAccountType.Trezor, id: 5, legacy: true, originalType: 0 }, + { type: KeyringAccountType.Ledger, id: 4, legacy: true, originalType: 1 }, + ])( + 'preserves original nonce and selected device account for %j', + async (target) => { + const hash = useOriginal( + transaction({ + nonce: 0, + type: target.originalType, + ...(target.originalType ? { accessList: ACCESS_LIST } : {}), + }) + ); + await expect( + sdk.sendTransactionWithEditedFee(hash, target.legacy, options(target)) + ).resolves.toMatchObject({ isSpeedUp: true, transaction: response }); + expect(getKey).not.toHaveBeenCalled(); + const signed = provider.sendTransaction.mock.calls[0][0]; + const parsed = Transaction.from(signed); + expect(parsed.nonce).toBe(0); + expect(parsed.type).toBe(target.originalType); + expect(Number(parsed.chainId)).toBe(CHAIN); + expect(parsed.from?.toLowerCase()).toBe(PAYER.toLowerCase()); + expect(parsed.to?.toLowerCase()).toBe(TARGET); + if (target.originalType) expect(parsed.accessList).toEqual(ACCESS_LIST); + if (target.type === KeyringAccountType.Ledger) + expect(ledger.evm.signEVMTransaction).toHaveBeenCalledWith( + expect.objectContaining({ accountIndex: 4 }) + ); + else + expect(trezor.signEthTransaction).toHaveBeenCalledWith( + expect.objectContaining({ index: '5', slip44: 60 }) + ); + expect(beforeBroadcast).toHaveBeenCalledTimes(1); + } + ); + + it.each(['scoped', 'ordinary'] as const)( + 'rejects unsupported Trezor type1 legacy signing through the %s API before balance or device access', + async (caller) => { + const target = { type: KeyringAccountType.Trezor, id: 5 }; + const hash = useOriginal( + transaction({ type: 1, accessList: ACCESS_LIST }) + ); + if (caller === 'ordinary') { + state.activeAccountType = target.type; + state.activeAccountId = target.id; + } + await expect( + sdk.sendTransactionWithEditedFee( + hash, + true, + caller === 'scoped' + ? options(target) + : { approvedMaximumFee: APPROVED_MAXIMUM_FEE } + ) + ).rejects.toThrow('Trezor does not support type 1 replacement signing'); + expect(provider.getBalance).not.toHaveBeenCalled(); + expect(getKey).not.toHaveBeenCalled(); + expect(sendLocalEvmTransaction).not.toHaveBeenCalled(); + expect(trezor.signEthTransaction).not.toHaveBeenCalled(); + expect(ledger.evm.signEVMTransaction).not.toHaveBeenCalled(); + expect(provider.sendTransaction).not.toHaveBeenCalled(); + } + ); + + it.each(['scoped', 'ordinary'] as const)( + 'converts a Trezor type1 original to supported dynamic fees through the %s API preserving the public Connect access list', + async (caller) => { + const target = { type: KeyringAccountType.Trezor, id: 5 }; + const hash = useOriginal( + transaction({ type: 1, nonce: 0, accessList: ACCESS_LIST }) + ); + const deviceCall = jest.fn(async (tx) => { + expect(tx.type).toBe(2); + expect(tx.gasPrice).toBeUndefined(); + expect(typeof tx.maxFeePerGas).toBe('string'); + expect(typeof tx.maxPriorityFeePerGas).toBe('string'); + expect(tx.accessList).toEqual(ACCESS_LIST); + const signature = await deviceSignature(tx); + return { + success: true, + payload: { + r: signature.r.replace(/^0x/, ''), + s: signature.s.replace(/^0x/, ''), + v: signature.v.toString(16), + }, + }; + }); + trezor.signEthTransaction.mockImplementationOnce(({ tx }) => + deviceCall(tx) + ); + if (caller === 'ordinary') { + state.activeAccountType = target.type; + state.activeAccountId = target.id; + } + await expect( + sdk.sendTransactionWithEditedFee( + hash, + false, + caller === 'scoped' + ? options(target) + : { approvedMaximumFee: APPROVED_MAXIMUM_FEE } + ) + ).resolves.toMatchObject({ isSpeedUp: true, transaction: response }); + expect(deviceCall).toHaveBeenCalledWith( + expect.objectContaining({ + chainId: CHAIN, + accessList: ACCESS_LIST, + }) + ); + expect(getKey).not.toHaveBeenCalled(); + expect(provider.sendTransaction).toHaveBeenCalledTimes(1); + const parsed = Transaction.from( + provider.sendTransaction.mock.calls[0][0] + ); + expect(parsed.type).toBe(2); + expect(parsed.nonce).toBe(0); + expect(Number(parsed.chainId)).toBe(CHAIN); + expect(parsed.from?.toLowerCase()).toBe(PAYER.toLowerCase()); + expect(parsed.to?.toLowerCase()).toBe(TARGET); + expect(parsed.value).toBe(BigInt(7)); + expect(parsed.data).toBe('0x1234'); + expect(parsed.accessList).toEqual(ACCESS_LIST); + } + ); + + it.each([ + { type: KeyringAccountType.Ledger, id: 4 }, + { type: KeyringAccountType.Trezor, id: 5 }, + ])( + 'rejects context changes during %j device signing before broadcast', + async (target) => { + if (target.type === KeyringAccountType.Ledger) + ledger.evm.signEVMTransaction.mockImplementationOnce( + async ({ rawTx }) => { + const signature = await deviceSignature(`0x${rawTx}`); + current = false; + return { + r: signature.r.slice(2), + s: signature.s.slice(2), + v: signature.v.toString(16), + }; + } + ); + else + trezor.signEthTransaction.mockImplementationOnce(async ({ tx }) => { + const signature = await deviceSignature(tx); + current = false; + return { success: true, payload: signature }; + }); + await expect( + sdk.sendTransactionWithEditedFee(ORIGINAL, false, options(target)) + ).resolves.toMatchObject({ isSpeedUp: false, error: true }); + expect(provider.sendTransaction).not.toHaveBeenCalled(); + } + ); + + it.each([ + { type: KeyringAccountType.Ledger, id: 4, ordinary: false }, + { type: KeyringAccountType.Trezor, id: 5, ordinary: false }, + { type: KeyringAccountType.Ledger, id: 4, ordinary: true }, + { type: KeyringAccountType.Trezor, id: 5, ordinary: true }, + ])( + 'rejects a valid %j signature from a different device payer', + async (target) => { + if (target.ordinary) { + state.activeAccountType = target.type; + state.activeAccountId = target.id; + } + if (target.type === KeyringAccountType.Ledger) + ledger.evm.signEVMTransaction.mockImplementationOnce( + async ({ rawTx }) => { + const signature = await deviceSignature( + `0x${rawTx}`, + otherHardwareWallet + ); + return { + r: signature.r.slice(2), + s: signature.s.slice(2), + v: signature.v.toString(16), + }; + } + ); + else + trezor.signEthTransaction.mockImplementationOnce(async ({ tx }) => ({ + success: true, + payload: await deviceSignature(tx, otherHardwareWallet), + })); + await expect( + sdk.sendTransactionWithEditedFee( + ORIGINAL, + false, + target.ordinary + ? { approvedMaximumFee: APPROVED_MAXIMUM_FEE } + : options(target) + ) + ).resolves.toMatchObject({ isSpeedUp: false, error: true }); + expect(beforeBroadcast).not.toHaveBeenCalled(); + expect(provider.sendTransaction).not.toHaveBeenCalled(); + } + ); + + it.each([ + { type: KeyringAccountType.Ledger, id: 4, ordinary: false }, + { type: KeyringAccountType.Trezor, id: 5, ordinary: false }, + { type: KeyringAccountType.Ledger, id: 4, ordinary: true }, + { type: KeyringAccountType.Trezor, id: 5, ordinary: true }, + ])( + 'rejects a malformed %j device signature without broadcasting', + async (target) => { + if (target.ordinary) { + state.activeAccountType = target.type; + state.activeAccountId = target.id; + } + if (target.type === KeyringAccountType.Ledger) + ledger.evm.signEVMTransaction.mockResolvedValueOnce({ + r: 'invalid', + s: 'invalid', + v: '1b', + }); + else + trezor.signEthTransaction.mockResolvedValueOnce({ + success: true, + payload: { r: 'invalid', s: 'invalid', v: 27 }, + }); + await expect( + sdk.sendTransactionWithEditedFee( + ORIGINAL, + false, + target.ordinary + ? { approvedMaximumFee: APPROVED_MAXIMUM_FEE } + : options(target) + ) + ).resolves.toMatchObject({ isSpeedUp: false, error: true }); + expect(beforeBroadcast).not.toHaveBeenCalled(); + expect(provider.sendTransaction).not.toHaveBeenCalled(); + } + ); + + it('passes the exact account to the actual keyring credential getter without replacing the vault getter', async () => { + const manager: any = new KeyringManager(); + const vault = { + activeNetwork: state.activeNetwork, + activeAccount: smart, + accounts: { + ...state.accounts, + [payer.type]: { + [payer.id]: { address: PAYER, xprv: 'synthetic-payer-ciphertext' }, + }, + [smart.type]: { + [smart.id]: { address: SMART, xprv: 'synthetic-smart-ciphertext' }, + }, + }, + }; + manager.setVaultStateGetter(() => vault); + const replaceGetter = jest.spyOn(manager, 'setVaultStateGetter'); + manager.sessionPassword = {}; + manager.withSecureData = (read: (password: string) => unknown) => + read('synthetic-session-password'); + mockAes.decrypt.mockImplementation((ciphertext: string) => ({ + toString: () => { + return ciphertext === 'synthetic-smart-ciphertext' + ? '' + : 'mocked-private-key'; + }, + })); + jest.mocked(privateKeyToAccount).mockReturnValue({ address: PAYER } as any); + Object.defineProperty(manager.ethereumTransaction, 'web3Provider', { + get: () => provider, + }); + const result = + await manager.ethereumTransaction.sendTransactionWithEditedFee( + ORIGINAL, + false, + options() + ); + expect(mockAes.decrypt).toHaveBeenCalledWith( + 'synthetic-payer-ciphertext', + 'synthetic-session-password' + ); + expect(result).toMatchObject({ isSpeedUp: true, transaction: response }); + expect(replaceGetter).not.toHaveBeenCalled(); + expect(vault.activeAccount).toBe(smart); + expect(provider.sendTransaction).toHaveBeenCalledTimes(1); + }); + + it.each([0, 1, 2])( + 'signs an HD type%s replacement with real local cryptography through the captured provider', + async (type) => { + const localSigner = jest.requireActual( + '../../../src/transactions/evm-local-signer' + ); + const hash = useOriginal( + transaction({ type, ...(type ? { accessList: ACCESS_LIST } : {}) }) + ); + getKey.mockReturnValue({ + address: PAYER, + decryptedPrivateKey: hardwareWallet.privateKey, + }); + const otherProvider = { + verifyConfiguredChainId: jest.fn(), + sendTransaction: jest.fn(), + }; + provider.getBalance.mockImplementationOnce(async () => { + currentProvider = otherProvider; + return BigNumber.from('1000000000'); + }); + provider.verifyConfiguredChainId = jest.fn().mockResolvedValue(undefined); + provider.sendTransaction.mockImplementationOnce(async (raw: string) => ({ + ...response, + hash: Transaction.from(raw).hash, + })); + const sign = jest.spyOn(localSigner, 'signTransaction'); + jest + .mocked(sendLocalEvmTransaction) + .mockImplementationOnce(localSigner.sendLocalEvmTransaction); + + const result = await sdk.sendTransactionWithEditedFee( + hash, + type !== 2, + options() + ); + expect(result.isSpeedUp).toBe(true); + expect(getKey).toHaveBeenCalledWith(payer); + expect(sign).toHaveBeenCalledTimes(1); + expect(provider.verifyConfiguredChainId).toHaveBeenCalledTimes(1); + expect(provider.sendTransaction).toHaveBeenCalledTimes(1); + expect(otherProvider.verifyConfiguredChainId).not.toHaveBeenCalled(); + expect(otherProvider.sendTransaction).not.toHaveBeenCalled(); + expect(beforeBroadcast).toHaveBeenCalledTimes(1); + expect(sign.mock.invocationCallOrder[0]).toBeLessThan( + beforeBroadcast.mock.invocationCallOrder[0] + ); + expect(beforeBroadcast.mock.invocationCallOrder[0]).toBeLessThan( + provider.sendTransaction.mock.invocationCallOrder[0] + ); + + const raw = provider.sendTransaction.mock.calls[0][0]; + const decoded = Transaction.from(raw); + expect(decoded.from).toBe(PAYER); + expect(decoded.type).toBe(type); + expect(decoded.nonce).toBe(8); + expect(decoded.chainId).toBe(BigInt(CHAIN)); + expect(decoded.to?.toLowerCase()).toBe(TARGET); + expect(decoded.value).toBe(BigInt(7)); + expect(decoded.data).toBe('0x1234'); + expect(decoded.gasLimit).toBe(BigInt(25200)); + const signedFee = type === 2 ? decoded.maxFeePerGas : decoded.gasPrice; + expect(signedFee).toBe(BigInt(120)); + expect(decoded.gasLimit * signedFee!).toBe(BigInt(APPROVED_MAXIMUM_FEE)); + if (type === 2) { + expect(decoded.maxPriorityFeePerGas).toBe(BigInt(12)); + } + if (type) expect(decoded.accessList).toEqual(ACCESS_LIST); + expect(result.transaction?.hash).toBe(decoded.hash); + expect(raw).toBe( + await hardwareWallet.signTransaction({ + type, + chainId: CHAIN, + nonce: 8, + to: TARGET, + value: 7, + data: '0x1234', + gasLimit: 25200, + ...(type === 2 + ? { maxFeePerGas: 120, maxPriorityFeePerGas: 12 } + : { gasPrice: 120 }), + ...(type ? { accessList: ACCESS_LIST } : {}), + }) + ); + expect(state.activeAccountType).toBe(smart.type); + expect(state.activeAccountId).toBe(smart.id); + expect(ledger.evm.signEVMTransaction).not.toHaveBeenCalled(); + expect(trezor.signEthTransaction).not.toHaveBeenCalled(); + } + ); + + it('blocks actual local signing after context changes during provider preflight', async () => { + const localSigner = jest.requireActual( + '../../../src/transactions/evm-local-signer' + ); + jest.spyOn(localSigner, 'privateKeyToAccount').mockReturnValue({ + address: PAYER, + }); + const sign = jest + .spyOn(localSigner, 'signTransaction') + .mockReturnValue('mocked-signed-transaction'); + provider.verifyConfiguredChainId = jest.fn(async () => { + current = false; + }); + await expect( + localSigner.sendLocalEvmTransaction( + provider, + 'mocked-private-key', + transaction(), + beforeBroadcast, + options().assertCurrentContext + ) + ).rejects.toThrow('PALI_TRANSACTION_CONTEXT_CHANGED'); + expect(sign).not.toHaveBeenCalled(); + expect(beforeBroadcast).not.toHaveBeenCalled(); + expect(provider.sendTransaction).not.toHaveBeenCalled(); + }); + + it('passes the pre-sign context guard through the scoped SDK sender', async () => { + const localSigner = jest.requireActual( + '../../../src/transactions/evm-local-signer' + ); + jest.spyOn(localSigner, 'privateKeyToAccount').mockReturnValue({ + address: PAYER, + }); + const sign = jest + .spyOn(localSigner, 'signTransaction') + .mockReturnValue('mocked-signed-transaction'); + provider.verifyConfiguredChainId = jest.fn(async () => { + current = false; + }); + jest + .mocked(sendLocalEvmTransaction) + .mockImplementationOnce(localSigner.sendLocalEvmTransaction); + await expect( + sdk.sendTransactionWithEditedFee(ORIGINAL, false, options()) + ).resolves.toMatchObject({ isSpeedUp: false, error: true }); + expect(sign).not.toHaveBeenCalled(); + expect(beforeBroadcast).not.toHaveBeenCalled(); + expect(provider.sendTransaction).not.toHaveBeenCalled(); + }); + + describe('native MAX replacement value preservation', () => { + const targets = [ + { type: KeyringAccountType.HDAccount, id: 3 }, + { type: KeyringAccountType.Ledger, id: 4 }, + { type: KeyringAccountType.Trezor, id: 5 }, + ]; + const cases = targets.flatMap((target) => + [true, false].flatMap((legacy) => + [true, false].map((previewOnly) => ({ target, legacy, previewOnly })) + ) + ); + it.each(cases)( + 'refuses to reduce the original amount for %j', + async ({ target, legacy, previewOnly }) => { + const value = BigNumber.from('1000000000'); + const hash = useOriginal( + transaction({ + type: legacy ? 0 : 2, + value, + data: '0x', + }) + ); + // The original fits exactly; the replacement's higher fee does not. + provider.getBalance.mockResolvedValue(value.add(2100000)); + await expect( + sdk.sendTransactionWithEditedFee(hash, legacy, { + ...options(target), + previewOnly, + }) + ).resolves.toEqual({ + isSpeedUp: false, + error: true, + code: 'REPLACEMENT_VALUE_WOULD_CHANGE', + message: + 'Add funds before speeding up this transaction; the original amount will not be changed', + }); + expect(getKey).not.toHaveBeenCalled(); + expect(sendLocalEvmTransaction).not.toHaveBeenCalled(); + expect(ledger.evm.signEVMTransaction).not.toHaveBeenCalled(); + expect(trezor.signEthTransaction).not.toHaveBeenCalled(); + expect(provider.sendTransaction).not.toHaveBeenCalled(); + } + ); + it.each( + targets.flatMap((target) => + [true, false].map((legacy) => ({ target, legacy })) + ) + )( + 'preserves the original amount when the larger fee is funded for %j', + async ({ target, legacy }) => { + const value = BigNumber.from('1000000000'); + const hash = useOriginal( + transaction({ type: legacy ? 0 : 2, value, data: '0x' }) + ); + provider.getBalance.mockResolvedValue(value.add(APPROVED_MAXIMUM_FEE)); + await expect( + sdk.sendTransactionWithEditedFee(hash, legacy, options(target)) + ).resolves.toMatchObject({ isSpeedUp: true }); + const call = + target.type === KeyringAccountType.HDAccount + ? jest.mocked(sendLocalEvmTransaction).mock.calls[0][2] + : target.type === KeyringAccountType.Ledger + ? Transaction.from( + `0x${ledger.evm.signEVMTransaction.mock.calls[0][0].rawTx}` + ) + : trezor.signEthTransaction.mock.calls[0][0].tx; + expect(BigNumber.from(call.value).toString()).toBe(value.toString()); + expect(provider.sendTransaction).toHaveBeenCalledTimes(1); + } + ); + it('retains the existing contract-call MAX rejection', async () => { + const value = BigNumber.from('1000000000'); + const hash = useOriginal(transaction({ value, data: '0x1234' })); + provider.getBalance.mockResolvedValue(value.add(2100000)); + await expect( + sdk.sendTransactionWithEditedFee(hash, false, options()) + ).resolves.toMatchObject({ + isSpeedUp: false, + error: true, + code: 'CONTRACT_CALL_MAX_SEND', + }); + expect(getKey).not.toHaveBeenCalled(); + expect(provider.sendTransaction).not.toHaveBeenCalled(); + }); + }); +}); diff --git a/packages/sysweb3-keyring/test/unit/transactions/ethereum-send-context.spec.ts b/packages/sysweb3-keyring/test/unit/transactions/ethereum-send-context.spec.ts new file mode 100644 index 00000000..e937a12e --- /dev/null +++ b/packages/sysweb3-keyring/test/unit/transactions/ethereum-send-context.spec.ts @@ -0,0 +1,201 @@ +import ecc from '@bitcoinerlab/secp256k1'; +import { INetworkType } from '@sidhujag/sysweb3-network'; + +import { EthereumTransactions } from '../../../src/transactions/ethereum'; +import { KeyringAccountType } from '../../../src/types'; + +const PRIVATE_KEY = + '0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef'; +const ADDRESS = '0xFCAd0B19bB29D4674531d6f115237E16AfCE377c'; +const HASH = `0x${'12'.repeat(32)}`; +const deferred = () => { + let resolve!: (value: T) => void; + const promise = new Promise((done) => (resolve = done)); + return { promise, resolve }; +}; + +describe('formatted EVM transaction host admission', () => { + let sdk: EthereumTransactions; + let provider: any; + let state: any; + let current: boolean; + let guard: jest.Mock; + let sign: jest.SpyInstance; + const request = () => ({ + from: ADDRESS, + to: ADDRESS, + chainId: 1, + value: '0x0', + gasLimit: '0x5208', + gasPrice: '0x1', + nonce: 0, + }); + const send = (options: any = { assertCurrent: guard }) => + (sdk.sendFormattedTransaction as any)(request(), true, options); + + beforeEach(() => { + const network = { + kind: INetworkType.Ethereum, + chainId: 1, + url: 'https://rpc.ankr.com/eth', + currency: 'eth', + } as any; + state = { + activeAccountType: KeyringAccountType.HDAccount, + activeAccountId: 0, + activeNetwork: network, + accounts: { HDAccount: { 0: { address: ADDRESS } } }, + }; + sdk = new EthereumTransactions( + () => network, + () => ({ address: ADDRESS, decryptedPrivateKey: PRIVATE_KEY }), + () => state, + {} as any, + {} as any + ); + provider = sdk.web3Provider as any; + provider.sendTransaction.mockResolvedValue({ hash: HASH }); + current = true; + guard = jest.fn(() => { + if (!current) throw new Error('Host admission expired'); + }); + sign = jest.spyOn(ecc, 'signRecoverable'); + }); + + afterEach(() => jest.restoreAllMocks()); + + it.each(['snapshot validity', 'review expiry'])( + 'rechecks %s after chain verification and before private-key signing', + async () => { + const entered = deferred(); + const resume = deferred(); + provider.verifyConfiguredChainId.mockImplementationOnce(async () => { + entered.resolve(); + await resume.promise; + }); + const result = send(); + const rejected = expect(result).rejects.toMatchObject({ + message: 'Host admission expired', + transactionNotBroadcast: true, + }); + await entered.promise; + current = false; + resume.resolve(); + await rejected; + expect(sign).not.toHaveBeenCalled(); + expect(provider.sendTransaction).not.toHaveBeenCalled(); + } + ); + + it('keeps the guard captured at entry when the options object changes', async () => { + const entered = deferred(); + const resume = deferred(); + provider.verifyConfiguredChainId.mockImplementationOnce(async () => { + entered.resolve(); + await resume.promise; + }); + const options = { assertCurrent: guard }; + const result = send(options); + const rejected = expect(result).rejects.toMatchObject({ + transactionNotBroadcast: true, + }); + await entered.promise; + options.assertCurrent = jest.fn(); + current = false; + resume.resolve(); + await rejected; + expect(options.assertCurrent).not.toHaveBeenCalled(); + expect(sign).not.toHaveBeenCalled(); + expect(provider.sendTransaction).not.toHaveBeenCalled(); + }); + + it('preserves healthy signing and broadcasts exactly once', async () => { + await expect(send()).resolves.toEqual({ hash: HASH }); + expect(guard.mock.calls.length).toBeGreaterThanOrEqual(3); + expect(sign).toHaveBeenCalledTimes(1); + expect(provider.sendTransaction).toHaveBeenCalledTimes(1); + }); + + it('rechecks admission between signing and broadcast', async () => { + const implementation = sign.getMockImplementation()!; + sign.mockImplementationOnce((...args) => { + const signature = implementation(...args); + current = false; + return signature; + }); + await expect(send()).rejects.toMatchObject({ + message: 'Host admission expired', + transactionNotBroadcast: true, + }); + expect(sign).toHaveBeenCalledTimes(1); + expect(provider.sendTransaction).not.toHaveBeenCalled(); + }); + + it.each([null, [], { assertCurrent: false }, { assertCurrent: 'yes' }])( + 'refuses invalid options before any preflight or signing: %p', + async (options) => { + await expect(send(options)).rejects.toMatchObject({ + transactionNotBroadcast: true, + }); + expect(provider.verifyConfiguredChainId).not.toHaveBeenCalled(); + expect(sign).not.toHaveBeenCalled(); + expect(provider.sendTransaction).not.toHaveBeenCalled(); + } + ); + + it('refuses async admission and consumes its rejection without signing', async () => { + await expect( + send({ assertCurrent: () => Promise.reject(new Error('Late denial')) }) + ).rejects.toMatchObject({ transactionNotBroadcast: true }); + await Promise.resolve(); + expect(sign).not.toHaveBeenCalled(); + expect(provider.sendTransaction).not.toHaveBeenCalled(); + }); + + it('refuses admission that becomes asynchronous after preflight', async () => { + let verified = false; + provider.verifyConfiguredChainId.mockImplementationOnce(async () => { + verified = true; + }); + const assertCurrent = jest.fn(() => + verified ? Promise.resolve() : undefined + ); + await expect(send({ assertCurrent })).rejects.toMatchObject({ + message: 'Transaction context guard must be synchronous', + transactionNotBroadcast: true, + }); + expect(provider.verifyConfiguredChainId).toHaveBeenCalledTimes(1); + expect(sign).not.toHaveBeenCalled(); + expect(provider.sendTransaction).not.toHaveBeenCalled(); + }); + + it('does not let a host guard bypass the keyring account guard', async () => { + provider.verifyConfiguredChainId.mockImplementationOnce(async () => { + state.activeAccountId = 1; + }); + await expect(send()).rejects.toMatchObject({ + message: 'Wallet signing context changed', + transactionNotBroadcast: true, + }); + expect(sign).not.toHaveBeenCalled(); + expect(provider.sendTransaction).not.toHaveBeenCalled(); + }); + + it('preserves an acknowledged broadcast if admission expires while awaiting it', async () => { + const entered = deferred(); + const resume = deferred<{ hash: string }>(); + provider.sendTransaction.mockImplementationOnce(() => { + entered.resolve(); + return resume.promise; + }); + const result = send(); + await entered.promise; + const callsAtBroadcast = guard.mock.calls.length; + current = false; + resume.resolve({ hash: HASH }); + await expect(result).resolves.toEqual({ hash: HASH }); + expect(guard).toHaveBeenCalledTimes(callsAtBroadcast); + expect(sign).toHaveBeenCalledTimes(1); + expect(provider.sendTransaction).toHaveBeenCalledTimes(1); + }); +}); diff --git a/packages/sysweb3-keyring/test/unit/transactions/ethereum-submission-boundary.spec.ts b/packages/sysweb3-keyring/test/unit/transactions/ethereum-submission-boundary.spec.ts new file mode 100644 index 00000000..26a5066c --- /dev/null +++ b/packages/sysweb3-keyring/test/unit/transactions/ethereum-submission-boundary.spec.ts @@ -0,0 +1,233 @@ +import { INetworkType } from '@sidhujag/sysweb3-network'; +import { Transaction, Wallet } from 'ethers'; + +import { BigNumber, serializeTransaction } from '../../../src/ethers-v6'; +import { EthereumTransactions } from '../../../src/transactions/ethereum'; +import { KeyringAccountType } from '../../../src/types'; + +const PRIVATE_KEY = + '0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef'; +const ADDRESS = '0xFCAd0B19bB29D4674531d6f115237E16AfCE377c'; +const HASH = `0x${'12'.repeat(32)}`; +const wallet = new Wallet(PRIVATE_KEY); + +describe('formatted EVM transaction submission boundary', () => { + let transaction: EthereumTransactions; + let provider: any; + let state: any; + let ledger: any; + let trezor: any; + const request = () => ({ + from: ADDRESS, + to: ADDRESS, + chainId: 1, + value: '0x0', + gasLimit: '0x5208', + gasPrice: '0x1', + nonce: 0, + }); + + beforeEach(() => { + const network = { + kind: INetworkType.Ethereum, + chainId: 1, + url: 'https://rpc.ankr.com/eth', + currency: 'eth', + } as any; + state = { + activeAccountType: KeyringAccountType.HDAccount, + activeAccountId: 0, + activeNetwork: network, + accounts: { + HDAccount: { 0: { address: ADDRESS } }, + Imported: { 0: { address: ADDRESS } }, + Ledger: { 0: { address: ADDRESS } }, + Trezor: { 0: { address: ADDRESS } }, + }, + }; + ledger = { + evm: { + signEVMTransaction: jest.fn(async ({ rawTx }) => { + const signature = wallet.signingKey.sign( + Transaction.from(`0x${rawTx}`).unsignedHash + ); + return { + r: signature.r.slice(2), + s: signature.s.slice(2), + v: signature.v.toString(16), + }; + }), + }, + }; + trezor = { + signEthTransaction: jest.fn().mockImplementation(async ({ tx }) => ({ + success: true, + payload: wallet.signingKey.sign( + Transaction.from( + serializeTransaction({ + ...tx, + type: tx.gasPrice === undefined ? 2 : 0, + }) + ).unsignedHash + ), + })), + }; + transaction = new EthereumTransactions( + () => network, + () => ({ address: ADDRESS, decryptedPrivateKey: PRIVATE_KEY }), + () => state, + ledger, + trezor + ); + provider = transaction.web3Provider as any; + provider.getFeeData = jest.fn().mockResolvedValue({ + gasPrice: BigNumber.from(100), + maxFeePerGas: BigNumber.from(300), + maxPriorityFeePerGas: BigNumber.from(20), + }); + provider.sendTransaction.mockResolvedValue({ hash: HASH }); + }); + + it.each(['estimateGas', 'getFeeData', 'getGasPrice'])( + 'marks a %s failure as definitely not broadcast', + async (method) => { + state.activeAccountType = KeyringAccountType.Trezor; + const failure = Object.assign(new Error('RPC temporarily unavailable'), { + code: 'NETWORK_ERROR', + }); + provider[method].mockRejectedValueOnce(failure); + const params: any = request(); + if (method === 'estimateGas') delete params.gasLimit; + if (method === 'getGasPrice') delete params.gasPrice; + await expect( + transaction.sendFormattedTransaction(params, method !== 'getFeeData') + ).rejects.toMatchObject({ + message: failure.message, + code: failure.code, + transactionNotBroadcast: true, + }); + expect(provider.sendTransaction).not.toHaveBeenCalled(); + expect(trezor.signEthTransaction).not.toHaveBeenCalled(); + } + ); + + it.each([KeyringAccountType.Trezor, KeyringAccountType.Ledger])( + 'marks %s signing rejection as definitely not broadcast', + async (type) => { + state.activeAccountType = type; + if (type === KeyringAccountType.Trezor) { + trezor.signEthTransaction.mockResolvedValueOnce({ + success: false, + payload: { error: 'Cancelled' }, + }); + } else { + ledger.evm.signEVMTransaction.mockRejectedValueOnce( + Object.assign(new Error('Device rejected signing'), { code: 4001 }) + ); + } + await expect( + transaction.sendFormattedTransaction(request(), true) + ).rejects.toMatchObject({ transactionNotBroadcast: true }); + expect(provider.sendTransaction).not.toHaveBeenCalled(); + } + ); + + it.each([KeyringAccountType.Trezor, KeyringAccountType.Ledger])( + 'marks a mismatched %s signature as definitely not broadcast', + async (type) => { + state.activeAccountType = type; + state.accounts[type][0].address = new Wallet( + `0x${'11'.repeat(32)}` + ).address; + await expect( + transaction.sendFormattedTransaction( + { ...request(), from: state.accounts[type][0].address }, + true + ) + ).rejects.toMatchObject({ + code: 'HARDWARE_ACCOUNT_MISMATCH', + transactionNotBroadcast: true, + }); + expect(provider.sendTransaction).not.toHaveBeenCalled(); + } + ); + + it('marks a local signer chain-verification failure as definitely not broadcast', async () => { + provider.verifyConfiguredChainId.mockRejectedValueOnce( + Error('RPC chain id changed') + ); + await expect( + transaction.sendFormattedTransaction(request(), true) + ).rejects.toMatchObject({ transactionNotBroadcast: true }); + expect(provider.sendTransaction).not.toHaveBeenCalled(); + }); + + it.each([ + KeyringAccountType.HDAccount, + KeyringAccountType.Trezor, + KeyringAccountType.Ledger, + ])( + 'keeps a failed %s broadcast ambiguous despite a reused true marker', + async (type) => { + state.activeAccountType = type; + const failure = Object.freeze( + Object.assign(new Error('RPC acknowledgement was lost'), { + code: 'NETWORK_ERROR', + transactionNotBroadcast: true, + }) + ); + provider.sendTransaction.mockRejectedValueOnce(failure); + await expect( + transaction.sendFormattedTransaction(request(), true) + ).rejects.toMatchObject({ + message: failure.message, + code: failure.code, + transactionNotBroadcast: false, + }); + expect(provider.sendTransaction).toHaveBeenCalledTimes(1); + expect(failure.transactionNotBroadcast).toBe(true); + } + ); + + it('keeps the broadcast flag isolated between concurrent calls', async () => { + let rejectBroadcast!: (error: Error) => void; + let started!: () => void; + const broadcastStarted = new Promise( + (resolve) => (started = resolve) + ); + provider.sendTransaction.mockImplementationOnce( + () => + new Promise((_resolve, reject) => { + rejectBroadcast = reject; + started(); + }) + ); + const first = transaction.sendFormattedTransaction(request(), true); + const firstRejected = expect(first).rejects.toMatchObject({ + transactionNotBroadcast: false, + }); + await broadcastStarted; + provider.estimateGas.mockRejectedValueOnce(Error('Estimate unavailable')); + await expect( + transaction.sendFormattedTransaction( + { ...request(), gasLimit: undefined }, + true + ) + ).rejects.toMatchObject({ transactionNotBroadcast: true }); + rejectBroadcast(Error('Broadcast acknowledgement lost')); + await firstRejected; + expect(provider.sendTransaction).toHaveBeenCalledTimes(1); + }); + + it.each([ + KeyringAccountType.HDAccount, + KeyringAccountType.Trezor, + KeyringAccountType.Ledger, + ])('preserves the successful %s response', async (type) => { + state.activeAccountType = type; + await expect( + transaction.sendFormattedTransaction(request(), true) + ).resolves.toEqual({ hash: HASH }); + expect(provider.sendTransaction).toHaveBeenCalledTimes(1); + }); +}); diff --git a/packages/sysweb3-keyring/test/unit/transactions/ethereum-transactions.spec.ts b/packages/sysweb3-keyring/test/unit/transactions/ethereum-transactions.spec.ts index 8721f316..bb56a947 100644 --- a/packages/sysweb3-keyring/test/unit/transactions/ethereum-transactions.spec.ts +++ b/packages/sysweb3-keyring/test/unit/transactions/ethereum-transactions.spec.ts @@ -1,9 +1,14 @@ -import { encrypt } from 'eth-sig-util'; +import { + encrypt, + recoverPersonalSignature, + SignTypedDataVersion, +} from '@metamask/eth-sig-util'; +import { INetworkType } from '@sidhujag/sysweb3-network'; import { KeyringManager, KeyringAccountType } from '../../../src'; +import { BigNumber } from '../../../src/ethers-v6'; import { FAKE_PASSWORD, PEACE_SEED_PHRASE } from '../../helpers/constants'; -import { setupMocks } from '../../helpers/setup'; -import { INetworkType } from '@pollum-io/sysweb3-network'; +import { createFreshTestKeyring, setupMocks } from '../../helpers/setup'; describe('Ethereum Transactions', () => { let keyringManager: KeyringManager; @@ -24,7 +29,7 @@ describe('Ethereum Transactions', () => { }); mockVaultStateGetter = jest.fn(() => currentVaultState); - keyringManager = await KeyringManager.createInitialized( + keyringManager = await createFreshTestKeyring( PEACE_SEED_PHRASE, FAKE_PASSWORD, mockVaultStateGetter @@ -50,6 +55,40 @@ describe('Ethereum Transactions', () => { expect(result.hash).toBeDefined(); }); + it('returns the broadcast hash when a pending block is unavailable', async () => { + const provider = keyringManager.ethereumTransaction.web3Provider as any; + const hash = + '0x1234567890123456789012345678901234567890123456789012345678901234'; + provider.sendTransaction.mockResolvedValueOnce({ + hash, + blockNumber: null, + }); + provider.getTransaction.mockResolvedValueOnce({ + hash, + blockNumber: null, + }); + provider.getBlock.mockRejectedValueOnce( + new Error('pruned history unavailable: requested 0') + ); + + const tx = { + from: keyringManager.getActiveAccount().activeAccount.address, + to: '0x2c7536E3605D9C16a7a3D7b1898e529396a65c23', + value: '0x0', + gasLimit: '0x5208', + maxFeePerGas: '0x4a817c800', + maxPriorityFeePerGas: '0x77359400', + nonce: '0x0', + chainId: 1, + }; + + await expect( + keyringManager.ethereumTransaction.sendFormattedTransaction(tx) + ).resolves.toMatchObject({ hash, blockNumber: null }); + expect(provider.getTransaction).not.toHaveBeenCalled(); + expect(provider.getBlock).not.toHaveBeenCalled(); + }); + it('should get recommended nonce', async () => { const nonce = await keyringManager.ethereumTransaction.getRecommendedNonce( @@ -66,6 +105,25 @@ describe('Ethereum Transactions', () => { expect(feeData.maxPriorityFeePerGas).toBeDefined(); }); + it('should treat zero base fee blocks as EIP-1559 compatible', async () => { + const provider = keyringManager.ethereumTransaction.web3Provider as any; + provider.getBlock.mockResolvedValueOnce({ + number: 12345, + timestamp: Math.floor(Date.now() / 1000), + baseFeePerGas: 0n, + gasLimit: BigNumber.from('30000000'), + gasUsed: BigNumber.from('21000'), + transactions: [], + hash: '0x1234567890123456789012345678901234567890123456789012345678901234', + }); + + const feeData = + await keyringManager.ethereumTransaction.getFeeDataWithDynamicMaxPriorityFeePerGas(); + + expect(feeData.maxFeePerGas.isZero()).toBe(false); + expect(feeData.maxPriorityFeePerGas.isZero()).toBe(false); + }); + it('should estimate gas limit', async () => { const tx = { from: keyringManager.getActiveAccount().activeAccount.address, @@ -81,6 +139,188 @@ describe('Ethereum Transactions', () => { ); expect(gasLimit).toBeDefined(); expect(gasLimit._isBigNumber).toBe(true); + expect(gasLimit.toString()).toBe('25200'); + }); + + it('should honor explicit minimum gas override', async () => { + keyringManager.ethereumTransaction.setGasOverrides({ + minGasLimit: '65000', + }); + + const tx = { + from: keyringManager.getActiveAccount().activeAccount.address, + to: '0x742d35Cc6634C0532925a3b844Bc9e7595f8b2bc', + value: '0x0', + chainId: 1, + maxFeePerGas: '0x4a817c800', + maxPriorityFeePerGas: '0x77359400', + }; + + const gasLimit = await keyringManager.ethereumTransaction.getTxGasLimit( + tx + ); + + expect(gasLimit.toString()).toBe('65000'); + }); + + it('should keep a conservative fallback when calldata estimation fails', async () => { + const provider = keyringManager.ethereumTransaction.web3Provider as any; + provider.estimateGas.mockRejectedValueOnce(new Error('estimate failed')); + + const tx = { + from: keyringManager.getActiveAccount().activeAccount.address, + to: '0x742d35Cc6634C0532925a3b844Bc9e7595f8b2bc', + value: '0x0', + data: '0xabcdef', + chainId: 1, + maxFeePerGas: '0x4a817c800', + maxPriorityFeePerGas: '0x77359400', + }; + + const gasLimit = await keyringManager.ethereumTransaction.getTxGasLimit( + tx + ); + + expect(gasLimit.toString()).toBe('100000'); + expect(provider.estimateGas).toHaveBeenCalledTimes(1); + }); + + it('should use simple fallback for basic transfer estimation failures', async () => { + const provider = keyringManager.ethereumTransaction.web3Provider as any; + provider.estimateGas + .mockRejectedValueOnce(new Error('estimate failed')) + .mockResolvedValueOnce(BigNumber.from('21000')); + + const tx = { + from: keyringManager.getActiveAccount().activeAccount.address, + to: '0x742d35Cc6634C0532925a3b844Bc9e7595f8b2bc', + value: '0x0', + chainId: 1, + maxFeePerGas: '0x4a817c800', + maxPriorityFeePerGas: '0x77359400', + }; + + const gasLimit = await keyringManager.ethereumTransaction.getTxGasLimit( + tx + ); + + expect(gasLimit.toString()).toBe('31500'); + }); + + it('should normalize serialized BigNumber gas overrides for ERC20 sends', async () => { + const provider = keyringManager.ethereumTransaction.web3Provider as any; + const serializeBigNumber = (value: string) => + JSON.parse(JSON.stringify(BigNumber.from(value))); + + await expect( + keyringManager.ethereumTransaction.sendSignedErc20Transaction({ + decimals: 18, + gasLimit: serializeBigNumber('100000'), + maxFeePerGas: serializeBigNumber('20000000000'), + maxPriorityFeePerGas: serializeBigNumber('2000000000'), + networkUrl: 'https://rpc.example', + receiver: '0x2c7536E3605D9C16a7a3D7b1898e529396a65c23', + tokenAddress: '0x1111111111111111111111111111111111111111', + tokenAmount: '1', + }) + ).resolves.toBeDefined(); + + expect(provider.sendTransaction).toHaveBeenCalledTimes(1); + }); + + it('should preserve gas limit units', async () => { + const gasLimit = await keyringManager.ethereumTransaction.getGasLimit( + '0x2c7536E3605D9C16a7a3D7b1898e529396a65c23' + ); + + expect(gasLimit).toBe(21000); + }); + + it('should accept ERC721 token IDs beyond Number safe integer range', async () => { + await expect( + keyringManager.ethereumTransaction.sendSignedErc721Transaction({ + gasLimit: '0x0249f0', + maxFeePerGas: '0x4a817c800', + maxPriorityFeePerGas: '0x77359400', + networkUrl: 'https://rpc.example', + receiver: '0x2c7536E3605D9C16a7a3D7b1898e529396a65c23', + tokenAddress: '0x1111111111111111111111111111111111111111', + tokenId: '9007199254740993', + }) + ).resolves.toBeDefined(); + }); + + it('should reject ERC721 sends without a token ID', async () => { + await expect( + keyringManager.ethereumTransaction.sendSignedErc721Transaction({ + gasLimit: '0x0249f0', + maxFeePerGas: '0x4a817c800', + maxPriorityFeePerGas: '0x77359400', + networkUrl: 'https://rpc.example', + receiver: '0x2c7536E3605D9C16a7a3D7b1898e529396a65c23', + tokenAddress: '0x1111111111111111111111111111111111111111', + }) + ).rejects.toThrow('ERC721 tokenId is required'); + }); + + it('should preserve explicit zero priority fee on formatted transactions', async () => { + const provider = keyringManager.ethereumTransaction.web3Provider as any; + const tx = { + from: keyringManager.getActiveAccount().activeAccount.address, + to: '0x2c7536E3605D9C16a7a3D7b1898e529396a65c23', + value: '0x0', + gasLimit: '0x5208', + maxFeePerGas: '0x4a817c800', + maxPriorityFeePerGas: 0, + nonce: '0x0', + chainId: 1, + }; + + await keyringManager.ethereumTransaction.sendFormattedTransaction(tx); + + const signedTx = provider.sendTransaction.mock.calls.at(-1)?.[0]; + expect(signedTx).toBeDefined(); + expect(signedTx).toContain('02'); + }); + + it('should strip gasPrice before estimating EIP-1559 formatted transactions', async () => { + const provider = keyringManager.ethereumTransaction.web3Provider as any; + const tx = { + from: keyringManager.getActiveAccount().activeAccount.address, + to: '0x2c7536E3605D9C16a7a3D7b1898e529396a65c23', + value: '0x0', + gasPrice: '0x01', + maxFeePerGas: '0x4a817c800', + maxPriorityFeePerGas: '0x77359400', + nonce: '0x0', + chainId: 1, + }; + + await keyringManager.ethereumTransaction.sendFormattedTransaction(tx); + + expect(provider.estimateGas).toHaveBeenLastCalledWith( + expect.not.objectContaining({ gasPrice: expect.anything() }) + ); + }); + + it('should reject an invalid explicit type-2 maximum instead of estimating a legacy fallback', async () => { + const provider = keyringManager.ethereumTransaction.web3Provider as any; + const tx = { + from: keyringManager.getActiveAccount().activeAccount.address, + to: '0x2c7536E3605D9C16a7a3D7b1898e529396a65c23', + value: '0x0', + maxFeePerGas: '0x0', + maxPriorityFeePerGas: '0x0', + nonce: '0x0', + chainId: 1, + type: 2, + }; + + await expect( + keyringManager.ethereumTransaction.sendFormattedTransaction(tx) + ).rejects.toMatchObject({ transactionNotBroadcast: true }); + expect(provider.estimateGas).not.toHaveBeenCalled(); + expect(provider.sendTransaction).not.toHaveBeenCalled(); }); }); @@ -111,6 +351,21 @@ describe('Ethereum Transactions', () => { expect(signature.startsWith('0x')).toBe(true); }); + it('should sign malformed 0x-prefixed personal messages as text', async () => { + const address = keyringManager.getActiveAccount().activeAccount.address; + const signature = + await keyringManager.ethereumTransaction.signPersonalMessage([ + '0xhello', + address, + ]); + const recovered = recoverPersonalSignature({ + data: '0xhello', + signature, + }); + + expect(recovered.toLowerCase()).toBe(address.toLowerCase()); + }); + it('should verify personal message signature', () => { const message = 'Example `personal_sign` message'; const signature = @@ -192,7 +447,7 @@ describe('Ethereum Transactions', () => { const signature = await keyringManager.ethereumTransaction.signTypedData( keyringManager.getActiveAccount().activeAccount.address, typedDataV1, - 'V1' + SignTypedDataVersion.V1 ); expect(signature).toBeDefined(); @@ -203,7 +458,7 @@ describe('Ethereum Transactions', () => { const signature = await keyringManager.ethereumTransaction.signTypedData( keyringManager.getActiveAccount().activeAccount.address, typedDataV3V4, - 'V3' + SignTypedDataVersion.V3 ); expect(signature).toBeDefined(); @@ -214,7 +469,7 @@ describe('Ethereum Transactions', () => { const signature = await keyringManager.ethereumTransaction.signTypedData( keyringManager.getActiveAccount().activeAccount.address, typedDataV3V4, - 'V4' + SignTypedDataVersion.V4 ); expect(signature).toBeDefined(); @@ -227,7 +482,7 @@ describe('Ethereum Transactions', () => { const recovered = keyringManager.ethereumTransaction.verifyTypedSignature( typedDataV1, signature, - 'V1' + SignTypedDataVersion.V1 ); expect(recovered.toLowerCase()).toBe( @@ -254,11 +509,11 @@ describe('Ethereum Transactions', () => { expect(encryptionPublicKey).toBeDefined(); // Use eth-sig-util to encrypt the message - const encryptedData = encrypt( - encryptionPublicKey, - { data: originalMessage }, - 'x25519-xsalsa20-poly1305' - ); + const encryptedData = encrypt({ + publicKey: encryptionPublicKey, + data: originalMessage, + version: 'x25519-xsalsa20-poly1305', + }); // Convert encrypted data to the hex format that decryptMessage expects const encryptedHex = Buffer.from(JSON.stringify(encryptedData)).toString( @@ -304,6 +559,9 @@ describe('Ethereum Transactions', () => { expect(bigNumber._isBigNumber).toBe(true); expect(bigNumber._hex).toBe('0x03e8'); // Updated to match actual format + expect(JSON.stringify({ gasLimit: bigNumber })).toBe( + '{"gasLimit":{"type":"BigNumber","hex":"0x03e8"}}' + ); }); }); diff --git a/packages/sysweb3-keyring/test/unit/transactions/evm-local-signer.spec.ts b/packages/sysweb3-keyring/test/unit/transactions/evm-local-signer.spec.ts new file mode 100644 index 00000000..4d050069 --- /dev/null +++ b/packages/sysweb3-keyring/test/unit/transactions/evm-local-signer.spec.ts @@ -0,0 +1,669 @@ +import { recoverPersonalSignature } from '@metamask/eth-sig-util'; +import { Transaction } from 'ethers'; + +import { BigNumber, serializeTransaction } from '../../../src/ethers-v6'; +import { + deriveEvmAccountFromMnemonic, + hashPersonalMessage, + parsePersonalMessage, + privateKeyToAccount, + sendLocalEvmTransaction, + signDigestHex, + signPersonalMessage, + signTransaction, +} from '../../../src/transactions/evm-local-signer'; + +const PRIVATE_KEY = + '0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef'; +const ADDRESS = '0xFCAd0B19bB29D4674531d6f115237E16AfCE377c'; +const PERSONAL_MESSAGE = + '0x4578616d706c652060706572736f6e616c5f7369676e60206d657373616765'; +const PERSONAL_SIGNATURE = + '0x51da3570312f459585790825e3ba282376271e18a77845cb01a4adea9cf7d0f0496866d454d74361b4ca286623f0fb91fd9fa3519c79f343215e736bcac50f061b'; +const DIGEST = + '0x00000000000000000000000000000000000000000048656c6c6f20576f726c64'; +const DIGEST_SIGNATURE = + '0x1562194d8ae416bc5da2a06d7853fe26ce3c0ac0ead654505e6fca52c079cf2e063a90d5b6e8fdc8d9fc108aef36c203736c65fef90b54b9284ece28b90b2e141c'; + +describe('EVM local signer', () => { + it('derives the expected checksummed address and public key from a private key', () => { + const account = privateKeyToAccount(PRIVATE_KEY); + + expect(account.address).toBe(ADDRESS); + expect(account.privateKey).toBe(PRIVATE_KEY); + expect(account.publicKey).toMatch(/^0x04[0-9a-f]{128}$/); + }); + + it('derives the expected first EVM account from a mnemonic and path', () => { + const account = deriveEvmAccountFromMnemonic( + 'abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about', + "m/44'/60'/0'/0/0" + ); + + expect(account.address).toBe('0x9858EfFD232B4033E47d90003D41EC34EcaEda94'); + expect(account.privateKey).toBe( + '0x1ab42cc412b618bdea3a599e3c9bae199ebf030895b039e9db1e30dafb12b727' + ); + }); + + it('rejects invalid mnemonic phrases before deriving EVM accounts', () => { + expect(() => + deriveEvmAccountFromMnemonic( + 'abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon', + "m/44'/60'/0'/0/0" + ) + ).toThrow('Invalid EVM mnemonic'); + }); + + it('rejects invalid private keys before signing or deriving', () => { + expect(() => privateKeyToAccount('0x' + '00'.repeat(32))).toThrow( + 'Invalid EVM private key' + ); + expect(() => privateKeyToAccount('0x1234')).toThrow( + 'Invalid EVM private key' + ); + expect(() => privateKeyToAccount(PRIVATE_KEY + 'f')).toThrow( + 'Invalid EVM private key' + ); + expect(() => privateKeyToAccount(PRIVATE_KEY + 'zz')).toThrow( + 'Invalid EVM private key' + ); + }); + + it('signs a raw 32-byte eth_sign digest deterministically', () => { + expect(signDigestHex(DIGEST, PRIVATE_KEY)).toBe(DIGEST_SIGNATURE); + }); + + it('rejects non-32-byte digests', () => { + expect(() => signDigestHex('0x1234', PRIVATE_KEY)).toThrow( + 'EVM signatures require a 32-byte digest' + ); + }); + + it('rejects local transaction signing when from does not match the private key', async () => { + const provider = { + verifyConfiguredChainId: jest.fn().mockResolvedValue(undefined), + getNetwork: jest.fn().mockResolvedValue({ chainId: 1 }), + getTransactionCount: jest.fn(), + estimateGas: jest.fn(), + getGasPrice: jest.fn(), + sendTransaction: jest.fn(), + } as any; + + await expect( + sendLocalEvmTransaction(provider, PRIVATE_KEY, { + from: '0x0000000000000000000000000000000000000001', + to: ADDRESS, + value: '0x0', + gasLimit: '0x5208', + gasPrice: '0x01', + nonce: 0, + chainId: 1, + type: 0, + data: '0x', + }) + ).rejects.toThrow('Transaction from does not match EVM private key'); + expect(provider.sendTransaction).not.toHaveBeenCalled(); + }); + + it('populates EIP-1559 fees before signing local transactions', async () => { + const provider = { + verifyConfiguredChainId: jest.fn().mockResolvedValue(undefined), + getNetwork: jest.fn().mockResolvedValue({ chainId: 1 }), + resolveName: jest.fn(), + getTransactionCount: jest.fn().mockResolvedValue(7), + estimateGas: jest.fn().mockResolvedValue(BigNumber.from(21000)), + getFeeData: jest.fn().mockResolvedValue({ + gasPrice: BigNumber.from(100), + maxFeePerGas: BigNumber.from(300), + maxPriorityFeePerGas: BigNumber.from(20), + }), + getGasPrice: jest.fn(), + sendTransaction: jest + .fn() + .mockImplementation(async (signedTx: string) => { + const decoded = Transaction.from(signedTx); + expect(decoded.type).toBe(2); + expect(decoded.maxFeePerGas).toBe(300n); + expect(decoded.maxPriorityFeePerGas).toBe(20n); + return { + hash: '0x1234567890123456789012345678901234567890123456789012345678901234', + }; + }), + } as any; + + await sendLocalEvmTransaction(provider, PRIVATE_KEY, { + to: ADDRESS, + value: '0x0', + data: '0x', + }); + + expect(provider.getFeeData).toHaveBeenCalledTimes(1); + expect(provider.getGasPrice).not.toHaveBeenCalled(); + expect(provider.verifyConfiguredChainId).toHaveBeenCalledTimes(1); + expect(provider.sendTransaction).toHaveBeenCalledTimes(1); + }); + + it('resolves named recipients before signing local transactions', async () => { + const provider = { + verifyConfiguredChainId: jest.fn().mockResolvedValue(undefined), + getNetwork: jest.fn().mockResolvedValue({ chainId: 1 }), + resolveName: jest.fn().mockResolvedValue(ADDRESS), + getTransactionCount: jest.fn().mockResolvedValue(7), + estimateGas: jest.fn().mockResolvedValue(BigNumber.from(21000)), + getFeeData: jest.fn().mockResolvedValue({ + gasPrice: BigNumber.from(100), + maxFeePerGas: BigNumber.from(300), + maxPriorityFeePerGas: BigNumber.from(20), + }), + getGasPrice: jest.fn(), + sendTransaction: jest + .fn() + .mockImplementation(async (signedTx: string) => { + const decoded = Transaction.from(signedTx); + expect(decoded.to).toBe(ADDRESS); + return { + hash: '0x1234567890123456789012345678901234567890123456789012345678901234', + }; + }), + } as any; + + await sendLocalEvmTransaction(provider, PRIVATE_KEY, { + to: 'alice.eth', + value: '0x0', + data: '0x', + }); + + expect(provider.resolveName).toHaveBeenCalledWith('alice.eth'); + expect(provider.verifyConfiguredChainId).toHaveBeenCalledTimes(1); + expect(provider.sendTransaction).toHaveBeenCalledTimes(1); + }); + + it('rejects local transactions with unresolved named recipients', async () => { + const provider = { + verifyConfiguredChainId: jest.fn().mockResolvedValue(undefined), + getNetwork: jest.fn().mockResolvedValue({ chainId: 1 }), + resolveName: jest.fn().mockResolvedValue(null), + getTransactionCount: jest.fn(), + estimateGas: jest.fn(), + getFeeData: jest.fn(), + getGasPrice: jest.fn(), + sendTransaction: jest.fn(), + } as any; + + await expect( + sendLocalEvmTransaction(provider, PRIVATE_KEY, { + to: 'missing.eth', + value: '0x0', + data: '0x', + }) + ).rejects.toThrow('Unable to resolve EVM transaction recipient'); + + expect(provider.resolveName).toHaveBeenCalledWith('missing.eth'); + expect(provider.verifyConfiguredChainId).toHaveBeenCalledTimes(1); + expect(provider.sendTransaction).not.toHaveBeenCalled(); + }); + + it('populates gasPrice for explicit EIP-2930 local transactions', async () => { + const provider = { + verifyConfiguredChainId: jest.fn().mockResolvedValue(undefined), + getNetwork: jest.fn().mockResolvedValue({ chainId: 1 }), + getTransactionCount: jest.fn().mockResolvedValue(7), + estimateGas: jest.fn().mockResolvedValue(BigNumber.from(21000)), + getFeeData: jest.fn(), + getGasPrice: jest.fn().mockResolvedValue(BigNumber.from(100)), + sendTransaction: jest + .fn() + .mockImplementation(async (signedTx: string) => { + const decoded = Transaction.from(signedTx); + expect(decoded.type).toBe(1); + expect(decoded.gasPrice).toBe(100n); + expect(decoded.maxFeePerGas).toBe(null); + expect(decoded.maxPriorityFeePerGas).toBe(null); + return { + hash: '0x1234567890123456789012345678901234567890123456789012345678901234', + }; + }), + } as any; + + await sendLocalEvmTransaction(provider, PRIVATE_KEY, { + type: '0x1', + to: ADDRESS, + value: '0x0', + data: '0x', + accessList: [], + }); + + expect(provider.getGasPrice).toHaveBeenCalledTimes(1); + expect(provider.getFeeData).not.toHaveBeenCalled(); + expect(provider.verifyConfiguredChainId).toHaveBeenCalledTimes(1); + expect(provider.sendTransaction).toHaveBeenCalledTimes(1); + }); + + it('validates the fully populated transaction after the context guard and before signing', async () => { + const order: string[] = []; + const provider = { + verifyConfiguredChainId: jest.fn().mockResolvedValue(undefined), + getNetwork: jest.fn().mockResolvedValue({ chainId: 1 }), + resolveName: jest.fn().mockResolvedValue(ADDRESS), + getTransactionCount: jest.fn().mockResolvedValue(7), + estimateGas: jest.fn().mockResolvedValue(BigNumber.from(21000)), + getFeeData: jest.fn().mockResolvedValue({ + maxFeePerGas: BigNumber.from(300), + maxPriorityFeePerGas: BigNumber.from(20), + }), + sendTransaction: jest.fn(async (signed: string) => { + order.push('broadcast'); + const transaction = Transaction.from(signed); + expect(transaction).toMatchObject({ + to: ADDRESS, + chainId: 1n, + nonce: 7, + gasLimit: 21000n, + type: 2, + maxFeePerGas: 300n, + maxPriorityFeePerGas: 20n, + value: 0n, + data: '0x', + }); + return { hash: '0x' + '12'.repeat(32) }; + }), + } as any; + const beforeSign = jest.fn(() => { + order.push('context'); + }); + const beforeBroadcast = jest.fn(() => { + order.push('beforeBroadcast'); + }); + const validate = jest.fn((transaction) => { + order.push('validate'); + expect(provider.resolveName).toHaveBeenCalledWith('alice.eth'); + expect(provider.getTransactionCount).toHaveBeenCalledWith( + ADDRESS, + 'pending' + ); + expect(provider.estimateGas).toHaveBeenCalledTimes(1); + expect(provider.getFeeData).toHaveBeenCalledTimes(1); + expect(transaction).toMatchObject({ + to: ADDRESS, + chainId: 1, + nonce: 7, + type: 2, + value: '0x0', + data: '0x', + }); + expect(transaction.gasLimit.toString()).toBe('21000'); + expect(transaction.maxFeePerGas.toString()).toBe('300'); + expect(transaction.maxPriorityFeePerGas.toString()).toBe('20'); + expect(transaction).not.toHaveProperty('from'); + expect(transaction).not.toHaveProperty('ccipReadEnabled'); + expect(transaction).not.toHaveProperty('customData'); + }); + + await sendLocalEvmTransaction( + provider, + PRIVATE_KEY, + { + from: Promise.resolve(ADDRESS), + to: Promise.resolve('alice.eth'), + ccipReadEnabled: true, + customData: { ignored: true }, + }, + beforeBroadcast, + beforeSign, + validate + ); + + expect(validate).toHaveBeenCalledTimes(1); + expect(order).toEqual([ + 'context', + 'validate', + 'beforeBroadcast', + 'broadcast', + ]); + }); + + it('rejects a populated envelope before signing or broadcasting when final validation fails', async () => { + const provider = { + verifyConfiguredChainId: jest.fn().mockResolvedValue(undefined), + getNetwork: jest.fn().mockResolvedValue({ chainId: 1 }), + getTransactionCount: jest.fn().mockResolvedValue(0), + estimateGas: jest.fn().mockResolvedValue(BigNumber.from(42000)), + getFeeData: jest.fn().mockResolvedValue({ + maxFeePerGas: BigNumber.from(301), + maxPriorityFeePerGas: BigNumber.from(20), + }), + sendTransaction: jest.fn(), + } as any; + const error = new Error('Final fee exceeds approval'); + const beforeSign = jest.fn(); + const beforeBroadcast = jest.fn(); + const validate = jest.fn((transaction) => { + expect(beforeSign).toHaveBeenCalledTimes(1); + expect( + transaction.gasLimit.mul(transaction.maxFeePerGas).toString() + ).toBe('12642000'); + throw error; + }); + const signer = jest.spyOn( + // Observe the actual exported signing boundary; no successful signing mock. + // eslint-disable-next-line @typescript-eslint/no-var-requires + require('../../../src/transactions/evm-local-signer'), + 'signTransaction' + ); + try { + await expect( + sendLocalEvmTransaction( + provider, + PRIVATE_KEY, + { to: ADDRESS }, + beforeBroadcast, + beforeSign, + validate + ) + ).rejects.toBe(error); + expect(validate).toHaveBeenCalledTimes(1); + expect(signer).not.toHaveBeenCalled(); + expect(beforeBroadcast).not.toHaveBeenCalled(); + expect(provider.sendTransaction).not.toHaveBeenCalled(); + } finally { + signer.mockRestore(); + } + }); + + it.each(['resolve', 'reject'])( + 'rejects an async final validator before its pending decision (%s)', + async (decision) => { + const provider = { + verifyConfiguredChainId: jest.fn().mockResolvedValue(undefined), + sendTransaction: jest.fn(), + } as any; + let release!: () => void; + const pending = new Promise((resolve) => { + release = resolve; + }); + let entered!: () => void; + const ready = new Promise((resolve) => { + entered = resolve; + }); + const validate = jest.fn(async () => { + entered(); + await pending; + if (decision === 'reject') throw new Error('Late validator rejection'); + }); + const beforeBroadcast = jest.fn(); + const signer = jest.spyOn( + // eslint-disable-next-line @typescript-eslint/no-var-requires + require('../../../src/transactions/evm-local-signer'), + 'signTransaction' + ); + try { + const result = sendLocalEvmTransaction( + provider, + PRIVATE_KEY, + { + to: ADDRESS, + nonce: 0, + chainId: 1, + gasLimit: 21000, + gasPrice: 100, + type: 0, + }, + beforeBroadcast, + undefined, + validate + ); + const rejected = expect(result).rejects.toThrow( + 'Transaction validation must be synchronous' + ); + await ready; + // The call must reject while the validator still has no decision. + await rejected; + expect(signer).not.toHaveBeenCalled(); + expect(beforeBroadcast).not.toHaveBeenCalled(); + expect(provider.sendTransaction).not.toHaveBeenCalled(); + release(); + // Let the delayed rejection run; it must already have a rejection handler. + await new Promise((resolve) => setImmediate(resolve)); + } finally { + release(); + signer.mockRestore(); + } + } + ); + + it('rejects a custom final-validation thenable and consumes its rejection', async () => { + const provider = { + verifyConfiguredChainId: jest.fn().mockResolvedValue(undefined), + sendTransaction: jest.fn(), + } as any; + const then = jest.fn((_resolve, reject) => { + reject(new Error('Thenable rejection')); + }); + const validate = jest.fn(() => ({ then })); + const beforeBroadcast = jest.fn(); + const signer = jest.spyOn( + // eslint-disable-next-line @typescript-eslint/no-var-requires + require('../../../src/transactions/evm-local-signer'), + 'signTransaction' + ); + try { + await expect( + sendLocalEvmTransaction( + provider, + PRIVATE_KEY, + { + to: ADDRESS, + nonce: 0, + chainId: 1, + gasLimit: 21000, + gasPrice: 100, + type: 0, + }, + beforeBroadcast, + undefined, + validate + ) + ).rejects.toThrow('Transaction validation must be synchronous'); + await new Promise((resolve) => setImmediate(resolve)); + expect(then).toHaveBeenCalledTimes(1); + expect(signer).not.toHaveBeenCalled(); + expect(beforeBroadcast).not.toHaveBeenCalled(); + expect(provider.sendTransaction).not.toHaveBeenCalled(); + } finally { + signer.mockRestore(); + } + }); + + it('preserves the five-argument send API when no final validator is supplied', async () => { + const order: string[] = []; + const provider = { + verifyConfiguredChainId: jest.fn().mockResolvedValue(undefined), + sendTransaction: jest.fn(async () => { + order.push('broadcast'); + return { hash: '0x' + '34'.repeat(32) }; + }), + } as any; + await sendLocalEvmTransaction( + provider, + PRIVATE_KEY, + { + to: ADDRESS, + nonce: 0, + chainId: 1, + gasLimit: 21000, + gasPrice: 100, + type: 0, + }, + () => { + order.push('beforeBroadcast'); + }, + () => { + order.push('context'); + } + ); + expect(order).toEqual(['context', 'beforeBroadcast', 'broadcast']); + expect(provider.sendTransaction).toHaveBeenCalledTimes(1); + }); + + it('signs personal messages in MetaMask-compatible format', () => { + const signature = signPersonalMessage(PERSONAL_MESSAGE, PRIVATE_KEY); + const recovered = recoverPersonalSignature({ + data: PERSONAL_MESSAGE, + signature, + }); + + expect(signature).toBe(PERSONAL_SIGNATURE); + expect(recovered.toLowerCase()).toBe(ADDRESS.toLowerCase()); + expect(parsePersonalMessage(PERSONAL_MESSAGE)).toBe( + 'Example `personal_sign` message' + ); + }); + + it('hashes personal messages with the EIP-191 prefix', () => { + expect(hashPersonalMessage(Buffer.from('hello'))).toBe( + '0x50b2c43fd39106bafbba0da34fc430e1f91e3c96ea2acee2bc34119f92b37750' + ); + }); +}); + +describe('EVM transaction serializer', () => { + it('signs an EIP-1559 transaction byte-for-byte against a fixed vector', () => { + expect( + signTransaction( + { + to: '0x2c7536E3605D9C16a7a3D7b1898e529396a65c23', + value: '0x0', + gasLimit: '0x5208', + maxFeePerGas: '0x4a817c800', + maxPriorityFeePerGas: '0x77359400', + nonce: 0, + chainId: 1, + type: 2, + data: '0x', + }, + PRIVATE_KEY + ) + ).toBe( + '0x02f86b018084773594008504a817c800825208942c7536e3605d9c16a7a3d7b1898e529396a65c238080c001a00e649d7c30947b140969ffd55afacebbfb1ad9a3f2598b46c9a7c83ea4b12d71a02e6f269af1511ca6337cc35761707c8459e7781502050ac87a9f8c1fe1e76c31' + ); + }); + + it('signs a legacy EIP-155 transaction byte-for-byte against a fixed vector', () => { + expect( + signTransaction( + { + to: '0x2c7536E3605D9C16a7a3D7b1898e529396a65c23', + value: '0x01', + gasLimit: '0x5208', + gasPrice: '0x4a817c800', + nonce: 1, + chainId: 57, + type: 0, + data: '0x', + }, + PRIVATE_KEY + ) + ).toBe( + '0xf865018504a817c800825208942c7536e3605d9c16a7a3d7b1898e529396a65c2301808196a09e45c98f8c125ec111da1ee78c493e4a81c6f395001db83c8d12e15a86bb6699a0395567d28d51d925f906ff930731a589c78138326bcce5687ce2b1697176ae9e' + ); + }); + + it('serializes legacy EIP-155 signatures for Syscoin NEVM chain 57', () => { + const transaction = { + to: '0x2c7536E3605D9C16a7a3D7b1898e529396a65c23', + value: '0x01', + gasLimit: '0x5208', + gasPrice: '0x01', + nonce: 1, + chainId: 57, + type: 0, + data: '0x', + }; + const signature = { + r: `0x${'11'.repeat(32)}`, + s: `0x${'22'.repeat(32)}`, + v: 149, + }; + + expect(() => serializeTransaction(transaction, signature)).not.toThrow(); + expect(serializeTransaction(transaction, signature)).toContain('8195'); + }); + + it('signs an EIP-2930 transaction with access list byte-for-byte', () => { + expect( + signTransaction( + { + to: '0x2c7536E3605D9C16a7a3D7b1898e529396a65c23', + value: '0x0', + gasLimit: '0x5208', + gasPrice: '0x4a817c800', + nonce: 2, + chainId: 1, + type: 1, + data: '0x', + accessList: [ + { + address: '0x0000000000000000000000000000000000000001', + storageKeys: [ + '0x0000000000000000000000000000000000000000000000000000000000000000', + ], + }, + ], + }, + PRIVATE_KEY + ) + ).toBe( + '0x01f89f01028504a817c800825208942c7536e3605d9c16a7a3d7b1898e529396a65c238080f838f7940000000000000000000000000000000000000001e1a0000000000000000000000000000000000000000000000000000000000000000080a08916200a771d6a544bc65b882ef2d78502b7c0d0822d723d0a9179f580e00dbea07b9ba2f6d11d1b0ac05e52273126193e0c23a7c4edf6bbc6e1d506066808017f' + ); + }); + + it('infers EIP-2930 type for access-list transactions', () => { + const unsigned = serializeTransaction({ + to: '0x2c7536E3605D9C16a7a3D7b1898e529396a65c23', + value: '0x0', + gasLimit: '0x5208', + gasPrice: '0x4a817c800', + nonce: 2, + chainId: 1, + data: '0x', + accessList: [ + { + address: '0x0000000000000000000000000000000000000001', + storageKeys: [ + '0x0000000000000000000000000000000000000000000000000000000000000000', + ], + }, + ], + }); + + expect(Transaction.from(unsigned).type).toBe(1); + }); + + it('rejects unsupported transaction shapes', () => { + expect(() => + serializeTransaction({ type: 5, chainId: 1, data: '0x' }) + ).toThrow('unsupported transaction type'); + + expect(() => + serializeTransaction({ + type: 2, + chainId: 1, + gasPrice: '0x1', + maxFeePerGas: '0x2', + }) + ).toThrow('mismatch EIP-1559 gasPrice != maxFeePerGas'); + + expect(() => + serializeTransaction({ + type: 0, + accessList: [ + { + address: '0x0000000000000000000000000000000000000001', + storageKeys: [], + }, + ], + }) + ).toThrow('legacy transactions do not support accessList'); + }); +}); diff --git a/packages/sysweb3-keyring/test/unit/transactions/native-sweep.spec.ts b/packages/sysweb3-keyring/test/unit/transactions/native-sweep.spec.ts new file mode 100644 index 00000000..0f94c47c --- /dev/null +++ b/packages/sysweb3-keyring/test/unit/transactions/native-sweep.spec.ts @@ -0,0 +1,424 @@ +// The package's shared setup imports the SDK with a mocked builder. This +// regression intentionally exercises the installed builder and sanitizer. +jest.resetModules(); +jest.unmock('syscoinjs-lib'); +if ((global as any).window) + (global as any).window.location = { href: 'http://localhost/' }; + +import * as syscoinjs from 'syscoinjs-lib'; + +import { SyscoinTransactions } from '../../../src/transactions/syscoin'; +import { KeyringAccountType } from '../../../src/types'; +import { PsbtUtils } from '../../../src/utils/psbt'; + +describe('explicit native sweep quotes', () => { + const network = syscoinjs.utils.syscoinNetworks.testnet; + const address = syscoinjs.utils.bitcoinjs.payments.p2wpkh({ + hash: Buffer.alloc(20, 2), + network, + }).address; + const utxo = (value = '6547561', parent = 1, extra: any = {}) => ({ + txid: parent.toString(16).padStart(64, '0'), + vout: 0, + value, + address, + confirmations: 0, + ...extra, + }); + let main: any; + let sdk: SyscoinTransactions; + let fetchUtxos: jest.SpyInstance; + let create: jest.SpyInstance; + let getSigner: jest.Mock; + let state: any; + const request = { + amount: '0.09775331', + receivingAddress: address, + feeRate: 0.000000012529296875, + isMax: true, + nativeSweep: true, + token: null, + }; + + beforeEach(() => { + main = new syscoinjs.SyscoinJSLib(null, 'https://offline.invalid', network); + fetchUtxos = jest + .spyOn(syscoinjs.utils, 'fetchBackendUTXOS') + .mockImplementation(async () => [utxo()]); + create = jest.spyOn(main, 'createTransaction'); + getSigner = jest.fn(() => { + throw new Error('No signing is permitted'); + }); + state = { + activeAccountId: 0, + activeAccountType: KeyringAccountType.HDAccount, + accounts: { HDAccount: { 0: { xpub: 'vpub-offline', address } } }, + activeNetwork: { slip44: 1, currency: 'TSYS' }, + }; + sdk = new SyscoinTransactions( + getSigner, + () => ({ main }), + () => state, + async () => address, + {} as any, + {} as any + ); + }); + afterEach(() => jest.restoreAllMocks()); + + it('quotes the reported summary mismatch from one current UTXO snapshot', async () => { + const sanitize = jest.spyOn(syscoinjs.utils, 'sanitizeBlockbookUTXOs'); + const quote = await sdk.getEstimateSysTransactionFee(request); + expect(quote).toMatchObject({ + grossAmount: '0.06547561', + recipientAmount: '0.06547335', + fee: 0.00000226, + }); + expect(fetchUtxos).toHaveBeenCalledTimes(1); + expect(sanitize).toHaveBeenCalledTimes(1); + expect(create.mock.calls[0][5].utxos).toHaveLength(1); + const psbt = PsbtUtils.fromPali(quote.psbt, { + slip44: 1, + currency: 'TSYS', + }); + expect(psbt.txOutputs[0].value.toString()).toBe('6547335'); + expect(psbt.data.inputs[0].witnessUtxo.value.toString()).toBe('6547561'); + expect(getSigner).not.toHaveBeenCalled(); + }); + + it('quotes a fresh larger balance only when nativeSweep was explicitly requested', async () => { + fetchUtxos.mockResolvedValue([utxo('12000000')]); + const quote = await sdk.getEstimateSysTransactionFee(request); + expect(quote.grossAmount).toBe('0.12'); + expect(quote.recipientAmount).toBe('0.11999774'); + }); + + it('uses the public address scope for an imported single-address account', async () => { + state.activeAccountType = KeyringAccountType.Imported; + state.accounts.Imported = { 0: { xpub: address, address } }; + fetchUtxos.mockResolvedValue([utxo('6547561', 1, { address: undefined })]); + const quote = await sdk.getEstimateSysTransactionFee(request); + expect(fetchUtxos).toHaveBeenCalledWith(main.blockbookURL, address); + expect(quote.grossAmount).toBe('0.06547561'); + expect(quote.recipientAmount).toBe('0.06547335'); + expect(getSigner).not.toHaveBeenCalled(); + }); + + it('prepares four consecutive zero-confirmation native parents without a signing call', async () => { + let value = 9775331n; + for (let parent = 1; parent <= 4; parent++) { + fetchUtxos.mockResolvedValueOnce([utxo(value.toString(), parent)]); + const quote = await sdk.getEstimateSysTransactionFee(request); + const psbt = PsbtUtils.fromPali(quote.psbt, { + slip44: 1, + currency: 'TSYS', + }); + expect(psbt.data.inputs[0].witnessUtxo.value).toBe(value); + value -= 226n; + expect(psbt.txOutputs[0].value).toBe(value); + } + expect(value).toBe(9774427n); + expect(fetchUtxos).toHaveBeenCalledTimes(4); + expect(getSigner).not.toHaveBeenCalled(); + }); + + it('keeps an ordinary full-balance manual request bounded and failing with the exact shortfall', async () => { + await expect( + sdk.getEstimateSysTransactionFee({ ...request, nativeSweep: false }) + ).rejects.toMatchObject({ + code: 'INSUFFICIENT_FUNDS', + shortfall: 0.0322777, + }); + expect(create.mock.calls[0]).toHaveLength(5); + }); + + it('retains the ordinary manual quote shape and exact recipient amount', async () => { + const quote = await sdk.getEstimateSysTransactionFee({ + ...request, + amount: '0.01', + nativeSweep: false, + isMax: false, + }); + expect(Object.keys(quote).sort()).toEqual(['fee', 'psbt']); + const psbt = PsbtUtils.fromPali(quote.psbt, { + slip44: 1, + currency: 'TSYS', + }); + expect(psbt.txOutputs[0].value).toBe(1000000n); + }); + + it('leaves SPT carrier outpoints untouched instead of counting their native value', async () => { + fetchUtxos.mockResolvedValue([ + utxo(), + utxo('1000000', 2, { assetInfo: { assetGuid: '123', value: '10' } }), + ]); + const quote = await sdk.getEstimateSysTransactionFee(request); + expect(quote.grossAmount).toBe('0.06547561'); + const psbt = PsbtUtils.fromPali(quote.psbt, { + slip44: 1, + currency: 'TSYS', + }); + expect(psbt.txInputs).toHaveLength(1); + expect( + create.mock.calls[0][5].utxos.every((input: any) => !input.assetInfo) + ).toBe(true); + }); + + it('spends rewards at the same address without spending linked collateral on MAX', async () => { + const collateral = utxo('10000000000000', 2); + fetchUtxos.mockResolvedValue([collateral, utxo('1000000')]); + const quote = await sdk.getEstimateSysTransactionFee({ + ...request, + excludedOutpoints: [{ txid: collateral.txid, vout: 0 }], + }); + expect(quote.grossAmount).toBe('0.01'); + const psbt = PsbtUtils.fromPali(quote.psbt, { + slip44: 1, + currency: 'TSYS', + }); + expect(psbt.txInputs).toHaveLength(1); + expect(Buffer.from(psbt.txInputs[0].hash).reverse().toString('hex')).toBe( + utxo().txid + ); + expect(fetchUtxos).toHaveBeenCalledTimes(1); + }); + + it('excludes collateral for ordinary sends and fails if only collateral could fund the request', async () => { + const collateral = utxo('10000000000000', 2); + fetchUtxos.mockResolvedValue([collateral, utxo('1000000')]); + const excludedOutpoints = [{ txid: collateral.txid, vout: 0 }]; + const quote = await sdk.getEstimateSysTransactionFee({ + ...request, + nativeSweep: false, + isMax: false, + amount: '0.001', + excludedOutpoints, + }); + const psbt = PsbtUtils.fromPali(quote.psbt, { + slip44: 1, + currency: 'TSYS', + }); + expect(psbt.txInputs).toHaveLength(1); + expect(Buffer.from(psbt.txInputs[0].hash).reverse().toString('hex')).toBe( + utxo().txid + ); + await expect( + sdk.getEstimateSysTransactionFee({ + ...request, + nativeSweep: false, + isMax: false, + amount: '1', + excludedOutpoints, + }) + ).rejects.toMatchObject({ code: 'INSUFFICIENT_FUNDS' }); + }); + + it('preserves SPT metadata when filtering collateral from fee funding', async () => { + const collateral = utxo('10000000000000', 2); + const assets = new Map([['123', { symbol: 'TEST', decimals: 8 }]]); + fetchUtxos.mockResolvedValue({ utxos: [collateral, utxo()], assets }); + const allocate = jest.spyOn(main, 'assetAllocationSend').mockResolvedValue({ + psbt: new syscoinjs.utils.bitcoinjs.Psbt({ network }), + fee: 226, + }); + await sdk.getEstimateSysTransactionFee({ + ...request, + nativeSweep: false, + token: { guid: '123' }, + excludedOutpoints: [{ txid: collateral.txid, vout: 0 }], + }); + expect(allocate.mock.calls[0][5]).toEqual({ utxos: [utxo()], assets }); + expect(fetchUtxos).toHaveBeenCalledTimes(1); + }); + + it.each([true, false])( + 'builds an actual SPT transfer with top-level metadata=%s and unprotected fee funds', + async (withTopLevelMetadata) => { + const collateral = utxo('10000000000000', 2); + const carrier = utxo('1000', 3, { + assetInfo: { assetGuid: '123', value: '1000' }, + }); + fetchUtxos.mockResolvedValue( + withTopLevelMetadata + ? { + utxos: [collateral, utxo(), carrier], + assets: [ + { assetGuid: '123', maxSupply: '1000000000', decimals: 8 }, + ], + } + : [collateral, utxo(), carrier] + ); + const quote = await sdk.getEstimateSysTransactionFee({ + ...request, + amount: '0.00000005', + nativeSweep: false, + isMax: false, + token: { guid: '123' }, + excludedOutpoints: [{ txid: collateral.txid, vout: 0 }], + }); + const psbt = PsbtUtils.fromPali(quote.psbt, { + slip44: 1, + currency: 'TSYS', + }); + const ids = psbt.txInputs.map((input) => + Buffer.from(input.hash).reverse().toString('hex') + ); + expect(ids).toContain(carrier.txid); + expect(ids).not.toContain(collateral.txid); + expect(fetchUtxos).toHaveBeenCalledTimes(1); + expect(getSigner).not.toHaveBeenCalled(); + } + ); + + it('rejects a builder returning protected inputs despite the filtered funding set', async () => { + const collateral = utxo('10000000000000', 2); + fetchUtxos.mockResolvedValue([collateral, utxo()]); + const psbt = new syscoinjs.utils.bitcoinjs.Psbt({ network }); + psbt.addInput({ + hash: collateral.txid, + index: 0, + witnessUtxo: { + script: syscoinjs.utils.bitcoinjs.address.toOutputScript( + address, + network + ), + value: BigInt(collateral.value), + }, + }); + jest + .spyOn(main, 'assetAllocationSend') + .mockResolvedValue({ psbt, fee: 226 }); + await expect( + sdk.getEstimateSysTransactionFee({ + ...request, + nativeSweep: false, + token: { guid: '123' }, + excludedOutpoints: [{ txid: collateral.txid, vout: 0 }], + }) + ).rejects.toMatchObject({ code: 'PROTECTED_COLLATERAL' }); + }); + + it('includes an uneconomic native outpoint in the complete sweep', async () => { + fetchUtxos.mockResolvedValue({ utxos: [utxo('1000000'), utxo('1', 2)] }); + const quote = await sdk.getEstimateSysTransactionFee(request); + expect(quote.grossAmount).toBe('0.01000001'); + expect(quote.recipientAmount).toBe('0.00999639'); + expect( + PsbtUtils.fromPali(quote.psbt, { slip44: 1, currency: 'TSYS' }).txInputs + ).toHaveLength(2); + }); + + it('keeps the ordinary SPT estimate route and response shape when sweep is absent', async () => { + const allocate = jest.spyOn(main, 'assetAllocationSend').mockResolvedValue({ + psbt: new syscoinjs.utils.bitcoinjs.Psbt({ network }), + fee: 226, + }); + const quote = await sdk.getEstimateSysTransactionFee({ + ...request, + nativeSweep: false, + token: { guid: '123' }, + }); + expect(Object.keys(quote).sort()).toEqual(['fee', 'psbt']); + expect(allocate).toHaveBeenCalledTimes(1); + expect(create).not.toHaveBeenCalled(); + expect(fetchUtxos).not.toHaveBeenCalled(); + }); + + it.each([ + { isMax: false }, + { token: { guid: '123' } }, + { token: {} }, + { nativeSweep: 'true' }, + ])('rejects invalid sweep intent before fetching: %p', async (change) => { + await expect( + sdk.getEstimateSysTransactionFee({ ...request, ...change } as any) + ).rejects.toMatchObject({ code: 'INVALID_NATIVE_SWEEP' }); + expect(fetchUtxos).not.toHaveBeenCalled(); + expect(create).not.toHaveBeenCalled(); + }); + + it.each([ + [utxo(), utxo()], + [utxo('-1')], + [utxo('1.5')], + [utxo('1e6')], + [utxo('1', 1, { value: Number.MAX_SAFE_INTEGER + 1 })], + [utxo('1', 1, { vout: -1 })], + [utxo('1', 1, { txid: 'invalid' })], + [utxo('1', 1, { assetInfo: false })], + ])( + 'rejects duplicate or malformed raw outpoints/values: %p', + async (...inputs) => { + fetchUtxos.mockResolvedValue(inputs); + await expect( + sdk.getEstimateSysTransactionFee(request) + ).rejects.toMatchObject({ code: 'INVALID_NATIVE_SWEEP_UTXOS' }); + expect(create).not.toHaveBeenCalled(); + } + ); + + it.each([ + [], + [utxo('1000000', 1, { assetInfo: { assetGuid: '123', value: '10' } })], + [utxo('294')], + ])( + 'rejects empty, asset-only, or dust-limited funding: %p', + async (...inputs) => { + fetchUtxos.mockResolvedValue(inputs); + await expect( + sdk.getEstimateSysTransactionFee(request) + ).rejects.toMatchObject({ error: true }); + } + ); + + it('rejects an oversized sweep instead of returning a partial quote', async () => { + fetchUtxos.mockResolvedValue( + Array.from({ length: 1500 }, (_, i) => utxo('10000', i + 1)) + ); + await expect( + sdk.getEstimateSysTransactionFee(request) + ).rejects.toMatchObject({ error: true }); + }); + + it('sums large atomic strings without rounding the gross through Number', async () => { + fetchUtxos.mockResolvedValue([ + utxo('4503599627370496'), + utxo('4503599627370497', 2), + ]); + const quote = await sdk.getEstimateSysTransactionFee(request); + expect(quote.grossAmount).toBe('90071992.54740993'); + expect(quote.recipientAmount).toBe('90071992.54740631'); + expect(create.mock.calls[0][2][0].value.toString()).toBe( + '9007199254740993' + ); + }); + + it('fails closed when an individual input exceeds the existing builder numeric limit', async () => { + fetchUtxos.mockResolvedValue([utxo('9007199254740993')]); + await expect( + sdk.getEstimateSysTransactionFee(request) + ).rejects.toMatchObject({ error: true }); + }); + + it('rejects a quote fee inconsistent with the returned recipient value', async () => { + create.mockImplementationOnce(async (...args) => { + const result = + await syscoinjs.SyscoinJSLib.prototype.createTransaction.apply( + main, + args + ); + return { ...result, fee: result.fee + 1 }; + }); + await expect( + sdk.getEstimateSysTransactionFee(request) + ).rejects.toMatchObject({ code: 'INCOMPLETE_NATIVE_SWEEP' }); + }); + + it('rejects a builder result which omits a requested funding outpoint', async () => { + fetchUtxos.mockResolvedValue([utxo(), utxo('1000000', 2)]); + create.mockResolvedValue({ psbt: { txInputs: [], txOutputs: [] }, fee: 1 }); + await expect( + sdk.getEstimateSysTransactionFee(request) + ).rejects.toMatchObject({ code: 'INCOMPLETE_NATIVE_SWEEP' }); + }); +}); diff --git a/packages/sysweb3-keyring/test/unit/transactions/prepared-bip84.spec.ts b/packages/sysweb3-keyring/test/unit/transactions/prepared-bip84.spec.ts new file mode 100644 index 00000000..07557469 --- /dev/null +++ b/packages/sysweb3-keyring/test/unit/transactions/prepared-bip84.spec.ts @@ -0,0 +1,322 @@ +import ecc from '@bitcoinerlab/secp256k1'; +import { BIP32Factory, BIP32Interface } from 'bip32'; +import { Psbt, Transaction, script } from 'bitcoinjs-lib'; + +import { + deriveBip84PublicAddress, + parseBip84PublicAccount, +} from '../../../src/public-bip84'; +import { + prepareBip84NativeTransaction, + validateBip84NativePlan, + Bip84NativePlan, +} from '../../../src/transactions/bip84-native-plan'; +import { + signValidatedBip84Plan, + snapshotPreparedBip84Request, +} from '../../../src/transactions/prepared-bip84'; + +const bip32 = BIP32Factory(ecc); +const noop = () => undefined; +function fixture(count = 2, fee = 1000, rate = '1000') { + const accountNode = bip32 + .fromSeed(Buffer.alloc(32, 7)) + .derivePath("m/84'/0'/2'"); + const account = parseBip84PublicAccount({ + network: 'bitcoin', + accountKey: accountNode.neutered().toBase58(), + }); + const parent = new Transaction(); + parent.version = 2; + parent.addInput(Buffer.alloc(32, 5), 0); + const inputs = Array.from({ length: count }, (_, i) => { + const branch = (i % 2) as 0 | 1, + index = i + 3; + const derived = deriveBip84PublicAddress({ + network: 'bitcoin', + accountKey: account.canonicalKey, + branch, + index, + }); + parent.addOutput(Buffer.from(derived.scriptPubKey, 'hex'), 100_000n); + return { branch, index }; + }); + const plan: Bip84NativePlan = { + network: { network: 'bitcoin', endpoint: 'https://offline.invalid' }, + account, + inputs: inputs.map((path, vout) => ({ + txid: parent.getId(), + vout, + ...path, + })), + previousTransactions: [ + { txid: parent.getId(), rawTransaction: parent.toHex() }, + ], + recipient: { + address: deriveBip84PublicAddress({ + network: 'bitcoin', + accountKey: account.canonicalKey, + branch: 0, + index: 11, + }).address, + valueSatoshis: String(count * 100_000 - fee), + }, + change: null, + locktime: 0, + rbf: true, + feeLimits: { maxFeeSatoshis: String(fee), maxFeeRateSatPerVByte: rate }, + }; + return { accountNode, plan, validated: () => validateBip84NativePlan(plan) }; +} +afterEach(() => jest.restoreAllMocks()); + +it('checks exact unsigned bytes, independently verifiable complete witnesses and final fee', () => { + const f = fixture(); + const result = signValidatedBip84Plan(f.validated(), f.accountNode, noop); + const tx = Transaction.fromHex(result.rawTransaction); + const unsigned = tx.clone(); + unsigned.stripWitnesses(); + expect(unsigned.toHex()).toBe( + prepareBip84NativeTransaction(f.plan).unsignedTransaction + ); + expect(result.txid).toBe(tx.getId()); + expect(result.wtxid).toBe( + Buffer.from(tx.getHash(true)).reverse().toString('hex') + ); + expect(result.virtualSize).toBe(tx.virtualSize()); + expect(result.feeSatoshis).toBe('1000'); + expect(Object.isFrozen(result)).toBe(true); + for (const [i, input] of tx.ins.entries()) { + expect(input.script.length).toBe(0); + expect(input.witness).toHaveLength(2); + const path = f.plan.inputs[i], + child = f.accountNode.derive(path.branch).derive(path.index); + expect(Buffer.from(input.witness[1])).toEqual(Buffer.from(child.publicKey)); + const sig = script.signature.decode(input.witness[0]); + expect(sig.hashType).toBe(Transaction.SIGHASH_ALL); + } +}); + +it.each(['high-s', 'wrong-key', 'none', 'extra'] as const)( + 'rejects malicious partial signature: %s', + (kind) => { + const f = fixture(), + original = Psbt.prototype.signInput; + jest + .spyOn(Psbt.prototype, 'signInput') + .mockImplementation(function (this: Psbt, i, key, hashTypes) { + const result = original.call(this, i, key, hashTypes), + partial = this.data.inputs[i].partialSig![0]; + const decoded = script.signature.decode(partial.signature); + if (kind === 'high-s') { + const n = + 0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n; + const s = BigInt( + '0x' + Buffer.from(decoded.signature.subarray(32)).toString('hex') + ); + decoded.signature.set( + Buffer.from((n - s).toString(16).padStart(64, '0'), 'hex'), + 32 + ); + partial.signature = script.signature.encode( + decoded.signature, + Transaction.SIGHASH_ALL + ); + } else if (kind === 'none') + partial.signature = script.signature.encode( + decoded.signature, + Transaction.SIGHASH_NONE + ); + else if (kind === 'wrong-key') + partial.pubkey = Uint8Array.from(f.accountNode.publicKey); + else this.data.inputs[i].partialSig!.push({ ...partial }); + return result; + }); + expect(() => + signValidatedBip84Plan(f.validated(), f.accountNode, noop) + ).toThrow('SIGNATURE_INVALID'); + } +); + +it.each(['incomplete', 'throw'] as const)( + 'rejects %s finalization without partial success', + (kind) => { + const f = fixture(), + original = Psbt.prototype.finalizeInput; + jest + .spyOn(Psbt.prototype, 'finalizeInput') + .mockImplementation(function (this: Psbt, i, ...rest) { + if (i === 1) { + if (kind === 'throw') throw Error('sensitive unexpected finalizer'); + return this; + } + return original.call(this, i, ...rest); + }); + expect(() => + signValidatedBip84Plan(f.validated(), f.accountNode, noop) + ).toThrow('SIGNATURE_INVALID'); + } +); + +it.each([ + 'witness-key', + 'witness-extra', + 'witness-signature', + 'script-sig', + 'output', + 'sequence', +] as const)('independently rejects modified extracted %s', (kind) => { + const f = fixture(), + original = Psbt.prototype.extractTransaction; + jest + .spyOn(Psbt.prototype, 'extractTransaction') + .mockImplementation(function (this: Psbt, ...args) { + const tx = original.apply(this, args).clone(); + if (kind === 'witness-key') + tx.ins[1].witness[1] = Uint8Array.from(f.accountNode.publicKey); + else if (kind === 'witness-extra') + tx.ins[1].witness.push(new Uint8Array(1)); + else if (kind === 'witness-signature') + tx.ins[1].witness[0] = Uint8Array.from(tx.ins[0].witness[0]); + else if (kind === 'script-sig') tx.ins[1].script = Uint8Array.from([0]); + else if (kind === 'output') tx.outs[0].value++; + else tx.ins[1].sequence--; + return tx; + }); + expect(() => + signValidatedBip84Plan(f.validated(), f.accountNode, noop) + ).toThrow('SIGNATURE_INVALID'); +}); + +it('rejects a forged prepared unsigned or fee field before obtaining any signing key', () => { + const f = fixture(), + prepared = prepareBip84NativeTransaction(f.plan), + account = { + type: 'HDAccount' as const, + index: 2, + expectedAccountKey: f.plan.account.canonicalKey, + }; + for (const change of [ + { feeSatoshis: '999' }, + { unsignedTransaction: prepared.unsignedTransaction + '00' }, + ]) + expect(() => + snapshotPreparedBip84Request({ + account, + prepared: { ...prepared, ...change }, + }) + ).toThrow('INVALID_REQUEST'); + expect(() => + snapshotPreparedBip84Request({ + account: { ...account, index: 3 }, + prepared, + }) + ).toThrow('ACCOUNT_MISMATCH'); + const getter = jest.fn(() => prepared); + const input = Object.defineProperty({ account }, 'prepared', { + enumerable: true, + get: getter, + }); + expect(() => snapshotPreparedBip84Request(input)).toThrow('INVALID_REQUEST'); + expect(getter).not.toHaveBeenCalled(); +}); + +it('enforces exact actual-vsize rate boundary and plus one after the maximum-size planning filter', () => { + let exact: number | undefined; + let plusOne: number | undefined; + for (let fee = 306; fee <= 318; fee++) { + const f = fixture(4, fee); + const validated = f.validated(); + const maximum = Transaction.fromHex(validated.prepared.unsignedTransaction); + maximum.ins.forEach((_, i) => + maximum.setWitness(i, [new Uint8Array(73), new Uint8Array(33)]) + ); + const actual = signValidatedBip84Plan( + validated, + f.accountNode, + noop + ).virtualSize; + if (fee === actual) exact = fee; + if (fee === actual + 1 && fee <= maximum.virtualSize()) plusOne = fee; + } + expect(exact).toBeDefined(); + expect(plusOne).toBeDefined(); + const accepted = fixture(4, exact!, '1'); + const signed = signValidatedBip84Plan( + accepted.validated(), + accepted.accountNode, + noop + ); + expect(Number(signed.feeSatoshis)).toBe(signed.virtualSize); + const rejected = fixture(4, plusOne!, '1'); + expect(() => + signValidatedBip84Plan(rejected.validated(), rejected.accountNode, noop) + ).toThrow('FEE_LIMIT'); +}); + +it('does not use SJS fee getters as the returned fee authority', () => { + const f = fixture(); + const calculate = Psbt.prototype.getFeeRate; + jest.spyOn(Psbt.prototype, 'getFee').mockReturnValue(-1n); + jest + .spyOn(Psbt.prototype, 'getFeeRate') + .mockImplementation(function (this: Psbt) { + calculate.call(this); // The library still initializes its extraction cache. + return -1; // Its reported rate is not our returned fee authority. + }); + expect( + signValidatedBip84Plan(f.validated(), f.accountNode, noop).feeSatoshis + ).toBe('1000'); +}); + +it.each(['branch', 'child'] as const)( + 'rejects a BIP32 retry that changes the requested %s index', + (kind) => { + const f = fixture(), + derive = f.accountNode.derive.bind(f.accountNode); + jest.spyOn(f.accountNode, 'derive').mockImplementation((i) => { + const branch = derive(kind === 'branch' ? i + 1 : i); + if (kind === 'child') { + const child = branch.derive.bind(branch); + jest.spyOn(branch, 'derive').mockImplementation((j) => child(j + 1)); + } + return branch; + }); + expect(() => + signValidatedBip84Plan(f.validated(), f.accountNode, noop) + ).toThrow('ACCOUNT_MISMATCH'); + } +); + +it.each(['success', 'failure'] as const)( + 'clears all owned branch/child scalar buffers on %s', + (kind) => { + const f = fixture(), + owned: BIP32Interface[] = [], + derive = f.accountNode.derive.bind(f.accountNode); + jest.spyOn(f.accountNode, 'derive').mockImplementation((i) => { + const branch = derive(i); + owned.push(branch); + const child = branch.derive.bind(branch); + jest.spyOn(branch, 'derive').mockImplementation((j) => { + const value = child(j); + owned.push(value); + return value; + }); + return branch; + }); + if (kind === 'failure') + jest.spyOn(Psbt.prototype, 'finalizeInput').mockImplementation(() => { + throw Error('failure'); + }); + try { + signValidatedBip84Plan(f.validated(), f.accountNode, noop); + } catch (error) { + if (kind === 'success') throw error; + } + expect(owned.length).toBeGreaterThan(1); + for (const node of owned) + expect(node.privateKey!.every((b) => b === 0)).toBe(true); + expect(f.accountNode.privateKey!.some((b) => b !== 0)).toBe(true); + } +); diff --git a/packages/sysweb3-keyring/test/unit/transactions/prepared-evm.spec.ts b/packages/sysweb3-keyring/test/unit/transactions/prepared-evm.spec.ts new file mode 100644 index 00000000..cb3b3b55 --- /dev/null +++ b/packages/sysweb3-keyring/test/unit/transactions/prepared-evm.spec.ts @@ -0,0 +1,500 @@ +import ecc from '@bitcoinerlab/secp256k1'; +import { keccak256 } from 'ethers/crypto'; +import { HDNodeWallet, Wallet } from 'ethers/wallet'; +import { Transaction } from 'ethers/transaction'; + +import { + SoftwareKeyring, + createSoftwareKeyringHost, + INetworkType, + KeyringAccountType, +} from '../../../src/software'; +import { snapshotPreparedEvmRequest } from '../../../src/transactions/prepared-evm'; +import type { PreparedSoftwareEvmSigningRequest } from '../../../src/software'; + +const PHRASE = + 'abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about'; +const PASSWORD = 'public prepared transaction fixture'; +const ADDRESS = '0x9858EfFD232B4033E47d90003D41EC34EcaEda94'; +const RECIPIENT = '0x1111111111111111111111111111111111111111'; +const URL = 'https://offline.invalid'; +const referenceWallet = HDNodeWallet.fromPhrase( + PHRASE, + undefined, + "m/44'/60'/0'/0/0" +); + +function request(type: 0 | 2 = 2): PreparedSoftwareEvmSigningRequest { + return { + account: { id: 0, type: 'HDAccount', expectedAddress: ADDRESS }, + network: { kind: 'ethereum', chainId: '1', slip44: 60, url: URL }, + transaction: { + type, + from: ADDRESS, + to: RECIPIENT, + chainId: '1', + nonce: '7', + value: '1000000000000000000', + gasLimit: '21000', + data: '0x', + ...(type === 0 + ? { gasPrice: '20000000000' } + : { maxFeePerGas: '30000000000', maxPriorityFeePerGas: '1000000000' }), + } as any, + }; +} + +function fixtureState() { + return { + activeAccount: { id: 0, type: KeyringAccountType.HDAccount }, + activeNetwork: { + kind: INetworkType.Ethereum, + chainId: 1, + slip44: 60, + label: 'Ethereum', + currency: 'ETH', + url: URL, + }, + accounts: { + HDAccount: {}, + Imported: {}, + Ledger: {}, + Trezor: {}, + SmartAccount: {}, + }, + } as any; +} + +const mutations: Array<[string, (input: any) => void]> = [ + ['missing nonce', (v) => delete v.transaction.nonce], + ['numeric nonce', (v) => (v.transaction.nonce = 7)], + ['negative nonce', (v) => (v.transaction.nonce = '-1')], + ['fractional nonce', (v) => (v.transaction.nonce = '0.5')], + ['unsafe nonce', (v) => (v.transaction.nonce = '9007199254740992')], + ['noncanonical decimal', (v) => (v.transaction.value = '01')], + ['hexadecimal value', (v) => (v.transaction.value = '0x10')], + ['oversized value', (v) => (v.transaction.value = (1n << 256n).toString())], + [ + 'fee plus value overflow', + (v) => (v.transaction.value = ((1n << 256n) - 1n).toString()), + ], + ['missing gas', (v) => delete v.transaction.gasLimit], + ['zero gas', (v) => (v.transaction.gasLimit = '0')], + ['oversized gas', (v) => (v.transaction.gasLimit = (1n << 64n).toString())], + ['missing fee', (v) => delete v.transaction.maxFeePerGas], + [ + 'priority above maximum', + (v) => (v.transaction.maxPriorityFeePerGas = '30000000001'), + ], + ['mixed fees', (v) => (v.transaction.gasPrice = '1')], + ['unsupported type', (v) => (v.transaction.type = 4)], + ['string type', (v) => (v.transaction.type = '2')], + ['missing type', (v) => delete v.transaction.type], + ['unknown transaction field', (v) => (v.transaction.accessList = [])], + ['unknown root field', (v) => (v.extra = true)], + ['contract creation', (v) => (v.transaction.to = null)], + ['ENS recipient', (v) => (v.transaction.to = 'alice.eth')], + ['zero recipient', (v) => (v.transaction.to = '0x' + '0'.repeat(40))], + [ + 'invalid checksum', + (v) => (v.transaction.from = '0x9858EFFD232B4033E47d90003D41EC34EcaEda94'), + ], + ['wrong sender', (v) => (v.transaction.from = RECIPIENT)], + ['mismatched chain', (v) => (v.transaction.chainId = '2')], + [ + 'zero chain', + (v) => { + v.transaction.chainId = '0'; + v.network.chainId = '0'; + }, + ], + ['unknown network field', (v) => (v.network.privateKey = 'not permitted')], + ['wrong network family', (v) => (v.network.kind = 'syscoin')], + ['wrong slip44', (v) => (v.network.slip44 = 57)], + ['blank endpoint', (v) => (v.network.url = '')], + ['control in endpoint', (v) => (v.network.url += String.fromCharCode(0))], + ['oversized endpoint', (v) => (v.network.url = 'x'.repeat(4097))], + ['negative account id', (v) => (v.account.id = -1)], + ['hardware account type', (v) => (v.account.type = 'Ledger')], + ['odd hex data', (v) => (v.transaction.data = '0x1')], + ['non-hex data', (v) => (v.transaction.data = '0xgg')], + ['unprefixed data', (v) => (v.transaction.data = 'abcd')], + ['oversized data', (v) => (v.transaction.data = '0x' + 'ab'.repeat(16385))], +]; + +it.each(mutations)('rejects %s before signing', (_name, mutate) => { + const input = request(); + mutate(input); + expect(() => snapshotPreparedEvmRequest(input)).toThrow(); +}); + +it('rejects accessors, prototypes, symbols and nonenumerable fields without invoking getters', () => { + const accessor = request(); + const getter = jest.fn(); + Object.defineProperty(accessor.transaction, 'nonce', { + get: getter, + enumerable: true, + }); + expect(() => snapshotPreparedEvmRequest(accessor)).toThrow(); + expect(getter).not.toHaveBeenCalled(); + const symbol = request() as any; + symbol[Symbol('hidden')] = true; + expect(() => snapshotPreparedEvmRequest(symbol)).toThrow(); + const hidden = request(); + Object.defineProperty(hidden.transaction, 'nonce', { + value: '7', + enumerable: false, + }); + expect(() => snapshotPreparedEvmRequest(hidden)).toThrow(); + const prototype = request(); + Object.setPrototypeOf(prototype.transaction, { extra: true }); + expect(() => snapshotPreparedEvmRequest(prototype)).toThrow(); +}); + +it('normalizes and detaches the complete admitted request at the maximum calldata size', () => { + const input = request() as any; + input.account.expectedAddress = ADDRESS.toLowerCase(); + input.transaction.from = ADDRESS.toLowerCase(); + input.transaction.data = '0x' + 'AB'.repeat(16384); + const copy = snapshotPreparedEvmRequest(input); + input.transaction.nonce = '8'; + input.account.id = 1; + expect(copy.transaction.nonce).toBe('7'); + expect(copy.account.id).toBe(0); + expect(copy.transaction.from).toBe(ADDRESS); + expect(copy.transaction.data).toBe('0x' + 'ab'.repeat(16384)); + expect(Object.isFrozen(copy)).toBe(true); + expect(Object.isFrozen(copy.transaction)).toBe(true); + expect(Object.isFrozen(copy.account)).toBe(true); + expect(Object.isFrozen(copy.network)).toBe(true); +}); + +describe('software-only prepared signing authority', () => { + let keyring: SoftwareKeyring; + let state: any; + let sign: jest.SpyInstance; + let provider: jest.SpyInstance; + let fetch: jest.SpyInstance; + let guard: jest.Mock; + beforeEach(async () => { + const values = new Map(); + const storage = { + async get(key: string) { + return values.get(key); + }, + async set(key: string, value: unknown) { + values.set(key, value); + }, + async deleteItem(key: string) { + values.delete(key); + }, + async createManyIfAbsent(items: Record) { + if (Object.keys(items).some((key) => values.has(key))) return false; + Object.entries(items).forEach(([key, value]) => values.set(key, value)); + return true; + }, + }; + state = fixtureState(); + keyring = new SoftwareKeyring(createSoftwareKeyringHost(storage)); + keyring.setVaultStateGetter(() => state); + state.accounts.HDAccount[0] = await keyring.initializeWalletSecurely( + PHRASE, + PASSWORD + ); + expect(state.accounts.HDAccount[0].address).toBe(ADDRESS); + sign = jest.spyOn(ecc, 'signRecoverable'); + provider = jest + .spyOn(keyring.ethereumTransaction, 'web3Provider', 'get') + .mockImplementation(() => { + throw new Error('No provider access allowed'); + }); + fetch = jest + .spyOn(globalThis, 'fetch') + .mockRejectedValue(new Error('No network allowed')); + guard = jest.fn(); + }); + afterEach(async () => { + await keyring.destroy(); + jest.restoreAllMocks(); + }); + + it.each([0, 2] as const)( + 'signs a complete type %i envelope matching the independent wallet', + async (type) => { + const input = request(type); + const result = keyring.signPreparedEvmTransaction(input, { + assertCurrent: guard, + }); + const reference = await referenceWallet.signTransaction({ + ...input.transaction, + nonce: 7, + }); + expect(result.rawTransaction).toBe(reference); + const decoded = Transaction.from(result.rawTransaction); + expect(decoded.from).toBe(ADDRESS); + expect(decoded.to).toBe(RECIPIENT); + expect(decoded.value.toString()).toBe(input.transaction.value); + expect(result.hash).toBe(keccak256(reference)); + expect(result.unsignedHash).toBe(decoded.unsignedHash); + expect(result.transaction).toEqual(input.transaction); + expect(Object.isFrozen(result)).toBe(true); + expect(sign).toHaveBeenCalledTimes(1); + expect(provider).not.toHaveBeenCalled(); + expect(fetch).not.toHaveBeenCalled(); + expect(guard).toHaveBeenCalledTimes(2); + } + ); + + it('accepts a historically lowercase stored public address and returns checksummed identity', () => { + state.accounts.HDAccount[0].address = ADDRESS.toLowerCase(); + const input = request() as any; + input.account.expectedAddress = ADDRESS.toLowerCase(); + input.transaction.from = ADDRESS.toLowerCase(); + const result = keyring.signPreparedEvmTransaction(input, { + assertCurrent: guard, + }); + expect(result.from).toBe(ADDRESS); + expect(result.transaction.from).toBe(ADDRESS); + expect(fetch).not.toHaveBeenCalled(); + }); + + it('signs an imported software account without exposing its key', async () => { + const wallet = new Wallet( + '0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef' + ); + const account = await keyring.importAccount(wallet.privateKey); + state.accounts.Imported[account.id] = account; + state.activeAccount = { type: KeyringAccountType.Imported, id: account.id }; + const input = request() as any; + input.account = { + id: account.id, + type: 'Imported', + expectedAddress: account.address, + }; + input.transaction.from = account.address; + const result = keyring.signPreparedEvmTransaction(input, { + assertCurrent: guard, + }); + expect(result.from).toBe(wallet.address); + expect(JSON.stringify(result)).not.toContain(wallet.privateKey.slice(2)); + expect(fetch).not.toHaveBeenCalled(); + }); + + it('freezes the requested transaction before a host callback can replace its values or guard', () => { + const input = request() as any; + const options = { assertCurrent: guard }; + guard.mockImplementation(() => { + input.transaction.to = ADDRESS; + input.transaction.value = '2'; + options.assertCurrent = jest.fn(); + }); + const result = keyring.signPreparedEvmTransaction(input, options); + expect(Transaction.from(result.rawTransaction).to).toBe(RECIPIENT); + expect(Transaction.from(result.rawTransaction).value.toString()).toBe( + '1000000000000000000' + ); + expect(guard).toHaveBeenCalledTimes(2); + expect(options.assertCurrent).not.toHaveBeenCalled(); + }); + + it.each(['lock', 'reset', 'network', 'endpoint', 'account', 'key'])( + 'rejects a reentrant %s before accessing a signing key', + (change) => { + guard.mockImplementationOnce(() => { + if (change === 'lock') void keyring.lockWallet(); + if (change === 'reset') keyring.logout(); + if (change === 'network') state.activeNetwork.chainId = 2; + if (change === 'endpoint') + state.activeNetwork.url = 'https://other.invalid'; + if (change === 'account') state.activeAccount.id = 1; + if (change === 'key') state.accounts.HDAccount[0].xprv = 'different'; + }); + expect(() => + keyring.signPreparedEvmTransaction(request(), { assertCurrent: guard }) + ).toThrow(); + expect(sign).not.toHaveBeenCalled(); + expect(provider).not.toHaveBeenCalled(); + } + ); + + it('withholds the signed result if lock occurs during signing', () => { + const original = sign.getMockImplementation()!; + sign.mockImplementationOnce((...args) => { + const value = original(...args); + void keyring.lockWallet(); + return value; + }); + expect(() => + keyring.signPreparedEvmTransaction(request(), { assertCurrent: guard }) + ).toThrow(); + expect(sign).toHaveBeenCalledTimes(1); + expect(fetch).not.toHaveBeenCalled(); + }); + + it.each(['network', 'account'])( + 'withholds the signed result if %s changes while signing', + (change) => { + const original = sign.getMockImplementation()!; + sign.mockImplementationOnce((...args) => { + const signature = original(...args); + if (change === 'network') state.activeNetwork.chainId = 2; + else state.activeAccount.id = 1; + return signature; + }); + expect(() => + keyring.signPreparedEvmTransaction(request(), { assertCurrent: guard }) + ).toThrow(); + expect(sign).toHaveBeenCalledTimes(1); + expect(fetch).not.toHaveBeenCalled(); + } + ); + + it('withholds a result when the final guard becomes asynchronous', async () => { + guard + .mockImplementationOnce(() => undefined) + .mockImplementationOnce(() => Promise.reject(new Error('Expired'))); + expect(() => + keyring.signPreparedEvmTransaction(request(), { assertCurrent: guard }) + ).toThrow('synchronously'); + await Promise.resolve(); + await Promise.resolve(); + expect(sign).toHaveBeenCalledTimes(1); + expect(fetch).not.toHaveBeenCalled(); + }); + + it('withholds the result if its final host admission fails', () => { + guard + .mockImplementationOnce(() => undefined) + .mockImplementationOnce(() => { + throw new Error('Review expired'); + }); + expect(() => + keyring.signPreparedEvmTransaction(request(), { assertCurrent: guard }) + ).toThrow('Review expired'); + expect(sign).toHaveBeenCalledTimes(1); + expect(fetch).not.toHaveBeenCalled(); + }); + + it('rejects the wrong expected address, endpoint, chain or account', () => { + const wrongAddress = request() as any; + wrongAddress.account.expectedAddress = RECIPIENT; + wrongAddress.transaction.from = RECIPIENT; + const wrongEndpoint = request() as any; + wrongEndpoint.network.url = 'https://other.invalid'; + const wrongChain = request() as any; + wrongChain.network.chainId = wrongChain.transaction.chainId = '2'; + const wrongAccount = request() as any; + wrongAccount.account.id = 1; + for (const input of [wrongAddress, wrongEndpoint, wrongChain, wrongAccount]) + expect(() => + keyring.signPreparedEvmTransaction(input, { assertCurrent: guard }) + ).toThrow(); + expect(sign).not.toHaveBeenCalled(); + expect(guard).not.toHaveBeenCalled(); + }); + + it.each(['isLedgerWallet', 'isTrezorWallet', 'isSmartAccount', 'watch-only'])( + 'rejects %s metadata without provider/device fallback', + (flag) => { + if (flag === 'watch-only') state.accounts.HDAccount[0].xprv = ''; + else state.accounts.HDAccount[0][flag] = true; + expect(() => + keyring.signPreparedEvmTransaction(request(), { assertCurrent: guard }) + ).toThrow(); + expect(sign).not.toHaveBeenCalled(); + expect(provider).not.toHaveBeenCalled(); + } + ); + + it.each([ + KeyringAccountType.Ledger, + KeyringAccountType.Trezor, + KeyringAccountType.SmartAccount, + ])( + 'rejects a selected %s account despite software-looking request data', + (type) => { + state.accounts[type][0] = { ...state.accounts.HDAccount[0] }; + state.activeAccount.type = type; + expect(() => + keyring.signPreparedEvmTransaction(request(), { assertCurrent: guard }) + ).toThrow(); + expect(sign).not.toHaveBeenCalled(); + expect(provider).not.toHaveBeenCalled(); + } + ); + + it.each([ + undefined, + null, + {}, + [], + { assertCurrent: false }, + { assertCurrent: () => true }, + ])('requires a synchronous void host guard: %p', (options) => { + expect(() => + keyring.signPreparedEvmTransaction(request(), options as any) + ).toThrow(); + expect(sign).not.toHaveBeenCalled(); + }); + + it('rejects and observes an asynchronous guard rejection', async () => { + expect(() => + keyring.signPreparedEvmTransaction(request(), { + assertCurrent: (() => Promise.reject(new Error('Denied'))) as any, + }) + ).toThrow(); + await Promise.resolve(); + await Promise.resolve(); + expect(sign).not.toHaveBeenCalled(); + }); + + it('rejects a corrupted signature that recovers another key', () => { + const other = new Wallet( + '0x2222222222222222222222222222222222222222222222222222222222222222' + ); + const original = sign.getMockImplementation()!; + sign.mockImplementationOnce((digest) => + original(digest, Buffer.from(other.privateKey.slice(2), 'hex')) + ); + expect(() => + keyring.signPreparedEvmTransaction(request(), { assertCurrent: guard }) + ).toThrow('does not match'); + expect(fetch).not.toHaveBeenCalled(); + }); + + it('rejects valid same-signer bytes for a different transaction', () => { + const signer = jest.requireActual( + '../../../src/transactions/evm-local-signer' + ); + const original = signer.signTransaction; + jest + .spyOn(signer, 'signTransaction') + .mockImplementationOnce((transaction: any, key: string) => + original({ ...transaction, value: 2n }, key) + ); + expect(() => + keyring.signPreparedEvmTransaction(request(), { assertCurrent: guard }) + ).toThrow('does not match'); + expect(fetch).not.toHaveBeenCalled(); + }); + + it('never returns a key/seed/private record or modifies a caller object', () => { + const input = request(); + const original = structuredClone(input); + const result = keyring.signPreparedEvmTransaction(input, { + assertCurrent: guard, + }); + expect(input).toEqual(original); + expect(Object.keys(result).sort()).toEqual([ + 'from', + 'hash', + 'rawTransaction', + 'transaction', + 'unsignedHash', + ]); + expect(JSON.stringify(result)).not.toContain(PHRASE); + expect(JSON.stringify(result)).not.toContain( + referenceWallet.privateKey.slice(2) + ); + }); +}); diff --git a/packages/sysweb3-keyring/test/unit/transactions/psbt-account-scope.spec.ts b/packages/sysweb3-keyring/test/unit/transactions/psbt-account-scope.spec.ts new file mode 100644 index 00000000..f9d0a170 --- /dev/null +++ b/packages/sysweb3-keyring/test/unit/transactions/psbt-account-scope.spec.ts @@ -0,0 +1,709 @@ +import { getNetworkConfig, INetworkType } from '@sidhujag/sysweb3-network'; +import { Psbt, Transaction, payments } from 'bitcoinjs-lib'; +import CryptoJS from 'crypto-js'; + +import { KeyringManager } from '../../../src/keyring-manager'; +import { SyscoinTransactions } from '../../../src/transactions/syscoin'; +import { KeyringAccountType } from '../../../src/types'; +import { PsbtUtils } from '../../../src/utils/psbt'; +import { assertPsbtAccountScope } from '../../../src/utils/psbt-account-scope'; + +jest.mock('../../../src/utils/blockbook-cache', () => ({ + fetchBackendAccountCached: jest.fn().mockResolvedValue({ tokens: [] }), +})); + +const network = { + kind: INetworkType.Syscoin, + chainId: 5700, + slip44: 1, + currency: 'tSYS', + url: 'https://offline.invalid', +} as any; +const config = getNetworkConfig(1, 'tSYS'); +const bitcoinNetwork = config.networks.testnet; +const fixture = () => { + const syscoinjs = jest.requireActual('syscoinjs-lib'); + const hd = new syscoinjs.utils.HDSigner( + 'abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about', + null, + true, + config.networks, + 1, + config.types.zPubType, + 84 + ); + hd.createAccountAtIndex(0, 84); + const root = hd.getRootNode(); + const paths = ["m/84'/1'/0'/0/0", "m/84'/1'/1'/0/0"]; + const children = paths.map((path) => root.derivePath(path)); + const account = { + id: 0, + address: payments.p2wpkh({ + pubkey: children[0].publicKey, + network: bitcoinNetwork, + }).address!, + xpub: hd.getAccountXpub(), + }; + const state = { + activeNetwork: network, + activeAccountId: 0, + activeAccountType: KeyringAccountType.HDAccount, + accounts: { + HDAccount: { 0: account }, + Imported: {}, + Ledger: {}, + Trezor: {}, + }, + }; + const makePsbt = (indices: number[], forgedAddress = false) => { + const previous = new Transaction(); + previous.addInput(Buffer.alloc(32), 0xffffffff); + children.forEach((child) => + previous.addOutput( + payments.p2wpkh({ pubkey: child.publicKey, network: bitcoinNetwork }) + .output!, + 100000n + ) + ); + const psbt = new Psbt({ network: bitcoinNetwork }); + indices.forEach((index) => { + psbt.addInput({ + hash: previous.getId(), + index, + nonWitnessUtxo: previous.toBuffer(), + bip32Derivation: [ + { + masterFingerprint: root.fingerprint, + path: paths[index], + pubkey: children[index].publicKey, + }, + ], + }); + if (forgedAddress) + psbt.addUnknownKeyValToInput(psbt.inputCount - 1, { + key: Buffer.from('address'), + value: Buffer.from(account.address), + }); + }); + psbt.addOutput({ + address: account.address, + value: BigInt(indices.length) * 100000n - 1000n, + }); + return psbt; + }; + const tx = new SyscoinTransactions( + () => ({ hd, main: {} }), + () => ({ main: {} }), + () => state, + jest.fn(), + {} as any, + {} as any + ); + return { tx, hd, state, account, makePsbt, root, children, paths }; +}; + +const multisigFixture = (type: string, sameWallet = false) => { + const base = fixture(); + const actual = jest.requireActual('syscoinjs-lib'); + const external = new actual.utils.HDSigner( + 'legal winner thank year wave sausage worth useful legal winner thank yellow', + null, + true, + config.networks, + 1, + config.types.zPubType, + 84 + ); + const cosignerRoot = sameWallet ? base.root : external.getRootNode(); + const cosignerPath = sameWallet ? base.paths[1] : "m/84'/1'/3'/1/5"; + const cosigner = cosignerRoot.derivePath(cosignerPath); + const multisig = payments.p2ms({ + m: 2, + pubkeys: [base.children[0].publicKey, cosigner.publicKey], + network: bitcoinNetwork, + }); + const witness = payments.p2wsh({ redeem: multisig, network: bitcoinNetwork }); + const payment = + type === 'p2wsh' + ? witness + : payments.p2sh({ + redeem: type === 'p2sh' ? multisig : witness, + network: bitcoinNetwork, + }); + const previous = new Transaction(); + previous.addInput(Buffer.alloc(32), 0xffffffff); + previous.addOutput(payment.output!, 100000n); + const psbt = new Psbt({ network: bitcoinNetwork }); + psbt.addInput({ + hash: previous.getId(), + index: 0, + nonWitnessUtxo: previous.toBuffer(), + ...(type === 'p2sh' + ? { redeemScript: multisig.output } + : { + witnessScript: multisig.output, + ...(type === 'p2sh-p2wsh' ? { redeemScript: witness.output } : {}), + }), + bip32Derivation: [ + { + masterFingerprint: base.root.fingerprint, + path: base.paths[0], + pubkey: base.children[0].publicKey, + }, + { + masterFingerprint: cosignerRoot.fingerprint, + path: cosignerPath, + pubkey: cosigner.publicKey, + }, + ], + }); + psbt.addOutput({ address: base.account.address, value: 99000n }); + return { ...base, psbt, cosigner, cosignerRoot }; +}; + +describe('PSBT approved-account boundary with the real HD signer', () => { + it.each(['p2wsh', 'p2sh-p2wsh', 'p2sh'])( + 'signs only the approved key in standard %s multisig', + async (type) => { + const { tx, psbt, children } = multisigFixture(type); + const signed = PsbtUtils.fromPali( + await tx.signPSBT({ psbt: PsbtUtils.toPali(psbt) }), + network + ); + expect(signed.data.inputs[0].partialSig).toHaveLength(1); + expect(Buffer.from(signed.data.inputs[0].partialSig![0].pubkey)).toEqual( + Buffer.from(children[0].publicKey) + ); + expect( + signed.validateSignaturesOfInput(0, (publicKey, hash, signature) => + require('@bitcoinerlab/secp256k1').verify(hash, publicKey, signature) + ) + ).toBe(true); + expect(signed.data.inputs[0].bip32Derivation).toHaveLength(2); + } + ); + + it('never signs another account of the same wallet in a shared multisig input', async () => { + const { tx, psbt, children, paths } = multisigFixture('p2wsh', true); + const signed = PsbtUtils.fromPali( + await tx.signPSBT({ psbt: PsbtUtils.toPali(psbt) }), + network + ); + expect(signed.data.inputs[0].partialSig).toHaveLength(1); + expect(Buffer.from(signed.data.inputs[0].partialSig![0].pubkey)).toEqual( + Buffer.from(children[0].publicKey) + ); + expect( + signed.data.inputs[0].bip32Derivation!.map((item) => item.path).sort() + ).toEqual([...paths].sort()); + }); + + it.each(['p2wsh', 'p2sh-p2wsh', 'p2sh'])( + 'preserves public metadata for a standard external %s cosigner', + async (type) => { + const { tx, psbt, cosignerRoot } = multisigFixture(type); + const signed = PsbtUtils.fromPali( + await tx.signPSBT({ psbt: PsbtUtils.toPali(psbt) }), + network + ); + signed.signInputHD(0, cosignerRoot); + signed.finalizeAllInputs(); + expect( + signed.data.inputs[0].finalScriptWitness || + signed.data.inputs[0].finalScriptSig + ).toBeDefined(); + } + ); + + it.each(['p2wsh', 'p2sh-p2wsh', 'p2sh'])( + 'preserves an existing external signature in %s multisig', + async (type) => { + const { tx, psbt, cosigner } = multisigFixture(type); + psbt.signInput(0, cosigner); + const externalSignature = Buffer.from( + psbt.data.inputs[0].partialSig![0].signature + ); + const signed = PsbtUtils.fromPali( + await tx.signPSBT({ psbt: PsbtUtils.toPali(psbt) }), + network + ); + const input = signed.data.inputs[0]; + expect( + Buffer.from(input.finalScriptWitness || input.finalScriptSig!).includes( + externalSignature + ) + ).toBe(true); + } + ); + + it('rejects a multisig derivation hint not actually committed by the spent script', async () => { + const { tx, psbt, cosigner } = multisigFixture('p2wsh'); + psbt.data.inputs[0].witnessScript = payments.p2ms({ + m: 1, + pubkeys: [cosigner.publicKey], + network: bitcoinNetwork, + }).output; + await expect(tx.signPSBT({ psbt: PsbtUtils.toPali(psbt) })).rejects.toThrow( + /approved account/ + ); + }); + + it('leaves a distinct multisig input with no approved-account key unsigned', async () => { + const { tx, psbt, cosigner, root } = multisigFixture('p2wsh'); + const other = root.derivePath("m/84'/1'/1'/0/0"); + const multisig = payments.p2ms({ + m: 2, + pubkeys: [cosigner.publicKey, other.publicKey], + network: bitcoinNetwork, + }); + const witness = payments.p2wsh({ + redeem: multisig, + network: bitcoinNetwork, + }); + const previous = new Transaction(); + previous.addInput(Buffer.alloc(32), 0xffffffff); + previous.addOutput(witness.output!, 100000n); + psbt.addInput({ + hash: previous.getId(), + index: 0, + nonWitnessUtxo: previous.toBuffer(), + witnessScript: multisig.output, + bip32Derivation: [ + { + masterFingerprint: root.fingerprint, + path: "m/84'/1'/1'/0/0", + pubkey: other.publicKey, + }, + ], + }); + const signed = PsbtUtils.fromPali( + await tx.signPSBT({ psbt: PsbtUtils.toPali(psbt) }), + network + ); + expect(signed.data.inputs[0].partialSig).toHaveLength(1); + expect(signed.data.inputs[1].partialSig).toBeUndefined(); + expect(signed.data.inputs[1].finalScriptWitness).toBeUndefined(); + expect(signed.data.inputs[1].bip32Derivation).toHaveLength(1); + }); + + it.each([ + ['another account without proprietary metadata', [1], false], + ['another account claiming the approved address', [1], true], + ])('rejects %s before any signature', async (_label, indices, forged) => { + const { tx, hd, makePsbt } = fixture(); + const sign = jest.spyOn(hd, 'sign'); + await expect( + tx.signPSBT({ + psbt: PsbtUtils.toPali( + makePsbt(indices as number[], forged as boolean) + ), + }) + ).rejects.toThrow(/approved account/); + expect(sign).not.toHaveBeenCalled(); + }); + + it.each([ + 'own account 1', + 'external key', + 'forged ownership hints', + 'no hints', + ])('signs only the approved input in a joint PSBT with %s', async (kind) => { + const { tx, hd, makePsbt, root, paths, children } = fixture(); + const psbt = makePsbt([0, 1]); + if (kind !== 'own account 1') { + const actual = jest.requireActual('syscoinjs-lib'); + const external = new actual.utils.HDSigner( + 'legal winner thank year wave sausage worth useful legal winner thank yellow', + null, + true, + config.networks, + 1, + config.types.zPubType, + 84 + ); + const externalRoot = external.getRootNode(); + const externalPath = "m/84'/1'/3'/1/5"; + const externalKey = externalRoot.derivePath(externalPath); + const previous = new Transaction(); + previous.addInput(Buffer.alloc(32), 0xffffffff); + previous.addOutput( + payments.p2wpkh({ + pubkey: externalKey.publicKey, + network: bitcoinNetwork, + }).output!, + 100000n + ); + const joint = makePsbt([0]); + joint.addInput({ + hash: previous.getId(), + index: 0, + nonWitnessUtxo: previous.toBuffer(), + ...(kind === 'no hints' + ? {} + : { + bip32Derivation: [ + { + masterFingerprint: + kind === 'forged ownership hints' + ? root.fingerprint + : externalRoot.fingerprint, + path: + kind === 'forged ownership hints' ? paths[0] : externalPath, + pubkey: + kind === 'forged ownership hints' + ? children[0].publicKey + : externalKey.publicKey, + }, + ], + }), + }); + // Keep bitcoinjs internals coherent by using the rebuilt joint PSBT. + return verifyJoint(joint); + } + return verifyJoint(psbt); + + async function verifyJoint(joint: Psbt) { + joint.addUnknownKeyValToInput(1, { + key: Buffer.from('path'), + value: Buffer.from(paths[1]), + }); + const originalSign = hd.sign.bind(hd); + let foreignHints: unknown; + jest.spyOn(hd, 'sign').mockImplementation(async (input) => { + foreignHints = { + bip32: input.data.inputs[1].bip32Derivation, + tap: input.data.inputs[1].tapBip32Derivation, + paths: (input.data.inputs[1].unknownKeyVals || []).filter( + (field) => Buffer.from(field.key).toString() === 'path' + ), + }; + return originalSign(input); + }); + const signed = PsbtUtils.fromPali( + await tx.signPSBT({ psbt: PsbtUtils.toPali(joint) }), + network + ); + expect(foreignHints).toEqual({ + bip32: undefined, + tap: undefined, + paths: [], + }); + expect(signed.data.inputs[0].finalScriptWitness).toBeDefined(); + expect(signed.data.inputs[1].finalScriptWitness).toBeUndefined(); + expect(signed.data.inputs[1].partialSig).toBeUndefined(); + expect( + signed.data.inputs[1].unknownKeyVals?.find( + (field) => Buffer.from(field.key).toString() === 'path' + ) + ).toBeDefined(); + } + }); + + it('allows an imported account node to sign only its own joint input', async () => { + const { root, account, makePsbt } = fixture(); + const psbt = makePsbt([0, 1]); + assertPsbtAccountScope(psbt, { + account, + accountId: 7, + accountType: KeyringAccountType.Imported, + network, + }); + expect(psbt.data.inputs[0].bip32Derivation![0].path).toBe('0/0'); + expect(psbt.data.inputs[1].bip32Derivation).toBeUndefined(); + const actual = jest.requireActual('syscoinjs-lib'); + await actual.utils.signWithKeyPair( + psbt, + root.derivePath("m/84'/1'/0'"), + bitcoinNetwork + ); + expect(psbt.data.inputs[0].finalScriptWitness).toBeDefined(); + expect(psbt.data.inputs[1].finalScriptWitness).toBeUndefined(); + expect(psbt.data.inputs[1].partialSig).toBeUndefined(); + }); + + it('still signs the approved account with the actual signer', async () => { + const { tx, makePsbt } = fixture(); + const signed = await tx.signPSBT({ psbt: PsbtUtils.toPali(makePsbt([0])) }); + expect( + PsbtUtils.fromPali(signed, network).data.inputs[0].finalScriptWitness + ).toBeDefined(); + }); + + it('does not trust a valid approved derivation paired with another input script', () => { + const { makePsbt, account, root, paths, children } = fixture(); + const psbt = makePsbt([1]); + psbt.data.inputs[0].bip32Derivation = [ + { + masterFingerprint: root.fingerprint, + path: paths[0], + pubkey: children[0].publicKey, + }, + ]; + expect(() => + assertPsbtAccountScope(psbt, { + account, + accountId: 0, + accountType: KeyringAccountType.HDAccount, + network, + }) + ).toThrow(/approved account/); + }); + + it('bounds the actual keyring signer root as well as its sign method', async () => { + const { hd, state, account, makePsbt, paths } = fixture(); + const keyring: any = new KeyringManager(); + keyring.sessionPassword = { isCleared: () => false }; + keyring.setVaultStateGetter(() => ({ + activeAccount: { id: 0, type: KeyringAccountType.HDAccount }, + accounts: state.accounts, + activeNetwork: network, + })); + keyring.createOnDemandUTXOSigner = () => hd; + const scoped = keyring.getSigner().hd; + expect(() => scoped.getRootNode().derivePath(paths[1])).toThrow( + /approved account/ + ); + const joint = await scoped.sign(makePsbt([0, 1])); + expect(joint.data.inputs[0].finalScriptWitness).toBeDefined(); + expect(joint.data.inputs[1].finalScriptWitness).toBeUndefined(); + expect(joint.data.inputs[1].partialSig).toBeUndefined(); + expect(joint.data.inputs[1].bip32Derivation).toBeUndefined(); + await expect(scoped.sign(makePsbt([0]))).resolves.toBeDefined(); + expect(account.address).toBeDefined(); + keyring.sessionPassword = null; + await keyring.destroy(); + }); + + it.each([KeyringAccountType.Ledger, KeyringAccountType.Trezor])( + 'accepts authenticated %s account paths and rejects another account', + (accountType) => { + const { makePsbt, account } = fixture(); + const scope = { account, accountId: 0, accountType, network }; + expect(() => assertPsbtAccountScope(makePsbt([0]), scope)).not.toThrow(); + expect(() => assertPsbtAccountScope(makePsbt([1], true), scope)).toThrow( + /approved account/ + ); + } + ); + + it('uses the selected Trezor account even if caller flags request software signing', async () => { + const { state, account, makePsbt } = fixture(); + state.activeAccountType = KeyringAccountType.Trezor; + (state.accounts as any).Trezor[0] = { ...account, isTrezorWallet: true }; + const trezor = { + convertToTrezorFormat: jest.fn(() => 'request'), + signUtxoTransaction: jest.fn(async (_request, psbt) => psbt), + }; + const getSigner = jest.fn(); + const tx = new SyscoinTransactions( + getSigner, + () => ({ main: {} }), + () => state, + jest.fn(), + {} as any, + trezor as any + ); + await expect( + tx.signPSBT({ psbt: PsbtUtils.toPali(makePsbt([0])), isTrezor: false }) + ).resolves.toBeDefined(); + expect(trezor.signUtxoTransaction).toHaveBeenCalledTimes(1); + expect(getSigner).not.toHaveBeenCalled(); + await expect( + tx.signPSBT({ psbt: PsbtUtils.toPali(makePsbt([1])), isTrezor: true }) + ).rejects.toThrow(/approved account/); + expect(trezor.signUtxoTransaction).toHaveBeenCalledTimes(1); + }); + + it('accepts an imported account-level key and normalizes only authenticated relative paths', async () => { + const { root, account, makePsbt } = fixture(); + const node = root.derivePath("m/84'/1'/0'"); + const psbt = makePsbt([0]); + const scope = { + account, + accountId: 7, + accountType: KeyringAccountType.Imported, + network, + }; + assertPsbtAccountScope(psbt, scope); + expect(psbt.data.inputs[0].bip32Derivation![0].path).toBe('0/0'); + const actual = jest.requireActual('syscoinjs-lib'); + await actual.utils.signWithKeyPair(psbt, node, bitcoinNetwork); + expect(psbt.data.inputs[0].finalScriptWitness).toBeDefined(); + }); + + it('permits a single-address imported key only for its actual output script', async () => { + const { account, makePsbt, children } = fixture(); + const imported = { ...account, xpub: account.address }; + const scope = { + account: imported, + accountId: 3, + accountType: KeyringAccountType.Imported, + network, + }; + expect(() => assertPsbtAccountScope(makePsbt([0]), scope)).not.toThrow(); + expect(() => assertPsbtAccountScope(makePsbt([1], true), scope)).toThrow( + /approved account/ + ); + expect(() => assertPsbtAccountScope(makePsbt([0, 1]), scope)).toThrow( + /approved account/ + ); + const keyring: any = new KeyringManager(); + const password = 'disposable-public-test-password'; + keyring.sessionPassword = { isCleared: () => false }; + keyring.setVaultStateGetter(() => ({ + activeAccount: { id: 3, type: KeyringAccountType.Imported }, + accounts: { + Imported: { + 3: { + ...imported, + xprv: CryptoJS.AES.encrypt( + children[0].toWIF(), + password + ).toString(), + }, + }, + }, + activeNetwork: network, + })); + keyring.withSecureData = (callback) => callback(password); + const signer = keyring.getSigner().hd; + await expect(signer.sign(makePsbt([1], true))).rejects.toThrow( + /approved account/ + ); + const signed = await signer.sign(makePsbt([0])); + expect(signed.data.inputs[0].finalScriptWitness).toBeDefined(); + keyring.sessionPassword = null; + await keyring.destroy(); + }); + + it.each([ + "m/84'/1'/1'/0/0", + "m/44'/1'/0'/0/0", + "m/84'/57'/0'/0/0", + "m/84'/1'/0'/2/0", + "m/84'/1'/0'/0/0'", + ])( + 'rejects an unauthenticated proprietary path %s even alongside valid derivation data', + (path) => { + const { makePsbt, account } = fixture(); + const psbt = makePsbt([0]); + psbt.addUnknownKeyValToInput(0, { + key: Buffer.from('path'), + value: Buffer.from(path), + }); + expect(() => + assertPsbtAccountScope(psbt, { + account, + accountId: 0, + accountType: KeyringAccountType.HDAccount, + network, + }) + ).toThrow(/approved account/); + } + ); + + it('preserves finalized co-signer inputs without signing them again', async () => { + const { tx, makePsbt, children } = fixture(); + const psbt = makePsbt([0, 1]); + psbt.signInput(1, children[1]); + psbt.finalizeInput(1); + const witness = Buffer.from(psbt.data.inputs[1].finalScriptWitness!); + // An attacker can reattach derivation hints to a finalized input. + psbt.addUnknownKeyValToInput(1, { + key: Buffer.from('path'), + value: Buffer.from("m/84'/1'/1'/0/0"), + }); + const signed = PsbtUtils.fromPali( + await tx.signPSBT({ psbt: PsbtUtils.toPali(psbt) }), + network + ); + expect(Buffer.from(signed.data.inputs[1].finalScriptWitness)).toEqual( + witness + ); + expect(signed.data.inputs[1].partialSig).toBeUndefined(); + expect(signed.data.inputs[0].finalScriptWitness).toBeDefined(); + }); + + it('preserves scope validation for a completely finalized PSBT', () => { + const { account, makePsbt, children } = fixture(); + const psbt = makePsbt([1]); + psbt.signInput(0, children[1]); + psbt.finalizeInput(0); + expect(() => + assertPsbtAccountScope(psbt, { + account, + accountId: 0, + accountType: KeyringAccountType.HDAccount, + network, + }) + ).not.toThrow(); + }); + + it('requires an authenticated owned input even when foreign hints are absent', async () => { + const { tx, makePsbt, hd } = fixture(); + const psbt = makePsbt([1]); + delete psbt.data.inputs[0].bip32Derivation; + const sign = jest.spyOn(hd, 'sign'); + await expect(tx.signPSBT({ psbt: PsbtUtils.toPali(psbt) })).rejects.toThrow( + /approved account/ + ); + expect(sign).not.toHaveBeenCalled(); + }); + + it('does not skip malformed previous-transaction data in a joint input', async () => { + const { tx, makePsbt, hd } = fixture(); + const psbt = makePsbt([0, 1]); + const wrong = Transaction.fromBuffer(psbt.data.inputs[1].nonWitnessUtxo!); + wrong.outs[0].value += 1n; + psbt.data.inputs[1].nonWitnessUtxo = wrong.toBuffer(); + const sign = jest.spyOn(hd, 'sign'); + await expect( + tx.signPSBT({ psbt: PsbtUtils.toPali(psbt) }) + ).rejects.toThrow(); + expect(sign).not.toHaveBeenCalled(); + }); + + it('validates 100 legitimate independent inputs within one bounded operation', () => { + const { root, account } = fixture(); + const previous = new Transaction(); + previous.addInput(Buffer.alloc(32), 0xffffffff); + const children = Array.from({ length: 100 }, (_, index) => + root.derivePath(`m/84'/1'/0'/0/${index}`) + ); + children.forEach((child) => + previous.addOutput( + payments.p2wpkh({ pubkey: child.publicKey, network: bitcoinNetwork }) + .output!, + 100000n + ) + ); + const psbt = new Psbt({ network: bitcoinNetwork }); + children.forEach((child, index) => + psbt.addInput({ + hash: previous.getId(), + index, + nonWitnessUtxo: previous.toBuffer(), + bip32Derivation: [ + { + masterFingerprint: root.fingerprint, + path: `m/84'/1'/0'/0/${index}`, + pubkey: child.publicKey, + }, + ], + }) + ); + psbt.addOutput({ address: account.address, value: 9999000n }); + const start = performance.now(); + assertPsbtAccountScope(psbt, { + account, + accountId: 0, + accountType: KeyringAccountType.HDAccount, + network, + }); + console.info( + `PSBT scope validation: 100 independent inputs in ${( + performance.now() - start + ).toFixed(1)} ms` + ); + }); +}); diff --git a/packages/sysweb3-keyring/test/unit/transactions/psbt-taproot-account-scope.spec.ts b/packages/sysweb3-keyring/test/unit/transactions/psbt-taproot-account-scope.spec.ts new file mode 100644 index 00000000..9bfeea6c --- /dev/null +++ b/packages/sysweb3-keyring/test/unit/transactions/psbt-taproot-account-scope.spec.ts @@ -0,0 +1,319 @@ +import { signSchnorr, verifySchnorr } from '@bitcoinerlab/secp256k1'; +import { getNetworkConfig, INetworkType } from '@sidhujag/sysweb3-network'; +import { opcodes, payments, Psbt, script, Transaction } from 'bitcoinjs-lib'; + +import { SyscoinTransactions } from '../../../src/transactions/syscoin'; +import { KeyringAccountType } from '../../../src/types'; +import { PsbtUtils } from '../../../src/utils/psbt'; + +jest.mock('../../../src/utils/blockbook-cache', () => ({ + fetchBackendAccountCached: jest.fn().mockResolvedValue({ tokens: [] }), +})); + +const network = { + kind: INetworkType.Syscoin, + chainId: 5700, + slip44: 1, + currency: 'tSYS', + url: 'https://offline.invalid', +} as any; +const config = getNetworkConfig(1, 'tSYS'); +const bitcoinNetwork = config.networks.testnet; +const approvedPath = "m/84'/1'/0'/0/0"; +const otherAccountPath = "m/84'/1'/1'/0/0"; +const merkleRoot = Buffer.alloc(32, 0x51); + +type InputOptions = { + bip371?: boolean; + internal?: boolean; + root?: Buffer; + otherAccount?: boolean; + forgedPath?: boolean; +}; + +const fixture = () => { + // The suite-wide HDSigner mock does not sign. Explicitly load the actual + // signer so these tests exercise the public API through real Schnorr signing. + const syscoinjs = jest.requireActual('syscoinjs-lib'); + const hd = new syscoinjs.utils.HDSigner( + 'abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about', + null, + true, + config.networks, + 1, + config.types.zPubType, + 84 + ); + hd.createAccountAtIndex(0, 84); + const root = hd.getRootNode(); + const approved = root.derivePath(approvedPath); + const otherAccount = root.derivePath(otherAccountPath); + const account = { + id: 0, + address: payments.p2wpkh({ + pubkey: approved.publicKey, + network: bitcoinNetwork, + }).address!, + xpub: hd.getAccountXpub(), + }; + const state = { + activeNetwork: network, + activeAccountId: 0, + activeAccountType: KeyringAccountType.HDAccount, + accounts: { + HDAccount: { 0: account }, + Imported: {}, + Ledger: {}, + Trezor: {}, + }, + }; + const tx = new SyscoinTransactions( + () => ({ hd, main: {} }), + () => ({ main: {} }), + () => state, + jest.fn(), + {} as any, + {} as any + ); + const makePsbt = (options: InputOptions[]) => { + const spent = options.map((option) => + payments.p2tr({ + internalPubkey: (option.otherAccount + ? otherAccount + : approved + ).publicKey.slice(1), + hash: option.root, + network: bitcoinNetwork, + }) + ); + const previous = new Transaction(); + previous.addInput(Buffer.alloc(32), 0xffffffff); + spent.forEach((payment) => previous.addOutput(payment.output!, 100000n)); + const psbt = new Psbt({ network: bitcoinNetwork }); + options.forEach((option, index) => { + const key = + option.otherAccount && !option.forgedPath ? otherAccount : approved; + const path = + option.otherAccount && !option.forgedPath + ? otherAccountPath + : approvedPath; + psbt.addInput({ + hash: previous.getId(), + index, + witnessUtxo: { script: spent[index].output!, value: 100000n }, + ...(option.bip371 + ? { + tapBip32Derivation: [ + { + masterFingerprint: root.fingerprint, + path, + pubkey: key.publicKey.slice(1), + leafHashes: [], + }, + ], + } + : {}), + ...(option.internal ? { tapInternalKey: key.publicKey.slice(1) } : {}), + ...(option.root ? { tapMerkleRoot: option.root } : {}), + }); + psbt.addUnknownKeyValToInput(index, { + key: Buffer.from('path'), + value: Buffer.from(path), + }); + }); + psbt.addOutput({ + address: account.address, + value: BigInt(options.length) * 100000n - 1000n, + }); + return { psbt, spent }; + }; + const sign = async (psbt: Psbt) => + PsbtUtils.fromPali( + await tx.signPSBT({ psbt: PsbtUtils.toPali(psbt) }), + network + ); + return { hd, sign, makePsbt, approved, otherAccount }; +}; + +const expectValidKeyPathSignature = ( + signed: Psbt, + spent: ReturnType[], + index = 0 +) => { + const witness = Buffer.from(signed.data.inputs[index].finalScriptWitness!); + // A default-sighash key-path spend has exactly one 64-byte witness item. + expect(witness[0]).toBe(1); + expect(witness[1]).toBe(64); + expect(witness).toHaveLength(66); + const transaction = Transaction.fromBuffer( + signed.data.globalMap.unsignedTx.toBuffer() + ); + const digest = transaction.hashForWitnessV1( + index, + spent.map((payment) => payment.output!), + spent.map(() => 100000n), + Transaction.SIGHASH_DEFAULT + ); + expect(verifySchnorr(digest, spent[index].pubkey!, witness.subarray(2))).toBe( + true + ); +}; + +describe('Taproot key-path PSBT approved-account boundary with the real HD signer', () => { + it.each<[string, InputOptions]>([ + ['a proprietary path without Taproot metadata', {}], + [ + 'a proprietary path and BIP371 derivation without an internal key', + { bip371: true }, + ], + [ + 'a known Merkle root without an internal key', + { bip371: true, root: merkleRoot }, + ], + ['an explicit internal key', { bip371: true, internal: true }], + [ + 'an explicit internal key and known Merkle root', + { bip371: true, internal: true, root: merkleRoot }, + ], + ])('signs %s', async (_label, options) => { + const { sign, makePsbt } = fixture(); + const { psbt, spent } = makePsbt([options]); + expect(Boolean(psbt.data.inputs[0].tapInternalKey)).toBe( + Boolean(options.internal) + ); + expect(psbt.data.inputs[0].tapLeafScript).toBeUndefined(); + expectValidKeyPathSignature(await sign(psbt), spent); + }); + + it.each([ + 'conflicting internal key', + 'forged approved path', + 'foreign account path', + 'wrong Merkle root', + ])('rejects a %s before invoking the private signer', async (kind) => { + const { hd, sign, makePsbt, otherAccount } = fixture(); + const { psbt } = makePsbt([ + kind === 'forged approved path' + ? { otherAccount: true, forgedPath: true, bip371: true } + : kind === 'foreign account path' + ? { otherAccount: true, bip371: true } + : { + bip371: true, + ...(kind === 'wrong Merkle root' ? { root: merkleRoot } : {}), + }, + ]); + if (kind === 'conflicting internal key') + psbt.data.inputs[0].tapInternalKey = otherAccount.publicKey.slice(1); + if (kind === 'wrong Merkle root') + psbt.data.inputs[0].tapMerkleRoot = Buffer.alloc(32, 0x52); + const privateSign = jest.spyOn(hd, 'sign'); + await expect(sign(psbt)).rejects.toThrow(/approved account/); + expect(privateSign).not.toHaveBeenCalled(); + }); + + it('does not infer an internal key for a PSBT carrying leaf-script metadata', async () => { + const { hd, sign, makePsbt, approved } = fixture(); + const leafScript = Buffer.from([0x51]); + const payment = payments.p2tr({ + internalPubkey: approved.publicKey.slice(1), + scriptTree: { output: leafScript }, + redeem: { output: leafScript, redeemVersion: 0xc0 }, + network: bitcoinNetwork, + }); + const { psbt } = makePsbt([ + { bip371: true, root: Buffer.from(payment.hash!) }, + ]); + psbt.data.inputs[0].tapLeafScript = [ + { + leafVersion: 0xc0, + script: leafScript, + controlBlock: payment.witness![payment.witness!.length - 1], + }, + ]; + expect(psbt.data.inputs[0].tapInternalKey).toBeUndefined(); + const privateSign = jest.spyOn(hd, 'sign'); + await expect(sign(psbt)).rejects.toThrow(/approved account/); + expect(privateSign).not.toHaveBeenCalled(); + }); + + it.each(['BIP371 leaf hashes', 'a script-path signature'])( + 'does not infer an internal key for a PSBT carrying %s without leaf scripts', + async (metadata) => { + const { hd, sign, makePsbt, approved } = fixture(); + const leafScript = script.compile([ + approved.publicKey.slice(1), + opcodes.OP_CHECKSIG, + ]); + const payment = payments.p2tr({ + internalPubkey: approved.publicKey.slice(1), + scriptTree: { output: leafScript }, + network: bitcoinNetwork, + }); + // A single-leaf tree root is that leaf's actual BIP341 hash. + const leafHash = Buffer.from(payment.hash!); + const { psbt, spent } = makePsbt([{ bip371: true, root: leafHash }]); + if (metadata === 'BIP371 leaf hashes') { + psbt.data.inputs[0].tapBip32Derivation![0].leafHashes = [leafHash]; + } else { + const transaction = Transaction.fromBuffer( + psbt.data.globalMap.unsignedTx.toBuffer() + ); + const digest = transaction.hashForWitnessV1( + 0, + spent.map((output) => output.output!), + [100000n], + Transaction.SIGHASH_DEFAULT, + leafHash + ); + const signature = signSchnorr(digest, approved.privateKey); + expect( + verifySchnorr(digest, approved.publicKey.slice(1), signature) + ).toBe(true); + psbt.data.inputs[0].tapScriptSig = [ + { pubkey: approved.publicKey.slice(1), leafHash, signature }, + ]; + } + expect(psbt.data.inputs[0].tapInternalKey).toBeUndefined(); + expect(psbt.data.inputs[0].tapLeafScript).toBeUndefined(); + const privateSign = jest.spyOn(hd, 'sign'); + await expect(sign(psbt)).rejects.toThrow(/approved account/); + expect(privateSign).not.toHaveBeenCalled(); + } + ); + + it.each([false, true])( + 'leaves a joint foreign Taproot input unsigned (forged path: %s)', + async (forgedPath) => { + const { hd, sign, makePsbt } = fixture(); + const { psbt, spent } = makePsbt([ + {}, + { otherAccount: true, forgedPath, bip371: true }, + ]); + const originalSign = hd.sign.bind(hd); + let foreignHints: unknown; + jest.spyOn(hd, 'sign').mockImplementation(async (input) => { + foreignHints = { + derivations: input.data.inputs[1].tapBip32Derivation, + paths: (input.data.inputs[1].unknownKeyVals || []).filter( + (field) => Buffer.from(field.key).toString() === 'path' + ), + }; + return originalSign(input); + }); + const signed = await sign(psbt); + expectValidKeyPathSignature(signed, spent); + expect(foreignHints).toEqual({ derivations: undefined, paths: [] }); + expect(signed.data.inputs[1].tapKeySig).toBeUndefined(); + expect(signed.data.inputs[1].tapScriptSig).toBeUndefined(); + expect(signed.data.inputs[1].partialSig).toBeUndefined(); + expect(signed.data.inputs[1].finalScriptSig).toBeUndefined(); + expect(signed.data.inputs[1].finalScriptWitness).toBeUndefined(); + expect(signed.data.inputs[1].tapBip32Derivation).toHaveLength(1); + expect( + signed.data.inputs[1].unknownKeyVals?.some( + (field) => Buffer.from(field.key).toString() === 'path' + ) + ).toBe(true); + } + ); +}); diff --git a/packages/sysweb3-keyring/test/unit/transactions/software-boundary.spec.ts b/packages/sysweb3-keyring/test/unit/transactions/software-boundary.spec.ts new file mode 100644 index 00000000..a7517d8f --- /dev/null +++ b/packages/sysweb3-keyring/test/unit/transactions/software-boundary.spec.ts @@ -0,0 +1,325 @@ +import { getNetworkConfig, INetworkType } from '@sidhujag/sysweb3-network'; +import { Psbt, Transaction, payments } from 'bitcoinjs-lib'; + +import { SyscoinTransactionsCore } from '../../../src/transactions/syscoin-core'; +import { KeyringAccountType } from '../../../src/types'; +import { PsbtUtils } from '../../../src/utils/psbt'; + +import type { ISyscoinHardwareSigners } from '../../../src/transactions/syscoin-core'; + +jest.mock('../../../src/utils/blockbook-cache', () => ({ + fetchBackendAccountCached: jest.fn().mockResolvedValue({ tokens: [] }), +})); + +const network = { + kind: INetworkType.Syscoin, + chainId: 5700, + slip44: 1, + currency: 'tSYS', + url: 'https://offline.invalid', +} as any; + +function fixture(hardware?: ISyscoinHardwareSigners) { + const syscoinjs = jest.requireActual('syscoinjs-lib'); + const config = getNetworkConfig(1, 'tSYS'); + const hd = new syscoinjs.utils.HDSigner( + 'abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about', + null, + true, + config.networks, + 1, + config.types.zPubType, + 84 + ); + hd.createAccountAtIndex(0, 84); + const root = hd.getRootNode(); + const path = "m/84'/1'/0'/0/0"; + const child = root.derivePath(path); + const payment = payments.p2wpkh({ + pubkey: child.publicKey, + network: config.networks.testnet, + }); + const account = { + id: 0, + address: payment.address!, + xpub: hd.getAccountXpub(), + }; + const state = { + activeNetwork: network, + activeAccountId: 0, + activeAccountType: KeyringAccountType.HDAccount, + accounts: { + HDAccount: { 0: account }, + Imported: {}, + Ledger: {}, + Trezor: {}, + } as any, + }; + const getSigner = jest.fn(() => ({ hd, main: {} })); + let generation = 0; + const capture = () => { + const atStart = generation; + return () => { + if (atStart !== generation) + throw new Error('Wallet signing context changed'); + }; + }; + const tx = new SyscoinTransactionsCore( + getSigner, + () => ({ main: {} }), + () => state, + jest.fn(), + hardware, + capture + ); + const makePsbt = () => { + const previous = new Transaction(); + previous.addInput(Buffer.alloc(32), 0xffffffff); + previous.addOutput(payment.output!, 100000n); + const psbt = new Psbt({ network: config.networks.testnet }); + psbt.addInput({ + hash: previous.getId(), + index: 0, + nonWitnessUtxo: previous.toBuffer(), + bip32Derivation: [ + { masterFingerprint: root.fingerprint, path, pubkey: child.publicKey }, + ], + }); + psbt.addOutput({ script: payment.output!, value: 99000n }); + return psbt; + }; + return { + tx, + state, + account, + child, + root, + getSigner, + makePsbt, + cycle: () => { + generation += 2; + }, + }; +} + +test('software core signs the existing authenticated HD PSBT without a hardware adapter', async () => { + const f = fixture(); + const result = await f.tx.signPSBT({ psbt: PsbtUtils.toPali(f.makePsbt()) }); + const signed = PsbtUtils.fromPali(result, network); + expect(signed.data.inputs[0].finalScriptWitness).toBeDefined(); + expect(f.getSigner).toHaveBeenCalledTimes(1); +}); + +test.each([KeyringAccountType.Ledger, KeyringAccountType.Trezor])( + 'missing %s adapter cannot fall through to the HD signer despite caller flags', + async (kind) => { + const f = fixture(); + f.state.activeAccountType = kind; + f.state.accounts[kind][0] = { ...f.account }; + await expect( + f.tx.signPSBT({ + psbt: PsbtUtils.toPali(f.makePsbt()), + isLedger: false, + isTrezor: false, + }) + ).rejects.toMatchObject({ code: 'HARDWARE_SIGNER_UNAVAILABLE' }); + expect(f.getSigner).not.toHaveBeenCalled(); + } +); + +test('hardware metadata on an otherwise software account cannot select a software fallback', async () => { + const f = fixture(); + f.state.accounts.HDAccount[0].isLedgerWallet = true; + await expect( + f.tx.signPSBT({ psbt: PsbtUtils.toPali(f.makePsbt()) }) + ).rejects.toMatchObject({ code: 'HARDWARE_SIGNER_UNAVAILABLE' }); + expect(f.getSigner).not.toHaveBeenCalled(); +}); + +test('hardware adapters cannot mutate wallet network or signing context snapshots', async () => { + const originalUrl = network.url; + const ledger: ISyscoinHardwareSigners['ledger'] = async (request) => { + expect(request.network).not.toBe(network); + expect(Object.isFrozen(request.network)).toBe(true); + expect(Object.isFrozen(request.scope)).toBe(true); + expect(Object.isFrozen(request.scope.account)).toBe(true); + expect(() => { + (request.network as any).url = 'https://attacker.invalid'; + }).toThrow(TypeError); + expect(() => { + (request.scope.network as any).url = 'https://attacker.invalid'; + }).toThrow(TypeError); + request.assertCurrent(); + return request.psbt; + }; + const f = fixture({ ledger }); + f.state.activeAccountType = KeyringAccountType.Ledger; + f.state.accounts.Ledger[0] = { ...f.account }; + await f.tx.signPSBT({ psbt: PsbtUtils.toPali(f.makePsbt()) }); + expect(f.state.activeNetwork.url).toBe(originalUrl); + expect(f.getSigner).not.toHaveBeenCalled(); +}); + +test('injected hardware completion is rejected after a session cycle', async () => { + let complete!: () => void; + let entered!: () => void; + const ready = new Promise((resolve) => { + entered = resolve; + }); + const wait = new Promise((resolve) => { + complete = resolve; + }); + const ledger = jest.fn(async ({ psbt }) => { + entered(); + await wait; + return psbt; + }); + const f = fixture({ ledger }); + f.state.activeAccountType = KeyringAccountType.Ledger; + f.state.accounts.Ledger[0] = { ...f.account, xprv: 'encrypted-test-secret' }; + const result = f.tx.signPSBT({ psbt: PsbtUtils.toPali(f.makePsbt()) }); + const rejected = expect(result).rejects.toThrow( + 'Wallet signing context changed' + ); + await ready; + f.cycle(); + complete(); + await rejected; + expect(ledger).toHaveBeenCalledTimes(1); + expect(ledger.mock.calls[0][0].account).toEqual({ + id: f.account.id, + xpub: f.account.xpub, + }); + expect(f.getSigner).not.toHaveBeenCalled(); +}); + +test.each([ + 'valid', + 'foreign-key', + 'wrong-transaction', + 'unexpected-sighash', + 'requested-sighash', +])( + 'semantic Ledger adapter validates returned signatures (%s)', + async (response) => { + // Exercise the public constructor through real PSBT conversion/finalization. + // Only physical device I/O is replaced with a deterministic signature fixture. + // eslint-disable-next-line @typescript-eslint/no-var-requires + const { + SyscoinTransactions, + } = require('../../../src/transactions/syscoin'); + const f = fixture(); + f.state.activeAccountType = KeyringAccountType.Ledger; + f.state.accounts.Ledger[0] = { ...f.account }; + const deviceSignature = f.makePsbt(); + if (response === 'wrong-transaction') deviceSignature.setLocktime(1); + if (response.endsWith('sighash')) { + deviceSignature.updateInput(0, { sighashType: Transaction.SIGHASH_NONE }); + deviceSignature.signInput(0, f.child, [Transaction.SIGHASH_NONE]); + } else { + deviceSignature.signInput(0, f.child); + } + const signature = deviceSignature.data.inputs[0].partialSig![0]; + const getRawTransaction = jest.fn(); + const signPsbt = jest.fn(async () => ({ + fingerprint: Buffer.from(f.root.fingerprint).toString('hex'), + signatures: [ + { + inputIndex: 0, + pubkeyHex: + response === 'foreign-key' + ? Buffer.alloc(33, 2).toString('hex') + : Buffer.from(signature.pubkey).toString('hex'), + signatureHex: Buffer.from(signature.signature).toString('hex'), + }, + ], + })); + const ledger = { signPsbt }; + const tx = new SyscoinTransactions( + f.getSigner, + () => ({ main: {} }), + () => f.state, + jest.fn(), + ledger, + undefined + ); + jest.spyOn(tx, 'txUtilsFunctions').mockReturnValue({ getRawTransaction }); + const approvedPsbt = f.makePsbt(); + if (response === 'requested-sighash') + approvedPsbt.updateInput(0, { sighashType: Transaction.SIGHASH_NONE }); + const pending = tx.signPSBT({ + psbt: PsbtUtils.toPali(approvedPsbt), + isLedger: false, + }); + if (response === 'foreign-key') { + await expect(pending).rejects.toThrow( + 'PSBT input is outside the approved account' + ); + } else if (response === 'wrong-transaction') { + await expect(pending).rejects.toThrow(/invalid.*signature/i); + } else if (response === 'unexpected-sighash') { + await expect(pending).rejects.toThrow(/sighash|signature/i); + } else { + const result = PsbtUtils.fromPali(await pending, network); + expect(result.data.inputs[0].finalScriptWitness).toBeDefined(); + } + expect(signPsbt).toHaveBeenCalledTimes(1); + expect(getRawTransaction).not.toHaveBeenCalled(); + expect(f.getSigner).not.toHaveBeenCalled(); + } +); + +test('software transaction entries do not import browser hardware or Ledger protocol adapters', () => { + const browserGlobals = ['window', 'document', 'self', 'chrome']; + const descriptors = browserGlobals.map((name) => + Object.getOwnPropertyDescriptor(globalThis, name) + ); + for (const name of browserGlobals) delete (globalThis as any)[name]; + jest.resetModules(); + const forbidden = [ + '../../../src/ledger', + '../../../src/ledger-host', + '../../../src/trezor', + '../../../src/hardware-wallet-manager', + '../../../src/hardware-wallet-manager-singleton', + '../../../src/ledger/bitcoin_client', + '../../../src/ledger/bitcoin_client/lib/policy', + '../../../src/ledger/bitcoin_client/lib/psbtv2', + '../../../src/transactions/hardware-psbt', + '@trezor/connect-web', + '@trezor/connect-webextension', + '@ledgerhq/hw-transport-webhid', + '@ledgerhq/device-management-kit', + '@ledgerhq/device-transport-kit-web-hid', + '@ledgerhq/device-signer-kit-ethereum', + '@ledgerhq/context-module', + ]; + for (const module of forbidden) + jest.doMock( + module, + () => { + throw new Error('Browser hardware imported'); + }, + { virtual: true } + ); + try { + jest.isolateModules(() => { + // Test the runtime graph rather than relying on erased type imports. + // eslint-disable-next-line @typescript-eslint/no-var-requires + expect( + require('../../../src/transactions/syscoin-core') + .SyscoinTransactionsCore + ).toBeDefined(); + // eslint-disable-next-line @typescript-eslint/no-var-requires + expect( + require('../../../src/transactions/ethereum').EthereumTransactions + ).toBeDefined(); + }); + } finally { + for (const module of forbidden) jest.dontMock(module); + browserGlobals.forEach((name, index) => { + const descriptor = descriptors[index]; + if (descriptor) Object.defineProperty(globalThis, name, descriptor); + }); + } +}); diff --git a/packages/sysweb3-keyring/test/unit/transactions/syscoin-transactions.spec.ts b/packages/sysweb3-keyring/test/unit/transactions/syscoin-transactions.spec.ts index 642181b9..3b60f126 100644 --- a/packages/sysweb3-keyring/test/unit/transactions/syscoin-transactions.spec.ts +++ b/packages/sysweb3-keyring/test/unit/transactions/syscoin-transactions.spec.ts @@ -1,17 +1,54 @@ +import { INetworkType } from '@sidhujag/sysweb3-network'; import * as sjs from 'syscoinjs-lib'; import { KeyringManager, KeyringAccountType } from '../../../src'; import { FAKE_PASSWORD, PEACE_SEED_PHRASE } from '../../helpers/constants'; -import { setupMocks } from '../../helpers/setup'; -import { INetworkType } from '@pollum-io/sysweb3-network'; +import { createFreshTestKeyring, setupMocks } from '../../helpers/setup'; describe('Syscoin Transactions', () => { let keyringManager: KeyringManager; let mockVaultStateGetter: jest.Mock; let currentVaultState: any; + // Use a real spent output and an authenticated path for the selected account. + // The signer and scope checks remain real; only network/transport wrappers are mocked. + const scopedPsbtFixture = () => { + const bitcoinjs = (sjs.utils as any).bitcoinjs; + const signer = (keyringManager as any).createOnDemandUTXOSigner(0); + const root = signer.getRootNode(); + const path = `m/84'/${currentVaultState.activeNetwork.slip44}'/0'/0/0`; + const child = root.derivePath(path); + const network = signer.Signer.network; + const payment = bitcoinjs.payments.p2wpkh({ + pubkey: child.publicKey, + network, + }); + const previous = new bitcoinjs.Transaction(); + previous.addInput(Buffer.alloc(32), 0xffffffff); + previous.addOutput(payment.output, 100000000n); + const psbt = new bitcoinjs.Psbt({ network }); + psbt.addInput({ + hash: previous.getId(), + index: 0, + nonWitnessUtxo: previous.toBuffer(), + bip32Derivation: [ + { masterFingerprint: root.fingerprint, path, pubkey: child.publicKey }, + ], + }); + psbt.addOutput({ script: payment.output, value: 99999000n }); + return psbt; + }; + beforeEach(async () => { setupMocks(); + // Keep real PSBT getters and signatures through the public return path. + // The shared mock spreads the object and loses prototype fields such as + // txInputs, so use the real HD signing method for these integration cases. + jest + .spyOn((sjs.utils as any).HDSigner.prototype, 'sign') + .mockImplementation( + jest.requireActual('syscoinjs-lib').utils.HDSigner.prototype.sign + ); // Set up vault-keys that would normally be created by Pali's MainController await setupTestVault(FAKE_PASSWORD); @@ -24,13 +61,15 @@ describe('Syscoin Transactions', () => { }); mockVaultStateGetter = jest.fn(() => currentVaultState); - keyringManager = await KeyringManager.createInitialized( + keyringManager = await createFreshTestKeyring( PEACE_SEED_PHRASE, FAKE_PASSWORD, mockVaultStateGetter ); }); + afterEach(() => jest.restoreAllMocks()); + describe('Fee Estimation', () => { it('should get recommended fee from network', async () => { const fee = await keyringManager.syscoinTransaction.getRecommendedFee( @@ -117,26 +156,7 @@ describe('Syscoin Transactions', () => { const originalFromPali = PsbtUtils.fromPali; const originalToPali = PsbtUtils.toPali; - PsbtUtils.fromPali = jest.fn().mockReturnValue({ - txInputs: [{ hash: Buffer.alloc(32), index: 0, sequence: 0xffffffff }], - txOutputs: [{ script: Buffer.alloc(25), value: 100000000 }], - data: { - inputs: [ - { - witnessUtxo: { script: Buffer.alloc(25), value: 100000000 }, - nonWitnessUtxo: Buffer.alloc(100), - }, - ], - outputs: [{}], - }, - getInputType: () => 'witnesspubkeyhash', - signAllInputsHDAsync: jest.fn().mockResolvedValue(undefined), - validateSignaturesOfAllInputs: jest.fn().mockReturnValue(true), - finalizeAllInputs: jest.fn(), - extractTransaction: jest.fn().mockReturnValue({ - getId: jest.fn().mockReturnValue('mock_txid'), - }), - }); + PsbtUtils.fromPali = jest.fn().mockReturnValue(scopedPsbtFixture()); PsbtUtils.toPali = jest.fn().mockReturnValue({ psbt: 'mock_signed_psbt', @@ -152,7 +172,6 @@ describe('Syscoin Transactions', () => { psbt: mockPsbtData, isTrezor: false, isLedger: false, - pathIn: undefined, }); expect(result).toBeDefined(); @@ -169,7 +188,6 @@ describe('Syscoin Transactions', () => { psbt: 'invalid-psbt-format', isTrezor: false, isLedger: false, - pathIn: undefined, }) ).rejects.toThrow(); }); @@ -186,37 +204,10 @@ describe('Syscoin Transactions', () => { ).signPSBTWithMethod; (keyringManager.syscoinTransaction as any).signPSBTWithMethod = jest .fn() - .mockResolvedValue({ - txid: 'mock_trezor_txid', - transaction: 'mock_trezor_transaction', - }); + .mockImplementation(async (psbt) => psbt); // Mock a proper PSBT object with required methods for Trezor conversion - PsbtUtils.fromPali = jest.fn().mockReturnValue({ - txInputs: [{ hash: Buffer.alloc(32), index: 0, sequence: 0xffffffff }], - txOutputs: [ - { - script: Buffer.from('0014' + '0'.repeat(40), 'hex'), // Valid witness script - value: 100000000, - address: - 'tsys1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq4k9aqm', // Valid testnet bech32 - }, - ], - data: { - inputs: [ - { - witnessUtxo: { script: Buffer.alloc(25), value: 100000000 }, - nonWitnessUtxo: Buffer.alloc(100), - }, - ], - outputs: [{}], - }, - getInputType: () => 'witnesspubkeyhash', - finalizeAllInputs: jest.fn(), - extractTransaction: jest.fn().mockReturnValue({ - getId: jest.fn().mockReturnValue('mock_txid'), - }), - }); + PsbtUtils.fromPali = jest.fn().mockReturnValue(scopedPsbtFixture()); PsbtUtils.toPali = jest.fn().mockReturnValue({ psbt: 'mock_signed_psbt', @@ -233,7 +224,6 @@ describe('Syscoin Transactions', () => { psbt: mockPsbtData, isTrezor: true, isLedger: false, - pathIn: undefined, }); expect(trezorResult).toBeDefined(); @@ -258,26 +248,7 @@ describe('Syscoin Transactions', () => { assets: [], }); - PsbtUtils.fromPali = jest.fn().mockReturnValue({ - txInputs: [{ hash: Buffer.alloc(32), index: 0, sequence: 0xffffffff }], - txOutputs: [{ script: Buffer.alloc(25), value: 100000000 }], - data: { - inputs: [ - { - witnessUtxo: { script: Buffer.alloc(25), value: 100000000 }, - nonWitnessUtxo: Buffer.alloc(100), - }, - ], - outputs: [{}], - }, - getInputType: () => 'witnesspubkeyhash', - signAllInputsHDAsync: jest.fn().mockResolvedValue(undefined), - validateSignaturesOfAllInputs: jest.fn().mockReturnValue(true), - finalizeAllInputs: jest.fn(), - extractTransaction: jest.fn().mockReturnValue({ - getId: jest.fn().mockReturnValue('mock_transaction_id'), - }), - }); + PsbtUtils.fromPali = jest.fn().mockReturnValue(scopedPsbtFixture()); // First create unsigned PSBT const feeEstimate = @@ -300,7 +271,6 @@ describe('Syscoin Transactions', () => { psbt: feeEstimate.psbt, isTrezor: false, isLedger: false, - pathIn: undefined, }); // Mock sendTransaction to avoid network calls @@ -411,26 +381,7 @@ describe('Syscoin Transactions', () => { assets: [], }); - PsbtUtils.fromPali = jest.fn().mockReturnValue({ - txInputs: [{ hash: Buffer.alloc(32), index: 0, sequence: 0xffffffff }], - txOutputs: [{ script: Buffer.alloc(25), value: 100000000 }], - data: { - inputs: [ - { - witnessUtxo: { script: Buffer.alloc(25), value: 100000000 }, - nonWitnessUtxo: Buffer.alloc(100), - }, - ], - outputs: [{}], - }, - getInputType: () => 'witnesspubkeyhash', - signAllInputsHDAsync: jest.fn().mockResolvedValue(undefined), - validateSignaturesOfAllInputs: jest.fn().mockReturnValue(true), - finalizeAllInputs: jest.fn(), - extractTransaction: jest.fn().mockReturnValue({ - getId: jest.fn().mockReturnValue('mock_token_txid'), - }), - }); + PsbtUtils.fromPali = jest.fn().mockReturnValue(scopedPsbtFixture()); // First create unsigned PSBT for token transaction const feeEstimate = @@ -456,7 +407,6 @@ describe('Syscoin Transactions', () => { psbt: feeEstimate.psbt, isTrezor: false, isLedger: false, - pathIn: undefined, }); // Mock sendTransaction to avoid network calls @@ -534,7 +484,7 @@ describe('Syscoin Transactions', () => { const mainnetVaultStateGetter = jest.fn(() => mainnetVaultState); // Create mainnet keyring - const mainnetKeyring = await KeyringManager.createInitialized( + const mainnetKeyring = await createFreshTestKeyring( PEACE_SEED_PHRASE, FAKE_PASSWORD, mainnetVaultStateGetter diff --git a/packages/sysweb3-keyring/test/unit/utils/public-bip84.spec.ts b/packages/sysweb3-keyring/test/unit/utils/public-bip84.spec.ts new file mode 100644 index 00000000..a1f3eb14 --- /dev/null +++ b/packages/sysweb3-keyring/test/unit/utils/public-bip84.spec.ts @@ -0,0 +1,317 @@ +import { address, networks } from 'bitcoinjs-lib'; +import bs58check from 'bs58check'; + +import { + deriveBip84PublicAddress, + parseBip84PublicAccount, + PublicBip84Error, +} from '../../../src/public-bip84'; + +// Public account key and addresses from the BIP84 test vector. No seed/key is used. +const ZPUB = + 'zpub6rFR7y4Q2AijBEqTUquhVz398htDFrtymD9xYYfG1m4wAcvPhXNfE3EfH1r1ADqtfSdVCToUG868RvUUkgDKf31mGDtKsAYz2oz2AGutZYs'; +const payload = () => Buffer.from(bs58check.decode(ZPUB)); +const changed = (edit: (bytes: Buffer) => void) => { + const bytes = payload(); + edit(bytes); + return bs58check.encode(bytes); +}; +const XPUB = changed((bytes) => bytes.writeUInt32BE(0x0488b21e, 0)); +const request = { network: 'bitcoin' as const, accountKey: ZPUB }; + +afterEach(() => { + expect(global.fetch).not.toHaveBeenCalled(); +}); +beforeEach(() => { + jest.mocked(global.fetch).mockClear(); +}); + +describe('strict stateless BIP84 public accounts', () => { + it('canonicalizes xpub/zpub aliases without claiming ancestry', () => { + const expected = { + network: 'bitcoin', + policy: 'bip84-p2wpkh', + canonicalKey: ZPUB, + accountIndex: 0, + }; + expect(parseBip84PublicAccount(request)).toEqual(expected); + expect(parseBip84PublicAccount({ ...request, accountKey: XPUB })).toEqual( + expected + ); + expect(parseBip84PublicAccount({ ...request, network: 'syscoin' })).toEqual( + { ...expected, network: 'syscoin' } + ); + }); + + it.each([ + [0, 0, 'bc1qcr8te4kr609gcawutmrza0j4xv80jy8z306fyu'], + [0, 1, 'bc1qnjg0jd8228aq7egyzacy8cys3knf9xvrerkf9g'], + [1, 0, 'bc1q8c6fshw2dlwun7ekn9qwf37cu2rn755upcp6el'], + ])( + 'matches public Bitcoin BIP84 vector /%i/%i', + (branch, index, expected) => { + const result = deriveBip84PublicAddress({ + ...request, + branch: branch as 0 | 1, + index, + }); + expect(result.address).toBe(expected); + expect(result.scriptPubKey).toBe( + Buffer.from( + address.toOutputScript(expected, networks.bitcoin) + ).toString('hex') + ); + expect(result.branch).toBe(branch); + expect(result.index).toBe(index); + } + ); + + it('uses Syscoin HRP with the identical derived witness program, including nonzero account metadata', () => { + const btc = deriveBip84PublicAddress({ ...request, branch: 1, index: 4 }); + const sys = deriveBip84PublicAddress({ + ...request, + network: 'syscoin', + branch: 1, + index: 4, + }); + expect(sys.address.startsWith('sys1q')).toBe(true); + expect(sys.scriptPubKey).toBe(btc.scriptPubKey); + expect(address.fromBech32(sys.address).data).toEqual( + address.fromBech32(btc.address).data + ); + const high = changed((bytes) => bytes.writeUInt32BE(0xffffffff, 9)); + expect( + parseBip84PublicAccount({ ...request, accountKey: high }).accountIndex + ).toBe(0x7fffffff); + }); + + it('returns only deeply immutable public values and leaves input untouched', () => { + const input = { ...request, branch: 0 as const, index: 0 }; + const result = deriveBip84PublicAddress(input); + expect(Object.isFrozen(result)).toBe(true); + expect(Object.isFrozen(result.account)).toBe(true); + expect(Object.keys(result).sort()).toEqual([ + 'account', + 'address', + 'branch', + 'index', + 'scriptPubKey', + ]); + expect(Object.keys(result.account).sort()).toEqual([ + 'accountIndex', + 'canonicalKey', + 'network', + 'policy', + ]); + input.accountKey = XPUB; + expect(result.account.canonicalKey).toBe(ZPUB); + expect(() => { + (result as any).index = 12; + }).toThrow(); + expect(() => { + (result.account as any).network = 'syscoin'; + }).toThrow(); + }); + + it.each([0, 1, 2, 4, 255])('rejects account depth %i', (depth) => { + expect(() => + parseBip84PublicAccount({ + ...request, + accountKey: changed((bytes) => { + bytes[4] = depth; + }), + }) + ).toThrow(PublicBip84Error); + }); + it.each([0, 1, 0x7fffffff])( + 'requires a hardened account child, rejecting %i', + (index) => { + expect(() => + parseBip84PublicAccount({ + ...request, + accountKey: changed((bytes) => bytes.writeUInt32BE(index, 9)), + }) + ).toThrow('INVALID_ACCOUNT'); + } + ); + it.each([0x043587cf, 0x045f1cf6, 0x049d7cb2, 0x0488ade4, 0x04b2430c, 1])( + 'rejects unsupported version %i', + (version) => { + expect(() => + parseBip84PublicAccount({ + ...request, + accountKey: changed((bytes) => bytes.writeUInt32BE(version, 0)), + }) + ).toThrow('INVALID_ACCOUNT'); + } + ); + it.each([ + changed((bytes) => { + bytes.fill(0, 45); + bytes[77] = 1; + }), + changed((bytes) => { + bytes.fill(255, 46); + bytes[45] = 2; + }), + ZPUB.slice(0, -1) + '1', + '', + ' ' + ZPUB, + ZPUB + '\n', + ZPUB.repeat(200), + `wpkh(${ZPUB})`, + ZPUB + '/0/*', + ])( + 'rejects private, malformed or non-bare input %# without echoing it', + (accountKey) => { + expect(() => parseBip84PublicAccount({ ...request, accountKey })).toThrow( + 'INVALID_ACCOUNT' + ); + try { + parseBip84PublicAccount({ ...request, accountKey }); + } catch (error) { + expect((error as Error).message).not.toContain(accountKey || 'zpub'); + } + } + ); + + it.each(['testnet', 'BTC', 'ethereum', 0, 57, {}, null])( + 'requires an explicit supported network %#', + (network) => { + expect(() => + parseBip84PublicAccount({ ...request, network } as any) + ).toThrow('INVALID_INPUT'); + } + ); + it.each([-1, 2, 0.5, '0', true, null, undefined])( + 'rejects branch %#', + (branch) => { + expect(() => + deriveBip84PublicAddress({ ...request, branch, index: 0 } as any) + ).toThrow('INVALID_INPUT'); + } + ); + it.each([-1, 0x80000000, 1.5, NaN, Infinity, '0', null, undefined])( + 'rejects index %#', + (index) => { + expect(() => + deriveBip84PublicAddress({ ...request, branch: 0, index } as any) + ).toThrow('INVALID_INPUT'); + } + ); + it('derives the highest nonhardened index without scanning preceding indices', () => { + const result = deriveBip84PublicAddress({ + ...request, + branch: 0, + index: 0x7fffffff, + }); + expect(result.index).toBe(0x7fffffff); + expect(result.address.startsWith('bc1q')).toBe(true); + }); + it('rejects getter, inherited, missing, extra and symbol inputs without evaluating accessors', () => { + let calls = 0; + const getter = { + network: 'bitcoin', + get accountKey() { + calls++; + return ZPUB; + }, + }; + for (const value of [ + getter, + Object.create(request), + { network: 'bitcoin' }, + { ...request, path: 'm/84h/0h/0h' }, + { ...request, [Symbol('extra')]: true }, + ]) + expect(() => parseBip84PublicAccount(value as any)).toThrow( + 'INVALID_INPUT' + ); + expect(calls).toBe(0); + }); + + it('uses fixed encodings even if the external Bitcoin network object is changed before import', () => { + const original = networks.bitcoin.bech32; + try { + networks.bitcoin.bech32 = 'tainted'; + jest.isolateModules(() => { + const dependency = require('bitcoinjs-lib'); + dependency.networks.bitcoin.bech32 = 'tainted'; + const api = require('../../../src/public-bip84'); + expect( + api.deriveBip84PublicAddress({ ...request, branch: 0, index: 0 }) + .address + ).toBe('bc1qcr8te4kr609gcawutmrza0j4xv80jy8z306fyu'); + }); + } finally { + networks.bitcoin.bech32 = original; + } + }); + + it('requests exactly the branch and leaf without iterating earlier indices', () => { + jest.isolateModules(() => { + const real = jest + .requireActual('bip32') + .BIP32Factory(jest.requireActual('@bitcoinerlab/secp256k1')); + const calls: number[] = []; + jest.doMock('bip32', () => ({ + BIP32Factory: () => ({ + fromBase58(key: string, network: any) { + const root = real.fromBase58(key, network); + const derive = root.derive.bind(root); + root.derive = (branch: number) => { + calls.push(branch); + const child = derive(branch); + const deriveChild = child.derive.bind(child); + child.derive = (index: number) => { + calls.push(index); + return deriveChild(index); + }; + return child; + }; + return root; + }, + }), + })); + const api = require('../../../src/public-bip84'); + api.parseBip84PublicAccount(request); + expect(calls).toEqual([]); + api.deriveBip84PublicAddress({ + ...request, + branch: 1, + index: 0x7fffffff, + }); + expect(calls).toEqual([1, 0x7fffffff]); + }); + jest.dontMock('bip32'); + }); + + it.each(['branch', 'leaf'])( + 'rejects BIP32 invalid-child retry at the %s step', + (step) => { + jest.isolateModules(() => { + const real = jest + .requireActual('bip32') + .BIP32Factory(jest.requireActual('@bitcoinerlab/secp256k1')); + jest.doMock('bip32', () => ({ + BIP32Factory: () => ({ + fromBase58(key: string, network: any) { + const root = real.fromBase58(key, network); + root.derive = (index: number) => { + return step === 'branch' + ? { index: index + 1 } + : { index, derive: (leaf: number) => ({ index: leaf + 1 }) }; + }; + return root; + }, + }), + })); + const api = require('../../../src/public-bip84'); + expect(() => + api.deriveBip84PublicAddress({ ...request, branch: 0, index: 0 }) + ).toThrow('INVALID_DERIVATION'); + }); + jest.dontMock('bip32'); + } + ); +}); diff --git a/packages/sysweb3-keyring/test/unit/utils/watch-descriptor.spec.ts b/packages/sysweb3-keyring/test/unit/utils/watch-descriptor.spec.ts new file mode 100644 index 00000000..26f89e69 --- /dev/null +++ b/packages/sysweb3-keyring/test/unit/utils/watch-descriptor.spec.ts @@ -0,0 +1,229 @@ +import { INetwork, INetworkType } from '@sidhujag/sysweb3-network'; +import bs58check from 'bs58check'; + +import { + deriveDescriptorAddress, + descriptorChecksum, +} from '../../../src/utils/watch-descriptor'; + +// Public BIP86 test vector; no seed/private key or remote service is used. +// https://github.com/bitcoin/bips/blob/master/bip-0086.mediawiki#test-vectors +const XPUB = + 'xpub6BgBgsespWvERF3LHQu6CnqdvfEvtMcQjYrcRzx53QJjSxarj2afYWcLteoGVky7D3UKDP9QyrLprQ3VCECoY49yfdDEHGCtMMj92pReUsQ'; +const network: INetwork = { + kind: INetworkType.Syscoin, + chainId: 0, + slip44: 0, + currency: 'BTC', + label: 'Bitcoin', + url: 'https://offline.invalid', +}; +const descriptor = (type = 'wpkh', path = '') => { + return type === 'sh(wpkh)' + ? `sh(wpkh(${XPUB}${path}))` + : `${type}(${XPUB}${path})`; +}; +const publicPayload = Buffer.from(bs58check.decode(XPUB)); +const withVersion = (version: number) => { + const payload = Buffer.from(publicPayload); + payload.writeUInt32BE(version, 0); + return bs58check.encode(payload); +}; + +beforeEach(() => { + jest.mocked(global.fetch).mockClear(); +}); +afterEach(() => { + expect(global.fetch).not.toHaveBeenCalled(); +}); + +describe('public descriptor receiving address', () => { + it.each([ + ['pkh', '1NsJS4DAHLcegD63trZurmkLm23TRAujXd'], + ['sh(wpkh)', '39oRj36VbCJdky8wsPCT5FMQNRUUekuoUr'], + ['wpkh', 'bc1qalwlmdxd2ggue4290ekzxl9tetg56neexr6amw'], + ['tr', 'bc1p5cyxnuxmeuwuvkwfem96lqzszd02n6xdcjrs20cac6yqjjwudpxqkedrcr'], + ])( + 'preserves the declared %s script at default branch/index zero', + (type, expected) => { + expect(deriveDescriptorAddress(descriptor(type), network)).toBe(expected); + } + ); + + it('uses the first declared branch and preserves multipath order', () => { + const expected = 'bc1qdjk5l8zfe5h5ex7vnhfj7rxu9fnd9d38c8plnx'; + expect(deriveDescriptorAddress(descriptor('wpkh', '/2/*'), network)).toBe( + expected + ); + expect( + deriveDescriptorAddress(descriptor('wpkh', '/<2;0>/*'), network) + ).toBe(expected); + expect( + deriveDescriptorAddress(descriptor('wpkh', '/{2,0}/*'), network) + ).toBe(expected); + expect( + deriveDescriptorAddress(descriptor('wpkh', '/<2;0>/*'), network, { + change: true, + }) + ).toBe('bc1qalwlmdxd2ggue4290ekzxl9tetg56neexr6amw'); + }); + + it('uses the second declared branch only when change was requested', () => { + expect( + deriveDescriptorAddress(descriptor(), network, { change: true }) + ).toBe('bc1qm4y5h28kytu6uftd94vtcjppffk5sx0hgat2c5'); + expect(() => + deriveDescriptorAddress(descriptor('wpkh', '/0/*'), network, { + change: true, + }) + ).toThrow(); + }); + + it('derives the exact requested nonzero index', () => { + expect( + deriveDescriptorAddress(descriptor('tr', '/0/*'), network, { index: 1 }) + ).toBe('bc1p4qhjn9zdvkux4e44uhx8tc55attvtyu358kutcqkudyccelu0was9fqzwh'); + }); + + it.each(["d34db33f/84'/0'/0'", 'd34db33f/84h/0h/0h', 'D34DB33F/44h/1/7'])( + 'treats origin %s as metadata, not an additional derivation', + (origin) => { + expect( + deriveDescriptorAddress(`wpkh([${origin}]${XPUB}/0/*)`, network) + ).toBe('bc1qalwlmdxd2ggue4290ekzxl9tetg56neexr6amw'); + } + ); + + it('checks the supplied checksum without changing the descriptor', () => { + const body = descriptor('wpkh', '/0/*'); + const input = `${body}#${descriptorChecksum(body)}`; + expect(deriveDescriptorAddress(input, network)).toBe( + 'bc1qalwlmdxd2ggue4290ekzxl9tetg56neexr6amw' + ); + expect(input).toBe(`${body}#${descriptorChecksum(body)}`); + }); + + it('matches the independent Bitcoin Core checksum vector', () => { + expect(descriptorChecksum('raw(deadbeef)')).toBe('89f8spxm'); + expect(descriptorChecksum('\u2603')).toBe(''); + }); + + it('uses registered coin encoding instead of the key version', () => { + const testnet = { ...network, chainId: 5700, slip44: 1, currency: 'tSYS' }; + expect(deriveDescriptorAddress(descriptor(), testnet)).toBe( + 'tsys1qalwlmdxd2ggue4290ekzxl9tetg56neeepgwhk' + ); + expect( + deriveDescriptorAddress(`wpkh(${withVersion(0x043587cf)})`, testnet) + ).toBe('tsys1qalwlmdxd2ggue4290ekzxl9tetg56neeepgwhk'); + expect( + deriveDescriptorAddress(`wpkh(${withVersion(0x04b24746)})`, network) + ).toBe('bc1qalwlmdxd2ggue4290ekzxl9tetg56neexr6amw'); + }); + + it('accepts ten declared branches without expanding the entire set', () => { + expect( + deriveDescriptorAddress( + descriptor('wpkh', '/<0;1;2;3;4;5;6;7;8;9>/*'), + network + ) + ).toBe('bc1qalwlmdxd2ggue4290ekzxl9tetg56neexr6amw'); + }); + + it.each([ + descriptor('addr'), + descriptor('pk'), + descriptor('wsh'), + `sh(${XPUB})`, + `tr(${XPUB},{pk(${XPUB}),pk(${XPUB})})`, + `wpkh(03cc8a4bc64d897bddc5fbc2f670f7a8ba0b386779106cf1223c6fc5d7cd6fc115)`, + `${descriptor()})`, + `${descriptor()}trailing`, + ` wpkh(${XPUB})`, + `wpkh( ${XPUB})`, + descriptor('wpkh', '/0/1'), + descriptor('wpkh', '/0/1/*'), + descriptor('wpkh', '/0h/*'), + descriptor('wpkh', "/0'/*"), + descriptor('wpkh', '/0/*h'), + descriptor('wpkh', '/2147483648/*'), + descriptor('wpkh', '/9007199254740993/*'), + descriptor('wpkh', '/<-1;0>/*'), + descriptor('wpkh', '/<0;2147483648>/*'), + descriptor('wpkh', '/<0;1;2;3;4;5;6;7;8;9;10>/*'), + `wpkh([not-a-fingerprint/84h/0h/0h]${XPUB})`, + `wpkh([d34db33f/84H/0H/0H]${XPUB})`, + `wpkh([d34db33f/2147483648h/0h/0h]${XPUB})`, + `wpkh([d34db33f/84h/0h]${XPUB})`, + `${descriptor()}#aaaaaaaa`, + `${descriptor()}#${descriptorChecksum(descriptor())}#extra`, + `wpkh(${XPUB.slice(0, -1)}1)`, + `wpkh(${XPUB.repeat(150)})`, + ])('rejects unsupported or malformed public syntax case %#', (input) => { + expect(() => deriveDescriptorAddress(input, network)).toThrow(); + }); + + it('rejects private-key payloads even when encoded with public version bytes', () => { + const payload = Buffer.from(publicPayload); + payload.fill(0, 45); + payload[77] = 1; // Publicly known synthetic scalar, not a wallet secret. + expect(() => + deriveDescriptorAddress(`wpkh(${bs58check.encode(payload)})`, network) + ).toThrow(); + payload.writeUInt32BE(0x0488ade4, 0); + expect(() => + deriveDescriptorAddress(`wpkh(${bs58check.encode(payload)})`, network) + ).toThrow(); + }); + + it.each([-1, 1.5, 0x80000000, NaN, Infinity, '1', null])( + 'rejects invalid index %s', + (index) => { + expect(() => + deriveDescriptorAddress(descriptor(), network, { index } as any) + ).toThrow(); + } + ); + + it('rejects a nonboolean change request', () => { + expect(() => + deriveDescriptorAddress(descriptor(), network, { change: 'yes' } as any) + ).toThrow(); + }); + + it.each([ + { ...network, kind: INetworkType.Ethereum, slip44: 60, currency: 'ETH' }, + { ...network, slip44: 987654, currency: 'Unknown' }, + { ...network, currency: 'Unknown' }, + { ...network, slip44: 1, currency: 'BTC' }, + ])('rejects EVM, unknown or mismatched coin identity', (input) => { + expect(() => deriveDescriptorAddress(descriptor(), input)).toThrow(); + }); + + it('does not enable Taproot only because the payment library supports it', () => { + expect(() => + deriveDescriptorAddress(descriptor('tr'), { + ...network, + slip44: 57, + currency: 'SYS', + }) + ).toThrow(); + expect(() => + deriveDescriptorAddress(descriptor('tr'), { + ...network, + slip44: 1, + currency: 'tSYS', + }) + ).toThrow(); + }); + + it('rejects witness scripts for a registered non-SegWit coin', () => { + expect(() => + deriveDescriptorAddress(descriptor(), { + ...network, + slip44: 3, + currency: 'DOGE', + }) + ).toThrow(); + }); +}); diff --git a/packages/sysweb3-keyring/tsconfig-ledger-host.json b/packages/sysweb3-keyring/tsconfig-ledger-host.json new file mode 100644 index 00000000..7ea6f3ab --- /dev/null +++ b/packages/sysweb3-keyring/tsconfig-ledger-host.json @@ -0,0 +1,10 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "module": "ESNext", + "outDir": "dist/esm", + "declarationDir": "dist/types" + }, + "include": ["src/ledger-host.ts", "src/ethers-subpaths.d.ts", "src/declare.d.ts"], + "exclude": [] +} diff --git a/packages/sysweb3-keyring/tsconfig.json b/packages/sysweb3-keyring/tsconfig.json index c7996358..028c5903 100644 --- a/packages/sysweb3-keyring/tsconfig.json +++ b/packages/sysweb3-keyring/tsconfig.json @@ -3,12 +3,28 @@ "compilerOptions": { "rootDir": "src", "baseUrl": "src", + "paths": { + "@ledgerhq/device-management-kit": [ + "../node_modules/@ledgerhq/device-management-kit/lib/types/index.d.ts" + ], + "@ledgerhq/device-transport-kit-web-hid": [ + "../node_modules/@ledgerhq/device-transport-kit-web-hid/lib/types/index.d.ts" + ], + "@ledgerhq/device-signer-kit-ethereum": [ + "../node_modules/@ledgerhq/device-signer-kit-ethereum/lib/types/index.d.ts" + ], + "@ledgerhq/context-module": [ + "../node_modules/@ledgerhq/context-module/lib/types/index.d.ts" + ] + }, "allowJs": true, "outDir": "dist/cjs", "declarationDir": "dist/types", "resolveJsonModule": true, "noImplicitAny": false, - "strictPropertyInitialization": false + "strictPropertyInitialization": false, + "isolatedModules": true }, - "include": ["src"] + "include": ["src"], + "exclude": ["src/ledger-host.ts", "src/ledger/dmk-*.ts"] } diff --git a/packages/sysweb3-keyring/yarn.lock b/packages/sysweb3-keyring/yarn.lock index 6a2c27c1..0070abed 100644 --- a/packages/sysweb3-keyring/yarn.lock +++ b/packages/sysweb3-keyring/yarn.lock @@ -2,110 +2,64 @@ # yarn lockfile v1 -"@babel/runtime@^7.15.4": - version "7.28.2" - resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.28.2.tgz#2ae5a9d51cc583bd1f5673b3bb70d6d819682473" - integrity sha512-KHp2IflsnGywDjBWDkR9iEqiWSpc8GIi0lgTT3mOElT0PP1tG26P4tmFI2YvAdzgq9RGyoHZQEIEdZy6Ec5xCA== +"@adraffy/ens-normalize@1.10.1": + version "1.10.1" + resolved "https://registry.yarnpkg.com/@adraffy/ens-normalize/-/ens-normalize-1.10.1.tgz#63430d04bd8c5e74f8d7d049338f1cd9d4f02069" + integrity sha512-96Z2IP3mYmF1Xg2cDm8f1gWGf/HUVedQ3FMifV4kG/PQ4yEP51xDtRAEfhVNt5f/uzpNkZHwWQuUcu6D6K+Ekw== -"@bitcoinerlab/descriptors@^1.0.2": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@bitcoinerlab/descriptors/-/descriptors-1.1.1.tgz#0d1a828cea66c51ebc9863d3e5c43c4ffcde2fe5" - integrity sha512-AMFkbBBg9T1iWtEmWB23oADk7zaOQix6wUPLXalhTyFDjhkFXDd6pCRfto/HAdaPg/ccM4GMTVgYLee9WdYFyQ== - dependencies: - "@bitcoinerlab/miniscript" "^1.2.1" - "@bitcoinerlab/secp256k1" "^1.0.5" - bip32 "^4.0.0" - bitcoinjs-lib "^6.1.3" - ecpair "^2.1.0" +"@adraffy/ens-normalize@1.11.1": + version "1.11.1" + resolved "https://registry.yarnpkg.com/@adraffy/ens-normalize/-/ens-normalize-1.11.1.tgz#6c2d657d4b2dfb37f8ea811dcb3e60843d4ac24a" + integrity sha512-nhCBV3quEgesuf7c7KYfperqSS14T8bYuvJ8PcLJp6znkZpFc0AuW4qBtr8eKVyPPe/8RSr7sglCWPU5eaxwKQ== -"@bitcoinerlab/descriptors@^2.0.1": - version "2.3.1" - resolved "https://registry.yarnpkg.com/@bitcoinerlab/descriptors/-/descriptors-2.3.1.tgz#08654470d1d4733ce9068d287a6f03761384dcf8" - integrity sha512-e53NE+vMolNusJ9bLQR/Tcu4Wnf9SXKb64+u30pboJozVFtl7brtcCL6IwjB5iW6QYNr1DYGocai8qtgp34p4g== +"@babel/code-frame@^7.12.13": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.29.7.tgz#f2fbbfea87c44a21590ec515b778b2c26d8866e7" + integrity sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw== dependencies: - "@bitcoinerlab/miniscript" "^1.4.0" - "@bitcoinerlab/secp256k1" "^1.2.0" - bip32 "^4.0.0" - bitcoinjs-lib "^6.1.3" - ecpair "^2.1.0" - lodash.memoize "^4.1.2" - varuint-bitcoin "^1.1.2" + "@babel/helper-validator-identifier" "^7.29.7" + js-tokens "^4.0.0" + picocolors "^1.1.1" -"@bitcoinerlab/miniscript@^1.2.1", "@bitcoinerlab/miniscript@^1.4.0": - version "1.4.0" - resolved "https://registry.yarnpkg.com/@bitcoinerlab/miniscript/-/miniscript-1.4.0.tgz#9beda21d4dadb1cb806de6f846470927cfd96f6c" - integrity sha512-BsG3dmwQmgKHnRZecDgUsPjwcpnf1wgaZbolcMTByS10k1zYzIx97W51LzG7GvokRJ+wnzTX/GhC8Y3L2X0CQA== - dependencies: - bip68 "^1.0.4" +"@babel/helper-validator-identifier@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.29.7.tgz#bd87084ced0c796ec46bda492de6e83d29e89fc2" + integrity sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg== -"@bitcoinerlab/secp256k1@^1.0.5", "@bitcoinerlab/secp256k1@^1.1.1", "@bitcoinerlab/secp256k1@^1.2.0": +"@bitcoinerlab/secp256k1@^1.2.0": version "1.2.0" resolved "https://registry.yarnpkg.com/@bitcoinerlab/secp256k1/-/secp256k1-1.2.0.tgz#429d043ef4218b9c71915b50172e9aa4a2a8fea4" integrity sha512-jeujZSzb3JOZfmJYI0ph1PVpCRV5oaexCgy+RvCXV8XlY+XFB/2n3WOcvBsKLsOw78KYgnQrQWb2HrKE4be88Q== dependencies: "@noble/curves" "^1.7.0" -"@emurgo/cardano-serialization-lib-browser@^13.2.0": - version "13.2.1" - resolved "https://registry.yarnpkg.com/@emurgo/cardano-serialization-lib-browser/-/cardano-serialization-lib-browser-13.2.1.tgz#b5ef35f2d60773e493b7647aa8cd766d31897c28" - integrity sha512-7RfX1gI16Vj2DgCp/ZoXqyLAakWo6+X95ku/rYGbVzuS/1etrlSiJmdbmdm+eYmszMlGQjrtOJQeVLXoj4L/Ag== - -"@emurgo/cardano-serialization-lib-nodejs@13.2.0": - version "13.2.0" - resolved "https://registry.yarnpkg.com/@emurgo/cardano-serialization-lib-nodejs/-/cardano-serialization-lib-nodejs-13.2.0.tgz#7427c30c94c7e9676327c9362f4f4d2e387efd2d" - integrity sha512-Bz1zLGEqBQ0BVkqt1OgMxdBOE3BdUWUd7Ly9Ecr/aUwkA8AV1w1XzBMe4xblmJHnB1XXNlPH4SraXCvO+q0Mig== +"@bufbuild/protobuf@^2.11.0": + version "2.16.0" + resolved "https://registry.yarnpkg.com/@bufbuild/protobuf/-/protobuf-2.16.0.tgz#130eff69a232f29fb4e2b3f8ebbb0b3e0adf5a36" + integrity sha512-FWa0sPlqYGJgpTs6OxBRcL/AW4JT0OIO+W1ajerluoTVh8CV0B7XM1qsNCRgnkSCkRCgOICKHRQlY17jrsm0+Q== -"@ethereumjs/common@2.6.5", "@ethereumjs/common@^2.6.4": - version "2.6.5" - resolved "https://registry.yarnpkg.com/@ethereumjs/common/-/common-2.6.5.tgz#0a75a22a046272579d91919cb12d84f2756e8d30" - integrity sha512-lRyVQOeCDaIVtgfbowla32pzeDv2Obr8oR8Put5RdUBNRGr1VGPGQNGP6elWIpgK3YdpzqTOh4GyUGOureVeeA== +"@ethereumjs/common@^3.2.0": + version "3.2.0" + resolved "https://registry.yarnpkg.com/@ethereumjs/common/-/common-3.2.0.tgz#b71df25845caf5456449163012074a55f048e0a0" + integrity sha512-pksvzI0VyLgmuEF2FA/JR/4/y6hcPq8OUail3/AvycBaW1d5VSauOZzqGvJ3RTmR4MU35lWE8KseKOsEhrFRBA== dependencies: + "@ethereumjs/util" "^8.1.0" crc-32 "^1.2.0" - ethereumjs-util "^7.1.5" - -"@ethereumjs/common@^10.0.0": - version "10.0.0" - resolved "https://registry.yarnpkg.com/@ethereumjs/common/-/common-10.0.0.tgz#7beb1d2135c9eeaf03fd7dd9fed94fea18182a2c" - integrity sha512-qb0M1DGdXzMAf3O6Zg5Wr5UDjoxBmplLPbQyC6DQ0LfgVDBRdqn0Pk+/hHm4q0McE22Of0MxbV4hhiDTkSgKag== - dependencies: - "@ethereumjs/util" "^10.0.0" - eventemitter3 "^5.0.1" - -"@ethereumjs/rlp@^10.0.0": - version "10.0.0" - resolved "https://registry.yarnpkg.com/@ethereumjs/rlp/-/rlp-10.0.0.tgz#8305d99422b4cde522f5feeb77593687287633c1" - integrity sha512-h2SK6RxFBfN5ZGykbw8LTNNLckSXZeuUZ6xqnmtF22CzZbHflFMcIOyfVGdvyCVQqIoSbGMHtvyxMCWnOyB9RA== "@ethereumjs/rlp@^4.0.1": version "4.0.1" resolved "https://registry.yarnpkg.com/@ethereumjs/rlp/-/rlp-4.0.1.tgz#626fabfd9081baab3d0a3074b0c7ecaf674aaa41" integrity sha512-tqsQiBQDQdmPWE1xkkBq4rlSW5QZpLOUJ5RJh2/9fug+q9tnUhuZoVLk7s0scUIKTOzEtR72DFBXI4WiZcMpvw== -"@ethereumjs/tx@3.5.2": - version "3.5.2" - resolved "https://registry.yarnpkg.com/@ethereumjs/tx/-/tx-3.5.2.tgz#197b9b6299582ad84f9527ca961466fce2296c1c" - integrity sha512-gQDNJWKrSDGu2w7w0PzVXVBNMzb7wwdDOmOqczmhNjqFxFuIbhVJDwiGEnxFNC2/b8ifcZzY7MLcluizohRzNw== - dependencies: - "@ethereumjs/common" "^2.6.4" - ethereumjs-util "^7.1.5" - -"@ethereumjs/tx@^10.0.0": - version "10.0.0" - resolved "https://registry.yarnpkg.com/@ethereumjs/tx/-/tx-10.0.0.tgz#100ee3cf4cb7342cabeb4f0ec41f4ccadf50df26" - integrity sha512-DApm04kp2nbvaOuHy2Rkcz1ZeJkTVgW6oCuNnQf9bRtGc+LsvLrdULE3LoGtBItEoNEcgXLJqrV0foooWFX6jw== - dependencies: - "@ethereumjs/common" "^10.0.0" - "@ethereumjs/rlp" "^10.0.0" - "@ethereumjs/util" "^10.0.0" - ethereum-cryptography "^3.2.0" - -"@ethereumjs/util@^10.0.0": - version "10.0.0" - resolved "https://registry.yarnpkg.com/@ethereumjs/util/-/util-10.0.0.tgz#1afcb06d769cb979a628a65604ba7e7fb61167ac" - integrity sha512-lO23alM4uQsv8dp6/yEm4Xw4328+wIRjSeuBO1mRTToUWRcByEMTk87yzBpXgpixpgHrl+9LTn9KB2vvKKtOQQ== +"@ethereumjs/tx@^4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@ethereumjs/tx/-/tx-4.2.0.tgz#5988ae15daf5a3b3c815493bc6b495e76009e853" + integrity sha512-1nc6VO4jtFd172BbSnTnDQVr9IYBFl1y4xPzZdtkrkKIncBCkdbgfdRV+MiTkJYAtTxvV12GRZLqBFT1PNK6Yw== dependencies: - "@ethereumjs/rlp" "^10.0.0" - ethereum-cryptography "^3.2.0" + "@ethereumjs/common" "^3.2.0" + "@ethereumjs/rlp" "^4.0.1" + "@ethereumjs/util" "^8.1.0" + ethereum-cryptography "^2.0.0" "@ethereumjs/util@^8.1.0": version "8.1.0" @@ -116,854 +70,186 @@ ethereum-cryptography "^2.0.0" micro-ftch "^0.3.1" -"@ethersproject/abi@5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/abi/-/abi-5.7.0.tgz#b3f3e045bbbeed1af3947335c247ad625a44e449" - integrity sha512-351ktp42TiRcYB3H1OP8yajPeAQstMW/yCFokj/AthP9bLHzQFPlOrxOcwYEDkUAICmOHljvN4K39OMTMUa9RA== - dependencies: - "@ethersproject/address" "^5.7.0" - "@ethersproject/bignumber" "^5.7.0" - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/constants" "^5.7.0" - "@ethersproject/hash" "^5.7.0" - "@ethersproject/keccak256" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - "@ethersproject/properties" "^5.7.0" - "@ethersproject/strings" "^5.7.0" - -"@ethersproject/abi@5.8.0", "@ethersproject/abi@^5.6.3", "@ethersproject/abi@^5.7.0", "@ethersproject/abi@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/abi/-/abi-5.8.0.tgz#e79bb51940ac35fe6f3262d7fe2cdb25ad5f07d9" - integrity sha512-b9YS/43ObplgyV6SlyQsG53/vkSal0MNA1fskSC4mbnCMi8R+NkcH8K9FPYNESf6jUefBUniE4SOKms0E/KK1Q== - dependencies: - "@ethersproject/address" "^5.8.0" - "@ethersproject/bignumber" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/constants" "^5.8.0" - "@ethersproject/hash" "^5.8.0" - "@ethersproject/keccak256" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - "@ethersproject/strings" "^5.8.0" - -"@ethersproject/abstract-provider@5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/abstract-provider/-/abstract-provider-5.7.0.tgz#b0a8550f88b6bf9d51f90e4795d48294630cb9ef" - integrity sha512-R41c9UkchKCpAqStMYUpdunjo3pkEvZC3FAwZn5S5MGbXoMQOHIdHItezTETxAO5bevtMApSyEhn9+CHcDsWBw== - dependencies: - "@ethersproject/bignumber" "^5.7.0" - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - "@ethersproject/networks" "^5.7.0" - "@ethersproject/properties" "^5.7.0" - "@ethersproject/transactions" "^5.7.0" - "@ethersproject/web" "^5.7.0" - -"@ethersproject/abstract-provider@5.8.0", "@ethersproject/abstract-provider@^5.7.0", "@ethersproject/abstract-provider@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/abstract-provider/-/abstract-provider-5.8.0.tgz#7581f9be601afa1d02b95d26b9d9840926a35b0c" - integrity sha512-wC9SFcmh4UK0oKuLJQItoQdzS/qZ51EJegK6EmAWlh+OptpQ/npECOR3QqECd8iGHC0RJb4WKbVdSfif4ammrg== - dependencies: - "@ethersproject/bignumber" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/networks" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - "@ethersproject/transactions" "^5.8.0" - "@ethersproject/web" "^5.8.0" - -"@ethersproject/abstract-signer@5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/abstract-signer/-/abstract-signer-5.7.0.tgz#13f4f32117868452191a4649723cb086d2b596b2" - integrity sha512-a16V8bq1/Cz+TGCkE2OPMTOUDLS3grCpdjoJCYNnVBbdYEMSgKrU0+B90s8b6H+ByYTBZN7a3g76jdIJi7UfKQ== - dependencies: - "@ethersproject/abstract-provider" "^5.7.0" - "@ethersproject/bignumber" "^5.7.0" - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - "@ethersproject/properties" "^5.7.0" - -"@ethersproject/abstract-signer@5.8.0", "@ethersproject/abstract-signer@^5.7.0", "@ethersproject/abstract-signer@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/abstract-signer/-/abstract-signer-5.8.0.tgz#8d7417e95e4094c1797a9762e6789c7356db0754" - integrity sha512-N0XhZTswXcmIZQdYtUnd79VJzvEwXQw6PK0dTl9VoYrEBxxCPXqS0Eod7q5TNKRxe1/5WUMuR0u0nqTF/avdCA== - dependencies: - "@ethersproject/abstract-provider" "^5.8.0" - "@ethersproject/bignumber" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - -"@ethersproject/address@5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/address/-/address-5.7.0.tgz#19b56c4d74a3b0a46bfdbb6cfcc0a153fc697f37" - integrity sha512-9wYhYt7aghVGo758POM5nqcOMaE168Q6aRLJZwUmiqSrAungkG74gSSeKEIR7ukixesdRZGPgVqme6vmxs1fkA== - dependencies: - "@ethersproject/bignumber" "^5.7.0" - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/keccak256" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - "@ethersproject/rlp" "^5.7.0" - -"@ethersproject/address@5.8.0", "@ethersproject/address@^5.7.0", "@ethersproject/address@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/address/-/address-5.8.0.tgz#3007a2c352eee566ad745dca1dbbebdb50a6a983" - integrity sha512-GhH/abcC46LJwshoN+uBNoKVFPxUuZm6dA257z0vZkKmU1+t8xTn8oK7B9qrj8W2rFRMch4gbJl6PmVxjxBEBA== - dependencies: - "@ethersproject/bignumber" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/keccak256" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/rlp" "^5.8.0" - -"@ethersproject/base64@5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/base64/-/base64-5.7.0.tgz#ac4ee92aa36c1628173e221d0d01f53692059e1c" - integrity sha512-Dr8tcHt2mEbsZr/mwTPIQAf3Ai0Bks/7gTw9dSqk1mQvhW3XvRlmDJr/4n+wg1JmCl16NZue17CDh8xb/vZ0sQ== - dependencies: - "@ethersproject/bytes" "^5.7.0" - -"@ethersproject/base64@5.8.0", "@ethersproject/base64@^5.7.0", "@ethersproject/base64@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/base64/-/base64-5.8.0.tgz#61c669c648f6e6aad002c228465d52ac93ee83eb" - integrity sha512-lN0oIwfkYj9LbPx4xEkie6rAMJtySbpOAFXSDVQaBnAzYfB4X2Qr+FXJGxMoc3Bxp2Sm8OwvzMrywxyw0gLjIQ== - dependencies: - "@ethersproject/bytes" "^5.8.0" - -"@ethersproject/basex@5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/basex/-/basex-5.7.0.tgz#97034dc7e8938a8ca943ab20f8a5e492ece4020b" - integrity sha512-ywlh43GwZLv2Voc2gQVTKBoVQ1mti3d8HK5aMxsfu/nRDnMmNqaSJ3r3n85HBByT8OpoY96SXM1FogC533T4zw== - dependencies: - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/properties" "^5.7.0" - -"@ethersproject/basex@5.8.0", "@ethersproject/basex@^5.7.0", "@ethersproject/basex@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/basex/-/basex-5.8.0.tgz#1d279a90c4be84d1c1139114a1f844869e57d03a" - integrity sha512-PIgTszMlDRmNwW9nhS6iqtVfdTAKosA7llYXNmGPw4YAI1PUyMv28988wAb41/gHF/WqGdoLv0erHaRcHRKW2Q== - dependencies: - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - -"@ethersproject/bignumber@5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/bignumber/-/bignumber-5.7.0.tgz#e2f03837f268ba655ffba03a57853e18a18dc9c2" - integrity sha512-n1CAdIHRWjSucQO3MC1zPSVgV/6dy/fjL9pMrPP9peL+QxEg9wOsVqwD4+818B6LUEtaXzVHQiuivzRoxPxUGw== - dependencies: - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - bn.js "^5.2.1" - -"@ethersproject/bignumber@5.8.0", "@ethersproject/bignumber@^5.7.0", "@ethersproject/bignumber@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/bignumber/-/bignumber-5.8.0.tgz#c381d178f9eeb370923d389284efa19f69efa5d7" - integrity sha512-ZyaT24bHaSeJon2tGPKIiHszWjD/54Sz8t57Toch475lCLljC6MgPmxk7Gtzz+ddNN5LuHea9qhAe0x3D+uYPA== - dependencies: - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - bn.js "^5.2.1" - -"@ethersproject/bytes@5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/bytes/-/bytes-5.7.0.tgz#a00f6ea8d7e7534d6d87f47188af1148d71f155d" - integrity sha512-nsbxwgFXWh9NyYWo+U8atvmMsSdKJprTcICAkvbBffT75qDocbuggBU0SJiVK2MuTrp0q+xvLkTnGMPK1+uA9A== - dependencies: - "@ethersproject/logger" "^5.7.0" - -"@ethersproject/bytes@5.8.0", "@ethersproject/bytes@^5.7.0", "@ethersproject/bytes@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/bytes/-/bytes-5.8.0.tgz#9074820e1cac7507a34372cadeb035461463be34" - integrity sha512-vTkeohgJVCPVHu5c25XWaWQOZ4v+DkGoC42/TS2ond+PARCxTJvgTFUNDZovyQ/uAQ4EcpqqowKydcdmRKjg7A== - dependencies: - "@ethersproject/logger" "^5.8.0" - -"@ethersproject/constants@5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/constants/-/constants-5.7.0.tgz#df80a9705a7e08984161f09014ea012d1c75295e" - integrity sha512-DHI+y5dBNvkpYUMiRQyxRBYBefZkJfo70VUkUAsRjcPs47muV9evftfZ0PJVCXYbAiCgght0DtcF9srFQmIgWA== - dependencies: - "@ethersproject/bignumber" "^5.7.0" - -"@ethersproject/constants@5.8.0", "@ethersproject/constants@^5.7.0", "@ethersproject/constants@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/constants/-/constants-5.8.0.tgz#12f31c2f4317b113a4c19de94e50933648c90704" - integrity sha512-wigX4lrf5Vu+axVTIvNsuL6YrV4O5AXl5ubcURKMEME5TnWBouUh0CDTWxZ2GpnRn1kcCgE7l8O5+VbV9QTTcg== - dependencies: - "@ethersproject/bignumber" "^5.8.0" - -"@ethersproject/contracts@5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/contracts/-/contracts-5.7.0.tgz#c305e775abd07e48aa590e1a877ed5c316f8bd1e" - integrity sha512-5GJbzEU3X+d33CdfPhcyS+z8MzsTrBGk/sc+G+59+tPa9yFkl6HQ9D6L0QMgNTA9q8dT0XKxxkyp883XsQvbbg== - dependencies: - "@ethersproject/abi" "^5.7.0" - "@ethersproject/abstract-provider" "^5.7.0" - "@ethersproject/abstract-signer" "^5.7.0" - "@ethersproject/address" "^5.7.0" - "@ethersproject/bignumber" "^5.7.0" - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/constants" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - "@ethersproject/properties" "^5.7.0" - "@ethersproject/transactions" "^5.7.0" - -"@ethersproject/contracts@5.8.0", "@ethersproject/contracts@^5.6.2": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/contracts/-/contracts-5.8.0.tgz#243a38a2e4aa3e757215ea64e276f8a8c9d8ed73" - integrity sha512-0eFjGz9GtuAi6MZwhb4uvUM216F38xiuR0yYCjKJpNfSEy4HUM8hvqqBj9Jmm0IUz8l0xKEhWwLIhPgxNY0yvQ== - dependencies: - "@ethersproject/abi" "^5.8.0" - "@ethersproject/abstract-provider" "^5.8.0" - "@ethersproject/abstract-signer" "^5.8.0" - "@ethersproject/address" "^5.8.0" - "@ethersproject/bignumber" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/constants" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - "@ethersproject/transactions" "^5.8.0" - -"@ethersproject/hash@5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/hash/-/hash-5.7.0.tgz#eb7aca84a588508369562e16e514b539ba5240a7" - integrity sha512-qX5WrQfnah1EFnO5zJv1v46a8HW0+E5xuBBDTwMFZLuVTx0tbU2kkx15NqdjxecrLGatQN9FGQKpb1FKdHCt+g== - dependencies: - "@ethersproject/abstract-signer" "^5.7.0" - "@ethersproject/address" "^5.7.0" - "@ethersproject/base64" "^5.7.0" - "@ethersproject/bignumber" "^5.7.0" - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/keccak256" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - "@ethersproject/properties" "^5.7.0" - "@ethersproject/strings" "^5.7.0" - -"@ethersproject/hash@5.8.0", "@ethersproject/hash@^5.7.0", "@ethersproject/hash@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/hash/-/hash-5.8.0.tgz#b8893d4629b7f8462a90102572f8cd65a0192b4c" - integrity sha512-ac/lBcTbEWW/VGJij0CNSw/wPcw9bSRgCB0AIBz8CvED/jfvDoV9hsIIiWfvWmFEi8RcXtlNwp2jv6ozWOsooA== - dependencies: - "@ethersproject/abstract-signer" "^5.8.0" - "@ethersproject/address" "^5.8.0" - "@ethersproject/base64" "^5.8.0" - "@ethersproject/bignumber" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/keccak256" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - "@ethersproject/strings" "^5.8.0" - -"@ethersproject/hdnode@5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/hdnode/-/hdnode-5.7.0.tgz#e627ddc6b466bc77aebf1a6b9e47405ca5aef9cf" - integrity sha512-OmyYo9EENBPPf4ERhR7oj6uAtUAhYGqOnIS+jE5pTXvdKBS99ikzq1E7Iv0ZQZ5V36Lqx1qZLeak0Ra16qpeOg== - dependencies: - "@ethersproject/abstract-signer" "^5.7.0" - "@ethersproject/basex" "^5.7.0" - "@ethersproject/bignumber" "^5.7.0" - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - "@ethersproject/pbkdf2" "^5.7.0" - "@ethersproject/properties" "^5.7.0" - "@ethersproject/sha2" "^5.7.0" - "@ethersproject/signing-key" "^5.7.0" - "@ethersproject/strings" "^5.7.0" - "@ethersproject/transactions" "^5.7.0" - "@ethersproject/wordlists" "^5.7.0" - -"@ethersproject/hdnode@5.8.0", "@ethersproject/hdnode@^5.7.0", "@ethersproject/hdnode@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/hdnode/-/hdnode-5.8.0.tgz#a51ae2a50bcd48ef6fd108c64cbae5e6ff34a761" - integrity sha512-4bK1VF6E83/3/Im0ERnnUeWOY3P1BZml4ZD3wcH8Ys0/d1h1xaFt6Zc+Dh9zXf9TapGro0T4wvO71UTCp3/uoA== - dependencies: - "@ethersproject/abstract-signer" "^5.8.0" - "@ethersproject/basex" "^5.8.0" - "@ethersproject/bignumber" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/pbkdf2" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - "@ethersproject/sha2" "^5.8.0" - "@ethersproject/signing-key" "^5.8.0" - "@ethersproject/strings" "^5.8.0" - "@ethersproject/transactions" "^5.8.0" - "@ethersproject/wordlists" "^5.8.0" - -"@ethersproject/json-wallets@5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/json-wallets/-/json-wallets-5.7.0.tgz#5e3355287b548c32b368d91014919ebebddd5360" - integrity sha512-8oee5Xgu6+RKgJTkvEMl2wDgSPSAQ9MB/3JYjFV9jlKvcYHUXZC+cQp0njgmxdHkYWn8s6/IqIZYm0YWCjO/0g== - dependencies: - "@ethersproject/abstract-signer" "^5.7.0" - "@ethersproject/address" "^5.7.0" - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/hdnode" "^5.7.0" - "@ethersproject/keccak256" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - "@ethersproject/pbkdf2" "^5.7.0" - "@ethersproject/properties" "^5.7.0" - "@ethersproject/random" "^5.7.0" - "@ethersproject/strings" "^5.7.0" - "@ethersproject/transactions" "^5.7.0" - aes-js "3.0.0" - scrypt-js "3.0.1" - -"@ethersproject/json-wallets@5.8.0", "@ethersproject/json-wallets@^5.7.0", "@ethersproject/json-wallets@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/json-wallets/-/json-wallets-5.8.0.tgz#d18de0a4cf0f185f232eb3c17d5e0744d97eb8c9" - integrity sha512-HxblNck8FVUtNxS3VTEYJAcwiKYsBIF77W15HufqlBF9gGfhmYOJtYZp8fSDZtn9y5EaXTE87zDwzxRoTFk11w== - dependencies: - "@ethersproject/abstract-signer" "^5.8.0" - "@ethersproject/address" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/hdnode" "^5.8.0" - "@ethersproject/keccak256" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/pbkdf2" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - "@ethersproject/random" "^5.8.0" - "@ethersproject/strings" "^5.8.0" - "@ethersproject/transactions" "^5.8.0" - aes-js "3.0.0" - scrypt-js "3.0.1" - -"@ethersproject/keccak256@5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/keccak256/-/keccak256-5.7.0.tgz#3186350c6e1cd6aba7940384ec7d6d9db01f335a" - integrity sha512-2UcPboeL/iW+pSg6vZ6ydF8tCnv3Iu/8tUmLLzWWGzxWKFFqOBQFLo6uLUv6BDrLgCDfN28RJ/wtByx+jZ4KBg== - dependencies: - "@ethersproject/bytes" "^5.7.0" - js-sha3 "0.8.0" - -"@ethersproject/keccak256@5.8.0", "@ethersproject/keccak256@^5.7.0", "@ethersproject/keccak256@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/keccak256/-/keccak256-5.8.0.tgz#d2123a379567faf2d75d2aaea074ffd4df349e6a" - integrity sha512-A1pkKLZSz8pDaQ1ftutZoaN46I6+jvuqugx5KYNeQOPqq+JZ0Txm7dlWesCHB5cndJSu5vP2VKptKf7cksERng== - dependencies: - "@ethersproject/bytes" "^5.8.0" - js-sha3 "0.8.0" - -"@ethersproject/logger@5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/logger/-/logger-5.7.0.tgz#6ce9ae168e74fecf287be17062b590852c311892" - integrity sha512-0odtFdXu/XHtjQXJYA3u9G0G8btm0ND5Cu8M7i5vhEcE8/HmF4Lbdqanwyv4uQTr2tx6b7fQRmgLrsnpQlmnig== - -"@ethersproject/logger@5.8.0", "@ethersproject/logger@^5.7.0", "@ethersproject/logger@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/logger/-/logger-5.8.0.tgz#f0232968a4f87d29623a0481690a2732662713d6" - integrity sha512-Qe6knGmY+zPPWTC+wQrpitodgBfH7XoceCGL5bJVejmH+yCS3R8jJm8iiWuvWbG76RUmyEG53oqv6GMVWqunjA== - -"@ethersproject/networks@5.7.1": - version "5.7.1" - resolved "https://registry.yarnpkg.com/@ethersproject/networks/-/networks-5.7.1.tgz#118e1a981d757d45ccea6bb58d9fd3d9db14ead6" - integrity sha512-n/MufjFYv3yFcUyfhnXotyDlNdFb7onmkSy8aQERi2PjNcnWQ66xXxa3XlS8nCcA8aJKJjIIMNJTC7tu80GwpQ== - dependencies: - "@ethersproject/logger" "^5.7.0" - -"@ethersproject/networks@5.8.0", "@ethersproject/networks@^5.7.0", "@ethersproject/networks@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/networks/-/networks-5.8.0.tgz#8b4517a3139380cba9fb00b63ffad0a979671fde" - integrity sha512-egPJh3aPVAzbHwq8DD7Po53J4OUSsA1MjQp8Vf/OZPav5rlmWUaFLiq8cvQiGK0Z5K6LYzm29+VA/p4RL1FzNg== - dependencies: - "@ethersproject/logger" "^5.8.0" - -"@ethersproject/pbkdf2@5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/pbkdf2/-/pbkdf2-5.7.0.tgz#d2267d0a1f6e123f3771007338c47cccd83d3102" - integrity sha512-oR/dBRZR6GTyaofd86DehG72hY6NpAjhabkhxgr3X2FpJtJuodEl2auADWBZfhDHgVCbu3/H/Ocq2uC6dpNjjw== - dependencies: - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/sha2" "^5.7.0" - -"@ethersproject/pbkdf2@5.8.0", "@ethersproject/pbkdf2@^5.7.0", "@ethersproject/pbkdf2@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/pbkdf2/-/pbkdf2-5.8.0.tgz#cd2621130e5dd51f6a0172e63a6e4a0c0a0ec37e" - integrity sha512-wuHiv97BrzCmfEaPbUFpMjlVg/IDkZThp9Ri88BpjRleg4iePJaj2SW8AIyE8cXn5V1tuAaMj6lzvsGJkGWskg== - dependencies: - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/sha2" "^5.8.0" - -"@ethersproject/properties@5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/properties/-/properties-5.7.0.tgz#a6e12cb0439b878aaf470f1902a176033067ed30" - integrity sha512-J87jy8suntrAkIZtecpxEPxY//szqr1mlBaYlQ0r4RCaiD2hjheqF9s1LVE8vVuJCXisjIP+JgtK/Do54ej4Sw== - dependencies: - "@ethersproject/logger" "^5.7.0" - -"@ethersproject/properties@5.8.0", "@ethersproject/properties@^5.7.0", "@ethersproject/properties@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/properties/-/properties-5.8.0.tgz#405a8affb6311a49a91dabd96aeeae24f477020e" - integrity sha512-PYuiEoQ+FMaZZNGrStmN7+lWjlsoufGIHdww7454FIaGdbe/p5rnaCXTr5MtBYl3NkeoVhHZuyzChPeGeKIpQw== - dependencies: - "@ethersproject/logger" "^5.8.0" - -"@ethersproject/providers@5.7.2": - version "5.7.2" - resolved "https://registry.yarnpkg.com/@ethersproject/providers/-/providers-5.7.2.tgz#f8b1a4f275d7ce58cf0a2eec222269a08beb18cb" - integrity sha512-g34EWZ1WWAVgr4aptGlVBF8mhl3VWjv+8hoAnzStu8Ah22VHBsuGzP17eb6xDVRzw895G4W7vvx60lFFur/1Rg== - dependencies: - "@ethersproject/abstract-provider" "^5.7.0" - "@ethersproject/abstract-signer" "^5.7.0" - "@ethersproject/address" "^5.7.0" - "@ethersproject/base64" "^5.7.0" - "@ethersproject/basex" "^5.7.0" - "@ethersproject/bignumber" "^5.7.0" - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/constants" "^5.7.0" - "@ethersproject/hash" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - "@ethersproject/networks" "^5.7.0" - "@ethersproject/properties" "^5.7.0" - "@ethersproject/random" "^5.7.0" - "@ethersproject/rlp" "^5.7.0" - "@ethersproject/sha2" "^5.7.0" - "@ethersproject/strings" "^5.7.0" - "@ethersproject/transactions" "^5.7.0" - "@ethersproject/web" "^5.7.0" - bech32 "1.1.4" - ws "7.4.6" - -"@ethersproject/providers@5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/providers/-/providers-5.8.0.tgz#6c2ae354f7f96ee150439f7de06236928bc04cb4" - integrity sha512-3Il3oTzEx3o6kzcg9ZzbE+oCZYyY+3Zh83sKkn4s1DZfTUjIegHnN2Cm0kbn9YFy45FDVcuCLLONhU7ny0SsCw== - dependencies: - "@ethersproject/abstract-provider" "^5.8.0" - "@ethersproject/abstract-signer" "^5.8.0" - "@ethersproject/address" "^5.8.0" - "@ethersproject/base64" "^5.8.0" - "@ethersproject/basex" "^5.8.0" - "@ethersproject/bignumber" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/constants" "^5.8.0" - "@ethersproject/hash" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/networks" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - "@ethersproject/random" "^5.8.0" - "@ethersproject/rlp" "^5.8.0" - "@ethersproject/sha2" "^5.8.0" - "@ethersproject/strings" "^5.8.0" - "@ethersproject/transactions" "^5.8.0" - "@ethersproject/web" "^5.8.0" - bech32 "1.1.4" - ws "8.18.0" - -"@ethersproject/random@5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/random/-/random-5.7.0.tgz#af19dcbc2484aae078bb03656ec05df66253280c" - integrity sha512-19WjScqRA8IIeWclFme75VMXSBvi4e6InrUNuaR4s5pTF2qNhcGdCUwdxUVGtDDqC00sDLCO93jPQoDUH4HVmQ== - dependencies: - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - -"@ethersproject/random@5.8.0", "@ethersproject/random@^5.7.0", "@ethersproject/random@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/random/-/random-5.8.0.tgz#1bced04d49449f37c6437c701735a1a022f0057a" - integrity sha512-E4I5TDl7SVqyg4/kkA/qTfuLWAQGXmSOgYyO01So8hLfwgKvYK5snIlzxJMk72IFdG/7oh8yuSqY2KX7MMwg+A== - dependencies: - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - -"@ethersproject/rlp@5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/rlp/-/rlp-5.7.0.tgz#de39e4d5918b9d74d46de93af80b7685a9c21304" - integrity sha512-rBxzX2vK8mVF7b0Tol44t5Tb8gomOHkj5guL+HhzQ1yBh/ydjGnpw6at+X6Iw0Kp3OzzzkcKp8N9r0W4kYSs9w== - dependencies: - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - -"@ethersproject/rlp@5.8.0", "@ethersproject/rlp@^5.7.0", "@ethersproject/rlp@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/rlp/-/rlp-5.8.0.tgz#5a0d49f61bc53e051532a5179472779141451de5" - integrity sha512-LqZgAznqDbiEunaUvykH2JAoXTT9NV0Atqk8rQN9nx9SEgThA/WMx5DnW8a9FOufo//6FZOCHZ+XiClzgbqV9Q== - dependencies: - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - -"@ethersproject/sha2@5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/sha2/-/sha2-5.7.0.tgz#9a5f7a7824ef784f7f7680984e593a800480c9fb" - integrity sha512-gKlH42riwb3KYp0reLsFTokByAKoJdgFCwI+CCiX/k+Jm2mbNs6oOaCjYQSlI1+XBVejwH2KrmCbMAT/GnRDQw== - dependencies: - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - hash.js "1.1.7" - -"@ethersproject/sha2@5.8.0", "@ethersproject/sha2@^5.7.0", "@ethersproject/sha2@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/sha2/-/sha2-5.8.0.tgz#8954a613bb78dac9b46829c0a95de561ef74e5e1" - integrity sha512-dDOUrXr9wF/YFltgTBYS0tKslPEKr6AekjqDW2dbn1L1xmjGR+9GiKu4ajxovnrDbwxAKdHjW8jNcwfz8PAz4A== - dependencies: - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - hash.js "1.1.7" - -"@ethersproject/signing-key@5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/signing-key/-/signing-key-5.7.0.tgz#06b2df39411b00bc57c7c09b01d1e41cf1b16ab3" - integrity sha512-MZdy2nL3wO0u7gkB4nA/pEf8lu1TlFswPNmy8AiYkfKTdO6eXBJyUdmHO/ehm/htHw9K/qF8ujnTyUAD+Ry54Q== - dependencies: - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - "@ethersproject/properties" "^5.7.0" - bn.js "^5.2.1" - elliptic "6.5.4" - hash.js "1.1.7" - -"@ethersproject/signing-key@5.8.0", "@ethersproject/signing-key@^5.7.0", "@ethersproject/signing-key@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/signing-key/-/signing-key-5.8.0.tgz#9797e02c717b68239c6349394ea85febf8893119" - integrity sha512-LrPW2ZxoigFi6U6aVkFN/fa9Yx/+4AtIUe4/HACTvKJdhm0eeb107EVCIQcrLZkxaSIgc/eCrX8Q1GtbH+9n3w== - dependencies: - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - bn.js "^5.2.1" - elliptic "6.6.1" - hash.js "1.1.7" - -"@ethersproject/solidity@5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/solidity/-/solidity-5.7.0.tgz#5e9c911d8a2acce2a5ebb48a5e2e0af20b631cb8" - integrity sha512-HmabMd2Dt/raavyaGukF4XxizWKhKQ24DoLtdNbBmNKUOPqwjsKQSdV9GQtj9CBEea9DlzETlVER1gYeXXBGaA== - dependencies: - "@ethersproject/bignumber" "^5.7.0" - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/keccak256" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - "@ethersproject/sha2" "^5.7.0" - "@ethersproject/strings" "^5.7.0" - -"@ethersproject/solidity@5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/solidity/-/solidity-5.8.0.tgz#429bb9fcf5521307a9448d7358c26b93695379b9" - integrity sha512-4CxFeCgmIWamOHwYN9d+QWGxye9qQLilpgTU0XhYs1OahkclF+ewO+3V1U0mvpiuQxm5EHHmv8f7ClVII8EHsA== - dependencies: - "@ethersproject/bignumber" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/keccak256" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/sha2" "^5.8.0" - "@ethersproject/strings" "^5.8.0" - -"@ethersproject/strings@5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/strings/-/strings-5.7.0.tgz#54c9d2a7c57ae8f1205c88a9d3a56471e14d5ed2" - integrity sha512-/9nu+lj0YswRNSH0NXYqrh8775XNyEdUQAuf3f+SmOrnVewcJ5SBNAjF7lpgehKi4abvNNXyf+HX86czCdJ8Mg== - dependencies: - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/constants" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - -"@ethersproject/strings@5.8.0", "@ethersproject/strings@^5.7.0", "@ethersproject/strings@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/strings/-/strings-5.8.0.tgz#ad79fafbf0bd272d9765603215ac74fd7953908f" - integrity sha512-qWEAk0MAvl0LszjdfnZ2uC8xbR2wdv4cDabyHiBh3Cldq/T8dPH3V4BbBsAYJUeonwD+8afVXld274Ls+Y1xXg== - dependencies: - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/constants" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - -"@ethersproject/transactions@5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/transactions/-/transactions-5.7.0.tgz#91318fc24063e057885a6af13fdb703e1f993d3b" - integrity sha512-kmcNicCp1lp8qanMTC3RIikGgoJ80ztTyvtsFvCYpSCfkjhD0jZ2LOrnbcuxuToLIUYYf+4XwD1rP+B/erDIhQ== - dependencies: - "@ethersproject/address" "^5.7.0" - "@ethersproject/bignumber" "^5.7.0" - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/constants" "^5.7.0" - "@ethersproject/keccak256" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - "@ethersproject/properties" "^5.7.0" - "@ethersproject/rlp" "^5.7.0" - "@ethersproject/signing-key" "^5.7.0" - -"@ethersproject/transactions@5.8.0", "@ethersproject/transactions@^5.6.2", "@ethersproject/transactions@^5.7.0", "@ethersproject/transactions@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/transactions/-/transactions-5.8.0.tgz#1e518822403abc99def5a043d1c6f6fe0007e46b" - integrity sha512-UglxSDjByHG0TuU17bDfCemZ3AnKO2vYrL5/2n2oXvKzvb7Cz+W9gOWXKARjp2URVwcWlQlPOEQyAviKwT4AHg== - dependencies: - "@ethersproject/address" "^5.8.0" - "@ethersproject/bignumber" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/constants" "^5.8.0" - "@ethersproject/keccak256" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - "@ethersproject/rlp" "^5.8.0" - "@ethersproject/signing-key" "^5.8.0" - -"@ethersproject/units@5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/units/-/units-5.7.0.tgz#637b563d7e14f42deeee39245275d477aae1d8b1" - integrity sha512-pD3xLMy3SJu9kG5xDGI7+xhTEmGXlEqXU4OfNapmfnxLVY4EMSSRp7j1k7eezutBPH7RBN/7QPnwR7hzNlEFeg== - dependencies: - "@ethersproject/bignumber" "^5.7.0" - "@ethersproject/constants" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - -"@ethersproject/units@5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/units/-/units-5.8.0.tgz#c12f34ba7c3a2de0e9fa0ed0ee32f3e46c5c2c6a" - integrity sha512-lxq0CAnc5kMGIiWW4Mr041VT8IhNM+Pn5T3haO74XZWFulk7wH1Gv64HqE96hT4a7iiNMdOCFEBgaxWuk8ETKQ== - dependencies: - "@ethersproject/bignumber" "^5.8.0" - "@ethersproject/constants" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - -"@ethersproject/wallet@5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/wallet/-/wallet-5.7.0.tgz#4e5d0790d96fe21d61d38fb40324e6c7ef350b2d" - integrity sha512-MhmXlJXEJFBFVKrDLB4ZdDzxcBxQ3rLyCkhNqVu3CDYvR97E+8r01UgrI+TI99Le+aYm/in/0vp86guJuM7FCA== - dependencies: - "@ethersproject/abstract-provider" "^5.7.0" - "@ethersproject/abstract-signer" "^5.7.0" - "@ethersproject/address" "^5.7.0" - "@ethersproject/bignumber" "^5.7.0" - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/hash" "^5.7.0" - "@ethersproject/hdnode" "^5.7.0" - "@ethersproject/json-wallets" "^5.7.0" - "@ethersproject/keccak256" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - "@ethersproject/properties" "^5.7.0" - "@ethersproject/random" "^5.7.0" - "@ethersproject/signing-key" "^5.7.0" - "@ethersproject/transactions" "^5.7.0" - "@ethersproject/wordlists" "^5.7.0" - -"@ethersproject/wallet@5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/wallet/-/wallet-5.8.0.tgz#49c300d10872e6986d953e8310dc33d440da8127" - integrity sha512-G+jnzmgg6UxurVKRKvw27h0kvG75YKXZKdlLYmAHeF32TGUzHkOFd7Zn6QHOTYRFWnfjtSSFjBowKo7vfrXzPA== - dependencies: - "@ethersproject/abstract-provider" "^5.8.0" - "@ethersproject/abstract-signer" "^5.8.0" - "@ethersproject/address" "^5.8.0" - "@ethersproject/bignumber" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/hash" "^5.8.0" - "@ethersproject/hdnode" "^5.8.0" - "@ethersproject/json-wallets" "^5.8.0" - "@ethersproject/keccak256" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - "@ethersproject/random" "^5.8.0" - "@ethersproject/signing-key" "^5.8.0" - "@ethersproject/transactions" "^5.8.0" - "@ethersproject/wordlists" "^5.8.0" - -"@ethersproject/web@5.7.1": - version "5.7.1" - resolved "https://registry.yarnpkg.com/@ethersproject/web/-/web-5.7.1.tgz#de1f285b373149bee5928f4eb7bcb87ee5fbb4ae" - integrity sha512-Gueu8lSvyjBWL4cYsWsjh6MtMwM0+H4HvqFPZfB6dV8ctbP9zFAO73VG1cMWae0FLPCtz0peKPpZY8/ugJJX2w== - dependencies: - "@ethersproject/base64" "^5.7.0" - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - "@ethersproject/properties" "^5.7.0" - "@ethersproject/strings" "^5.7.0" - -"@ethersproject/web@5.8.0", "@ethersproject/web@^5.7.0", "@ethersproject/web@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/web/-/web-5.8.0.tgz#3e54badc0013b7a801463a7008a87988efce8a37" - integrity sha512-j7+Ksi/9KfGviws6Qtf9Q7KCqRhpwrYKQPs+JBA/rKVFF/yaWLHJEH3zfVP2plVu+eys0d2DlFmhoQJayFewcw== - dependencies: - "@ethersproject/base64" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - "@ethersproject/strings" "^5.8.0" - -"@ethersproject/wordlists@5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/wordlists/-/wordlists-5.7.0.tgz#8fb2c07185d68c3e09eb3bfd6e779ba2774627f5" - integrity sha512-S2TFNJNfHWVHNE6cNDjbVlZ6MgE17MIxMbMg2zv3wn+3XSJGosL1m9ZVv3GXCf/2ymSsQ+hRI5IzoMJTG6aoVA== - dependencies: - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/hash" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - "@ethersproject/properties" "^5.7.0" - "@ethersproject/strings" "^5.7.0" - -"@ethersproject/wordlists@5.8.0", "@ethersproject/wordlists@^5.7.0", "@ethersproject/wordlists@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/wordlists/-/wordlists-5.8.0.tgz#7a5654ee8d1bb1f4dbe43f91d217356d650ad821" - integrity sha512-2df9bbXicZws2Sb5S6ET493uJ0Z84Fjr3pC4tu/qlnZERibZCeUVuqdtt+7Tv9xxhUxHoIekIA7avrKUWHrezg== - dependencies: - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/hash" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - "@ethersproject/strings" "^5.8.0" - -"@fivebinaries/coin-selection@3.0.0": - version "3.0.0" - resolved "https://registry.yarnpkg.com/@fivebinaries/coin-selection/-/coin-selection-3.0.0.tgz#00f19f21a8c6d183c8922efef6c102d0ce2b1af3" - integrity sha512-h25Pn1ZA7oqQBQDodGAgIsQt66T2wDge9onBKNqE66WNWL0KJiKJbpij8YOLo5AAlEIg5IS7EB1QjBgDOIg6DQ== +"@inversifyjs/common@1.5.0": + version "1.5.0" + resolved "https://registry.yarnpkg.com/@inversifyjs/common/-/common-1.5.0.tgz#542cdb0cfc02e36cca5a19208af726ecf904d400" + integrity sha512-Qj5BELk11AfI2rgZEAaLPmOftmQRLLmoCXgAjmaF0IngQN5vHomVT5ML7DZ3+CA5fgGcEVMcGbUDAun+Rz+oNg== + +"@inversifyjs/container@1.9.1": + version "1.9.1" + resolved "https://registry.yarnpkg.com/@inversifyjs/container/-/container-1.9.1.tgz#56367187c8a155b929758b3ab46a0ff2016cce4f" + integrity sha512-8EhjFoAx1LoD7TpCuP9ptitwc+7kVXEpZB0IeoEsCQb9sWaNYYaBi+7Lommu3/1nYxdMbX2t7AJhQnryT1EEsg== dependencies: - "@emurgo/cardano-serialization-lib-browser" "^13.2.0" - "@emurgo/cardano-serialization-lib-nodejs" "13.2.0" + "@inversifyjs/common" "1.5.0" + "@inversifyjs/core" "5.2.0" + "@inversifyjs/reflect-metadata-utils" "1.1.0" -"@isaacs/balanced-match@^4.0.1": - version "4.0.1" - resolved "https://registry.yarnpkg.com/@isaacs/balanced-match/-/balanced-match-4.0.1.tgz#3081dadbc3460661b751e7591d7faea5df39dd29" - integrity sha512-yzMTt9lEb8Gv7zRioUilSglI0c0smZ9k5D65677DLWLtWJaXIS3CqcGyUFByYKlnUj6TkjLVs54fBl6+TiGQDQ== +"@inversifyjs/core@5.2.0": + version "5.2.0" + resolved "https://registry.yarnpkg.com/@inversifyjs/core/-/core-5.2.0.tgz#cd4e27a8096c7156f0b80ecb07af8baa40c453d7" + integrity sha512-MMaHGGRjQWT9uAof63sbZyEhRl4XptEAE17DJwrgUcN9LsdIEvecKP3r53pE9VF88PFR41knUKKzagUBvWLHmw== + dependencies: + "@inversifyjs/common" "1.5.0" + "@inversifyjs/prototype-utils" "0.1.0" + "@inversifyjs/reflect-metadata-utils" "1.1.0" -"@isaacs/brace-expansion@^5.0.0": - version "5.0.0" - resolved "https://registry.yarnpkg.com/@isaacs/brace-expansion/-/brace-expansion-5.0.0.tgz#4b3dabab7d8e75a429414a96bd67bf4c1d13e0f3" - integrity sha512-ZT55BDLV0yv0RBm2czMiZ+SqCGO7AvmOM3G/w2xhVPH+te0aKgFjmBvGlL1dH+ql2tgGO3MVrbb3jCKyvpgnxA== - dependencies: - "@isaacs/balanced-match" "^4.0.1" - -"@isaacs/cliui@^8.0.2": - version "8.0.2" - resolved "https://registry.yarnpkg.com/@isaacs/cliui/-/cliui-8.0.2.tgz#b37667b7bc181c168782259bab42474fbf52b550" - integrity sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA== - dependencies: - string-width "^5.1.2" - string-width-cjs "npm:string-width@^4.2.0" - strip-ansi "^7.0.1" - strip-ansi-cjs "npm:strip-ansi@^6.0.1" - wrap-ansi "^8.1.0" - wrap-ansi-cjs "npm:wrap-ansi@^7.0.0" - -"@ledgerhq/cryptoassets-evm-signatures@^13.5.10": - version "13.5.10" - resolved "https://registry.yarnpkg.com/@ledgerhq/cryptoassets-evm-signatures/-/cryptoassets-evm-signatures-13.5.10.tgz#1e5764acb56cbfb03149295bd0e21b3210a470d4" - integrity sha512-1s0a6P2E4KKDbk12eVmJfvSA/zmTC8GKuXz+XVVYJIY+xPWs4B3qtPLXC2EpdZhj7GOehj8i0csxlV3rhQRC6w== - dependencies: - "@ledgerhq/live-env" "^2.12.0" - axios "1.7.7" - -"@ledgerhq/devices@8.4.8": - version "8.4.8" - resolved "https://registry.yarnpkg.com/@ledgerhq/devices/-/devices-8.4.8.tgz#0eee2e6b7f946dedd7adebb10dcb2dc54c1aaf87" - integrity sha512-joodpi1lTIoPswpH6DBtlAieEfP0xB1NlM8RY3xj82EtO8eU1IRqTQz7wtsbstXJ1FdLRg/CJ5OL41omdBsrZQ== - dependencies: - "@ledgerhq/errors" "^6.23.0" - "@ledgerhq/logs" "^6.13.0" - rxjs "^7.8.1" - semver "^7.3.5" - -"@ledgerhq/domain-service@^1.2.37": - version "1.2.37" - resolved "https://registry.yarnpkg.com/@ledgerhq/domain-service/-/domain-service-1.2.37.tgz#456a6bea180edebb4fbd13d5b7fb2a6308c2e917" - integrity sha512-m4F3Ur9Vwss/K8HCYmfdRH6MkgiTS9yQH30xLVtmb9Py+4at/MGkiDD38a3XN4TG9HPXFJOCj8dnhNs63UpC2Q== - dependencies: - "@ledgerhq/errors" "^6.23.0" - "@ledgerhq/logs" "^6.13.0" - "@ledgerhq/types-live" "^6.78.0" - axios "1.7.7" - eip55 "^2.1.1" - react "^18.2.0" - react-dom "^18.2.0" - -"@ledgerhq/errors@^6.23.0": - version "6.23.0" - resolved "https://registry.yarnpkg.com/@ledgerhq/errors/-/errors-6.23.0.tgz#fae7b61095ce4c033394d16085b5f14ca9f9d738" - integrity sha512-bM7tPYShPThtBy1Y+9D28iquOeP5W5s4p7KKD/cUQoaVaPibrtC7Mm4u+IeSlH4WGvFJkTmv0vmZJajuZtM79A== - -"@ledgerhq/evm-tools@^1.7.1": - version "1.7.1" - resolved "https://registry.yarnpkg.com/@ledgerhq/evm-tools/-/evm-tools-1.7.1.tgz#58e3144eb56da542f0ff858b7d60a6ae8908947b" - integrity sha512-Un3GBDmJ6zUTX6Zf+ODnxnej/20VCZ4CQWobuRdEzR5PoCjgtb/u+v3XLbP/xU/CkYgOS2+ieWwnvOe0a0/WXg== - dependencies: - "@ethersproject/constants" "^5.7.0" - "@ethersproject/hash" "^5.7.0" - "@ledgerhq/cryptoassets-evm-signatures" "^13.5.10" - "@ledgerhq/live-env" "^2.12.0" - axios "1.7.7" - crypto-js "4.2.0" - -"@ledgerhq/hw-app-eth@^6.45.12": - version "6.45.12" - resolved "https://registry.yarnpkg.com/@ledgerhq/hw-app-eth/-/hw-app-eth-6.45.12.tgz#42f0c9db737c0414aa19c29be802ab51115bf592" - integrity sha512-0yGienMDf8ZKYO7Id3eNMEdlQ+iY4qh7pJr0nCvnR7D7P1+U8d49h1JZw5gbbh5A5rN6AeOQAi6wDi5GIofgCQ== - dependencies: - "@ethersproject/abi" "^5.7.0" - "@ethersproject/rlp" "^5.7.0" - "@ethersproject/transactions" "^5.7.0" - "@ledgerhq/cryptoassets-evm-signatures" "^13.5.10" - "@ledgerhq/domain-service" "^1.2.37" - "@ledgerhq/errors" "^6.23.0" - "@ledgerhq/evm-tools" "^1.7.1" - "@ledgerhq/hw-transport" "^6.31.8" - "@ledgerhq/hw-transport-mocker" "^6.29.8" - "@ledgerhq/logs" "^6.13.0" - "@ledgerhq/types-live" "^6.78.0" - axios "1.7.7" - bignumber.js "^9.1.2" - semver "^7.3.5" - -"@ledgerhq/hw-transport-mocker@^6.29.8": - version "6.29.8" - resolved "https://registry.yarnpkg.com/@ledgerhq/hw-transport-mocker/-/hw-transport-mocker-6.29.8.tgz#7188e0fe8dfa5df5451ce3b55c192c89007ccdea" - integrity sha512-Ea7j0M9miX6KkZTdHcCdcfT1yne1Uuy6/Ph51OKhleiSSBQytSxLtbsEw8r4dppqVHNybf+DoKOsBgo2p7XayA== - dependencies: - "@ledgerhq/hw-transport" "^6.31.8" - "@ledgerhq/logs" "^6.13.0" - rxjs "^7.8.1" - -"@ledgerhq/hw-transport-webhid@^6.30.4": - version "6.30.4" - resolved "https://registry.yarnpkg.com/@ledgerhq/hw-transport-webhid/-/hw-transport-webhid-6.30.4.tgz#2f3b3039e7c4fa56692ba606412827c958874dea" - integrity sha512-A13E89U1wfWx8reA9ciwm/+SsbGM163yl1UXuWUQ521hIDAAwVbpnRhwaQT4XjTmDbWhvtT2RYRCoOWWO7N6GA== - dependencies: - "@ledgerhq/devices" "8.4.8" - "@ledgerhq/errors" "^6.23.0" - "@ledgerhq/hw-transport" "^6.31.8" - "@ledgerhq/logs" "^6.13.0" - -"@ledgerhq/hw-transport@^6.20.0", "@ledgerhq/hw-transport@^6.31.8": - version "6.31.8" - resolved "https://registry.yarnpkg.com/@ledgerhq/hw-transport/-/hw-transport-6.31.8.tgz#1127ad66ec68c2ec82f968e3764078b5bbbfbc1a" - integrity sha512-iH74gILq8BkkLX1Il0wNhcYp1BJ3tjR18fdok4KEdU86i9dOXRKfLbWNhDDFf1px/pMrsGlDS4SpaO74janeEA== - dependencies: - "@ledgerhq/devices" "8.4.8" - "@ledgerhq/errors" "^6.23.0" - "@ledgerhq/logs" "^6.13.0" - events "^3.3.0" - -"@ledgerhq/live-env@^2.12.0": - version "2.12.0" - resolved "https://registry.yarnpkg.com/@ledgerhq/live-env/-/live-env-2.12.0.tgz#d238595627211c669667c5d6b8042937e56288ac" - integrity sha512-p1pqfXN88TZWHdoQVLtrs1WdX1/VG07ZDDOwmrgi04iSh6NWaiiGJS27Xye3xSf/vL0pU5nLWmj2LP5Rjhxs6g== - dependencies: - rxjs "^7.8.1" - utility-types "^3.10.0" - -"@ledgerhq/logs@^6.10.1", "@ledgerhq/logs@^6.13.0": - version "6.13.0" - resolved "https://registry.yarnpkg.com/@ledgerhq/logs/-/logs-6.13.0.tgz#0b083af64b6b85db0630c7b940a0ed74ff6262b6" - integrity sha512-4+qRW2Pc8V+btL0QEmdB2X+uyx0kOWMWE1/LWsq5sZy3Q5tpi4eItJS6mB0XL3wGW59RQ+8bchNQQ1OW/va8Og== - -"@ledgerhq/types-live@^6.78.0": - version "6.78.0" - resolved "https://registry.yarnpkg.com/@ledgerhq/types-live/-/types-live-6.78.0.tgz#d730f58d13876d65f389d74dd95671324bd26433" - integrity sha512-8popPS/tw8AmoTBSCfmiLc0wFskPpNAhhh5n4wqD9N6d0gFax84HWMEEHJSqsPor6wuzfVPmFYVivpjErlYi9Q== - dependencies: - bignumber.js "^9.1.2" - rxjs "^7.8.1" - -"@metamask/safe-event-emitter@^2.0.0": - version "2.0.0" - resolved "https://registry.yarnpkg.com/@metamask/safe-event-emitter/-/safe-event-emitter-2.0.0.tgz#af577b477c683fad17c619a78208cede06f9605c" - integrity sha512-/kSXhY692qiV1MXu6EeOZvg5nECLclxNXcKCxJ3cXQgYuRymRHpdx/t7JXfsK+JLjwA1e1c1/SBrlQYpusC29Q== +"@inversifyjs/prototype-utils@0.1.0": + version "0.1.0" + resolved "https://registry.yarnpkg.com/@inversifyjs/prototype-utils/-/prototype-utils-0.1.0.tgz#1378596f3d708244f390e9b233599b862aba450d" + integrity sha512-lNz1yyajMRDXBHLvJsYYX81FcmeD15e5Qz1zAZ/3zeYTl+u7ZF/GxNRKJzNOloeMPMtuR8BnvzHA1SZxjR+J9w== + dependencies: + "@inversifyjs/common" "1.5.0" + +"@inversifyjs/reflect-metadata-utils@1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@inversifyjs/reflect-metadata-utils/-/reflect-metadata-utils-1.1.0.tgz#193ab71b92d47a8073e65e5bab640762bc435dcb" + integrity sha512-jmuAuC3eL1GnFAYfJGJOMKRDL9q1mgzOyrban6zxfM8Yg1FUHsj25h27bW2G7p8X1Amvhg3MLkaOuogszkrofA== -"@mobily/ts-belt@^3.13.1": - version "3.13.1" - resolved "https://registry.yarnpkg.com/@mobily/ts-belt/-/ts-belt-3.13.1.tgz#8f8ce2a2eca41d88c2ca70c84d0f47d0f7f5cd5f" - integrity sha512-K5KqIhPI/EoCTbA6CGbrenM9s41OouyK8A03fGJJcla/zKucsgLbz8HNbeseoLarRPgyWJsUyCYqFhI7t3Ra9Q== +"@jest/expect-utils@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/expect-utils/-/expect-utils-29.7.0.tgz#023efe5d26a8a70f21677d0a1afc0f0a44e3a1c6" + integrity sha512-GlsNBWiFQFCVi9QVSx7f5AgMeLxe9YCCs5PuP2O2LdjDAA8Jh9eX7lA1Jq/xdXw3Wb3hyvlFNfZIfcRetSzYcA== + dependencies: + jest-get-type "^29.6.3" + +"@jest/schemas@^29.6.3": + version "29.6.3" + resolved "https://registry.yarnpkg.com/@jest/schemas/-/schemas-29.6.3.tgz#430b5ce8a4e0044a7e3819663305a7b3091c8e03" + integrity sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA== + dependencies: + "@sinclair/typebox" "^0.27.8" -"@noble/ciphers@1.3.0": +"@jest/types@^29.6.3": + version "29.6.3" + resolved "https://registry.yarnpkg.com/@jest/types/-/types-29.6.3.tgz#1131f8cf634e7e84c5e77bab12f052af585fba59" + integrity sha512-u3UPsIilWKOM3F9CXtrG8LEJmNxwoCQC/XVj4IKYXvvpx7QIi/Kg1LI5uDmDpKlac62NUtX7eLjRh+jVZcLOzw== + dependencies: + "@jest/schemas" "^29.6.3" + "@types/istanbul-lib-coverage" "^2.0.0" + "@types/istanbul-reports" "^3.0.0" + "@types/node" "*" + "@types/yargs" "^17.0.8" + chalk "^4.0.0" + +"@ledgerhq/context-module@2.8.0": + version "2.8.0" + resolved "https://registry.yarnpkg.com/@ledgerhq/context-module/-/context-module-2.8.0.tgz#05f669aa5a079c265d91aadf3525042fd59120d5" + integrity sha512-bndTxEdV15CirIq47kCx5Q0ilKSX9V2gDSy9n6X37GKUffFrr6r9TLOx3AISZDWKX5UorCUzxRWKtT0Q2OozJA== + dependencies: + bs58 "^6.0.0" + crypto-js "^4.2.0" + ethers "6.14.1" + inversify "7.5.1" + purify-ts "2.1.0" + reflect-metadata "0.2.2" + +"@ledgerhq/device-contacts-kit@^0.5.0": + version "0.5.0" + resolved "https://registry.yarnpkg.com/@ledgerhq/device-contacts-kit/-/device-contacts-kit-0.5.0.tgz#6dd16fdefdfff036677a16766cc58903baa93931" + integrity sha512-i8K0NSKalvIfg1mwrrOFEK00a5tPPFOqQBIHuSeTUUXWGH8VdnNulmTmAjNsw64Q+vskUs0+cd9DswAbtHHv9A== + dependencies: + "@ledgerhq/signer-utils" "^1.3.0" + inversify "7.5.1" + purify-ts "2.1.0" + reflect-metadata "0.2.2" + semver "7.7.2" + xstate "5.19.2" + +"@ledgerhq/device-management-kit@1.11.0": + version "1.11.0" + resolved "https://registry.yarnpkg.com/@ledgerhq/device-management-kit/-/device-management-kit-1.11.0.tgz#b5213b4b03bc3d09f05ee34b8ade7f1340626fab" + integrity sha512-1KAC6tmtLZz+9X0KQY0lukzEAXgIDoMM3LP0pTRh9/Rab/NmZv5+74R9coL2mYTnDQTp8EfR41uJLJ5FylRCug== + dependencies: + "@noble/hashes" "^1.8.0" + "@sentry/minimal" "6.19.7" + inversify "7.5.1" + isomorphic-ws "^5.0.0" + purify-ts "2.1.0" + reflect-metadata "0.2.2" + semver "7.7.2" + uuid "11.0.3" + ws "^8.18.0" + xstate "5.19.2" + +"@ledgerhq/device-signer-kit-ethereum@1.18.2": + version "1.18.2" + resolved "https://registry.yarnpkg.com/@ledgerhq/device-signer-kit-ethereum/-/device-signer-kit-ethereum-1.18.2.tgz#80cd2ce0420550e48262f6201a68957b01901f7b" + integrity sha512-4ulqEBlUW3tkvcU4mxXF+yu6co7yl/B+9x4GJAFRG5qcwTTj1JpnErxzx1cX/BdQ1ZfwKsjPJKRaT1x3sf2EVA== + dependencies: + "@ledgerhq/device-contacts-kit" "^0.5.0" + "@ledgerhq/signer-utils" "^1.3.0" + ethers "6.14.1" + inversify "7.5.1" + purify-ts "2.1.0" + reflect-metadata "0.2.2" + semver "7.7.2" + xstate "5.19.2" + +"@ledgerhq/device-transport-kit-web-hid@1.2.4": + version "1.2.4" + resolved "https://registry.yarnpkg.com/@ledgerhq/device-transport-kit-web-hid/-/device-transport-kit-web-hid-1.2.4.tgz#fc4f5f7dfefef0460a9de827153949e54a8fdb33" + integrity sha512-VMwkZ6QTUJpj4fS45ihnqdcNrJFDI58kg/KGKCDVhsknSZAe52R0JoH9yRqryemjL0eeo11Yj2KifXM8dNpsDA== + dependencies: + "@sentry/minimal" "6.19.7" + purify-ts "2.1.0" + uuid "11.0.3" + +"@ledgerhq/signer-utils@^1.3.0": version "1.3.0" - resolved "https://registry.yarnpkg.com/@noble/ciphers/-/ciphers-1.3.0.tgz#f64b8ff886c240e644e5573c097f86e5b43676dc" - integrity sha512-2I0gnIVPtfnMw9ee9h1dJG7tp81+8Ob3OJb3Mv37rx5L40/b0i7djjCVvGOVqc9AEIQyvyu1i6ypKdFw8R8gQw== + resolved "https://registry.yarnpkg.com/@ledgerhq/signer-utils/-/signer-utils-1.3.0.tgz#074b6ac8697db5744f470183dc777cd43a610cce" + integrity sha512-qe+HQMgZxq6SPv8ghvlq4c33RchUwlf1qE/qp7MtUGPbKGAqD/0PKNyzx05sKLpmA8m6YZdtndHH4CEkikzqSQ== + dependencies: + semver "7.7.2" + +"@metamask/abi-utils@^3.0.0": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@metamask/abi-utils/-/abi-utils-3.0.0.tgz#2eab9cb895922b94305364d9111b6dde724f6f9b" + integrity sha512-a/l0DiSIr7+CBYVpHygUa3ztSlYLFCQMsklLna+t6qmNY9+eIO5TedNxhyIyvaJ+4cN7TLy0NQFbp9FV3X2ktg== + dependencies: + "@metamask/superstruct" "^3.1.0" + "@metamask/utils" "^11.0.1" + +"@metamask/eth-sig-util@^8.2.0": + version "8.2.0" + resolved "https://registry.yarnpkg.com/@metamask/eth-sig-util/-/eth-sig-util-8.2.0.tgz#f114ca5b2a1a997b467933c902e7ec44123eb8fb" + integrity sha512-LZDglIh4gYGw9Myp+2aIwKrj6lIJpMC4e0m7wKJU+BxLLBFcrTgKrjdjstXGVWvuYG3kutlh9J+uNBRPJqffWQ== + dependencies: + "@ethereumjs/rlp" "^4.0.1" + "@ethereumjs/util" "^8.1.0" + "@metamask/abi-utils" "^3.0.0" + "@metamask/utils" "^11.0.1" + "@scure/base" "~1.1.3" + ethereum-cryptography "^2.1.2" + tweetnacl "^1.0.3" + +"@metamask/superstruct@^3.1.0": + version "3.4.1" + resolved "https://registry.yarnpkg.com/@metamask/superstruct/-/superstruct-3.4.1.tgz#3374ef336ebc5f9a6c5e3e5d3c28a80c89e8dc28" + integrity sha512-caTaaBUcwBGbUNf3r0uT48upX4nECRbKhQ9pPOfW4sIkfcIUUDV4S9DZxq/5fuNPVt5KWpyd5xIIz0sP+iWLlg== + +"@metamask/utils@^11.0.1": + version "11.11.0" + resolved "https://registry.yarnpkg.com/@metamask/utils/-/utils-11.11.0.tgz#6675946df767da6cbe306c7b5e76685320a6c826" + integrity sha512-0nF2CWjWQr/m0Y2t2lJnBTU1/CZPPTvKvcESLplyWe/tyeb8zFOi/FeneDmaFnML6LYRIGZU6f+xR0jKAIUZfw== + dependencies: + "@ethereumjs/tx" "^4.2.0" + "@metamask/superstruct" "^3.1.0" + "@noble/hashes" "^1.3.1" + "@scure/base" "^1.1.3" + "@types/debug" "^4.1.7" + "@types/lodash" "^4.17.20" + debug "^4.3.4" + lodash "^4.17.21" + pony-cause "^2.1.10" + semver "^7.5.4" + uuid "^9.0.1" + +"@noble/curves@1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.2.0.tgz#92d7e12e4e49b23105a2555c6984d41733d65c35" + integrity sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw== + dependencies: + "@noble/hashes" "1.3.2" "@noble/curves@1.4.2", "@noble/curves@~1.4.0": version "1.4.2" @@ -972,129 +258,34 @@ dependencies: "@noble/hashes" "1.4.0" -"@noble/curves@1.9.0": - version "1.9.0" - resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.9.0.tgz#13e0ca8be4a0ce66c113693a94514e5599f40cfc" - integrity sha512-7YDlXiNMdO1YZeH6t/kvopHHbIZzlxrCV9WLqCY6QhcXOoXiNCMDqJIglZ9Yjx5+w7Dz30TITFrlTjnRg7sKEg== +"@noble/curves@^1.7.0": + version "1.9.7" + resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.9.7.tgz#79d04b4758a43e4bca2cbdc62e7771352fa6b951" + integrity sha512-gbKGcRUYIjA3/zCCNaWDciTMFI0dCkvou3TL8Zmy5Nc7sJ47a0jtOeZoTaMxkuqRo9cRhjOdZJXegxYE5FN/xw== dependencies: "@noble/hashes" "1.8.0" -"@noble/curves@^1.0.0", "@noble/curves@^1.7.0", "@noble/curves@~1.9.0": - version "1.9.4" - resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.9.4.tgz#a748c6837ee7854a558cc3b951aedd87a5e7d6a5" - integrity sha512-2bKONnuM53lINoDrSmK8qP8W271ms7pygDhZt4SiLOoLwBtoHqeCFi6RG42V8zd3mLHuJFhU/Bmaqo4nX0/kBw== - dependencies: - "@noble/hashes" "1.8.0" +"@noble/hashes@1.3.2": + version "1.3.2" + resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.2.tgz#6f26dbc8fbc7205873ce3cee2f690eba0d421b39" + integrity sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ== "@noble/hashes@1.4.0", "@noble/hashes@~1.4.0": version "1.4.0" resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.4.0.tgz#45814aa329f30e4fe0ba49426f49dfccdd066426" integrity sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg== -"@noble/hashes@1.8.0", "@noble/hashes@^1.0.0", "@noble/hashes@^1.2.0", "@noble/hashes@^1.4.0", "@noble/hashes@^1.6.1", "@noble/hashes@~1.8.0": +"@noble/hashes@1.8.0", "@noble/hashes@^1.2.0", "@noble/hashes@^1.3.1", "@noble/hashes@^1.8.0": version "1.8.0" resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.8.0.tgz#cee43d801fcef9644b11b8194857695acd5f815a" integrity sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A== -"@pollum-io/sysweb3-core@^1.0.27": - version "1.0.27" - resolved "https://registry.yarnpkg.com/@pollum-io/sysweb3-core/-/sysweb3-core-1.0.27.tgz#2ecbf38c3b5f6821ec2bcc95472eed0a2f11cd10" - integrity sha512-HHW2ozdXCac2Xo0oUQgRk/sczBIGQCBvsqYBIwondipA3Rx4/jGC6Y9U/M4wpTi5wQ+ZD18DyEbKAVMXElGcbQ== - -"@pollum-io/sysweb3-network@^1.0.96": - version "1.0.96" - resolved "https://registry.yarnpkg.com/@pollum-io/sysweb3-network/-/sysweb3-network-1.0.96.tgz#7bc358dc4c5f8bff4de18aaf7dabd190cdd867e9" - integrity sha512-iAtYGR8xa0sgRS601bXDbwKVu3yYIrF+hgJgsP1BKayVSsqJ+tJKyY8YBIxCcpyxlbu6mRgqPOhlwe2ZXYB4fQ== - dependencies: - axios "^0.26.1" - bip44-constants "^114.0.0" - bs58check "^2.1.2" - eth-chains "^1.0.0" - ethers "^5.6.9" - web3 "^1.7.1" - -"@pollum-io/sysweb3-utils@^1.1.237": - version "1.1.237" - resolved "https://registry.yarnpkg.com/@pollum-io/sysweb3-utils/-/sysweb3-utils-1.1.237.tgz#8e08ec3c637dc2fb1fa785c7b898fa9af9abde11" - integrity sha512-qwy8mBZxJ+ntTSIVsrCqT008MMm15i1N+MZw6gTONF0TSZTXbZIBN3Jh74Y4rdVM1/ghBk42K96NoPWWu/MP9Q== - dependencies: - "@ethersproject/contracts" "^5.6.2" - axios "^0.26.1" - bech32 "^2.0.0" - bip32 "^3.0.1" - bip44-constants "^114.0.0" - bip84 "^0.2.7" - bitcoinjs-lib "^5.2.0" - camelcase-keys "^7.0.2" - coinselectsyscoin "^1.0.77" - crypto-js "^4.1.1" - eth-object "https://github.com/syscoin/eth-object.git" - eth-proof "^2.1.6" - eth-util-lite "^1.0.1" - ethers "^5.6.4" - syscoinjs-lib "^1.0.218" - syscointx-js "^1.0.106" - web3 "^1.7.1" - -"@protobufjs/aspromise@^1.1.1", "@protobufjs/aspromise@^1.1.2": - version "1.1.2" - resolved "https://registry.yarnpkg.com/@protobufjs/aspromise/-/aspromise-1.1.2.tgz#9b8b0cc663d669a7d8f6f5d0893a14d348f30fbf" - integrity sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ== - -"@protobufjs/base64@^1.1.2": - version "1.1.2" - resolved "https://registry.yarnpkg.com/@protobufjs/base64/-/base64-1.1.2.tgz#4c85730e59b9a1f1f349047dbf24296034bb2735" - integrity sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg== - -"@protobufjs/codegen@^2.0.4": - version "2.0.4" - resolved "https://registry.yarnpkg.com/@protobufjs/codegen/-/codegen-2.0.4.tgz#7ef37f0d010fb028ad1ad59722e506d9262815cb" - integrity sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg== - -"@protobufjs/eventemitter@^1.1.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz#355cbc98bafad5978f9ed095f397621f1d066b70" - integrity sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q== - -"@protobufjs/fetch@^1.1.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@protobufjs/fetch/-/fetch-1.1.0.tgz#ba99fb598614af65700c1619ff06d454b0d84c45" - integrity sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ== - dependencies: - "@protobufjs/aspromise" "^1.1.1" - "@protobufjs/inquire" "^1.1.0" - -"@protobufjs/float@^1.0.2": - version "1.0.2" - resolved "https://registry.yarnpkg.com/@protobufjs/float/-/float-1.0.2.tgz#5e9e1abdcb73fc0a7cb8b291df78c8cbd97b87d1" - integrity sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ== - -"@protobufjs/inquire@^1.1.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@protobufjs/inquire/-/inquire-1.1.0.tgz#ff200e3e7cf2429e2dcafc1140828e8cc638f089" - integrity sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q== - -"@protobufjs/path@^1.1.2": - version "1.1.2" - resolved "https://registry.yarnpkg.com/@protobufjs/path/-/path-1.1.2.tgz#6cc2b20c5c9ad6ad0dccfd21ca7673d8d7fbf68d" - integrity sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA== - -"@protobufjs/pool@^1.1.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@protobufjs/pool/-/pool-1.1.0.tgz#09fd15f2d6d3abfa9b65bc366506d6ad7846ff54" - integrity sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw== - -"@protobufjs/utf8@^1.1.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@protobufjs/utf8/-/utf8-1.1.0.tgz#a777360b5b39a1a2e5106f8e858f2fd2d060c570" - integrity sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw== - -"@scure/base@^1.1.1", "@scure/base@^1.1.3", "@scure/base@~1.2.5": +"@scure/base@^1.1.1", "@scure/base@^1.1.3": version "1.2.6" resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.2.6.tgz#ca917184b8231394dd8847509c67a0be522e59f6" integrity sha512-g/nm5FgUa//MCj1gV09zTJTaM6KBAHqLN907YVQqf7zC49+DcO4B1so4ZX07Ef10Twr6nuqYEH9GEggFXA4Fmg== -"@scure/base@~1.1.6": +"@scure/base@~1.1.3", "@scure/base@~1.1.6": version "1.1.9" resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.1.9.tgz#e5e142fbbfe251091f9c5f1dd4c834ac04c3dbd1" integrity sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg== @@ -1108,15 +299,6 @@ "@noble/hashes" "~1.4.0" "@scure/base" "~1.1.6" -"@scure/bip32@1.7.0", "@scure/bip32@^1.3.1": - version "1.7.0" - resolved "https://registry.yarnpkg.com/@scure/bip32/-/bip32-1.7.0.tgz#b8683bab172369f988f1589640e53c4606984219" - integrity sha512-E4FFX/N3f4B80AKWp5dP6ow+flD1LQZo/w8UnLGYZO674jS6YnYeepycOOksv+vLPSpgN35wgKgy+ybfTb2SMw== - dependencies: - "@noble/curves" "~1.9.0" - "@noble/hashes" "~1.8.0" - "@scure/base" "~1.2.5" - "@scure/bip39@1.3.0": version "1.3.0" resolved "https://registry.yarnpkg.com/@scure/bip39/-/bip39-1.3.0.tgz#0f258c16823ddd00739461ac31398b4e7d6a18c3" @@ -1125,789 +307,228 @@ "@noble/hashes" "~1.4.0" "@scure/base" "~1.1.6" -"@scure/bip39@1.6.0", "@scure/bip39@^1.2.1", "@scure/bip39@^1.5.1": - version "1.6.0" - resolved "https://registry.yarnpkg.com/@scure/bip39/-/bip39-1.6.0.tgz#475970ace440d7be87a6086cbee77cb8f1a684f9" - integrity sha512-+lF0BbLiJNwVlev4eKelw1WWLaiKXw7sSl8T6FvBlWkdX+94aGJ4o8XjUdlyhTCjd8c+B3KT3JfS8P0bLRNU6A== +"@sentry/hub@6.19.7": + version "6.19.7" + resolved "https://registry.yarnpkg.com/@sentry/hub/-/hub-6.19.7.tgz#58ad7776bbd31e9596a8ec46365b45cd8b9cfd11" + integrity sha512-y3OtbYFAqKHCWezF0EGGr5lcyI2KbaXW2Ik7Xp8Mu9TxbSTuwTe4rTntwg8ngPjUQU3SUHzgjqVB8qjiGqFXCA== dependencies: - "@noble/hashes" "~1.8.0" - "@scure/base" "~1.2.5" - -"@sinclair/typebox@^0.33.7": - version "0.33.22" - resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.33.22.tgz#3339d85172509095a8384cb4b44834a7c9309d86" - integrity sha512-auUj4k+f4pyrIVf4GW5UKquSZFHJWri06QgARy9C0t9ZTjJLIuNIrr1yl9bWcJWJ1Gz1vOvYN1D+QPaIlNMVkQ== - -"@sindresorhus/is@^4.0.0", "@sindresorhus/is@^4.6.0": - version "4.6.0" - resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-4.6.0.tgz#3c7c9c46e678feefe7a2e5bb609d3dbd665ffb3f" - integrity sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw== - -"@solana-program/compute-budget@^0.8.0": - version "0.8.0" - resolved "https://registry.yarnpkg.com/@solana-program/compute-budget/-/compute-budget-0.8.0.tgz#0930aca4de1170ed607d64d89375074930aa8b93" - integrity sha512-qPKxdxaEsFxebZ4K5RPuy7VQIm/tfJLa1+Nlt3KNA8EYQkz9Xm8htdoEaXVrer9kpgzzp9R3I3Bh6omwCM06tQ== - -"@solana-program/stake@^0.2.1": - version "0.2.1" - resolved "https://registry.yarnpkg.com/@solana-program/stake/-/stake-0.2.1.tgz#cc3367e5aa0258fa6599658b0ed48b02f86487a2" - integrity sha512-ssNPsJv9XHaA+L7ihzmWGYcm/+XYURQ8UA3wQMKf6ccEHyHOUgoglkkDU/BoA0+wul6HxZUN0tHFymC0qFw6sg== - -"@solana-program/system@^0.7.0": - version "0.7.0" - resolved "https://registry.yarnpkg.com/@solana-program/system/-/system-0.7.0.tgz#3e21c9fb31d3795eb65ba5cb663947c19b305bad" - integrity sha512-FKTBsKHpvHHNc1ATRm7SlC5nF/VdJtOSjldhcyfMN9R7xo712Mo2jHIzvBgn8zQO5Kg0DcWuKB7268Kv1ocicw== + "@sentry/types" "6.19.7" + "@sentry/utils" "6.19.7" + tslib "^1.9.3" -"@solana-program/token-2022@^0.4.2": - version "0.4.2" - resolved "https://registry.yarnpkg.com/@solana-program/token-2022/-/token-2022-0.4.2.tgz#f90a638de82acb7933a114e884a24ac4be8ef635" - integrity sha512-zIpR5t4s9qEU3hZKupzIBxJ6nUV5/UVyIT400tu9vT1HMs5JHxaTTsb5GUhYjiiTvNwU0MQavbwc4Dl29L0Xvw== - -"@solana-program/token@^0.5.1": - version "0.5.1" - resolved "https://registry.yarnpkg.com/@solana-program/token/-/token-0.5.1.tgz#10e327df23f05a7f892fd33a9b6418f17dd62296" - integrity sha512-bJvynW5q9SFuVOZ5vqGVkmaPGA0MCC+m9jgJj1nk5m20I389/ms69ASnhWGoOPNcie7S9OwBX0gTj2fiyWpfag== - -"@solana/accounts@2.3.0": - version "2.3.0" - resolved "https://registry.yarnpkg.com/@solana/accounts/-/accounts-2.3.0.tgz#957360edd572c1294772ee0eae3abd598189b16e" - integrity sha512-QgQTj404Z6PXNOyzaOpSzjgMOuGwG8vC66jSDB+3zHaRcEPRVRd2sVSrd1U6sHtnV3aiaS6YyDuPQMheg4K2jw== - dependencies: - "@solana/addresses" "2.3.0" - "@solana/codecs-core" "2.3.0" - "@solana/codecs-strings" "2.3.0" - "@solana/errors" "2.3.0" - "@solana/rpc-spec" "2.3.0" - "@solana/rpc-types" "2.3.0" - -"@solana/addresses@2.3.0": - version "2.3.0" - resolved "https://registry.yarnpkg.com/@solana/addresses/-/addresses-2.3.0.tgz#d89cba142819f01905a4bf30a1b990a1b55e490d" - integrity sha512-ypTNkY2ZaRFpHLnHAgaW8a83N0/WoqdFvCqf4CQmnMdFsZSdC7qOwcbd7YzdaQn9dy+P2hybewzB+KP7LutxGA== - dependencies: - "@solana/assertions" "2.3.0" - "@solana/codecs-core" "2.3.0" - "@solana/codecs-strings" "2.3.0" - "@solana/errors" "2.3.0" - "@solana/nominal-types" "2.3.0" - -"@solana/assertions@2.3.0": - version "2.3.0" - resolved "https://registry.yarnpkg.com/@solana/assertions/-/assertions-2.3.0.tgz#f96f655088dea6fe9f79604da7615c745c64173b" - integrity sha512-Ekoet3khNg3XFLN7MIz8W31wPQISpKUGDGTylLptI+JjCDWx3PIa88xjEMqFo02WJ8sBj2NLV64Xg1sBcsHjZQ== - dependencies: - "@solana/errors" "2.3.0" - -"@solana/codecs-core@2.3.0": - version "2.3.0" - resolved "https://registry.yarnpkg.com/@solana/codecs-core/-/codecs-core-2.3.0.tgz#6bf2bb565cb1ae880f8018635c92f751465d8695" - integrity sha512-oG+VZzN6YhBHIoSKgS5ESM9VIGzhWjEHEGNPSibiDTxFhsFWxNaz8LbMDPjBUE69r9wmdGLkrQ+wVPbnJcZPvw== - dependencies: - "@solana/errors" "2.3.0" - -"@solana/codecs-data-structures@2.3.0": - version "2.3.0" - resolved "https://registry.yarnpkg.com/@solana/codecs-data-structures/-/codecs-data-structures-2.3.0.tgz#ae4ea2b3177d79a95fdcde20c04fde93b9fd190d" - integrity sha512-qvU5LE5DqEdYMYgELRHv+HMOx73sSoV1ZZkwIrclwUmwTbTaH8QAJURBj0RhQ/zCne7VuLLOZFFGv6jGigWhSw== - dependencies: - "@solana/codecs-core" "2.3.0" - "@solana/codecs-numbers" "2.3.0" - "@solana/errors" "2.3.0" - -"@solana/codecs-numbers@2.3.0": - version "2.3.0" - resolved "https://registry.yarnpkg.com/@solana/codecs-numbers/-/codecs-numbers-2.3.0.tgz#ac7e7f38aaf7fcd22ce2061fbdcd625e73828dc6" - integrity sha512-jFvvwKJKffvG7Iz9dmN51OGB7JBcy2CJ6Xf3NqD/VP90xak66m/Lg48T01u5IQ/hc15mChVHiBm+HHuOFDUrQg== - dependencies: - "@solana/codecs-core" "2.3.0" - "@solana/errors" "2.3.0" - -"@solana/codecs-strings@2.3.0": - version "2.3.0" - resolved "https://registry.yarnpkg.com/@solana/codecs-strings/-/codecs-strings-2.3.0.tgz#1b3a855dcd260283a732060aa6220f78b41251ae" - integrity sha512-y5pSBYwzVziXu521hh+VxqUtp0hYGTl1eWGoc1W+8mdvBdC1kTqm/X7aYQw33J42hw03JjryvYOvmGgk3Qz/Ug== - dependencies: - "@solana/codecs-core" "2.3.0" - "@solana/codecs-numbers" "2.3.0" - "@solana/errors" "2.3.0" - -"@solana/codecs@2.3.0": - version "2.3.0" - resolved "https://registry.yarnpkg.com/@solana/codecs/-/codecs-2.3.0.tgz#75ea5811e2792d7344409b83ffbfd1d096292e36" - integrity sha512-JVqGPkzoeyU262hJGdH64kNLH0M+Oew2CIPOa/9tR3++q2pEd4jU2Rxdfye9sd0Ce3XJrR5AIa8ZfbyQXzjh+g== - dependencies: - "@solana/codecs-core" "2.3.0" - "@solana/codecs-data-structures" "2.3.0" - "@solana/codecs-numbers" "2.3.0" - "@solana/codecs-strings" "2.3.0" - "@solana/options" "2.3.0" - -"@solana/errors@2.3.0": - version "2.3.0" - resolved "https://registry.yarnpkg.com/@solana/errors/-/errors-2.3.0.tgz#4ac9380343dbeffb9dffbcb77c28d0e457c5fa31" - integrity sha512-66RI9MAbwYV0UtP7kGcTBVLxJgUxoZGm8Fbc0ah+lGiAw17Gugco6+9GrJCV83VyF2mDWyYnYM9qdI3yjgpnaQ== - dependencies: - chalk "^5.4.1" - commander "^14.0.0" - -"@solana/fast-stable-stringify@2.3.0": - version "2.3.0" - resolved "https://registry.yarnpkg.com/@solana/fast-stable-stringify/-/fast-stable-stringify-2.3.0.tgz#723b94e373952bad4549bdd2318f79f46313d85a" - integrity sha512-KfJPrMEieUg6D3hfQACoPy0ukrAV8Kio883llt/8chPEG3FVTX9z/Zuf4O01a15xZmBbmQ7toil2Dp0sxMJSxw== - -"@solana/functional@2.3.0": - version "2.3.0" - resolved "https://registry.yarnpkg.com/@solana/functional/-/functional-2.3.0.tgz#ac33815655e954bb78151446a571bc6c9fd9be28" - integrity sha512-AgsPh3W3tE+nK3eEw/W9qiSfTGwLYEvl0rWaxHht/lRcuDVwfKRzeSa5G79eioWFFqr+pTtoCr3D3OLkwKz02Q== - -"@solana/instructions@2.3.0": - version "2.3.0" - resolved "https://registry.yarnpkg.com/@solana/instructions/-/instructions-2.3.0.tgz#ff25cbe545000a33fb3604d83f4e2b683de94ad3" - integrity sha512-PLMsmaIKu7hEAzyElrk2T7JJx4D+9eRwebhFZpy2PXziNSmFF929eRHKUsKqBFM3cYR1Yy3m6roBZfA+bGE/oQ== - dependencies: - "@solana/codecs-core" "2.3.0" - "@solana/errors" "2.3.0" - -"@solana/keys@2.3.0": - version "2.3.0" - resolved "https://registry.yarnpkg.com/@solana/keys/-/keys-2.3.0.tgz#9d0b0ec09c2789a051b4df1945ed52631261186e" - integrity sha512-ZVVdga79pNH+2pVcm6fr2sWz9HTwfopDVhYb0Lh3dh+WBmJjwkabXEIHey2rUES7NjFa/G7sV8lrUn/v8LDCCQ== - dependencies: - "@solana/assertions" "2.3.0" - "@solana/codecs-core" "2.3.0" - "@solana/codecs-strings" "2.3.0" - "@solana/errors" "2.3.0" - "@solana/nominal-types" "2.3.0" - -"@solana/kit@^2.1.1": - version "2.3.0" - resolved "https://registry.yarnpkg.com/@solana/kit/-/kit-2.3.0.tgz#92deb7c4883293617209aecac9a43d5e41ccf092" - integrity sha512-sb6PgwoW2LjE5oTFu4lhlS/cGt/NB3YrShEyx7JgWFWysfgLdJnhwWThgwy/4HjNsmtMrQGWVls0yVBHcMvlMQ== - dependencies: - "@solana/accounts" "2.3.0" - "@solana/addresses" "2.3.0" - "@solana/codecs" "2.3.0" - "@solana/errors" "2.3.0" - "@solana/functional" "2.3.0" - "@solana/instructions" "2.3.0" - "@solana/keys" "2.3.0" - "@solana/programs" "2.3.0" - "@solana/rpc" "2.3.0" - "@solana/rpc-parsed-types" "2.3.0" - "@solana/rpc-spec-types" "2.3.0" - "@solana/rpc-subscriptions" "2.3.0" - "@solana/rpc-types" "2.3.0" - "@solana/signers" "2.3.0" - "@solana/sysvars" "2.3.0" - "@solana/transaction-confirmation" "2.3.0" - "@solana/transaction-messages" "2.3.0" - "@solana/transactions" "2.3.0" - -"@solana/nominal-types@2.3.0": - version "2.3.0" - resolved "https://registry.yarnpkg.com/@solana/nominal-types/-/nominal-types-2.3.0.tgz#b67637241b4a45c756464e049c7a830880b6e944" - integrity sha512-uKlMnlP4PWW5UTXlhKM8lcgIaNj8dvd8xO4Y9l+FVvh9RvW2TO0GwUO6JCo7JBzCB0PSqRJdWWaQ8pu1Ti/OkA== - -"@solana/options@2.3.0": - version "2.3.0" - resolved "https://registry.yarnpkg.com/@solana/options/-/options-2.3.0.tgz#f8a967b9ebae703b2c8adb8f4294df303ab866e8" - integrity sha512-PPnnZBRCWWoZQ11exPxf//DRzN2C6AoFsDI/u2AsQfYih434/7Kp4XLpfOMT/XESi+gdBMFNNfbES5zg3wAIkw== - dependencies: - "@solana/codecs-core" "2.3.0" - "@solana/codecs-data-structures" "2.3.0" - "@solana/codecs-numbers" "2.3.0" - "@solana/codecs-strings" "2.3.0" - "@solana/errors" "2.3.0" - -"@solana/programs@2.3.0": - version "2.3.0" - resolved "https://registry.yarnpkg.com/@solana/programs/-/programs-2.3.0.tgz#344193a0a4443217c177e2ec21bac7bc52afe4da" - integrity sha512-UXKujV71VCI5uPs+cFdwxybtHZAIZyQkqDiDnmK+DawtOO9mBn4Nimdb/6RjR2CXT78mzO9ZCZ3qfyX+ydcB7w== - dependencies: - "@solana/addresses" "2.3.0" - "@solana/errors" "2.3.0" - -"@solana/promises@2.3.0": - version "2.3.0" - resolved "https://registry.yarnpkg.com/@solana/promises/-/promises-2.3.0.tgz#ae3fc000f4aef65561d9e4f9724d4635ed042750" - integrity sha512-GjVgutZKXVuojd9rWy1PuLnfcRfqsaCm7InCiZc8bqmJpoghlyluweNc7ml9Y5yQn1P2IOyzh9+p/77vIyNybQ== - -"@solana/rpc-api@2.3.0": - version "2.3.0" - resolved "https://registry.yarnpkg.com/@solana/rpc-api/-/rpc-api-2.3.0.tgz#c6e5f7353910bd7c7d2f8a6d4dab44d080bd313a" - integrity sha512-UUdiRfWoyYhJL9PPvFeJr4aJ554ob2jXcpn4vKmRVn9ire0sCbpQKYx6K8eEKHZWXKrDW8IDspgTl0gT/aJWVg== - dependencies: - "@solana/addresses" "2.3.0" - "@solana/codecs-core" "2.3.0" - "@solana/codecs-strings" "2.3.0" - "@solana/errors" "2.3.0" - "@solana/keys" "2.3.0" - "@solana/rpc-parsed-types" "2.3.0" - "@solana/rpc-spec" "2.3.0" - "@solana/rpc-transformers" "2.3.0" - "@solana/rpc-types" "2.3.0" - "@solana/transaction-messages" "2.3.0" - "@solana/transactions" "2.3.0" - -"@solana/rpc-parsed-types@2.3.0": - version "2.3.0" - resolved "https://registry.yarnpkg.com/@solana/rpc-parsed-types/-/rpc-parsed-types-2.3.0.tgz#132b03f6b4c1b4688336ad48e76c2eea0d8c91d7" - integrity sha512-B5pHzyEIbBJf9KHej+zdr5ZNAdSvu7WLU2lOUPh81KHdHQs6dEb310LGxcpCc7HVE8IEdO20AbckewDiAN6OCg== - -"@solana/rpc-spec-types@2.3.0": - version "2.3.0" - resolved "https://registry.yarnpkg.com/@solana/rpc-spec-types/-/rpc-spec-types-2.3.0.tgz#010ea9de2f720e84bec2b93ca77ad3664b77235f" - integrity sha512-xQsb65lahjr8Wc9dMtP7xa0ZmDS8dOE2ncYjlvfyw/h4mpdXTUdrSMi6RtFwX33/rGuztQ7Hwaid5xLNSLvsFQ== - -"@solana/rpc-spec@2.3.0": - version "2.3.0" - resolved "https://registry.yarnpkg.com/@solana/rpc-spec/-/rpc-spec-2.3.0.tgz#2b679eb750c0f9270da6d451ea1bdc2c7783eb42" - integrity sha512-fA2LMX4BMixCrNB2n6T83AvjZ3oUQTu7qyPLyt8gHQaoEAXs8k6GZmu6iYcr+FboQCjUmRPgMaABbcr9j2J9Sw== - dependencies: - "@solana/errors" "2.3.0" - "@solana/rpc-spec-types" "2.3.0" - -"@solana/rpc-subscriptions-api@2.3.0": - version "2.3.0" - resolved "https://registry.yarnpkg.com/@solana/rpc-subscriptions-api/-/rpc-subscriptions-api-2.3.0.tgz#e779b8ad10e89b2f4a4ccb0fcd1a722d8bdd7729" - integrity sha512-9mCjVbum2Hg9KGX3LKsrI5Xs0KX390lS+Z8qB80bxhar6MJPugqIPH8uRgLhCW9GN3JprAfjRNl7our8CPvsPQ== - dependencies: - "@solana/addresses" "2.3.0" - "@solana/keys" "2.3.0" - "@solana/rpc-subscriptions-spec" "2.3.0" - "@solana/rpc-transformers" "2.3.0" - "@solana/rpc-types" "2.3.0" - "@solana/transaction-messages" "2.3.0" - "@solana/transactions" "2.3.0" - -"@solana/rpc-subscriptions-channel-websocket@2.3.0": - version "2.3.0" - resolved "https://registry.yarnpkg.com/@solana/rpc-subscriptions-channel-websocket/-/rpc-subscriptions-channel-websocket-2.3.0.tgz#11352ed281eccfa89a782a1b27444613ebeacca4" - integrity sha512-2oL6ceFwejIgeWzbNiUHI2tZZnaOxNTSerszcin7wYQwijxtpVgUHiuItM/Y70DQmH9sKhmikQp+dqeGalaJxw== - dependencies: - "@solana/errors" "2.3.0" - "@solana/functional" "2.3.0" - "@solana/rpc-subscriptions-spec" "2.3.0" - "@solana/subscribable" "2.3.0" - -"@solana/rpc-subscriptions-spec@2.3.0": - version "2.3.0" - resolved "https://registry.yarnpkg.com/@solana/rpc-subscriptions-spec/-/rpc-subscriptions-spec-2.3.0.tgz#a718a4ea97f57ed62291526b70740a42d576fada" - integrity sha512-rdmVcl4PvNKQeA2l8DorIeALCgJEMSu7U8AXJS1PICeb2lQuMeaR+6cs/iowjvIB0lMVjYN2sFf6Q3dJPu6wWg== - dependencies: - "@solana/errors" "2.3.0" - "@solana/promises" "2.3.0" - "@solana/rpc-spec-types" "2.3.0" - "@solana/subscribable" "2.3.0" - -"@solana/rpc-subscriptions@2.3.0": - version "2.3.0" - resolved "https://registry.yarnpkg.com/@solana/rpc-subscriptions/-/rpc-subscriptions-2.3.0.tgz#12639c17603e1a30113825350ddbfc3b50b6a031" - integrity sha512-Uyr10nZKGVzvCOqwCZgwYrzuoDyUdwtgQRefh13pXIrdo4wYjVmoLykH49Omt6abwStB0a4UL5gX9V4mFdDJZg== - dependencies: - "@solana/errors" "2.3.0" - "@solana/fast-stable-stringify" "2.3.0" - "@solana/functional" "2.3.0" - "@solana/promises" "2.3.0" - "@solana/rpc-spec-types" "2.3.0" - "@solana/rpc-subscriptions-api" "2.3.0" - "@solana/rpc-subscriptions-channel-websocket" "2.3.0" - "@solana/rpc-subscriptions-spec" "2.3.0" - "@solana/rpc-transformers" "2.3.0" - "@solana/rpc-types" "2.3.0" - "@solana/subscribable" "2.3.0" - -"@solana/rpc-transformers@2.3.0": - version "2.3.0" - resolved "https://registry.yarnpkg.com/@solana/rpc-transformers/-/rpc-transformers-2.3.0.tgz#e008d2782047d574dbc74985c6cce26d7c3555f3" - integrity sha512-UuHYK3XEpo9nMXdjyGKkPCOr7WsZsxs7zLYDO1A5ELH3P3JoehvrDegYRAGzBS2VKsfApZ86ZpJToP0K3PhmMA== - dependencies: - "@solana/errors" "2.3.0" - "@solana/functional" "2.3.0" - "@solana/nominal-types" "2.3.0" - "@solana/rpc-spec-types" "2.3.0" - "@solana/rpc-types" "2.3.0" - -"@solana/rpc-transport-http@2.3.0": - version "2.3.0" - resolved "https://registry.yarnpkg.com/@solana/rpc-transport-http/-/rpc-transport-http-2.3.0.tgz#581601b9579b2a7fed9e0cb6fbcb95b4186e5b49" - integrity sha512-HFKydmxGw8nAF5N+S0NLnPBDCe5oMDtI2RAmW8DMqP4U3Zxt2XWhvV1SNkAldT5tF0U1vP+is6fHxyhk4xqEvg== - dependencies: - "@solana/errors" "2.3.0" - "@solana/rpc-spec" "2.3.0" - "@solana/rpc-spec-types" "2.3.0" - undici-types "^7.11.0" - -"@solana/rpc-types@2.3.0", "@solana/rpc-types@^2.1.1": - version "2.3.0" - resolved "https://registry.yarnpkg.com/@solana/rpc-types/-/rpc-types-2.3.0.tgz#38adf5cb1c79c08086bd672edf7a56d19581d19f" - integrity sha512-O09YX2hED2QUyGxrMOxQ9GzH1LlEwwZWu69QbL4oYmIf6P5dzEEHcqRY6L1LsDVqc/dzAdEs/E1FaPrcIaIIPw== - dependencies: - "@solana/addresses" "2.3.0" - "@solana/codecs-core" "2.3.0" - "@solana/codecs-numbers" "2.3.0" - "@solana/codecs-strings" "2.3.0" - "@solana/errors" "2.3.0" - "@solana/nominal-types" "2.3.0" - -"@solana/rpc@2.3.0": - version "2.3.0" - resolved "https://registry.yarnpkg.com/@solana/rpc/-/rpc-2.3.0.tgz#a65919520d14c122625fb887a2d72c95bf8691cf" - integrity sha512-ZWN76iNQAOCpYC7yKfb3UNLIMZf603JckLKOOLTHuy9MZnTN8XV6uwvDFhf42XvhglgUjGCEnbUqWtxQ9pa/pQ== - dependencies: - "@solana/errors" "2.3.0" - "@solana/fast-stable-stringify" "2.3.0" - "@solana/functional" "2.3.0" - "@solana/rpc-api" "2.3.0" - "@solana/rpc-spec" "2.3.0" - "@solana/rpc-spec-types" "2.3.0" - "@solana/rpc-transformers" "2.3.0" - "@solana/rpc-transport-http" "2.3.0" - "@solana/rpc-types" "2.3.0" - -"@solana/signers@2.3.0": - version "2.3.0" - resolved "https://registry.yarnpkg.com/@solana/signers/-/signers-2.3.0.tgz#94569a7fb025a3f473661078fbca15b34ceacf94" - integrity sha512-OSv6fGr/MFRx6J+ZChQMRqKNPGGmdjkqarKkRzkwmv7v8quWsIRnJT5EV8tBy3LI4DLO/A8vKiNSPzvm1TdaiQ== - dependencies: - "@solana/addresses" "2.3.0" - "@solana/codecs-core" "2.3.0" - "@solana/errors" "2.3.0" - "@solana/instructions" "2.3.0" - "@solana/keys" "2.3.0" - "@solana/nominal-types" "2.3.0" - "@solana/transaction-messages" "2.3.0" - "@solana/transactions" "2.3.0" - -"@solana/subscribable@2.3.0": - version "2.3.0" - resolved "https://registry.yarnpkg.com/@solana/subscribable/-/subscribable-2.3.0.tgz#4e48f1a4eeb1ccf22065b46fb8e3ed80d1a27f80" - integrity sha512-DkgohEDbMkdTWiKAoatY02Njr56WXx9e/dKKfmne8/Ad6/2llUIrax78nCdlvZW9quXMaXPTxZvdQqo9N669Og== - dependencies: - "@solana/errors" "2.3.0" - -"@solana/sysvars@2.3.0": - version "2.3.0" - resolved "https://registry.yarnpkg.com/@solana/sysvars/-/sysvars-2.3.0.tgz#eeea82f89716682014e801de5870344ddd02becd" - integrity sha512-LvjADZrpZ+CnhlHqfI5cmsRzX9Rpyb1Ox2dMHnbsRNzeKAMhu9w4ZBIaeTdO322zsTr509G1B+k2ABD3whvUBA== - dependencies: - "@solana/accounts" "2.3.0" - "@solana/codecs" "2.3.0" - "@solana/errors" "2.3.0" - "@solana/rpc-types" "2.3.0" - -"@solana/transaction-confirmation@2.3.0": - version "2.3.0" - resolved "https://registry.yarnpkg.com/@solana/transaction-confirmation/-/transaction-confirmation-2.3.0.tgz#f66e70334d797b5010b4ae27dc59de2f90b8ebe6" - integrity sha512-UiEuiHCfAAZEKdfne/XljFNJbsKAe701UQHKXEInYzIgBjRbvaeYZlBmkkqtxwcasgBTOmEaEKT44J14N9VZDw== - dependencies: - "@solana/addresses" "2.3.0" - "@solana/codecs-strings" "2.3.0" - "@solana/errors" "2.3.0" - "@solana/keys" "2.3.0" - "@solana/promises" "2.3.0" - "@solana/rpc" "2.3.0" - "@solana/rpc-subscriptions" "2.3.0" - "@solana/rpc-types" "2.3.0" - "@solana/transaction-messages" "2.3.0" - "@solana/transactions" "2.3.0" - -"@solana/transaction-messages@2.3.0": - version "2.3.0" - resolved "https://registry.yarnpkg.com/@solana/transaction-messages/-/transaction-messages-2.3.0.tgz#e2a9c2f5565c7cc720aa09816aa3c17fb79c2abc" - integrity sha512-bgqvWuy3MqKS5JdNLH649q+ngiyOu5rGS3DizSnWwYUd76RxZl1kN6CoqHSrrMzFMvis6sck/yPGG3wqrMlAww== - dependencies: - "@solana/addresses" "2.3.0" - "@solana/codecs-core" "2.3.0" - "@solana/codecs-data-structures" "2.3.0" - "@solana/codecs-numbers" "2.3.0" - "@solana/errors" "2.3.0" - "@solana/functional" "2.3.0" - "@solana/instructions" "2.3.0" - "@solana/nominal-types" "2.3.0" - "@solana/rpc-types" "2.3.0" - -"@solana/transactions@2.3.0": - version "2.3.0" - resolved "https://registry.yarnpkg.com/@solana/transactions/-/transactions-2.3.0.tgz#fc99f6ce6cc5706f2b8116bbf8a2f396c3ec3177" - integrity sha512-LnTvdi8QnrQtuEZor5Msje61sDpPstTVwKg4y81tNxDhiyomjuvnSNLAq6QsB9gIxUqbNzPZgOG9IU4I4/Uaug== - dependencies: - "@solana/addresses" "2.3.0" - "@solana/codecs-core" "2.3.0" - "@solana/codecs-data-structures" "2.3.0" - "@solana/codecs-numbers" "2.3.0" - "@solana/codecs-strings" "2.3.0" - "@solana/errors" "2.3.0" - "@solana/functional" "2.3.0" - "@solana/instructions" "2.3.0" - "@solana/keys" "2.3.0" - "@solana/nominal-types" "2.3.0" - "@solana/rpc-types" "2.3.0" - "@solana/transaction-messages" "2.3.0" - -"@stellar/js-xdr@^3.1.2": - version "3.1.2" - resolved "https://registry.yarnpkg.com/@stellar/js-xdr/-/js-xdr-3.1.2.tgz#db7611135cf21e989602fd72f513c3bed621bc74" - integrity sha512-VVolPL5goVEIsvuGqDc5uiKxV03lzfWdvYg1KikvwheDmTBO68CKDji3bAZ/kppZrx5iTA8z3Ld5yuytcvhvOQ== - -"@stellar/stellar-base@^13.1.0": - version "13.1.0" - resolved "https://registry.yarnpkg.com/@stellar/stellar-base/-/stellar-base-13.1.0.tgz#06d9075cc72da05bc5dd6f1971e6682a0525cec9" - integrity sha512-90EArG+eCCEzDGj3OJNoCtwpWDwxjv+rs/RNPhvg4bulpjN/CSRj+Ys/SalRcfM4/WRC5/qAfjzmJBAuquWhkA== +"@sentry/minimal@6.19.7": + version "6.19.7" + resolved "https://registry.yarnpkg.com/@sentry/minimal/-/minimal-6.19.7.tgz#b3ee46d6abef9ef3dd4837ebcb6bdfd01b9aa7b4" + integrity sha512-wcYmSJOdvk6VAPx8IcmZgN08XTXRwRtB1aOLZm+MVHjIZIhHoBGZJYTVQS/BWjldsamj2cX3YGbGXNunaCfYJQ== dependencies: - "@stellar/js-xdr" "^3.1.2" - base32.js "^0.1.0" - bignumber.js "^9.1.2" - buffer "^6.0.3" - sha.js "^2.3.6" - tweetnacl "^1.0.3" - optionalDependencies: - sodium-native "^4.3.3" - -"@stellar/stellar-sdk@^13.3.0": - version "13.3.0" - resolved "https://registry.yarnpkg.com/@stellar/stellar-sdk/-/stellar-sdk-13.3.0.tgz#72bf3eea4797de053aaebb889bf4de342d0b6b54" - integrity sha512-8+GHcZLp+mdin8gSjcgfb/Lb6sSMYRX6Nf/0LcSJxvjLQR0XHpjGzOiRbYb2jSXo51EnA6kAV5j+4Pzh5OUKUg== - dependencies: - "@stellar/stellar-base" "^13.1.0" - axios "^1.8.4" - bignumber.js "^9.3.0" - eventsource "^2.0.2" - feaxios "^0.0.23" - randombytes "^2.1.0" - toml "^3.0.0" - urijs "^1.19.1" + "@sentry/hub" "6.19.7" + "@sentry/types" "6.19.7" + tslib "^1.9.3" -"@szmarczak/http-timer@^4.0.5": - version "4.0.6" - resolved "https://registry.yarnpkg.com/@szmarczak/http-timer/-/http-timer-4.0.6.tgz#b4a914bb62e7c272d4e5989fe4440f812ab1d807" - integrity sha512-4BAffykYOgO+5nzBWYwE3W90sBgLJoUPRWWcL8wlyiM8IB8ipJz3UMJ9KXQd1RKQXpKp8Tutn80HZtWsu2u76w== - dependencies: - defer-to-connect "^2.0.0" +"@sentry/types@6.19.7": + version "6.19.7" + resolved "https://registry.yarnpkg.com/@sentry/types/-/types-6.19.7.tgz#c6b337912e588083fc2896eb012526cf7cfec7c7" + integrity sha512-jH84pDYE+hHIbVnab3Hr+ZXr1v8QABfhx39KknxqKWr2l0oEItzepV0URvbEhB446lk/S/59230dlUUIBGsXbg== -"@szmarczak/http-timer@^5.0.1": - version "5.0.1" - resolved "https://registry.yarnpkg.com/@szmarczak/http-timer/-/http-timer-5.0.1.tgz#c7c1bf1141cdd4751b0399c8fc7b8b664cd5be3a" - integrity sha512-+PmQX0PiAYPMeVYe237LJAYvOMYW1j2rH5YROyS3b4CTVJum34HfRvKvAzozHAQG0TnHNdUfY9nCeUyRAs//cw== +"@sentry/utils@6.19.7": + version "6.19.7" + resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-6.19.7.tgz#6edd739f8185fd71afe49cbe351c1bbf5e7b7c79" + integrity sha512-z95ECmE3i9pbWoXQrD/7PgkBAzJYR+iXtPuTkpBjDKs86O3mT+PXOT3BAn79w2wkn7/i3vOGD2xVr1uiMl26dA== dependencies: - defer-to-connect "^2.0.1" + "@sentry/types" "6.19.7" + tslib "^1.9.3" -"@trezor/analytics@1.4.2": - version "1.4.2" - resolved "https://registry.yarnpkg.com/@trezor/analytics/-/analytics-1.4.2.tgz#4eb7a8ed8687ebbc2993659eb1b31e89e3bdeda5" - integrity sha512-FgjJekuDvx1TjiDemvpnPiRck7Kp/v1ZeppsBYpQR3yGKyKzbG1pVpcl0RyI2237raXxbORaz7XV8tcyjq4BXg== - dependencies: - "@trezor/env-utils" "1.4.2" - "@trezor/utils" "9.4.2" +"@sidhujag/sysweb3-core@^1.0.29": + version "1.0.29" + resolved "https://registry.yarnpkg.com/@sidhujag/sysweb3-core/-/sysweb3-core-1.0.29.tgz" -"@trezor/blockchain-link-types@1.4.2": - version "1.4.2" - resolved "https://registry.yarnpkg.com/@trezor/blockchain-link-types/-/blockchain-link-types-1.4.2.tgz#ccdcdbee6eb5789ee60978930fd181212f867798" - integrity sha512-KThBmGOFLJAFnmou9ThQhnjEVxfYPfEwMOaVTVNgJ+NAkt5rEMx0SKBBelCGZ63XtOLWdVPglFo83wtm+I9Vpg== +"@sidhujag/sysweb3-network@^1.0.109": + version "1.0.109" + resolved "https://registry.yarnpkg.com/@sidhujag/sysweb3-network/-/sysweb3-network-1.0.109.tgz#dc25e4e0938403ef18661d7874d2d8186be7ee98" + integrity sha512-ivHoiFMNeCeOIqMofDF0o9+zrEP1Zgq+IoIXGLdqltUoZluQb78ga63mKTeGivZjy3GZ6niMBFVIeSSSFswDog== dependencies: - "@trezor/utxo-lib" "2.4.2" - -"@trezor/blockchain-link-utils@1.4.2": - version "1.4.2" - resolved "https://registry.yarnpkg.com/@trezor/blockchain-link-utils/-/blockchain-link-utils-1.4.2.tgz#56884209e8111cee91d4bd20f4e728fcaec38eb4" - integrity sha512-PBEBrdtHn0dn/c9roW6vjdHI/CucMywJm5gthETZAZmzBOtg6ZDpLTn+qL8+jZGIbwcAkItrQ3iHrHhR6xTP5g== - dependencies: - "@mobily/ts-belt" "^3.13.1" - "@stellar/stellar-sdk" "^13.3.0" - "@trezor/env-utils" "1.4.2" - "@trezor/utils" "9.4.2" - xrpl "^4.3.0" - -"@trezor/blockchain-link@2.5.2": - version "2.5.2" - resolved "https://registry.yarnpkg.com/@trezor/blockchain-link/-/blockchain-link-2.5.2.tgz#dc4cfc13638674c96d91a553eb92a8c82c1456b1" - integrity sha512-/egUnIt/fR57QY33ejnkPMhZwRvVRS/pUCoqdVIGitN1Q7QZsdopoR4hw37hdK/Ux/q1ZLH6LZz7U2UFahjppw== - dependencies: - "@solana-program/stake" "^0.2.1" - "@solana-program/token" "^0.5.1" - "@solana-program/token-2022" "^0.4.2" - "@solana/kit" "^2.1.1" - "@solana/rpc-types" "^2.1.1" - "@stellar/stellar-sdk" "^13.3.0" - "@trezor/blockchain-link-types" "1.4.2" - "@trezor/blockchain-link-utils" "1.4.2" - "@trezor/env-utils" "1.4.2" - "@trezor/utils" "9.4.2" - "@trezor/utxo-lib" "2.4.2" - "@trezor/websocket-client" "1.2.2" - "@types/web" "^0.0.197" - events "^3.3.0" - socks-proxy-agent "8.0.5" - xrpl "^4.3.0" - -"@trezor/connect-analytics@1.3.5": - version "1.3.5" - resolved "https://registry.yarnpkg.com/@trezor/connect-analytics/-/connect-analytics-1.3.5.tgz#d965ac376268de1cd80a881df3f6ec4c8d04952d" - integrity sha512-Aoi+EITpZZycnELQJEp9XV0mHFfaCQ6JE0Ka5mWuHtOny3nJdFLBrih4ipcEXJdJbww6pBxRJB09sJ19cTyacA== - dependencies: - "@trezor/analytics" "1.4.2" - -"@trezor/connect-common@0.4.2": - version "0.4.2" - resolved "https://registry.yarnpkg.com/@trezor/connect-common/-/connect-common-0.4.2.tgz#472e8e46c09c0e0879c25739809d0e55c1437d3d" - integrity sha512-ND5TTjrTPnJdfl8Wlhl9YtFWnY2u6FHM1dsPkNYCmyUKIMoflJ5cLn95Xabl6l1btHERYn3wTUvgEYQG7r8OVQ== - dependencies: - "@trezor/env-utils" "1.4.2" - "@trezor/utils" "9.4.2" - -"@trezor/connect-web@9.6.2", "@trezor/connect-web@^9.1.5": - version "9.6.2" - resolved "https://registry.yarnpkg.com/@trezor/connect-web/-/connect-web-9.6.2.tgz#bcbb423447e4f4cd0bcbabdf385d80f2eb7fb06c" - integrity sha512-QGuCjX8Bx9aCq1Pg52KifbbzYn00FQu9mCTDSgCVGH/HAzbxhcRkDKc86kFwW8z9NdJxw+XeVJq5Ky/js3iEDA== - dependencies: - "@trezor/connect" "9.6.2" - "@trezor/connect-common" "0.4.2" - "@trezor/utils" "9.4.2" - "@trezor/websocket-client" "1.2.2" - -"@trezor/connect-webextension@^9.6.2": - version "9.6.2" - resolved "https://registry.yarnpkg.com/@trezor/connect-webextension/-/connect-webextension-9.6.2.tgz#49283e6a38a0b73404ffacd411f2a207bd7799bc" - integrity sha512-IxKa2zjd+xth5/bpncE7uNU93q7+1pELHFOGejlJexdtZ0qvAGF5IY763oBAgNthkox0XH34e4Trrwuv5VoBqQ== - dependencies: - "@trezor/connect" "9.6.2" - "@trezor/connect-web" "9.6.2" - -"@trezor/connect@9.6.2": - version "9.6.2" - resolved "https://registry.yarnpkg.com/@trezor/connect/-/connect-9.6.2.tgz#4d48a0bc8f571a8e4c8cdd11fd2d75652c697c8b" - integrity sha512-XsSERBK+KnF6FPsATuhB9AEM0frekVLwAwFo35MRV9I4P+mdv6tnUiZUq8O8aoPbfJwDjtNJSYv+PMsKuRH6rg== - dependencies: - "@ethereumjs/common" "^10.0.0" - "@ethereumjs/tx" "^10.0.0" - "@fivebinaries/coin-selection" "3.0.0" - "@mobily/ts-belt" "^3.13.1" - "@noble/hashes" "^1.6.1" - "@scure/bip39" "^1.5.1" - "@solana-program/compute-budget" "^0.8.0" - "@solana-program/system" "^0.7.0" - "@solana-program/token" "^0.5.1" - "@solana-program/token-2022" "^0.4.2" - "@solana/kit" "^2.1.1" - "@trezor/blockchain-link" "2.5.2" - "@trezor/blockchain-link-types" "1.4.2" - "@trezor/blockchain-link-utils" "1.4.2" - "@trezor/connect-analytics" "1.3.5" - "@trezor/connect-common" "0.4.2" - "@trezor/crypto-utils" "1.1.4" - "@trezor/device-utils" "1.1.2" - "@trezor/env-utils" "^1.4.2" - "@trezor/protobuf" "1.4.2" - "@trezor/protocol" "1.2.8" - "@trezor/schema-utils" "1.3.4" - "@trezor/transport" "1.5.2" - "@trezor/type-utils" "1.1.8" - "@trezor/utils" "9.4.2" - "@trezor/utxo-lib" "2.4.2" - blakejs "^1.2.1" - bs58 "^6.0.0" - bs58check "^4.0.0" - cross-fetch "^4.0.0" - jws "^4.0.0" - -"@trezor/crypto-utils@1.1.4": - version "1.1.4" - resolved "https://registry.yarnpkg.com/@trezor/crypto-utils/-/crypto-utils-1.1.4.tgz#86ebde3ff745d3672f4ed475f00ee68d2ff05e43" - integrity sha512-Y6VziniqMPoMi70IyowEuXKqRvBYQzgPAekJaUZTHhR+grtYNRKRH2HJCvuZ8MGmSKUFSYfa7y8AvwALA8mQmA== - -"@trezor/device-utils@1.1.2": - version "1.1.2" - resolved "https://registry.yarnpkg.com/@trezor/device-utils/-/device-utils-1.1.2.tgz#541c2bf623b7acda7e445b876336a0579da0c504" - integrity sha512-R3AJvAo+a3wYVmcGZO2VNl9PZOmDEzCZIlmCJn0BlSRWWd8G9u1qyo/fL9zOwij/YhCaJyokmSHmIEmbY9qpgw== + eth-chains "^1.0.0" + ethers "^6.17.0" -"@trezor/env-utils@1.4.2", "@trezor/env-utils@^1.4.2": - version "1.4.2" - resolved "https://registry.yarnpkg.com/@trezor/env-utils/-/env-utils-1.4.2.tgz#b1608e98a975f2a071c9005a30b606f5a5a8cd00" - integrity sha512-lQvrqcNK5I4dy2MuiLyMuEm0KzY59RIu2GLtc9GsvqyxSPZkADqVzGeLJjXj/vI2ajL8leSpMvmN4zPw3EK8AA== +"@sidhujag/sysweb3-utils@^1.1.280": + version "1.1.280" + resolved "https://registry.yarnpkg.com/@sidhujag/sysweb3-utils/-/sysweb3-utils-1.1.280.tgz#1a29c758e7dd40fbe18a9ad9f8cd5afc319c5656" + integrity sha512-q/bEBhIW9HLoX0WoDQ1LId6zqEBlLioqkir8B0JafCGBFUX9PkzUVrck+7tMLJNlL/rj/q3MY86ZjKphdsWARg== dependencies: - ua-parser-js "^2.0.4" - -"@trezor/protobuf@1.4.2": - version "1.4.2" - resolved "https://registry.yarnpkg.com/@trezor/protobuf/-/protobuf-1.4.2.tgz#92a1732262f991fea911eec1b21010c6806b430a" - integrity sha512-AeIYKCgKcE9cWflggGL8T9gD+IZLSGrwkzqCk3wpIiODd5dUCgEgA4OPBufR6OMu3RWu/Tgu2xviHunijG3LXQ== - dependencies: - "@trezor/schema-utils" "1.3.4" - long "5.2.5" - protobufjs "7.4.0" - -"@trezor/protocol@1.2.8": - version "1.2.8" - resolved "https://registry.yarnpkg.com/@trezor/protocol/-/protocol-1.2.8.tgz#3980018b4c5c3d2b126fb17cd11d26b575b9f1ce" - integrity sha512-8EH+EU4Z1j9X4Ljczjbl9G7vVgcUz41qXcdE+6FOG3BFvMDK4KUVvaOtWqD+1dFpeo5yvWSTEKdhgXMPFprWYQ== - -"@trezor/schema-utils@1.3.4": - version "1.3.4" - resolved "https://registry.yarnpkg.com/@trezor/schema-utils/-/schema-utils-1.3.4.tgz#6ebd17aadf9534c1054e852d44e3c351bb919a79" - integrity sha512-guP5TKjQEWe6c5HGx+7rhM0SAdEL5gylpkvk9XmJXjZDnl1Ew81nmLHUs2ghf8Od3pKBe4qjBIMBHUQNaOqWUg== - dependencies: - "@sinclair/typebox" "^0.33.7" - ts-mixer "^6.0.3" - -"@trezor/transport@1.5.2": - version "1.5.2" - resolved "https://registry.yarnpkg.com/@trezor/transport/-/transport-1.5.2.tgz#d5373c4364546933944a76dc817c65b8660dc123" - integrity sha512-rYP87zdVll2bNBtsD3VxJq0yjaNvIClcgszZjQwVTQxpKGFPkx8bLSpAGI05R9qfxusZJCfYarjX3qki9nHYPw== - dependencies: - "@trezor/protobuf" "1.4.2" - "@trezor/protocol" "1.2.8" - "@trezor/type-utils" "1.1.8" - "@trezor/utils" "9.4.2" - cross-fetch "^4.0.0" - usb "^2.15.0" - -"@trezor/type-utils@1.1.8": - version "1.1.8" - resolved "https://registry.yarnpkg.com/@trezor/type-utils/-/type-utils-1.1.8.tgz#3cddcdfb483342459e22fa6d89a2e918da1ac718" - integrity sha512-VtvkPXpwtMtTX9caZWYlMMTmhjUeDq4/1LGn0pSdjd4OuL/vQyuPWXCT/0RtlnRraW6R2dZF7rX2UON2kQIMTQ== - -"@trezor/utils@9.0.14": - version "9.0.14" - resolved "https://registry.yarnpkg.com/@trezor/utils/-/utils-9.0.14.tgz#4a493e550ea91c2100add06180640b1bca9e75e8" - integrity sha512-9Q1LtxgAKpNDvvtQttTc/ufYHonnSJ3wmWnxPZsc1H0gn9MLV8WwRMH5+Yl3gJsUKZvcTJ5xwippVWDxPwP8Uw== - -"@trezor/utils@9.4.2": - version "9.4.2" - resolved "https://registry.yarnpkg.com/@trezor/utils/-/utils-9.4.2.tgz#8d62bea5f032b3b368a06ed97a4e942c5496a0cc" - integrity sha512-Fm3m2gmfXsgv4chqn5HX8e8dElEr2ibBJSJ7HE3bsHh/1OSQcDdzsSioAK04Fo9ws/v7n6lt+QBZ6fGmwyIkZQ== - dependencies: - bignumber.js "^9.3.0" - -"@trezor/utxo-lib@2.4.2": - version "2.4.2" - resolved "https://registry.yarnpkg.com/@trezor/utxo-lib/-/utxo-lib-2.4.2.tgz#1d2cc81863c2c89bc207ff3eb013aa1cbfde9719" - integrity sha512-dTXfBg/cEKnmHM5CLG5+0qrp6fqOfwxqe8YPACdKeM7g1XJKCGDAuFpDUVeT3lrcUsTh6bEMHM06z4H3gZp5MQ== - dependencies: - "@trezor/utils" "9.4.2" - bchaddrjs "^0.5.2" + "@sidhujag/sysweb3-network" "^1.0.109" bech32 "^2.0.0" - bip66 "^2.0.0" - bitcoin-ops "^1.4.1" - blake-hash "^2.0.0" - blakejs "^1.2.1" - bn.js "^5.2.2" - bs58 "^6.0.0" - bs58check "^4.0.0" - create-hmac "^1.1.7" - int64-buffer "^1.1.0" - pushdata-bitcoin "^1.0.1" - tiny-secp256k1 "^1.1.7" - typeforce "^1.18.0" - varuint-bitcoin "2.0.0" - wif "^5.0.0" + crypto-js "^4.1.1" + ethers "^6.17.0" + +"@sinclair/typebox@^0.27.8": + version "0.27.12" + resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.27.12.tgz#0cacd3cff047a32936b1ace47ea7c86eaab60a7f" + integrity sha512-hhyNJ+nbR6ZR7pToHvllEFun9TL0sbL+tk/ON75lo+Xas054uez98qRbsuNt7MBCyZKK4+8Yli/OAGZhmfBZ/g== + +"@sinclair/typebox@^0.34.49": + version "0.34.52" + resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.34.52.tgz#62f8a686e4ab28a8944902e2ad2d648312ef11cb" + integrity sha512-XiMQh7qqVlxZzcVD+kkGMNGMzcTrDMLWI7S4x7z1MkCkbDPrekpZXEUK0eZqZFMuHQg2a2DZOcDIh9o5v3Gonw== + +"@trezor/connect-common@10.0.1": + version "10.0.1" + resolved "https://registry.yarnpkg.com/@trezor/connect-common/-/connect-common-10.0.1.tgz#89b6cacb933017b923a9f5577f8f5632716a6ba8" + integrity sha512-sUx4mU+xNgJQNCvfDGqqNYXjPEabfyRnKKRdjFmglPjeUQGSc1o5pzVma6qQK0FvCm1jVRga8EgcLZGSPszEpw== + dependencies: + "@trezor/crypto-utils" "10.0.1" + "@trezor/device-utils" "10.0.1" + "@trezor/protobuf" "10.0.1" + "@trezor/protocol" "^10.0.1" + "@trezor/schema-utils" "10.0.1" + "@trezor/type-utils" "10.0.1" + "@trezor/utils" "10.0.1" + +"@trezor/connect-web@10.0.1": + version "10.0.1" + resolved "https://registry.yarnpkg.com/@trezor/connect-web/-/connect-web-10.0.1.tgz#825c544624c7de8c48edb2e08e801b79b4379d57" + integrity sha512-xoVHBWiO4XAVV8B/6uk5WS91LAb7OEy6p3tCIO78RxxyqSF+CEJz4ofXM3xY9l4d4Rz1VBMOtONBSuhwG/O/kQ== + dependencies: + "@trezor/connect-common" "10.0.1" + "@trezor/utils" "10.0.1" + "@trezor/websocket-client" "10.0.1" + +"@trezor/connect-webextension@10.0.1": + version "10.0.1" + resolved "https://registry.yarnpkg.com/@trezor/connect-webextension/-/connect-webextension-10.0.1.tgz#84b3440839780fd5f3ccbff0668e01b7780bb6ad" + integrity sha512-P1iKK6FjpB+rvOJkikpyNXl59GJgTTxd00BElTaElk5j4PKI67b2W69+y/EK0jHozewgWO7MtqsG2EGq+g9uPg== + dependencies: + "@trezor/connect-common" "10.0.1" + "@trezor/connect-web" "10.0.1" + +"@trezor/crypto-utils@10.0.1": + version "10.0.1" + resolved "https://registry.yarnpkg.com/@trezor/crypto-utils/-/crypto-utils-10.0.1.tgz#5c498cb7b7859275146ae27dafd07da92b0c1b4d" + integrity sha512-X1ziWMy1O8Bion/t/XXieH38ZC7+mtAOjBMQ0Cmw/GwWc7GTp48IsALBcum6X1/UpEYUCbGFp8qP0LbYlV+vyQ== + dependencies: + "@trezor/type-utils" "10.0.1" + +"@trezor/device-utils@10.0.1": + version "10.0.1" + resolved "https://registry.yarnpkg.com/@trezor/device-utils/-/device-utils-10.0.1.tgz#f85893afaa0b830de68d9c8b63eb46aa46f42bac" + integrity sha512-YdjW+Di53CBESiOaEj6bBlzZR/QG8hqJ5fHeU3qN/MNJtPCR1BdFRNCMY85TtycuQEgcOJ1ZW0Jzv5t2biRLbA== + dependencies: + "@trezor/protobuf" "10.0.1" + "@trezor/utils" "10.0.1" + +"@trezor/protobuf@10.0.1": + version "10.0.1" + resolved "https://registry.yarnpkg.com/@trezor/protobuf/-/protobuf-10.0.1.tgz#56aea77029af8452fb4f8a46799728ed49dcdae6" + integrity sha512-nNSXgQXMtosAb5QzWXBo9SPer3MF22u5JwcdgEmYjXXfOWd+O7Na2P6IHlWqpf0mOWVZP8kGsrdOUzqUIQGM4A== + dependencies: + "@bufbuild/protobuf" "^2.11.0" + "@trezor/schema-utils" "10.0.1" + +"@trezor/protocol@^10.0.1": + version "10.0.1" + resolved "https://registry.yarnpkg.com/@trezor/protocol/-/protocol-10.0.1.tgz#0ec3eb357cb3ce5ece956392407969133488c8a9" + integrity sha512-uoFyMzfr3/p7uXhTJSxXurfwM6N0vDicTKHlQRrwH9dMcidEEOxuOJZBrhKnoj4osLfDPt5+ctQ+mqFjxJA9Tw== + +"@trezor/schema-utils@10.0.1": + version "10.0.1" + resolved "https://registry.yarnpkg.com/@trezor/schema-utils/-/schema-utils-10.0.1.tgz#1e537868d91d5b185e21f6267447174f02257683" + integrity sha512-pcfgZfgjw3FdJGjSEx4IBCl2RSEmBm50ouNTiBijWoe7lIxbNdCA6UNZHEcDk9g/1eu0BkjeZ4KDVSXgcfuKtg== + dependencies: + "@sinclair/typebox" "^0.34.49" + "@trezor/utils" "10.0.1" + ts-mixer "^6.0.4" + +"@trezor/type-utils@10.0.1": + version "10.0.1" + resolved "https://registry.yarnpkg.com/@trezor/type-utils/-/type-utils-10.0.1.tgz#3eb6f1e0688f8f3962f679a1a6e050d2444306a0" + integrity sha512-+o0wHYpNWJ01q9jJ0346XON05Vfp17SX4KQzabFgvadiWuB5ZU1iD/w25aTF/fmeZlyssmaOvxkziRV+D24+VA== + +"@trezor/utils@10.0.1": + version "10.0.1" + resolved "https://registry.yarnpkg.com/@trezor/utils/-/utils-10.0.1.tgz#c18db1de35595ae71b2ae1cbd7781b13e6d26bec" + integrity sha512-zrpLFCg9Rwbco/SdWePUUYyBhUEfE3waIeZvcWRrUgSsXtTmdOmOHv1rhWA1oBJ73Z7/MxPjGph40C+s+0Ckig== + dependencies: + bignumber.js "^11.1.4" + +"@trezor/websocket-client@10.0.1": + version "10.0.1" + resolved "https://registry.yarnpkg.com/@trezor/websocket-client/-/websocket-client-10.0.1.tgz#545705827afae4f7de83e2e7b85964e136700a5b" + integrity sha512-0T+jvuBpAup/wi6ttZpZmOh7cPcbYukwvSRCaa4pb1dTGTPQnLz0T9dsf9SMbF/WbM685FhmS2YJMACMO3k2TA== + dependencies: + "@trezor/utils" "10.0.1" + ws "^8.20.0" -"@trezor/utxo-lib@^1.0.12", "@trezor/utxo-lib@^1.0.7": - version "1.0.12" - resolved "https://registry.yarnpkg.com/@trezor/utxo-lib/-/utxo-lib-1.0.12.tgz#9c0b85bff90daea001c73173981ba058b9f711cc" - integrity sha512-Mtg3bE+Z+8oVfiME2CPZycbpbEyMymF4+YH2eD4aa4adysTimRxwI9+bjrUwMLwUsG1OrrNOVpeail9FrNB+hA== - dependencies: - "@trezor/utils" "9.0.14" - bchaddrjs "^0.5.2" - bech32 "^2.0.0" - bip66 "^1.1.5" - bitcoin-ops "^1.4.1" - blake-hash "^2.0.0" - blakejs "^1.2.1" - bn.js "^5.2.1" - bs58 "^5.0.0" - bs58check "^3.0.1" - create-hash "^1.2.0" - create-hmac "^1.1.7" - int64-buffer "^1.0.1" - pushdata-bitcoin "^1.0.1" - tiny-secp256k1 "^1.1.6" - typeforce "^1.18.0" - varuint-bitcoin "^1.1.2" - wif "^2.0.6" +"@types/crypto-js@^4.1.3": + version "4.2.2" + resolved "https://registry.yarnpkg.com/@types/crypto-js/-/crypto-js-4.2.2.tgz#771c4a768d94eb5922cc202a3009558204df0cea" + integrity sha512-sDOLlVbHhXpAUAL0YHDUUwDZf3iN4Bwi4W6a0W0b+QcAezUbRtH4FVb+9J4h+XFPW7l/gQ9F8qC7P+Ec4k8QVQ== -"@trezor/websocket-client@1.2.2": - version "1.2.2" - resolved "https://registry.yarnpkg.com/@trezor/websocket-client/-/websocket-client-1.2.2.tgz#f7fe1da844df847d83e3de66906b22fe092aed10" - integrity sha512-vu9L1V/5yh8LHQCmsGC9scCnihELsVuR5Tri1IvW3CdgTUFFcfjsEgXsFqFME3HlxuUmx6qokw0Gx/o0/hzaSQ== +"@types/debug@^4.1.7": + version "4.1.13" + resolved "https://registry.yarnpkg.com/@types/debug/-/debug-4.1.13.tgz#22d1cc9d542d3593caea764f974306ab36286ee7" + integrity sha512-KSVgmQmzMwPlmtljOomayoR89W4FynCAi3E8PPs7vmDVPe84hT+vGPKkJfThkmXs0x0jAaa9U8uW8bbfyS2fWw== dependencies: - "@trezor/utils" "9.4.2" - ws "^8.18.0" + "@types/ms" "*" + +"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0": + version "2.0.6" + resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz#7739c232a1fee9b4d3ce8985f314c0c6d33549d7" + integrity sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w== -"@types/bn.js@^4.11.3": - version "4.11.6" - resolved "https://registry.yarnpkg.com/@types/bn.js/-/bn.js-4.11.6.tgz#c306c70d9358aaea33cd4eda092a742b9505967c" - integrity sha512-pqr857jrp2kPuO9uRjZ3PwnJTjoQy+fcdxvBTvHm6dkmEL9q+hDD/2j/0ELOBPtPnS8LjCX0gI9nbl8lVkadpg== +"@types/istanbul-lib-report@*": + version "3.0.3" + resolved "https://registry.yarnpkg.com/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.3.tgz#53047614ae72e19fc0401d872de3ae2b4ce350bf" + integrity sha512-NQn7AHQnk/RSLOxrBbGyJM/aVQ+pjj5HCgasFxc0K/KhoATfQ/47AyUl15I2yBUpihjmas+a+VJBOqecrFH+uA== dependencies: - "@types/node" "*" + "@types/istanbul-lib-coverage" "*" -"@types/bn.js@^5.1.0", "@types/bn.js@^5.1.1": - version "5.2.0" - resolved "https://registry.yarnpkg.com/@types/bn.js/-/bn.js-5.2.0.tgz#4349b9710e98f9ab3cdc50f1c5e4dcbd8ef29c80" - integrity sha512-DLbJ1BPqxvQhIGbeu8VbUC1DiAiahHtAYvA0ZEAa4P31F7IaArc8z3C3BRQdWX4mtLQuABG4yzp76ZrS02Ui1Q== +"@types/istanbul-reports@^3.0.0": + version "3.0.4" + resolved "https://registry.yarnpkg.com/@types/istanbul-reports/-/istanbul-reports-3.0.4.tgz#0f03e3d2f670fbdac586e34b433783070cc16f54" + integrity sha512-pk2B1NWalF9toCRu6gjBzR69syFjP4Od8WRAX+0mmf9lAjCRicLOWc+ZrxZHx/0XRjotgkF9t6iaMJ+aXcOdZQ== dependencies: - "@types/node" "*" + "@types/istanbul-lib-report" "*" -"@types/cacheable-request@^6.0.1", "@types/cacheable-request@^6.0.2": - version "6.0.3" - resolved "https://registry.yarnpkg.com/@types/cacheable-request/-/cacheable-request-6.0.3.tgz#a430b3260466ca7b5ca5bfd735693b36e7a9d183" - integrity sha512-IQ3EbTzGxIigb1I3qPZc1rWJnH0BmSKv5QYTalEwweFvyBDLSAe24zP0le/hyi7ecGfZVlIVAg4BZqb8WBwKqw== +"@types/jest@^29.5.0": + version "29.5.14" + resolved "https://registry.yarnpkg.com/@types/jest/-/jest-29.5.14.tgz#2b910912fa1d6856cadcd0c1f95af7df1d6049e5" + integrity sha512-ZN+4sdnLUbo8EVvVc2ao0GFW6oVrQRPn4K2lglySj7APvSrgzxHiNNK99us4WDMi57xxA2yggblIAMNhXOotLQ== dependencies: - "@types/http-cache-semantics" "*" - "@types/keyv" "^3.1.4" - "@types/node" "*" - "@types/responselike" "^1.0.0" + expect "^29.0.0" + pretty-format "^29.0.0" -"@types/crypto-js@^4.1.3": - version "4.2.2" - resolved "https://registry.yarnpkg.com/@types/crypto-js/-/crypto-js-4.2.2.tgz#771c4a768d94eb5922cc202a3009558204df0cea" - integrity sha512-sDOLlVbHhXpAUAL0YHDUUwDZf3iN4Bwi4W6a0W0b+QcAezUbRtH4FVb+9J4h+XFPW7l/gQ9F8qC7P+Ec4k8QVQ== +"@types/json-schema@7.0.15": + version "7.0.15" + resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841" + integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA== -"@types/http-cache-semantics@*": - version "4.0.4" - resolved "https://registry.yarnpkg.com/@types/http-cache-semantics/-/http-cache-semantics-4.0.4.tgz#b979ebad3919799c979b17c72621c0bc0a31c6c4" - integrity sha512-1m0bIFVc7eJWyve9S0RnuRgcQqF/Xd5QsUZAZeQFr1Q3/p9JWoQQEqmVy+DPTNpGXwhgIetAoYF8JSc33q29QA== +"@types/lodash@^4.17.20": + version "4.17.25" + resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.17.25.tgz#69765ac7bcddb0eb072961cf292524a8f5b3c2c0" + integrity sha512-+K1NIO8I+F9/wNulfVvu23QYd0Pe9/OCqRrim4NoYIf1VoEDL90Ve4ClzpyqBLc7NpGGWRvYNCKZ1BE/Jpf8dQ== -"@types/keyv@^3.1.4": - version "3.1.4" - resolved "https://registry.yarnpkg.com/@types/keyv/-/keyv-3.1.4.tgz#3ccdb1c6751b0c7e52300bcdacd5bcbf8faa75b6" - integrity sha512-BQ5aZNSCpj7D6K2ksrRCTmKRLEpnPvWDiLPfoGyhZ++8YtiK9d/3DBKPJgry359X/P1PfruyYwvnvwFjuEiEIg== - dependencies: - "@types/node" "*" - -"@types/lodash@^4.14.200": - version "4.17.20" - resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.17.20.tgz#1ca77361d7363432d29f5e55950d9ec1e1c6ea93" - integrity sha512-H3MHACvFUEiujabxhaI/ImO6gUrd8oOurg7LQtS7mbwIXA/cUqWrvBsaeJ23aZEPk1TAYkurjfMbSELfoCXlGA== +"@types/ms@*": + version "2.1.0" + resolved "https://registry.yarnpkg.com/@types/ms/-/ms-2.1.0.tgz#052aa67a48eccc4309d7f0191b7e41434b90bb78" + integrity sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA== -"@types/node-fetch@^2.6.12": - version "2.6.12" - resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.6.12.tgz#8ab5c3ef8330f13100a7479e2cd56d3386830a03" - integrity sha512-8nneRWKCg3rMtF69nLQJnOYUcbafYeFSjqkw3jCRLsqkWFlHaoQrr5mXmofFGOx3DKn7UfmBMyov8ySvLRVldA== +"@types/node@*": + version "26.1.2" + resolved "https://registry.yarnpkg.com/@types/node/-/node-26.1.2.tgz#da79708f1f9c6294f4cdec8f455a3032b028808a" + integrity sha512-Vu4a5UFA9rIIFJ7rB/Vaafh9lrCQszopTCx6KjFboXTGQbPNasehVR5TEiithSDGyd1DEiUByggTZsg8jukeIg== dependencies: - "@types/node" "*" - form-data "^4.0.0" + undici-types "~8.3.0" -"@types/node@*", "@types/node@>=13.7.0": - version "24.1.0" - resolved "https://registry.yarnpkg.com/@types/node/-/node-24.1.0.tgz#0993f7dc31ab5cc402d112315b463e383d68a49c" - integrity sha512-ut5FthK5moxFKH2T1CUOC6ctR67rQRvvHdFLCD2Ql6KXmMuCrjsSsRI9UsLCm9M18BMwClv4pn327UvB7eeO1w== +"@types/node@22.7.5": + version "22.7.5" + resolved "https://registry.yarnpkg.com/@types/node/-/node-22.7.5.tgz#cfde981727a7ab3611a481510b473ae54442b92b" + integrity sha512-jML7s2NAzMWc//QSJ1a3prpk78cOPchGvXJsC3C6R6PSMoooztvRVQEz89gmBTBY1SPMaqo5teB4uNHPdetShQ== dependencies: - undici-types "~7.8.0" - -"@types/node@10.12.18": - version "10.12.18" - resolved "https://registry.yarnpkg.com/@types/node/-/node-10.12.18.tgz#1d3ca764718915584fcd9f6344621b7672665c67" - integrity sha512-fh+pAqt4xRzPfqA6eh3Z2y6fyZavRIumvjhaCL753+TVkGKGhpPeyrJG2JftD0T9q4GF00KjefsQ+PQNDdWQaQ== - -"@types/node@^12.12.6": - version "12.20.55" - resolved "https://registry.yarnpkg.com/@types/node/-/node-12.20.55.tgz#c329cbd434c42164f846b909bd6f85b5537f6240" - integrity sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ== + undici-types "~6.19.2" "@types/node@^20.8.10": - version "20.19.9" - resolved "https://registry.yarnpkg.com/@types/node/-/node-20.19.9.tgz#ca9a58193fec361cc6e859d88b52261853f1f0d3" - integrity sha512-cuVNgarYWZqxRJDQHEB58GEONhOK79QVR/qYx4S7kcUObQvUwvFnYxJuuHUKm2aieN9X3yZB4LZsuYNU1Qphsw== + version "20.19.43" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.19.43.tgz#fcecf580ba42a0db55cf404c372c97973c376c97" + integrity sha512-6oYBAi5ikg4Pl+kGsoYtawUMBT2zZMCvPNF7pVLnHZfd1zf38DRiWn/gT01RYCdUqkv7Fhr+C9ot4/tb+2sVvA== dependencies: undici-types "~6.21.0" @@ -1918,51 +539,29 @@ dependencies: "@types/node" "*" -"@types/responselike@^1.0.0": - version "1.0.3" - resolved "https://registry.yarnpkg.com/@types/responselike/-/responselike-1.0.3.tgz#cc29706f0a397cfe6df89debfe4bf5cea159db50" - integrity sha512-H/+L+UkTV33uf49PH5pCAUBVPNj2nDBXTN+qS1dOwyyg24l3CcicicCA7ca+HMvJBZcFgl5r8e+RR6elsb4Lyw== - dependencies: - "@types/node" "*" - "@types/secp256k1@^4.0.1": - version "4.0.6" - resolved "https://registry.yarnpkg.com/@types/secp256k1/-/secp256k1-4.0.6.tgz#d60ba2349a51c2cbc5e816dcd831a42029d376bf" - integrity sha512-hHxJU6PAEUn0TP4S/ZOzuTUvJWuZ6eIKeNKb5RBpODvSl6hp1Wrw4s7ATY50rklRCScUDpHzVA/DQdSjJ3UoYQ== + version "4.0.7" + resolved "https://registry.yarnpkg.com/@types/secp256k1/-/secp256k1-4.0.7.tgz#534c9814eb80964962108ad45d549d1555c75fa0" + integrity sha512-Rcvjl6vARGAKRO6jHeKMatGrvOMGrR/AR11N1x2LqintPCyDZ7NBhrh238Z2VZc7aM7KIwnFpFQ7fnfK4H/9Qw== dependencies: "@types/node" "*" -"@types/w3c-web-usb@^1.0.6": - version "1.0.10" - resolved "https://registry.yarnpkg.com/@types/w3c-web-usb/-/w3c-web-usb-1.0.10.tgz#cf89cccd2d93b6245e784c19afe0a9f5038d4528" - integrity sha512-CHgUI5kTc/QLMP8hODUHhge0D4vx+9UiAwIGiT0sTy/B2XpdX1U5rJt6JSISgr6ikRT7vxV9EVAFeYZqUnl1gQ== - -"@types/web@^0.0.197": - version "0.0.197" - resolved "https://registry.yarnpkg.com/@types/web/-/web-0.0.197.tgz#624cf02b57e79ec9d90b61b24b95fe1732713e45" - integrity sha512-V4sOroWDADFx9dLodWpKm298NOJ1VJ6zoDVgaP+WBb/utWxqQ6gnMzd9lvVDAr/F3ibiKaxH9i45eS0gQPSTaQ== +"@types/stack-utils@^2.0.0": + version "2.0.3" + resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.3.tgz#6209321eb2c1712a7e7466422b8cb1fc0d9dd5d8" + integrity sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw== -"@xrplf/isomorphic@^1.0.0", "@xrplf/isomorphic@^1.0.1": - version "1.0.1" - resolved "https://registry.yarnpkg.com/@xrplf/isomorphic/-/isomorphic-1.0.1.tgz#d7676e0ec0e55a39f37ddc1f3cc30eeab52e0739" - integrity sha512-0bIpgx8PDjYdrLFeC3csF305QQ1L7sxaWnL5y71mCvhenZzJgku9QsA+9QCXBC1eNYtxWO/xR91zrXJy2T/ixg== - dependencies: - "@noble/hashes" "^1.0.0" - eventemitter3 "5.0.1" - ws "^8.13.0" +"@types/yargs-parser@*": + version "21.0.3" + resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-21.0.3.tgz#815e30b786d2e8f0dcd85fd5bcf5e1a04d008f15" + integrity sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ== -"@xrplf/secret-numbers@^1.0.0": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@xrplf/secret-numbers/-/secret-numbers-1.0.0.tgz#cc19ff84236cc2737b38f2e42a29924f2b8ffc0e" - integrity sha512-qsCLGyqe1zaq9j7PZJopK+iGTGRbk6akkg6iZXJJgxKwck0C5x5Gnwlb1HKYGOwPKyrXWpV6a2YmcpNpUFctGg== +"@types/yargs@^17.0.8": + version "17.0.35" + resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-17.0.35.tgz#07013e46aa4d7d7d50a49e15604c1c5340d4eb24" + integrity sha512-qUHkeCyQFxMXg79wQfTtfndEC+N9ZZg76HJftDJp+qH2tV7Gj4OJi7l+PiWwJ+pWtW8GwSmqsDj/oymhrTWXjg== dependencies: - "@xrplf/isomorphic" "^1.0.0" - ripple-keypairs "^2.0.0" - -abortcontroller-polyfill@^1.7.5: - version "1.7.8" - resolved "https://registry.yarnpkg.com/abortcontroller-polyfill/-/abortcontroller-polyfill-1.7.8.tgz#fe8d4370403f02e2aa37e3d2b0b178bae9d83f49" - integrity sha512-9f1iZ2uWh92VcrU9Y8x+LdM4DLj75VE0MJB8zuF1iUnroEptStw+DQ8EQPMUdfe5k+PkB1uUfDQfWbhstH8LrQ== + "@types/yargs-parser" "*" abstract-leveldown@^5.0.0, abstract-leveldown@~5.0.0: version "5.0.0" @@ -1971,84 +570,29 @@ abstract-leveldown@^5.0.0, abstract-leveldown@~5.0.0: dependencies: xtend "~4.0.0" -accepts@~1.3.8: - version "1.3.8" - resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.8.tgz#0bf0be125b67014adcb0b0921e62db7bffe16b2e" - integrity sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw== - dependencies: - mime-types "~2.1.34" - negotiator "0.6.3" +aes-js@4.0.0-beta.5: + version "4.0.0-beta.5" + resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-4.0.0-beta.5.tgz#8d2452c52adedebc3a3e28465d858c11ca315873" + integrity sha512-G965FqalsNyrPqgEGON7nIx1e/OVENSgiEIzyC63haUMuvNnwIgIjMs52hlTCKhkBny7A2ORNlfY9Zu+jmGk1Q== -aes-js@3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-3.0.0.tgz#e21df10ad6c2053295bcbb8dab40b09dbea87e4d" - integrity sha512-H7wUZRn8WpTq9jocdxQ2c8x2sKo9ZVmzfRE13GiNJXfp7NcKYEdvl3vspKjXox6RIG2VtaRe4JFvxG4rqp2Zuw== - -agent-base@^7.1.2: - version "7.1.4" - resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-7.1.4.tgz#e3cd76d4c548ee895d3c3fd8dc1f6c5b9032e7a8" - integrity sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ== - -ajv@^6.12.3: - version "6.12.6" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" - integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== +agent-base@6: + version "6.0.2" + resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-6.0.2.tgz#49fff58577cfee3f37176feab4c22e00f86d7f77" + integrity sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ== dependencies: - fast-deep-equal "^3.1.1" - fast-json-stable-stringify "^2.0.0" - json-schema-traverse "^0.4.1" - uri-js "^4.2.2" - -ansi-regex@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" - integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== - -ansi-regex@^6.0.1: - version "6.1.0" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-6.1.0.tgz#95ec409c69619d6cb1b8b34f14b660ef28ebd654" - integrity sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA== + debug "4" -ansi-styles@^4.0.0: +ansi-styles@^4.1.0: version "4.3.0" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== dependencies: color-convert "^2.0.1" -ansi-styles@^6.1.0: - version "6.2.1" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-6.2.1.tgz#0e62320cf99c21afff3b3012192546aacbfb05c5" - integrity sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug== - -array-flatten@1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/array-flatten/-/array-flatten-1.1.1.tgz#9a5f699051b1e7073328f2a008968b64ea2955d2" - integrity sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg== - -asn1@~0.2.3: - version "0.2.6" - resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.6.tgz#0d3a7bb6e64e02a90c0303b31f292868ea09a08d" - integrity sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ== - dependencies: - safer-buffer "~2.1.0" - -assert-plus@1.0.0, assert-plus@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525" - integrity sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw== - -async-limiter@~1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/async-limiter/-/async-limiter-1.0.1.tgz#dd379e94f0db8310b08291f9d64c3209766617fd" - integrity sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ== - -async-mutex@^0.2.6: - version "0.2.6" - resolved "https://registry.yarnpkg.com/async-mutex/-/async-mutex-0.2.6.tgz#0d7a3deb978bc2b984d5908a2038e1ae2e54ff40" - integrity sha512-Hs4R+4SPgamu6rSGW8C7cV9gaWUKEHykfzCCvIRuaVv636Ju10ZdeUbvb4TBEW0INuq2DHZqXbK4Nd3yG4RaRw== - dependencies: - tslib "^2.0.0" +ansi-styles@^5.0.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-5.2.0.tgz#07449690ad45777d1924ac2abb2fc8895dba836b" + integrity sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA== async@^2.6.1: version "2.6.4" @@ -2069,88 +613,22 @@ available-typed-arrays@^1.0.7: dependencies: possible-typed-array-names "^1.0.0" -aws-sign2@~0.7.0: - version "0.7.0" - resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8" - integrity sha512-08kcGqnYf/YmjoRhfxyu+CLxBjUtHLXLXX/vUfx9l2LYzG3c1m61nrpyFUZI6zeS+Li/wWMMidD9KgrqtGq3mA== - -aws4@^1.8.0: - version "1.13.2" - resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.13.2.tgz#0aa167216965ac9474ccfa83892cfb6b3e1e52ef" - integrity sha512-lHe62zvbTB5eEABUVi/AwVh0ZKY9rMMDhmm+eeyuuUQbQ3+J+fONVQOZyj+DdrvD4BY33uYniyRJ4UJIaSKAfw== - -axios@1.7.7: - version "1.7.7" - resolved "https://registry.yarnpkg.com/axios/-/axios-1.7.7.tgz#2f554296f9892a72ac8d8e4c5b79c14a91d0a47f" - integrity sha512-S4kL7XrjgBmvdGut0sN3yJxqYzrDOnivkBiN0OFs6hLiUam3UPvswUo0kqGyhqUZGEOytHyumEdXsAkgCOUf3Q== - dependencies: - follow-redirects "^1.15.6" - form-data "^4.0.0" - proxy-from-env "^1.1.0" - -axios@^0.21.1: - version "0.21.4" - resolved "https://registry.yarnpkg.com/axios/-/axios-0.21.4.tgz#c67b90dc0568e5c1cf2b0b858c43ba28e2eda575" - integrity sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg== - dependencies: - follow-redirects "^1.14.0" - -axios@^0.26.1: - version "0.26.1" - resolved "https://registry.yarnpkg.com/axios/-/axios-0.26.1.tgz#1ede41c51fcf51bbbd6fd43669caaa4f0495aaa9" - integrity sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA== - dependencies: - follow-redirects "^1.14.8" - -axios@^1.8.4: - version "1.11.0" - resolved "https://registry.yarnpkg.com/axios/-/axios-1.11.0.tgz#c2ec219e35e414c025b2095e8b8280278478fdb6" - integrity sha512-1Lx3WLFQWm3ooKDYZD1eXmoGO9fxYQjrycfHFC8P0sCfQVXyROp0p9PFWBehewBOdCwHc+f/b8I0fMto5eSfwA== - dependencies: - follow-redirects "^1.15.6" - form-data "^4.0.4" - proxy-from-env "^1.1.0" - -bare-addon-resolve@^1.3.0: - version "1.9.4" - resolved "https://registry.yarnpkg.com/bare-addon-resolve/-/bare-addon-resolve-1.9.4.tgz#50ad7b26de493f978f09bbbbe987219c4ecbfd28" - integrity sha512-unn6Vy/Yke6F99vg/7tcrvM2KUvIhTNniaSqDbam4AWkd4NhvDVSrQiRYVlNzUV2P7SPobkCK7JFVxrJk9btCg== - dependencies: - bare-module-resolve "^1.10.0" - bare-semver "^1.0.0" - -bare-module-resolve@^1.10.0: - version "1.11.1" - resolved "https://registry.yarnpkg.com/bare-module-resolve/-/bare-module-resolve-1.11.1.tgz#4ea4d1dd82947a00b4f4bbbfce2379eedd9c9e09" - integrity sha512-DCxeT9i8sTs3vUMA3w321OX/oXtNEu5EjObQOnTmCdNp5RXHBAvAaBDHvAi9ta0q/948QPz+co6SsGi6aQMYRg== - dependencies: - bare-semver "^1.0.0" - -bare-os@^3.0.1: - version "3.6.1" - resolved "https://registry.yarnpkg.com/bare-os/-/bare-os-3.6.1.tgz#9921f6f59edbe81afa9f56910658422c0f4858d4" - integrity sha512-uaIjxokhFidJP+bmmvKSgiMzj2sV5GPHaZVAIktcxcpCyBFFWO+YlikVAdhmUo2vYFvFhOXIAlldqV29L8126g== - -bare-path@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/bare-path/-/bare-path-3.0.0.tgz#b59d18130ba52a6af9276db3e96a2e3d3ea52178" - integrity sha512-tyfW2cQcB5NN8Saijrhqn0Zh7AnFNsnczRcuWODH0eYAXBsJ5gVxAUuNr7tsHSC6IZ77cA0SitzT+s47kot8Mw== +axios@^1.18.1: + version "1.19.0" + resolved "https://registry.yarnpkg.com/axios/-/axios-1.19.0.tgz#ddf864d4c8233c0e6873746ab59361537d05ad39" + integrity sha512-ht/iuYZXEjFxLH/Hkezgd7m6JKlHHXEUSneaDz8uZe1Gj5QZtCnpyDsckvAiEnT89OEbCLmnte4R4sn7P0EKFw== dependencies: - bare-os "^3.0.1" + follow-redirects "^1.16.0" + form-data "^4.0.6" + https-proxy-agent "^5.0.1" + proxy-from-env "^2.1.0" -bare-semver@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/bare-semver/-/bare-semver-1.0.1.tgz#4737d660785f07cb723cefa6b022089e59120a61" - integrity sha512-UtggzHLiTrmFOC/ogQ+Hy7VfoKoIwrP1UFcYtTxoCUdLtsIErT8+SWtOC2DH/snT9h+xDrcBEPcwKei1mzemgg== - -bare-url@^2.1.0: - version "2.1.6" - resolved "https://registry.yarnpkg.com/bare-url/-/bare-url-2.1.6.tgz#86937c11c29b094c821459d3041b7fa67322266e" - integrity sha512-FgjDeR+/yDH34By4I0qB5NxAoWv7dOTYcOXwn73kr+c93HyC2lU6tnjifqUe33LKMJcDyCYPQjEAqgOQiXkE2Q== - dependencies: - bare-path "^3.0.0" +balanced-match@^4.0.2: + version "4.0.4" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-4.0.4.tgz#bfb10662feed8196a2c62e7c68e17720c274179a" + integrity sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA== -base-x@^3.0.2, base-x@^3.0.8: +base-x@^3.0.2: version "3.0.11" resolved "https://registry.yarnpkg.com/base-x/-/base-x-3.0.11.tgz#40d80e2a1aeacba29792ccc6c5354806421287ff" integrity sha512-xz7wQ8xDhdyP7tQxwdteLYeFfS68tSMNCZ/Y37WJ4bhGfKPpqEIlmIyueQHqOyoPhE6xNUqjzRr8ra0eF9VRvA== @@ -2167,246 +645,105 @@ base-x@^5.0.0: resolved "https://registry.yarnpkg.com/base-x/-/base-x-5.0.1.tgz#16bf35254be1df8aca15e36b7c1dda74b2aa6b03" integrity sha512-M7uio8Zt++eg3jPj+rHMfCC+IuygQHHCOU+IYsVtik6FWjuYpVt/+MRKcgsAMHh8mMFAwnB+Bs+mTrFiXjMzKg== -base32.js@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/base32.js/-/base32.js-0.1.0.tgz#b582dec693c2f11e893cf064ee6ac5b6131a2202" - integrity sha512-n3TkB02ixgBOhTvANakDb4xaMXnYUVkNoRFJjQflcqMQhyEKxEHdj3E6N8t8sUQ0mjH/3/JxzlXuz3ul/J90pQ== - base64-js@^1.3.1: version "1.5.1" resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== -bchaddrjs@^0.5.2: - version "0.5.2" - resolved "https://registry.yarnpkg.com/bchaddrjs/-/bchaddrjs-0.5.2.tgz#1f52b5077329774e7c82d4882964628106bb11a0" - integrity sha512-OO7gIn3m7ea4FVx4cT8gdlWQR2+++EquhdpWQJH9BQjK63tJJ6ngB3QMZDO6DiBoXiIGUsTPHjlrHVxPGcGxLQ== - dependencies: - bs58check "2.1.2" - buffer "^6.0.3" - cashaddrjs "0.4.4" - stream-browserify "^3.0.0" - -bcrypt-pbkdf@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz#a4301d389b6a43f9b67ff3ca11a3f6637e360e9e" - integrity sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w== - dependencies: - tweetnacl "^0.14.3" - -bech32@1.1.4, bech32@^1.1.2: - version "1.1.4" - resolved "https://registry.yarnpkg.com/bech32/-/bech32-1.1.4.tgz#e38c9f37bf179b8eb16ae3a772b40c356d4832e9" - integrity sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ== - bech32@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/bech32/-/bech32-2.0.0.tgz#078d3686535075c8c79709f054b1b226a133b355" integrity sha512-LcknSilhIGatDAsY1ak2I8VtGaHNhgMSYVxFrGLXv+xLHytaKZKcaUJJUE7qmBr7h33o5YQwP55pMI0xmkpJwg== -big-integer@1.6.36: - version "1.6.36" - resolved "https://registry.yarnpkg.com/big-integer/-/big-integer-1.6.36.tgz#78631076265d4ae3555c04f85e7d9d2f3a071a36" - integrity sha512-t70bfa7HYEA1D9idDbmuv7YbsbVkQ+Hp+8KFSul4aE5e/i1bjCNIRYJZlA8Q8p0r9T8cF/RVvwUgRA//FydEyg== +bignumber.js@^11.1.4: + version "11.1.5" + resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-11.1.5.tgz#0f678769f989e6947138d16adaaaa475a9b0bc65" + integrity sha512-6WmzCNtUnfKpbozq+hOgWaZMMzORmYBwF1xZScyoIX3QRYWeKTtxxwDOW5tIz7C9BdjkIYHGTcelCLkXg0mndw== -big.js@^3.1.3: - version "3.2.0" - resolved "https://registry.yarnpkg.com/big.js/-/big.js-3.2.0.tgz#a5fc298b81b9e0dca2e458824784b65c52ba588e" - integrity sha512-+hN/Zh2D08Mx65pZ/4g5bsmNiZUuChDiQfTUQ7qJr4/kuopCr88xZsAXv6mBoZEsUI4OuGHlX59qE94K2mMW8Q== - -bignumber.js@^9.0.0, bignumber.js@^9.1.2, bignumber.js@^9.3.0: - version "9.3.1" - resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.3.1.tgz#759c5aaddf2ffdc4f154f7b493e1c8770f88c4d7" - integrity sha512-Ko0uX15oIUS7wJ3Rb30Fs6SkVbLmPBAKdlm7q9+ak9bbIeFf0MwuBsQV6z7+X768/cHsfg+WlysDWJcmthjsjQ== - -bindings@^1.3.0, bindings@^1.5.0: - version "1.5.0" - resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.5.0.tgz#10353c9e945334bc0511a6d90b38fbc7c9c504df" - integrity sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ== +bip174@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/bip174/-/bip174-3.0.1.tgz#c213c888ab42dd0b113802b0c48285ede8c37cb0" + integrity sha512-avOnOoLOwdjw1MebWKh3bHqWOH558Q9VpqmRKUv2S63vjw0pnX7Y+yRihxIibgP55twhc7+YfC0IAH43IF5FqQ== dependencies: - file-uri-to-path "1.0.0" - -bip174@^2.0.1, bip174@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/bip174/-/bip174-2.1.1.tgz#ef3e968cf76de234a546962bcf572cc150982f9f" - integrity sha512-mdFV5+/v0XyNYXjBS6CQPLo9ekCx4gtKZFnJm5PMto7Fs9hTTDpkkzOB7/FtluRI6JbUUAu+snTYfJRgHLZbZQ== + uint8array-tools "^0.0.10" + varuint-bitcoin "^2.0.1" bip32-path@^0.4.2: version "0.4.2" resolved "https://registry.yarnpkg.com/bip32-path/-/bip32-path-0.4.2.tgz#5db0416ad6822712f077836e2557b8697c0c7c99" integrity sha512-ZBMCELjJfcNMkz5bDuJ1WrYvjlhEF5k6mQ8vUr4N7MbVRsXei7ZOg8VhhwMfNiW68NWmLkgkc6WvTickrLGprQ== -bip32@^2.0.4: - version "2.0.6" - resolved "https://registry.yarnpkg.com/bip32/-/bip32-2.0.6.tgz#6a81d9f98c4cd57d05150c60d8f9e75121635134" - integrity sha512-HpV5OMLLGTjSVblmrtYRfFFKuQB+GArM0+XP8HGWfJ5vxYBqo+DesvJwOdC2WJ3bCkZShGf0QIfoIpeomVzVdA== - dependencies: - "@types/node" "10.12.18" - bs58check "^2.1.1" - create-hash "^1.2.0" - create-hmac "^1.1.7" - tiny-secp256k1 "^1.1.3" - typeforce "^1.11.5" - wif "^2.0.6" - -bip32@^3.0.1: - version "3.1.0" - resolved "https://registry.yarnpkg.com/bip32/-/bip32-3.1.0.tgz#ce90e020d0e6b41e891a0122ff053efabcce1ccc" - integrity sha512-eoeajYEzJ4d6yyVtby8C+XkCeKItiC4Mx56a0M9VaqTMC73SWOm4xVZG7SaR8e/yp4eSyky2XcBpH3DApPdu7Q== - dependencies: - bs58check "^2.1.1" - create-hash "^1.2.0" - create-hmac "^1.1.7" - ripemd160 "^2.0.2" - typeforce "^1.11.5" - wif "^2.0.6" - -bip32@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/bip32/-/bip32-4.0.0.tgz#7fac3c05072188d2d355a4d6596b37188f06aa2f" - integrity sha512-aOGy88DDlVUhspIXJN+dVEtclhIsfAUppD43V0j40cPTld3pv/0X/MlrZSZ6jowIaQQzFwP8M6rFU2z2mVYjDQ== +bip32@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/bip32/-/bip32-5.0.1.tgz#08ccd31bbc57e62197ea74e039795a590302f332" + integrity sha512-PWlHIAgYCfVhwqNpZyeakHXuLAGyN6rEQZnhxHxKI3BoFJRVWLl26455fhRlHsmbYcV986HqtPnt33Edu5sTCw== dependencies: "@noble/hashes" "^1.2.0" "@scure/base" "^1.1.1" - typeforce "^1.11.5" - wif "^2.0.6" + uint8array-tools "^0.0.8" + valibot "^1.2.0" + wif "^5.0.0" -bip39@^3.0.4, bip39@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/bip39/-/bip39-3.1.0.tgz#c55a418deaf48826a6ceb34ac55b3ee1577e18a3" - integrity sha512-c9kiwdk45Do5GL0vJMe7tS95VjCii65mYAH7DfWl3uW8AVzXKQVUm64i3hzVybBDMp9r7j9iNxR85+ul8MdN/A== +bip39@^3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/bip39/-/bip39-3.1.2.tgz#17e31b77e80ded2e7388cb88a327cd640917baf7" + integrity sha512-inxKLEH+Weos8f5rBYNKuOrpOIcNWtKnrLur9x72s4Cb8w4Mm0jJktUPkev7+1pQuivxFqkiut9+AcrwunLHxA== dependencies: "@noble/hashes" "^1.2.0" -bip44-constants@^114.0.0: - version "114.0.0" - resolved "https://registry.yarnpkg.com/bip44-constants/-/bip44-constants-114.0.0.tgz#ef47b3952288068fec324d7e1d09cc4e6eab091d" - integrity sha512-4y6kex3SRdQVClhSZVGb3c1oeH5zZxzZt5xFe56NHpyFdcp9rZMonv4wNP1xgjYPixyqs0cCjnWUCfMTmOi4Dw== - -bip66@^1.1.0, bip66@^1.1.5: - version "1.1.5" - resolved "https://registry.yarnpkg.com/bip66/-/bip66-1.1.5.tgz#01fa8748785ca70955d5011217d1b3139969ca22" - integrity sha512-nemMHz95EmS38a26XbbdxIYj5csHd3RMP3H5bwQknX0WYHF01qhpufP42mLOwVICuH2JmhIhXiWs89MfUGL7Xw== - dependencies: - safe-buffer "^5.0.1" - -bip66@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/bip66/-/bip66-2.0.0.tgz#96b5cca18ad10a009f7c8ea4eb24079e37ec9c79" - integrity sha512-kBG+hSpgvZBrkIm9dt5T1Hd/7xGCPEX2npoxAWZfsK1FvjgaxySEh2WizjyIstWXriKo9K9uJ4u0OnsyLDUPXQ== - -bip68@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/bip68/-/bip68-1.0.4.tgz#78a95c7a43fad183957995cc2e08d79b0c372c4d" - integrity sha512-O1htyufFTYy3EO0JkHg2CLykdXEtV2ssqw47Gq9A0WByp662xpJnMEB9m43LZjsSDjIAOozWRExlFQk2hlV1XQ== - -bip84@^0.2.7: - version "0.2.9" - resolved "https://registry.yarnpkg.com/bip84/-/bip84-0.2.9.tgz#3b852c6386607338ad4c75b648c1c32733853eff" - integrity sha512-64uzZMiW20d/Gx5YC54Z1xsV2ULdVczat0Dla0DNoxjUo+2uIpy3DCtwDB4P4BkrWI1eHSjWvSKcKpwS+DwMVQ== - dependencies: - "@bitcoinerlab/secp256k1" "^1.1.1" - bip32 "^4.0.0" - bip39 "^3.1.0" - bitcoinjs-lib "^6.1.5" - bs58check "^3.0.1" - -bitcoin-ops@^1.3.0, bitcoin-ops@^1.4.0, bitcoin-ops@^1.4.1: +bitcoin-ops@^1.4.1: version "1.4.1" resolved "https://registry.yarnpkg.com/bitcoin-ops/-/bitcoin-ops-1.4.1.tgz#e45de620398e22fd4ca6023de43974ff42240278" integrity sha512-pef6gxZFztEhaE9RY9HmWVmiIHqCb2OyS4HPKkpc6CIiiOa3Qmuoylxc5P2EkU3w+5eTSifI9SEZC88idAIGow== -bitcoinjs-lib@^5.2.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/bitcoinjs-lib/-/bitcoinjs-lib-5.2.0.tgz#caf8b5efb04274ded1b67e0706960b93afb9d332" - integrity sha512-5DcLxGUDejgNBYcieMIUfjORtUeNWl828VWLHJGVKZCb4zIS1oOySTUr0LGmcqJBQgTBz3bGbRQla4FgrdQEIQ== - dependencies: - bech32 "^1.1.2" - bip174 "^2.0.1" - bip32 "^2.0.4" - bip66 "^1.1.0" - bitcoin-ops "^1.4.0" - bs58check "^2.0.0" - create-hash "^1.1.0" - create-hmac "^1.1.3" - merkle-lib "^2.0.10" - pushdata-bitcoin "^1.0.1" - randombytes "^2.0.1" - tiny-secp256k1 "^1.1.1" - typeforce "^1.11.3" - varuint-bitcoin "^1.0.4" - wif "^2.0.1" - -bitcoinjs-lib@^6.1.3, bitcoinjs-lib@^6.1.5: - version "6.1.7" - resolved "https://registry.yarnpkg.com/bitcoinjs-lib/-/bitcoinjs-lib-6.1.7.tgz#0f98dec1333d658574eefa455295668cfae38bb0" - integrity sha512-tlf/r2DGMbF7ky1MgUqXHzypYHakkEnm0SZP23CJKIqNY/5uNAnMbFhMJdhjrL/7anfb/U8+AlpdjPWjPnAalg== +bitcoinjs-lib@^7.0.1, bitcoinjs-lib@^7.0.5: + version "7.0.5" + resolved "https://registry.yarnpkg.com/bitcoinjs-lib/-/bitcoinjs-lib-7.0.5.tgz#ef7175e79e50faae69c9ca61c273efd966a60c33" + integrity sha512-xH24P1ile3QtyChzX1ITitcgpfZgDzG986gy1glbGXFsvcSnRX0P6p4m3nuTQfJ+j97va8py0leEK7xG8oxMqQ== dependencies: "@noble/hashes" "^1.2.0" bech32 "^2.0.0" - bip174 "^2.1.1" - bs58check "^3.0.1" - typeforce "^1.11.3" - varuint-bitcoin "^1.1.2" - -blake-hash@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/blake-hash/-/blake-hash-2.0.0.tgz#af184dce641951126d05b7d1c3de3224f538d66e" - integrity sha512-Igj8YowDu1PRkRsxZA7NVkdFNxH5rKv5cpLxQ0CVXSIA77pVYwCPRQJ2sMew/oneUpfuYRyjG6r8SmmmnbZb1w== - dependencies: - node-addon-api "^3.0.0" - node-gyp-build "^4.2.2" - readable-stream "^3.6.0" + bip174 "^3.0.1" + bs58check "^4.0.0" + uint8array-tools "^0.0.10" + valibot "^1.2.0" + varuint-bitcoin "^2.0.1" -blakejs@^1.1.0, blakejs@^1.2.1: +blakejs@^1.1.0: version "1.2.1" resolved "https://registry.yarnpkg.com/blakejs/-/blakejs-1.2.1.tgz#5057e4206eadb4a97f7c0b6e197a505042fc3814" integrity sha512-QXUSXI3QVc/gJME0dBpXrag1kbzOqCjCX8/b54ntNyW6sjtoqxqRk3LTmXzaJoh71zMsDCjM+47jS7XiwN/+fQ== -bluebird@^3.5.0: - version "3.7.2" - resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f" - integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg== - -bn.js@4.11.6: - version "4.11.6" - resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.6.tgz#53344adb14617a13f6e8dd2ce28905d1c0ba3215" - integrity sha512-XWwnNNFCuuSQ0m3r3C4LE3EiORltHd9M05pq6FOlVeiophzRbMo50Sbz1ehl8K3Z+jw9+vmgnXefY1hz8X+2wA== - -bn.js@^4.11.0, bn.js@^4.11.6, bn.js@^4.11.8, bn.js@^4.11.9: - version "4.12.2" - resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.12.2.tgz#3d8fed6796c24e177737f7cc5172ee04ef39ec99" - integrity sha512-n4DSx829VRTRByMRGdjQ9iqsN0Bh4OolPsFnaZBLcbi8iXcB+kJ9s7EnRt4wILZNV3kPLHkRVfOc/HvhC3ovDw== - -bn.js@^5.1.2, bn.js@^5.1.3, bn.js@^5.2.0, bn.js@^5.2.1, bn.js@^5.2.2: - version "5.2.2" - resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.2.tgz#82c09f9ebbb17107cd72cb7fd39bd1f9d0aaa566" - integrity sha512-v2YAxEmKaBLahNwE1mjp4WON6huMNeuDvagFZW+ASCuA/ku0bXR9hSMw0XpiqMoA3+rmnyck/tPRSFQkoC9Cuw== - -body-parser@1.20.3, body-parser@^1.16.0: - version "1.20.3" - resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.20.3.tgz#1953431221c6fb5cd63c4b36d53fab0928e548c6" - integrity sha512-7rAxByjUMqQ3/bHJy7D6OGXvx/MMc4IqBn/X0fcM1QUcAItpZrBEYhWGem+tzXH90c+G01ypMcYJBO9Y30203g== - dependencies: - bytes "3.1.2" - content-type "~1.0.5" - debug "2.6.9" - depd "2.0.0" - destroy "1.2.0" - http-errors "2.0.0" - iconv-lite "0.4.24" - on-finished "2.4.1" - qs "6.13.0" - raw-body "2.5.2" - type-is "~1.6.18" - unpipe "1.0.0" +bn.js@^4.11.0, bn.js@^4.11.8, bn.js@^4.11.9: + version "4.12.5" + resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.12.5.tgz#74f119ffecd823168d188eae06d97ea40835c489" + integrity sha512-3aRg6/JxfffFD+OlOjOFR3Vo79l39ooBTFucxx+MT3dhCtzn3EmiUPQo+6/OZuI2jbXi3YKgmiTFBgChQMwIRQ== + +bn.js@^5.2.0, bn.js@^5.2.4: + version "5.2.5" + resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.5.tgz#e81ce41cf25e6f0cd1e05f20a9db8c18405e375f" + integrity sha512-Vq886eXykuP5E6HcKSSStP3bJgrE6In5WKxVUvJ8XGpWWYs2xZHWqUwzCtGgEtBcxyd57KBFDPFoUfNzdaHCNg== + +brace-expansion@^5.0.8: + version "5.0.9" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-5.0.9.tgz#7c72438809b5fa5babf54199a1f1c281a6984fcf" + integrity sha512-ScQ4IuvIEF1TMlP7Zt+vjJ//9zlPb2SDcxWxM3bk8s6t6GGdJ7KO1dCcTidOPJKePW30LE/2cT7wCyPho9/Wxg== + dependencies: + balanced-match "^4.0.2" + +braces@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.3.tgz#490332f40919452272d55a8480adc0c441358789" + integrity sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA== + dependencies: + fill-range "^7.1.1" brorand@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f" integrity sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w== -browserify-aes@^1.0.6, browserify-aes@^1.2.0: +browserify-aes@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/browserify-aes/-/browserify-aes-1.2.0.tgz#326734642f403dabc3003209853bb70ad428ef48" integrity sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA== @@ -2439,7 +776,7 @@ bs58@^6.0.0: dependencies: base-x "^5.0.0" -bs58check@2.1.2, bs58check@<3.0.0, bs58check@^2.0.0, bs58check@^2.1.1, bs58check@^2.1.2: +bs58check@^2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/bs58check/-/bs58check-2.1.2.tgz#53b018291228d82a5aa08e7d796fdafda54aebfc" integrity sha512-0TS1jicxdU09dwJMNZtVAfzPi6Q6QeN0pM1Fkzrjn+XYHvzMKPU3pHVpva+769iNVSfIYWf7LJ6WR+BuuMf8cA== @@ -2464,27 +801,17 @@ bs58check@^4.0.0: "@noble/hashes" "^1.2.0" bs58 "^6.0.0" -btoa@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/btoa/-/btoa-1.2.1.tgz#01a9909f8b2c93f6bf680ba26131eb30f7fa3d73" - integrity sha512-SB4/MIGlsiVkMcHmT+pSmIPoNDoHg+7cMzmt3Uxt628MTz2487DKSqK/fuhFBrkuqrYv5UCEnACpF4dTFNKc/g== - buffer-equal-constant-time@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz#f8e71132f7ffe6e01a5c9697a4c6f3e48d5cc819" integrity sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA== -buffer-to-arraybuffer@^0.0.5: - version "0.0.5" - resolved "https://registry.yarnpkg.com/buffer-to-arraybuffer/-/buffer-to-arraybuffer-0.0.5.tgz#6064a40fa76eb43c723aba9ef8f6e1216d10511a" - integrity sha512-3dthu5CYiVB1DEJp61FtApNnNndTckcqe4pFcLdvHtrpG+kcyekCJKg4MRiDcFW7A6AODnXB9U4dwQiCW5kzJQ== - buffer-xor@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/buffer-xor/-/buffer-xor-1.0.3.tgz#26e61ed1422fb70dd42e6e36729ed51d855fe8d9" integrity sha512-571s0T7nZWK6vB67HI5dyUF7wXiNcfaPPPTl6zYCNApANjIvYJTg7hlud/+cJpdAhS7dVzqMLmfhfHR3rAcOjQ== -buffer@^5.0.5, buffer@^5.5.0, buffer@^5.6.0: +buffer@^5.6.0: version "5.7.1" resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.7.1.tgz#ba62e7c13133053582197160851a8f648e99eed0" integrity sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ== @@ -2500,42 +827,7 @@ buffer@^6.0.3: base64-js "^1.3.1" ieee754 "^1.2.1" -bufferutil@^4.0.1: - version "4.0.9" - resolved "https://registry.yarnpkg.com/bufferutil/-/bufferutil-4.0.9.tgz#6e81739ad48a95cad45a279588e13e95e24a800a" - integrity sha512-WDtdLmJvAuNNPzByAYpRo2rF1Mmradw6gvWsQKf63476DDXmomT9zUiGypLcG4ibIM67vhAj8jJRdbmEws2Aqw== - dependencies: - node-gyp-build "^4.3.0" - -bytes@3.1.2: - version "3.1.2" - resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.2.tgz#8b0beeb98605adf1b128fa4386403c009e0221a5" - integrity sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg== - -cacheable-lookup@^5.0.3: - version "5.0.4" - resolved "https://registry.yarnpkg.com/cacheable-lookup/-/cacheable-lookup-5.0.4.tgz#5a6b865b2c44357be3d5ebc2a467b032719a7005" - integrity sha512-2/kNscPhpcxrOigMZzbiWF7dz8ilhb/nIHU3EyZiXWXpeq/au8qJ8VhdftMkty3n7Gj6HIGalQG8oiBNB3AJgA== - -cacheable-lookup@^6.0.4: - version "6.1.0" - resolved "https://registry.yarnpkg.com/cacheable-lookup/-/cacheable-lookup-6.1.0.tgz#0330a543471c61faa4e9035db583aad753b36385" - integrity sha512-KJ/Dmo1lDDhmW2XDPMo+9oiy/CeqosPguPCrgcVzKyZrL6pM1gU2GmPY/xo6OQPTUaA/c0kwHuywB4E6nmT9ww== - -cacheable-request@^7.0.2: - version "7.0.4" - resolved "https://registry.yarnpkg.com/cacheable-request/-/cacheable-request-7.0.4.tgz#7a33ebf08613178b403635be7b899d3e69bbe817" - integrity sha512-v+p6ongsrp0yTGbJXjgxPow2+DL93DASP4kXCDKb8/bwRtt9OEF3whggkkDkGNzgcWy2XaF4a8nZglC7uElscg== - dependencies: - clone-response "^1.0.2" - get-stream "^5.1.0" - http-cache-semantics "^4.0.0" - keyv "^4.0.0" - lowercase-keys "^2.0.0" - normalize-url "^6.0.1" - responselike "^2.0.0" - -call-bind-apply-helpers@^1.0.0, call-bind-apply-helpers@^1.0.1, call-bind-apply-helpers@^1.0.2: +call-bind-apply-helpers@^1.0.1, call-bind-apply-helpers@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz#4b5428c222be985d79c3d82657479dbe0b59b2d6" integrity sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ== @@ -2543,17 +835,17 @@ call-bind-apply-helpers@^1.0.0, call-bind-apply-helpers@^1.0.1, call-bind-apply- es-errors "^1.3.0" function-bind "^1.1.2" -call-bind@^1.0.8: - version "1.0.8" - resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.8.tgz#0736a9660f537e3388826f440d5ec45f744eaa4c" - integrity sha512-oKlSFMcMwpUg2ednkhQ454wfWiU/ul3CkJe/PEHcTKuiX6RpbehUiFMXu13HalGZxfUwCQzZG747YXBn1im9ww== +call-bind@^1.0.9: + version "1.0.9" + resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.9.tgz#39a644700c80bc7d0ca9102fc6d1d43b2fd7eee7" + integrity sha512-a/hy+pNsFUTR+Iz8TCJvXudKVLAnz/DyeSUo10I5yvFDQJBFU2s9uqQpoSrJlroHUKoKqzg+epxyP9lqFdzfBQ== dependencies: - call-bind-apply-helpers "^1.0.0" - es-define-property "^1.0.0" - get-intrinsic "^1.2.4" + call-bind-apply-helpers "^1.0.2" + es-define-property "^1.0.1" + get-intrinsic "^1.3.0" set-function-length "^1.2.2" -call-bound@^1.0.2, call-bound@^1.0.3, call-bound@^1.0.4: +call-bound@^1.0.3, call-bound@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/call-bound/-/call-bound-1.0.4.tgz#238de935d2a2a692928c538c7ccfa91067fd062a" integrity sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg== @@ -2561,85 +853,34 @@ call-bound@^1.0.2, call-bound@^1.0.3, call-bound@^1.0.4: call-bind-apply-helpers "^1.0.2" get-intrinsic "^1.3.0" -camelcase-keys@^7.0.2: - version "7.0.2" - resolved "https://registry.yarnpkg.com/camelcase-keys/-/camelcase-keys-7.0.2.tgz#d048d8c69448745bb0de6fc4c1c52a30dfbe7252" - integrity sha512-Rjs1H+A9R+Ig+4E/9oyB66UC5Mj9Xq3N//vcLf2WzgdTi/3gUu3Z9KoqmlrEG4VuuLK8wJHofxzdQXz/knhiYg== - dependencies: - camelcase "^6.3.0" - map-obj "^4.1.0" - quick-lru "^5.1.1" - type-fest "^1.2.1" - -camelcase@^6.3.0: - version "6.3.0" - resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a" - integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== - -caseless@~0.12.0: - version "0.12.0" - resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" - integrity sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw== - -cashaddrjs@0.4.4: - version "0.4.4" - resolved "https://registry.yarnpkg.com/cashaddrjs/-/cashaddrjs-0.4.4.tgz#169f1ae620d325db77700273d972282adeeee331" - integrity sha512-xZkuWdNOh0uq/mxJIng6vYWfTowZLd9F4GMAlp2DwFHlcCqCm91NtuAc47RuV4L7r4PYcY5p6Cr2OKNb4hnkWA== +chalk@^4.0.0: + version "4.1.2" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" + integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== dependencies: - big-integer "1.6.36" + ansi-styles "^4.1.0" + supports-color "^7.1.0" -chalk@^5.4.1: - version "5.4.1" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-5.4.1.tgz#1b48bf0963ec158dce2aacf69c093ae2dd2092d8" - integrity sha512-zgVZuo2WcZgfUEmsn6eO3kINexW8RAE4maiQ8QNs8CtpPCSyMiYsULR3HQYkm3w8FIA3SberyMJMSldGsW+U3w== - -chownr@^1.1.4: - version "1.1.4" - resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.4.tgz#6fc9d7b42d32a583596337666e7d08084da2cc6b" - integrity sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg== - -cids@^0.7.1: - version "0.7.5" - resolved "https://registry.yarnpkg.com/cids/-/cids-0.7.5.tgz#60a08138a99bfb69b6be4ceb63bfef7a396b28b2" - integrity sha512-zT7mPeghoWAu+ppn8+BS1tQ5qGmbMfB4AregnQjA/qHY3GC1m1ptI9GkWNlgeu38r7CuRdXB47uY2XgAYt6QVA== - dependencies: - buffer "^5.5.0" - class-is "^1.1.0" - multibase "~0.6.0" - multicodec "^1.0.0" - multihashes "~0.4.15" +ci-info@^3.2.0: + version "3.9.0" + resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-3.9.0.tgz#4279a62028a7b1f262f3473fc9605f5e218c59b4" + integrity sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ== cipher-base@^1.0.0, cipher-base@^1.0.1, cipher-base@^1.0.3: - version "1.0.6" - resolved "https://registry.yarnpkg.com/cipher-base/-/cipher-base-1.0.6.tgz#8fe672437d01cd6c4561af5334e0cc50ff1955f7" - integrity sha512-3Ek9H3X6pj5TgenXYtNWdaBon1tgYCaebd+XPg0keyjEbEfkD4KkmAxkQ/i1vYvxdcT5nscLBfq9VJRmCBcFSw== + version "1.0.7" + resolved "https://registry.yarnpkg.com/cipher-base/-/cipher-base-1.0.7.tgz#bd094bfef42634ccfd9e13b9fc73274997111e39" + integrity sha512-Mz9QMT5fJe7bKI7MH31UilT5cEK5EHHRCccw/YRFsRY47AuNgaV6HY3rscp0/I4Q+tTW/5zoqpSeRRI54TkDWA== dependencies: inherits "^2.0.4" safe-buffer "^5.2.1" + to-buffer "^1.2.2" -class-is@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/class-is/-/class-is-1.1.0.tgz#9d3c0fba0440d211d843cec3dedfa48055005825" - integrity sha512-rhjH9AG1fvabIDoGRVH587413LPjTZgmDF9fOFCbFJQV4yuocX1mHxxvXI4g3cGwbVY9wAYIoKlg1N79frJKQw== - -clone-response@^1.0.2: - version "1.0.3" - resolved "https://registry.yarnpkg.com/clone-response/-/clone-response-1.0.3.tgz#af2032aa47816399cf5f0a1d0db902f517abb8c3" - integrity sha512-ROoL94jJH2dUVML2Y/5PEDNaSHgeOdSDicUyS7izcF63G6sTc/FTjLub4b8Il9S8S0beOfYt0TaA5qvFK+w0wA== - dependencies: - mimic-response "^1.0.0" - -clone@^2.1.1: - version "2.1.2" - resolved "https://registry.yarnpkg.com/clone/-/clone-2.1.2.tgz#1b7f4b9f591f1e8f83670401600345a02887435f" - integrity sha512-3Pe/CF1Nn94hyhIYpjtiLhdCoEoz0DqQ+988E9gmeEdQZlojxnOb74wctFyuwWQHzqyf9X7C7MG8juUpqBJT8w== - -coinselectsyscoin@^1.0.77, coinselectsyscoin@^1.1.8: - version "1.1.8" - resolved "https://registry.yarnpkg.com/coinselectsyscoin/-/coinselectsyscoin-1.1.8.tgz#142671443cb092f34d54df26dcf72c561bbb5fea" - integrity sha512-k7FpmKrSzCXvDn7Al8WbSBTQf0kXieE+zoFipcl0XqCJgc5pFoyfelGEvKUMgkyPIG1CPjepSu4zE3wOXZJ4xA== +coinselectsyscoin@^1.1.12: + version "1.1.12" + resolved "https://registry.npmjs.org/coinselectsyscoin/-/coinselectsyscoin-1.1.12.tgz#2f8715735d59ab91beab85957da737ead33feccc" + integrity sha512-eQ/zZGaHRSvJ5Z8cNt3tEjH77WhRl2yBN0Dl/xMJXWa1Cj4S5x3/SlQB9ZaVfrxFFCmtpptDcQi0eMPT2mq1bQ== dependencies: - bn.js "^5.1.3" + bn.js "^5.2.4" color-convert@^2.0.1: version "2.0.1" @@ -2653,67 +894,18 @@ color-name@~1.1.4: resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== -combined-stream@^1.0.6, combined-stream@^1.0.8, combined-stream@~1.0.6: +combined-stream@^1.0.8: version "1.0.8" resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== dependencies: delayed-stream "~1.0.0" -commander@^14.0.0: - version "14.0.0" - resolved "https://registry.yarnpkg.com/commander/-/commander-14.0.0.tgz#f244fc74a92343514e56229f16ef5c5e22ced5e9" - integrity sha512-2uM9rYjPvyq39NwLRqaiLtWHyDC1FvryJDa2ATTVims5YAS4PupsEQsDvP14FqhFr0P49CYDugi59xaxJlTXRA== - -content-disposition@0.5.4: - version "0.5.4" - resolved "https://registry.yarnpkg.com/content-disposition/-/content-disposition-0.5.4.tgz#8b82b4efac82512a02bb0b1dcec9d2c5e8eb5bfe" - integrity sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ== - dependencies: - safe-buffer "5.2.1" - -content-hash@^2.5.2: - version "2.5.2" - resolved "https://registry.yarnpkg.com/content-hash/-/content-hash-2.5.2.tgz#bbc2655e7c21f14fd3bfc7b7d4bfe6e454c9e211" - integrity sha512-FvIQKy0S1JaWV10sMsA7TRx8bpU+pqPkhbsfvOJAdjRXvYxEckAwQWGwtRjiaJfh+E0DvcWUGqcdjwMGFjsSdw== - dependencies: - cids "^0.7.1" - multicodec "^0.5.5" - multihashes "^0.4.15" - -content-type@~1.0.4, content-type@~1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/content-type/-/content-type-1.0.5.tgz#8b773162656d1d1086784c8f23a54ce6d73d7918" - integrity sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA== - -cookie-signature@1.0.6: - version "1.0.6" - resolved "https://registry.yarnpkg.com/cookie-signature/-/cookie-signature-1.0.6.tgz#e303a882b342cc3ee8ca513a79999734dab3ae2c" - integrity sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ== - -cookie@0.7.1: - version "0.7.1" - resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.7.1.tgz#2f73c42142d5d5cf71310a74fc4ae61670e5dbc9" - integrity sha512-6DnInpx7SJ2AK3+CTUE/ZM0vWTUboZCegxhC2xiIydHR9jNuTAASBrfEpHhiGOZw/nX51bHt6YQl8jsGo4y/0w== - -core-util-is@1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" - integrity sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ== - core-util-is@~1.0.0: version "1.0.3" resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.3.tgz#a6042d3634c2b27e9328f837b965fac83808db85" integrity sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ== -cors@^2.8.1: - version "2.8.5" - resolved "https://registry.yarnpkg.com/cors/-/cors-2.8.5.tgz#eac11da51592dd86b9f06f6e7ac293b3df875d29" - integrity sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g== - dependencies: - object-assign "^4" - vary "^1" - crc-32@^1.2.0: version "1.2.2" resolved "https://registry.yarnpkg.com/crc-32/-/crc-32-1.2.2.tgz#3cad35a934b8bf71f25ca524b6da51fb7eace2ff" @@ -2730,17 +922,7 @@ create-hash@^1.1.0, create-hash@^1.1.2, create-hash@^1.2.0: ripemd160 "^2.0.1" sha.js "^2.4.0" -create-hash@~1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/create-hash/-/create-hash-1.1.3.tgz#606042ac8b9262750f483caddab0f5819172d8fd" - integrity sha512-snRpch/kwQhcdlnZKYanNF1m0RDlrCdSKQaH87w1FCFPVPNCQ/Il9QJKAX2jVBZddRdaHBMC+zXa9Gw9tmkNUA== - dependencies: - cipher-base "^1.0.1" - inherits "^2.0.1" - ripemd160 "^2.0.0" - sha.js "^2.4.0" - -create-hmac@^1.1.3, create-hmac@^1.1.4, create-hmac@^1.1.7: +create-hmac@^1.1.7: version "1.1.7" resolved "https://registry.yarnpkg.com/create-hmac/-/create-hmac-1.1.7.tgz#69170c78b3ab957147b2b8b04572e47ead2243ff" integrity sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg== @@ -2752,87 +934,18 @@ create-hmac@^1.1.3, create-hmac@^1.1.4, create-hmac@^1.1.7: safe-buffer "^5.0.1" sha.js "^2.4.8" -cross-fetch@^3.1.5: - version "3.2.0" - resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-3.2.0.tgz#34e9192f53bc757d6614304d9e5e6fb4edb782e3" - integrity sha512-Q+xVJLoGOeIMXZmbUK4HYk+69cQH6LudR0Vu/pRm2YlU/hDV9CiS0gKUMaWY5f2NeUH9C1nV3bsTlCo0FsTV1Q== - dependencies: - node-fetch "^2.7.0" - -cross-fetch@^4.0.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-4.1.0.tgz#8f69355007ee182e47fa692ecbaa37a52e43c3d2" - integrity sha512-uKm5PU+MHTootlWEY+mZ4vvXoCn4fLQxT9dSc1sXVMSFkINTJVN8cAQROpwcKm8bJ/c7rgZVIBWzH5T78sNZZw== - dependencies: - node-fetch "^2.7.0" - -cross-spawn@^7.0.6: - version "7.0.6" - resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.6.tgz#8a58fe78f00dcd70c370451759dfbfaf03e8ee9f" - integrity sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA== - dependencies: - path-key "^3.1.0" - shebang-command "^2.0.0" - which "^2.0.1" - -crypto-js@4.2.0, crypto-js@^4.0.0, crypto-js@^4.1.1: +crypto-js@^4.1.1, crypto-js@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/crypto-js/-/crypto-js-4.2.0.tgz#4d931639ecdfd12ff80e8186dba6af2c2e856631" integrity sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q== -d@1, d@^1.0.1, d@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/d/-/d-1.0.2.tgz#2aefd554b81981e7dccf72d6842ae725cb17e5de" - integrity sha512-MOqHvMWF9/9MX6nza0KgvFH4HpMU0EF5uUDXqX/BtxtU8NfB0QzRtJ8Oe/6SuS4kbhyzVJwjd97EA4PKrzJ8bw== - dependencies: - es5-ext "^0.10.64" - type "^2.7.2" - -dashdash@^1.12.0: - version "1.14.1" - resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0" - integrity sha512-jRFi8UDGo6j+odZiEpjazZaWqEal3w/basFjQHQEwVtZJGDpxbH1MeYluwCS8Xq5wmLJooDlMgvVarmWfGM44g== - dependencies: - assert-plus "^1.0.0" - -debug@2.6.9, debug@^2.2.0: - version "2.6.9" - resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" - integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== - dependencies: - ms "2.0.0" - -debug@^4.3.4: - version "4.4.1" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.4.1.tgz#e5a8bc6cbc4c6cd3e64308b0693a3d4fa550189b" - integrity sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ== +debug@4, debug@^4.3.4: + version "4.4.3" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.4.3.tgz#c6ae432d9bd9662582fce08709b038c58e9e3d6a" + integrity sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA== dependencies: ms "^2.1.3" -decode-uri-component@^0.2.0: - version "0.2.2" - resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.2.tgz#e69dbe25d37941171dd540e024c444cd5188e1e9" - integrity sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ== - -decompress-response@^3.3.0: - version "3.3.0" - resolved "https://registry.yarnpkg.com/decompress-response/-/decompress-response-3.3.0.tgz#80a4dd323748384bfa248083622aedec982adff3" - integrity sha512-BzRPQuY1ip+qDonAOz42gRm/pg9F768C+npV/4JOsxRC2sq+Rlk+Q4ZCAsOhnIaMrgarILY+RMUIvMmmX1qAEA== - dependencies: - mimic-response "^1.0.0" - -decompress-response@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/decompress-response/-/decompress-response-6.0.0.tgz#ca387612ddb7e104bd16d85aab00d5ecf09c66fc" - integrity sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ== - dependencies: - mimic-response "^3.1.0" - -defer-to-connect@^2.0.0, defer-to-connect@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/defer-to-connect/-/defer-to-connect-2.0.1.tgz#8016bdb4143e4632b77a3449c6236277de520587" - integrity sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg== - deferred-leveldown@~4.0.0: version "4.0.2" resolved "https://registry.yarnpkg.com/deferred-leveldown/-/deferred-leveldown-4.0.2.tgz#0b0570087827bf480a23494b398f04c128c19a20" @@ -2855,40 +968,16 @@ delayed-stream@~1.0.0: resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ== -depd@2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/depd/-/depd-2.0.0.tgz#b696163cc757560d09cf22cc8fad1571b79e76df" - integrity sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw== - -destroy@1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/destroy/-/destroy-1.2.0.tgz#4803735509ad8be552934c67df614f94e66fa015" - integrity sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg== - -detect-europe-js@^0.1.2: - version "0.1.2" - resolved "https://registry.yarnpkg.com/detect-europe-js/-/detect-europe-js-0.1.2.tgz#aa76642e05dae786efc2e01a23d4792cd24c7b88" - integrity sha512-lgdERlL3u0aUdHocoouzT10d9I89VVhk0qNRmll7mXdGfJT1/wqZ2ZLA4oJAjeACPY5fT1wsbq2AT+GkuInsow== +diff-sequences@^29.6.3: + version "29.6.3" + resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-29.6.3.tgz#4deaf894d11407c51efc8418012f9e70b84ea921" + integrity sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q== -dom-walk@^0.1.0: - version "0.1.2" - resolved "https://registry.yarnpkg.com/dom-walk/-/dom-walk-0.1.2.tgz#0c548bef048f4d1f2a97249002236060daa3fd84" - integrity sha512-6QvTW9mrGeIegrFXdtQi9pk7O/nSK6lSdXW2eqUspN5LWD7UTji2Fqw5V2YLjBpHEoU9Xl/eUWNpDeZvoyOv2w== - -dotenv@^16.4.5: +dotenv@^16.0.3: version "16.6.1" resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.6.1.tgz#773f0e69527a8315c7285d5ee73c4459d20a8020" integrity sha512-uBq4egWHTcTt33a72vpSG0z3HnPuIl6NqYcTrKEg2azoEyl2hpW0zqlxysq2pK9HlDIHyHyakeYaYnSAwd8bow== -drbg.js@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/drbg.js/-/drbg.js-1.0.1.tgz#3e36b6c42b37043823cdbc332d58f31e2445480b" - integrity sha512-F4wZ06PvqxYLFEZKkFxTDcns9oFNk34hvmJSEwdzsxVQ8YI5YaxtACgQatkYgv2VI2CFkUd2Y+xosPQnHv809g== - dependencies: - browserify-aes "^1.0.6" - create-hash "^1.1.2" - create-hmac "^1.1.4" - dunder-proto@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/dunder-proto/-/dunder-proto-1.0.1.tgz#d7ae667e1dc83482f8b70fd0f6eefc50da30f58a" @@ -2898,19 +987,6 @@ dunder-proto@^1.0.1: es-errors "^1.3.0" gopd "^1.2.0" -eastasianwidth@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/eastasianwidth/-/eastasianwidth-0.2.0.tgz#696ce2ec0aa0e6ea93a397ffcf24aa7840c827cb" - integrity sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA== - -ecc-jsbn@~0.1.1: - version "0.1.2" - resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz#3a83a904e54353287874c564b7549386849a98c9" - integrity sha512-eh9O+hwRHNbG4BLTjEl3nw044CkGm5X6LoaCf7LPp7UU8Qrt47JYNi6nPX8xjW97TKGKm1ouctg0QSpZe9qrnw== - dependencies: - jsbn "~0.1.0" - safer-buffer "^2.1.0" - ecdsa-sig-formatter@1.0.11: version "1.0.11" resolved "https://registry.yarnpkg.com/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz#ae0f0fa2d85045ef14a817daa3ce9acd0489e5bf" @@ -2918,41 +994,16 @@ ecdsa-sig-formatter@1.0.11: dependencies: safe-buffer "^5.0.1" -ecpair@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/ecpair/-/ecpair-2.1.0.tgz#673f826b1d80d5eb091b8e2010c6b588e8d2cb45" - integrity sha512-cL/mh3MtJutFOvFc27GPZE2pWL3a3k4YvzUWEOvilnfZVlH3Jwgx/7d6tlD7/75tNk8TG2m+7Kgtz0SI1tWcqw== - dependencies: - randombytes "^2.1.0" - typeforce "^1.18.0" - wif "^2.0.6" - -ee-first@1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" - integrity sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow== - -eip55@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/eip55/-/eip55-2.1.1.tgz#28b743c4701ac3c811b1e9fe67e39cf1d0781b96" - integrity sha512-WcagVAmNu2Ww2cDUfzuWVntYwFxbvZ5MvIyLZpMjTTkjD6sCvkGOiS86jTppzu9/gWsc8isLHAeMBWK02OnZmA== - dependencies: - keccak "^3.0.3" - -elliptic@6.5.4: - version "6.5.4" - resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.4.tgz#da37cebd31e79a1367e941b592ed1fbebd58abbb" - integrity sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ== +ecpair@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/ecpair/-/ecpair-3.0.1.tgz#94be8bb9efbfc0fdb5c5b4bd9b5d1da53b42a621" + integrity sha512-uz8wMFvtdr58TLrXnAesBsoMEyY8UudLOfApcyg40XfZjP+gt1xO4cuZSIkZ8hTMTQ8+ETgt7xSIV4eM7M6VNw== dependencies: - bn.js "^4.11.9" - brorand "^1.1.0" - hash.js "^1.0.0" - hmac-drbg "^1.0.1" - inherits "^2.0.4" - minimalistic-assert "^1.0.1" - minimalistic-crypto-utils "^1.0.1" + uint8array-tools "^0.0.8" + valibot "^1.2.0" + wif "^5.0.0" -elliptic@6.6.1, elliptic@^6.4.0, elliptic@^6.5.2, elliptic@^6.5.7: +elliptic@^6.5.2, elliptic@^6.5.7: version "6.6.1" resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.6.1.tgz#3b8ffb02670bf69e382c7f65bf524c97c5405c06" integrity sha512-RaddvvMatK2LJHqFJ+YA4WysVN5Ita9E35botqIYspQ4TkRAlCicdzKOjlyv/1Za5RyTNn7di//eEV0uTAfe3g== @@ -2965,26 +1016,6 @@ elliptic@6.6.1, elliptic@^6.4.0, elliptic@^6.5.2, elliptic@^6.5.7: minimalistic-assert "^1.0.1" minimalistic-crypto-utils "^1.0.1" -emoji-regex@^8.0.0: - version "8.0.0" - resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" - integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== - -emoji-regex@^9.2.2: - version "9.2.2" - resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-9.2.2.tgz#840c8803b0d8047f4ff0cf963176b32d4ef3ed72" - integrity sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg== - -encodeurl@~1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59" - integrity sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w== - -encodeurl@~2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-2.0.0.tgz#7b8ea898077d7e409d3ac45474ea38eaf0857a58" - integrity sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg== - encoding-down@~5.0.0: version "5.0.4" resolved "https://registry.yarnpkg.com/encoding-down/-/encoding-down-5.0.4.tgz#1e477da8e9e9d0f7c8293d320044f8b2cd8e9614" @@ -3003,13 +1034,6 @@ encoding@^0.1.11: dependencies: iconv-lite "^0.6.2" -end-of-stream@^1.1.0: - version "1.4.5" - resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.5.tgz#7344d711dea40e0b74abc2ed49778743ccedb08c" - integrity sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg== - dependencies: - once "^1.4.0" - errno@~0.1.1: version "0.1.8" resolved "https://registry.yarnpkg.com/errno/-/errno-0.1.8.tgz#8bb3e9c7d463be4976ff888f76b4809ebc2e811f" @@ -3028,9 +1052,9 @@ es-errors@^1.3.0: integrity sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw== es-object-atoms@^1.0.0, es-object-atoms@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/es-object-atoms/-/es-object-atoms-1.1.1.tgz#1c4f2c4837327597ce69d2ca190a7fdd172338c1" - integrity sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA== + version "1.1.2" + resolved "https://registry.yarnpkg.com/es-object-atoms/-/es-object-atoms-1.1.2.tgz#a2d0b373205724dfa525d23b0c3e1b1ca582c99b" + integrity sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw== dependencies: es-errors "^1.3.0" @@ -3044,141 +1068,22 @@ es-set-tostringtag@^2.1.0: has-tostringtag "^1.0.2" hasown "^2.0.2" -es5-ext@^0.10.35, es5-ext@^0.10.62, es5-ext@^0.10.63, es5-ext@^0.10.64, es5-ext@~0.10.14: - version "0.10.64" - resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.64.tgz#12e4ffb48f1ba2ea777f1fcdd1918ef73ea21714" - integrity sha512-p2snDhiLaXe6dahss1LddxqEm+SkuDvV8dnIQG0MWjyHpcMNfXKPE+/Cc0y+PhxJX3A4xGNeFCj5oc0BUh6deg== - dependencies: - es6-iterator "^2.0.3" - es6-symbol "^3.1.3" - esniff "^2.0.1" - next-tick "^1.1.0" - -es6-iterator@^2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/es6-iterator/-/es6-iterator-2.0.3.tgz#a7de889141a05a94b0854403b2d0a0fbfa98f3b7" - integrity sha512-zw4SRzoUkd+cl+ZoE15A9o1oQd920Bb0iOJMQkQhl3jNc03YqVjAhG7scf9C5KWRU/R13Orf588uCC6525o02g== - dependencies: - d "1" - es5-ext "^0.10.35" - es6-symbol "^3.1.1" - -es6-promise@^4.2.8: - version "4.2.8" - resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-4.2.8.tgz#4eb21594c972bc40553d276e510539143db53e0a" - integrity sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w== - -es6-symbol@^3.1.1, es6-symbol@^3.1.3: - version "3.1.4" - resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.4.tgz#f4e7d28013770b4208ecbf3e0bf14d3bcb557b8c" - integrity sha512-U9bFFjX8tFiATgtkJ1zg25+KviIXpgRvRHS8sau3GfhVzThRQrOeksPeT0BWW2MNZs1OEWJ1DPXOQMn0KKRkvg== - dependencies: - d "^1.0.2" - ext "^1.7.0" - -escape-html@~1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988" - integrity sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow== - -esniff@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/esniff/-/esniff-2.0.1.tgz#a4d4b43a5c71c7ec51c51098c1d8a29081f9b308" - integrity sha512-kTUIGKQ/mDPFoJ0oVfcmyJn4iBDRptjNVIzwIFR7tqWXdVI9xfA2RMwY/gbSpJG3lkdWNEjLap/NqVHZiJsdfg== - dependencies: - d "^1.0.1" - es5-ext "^0.10.62" - event-emitter "^0.3.5" - type "^2.7.2" - -etag@~1.8.1: - version "1.8.1" - resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" - integrity sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg== +escape-string-regexp@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz#a30304e99daa32e23b2fd20f51babd07cffca344" + integrity sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w== eth-chains@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/eth-chains/-/eth-chains-1.0.0.tgz#1386496ee1aa231a4d050fde6a87fe36741ecb83" integrity sha512-SnJrJPSr5I3rKpW6RZT/qhX8qbmE5bsMeeHoRWBXkvbifudfi3YLKHXZMdLsg+Yv+PP8oqSyPxOvQxKwjNVqmQ== -eth-ens-namehash@2.0.8: - version "2.0.8" - resolved "https://registry.yarnpkg.com/eth-ens-namehash/-/eth-ens-namehash-2.0.8.tgz#229ac46eca86d52e0c991e7cb2aef83ff0f68bcf" - integrity sha512-VWEI1+KJfz4Km//dadyvBBoBeSQ0MHTXPvr8UIXiLW6IanxvAV+DmlZAijZwAyggqGUfwQBeHf7tc9wzc1piSw== - dependencies: - idna-uts46-hx "^2.3.1" - js-sha3 "^0.5.7" - -eth-json-rpc-filters@^4.2.2: - version "4.2.2" - resolved "https://registry.yarnpkg.com/eth-json-rpc-filters/-/eth-json-rpc-filters-4.2.2.tgz#eb35e1dfe9357ace8a8908e7daee80b2cd60a10d" - integrity sha512-DGtqpLU7bBg63wPMWg1sCpkKCf57dJ+hj/k3zF26anXMzkmtSBDExL8IhUu7LUd34f0Zsce3PYNO2vV2GaTzaw== - dependencies: - "@metamask/safe-event-emitter" "^2.0.0" - async-mutex "^0.2.6" - eth-json-rpc-middleware "^6.0.0" - eth-query "^2.1.2" - json-rpc-engine "^6.1.0" - pify "^5.0.0" - -eth-json-rpc-middleware@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/eth-json-rpc-middleware/-/eth-json-rpc-middleware-6.0.0.tgz#4fe16928b34231a2537856f08a5ebbc3d0c31175" - integrity sha512-qqBfLU2Uq1Ou15Wox1s+NX05S9OcAEL4JZ04VZox2NS0U+RtCMjSxzXhLFWekdShUPZ+P8ax3zCO2xcPrp6XJQ== - dependencies: - btoa "^1.2.1" - clone "^2.1.1" - eth-query "^2.1.2" - eth-rpc-errors "^3.0.0" - eth-sig-util "^1.4.2" - ethereumjs-util "^5.1.2" - json-rpc-engine "^5.3.0" - json-stable-stringify "^1.0.1" - node-fetch "^2.6.1" - pify "^3.0.0" - safe-event-emitter "^1.0.1" - -eth-lib@0.2.8: - version "0.2.8" - resolved "https://registry.yarnpkg.com/eth-lib/-/eth-lib-0.2.8.tgz#b194058bef4b220ad12ea497431d6cb6aa0623c8" - integrity sha512-ArJ7x1WcWOlSpzdoTBX8vkwlkSQ85CjjifSZtV4co64vWxSV8geWfPI9x4SVYu3DSxnX4yWFVTtGL+j9DUFLNw== - dependencies: - bn.js "^4.11.6" - elliptic "^6.4.0" - xhr-request-promise "^0.1.2" - -eth-lib@^0.1.26: - version "0.1.29" - resolved "https://registry.yarnpkg.com/eth-lib/-/eth-lib-0.1.29.tgz#0c11f5060d42da9f931eab6199084734f4dbd1d9" - integrity sha512-bfttrr3/7gG4E02HoWTDUcDDslN003OlOoBxk9virpAZQ1ja/jDgwkWB8QfJF7ojuEowrqy+lzp9VcJG7/k5bQ== - dependencies: - bn.js "^4.11.6" - elliptic "^6.4.0" - nano-json-stream-parser "^0.1.2" - servify "^0.1.12" - ws "^3.0.0" - xhr-request-promise "^0.1.2" - -eth-object@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/eth-object/-/eth-object-1.0.3.tgz#5e7a58615793e570c6b1c009eb282876b4d059b6" - integrity sha512-VOWso/tO0Pz66wNlzUveYN0FgaqHQGVr+n60GL6QWQSUW3kwTyyaMxrHNnaDCeq/61YvMUxygGr9FJsnmWKqEg== - dependencies: - eth-util-lite "^1.0.1" - -"eth-object@git+https://github.com/syscoin/eth-object.git": +eth-object@^1.0.3, "eth-object@https://github.com/syscoin/eth-object.git": version "1.0.3" - uid b5ff300f57c136138b31d6e570c816a147e0f1c9 resolved "git+https://github.com/syscoin/eth-object.git#b5ff300f57c136138b31d6e570c816a147e0f1c9" dependencies: eth-util-lite "^1.0.1" -"eth-object@https://github.com/syscoin/eth-object.git": - version "1.0.3" - resolved "https://github.com/syscoin/eth-object.git#b5ff300f57c136138b31d6e570c816a147e0f1c9" - dependencies: - eth-util-lite "^1.0.1" - eth-proof@^2.1.6: version "2.1.6" resolved "https://registry.yarnpkg.com/eth-proof/-/eth-proof-2.1.6.tgz#6c8a468f82334d9c79347324e6eb237f1ecc965f" @@ -3191,46 +1096,6 @@ eth-proof@^2.1.6: merkle-patricia-tree "github:zmitton/merkle-patricia-tree#build" promisfy "^1.2.0" -eth-query@^2.1.2: - version "2.1.2" - resolved "https://registry.yarnpkg.com/eth-query/-/eth-query-2.1.2.tgz#d6741d9000106b51510c72db92d6365456a6da5e" - integrity sha512-srES0ZcvwkR/wd5OQBRA1bIJMww1skfGS0s8wlwK3/oNP4+wnds60krvu5R1QbpRQjMmpG5OMIWro5s7gvDPsA== - dependencies: - json-rpc-random-id "^1.0.0" - xtend "^4.0.1" - -eth-rpc-errors@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/eth-rpc-errors/-/eth-rpc-errors-3.0.0.tgz#d7b22653c70dbf9defd4ef490fd08fe70608ca10" - integrity sha512-iPPNHPrLwUlR9xCSYm7HHQjWBasor3+KZfRvwEWxMz3ca0yqnlBeJrnyphkGIXZ4J7AMAaOLmwy4AWhnxOiLxg== - dependencies: - fast-safe-stringify "^2.0.6" - -eth-rpc-errors@^4.0.2: - version "4.0.3" - resolved "https://registry.yarnpkg.com/eth-rpc-errors/-/eth-rpc-errors-4.0.3.tgz#6ddb6190a4bf360afda82790bb7d9d5e724f423a" - integrity sha512-Z3ymjopaoft7JDoxZcEb3pwdGh7yiYMhOwm2doUt6ASXlMavpNlK6Cre0+IMl2VSGyEU9rkiperQhp5iRxn5Pg== - dependencies: - fast-safe-stringify "^2.0.6" - -eth-sig-util@^1.4.2: - version "1.4.2" - resolved "https://registry.yarnpkg.com/eth-sig-util/-/eth-sig-util-1.4.2.tgz#8d958202c7edbaae839707fba6f09ff327606210" - integrity sha512-iNZ576iTOGcfllftB73cPB5AN+XUQAT/T8xzsILsghXC1o8gJUqe3RHlcDqagu+biFpYQ61KQrZZJza8eRSYqw== - dependencies: - ethereumjs-abi "git+https://github.com/ethereumjs/ethereumjs-abi.git" - ethereumjs-util "^5.1.1" - -eth-sig-util@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/eth-sig-util/-/eth-sig-util-3.0.1.tgz#8753297c83a3f58346bd13547b59c4b2cd110c96" - integrity sha512-0Us50HiGGvZgjtWTyAI/+qTzYPMLy5Q451D0Xy68bxq1QMWdoOddDwGvsqcFT27uohKgalM9z/yxplyt+mY2iQ== - dependencies: - ethereumjs-abi "^0.6.8" - ethereumjs-util "^5.1.1" - tweetnacl "^1.0.3" - tweetnacl-util "^0.15.0" - eth-util-lite@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/eth-util-lite/-/eth-util-lite-1.0.1.tgz#e0eef3dd317375f22548cda4ca483807a63fa71a" @@ -3241,13 +1106,6 @@ eth-util-lite@^1.0.1: rlp "^2.2.3" safe-buffer "^5.1.2" -ethereum-bloom-filters@^1.0.6: - version "1.2.0" - resolved "https://registry.yarnpkg.com/ethereum-bloom-filters/-/ethereum-bloom-filters-1.2.0.tgz#8294f074c1a6cbd32c39d2cc77ce86ff14797dab" - integrity sha512-28hyiE7HVsWubqhpVLVmZXFd4ITeHi+BUu05o9isf0GUpMtzBUi+8/gFrGaGYzvGAJQmJ3JKj77Mk9G98T84rA== - dependencies: - "@noble/hashes" "^1.4.0" - ethereum-cryptography@^0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/ethereum-cryptography/-/ethereum-cryptography-0.1.3.tgz#8d6143cfc3d74bf79bbd8edecdf29e4ae20dd191" @@ -3275,29 +1133,11 @@ ethereum-cryptography@^2.0.0, ethereum-cryptography@^2.1.2: integrity sha512-r/W8lkHSiTLxUxW8Rf3u4HGB0xQweG2RyETjywylKZSzLWoWAijRz8WCuOtJ6wah+avllXBqZuk29HCCvhEIRg== dependencies: "@noble/curves" "1.4.2" - "@noble/hashes" "1.4.0" - "@scure/bip32" "1.4.0" - "@scure/bip39" "1.3.0" - -ethereum-cryptography@^3.2.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/ethereum-cryptography/-/ethereum-cryptography-3.2.0.tgz#42a04b57834bf536e552b50a70b9ee5057c71dc6" - integrity sha512-Urr5YVsalH+Jo0sYkTkv1MyI9bLYZwW8BENZCeE1QYaTHETEYx0Nv/SVsWkSqpYrzweg6d8KMY1wTjH/1m/BIg== - dependencies: - "@noble/ciphers" "1.3.0" - "@noble/curves" "1.9.0" - "@noble/hashes" "1.8.0" - "@scure/bip32" "1.7.0" - "@scure/bip39" "1.6.0" - -ethereumjs-abi@^0.6.8, "ethereumjs-abi@git+https://github.com/ethereumjs/ethereumjs-abi.git": - version "0.6.8" - resolved "git+https://github.com/ethereumjs/ethereumjs-abi.git#ee3994657fa7a427238e6ba92a84d0b529bbcde0" - dependencies: - bn.js "^4.11.8" - ethereumjs-util "^6.0.0" + "@noble/hashes" "1.4.0" + "@scure/bip32" "1.4.0" + "@scure/bip39" "1.3.0" -ethereumjs-util@^5.1.1, ethereumjs-util@^5.1.2, ethereumjs-util@^5.2.0: +ethereumjs-util@^5.2.0: version "5.2.1" resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-5.2.1.tgz#a833f0e5fca7e5b361384dc76301a721f537bf65" integrity sha512-v3kT+7zdyCm1HIqWlLNrHGqHGLpGYIhjeHxQjnDXjLT2FyGJDsd3LWMYUo7pAFRrk86CR3nUJfhC81CCoJNNGQ== @@ -3310,111 +1150,33 @@ ethereumjs-util@^5.1.1, ethereumjs-util@^5.1.2, ethereumjs-util@^5.2.0: rlp "^2.0.0" safe-buffer "^5.1.1" -ethereumjs-util@^6.0.0: - version "6.2.1" - resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-6.2.1.tgz#fcb4e4dd5ceacb9d2305426ab1a5cd93e3163b69" - integrity sha512-W2Ktez4L01Vexijrm5EB6w7dg4n/TgpoYU4avuT5T3Vmnw/eCRtiBrJfQYS/DCSvDIOLn2k57GcHdeBcgVxAqw== - dependencies: - "@types/bn.js" "^4.11.3" - bn.js "^4.11.0" - create-hash "^1.1.2" - elliptic "^6.5.2" - ethereum-cryptography "^0.1.3" - ethjs-util "0.1.6" - rlp "^2.2.3" - -ethereumjs-util@^7.1.5: - version "7.1.5" - resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-7.1.5.tgz#9ecf04861e4fbbeed7465ece5f23317ad1129181" - integrity sha512-SDl5kKrQAudFBUe5OJM9Ac6WmMyYmXX/6sTmLZ3ffG2eY6ZIGBes3pEDxNN6V72WyOw4CPD5RomKdsa8DAAwLg== - dependencies: - "@types/bn.js" "^5.1.0" - bn.js "^5.1.2" - create-hash "^1.1.2" - ethereum-cryptography "^0.1.3" - rlp "^2.2.4" - -ethers@^5.6.4, ethers@^5.6.9, ethers@^5.7.2: - version "5.8.0" - resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.8.0.tgz#97858dc4d4c74afce83ea7562fe9493cedb4d377" - integrity sha512-DUq+7fHrCg1aPDFCHx6UIPb3nmt2XMpM7Y/g2gLhsl3lIBqeAfOJIl1qEvRf2uq3BiKxmh6Fh5pfp2ieyek7Kg== - dependencies: - "@ethersproject/abi" "5.8.0" - "@ethersproject/abstract-provider" "5.8.0" - "@ethersproject/abstract-signer" "5.8.0" - "@ethersproject/address" "5.8.0" - "@ethersproject/base64" "5.8.0" - "@ethersproject/basex" "5.8.0" - "@ethersproject/bignumber" "5.8.0" - "@ethersproject/bytes" "5.8.0" - "@ethersproject/constants" "5.8.0" - "@ethersproject/contracts" "5.8.0" - "@ethersproject/hash" "5.8.0" - "@ethersproject/hdnode" "5.8.0" - "@ethersproject/json-wallets" "5.8.0" - "@ethersproject/keccak256" "5.8.0" - "@ethersproject/logger" "5.8.0" - "@ethersproject/networks" "5.8.0" - "@ethersproject/pbkdf2" "5.8.0" - "@ethersproject/properties" "5.8.0" - "@ethersproject/providers" "5.8.0" - "@ethersproject/random" "5.8.0" - "@ethersproject/rlp" "5.8.0" - "@ethersproject/sha2" "5.8.0" - "@ethersproject/signing-key" "5.8.0" - "@ethersproject/solidity" "5.8.0" - "@ethersproject/strings" "5.8.0" - "@ethersproject/transactions" "5.8.0" - "@ethersproject/units" "5.8.0" - "@ethersproject/wallet" "5.8.0" - "@ethersproject/web" "5.8.0" - "@ethersproject/wordlists" "5.8.0" - -ethers@~5.7.0: - version "5.7.2" - resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.7.2.tgz#3a7deeabbb8c030d4126b24f84e525466145872e" - integrity sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg== - dependencies: - "@ethersproject/abi" "5.7.0" - "@ethersproject/abstract-provider" "5.7.0" - "@ethersproject/abstract-signer" "5.7.0" - "@ethersproject/address" "5.7.0" - "@ethersproject/base64" "5.7.0" - "@ethersproject/basex" "5.7.0" - "@ethersproject/bignumber" "5.7.0" - "@ethersproject/bytes" "5.7.0" - "@ethersproject/constants" "5.7.0" - "@ethersproject/contracts" "5.7.0" - "@ethersproject/hash" "5.7.0" - "@ethersproject/hdnode" "5.7.0" - "@ethersproject/json-wallets" "5.7.0" - "@ethersproject/keccak256" "5.7.0" - "@ethersproject/logger" "5.7.0" - "@ethersproject/networks" "5.7.1" - "@ethersproject/pbkdf2" "5.7.0" - "@ethersproject/properties" "5.7.0" - "@ethersproject/providers" "5.7.2" - "@ethersproject/random" "5.7.0" - "@ethersproject/rlp" "5.7.0" - "@ethersproject/sha2" "5.7.0" - "@ethersproject/signing-key" "5.7.0" - "@ethersproject/solidity" "5.7.0" - "@ethersproject/strings" "5.7.0" - "@ethersproject/transactions" "5.7.0" - "@ethersproject/units" "5.7.0" - "@ethersproject/wallet" "5.7.0" - "@ethersproject/web" "5.7.1" - "@ethersproject/wordlists" "5.7.0" - -ethjs-unit@0.1.6: - version "0.1.6" - resolved "https://registry.yarnpkg.com/ethjs-unit/-/ethjs-unit-0.1.6.tgz#c665921e476e87bce2a9d588a6fe0405b2c41699" - integrity sha512-/Sn9Y0oKl0uqQuvgFk/zQgR7aw1g36qX/jzSQ5lSwlO0GigPymk4eGQfeNTD03w1dPOqfz8V77Cy43jH56pagw== - dependencies: - bn.js "4.11.6" - number-to-bn "1.7.0" - -ethjs-util@0.1.6, ethjs-util@^0.1.3: +ethers@6.14.1: + version "6.14.1" + resolved "https://registry.yarnpkg.com/ethers/-/ethers-6.14.1.tgz#96b5e967d9c3c66c6b64304d8e7669a761d6fca3" + integrity sha512-JnFiPFi3sK2Z6y7jZ3qrafDMwiXmU+6cNZ0M+kPq+mTy9skqEzwqAdFW3nb/em2xjlIVXX6Lz8ID6i3LmS4+fQ== + dependencies: + "@adraffy/ens-normalize" "1.10.1" + "@noble/curves" "1.2.0" + "@noble/hashes" "1.3.2" + "@types/node" "22.7.5" + aes-js "4.0.0-beta.5" + tslib "2.7.0" + ws "8.17.1" + +ethers@^6.17.0: + version "6.17.0" + resolved "https://registry.yarnpkg.com/ethers/-/ethers-6.17.0.tgz#ad85ee1fc45fe2d95cb1e21c4e3ff9f7f1b093cc" + integrity sha512-BpyrpIPJ3ydEVow8zGaz1DuPS7YU8DcWxuBnY9a0UA/lvAPwrMr+EPXsfrul628SRaekPNeIM4UFh/91GWZang== + dependencies: + "@adraffy/ens-normalize" "1.11.1" + "@noble/curves" "1.2.0" + "@noble/hashes" "1.3.2" + "@types/node" "22.7.5" + aes-js "4.0.0-beta.5" + tslib "2.7.0" + ws "8.21.0" + +ethjs-util@^0.1.3: version "0.1.6" resolved "https://registry.yarnpkg.com/ethjs-util/-/ethjs-util-0.1.6.tgz#f308b62f185f9fe6237132fb2a9818866a5cd536" integrity sha512-CUnVOQq7gSpDHZVVrQW8ExxUETWrnrvXYvYz55wOU8Uj4VCgw56XC2B/fVqQN+f7gmrnRHSLVnFAwsCuNwji8w== @@ -3422,34 +1184,6 @@ ethjs-util@0.1.6, ethjs-util@^0.1.3: is-hex-prefixed "1.0.0" strip-hex-prefix "1.0.0" -event-emitter@^0.3.5: - version "0.3.5" - resolved "https://registry.yarnpkg.com/event-emitter/-/event-emitter-0.3.5.tgz#df8c69eef1647923c7157b9ce83840610b02cc39" - integrity sha512-D9rRn9y7kLPnJ+hMq7S/nhvoKwwvVJahBi2BPmx3bvbsEdK3W9ii8cBSGjP+72/LnM4n6fo3+dkCX5FeTQruXA== - dependencies: - d "1" - es5-ext "~0.10.14" - -eventemitter3@4.0.4: - version "4.0.4" - resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.4.tgz#b5463ace635a083d018bdc7c917b4c5f10a85384" - integrity sha512-rlaVLnVxtxvoyLsQQFBx53YmXHDxRIzzTLbdfxqi4yocpSjAxXwkU0cScM5JgSKMqEhrZpnvQ2D9gjylR0AimQ== - -eventemitter3@5.0.1, eventemitter3@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-5.0.1.tgz#53f5ffd0a492ac800721bb42c66b841de96423c4" - integrity sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA== - -events@^3.0.0, events@^3.3.0: - version "3.3.0" - resolved "https://registry.yarnpkg.com/events/-/events-3.3.0.tgz#31a95ad0a924e2d2c419a813aeb2c4e878ea7400" - integrity sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q== - -eventsource@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/eventsource/-/eventsource-2.0.2.tgz#76dfcc02930fb2ff339520b6d290da573a9e8508" - integrity sha512-IzUmBGPR3+oUG9dUeXynyNmf91/3zUSJg1lCktzKw47OXuhco54U3r9B7O4XX+Rb1Itm9OZ2b0RkTs10bICOxA== - evp_bytestokey@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz#7fcbdb198dc71959432efe13842684e0525acb02" @@ -3458,109 +1192,28 @@ evp_bytestokey@^1.0.3: md5.js "^1.3.4" safe-buffer "^5.1.1" -express@^4.14.0: - version "4.21.2" - resolved "https://registry.yarnpkg.com/express/-/express-4.21.2.tgz#cf250e48362174ead6cea4a566abef0162c1ec32" - integrity sha512-28HqgMZAmih1Czt9ny7qr6ek2qddF4FclbMzwhCREB6OFfH+rXAnuNCwo1/wFvrtbgsQDb4kSbX9de9lFbrXnA== - dependencies: - accepts "~1.3.8" - array-flatten "1.1.1" - body-parser "1.20.3" - content-disposition "0.5.4" - content-type "~1.0.4" - cookie "0.7.1" - cookie-signature "1.0.6" - debug "2.6.9" - depd "2.0.0" - encodeurl "~2.0.0" - escape-html "~1.0.3" - etag "~1.8.1" - finalhandler "1.3.1" - fresh "0.5.2" - http-errors "2.0.0" - merge-descriptors "1.0.3" - methods "~1.1.2" - on-finished "2.4.1" - parseurl "~1.3.3" - path-to-regexp "0.1.12" - proxy-addr "~2.0.7" - qs "6.13.0" - range-parser "~1.2.1" - safe-buffer "5.2.1" - send "0.19.0" - serve-static "1.16.2" - setprototypeof "1.2.0" - statuses "2.0.1" - type-is "~1.6.18" - utils-merge "1.0.1" - vary "~1.1.2" - -ext@^1.7.0: - version "1.7.0" - resolved "https://registry.yarnpkg.com/ext/-/ext-1.7.0.tgz#0ea4383c0103d60e70be99e9a7f11027a33c4f5f" - integrity sha512-6hxeJYaL110a9b5TEJSj0gojyHQAmA2ch5Os+ySCiA1QGdS697XWY1pzsrSjqA9LDEEgdB/KypIlR59RcLuHYw== - dependencies: - type "^2.7.2" - -extend@~3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa" - integrity sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g== - -extsprintf@1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.3.0.tgz#96918440e3041a7a414f8c52e3c574eb3c3e1e05" - integrity sha512-11Ndz7Nv+mvAC1j0ktTa7fAb0vLyGGX+rMHNBYQviQDGU0Hw7lhctJANqbPhu9nV9/izT/IntTgZ7Im/9LJs9g== - -extsprintf@^1.2.0: - version "1.4.1" - resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.1.tgz#8d172c064867f235c0c84a596806d279bf4bcc07" - integrity sha512-Wrk35e8ydCKDj/ArClo1VrPVmN8zph5V4AtHwIuHhvMXsKf73UT3BOD+azBIW+3wOJ4FhEH7zyaJCFvChjYvMA== - -fast-deep-equal@^3.1.1: - version "3.1.3" - resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" - integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== - -fast-json-stable-stringify@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" - integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== - -fast-safe-stringify@^2.0.6: - version "2.1.1" - resolved "https://registry.yarnpkg.com/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz#c406a83b6e70d9e35ce3b30a81141df30aeba884" - integrity sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA== +expect@^29.0.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/expect/-/expect-29.7.0.tgz#578874590dcb3214514084c08115d8aee61e11bc" + integrity sha512-2Zks0hf1VLFYI1kbh0I5jP3KHHyCHpkfyHBzsSXRFgl/Bg9mWYfMW8oD+PdMPlEwy5HNsR9JutYy6pMeOh61nw== + dependencies: + "@jest/expect-utils" "^29.7.0" + jest-get-type "^29.6.3" + jest-matcher-utils "^29.7.0" + jest-message-util "^29.7.0" + jest-util "^29.7.0" -feaxios@^0.0.23: - version "0.0.23" - resolved "https://registry.yarnpkg.com/feaxios/-/feaxios-0.0.23.tgz#76f37a2666232377ce75354e46dd85cbceeb1758" - integrity sha512-eghR0A21fvbkcQBgZuMfQhrXxJzC0GNUGC9fXhBge33D+mFDTwl0aJ35zoQQn575BhyjQitRc5N4f+L4cP708g== +fill-range@^7.1.1: + version "7.1.1" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.1.1.tgz#44265d3cac07e3ea7dc247516380643754a05292" + integrity sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg== dependencies: - is-retry-allowed "^3.0.0" + to-regex-range "^5.0.1" -file-uri-to-path@1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz#553a7b8446ff6f684359c445f1e37a05dacc33dd" - integrity sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw== - -finalhandler@1.3.1: - version "1.3.1" - resolved "https://registry.yarnpkg.com/finalhandler/-/finalhandler-1.3.1.tgz#0c575f1d1d324ddd1da35ad7ece3df7d19088019" - integrity sha512-6BN9trH7bp3qvnrRyzsBz+g3lZxTNZTbVO2EV1CS0WIcDbawYVdYvGflME/9QP0h0pYlCDBCTjYa9nZzMDpyxQ== - dependencies: - debug "2.6.9" - encodeurl "~2.0.0" - escape-html "~1.0.3" - on-finished "2.4.1" - parseurl "~1.3.3" - statuses "2.0.1" - unpipe "~1.0.0" - -follow-redirects@^1.14.0, follow-redirects@^1.14.8, follow-redirects@^1.15.6: - version "1.15.9" - resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.9.tgz#a604fa10e443bf98ca94228d9eebcc2e8a2c8ee1" - integrity sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ== +follow-redirects@^1.16.0: + version "1.16.0" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.16.0.tgz#28474a159d3b9d11ef62050a14ed60e4df6d61bc" + integrity sha512-y5rN/uOsadFT/JfYwhxRS5R7Qce+g3zG97+JrtFZlC9klX/W5hD7iiLzScI4nZqUS7DNUdhPgw4xI8W2LuXlUw== for-each@^0.3.5: version "0.3.5" @@ -3569,69 +1222,16 @@ for-each@^0.3.5: dependencies: is-callable "^1.2.7" -foreground-child@^3.3.1: - version "3.3.1" - resolved "https://registry.yarnpkg.com/foreground-child/-/foreground-child-3.3.1.tgz#32e8e9ed1b68a3497befb9ac2b6adf92a638576f" - integrity sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw== - dependencies: - cross-spawn "^7.0.6" - signal-exit "^4.0.1" - -forever-agent@~0.6.1: - version "0.6.1" - resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" - integrity sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw== - -form-data-encoder@1.7.1: - version "1.7.1" - resolved "https://registry.yarnpkg.com/form-data-encoder/-/form-data-encoder-1.7.1.tgz#ac80660e4f87ee0d3d3c3638b7da8278ddb8ec96" - integrity sha512-EFRDrsMm/kyqbTQocNvRXMLjc7Es2Vk+IQFx/YW7hkUH1eBl4J1fqiP34l74Yt0pFLCNpc06fkbVk00008mzjg== - -form-data@^4.0.0, form-data@^4.0.4: - version "4.0.4" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.4.tgz#784cdcce0669a9d68e94d11ac4eea98088edd2c4" - integrity sha512-KrGhL9Q4zjj0kiUt5OO4Mr/A/jlI2jDYs5eHBpYHPcBEVSiipAvn2Ko2HnPe20rmcuuvMHNdZFp+4IlGTMF0Ow== +form-data@^4.0.6: + version "4.0.6" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.6.tgz#28e864e1b786dbebb68db1f452f9635278665827" + integrity sha512-vKatAh4SlVfgbv+YtmhiRjhEMJsYpsG1Y2rMQtR+SVSbytsSD1YGzDIcrAJmdFec88u/+VoGmxnl+80gL1tRCQ== dependencies: asynckit "^0.4.0" combined-stream "^1.0.8" es-set-tostringtag "^2.1.0" - hasown "^2.0.2" - mime-types "^2.1.12" - -form-data@~2.3.2: - version "2.3.3" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.3.tgz#dcce52c05f644f298c6a7ab936bd724ceffbf3a6" - integrity sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ== - dependencies: - asynckit "^0.4.0" - combined-stream "^1.0.6" - mime-types "^2.1.12" - -forwarded@0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.2.0.tgz#2269936428aad4c15c7ebe9779a84bf0b2a81811" - integrity sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow== - -fresh@0.5.2: - version "0.5.2" - resolved "https://registry.yarnpkg.com/fresh/-/fresh-0.5.2.tgz#3d8cadd90d976569fa835ab1f8e4b23a105605a7" - integrity sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q== - -fs-extra@^4.0.2: - version "4.0.3" - resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-4.0.3.tgz#0d852122e5bc5beb453fb028e9c0c9bf36340c94" - integrity sha512-q6rbdDd1o2mAnQreO7YADIxf/Whx4AHBiRf6d+/cVT8h44ss+lHgxf1FemcqDnQt9X3ct4McHr+JMGlYSsK7Cg== - dependencies: - graceful-fs "^4.1.2" - jsonfile "^4.0.0" - universalify "^0.1.0" - -fs-minipass@^1.2.7: - version "1.2.7" - resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-1.2.7.tgz#ccff8570841e7fe4265693da88936c55aed7f7c7" - integrity sha512-GWSSJGFy4e9GUeCcbIkED+bgAoFyj7XF1mV8rma3QW4NIqX9Kyx79N/PF61H5udOV3aY1IaMLs6pGbH71nlCTA== - dependencies: - minipass "^2.6.0" + hasown "^2.0.4" + mime-types "^2.1.35" function-bind@^1.1.2: version "1.1.2" @@ -3643,7 +1243,7 @@ functional-red-black-tree@~1.0.1: resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" integrity sha512-dsKNQNdj6xA3T+QlADDA7mOSlX0qiMINjn0cgr+eGHGsbSHzTabcIogz2+p/iqP1Xs6EP/sS2SbqH+brGTbq0g== -get-intrinsic@^1.2.4, get-intrinsic@^1.2.5, get-intrinsic@^1.2.6, get-intrinsic@^1.3.0: +get-intrinsic@^1.2.4, get-intrinsic@^1.2.6, get-intrinsic@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.3.0.tgz#743f0e3b6964a93a5491ed1bffaae054d7f98d01" integrity sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ== @@ -3659,7 +1259,7 @@ get-intrinsic@^1.2.4, get-intrinsic@^1.2.5, get-intrinsic@^1.2.6, get-intrinsic@ hasown "^2.0.2" math-intrinsics "^1.1.0" -get-proto@^1.0.0, get-proto@^1.0.1: +get-proto@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/get-proto/-/get-proto-1.0.1.tgz#150b3f2743869ef3e851ec0c49d15b1d14d00ee1" integrity sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g== @@ -3667,103 +1267,29 @@ get-proto@^1.0.0, get-proto@^1.0.1: dunder-proto "^1.0.1" es-object-atoms "^1.0.0" -get-stream@^5.1.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-5.2.0.tgz#4966a1795ee5ace65e706c4b7beb71257d6e22d3" - integrity sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA== - dependencies: - pump "^3.0.0" - -get-stream@^6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7" - integrity sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg== - -getpass@^0.1.1: - version "0.1.7" - resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.7.tgz#5eff8e3e684d569ae4cb2b1282604e8ba62149fa" - integrity sha512-0fzj9JxOLfJ+XGLhR8ze3unN0KZCgZwiSSDz168VERjK8Wl8kVSdcu2kspd4s4wtAa1y/qrVRiAA0WclVsu0ng== +glob@^13.0.3: + version "13.0.6" + resolved "https://registry.yarnpkg.com/glob/-/glob-13.0.6.tgz#078666566a425147ccacfbd2e332deb66a2be71d" + integrity sha512-Wjlyrolmm8uDpm/ogGyXZXb1Z+Ca2B8NbJwqBVg0axK9GbBeoS7yGV6vjXnYdGm6X53iehEuxxbyiKp8QmN4Vw== dependencies: - assert-plus "^1.0.0" - -glob@^11.0.0: - version "11.0.3" - resolved "https://registry.yarnpkg.com/glob/-/glob-11.0.3.tgz#9d8087e6d72ddb3c4707b1d2778f80ea3eaefcd6" - integrity sha512-2Nim7dha1KVkaiF4q6Dj+ngPPMdfvLJEOpZk/jKiUAkqKebpGAWQXAq9z1xu9HKu5lWfqw/FASuccEjyznjPaA== - dependencies: - foreground-child "^3.3.1" - jackspeak "^4.1.1" - minimatch "^10.0.3" - minipass "^7.1.2" - package-json-from-dist "^1.0.0" - path-scurry "^2.0.0" - -global@~4.4.0: - version "4.4.0" - resolved "https://registry.yarnpkg.com/global/-/global-4.4.0.tgz#3e7b105179006a323ed71aafca3e9c57a5cc6406" - integrity sha512-wv/LAoHdRE3BeTGz53FAamhGlPLhlssK45usmGFThIi4XqnBmjKQ16u+RNbP7WvigRZDxUsM0J3gcQ5yicaL0w== - dependencies: - min-document "^2.19.0" - process "^0.11.10" + minimatch "^10.2.2" + minipass "^7.1.3" + path-scurry "^2.0.2" gopd@^1.0.1, gopd@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.2.0.tgz#89f56b8217bdbc8802bd299df6d7f1081d7e51a1" integrity sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg== -got@12.1.0: - version "12.1.0" - resolved "https://registry.yarnpkg.com/got/-/got-12.1.0.tgz#099f3815305c682be4fd6b0ee0726d8e4c6b0af4" - integrity sha512-hBv2ty9QN2RdbJJMK3hesmSkFTjVIHyIDDbssCKnSmq62edGgImJWD10Eb1k77TiV1bxloxqcFAVK8+9pkhOig== - dependencies: - "@sindresorhus/is" "^4.6.0" - "@szmarczak/http-timer" "^5.0.1" - "@types/cacheable-request" "^6.0.2" - "@types/responselike" "^1.0.0" - cacheable-lookup "^6.0.4" - cacheable-request "^7.0.2" - decompress-response "^6.0.0" - form-data-encoder "1.7.1" - get-stream "^6.0.1" - http2-wrapper "^2.1.10" - lowercase-keys "^3.0.0" - p-cancelable "^3.0.0" - responselike "^2.0.0" - -got@^11.8.5: - version "11.8.6" - resolved "https://registry.yarnpkg.com/got/-/got-11.8.6.tgz#276e827ead8772eddbcfc97170590b841823233a" - integrity sha512-6tfZ91bOr7bOXnK7PRDCGBLa1H4U080YHNaAQ2KsMGlLEzRbk44nsZF2E1IeRc3vtJHPVbKCYgdFbaGO2ljd8g== - dependencies: - "@sindresorhus/is" "^4.0.0" - "@szmarczak/http-timer" "^4.0.5" - "@types/cacheable-request" "^6.0.1" - "@types/responselike" "^1.0.0" - cacheable-lookup "^5.0.3" - cacheable-request "^7.0.2" - decompress-response "^6.0.0" - http2-wrapper "^1.0.0-beta.5.2" - lowercase-keys "^2.0.0" - p-cancelable "^2.0.0" - responselike "^2.0.0" - -graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.6: +graceful-fs@^4.2.9: version "4.2.11" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== -har-schema@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92" - integrity sha512-Oqluz6zhGX8cyRaTQlFMPw80bSJVG2x/cFb8ZPhUILGgHka9SsokCCOQgpveePerqidZOrT14ipqfJb7ILcW5Q== - -har-validator@~5.1.3: - version "5.1.5" - resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-5.1.5.tgz#1f0803b9f8cb20c0fa13822df1ecddb36bde1efd" - integrity sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w== - dependencies: - ajv "^6.12.3" - har-schema "^2.0.0" +has-flag@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" + integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== has-property-descriptors@^1.0.2: version "1.0.2" @@ -3784,23 +1310,17 @@ has-tostringtag@^1.0.2: dependencies: has-symbols "^1.0.3" -hash-base@^2.0.0: - version "2.0.2" - resolved "https://registry.yarnpkg.com/hash-base/-/hash-base-2.0.2.tgz#66ea1d856db4e8a5470cadf6fce23ae5244ef2e1" - integrity sha512-0TROgQ1/SxE6KmxWSvXHvRj90/Xo1JvZShofnYF+f6ZsGtR4eES7WfrQzPalmyagfKZCXpVnitiRebZulWsbiw== - dependencies: - inherits "^2.0.1" - -hash-base@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/hash-base/-/hash-base-3.1.0.tgz#55c381d9e06e1d2997a883b4a3fddfe7f0d3af33" - integrity sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA== +hash-base@^3.0.0, hash-base@^3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/hash-base/-/hash-base-3.1.2.tgz#79d72def7611c3f6e3c3b5730652638001b10a74" + integrity sha512-Bb33KbowVTIj5s7Ked1OsqHUeCpz//tPwR+E2zJgJKo9Z5XolZ9b6bdUgjmYlwnWhoOQKoTd1TYToZGn5mAYOg== dependencies: inherits "^2.0.4" - readable-stream "^3.6.0" - safe-buffer "^5.2.0" + readable-stream "^2.3.8" + safe-buffer "^5.2.1" + to-buffer "^1.2.1" -hash.js@1.1.7, hash.js@^1.0.0, hash.js@^1.0.3, hash.js@^1.1.7: +hash.js@^1.0.0, hash.js@^1.0.3, hash.js@^1.1.7: version "1.1.7" resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.7.tgz#0babca538e8d4ee4a0f8988d68866537a003cf42" integrity sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA== @@ -3808,10 +1328,10 @@ hash.js@1.1.7, hash.js@^1.0.0, hash.js@^1.0.3, hash.js@^1.1.7: inherits "^2.0.3" minimalistic-assert "^1.0.1" -hasown@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.2.tgz#003eaf91be7adc372e84ec59dc37252cedb80003" - integrity sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ== +hasown@^2.0.2, hasown@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.4.tgz#8c62d8cb90beb2aad5d0a5b67581ad9854c3f003" + integrity sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A== dependencies: function-bind "^1.1.2" @@ -3824,58 +1344,13 @@ hmac-drbg@^1.0.1: minimalistic-assert "^1.0.0" minimalistic-crypto-utils "^1.0.1" -http-cache-semantics@^4.0.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/http-cache-semantics/-/http-cache-semantics-4.2.0.tgz#205f4db64f8562b76a4ff9235aa5279839a09dd5" - integrity sha512-dTxcvPXqPvXBQpq5dUr6mEMJX4oIEFv6bwom3FDwKRDsuIjjJGANqhBuoAn9c1RQJIdAKav33ED65E2ys+87QQ== - -http-errors@2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-2.0.0.tgz#b7774a1486ef73cf7667ac9ae0858c012c57b9d3" - integrity sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ== - dependencies: - depd "2.0.0" - inherits "2.0.4" - setprototypeof "1.2.0" - statuses "2.0.1" - toidentifier "1.0.1" - -http-https@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/http-https/-/http-https-1.0.0.tgz#2f908dd5f1db4068c058cd6e6d4ce392c913389b" - integrity sha512-o0PWwVCSp3O0wS6FvNr6xfBCHgt0m1tvPLFOCc2iFDKTRAXhB7m8klDf7ErowFH8POa6dVdGatKU5I1YYwzUyg== - -http-signature@~1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.2.0.tgz#9aecd925114772f3d95b65a60abb8f7c18fbace1" - integrity sha512-CAbnr6Rz4CYQkLYUtSNXxQPUH2gK8f3iWexVlsnMeD+GjlsQ0Xsy1cOX+mN3dtxYomRy21CiOzU8Uhw6OwncEQ== - dependencies: - assert-plus "^1.0.0" - jsprim "^1.2.2" - sshpk "^1.7.0" - -http2-wrapper@^1.0.0-beta.5.2: - version "1.0.3" - resolved "https://registry.yarnpkg.com/http2-wrapper/-/http2-wrapper-1.0.3.tgz#b8f55e0c1f25d4ebd08b3b0c2c079f9590800b3d" - integrity sha512-V+23sDMr12Wnz7iTcDeJr3O6AIxlnvT/bmaAAAP/Xda35C90p9599p0F1eHR/N1KILWSoWVAiOMFjBBXaXSMxg== - dependencies: - quick-lru "^5.1.1" - resolve-alpn "^1.0.0" - -http2-wrapper@^2.1.10: - version "2.2.1" - resolved "https://registry.yarnpkg.com/http2-wrapper/-/http2-wrapper-2.2.1.tgz#310968153dcdedb160d8b72114363ef5fce1f64a" - integrity sha512-V5nVw1PAOgfI3Lmeaj2Exmeg7fenjhRUgz1lPSezy1CuhPYbgQtbQj4jZfEAEMlaL+vupsvhjqCyjzob0yxsmQ== - dependencies: - quick-lru "^5.1.1" - resolve-alpn "^1.2.0" - -iconv-lite@0.4.24: - version "0.4.24" - resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" - integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== +https-proxy-agent@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz#c59ef224a04fe8b754f3db0063a25ea30d0005d6" + integrity sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA== dependencies: - safer-buffer ">= 2.1.2 < 3" + agent-base "6" + debug "4" iconv-lite@^0.6.2: version "0.6.3" @@ -3884,13 +1359,6 @@ iconv-lite@^0.6.2: dependencies: safer-buffer ">= 2.1.2 < 3.0.0" -idna-uts46-hx@^2.3.1: - version "2.3.1" - resolved "https://registry.yarnpkg.com/idna-uts46-hx/-/idna-uts46-hx-2.3.1.tgz#a1dc5c4df37eee522bf66d969cc980e00e8711f9" - integrity sha512-PWoF9Keq6laYdIRwwCdhTPl60xRqAloYNMQLiyUnG42VjT53oW07BXIRM+NK7eQjzXjAk2gUvX9caRxlnF9TAA== - dependencies: - punycode "2.1.0" - ieee754@^1.1.13, ieee754@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" @@ -3901,109 +1369,47 @@ immediate@~3.2.3: resolved "https://registry.yarnpkg.com/immediate/-/immediate-3.2.3.tgz#d140fa8f614659bd6541233097ddaac25cdd991c" integrity sha512-RrGCXRm/fRVqMIhqXrGEX9rRADavPiDFSoMb/k64i9XMk8uH4r/Omi5Ctierj6XzNecwDbO4WuFbDD1zmpl3Tg== -imurmurhash@^0.1.4: - version "0.1.4" - resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" - integrity sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA== - -inherits@2.0.4, inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.1, inherits@~2.0.3, inherits@~2.0.4: +inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.1, inherits@~2.0.3: version "2.0.4" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== -int64-buffer@^1.0.1, int64-buffer@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/int64-buffer/-/int64-buffer-1.1.0.tgz#7ebe9822196a93bbedf93ec6b73b569561b5ae3a" - integrity sha512-94smTCQOvigN4d/2R/YDjz8YVG0Sufvv2aAh8P5m42gwhCsDAJqnbNOrxJsrADuAFAA69Q/ptGzxvNcNuIJcvw== - -ip-address@^9.0.5: - version "9.0.5" - resolved "https://registry.yarnpkg.com/ip-address/-/ip-address-9.0.5.tgz#117a960819b08780c3bd1f14ef3c1cc1d3f3ea5a" - integrity sha512-zHtQzGojZXTwZTHQqra+ETKd4Sn3vgi7uBmlPoXVWZqYvuKmtI0l/VZTjqGmJY9x88GGOaZ9+G9ES8hC4T4X8g== - dependencies: - jsbn "1.1.0" - sprintf-js "^1.1.3" - -ipaddr.js@1.9.1: - version "1.9.1" - resolved "https://registry.yarnpkg.com/ipaddr.js/-/ipaddr.js-1.9.1.tgz#bff38543eeb8984825079ff3a2a8e6cbd46781b3" - integrity sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g== - -is-arguments@^1.0.4: - version "1.2.0" - resolved "https://registry.yarnpkg.com/is-arguments/-/is-arguments-1.2.0.tgz#ad58c6aecf563b78ef2bf04df540da8f5d7d8e1b" - integrity sha512-7bVbi0huj/wrIAOzb8U1aszg9kdi3KN/CyU19CTI7tAoZYEZoL9yCDXpbXN+uPsuWnP02cyug1gleqq+TU+YCA== +inversify@7.5.1: + version "7.5.1" + resolved "https://registry.yarnpkg.com/inversify/-/inversify-7.5.1.tgz#aa69cf594d7703b63a2e77902f8c47e172840bf0" + integrity sha512-oWWFDU2BXiuqZynGcLDDD4tqiWAeaEUCALlCj0vk/QwHGgZY/tzDFPuTmWMY3jwRmDIHxVDkcj9SL3MFTlCEDw== dependencies: - call-bound "^1.0.2" - has-tostringtag "^1.0.2" + "@inversifyjs/common" "1.5.0" + "@inversifyjs/container" "1.9.1" + "@inversifyjs/core" "5.2.0" is-callable@^1.2.7: version "1.2.7" resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.7.tgz#3bc2a85ea742d9e36205dcacdd72ca1fdc51b055" integrity sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA== -is-fullwidth-code-point@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" - integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== - -is-function@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/is-function/-/is-function-1.0.2.tgz#4f097f30abf6efadac9833b17ca5dc03f8144e08" - integrity sha512-lw7DUp0aWXYg+CBCN+JKkcE0Q2RayZnSvnZBlwgxHBQhqt5pZNVy4Ri7H9GmmXkdu7LUthszM+Tor1u/2iBcpQ== - -is-generator-function@^1.0.7: - version "1.1.0" - resolved "https://registry.yarnpkg.com/is-generator-function/-/is-generator-function-1.1.0.tgz#bf3eeda931201394f57b5dba2800f91a238309ca" - integrity sha512-nPUB5km40q9e8UfN/Zc24eLlzdSf9OfKByBw9CIdw4H1giPMeA0OIJvbchsCu4npfI2QcMVBsGEBHKZ7wLTWmQ== - dependencies: - call-bound "^1.0.3" - get-proto "^1.0.0" - has-tostringtag "^1.0.2" - safe-regex-test "^1.1.0" - is-hex-prefixed@1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz#7d8d37e6ad77e5d127148913c573e082d777f554" integrity sha512-WvtOiug1VFrE9v1Cydwm+FnXd3+w9GaeVUss5W4v/SLy3UW00vP+6iNF2SdnfiBoLy4bTqVdkftNGTUeOFVsbA== -is-regex@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.2.1.tgz#76d70a3ed10ef9be48eb577887d74205bf0cad22" - integrity sha512-MjYsKHO5O7mCsmRGxWcLWheFqN9DJ/2TmngvjKXihe6efViPqc274+Fx/4fYj/r03+ESvBdTXK0V6tA3rgez1g== - dependencies: - call-bound "^1.0.2" - gopd "^1.2.0" - has-tostringtag "^1.0.2" - hasown "^2.0.2" - -is-retry-allowed@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/is-retry-allowed/-/is-retry-allowed-3.0.0.tgz#ea79389fd350d156823c491bee9c69f485b1445c" - integrity sha512-9xH0xvoggby+u0uGF7cZXdrutWiBiaFG8ZT4YFPXL8NzkyAwX3AKGLeFQLvzDpM430+nDFBZ1LHkie/8ocL06A== - -is-standalone-pwa@^0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/is-standalone-pwa/-/is-standalone-pwa-0.1.1.tgz#7a1b0459471a95378aa0764d5dc0a9cec95f2871" - integrity sha512-9Cbovsa52vNQCjdXOzeQq5CnCbAcRk05aU62K20WO372NrTv0NxibLFCK6lQ4/iZEFdEA3p3t2VNOn8AJ53F5g== +is-number@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" + integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== is-stream@^1.0.1: version "1.1.0" resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" integrity sha512-uQPm8kcs47jx38atAcWTVxyltQYoPT68y9aWYdV6yWXSyW8mzSat0TL6CiWdZeCdF3KrAvpVtnHbTv4RN+rqdQ== -is-typed-array@^1.1.14, is-typed-array@^1.1.3: +is-typed-array@^1.1.14: version "1.1.15" resolved "https://registry.yarnpkg.com/is-typed-array/-/is-typed-array-1.1.15.tgz#4bfb4a45b61cee83a5a46fba778e4e8d59c0ce0b" integrity sha512-p3EcsicXjit7SaskXHs1hA91QxgTw46Fv6EFKKGS5DRFLD8yKnohjF3hxoju94b/OcMZoQukzpPpBE9uLVKzgQ== dependencies: which-typed-array "^1.1.16" -is-typedarray@^1.0.0, is-typedarray@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" - integrity sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA== - isarray@^2.0.5: version "2.0.5" resolved "https://registry.yarnpkg.com/isarray/-/isarray-2.0.5.tgz#8af1e4c1221244cc62459faf38940d4e644a5723" @@ -4014,11 +1420,6 @@ isarray@~1.0.0: resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" integrity sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ== -isexe@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" - integrity sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw== - isomorphic-fetch@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz#611ae1acf14f5e81f729507472819fe9733558a9" @@ -4034,118 +1435,74 @@ isomorphic-rpc@^1.2.1: dependencies: isomorphic-fetch "^2.2.1" -isstream@~0.1.2: - version "0.1.2" - resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" - integrity sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g== - -jackspeak@^4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/jackspeak/-/jackspeak-4.1.1.tgz#96876030f450502047fc7e8c7fcf8ce8124e43ae" - integrity sha512-zptv57P3GpL+O0I7VdMJNBZCu+BPHVQUk55Ft8/QCJjTVxrnJHuVuX/0Bl2A6/+2oyR/ZMEuFKwmzqqZ/U5nPQ== - dependencies: - "@isaacs/cliui" "^8.0.2" +isomorphic-ws@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/isomorphic-ws/-/isomorphic-ws-5.0.0.tgz#e5529148912ecb9b451b46ed44d53dae1ce04bbf" + integrity sha512-muId7Zzn9ywDsyXgTIafTry2sV3nySZeUDe6YedVd1Hvuuep5AsIlqK+XefWpYTyJG5e503F2xIuT2lcU6rCSw== + +jest-diff@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-29.7.0.tgz#017934a66ebb7ecf6f205e84699be10afd70458a" + integrity sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw== + dependencies: + chalk "^4.0.0" + diff-sequences "^29.6.3" + jest-get-type "^29.6.3" + pretty-format "^29.7.0" + +jest-get-type@^29.6.3: + version "29.6.3" + resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-29.6.3.tgz#36f499fdcea197c1045a127319c0481723908fd1" + integrity sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw== + +jest-matcher-utils@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-29.7.0.tgz#ae8fec79ff249fd592ce80e3ee474e83a6c44f12" + integrity sha512-sBkD+Xi9DtcChsI3L3u0+N0opgPYnCRPtGcQYrgXmR+hmt/fYfWAL0xRXYU8eWOdfuLgBe0YCW3AFtnRLagq/g== + dependencies: + chalk "^4.0.0" + jest-diff "^29.7.0" + jest-get-type "^29.6.3" + pretty-format "^29.7.0" + +jest-message-util@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-29.7.0.tgz#8bc392e204e95dfe7564abbe72a404e28e51f7f3" + integrity sha512-GBEV4GRADeP+qtB2+6u61stea8mGcOT4mCtrYISZwfu9/ISHFJ/5zOMXYbpBE9RsS5+Gb63DW4FgmnKJ79Kf6w== + dependencies: + "@babel/code-frame" "^7.12.13" + "@jest/types" "^29.6.3" + "@types/stack-utils" "^2.0.0" + chalk "^4.0.0" + graceful-fs "^4.2.9" + micromatch "^4.0.4" + pretty-format "^29.7.0" + slash "^3.0.0" + stack-utils "^2.0.3" + +jest-util@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-29.7.0.tgz#23c2b62bfb22be82b44de98055802ff3710fc0bc" + integrity sha512-z6EbKajIpqGKU56y5KBUgy1dt1ihhQJgWzUlZHArA/+X2ad7Cb5iF+AK1EWVL/Bo7Rz9uurpqw6SiBCefUbCGA== + dependencies: + "@jest/types" "^29.6.3" + "@types/node" "*" + chalk "^4.0.0" + ci-info "^3.2.0" + graceful-fs "^4.2.9" + picomatch "^2.2.3" -js-sha3@0.8.0, js-sha3@^0.8.0: +js-sha3@^0.8.0: version "0.8.0" resolved "https://registry.yarnpkg.com/js-sha3/-/js-sha3-0.8.0.tgz#b9b7a5da73afad7dedd0f8c463954cbde6818840" integrity sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q== -js-sha3@^0.5.7: - version "0.5.7" - resolved "https://registry.yarnpkg.com/js-sha3/-/js-sha3-0.5.7.tgz#0d4ffd8002d5333aabaf4a23eed2f6374c9f28e7" - integrity sha512-GII20kjaPX0zJ8wzkTbNDYMY7msuZcTWk8S5UOh6806Jq/wz1J8/bnr8uGU0DAUmYDjj2Mr4X1cW8v/GLYnR+g== - -"js-tokens@^3.0.0 || ^4.0.0": +js-tokens@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== -jsbn@1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-1.1.0.tgz#b01307cb29b618a1ed26ec79e911f803c4da0040" - integrity sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A== - -jsbn@~0.1.0: - version "0.1.1" - resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" - integrity sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg== - -json-buffer@3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/json-buffer/-/json-buffer-3.0.1.tgz#9338802a30d3b6605fbe0613e094008ca8c05a13" - integrity sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ== - -json-rpc-engine@^5.3.0: - version "5.4.0" - resolved "https://registry.yarnpkg.com/json-rpc-engine/-/json-rpc-engine-5.4.0.tgz#75758609d849e1dba1e09021ae473f3ab63161e5" - integrity sha512-rAffKbPoNDjuRnXkecTjnsE3xLLrb00rEkdgalINhaYVYIxDwWtvYBr9UFbhTvPB1B2qUOLoFd/cV6f4Q7mh7g== - dependencies: - eth-rpc-errors "^3.0.0" - safe-event-emitter "^1.0.1" - -json-rpc-engine@^6.1.0: - version "6.1.0" - resolved "https://registry.yarnpkg.com/json-rpc-engine/-/json-rpc-engine-6.1.0.tgz#bf5ff7d029e1c1bf20cb6c0e9f348dcd8be5a393" - integrity sha512-NEdLrtrq1jUZyfjkr9OCz9EzCNhnRyWtt1PAnvnhwy6e8XETS0Dtc+ZNCO2gvuAoKsIn2+vCSowXTYE4CkgnAQ== - dependencies: - "@metamask/safe-event-emitter" "^2.0.0" - eth-rpc-errors "^4.0.2" - -json-rpc-random-id@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/json-rpc-random-id/-/json-rpc-random-id-1.0.1.tgz#ba49d96aded1444dbb8da3d203748acbbcdec8c8" - integrity sha512-RJ9YYNCkhVDBuP4zN5BBtYAzEl03yq/jIIsyif0JY9qyJuQQZNeDK7anAPKKlyEtLSj2s8h6hNh2F8zO5q7ScA== - -json-schema-traverse@^0.4.1: - version "0.4.1" - resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" - integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== - -json-schema@0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.4.0.tgz#f7de4cf6efab838ebaeb3236474cbba5a1930ab5" - integrity sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA== - -json-stable-stringify@^1.0.1: - version "1.3.0" - resolved "https://registry.yarnpkg.com/json-stable-stringify/-/json-stable-stringify-1.3.0.tgz#8903cfac42ea1a0f97f35d63a4ce0518f0cc6a70" - integrity sha512-qtYiSSFlwot9XHtF9bD9c7rwKjr+RecWT//ZnPvSmEjpV5mmPOCN4j8UjY5hbjNkOwZ/jQv3J6R1/pL7RwgMsg== - dependencies: - call-bind "^1.0.8" - call-bound "^1.0.4" - isarray "^2.0.5" - jsonify "^0.0.1" - object-keys "^1.1.1" - -json-stringify-safe@~5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" - integrity sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA== - -jsonfile@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb" - integrity sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg== - optionalDependencies: - graceful-fs "^4.1.6" - -jsonify@^0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.1.tgz#2aa3111dae3d34a0f151c63f3a45d995d9420978" - integrity sha512-2/Ki0GcmuqSrgFyelQq9M05y7PS0mEwuIzrf3f1fPqkVDVRvZrPZtVSMHxdgo8Aq0sxAOb/cr2aqqA3LeWHVPg== - -jsprim@^1.2.2: - version "1.4.2" - resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.2.tgz#712c65533a15c878ba59e9ed5f0e26d5b77c5feb" - integrity sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw== - dependencies: - assert-plus "1.0.0" - extsprintf "1.3.0" - json-schema "0.4.0" - verror "1.10.0" - -jwa@^2.0.0: +jwa@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/jwa/-/jwa-2.0.1.tgz#bf8176d1ad0cd72e0f3f58338595a13e110bc804" integrity sha512-hRF04fqJIP8Abbkq5NKGN0Bbr3JxlQ+qhZufXVr0DvujKy93ZCbXZMHDL4EOtodSbCWxOqR8MS1tXA5hwqCXDg== @@ -4154,15 +1511,15 @@ jwa@^2.0.0: ecdsa-sig-formatter "1.0.11" safe-buffer "^5.0.1" -jws@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/jws/-/jws-4.0.0.tgz#2d4e8cf6a318ffaa12615e9dec7e86e6c97310f4" - integrity sha512-KDncfTmOZoOMTFG4mBlG0qUIOlc03fmzH+ru6RgYVZhPkyiy/92Owlt/8UEN+a4TXR1FQetfIpJE8ApdvdVxTg== +jws@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/jws/-/jws-4.0.1.tgz#07edc1be8fac20e677b283ece261498bd38f0690" + integrity sha512-EKI/M/yqPncGUUh44xz0PxSidXFr/+r0pA70+gIYhjv+et7yxM+s29Y+VGDkovRofQem0fs7Uvf4+YmAdyRduA== dependencies: - jwa "^2.0.0" + jwa "^2.0.1" safe-buffer "^5.0.1" -keccak@^3.0.0, keccak@^3.0.3: +keccak@^3.0.0: version "3.0.4" resolved "https://registry.yarnpkg.com/keccak/-/keccak-3.0.4.tgz#edc09b89e633c0549da444432ecf062ffadee86d" integrity sha512-3vKuW0jV8J3XNTzvfyicFR5qvxrSAGl7KIhvgOu5cmWwM7tZRj3fMbj/pfIf4be7aznbc+prBWGjywox/g2Y6Q== @@ -4171,24 +1528,6 @@ keccak@^3.0.0, keccak@^3.0.3: node-gyp-build "^4.2.0" readable-stream "^3.6.0" -keyv@^4.0.0: - version "4.5.4" - resolved "https://registry.yarnpkg.com/keyv/-/keyv-4.5.4.tgz#a879a99e29452f942439f2a405e3af8b31d4de93" - integrity sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw== - dependencies: - json-buffer "3.0.1" - -ledger-bitcoin@^0.2.3: - version "0.2.3" - resolved "https://registry.yarnpkg.com/ledger-bitcoin/-/ledger-bitcoin-0.2.3.tgz#9954f4464f1f439e393d228ae477ad86573d023b" - integrity sha512-sWdvMTR5CkebNlM0Mam9ROdpsD7Y4087kj4cbIaCCq8IXShCQ44vE3j0wTmt+sHp13eETgY63OWN1rkuIfMfuQ== - dependencies: - "@bitcoinerlab/descriptors" "^1.0.2" - "@bitcoinerlab/secp256k1" "^1.0.5" - "@ledgerhq/hw-transport" "^6.20.0" - bip32-path "^0.4.2" - bitcoinjs-lib "^6.1.3" - level-codec@^9.0.0: version "9.0.2" resolved "https://registry.yarnpkg.com/level-codec/-/level-codec-9.0.2.tgz#fd60df8c64786a80d44e63423096ffead63d8cbc" @@ -4247,58 +1586,21 @@ levelup@^3.0.0: level-iterator-stream "~3.0.0" xtend "~4.0.0" -lodash.memoize@^4.1.2: - version "4.1.2" - resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe" - integrity sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag== - lodash@^4.17.14, lodash@^4.17.21: - version "4.17.21" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" - integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== - -long@5.2.5: - version "5.2.5" - resolved "https://registry.yarnpkg.com/long/-/long-5.2.5.tgz#716dcb0807c406345b3fc0f34d8042b41edb9d16" - integrity sha512-e0r9YBBgNCq1D1o5Dp8FMH0N5hsFtXDBiVa0qoJPHpakvZkmDKPRoGffZJII/XsHvj9An9blm+cRJ01yQqU+Dw== - -long@^5.0.0: - version "5.3.2" - resolved "https://registry.yarnpkg.com/long/-/long-5.3.2.tgz#1d84463095999262d7d7b7f8bfd4a8cc55167f83" - integrity sha512-mNAgZ1GmyNhD7AuqnTG3/VQ26o760+ZYBPKjPvugO8+nLbYfX6TVpJPseBvopbdY+qpZ/lKUnmEc1LeZYS3QAA== - -loose-envify@^1.1.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" - integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q== - dependencies: - js-tokens "^3.0.0 || ^4.0.0" - -lowercase-keys@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-2.0.0.tgz#2603e78b7b4b0006cbca2fbcc8a3202558ac9479" - integrity sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA== - -lowercase-keys@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-3.0.0.tgz#c5e7d442e37ead247ae9db117a9d0a467c89d4f2" - integrity sha512-ozCC6gdQ+glXOQsveKD0YsDy8DSQFjDTz4zyzEHNV5+JP5D62LmfDZ6o1cycFx9ouG940M5dE8C8CTewdj2YWQ== + version "4.18.1" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.18.1.tgz#ff2b66c1f6326d59513de2407bf881439812771c" + integrity sha512-dMInicTPVE8d1e5otfwmmjlxkZoUpiVLwyeTdUsi/Caj/gfzzblBcCE5sRHV/AsjuCmxWrte2TNGSYuCeCq+0Q== lru-cache@^11.0.0: - version "11.1.0" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-11.1.0.tgz#afafb060607108132dbc1cf8ae661afb69486117" - integrity sha512-QIXZUBJUx+2zHUdQujWejBkcD9+cs94tLn0+YL8UrCh+D5sCXZ4c7LaEH48pNwRY3MLDgqUFyhlCyjJPf1WP0A== + version "11.5.2" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-11.5.2.tgz#00e16665c90c620fba14a3c368732a976493f760" + integrity sha512-4pfM1Ff0x50o0tQwb5ucw/RzNyD0/YJME6IVcStalZuMWxdt3sR3huStTtxz4PUmvZfRguvDejasvQ2kifR11g== ltgt@~2.2.0: version "2.2.1" resolved "https://registry.yarnpkg.com/ltgt/-/ltgt-2.2.1.tgz#f35ca91c493f7b73da0e07495304f17b31f87ee5" integrity sha512-AI2r85+4MquTw9ZYqabu4nMwy9Oftlfa/e/52t9IjtfG+mGBbTNdAoZ3RQKLHR6r0wQnwZnPIEh/Ya6XTWAKNA== -map-obj@^4.1.0: - version "4.3.0" - resolved "https://registry.yarnpkg.com/map-obj/-/map-obj-4.3.0.tgz#9304f906e93faae70880da102a9f1df0ea8bb05a" - integrity sha512-hdN1wVrZbb29eBGiGjJbeP8JbKjq1urkHJ/LIP/NY48MZ1QVXUsQBV1G1zvYFHn1XE06cwjBsOI2K3Ulnj1YXQ== - math-intrinsics@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/math-intrinsics/-/math-intrinsics-1.1.0.tgz#a0dd74be81e2aa5c2f27e65ce283605ee4e2b7f9" @@ -4313,11 +1615,6 @@ md5.js@^1.3.4: inherits "^2.0.1" safe-buffer "^5.1.2" -media-typer@0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748" - integrity sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ== - memdown@~3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/memdown/-/memdown-3.0.0.tgz#93aca055d743b20efc37492e9e399784f2958309" @@ -4330,16 +1627,6 @@ memdown@~3.0.0: ltgt "~2.2.0" safe-buffer "~5.1.1" -merge-descriptors@1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/merge-descriptors/-/merge-descriptors-1.0.3.tgz#d80319a65f3c7935351e5cfdac8f9318504dbed5" - integrity sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ== - -merkle-lib@^2.0.10: - version "2.0.10" - resolved "https://registry.yarnpkg.com/merkle-lib/-/merkle-lib-2.0.10.tgz#82b8dbae75e27a7785388b73f9d7725d0f6f3326" - integrity sha512-XrNQvUbn1DL5hKNe46Ccs+Tu3/PYOlrcZILuGUhb95oKBPjc/nmIC8D462PQkipVDGKRvwhn+QFg2cCdIvmDJA== - "merkle-patricia-tree@github:zmitton/merkle-patricia-tree#build": version "3.0.0" resolved "https://codeload.github.com/zmitton/merkle-patricia-tree/tar.gz/3e33005b879d839dea2239cae9e65171f2cc17a2" @@ -4352,50 +1639,31 @@ merkle-lib@^2.0.10: rlp "^2.0.0" semaphore ">=1.0.1" -methods@~1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" - integrity sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w== - micro-ftch@^0.3.1: version "0.3.1" resolved "https://registry.yarnpkg.com/micro-ftch/-/micro-ftch-0.3.1.tgz#6cb83388de4c1f279a034fb0cf96dfc050853c5f" integrity sha512-/0LLxhzP0tfiR5hcQebtudP56gUurs2CLkGarnCiB/OqEyUFQ6U3paQi/tgLv0hBJYt2rnr9MNpxz4fiiugstg== +micromatch@^4.0.4: + version "4.0.8" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.8.tgz#d66fa18f3a47076789320b9b1af32bd86d9fa202" + integrity sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA== + dependencies: + braces "^3.0.3" + picomatch "^2.3.1" + mime-db@1.52.0: version "1.52.0" resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70" integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== -mime-types@^2.1.12, mime-types@^2.1.16, mime-types@~2.1.19, mime-types@~2.1.24, mime-types@~2.1.34: +mime-types@^2.1.35: version "2.1.35" resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a" integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== dependencies: mime-db "1.52.0" -mime@1.6.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1" - integrity sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg== - -mimic-response@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-1.0.1.tgz#4923538878eef42063cb8a3e3b0798781487ab1b" - integrity sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ== - -mimic-response@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-3.1.0.tgz#2d1d59af9c1b129815accc2c46a022a5ce1fa3c9" - integrity sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ== - -min-document@^2.19.0: - version "2.19.0" - resolved "https://registry.yarnpkg.com/min-document/-/min-document-2.19.0.tgz#7bd282e3f5842ed295bb748cdd9f1ffa2c824685" - integrity sha512-9Wy1B3m3f66bPPmU5hdA4DR4PB2OfDU/+GS3yAB7IQozE3tqXaVv2zOjgla7MEGSRv95+ILmOuvhLkOK6wJtCQ== - dependencies: - dom-walk "^0.1.0" - minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7" @@ -4406,455 +1674,140 @@ minimalistic-crypto-utils@^1.0.1: resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" integrity sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg== -minimatch@^10.0.3: - version "10.0.3" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-10.0.3.tgz#cf7a0314a16c4d9ab73a7730a0e8e3c3502d47aa" - integrity sha512-IPZ167aShDZZUMdRk66cyQAW3qr0WzbHkPdMYa8bzZhlHhO3jALbKdxcaak7W9FfT2rZNpQuUu4Od7ILEpXSaw== - dependencies: - "@isaacs/brace-expansion" "^5.0.0" - -minimist@^1.2.6: - version "1.2.8" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c" - integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA== - -minipass@^2.6.0, minipass@^2.9.0: - version "2.9.0" - resolved "https://registry.yarnpkg.com/minipass/-/minipass-2.9.0.tgz#e713762e7d3e32fed803115cf93e04bca9fcc9a6" - integrity sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg== - dependencies: - safe-buffer "^5.1.2" - yallist "^3.0.0" - -minipass@^7.1.2: - version "7.1.2" - resolved "https://registry.yarnpkg.com/minipass/-/minipass-7.1.2.tgz#93a9626ce5e5e66bd4db86849e7515e92340a707" - integrity sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw== - -minizlib@^1.3.3: - version "1.3.3" - resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-1.3.3.tgz#2290de96818a34c29551c8a8d301216bd65a861d" - integrity sha512-6ZYMOEnmVsdCeTJVE0W9ZD+pVnE8h9Hma/iOwwRDsdQoePpoX56/8B6z3P9VNwppJuBKNRuFDRNRqRWexT9G9Q== - dependencies: - minipass "^2.9.0" - -mkdirp-promise@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/mkdirp-promise/-/mkdirp-promise-5.0.1.tgz#e9b8f68e552c68a9c1713b84883f7a1dd039b8a1" - integrity sha512-Hepn5kb1lJPtVW84RFT40YG1OddBNTOVUZR2bzQUHc+Z03en8/3uX0+060JDhcEzyO08HmipsN9DcnFMxhIL9w== - dependencies: - mkdirp "*" - -mkdirp@*: - version "3.0.1" - resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-3.0.1.tgz#e44e4c5607fb279c168241713cc6e0fea9adcb50" - integrity sha512-+NsyUUAZDmo6YVHzL/stxSu3t9YS1iljliy3BSDrXJ/dkn1KYdmtZODGGjLcc9XLgVVpH4KshHB8XmZgMhaBXg== - -mkdirp@^0.5.5: - version "0.5.6" - resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.6.tgz#7def03d2432dcae4ba1d611445c48396062255f6" - integrity sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw== +minimatch@^10.2.2: + version "10.2.6" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-10.2.6.tgz#fd956bbe0b77241e9f15ac5dccb1c638060968ef" + integrity sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A== dependencies: - minimist "^1.2.6" - -mock-fs@^4.1.0: - version "4.14.0" - resolved "https://registry.yarnpkg.com/mock-fs/-/mock-fs-4.14.0.tgz#ce5124d2c601421255985e6e94da80a7357b1b18" - integrity sha512-qYvlv/exQ4+svI3UOvPUpLDF0OMX5euvUH0Ny4N5QyRyhNdgAgUrVH3iUINSzEPLvx0kbo/Bp28GJKIqvE7URw== + brace-expansion "^5.0.8" -ms@2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" - integrity sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A== +minipass@^7.1.2, minipass@^7.1.3: + version "7.1.3" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-7.1.3.tgz#79389b4eb1bb2d003a9bba87d492f2bd37bdc65b" + integrity sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A== -ms@2.1.3, ms@^2.1.3: +ms@^2.1.3: version "2.1.3" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== -multibase@^0.7.0: - version "0.7.0" - resolved "https://registry.yarnpkg.com/multibase/-/multibase-0.7.0.tgz#1adfc1c50abe05eefeb5091ac0c2728d6b84581b" - integrity sha512-TW8q03O0f6PNFTQDvh3xxH03c8CjGaaYrjkl9UQPG6rz53TQzzxJVCIWVjzcbN/Q5Y53Zd0IBQBMVktVgNx4Fg== - dependencies: - base-x "^3.0.8" - buffer "^5.5.0" - -multibase@~0.6.0: - version "0.6.1" - resolved "https://registry.yarnpkg.com/multibase/-/multibase-0.6.1.tgz#b76df6298536cc17b9f6a6db53ec88f85f8cc12b" - integrity sha512-pFfAwyTjbbQgNc3G7D48JkJxWtoJoBMaR4xQUOuB8RnCgRqaYmWNFeJTTvrJ2w51bjLq2zTby6Rqj9TQ9elSUw== - dependencies: - base-x "^3.0.8" - buffer "^5.5.0" - -multicodec@^0.5.5: - version "0.5.7" - resolved "https://registry.yarnpkg.com/multicodec/-/multicodec-0.5.7.tgz#1fb3f9dd866a10a55d226e194abba2dcc1ee9ffd" - integrity sha512-PscoRxm3f+88fAtELwUnZxGDkduE2HD9Q6GHUOywQLjOGT/HAdhjLDYNZ1e7VR0s0TP0EwZ16LNUTFpoBGivOA== - dependencies: - varint "^5.0.0" - -multicodec@^1.0.0: - version "1.0.4" - resolved "https://registry.yarnpkg.com/multicodec/-/multicodec-1.0.4.tgz#46ac064657c40380c28367c90304d8ed175a714f" - integrity sha512-NDd7FeS3QamVtbgfvu5h7fd1IlbaC4EQ0/pgU4zqE2vdHCmBGsUa0TiM8/TdSeG6BMPC92OOCf8F1ocE/Wkrrg== - dependencies: - buffer "^5.6.0" - varint "^5.0.0" - -multihashes@^0.4.15, multihashes@~0.4.15: - version "0.4.21" - resolved "https://registry.yarnpkg.com/multihashes/-/multihashes-0.4.21.tgz#dc02d525579f334a7909ade8a122dabb58ccfcb5" - integrity sha512-uVSvmeCWf36pU2nB4/1kzYZjsXD9vofZKpgudqkceYY5g2aZZXJ5r9lxuzoRLl1OAp28XljXsEJ/X/85ZsKmKw== - dependencies: - buffer "^5.5.0" - multibase "^0.7.0" - varint "^5.0.0" - -nan@^2.13.2, nan@^2.14.0: - version "2.23.0" - resolved "https://registry.yarnpkg.com/nan/-/nan-2.23.0.tgz#24aa4ddffcc37613a2d2935b97683c1ec96093c6" - integrity sha512-1UxuyYGdoQHcGg87Lkqm3FzefucTa0NAiOcuRsDmysep3c1LVCRK2krrUDafMWtjSG04htvAmvg96+SDknOmgQ== - -nano-json-stream-parser@^0.1.2: - version "0.1.2" - resolved "https://registry.yarnpkg.com/nano-json-stream-parser/-/nano-json-stream-parser-0.1.2.tgz#0cc8f6d0e2b622b479c40d499c46d64b755c6f5f" - integrity sha512-9MqxMH/BSJC7dnLsEMPyfN5Dvoo49IsPFYMcHw3Bcfc2kN0lpHRBSzlMSVx4HGyJ7s9B31CyBTVehWJoQ8Ctew== - -negotiator@0.6.3: - version "0.6.3" - resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.3.tgz#58e323a72fedc0d6f9cd4d31fe49f51479590ccd" - integrity sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg== - -next-tick@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.1.0.tgz#1836ee30ad56d67ef281b22bd199f709449b35eb" - integrity sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ== - node-addon-api@^2.0.0: version "2.0.2" resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-2.0.2.tgz#432cfa82962ce494b132e9d72a15b29f71ff5d32" integrity sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA== -node-addon-api@^3.0.0: - version "3.2.1" - resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-3.2.1.tgz#81325e0a2117789c0128dab65e7e38f07ceba161" - integrity sha512-mmcei9JghVNDYydghQmeDX8KoAm0FAiYyIcUt/N4nhyAipB17pllZQDOJD2fotxABnt4Mdz+dKTO7eftLg4d0A== - node-addon-api@^5.0.0: version "5.1.0" resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-5.1.0.tgz#49da1ca055e109a23d537e9de43c09cca21eb762" integrity sha512-eh0GgfEkpnoWDq+VY8OyvYhFEzBk6jIYbRKdIlyTiAXIVJ8PyBaKb0rp7oDtoddbdoHWhq8wwr+XZ81F1rpNdA== -node-addon-api@^8.0.0: - version "8.5.0" - resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-8.5.0.tgz#c91b2d7682fa457d2e1c388150f0dff9aafb8f3f" - integrity sha512-/bRZty2mXUIFY/xU5HLvveNHlswNJej+RnxBjOMkidWfwZzgTbPG1E3K5TOxRLOR+5hX7bSofy8yf1hZevMS8A== - node-fetch@^1.0.1: version "1.7.3" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-1.7.3.tgz#980f6f72d85211a5347c6b2bc18c5b84c3eb47ef" integrity sha512-NhZ4CsKx7cYm2vSrBAr2PvFOe6sWDf0UYLRqA6svUYg7+/TSfVAu49jYC4BvQ4Sms9SZgdqGBgroqfDhJdTyKQ== dependencies: - encoding "^0.1.11" - is-stream "^1.0.1" - -node-fetch@^2.6.1, node-fetch@^2.7.0: - version "2.7.0" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d" - integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A== - dependencies: - whatwg-url "^5.0.0" - -node-gyp-build@^4.2.0, node-gyp-build@^4.2.2, node-gyp-build@^4.3.0, node-gyp-build@^4.5.0: - version "4.8.4" - resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.8.4.tgz#8a70ee85464ae52327772a90d66c6077a900cfc8" - integrity sha512-LA4ZjwlnUblHVgq0oBF3Jl/6h/Nvs5fzBLwdEF4nuxnFdsfajde4WfxtJr3CaiH+F6ewcIB/q4jQ4UzPyid+CQ== - -node-localstorage@^2.1.6: - version "2.2.1" - resolved "https://registry.yarnpkg.com/node-localstorage/-/node-localstorage-2.2.1.tgz#869723550a4883e426cb391d2df0b563a51c7c1c" - integrity sha512-vv8fJuOUCCvSPjDjBLlMqYMHob4aGjkmrkaE42/mZr0VT+ZAU10jRF8oTnX9+pgU9/vYJ8P7YT3Vd6ajkmzSCw== - dependencies: - write-file-atomic "^1.1.4" - -normalize-url@^6.0.1: - version "6.1.0" - resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-6.1.0.tgz#40d0885b535deffe3f3147bec877d05fe4c5668a" - integrity sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A== - -number-to-bn@1.7.0: - version "1.7.0" - resolved "https://registry.yarnpkg.com/number-to-bn/-/number-to-bn-1.7.0.tgz#bb3623592f7e5f9e0030b1977bd41a0c53fe1ea0" - integrity sha512-wsJ9gfSz1/s4ZsJN01lyonwuxA1tml6X1yBDnfpMglypcBRFZZkus26EdPSlqS5GJfYddVZa22p3VNb3z5m5Ig== - dependencies: - bn.js "4.11.6" - strip-hex-prefix "1.0.0" - -oauth-sign@~0.9.0: - version "0.9.0" - resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.9.0.tgz#47a7b016baa68b5fa0ecf3dee08a85c679ac6455" - integrity sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ== - -object-assign@^4, object-assign@^4.1.0, object-assign@^4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" - integrity sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg== - -object-inspect@^1.13.3: - version "1.13.4" - resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.13.4.tgz#8375265e21bc20d0fa582c22e1b13485d6e00213" - integrity sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew== - -object-keys@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e" - integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA== - -oboe@2.1.5: - version "2.1.5" - resolved "https://registry.yarnpkg.com/oboe/-/oboe-2.1.5.tgz#5554284c543a2266d7a38f17e073821fbde393cd" - integrity sha512-zRFWiF+FoicxEs3jNI/WYUrVEgA7DeET/InK0XQuudGHRg8iIob3cNPrJTKaz4004uaA9Pbe+Dwa8iluhjLZWA== - dependencies: - http-https "^1.0.0" - -on-finished@2.4.1: - version "2.4.1" - resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.4.1.tgz#58c8c44116e54845ad57f14ab10b03533184ac3f" - integrity sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg== - dependencies: - ee-first "1.1.1" - -once@^1.3.1, once@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" - integrity sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w== - dependencies: - wrappy "1" - -p-cancelable@^2.0.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/p-cancelable/-/p-cancelable-2.1.1.tgz#aab7fbd416582fa32a3db49859c122487c5ed2cf" - integrity sha512-BZOr3nRQHOntUjTrH8+Lh54smKHoHyur8We1V8DSMVrl5A2malOOwuJRnKRDjSnkoeBh4at6BwEnb5I7Jl31wg== + encoding "^0.1.11" + is-stream "^1.0.1" -p-cancelable@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/p-cancelable/-/p-cancelable-3.0.0.tgz#63826694b54d61ca1c20ebcb6d3ecf5e14cd8050" - integrity sha512-mlVgR3PGuzlo0MmTdk4cXqXWlwQDLnONTAg6sm62XkMJEiRxN3GL3SffkYvqwonbkJBcrI7Uvv5Zh9yjvn2iUw== +node-gyp-build@^4.2.0: + version "4.8.4" + resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.8.4.tgz#8a70ee85464ae52327772a90d66c6077a900cfc8" + integrity sha512-LA4ZjwlnUblHVgq0oBF3Jl/6h/Nvs5fzBLwdEF4nuxnFdsfajde4WfxtJr3CaiH+F6ewcIB/q4jQ4UzPyid+CQ== -package-json-from-dist@^1.0.0: +package-json-from-dist@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz#4f1471a010827a86f94cfd9b0727e36d267de505" integrity sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw== -parse-headers@^2.0.0: - version "2.0.6" - resolved "https://registry.yarnpkg.com/parse-headers/-/parse-headers-2.0.6.tgz#7940f0abe5fe65df2dd25d4ce8800cb35b49d01c" - integrity sha512-Tz11t3uKztEW5FEVZnj1ox8GKblWn+PvHY9TmJV5Mll2uHEwRdR/5Li1OlXoECjLYkApdhWy44ocONwXLiKO5A== - -parseurl@~1.3.3: - version "1.3.3" - resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.3.tgz#9da19e7bee8d12dff0513ed5b76957793bc2e8d4" - integrity sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ== - -path-key@^3.1.0: - version "3.1.1" - resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" - integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== - -path-scurry@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/path-scurry/-/path-scurry-2.0.0.tgz#9f052289f23ad8bf9397a2a0425e7b8615c58580" - integrity sha512-ypGJsmGtdXUOeM5u93TyeIEfEhM6s+ljAhrk5vAvSx8uyY/02OvrZnA0YNGUrPXfpJMgI1ODd3nwz8Npx4O4cg== +path-scurry@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/path-scurry/-/path-scurry-2.0.2.tgz#6be0d0ee02a10d9e0de7a98bae65e182c9061f85" + integrity sha512-3O/iVVsJAPsOnpwWIeD+d6z/7PmqApyQePUtCndjatj/9I5LylHvt5qluFaBT3I5h3r1ejfR056c+FCv+NnNXg== dependencies: lru-cache "^11.0.0" minipass "^7.1.2" -path-to-regexp@0.1.12: - version "0.1.12" - resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.12.tgz#d5e1a12e478a976d432ef3c58d534b9923164bb7" - integrity sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ== - pbkdf2@^3.0.17: - version "3.1.3" - resolved "https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.1.3.tgz#8be674d591d65658113424592a95d1517318dd4b" - integrity sha512-wfRLBZ0feWRhCIkoMB6ete7czJcnNnqRpcoWQBLqatqXXmelSRqfdDK4F3u9T2s2cXas/hQJcryI/4lAL+XTlA== + version "3.1.6" + resolved "https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.1.6.tgz#935cb1d99e491880cb48cb070bb539a6901e57d6" + integrity sha512-BT6eelPB1EyGHo8pC0o9Bl6k6SYVhKO1jEbd3lcTrtr7XHdjP8BW1YpfCV3G9Kwkxgattk+S5q2/RvuttCsS1g== dependencies: - create-hash "~1.1.3" + create-hash "^1.2.0" create-hmac "^1.1.7" - ripemd160 "=2.0.1" + ripemd160 "^2.0.3" safe-buffer "^5.2.1" - sha.js "^2.4.11" - to-buffer "^1.2.0" + sha.js "^2.4.12" + to-buffer "^1.2.2" -performance-now@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" - integrity sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow== +picocolors@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.1.1.tgz#3d321af3eab939b083c8f929a1d12cda81c26b6b" + integrity sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA== -pify@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/pify/-/pify-3.0.0.tgz#e5a4acd2c101fdf3d9a4d07f0dbc4db49dd28176" - integrity sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg== +picomatch@^2.2.3, picomatch@^2.3.1: + version "2.3.2" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.2.tgz#5a942915e26b372dc0f0e6753149a16e6b1c5601" + integrity sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA== -pify@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/pify/-/pify-5.0.0.tgz#1f5eca3f5e87ebec28cc6d54a0e4aaf00acc127f" - integrity sha512-eW/gHNMlxdSP6dmG6uJip6FXN0EQBwm2clYYd8Wul42Cwu/DK8HEftzsapcNdYe2MfLiIwZqsDk2RDEsTE79hA== +pony-cause@^2.1.10: + version "2.1.11" + resolved "https://registry.yarnpkg.com/pony-cause/-/pony-cause-2.1.11.tgz#d69a20aaccdb3bdb8f74dd59e5c68d8e6772e4bd" + integrity sha512-M7LhCsdNbNgiLYiP4WjsfLUuFmCfnjdF6jKe2R9NKl4WFN+HZPGHJZ9lnLP7f9ZnKe3U9nuWD0szirmj+migUg== possible-typed-array-names@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/possible-typed-array-names/-/possible-typed-array-names-1.1.0.tgz#93e3582bc0e5426586d9d07b79ee40fc841de4ae" integrity sha512-/+5VFTchJDoVj3bhoqi6UeymcD00DAwb1nJwamzPvHEszJ4FpF6SNNbUbOS8yI56qHzdV8eK0qEfOSiodkTdxg== +pretty-format@^29.0.0, pretty-format@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-29.7.0.tgz#ca42c758310f365bfa71a0bda0a807160b776812" + integrity sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ== + dependencies: + "@jest/schemas" "^29.6.3" + ansi-styles "^5.0.0" + react-is "^18.0.0" + process-nextick-args@~2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag== -process@^0.11.10: - version "0.11.10" - resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182" - integrity sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A== - promisfy@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/promisfy/-/promisfy-1.2.0.tgz#d34cfec196bddd6a2cfa0bf64eaca53dbc9250a8" integrity sha512-9S6NY6pVlmrvQX/KIZn4V8EPcKNAC0l5nEKXTa5K1/uzqnMOn4ivWtQY+IbSE/f9uLUa1T/kbDsASSzi05X3dA== -protobufjs@7.4.0: - version "7.4.0" - resolved "https://registry.yarnpkg.com/protobufjs/-/protobufjs-7.4.0.tgz#7efe324ce9b3b61c82aae5de810d287bc08a248a" - integrity sha512-mRUWCc3KUU4w1jU8sGxICXH/gNS94DvI1gxqDvBzhj1JpcsimQkYiOJfwsPUykUI5ZaspFbSgmBLER8IrQ3tqw== - dependencies: - "@protobufjs/aspromise" "^1.1.2" - "@protobufjs/base64" "^1.1.2" - "@protobufjs/codegen" "^2.0.4" - "@protobufjs/eventemitter" "^1.1.0" - "@protobufjs/fetch" "^1.1.0" - "@protobufjs/float" "^1.0.2" - "@protobufjs/inquire" "^1.1.0" - "@protobufjs/path" "^1.1.2" - "@protobufjs/pool" "^1.1.0" - "@protobufjs/utf8" "^1.1.0" - "@types/node" ">=13.7.0" - long "^5.0.0" - -proxy-addr@~2.0.7: - version "2.0.7" - resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-2.0.7.tgz#f19fe69ceab311eeb94b42e70e8c2070f9ba1025" - integrity sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg== - dependencies: - forwarded "0.2.0" - ipaddr.js "1.9.1" - -proxy-from-env@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2" - integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg== +proxy-from-env@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-2.1.0.tgz#a7487568adad577cfaaa7e88c49cab3ab3081aba" + integrity sha512-cJ+oHTW1VAEa8cJslgmUZrc+sjRKgAKl3Zyse6+PV38hZe/V6Z14TbCuXcan9F9ghlz4QrFr2c92TNF82UkYHA== prr@~1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/prr/-/prr-1.0.1.tgz#d3fc114ba06995a45ec6893f484ceb1d78f5f476" integrity sha512-yPw4Sng1gWghHQWj0B3ZggWUm4qVbPwPFcRG8KyxiU7J2OHFSoEHKS+EZ3fv5l1t9CyCiop6l/ZYeWbrgoQejw== -psl@^1.1.28: - version "1.15.0" - resolved "https://registry.yarnpkg.com/psl/-/psl-1.15.0.tgz#bdace31896f1d97cec6a79e8224898ce93d974c6" - integrity sha512-JZd3gMVBAVQkSs6HdNZo9Sdo0LNcQeMNP3CozBJb3JYC/QUYZTnKxP+f8oWRX4rHP5EurWxqAHTSwUCjlNKa1w== - dependencies: - punycode "^2.3.1" - -pump@^3.0.0: - version "3.0.3" - resolved "https://registry.yarnpkg.com/pump/-/pump-3.0.3.tgz#151d979f1a29668dc0025ec589a455b53282268d" - integrity sha512-todwxLMY7/heScKmntwQG8CXVkWUOdYxIvY2s0VWAAMh/nd8SoYiRaKjlr7+iCs984f2P8zvrfWcDDYVb73NfA== - dependencies: - end-of-stream "^1.1.0" - once "^1.3.1" - -punycode@2.1.0: +purify-ts@2.1.0: version "2.1.0" - resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.0.tgz#5f863edc89b96db09074bad7947bf09056ca4e7d" - integrity sha512-Yxz2kRwT90aPiWEMHVYnEf4+rhwF1tBmmZ4KepCP+Wkium9JxtWnUm1nqGwpiAHr/tnTSeHqr3wb++jgSkXjhA== - -punycode@^2.1.0, punycode@^2.1.1, punycode@^2.3.1: - version "2.3.1" - resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.1.tgz#027422e2faec0b25e1549c3e1bd8309b9133b6e5" - integrity sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg== - -pushdata-bitcoin@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/pushdata-bitcoin/-/pushdata-bitcoin-1.0.1.tgz#15931d3cd967ade52206f523aa7331aef7d43af7" - integrity sha512-hw7rcYTJRAl4olM8Owe8x0fBuJJ+WGbMhQuLWOXEMN3PxPCKQHRkhfL+XG0+iXUmSHjkMmb3Ba55Mt21cZc9kQ== - dependencies: - bitcoin-ops "^1.3.0" - -qs@6.13.0: - version "6.13.0" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.13.0.tgz#6ca3bd58439f7e245655798997787b0d88a51906" - integrity sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg== - dependencies: - side-channel "^1.0.6" - -qs@~6.5.2: - version "6.5.3" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.3.tgz#3aeeffc91967ef6e35c0e488ef46fb296ab76aad" - integrity sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA== - -query-string@^5.0.1: - version "5.1.1" - resolved "https://registry.yarnpkg.com/query-string/-/query-string-5.1.1.tgz#a78c012b71c17e05f2e3fa2319dd330682efb3cb" - integrity sha512-gjWOsm2SoGlgLEdAGt7a6slVOk9mGiXmPFMqrEhLQ68rhQuBnpfs3+EmlvqKyxnCo9/PPlF+9MtY02S1aFg+Jw== + resolved "https://registry.yarnpkg.com/purify-ts/-/purify-ts-2.1.0.tgz#e51cd94aa29edc7e09e914b15b3367c490b3df40" + integrity sha512-+KNUHV9FxB9BbjadFdvxa+LNJIaqZmSF7CQH5Rv6+f0rBzsxm9FEqrvkALQbWYJobAja2ZCbBDUY7O4fH2znMA== dependencies: - decode-uri-component "^0.2.0" - object-assign "^4.1.0" - strict-uri-encode "^1.0.0" + "@types/json-schema" "7.0.15" -quick-lru@^5.1.1: - version "5.1.1" - resolved "https://registry.yarnpkg.com/quick-lru/-/quick-lru-5.1.1.tgz#366493e6b3e42a3a6885e2e99d18f80fb7a8c932" - integrity sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA== - -randombytes@^2.0.1, randombytes@^2.1.0: +randombytes@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" integrity sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ== dependencies: safe-buffer "^5.1.0" -range-parser@~1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.1.tgz#3cf37023d199e1c24d1a55b84800c2f3e6468031" - integrity sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg== - -raw-body@2.5.2: - version "2.5.2" - resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.5.2.tgz#99febd83b90e08975087e8f1f9419a149366b68a" - integrity sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA== - dependencies: - bytes "3.1.2" - http-errors "2.0.0" - iconv-lite "0.4.24" - unpipe "1.0.0" - -react-dom@^18.2.0: - version "18.3.1" - resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-18.3.1.tgz#c2265d79511b57d479b3dd3fdfa51536494c5cb4" - integrity sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw== - dependencies: - loose-envify "^1.1.0" - scheduler "^0.23.2" - -react@^18.2.0: +react-is@^18.0.0: version "18.3.1" - resolved "https://registry.yarnpkg.com/react/-/react-18.3.1.tgz#49ab892009c53933625bd16b2533fc754cab2891" - integrity sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ== - dependencies: - loose-envify "^1.1.0" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.3.1.tgz#e83557dc12eae63a99e003a46388b1dcbb44db7e" + integrity sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg== -readable-stream@^2.2.8, readable-stream@^2.3.6: +readable-stream@^2.2.8, readable-stream@^2.3.6, readable-stream@^2.3.8: version "2.3.8" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.8.tgz#91125e8042bba1b9887f49345f6277027ce8be9b" integrity sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA== @@ -4867,7 +1820,7 @@ readable-stream@^2.2.8, readable-stream@^2.3.6: string_decoder "~1.1.1" util-deprecate "~1.0.1" -readable-stream@^3.0.6, readable-stream@^3.5.0, readable-stream@^3.6.0: +readable-stream@^3.0.6, readable-stream@^3.6.0: version "3.6.2" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.2.tgz#56a9b36ea965c00c5a93ef31eb111a0f11056967" integrity sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA== @@ -4876,117 +1829,42 @@ readable-stream@^3.0.6, readable-stream@^3.5.0, readable-stream@^3.6.0: string_decoder "^1.1.1" util-deprecate "^1.0.1" -request@^2.79.0: - version "2.88.2" - resolved "https://registry.yarnpkg.com/request/-/request-2.88.2.tgz#d73c918731cb5a87da047e207234146f664d12b3" - integrity sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw== - dependencies: - aws-sign2 "~0.7.0" - aws4 "^1.8.0" - caseless "~0.12.0" - combined-stream "~1.0.6" - extend "~3.0.2" - forever-agent "~0.6.1" - form-data "~2.3.2" - har-validator "~5.1.3" - http-signature "~1.2.0" - is-typedarray "~1.0.0" - isstream "~0.1.2" - json-stringify-safe "~5.0.1" - mime-types "~2.1.19" - oauth-sign "~0.9.0" - performance-now "^2.1.0" - qs "~6.5.2" - safe-buffer "^5.1.2" - tough-cookie "~2.5.0" - tunnel-agent "^0.6.0" - uuid "^3.3.2" - -require-addon@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/require-addon/-/require-addon-1.1.0.tgz#0a1ef0ba98b186a3aa304a1abda5208902e63e17" - integrity sha512-KbXAD5q2+v1GJnkzd8zzbOxchTkStSyJZ9QwoCq3QwEXAaIlG3wDYRZGzVD357jmwaGY7hr5VaoEAL0BkF0Kvg== - dependencies: - bare-addon-resolve "^1.3.0" - bare-url "^2.1.0" - -resolve-alpn@^1.0.0, resolve-alpn@^1.2.0: - version "1.2.1" - resolved "https://registry.yarnpkg.com/resolve-alpn/-/resolve-alpn-1.2.1.tgz#b7adbdac3546aaaec20b45e7d8265927072726f9" - integrity sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g== - -responselike@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/responselike/-/responselike-2.0.1.tgz#9a0bc8fdc252f3fb1cca68b016591059ba1422bc" - integrity sha512-4gl03wn3hj1HP3yzgdI7d3lCkF95F21Pz4BPGvKHinyQzALR5CapwC8yIi0Rh58DEMQ/SguC03wFj2k0M/mHhw== - dependencies: - lowercase-keys "^2.0.0" +reflect-metadata@0.2.2: + version "0.2.2" + resolved "https://registry.yarnpkg.com/reflect-metadata/-/reflect-metadata-0.2.2.tgz#400c845b6cba87a21f2c65c4aeb158f4fa4d9c5b" + integrity sha512-urBwgfrvVP/eAyXx4hluJivBKzuEbSQs9rKWCrCkbSxNv8mxPcUZKeuoF3Uy4mJl3Lwprp6yy5/39VWigZ4K6Q== rimraf@^6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-6.0.1.tgz#ffb8ad8844dd60332ab15f52bc104bc3ed71ea4e" - integrity sha512-9dkvaxAsk/xNXSJzMgFqqMCuFgt2+KsOFek3TMLfo8NCPfWpBmqwyNn5Y+NX56QUYfCtsyhF3ayiboEoUmJk/A== - dependencies: - glob "^11.0.0" - package-json-from-dist "^1.0.0" - -ripemd160@=2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-2.0.1.tgz#0f4584295c53a3628af7e6d79aca21ce57d1c6e7" - integrity sha512-J7f4wutN8mdbV08MJnXibYpCOPHR+yzy+iQ/AsjMv2j8cLavQ8VGagDFUwwTAdF8FmRKVeNpbTTEwNHCW1g94w== - dependencies: - hash-base "^2.0.0" - inherits "^2.0.1" - -ripemd160@^2.0.0, ripemd160@^2.0.1, ripemd160@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-2.0.2.tgz#a1c1a6f624751577ba5d07914cbc92850585890c" - integrity sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA== + version "6.1.3" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-6.1.3.tgz#afbee236b3bd2be331d4e7ce4493bac1718981af" + integrity sha512-LKg+Cr2ZF61fkcaK1UdkH2yEBBKnYjTyWzTJT6KNPcSPaiT7HSdhtMXQuN5wkTX0Xu72KQ1l8S42rlmexS2hSA== dependencies: - hash-base "^3.0.0" - inherits "^2.0.1" - -ripple-address-codec@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/ripple-address-codec/-/ripple-address-codec-5.0.0.tgz#97059f7bba6f9ed7a52843de8aa427723fb529f6" - integrity sha512-de7osLRH/pt5HX2xw2TRJtbdLLWHu0RXirpQaEeCnWKY5DYHykh3ETSkofvm0aX0LJiV7kwkegJxQkmbO94gWw== - dependencies: - "@scure/base" "^1.1.3" - "@xrplf/isomorphic" "^1.0.0" - -ripple-binary-codec@^2.4.0: - version "2.4.1" - resolved "https://registry.yarnpkg.com/ripple-binary-codec/-/ripple-binary-codec-2.4.1.tgz#14990af5ab48775cbe109526c6066692768a25de" - integrity sha512-ABwQnWE1WBOvya9WIJ/KiogdsulOw5X8IrIZ3wW0Ec1hiWUNitNuI9LhN9XwHhNFuuvZyRAr+SzgFTBTCTfxFg== - dependencies: - "@xrplf/isomorphic" "^1.0.1" - bignumber.js "^9.0.0" - ripple-address-codec "^5.0.0" + glob "^13.0.3" + package-json-from-dist "^1.0.1" -ripple-keypairs@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/ripple-keypairs/-/ripple-keypairs-2.0.0.tgz#4a1a8142e9a58c07e61b3cc6cfe7317db718d289" - integrity sha512-b5rfL2EZiffmklqZk1W+dvSy97v3V/C7936WxCCgDynaGPp7GE6R2XO7EU9O2LlM/z95rj870IylYnOQs+1Rag== +ripemd160@^2.0.0, ripemd160@^2.0.1, ripemd160@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-2.0.3.tgz#9be54e4ba5e3559c8eee06a25cd7648bbccdf5a8" + integrity sha512-5Di9UC0+8h1L6ZD2d7awM7E/T4uA1fJRlx6zk/NvdCCVEoAnFqvHmCuNeIKoCeIixBX/q8uM+6ycDvF8woqosA== dependencies: - "@noble/curves" "^1.0.0" - "@xrplf/isomorphic" "^1.0.0" - ripple-address-codec "^5.0.0" + hash-base "^3.1.2" + inherits "^2.0.4" -rlp@^2.0.0, rlp@^2.2.3, rlp@^2.2.4: +rlp@^2.0.0, rlp@^2.2.3: version "2.2.7" resolved "https://registry.yarnpkg.com/rlp/-/rlp-2.2.7.tgz#33f31c4afac81124ac4b283e2bd4d9720b30beaf" integrity sha512-d5gdPmgQ0Z+AklL2NVXr/IoSjNZFfTVvQWzL/AM2AOcSzYP2xjlb0AC8YyCLc41MSNf6P6QVtjgPdmVtzb+4lQ== dependencies: bn.js "^5.2.0" -rxjs@^7.8.1: +rxjs@7.8.2: version "7.8.2" resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.8.2.tgz#955bc473ed8af11a002a2be52071bf475638607b" integrity sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA== dependencies: tslib "^2.1.0" -safe-buffer@5.2.1, safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@^5.2.0, safe-buffer@^5.2.1, safe-buffer@~5.2.0: +safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@^5.2.1, safe-buffer@~5.2.0: version "5.2.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== @@ -4996,60 +1874,16 @@ safe-buffer@~5.1.0, safe-buffer@~5.1.1: resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== -safe-event-emitter@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/safe-event-emitter/-/safe-event-emitter-1.0.1.tgz#5b692ef22329ed8f69fdce607e50ca734f6f20af" - integrity sha512-e1wFe99A91XYYxoQbcq2ZJUWurxEyP8vfz7A7vuUe1s95q8r5ebraVaA1BukYJcpM6V16ugWoD9vngi8Ccu5fg== - dependencies: - events "^3.0.0" - -safe-regex-test@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/safe-regex-test/-/safe-regex-test-1.1.0.tgz#7f87dfb67a3150782eaaf18583ff5d1711ac10c1" - integrity sha512-x/+Cz4YrimQxQccJf5mKEbIa1NzeCRNI5Ecl/ekmlYaampdNLPalVyIcCZNNH3MvmqBugV5TMYZXv0ljslUlaw== - dependencies: - call-bound "^1.0.2" - es-errors "^1.3.0" - is-regex "^1.2.1" - -"safer-buffer@>= 2.1.2 < 3", "safer-buffer@>= 2.1.2 < 3.0.0", safer-buffer@^2.0.2, safer-buffer@^2.1.0, safer-buffer@~2.1.0: +"safer-buffer@>= 2.1.2 < 3.0.0": version "2.1.2" resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== -satoshi-bitcoin@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/satoshi-bitcoin/-/satoshi-bitcoin-1.0.5.tgz#d2a2b12dd904715e4ca17e17493ffff75ce2af72" - integrity sha512-iCUOSe8yTOqetYcj/n4ziv0psqRMRZT4+YhcMrQIYpjnx3Pgn9uiTlaUItNMMB/0sldINEGkJvxwTW55OfrYPg== - dependencies: - big.js "^3.1.3" - -scheduler@^0.23.2: - version "0.23.2" - resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.23.2.tgz#414ba64a3b282892e944cf2108ecc078d115cdc3" - integrity sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ== - dependencies: - loose-envify "^1.1.0" - -scrypt-js@3.0.1, scrypt-js@^3.0.0, scrypt-js@^3.0.1: +scrypt-js@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/scrypt-js/-/scrypt-js-3.0.1.tgz#d314a57c2aef69d1ad98a138a21fe9eafa9ee312" integrity sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA== -secp256k1@^3.8.0: - version "3.8.1" - resolved "https://registry.yarnpkg.com/secp256k1/-/secp256k1-3.8.1.tgz#b62a62a882d6b16f9b51fe599c6b3a861e36c59f" - integrity sha512-tArjQw2P0RTdY7QmkNehgp6TVvQXq6ulIhxv8gaH6YubKG/wxxAoNKcbuXjDhybbc+b2Ihc7e0xxiGN744UIiQ== - dependencies: - bindings "^1.5.0" - bip66 "^1.1.5" - bn.js "^4.11.8" - create-hash "^1.2.0" - drbg.js "^1.0.1" - elliptic "^6.5.7" - nan "^2.14.0" - safe-buffer "^5.1.2" - secp256k1@^4.0.1: version "4.0.4" resolved "https://registry.yarnpkg.com/secp256k1/-/secp256k1-4.0.4.tgz#58f0bfe1830fe777d9ca1ffc7574962a8189f8ab" @@ -5064,50 +1898,15 @@ semaphore@>=1.0.1: resolved "https://registry.yarnpkg.com/semaphore/-/semaphore-1.1.0.tgz#aaad8b86b20fe8e9b32b16dc2ee682a8cd26a8aa" integrity sha512-O4OZEaNtkMd/K0i6js9SL+gqy0ZCBMgUvlSqHKi4IBdjhe7wB8pwztUk1BbZ1fmrvpwFrPbHzqd2w5pTcJH6LA== -semver@^7.3.5: +semver@7.7.2: version "7.7.2" resolved "https://registry.yarnpkg.com/semver/-/semver-7.7.2.tgz#67d99fdcd35cec21e6f8b87a7fd515a33f982b58" integrity sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA== -send@0.19.0: - version "0.19.0" - resolved "https://registry.yarnpkg.com/send/-/send-0.19.0.tgz#bbc5a388c8ea6c048967049dbeac0e4a3f09d7f8" - integrity sha512-dW41u5VfLXu8SJh5bwRmyYUbAoSB3c9uQh6L8h/KtsFREPWpbX1lrljJo186Jc4nmci/sGUZ9a0a0J2zgfq2hw== - dependencies: - debug "2.6.9" - depd "2.0.0" - destroy "1.2.0" - encodeurl "~1.0.2" - escape-html "~1.0.3" - etag "~1.8.1" - fresh "0.5.2" - http-errors "2.0.0" - mime "1.6.0" - ms "2.1.3" - on-finished "2.4.1" - range-parser "~1.2.1" - statuses "2.0.1" - -serve-static@1.16.2: - version "1.16.2" - resolved "https://registry.yarnpkg.com/serve-static/-/serve-static-1.16.2.tgz#b6a5343da47f6bdd2673848bf45754941e803296" - integrity sha512-VqpjJZKadQB/PEbEwvFdO43Ax5dFBZ2UECszz8bQ7pi7wt//PWe1P6MN7eCnjsatYtBT6EuiClbjSWP2WrIoTw== - dependencies: - encodeurl "~2.0.0" - escape-html "~1.0.3" - parseurl "~1.3.3" - send "0.19.0" - -servify@^0.1.12: - version "0.1.12" - resolved "https://registry.yarnpkg.com/servify/-/servify-0.1.12.tgz#142ab7bee1f1d033b66d0707086085b17c06db95" - integrity sha512-/xE6GvsKKqyo1BAY+KxOWXcLpPsUUyji7Qg3bVD7hh1eRze5bR1uYiuDA/k3Gof1s9BTzQZEJK8sNcNGFIzeWw== - dependencies: - body-parser "^1.16.0" - cors "^2.8.1" - express "^4.14.0" - request "^2.79.0" - xhr "^2.3.3" +semver@^7.5.4: + version "7.8.5" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.8.5.tgz#39b646037dd50c14fb451e7e4cac58ed8b863f69" + integrity sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA== set-function-length@^1.2.2: version "1.2.2" @@ -5126,12 +1925,7 @@ setimmediate@^1.0.5: resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285" integrity sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA== -setprototypeof@1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.2.0.tgz#66c9a24a73f9fc28cbe66b09fed3d33dcaf1b424" - integrity sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw== - -sha.js@^2.3.6, sha.js@^2.4.0, sha.js@^2.4.11, sha.js@^2.4.8: +sha.js@^2.4.0, sha.js@^2.4.12, sha.js@^2.4.8: version "2.4.12" resolved "https://registry.yarnpkg.com/sha.js/-/sha.js-2.4.12.tgz#eb8b568bf383dfd1867a32c3f2b74eb52bdbf23f" integrity sha512-8LzC5+bvI45BjpfXU8V5fdU2mfeKiQe1D1gIMn7XUlF3OTUrpdJpPPH4EMAnF0DsHHdSZqCdSss5qCmJKuiO3w== @@ -5140,175 +1934,17 @@ sha.js@^2.3.6, sha.js@^2.4.0, sha.js@^2.4.11, sha.js@^2.4.8: safe-buffer "^5.2.1" to-buffer "^1.2.0" -shebang-command@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" - integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA== - dependencies: - shebang-regex "^3.0.0" - -shebang-regex@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" - integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== - -side-channel-list@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/side-channel-list/-/side-channel-list-1.0.0.tgz#10cb5984263115d3b7a0e336591e290a830af8ad" - integrity sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA== - dependencies: - es-errors "^1.3.0" - object-inspect "^1.13.3" - -side-channel-map@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/side-channel-map/-/side-channel-map-1.0.1.tgz#d6bb6b37902c6fef5174e5f533fab4c732a26f42" - integrity sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA== - dependencies: - call-bound "^1.0.2" - es-errors "^1.3.0" - get-intrinsic "^1.2.5" - object-inspect "^1.13.3" - -side-channel-weakmap@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz#11dda19d5368e40ce9ec2bdc1fb0ecbc0790ecea" - integrity sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A== - dependencies: - call-bound "^1.0.2" - es-errors "^1.3.0" - get-intrinsic "^1.2.5" - object-inspect "^1.13.3" - side-channel-map "^1.0.1" - -side-channel@^1.0.6: - version "1.1.0" - resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.1.0.tgz#c3fcff9c4da932784873335ec9765fa94ff66bc9" - integrity sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw== - dependencies: - es-errors "^1.3.0" - object-inspect "^1.13.3" - side-channel-list "^1.0.0" - side-channel-map "^1.0.1" - side-channel-weakmap "^1.0.2" - -signal-exit@^4.0.1: - version "4.1.0" - resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-4.1.0.tgz#952188c1cbd546070e2dd20d0f41c0ae0530cb04" - integrity sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw== - -simple-concat@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/simple-concat/-/simple-concat-1.0.1.tgz#f46976082ba35c2263f1c8ab5edfe26c41c9552f" - integrity sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q== - -simple-get@^2.7.0: - version "2.8.2" - resolved "https://registry.yarnpkg.com/simple-get/-/simple-get-2.8.2.tgz#5708fb0919d440657326cd5fe7d2599d07705019" - integrity sha512-Ijd/rV5o+mSBBs4F/x9oDPtTx9Zb6X9brmnXvMW4J7IR15ngi9q5xxqWBKU744jTZiaXtxaPL7uHG6vtN8kUkw== - dependencies: - decompress-response "^3.3.0" - once "^1.3.1" - simple-concat "^1.0.0" - -slide@^1.1.5: - version "1.1.6" - resolved "https://registry.yarnpkg.com/slide/-/slide-1.1.6.tgz#56eb027d65b4d2dce6cb2e2d32c4d4afc9e1d707" - integrity sha512-NwrtjCg+lZoqhFU8fOwl4ay2ei8PaqCBOUV3/ektPY9trO1yQ1oXEfmHAhKArUVUr/hOHvy5f6AdP17dCM0zMw== - -smart-buffer@^4.2.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/smart-buffer/-/smart-buffer-4.2.0.tgz#6e1d71fa4f18c05f7d0ff216dd16a481d0e8d9ae" - integrity sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg== - -socks-proxy-agent@8.0.5: - version "8.0.5" - resolved "https://registry.yarnpkg.com/socks-proxy-agent/-/socks-proxy-agent-8.0.5.tgz#b9cdb4e7e998509d7659d689ce7697ac21645bee" - integrity sha512-HehCEsotFqbPW9sJ8WVYB6UbmIMv7kUUORIF2Nncq4VQvBfNBLibW9YZR5dlYCSUhwcD628pRllm7n+E+YTzJw== - dependencies: - agent-base "^7.1.2" - debug "^4.3.4" - socks "^2.8.3" - -socks@^2.8.3: - version "2.8.6" - resolved "https://registry.yarnpkg.com/socks/-/socks-2.8.6.tgz#e335486a2552f34f932f0c27d8dbb93f2be867aa" - integrity sha512-pe4Y2yzru68lXCb38aAqRf5gvN8YdjP1lok5o0J7BOHljkyCGKVz7H3vpVIXKD27rj2giOJ7DwVyk/GWrPHDWA== - dependencies: - ip-address "^9.0.5" - smart-buffer "^4.2.0" - -sodium-native@^4.3.3: - version "4.3.3" - resolved "https://registry.yarnpkg.com/sodium-native/-/sodium-native-4.3.3.tgz#fae4866b52366f5e6cc1b7ae8c8a71673d50c7df" - integrity sha512-OnxSlN3uyY8D0EsLHpmm2HOFmKddQVvEMmsakCrXUzSd8kjjbzL413t4ZNF3n0UxSwNgwTyUvkmZHTfuCeiYSw== - dependencies: - require-addon "^1.1.0" - -sprintf-js@^1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.1.3.tgz#4914b903a2f8b685d17fdf78a70e917e872e444a" - integrity sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA== - -sshpk@^1.7.0: - version "1.18.0" - resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.18.0.tgz#1663e55cddf4d688b86a46b77f0d5fe363aba028" - integrity sha512-2p2KJZTSqQ/I3+HX42EpYOa2l3f8Erv8MWKsy2I9uf4wA7yFIkXRffYdsx86y6z4vHtV8u7g+pPlr8/4ouAxsQ== - dependencies: - asn1 "~0.2.3" - assert-plus "^1.0.0" - bcrypt-pbkdf "^1.0.0" - dashdash "^1.12.0" - ecc-jsbn "~0.1.1" - getpass "^0.1.1" - jsbn "~0.1.0" - safer-buffer "^2.0.2" - tweetnacl "~0.14.0" - -statuses@2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/statuses/-/statuses-2.0.1.tgz#55cb000ccf1d48728bd23c685a063998cf1a1b63" - integrity sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ== - -stream-browserify@^3.0.0: +slash@^3.0.0: version "3.0.0" - resolved "https://registry.yarnpkg.com/stream-browserify/-/stream-browserify-3.0.0.tgz#22b0a2850cdf6503e73085da1fc7b7d0c2122f2f" - integrity sha512-H73RAHsVBapbim0tU2JwwOiXUj+fikfiaoYAKHF3VJfA0pe2BCzkhAHBlLG6REzE+2WNZcxOXjK7lkso+9euLA== - dependencies: - inherits "~2.0.4" - readable-stream "^3.5.0" + resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" + integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== -strict-uri-encode@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz#279b225df1d582b1f54e65addd4352e18faa0713" - integrity sha512-R3f198pcvnB+5IpnBlRkphuE9n46WyVl8I39W/ZUTZLz4nqSP/oLYUrcnJrw462Ds8he4YKMov2efsTIw1BDGQ== - -"string-width-cjs@npm:string-width@^4.2.0": - version "4.2.3" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" - integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.1" - -string-width@^4.1.0: - version "4.2.3" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" - integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.1" - -string-width@^5.0.1, string-width@^5.1.2: - version "5.1.2" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-5.1.2.tgz#14f8daec6d81e7221d2a357e668cab73bdbca794" - integrity sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA== +stack-utils@^2.0.3: + version "2.0.6" + resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-2.0.6.tgz#aaf0748169c02fc33c8232abccf933f54a1cc34f" + integrity sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ== dependencies: - eastasianwidth "^0.2.0" - emoji-regex "^9.2.2" - strip-ansi "^7.0.1" + escape-string-regexp "^2.0.0" string_decoder@^1.1.1: version "1.3.0" @@ -5324,27 +1960,6 @@ string_decoder@~1.1.1: dependencies: safe-buffer "~5.1.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" - integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== - dependencies: - ansi-regex "^5.0.1" - -strip-ansi@^6.0.0, strip-ansi@^6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" - integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== - dependencies: - ansi-regex "^5.0.1" - -strip-ansi@^7.0.1: - version "7.1.0" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45" - integrity sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ== - dependencies: - ansi-regex "^6.0.1" - strip-hex-prefix@1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/strip-hex-prefix/-/strip-hex-prefix-1.0.0.tgz#0c5f155fef1151373377de9dbb588da05500e36f" @@ -5352,176 +1967,88 @@ strip-hex-prefix@1.0.0: dependencies: is-hex-prefixed "1.0.0" -swarm-js@^0.1.40: - version "0.1.42" - resolved "https://registry.yarnpkg.com/swarm-js/-/swarm-js-0.1.42.tgz#497995c62df6696f6e22372f457120e43e727979" - integrity sha512-BV7c/dVlA3R6ya1lMlSSNPLYrntt0LUq4YMgy3iwpCIc6rZnS5W2wUoctarZ5pXlpKtxDDf9hNziEkcfrxdhqQ== - dependencies: - bluebird "^3.5.0" - buffer "^5.0.5" - eth-lib "^0.1.26" - fs-extra "^4.0.2" - got "^11.8.5" - mime-types "^2.1.16" - mkdirp-promise "^5.0.1" - mock-fs "^4.1.0" - setimmediate "^1.0.5" - tar "^4.0.2" - xhr-request "^1.0.1" +supports-color@^7.1.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" + integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== + dependencies: + has-flag "^4.0.0" -syscoinjs-lib@^1.0.218, syscoinjs-lib@^1.0.242: - version "1.0.242" - resolved "https://registry.yarnpkg.com/syscoinjs-lib/-/syscoinjs-lib-1.0.242.tgz#aa49db28b037c5b0ee2a58ab1713ef26fb684586" - integrity sha512-AvTRcJdftG0zrGfiF9OoqbbJF27GzZyqjZQH1asSSfsmBrq2SbRo5U/x2SlA6QUWcsFM5W1sLunYN4PwshwHKg== +syscoinjs-lib@^1.0.276: + version "1.0.276" + resolved "https://registry.npmjs.org/syscoinjs-lib/-/syscoinjs-lib-1.0.276.tgz#3c5fa4bae3ce8f16cbdc92a89451b3295877a379" + integrity sha512-tMtopRemMbDL/Oj7RmChZcLD7BlE1BDvy49dumwBKvuJJDtSjr2XLlvgxAxNJuJIKhppsXveW1/U58SMiKKSzQ== dependencies: - "@trezor/utxo-lib" "^1.0.7" - axios "^0.21.1" - bip84 "^0.2.7" + "@bitcoinerlab/secp256k1" "^1.2.0" + axios "^1.18.1" + bip32 "^5.0.1" + bip39 "^3.1.2" bitcoin-ops "^1.4.1" - bitcoinjs-lib "^5.2.0" - bn.js "^5.1.3" - crypto-js "^4.0.0" + bitcoinjs-lib "^7.0.5" + bn.js "^5.2.4" + bs58 "^6.0.0" + ecpair "^3.0.1" eth-object "https://github.com/syscoin/eth-object.git" eth-proof "^2.1.6" - node-localstorage "^2.1.6" - syscointx-js "^1.0.118" - trezor-connect "^8.1.29" - varuint-bitcoin "^1.1.2" - web3 "^1.4.0" + ethers "^6.17.0" + syscointx-js "^1.0.128" + varuint-bitcoin "^2.0.0" -syscointx-js@^1.0.106, syscointx-js@^1.0.118: - version "1.0.118" - resolved "https://registry.yarnpkg.com/syscointx-js/-/syscointx-js-1.0.118.tgz#ac66a27927e0583375e99a5bfe8a2bade8447ba4" - integrity sha512-d2sX2JtZ44LXDViwovuhM7MJbHjVI/ufUdoxnUT2NdtxA8GNclCa3fv85SPWn0oKogRCmjS/BLJmSDz86E8TZg== +syscointx-js@^1.0.128: + version "1.0.128" + resolved "https://registry.npmjs.org/syscointx-js/-/syscointx-js-1.0.128.tgz#60795c81430eacafe1bbc3233d69c8e8baa75ef0" + integrity sha512-43dgrnCgRCWcM6PIMU7mvV9t2thjLhtm9yMqmvZvMPWuqRGbWG7yxC6Ix+bsvd/NDIFri26npR5xPdRlXPSO9g== dependencies: + "@bitcoinerlab/secp256k1" "^1.2.0" bitcoin-ops "^1.4.1" - bitcoinjs-lib "^5.2.0" - bn.js "^5.1.3" - coinselectsyscoin "^1.1.8" - secp256k1 "^3.8.0" + bitcoinjs-lib "^7.0.1" + bn.js "^5.2.4" + coinselectsyscoin "^1.1.12" + ecpair "^3.0.1" typeforce "^1.18.0" - varuint-bitcoin "^1.1.2" - -tar@^4.0.2: - version "4.4.19" - resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.19.tgz#2e4d7263df26f2b914dee10c825ab132123742f3" - integrity sha512-a20gEsvHnWe0ygBY8JbxoM4w3SJdhc7ZAuxkLqh+nvNQN2IOt0B5lLgM490X5Hl8FF0dl0tOf2ewFYAlIFgzVA== - dependencies: - chownr "^1.1.4" - fs-minipass "^1.2.7" - minipass "^2.9.0" - minizlib "^1.3.3" - mkdirp "^0.5.5" - safe-buffer "^5.2.1" - yallist "^3.1.1" - -timed-out@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/timed-out/-/timed-out-4.0.1.tgz#f32eacac5a175bea25d7fab565ab3ed8741ef56f" - integrity sha512-G7r3AhovYtr5YKOWQkta8RKAPb+J9IsO4uVmzjl8AZwfhs8UcUwTiD6gcJYSgOtzyjvQKrKYn41syHbUWMkafA== - -tiny-secp256k1@^1.1.1, tiny-secp256k1@^1.1.3, tiny-secp256k1@^1.1.6, tiny-secp256k1@^1.1.7: - version "1.1.7" - resolved "https://registry.yarnpkg.com/tiny-secp256k1/-/tiny-secp256k1-1.1.7.tgz#0c1b6b9d2d93404f9093dc7e287b0aa834480573" - integrity sha512-eb+F6NabSnjbLwNoC+2o5ItbmP1kg7HliWue71JgLegQt6A5mTN8YbvTLCazdlg6e5SV6A+r8OGvZYskdlmhqQ== - dependencies: - bindings "^1.3.0" - bn.js "^4.11.8" - create-hmac "^1.1.7" - elliptic "^6.4.0" - nan "^2.13.2" + varuint-bitcoin "^2.0.0" -to-buffer@^1.2.0: - version "1.2.1" - resolved "https://registry.yarnpkg.com/to-buffer/-/to-buffer-1.2.1.tgz#2ce650cdb262e9112a18e65dc29dcb513c8155e0" - integrity sha512-tB82LpAIWjhLYbqjx3X4zEeHN6M8CiuOEy2JY8SEQVdYRe3CCHOFaqrBW1doLDrfpWhplcW7BL+bO3/6S3pcDQ== +to-buffer@^1.2.0, to-buffer@^1.2.1, to-buffer@^1.2.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/to-buffer/-/to-buffer-1.2.2.tgz#ffe59ef7522ada0a2d1cb5dfe03bb8abc3cdc133" + integrity sha512-db0E3UJjcFhpDhAF4tLo03oli3pwl3dbnzXOUIlRKrp+ldk/VUxzpWYZENsw2SZiuBjHAk7DfB0VU7NKdpb6sw== dependencies: isarray "^2.0.5" safe-buffer "^5.2.1" typed-array-buffer "^1.0.3" -toidentifier@1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.1.tgz#3be34321a88a820ed1bd80dfaa33e479fbb8dd35" - integrity sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA== - -toml@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/toml/-/toml-3.0.0.tgz#342160f1af1904ec9d204d03a5d61222d762c5ee" - integrity sha512-y/mWCZinnvxjTKYhJ+pYxwD0mRLVvOtdS2Awbgxln6iEnt4rk0yBxeSBHkGJcPucRiG0e55mwWp+g/05rsrd6w== - -tough-cookie@~2.5.0: - version "2.5.0" - resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.5.0.tgz#cd9fb2a0aa1d5a12b473bd9fb96fa3dcff65ade2" - integrity sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g== - dependencies: - psl "^1.1.28" - punycode "^2.1.1" - -tr46@~0.0.3: - version "0.0.3" - resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" - integrity sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw== - -trezor-connect@^8.1.29: - version "8.2.12" - resolved "https://registry.yarnpkg.com/trezor-connect/-/trezor-connect-8.2.12.tgz#f042a9ec001148f5198c59c51943c9a94ed604c1" - integrity sha512-rk6Qeu53H8+7rgt4kCbNNZqCGURvTe/Tfy38MZHiLkYbeg22XIkCbdJ1JW7CpCUpCWLfg4pRZXEGYoHc3CPpeg== +to-regex-range@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" + integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== dependencies: - "@babel/runtime" "^7.15.4" - cross-fetch "^3.1.5" - events "^3.3.0" + is-number "^7.0.0" -ts-mixer@^6.0.3: +ts-mixer@^6.0.4: version "6.0.4" resolved "https://registry.yarnpkg.com/ts-mixer/-/ts-mixer-6.0.4.tgz#1da39ceabc09d947a82140d9f09db0f84919ca28" integrity sha512-ufKpbmrugz5Aou4wcr5Wc1UUFWOLhq+Fm6qa6P0w0K5Qw2yhaUoiWszhCVuNQyNwrlGiscHOmqYoAox1PtvgjA== -tslib@^2.0.0, tslib@^2.1.0: +tslib@2.7.0: + version "2.7.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.7.0.tgz#d9b40c5c40ab59e8738f297df3087bf1a2690c01" + integrity sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA== + +tslib@^1.9.3: + version "1.14.1" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" + integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== + +tslib@^2.1.0, tslib@^2.8.1: version "2.8.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.8.1.tgz#612efe4ed235d567e8aba5f2a5fab70280ade83f" integrity sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w== -tunnel-agent@^0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" - integrity sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w== - dependencies: - safe-buffer "^5.0.1" - -tweetnacl-util@^0.15.0: - version "0.15.1" - resolved "https://registry.yarnpkg.com/tweetnacl-util/-/tweetnacl-util-0.15.1.tgz#b80fcdb5c97bcc508be18c44a4be50f022eea00b" - integrity sha512-RKJBIj8lySrShN4w6i/BonWp2Z/uxwC3h4y7xsRrpP59ZboCd0GpEVsOnMDYLMmKBpYhb5TgHzZXy7wTfYFBRw== - -tweetnacl@^0.14.3, tweetnacl@~0.14.0: - version "0.14.5" - resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" - integrity sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA== - tweetnacl@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-1.0.3.tgz#ac0af71680458d8a6378d0d0d050ab1407d35596" integrity sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw== -type-fest@^1.2.1: - version "1.4.0" - resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-1.4.0.tgz#e9fb813fe3bf1744ec359d55d1affefa76f14be1" - integrity sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA== - -type-is@~1.6.18: - version "1.6.18" - resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.18.tgz#4e552cd05df09467dcbc4ef739de89f2cf37c131" - integrity sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g== - dependencies: - media-typer "0.3.0" - mime-types "~2.1.24" - -type@^2.7.2: - version "2.7.3" - resolved "https://registry.yarnpkg.com/type/-/type-2.7.3.tgz#436981652129285cc3ba94f392886c2637ea0486" - integrity sha512-8j+1QmAbPvLZow5Qpi6NCaN8FB60p/6x8/vfNqOk/hC+HuvFZhL4+WfekuhQLiqFZXOgQdrs3B+XxEmCc6b3FQ== - typed-array-buffer@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/typed-array-buffer/-/typed-array-buffer-1.0.3.tgz#a72395450a4869ec033fd549371b47af3a2ee536" @@ -5531,463 +2058,93 @@ typed-array-buffer@^1.0.3: es-errors "^1.3.0" is-typed-array "^1.1.14" -typedarray-to-buffer@^3.1.5: - version "3.1.5" - resolved "https://registry.yarnpkg.com/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz#a97ee7a9ff42691b9f783ff1bc5112fe3fca9080" - integrity sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q== - dependencies: - is-typedarray "^1.0.0" - -typeforce@^1.11.3, typeforce@^1.11.5, typeforce@^1.18.0: +typeforce@^1.18.0: version "1.18.0" resolved "https://registry.yarnpkg.com/typeforce/-/typeforce-1.18.0.tgz#d7416a2c5845e085034d70fcc5b6cc4a90edbfdc" integrity sha512-7uc1O8h1M1g0rArakJdf0uLRSSgFcYexrVoKo+bzJd32gd4gDy2L/Z+8/FjPnU9ydY3pEnVPtr9FyscYY60K1g== -ua-is-frozen@^0.1.2: - version "0.1.2" - resolved "https://registry.yarnpkg.com/ua-is-frozen/-/ua-is-frozen-0.1.2.tgz#bfbc5f06336e379590e36beca444188c7dc3a7f3" - integrity sha512-RwKDW2p3iyWn4UbaxpP2+VxwqXh0jpvdxsYpZ5j/MLLiQOfbsV5shpgQiw93+KMYQPcteeMQ289MaAFzs3G9pw== +typescript@^5.3.3: + version "5.9.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.9.3.tgz#5b4f59e15310ab17a216f5d6cf53ee476ede670f" + integrity sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw== -ua-parser-js@^2.0.4: - version "2.0.4" - resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-2.0.4.tgz#ea6698b055af2a61661d8793f069452cf456c0df" - integrity sha512-XiBOnM/UpUq21ZZ91q2AVDOnGROE6UQd37WrO9WBgw4u2eGvUCNOheMmZ3EfEUj7DLHr8tre+Um/436Of/Vwzg== - dependencies: - "@types/node-fetch" "^2.6.12" - detect-europe-js "^0.1.2" - is-standalone-pwa "^0.1.1" - node-fetch "^2.7.0" - ua-is-frozen "^0.1.2" +uint8array-tools@^0.0.10: + version "0.0.10" + resolved "https://registry.yarnpkg.com/uint8array-tools/-/uint8array-tools-0.0.10.tgz#acfcf118e072df79175c5f73f86af917885d095a" + integrity sha512-sSbrZqlr04w4p8KKpHw0ME/R4JzQaadum+BWhMlk2M7LrDyXWTfJOco3d1jNMdQNxgk5DDm88R3IWYH0nR+tzQ== uint8array-tools@^0.0.8: version "0.0.8" resolved "https://registry.yarnpkg.com/uint8array-tools/-/uint8array-tools-0.0.8.tgz#712bab001f8347bd782f45bc47c76ffff32d1e0b" integrity sha512-xS6+s8e0Xbx++5/0L+yyexukU7pz//Yg6IHg3BKhXotg1JcYtgxVcUctQ0HxLByiJzpAkNFawz1Nz5Xadzo82g== -ultron@~1.1.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/ultron/-/ultron-1.1.1.tgz#9fe1536a10a664a65266a1e3ccf85fd36302bc9c" - integrity sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og== - -undici-types@^7.11.0: - version "7.12.0" - resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-7.12.0.tgz#15c5c7475c2a3ba30659529f5cdb4674b622fafb" - integrity sha512-goOacqME2GYyOZZfb5Lgtu+1IDmAlAEu5xnD3+xTzS10hT0vzpf0SPjkXwAw9Jm+4n/mQGDP3LO8CPbYROeBfQ== +undici-types@~6.19.2: + version "6.19.8" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.19.8.tgz#35111c9d1437ab83a7cdc0abae2f26d88eda0a02" + integrity sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw== undici-types@~6.21.0: version "6.21.0" resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.21.0.tgz#691d00af3909be93a7faa13be61b3a5b50ef12cb" integrity sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ== -undici-types@~7.8.0: - version "7.8.0" - resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-7.8.0.tgz#de00b85b710c54122e44fbfd911f8d70174cd294" - integrity sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw== - -universalify@^0.1.0: - version "0.1.2" - resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66" - integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg== - -unpipe@1.0.0, unpipe@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec" - integrity sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ== - -uri-js@^4.2.2: - version "4.4.1" - resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e" - integrity sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg== - dependencies: - punycode "^2.1.0" - -urijs@^1.19.1: - version "1.19.11" - resolved "https://registry.yarnpkg.com/urijs/-/urijs-1.19.11.tgz#204b0d6b605ae80bea54bea39280cdb7c9f923cc" - integrity sha512-HXgFDgDommxn5/bIv0cnQZsPhHDA90NPHD6+c/v21U5+Sx5hoP8+dP9IZXBU1gIfvdRfhG8cel9QNPeionfcCQ== - -url-set-query@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/url-set-query/-/url-set-query-1.0.0.tgz#016e8cfd7c20ee05cafe7795e892bd0702faa339" - integrity sha512-3AChu4NiXquPfeckE5R5cGdiHCMWJx1dwCWOmWIL4KHAziJNOFIYJlpGFeKDvwLPHovZRCxK3cYlwzqI9Vp+Gg== - -usb@^2.15.0: - version "2.16.0" - resolved "https://registry.yarnpkg.com/usb/-/usb-2.16.0.tgz#6c7a043d2b6305859974a92c30c2fa0d1285bbd3" - integrity sha512-jD88fvzDViMDH5KmmNJgzMBDj/95bDTt6+kBNaNxP4G98xUTnDMiLUY2CYmToba6JAFhM9VkcaQuxCNRLGR7zg== - dependencies: - "@types/w3c-web-usb" "^1.0.6" - node-addon-api "^8.0.0" - node-gyp-build "^4.5.0" - -utf-8-validate@^5.0.2: - version "5.0.10" - resolved "https://registry.yarnpkg.com/utf-8-validate/-/utf-8-validate-5.0.10.tgz#d7d10ea39318171ca982718b6b96a8d2442571a2" - integrity sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ== - dependencies: - node-gyp-build "^4.3.0" - -utf8@3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/utf8/-/utf8-3.0.0.tgz#f052eed1364d696e769ef058b183df88c87f69d1" - integrity sha512-E8VjFIQ/TyQgp+TZfS6l8yp/xWppSAHzidGiRrqe4bK4XP9pTRyKFgGJpO3SN7zdX4DeomTrwaseCHovfpFcqQ== +undici-types@~8.3.0: + version "8.3.0" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-8.3.0.tgz#44e9fc9f3244648cdea35e4f9bb2d681e9410809" + integrity sha512-j375ScV60dom+YkPFIfTLcOiPxkN/buHz5GobjLhixFuANaNs3C9l4GmrWqejgXWJ7BbJcFYpTEUkS1Ge8bpZQ== util-deprecate@^1.0.1, util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw== -util@^0.12.5: - version "0.12.5" - resolved "https://registry.yarnpkg.com/util/-/util-0.12.5.tgz#5f17a6059b73db61a875668781a1c2b136bd6fbc" - integrity sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA== - dependencies: - inherits "^2.0.3" - is-arguments "^1.0.4" - is-generator-function "^1.0.7" - is-typed-array "^1.1.3" - which-typed-array "^1.1.2" - -utility-types@^3.10.0: - version "3.11.0" - resolved "https://registry.yarnpkg.com/utility-types/-/utility-types-3.11.0.tgz#607c40edb4f258915e901ea7995607fdf319424c" - integrity sha512-6Z7Ma2aVEWisaL6TvBCy7P8rm2LQoPv6dJ7ecIaIixHcwfbJ0x7mWdbcwlIM5IGQxPZSFYeqRCqlOOeKoJYMkw== - -utils-merge@1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713" - integrity sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA== - -uuid@^3.3.2: - version "3.4.0" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" - integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== +uuid@11.0.3: + version "11.0.3" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-11.0.3.tgz#248451cac9d1a4a4128033e765d137e2b2c49a3d" + integrity sha512-d0z310fCWv5dJwnX1Y/MncBAqGMKEzlBb1AOf7z9K8ALnd0utBX/msg/fA0+sbyN1ihbMsLhrBlnl1ak7Wa0rg== -uuid@^9.0.0: +uuid@^9.0.1: version "9.0.1" resolved "https://registry.yarnpkg.com/uuid/-/uuid-9.0.1.tgz#e188d4c8853cc722220392c424cd637f32293f30" integrity sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA== -varint@^5.0.0: - version "5.0.2" - resolved "https://registry.yarnpkg.com/varint/-/varint-5.0.2.tgz#5b47f8a947eb668b848e034dcfa87d0ff8a7f7a4" - integrity sha512-lKxKYG6H03yCZUpAGOPOsMcGxd1RHCu1iKvEHYDPmTyq2HueGhD73ssNBqqQWfvYs04G9iUFRvmAVLW20Jw6ow== +valibot@^1.2.0: + version "1.4.2" + resolved "https://registry.yarnpkg.com/valibot/-/valibot-1.4.2.tgz#da857781187f170aeaf4498d463d25028615b0d6" + integrity sha512-gjdCvJ6d3RyHAneqxMYMW9QMCwYMb3jpOO0IyHZV1bnRHFBHrX3VkIILt5XYR0WhwHiH7Mty8ovuPZ/O3gamrg== -varuint-bitcoin@2.0.0: +varuint-bitcoin@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/varuint-bitcoin/-/varuint-bitcoin-2.0.0.tgz#59a53845a87ad18c42f184a3d325074465341523" integrity sha512-6QZbU/rHO2ZQYpWFDALCDSRsXbAs1VOEmXAxtbtjLtKuMJ/FQ8YbhfxlaiKv5nklci0M6lZtlZyxo9Q+qNnyog== dependencies: uint8array-tools "^0.0.8" -varuint-bitcoin@^1.0.4, varuint-bitcoin@^1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/varuint-bitcoin/-/varuint-bitcoin-1.1.2.tgz#e76c138249d06138b480d4c5b40ef53693e24e92" - integrity sha512-4EVb+w4rx+YfVM32HQX42AbbT7/1f5zwAYhIujKXKk8NQK+JfRVl3pqT3hjNn/L+RstigmGGKVwHA/P0wgITZw== - dependencies: - safe-buffer "^5.1.1" - -vary@^1, vary@~1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc" - integrity sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg== - -verror@1.10.0: - version "1.10.0" - resolved "https://registry.yarnpkg.com/verror/-/verror-1.10.0.tgz#3a105ca17053af55d6e270c1f8288682e18da400" - integrity sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw== - dependencies: - assert-plus "^1.0.0" - core-util-is "1.0.2" - extsprintf "^1.2.0" - -web3-bzz@1.10.4: - version "1.10.4" - resolved "https://registry.yarnpkg.com/web3-bzz/-/web3-bzz-1.10.4.tgz#dcc787970767d9004c73d11d0eeef774ce16b880" - integrity sha512-ZZ/X4sJ0Uh2teU9lAGNS8EjveEppoHNQiKlOXAjedsrdWuaMErBPdLQjXfcrYvN6WM6Su9PMsAxf3FXXZ+HwQw== - dependencies: - "@types/node" "^12.12.6" - got "12.1.0" - swarm-js "^0.1.40" - -web3-core-helpers@1.10.4: - version "1.10.4" - resolved "https://registry.yarnpkg.com/web3-core-helpers/-/web3-core-helpers-1.10.4.tgz#bd2b4140df2016d5dd3bb2b925fc29ad8678677c" - integrity sha512-r+L5ylA17JlD1vwS8rjhWr0qg7zVoVMDvWhajWA5r5+USdh91jRUYosp19Kd1m2vE034v7Dfqe1xYRoH2zvG0g== - dependencies: - web3-eth-iban "1.10.4" - web3-utils "1.10.4" - -web3-core-method@1.10.4: - version "1.10.4" - resolved "https://registry.yarnpkg.com/web3-core-method/-/web3-core-method-1.10.4.tgz#566b52f006d3cbb13b21b72b8d2108999bf5d6bf" - integrity sha512-uZTb7flr+Xl6LaDsyTeE2L1TylokCJwTDrIVfIfnrGmnwLc6bmTWCCrm71sSrQ0hqs6vp/MKbQYIYqUN0J8WyA== - dependencies: - "@ethersproject/transactions" "^5.6.2" - web3-core-helpers "1.10.4" - web3-core-promievent "1.10.4" - web3-core-subscriptions "1.10.4" - web3-utils "1.10.4" - -web3-core-promievent@1.10.4: - version "1.10.4" - resolved "https://registry.yarnpkg.com/web3-core-promievent/-/web3-core-promievent-1.10.4.tgz#629b970b7934430b03c5033c79f3bb3893027e22" - integrity sha512-2de5WnJQ72YcIhYwV/jHLc4/cWJnznuoGTJGD29ncFQHAfwW/MItHFSVKPPA5v8AhJe+r6y4Y12EKvZKjQVBvQ== - dependencies: - eventemitter3 "4.0.4" - -web3-core-requestmanager@1.10.4: - version "1.10.4" - resolved "https://registry.yarnpkg.com/web3-core-requestmanager/-/web3-core-requestmanager-1.10.4.tgz#eb1f147e6b9df84e3a37e602162f8925bdb4bb9a" - integrity sha512-vqP6pKH8RrhT/2MoaU+DY/OsYK9h7HmEBNCdoMj+4ZwujQtw/Mq2JifjwsJ7gits7Q+HWJwx8q6WmQoVZAWugg== - dependencies: - util "^0.12.5" - web3-core-helpers "1.10.4" - web3-providers-http "1.10.4" - web3-providers-ipc "1.10.4" - web3-providers-ws "1.10.4" - -web3-core-subscriptions@1.10.4: - version "1.10.4" - resolved "https://registry.yarnpkg.com/web3-core-subscriptions/-/web3-core-subscriptions-1.10.4.tgz#2f4dcb404237e92802a563265d11a33934dc38e6" - integrity sha512-o0lSQo/N/f7/L76C0HV63+S54loXiE9fUPfHFcTtpJRQNDBVsSDdWRdePbWwR206XlsBqD5VHApck1//jEafTw== - dependencies: - eventemitter3 "4.0.4" - web3-core-helpers "1.10.4" - -web3-core@1.10.4: - version "1.10.4" - resolved "https://registry.yarnpkg.com/web3-core/-/web3-core-1.10.4.tgz#639de68b8b9871d2dc8892e0dd4e380cb1361a98" - integrity sha512-B6elffYm81MYZDTrat7aEhnhdtVE3lDBUZft16Z8awYMZYJDbnykEbJVS+l3mnA7AQTnSDr/1MjWofGDLBJPww== - dependencies: - "@types/bn.js" "^5.1.1" - "@types/node" "^12.12.6" - bignumber.js "^9.0.0" - web3-core-helpers "1.10.4" - web3-core-method "1.10.4" - web3-core-requestmanager "1.10.4" - web3-utils "1.10.4" - -web3-eth-abi@1.10.4: - version "1.10.4" - resolved "https://registry.yarnpkg.com/web3-eth-abi/-/web3-eth-abi-1.10.4.tgz#16c19d0bde0aaf8c1a56cb7743a83156d148d798" - integrity sha512-cZ0q65eJIkd/jyOlQPDjr8X4fU6CRL1eWgdLwbWEpo++MPU/2P4PFk5ZLAdye9T5Sdp+MomePPJ/gHjLMj2VfQ== - dependencies: - "@ethersproject/abi" "^5.6.3" - web3-utils "1.10.4" - -web3-eth-accounts@1.10.4: - version "1.10.4" - resolved "https://registry.yarnpkg.com/web3-eth-accounts/-/web3-eth-accounts-1.10.4.tgz#df30e85a7cd70e475f8cf52361befba408829e34" - integrity sha512-ysy5sVTg9snYS7tJjxVoQAH6DTOTkRGR8emEVCWNGLGiB9txj+qDvSeT0izjurS/g7D5xlMAgrEHLK1Vi6I3yg== - dependencies: - "@ethereumjs/common" "2.6.5" - "@ethereumjs/tx" "3.5.2" - "@ethereumjs/util" "^8.1.0" - eth-lib "0.2.8" - scrypt-js "^3.0.1" - uuid "^9.0.0" - web3-core "1.10.4" - web3-core-helpers "1.10.4" - web3-core-method "1.10.4" - web3-utils "1.10.4" - -web3-eth-contract@1.10.4: - version "1.10.4" - resolved "https://registry.yarnpkg.com/web3-eth-contract/-/web3-eth-contract-1.10.4.tgz#22d39f04e11d9ff4e726e8025a56d78e843a2c3d" - integrity sha512-Q8PfolOJ4eV9TvnTj1TGdZ4RarpSLmHnUnzVxZ/6/NiTfe4maJz99R0ISgwZkntLhLRtw0C7LRJuklzGYCNN3A== - dependencies: - "@types/bn.js" "^5.1.1" - web3-core "1.10.4" - web3-core-helpers "1.10.4" - web3-core-method "1.10.4" - web3-core-promievent "1.10.4" - web3-core-subscriptions "1.10.4" - web3-eth-abi "1.10.4" - web3-utils "1.10.4" - -web3-eth-ens@1.10.4: - version "1.10.4" - resolved "https://registry.yarnpkg.com/web3-eth-ens/-/web3-eth-ens-1.10.4.tgz#3d991adac52bc8e598f1f1b8528337fa6291004c" - integrity sha512-LLrvxuFeVooRVZ9e5T6OWKVflHPFgrVjJ/jtisRWcmI7KN/b64+D/wJzXqgmp6CNsMQcE7rpmf4CQmJCrTdsgg== - dependencies: - content-hash "^2.5.2" - eth-ens-namehash "2.0.8" - web3-core "1.10.4" - web3-core-helpers "1.10.4" - web3-core-promievent "1.10.4" - web3-eth-abi "1.10.4" - web3-eth-contract "1.10.4" - web3-utils "1.10.4" - -web3-eth-iban@1.10.4: - version "1.10.4" - resolved "https://registry.yarnpkg.com/web3-eth-iban/-/web3-eth-iban-1.10.4.tgz#bc61b4a1930d19b1df8762c606d669902558e54d" - integrity sha512-0gE5iNmOkmtBmbKH2aTodeompnNE8jEyvwFJ6s/AF6jkw9ky9Op9cqfzS56AYAbrqEFuClsqB/AoRves7LDELw== - dependencies: - bn.js "^5.2.1" - web3-utils "1.10.4" - -web3-eth-personal@1.10.4: - version "1.10.4" - resolved "https://registry.yarnpkg.com/web3-eth-personal/-/web3-eth-personal-1.10.4.tgz#e2ee920f47e84848288e03442659cdbb2c4deea2" - integrity sha512-BRa/hs6jU1hKHz+AC/YkM71RP3f0Yci1dPk4paOic53R4ZZG4MgwKRkJhgt3/GPuPliwS46f/i5A7fEGBT4F9w== - dependencies: - "@types/node" "^12.12.6" - web3-core "1.10.4" - web3-core-helpers "1.10.4" - web3-core-method "1.10.4" - web3-net "1.10.4" - web3-utils "1.10.4" - -web3-eth@1.10.4: - version "1.10.4" - resolved "https://registry.yarnpkg.com/web3-eth/-/web3-eth-1.10.4.tgz#3a908c635cb5d935bd30473e452f3bd7f2ee66a5" - integrity sha512-Sql2kYKmgt+T/cgvg7b9ce24uLS7xbFrxE4kuuor1zSCGrjhTJ5rRNG8gTJUkAJGKJc7KgnWmgW+cOfMBPUDSA== - dependencies: - web3-core "1.10.4" - web3-core-helpers "1.10.4" - web3-core-method "1.10.4" - web3-core-subscriptions "1.10.4" - web3-eth-abi "1.10.4" - web3-eth-accounts "1.10.4" - web3-eth-contract "1.10.4" - web3-eth-ens "1.10.4" - web3-eth-iban "1.10.4" - web3-eth-personal "1.10.4" - web3-net "1.10.4" - web3-utils "1.10.4" - -web3-net@1.10.4: - version "1.10.4" - resolved "https://registry.yarnpkg.com/web3-net/-/web3-net-1.10.4.tgz#20e12c60e4477d4298979d8d5d66b9abf8e66a09" - integrity sha512-mKINnhOOnZ4koA+yV2OT5s5ztVjIx7IY9a03w6s+yao/BUn+Luuty0/keNemZxTr1E8Ehvtn28vbOtW7Ids+Ow== - dependencies: - web3-core "1.10.4" - web3-core-method "1.10.4" - web3-utils "1.10.4" - -web3-providers-http@1.10.4: - version "1.10.4" - resolved "https://registry.yarnpkg.com/web3-providers-http/-/web3-providers-http-1.10.4.tgz#ca7aa58aeaf8123500c24ffe0595896319f830e8" - integrity sha512-m2P5Idc8hdiO0l60O6DSCPw0kw64Zgi0pMjbEFRmxKIck2Py57RQMu4bxvkxJwkF06SlGaEQF8rFZBmuX7aagQ== - dependencies: - abortcontroller-polyfill "^1.7.5" - cross-fetch "^4.0.0" - es6-promise "^4.2.8" - web3-core-helpers "1.10.4" - -web3-providers-ipc@1.10.4: - version "1.10.4" - resolved "https://registry.yarnpkg.com/web3-providers-ipc/-/web3-providers-ipc-1.10.4.tgz#2e03437909e4e7771d646ff05518efae44b783c3" - integrity sha512-YRF/bpQk9z3WwjT+A6FI/GmWRCASgd+gC0si7f9zbBWLXjwzYAKG73bQBaFRAHex1hl4CVcM5WUMaQXf3Opeuw== - dependencies: - oboe "2.1.5" - web3-core-helpers "1.10.4" - -web3-providers-ws@1.10.4: - version "1.10.4" - resolved "https://registry.yarnpkg.com/web3-providers-ws/-/web3-providers-ws-1.10.4.tgz#55d0c3ba36c6a79d105f02e20a707eb3978e7f82" - integrity sha512-j3FBMifyuFFmUIPVQR4pj+t5ILhAexAui0opgcpu9R5LxQrLRUZxHSnU+YO25UycSOa/NAX8A+qkqZNpcFAlxA== - dependencies: - eventemitter3 "4.0.4" - web3-core-helpers "1.10.4" - websocket "^1.0.32" - -web3-shh@1.10.4: - version "1.10.4" - resolved "https://registry.yarnpkg.com/web3-shh/-/web3-shh-1.10.4.tgz#9852d6f3d05678e31e49235a60fea10ca7a9e21d" - integrity sha512-cOH6iFFM71lCNwSQrC3niqDXagMqrdfFW85hC9PFUrAr3PUrIem8TNstTc3xna2bwZeWG6OBy99xSIhBvyIACw== - dependencies: - web3-core "1.10.4" - web3-core-method "1.10.4" - web3-core-subscriptions "1.10.4" - web3-net "1.10.4" - -web3-utils@1.10.4: - version "1.10.4" - resolved "https://registry.yarnpkg.com/web3-utils/-/web3-utils-1.10.4.tgz#0daee7d6841641655d8b3726baf33b08eda1cbec" - integrity sha512-tsu8FiKJLk2PzhDl9fXbGUWTkkVXYhtTA+SmEFkKft+9BgwLxfCRpU96sWv7ICC8zixBNd3JURVoiR3dUXgP8A== - dependencies: - "@ethereumjs/util" "^8.1.0" - bn.js "^5.2.1" - ethereum-bloom-filters "^1.0.6" - ethereum-cryptography "^2.1.2" - ethjs-unit "0.1.6" - number-to-bn "1.7.0" - randombytes "^2.1.0" - utf8 "3.0.0" - -web3@^1.4.0, web3@^1.7.1: - version "1.10.4" - resolved "https://registry.yarnpkg.com/web3/-/web3-1.10.4.tgz#5d5e59b976eaf758b060fe1a296da5fe87bdc79c" - integrity sha512-kgJvQZjkmjOEKimx/tJQsqWfRDPTTcBfYPa9XletxuHLpHcXdx67w8EFn5AW3eVxCutE9dTVHgGa9VYe8vgsEA== - dependencies: - web3-bzz "1.10.4" - web3-core "1.10.4" - web3-eth "1.10.4" - web3-eth-personal "1.10.4" - web3-net "1.10.4" - web3-shh "1.10.4" - web3-utils "1.10.4" - -webidl-conversions@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" - integrity sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ== - -websocket@^1.0.32: - version "1.0.35" - resolved "https://registry.yarnpkg.com/websocket/-/websocket-1.0.35.tgz#374197207d7d4cc4c36cbf8a1bb886ee52a07885" - integrity sha512-/REy6amwPZl44DDzvRCkaI1q1bIiQB0mEFQLUrhz3z2EK91cp3n72rAjUlrTP0zV22HJIUOVHQGPxhFRjxjt+Q== +varuint-bitcoin@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/varuint-bitcoin/-/varuint-bitcoin-2.0.1.tgz#bbf7e790b900f47aad5b597a501337dff7978b17" + integrity sha512-TTl5qSPJ3FzjuTHo0Ex9WUE3jTxnUsQHR38vIDhHApoVstzJK4gE20WqmTWOT5oo7ilvOSNejXt4CJrfDcqm5A== dependencies: - bufferutil "^4.0.1" - debug "^2.2.0" - es5-ext "^0.10.63" - typedarray-to-buffer "^3.1.5" - utf-8-validate "^5.0.2" - yaeti "^0.0.6" + uint8array-tools "^0.0.10" whatwg-fetch@>=0.10.0: version "3.6.20" resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-3.6.20.tgz#580ce6d791facec91d37c72890995a0b48d31c70" integrity sha512-EqhiFU6daOA8kpjOWTL0olhVOF3i7OrFzSYiGsEMB8GcXS+RrzauAERX65xMeNWVqxA6HXH2m69Z9LaKKdisfg== -whatwg-url@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d" - integrity sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw== - dependencies: - tr46 "~0.0.3" - webidl-conversions "^3.0.0" - -which-typed-array@^1.1.16, which-typed-array@^1.1.2: - version "1.1.19" - resolved "https://registry.yarnpkg.com/which-typed-array/-/which-typed-array-1.1.19.tgz#df03842e870b6b88e117524a4b364b6fc689f956" - integrity sha512-rEvr90Bck4WZt9HHFC4DJMsjvu7x+r6bImz0/BrbWb7A2djJ8hnZMrWnHo9F8ssv0OMErasDhftrfROTyqSDrw== +which-typed-array@^1.1.16: + version "1.1.22" + resolved "https://registry.yarnpkg.com/which-typed-array/-/which-typed-array-1.1.22.tgz#8f3cc78aefb40b437346dd40a1dbfa5d1da43fe9" + integrity sha512-fvO4ExWMFsqyhG3AiPAObMuY1lxaqgYcxbc49CNdWDDECOJNgQyvsOWVwbZc+qf3rzRtxojBK+CMEv0Ld5CYpw== dependencies: available-typed-arrays "^1.0.7" - call-bind "^1.0.8" + call-bind "^1.0.9" call-bound "^1.0.4" for-each "^0.3.5" get-proto "^1.0.1" gopd "^1.2.0" has-tostringtag "^1.0.2" -which@^2.0.1: - version "2.0.2" - resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" - integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== - dependencies: - isexe "^2.0.0" - -wif@^2.0.1, wif@^2.0.6: - version "2.0.6" - resolved "https://registry.yarnpkg.com/wif/-/wif-2.0.6.tgz#08d3f52056c66679299726fade0d432ae74b4704" - integrity sha512-HIanZn1zmduSF+BQhkE+YXIbEiH0xPr1012QbFEGB0xsKqJii0/SqJjyn8dFv6y36kOznMgMB+LGcbZTJ1xACQ== - dependencies: - bs58check "<3.0.0" - wif@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/wif/-/wif-5.0.0.tgz#445e44b8f62e155144d1c970c01ca2ba3979cc3f" @@ -5995,125 +2152,32 @@ wif@^5.0.0: dependencies: bs58check "^4.0.0" -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" - integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== - dependencies: - ansi-styles "^4.0.0" - string-width "^4.1.0" - strip-ansi "^6.0.0" - -wrap-ansi@^8.1.0: - version "8.1.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214" - integrity sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ== - dependencies: - ansi-styles "^6.1.0" - string-width "^5.0.1" - strip-ansi "^7.0.1" - -wrappy@1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" - integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== - -write-file-atomic@^1.1.4: - version "1.3.4" - resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-1.3.4.tgz#f807a4f0b1d9e913ae7a48112e6cc3af1991b45f" - integrity sha512-SdrHoC/yVBPpV0Xq/mUZQIpW2sWXAShb/V4pomcJXh92RuaO+f3UTWItiR3Px+pLnV2PvC2/bfn5cwr5X6Vfxw== - dependencies: - graceful-fs "^4.1.11" - imurmurhash "^0.1.4" - slide "^1.1.5" - -ws@7.4.6: - version "7.4.6" - resolved "https://registry.yarnpkg.com/ws/-/ws-7.4.6.tgz#5654ca8ecdeee47c33a9a4bf6d28e2be2980377c" - integrity sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A== - -ws@8.18.0: - version "8.18.0" - resolved "https://registry.yarnpkg.com/ws/-/ws-8.18.0.tgz#0d7505a6eafe2b0e712d232b42279f53bc289bbc" - integrity sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw== - -ws@^3.0.0: - version "3.3.3" - resolved "https://registry.yarnpkg.com/ws/-/ws-3.3.3.tgz#f1cf84fe2d5e901ebce94efaece785f187a228f2" - integrity sha512-nnWLa/NwZSt4KQJu51MYlCcSQ5g7INpOrOMt4XV8j4dqTXdmlUmSHQ8/oLC069ckre0fRsgfvsKwbTdtKLCDkA== - dependencies: - async-limiter "~1.0.0" - safe-buffer "~5.1.0" - ultron "~1.1.0" +ws@8.17.1: + version "8.17.1" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.17.1.tgz#9293da530bb548febc95371d90f9c878727d919b" + integrity sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ== -ws@^8.13.0, ws@^8.18.0: - version "8.18.3" - resolved "https://registry.yarnpkg.com/ws/-/ws-8.18.3.tgz#b56b88abffde62791c639170400c93dcb0c95472" - integrity sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg== +ws@8.21.0: + version "8.21.0" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.21.0.tgz#012e413fc07429945121b0c153158c4343086951" + integrity sha512-Vsp28b7DRcimFQvrqu2Wek3z1iYxDCWqHYB8Qsnk/S4RfaCQzPGPyBNuVjJV3cd6UiKtUtp6sNM77gWvzcCH+g== -xhr-request-promise@^0.1.2: - version "0.1.3" - resolved "https://registry.yarnpkg.com/xhr-request-promise/-/xhr-request-promise-0.1.3.tgz#2d5f4b16d8c6c893be97f1a62b0ed4cf3ca5f96c" - integrity sha512-YUBytBsuwgitWtdRzXDDkWAXzhdGB8bYm0sSzMPZT7Z2MBjMSTHFsyCT1yCRATY+XC69DUrQraRAEgcoCRaIPg== - dependencies: - xhr-request "^1.1.0" +ws@^8.18.0: + version "8.22.1" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.22.1.tgz#60d427870e8272ddb10c7fc5cdf00a70eaec369e" + integrity sha512-oyL6OPYme/CmiFvNuGzeoxCJ4nOrZE2O1FwM9MWM1AsGri6nLXB2pg+lNA8aLeXMSav0J6eIVS1j6vUPzUtK9g== -xhr-request@^1.0.1, xhr-request@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/xhr-request/-/xhr-request-1.1.0.tgz#f4a7c1868b9f198723444d82dcae317643f2e2ed" - integrity sha512-Y7qzEaR3FDtL3fP30k9wO/e+FBnBByZeybKOhASsGP30NIkRAAkKD/sCnLvgEfAIEC1rcmK7YG8f4oEnIrrWzA== - dependencies: - buffer-to-arraybuffer "^0.0.5" - object-assign "^4.1.1" - query-string "^5.0.1" - simple-get "^2.7.0" - timed-out "^4.0.1" - url-set-query "^1.0.0" - xhr "^2.0.4" - -xhr@^2.0.4, xhr@^2.3.3: - version "2.6.0" - resolved "https://registry.yarnpkg.com/xhr/-/xhr-2.6.0.tgz#b69d4395e792b4173d6b7df077f0fc5e4e2b249d" - integrity sha512-/eCGLb5rxjx5e3mF1A7s+pLlR6CGyqWN91fv1JgER5mVWg1MZmlhBvy9kjcsOdRk8RrIujotWyJamfyrp+WIcA== - dependencies: - global "~4.4.0" - is-function "^1.0.1" - parse-headers "^2.0.0" - xtend "^4.0.0" +ws@^8.20.0: + version "8.21.2" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.21.2.tgz#e6976cfe96161d40420689a5f051378d11b0f0ce" + integrity sha512-54dMVAo4WIe6SKy3vBgN+9bJZqqQ8IMRevAkOLQALhi49qkkQDQfWdAZ8KQlXiEabw88ARXXdUrlvtbKQX+aKw== -xrpl@^4.3.0: - version "4.3.0" - resolved "https://registry.yarnpkg.com/xrpl/-/xrpl-4.3.0.tgz#769fb81b2ec169ff98391a55720b65bccb7b86c9" - integrity sha512-MW/VyWyTGNmfmt5EaPexKb7ojcnobdzaqtm5UC9NErtlq7IgayqAZpMI26ptOzQolGndK7vOk8U0iOBpMSykJQ== - dependencies: - "@scure/bip32" "^1.3.1" - "@scure/bip39" "^1.2.1" - "@xrplf/isomorphic" "^1.0.1" - "@xrplf/secret-numbers" "^1.0.0" - bignumber.js "^9.0.0" - eventemitter3 "^5.0.1" - ripple-address-codec "^5.0.0" - ripple-binary-codec "^2.4.0" - ripple-keypairs "^2.0.0" +xstate@5.19.2: + version "5.19.2" + resolved "https://registry.yarnpkg.com/xstate/-/xstate-5.19.2.tgz#db3f1ee614bbb6a49ad3f0c96ddbf98562d456ba" + integrity sha512-B8fL2aP0ogn5aviAXFzI5oZseAMqN00fg/TeDa3ZtatyDcViYLIfuQl4y8qmHCiKZgGEzmnTyNtNQL9oeJE2gw== xtend@^4.0.0, xtend@^4.0.1, xtend@~4.0.0: version "4.0.2" resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54" integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ== - -yaeti@^0.0.6: - version "0.0.6" - resolved "https://registry.yarnpkg.com/yaeti/-/yaeti-0.0.6.tgz#f26f484d72684cf42bedfb76970aa1608fbf9577" - integrity sha512-MvQa//+KcZCUkBTIC9blM+CU9J2GzuTytsOUwf2lidtvkx/6gnEp1QvJv34t9vdjhFmha/mUiNDbN0D0mJWdug== - -yallist@^3.0.0, yallist@^3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd" - integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g== - -zksync-ethers@5: - version "5.10.0" - resolved "https://registry.yarnpkg.com/zksync-ethers/-/zksync-ethers-5.10.0.tgz#3caf25478539a3fd6e170c13555cec6a1dae32e2" - integrity sha512-OAjTGAHF9wbdkRGkj7XZuF/a1Sk/FVbwH4pmLjAKlR7mJ7sQtQhBhrPU2dCc67xLaNvEESPfwil19ES5wooYFg== - dependencies: - ethers "~5.7.0" diff --git a/packages/sysweb3-network/jest.config.js b/packages/sysweb3-network/jest.config.js index 59333088..263e7a60 100644 --- a/packages/sysweb3-network/jest.config.js +++ b/packages/sysweb3-network/jest.config.js @@ -3,13 +3,15 @@ module.exports = { testEnvironment: 'node', moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], transform: { - '^.+\\.(ts|tsx)$': 'ts-jest', + '^.+\\.(ts|tsx)$': [ + 'ts-jest', + ], }, testMatch: ['**/test/**/*.spec.ts'], moduleNameMapper: { - '^@pollum-io/sysweb3-utils$': '/../sysweb3-utils/src', - '^@pollum-io/sysweb3-core$': '/../sysweb3-core/src', - '^@pollum-io/sysweb3-keyring$': '/../sysweb3-keyring/src', + '^@sidhujag/sysweb3-utils$': '/../sysweb3-utils/src', + '^@sidhujag/sysweb3-core$': '/../sysweb3-core/src', + '^@sidhujag/sysweb3-keyring$': '/../sysweb3-keyring/src', 'isomorphic-fetch': '/../../__mocks__/isomorphic-fetch.js', }, setupFilesAfterEnv: ['/../../jest.setup.js'], diff --git a/packages/sysweb3-network/package.json b/packages/sysweb3-network/package.json index 1da6cb62..1c697e46 100644 --- a/packages/sysweb3-network/package.json +++ b/packages/sysweb3-network/package.json @@ -1,20 +1,20 @@ { - "name": "@pollum-io/sysweb3-network", - "version": "1.0.96", + "name": "@sidhujag/sysweb3-network", + "version": "1.0.110", "description": "A network management tool for multi-chain accounts.", "main": "cjs/index.js", "types": "types/index.d.ts", "repository": { "type": "git", - "url": "git+https://github.com/Pollum-io/sysweb3.git" + "url": "git+https://github.com/syscoin/sysweb3.git" }, "author": "Pali Wallet", "license": "MIT", "private": false, "bugs": { - "url": "https://github.com/Pollum-io/sysweb3/issues" + "url": "https://github.com/syscoin/sysweb3/issues" }, - "homepage": "https://github.com/Pollum-io/sysweb3#readme", + "homepage": "https://github.com/syscoin/sysweb3#readme", "engines": { "yarn": ">= 1.0.0" }, @@ -31,10 +31,12 @@ }, "dependencies": { "eth-chains": "^1.0.0", - "ethers": "^5.7.2" + "ethers": "^6.17.0" }, "devDependencies": { - "@types/lodash": "^4.14.191", - "rimraf": "^6.0.1" + "@types/jest": "^29.5.0", + "dotenv": "^16.6.1", + "rimraf": "^6.1.2", + "typescript": "5.9.3" } } diff --git a/packages/sysweb3-network/readme.md b/packages/sysweb3-network/readme.md index b710c443..90c04e0a 100644 --- a/packages/sysweb3-network/readme.md +++ b/packages/sysweb3-network/readme.md @@ -13,15 +13,15 @@ For use this library, is nice to have: For install, you can follow these commands: -- `yarn add @pollum-io/sysweb3-network` -- `npm install @pollum-io/sysweb3-network` +- `yarn add @sidhujag/sysweb3-network` +- `npm install @sidhujag/sysweb3-network` ## Usage The sysweb3-network was builded to have a really simple usability. For example, you can import package and console it to know what kind of functions you'll find: ```js -import sysweb3 from '@pollum-io/sysweb3-network'; +import sysweb3 from '@sidhujag/sysweb3-network'; console.log(sysweb3); diff --git a/packages/sysweb3-network/src/coins.ts b/packages/sysweb3-network/src/coins.ts index e74fc18a..4fb1faeb 100644 --- a/packages/sysweb3-network/src/coins.ts +++ b/packages/sysweb3-network/src/coins.ts @@ -115,7 +115,11 @@ export const coins: CoinsArray = [ bech32Prefix: 'tb', blockchainLink: { type: 'blockbook', - url: ['https://tbtc1.trezor.io', 'https://tbtc2.trezor.io'], + url: [ + 'https://blockbook.tbtc-1.zelcore.io', + 'https://tbtc1.trezor.io', + 'https://tbtc2.trezor.io', + ], }, blocktimeSeconds: 600, cashaddrPrefix: null, diff --git a/packages/sysweb3-network/src/ethers-subpaths.d.ts b/packages/sysweb3-network/src/ethers-subpaths.d.ts new file mode 100644 index 00000000..5a917bdb --- /dev/null +++ b/packages/sysweb3-network/src/ethers-subpaths.d.ts @@ -0,0 +1,3 @@ +declare module 'ethers/utils' { + export { toBeHex } from 'ethers'; +} diff --git a/packages/sysweb3-network/src/networks.ts b/packages/sysweb3-network/src/networks.ts index bcb74839..b2f66b6f 100644 --- a/packages/sysweb3-network/src/networks.ts +++ b/packages/sysweb3-network/src/networks.ts @@ -1,9 +1,5 @@ -import { ethers } from 'ethers'; - import { findCoin } from './coin-utils'; -export const toHexFromNumber = (decimal: number) => - ethers.utils.hexlify(decimal); export const toDecimalFromHex = (hexString: string) => parseInt(hexString, 16); export const getPubType = ( diff --git a/packages/sysweb3-network/src/retryUtils.ts b/packages/sysweb3-network/src/retryUtils.ts index d39a345e..72252820 100644 --- a/packages/sysweb3-network/src/retryUtils.ts +++ b/packages/sysweb3-network/src/retryUtils.ts @@ -33,7 +33,7 @@ export async function retryWithBackoff( if (isRetryableError && retryCount < MAX_RETRIES) { const delay = INITIAL_RETRY_DELAY * Math.pow(2, retryCount); console.log( - `[retryWithBackoff] Blockbook API rate limited, retrying after ${delay}ms... (attempt ${ + `[retryWithBackoff] API rate limited, retrying after ${delay}ms... (attempt ${ retryCount + 1 }/${MAX_RETRIES})` ); diff --git a/packages/sysweb3-network/src/rpc.ts b/packages/sysweb3-network/src/rpc.ts index 75253e09..1376f7f1 100644 --- a/packages/sysweb3-network/src/rpc.ts +++ b/packages/sysweb3-network/src/rpc.ts @@ -1,5 +1,5 @@ import { Chain, chains } from 'eth-chains'; -import { hexlify } from 'ethers/lib/utils'; +import { toBeHex } from 'ethers/utils'; import { findCoin } from './coin-utils'; // import fetch from "node-fetch"; @@ -39,10 +39,23 @@ export const clearRpcCaches = () => { console.log('[RPC] Cleared all RPC caches'); }; +/** + * Get chain details by chain ID + * @param chainId - The chain ID to look up + * @returns Chain details object or undefined if not found + */ +export const getChainById = (chainId: number): Chain | undefined => { + try { + return chains.getById(chainId); + } catch (error) { + return undefined; + } +}; + export const validateChainId = ( chainId: number | string ): { hexChainId: string; valid: boolean } => { - const hexChainId = hexlify(chainId); + const hexChainId = toBeHex(chainId); const isHexChainIdValid = typeof hexChainId === 'string' && hexRegEx.test(hexChainId); @@ -52,7 +65,7 @@ export const validateChainId = ( hexChainId, }; }; -//TODO: add returns types for getEthChainId + const getEthChainId = async ( url: string, isInCooldown: boolean @@ -209,7 +222,7 @@ export const validateEthRpc = async ( } const { valid, hexChainId } = validateChainId(chainId); - const details = chains.getById(chainId); + const details = getChainById(chainId); if (!valid) { throw new Error('RPC has an invalid chain ID'); } @@ -236,7 +249,6 @@ export const getEthRpc = async ( ): Promise<{ formattedNetwork: INetwork; }> => { - const endsWithSlash = /\/$/; const { valid, hexChainId, details } = await validateEthRpc( data.url, isInCooldown @@ -251,9 +263,12 @@ export const getEthRpc = async ( } else if (data.explorer) { explorer = data.explorer; } - if (!endsWithSlash.test(explorer)) { - explorer = explorer + '/'; - } + // Preserve query and fragment bytes; only the pathname needs a trailing slash. + const explorerString = String(explorer); + const explorerPath = explorerString.split(/[?#]/, 1)[0]; + explorer = explorerPath.endsWith('/') + ? explorerString + : explorerPath + '/' + explorerString.slice(explorerPath.length); if (!details && !data.symbol) throw new Error('Must define a symbol'); const formattedNetwork = { url: data.url, diff --git a/packages/sysweb3-network/test/rpc-explorer-normalization.spec.ts b/packages/sysweb3-network/test/rpc-explorer-normalization.spec.ts new file mode 100644 index 00000000..75337dcc --- /dev/null +++ b/packages/sysweb3-network/test/rpc-explorer-normalization.spec.ts @@ -0,0 +1,211 @@ +import { INetworkType } from '../src/networks'; +import { clearRpcCaches, getEthRpc } from '../src/rpc'; + +describe('getEthRpc explorer pathname normalization', () => { + const unknownChainId = 1234567890123; + const originalFetch = global.fetch; + let fetchMock: jest.Mock; + + beforeEach(() => { + clearRpcCaches(); + fetchMock = jest.fn().mockResolvedValue({ + ok: true, + status: 200, + json: async () => ({ + jsonrpc: '2.0', + id: 1, + result: `0x${unknownChainId.toString(16)}`, + }), + }); + global.fetch = fetchMock; + }); + + afterEach(() => { + global.fetch = originalFetch; + }); + + it.each([ + ['origin', 'https://explorer.invalid', 'https://explorer.invalid/'], + ['root', 'https://explorer.invalid/', 'https://explorer.invalid/'], + [ + 'path', + 'https://explorer.invalid/public', + 'https://explorer.invalid/public/', + ], + [ + 'path slash', + 'https://explorer.invalid/public/', + 'https://explorer.invalid/public/', + ], + [ + 'query', + 'https://explorer.invalid?view=compact', + 'https://explorer.invalid/?view=compact', + ], + [ + 'path query', + 'https://explorer.invalid/public?view=compact', + 'https://explorer.invalid/public/?view=compact', + ], + [ + 'path slash query', + 'https://explorer.invalid/public/?view=compact', + 'https://explorer.invalid/public/?view=compact', + ], + [ + 'query ending in slash', + 'https://explorer.invalid/public?next=/', + 'https://explorer.invalid/public/?next=/', + ], + [ + 'anchor', + 'https://explorer.invalid/public#section', + 'https://explorer.invalid/public/#section', + ], + [ + 'root anchor', + 'https://explorer.invalid/#section', + 'https://explorer.invalid/#section', + ], + [ + 'fragment ending in slash', + 'https://explorer.invalid/public#section/', + 'https://explorer.invalid/public/#section/', + ], + [ + 'hash router', + 'https://explorer.invalid/public#/route?view=compact', + 'https://explorer.invalid/public/#/route?view=compact', + ], + [ + 'root hash router', + 'https://explorer.invalid/#/route?view=compact', + 'https://explorer.invalid/#/route?view=compact', + ], + [ + 'hashbang router', + 'https://explorer.invalid/public#!/route?view=compact', + 'https://explorer.invalid/public/#!/route?view=compact', + ], + [ + 'query and hashbang', + 'https://explorer.invalid/public?view=compact#!/route?item=1', + 'https://explorer.invalid/public/?view=compact#!/route?item=1', + ], + [ + 'encoded suffix bytes', + 'https://Explorer.invalid/%2f?key=a%2Bb&path=%2F%3f%23#/%2F?x=%2b', + 'https://Explorer.invalid/%2f/?key=a%2Bb&path=%2F%3f%23#/%2F?x=%2b', + ], + [ + 'empty query', + 'https://explorer.invalid/public?', + 'https://explorer.invalid/public/?', + ], + [ + 'empty fragment', + 'https://explorer.invalid/public#', + 'https://explorer.invalid/public/#', + ], + [ + 'question mark inside fragment', + 'https://explorer.invalid/public#route?view=compact', + 'https://explorer.invalid/public/#route?view=compact', + ], + ['accepted non-URL value', 'not-a-url', 'not-a-url/'], + ['accepted non-URL slash', 'not-a-url/', 'not-a-url/'], + ['empty explorer', '', '/'], + ])( + 'preserves %s while adding only a pathname slash', + async (_label, explorer, expected) => { + const input = { + url: 'https://rpc.synthetic.invalid', + explorer, + apiUrl: 'https://api.synthetic.invalid/data?key=a%2Bb#anchor', + label: 'Synthetic network', + symbol: 'TEST', + }; + const result = await getEthRpc(input, false); + + expect(result).toStrictEqual({ + formattedNetwork: { + url: input.url, + default: false, + label: input.label, + apiUrl: input.apiUrl, + explorer: expected, + currency: 'test', + chainId: unknownChainId, + slip44: 60, + kind: INetworkType.Ethereum, + }, + }); + expect(fetchMock).toHaveBeenCalledTimes(1); + expect(fetchMock.mock.calls[0][0]).toBe(input.url); + expect(JSON.parse(fetchMock.mock.calls[0][1].body)).toStrictEqual({ + jsonrpc: '2.0', + method: 'eth_chainId', + params: [], + id: 1, + }); + expect(input.explorer).toBe(explorer); + } + ); + + it('retains an absent custom explorer as the existing slash value', async () => { + const { formattedNetwork } = await getEthRpc( + { url: 'https://rpc.synthetic.invalid', symbol: 'TEST' }, + false + ); + expect(formattedNetwork.explorer).toBe('/'); + }); + + it.each([17, true])( + 'retains string coercion for an accepted non-string explorer %s', + async (explorer) => { + const { formattedNetwork } = await getEthRpc( + { url: 'https://rpc.synthetic.invalid', symbol: 'TEST', explorer }, + false + ); + expect(formattedNetwork.explorer).toBe(`${explorer}/`); + } + ); + + it('uses the registered explorer and native symbol when no override is supplied', async () => { + fetchMock.mockResolvedValue({ + ok: true, + status: 200, + json: async () => ({ jsonrpc: '2.0', id: 1, result: '0x1' }), + }); + const { formattedNetwork } = await getEthRpc( + { url: 'https://rpc.synthetic.invalid' }, + false + ); + expect(formattedNetwork.explorer).toBe('https://etherscan.io/'); + expect(formattedNetwork.currency).toBe('eth'); + expect(formattedNetwork.chainId).toBe(1); + }); + + it('still requires a symbol for an unregistered chain', async () => { + await expect( + getEthRpc( + { url: 'https://rpc.synthetic.invalid', explorer: 'not-a-url' }, + false + ) + ).rejects.toThrow('Must define a symbol'); + }); + + it('still refuses a cooldown before issuing an RPC request', async () => { + await expect( + getEthRpc( + { + url: 'https://rpc.synthetic.invalid', + symbol: 'TEST', + explorer: 'https://explorer.invalid?view=compact', + }, + true + ) + ).rejects.toThrow('Cant make request, rpc cooldown is active'); + expect(fetchMock).not.toHaveBeenCalled(); + }); +}); diff --git a/packages/sysweb3-network/yarn.lock b/packages/sysweb3-network/yarn.lock index 7158cc27..5332706c 100644 --- a/packages/sysweb3-network/yarn.lock +++ b/packages/sysweb3-network/yarn.lock @@ -2,423 +2,174 @@ # yarn lockfile v1 -"@ethersproject/abi@5.8.0", "@ethersproject/abi@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/abi/-/abi-5.8.0.tgz#e79bb51940ac35fe6f3262d7fe2cdb25ad5f07d9" - integrity sha512-b9YS/43ObplgyV6SlyQsG53/vkSal0MNA1fskSC4mbnCMi8R+NkcH8K9FPYNESf6jUefBUniE4SOKms0E/KK1Q== - dependencies: - "@ethersproject/address" "^5.8.0" - "@ethersproject/bignumber" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/constants" "^5.8.0" - "@ethersproject/hash" "^5.8.0" - "@ethersproject/keccak256" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - "@ethersproject/strings" "^5.8.0" - -"@ethersproject/abstract-provider@5.8.0", "@ethersproject/abstract-provider@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/abstract-provider/-/abstract-provider-5.8.0.tgz#7581f9be601afa1d02b95d26b9d9840926a35b0c" - integrity sha512-wC9SFcmh4UK0oKuLJQItoQdzS/qZ51EJegK6EmAWlh+OptpQ/npECOR3QqECd8iGHC0RJb4WKbVdSfif4ammrg== - dependencies: - "@ethersproject/bignumber" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/networks" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - "@ethersproject/transactions" "^5.8.0" - "@ethersproject/web" "^5.8.0" - -"@ethersproject/abstract-signer@5.8.0", "@ethersproject/abstract-signer@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/abstract-signer/-/abstract-signer-5.8.0.tgz#8d7417e95e4094c1797a9762e6789c7356db0754" - integrity sha512-N0XhZTswXcmIZQdYtUnd79VJzvEwXQw6PK0dTl9VoYrEBxxCPXqS0Eod7q5TNKRxe1/5WUMuR0u0nqTF/avdCA== - dependencies: - "@ethersproject/abstract-provider" "^5.8.0" - "@ethersproject/bignumber" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - -"@ethersproject/address@5.8.0", "@ethersproject/address@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/address/-/address-5.8.0.tgz#3007a2c352eee566ad745dca1dbbebdb50a6a983" - integrity sha512-GhH/abcC46LJwshoN+uBNoKVFPxUuZm6dA257z0vZkKmU1+t8xTn8oK7B9qrj8W2rFRMch4gbJl6PmVxjxBEBA== - dependencies: - "@ethersproject/bignumber" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/keccak256" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/rlp" "^5.8.0" - -"@ethersproject/base64@5.8.0", "@ethersproject/base64@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/base64/-/base64-5.8.0.tgz#61c669c648f6e6aad002c228465d52ac93ee83eb" - integrity sha512-lN0oIwfkYj9LbPx4xEkie6rAMJtySbpOAFXSDVQaBnAzYfB4X2Qr+FXJGxMoc3Bxp2Sm8OwvzMrywxyw0gLjIQ== - dependencies: - "@ethersproject/bytes" "^5.8.0" - -"@ethersproject/basex@5.8.0", "@ethersproject/basex@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/basex/-/basex-5.8.0.tgz#1d279a90c4be84d1c1139114a1f844869e57d03a" - integrity sha512-PIgTszMlDRmNwW9nhS6iqtVfdTAKosA7llYXNmGPw4YAI1PUyMv28988wAb41/gHF/WqGdoLv0erHaRcHRKW2Q== - dependencies: - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - -"@ethersproject/bignumber@5.8.0", "@ethersproject/bignumber@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/bignumber/-/bignumber-5.8.0.tgz#c381d178f9eeb370923d389284efa19f69efa5d7" - integrity sha512-ZyaT24bHaSeJon2tGPKIiHszWjD/54Sz8t57Toch475lCLljC6MgPmxk7Gtzz+ddNN5LuHea9qhAe0x3D+uYPA== - dependencies: - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - bn.js "^5.2.1" - -"@ethersproject/bytes@5.8.0", "@ethersproject/bytes@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/bytes/-/bytes-5.8.0.tgz#9074820e1cac7507a34372cadeb035461463be34" - integrity sha512-vTkeohgJVCPVHu5c25XWaWQOZ4v+DkGoC42/TS2ond+PARCxTJvgTFUNDZovyQ/uAQ4EcpqqowKydcdmRKjg7A== - dependencies: - "@ethersproject/logger" "^5.8.0" - -"@ethersproject/constants@5.8.0", "@ethersproject/constants@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/constants/-/constants-5.8.0.tgz#12f31c2f4317b113a4c19de94e50933648c90704" - integrity sha512-wigX4lrf5Vu+axVTIvNsuL6YrV4O5AXl5ubcURKMEME5TnWBouUh0CDTWxZ2GpnRn1kcCgE7l8O5+VbV9QTTcg== - dependencies: - "@ethersproject/bignumber" "^5.8.0" - -"@ethersproject/contracts@5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/contracts/-/contracts-5.8.0.tgz#243a38a2e4aa3e757215ea64e276f8a8c9d8ed73" - integrity sha512-0eFjGz9GtuAi6MZwhb4uvUM216F38xiuR0yYCjKJpNfSEy4HUM8hvqqBj9Jmm0IUz8l0xKEhWwLIhPgxNY0yvQ== - dependencies: - "@ethersproject/abi" "^5.8.0" - "@ethersproject/abstract-provider" "^5.8.0" - "@ethersproject/abstract-signer" "^5.8.0" - "@ethersproject/address" "^5.8.0" - "@ethersproject/bignumber" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/constants" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - "@ethersproject/transactions" "^5.8.0" - -"@ethersproject/hash@5.8.0", "@ethersproject/hash@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/hash/-/hash-5.8.0.tgz#b8893d4629b7f8462a90102572f8cd65a0192b4c" - integrity sha512-ac/lBcTbEWW/VGJij0CNSw/wPcw9bSRgCB0AIBz8CvED/jfvDoV9hsIIiWfvWmFEi8RcXtlNwp2jv6ozWOsooA== - dependencies: - "@ethersproject/abstract-signer" "^5.8.0" - "@ethersproject/address" "^5.8.0" - "@ethersproject/base64" "^5.8.0" - "@ethersproject/bignumber" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/keccak256" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - "@ethersproject/strings" "^5.8.0" - -"@ethersproject/hdnode@5.8.0", "@ethersproject/hdnode@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/hdnode/-/hdnode-5.8.0.tgz#a51ae2a50bcd48ef6fd108c64cbae5e6ff34a761" - integrity sha512-4bK1VF6E83/3/Im0ERnnUeWOY3P1BZml4ZD3wcH8Ys0/d1h1xaFt6Zc+Dh9zXf9TapGro0T4wvO71UTCp3/uoA== - dependencies: - "@ethersproject/abstract-signer" "^5.8.0" - "@ethersproject/basex" "^5.8.0" - "@ethersproject/bignumber" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/pbkdf2" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - "@ethersproject/sha2" "^5.8.0" - "@ethersproject/signing-key" "^5.8.0" - "@ethersproject/strings" "^5.8.0" - "@ethersproject/transactions" "^5.8.0" - "@ethersproject/wordlists" "^5.8.0" - -"@ethersproject/json-wallets@5.8.0", "@ethersproject/json-wallets@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/json-wallets/-/json-wallets-5.8.0.tgz#d18de0a4cf0f185f232eb3c17d5e0744d97eb8c9" - integrity sha512-HxblNck8FVUtNxS3VTEYJAcwiKYsBIF77W15HufqlBF9gGfhmYOJtYZp8fSDZtn9y5EaXTE87zDwzxRoTFk11w== - dependencies: - "@ethersproject/abstract-signer" "^5.8.0" - "@ethersproject/address" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/hdnode" "^5.8.0" - "@ethersproject/keccak256" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/pbkdf2" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - "@ethersproject/random" "^5.8.0" - "@ethersproject/strings" "^5.8.0" - "@ethersproject/transactions" "^5.8.0" - aes-js "3.0.0" - scrypt-js "3.0.1" - -"@ethersproject/keccak256@5.8.0", "@ethersproject/keccak256@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/keccak256/-/keccak256-5.8.0.tgz#d2123a379567faf2d75d2aaea074ffd4df349e6a" - integrity sha512-A1pkKLZSz8pDaQ1ftutZoaN46I6+jvuqugx5KYNeQOPqq+JZ0Txm7dlWesCHB5cndJSu5vP2VKptKf7cksERng== - dependencies: - "@ethersproject/bytes" "^5.8.0" - js-sha3 "0.8.0" - -"@ethersproject/logger@5.8.0", "@ethersproject/logger@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/logger/-/logger-5.8.0.tgz#f0232968a4f87d29623a0481690a2732662713d6" - integrity sha512-Qe6knGmY+zPPWTC+wQrpitodgBfH7XoceCGL5bJVejmH+yCS3R8jJm8iiWuvWbG76RUmyEG53oqv6GMVWqunjA== - -"@ethersproject/networks@5.8.0", "@ethersproject/networks@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/networks/-/networks-5.8.0.tgz#8b4517a3139380cba9fb00b63ffad0a979671fde" - integrity sha512-egPJh3aPVAzbHwq8DD7Po53J4OUSsA1MjQp8Vf/OZPav5rlmWUaFLiq8cvQiGK0Z5K6LYzm29+VA/p4RL1FzNg== - dependencies: - "@ethersproject/logger" "^5.8.0" - -"@ethersproject/pbkdf2@5.8.0", "@ethersproject/pbkdf2@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/pbkdf2/-/pbkdf2-5.8.0.tgz#cd2621130e5dd51f6a0172e63a6e4a0c0a0ec37e" - integrity sha512-wuHiv97BrzCmfEaPbUFpMjlVg/IDkZThp9Ri88BpjRleg4iePJaj2SW8AIyE8cXn5V1tuAaMj6lzvsGJkGWskg== - dependencies: - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/sha2" "^5.8.0" - -"@ethersproject/properties@5.8.0", "@ethersproject/properties@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/properties/-/properties-5.8.0.tgz#405a8affb6311a49a91dabd96aeeae24f477020e" - integrity sha512-PYuiEoQ+FMaZZNGrStmN7+lWjlsoufGIHdww7454FIaGdbe/p5rnaCXTr5MtBYl3NkeoVhHZuyzChPeGeKIpQw== - dependencies: - "@ethersproject/logger" "^5.8.0" - -"@ethersproject/providers@5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/providers/-/providers-5.8.0.tgz#6c2ae354f7f96ee150439f7de06236928bc04cb4" - integrity sha512-3Il3oTzEx3o6kzcg9ZzbE+oCZYyY+3Zh83sKkn4s1DZfTUjIegHnN2Cm0kbn9YFy45FDVcuCLLONhU7ny0SsCw== - dependencies: - "@ethersproject/abstract-provider" "^5.8.0" - "@ethersproject/abstract-signer" "^5.8.0" - "@ethersproject/address" "^5.8.0" - "@ethersproject/base64" "^5.8.0" - "@ethersproject/basex" "^5.8.0" - "@ethersproject/bignumber" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/constants" "^5.8.0" - "@ethersproject/hash" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/networks" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - "@ethersproject/random" "^5.8.0" - "@ethersproject/rlp" "^5.8.0" - "@ethersproject/sha2" "^5.8.0" - "@ethersproject/strings" "^5.8.0" - "@ethersproject/transactions" "^5.8.0" - "@ethersproject/web" "^5.8.0" - bech32 "1.1.4" - ws "8.18.0" - -"@ethersproject/random@5.8.0", "@ethersproject/random@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/random/-/random-5.8.0.tgz#1bced04d49449f37c6437c701735a1a022f0057a" - integrity sha512-E4I5TDl7SVqyg4/kkA/qTfuLWAQGXmSOgYyO01So8hLfwgKvYK5snIlzxJMk72IFdG/7oh8yuSqY2KX7MMwg+A== - dependencies: - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - -"@ethersproject/rlp@5.8.0", "@ethersproject/rlp@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/rlp/-/rlp-5.8.0.tgz#5a0d49f61bc53e051532a5179472779141451de5" - integrity sha512-LqZgAznqDbiEunaUvykH2JAoXTT9NV0Atqk8rQN9nx9SEgThA/WMx5DnW8a9FOufo//6FZOCHZ+XiClzgbqV9Q== - dependencies: - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - -"@ethersproject/sha2@5.8.0", "@ethersproject/sha2@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/sha2/-/sha2-5.8.0.tgz#8954a613bb78dac9b46829c0a95de561ef74e5e1" - integrity sha512-dDOUrXr9wF/YFltgTBYS0tKslPEKr6AekjqDW2dbn1L1xmjGR+9GiKu4ajxovnrDbwxAKdHjW8jNcwfz8PAz4A== - dependencies: - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - hash.js "1.1.7" - -"@ethersproject/signing-key@5.8.0", "@ethersproject/signing-key@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/signing-key/-/signing-key-5.8.0.tgz#9797e02c717b68239c6349394ea85febf8893119" - integrity sha512-LrPW2ZxoigFi6U6aVkFN/fa9Yx/+4AtIUe4/HACTvKJdhm0eeb107EVCIQcrLZkxaSIgc/eCrX8Q1GtbH+9n3w== - dependencies: - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - bn.js "^5.2.1" - elliptic "6.6.1" - hash.js "1.1.7" - -"@ethersproject/solidity@5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/solidity/-/solidity-5.8.0.tgz#429bb9fcf5521307a9448d7358c26b93695379b9" - integrity sha512-4CxFeCgmIWamOHwYN9d+QWGxye9qQLilpgTU0XhYs1OahkclF+ewO+3V1U0mvpiuQxm5EHHmv8f7ClVII8EHsA== - dependencies: - "@ethersproject/bignumber" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/keccak256" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/sha2" "^5.8.0" - "@ethersproject/strings" "^5.8.0" - -"@ethersproject/strings@5.8.0", "@ethersproject/strings@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/strings/-/strings-5.8.0.tgz#ad79fafbf0bd272d9765603215ac74fd7953908f" - integrity sha512-qWEAk0MAvl0LszjdfnZ2uC8xbR2wdv4cDabyHiBh3Cldq/T8dPH3V4BbBsAYJUeonwD+8afVXld274Ls+Y1xXg== - dependencies: - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/constants" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - -"@ethersproject/transactions@5.8.0", "@ethersproject/transactions@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/transactions/-/transactions-5.8.0.tgz#1e518822403abc99def5a043d1c6f6fe0007e46b" - integrity sha512-UglxSDjByHG0TuU17bDfCemZ3AnKO2vYrL5/2n2oXvKzvb7Cz+W9gOWXKARjp2URVwcWlQlPOEQyAviKwT4AHg== - dependencies: - "@ethersproject/address" "^5.8.0" - "@ethersproject/bignumber" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/constants" "^5.8.0" - "@ethersproject/keccak256" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - "@ethersproject/rlp" "^5.8.0" - "@ethersproject/signing-key" "^5.8.0" - -"@ethersproject/units@5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/units/-/units-5.8.0.tgz#c12f34ba7c3a2de0e9fa0ed0ee32f3e46c5c2c6a" - integrity sha512-lxq0CAnc5kMGIiWW4Mr041VT8IhNM+Pn5T3haO74XZWFulk7wH1Gv64HqE96hT4a7iiNMdOCFEBgaxWuk8ETKQ== - dependencies: - "@ethersproject/bignumber" "^5.8.0" - "@ethersproject/constants" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - -"@ethersproject/wallet@5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/wallet/-/wallet-5.8.0.tgz#49c300d10872e6986d953e8310dc33d440da8127" - integrity sha512-G+jnzmgg6UxurVKRKvw27h0kvG75YKXZKdlLYmAHeF32TGUzHkOFd7Zn6QHOTYRFWnfjtSSFjBowKo7vfrXzPA== - dependencies: - "@ethersproject/abstract-provider" "^5.8.0" - "@ethersproject/abstract-signer" "^5.8.0" - "@ethersproject/address" "^5.8.0" - "@ethersproject/bignumber" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/hash" "^5.8.0" - "@ethersproject/hdnode" "^5.8.0" - "@ethersproject/json-wallets" "^5.8.0" - "@ethersproject/keccak256" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - "@ethersproject/random" "^5.8.0" - "@ethersproject/signing-key" "^5.8.0" - "@ethersproject/transactions" "^5.8.0" - "@ethersproject/wordlists" "^5.8.0" - -"@ethersproject/web@5.8.0", "@ethersproject/web@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/web/-/web-5.8.0.tgz#3e54badc0013b7a801463a7008a87988efce8a37" - integrity sha512-j7+Ksi/9KfGviws6Qtf9Q7KCqRhpwrYKQPs+JBA/rKVFF/yaWLHJEH3zfVP2plVu+eys0d2DlFmhoQJayFewcw== - dependencies: - "@ethersproject/base64" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - "@ethersproject/strings" "^5.8.0" - -"@ethersproject/wordlists@5.8.0", "@ethersproject/wordlists@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/wordlists/-/wordlists-5.8.0.tgz#7a5654ee8d1bb1f4dbe43f91d217356d650ad821" - integrity sha512-2df9bbXicZws2Sb5S6ET493uJ0Z84Fjr3pC4tu/qlnZERibZCeUVuqdtt+7Tv9xxhUxHoIekIA7avrKUWHrezg== - dependencies: - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/hash" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - "@ethersproject/strings" "^5.8.0" - -"@isaacs/balanced-match@^4.0.1": - version "4.0.1" - resolved "https://registry.yarnpkg.com/@isaacs/balanced-match/-/balanced-match-4.0.1.tgz#3081dadbc3460661b751e7591d7faea5df39dd29" - integrity sha512-yzMTt9lEb8Gv7zRioUilSglI0c0smZ9k5D65677DLWLtWJaXIS3CqcGyUFByYKlnUj6TkjLVs54fBl6+TiGQDQ== - -"@isaacs/brace-expansion@^5.0.0": - version "5.0.0" - resolved "https://registry.yarnpkg.com/@isaacs/brace-expansion/-/brace-expansion-5.0.0.tgz#4b3dabab7d8e75a429414a96bd67bf4c1d13e0f3" - integrity sha512-ZT55BDLV0yv0RBm2czMiZ+SqCGO7AvmOM3G/w2xhVPH+te0aKgFjmBvGlL1dH+ql2tgGO3MVrbb3jCKyvpgnxA== - dependencies: - "@isaacs/balanced-match" "^4.0.1" - -"@isaacs/cliui@^8.0.2": - version "8.0.2" - resolved "https://registry.yarnpkg.com/@isaacs/cliui/-/cliui-8.0.2.tgz#b37667b7bc181c168782259bab42474fbf52b550" - integrity sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA== - dependencies: - string-width "^5.1.2" - string-width-cjs "npm:string-width@^4.2.0" - strip-ansi "^7.0.1" - strip-ansi-cjs "npm:strip-ansi@^6.0.1" - wrap-ansi "^8.1.0" - wrap-ansi-cjs "npm:wrap-ansi@^7.0.0" - -"@types/lodash@^4.14.191": - version "4.17.20" - resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.17.20.tgz#1ca77361d7363432d29f5e55950d9ec1e1c6ea93" - integrity sha512-H3MHACvFUEiujabxhaI/ImO6gUrd8oOurg7LQtS7mbwIXA/cUqWrvBsaeJ23aZEPk1TAYkurjfMbSELfoCXlGA== - -aes-js@3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-3.0.0.tgz#e21df10ad6c2053295bcbb8dab40b09dbea87e4d" - integrity sha512-H7wUZRn8WpTq9jocdxQ2c8x2sKo9ZVmzfRE13GiNJXfp7NcKYEdvl3vspKjXox6RIG2VtaRe4JFvxG4rqp2Zuw== +"@adraffy/ens-normalize@1.11.1": + version "1.11.1" + resolved "https://registry.yarnpkg.com/@adraffy/ens-normalize/-/ens-normalize-1.11.1.tgz#6c2d657d4b2dfb37f8ea811dcb3e60843d4ac24a" + integrity sha512-nhCBV3quEgesuf7c7KYfperqSS14T8bYuvJ8PcLJp6znkZpFc0AuW4qBtr8eKVyPPe/8RSr7sglCWPU5eaxwKQ== + +"@babel/code-frame@^7.12.13": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.29.7.tgz#f2fbbfea87c44a21590ec515b778b2c26d8866e7" + integrity sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw== + dependencies: + "@babel/helper-validator-identifier" "^7.29.7" + js-tokens "^4.0.0" + picocolors "^1.1.1" + +"@babel/helper-validator-identifier@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.29.7.tgz#bd87084ced0c796ec46bda492de6e83d29e89fc2" + integrity sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg== + +"@jest/expect-utils@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/expect-utils/-/expect-utils-29.7.0.tgz#023efe5d26a8a70f21677d0a1afc0f0a44e3a1c6" + integrity sha512-GlsNBWiFQFCVi9QVSx7f5AgMeLxe9YCCs5PuP2O2LdjDAA8Jh9eX7lA1Jq/xdXw3Wb3hyvlFNfZIfcRetSzYcA== + dependencies: + jest-get-type "^29.6.3" + +"@jest/schemas@^29.6.3": + version "29.6.3" + resolved "https://registry.yarnpkg.com/@jest/schemas/-/schemas-29.6.3.tgz#430b5ce8a4e0044a7e3819663305a7b3091c8e03" + integrity sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA== + dependencies: + "@sinclair/typebox" "^0.27.8" + +"@jest/types@^29.6.3": + version "29.6.3" + resolved "https://registry.yarnpkg.com/@jest/types/-/types-29.6.3.tgz#1131f8cf634e7e84c5e77bab12f052af585fba59" + integrity sha512-u3UPsIilWKOM3F9CXtrG8LEJmNxwoCQC/XVj4IKYXvvpx7QIi/Kg1LI5uDmDpKlac62NUtX7eLjRh+jVZcLOzw== + dependencies: + "@jest/schemas" "^29.6.3" + "@types/istanbul-lib-coverage" "^2.0.0" + "@types/istanbul-reports" "^3.0.0" + "@types/node" "*" + "@types/yargs" "^17.0.8" + chalk "^4.0.0" + +"@noble/curves@1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.2.0.tgz#92d7e12e4e49b23105a2555c6984d41733d65c35" + integrity sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw== + dependencies: + "@noble/hashes" "1.3.2" + +"@noble/hashes@1.3.2": + version "1.3.2" + resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.2.tgz#6f26dbc8fbc7205873ce3cee2f690eba0d421b39" + integrity sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ== + +"@sinclair/typebox@^0.27.8": + version "0.27.10" + resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.27.10.tgz#beefe675f1853f73676aecc915b2bd2ac98c4fc6" + integrity sha512-MTBk/3jGLNB2tVxv6uLlFh1iu64iYOQ2PbdOSK3NW8JZsmlaOh2q6sdtKowBhfw8QFLmYNzTW4/oK4uATIi6ZA== + +"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0": + version "2.0.6" + resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz#7739c232a1fee9b4d3ce8985f314c0c6d33549d7" + integrity sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w== + +"@types/istanbul-lib-report@*": + version "3.0.3" + resolved "https://registry.yarnpkg.com/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.3.tgz#53047614ae72e19fc0401d872de3ae2b4ce350bf" + integrity sha512-NQn7AHQnk/RSLOxrBbGyJM/aVQ+pjj5HCgasFxc0K/KhoATfQ/47AyUl15I2yBUpihjmas+a+VJBOqecrFH+uA== + dependencies: + "@types/istanbul-lib-coverage" "*" + +"@types/istanbul-reports@^3.0.0": + version "3.0.4" + resolved "https://registry.yarnpkg.com/@types/istanbul-reports/-/istanbul-reports-3.0.4.tgz#0f03e3d2f670fbdac586e34b433783070cc16f54" + integrity sha512-pk2B1NWalF9toCRu6gjBzR69syFjP4Od8WRAX+0mmf9lAjCRicLOWc+ZrxZHx/0XRjotgkF9t6iaMJ+aXcOdZQ== + dependencies: + "@types/istanbul-lib-report" "*" + +"@types/jest@^29.5.0": + version "29.5.14" + resolved "https://registry.yarnpkg.com/@types/jest/-/jest-29.5.14.tgz#2b910912fa1d6856cadcd0c1f95af7df1d6049e5" + integrity sha512-ZN+4sdnLUbo8EVvVc2ao0GFW6oVrQRPn4K2lglySj7APvSrgzxHiNNK99us4WDMi57xxA2yggblIAMNhXOotLQ== + dependencies: + expect "^29.0.0" + pretty-format "^29.0.0" + +"@types/node@*": + version "26.1.0" + resolved "https://registry.yarnpkg.com/@types/node/-/node-26.1.0.tgz#aa85f0727fc5611347091c478341c63650903439" + integrity sha512-O0A1G3xPGy4w7AgQdAQYUlQ+BKk2Oovw8eRpofyp5KdBZULnbe+WqaOVNrm705SHphCiG4XHsACrSmPu1f+Kgw== + dependencies: + undici-types "~8.3.0" + +"@types/node@22.7.5": + version "22.7.5" + resolved "https://registry.yarnpkg.com/@types/node/-/node-22.7.5.tgz#cfde981727a7ab3611a481510b473ae54442b92b" + integrity sha512-jML7s2NAzMWc//QSJ1a3prpk78cOPchGvXJsC3C6R6PSMoooztvRVQEz89gmBTBY1SPMaqo5teB4uNHPdetShQ== + dependencies: + undici-types "~6.19.2" + +"@types/stack-utils@^2.0.0": + version "2.0.3" + resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.3.tgz#6209321eb2c1712a7e7466422b8cb1fc0d9dd5d8" + integrity sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw== -ansi-regex@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" - integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== +"@types/yargs-parser@*": + version "21.0.3" + resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-21.0.3.tgz#815e30b786d2e8f0dcd85fd5bcf5e1a04d008f15" + integrity sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ== + +"@types/yargs@^17.0.8": + version "17.0.35" + resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-17.0.35.tgz#07013e46aa4d7d7d50a49e15604c1c5340d4eb24" + integrity sha512-qUHkeCyQFxMXg79wQfTtfndEC+N9ZZg76HJftDJp+qH2tV7Gj4OJi7l+PiWwJ+pWtW8GwSmqsDj/oymhrTWXjg== + dependencies: + "@types/yargs-parser" "*" -ansi-regex@^6.0.1: - version "6.1.0" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-6.1.0.tgz#95ec409c69619d6cb1b8b34f14b660ef28ebd654" - integrity sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA== +aes-js@4.0.0-beta.5: + version "4.0.0-beta.5" + resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-4.0.0-beta.5.tgz#8d2452c52adedebc3a3e28465d858c11ca315873" + integrity sha512-G965FqalsNyrPqgEGON7nIx1e/OVENSgiEIzyC63haUMuvNnwIgIjMs52hlTCKhkBny7A2ORNlfY9Zu+jmGk1Q== -ansi-styles@^4.0.0: +ansi-styles@^4.1.0: version "4.3.0" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== dependencies: color-convert "^2.0.1" -ansi-styles@^6.1.0: - version "6.2.1" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-6.2.1.tgz#0e62320cf99c21afff3b3012192546aacbfb05c5" - integrity sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug== +ansi-styles@^5.0.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-5.2.0.tgz#07449690ad45777d1924ac2abb2fc8895dba836b" + integrity sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA== -bech32@1.1.4: - version "1.1.4" - resolved "https://registry.yarnpkg.com/bech32/-/bech32-1.1.4.tgz#e38c9f37bf179b8eb16ae3a772b40c356d4832e9" - integrity sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ== +balanced-match@^4.0.2: + version "4.0.4" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-4.0.4.tgz#bfb10662feed8196a2c62e7c68e17720c274179a" + integrity sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA== -bn.js@^4.11.9: - version "4.12.2" - resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.12.2.tgz#3d8fed6796c24e177737f7cc5172ee04ef39ec99" - integrity sha512-n4DSx829VRTRByMRGdjQ9iqsN0Bh4OolPsFnaZBLcbi8iXcB+kJ9s7EnRt4wILZNV3kPLHkRVfOc/HvhC3ovDw== +brace-expansion@^5.0.5: + version "5.0.7" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-5.0.7.tgz#1b0e46965b479dad65af737b4a02790a05498337" + integrity sha512-7oFy703dxfY3/NLxC1fh2SUCQ0H9rmAY+5EpDVfXjUTTs+HEwR2nYaqLv+GWcTsumwxPfiz6CzCNkwXwBUwqCA== + dependencies: + balanced-match "^4.0.2" -bn.js@^5.2.1: - version "5.2.2" - resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.2.tgz#82c09f9ebbb17107cd72cb7fd39bd1f9d0aaa566" - integrity sha512-v2YAxEmKaBLahNwE1mjp4WON6huMNeuDvagFZW+ASCuA/ku0bXR9hSMw0XpiqMoA3+rmnyck/tPRSFQkoC9Cuw== +braces@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.3.tgz#490332f40919452272d55a8480adc0c441358789" + integrity sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA== + dependencies: + fill-range "^7.1.1" -brorand@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f" - integrity sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w== +chalk@^4.0.0: + version "4.1.2" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" + integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== + dependencies: + ansi-styles "^4.1.0" + supports-color "^7.1.0" + +ci-info@^3.2.0: + version "3.9.0" + resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-3.9.0.tgz#4279a62028a7b1f262f3473fc9605f5e218c59b4" + integrity sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ== color-convert@^2.0.1: version "2.0.1" @@ -432,297 +183,255 @@ color-name@~1.1.4: resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== -cross-spawn@^7.0.6: - version "7.0.6" - resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.6.tgz#8a58fe78f00dcd70c370451759dfbfaf03e8ee9f" - integrity sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA== - dependencies: - path-key "^3.1.0" - shebang-command "^2.0.0" - which "^2.0.1" - -eastasianwidth@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/eastasianwidth/-/eastasianwidth-0.2.0.tgz#696ce2ec0aa0e6ea93a397ffcf24aa7840c827cb" - integrity sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA== - -elliptic@6.6.1: - version "6.6.1" - resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.6.1.tgz#3b8ffb02670bf69e382c7f65bf524c97c5405c06" - integrity sha512-RaddvvMatK2LJHqFJ+YA4WysVN5Ita9E35botqIYspQ4TkRAlCicdzKOjlyv/1Za5RyTNn7di//eEV0uTAfe3g== - dependencies: - bn.js "^4.11.9" - brorand "^1.1.0" - hash.js "^1.0.0" - hmac-drbg "^1.0.1" - inherits "^2.0.4" - minimalistic-assert "^1.0.1" - minimalistic-crypto-utils "^1.0.1" - -emoji-regex@^8.0.0: - version "8.0.0" - resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" - integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== - -emoji-regex@^9.2.2: - version "9.2.2" - resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-9.2.2.tgz#840c8803b0d8047f4ff0cf963176b32d4ef3ed72" - integrity sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg== +diff-sequences@^29.6.3: + version "29.6.3" + resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-29.6.3.tgz#4deaf894d11407c51efc8418012f9e70b84ea921" + integrity sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q== + +dotenv@^16.6.1: + version "16.6.1" + resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.6.1.tgz#773f0e69527a8315c7285d5ee73c4459d20a8020" + integrity sha512-uBq4egWHTcTt33a72vpSG0z3HnPuIl6NqYcTrKEg2azoEyl2hpW0zqlxysq2pK9HlDIHyHyakeYaYnSAwd8bow== + +escape-string-regexp@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz#a30304e99daa32e23b2fd20f51babd07cffca344" + integrity sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w== eth-chains@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/eth-chains/-/eth-chains-1.0.0.tgz#1386496ee1aa231a4d050fde6a87fe36741ecb83" integrity sha512-SnJrJPSr5I3rKpW6RZT/qhX8qbmE5bsMeeHoRWBXkvbifudfi3YLKHXZMdLsg+Yv+PP8oqSyPxOvQxKwjNVqmQ== -ethers@^5.7.2: - version "5.8.0" - resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.8.0.tgz#97858dc4d4c74afce83ea7562fe9493cedb4d377" - integrity sha512-DUq+7fHrCg1aPDFCHx6UIPb3nmt2XMpM7Y/g2gLhsl3lIBqeAfOJIl1qEvRf2uq3BiKxmh6Fh5pfp2ieyek7Kg== - dependencies: - "@ethersproject/abi" "5.8.0" - "@ethersproject/abstract-provider" "5.8.0" - "@ethersproject/abstract-signer" "5.8.0" - "@ethersproject/address" "5.8.0" - "@ethersproject/base64" "5.8.0" - "@ethersproject/basex" "5.8.0" - "@ethersproject/bignumber" "5.8.0" - "@ethersproject/bytes" "5.8.0" - "@ethersproject/constants" "5.8.0" - "@ethersproject/contracts" "5.8.0" - "@ethersproject/hash" "5.8.0" - "@ethersproject/hdnode" "5.8.0" - "@ethersproject/json-wallets" "5.8.0" - "@ethersproject/keccak256" "5.8.0" - "@ethersproject/logger" "5.8.0" - "@ethersproject/networks" "5.8.0" - "@ethersproject/pbkdf2" "5.8.0" - "@ethersproject/properties" "5.8.0" - "@ethersproject/providers" "5.8.0" - "@ethersproject/random" "5.8.0" - "@ethersproject/rlp" "5.8.0" - "@ethersproject/sha2" "5.8.0" - "@ethersproject/signing-key" "5.8.0" - "@ethersproject/solidity" "5.8.0" - "@ethersproject/strings" "5.8.0" - "@ethersproject/transactions" "5.8.0" - "@ethersproject/units" "5.8.0" - "@ethersproject/wallet" "5.8.0" - "@ethersproject/web" "5.8.0" - "@ethersproject/wordlists" "5.8.0" - -foreground-child@^3.3.1: - version "3.3.1" - resolved "https://registry.yarnpkg.com/foreground-child/-/foreground-child-3.3.1.tgz#32e8e9ed1b68a3497befb9ac2b6adf92a638576f" - integrity sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw== - dependencies: - cross-spawn "^7.0.6" - signal-exit "^4.0.1" - -glob@^11.0.0: - version "11.0.3" - resolved "https://registry.yarnpkg.com/glob/-/glob-11.0.3.tgz#9d8087e6d72ddb3c4707b1d2778f80ea3eaefcd6" - integrity sha512-2Nim7dha1KVkaiF4q6Dj+ngPPMdfvLJEOpZk/jKiUAkqKebpGAWQXAq9z1xu9HKu5lWfqw/FASuccEjyznjPaA== - dependencies: - foreground-child "^3.3.1" - jackspeak "^4.1.1" - minimatch "^10.0.3" - minipass "^7.1.2" - package-json-from-dist "^1.0.0" - path-scurry "^2.0.0" - -hash.js@1.1.7, hash.js@^1.0.0, hash.js@^1.0.3: - version "1.1.7" - resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.7.tgz#0babca538e8d4ee4a0f8988d68866537a003cf42" - integrity sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA== - dependencies: - inherits "^2.0.3" - minimalistic-assert "^1.0.1" - -hmac-drbg@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1" - integrity sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg== - dependencies: - hash.js "^1.0.3" - minimalistic-assert "^1.0.0" - minimalistic-crypto-utils "^1.0.1" - -inherits@^2.0.3, inherits@^2.0.4: - version "2.0.4" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" - integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== - -is-fullwidth-code-point@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" - integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== - -isexe@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" - integrity sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw== - -jackspeak@^4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/jackspeak/-/jackspeak-4.1.1.tgz#96876030f450502047fc7e8c7fcf8ce8124e43ae" - integrity sha512-zptv57P3GpL+O0I7VdMJNBZCu+BPHVQUk55Ft8/QCJjTVxrnJHuVuX/0Bl2A6/+2oyR/ZMEuFKwmzqqZ/U5nPQ== - dependencies: - "@isaacs/cliui" "^8.0.2" - -js-sha3@0.8.0: - version "0.8.0" - resolved "https://registry.yarnpkg.com/js-sha3/-/js-sha3-0.8.0.tgz#b9b7a5da73afad7dedd0f8c463954cbde6818840" - integrity sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q== +ethers@^6.17.0: + version "6.17.0" + resolved "https://registry.yarnpkg.com/ethers/-/ethers-6.17.0.tgz#ad85ee1fc45fe2d95cb1e21c4e3ff9f7f1b093cc" + integrity sha512-BpyrpIPJ3ydEVow8zGaz1DuPS7YU8DcWxuBnY9a0UA/lvAPwrMr+EPXsfrul628SRaekPNeIM4UFh/91GWZang== + dependencies: + "@adraffy/ens-normalize" "1.11.1" + "@noble/curves" "1.2.0" + "@noble/hashes" "1.3.2" + "@types/node" "22.7.5" + aes-js "4.0.0-beta.5" + tslib "2.7.0" + ws "8.21.0" + +expect@^29.0.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/expect/-/expect-29.7.0.tgz#578874590dcb3214514084c08115d8aee61e11bc" + integrity sha512-2Zks0hf1VLFYI1kbh0I5jP3KHHyCHpkfyHBzsSXRFgl/Bg9mWYfMW8oD+PdMPlEwy5HNsR9JutYy6pMeOh61nw== + dependencies: + "@jest/expect-utils" "^29.7.0" + jest-get-type "^29.6.3" + jest-matcher-utils "^29.7.0" + jest-message-util "^29.7.0" + jest-util "^29.7.0" + +fill-range@^7.1.1: + version "7.1.1" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.1.1.tgz#44265d3cac07e3ea7dc247516380643754a05292" + integrity sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg== + dependencies: + to-regex-range "^5.0.1" + +glob@^13.0.3: + version "13.0.6" + resolved "https://registry.yarnpkg.com/glob/-/glob-13.0.6.tgz#078666566a425147ccacfbd2e332deb66a2be71d" + integrity sha512-Wjlyrolmm8uDpm/ogGyXZXb1Z+Ca2B8NbJwqBVg0axK9GbBeoS7yGV6vjXnYdGm6X53iehEuxxbyiKp8QmN4Vw== + dependencies: + minimatch "^10.2.2" + minipass "^7.1.3" + path-scurry "^2.0.2" + +graceful-fs@^4.2.9: + version "4.2.11" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" + integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== + +has-flag@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" + integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== + +is-number@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" + integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== + +jest-diff@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-29.7.0.tgz#017934a66ebb7ecf6f205e84699be10afd70458a" + integrity sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw== + dependencies: + chalk "^4.0.0" + diff-sequences "^29.6.3" + jest-get-type "^29.6.3" + pretty-format "^29.7.0" + +jest-get-type@^29.6.3: + version "29.6.3" + resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-29.6.3.tgz#36f499fdcea197c1045a127319c0481723908fd1" + integrity sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw== + +jest-matcher-utils@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-29.7.0.tgz#ae8fec79ff249fd592ce80e3ee474e83a6c44f12" + integrity sha512-sBkD+Xi9DtcChsI3L3u0+N0opgPYnCRPtGcQYrgXmR+hmt/fYfWAL0xRXYU8eWOdfuLgBe0YCW3AFtnRLagq/g== + dependencies: + chalk "^4.0.0" + jest-diff "^29.7.0" + jest-get-type "^29.6.3" + pretty-format "^29.7.0" + +jest-message-util@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-29.7.0.tgz#8bc392e204e95dfe7564abbe72a404e28e51f7f3" + integrity sha512-GBEV4GRADeP+qtB2+6u61stea8mGcOT4mCtrYISZwfu9/ISHFJ/5zOMXYbpBE9RsS5+Gb63DW4FgmnKJ79Kf6w== + dependencies: + "@babel/code-frame" "^7.12.13" + "@jest/types" "^29.6.3" + "@types/stack-utils" "^2.0.0" + chalk "^4.0.0" + graceful-fs "^4.2.9" + micromatch "^4.0.4" + pretty-format "^29.7.0" + slash "^3.0.0" + stack-utils "^2.0.3" + +jest-util@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-29.7.0.tgz#23c2b62bfb22be82b44de98055802ff3710fc0bc" + integrity sha512-z6EbKajIpqGKU56y5KBUgy1dt1ihhQJgWzUlZHArA/+X2ad7Cb5iF+AK1EWVL/Bo7Rz9uurpqw6SiBCefUbCGA== + dependencies: + "@jest/types" "^29.6.3" + "@types/node" "*" + chalk "^4.0.0" + ci-info "^3.2.0" + graceful-fs "^4.2.9" + picomatch "^2.2.3" + +js-tokens@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" + integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== lru-cache@^11.0.0: - version "11.1.0" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-11.1.0.tgz#afafb060607108132dbc1cf8ae661afb69486117" - integrity sha512-QIXZUBJUx+2zHUdQujWejBkcD9+cs94tLn0+YL8UrCh+D5sCXZ4c7LaEH48pNwRY3MLDgqUFyhlCyjJPf1WP0A== - -minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7" - integrity sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A== + version "11.5.1" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-11.5.1.tgz#f3daa3540847b9737ebc02499ddb36765e54db4a" + integrity sha512-RPimw/7aMdv2oqRrxKwvZXcPfwBrn/JZ2xYcY9Hus/6LaS3VOAKVWKWgNLCFSiOm1ESXinjsDlidVU7JlnCN2A== -minimalistic-crypto-utils@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" - integrity sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg== +micromatch@^4.0.4: + version "4.0.8" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.8.tgz#d66fa18f3a47076789320b9b1af32bd86d9fa202" + integrity sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA== + dependencies: + braces "^3.0.3" + picomatch "^2.3.1" -minimatch@^10.0.3: - version "10.0.3" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-10.0.3.tgz#cf7a0314a16c4d9ab73a7730a0e8e3c3502d47aa" - integrity sha512-IPZ167aShDZZUMdRk66cyQAW3qr0WzbHkPdMYa8bzZhlHhO3jALbKdxcaak7W9FfT2rZNpQuUu4Od7ILEpXSaw== +minimatch@^10.2.2: + version "10.2.5" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-10.2.5.tgz#bd48687a0be38ed2961399105600f832095861d1" + integrity sha512-MULkVLfKGYDFYejP07QOurDLLQpcjk7Fw+7jXS2R2czRQzR56yHRveU5NDJEOviH+hETZKSkIk5c+T23GjFUMg== dependencies: - "@isaacs/brace-expansion" "^5.0.0" + brace-expansion "^5.0.5" -minipass@^7.1.2: - version "7.1.2" - resolved "https://registry.yarnpkg.com/minipass/-/minipass-7.1.2.tgz#93a9626ce5e5e66bd4db86849e7515e92340a707" - integrity sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw== +minipass@^7.1.2, minipass@^7.1.3: + version "7.1.3" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-7.1.3.tgz#79389b4eb1bb2d003a9bba87d492f2bd37bdc65b" + integrity sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A== -package-json-from-dist@^1.0.0: +package-json-from-dist@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz#4f1471a010827a86f94cfd9b0727e36d267de505" integrity sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw== -path-key@^3.1.0: - version "3.1.1" - resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" - integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== - -path-scurry@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/path-scurry/-/path-scurry-2.0.0.tgz#9f052289f23ad8bf9397a2a0425e7b8615c58580" - integrity sha512-ypGJsmGtdXUOeM5u93TyeIEfEhM6s+ljAhrk5vAvSx8uyY/02OvrZnA0YNGUrPXfpJMgI1ODd3nwz8Npx4O4cg== +path-scurry@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/path-scurry/-/path-scurry-2.0.2.tgz#6be0d0ee02a10d9e0de7a98bae65e182c9061f85" + integrity sha512-3O/iVVsJAPsOnpwWIeD+d6z/7PmqApyQePUtCndjatj/9I5LylHvt5qluFaBT3I5h3r1ejfR056c+FCv+NnNXg== dependencies: lru-cache "^11.0.0" minipass "^7.1.2" -rimraf@^6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-6.0.1.tgz#ffb8ad8844dd60332ab15f52bc104bc3ed71ea4e" - integrity sha512-9dkvaxAsk/xNXSJzMgFqqMCuFgt2+KsOFek3TMLfo8NCPfWpBmqwyNn5Y+NX56QUYfCtsyhF3ayiboEoUmJk/A== - dependencies: - glob "^11.0.0" - package-json-from-dist "^1.0.0" - -scrypt-js@3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/scrypt-js/-/scrypt-js-3.0.1.tgz#d314a57c2aef69d1ad98a138a21fe9eafa9ee312" - integrity sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA== - -shebang-command@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" - integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA== - dependencies: - shebang-regex "^3.0.0" - -shebang-regex@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" - integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== - -signal-exit@^4.0.1: - version "4.1.0" - resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-4.1.0.tgz#952188c1cbd546070e2dd20d0f41c0ae0530cb04" - integrity sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw== +picocolors@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.1.1.tgz#3d321af3eab939b083c8f929a1d12cda81c26b6b" + integrity sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA== -"string-width-cjs@npm:string-width@^4.2.0": - version "4.2.3" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" - integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.1" +picomatch@^2.2.3, picomatch@^2.3.1: + version "2.3.2" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.2.tgz#5a942915e26b372dc0f0e6753149a16e6b1c5601" + integrity sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA== -string-width@^4.1.0: - version "4.2.3" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" - integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== +pretty-format@^29.0.0, pretty-format@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-29.7.0.tgz#ca42c758310f365bfa71a0bda0a807160b776812" + integrity sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ== dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.1" + "@jest/schemas" "^29.6.3" + ansi-styles "^5.0.0" + react-is "^18.0.0" -string-width@^5.0.1, string-width@^5.1.2: - version "5.1.2" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-5.1.2.tgz#14f8daec6d81e7221d2a357e668cab73bdbca794" - integrity sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA== - dependencies: - eastasianwidth "^0.2.0" - emoji-regex "^9.2.2" - strip-ansi "^7.0.1" +react-is@^18.0.0: + version "18.3.1" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.3.1.tgz#e83557dc12eae63a99e003a46388b1dcbb44db7e" + integrity sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg== -"strip-ansi-cjs@npm:strip-ansi@^6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" - integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== +rimraf@^6.1.2: + version "6.1.3" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-6.1.3.tgz#afbee236b3bd2be331d4e7ce4493bac1718981af" + integrity sha512-LKg+Cr2ZF61fkcaK1UdkH2yEBBKnYjTyWzTJT6KNPcSPaiT7HSdhtMXQuN5wkTX0Xu72KQ1l8S42rlmexS2hSA== dependencies: - ansi-regex "^5.0.1" + glob "^13.0.3" + package-json-from-dist "^1.0.1" -strip-ansi@^6.0.0, strip-ansi@^6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" - integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== - dependencies: - ansi-regex "^5.0.1" +slash@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" + integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== -strip-ansi@^7.0.1: - version "7.1.0" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45" - integrity sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ== +stack-utils@^2.0.3: + version "2.0.6" + resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-2.0.6.tgz#aaf0748169c02fc33c8232abccf933f54a1cc34f" + integrity sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ== dependencies: - ansi-regex "^6.0.1" + escape-string-regexp "^2.0.0" -which@^2.0.1: - version "2.0.2" - resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" - integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== +supports-color@^7.1.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" + integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== dependencies: - isexe "^2.0.0" + has-flag "^4.0.0" -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" - integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== - dependencies: - ansi-styles "^4.0.0" - string-width "^4.1.0" - strip-ansi "^6.0.0" - -wrap-ansi@^8.1.0: - version "8.1.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214" - integrity sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ== - dependencies: - ansi-styles "^6.1.0" - string-width "^5.0.1" - strip-ansi "^7.0.1" - -ws@8.18.0: - version "8.18.0" - resolved "https://registry.yarnpkg.com/ws/-/ws-8.18.0.tgz#0d7505a6eafe2b0e712d232b42279f53bc289bbc" - integrity sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw== +to-regex-range@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" + integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== + dependencies: + is-number "^7.0.0" + +tslib@2.7.0: + version "2.7.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.7.0.tgz#d9b40c5c40ab59e8738f297df3087bf1a2690c01" + integrity sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA== + +typescript@5.9.3: + version "5.9.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.9.3.tgz#5b4f59e15310ab17a216f5d6cf53ee476ede670f" + integrity sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw== + +undici-types@~6.19.2: + version "6.19.8" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.19.8.tgz#35111c9d1437ab83a7cdc0abae2f26d88eda0a02" + integrity sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw== + +undici-types@~8.3.0: + version "8.3.0" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-8.3.0.tgz#44e9fc9f3244648cdea35e4f9bb2d681e9410809" + integrity sha512-j375ScV60dom+YkPFIfTLcOiPxkN/buHz5GobjLhixFuANaNs3C9l4GmrWqejgXWJ7BbJcFYpTEUkS1Ge8bpZQ== + +ws@8.21.0: + version "8.21.0" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.21.0.tgz#012e413fc07429945121b0c153158c4343086951" + integrity sha512-Vsp28b7DRcimFQvrqu2Wek3z1iYxDCWqHYB8Qsnk/S4RfaCQzPGPyBNuVjJV3cd6UiKtUtp6sNM77gWvzcCH+g== diff --git a/packages/sysweb3-sentry/.gitignore b/packages/sysweb3-sentry/.gitignore new file mode 100644 index 00000000..9f9370dd --- /dev/null +++ b/packages/sysweb3-sentry/.gitignore @@ -0,0 +1,4 @@ +node_modules/ +dist/ +coverage/ +!package-lock.json diff --git a/packages/sysweb3-sentry/INTERFACE.md b/packages/sysweb3-sentry/INTERFACE.md new file mode 100644 index 00000000..96dd4798 --- /dev/null +++ b/packages/sysweb3-sentry/INTERFACE.md @@ -0,0 +1,211 @@ +# Sentry transaction SDK interface (v1) + +Package: `@sidhujag/sysweb3-sentry`. Operator secrets remain local to Pali and +never appear in a dapp request/response. There is no arbitrary-hash signing API. + +```ts +type SentryScheme = 'bls-basic' | 'slh-dsa-shake-128s'; +type SentryEra = 'legacy-v3' | 'pq-v4'; +interface SentryChain { + genesisHash: string; // 32-byte display-order hex, trusted configured chain + era: SentryEra; // resolved by wallet from activation state, NOT the dapp +} +interface SentryNodeState { + proTxHash: string; // 32-byte display-order hex + operatorPublicKey: string; // 48-byte BLS or 32-byte SLH public key hex + service: string; // IPv4:port or [IPv6]:port + operatorPayoutScript: string; // exact script hex, empty means unset + nevmAddress: string; // 0x + 20 bytes, or '' (explicitly unregistered) + globalKeyVersion?: number; // required positive uint32 for pq-v4 + pqRecord?: SentryPQRecord; // REQUIRED full trusted Core record for pq-v4 + collateralOutpoint?: {txid: string; vout: number}; // wallet requires/protects it +} +interface SentryPQRecord { + version: number; // currently 1 + profile: number; // currently 1 (SLH-DSA-SHAKE-128s) + keyVersion: number; + publicKey: string; + childKeyCommitmentHex: string; // exact canonical 80-byte Core commitment + activatedHeight: number; +} +interface SentryOperationRequest { + version: 1; + operation: 'updateService'; + chain: SentryChain; + transactionHex: string; // complete funded raw tx, empty input scripts/witness +} +interface SentryReviewContext { + chain: SentryChain; // wallet's independent chain/era observation + node: SentryNodeState; // wallet's independent registered node observation + previousTransactions: string[]; // exact raw funding prevtxs, fetched or hash checked + maxFeeSatoshis: string; // wallet/user fee safety bound, decimal integer +} +interface SentryOperationReview { + operation: 'updateService'; + scheme: SentryScheme; + chain: SentryChain; + proTxHash: string; + changes: { + service: { previous: string; next: string }; + operatorPayoutScript: { previous: string; next: string }; + nevmAddress: { previous: string; next: string }; + }; + feeSatoshis: string; + inputCount: number; + outputs: { valueSatoshis: string; scriptHex: string; isPayload: boolean }[]; + authorizationHash: string; // digest bytes hex, NOT reversed display hash +} +interface SentryOperationResponse { + version: 1; + operation: 'updateService'; + transactionHex: string; // operator-authorized; fee-input signer still signs afterwards + operatorPublicKey: string; + authorizationHash: string; +} +``` + +Exports (synchronous codec/review, asynchronous crypto to allow lazy loading): + +* `getSentryCapabilities()` returns supported operations/eras/key schemes. +* `validateSentryOperationRequest(unknown): SentryOperationRequest` strictly validates + the public envelope and rejects extra fields (especially secret-key fields). +* `reviewSentryOperation(request, context): SentryOperationReview` independently + decodes actual transaction bytes, validates OP_RETURN payload and ordered + input hash, binds configured genesis/era/registered operator, verifies funding + txids/output amounts, enforces fee bound. UI should show changes plus fee payer + and all non-payload outputs. Empty next NEVM address explicitly means removal. + It accepts already fee-signed transactions for final backend verification; + `signSentryOperation` rejects signed inputs so authorization order is enforced. +* `inspectSentryOperation(request)` returns syntactic `{proTxHash,inputTxids, + globalKeyVersion?}` only for choosing wallet-owned chain queries. It is not a + trusted review or authorization result. +* `matchesSentryTransactionIntent(prepared, signed)` checks all original bytes + except the inserted operator signature and fee-input script/witness. Relays + MUST use this (or an equivalent comparison) in addition to signature checks: + Core's operator authorization intentionally does not commit fee outputs. +* `importSentryOperatorKey(scheme, secretKeyHex): Promise` + returns `{scheme, publicKey, secretKey}`; secret is a normalized hex string for + LOCAL encrypted storage only. BLS key is 32 bytes; SLH key is the exact 64-byte + Core key (or 48-byte generation seed via separate `deriveSentryOperatorKey`). +* `deriveSentryOperatorKey(scheme, seedHex): Promise` generates + deterministic keys from exactly 32 BLS seed bytes or 48 SLH seed bytes, not + SA SHA2 keys. BLS matches Core `BasicSchemeMPL::KeyGen` using its exact + HKDF-SHA256 salt, IKM suffix, expansion and scalar-field reduction; it does + not treat the seed as a private scalar or use Noble's 48-byte entropy API. +* `signSentryOperation(request, context, importedKey): Promise` + repeats review, verifies key matches registration, locally signs the decoded + protocol authorization and inserts the signature without changing other bytes. +* `verifySentryOperation(request, context): Promise` verifies the on-chain + operator authorization in an already-authorized transaction. +* `buildSentryServiceUpdate({chain,node,service?,operatorPayoutScript?,nevmAddress?,inputs,outputs,lockTime?})` + constructs a deterministic unsigned funded transaction. Omitted fields preserve + independently observed state; `nevmAddress: ''` is explicit unregister. + Inputs are `{txid,vout,sequence?}`; outputs `{valueSatoshis,scriptHex}` exclude + the payload, which is appended with zero value. Funding is caller's responsibility. +* `decodeSentryTransaction(rawHex)` returns exact inputs, outputs, lockTime, + txid, weight and virtualSize for public fee-signing integration. +* `estimateSentrySignedVBytes(request)` returns conservative P2PKH/P2WPKH + funding size. Allzero operator signature placeholders already occupy the + exact final 96/7856 bytes. Arbitrary multisig needs its own estimator. + +The package uses ESM for the current noble libraries. Import it statically in a +bundler/ESM app or with `await import('@sidhujag/sysweb3-sentry')` in CommonJS. + +The public methods recommended for Pali are `sys_getSentryCapabilities` and +`sys_signSentryOperation`; the latter accepts only the public request above. +The wallet obtains `context` independently, then obtains local key material from +its vault. A provider may be the fee payer; do not represent the returned operator +authorization as a fully UTXO-signed/broadcastable transaction. + +The service API supports current legacy update-service payload v3 and PQ PR +#609 payload v4. Historical service payloads v1/v2 fail closed. Other management +operations use the separate role-aware API below, never a service signature. + +## Role-aware management API + +Separate `SentryManagementRequest` keeps the public envelope shape above but +supports `register`, `updateRegistrar`, `revoke`, `registerOperator` and +`rotateOperator`. Exact exported TypeScript contracts are in +`src/management-types.ts`; these are additive and do not change the service API. + +* Builders: `buildSentryRegistration`, `buildSentryRegistrarUpdate`, + `buildSentryRevocation`, `buildSentryOperatorUpdate`. +* Discovery/validation: `validateSentryManagementRequest`, + `inspectSentryManagementOperation` (syntactic only), + `getSentryManagementCapabilities`. +* Review/verification: `reviewSentryManagementOperation`, + `verifySentryManagementOperation`, `matchesSentryManagementIntent`. +* Local-only keys: `importSentryAuthorityKey(role, scheme, secretKeyHex)`; + `role` is owner/operator/collateral/voting, `scheme` adds secp256k1. +* Local signing: `signSentryManagementOperation(request, context, key, + authorizationId?)`. It fills exactly one required authorization slot. Its + response has `complete: false` until all role-specific signatures verify. + The fee-payer signs inputs only after `complete: true`. + +Review returns all public fields and an `authorizations` list with ID, role, +scheme, key identity, digest, FIPS context and whether signature bytes are +present. `signed` is a presence marker, not a substitute for verification. +Wallet UI chooses local keys by role and must not offer an operator key as an +owner/collateral key. Never forward the key object into a dapp message. + +The context additionally supplies trusted network address prefixes for the +Core collateral signing message, a complete node owner/voting state, or the +exact external collateral transaction and chain's required collateral value. +Only trusted Core preparation capabilities may set `allowOwnerPreparation` or +`allowOperatorPreparation`; these are not public request fields. + +PQ operator `candidate` includes the exact canonical child-tree commitment and +must have activation height zero. The node's separate setup process generates +the corresponding WOTS tree; this transaction codec does not invent one. + +## Legacy governance funding votes + +`SentryGovernanceVoteRequest` is a separate typed protocol, not a transaction or +an arbitrary hash-signing method. Its exact fields are: + +```ts +{ + version: 1, + chain: { genesisHash, era: 'legacy-v3' }, + proposalHash, + signal: 'funding', + outcome: 'yes' | 'no' | 'abstain', + timestamp, // safe integer Unix seconds + nodes: [{ proTxHash, collateralOutpoint: { txid, vout } }] // 1–20 unique nodes +} +``` + +Hashes are nonzero lowercase 32-byte hex. The collateral index is a nonnegative +signed-32-bit integer, matching `voteraw`'s RPC parser. Unknown fields, duplicate +node IDs/outpoints and unsupported schemes/eras/signals fail closed. + +`reviewSentryGovernanceVote(request, context)` requires independently resolved +`chain`, `now`, `proposalHash` and exactly matching `nodes`, each with the current +`votingKeyId` and `valid: true`. Optional `proposal: {name, url?}` is display +metadata only. New wallet approvals require the timestamp within one hour of +`now` in either direction. This is stricter than Core, which only checks the +future bound. + +`signSentryGovernanceVote(request, context, proTxHash, key)` returns one +`SentryGovernanceVoteResponse`: `{proTxHash, collateralOutpoint, voteSig, +signatureHash, voteHash}`. The local key must have role `voting`, scheme +`secp256k1` and match the verified registration. `voteSig` is canonical base64 of +the 65-byte recoverable signature. `signatureHash` and `voteHash` use Core's +display byte order; `governanceVoteDigest(fields)` returns raw signing-digest +hex. `governanceVoteHash(fields)` returns the display-order identity hash. +`verifySentryGovernanceVote(request, context, response)` checks the same binding +and rejects high-S/noncanonical signatures. + +`await governanceVotingKeyIds(compressedPublicKey)` returns `{compressed, +uncompressed}` Hash160 identities for legacy voting registration discovery. +The stored key's public representation remains compressed. Signing chooses the +Core compact header for the actual registered encoding (27–30 uncompressed, +31–34 compressed); this does not alter transaction-management key semantics. + +Core's signature hashes the serialized collateral outpoint, proposal hash, +outcome, signal and timestamp. **It does not include network/genesis or +proTxHash.** Wallets must independently enforce the trusted envelope and verify +fresh registration context; the signature itself cannot provide those bindings. +`GetHash` orders signal before outcome, unlike `GetSignatureHash`. Native Core +golden vectors cover both orders, all three outcomes and both key encodings. +They exercise signature verification, not live governance-object acceptance. diff --git a/packages/sysweb3-sentry/README.md b/packages/sysweb3-sentry/README.md new file mode 100644 index 00000000..bd5abded --- /dev/null +++ b/packages/sysweb3-sentry/README.md @@ -0,0 +1,116 @@ +# sysweb3-sentry + +Strict transaction review and local operator signing for Syscoin Sentry nodes. +The package implements service/NEVM updates for active BLS payload v3 +and the PQ payload v4 in Core PR #609, plus external-collateral registration, +owner/registrar updates, revocation and PQ global-operator enrollment/rotation. +It is not an Ethereum signer, a smart-account +SLH signer, a node-hosting client, or an arbitrary-hash signing interface. + +See [INTERFACE.md](./INTERFACE.md) for the frozen public envelope. Secrets are +accepted only by local key-import/signing functions, never by request validation. +The wallet must fetch the registered node, funding transactions, genesis and +activation state through its own configured RPC. It must not trust a dapp's +replacement RPC, registered key record, fee claim or human-readable review text. + +## Flow + +1. The dapp builds an unsigned funded `updateService` request. All payload changes + are represented by transaction bytes. Omitted builder fields preserve current + state; an empty NEVM address explicitly unregisters it. +2. The wallet runs `reviewSentryOperation` against independently fetched context, + displays changed fields and **all** fee outputs, and selects its local operator + key. Registered collateral must be excluded from funding and supplied to the + context guard. +3. After user approval, the wallet calls `signSentryOperation`. It refuses signed + fee inputs and existing operator signatures; it changes only the reserved + operator-signature bytes. It returns no secrets. +4. The separate fee payer signs the resulting transaction inputs. That signature + must come last because the operator signature lives in an OP_RETURN output. +5. The relay verifies the operator signature again, checks the current chain/key + state and broadcasts the exact fully authorized bytes. After confirmation it + rereads the node's registered NEVM address. + +`verifySentryOperation` and `reviewSentryOperation` accept the final fee-signed +transaction. They authenticate funding contents by matching exact previous +transaction hashes, but cannot decide whether an input is currently spent or +whether a node is banned/unconfirmed. Those are fresh RPC/mempool checks. + +## Protocol boundaries + +* Current non-PQ Core: `dd1457d89a5906288d0c0813a157413e79f75f6d`. +* PQ candidate: `fa24600369c7afbe338afc09d07c840d21c2e205` (PR #609). +* The current BLS v3 digest is Core's SHA256d payload serialization with the + signature omitted. Inputs hash is SHA256d of **ordered serialized prevouts**. + BLS uses BasicSchemeMPL's exact `..._NUL_` DST, not POP/AUG or historical v1. +* PQ service signing uses the exact raw `SYS_PQ_PROVIDER_SERVICE_V1` transcript, + full registered `GlobalKeyRecord` hash, chain genesis and fixed network endpoint. + The same domain is the FIPS-205 context. Its scheme is **SHAKE-128s**, not the + Pali smart-account SHA2 scheme. +* Both eras encode the provider payload as a zero-value canonical OP_RETURN + output on transaction version 81; there is no Dash-style appended extraPayload. +* Current Core policy requires IPv4 service addresses. The internal endpoint + codec understands IPv6/CJDNS for transcript portability, but service requests + using those families are rejected until Core policy supports them. + Core's reset current-state values `0.0.0.0:0` and `[::]:0` are recognized after + operator rotation; restoring service requires an explicit valid replacement endpoint. + The reset value is never accepted as a proposed service address. +* Genesis is cryptographically in the PQ transcript. BLS consensus has no genesis + field; wallet network binding does not retroactively alter that legacy digest. +* PQ is a pinned candidate adapter, not evidence that an unactivated chain accepts + PQ transactions. A wallet must resolve era from activation and not a user toggle. + +The ESM package uses pinned noble cryptography modules. BLS and SLH code load only +inside asynchronous signing/import operations. SLH import recomputes its public +root just like Core; it can be CPU-intensive, so wallets should invoke it in an +isolated worker without blocking the approval UI. + +## Build and tests + +Repository development and CI use Node.js 26.12.1, pinned in the root `.nvmrc`. +The package's Node consumer requirement remains the range in its `engines` field. + +`npm ci && npm test` inside this package. Tests use synthetic funding fixtures and +public test keys; no live wallet, RPC, secret or broadcast is involved. + +## Other management operations + +`getSentryManagementCapabilities` advertises separate management APIs. The +builders `buildSentryRegistration`, `buildSentryRegistrarUpdate`, +`buildSentryRevocation` and `buildSentryOperatorUpdate` return strict public +requests consumed by `reviewSentryManagementOperation` and +`signSentryManagementOperation`. These are not operator-service signatures: + +* Existing collateral registration requires the collateral's secp256k1 key and, + for PQ registration, a separate new-owner proof. +* Registrar changes use the currently enrolled owner: legacy ECDSA or PQ + SHAKE-128s. Owner replacement additionally requires the new owner's proof. + An enrolled PQ owner cannot fall back to ECDSA. +* Revocation uses the currently registered operator, BLS or PQ as appropriate. +* Initial PQ operator enrollment/recovery requires owner authorization plus + proof by the new operator key. Active rotation uses the current operator. + All version, generation, chain and child-commitment bindings follow Core. + +`SentryAuthorityKey` retains explicit owner/operator/collateral/voting roles. +The new operator's 80-byte child-tree commitment must come from the operator's +key-setup process: this package does not generate or manage the WOTS tree and +must not pretend a random commitment is usable. The transaction approves its +exact public commitment; node setup must retain the corresponding secrets. +External collateral is supported; creating and spending a new collateral +output is intentionally a distinct normal wallet transaction. + +Pre-activation owner/operator enrollment is accepted only when the wallet's +independently resolved Core context enables the corresponding preparation +capability. A dapp cannot activate this policy with a request flag. Pure voting +messages, governance actions and private node operation are separate protocols. + +## Governance voting + +The typed governance helpers support batches of up to 20 legacy proposal-funding +votes. Wallets review fresh, independently fetched node/voting-key and proposal +context before signing with local secp256k1 voting keys. Both historical +uncompressed and compressed voting identities are supported without changing +the stored key representation. PQ governance signing remains disabled. + +See `INTERFACE.md` for exact request/response contracts and the distinction +between Core's signed fields and the wallet-enforced network/node envelope. diff --git a/packages/sysweb3-sentry/package-lock.json b/packages/sysweb3-sentry/package-lock.json new file mode 100644 index 00000000..ab1df03b --- /dev/null +++ b/packages/sysweb3-sentry/package-lock.json @@ -0,0 +1,104 @@ +{ + "name": "@sidhujag/sysweb3-sentry", + "version": "0.1.2", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "@sidhujag/sysweb3-sentry", + "version": "0.1.2", + "license": "MIT", + "dependencies": { + "@noble/curves": "2.4.0", + "@noble/hashes": "2.4.0", + "@noble/post-quantum": "0.7.1", + "@scure/base": "2.4.0" + }, + "devDependencies": { + "typescript": "5.9.3" + }, + "engines": { + "node": ">=20.19.0" + } + }, + "node_modules/@noble/ciphers": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/@noble/ciphers/-/ciphers-2.4.0.tgz", + "integrity": "sha512-AnjFn0Jv92laAkvMrghlFZq4qQCIN/4DxFV/eooqtC2YTjB7kBeLMS2T9KJX4Dn+ZVXLOwK0lSgqDtx9gvxtiw==", + "license": "MIT", + "engines": { + "node": ">= 20.19.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@noble/curves": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-2.4.0.tgz", + "integrity": "sha512-P4/62zrgfH33CneE3Dn4WhJVA22YUU0eR51wKIan4NVRvwsA0YnPTwWGpNbpuacSujmSFLvyzpyuR30+fbq2Ew==", + "license": "MIT", + "dependencies": { + "@noble/hashes": "2.4.0" + }, + "engines": { + "node": ">= 20.19.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@noble/hashes": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-2.4.0.tgz", + "integrity": "sha512-X5XaVWZIBCT7HHZGm5I7ZQXDwLG+bGXuSrMQAW+7Zvl87h1kmc1ZB1VSRJcpUfoUrGQp4Fkoxm5kZ+Ms+aW+eA==", + "license": "MIT", + "engines": { + "node": ">= 20.19.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@noble/post-quantum": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/@noble/post-quantum/-/post-quantum-0.7.1.tgz", + "integrity": "sha512-+P9981IiAnVh+rmcubozzVwrEy3XsN/tMhTnvsjV9VDaYpOnNCqWqKo2FLWxbu92YHfjGIlE5XnW175UK+ln+Q==", + "license": "MIT", + "dependencies": { + "@noble/ciphers": "2.4.0", + "@noble/curves": "2.4.0", + "@noble/hashes": "2.4.0" + }, + "engines": { + "node": ">= 20.19.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@scure/base": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-2.4.0.tgz", + "integrity": "sha512-thZ1TuJwFwBblOhgsjDKvvGirBxNp+wSvY/DR6tJBJOTDhdAAcHJ8Vbr2eFnqaxeca4+t0i9KBf+uHYGWwZORg==", + "license": "MIT", + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/typescript": { + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + } + } +} diff --git a/packages/sysweb3-sentry/package.json b/packages/sysweb3-sentry/package.json new file mode 100644 index 00000000..6c3822c0 --- /dev/null +++ b/packages/sysweb3-sentry/package.json @@ -0,0 +1,42 @@ +{ + "name": "@sidhujag/sysweb3-sentry", + "version": "0.1.2", + "description": "Local operator authorization and canonical transaction codecs for Syscoin Sentry nodes", + "type": "module", + "sideEffects": false, + "main": "./dist/index.js", + "types": "./dist/index.d.ts", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "import": "./dist/index.js" + } + }, + "files": [ + "dist", + "INTERFACE.md", + "README.md" + ], + "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/syscoin/sysweb3.git" + }, + "engines": { + "node": ">=20.19.0" + }, + "scripts": { + "build": "tsc -p tsconfig.json", + "type-check": "tsc -p tsconfig.json --noEmit", + "test": "npm run build && node --test test/*.test.mjs" + }, + "dependencies": { + "@noble/curves": "2.4.0", + "@noble/hashes": "2.4.0", + "@noble/post-quantum": "0.7.1", + "@scure/base": "2.4.0" + }, + "devDependencies": { + "typescript": "5.9.3" + } +} diff --git a/packages/sysweb3-sentry/src/bytes.ts b/packages/sysweb3-sentry/src/bytes.ts new file mode 100644 index 00000000..efb9fc55 --- /dev/null +++ b/packages/sysweb3-sentry/src/bytes.ts @@ -0,0 +1,201 @@ +import { sha256 } from '@noble/hashes/sha2.js'; + +export const MAX_TX_BYTES = 100_000; +export const MAX_MONEY = 888_000_000n * 100_000_000n; + +export class SentryValidationError extends Error { + readonly code: string; + constructor(code: string, message: string) { + super(message); + this.name = 'SentryValidationError'; + this.code = code; + } +} + +export function fail(code: string, message: string): never { + throw new SentryValidationError(code, message); +} + +export function fromHex( + value: unknown, + name = 'hex', + length?: number +): Uint8Array { + if ( + typeof value !== 'string' || + value.length % 2 !== 0 || + !/^[0-9a-f]*$/i.test(value) || + value.length > MAX_TX_BYTES * 2 || + (length !== undefined && value.length !== length * 2) + ) { + fail( + 'INVALID_HEX', + `${name} must be canonical byte hex${ + length === undefined ? '' : ` (${length} bytes)` + }` + ); + } + const out = new Uint8Array(value.length / 2); + for (let i = 0; i < out.length; i++) + out[i] = parseInt(value.slice(i * 2, i * 2 + 2), 16); + return out; +} + +export function hex(bytes: Uint8Array): string { + let result = ''; + for (const value of bytes) result += value.toString(16).padStart(2, '0'); + return result; +} + +export function concat(...parts: Uint8Array[]): Uint8Array { + const out = new Uint8Array( + parts.reduce((size, part) => size + part.length, 0) + ); + let offset = 0; + for (const part of parts) { + out.set(part, offset); + offset += part.length; + } + return out; +} + +export function equal(a: Uint8Array, b: Uint8Array): boolean { + if (a.length !== b.length) return false; + let diff = 0; + for (let i = 0; i < a.length; i++) diff |= a[i] ^ b[i]; + return diff === 0; +} + +export function nonzero(bytes: Uint8Array): boolean { + return bytes.some((value) => value !== 0); +} +export function hash256(bytes: Uint8Array): Uint8Array { + return sha256(sha256(bytes)); +} +export function displayHash(bytes: Uint8Array): string { + return hex(bytes.slice().reverse()); +} +export function hashBytes(value: unknown, name = 'hash'): Uint8Array { + const bytes = fromHex(value, name, 32); + if (!nonzero(bytes)) fail('INVALID_HASH', `${name} cannot be zero`); + return bytes.reverse(); +} + +export function uint(value: unknown, bits: 8 | 16 | 32, name: string): number { + if ( + typeof value !== 'number' || + !Number.isSafeInteger(value) || + value < 0 || + value > 2 ** bits - 1 + ) { + fail('INVALID_INTEGER', `${name} must be an unsigned ${bits}-bit integer`); + } + return value; +} + +export function integerBytes( + value: number | bigint, + size: number, + bigEndian = false +): Uint8Array { + let remaining = BigInt(value); + if (remaining < 0n || remaining >= 1n << BigInt(size * 8)) + fail('INVALID_INTEGER', 'Integer out of range'); + const out = new Uint8Array(size); + for (let i = 0; i < size; i++) { + out[i] = Number(remaining & 255n); + remaining >>= 8n; + } + return bigEndian ? out.reverse() : out; +} + +export function compactSize(size: number): Uint8Array { + uint(size, 32, 'CompactSize'); + if (size < 253) return Uint8Array.of(size); + if (size <= 65535) return concat(Uint8Array.of(253), integerBytes(size, 2)); + return concat(Uint8Array.of(254), integerBytes(size, 4)); +} + +export function vector(bytes: Uint8Array): Uint8Array { + return concat(compactSize(bytes.length), bytes); +} + +export function amount(value: unknown, name: string): bigint { + if (typeof value !== 'string' || !/^(0|[1-9][0-9]{0,16})$/.test(value)) + fail('INVALID_AMOUNT', `${name} must be integer satoshis`); + const result = BigInt(value); + if (result > MAX_MONEY) fail('INVALID_AMOUNT', `${name} exceeds MAX_MONEY`); + return result; +} + +export function object( + value: unknown, + keys: readonly string[], + name: string +): Record { + if ( + !value || + typeof value !== 'object' || + Array.isArray(value) || + (Object.getPrototypeOf(value) !== Object.prototype && + Object.getPrototypeOf(value) !== null) + ) { + fail('INVALID_REQUEST', `${name} must be a plain object`); + } + const result = value as Record; + for (const key of Object.keys(result)) + if (!keys.includes(key)) + fail('INVALID_REQUEST', `Unsupported ${name} field: ${key}`); + return result; +} + +export class Reader { + offset = 0; + constructor(readonly bytes: Uint8Array) {} + read(size: number): Uint8Array { + if ( + !Number.isSafeInteger(size) || + size < 0 || + size > this.bytes.length - this.offset + ) + fail('TRUNCATED', 'Truncated serialization'); + const out = this.bytes.slice(this.offset, this.offset + size); + this.offset += size; + return out; + } + integer(size: number, bigEndian = false): bigint { + const bytes = this.read(size); + let value = 0n; + for (const byte of bigEndian ? bytes : bytes.reverse()) + value = (value << 8n) | BigInt(byte); + return value; + } + number(size: number, bigEndian = false): number { + const value = this.integer(size, bigEndian); + if (value > BigInt(Number.MAX_SAFE_INTEGER)) + fail('INVALID_INTEGER', 'Integer too large'); + return Number(value); + } + size(limit: number): number { + const prefix = this.number(1); + const value = + prefix < 253 + ? prefix + : this.number(prefix === 253 ? 2 : prefix === 254 ? 4 : 8); + if ( + (prefix === 253 && value < 253) || + (prefix === 254 && value <= 65535) || + (prefix === 255 && value <= 0xffffffff) + ) + fail('NON_CANONICAL', 'Non-canonical CompactSize'); + if (value > limit) fail('LIMIT', 'Serialization exceeds bounded size'); + return value; + } + vector(limit: number): Uint8Array { + return this.read(this.size(limit)); + } + end(): void { + if (this.offset !== this.bytes.length) + fail('TRAILING_DATA', 'Unexpected trailing bytes'); + } +} diff --git a/packages/sysweb3-sentry/src/codec.ts b/packages/sysweb3-sentry/src/codec.ts new file mode 100644 index 00000000..d795bdf6 --- /dev/null +++ b/packages/sysweb3-sentry/src/codec.ts @@ -0,0 +1,534 @@ +import { + MAX_MONEY, + MAX_TX_BYTES, + Reader, + amount, + compactSize, + concat, + displayHash, + equal, + fail, + fromHex, + hash256, + hashBytes, + hex, + integerBytes, + nonzero, + uint, + vector, +} from './bytes.js'; + +import type { + BuildSentryServiceUpdate, + DecodedSentryTransaction, + SentryChain, + SentryNodeState, + SentryOperationRequest, +} from './types.js'; + +export const UPDATE_SERVICE_TX_VERSION = 81; +export const LEGACY_SERVICE_VERSION = 3; +export const PQ_SERVICE_VERSION = 4; +export const BLS_SIGNATURE_SIZE = 96; +export const PQ_SIGNATURE_SIZE = 7856; +const MAX_INPUTS_OUTPUTS = 256; +const MAX_SCRIPT = 10_000; + +export interface ServiceAddress { + bytes: Uint8Array; + text: string; + network: 1 | 2 | 5; + address: Uint8Array; + port: number; +} +export interface ServicePayload { + version: 3 | 4; + proTxHash: string; + service: ServiceAddress; + payoutScript: Uint8Array; + inputsHash: Uint8Array; + globalKeyVersion?: number; + signature: Uint8Array; + nevmAddress: string; +} + +function ipv4(text: string): Uint8Array | undefined { + if (!/^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$/.test(text)) return undefined; + const parts = text.split('.'); + if (parts.some((p) => Number(p) > 255 || String(Number(p)) !== p)) + return undefined; + return Uint8Array.from(parts.map(Number)); +} + +function ipv6(text: string): Uint8Array | undefined { + if ( + !/^[a-fA-F0-9:]+$/.test(text) || + !text.includes(':') || + text.split('::').length > 2 + ) + return undefined; + const sides = text.split('::'); + const left = sides[0] ? sides[0].split(':') : []; + const right = sides.length === 2 && sides[1] ? sides[1].split(':') : []; + if ([...left, ...right].some((s) => !/^[a-fA-F0-9]{1,4}$/.test(s))) + return undefined; + const gap = 8 - left.length - right.length; + if ((sides.length === 1 && gap !== 0) || (sides.length === 2 && gap < 1)) + return undefined; + const groups = [...left, ...Array(gap).fill('0'), ...right]; + return concat( + ...groups.map((group) => integerBytes(parseInt(group, 16), 2, true)) + ); +} + +export function serviceFromBytes(bytes: Uint8Array): ServiceAddress { + if (bytes.length !== 18) + fail('INVALID_SERVICE', 'Service must contain 16 address bytes and port'); + const port = Number(new Reader(bytes.slice(16)).integer(2, true)); + if (port === 0) fail('INVALID_SERVICE', 'Service port cannot be zero'); + const address = bytes.slice(0, 16); + const mapped = + address.slice(0, 10).every((b) => b === 0) && + address[10] === 255 && + address[11] === 255; + if (mapped) { + const ip = address.slice(12); + if (!nonzero(ip)) + fail('INVALID_SERVICE', 'Service address cannot be unspecified'); + return { + bytes, + text: `${Array.from(ip).join('.')}:${port}`, + network: 1, + address: ip, + port, + }; + } + if (!nonzero(address)) + fail('INVALID_SERVICE', 'Service address cannot be unspecified'); + const groups = Array.from({ length: 8 }, (_, i) => + ((address[i * 2] << 8) | address[i * 2 + 1]).toString(16) + ); + // Fixed-width identity is independent of how a user compresses IPv6 text. + return { + bytes, + text: `[${groups.join(':')}]:${port}`, + network: address[0] === 0xfc ? 5 : 2, + address, + port, + }; +} + +export function parseService(value: unknown): ServiceAddress { + if (typeof value !== 'string' || value.length > 80) + fail('INVALID_SERVICE', 'Service must be an IP address and port'); + const match = /^(?:\[([^\]]+)\]|([^:]+)):([0-9]{1,5})$/.exec(value); + if (!match) + fail('INVALID_SERVICE', 'Use IPv4:port or [IPv6]:port; DNS is not signed'); + const port = Number(match[3]); + if (port < 1 || port > 65535 || String(port) !== match[3]) + fail('INVALID_SERVICE', 'Invalid service port'); + const ip = match[1] ? ipv6(match[1]) : ipv4(match[2]); + if (!ip) fail('INVALID_SERVICE', 'Invalid IP service address'); + const encoded = + ip.length === 4 + ? concat(new Uint8Array(10), Uint8Array.of(255, 255), ip) + : ip; + return serviceFromBytes(concat(encoded, integerBytes(port, 2, true))); +} + +/** Core clears this current-state field after operator rotation. It is never a valid proposed service. */ +export function currentServiceText(value: unknown): string { + return value === '0.0.0.0:0' || value === '[::]:0' + ? value + : parseService(value).text; +} + +export function normalizeNEVM(value: unknown): string { + if (value === '') return ''; + if (typeof value !== 'string' || !/^0x[0-9a-fA-F]{40}$/.test(value)) + fail( + 'INVALID_NEVM', + 'NEVM must be 0x plus 20 bytes, or empty to unregister' + ); + return value.toLowerCase(); +} + +export function payloadBytes( + payload: ServicePayload, + hashing = false +): Uint8Array { + const prefix = concat( + integerBytes(payload.version, 2), + hashBytes(payload.proTxHash, 'proTxHash'), + payload.service.bytes, + vector(payload.payoutScript), + payload.inputsHash + ); + const auth = + payload.version === 4 + ? concat( + integerBytes(payload.globalKeyVersion!, 4), + ...(hashing ? [] : [payload.signature]) + ) + : hashing + ? new Uint8Array() + : payload.signature; + return concat( + prefix, + auth, + vector( + payload.nevmAddress === '' + ? new Uint8Array() + : fromHex(payload.nevmAddress.slice(2), 'NEVM', 20) + ) + ); +} + +export function decodePayload(bytes: Uint8Array): ServicePayload { + const reader = new Reader(bytes); + const version = reader.number(2); + if (version !== 3 && version !== 4) + fail( + 'UNSUPPORTED_ERA', + 'Only current legacy-v3 and PQ-v4 service updates are supported' + ); + const proTxHash = displayHash(reader.read(32)); + hashBytes(proTxHash, 'proTxHash'); + const service = serviceFromBytes(reader.read(18)); + const payoutScript = reader.vector(MAX_SCRIPT); + const inputsHash = reader.read(32); + if (!nonzero(inputsHash)) + fail('INVALID_INPUTS_HASH', 'Inputs hash cannot be zero'); + const globalKeyVersion = version === 4 ? reader.number(4) : undefined; + if (globalKeyVersion === 0) + fail('INVALID_KEY_VERSION', 'PQ key version cannot be zero'); + const signature = reader.read( + version === 4 ? PQ_SIGNATURE_SIZE : BLS_SIGNATURE_SIZE + ); + const nevm = reader.vector(20); + if (nevm.length !== 0 && nevm.length !== 20) + fail('INVALID_NEVM', 'NEVM must be exactly 20 bytes'); + reader.end(); + const result: ServicePayload = { + version, + proTxHash, + service, + payoutScript, + inputsHash, + globalKeyVersion, + signature, + nevmAddress: nevm.length ? `0x${hex(nevm)}` : '', + }; + if (!equal(payloadBytes(result), bytes)) + fail('NON_CANONICAL', 'Payload does not reserialize canonically'); + return result; +} + +export function opReturn(payload: Uint8Array): Uint8Array { + const push = + payload.length < 76 + ? Uint8Array.of(payload.length) + : payload.length <= 255 + ? concat(Uint8Array.of(76), integerBytes(payload.length, 1)) + : payload.length <= 65535 + ? concat(Uint8Array.of(77), integerBytes(payload.length, 2)) + : concat(Uint8Array.of(78), integerBytes(payload.length, 4)); + return concat(Uint8Array.of(0x6a), push, payload); +} + +export function extractOpReturn(script: Uint8Array): Uint8Array { + const reader = new Reader(script); + if (reader.number(1) !== 0x6a) + fail('INVALID_PAYLOAD', 'Payload output must be OP_RETURN'); + const push = reader.number(1); + const length = + push < 76 + ? push + : push === 76 + ? reader.number(1) + : push === 77 + ? reader.number(2) + : push === 78 + ? reader.number(4) + : -1; + if ( + length < 0 || + length > MAX_TX_BYTES || + (push === 76 && length < 76) || + (push === 77 && length <= 255) || + (push === 78 && length <= 65535) + ) + fail('NON_CANONICAL', 'Non-canonical OP_RETURN push'); + const payload = reader.read(length); + reader.end(); + return payload; +} + +export function encodeTransaction( + tx: Pick< + DecodedSentryTransaction, + 'version' | 'inputs' | 'outputs' | 'lockTime' + >, + includeWitness = true +): Uint8Array { + const witness = + includeWitness && tx.inputs.some((input) => input.witness.length); + const encoded = concat( + integerBytes(tx.version, 4), + ...(witness ? [Uint8Array.of(0, 1)] : []), + compactSize(tx.inputs.length), + ...tx.inputs.map((input) => + concat( + fromHex(input.txid, 'input txid', 32).reverse(), + integerBytes(input.vout, 4), + vector(fromHex(input.scriptHex, 'input script')), + integerBytes(input.sequence, 4) + ) + ), + compactSize(tx.outputs.length), + ...tx.outputs.map((output) => + concat( + integerBytes(amount(output.valueSatoshis, 'output value'), 8), + vector(fromHex(output.scriptHex, 'output script')) + ) + ), + ...(witness + ? tx.inputs.map((input) => + concat( + compactSize(input.witness.length), + ...input.witness.map((item) => + vector(fromHex(item, 'witness item')) + ) + ) + ) + : []), + integerBytes(tx.lockTime, 4) + ); + if (encoded.length > MAX_TX_BYTES) fail('LIMIT', 'Transaction is too large'); + return encoded; +} + +/** Strict general Bitcoin-style transaction decoder for funding and service transactions. */ +export function decodeSentryTransaction( + transactionHex: string +): DecodedSentryTransaction { + const bytes = fromHex(transactionHex, 'transaction'); + const reader = new Reader(bytes); + const version = reader.number(4); + let witness = false; + if (reader.bytes[reader.offset] === 0) { + reader.read(1); + if (reader.number(1) !== 1) + fail('INVALID_TRANSACTION', 'Unknown witness flag'); + witness = true; + } + const inputCount = reader.size(MAX_INPUTS_OUTPUTS); + if (!inputCount) fail('INVALID_TRANSACTION', 'Transaction has no inputs'); + const inputs: DecodedSentryTransaction['inputs'] = []; + for (let i = 0; i < inputCount; i++) { + inputs.push({ + txid: displayHash(reader.read(32)), + vout: reader.number(4), + scriptHex: hex(reader.vector(MAX_SCRIPT)), + sequence: reader.number(4), + witness: [], + }); + } + const outputCount = reader.size(MAX_INPUTS_OUTPUTS); + if (!outputCount) fail('INVALID_TRANSACTION', 'Transaction has no outputs'); + const outputs: DecodedSentryTransaction['outputs'] = []; + let total = 0n; + for (let i = 0; i < outputCount; i++) { + const value = reader.integer(8); + total += value; + if (value > MAX_MONEY || total > MAX_MONEY) + fail('INVALID_AMOUNT', 'Transaction output value exceeds MAX_MONEY'); + outputs.push({ + valueSatoshis: value.toString(), + scriptHex: hex(reader.vector(MAX_TX_BYTES)), + }); + } + if (witness) { + for (const input of inputs) { + const count = reader.size(100); + for (let i = 0; i < count; i++) + input.witness.push(hex(reader.vector(MAX_SCRIPT))); + } + if (!inputs.some((input) => input.witness.length)) + fail('NON_CANONICAL', 'Superfluous witness encoding'); + } + const lockTime = reader.number(4); + reader.end(); + const stripped = encodeTransaction( + { version, inputs, outputs, lockTime }, + false + ); + const weight = stripped.length * 3 + bytes.length; + return { + version, + inputs, + outputs, + lockTime, + txid: displayHash(hash256(stripped)), + weight, + virtualSize: Math.ceil(weight / 4), + }; +} + +export function orderedInputsHash(tx: DecodedSentryTransaction): Uint8Array { + return hash256( + concat( + ...tx.inputs.map((input) => + concat(hashBytes(input.txid, 'input txid'), integerBytes(input.vout, 4)) + ) + ) + ); +} + +export function locateServicePayload(tx: DecodedSentryTransaction): { + payload: ServicePayload; + outputIndex: number; +} { + if (tx.version !== UPDATE_SERVICE_TX_VERSION) + fail('UNSUPPORTED_OPERATION', 'Transaction is not a service update'); + const indices = tx.outputs.flatMap((output, i) => + fromHex(output.scriptHex)[0] === 0x6a ? [i] : [] + ); + if (indices.length !== 1) + fail('INVALID_PAYLOAD', 'Exactly one OP_RETURN output is required'); + const outputIndex = indices[0]; + if (tx.outputs[outputIndex].valueSatoshis !== '0') + fail('INVALID_PAYLOAD', 'Payload output must have zero value'); + const payload = decodePayload( + extractOpReturn(fromHex(tx.outputs[outputIndex].scriptHex)) + ); + // Both pinned Core versions' CheckService currently require IPv4, even + // though the PQ transcript format can encode additional future families. + if (payload.service.network !== 1) + fail( + 'UNSUPPORTED_SERVICE', + 'The current Core service-update policy requires IPv4' + ); + if (!equal(payload.inputsHash, orderedInputsHash(tx))) + fail( + 'INPUTS_MISMATCH', + 'Payload inputsHash does not match ordered funding inputs' + ); + return { payload, outputIndex }; +} + +function validateChain(chain: SentryChain): void { + hashBytes(chain.genesisHash, 'genesisHash'); + if (chain.era !== 'legacy-v3' && chain.era !== 'pq-v4') + fail('UNSUPPORTED_ERA', 'Unsupported Sentry era'); +} + +export function validateNode(node: SentryNodeState, chain: SentryChain): void { + validateChain(chain); + hashBytes(node.proTxHash, 'proTxHash'); + currentServiceText(node.service); + const payout = fromHex(node.operatorPayoutScript, 'operator payout script'); + if (payout.length > MAX_SCRIPT) + fail('LIMIT', 'Operator payout script too large'); + normalizeNEVM(node.nevmAddress); + if (node.collateralOutpoint) { + hashBytes(node.collateralOutpoint.txid, 'collateral txid'); + uint(node.collateralOutpoint.vout, 32, 'collateral vout'); + } + const pk = fromHex( + node.operatorPublicKey, + 'operator public key', + chain.era === 'pq-v4' ? 32 : 48 + ); + if (!nonzero(pk)) + fail('INVALID_PUBLIC_KEY', 'Operator public key cannot be zero'); + if ( + chain.era === 'pq-v4' && + (uint(node.globalKeyVersion, 32, 'globalKeyVersion') === 0 || + !node.pqRecord) + ) { + fail('INVALID_KEY_VERSION', 'PQ registered key record is required'); + } +} + +export function buildSentryServiceUpdate( + options: BuildSentryServiceUpdate +): SentryOperationRequest { + validateNode(options.node, options.chain); + if ( + !Array.isArray(options.inputs) || + !options.inputs.length || + options.inputs.length > MAX_INPUTS_OUTPUTS || + !Array.isArray(options.outputs) || + options.outputs.length >= MAX_INPUTS_OUTPUTS + ) + fail('LIMIT', 'Invalid funding inputs/outputs'); + const inputs = options.inputs.map((input) => ({ + txid: displayHash(hashBytes(input.txid, 'input txid')), + vout: uint(input.vout, 32, 'input vout'), + sequence: uint(input.sequence ?? 0xfffffffe, 32, 'sequence'), + scriptHex: '', + witness: [], + })); + const outputs = options.outputs.map((output) => { + const script = fromHex(output.scriptHex, 'output script'); + if (script.length > MAX_SCRIPT || script[0] === 0x6a) + fail('INVALID_OUTPUT', 'Funding outputs cannot contain an OP_RETURN'); + return { + valueSatoshis: amount(output.valueSatoshis, 'output value').toString(), + scriptHex: hex(script), + }; + }); + const tx = { + version: UPDATE_SERVICE_TX_VERSION, + inputs, + outputs, + lockTime: uint(options.lockTime ?? 0, 32, 'lockTime'), + }; + const version = + options.chain.era === 'pq-v4' ? PQ_SERVICE_VERSION : LEGACY_SERVICE_VERSION; + const payload: ServicePayload = { + version, + proTxHash: options.node.proTxHash.toLowerCase(), + service: parseService(options.service ?? options.node.service), + payoutScript: fromHex( + options.operatorPayoutScript ?? options.node.operatorPayoutScript, + 'operator payout' + ), + nevmAddress: normalizeNEVM(options.nevmAddress ?? options.node.nevmAddress), + inputsHash: orderedInputsHash({ + ...tx, + txid: '', + weight: 0, + virtualSize: 0, + }), + globalKeyVersion: version === 4 ? options.node.globalKeyVersion : undefined, + signature: new Uint8Array( + version === 4 ? PQ_SIGNATURE_SIZE : BLS_SIGNATURE_SIZE + ), + }; + outputs.push({ + valueSatoshis: '0', + scriptHex: hex(opReturn(payloadBytes(payload))), + }); + const result: SentryOperationRequest = { + version: 1, + operation: 'updateService', + chain: { ...options.chain }, + transactionHex: hex(encodeTransaction(tx)), + }; + // Runs all decoder bounds and money-range checks before exposing bytes. + locateServicePayload(decodeSentryTransaction(result.transactionHex)); + return result; +} + +/** Conservative fee sizing: assumes every funding input is legacy 148-byte P2PKH. */ +export function estimateSentrySignedVBytes( + request: SentryOperationRequest +): number { + const tx = decodeSentryTransaction(request.transactionHex); + locateServicePayload(tx); + // Each unsigned input already contains 41 bytes. Legacy scripts add at most + // 108 bytes; P2WPKH is smaller. Arbitrary multisig must use its own estimator. + return tx.virtualSize + tx.inputs.length * 108; +} diff --git a/packages/sysweb3-sentry/src/governance.ts b/packages/sysweb3-sentry/src/governance.ts new file mode 100644 index 00000000..00e1f8c9 --- /dev/null +++ b/packages/sysweb3-sentry/src/governance.ts @@ -0,0 +1,418 @@ +import { base64 } from '@scure/base'; + +import { + concat, + displayHash, + fail, + fromHex, + hash256, + hashBytes, + hex, + integerBytes, + object, + uint, +} from './bytes.js'; +import { sentryKeyId } from './management.js'; + +import type { SentryAuthorityKey } from './management-types.js'; + +export const MAX_GOVERNANCE_VOTE_NODES = 20; +export interface SentryGovernanceOutpoint { + txid: string; + vout: number; +} +export interface SentryGovernanceVoteNode { + proTxHash: string; + collateralOutpoint: SentryGovernanceOutpoint; +} +export interface SentryGovernanceVoteFields { + proposalHash: string; + signal: 'funding'; + outcome: 'yes' | 'no' | 'abstain'; + timestamp: number; + collateralOutpoint: SentryGovernanceOutpoint; +} +export interface SentryGovernanceVoteRequest + extends Omit { + version: 1; + chain: { genesisHash: string; era: 'legacy-v3' }; + nodes: SentryGovernanceVoteNode[]; +} +export interface SentryGovernanceVotingNode extends SentryGovernanceVoteNode { + /** Current voting Hash160 from independently resolved node registration. */ + votingKeyId: string; + valid: true; +} +export interface SentryGovernanceVoteContext { + chain: { genesisHash: string; era: 'legacy-v3' | 'pq-v4' }; + /** Independently resolved proposal and current time, not caller assertions. */ + proposalHash: string; + /** Presentation metadata from the independently resolved proposal; not signed. */ + proposal?: { name: string; url?: string }; + now: number; + nodes: SentryGovernanceVotingNode[]; +} +export interface SentryGovernanceVoteReview { + request: SentryGovernanceVoteRequest; + proposal?: { name: string; url?: string }; + nodes: Array< + SentryGovernanceVotingNode & { digest: string; voteHash: string } + >; +} +export interface SentryGovernanceVoteResponse extends SentryGovernanceVoteNode { + /** Canonical base64 of Core's 65-byte recoverable ECDSA signature. */ + voteSig: string; + /** Core uint256 display order; digest() returns the raw signing bytes instead. */ + signatureHash: string; + voteHash: string; +} + +function canonicalHash(value: unknown, name: string, size = 32): string { + if ( + typeof value !== 'string' || + !new RegExp(`^[0-9a-f]{${size * 2}}$`).test(value) || + /^0+$/.test(value) + ) + fail('INVALID_HASH', `${name} must be nonzero lowercase ${size}-byte hex`); + return value; +} +function safeTime(value: unknown, name: string): number { + if ( + typeof value !== 'number' || + !Number.isSafeInteger(value) || + value < 0 || + Object.is(value, -0) + ) + fail( + 'INVALID_TIME', + `${name} must be a nonnegative safe integer of Unix seconds` + ); + return value; +} +function outpoint(value: unknown): SentryGovernanceOutpoint { + const p = object(value, ['txid', 'vout'], 'collateral outpoint'); + const vout = uint(p.vout, 32, 'collateral output index'); + // voteraw parses this RPC parameter as a signed C++ int before constructing COutPoint. + if (vout > 0x7fffffff || Object.is(vout, -0)) + fail('INVALID_OUTPOINT', 'Collateral index exceeds voteraw range'); + return { txid: canonicalHash(p.txid, 'collateral txid'), vout }; +} +function node( + value: unknown, + trusted = false +): SentryGovernanceVotingNode | SentryGovernanceVoteNode { + const n = object( + value, + trusted + ? ['proTxHash', 'collateralOutpoint', 'votingKeyId', 'valid'] + : ['proTxHash', 'collateralOutpoint'], + 'voting node' + ); + const result = { + proTxHash: canonicalHash(n.proTxHash, 'proTxHash'), + collateralOutpoint: outpoint(n.collateralOutpoint), + }; + if (!trusted) return result; + if (n.valid !== true) + fail('INVALID_NODE', 'Voting node is not currently valid'); + return { + ...result, + votingKeyId: canonicalHash(n.votingKeyId, 'voting key ID', 20), + valid: true, + }; +} +function chain(value: unknown, legacyOnly = true) { + const c = object(value, ['genesisHash', 'era'], 'chain'); + if (c.era !== 'legacy-v3' && (legacyOnly || c.era !== 'pq-v4')) + fail( + 'UNSUPPORTED_ERA', + 'Pali governance voting currently supports legacy secp256k1 only' + ); + return { + genesisHash: canonicalHash(c.genesisHash, 'genesis hash'), + era: c.era as 'legacy-v3' | 'pq-v4', + }; +} +function fields(value: unknown): SentryGovernanceVoteFields { + const f = object( + value, + ['proposalHash', 'signal', 'outcome', 'timestamp', 'collateralOutpoint'], + 'vote fields' + ); + if (f.signal !== 'funding') + fail( + 'UNSUPPORTED_SIGNAL', + 'Only proposal funding votes use the voting key' + ); + if (f.outcome !== 'yes' && f.outcome !== 'no' && f.outcome !== 'abstain') + fail('INVALID_OUTCOME', 'Unsupported vote outcome'); + return { + proposalHash: canonicalHash(f.proposalHash, 'proposal hash'), + signal: 'funding', + outcome: f.outcome, + timestamp: safeTime(f.timestamp, 'timestamp'), + collateralOutpoint: outpoint(f.collateralOutpoint), + }; +} +export function validateSentryGovernanceVoteRequest( + value: unknown +): SentryGovernanceVoteRequest { + const r = object( + value, + [ + 'version', + 'chain', + 'proposalHash', + 'signal', + 'outcome', + 'timestamp', + 'nodes', + ], + 'governance vote' + ); + if (r.version !== 1) + fail('UNSUPPORTED_VERSION', 'Unsupported governance vote request'); + const c = chain(r.chain); + if ( + !Array.isArray(r.nodes) || + r.nodes.length < 1 || + r.nodes.length > MAX_GOVERNANCE_VOTE_NODES + ) + fail('INVALID_BATCH', 'Select between 1 and 20 voting nodes'); + const nodes = r.nodes.map((n) => node(n) as SentryGovernanceVoteNode); + const ids = new Set(nodes.map((n) => n.proTxHash)); + const outputs = new Set( + nodes.map( + (n) => `${n.collateralOutpoint.txid}:${n.collateralOutpoint.vout}` + ) + ); + if (ids.size !== nodes.length || outputs.size !== nodes.length) + fail('DUPLICATE_NODE', 'Duplicate voting node or collateral'); + const f = fields({ + proposalHash: r.proposalHash, + signal: r.signal, + outcome: r.outcome, + timestamp: r.timestamp, + collateralOutpoint: nodes[0].collateralOutpoint, + }); + return { + version: 1, + chain: { ...c, era: 'legacy-v3' }, + proposalHash: f.proposalHash, + signal: f.signal, + outcome: f.outcome, + timestamp: f.timestamp, + nodes, + }; +} +function preimage(value: unknown, identity = false): Uint8Array { + const f = fields(value); + const outcome = { yes: 1, no: 2, abstain: 3 }[f.outcome]; + return concat( + hashBytes(f.collateralOutpoint.txid), + integerBytes(f.collateralOutpoint.vout, 4), + hashBytes(f.proposalHash), + integerBytes(identity ? 1 : outcome, 4), + integerBytes(identity ? outcome : 1, 4), + integerBytes(f.timestamp, 8) + ); +} +/** Raw digest bytes for GetSignatureHash: outcome then signal, unlike GetHash. */ +export function governanceVoteDigest( + value: SentryGovernanceVoteFields +): string { + return hex(hash256(preimage(value))); +} +/** Core's vote identity uses signal then outcome, in uint256 display order. */ +export function governanceVoteHash(value: SentryGovernanceVoteFields): string { + return displayHash(hash256(preimage(value, true))); +} +/** Legacy funding votes support either registered public-key encoding. */ +export async function governanceVotingKeyIds( + compressedPublicKey: string +): Promise<{ compressed: string; uncompressed: string }> { + if (!/^(02|03)[0-9a-f]{64}$/.test(compressedPublicKey)) + fail('INVALID_KEY', 'Expected a canonical compressed voting public key'); + const { secp256k1 } = await import('@noble/curves/secp256k1.js'); + const point = secp256k1.Point.fromBytes(fromHex(compressedPublicKey)); + return { + compressed: sentryKeyId(compressedPublicKey), + uncompressed: sentryKeyId(hex(point.toBytes(false))), + }; +} +export function reviewSentryGovernanceVote( + value: unknown, + context: SentryGovernanceVoteContext +): SentryGovernanceVoteReview { + const request = validateSentryGovernanceVoteRequest(value); + const c = chain(context.chain, false); + if ( + c.era !== request.chain.era || + c.genesisHash !== request.chain.genesisHash + ) + fail('CHAIN_MISMATCH', 'Voting network or protocol changed'); + if ( + canonicalHash(context.proposalHash, 'verified proposal hash') !== + request.proposalHash + ) + fail('PROPOSAL_MISMATCH', 'Verified proposal differs'); + const now = safeTime(context.now, 'current time'); + // Core rejects only future votes; new wallet approvals deliberately also + // refuse stale timestamps rather than authorizing replayable old drafts. + if (Math.abs(request.timestamp - now) > 3600) + fail( + 'STALE_VOTE', + 'New vote approval must be within one hour of current time' + ); + let proposal: SentryGovernanceVoteContext['proposal']; + if (context.proposal !== undefined) { + const p = object(context.proposal, ['name', 'url'], 'proposal metadata'); + if (typeof p.name !== 'string' || p.name.length < 1 || p.name.length > 256) + fail('INVALID_PROPOSAL', 'Invalid proposal name'); + if (p.url !== undefined) { + if (typeof p.url !== 'string' || p.url.length > 2048) + fail('INVALID_PROPOSAL', 'Invalid proposal URL'); + try { + if (!['https:', 'http:'].includes(new URL(p.url).protocol)) + throw new Error(); + } catch { + fail('INVALID_PROPOSAL', 'Invalid proposal URL'); + } + } + proposal = { + name: p.name, + ...(p.url === undefined ? {} : { url: p.url as string }), + }; + } + if ( + !Array.isArray(context.nodes) || + context.nodes.length !== request.nodes.length + ) + fail('NODE_MISMATCH', 'Every voting node requires verified context'); + const verified = context.nodes.map( + (n) => node(n, true) as SentryGovernanceVotingNode + ); + if (new Set(verified.map((n) => n.proTxHash)).size !== verified.length) + fail('DUPLICATE_NODE', 'Duplicate verified voting node'); + const nodes = request.nodes.map((n) => { + const v = verified.find((v) => v.proTxHash === n.proTxHash); + if ( + !v || + v.collateralOutpoint.txid !== n.collateralOutpoint.txid || + v.collateralOutpoint.vout !== n.collateralOutpoint.vout + ) + fail( + 'NODE_MISMATCH', + 'Voting collateral differs from current registration' + ); + const f = { + proposalHash: request.proposalHash, + signal: request.signal, + outcome: request.outcome, + timestamp: request.timestamp, + collateralOutpoint: n.collateralOutpoint, + }; + return { + ...v, + digest: governanceVoteDigest(f), + voteHash: governanceVoteHash(f), + }; + }); + return { request, ...(proposal ? { proposal } : {}), nodes }; +} +export async function signSentryGovernanceVote( + value: unknown, + context: SentryGovernanceVoteContext, + proTxHash: string, + key: SentryAuthorityKey +): Promise { + const review = reviewSentryGovernanceVote(value, context); + const n = review.nodes.find((n) => n.proTxHash === proTxHash); + if (!n) fail('NODE_MISMATCH', 'Selected voting node was not approved'); + if (key.role !== 'voting' || key.scheme !== 'secp256k1') + fail( + 'INVALID_KEY_ROLE', + 'Legacy governance requires a secp256k1 voting key' + ); + const secret = fromHex(key.secretKey, 'voting secret', 32); + try { + const { secp256k1 } = await import('@noble/curves/secp256k1.js'); + const publicKey = hex(secp256k1.getPublicKey(secret, true)); + const ids = await governanceVotingKeyIds(publicKey); + if ( + publicKey !== key.publicKey || + (ids.compressed !== n.votingKeyId && ids.uncompressed !== n.votingKeyId) + ) + fail('WRONG_KEY', 'Key does not match the verified voting registration'); + const signature = secp256k1.sign(fromHex(n.digest), secret, { + prehash: false, + format: 'recovered', + lowS: true, + }); + signature[0] += ids.compressed === n.votingKeyId ? 31 : 27; + return { + proTxHash: n.proTxHash, + collateralOutpoint: n.collateralOutpoint, + voteSig: base64.encode(signature), + signatureHash: displayHash(fromHex(n.digest)), + voteHash: n.voteHash, + }; + } finally { + secret.fill(0); + } +} +export async function verifySentryGovernanceVote( + value: unknown, + context: SentryGovernanceVoteContext, + response: SentryGovernanceVoteResponse +): Promise { + try { + const review = reviewSentryGovernanceVote(value, context); + const r = object( + response, + [ + 'proTxHash', + 'collateralOutpoint', + 'voteSig', + 'signatureHash', + 'voteHash', + ], + 'vote signature' + ); + const n = review.nodes.find((n) => n.proTxHash === r.proTxHash); + const p = outpoint(r.collateralOutpoint); + if ( + !n || + p.txid !== n.collateralOutpoint.txid || + p.vout !== n.collateralOutpoint.vout || + r.signatureHash !== displayHash(fromHex(n.digest)) || + r.voteHash !== n.voteHash || + typeof r.voteSig !== 'string' || + r.voteSig.length !== 88 + ) + return false; + const signature = base64.decode(r.voteSig); + if ( + base64.encode(signature) !== r.voteSig || + signature.length !== 65 || + signature[0] < 27 || + signature[0] > 34 + ) + return false; + const { secp256k1 } = await import('@noble/curves/secp256k1.js'); + if (secp256k1.Signature.fromBytes(signature.slice(1), 'compact').hasHighS()) + return false; + const compressed = signature[0] >= 31; + signature[0] -= compressed ? 31 : 27; + const recovered = secp256k1.recoverPublicKey(signature, fromHex(n.digest), { + prehash: false, + }); + return ( + sentryKeyId( + hex(secp256k1.Point.fromBytes(recovered).toBytes(compressed)) + ) === n.votingKeyId + ); + } catch { + return false; + } +} diff --git a/packages/sysweb3-sentry/src/index.ts b/packages/sysweb3-sentry/src/index.ts new file mode 100644 index 00000000..bb59955e --- /dev/null +++ b/packages/sysweb3-sentry/src/index.ts @@ -0,0 +1,42 @@ +export * from './types.js'; +export { SentryValidationError } from './bytes.js'; +export { + buildSentryServiceUpdate, + decodeSentryTransaction, + estimateSentrySignedVBytes, + BLS_SIGNATURE_SIZE, + PQ_SIGNATURE_SIZE, +} from './codec.js'; +export { + getSentryCapabilities, + inspectSentryOperation, + matchesSentryTransactionIntent, + reviewSentryOperation, + validateSentryOperationRequest, +} from './review.js'; +export { + deriveSentryOperatorKey, + importSentryOperatorKey, + signSentryOperation, + verifySentryOperation, +} from './signing.js'; +export * from './management-types.js'; +export * from './governance.js'; +export { + buildSentryRegistration, + buildSentryRegistrarUpdate, + buildSentryRevocation, + buildSentryOperatorUpdate, + validateSentryManagementRequest, + sentryKeyIdFromAddress, +} from './management-codec.js'; +export { + importSentryAuthorityKey, + sentryKeyId, + reviewSentryManagementOperation, + signSentryManagementOperation, + verifySentryManagementOperation, + matchesSentryManagementIntent, + inspectSentryManagementOperation, + getSentryManagementCapabilities, +} from './management.js'; diff --git a/packages/sysweb3-sentry/src/management-codec.ts b/packages/sysweb3-sentry/src/management-codec.ts new file mode 100644 index 00000000..ab588eb7 --- /dev/null +++ b/packages/sysweb3-sentry/src/management-codec.ts @@ -0,0 +1,707 @@ +import { bech32, bech32m, base58check } from '@scure/base'; +import { sha256 } from '@noble/hashes/sha2.js'; +import { + Reader, + amount, + concat, + displayHash, + fail, + fromHex, + hash256, + hashBytes, + hex, + integerBytes, + nonzero, + object, + uint, + vector, +} from './bytes.js'; +import { + BLS_SIGNATURE_SIZE, + PQ_SIGNATURE_SIZE, + type ServiceAddress, + decodeSentryTransaction, + encodeTransaction, + extractOpReturn, + opReturn, + parseService, + serviceFromBytes, +} from './codec.js'; +import type { + SentryChain, + SentryPQRecord, + SentryTxInput, + SentryTxOutput, +} from './types.js'; +import { serializePQRecord } from './review.js'; +import type { + BuildSentryRegistration, + BuildSentryRegistrarUpdate, + BuildSentryRevocation, + BuildSentryOperatorUpdate, + SentryManagementRequest, + SentryNetworkEncoding, +} from './management-types.js'; + +interface BasePayload { + kind: SentryManagementRequest['operation']; + version: 1 | 2 | 3; + inputsHash: Uint8Array; + primarySignature: Uint8Array; + ownerProof: Uint8Array; +} +export interface RegistrationPayload extends BasePayload { + kind: 'register'; + collateralTxid: string; + collateralVout: number; + service: ServiceAddress; + ownerKeyId: Uint8Array; + votingKeyId: Uint8Array; + operatorPublicKey: Uint8Array; + reward: number; + payoutScript: Uint8Array; + pqVotingPublicKey: Uint8Array; + pqOwnerPublicKey: Uint8Array; +} +export interface RegistrarPayload extends BasePayload { + kind: 'updateRegistrar'; + proTxHash: string; + votingKeyId: Uint8Array; + operatorPublicKey: Uint8Array; + payoutScript: Uint8Array; + pqVotingPublicKey: Uint8Array; + pqOwnerPublicKey: Uint8Array; + ownerKeyVersion: number; +} +export interface RevokePayload extends BasePayload { + kind: 'revoke'; + proTxHash: string; + reason: number; + globalKeyVersion: number; +} +export interface OperatorPayload extends BasePayload { + kind: 'registerOperator' | 'rotateOperator'; + proTxHash: string; + candidate: SentryPQRecord; + ownerKeyVersion: number; +} +export type ManagementPayload = + | RegistrationPayload + | RegistrarPayload + | RevokePayload + | OperatorPayload; +export const MANAGEMENT_TX_VERSION = { + register: 80, + updateRegistrar: 82, + revoke: 83, + registerOperator: 86, + rotateOperator: 86, +} as const; + +export function managementPayloadBytes( + p: ManagementPayload, + hashing = false +): Uint8Array { + const version = integerBytes(p.version, 2); + if (p.kind === 'registerOperator' || p.kind === 'rotateOperator') + return concat( + version, + Uint8Array.of(p.kind === 'registerOperator' ? 1 : 2), + hashBytes(p.proTxHash), + serializePQRecord(p.candidate, true), + p.inputsHash, + ...(p.version === 2 ? [integerBytes(p.ownerKeyVersion, 4)] : []), + ...(hashing ? [] : [p.ownerProof, p.primarySignature]) + ); + const signatures = hashing + ? new Uint8Array() + : p.kind === 'revoke' + ? p.primarySignature + : concat( + vector(p.primarySignature), + ...(p.version === 3 ? [p.ownerProof] : []) + ); + if (p.kind === 'register') + return concat( + version, + integerBytes(0, 2), + integerBytes(0, 2), + hashBytes(p.collateralTxid, 'collateral txid'), + integerBytes(p.collateralVout, 4), + p.service.bytes, + p.ownerKeyId, + ...(p.version === 2 ? [p.operatorPublicKey] : []), + p.votingKeyId, + integerBytes(p.reward, 2), + vector(p.payoutScript), + p.inputsHash, + ...(p.version === 3 ? [p.pqVotingPublicKey, p.pqOwnerPublicKey] : []), + signatures + ); + if (p.kind === 'updateRegistrar') + return concat( + version, + hashBytes(p.proTxHash, 'proTxHash'), + integerBytes(0, 2), + ...(p.version === 2 ? [p.operatorPublicKey] : []), + p.votingKeyId, + vector(p.payoutScript), + p.inputsHash, + ...(p.version === 3 + ? [ + p.pqVotingPublicKey, + p.pqOwnerPublicKey, + integerBytes(p.ownerKeyVersion, 4), + ] + : []), + signatures + ); + if (p.kind !== 'revoke') + fail('UNSUPPORTED_OPERATION', 'Unknown node payload'); + return concat( + version, + hashBytes(p.proTxHash, 'proTxHash'), + integerBytes(p.reason, 2), + p.inputsHash, + ...(p.version === 3 ? [integerBytes(p.globalKeyVersion, 4)] : []), + signatures + ); +} + +export function managementPayload( + txHex: string, + expected?: SentryManagementRequest['operation'] +): { payload: ManagementPayload; outputIndex: number } { + const tx = decodeSentryTransaction(txHex); + let kind = ( + Object.keys(MANAGEMENT_TX_VERSION) as Array< + SentryManagementRequest['operation'] + > + ).find((k) => MANAGEMENT_TX_VERSION[k] === tx.version); + if (!kind) + fail( + 'UNSUPPORTED_OPERATION', + 'Unexpected node management transaction type' + ); + const positions = tx.outputs.flatMap((o, i) => + o.scriptHex.startsWith('6a') ? [i] : [] + ); + if (positions.length !== 1 || tx.outputs[positions[0]].valueSatoshis !== '0') + fail('INVALID_PAYLOAD', 'A single zero-value node payload is required'); + const outputIndex = positions[0]; + const bytes = extractOpReturn(fromHex(tx.outputs[outputIndex].scriptHex)); + const r = new Reader(bytes), + version = r.number(2); + if (tx.version === 86) { + const operation = r.number(1); + kind = + operation === 1 + ? 'registerOperator' + : operation === 2 + ? 'rotateOperator' + : undefined; + if (!kind || (version !== 1 && version !== 2)) + fail('UNSUPPORTED_ERA', 'Unknown global-operator payload'); + } else if (version !== 2 && version !== 3) + fail( + 'UNSUPPORTED_ERA', + 'Only current legacy and PQ payloads are supported' + ); + if (expected && kind !== expected) + fail( + 'UNSUPPORTED_OPERATION', + 'Unexpected node management transaction type' + ); + const empty = new Uint8Array(); + let payload: ManagementPayload; + if (kind === 'registerOperator' || kind === 'rotateOperator') { + const proTxHash = displayHash(r.read(32)); + hashBytes(proTxHash); + const candidate = { + version: r.number(2), + profile: r.number(2), + keyVersion: r.number(4), + publicKey: hex(r.read(32)), + childKeyCommitmentHex: hex(r.read(80)), + activatedHeight: r.number(4), + }; + if (candidate.activatedHeight !== 0) + fail( + 'INVALID_CANDIDATE', + 'Operator candidate activation height must be zero' + ); + serializePQRecord(candidate, true); + const inputsHash = r.read(32), + ownerKeyVersion = version === 2 ? r.number(4) : 0; + const ownerProof = r.read(version === 2 ? PQ_SIGNATURE_SIZE : 65), + primarySignature = r.read(PQ_SIGNATURE_SIZE); + if ( + (kind === 'rotateOperator' && (version !== 1 || nonzero(ownerProof))) || + (version === 2 && ownerKeyVersion === 0) + ) + fail('INVALID_CANDIDATE', 'Invalid global-operator owner authorization'); + payload = { + kind, + version, + proTxHash, + candidate, + inputsHash, + ownerKeyVersion, + ownerProof, + primarySignature, + }; + } else if (kind === 'register') { + if (r.number(2) !== 0 || r.number(2) !== 0) + fail('INVALID_PAYLOAD', 'Unknown node type or mode'); + const collateralTxid = displayHash(r.read(32)); + hashBytes(collateralTxid, 'external collateral txid'); + const collateralVout = r.number(4), + service = serviceFromBytes(r.read(18)); + if (service.network !== 1) + fail('UNSUPPORTED_SERVICE', 'Current Core requires IPv4'); + const ownerKeyId = r.read(20), + operatorPublicKey = version === 2 ? r.read(48) : empty, + votingKeyId = r.read(20); + const reward = r.number(2), + payoutScript = r.vector(10000), + inputsHash = r.read(32); + const pqVotingPublicKey = version === 3 ? r.read(32) : empty, + pqOwnerPublicKey = version === 3 ? r.read(32) : empty; + const primarySignature = r.vector(65), + ownerProof = version === 3 ? r.read(PQ_SIGNATURE_SIZE) : empty; + if ( + reward > 10000 || + !nonzero(ownerKeyId) || + !nonzero(votingKeyId) || + primarySignature.length !== 65 || + (version === 2 && !nonzero(operatorPublicKey)) || + (version === 3 && + (!nonzero(pqVotingPublicKey) || !nonzero(pqOwnerPublicKey))) + ) + fail('INVALID_PAYLOAD', 'Invalid registration keys or reward'); + payload = { + kind, + version, + collateralTxid, + collateralVout, + service, + ownerKeyId, + operatorPublicKey, + votingKeyId, + reward, + payoutScript, + inputsHash, + pqVotingPublicKey, + pqOwnerPublicKey, + primarySignature, + ownerProof, + }; + } else if (kind === 'updateRegistrar') { + const proTxHash = displayHash(r.read(32)); + hashBytes(proTxHash, 'proTxHash'); + if (r.number(2) !== 0) fail('INVALID_PAYLOAD', 'Unknown registrar mode'); + const operatorPublicKey = version === 2 ? r.read(48) : empty, + votingKeyId = r.read(20), + payoutScript = r.vector(10000), + inputsHash = r.read(32); + const pqVotingPublicKey = version === 3 ? r.read(32) : empty, + pqOwnerPublicKey = version === 3 ? r.read(32) : empty; + const ownerKeyVersion = version === 3 ? r.number(4) : 0; + const primarySignature = r.vector(PQ_SIGNATURE_SIZE), + ownerProof = version === 3 ? r.read(PQ_SIGNATURE_SIZE) : empty; + if ( + (primarySignature.length !== 65 && + !(version === 3 && primarySignature.length === PQ_SIGNATURE_SIZE)) || + (version === 2 && (!nonzero(operatorPublicKey) || !nonzero(votingKeyId))) + ) + fail('INVALID_PAYLOAD', 'Invalid registrar key or signature size'); + payload = { + kind, + version, + proTxHash, + operatorPublicKey, + votingKeyId, + payoutScript, + inputsHash, + pqVotingPublicKey, + pqOwnerPublicKey, + ownerKeyVersion, + primarySignature, + ownerProof, + }; + } else { + const proTxHash = displayHash(r.read(32)); + hashBytes(proTxHash, 'proTxHash'); + const reason = r.number(2), + inputsHash = r.read(32), + globalKeyVersion = version === 3 ? r.number(4) : 0; + if (reason > 3 || (version === 3 && !globalKeyVersion)) + fail('INVALID_PAYLOAD', 'Invalid revocation reason/key version'); + payload = { + kind, + version, + proTxHash, + reason, + inputsHash, + globalKeyVersion, + primarySignature: r.read( + version === 3 ? PQ_SIGNATURE_SIZE : BLS_SIGNATURE_SIZE + ), + ownerProof: empty, + }; + } + r.end(); + const actualInputs = hash256( + concat( + ...tx.inputs.map((i) => + concat(hashBytes(i.txid), integerBytes(i.vout, 4)) + ) + ) + ); + if (hex(actualInputs) !== hex(payload.inputsHash)) + fail( + 'INPUTS_MISMATCH', + 'Management payload does not bind these exact ordered inputs' + ); + if (hex(managementPayloadBytes(payload)) !== hex(bytes)) + fail('NON_CANONICAL', 'Management payload is not canonical'); + return { payload, outputIndex }; +} + +export function validateSentryManagementRequest( + value: unknown +): SentryManagementRequest { + const v = object( + value, + ['version', 'operation', 'chain', 'transactionHex'], + 'management request' + ); + if ( + v.version !== 1 || + ![ + 'register', + 'updateRegistrar', + 'revoke', + 'registerOperator', + 'rotateOperator', + ].includes(String(v.operation)) + ) + fail('UNSUPPORTED_OPERATION', 'Unknown management operation'); + const c = object(v.chain, ['genesisHash', 'era'], 'chain'); + if (c.era !== 'legacy-v3' && c.era !== 'pq-v4') + fail('UNSUPPORTED_ERA', 'Unknown management era'); + const chain = { + genesisHash: displayHash(hashBytes(c.genesisHash)), + era: c.era, + } as SentryChain; + const operation = v.operation as SentryManagementRequest['operation'], + transactionHex = hex(fromHex(v.transactionHex)); + const { payload } = managementPayload(transactionHex, operation); + const isGlobal = + operation === 'registerOperator' || operation === 'rotateOperator'; + if ( + !isGlobal && + payload.version !== (chain.era === 'pq-v4' ? 3 : 2) && + !( + operation === 'updateRegistrar' && + payload.version === 3 && + chain.era === 'legacy-v3' + ) + ) + fail('ERA_MISMATCH', 'Payload does not match the active management era'); + return { version: 1, operation, chain, transactionHex }; +} + +function fund( + p: ManagementPayload, + chain: SentryChain, + inputs: SentryTxInput[], + outputs: SentryTxOutput[], + lockTime = 0 +): SentryManagementRequest { + if (!inputs.length || inputs.length > 256 || outputs.length > 255) + fail('LIMIT', 'Invalid funding size'); + const txInputs = inputs.map((i) => ({ + txid: displayHash(hashBytes(i.txid)), + vout: uint(i.vout, 32, 'vout'), + sequence: uint(i.sequence ?? 0xfffffffe, 32, 'sequence'), + scriptHex: '', + witness: [], + })); + p.inputsHash = hash256( + concat( + ...txInputs.map((i) => concat(hashBytes(i.txid), integerBytes(i.vout, 4))) + ) + ); + const txOutputs = outputs.map((o) => { + const script = fromHex(o.scriptHex); + if (script[0] === 0x6a) + fail('INVALID_OUTPUT', 'Only one node payload is permitted'); + return { + valueSatoshis: amount(o.valueSatoshis, 'output').toString(), + scriptHex: hex(script), + }; + }); + txOutputs.push({ + valueSatoshis: '0', + scriptHex: hex(opReturn(managementPayloadBytes(p))), + }); + return validateSentryManagementRequest({ + version: 1, + operation: p.kind, + chain, + transactionHex: hex( + encodeTransaction({ + version: MANAGEMENT_TX_VERSION[p.kind], + inputs: txInputs, + outputs: txOutputs, + lockTime: uint(lockTime, 32, 'locktime'), + }) + ), + }); +} + +export function buildSentryRegistration( + o: BuildSentryRegistration +): SentryManagementRequest { + const pq = o.chain.era === 'pq-v4'; + return fund( + { + kind: 'register', + version: pq ? 3 : 2, + inputsHash: new Uint8Array(32), + collateralTxid: displayHash(hashBytes(o.collateralOutpoint.txid)), + collateralVout: uint(o.collateralOutpoint.vout, 32, 'collateralVout'), + service: parseService(o.service), + ownerKeyId: fromHex(o.ownerKeyId, 'owner key id', 20), + votingKeyId: fromHex(o.votingKeyId, 'voting key id', 20), + operatorPublicKey: pq + ? new Uint8Array() + : fromHex(o.operatorPublicKey, 'operator key', 48), + pqOwnerPublicKey: pq + ? fromHex(o.pqOwnerPublicKey, 'PQ owner key', 32) + : new Uint8Array(), + pqVotingPublicKey: pq + ? fromHex(o.pqVotingPublicKey, 'PQ voting key', 32) + : new Uint8Array(), + reward: uint(o.operatorRewardBasisPoints, 16, 'operator reward'), + payoutScript: fromHex(o.payoutScript), + primarySignature: new Uint8Array(65), + ownerProof: new Uint8Array(pq ? PQ_SIGNATURE_SIZE : 0), + }, + o.chain, + o.inputs, + o.outputs, + o.lockTime + ); +} + +export function buildSentryRegistrarUpdate( + o: BuildSentryRegistrarUpdate +): SentryManagementRequest { + const pq = o.chain.era === 'pq-v4' || o.ownerPreparation === true; + if (pq && o.operatorPublicKey !== undefined) + fail( + 'UNSUPPORTED_OPERATION', + 'PQ operator rotation uses a separate global-key operation' + ); + return fund( + { + kind: 'updateRegistrar', + version: pq ? 3 : 2, + proTxHash: o.node.proTxHash, + inputsHash: new Uint8Array(32), + votingKeyId: fromHex( + o.votingKeyId ?? o.node.votingKeyId, + 'voting key id', + 20 + ), + operatorPublicKey: pq + ? new Uint8Array() + : fromHex( + o.operatorPublicKey ?? o.node.operatorPublicKey, + 'operator key', + 48 + ), + payoutScript: fromHex(o.payoutScript ?? o.node.payoutScript), + pqVotingPublicKey: pq + ? fromHex( + o.pqVotingPublicKey ?? o.node.pqVotingPublicKey ?? '00'.repeat(32), + 'PQ voting key', + 32 + ) + : new Uint8Array(), + pqOwnerPublicKey: pq + ? fromHex(o.pqOwnerPublicKey ?? '00'.repeat(32), 'PQ owner key', 32) + : new Uint8Array(), + ownerKeyVersion: pq ? o.node.pqOwnerRecord?.keyVersion ?? 0 : 0, + primarySignature: new Uint8Array( + pq && o.node.pqOwnerRecord ? PQ_SIGNATURE_SIZE : 65 + ), + ownerProof: new Uint8Array(pq ? PQ_SIGNATURE_SIZE : 0), + }, + o.chain, + o.inputs, + o.outputs, + o.lockTime + ); +} + +export function buildSentryOperatorUpdate( + o: BuildSentryOperatorUpdate +): SentryManagementRequest { + if (o.mode !== 'initial' && o.mode !== 'rotate') + fail('UNSUPPORTED_OPERATION', 'Unknown operator update mode'); + const pqOwner = o.mode === 'initial' && !!o.node.pqOwnerRecord; + return fund( + { + kind: o.mode === 'initial' ? 'registerOperator' : 'rotateOperator', + version: pqOwner ? 2 : 1, + proTxHash: o.node.proTxHash, + candidate: { ...o.candidate }, + inputsHash: new Uint8Array(32), + ownerKeyVersion: pqOwner ? o.node.pqOwnerRecord!.keyVersion : 0, + primarySignature: new Uint8Array(PQ_SIGNATURE_SIZE), + ownerProof: new Uint8Array(pqOwner ? PQ_SIGNATURE_SIZE : 65), + }, + o.chain, + o.inputs, + o.outputs, + o.lockTime + ); +} + +export function buildSentryRevocation( + o: BuildSentryRevocation +): SentryManagementRequest { + const pq = o.chain.era === 'pq-v4'; + return fund( + { + kind: 'revoke', + version: pq ? 3 : 2, + proTxHash: o.node.proTxHash, + inputsHash: new Uint8Array(32), + reason: uint(o.reason, 16, 'reason'), + globalKeyVersion: pq + ? uint(o.node.globalKeyVersion, 32, 'global key version') + : 0, + primarySignature: new Uint8Array( + pq ? PQ_SIGNATURE_SIZE : BLS_SIGNATURE_SIZE + ), + ownerProof: new Uint8Array(), + }, + o.chain, + o.inputs, + o.outputs, + o.lockTime + ); +} + +export function scriptAddress( + script: Uint8Array, + network: SentryNetworkEncoding +): string { + if (!/^[a-z0-9]{1,20}$/.test(network.bech32Hrp)) + fail('INVALID_NETWORK', 'Invalid configured address prefix'); + const h = hex(script); + if (/^76a914[0-9a-f]{40}88ac$/.test(h)) + return base58check(sha256).encode( + concat( + integerBytes(uint(network.pubKeyHash, 8, 'pubkey prefix'), 1), + script.slice(3, 23) + ) + ); + if (/^a914[0-9a-f]{40}87$/.test(h)) + return base58check(sha256).encode( + concat( + integerBytes(uint(network.scriptHash, 8, 'script prefix'), 1), + script.slice(2, 22) + ) + ); + const version = + script[0] === 0 + ? 0 + : script[0] >= 0x51 && script[0] <= 0x60 + ? script[0] - 0x50 + : -1; + if ( + version >= 0 && + script.length >= 4 && + script[1] === script.length - 2 && + script[1] <= 40 && + (version !== 0 || script[1] === 20 || script[1] === 32) + ) { + const coder = version === 0 ? bech32 : bech32m; + return coder.encode(network.bech32Hrp, [ + version, + ...coder.toWords(script.slice(2)), + ]); + } + fail('INVALID_PAYOUT', 'Node payout must be a standard destination script'); +} + +export function registrationMessage( + p: RegistrationPayload, + network: SentryNetworkEncoding +): string { + const owner = scriptAddress( + concat(Uint8Array.of(0, 20), p.ownerKeyId), + network + ); + const voting = scriptAddress( + concat(Uint8Array.of(0, 20), p.votingKeyId), + network + ); + return `${scriptAddress(p.payoutScript, network)}|${ + p.reward + }|${owner}|${voting}|${displayHash( + hash256(managementPayloadBytes(p, true)) + )}`; +} + +export function registrationMessageDigest( + p: RegistrationPayload, + network: SentryNetworkEncoding +): Uint8Array { + return hash256( + concat( + vector(new TextEncoder().encode('Syscoin Signed Message:\n')), + vector(new TextEncoder().encode(registrationMessage(p, network))) + ) + ); +} + +/** Convert trusted Core owner/voting address fields into their signed key ID. */ +export function sentryKeyIdFromAddress( + value: string, + network: SentryNetworkEncoding +): string { + if (typeof value !== 'string' || value.length > 128) + fail('INVALID_ADDRESS', 'Invalid node authority address'); + try { + const decoded = bech32.decode(value as `${string}1${string}`); + const bytes = bech32.fromWords(decoded.words.slice(1)); + if ( + decoded.prefix !== network.bech32Hrp || + decoded.words[0] !== 0 || + bytes.length !== 20 + ) + fail( + 'INVALID_ADDRESS', + 'Owner/voting address must be this network single-key address' + ); + return hex(Uint8Array.from(bytes)); + } catch { + try { + const bytes = base58check(sha256).decode(value); + if (bytes.length !== 21 || bytes[0] !== network.pubKeyHash) + fail('INVALID_ADDRESS', 'Wrong node address network/type'); + return hex(bytes.slice(1)); + } catch { + return fail( + 'INVALID_ADDRESS', + 'Owner/voting address must be this network single-key address' + ); + } + } +} diff --git a/packages/sysweb3-sentry/src/management-types.ts b/packages/sysweb3-sentry/src/management-types.ts new file mode 100644 index 00000000..5e776c60 --- /dev/null +++ b/packages/sysweb3-sentry/src/management-types.ts @@ -0,0 +1,125 @@ +import type { + SentryChain, + SentryNodeState, + SentryPQRecord, + SentryScheme, + SentryTxInput, + SentryTxOutput, +} from './types.js'; + +export type SentryAuthorityRole = + | 'collateral' + | 'owner' + | 'operator' + | 'voting'; +export type SentryAuthorityScheme = SentryScheme | 'secp256k1'; +export interface SentryAuthorityKey { + role: SentryAuthorityRole; + scheme: SentryAuthorityScheme; + publicKey: string; + secretKey: string; +} +export interface SentryNetworkEncoding { + bech32Hrp: string; + pubKeyHash: number; + scriptHash: number; +} +export interface SentryManagementNode extends SentryNodeState { + ownerKeyId: string; + votingKeyId: string; + payoutScript: string; + pqOwnerRecord?: { + publicKey: string; + keyVersion: number; + activatedHeight: number; + }; + pqVotingPublicKey?: string; + operatorRevoked?: boolean; +} +export interface SentryManagementRequest { + version: 1; + operation: + | 'register' + | 'updateRegistrar' + | 'revoke' + | 'registerOperator' + | 'rotateOperator'; + chain: SentryChain; + transactionHex: string; +} +export interface SentryManagementContext { + chain: SentryChain; + network: SentryNetworkEncoding; + node?: SentryManagementNode; + previousTransactions: string[]; + maxFeeSatoshis: string; + /** Independently resolved Core preparation-phase capability, never a dapp toggle. */ + allowOperatorPreparation?: boolean; + allowOwnerPreparation?: boolean; + registration?: { + collateralTransactionHex: string; + collateralVout: number; + requiredCollateralSatoshis: string; + }; +} +export interface SentryRequiredAuthorization { + id: 'collateral' | 'owner' | 'operator' | 'newOwner' | 'newOperator'; + role: SentryAuthorityRole; + scheme: SentryAuthorityScheme; + /** Hash160 for secp256k1, complete public key for BLS/SLH. */ + keyIdentity: string; + digest: string; + context?: string; + signed: boolean; +} +export interface SentryManagementReview { + operation: SentryManagementRequest['operation']; + chain: SentryChain; + proTxHash?: string; + feeSatoshis: string; + outputs: Array; + fields: Record; + authorizations: SentryRequiredAuthorization[]; +} +export interface SentryManagementResponse { + version: 1; + operation: SentryManagementRequest['operation']; + transactionHex: string; + signedAuthorization: SentryRequiredAuthorization['id']; + complete: boolean; +} +interface Funding { + chain: SentryChain; + inputs: SentryTxInput[]; + outputs: SentryTxOutput[]; + lockTime?: number; +} +export interface BuildSentryRegistration extends Funding { + collateralOutpoint: { txid: string; vout: number }; + service: string; + ownerKeyId: string; + votingKeyId: string; + operatorPublicKey?: string; + pqOwnerPublicKey?: string; + pqVotingPublicKey?: string; + operatorRewardBasisPoints: number; + payoutScript: string; +} +export interface BuildSentryRegistrarUpdate extends Funding { + node: SentryManagementNode; + operatorPublicKey?: string; + votingKeyId?: string; + payoutScript?: string; + pqOwnerPublicKey?: string; + pqVotingPublicKey?: string; + ownerPreparation?: boolean; +} +export interface BuildSentryRevocation extends Funding { + node: SentryManagementNode; + reason: 0 | 1 | 2 | 3; +} +export interface BuildSentryOperatorUpdate extends Funding { + node: SentryManagementNode; + mode: 'initial' | 'rotate'; + candidate: SentryPQRecord; +} diff --git a/packages/sysweb3-sentry/src/management.ts b/packages/sysweb3-sentry/src/management.ts new file mode 100644 index 00000000..a2651acd --- /dev/null +++ b/packages/sysweb3-sentry/src/management.ts @@ -0,0 +1,827 @@ +import { ripemd160 } from '@noble/hashes/legacy.js'; +import { sha256 } from '@noble/hashes/sha2.js'; + +import { + concat, + fail, + fromHex, + hash256, + hashBytes, + hex, + integerBytes, + nonzero, + uint, + vector, +} from './bytes.js'; +import { + decodeSentryTransaction, + encodeTransaction, + opReturn, +} from './codec.js'; +import { + MANAGEMENT_TX_VERSION, + managementPayload, + managementPayloadBytes, + registrationMessage, + registrationMessageDigest, + scriptAddress, + validateSentryManagementRequest, + type ManagementPayload, +} from './management-codec.js'; +import { reviewFunding, serializePQRecord } from './review.js'; +import { importSentryOperatorKey } from './signing.js'; + +import type { + SentryAuthorityKey, + SentryAuthorityRole, + SentryAuthorityScheme, + SentryManagementContext, + SentryManagementRequest, + SentryManagementResponse, + SentryManagementReview, + SentryRequiredAuthorization, +} from './management-types.js'; + +export function sentryKeyId(publicKeyHex: string): string { + return hex(ripemd160(sha256(fromHex(publicKeyHex, 'public key')))); +} + +export async function importSentryAuthorityKey( + role: SentryAuthorityRole, + scheme: SentryAuthorityScheme, + secretKeyHex: string +): Promise { + if ( + !['owner', 'operator', 'collateral', 'voting'].includes(role) || + (role === 'collateral' && scheme !== 'secp256k1') || + (role === 'operator' && scheme === 'secp256k1') || + (role !== 'operator' && scheme === 'bls-basic') + ) + fail('INVALID_KEY_ROLE', 'Key scheme cannot authorize this node role'); + if (scheme !== 'secp256k1') + return { ...(await importSentryOperatorKey(scheme, secretKeyHex)), role }; + const secret = fromHex(secretKeyHex, 'secp256k1 key', 32); + try { + const { secp256k1 } = await import('@noble/curves/secp256k1.js'); + const publicKey = secp256k1.getPublicKey(secret, true); + return { role, scheme, publicKey: hex(publicKey), secretKey: hex(secret) }; + } catch { + return fail('INVALID_SECRET_KEY', 'Invalid node authority key'); + } finally { + secret.fill(0); + } +} + +export function ownerDigest( + p: ManagementPayload, + context: SentryManagementContext +): Uint8Array { + const domain = + p.kind === 'register' + ? 'SYS_PQ_OWNER_PROREG_V1' + : 'SYS_PQ_OWNER_REGISTRAR_V1'; + return hash256( + concat( + vector(new TextEncoder().encode(domain)), + hashBytes(context.chain.genesisHash), + integerBytes(MANAGEMENT_TX_VERSION[p.kind], 4), + hash256(managementPayloadBytes(p, true)) + ) + ); +} + +function addAuth( + list: SentryRequiredAuthorization[], + id: SentryRequiredAuthorization['id'], + role: SentryAuthorityRole, + scheme: SentryAuthorityScheme, + keyIdentity: string, + digest: Uint8Array, + signature: Uint8Array, + context?: string +): void { + fromHex( + keyIdentity, + 'authorization key identity', + scheme === 'secp256k1' ? 20 : scheme === 'bls-basic' ? 48 : 32 + ); + if (!nonzero(fromHex(keyIdentity))) + fail('INVALID_KEY', 'Authorization key cannot be empty'); + list.push({ + id, + role, + scheme, + keyIdentity: keyIdentity.toLowerCase(), + digest: hex(digest), + context, + signed: nonzero(signature), + }); +} + +export function reviewSentryManagementOperation( + value: unknown, + context: SentryManagementContext +): SentryManagementReview { + const request = validateSentryManagementRequest(value); + if ( + request.chain.genesisHash !== context.chain.genesisHash.toLowerCase() || + request.chain.era !== context.chain.era + ) + fail( + 'CHAIN_MISMATCH', + 'Wallet chain/activation state differs from request' + ); + const owner = context.node?.pqOwnerRecord; + if ( + owner && + (uint(owner.keyVersion, 32, 'owner key version') === 0 || + !Number.isSafeInteger(owner.activatedHeight) || + owner.activatedHeight < 0 || + !nonzero(fromHex(owner.publicKey, 'owner public key', 32))) + ) + fail('INVALID_OWNER', 'Invalid current owner key record'); + const tx = decodeSentryTransaction(request.transactionHex); + const { payload: p, outputIndex } = managementPayload(request.transactionHex); + const fee = reviewFunding(request, context); + const authorizations: SentryRequiredAuthorization[] = [], + fields: Record = {}; + let proTxHash: string | undefined; + if (p.kind === 'registerOperator' || p.kind === 'rotateOperator') { + const node = context.node; + if (!node || node.proTxHash.toLowerCase() !== p.proTxHash) + fail('NODE_MISMATCH', 'Wallet must fetch the registered operator target'); + if ( + context.chain.era !== 'pq-v4' && + (p.kind !== 'registerOperator' || !context.allowOperatorPreparation) + ) + fail('ERA_MISMATCH', 'Core has not enabled operator preparation'); + proTxHash = p.proTxHash; + const candidate = p.candidate; + const recordBytes = serializePQRecord(candidate, true); + const prior = node.pqRecord; + const candidateChild = fromHex(candidate.childKeyCommitmentHex); + const candidateGeneration = new DataView( + candidateChild.buffer, + candidateChild.byteOffset + ).getUint32(8, true); + if (candidate.activatedHeight !== 0) + fail('INVALID_CANDIDATE', 'Activation height is assigned by consensus'); + if (!prior) { + if ( + p.kind !== 'registerOperator' || + candidate.keyVersion !== 1 || + candidateGeneration !== 1 + ) + fail( + 'INVALID_CANDIDATE', + 'Initial operator key must start at version and generation one' + ); + } else { + serializePQRecord(prior); + if ( + candidate.keyVersion !== prior.keyVersion + 1 || + candidate.publicKey.toLowerCase() === prior.publicKey.toLowerCase() + ) + fail( + 'INVALID_CANDIDATE', + 'Operator update requires next version and a different public key' + ); + if ((p.kind === 'registerOperator') !== !!node.operatorRevoked) + fail( + 'INVALID_CANDIDATE', + 'Recovery requires a revoked operator; active keys use rotation' + ); + const previousChild = fromHex(prior.childKeyCommitmentHex); + const previousGeneration = new DataView( + previousChild.buffer, + previousChild.byteOffset + ).getUint32(8, true); + const same = + candidate.childKeyCommitmentHex.toLowerCase() === + prior.childKeyCommitmentHex.toLowerCase(); + const successor = + candidateGeneration === previousGeneration + 1 && + hex(candidateChild.slice(16, 48)) !== + hex(previousChild.slice(16, 48)) && + hex(candidateChild.slice(48)) !== hex(previousChild.slice(48)); + if ((!same && !successor) || (p.kind === 'registerOperator' && same)) + fail('INVALID_CANDIDATE', 'Invalid operator child-tree successor'); + } + fields.previousOperatorPublicKey = + prior?.publicKey ?? node.operatorPublicKey; + fields.operatorPublicKey = candidate.publicKey; + fields.globalKeyVersion = String(candidate.keyVersion); + fields.childKeyCommitment = candidate.childKeyCommitmentHex; + fields.action = + p.kind === 'rotateOperator' + ? 'Rotate active operator key' + : prior + ? 'Recover revoked operator' + : 'Enroll initial PQ operator'; + if (p.kind === 'registerOperator') { + const owner = node.pqOwnerRecord; + if ( + (p.version === 2) !== !!owner || + p.ownerKeyVersion !== (owner?.keyVersion ?? 0) + ) + fail( + 'OWNER_DOWNGRADE', + 'Operator enrollment must use the current owner authority' + ); + const domain = owner + ? 'SYS_PQ_GLOBAL_OWNER_REGISTER_V2' + : 'SYS_PQ_GLOBAL_OWNER_REGISTER_V1'; + const ownerHash = hash256( + concat( + new TextEncoder().encode(domain), + hashBytes(context.chain.genesisHash), + integerBytes(86, 4), + integerBytes(p.version, 2), + Uint8Array.of(1), + hashBytes(p.proTxHash), + recordBytes, + p.inputsHash, + ...(owner ? [integerBytes(p.ownerKeyVersion, 4)] : []) + ) + ); + addAuth( + authorizations, + 'owner', + 'owner', + owner ? 'slh-dsa-shake-128s' : 'secp256k1', + owner?.publicKey ?? node.ownerKeyId, + ownerHash, + p.ownerProof, + owner ? domain : undefined + ); + const registrationHash = hash256( + concat( + new TextEncoder().encode('SYS_PQ_GLOBAL_REGISTER_V1'), + hashBytes(context.chain.genesisHash), + hashBytes(p.proTxHash), + recordBytes.slice(0, -4), + p.inputsHash + ) + ); + addAuth( + authorizations, + 'newOperator', + 'operator', + 'slh-dsa-shake-128s', + candidate.publicKey, + registrationHash, + p.primarySignature, + 'SYS_PQ_GLOBAL_REGISTER_V1' + ); + } else { + if (!prior) fail('INVALID_CANDIDATE', 'No active operator to rotate'); + const rotationHash = hash256( + concat( + new TextEncoder().encode('SYS_PQ_GLOBAL_ROTATE_V1'), + hashBytes(context.chain.genesisHash), + hashBytes(p.proTxHash), + serializePQRecord(prior).slice(0, -4), + recordBytes.slice(0, -4), + p.inputsHash + ) + ); + addAuth( + authorizations, + 'operator', + 'operator', + 'slh-dsa-shake-128s', + prior.publicKey, + rotationHash, + p.primarySignature, + 'SYS_PQ_GLOBAL_ROTATE_V1' + ); + } + } else if (p.kind === 'register') { + const c = context.registration; + if (!c) + fail( + 'MISSING_COLLATERAL', + 'Wallet must independently fetch registration collateral' + ); + const collateralTx = decodeSentryTransaction(c.collateralTransactionHex); + if ( + collateralTx.txid !== p.collateralTxid || + c.collateralVout !== p.collateralVout + ) + fail( + 'COLLATERAL_MISMATCH', + 'Registration points to another collateral output' + ); + const collateral = collateralTx.outputs[p.collateralVout]; + if ( + !collateral || + collateral.valueSatoshis !== c.requiredCollateralSatoshis + ) + fail('COLLATERAL_AMOUNT', 'Registration collateral amount is incorrect'); + if ( + tx.inputs.some( + (input) => + input.txid === p.collateralTxid && input.vout === p.collateralVout + ) + ) + fail('COLLATERAL_SPEND', 'Registration must not spend its collateral'); + const script = collateral.scriptHex; + const collateralKeyId = /^0014[0-9a-f]{40}$/.test(script) + ? script.slice(4) + : /^76a914[0-9a-f]{40}88ac$/.test(script) + ? script.slice(6, -4) + : undefined; + if (!collateralKeyId) + fail( + 'UNSUPPORTED_COLLATERAL', + 'External collateral must use a single-key P2PKH/P2WPKH output' + ); + if ( + collateralKeyId === hex(p.ownerKeyId) || + collateralKeyId === hex(p.votingKeyId) + ) + fail('KEY_REUSE', 'Collateral cannot reuse owner/voting authority'); + fields.collateral = `${p.collateralTxid}:${p.collateralVout}`; + fields.collateralSatoshis = collateral.valueSatoshis; + fields.service = p.service.text; + fields.ownerKeyId = hex(p.ownerKeyId); + fields.votingKeyId = hex(p.votingKeyId); + fields.payoutAddress = scriptAddress(p.payoutScript, context.network); + fields.operatorRewardBasisPoints = String(p.reward); + fields.operatorPublicKey = hex(p.operatorPublicKey); + fields.pqVotingPublicKey = hex(p.pqVotingPublicKey); + fields.pqOwnerPublicKey = hex(p.pqOwnerPublicKey); + fields.collateralSigningMessage = registrationMessage(p, context.network); + addAuth( + authorizations, + 'collateral', + 'collateral', + 'secp256k1', + collateralKeyId, + registrationMessageDigest(p, context.network), + p.primarySignature + ); + if (p.version === 3) + addAuth( + authorizations, + 'newOwner', + 'owner', + 'slh-dsa-shake-128s', + hex(p.pqOwnerPublicKey), + ownerDigest(p, context), + p.ownerProof, + 'SYS_PQ_OWNER_PROOF_V1' + ); + } else { + const node = context.node; + if (!node || p.proTxHash !== node.proTxHash.toLowerCase()) + fail('NODE_MISMATCH', 'Wallet must fetch the registered target node'); + proTxHash = p.proTxHash; + if (p.kind === 'updateRegistrar') { + if (request.chain.era === 'legacy-v3' && p.version === 3) { + if ( + !context.allowOwnerPreparation || + !nonzero(p.pqOwnerPublicKey) || + hex(p.votingKeyId) !== node.votingKeyId.toLowerCase() || + hex(p.payoutScript) !== node.payoutScript.toLowerCase() || + hex(p.pqVotingPublicKey) !== + hex( + fromHex( + node.pqVotingPublicKey ?? '00'.repeat(32), + 'current PQ voting key', + 32 + ) + ) + ) { + fail( + 'ERA_MISMATCH', + 'Only authorized owner-preparation fields may change before activation' + ); + } + } + scriptAddress(p.payoutScript, context.network); + fields.previousPayoutAddress = scriptAddress( + fromHex(node.payoutScript), + context.network + ); + fields.payoutAddress = scriptAddress(p.payoutScript, context.network); + fields.previousVotingKeyId = node.votingKeyId; + fields.votingKeyId = hex(p.votingKeyId); + fields.previousOperatorPublicKey = node.operatorPublicKey; + fields.operatorPublicKey = + p.version === 2 ? hex(p.operatorPublicKey) : node.operatorPublicKey; + fields.previousPQVotingPublicKey = node.pqVotingPublicKey ?? ''; + fields.pqVotingPublicKey = hex(p.pqVotingPublicKey); + fields.previousPQOwnerPublicKey = node.pqOwnerRecord?.publicKey ?? ''; + fields.pqOwnerPublicKey = nonzero(p.pqOwnerPublicKey) + ? hex(p.pqOwnerPublicKey) + : node.pqOwnerRecord?.publicKey ?? ''; + if (p.version === 2) { + if (node.pqOwnerRecord) + fail( + 'OWNER_DOWNGRADE', + 'Enrolled PQ owner cannot fall back to ECDSA' + ); + addAuth( + authorizations, + 'owner', + 'owner', + 'secp256k1', + node.ownerKeyId, + hash256(managementPayloadBytes(p, true)), + p.primarySignature + ); + } else { + const replaces = nonzero(p.pqOwnerPublicKey), + owner = node.pqOwnerRecord; + if (p.ownerKeyVersion !== (owner?.keyVersion ?? 0)) + fail( + 'KEY_VERSION', + 'Registrar must use the currently enrolled owner version' + ); + const digest = ownerDigest(p, context); + if (owner) { + if ( + owner.keyVersion < 1 || + owner.activatedHeight < 0 || + p.primarySignature.length !== 7856 + ) + fail('INVALID_OWNER', 'Invalid current PQ owner record/signature'); + addAuth( + authorizations, + 'owner', + 'owner', + 'slh-dsa-shake-128s', + owner.publicKey, + digest, + p.primarySignature, + 'SYS_PQ_OWNER_UPDATE_V1' + ); + } else { + if (p.primarySignature.length !== 65) + fail( + 'INVALID_OWNER', + 'Legacy owner requires compact ECDSA authorization' + ); + addAuth( + authorizations, + 'owner', + 'owner', + 'secp256k1', + node.ownerKeyId, + replaces ? digest : hash256(managementPayloadBytes(p, true)), + p.primarySignature + ); + } + if (replaces) + addAuth( + authorizations, + 'newOwner', + 'owner', + 'slh-dsa-shake-128s', + hex(p.pqOwnerPublicKey), + digest, + p.ownerProof, + 'SYS_PQ_OWNER_PROOF_V1' + ); + else if (nonzero(p.ownerProof)) + fail( + 'UNEXPECTED_PROOF', + 'Unchanged owner must not carry an unrelated proof' + ); + } + } else { + if (p.kind !== 'revoke') + fail('UNSUPPORTED_OPERATION', 'Unknown node management operation'); + fields.reason = String(p.reason); + if (p.version === 2) + addAuth( + authorizations, + 'operator', + 'operator', + 'bls-basic', + node.operatorPublicKey, + hash256(managementPayloadBytes(p, true)), + p.primarySignature + ); + else { + const record = node.pqRecord; + if ( + !record || + record.keyVersion !== p.globalKeyVersion || + node.globalKeyVersion !== p.globalKeyVersion || + record.publicKey.toLowerCase() !== + node.operatorPublicKey.toLowerCase() + ) + fail( + 'KEY_VERSION', + 'Revocation requires current registered PQ operator' + ); + const digest = hash256( + concat( + new TextEncoder().encode('SYS_PQ_PROVIDER_REVOKE_V1'), + hashBytes(context.chain.genesisHash), + integerBytes(1, 2), + integerBytes(p.version, 2), + hashBytes(p.proTxHash), + integerBytes(p.globalKeyVersion, 4), + integerBytes(record.version, 2), + integerBytes(record.profile, 2), + hash256(serializePQRecord(record)), + integerBytes(p.reason, 2), + p.inputsHash + ) + ); + addAuth( + authorizations, + 'operator', + 'operator', + 'slh-dsa-shake-128s', + node.operatorPublicKey, + digest, + p.primarySignature, + 'SYS_PQ_PROVIDER_REVOKE_V1' + ); + } + } + } + return { + operation: p.kind, + chain: { ...request.chain }, + proTxHash, + fields, + authorizations, + feeSatoshis: fee.toString(), + outputs: tx.outputs.map((o, i) => ({ ...o, isPayload: i === outputIndex })), + }; +} + +function signatureFor( + p: ManagementPayload, + auth: SentryRequiredAuthorization +): Uint8Array { + if ( + (p.kind === 'registerOperator' || p.kind === 'rotateOperator') && + auth.id === 'owner' + ) + return p.ownerProof; + return auth.id === 'newOwner' ? p.ownerProof : p.primarySignature; +} + +async function verifyAuthority( + signature: Uint8Array, + auth: SentryRequiredAuthorization +): Promise { + if (!nonzero(signature)) return false; + const digest = fromHex(auth.digest); + try { + if (auth.scheme === 'secp256k1') { + if (signature.length !== 65 || signature[0] < 31 || signature[0] > 34) + return false; + const recovered = signature.slice(); + recovered[0] -= 31; + const { secp256k1 } = await import('@noble/curves/secp256k1.js'); + if ( + secp256k1.Signature.fromBytes(signature.slice(1), 'compact').hasHighS() + ) + return false; + return ( + sentryKeyId( + hex(secp256k1.recoverPublicKey(recovered, digest, { prehash: false })) + ) === auth.keyIdentity + ); + } + if (auth.scheme === 'bls-basic') { + const { bls12_381 } = await import('@noble/curves/bls12-381.js'); + return bls12_381.longSignatures.verify( + signature, + bls12_381.longSignatures.hash( + digest, + 'BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_NUL_' + ), + fromHex(auth.keyIdentity) + ); + } + const { slh_dsa_shake_128s } = await import( + '@noble/post-quantum/slh-dsa.js' + ); + return slh_dsa_shake_128s.verify( + signature, + digest, + fromHex(auth.keyIdentity), + { context: new TextEncoder().encode(auth.context!) } + ); + } catch { + return false; + } +} + +export async function verifySentryManagementOperation( + value: unknown, + context: SentryManagementContext +): Promise { + try { + const request = validateSentryManagementRequest(value), + review = reviewSentryManagementOperation(request, context); + const { payload } = managementPayload(request.transactionHex); + for (const auth of review.authorizations) + if (!(await verifyAuthority(signatureFor(payload, auth), auth))) + return false; + return true; + } catch { + return false; + } +} + +export async function signSentryManagementOperation( + value: unknown, + context: SentryManagementContext, + importedKey: SentryAuthorityKey, + authorizationId?: SentryRequiredAuthorization['id'] +): Promise { + context = { + ...context, + chain: { ...context.chain }, + network: { ...context.network }, + previousTransactions: [...context.previousTransactions], + registration: context.registration + ? { ...context.registration } + : undefined, + node: context.node + ? { + ...context.node, + pqOwnerRecord: context.node.pqOwnerRecord + ? { ...context.node.pqOwnerRecord } + : undefined, + pqRecord: context.node.pqRecord + ? { ...context.node.pqRecord } + : undefined, + collateralOutpoint: context.node.collateralOutpoint + ? { ...context.node.collateralOutpoint } + : undefined, + } + : undefined, + }; + importedKey = { ...importedKey }; + const request = validateSentryManagementRequest(value), + review = reviewSentryManagementOperation(request, context); + const tx = decodeSentryTransaction(request.transactionHex), + { payload, outputIndex } = managementPayload(request.transactionHex); + if (tx.inputs.some((i) => i.scriptHex !== '' || i.witness.length)) + fail( + 'SIGNED_FUNDING', + 'Fee signatures must follow all node authorizations' + ); + const key = await importSentryAuthorityKey( + importedKey.role, + importedKey.scheme, + importedKey.secretKey + ); + if (key.publicKey !== importedKey.publicKey.toLowerCase()) + fail('KEY_MISMATCH', 'Imported authority key identity changed'); + const identity = + key.scheme === 'secp256k1' ? sentryKeyId(key.publicKey) : key.publicKey; + const candidates = review.authorizations.filter( + (a) => + a.role === key.role && + a.scheme === key.scheme && + a.keyIdentity === identity && + (!authorizationId || a.id === authorizationId) + ); + if (candidates.length !== 1) + fail( + 'KEY_MISMATCH', + 'Select the exact required authority slot for this key' + ); + const auth = candidates[0]; + if (auth.signed) + fail('ALREADY_AUTHORIZED', 'This authority signature already exists'); + for (const existing of review.authorizations) + if ( + existing.signed && + !(await verifyAuthority(signatureFor(payload, existing), existing)) + ) + fail('INVALID_SIGNATURE', 'Another authority signature is invalid'); + const secret = fromHex(key.secretKey), + digest = fromHex(auth.digest); + let signature: Uint8Array; + try { + if (key.scheme === 'secp256k1') { + const { secp256k1 } = await import('@noble/curves/secp256k1.js'); + signature = secp256k1.sign(digest, secret, { + prehash: false, + format: 'recovered', + lowS: true, + }); + signature[0] += 31; + } else if (key.scheme === 'bls-basic') { + const { bls12_381 } = await import('@noble/curves/bls12-381.js'); + signature = bls12_381.longSignatures + .sign( + bls12_381.longSignatures.hash( + digest, + 'BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_NUL_' + ), + secret + ) + .toBytes(); + } else { + const { slh_dsa_shake_128s } = await import( + '@noble/post-quantum/slh-dsa.js' + ); + signature = slh_dsa_shake_128s.sign(digest, secret, { + context: new TextEncoder().encode(auth.context!), + extraEntropy: false, + }); + } + } finally { + secret.fill(0); + digest.fill(0); + } + if (!(await verifyAuthority(signature!, auth))) + fail('SIGNATURE_FAILED', 'Authority signature did not verify'); + if ( + auth.id === 'newOwner' || + ((payload.kind === 'registerOperator' || + payload.kind === 'rotateOperator') && + auth.id === 'owner') + ) + payload.ownerProof = signature!; + else payload.primarySignature = signature!; + tx.outputs[outputIndex].scriptHex = hex( + opReturn(managementPayloadBytes(payload)) + ); + const next = { ...request, transactionHex: hex(encodeTransaction(tx)) }; + return { + version: 1, + operation: request.operation, + transactionHex: next.transactionHex, + signedAuthorization: auth.id, + complete: await verifySentryManagementOperation(next, context), + }; +} + +export function matchesSentryManagementIntent( + prepared: unknown, + signed: unknown +): boolean { + try { + const a = validateSentryManagementRequest(prepared), + b = validateSentryManagementRequest(signed); + if ( + a.operation !== b.operation || + a.chain.genesisHash !== b.chain.genesisHash || + a.chain.era !== b.chain.era + ) + return false; + const clean = (req: SentryManagementRequest): string => { + const tx = decodeSentryTransaction(req.transactionHex), + { payload, outputIndex } = managementPayload(req.transactionHex); + payload.primarySignature.fill(0); + payload.ownerProof.fill(0); + tx.outputs[outputIndex].scriptHex = hex( + opReturn(managementPayloadBytes(payload)) + ); + for (const input of tx.inputs) { + input.scriptHex = ''; + input.witness = []; + } + return hex(encodeTransaction(tx)); + }; + return clean(a) === clean(b); + } catch { + return false; + } +} + +export function inspectSentryManagementOperation(value: unknown) { + const request = validateSentryManagementRequest(value), + { payload } = managementPayload(request.transactionHex); + const tx = decodeSentryTransaction(request.transactionHex); + return { + operation: request.operation, + proTxHash: payload.kind === 'register' ? undefined : payload.proTxHash, + collateral: + payload.kind === 'register' + ? { txid: payload.collateralTxid, vout: payload.collateralVout } + : undefined, + inputTxids: [...new Set(tx.inputs.map((i) => i.txid))], + }; +} + +export function getSentryManagementCapabilities() { + return { + version: 1 as const, + operations: [ + 'register', + 'updateRegistrar', + 'revoke', + 'registerOperator', + 'rotateOperator', + ] as const, + roles: ['collateral', 'owner', 'operator', 'voting'] as const, + schemes: ['secp256k1', 'bls-basic', 'slh-dsa-shake-128s'] as const, + externalCollateralOnly: true, + precomputedOperatorChildCommitmentRequired: true, + }; +} diff --git a/packages/sysweb3-sentry/src/review.ts b/packages/sysweb3-sentry/src/review.ts new file mode 100644 index 00000000..e8a5303e --- /dev/null +++ b/packages/sysweb3-sentry/src/review.ts @@ -0,0 +1,352 @@ +import { + MAX_MONEY, + Reader, + amount, + concat, + displayHash, + fail, + fromHex, + hash256, + hashBytes, + hex, + integerBytes, + nonzero, + object, + uint, + vector, +} from './bytes.js'; +import { + type ServicePayload, + decodeSentryTransaction, + encodeTransaction, + locateServicePayload, + normalizeNEVM, + currentServiceText, + opReturn, + payloadBytes, + validateNode, +} from './codec.js'; + +import type { + SentryChain, + SentryOperationRequest, + SentryOperationReview, + SentryPQRecord, + SentryReviewContext, +} from './types.js'; + +export const PQ_SERVICE_DOMAIN = 'SYS_PQ_PROVIDER_SERVICE_V1'; + +function validateChain(value: unknown): SentryChain { + const chain = object(value, ['genesisHash', 'era'], 'chain'); + const genesisHash = displayHash(hashBytes(chain.genesisHash, 'genesisHash')); + if (chain.era !== 'legacy-v3' && chain.era !== 'pq-v4') + fail('UNSUPPORTED_ERA', 'Unsupported Sentry era'); + return { genesisHash, era: chain.era }; +} + +export function validateSentryOperationRequest( + value: unknown +): SentryOperationRequest { + const request = object( + value, + ['version', 'operation', 'chain', 'transactionHex'], + 'request' + ); + if (request.version !== 1 || request.operation !== 'updateService') + fail('UNSUPPORTED_OPERATION', 'Unsupported Sentry request'); + const chain = validateChain(request.chain); + const transactionHex = hex(fromHex(request.transactionHex, 'transaction')); + const tx = decodeSentryTransaction(transactionHex); + const { payload } = locateServicePayload(tx); + if (payload.version !== (chain.era === 'pq-v4' ? 4 : 3)) + fail('ERA_MISMATCH', 'Payload version does not match requested era'); + return { version: 1, operation: 'updateService', chain, transactionHex }; +} + +/** Syntactic discovery only. No authorization should rely on this without review. */ +export function inspectSentryOperation(value: unknown): { + proTxHash: string; + inputTxids: string[]; + globalKeyVersion?: number; +} { + const request = validateSentryOperationRequest(value); + const tx = decodeSentryTransaction(request.transactionHex); + const { payload } = locateServicePayload(tx); + return { + proTxHash: payload.proTxHash, + inputTxids: [...new Set(tx.inputs.map((input) => input.txid))], + globalKeyVersion: payload.globalKeyVersion, + }; +} + +/** + * The Core operator signature does not bind fee outputs. Relays must compare + * this as well as verifying authorization before forwarding a prepared intent. + * Only operator signature bytes and fee-input script/witness may change. + */ +export function matchesSentryTransactionIntent( + prepared: unknown, + signed: unknown +): boolean { + try { + const first = validateSentryOperationRequest(prepared); + const second = validateSentryOperationRequest(signed); + if ( + first.chain.genesisHash !== second.chain.genesisHash || + first.chain.era !== second.chain.era + ) + return false; + const unsignedForm = (request: SentryOperationRequest): string => { + const tx = decodeSentryTransaction(request.transactionHex); + const { payload, outputIndex } = locateServicePayload(tx); + payload.signature.fill(0); + tx.outputs[outputIndex].scriptHex = hex(opReturn(payloadBytes(payload))); + for (const input of tx.inputs) { + input.scriptHex = ''; + input.witness = []; + } + return hex(encodeTransaction(tx)); + }; + return unsignedForm(first) === unsignedForm(second); + } catch { + return false; + } +} + +export function serializePQRecord( + record: SentryPQRecord, + allowUnactivated = false +): Uint8Array { + if ( + record.version !== 1 || + record.profile !== 1 || + uint(record.keyVersion, 32, 'keyVersion') === 0 + ) { + fail( + 'INVALID_PQ_RECORD', + 'Unsupported PQ global key record version/profile' + ); + } + const publicKey = fromHex(record.publicKey, 'PQ public key', 32); + if (!nonzero(publicKey)) + fail('INVALID_PQ_RECORD', 'PQ public key cannot be zero'); + const child = fromHex(record.childKeyCommitmentHex, 'child commitment', 80); + const reader = new Reader(child); + const version = reader.number(2), + profile = reader.number(2), + usage = reader.number(2), + depth = reader.number(2); + const generation = reader.number(4); + const firstEpoch = reader.number(4); + if ( + version !== 1 || + profile !== 1 || + usage !== 235 || + depth !== 16 || + generation < 1 || + generation > 16 || + firstEpoch > 0xffffffff - 65535 || + !nonzero(reader.read(32)) || + !nonzero(reader.read(32)) + ) { + fail('INVALID_PQ_RECORD', 'Invalid registered child commitment'); + } + reader.end(); + if ( + uint(record.activatedHeight, 32, 'activatedHeight') === 0 && + !allowUnactivated + ) + fail('INVALID_PQ_RECORD', 'Operator key has not activated'); + return concat( + integerBytes(record.version, 2), + integerBytes(record.profile, 2), + integerBytes(record.keyVersion, 4), + publicKey, + child, + integerBytes(uint(record.activatedHeight, 32, 'activatedHeight'), 4) + ); +} + +/** Exact Core transcript; it is intentionally not the PQ payload serialization. */ +export function serviceAuthorizationDigest( + payload: ServicePayload, + context: SentryReviewContext +): Uint8Array { + if (payload.version === 3) return hash256(payloadBytes(payload, true)); + const record = context.node.pqRecord; + if ( + !record || + record.keyVersion !== payload.globalKeyVersion || + record.keyVersion !== context.node.globalKeyVersion || + hex(fromHex(record.publicKey)) !== + context.node.operatorPublicKey.toLowerCase() + ) { + fail( + 'KEY_MISMATCH', + 'PQ payload must use the current registered operator key' + ); + } + const recordHash = hash256(serializePQRecord(record)); + const address = new Uint8Array(32); + address.set(payload.service.address); + const endpoint = concat( + Uint8Array.of(payload.service.network, payload.service.address.length), + address, + integerBytes(payload.service.port, 2) + ); + const nevm = + payload.nevmAddress === '' + ? Uint8Array.of(0) + : concat( + Uint8Array.of(1), + fromHex(payload.nevmAddress.slice(2), 'NEVM', 20) + ); + return hash256( + concat( + new TextEncoder().encode(PQ_SERVICE_DOMAIN), + hashBytes(context.chain.genesisHash, 'genesisHash'), + integerBytes(1, 2), + integerBytes(payload.version, 2), + hashBytes(payload.proTxHash, 'proTxHash'), + integerBytes(payload.globalKeyVersion!, 4), + integerBytes(record.version, 2), + integerBytes(record.profile, 2), + recordHash, + endpoint, + vector(payload.payoutScript), + nevm, + payload.inputsHash + ) + ); +} + +export function reviewFunding( + request: { transactionHex: string }, + context: { + previousTransactions: string[]; + maxFeeSatoshis: string; + node?: { collateralOutpoint?: { txid: string; vout: number } }; + } +): bigint { + if ( + !Array.isArray(context.previousTransactions) || + context.previousTransactions.length > 256 + ) + fail('INVALID_FUNDING', 'Exact funding transactions are required'); + const tx = decodeSentryTransaction(request.transactionHex); + const previous = new Map( + context.previousTransactions.map((raw) => { + const transaction = decodeSentryTransaction(raw); + return [transaction.txid, transaction] as const; + }) + ); + if (previous.size !== context.previousTransactions.length) + fail('INVALID_FUNDING', 'Duplicate funding transactions'); + const seen = new Set(); + const usedPrevious = new Set(); + let totalIn = 0n; + for (const input of tx.inputs) { + hashBytes(input.txid, 'input txid'); + const key = `${input.txid}:${input.vout}`; + const collateral = context.node?.collateralOutpoint; + if ( + collateral && + input.txid === collateral.txid.toLowerCase() && + input.vout === collateral.vout + ) { + fail( + 'COLLATERAL_SPEND', + 'A service update cannot spend the node collateral' + ); + } + if (seen.has(key)) fail('DUPLICATE_INPUT', 'Duplicate transaction input'); + seen.add(key); + const prev = previous.get(input.txid); + if (!prev || !prev.outputs[input.vout]) + fail('INVALID_FUNDING', 'Missing exact funding prevout'); + usedPrevious.add(input.txid); + totalIn += amount(prev.outputs[input.vout].valueSatoshis, 'input amount'); + if (totalIn > MAX_MONEY) + fail('INVALID_AMOUNT', 'Total funding exceeds MAX_MONEY'); + } + if (usedPrevious.size !== previous.size) + fail('INVALID_FUNDING', 'Unreferenced funding transaction'); + const totalOut = tx.outputs.reduce( + (sum, output) => sum + amount(output.valueSatoshis, 'output amount'), + 0n + ); + const fee = totalIn - totalOut; + if (fee < 0n || fee > amount(context.maxFeeSatoshis, 'maximum fee')) + fail( + 'FEE_LIMIT', + 'Funding fee is negative or exceeds the wallet safety limit' + ); + return fee; +} + +export function reviewSentryOperation( + value: unknown, + context: SentryReviewContext +): SentryOperationReview { + const request = validateSentryOperationRequest(value); + const expectedChain = validateChain(context.chain); + if ( + request.chain.genesisHash !== expectedChain.genesisHash || + request.chain.era !== expectedChain.era + ) { + fail( + 'CHAIN_MISMATCH', + 'Requested chain/era does not match independently resolved wallet chain' + ); + } + validateNode(context.node, context.chain); + const tx = decodeSentryTransaction(request.transactionHex); + const { payload, outputIndex } = locateServicePayload(tx); + if (payload.proTxHash !== context.node.proTxHash.toLowerCase()) + fail('NODE_MISMATCH', 'Payload targets a different registered node'); + const fee = reviewFunding(request, context); + const authorizationHash = hex(serviceAuthorizationDigest(payload, context)); + return { + operation: 'updateService', + scheme: payload.version === 4 ? 'slh-dsa-shake-128s' : 'bls-basic', + chain: expectedChain, + proTxHash: payload.proTxHash, + changes: { + service: { + previous: currentServiceText(context.node.service), + next: payload.service.text, + }, + operatorPayoutScript: { + previous: hex(fromHex(context.node.operatorPayoutScript)), + next: hex(payload.payoutScript), + }, + nevmAddress: { + previous: normalizeNEVM(context.node.nevmAddress), + next: payload.nevmAddress, + }, + }, + feeSatoshis: fee.toString(), + inputCount: tx.inputs.length, + outputs: tx.outputs.map((output, i) => ({ + ...output, + isPayload: i === outputIndex, + })), + authorizationHash, + }; +} + +export function getSentryCapabilities() { + return { + version: 1 as const, + operations: ['updateService'] as const, + eras: ['legacy-v3', 'pq-v4'] as const, + schemes: ['bls-basic', 'slh-dsa-shake-128s'] as const, + keyRoles: ['operator'] as const, + feeSigning: 'separate-after-operator-authorization' as const, + protocolSources: { + legacy: 'dd1457d89a5906288d0c0813a157413e79f75f6d', + pq: 'fa24600369c7afbe338afc09d07c840d21c2e205', + }, + }; +} diff --git a/packages/sysweb3-sentry/src/signing.ts b/packages/sysweb3-sentry/src/signing.ts new file mode 100644 index 00000000..af6cd1ee --- /dev/null +++ b/packages/sysweb3-sentry/src/signing.ts @@ -0,0 +1,254 @@ +import { equal, fail, fromHex, hex, nonzero } from './bytes.js'; +import { + decodeSentryTransaction, + encodeTransaction, + locateServicePayload, + opReturn, + payloadBytes, +} from './codec.js'; +import { + PQ_SERVICE_DOMAIN, + reviewSentryOperation, + validateSentryOperationRequest, +} from './review.js'; + +import type { + SentryImportedKey, + SentryOperationResponse, + SentryReviewContext, + SentryScheme, +} from './types.js'; + +const BLS_BASIC_DST = 'BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_NUL_'; +const BLS_SCALAR_ORDER = + 0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001n; + +function assertScheme(scheme: SentryScheme): void { + if (scheme !== 'bls-basic' && scheme !== 'slh-dsa-shake-128s') + fail('UNSUPPORTED_SCHEME', 'Unsupported Sentry operator scheme'); +} + +/** Import is local-only. SLH imports recompute the root, as Core does. */ +export async function importSentryOperatorKey( + scheme: SentryScheme, + secretKeyHex: string +): Promise { + assertScheme(scheme); + const secret = fromHex( + secretKeyHex, + 'operator secret key', + scheme === 'bls-basic' ? 32 : 64 + ); + let publicKey: Uint8Array; + try { + if (scheme === 'bls-basic') { + // Core imports an exact scalar, not a scalar reduced modulo r. Noble's + // point multiplication accepts broader integer encodings, so constrain it. + const scalar = BigInt(`0x${hex(secret)}`); + if (scalar === 0n || scalar >= BLS_SCALAR_ORDER) + fail('INVALID_SECRET_KEY', 'Invalid BLS scalar'); + const { bls12_381 } = await import('@noble/curves/bls12-381.js'); + publicKey = bls12_381.longSignatures.getPublicKey(secret).toBytes(); + } else { + const { slh_dsa_shake_128s } = await import( + '@noble/post-quantum/slh-dsa.js' + ); + const reconstructed = slh_dsa_shake_128s.keygen(secret.slice(0, 48)); + try { + if (!equal(secret, reconstructed.secretKey)) + fail( + 'INVALID_SECRET_KEY', + 'SLH secret key root does not match its seed' + ); + publicKey = reconstructed.publicKey.slice(); + } finally { + reconstructed.secretKey.fill(0); + } + } + return { scheme, publicKey: hex(publicKey), secretKey: hex(secret) }; + } catch { + // Never pass third-party exception details (which may contain key material) + // across the caller's dapp boundary. + return fail('INVALID_SECRET_KEY', 'Invalid Sentry operator secret key'); + } finally { + secret.fill(0); + } +} + +/** Explicit seed generation avoids confusing a SLH seed with an encoded key. */ +export async function deriveSentryOperatorKey( + scheme: SentryScheme, + seedHex: string +): Promise { + assertScheme(scheme); + const seed = fromHex( + seedHex, + 'key generation seed', + scheme === 'bls-basic' ? 32 : 48 + ); + let secret: Uint8Array | undefined; + try { + if (scheme === 'bls-basic') { + const { bls12_381 } = await import('@noble/curves/bls12-381.js'); + const { bytesToNumberBE } = await import('@noble/curves/utils.js'); + const { hkdf } = await import('@noble/hashes/hkdf.js'); + const { sha256 } = await import('@noble/hashes/sha2.js'); + // Match Core's BasicSchemeMPL::KeyGen / HDKeys::KeyGen exactly. + // Noble keygen consumes 48 bytes of direct entropy; it is not this + // 32-byte IKM -> HKDF-SHA256 -> Fr derivation. + const ikm = new Uint8Array(seed.length + 1); + ikm.set(seed); + let okm: Uint8Array | undefined; + try { + okm = hkdf( + sha256, + ikm, + new TextEncoder().encode('BLS-SIG-KEYGEN-SALT-'), + Uint8Array.of(0, 48), + 48 + ); + const field = bls12_381.fields.Fr; + secret = field.toBytes(field.create(bytesToNumberBE(okm))); + } finally { + ikm.fill(0); + okm?.fill(0); + } + } else { + const { slh_dsa_shake_128s } = await import( + '@noble/post-quantum/slh-dsa.js' + ); + secret = slh_dsa_shake_128s.keygen(seed).secretKey; + } + return await importSentryOperatorKey(scheme, hex(secret)); + } finally { + seed.fill(0); + secret?.fill(0); + } +} + +export async function signSentryOperation( + value: unknown, + context: SentryReviewContext, + importedKey: SentryImportedKey +): Promise { + // Do not let account/RPC cache mutation during lazy crypto loading alter the + // reviewed context. The caller still rechecks liveness before broadcasting. + context = { + ...context, + chain: { ...context.chain }, + previousTransactions: [...context.previousTransactions], + node: { + ...context.node, + pqRecord: context.node.pqRecord + ? { ...context.node.pqRecord } + : undefined, + collateralOutpoint: context.node.collateralOutpoint + ? { ...context.node.collateralOutpoint } + : undefined, + }, + }; + importedKey = { ...importedKey }; + const request = validateSentryOperationRequest(value); + const review = reviewSentryOperation(request, context); + if (review.scheme !== importedKey.scheme) + fail('KEY_MISMATCH', 'Selected operator key uses another scheme'); + const tx = decodeSentryTransaction(request.transactionHex); + if ( + tx.inputs.some( + (input) => input.scriptHex !== '' || input.witness.length !== 0 + ) + ) { + fail( + 'SIGNED_FUNDING', + 'Fee inputs must be signed after operator authorization' + ); + } + const { payload, outputIndex } = locateServicePayload(tx); + if (nonzero(payload.signature)) + fail( + 'ALREADY_AUTHORIZED', + 'Service transaction already contains an operator signature' + ); + const key = await importSentryOperatorKey( + importedKey.scheme, + importedKey.secretKey + ); + if ( + key.publicKey !== context.node.operatorPublicKey.toLowerCase() || + key.publicKey !== importedKey.publicKey.toLowerCase() + ) { + fail('KEY_MISMATCH', 'Selected key does not match the registered operator'); + } + const secret = fromHex(key.secretKey, 'operator secret key'); + const digest = fromHex(review.authorizationHash, 'authorization digest', 32); + try { + if (review.scheme === 'bls-basic') { + const { bls12_381 } = await import('@noble/curves/bls12-381.js'); + const basic = bls12_381.longSignatures; + payload.signature = basic + .sign(basic.hash(digest, BLS_BASIC_DST), secret) + .toBytes(); + } else { + const { slh_dsa_shake_128s } = await import( + '@noble/post-quantum/slh-dsa.js' + ); + payload.signature = slh_dsa_shake_128s.sign(digest, secret, { + context: new TextEncoder().encode(PQ_SERVICE_DOMAIN), + extraEntropy: false, + }); + } + tx.outputs[outputIndex].scriptHex = hex(opReturn(payloadBytes(payload))); + const transactionHex = hex(encodeTransaction(tx)); + const result = { ...request, transactionHex }; + if (!(await verifySentryOperation(result, context))) + fail('SIGNATURE_FAILED', 'Operator authorization did not verify'); + return { + version: 1, + operation: 'updateService', + transactionHex, + operatorPublicKey: key.publicKey, + authorizationHash: review.authorizationHash, + }; + } finally { + secret.fill(0); + digest.fill(0); + } +} + +/** Works both before and after the distinct fee-input signing step. */ +export async function verifySentryOperation( + value: unknown, + context: SentryReviewContext +): Promise { + try { + const request = validateSentryOperationRequest(value); + const review = reviewSentryOperation(request, context); + const { payload } = locateServicePayload( + decodeSentryTransaction(request.transactionHex) + ); + if (!nonzero(payload.signature)) return false; + const digest = fromHex(review.authorizationHash, 'authorization hash', 32); + const publicKey = fromHex( + context.node.operatorPublicKey, + 'operator public key', + review.scheme === 'bls-basic' ? 48 : 32 + ); + if (review.scheme === 'bls-basic') { + const { bls12_381 } = await import('@noble/curves/bls12-381.js'); + const basic = bls12_381.longSignatures; + return basic.verify( + payload.signature, + basic.hash(digest, BLS_BASIC_DST), + publicKey + ); + } + const { slh_dsa_shake_128s } = await import( + '@noble/post-quantum/slh-dsa.js' + ); + return slh_dsa_shake_128s.verify(payload.signature, digest, publicKey, { + context: new TextEncoder().encode(PQ_SERVICE_DOMAIN), + }); + } catch { + return false; + } +} diff --git a/packages/sysweb3-sentry/src/types.ts b/packages/sysweb3-sentry/src/types.ts new file mode 100644 index 00000000..dcbb14e7 --- /dev/null +++ b/packages/sysweb3-sentry/src/types.ts @@ -0,0 +1,114 @@ +export type SentryScheme = 'bls-basic' | 'slh-dsa-shake-128s'; +export type SentryEra = 'legacy-v3' | 'pq-v4'; + +export interface SentryChain { + genesisHash: string; + era: SentryEra; +} + +/** Exact independently fetched Core GlobalKeyRecord. Hashes use display order. */ +export interface SentryPQRecord { + version: number; + profile: number; + keyVersion: number; + publicKey: string; + childKeyCommitmentHex: string; + activatedHeight: number; +} + +export interface SentryNodeState { + proTxHash: string; + operatorPublicKey: string; + service: string; + operatorPayoutScript: string; + nevmAddress: string; + globalKeyVersion?: number; + pqRecord?: SentryPQRecord; + collateralOutpoint?: { txid: string; vout: number }; +} + +export interface SentryOperationRequest { + version: 1; + operation: 'updateService'; + chain: SentryChain; + transactionHex: string; +} + +/** This context belongs to the wallet. Do not accept it from a dapp. */ +export interface SentryReviewContext { + chain: SentryChain; + node: SentryNodeState; + previousTransactions: string[]; + maxFeeSatoshis: string; +} + +export interface SentryOperationReview { + operation: 'updateService'; + scheme: SentryScheme; + chain: SentryChain; + proTxHash: string; + changes: { + service: { previous: string; next: string }; + operatorPayoutScript: { previous: string; next: string }; + nevmAddress: { previous: string; next: string }; + }; + feeSatoshis: string; + inputCount: number; + outputs: { valueSatoshis: string; scriptHex: string; isPayload: boolean }[]; + /** Digest in byte order passed to the cryptographic signer, not uint256 display order. */ + authorizationHash: string; +} + +/** Never serialize this type into a dapp response, log, telemetry or URL. */ +export interface SentryImportedKey { + scheme: SentryScheme; + publicKey: string; + secretKey: string; +} + +export interface SentryOperationResponse { + version: 1; + operation: 'updateService'; + transactionHex: string; + operatorPublicKey: string; + authorizationHash: string; +} + +export interface SentryTxInput { + txid: string; + vout: number; + sequence?: number; +} + +export interface SentryTxOutput { + valueSatoshis: string; + scriptHex: string; +} + +export interface BuildSentryServiceUpdate { + chain: SentryChain; + node: SentryNodeState; + service?: string; + operatorPayoutScript?: string; + /** Undefined preserves the registered address; '' explicitly removes it. */ + nevmAddress?: string; + inputs: SentryTxInput[]; + outputs: SentryTxOutput[]; + lockTime?: number; +} + +export interface DecodedSentryTransaction { + version: number; + inputs: { + txid: string; + vout: number; + scriptHex: string; + sequence: number; + witness: string[]; + }[]; + outputs: SentryTxOutput[]; + lockTime: number; + txid: string; + weight: number; + virtualSize: number; +} diff --git a/packages/sysweb3-sentry/test/core-vectors.test.mjs b/packages/sysweb3-sentry/test/core-vectors.test.mjs new file mode 100644 index 00000000..e6b08e60 --- /dev/null +++ b/packages/sysweb3-sentry/test/core-vectors.test.mjs @@ -0,0 +1,137 @@ +import { test } from 'node:test'; +import assert from 'node:assert/strict'; +import { readFileSync } from 'node:fs'; +import { bls12_381 } from '@noble/curves/bls12-381.js'; +import { slh_dsa_shake_128s } from '@noble/post-quantum/slh-dsa.js'; +import { + buildSentryServiceUpdate, + decodeSentryTransaction, + deriveSentryOperatorKey, + importSentryOperatorKey, +} from '../dist/index.js'; +import { locateServicePayload, payloadBytes } from '../dist/codec.js'; +import { + PQ_SERVICE_DOMAIN, + serializePQRecord, + serviceAuthorizationDigest, +} from '../dist/review.js'; +import { fromHex, hash256, hex } from '../dist/bytes.js'; + +const vectors = JSON.parse( + readFileSync(new URL('./fixtures/core-vectors.json', import.meta.url), 'utf8') +); +const DST = 'BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_NUL_'; +const base = { + proTxHash: '11'.repeat(32), + service: '127.0.0.1:18367', + operatorPayoutScript: '0014' + '33'.repeat(20), + nevmAddress: '0x' + '55'.repeat(20), +}; +const funding = [{ txid: '22'.repeat(32), vout: 1 }]; + +test('exact Core BasicSchemeMPL public key, SerializeHash preimage and signature vector', async () => { + const key = await importSentryOperatorKey( + 'bls-basic', + '00'.repeat(31) + '01' + ); + assert.equal(key.publicKey, vectors.legacy.publicKey); + const chain = { genesisHash: '44'.repeat(32), era: 'legacy-v3' }; + const node = { ...base, operatorPublicKey: key.publicKey }; + const request = buildSentryServiceUpdate({ + chain, + node, + inputs: funding, + outputs: [], + }); + const { payload } = locateServicePayload( + decodeSentryTransaction(request.transactionHex) + ); + const preimage = payloadBytes(payload, true); + assert.equal(hex(payload.inputsHash), vectors.legacy.inputsHash); + assert.equal(hex(preimage), vectors.legacy.payloadPreimageHex); + assert.equal(hex(hash256(preimage)), vectors.legacy.authorizationHash); + const basic = bls12_381.longSignatures; + const point = basic.hash(fromHex(vectors.legacy.authorizationHash), DST); + assert.equal( + hex(basic.sign(point, fromHex(key.secretKey)).toBytes()), + vectors.legacy.signature + ); + assert.equal( + basic.verify( + fromHex(vectors.legacy.signature), + point, + fromHex(key.publicKey) + ), + true + ); +}); + +test( + 'exact Core PQ key, record hash transcript, context and deterministic signature vector', + { timeout: 120_000 }, + async () => { + const key = await deriveSentryOperatorKey( + 'slh-dsa-shake-128s', + vectors.pq.seed + ); + assert.equal(key.secretKey, vectors.pq.secretKey); + assert.equal(key.publicKey, vectors.pq.publicKey); + const record = { + version: 1, + profile: 1, + keyVersion: 1, + publicKey: key.publicKey, + childKeyCommitmentHex: vectors.pq.childKeyCommitmentHex, + activatedHeight: 1440, + }; + assert.equal(hex(serializePQRecord(record)), vectors.pq.globalRecordHex); + const chain = { genesisHash: vectors.pq.genesisHash, era: 'pq-v4' }; + const node = { + ...base, + operatorPublicKey: key.publicKey, + globalKeyVersion: 1, + pqRecord: record, + }; + const request = buildSentryServiceUpdate({ + chain, + node, + inputs: funding, + outputs: [], + }); + const { payload } = locateServicePayload( + decodeSentryTransaction(request.transactionHex) + ); + const context = { + chain, + node, + previousTransactions: [], + maxFeeSatoshis: '0', + }; + const digest = serviceAuthorizationDigest(payload, context); + assert.equal(hex(digest), vectors.pq.authorizationHash); + const domain = new TextEncoder().encode(PQ_SERVICE_DOMAIN); + assert.equal(hex(domain), vectors.pq.contextHex); + const signature = slh_dsa_shake_128s.sign(digest, fromHex(key.secretKey), { + context: domain, + extraEntropy: false, + }); + assert.equal(hex(signature), vectors.pq.signature); + assert.equal( + slh_dsa_shake_128s.verify( + fromHex(vectors.pq.signature), + digest, + fromHex(key.publicKey), + { context: domain } + ), + true + ); + assert.equal( + slh_dsa_shake_128s.verify( + fromHex(vectors.pq.signature), + digest, + fromHex(key.publicKey) + ), + false + ); + } +); diff --git a/packages/sysweb3-sentry/test/fixture.mjs b/packages/sysweb3-sentry/test/fixture.mjs new file mode 100644 index 00000000..b4b2aacf --- /dev/null +++ b/packages/sysweb3-sentry/test/fixture.mjs @@ -0,0 +1,76 @@ +import { + buildSentryServiceUpdate, + decodeSentryTransaction, + importSentryOperatorKey, +} from '../dist/index.js'; +import { encodeTransaction } from '../dist/codec.js'; +import { hex } from '../dist/bytes.js'; + +export const BLS_SK = '00'.repeat(31) + '01'; +export const GENESIS = '12'.repeat(32); +export const PRO_TX = '23'.repeat(32); +export const PAYOUT = '0014' + '34'.repeat(20); +export const OLD_NEVM = '0x' + '45'.repeat(20); +export const NEW_NEVM = '0x' + '56'.repeat(20); + +export function previousTransaction() { + // Synthetic coinbase funding fixture. Its hash is computed from the bytes, + // not supplied as an unauthenticated amount alongside the service request. + return hex( + encodeTransaction({ + version: 2, + lockTime: 0, + inputs: [ + { + txid: '00'.repeat(32), + vout: 0xffffffff, + sequence: 0xffffffff, + scriptHex: '0101', + witness: [], + }, + ], + outputs: [{ valueSatoshis: '1000000', scriptHex: PAYOUT }], + }) + ); +} + +export async function legacyFixture(overrides = {}) { + const key = await importSentryOperatorKey('bls-basic', BLS_SK); + const previous = previousTransaction(); + const chain = { genesisHash: GENESIS, era: 'legacy-v3' }; + const node = { + proTxHash: PRO_TX, + operatorPublicKey: key.publicKey, + service: '127.0.0.1:18367', + operatorPayoutScript: PAYOUT, + nevmAddress: OLD_NEVM, + ...overrides, + }; + const request = buildSentryServiceUpdate({ + chain, + node, + nevmAddress: NEW_NEVM, + inputs: [{ txid: decodeSentryTransaction(previous).txid, vout: 0 }], + outputs: [{ valueSatoshis: '998000', scriptHex: PAYOUT }], + }); + const context = { + chain, + node, + previousTransactions: [previous], + maxFeeSatoshis: '10000', + }; + return { key, request, context }; +} + +export function replacePayload(request, mutate) { + // Helpers use the actual codec instead of making review fields authoritative. + return import('../dist/codec.js').then( + ({ locateServicePayload, opReturn, payloadBytes }) => { + const tx = decodeSentryTransaction(request.transactionHex); + const { payload, outputIndex } = locateServicePayload(tx); + mutate(payload); + tx.outputs[outputIndex].scriptHex = hex(opReturn(payloadBytes(payload))); + return { ...request, transactionHex: hex(encodeTransaction(tx)) }; + } + ); +} diff --git a/packages/sysweb3-sentry/test/fixtures/README.md b/packages/sysweb3-sentry/test/fixtures/README.md new file mode 100644 index 00000000..1f385571 --- /dev/null +++ b/packages/sysweb3-sentry/test/fixtures/README.md @@ -0,0 +1,49 @@ +# Core compatibility vectors + +`core-vectors.json` contains only public synthetic test keys, never wallet keys. +The 48-byte SLH generation seed is the sequence `00 01 ... 2f`; the BLS private +scalar is the integer one. + +The accompanying C++ generator was compiled against: + +* Syscoin legacy BasicSchemeMPL library from current Core + `dd1457d89a5906288d0c0813a157413e79f75f6d`; +* Core PR #609 source `fa24600369c7afbe338afc09d07c840d21c2e205`, including + `pq_global_auth.cpp`, `pq_chainlock_types.cpp`, `slhdsa.cpp`, and Core's + bundled SLH-DSA-SHAKE-128s implementation. + +It uses Core `CDataStream`, `CHash256`, `GetProviderServiceAuthorizationHash`, +`GetGlobalAuthContext`, and `slhdsa::SignDeterministic`, not the TypeScript SDK. +The legacy service preimage omits the signature as `SER_GETHASH` requires. +Provider payload signatures are domain-specific and these vectors use fabricated +proTx/prevout hashes, not spendable transactions or on-chain registrations. + +The SDK tests compare exact byte preimages, registered-record serialization, +input hashes, authorization digests, public keys and deterministic signatures in +both implementations. Separate integration tests use correctly hashed synthetic +funding transactions for the complete wallet review/sign/verify flow. + +`generate-management-vectors.cpp` and `management-core-vectors.json` extend this +coverage to registration, registrar updates, revocation, owner proofs and global +operator enrollment/rotation. The generator uses Core CDataStream field layouts, +Core Bech32 address encoding, the same libsecp256k1 recoverable RFC6979 signing +routine as CKey::SignCompact, BasicSchemeMPL, and the actual Core global/PQ +authorization functions. Registration/registrar owner domains are serialized +explicitly as specified in Core's providertx.cpp. Long secondary SLH signatures +are represented by SHA256d hashes in this fixture to limit checked-in size; the +SDK tests recompute the full signature and compare its hash. + +The management funding transaction is a synthetic coinbase with a correctly +computed transaction ID, enabling full SDK fee review in those vector tests. +Its external registration collateral hash is intentionally fictitious: that +part of the vector tests the protocol encoding/message only, never an on-chain +registration claim. Complete collateral validation is covered separately by the +management integration tests. + +`bls-keygen-vectors.cpp` and `bls-keygen-vectors.json` cover the separate BLS +seed-generation contract. They were generated with the same Core +`BasicSchemeMPL::KeyGen` / `HDKeys::KeyGen` implementation (unchanged at legacy +merge `d738769e5b3d1320127670a3dc1a028c9ecbaeed`). Inputs are synthetic 32-byte +all-zero, all-one, all-FF and ascending-byte seeds. These compare the exact +private scalar and compressed public key, not just sign/verify self-consistency. +The all-zero seed vector also matches the bundled Dash BLS Chia test vector. diff --git a/packages/sysweb3-sentry/test/fixtures/bls-keygen-vectors.cpp b/packages/sysweb3-sentry/test/fixtures/bls-keygen-vectors.cpp new file mode 100644 index 00000000..48813850 --- /dev/null +++ b/packages/sysweb3-sentry/test/fixtures/bls-keygen-vectors.cpp @@ -0,0 +1,37 @@ +// Copyright (c) 2026 The Syscoin Core developers +// Distributed under the MIT software license. +// Generate public synthetic vectors with Core's bundled BasicSchemeMPL. +// Build against the legacy Core dashbls library, not a replacement BLS implementation. +#include +#include +#include +#include + +template std::string Hex(const R& bytes) +{ + static constexpr char hex[] = "0123456789abcdef"; + std::string out; + for (const auto value : bytes) { + out += hex[static_cast(value) >> 4]; + out += hex[static_cast(value) & 15]; + } + return out; +} + +int main() +{ + std::vector> seeds{ + std::vector(32, 0), std::vector(32, 1), std::vector(32, 255), + }; + std::vector sequence(32); + for (size_t i = 0; i < sequence.size(); ++i) sequence[i] = i; + seeds.push_back(sequence); + std::puts("["); + for (size_t i = 0; i < seeds.size(); ++i) { + const auto key = bls::BasicSchemeMPL().KeyGen(seeds[i]); + std::printf(" {\"seed\":\"%s\",\"secretKey\":\"%s\",\"publicKey\":\"%s\"}%s\n", + Hex(seeds[i]).c_str(), Hex(key.Serialize()).c_str(), + Hex(key.GetG1Element().Serialize(false)).c_str(), i + 1 == seeds.size() ? "" : ","); + } + std::puts("]"); +} diff --git a/packages/sysweb3-sentry/test/fixtures/bls-keygen-vectors.json b/packages/sysweb3-sentry/test/fixtures/bls-keygen-vectors.json new file mode 100644 index 00000000..4a8b8361 --- /dev/null +++ b/packages/sysweb3-sentry/test/fixtures/bls-keygen-vectors.json @@ -0,0 +1,6 @@ +[ + {"seed":"0000000000000000000000000000000000000000000000000000000000000000","secretKey":"4a353be3dac091a0a7e640620372f5e1e2e4401717c1e79cac6ffba8f6905604","publicKey":"85695fcbc06cc4c4c9451f4dce21cbf8de3e5a13bf48f44cdbb18e2038ba7b8bb1632d7911ef1e2e08749bddbf165352"}, + {"seed":"0101010101010101010101010101010101010101010101010101010101010101","secretKey":"6fc9d9a2b05fd1f0e51bc91041a03be8657081f272ec281aff731624f0d1c220","publicKey":"aefe1789d6476f60439e1168f588ea16652dc321279f05a805fbc63933e88ae9c175d6c6ab182e54af562e1a0dce41bb"}, + {"seed":"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","secretKey":"4ecb8197b8a2af28bfadf88f8084662c078bed1fa6970fd89b95ed541e35b3be","publicKey":"96a5412d094be0d2017da0b7f17fe32540ad8356e59d181aec873543cc01433cf8cb251d3e1f950adfeeca9075a7e89c"}, + {"seed":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f","secretKey":"4a18022aa9097511134fcf6c024da289058c76d14de712ba264e50e306b6d6e3","publicKey":"8f336467f057b373bb3c43815a10ec131119d1bf50c14fa3f9ad86c0ec074f920f936a5315a8365a37fee0afa34c32c6"} +] diff --git a/packages/sysweb3-sentry/test/fixtures/core-vectors.json b/packages/sysweb3-sentry/test/fixtures/core-vectors.json new file mode 100644 index 00000000..58371d69 --- /dev/null +++ b/packages/sysweb3-sentry/test/fixtures/core-vectors.json @@ -0,0 +1 @@ +{"legacy":{"payloadPreimageHex":"0300111111111111111111111111111111111111111111111111111111111111111100000000000000000000ffff7f00000147bf16001433333333333333333333333333333333333333336dbf69395437da4b2f40afd236bdcdea3f7515247f8573ec1ed021d225f52a94145555555555555555555555555555555555555555","inputsHash":"6dbf69395437da4b2f40afd236bdcdea3f7515247f8573ec1ed021d225f52a94","authorizationHash":"d98258eb8c34c9ca7d6a370590e515946f572532f0d62af40670959bbfb5f3ad","publicKey":"97f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb","signature":"b4f2a1df2243a053fe6cf21fd5c6a63ccc38cfa6a7fc89c44ad05745bdf835857321945058169227d2cbb3de5c597f8f07955fbfa7c5e0ebf22c5cb7d391444e39124c56e524de901454b58db90b0e692e20fb2c4fb52c56e7977d5473cced37"},"pq":{"genesisHash":"4444444444444444444444444444444444444444444444444444444444444444","seed":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f","secretKey":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f89fd81fdbb5b94129b14761bdc6bf682","publicKey":"202122232425262728292a2b2c2d2e2f89fd81fdbb5b94129b14761bdc6bf682","globalRecordHex":"0100010001000000202122232425262728292a2b2c2d2e2f89fd81fdbb5b94129b14761bdc6bf68201000100eb001000010000000700000066666666666666666666666666666666666666666666666666666666666666667777777777777777777777777777777777777777777777777777777777777777a0050000","childKeyCommitmentHex":"01000100eb001000010000000700000066666666666666666666666666666666666666666666666666666666666666667777777777777777777777777777777777777777777777777777777777777777","authorizationHash":"6b167789ef5b9b9930df342858ff82ea8150e21b6e837cbf90eb8ce9f222105d","contextHex":"5359535f50515f50524f56494445525f534552564943455f5631","signature":"bfc5c840e2d613ebb016772821626e16f4595a2fc532c4adb30d79af388db72b0cbee999eb532c010afd6bcaa5e99e2977cf0b51fe960c254fca6ef0eea1a2edea1a774c35aa56d84d26e36b7059fa20a62b0861a100299bba67f19506b52bdd25ae5fd614d540f881903b50237026345e478f91e23042efa057f589fa2cf073347d2e0ce544bd3596286ec24858f4fdf5a3e05a5dfea0f7956124006ac88b668ba84000102308a30ee5e8e1d36fced60f294b094db9912b82312d1d8e9ca3fd9d9b9b8a40a7ca38c4a1d0afe66b3418cd8bfd8fe4e6f5f189d371d6838bcdceef9bc5920005434d417e9caeeff3bf6459fbf45a0759c3f8bcc9d271820fd187c136b7c9301cfc2e4521d7aa24c3c1e3d56c76d843c3d1da6b29f4ce186aa6dcace44e9e40d1139089bb7a253509714cbd91ecc75e0463e3cf571251cfb1cea4b0403008b479d3b3b88d81a2c1e3f6bc8102c3275f9b72e77f017f7e9c893634be6a8c0fe9867f41277ee67027816727b1550cede64f81eb9f22c31776276cbfd8a70073fe9c29f3a2d6db009d34abef3433137ae45acb393491096636faf6fba6555d188670f96dca7d5fdf4c59ed85ada91e5d643b93167dae6aaebe3fb6385c5196aa517756646898c0024361d51c927b26fe9f00fa5bd50bf0f19383d1976c66651bf68bd8e8f8a520eb94ea6336fbe9eb7659d43a1a5433450a8a79c23bca86fcbf37043af83d4242202643709d4904cb3f62cb943c7a42dd2986b6efa717ff08cef06dc99c021db3d0eb79682d5b995aedcd52c3b6bccea1fa9adbd795c4adf33b0a6c475cdd9ce68dba8be46febd51c0ae532cdabdd6d794d5e29047b6cd24427b7959095099d423d1042e5e38af8a0d033eb70a0ee5e153bad1dd14221c7c3f8fe75a07cd232143f57287127f03d62da4395a07977f1ba033e6f0aed9323abb4200a7c032a039e4b59a36bc598388fa433ee0da50989cffe547d9a6fd8e2265e674b2f48b5cd526fc7286ab9cc360faece1526c6997e39a9b1c50bcd5bc9a2803aa536869e8372bfa0b3541e8b516a7d09ef78e5946652d5746d0f5e48ab6945f8f1aa8e5746f259d4777be03bf87e277d8ba7f10d995c71cd3849064da9cf16edb491baaa73f955b197a6a89239bc7aeb9b509760f8b17225ce37561af92a7de15d69dd35eff2ae38ca29a00ba94bce4520f165f78b37ad9845bd8439fc0b763faef77219ad169d55bbb3c0d051f965a0bff02bf16c3e431c4bbb2d23b850320766ddbedad5a87f69d24b3cc8f7b90382b64133da03470984ee3a12d5768a08b674ebc2d95752639d7ce0ded6f9e5682ee59c6286dd70b0558e38647e8db0a57d791eb7cf4324c738914540f7dfa47a9b8e7acd365a77a8b2b26c81a54739cfeca508c175215404064567180229f87cb51290da97a3aa64924abf41c0e030e5950e392c0f93d85b910659e174ebf35c67641b01fde54aa74f26be4b2d08fb4637c9a78a4462decf28cbb7cb4aa11fdfc67d0a3384fa65b87fa2998d2fa361fe8bc2788e25b69670ef2bd944a5b9824cbb1e3b90bb6cd35542299a2b9639b7fd9b47a1326f27604646e763e0d11107e850f8ca4b880efd12dd29ffc4c378535e2d8e039b4d12f8f240b28a8bba705b54ace2bfb7e0d0b87928ab6be2b4d895348a877b6966185f975c3634e9f0f198c5189aac3e0fc7d8ff5872c9d53877342b2017a041a384ec38b872f706cdc740ac6cdbdbb6b1e8483b8a6b5e9d807a6930bdf02f67655d0a2bea9d0183952b4d29a5713c8f8ee8baae74e43bf6a54ff85b9dd1302e67bc9a21e222004d267d206a7415cb26b3b70c453e2a95e45723e58adea03e421e30101bab202012ab3a560a217736ccd8a0203d110eedffa347acc5e67a88175004ebc20178fc362279f7d7b1cc2cdc10ee53453a0f914ffa8327d31cb1cedc2cdb782a5d6dd7cfad1f95fc62ddb9f2f0024306827df1f57dc4706a3ee51227151388a700fd3d552203b2787eb1cb431371b8c5a7961a3e734640c2b8b6dac412eab7d269332471817126d094fd5b4dacb4e98b7593da22582a6f5859ffcec496305be9bb03489a55d2859e8298c09435cb60f73c3082407b9fd7b55f268983efc056b3dbc0aabecd0b900f886194382d00f1d44a90a26be4f89f9ee1799b6e7cff2f28a0f63925de9541c3c7778ce362c8d447963ddeffb45354756b2f72fab583f0092817393db62f7bb3dc25dc715d34349150d353d2d86689c150eec065c09ff8f2fadda4fb08ca1733c163c5e77b833e053cf984c85089c2144da143f24067ccaeaf786246749057a99e879f879c2c7c7f93ce85020fbd246cf3a116d749a2ebdf54b819d4f0d6ad22c84950b08942c5db1167210c260bfc3a4e6ec3b4d2f62a82a208bad8ab8db3b5cdb0b7f27908f8a6e1c10b90f09e5f94dbe0be747a0d4068f383648bdd80dcb6db336bd5e02add897fc6a2f695b48ea4904587e4e986f2f3cbc1e5b9e4ed8d306a1962a0c302b3d3a5cd431e4b29b0479f4dac60b4f02125d5ee3d25cff0e489306c8aae7ac6d17978fdb5d7563996fe83fa6526b1bfc7bc8a58e5bd4c9eaecdb9292bd53a4de79bfcb141e28f029de7567f69c763220760db913516b698dce08dd4511ea76c2b5dffe281dc83fe13b2e6d8e1881b2e9e18250372f86c7af86fca0d22818c7f8947dae55a28724ac2c34d331731a17399d88f6972ab061aef716f737bb4ac60b21d0b9e057b221bc6dc699b11fef3626085a0a6310e73b8116f05f9402431d17b44cf0345b9fe7fb16ec79845f5eb52e970110a9bfa427321697146efbe8cd6c2f164e8aec2495136403f879f692773f5c15dfa21e3e779adf131202f691f349ae68cbec81300faef9157865226b446a616f341d0dc54f5bbe44cec219ede3eefd61cdad499bbaeccfd68f291682ddab9121c0d31bef508910257f681450dad1c90c582abb5923174822e06ee738ff6c21919c421649cd068a4149237c228009b910befdc24fdc7c71cc03cefcb6efde5331cfb0b049c45e53148c7339dfc4eb9c9eb874e2cac976387657405883663c8a76c7045563d8a240fbb22eb77d0a9d911b207994cfbd622786b83fb2a183fd22ca748a2471ed89bfff8252a5cc6bb4df4403fc7640d59f3404a9c87ef7a0663d12a8b2d9be6ee907709ee790e16141b57e5366a766c13199e518f4f55916ad9aa96c7ddffaee7c1c3d85e50894eded3e03f0d1213db245ea626007ce0d93a37779aed96121dde5acb4800f45ae50e9cb4a3deb265c7061fcbae2002c0731a8b94cbfb3f23b2f1a762bc02091215a9768fa26866d4e32d4deb69a274d833dea2eaaa02e1af3abb363c917cd0c0b9643135313d2c54a21eaae1a0bcb9d220c53edf880b05c2a047a335af5790101a9919a967e724369d9caf47b8c0650cd912e7c1dbaaa4ccdc2f84d63c2ab23d221ffa2b49a8353c47fdf5d08d991a6b952fe61dd38d3ea0b4459ba6f80cde619a9091652652ba450a5eeae22fbe92761499b55160061baf1be10ba13f76e2319a59e335d3ce260d2c8a3e502f46b8a208f68b4d2cf415b777aa8031aaebbf1e16165fd7192961970bf03a9867c8a524825ba8b6fbfb95d7aa1acbbc3476949caa0eed09c5f1dd83472de8842e9bfa2f0fe127bf40cc1baef47f59254b708fe1376690cc5d4fb1cd8c704edffce358feff0a029036b49aa56aa5d3caaebb4dda9f60d1528943dd3f2eca690e65e8455f64003a6bb87f2d35f8d986a6798b076b98feb0b21262f71cf962516f76a9dcfe233908d463349f496883d0989dff7a1054981c96b87e57503c41d68c4e43ee603adb9afde417be2b8dfec561ee1311d2306199df8b2a7ab961a8993325377571379ed20be1ef4ef8d276ba4110ffd43df0974df76602cbc50cd2095f904d95ee89024cf180db97491b2fab54c45a0e1184b8379d877d360e828c54e048a4a50beffb8f78df23b0fdcfbd7498c9e5bd287eb6d2dbc036830c02c9957391f44a2db10bff0f56e8fc3e140c56636f43d73111233d94cdb7afcd629cad8334d40ebab09cfa108b09b9bba748b94322a6e1210ad7f27efdd0955aef3935f019fa923984575d972ca1ebb1214e0f8be51e1dd7f85a44ed8a83f99af885b9625d6d70a4526d6ed1cab27ef75758bd150910d3003b58ef174ce1d64a92e385036c9878633351040f558dbad5c8a5b41b2fa2d00656258d0a1e602fe18adb0ecb46cf2708a1042fcfb0927eee0f225b2d17fa31c150281faccef6d14a6dad81cbffe1192b31a62211cbb2c6f5930a74e59dff4dfee3e3ba90e663227a69d69434a001e80c7f9d920d0f3b36f38cbbd0cc1d96c787ea74dec4547a668c84fb0e0bc003d6d6bab80ed1306551f8eb9536a3992f5cac706f5852a78091b6a9d24dc14cb4b89e053c80afc4f2ae037658d25b5b00d6e79f45840ba403f9d83ba888a90f288815d2a5f3c5011c9a10b082c3123c166b55debf27778d062d1e5f3e6f22492fb96f4c588952ca0eafb4774db5bac60eeb79f9d4e143ade8ce84391bf92b6998cf3990226a4bd761ac0e8f142c1848f6c083233a86753a5c0824316b10bde38ceb0f552c213610dae4ea482d7c3597f9e0e04cd0de60e7021c00c00503188b5b5552043b4f0b3eb2c390f983e631ba7320830aa54b3ccfd4a3a3d4ad2a02b6069d8a2a7bfd81e5c39c63f6c7acd4f1e77086cf841b352fc0a4674186d800560310b49823b62e12e17a34ee6818ed782ed2872e651bb5ba6c18d34fecb54468c091280723920b996998a2891588748bf8b2a9cd21ad83edb349d8168e7b6a1240160bc1b6abfbb184c9bedbed71b1ac6bb6c6f40fca0a81ba5e40fe4befd5401f3c5b644fe5a80e827f7c807a090c0b883a92825c357d0a1ea35bedd1955652718767005b34a4b794c7fb9e5d158992f960822afdba2d184e10aeed193e0d444382c1db81762947694c34e775eb7545a4db1e2069f3fc5e5a6bb5bd58169c7726d6e3e3cca9e54903bd55421528a636fa3424a4ee302c6091d33535daed97b25e20d8c4cebed4b124bb94a645f8f306e6f76151ca7f1c36babe8cf59cdaf88b9f30207a3ebdeef1898f0c913f712115a4f9b3a7fcc2936d0109658960e11138c4d7053680e4cf61036fd61fba6848ed2fae091bc82d46f4a0f0aa13da21c153951292212dc7939fad9b6a4be2f6be309294aa12ac3855b4a38bcd9e79714fe219216a7b7bea8a25fd9a59b1c868727078e414ac294883c442de62a9d81552c6269ace78bb8c39837800e2d96b92261bff7dce0fa687bae0eaa75b3caf50301fdb956dfac68c6a667db07d5dd5fca983b397595f36a85d8e28834d703739144f3b25df8318480bf905d277f8a31af6a9b01bfe4769ec9aec6bcfd2d3684b10213907de6fa8ef78d9e47dde35057a9073b41d49f0a3fd50d43f22c284d7f706fb4cb751b52e74e06593e52cfe4d4d51af88587a55a76dceb4f69433109c9ae4574a70739ab8e712fd7ae547b95bedba26ebc320e4919e798b7740b5cc7a5d5ea95cc319dec3dbd3a9f827b80e538fc53fdb840e8b5321224ba45178645905b69c690198237286f934e76ca8ca80e14e6cdbc120a2de6e59d83e7e47b8bec4ba8ef3067d435ea26f80ed5a6501a42e9ab9232e950783cee62caf4c8a1a893f9e7bdfd060b094f625e3929f0d5e3876e7338be60008d5a21efea3fb00a05933c4f0f4737bd4c223ba1d6a2b0b9f12a87fd5d319855f974568a90afae182df3eb1de337006c5222904c8db48f672767cd6f4d6ebe4c4f57c597d5bd7952a9a015be0cc0a1f1c824faf9c84868d10083e548f88425b4433c4b662974929308b75a58a2fe7c645f65e10ad3b9f7285ce7550123a7625a32bab12c187c9d6bef7a06a0afb8177932ed7dc3e3bb7cffe72001e6fa804b122a2a6b54142ffe0eb36283e1eedd54b0e91cf33d85117eb38a40a891283b0e72341f3ebfd02b2a04d3b2d5c282f3826056519297d66160d11ef2f69fc9b533485d9f28b7cb5d5e61f30aef84c12c7cc711959e31aa92a8cec2a496dcfda3280c028e74f20232b609bebe0569a9017a0ca6760587c6ac4bd36d2d3bc432521c0df24c3e6a96fbad131a25f497ec9a3b7e0ee3a23dc7171dad078c26a227602f94db78b63e27ab27826c34ff5dce64b9c915a721103dddf8f7e551b388105105c7288fea53e2aef9ff8427cd81edee3bc1cd978e3df4a8ea03d2939c6b6da656462205b4a4583c4362a08374db0243892b0d4d7b2f5a35477b60ceedb011954129873e282b8201d60202e3b80604145d4cfd4c1d84f7e2c5b1663c4855a9a2238f42b4b2f0c3ce9c6ebed9644d7c7fa88243f1a85eac4f22aa969a97ebdeee3687e233514a07b3d51630ca8df021cd123d44fde055415c6d9acda1adc72a3493713e3238ee1b8774a1cc4b4cff67813b61ba863ffdcf973a19e9c8dbc5dce10b63ebce513020ea6248cfd74a6893b03a2260062c4dcab1e929ffab9b0af375eb510d7cd42634eb87d58450b0ff6a0535fccf2ad439e837423fab16c606449204cffed1c56ee61ca485b6a6d45b369ee9d7226151b6aec238d6ddf2c5e45778ef06f74471a6e3b1742b12d15129247d6ecae26156d190033826fc9e3054cd031ca868f1868dde2d2a9764ed979100f1da744c6beba78777e2eca2ca2c9151a2b0b88b1bcb0bba34e67947f83a6eb7fe182d88a96aeddaf8b4c9d0f6518d487d05c44565de6db54a733829424cfa4019910a8148a0d4dc3e9b7ffc293e347ca46951c240eebda24db8cd6cd55366285094f4d986945c3c48b3775a7f853c4e4d7dd49be7d67aaf1a43a3690a636384195bd886428b3b238eb99b0e1eed8672544c7922c2f60c1643eeb7f48464983af23e5d4de09f25fbe95d3724c95a9f4791330e32a5bc6c055cd96cd86dba5e45568c97f8c41983461a8dcafea1ba20a7c680d3786ef19325b1ef507183650b6c8526c2463e33879c42f19973422b386767f52abf205a69ab6f089fbdf132a70af0136f7b66652b1b4681fd206e415a94ed6c741cfe7e749398402f6371cf045944136faa0bf04ebe478e469165ff388a7911c22c74779977c561c4cdace66118471771fd586838c07b90ca1ab224280862baf91cbf028662087ba476469c7f8f7c41f7679af8825f458025dd9af256086aa5bc435af3ae3bf31fa6bd0f75859074960f8600fdfb134ec040af5f0b1dc6bc70701146b5b4f9fb1c38c3f4ca761e630ff0cf6210dbe84ec80b5350398939399c4a9f346a6a8dd14c2d0e4c09ef839d7b4ca914b4c9272123941cbd124665434d517cbba49e3ef332007965577d54d1093ef7a7762e4684b6b5d7fa30f1e68011753e8b2f7f62ed79632f41694b7a98355f799798ee7d725caae94a1cf2a731e0ceda9d875f1c0ba5b057db698dd5efafb51193e573afccea656543700bcdad38bfee61b2cf05ad9b06ca38034007dfc4905fab47a92c736c2636cdaf37fb358fffd248030a6886b293d337f92403d71b65f48eaef37ab09f70c3e0026c04447348ef0297fc5c17f2e4ba62bc95225cf608d8428a73c76cc8ec3ebfd37bffe51be03ab4efbe35e13ff7a75e824f142f390a303c63dacafe7968d9b67fba5c81fc1917ab934e3726322111984239ff03a1462faa9dfc7c4e4283831ab74e74259ebdb966975106e781bb2aad1b8550dcd022f03b5c0c0313d4e06809404a988f11d14b0c92f44933cf55f67d562f2c3d77e1bfd366a063bb9ea183db567cda398a676d9bf8834828d6f1736359ee851cbf30b5719083cb28b3b8bb61d7011522003dc3b5f1c694c934b642264fa161e9b06d2d762fe02062e56ab2fe102d87cf10ec4ff8504149c32d29d5365a9df3be3686ad5f6bca59bf08312719e18e2ebe20a81ea985682acadfad6a32c59202aef0d779bd39df8db7cc4c58f25ee2cb791264a50216cf9a7dd053b05a08d11ff7d855472847d53ddfcb86dcdda09331889fae493fc8b05a5e6cf170400c1ea4a6740e16b7741eaa1d57ad9565d0c90f345554daceda560d37787d7de96898156334982a759f5a3009c3172aa60bf4df5311b20178cc14f3ba0f1e0623901212918a0ceb8fd18f6d1176e9a8edc4e310249e514529b270c7e985fdeac2ab0bf6e00c811d07f8635b81748f2e2df134ede175075d0d2fa74402b263c8fcb6129be09302c66d17a77a52f387ac9562d47518129f6d09d9a27021e8f647c4a903733b53a717bf9c0421fbfb40cac36af95a37e8d87fff4f04217dd807e6d960f6328f381a23fe3671b100fb8478f3489b5e3d5bb5eac4e9010a871279fd9c3cc5fd80d50fae373cadd23b5510c4b318873536846a58b9dbad5e897bc906e470abb6bcbdb132bffa8dac7e5e7b0a2f4e34f6a49da5d94a30c0b9c171d12f99c4d19243e9ea7e892a5947b46219b78817f77b9affaa6eb9cf97a5d313d76115fbbdfd693da781738e1ed03def9396df6573fd2460562f7280ec5e012870ccf0b7fe3a9436ebeaf835806009ce82c08099932821f5e3d9a3b3943f4eff0d57dc565961d73582e4a06f6c1dcd28fdb2f44a3a0a52286eeb1ed05087277535c2bbb9a0fc2be24605958c832fb34e45697eeb5e98947120db88771e7579d19a5c26d9fb22be38d927bb92d3c77a811dec14beb0bb55378ca383d3e9738e043d0153dbe7ff13f122d2aa6577a7083528831bc52fde064fddacd634cac06d0d097724befe76a9f6cb8a2e1aab0d3c8844be1fa2bc96d387f68d5408f6779b08ebd0adb6e72a11ccd1282e1d93806bf447522f1a59cccee34b834b11d42aafdeff54f5614318a232a5d9247450ceef58549a57fe268cc3337e370493baf72c11f3a71c3ec20334324efc03d2098adef7b29ab39b3f6a9a86d5f898e289b3fafd03c6e1b05d2c45b053f20e8b59ee62082a26b2cbed4bd8657ab3010fbdc135243d268fa4fdce453e801fbba7508539e3f3d9139c5b8cf9f913b963a37cf413ef41c229b05e3a40ed5c7ab21a2db0e20ff8ff7ff6e979c0fbb7f102d0ad0ea08b8a535378c17903b78633658c15a8a1c895b338df007620182e5cd0b09cb3e185e662f396ce1ca17e047a64e8c85e2f00544fb21f8c21fecb7356b69a63387d04b115a37990c63c7834b40a749e9b4be3b8b0c63b4715382211e0b69ae514114623f2099d21d69ea6cdf997046e81341ed0742d155326a625a8f0c48e926063c24f23baa573aaa05a18577801c0a476590dcc69234d199382ac8885f87c3ed186134c77211114c00ab2046a56c578eaebf06dea019e59897c7ab81b45fc83c59e4290cb9f5b9b22e84f0a165b6d19a9a61f3044e6f9ec3fe4fe6384882f6d60129affe8221810873deb75794bf6b6462705f961afd381eecceac49549a33ae946e0836a7756ea296009785dfe0fd47061e518d1de52b2beecf4611ad50d378bf2a9298c5a2560aa23cc59bc0f388953021a589a63fd77cbc032bc8e0ea6ff62764805c38e65f10289867818d32d6a906415360f2dcdff608863a35d61064d60aa13170f696587d63b29e8af38af20ae6519159588a0ad91b0d3094ee227d8173f09752f8523a9bcf32e0c87dc44b93191be97fd4c911c69b25a9fb68b599ad403c27e6db3e517efa8c6ba0de97169f100d920ebcdebc4bbdcbb36653d33c8090a143f8e6c396ce4273e57612490fa38d4dcd6d086c59ab6cde0185ce4ed704bd3af0f33525a9da192a646e3984d7716c0e4d49b937560254e63e2f6d327c50c04608980ab901bb98a85edfd433c1d44e2dd1c9c9c2c9dae632db21a2d9a24ccd58cdbe306b6ecee1234ca8959a3725412d56de0dc8b54883302f6ef63b22828186fa73156d965afa8cf695ead5f6a6a6b4548e6f9f6577fea77ba496fc0c134323e5078cc850d3dfcaae5dc9b03260dfc0c8931f4bf0fb240502efac4e89e252c69c5b690de78e3f526124c09db13df488e60d08b7807a893336c39a53d93394102f0959b5a24cb29182f6783989cfa3bd7384256567d248a8f0889e024ee86ff1ea867ba522102bc3eac5dac4521f2cef67d2a315158f3c449cc160359a6121589f4c92e7dd48f4d75ec2c04770e768a21abc0ebb79dc411b81f9109846d8fc2437488ee4b42e6670b257c7ad8d78f13b5507588a01c902ea83e7f5a85f8c25ca6593aabad0f27b98e4916dcb9ca6f741e4cab9c3a4d64a9a71a1a62e809abd4bdd99fd7ae45824e2add2eaf6dc8f7b6ce9f7201aa4a506307a503e0d71b947ca9c421a072bf38bed3f6185606cb94e8e2abf10be7a200774b27fc2be0051ace3344a31cd150eff5426d96edd0cd4bdfe908e9a2a62ab840aaa0b78e21a75481f44bccc99cc3615e027ea592994c3ff6e89e84d9ecf8baf3ba9304c937f9b2c5fb37dabc6415218e7e13245a80a0d5b47f6a63068129544ec7698e94ee55563eb27cb2b5fd4f9d43006610f2ffd1d3df771062dcac69196bd12d4ecc0ce9ba4bfb6a7dabc61a366689239d973ec8064300e27c8664bf01469d6250309aee7e155af2ab285c3714972c965ed4612ff70c980b53b7c8b8875eeae13d60e4efeb9f03e97d36c6a4053d7b8531d96df7a39304307fad0b03dc14fab68e38347af0254cf1f19f06a4935ca6d85709480901a4db7ee7e35d49c145722c10c4d4a29053d6e8386f20b172ab335f0979b034ffc6d493fda030e73e62f8c839e18698ec6f5366b44f7855b381ae0379531c16bd85990f2f85dd6934e430dd933a5c48213b732c10ac73dd99fa7fe7586fb4f5a3063f659c6a486c2d37f178081cac5a8f193db723730f26fb8d628c438acf879527ce7fda8754251da7b6721154859cc72d3d0d88ba93a6598bc5a27da0dacaaed14afb3f5923563cee81175e9c14692a0e5303bcbaf17eee4130eb26249611c7cd3082485026abddb33d74b968c54bd2f3e066ed27991fa0577abda5fd1ef7ea58d71d3936ac0e497f0a62ac09104b0a8d3ff2549d0cf55bdfce1f296efc0deb1bfd8aa923faa9cfc47190579abe37b514f0ad64295e7882d7ba69e7c0d42f8c735"}} diff --git a/packages/sysweb3-sentry/test/fixtures/generate-core-vectors.cpp b/packages/sysweb3-sentry/test/fixtures/generate-core-vectors.cpp new file mode 100644 index 00000000..e9864ec3 --- /dev/null +++ b/packages/sysweb3-sentry/test/fixtures/generate-core-vectors.cpp @@ -0,0 +1,41 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +template std::string hex(const R& r) { static const char* h="0123456789abcdef"; std::string s; for(auto c:r){s+=h[(uint8_t)c>>4];s+=h[(uint8_t)c&15];}return s; } +template uint256 hash256(const R& r) { uint256 out; CHash256().Write(Span{reinterpret_cast(r.data()),r.size()}).Finalize(out); return out; } +int main() { + const auto uniform=[](unsigned char c){uint256 h;std::fill(h.begin(),h.end(),c);return h;}; + const auto genesis=uniform(0x44), protx=uniform(0x11), prevtx=uniform(0x22); + CDataStream prevouts(SER_NETWORK,0); prevouts << prevtx << uint32_t{1}; + const auto inputs_hash=hash256(prevouts); + std::vector payout{0,20}; payout.insert(payout.end(),20,0x33); + std::vector nevm(20,0x55); + std::array addr{};addr[10]=0xff;addr[11]=0xff;addr[12]=127;addr[15]=1; + CDataStream payload(SER_NETWORK,0);payload << uint16_t{3} << protx; + payload.write(AsBytes(Span{addr})); const std::array port{0x47,0xbf};payload.write(AsBytes(Span{port})); + payload << payout << inputs_hash << nevm; + const auto legacy_hash=hash256(payload); + std::vector secret(32);secret.back()=1; + const auto sk=bls::PrivateKey::FromByteVector(secret); + const std::vector legacy_digest(legacy_hash.begin(),legacy_hash.end()); + const auto sig=bls::BasicSchemeMPL().Sign(sk,legacy_digest).Serialize(false); + const auto pub=sk.GetG1Element().Serialize(false); + std::printf("{\"legacy\":{\"payloadPreimageHex\":\"%s\",\"inputsHash\":\"%s\",\"authorizationHash\":\"%s\",\"publicKey\":\"%s\",\"signature\":\"%s\"},",hex(payload).c_str(),hex(inputs_hash).c_str(),hex(legacy_hash).c_str(),hex(pub).c_str(),hex(sig).c_str()); + slhdsa::KeyGenerationSeed seed{}; for(size_t i=0;iGetPublicKey(record.public_key))return 3; + llmq::pq::ProviderServiceAuthorization authorization;authorization.payload_version=4;authorization.pro_tx_hash=protx;authorization.global_key_version=1;authorization.service.network=llmq::pq::EndpointNetwork::IPV4;authorization.service.address_size=4;authorization.service.address[0]=127;authorization.service.address[3]=1;authorization.service.port=18367;authorization.operator_payout_script=payout;authorization.nevm_address.emplace();std::fill(authorization.nevm_address->begin(),authorization.nevm_address->end(),0x55);authorization.transaction_inputs_hash=inputs_hash; + auto digest=llmq::pq::GetProviderServiceAuthorizationHash(genesis,record,authorization);if(!digest)return 4; + const auto ctx=llmq::pq::GetGlobalAuthContext(llmq::pq::GlobalAuthPurpose::PROVIDER_SERVICE);slhdsa::Signature pqsig{};if(!slhdsa::SignDeterministic(*pqkey,Span{digest->begin(),digest->size()},ctx,pqsig))return 5; + CDataStream recordbytes(SER_NETWORK,0);recordbytes< pqsecret{};if(!pqkey->Export(pqsecret))return 6; + std::printf("\"pq\":{\"genesisHash\":\"%s\",\"seed\":\"%s\",\"secretKey\":\"%s\",\"publicKey\":\"%s\",\"globalRecordHex\":\"%s\",\"childKeyCommitmentHex\":\"%s\",\"authorizationHash\":\"%s\",\"contextHex\":\"%s\",\"signature\":\"%s\"}}\n",hex(genesis).c_str(),hex(seed).c_str(),hex(pqsecret).c_str(),hex(record.public_key).c_str(),hex(recordbytes).c_str(),hex(childbytes).c_str(),hex(*digest).c_str(),hex(ctx).c_str(),hex(pqsig).c_str()); +} diff --git a/packages/sysweb3-sentry/test/fixtures/generate-governance-vectors.cpp b/packages/sysweb3-sentry/test/fixtures/generate-governance-vectors.cpp new file mode 100644 index 00000000..0a91adf7 --- /dev/null +++ b/packages/sysweb3-sentry/test/fixtures/generate-governance-vectors.cpp @@ -0,0 +1,52 @@ +// Public synthetic key only. Cross-checked with Syscoin Core 9bdd0a0dd9. +// To reproduce, temporarily include this file from src/test/fs_tests.cpp in a +// configured Core checkout, build test/test_syscoin, and run: +// test/test_syscoin --run_test=governance_vector_probe --log_level=message +// The committed JSON contains the six GOVERNANCE_VECTOR output objects. +#include +#include +#include +#include +#include +#include +#include +#include +#include + +BOOST_FIXTURE_TEST_SUITE(governance_vector_probe, BasicTestingSetup) +BOOST_AUTO_TEST_CASE(known_key_votes) +{ + const auto secret = ParseHex("0000000000000000000000000000000000000000000000000000000000000001"); + for (const bool compressed : {true, false}) { + CKey key; + key.Set(secret.begin(), secret.end(), compressed); + for (int outcome = 1; outcome <= 3; ++outcome) { + const auto collateral = uint256S("00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff"); + const auto parent = uint256S("ffeeddccbbaa99887766554433221100ffeeddccbbaa99887766554433221100"); + const uint32_t index = outcome == 3 ? 2147483647 : outcome - 1; + const int64_t timestamp = outcome == 1 ? 1700000000 : outcome == 2 ? 4294967297LL : 9007199254740991LL; + CGovernanceVote vote(COutPoint(collateral, index), parent, VOTE_SIGNAL_FUNDING, static_cast(outcome)); + vote.SetTime(timestamp); + BOOST_REQUIRE(vote.Sign(key, key.GetPubKey().GetID())); + BOOST_REQUIRE(vote.CheckSignature(key.GetPubKey().GetID())); + CDataStream serialized(SER_NETWORK, PROTOCOL_VERSION); + serialized << vote; + std::vector signature; + for (auto it = serialized.end() - 65; it != serialized.end(); ++it) signature.push_back(std::to_integer(*it)); + UniValue obj(UniValue::VOBJ); + obj.pushKV("collateralHash", collateral.GetHex()); + obj.pushKV("collateralIndex", index); + obj.pushKV("proposalHash", parent.GetHex()); + obj.pushKV("outcome", outcome); + obj.pushKV("timestamp", timestamp); + obj.pushKV("digest", HexStr(vote.GetSignatureHash())); + obj.pushKV("signatureHash", vote.GetSignatureHash().GetHex()); + obj.pushKV("voteHash", vote.GetHash().GetHex()); + obj.pushKV("voteSig", EncodeBase64(signature)); + obj.pushKV("publicKey", HexStr(key.GetPubKey())); + obj.pushKV("compressed", compressed); + std::cout << "GOVERNANCE_VECTOR " << obj.write() << std::endl; + } + } +} +BOOST_AUTO_TEST_SUITE_END() diff --git a/packages/sysweb3-sentry/test/fixtures/generate-management-vectors.cpp b/packages/sysweb3-sentry/test/fixtures/generate-management-vectors.cpp new file mode 100644 index 00000000..2df5d9cc --- /dev/null +++ b/packages/sysweb3-sentry/test/fixtures/generate-management-vectors.cpp @@ -0,0 +1,72 @@ +// Public synthetic keys only. Built against pinned Syscoin Core libraries. +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +template std::string hex(const R& r) { static const char* h="0123456789abcdef"; std::string s; for(auto c:r){s+=h[(uint8_t)c>>4];s+=h[(uint8_t)c&15];}return s; } +template uint256 hash256(const R& r) { uint256 out; CHash256().Write(Span{reinterpret_cast(r.data()),r.size()}).Finalize(out); return out; } +template void raw(CDataStream& s,const R& r) {s.write(AsBytes(Span{r}));} +uint256 uniform(unsigned char v) { uint256 h;std::fill(h.begin(),h.end(),v);return h; } +std::string address(const std::array& key) { std::vector d{0};ConvertBits<8,5,true>([&](uint8_t v){d.push_back(v);},key.begin(),key.end());return bech32::Encode(bech32::Encoding::BECH32,"tsys",d); } +std::vector secpsign(const uint256& h) { + auto* ctx=secp256k1_context_create(SECP256K1_CONTEXT_SIGN);std::array sk{};sk.back()=3; + secp256k1_ecdsa_recoverable_signature sig; if(!secp256k1_ecdsa_sign_recoverable(ctx,&sig,h.begin(),sk.data(),secp256k1_nonce_function_rfc6979,nullptr))std::abort(); + std::vector out(65);int rec;secp256k1_ecdsa_recoverable_signature_serialize_compact(ctx,out.data()+1,&rec,&sig);out[0]=31+rec;secp256k1_context_destroy(ctx);return out; +} +int main() { + const auto genesis=uniform(0x44),protx=uniform(0x11),collateral=uniform(0x33); + std::vector fundingScript{0,20};fundingScript.insert(fundingScript.end(),20,0x34); + CDataStream funding(SER_NETWORK,0);funding<{1,1}< owner{},voting{},payoutkey{};owner.fill(0x66);voting.fill(0x77);payoutkey.fill(0x88); + std::vector payout{0,20};payout.insert(payout.end(),payoutkey.begin(),payoutkey.end()); + std::array service{};service[10]=service[11]=0xff;service[12]=127;service[15]=1; + const std::array port{0x47,0xbf};std::vector blssk(32);blssk.back()=1; + const auto bls=bls::PrivateKey::FromByteVector(blssk);const auto blspub=bls.GetG1Element().Serialize(false); + CDataStream registration(SER_GETHASH,0);registration<(reghash.begin(),reghash.end());std::reverse(reversed_hash.begin(),reversed_hash.end()); + const std::string message=address(payoutkey)+"|250|"+address(owner)+"|"+address(voting)+"|"+hex(reversed_hash); + CDataStream ms(SER_GETHASH,0);ms<(revokehash.begin(),revokehash.end())).Serialize(false); + std::printf("{\"fundingTransaction\":\"%s\",\"legacyRegistration\":{\"preimage\":\"%s\",\"payloadHash\":\"%s\",\"message\":\"%s\",\"digest\":\"%s\",\"signature\":\"%s\"},\"legacyRegistrar\":{\"preimage\":\"%s\",\"digest\":\"%s\",\"signature\":\"%s\"},\"legacyRevoke\":{\"preimage\":\"%s\",\"digest\":\"%s\",\"signature\":\"%s\"},",hex(funding).c_str(),hex(registration).c_str(),hex(reghash).c_str(),message.c_str(),hex(messagehash).c_str(),hex(secpsign(messagehash)).c_str(),hex(registrar).c_str(),hex(registrarhash).c_str(),hex(secpsign(registrarhash)).c_str(),hex(revoke).c_str(),hex(revokehash).c_str(),hex(revokesig).c_str()); + slhdsa::KeyGenerationSeed seed{};for(size_t i=0;iGetPublicKey(record.public_key))return 2; + llmq::pq::ProviderRevokeAuthorization auth;auth.payload_version=3;auth.pro_tx_hash=protx;auth.global_key_version=1;auth.reason=2;auth.transaction_inputs_hash=inputhash; + auto revoke_pq_hash=llmq::pq::GetProviderRevokeAuthorizationHash(genesis,record,auth);if(!revoke_pq_hash)return 3; + slhdsa::Signature revoke_pq_sig{};auto ctx=llmq::pq::GetGlobalAuthContext(llmq::pq::GlobalAuthPurpose::PROVIDER_REVOKE);if(!slhdsa::SignDeterministic(*key,Span{revoke_pq_hash->begin(),32},ctx,revoke_pq_sig))return 4; + auto candidate=record;candidate.activated_height=0; + llmq::pq::GlobalKeyTxPayload op;op.pro_tx_hash=protx;op.candidate=candidate;op.transaction_inputs_hash=inputhash; + auto ownerhash=llmq::pq::GetGlobalOwnerRegistrationAuthorizationHash(genesis,op);if(!ownerhash)return 5; + auto pophash=llmq::pq::GetGlobalRegistrationAuthorizationHash(genesis,protx,candidate,inputhash);if(!pophash)return 6; + slhdsa::Signature popsig{};ctx=llmq::pq::GetGlobalAuthContext(llmq::pq::GlobalAuthPurpose::GLOBAL_REGISTRATION);if(!slhdsa::SignDeterministic(*key,Span{pophash->begin(),32},ctx,popsig))return 7; + std::printf("\"pqRevoke\":{\"digest\":\"%s\",\"signature\":\"%s\"},\"globalInitial\":{\"ownerDigest\":\"%s\",\"ownerSignature\":\"%s\",\"operatorDigest\":\"%s\",\"operatorSignature\":\"%s\"},",hex(*revoke_pq_hash).c_str(),hex(revoke_pq_sig).c_str(),hex(*ownerhash).c_str(),hex(secpsign(*ownerhash)).c_str(),hex(*pophash).c_str(),hex(popsig).c_str()); + const auto signpq=[&](uint256 digest,std::string context){slhdsa::Signature out{};if(!slhdsa::SignDeterministic(*key,Span{digest.begin(),32},Span{reinterpret_cast(context.data()),context.size()},out))std::abort();return out;}; + std::array pqvoting{};pqvoting.fill(0x99); + CDataStream pqreg(SER_GETHASH,0);pqreg<GetPublicKey(next.public_key))return 9; + const auto rotation=llmq::pq::GetGlobalRotationAuthorizationHash(genesis,protx,record,next,inputhash);if(!rotation)return 10; + std::printf("\"pqOwnerRegistration\":{\"preimage\":\"%s\",\"digest\":\"%s\",\"proofHash\":\"%s\"},\"pqRegistrar\":{\"preimage\":\"%s\",\"digest\":\"%s\",\"updateSignatureHash\":\"%s\",\"proofHash\":\"%s\"},\"globalPQOwner\":{\"digest\":\"%s\",\"signatureHash\":\"%s\"},\"globalRotation\":{\"candidatePublicKey\":\"%s\",\"digest\":\"%s\",\"signatureHash\":\"%s\"}}\n",hex(pqreg).c_str(),hex(pqregdigest).c_str(),hex(hash256(signpq(pqregdigest,"SYS_PQ_OWNER_PROOF_V1"))).c_str(),hex(pqregistrar).c_str(),hex(pqregistrardigest).c_str(),hex(hash256(signpq(pqregistrardigest,"SYS_PQ_OWNER_UPDATE_V1"))).c_str(),hex(hash256(signpq(pqregistrardigest,"SYS_PQ_OWNER_PROOF_V1"))).c_str(),hex(*pqownerhash).c_str(),hex(hash256(signpq(*pqownerhash,"SYS_PQ_GLOBAL_OWNER_REGISTER_V2"))).c_str(),hex(next.public_key).c_str(),hex(*rotation).c_str(),hex(hash256(signpq(*rotation,"SYS_PQ_GLOBAL_ROTATE_V1"))).c_str()); +} diff --git a/packages/sysweb3-sentry/test/fixtures/governance-core-vectors.json b/packages/sysweb3-sentry/test/fixtures/governance-core-vectors.json new file mode 100644 index 00000000..adb40a40 --- /dev/null +++ b/packages/sysweb3-sentry/test/fixtures/governance-core-vectors.json @@ -0,0 +1,77 @@ +[ + { + "collateralHash": "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff", + "collateralIndex": 0, + "proposalHash": "ffeeddccbbaa99887766554433221100ffeeddccbbaa99887766554433221100", + "outcome": 1, + "timestamp": 1700000000, + "digest": "7fffa6d894cb683b076c893cd8c739e5775ede1b056d73ed7a2672a881b5c871", + "signatureHash": "71c8b581a872267aed736d051bde5e77e539c7d83c896c073b68cb94d8a6ff7f", + "voteHash": "71c8b581a872267aed736d051bde5e77e539c7d83c896c073b68cb94d8a6ff7f", + "voteSig": "IIiU1rdeltahxOVZjPiiEYOJ/QAqxj2KatA1BK1RfVUrAusiKYhQ7h9q75JdvugvUo1Dia1+rISpnX8TF97iM/A=", + "publicKey": "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798" + }, + { + "collateralHash": "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff", + "collateralIndex": 1, + "proposalHash": "ffeeddccbbaa99887766554433221100ffeeddccbbaa99887766554433221100", + "outcome": 2, + "timestamp": 4294967297, + "digest": "1ee8108fb7c11ad56c45eb92ac67fde3018f07de7541f4760f17547dedff5c6e", + "signatureHash": "6e5cffed7d54170f76f44175de078f01e3fd67ac92eb456cd51ac1b78f10e81e", + "voteHash": "f64e1c83a061f15c1ecfd39fd0f5a1548d90343d35a439ce191e5394468f2dad", + "voteSig": "H4shOAflkSrVB4162YAnHJAGvsN060oyzc8vcc+yBcmMAbL6U8wU1pBa+1rzFVGtbDHoCH61dgRy8YsOdsXSnFI=", + "publicKey": "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798" + }, + { + "collateralHash": "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff", + "collateralIndex": 2147483647, + "proposalHash": "ffeeddccbbaa99887766554433221100ffeeddccbbaa99887766554433221100", + "outcome": 3, + "timestamp": 9007199254740991, + "digest": "127bdd4417c9ecb83e230731a02114b0418c88a5f9baf44de15c6db7ae75d8d2", + "signatureHash": "d2d875aeb76d5ce14df4baf9a5888c41b01421a03107233eb8ecc91744dd7b12", + "voteHash": "c205357c01bdde3fc0b856efdc42a2e3409433b47a7d091b3a1c35bf395d8bdc", + "voteSig": "H18oAksxjFgeWSl4C3yF9uOqOz1Wn6fV7iNIi4ht1EiISxsTS1aSLHTQ0GedEXx9vZDQ4XYsWyzbfRMcuyQZ5Jc=", + "publicKey": "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798" + }, + { + "collateralHash": "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff", + "collateralIndex": 0, + "proposalHash": "ffeeddccbbaa99887766554433221100ffeeddccbbaa99887766554433221100", + "outcome": 1, + "timestamp": 1700000000, + "digest": "7fffa6d894cb683b076c893cd8c739e5775ede1b056d73ed7a2672a881b5c871", + "signatureHash": "71c8b581a872267aed736d051bde5e77e539c7d83c896c073b68cb94d8a6ff7f", + "voteHash": "71c8b581a872267aed736d051bde5e77e539c7d83c896c073b68cb94d8a6ff7f", + "voteSig": "HIiU1rdeltahxOVZjPiiEYOJ/QAqxj2KatA1BK1RfVUrAusiKYhQ7h9q75JdvugvUo1Dia1+rISpnX8TF97iM/A=", + "publicKey": "0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8", + "compressed": false + }, + { + "collateralHash": "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff", + "collateralIndex": 1, + "proposalHash": "ffeeddccbbaa99887766554433221100ffeeddccbbaa99887766554433221100", + "outcome": 2, + "timestamp": 4294967297, + "digest": "1ee8108fb7c11ad56c45eb92ac67fde3018f07de7541f4760f17547dedff5c6e", + "signatureHash": "6e5cffed7d54170f76f44175de078f01e3fd67ac92eb456cd51ac1b78f10e81e", + "voteHash": "f64e1c83a061f15c1ecfd39fd0f5a1548d90343d35a439ce191e5394468f2dad", + "voteSig": "G4shOAflkSrVB4162YAnHJAGvsN060oyzc8vcc+yBcmMAbL6U8wU1pBa+1rzFVGtbDHoCH61dgRy8YsOdsXSnFI=", + "publicKey": "0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8", + "compressed": false + }, + { + "collateralHash": "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff", + "collateralIndex": 2147483647, + "proposalHash": "ffeeddccbbaa99887766554433221100ffeeddccbbaa99887766554433221100", + "outcome": 3, + "timestamp": 9007199254740991, + "digest": "127bdd4417c9ecb83e230731a02114b0418c88a5f9baf44de15c6db7ae75d8d2", + "signatureHash": "d2d875aeb76d5ce14df4baf9a5888c41b01421a03107233eb8ecc91744dd7b12", + "voteHash": "c205357c01bdde3fc0b856efdc42a2e3409433b47a7d091b3a1c35bf395d8bdc", + "voteSig": "G18oAksxjFgeWSl4C3yF9uOqOz1Wn6fV7iNIi4ht1EiISxsTS1aSLHTQ0GedEXx9vZDQ4XYsWyzbfRMcuyQZ5Jc=", + "publicKey": "0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8", + "compressed": false + } +] diff --git a/packages/sysweb3-sentry/test/fixtures/management-core-vectors.json b/packages/sysweb3-sentry/test/fixtures/management-core-vectors.json new file mode 100644 index 00000000..99489001 --- /dev/null +++ b/packages/sysweb3-sentry/test/fixtures/management-core-vectors.json @@ -0,0 +1,50 @@ +{ + "fundingTransaction": "02000000010000000000000000000000000000000000000000000000000000000000000000ffffffff020101ffffffff0140420f0000000000160014343434343434343434343434343434343434343400000000", + "legacyRegistration": { + "preimage": "02000000000033333333333333333333333333333333333333333333333333333333333333330200000000000000000000000000ffff7f00000147bf666666666666666666666666666666666666666697f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb7777777777777777777777777777777777777777fa001600148888888888888888888888888888888888888888ea98fb5c558fc5d57595e99449bbf3040a884ea5fd8a9f244e36f0ef52d38381", + "payloadHash": "a909c5345b9a4649709b8c026f65a8df40538c49fd24679f714f2da7fe16a505", + "message": "tsys1q3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zygf99hwv|250|tsys1qvenxvenxvenxvenxvenxvenxvenxvenxh2n9u5|tsys1qwamhwamhwamhwamhwamhwamhwamhwamh95ycfx|05a516fea72d4f719f6724fd498c5340dfa8656f028c9b7049469a5b34c509a9", + "digest": "4489bc724293adc406b5013157530cd627540c21cf2f13c74d2fd41fdf14bf5e", + "signature": "208b4b311fcca8d3384e24a53217e494617dcc6d7238685825947e634b9ce2bac51851e61d5213f405d51254832db2e63a1f1a3b2117ec6bb086ff438742d91158" + }, + "legacyRegistrar": { + "preimage": "02001111111111111111111111111111111111111111111111111111111111111111000097f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb77777777777777777777777777777777777777771600148888888888888888888888888888888888888888ea98fb5c558fc5d57595e99449bbf3040a884ea5fd8a9f244e36f0ef52d38381", + "digest": "a2aface91cd00e5d27a29a01fd8a8ec8f09d7118972ff02d8043d0ac2ac1cae5", + "signature": "1f80823af01cf77fee29839ef3a311a25b8b093a81289ed0086699e91918da012a7d21b01d821786cd45543df09c98c6c70cfb7a1799c441d2819e445755b83818" + }, + "legacyRevoke": { + "preimage": "020011111111111111111111111111111111111111111111111111111111111111110200ea98fb5c558fc5d57595e99449bbf3040a884ea5fd8a9f244e36f0ef52d38381", + "digest": "fd4d259a49b35bd54074d4fb23eea009bc2fd0cfd858b9573ac58f74adf04878", + "signature": "aed9d903fba1e676caa2907a675b1d3f396db7adee765566149f6d54f3ca6f30568e8b45fb3b762085cecbfc5a7546fb1354f35415dea4bbc7bcc5ac254c9097035f558c27db5e1cde21c63f6e00e247e8783e5762e59e39a365dc6d4ef08df2" + }, + "pqRevoke": { + "digest": "8aaa12a328a715514c317b2594314c89accab4222c818061426089ad152a7870", + "signature": "4434fde1c455a639bc30a6541587cea6566678670cd6e7a0376a5d1ea481caf0ca1a48391a4121c1767d142b97c4e40ccd478aec637055e726a64478a36a4d4d7c967af2fe48063bd223496e017cac9e3f012046f80620660aae7d1caa87d5b269def5d7e244d0249c16d8a7926c96ba2bbdcc724447932f5e7f9892d0151f88cecc307766df72876a2597a420f5258ccee8a4eedfcc7769851677f163f21c59d3d12785a79dacd855e5e4e30bad7605b1d93df780c2c1c5d978cb52a29dd219848eb8f2cfd6e24b17e3623c050b69bc6202296700539184cb9735a59bf83a05d211e7d0cdaea4af1fba40e928e4e7cd64cf7e56d470f2b5ba87014331b0323830e8c56c0731b5a5a7e97968fd6998cb596f64130ef6172b1b6175d25ee0ad0a3d6735217bb89ed5ca03cce05534d1a6544181d589425e6f3082c43be8071c2d4f9cce3c716d74e0898256c7e6ba9d473170aad49775b48e1c8aec95db506a232a18242848af08c0d3268e84a0c8da2706142313de000bc066435f22f24406a77282fd573eaa69719528e3e4dc01cb293c0def763d4b720c186ce2197d92f856bba2a130938c436c067495f52a977cc1ec7d19e3e6a8a88e7a9f61eb2bdef6d2651ea1cd2dca8784753a617389b16841c95880ce2e40c0c0af58c1e2025c464e287332f46445d73652a44b6a5fccd8cd83cddd48a378c648179f5ff987fb6330c62b4a33c13091e6588ac3fa7d9b3d69ed9957603ec28e609236672de3394a1d7751122b3c6616c7906f169e96c4dcd43d233d608f73569f48acfb582cc9d2eaf4a647bcd9754b64de7f206382a5f4b32350a5f35aebea2e1e187087521f14d78055fd9145cf6f321323de776789ca3662b9c0a26f824be9a2c79935d4d3e46cc215ebeac3d7a48fc82b3cc04dd22101f416048ef19753b71169b6465acbfbcbaa1e9f602223681055cc0dc23adde1e54fd4cfab6006372697e76cb9ad5ad4a0e48db1e38cb7121c5125925dfed4e001959a203d53a74122c0b97de637fa7d11a06182f9eb7c0a586645565b332afc134d93a9d3685c408b308ea8f1c4ab866ad6672d7c53ec24e5f8756a672a202effdc7e8b2dfee5e79151af50427919f24a1af65c1cd2f7214a88a71260ae9e0eb631660e39f405df9654fa126b07ddc3d31b887196b97d1373f0ad002fff2738118ce0b615103fde3ca57fc21efd88cc78fe276a31f44b633accac4e207b7270718e7573cd4855f3b44c1a4d77257c97051e399125b1cbbaa0e7dd0c086756be1cbbde229b2c09d0ed165b297d9f008119b74558be2e8020d25fed5920b00aa01407d68574045fff442f06e2cb3d4ecfa3b34d32b57f89608025e8786528a43ad61cc7265835b6717c15106fd3518ad7f70042fb7958a30363d96ccf175df9c8f7c47f875e51e2135e3ff312b03467833c21a9ca36737e614f15b1a4e97e4797caccf20ea0e86c725bbeccf8878432a2749ffe05d0641aae74b7db11ba7c5fec2f106c3041a3a5bd95d800f2acf6cd64964bef0bf85b380eda7ef770d41099ed3b4caa5b0e2adf42729d887ac26cf7b3a56fed51c17abac9595d28596f84d06472af451304573c27836dac3ea36860e0e4003f63c5712a1572ab525c66c6aac6302332c3a56ac7e5adcd60caa8b0470ae57296a7554998411156138663c4d44ab05375e7acbab2e5a58809cbdabedf980ad80857c98ef83122d504a846354d5e3d0abf098f9631012fef0382c2cdfb66c9b0bb9dddb85115a1abcad141c1ab8753b5f488ab4f4fe028aed7348b5d5d5e526ea263a446513c1da321db4835aa9fc82b3ed1e412f28de35bbdf01cf56604c58f87eb77609b07bf5a3750779d1855a756a4e0a5ddfff6f8ead5ad638ee675d9f378deed2994277c1472fd47c43b144127331c47cb2f3b49b52eeccf5ac7f6d343d9955321632333fe323b66f7cf657fc9e992a755f12589a9ad485269b9728d3c78a5fa787f5fe045f98b7f916460f7e211f0fdfcd01941235782d1346a77f1c6d9f51c7acaa6f9c0a564dcb35a9323f40b6cdcc22577860f958a857c6f6e8b00ac38073fc87e39286227240736da5edecf84636d4137b5ffc5af1846051e07c2b518d9160bafb4643f53bf645d6a13a5c8624efbebf0693a74f3e7aed0b0a6295ab71384ff8b18161e034a4fab9125bad9f0e12128a4e0e479441473798fbadef15115f1d14471518e3e54e29402b81b62b87d41cb7e8ef54b821540e7419c633abb89b878a8718776c862b823ddb01dcf67900e957c0aba28cbd74d7a03e5d6d3b187ba35b17f0512f558fffb3e677f7e130ae0962b8a9a2bc9e1fc34b2ea00525b8f0f21160b7e80896629b32f36709a20dae7df5141852e27364f9856418dc6df3def5adaca5d98dbf0549223b72ffc2b147390dcf475d109fa891150e2efc6306e49a395b49435c288a921ce93b09b36fab3a93bd7f9eb0b3953353d2d2f36695beec1cb5081f839f7452d2c228018524607a8c186da8a47fd4c59c812793573f1d5e45c166351be3999bd7f5e213b1a7edd7354190dc6cc18b336a92026a499148fd5a6256baf7dc5b809408345fee32887cdf7a2d778096696b3914630120f8e532ad8a0b209a5e0588aa7dd7a87c6c62ddfc35204dd776aa5bba9e6889b9ce3382e682501bf6b15f49715cd520887443499d8383cf0ddfd5f0018448279a28c10afc864f54f4d20bd0497d0e7f751fd0471083b9e7c9af6863c1fe7f98d0d045f3830e13f5a25afbb4212b65c6d71ed187f4cbbcd79c08ddb3b3d58f4b24df934788fdbb1050c8f6cb03828c815205fc180f4a889ffe68358eea718f77628168ecd7bee64fbe38aa04d2bba34764fcbf0e63608fc8cb9327f190cf9f545f6a4c5b05af4097252cf5eed6294478fa3ce8ff5cdf77392b5a735ab27c3bba72b52a00d8ab486c786647f9e22ca3165ffe593c98bf32d7ae15e395a4496475145ce4e3b3421233e8627dab9e4a81cc83e25d70f4c1bfb96c4bec5152a7b3050f63cd186e3e1002c19dbf861fc5a4e1ecdae7a5bfec89028a7915792ce57002b46ed227332b9d4d598cf96114daa99da0866cbb45f2dca59fc066e3e91688fc3ba8858a732ef8109879a1de07010be5660f43094f98b8fe2a4693800a903426603752d52140ba32c251312842ecb660575d72ba1fae104e00d59596ddd03fad845588ab404fa643bd8aa2f64f6b78c0090f8d1a0c1548bd0eed368e51fd21826a90150052cce7f2d7019b0f304df8c392802449b3f447097a461f43d3e84bfa5bf432a7221cd2176d77ee28249a3550c7c3e441b55f5ea49d3df2612afbb78de95bbed9cc4618591855aae98779ca8aac9862ea5fd0e82a623f4b9108888f4000ffa04bfd31fb8697c360ae86d830e8478dcce29af51eaa8fe26642f866d36650da296ac607ba9d664998e94574a293ce9c7b27ad9066bbc358e21f7862223c69fb9426ff07e382f79b36b48ea6fe754333d40f6e9924bcfadeda993da9ce58d72d28357b9ec526cd5227338307809d1e3312f94d182e8f20c4433c0ab98398bcefb86f85a959c34b5704f38569ac22b6bc2073b2f13c7b96f2a2185eb321afed342ee2be4f2a6a3c9878a42a32cf78d45d860d2b71e03391e13700a359b5f6a0853da9af7541d2e926cf24cd65b948c2c7597c57efb16eee54f818d729702e182f78db96993f9e94853e47599f05b76bbd4232a4256b0e2b67f0490b3ab0fd31e05e4e4957ff2985086d6641a3177e4bff77abb17315e43818f2782a91939d5679c4f37ac1c596906d0a269f528f4a44d40fb36e61dab164ace4878d0def665f59e5367ed2e23da60ae5ad81c2ebbc7f7d0e4f45d272eeb4807bf13de10cedd411c61a6e36bcae1286a1c366e52b3edf90a896fdb41ed1f1cb59d14ceb2c94b42c8b7e4151b336b452a8705714adf737324840520c7ce54c4f0c35a64e55e58457f459eb5534a904a5b71b5467ba1bf4648fbb93ed071833bf6c9521a4f785c165a48913c9b91aeddb2ee59dbb6210fc65a14ecfdd956c1ed2c2db5a60c7d1f9035ed2b34a393f90cc1fa82ca9ac80226cfb2faab5f4d50658aac25d79170cbd6b9c17501d44fbef66afd991617d72053e2ccae06230c6043a2ac2c71866e2b245b3c351729bd37cc60a247207287aa3f9bc248e03646af3b89cf385dba7bf86344e302f026830a09c42fceafb99d201ead9dd99587980903760fb195f9eeddcbb2ccf623b8e2e44a39e8cd5bb57f8f64ce52da337ebbd67e494b0366a87e2db7236ecadeabec8d0699d2ee99b09724b965b073c1969a681fab55f12dc2e5e29a254c3ad231a3351e31601e63576fb827589dfc1bcffb9df1dd302778fcc053b46df940dd1932629958e1d007e10891f58d58f62b9de628f9afd6909699f7050eba68be0fdf07d440af02db76dd71f090655395f206a818b214567cb45bd7f5bd3ac0f5da684c2cd57f840db2d84319e001a0da887f0e2bfdce818fe272509da45adc8b60622fad5be692ac262c34734a34c0374291fdbf3522e5291932e661715320560806bd49dee16d3695488e4fccef6c92fec3db208f84afbe5c02d4097d7828456fec88ea033af3242f66da913280993696039a0be2b5cae4e7c22e29b886947c352787dfe413c32ce68fb39b5e8215f2a869c86e46a95c5994789514e85fff030e37a7ae09470d0c02e0f1855c3c9f204a29da9c1fddb181d9eb4157f38ead5cd13cc367843484b5f9de49725a58e12aa9c35e028740ddaa6dbddfab56df4df2f09d73a1e06cd42e755de9c0a71560a2324cbd58a442bd51a156649a819af5feebd97d0efd3e9b39eb38ae28cccdcdcdaab692be679aa596cf0f0c67f4cc2730cb80077305fa5b3d711be5bc4a40eee1594822854002ff76bddc511dd207b22cb2b2785c4b4b742bc77e96bcd2e6c822332ad967fba8e7e124eb5908228c98df74d2c67231f31d0555e09d2a915831363eed913bb5e4c9e64faecbc0dedc56e4944c5b59ea13a61f80c5aaab0eea258e2e895ecd2db7414d9ab61645b4f7f87977a011555a1c8495cbee5bf6e5cff9448629d0db664449b970d669028a4e45240bba1aaea6e961b5b0eaed3658a55d500441beb36e4e2bbac363134b53d9098ba2a62f74ae3e386e8f063eb1db0aacf9196e27d68292fb007df02e5e1a6e944b36b4008d901519ba79b90aecda0ca00b574e41ac853fa3d4c72e89478c72178c2da958f1d0757898dbaee054a0e641a6aa496941266bd105c2c9b28be394a15e82e1a1fc16325efd4f9ea7dbdb6dcd87987e590f91f27c3ccf2822a43e6ff4ab8c36a0cde64e628376c890d42c93cda2e6d375f96121b604b33a4e461960732e26718604242866e290a81fa9a84b4799114d7032636da2b1b803684e741d5991e955bf872ef297b463d3aa8f8c219e036100a891c1aae1d68b8315503f35eb5cbbda40a1b3496c5165743a31a7a301f6b5b22a44f06143dd096695fca6d1094ed8d053246bb220293fbaaec95c01a6e5adbfe290cc7ad955ac435211b68dbcd0fa8f75702de8dbf534bb382e57f7aea0d50417f6d578e5b86286c193fd258722ec32b13e24782c50bf87dd84f774c2f97bd62502fc584844aee086ca4504baf3f2eafd237239f8266b4ec80865818de4f78a1076ef163508b099f20c8efac9177347ddeb0ec3ff8d92ae43862ee578a34d90fe4c9043c5668d6a687e24d6449536f5c103307bb7c717ead9cfdd1bdfa553734a50514c8098b53515493ed0288ec8bbe6e4654f910692373cc5504c082e3f2b7d5c7cfbfa225d209ec124f7e8299d7d600aa952ab1d654b97d79e94dff50df798f0bea261c515c62cb11621a574c7a38d3d13e5472694f34bf22c9c1b34ad5e6a68d697a271784119d1416a215631bb6db31ef2b45f653cddb36ba256cd4fb9d0ed447834302d7f3c9f911a957e2213f09c2cbdae9e4028f32c54cf5906cb08727b63577f5c599a157a87b8b0e8a16baebb739762856c005da7260d707acc3ac68660245f26b36e871b01fff7fc5a369416d8eaa4a44388dd30909b29b016d73aebcb71312cfbb2af791e7f0574278846fb1ddbeaadd9b429c52aa5c664313dd6149fee6007e36df60a81c431f3368eb2ade0f3062594323cd58fbe95eca88f27055c7623892c7688c0e202aaeef6bfe4f00ed6808c0b0495d6f2d1f1709d74f33aec1c7996568bb9da44f57cc6e332ad92628641d810c5086263c46f0486bace9ddd9ec82c60dc584b73a4767000ebdd71b7798448746aee92a1b3cc0164b6e3d1f52f9bbb7410ec80f42e8f518353e7f05ffd232598bb29230f755c96c33b55b904a7c0db80a278384faffe7f905d06fe58e3a4183d09b79bd78da8e3868706b8954448971a23eadd1fe4f413f363280cfe093a2bc541a2971758e7ac9e216cb5ecd886d0288f0425d66f86f12e8cad8bd87a658b15df1ec4c3607fc2aced950f2883cf1f72aa9a665facdb358ec2debbea4c26ab1c3bab12670936525add31f1307f347820aec236dc451e9b7f7d1c34fe0cfe3bc7a2a0071ea856645b8bd470c4d0a9c173763469be32d4868c906317953ba2693a0feecc7559b55bde6f832537e174dd64202d902457c5e390337541f1d2d4d0b4fef4b96eabbe2f398cde8ff206b6ca976564b9231a040fceaceae4185921a87593b17b3f9d436a526d496ae57c18647d8807e52cb2cb5d720c227fc6c4e6642a33b9003ac87f62496dad9799faed7afc40c60e61f2b27d9632edd3743f5b885021a42e0afb391945b7de0cd51699318b2509c226fa62e4307950038ab65e741ab690687bf815d1e4638928b88f3ae2f281225ab10c6acff7381da3ffa198e3641852b0eb566a3144abefab8727f1978c30ad849dc50e25a06d6fa4a59c508f15669723abe5a072c92eebdbea87e0d7c2bef648667be1ef15ec0e11fadef52efc3285882231cfeb0294c5ac40ecec47a5a3afa60d3f58fe436b54508ec5705bcbf88529d0bfad62692f9e5a36f7258d06a7e5c198e3e7e9ef03f774108ff52f36efc5713322feda0f71e4c1ed48b705aae309db2626b67a06af78ecd1ba09671eae55036558b820545e9e916c525fd26817ba3b58d8ba093c41dea5fcb7284abee5f0a45b9f96cc2b1d1ee2edac125c2daa0bc38aa2bc14218bf25426cb70c89fa7032ecddc17dfb4e3ff2c02f3f19ec978920a81388236a87bae767f563021c9839e95a767b126de2b800c4f8ae8b3535bc1627a93478864a7b0f27ff1fa6a72f590378babf3af5a6be90f36614423cbb9d2b3dea3d9b898e369373ed9813999ba088eef5f252f612cccdd8ee5772e5e45e2b966c8f8797c3a8640cbe5ab17aa5787831d112513ab8839784f2760576a8722ac6c16b06bc6dd63a56d90e45b4be2a3432f3f88659cfbd185d60f1737c1e05ef752ec38d3ba82f33488b7c7dd181a0dfb17f5ac6b36864bd18fa3e978fc6a52ce6f3aa655b184169955a29d91de93edd617d68f5e6004a3c933ce298393b9dd385aa882b03439aeba1689ba1d2bab005313b14cb36379bfd18098658fbf3e5c488adf2d325a4d8bc5d58f935455eddb6acc55427d09ffcf4320e388d6e34d57711c4d6beb82f75ce8c0efa8cc09424eec0cd3d9c27b39df755e759b66ef80d99b5d29a7f39862f607c1a42ab0cb64e2e1214e078386b9e104bb67844d12fc5a2498159dbd4806ceff89f0fb8c1b1af29de7af534702589742a0bdba6e9df9e21f62f1a1c472a60e18343b292cf927b32c163f8fec6f878b01409545e815d02dd112d10019960b1a0f628a66e62bf76ddbe31fb43ccf71fd83c9e6251c54207ec1f7d4d53f31e11d399001dae28178e97c17a6ce2301dd84906768f7a3b44166b0a131ae89d80f3a839a7a38c042e2362b94383a635a30b1fd76fc676edadcfa0026bd4b9094ca597f00cc0490187b62b31f6ec334bb6575cd31da88a87b1d63d8d6b4ae365876b349d43ec3a567c3ed157f7840e488057590c3bdb50dc68294bd10556f065ab38c0cb60fb90c67c18ecf021cade0eff71818852871dae20c6e7cb1116eadb4a765b976b17beeaed5c0eb2d064c91fe939d94bfd75ac963359846d838d7b9408804365d619954f59f9c4fc9964c2c3a9f3e6004d093fbf9bb768cf41c41396540cbef1abdf8a1871c343c4acd59f5cf3b070330bcf9655c11d1b60b57dec77a63e12fd3e69b87da7e6988c88754b5297aa2dd230799ebd5099c224e3f67b1b3aaaa0c40205127dad878ac69af0a9eccbe1f91cde5bd43d70f0b17f3684a46fa112111cdfa7960afdad572aa231d38a44b637c10151d4726be20a3b38de3ff158feff1300da39dbf6c60ccc0ab2ddbf8e9eafb4e7ef6d49014edea72cb730c165a2bf4cf5068aba882f68d076359c9d0c271792dfbcfbe3e256e77b65bd1b1a1127b1c8f882a585f821ea4a64a179ba27a78c2825e3c8ee6ef7d1b0aded6bba431dec286dd8471665625db6e16e57982dc7eff3e1fed5dc2aca94e2b9ee958246e8ac31496cfd1cb56f7b3f234b98e7c63d293fc5119486c8fd3f4dffd8e33cecb9618c04b86b5dc5775d525809fcac477bffb438971f8623c18b8547e4e73ba3f83cfc34c3c998e4f6c81e6be62cbdfae437b2d587bd512bd97afaa2d243d960625f8b86886b2712ccb7047e127753fa0b38ab60803f046270b37a6053cb8d51a623893fbb560ee061f33f854322850cfa4b1a601e68dbce6d51ca3138768f4d6567225fab3504c6ec761afc28e073d65acc8f06367bff4fe1ff438da0756f24c8a0eedfa23df22c57f64724dbac2d8000d413a1f4d0868ca28c7df856199638bba3dc9bb0b994266ac88dd031d333a87e0d7a1c44abce3480cc4ab545d639cf84c633eea251293ff9e22bea93dce4fae9051fef1398d97783005d1259a079f01057e064cd71ef360b5392496cb60faf3d18d884c67428b9f5a9d2a4f3335ccb8c1deb320429e73cc636096a95afc9efe5ef92d28d207301ef8b10f4a306c22742edbeec85727b1ba46569885135a2dc69470acc4b3ffb7846cf1a9e20a90ea94f44504f6fef53aaa48a27006ba1ea903b9a127f26bc762745965208546ee97372f54b92bec4cde6499ee12ca4dcfce605b67b2bb0f8ed3ac8dc4e3d0913efae2a585c523abf9b81961e5da1a30766e2c0698c279a11b4500874c6b122ea7af22a3ad97e1e6fb4a0a1977580cc4852d9b666815c77bd1e4132cdd88c9c4e7deb0f035ad29c9622f8f638e960b9c450569ba7156730bec4e85d8bf2aa97ebf3c334b7dbeb09640f12b92eed1f089adaef960fdc08bbe20b4ecaff3eb5c18e32449a86133996d904aea3f5c2ccf0586f498357bc9a80c24300be390a93e724c281b0218e15843e34db431d3f60baf39a23c621fa1720b33b160c8ddd4175bf35621003a201d9553b7074d773960377f80a6dc36763b7d50db0525142be67f0c51727d9363663090129856a96360102f0a5eaffd1945246aa59c98c0cf25d72b384f9ec5d713a9f76d14e4a736f692a8522b27454f4f8fb0c9d39a43e7b5765af7ccaa5e32c62b4c88306b2bb07c23d9924d673d29e463824b2101468428378dccc99b8574a046ea1a702116fc9783f4ee8f4503951b78c9c715dddf386f619379c4130e85338ce9f964699ca16c58a3732a2c4470988743d7603c0085b9c35ce9ccb0062441ab51e9cc5055b4a3782827840a5dc8bc632bbe1234ec2d49515f1d050e35c5c090c9ff5cf9113c279d175a66608b6264940d3326c62fe9cbd8d11abb1eec0ad0ad281feec601ac04f5fe67d0cadbe484a4dff9108828c4f687da270411c6b4051262d1dc988634b135994cca99e79b11614ae5c971d2e904e09bc66c4378cfc39339c14eeda704808399f51e02fac09d35aeadc0f414191b1a862fb5ec48f98299923b95fcfa9dfd86a6ca0470c3d0f48ff031b2149008504c71a87680e5fcd7a0f8b4e96ffb98f5ae6a2a9aba7ea2ed459dadbb610f8d654d640a40ee1e7f8fa814dc6e67d461399234174800d60095c516fb21a7317a7b685633165f0679137c070a6a4195b382385a94a32fd0bfac8c576304af548e8db55d037213f05e78bb62498bdf09082cbdd677c5549501e5bbada359b51851a1df6aee7b1322e3cbcc95daba7143abc97a7f9c4b535bd19e374676d19013810c2d8dadceb9f640ecc82413162f79835f34fdebbead5ab06ccc1584b36409bd0198d7f42432fa609e2370cc18e1c0bd64b55c61d341f2783315f44bfe87764a190eefcb67e73fdbde5c9b5fb857ab3c14e4b9b78df47e024f19cdebb6e3eb46a09bd1ca74f2d28ead9600d30480a4f8a31bc59e7c99319ab8a4071c7f3e3f7a936f55b5232fb23337496b440e03ca8ae63733c470c4b9c2f46464f26f6ef7316576ee7e3f06abe1689e896c04d77e47cccc54f623eb6bb04409676c186d0254e979b72c40f2635fb1be4bd150ba0d09a9e3d329b856a404a4b588d2263537c0cc9f04261e9b92d2664bfb680fd31af8536678b0d6a09e26be5f1899acceaf861579c37363f3f49e64fc71e2a929d43b7479377ce36f5830733242ae0e66bfba025491d1d0ffa57144c6ad9de42c1bf03766b120b7e9804ae9a3858beecd229088d3f1e8738b775a79eb2238605b910ad94e8917904091922eca3ae4c63f58b0d8417c660a8db42655a88694cdb51421b1a0dedd3eec12d38547af6a2cd8329cc314345b4bf4d3587f0f05d54384366e2bf1cce374e2e64f267488ae72820526cb95d791c75dabb3ea09f7abe3669d48a0089adcefff47d8483e4163662395948f83ef6895053f0fae1d766c2524ba4bcd9a09998d239f46bde8790add74a121070bfc0cf8f9e8be6f2f014f8e1fb44e022c4f81908dc54e6db9723f9c0ab586b8c009dec86a1e8da3365203c4082485026abddb33d74b968c54bd2f3e066ed27991fa0577abda5fd1ef7ea58d71d3936ac0e497f0a62ac09104b0a8d3ff2549d0cf55bdfce1f296efc0deb1bfd8aa923faa9cfc47190579abe37b514f0ad64295e7882d7ba69e7c0d42f8c735" + }, + "globalInitial": { + "ownerDigest": "335acdf09bca45bcb3e41d93525499ab66c8f3c9cc7f8c55c79933398981cbb8", + "ownerSignature": "20acf6557531d67ccac79852a4d9ad42f0f14e8a984b0253f6d564be280fac02917b903afbe7b76866bbe493198387dda6a76224f38438ad85ffc658680c9673cf", + "operatorDigest": "3cafdacd79e96cfe05936d6be8184e33f0ea53dcf9c10f978d8decdcf63f5e39", + "operatorSignature": "680f501bf17986f6d4368624cd17b5fdd457d7d108715fec042aa79102905552ff60e1a1e8c8a00b9e7e0fd199bee4db4de91e0cd5747df74f175a01fc7e9f87519a9765df9dedbddb42619e5d59ef954603931d47a95f31527bd9bbb8458483d9c62b5b8e3d03ce0ea0168f1a3e212567047dbcea442e9c0aac4301a2d4a1bd3fed3384a9b124cce483c5c14d03f50e687b8869ee1ebe0984cf3758ad05e06b7494075782632459f985ae2b1c8e99b7c440c4ba76583a407dc6ce8778bfb1d3919c205d6ab99d4af66a66a91e2ab2f67dc549894eace279d8d09df7b59af98bfe1e072a4638ed343635f5676be596c48b11f0c7c5da23121d251c76d3628e1ef6abbf7a8e0a893aa80ceea672bb8db0ca6ab469a7418b40acafbaafba4cbceb3105f25d6be72017457bb199573a78b923a4e068dbad86d8e8e73f495c9e0b47a5c8ce15e2238dba37be1d9cfc5e42d1131b1e736a9fda754cb3b69175787aa4cafbd1fc8ec827edc7697656e3696aef034f6f93b7a328168c1740e2368e78535d99a8805b070958d79b8188954bd3079749efd11405ccbcc907e069fd10a41cb5271772420c3090cd4222a05e327b67019173c4b6a8ca2025ef5e0be138aab41ea02974d73556a798c6cfbb65263f96c6145c3261a9b166a4e25b4fb68f396e01ef6731bdaa9a8237d50403fe40ebf534f529b9414eba42ee29422b4198e325bbcd73d3154689968ff70b59272dc8d0ef9f7f55ab3dc1c90ca6ded45cf9b87d572a7a3c7e111be18b2ecdd318fbd5ad25cedcd115f8bc2c7c25e7df4307be799d3df579180c0d960434fa00be7738ddb79b1484a65015a6d209aff60abe69845251f24a5c4e7a2cc33695c7bd121727dd1718bbec94879747f695c93b028fd0703d3334d3fc8c1226cf0bdff2ef5c65c2b5ab386cfb30ed6c1b9fb917e030644ea0d11cc2165cc3681f503b04e77546648ab3d23f307f9f6f579e0462686a763a092a2f233a2f108045cb91227991318cc3361e3dcd78d068849cdf73673bc1bba22b693287a98b52e038a80b9bd441dc0eee0d11684c4552f48d45c6b2c3b0c8ba705591671ff3935b354a7bf4768d71ee7ca955a490dfe5b80fdb3ec31b8e01837e20e464be32db9bc0bbebaacd09061b654b2144266944c9e294f31efb6d5dcc22df5f2afd002498e53b0710dedeb29c36a6943c43934abcce3e99b207e1a87cf0008f2be8de9d82f20a204598944d6520dda082fb544e0b1d816d53b826853b9b5dacd1a90700eef55a77e35fb5d175690df191312b201b4a4a8fa091552651f712e241e9ba9117157013dfadb1c4b8807a7679673e43675db740a02782a75b59471817a3e74d20c57e24cbf597db4395e8fe42fab230f3f83c54e81acba00a9b2ccbf4ae380255e0eb5d7d2c0b1de5f8810648494f881fb0724e3ea1ff0206eb85d9652d8b8ef3cabcc16161a1ec2bc4b73a65b5f007f392db6272f1fa34d579dbe0aaaa81cdfce40bd674c6f95e5ff0977785e6b7df5d244cdbffaac336fa6236ec42b32b4e477dd649c4135e382d8b70de6d08c5a735861a53a47b43dd6494808a1a4b947cdde0b57cd789eac0ca3b1615d9450936a6be8e2c543e32b396f3c7d10d78b3e4650b050f77eb3990940cb0a31c6bd5780ef7865c883c8cf30f8d7a740193768863683bd2f9a4ddbcc022bab1b437d0ad53bf85a6ecc98553e321a5ff72fff490af9e62639d6533eadaa9637a974d3d796a0cfd851a15acbe40653a2fc1b728ac5a6541bab31126096a65b1fc3b93e6b9de4132c71443b5d5a289881bbdeabd5d27cb7e915c005f32a8a036e48441dfe37edf65331aba97bc6b9f8209d768bad9c5bff93d379811531b892953f12df913686d609f3b0590590fa1a9b8102be61aa0a51dfdfcfbe1cf7b71640a5ec2201c6885cd77be399ffc520b4169717f93c9e2b2d3d7a9632982edac231c558c92b0984c37904f22b16565d5a33f918910dedf28c2bba97ad2f1fc7b4e6c02d09f5528d68c64e2d42446baeaf4e1cc3a834dd451bad45b4c103d91a0b3278929a4b86f2294be123b56e4d37ecddb12aaed994db540040d74094336cb89b68f5963efc11169fc1f4500219600183c5ce1629b001df2115efb694843691f0a80a5e2a05f87ad656df29abbd8f24fac2af996a99da9f4eec40cf8a030b95aca756e2ed9b25167c587bdd9dfa604e67c6d4d05c8fbe075f2c25e7e5fb8f3dd7585ef6ec8251968f3d6175c9f350f78a8c33b10d56b4c523820b595d4c2b7546f4e37b75a80c13001466006621088f9d450f1c549c9c07801e555ae192e67be767bb4a3b8e677ff54ed9dd56b96da6277cbf53f9f73e4a6e23738f04d1cee431bf8fbf90484f74dc59337cfed9b588720f27f082df0821356e404cbb8b066e6fc35ae4a63a52b751c412da79a1e2f332cd57888bc781a9e9c1b774cef62c9ae4226ba45882dedbc3154954bc06473933222e7a4c9260ff524d37d666165ff24c67c815966a01212d08a15e647ffa97c71ccde743598b17b85685e4d3b14273ba45d6ffaf1a5aaa10c04cc7651aa08736d52f216d940d002e064a5b0f0541500ad9a11cb334e14d7d863ff064c31c58653f0fa53ce60605474afd5a95d8b6a8011c239db1996a6a593e56effd40310773d36eb6fcb4d987e4d04d7c0b3d2ff14578a733d93ae90d626e4772372d097cde09c073c77fb838cd5494e552b547d860ff037c34e08e0d57af5025f4a550958d321ab26fa86e51fb52b13a83033158f79cf73661d80144553810fcf0705b5ec737f048a1833f80cf55d09406cc1b0382ab237ae8b878bf0afdbb751b7057ae428f74545200b17b1e7c9a4e59caa906f360b0fa4e8daa28083c5dfecbf0f46de341de679edec37b81db8ed07177dbd392439e81b0663f5e5b421f6763d2bf7b947ef7bdd31f879bd3ed595378ab97198405756c805d6619ad9dd51f3b0b458aeadb51e3383b551f9782617061068795a13bc794a92e5374042b58cc248864bc69e9966e40320c6bcc24967e8a0186fba54edc98cb8404aedb98f0a275b321ec46c03f6ebf34ba5ba26e8e4e4722696d8fa4c2f9c0467c718740c84cca4a10a7abd68cc0a0772f3564da6e361947e4b2d60c9a4fd7a090cc3a3123db7e925d6846f89510c56f54e5de4d58de7d35c63deade39fe42e0a26a2b00656483850b81a1782a7e32e0103adef008f94b245142e557b3a4afa10748d2f43cb6a99fe6a2736cc618d599134a8088f7af16adf4bd25731b82de1cec1ac7d911046dcbb6f399b08733a9b7144f3521aff6eab1b1fb3c4e8e4f755c6f0e7c6ea718113065cad1acb1c8781e499bc98465120504565ade32e6036710c03f6e3ca3b67e53bb1262038eb9a2be11f3dc08faba5b4e247e1e34a13023aa8ccda71addc95ace54ce7c3ff7341904370291a0cd513f7ec47db118adebdccf16865a83d0295b3aab8ebc6dc9669cf8bb04552e7fab4faab5ae63d3b3b73c2833534c0aabcd3c6c2263e49defc449813658c33c5693cfaa73c569ae82d8b434031b61fd711b81c8ab5fc9d030dd624e8f590870f47011e49ace5062cbd555681cfbe7f3a8bab84212c561f4a71753a0e5a94bd637ab8a6c3c2be83764dcb44df3df865d6630d502dc82ff69a177f12416e37f155428e84059b8f61ebed7c7512bee1eb949ba05b4503b10d09d16ff8203c30c8258eacd2fc4d6a9002d95edffc55431769ef990bb49c8ed462148a7c41ce84f790794a9912ac1009ac5c9619e3090489bb4183ddb58fb0cd5f087835a3c45c1bf78e04eb1fe6e128d8c619771eefc08fcd3a664036ea41e3a7393142e6b90f655775e27efcaf7402085b7c2c69aa79ffb284f3604fed48b76bce623887c0fd1284256822142ea03e26235a898e7112761d8262383a912645f72f17ee1039afb9e10a114a75985f85dc180c0bc5321de98067add6afb49ab6fe9ea4f2971ebe7257f65b6db56ec21a742e22e08a2e5a72c10d8f1b250a6f8016ee3c587c4929d1e7131a09f677a75d2633fc8c6af106ea6bc1d4d46bf6ec914ce91edd8f80df79e4922c7b1925c789b617020c6a6dddac7eb4ffaa032c6636b7031af23e82b97eb1fbf434edb1a7c91d43c0e40fc034dd11a73917c5811c1369f817b5ebe054f509052331800c209aee2a26915321c297ca80024f3aa8c3ae62aa3e6512a07624f5355d16a06698a54264328068bb4e9d24583e4c965ab2e584cb16095048adcf9a8f0f18f94147acdec86d6eaab337f322afa0c7e90b57f0c1211eece65bde9e971b678a05c8a06652e6ed105829a0eb4e0179a2406fee4b811c754e85448ece62633cf2c05897de06b240fdac8a10f36af9c39146a20c73fd2a163e66db734308ca4e283ac495f55716fbed711ff848b62e488434e740bd36572a8849a57b5b4c856174bdebdc0fbe400a691c9cafdef97108e8ef53a97514d445248c2083cf3b081fca53c775f615755fa620b371f98d7f78cd9f316872ab319fff3d6e750f373d8363ce6b9b821acb153e4606be1b8b687ef82a7964a472520fc4b63175908173152bb9baedd0cc1c42a8fa104d7a3f5724216280886935e79dfd8dad33c2c90a2ea887ad126d40cca373a4a5e5f63aa72a9a8fe795a23a68bc3f48a37022cf19124ece56796cd01d4bfe75ff522aa35ab0cc2143c3aa1df198dcdc61ee61ce42468b447c8727be7a4882119125e71a9938bfbbc263e41617b992f7974278024f9cbf070ed1f2d8b43a4bc4ee5edfa8114f80cd9f8a154c57b4b97c33feacd844a835d511fe41d7959f0ab1652bba8c730ea979695ab2d49b5806a69012448b87edd108e56b138b7e4ce7979a61ec472c783055c1bfde2a28274cbc31619f204197a21df68e37486637b502f23306bde9f188c19185cbe819547df6b2539b2c7a14dffb9f38d9ff64ba69350f454f7a0a9317087bec49587f581a3174016d9249a0d2d4a329436e0792b5129f8e99a0d751bc00be0f13460bb3ad79a7aba06a64deb0894c00c21c78c9e624bd946b19b1464701f25ad23c73f0ddd0237f7849211a94c18870571f20d66ac67369763e091e885b9347f2fbfcc3eb03b8e396d147e8f333990a8213f95aa73ccac7fa39c071462c8f029342c2f1fc0c6f03f07a2cbb49176f7d65536c6bbf55a3f7edb990d0e27f9a388c03cd40a629d30d561fc732335d6dfe701648d401a01ec16f4170c99dd7513dece33a0aa25183fcd786994c4a13008ca671ba6cfbc0d5a06b79ea592b0910927c33e1ae8accdd45cca4b0c16db3ad326842beb1e56b08f2b0cc12d2bc919302680e5f579ab43f7392a0642c33a0f72d8e2147175a86de7531de5d4fda9da280300f26fdd1c2f45da5defa226117121f72dccf2196285e116148945bcd9d719ab8e86e98c37e4379e40518f8473a1e0c8fbcddb6a46628aef8ad12b063b754cf022a437aba68b69c753d121dd87e1c5b9b0552cf968293e85cc26c5e3af6fd4cd5e7e179c26d0f2658825168f3450d3b3fc4f8d14faa29f78a96bd466a4fc95e93cfe161da2e64d2feec7d47fd239f4d231b8921c43d53491769b0f3acf1db2983d1d482091bc01fb339a429b8533f392933613b9d5cb01d65839b047b550959de48ebcb3f2d88d2fa69e77d4b9477469fd7a1d2b3d57c72ca50488886be9a502ae5798c05815c524ad9f20bca64e7784aa2e691e52832734ab14a77e311fcf2ab5c2c2373f94623fa6a85c8d75a26a2a5a4f7ca34ac9ca3334a70dfe91eb1432a9cefccbc988a7e0dc2e02118a7472cb813337498db8e0ba0fabccab0229637a17e75a026349edffe856519e250e707101805a8ccaf76126bbc6edd2cfbabe58ea9a198114af5aff2db1bdc68819c5cc737a52c9cef8473cdbed632c55db2b418b040cf3649fedd5afac15e056d2e868bf2880e7a311a2373c8dd62ceb501e9c560d2c0c027923468b31de8654aaaf81ebaff81e27b88d88c042bccc32e78f190d9fa4cab0d72183a01fc44deccc3f4e5a1bdf8d722f12d5d08c6c5b1887a43ba7ad2ea658d1ed600d1f10352310833c9a6e8dbb3ccbe185cb9af230e373078c9643f1866dad9ddb584c95f1349daef9f73dda7e339f7a25c0a9fedcf82103a0c41ee680dda7e770337ccecc83bfa132447553ecec083cbaca9a400589a963c7866e6cd5e3bef14cf4cb1e601b68d47ac0db2aedee9c0b4f97f08e2b305bda1b8279c6aa49ce64f5ec584c012381afde8cbd3cc60fe02c0b36adb0b9ac07f9b79cc054f9d21a6f9ac503ff402283a11eb01a97d0186d587b6748457572d523ceb2bd36794ae0a3a6b8ed3d7425403da79cf07b06f0e3c1362705d6326a8837524de4d4c23a5f026c7650ee327be3c1a17af4435588d755ee2b963893dde4bb8da898ed202cccf8b1eb3ee5683f86ea5d36995a237856504d25470578e3a4e036e5da4099358ae288f361b02ffa532de8c60a5398c691ac411871b3b1a19b2b5f6b01d54d2b1a6326a3e451fc07c911a511226b6cf4ad3118598f9ac9b9fb168a4c53b7f8455233d31ef5dd623e934c1d04973f6921aac86c1e416fb62837c62269ab55f0b109ca269f307b19339e7f6002e8441e86d61a3725164681e09445e8d71e2062ad8920a34a6aef5519a0517c903a7a5ca1e80174f7e30f8b9ffb5694bfdbb03b253feb9fb5ec5e628eaf2944ef64d940f5b32292345a0ef4cc9ebeafc693cde768627a0378b8f64b52245114d012efc51e53b38aca110acbc6842c1ba11e159067502759f8dc532aae0486345a84fbd11128485fd6db3f874665732d074a8b6b294c4e0e290e9687216ea2e1906f3fc1340ccd2c299c82b93a2c364ebbda7ae83e7ce4daa9aa8d8d4971c2cb51f7a253e4445c6ebfd4f104b00fb35e0f7afef8dafa44afd2e4bfa3649d66a9f5fae806085d41edcccd3d952ddb08bcc5974f5f2e7e4167d0430b53d308d36d75652f1da01d983057ed3f32320887c363741d56a2cf359edfc977441ca56c567990c3d8b3408f4035de8639e1d3ff4c0654f6dce73419871ca314d4110f0c99573ac9cd263c0b9da699eee633bfecc41e873cb8c192a86b035577ec9a799a19842e0539d4b4f5834181e124bc005716d55b2391fb483cecb0922624a3281ee1c0c095efaab8ed602e5a4ee4628a7989ecd30f9c6f8e4d757c6609939ff5e9e38c7e8cdc9dc8f0668c750c01e09e60baad4c263f2e33cd7f3d5ca2176c5e306bd09d09f38ba2c23d12b5ae12969624c3cdb2b332bee410a72d1d826f4199fb1e2d65c71a6729bf4dbfb7579131da8ddbfa34de88e4bc4731274e72802f732d74f4764673568cdeb7d9c70157fdb929901711d50b34eb1ecfeb5cc89709254cf6df6f35111a59f442eeb704b9342cbe06c5038dc6c0157cdd79a0824fbf6c8e672b61de064259a30cdf61ac52986d142f018bfd832494a64da13db069eed5ef2f221464e9debd3517d94b21c1d36d0d05f7a68166c89b900a4b6716ca79cc8d84f1e9c0f45149ae2f3c47303da5f37ccd9df307d026d8a5e75d830a9f6959f4e36cc57972481f67a963cddb73843e5fbe16b4905297d4d77f750fe514991df1e7184d43ef5ffbd05eb13d389a6203f37d7dc59e96d1413637832dd9d73b75350d929abdace439ed0fcdd8473865a02ce79f5733cd5467a70a7c8abf4c6ac8a235165ff5a840dbe3520c74dfced5d4d3646effb517728733759c03e94b2d4898e01f8401dd9817d93554d4d115979500d0ea0a48ef960b8ffab404ca5edcd11191dc0dcb0c13a04c58d9c12e1b0e91af029bb8a29fd29545f6f12bd997cf00521c8962161e60392cdb6deb49e06a310b4a7efafd9a01a4b4377edcc2ad9696eba4db0409745e0bd8e929f8154149d680c4966d1e6f5e64fc962662b5b68dac623c774b7a138a6a3705ddf593eb3f4ea966355e35999d1e63845061c8266059cf589dfd3b1d67d3ecd4b4ec8bbb4f9f872acb9e62ee46478ed3d5d273c2dfeb87d166604e996d4da162241baf3557ea34fcb1f38617da8e50ba79e10561fb44ee7d9a1fc12a109555b0c3575b453b9adafb51619c10b4c6d3554613ef32ad6278249bd9b3cf3999b40e46fca50af83acb42d373fcb83ed274200d269dc9ecdedd86b49780401398f1eb37a023d5d72199d26bfc2c55e7ef2f5c74f6dd56f67f070d3720767b52325409b8e9bdfc9ac5c080a87c783a3ade772229ed3af19ca02e32a6f573e8018ea238cf1f7fe498d314087395b4f45394cc8755f32de43421d5400b2d777509664dc26a0b7401321b67d2fdd6df11811c027a420e348b16d3339fef1c2c52b8db70fcf7c2bea5bfbc76696d35f167a71b26116769457dad4d741df3d0d5253894ce647d5c79d7270248b1b3fd1a2195d711cad7e5536beb86a59bdac5ea44b9e6bf0d8dd9e15bbc4f4cd066ee2d74f4551cd35f44ad20ce3a020bb068aed6485b6d2ffd30c76218e0205975276aa5e2bfafc1b6023a101938d443266cdcbc1bd36d8ef2c6c8194be6e07f12316bf224c9474a28c5a338ab0d7afdfca4bf2d6e4ebafae3fb241c39aaf9c9d9bb57017864de3f2ad8eb51be335d7ad8d384c181d8eb6f9137357b374e2b057e8ebd90b1cce0be6d8084b1fd905f500ac5a08d19c4d8ba11dc8ccbd632fa170e5e8903516fd6c7bea4dd59143135c18266caec256c65d1c9b6c8ac80584f8857ecefad4cb46118c36763e0d949b36be6e5b0f5e3204bd0fcafc1ce94d979154c02b8f3aba4abf1d236c5474dac7aa843d1688a7710d9b473682d02c272b4cb5717b88e38ef7e7abef0d92ef3589bdfc8a7821d09c96dd043351318a21c421f4111262456d664f37dcfe82e51eb1742bd35bbdc36dc992b9392ef22132ac0dd088b719d01365fe19d397743fb5142069872a6c58658d079368e0ab8527d451f63f302da882771c6564da0fc89173bd0cfc57dd60b16b0931324ebf6d04e4080628ced14347072d78df56b10de8e2b8e215808cf0631a37e008ac863d57561378957971b69a867177b4d5ac4b42c5df7b0846e85e10d916f53f37d2c339da85df72585c56c6ec69c611fe51d49a85704544074393c46c050cbc9f8edfb4d78803c43bceab344c4ef02750987fd7f61884c3ba1e54a938ca61fb2b9507db37350784250783108b837c70365858cc14665263f769f619cf38a6c323d790ece7d2b07121bbc87e46e2bcc93330c4cf04b3d58151aa92a693c715531b212740afc42313ef806e1b2c0becc0938f48374953e78b4b6f3773697b4e74c16818bb9db606c7e8fd23c44f4bd662515ee654ca18502ec842c1e1af175b0d87f551552aa7be421737b698233afe468312d0f35918d1c8b422843918df8b6d0a2f9f1e0837a270bd4b47a1ea8fed4bd7f764d865ec8c55b3fc1ec3bcaf3609ce3ac56c3c27418ff30f83f7815a79c5b0f8ad965bada1a3272f2530dd7fd4ea3f49c259d6e83f578b3e409465752ad0ca223ac6c6dc77840cc09a3f2c6503eda938b320e77ff6f23aa5f9eb1ddc3a51f9132a0dadc97cf8b8f126092c4bc24bf7b82832e355a78e483a8270153abdd735ef9c4448fad508b809e39e7bf529ae974056e78434cd7b342d899fc56373c0742c6f8a24c9f17c596a0d9800ebad558b38700e87cb9a8604b29eb2347e781ea69521c67b7c0d1a44bbbcfe53124cef45696d021b9a92eec29e6495a756a8e15e54600c4baeb6b2865d26640a011bd08a52ecdb659467f953839be09324477626aa18ddc2af309098d4dbaf7cdc39bec389eb59c9e7ad4205d5e749a6a7f7bc4e36fbe998117e434c197baf4137491329ad2f4d7caf12f6fec75eadaff358258b3e294b88ea9d134940a9c71886199133175270a88672fac96fed543c2a58ff830f85112be4b496f397a9724b32fd55f31985adb25f08c9285c2f8f22ffe1ae4e29ba2879773b58dfd6e57e0cf251953be8a444d2e021b4451fd003ecfda6155b126a3b6df38a96ba66ef8f5c34483edfa1dcdb5e219cda2973f80fc507f6e1803e001b1d398f33cd679386a0834534fda95b669bff6dda6213f0adc1e95005658de34fb8eb1dddca80737a81877defbe6edc50b90355cc8ae25c4691304b9b0b37acaab0cae99458acaf9eaeeca3de8ed6c915c23bdf05be5beee227fdb109c2e7a12cfa568d785ee57cc79ebd67ac1edacecb4e4785159e86e5a5e933b103caa33c9e57a9aace83524cbd4f2ce56456ee3b47d6bad5c315d1d95f5a50285b793ba1f1d6af9b3e72c1c20a92c636c5302ff1f8cb661d6ceae80401acabd050edb8efdff661ac6c284e6b210592c51a9cd118911282f121a247e004efe7862613569ea018bd64c16bf57b73b4bda166c7eafd820f97882483875d62a553c6c4bbb7e2b72b6b58a1817362dbe781b6292311855fec6407a2a7fac7d7df3ce2d8ae47834f38e0977a87ef84fa0c9adf188307f30a439722b07ba2bb1fe521ed49db94bf9202a4b3b24b11f4c5c558dc5c2db569ed19f2fd245ed4ed1ae9f5bc9b0c42c4016382401b0b241db2469142befd5d9b6b3b46df857a4135a6bce55175e496614b424d5284ff7f7d915fee71f8a14b0b6cb56d6df68ae5fa06352804d083bceffe6dc003fc7b49f8954979fed67718e1097a2d9ce19d41997e2b0dedf59035024dea18ea189ff9bb619486e32096cb273fd818fc7e4e730f80a2893991a1a0ada5a99e5bf31b848555fb373aa3331105e000336ead3585d7b034e8dbbe9d2720a0175384a166008966dce18718d2ceca7727584416963f988f20ade958b31e7d333c1b668eaef4bfd770e94c51e50698db908a67b13b445d0b5f7b982454a6137232c74c6791980ebae169883506bfe0e306ca084425b9efbab9973472d38a63c267d282171861abd730b0b8d6dc6acf837ee2e057326ac4639e8a5b994890b37006317364dfb1946f8536b133bf4f6149eab1cd3df3dc3335bf972fdae5a89c3fcf4aeee5c9d6bb61a4d5d171db1384597b362abacea6479edeb27503bc9dc31d6f6f3a268fe3eff6bda619e85fcc5d89205bfee693c30bc3de827b0d1af8" + }, + "pqOwnerRegistration": { + "preimage": "03000000000033333333333333333333333333333333333333333333333333333333333333330200000000000000000000000000ffff7f00000147bf66666666666666666666666666666666666666667777777777777777777777777777777777777777fa001600148888888888888888888888888888888888888888ea98fb5c558fc5d57595e99449bbf3040a884ea5fd8a9f244e36f0ef52d383819999999999999999999999999999999999999999999999999999999999999999202122232425262728292a2b2c2d2e2f89fd81fdbb5b94129b14761bdc6bf682", + "digest": "4d4c0adafba9983f697d6df610cd241ff05269ae8d7e4d193eb64489fd78ede7", + "proofHash": "129d6f0645c09c642f815a185753b176a23cd1e66547e667819ccd65c7f5cb56" + }, + "pqRegistrar": { + "preimage": "03001111111111111111111111111111111111111111111111111111111111111111000077777777777777777777777777777777777777771600148888888888888888888888888888888888888888ea98fb5c558fc5d57595e99449bbf3040a884ea5fd8a9f244e36f0ef52d383819999999999999999999999999999999999999999999999999999999999999999202122232425262728292a2b2c2d2e2f89fd81fdbb5b94129b14761bdc6bf68201000000", + "digest": "934804c2df5cdcd5cca1ff7989f3e0d16fb260d869527d0194723e7f68c8e04a", + "updateSignatureHash": "3be8f4877cbaaeff514585d627fea6345b6cd7883a1e67c8abe516d424b5b243", + "proofHash": "233702ec59ca6586deba187e2229b5576f8f61503bd9a780dd8c0d9e4cc89d1c" + }, + "globalPQOwner": { + "digest": "e1f91602dfe271e100c785706f4f1ddb8a2b4e0d0eff7d2843f39c041827d711", + "signatureHash": "1ebdc5e495a9c13b5bc5092d634d393b7731da3e73d64c3fce3cfd73a2b049e7" + }, + "globalRotation": { + "candidatePublicKey": "010101010101010101010101010101019fa70c8059ad5e53bfe1ac55536364ac", + "digest": "35bc6ab9877f474571181ec2766d72c34e7e75e81d9e417c3fe532d3af475047", + "signatureHash": "110f397b4ed062b08b82599beb2fb3dcc919dac907aacc4e7e86addaa672be9d" + } +} diff --git a/packages/sysweb3-sentry/test/governance.test.mjs b/packages/sysweb3-sentry/test/governance.test.mjs new file mode 100644 index 00000000..493563c9 --- /dev/null +++ b/packages/sysweb3-sentry/test/governance.test.mjs @@ -0,0 +1,334 @@ +import test from 'node:test'; +import assert from 'node:assert/strict'; +import { readFileSync } from 'node:fs'; +import { + governanceVoteDigest, + governanceVoteHash, + governanceVotingKeyIds, + importSentryAuthorityKey, + reviewSentryGovernanceVote, + sentryKeyId, + signSentryGovernanceVote, + validateSentryGovernanceVoteRequest, + verifySentryGovernanceVote, +} from '../dist/index.js'; + +const key = await importSentryAuthorityKey( + 'voting', + 'secp256k1', + '00'.repeat(31) + '01' +); +const chain = { genesisHash: '11'.repeat(32), era: 'legacy-v3' }; +const request = { + version: 1, + chain, + proposalHash: '22'.repeat(32), + signal: 'funding', + outcome: 'yes', + timestamp: 1700000000, + nodes: [ + { + proTxHash: '33'.repeat(32), + collateralOutpoint: { txid: '44'.repeat(32), vout: 1 }, + }, + ], +}; +const context = { + chain, + now: request.timestamp, + proposalHash: request.proposalHash, + proposal: { name: 'Public proposal', url: 'https://example.com/proposal' }, + nodes: [ + { + ...request.nodes[0], + votingKeyId: sentryKeyId(key.publicKey), + valid: true, + }, + ], +}; +const copy = (value) => structuredClone(value); + +test('supports legacy uncompressed voting identity without changing stored public key encoding', async () => { + const ids = await governanceVotingKeyIds(key.publicKey); + assert.notEqual(ids.compressed, ids.uncompressed); + assert.equal(ids.compressed, sentryKeyId(key.publicKey)); + const c = copy(context); + c.nodes[0].votingKeyId = ids.uncompressed; + const response = await signSentryGovernanceVote( + request, + c, + request.nodes[0].proTxHash, + key + ); + const sig = Buffer.from(response.voteSig, 'base64'); + assert(sig[0] >= 27 && sig[0] <= 30); + assert.equal(await verifySentryGovernanceVote(request, c, response), true); + assert.equal( + await verifySentryGovernanceVote(request, context, response), + false + ); + sig[0] += 4; + assert.equal( + await verifySentryGovernanceVote(request, c, { + ...response, + voteSig: sig.toString('base64'), + }), + false + ); + c.nodes[0].votingKeyId = '88'.repeat(20); + await assert.rejects( + signSentryGovernanceVote(request, c, request.nodes[0].proTxHash, key) + ); + await assert.rejects(governanceVotingKeyIds('04' + '00'.repeat(64))); + await assert.rejects(governanceVotingKeyIds('02' + 'ff'.repeat(32))); +}); + +test('bounds complete batch review to twenty distinct verified nodes', () => { + const r = copy(request); + r.nodes = Array.from({ length: 20 }, (_, i) => ({ + proTxHash: (i + 1).toString(16).padStart(64, '0'), + collateralOutpoint: { txid: '44'.repeat(32), vout: i }, + })); + const c = copy(context); + c.nodes = r.nodes.map((n) => ({ + ...n, + votingKeyId: context.nodes[0].votingKeyId, + valid: true, + })); + assert.equal(reviewSentryGovernanceVote(r, c).nodes.length, 20); + c.nodes[1].proTxHash = c.nodes[0].proTxHash; + assert.throws(() => reviewSentryGovernanceVote(r, c)); +}); + +test('signs only the independently verified voting authority and returns no key', async () => { + const response = await signSentryGovernanceVote( + request, + context, + request.nodes[0].proTxHash, + key + ); + assert.equal( + await verifySentryGovernanceVote(request, context, response), + true + ); + assert.equal(Buffer.from(response.voteSig, 'base64').length, 65); + assert.deepEqual(Object.keys(response).sort(), [ + 'collateralOutpoint', + 'proTxHash', + 'signatureHash', + 'voteHash', + 'voteSig', + ]); + assert.equal(JSON.stringify(response).includes(key.secretKey), false); + const review = reviewSentryGovernanceVote(request, context); + assert.deepEqual(review.proposal, context.proposal); + assert.equal(review.nodes[0].votingKeyId, context.nodes[0].votingKeyId); + const wrongKey = await importSentryAuthorityKey( + 'voting', + 'secp256k1', + '00'.repeat(31) + '02' + ); + await assert.rejects( + signSentryGovernanceVote( + request, + context, + request.nodes[0].proTxHash, + wrongKey + ) + ); + await assert.rejects( + signSentryGovernanceVote(request, context, request.nodes[0].proTxHash, { + ...key, + role: 'owner', + }) + ); + await assert.rejects( + signSentryGovernanceVote(request, context, request.nodes[0].proTxHash, { + ...key, + scheme: 'slh-dsa-shake-128s', + }) + ); + await assert.rejects( + signSentryGovernanceVote(request, context, request.nodes[0].proTxHash, { + ...key, + secretKey: wrongKey.secretKey, + }) + ); +}); + +test('binds chain, proposal, every node, current voting identity and fresh timestamp', () => { + for (const mutate of [ + (c) => (c.chain.genesisHash = '55'.repeat(32)), + (c) => (c.chain.era = 'pq-v4'), + (c) => (c.proposalHash = '55'.repeat(32)), + (c) => (c.nodes[0].proTxHash = '55'.repeat(32)), + (c) => (c.nodes[0].collateralOutpoint.txid = '55'.repeat(32)), + (c) => c.nodes[0].collateralOutpoint.vout++, + (c) => (c.nodes[0].valid = false), + (c) => (c.nodes = []), + (c) => (c.now += 3601), + (c) => (c.now -= 3601), + ]) { + const c = copy(context); + mutate(c); + assert.throws(() => reviewSentryGovernanceVote(request, c)); + } + for (const offset of [-3600, 3600]) { + const c = copy(context); + c.now += offset; + assert.doesNotThrow(() => reviewSentryGovernanceVote(request, c)); + } + const c = copy(context); + c.proposal.name = 'Changed display name'; + assert.equal( + reviewSentryGovernanceVote(request, c).nodes[0].digest, + reviewSentryGovernanceVote(request, context).nodes[0].digest + ); +}); + +test('rejects malformed, noncanonical, unsupported and oversized requests', () => { + for (const mutate of [ + (r) => (r.extra = true), + (r) => (r.version = 2), + (r) => (r.chain.era = 'pq-v4'), + (r) => (r.chain.genesisHash = '0'.repeat(64)), + (r) => (r.proposalHash = 'AA'.repeat(32)), + (r) => (r.proposalHash = '0x' + '22'.repeat(32)), + (r) => (r.signal = 'valid'), + (r) => (r.outcome = 'none'), + (r) => (r.outcome = 'constructor'), + (r) => (r.timestamp = -1), + (r) => (r.timestamp = -0), + (r) => (r.timestamp = 1.5), + (r) => (r.timestamp = Number.MAX_SAFE_INTEGER + 1), + (r) => (r.timestamp = '1700000000'), + (r) => (r.nodes = []), + (r) => r.nodes.push(copy(r.nodes[0])), + (r) => (r.nodes[0].collateralOutpoint.vout = 2147483648), + (r) => (r.nodes[0].collateralOutpoint.vout = -0), + (r) => (r.nodes[0].collateralOutpoint.vout = -1), + (r) => (r.nodes[0].collateralOutpoint.vout = 0.5), + (r) => (r.nodes[0].collateralOutpoint.extra = true), + (r) => (r.nodes[0].extra = true), + (r) => + (r.nodes = Array.from({ length: 21 }, (_, i) => ({ + proTxHash: (i + 1).toString(16).padStart(64, '0'), + collateralOutpoint: { txid: '44'.repeat(32), vout: i }, + }))), + ]) { + const r = copy(request); + mutate(r); + assert.throws(() => validateSentryGovernanceVoteRequest(r)); + } + assert.throws(() => validateSentryGovernanceVoteRequest(null)); + assert.throws(() => + validateSentryGovernanceVoteRequest( + Object.assign(Object.create({ injected: true }), request) + ) + ); +}); + +test('rejects mutated or noncanonical signatures and swapped node identity', async () => { + const response = await signSentryGovernanceVote( + request, + context, + request.nodes[0].proTxHash, + key + ); + for (const mutate of [ + (r) => (r.proTxHash = '55'.repeat(32)), + (r) => (r.signatureHash = '55'.repeat(32)), + (r) => (r.voteHash = '55'.repeat(32)), + (r) => r.collateralOutpoint.vout++, + (r) => (r.voteSig += '\n'), + (r) => (r.voteSig = r.voteSig.slice(0, -1)), + (r) => (r.voteSig = 'A'.repeat(1_000_000)), + (r) => (r.voteSig = Buffer.alloc(65).toString('base64')), + (r) => (r.extra = true), + ]) { + const r = copy(response); + mutate(r); + assert.equal(await verifySentryGovernanceVote(request, context, r), false); + } + for (const property of ['outcome', 'timestamp', 'proposalHash']) { + const r = copy(request); + r[property] = + property === 'outcome' + ? 'no' + : property === 'timestamp' + ? request.timestamp + 1 + : '55'.repeat(32); + const c = copy(context); + c.proposalHash = r.proposalHash; + assert.equal(await verifySentryGovernanceVote(r, c, response), false); + } + const highS = Buffer.from(response.voteSig, 'base64'); + const order = BigInt( + '0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141' + ); + const s = BigInt('0x' + highS.subarray(33).toString('hex')); + Buffer.from((order - s).toString(16).padStart(64, '0'), 'hex').copy( + highS, + 33 + ); + highS[0] = 31 + ((highS[0] - 31) ^ 1); + assert.equal( + await verifySentryGovernanceVote(request, context, { + ...response, + voteSig: highS.toString('base64'), + }), + false + ); +}); + +test('matches native Core GetSignatureHash, GetHash and deterministic compact signatures', async () => { + const vectors = JSON.parse( + readFileSync( + new URL('./fixtures/governance-core-vectors.json', import.meta.url), + 'utf8' + ) + ); + for (const v of vectors) { + const r = copy(request); + Object.assign(r, { + proposalHash: v.proposalHash, + outcome: ['none', 'yes', 'no', 'abstain'][v.outcome], + timestamp: v.timestamp, + }); + r.nodes[0].collateralOutpoint = { + txid: v.collateralHash, + vout: v.collateralIndex, + }; + const c = copy(context); + Object.assign(c, { now: v.timestamp, proposalHash: v.proposalHash }); + c.nodes[0] = { + ...r.nodes[0], + votingKeyId: sentryKeyId(v.publicKey), + valid: true, + }; + const f = { + proposalHash: r.proposalHash, + signal: r.signal, + outcome: r.outcome, + timestamp: r.timestamp, + collateralOutpoint: r.nodes[0].collateralOutpoint, + }; + assert.equal(governanceVoteDigest(f), v.digest); + assert.equal(governanceVoteHash(f), v.voteHash); + assert.equal( + v.compressed === false + ? (await governanceVotingKeyIds(key.publicKey)).uncompressed + : sentryKeyId(key.publicKey), + sentryKeyId(v.publicKey) + ); + const signed = await signSentryGovernanceVote( + r, + c, + r.nodes[0].proTxHash, + key + ); + assert.equal(signed.signatureHash, v.signatureHash); + assert.equal(signed.voteSig, v.voteSig); + assert.equal(await verifySentryGovernanceVote(r, c, signed), true); + } +}); diff --git a/packages/sysweb3-sentry/test/keygen.test.mjs b/packages/sysweb3-sentry/test/keygen.test.mjs new file mode 100644 index 00000000..ef92b127 --- /dev/null +++ b/packages/sysweb3-sentry/test/keygen.test.mjs @@ -0,0 +1,54 @@ +import { test } from 'node:test'; +import assert from 'node:assert/strict'; +import { readFileSync } from 'node:fs'; +import { + deriveSentryOperatorKey, + importSentryOperatorKey, +} from '../dist/index.js'; + +const vectors = JSON.parse( + readFileSync( + new URL('./fixtures/bls-keygen-vectors.json', import.meta.url), + 'utf8' + ) +); + +test('32-byte BLS generation matches exact Core private and public key vectors', async () => { + for (const vector of vectors) { + const key = await deriveSentryOperatorKey('bls-basic', vector.seed); + assert.deepEqual(key, { + scheme: 'bls-basic', + secretKey: vector.secretKey, + publicKey: vector.publicKey, + }); + assert.deepEqual(await importSentryOperatorKey(key.scheme, key.secretKey), key); + assert.deepEqual( + await deriveSentryOperatorKey('bls-basic', vector.seed.toUpperCase()), + key + ); + } +}); + +test('BLS seed generation rejects wrong lengths and malformed inputs without echoing them', async () => { + for (const seed of [ + '', + '01'.repeat(31), + '01'.repeat(33), + '01'.repeat(48), + 'ab'.repeat(31) + 'zz', + 'ab'.repeat(32) + '0', + ]) { + await assert.rejects(deriveSentryOperatorKey('bls-basic', seed), (error) => { + assert.equal(error.code, 'INVALID_HEX'); + assert.equal( + error.message, + 'key generation seed must be canonical byte hex (32 bytes)' + ); + return true; + }); + } + await assert.rejects( + deriveSentryOperatorKey('other', '01'.repeat(32)), + /Unsupported Sentry operator scheme/ + ); +}); diff --git a/packages/sysweb3-sentry/test/management-core-vectors.test.mjs b/packages/sysweb3-sentry/test/management-core-vectors.test.mjs new file mode 100644 index 00000000..330bf5a4 --- /dev/null +++ b/packages/sysweb3-sentry/test/management-core-vectors.test.mjs @@ -0,0 +1,471 @@ +import { test } from 'node:test'; +import assert from 'node:assert/strict'; +import { readFileSync } from 'node:fs'; +import { secp256k1 } from '@noble/curves/secp256k1.js'; +import { + buildSentryRegistration, + buildSentryRegistrarUpdate, + buildSentryRevocation, + buildSentryOperatorUpdate, + decodeSentryTransaction, + importSentryAuthorityKey, + sentryKeyId, + reviewSentryManagementOperation, + signSentryManagementOperation, + verifySentryManagementOperation, + matchesSentryManagementIntent, +} from '../dist/index.js'; +import { + managementPayload, + managementPayloadBytes, + registrationMessage, + registrationMessageDigest, +} from '../dist/management-codec.js'; +import { ownerDigest } from '../dist/management.js'; +import { fromHex, hash256, hex } from '../dist/bytes.js'; + +const vectors = JSON.parse( + readFileSync( + new URL('./fixtures/management-core-vectors.json', import.meta.url), + 'utf8' + ) +); +const pq = JSON.parse( + readFileSync(new URL('./fixtures/core-vectors.json', import.meta.url), 'utf8') +).pq; +const chain = { genesisHash: '44'.repeat(32), era: 'legacy-v3' }; +const network = { bech32Hrp: 'tsys', pubKeyHash: 65, scriptHash: 196 }; +const funding = [ + { txid: decodeSentryTransaction(vectors.fundingTransaction).txid, vout: 0 }, +]; +const payout = '0014' + '88'.repeat(20); +const outputs = [{ valueSatoshis: '998000', scriptHex: payout }]; + +test('Core registration preimage, Bech32 signing message and libsecp compact signature match', async () => { + const operator = await importSentryAuthorityKey( + 'operator', + 'bls-basic', + '00'.repeat(31) + '01' + ); + const req = buildSentryRegistration({ + chain, + inputs: funding, + outputs, + collateralOutpoint: { txid: '33'.repeat(32), vout: 2 }, + service: '127.0.0.1:18367', + ownerKeyId: '66'.repeat(20), + votingKeyId: '77'.repeat(20), + operatorPublicKey: operator.publicKey, + operatorRewardBasisPoints: 250, + payoutScript: payout, + }); + const { payload } = managementPayload(req.transactionHex); + assert.equal( + hex(managementPayloadBytes(payload, true)), + vectors.legacyRegistration.preimage + ); + assert.equal( + hex(hash256(managementPayloadBytes(payload, true))), + vectors.legacyRegistration.payloadHash + ); + assert.equal( + registrationMessage(payload, network), + vectors.legacyRegistration.message + ); + const digest = registrationMessageDigest(payload, network); + assert.equal(hex(digest), vectors.legacyRegistration.digest); + const signature = secp256k1.sign(digest, fromHex('00'.repeat(31) + '03'), { + prehash: false, + format: 'recovered', + lowS: true, + }); + signature[0] += 31; + assert.equal(hex(signature), vectors.legacyRegistration.signature); +}); + +test('Core registrar ECDSA and revocation BLS exact bytes verify through complete SDK flow', async () => { + const owner = await importSentryAuthorityKey( + 'owner', + 'secp256k1', + '00'.repeat(31) + '03' + ); + const operator = await importSentryAuthorityKey( + 'operator', + 'bls-basic', + '00'.repeat(31) + '01' + ); + const node = { + proTxHash: '11'.repeat(32), + operatorPublicKey: operator.publicKey, + ownerKeyId: sentryKeyId(owner.publicKey), + votingKeyId: '77'.repeat(20), + service: '127.0.0.1:18367', + operatorPayoutScript: payout, + payoutScript: payout, + nevmAddress: '', + }; + const context = { + chain, + network, + node, + previousTransactions: [vectors.fundingTransaction], + maxFeeSatoshis: '10000', + }; + for (const [request, key, expected] of [ + [ + buildSentryRegistrarUpdate({ chain, node, inputs: funding, outputs }), + owner, + vectors.legacyRegistrar, + ], + [ + buildSentryRevocation({ + chain, + node, + inputs: funding, + outputs, + reason: 2, + }), + operator, + vectors.legacyRevoke, + ], + ]) { + const { payload } = managementPayload(request.transactionHex); + assert.equal(hex(managementPayloadBytes(payload, true)), expected.preimage); + assert.equal( + reviewSentryManagementOperation(request, context).authorizations[0] + .digest, + expected.digest + ); + const signed = await signSentryManagementOperation(request, context, key); + assert.equal(signed.complete, true); + assert.equal( + hex(managementPayload(signed.transactionHex).payload.primarySignature), + expected.signature + ); + } +}); + +test( + 'Core PQ revocation and initial operator owner/PoP signatures match exactly', + { timeout: 120_000 }, + async () => { + const owner = await importSentryAuthorityKey( + 'owner', + 'secp256k1', + '00'.repeat(31) + '03' + ); + const operator = await importSentryAuthorityKey( + 'operator', + 'slh-dsa-shake-128s', + pq.secretKey + ); + const activeChain = { ...chain, era: 'pq-v4' }; + const record = { + version: 1, + profile: 1, + keyVersion: 1, + publicKey: operator.publicKey, + childKeyCommitmentHex: pq.childKeyCommitmentHex, + activatedHeight: 1440, + }; + const node = { + proTxHash: '11'.repeat(32), + operatorPublicKey: operator.publicKey, + globalKeyVersion: 1, + pqRecord: record, + ownerKeyId: sentryKeyId(owner.publicKey), + votingKeyId: '77'.repeat(20), + service: '127.0.0.1:18367', + operatorPayoutScript: payout, + payoutScript: payout, + nevmAddress: '', + }; + const context = { + chain: activeChain, + network, + node, + previousTransactions: [vectors.fundingTransaction], + maxFeeSatoshis: '10000', + }; + const revoke = buildSentryRevocation({ + chain: activeChain, + node, + inputs: funding, + outputs, + reason: 2, + }); + assert.equal( + reviewSentryManagementOperation(revoke, context).authorizations[0].digest, + vectors.pqRevoke.digest + ); + const signedRevoke = await signSentryManagementOperation( + revoke, + context, + operator + ); + assert.equal( + hex( + managementPayload(signedRevoke.transactionHex).payload.primarySignature + ), + vectors.pqRevoke.signature + ); + const initialNode = { + ...node, + pqRecord: undefined, + globalKeyVersion: undefined, + }; + const initial = buildSentryOperatorUpdate({ + chain: activeChain, + node: initialNode, + inputs: funding, + outputs, + mode: 'initial', + candidate: { ...record, activatedHeight: 0 }, + }); + const initialContext = { ...context, node: initialNode }; + const review = reviewSentryManagementOperation(initial, initialContext); + assert.equal( + review.authorizations[0].digest, + vectors.globalInitial.ownerDigest + ); + assert.equal( + review.authorizations[1].digest, + vectors.globalInitial.operatorDigest + ); + const signedOwner = await signSentryManagementOperation( + initial, + initialContext, + owner + ); + assert.equal( + hex(managementPayload(signedOwner.transactionHex).payload.ownerProof), + vectors.globalInitial.ownerSignature + ); + const signedOperator = await signSentryManagementOperation( + { ...initial, transactionHex: signedOwner.transactionHex }, + initialContext, + operator + ); + assert.equal(signedOperator.complete, true); + assert.equal( + hex( + managementPayload(signedOperator.transactionHex).payload + .primarySignature + ), + vectors.globalInitial.operatorSignature + ); + } +); + +test( + 'Core PQ owner proofs, dual-owner registrar and global rotation domains match', + { timeout: 120_000 }, + async () => { + const owner = await importSentryAuthorityKey( + 'owner', + 'slh-dsa-shake-128s', + pq.secretKey + ); + const operator = { ...owner, role: 'operator' }; + const activeChain = { ...chain, era: 'pq-v4' }; + const record = { + version: 1, + profile: 1, + keyVersion: 1, + publicKey: owner.publicKey, + childKeyCommitmentHex: pq.childKeyCommitmentHex, + activatedHeight: 1440, + }; + const node = { + proTxHash: '11'.repeat(32), + operatorPublicKey: owner.publicKey, + globalKeyVersion: 1, + pqRecord: record, + ownerKeyId: '66'.repeat(20), + votingKeyId: '77'.repeat(20), + service: '127.0.0.1:18367', + operatorPayoutScript: payout, + payoutScript: payout, + nevmAddress: '', + pqVotingPublicKey: '99'.repeat(32), + pqOwnerRecord: { + publicKey: owner.publicKey, + keyVersion: 1, + activatedHeight: 100, + }, + }; + const context = { + chain: activeChain, + network, + node, + previousTransactions: [vectors.fundingTransaction], + maxFeeSatoshis: '10000', + }; + const registration = buildSentryRegistration({ + chain: activeChain, + inputs: funding, + outputs, + collateralOutpoint: { txid: '33'.repeat(32), vout: 2 }, + service: node.service, + ownerKeyId: node.ownerKeyId, + votingKeyId: node.votingKeyId, + pqOwnerPublicKey: owner.publicKey, + pqVotingPublicKey: node.pqVotingPublicKey, + operatorRewardBasisPoints: 250, + payoutScript: payout, + }); + const regPayload = managementPayload(registration.transactionHex).payload; + assert.equal( + hex(managementPayloadBytes(regPayload, true)), + vectors.pqOwnerRegistration.preimage + ); + const digest = ownerDigest(regPayload, context); + assert.equal(hex(digest), vectors.pqOwnerRegistration.digest); + const { slh_dsa_shake_128s } = await import( + '@noble/post-quantum/slh-dsa.js' + ); + assert.equal( + hex( + hash256( + slh_dsa_shake_128s.sign(digest, fromHex(owner.secretKey), { + context: new TextEncoder().encode('SYS_PQ_OWNER_PROOF_V1'), + extraEntropy: false, + }) + ) + ), + vectors.pqOwnerRegistration.proofHash + ); + const update = buildSentryRegistrarUpdate({ + chain: activeChain, + node, + inputs: funding, + outputs, + pqOwnerPublicKey: owner.publicKey, + }); + assert.equal( + hex( + managementPayloadBytes( + managementPayload(update.transactionHex).payload, + true + ) + ), + vectors.pqRegistrar.preimage + ); + assert.equal( + reviewSentryManagementOperation(update, context).authorizations[0].digest, + vectors.pqRegistrar.digest + ); + const first = await signSentryManagementOperation( + update, + context, + owner, + 'owner' + ); + assert.equal( + hex( + hash256( + managementPayload(first.transactionHex).payload.primarySignature + ) + ), + vectors.pqRegistrar.updateSignatureHash + ); + const second = await signSentryManagementOperation( + { ...update, transactionHex: first.transactionHex }, + context, + owner, + 'newOwner' + ); + assert.equal( + hex(hash256(managementPayload(second.transactionHex).payload.ownerProof)), + vectors.pqRegistrar.proofHash + ); + assert.equal(second.complete, true); + const initialNode = { + ...node, + pqRecord: undefined, + globalKeyVersion: undefined, + }; + const initial = buildSentryOperatorUpdate({ + chain: activeChain, + node: initialNode, + inputs: funding, + outputs, + mode: 'initial', + candidate: { ...record, activatedHeight: 0 }, + }); + const initialContext = { ...context, node: initialNode }; + assert.equal( + reviewSentryManagementOperation(initial, initialContext).authorizations[0] + .digest, + vectors.globalPQOwner.digest + ); + const signed = await signSentryManagementOperation( + initial, + initialContext, + owner, + 'owner' + ); + assert.equal( + hex(hash256(managementPayload(signed.transactionHex).payload.ownerProof)), + vectors.globalPQOwner.signatureHash + ); + assert.equal(signed.complete, false); + const completedInitial = await signSentryManagementOperation( + { ...initial, transactionHex: signed.transactionHex }, + initialContext, + operator, + 'newOperator' + ); + assert.equal(completedInitial.complete, true); + const completedRequest = { + ...initial, + transactionHex: completedInitial.transactionHex, + }; + assert.equal( + await verifySentryManagementOperation(completedRequest, initialContext), + true + ); + assert.equal(matchesSentryManagementIntent(initial, completedRequest), true); + const completedTransaction = decodeSentryTransaction( + completedInitial.transactionHex + ); + const dataOutput = completedTransaction.outputs.find((output) => + output.scriptHex.startsWith('6a') + ); + // Core's PQ-owner exception permits two SLH signatures in these exact + // canonical special payload versions, without raising ordinary limits. + assert.ok(dataOutput.scriptHex.length / 2 > 10_000); + assert.ok(dataOutput.scriptHex.length / 2 <= 2 * 7856 + 1024); + const rotate = buildSentryOperatorUpdate({ + chain: activeChain, + node, + inputs: funding, + outputs, + mode: 'rotate', + candidate: { + ...record, + keyVersion: 2, + publicKey: vectors.globalRotation.candidatePublicKey, + activatedHeight: 0, + }, + }); + assert.equal( + reviewSentryManagementOperation(rotate, context).authorizations[0].digest, + vectors.globalRotation.digest + ); + const rotated = await signSentryManagementOperation( + rotate, + context, + operator + ); + assert.equal(rotated.complete, true); + assert.equal( + hex( + hash256( + managementPayload(rotated.transactionHex).payload.primarySignature + ) + ), + vectors.globalRotation.signatureHash + ); + } +); diff --git a/packages/sysweb3-sentry/test/management.test.mjs b/packages/sysweb3-sentry/test/management.test.mjs new file mode 100644 index 00000000..1929cdc8 --- /dev/null +++ b/packages/sysweb3-sentry/test/management.test.mjs @@ -0,0 +1,587 @@ +import { test } from 'node:test'; +import assert from 'node:assert/strict'; +import { readFileSync } from 'node:fs'; +import { + buildSentryRegistration, + buildSentryRegistrarUpdate, + buildSentryRevocation, + buildSentryOperatorUpdate, + decodeSentryTransaction, + importSentryAuthorityKey, + reviewSentryManagementOperation, + signSentryManagementOperation, + verifySentryManagementOperation, + sentryKeyId, + matchesSentryManagementIntent, +} from '../dist/index.js'; +import { encodeTransaction } from '../dist/codec.js'; +import { + managementPayload, + managementPayloadBytes, +} from '../dist/management-codec.js'; +import { hex } from '../dist/bytes.js'; +import { + GENESIS, + PRO_TX, + OLD_NEVM, + PAYOUT, + previousTransaction, +} from './fixture.mjs'; + +const privateKey = (n) => n.toString(16).padStart(64, '0'); +const network = { bech32Hrp: 'tsys', pubKeyHash: 65, scriptHash: 196 }; +const funding = previousTransaction(); +const inputs = [{ txid: decodeSentryTransaction(funding).txid, vout: 0 }]; +const outputs = [{ valueSatoshis: '998000', scriptHex: PAYOUT }]; + +async function fixture() { + const collateralKey = await importSentryAuthorityKey( + 'collateral', + 'secp256k1', + privateKey(2) + ); + const ownerKey = await importSentryAuthorityKey( + 'owner', + 'secp256k1', + privateKey(3) + ); + const votingKey = await importSentryAuthorityKey( + 'voting', + 'secp256k1', + privateKey(4) + ); + const operatorKey = await importSentryAuthorityKey( + 'operator', + 'bls-basic', + privateKey(1) + ); + const collateral = hex( + encodeTransaction({ + version: 2, + lockTime: 0, + inputs: [ + { + txid: '00'.repeat(32), + vout: 0xffffffff, + sequence: 0xffffffff, + scriptHex: '0102', + witness: [], + }, + ], + outputs: [ + { + valueSatoshis: '10000000000000', + scriptHex: '0014' + sentryKeyId(collateralKey.publicKey), + }, + ], + }) + ); + const chain = { genesisHash: GENESIS, era: 'legacy-v3' }; + const node = { + proTxHash: PRO_TX, + operatorPublicKey: operatorKey.publicKey, + service: '127.0.0.1:18367', + operatorPayoutScript: PAYOUT, + nevmAddress: OLD_NEVM, + ownerKeyId: sentryKeyId(ownerKey.publicKey), + votingKeyId: sentryKeyId(votingKey.publicKey), + payoutScript: PAYOUT, + collateralOutpoint: { + txid: decodeSentryTransaction(collateral).txid, + vout: 0, + }, + }; + const context = { + chain, + network, + node, + previousTransactions: [funding], + maxFeeSatoshis: '10000', + registration: { + collateralTransactionHex: collateral, + collateralVout: 0, + requiredCollateralSatoshis: '10000000000000', + }, + }; + return { + collateralKey, + ownerKey, + votingKey, + operatorKey, + collateral, + chain, + node, + context, + }; +} + +test('legacy existing-collateral registration binds message to actual payload and never spends collateral', async () => { + const f = await fixture(); + const req = buildSentryRegistration({ + chain: f.chain, + inputs, + outputs, + collateralOutpoint: f.node.collateralOutpoint, + service: f.node.service, + ownerKeyId: f.node.ownerKeyId, + votingKeyId: f.node.votingKeyId, + operatorPublicKey: f.operatorKey.publicKey, + payoutScript: PAYOUT, + operatorRewardBasisPoints: 250, + }); + const review = reviewSentryManagementOperation(req, f.context); + assert.equal(review.authorizations[0].role, 'collateral'); + assert.equal(review.fields.collateralSatoshis, '10000000000000'); + assert.match( + review.fields.collateralSigningMessage, + /^tsys1.+\|250\|tsys1.+\|tsys1.+\|[0-9a-f]{64}$/ + ); + await assert.rejects( + signSentryManagementOperation(req, f.context, f.ownerKey), + /exact required/ + ); + const signed = await signSentryManagementOperation( + req, + f.context, + f.collateralKey + ); + assert.equal(signed.complete, true); + const candidate = { ...req, transactionHex: signed.transactionHex }; + assert.equal( + await verifySentryManagementOperation(candidate, f.context), + true + ); + assert.equal(matchesSentryManagementIntent(req, candidate), true); + assert.throws( + () => + reviewSentryManagementOperation(req, { + ...f.context, + registration: { + ...f.context.registration, + requiredCollateralSatoshis: '1', + }, + }), + /collateral amount/ + ); +}); + +test('legacy registrar owner authorizes operator/voting/payout changes; operator cannot', async () => { + const f = await fixture(); + const req = buildSentryRegistrarUpdate({ + chain: f.chain, + node: f.node, + inputs, + outputs, + operatorPublicKey: ( + await importSentryAuthorityKey('operator', 'bls-basic', privateKey(5)) + ).publicKey, + votingKeyId: '56'.repeat(20), + payoutScript: '0014' + '67'.repeat(20), + }); + const review = reviewSentryManagementOperation(req, f.context); + assert.equal(review.authorizations[0].role, 'owner'); + assert.equal(review.fields.votingKeyId, '56'.repeat(20)); + await assert.rejects( + signSentryManagementOperation(req, f.context, f.operatorKey), + /exact required/ + ); + const signed = await signSentryManagementOperation( + req, + f.context, + f.ownerKey + ); + assert.equal(signed.complete, true); + const candidate = { ...req, transactionHex: signed.transactionHex }; + assert.equal( + await verifySentryManagementOperation(candidate, f.context), + true + ); + const tx = decodeSentryTransaction(candidate.transactionHex); + tx.outputs[0].scriptHex = '0014' + 'ab'.repeat(20); + assert.equal( + matchesSentryManagementIntent(req, { + ...candidate, + transactionHex: hex(encodeTransaction(tx)), + }), + false + ); +}); + +test('legacy revocation requires operator authority and constrains revocation reason', async () => { + const f = await fixture(); + const req = buildSentryRevocation({ + chain: f.chain, + node: f.node, + inputs, + outputs, + reason: 2, + }); + assert.equal( + reviewSentryManagementOperation(req, f.context).fields.reason, + '2' + ); + await assert.rejects( + signSentryManagementOperation(req, f.context, f.ownerKey), + /exact required/ + ); + const signed = await signSentryManagementOperation( + req, + f.context, + f.operatorKey + ); + assert.equal(signed.complete, true); + assert.equal( + await verifySentryManagementOperation( + { ...req, transactionHex: signed.transactionHex }, + f.context + ), + true + ); + assert.throws( + () => + buildSentryRevocation({ + chain: f.chain, + node: f.node, + inputs, + outputs, + reason: 4, + }), + /reason/ + ); +}); + +test( + 'PQ registrar is current-owner plus new-owner proof; PQ revocation uses registered operator record', + { timeout: 120_000 }, + async () => { + const f = await fixture(); + const vector = JSON.parse( + readFileSync( + new URL('./fixtures/core-vectors.json', import.meta.url), + 'utf8' + ) + ).pq; + const owner = await importSentryAuthorityKey( + 'owner', + 'slh-dsa-shake-128s', + vector.secretKey + ); + const chain = { ...f.chain, era: 'pq-v4' }; + const pqRecord = { + version: 1, + profile: 1, + keyVersion: 1, + publicKey: owner.publicKey, + childKeyCommitmentHex: vector.childKeyCommitmentHex, + activatedHeight: 1440, + }; + const node = { + ...f.node, + operatorPublicKey: owner.publicKey, + globalKeyVersion: 1, + pqRecord, + pqOwnerRecord: { + publicKey: owner.publicKey, + keyVersion: 1, + activatedHeight: 100, + }, + pqVotingPublicKey: '67'.repeat(32), + }; + const context = { ...f.context, chain, node }; + const req = buildSentryRegistrarUpdate({ + chain, + node, + inputs, + outputs, + pqOwnerPublicKey: owner.publicKey, + pqVotingPublicKey: '78'.repeat(32), + }); + const review = reviewSentryManagementOperation(req, context); + assert.deepEqual( + review.authorizations.map((a) => a.id), + ['owner', 'newOwner'] + ); + assert.notEqual( + review.authorizations[0].context, + review.authorizations[1].context + ); + const first = await signSentryManagementOperation( + req, + context, + owner, + 'newOwner' + ); + assert.equal(first.complete, false); + const next = { ...req, transactionHex: first.transactionHex }; + const last = await signSentryManagementOperation( + next, + context, + owner, + 'owner' + ); + assert.equal(last.complete, true); + assert.equal( + await verifySentryManagementOperation( + { ...req, transactionHex: last.transactionHex }, + context + ), + true + ); + const wrongVersion = { + ...context, + node: { + ...node, + pqOwnerRecord: { ...node.pqOwnerRecord, keyVersion: 2 }, + }, + }; + assert.throws( + () => reviewSentryManagementOperation(req, wrongVersion), + /currently enrolled owner/ + ); + const revoke = buildSentryRevocation({ + chain, + node, + inputs, + outputs, + reason: 1, + }); + const op = { ...owner, role: 'operator' }; + const revoked = await signSentryManagementOperation(revoke, context, op); + assert.equal(revoked.complete, true); + const p = managementPayload(revoked.transactionHex).payload; + p.reason = 0; + const tx = decodeSentryTransaction(revoked.transactionHex); + const { opReturn } = await import('../dist/codec.js'); + tx.outputs[1].scriptHex = hex(opReturn(managementPayloadBytes(p))); + assert.equal( + await verifySentryManagementOperation( + { ...revoke, transactionHex: hex(encodeTransaction(tx)) }, + context + ), + false + ); + } +); + +test('key roles and algorithm imports are not interchangeable', async () => { + await assert.rejects( + importSentryAuthorityKey('owner', 'bls-basic', privateKey(1)), + /role/ + ); + await assert.rejects( + importSentryAuthorityKey( + 'collateral', + 'slh-dsa-shake-128s', + '00'.repeat(64) + ), + /role/ + ); + await assert.rejects( + importSentryAuthorityKey('operator', 'secp256k1', privateKey(1)), + /role/ + ); +}); + +test( + 'PQ operator enrollment is owner plus new-key proof and validates child commitment', + { timeout: 120_000 }, + async () => { + const f = await fixture(); + const vector = JSON.parse( + readFileSync( + new URL('./fixtures/core-vectors.json', import.meta.url), + 'utf8' + ) + ).pq; + const operator = await importSentryAuthorityKey( + 'operator', + 'slh-dsa-shake-128s', + vector.secretKey + ); + const chain = { ...f.chain, era: 'pq-v4' }; + const candidate = { + version: 1, + profile: 1, + keyVersion: 1, + publicKey: operator.publicKey, + childKeyCommitmentHex: vector.childKeyCommitmentHex, + activatedHeight: 0, + }; + const context = { ...f.context, chain }; + const req = buildSentryOperatorUpdate({ + chain, + node: f.node, + inputs, + outputs, + mode: 'initial', + candidate, + }); + assert.deepEqual( + reviewSentryManagementOperation(req, context).authorizations.map( + (a) => a.id + ), + ['owner', 'newOperator'] + ); + const ownerSigned = await signSentryManagementOperation( + req, + context, + f.ownerKey + ); + assert.equal(ownerSigned.complete, false); + const opSigned = await signSentryManagementOperation( + { ...req, transactionHex: ownerSigned.transactionHex }, + context, + operator + ); + assert.equal(opSigned.complete, true); + assert.equal( + await verifySentryManagementOperation( + { ...req, transactionHex: opSigned.transactionHex }, + context + ), + true + ); + assert.equal( + matchesSentryManagementIntent(req, { + ...req, + transactionHex: opSigned.transactionHex, + }), + true + ); + const premature = { ...req, chain: f.chain }; + assert.throws( + () => reviewSentryManagementOperation(premature, f.context), + /preparation/ + ); + assert.equal( + reviewSentryManagementOperation(premature, { + ...f.context, + allowOperatorPreparation: true, + }).authorizations.length, + 2 + ); + const bad = buildSentryOperatorUpdate({ + chain, + node: f.node, + inputs, + outputs, + mode: 'initial', + candidate: { ...candidate, keyVersion: 2 }, + }); + assert.throws( + () => reviewSentryManagementOperation(bad, context), + /version and generation one/ + ); + const activeNode = { + ...f.node, + operatorPublicKey: operator.publicKey, + globalKeyVersion: 1, + pqRecord: { ...candidate, activatedHeight: 1440 }, + }; + const nextCandidate = { + ...candidate, + keyVersion: 2, + publicKey: '89'.repeat(32), + }; + const rotatedRequest = buildSentryOperatorUpdate({ + chain, + node: activeNode, + inputs, + outputs, + mode: 'rotate', + candidate: nextCandidate, + }); + const rotateContext = { ...context, node: activeNode }; + assert.deepEqual( + reviewSentryManagementOperation( + rotatedRequest, + rotateContext + ).authorizations.map((a) => a.id), + ['operator'] + ); + const rotated = await signSentryManagementOperation( + rotatedRequest, + rotateContext, + operator + ); + assert.equal(rotated.complete, true); + assert.throws( + () => + reviewSentryManagementOperation(rotatedRequest, { + ...rotateContext, + node: { ...activeNode, operatorRevoked: true }, + }), + /active keys use rotation/ + ); + } +); + +test('owner enrollment preparation cannot change payout, voting or operator before activation', async () => { + const f = await fixture(); + const ownerPublicKey = 'aa'.repeat(32); + const request = buildSentryRegistrarUpdate({ + chain: f.chain, + node: f.node, + inputs, + outputs, + ownerPreparation: true, + pqOwnerPublicKey: ownerPublicKey, + }); + assert.throws( + () => reviewSentryManagementOperation(request, f.context), + /preparation/ + ); + const context = { ...f.context, allowOwnerPreparation: true }; + assert.deepEqual( + reviewSentryManagementOperation(request, context).authorizations.map( + (a) => a.id + ), + ['owner', 'newOwner'] + ); + const bad = buildSentryRegistrarUpdate({ + chain: f.chain, + node: f.node, + inputs, + outputs, + ownerPreparation: true, + pqOwnerPublicKey: ownerPublicKey, + payoutScript: '0014' + 'af'.repeat(20), + }); + assert.throws( + () => reviewSentryManagementOperation(bad, context), + /preparation fields/ + ); +}); + +test('owner preparation preserves absent, zero and enrolled PQ voting keys exactly', async () => { + const f = await fixture(); + for (const current of [undefined, '00'.repeat(32), 'bb'.repeat(32)]) { + const node = { ...f.node, pqVotingPublicKey: current }; + const context = { ...f.context, node, allowOwnerPreparation: true }; + const options = { + chain: f.chain, + node, + inputs, + outputs, + ownerPreparation: true, + pqOwnerPublicKey: 'aa'.repeat(32), + }; + const request = buildSentryRegistrarUpdate(options); + const review = reviewSentryManagementOperation(request, context); + assert.equal(review.fields.pqVotingPublicKey, current ?? '00'.repeat(32)); + for (const proposed of ['cc'.repeat(32), '00'.repeat(32)]) { + if (proposed === (current ?? '00'.repeat(32))) continue; + assert.throws( + () => + reviewSentryManagementOperation( + buildSentryRegistrarUpdate({ + ...options, + pqVotingPublicKey: proposed, + }), + context + ), + /preparation fields/ + ); + } + } +}); diff --git a/packages/sysweb3-sentry/test/pq.test.mjs b/packages/sysweb3-sentry/test/pq.test.mjs new file mode 100644 index 00000000..78bb7e7f --- /dev/null +++ b/packages/sysweb3-sentry/test/pq.test.mjs @@ -0,0 +1,166 @@ +import { test } from 'node:test'; +import assert from 'node:assert/strict'; +import { + buildSentryServiceUpdate, + decodeSentryTransaction, + deriveSentryOperatorKey, + importSentryOperatorKey, + reviewSentryOperation, + signSentryOperation, + verifySentryOperation, +} from '../dist/index.js'; +import { concat, hex, integerBytes } from '../dist/bytes.js'; +import { locateServicePayload } from '../dist/codec.js'; +import { serializePQRecord } from '../dist/review.js'; +import { + GENESIS, + NEW_NEVM, + OLD_NEVM, + PAYOUT, + PRO_TX, + previousTransaction, + replacePayload, +} from './fixture.mjs'; + +test( + 'PQ SHAKE-128s matches its full registered record and separates chain/context/NEVM', + { timeout: 120_000 }, + async () => { + const key = await deriveSentryOperatorKey( + 'slh-dsa-shake-128s', + '01'.repeat(48) + ); + assert.equal(key.secretKey.length, 128); + assert.equal(key.publicKey.length, 64); + assert.deepEqual( + await importSentryOperatorKey(key.scheme, key.secretKey), + key + ); + const malformed = + key.secretKey.slice(0, -2) + + (key.secretKey.slice(-2) === '00' ? '01' : '00'); + await assert.rejects( + importSentryOperatorKey(key.scheme, malformed), + /Invalid Sentry operator/ + ); + const commitment = concat( + integerBytes(1, 2), + integerBytes(1, 2), + integerBytes(235, 2), + integerBytes(16, 2), + integerBytes(1, 4), + integerBytes(100, 4), + new Uint8Array(32).fill(0x66), + new Uint8Array(32).fill(0x77) + ); + const pqRecord = { + version: 1, + profile: 1, + keyVersion: 1, + publicKey: key.publicKey, + childKeyCommitmentHex: hex(commitment), + activatedHeight: 1000, + }; + assert.equal(serializePQRecord(pqRecord).length, 124); + const previous = previousTransaction(); + const chain = { genesisHash: GENESIS, era: 'pq-v4' }; + const node = { + proTxHash: PRO_TX, + operatorPublicKey: key.publicKey, + globalKeyVersion: 1, + pqRecord, + service: '127.0.0.1:18367', + operatorPayoutScript: PAYOUT, + nevmAddress: OLD_NEVM, + }; + const request = buildSentryServiceUpdate({ + chain, + node, + nevmAddress: NEW_NEVM, + inputs: [{ txid: decodeSentryTransaction(previous).txid, vout: 0 }], + outputs: [{ valueSatoshis: '998000', scriptHex: PAYOUT }], + }); + const context = { + chain, + node, + previousTransactions: [previous], + maxFeeSatoshis: '10000', + }; + const review = reviewSentryOperation(request, context); + assert.equal(review.scheme, 'slh-dsa-shake-128s'); + assert.equal( + locateServicePayload(decodeSentryTransaction(request.transactionHex)) + .payload.signature.length, + 7856 + ); + const signed = await signSentryOperation(request, context, key); + const signedRequest = { ...request, transactionHex: signed.transactionHex }; + assert.equal(await verifySentryOperation(signedRequest, context), true); + // Full registered state participates in Core's signature digest. + assert.equal( + await verifySentryOperation(signedRequest, { + ...context, + node: { ...node, pqRecord: { ...pqRecord, activatedHeight: 1001 } }, + }), + false + ); + assert.equal( + await verifySentryOperation(signedRequest, { + ...context, + node: { + ...node, + globalKeyVersion: 2, + pqRecord: { ...pqRecord, keyVersion: 2 }, + }, + }), + false + ); + const otherChain = { ...chain, genesisHash: 'ee'.repeat(32) }; + assert.equal( + await verifySentryOperation( + { ...signedRequest, chain: otherChain }, + { ...context, chain: otherChain } + ), + false + ); + const removal = await replacePayload(signedRequest, (payload) => { + payload.nevmAddress = ''; + }); + assert.equal(await verifySentryOperation(removal, context), false); + assert.throws( + () => + reviewSentryOperation(request, { + ...context, + node: { ...node, pqRecord: undefined }, + }), + /record/ + ); + assert.throws( + () => serializePQRecord({ ...pqRecord, activatedHeight: 0 }), + /not activated/ + ); + assert.throws( + () => serializePQRecord({ ...pqRecord, profile: 2 }), + /profile/ + ); + } +); + +test('BLS import rejects zero/out-of-range keys and is distinct from SLH key imports', async () => { + await assert.rejects( + importSentryOperatorKey('bls-basic', '00'.repeat(32)), + /Invalid/ + ); + await assert.rejects( + importSentryOperatorKey('bls-basic', 'ff'.repeat(32)), + /Invalid/ + ); + await assert.rejects( + importSentryOperatorKey('slh-dsa-shake-128s', '01'.repeat(32)), + /64 bytes/ + ); + await assert.rejects( + importSentryOperatorKey('ecdsa', '01'.repeat(32)), + /Unsupported/ + ); +}); diff --git a/packages/sysweb3-sentry/test/service.test.mjs b/packages/sysweb3-sentry/test/service.test.mjs new file mode 100644 index 00000000..2e137b62 --- /dev/null +++ b/packages/sysweb3-sentry/test/service.test.mjs @@ -0,0 +1,387 @@ +import { test } from 'node:test'; +import assert from 'node:assert/strict'; +import { + buildSentryServiceUpdate, + decodeSentryTransaction, + estimateSentrySignedVBytes, + getSentryCapabilities, + importSentryOperatorKey, + inspectSentryOperation, + matchesSentryTransactionIntent, + reviewSentryOperation, + signSentryOperation, + validateSentryOperationRequest, + verifySentryOperation, +} from '../dist/index.js'; +import { + encodeTransaction, + locateServicePayload, + opReturn, + parseService, + payloadBytes, +} from '../dist/codec.js'; +import { concat, fromHex, hex } from '../dist/bytes.js'; +import { + legacyFixture, + NEW_NEVM, + OLD_NEVM, + PAYOUT, + replacePayload, +} from './fixture.mjs'; + +test('capabilities distinguish active legacy BLS v3 and PQ v4; no opaque hash API', () => { + assert.deepEqual(getSentryCapabilities().operations, ['updateService']); + assert.deepEqual(getSentryCapabilities().keyRoles, ['operator']); + assert.deepEqual(getSentryCapabilities().eras, ['legacy-v3', 'pq-v4']); +}); + +test('unsigned legacy service request reviews exact NEVM change, funding and payload', async () => { + const { request, context } = await legacyFixture(); + const review = reviewSentryOperation(request, context); + assert.equal(review.feeSatoshis, '2000'); + assert.deepEqual(review.changes.nevmAddress, { + previous: OLD_NEVM, + next: NEW_NEVM, + }); + assert.deepEqual(review.changes.service, { + previous: '127.0.0.1:18367', + next: '127.0.0.1:18367', + }); + assert.equal(review.outputs.length, 2); + assert.equal(review.outputs[1].isPayload, true); + assert.equal(review.outputs[0].scriptHex, PAYOUT); + const tx = decodeSentryTransaction(request.transactionHex); + assert.equal(tx.version, 81); + assert.equal(locateServicePayload(tx).payload.signature.length, 96); + assert.equal(estimateSentrySignedVBytes(request), tx.virtualSize + 108); + assert.deepEqual(inspectSentryOperation(request).inputTxids, [ + tx.inputs[0].txid, + ]); +}); + +test('BLS signs real payload, changes only signature, verifies after separate fee signing', async () => { + const { request, context, key } = await legacyFixture(); + const signed = await signSentryOperation(request, context, key); + assert.equal( + await verifySentryOperation( + { ...request, transactionHex: signed.transactionHex }, + context + ), + true + ); + const unsignedTx = decodeSentryTransaction(request.transactionHex); + const tx = decodeSentryTransaction(signed.transactionHex); + assert.deepEqual(tx.inputs, unsignedTx.inputs); + assert.deepEqual(tx.outputs[0], unsignedTx.outputs[0]); + assert.equal(tx.virtualSize, unsignedTx.virtualSize); + assert.equal( + reviewSentryOperation( + { ...request, transactionHex: signed.transactionHex }, + context + ).authorizationHash, + signed.authorizationHash + ); + // A fee-payer may add input signatures after operator authorization. The + // inputsHash only commits to ordered prevouts, matching Core. + tx.inputs[0].witness = ['11'.repeat(71), '02' + '22'.repeat(32)]; + const feeSigned = { ...request, transactionHex: hex(encodeTransaction(tx)) }; + assert.equal(matchesSentryTransactionIntent(request, feeSigned), true); + assert.equal(await verifySentryOperation(feeSigned, context), true); + assert.equal(reviewSentryOperation(feeSigned, context).feeSatoshis, '2000'); + await assert.rejects( + signSentryOperation(feeSigned, context, key), + /Fee inputs/ + ); + // Operator authorization deliberately does not cover fee outputs. The + // full-intent comparison must catch substitutions even when Core auth verifies. + tx.outputs[0].scriptHex = '0014' + 'ee'.repeat(20); + const redirected = { ...request, transactionHex: hex(encodeTransaction(tx)) }; + assert.equal(await verifySentryOperation(redirected, context), true); + assert.equal(matchesSentryTransactionIntent(request, redirected), false); +}); + +test('omitted NEVM preserves existing binding; explicit empty string removes it', async () => { + const { request, context } = await legacyFixture(); + const tx = decodeSentryTransaction(request.transactionHex); + const common = { + chain: context.chain, + node: context.node, + inputs: tx.inputs, + outputs: tx.outputs.filter((output) => output.scriptHex[0] !== '6'), + }; + assert.equal( + reviewSentryOperation(buildSentryServiceUpdate(common), context).changes + .nevmAddress.next, + OLD_NEVM + ); + assert.equal( + reviewSentryOperation( + buildSentryServiceUpdate({ ...common, nevmAddress: '' }), + context + ).changes.nevmAddress.next, + '' + ); +}); + +test('restores a reset Core service with the new operator while keeping proposed endpoints strict', async () => { + const f = await legacyFixture(); + const newOperator = await importSentryOperatorKey( + 'bls-basic', + '00'.repeat(31) + '02' + ); + const transaction = decodeSentryTransaction(f.request.transactionHex); + for (const currentService of ['0.0.0.0:0', '[::]:0']) { + const node = { + ...f.context.node, + operatorPublicKey: newOperator.publicKey, + service: currentService, + }; + const context = { ...f.context, node }; + const options = { + chain: context.chain, + node, + inputs: transaction.inputs, + outputs: transaction.outputs.filter( + (output) => !output.scriptHex.startsWith('6a') + ), + }; + const request = buildSentryServiceUpdate({ + ...options, + service: '127.0.0.2:18367', + }); + assert.deepEqual(reviewSentryOperation(request, context).changes.service, { + previous: currentService, + next: '127.0.0.2:18367', + }); + await assert.rejects( + signSentryOperation(request, context, f.key), + /registered operator/i + ); + const signed = await signSentryOperation(request, context, newOperator); + assert.equal( + await verifySentryOperation( + { ...request, transactionHex: signed.transactionHex }, + context + ), + true + ); + assert.equal( + matchesSentryTransactionIntent(request, { + ...request, + transactionHex: signed.transactionHex, + }), + true + ); + assert.throws(() => buildSentryServiceUpdate(options), /service port/i); + for (const service of ['0.0.0.0:0', '127.0.0.1:0', '[::]:0']) { + assert.throws( + () => buildSentryServiceUpdate({ ...options, service }), + /service port/i + ); + } + for (const service of ['127.0.0.1:0', '[::1]:0', 'not-a-service']) { + assert.throws( + () => + reviewSentryOperation(request, { + ...context, + node: { ...node, service }, + }), + /service|IPv4/i + ); + } + } +}); + +test('canonical services compare compressed IPv6 by bytes; reject DNS and invalid ports', () => { + assert.deepEqual( + parseService('[2001:db8::1]:18367').bytes, + parseService('[2001:0db8:0:0:0:0:0:1]:18367').bytes + ); + for (const service of [ + 'rpc.example:123', + '127.0.0.1:0', + '127.0.0.1:65536', + '127.0.0.01:123', + '0.0.0.0:123', + '[::]:123', + '127.0.0.1:0123', + ]) { + assert.throws(() => parseService(service)); + } +}); + +test('rejects secret fields, opaque methods, unknown chain era, wrong node and excessive fees', async () => { + const { request, context } = await legacyFixture(); + assert.throws( + () => + validateSentryOperationRequest({ + ...request, + operatorSecret: 'never-accepted', + }), + /Unsupported request field/ + ); + assert.throws( + () => validateSentryOperationRequest({ ...request, operation: 'signHash' }), + /Unsupported/ + ); + assert.throws( + () => + validateSentryOperationRequest({ + ...request, + chain: { ...request.chain, era: 'legacy-v1' }, + }), + /Unsupported/ + ); + assert.throws( + () => + reviewSentryOperation(request, { + ...context, + chain: { ...context.chain, genesisHash: 'ab'.repeat(32) }, + }), + /chain/ + ); + assert.throws( + () => + reviewSentryOperation(request, { + ...context, + node: { ...context.node, proTxHash: 'ab'.repeat(32) }, + }), + /different registered node/ + ); + assert.throws( + () => + reviewSentryOperation(request, { ...context, maxFeeSatoshis: '1000' }), + /fee/ + ); + assert.throws( + () => + reviewSentryOperation(request, { ...context, previousTransactions: [] }), + /funding/ + ); +}); + +test('rejects duplicated inputs, changed prevout identity and protected collateral spending', async () => { + const { request, context } = await legacyFixture(); + const tx = decodeSentryTransaction(request.transactionHex); + assert.throws( + () => + reviewSentryOperation(request, { + ...context, + node: { + ...context.node, + collateralOutpoint: { txid: tx.inputs[0].txid, vout: 0 }, + }, + }), + /collateral/ + ); + tx.inputs[0].vout = 1; + assert.throws( + () => + reviewSentryOperation( + { ...request, transactionHex: hex(encodeTransaction(tx)) }, + context + ), + /inputsHash/ + ); + const duplicate = buildSentryServiceUpdate({ + chain: context.chain, + node: context.node, + inputs: [ + decodeSentryTransaction(request.transactionHex).inputs[0], + decodeSentryTransaction(request.transactionHex).inputs[0], + ], + outputs: [{ valueSatoshis: '998000', scriptHex: PAYOUT }], + }); + assert.throws( + () => reviewSentryOperation(duplicate, context), + /Duplicate transaction input/ + ); +}); + +test('rejects trailing data, nonminimal OP_RETURN, duplicate payload and nonzero payload value', async () => { + const { request, context } = await legacyFixture(); + assert.throws( + () => + validateSentryOperationRequest({ + ...request, + transactionHex: request.transactionHex + '00', + }), + /trailing/ + ); + const tx = decodeSentryTransaction(request.transactionHex); + tx.outputs.push({ ...tx.outputs[1] }); + assert.throws( + () => + validateSentryOperationRequest({ + ...request, + transactionHex: hex(encodeTransaction(tx)), + }), + /Exactly one/ + ); + tx.outputs.pop(); + tx.outputs[1].valueSatoshis = '1'; + assert.throws( + () => + reviewSentryOperation( + { ...request, transactionHex: hex(encodeTransaction(tx)) }, + context + ), + /zero value/ + ); + tx.outputs[1].valueSatoshis = '0'; + const bytes = payloadBytes(locateServicePayload(tx).payload); + // Payload < 256 bytes must use PUSHDATA1, not PUSHDATA2. + tx.outputs[1].scriptHex = hex( + concat(Uint8Array.of(0x6a, 0x4d, bytes.length, 0), bytes) + ); + assert.throws( + () => + validateSentryOperationRequest({ + ...request, + transactionHex: hex(encodeTransaction(tx)), + }), + /Non-canonical/ + ); +}); + +test('mutated NEVM/service/payout and version invalidate operator authorization', async () => { + const { request, context, key } = await legacyFixture(); + const signed = await signSentryOperation(request, context, key); + for (const mutate of [ + (p) => { + p.nevmAddress = OLD_NEVM; + }, + (p) => { + p.service = parseService('127.0.0.2:18367'); + }, + (p) => { + p.payoutScript = fromHex('0014' + '88'.repeat(20)); + }, + ]) { + const altered = await replacePayload( + { ...request, transactionHex: signed.transactionHex }, + mutate + ); + assert.equal(await verifySentryOperation(altered, context), false); + } + assert.equal( + await verifySentryOperation( + { ...request, transactionHex: signed.transactionHex.slice(0, -2) }, + context + ), + false + ); +}); + +test('fee signing refuses replacing an existing operator signature', async () => { + const { request, context, key } = await legacyFixture(); + const signed = await signSentryOperation(request, context, key); + await assert.rejects( + signSentryOperation( + { ...request, transactionHex: signed.transactionHex }, + context, + key + ), + /already contains/ + ); +}); diff --git a/packages/sysweb3-sentry/tsconfig.json b/packages/sysweb3-sentry/tsconfig.json new file mode 100644 index 00000000..16173258 --- /dev/null +++ b/packages/sysweb3-sentry/tsconfig.json @@ -0,0 +1,11 @@ +{ + "extends": "../../tsconfig-package.json", + "compilerOptions": { + "module": "NodeNext", + "moduleResolution": "NodeNext", + "rootDir": "src", + "outDir": "dist", + "declarationDir": "dist" + }, + "include": ["src"] +} diff --git a/packages/sysweb3-utils/jest.config.js b/packages/sysweb3-utils/jest.config.js index 234fa5b3..db8a80b4 100644 --- a/packages/sysweb3-utils/jest.config.js +++ b/packages/sysweb3-utils/jest.config.js @@ -3,13 +3,15 @@ module.exports = { testEnvironment: 'node', moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], transform: { - '^.+\\.(ts|tsx)$': 'ts-jest', + '^.+\\.(ts|tsx)$': [ + 'ts-jest', + ], }, testMatch: ['**/test/**/*.spec.ts'], moduleNameMapper: { - '^@pollum-io/sysweb3-network$': '/../sysweb3-network/src', - '^@pollum-io/sysweb3-core$': '/../sysweb3-core/src', - '^@pollum-io/sysweb3-keyring$': '/../sysweb3-keyring/src', + '^@sidhujag/sysweb3-network$': '/../sysweb3-network/src', + '^@sidhujag/sysweb3-core$': '/../sysweb3-core/src', + '^@sidhujag/sysweb3-keyring$': '/../sysweb3-keyring/src', 'isomorphic-fetch': '/../../__mocks__/isomorphic-fetch.js', }, setupFilesAfterEnv: [ diff --git a/packages/sysweb3-utils/package.json b/packages/sysweb3-utils/package.json index d5a0e4f6..509fe70b 100644 --- a/packages/sysweb3-utils/package.json +++ b/packages/sysweb3-utils/package.json @@ -1,12 +1,12 @@ { - "name": "@pollum-io/sysweb3-utils", - "version": "1.1.237", + "name": "@sidhujag/sysweb3-utils", + "version": "1.1.280", "description": "A helper for multi-chain accounts.", "main": "cjs/index.js", "types": "types/index.d.ts", "repository": { "type": "git", - "url": "git+https://github.com/Pollum-io/sysweb3.git" + "url": "git+https://github.com/syscoin/sysweb3.git" }, "author": "Pali Wallet", "license": "MIT", @@ -27,22 +27,20 @@ "localTest": "yarn prebuild && yarn build && yarn build && yarn copy" }, "dependencies": { - "@ethersproject/contracts": "^5.8.0", - "@pollum-io/sysweb3-network": "^1.0.96", - "axios": "^0.26.1", + "@sidhujag/sysweb3-network": "^1.0.109", "bech32": "^2.0.0", - "bip84": "^0.2.7", - "camelcase-keys": "^7.0.2", - "coinselectsyscoin": "^1.1.8", "crypto-js": "^4.1.1", - "ethers": "^5.7.2", - "syscoinjs-lib": "^1.0.242", - "syscointx-js": "^1.0.118" + "ethers": "^6.17.0" + }, + "peerDependencies": { + "syscoinjs-lib": "^1.0.275" }, "devDependencies": { "@types/crypto-js": "^4.1.1", "@types/node": "^17.0.23", - "jest": "^27.5.1", - "rimraf": "^6.0.1" + "jest": "^29.7.0", + "rimraf": "^6.1.2", + "syscoinjs-lib": "^1.0.275", + "typescript": "^5.3.3" } } diff --git a/packages/sysweb3-utils/readme.md b/packages/sysweb3-utils/readme.md index 43cd3016..a5fd3cb2 100644 --- a/packages/sysweb3-utils/readme.md +++ b/packages/sysweb3-utils/readme.md @@ -21,15 +21,15 @@ For use this library, is nice to have: For install, you can follow these commands: -- `yarn add @pollum-io/sysweb3-utils` -- `npm install @pollum-io/sysweb3-utils` +- `yarn add @sidhujag/sysweb3-utils` +- `npm install @sidhujag/sysweb3-utils` ## Usage The sysweb3-utils was builded to have a really simple usability. For example, you can import package and console it to know what kind of functions you'll find: ```js -import sysweb3 from '@pollum-io/sysweb3-utils'; +import sysweb3 from '@sidhujag/sysweb3-utils'; console.log(sysweb3); diff --git a/packages/sysweb3-utils/src/address.ts b/packages/sysweb3-utils/src/address.ts index 48e3cbc4..c1bcb319 100644 --- a/packages/sysweb3-utils/src/address.ts +++ b/packages/sysweb3-utils/src/address.ts @@ -1,11 +1,10 @@ +import { findCoin } from '@sidhujag/sysweb3-network'; import { bech32 } from 'bech32'; -import { ethers } from 'ethers'; +import { isAddress } from 'ethers/address'; import { isContractAddress } from '.'; -import { findCoin } from '@pollum-io/sysweb3-network'; -export const isValidEthereumAddress = (address: string) => - ethers.utils.isAddress(address); +export const isValidEthereumAddress = (address: string) => isAddress(address); //TODO: this function needs to be refactorated to validate with descriptors in mind export const isValidSYSAddress = ( diff --git a/packages/sysweb3-utils/src/contracts.ts b/packages/sysweb3-utils/src/contracts.ts index 12f17fa5..e45def89 100644 --- a/packages/sysweb3-utils/src/contracts.ts +++ b/packages/sysweb3-utils/src/contracts.ts @@ -1,15 +1,17 @@ -import { ethers, Contract, ContractInterface } from 'ethers'; +import { Contract } from 'ethers/contract'; import abi55 from './abi/erc1155.json'; import abi20 from './abi/erc20.json'; import abi21 from './abi/erc721.json'; import { getContractType, ISupportsInterfaceProps } from './getContract'; +import type { InterfaceAbi } from 'ethers/abi'; + export const createContractUsingAbi = ( - AbiContract: ContractInterface, + AbiContract: InterfaceAbi, address: string, web3Provider: any -): Contract => new ethers.Contract(String(address), AbiContract, web3Provider); +): Contract => new Contract(String(address), AbiContract, web3Provider); export const isContractAddress = async (address: string, web3Provider: any) => { if (!address) return false; diff --git a/packages/sysweb3-utils/src/declare.d.ts b/packages/sysweb3-utils/src/declare.d.ts index 4edd21d8..c75fe9b8 100644 --- a/packages/sysweb3-utils/src/declare.d.ts +++ b/packages/sysweb3-utils/src/declare.d.ts @@ -1,4 +1 @@ -declare module 'bip84'; declare module 'syscoinjs-lib'; -declare module 'syscointx-js'; -declare module 'coinselectsyscoin'; diff --git a/packages/sysweb3-utils/src/ethers-subpaths.d.ts b/packages/sysweb3-utils/src/ethers-subpaths.d.ts new file mode 100644 index 00000000..08cc3fa9 --- /dev/null +++ b/packages/sysweb3-utils/src/ethers-subpaths.d.ts @@ -0,0 +1,15 @@ +declare module 'ethers/abi' { + export type { InterfaceAbi } from 'ethers'; +} + +declare module 'ethers/address' { + export { isAddress } from 'ethers'; +} + +declare module 'ethers/contract' { + export { Contract, EventLog } from 'ethers'; +} + +declare module 'ethers/providers' { + export type { JsonRpcProvider } from 'ethers'; +} diff --git a/packages/sysweb3-utils/src/fee.ts b/packages/sysweb3-utils/src/fee.ts deleted file mode 100644 index 8640a7b2..00000000 --- a/packages/sysweb3-utils/src/fee.ts +++ /dev/null @@ -1,61 +0,0 @@ -import coinSelectSyscoin from 'coinselectsyscoin'; -import { ethers } from 'ethers'; -import * as syscoinjs from 'syscoinjs-lib'; -import syscointx from 'syscointx-js'; - -type EstimateFeeParams = { - changeAddress: string; - explorerUrl: string; - feeRateBN: any; - network: string; - outputs: { address: string; value: number }[]; - xpub: string; -}; - -export const feeUtils = () => { - const estimateSysTransactionFee = async ({ - outputs, - changeAddress, - feeRateBN, - network, - xpub, - explorerUrl, - }: EstimateFeeParams) => { - const txOpts = { rbf: false }; - - const utxos = await syscoinjs.utils.fetchBackendUTXOS(explorerUrl, xpub); - const utxosSanitized = syscoinjs.utils.sanitizeBlockbookUTXOs( - null, - utxos, - network - ); - - // 0 feerate to create tx, then find bytes and multiply feeRate by bytes to get estimated txfee - const tx = await syscointx.createTransaction( - txOpts, - utxosSanitized, - changeAddress, - outputs, - new syscoinjs.utils.BN(0) - ); - const bytes = coinSelectSyscoin.utils.transactionBytes( - tx.inputs, - tx.outputs - ); - const txFee = feeRateBN.mul(new syscoinjs.utils.BN(bytes)); - - return txFee; - }; - - const getRecommendedFee = async (explorerUrl: string): Promise => - (await syscoinjs.utils.fetchEstimateFee(explorerUrl, 1)) / 1024; - - const convertGasFee = (value: string) => - ethers.utils.formatEther(String(value)); - - return { - estimateSysTransactionFee, - getRecommendedFee, - convertGasFee, - }; -}; diff --git a/packages/sysweb3-utils/src/getContract.ts b/packages/sysweb3-utils/src/getContract.ts index f77eecf1..36d3296d 100644 --- a/packages/sysweb3-utils/src/getContract.ts +++ b/packages/sysweb3-utils/src/getContract.ts @@ -1,4 +1,4 @@ -import * as ethers from 'ethers'; +import { Contract } from 'ethers/contract'; import erc1155Abi from './abi/erc1155.json'; import erc20Abi from './abi/erc20.json'; @@ -9,7 +9,7 @@ export const getContractType = async ( web3Provider: any ): Promise => { try { - const contractERC721 = new ethers.Contract( + const contractERC721 = new Contract( contractAddress, erc721Abi, web3Provider @@ -25,7 +25,7 @@ export const getContractType = async ( throw new Error('ERC-721'); } catch (e) { try { - const contractERC1155 = new ethers.Contract( + const contractERC1155 = new Contract( contractAddress, erc1155Abi, web3Provider @@ -39,14 +39,14 @@ export const getContractType = async ( throw new Error('ERC-1155'); } catch (e) { try { - const contractERC20 = new ethers.Contract( + const contractERC20 = new Contract( contractAddress, erc20Abi, web3Provider ); const balanceOf = await contractERC20.balanceOf(contractAddress); - if (typeof balanceOf === 'object') { + if (typeof balanceOf === 'bigint' || typeof balanceOf === 'object') { return { type: 'ERC-20' }; } throw new Error('ERC-20'); diff --git a/packages/sysweb3-utils/src/index.ts b/packages/sysweb3-utils/src/index.ts index ef31eb07..4e69cb1e 100644 --- a/packages/sysweb3-utils/src/index.ts +++ b/packages/sysweb3-utils/src/index.ts @@ -2,10 +2,7 @@ export * from './contracts'; export * from './encryptor'; export * from './tokens'; export * from './validation'; -export * from './fee'; export * from './transactions'; -export * from './trezor'; -// export * from './networks'; export * from './address'; export * from './constants'; export * from './getContract'; diff --git a/packages/sysweb3-utils/src/tokens.json b/packages/sysweb3-utils/src/tokens.json deleted file mode 100644 index 4d998325..00000000 --- a/packages/sysweb3-utils/src/tokens.json +++ /dev/null @@ -1,4003 +0,0 @@ -{ - "0x4ad7a056191F4c9519fAcd6D75FA94CA26003aCE": { - "name": "GoldPesa Option", - "logo": "GPO.svg", - "erc20": true, - "tokenSymbol": "GPO", - "decimals": 16 - }, - "0x85F17Cf997934a597031b2E18a9aB6ebD4B9f6a4": { - "name": "NEAR", - "logo": "NEAR.svg", - "erc20": true, - "tokenSymbol": "NEAR", - "decimals": 24 - }, - "0x6B3595068778DD592e39A122f4f5a5cF09C90fE2": { - "name": "SushiSwap", - "logo": "sushi.svg", - "erc20": true, - "erc721": false, - "tokenSymbol": "SUSHI", - "decimals": 18 - }, - "0x881Ba05de1E78f549cC63a8f6Cabb1d4AD32250D": { - "name": "00", - "logo": "00.svg", - "erc20": true, - "erc721": false, - "tokenSymbol": "00", - "decimals": 18 - }, - "0x2Ec3275f7aCe4044e499823F511cd58250be8E3d": { - "name": "Privilege", - "logo": "prvg.svg", - "erc20": true, - "tokenSymbol": "PRVG", - "decimals": 8 - }, - "0x65BB569FAaDD324a00883FdE4c46346cc96D5c0A": { - "name": "Provide", - "logo": "prvd.svg", - "erc20": true, - "tokenSymbol": "PRVD", - "decimals": 8 - }, - "0xB4272071eCAdd69d933AdcD19cA99fe80664fc08": { - "name": "CryptoFranc", - "logo": "XCHF.svg", - "erc20": true, - "tokenSymbol": "XCHF", - "decimals": 18 - }, - "0x5aFE3855358E112B5647B952709E6165e1c1eEEe": { - "name": "Safe Token", - "logo": "safe-white-token.svg", - "erc20": true, - "tokenSymbol": "SAFE", - "decimals": 18 - }, - "0x9C8fF314C9Bc7F6e59A9d9225Fb22946427eDC03": { - "name": "Nouns", - "erc20": false, - "erc721": true, - "tokenSymbol": "NOUN", - "decimals": 0, - "logo": "nouns.svg" - }, - "0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D": { - "name": "BoredApeYachtClub", - "erc20": false, - "erc721": true, - "tokenSymbol": "BAYC", - "decimals": 0, - "logo": "bayc.svg" - }, - "0x08D7C0242953446436F34b4C78Fe9da38c73668d": { - "name": "PROOF Collective", - "erc20": false, - "erc721": true, - "tokenSymbol": "PROOF", - "decimals": 0, - "logo": "proof.svg" - }, - "0x23581767a106ae21c074b2276D25e5C3e136a68b": { - "name": "Moonbirds", - "erc20": false, - "erc721": true, - "tokenSymbol": "MOONBIRD", - "decimals": 0, - "logo": "moonbirds.svg" - }, - "0x60E4d786628Fea6478F785A6d7e704777c86a7c6": { - "name": "MutantApeYachtClub", - "erc20": false, - "erc721": true, - "tokenSymbol": "MAYC", - "decimals": 0, - "logo": "mayc.svg" - }, - "0x49cF6f5d44E70224e2E23fDcdd2C053F30aDA28B": { - "name": "CloneX", - "erc20": false, - "erc721": true, - "tokenSymbol": "CloneX", - "decimals": 0, - "logo": "clonex.svg" - }, - "0x8a90CAb2b38dba80c64b7734e58Ee1dB38B8992e": { - "name": "Doodles", - "erc20": false, - "erc721": true, - "tokenSymbol": "DOODLE", - "decimals": 0, - "logo": "doodles.svg" - }, - "0xED5AF388653567Af2F388E6224dC7C4b3241C544": { - "name": "Azuki", - "erc20": false, - "erc721": true, - "tokenSymbol": "AZUKI", - "decimals": 0, - "logo": "azuki.svg" - }, - "0xa3AEe8BcE55BEeA1951EF834b99f3Ac60d1ABeeB": { - "name": "VeeFriends", - "erc20": false, - "erc721": true, - "tokenSymbol": "VFT", - "decimals": 0, - "logo": "veefriends.svg" - }, - "0x34d85c9CDeB23FA97cb08333b511ac86E1C4E258": { - "name": "Otherdeed", - "erc20": false, - "erc721": true, - "tokenSymbol": "OTHR", - "decimals": 0, - "logo": "otherdeed.svg" - }, - "0xBBc2AE13b23d715c30720F079fcd9B4a74093505": { - "name": "Ethernity Chain Token", - "logo": "ERN.svg", - "erc20": true, - "tokenSymbol": "ERN", - "decimals": 18 - }, - "0xD057B63f5E69CF1B929b356b579Cba08D7688048": { - "name": "CoW Protocol Virtual Token", - "logo": "vCOW.svg", - "erc20": true, - "tokenSymbol": "vCOW", - "decimals": 18 - }, - "0xDEf1CA1fb7FBcDC777520aa7f396b4E015F497aB": { - "name": "CoW Protocol Token", - "logo": "COW.svg", - "erc20": true, - "tokenSymbol": "COW", - "decimals": 18 - }, - "0xEd04915c23f00A313a544955524EB7DBD823143d": { - "name": "Alchemy Pay", - "logo": "ACH.svg", - "erc20": true, - "tokenSymbol": "ACH", - "decimals": 8 - }, - "0xeDF6568618A00C6F0908Bf7758A16F76B6E04aF9": { - "name": "Arianee", - "logo": "aria20.svg", - "erc20": true, - "tokenSymbol": "ARIA20", - "decimals": 18 - }, - "0x88D8DA2A8D0fA5b1f4E38030AC486aDE0AFA2798": { - "name": "Terrapass Coin", - "logo": "tpsc.svg", - "erc20": true, - "tokenSymbol": "TPSC", - "decimals": 18 - }, - "0x4730fB1463A6F1F44AEB45F6c5c422427f37F4D0": { - "name": "The 4th Pillar Token", - "logo": "four.svg", - "erc20": true, - "tokenSymbol": "FOUR", - "decimals": 18 - }, - "0x875773784Af8135eA0ef43b5a374AaD105c5D39e": { - "name": "Idle DAO Token", - "logo": "idle.svg", - "erc20": true, - "tokenSymbol": "IDLE", - "decimals": 18 - }, - "0x6BeA7CFEF803D1e3d5f7C0103f7ded065644e197": { - "name": "Gamma", - "logo": "Gamma.svg", - "erc20": true, - "tokenSymbol": "GAMMA", - "decimals": 18 - }, - "0x26805021988F1a45dC708B5FB75Fc75F21747D8c": { - "name": "xGamma", - "logo": "xGamma.svg", - "erc20": true, - "tokenSymbol": "xGAMMA", - "decimals": 18 - }, - "0xc7D9c108D4E1dD1484D3e2568d7f74bfD763d356": { - "name": "SORA Synthetic USD", - "logo": "sora-xstusd.svg", - "erc20": true, - "tokenSymbol": "XSTUSD", - "decimals": 18 - }, - "0x519C1001D550C0a1DaE7d1fC220f7d14c2A521BB": { - "name": "Polkaswap", - "logo": "sora-pswap.svg", - "erc20": true, - "tokenSymbol": "PSWAP", - "decimals": 18 - }, - "0x40FD72257597aA14C7231A7B1aaa29Fce868F677": { - "name": "SORA", - "logo": "sora-xor.svg", - "erc20": true, - "tokenSymbol": "XOR", - "decimals": 18 - }, - "0x909E34d3f6124C324ac83DccA84b74398a6fa173": { - "name": "$ZKP Token", - "logo": "ZKP.svg", - "erc20": true, - "erc721": false, - "tokenSymbol": "$ZKP", - "decimals": 18 - }, - "0xe88f8313e61A97cEc1871EE37fBbe2a8bf3ed1E4": { - "name": "SORA Validator", - "logo": "sora-val.svg", - "erc20": true, - "tokenSymbol": "VAL", - "decimals": 18 - }, - "0x7A58c0Be72BE218B41C608b7Fe7C5bB630736C71": { - "name": "ConstitutionDAO", - "logo": "PEOPLE.svg", - "erc20": true, - "tokenSymbol": "PEOPLE", - "decimals": 18 - }, - "0x32E6C34Cd57087aBBD59B5A4AECC4cB495924356": { - "name": "BitBase", - "logo": "BTBS.svg", - "erc20": true, - "tokenSymbol": "BTBS", - "decimals": 18 - }, - "0x3fa400483487A489EC9b1dB29C4129063EEC4654": { - "name": "Cryptokek.com", - "logo": "cryptokek.svg", - "erc20": true, - "tokenSymbol": "KEK", - "decimals": 18 - }, - "0xb753428af26E81097e7fD17f40c88aaA3E04902c": { - "name": "Spice", - "logo": "sfi.svg", - "erc20": true, - "tokenSymbol": "SFI", - "decimals": 18 - }, - "0xd084944d3c05CD115C09d072B9F44bA3E0E45921": { - "name": "Manifold Finance", - "logo": "Manifold.svg", - "erc20": true, - "tokenSymbol": "FOLD", - "decimals": 18 - }, - "0x9a0242b7a33DAcbe40eDb927834F96eB39f8fBCB": { - "name": "BABB", - "logo": "bax.svg", - "erc20": true, - "tokenSymbol": "BAX", - "decimals": 18 - }, - "0x4Cf89ca06ad997bC732Dc876ed2A7F26a9E7f361": { - "name": "Mysterium", - "logo": "MYST.svg", - "erc20": true, - "tokenSymbol": "MYST", - "decimals": 18 - }, - "0x697eF32B4a3F5a4C39dE1cB7563f24CA7BfC5947": { - "name": "Insula Token", - "logo": "Insula.svg", - "erc20": true, - "tokenSymbol": "ISLA", - "decimals": 18 - }, - "0x62Dc4817588d53a056cBbD18231d91ffCcd34b2A": { - "name": "DeHive", - "logo": "dehive.svg", - "erc20": true, - "erc721": false, - "tokenSymbol": "DHV", - "decimals": 18 - }, - "0x8400D94A5cb0fa0D041a3788e395285d61c9ee5e": { - "name": "Unibright", - "logo": "ubt.svg", - "erc20": true, - "tokenSymbol": "UBT", - "decimals": 8 - }, - "0xfAd45E47083e4607302aa43c65fB3106F1cd7607": { - "name": "Hoge Finance", - "logo": "HogeFinanceLogo.svg", - "erc20": true, - "tokenSymbol": "HOGE", - "decimals": 9 - }, - "0xBB0E17EF65F82Ab018d8EDd776e8DD940327B28b": { - "name": "Axie Infinity Shard", - "logo": "AXS.svg", - "erc20": true, - "tokenSymbol": "AXS", - "decimals": 18 - }, - "0xCC8Fa225D80b9c7D42F96e9570156c65D6cAAa25": { - "name": "Smooth Love Potion", - "logo": "SLP.svg", - "erc20": true, - "tokenSymbol": "SLP", - "decimals": 0 - }, - "0x10633216E7E8281e33c86F02Bf8e565a635D9770": { - "name": "Dvision Network", - "logo": "dvision.svg", - "erc20": true, - "tokenSymbol": "DVI", - "decimals": 18 - }, - "0x898BAD2774EB97cF6b94605677F43b41871410B1": { - "name": "vEth2", - "logo": "vEth2.svg", - "erc20": true, - "tokenSymbol": "vEth2", - "decimals": 18 - }, - "0xE94B97b6b43639E238c851A7e693F50033EfD75C": { - "name": "Rainbow Token", - "logo": "halodao-rnbw.svg", - "erc20": true, - "tokenSymbol": "RNBW", - "decimals": 18 - }, - "0x47BE779De87de6580d0548cde80710a93c502405": { - "name": "Rainbow Pool", - "logo": "halodao-xrnbw.svg", - "erc20": true, - "tokenSymbol": "xRNBW", - "decimals": 18 - }, - "0xe7aE6D0C56CACaf007b7e4d312f9af686a9E9a04": { - "name": "Vabble", - "logo": "VAB.svg", - "erc20": true, - "tokenSymbol": "VAB", - "decimals": 18 - }, - "0x853d955aCEf822Db058eb8505911ED77F175b99e": { - "name": "Frax", - "logo": "frax.svg", - "erc20": true, - "tokenSymbol": "FRAX", - "decimals": 18 - }, - "0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0": { - "name": "Frax Share", - "logo": "fxs.svg", - "erc20": true, - "tokenSymbol": "FXS", - "decimals": 18 - }, - "0x84810bcF08744d5862B8181f12d17bfd57d3b078": { - "name": "SharedStake", - "logo": "sharedstake.svg", - "erc20": true, - "tokenSymbol": "SGT", - "decimals": 18 - }, - "0x75387e1287Dd85482aB66102DA9f6577E027f609": { - "name": "MindsyncAI", - "logo": "MAI.svg", - "erc20": true, - "tokenSymbol": "MAI", - "decimals": 18 - }, - "0x196f4727526eA7FB1e17b2071B3d8eAA38486988": { - "name": "Reserve", - "logo": "rsv.svg", - "erc20": true, - "tokenSymbol": "RSV", - "decimals": 18 - }, - "0x320623b8E4fF03373931769A31Fc52A4E78B5d70": { - "name": "Reserve Rights", - "logo": "rsr.svg", - "erc20": true, - "tokenSymbol": "RSR", - "decimals": 18 - }, - "0x1cF4592ebfFd730c7dc92c1bdFFDfc3B9EfCf29a": { - "name": "WAVES", - "logo": "waves.svg", - "erc20": true, - "tokenSymbol": "WAVES", - "decimals": 18 - }, - "0x252739487C1fa66eaeaE7CED41d6358aB2a6bCa9": { - "name": "ArCoin", - "logo": "ArCoin.svg", - "erc20": true, - "tokenSymbol": "RCOIN", - "decimals": 8 - }, - "0x18aAA7115705e8be94bfFEBDE57Af9BFc265B998": { - "name": "Audius", - "logo": "audius.svg", - "erc20": true, - "tokenSymbol": "AUDIO", - "decimals": 18 - }, - "0x8E3BCC334657560253B83f08331d85267316e08a": { - "name": "Rubic", - "logo": "brbc.svg", - "erc20": true, - "tokenSymbol": "BRBC", - "decimals": 18 - }, - "0xca1207647Ff814039530D7d35df0e1Dd2e91Fa84": { - "name": "dHEDGE DAO Token", - "logo": "DHT.svg", - "erc20": true, - "tokenSymbol": "DHT", - "decimals": 18 - }, - "0x6243d8CEA23066d098a15582d81a598b4e8391F4": { - "name": "Reflexer Ungovernance Token", - "logo": "flx.svg", - "erc20": true, - "tokenSymbol": "FLX", - "decimals": 18 - }, - "0x03ab458634910AaD20eF5f1C8ee96F1D6ac54919": { - "name": "Rai Reflex Index", - "logo": "rai.svg", - "erc20": true, - "tokenSymbol": "RAI", - "decimals": 18 - }, - "0xF25c91C87e0B1fd9B4064Af0F427157AaB0193A7": { - "name": "BASIC Token", - "logo": "basic.svg", - "erc20": true, - "tokenSymbol": "BASIC", - "decimals": 18 - }, - "0x53C8395465A84955c95159814461466053DedEDE": { - "name": "DeGate Token", - "logo": "DG.svg", - "erc20": true, - "tokenSymbol": "DG", - "decimals": 18 - }, - "0xBCf9dBf8B14eD096B2BA08b7269356197fDd1b5D": { - "name": "Avaluse", - "logo": "avaluse.svg", - "erc20": true, - "tokenSymbol": "AVAL", - "decimals": 18 - }, - "0x6E765D26388A17A6e86c49A8E41DF3F58aBcd337": { - "name": "Kangal", - "logo": "kangal.svg", - "erc20": true, - "tokenSymbol": "KANGAL", - "decimals": 18 - }, - "0x9AF4f26941677C706cfEcf6D3379FF01bB85D5Ab": { - "name": "DomRaiderToken", - "logo": "drt.svg", - "erc20": true, - "tokenSymbol": "DRT", - "decimals": 8 - }, - "0x06B179e292f080871825beD5D722162fD96B4c95": { - "name": "10x.gg", - "logo": "xgg.svg", - "erc20": true, - "tokenSymbol": "XGG", - "decimals": 18 - }, - "0xF29992D7b589A0A6bD2de7Be29a97A6EB73EaF85": { - "name": "DMScript", - "logo": "dmst.svg", - "erc20": true, - "tokenSymbol": "DMST", - "decimals": 18 - }, - "0x64aa3364F17a4D01c6f1751Fd97C2BD3D7e7f1D5": { - "name": "Olympus", - "logo": "OHM.svg", - "erc20": true, - "tokenSymbol": "OHM", - "decimals": 9 - }, - "0x0ab87046fBb341D058F17CBC4c1133F25a20a52f": { - "name": "Governance OHM", - "logo": "gOHM.svg", - "erc20": true, - "tokenSymbol": "gOHM", - "decimals": 18 - }, - "0xDd1Ad9A21Ce722C151A836373baBe42c868cE9a4": { - "name": "Universal Basic Income", - "logo": "ubi.svg", - "erc20": true, - "tokenSymbol": "UBI", - "decimals": 18 - }, - "0xf293d23BF2CDc05411Ca0edDD588eb1977e8dcd4": { - "name": "Sylo", - "logo": "SYLO.svg", - "erc20": true, - "tokenSymbol": "SYLO", - "decimals": 18 - }, - "0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84": { - "name": "Liquid staked Ether 2.0", - "logo": "stETH.svg", - "erc20": true, - "tokenSymbol": "stETH", - "decimals": 18 - }, - "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0": { - "name": "Wrapped liquid staked Ether 2.0", - "logo": "wstETH.svg", - "erc20": true, - "tokenSymbol": "wstETH", - "decimals": 18 - }, - "0x5A98FcBEA516Cf06857215779Fd812CA3beF1B32": { - "name": "Lido DAO Token", - "logo": "LDO.svg", - "erc20": true, - "tokenSymbol": "LDO", - "decimals": 18 - }, - "0xbd31EA8212119f94A611FA969881CBa3EA06Fa3d": { - "name": "LUNA Token", - "logo": "Luna.svg", - "erc20": true, - "tokenSymbol": "LUNA", - "decimals": 6 - }, - "0xa693B19d2931d498c5B318dF961919BB4aee87a5": { - "name": "UST Token", - "logo": "UST.svg", - "erc20": true, - "tokenSymbol": "UST", - "decimals": 6 - }, - "0xd2877702675e6cEb975b4A1dFf9fb7BAF4C91ea9": { - "name": "LUNA Token - Shuttle", - "logo": "shuttleLUNA.svg", - "erc20": true, - "tokenSymbol": "LUNA-S", - "decimals": 18 - }, - "0xa47c8bf37f92aBed4A126BDA807A7b7498661acD": { - "name": "UST Token - Shuttle", - "logo": "shuttleUST.svg", - "erc20": true, - "tokenSymbol": "UST-S", - "decimals": 18 - }, - "0xcAAfF72A8CbBfc5Cf343BA4e26f65a257065bFF1": { - "name": "KRT Token - Shuttle", - "logo": "KRT.svg", - "erc20": true, - "tokenSymbol": "KRT-S", - "decimals": 18 - }, - "0x676Ad1b33ae6423c6618C1AEcf53BAa29cf39EE5": { - "name": "SDT Token - Shuttle", - "logo": "SDT.svg", - "erc20": true, - "tokenSymbol": "SDT-S", - "decimals": 18 - }, - "0x156B36ec68FdBF84a925230BA96cb1Ca4c4bdE45": { - "name": "MNT Token - Shuttle", - "logo": "MNT.svg", - "erc20": true, - "tokenSymbol": "MNT-S", - "decimals": 18 - }, - "0x09a3EcAFa817268f77BE1283176B946C4ff2E608": { - "name": "MIR Token - Shuttle", - "logo": "MIR.svg", - "erc20": true, - "tokenSymbol": "MIR-S", - "decimals": 18 - }, - "0xd36932143F6eBDEDD872D5Fb0651f4B72Fd15a84": { - "name": "Mirror AAPL Token - Shuttle", - "logo": "mAAPL.svg", - "erc20": true, - "tokenSymbol": "mAAPL-S", - "decimals": 18 - }, - "0x59A921Db27Dd6d4d974745B7FfC5c33932653442": { - "name": "Mirror GOOGL Token - Shuttle", - "logo": "mGOOGL.svg", - "erc20": true, - "tokenSymbol": "mGOGL-S", - "decimals": 18 - }, - "0x21cA39943E91d704678F5D00b6616650F066fD63": { - "name": "Mirror TSLA Token - Shuttle", - "logo": "mTSLA.svg", - "erc20": true, - "tokenSymbol": "mTSLA-S", - "decimals": 18 - }, - "0xC8d674114bac90148d11D3C1d33C61835a0F9DCD": { - "name": "Mirror NFLX Token - Shuttle", - "logo": "mNFLX.svg", - "erc20": true, - "tokenSymbol": "mNFLX-S", - "decimals": 18 - }, - "0x13B02c8dE71680e71F0820c996E4bE43c2F57d15": { - "name": "Mirror QQQ Token - Shuttle", - "logo": "mQQQ.svg", - "erc20": true, - "tokenSymbol": "mQQQ-S", - "decimals": 18 - }, - "0xEdb0414627E6f1e3F082DE65cD4F9C693D78CCA9": { - "name": "Mirror TWTR Token - Shuttle", - "logo": "mTWTR.svg", - "erc20": true, - "tokenSymbol": "mTWTR-S", - "decimals": 18 - }, - "0x41BbEDd7286dAab5910a1f15d12CBda839852BD7": { - "name": "Mirror MSFT Token - Shuttle", - "logo": "mMSFT.svg", - "erc20": true, - "tokenSymbol": "mMSFT-S", - "decimals": 18 - }, - "0x0cae9e4d663793c2a2A0b211c1Cf4bBca2B9cAa7": { - "name": "Mirror AMZN Token - Shuttle", - "logo": "mAMZN.svg", - "erc20": true, - "tokenSymbol": "mAMZN-S", - "decimals": 18 - }, - "0x56aA298a19C93c6801FDde870fA63EF75Cc0aF72": { - "name": "Mirror BABA Token - Shuttle", - "logo": "mBABA.svg", - "erc20": true, - "tokenSymbol": "mBABA-S", - "decimals": 18 - }, - "0x1d350417d9787E000cc1b95d70E9536DcD91F373": { - "name": "Mirror IAU Token - Shuttle", - "logo": "mIAU.svg", - "erc20": true, - "tokenSymbol": "mIAU-S", - "decimals": 18 - }, - "0x9d1555d8cB3C846Bb4f7D5B1B1080872c3166676": { - "name": "Mirror SLV Token - Shuttle", - "logo": "mSLV.svg", - "erc20": true, - "tokenSymbol": "mSLV-S", - "decimals": 18 - }, - "0x31c63146a635EB7465e5853020b39713AC356991": { - "name": "Mirror USO Token - Shuttle", - "logo": "mUSO.svg", - "erc20": true, - "tokenSymbol": "mUSO-S", - "decimals": 18 - }, - "0xf72FCd9DCF0190923Fadd44811E240Ef4533fc86": { - "name": "Mirror VIXY Token - Shuttle", - "logo": "mVIXY.svg", - "erc20": true, - "tokenSymbol": "mVIXY-S", - "decimals": 18 - }, - "0x21BfBDa47A0B4B5b1248c767Ee49F7caA9B23697": { - "name": "OVR", - "logo": "OVR.svg", - "erc20": true, - "tokenSymbol": "OVR", - "decimals": 18 - }, - "0x4691937a7508860F876c9c0a2a617E7d9E945D4B": { - "name": "Wootrade Network", - "logo": "wootrade.svg", - "erc20": true, - "tokenSymbol": "WOO", - "decimals": 18 - }, - "0xaf9f549774ecEDbD0966C52f250aCc548D3F36E5": { - "name": "RFUEL", - "logo": "RFUEL.svg", - "erc20": true, - "tokenSymbol": "RFUEL", - "decimals": 18 - }, - "0x7420B4b9a0110cdC71fB720908340C03F9Bc03EC": { - "name": "JasmyCoin", - "logo": "JASMY.svg", - "erc20": true, - "tokenSymbol": "JASMY", - "decimals": 18 - }, - "0x947AEb02304391f8fbE5B25D7D98D649b57b1788": { - "name": "Mandala Exchange Token", - "logo": "mandala.svg", - "erc20": true, - "tokenSymbol": "MDX", - "decimals": 18 - }, - "0xCdeee767beD58c5325f68500115d4B722b3724EE": { - "name": "Carbon", - "logo": "CRBN.svg", - "erc20": true, - "tokenSymbol": "CRBN", - "decimals": 18 - }, - "0xA4EED63db85311E22dF4473f87CcfC3DaDCFA3E3": { - "name": "Rubic", - "logo": "Rubic.svg", - "erc20": true, - "tokenSymbol": "RBC", - "decimals": 18 - }, - "0x3A880652F47bFaa771908C07Dd8673A787dAEd3A": { - "name": "DerivaDAO", - "logo": "DDX.svg", - "erc20": true, - "tokenSymbol": "DDX", - "decimals": 18 - }, - "0xbC396689893D065F41bc2C6EcbeE5e0085233447": { - "name": "Perpetual", - "logo": "PERP.svg", - "erc20": true, - "tokenSymbol": "PERP", - "decimals": 18 - }, - "0xeca82185adCE47f39c684352B0439f030f860318": { - "name": "Perlin", - "logo": "PERL.svg", - "erc20": true, - "tokenSymbol": "PERL", - "decimals": 18 - }, - "0xA1AFFfE3F4D611d252010E3EAf6f4D77088b0cd7": { - "name": "Reflect Finance", - "logo": "RFI.svg", - "erc20": true, - "tokenSymbol": "RFI", - "decimals": 9 - }, - "0xC0bA369c8Db6eB3924965e5c4FD0b4C1B91e305F": { - "name": "DLP Duck Token", - "logo": "dlpducktoken.svg", - "erc20": true, - "tokenSymbol": "DUCK", - "decimals": 18 - }, - "0xFbEEa1C75E4c4465CB2FCCc9c6d6afe984558E20": { - "name": "DuckDaoDime", - "logo": "ddim.svg", - "erc20": true, - "tokenSymbol": "DDIM", - "decimals": 18 - }, - "0xB4d930279552397bbA2ee473229f89Ec245bc365": { - "name": "MahaDAO", - "logo": "MAHA.svg", - "erc20": true, - "tokenSymbol": "MAHA", - "decimals": 18 - }, - "0x3231Cb76718CDeF2155FC47b5286d82e6eDA273f": { - "name": "Monerium EUR", - "logo": "EURe.svg", - "erc20": true, - "tokenSymbol": "EURe", - "decimals": 18 - }, - "0x7ba92741Bf2A568abC6f1D3413c58c6e0244F8fD": { - "name": "Monerium GBP", - "logo": "GBPe.svg", - "erc20": true, - "tokenSymbol": "GBPe", - "decimals": 18 - }, - "0xBc5142e0CC5eB16b47c63B0f033d4c2480853a52": { - "name": "Monerium USD", - "logo": "USDe.svg", - "erc20": true, - "tokenSymbol": "USDe", - "decimals": 18 - }, - "0xC642549743A93674cf38D6431f75d6443F88E3E2": { - "name": "Monerium ISK", - "logo": "ISKe.svg", - "erc20": true, - "tokenSymbol": "ISKe", - "decimals": 18 - }, - "0x66a0f676479Cee1d7373f3DC2e2952778BfF5bd6": { - "name": "WISE Token", - "logo": "wise.svg", - "erc20": true, - "tokenSymbol": "WISE", - "decimals": 18 - }, - "0x72F020f8f3E8fd9382705723Cd26380f8D0c66Bb": { - "name": "PlotX", - "logo": "plotx.svg", - "erc20": true, - "tokenSymbol": "PLOT", - "decimals": 18 - }, - "0x44197A4c44D6A059297cAf6be4F7e172BD56Caaf": { - "name": "ELTCOIN", - "logo": "ELTCOIN.svg", - "erc20": true, - "tokenSymbol": "ELT", - "decimals": 8 - }, - "0x6781a0F84c7E9e846DCb84A9a5bd49333067b104": { - "name": "ZAP TOKEN", - "logo": "zapicon.svg", - "erc20": true, - "tokenSymbol": "ZAP", - "decimals": 18 - }, - "0x00c83aeCC790e8a4453e5dD3B0B4b3680501a7A7": { - "name": "SKALE", - "logo": "skl.svg", - "erc20": true, - "tokenSymbol": "SKL", - "decimals": 18 - }, - "0x674C6Ad92Fd080e4004b2312b45f796a192D27a0": { - "name": "Neutrino USD", - "logo": "usdn.svg", - "erc20": true, - "tokenSymbol": "USDN", - "decimals": 18 - }, - "0xE5CAeF4Af8780E59Df925470b050Fb23C43CA68C": { - "name": "Ferrum Network Token", - "logo": "frm.svg", - "erc20": true, - "tokenSymbol": "FRM", - "decimals": 6 - }, - "0x998FFE1E43fAcffb941dc337dD0468d52bA5b48A": { - "name": "Rupiah Token", - "logo": "idrt.svg", - "erc20": true, - "tokenSymbol": "IDRT", - "decimals": 2 - }, - "0x4E15361FD6b4BB609Fa63C81A2be19d873717870": { - "name": "Fantom", - "logo": "ftm.svg", - "erc20": true, - "tokenSymbol": "FTM", - "decimals": 18 - }, - "0x557B933a7C2c45672B610F8954A3deB39a51A8Ca": { - "name": "REVV", - "logo": "revv.svg", - "erc20": true, - "tokenSymbol": "REVV", - "decimals": 18 - }, - "0xFFC97d72E13E01096502Cb8Eb52dEe56f74DAD7B": { - "name": "Aave AAVE", - "logo": "aAAVE.svg", - "erc20": true, - "tokenSymbol": "aAAVE", - "decimals": 18 - }, - "0x05Ec93c0365baAeAbF7AefFb0972ea7ECdD39CF1": { - "name": "Aave BAT", - "logo": "aBAT.svg", - "erc20": true, - "tokenSymbol": "aBAT", - "decimals": 18 - }, - "0xA361718326c15715591c299427c62086F69923D9": { - "name": "Aave BUSD", - "logo": "aBUSD.svg", - "erc20": true, - "tokenSymbol": "aBUSD", - "decimals": 18 - }, - "0x028171bCA77440897B824Ca71D1c56caC55b68A3": { - "name": "Aave DAI", - "logo": "aDAI.svg", - "erc20": true, - "tokenSymbol": "aDAI", - "decimals": 18 - }, - "0xaC6Df26a590F08dcC95D5a4705ae8abbc88509Ef": { - "name": "Aave ENJ", - "logo": "aENJ.svg", - "erc20": true, - "tokenSymbol": "aENJ", - "decimals": 18 - }, - "0xD37EE7e4f452C6638c96536e68090De8cBcdb583": { - "name": "Aave GUSD", - "logo": "aGUSD.svg", - "erc20": true, - "tokenSymbol": "aGUSD", - "decimals": 2 - }, - "0x39C6b3e42d6A679d7D776778Fe880BC9487C2EDA": { - "name": "Aave KNC", - "logo": "aKNC.svg", - "erc20": true, - "tokenSymbol": "aKNC", - "decimals": 18 - }, - "0xa06bC25B5805d5F8d82847D191Cb4Af5A3e873E0": { - "name": "Aave LINK", - "logo": "aLINK.svg", - "erc20": true, - "tokenSymbol": "aLINK", - "decimals": 18 - }, - "0xa685a61171bb30d4072B338c80Cb7b2c865c873E": { - "name": "Aave MANA", - "logo": "aMANA.svg", - "erc20": true, - "tokenSymbol": "aMANA", - "decimals": 18 - }, - "0xc713e5E149D5D0715DcD1c156a020976e7E56B88": { - "name": "Aave MKR", - "logo": "aMKR.svg", - "erc20": true, - "tokenSymbol": "aMKR", - "decimals": 18 - }, - "0xCC12AbE4ff81c9378D670De1b57F8e0Dd228D77a": { - "name": "Aave REN", - "logo": "aREN.svg", - "erc20": true, - "tokenSymbol": "aREN", - "decimals": 18 - }, - "0x35f6B052C598d933D69A4EEC4D04c73A191fE6c2": { - "name": "Aave SNX", - "logo": "aSNX.svg", - "erc20": true, - "tokenSymbol": "aSNX", - "decimals": 18 - }, - "0x6C5024Cd4F8A59110119C56f8933403A539555EB": { - "name": "Aave SUSD", - "logo": "aSUSD.svg", - "erc20": true, - "tokenSymbol": "aSUSD", - "decimals": 18 - }, - "0x101cc05f4A51C0319f570d5E146a8C625198e636": { - "name": "Aave TUSD", - "logo": "aTUSD.svg", - "erc20": true, - "tokenSymbol": "aTUSD", - "decimals": 18 - }, - "0xB9D7CB55f463405CDfBe4E90a6D2Df01C2B92BF1": { - "name": "Aave UNI", - "logo": "aUNI.svg", - "erc20": true, - "tokenSymbol": "aUNI", - "decimals": 18 - }, - "0xBcca60bB61934080951369a648Fb03DF4F96263C": { - "name": "Aave USDC", - "logo": "aUSDC.svg", - "erc20": true, - "tokenSymbol": "aUSDC", - "decimals": 6 - }, - "0x3Ed3B47Dd13EC9a98b44e6204A523E766B225811": { - "name": "Aave USDT", - "logo": "aUSDT.svg", - "erc20": true, - "tokenSymbol": "aUSDT", - "decimals": 6 - }, - "0x9ff58f4fFB29fA2266Ab25e75e2A8b3503311656": { - "name": "Aave WBTC", - "logo": "aWBTC.svg", - "erc20": true, - "tokenSymbol": "aWBTC", - "decimals": 8 - }, - "0x030bA81f1c18d280636F32af80b9AAd02Cf0854e": { - "name": "Aave WETH", - "logo": "aWETH.svg", - "erc20": true, - "tokenSymbol": "aWETH", - "decimals": 18 - }, - "0x5165d24277cD063F5ac44Efd447B27025e888f37": { - "name": "Aave YFI", - "logo": "aYFI.svg", - "erc20": true, - "tokenSymbol": "aYFI", - "decimals": 18 - }, - "0xdef1fac7Bf08f173D286BbBDcBeeADe695129840": { - "name": "Defi Factory Token", - "logo": "DEFT.svg", - "erc20": true, - "tokenSymbol": "DEFT", - "decimals": 18 - }, - "0xDf7FF54aAcAcbFf42dfe29DD6144A69b629f8C9e": { - "name": "Aave ZRX", - "logo": "aZRX.svg", - "erc20": true, - "tokenSymbol": "aZRX", - "decimals": 18 - }, - "0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9": { - "name": "Aave", - "logo": "AAVE.svg", - "erc20": true, - "tokenSymbol": "AAVE", - "decimals": 18 - }, - "0x44e2deC86B9F0e0266E9AA66e10323A2bd69CF9A": { - "name": "Attrace", - "logo": "attr.svg", - "erc20": true, - "tokenSymbol": "ATTR", - "decimals": 18 - }, - "0x1Da87b114f35E1DC91F72bF57fc07A768Ad40Bb0": { - "name": "Equalizer", - "logo": "EQZ.svg", - "erc20": true, - "tokenSymbol": "EQZ", - "decimals": 18 - }, - "0x4da27a545c0c5B758a6BA100e3a049001de870f5": { - "name": "Staked Aave", - "logo": "stkAAVE.svg", - "erc20": true, - "tokenSymbol": "stAAVE", - "decimals": 18 - }, - "0xba9d4199faB4f26eFE3551D490E3821486f135Ba": { - "name": "SwissBorg", - "logo": "chsb.svg", - "erc20": true, - "tokenSymbol": "CHSB", - "decimals": 8 - }, - "0x7DD9c5Cba05E151C895FDe1CF355C9A1D5DA6429": { - "name": "Golem Network Token", - "logo": "glm.svg", - "erc20": true, - "tokenSymbol": "GLM", - "decimals": 18 - }, - "0x7240aC91f01233BaAf8b064248E80feaA5912BA3": { - "name": "OctoFi", - "logo": "octo.svg", - "erc20": true, - "tokenSymbol": "OCTO", - "decimals": 18 - }, - "0xff56Cc6b1E6dEd347aA0B7676C85AB0B3D08B0FA": { - "name": "Orbs", - "logo": "orbs.svg", - "erc20": true, - "tokenSymbol": "ORBS", - "decimals": 18 - }, - "0x63f88A2298a5c4AEE3c216Aa6D926B184a4b2437": { - "name": "GAME Credits", - "logo": "GAMECreditsLogo.svg", - "erc20": true, - "tokenSymbol": "GAME", - "decimals": 18 - }, - "0x5150956E082C748Ca837a5dFa0a7C10CA4697f9c": { - "name": "Zeedex", - "logo": "zdex.svg", - "erc20": true, - "tokenSymbol": "ZDEX", - "decimals": 18 - }, - "0x84cA8bc7997272c7CfB4D0Cd3D55cd942B3c9419": { - "name": "DIAdata", - "logo": "dia.svg", - "erc20": true, - "tokenSymbol": "DIA", - "decimals": 18 - }, - "0xb78B3320493a4EFaa1028130C5Ba26f0B6085Ef8": { - "name": "Dracula", - "logo": "dracula.svg", - "erc20": true, - "tokenSymbol": "DRC", - "decimals": 18 - }, - "0xF433089366899D83a9f26A773D59ec7eCF30355e": { - "name": "Metal", - "logo": "mtl.svg", - "erc20": true, - "tokenSymbol": "MTL", - "decimals": 8 - }, - "0x85Eee30c52B0b379b046Fb0F85F4f3Dc3009aFEC": { - "name": "KEEP", - "logo": "keep.svg", - "erc20": true, - "tokenSymbol": "KEEP", - "decimals": 18 - }, - "0x8dAEBADE922dF735c38C80C7eBD708Af50815fAa": { - "name": "tBTC", - "logo": "tbtc.svg", - "erc20": true, - "tokenSymbol": "TBTC", - "decimals": 18 - }, - "0xD7EFB00d12C2c13131FD319336Fdf952525dA2af": { - "name": "Proton", - "logo": "proton.svg", - "erc20": true, - "tokenSymbol": "XPR", - "decimals": 4 - }, - "0x178c820f862B14f316509ec36b13123DA19A6054": { - "name": "Energy Web Token Bridged", - "logo": "ewtb.svg", - "erc20": true, - "tokenSymbol": "EWTB", - "decimals": 18 - }, - "0x2b591e99afE9f32eAA6214f7B7629768c40Eeb39": { - "name": "HEX", - "logo": "hex.svg", - "erc20": true, - "tokenSymbol": "HEX", - "decimals": 8 - }, - "0xFca59Cd816aB1eaD66534D82bc21E7515cE441CF": { - "name": "Rarible", - "logo": "rari.svg", - "erc20": true, - "tokenSymbol": "RARI", - "decimals": 18 - }, - "0x7865af71cf0b288b4E7F654f4F7851EB46a2B7F8": { - "name": "Sentivate", - "logo": "sentivate.svg", - "erc20": true, - "tokenSymbol": "SNTVT", - "decimals": 18 - }, - "0xa3d58c4E56fedCae3a7c43A725aeE9A71F0ece4e": { - "name": "Metronome", - "logo": "metronome.svg", - "erc20": true, - "tokenSymbol": "MET", - "decimals": 18 - }, - "0x49d716DFe60b37379010A75329ae09428f17118d": { - "name": "PoolTogether Dai", - "logo": "pldai.svg", - "erc20": true, - "tokenSymbol": "PLDAI", - "decimals": 18 - }, - "0xfE6892654CBB05eB73d28DCc1Ff938f59666Fe9f": { - "name": "PoolTogether Sai", - "logo": "plsai.svg", - "erc20": true, - "tokenSymbol": "PLSAI", - "decimals": 18 - }, - "0x5732046A883704404F284Ce41FfADd5b007FD668": { - "name": "Bluzelle Token", - "logo": "Bluzelle.svg", - "erc20": true, - "tokenSymbol": "BLZ", - "decimals": 18 - }, - "0xBD87447F48ad729C5c4b8bcb503e1395F62e8B98": { - "name": "PoolTogether USDC", - "logo": "plusdc.svg", - "erc20": true, - "tokenSymbol": "PLUSDC", - "decimals": 6 - }, - "0x69A95185ee2a045CDC4bCd1b1Df10710395e4e23": { - "name": "$Poolz Finance", - "logo": "Poolz.svg", - "erc20": true, - "tokenSymbol": "POOLZ", - "decimals": 18 - }, - "0x0adA190c81b814548ddC2F6AdC4a689ce7C1FE73": { - "name": "yAxis", - "logo": "yaxis.svg", - "erc20": true, - "tokenSymbol": "YAXIS", - "decimals": 18 - }, - "0xb1dC9124c395c1e97773ab855d66E879f053A289": { - "name": "yAxis", - "logo": "yaxis.svg", - "erc20": true, - "tokenSymbol": "YAX", - "decimals": 18 - }, - "0xeF31Cb88048416E301Fee1eA13e7664b887BA7e8": { - "name": "Staked yAxis", - "logo": "yaxis.svg", - "erc20": true, - "tokenSymbol": "sYAX", - "decimals": 18 - }, - "0x28cb7e841ee97947a86B06fA4090C8451f64c0be": { - "name": "YF Link", - "logo": "YFL.svg", - "erc20": true, - "tokenSymbol": "YFL", - "decimals": 18 - }, - "0x75D1aA733920b14fC74c9F6e6faB7ac1EcE8482E": { - "name": "YFLink Staking Share", - "logo": "YFL.svg", - "erc20": true, - "tokenSymbol": "yYFL", - "decimals": 18 - }, - "0x7b760D06E401f85545F3B50c44bf5B05308b7b62": { - "name": "YFLink USD", - "logo": "YFLUSD.svg", - "erc20": true, - "tokenSymbol": "YFLUSD", - "decimals": 18 - }, - "0x8282df223AC402d04B2097d16f758Af4F70e7Db0": { - "name": "YFLink Synthetic", - "logo": "sYFL.svg", - "erc20": true, - "tokenSymbol": "sYFL", - "decimals": 18 - }, - "0x008377EB0C62cE8e0BA3D7Bb4A5638591f21588E": { - "name": "YFLink Bond", - "logo": "bYFL.svg", - "erc20": true, - "tokenSymbol": "bYFL", - "decimals": 18 - }, - "0x0bc529c00C6401aEF6D220BE8C6Ea1667F6Ad93e": { - "name": "yearn.finance", - "logo": "yfi.svg", - "erc20": true, - "tokenSymbol": "YFI", - "decimals": 18 - }, - "0x261b45D85cCFeAbb11F022eBa346ee8D1cd488c0": { - "name": "rDAI", - "logo": "rdai.svg", - "erc20": true, - "tokenSymbol": "rDAI", - "decimals": 18 - }, - "0xea8b224eDD3e342DEb514C4176c2E72Bcce6fFF9": { - "name": "rSAI", - "logo": "rsai.svg", - "erc20": true, - "tokenSymbol": "rSAI", - "decimals": 18 - }, - "0x12B19D3e2ccc14Da04FAe33e63652ce469b3F2FD": { - "name": "GridPlus", - "logo": "GridPlus.svg", - "erc20": true, - "tokenSymbol": "GRID", - "decimals": 12 - }, - "0xDb05EA0877A2622883941b939f0bb11d1ac7c400": { - "name": "Opacity", - "logo": "opct.svg", - "erc20": true, - "tokenSymbol": "OPCT", - "decimals": 18 - }, - "0x4575f41308EC1483f3d399aa9a2826d74Da13Deb": { - "name": "Orchid", - "logo": "OXT.svg", - "erc20": true, - "tokenSymbol": "OXT", - "decimals": 18 - }, - "0x4CC19356f2D37338b9802aa8E8fc58B0373296E7": { - "name": "Selfkey", - "logo": "KEY.svg", - "erc20": true, - "tokenSymbol": "KEY", - "decimals": 18 - }, - "0x92A5B04D0ED5D94D7a193d1d334D3D16996f4E13": { - "name": "Eristica", - "logo": "Eristica.svg", - "erc20": true, - "tokenSymbol": "ERT", - "decimals": 18 - }, - "0xdAC17F958D2ee523a2206206994597C13D831ec7": { - "name": "Tether USD", - "logo": "usdt.svg", - "erc20": true, - "tokenSymbol": "USDT", - "decimals": 6 - }, - "0x06AF07097C9Eeb7fD685c692751D5C66dB49c215": { - "name": "Chai", - "logo": "CHAI.svg", - "erc20": true, - "tokenSymbol": "CHAI", - "decimals": 18 - }, - "0x04Fa0d235C4abf4BcF4787aF4CF447DE572eF828": { - "name": "UMA", - "logo": "UMA.png", - "erc20": true, - "tokenSymbol": "UMA", - "decimals": 18 - }, - "0x5f778ec4B31a506c1Dfd8b06F131E9B451a61D39": { - "name": "UPX Token", - "logo": "UPX.svg", - "erc20": true, - "tokenSymbol": "UPX", - "decimals": 18 - }, - "0xb1CD6e4153B2a390Cf00A6556b0fC1458C4A5533": { - "name": "ETHBNT Liquidity Pool", - "logo": "ETHBNT.svg", - "erc20": true, - "tokenSymbol": "ETHBNT", - "decimals": 18 - }, - "0xf0Ee6b27b759C9893Ce4f094b49ad28fd15A23e4": { - "name": "Enigma", - "logo": "enigma.svg", - "erc20": true, - "tokenSymbol": "ENG", - "decimals": 8 - }, - "0xaaAEBE6Fe48E54f431b0C390CfaF0b017d09D42d": { - "name": "Celsius", - "logo": "celsius.svg", - "erc20": true, - "tokenSymbol": "CEL", - "decimals": 4 - }, - "0xb683D83a532e2Cb7DFa5275eED3698436371cc9f": { - "name": "BTU", - "logo": "BTU.svg", - "erc20": true, - "tokenSymbol": "BTU", - "decimals": 18 - }, - "0x746DdA2ea243400D5a63e0700F190aB79f06489e": { - "name": "BOSAGORA", - "logo": "BOA.svg", - "erc20": true, - "tokenSymbol": "BOA", - "decimals": 7 - }, - "0x5D858bcd53E085920620549214a8b27CE2f04670": { - "name": "POP Network Token", - "logo": "POP.svg", - "erc20": true, - "tokenSymbol": "POP", - "decimals": 18 - }, - "0x048Fe49BE32adfC9ED68C37D32B5ec9Df17b3603": { - "name": "Skrumble Network V2", - "logo": "skm.svg", - "erc20": true, - "tokenSymbol": "SKM", - "decimals": 18 - }, - "0x16EA01aCB4b0Bca2000ee5473348B6937ee6f72F": { - "name": "Enecuum", - "logo": "ENQ-logo.svg", - "erc20": true, - "tokenSymbol": "ENQ", - "decimals": 10 - }, - "0xE5B826Ca2Ca02F09c1725e9bd98d9a8874C30532": { - "name": "ZEON Network", - "logo": "ZEON_logo.png", - "erc20": true, - "tokenSymbol": "ZEON", - "decimals": 18 - }, - "0x13cb85823f78Cff38f0B0E90D3e975b8CB3AAd64": { - "name": "REMIIT REMI Token", - "logo": "remi.svg", - "erc20": true, - "tokenSymbol": "REMI", - "decimals": 18 - }, - "0x93a7174dafd31d13400cD9fa01f4e5B5BAa00D39": { - "name": "Shaka", - "logo": "hak.svg", - "erc20": true, - "tokenSymbol": "HAK", - "decimals": 18 - }, - "0x6fB3e0A217407EFFf7Ca062D46c26E5d60a14d69": { - "name": "IoTeX", - "logo": "iotex.svg", - "erc20": true, - "tokenSymbol": "IOTX", - "decimals": 18 - }, - "0xE5a3229CCb22b6484594973A03a3851dCd948756": { - "name": "RAE Token", - "logo": "rae.svg", - "erc20": true, - "tokenSymbol": "RAE", - "decimals": 18 - }, - "0x4470BB87d77b963A013DB939BE332f927f2b992e": { - "name": "AdEx Legacy Token", - "logo": "adex.svg", - "erc20": true, - "tokenSymbol": "ADXL", - "decimals": 4 - }, - "0xADE00C28244d5CE17D72E40330B1c318cD12B7c3": { - "name": "AdEx Token", - "logo": "adex.svg", - "erc20": true, - "tokenSymbol": "ADX", - "decimals": 18 - }, - "0xDc5864eDe28BD4405aa04d93E05A0531797D9D59": { - "name": "Falcon", - "logo": "fnt.svg", - "erc20": true, - "tokenSymbol": "FNT", - "decimals": 6 - }, - "0x1966d718A565566e8E202792658D7b5Ff4ECe469": { - "name": "nDEX", - "logo": "nDEX.png", - "erc20": true, - "tokenSymbol": "NDX", - "decimals": 18 - }, - "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599": { - "name": "Wrapped BTC", - "logo": "wbtc.svg", - "erc20": true, - "tokenSymbol": "WBTC", - "decimals": 8 - }, - "0x150b0b96933B75Ce27af8b92441F8fB683bF9739": { - "name": "Dragonereum Gold", - "logo": "gold.svg", - "erc20": true, - "tokenSymbol": "GOLD", - "decimals": 18 - }, - "0x82f4dED9Cec9B5750FBFf5C2185AEe35AfC16587": { - "name": "DreamTeam Token", - "logo": "dream.svg", - "erc20": true, - "tokenSymbol": "DREAM", - "decimals": 6 - }, - "0x5d60d8d7eF6d37E16EBABc324de3bE57f135e0BC": { - "name": "MyBit", - "logo": "MYB.svg", - "erc20": true, - "tokenSymbol": "MYB", - "decimals": 18 - }, - "0x01FA555c97D7958Fa6f771f3BbD5CCD508f81e22": { - "name": "Civil Token", - "logo": "CVL_token.svg", - "erc20": true, - "tokenSymbol": "CVL", - "decimals": 18 - }, - "0x5adc961D6AC3f7062D2eA45FEFB8D8167d44b190": { - "name": "Dether", - "logo": "dether.svg", - "erc20": true, - "tokenSymbol": "DTH", - "decimals": 18 - }, - "0x3F17Dd476faF0a4855572F0B6ed5115D9bBA22AD": { - "name": "Wibson", - "logo": "wibson-logo.png", - "erc20": true, - "tokenSymbol": "WIB", - "decimals": 9 - }, - "0xDF347911910b6c9A4286bA8E2EE5ea4a39eB2134": { - "name": "Bob's Repair", - "logo": "bobsrepair.png", - "erc20": true, - "tokenSymbol": "BOB", - "decimals": 18 - }, - "0x3505F494c3f0fed0B594E01Fa41Dd3967645ca39": { - "name": "SWARM", - "logo": "swarm.svg", - "erc20": true, - "tokenSymbol": "SWM", - "decimals": 18 - }, - "0x6863bE0e7CF7ce860A574760e9020D519a8bDC47": { - "name": "On.Live", - "logo": "onlive.svg", - "erc20": true, - "tokenSymbol": "ONL", - "decimals": 18 - }, - "0xea5f88E54d982Cbb0c441cde4E79bC305e5b43Bc": { - "name": "Pareto", - "logo": "ParetoLogo.png", - "erc20": true, - "tokenSymbol": "PARETO", - "decimals": 18 - }, - "0x2e91E3e54C5788e9FdD6A181497FDcEa1De1bcc1": { - "name": "Hercules", - "logo": "herc.png", - "erc20": true, - "tokenSymbol": "HERC", - "decimals": 18 - }, - "0x4946Fcea7C692606e8908002e55A582af44AC121": { - "name": "FOAM", - "logo": "FOAM.svg", - "erc20": true, - "tokenSymbol": "FOAM", - "decimals": 18 - }, - "0x4D807509aECe24C0fa5A102b6a3B059Ec6E14392": { - "name": "Menlo One", - "logo": "Menlo_One.png", - "erc20": true, - "tokenSymbol": "ONE", - "decimals": 18 - }, - "0xDDD460bBD9F79847ea08681563e8A9696867210C": { - "name": "Spendcoin", - "logo": "spnd.png", - "erc20": true, - "tokenSymbol": "SPND", - "decimals": 18 - }, - "0x27054b13b1B798B345b591a4d22e6562d47eA75a": { - "name": "AirSwap Token", - "logo": "AST.png", - "erc20": true, - "tokenSymbol": "AST", - "decimals": 4 - }, - "0x8D5682941cE456900b12d47ac06a88b47C764CE1": { - "name": "RightMesh Token", - "logo": "Rmesh.png", - "erc20": true, - "tokenSymbol": "RMESH", - "decimals": 18 - }, - "0xDDe12a12A6f67156e0DA672be05c374e1B0a3e57": { - "name": "JOYSO", - "logo": "JOY.png", - "erc20": true, - "tokenSymbol": "JOY", - "decimals": 6 - }, - "0x0D262e5dC4A06a0F1c90cE79C7a60C09DfC884E4": { - "name": "JET8 Token", - "logo": "J8T.svg", - "erc20": true, - "tokenSymbol": "J8T", - "decimals": 8 - }, - "0x4a220E6096B25EADb88358cb44068A3248254675": { - "name": "Quant Network", - "logo": "quant-network.svg", - "erc20": true, - "tokenSymbol": "QNT", - "decimals": 18 - }, - "0xBC86727E770de68B1060C91f6BB6945c73e10388": { - "name": "Ink Protocol", - "logo": "ink_protocol.svg", - "erc20": true, - "tokenSymbol": "XNK", - "decimals": 18 - }, - "0x4CEdA7906a5Ed2179785Cd3A40A69ee8bc99C466": { - "name": "Aion Network", - "logo": "Aion.png", - "erc20": true, - "tokenSymbol": "AION", - "decimals": 8 - }, - "0xa95592DCFfA3C080B4B40E459c5f5692F67DB7F8": { - "name": "ELY Token", - "logo": "ely.png", - "erc20": true, - "tokenSymbol": "ELY", - "decimals": 18 - }, - "0x9E46A38F5DaaBe8683E10793b06749EEF7D733d1": { - "name": "PolySwarm Nectar", - "logo": "polyswarm_nectar.svg", - "erc20": true, - "tokenSymbol": "NCT", - "decimals": 18 - }, - "0xe1A178B681BD05964d3e3Ed33AE731577d9d96dD": { - "name": "BOX Token", - "logo": "box_token.png", - "erc20": true, - "tokenSymbol": "BOX", - "decimals": 18 - }, - "0x82BD526bDB718C6d4DD2291Ed013A5186cAE2DCa": { - "name": "dutyof.care Token", - "logo": "dutyof.care-square.png", - "erc20": true, - "tokenSymbol": "VDOC", - "decimals": 18 - }, - "0x168296bb09e24A88805CB9c33356536B980D3fC5": { - "name": "Rhoc", - "logo": "rchain.png", - "erc20": true, - "tokenSymbol": "RHOC", - "decimals": 8 - }, - "0x543Ff227F64Aa17eA132Bf9886cAb5DB55DCAddf": { - "name": "DAOstack", - "logo": "DAOstack.png", - "erc20": true, - "tokenSymbol": "GEN", - "decimals": 18 - }, - "0x6aEDbF8dFF31437220dF351950Ba2a3362168d1b": { - "name": "Dragonglass", - "logo": "dragonglass.svg", - "erc20": true, - "tokenSymbol": "DGS", - "decimals": 8 - }, - "0xd26114cd6EE289AccF82350c8d8487fedB8A0C07": { - "name": "OmiseGO", - "logo": "omg.jpg", - "erc20": true, - "tokenSymbol": "OMG", - "decimals": 18 - }, - "0x99ea4dB9EE77ACD40B119BD1dC4E33e1C070b80d": { - "name": "Quantstamp", - "logo": "qsp.svg", - "erc20": true, - "tokenSymbol": "QSP", - "decimals": 18 - }, - "0x4162178B78D6985480A308B2190EE5517460406D": { - "name": "Colu Local Network", - "logo": "cln.png", - "erc20": true, - "tokenSymbol": "CLN", - "decimals": 18 - }, - "0xB64ef51C888972c908CFacf59B47C1AfBC0Ab8aC": { - "name": "Storj", - "logo": "storj.jpg", - "erc20": true, - "tokenSymbol": "STORJ", - "decimals": 8 - }, - "0xD8E3FB3b08eBA982F2754988d70D57eDc0055ae6": { - "name": "Zoracles", - "logo": "ZORA.svg", - "erc20": true, - "tokenSymbol": "ZORA", - "decimals": 9 - }, - "0xF938424F7210f31dF2Aee3011291b658f872e91e": { - "name": "VISOR", - "logo": "VISR.svg", - "erc20": true, - "tokenSymbol": "VISR", - "decimals": 18 - }, - "0x0F5D2fB29fb7d3CFeE444a200298f468908cC942": { - "name": "Decentraland", - "logo": "mana.svg", - "erc20": true, - "tokenSymbol": "MANA", - "decimals": 18 - }, - "0x0F513fFb4926ff82D7F60A05069047AcA295C413": { - "name": "CrowdstartCoin", - "logo": "XSC_Logo.svg", - "erc20": true, - "tokenSymbol": "XSC", - "decimals": 18 - }, - "0x5BC7e5f0Ab8b2E10D2D0a3F21739FCe62459aeF3": { - "name": "Hut34 Entropy Token", - "logo": "ENTRP.png", - "tokenSymbol": "ENTRP", - "erc20": true, - "decimals": 18 - }, - "0x946112efaB61C3636CBD52DE2E1392D7A75A6f01": { - "name": "HYDRO TOKEN", - "logo": "hydro.svg", - "erc20": true, - "tokenSymbol": "HYDRO", - "decimals": 18 - }, - "0x2604FA406Be957E542BEb89E6754fCdE6815e83f": { - "name": "Playkey Token", - "logo": "playkey.svg", - "erc20": true, - "tokenSymbol": "PKT", - "decimals": 18 - }, - "0xE41d2489571d322189246DaFA5ebDe1F4699F498": { - "name": "0x", - "logo": "zrx.svg", - "erc20": true, - "tokenSymbol": "ZRX", - "decimals": 18 - }, - "0xB563300A3BAc79FC09B93b6F84CE0d4465A2AC27": { - "name": "RedCab", - "logo": "redcab.png", - "erc20": true, - "tokenSymbol": "REDC", - "decimals": 18 - }, - "0x957c30aB0426e0C93CD8241E2c60392d08c6aC8e": { - "name": "Modum Token", - "logo": "modum.svg", - "erc20": true, - "tokenSymbol": "MOD", - "decimals": 0 - }, - "0x1a7a8BD9106F2B8D977E08582DC7d24c723ab0DB": { - "name": "AppCoins", - "logo": "appcoins.png", - "erc20": true, - "decimals": 18, - "tokenSymbol": "APPC" - }, - "0xdB25f211AB05b1c97D595516F45794528a807ad8": { - "name": "STASIS EURS Token", - "logo": "stasis-eurs.svg", - "erc20": true, - "decimals": 2, - "tokenSymbol": "EURS" - }, - "0xCA0e7269600d353F70b14Ad118A49575455C0f2f": { - "name": "AMLT", - "logo": "amlt.png", - "erc20": true, - "decimals": 18, - "tokenSymbol": "AMLT" - }, - "0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F": { - "name": "Synthetix Network Token", - "logo": "synthetix.svg", - "erc20": true, - "decimals": 18, - "tokenSymbol": "SNX" - }, - "0x57Ab1ec28D129707052df4dF418D58a2D46d5f51": { - "name": "Synth sUSD", - "logo": "synthetix_susd.svg", - "erc20": true, - "decimals": 18, - "tokenSymbol": "SUSD" - }, - "0x5e74C9036fb86BD7eCdcb084a0673EFc32eA31cb": { - "name": "Synth sETH", - "logo": "synthetix_seth.svg", - "erc20": true, - "decimals": 18, - "tokenSymbol": "SETH" - }, - "0xfE18be6b3Bd88A2D2A7f928d00292E7a9963CfC6": { - "name": "Synth sBTC", - "logo": "synthetix_sbtc.svg", - "erc20": true, - "decimals": 18, - "tokenSymbol": "SBTC" - }, - "0x0DB8D8b76BC361bAcbB72E2C491E06085A97Ab31": { - "name": "IQeon", - "logo": "iqeon.svg", - "erc20": true, - "decimals": 18, - "tokenSymbol": "IQN" - }, - "0x000C100050E98C91f9114fa5Dd75CE6869Bf4F53": { - "name": "CRYPTO10 Hedged", - "logo": "c10.svg", - "erc20": true, - "tokenSymbol": "C10", - "decimals": 18 - }, - "0x26E75307Fc0C021472fEb8F727839531F112f317": { - "name": "Crypto20", - "logo": "c20.svg", - "erc20": true, - "tokenSymbol": "C20", - "decimals": 18 - }, - "0x06012c8cf97BEaD5deAe237070F9587f8E7A266d": { - "name": "Crypto Kitties", - "logo": "CryptoKitties-Kitty-13733.svg", - "erc20": false, - "erc721": true, - "tokenSymbol": "CK", - "decimals": 0 - }, - "0xE477292f1B3268687A29376116B0ED27A9c76170": { - "name": "Herocoin", - "logo": "herocoin_logo.png", - "erc20": true, - "tokenSymbol": "PLAY", - "decimals": 18 - }, - "0x4F4f0Db4de903B88f2B1a2847971E231D54F8fd3": { - "name": "Geens Platform Token", - "logo": "gee-icon.svg", - "erc20": true, - "tokenSymbol": "GEE", - "decimals": 8 - }, - "0xec67005c4E498Ec7f55E092bd1d35cbC47C91892": { - "name": "Melon", - "logo": "mln.jpg", - "erc20": true, - "tokenSymbol": "MLN", - "decimals": 18 - }, - "0xba2184520A1cC49a6159c57e61E1844E085615B6": { - "name": "HelloGold Token", - "logo": "hgt.png", - "erc20": true, - "tokenSymbol": "HGT", - "decimals": 8 - }, - "0xba358B6f5b4c0215650444B8C30D870B55050D2D": { - "name": "Hub Token", - "logo": "hub.svg", - "erc20": true, - "tokenSymbol": "HUB", - "decimals": 18 - }, - "0xeAb43193CF0623073Ca89DB9B712796356FA7414": { - "name": "GOLDX", - "logo": "goldx.png", - "erc20": true, - "tokenSymbol": "GOLDX", - "decimals": 18 - }, - "0x8727c112C712c4a03371AC87a74dD6aB104Af768": { - "name": "Jetcoin Institute Token", - "logo": "JETCOIN28.png", - "erc20": true, - "tokenSymbol": "JET", - "decimals": 18 - }, - "0xf8e386EDa857484f5a12e4B5DAa9984E06E73705": { - "name": "Indorse Token", - "logo": "indorseLogo.jpg", - "erc20": true, - "tokenSymbol": "IND", - "decimals": 18 - }, - "0xA54ddC7B3CcE7FC8b1E3Fa0256D0DB80D2c10970": { - "name": "NEVERDIE Coin", - "logo": "ndc.png", - "erc20": true, - "tokenSymbol": "NDC", - "decimals": 18 - }, - "0x1c4481750daa5Ff521A2a7490d9981eD46465Dbd": { - "name": "BlockMason Credit Protocol Token", - "logo": "bcpt.svg", - "erc20": true, - "tokenSymbol": "BCPT", - "decimals": 18 - }, - "0x20F7A3DdF244dc9299975b4Da1C39F8D5D75f05A": { - "name": "Sapien Network Token", - "logo": "spn.svg", - "erc20": true, - "tokenSymbol": "SPN", - "decimals": 6 - }, - "0xA4e8C3Ec456107eA67d3075bF9e3DF3A75823DB0": { - "name": "Loom Network Token", - "logo": "loom.svg", - "erc20": true, - "tokenSymbol": "LOOM", - "decimals": 18 - }, - "0x4F9254C83EB525f9FCf346490bbb3ed28a81C667": { - "name": "Celer Network Token", - "logo": "CELR.svg", - "erc20": true, - "tokenSymbol": "CELR", - "decimals": 18 - }, - "0x71D01dB8d6a2fBEa7f8d434599C237980C234e4C": { - "name": "Gladius", - "logo": "gladius.svg", - "erc20": true, - "tokenSymbol": "GLA", - "decimals": 8 - }, - "0xdd974D5C2e2928deA5F71b9825b8b646686BD200": { - "name": "Kyber Network Crystal", - "logo": "kyber.svg", - "erc20": true, - "tokenSymbol": "KNC", - "decimals": 18 - }, - "0x1F573D6Fb3F13d689FF844B4cE37794d79a7FF1C": { - "name": "Bancor Network Token", - "logo": "bancor.png", - "erc20": true, - "tokenSymbol": "BNT", - "decimals": 18 - }, - "0xfa05A73FfE78ef8f1a739473e462c54bae6567D9": { - "name": "Lunyr Token", - "logo": "lun.png", - "erc20": true, - "tokenSymbol": "LUN", - "decimals": 18 - }, - "0xC741f06082AA47F93729070aD0dD95E223Bda091": { - "name": "LEDU Token", - "logo": "edu.svg", - "erc20": true, - "tokenSymbol": "LEDU", - "decimals": 8 - }, - "0x5c543e7AE0A1104f78406C340E9C64FD9fCE5170": { - "name": "vSlice", - "logo": "vslice.png", - "erc20": true, - "tokenSymbol": "VSL", - "decimals": 18 - }, - "0x1f41E42D0a9e3c0Dd3BA15B527342783B43200A9": { - "name": "Blockchain Capital", - "logo": "bcap.svg", - "erc20": true, - "tokenSymbol": "BCAP", - "decimals": 0 - }, - "0x6531f133e6DeeBe7F2dcE5A0441aA7ef330B4e53": { - "name": "Chronobank TIME", - "logo": "chronobank.png", - "erc20": true, - "tokenSymbol": "TIME", - "decimals": 8 - }, - "0xE7775A6e9Bcf904eb39DA2b68c5efb4F9360e08C": { - "name": "Token-as-a-Service", - "logo": "taas-ico.png", - "erc20": true, - "tokenSymbol": "TAAS", - "decimals": 6 - }, - "0xaAAf91D9b90dF800Df4F55c205fd6989c977E73a": { - "name": "Monolith TKN", - "logo": "tkn.svg", - "erc20": true, - "tokenSymbol": "TKN", - "decimals": 8 - }, - "0x08711D3B02C8758F2FB3ab4e80228418a7F8e39c": { - "name": "Edgeless", - "logo": "edgeless.jpg", - "erc20": true, - "tokenSymbol": "EDG", - "decimals": 0 - }, - "0xf7B098298f7C69Fc14610bf71d5e02c60792894C": { - "name": "Guppy", - "logo": "guppy.png", - "erc20": true, - "tokenSymbol": "GUP", - "decimals": 3 - }, - "0x4DF812F6064def1e5e029f1ca858777CC98D2D81": { - "name": "Xaurum", - "logo": "xaurum_logo.svg", - "erc20": true, - "tokenSymbol": "XAUR", - "decimals": 8 - }, - "0xB9e7F8568e08d5659f5D29C4997173d84CdF2607": { - "name": "Swarm City Token", - "logo": "swt.jpg", - "erc20": true, - "tokenSymbol": "SWT", - "decimals": 18 - }, - "0xCb94be6f13A1182E4A4B6140cb7bf2025d28e41B": { - "name": "Trustcoin", - "logo": "trustcoin.jpg", - "erc20": true, - "tokenSymbol": "TRST", - "decimals": 6 - }, - "0xCB56b52316041A62B6b5D0583DcE4A8AE7a3C629": { - "name": "Cigarettes", - "logo": "cig.svg", - "erc20": true, - "tokenSymbol": "CIG", - "decimals": 18 - }, - "0x960b236A07cf122663c4303350609A66A7B288C0": { - "name": "Aragon Network Token v1", - "logo": "antv1.svg", - "erc20": true, - "tokenSymbol": "ANTv1", - "decimals": 18 - }, - "0x667088b212ce3d06a1b553a7221E1fD19000d9aF": { - "name": "WINGS", - "logo": "wings_logo.svg", - "erc20": true, - "tokenSymbol": "WINGS", - "decimals": 18 - }, - "0x16484d73Ac08d2355F466d448D2b79D2039F6EBB": { - "name": "KnoxsterCoin", - "logo": "FortKnoxster.svg", - "erc20": true, - "tokenSymbol": "FKX", - "decimals": 18 - }, - "0xAf30D2a7E90d7DC361c8C4585e9BB7D2F6f15bc7": { - "name": "FirstBlood Token", - "logo": "1st.svg", - "erc20": true, - "tokenSymbol": "1ST", - "decimals": 18 - }, - "0x607F4C5BB672230e8672085532f7e901544a7375": { - "name": "iExec RLC Token", - "logo": "rlc.svg", - "erc20": true, - "tokenSymbol": "RLC", - "decimals": 9 - }, - "0xaeC2E87E0A235266D9C5ADc9DEb4b2E29b54D009": { - "name": "SingularDTV", - "logo": "singulardtv.svg", - "erc20": true, - "tokenSymbol": "SNGLS", - "decimals": 0 - }, - "0x888666CA69E0f178DED6D75b5726Cee99A87D698": { - "name": "ICONOMI", - "logo": "iconomi.png", - "erc20": true, - "tokenSymbol": "ICN", - "decimals": 18 - }, - "0xE0B7927c4aF23765Cb51314A0E0521A9645F0E2A": { - "name": "Digix", - "logo": "DGD.png", - "erc20": true, - "tokenSymbol": "DGD", - "decimals": 9 - }, - "0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2": { - "name": "Maker", - "logo": "mkr.svg", - "erc20": true, - "tokenSymbol": "MKR", - "decimals": 18 - }, - "0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359": { - "name": "Sai Stablecoin v1.0", - "logo": "sai.svg", - "erc20": true, - "tokenSymbol": "SAI", - "decimals": 18 - }, - "0x6B175474E89094C44Da98b954EedeAC495271d0F": { - "name": "Dai Stablecoin", - "logo": "dai.svg", - "erc20": true, - "tokenSymbol": "DAI", - "decimals": 18 - }, - "0xC477D038d5420C6A9e0b031712f61c5120090de9": { - "name": "Boson Token", - "logo": "boson.svg", - "erc20": true, - "tokenSymbol": "BOSON", - "decimals": 18 - }, - "0xD46bA6D942050d489DBd938a2C909A5d5039A161": { - "name": "Ampleforth", - "logo": "ampl.svg", - "erc20": true, - "tokenSymbol": "AMPL", - "decimals": 9 - }, - "0xDF2C7238198Ad8B389666574f2d8bc411A4b7428": { - "name": "Mainframe Token", - "logo": "Mainframe.png", - "erc20": true, - "tokenSymbol": "MFT", - "decimals": 18 - }, - "0x0D8775F648430679A709E98d2b0Cb6250d2887EF": { - "name": "Basic Attention Token", - "logo": "bat.svg", - "erc20": true, - "tokenSymbol": "BAT", - "decimals": 18 - }, - "0x4D8fc1453a0F359e99c9675954e656D80d996FbF": { - "name": "BEE Token", - "logo": "bee_token.svg", - "erc20": true, - "tokenSymbol": "BEE", - "decimals": 18 - }, - "0x6810e776880C02933D47DB1b9fc05908e5386b96": { - "name": "Gnosis Token", - "logo": "gnosis.svg", - "erc20": true, - "tokenSymbol": "GNO", - "decimals": 18 - }, - "0x514910771AF9Ca656af840dff83E8264EcF986CA": { - "name": "Chainlink Token", - "logo": "chainlink.svg", - "erc20": true, - "tokenSymbol": "LINK", - "decimals": 18 - }, - "0xD8912C10681D8B21Fd3742244f44658dBA12264E": { - "name": "Pluton", - "logo": "plutus-god.svg", - "erc20": true, - "tokenSymbol": "PLU", - "decimals": 18 - }, - "0x1985365e9f78359a9B6AD760e32412f4a445E862": { - "name": "Reputation Old", - "logo": "rep.svg", - "erc20": true, - "tokenSymbol": "REP", - "decimals": 18 - }, - "0x221657776846890989a759BA2973e427DfF5C9bB": { - "name": "Reputation", - "logo": "repv2.svg", - "erc20": true, - "tokenSymbol": "REPv2", - "decimals": 18 - }, - "0xd0929d411954c47438dc1d871dd6081F5C5e149c": { - "name": "Refereum", - "logo": "rfr.svg", - "erc20": true, - "tokenSymbol": "RFR", - "decimals": 4 - }, - "0xb0866289e870D2efc282406cF4123Df6E5BcB652": { - "name": "NoFakeCoin", - "logo": "nfticon.png", - "erc20": true, - "tokenSymbol": "NFC", - "decimals": 18 - }, - "0x2C4e8f2D746113d0696cE89B35F0d8bF88E0AEcA": { - "name": "Open Simple Token", - "logo": "OST.svg", - "erc20": true, - "tokenSymbol": "OST", - "decimals": 18 - }, - "0x408e41876cCCDC0F92210600ef50372656052a38": { - "name": "Republic Token", - "logo": "ren.svg", - "erc20": true, - "tokenSymbol": "REN", - "decimals": 18 - }, - "0xEB4C2781e4ebA804CE9a9803C67d0893436bB27D": { - "name": "renBTC", - "logo": "renBTC.svg", - "erc20": true, - "tokenSymbol": "renBTC", - "decimals": 8 - }, - "0x1C5db575E2Ff833E46a2E9864C22F4B22E0B37C2": { - "name": "renZEC", - "logo": "renZEC.svg", - "erc20": true, - "tokenSymbol": "renZEC", - "decimals": 8 - }, - "0x459086F2376525BdCebA5bDDA135e4E9d3FeF5bf": { - "name": "renBCH", - "logo": "renBCH.svg", - "erc20": true, - "tokenSymbol": "renBCH", - "decimals": 8 - }, - "0xD5147bc8e386d91Cc5DBE72099DAC6C9b99276F5": { - "name": "renFIL", - "logo": "renFIL.svg", - "erc20": true, - "tokenSymbol": "renFIL", - "decimals": 18 - }, - "0xa74476443119A942dE498590Fe1f2454d7D4aC0d": { - "name": "Golem Network Token", - "logo": "golem.svg", - "erc20": true, - "tokenSymbol": "GNT", - "decimals": 18 - }, - "0x6888a16eA9792c15A4DCF2f6C623D055c8eDe792": { - "name": "Spectiv Signal Token", - "logo": "spectiv.svg", - "erc20": true, - "tokenSymbol": "SIG", - "decimals": 18 - }, - "0x9a642d6b3368ddc662CA244bAdf32cDA716005BC": { - "name": "Qtum", - "logo": "qtum_28.png", - "erc20": true, - "decimals": 18, - "tokenSymbol": "QTUM" - }, - "0x1234567461d3f8Db7496581774Bd869C83D51c93": { - "name": "BitClave", - "logo": "bitclave.svg", - "erc20": true, - "decimals": 18, - "tokenSymbol": "CAT" - }, - "0x7d4b8Cce0591C9044a22ee543533b72E976E36C3": { - "name": "Change", - "logo": "change.svg", - "erc20": true, - "decimals": 18, - "tokenSymbol": "CAG" - }, - "0x1d462414fe14cf489c7A21CaC78509f4bF8CD7c0": { - "name": "CanYaCoin", - "logo": "CanYa.svg", - "erc20": true, - "decimals": 6, - "tokenSymbol": "CAN" - }, - "0xC18360217D8F7Ab5e7c516566761Ea12Ce7F9D72": { - "name": "Ethereum Name Service", - "logo": "ens.svg", - "erc20": true, - "decimals": 18, - "tokenSymbol": "ENS" - }, - "0x3d1BA9be9f66B8ee101911bC36D3fB562eaC2244": { - "name": "Rivetz", - "logo": "rivetz.png", - "erc20": true, - "decimals": 18, - "tokenSymbol": "RVT" - }, - "0x056017c55aE7AE32d12AeF7C679dF83A85ca75Ff": { - "name": "Project Wyvern Token", - "logo": "wyvern-logo.svg", - "erc20": true, - "tokenSymbol": "WYV", - "decimals": 18 - }, - "0xfec0cF7fE078a500abf15F1284958F22049c2C7e": { - "name": "Maecenas ART Token", - "logo": "Maecenas.jpg", - "erc20": true, - "tokenSymbol": "ART", - "decimals": 18 - }, - "0x05f4a42e251f2d52b8ed15E9FEdAacFcEF1FAD27": { - "name": "Zilliqa", - "logo": "zilliqa.svg", - "erc20": true, - "tokenSymbol": "ZIL", - "decimals": 12 - }, - "0x986EE2B944c42D017F52Af21c4c69B84DBeA35d8": { - "name": "BitMartToken", - "logo": "bitmart.png", - "erc20": true, - "tokenSymbol": "BMX", - "decimals": 18 - }, - "0x2af47a65da8CD66729b4209C22017d6A5C2d2400": { - "name": "StandardBounties", - "logo": "StandardBounties.png" - }, - "0xF03f8D65BaFA598611C3495124093c56e8F638f0": { - "name": "Viewly", - "logo": "viewly.svg", - "erc20": true, - "tokenSymbol": "VIEW", - "decimals": 18 - }, - "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2": { - "name": "Wrapped Ether", - "logo": "weth.png", - "erc20": true, - "tokenSymbol": "WETH", - "decimals": 18 - }, - "0xba5BDe662c17e2aDFF1075610382B9B691296350": { - "name": "SuperRare Token", - "logo": "rare.svg", - "erc20": true, - "tokenSymbol": "RARE", - "decimals": 18 - }, - "0x6C8c6b02E7b2BE14d4fA6022Dfd6d75921D90E4E": { - "name": "Compound Basic Attention Token", - "logo": "ctoken-bat.svg", - "erc20": true, - "tokenSymbol": "cBAT", - "decimals": 8 - }, - "0x70e36f6BF80a52b3B46b3aF8e106CC0ed743E8e4": { - "name": "Compound Collateral", - "logo": "ctoken-comp.svg", - "erc20": true, - "tokenSymbol": "cCOMP", - "decimals": 8 - }, - "0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643": { - "name": "Compound Dai", - "logo": "ctoken-dai.svg", - "erc20": true, - "tokenSymbol": "cDAI", - "decimals": 8 - }, - "0xF5DCe57282A584D2746FaF1593d3121Fcac444dC": { - "name": "Compound Sai (Legacy Dai)", - "logo": "ctoken-sai.svg", - "erc20": true, - "tokenSymbol": "cSAI", - "decimals": 8 - }, - "0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5": { - "name": "Compound Ether", - "logo": "ctoken-eth.svg", - "erc20": true, - "tokenSymbol": "cETH", - "decimals": 8 - }, - "0x158079Ee67Fce2f58472A96584A73C7Ab9AC95c1": { - "name": "Compound Augur", - "logo": "ctoken-rep.svg", - "erc20": true, - "tokenSymbol": "cREP", - "decimals": 8 - }, - "0x39AA39c021dfbaE8faC545936693aC917d5E7563": { - "name": "Compound USD Coin", - "logo": "ctoken-usdc.svg", - "erc20": true, - "tokenSymbol": "cUSDC", - "decimals": 8 - }, - "0xf650C3d88D12dB855b8bf7D11Be6C55A4e07dCC9": { - "name": "Compound Tether", - "logo": "ctoken-usdt.svg", - "erc20": true, - "tokenSymbol": "cUSDT", - "decimals": 8 - }, - "0xC11b1268C1A384e55C48c2391d8d480264A3A7F4": { - "name": "Compound Wrapped BTC", - "logo": "ctoken-wbtc.svg", - "erc20": true, - "tokenSymbol": "cWBTC", - "decimals": 8 - }, - "0xB3319f5D18Bc0D84dD1b4825Dcde5d5f7266d407": { - "name": "Compound 0x", - "logo": "ctoken-zrx.svg", - "erc20": true, - "tokenSymbol": "cZRX", - "decimals": 8 - }, - "0xc00e94Cb662C3520282E6f5717214004A7f26888": { - "name": "Compound", - "logo": "comp.svg", - "erc20": true, - "tokenSymbol": "COMP", - "decimals": 18 - }, - "0xFFE02ee4C69eDf1b340fCaD64fbd6b37a7b9e265": { - "name": "NANJCOIN", - "logo": "nanjcoin.svg", - "erc20": true, - "tokenSymbol": "NANJ", - "decimals": 8 - }, - "0xB6eD7644C69416d67B522e20bC294A9a9B405B31": { - "name": "0xBitcoin Token", - "logo": "0xbitcoin.svg", - "erc20": true, - "tokenSymbol": "0xBTC", - "decimals": 8 - }, - "0x744d70FDBE2Ba4CF95131626614a1763DF805B9E": { - "name": "Status Network Token", - "logo": "snt.svg", - "erc20": true, - "tokenSymbol": "SNT", - "decimals": 18 - }, - "0x42d6622deCe394b54999Fbd73D108123806f6a18": { - "name": "SPANK", - "logo": "SPANK.png", - "erc20": true, - "tokenSymbol": "SPANK", - "decimals": 18 - }, - "0x6B01c3170ae1EFEBEe1a3159172CB3F7A5ECf9E5": { - "name": "BOOTY", - "logo": "booty.png", - "erc20": true, - "tokenSymbol": "BOOTY", - "decimals": 18 - }, - "0x4a6058666cf1057eaC3CD3A5a614620547559fc9": { - "name": "Brickblock", - "logo": "Brickblock.svg", - "erc20": true, - "tokenSymbol": "BBK", - "decimals": 18 - }, - "0x80fB784B7eD66730e8b1DBd9820aFD29931aab03": { - "name": "ETHLend Token", - "logo": "lend.svg", - "erc20": true, - "tokenSymbol": "LEND", - "decimals": 18 - }, - "0x48FF53777F747cFB694101222a944dE070c15D36": { - "name": "Ether Kingdoms Token", - "logo": "IMP.svg", - "erc20": true, - "tokenSymbol": "IMP", - "decimals": 7 - }, - "0x02F61Fd266DA6E8B102D4121f5CE7b992640CF98": { - "name": "LikeCoin", - "logo": "like.svg", - "erc20": true, - "tokenSymbol": "LIKE", - "decimals": 18 - }, - "0xB8c77482e45F1F44dE1745F52C74426C631bDD52": { - "name": "Binance Coin", - "logo": "bnb.png", - "erc20": true, - "tokenSymbol": "BNB", - "decimals": 18 - }, - "0xD850942eF8811f2A866692A623011bDE52a462C1": { - "name": "VeChain", - "logo": "ven.svg", - "erc20": true, - "tokenSymbol": "VEN", - "decimals": 18 - }, - "0xb5A5F22694352C15B00323844aD545ABb2B11028": { - "name": "ICON", - "logo": "icon-icx-logo.png", - "erc20": true, - "tokenSymbol": "ICX", - "decimals": 18 - }, - "0x91Af0fBB28ABA7E31403Cb457106Ce79397FD4E6": { - "name": "Aergo", - "logo": "Aergo.svg", - "erc20": true, - "tokenSymbol": "AERGO", - "decimals": 18 - }, - "0x5CA9a71B1d01849C0a95490Cc00559717fCF0D1d": { - "name": "Aeternity", - "logo": "aeternity.svg", - "erc20": true, - "tokenSymbol": "AE", - "decimals": 18 - }, - "0xd4fa1460F537bb9085d22C7bcCB5DD450Ef28e3a": { - "name": "Populous", - "logo": "FEATURED.POP_.png", - "erc20": true, - "tokenSymbol": "PPT", - "decimals": 8 - }, - "0xFA1a856Cfa3409CFa145Fa4e20Eb270dF3EB21ab": { - "name": "IOST", - "logo": "iost.png", - "erc20": true, - "tokenSymbol": "IOST", - "decimals": 18 - }, - "0x039B5649A59967e3e936D7471f9c3700100Ee1ab": { - "name": "Kucoin Shares", - "logo": "kucoin.svg", - "erc20": true, - "tokenSymbol": "KCS", - "decimals": 6 - }, - "0x3893b9422Cd5D70a81eDeFfe3d5A1c6A978310BB": { - "name": "Mithril", - "logo": "mithril-featured.png", - "erc20": true, - "tokenSymbol": "MITH", - "decimals": 18 - }, - "0xb7cB1C96dB6B22b0D3d9536E0108d062BD488F74": { - "name": "Walton", - "logo": "waltonchain.png", - "erc20": true, - "tokenSymbol": "WTC", - "decimals": 18 - }, - "0x1776e1F26f98b1A5dF9cD347953a26dd3Cb46671": { - "name": "Numeraire", - "logo": "nmr.png", - "erc20": true, - "tokenSymbol": "NMR", - "decimals": 18 - }, - "0x056Fd409E1d7A124BD7017459dFEa2F387b6d5Cd": { - "name": "Gemini Dollar", - "logo": "gusd.svg", - "erc20": true, - "tokenSymbol": "GUSD", - "decimals": 2 - }, - "0xA4Bdb11dc0a2bEC88d24A3aa1E6Bb17201112eBe": { - "name": "StableUSD", - "logo": "usds.svg", - "erc20": true, - "tokenSymbol": "USDS", - "decimals": 6 - }, - "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48": { - "name": "USD Coin", - "logo": "usdc.svg", - "erc20": true, - "tokenSymbol": "USDC", - "decimals": 6 - }, - "0x93ED3FBe21207Ec2E8f2d3c3de6e058Cb73Bc04d": { - "name": "Pinakion Token", - "logo": "pinakion.svg", - "erc20": true, - "tokenSymbol": "PNK", - "decimals": 18 - }, - "0x419D0d8BdD9aF5e606Ae2232ed285Aff190E711b": { - "name": "FunFair", - "logo": "fun.svg", - "erc20": true, - "tokenSymbol": "FUN", - "decimals": 8 - }, - "0xcA2796F9F61dc7b238Aab043971e49c6164DF375": { - "name": "YGGDRASH YEED Token", - "logo": "yggdrash.svg", - "erc20": true, - "tokenSymbol": "YEED", - "decimals": 18 - }, - "0x03e3f0c25965f13DbbC58246738C183E27b26a56": { - "name": "Disciplina Token", - "logo": "disciplina.svg", - "erc20": true, - "tokenSymbol": "DSCP", - "decimals": 18 - }, - "0xE814aeE960a85208C3dB542C53E7D4a6C8D5f60F": { - "name": "Chronologic DAY Token", - "logo": "DAY.png", - "erc20": true, - "tokenSymbol": "DAY", - "decimals": 18 - }, - "0x7E43581b19ab509BCF9397a2eFd1ab10233f27dE": { - "name": "PLATINUM", - "logo": "plat.png", - "erc20": true, - "tokenSymbol": "PLAT", - "decimals": 18 - }, - "0x8E870D67F660D95d5be530380D0eC0bd388289E1": { - "name": "Pax Dollar", - "logo": "usdp.svg", - "erc20": true, - "tokenSymbol": "USDP", - "decimals": 18 - }, - "0x45804880De22913dAFE09f4980848ECE6EcbAf78": { - "name": "PAX Gold", - "logo": "paxg.svg", - "erc20": true, - "tokenSymbol": "PAXG", - "decimals": 18 - }, - "0x0000000000085d4780B73119b644AE5ecd22b376": { - "name": "TrueUSD", - "logo": "TUSD.svg", - "erc20": true, - "tokenSymbol": "TUSD", - "decimals": 18 - }, - "0x4Fabb145d64652a948d72533023f6E7A623C7C53": { - "name": "Binance USD", - "logo": "busd.svg", - "erc20": true, - "tokenSymbol": "BUSD", - "decimals": 18 - }, - "0x23Ccc43365D9dD3882eab88F43d515208f832430": { - "name": "MidasProtocol", - "logo": "MAS.png", - "erc20": true, - "tokenSymbol": "MAS", - "decimals": 18 - }, - "0xC16b542ff490e01fcc0DC58a60e1EFdc3e357cA6": { - "name": "ICE ROCK MINING", - "logo": "rock2.png", - "erc20": true, - "tokenSymbol": "ROCK2", - "decimals": 0 - }, - "0x6758B7d441a9739b98552B373703d8d3d14f9e62": { - "name": "POA20 Token", - "logo": "POA20.png", - "erc20": true, - "tokenSymbol": "POA20", - "decimals": 18 - }, - "0x3DB6Ba6ab6F95efed1a6E794caD492fAAabF294D": { - "name": "LTO Network Token (old)", - "logo": "LTO.svg", - "erc20": true, - "tokenSymbol": "LTOOLD", - "decimals": 8 - }, - "0xd01409314aCb3b245CEa9500eCE3F6Fd4d70ea30": { - "name": "LTO Network Token", - "logo": "LTO.svg", - "erc20": true, - "tokenSymbol": "LTO", - "decimals": 8 - }, - "0xfeF4185594457050cC9c23980d301908FE057Bb1": { - "name": "VIDT Datalink", - "logo": "VIDT.svg", - "erc20": true, - "tokenSymbol": "VIDT", - "decimals": 18 - }, - "0x7064aAb39A0Fcf7221c3396719D0917a65E35515": { - "name": "Cpollo", - "logo": "Cpollo.svg", - "erc20": true, - "tokenSymbol": "CPLO", - "decimals": 18 - }, - "0xd8446236FA95b9b5f9fd0f8E7Df1a944823c683d": { - "name": "NEEO", - "logo": "neeo.png", - "erc20": true, - "tokenSymbol": "NEEO", - "decimals": 18 - }, - "0xA823E6722006afe99E91c30FF5295052fe6b8E32": { - "name": "Neumark", - "logo": "neu.svg", - "erc20": true, - "tokenSymbol": "NEU", - "decimals": 18 - }, - "0x8f693ca8D21b157107184d29D398A8D082b38b76": { - "name": "Streamr", - "logo": "streamr.svg", - "erc20": true, - "tokenSymbol": "DATA", - "decimals": 18 - }, - "0x0Cf0Ee63788A0849fE5297F3407f701E122cC023": { - "name": "Streamr (old)", - "logo": "streamr_old.svg", - "erc20": true, - "tokenSymbol": "XDATA", - "decimals": 18 - }, - "0xA0b73E1Ff0B80914AB6fe0444E65848C4C34450b": { - "name": "Crypto.com Chain", - "logo": "CRO.png", - "erc20": true, - "tokenSymbol": "CRO", - "decimals": 8 - }, - "0xF70a642bD387F94380fFb90451C2c81d4Eb82CBc": { - "name": "STAR", - "logo": "starbase.png", - "erc20": true, - "tokenSymbol": "STAR", - "decimals": 18 - }, - "0x7C5A0CE9267ED19B22F8cae653F198e3E8daf098": { - "name": "Santiment", - "logo": "santiment.svg", - "erc20": true, - "tokenSymbol": "SAN", - "decimals": 18 - }, - "0x58b6A8A3302369DAEc383334672404Ee733aB239": { - "name": "Livepeer", - "logo": "livepeer.png", - "erc20": true, - "tokenSymbol": "LPT", - "decimals": 18 - }, - "0x6fe56C0bcdD471359019FcBC48863d6c3e9d4F41": { - "name": "Props", - "logo": "props.png", - "erc20": true, - "tokenSymbol": "PROPS", - "decimals": 18 - }, - "0x6c6EE5e31d828De241282B9606C8e98Ea48526E2": { - "name": "HoloToken", - "logo": "holotoken.png", - "erc20": true, - "tokenSymbol": "HOT", - "decimals": 18 - }, - "0xF629cBd94d3791C9250152BD8dfBDF380E2a3B9c": { - "name": "Enjin Coin", - "logo": "enj.svg", - "erc20": true, - "tokenSymbol": "ENJ", - "decimals": 18 - }, - "0xbf2179859fc6D5BEE9Bf9158632Dc51678a4100e": { - "name": "AELF", - "logo": "aelf.png", - "erc20": true, - "tokenSymbol": "ELF", - "decimals": 18 - }, - "0x39Bb259F66E1C59d5ABEF88375979b4D20D98022": { - "name": "Wax", - "logo": "wax.png", - "erc20": true, - "tokenSymbol": "WAX", - "decimals": 8 - }, - "0x595832F8FC6BF59c85C527fEC3740A1b7a361269": { - "name": "PowerLedger", - "logo": "power.png", - "erc20": true, - "tokenSymbol": "POWR", - "decimals": 6 - }, - "0x28dee01D53FED0Edf5f6E310BF8Ef9311513Ae40": { - "name": "BlitzPredict", - "logo": "blitzpredict.svg", - "erc20": true, - "tokenSymbol": "XBP", - "decimals": 18 - }, - "0x33349B282065b0284d756F0577FB39c158F935e6": { - "name": "Maple Finance", - "logo": "maple-finance.svg", - "erc20": true, - "erc721": false, - "tokenSymbol": "MPL", - "decimals": 18 - }, - "0xFBeef911Dc5821886e1dda71586d90eD28174B7d": { - "name": "KnownOrigin", - "logo": "knownorigin.svg", - "erc20": true, - "tokenSymbol": "KODA", - "decimals": 0 - }, - "0x8207c1FfC5B6804F6024322CcF34F29c3541Ae26": { - "name": "Origin Protocol", - "logo": "originprotocol.png", - "erc20": true, - "tokenSymbol": "OGN", - "decimals": 18 - }, - "0x2A8e1E676Ec238d8A992307B495b45B3fEAa5e86": { - "name": "Origin Dollar", - "logo": "ousd.svg", - "erc20": true, - "tokenSymbol": "OUSD", - "decimals": 18 - }, - "0x9c354503C38481a7A7a51629142963F98eCC12D0": { - "name": "Origin Dollar Governance", - "logo": "ogv.svg", - "erc20": true, - "tokenSymbol": "OGV", - "decimals": 18 - }, - "0x0C4576Ca1c365868E162554AF8e385dc3e7C66D9": { - "name": "Vote Escrowed Origin Dollar Governance", - "logo": "veogv.svg", - "erc20": true, - "tokenSymbol": "veOGV", - "decimals": 18 - }, - "0x8f8221aFbB33998d8584A2B05749bA73c37a938a": { - "name": "Request", - "logo": "request.svg", - "erc20": true, - "tokenSymbol": "REQ", - "decimals": 18 - }, - "0x2aEa4Add166EBf38b63d09a75dE1a7b94Aa24163": { - "name": "Kudos", - "logo": "kudos.svg", - "erc20": false, - "erc721": true, - "tokenSymbol": "KDO", - "decimals": 0 - }, - "0x14C926F2290044B647e1Bf2072e67B495eff1905": { - "name": "Bethereum", - "logo": "bether.jpg", - "erc20": true, - "tokenSymbol": "BETHER", - "decimals": 18 - }, - "0x9AAb071B4129B083B01cB5A0Cb513Ce7ecA26fa5": { - "name": "Hunt Token", - "logo": "hunt.png", - "erc20": true, - "tokenSymbol": "HUNT", - "decimals": 18 - }, - "0xFEF3884b603C33EF8eD4183346E093A173C94da6": { - "name": "Metamorph", - "logo": "metamorph.svg", - "erc20": true, - "tokenSymbol": "METM", - "decimals": 18 - }, - "0x0AbdAce70D3790235af448C88547603b945604ea": { - "name": "district0x", - "logo": "district0x.svg", - "erc20": true, - "tokenSymbol": "DNT", - "decimals": 18 - }, - "0x0C6144c16af288948C8fdB37fD8fEc94bfF3d1d9": { - "name": "Neutral Dollar", - "logo": "neutraldollar.png", - "erc20": true, - "tokenSymbol": "NUSD", - "decimals": 6 - }, - "0xB26631c6dda06aD89B93C71400D25692de89c068": { - "name": "Minds", - "logo": "minds.svg", - "erc20": true, - "tokenSymbol": "MINDS", - "decimals": 18 - }, - "0xBb1f24C0c1554b9990222f036b0AaD6Ee4CAec29": { - "name": "CryptoSoul", - "logo": "SOUL.svg", - "erc20": true, - "tokenSymbol": "SOUL", - "decimals": 18 - }, - "0xFF0E5e014cf97e0615cb50F6f39Da6388E2FaE6E": { - "name": "Origo", - "logo": "origo.svg", - "erc20": true, - "tokenSymbol": "OGO", - "decimals": 18 - }, - "0x0cB8D0B37C7487b11d57F1f33dEfA2B1d3cFccfE": { - "name": "DANKToken", - "logo": "dank-logo.svg", - "erc20": true, - "tokenSymbol": "DANK", - "decimals": 18 - }, - "0x3a4f40631a4f906c2BaD353Ed06De7A5D3fCb430": { - "name": "PlayDapp Token", - "logo": "playdapp.svg", - "erc20": true, - "tokenSymbol": "PLA", - "decimals": 18 - }, - "0xE9e3F9cfc1A64DFca53614a0182CFAD56c10624F": { - "name": "Su Squares", - "logo": "Su-Squares.svg", - "erc20": false, - "erc721": true, - "tokenSymbol": "SU", - "decimals": 0 - }, - "0xfA5047c9c78B8877af97BDcb85Db743fD7313d4a": { - "name": "ROOK", - "logo": "Rook.svg", - "erc20": true, - "tokenSymbol": "ROOK", - "decimals": 18 - }, - "0xbE9375C6a420D2eEB258962efB95551A5b722803": { - "name": "StormX Token", - "logo": "stormx.svg", - "erc20": true, - "tokenSymbol": "STMX", - "decimals": 18 - }, - "0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0": { - "name": "Matic Network Token", - "logo": "matic-network-logo.svg", - "erc20": true, - "tokenSymbol": "MATIC", - "decimals": 18 - }, - "0x9992eC3cF6A55b00978cdDF2b27BC6882d88D1eC": { - "name": "Polymath", - "logo": "polymath_logo.svg", - "erc20": true, - "tokenSymbol": "POLY", - "decimals": 18 - }, - "0x0a50C93c762fDD6E56D86215C24AaAD43aB629aa": { - "name": "LGO Token", - "logo": "lgo.png", - "erc20": true, - "tokenSymbol": "LGO", - "decimals": 8 - }, - "0xc8Cac7672f4669685817cF332a33Eb249F085475": { - "name": "LivenCoin", - "logo": "LVN.svg", - "erc20": true, - "tokenSymbol": "LVN", - "decimals": 18 - }, - "0xBBbbCA6A901c926F240b89EacB641d8Aec7AEafD": { - "name": "Loopring", - "logo": "LRC.svg", - "erc20": true, - "tokenSymbol": "LRC", - "decimals": 18 - }, - "0x255Aa6DF07540Cb5d3d297f0D0D4D84cb52bc8e6": { - "name": "Raiden Network Token", - "logo": "raiden.svg", - "erc20": true, - "tokenSymbol": "RDN", - "decimals": 18 - }, - "0x66fD97a78d8854fEc445cd1C80a07896B0b4851f": { - "name": "Lunch Money", - "logo": "LMY.svg", - "erc20": true, - "tokenSymbol": "LMY", - "decimals": 18 - }, - "0x679131F591B4f369acB8cd8c51E68596806c3916": { - "name": "Trustlines Network Token", - "logo": "TLN128.png", - "erc20": true, - "tokenSymbol": "TLN", - "decimals": 18 - }, - "0xdcD85914b8aE28c1E62f1C488E1D968D5aaFfE2b": { - "name": "TOP Network Token", - "logo": "TOP.svg", - "erc20": true, - "tokenSymbol": "TOP", - "decimals": 18 - }, - "0xaea46A60368A7bD060eec7DF8CBa43b7EF41Ad85": { - "name": "Fetch", - "logo": "fetch.svg", - "erc20": true, - "tokenSymbol": "FET", - "decimals": 18 - }, - "0x2e1E15C44Ffe4Df6a0cb7371CD00d5028e571d14": { - "name": "Mettalex", - "logo": "mettalex.svg", - "erc20": true, - "tokenSymbol": "MTLX", - "decimals": 18 - }, - "0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984": { - "name": "Uniswap", - "logo": "uni.svg", - "erc20": true, - "tokenSymbol": "UNI", - "decimals": 18 - }, - "0x2e6539edc3b76f1E21B71d214527FAbA875F70F3": { - "name": "Yearn Finance Dot", - "logo": "YFDOT.svg", - "erc20": true, - "tokenSymbol": "YFDOT", - "decimals": 18 - }, - "0x9F284E1337A815fe77D2Ff4aE46544645B20c5ff": { - "name": "Darwinia Commitment Token", - "logo": "kton.svg", - "erc20": true, - "tokenSymbol": "KTON", - "decimals": 18 - }, - "0xE48972fCd82a274411c01834e2f031D4377Fa2c0": { - "name": "TwoKeyEconomy", - "logo": "2key.svg", - "erc20": true, - "tokenSymbol": "2KEY", - "decimals": 18 - }, - "0x970B9bB2C0444F5E81e9d0eFb84C8ccdcdcAf84d": { - "name": "Fuse Token", - "logo": "fuse.svg", - "erc20": true, - "tokenSymbol": "FUSE", - "decimals": 18 - }, - "0x0Ae055097C6d159879521C384F1D2123D1f195e6": { - "name": "STAKE Token", - "logo": "stake.png", - "erc20": true, - "tokenSymbol": "STAKE", - "decimals": 18 - }, - "0x5dc60C4D5e75D22588FA17fFEB90A63E535efCE0": { - "name": "dKargo", - "logo": "DKA.svg", - "erc20": true, - "tokenSymbol": "DKA", - "decimals": 18 - }, - "0x9469D013805bFfB7D3DEBe5E7839237e535ec483": { - "name": "Darwinia Network Native Token", - "logo": "ring.svg", - "erc20": true, - "tokenSymbol": "RING", - "decimals": 18 - }, - "0xA31B1767e09f842ECFd4bc471Fe44F830E3891AA": { - "name": "ROOBEE", - "logo": "ROOBEE.svg", - "erc20": true, - "tokenSymbol": "ROOBEE", - "decimals": 18 - }, - "0xC7e43A1c8E118aA2965F5EAbe0e718D83DB7A63C": { - "name": "ZCore Token", - "logo": "zcrt.svg", - "erc20": true, - "tokenSymbol": "ZCRT", - "decimals": 18 - }, - "0x08d32b0da63e2C3bcF8019c9c5d849d7a9d791e6": { - "name": "Dentacoin Token", - "logo": "dcn.svg", - "erc20": true, - "tokenSymbol": "DCN", - "decimals": 0 - }, - "0xe2f2a5C287993345a840Db3B0845fbC70f5935a5": { - "name": "mStable USD", - "logo": "mUSD.svg", - "erc20": true, - "tokenSymbol": "mUSD", - "decimals": 18 - }, - "0xa3BeD4E1c75D00fa6f4E5E6922DB7261B5E9AcD2": { - "name": "Meta", - "logo": "MTA.svg", - "erc20": true, - "tokenSymbol": "MTA", - "decimals": 18 - }, - "0xe3818504c1B32bF1557b16C238B2E01Fd3149C17": { - "name": "Pillar", - "logo": "plr.svg", - "erc20": true, - "tokenSymbol": "PLR", - "decimals": 18 - }, - "0xba100000625a3754423978a60c9317c58a424e3D": { - "name": "Balancer (BAL)", - "logo": "balancer.svg", - "erc20": true, - "tokenSymbol": "BAL", - "decimals": 18 - }, - "0x8a854288a5976036A725879164Ca3e91d30c6A1B": { - "name": "Guaranteed Entrance Token", - "logo": "get-logo.svg", - "erc20": true, - "tokenSymbol": "GET", - "decimals": 18 - }, - "0x2781246fe707bB15CeE3e5ea354e2154a2877B16": { - "name": "Elysia", - "logo": "el.svg", - "erc20": true, - "tokenSymbol": "EL", - "decimals": 18 - }, - "0xc12d099be31567add4e4e4d0D45691C3F58f5663": { - "name": "Auctus", - "logo": "auc.svg", - "erc20": true, - "tokenSymbol": "AUC", - "decimals": 18 - }, - "0xdF574c24545E5FfEcb9a659c229253D4111d87e1": { - "name": "HUSD", - "logo": "HUSD.svg", - "erc20": true, - "tokenSymbol": "HUSD", - "decimals": 8 - }, - "0x2ecB13A8c458c379c4d9a7259e202De03c8F3D19": { - "name": "Block-Chain.com Token", - "logo": "block-chain.svg", - "erc20": true, - "tokenSymbol": "BC", - "decimals": 18 - }, - "0x38e4adB44ef08F22F5B5b76A8f0c2d0dCbE7DcA1": { - "name": "Concentrated Voting Power", - "logo": "PowerPool.svg", - "erc20": true, - "tokenSymbol": "CVP", - "decimals": 18 - }, - "0xa117000000f279D81A1D3cc75430fAA017FA5A2e": { - "name": "Aragon Network Token", - "logo": "antv2.svg", - "erc20": true, - "tokenSymbol": "ANT", - "decimals": 18 - }, - "0xDecade1c6Bf2cD9fb89aFad73e4a519C867adcF5": { - "name": "Experty Wisdom Token", - "logo": "wisdom-token.svg", - "erc20": true, - "tokenSymbol": "WIS", - "decimals": 18 - }, - "0x7D85e23014F84E6E21d5663aCD8751bEF3562352": { - "name": "Axion Old", - "logo": "obsolete.svg", - "erc20": true, - "tokenSymbol": "AXNv1", - "decimals": 18 - }, - "0x358AA737e033F34df7c54306960a38d09AaBd523": { - "name": "Ares Token", - "logo": "ares.svg", - "erc20": true, - "tokenSymbol": "ARES", - "decimals": 18 - }, - "0xB62132e35a6c13ee1EE0f84dC5d40bad8d815206": { - "name": "NEXO", - "logo": "NEXO.svg", - "erc20": true, - "tokenSymbol": "NEXO", - "decimals": 18 - }, - "0x4612021C75809160Be60DB21fBc9D6adD0B32deF": { - "name": "BCP Coin", - "logo": "BCP.svg", - "erc20": true, - "tokenSymbol": "BCP", - "decimals": 18 - }, - "0xE9E73E1aE76D17A16cC53E3e87a9a7dA78834d37": { - "name": "Camp", - "logo": "Camp.svg", - "erc20": true, - "tokenSymbol": "CAMP", - "decimals": 18 - }, - "0xdacD69347dE42baBfAEcD09dC88958378780FB62": { - "name": "Atari Token", - "logo": "atrilast.svg", - "erc20": true, - "tokenSymbol": "ATRI", - "decimals": 0 - }, - "0x71F85B2E46976bD21302B64329868fd15eb0D127": { - "name": "Axion", - "logo": "axion.svg", - "erc20": true, - "tokenSymbol": "AXN", - "decimals": 18 - }, - "0xc944E90C64B2c07662A292be6244BDf05Cda44a7": { - "name": "Graph Token", - "logo": "graphToken.svg", - "erc20": true, - "tokenSymbol": "GRT", - "decimals": 18 - }, - "0xFE3E6a25e6b192A42a44ecDDCd13796471735ACf": { - "name": "Reef Finance", - "logo": "reef.svg", - "erc20": true, - "tokenSymbol": "REEF", - "decimals": 18 - }, - "0x43Dfc4159D86F3A37A5A4B3D4580b888ad7d4DDd": { - "name": "DODO bird", - "logo": "DODO.svg", - "erc20": true, - "tokenSymbol": "DODO", - "decimals": 18 - }, - "0x4a615bB7166210CCe20E6642a6f8Fb5d4D044496": { - "name": "NAOS Finance", - "logo": "naos.svg", - "erc20": true, - "tokenSymbol": "NAOS", - "decimals": 18 - }, - "0x111111111117dC0aa78b770fA6A738034120C302": { - "name": "1INCH Token", - "logo": "1inch.svg", - "erc20": true, - "tokenSymbol": "1INCH", - "decimals": 18 - }, - "0x27702a26126e0B3702af63Ee09aC4d1A084EF628": { - "name": "Aleph.im Token", - "logo": "aleph.svg", - "erc20": true, - "tokenSymbol": "ALEPH", - "decimals": 18 - }, - "0x32a7C02e79c4ea1008dD6564b35F131428673c41": { - "name": "CRUST", - "logo": "crust.svg", - "erc20": true, - "tokenSymbol": "CRU", - "decimals": 18 - }, - "0x3472A5A71965499acd81997a54BBA8D852C6E53d": { - "name": "BADGER", - "logo": "badger.svg", - "erc20": true, - "tokenSymbol": "BADGER", - "decimals": 18 - }, - "0x65Def5029A0e7591e46B38742bFEdd1Fb7b24436": { - "name": "Kanpeki", - "logo": "kanpeki-green.svg", - "erc20": true, - "tokenSymbol": "KAE", - "decimals": 18 - }, - "0xDcB01cc464238396E213a6fDd933E36796eAfF9f": { - "name": "Yield", - "logo": "yield-logo.svg", - "erc20": true, - "tokenSymbol": "YLD", - "decimals": 18 - }, - "0x968F6f898a6Df937fC1859b323aC2F14643e3fED": { - "name": "Newscrypto", - "logo": "NWC.svg", - "erc20": true, - "tokenSymbol": "NWC", - "decimals": 18 - }, - "0xeb269732ab75A6fD61Ea60b06fE994cD32a83549": { - "name": "dForce USDx", - "logo": "USDx.svg", - "erc20": true, - "tokenSymbol": "USDx", - "decimals": 18 - }, - "0x6e0daDE58D2d89eBBe7aFc384e3E4f15b70b14D8": { - "name": "QuiverX", - "logo": "quiverx.svg", - "erc20": true, - "tokenSymbol": "QRX", - "decimals": 18 - }, - "0x0beAD9a1bcc1b84D06E3f2df67E3549Fd55aB054": { - "name": "EURxb", - "logo": "eurxb.svg", - "erc20": true, - "tokenSymbol": "EURxb", - "decimals": 18 - }, - "0x9F9c8ec3534c3cE16F928381372BfbFBFb9F4D24": { - "name": "GraphLinq", - "logo": "glq.svg", - "erc20": true, - "tokenSymbol": "GLQ", - "decimals": 18 - }, - "0xEB58343b36C7528F23CAAe63a150240241310049": { - "name": "NBU", - "logo": "NBU.svg", - "erc20": true, - "tokenSymbol": "NBU", - "decimals": 18 - }, - "0x16ECCfDbb4eE1A85A33f3A9B21175Cd7Ae753dB4": { - "name": "Route", - "logo": "route.svg", - "erc20": true, - "tokenSymbol": "ROUTE", - "decimals": 18 - }, - "0x75739d5944534115d7C54ee8C73F186D793BAE02": { - "name": "Collective", - "logo": "CO2.svg", - "erc20": true, - "tokenSymbol": "CO2", - "decimals": 18 - }, - "0x35bD01FC9d6D5D81CA9E055Db88Dc49aa2c699A8": { - "name": "FWB Pro", - "logo": "FWB.svg", - "erc20": true, - "tokenSymbol": "FWB", - "decimals": 18 - }, - "0x9B99CcA871Be05119B2012fd4474731dd653FEBe": { - "name": "Antimatter", - "logo": "antimatter.svg", - "erc20": true, - "tokenSymbol": "MATTER", - "decimals": 18 - }, - "0x6De037ef9aD2725EB40118Bb1702EBb27e4Aeb24": { - "name": "Render Token", - "logo": "RNDR.svg", - "erc20": true, - "tokenSymbol": "RNDR", - "decimals": 18 - }, - "0xDf49C9f599A0A9049D97CFF34D0C30E468987389": { - "name": "SaTT", - "logo": "SaTT.svg", - "erc20": true, - "tokenSymbol": "SATT", - "decimals": 18 - }, - "0x431ad2ff6a9C365805eBaD47Ee021148d6f7DBe0": { - "name": "dForce", - "logo": "DF.svg", - "erc20": true, - "tokenSymbol": "DF", - "decimals": 18 - }, - "0x6e1A19F235bE7ED8E3369eF73b196C07257494DE": { - "name": "Wrapped Filecoin", - "logo": "WFIL.svg", - "erc20": true, - "tokenSymbol": "WFIL", - "decimals": 18 - }, - "0xE452E6Ea2dDeB012e20dB73bf5d3863A3Ac8d77a": { - "name": "Wrapped Celo", - "logo": "WCELO.svg", - "erc20": true, - "tokenSymbol": "wCELO", - "decimals": 18 - }, - "0x4A64515E5E1d1073e83f30cB97BEd20400b66E10": { - "name": "Wrapped ZEC", - "logo": "WZEC.svg", - "erc20": true, - "tokenSymbol": "WZEC", - "decimals": 18 - }, - "0xA3865E64121537b5b59B5e239Db4aCBe6F36aa74": { - "name": "Wrapped Tezos", - "logo": "WXTZ.svg", - "erc20": true, - "tokenSymbol": "WXTZ", - "decimals": 18 - }, - "0x53c4871322Bb47e7A24136fce291a6dcC832a294": { - "name": "Wrapped Litecoin", - "logo": "WLTC.svg", - "erc20": true, - "tokenSymbol": "WLTC", - "decimals": 18 - }, - "0xad3E3Fc59dff318BecEaAb7D00EB4F68b1EcF195": { - "name": "Wrapped Celo USD", - "logo": "WCUSD.svg", - "erc20": true, - "tokenSymbol": "wCUSD", - "decimals": 18 - }, - "0x85D7bdfc9c3426b33A684241eEEE70385Bc42820": { - "name": "Wrapped Kadena", - "logo": "WKDA.svg", - "erc20": true, - "tokenSymbol": "WKDA", - "decimals": 18 - }, - "0x39fBBABf11738317a448031930706cd3e612e1B9": { - "name": "Wrapped XRP", - "logo": "WXRP.svg", - "erc20": true, - "tokenSymbol": "WXRP", - "decimals": 18 - }, - "0xBBC7f7A6AADAc103769C66CBC69AB720f7F9Eae3": { - "name": "INX Token", - "logo": "INX.svg", - "erc20": true, - "tokenSymbol": "INX", - "decimals": 18 - }, - "0x1b40183EFB4Dd766f11bDa7A7c3AD8982e998421": { - "name": "Vesper", - "logo": "Vesper-VSP-Token.svg", - "erc20": true, - "tokenSymbol": "VSP", - "decimals": 18 - }, - "0x544c42fBB96B39B21DF61cf322b5EDC285EE7429": { - "name": "InsurAce", - "logo": "INSUR.svg", - "erc20": true, - "tokenSymbol": "INSUR", - "decimals": 18 - }, - "0xcC665390b03c5D324D8fAF81C15eCee29A73bCB4": { - "name": "ChainSwap.com Governance Token", - "logo": "chainswap.svg", - "erc20": true, - "tokenSymbol": "ASAP", - "decimals": 18 - }, - "0x182F4c4C97cd1c24E1Df8FC4c053E5C47bf53Bef": { - "name": "keyTango Token", - "logo": "keyTango.svg", - "erc20": true, - "tokenSymbol": "TANGO", - "decimals": 18 - }, - "0x0275E1001e293C46CFe158B3702AADe0B99f88a5": { - "name": "Oiler", - "logo": "oiler.svg", - "erc20": true, - "tokenSymbol": "OIL", - "decimals": 18 - }, - "0xDe30da39c46104798bB5aA3fe8B9e0e1F348163F": { - "name": "Gitcoin", - "logo": "gtc.svg", - "erc20": true, - "tokenSymbol": "GTC", - "decimals": 18 - }, - "0x1796ae0b0fa4862485106a0de9b654eFE301D0b2": { - "name": "Polychain Monsters", - "logo": "PMON.svg", - "erc20": true, - "tokenSymbol": "PMON", - "decimals": 18 - }, - "0x8eEF5a82E6Aa222a60F009ac18c24EE12dBf4b41": { - "name": "Tixl", - "logo": "TXL.svg", - "erc20": true, - "tokenSymbol": "TXL", - "decimals": 18 - }, - "0x5218E472cFCFE0b64A064F055B43b4cdC9EfD3A6": { - "name": "unFederalReserve Token", - "logo": "eRSDL.svg", - "erc20": true, - "tokenSymbol": "eRSDL", - "decimals": 18 - }, - "0xE4cC5A22B39fFB0A56d67F94f9300db20D786a5F": { - "name": "unFederal eRSDL", - "logo": "uneRSDL.svg", - "erc20": true, - "tokenSymbol": "uneRSDL", - "decimals": 8 - }, - "0x2dbA05B51eF5A7DE3E7c3327201CA2F8a25C2414": { - "name": "unFederal DAI", - "logo": "unDAI.svg", - "erc20": true, - "tokenSymbol": "unDAI", - "decimals": 8 - }, - "0xFaCecE87e14B50eafc85C44C01702F5f485CA460": { - "name": "unFederal ETH", - "logo": "unETH.svg", - "erc20": true, - "tokenSymbol": "unETH", - "decimals": 8 - }, - "0x6b576972de33BebDe3A703BfF52a091e79f8c87A": { - "name": "unFederal USDC", - "logo": "unUSDC.svg", - "erc20": true, - "tokenSymbol": "unUSDC", - "decimals": 8 - }, - "0x6e2aA5bB90ac37D9006685AFc651ef067E1c7b44": { - "name": "unFederal USDT", - "logo": "unUSDT.svg", - "erc20": true, - "tokenSymbol": "unUSDT", - "decimals": 8 - }, - "0x5D446FC8DBd10EBAcfE9A427aB5402586af98cD4": { - "name": "unFederal WBTC", - "logo": "unWBTC.svg", - "erc20": true, - "tokenSymbol": "unWBTC", - "decimals": 8 - }, - "0xD837eCa6C91c67D98461A411BA2f00bdA9960a9D": { - "name": "unFederal AAVE", - "logo": "unAAVE.svg", - "erc20": true, - "tokenSymbol": "unAAVE", - "decimals": 8 - }, - "0x9e29Ce9cD25F4141dF6BB85b27Ef6933a16A5824": { - "name": "unFederal YFI", - "logo": "unYFI.svg", - "erc20": true, - "tokenSymbol": "unYFI", - "decimals": 8 - }, - "0x031002d15B0D0Cd7c9129d6F644446368deaE391": { - "name": "unFederal LINK", - "logo": "unLINK.svg", - "erc20": true, - "tokenSymbol": "unLINK", - "decimals": 8 - }, - "0xB8E2e2101eD11e9138803cd3e06e16dd19910647": { - "name": "ArdCoin", - "logo": "ardcoin.svg", - "erc20": true, - "tokenSymbol": "ARDX", - "decimals": 2 - }, - "0x6D0F5149c502faf215C89ab306ec3E50b15e2892": { - "name": "Portion Token", - "logo": "PRT.svg", - "erc20": true, - "tokenSymbol": "PRT", - "decimals": 18 - }, - "0x3845badAde8e6dFF049820680d1F14bD3903a5d0": { - "name": "SAND", - "logo": "SAND.svg", - "erc20": true, - "tokenSymbol": "SAND", - "decimals": 18 - }, - "0xcc7ab8d78dBA187dC95bF3bB86e65E0C26d0041f": { - "name": "Spacelens", - "logo": "SPACE.svg", - "erc20": true, - "tokenSymbol": "SPACE", - "decimals": 18 - }, - "0x50f5474724e0Ee42D9a4e711ccFB275809Fd6d4a": { - "name": "Sandbox's LANDs", - "logo": "SAND.svg", - "erc20": false, - "erc721": true, - "tokenSymbol": "LAND", - "decimals": 0 - }, - "0x362bc847A3a9637d3af6624EeC853618a43ed7D2": { - "name": "PARSIQ", - "logo": "parsiq.svg", - "erc20": true, - "tokenSymbol": "PRQ", - "decimals": 18 - }, - "0x21381e026Ad6d8266244f2A583b35F9E4413FA2a": { - "name": "Formation Finance", - "logo": "form.svg", - "erc20": true, - "tokenSymbol": "FORM", - "decimals": 18 - }, - "0x2ba592F78dB6436527729929AAf6c908497cB200": { - "name": "Cream", - "logo": "cream.svg", - "erc20": true, - "tokenSymbol": "CREAM", - "decimals": 18 - }, - "0x46576e20EC5F25586A6Fa2E0d6B6058354B72E72": { - "name": "Cryptomind", - "logo": "CR.svg", - "erc20": true, - "erc721": false, - "tokenSymbol": "CR", - "decimals": 8 - }, - "0x5ab21Ec0bfa0B29545230395e3Adaca7d552C948": { - "name": "PUNKS Comic", - "logo": "punks-comic.svg", - "erc20": false, - "erc721": true, - "tokenSymbol": "COMIC", - "decimals": 0 - }, - "0x9C2dc0c3CC2BADdE84B0025Cf4df1c5aF288D835": { - "name": "Coreto", - "logo": "coreto.svg", - "erc20": true, - "tokenSymbol": "COR", - "decimals": 18 - }, - "0x0De05F6447ab4D22c8827449EE4bA2D5C288379B": { - "name": "OOKI", - "logo": "ooki.svg", - "erc20": true, - "tokenSymbol": "OOKI", - "decimals": 18 - }, - "0x6B4c7A5e3f0B99FCD83e9c089BDDD6c7FCe5c611": { - "name": "Million", - "logo": "million.svg", - "erc20": true, - "tokenSymbol": "MM", - "decimals": 18 - }, - "0x56d811088235F11C8920698a204A5010a788f4b3": { - "name": "bZx Protocol Token (BZRX)", - "logo": "ic_token_bzrx.svg", - "erc20": true, - "tokenSymbol": "BZRX", - "decimals": 18 - }, - "0xB72B31907C1C95F3650b64b2469e08EdACeE5e8F": { - "name": "bZx Vesting Token (vBZRX)", - "logo": "ic_token_vbzrx.svg", - "erc20": true, - "tokenSymbol": "vBZRX", - "decimals": 18 - }, - "0x3085154623F51b00Dedfc6Ceeb5197277A66B17B": { - "name": "NIFTY", - "logo": "nfty.svg", - "erc20": true, - "tokenSymbol": "NFTY", - "decimals": 18 - }, - "0xB983E01458529665007fF7E0CDdeCDB74B967Eb6": { - "name": "Fulcrum ETH iToken (iETH)", - "logo": "ic_token_ieth.svg", - "erc20": true, - "tokenSymbol": "iETH", - "decimals": 18 - }, - "0x32E4c68B3A4a813b710595AebA7f6B7604Ab9c15": { - "name": "Fulcrum USDC iToken (iUSDC)", - "logo": "ic_token_iusdc.svg", - "erc20": true, - "tokenSymbol": "iUSDC", - "decimals": 6 - }, - "0x2ffa85f655752fB2aCB210287c60b9ef335f5b6E": { - "name": "Fulcrum WBTC iToken (iWBTC)", - "logo": "ic_token_ibtc.svg", - "erc20": true, - "tokenSymbol": "iWBTC", - "decimals": 8 - }, - "0x687642347a9282Be8FD809d8309910A3f984Ac5a": { - "name": "Fulcrum KNC iToken (iKNC)", - "logo": "ic_token_iknc.svg", - "erc20": true, - "tokenSymbol": "iKNC", - "decimals": 18 - }, - "0x463538705E7d22aA7f03Ebf8ab09B067e1001B54": { - "name": "Fulcrum LINK iToken (iLINK)", - "logo": "ic_token_ilink.svg", - "erc20": true, - "tokenSymbol": "iLINK", - "decimals": 18 - }, - "0x6b093998D36f2C7F0cc359441FBB24CC629D5FF0": { - "name": "Fulcrum DAI iToken (iDAI)", - "logo": "ic_token_idai.svg", - "erc20": true, - "tokenSymbol": "iDAI", - "decimals": 18 - }, - "0x7e9997a38A439b2be7ed9c9C4628391d3e055D48": { - "name": "Fulcrum USDT iToken (iUSDT)", - "logo": "ic_token_iusdt.svg", - "erc20": true, - "tokenSymbol": "iUSDT", - "decimals": 6 - }, - "0x9189c499727f88F8eCC7dC4EEA22c828E6AaC015": { - "name": "Fulcrum MKR iToken (iMKR)", - "logo": "ic_token_imkr.svg", - "erc20": true, - "tokenSymbol": "iMKR", - "decimals": 18 - }, - "0x18240BD9C07fA6156Ce3F3f61921cC82b2619157": { - "name": "Fulcrum BZRX iToken (iBZRX)", - "logo": "ic_token_ibzrx.svg", - "erc20": true, - "tokenSymbol": "iBZRX", - "decimals": 18 - }, - "0x7F3Fe9D492A9a60aEBb06d82cBa23c6F32CAd10b": { - "name": "Fulcrum YFI iToken (iYFI)", - "logo": "ic_token_iyfi.svg", - "erc20": true, - "tokenSymbol": "iYFI", - "decimals": 18 - }, - "0x0a625FceC657053Fe2D9FFFdeb1DBb4e412Cf8A8": { - "name": "Fulcrum UNI iToken (iUNI)", - "logo": "ic_token_iuni.svg", - "erc20": true, - "tokenSymbol": "iUNI", - "decimals": 18 - }, - "0x0cae8d91E0b1b7Bd00D906E990C3625b2c220db1": { - "name": "Fulcrum AAVE iToken (iAAVE)", - "logo": "ic_token_iaave.svg", - "erc20": true, - "tokenSymbol": "iAAVE", - "decimals": 18 - }, - "0x3dA0e01472Dee3746b4D324a65D7EdFaECa9Aa4f": { - "name": "Fulcrum LRC iToken (iLRC)", - "logo": "ic_token_ilrc.svg", - "erc20": true, - "tokenSymbol": "iLRC", - "decimals": 18 - }, - "0x6d29903BC2c4318b59B35d97Ab98ab9eC08Ed70D": { - "name": "Fulcrum COMP iToken (iCOMP)", - "logo": "ic_token_icomp.svg", - "erc20": true, - "tokenSymbol": "iCOMP", - "decimals": 18 - }, - "0x08c32b0726C5684024ea6e141C50aDe9690bBdcc": { - "name": "Stratos Token", - "logo": "stos.svg", - "erc20": true, - "tokenSymbol": "STOS", - "decimals": 18 - }, - "0xe28b3B32B6c345A34Ff64674606124Dd5Aceca30": { - "name": "Injective", - "logo": "inj.svg", - "erc20": true, - "tokenSymbol": "INJ", - "decimals": 18 - }, - "0xe516D78d784C77D479977BE58905B3f2b1111126": { - "name": "Bitspawn", - "logo": "spwn.svg", - "erc20": true, - "tokenSymbol": "SPWN", - "decimals": 18 - }, - "0xB16e967ff83DE3F1e9FCeAfbc2C28c1c5c56eF91": { - "name": "Polkadog", - "logo": "polkadog.svg", - "erc20": true, - "tokenSymbol": "PDOG", - "decimals": 18 - }, - "0xF4d861575ecC9493420A3f5a14F85B13f0b50EB3": { - "name": "Fractal Protocol", - "logo": "fractal.svg", - "erc20": true, - "tokenSymbol": "FCL", - "decimals": 18 - }, - "0x3af33bEF05C2dCb3C7288b77fe1C8d2AeBA4d789": { - "name": "Kromatika", - "logo": "krom.svg", - "erc20": true, - "tokenSymbol": "KROM", - "decimals": 18 - }, - "0xA130E3a33a4d84b04c3918c4E5762223Ae252F80": { - "name": "Swash Token", - "logo": "swash.svg", - "erc20": true, - "tokenSymbol": "SWASH", - "decimals": 18 - }, - "0xea7Cc765eBC94C4805e3BFf28D7E4aE48D06468A": { - "name": "NearPad Token", - "logo": "nearpad.svg", - "erc20": true, - "tokenSymbol": "PAD", - "decimals": 18 - }, - "0x87C22615435998D69ACA34889D03155B694a94fc": { - "name": "DiemLibre", - "logo": "DLB.svg", - "erc20": true, - "tokenSymbol": "DLB", - "decimals": 18 - }, - "0x4d224452801ACEd8B2F0aebE155379bb5D594381": { - "name": "ApeCoin", - "logo": "APE.svg", - "erc20": true, - "tokenSymbol": "APE", - "decimals": 18 - }, - "0xCd1fAFf6e578Fa5cAC469d2418C95671bA1a62Fe": { - "name": "Torum Token", - "logo": "torum.svg", - "erc20": true, - "tokenSymbol": "XTM", - "decimals": 18 - }, - "0xcf0C122c6b73ff809C693DB761e7BaeBe62b6a2E": { - "name": "FLOKI", - "logo": "floki.svg", - "erc20": true, - "tokenSymbol": "FLOKI", - "decimals": 9 - }, - "0xe831F96A7a1DcE1aa2EB760b1e296c6A74CaA9d5": { - "name": "Nexum Coin", - "logo": "nexum.svg", - "erc20": true, - "tokenSymbol": "Nexm", - "decimals": 8 - }, - "0x6710c63432A2De02954fc0f851db07146a6c0312": { - "name": "MFG", - "logo": "mfg.svg", - "erc20": true, - "tokenSymbol": "MFG", - "decimals": 18 - }, - "0xae78736Cd615f374D3085123A210448E74Fc6393": { - "name": "Rocket Pool ETH", - "logo": "rETH.svg", - "erc20": true, - "tokenSymbol": "rETH", - "decimals": 18 - }, - "0xD33526068D116cE69F19A9ee46F0bd304F21A51f": { - "name": "Rocket Pool", - "logo": "rpl.svg", - "erc20": true, - "tokenSymbol": "RPL", - "decimals": 18 - }, - "0x9d38F670D15C14716BE1F109a4F453E966A2B6D4": { - "name": "Quid Ika", - "logo": "QuidIka.svg", - "erc20": true, - "tokenSymbol": "QUID", - "decimals": 18 - }, - "0xD3c625F54dec647DB8780dBBe0E880eF21BA4329": { - "name": "HollaEx Token", - "logo": "xht.svg", - "erc20": true, - "tokenSymbol": "XHT", - "decimals": 18 - }, - "0x01e0E2e61f554eCAaeC0cC933E739Ad90f24a86d": { - "name": "GTON", - "logo": "gton.svg", - "erc20": true, - "tokenSymbol": "GTON", - "decimals": 18 - }, - "0xeFF66B4A84C8a6b69b99EB1C5e39aF8fc35d13db": { - "name": "sGTON", - "logo": "sgton.svg", - "erc20": true, - "tokenSymbol": "sGTON", - "decimals": 18 - }, - "0x7659CE147D0e714454073a5dd7003544234b6Aa0": { - "name": "XCAD Token", - "logo": "xcad.svg", - "erc20": true, - "tokenSymbol": "XCAD", - "decimals": 18 - } -} diff --git a/packages/sysweb3-utils/src/tokens.ts b/packages/sysweb3-utils/src/tokens.ts index 40963d11..cbcee3f1 100644 --- a/packages/sysweb3-utils/src/tokens.ts +++ b/packages/sysweb3-utils/src/tokens.ts @@ -1,20 +1,13 @@ -import camelcaseKeys from 'camelcase-keys'; -import { ethers as ethersModule } from 'ethers'; +import { retryableFetch } from '@sidhujag/sysweb3-network'; +import { Contract, type EventLog } from 'ethers/contract'; import * as sys from 'syscoinjs-lib'; import { createContractUsingAbi } from '.'; import ABI1155 from './abi/erc1155.json'; import abi20 from './abi/erc20.json'; import ABI721 from './abi/erc721.json'; -import tokens from './tokens.json'; -import { retryableFetch } from '@pollum-io/sysweb3-network'; -import type { - Contract, - ContractFunction, - Event, -} from '@ethersproject/contracts'; -import type { BaseProvider, JsonRpcProvider } from '@ethersproject/providers'; +import type { JsonRpcProvider } from 'ethers/providers'; const COINGECKO_API = 'https://api.coingecko.com/api/v3'; @@ -36,6 +29,12 @@ export const isAddress = (value: string): value is Address => export const identity = (arg: T): T => arg; +const toNumber = (value: any): number => + Number(value?.toString ? value.toString() : value); + +const toStringValue = (value: any): string => + value?.toString ? value.toString() : String(value); + export const parseNftUrl = (url: string): [string, string] | null => { const raribleMatch = RARIBLE_MATCH_RE.exec(url); @@ -84,20 +83,9 @@ export const ERC20ABI = [ 'event Transfer(address indexed from, address indexed to, uint amount)', ]; -type NftContract = InstanceType & { - balanceOf: ContractFunction; - ownerOf: ContractFunction; - tokenURI: ContractFunction; - uri: ContractFunction; -}; +type NftContract = any; -type TokenContract = InstanceType & { - Transfer: Event; - balanceOf: ContractFunction; - decimals: ContractFunction; - symbol: ContractFunction; - transfer: ContractFunction; -}; +type TokenContract = any; export const url = async ( contract: NftContract, @@ -118,34 +106,34 @@ export const url = async ( export const fetchBalanceOfERC721Contract = async ( contractAddress: string, address: string, - config: EthersFetcherConfigEthersLoaded + provider: JsonRpcProvider ): Promise => { - const contract = new config.ethers.Contract( + const contract = new Contract( contractAddress, ABI721, - config.provider + provider ) as NftContract; const fetchBalanceOfValue = await contract.balanceOf(address); - return fetchBalanceOfValue; + return toNumber(fetchBalanceOfValue); }; export const fetchBalanceOfERC1155Contract = async ( contractAddress: string, address: string, - config: EthersFetcherConfigEthersLoaded, + provider: JsonRpcProvider, tokenId: number -): Promise => { - const contract = new config.ethers.Contract( +): Promise => { + const contract = new Contract( contractAddress, ABI1155, - config.provider + provider ) as NftContract; const fetchBalanceOfValue = await contract.balanceOf(address, tokenId); - return fetchBalanceOfValue; + return toStringValue(fetchBalanceOfValue); }; export const getERC1155StandardBalance = async ( @@ -155,13 +143,10 @@ export const getERC1155StandardBalance = async ( tokenId: number ) => { try { - const config = { provider, ethers: ethersModule }; - const loaded = await loadEthers(config); - return await fetchBalanceOfERC1155Contract( contractAddress, address, - loaded, + provider, tokenId ); } catch (error) { @@ -177,10 +162,11 @@ export const getERC721StandardBalance = async ( provider: JsonRpcProvider ) => { try { - const config = { provider, ethers: ethersModule }; - const loaded = await loadEthers(config); - - return await fetchBalanceOfERC721Contract(contractAddress, address, loaded); + return await fetchBalanceOfERC721Contract( + contractAddress, + address, + provider + ); } catch (error) { throw new Error( `Verify current network or the contract address. Set the same network of token contract. ${error}` @@ -190,22 +176,86 @@ export const getERC721StandardBalance = async ( export const fetchStandardNftContractData = async ( contractAddress: Address, - config: EthersFetcherConfigEthersLoaded + provider: JsonRpcProvider ): Promise => { - const contract = new config.ethers.Contract( - contractAddress, - ABI1155, - config.provider - ) as NftContract; + // First try to determine the contract type + let contractType = 'UNKNOWN'; + let contract: NftContract; - const [name, symbol] = await Promise.all([ - contract.name(), - contract.symbol(), - ]); + try { + // Try ERC-721 first + const erc721Contract = new Contract( + contractAddress, + ABI721, + provider + ) as NftContract; + + // Check if it supports ERC-721 interface + const isERC721 = await erc721Contract.supportsInterface('0x80ac58cd'); + if (isERC721) { + contractType = 'ERC-721'; + contract = erc721Contract; + } else { + // Try ERC-1155 + const erc1155Contract = new Contract( + contractAddress, + ABI1155, + provider + ) as NftContract; + + const isERC1155 = await erc1155Contract.supportsInterface('0xd9b67a26'); + if (isERC1155) { + contractType = 'ERC-1155'; + contract = erc1155Contract; + } else { + throw new Error('Contract does not support ERC-721 or ERC-1155'); + } + } + } catch (error) { + // If supportsInterface fails, try to detect by calling methods + // This is a fallback for contracts that don't implement ERC-165 + contract = new Contract( + contractAddress, + [...ABI721, ...ABI1155], // Combined ABI + provider + ) as NftContract; + } + + // Try to get name and symbol + let name = ''; + let symbol = ''; + + try { + // Try to get name + name = await contract.name(); + } catch (error) { + // Name might not be implemented (optional in ERC-1155) + console.warn( + `NFT contract ${contractAddress} does not implement name()`, + error + ); + } + + try { + // Try to get symbol + symbol = await contract.symbol(); + } catch (error) { + // Symbol might not be implemented (optional in ERC-1155) + console.warn( + `NFT contract ${contractAddress} does not implement symbol()`, + error + ); + } + + // If neither name nor symbol is available, use a default + if (!name && !symbol) { + symbol = 'NFT'; + name = `${contractType} Collection`; + } return { - name, - symbol: cleanTokenSymbol(symbol), + name: name || symbol || `${contractType} Collection`, + symbol: cleanTokenSymbol(symbol || 'NFT'), }; }; @@ -231,12 +281,12 @@ export const cleanTokenSymbol = (symbol: string): string => { export const fetchStandardTokenContractData = async ( contractAddress: Address, address: Address, - config: EthersFetcherConfigEthersLoaded -): Promise<{ balance: number; decimals: number; tokenSymbol: string }> => { - const contract = new config.ethers.Contract( + provider: JsonRpcProvider +): Promise<{ balance: string; decimals: number; tokenSymbol: string }> => { + const contract = new Contract( contractAddress, ERC20ABI, - config.provider + provider ) as TokenContract; const [balance, decimals, symbol] = await Promise.all([ @@ -246,36 +296,12 @@ export const fetchStandardTokenContractData = async ( ]); return { - balance, - decimals, + balance: toStringValue(balance), + decimals: toNumber(decimals), tokenSymbol: cleanTokenSymbol(symbol), }; }; -const ETHERS_NOT_FOUND = `Ethers couldn't be imported. Please add the ethers module to your project dependencies, or inject it in the Ethers fetcher options.`; - -export const loadEthers = async ( - config: EthersFetcherConfig -): Promise => { - if (config.ethers.Contract) { - return config as EthersFetcherConfigEthersLoaded; - } - - try { - const ethers = await Promise.resolve() - .then(() => import('@ethersproject/contracts')) - .then((m) => (m.default ? m.default : m)); - - if (!ethers.Contract) { - throw new Error(); - } - - return { ...config, ethers }; - } catch (error) { - throw new Error(ETHERS_NOT_FOUND); - } -}; - export const fixIncorrectImageField = ( data: Record ): Record => { @@ -358,58 +384,16 @@ export const reversePromise = (promise: Promise): Promise => export const IMAGE_EXT_RE = /\.(?:png|svg|jpg|jepg|gif|webp|jxl|avif)$/; export const VIDEO_EXT_RE = /\.(?:mp4|mov|webm|ogv)$/; -export const getTokenIconBySymbol = async (symbol: string): Promise => { - symbol = symbol.toUpperCase(); - const searchResults = await getSearch(symbol); - - const tokens = searchResults.coins.filter( - (token: any) => token.symbol.toUpperCase() === symbol - ); - - if (tokens[0]) return tokens[0].thumb; - - throw new Error('Token icon not found'); -}; - -export const isNFT = (guid: number) => { - const assetGuid = BigInt.asUintN(64, BigInt(guid)); - - return assetGuid >> BigInt(32) > 0; -}; - -export const getHost = (url: string) => { - if (typeof url === 'string' && url !== '') { - return new URL(url).host; - } - - return url; -}; - -export const getToken = async (id: string): Promise => { - let token; - try { - const response = await retryableFetch(`${COINGECKO_API}/coins/${id}`); - token = await response.json(); - } catch (error) { - throw new Error('Unable to retrieve token data'); - } - - return camelcaseKeys(token, { deep: true }); -}; - export const getTokenStandardMetadata = async ( contractAddress: string, address: string, provider: JsonRpcProvider ) => { try { - const config = { provider, ethers: ethersModule }; - const loaded = await loadEthers(config); - return await fetchStandardTokenContractData( contractAddress, address, - loaded + provider ); } catch (error) { throw new Error( @@ -423,13 +407,31 @@ export const getNftStandardMetadata = async ( provider: JsonRpcProvider ) => { try { - const config = { provider, ethers: ethersModule }; - const loaded = await loadEthers(config); - - return await fetchStandardNftContractData(contractAddress, loaded); + return await fetchStandardNftContractData(contractAddress, provider); } catch (error) { + // Check if it's a network error + if (error?.code === 'CALL_EXCEPTION' || error?.code === 'NETWORK_ERROR') { + throw new Error( + `Network error: Verify you are on the correct network for NFT contract ${contractAddress}. ${ + error?.message || error + }` + ); + } + + // Check if it's a contract not found error + if ( + error?.message?.includes('Contract does not support ERC-721 or ERC-1155') + ) { + throw new Error( + `Invalid NFT contract: ${contractAddress} does not appear to be an ERC-721 or ERC-1155 contract` + ); + } + + // Generic error throw new Error( - `Verify current network. Set the same network of NFT token contract. ${error}` + `Failed to fetch NFT metadata for ${contractAddress}: ${ + error?.message || error + }` ); } }; @@ -458,55 +460,6 @@ export const getFiatValueByToken = async ( } }; -/** - * Get token symbol by chain - * @param chain should be written in lower case and by extense - * @example 'ethereum' | 'syscoin' - */ -export const getSymbolByChain = async (chain: string): Promise => { - const { symbol } = await getToken(chain); - - return symbol.toUpperCase(); -}; - -export const getTokenBySymbol = async ( - symbol: string -): Promise => { - const searchResults = await getSearch(symbol); - const firstCoin = searchResults.coins[0]; - - const symbolsAreEqual = - firstCoin.symbol.toUpperCase() === symbol.toUpperCase(); - - if (symbolsAreEqual) return firstCoin; - else throw new Error('Unable to find token'); -}; - -export const getSearch = async ( - query: string -): Promise => { - const response = await retryableFetch( - `${COINGECKO_API}/search?query=${query}` - ); - const data = await response.json(); - return camelcaseKeys(data, { deep: true }); -}; - -export const getSearchTokenAtCoingecko = async ( - tokenSymbol: string -): Promise => { - try { - const { coins } = await getSearch(tokenSymbol); - - if (coins && coins[0]) { - return coins[0]; - } else { - return null; - } - } catch (error) { - return null; - } -}; const isImageUrlAvailable = async (imageUrl: string) => { try { const response = await retryableFetch(imageUrl); @@ -554,27 +507,6 @@ export const getSearchTokenAtSysGithubRepo = async (tokenSymbol: string) => { }; } }; - -/** - * - * @param contractAddress Contract address of the token to get info from - */ -export const getTokenByContract = async ( - contractAddress: string -): Promise => { - let token; - try { - const response = await retryableFetch( - `${COINGECKO_API}/coins/ethereum/contract/${contractAddress}` - ); - token = await response.json(); - } catch (error) { - throw new Error('Token not found'); - } - - return camelcaseKeys(token, { deep: true }); -}; - /** * * @param address Contract address of the token to validate @@ -586,13 +518,21 @@ export const validateToken = async ( try { const contract = createContractUsingAbi(abi20, address, web3Provider); - const [decimals, name, symbol]: IErc20Token[] = await Promise.all([ - contract.methods.decimals().call(), - contract.methods.name().call(), - contract.methods.symbol().call(), - ]); - - const validToken = decimals && name && symbol; + const methods = (contract as any).methods; + const [decimals, name, symbol]: IErc20Token[] = methods + ? await Promise.all([ + methods.decimals().call(), + methods.name().call(), + methods.symbol().call(), + ]) + : await Promise.all([ + (contract as any).decimals(), + (contract as any).name(), + (contract as any).symbol(), + ]); + + const validToken = + decimals !== null && decimals !== undefined && name && symbol; if (validToken) { return { @@ -608,8 +548,6 @@ export const validateToken = async ( } }; -export const getTokenJson = (): any => tokens; - export const getAsset = async ( explorerUrl: string, assetGuid: string @@ -852,24 +790,6 @@ export type IAddressMap = { ]; }; -export type EthersContract = typeof Contract; - -export type EthersFetcherConfig = { - ethers: { Contract: EthersContract }; - provider: BaseProvider | JsonRpcProvider; -}; - -export type EthersFetcherConfigEthersLoaded = EthersFetcherConfig & { - ethers: { Contract: EthersContract }; -}; - -export type EthereumProviderEip1193 = { - request: (args: { - method: string; - params?: unknown[] | Record; - }) => Promise; -}; - export type Address = string; export type NftResultLoading = { @@ -888,7 +808,7 @@ export type NftResultError = { status: 'error'; }; -export type IQueryFilterResult = Promise>; +export type IQueryFilterResult = Promise>; export type NftResult = NftResultLoading | NftResultError | NftResultDone; diff --git a/packages/sysweb3-utils/src/transactions.ts b/packages/sysweb3-utils/src/transactions.ts index f427f622..141c85bd 100644 --- a/packages/sysweb3-utils/src/transactions.ts +++ b/packages/sysweb3-utils/src/transactions.ts @@ -1,10 +1,66 @@ import * as syscoinjs from 'syscoinjs-lib'; -// import { web3Provider } from '@pollum-io/sysweb3-network'; +// import { web3Provider } from '@sidhujag/sysweb3-network'; + +// Short-TTL cache + in-flight dedup for Blockbook /api/v2/tx lookups. +// The fields consumers rely on (hex, vin/vout) are immutable per txid, but the +// response also carries mutable fields (confirmations), so entries expire +// quickly instead of being cached forever. +const RAW_TX_CACHE_TTL_MS = 60_000; +const RAW_TX_CACHE_MAX_ENTRIES = 100; +const rawTxCache = new Map< + string, + { promise: Promise; timestamp: number } +>(); + +const getRawTransactionCached = ( + explorerUrl: string, + txid: string +): Promise => { + const key = `${explorerUrl}::${txid}`; + const now = Date.now(); + + const cached = rawTxCache.get(key); + if (cached && now - cached.timestamp < RAW_TX_CACHE_TTL_MS) { + return cached.promise; + } + + if (!rawTxCache.has(key) && rawTxCache.size >= RAW_TX_CACHE_MAX_ENTRIES) { + const oldestKey = rawTxCache.keys().next().value; + if (oldestKey !== undefined) { + rawTxCache.delete(oldestKey); + } + } + + const promise = Promise.resolve( + syscoinjs.utils.fetchBackendRawTx(explorerUrl, txid) + ); + rawTxCache.set(key, { promise, timestamp: now }); + + // Never cache failures or empty responses (e.g. tx not indexed yet) - + // the next caller should retry + const dropEntry = () => { + const entry = rawTxCache.get(key); + if (entry && entry.promise === promise) { + rawTxCache.delete(key); + } + }; + promise.then((value) => { + if (value === null || value === undefined) { + dropEntry(); + } + }, dropEntry); + + return promise; +}; + +export const clearRawTransactionCache = () => { + rawTxCache.clear(); +}; export const txUtils = () => { const getRawTransaction = (explorerUrl: string, txid: string) => - syscoinjs.utils.fetchBackendRawTx(explorerUrl, txid); + getRawTransactionCached(explorerUrl, txid); return { getRawTransaction, diff --git a/packages/sysweb3-utils/src/trezor.ts b/packages/sysweb3-utils/src/trezor.ts deleted file mode 100644 index 843bc6a2..00000000 --- a/packages/sysweb3-utils/src/trezor.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { fromZpub } from 'bip84'; - -export const getTrezorAccountAddressAndSplitTokensPath = ({ - xpub, - signer, - backendAccount, -}: { - backendAccount: any; - signer: any; - xpub: string; -}) => { - const account: any = new fromZpub( - xpub, - signer.Signer.Signer.pubtypes, - signer.Signer.Signer.networks - ); - let receivingIndex = -1; - - if (backendAccount.tokens) { - backendAccount.tokens.forEach((token: any) => { - if (token.path) { - const splitPath = token.path.split('/'); - - if (splitPath.length >= 6) { - const change = parseInt(splitPath[4], 10); - const index = parseInt(splitPath[5], 10); - - if (change === 1) { - return; - } - - if (index > receivingIndex) { - receivingIndex = index; - } - } - } - }); - } - const address = account.getAddress(receivingIndex + 1); - - return address; -}; diff --git a/packages/sysweb3-utils/test/contracts.spec.ts b/packages/sysweb3-utils/test/contracts.spec.ts index 65396563..8f7c10a9 100644 --- a/packages/sysweb3-utils/test/contracts.spec.ts +++ b/packages/sysweb3-utils/test/contracts.spec.ts @@ -1,5 +1,6 @@ import { contractChecker, isContractAddress } from '../src/contracts'; import { getContractType } from '../src/getContract'; +import { getTokenStandardMetadata, validateToken } from '../src/tokens'; // Helper to create mock provider const createMockProvider = () => { @@ -82,6 +83,16 @@ describe('Validate Contract Type in Mumbai Network using contractType function', } }); + it('Should return ERC 20 Contract when balanceOf returns bigint', async () => { + const provider = createMockProvider(); + const handleContractType = await getContractType( + '0xa6fa4fb5f76172d178d61b04b0ecd319c5d1c0aa', + provider + ); + + expect(handleContractType?.type).toBe('ERC-20'); + }); + it('Should return ERC 721 Contract', async () => { const provider = createMockProvider(); const handleContractType = await getContractType( @@ -113,6 +124,38 @@ describe('Validate Contract Type in Mumbai Network using contractType function', }); }); +describe('Validate ERC20 token metadata', () => { + it('Should preserve exact ERC20 balances when ethers returns bigint integers', async () => { + const token = await getTokenStandardMetadata( + '0xa6fa4fb5f76172d178d61b04b0ecd319c5d1c0aa', + '0x0000000000000000000000000000000000000001', + createMockProvider() as any + ); + + expect(token).toEqual({ + balance: '1000000000000000001', + decimals: 18, + tokenSymbol: 'TEST', + }); + expect(typeof token.balance).toBe('string'); + expect(typeof token.decimals).toBe('number'); + expect(() => JSON.stringify(token)).not.toThrow(); + }); + + it('Should accept zero-decimal ERC20 tokens', async () => { + const token = await validateToken( + '0x0000000000000000000000000000000000000020', + createMockProvider() + ); + + expect(token).toEqual({ + name: 'Test Token', + symbol: 'TEST', + decimals: 0, + }); + }); +}); + describe('Validate Contracts in Mumbai Network using contractChecker function', () => { it('Should return Undefined Contract', async () => { const provider = createMockProvider(); diff --git a/packages/sysweb3-utils/test/nfts.spec.ts b/packages/sysweb3-utils/test/nfts.spec.ts index 29146b23..afb70df0 100644 --- a/packages/sysweb3-utils/test/nfts.spec.ts +++ b/packages/sysweb3-utils/test/nfts.spec.ts @@ -1,35 +1,45 @@ -import { ethers } from 'ethers'; +import { JsonRpcProvider } from 'ethers'; -import { getERC721StandardBalance } from '../src/tokens'; +import { + getERC1155StandardBalance, + getERC721StandardBalance, +} from '../src/tokens'; describe('ERC-721 NFts tests', () => { it('should return balance 0 from NFT contract', async () => { - const RpcProvider = new ethers.providers.JsonRpcProvider(); + const RpcProvider = new JsonRpcProvider(); const erc721Balance = await getERC721StandardBalance( '0x0c702F78b889f25E3347fb978345F7eCF4F3861C', // Contract Address in Mumbai '0x6a92eF94F6Db88098625a30396e0fde7255E97d5', // Wallet Adress RpcProvider ); - const convertBalance = Number(erc721Balance); - - expect(typeof erc721Balance).toBe('object'); // Object of BigNumber - expect(typeof convertBalance).toBe('number'); - expect(convertBalance).toBeLessThanOrEqual(0); + expect(typeof erc721Balance).toBe('number'); + expect(erc721Balance).toBeLessThanOrEqual(0); }); it('should return balance greater or equal to 1 from NFT contract', async () => { - const RpcProvider = new ethers.providers.JsonRpcProvider(); + const RpcProvider = new JsonRpcProvider(); const erc721Balance = await getERC721StandardBalance( '0xd19018f7946D518D316BB10FdFF118C28835cF7a', // Contract Address in Mumbai '0x6a92eF94F6Db88098625a30396e0fde7255E97d5', // Wallet Adress RpcProvider ); - const convertBalance = Number(erc721Balance); + expect(typeof erc721Balance).toBe('number'); + expect(erc721Balance).toBeGreaterThanOrEqual(1); + }); + + it('should preserve exact ERC-1155 balances', async () => { + const RpcProvider = new JsonRpcProvider(); + const erc1155Balance = await getERC1155StandardBalance( + '0xAa54A8E8BdEA1aa7E2ed7E5F681c798a8ed7e5AB', + '0x6a92eF94F6Db88098625a30396e0fde7255E97d5', + RpcProvider, + 1 + ); - expect(typeof erc721Balance).toBe('object'); // Object of BigNumber - expect(typeof convertBalance).toBe('number'); - expect(convertBalance).toBeGreaterThanOrEqual(1); + expect(erc1155Balance).toBe('1000000000000000001'); + expect(typeof erc1155Balance).toBe('string'); }); }); diff --git a/packages/sysweb3-utils/test/setup.ts b/packages/sysweb3-utils/test/setup.ts index 6b20d502..95e0c53b 100644 --- a/packages/sysweb3-utils/test/setup.ts +++ b/packages/sysweb3-utils/test/setup.ts @@ -1,187 +1,192 @@ -// Mock the dynamic ethers import -jest.mock('@ethersproject/contracts', () => { - const ethers = jest.requireActual('ethers'); - const mockEthers = jest.requireMock('ethers'); - return { - Contract: mockEthers.Contract || ethers.Contract, - default: { Contract: mockEthers.Contract || ethers.Contract }, - }; -}); +// Mock ethers +const BigNumber = { + from: (value: string | number | bigint) => ({ + toString: () => String(value), + valueOf: () => Number(value), + }), +}; -// Mock ethers providers to avoid real network calls jest.mock('ethers', () => { const actual = jest.requireActual('ethers'); - // Create a mock that doesn't try to connect to network - const MockJsonRpcProvider = jest - .fn() - .mockImplementation(function (this: any, _url?: string) { - this._isProvider = true; - this._network = { chainId: 80001, name: 'mumbai' }; - this.connection = { url: _url || 'http://localhost:8545' }; - this._networkPromise = Promise.resolve({ - chainId: 80001, - name: 'mumbai', - }); + const MockContract = jest.fn().mockImplementation((address: string) => { + const lowerAddress = address.toLowerCase(); + + // Determine contract type based on address + const erc721Addresses = [ + '0x0c702f78b889f25e3347fb978345f7ecf4f3861c', + '0xd19018f7946d518d316bb10fdff118c28835cf7a', + ]; + const erc1155Addresses = ['0xaa54a8e8bdea1aa7e2ed7e5f681c798a8ed7e5ab']; + const zeroDecimalErc20Address = + '0x0000000000000000000000000000000000000020'; + const erc20Addresses = [ + '0xa6fa4fb5f76172d178d61b04b0ecd319c5d1c0aa', + zeroDecimalErc20Address, + ]; + + const isERC721 = erc721Addresses.some( + (a) => a.toLowerCase() === lowerAddress + ); + const isERC1155 = erc1155Addresses.some( + (a) => a.toLowerCase() === lowerAddress + ); + const isERC20 = erc20Addresses.some( + (a) => a.toLowerCase() === lowerAddress + ); + + return { + balanceOf: jest.fn().mockImplementation(async () => { + // For ERC20 type detection, return balance even when checking contract's own balance + if (isERC20) { + return Promise.resolve(1000000000000000001n); + } + // For unknown contracts that don't support any standard, throw error + if (!isERC721 && !isERC1155 && !isERC20) { + throw new Error('Contract does not support balanceOf'); + } + if (isERC1155) { + return Promise.resolve(1000000000000000001n); + } + // Return different balances for NFTs + if (lowerAddress === '0x0c702f78b889f25e3347fb978345f7ecf4f3861c') { + return Promise.resolve(0n); + } + return Promise.resolve(1n); + }), + supportsInterface: jest + .fn() + .mockImplementation(async (interfaceId: string) => { + // For unknown contracts, throw error to simulate they don't have supportsInterface + if (!isERC721 && !isERC1155) { + throw new Error('Contract does not support supportsInterface'); + } + if (interfaceId === '0x80ac58cd' && isERC721) return true; // ERC721 + if (interfaceId === '0xd9b67a26' && isERC1155) return true; // ERC1155 + return false; + }), + ownerOf: jest + .fn() + .mockResolvedValue('0x1234567890123456789012345678901234567890'), + tokenURI: jest.fn().mockResolvedValue('https://example.com/token/1'), + symbol: jest.fn().mockResolvedValue('TEST'), + name: jest.fn().mockResolvedValue('Test Token'), + decimals: jest + .fn() + .mockResolvedValue(lowerAddress === zeroDecimalErc20Address ? 0n : 18), + }; + }); - this.getNetwork = async () => ({ chainId: 80001, name: 'mumbai' }); - this.detectNetwork = async () => ({ chainId: 80001, name: 'mumbai' }); - this.ready = Promise.resolve({ chainId: 80001, name: 'mumbai' }); + return { + ...actual, + Contract: MockContract, + JsonRpcProvider: jest + .fn() + .mockImplementation(function (this: any, _url?: string) { + this._isProvider = true; + this._network = { chainId: 80001, name: 'mumbai' }; + this.connection = { url: _url || 'http://localhost:8545' }; + this._networkPromise = Promise.resolve({ + chainId: 80001, + name: 'mumbai', + }); + + this.getNetwork = async () => ({ chainId: 80001, name: 'mumbai' }); + this.detectNetwork = async () => ({ chainId: 80001, name: 'mumbai' }); + this.ready = Promise.resolve({ chainId: 80001, name: 'mumbai' }); + + Object.defineProperty(this, 'network', { + get: () => ({ chainId: 80001, name: 'mumbai' }), + }); + + this.getBalance = async () => { + return BigNumber.from('1000000000000000000'); + }; + + this.getCode = async (address: string) => { + // Return contract code for known contract addresses + const contracts = [ + '0x0c702f78b889f25e3347fb978345f7ecf4f3861c', + '0xd19018f7946d518d316bb10fdff118c28835cf7a', + '0xaa54a8e8bdea1aa7e2ed7e5f681c798a8ed7e5ab', + '0x07865c6e87b9f70255377e024ace6630c1eaa37f', + '0x1297228a708602b796fa16e9a7683db9cde09436', + '0x628a9db47d7aeb6cf80ebf8c441bb72a83ddb08e', + '0x68b3465833fb72a70ecdf485e0e4c7bd8665fc45', + '0xa6fa4fb5f76172d178d61b04b0ecd319c5d1c0aa', + ]; + + // Handle case-insensitive comparison + const normalizedAddress = address.toLowerCase(); + const isContract = contracts.some( + (c) => normalizedAddress === c.toLowerCase() + ); - Object.defineProperty(this, 'network', { - get: () => ({ chainId: 80001, name: 'mumbai' }), - }); + return isContract ? '0x608060405234801561001057600080fd5b50' : '0x'; + }; + + this.call = async (transaction: any) => { + // Mock contract calls for ERC721 balanceOf + if (transaction.data && transaction.data.startsWith('0x70a08231')) { + // Return balance based on the contract address + if ( + transaction.to.toLowerCase() === + '0x0c702f78b889f25e3347fb978345f7ecf4f3861c' + ) { + return '0x0000000000000000000000000000000000000000000000000000000000000000'; // 0 + } else { + return '0x0000000000000000000000000000000000000000000000000000000000000001'; // 1 + } + } + return '0x0000000000000000000000000000000000000000000000000000000000000001'; + }; - this.getBalance = async () => { - return actual.BigNumber.from('1000000000000000000'); - }; - - this.getCode = async (address: string) => { - // Return contract code for known contract addresses - const contracts = [ - '0x0c702f78b889f25e3347fb978345f7ecf4f3861c', - '0xd19018f7946d518d316bb10fdff118c28835cf7a', - '0xaa54a8e8bdea1aa7e2ed7e5f681c798a8ed7e5ab', - '0x07865c6e87b9f70255377e024ace6630c1eaa37f', - '0x1297228a708602b796fa16e9a7683db9cde09436', - '0x628a9db47d7aeb6cf80ebf8c441bb72a83ddb08e', - '0x68b3465833fb72a70ecdf485e0e4c7bd8665fc45', - '0xa6fa4fb5f76172d178d61b04b0ecd319c5d1c0aa', - ]; - - // Handle case-insensitive comparison - const normalizedAddress = address.toLowerCase(); - const isContract = contracts.some( - (c) => normalizedAddress === c.toLowerCase() - ); - - // Debug logging for the failing test - if ( - normalizedAddress === '0x0c702f78b889f25e3347fb978345f7ecf4f3861c' - ) { - console.log( - 'getCode debug - address:', - address, - 'normalized:', - normalizedAddress, - 'isContract:', - isContract - ); - } + this.estimateGas = async () => { + return BigNumber.from('21000'); + }; - return isContract ? '0x608060405234801561001057600080fd5b50' : '0x'; - }; - - this.call = async (transaction: any) => { - // Mock contract calls for ERC721 balanceOf - if (transaction.data && transaction.data.startsWith('0x70a08231')) { - // Return balance based on the contract address - if ( - transaction.to.toLowerCase() === - '0x0c702f78b889f25e3347fb978345f7ecf4f3861c' - ) { - return '0x0000000000000000000000000000000000000000000000000000000000000000'; // 0 - } else { - return '0x0000000000000000000000000000000000000000000000000000000000000001'; // 1 + // Add send method for JSON-RPC calls + this.send = async (method: string, params: any[]) => { + if (method === 'eth_chainId') { + return '0x13881'; // 80001 in hex } - } - return '0x0000000000000000000000000000000000000000000000000000000000000001'; - }; + if (method === 'net_version') { + return '80001'; + } + if (method === 'eth_getCode') { + return this.getCode(params[0]); + } + return null; + }; - this.estimateGas = async () => { - return actual.BigNumber.from('21000'); - }; + // Add perform method + this.perform = async (method: string, params: any) => { + if (method === 'getCode') { + return this.getCode(params.address); + } + return null; + }; + }), + }; +}); - // Add send method for JSON-RPC calls - this.send = async (method: string, params: any[]) => { - if (method === 'eth_chainId') { - return '0x13881'; // 80001 in hex - } - if (method === 'net_version') { - return '80001'; - } - if (method === 'eth_getCode') { - return this.getCode(params[0]); - } - return null; - }; +jest.mock('ethers/contract', () => { + const actual = jest.requireActual('ethers/contract'); + const ethers = jest.requireMock('ethers'); - // Add perform method - this.perform = async (method: string, params: any) => { - if (method === 'getCode') { - return this.getCode(params.address); - } - return null; - }; - }); + return { + ...actual, + Contract: ethers.Contract, + }; +}); + +jest.mock('ethers/providers', () => { + const actual = jest.requireActual('ethers/providers'); + const ethers = jest.requireMock('ethers'); return { ...actual, - ethers: { - ...actual.ethers, - Contract: actual.Contract || actual.ethers?.Contract || jest.fn(), - }, - providers: { - ...actual.providers, - JsonRpcProvider: MockJsonRpcProvider, - }, - Contract: jest.fn().mockImplementation((address: string) => { - const lowerAddress = address.toLowerCase(); - - // Determine contract type based on address - const erc721Addresses = [ - '0x0c702f78b889f25e3347fb978345f7ecf4f3861c', - '0xd19018f7946d518d316bb10fdff118c28835cf7a', - ]; - const erc1155Addresses = ['0xaa54a8e8bdea1aa7e2ed7e5f681c798a8ed7e5ab']; - const erc20Addresses = ['0xa6fa4fb5f76172d178d61b04b0ecd319c5d1c0aa']; - - const isERC721 = erc721Addresses.some( - (a) => a.toLowerCase() === lowerAddress - ); - const isERC1155 = erc1155Addresses.some( - (a) => a.toLowerCase() === lowerAddress - ); - const isERC20 = erc20Addresses.some( - (a) => a.toLowerCase() === lowerAddress - ); - - return { - balanceOf: jest.fn().mockImplementation(async () => { - // For ERC20 type detection, return balance even when checking contract's own balance - if (isERC20) { - return actual.BigNumber.from('1000000'); - } - // For unknown contracts that don't support any standard, throw error - if (!isERC721 && !isERC1155 && !isERC20) { - throw new Error('Contract does not support balanceOf'); - } - // Return different balances for NFTs - if (lowerAddress === '0x0c702f78b889f25e3347fb978345f7ecf4f3861c') { - return actual.BigNumber.from('0'); - } - return actual.BigNumber.from('1'); - }), - supportsInterface: jest - .fn() - .mockImplementation(async (interfaceId: string) => { - // For unknown contracts, throw error to simulate they don't have supportsInterface - if (!isERC721 && !isERC1155) { - throw new Error('Contract does not support supportsInterface'); - } - if (interfaceId === '0x80ac58cd' && isERC721) return true; // ERC721 - if (interfaceId === '0xd9b67a26' && isERC1155) return true; // ERC1155 - return false; - }), - ownerOf: jest - .fn() - .mockResolvedValue('0x1234567890123456789012345678901234567890'), - tokenURI: jest.fn().mockResolvedValue('https://example.com/token/1'), - symbol: jest.fn().mockResolvedValue('TEST'), - name: jest.fn().mockResolvedValue('Test Token'), - decimals: jest.fn().mockResolvedValue(18), - }; - }), + JsonRpcProvider: ethers.JsonRpcProvider, }; }); diff --git a/packages/sysweb3-utils/test/tokens.spec.ts b/packages/sysweb3-utils/test/tokens.spec.ts deleted file mode 100644 index a8f8492f..00000000 --- a/packages/sysweb3-utils/test/tokens.spec.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { getFiatValueByToken, getTokenIconBySymbol } from '../src/tokens'; - -describe('web3-Tokens tests', () => { - it('should get token icon by symbol', async () => { - const token = await getTokenIconBySymbol('eth'); - expect(token.startsWith('https://')).toBe(true); - }); - - it('should retrieve a token price as fiat', async () => { - const result = await getFiatValueByToken('syscoin', 'usd'); - - expect(typeof result).toBe('number'); - expect(result).toBeGreaterThan(0); - }); -}); diff --git a/packages/sysweb3-utils/test/transactions.spec.ts b/packages/sysweb3-utils/test/transactions.spec.ts new file mode 100644 index 00000000..405bd5a1 --- /dev/null +++ b/packages/sysweb3-utils/test/transactions.spec.ts @@ -0,0 +1,88 @@ +import * as syscoinjs from 'syscoinjs-lib'; + +import { clearRawTransactionCache, txUtils } from '../src/transactions'; + +jest.mock('syscoinjs-lib', () => ({ + utils: { + fetchBackendRawTx: jest.fn(), + }, +})); + +const fetchBackendRawTxMock = syscoinjs.utils.fetchBackendRawTx as jest.Mock; + +const URL = 'https://blockbook.test'; +const TXID = 'a'.repeat(64); + +describe('txUtils getRawTransaction cache', () => { + beforeEach(() => { + jest.clearAllMocks(); + clearRawTransactionCache(); + fetchBackendRawTxMock.mockResolvedValue({ + txid: TXID, + hex: '0xdeadbeef', + confirmations: 1, + }); + }); + + it('reuses the cached response for the same txid within the TTL', async () => { + const { getRawTransaction } = txUtils(); + + const first = await getRawTransaction(URL, TXID); + const second = await getRawTransaction(URL, TXID); + + expect(fetchBackendRawTxMock).toHaveBeenCalledTimes(1); + expect(second).toEqual(first); + }); + + it('shares the cache across txUtils instances', async () => { + await txUtils().getRawTransaction(URL, TXID); + await txUtils().getRawTransaction(URL, TXID); + + expect(fetchBackendRawTxMock).toHaveBeenCalledTimes(1); + }); + + it('fetches separately for different txids', async () => { + const { getRawTransaction } = txUtils(); + + await getRawTransaction(URL, TXID); + await getRawTransaction(URL, 'b'.repeat(64)); + + expect(fetchBackendRawTxMock).toHaveBeenCalledTimes(2); + }); + + it('expires entries after the TTL', async () => { + const { getRawTransaction } = txUtils(); + const nowSpy = jest.spyOn(Date, 'now'); + const base = 1_750_000_000_000; + + nowSpy.mockReturnValue(base); + await getRawTransaction(URL, TXID); + + nowSpy.mockReturnValue(base + 61_000); // TTL is 60s + await getRawTransaction(URL, TXID); + + expect(fetchBackendRawTxMock).toHaveBeenCalledTimes(2); + nowSpy.mockRestore(); + }); + + it('does not cache failures', async () => { + const { getRawTransaction } = txUtils(); + fetchBackendRawTxMock.mockRejectedValueOnce(new Error('boom')); + + await expect(getRawTransaction(URL, TXID)).rejects.toThrow('boom'); + const result = await getRawTransaction(URL, TXID); + + expect(fetchBackendRawTxMock).toHaveBeenCalledTimes(2); + expect(result.hex).toBe('0xdeadbeef'); + }); + + it('does not cache null responses (tx not indexed yet)', async () => { + const { getRawTransaction } = txUtils(); + fetchBackendRawTxMock.mockResolvedValueOnce(null); + + await getRawTransaction(URL, TXID); + await getRawTransaction(URL, TXID); + + expect(fetchBackendRawTxMock).toHaveBeenCalledTimes(2); + }); +}); diff --git a/packages/sysweb3-utils/tsconfig.json b/packages/sysweb3-utils/tsconfig.json index 7da0cd73..89c5a9b8 100644 --- a/packages/sysweb3-utils/tsconfig.json +++ b/packages/sysweb3-utils/tsconfig.json @@ -6,6 +6,7 @@ "baseUrl": "src", "outDir": "dist/cjs", "declarationDir": "dist/types", + "isolatedModules": true, "resolveJsonModule": true }, "include": ["src"] diff --git a/packages/sysweb3-utils/yarn.lock b/packages/sysweb3-utils/yarn.lock index 877268ad..d5df22db 100644 --- a/packages/sysweb3-utils/yarn.lock +++ b/packages/sysweb3-utils/yarn.lock @@ -2,127 +2,124 @@ # yarn lockfile v1 -"@ampproject/remapping@^2.2.0": - version "2.3.0" - resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.3.0.tgz#ed441b6fa600072520ce18b43d2c8cc8caecc7f4" - integrity sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw== - dependencies: - "@jridgewell/gen-mapping" "^0.3.5" - "@jridgewell/trace-mapping" "^0.3.24" +"@adraffy/ens-normalize@1.11.1": + version "1.11.1" + resolved "https://registry.yarnpkg.com/@adraffy/ens-normalize/-/ens-normalize-1.11.1.tgz#6c2d657d4b2dfb37f8ea811dcb3e60843d4ac24a" + integrity sha512-nhCBV3quEgesuf7c7KYfperqSS14T8bYuvJ8PcLJp6znkZpFc0AuW4qBtr8eKVyPPe/8RSr7sglCWPU5eaxwKQ== -"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.27.1.tgz#200f715e66d52a23b221a9435534a91cc13ad5be" - integrity sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg== +"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.29.7.tgz#f2fbbfea87c44a21590ec515b778b2c26d8866e7" + integrity sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw== dependencies: - "@babel/helper-validator-identifier" "^7.27.1" + "@babel/helper-validator-identifier" "^7.29.7" js-tokens "^4.0.0" picocolors "^1.1.1" -"@babel/compat-data@^7.27.2": - version "7.28.0" - resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.28.0.tgz#9fc6fd58c2a6a15243cd13983224968392070790" - integrity sha512-60X7qkglvrap8mn1lh2ebxXdZYtUcpd7gsmy9kLaBJ4i/WdY8PqTSdxyA8qraikqKQK5C1KRBKXqznrVapyNaw== - -"@babel/core@^7.1.0", "@babel/core@^7.12.3", "@babel/core@^7.7.2", "@babel/core@^7.8.0": - version "7.28.0" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.28.0.tgz#55dad808d5bf3445a108eefc88ea3fdf034749a4" - integrity sha512-UlLAnTPrFdNGoFtbSXwcGFQBtQZJCNjaN6hQNP3UPvuNXT1i82N26KL3dZeIpNalWywr9IuQuncaAfUaS1g6sQ== - dependencies: - "@ampproject/remapping" "^2.2.0" - "@babel/code-frame" "^7.27.1" - "@babel/generator" "^7.28.0" - "@babel/helper-compilation-targets" "^7.27.2" - "@babel/helper-module-transforms" "^7.27.3" - "@babel/helpers" "^7.27.6" - "@babel/parser" "^7.28.0" - "@babel/template" "^7.27.2" - "@babel/traverse" "^7.28.0" - "@babel/types" "^7.28.0" +"@babel/compat-data@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.29.7.tgz#6f0237f0f36d2e51c0570a636faed9d2d0efe629" + integrity sha512-locTkQyKvwIEgBzVrn8693ebc97F2U8ZHjbXwDXJ5Fn2TCpNwTlKcaKLkdHop5c/icOFE7qt7Q9JC5hnKNa6Gg== + +"@babel/core@^7.11.6", "@babel/core@^7.12.3", "@babel/core@^7.23.9": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.29.7.tgz#80c10b17248082968b57a857b91640971f2070f7" + integrity sha512-RgHBCvtjbOK2gXSNBNIkNoEc9qoVEtau3hj8gEqKQuL3HZAibKarWFEI3Lfm6EYKkLalOh8eSrj9b+ch9H/VBA== + dependencies: + "@babel/code-frame" "^7.29.7" + "@babel/generator" "^7.29.7" + "@babel/helper-compilation-targets" "^7.29.7" + "@babel/helper-module-transforms" "^7.29.7" + "@babel/helpers" "^7.29.7" + "@babel/parser" "^7.29.7" + "@babel/template" "^7.29.7" + "@babel/traverse" "^7.29.7" + "@babel/types" "^7.29.7" + "@jridgewell/remapping" "^2.3.5" convert-source-map "^2.0.0" debug "^4.1.0" gensync "^1.0.0-beta.2" json5 "^2.2.3" semver "^6.3.1" -"@babel/generator@^7.28.0", "@babel/generator@^7.7.2": - version "7.28.0" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.28.0.tgz#9cc2f7bd6eb054d77dc66c2664148a0c5118acd2" - integrity sha512-lJjzvrbEeWrhB4P3QBsH7tey117PjLZnDbLiQEKjQ/fNJTjuq4HSqgFA+UNSwZT8D7dxxbnuSBMsa1lrWzKlQg== +"@babel/generator@^7.29.7", "@babel/generator@^7.29.8", "@babel/generator@^7.7.2": + version "7.29.8" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.29.8.tgz#4b0b887885422643339e09022148a4c4ebaa4979" + integrity sha512-gZbepsdh3WDtgZKWL+vTPh71LSBrm/Y4/QDZBVCcYfmeTEEuoOYwlSy+G1StfJg+/Zy550u/3TATbm7qDbbMtg== dependencies: - "@babel/parser" "^7.28.0" - "@babel/types" "^7.28.0" + "@babel/parser" "^7.29.8" + "@babel/types" "^7.29.8" "@jridgewell/gen-mapping" "^0.3.12" "@jridgewell/trace-mapping" "^0.3.28" jsesc "^3.0.2" -"@babel/helper-compilation-targets@^7.27.2": - version "7.27.2" - resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.27.2.tgz#46a0f6efab808d51d29ce96858dd10ce8732733d" - integrity sha512-2+1thGUUWWjLTYTHZWK1n8Yga0ijBz1XAhUXcKy81rd5g6yh7hGqMp45v7cadSbEHc9G3OTv45SyneRN3ps4DQ== +"@babel/helper-compilation-targets@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.29.7.tgz#7a1def704302401c47f64fa85589e974ae217042" + integrity sha512-wem6WaBj4NaVYVdNhLPPVacES6ZJ+KBBfSkTMD3YZxbP3rm3Di85tJU5ljaUNhaOynt+Aj0xruhYuzQBt8n71g== dependencies: - "@babel/compat-data" "^7.27.2" - "@babel/helper-validator-option" "^7.27.1" + "@babel/compat-data" "^7.29.7" + "@babel/helper-validator-option" "^7.29.7" browserslist "^4.24.0" lru-cache "^5.1.1" semver "^6.3.1" -"@babel/helper-globals@^7.28.0": - version "7.28.0" - resolved "https://registry.yarnpkg.com/@babel/helper-globals/-/helper-globals-7.28.0.tgz#b9430df2aa4e17bc28665eadeae8aa1d985e6674" - integrity sha512-+W6cISkXFa1jXsDEdYA8HeevQT/FULhxzR99pxphltZcVaugps53THCeiWA8SguxxpSp3gKPiuYfSWopkLQ4hw== - -"@babel/helper-module-imports@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.27.1.tgz#7ef769a323e2655e126673bb6d2d6913bbead204" - integrity sha512-0gSFWUPNXNopqtIPQvlD5WgXYI5GY2kP2cCvoT8kczjbfcfuIljTbcWrulD1CIPIX2gt1wghbDy08yE1p+/r3w== - dependencies: - "@babel/traverse" "^7.27.1" - "@babel/types" "^7.27.1" - -"@babel/helper-module-transforms@^7.27.3": - version "7.27.3" - resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.27.3.tgz#db0bbcfba5802f9ef7870705a7ef8788508ede02" - integrity sha512-dSOvYwvyLsWBeIRyOeHXp5vPj5l1I011r52FM1+r1jCERv+aFXYk4whgQccYEGYxK2H3ZAIA8nuPkQ0HaUo3qg== - dependencies: - "@babel/helper-module-imports" "^7.27.1" - "@babel/helper-validator-identifier" "^7.27.1" - "@babel/traverse" "^7.27.3" - -"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.14.5", "@babel/helper-plugin-utils@^7.27.1", "@babel/helper-plugin-utils@^7.8.0": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.27.1.tgz#ddb2f876534ff8013e6c2b299bf4d39b3c51d44c" - integrity sha512-1gn1Up5YXka3YYAHGKpbideQ5Yjf1tDa9qYcgysz+cNCXukyLl6DjPXhD3VRwSb8c0J9tA4b2+rHEZtc6R0tlw== - -"@babel/helper-string-parser@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz#54da796097ab19ce67ed9f88b47bb2ec49367687" - integrity sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA== - -"@babel/helper-validator-identifier@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.27.1.tgz#a7054dcc145a967dd4dc8fee845a57c1316c9df8" - integrity sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow== - -"@babel/helper-validator-option@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.27.1.tgz#fa52f5b1e7db1ab049445b421c4471303897702f" - integrity sha512-YvjJow9FxbhFFKDSuFnVCe2WxXk1zWc22fFePVNEaWJEu8IrZVlda6N0uHwzZrUM1il7NC9Mlp4MaJYbYd9JSg== - -"@babel/helpers@^7.27.6": - version "7.28.2" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.28.2.tgz#80f0918fecbfebea9af856c419763230040ee850" - integrity sha512-/V9771t+EgXz62aCcyofnQhGM8DQACbRhvzKFsXKC9QM+5MadF8ZmIm0crDMaz3+o0h0zXfJnd4EhbYbxsrcFw== - dependencies: - "@babel/template" "^7.27.2" - "@babel/types" "^7.28.2" +"@babel/helper-globals@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/helper-globals/-/helper-globals-7.29.7.tgz#f04a96fbd8473241b1079243f5b3f03a3010ab7b" + integrity sha512-3nQVUAtvkKH9zahfWgw96Jc/uFOmjACE1kQz82E2lqWmHBgjzbNlsC22nuQTfahmWeQtTq5nQ/4Nnd2A1wj4zA== -"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.20.7", "@babel/parser@^7.27.2", "@babel/parser@^7.28.0": - version "7.28.0" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.28.0.tgz#979829fbab51a29e13901e5a80713dbcb840825e" - integrity sha512-jVZGvOxOuNSsuQuLRTh13nU0AogFlw32w/MT+LV6D3sP5WdbW61E77RnkbaO2dUvmPAYrBDJXGn5gGS6tH4j8g== +"@babel/helper-module-imports@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.29.7.tgz#ef25048a518e828d7393fac5882ddd73921d7396" + integrity sha512-ejHwrQQYcm9xnTivShn2IDOlIzInN34AXskvq9QicvCtEzq1Vzclu/tKF8Jq1Cg8JG2GL6/EmjgsCT7lXepE3g== + dependencies: + "@babel/traverse" "^7.29.7" + "@babel/types" "^7.29.7" + +"@babel/helper-module-transforms@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.29.7.tgz#b062747a5997ba138637201328bbff77960574ae" + integrity sha512-UPUVSyXbOh627KiCIGQSgwWzGeBKLkaJ9PJEdrngIwMSzxLR4jS4+f1f1jb7VzBbg8nFLaYotvVPFCTqdrmTAg== + dependencies: + "@babel/helper-module-imports" "^7.29.7" + "@babel/helper-validator-identifier" "^7.29.7" + "@babel/traverse" "^7.29.7" + +"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.14.5", "@babel/helper-plugin-utils@^7.29.7", "@babel/helper-plugin-utils@^7.8.0": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.29.7.tgz#c0a0766f1a13617d8a17407d7ab8f9d486225ea4" + integrity sha512-G7sHYigPY17oO5SYWnfD/0MTBwVR781S/JI643e/JhUYgVgWE/61SoW3NH9KWUKyKq5LVh3npif99Wkt6j86Jw== + +"@babel/helper-string-parser@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.29.7.tgz#7f0871d99824d23137d60f86fcf6130fd5a1b51f" + integrity sha512-Pb5ijPrZ89GDH8223L4UP8i6QApWxs04RbPQJTeWDV0/keR2E36MeKnyr6LYmUUvqRRI+Iv87SuF1W6ErINzYw== + +"@babel/helper-validator-identifier@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.29.7.tgz#bd87084ced0c796ec46bda492de6e83d29e89fc2" + integrity sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg== + +"@babel/helper-validator-option@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.29.7.tgz#cf315be940213b354eb4abcc0bd01ebe3f73bc2a" + integrity sha512-N9ZErrD+yW5geCDtBqnOoxmR8+tNKiGuxKlDpuJxfsqpa2dFcexaziGAE/qoHLiDDreVNMupxGmSoNlyvsA3gw== + +"@babel/helpers@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.29.7.tgz#45abfde7548997e34376c3e69feb475cffb4a607" + integrity sha512-1k2lAGRMfHTcwuNYcCNUmaUffmQv8KWMfh2iJUUeRlwlwH4FdNG7mfPI10NPfLHJFThE4Tyr4mv7kTNZOiPuBg== + dependencies: + "@babel/template" "^7.29.7" + "@babel/types" "^7.29.7" + +"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.20.7", "@babel/parser@^7.23.9", "@babel/parser@^7.29.7", "@babel/parser@^7.29.8": + version "7.29.8" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.29.8.tgz#9653716a2f10c677b98fbc63d4bfb000c302cf17" + integrity sha512-E8lTAYNB1KW+FH+VGJuZM1ioAx2E6oVlvQFRrf5P8ZZmsiJXYAD9vTFV7yyEURNzgh1dFqMZuO6tUwcARbqFCA== dependencies: - "@babel/types" "^7.28.0" + "@babel/types" "^7.29.8" "@babel/plugin-syntax-async-generators@^7.8.4": version "7.8.4" @@ -153,11 +150,11 @@ "@babel/helper-plugin-utils" "^7.14.5" "@babel/plugin-syntax-import-attributes@^7.24.7": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-attributes/-/plugin-syntax-import-attributes-7.27.1.tgz#34c017d54496f9b11b61474e7ea3dfd5563ffe07" - integrity sha512-oFT0FrKHgF53f4vOsZGi2Hh3I35PfSmVs4IBFLFj4dnafP+hIWDLg3VyKmUHfLoLHlyxY4C7DGtmHuJgn+IGww== + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-attributes/-/plugin-syntax-import-attributes-7.29.7.tgz#6115264516e95ead0f35a41710906612e447f605" + integrity sha512-zGYcYfq/WmZ4V+kBIXQon9dSSc8ircGZqw9ZaNhhGj9nZkeBu1jHLBDQqYYi5WA9uawvA2sIMbry2nCFhf5Djg== dependencies: - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-plugin-utils" "^7.29.7" "@babel/plugin-syntax-import-meta@^7.10.4": version "7.10.4" @@ -173,6 +170,13 @@ dependencies: "@babel/helper-plugin-utils" "^7.8.0" +"@babel/plugin-syntax-jsx@^7.7.2": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.29.7.tgz#622c16f9ad63782fe6e83dadc7e40330744b7f1e" + integrity sha512-TSu8+mHCoEaaCDEZ0I3+6mvTBYR4PCxQwf2z9/r5Tbztv6NaLR3B9thGTTxX2WGuGHJqRiAbKPeGTJ5XWXVg6A== + dependencies: + "@babel/helper-plugin-utils" "^7.29.7" + "@babel/plugin-syntax-logical-assignment-operators@^7.10.4": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz#ca91ef46303530448b906652bac2e9fe9941f699" @@ -230,455 +234,54 @@ "@babel/helper-plugin-utils" "^7.14.5" "@babel/plugin-syntax-typescript@^7.7.2": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.27.1.tgz#5147d29066a793450f220c63fa3a9431b7e6dd18" - integrity sha512-xfYCBMxveHrRMnAWl1ZlPXOZjzkN82THFvLhQhFXFt81Z5HnN+EtUkZhv/zcKpmT3fzmWZB0ywiBrbC3vogbwQ== - dependencies: - "@babel/helper-plugin-utils" "^7.27.1" - -"@babel/runtime@^7.15.4": - version "7.28.2" - resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.28.2.tgz#2ae5a9d51cc583bd1f5673b3bb70d6d819682473" - integrity sha512-KHp2IflsnGywDjBWDkR9iEqiWSpc8GIi0lgTT3mOElT0PP1tG26P4tmFI2YvAdzgq9RGyoHZQEIEdZy6Ec5xCA== - -"@babel/template@^7.27.2", "@babel/template@^7.3.3": - version "7.27.2" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.27.2.tgz#fa78ceed3c4e7b63ebf6cb39e5852fca45f6809d" - integrity sha512-LPDZ85aEJyYSd18/DkjNh4/y1ntkE5KwUHWTiqgRxruuZL2F1yuHligVHLvcHY2vMHXttKFpJn6LwfI7cw7ODw== - dependencies: - "@babel/code-frame" "^7.27.1" - "@babel/parser" "^7.27.2" - "@babel/types" "^7.27.1" - -"@babel/traverse@^7.27.1", "@babel/traverse@^7.27.3", "@babel/traverse@^7.28.0", "@babel/traverse@^7.7.2": - version "7.28.0" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.28.0.tgz#518aa113359b062042379e333db18380b537e34b" - integrity sha512-mGe7UK5wWyh0bKRfupsUchrQGqvDbZDbKJw+kcRGSmdHVYrv+ltd0pnpDTVpiTqnaBru9iEvA8pz8W46v0Amwg== - dependencies: - "@babel/code-frame" "^7.27.1" - "@babel/generator" "^7.28.0" - "@babel/helper-globals" "^7.28.0" - "@babel/parser" "^7.28.0" - "@babel/template" "^7.27.2" - "@babel/types" "^7.28.0" + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.29.7.tgz#7c29388932313ed58413a0343048d75d92fb5b24" + integrity sha512-ngr+82Sh0xMz25TPCZi+nC2iTzjfCdWS2ONXTp/PtSCHCgaCNBpdMqgvJ2ccdLlClVZ7sisIgB914j/JFe+RZA== + dependencies: + "@babel/helper-plugin-utils" "^7.29.7" + +"@babel/template@^7.29.7", "@babel/template@^7.3.3": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.29.7.tgz#4d9d4004f645cdd304de958c725162784ecac700" + integrity sha512-puq+Gf35oI24FeN11LkoUQFqv9uwNeWpxXZi/Ji3rRIoKAzKnxRaZ+Gkj0vKS9ZCiTESfng1N9LyOyXvo+m+Gg== + dependencies: + "@babel/code-frame" "^7.29.7" + "@babel/parser" "^7.29.7" + "@babel/types" "^7.29.7" + +"@babel/traverse@^7.29.7": + version "7.29.8" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.29.8.tgz#4111014cdc71a0f95d9471907590baa0b8a6b28a" + integrity sha512-I5z7H3bf/41ktsNVLtpN0wAa336HkqIHQ5BuPLEhTkt1jVSyZpeNKIzTgEWmlxjdg81R0IgUCcaE+Ok3NvrfZg== + dependencies: + "@babel/code-frame" "^7.29.7" + "@babel/generator" "^7.29.8" + "@babel/helper-globals" "^7.29.7" + "@babel/parser" "^7.29.8" + "@babel/template" "^7.29.7" + "@babel/types" "^7.29.8" debug "^4.3.1" -"@babel/types@^7.0.0", "@babel/types@^7.20.7", "@babel/types@^7.27.1", "@babel/types@^7.28.0", "@babel/types@^7.28.2", "@babel/types@^7.3.3": - version "7.28.2" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.28.2.tgz#da9db0856a9a88e0a13b019881d7513588cf712b" - integrity sha512-ruv7Ae4J5dUYULmeXw1gmb7rYRz57OWCPM57pHojnLq/3Z1CK2lNSLTCVjxVk1F/TZHwOZZrOWi0ur95BbLxNQ== +"@babel/types@^7.0.0", "@babel/types@^7.20.7", "@babel/types@^7.28.2", "@babel/types@^7.29.7", "@babel/types@^7.29.8", "@babel/types@^7.3.3": + version "7.29.8" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.29.8.tgz#1229eef31d85156d70fa3f4cd859376d0eaf6863" + integrity sha512-Vj1jF3cPfxg7OAfoI7QnVKLoILlm2JF9pnVHrX8qx7AHMiYWT+NDAA7jChlNgRS4WTLc/fD1lXLmPixluj+3Gg== dependencies: - "@babel/helper-string-parser" "^7.27.1" - "@babel/helper-validator-identifier" "^7.27.1" + "@babel/helper-string-parser" "^7.29.7" + "@babel/helper-validator-identifier" "^7.29.7" "@bcoe/v8-coverage@^0.2.3": version "0.2.3" resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@bitcoinerlab/secp256k1@^1.1.1": +"@bitcoinerlab/secp256k1@^1.2.0": version "1.2.0" resolved "https://registry.yarnpkg.com/@bitcoinerlab/secp256k1/-/secp256k1-1.2.0.tgz#429d043ef4218b9c71915b50172e9aa4a2a8fea4" integrity sha512-jeujZSzb3JOZfmJYI0ph1PVpCRV5oaexCgy+RvCXV8XlY+XFB/2n3WOcvBsKLsOw78KYgnQrQWb2HrKE4be88Q== dependencies: "@noble/curves" "^1.7.0" -"@ethereumjs/common@2.6.5", "@ethereumjs/common@^2.6.4": - version "2.6.5" - resolved "https://registry.yarnpkg.com/@ethereumjs/common/-/common-2.6.5.tgz#0a75a22a046272579d91919cb12d84f2756e8d30" - integrity sha512-lRyVQOeCDaIVtgfbowla32pzeDv2Obr8oR8Put5RdUBNRGr1VGPGQNGP6elWIpgK3YdpzqTOh4GyUGOureVeeA== - dependencies: - crc-32 "^1.2.0" - ethereumjs-util "^7.1.5" - -"@ethereumjs/rlp@^4.0.1": - version "4.0.1" - resolved "https://registry.yarnpkg.com/@ethereumjs/rlp/-/rlp-4.0.1.tgz#626fabfd9081baab3d0a3074b0c7ecaf674aaa41" - integrity sha512-tqsQiBQDQdmPWE1xkkBq4rlSW5QZpLOUJ5RJh2/9fug+q9tnUhuZoVLk7s0scUIKTOzEtR72DFBXI4WiZcMpvw== - -"@ethereumjs/tx@3.5.2": - version "3.5.2" - resolved "https://registry.yarnpkg.com/@ethereumjs/tx/-/tx-3.5.2.tgz#197b9b6299582ad84f9527ca961466fce2296c1c" - integrity sha512-gQDNJWKrSDGu2w7w0PzVXVBNMzb7wwdDOmOqczmhNjqFxFuIbhVJDwiGEnxFNC2/b8ifcZzY7MLcluizohRzNw== - dependencies: - "@ethereumjs/common" "^2.6.4" - ethereumjs-util "^7.1.5" - -"@ethereumjs/util@^8.1.0": - version "8.1.0" - resolved "https://registry.yarnpkg.com/@ethereumjs/util/-/util-8.1.0.tgz#299df97fb6b034e0577ce9f94c7d9d1004409ed4" - integrity sha512-zQ0IqbdX8FZ9aw11vP+dZkKDkS+kgIvQPHnSAXzP9pLu+Rfu3D3XEeLbicvoXJTYnhZiPmsZUxgdzXwNKxRPbA== - dependencies: - "@ethereumjs/rlp" "^4.0.1" - ethereum-cryptography "^2.0.0" - micro-ftch "^0.3.1" - -"@ethersproject/abi@5.8.0", "@ethersproject/abi@^5.6.3", "@ethersproject/abi@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/abi/-/abi-5.8.0.tgz#e79bb51940ac35fe6f3262d7fe2cdb25ad5f07d9" - integrity sha512-b9YS/43ObplgyV6SlyQsG53/vkSal0MNA1fskSC4mbnCMi8R+NkcH8K9FPYNESf6jUefBUniE4SOKms0E/KK1Q== - dependencies: - "@ethersproject/address" "^5.8.0" - "@ethersproject/bignumber" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/constants" "^5.8.0" - "@ethersproject/hash" "^5.8.0" - "@ethersproject/keccak256" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - "@ethersproject/strings" "^5.8.0" - -"@ethersproject/abstract-provider@5.8.0", "@ethersproject/abstract-provider@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/abstract-provider/-/abstract-provider-5.8.0.tgz#7581f9be601afa1d02b95d26b9d9840926a35b0c" - integrity sha512-wC9SFcmh4UK0oKuLJQItoQdzS/qZ51EJegK6EmAWlh+OptpQ/npECOR3QqECd8iGHC0RJb4WKbVdSfif4ammrg== - dependencies: - "@ethersproject/bignumber" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/networks" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - "@ethersproject/transactions" "^5.8.0" - "@ethersproject/web" "^5.8.0" - -"@ethersproject/abstract-signer@5.8.0", "@ethersproject/abstract-signer@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/abstract-signer/-/abstract-signer-5.8.0.tgz#8d7417e95e4094c1797a9762e6789c7356db0754" - integrity sha512-N0XhZTswXcmIZQdYtUnd79VJzvEwXQw6PK0dTl9VoYrEBxxCPXqS0Eod7q5TNKRxe1/5WUMuR0u0nqTF/avdCA== - dependencies: - "@ethersproject/abstract-provider" "^5.8.0" - "@ethersproject/bignumber" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - -"@ethersproject/address@5.8.0", "@ethersproject/address@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/address/-/address-5.8.0.tgz#3007a2c352eee566ad745dca1dbbebdb50a6a983" - integrity sha512-GhH/abcC46LJwshoN+uBNoKVFPxUuZm6dA257z0vZkKmU1+t8xTn8oK7B9qrj8W2rFRMch4gbJl6PmVxjxBEBA== - dependencies: - "@ethersproject/bignumber" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/keccak256" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/rlp" "^5.8.0" - -"@ethersproject/base64@5.8.0", "@ethersproject/base64@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/base64/-/base64-5.8.0.tgz#61c669c648f6e6aad002c228465d52ac93ee83eb" - integrity sha512-lN0oIwfkYj9LbPx4xEkie6rAMJtySbpOAFXSDVQaBnAzYfB4X2Qr+FXJGxMoc3Bxp2Sm8OwvzMrywxyw0gLjIQ== - dependencies: - "@ethersproject/bytes" "^5.8.0" - -"@ethersproject/basex@5.8.0", "@ethersproject/basex@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/basex/-/basex-5.8.0.tgz#1d279a90c4be84d1c1139114a1f844869e57d03a" - integrity sha512-PIgTszMlDRmNwW9nhS6iqtVfdTAKosA7llYXNmGPw4YAI1PUyMv28988wAb41/gHF/WqGdoLv0erHaRcHRKW2Q== - dependencies: - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - -"@ethersproject/bignumber@5.8.0", "@ethersproject/bignumber@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/bignumber/-/bignumber-5.8.0.tgz#c381d178f9eeb370923d389284efa19f69efa5d7" - integrity sha512-ZyaT24bHaSeJon2tGPKIiHszWjD/54Sz8t57Toch475lCLljC6MgPmxk7Gtzz+ddNN5LuHea9qhAe0x3D+uYPA== - dependencies: - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - bn.js "^5.2.1" - -"@ethersproject/bytes@5.8.0", "@ethersproject/bytes@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/bytes/-/bytes-5.8.0.tgz#9074820e1cac7507a34372cadeb035461463be34" - integrity sha512-vTkeohgJVCPVHu5c25XWaWQOZ4v+DkGoC42/TS2ond+PARCxTJvgTFUNDZovyQ/uAQ4EcpqqowKydcdmRKjg7A== - dependencies: - "@ethersproject/logger" "^5.8.0" - -"@ethersproject/constants@5.8.0", "@ethersproject/constants@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/constants/-/constants-5.8.0.tgz#12f31c2f4317b113a4c19de94e50933648c90704" - integrity sha512-wigX4lrf5Vu+axVTIvNsuL6YrV4O5AXl5ubcURKMEME5TnWBouUh0CDTWxZ2GpnRn1kcCgE7l8O5+VbV9QTTcg== - dependencies: - "@ethersproject/bignumber" "^5.8.0" - -"@ethersproject/contracts@5.8.0", "@ethersproject/contracts@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/contracts/-/contracts-5.8.0.tgz#243a38a2e4aa3e757215ea64e276f8a8c9d8ed73" - integrity sha512-0eFjGz9GtuAi6MZwhb4uvUM216F38xiuR0yYCjKJpNfSEy4HUM8hvqqBj9Jmm0IUz8l0xKEhWwLIhPgxNY0yvQ== - dependencies: - "@ethersproject/abi" "^5.8.0" - "@ethersproject/abstract-provider" "^5.8.0" - "@ethersproject/abstract-signer" "^5.8.0" - "@ethersproject/address" "^5.8.0" - "@ethersproject/bignumber" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/constants" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - "@ethersproject/transactions" "^5.8.0" - -"@ethersproject/hash@5.8.0", "@ethersproject/hash@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/hash/-/hash-5.8.0.tgz#b8893d4629b7f8462a90102572f8cd65a0192b4c" - integrity sha512-ac/lBcTbEWW/VGJij0CNSw/wPcw9bSRgCB0AIBz8CvED/jfvDoV9hsIIiWfvWmFEi8RcXtlNwp2jv6ozWOsooA== - dependencies: - "@ethersproject/abstract-signer" "^5.8.0" - "@ethersproject/address" "^5.8.0" - "@ethersproject/base64" "^5.8.0" - "@ethersproject/bignumber" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/keccak256" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - "@ethersproject/strings" "^5.8.0" - -"@ethersproject/hdnode@5.8.0", "@ethersproject/hdnode@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/hdnode/-/hdnode-5.8.0.tgz#a51ae2a50bcd48ef6fd108c64cbae5e6ff34a761" - integrity sha512-4bK1VF6E83/3/Im0ERnnUeWOY3P1BZml4ZD3wcH8Ys0/d1h1xaFt6Zc+Dh9zXf9TapGro0T4wvO71UTCp3/uoA== - dependencies: - "@ethersproject/abstract-signer" "^5.8.0" - "@ethersproject/basex" "^5.8.0" - "@ethersproject/bignumber" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/pbkdf2" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - "@ethersproject/sha2" "^5.8.0" - "@ethersproject/signing-key" "^5.8.0" - "@ethersproject/strings" "^5.8.0" - "@ethersproject/transactions" "^5.8.0" - "@ethersproject/wordlists" "^5.8.0" - -"@ethersproject/json-wallets@5.8.0", "@ethersproject/json-wallets@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/json-wallets/-/json-wallets-5.8.0.tgz#d18de0a4cf0f185f232eb3c17d5e0744d97eb8c9" - integrity sha512-HxblNck8FVUtNxS3VTEYJAcwiKYsBIF77W15HufqlBF9gGfhmYOJtYZp8fSDZtn9y5EaXTE87zDwzxRoTFk11w== - dependencies: - "@ethersproject/abstract-signer" "^5.8.0" - "@ethersproject/address" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/hdnode" "^5.8.0" - "@ethersproject/keccak256" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/pbkdf2" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - "@ethersproject/random" "^5.8.0" - "@ethersproject/strings" "^5.8.0" - "@ethersproject/transactions" "^5.8.0" - aes-js "3.0.0" - scrypt-js "3.0.1" - -"@ethersproject/keccak256@5.8.0", "@ethersproject/keccak256@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/keccak256/-/keccak256-5.8.0.tgz#d2123a379567faf2d75d2aaea074ffd4df349e6a" - integrity sha512-A1pkKLZSz8pDaQ1ftutZoaN46I6+jvuqugx5KYNeQOPqq+JZ0Txm7dlWesCHB5cndJSu5vP2VKptKf7cksERng== - dependencies: - "@ethersproject/bytes" "^5.8.0" - js-sha3 "0.8.0" - -"@ethersproject/logger@5.8.0", "@ethersproject/logger@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/logger/-/logger-5.8.0.tgz#f0232968a4f87d29623a0481690a2732662713d6" - integrity sha512-Qe6knGmY+zPPWTC+wQrpitodgBfH7XoceCGL5bJVejmH+yCS3R8jJm8iiWuvWbG76RUmyEG53oqv6GMVWqunjA== - -"@ethersproject/networks@5.8.0", "@ethersproject/networks@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/networks/-/networks-5.8.0.tgz#8b4517a3139380cba9fb00b63ffad0a979671fde" - integrity sha512-egPJh3aPVAzbHwq8DD7Po53J4OUSsA1MjQp8Vf/OZPav5rlmWUaFLiq8cvQiGK0Z5K6LYzm29+VA/p4RL1FzNg== - dependencies: - "@ethersproject/logger" "^5.8.0" - -"@ethersproject/pbkdf2@5.8.0", "@ethersproject/pbkdf2@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/pbkdf2/-/pbkdf2-5.8.0.tgz#cd2621130e5dd51f6a0172e63a6e4a0c0a0ec37e" - integrity sha512-wuHiv97BrzCmfEaPbUFpMjlVg/IDkZThp9Ri88BpjRleg4iePJaj2SW8AIyE8cXn5V1tuAaMj6lzvsGJkGWskg== - dependencies: - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/sha2" "^5.8.0" - -"@ethersproject/properties@5.8.0", "@ethersproject/properties@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/properties/-/properties-5.8.0.tgz#405a8affb6311a49a91dabd96aeeae24f477020e" - integrity sha512-PYuiEoQ+FMaZZNGrStmN7+lWjlsoufGIHdww7454FIaGdbe/p5rnaCXTr5MtBYl3NkeoVhHZuyzChPeGeKIpQw== - dependencies: - "@ethersproject/logger" "^5.8.0" - -"@ethersproject/providers@5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/providers/-/providers-5.8.0.tgz#6c2ae354f7f96ee150439f7de06236928bc04cb4" - integrity sha512-3Il3oTzEx3o6kzcg9ZzbE+oCZYyY+3Zh83sKkn4s1DZfTUjIegHnN2Cm0kbn9YFy45FDVcuCLLONhU7ny0SsCw== - dependencies: - "@ethersproject/abstract-provider" "^5.8.0" - "@ethersproject/abstract-signer" "^5.8.0" - "@ethersproject/address" "^5.8.0" - "@ethersproject/base64" "^5.8.0" - "@ethersproject/basex" "^5.8.0" - "@ethersproject/bignumber" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/constants" "^5.8.0" - "@ethersproject/hash" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/networks" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - "@ethersproject/random" "^5.8.0" - "@ethersproject/rlp" "^5.8.0" - "@ethersproject/sha2" "^5.8.0" - "@ethersproject/strings" "^5.8.0" - "@ethersproject/transactions" "^5.8.0" - "@ethersproject/web" "^5.8.0" - bech32 "1.1.4" - ws "8.18.0" - -"@ethersproject/random@5.8.0", "@ethersproject/random@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/random/-/random-5.8.0.tgz#1bced04d49449f37c6437c701735a1a022f0057a" - integrity sha512-E4I5TDl7SVqyg4/kkA/qTfuLWAQGXmSOgYyO01So8hLfwgKvYK5snIlzxJMk72IFdG/7oh8yuSqY2KX7MMwg+A== - dependencies: - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - -"@ethersproject/rlp@5.8.0", "@ethersproject/rlp@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/rlp/-/rlp-5.8.0.tgz#5a0d49f61bc53e051532a5179472779141451de5" - integrity sha512-LqZgAznqDbiEunaUvykH2JAoXTT9NV0Atqk8rQN9nx9SEgThA/WMx5DnW8a9FOufo//6FZOCHZ+XiClzgbqV9Q== - dependencies: - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - -"@ethersproject/sha2@5.8.0", "@ethersproject/sha2@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/sha2/-/sha2-5.8.0.tgz#8954a613bb78dac9b46829c0a95de561ef74e5e1" - integrity sha512-dDOUrXr9wF/YFltgTBYS0tKslPEKr6AekjqDW2dbn1L1xmjGR+9GiKu4ajxovnrDbwxAKdHjW8jNcwfz8PAz4A== - dependencies: - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - hash.js "1.1.7" - -"@ethersproject/signing-key@5.8.0", "@ethersproject/signing-key@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/signing-key/-/signing-key-5.8.0.tgz#9797e02c717b68239c6349394ea85febf8893119" - integrity sha512-LrPW2ZxoigFi6U6aVkFN/fa9Yx/+4AtIUe4/HACTvKJdhm0eeb107EVCIQcrLZkxaSIgc/eCrX8Q1GtbH+9n3w== - dependencies: - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - bn.js "^5.2.1" - elliptic "6.6.1" - hash.js "1.1.7" - -"@ethersproject/solidity@5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/solidity/-/solidity-5.8.0.tgz#429bb9fcf5521307a9448d7358c26b93695379b9" - integrity sha512-4CxFeCgmIWamOHwYN9d+QWGxye9qQLilpgTU0XhYs1OahkclF+ewO+3V1U0mvpiuQxm5EHHmv8f7ClVII8EHsA== - dependencies: - "@ethersproject/bignumber" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/keccak256" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/sha2" "^5.8.0" - "@ethersproject/strings" "^5.8.0" - -"@ethersproject/strings@5.8.0", "@ethersproject/strings@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/strings/-/strings-5.8.0.tgz#ad79fafbf0bd272d9765603215ac74fd7953908f" - integrity sha512-qWEAk0MAvl0LszjdfnZ2uC8xbR2wdv4cDabyHiBh3Cldq/T8dPH3V4BbBsAYJUeonwD+8afVXld274Ls+Y1xXg== - dependencies: - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/constants" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - -"@ethersproject/transactions@5.8.0", "@ethersproject/transactions@^5.6.2", "@ethersproject/transactions@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/transactions/-/transactions-5.8.0.tgz#1e518822403abc99def5a043d1c6f6fe0007e46b" - integrity sha512-UglxSDjByHG0TuU17bDfCemZ3AnKO2vYrL5/2n2oXvKzvb7Cz+W9gOWXKARjp2URVwcWlQlPOEQyAviKwT4AHg== - dependencies: - "@ethersproject/address" "^5.8.0" - "@ethersproject/bignumber" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/constants" "^5.8.0" - "@ethersproject/keccak256" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - "@ethersproject/rlp" "^5.8.0" - "@ethersproject/signing-key" "^5.8.0" - -"@ethersproject/units@5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/units/-/units-5.8.0.tgz#c12f34ba7c3a2de0e9fa0ed0ee32f3e46c5c2c6a" - integrity sha512-lxq0CAnc5kMGIiWW4Mr041VT8IhNM+Pn5T3haO74XZWFulk7wH1Gv64HqE96hT4a7iiNMdOCFEBgaxWuk8ETKQ== - dependencies: - "@ethersproject/bignumber" "^5.8.0" - "@ethersproject/constants" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - -"@ethersproject/wallet@5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/wallet/-/wallet-5.8.0.tgz#49c300d10872e6986d953e8310dc33d440da8127" - integrity sha512-G+jnzmgg6UxurVKRKvw27h0kvG75YKXZKdlLYmAHeF32TGUzHkOFd7Zn6QHOTYRFWnfjtSSFjBowKo7vfrXzPA== - dependencies: - "@ethersproject/abstract-provider" "^5.8.0" - "@ethersproject/abstract-signer" "^5.8.0" - "@ethersproject/address" "^5.8.0" - "@ethersproject/bignumber" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/hash" "^5.8.0" - "@ethersproject/hdnode" "^5.8.0" - "@ethersproject/json-wallets" "^5.8.0" - "@ethersproject/keccak256" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - "@ethersproject/random" "^5.8.0" - "@ethersproject/signing-key" "^5.8.0" - "@ethersproject/transactions" "^5.8.0" - "@ethersproject/wordlists" "^5.8.0" - -"@ethersproject/web@5.8.0", "@ethersproject/web@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/web/-/web-5.8.0.tgz#3e54badc0013b7a801463a7008a87988efce8a37" - integrity sha512-j7+Ksi/9KfGviws6Qtf9Q7KCqRhpwrYKQPs+JBA/rKVFF/yaWLHJEH3zfVP2plVu+eys0d2DlFmhoQJayFewcw== - dependencies: - "@ethersproject/base64" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - "@ethersproject/strings" "^5.8.0" - -"@ethersproject/wordlists@5.8.0", "@ethersproject/wordlists@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/wordlists/-/wordlists-5.8.0.tgz#7a5654ee8d1bb1f4dbe43f91d217356d650ad821" - integrity sha512-2df9bbXicZws2Sb5S6ET493uJ0Z84Fjr3pC4tu/qlnZERibZCeUVuqdtt+7Tv9xxhUxHoIekIA7avrKUWHrezg== - dependencies: - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/hash" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - "@ethersproject/strings" "^5.8.0" - -"@isaacs/balanced-match@^4.0.1": - version "4.0.1" - resolved "https://registry.yarnpkg.com/@isaacs/balanced-match/-/balanced-match-4.0.1.tgz#3081dadbc3460661b751e7591d7faea5df39dd29" - integrity sha512-yzMTt9lEb8Gv7zRioUilSglI0c0smZ9k5D65677DLWLtWJaXIS3CqcGyUFByYKlnUj6TkjLVs54fBl6+TiGQDQ== - -"@isaacs/brace-expansion@^5.0.0": - version "5.0.0" - resolved "https://registry.yarnpkg.com/@isaacs/brace-expansion/-/brace-expansion-5.0.0.tgz#4b3dabab7d8e75a429414a96bd67bf4c1d13e0f3" - integrity sha512-ZT55BDLV0yv0RBm2czMiZ+SqCGO7AvmOM3G/w2xhVPH+te0aKgFjmBvGlL1dH+ql2tgGO3MVrbb3jCKyvpgnxA== - dependencies: - "@isaacs/balanced-match" "^4.0.1" - -"@isaacs/cliui@^8.0.2": - version "8.0.2" - resolved "https://registry.yarnpkg.com/@isaacs/cliui/-/cliui-8.0.2.tgz#b37667b7bc181c168782259bab42474fbf52b550" - integrity sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA== - dependencies: - string-width "^5.1.2" - string-width-cjs "npm:string-width@^4.2.0" - strip-ansi "^7.0.1" - strip-ansi-cjs "npm:strip-ansi@^6.0.1" - wrap-ansi "^8.1.0" - wrap-ansi-cjs "npm:wrap-ansi@^7.0.0" - "@istanbuljs/load-nyc-config@^1.0.0": version "1.1.0" resolved "https://registry.yarnpkg.com/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz#fd3db1d59ecf7cf121e80650bb86712f9b55eced" @@ -690,337 +293,294 @@ js-yaml "^3.13.1" resolve-from "^5.0.0" -"@istanbuljs/schema@^0.1.2": - version "0.1.3" - resolved "https://registry.yarnpkg.com/@istanbuljs/schema/-/schema-0.1.3.tgz#e45e384e4b8ec16bce2fd903af78450f6bf7ec98" - integrity sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA== +"@istanbuljs/schema@^0.1.2", "@istanbuljs/schema@^0.1.3": + version "0.1.6" + resolved "https://registry.yarnpkg.com/@istanbuljs/schema/-/schema-0.1.6.tgz#8dc9afa2ac1506cb1a58f89940f1c124446c8df3" + integrity sha512-+Sg6GCR/wy1oSmQDFq4LQDAhm3ETKnorxN+y5nbLULOR3P0c14f2Wurzj3/xqPXtasLFfHd5iRFQ7AJt4KH2cw== -"@jest/console@^27.5.1": - version "27.5.1" - resolved "https://registry.yarnpkg.com/@jest/console/-/console-27.5.1.tgz#260fe7239602fe5130a94f1aa386eff54b014bba" - integrity sha512-kZ/tNpS3NXn0mlXXXPNuDZnb4c0oZ20r4K5eemM2k30ZC3G0T02nXUvyhf5YdbXWHPEJLc9qGLxEZ216MdL+Zg== +"@jest/console@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/console/-/console-29.7.0.tgz#cd4822dbdb84529265c5a2bdb529a3c9cc950ffc" + integrity sha512-5Ni4CU7XHQi32IJ398EEP4RrB8eV09sXP2ROqD4bksHrnTree52PsxvX8tpL8LvTZ3pFzXyPbNQReSN41CAhOg== dependencies: - "@jest/types" "^27.5.1" + "@jest/types" "^29.6.3" "@types/node" "*" chalk "^4.0.0" - jest-message-util "^27.5.1" - jest-util "^27.5.1" + jest-message-util "^29.7.0" + jest-util "^29.7.0" slash "^3.0.0" -"@jest/core@^27.5.1": - version "27.5.1" - resolved "https://registry.yarnpkg.com/@jest/core/-/core-27.5.1.tgz#267ac5f704e09dc52de2922cbf3af9edcd64b626" - integrity sha512-AK6/UTrvQD0Cd24NSqmIA6rKsu0tKIxfiCducZvqxYdmMisOYAsdItspT+fQDQYARPf8XgjAFZi0ogW2agH5nQ== +"@jest/core@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/core/-/core-29.7.0.tgz#b6cccc239f30ff36609658c5a5e2291757ce448f" + integrity sha512-n7aeXWKMnGtDA48y8TLWJPJmLmmZ642Ceo78cYWEpiD7FzDgmNDV/GCVRorPABdXLJZ/9wzzgZAlHjXjxDHGsg== dependencies: - "@jest/console" "^27.5.1" - "@jest/reporters" "^27.5.1" - "@jest/test-result" "^27.5.1" - "@jest/transform" "^27.5.1" - "@jest/types" "^27.5.1" + "@jest/console" "^29.7.0" + "@jest/reporters" "^29.7.0" + "@jest/test-result" "^29.7.0" + "@jest/transform" "^29.7.0" + "@jest/types" "^29.6.3" "@types/node" "*" ansi-escapes "^4.2.1" chalk "^4.0.0" - emittery "^0.8.1" + ci-info "^3.2.0" exit "^0.1.2" graceful-fs "^4.2.9" - jest-changed-files "^27.5.1" - jest-config "^27.5.1" - jest-haste-map "^27.5.1" - jest-message-util "^27.5.1" - jest-regex-util "^27.5.1" - jest-resolve "^27.5.1" - jest-resolve-dependencies "^27.5.1" - jest-runner "^27.5.1" - jest-runtime "^27.5.1" - jest-snapshot "^27.5.1" - jest-util "^27.5.1" - jest-validate "^27.5.1" - jest-watcher "^27.5.1" + jest-changed-files "^29.7.0" + jest-config "^29.7.0" + jest-haste-map "^29.7.0" + jest-message-util "^29.7.0" + jest-regex-util "^29.6.3" + jest-resolve "^29.7.0" + jest-resolve-dependencies "^29.7.0" + jest-runner "^29.7.0" + jest-runtime "^29.7.0" + jest-snapshot "^29.7.0" + jest-util "^29.7.0" + jest-validate "^29.7.0" + jest-watcher "^29.7.0" micromatch "^4.0.4" - rimraf "^3.0.0" + pretty-format "^29.7.0" slash "^3.0.0" strip-ansi "^6.0.0" -"@jest/environment@^27.5.1": - version "27.5.1" - resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-27.5.1.tgz#d7425820511fe7158abbecc010140c3fd3be9c74" - integrity sha512-/WQjhPJe3/ghaol/4Bq480JKXV/Rfw8nQdN7f41fM8VDHLcxKXou6QyXAh3EFr9/bVG3x74z1NWDkP87EiY8gA== +"@jest/environment@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-29.7.0.tgz#24d61f54ff1f786f3cd4073b4b94416383baf2a7" + integrity sha512-aQIfHDq33ExsN4jP1NWGXhxgQ/wixs60gDiKO+XVMd8Mn0NWPWgc34ZQDTb2jKaUWQ7MuwoitXAsN2XVXNMpAw== dependencies: - "@jest/fake-timers" "^27.5.1" - "@jest/types" "^27.5.1" + "@jest/fake-timers" "^29.7.0" + "@jest/types" "^29.6.3" "@types/node" "*" - jest-mock "^27.5.1" + jest-mock "^29.7.0" + +"@jest/expect-utils@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/expect-utils/-/expect-utils-29.7.0.tgz#023efe5d26a8a70f21677d0a1afc0f0a44e3a1c6" + integrity sha512-GlsNBWiFQFCVi9QVSx7f5AgMeLxe9YCCs5PuP2O2LdjDAA8Jh9eX7lA1Jq/xdXw3Wb3hyvlFNfZIfcRetSzYcA== + dependencies: + jest-get-type "^29.6.3" -"@jest/fake-timers@^27.5.1": - version "27.5.1" - resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-27.5.1.tgz#76979745ce0579c8a94a4678af7a748eda8ada74" - integrity sha512-/aPowoolwa07k7/oM3aASneNeBGCmGQsc3ugN4u6s4C/+s5M64MFo/+djTdiwcbQlRfFElGuDXWzaWj6QgKObQ== +"@jest/expect@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/expect/-/expect-29.7.0.tgz#76a3edb0cb753b70dfbfe23283510d3d45432bf2" + integrity sha512-8uMeAMycttpva3P1lBHB8VciS9V0XAr3GymPpipdyQXbBcuhkLQOSe8E/p92RyAdToS6ZD1tFkX+CkhoECE0dQ== dependencies: - "@jest/types" "^27.5.1" - "@sinonjs/fake-timers" "^8.0.1" + expect "^29.7.0" + jest-snapshot "^29.7.0" + +"@jest/fake-timers@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-29.7.0.tgz#fd91bf1fffb16d7d0d24a426ab1a47a49881a565" + integrity sha512-q4DH1Ha4TTFPdxLsqDXK1d3+ioSL7yL5oCMJZgDYm6i+6CygW5E5xVr/D1HdsGxjt1ZWSfUAs9OxSB/BNelWrQ== + dependencies: + "@jest/types" "^29.6.3" + "@sinonjs/fake-timers" "^10.0.2" "@types/node" "*" - jest-message-util "^27.5.1" - jest-mock "^27.5.1" - jest-util "^27.5.1" + jest-message-util "^29.7.0" + jest-mock "^29.7.0" + jest-util "^29.7.0" -"@jest/globals@^27.5.1": - version "27.5.1" - resolved "https://registry.yarnpkg.com/@jest/globals/-/globals-27.5.1.tgz#7ac06ce57ab966566c7963431cef458434601b2b" - integrity sha512-ZEJNB41OBQQgGzgyInAv0UUfDDj3upmHydjieSxFvTRuZElrx7tXg/uVQ5hYVEwiXs3+aMsAeEc9X7xiSKCm4Q== +"@jest/globals@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/globals/-/globals-29.7.0.tgz#8d9290f9ec47ff772607fa864ca1d5a2efae1d4d" + integrity sha512-mpiz3dutLbkW2MNFubUGUEVLkTGiqW6yLVTA+JbP6fI6J5iL9Y0Nlg8k95pcF8ctKwCS7WVxteBs29hhfAotzQ== dependencies: - "@jest/environment" "^27.5.1" - "@jest/types" "^27.5.1" - expect "^27.5.1" + "@jest/environment" "^29.7.0" + "@jest/expect" "^29.7.0" + "@jest/types" "^29.6.3" + jest-mock "^29.7.0" -"@jest/reporters@^27.5.1": - version "27.5.1" - resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-27.5.1.tgz#ceda7be96170b03c923c37987b64015812ffec04" - integrity sha512-cPXh9hWIlVJMQkVk84aIvXuBB4uQQmFqZiacloFuGiP3ah1sbCxCosidXFDfqG8+6fO1oR2dTJTlsOy4VFmUfw== +"@jest/reporters@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-29.7.0.tgz#04b262ecb3b8faa83b0b3d321623972393e8f4c7" + integrity sha512-DApq0KJbJOEzAFYjHADNNxAE3KbhxQB1y5Kplb5Waqw6zVbuWatSnMjE5gs8FUgEPmNsnZA3NCWl9NG0ia04Pg== dependencies: "@bcoe/v8-coverage" "^0.2.3" - "@jest/console" "^27.5.1" - "@jest/test-result" "^27.5.1" - "@jest/transform" "^27.5.1" - "@jest/types" "^27.5.1" + "@jest/console" "^29.7.0" + "@jest/test-result" "^29.7.0" + "@jest/transform" "^29.7.0" + "@jest/types" "^29.6.3" + "@jridgewell/trace-mapping" "^0.3.18" "@types/node" "*" chalk "^4.0.0" collect-v8-coverage "^1.0.0" exit "^0.1.2" - glob "^7.1.2" + glob "^7.1.3" graceful-fs "^4.2.9" istanbul-lib-coverage "^3.0.0" - istanbul-lib-instrument "^5.1.0" + istanbul-lib-instrument "^6.0.0" istanbul-lib-report "^3.0.0" istanbul-lib-source-maps "^4.0.0" istanbul-reports "^3.1.3" - jest-haste-map "^27.5.1" - jest-resolve "^27.5.1" - jest-util "^27.5.1" - jest-worker "^27.5.1" + jest-message-util "^29.7.0" + jest-util "^29.7.0" + jest-worker "^29.7.0" slash "^3.0.0" - source-map "^0.6.0" string-length "^4.0.1" - terminal-link "^2.0.0" - v8-to-istanbul "^8.1.0" + strip-ansi "^6.0.0" + v8-to-istanbul "^9.0.1" + +"@jest/schemas@^29.6.3": + version "29.6.3" + resolved "https://registry.yarnpkg.com/@jest/schemas/-/schemas-29.6.3.tgz#430b5ce8a4e0044a7e3819663305a7b3091c8e03" + integrity sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA== + dependencies: + "@sinclair/typebox" "^0.27.8" -"@jest/source-map@^27.5.1": - version "27.5.1" - resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-27.5.1.tgz#6608391e465add4205eae073b55e7f279e04e8cf" - integrity sha512-y9NIHUYF3PJRlHk98NdC/N1gl88BL08aQQgu4k4ZopQkCw9t9cV8mtl3TV8b/YCB8XaVTFrmUTAJvjsntDireg== +"@jest/source-map@^29.6.3": + version "29.6.3" + resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-29.6.3.tgz#d90ba772095cf37a34a5eb9413f1b562a08554c4" + integrity sha512-MHjT95QuipcPrpLM+8JMSzFx6eHp5Bm+4XeFDJlwsvVBjmKNiIAvasGK2fxz2WbGRlnvqehFbh07MMa7n3YJnw== dependencies: + "@jridgewell/trace-mapping" "^0.3.18" callsites "^3.0.0" graceful-fs "^4.2.9" - source-map "^0.6.0" -"@jest/test-result@^27.5.1": - version "27.5.1" - resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-27.5.1.tgz#56a6585fa80f7cdab72b8c5fc2e871d03832f5bb" - integrity sha512-EW35l2RYFUcUQxFJz5Cv5MTOxlJIQs4I7gxzi2zVU7PJhOwfYq1MdC5nhSmYjX1gmMmLPvB3sIaC+BkcHRBfag== +"@jest/test-result@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-29.7.0.tgz#8db9a80aa1a097bb2262572686734baed9b1657c" + integrity sha512-Fdx+tv6x1zlkJPcWXmMDAG2HBnaR9XPSd5aDWQVsfrZmLVT3lU1cwyxLgRmXR9yrq4NBoEm9BMsfgFzTQAbJYA== dependencies: - "@jest/console" "^27.5.1" - "@jest/types" "^27.5.1" + "@jest/console" "^29.7.0" + "@jest/types" "^29.6.3" "@types/istanbul-lib-coverage" "^2.0.0" collect-v8-coverage "^1.0.0" -"@jest/test-sequencer@^27.5.1": - version "27.5.1" - resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-27.5.1.tgz#4057e0e9cea4439e544c6353c6affe58d095745b" - integrity sha512-LCheJF7WB2+9JuCS7VB/EmGIdQuhtqjRNI9A43idHv3E4KltCTsPsLxvdaubFHSYwY/fNjMWjl6vNRhDiN7vpQ== +"@jest/test-sequencer@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-29.7.0.tgz#6cef977ce1d39834a3aea887a1726628a6f072ce" + integrity sha512-GQwJ5WZVrKnOJuiYiAF52UNUJXgTZx1NHjFSEB0qEMmSZKAkdMoIzw/Cj6x6NF4AvV23AUqDpFzQkN/eYCYTxw== dependencies: - "@jest/test-result" "^27.5.1" + "@jest/test-result" "^29.7.0" graceful-fs "^4.2.9" - jest-haste-map "^27.5.1" - jest-runtime "^27.5.1" + jest-haste-map "^29.7.0" + slash "^3.0.0" -"@jest/transform@^27.5.1": - version "27.5.1" - resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-27.5.1.tgz#6c3501dcc00c4c08915f292a600ece5ecfe1f409" - integrity sha512-ipON6WtYgl/1329g5AIJVbUuEh0wZVbdpGwC99Jw4LwuoBNS95MVphU6zOeD9pDkon+LLbFL7lOQRapbB8SCHw== +"@jest/transform@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-29.7.0.tgz#df2dd9c346c7d7768b8a06639994640c642e284c" + integrity sha512-ok/BTPFzFKVMwO5eOHRrvnBVHdRy9IrsrW1GpMaQ9MCnilNLXQKmAX8s1YXDFaai9xJpac2ySzV0YeRRECr2Vw== dependencies: - "@babel/core" "^7.1.0" - "@jest/types" "^27.5.1" + "@babel/core" "^7.11.6" + "@jest/types" "^29.6.3" + "@jridgewell/trace-mapping" "^0.3.18" babel-plugin-istanbul "^6.1.1" chalk "^4.0.0" - convert-source-map "^1.4.0" - fast-json-stable-stringify "^2.0.0" + convert-source-map "^2.0.0" + fast-json-stable-stringify "^2.1.0" graceful-fs "^4.2.9" - jest-haste-map "^27.5.1" - jest-regex-util "^27.5.1" - jest-util "^27.5.1" + jest-haste-map "^29.7.0" + jest-regex-util "^29.6.3" + jest-util "^29.7.0" micromatch "^4.0.4" pirates "^4.0.4" slash "^3.0.0" - source-map "^0.6.1" - write-file-atomic "^3.0.0" + write-file-atomic "^4.0.2" -"@jest/types@^27.5.1": - version "27.5.1" - resolved "https://registry.yarnpkg.com/@jest/types/-/types-27.5.1.tgz#3c79ec4a8ba61c170bf937bcf9e98a9df175ec80" - integrity sha512-Cx46iJ9QpwQTjIdq5VJu2QTMMs3QlEjI0x1QbBP5W1+nMzyc2XmimiRR/CbX9TO0cPTeUlxWMOu8mslYsJ8DEw== +"@jest/types@^29.6.3": + version "29.6.3" + resolved "https://registry.yarnpkg.com/@jest/types/-/types-29.6.3.tgz#1131f8cf634e7e84c5e77bab12f052af585fba59" + integrity sha512-u3UPsIilWKOM3F9CXtrG8LEJmNxwoCQC/XVj4IKYXvvpx7QIi/Kg1LI5uDmDpKlac62NUtX7eLjRh+jVZcLOzw== dependencies: + "@jest/schemas" "^29.6.3" "@types/istanbul-lib-coverage" "^2.0.0" "@types/istanbul-reports" "^3.0.0" "@types/node" "*" - "@types/yargs" "^16.0.0" + "@types/yargs" "^17.0.8" chalk "^4.0.0" "@jridgewell/gen-mapping@^0.3.12", "@jridgewell/gen-mapping@^0.3.5": - version "0.3.12" - resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.12.tgz#2234ce26c62889f03db3d7fea43c1932ab3e927b" - integrity sha512-OuLGC46TjB5BbN1dH8JULVVZY4WTdkF7tV9Ys6wLL1rubZnCMstOhNHueU5bLCrnRuDhKPDM4g6sw4Bel5Gzqg== + version "0.3.13" + resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz#6342a19f44347518c93e43b1ac69deb3c4656a1f" + integrity sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA== dependencies: "@jridgewell/sourcemap-codec" "^1.5.0" "@jridgewell/trace-mapping" "^0.3.24" +"@jridgewell/remapping@^2.3.5": + version "2.3.5" + resolved "https://registry.yarnpkg.com/@jridgewell/remapping/-/remapping-2.3.5.tgz#375c476d1972947851ba1e15ae8f123047445aa1" + integrity sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ== + dependencies: + "@jridgewell/gen-mapping" "^0.3.5" + "@jridgewell/trace-mapping" "^0.3.24" + "@jridgewell/resolve-uri@^3.1.0": version "3.1.2" resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz#7a0ee601f60f99a20c7c7c5ff0c80388c1189bd6" integrity sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw== "@jridgewell/sourcemap-codec@^1.4.14", "@jridgewell/sourcemap-codec@^1.5.0": - version "1.5.4" - resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.4.tgz#7358043433b2e5da569aa02cbc4c121da3af27d7" - integrity sha512-VT2+G1VQs/9oz078bLrYbecdZKs912zQlkelYpuf+SXF+QvZDYJlbx/LSx+meSAwdDFnF8FVXW92AVjjkVmgFw== + version "1.5.5" + resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz#6912b00d2c631c0d15ce1a7ab57cd657f2a8f8ba" + integrity sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og== -"@jridgewell/trace-mapping@^0.3.24", "@jridgewell/trace-mapping@^0.3.28": - version "0.3.29" - resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.29.tgz#a58d31eaadaf92c6695680b2e1d464a9b8fbf7fc" - integrity sha512-uw6guiW/gcAGPDhLmd77/6lW8QLeiV5RUTsAX46Db6oLhGaVj4lhnPwb184s1bkc8kdVg/+h988dro8GRDpmYQ== +"@jridgewell/trace-mapping@^0.3.12", "@jridgewell/trace-mapping@^0.3.18", "@jridgewell/trace-mapping@^0.3.24", "@jridgewell/trace-mapping@^0.3.28": + version "0.3.31" + resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz#db15d6781c931f3a251a3dac39501c98a6082fd0" + integrity sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw== dependencies: "@jridgewell/resolve-uri" "^3.1.0" "@jridgewell/sourcemap-codec" "^1.4.14" -"@noble/curves@1.4.2", "@noble/curves@~1.4.0": - version "1.4.2" - resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.4.2.tgz#40309198c76ed71bc6dbf7ba24e81ceb4d0d1fe9" - integrity sha512-TavHr8qycMChk8UwMld0ZDRvatedkzWfH8IiaeGCfymOP5i0hSCozz9vHOL0nkwk7HRMlFnAiKpS2jrUmSybcw== +"@noble/curves@1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.2.0.tgz#92d7e12e4e49b23105a2555c6984d41733d65c35" + integrity sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw== dependencies: - "@noble/hashes" "1.4.0" + "@noble/hashes" "1.3.2" "@noble/curves@^1.7.0": - version "1.9.4" - resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.9.4.tgz#a748c6837ee7854a558cc3b951aedd87a5e7d6a5" - integrity sha512-2bKONnuM53lINoDrSmK8qP8W271ms7pygDhZt4SiLOoLwBtoHqeCFi6RG42V8zd3mLHuJFhU/Bmaqo4nX0/kBw== + version "1.9.7" + resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.9.7.tgz#79d04b4758a43e4bca2cbdc62e7771352fa6b951" + integrity sha512-gbKGcRUYIjA3/zCCNaWDciTMFI0dCkvou3TL8Zmy5Nc7sJ47a0jtOeZoTaMxkuqRo9cRhjOdZJXegxYE5FN/xw== dependencies: "@noble/hashes" "1.8.0" -"@noble/hashes@1.4.0", "@noble/hashes@~1.4.0": - version "1.4.0" - resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.4.0.tgz#45814aa329f30e4fe0ba49426f49dfccdd066426" - integrity sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg== +"@noble/hashes@1.3.2": + version "1.3.2" + resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.2.tgz#6f26dbc8fbc7205873ce3cee2f690eba0d421b39" + integrity sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ== -"@noble/hashes@1.8.0", "@noble/hashes@^1.2.0", "@noble/hashes@^1.4.0": +"@noble/hashes@1.8.0", "@noble/hashes@^1.2.0": version "1.8.0" resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.8.0.tgz#cee43d801fcef9644b11b8194857695acd5f815a" integrity sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A== -"@pollum-io/sysweb3-network@^1.0.96": - version "1.0.96" - resolved "https://registry.yarnpkg.com/@pollum-io/sysweb3-network/-/sysweb3-network-1.0.96.tgz#7bc358dc4c5f8bff4de18aaf7dabd190cdd867e9" - integrity sha512-iAtYGR8xa0sgRS601bXDbwKVu3yYIrF+hgJgsP1BKayVSsqJ+tJKyY8YBIxCcpyxlbu6mRgqPOhlwe2ZXYB4fQ== - dependencies: - axios "^0.26.1" - bip44-constants "^114.0.0" - bs58check "^2.1.2" - eth-chains "^1.0.0" - ethers "^5.6.9" - web3 "^1.7.1" - "@scure/base@^1.1.1": version "1.2.6" resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.2.6.tgz#ca917184b8231394dd8847509c67a0be522e59f6" integrity sha512-g/nm5FgUa//MCj1gV09zTJTaM6KBAHqLN907YVQqf7zC49+DcO4B1so4ZX07Ef10Twr6nuqYEH9GEggFXA4Fmg== -"@scure/base@~1.1.6": - version "1.1.9" - resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.1.9.tgz#e5e142fbbfe251091f9c5f1dd4c834ac04c3dbd1" - integrity sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg== - -"@scure/bip32@1.4.0": - version "1.4.0" - resolved "https://registry.yarnpkg.com/@scure/bip32/-/bip32-1.4.0.tgz#4e1f1e196abedcef395b33b9674a042524e20d67" - integrity sha512-sVUpc0Vq3tXCkDGYVWGIZTRfnvu8LoTDaev7vbwh0omSvVORONr960MQWdKqJDCReIEmTj3PAr73O3aoxz7OPg== - dependencies: - "@noble/curves" "~1.4.0" - "@noble/hashes" "~1.4.0" - "@scure/base" "~1.1.6" - -"@scure/bip39@1.3.0": - version "1.3.0" - resolved "https://registry.yarnpkg.com/@scure/bip39/-/bip39-1.3.0.tgz#0f258c16823ddd00739461ac31398b4e7d6a18c3" - integrity sha512-disdg7gHuTDZtY+ZdkmLpPCk7fxZSu3gBiEGuoC1XYxv9cGx3Z6cpTggCgW6odSOOIXCiDjuGejW+aJKCY/pIQ== +"@sidhujag/sysweb3-network@^1.0.109": + version "1.0.109" + resolved "https://registry.yarnpkg.com/@sidhujag/sysweb3-network/-/sysweb3-network-1.0.109.tgz#dc25e4e0938403ef18661d7874d2d8186be7ee98" + integrity sha512-ivHoiFMNeCeOIqMofDF0o9+zrEP1Zgq+IoIXGLdqltUoZluQb78ga63mKTeGivZjy3GZ6niMBFVIeSSSFswDog== dependencies: - "@noble/hashes" "~1.4.0" - "@scure/base" "~1.1.6" + eth-chains "^1.0.0" + ethers "^6.17.0" -"@sindresorhus/is@^4.0.0", "@sindresorhus/is@^4.6.0": - version "4.6.0" - resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-4.6.0.tgz#3c7c9c46e678feefe7a2e5bb609d3dbd665ffb3f" - integrity sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw== +"@sinclair/typebox@^0.27.8": + version "0.27.12" + resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.27.12.tgz#0cacd3cff047a32936b1ace47ea7c86eaab60a7f" + integrity sha512-hhyNJ+nbR6ZR7pToHvllEFun9TL0sbL+tk/ON75lo+Xas054uez98qRbsuNt7MBCyZKK4+8Yli/OAGZhmfBZ/g== -"@sinonjs/commons@^1.7.0": - version "1.8.6" - resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-1.8.6.tgz#80c516a4dc264c2a69115e7578d62581ff455ed9" - integrity sha512-Ky+XkAkqPZSm3NLBeUng77EBQl3cmeJhITaGHdYH8kjVB+aun3S4XBRti2zt17mtt0mIUDiNxYeoJm6drVvBJQ== +"@sinonjs/commons@^3.0.0": + version "3.0.1" + resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-3.0.1.tgz#1029357e44ca901a615585f6d27738dbc89084cd" + integrity sha512-K3mCHKQ9sVh8o1C9cxkwxaOmXoAMlDxC1mYyHrjqOWEcBjYr76t96zL2zlj5dUGZ3HSw240X1qgH3Mjf1yJWpQ== dependencies: type-detect "4.0.8" -"@sinonjs/fake-timers@^8.0.1": - version "8.1.0" - resolved "https://registry.yarnpkg.com/@sinonjs/fake-timers/-/fake-timers-8.1.0.tgz#3fdc2b6cb58935b21bfb8d1625eb1300484316e7" - integrity sha512-OAPJUAtgeINhh/TAlUID4QTs53Njm7xzddaVlEs/SXwgtiD1tW22zAB/W1wdqfrpmikgaWQ9Fw6Ws+hsiRm5Vg== - dependencies: - "@sinonjs/commons" "^1.7.0" - -"@szmarczak/http-timer@^4.0.5": - version "4.0.6" - resolved "https://registry.yarnpkg.com/@szmarczak/http-timer/-/http-timer-4.0.6.tgz#b4a914bb62e7c272d4e5989fe4440f812ab1d807" - integrity sha512-4BAffykYOgO+5nzBWYwE3W90sBgLJoUPRWWcL8wlyiM8IB8ipJz3UMJ9KXQd1RKQXpKp8Tutn80HZtWsu2u76w== - dependencies: - defer-to-connect "^2.0.0" - -"@szmarczak/http-timer@^5.0.1": - version "5.0.1" - resolved "https://registry.yarnpkg.com/@szmarczak/http-timer/-/http-timer-5.0.1.tgz#c7c1bf1141cdd4751b0399c8fc7b8b664cd5be3a" - integrity sha512-+PmQX0PiAYPMeVYe237LJAYvOMYW1j2rH5YROyS3b4CTVJum34HfRvKvAzozHAQG0TnHNdUfY9nCeUyRAs//cw== - dependencies: - defer-to-connect "^2.0.1" - -"@tootallnate/once@1": - version "1.1.2" - resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-1.1.2.tgz#ccb91445360179a04e7fe6aff78c00ffc1eeaf82" - integrity sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw== - -"@trezor/utils@9.0.14": - version "9.0.14" - resolved "https://registry.yarnpkg.com/@trezor/utils/-/utils-9.0.14.tgz#4a493e550ea91c2100add06180640b1bca9e75e8" - integrity sha512-9Q1LtxgAKpNDvvtQttTc/ufYHonnSJ3wmWnxPZsc1H0gn9MLV8WwRMH5+Yl3gJsUKZvcTJ5xwippVWDxPwP8Uw== - -"@trezor/utxo-lib@^1.0.7": - version "1.0.12" - resolved "https://registry.yarnpkg.com/@trezor/utxo-lib/-/utxo-lib-1.0.12.tgz#9c0b85bff90daea001c73173981ba058b9f711cc" - integrity sha512-Mtg3bE+Z+8oVfiME2CPZycbpbEyMymF4+YH2eD4aa4adysTimRxwI9+bjrUwMLwUsG1OrrNOVpeail9FrNB+hA== +"@sinonjs/fake-timers@^10.0.2": + version "10.3.0" + resolved "https://registry.yarnpkg.com/@sinonjs/fake-timers/-/fake-timers-10.3.0.tgz#55fdff1ecab9f354019129daf4df0dd4d923ea66" + integrity sha512-V4BG07kuYSUkTCSBHG8G8TNhM+F19jXFWnQtzj+we8DrkpSBCee9Z3Ms8yiGer/dlmhe35/Xdgyo3/0rQKg7YA== dependencies: - "@trezor/utils" "9.0.14" - bchaddrjs "^0.5.2" - bech32 "^2.0.0" - bip66 "^1.1.5" - bitcoin-ops "^1.4.1" - blake-hash "^2.0.0" - blakejs "^1.2.1" - bn.js "^5.2.1" - bs58 "^5.0.0" - bs58check "^3.0.1" - create-hash "^1.2.0" - create-hmac "^1.1.7" - int64-buffer "^1.0.1" - pushdata-bitcoin "^1.0.1" - tiny-secp256k1 "^1.1.6" - typeforce "^1.18.0" - varuint-bitcoin "^1.1.2" - wif "^2.0.6" + "@sinonjs/commons" "^3.0.0" -"@types/babel__core@^7.0.0", "@types/babel__core@^7.1.14": +"@types/babel__core@^7.1.14": version "7.20.5" resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.20.5.tgz#3df15f27ba85319caa07ba08d0721889bb39c017" integrity sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA== @@ -1046,47 +606,25 @@ "@babel/parser" "^7.1.0" "@babel/types" "^7.0.0" -"@types/babel__traverse@*", "@types/babel__traverse@^7.0.4", "@types/babel__traverse@^7.0.6": - version "7.20.7" - resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.20.7.tgz#968cdc2366ec3da159f61166428ee40f370e56c2" - integrity sha512-dkO5fhS7+/oos4ciWxyEyjWe48zmG6wbCheo/G2ZnHx4fs3EU6YC6UM8rk56gAjNJ9P3MTH2jo5jb92/K6wbng== - dependencies: - "@babel/types" "^7.20.7" - -"@types/bn.js@^5.1.0", "@types/bn.js@^5.1.1": - version "5.2.0" - resolved "https://registry.yarnpkg.com/@types/bn.js/-/bn.js-5.2.0.tgz#4349b9710e98f9ab3cdc50f1c5e4dcbd8ef29c80" - integrity sha512-DLbJ1BPqxvQhIGbeu8VbUC1DiAiahHtAYvA0ZEAa4P31F7IaArc8z3C3BRQdWX4mtLQuABG4yzp76ZrS02Ui1Q== - dependencies: - "@types/node" "*" - -"@types/cacheable-request@^6.0.1", "@types/cacheable-request@^6.0.2": - version "6.0.3" - resolved "https://registry.yarnpkg.com/@types/cacheable-request/-/cacheable-request-6.0.3.tgz#a430b3260466ca7b5ca5bfd735693b36e7a9d183" - integrity sha512-IQ3EbTzGxIigb1I3qPZc1rWJnH0BmSKv5QYTalEwweFvyBDLSAe24zP0le/hyi7ecGfZVlIVAg4BZqb8WBwKqw== +"@types/babel__traverse@*", "@types/babel__traverse@^7.0.6": + version "7.28.0" + resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.28.0.tgz#07d713d6cce0d265c9849db0cbe62d3f61f36f74" + integrity sha512-8PvcXf70gTDZBgt9ptxJ8elBeBjcLOAcOtoO/mPJjtji1+CdGbHgm77om1GrsPxsiE+uXIpNSK64UYaIwQXd4Q== dependencies: - "@types/http-cache-semantics" "*" - "@types/keyv" "^3.1.4" - "@types/node" "*" - "@types/responselike" "^1.0.0" + "@babel/types" "^7.28.2" "@types/crypto-js@^4.1.1": version "4.2.2" resolved "https://registry.yarnpkg.com/@types/crypto-js/-/crypto-js-4.2.2.tgz#771c4a768d94eb5922cc202a3009558204df0cea" integrity sha512-sDOLlVbHhXpAUAL0YHDUUwDZf3iN4Bwi4W6a0W0b+QcAezUbRtH4FVb+9J4h+XFPW7l/gQ9F8qC7P+Ec4k8QVQ== -"@types/graceful-fs@^4.1.2": +"@types/graceful-fs@^4.1.3": version "4.1.9" resolved "https://registry.yarnpkg.com/@types/graceful-fs/-/graceful-fs-4.1.9.tgz#2a06bc0f68a20ab37b3e36aa238be6abdf49e8b4" integrity sha512-olP3sd1qOEe5dXTSaFvQG+02VdRXcdytWLAZsAq1PecU8uqQAhkrnbli7DagjtXKW/Bl7YJbUsa8MPcuc8LHEQ== dependencies: "@types/node" "*" -"@types/http-cache-semantics@*": - version "4.0.4" - resolved "https://registry.yarnpkg.com/@types/http-cache-semantics/-/http-cache-semantics-4.0.4.tgz#b979ebad3919799c979b17c72621c0bc0a31c6c4" - integrity sha512-1m0bIFVc7eJWyve9S0RnuRgcQqF/Xd5QsUZAZeQFr1Q3/p9JWoQQEqmVy+DPTNpGXwhgIetAoYF8JSc33q29QA== - "@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0", "@types/istanbul-lib-coverage@^2.0.1": version "2.0.6" resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz#7739c232a1fee9b4d3ce8985f314c0c6d33549d7" @@ -1106,29 +644,19 @@ dependencies: "@types/istanbul-lib-report" "*" -"@types/keyv@^3.1.4": - version "3.1.4" - resolved "https://registry.yarnpkg.com/@types/keyv/-/keyv-3.1.4.tgz#3ccdb1c6751b0c7e52300bcdacd5bcbf8faa75b6" - integrity sha512-BQ5aZNSCpj7D6K2ksrRCTmKRLEpnPvWDiLPfoGyhZ++8YtiK9d/3DBKPJgry359X/P1PfruyYwvnvwFjuEiEIg== - dependencies: - "@types/node" "*" - "@types/node@*": - version "24.1.0" - resolved "https://registry.yarnpkg.com/@types/node/-/node-24.1.0.tgz#0993f7dc31ab5cc402d112315b463e383d68a49c" - integrity sha512-ut5FthK5moxFKH2T1CUOC6ctR67rQRvvHdFLCD2Ql6KXmMuCrjsSsRI9UsLCm9M18BMwClv4pn327UvB7eeO1w== + version "26.1.2" + resolved "https://registry.yarnpkg.com/@types/node/-/node-26.1.2.tgz#da79708f1f9c6294f4cdec8f455a3032b028808a" + integrity sha512-Vu4a5UFA9rIIFJ7rB/Vaafh9lrCQszopTCx6KjFboXTGQbPNasehVR5TEiithSDGyd1DEiUByggTZsg8jukeIg== dependencies: - undici-types "~7.8.0" + undici-types "~8.3.0" -"@types/node@10.12.18": - version "10.12.18" - resolved "https://registry.yarnpkg.com/@types/node/-/node-10.12.18.tgz#1d3ca764718915584fcd9f6344621b7672665c67" - integrity sha512-fh+pAqt4xRzPfqA6eh3Z2y6fyZavRIumvjhaCL753+TVkGKGhpPeyrJG2JftD0T9q4GF00KjefsQ+PQNDdWQaQ== - -"@types/node@^12.12.6": - version "12.20.55" - resolved "https://registry.yarnpkg.com/@types/node/-/node-12.20.55.tgz#c329cbd434c42164f846b909bd6f85b5537f6240" - integrity sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ== +"@types/node@22.7.5": + version "22.7.5" + resolved "https://registry.yarnpkg.com/@types/node/-/node-22.7.5.tgz#cfde981727a7ab3611a481510b473ae54442b92b" + integrity sha512-jML7s2NAzMWc//QSJ1a3prpk78cOPchGvXJsC3C6R6PSMoooztvRVQEz89gmBTBY1SPMaqo5teB4uNHPdetShQ== + dependencies: + undici-types "~6.19.2" "@types/node@^17.0.23": version "17.0.45" @@ -1142,22 +670,10 @@ dependencies: "@types/node" "*" -"@types/prettier@^2.1.5": - version "2.7.3" - resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.7.3.tgz#3e51a17e291d01d17d3fc61422015a933af7a08f" - integrity sha512-+68kP9yzs4LMp7VNh8gdzMSPZFL44MLGqiHWvttYJe+6qnuVr4Ek9wSBQoveqY/r+LwjCcU29kNVkidwim+kYA== - -"@types/responselike@^1.0.0": - version "1.0.3" - resolved "https://registry.yarnpkg.com/@types/responselike/-/responselike-1.0.3.tgz#cc29706f0a397cfe6df89debfe4bf5cea159db50" - integrity sha512-H/+L+UkTV33uf49PH5pCAUBVPNj2nDBXTN+qS1dOwyyg24l3CcicicCA7ca+HMvJBZcFgl5r8e+RR6elsb4Lyw== - dependencies: - "@types/node" "*" - "@types/secp256k1@^4.0.1": - version "4.0.6" - resolved "https://registry.yarnpkg.com/@types/secp256k1/-/secp256k1-4.0.6.tgz#d60ba2349a51c2cbc5e816dcd831a42029d376bf" - integrity sha512-hHxJU6PAEUn0TP4S/ZOzuTUvJWuZ6eIKeNKb5RBpODvSl6hp1Wrw4s7ATY50rklRCScUDpHzVA/DQdSjJ3UoYQ== + version "4.0.7" + resolved "https://registry.yarnpkg.com/@types/secp256k1/-/secp256k1-4.0.7.tgz#534c9814eb80964962108ad45d549d1555c75fa0" + integrity sha512-Rcvjl6vARGAKRO6jHeKMatGrvOMGrR/AR11N1x2LqintPCyDZ7NBhrh238Z2VZc7aM7KIwnFpFQ7fnfK4H/9Qw== dependencies: "@types/node" "*" @@ -1171,23 +687,13 @@ resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-21.0.3.tgz#815e30b786d2e8f0dcd85fd5bcf5e1a04d008f15" integrity sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ== -"@types/yargs@^16.0.0": - version "16.0.9" - resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-16.0.9.tgz#ba506215e45f7707e6cbcaf386981155b7ab956e" - integrity sha512-tHhzvkFXZQeTECenFoRljLBYPZJ7jAVxqqtEI0qTLOmuultnFp4I9yKE17vTuhf7BkhCu7I4XuemPgikDVuYqA== +"@types/yargs@^17.0.8": + version "17.0.35" + resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-17.0.35.tgz#07013e46aa4d7d7d50a49e15604c1c5340d4eb24" + integrity sha512-qUHkeCyQFxMXg79wQfTtfndEC+N9ZZg76HJftDJp+qH2tV7Gj4OJi7l+PiWwJ+pWtW8GwSmqsDj/oymhrTWXjg== dependencies: "@types/yargs-parser" "*" -abab@^2.0.3, abab@^2.0.5: - version "2.0.6" - resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.6.tgz#41b80f2c871d19686216b82309231cfd3cb3d291" - integrity sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA== - -abortcontroller-polyfill@^1.7.5: - version "1.7.8" - resolved "https://registry.yarnpkg.com/abortcontroller-polyfill/-/abortcontroller-polyfill-1.7.8.tgz#fe8d4370403f02e2aa37e3d2b0b178bae9d83f49" - integrity sha512-9f1iZ2uWh92VcrU9Y8x+LdM4DLj75VE0MJB8zuF1iUnroEptStw+DQ8EQPMUdfe5k+PkB1uUfDQfWbhstH8LrQ== - abstract-leveldown@^5.0.0, abstract-leveldown@~5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/abstract-leveldown/-/abstract-leveldown-5.0.0.tgz#f7128e1f86ccabf7d2893077ce5d06d798e386c6" @@ -1195,41 +701,10 @@ abstract-leveldown@^5.0.0, abstract-leveldown@~5.0.0: dependencies: xtend "~4.0.0" -accepts@~1.3.8: - version "1.3.8" - resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.8.tgz#0bf0be125b67014adcb0b0921e62db7bffe16b2e" - integrity sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw== - dependencies: - mime-types "~2.1.34" - negotiator "0.6.3" - -acorn-globals@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-6.0.0.tgz#46cdd39f0f8ff08a876619b55f5ac8a6dc770b45" - integrity sha512-ZQl7LOWaF5ePqqcX4hLuv/bLXYQNfNWw2c0/yX/TsPRKamzHcTGQnlCjHT3TsmkOUVEPS3crCxiPfdzE/Trlhg== - dependencies: - acorn "^7.1.1" - acorn-walk "^7.1.1" - -acorn-walk@^7.1.1: - version "7.2.0" - resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-7.2.0.tgz#0de889a601203909b0fbe07b8938dc21d2e967bc" - integrity sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA== - -acorn@^7.1.1: - version "7.4.1" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.4.1.tgz#feaed255973d2e77555b83dbc08851a6c63520fa" - integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A== - -acorn@^8.2.4: - version "8.15.0" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.15.0.tgz#a360898bc415edaac46c8241f6383975b930b816" - integrity sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg== - -aes-js@3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-3.0.0.tgz#e21df10ad6c2053295bcbb8dab40b09dbea87e4d" - integrity sha512-H7wUZRn8WpTq9jocdxQ2c8x2sKo9ZVmzfRE13GiNJXfp7NcKYEdvl3vspKjXox6RIG2VtaRe4JFvxG4rqp2Zuw== +aes-js@4.0.0-beta.5: + version "4.0.0-beta.5" + resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-4.0.0-beta.5.tgz#8d2452c52adedebc3a3e28465d858c11ca315873" + integrity sha512-G965FqalsNyrPqgEGON7nIx1e/OVENSgiEIzyC63haUMuvNnwIgIjMs52hlTCKhkBny7A2ORNlfY9Zu+jmGk1Q== agent-base@6: version "6.0.2" @@ -1238,16 +713,6 @@ agent-base@6: dependencies: debug "4" -ajv@^6.12.3: - version "6.12.6" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" - integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== - dependencies: - fast-deep-equal "^3.1.1" - fast-json-stable-stringify "^2.0.0" - json-schema-traverse "^0.4.1" - uri-js "^4.2.2" - ansi-escapes@^4.2.1: version "4.3.2" resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.3.2.tgz#6b2291d1db7d98b6521d5f1efa42d0f3a9feb65e" @@ -1260,11 +725,6 @@ ansi-regex@^5.0.1: resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== -ansi-regex@^6.0.1: - version "6.1.0" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-6.1.0.tgz#95ec409c69619d6cb1b8b34f14b660ef28ebd654" - integrity sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA== - ansi-styles@^4.0.0, ansi-styles@^4.1.0: version "4.3.0" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" @@ -1277,11 +737,6 @@ ansi-styles@^5.0.0: resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-5.2.0.tgz#07449690ad45777d1924ac2abb2fc8895dba836b" integrity sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA== -ansi-styles@^6.1.0: - version "6.2.1" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-6.2.1.tgz#0e62320cf99c21afff3b3012192546aacbfb05c5" - integrity sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug== - anymatch@^3.0.3: version "3.1.3" resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.3.tgz#790c58b19ba1720a84205b57c618d5ad8524973e" @@ -1297,28 +752,6 @@ argparse@^1.0.7: dependencies: sprintf-js "~1.0.2" -array-flatten@1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/array-flatten/-/array-flatten-1.1.1.tgz#9a5f699051b1e7073328f2a008968b64ea2955d2" - integrity sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg== - -asn1@~0.2.3: - version "0.2.6" - resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.6.tgz#0d3a7bb6e64e02a90c0303b31f292868ea09a08d" - integrity sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ== - dependencies: - safer-buffer "~2.1.0" - -assert-plus@1.0.0, assert-plus@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525" - integrity sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw== - -async-limiter@~1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/async-limiter/-/async-limiter-1.0.1.tgz#dd379e94f0db8310b08291f9d64c3209766617fd" - integrity sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ== - async@^2.6.1: version "2.6.4" resolved "https://registry.yarnpkg.com/async/-/async-2.6.4.tgz#706b7ff6084664cd7eae713f6f965433b5504221" @@ -1338,40 +771,25 @@ available-typed-arrays@^1.0.7: dependencies: possible-typed-array-names "^1.0.0" -aws-sign2@~0.7.0: - version "0.7.0" - resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8" - integrity sha512-08kcGqnYf/YmjoRhfxyu+CLxBjUtHLXLXX/vUfx9l2LYzG3c1m61nrpyFUZI6zeS+Li/wWMMidD9KgrqtGq3mA== - -aws4@^1.8.0: - version "1.13.2" - resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.13.2.tgz#0aa167216965ac9474ccfa83892cfb6b3e1e52ef" - integrity sha512-lHe62zvbTB5eEABUVi/AwVh0ZKY9rMMDhmm+eeyuuUQbQ3+J+fONVQOZyj+DdrvD4BY33uYniyRJ4UJIaSKAfw== - -axios@^0.21.1: - version "0.21.4" - resolved "https://registry.yarnpkg.com/axios/-/axios-0.21.4.tgz#c67b90dc0568e5c1cf2b0b858c43ba28e2eda575" - integrity sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg== - dependencies: - follow-redirects "^1.14.0" - -axios@^0.26.1: - version "0.26.1" - resolved "https://registry.yarnpkg.com/axios/-/axios-0.26.1.tgz#1ede41c51fcf51bbbd6fd43669caaa4f0495aaa9" - integrity sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA== +axios@^1.18.1: + version "1.19.0" + resolved "https://registry.yarnpkg.com/axios/-/axios-1.19.0.tgz#ddf864d4c8233c0e6873746ab59361537d05ad39" + integrity sha512-ht/iuYZXEjFxLH/Hkezgd7m6JKlHHXEUSneaDz8uZe1Gj5QZtCnpyDsckvAiEnT89OEbCLmnte4R4sn7P0EKFw== dependencies: - follow-redirects "^1.14.8" + follow-redirects "^1.16.0" + form-data "^4.0.6" + https-proxy-agent "^5.0.1" + proxy-from-env "^2.1.0" -babel-jest@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-27.5.1.tgz#a1bf8d61928edfefd21da27eb86a695bfd691444" - integrity sha512-cdQ5dXjGRd0IBRATiQ4mZGlGlRE8kJpjPOixdNRdT+m3UcNqmYWN6rK6nvtXYfY3D76cb8s/O1Ss8ea24PIwcg== +babel-jest@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-29.7.0.tgz#f4369919225b684c56085998ac63dbd05be020d5" + integrity sha512-BrvGY3xZSwEcCzKvKsCi2GgHqDqsYkOP4/by5xCgIwGXQxIEh+8ew3gmrE1y7XRR6LHZIj6yLYnUi/mm2KXKBg== dependencies: - "@jest/transform" "^27.5.1" - "@jest/types" "^27.5.1" + "@jest/transform" "^29.7.0" "@types/babel__core" "^7.1.14" babel-plugin-istanbul "^6.1.1" - babel-preset-jest "^27.5.1" + babel-preset-jest "^29.6.3" chalk "^4.0.0" graceful-fs "^4.2.9" slash "^3.0.0" @@ -1387,20 +805,20 @@ babel-plugin-istanbul@^6.1.1: istanbul-lib-instrument "^5.0.4" test-exclude "^6.0.0" -babel-plugin-jest-hoist@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-27.5.1.tgz#9be98ecf28c331eb9f5df9c72d6f89deb8181c2e" - integrity sha512-50wCwD5EMNW4aRpOwtqzyZHIewTYNxLA4nhB+09d8BIssfNfzBRhkBIHiaPv1Si226TQSvp8gxAJm2iY2qs2hQ== +babel-plugin-jest-hoist@^29.6.3: + version "29.6.3" + resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-29.6.3.tgz#aadbe943464182a8922c3c927c3067ff40d24626" + integrity sha512-ESAc/RJvGTFEzRwOTT4+lNDk/GNHMkKbNzsvT0qKRfDyyYTskxB5rnU2njIDYVxXCBHHEI1c0YwHob3WaYujOg== dependencies: "@babel/template" "^7.3.3" "@babel/types" "^7.3.3" - "@types/babel__core" "^7.0.0" + "@types/babel__core" "^7.1.14" "@types/babel__traverse" "^7.0.6" babel-preset-current-node-syntax@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.1.0.tgz#9a929eafece419612ef4ae4f60b1862ebad8ef30" - integrity sha512-ldYss8SbBlWva1bs28q78Ju5Zq1F+8BrqBZZ0VFhLBvhh6lCpC2o3gDJi/5DRLs9FgYZCnmPYIVFU4lRXCkyUw== + version "1.2.0" + resolved "https://registry.yarnpkg.com/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.2.0.tgz#20730d6cdc7dda5d89401cab10ac6a32067acde6" + integrity sha512-E/VlAEzRrsLEb2+dv8yp3bo4scof3l9nR4lrld+Iy5NyVqgVYUJnDAmunkhPMisRI32Qc4iRiz425d8vM++2fg== dependencies: "@babel/plugin-syntax-async-generators" "^7.8.4" "@babel/plugin-syntax-bigint" "^7.8.3" @@ -1418,12 +836,12 @@ babel-preset-current-node-syntax@^1.0.0: "@babel/plugin-syntax-private-property-in-object" "^7.14.5" "@babel/plugin-syntax-top-level-await" "^7.14.5" -babel-preset-jest@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-27.5.1.tgz#91f10f58034cb7989cb4f962b69fa6eef6a6bc81" - integrity sha512-Nptf2FzlPCWYuJg41HBqXVT8ym6bXOevuCTbhxlUpjwtysGaIWFvDEjp4y+G7fl13FgOdjs7P/DmErqH7da0Ag== +babel-preset-jest@^29.6.3: + version "29.6.3" + resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-29.6.3.tgz#fa05fa510e7d493896d7b0dd2033601c840f171c" + integrity sha512-0B3bhxR6snWXJZtR/RliHTDPRgn1sNHOR0yVtq/IiQFyuOVjFS+wuio/R4gSNkyYmKmJB4wGZv2NZanmKmTnNA== dependencies: - babel-plugin-jest-hoist "^27.5.1" + babel-plugin-jest-hoist "^29.6.3" babel-preset-current-node-syntax "^1.0.0" balanced-match@^1.0.0: @@ -1431,223 +849,120 @@ balanced-match@^1.0.0: resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== -base-x@^3.0.2, base-x@^3.0.8: +balanced-match@^4.0.2: + version "4.0.4" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-4.0.4.tgz#bfb10662feed8196a2c62e7c68e17720c274179a" + integrity sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA== + +base-x@^3.0.2: version "3.0.11" resolved "https://registry.yarnpkg.com/base-x/-/base-x-3.0.11.tgz#40d80e2a1aeacba29792ccc6c5354806421287ff" integrity sha512-xz7wQ8xDhdyP7tQxwdteLYeFfS68tSMNCZ/Y37WJ4bhGfKPpqEIlmIyueQHqOyoPhE6xNUqjzRr8ra0eF9VRvA== dependencies: safe-buffer "^5.0.1" -base-x@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/base-x/-/base-x-4.0.1.tgz#817fb7b57143c501f649805cb247617ad016a885" - integrity sha512-uAZ8x6r6S3aUM9rbHGVOIsR15U/ZSc82b3ymnCPsT45Gk1DDvhDPdIgB5MrhirZWt+5K0EEPQH985kNqZgNPFw== +base-x@^5.0.0: + version "5.0.1" + resolved "https://registry.yarnpkg.com/base-x/-/base-x-5.0.1.tgz#16bf35254be1df8aca15e36b7c1dda74b2aa6b03" + integrity sha512-M7uio8Zt++eg3jPj+rHMfCC+IuygQHHCOU+IYsVtik6FWjuYpVt/+MRKcgsAMHh8mMFAwnB+Bs+mTrFiXjMzKg== base64-js@^1.3.1: version "1.5.1" resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== -bchaddrjs@^0.5.2: - version "0.5.2" - resolved "https://registry.yarnpkg.com/bchaddrjs/-/bchaddrjs-0.5.2.tgz#1f52b5077329774e7c82d4882964628106bb11a0" - integrity sha512-OO7gIn3m7ea4FVx4cT8gdlWQR2+++EquhdpWQJH9BQjK63tJJ6ngB3QMZDO6DiBoXiIGUsTPHjlrHVxPGcGxLQ== - dependencies: - bs58check "2.1.2" - buffer "^6.0.3" - cashaddrjs "0.4.4" - stream-browserify "^3.0.0" - -bcrypt-pbkdf@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz#a4301d389b6a43f9b67ff3ca11a3f6637e360e9e" - integrity sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w== - dependencies: - tweetnacl "^0.14.3" - -bech32@1.1.4, bech32@^1.1.2: - version "1.1.4" - resolved "https://registry.yarnpkg.com/bech32/-/bech32-1.1.4.tgz#e38c9f37bf179b8eb16ae3a772b40c356d4832e9" - integrity sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ== +baseline-browser-mapping@^2.10.44: + version "2.11.12" + resolved "https://registry.yarnpkg.com/baseline-browser-mapping/-/baseline-browser-mapping-2.11.12.tgz#42ac48770bf73d292f60ce8ba4dc5e7ebb242ec3" + integrity sha512-r7WnVImvVCeFpf2DOXfy41aPWzeNg3H/A2X4dKmy1QL0MSyyk/e7z8ihJ3N6Nn2PsdhkVlqnEfnUE4a05P2aTA== bech32@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/bech32/-/bech32-2.0.0.tgz#078d3686535075c8c79709f054b1b226a133b355" integrity sha512-LcknSilhIGatDAsY1ak2I8VtGaHNhgMSYVxFrGLXv+xLHytaKZKcaUJJUE7qmBr7h33o5YQwP55pMI0xmkpJwg== -big-integer@1.6.36: - version "1.6.36" - resolved "https://registry.yarnpkg.com/big-integer/-/big-integer-1.6.36.tgz#78631076265d4ae3555c04f85e7d9d2f3a071a36" - integrity sha512-t70bfa7HYEA1D9idDbmuv7YbsbVkQ+Hp+8KFSul4aE5e/i1bjCNIRYJZlA8Q8p0r9T8cF/RVvwUgRA//FydEyg== - -bignumber.js@^9.0.0: - version "9.3.1" - resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.3.1.tgz#759c5aaddf2ffdc4f154f7b493e1c8770f88c4d7" - integrity sha512-Ko0uX15oIUS7wJ3Rb30Fs6SkVbLmPBAKdlm7q9+ak9bbIeFf0MwuBsQV6z7+X768/cHsfg+WlysDWJcmthjsjQ== - -bindings@^1.3.0, bindings@^1.5.0: - version "1.5.0" - resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.5.0.tgz#10353c9e945334bc0511a6d90b38fbc7c9c504df" - integrity sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ== +bip174@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/bip174/-/bip174-3.0.0.tgz#fbf60cc7a6e39dde17afdda0cf1a27e5508ae075" + integrity sha512-N3vz3rqikLEu0d6yQL8GTrSkpYb35NQKWMR7Hlza0lOj6ZOlvQ3Xr7N9Y+JPebaCVoEUHdBeBSuLxcHr71r+Lw== dependencies: - file-uri-to-path "1.0.0" + uint8array-tools "^0.0.9" + varuint-bitcoin "^2.0.0" -bip174@^2.0.1, bip174@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/bip174/-/bip174-2.1.1.tgz#ef3e968cf76de234a546962bcf572cc150982f9f" - integrity sha512-mdFV5+/v0XyNYXjBS6CQPLo9ekCx4gtKZFnJm5PMto7Fs9hTTDpkkzOB7/FtluRI6JbUUAu+snTYfJRgHLZbZQ== - -bip32@^2.0.4: - version "2.0.6" - resolved "https://registry.yarnpkg.com/bip32/-/bip32-2.0.6.tgz#6a81d9f98c4cd57d05150c60d8f9e75121635134" - integrity sha512-HpV5OMLLGTjSVblmrtYRfFFKuQB+GArM0+XP8HGWfJ5vxYBqo+DesvJwOdC2WJ3bCkZShGf0QIfoIpeomVzVdA== +bip174@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/bip174/-/bip174-3.0.1.tgz#c213c888ab42dd0b113802b0c48285ede8c37cb0" + integrity sha512-avOnOoLOwdjw1MebWKh3bHqWOH558Q9VpqmRKUv2S63vjw0pnX7Y+yRihxIibgP55twhc7+YfC0IAH43IF5FqQ== dependencies: - "@types/node" "10.12.18" - bs58check "^2.1.1" - create-hash "^1.2.0" - create-hmac "^1.1.7" - tiny-secp256k1 "^1.1.3" - typeforce "^1.11.5" - wif "^2.0.6" + uint8array-tools "^0.0.10" + varuint-bitcoin "^2.0.1" -bip32@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/bip32/-/bip32-4.0.0.tgz#7fac3c05072188d2d355a4d6596b37188f06aa2f" - integrity sha512-aOGy88DDlVUhspIXJN+dVEtclhIsfAUppD43V0j40cPTld3pv/0X/MlrZSZ6jowIaQQzFwP8M6rFU2z2mVYjDQ== +bip32@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/bip32/-/bip32-5.0.1.tgz#08ccd31bbc57e62197ea74e039795a590302f332" + integrity sha512-PWlHIAgYCfVhwqNpZyeakHXuLAGyN6rEQZnhxHxKI3BoFJRVWLl26455fhRlHsmbYcV986HqtPnt33Edu5sTCw== dependencies: "@noble/hashes" "^1.2.0" "@scure/base" "^1.1.1" - typeforce "^1.11.5" - wif "^2.0.6" + uint8array-tools "^0.0.8" + valibot "^1.2.0" + wif "^5.0.0" -bip39@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/bip39/-/bip39-3.1.0.tgz#c55a418deaf48826a6ceb34ac55b3ee1577e18a3" - integrity sha512-c9kiwdk45Do5GL0vJMe7tS95VjCii65mYAH7DfWl3uW8AVzXKQVUm64i3hzVybBDMp9r7j9iNxR85+ul8MdN/A== +bip39@^3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/bip39/-/bip39-3.1.2.tgz#17e31b77e80ded2e7388cb88a327cd640917baf7" + integrity sha512-inxKLEH+Weos8f5rBYNKuOrpOIcNWtKnrLur9x72s4Cb8w4Mm0jJktUPkev7+1pQuivxFqkiut9+AcrwunLHxA== dependencies: "@noble/hashes" "^1.2.0" -bip44-constants@^114.0.0: - version "114.0.0" - resolved "https://registry.yarnpkg.com/bip44-constants/-/bip44-constants-114.0.0.tgz#ef47b3952288068fec324d7e1d09cc4e6eab091d" - integrity sha512-4y6kex3SRdQVClhSZVGb3c1oeH5zZxzZt5xFe56NHpyFdcp9rZMonv4wNP1xgjYPixyqs0cCjnWUCfMTmOi4Dw== - -bip66@^1.1.0, bip66@^1.1.5: - version "1.1.5" - resolved "https://registry.yarnpkg.com/bip66/-/bip66-1.1.5.tgz#01fa8748785ca70955d5011217d1b3139969ca22" - integrity sha512-nemMHz95EmS38a26XbbdxIYj5csHd3RMP3H5bwQknX0WYHF01qhpufP42mLOwVICuH2JmhIhXiWs89MfUGL7Xw== - dependencies: - safe-buffer "^5.0.1" - -bip84@^0.2.7: - version "0.2.9" - resolved "https://registry.yarnpkg.com/bip84/-/bip84-0.2.9.tgz#3b852c6386607338ad4c75b648c1c32733853eff" - integrity sha512-64uzZMiW20d/Gx5YC54Z1xsV2ULdVczat0Dla0DNoxjUo+2uIpy3DCtwDB4P4BkrWI1eHSjWvSKcKpwS+DwMVQ== - dependencies: - "@bitcoinerlab/secp256k1" "^1.1.1" - bip32 "^4.0.0" - bip39 "^3.1.0" - bitcoinjs-lib "^6.1.5" - bs58check "^3.0.1" - -bitcoin-ops@^1.3.0, bitcoin-ops@^1.4.0, bitcoin-ops@^1.4.1: +bitcoin-ops@^1.4.1: version "1.4.1" resolved "https://registry.yarnpkg.com/bitcoin-ops/-/bitcoin-ops-1.4.1.tgz#e45de620398e22fd4ca6023de43974ff42240278" integrity sha512-pef6gxZFztEhaE9RY9HmWVmiIHqCb2OyS4HPKkpc6CIiiOa3Qmuoylxc5P2EkU3w+5eTSifI9SEZC88idAIGow== -bitcoinjs-lib@^5.2.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/bitcoinjs-lib/-/bitcoinjs-lib-5.2.0.tgz#caf8b5efb04274ded1b67e0706960b93afb9d332" - integrity sha512-5DcLxGUDejgNBYcieMIUfjORtUeNWl828VWLHJGVKZCb4zIS1oOySTUr0LGmcqJBQgTBz3bGbRQla4FgrdQEIQ== - dependencies: - bech32 "^1.1.2" - bip174 "^2.0.1" - bip32 "^2.0.4" - bip66 "^1.1.0" - bitcoin-ops "^1.4.0" - bs58check "^2.0.0" - create-hash "^1.1.0" - create-hmac "^1.1.3" - merkle-lib "^2.0.10" - pushdata-bitcoin "^1.0.1" - randombytes "^2.0.1" - tiny-secp256k1 "^1.1.1" - typeforce "^1.11.3" - varuint-bitcoin "^1.0.4" - wif "^2.0.1" - -bitcoinjs-lib@^6.1.5: - version "6.1.7" - resolved "https://registry.yarnpkg.com/bitcoinjs-lib/-/bitcoinjs-lib-6.1.7.tgz#0f98dec1333d658574eefa455295668cfae38bb0" - integrity sha512-tlf/r2DGMbF7ky1MgUqXHzypYHakkEnm0SZP23CJKIqNY/5uNAnMbFhMJdhjrL/7anfb/U8+AlpdjPWjPnAalg== +bitcoinjs-lib@^7.0.1, bitcoinjs-lib@^7.0.5: + version "7.0.5" + resolved "https://registry.yarnpkg.com/bitcoinjs-lib/-/bitcoinjs-lib-7.0.5.tgz#ef7175e79e50faae69c9ca61c273efd966a60c33" + integrity sha512-xH24P1ile3QtyChzX1ITitcgpfZgDzG986gy1glbGXFsvcSnRX0P6p4m3nuTQfJ+j97va8py0leEK7xG8oxMqQ== dependencies: "@noble/hashes" "^1.2.0" bech32 "^2.0.0" - bip174 "^2.1.1" - bs58check "^3.0.1" - typeforce "^1.11.3" - varuint-bitcoin "^1.1.2" - -blake-hash@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/blake-hash/-/blake-hash-2.0.0.tgz#af184dce641951126d05b7d1c3de3224f538d66e" - integrity sha512-Igj8YowDu1PRkRsxZA7NVkdFNxH5rKv5cpLxQ0CVXSIA77pVYwCPRQJ2sMew/oneUpfuYRyjG6r8SmmmnbZb1w== - dependencies: - node-addon-api "^3.0.0" - node-gyp-build "^4.2.2" - readable-stream "^3.6.0" + bip174 "^3.0.1" + bs58check "^4.0.0" + uint8array-tools "^0.0.10" + valibot "^1.2.0" + varuint-bitcoin "^2.0.1" -blakejs@^1.1.0, blakejs@^1.2.1: +blakejs@^1.1.0: version "1.2.1" resolved "https://registry.yarnpkg.com/blakejs/-/blakejs-1.2.1.tgz#5057e4206eadb4a97f7c0b6e197a505042fc3814" integrity sha512-QXUSXI3QVc/gJME0dBpXrag1kbzOqCjCX8/b54ntNyW6sjtoqxqRk3LTmXzaJoh71zMsDCjM+47jS7XiwN/+fQ== -bluebird@^3.5.0: - version "3.7.2" - resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f" - integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg== - -bn.js@4.11.6: - version "4.11.6" - resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.6.tgz#53344adb14617a13f6e8dd2ce28905d1c0ba3215" - integrity sha512-XWwnNNFCuuSQ0m3r3C4LE3EiORltHd9M05pq6FOlVeiophzRbMo50Sbz1ehl8K3Z+jw9+vmgnXefY1hz8X+2wA== - -bn.js@^4.11.0, bn.js@^4.11.6, bn.js@^4.11.8, bn.js@^4.11.9: - version "4.12.2" - resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.12.2.tgz#3d8fed6796c24e177737f7cc5172ee04ef39ec99" - integrity sha512-n4DSx829VRTRByMRGdjQ9iqsN0Bh4OolPsFnaZBLcbi8iXcB+kJ9s7EnRt4wILZNV3kPLHkRVfOc/HvhC3ovDw== - -bn.js@^5.1.2, bn.js@^5.1.3, bn.js@^5.2.0, bn.js@^5.2.1: - version "5.2.2" - resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.2.tgz#82c09f9ebbb17107cd72cb7fd39bd1f9d0aaa566" - integrity sha512-v2YAxEmKaBLahNwE1mjp4WON6huMNeuDvagFZW+ASCuA/ku0bXR9hSMw0XpiqMoA3+rmnyck/tPRSFQkoC9Cuw== - -body-parser@1.20.3, body-parser@^1.16.0: - version "1.20.3" - resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.20.3.tgz#1953431221c6fb5cd63c4b36d53fab0928e548c6" - integrity sha512-7rAxByjUMqQ3/bHJy7D6OGXvx/MMc4IqBn/X0fcM1QUcAItpZrBEYhWGem+tzXH90c+G01ypMcYJBO9Y30203g== - dependencies: - bytes "3.1.2" - content-type "~1.0.5" - debug "2.6.9" - depd "2.0.0" - destroy "1.2.0" - http-errors "2.0.0" - iconv-lite "0.4.24" - on-finished "2.4.1" - qs "6.13.0" - raw-body "2.5.2" - type-is "~1.6.18" - unpipe "1.0.0" +bn.js@^4.11.0, bn.js@^4.11.8, bn.js@^4.11.9: + version "4.12.5" + resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.12.5.tgz#74f119ffecd823168d188eae06d97ea40835c489" + integrity sha512-3aRg6/JxfffFD+OlOjOFR3Vo79l39ooBTFucxx+MT3dhCtzn3EmiUPQo+6/OZuI2jbXi3YKgmiTFBgChQMwIRQ== + +bn.js@^5.2.0, bn.js@^5.2.4: + version "5.2.5" + resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.5.tgz#e81ce41cf25e6f0cd1e05f20a9db8c18405e375f" + integrity sha512-Vq886eXykuP5E6HcKSSStP3bJgrE6In5WKxVUvJ8XGpWWYs2xZHWqUwzCtGgEtBcxyd57KBFDPFoUfNzdaHCNg== brace-expansion@^1.1.7: - version "1.1.12" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.12.tgz#ab9b454466e5a8cc3a187beaad580412a9c5b843" - integrity sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg== + version "1.1.18" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.18.tgz#3ce74d89885136be1535341f8c3d4425c29a5cab" + integrity sha512-Edep/X9fGqVNmzKBVsDYIOtD+z1tuezV70LBjdCst9Tqu76lsnvRiZ6oTic1n+/BIwX6QDGAO94PN4N2SADvtw== dependencies: balanced-match "^1.0.0" concat-map "0.0.1" +brace-expansion@^5.0.8: + version "5.0.9" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-5.0.9.tgz#7c72438809b5fa5babf54199a1f1c281a6984fcf" + integrity sha512-ScQ4IuvIEF1TMlP7Zt+vjJ//9zlPb2SDcxWxM3bk8s6t6GGdJ7KO1dCcTidOPJKePW30LE/2cT7wCyPho9/Wxg== + dependencies: + balanced-match "^4.0.2" + braces@^3.0.3: version "3.0.3" resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.3.tgz#490332f40919452272d55a8480adc0c441358789" @@ -1660,12 +975,7 @@ brorand@^1.1.0: resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f" integrity sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w== -browser-process-hrtime@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/browser-process-hrtime/-/browser-process-hrtime-1.0.0.tgz#3c9b4b7d782c8121e56f10106d84c0d0ffc94626" - integrity sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow== - -browserify-aes@^1.0.6, browserify-aes@^1.2.0: +browserify-aes@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/browserify-aes/-/browserify-aes-1.2.0.tgz#326734642f403dabc3003209853bb70ad428ef48" integrity sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA== @@ -1678,14 +988,15 @@ browserify-aes@^1.0.6, browserify-aes@^1.2.0: safe-buffer "^5.0.1" browserslist@^4.24.0: - version "4.25.1" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.25.1.tgz#ba9e8e6f298a1d86f829c9b975e07948967bb111" - integrity sha512-KGj0KoOMXLpSNkkEI6Z6mShmQy0bc1I+T7K9N81k4WWMrfz+6fQ6es80B/YLAeRoKvjYE1YSHHOW1qe9xIVzHw== + version "4.28.7" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.28.7.tgz#409046517fccd2e51cdc20f077454b7141184028" + integrity sha512-JxV13hNrFxqjOc8alRbq9dK1MM79NEXYpma2B2J4wAtpWS5zIEIKqWPGCl7N4o7Uc7B7itylh7SuDujATRyyTw== dependencies: - caniuse-lite "^1.0.30001726" - electron-to-chromium "^1.5.173" - node-releases "^2.0.19" - update-browserslist-db "^1.1.3" + baseline-browser-mapping "^2.10.44" + caniuse-lite "^1.0.30001806" + electron-to-chromium "^1.5.393" + node-releases "^2.0.51" + update-browserslist-db "^1.2.3" bs58@^4.0.0: version "4.0.1" @@ -1694,14 +1005,14 @@ bs58@^4.0.0: dependencies: base-x "^3.0.2" -bs58@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/bs58/-/bs58-5.0.0.tgz#865575b4d13c09ea2a84622df6c8cbeb54ffc279" - integrity sha512-r+ihvQJvahgYT50JD05dyJNKlmmSlMoOGwn1lCcEzanPglg7TxYjioQUYehQ9mAR/+hOSd2jRc/Z2y5UxBymvQ== +bs58@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/bs58/-/bs58-6.0.0.tgz#a2cda0130558535dd281a2f8697df79caaf425d8" + integrity sha512-PD0wEnEYg6ijszw/u8s+iI3H17cTymlrwkKhDhPZq+Sokl3AU4htyBFTjAeNAlCCmg0f53g6ih3jATyCKftTfw== dependencies: - base-x "^4.0.0" + base-x "^5.0.0" -bs58check@2.1.2, bs58check@<3.0.0, bs58check@^2.0.0, bs58check@^2.1.1, bs58check@^2.1.2: +bs58check@^2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/bs58check/-/bs58check-2.1.2.tgz#53b018291228d82a5aa08e7d796fdafda54aebfc" integrity sha512-0TS1jicxdU09dwJMNZtVAfzPi6Q6QeN0pM1Fkzrjn+XYHvzMKPU3pHVpva+769iNVSfIYWf7LJ6WR+BuuMf8cA== @@ -1710,13 +1021,13 @@ bs58check@2.1.2, bs58check@<3.0.0, bs58check@^2.0.0, bs58check@^2.1.1, bs58check create-hash "^1.1.0" safe-buffer "^5.1.2" -bs58check@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/bs58check/-/bs58check-3.0.1.tgz#2094d13720a28593de1cba1d8c4e48602fdd841c" - integrity sha512-hjuuJvoWEybo7Hn/0xOrczQKKEKD63WguEjlhLExYs2wUBcebDC1jDNK17eEAD2lYfw82d5ASC1d7K3SWszjaQ== +bs58check@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/bs58check/-/bs58check-4.0.0.tgz#46cda52a5713b7542dcb78ec2efdf78f5bf1d23c" + integrity sha512-FsGDOnFg9aVI9erdriULkd/JjEWONV/lQE5aYziB5PoBsXRind56lh8doIZIc9X4HoxT5x4bLjMWN1/NB8Zp5g== dependencies: "@noble/hashes" "^1.2.0" - bs58 "^5.0.0" + bs58 "^6.0.0" bser@2.1.1: version "2.1.1" @@ -1730,17 +1041,12 @@ buffer-from@^1.0.0: resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5" integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== -buffer-to-arraybuffer@^0.0.5: - version "0.0.5" - resolved "https://registry.yarnpkg.com/buffer-to-arraybuffer/-/buffer-to-arraybuffer-0.0.5.tgz#6064a40fa76eb43c723aba9ef8f6e1216d10511a" - integrity sha512-3dthu5CYiVB1DEJp61FtApNnNndTckcqe4pFcLdvHtrpG+kcyekCJKg4MRiDcFW7A6AODnXB9U4dwQiCW5kzJQ== - buffer-xor@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/buffer-xor/-/buffer-xor-1.0.3.tgz#26e61ed1422fb70dd42e6e36729ed51d855fe8d9" integrity sha512-571s0T7nZWK6vB67HI5dyUF7wXiNcfaPPPTl6zYCNApANjIvYJTg7hlud/+cJpdAhS7dVzqMLmfhfHR3rAcOjQ== -buffer@^5.0.5, buffer@^5.5.0, buffer@^5.6.0: +buffer@^5.6.0: version "5.7.1" resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.7.1.tgz#ba62e7c13133053582197160851a8f648e99eed0" integrity sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ== @@ -1756,42 +1062,7 @@ buffer@^6.0.3: base64-js "^1.3.1" ieee754 "^1.2.1" -bufferutil@^4.0.1: - version "4.0.9" - resolved "https://registry.yarnpkg.com/bufferutil/-/bufferutil-4.0.9.tgz#6e81739ad48a95cad45a279588e13e95e24a800a" - integrity sha512-WDtdLmJvAuNNPzByAYpRo2rF1Mmradw6gvWsQKf63476DDXmomT9zUiGypLcG4ibIM67vhAj8jJRdbmEws2Aqw== - dependencies: - node-gyp-build "^4.3.0" - -bytes@3.1.2: - version "3.1.2" - resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.2.tgz#8b0beeb98605adf1b128fa4386403c009e0221a5" - integrity sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg== - -cacheable-lookup@^5.0.3: - version "5.0.4" - resolved "https://registry.yarnpkg.com/cacheable-lookup/-/cacheable-lookup-5.0.4.tgz#5a6b865b2c44357be3d5ebc2a467b032719a7005" - integrity sha512-2/kNscPhpcxrOigMZzbiWF7dz8ilhb/nIHU3EyZiXWXpeq/au8qJ8VhdftMkty3n7Gj6HIGalQG8oiBNB3AJgA== - -cacheable-lookup@^6.0.4: - version "6.1.0" - resolved "https://registry.yarnpkg.com/cacheable-lookup/-/cacheable-lookup-6.1.0.tgz#0330a543471c61faa4e9035db583aad753b36385" - integrity sha512-KJ/Dmo1lDDhmW2XDPMo+9oiy/CeqosPguPCrgcVzKyZrL6pM1gU2GmPY/xo6OQPTUaA/c0kwHuywB4E6nmT9ww== - -cacheable-request@^7.0.2: - version "7.0.4" - resolved "https://registry.yarnpkg.com/cacheable-request/-/cacheable-request-7.0.4.tgz#7a33ebf08613178b403635be7b899d3e69bbe817" - integrity sha512-v+p6ongsrp0yTGbJXjgxPow2+DL93DASP4kXCDKb8/bwRtt9OEF3whggkkDkGNzgcWy2XaF4a8nZglC7uElscg== - dependencies: - clone-response "^1.0.2" - get-stream "^5.1.0" - http-cache-semantics "^4.0.0" - keyv "^4.0.0" - lowercase-keys "^2.0.0" - normalize-url "^6.0.1" - responselike "^2.0.0" - -call-bind-apply-helpers@^1.0.0, call-bind-apply-helpers@^1.0.1, call-bind-apply-helpers@^1.0.2: +call-bind-apply-helpers@^1.0.1, call-bind-apply-helpers@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz#4b5428c222be985d79c3d82657479dbe0b59b2d6" integrity sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ== @@ -1799,17 +1070,17 @@ call-bind-apply-helpers@^1.0.0, call-bind-apply-helpers@^1.0.1, call-bind-apply- es-errors "^1.3.0" function-bind "^1.1.2" -call-bind@^1.0.8: - version "1.0.8" - resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.8.tgz#0736a9660f537e3388826f440d5ec45f744eaa4c" - integrity sha512-oKlSFMcMwpUg2ednkhQ454wfWiU/ul3CkJe/PEHcTKuiX6RpbehUiFMXu13HalGZxfUwCQzZG747YXBn1im9ww== +call-bind@^1.0.9: + version "1.0.9" + resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.9.tgz#39a644700c80bc7d0ca9102fc6d1d43b2fd7eee7" + integrity sha512-a/hy+pNsFUTR+Iz8TCJvXudKVLAnz/DyeSUo10I5yvFDQJBFU2s9uqQpoSrJlroHUKoKqzg+epxyP9lqFdzfBQ== dependencies: - call-bind-apply-helpers "^1.0.0" - es-define-property "^1.0.0" - get-intrinsic "^1.2.4" + call-bind-apply-helpers "^1.0.2" + es-define-property "^1.0.1" + get-intrinsic "^1.3.0" set-function-length "^1.2.2" -call-bound@^1.0.2, call-bound@^1.0.3, call-bound@^1.0.4: +call-bound@^1.0.3, call-bound@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/call-bound/-/call-bound-1.0.4.tgz#238de935d2a2a692928c538c7ccfa91067fd062a" integrity sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg== @@ -1822,42 +1093,20 @@ callsites@^3.0.0: resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== -camelcase-keys@^7.0.2: - version "7.0.2" - resolved "https://registry.yarnpkg.com/camelcase-keys/-/camelcase-keys-7.0.2.tgz#d048d8c69448745bb0de6fc4c1c52a30dfbe7252" - integrity sha512-Rjs1H+A9R+Ig+4E/9oyB66UC5Mj9Xq3N//vcLf2WzgdTi/3gUu3Z9KoqmlrEG4VuuLK8wJHofxzdQXz/knhiYg== - dependencies: - camelcase "^6.3.0" - map-obj "^4.1.0" - quick-lru "^5.1.1" - type-fest "^1.2.1" - camelcase@^5.3.1: version "5.3.1" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== -camelcase@^6.2.0, camelcase@^6.3.0: +camelcase@^6.2.0: version "6.3.0" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a" integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== -caniuse-lite@^1.0.30001726: - version "1.0.30001727" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001727.tgz#22e9706422ad37aa50556af8c10e40e2d93a8b85" - integrity sha512-pB68nIHmbN6L/4C6MH1DokyR3bYqFwjaSs/sWDHGj4CTcFtQUQMuJftVwWkXq7mNWOybD3KhUv3oWHoGxgP14Q== - -caseless@~0.12.0: - version "0.12.0" - resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" - integrity sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw== - -cashaddrjs@0.4.4: - version "0.4.4" - resolved "https://registry.yarnpkg.com/cashaddrjs/-/cashaddrjs-0.4.4.tgz#169f1ae620d325db77700273d972282adeeee331" - integrity sha512-xZkuWdNOh0uq/mxJIng6vYWfTowZLd9F4GMAlp2DwFHlcCqCm91NtuAc47RuV4L7r4PYcY5p6Cr2OKNb4hnkWA== - dependencies: - big-integer "1.6.36" +caniuse-lite@^1.0.30001806: + version "1.0.30001806" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001806.tgz#1bc8e502b723fa393455dfbedd5ccec0c29bb74e" + integrity sha512-72Cuvd95zbSYPKq6Fhg8eDJRlzgWDf7/mtoZv6Qe/DYNCEBdNxoA3+rZAU2ZhGCpZlns3EssFavaZomckT5Uuw== chalk@^4.0.0: version "4.1.2" @@ -1872,77 +1121,50 @@ char-regex@^1.0.2: resolved "https://registry.yarnpkg.com/char-regex/-/char-regex-1.0.2.tgz#d744358226217f981ed58f479b1d6bcc29545dcf" integrity sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw== -chownr@^1.1.4: - version "1.1.4" - resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.4.tgz#6fc9d7b42d32a583596337666e7d08084da2cc6b" - integrity sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg== - ci-info@^3.2.0: version "3.9.0" resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-3.9.0.tgz#4279a62028a7b1f262f3473fc9605f5e218c59b4" integrity sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ== -cids@^0.7.1: - version "0.7.5" - resolved "https://registry.yarnpkg.com/cids/-/cids-0.7.5.tgz#60a08138a99bfb69b6be4ceb63bfef7a396b28b2" - integrity sha512-zT7mPeghoWAu+ppn8+BS1tQ5qGmbMfB4AregnQjA/qHY3GC1m1ptI9GkWNlgeu38r7CuRdXB47uY2XgAYt6QVA== - dependencies: - buffer "^5.5.0" - class-is "^1.1.0" - multibase "~0.6.0" - multicodec "^1.0.0" - multihashes "~0.4.15" - cipher-base@^1.0.0, cipher-base@^1.0.1, cipher-base@^1.0.3: - version "1.0.6" - resolved "https://registry.yarnpkg.com/cipher-base/-/cipher-base-1.0.6.tgz#8fe672437d01cd6c4561af5334e0cc50ff1955f7" - integrity sha512-3Ek9H3X6pj5TgenXYtNWdaBon1tgYCaebd+XPg0keyjEbEfkD4KkmAxkQ/i1vYvxdcT5nscLBfq9VJRmCBcFSw== + version "1.0.7" + resolved "https://registry.yarnpkg.com/cipher-base/-/cipher-base-1.0.7.tgz#bd094bfef42634ccfd9e13b9fc73274997111e39" + integrity sha512-Mz9QMT5fJe7bKI7MH31UilT5cEK5EHHRCccw/YRFsRY47AuNgaV6HY3rscp0/I4Q+tTW/5zoqpSeRRI54TkDWA== dependencies: inherits "^2.0.4" safe-buffer "^5.2.1" + to-buffer "^1.2.2" cjs-module-lexer@^1.0.0: version "1.4.3" resolved "https://registry.yarnpkg.com/cjs-module-lexer/-/cjs-module-lexer-1.4.3.tgz#0f79731eb8cfe1ec72acd4066efac9d61991b00d" integrity sha512-9z8TZaGM1pfswYeXrUpzPrkx8UnWYdhJclsiYMm6x/w5+nN+8Tf/LnAgfLGQCm59qAOxU8WwHEq2vNwF6i4j+Q== -class-is@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/class-is/-/class-is-1.1.0.tgz#9d3c0fba0440d211d843cec3dedfa48055005825" - integrity sha512-rhjH9AG1fvabIDoGRVH587413LPjTZgmDF9fOFCbFJQV4yuocX1mHxxvXI4g3cGwbVY9wAYIoKlg1N79frJKQw== - -cliui@^7.0.2: - version "7.0.4" - resolved "https://registry.yarnpkg.com/cliui/-/cliui-7.0.4.tgz#a0265ee655476fc807aea9df3df8df7783808b4f" - integrity sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ== +cliui@^8.0.1: + version "8.0.1" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-8.0.1.tgz#0c04b075db02cbfe60dc8e6cf2f5486b1a3608aa" + integrity sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ== dependencies: string-width "^4.2.0" - strip-ansi "^6.0.0" + strip-ansi "^6.0.1" wrap-ansi "^7.0.0" -clone-response@^1.0.2: - version "1.0.3" - resolved "https://registry.yarnpkg.com/clone-response/-/clone-response-1.0.3.tgz#af2032aa47816399cf5f0a1d0db902f517abb8c3" - integrity sha512-ROoL94jJH2dUVML2Y/5PEDNaSHgeOdSDicUyS7izcF63G6sTc/FTjLub4b8Il9S8S0beOfYt0TaA5qvFK+w0wA== - dependencies: - mimic-response "^1.0.0" - co@^4.6.0: version "4.6.0" resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" integrity sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ== -coinselectsyscoin@^1.1.8: - version "1.1.8" - resolved "https://registry.yarnpkg.com/coinselectsyscoin/-/coinselectsyscoin-1.1.8.tgz#142671443cb092f34d54df26dcf72c561bbb5fea" - integrity sha512-k7FpmKrSzCXvDn7Al8WbSBTQf0kXieE+zoFipcl0XqCJgc5pFoyfelGEvKUMgkyPIG1CPjepSu4zE3wOXZJ4xA== +coinselectsyscoin@^1.1.12: + version "1.1.12" + resolved "https://registry.npmjs.org/coinselectsyscoin/-/coinselectsyscoin-1.1.12.tgz#2f8715735d59ab91beab85957da737ead33feccc" + integrity sha512-eQ/zZGaHRSvJ5Z8cNt3tEjH77WhRl2yBN0Dl/xMJXWa1Cj4S5x3/SlQB9ZaVfrxFFCmtpptDcQi0eMPT2mq1bQ== dependencies: - bn.js "^5.1.3" + bn.js "^5.2.4" collect-v8-coverage@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/collect-v8-coverage/-/collect-v8-coverage-1.0.2.tgz#c0b29bcd33bcd0779a1344c2136051e6afd3d9e9" - integrity sha512-lHl4d5/ONEbLlJvaJNtsF/Lz+WvB07u2ycqTYbdrq7UypDXailES4valYb2eWiJFxZlVmpGekfqoxQhzyFdT4Q== + version "1.0.3" + resolved "https://registry.yarnpkg.com/collect-v8-coverage/-/collect-v8-coverage-1.0.3.tgz#cc1f01eb8d02298cbc9a437c74c70ab4e5210b80" + integrity sha512-1L5aqIkwPfiodaMgQunkF1zRhNqifHBmtbbbxcr6yVxxBnliw4TDOW6NxpO8DJLgJ16OT+Y4ztZqP6p/FtXnAw== color-convert@^2.0.1: version "2.0.1" @@ -1956,7 +1178,7 @@ color-name@~1.1.4: resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== -combined-stream@^1.0.6, combined-stream@^1.0.8, combined-stream@~1.0.6: +combined-stream@^1.0.8: version "1.0.8" resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== @@ -1968,70 +1190,16 @@ concat-map@0.0.1: resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== -content-disposition@0.5.4: - version "0.5.4" - resolved "https://registry.yarnpkg.com/content-disposition/-/content-disposition-0.5.4.tgz#8b82b4efac82512a02bb0b1dcec9d2c5e8eb5bfe" - integrity sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ== - dependencies: - safe-buffer "5.2.1" - -content-hash@^2.5.2: - version "2.5.2" - resolved "https://registry.yarnpkg.com/content-hash/-/content-hash-2.5.2.tgz#bbc2655e7c21f14fd3bfc7b7d4bfe6e454c9e211" - integrity sha512-FvIQKy0S1JaWV10sMsA7TRx8bpU+pqPkhbsfvOJAdjRXvYxEckAwQWGwtRjiaJfh+E0DvcWUGqcdjwMGFjsSdw== - dependencies: - cids "^0.7.1" - multicodec "^0.5.5" - multihashes "^0.4.15" - -content-type@~1.0.4, content-type@~1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/content-type/-/content-type-1.0.5.tgz#8b773162656d1d1086784c8f23a54ce6d73d7918" - integrity sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA== - -convert-source-map@^1.4.0, convert-source-map@^1.6.0: - version "1.9.0" - resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.9.0.tgz#7faae62353fb4213366d0ca98358d22e8368b05f" - integrity sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A== - convert-source-map@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-2.0.0.tgz#4b560f649fc4e918dd0ab75cf4961e8bc882d82a" integrity sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg== -cookie-signature@1.0.6: - version "1.0.6" - resolved "https://registry.yarnpkg.com/cookie-signature/-/cookie-signature-1.0.6.tgz#e303a882b342cc3ee8ca513a79999734dab3ae2c" - integrity sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ== - -cookie@0.7.1: - version "0.7.1" - resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.7.1.tgz#2f73c42142d5d5cf71310a74fc4ae61670e5dbc9" - integrity sha512-6DnInpx7SJ2AK3+CTUE/ZM0vWTUboZCegxhC2xiIydHR9jNuTAASBrfEpHhiGOZw/nX51bHt6YQl8jsGo4y/0w== - -core-util-is@1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" - integrity sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ== - core-util-is@~1.0.0: version "1.0.3" resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.3.tgz#a6042d3634c2b27e9328f837b965fac83808db85" integrity sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ== -cors@^2.8.1: - version "2.8.5" - resolved "https://registry.yarnpkg.com/cors/-/cors-2.8.5.tgz#eac11da51592dd86b9f06f6e7ac293b3df875d29" - integrity sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g== - dependencies: - object-assign "^4" - vary "^1" - -crc-32@^1.2.0: - version "1.2.2" - resolved "https://registry.yarnpkg.com/crc-32/-/crc-32-1.2.2.tgz#3cad35a934b8bf71f25ca524b6da51fb7eace2ff" - integrity sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ== - create-hash@^1.1.0, create-hash@^1.1.2, create-hash@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/create-hash/-/create-hash-1.2.0.tgz#889078af11a63756bcfb59bd221996be3a9ef196" @@ -2043,17 +1211,7 @@ create-hash@^1.1.0, create-hash@^1.1.2, create-hash@^1.2.0: ripemd160 "^2.0.1" sha.js "^2.4.0" -create-hash@~1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/create-hash/-/create-hash-1.1.3.tgz#606042ac8b9262750f483caddab0f5819172d8fd" - integrity sha512-snRpch/kwQhcdlnZKYanNF1m0RDlrCdSKQaH87w1FCFPVPNCQ/Il9QJKAX2jVBZddRdaHBMC+zXa9Gw9tmkNUA== - dependencies: - cipher-base "^1.0.1" - inherits "^2.0.1" - ripemd160 "^2.0.0" - sha.js "^2.4.0" - -create-hmac@^1.1.3, create-hmac@^1.1.4, create-hmac@^1.1.7: +create-hmac@^1.1.7: version "1.1.7" resolved "https://registry.yarnpkg.com/create-hmac/-/create-hmac-1.1.7.tgz#69170c78b3ab957147b2b8b04572e47ead2243ff" integrity sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg== @@ -2065,21 +1223,20 @@ create-hmac@^1.1.3, create-hmac@^1.1.4, create-hmac@^1.1.7: safe-buffer "^5.0.1" sha.js "^2.4.8" -cross-fetch@^3.1.5: - version "3.2.0" - resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-3.2.0.tgz#34e9192f53bc757d6614304d9e5e6fb4edb782e3" - integrity sha512-Q+xVJLoGOeIMXZmbUK4HYk+69cQH6LudR0Vu/pRm2YlU/hDV9CiS0gKUMaWY5f2NeUH9C1nV3bsTlCo0FsTV1Q== +create-jest@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/create-jest/-/create-jest-29.7.0.tgz#a355c5b3cb1e1af02ba177fe7afd7feee49a5320" + integrity sha512-Adz2bdH0Vq3F53KEMJOoftQFutWCukm6J24wbPWRO4k1kMY7gS7ds/uoJkNuV8wDCtWWnuwGcJwpWcih+zEW1Q== dependencies: - node-fetch "^2.7.0" - -cross-fetch@^4.0.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-4.1.0.tgz#8f69355007ee182e47fa692ecbaa37a52e43c3d2" - integrity sha512-uKm5PU+MHTootlWEY+mZ4vvXoCn4fLQxT9dSc1sXVMSFkINTJVN8cAQROpwcKm8bJ/c7rgZVIBWzH5T78sNZZw== - dependencies: - node-fetch "^2.7.0" + "@jest/types" "^29.6.3" + chalk "^4.0.0" + exit "^0.1.2" + graceful-fs "^4.2.9" + jest-config "^29.7.0" + jest-util "^29.7.0" + prompts "^2.0.1" -cross-spawn@^7.0.3, cross-spawn@^7.0.6: +cross-spawn@^7.0.3: version "7.0.6" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.6.tgz#8a58fe78f00dcd70c370451759dfbfaf03e8ee9f" integrity sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA== @@ -2088,105 +1245,28 @@ cross-spawn@^7.0.3, cross-spawn@^7.0.6: shebang-command "^2.0.0" which "^2.0.1" -crypto-js@^4.0.0, crypto-js@^4.1.1: +crypto-js@^4.1.1: version "4.2.0" resolved "https://registry.yarnpkg.com/crypto-js/-/crypto-js-4.2.0.tgz#4d931639ecdfd12ff80e8186dba6af2c2e856631" integrity sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q== -cssom@^0.4.4: - version "0.4.4" - resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.4.4.tgz#5a66cf93d2d0b661d80bf6a44fb65f5c2e4e0a10" - integrity sha512-p3pvU7r1MyyqbTk+WbNJIgJjG2VmTIaB10rI93LzVPrmDJKkzKYMtxxyAvQXR/NS6otuzveI7+7BBq3SjBS2mw== - -cssom@~0.3.6: - version "0.3.8" - resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.3.8.tgz#9f1276f5b2b463f2114d3f2c75250af8c1a36f4a" - integrity sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg== - -cssstyle@^2.3.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/cssstyle/-/cssstyle-2.3.0.tgz#ff665a0ddbdc31864b09647f34163443d90b0852" - integrity sha512-AZL67abkUzIuvcHqk7c09cezpGNcxUxU4Ioi/05xHk4DQeTkWmGYftIE6ctU6AEt+Gn4n1lDStOtj7FKycP71A== - dependencies: - cssom "~0.3.6" - -d@1, d@^1.0.1, d@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/d/-/d-1.0.2.tgz#2aefd554b81981e7dccf72d6842ae725cb17e5de" - integrity sha512-MOqHvMWF9/9MX6nza0KgvFH4HpMU0EF5uUDXqX/BtxtU8NfB0QzRtJ8Oe/6SuS4kbhyzVJwjd97EA4PKrzJ8bw== - dependencies: - es5-ext "^0.10.64" - type "^2.7.2" - -dashdash@^1.12.0: - version "1.14.1" - resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0" - integrity sha512-jRFi8UDGo6j+odZiEpjazZaWqEal3w/basFjQHQEwVtZJGDpxbH1MeYluwCS8Xq5wmLJooDlMgvVarmWfGM44g== - dependencies: - assert-plus "^1.0.0" - -data-urls@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/data-urls/-/data-urls-2.0.0.tgz#156485a72963a970f5d5821aaf642bef2bf2db9b" - integrity sha512-X5eWTSXO/BJmpdIKCRuKUgSCgAN0OwliVK3yPKbwIWU1Tdw5BRajxlzMidvh+gwko9AfQ9zIj52pzF91Q3YAvQ== - dependencies: - abab "^2.0.3" - whatwg-mimetype "^2.3.0" - whatwg-url "^8.0.0" - -debug@2.6.9, debug@^2.2.0: - version "2.6.9" - resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" - integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== - dependencies: - ms "2.0.0" - debug@4, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1: - version "4.4.1" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.4.1.tgz#e5a8bc6cbc4c6cd3e64308b0693a3d4fa550189b" - integrity sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ== + version "4.4.3" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.4.3.tgz#c6ae432d9bd9662582fce08709b038c58e9e3d6a" + integrity sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA== dependencies: ms "^2.1.3" -decimal.js@^10.2.1: - version "10.6.0" - resolved "https://registry.yarnpkg.com/decimal.js/-/decimal.js-10.6.0.tgz#e649a43e3ab953a72192ff5983865e509f37ed9a" - integrity sha512-YpgQiITW3JXGntzdUmyUR1V812Hn8T1YVXhCu+wO3OpS4eU9l4YdD3qjyiKdV6mvV29zapkMeD390UVEf2lkUg== - -decode-uri-component@^0.2.0: - version "0.2.2" - resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.2.tgz#e69dbe25d37941171dd540e024c444cd5188e1e9" - integrity sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ== - -decompress-response@^3.3.0: - version "3.3.0" - resolved "https://registry.yarnpkg.com/decompress-response/-/decompress-response-3.3.0.tgz#80a4dd323748384bfa248083622aedec982adff3" - integrity sha512-BzRPQuY1ip+qDonAOz42gRm/pg9F768C+npV/4JOsxRC2sq+Rlk+Q4ZCAsOhnIaMrgarILY+RMUIvMmmX1qAEA== - dependencies: - mimic-response "^1.0.0" - -decompress-response@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/decompress-response/-/decompress-response-6.0.0.tgz#ca387612ddb7e104bd16d85aab00d5ecf09c66fc" - integrity sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ== - dependencies: - mimic-response "^3.1.0" - -dedent@^0.7.0: - version "0.7.0" - resolved "https://registry.yarnpkg.com/dedent/-/dedent-0.7.0.tgz#2495ddbaf6eb874abb0e1be9df22d2e5a544326c" - integrity sha512-Q6fKUPqnAHAyhiUgFU7BUzLiv0kd8saH9al7tnu5Q/okj6dnupxyTgFIBjVzJATdfIAm9NAsvXNzjaKa+bxVyA== +dedent@^1.0.0: + version "1.7.2" + resolved "https://registry.yarnpkg.com/dedent/-/dedent-1.7.2.tgz#34e2264ab538301e27cf7b07bf2369c19baa8dd9" + integrity sha512-WzMx3mW98SN+zn3hgemf4OzdmyNhhhKz5Ay0pUfQiMQ3e1g+xmTJWp/pKdwKVXhdSkAEGIIzqeuWrL3mV/AXbA== deepmerge@^4.2.2: version "4.3.1" resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.3.1.tgz#44b5f2147cd3b00d4b56137685966f26fd25dd4a" integrity sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A== -defer-to-connect@^2.0.0, defer-to-connect@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/defer-to-connect/-/defer-to-connect-2.0.1.tgz#8016bdb4143e4632b77a3449c6236277de520587" - integrity sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg== - deferred-leveldown@~4.0.0: version "4.0.2" resolved "https://registry.yarnpkg.com/deferred-leveldown/-/deferred-leveldown-4.0.2.tgz#0b0570087827bf480a23494b398f04c128c19a20" @@ -2209,46 +1289,15 @@ delayed-stream@~1.0.0: resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ== -depd@2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/depd/-/depd-2.0.0.tgz#b696163cc757560d09cf22cc8fad1571b79e76df" - integrity sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw== - -destroy@1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/destroy/-/destroy-1.2.0.tgz#4803735509ad8be552934c67df614f94e66fa015" - integrity sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg== - detect-newline@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-3.1.0.tgz#576f5dfc63ae1a192ff192d8ad3af6308991b651" integrity sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA== -diff-sequences@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-27.5.1.tgz#eaecc0d327fd68c8d9672a1e64ab8dccb2ef5327" - integrity sha512-k1gCAXAsNgLwEL+Y8Wvl+M6oEFj5bgazfZULpS5CneoPPXRaCCW7dm+q21Ky2VEE5X+VeRDBVg1Pcvvsr4TtNQ== - -dom-walk@^0.1.0: - version "0.1.2" - resolved "https://registry.yarnpkg.com/dom-walk/-/dom-walk-0.1.2.tgz#0c548bef048f4d1f2a97249002236060daa3fd84" - integrity sha512-6QvTW9mrGeIegrFXdtQi9pk7O/nSK6lSdXW2eqUspN5LWD7UTji2Fqw5V2YLjBpHEoU9Xl/eUWNpDeZvoyOv2w== - -domexception@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/domexception/-/domexception-2.0.1.tgz#fb44aefba793e1574b0af6aed2801d057529f304" - integrity sha512-yxJ2mFy/sibVQlu5qHjOkf9J3K6zgmCxgJ94u2EdvDOV09H+32LtRswEcUsmUWN72pVLOEnTSRaIVVzVQgS0dg== - dependencies: - webidl-conversions "^5.0.0" - -drbg.js@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/drbg.js/-/drbg.js-1.0.1.tgz#3e36b6c42b37043823cdbc332d58f31e2445480b" - integrity sha512-F4wZ06PvqxYLFEZKkFxTDcns9oFNk34hvmJSEwdzsxVQ8YI5YaxtACgQatkYgv2VI2CFkUd2Y+xosPQnHv809g== - dependencies: - browserify-aes "^1.0.6" - create-hash "^1.1.2" - create-hmac "^1.1.4" +diff-sequences@^29.6.3: + version "29.6.3" + resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-29.6.3.tgz#4deaf894d11407c51efc8418012f9e70b84ea921" + integrity sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q== dunder-proto@^1.0.1: version "1.0.1" @@ -2259,30 +1308,21 @@ dunder-proto@^1.0.1: es-errors "^1.3.0" gopd "^1.2.0" -eastasianwidth@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/eastasianwidth/-/eastasianwidth-0.2.0.tgz#696ce2ec0aa0e6ea93a397ffcf24aa7840c827cb" - integrity sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA== - -ecc-jsbn@~0.1.1: - version "0.1.2" - resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz#3a83a904e54353287874c564b7549386849a98c9" - integrity sha512-eh9O+hwRHNbG4BLTjEl3nw044CkGm5X6LoaCf7LPp7UU8Qrt47JYNi6nPX8xjW97TKGKm1ouctg0QSpZe9qrnw== +ecpair@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/ecpair/-/ecpair-3.0.1.tgz#94be8bb9efbfc0fdb5c5b4bd9b5d1da53b42a621" + integrity sha512-uz8wMFvtdr58TLrXnAesBsoMEyY8UudLOfApcyg40XfZjP+gt1xO4cuZSIkZ8hTMTQ8+ETgt7xSIV4eM7M6VNw== dependencies: - jsbn "~0.1.0" - safer-buffer "^2.1.0" - -ee-first@1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" - integrity sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow== + uint8array-tools "^0.0.8" + valibot "^1.2.0" + wif "^5.0.0" -electron-to-chromium@^1.5.173: - version "1.5.191" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.191.tgz#8ae49a471447b1ceaf1d4d183a9000082f52363c" - integrity sha512-xcwe9ELcuxYLUFqZZxL19Z6HVKcvNkIwhbHUz7L3us6u12yR+7uY89dSl570f/IqNthx8dAw3tojG7i4Ni4tDA== +electron-to-chromium@^1.5.393: + version "1.5.402" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.402.tgz#1bd96a2b0352c3d3a49d9a6c0f95269b64f70937" + integrity sha512-/oOpMaPT6Yg+6/1XQhyIPlzgj7Ye9zf+nNM2Uh6OcE2G2oNptWazFa+qB2Pdqqbsc9KnIDzgAntoYN0dbwOXwA== -elliptic@6.6.1, elliptic@^6.4.0, elliptic@^6.5.2, elliptic@^6.5.7: +elliptic@^6.5.2, elliptic@^6.5.7: version "6.6.1" resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.6.1.tgz#3b8ffb02670bf69e382c7f65bf524c97c5405c06" integrity sha512-RaddvvMatK2LJHqFJ+YA4WysVN5Ita9E35botqIYspQ4TkRAlCicdzKOjlyv/1Za5RyTNn7di//eEV0uTAfe3g== @@ -2295,31 +1335,16 @@ elliptic@6.6.1, elliptic@^6.4.0, elliptic@^6.5.2, elliptic@^6.5.7: minimalistic-assert "^1.0.1" minimalistic-crypto-utils "^1.0.1" -emittery@^0.8.1: - version "0.8.1" - resolved "https://registry.yarnpkg.com/emittery/-/emittery-0.8.1.tgz#bb23cc86d03b30aa75a7f734819dee2e1ba70860" - integrity sha512-uDfvUjVrfGJJhymx/kz6prltenw1u7WrCg1oa94zYY8xxVpLLUu045LAT0dhDZdXG58/EpPL/5kA180fQ/qudg== +emittery@^0.13.1: + version "0.13.1" + resolved "https://registry.yarnpkg.com/emittery/-/emittery-0.13.1.tgz#c04b8c3457490e0847ae51fced3af52d338e3dad" + integrity sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ== emoji-regex@^8.0.0: version "8.0.0" resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== -emoji-regex@^9.2.2: - version "9.2.2" - resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-9.2.2.tgz#840c8803b0d8047f4ff0cf963176b32d4ef3ed72" - integrity sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg== - -encodeurl@~1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59" - integrity sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w== - -encodeurl@~2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-2.0.0.tgz#7b8ea898077d7e409d3ac45474ea38eaf0857a58" - integrity sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg== - encoding-down@~5.0.0: version "5.0.4" resolved "https://registry.yarnpkg.com/encoding-down/-/encoding-down-5.0.4.tgz#1e477da8e9e9d0f7c8293d320044f8b2cd8e9614" @@ -2338,13 +1363,6 @@ encoding@^0.1.11: dependencies: iconv-lite "^0.6.2" -end-of-stream@^1.1.0: - version "1.4.5" - resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.5.tgz#7344d711dea40e0b74abc2ed49778743ccedb08c" - integrity sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg== - dependencies: - once "^1.4.0" - errno@~0.1.1: version "0.1.8" resolved "https://registry.yarnpkg.com/errno/-/errno-0.1.8.tgz#8bb3e9c7d463be4976ff888f76b4809ebc2e811f" @@ -2353,9 +1371,9 @@ errno@~0.1.1: prr "~1.0.1" error-ex@^1.3.1: - version "1.3.2" - resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf" - integrity sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g== + version "1.3.4" + resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.4.tgz#b3a8d8bb6f92eecc1629e3e27d3c8607a8a32414" + integrity sha512-sqQamAnR14VgCr1A618A3sGrygcpK+HEbenA/HiEAkkUwcZIIB/tgWqHFxWgOyDh4nB4JCRimh79dR5Ywc9MDQ== dependencies: is-arrayish "^0.2.1" @@ -2370,9 +1388,9 @@ es-errors@^1.3.0: integrity sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw== es-object-atoms@^1.0.0, es-object-atoms@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/es-object-atoms/-/es-object-atoms-1.1.1.tgz#1c4f2c4837327597ce69d2ca190a7fdd172338c1" - integrity sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA== + version "1.1.2" + resolved "https://registry.yarnpkg.com/es-object-atoms/-/es-object-atoms-1.1.2.tgz#a2d0b373205724dfa525d23b0c3e1b1ca582c99b" + integrity sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw== dependencies: es-errors "^1.3.0" @@ -2386,128 +1404,26 @@ es-set-tostringtag@^2.1.0: has-tostringtag "^1.0.2" hasown "^2.0.2" -es5-ext@^0.10.35, es5-ext@^0.10.62, es5-ext@^0.10.63, es5-ext@^0.10.64, es5-ext@~0.10.14: - version "0.10.64" - resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.64.tgz#12e4ffb48f1ba2ea777f1fcdd1918ef73ea21714" - integrity sha512-p2snDhiLaXe6dahss1LddxqEm+SkuDvV8dnIQG0MWjyHpcMNfXKPE+/Cc0y+PhxJX3A4xGNeFCj5oc0BUh6deg== - dependencies: - es6-iterator "^2.0.3" - es6-symbol "^3.1.3" - esniff "^2.0.1" - next-tick "^1.1.0" - -es6-iterator@^2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/es6-iterator/-/es6-iterator-2.0.3.tgz#a7de889141a05a94b0854403b2d0a0fbfa98f3b7" - integrity sha512-zw4SRzoUkd+cl+ZoE15A9o1oQd920Bb0iOJMQkQhl3jNc03YqVjAhG7scf9C5KWRU/R13Orf588uCC6525o02g== - dependencies: - d "1" - es5-ext "^0.10.35" - es6-symbol "^3.1.1" - -es6-promise@^4.2.8: - version "4.2.8" - resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-4.2.8.tgz#4eb21594c972bc40553d276e510539143db53e0a" - integrity sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w== - -es6-symbol@^3.1.1, es6-symbol@^3.1.3: - version "3.1.4" - resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.4.tgz#f4e7d28013770b4208ecbf3e0bf14d3bcb557b8c" - integrity sha512-U9bFFjX8tFiATgtkJ1zg25+KviIXpgRvRHS8sau3GfhVzThRQrOeksPeT0BWW2MNZs1OEWJ1DPXOQMn0KKRkvg== - dependencies: - d "^1.0.2" - ext "^1.7.0" - escalade@^3.1.1, escalade@^3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.2.0.tgz#011a3f69856ba189dffa7dc8fcce99d2a87903e5" integrity sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA== -escape-html@~1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988" - integrity sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow== - escape-string-regexp@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz#a30304e99daa32e23b2fd20f51babd07cffca344" integrity sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w== -escodegen@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-2.1.0.tgz#ba93bbb7a43986d29d6041f99f5262da773e2e17" - integrity sha512-2NlIDTwUWJN0mRPQOdtQBzbUHvdGY2P1VXSyU83Q3xKxM7WHX2Ql8dKq782Q9TgQUNOLEzEYu9bzLNj1q88I5w== - dependencies: - esprima "^4.0.1" - estraverse "^5.2.0" - esutils "^2.0.2" - optionalDependencies: - source-map "~0.6.1" - -esniff@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/esniff/-/esniff-2.0.1.tgz#a4d4b43a5c71c7ec51c51098c1d8a29081f9b308" - integrity sha512-kTUIGKQ/mDPFoJ0oVfcmyJn4iBDRptjNVIzwIFR7tqWXdVI9xfA2RMwY/gbSpJG3lkdWNEjLap/NqVHZiJsdfg== - dependencies: - d "^1.0.1" - es5-ext "^0.10.62" - event-emitter "^0.3.5" - type "^2.7.2" - -esprima@^4.0.0, esprima@^4.0.1: +esprima@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== -estraverse@^5.2.0: - version "5.3.0" - resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.3.0.tgz#2eea5290702f26ab8fe5370370ff86c965d21123" - integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA== - -esutils@^2.0.2: - version "2.0.3" - resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" - integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== - -etag@~1.8.1: - version "1.8.1" - resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" - integrity sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg== - eth-chains@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/eth-chains/-/eth-chains-1.0.0.tgz#1386496ee1aa231a4d050fde6a87fe36741ecb83" integrity sha512-SnJrJPSr5I3rKpW6RZT/qhX8qbmE5bsMeeHoRWBXkvbifudfi3YLKHXZMdLsg+Yv+PP8oqSyPxOvQxKwjNVqmQ== -eth-ens-namehash@2.0.8: - version "2.0.8" - resolved "https://registry.yarnpkg.com/eth-ens-namehash/-/eth-ens-namehash-2.0.8.tgz#229ac46eca86d52e0c991e7cb2aef83ff0f68bcf" - integrity sha512-VWEI1+KJfz4Km//dadyvBBoBeSQ0MHTXPvr8UIXiLW6IanxvAV+DmlZAijZwAyggqGUfwQBeHf7tc9wzc1piSw== - dependencies: - idna-uts46-hx "^2.3.1" - js-sha3 "^0.5.7" - -eth-lib@0.2.8: - version "0.2.8" - resolved "https://registry.yarnpkg.com/eth-lib/-/eth-lib-0.2.8.tgz#b194058bef4b220ad12ea497431d6cb6aa0623c8" - integrity sha512-ArJ7x1WcWOlSpzdoTBX8vkwlkSQ85CjjifSZtV4co64vWxSV8geWfPI9x4SVYu3DSxnX4yWFVTtGL+j9DUFLNw== - dependencies: - bn.js "^4.11.6" - elliptic "^6.4.0" - xhr-request-promise "^0.1.2" - -eth-lib@^0.1.26: - version "0.1.29" - resolved "https://registry.yarnpkg.com/eth-lib/-/eth-lib-0.1.29.tgz#0c11f5060d42da9f931eab6199084734f4dbd1d9" - integrity sha512-bfttrr3/7gG4E02HoWTDUcDDslN003OlOoBxk9virpAZQ1ja/jDgwkWB8QfJF7ojuEowrqy+lzp9VcJG7/k5bQ== - dependencies: - bn.js "^4.11.6" - elliptic "^6.4.0" - nano-json-stream-parser "^0.1.2" - servify "^0.1.12" - ws "^3.0.0" - xhr-request-promise "^0.1.2" - eth-object@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/eth-object/-/eth-object-1.0.3.tgz#5e7a58615793e570c6b1c009eb282876b4d059b6" @@ -2515,7 +1431,7 @@ eth-object@^1.0.3: dependencies: eth-util-lite "^1.0.1" -"eth-object@git+https://github.com/syscoin/eth-object.git": +"eth-object@https://github.com/syscoin/eth-object.git": version "1.0.3" resolved "git+https://github.com/syscoin/eth-object.git#b5ff300f57c136138b31d6e570c816a147e0f1c9" dependencies: @@ -2543,13 +1459,6 @@ eth-util-lite@^1.0.1: rlp "^2.2.3" safe-buffer "^5.1.2" -ethereum-bloom-filters@^1.0.6: - version "1.2.0" - resolved "https://registry.yarnpkg.com/ethereum-bloom-filters/-/ethereum-bloom-filters-1.2.0.tgz#8294f074c1a6cbd32c39d2cc77ce86ff14797dab" - integrity sha512-28hyiE7HVsWubqhpVLVmZXFd4ITeHi+BUu05o9isf0GUpMtzBUi+8/gFrGaGYzvGAJQmJ3JKj77Mk9G98T84rA== - dependencies: - "@noble/hashes" "^1.4.0" - ethereum-cryptography@^0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/ethereum-cryptography/-/ethereum-cryptography-0.1.3.tgz#8d6143cfc3d74bf79bbd8edecdf29e4ae20dd191" @@ -2571,16 +1480,6 @@ ethereum-cryptography@^0.1.3: secp256k1 "^4.0.1" setimmediate "^1.0.5" -ethereum-cryptography@^2.0.0, ethereum-cryptography@^2.1.2: - version "2.2.1" - resolved "https://registry.yarnpkg.com/ethereum-cryptography/-/ethereum-cryptography-2.2.1.tgz#58f2810f8e020aecb97de8c8c76147600b0b8ccf" - integrity sha512-r/W8lkHSiTLxUxW8Rf3u4HGB0xQweG2RyETjywylKZSzLWoWAijRz8WCuOtJ6wah+avllXBqZuk29HCCvhEIRg== - dependencies: - "@noble/curves" "1.4.2" - "@noble/hashes" "1.4.0" - "@scure/bip32" "1.4.0" - "@scure/bip39" "1.3.0" - ethereumjs-util@^5.2.0: version "5.2.1" resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-5.2.1.tgz#a833f0e5fca7e5b361384dc76301a721f537bf65" @@ -2594,60 +1493,18 @@ ethereumjs-util@^5.2.0: rlp "^2.0.0" safe-buffer "^5.1.1" -ethereumjs-util@^7.1.5: - version "7.1.5" - resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-7.1.5.tgz#9ecf04861e4fbbeed7465ece5f23317ad1129181" - integrity sha512-SDl5kKrQAudFBUe5OJM9Ac6WmMyYmXX/6sTmLZ3ffG2eY6ZIGBes3pEDxNN6V72WyOw4CPD5RomKdsa8DAAwLg== - dependencies: - "@types/bn.js" "^5.1.0" - bn.js "^5.1.2" - create-hash "^1.1.2" - ethereum-cryptography "^0.1.3" - rlp "^2.2.4" - -ethers@^5.6.9, ethers@^5.7.2: - version "5.8.0" - resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.8.0.tgz#97858dc4d4c74afce83ea7562fe9493cedb4d377" - integrity sha512-DUq+7fHrCg1aPDFCHx6UIPb3nmt2XMpM7Y/g2gLhsl3lIBqeAfOJIl1qEvRf2uq3BiKxmh6Fh5pfp2ieyek7Kg== - dependencies: - "@ethersproject/abi" "5.8.0" - "@ethersproject/abstract-provider" "5.8.0" - "@ethersproject/abstract-signer" "5.8.0" - "@ethersproject/address" "5.8.0" - "@ethersproject/base64" "5.8.0" - "@ethersproject/basex" "5.8.0" - "@ethersproject/bignumber" "5.8.0" - "@ethersproject/bytes" "5.8.0" - "@ethersproject/constants" "5.8.0" - "@ethersproject/contracts" "5.8.0" - "@ethersproject/hash" "5.8.0" - "@ethersproject/hdnode" "5.8.0" - "@ethersproject/json-wallets" "5.8.0" - "@ethersproject/keccak256" "5.8.0" - "@ethersproject/logger" "5.8.0" - "@ethersproject/networks" "5.8.0" - "@ethersproject/pbkdf2" "5.8.0" - "@ethersproject/properties" "5.8.0" - "@ethersproject/providers" "5.8.0" - "@ethersproject/random" "5.8.0" - "@ethersproject/rlp" "5.8.0" - "@ethersproject/sha2" "5.8.0" - "@ethersproject/signing-key" "5.8.0" - "@ethersproject/solidity" "5.8.0" - "@ethersproject/strings" "5.8.0" - "@ethersproject/transactions" "5.8.0" - "@ethersproject/units" "5.8.0" - "@ethersproject/wallet" "5.8.0" - "@ethersproject/web" "5.8.0" - "@ethersproject/wordlists" "5.8.0" - -ethjs-unit@0.1.6: - version "0.1.6" - resolved "https://registry.yarnpkg.com/ethjs-unit/-/ethjs-unit-0.1.6.tgz#c665921e476e87bce2a9d588a6fe0405b2c41699" - integrity sha512-/Sn9Y0oKl0uqQuvgFk/zQgR7aw1g36qX/jzSQ5lSwlO0GigPymk4eGQfeNTD03w1dPOqfz8V77Cy43jH56pagw== +ethers@^6.17.0: + version "6.17.0" + resolved "https://registry.yarnpkg.com/ethers/-/ethers-6.17.0.tgz#ad85ee1fc45fe2d95cb1e21c4e3ff9f7f1b093cc" + integrity sha512-BpyrpIPJ3ydEVow8zGaz1DuPS7YU8DcWxuBnY9a0UA/lvAPwrMr+EPXsfrul628SRaekPNeIM4UFh/91GWZang== dependencies: - bn.js "4.11.6" - number-to-bn "1.7.0" + "@adraffy/ens-normalize" "1.11.1" + "@noble/curves" "1.2.0" + "@noble/hashes" "1.3.2" + "@types/node" "22.7.5" + aes-js "4.0.0-beta.5" + tslib "2.7.0" + ws "8.21.0" ethjs-util@^0.1.3: version "0.1.6" @@ -2657,24 +1514,6 @@ ethjs-util@^0.1.3: is-hex-prefixed "1.0.0" strip-hex-prefix "1.0.0" -event-emitter@^0.3.5: - version "0.3.5" - resolved "https://registry.yarnpkg.com/event-emitter/-/event-emitter-0.3.5.tgz#df8c69eef1647923c7157b9ce83840610b02cc39" - integrity sha512-D9rRn9y7kLPnJ+hMq7S/nhvoKwwvVJahBi2BPmx3bvbsEdK3W9ii8cBSGjP+72/LnM4n6fo3+dkCX5FeTQruXA== - dependencies: - d "1" - es5-ext "~0.10.14" - -eventemitter3@4.0.4: - version "4.0.4" - resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.4.tgz#b5463ace635a083d018bdc7c917b4c5f10a85384" - integrity sha512-rlaVLnVxtxvoyLsQQFBx53YmXHDxRIzzTLbdfxqi4yocpSjAxXwkU0cScM5JgSKMqEhrZpnvQ2D9gjylR0AimQ== - -events@^3.3.0: - version "3.3.0" - resolved "https://registry.yarnpkg.com/events/-/events-3.3.0.tgz#31a95ad0a924e2d2c419a813aeb2c4e878ea7400" - integrity sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q== - evp_bytestokey@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz#7fcbdb198dc71959432efe13842684e0525acb02" @@ -2703,81 +1542,18 @@ exit@^0.1.2: resolved "https://registry.yarnpkg.com/exit/-/exit-0.1.2.tgz#0632638f8d877cc82107d30a0fff1a17cba1cd0c" integrity sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ== -expect@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/expect/-/expect-27.5.1.tgz#83ce59f1e5bdf5f9d2b94b61d2050db48f3fef74" - integrity sha512-E1q5hSUG2AmYQwQJ041nvgpkODHQvB+RKlB4IYdru6uJsyFTRyZAP463M+1lINorwbqAmUggi6+WwkD8lCS/Dw== - dependencies: - "@jest/types" "^27.5.1" - jest-get-type "^27.5.1" - jest-matcher-utils "^27.5.1" - jest-message-util "^27.5.1" - -express@^4.14.0: - version "4.21.2" - resolved "https://registry.yarnpkg.com/express/-/express-4.21.2.tgz#cf250e48362174ead6cea4a566abef0162c1ec32" - integrity sha512-28HqgMZAmih1Czt9ny7qr6ek2qddF4FclbMzwhCREB6OFfH+rXAnuNCwo1/wFvrtbgsQDb4kSbX9de9lFbrXnA== - dependencies: - accepts "~1.3.8" - array-flatten "1.1.1" - body-parser "1.20.3" - content-disposition "0.5.4" - content-type "~1.0.4" - cookie "0.7.1" - cookie-signature "1.0.6" - debug "2.6.9" - depd "2.0.0" - encodeurl "~2.0.0" - escape-html "~1.0.3" - etag "~1.8.1" - finalhandler "1.3.1" - fresh "0.5.2" - http-errors "2.0.0" - merge-descriptors "1.0.3" - methods "~1.1.2" - on-finished "2.4.1" - parseurl "~1.3.3" - path-to-regexp "0.1.12" - proxy-addr "~2.0.7" - qs "6.13.0" - range-parser "~1.2.1" - safe-buffer "5.2.1" - send "0.19.0" - serve-static "1.16.2" - setprototypeof "1.2.0" - statuses "2.0.1" - type-is "~1.6.18" - utils-merge "1.0.1" - vary "~1.1.2" - -ext@^1.7.0: - version "1.7.0" - resolved "https://registry.yarnpkg.com/ext/-/ext-1.7.0.tgz#0ea4383c0103d60e70be99e9a7f11027a33c4f5f" - integrity sha512-6hxeJYaL110a9b5TEJSj0gojyHQAmA2ch5Os+ySCiA1QGdS697XWY1pzsrSjqA9LDEEgdB/KypIlR59RcLuHYw== - dependencies: - type "^2.7.2" - -extend@~3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa" - integrity sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g== - -extsprintf@1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.3.0.tgz#96918440e3041a7a414f8c52e3c574eb3c3e1e05" - integrity sha512-11Ndz7Nv+mvAC1j0ktTa7fAb0vLyGGX+rMHNBYQviQDGU0Hw7lhctJANqbPhu9nV9/izT/IntTgZ7Im/9LJs9g== - -extsprintf@^1.2.0: - version "1.4.1" - resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.1.tgz#8d172c064867f235c0c84a596806d279bf4bcc07" - integrity sha512-Wrk35e8ydCKDj/ArClo1VrPVmN8zph5V4AtHwIuHhvMXsKf73UT3BOD+azBIW+3wOJ4FhEH7zyaJCFvChjYvMA== - -fast-deep-equal@^3.1.1: - version "3.1.3" - resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" - integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== +expect@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/expect/-/expect-29.7.0.tgz#578874590dcb3214514084c08115d8aee61e11bc" + integrity sha512-2Zks0hf1VLFYI1kbh0I5jP3KHHyCHpkfyHBzsSXRFgl/Bg9mWYfMW8oD+PdMPlEwy5HNsR9JutYy6pMeOh61nw== + dependencies: + "@jest/expect-utils" "^29.7.0" + jest-get-type "^29.6.3" + jest-matcher-utils "^29.7.0" + jest-message-util "^29.7.0" + jest-util "^29.7.0" -fast-json-stable-stringify@^2.0.0: +fast-json-stable-stringify@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== @@ -2789,11 +1565,6 @@ fb-watchman@^2.0.0: dependencies: bser "2.1.1" -file-uri-to-path@1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz#553a7b8446ff6f684359c445f1e37a05dacc33dd" - integrity sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw== - fill-range@^7.1.1: version "7.1.1" resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.1.1.tgz#44265d3cac07e3ea7dc247516380643754a05292" @@ -2801,19 +1572,6 @@ fill-range@^7.1.1: dependencies: to-regex-range "^5.0.1" -finalhandler@1.3.1: - version "1.3.1" - resolved "https://registry.yarnpkg.com/finalhandler/-/finalhandler-1.3.1.tgz#0c575f1d1d324ddd1da35ad7ece3df7d19088019" - integrity sha512-6BN9trH7bp3qvnrRyzsBz+g3lZxTNZTbVO2EV1CS0WIcDbawYVdYvGflME/9QP0h0pYlCDBCTjYa9nZzMDpyxQ== - dependencies: - debug "2.6.9" - encodeurl "~2.0.0" - escape-html "~1.0.3" - on-finished "2.4.1" - parseurl "~1.3.3" - statuses "2.0.1" - unpipe "~1.0.0" - find-up@^4.0.0, find-up@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/find-up/-/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19" @@ -2822,10 +1580,10 @@ find-up@^4.0.0, find-up@^4.1.0: locate-path "^5.0.0" path-exists "^4.0.0" -follow-redirects@^1.14.0, follow-redirects@^1.14.8: - version "1.15.9" - resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.9.tgz#a604fa10e443bf98ca94228d9eebcc2e8a2c8ee1" - integrity sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ== +follow-redirects@^1.16.0: + version "1.16.0" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.16.0.tgz#28474a159d3b9d11ef62050a14ed60e4df6d61bc" + integrity sha512-y5rN/uOsadFT/JfYwhxRS5R7Qce+g3zG97+JrtFZlC9klX/W5hD7iiLzScI4nZqUS7DNUdhPgw4xI8W2LuXlUw== for-each@^0.3.5: version "0.3.5" @@ -2834,70 +1592,17 @@ for-each@^0.3.5: dependencies: is-callable "^1.2.7" -foreground-child@^3.3.1: - version "3.3.1" - resolved "https://registry.yarnpkg.com/foreground-child/-/foreground-child-3.3.1.tgz#32e8e9ed1b68a3497befb9ac2b6adf92a638576f" - integrity sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw== - dependencies: - cross-spawn "^7.0.6" - signal-exit "^4.0.1" - -forever-agent@~0.6.1: - version "0.6.1" - resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" - integrity sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw== - -form-data-encoder@1.7.1: - version "1.7.1" - resolved "https://registry.yarnpkg.com/form-data-encoder/-/form-data-encoder-1.7.1.tgz#ac80660e4f87ee0d3d3c3638b7da8278ddb8ec96" - integrity sha512-EFRDrsMm/kyqbTQocNvRXMLjc7Es2Vk+IQFx/YW7hkUH1eBl4J1fqiP34l74Yt0pFLCNpc06fkbVk00008mzjg== - -form-data@^3.0.0: - version "3.0.4" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-3.0.4.tgz#938273171d3f999286a4557528ce022dc2c98df1" - integrity sha512-f0cRzm6dkyVYV3nPoooP8XlccPQukegwhAnpoLcXy+X+A8KfpGOoXwDr9FLZd3wzgLaBGQBE3lY93Zm/i1JvIQ== +form-data@^4.0.6: + version "4.0.6" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.6.tgz#28e864e1b786dbebb68db1f452f9635278665827" + integrity sha512-vKatAh4SlVfgbv+YtmhiRjhEMJsYpsG1Y2rMQtR+SVSbytsSD1YGzDIcrAJmdFec88u/+VoGmxnl+80gL1tRCQ== dependencies: asynckit "^0.4.0" combined-stream "^1.0.8" es-set-tostringtag "^2.1.0" - hasown "^2.0.2" + hasown "^2.0.4" mime-types "^2.1.35" -form-data@~2.3.2: - version "2.3.3" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.3.tgz#dcce52c05f644f298c6a7ab936bd724ceffbf3a6" - integrity sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ== - dependencies: - asynckit "^0.4.0" - combined-stream "^1.0.6" - mime-types "^2.1.12" - -forwarded@0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.2.0.tgz#2269936428aad4c15c7ebe9779a84bf0b2a81811" - integrity sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow== - -fresh@0.5.2: - version "0.5.2" - resolved "https://registry.yarnpkg.com/fresh/-/fresh-0.5.2.tgz#3d8cadd90d976569fa835ab1f8e4b23a105605a7" - integrity sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q== - -fs-extra@^4.0.2: - version "4.0.3" - resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-4.0.3.tgz#0d852122e5bc5beb453fb028e9c0c9bf36340c94" - integrity sha512-q6rbdDd1o2mAnQreO7YADIxf/Whx4AHBiRf6d+/cVT8h44ss+lHgxf1FemcqDnQt9X3ct4McHr+JMGlYSsK7Cg== - dependencies: - graceful-fs "^4.1.2" - jsonfile "^4.0.0" - universalify "^0.1.0" - -fs-minipass@^1.2.7: - version "1.2.7" - resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-1.2.7.tgz#ccff8570841e7fe4265693da88936c55aed7f7c7" - integrity sha512-GWSSJGFy4e9GUeCcbIkED+bgAoFyj7XF1mV8rma3QW4NIqX9Kyx79N/PF61H5udOV3aY1IaMLs6pGbH71nlCTA== - dependencies: - minipass "^2.6.0" - fs.realpath@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" @@ -2928,7 +1633,7 @@ get-caller-file@^2.0.5: resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== -get-intrinsic@^1.2.4, get-intrinsic@^1.2.5, get-intrinsic@^1.2.6, get-intrinsic@^1.3.0: +get-intrinsic@^1.2.4, get-intrinsic@^1.2.6, get-intrinsic@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.3.0.tgz#743f0e3b6964a93a5491ed1bffaae054d7f98d01" integrity sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ== @@ -2949,7 +1654,7 @@ get-package-type@^0.1.0: resolved "https://registry.yarnpkg.com/get-package-type/-/get-package-type-0.1.0.tgz#8de2d803cff44df3bc6c456e6668b36c3926e11a" integrity sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q== -get-proto@^1.0.0, get-proto@^1.0.1: +get-proto@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/get-proto/-/get-proto-1.0.1.tgz#150b3f2743869ef3e851ec0c49d15b1d14d00ee1" integrity sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g== @@ -2957,38 +1662,21 @@ get-proto@^1.0.0, get-proto@^1.0.1: dunder-proto "^1.0.1" es-object-atoms "^1.0.0" -get-stream@^5.1.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-5.2.0.tgz#4966a1795ee5ace65e706c4b7beb71257d6e22d3" - integrity sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA== - dependencies: - pump "^3.0.0" - -get-stream@^6.0.0, get-stream@^6.0.1: +get-stream@^6.0.0: version "6.0.1" resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7" integrity sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg== -getpass@^0.1.1: - version "0.1.7" - resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.7.tgz#5eff8e3e684d569ae4cb2b1282604e8ba62149fa" - integrity sha512-0fzj9JxOLfJ+XGLhR8ze3unN0KZCgZwiSSDz168VERjK8Wl8kVSdcu2kspd4s4wtAa1y/qrVRiAA0WclVsu0ng== - dependencies: - assert-plus "^1.0.0" - -glob@^11.0.0: - version "11.0.3" - resolved "https://registry.yarnpkg.com/glob/-/glob-11.0.3.tgz#9d8087e6d72ddb3c4707b1d2778f80ea3eaefcd6" - integrity sha512-2Nim7dha1KVkaiF4q6Dj+ngPPMdfvLJEOpZk/jKiUAkqKebpGAWQXAq9z1xu9HKu5lWfqw/FASuccEjyznjPaA== +glob@^13.0.3: + version "13.0.6" + resolved "https://registry.yarnpkg.com/glob/-/glob-13.0.6.tgz#078666566a425147ccacfbd2e332deb66a2be71d" + integrity sha512-Wjlyrolmm8uDpm/ogGyXZXb1Z+Ca2B8NbJwqBVg0axK9GbBeoS7yGV6vjXnYdGm6X53iehEuxxbyiKp8QmN4Vw== dependencies: - foreground-child "^3.3.1" - jackspeak "^4.1.1" - minimatch "^10.0.3" - minipass "^7.1.2" - package-json-from-dist "^1.0.0" - path-scurry "^2.0.0" + minimatch "^10.2.2" + minipass "^7.1.3" + path-scurry "^2.0.2" -glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4: +glob@^7.1.3, glob@^7.1.4: version "7.2.3" resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q== @@ -3000,73 +1688,16 @@ glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4: once "^1.3.0" path-is-absolute "^1.0.0" -global@~4.4.0: - version "4.4.0" - resolved "https://registry.yarnpkg.com/global/-/global-4.4.0.tgz#3e7b105179006a323ed71aafca3e9c57a5cc6406" - integrity sha512-wv/LAoHdRE3BeTGz53FAamhGlPLhlssK45usmGFThIi4XqnBmjKQ16u+RNbP7WvigRZDxUsM0J3gcQ5yicaL0w== - dependencies: - min-document "^2.19.0" - process "^0.11.10" - gopd@^1.0.1, gopd@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.2.0.tgz#89f56b8217bdbc8802bd299df6d7f1081d7e51a1" integrity sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg== -got@12.1.0: - version "12.1.0" - resolved "https://registry.yarnpkg.com/got/-/got-12.1.0.tgz#099f3815305c682be4fd6b0ee0726d8e4c6b0af4" - integrity sha512-hBv2ty9QN2RdbJJMK3hesmSkFTjVIHyIDDbssCKnSmq62edGgImJWD10Eb1k77TiV1bxloxqcFAVK8+9pkhOig== - dependencies: - "@sindresorhus/is" "^4.6.0" - "@szmarczak/http-timer" "^5.0.1" - "@types/cacheable-request" "^6.0.2" - "@types/responselike" "^1.0.0" - cacheable-lookup "^6.0.4" - cacheable-request "^7.0.2" - decompress-response "^6.0.0" - form-data-encoder "1.7.1" - get-stream "^6.0.1" - http2-wrapper "^2.1.10" - lowercase-keys "^3.0.0" - p-cancelable "^3.0.0" - responselike "^2.0.0" - -got@^11.8.5: - version "11.8.6" - resolved "https://registry.yarnpkg.com/got/-/got-11.8.6.tgz#276e827ead8772eddbcfc97170590b841823233a" - integrity sha512-6tfZ91bOr7bOXnK7PRDCGBLa1H4U080YHNaAQ2KsMGlLEzRbk44nsZF2E1IeRc3vtJHPVbKCYgdFbaGO2ljd8g== - dependencies: - "@sindresorhus/is" "^4.0.0" - "@szmarczak/http-timer" "^4.0.5" - "@types/cacheable-request" "^6.0.1" - "@types/responselike" "^1.0.0" - cacheable-lookup "^5.0.3" - cacheable-request "^7.0.2" - decompress-response "^6.0.0" - http2-wrapper "^1.0.0-beta.5.2" - lowercase-keys "^2.0.0" - p-cancelable "^2.0.0" - responselike "^2.0.0" - -graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.9: +graceful-fs@^4.2.9: version "4.2.11" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== -har-schema@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92" - integrity sha512-Oqluz6zhGX8cyRaTQlFMPw80bSJVG2x/cFb8ZPhUILGgHka9SsokCCOQgpveePerqidZOrT14ipqfJb7ILcW5Q== - -har-validator@~5.1.3: - version "5.1.5" - resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-5.1.5.tgz#1f0803b9f8cb20c0fa13822df1ecddb36bde1efd" - integrity sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w== - dependencies: - ajv "^6.12.3" - har-schema "^2.0.0" - has-flag@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" @@ -3091,23 +1722,17 @@ has-tostringtag@^1.0.2: dependencies: has-symbols "^1.0.3" -hash-base@^2.0.0: - version "2.0.2" - resolved "https://registry.yarnpkg.com/hash-base/-/hash-base-2.0.2.tgz#66ea1d856db4e8a5470cadf6fce23ae5244ef2e1" - integrity sha512-0TROgQ1/SxE6KmxWSvXHvRj90/Xo1JvZShofnYF+f6ZsGtR4eES7WfrQzPalmyagfKZCXpVnitiRebZulWsbiw== - dependencies: - inherits "^2.0.1" - -hash-base@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/hash-base/-/hash-base-3.1.0.tgz#55c381d9e06e1d2997a883b4a3fddfe7f0d3af33" - integrity sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA== +hash-base@^3.0.0, hash-base@^3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/hash-base/-/hash-base-3.1.2.tgz#79d72def7611c3f6e3c3b5730652638001b10a74" + integrity sha512-Bb33KbowVTIj5s7Ked1OsqHUeCpz//tPwR+E2zJgJKo9Z5XolZ9b6bdUgjmYlwnWhoOQKoTd1TYToZGn5mAYOg== dependencies: inherits "^2.0.4" - readable-stream "^3.6.0" - safe-buffer "^5.2.0" + readable-stream "^2.3.8" + safe-buffer "^5.2.1" + to-buffer "^1.2.1" -hash.js@1.1.7, hash.js@^1.0.0, hash.js@^1.0.3, hash.js@^1.1.7: +hash.js@^1.0.0, hash.js@^1.0.3, hash.js@^1.1.7: version "1.1.7" resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.7.tgz#0babca538e8d4ee4a0f8988d68866537a003cf42" integrity sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA== @@ -3115,10 +1740,10 @@ hash.js@1.1.7, hash.js@^1.0.0, hash.js@^1.0.3, hash.js@^1.1.7: inherits "^2.0.3" minimalistic-assert "^1.0.1" -hasown@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.2.tgz#003eaf91be7adc372e84ec59dc37252cedb80003" - integrity sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ== +hasown@^2.0.2, hasown@^2.0.3, hasown@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.4.tgz#8c62d8cb90beb2aad5d0a5b67581ad9854c3f003" + integrity sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A== dependencies: function-bind "^1.1.2" @@ -3131,74 +1756,12 @@ hmac-drbg@^1.0.1: minimalistic-assert "^1.0.0" minimalistic-crypto-utils "^1.0.1" -html-encoding-sniffer@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/html-encoding-sniffer/-/html-encoding-sniffer-2.0.1.tgz#42a6dc4fd33f00281176e8b23759ca4e4fa185f3" - integrity sha512-D5JbOMBIR/TVZkubHT+OyT2705QvogUW4IBn6nHd756OwieSF9aDYFj4dv6HHEVGYbHaLETa3WggZYWWMyy3ZQ== - dependencies: - whatwg-encoding "^1.0.5" - html-escaper@^2.0.0: version "2.0.2" resolved "https://registry.yarnpkg.com/html-escaper/-/html-escaper-2.0.2.tgz#dfd60027da36a36dfcbe236262c00a5822681453" integrity sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg== -http-cache-semantics@^4.0.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/http-cache-semantics/-/http-cache-semantics-4.2.0.tgz#205f4db64f8562b76a4ff9235aa5279839a09dd5" - integrity sha512-dTxcvPXqPvXBQpq5dUr6mEMJX4oIEFv6bwom3FDwKRDsuIjjJGANqhBuoAn9c1RQJIdAKav33ED65E2ys+87QQ== - -http-errors@2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-2.0.0.tgz#b7774a1486ef73cf7667ac9ae0858c012c57b9d3" - integrity sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ== - dependencies: - depd "2.0.0" - inherits "2.0.4" - setprototypeof "1.2.0" - statuses "2.0.1" - toidentifier "1.0.1" - -http-https@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/http-https/-/http-https-1.0.0.tgz#2f908dd5f1db4068c058cd6e6d4ce392c913389b" - integrity sha512-o0PWwVCSp3O0wS6FvNr6xfBCHgt0m1tvPLFOCc2iFDKTRAXhB7m8klDf7ErowFH8POa6dVdGatKU5I1YYwzUyg== - -http-proxy-agent@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/http-proxy-agent/-/http-proxy-agent-4.0.1.tgz#8a8c8ef7f5932ccf953c296ca8291b95aa74aa3a" - integrity sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg== - dependencies: - "@tootallnate/once" "1" - agent-base "6" - debug "4" - -http-signature@~1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.2.0.tgz#9aecd925114772f3d95b65a60abb8f7c18fbace1" - integrity sha512-CAbnr6Rz4CYQkLYUtSNXxQPUH2gK8f3iWexVlsnMeD+GjlsQ0Xsy1cOX+mN3dtxYomRy21CiOzU8Uhw6OwncEQ== - dependencies: - assert-plus "^1.0.0" - jsprim "^1.2.2" - sshpk "^1.7.0" - -http2-wrapper@^1.0.0-beta.5.2: - version "1.0.3" - resolved "https://registry.yarnpkg.com/http2-wrapper/-/http2-wrapper-1.0.3.tgz#b8f55e0c1f25d4ebd08b3b0c2c079f9590800b3d" - integrity sha512-V+23sDMr12Wnz7iTcDeJr3O6AIxlnvT/bmaAAAP/Xda35C90p9599p0F1eHR/N1KILWSoWVAiOMFjBBXaXSMxg== - dependencies: - quick-lru "^5.1.1" - resolve-alpn "^1.0.0" - -http2-wrapper@^2.1.10: - version "2.2.1" - resolved "https://registry.yarnpkg.com/http2-wrapper/-/http2-wrapper-2.2.1.tgz#310968153dcdedb160d8b72114363ef5fce1f64a" - integrity sha512-V5nVw1PAOgfI3Lmeaj2Exmeg7fenjhRUgz1lPSezy1CuhPYbgQtbQj4jZfEAEMlaL+vupsvhjqCyjzob0yxsmQ== - dependencies: - quick-lru "^5.1.1" - resolve-alpn "^1.2.0" - -https-proxy-agent@^5.0.0: +https-proxy-agent@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz#c59ef224a04fe8b754f3db0063a25ea30d0005d6" integrity sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA== @@ -3211,13 +1774,6 @@ human-signals@^2.1.0: resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-2.1.0.tgz#dc91fcba42e4d06e4abaed33b3e7a3c02f514ea0" integrity sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw== -iconv-lite@0.4.24: - version "0.4.24" - resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" - integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== - dependencies: - safer-buffer ">= 2.1.2 < 3" - iconv-lite@^0.6.2: version "0.6.3" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.6.3.tgz#a52f80bf38da1952eb5c681790719871a1a72501" @@ -3225,13 +1781,6 @@ iconv-lite@^0.6.2: dependencies: safer-buffer ">= 2.1.2 < 3.0.0" -idna-uts46-hx@^2.3.1: - version "2.3.1" - resolved "https://registry.yarnpkg.com/idna-uts46-hx/-/idna-uts46-hx-2.3.1.tgz#a1dc5c4df37eee522bf66d969cc980e00e8711f9" - integrity sha512-PWoF9Keq6laYdIRwwCdhTPl60xRqAloYNMQLiyUnG42VjT53oW07BXIRM+NK7eQjzXjAk2gUvX9caRxlnF9TAA== - dependencies: - punycode "2.1.0" - ieee754@^1.1.13, ieee754@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" @@ -3263,29 +1812,11 @@ inflight@^1.0.4: once "^1.3.0" wrappy "1" -inherits@2, inherits@2.0.4, inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.1, inherits@~2.0.3, inherits@~2.0.4: +inherits@2, inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.1, inherits@~2.0.3: version "2.0.4" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== -int64-buffer@^1.0.1: - version "1.1.0" - resolved "https://registry.yarnpkg.com/int64-buffer/-/int64-buffer-1.1.0.tgz#7ebe9822196a93bbedf93ec6b73b569561b5ae3a" - integrity sha512-94smTCQOvigN4d/2R/YDjz8YVG0Sufvv2aAh8P5m42gwhCsDAJqnbNOrxJsrADuAFAA69Q/ptGzxvNcNuIJcvw== - -ipaddr.js@1.9.1: - version "1.9.1" - resolved "https://registry.yarnpkg.com/ipaddr.js/-/ipaddr.js-1.9.1.tgz#bff38543eeb8984825079ff3a2a8e6cbd46781b3" - integrity sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g== - -is-arguments@^1.0.4: - version "1.2.0" - resolved "https://registry.yarnpkg.com/is-arguments/-/is-arguments-1.2.0.tgz#ad58c6aecf563b78ef2bf04df540da8f5d7d8e1b" - integrity sha512-7bVbi0huj/wrIAOzb8U1aszg9kdi3KN/CyU19CTI7tAoZYEZoL9yCDXpbXN+uPsuWnP02cyug1gleqq+TU+YCA== - dependencies: - call-bound "^1.0.2" - has-tostringtag "^1.0.2" - is-arrayish@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" @@ -3296,38 +1827,23 @@ is-callable@^1.2.7: resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.7.tgz#3bc2a85ea742d9e36205dcacdd72ca1fdc51b055" integrity sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA== -is-core-module@^2.16.0: - version "2.16.1" - resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.16.1.tgz#2a98801a849f43e2add644fbb6bc6229b19a4ef4" - integrity sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w== +is-core-module@^2.16.1: + version "2.16.2" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.16.2.tgz#3e07450a8080ebce3fbf0cac494f4d2ab324e082" + integrity sha512-evOr8xfXKxE6qSR0hSXL2r3sd7ALj8+7jQEUvPYcm5sgZFdJ+AYzT6yNmJenvIYQBgIGwfwz08sL8zoL7yq2BA== dependencies: - hasown "^2.0.2" + hasown "^2.0.3" is-fullwidth-code-point@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== -is-function@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/is-function/-/is-function-1.0.2.tgz#4f097f30abf6efadac9833b17ca5dc03f8144e08" - integrity sha512-lw7DUp0aWXYg+CBCN+JKkcE0Q2RayZnSvnZBlwgxHBQhqt5pZNVy4Ri7H9GmmXkdu7LUthszM+Tor1u/2iBcpQ== - is-generator-fn@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/is-generator-fn/-/is-generator-fn-2.1.0.tgz#7d140adc389aaf3011a8f2a2a4cfa6faadffb118" integrity sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ== -is-generator-function@^1.0.7: - version "1.1.0" - resolved "https://registry.yarnpkg.com/is-generator-function/-/is-generator-function-1.1.0.tgz#bf3eeda931201394f57b5dba2800f91a238309ca" - integrity sha512-nPUB5km40q9e8UfN/Zc24eLlzdSf9OfKByBw9CIdw4H1giPMeA0OIJvbchsCu4npfI2QcMVBsGEBHKZ7wLTWmQ== - dependencies: - call-bound "^1.0.3" - get-proto "^1.0.0" - has-tostringtag "^1.0.2" - safe-regex-test "^1.1.0" - is-hex-prefixed@1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz#7d8d37e6ad77e5d127148913c573e082d777f554" @@ -3338,21 +1854,6 @@ is-number@^7.0.0: resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== -is-potential-custom-element-name@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz#171ed6f19e3ac554394edf78caa05784a45bebb5" - integrity sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ== - -is-regex@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.2.1.tgz#76d70a3ed10ef9be48eb577887d74205bf0cad22" - integrity sha512-MjYsKHO5O7mCsmRGxWcLWheFqN9DJ/2TmngvjKXihe6efViPqc274+Fx/4fYj/r03+ESvBdTXK0V6tA3rgez1g== - dependencies: - call-bound "^1.0.2" - gopd "^1.2.0" - has-tostringtag "^1.0.2" - hasown "^2.0.2" - is-stream@^1.0.1: version "1.1.0" resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" @@ -3363,18 +1864,13 @@ is-stream@^2.0.0: resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.1.tgz#fac1e3d53b97ad5a9d0ae9cef2389f5810a5c077" integrity sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg== -is-typed-array@^1.1.14, is-typed-array@^1.1.3: +is-typed-array@^1.1.14: version "1.1.15" resolved "https://registry.yarnpkg.com/is-typed-array/-/is-typed-array-1.1.15.tgz#4bfb4a45b61cee83a5a46fba778e4e8d59c0ce0b" integrity sha512-p3EcsicXjit7SaskXHs1hA91QxgTw46Fv6EFKKGS5DRFLD8yKnohjF3hxoju94b/OcMZoQukzpPpBE9uLVKzgQ== dependencies: which-typed-array "^1.1.16" -is-typedarray@^1.0.0, is-typedarray@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" - integrity sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA== - isarray@^2.0.5: version "2.0.5" resolved "https://registry.yarnpkg.com/isarray/-/isarray-2.0.5.tgz#8af1e4c1221244cc62459faf38940d4e644a5723" @@ -3405,17 +1901,12 @@ isomorphic-rpc@^1.2.1: dependencies: isomorphic-fetch "^2.2.1" -isstream@~0.1.2: - version "0.1.2" - resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" - integrity sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g== - istanbul-lib-coverage@^3.0.0, istanbul-lib-coverage@^3.2.0: version "3.2.2" resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz#2d166c4b0644d43a39f04bf6c2edd1e585f31756" integrity sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg== -istanbul-lib-instrument@^5.0.4, istanbul-lib-instrument@^5.1.0: +istanbul-lib-instrument@^5.0.4: version "5.2.1" resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-5.2.1.tgz#d10c8885c2125574e1c231cacadf955675e1ce3d" integrity sha512-pzqtp31nLv/XFOzXGuvhCb8qhjmTVo5vjVk19XE4CRlSWz0KoeJ3bw9XsA7nOp9YBf4qHjwBxkDzKcME/J29Yg== @@ -3426,6 +1917,17 @@ istanbul-lib-instrument@^5.0.4, istanbul-lib-instrument@^5.1.0: istanbul-lib-coverage "^3.2.0" semver "^6.3.0" +istanbul-lib-instrument@^6.0.0: + version "6.0.3" + resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-6.0.3.tgz#fa15401df6c15874bcb2105f773325d78c666765" + integrity sha512-Vtgk7L/R2JHyyGW07spoFlB8/lpjiOLTjMdms6AFMraYt3BaJauod/NGrfnVG/y4Ix1JEuMRPDPEj2ua+zz1/Q== + dependencies: + "@babel/core" "^7.23.9" + "@babel/parser" "^7.23.9" + "@istanbuljs/schema" "^0.1.3" + istanbul-lib-coverage "^3.2.0" + semver "^7.5.4" + istanbul-lib-report@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz#908305bac9a5bd175ac6a74489eafd0fc2445a7d" @@ -3445,538 +1947,404 @@ istanbul-lib-source-maps@^4.0.0: source-map "^0.6.1" istanbul-reports@^3.1.3: - version "3.1.7" - resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-3.1.7.tgz#daed12b9e1dca518e15c056e1e537e741280fa0b" - integrity sha512-BewmUXImeuRk2YY0PVbxgKAysvhRPUQE0h5QRM++nVWyubKGV0l8qQ5op8+B2DOmwSe63Jivj0BjkPQVf8fP5g== + version "3.2.0" + resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-3.2.0.tgz#cb4535162b5784aa623cee21a7252cf2c807ac93" + integrity sha512-HGYWWS/ehqTV3xN10i23tkPkpH46MLCIMFNCaaKNavAXTF1RkqxawEPtnjnGZ6XKSInBKkiOA5BKS+aZiY3AvA== dependencies: html-escaper "^2.0.0" istanbul-lib-report "^3.0.0" -jackspeak@^4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/jackspeak/-/jackspeak-4.1.1.tgz#96876030f450502047fc7e8c7fcf8ce8124e43ae" - integrity sha512-zptv57P3GpL+O0I7VdMJNBZCu+BPHVQUk55Ft8/QCJjTVxrnJHuVuX/0Bl2A6/+2oyR/ZMEuFKwmzqqZ/U5nPQ== - dependencies: - "@isaacs/cliui" "^8.0.2" - -jest-changed-files@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-27.5.1.tgz#a348aed00ec9bf671cc58a66fcbe7c3dfd6a68f5" - integrity sha512-buBLMiByfWGCoMsLLzGUUSpAmIAGnbR2KJoMN10ziLhOLvP4e0SlypHnAel8iqQXTrcbmfEY9sSqae5sgUsTvw== +jest-changed-files@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-29.7.0.tgz#1c06d07e77c78e1585d020424dedc10d6e17ac3a" + integrity sha512-fEArFiwf1BpQ+4bXSprcDc3/x4HSzL4al2tozwVpDFpsxALjLYdyiIK4e5Vz66GQJIbXJ82+35PtysofptNX2w== dependencies: - "@jest/types" "^27.5.1" execa "^5.0.0" - throat "^6.0.1" - -jest-circus@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-circus/-/jest-circus-27.5.1.tgz#37a5a4459b7bf4406e53d637b49d22c65d125ecc" - integrity sha512-D95R7x5UtlMA5iBYsOHFFbMD/GVA4R/Kdq15f7xYWUfWHBto9NYRsOvnSauTgdF+ogCpJ4tyKOXhUifxS65gdw== - dependencies: - "@jest/environment" "^27.5.1" - "@jest/test-result" "^27.5.1" - "@jest/types" "^27.5.1" + jest-util "^29.7.0" + p-limit "^3.1.0" + +jest-circus@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-circus/-/jest-circus-29.7.0.tgz#b6817a45fcc835d8b16d5962d0c026473ee3668a" + integrity sha512-3E1nCMgipcTkCocFwM90XXQab9bS+GMsjdpmPrlelaxwD93Ad8iVEjX/vvHPdLPnFf+L40u+5+iutRdA1N9myw== + dependencies: + "@jest/environment" "^29.7.0" + "@jest/expect" "^29.7.0" + "@jest/test-result" "^29.7.0" + "@jest/types" "^29.6.3" "@types/node" "*" chalk "^4.0.0" co "^4.6.0" - dedent "^0.7.0" - expect "^27.5.1" + dedent "^1.0.0" is-generator-fn "^2.0.0" - jest-each "^27.5.1" - jest-matcher-utils "^27.5.1" - jest-message-util "^27.5.1" - jest-runtime "^27.5.1" - jest-snapshot "^27.5.1" - jest-util "^27.5.1" - pretty-format "^27.5.1" + jest-each "^29.7.0" + jest-matcher-utils "^29.7.0" + jest-message-util "^29.7.0" + jest-runtime "^29.7.0" + jest-snapshot "^29.7.0" + jest-util "^29.7.0" + p-limit "^3.1.0" + pretty-format "^29.7.0" + pure-rand "^6.0.0" slash "^3.0.0" stack-utils "^2.0.3" - throat "^6.0.1" -jest-cli@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-27.5.1.tgz#278794a6e6458ea8029547e6c6cbf673bd30b145" - integrity sha512-Hc6HOOwYq4/74/c62dEE3r5elx8wjYqxY0r0G/nFrLDPMFRu6RA/u8qINOIkvhxG7mMQ5EJsOGfRpI8L6eFUVw== +jest-cli@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-29.7.0.tgz#5592c940798e0cae677eec169264f2d839a37995" + integrity sha512-OVVobw2IubN/GSYsxETi+gOe7Ka59EFMR/twOU3Jb2GnKKeMGJB5SGUUrEz3SFVmJASUdZUzy83sLNNQ2gZslg== dependencies: - "@jest/core" "^27.5.1" - "@jest/test-result" "^27.5.1" - "@jest/types" "^27.5.1" + "@jest/core" "^29.7.0" + "@jest/test-result" "^29.7.0" + "@jest/types" "^29.6.3" chalk "^4.0.0" + create-jest "^29.7.0" exit "^0.1.2" - graceful-fs "^4.2.9" import-local "^3.0.2" - jest-config "^27.5.1" - jest-util "^27.5.1" - jest-validate "^27.5.1" - prompts "^2.0.1" - yargs "^16.2.0" - -jest-config@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-27.5.1.tgz#5c387de33dca3f99ad6357ddeccd91bf3a0e4a41" - integrity sha512-5sAsjm6tGdsVbW9ahcChPAFCk4IlkQUknH5AvKjuLTSlcO/wCZKyFdn7Rg0EkC+OGgWODEy2hDpWB1PgzH0JNA== - dependencies: - "@babel/core" "^7.8.0" - "@jest/test-sequencer" "^27.5.1" - "@jest/types" "^27.5.1" - babel-jest "^27.5.1" + jest-config "^29.7.0" + jest-util "^29.7.0" + jest-validate "^29.7.0" + yargs "^17.3.1" + +jest-config@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-29.7.0.tgz#bcbda8806dbcc01b1e316a46bb74085a84b0245f" + integrity sha512-uXbpfeQ7R6TZBqI3/TxCU4q4ttk3u0PJeC+E0zbfSoSjq6bJ7buBPxzQPL0ifrkY4DNu4JUdk0ImlBUYi840eQ== + dependencies: + "@babel/core" "^7.11.6" + "@jest/test-sequencer" "^29.7.0" + "@jest/types" "^29.6.3" + babel-jest "^29.7.0" chalk "^4.0.0" ci-info "^3.2.0" deepmerge "^4.2.2" - glob "^7.1.1" + glob "^7.1.3" graceful-fs "^4.2.9" - jest-circus "^27.5.1" - jest-environment-jsdom "^27.5.1" - jest-environment-node "^27.5.1" - jest-get-type "^27.5.1" - jest-jasmine2 "^27.5.1" - jest-regex-util "^27.5.1" - jest-resolve "^27.5.1" - jest-runner "^27.5.1" - jest-util "^27.5.1" - jest-validate "^27.5.1" + jest-circus "^29.7.0" + jest-environment-node "^29.7.0" + jest-get-type "^29.6.3" + jest-regex-util "^29.6.3" + jest-resolve "^29.7.0" + jest-runner "^29.7.0" + jest-util "^29.7.0" + jest-validate "^29.7.0" micromatch "^4.0.4" parse-json "^5.2.0" - pretty-format "^27.5.1" + pretty-format "^29.7.0" slash "^3.0.0" strip-json-comments "^3.1.1" -jest-diff@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-27.5.1.tgz#a07f5011ac9e6643cf8a95a462b7b1ecf6680def" - integrity sha512-m0NvkX55LDt9T4mctTEgnZk3fmEg3NRYutvMPWM/0iPnkFj2wIeF45O1718cMSOFO1vINkqmxqD8vE37uTEbqw== +jest-diff@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-29.7.0.tgz#017934a66ebb7ecf6f205e84699be10afd70458a" + integrity sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw== dependencies: chalk "^4.0.0" - diff-sequences "^27.5.1" - jest-get-type "^27.5.1" - pretty-format "^27.5.1" + diff-sequences "^29.6.3" + jest-get-type "^29.6.3" + pretty-format "^29.7.0" -jest-docblock@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-27.5.1.tgz#14092f364a42c6108d42c33c8cf30e058e25f6c0" - integrity sha512-rl7hlABeTsRYxKiUfpHrQrG4e2obOiTQWfMEH3PxPjOtdsfLQO4ReWSZaQ7DETm4xu07rl4q/h4zcKXyU0/OzQ== +jest-docblock@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-29.7.0.tgz#8fddb6adc3cdc955c93e2a87f61cfd350d5d119a" + integrity sha512-q617Auw3A612guyaFgsbFeYpNP5t2aoUNLwBUbc/0kD1R4t9ixDbyFTHd1nok4epoVFpr7PmeWHrhvuV3XaJ4g== dependencies: detect-newline "^3.0.0" -jest-each@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-27.5.1.tgz#5bc87016f45ed9507fed6e4702a5b468a5b2c44e" - integrity sha512-1Ff6p+FbhT/bXQnEouYy00bkNSY7OUpfIcmdl8vZ31A1UUaurOLPA8a8BbJOF2RDUElwJhmeaV7LnagI+5UwNQ== +jest-each@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-29.7.0.tgz#162a9b3f2328bdd991beaabffbb74745e56577d1" + integrity sha512-gns+Er14+ZrEoC5fhOfYCY1LOHHr0TI+rQUHZS8Ttw2l7gl+80eHc/gFf2Ktkw0+SIACDTeWvpFcv3B04VembQ== dependencies: - "@jest/types" "^27.5.1" + "@jest/types" "^29.6.3" chalk "^4.0.0" - jest-get-type "^27.5.1" - jest-util "^27.5.1" - pretty-format "^27.5.1" - -jest-environment-jsdom@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-27.5.1.tgz#ea9ccd1fc610209655a77898f86b2b559516a546" - integrity sha512-TFBvkTC1Hnnnrka/fUb56atfDtJ9VMZ94JkjTbggl1PEpwrYtUBKMezB3inLmWqQsXYLcMwNoDQwoBTAvFfsfw== - dependencies: - "@jest/environment" "^27.5.1" - "@jest/fake-timers" "^27.5.1" - "@jest/types" "^27.5.1" + jest-get-type "^29.6.3" + jest-util "^29.7.0" + pretty-format "^29.7.0" + +jest-environment-node@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-29.7.0.tgz#0b93e111dda8ec120bc8300e6d1fb9576e164376" + integrity sha512-DOSwCRqXirTOyheM+4d5YZOrWcdu0LNZ87ewUoywbcb2XR4wKgqiG8vNeYwhjFMbEkfju7wx2GYH0P2gevGvFw== + dependencies: + "@jest/environment" "^29.7.0" + "@jest/fake-timers" "^29.7.0" + "@jest/types" "^29.6.3" "@types/node" "*" - jest-mock "^27.5.1" - jest-util "^27.5.1" - jsdom "^16.6.0" - -jest-environment-node@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-27.5.1.tgz#dedc2cfe52fab6b8f5714b4808aefa85357a365e" - integrity sha512-Jt4ZUnxdOsTGwSRAfKEnE6BcwsSPNOijjwifq5sDFSA2kesnXTvNqKHYgM0hDq3549Uf/KzdXNYn4wMZJPlFLw== - dependencies: - "@jest/environment" "^27.5.1" - "@jest/fake-timers" "^27.5.1" - "@jest/types" "^27.5.1" - "@types/node" "*" - jest-mock "^27.5.1" - jest-util "^27.5.1" + jest-mock "^29.7.0" + jest-util "^29.7.0" -jest-get-type@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-27.5.1.tgz#3cd613c507b0f7ace013df407a1c1cd578bcb4f1" - integrity sha512-2KY95ksYSaK7DMBWQn6dQz3kqAf3BB64y2udeG+hv4KfSOb9qwcYQstTJc1KCbsix+wLZWZYN8t7nwX3GOBLRw== +jest-get-type@^29.6.3: + version "29.6.3" + resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-29.6.3.tgz#36f499fdcea197c1045a127319c0481723908fd1" + integrity sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw== -jest-haste-map@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-27.5.1.tgz#9fd8bd7e7b4fa502d9c6164c5640512b4e811e7f" - integrity sha512-7GgkZ4Fw4NFbMSDSpZwXeBiIbx+t/46nJ2QitkOjvwPYyZmqttu2TDSimMHP1EkPOi4xUZAN1doE5Vd25H4Jng== +jest-haste-map@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-29.7.0.tgz#3c2396524482f5a0506376e6c858c3bbcc17b104" + integrity sha512-fP8u2pyfqx0K1rGn1R9pyE0/KTn+G7PxktWidOBTqFPLYX0b9ksaMFkhK5vrS3DVun09pckLdlx90QthlW7AmA== dependencies: - "@jest/types" "^27.5.1" - "@types/graceful-fs" "^4.1.2" + "@jest/types" "^29.6.3" + "@types/graceful-fs" "^4.1.3" "@types/node" "*" anymatch "^3.0.3" fb-watchman "^2.0.0" graceful-fs "^4.2.9" - jest-regex-util "^27.5.1" - jest-serializer "^27.5.1" - jest-util "^27.5.1" - jest-worker "^27.5.1" + jest-regex-util "^29.6.3" + jest-util "^29.7.0" + jest-worker "^29.7.0" micromatch "^4.0.4" - walker "^1.0.7" + walker "^1.0.8" optionalDependencies: fsevents "^2.3.2" -jest-jasmine2@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-27.5.1.tgz#a037b0034ef49a9f3d71c4375a796f3b230d1ac4" - integrity sha512-jtq7VVyG8SqAorDpApwiJJImd0V2wv1xzdheGHRGyuT7gZm6gG47QEskOlzsN1PG/6WNaCo5pmwMHDf3AkG2pQ== +jest-leak-detector@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-29.7.0.tgz#5b7ec0dadfdfec0ca383dc9aa016d36b5ea4c728" + integrity sha512-kYA8IJcSYtST2BY9I+SMC32nDpBT3J2NvWJx8+JCuCdl/CR1I4EKUJROiP8XtCcxqgTTBGJNdbB1A8XRKbTetw== dependencies: - "@jest/environment" "^27.5.1" - "@jest/source-map" "^27.5.1" - "@jest/test-result" "^27.5.1" - "@jest/types" "^27.5.1" - "@types/node" "*" - chalk "^4.0.0" - co "^4.6.0" - expect "^27.5.1" - is-generator-fn "^2.0.0" - jest-each "^27.5.1" - jest-matcher-utils "^27.5.1" - jest-message-util "^27.5.1" - jest-runtime "^27.5.1" - jest-snapshot "^27.5.1" - jest-util "^27.5.1" - pretty-format "^27.5.1" - throat "^6.0.1" - -jest-leak-detector@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-27.5.1.tgz#6ec9d54c3579dd6e3e66d70e3498adf80fde3fb8" - integrity sha512-POXfWAMvfU6WMUXftV4HolnJfnPOGEu10fscNCA76KBpRRhcMN2c8d3iT2pxQS3HLbA+5X4sOUPzYO2NUyIlHQ== - dependencies: - jest-get-type "^27.5.1" - pretty-format "^27.5.1" - -jest-matcher-utils@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-27.5.1.tgz#9c0cdbda8245bc22d2331729d1091308b40cf8ab" - integrity sha512-z2uTx/T6LBaCoNWNFWwChLBKYxTMcGBRjAt+2SbP929/Fflb9aa5LGma654Rz8z9HLxsrUaYzxE9T/EFIL/PAw== + jest-get-type "^29.6.3" + pretty-format "^29.7.0" + +jest-matcher-utils@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-29.7.0.tgz#ae8fec79ff249fd592ce80e3ee474e83a6c44f12" + integrity sha512-sBkD+Xi9DtcChsI3L3u0+N0opgPYnCRPtGcQYrgXmR+hmt/fYfWAL0xRXYU8eWOdfuLgBe0YCW3AFtnRLagq/g== dependencies: chalk "^4.0.0" - jest-diff "^27.5.1" - jest-get-type "^27.5.1" - pretty-format "^27.5.1" + jest-diff "^29.7.0" + jest-get-type "^29.6.3" + pretty-format "^29.7.0" -jest-message-util@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-27.5.1.tgz#bdda72806da10d9ed6425e12afff38cd1458b6cf" - integrity sha512-rMyFe1+jnyAAf+NHwTclDz0eAaLkVDdKVHHBFWsBWHnnh5YeJMNWWsv7AbFYXfK3oTqvL7VTWkhNLu1jX24D+g== +jest-message-util@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-29.7.0.tgz#8bc392e204e95dfe7564abbe72a404e28e51f7f3" + integrity sha512-GBEV4GRADeP+qtB2+6u61stea8mGcOT4mCtrYISZwfu9/ISHFJ/5zOMXYbpBE9RsS5+Gb63DW4FgmnKJ79Kf6w== dependencies: "@babel/code-frame" "^7.12.13" - "@jest/types" "^27.5.1" + "@jest/types" "^29.6.3" "@types/stack-utils" "^2.0.0" chalk "^4.0.0" graceful-fs "^4.2.9" micromatch "^4.0.4" - pretty-format "^27.5.1" + pretty-format "^29.7.0" slash "^3.0.0" stack-utils "^2.0.3" -jest-mock@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-27.5.1.tgz#19948336d49ef4d9c52021d34ac7b5f36ff967d6" - integrity sha512-K4jKbY1d4ENhbrG2zuPWaQBvDly+iZ2yAW+T1fATN78hc0sInwn7wZB8XtlNnvHug5RMwV897Xm4LqmPM4e2Og== +jest-mock@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-29.7.0.tgz#4e836cf60e99c6fcfabe9f99d017f3fdd50a6347" + integrity sha512-ITOMZn+UkYS4ZFh83xYAOzWStloNzJFO2s8DWrE4lhtGD+AorgnbkiKERe4wQVBydIGPx059g6riW5Btp6Llnw== dependencies: - "@jest/types" "^27.5.1" + "@jest/types" "^29.6.3" "@types/node" "*" + jest-util "^29.7.0" jest-pnp-resolver@^1.2.2: version "1.2.3" resolved "https://registry.yarnpkg.com/jest-pnp-resolver/-/jest-pnp-resolver-1.2.3.tgz#930b1546164d4ad5937d5540e711d4d38d4cad2e" integrity sha512-+3NpwQEnRoIBtx4fyhblQDPgJI0H1IEIkX7ShLUjPGA7TtUTvI1oiKi3SR4oBR0hQhQR80l4WAe5RrXBwWMA8w== -jest-regex-util@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-27.5.1.tgz#4da143f7e9fd1e542d4aa69617b38e4a78365b95" - integrity sha512-4bfKq2zie+x16okqDXjXn9ql2B0dScQu+vcwe4TvFVhkVyuWLqpZrZtXxLLWoXYgn0E87I6r6GRYHF7wFZBUvg== +jest-regex-util@^29.6.3: + version "29.6.3" + resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-29.6.3.tgz#4a556d9c776af68e1c5f48194f4d0327d24e8a52" + integrity sha512-KJJBsRCyyLNWCNBOvZyRDnAIfUiRJ8v+hOBQYGn8gDyF3UegwiP4gwRR3/SDa42g1YbVycTidUF3rKjyLFDWbg== -jest-resolve-dependencies@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-27.5.1.tgz#d811ecc8305e731cc86dd79741ee98fed06f1da8" - integrity sha512-QQOOdY4PE39iawDn5rzbIePNigfe5B9Z91GDD1ae/xNDlu9kaat8QQ5EKnNmVWPV54hUdxCVwwj6YMgR2O7IOg== +jest-resolve-dependencies@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-29.7.0.tgz#1b04f2c095f37fc776ff40803dc92921b1e88428" + integrity sha512-un0zD/6qxJ+S0et7WxeI3H5XSe9lTBBR7bOHCHXkKR6luG5mwDDlIzVQ0V5cZCuoTgEdcdwzTghYkTWfubi+nA== dependencies: - "@jest/types" "^27.5.1" - jest-regex-util "^27.5.1" - jest-snapshot "^27.5.1" + jest-regex-util "^29.6.3" + jest-snapshot "^29.7.0" -jest-resolve@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-27.5.1.tgz#a2f1c5a0796ec18fe9eb1536ac3814c23617b384" - integrity sha512-FFDy8/9E6CV83IMbDpcjOhumAQPDyETnU2KZ1O98DwTnz8AOBsW/Xv3GySr1mOZdItLR+zDZ7I/UdTFbgSOVCw== +jest-resolve@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-29.7.0.tgz#64d6a8992dd26f635ab0c01e5eef4399c6bcbc30" + integrity sha512-IOVhZSrg+UvVAshDSDtHyFCCBUl/Q3AAJv8iZ6ZjnZ74xzvwuzLXid9IIIPgTnY62SJjfuupMKZsZQRsCvxEgA== dependencies: - "@jest/types" "^27.5.1" chalk "^4.0.0" graceful-fs "^4.2.9" - jest-haste-map "^27.5.1" + jest-haste-map "^29.7.0" jest-pnp-resolver "^1.2.2" - jest-util "^27.5.1" - jest-validate "^27.5.1" + jest-util "^29.7.0" + jest-validate "^29.7.0" resolve "^1.20.0" - resolve.exports "^1.1.0" + resolve.exports "^2.0.0" slash "^3.0.0" -jest-runner@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-27.5.1.tgz#071b27c1fa30d90540805c5645a0ec167c7b62e5" - integrity sha512-g4NPsM4mFCOwFKXO4p/H/kWGdJp9V8kURY2lX8Me2drgXqG7rrZAx5kv+5H7wtt/cdFIjhqYx1HrlqWHaOvDaQ== +jest-runner@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-29.7.0.tgz#809af072d408a53dcfd2e849a4c976d3132f718e" + integrity sha512-fsc4N6cPCAahybGBfTRcq5wFR6fpLznMg47sY5aDpsoejOcVYFb07AHuSnR0liMcPTgBsA3ZJL6kFOjPdoNipQ== dependencies: - "@jest/console" "^27.5.1" - "@jest/environment" "^27.5.1" - "@jest/test-result" "^27.5.1" - "@jest/transform" "^27.5.1" - "@jest/types" "^27.5.1" + "@jest/console" "^29.7.0" + "@jest/environment" "^29.7.0" + "@jest/test-result" "^29.7.0" + "@jest/transform" "^29.7.0" + "@jest/types" "^29.6.3" "@types/node" "*" chalk "^4.0.0" - emittery "^0.8.1" + emittery "^0.13.1" graceful-fs "^4.2.9" - jest-docblock "^27.5.1" - jest-environment-jsdom "^27.5.1" - jest-environment-node "^27.5.1" - jest-haste-map "^27.5.1" - jest-leak-detector "^27.5.1" - jest-message-util "^27.5.1" - jest-resolve "^27.5.1" - jest-runtime "^27.5.1" - jest-util "^27.5.1" - jest-worker "^27.5.1" - source-map-support "^0.5.6" - throat "^6.0.1" - -jest-runtime@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-27.5.1.tgz#4896003d7a334f7e8e4a53ba93fb9bcd3db0a1af" - integrity sha512-o7gxw3Gf+H2IGt8fv0RiyE1+r83FJBRruoA+FXrlHw6xEyBsU8ugA6IPfTdVyA0w8HClpbK+DGJxH59UrNMx8A== - dependencies: - "@jest/environment" "^27.5.1" - "@jest/fake-timers" "^27.5.1" - "@jest/globals" "^27.5.1" - "@jest/source-map" "^27.5.1" - "@jest/test-result" "^27.5.1" - "@jest/transform" "^27.5.1" - "@jest/types" "^27.5.1" + jest-docblock "^29.7.0" + jest-environment-node "^29.7.0" + jest-haste-map "^29.7.0" + jest-leak-detector "^29.7.0" + jest-message-util "^29.7.0" + jest-resolve "^29.7.0" + jest-runtime "^29.7.0" + jest-util "^29.7.0" + jest-watcher "^29.7.0" + jest-worker "^29.7.0" + p-limit "^3.1.0" + source-map-support "0.5.13" + +jest-runtime@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-29.7.0.tgz#efecb3141cf7d3767a3a0cc8f7c9990587d3d817" + integrity sha512-gUnLjgwdGqW7B4LvOIkbKs9WGbn+QLqRQQ9juC6HndeDiezIwhDP+mhMwHWCEcfQ5RUXa6OPnFF8BJh5xegwwQ== + dependencies: + "@jest/environment" "^29.7.0" + "@jest/fake-timers" "^29.7.0" + "@jest/globals" "^29.7.0" + "@jest/source-map" "^29.6.3" + "@jest/test-result" "^29.7.0" + "@jest/transform" "^29.7.0" + "@jest/types" "^29.6.3" + "@types/node" "*" chalk "^4.0.0" cjs-module-lexer "^1.0.0" collect-v8-coverage "^1.0.0" - execa "^5.0.0" glob "^7.1.3" graceful-fs "^4.2.9" - jest-haste-map "^27.5.1" - jest-message-util "^27.5.1" - jest-mock "^27.5.1" - jest-regex-util "^27.5.1" - jest-resolve "^27.5.1" - jest-snapshot "^27.5.1" - jest-util "^27.5.1" + jest-haste-map "^29.7.0" + jest-message-util "^29.7.0" + jest-mock "^29.7.0" + jest-regex-util "^29.6.3" + jest-resolve "^29.7.0" + jest-snapshot "^29.7.0" + jest-util "^29.7.0" slash "^3.0.0" strip-bom "^4.0.0" -jest-serializer@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-serializer/-/jest-serializer-27.5.1.tgz#81438410a30ea66fd57ff730835123dea1fb1f64" - integrity sha512-jZCyo6iIxO1aqUxpuBlwTDMkzOAJS4a3eYz3YzgxxVQFwLeSA7Jfq5cbqCY+JLvTDrWirgusI/0KwxKMgrdf7w== - dependencies: - "@types/node" "*" - graceful-fs "^4.2.9" - -jest-snapshot@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-27.5.1.tgz#b668d50d23d38054a51b42c4039cab59ae6eb6a1" - integrity sha512-yYykXI5a0I31xX67mgeLw1DZ0bJB+gpq5IpSuCAoyDi0+BhgU/RIrL+RTzDmkNTchvDFWKP8lp+w/42Z3us5sA== +jest-snapshot@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-29.7.0.tgz#c2c574c3f51865da1bb329036778a69bf88a6be5" + integrity sha512-Rm0BMWtxBcioHr1/OX5YCP8Uov4riHvKPknOGs804Zg9JGZgmIBkbtlxJC/7Z4msKYVbIJtfU+tKb8xlYNfdkw== dependencies: - "@babel/core" "^7.7.2" + "@babel/core" "^7.11.6" "@babel/generator" "^7.7.2" + "@babel/plugin-syntax-jsx" "^7.7.2" "@babel/plugin-syntax-typescript" "^7.7.2" - "@babel/traverse" "^7.7.2" - "@babel/types" "^7.0.0" - "@jest/transform" "^27.5.1" - "@jest/types" "^27.5.1" - "@types/babel__traverse" "^7.0.4" - "@types/prettier" "^2.1.5" + "@babel/types" "^7.3.3" + "@jest/expect-utils" "^29.7.0" + "@jest/transform" "^29.7.0" + "@jest/types" "^29.6.3" babel-preset-current-node-syntax "^1.0.0" chalk "^4.0.0" - expect "^27.5.1" + expect "^29.7.0" graceful-fs "^4.2.9" - jest-diff "^27.5.1" - jest-get-type "^27.5.1" - jest-haste-map "^27.5.1" - jest-matcher-utils "^27.5.1" - jest-message-util "^27.5.1" - jest-util "^27.5.1" + jest-diff "^29.7.0" + jest-get-type "^29.6.3" + jest-matcher-utils "^29.7.0" + jest-message-util "^29.7.0" + jest-util "^29.7.0" natural-compare "^1.4.0" - pretty-format "^27.5.1" - semver "^7.3.2" + pretty-format "^29.7.0" + semver "^7.5.3" -jest-util@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-27.5.1.tgz#3ba9771e8e31a0b85da48fe0b0891fb86c01c2f9" - integrity sha512-Kv2o/8jNvX1MQ0KGtw480E/w4fBCDOnH6+6DmeKi6LZUIlKA5kwY0YNdlzaWTiVgxqAqik11QyxDOKk543aKXw== +jest-util@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-29.7.0.tgz#23c2b62bfb22be82b44de98055802ff3710fc0bc" + integrity sha512-z6EbKajIpqGKU56y5KBUgy1dt1ihhQJgWzUlZHArA/+X2ad7Cb5iF+AK1EWVL/Bo7Rz9uurpqw6SiBCefUbCGA== dependencies: - "@jest/types" "^27.5.1" + "@jest/types" "^29.6.3" "@types/node" "*" chalk "^4.0.0" ci-info "^3.2.0" graceful-fs "^4.2.9" picomatch "^2.2.3" -jest-validate@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-27.5.1.tgz#9197d54dc0bdb52260b8db40b46ae668e04df067" - integrity sha512-thkNli0LYTmOI1tDB3FI1S1RTp/Bqyd9pTarJwL87OIBFuqEb5Apv5EaApEudYg4g86e3CT6kM0RowkhtEnCBQ== +jest-validate@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-29.7.0.tgz#7bf705511c64da591d46b15fce41400d52147d9c" + integrity sha512-ZB7wHqaRGVw/9hST/OuFUReG7M8vKeq0/J2egIGLdvjHCmYqGARhzXmtgi+gVeZ5uXFF219aOc3Ls2yLg27tkw== dependencies: - "@jest/types" "^27.5.1" + "@jest/types" "^29.6.3" camelcase "^6.2.0" chalk "^4.0.0" - jest-get-type "^27.5.1" + jest-get-type "^29.6.3" leven "^3.1.0" - pretty-format "^27.5.1" + pretty-format "^29.7.0" -jest-watcher@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-27.5.1.tgz#71bd85fb9bde3a2c2ec4dc353437971c43c642a2" - integrity sha512-z676SuD6Z8o8qbmEGhoEUFOM1+jfEiL3DXHK/xgEiG2EyNYfFG60jluWcupY6dATjfEsKQuibReS1djInQnoVw== +jest-watcher@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-29.7.0.tgz#7810d30d619c3a62093223ce6bb359ca1b28a2f2" + integrity sha512-49Fg7WXkU3Vl2h6LbLtMQ/HyB6rXSIX7SqvBLQmssRBGN9I0PNvPmAmCWSOY6SOvrjhI/F7/bGAv9RtnsPA03g== dependencies: - "@jest/test-result" "^27.5.1" - "@jest/types" "^27.5.1" + "@jest/test-result" "^29.7.0" + "@jest/types" "^29.6.3" "@types/node" "*" ansi-escapes "^4.2.1" chalk "^4.0.0" - jest-util "^27.5.1" + emittery "^0.13.1" + jest-util "^29.7.0" string-length "^4.0.1" -jest-worker@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-27.5.1.tgz#8d146f0900e8973b106b6f73cc1e9a8cb86f8db0" - integrity sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg== +jest-worker@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-29.7.0.tgz#acad073acbbaeb7262bd5389e1bcf43e10058d4a" + integrity sha512-eIz2msL/EzL9UFTFFx7jBTkeZfku0yUAyZZZmJ93H2TYEiroIx2PQjEXcwYtYl8zXCxb+PAmA2hLIt/6ZEkPHw== dependencies: "@types/node" "*" + jest-util "^29.7.0" merge-stream "^2.0.0" supports-color "^8.0.0" -jest@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest/-/jest-27.5.1.tgz#dadf33ba70a779be7a6fc33015843b51494f63fc" - integrity sha512-Yn0mADZB89zTtjkPJEXwrac3LHudkQMR+Paqa8uxJHCBr9agxztUifWCyiYrjhMPBoUVBjyny0I7XH6ozDr7QQ== +jest@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest/-/jest-29.7.0.tgz#994676fc24177f088f1c5e3737f5697204ff2613" + integrity sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw== dependencies: - "@jest/core" "^27.5.1" + "@jest/core" "^29.7.0" + "@jest/types" "^29.6.3" import-local "^3.0.2" - jest-cli "^27.5.1" + jest-cli "^29.7.0" -js-sha3@0.8.0, js-sha3@^0.8.0: +js-sha3@^0.8.0: version "0.8.0" resolved "https://registry.yarnpkg.com/js-sha3/-/js-sha3-0.8.0.tgz#b9b7a5da73afad7dedd0f8c463954cbde6818840" integrity sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q== -js-sha3@^0.5.7: - version "0.5.7" - resolved "https://registry.yarnpkg.com/js-sha3/-/js-sha3-0.5.7.tgz#0d4ffd8002d5333aabaf4a23eed2f6374c9f28e7" - integrity sha512-GII20kjaPX0zJ8wzkTbNDYMY7msuZcTWk8S5UOh6806Jq/wz1J8/bnr8uGU0DAUmYDjj2Mr4X1cW8v/GLYnR+g== - js-tokens@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== js-yaml@^3.13.1: - version "3.14.1" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.1.tgz#dae812fdb3825fa306609a8717383c50c36a0537" - integrity sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g== + version "3.15.1" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.15.1.tgz#24bc95028f361cdaaa84745b06a109c4486773c0" + integrity sha512-S99WuO3HlhO3XN41EtYUNl9zzXjoJx7QvmipxsJVxtCBT0YHEFy+iOJhjSvrmV12nYhWpZaM8lPHkJm0yUMbag== dependencies: argparse "^1.0.7" esprima "^4.0.0" -jsbn@~0.1.0: - version "0.1.1" - resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" - integrity sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg== - -jsdom@^16.6.0: - version "16.7.0" - resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-16.7.0.tgz#918ae71965424b197c819f8183a754e18977b710" - integrity sha512-u9Smc2G1USStM+s/x1ru5Sxrl6mPYCbByG1U/hUmqaVsm4tbNyS7CicOSRyuGQYZhTu0h84qkZZQ/I+dzizSVw== - dependencies: - abab "^2.0.5" - acorn "^8.2.4" - acorn-globals "^6.0.0" - cssom "^0.4.4" - cssstyle "^2.3.0" - data-urls "^2.0.0" - decimal.js "^10.2.1" - domexception "^2.0.1" - escodegen "^2.0.0" - form-data "^3.0.0" - html-encoding-sniffer "^2.0.1" - http-proxy-agent "^4.0.1" - https-proxy-agent "^5.0.0" - is-potential-custom-element-name "^1.0.1" - nwsapi "^2.2.0" - parse5 "6.0.1" - saxes "^5.0.1" - symbol-tree "^3.2.4" - tough-cookie "^4.0.0" - w3c-hr-time "^1.0.2" - w3c-xmlserializer "^2.0.0" - webidl-conversions "^6.1.0" - whatwg-encoding "^1.0.5" - whatwg-mimetype "^2.3.0" - whatwg-url "^8.5.0" - ws "^7.4.6" - xml-name-validator "^3.0.0" - jsesc@^3.0.2: version "3.1.0" resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-3.1.0.tgz#74d335a234f67ed19907fdadfac7ccf9d409825d" integrity sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA== -json-buffer@3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/json-buffer/-/json-buffer-3.0.1.tgz#9338802a30d3b6605fbe0613e094008ca8c05a13" - integrity sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ== - json-parse-even-better-errors@^2.3.0: version "2.3.1" resolved "https://registry.yarnpkg.com/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz#7c47805a94319928e05777405dc12e1f7a4ee02d" integrity sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w== -json-schema-traverse@^0.4.1: - version "0.4.1" - resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" - integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== - -json-schema@0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.4.0.tgz#f7de4cf6efab838ebaeb3236474cbba5a1930ab5" - integrity sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA== - -json-stringify-safe@~5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" - integrity sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA== - json5@^2.2.3: version "2.2.3" resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283" integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg== -jsonfile@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb" - integrity sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg== - optionalDependencies: - graceful-fs "^4.1.6" - -jsprim@^1.2.2: - version "1.4.2" - resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.2.tgz#712c65533a15c878ba59e9ed5f0e26d5b77c5feb" - integrity sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw== - dependencies: - assert-plus "1.0.0" - extsprintf "1.3.0" - json-schema "0.4.0" - verror "1.10.0" - keccak@^3.0.0: version "3.0.4" resolved "https://registry.yarnpkg.com/keccak/-/keccak-3.0.4.tgz#edc09b89e633c0549da444432ecf062ffadee86d" @@ -3986,13 +2354,6 @@ keccak@^3.0.0: node-gyp-build "^4.2.0" readable-stream "^3.6.0" -keyv@^4.0.0: - version "4.5.4" - resolved "https://registry.yarnpkg.com/keyv/-/keyv-4.5.4.tgz#a879a99e29452f942439f2a405e3af8b31d4de93" - integrity sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw== - dependencies: - json-buffer "3.0.1" - kleur@^3.0.3: version "3.0.3" resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e" @@ -4073,25 +2434,15 @@ locate-path@^5.0.0: dependencies: p-locate "^4.1.0" -lodash@^4.17.14, lodash@^4.7.0: - version "4.17.21" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" - integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== +lodash@^4.17.14: + version "4.18.1" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.18.1.tgz#ff2b66c1f6326d59513de2407bf881439812771c" + integrity sha512-dMInicTPVE8d1e5otfwmmjlxkZoUpiVLwyeTdUsi/Caj/gfzzblBcCE5sRHV/AsjuCmxWrte2TNGSYuCeCq+0Q== -lowercase-keys@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-2.0.0.tgz#2603e78b7b4b0006cbca2fbcc8a3202558ac9479" - integrity sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA== - -lowercase-keys@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-3.0.0.tgz#c5e7d442e37ead247ae9db117a9d0a467c89d4f2" - integrity sha512-ozCC6gdQ+glXOQsveKD0YsDy8DSQFjDTz4zyzEHNV5+JP5D62LmfDZ6o1cycFx9ouG940M5dE8C8CTewdj2YWQ== - -lru-cache@^11.0.0: - version "11.1.0" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-11.1.0.tgz#afafb060607108132dbc1cf8ae661afb69486117" - integrity sha512-QIXZUBJUx+2zHUdQujWejBkcD9+cs94tLn0+YL8UrCh+D5sCXZ4c7LaEH48pNwRY3MLDgqUFyhlCyjJPf1WP0A== +lru-cache@^11.0.0: + version "11.5.2" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-11.5.2.tgz#00e16665c90c620fba14a3c368732a976493f760" + integrity sha512-4pfM1Ff0x50o0tQwb5ucw/RzNyD0/YJME6IVcStalZuMWxdt3sR3huStTtxz4PUmvZfRguvDejasvQ2kifR11g== lru-cache@^5.1.1: version "5.1.1" @@ -4119,11 +2470,6 @@ makeerror@1.0.12: dependencies: tmpl "1.0.5" -map-obj@^4.1.0: - version "4.3.0" - resolved "https://registry.yarnpkg.com/map-obj/-/map-obj-4.3.0.tgz#9304f906e93faae70880da102a9f1df0ea8bb05a" - integrity sha512-hdN1wVrZbb29eBGiGjJbeP8JbKjq1urkHJ/LIP/NY48MZ1QVXUsQBV1G1zvYFHn1XE06cwjBsOI2K3Ulnj1YXQ== - math-intrinsics@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/math-intrinsics/-/math-intrinsics-1.1.0.tgz#a0dd74be81e2aa5c2f27e65ce283605ee4e2b7f9" @@ -4138,11 +2484,6 @@ md5.js@^1.3.4: inherits "^2.0.1" safe-buffer "^5.1.2" -media-typer@0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748" - integrity sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ== - memdown@~3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/memdown/-/memdown-3.0.0.tgz#93aca055d743b20efc37492e9e399784f2958309" @@ -4155,21 +2496,11 @@ memdown@~3.0.0: ltgt "~2.2.0" safe-buffer "~5.1.1" -merge-descriptors@1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/merge-descriptors/-/merge-descriptors-1.0.3.tgz#d80319a65f3c7935351e5cfdac8f9318504dbed5" - integrity sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ== - merge-stream@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== -merkle-lib@^2.0.10: - version "2.0.10" - resolved "https://registry.yarnpkg.com/merkle-lib/-/merkle-lib-2.0.10.tgz#82b8dbae75e27a7785388b73f9d7725d0f6f3326" - integrity sha512-XrNQvUbn1DL5hKNe46Ccs+Tu3/PYOlrcZILuGUhb95oKBPjc/nmIC8D462PQkipVDGKRvwhn+QFg2cCdIvmDJA== - "merkle-patricia-tree@github:zmitton/merkle-patricia-tree#build": version "3.0.0" resolved "https://codeload.github.com/zmitton/merkle-patricia-tree/tar.gz/3e33005b879d839dea2239cae9e65171f2cc17a2" @@ -4182,16 +2513,6 @@ merkle-lib@^2.0.10: rlp "^2.0.0" semaphore ">=1.0.1" -methods@~1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" - integrity sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w== - -micro-ftch@^0.3.1: - version "0.3.1" - resolved "https://registry.yarnpkg.com/micro-ftch/-/micro-ftch-0.3.1.tgz#6cb83388de4c1f279a034fb0cf96dfc050853c5f" - integrity sha512-/0LLxhzP0tfiR5hcQebtudP56gUurs2CLkGarnCiB/OqEyUFQ6U3paQi/tgLv0hBJYt2rnr9MNpxz4fiiugstg== - micromatch@^4.0.4: version "4.0.8" resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.8.tgz#d66fa18f3a47076789320b9b1af32bd86d9fa202" @@ -4205,40 +2526,18 @@ mime-db@1.52.0: resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70" integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== -mime-types@^2.1.12, mime-types@^2.1.16, mime-types@^2.1.35, mime-types@~2.1.19, mime-types@~2.1.24, mime-types@~2.1.34: +mime-types@^2.1.35: version "2.1.35" resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a" integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== dependencies: mime-db "1.52.0" -mime@1.6.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1" - integrity sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg== - mimic-fn@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== -mimic-response@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-1.0.1.tgz#4923538878eef42063cb8a3e3b0798781487ab1b" - integrity sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ== - -mimic-response@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-3.1.0.tgz#2d1d59af9c1b129815accc2c46a022a5ce1fa3c9" - integrity sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ== - -min-document@^2.19.0: - version "2.19.0" - resolved "https://registry.yarnpkg.com/min-document/-/min-document-2.19.0.tgz#7bd282e3f5842ed295bb748cdd9f1ffa2c824685" - integrity sha512-9Wy1B3m3f66bPPmU5hdA4DR4PB2OfDU/+GS3yAB7IQozE3tqXaVv2zOjgla7MEGSRv95+ILmOuvhLkOK6wJtCQ== - dependencies: - dom-walk "^0.1.0" - minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7" @@ -4249,154 +2548,40 @@ minimalistic-crypto-utils@^1.0.1: resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" integrity sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg== -minimatch@^10.0.3: - version "10.0.3" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-10.0.3.tgz#cf7a0314a16c4d9ab73a7730a0e8e3c3502d47aa" - integrity sha512-IPZ167aShDZZUMdRk66cyQAW3qr0WzbHkPdMYa8bzZhlHhO3jALbKdxcaak7W9FfT2rZNpQuUu4Od7ILEpXSaw== +minimatch@^10.2.2: + version "10.2.6" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-10.2.6.tgz#fd956bbe0b77241e9f15ac5dccb1c638060968ef" + integrity sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A== dependencies: - "@isaacs/brace-expansion" "^5.0.0" + brace-expansion "^5.0.8" minimatch@^3.0.4, minimatch@^3.1.1: - version "3.1.2" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" - integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== + version "3.1.5" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.5.tgz#580c88f8d5445f2bd6aa8f3cadefa0de79fbd69e" + integrity sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w== dependencies: brace-expansion "^1.1.7" -minimist@^1.2.6: - version "1.2.8" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c" - integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA== +minipass@^7.1.2, minipass@^7.1.3: + version "7.1.3" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-7.1.3.tgz#79389b4eb1bb2d003a9bba87d492f2bd37bdc65b" + integrity sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A== -minipass@^2.6.0, minipass@^2.9.0: - version "2.9.0" - resolved "https://registry.yarnpkg.com/minipass/-/minipass-2.9.0.tgz#e713762e7d3e32fed803115cf93e04bca9fcc9a6" - integrity sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg== - dependencies: - safe-buffer "^5.1.2" - yallist "^3.0.0" - -minipass@^7.1.2: - version "7.1.2" - resolved "https://registry.yarnpkg.com/minipass/-/minipass-7.1.2.tgz#93a9626ce5e5e66bd4db86849e7515e92340a707" - integrity sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw== - -minizlib@^1.3.3: - version "1.3.3" - resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-1.3.3.tgz#2290de96818a34c29551c8a8d301216bd65a861d" - integrity sha512-6ZYMOEnmVsdCeTJVE0W9ZD+pVnE8h9Hma/iOwwRDsdQoePpoX56/8B6z3P9VNwppJuBKNRuFDRNRqRWexT9G9Q== - dependencies: - minipass "^2.9.0" - -mkdirp-promise@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/mkdirp-promise/-/mkdirp-promise-5.0.1.tgz#e9b8f68e552c68a9c1713b84883f7a1dd039b8a1" - integrity sha512-Hepn5kb1lJPtVW84RFT40YG1OddBNTOVUZR2bzQUHc+Z03en8/3uX0+060JDhcEzyO08HmipsN9DcnFMxhIL9w== - dependencies: - mkdirp "*" - -mkdirp@*: - version "3.0.1" - resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-3.0.1.tgz#e44e4c5607fb279c168241713cc6e0fea9adcb50" - integrity sha512-+NsyUUAZDmo6YVHzL/stxSu3t9YS1iljliy3BSDrXJ/dkn1KYdmtZODGGjLcc9XLgVVpH4KshHB8XmZgMhaBXg== - -mkdirp@^0.5.5: - version "0.5.6" - resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.6.tgz#7def03d2432dcae4ba1d611445c48396062255f6" - integrity sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw== - dependencies: - minimist "^1.2.6" - -mock-fs@^4.1.0: - version "4.14.0" - resolved "https://registry.yarnpkg.com/mock-fs/-/mock-fs-4.14.0.tgz#ce5124d2c601421255985e6e94da80a7357b1b18" - integrity sha512-qYvlv/exQ4+svI3UOvPUpLDF0OMX5euvUH0Ny4N5QyRyhNdgAgUrVH3iUINSzEPLvx0kbo/Bp28GJKIqvE7URw== - -ms@2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" - integrity sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A== - -ms@2.1.3, ms@^2.1.3: +ms@^2.1.3: version "2.1.3" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== -multibase@^0.7.0: - version "0.7.0" - resolved "https://registry.yarnpkg.com/multibase/-/multibase-0.7.0.tgz#1adfc1c50abe05eefeb5091ac0c2728d6b84581b" - integrity sha512-TW8q03O0f6PNFTQDvh3xxH03c8CjGaaYrjkl9UQPG6rz53TQzzxJVCIWVjzcbN/Q5Y53Zd0IBQBMVktVgNx4Fg== - dependencies: - base-x "^3.0.8" - buffer "^5.5.0" - -multibase@~0.6.0: - version "0.6.1" - resolved "https://registry.yarnpkg.com/multibase/-/multibase-0.6.1.tgz#b76df6298536cc17b9f6a6db53ec88f85f8cc12b" - integrity sha512-pFfAwyTjbbQgNc3G7D48JkJxWtoJoBMaR4xQUOuB8RnCgRqaYmWNFeJTTvrJ2w51bjLq2zTby6Rqj9TQ9elSUw== - dependencies: - base-x "^3.0.8" - buffer "^5.5.0" - -multicodec@^0.5.5: - version "0.5.7" - resolved "https://registry.yarnpkg.com/multicodec/-/multicodec-0.5.7.tgz#1fb3f9dd866a10a55d226e194abba2dcc1ee9ffd" - integrity sha512-PscoRxm3f+88fAtELwUnZxGDkduE2HD9Q6GHUOywQLjOGT/HAdhjLDYNZ1e7VR0s0TP0EwZ16LNUTFpoBGivOA== - dependencies: - varint "^5.0.0" - -multicodec@^1.0.0: - version "1.0.4" - resolved "https://registry.yarnpkg.com/multicodec/-/multicodec-1.0.4.tgz#46ac064657c40380c28367c90304d8ed175a714f" - integrity sha512-NDd7FeS3QamVtbgfvu5h7fd1IlbaC4EQ0/pgU4zqE2vdHCmBGsUa0TiM8/TdSeG6BMPC92OOCf8F1ocE/Wkrrg== - dependencies: - buffer "^5.6.0" - varint "^5.0.0" - -multihashes@^0.4.15, multihashes@~0.4.15: - version "0.4.21" - resolved "https://registry.yarnpkg.com/multihashes/-/multihashes-0.4.21.tgz#dc02d525579f334a7909ade8a122dabb58ccfcb5" - integrity sha512-uVSvmeCWf36pU2nB4/1kzYZjsXD9vofZKpgudqkceYY5g2aZZXJ5r9lxuzoRLl1OAp28XljXsEJ/X/85ZsKmKw== - dependencies: - buffer "^5.5.0" - multibase "^0.7.0" - varint "^5.0.0" - -nan@^2.13.2, nan@^2.14.0: - version "2.23.0" - resolved "https://registry.yarnpkg.com/nan/-/nan-2.23.0.tgz#24aa4ddffcc37613a2d2935b97683c1ec96093c6" - integrity sha512-1UxuyYGdoQHcGg87Lkqm3FzefucTa0NAiOcuRsDmysep3c1LVCRK2krrUDafMWtjSG04htvAmvg96+SDknOmgQ== - -nano-json-stream-parser@^0.1.2: - version "0.1.2" - resolved "https://registry.yarnpkg.com/nano-json-stream-parser/-/nano-json-stream-parser-0.1.2.tgz#0cc8f6d0e2b622b479c40d499c46d64b755c6f5f" - integrity sha512-9MqxMH/BSJC7dnLsEMPyfN5Dvoo49IsPFYMcHw3Bcfc2kN0lpHRBSzlMSVx4HGyJ7s9B31CyBTVehWJoQ8Ctew== - natural-compare@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" integrity sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw== -negotiator@0.6.3: - version "0.6.3" - resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.3.tgz#58e323a72fedc0d6f9cd4d31fe49f51479590ccd" - integrity sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg== - -next-tick@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.1.0.tgz#1836ee30ad56d67ef281b22bd199f709449b35eb" - integrity sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ== - node-addon-api@^2.0.0: version "2.0.2" resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-2.0.2.tgz#432cfa82962ce494b132e9d72a15b29f71ff5d32" integrity sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA== -node-addon-api@^3.0.0: - version "3.2.1" - resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-3.2.1.tgz#81325e0a2117789c0128dab65e7e38f07ceba161" - integrity sha512-mmcei9JghVNDYydghQmeDX8KoAm0FAiYyIcUt/N4nhyAipB17pllZQDOJD2fotxABnt4Mdz+dKTO7eftLg4d0A== - node-addon-api@^5.0.0: version "5.1.0" resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-5.1.0.tgz#49da1ca055e109a23d537e9de43c09cca21eb762" @@ -4410,14 +2595,7 @@ node-fetch@^1.0.1: encoding "^0.1.11" is-stream "^1.0.1" -node-fetch@^2.7.0: - version "2.7.0" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d" - integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A== - dependencies: - whatwg-url "^5.0.0" - -node-gyp-build@^4.2.0, node-gyp-build@^4.2.2, node-gyp-build@^4.3.0: +node-gyp-build@^4.2.0: version "4.8.4" resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.8.4.tgz#8a70ee85464ae52327772a90d66c6077a900cfc8" integrity sha512-LA4ZjwlnUblHVgq0oBF3Jl/6h/Nvs5fzBLwdEF4nuxnFdsfajde4WfxtJr3CaiH+F6ewcIB/q4jQ4UzPyid+CQ== @@ -4427,28 +2605,16 @@ node-int64@^0.4.0: resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" integrity sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw== -node-localstorage@^2.1.6: - version "2.2.1" - resolved "https://registry.yarnpkg.com/node-localstorage/-/node-localstorage-2.2.1.tgz#869723550a4883e426cb391d2df0b563a51c7c1c" - integrity sha512-vv8fJuOUCCvSPjDjBLlMqYMHob4aGjkmrkaE42/mZr0VT+ZAU10jRF8oTnX9+pgU9/vYJ8P7YT3Vd6ajkmzSCw== - dependencies: - write-file-atomic "^1.1.4" - -node-releases@^2.0.19: - version "2.0.19" - resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.19.tgz#9e445a52950951ec4d177d843af370b411caf314" - integrity sha512-xxOWJsBKtzAq7DY0J+DTzuz58K8e7sJbdgwkbMWQe8UYB6ekmsQ45q0M/tJDsGaZmbC+l7n57UV8Hl5tHxO9uw== +node-releases@^2.0.51: + version "2.0.52" + resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.52.tgz#d8283ba25e577a4d9756d5b45eca353ba5500300" + integrity sha512-MRlTqhAfoMx/4mhEbPo3Hi02g9LJZaJkka69V6h67Cb1gjrAG0jsTE4CZX1eptNx+VCAwJmfpnDIF4P0Nh1A7A== normalize-path@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== -normalize-url@^6.0.1: - version "6.1.0" - resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-6.1.0.tgz#40d0885b535deffe3f3147bec877d05fe4c5668a" - integrity sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A== - npm-run-path@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-4.0.1.tgz#b7ecd1e5ed53da8e37a55e1c2269e0b97ed748ea" @@ -4456,49 +2622,7 @@ npm-run-path@^4.0.1: dependencies: path-key "^3.0.0" -number-to-bn@1.7.0: - version "1.7.0" - resolved "https://registry.yarnpkg.com/number-to-bn/-/number-to-bn-1.7.0.tgz#bb3623592f7e5f9e0030b1977bd41a0c53fe1ea0" - integrity sha512-wsJ9gfSz1/s4ZsJN01lyonwuxA1tml6X1yBDnfpMglypcBRFZZkus26EdPSlqS5GJfYddVZa22p3VNb3z5m5Ig== - dependencies: - bn.js "4.11.6" - strip-hex-prefix "1.0.0" - -nwsapi@^2.2.0: - version "2.2.20" - resolved "https://registry.yarnpkg.com/nwsapi/-/nwsapi-2.2.20.tgz#22e53253c61e7b0e7e93cef42c891154bcca11ef" - integrity sha512-/ieB+mDe4MrrKMT8z+mQL8klXydZWGR5Dowt4RAGKbJ3kIGEx3X4ljUo+6V73IXtUPWgfOlU5B9MlGxFO5T+cA== - -oauth-sign@~0.9.0: - version "0.9.0" - resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.9.0.tgz#47a7b016baa68b5fa0ecf3dee08a85c679ac6455" - integrity sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ== - -object-assign@^4, object-assign@^4.1.0, object-assign@^4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" - integrity sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg== - -object-inspect@^1.13.3: - version "1.13.4" - resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.13.4.tgz#8375265e21bc20d0fa582c22e1b13485d6e00213" - integrity sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew== - -oboe@2.1.5: - version "2.1.5" - resolved "https://registry.yarnpkg.com/oboe/-/oboe-2.1.5.tgz#5554284c543a2266d7a38f17e073821fbde393cd" - integrity sha512-zRFWiF+FoicxEs3jNI/WYUrVEgA7DeET/InK0XQuudGHRg8iIob3cNPrJTKaz4004uaA9Pbe+Dwa8iluhjLZWA== - dependencies: - http-https "^1.0.0" - -on-finished@2.4.1: - version "2.4.1" - resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.4.1.tgz#58c8c44116e54845ad57f14ab10b03533184ac3f" - integrity sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg== - dependencies: - ee-first "1.1.1" - -once@^1.3.0, once@^1.3.1, once@^1.4.0: +once@^1.3.0: version "1.4.0" resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" integrity sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w== @@ -4512,16 +2636,6 @@ onetime@^5.1.2: dependencies: mimic-fn "^2.1.0" -p-cancelable@^2.0.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/p-cancelable/-/p-cancelable-2.1.1.tgz#aab7fbd416582fa32a3db49859c122487c5ed2cf" - integrity sha512-BZOr3nRQHOntUjTrH8+Lh54smKHoHyur8We1V8DSMVrl5A2malOOwuJRnKRDjSnkoeBh4at6BwEnb5I7Jl31wg== - -p-cancelable@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/p-cancelable/-/p-cancelable-3.0.0.tgz#63826694b54d61ca1c20ebcb6d3ecf5e14cd8050" - integrity sha512-mlVgR3PGuzlo0MmTdk4cXqXWlwQDLnONTAg6sm62XkMJEiRxN3GL3SffkYvqwonbkJBcrI7Uvv5Zh9yjvn2iUw== - p-limit@^2.2.0: version "2.3.0" resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1" @@ -4529,6 +2643,13 @@ p-limit@^2.2.0: dependencies: p-try "^2.0.0" +p-limit@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-3.1.0.tgz#e1daccbe78d0d1388ca18c64fea38e3e57e3706b" + integrity sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ== + dependencies: + yocto-queue "^0.1.0" + p-locate@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-4.1.0.tgz#a3428bb7088b3a60292f66919278b7c297ad4f07" @@ -4541,16 +2662,11 @@ p-try@^2.0.0: resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== -package-json-from-dist@^1.0.0: +package-json-from-dist@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz#4f1471a010827a86f94cfd9b0727e36d267de505" integrity sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw== -parse-headers@^2.0.0: - version "2.0.6" - resolved "https://registry.yarnpkg.com/parse-headers/-/parse-headers-2.0.6.tgz#7940f0abe5fe65df2dd25d4ce8800cb35b49d01c" - integrity sha512-Tz11t3uKztEW5FEVZnj1ox8GKblWn+PvHY9TmJV5Mll2uHEwRdR/5Li1OlXoECjLYkApdhWy44ocONwXLiKO5A== - parse-json@^5.2.0: version "5.2.0" resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-5.2.0.tgz#c76fc66dee54231c962b22bcc8a72cf2f99753cd" @@ -4561,16 +2677,6 @@ parse-json@^5.2.0: json-parse-even-better-errors "^2.3.0" lines-and-columns "^1.1.6" -parse5@6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/parse5/-/parse5-6.0.1.tgz#e1a1c085c569b3dc08321184f19a39cc27f7c30b" - integrity sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw== - -parseurl@~1.3.3: - version "1.3.3" - resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.3.tgz#9da19e7bee8d12dff0513ed5b76957793bc2e8d4" - integrity sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ== - path-exists@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" @@ -4591,35 +2697,25 @@ path-parse@^1.0.7: resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== -path-scurry@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/path-scurry/-/path-scurry-2.0.0.tgz#9f052289f23ad8bf9397a2a0425e7b8615c58580" - integrity sha512-ypGJsmGtdXUOeM5u93TyeIEfEhM6s+ljAhrk5vAvSx8uyY/02OvrZnA0YNGUrPXfpJMgI1ODd3nwz8Npx4O4cg== +path-scurry@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/path-scurry/-/path-scurry-2.0.2.tgz#6be0d0ee02a10d9e0de7a98bae65e182c9061f85" + integrity sha512-3O/iVVsJAPsOnpwWIeD+d6z/7PmqApyQePUtCndjatj/9I5LylHvt5qluFaBT3I5h3r1ejfR056c+FCv+NnNXg== dependencies: lru-cache "^11.0.0" minipass "^7.1.2" -path-to-regexp@0.1.12: - version "0.1.12" - resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.12.tgz#d5e1a12e478a976d432ef3c58d534b9923164bb7" - integrity sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ== - pbkdf2@^3.0.17: - version "3.1.3" - resolved "https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.1.3.tgz#8be674d591d65658113424592a95d1517318dd4b" - integrity sha512-wfRLBZ0feWRhCIkoMB6ete7czJcnNnqRpcoWQBLqatqXXmelSRqfdDK4F3u9T2s2cXas/hQJcryI/4lAL+XTlA== + version "3.1.6" + resolved "https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.1.6.tgz#935cb1d99e491880cb48cb070bb539a6901e57d6" + integrity sha512-BT6eelPB1EyGHo8pC0o9Bl6k6SYVhKO1jEbd3lcTrtr7XHdjP8BW1YpfCV3G9Kwkxgattk+S5q2/RvuttCsS1g== dependencies: - create-hash "~1.1.3" + create-hash "^1.2.0" create-hmac "^1.1.7" - ripemd160 "=2.0.1" + ripemd160 "^2.0.3" safe-buffer "^5.2.1" - sha.js "^2.4.11" - to-buffer "^1.2.0" - -performance-now@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" - integrity sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow== + sha.js "^2.4.12" + to-buffer "^1.2.2" picocolors@^1.1.1: version "1.1.1" @@ -4627,9 +2723,9 @@ picocolors@^1.1.1: integrity sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA== picomatch@^2.0.4, picomatch@^2.2.3, picomatch@^2.3.1: - version "2.3.1" - resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" - integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== + version "2.3.2" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.2.tgz#5a942915e26b372dc0f0e6753149a16e6b1c5601" + integrity sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA== pirates@^4.0.4: version "4.0.7" @@ -4648,25 +2744,20 @@ possible-typed-array-names@^1.0.0: resolved "https://registry.yarnpkg.com/possible-typed-array-names/-/possible-typed-array-names-1.1.0.tgz#93e3582bc0e5426586d9d07b79ee40fc841de4ae" integrity sha512-/+5VFTchJDoVj3bhoqi6UeymcD00DAwb1nJwamzPvHEszJ4FpF6SNNbUbOS8yI56qHzdV8eK0qEfOSiodkTdxg== -pretty-format@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-27.5.1.tgz#2181879fdea51a7a5851fb39d920faa63f01d88e" - integrity sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ== +pretty-format@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-29.7.0.tgz#ca42c758310f365bfa71a0bda0a807160b776812" + integrity sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ== dependencies: - ansi-regex "^5.0.1" + "@jest/schemas" "^29.6.3" ansi-styles "^5.0.0" - react-is "^17.0.1" + react-is "^18.0.0" process-nextick-args@~2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag== -process@^0.11.10: - version "0.11.10" - resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182" - integrity sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A== - promisfy@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/promisfy/-/promisfy-1.2.0.tgz#d34cfec196bddd6a2cfa0bf64eaca53dbc9250a8" @@ -4680,110 +2771,34 @@ prompts@^2.0.1: kleur "^3.0.3" sisteransi "^1.0.5" -proxy-addr@~2.0.7: - version "2.0.7" - resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-2.0.7.tgz#f19fe69ceab311eeb94b42e70e8c2070f9ba1025" - integrity sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg== - dependencies: - forwarded "0.2.0" - ipaddr.js "1.9.1" +proxy-from-env@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-2.1.0.tgz#a7487568adad577cfaaa7e88c49cab3ab3081aba" + integrity sha512-cJ+oHTW1VAEa8cJslgmUZrc+sjRKgAKl3Zyse6+PV38hZe/V6Z14TbCuXcan9F9ghlz4QrFr2c92TNF82UkYHA== prr@~1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/prr/-/prr-1.0.1.tgz#d3fc114ba06995a45ec6893f484ceb1d78f5f476" integrity sha512-yPw4Sng1gWghHQWj0B3ZggWUm4qVbPwPFcRG8KyxiU7J2OHFSoEHKS+EZ3fv5l1t9CyCiop6l/ZYeWbrgoQejw== -psl@^1.1.28, psl@^1.1.33: - version "1.15.0" - resolved "https://registry.yarnpkg.com/psl/-/psl-1.15.0.tgz#bdace31896f1d97cec6a79e8224898ce93d974c6" - integrity sha512-JZd3gMVBAVQkSs6HdNZo9Sdo0LNcQeMNP3CozBJb3JYC/QUYZTnKxP+f8oWRX4rHP5EurWxqAHTSwUCjlNKa1w== - dependencies: - punycode "^2.3.1" - -pump@^3.0.0: - version "3.0.3" - resolved "https://registry.yarnpkg.com/pump/-/pump-3.0.3.tgz#151d979f1a29668dc0025ec589a455b53282268d" - integrity sha512-todwxLMY7/heScKmntwQG8CXVkWUOdYxIvY2s0VWAAMh/nd8SoYiRaKjlr7+iCs984f2P8zvrfWcDDYVb73NfA== - dependencies: - end-of-stream "^1.1.0" - once "^1.3.1" - -punycode@2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.0.tgz#5f863edc89b96db09074bad7947bf09056ca4e7d" - integrity sha512-Yxz2kRwT90aPiWEMHVYnEf4+rhwF1tBmmZ4KepCP+Wkium9JxtWnUm1nqGwpiAHr/tnTSeHqr3wb++jgSkXjhA== - -punycode@^2.1.0, punycode@^2.1.1, punycode@^2.3.1: - version "2.3.1" - resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.1.tgz#027422e2faec0b25e1549c3e1bd8309b9133b6e5" - integrity sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg== - -pushdata-bitcoin@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/pushdata-bitcoin/-/pushdata-bitcoin-1.0.1.tgz#15931d3cd967ade52206f523aa7331aef7d43af7" - integrity sha512-hw7rcYTJRAl4olM8Owe8x0fBuJJ+WGbMhQuLWOXEMN3PxPCKQHRkhfL+XG0+iXUmSHjkMmb3Ba55Mt21cZc9kQ== - dependencies: - bitcoin-ops "^1.3.0" - -qs@6.13.0: - version "6.13.0" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.13.0.tgz#6ca3bd58439f7e245655798997787b0d88a51906" - integrity sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg== - dependencies: - side-channel "^1.0.6" - -qs@~6.5.2: - version "6.5.3" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.3.tgz#3aeeffc91967ef6e35c0e488ef46fb296ab76aad" - integrity sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA== - -query-string@^5.0.1: - version "5.1.1" - resolved "https://registry.yarnpkg.com/query-string/-/query-string-5.1.1.tgz#a78c012b71c17e05f2e3fa2319dd330682efb3cb" - integrity sha512-gjWOsm2SoGlgLEdAGt7a6slVOk9mGiXmPFMqrEhLQ68rhQuBnpfs3+EmlvqKyxnCo9/PPlF+9MtY02S1aFg+Jw== - dependencies: - decode-uri-component "^0.2.0" - object-assign "^4.1.0" - strict-uri-encode "^1.0.0" - -querystringify@^2.1.1: - version "2.2.0" - resolved "https://registry.yarnpkg.com/querystringify/-/querystringify-2.2.0.tgz#3345941b4153cb9d082d8eee4cda2016a9aef7f6" - integrity sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ== - -quick-lru@^5.1.1: - version "5.1.1" - resolved "https://registry.yarnpkg.com/quick-lru/-/quick-lru-5.1.1.tgz#366493e6b3e42a3a6885e2e99d18f80fb7a8c932" - integrity sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA== +pure-rand@^6.0.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/pure-rand/-/pure-rand-6.1.0.tgz#d173cf23258231976ccbdb05247c9787957604f2" + integrity sha512-bVWawvoZoBYpp6yIoQtQXHZjmz35RSVHnUOTefl8Vcjr8snTPY1wnpSPMWekcFwbxI6gtmT7rSYPFvz71ldiOA== -randombytes@^2.0.1, randombytes@^2.1.0: +randombytes@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" integrity sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ== dependencies: safe-buffer "^5.1.0" -range-parser@~1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.1.tgz#3cf37023d199e1c24d1a55b84800c2f3e6468031" - integrity sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg== - -raw-body@2.5.2: - version "2.5.2" - resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.5.2.tgz#99febd83b90e08975087e8f1f9419a149366b68a" - integrity sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA== - dependencies: - bytes "3.1.2" - http-errors "2.0.0" - iconv-lite "0.4.24" - unpipe "1.0.0" - -react-is@^17.0.1: - version "17.0.2" - resolved "https://registry.yarnpkg.com/react-is/-/react-is-17.0.2.tgz#e691d4a8e9c789365655539ab372762b0efb54f0" - integrity sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w== +react-is@^18.0.0: + version "18.3.1" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.3.1.tgz#e83557dc12eae63a99e003a46388b1dcbb44db7e" + integrity sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg== -readable-stream@^2.2.8, readable-stream@^2.3.6: +readable-stream@^2.2.8, readable-stream@^2.3.6, readable-stream@^2.3.8: version "2.3.8" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.8.tgz#91125e8042bba1b9887f49345f6277027ce8be9b" integrity sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA== @@ -4796,7 +2811,7 @@ readable-stream@^2.2.8, readable-stream@^2.3.6: string_decoder "~1.1.1" util-deprecate "~1.0.1" -readable-stream@^3.0.6, readable-stream@^3.5.0, readable-stream@^3.6.0: +readable-stream@^3.0.6, readable-stream@^3.6.0: version "3.6.2" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.2.tgz#56a9b36ea965c00c5a93ef31eb111a0f11056967" integrity sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA== @@ -4805,47 +2820,11 @@ readable-stream@^3.0.6, readable-stream@^3.5.0, readable-stream@^3.6.0: string_decoder "^1.1.1" util-deprecate "^1.0.1" -request@^2.79.0: - version "2.88.2" - resolved "https://registry.yarnpkg.com/request/-/request-2.88.2.tgz#d73c918731cb5a87da047e207234146f664d12b3" - integrity sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw== - dependencies: - aws-sign2 "~0.7.0" - aws4 "^1.8.0" - caseless "~0.12.0" - combined-stream "~1.0.6" - extend "~3.0.2" - forever-agent "~0.6.1" - form-data "~2.3.2" - har-validator "~5.1.3" - http-signature "~1.2.0" - is-typedarray "~1.0.0" - isstream "~0.1.2" - json-stringify-safe "~5.0.1" - mime-types "~2.1.19" - oauth-sign "~0.9.0" - performance-now "^2.1.0" - qs "~6.5.2" - safe-buffer "^5.1.2" - tough-cookie "~2.5.0" - tunnel-agent "^0.6.0" - uuid "^3.3.2" - require-directory@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" integrity sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q== -requires-port@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff" - integrity sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ== - -resolve-alpn@^1.0.0, resolve-alpn@^1.2.0: - version "1.2.1" - resolved "https://registry.yarnpkg.com/resolve-alpn/-/resolve-alpn-1.2.1.tgz#b7adbdac3546aaaec20b45e7d8265927072726f9" - integrity sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g== - resolve-cwd@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/resolve-cwd/-/resolve-cwd-3.0.0.tgz#0f0075f1bb2544766cf73ba6a6e2adfebcb13f2d" @@ -4858,66 +2837,45 @@ resolve-from@^5.0.0: resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-5.0.0.tgz#c35225843df8f776df21c57557bc087e9dfdfc69" integrity sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw== -resolve.exports@^1.1.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/resolve.exports/-/resolve.exports-1.1.1.tgz#05cfd5b3edf641571fd46fa608b610dda9ead999" - integrity sha512-/NtpHNDN7jWhAaQ9BvBUYZ6YTXsRBgfqWFWP7BZBaoMJO/I3G5OFzvTuWNlZC3aPjins1F+TNrLKsGbH4rfsRQ== +resolve.exports@^2.0.0: + version "2.0.3" + resolved "https://registry.yarnpkg.com/resolve.exports/-/resolve.exports-2.0.3.tgz#41955e6f1b4013b7586f873749a635dea07ebe3f" + integrity sha512-OcXjMsGdhL4XnbShKpAcSqPMzQoYkYyhbEaeSko47MjRP9NfEQMhZkXL1DoFlt9LWQn4YttrdnV6X2OiyzBi+A== resolve@^1.20.0: - version "1.22.10" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.10.tgz#b663e83ffb09bbf2386944736baae803029b8b39" - integrity sha512-NPRy+/ncIMeDlTAsuqwKIiferiawhefFJtkNSW0qZJEqMEb+qBt/77B/jGeeek+F0uOeN05CDa6HXbbIgtVX4w== + version "1.22.12" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.12.tgz#f5b2a680897c69c238a13cd16b15671f8b73549f" + integrity sha512-TyeJ1zif53BPfHootBGwPRYT1RUt6oGWsaQr8UyZW/eAm9bKoijtvruSDEmZHm92CwS9nj7/fWttqPCgzep8CA== dependencies: - is-core-module "^2.16.0" + es-errors "^1.3.0" + is-core-module "^2.16.1" path-parse "^1.0.7" supports-preserve-symlinks-flag "^1.0.0" -responselike@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/responselike/-/responselike-2.0.1.tgz#9a0bc8fdc252f3fb1cca68b016591059ba1422bc" - integrity sha512-4gl03wn3hj1HP3yzgdI7d3lCkF95F21Pz4BPGvKHinyQzALR5CapwC8yIi0Rh58DEMQ/SguC03wFj2k0M/mHhw== - dependencies: - lowercase-keys "^2.0.0" - -rimraf@^3.0.0: - version "3.0.2" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a" - integrity sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA== +rimraf@^6.1.2: + version "6.1.3" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-6.1.3.tgz#afbee236b3bd2be331d4e7ce4493bac1718981af" + integrity sha512-LKg+Cr2ZF61fkcaK1UdkH2yEBBKnYjTyWzTJT6KNPcSPaiT7HSdhtMXQuN5wkTX0Xu72KQ1l8S42rlmexS2hSA== dependencies: - glob "^7.1.3" - -rimraf@^6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-6.0.1.tgz#ffb8ad8844dd60332ab15f52bc104bc3ed71ea4e" - integrity sha512-9dkvaxAsk/xNXSJzMgFqqMCuFgt2+KsOFek3TMLfo8NCPfWpBmqwyNn5Y+NX56QUYfCtsyhF3ayiboEoUmJk/A== - dependencies: - glob "^11.0.0" - package-json-from-dist "^1.0.0" + glob "^13.0.3" + package-json-from-dist "^1.0.1" -ripemd160@=2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-2.0.1.tgz#0f4584295c53a3628af7e6d79aca21ce57d1c6e7" - integrity sha512-J7f4wutN8mdbV08MJnXibYpCOPHR+yzy+iQ/AsjMv2j8cLavQ8VGagDFUwwTAdF8FmRKVeNpbTTEwNHCW1g94w== - dependencies: - hash-base "^2.0.0" - inherits "^2.0.1" - -ripemd160@^2.0.0, ripemd160@^2.0.1: - version "2.0.2" - resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-2.0.2.tgz#a1c1a6f624751577ba5d07914cbc92850585890c" - integrity sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA== +ripemd160@^2.0.0, ripemd160@^2.0.1, ripemd160@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-2.0.3.tgz#9be54e4ba5e3559c8eee06a25cd7648bbccdf5a8" + integrity sha512-5Di9UC0+8h1L6ZD2d7awM7E/T4uA1fJRlx6zk/NvdCCVEoAnFqvHmCuNeIKoCeIixBX/q8uM+6ycDvF8woqosA== dependencies: - hash-base "^3.0.0" - inherits "^2.0.1" + hash-base "^3.1.2" + inherits "^2.0.4" -rlp@^2.0.0, rlp@^2.2.3, rlp@^2.2.4: +rlp@^2.0.0, rlp@^2.2.3: version "2.2.7" resolved "https://registry.yarnpkg.com/rlp/-/rlp-2.2.7.tgz#33f31c4afac81124ac4b283e2bd4d9720b30beaf" integrity sha512-d5gdPmgQ0Z+AklL2NVXr/IoSjNZFfTVvQWzL/AM2AOcSzYP2xjlb0AC8YyCLc41MSNf6P6QVtjgPdmVtzb+4lQ== dependencies: bn.js "^5.2.0" -safe-buffer@5.2.1, safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@^5.2.0, safe-buffer@^5.2.1, safe-buffer@~5.2.0: +safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@^5.2.1, safe-buffer@~5.2.0: version "5.2.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== @@ -4927,46 +2885,16 @@ safe-buffer@~5.1.0, safe-buffer@~5.1.1: resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== -safe-regex-test@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/safe-regex-test/-/safe-regex-test-1.1.0.tgz#7f87dfb67a3150782eaaf18583ff5d1711ac10c1" - integrity sha512-x/+Cz4YrimQxQccJf5mKEbIa1NzeCRNI5Ecl/ekmlYaampdNLPalVyIcCZNNH3MvmqBugV5TMYZXv0ljslUlaw== - dependencies: - call-bound "^1.0.2" - es-errors "^1.3.0" - is-regex "^1.2.1" - -"safer-buffer@>= 2.1.2 < 3", "safer-buffer@>= 2.1.2 < 3.0.0", safer-buffer@^2.0.2, safer-buffer@^2.1.0, safer-buffer@~2.1.0: +"safer-buffer@>= 2.1.2 < 3.0.0": version "2.1.2" resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== -saxes@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/saxes/-/saxes-5.0.1.tgz#eebab953fa3b7608dbe94e5dadb15c888fa6696d" - integrity sha512-5LBh1Tls8c9xgGjw3QrMwETmTMVk0oFgvrFSvWx62llR2hcEInrKNZ2GZCCuuy2lvWrdl5jhbpeqc5hRYKFOcw== - dependencies: - xmlchars "^2.2.0" - -scrypt-js@3.0.1, scrypt-js@^3.0.0, scrypt-js@^3.0.1: +scrypt-js@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/scrypt-js/-/scrypt-js-3.0.1.tgz#d314a57c2aef69d1ad98a138a21fe9eafa9ee312" integrity sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA== -secp256k1@^3.8.0: - version "3.8.1" - resolved "https://registry.yarnpkg.com/secp256k1/-/secp256k1-3.8.1.tgz#b62a62a882d6b16f9b51fe599c6b3a861e36c59f" - integrity sha512-tArjQw2P0RTdY7QmkNehgp6TVvQXq6ulIhxv8gaH6YubKG/wxxAoNKcbuXjDhybbc+b2Ihc7e0xxiGN744UIiQ== - dependencies: - bindings "^1.5.0" - bip66 "^1.1.5" - bn.js "^4.11.8" - create-hash "^1.2.0" - drbg.js "^1.0.1" - elliptic "^6.5.7" - nan "^2.14.0" - safe-buffer "^5.1.2" - secp256k1@^4.0.1: version "4.0.4" resolved "https://registry.yarnpkg.com/secp256k1/-/secp256k1-4.0.4.tgz#58f0bfe1830fe777d9ca1ffc7574962a8189f8ab" @@ -4986,50 +2914,10 @@ semver@^6.3.0, semver@^6.3.1: resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== -semver@^7.3.2, semver@^7.5.3: - version "7.7.2" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.7.2.tgz#67d99fdcd35cec21e6f8b87a7fd515a33f982b58" - integrity sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA== - -send@0.19.0: - version "0.19.0" - resolved "https://registry.yarnpkg.com/send/-/send-0.19.0.tgz#bbc5a388c8ea6c048967049dbeac0e4a3f09d7f8" - integrity sha512-dW41u5VfLXu8SJh5bwRmyYUbAoSB3c9uQh6L8h/KtsFREPWpbX1lrljJo186Jc4nmci/sGUZ9a0a0J2zgfq2hw== - dependencies: - debug "2.6.9" - depd "2.0.0" - destroy "1.2.0" - encodeurl "~1.0.2" - escape-html "~1.0.3" - etag "~1.8.1" - fresh "0.5.2" - http-errors "2.0.0" - mime "1.6.0" - ms "2.1.3" - on-finished "2.4.1" - range-parser "~1.2.1" - statuses "2.0.1" - -serve-static@1.16.2: - version "1.16.2" - resolved "https://registry.yarnpkg.com/serve-static/-/serve-static-1.16.2.tgz#b6a5343da47f6bdd2673848bf45754941e803296" - integrity sha512-VqpjJZKadQB/PEbEwvFdO43Ax5dFBZ2UECszz8bQ7pi7wt//PWe1P6MN7eCnjsatYtBT6EuiClbjSWP2WrIoTw== - dependencies: - encodeurl "~2.0.0" - escape-html "~1.0.3" - parseurl "~1.3.3" - send "0.19.0" - -servify@^0.1.12: - version "0.1.12" - resolved "https://registry.yarnpkg.com/servify/-/servify-0.1.12.tgz#142ab7bee1f1d033b66d0707086085b17c06db95" - integrity sha512-/xE6GvsKKqyo1BAY+KxOWXcLpPsUUyji7Qg3bVD7hh1eRze5bR1uYiuDA/k3Gof1s9BTzQZEJK8sNcNGFIzeWw== - dependencies: - body-parser "^1.16.0" - cors "^2.8.1" - express "^4.14.0" - request "^2.79.0" - xhr "^2.3.3" +semver@^7.5.3, semver@^7.5.4: + version "7.8.5" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.8.5.tgz#39b646037dd50c14fb451e7e4cac58ed8b863f69" + integrity sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA== set-function-length@^1.2.2: version "1.2.2" @@ -5048,12 +2936,7 @@ setimmediate@^1.0.5: resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285" integrity sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA== -setprototypeof@1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.2.0.tgz#66c9a24a73f9fc28cbe66b09fed3d33dcaf1b424" - integrity sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw== - -sha.js@^2.4.0, sha.js@^2.4.11, sha.js@^2.4.8: +sha.js@^2.4.0, sha.js@^2.4.12, sha.js@^2.4.8: version "2.4.12" resolved "https://registry.yarnpkg.com/sha.js/-/sha.js-2.4.12.tgz#eb8b568bf383dfd1867a32c3f2b74eb52bdbf23f" integrity sha512-8LzC5+bvI45BjpfXU8V5fdU2mfeKiQe1D1gIMn7XUlF3OTUrpdJpPPH4EMAnF0DsHHdSZqCdSss5qCmJKuiO3w== @@ -5074,70 +2957,11 @@ shebang-regex@^3.0.0: resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== -side-channel-list@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/side-channel-list/-/side-channel-list-1.0.0.tgz#10cb5984263115d3b7a0e336591e290a830af8ad" - integrity sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA== - dependencies: - es-errors "^1.3.0" - object-inspect "^1.13.3" - -side-channel-map@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/side-channel-map/-/side-channel-map-1.0.1.tgz#d6bb6b37902c6fef5174e5f533fab4c732a26f42" - integrity sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA== - dependencies: - call-bound "^1.0.2" - es-errors "^1.3.0" - get-intrinsic "^1.2.5" - object-inspect "^1.13.3" - -side-channel-weakmap@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz#11dda19d5368e40ce9ec2bdc1fb0ecbc0790ecea" - integrity sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A== - dependencies: - call-bound "^1.0.2" - es-errors "^1.3.0" - get-intrinsic "^1.2.5" - object-inspect "^1.13.3" - side-channel-map "^1.0.1" - -side-channel@^1.0.6: - version "1.1.0" - resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.1.0.tgz#c3fcff9c4da932784873335ec9765fa94ff66bc9" - integrity sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw== - dependencies: - es-errors "^1.3.0" - object-inspect "^1.13.3" - side-channel-list "^1.0.0" - side-channel-map "^1.0.1" - side-channel-weakmap "^1.0.2" - -signal-exit@^3.0.2, signal-exit@^3.0.3: +signal-exit@^3.0.3, signal-exit@^3.0.7: version "3.0.7" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== -signal-exit@^4.0.1: - version "4.1.0" - resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-4.1.0.tgz#952188c1cbd546070e2dd20d0f41c0ae0530cb04" - integrity sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw== - -simple-concat@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/simple-concat/-/simple-concat-1.0.1.tgz#f46976082ba35c2263f1c8ab5edfe26c41c9552f" - integrity sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q== - -simple-get@^2.7.0: - version "2.8.2" - resolved "https://registry.yarnpkg.com/simple-get/-/simple-get-2.8.2.tgz#5708fb0919d440657326cd5fe7d2599d07705019" - integrity sha512-Ijd/rV5o+mSBBs4F/x9oDPtTx9Zb6X9brmnXvMW4J7IR15ngi9q5xxqWBKU744jTZiaXtxaPL7uHG6vtN8kUkw== - dependencies: - decompress-response "^3.3.0" - once "^1.3.1" - simple-concat "^1.0.0" - sisteransi@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-1.0.5.tgz#134d681297756437cc05ca01370d3a7a571075ed" @@ -5148,49 +2972,24 @@ slash@^3.0.0: resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== -slide@^1.1.5: - version "1.1.6" - resolved "https://registry.yarnpkg.com/slide/-/slide-1.1.6.tgz#56eb027d65b4d2dce6cb2e2d32c4d4afc9e1d707" - integrity sha512-NwrtjCg+lZoqhFU8fOwl4ay2ei8PaqCBOUV3/ektPY9trO1yQ1oXEfmHAhKArUVUr/hOHvy5f6AdP17dCM0zMw== - -source-map-support@^0.5.6: - version "0.5.21" - resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.21.tgz#04fe7c7f9e1ed2d662233c28cb2b35b9f63f6e4f" - integrity sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w== +source-map-support@0.5.13: + version "0.5.13" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.13.tgz#31b24a9c2e73c2de85066c0feb7d44767ed52932" + integrity sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w== dependencies: buffer-from "^1.0.0" source-map "^0.6.0" -source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.1: +source-map@^0.6.0, source-map@^0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== -source-map@^0.7.3: - version "0.7.6" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.6.tgz#a3658ab87e5b6429c8a1f3ba0083d4c61ca3ef02" - integrity sha512-i5uvt8C3ikiWeNZSVZNWcfZPItFQOsYTUAOkcUPGd8DqDy1uOUikjt5dG+uRlwyvR108Fb9DOd4GvXfT0N2/uQ== - sprintf-js@~1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" integrity sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g== -sshpk@^1.7.0: - version "1.18.0" - resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.18.0.tgz#1663e55cddf4d688b86a46b77f0d5fe363aba028" - integrity sha512-2p2KJZTSqQ/I3+HX42EpYOa2l3f8Erv8MWKsy2I9uf4wA7yFIkXRffYdsx86y6z4vHtV8u7g+pPlr8/4ouAxsQ== - dependencies: - asn1 "~0.2.3" - assert-plus "^1.0.0" - bcrypt-pbkdf "^1.0.0" - dashdash "^1.12.0" - ecc-jsbn "~0.1.1" - getpass "^0.1.1" - jsbn "~0.1.0" - safer-buffer "^2.0.2" - tweetnacl "~0.14.0" - stack-utils@^2.0.3: version "2.0.6" resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-2.0.6.tgz#aaf0748169c02fc33c8232abccf933f54a1cc34f" @@ -5198,24 +2997,6 @@ stack-utils@^2.0.3: dependencies: escape-string-regexp "^2.0.0" -statuses@2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/statuses/-/statuses-2.0.1.tgz#55cb000ccf1d48728bd23c685a063998cf1a1b63" - integrity sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ== - -stream-browserify@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/stream-browserify/-/stream-browserify-3.0.0.tgz#22b0a2850cdf6503e73085da1fc7b7d0c2122f2f" - integrity sha512-H73RAHsVBapbim0tU2JwwOiXUj+fikfiaoYAKHF3VJfA0pe2BCzkhAHBlLG6REzE+2WNZcxOXjK7lkso+9euLA== - dependencies: - inherits "~2.0.4" - readable-stream "^3.5.0" - -strict-uri-encode@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz#279b225df1d582b1f54e65addd4352e18faa0713" - integrity sha512-R3f198pcvnB+5IpnBlRkphuE9n46WyVl8I39W/ZUTZLz4nqSP/oLYUrcnJrw462Ds8he4YKMov2efsTIw1BDGQ== - string-length@^4.0.1: version "4.0.2" resolved "https://registry.yarnpkg.com/string-length/-/string-length-4.0.2.tgz#a8a8dc7bd5c1a82b9b3c8b87e125f66871b6e57a" @@ -5224,7 +3005,7 @@ string-length@^4.0.1: char-regex "^1.0.2" strip-ansi "^6.0.0" -"string-width-cjs@npm:string-width@^4.2.0": +string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -5233,24 +3014,6 @@ string-length@^4.0.1: is-fullwidth-code-point "^3.0.0" strip-ansi "^6.0.1" -string-width@^4.1.0, string-width@^4.2.0: - version "4.2.3" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" - integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.1" - -string-width@^5.0.1, string-width@^5.1.2: - version "5.1.2" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-5.1.2.tgz#14f8daec6d81e7221d2a357e668cab73bdbca794" - integrity sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA== - dependencies: - eastasianwidth "^0.2.0" - emoji-regex "^9.2.2" - strip-ansi "^7.0.1" - string_decoder@^1.1.1: version "1.3.0" resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" @@ -5265,13 +3028,6 @@ string_decoder@~1.1.1: dependencies: safe-buffer "~5.1.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" - integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== - dependencies: - ansi-regex "^5.0.1" - strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" @@ -5279,13 +3035,6 @@ strip-ansi@^6.0.0, strip-ansi@^6.0.1: dependencies: ansi-regex "^5.0.1" -strip-ansi@^7.0.1: - version "7.1.0" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45" - integrity sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ== - dependencies: - ansi-regex "^6.0.1" - strip-bom@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-4.0.0.tgz#9c3505c1db45bcedca3d9cf7a16f5c5aa3901878" @@ -5308,7 +3057,7 @@ strip-json-comments@^3.1.1: resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== -supports-color@^7.0.0, supports-color@^7.1.0: +supports-color@^7.1.0: version "7.2.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== @@ -5322,94 +3071,44 @@ supports-color@^8.0.0: dependencies: has-flag "^4.0.0" -supports-hyperlinks@^2.0.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/supports-hyperlinks/-/supports-hyperlinks-2.3.0.tgz#3943544347c1ff90b15effb03fc14ae45ec10624" - integrity sha512-RpsAZlpWcDwOPQA22aCH4J0t7L8JmAvsCxfOSEwm7cQs3LshN36QaTkwd70DnBOXDWGssw2eUoc8CaRWT0XunA== - dependencies: - has-flag "^4.0.0" - supports-color "^7.0.0" - supports-preserve-symlinks-flag@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== -swarm-js@^0.1.40: - version "0.1.42" - resolved "https://registry.yarnpkg.com/swarm-js/-/swarm-js-0.1.42.tgz#497995c62df6696f6e22372f457120e43e727979" - integrity sha512-BV7c/dVlA3R6ya1lMlSSNPLYrntt0LUq4YMgy3iwpCIc6rZnS5W2wUoctarZ5pXlpKtxDDf9hNziEkcfrxdhqQ== - dependencies: - bluebird "^3.5.0" - buffer "^5.0.5" - eth-lib "^0.1.26" - fs-extra "^4.0.2" - got "^11.8.5" - mime-types "^2.1.16" - mkdirp-promise "^5.0.1" - mock-fs "^4.1.0" - setimmediate "^1.0.5" - tar "^4.0.2" - xhr-request "^1.0.1" - -symbol-tree@^3.2.4: - version "3.2.4" - resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2" - integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw== - -syscoinjs-lib@^1.0.242: - version "1.0.242" - resolved "https://registry.yarnpkg.com/syscoinjs-lib/-/syscoinjs-lib-1.0.242.tgz#aa49db28b037c5b0ee2a58ab1713ef26fb684586" - integrity sha512-AvTRcJdftG0zrGfiF9OoqbbJF27GzZyqjZQH1asSSfsmBrq2SbRo5U/x2SlA6QUWcsFM5W1sLunYN4PwshwHKg== - dependencies: - "@trezor/utxo-lib" "^1.0.7" - axios "^0.21.1" - bip84 "^0.2.7" +syscoinjs-lib@^1.0.275: + version "1.0.275" + resolved "https://registry.yarnpkg.com/syscoinjs-lib/-/syscoinjs-lib-1.0.275.tgz#e70379458953b55e82b4656bdfad4bef7ff6976a" + integrity sha512-el+6wWDxVObR/f7+Q1aZTgg7goUEEQTfNYoF+CSMvv/VZKd8I2qqImb4LV1opkIPXTwydRBhaFpM7wE+93J8XA== + dependencies: + "@bitcoinerlab/secp256k1" "^1.2.0" + axios "^1.18.1" + bip32 "^5.0.1" + bip39 "^3.1.2" bitcoin-ops "^1.4.1" - bitcoinjs-lib "^5.2.0" - bn.js "^5.1.3" - crypto-js "^4.0.0" + bitcoinjs-lib "^7.0.5" + bn.js "^5.2.4" + bs58 "^6.0.0" + ecpair "^3.0.1" eth-object "https://github.com/syscoin/eth-object.git" eth-proof "^2.1.6" - node-localstorage "^2.1.6" - syscointx-js "^1.0.118" - trezor-connect "^8.1.29" - varuint-bitcoin "^1.1.2" - web3 "^1.4.0" + ethers "^6.17.0" + syscointx-js "^1.0.128" + varuint-bitcoin "^2.0.0" -syscointx-js@^1.0.118: - version "1.0.118" - resolved "https://registry.yarnpkg.com/syscointx-js/-/syscointx-js-1.0.118.tgz#ac66a27927e0583375e99a5bfe8a2bade8447ba4" - integrity sha512-d2sX2JtZ44LXDViwovuhM7MJbHjVI/ufUdoxnUT2NdtxA8GNclCa3fv85SPWn0oKogRCmjS/BLJmSDz86E8TZg== +syscointx-js@^1.0.128: + version "1.0.128" + resolved "https://registry.npmjs.org/syscointx-js/-/syscointx-js-1.0.128.tgz#60795c81430eacafe1bbc3233d69c8e8baa75ef0" + integrity sha512-43dgrnCgRCWcM6PIMU7mvV9t2thjLhtm9yMqmvZvMPWuqRGbWG7yxC6Ix+bsvd/NDIFri26npR5xPdRlXPSO9g== dependencies: + "@bitcoinerlab/secp256k1" "^1.2.0" bitcoin-ops "^1.4.1" - bitcoinjs-lib "^5.2.0" - bn.js "^5.1.3" - coinselectsyscoin "^1.1.8" - secp256k1 "^3.8.0" + bitcoinjs-lib "^7.0.1" + bn.js "^5.2.4" + coinselectsyscoin "^1.1.12" + ecpair "^3.0.1" typeforce "^1.18.0" - varuint-bitcoin "^1.1.2" - -tar@^4.0.2: - version "4.4.19" - resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.19.tgz#2e4d7263df26f2b914dee10c825ab132123742f3" - integrity sha512-a20gEsvHnWe0ygBY8JbxoM4w3SJdhc7ZAuxkLqh+nvNQN2IOt0B5lLgM490X5Hl8FF0dl0tOf2ewFYAlIFgzVA== - dependencies: - chownr "^1.1.4" - fs-minipass "^1.2.7" - minipass "^2.9.0" - minizlib "^1.3.3" - mkdirp "^0.5.5" - safe-buffer "^5.2.1" - yallist "^3.1.1" - -terminal-link@^2.0.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/terminal-link/-/terminal-link-2.1.1.tgz#14a64a27ab3c0df933ea546fba55f2d078edc994" - integrity sha512-un0FmiRUQNr5PJqy9kP7c40F5BOfpGlYTrxonDChEZB7pzZxRNp/bt+ymiy9/npwXya9KH99nJ/GXFIiUkYGFQ== - dependencies: - ansi-escapes "^4.2.1" - supports-hyperlinks "^2.0.0" + varuint-bitcoin "^2.0.0" test-exclude@^6.0.0: version "6.0.0" @@ -5420,36 +3119,15 @@ test-exclude@^6.0.0: glob "^7.1.4" minimatch "^3.0.4" -throat@^6.0.1: - version "6.0.2" - resolved "https://registry.yarnpkg.com/throat/-/throat-6.0.2.tgz#51a3fbb5e11ae72e2cf74861ed5c8020f89f29fe" - integrity sha512-WKexMoJj3vEuK0yFEapj8y64V0A6xcuPuK9Gt1d0R+dzCSJc0lHqQytAbSB4cDAK0dWh4T0E2ETkoLE2WZ41OQ== - -timed-out@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/timed-out/-/timed-out-4.0.1.tgz#f32eacac5a175bea25d7fab565ab3ed8741ef56f" - integrity sha512-G7r3AhovYtr5YKOWQkta8RKAPb+J9IsO4uVmzjl8AZwfhs8UcUwTiD6gcJYSgOtzyjvQKrKYn41syHbUWMkafA== - -tiny-secp256k1@^1.1.1, tiny-secp256k1@^1.1.3, tiny-secp256k1@^1.1.6: - version "1.1.7" - resolved "https://registry.yarnpkg.com/tiny-secp256k1/-/tiny-secp256k1-1.1.7.tgz#0c1b6b9d2d93404f9093dc7e287b0aa834480573" - integrity sha512-eb+F6NabSnjbLwNoC+2o5ItbmP1kg7HliWue71JgLegQt6A5mTN8YbvTLCazdlg6e5SV6A+r8OGvZYskdlmhqQ== - dependencies: - bindings "^1.3.0" - bn.js "^4.11.8" - create-hmac "^1.1.7" - elliptic "^6.4.0" - nan "^2.13.2" - tmpl@1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.5.tgz#8683e0b902bb9c20c4f726e3c0b69f36518c07cc" integrity sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw== -to-buffer@^1.2.0: - version "1.2.1" - resolved "https://registry.yarnpkg.com/to-buffer/-/to-buffer-1.2.1.tgz#2ce650cdb262e9112a18e65dc29dcb513c8155e0" - integrity sha512-tB82LpAIWjhLYbqjx3X4zEeHN6M8CiuOEy2JY8SEQVdYRe3CCHOFaqrBW1doLDrfpWhplcW7BL+bO3/6S3pcDQ== +to-buffer@^1.2.0, to-buffer@^1.2.1, to-buffer@^1.2.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/to-buffer/-/to-buffer-1.2.2.tgz#ffe59ef7522ada0a2d1cb5dfe03bb8abc3cdc133" + integrity sha512-db0E3UJjcFhpDhAF4tLo03oli3pwl3dbnzXOUIlRKrp+ldk/VUxzpWYZENsw2SZiuBjHAk7DfB0VU7NKdpb6sw== dependencies: isarray "^2.0.5" safe-buffer "^5.2.1" @@ -5462,61 +3140,10 @@ to-regex-range@^5.0.1: dependencies: is-number "^7.0.0" -toidentifier@1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.1.tgz#3be34321a88a820ed1bd80dfaa33e479fbb8dd35" - integrity sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA== - -tough-cookie@^4.0.0: - version "4.1.4" - resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-4.1.4.tgz#945f1461b45b5a8c76821c33ea49c3ac192c1b36" - integrity sha512-Loo5UUvLD9ScZ6jh8beX1T6sO1w2/MpCRpEP7V280GKMVUQ0Jzar2U3UJPsrdbziLEMMhu3Ujnq//rhiFuIeag== - dependencies: - psl "^1.1.33" - punycode "^2.1.1" - universalify "^0.2.0" - url-parse "^1.5.3" - -tough-cookie@~2.5.0: - version "2.5.0" - resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.5.0.tgz#cd9fb2a0aa1d5a12b473bd9fb96fa3dcff65ade2" - integrity sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g== - dependencies: - psl "^1.1.28" - punycode "^2.1.1" - -tr46@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/tr46/-/tr46-2.1.0.tgz#fa87aa81ca5d5941da8cbf1f9b749dc969a4e240" - integrity sha512-15Ih7phfcdP5YxqiB+iDtLoaTz4Nd35+IiAv0kQ5FNKHzXgdWqPoTIqEDDJmXceQt4JZk6lVPT8lnDlPpGDppw== - dependencies: - punycode "^2.1.1" - -tr46@~0.0.3: - version "0.0.3" - resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" - integrity sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw== - -trezor-connect@^8.1.29: - version "8.2.12" - resolved "https://registry.yarnpkg.com/trezor-connect/-/trezor-connect-8.2.12.tgz#f042a9ec001148f5198c59c51943c9a94ed604c1" - integrity sha512-rk6Qeu53H8+7rgt4kCbNNZqCGURvTe/Tfy38MZHiLkYbeg22XIkCbdJ1JW7CpCUpCWLfg4pRZXEGYoHc3CPpeg== - dependencies: - "@babel/runtime" "^7.15.4" - cross-fetch "^3.1.5" - events "^3.3.0" - -tunnel-agent@^0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" - integrity sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w== - dependencies: - safe-buffer "^5.0.1" - -tweetnacl@^0.14.3, tweetnacl@~0.14.0: - version "0.14.5" - resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" - integrity sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA== +tslib@2.7.0: + version "2.7.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.7.0.tgz#d9b40c5c40ab59e8738f297df3087bf1a2690c01" + integrity sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA== type-detect@4.0.8: version "4.0.8" @@ -5528,24 +3155,6 @@ type-fest@^0.21.3: resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.21.3.tgz#d260a24b0198436e133fa26a524a6d65fa3b2e37" integrity sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w== -type-fest@^1.2.1: - version "1.4.0" - resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-1.4.0.tgz#e9fb813fe3bf1744ec359d55d1affefa76f14be1" - integrity sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA== - -type-is@~1.6.18: - version "1.6.18" - resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.18.tgz#4e552cd05df09467dcbc4ef739de89f2cf37c131" - integrity sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g== - dependencies: - media-typer "0.3.0" - mime-types "~2.1.24" - -type@^2.7.2: - version "2.7.3" - resolved "https://registry.yarnpkg.com/type/-/type-2.7.3.tgz#436981652129285cc3ba94f392886c2637ea0486" - integrity sha512-8j+1QmAbPvLZow5Qpi6NCaN8FB60p/6x8/vfNqOk/hC+HuvFZhL4+WfekuhQLiqFZXOgQdrs3B+XxEmCc6b3FQ== - typed-array-buffer@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/typed-array-buffer/-/typed-array-buffer-1.0.3.tgz#a72395450a4869ec033fd549371b47af3a2ee536" @@ -5555,468 +3164,101 @@ typed-array-buffer@^1.0.3: es-errors "^1.3.0" is-typed-array "^1.1.14" -typedarray-to-buffer@^3.1.5: - version "3.1.5" - resolved "https://registry.yarnpkg.com/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz#a97ee7a9ff42691b9f783ff1bc5112fe3fca9080" - integrity sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q== - dependencies: - is-typedarray "^1.0.0" - -typeforce@^1.11.3, typeforce@^1.11.5, typeforce@^1.18.0: +typeforce@^1.18.0: version "1.18.0" resolved "https://registry.yarnpkg.com/typeforce/-/typeforce-1.18.0.tgz#d7416a2c5845e085034d70fcc5b6cc4a90edbfdc" integrity sha512-7uc1O8h1M1g0rArakJdf0uLRSSgFcYexrVoKo+bzJd32gd4gDy2L/Z+8/FjPnU9ydY3pEnVPtr9FyscYY60K1g== -ultron@~1.1.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/ultron/-/ultron-1.1.1.tgz#9fe1536a10a664a65266a1e3ccf85fd36302bc9c" - integrity sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og== - -undici-types@~7.8.0: - version "7.8.0" - resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-7.8.0.tgz#de00b85b710c54122e44fbfd911f8d70174cd294" - integrity sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw== - -universalify@^0.1.0: - version "0.1.2" - resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66" - integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg== - -universalify@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.2.0.tgz#6451760566fa857534745ab1dde952d1b1761be0" - integrity sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg== - -unpipe@1.0.0, unpipe@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec" - integrity sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ== - -update-browserslist-db@^1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.1.3.tgz#348377dd245216f9e7060ff50b15a1b740b75420" - integrity sha512-UxhIZQ+QInVdunkDAaiazvvT/+fXL5Osr0JZlJulepYu6Jd7qJtDZjlur0emRlT71EN3ScPoE7gvsuIKKNavKw== +typescript@^5.3.3: + version "5.9.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.9.3.tgz#5b4f59e15310ab17a216f5d6cf53ee476ede670f" + integrity sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw== + +uint8array-tools@^0.0.10: + version "0.0.10" + resolved "https://registry.yarnpkg.com/uint8array-tools/-/uint8array-tools-0.0.10.tgz#acfcf118e072df79175c5f73f86af917885d095a" + integrity sha512-sSbrZqlr04w4p8KKpHw0ME/R4JzQaadum+BWhMlk2M7LrDyXWTfJOco3d1jNMdQNxgk5DDm88R3IWYH0nR+tzQ== + +uint8array-tools@^0.0.8: + version "0.0.8" + resolved "https://registry.yarnpkg.com/uint8array-tools/-/uint8array-tools-0.0.8.tgz#712bab001f8347bd782f45bc47c76ffff32d1e0b" + integrity sha512-xS6+s8e0Xbx++5/0L+yyexukU7pz//Yg6IHg3BKhXotg1JcYtgxVcUctQ0HxLByiJzpAkNFawz1Nz5Xadzo82g== + +uint8array-tools@^0.0.9: + version "0.0.9" + resolved "https://registry.yarnpkg.com/uint8array-tools/-/uint8array-tools-0.0.9.tgz#e29e6d05f3472273db1b0e370ac1d91e4a0a4e6f" + integrity sha512-9vqDWmoSXOoi+K14zNaf6LBV51Q8MayF0/IiQs3GlygIKUYtog603e6virExkjjFosfJUBI4LhbQK1iq8IG11A== + +undici-types@~6.19.2: + version "6.19.8" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.19.8.tgz#35111c9d1437ab83a7cdc0abae2f26d88eda0a02" + integrity sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw== + +undici-types@~8.3.0: + version "8.3.0" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-8.3.0.tgz#44e9fc9f3244648cdea35e4f9bb2d681e9410809" + integrity sha512-j375ScV60dom+YkPFIfTLcOiPxkN/buHz5GobjLhixFuANaNs3C9l4GmrWqejgXWJ7BbJcFYpTEUkS1Ge8bpZQ== + +update-browserslist-db@^1.2.3: + version "1.2.3" + resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.2.3.tgz#64d76db58713136acbeb4c49114366cc6cc2e80d" + integrity sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w== dependencies: escalade "^3.2.0" picocolors "^1.1.1" -uri-js@^4.2.2: - version "4.4.1" - resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e" - integrity sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg== - dependencies: - punycode "^2.1.0" - -url-parse@^1.5.3: - version "1.5.10" - resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.5.10.tgz#9d3c2f736c1d75dd3bd2be507dcc111f1e2ea9c1" - integrity sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ== - dependencies: - querystringify "^2.1.1" - requires-port "^1.0.0" - -url-set-query@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/url-set-query/-/url-set-query-1.0.0.tgz#016e8cfd7c20ee05cafe7795e892bd0702faa339" - integrity sha512-3AChu4NiXquPfeckE5R5cGdiHCMWJx1dwCWOmWIL4KHAziJNOFIYJlpGFeKDvwLPHovZRCxK3cYlwzqI9Vp+Gg== - -utf-8-validate@^5.0.2: - version "5.0.10" - resolved "https://registry.yarnpkg.com/utf-8-validate/-/utf-8-validate-5.0.10.tgz#d7d10ea39318171ca982718b6b96a8d2442571a2" - integrity sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ== - dependencies: - node-gyp-build "^4.3.0" - -utf8@3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/utf8/-/utf8-3.0.0.tgz#f052eed1364d696e769ef058b183df88c87f69d1" - integrity sha512-E8VjFIQ/TyQgp+TZfS6l8yp/xWppSAHzidGiRrqe4bK4XP9pTRyKFgGJpO3SN7zdX4DeomTrwaseCHovfpFcqQ== - util-deprecate@^1.0.1, util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw== -util@^0.12.5: - version "0.12.5" - resolved "https://registry.yarnpkg.com/util/-/util-0.12.5.tgz#5f17a6059b73db61a875668781a1c2b136bd6fbc" - integrity sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA== - dependencies: - inherits "^2.0.3" - is-arguments "^1.0.4" - is-generator-function "^1.0.7" - is-typed-array "^1.1.3" - which-typed-array "^1.1.2" - -utils-merge@1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713" - integrity sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA== - -uuid@^3.3.2: - version "3.4.0" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" - integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== - -uuid@^9.0.0: - version "9.0.1" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-9.0.1.tgz#e188d4c8853cc722220392c424cd637f32293f30" - integrity sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA== - -v8-to-istanbul@^8.1.0: - version "8.1.1" - resolved "https://registry.yarnpkg.com/v8-to-istanbul/-/v8-to-istanbul-8.1.1.tgz#77b752fd3975e31bbcef938f85e9bd1c7a8d60ed" - integrity sha512-FGtKtv3xIpR6BYhvgH8MI/y78oT7d8Au3ww4QIxymrCtZEh5b8gCw2siywE+puhEmuWKDtmfrvF5UlB298ut3w== +v8-to-istanbul@^9.0.1: + version "9.3.0" + resolved "https://registry.yarnpkg.com/v8-to-istanbul/-/v8-to-istanbul-9.3.0.tgz#b9572abfa62bd556c16d75fdebc1a411d5ff3175" + integrity sha512-kiGUalWN+rgBJ/1OHZsBtU4rXZOfj/7rKQxULKlIzwzQSvMJUUNgPwJEEh7gU6xEVxC0ahoOBvN2YI8GH6FNgA== dependencies: + "@jridgewell/trace-mapping" "^0.3.12" "@types/istanbul-lib-coverage" "^2.0.1" - convert-source-map "^1.6.0" - source-map "^0.7.3" - -varint@^5.0.0: - version "5.0.2" - resolved "https://registry.yarnpkg.com/varint/-/varint-5.0.2.tgz#5b47f8a947eb668b848e034dcfa87d0ff8a7f7a4" - integrity sha512-lKxKYG6H03yCZUpAGOPOsMcGxd1RHCu1iKvEHYDPmTyq2HueGhD73ssNBqqQWfvYs04G9iUFRvmAVLW20Jw6ow== - -varuint-bitcoin@^1.0.4, varuint-bitcoin@^1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/varuint-bitcoin/-/varuint-bitcoin-1.1.2.tgz#e76c138249d06138b480d4c5b40ef53693e24e92" - integrity sha512-4EVb+w4rx+YfVM32HQX42AbbT7/1f5zwAYhIujKXKk8NQK+JfRVl3pqT3hjNn/L+RstigmGGKVwHA/P0wgITZw== - dependencies: - safe-buffer "^5.1.1" - -vary@^1, vary@~1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc" - integrity sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg== + convert-source-map "^2.0.0" -verror@1.10.0: - version "1.10.0" - resolved "https://registry.yarnpkg.com/verror/-/verror-1.10.0.tgz#3a105ca17053af55d6e270c1f8288682e18da400" - integrity sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw== - dependencies: - assert-plus "^1.0.0" - core-util-is "1.0.2" - extsprintf "^1.2.0" +valibot@^1.2.0: + version "1.4.2" + resolved "https://registry.yarnpkg.com/valibot/-/valibot-1.4.2.tgz#da857781187f170aeaf4498d463d25028615b0d6" + integrity sha512-gjdCvJ6d3RyHAneqxMYMW9QMCwYMb3jpOO0IyHZV1bnRHFBHrX3VkIILt5XYR0WhwHiH7Mty8ovuPZ/O3gamrg== -w3c-hr-time@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz#0a89cdf5cc15822df9c360543676963e0cc308cd" - integrity sha512-z8P5DvDNjKDoFIHK7q8r8lackT6l+jo/Ye3HOle7l9nICP9lf1Ci25fy9vHd0JOWewkIFzXIEig3TdKT7JQ5fQ== +varuint-bitcoin@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/varuint-bitcoin/-/varuint-bitcoin-2.0.0.tgz#59a53845a87ad18c42f184a3d325074465341523" + integrity sha512-6QZbU/rHO2ZQYpWFDALCDSRsXbAs1VOEmXAxtbtjLtKuMJ/FQ8YbhfxlaiKv5nklci0M6lZtlZyxo9Q+qNnyog== dependencies: - browser-process-hrtime "^1.0.0" + uint8array-tools "^0.0.8" -w3c-xmlserializer@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/w3c-xmlserializer/-/w3c-xmlserializer-2.0.0.tgz#3e7104a05b75146cc60f564380b7f683acf1020a" - integrity sha512-4tzD0mF8iSiMiNs30BiLO3EpfGLZUT2MSX/G+o7ZywDzliWQ3OPtTZ0PTC3B3ca1UAf4cJMHB+2Bf56EriJuRA== +varuint-bitcoin@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/varuint-bitcoin/-/varuint-bitcoin-2.0.1.tgz#bbf7e790b900f47aad5b597a501337dff7978b17" + integrity sha512-TTl5qSPJ3FzjuTHo0Ex9WUE3jTxnUsQHR38vIDhHApoVstzJK4gE20WqmTWOT5oo7ilvOSNejXt4CJrfDcqm5A== dependencies: - xml-name-validator "^3.0.0" + uint8array-tools "^0.0.10" -walker@^1.0.7: +walker@^1.0.8: version "1.0.8" resolved "https://registry.yarnpkg.com/walker/-/walker-1.0.8.tgz#bd498db477afe573dc04185f011d3ab8a8d7653f" integrity sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ== dependencies: makeerror "1.0.12" -web3-bzz@1.10.4: - version "1.10.4" - resolved "https://registry.yarnpkg.com/web3-bzz/-/web3-bzz-1.10.4.tgz#dcc787970767d9004c73d11d0eeef774ce16b880" - integrity sha512-ZZ/X4sJ0Uh2teU9lAGNS8EjveEppoHNQiKlOXAjedsrdWuaMErBPdLQjXfcrYvN6WM6Su9PMsAxf3FXXZ+HwQw== - dependencies: - "@types/node" "^12.12.6" - got "12.1.0" - swarm-js "^0.1.40" - -web3-core-helpers@1.10.4: - version "1.10.4" - resolved "https://registry.yarnpkg.com/web3-core-helpers/-/web3-core-helpers-1.10.4.tgz#bd2b4140df2016d5dd3bb2b925fc29ad8678677c" - integrity sha512-r+L5ylA17JlD1vwS8rjhWr0qg7zVoVMDvWhajWA5r5+USdh91jRUYosp19Kd1m2vE034v7Dfqe1xYRoH2zvG0g== - dependencies: - web3-eth-iban "1.10.4" - web3-utils "1.10.4" - -web3-core-method@1.10.4: - version "1.10.4" - resolved "https://registry.yarnpkg.com/web3-core-method/-/web3-core-method-1.10.4.tgz#566b52f006d3cbb13b21b72b8d2108999bf5d6bf" - integrity sha512-uZTb7flr+Xl6LaDsyTeE2L1TylokCJwTDrIVfIfnrGmnwLc6bmTWCCrm71sSrQ0hqs6vp/MKbQYIYqUN0J8WyA== - dependencies: - "@ethersproject/transactions" "^5.6.2" - web3-core-helpers "1.10.4" - web3-core-promievent "1.10.4" - web3-core-subscriptions "1.10.4" - web3-utils "1.10.4" - -web3-core-promievent@1.10.4: - version "1.10.4" - resolved "https://registry.yarnpkg.com/web3-core-promievent/-/web3-core-promievent-1.10.4.tgz#629b970b7934430b03c5033c79f3bb3893027e22" - integrity sha512-2de5WnJQ72YcIhYwV/jHLc4/cWJnznuoGTJGD29ncFQHAfwW/MItHFSVKPPA5v8AhJe+r6y4Y12EKvZKjQVBvQ== - dependencies: - eventemitter3 "4.0.4" - -web3-core-requestmanager@1.10.4: - version "1.10.4" - resolved "https://registry.yarnpkg.com/web3-core-requestmanager/-/web3-core-requestmanager-1.10.4.tgz#eb1f147e6b9df84e3a37e602162f8925bdb4bb9a" - integrity sha512-vqP6pKH8RrhT/2MoaU+DY/OsYK9h7HmEBNCdoMj+4ZwujQtw/Mq2JifjwsJ7gits7Q+HWJwx8q6WmQoVZAWugg== - dependencies: - util "^0.12.5" - web3-core-helpers "1.10.4" - web3-providers-http "1.10.4" - web3-providers-ipc "1.10.4" - web3-providers-ws "1.10.4" - -web3-core-subscriptions@1.10.4: - version "1.10.4" - resolved "https://registry.yarnpkg.com/web3-core-subscriptions/-/web3-core-subscriptions-1.10.4.tgz#2f4dcb404237e92802a563265d11a33934dc38e6" - integrity sha512-o0lSQo/N/f7/L76C0HV63+S54loXiE9fUPfHFcTtpJRQNDBVsSDdWRdePbWwR206XlsBqD5VHApck1//jEafTw== - dependencies: - eventemitter3 "4.0.4" - web3-core-helpers "1.10.4" - -web3-core@1.10.4: - version "1.10.4" - resolved "https://registry.yarnpkg.com/web3-core/-/web3-core-1.10.4.tgz#639de68b8b9871d2dc8892e0dd4e380cb1361a98" - integrity sha512-B6elffYm81MYZDTrat7aEhnhdtVE3lDBUZft16Z8awYMZYJDbnykEbJVS+l3mnA7AQTnSDr/1MjWofGDLBJPww== - dependencies: - "@types/bn.js" "^5.1.1" - "@types/node" "^12.12.6" - bignumber.js "^9.0.0" - web3-core-helpers "1.10.4" - web3-core-method "1.10.4" - web3-core-requestmanager "1.10.4" - web3-utils "1.10.4" - -web3-eth-abi@1.10.4: - version "1.10.4" - resolved "https://registry.yarnpkg.com/web3-eth-abi/-/web3-eth-abi-1.10.4.tgz#16c19d0bde0aaf8c1a56cb7743a83156d148d798" - integrity sha512-cZ0q65eJIkd/jyOlQPDjr8X4fU6CRL1eWgdLwbWEpo++MPU/2P4PFk5ZLAdye9T5Sdp+MomePPJ/gHjLMj2VfQ== - dependencies: - "@ethersproject/abi" "^5.6.3" - web3-utils "1.10.4" - -web3-eth-accounts@1.10.4: - version "1.10.4" - resolved "https://registry.yarnpkg.com/web3-eth-accounts/-/web3-eth-accounts-1.10.4.tgz#df30e85a7cd70e475f8cf52361befba408829e34" - integrity sha512-ysy5sVTg9snYS7tJjxVoQAH6DTOTkRGR8emEVCWNGLGiB9txj+qDvSeT0izjurS/g7D5xlMAgrEHLK1Vi6I3yg== - dependencies: - "@ethereumjs/common" "2.6.5" - "@ethereumjs/tx" "3.5.2" - "@ethereumjs/util" "^8.1.0" - eth-lib "0.2.8" - scrypt-js "^3.0.1" - uuid "^9.0.0" - web3-core "1.10.4" - web3-core-helpers "1.10.4" - web3-core-method "1.10.4" - web3-utils "1.10.4" - -web3-eth-contract@1.10.4: - version "1.10.4" - resolved "https://registry.yarnpkg.com/web3-eth-contract/-/web3-eth-contract-1.10.4.tgz#22d39f04e11d9ff4e726e8025a56d78e843a2c3d" - integrity sha512-Q8PfolOJ4eV9TvnTj1TGdZ4RarpSLmHnUnzVxZ/6/NiTfe4maJz99R0ISgwZkntLhLRtw0C7LRJuklzGYCNN3A== - dependencies: - "@types/bn.js" "^5.1.1" - web3-core "1.10.4" - web3-core-helpers "1.10.4" - web3-core-method "1.10.4" - web3-core-promievent "1.10.4" - web3-core-subscriptions "1.10.4" - web3-eth-abi "1.10.4" - web3-utils "1.10.4" - -web3-eth-ens@1.10.4: - version "1.10.4" - resolved "https://registry.yarnpkg.com/web3-eth-ens/-/web3-eth-ens-1.10.4.tgz#3d991adac52bc8e598f1f1b8528337fa6291004c" - integrity sha512-LLrvxuFeVooRVZ9e5T6OWKVflHPFgrVjJ/jtisRWcmI7KN/b64+D/wJzXqgmp6CNsMQcE7rpmf4CQmJCrTdsgg== - dependencies: - content-hash "^2.5.2" - eth-ens-namehash "2.0.8" - web3-core "1.10.4" - web3-core-helpers "1.10.4" - web3-core-promievent "1.10.4" - web3-eth-abi "1.10.4" - web3-eth-contract "1.10.4" - web3-utils "1.10.4" - -web3-eth-iban@1.10.4: - version "1.10.4" - resolved "https://registry.yarnpkg.com/web3-eth-iban/-/web3-eth-iban-1.10.4.tgz#bc61b4a1930d19b1df8762c606d669902558e54d" - integrity sha512-0gE5iNmOkmtBmbKH2aTodeompnNE8jEyvwFJ6s/AF6jkw9ky9Op9cqfzS56AYAbrqEFuClsqB/AoRves7LDELw== - dependencies: - bn.js "^5.2.1" - web3-utils "1.10.4" - -web3-eth-personal@1.10.4: - version "1.10.4" - resolved "https://registry.yarnpkg.com/web3-eth-personal/-/web3-eth-personal-1.10.4.tgz#e2ee920f47e84848288e03442659cdbb2c4deea2" - integrity sha512-BRa/hs6jU1hKHz+AC/YkM71RP3f0Yci1dPk4paOic53R4ZZG4MgwKRkJhgt3/GPuPliwS46f/i5A7fEGBT4F9w== - dependencies: - "@types/node" "^12.12.6" - web3-core "1.10.4" - web3-core-helpers "1.10.4" - web3-core-method "1.10.4" - web3-net "1.10.4" - web3-utils "1.10.4" - -web3-eth@1.10.4: - version "1.10.4" - resolved "https://registry.yarnpkg.com/web3-eth/-/web3-eth-1.10.4.tgz#3a908c635cb5d935bd30473e452f3bd7f2ee66a5" - integrity sha512-Sql2kYKmgt+T/cgvg7b9ce24uLS7xbFrxE4kuuor1zSCGrjhTJ5rRNG8gTJUkAJGKJc7KgnWmgW+cOfMBPUDSA== - dependencies: - web3-core "1.10.4" - web3-core-helpers "1.10.4" - web3-core-method "1.10.4" - web3-core-subscriptions "1.10.4" - web3-eth-abi "1.10.4" - web3-eth-accounts "1.10.4" - web3-eth-contract "1.10.4" - web3-eth-ens "1.10.4" - web3-eth-iban "1.10.4" - web3-eth-personal "1.10.4" - web3-net "1.10.4" - web3-utils "1.10.4" - -web3-net@1.10.4: - version "1.10.4" - resolved "https://registry.yarnpkg.com/web3-net/-/web3-net-1.10.4.tgz#20e12c60e4477d4298979d8d5d66b9abf8e66a09" - integrity sha512-mKINnhOOnZ4koA+yV2OT5s5ztVjIx7IY9a03w6s+yao/BUn+Luuty0/keNemZxTr1E8Ehvtn28vbOtW7Ids+Ow== - dependencies: - web3-core "1.10.4" - web3-core-method "1.10.4" - web3-utils "1.10.4" - -web3-providers-http@1.10.4: - version "1.10.4" - resolved "https://registry.yarnpkg.com/web3-providers-http/-/web3-providers-http-1.10.4.tgz#ca7aa58aeaf8123500c24ffe0595896319f830e8" - integrity sha512-m2P5Idc8hdiO0l60O6DSCPw0kw64Zgi0pMjbEFRmxKIck2Py57RQMu4bxvkxJwkF06SlGaEQF8rFZBmuX7aagQ== - dependencies: - abortcontroller-polyfill "^1.7.5" - cross-fetch "^4.0.0" - es6-promise "^4.2.8" - web3-core-helpers "1.10.4" - -web3-providers-ipc@1.10.4: - version "1.10.4" - resolved "https://registry.yarnpkg.com/web3-providers-ipc/-/web3-providers-ipc-1.10.4.tgz#2e03437909e4e7771d646ff05518efae44b783c3" - integrity sha512-YRF/bpQk9z3WwjT+A6FI/GmWRCASgd+gC0si7f9zbBWLXjwzYAKG73bQBaFRAHex1hl4CVcM5WUMaQXf3Opeuw== - dependencies: - oboe "2.1.5" - web3-core-helpers "1.10.4" - -web3-providers-ws@1.10.4: - version "1.10.4" - resolved "https://registry.yarnpkg.com/web3-providers-ws/-/web3-providers-ws-1.10.4.tgz#55d0c3ba36c6a79d105f02e20a707eb3978e7f82" - integrity sha512-j3FBMifyuFFmUIPVQR4pj+t5ILhAexAui0opgcpu9R5LxQrLRUZxHSnU+YO25UycSOa/NAX8A+qkqZNpcFAlxA== - dependencies: - eventemitter3 "4.0.4" - web3-core-helpers "1.10.4" - websocket "^1.0.32" - -web3-shh@1.10.4: - version "1.10.4" - resolved "https://registry.yarnpkg.com/web3-shh/-/web3-shh-1.10.4.tgz#9852d6f3d05678e31e49235a60fea10ca7a9e21d" - integrity sha512-cOH6iFFM71lCNwSQrC3niqDXagMqrdfFW85hC9PFUrAr3PUrIem8TNstTc3xna2bwZeWG6OBy99xSIhBvyIACw== - dependencies: - web3-core "1.10.4" - web3-core-method "1.10.4" - web3-core-subscriptions "1.10.4" - web3-net "1.10.4" - -web3-utils@1.10.4: - version "1.10.4" - resolved "https://registry.yarnpkg.com/web3-utils/-/web3-utils-1.10.4.tgz#0daee7d6841641655d8b3726baf33b08eda1cbec" - integrity sha512-tsu8FiKJLk2PzhDl9fXbGUWTkkVXYhtTA+SmEFkKft+9BgwLxfCRpU96sWv7ICC8zixBNd3JURVoiR3dUXgP8A== - dependencies: - "@ethereumjs/util" "^8.1.0" - bn.js "^5.2.1" - ethereum-bloom-filters "^1.0.6" - ethereum-cryptography "^2.1.2" - ethjs-unit "0.1.6" - number-to-bn "1.7.0" - randombytes "^2.1.0" - utf8 "3.0.0" - -web3@^1.4.0, web3@^1.7.1: - version "1.10.4" - resolved "https://registry.yarnpkg.com/web3/-/web3-1.10.4.tgz#5d5e59b976eaf758b060fe1a296da5fe87bdc79c" - integrity sha512-kgJvQZjkmjOEKimx/tJQsqWfRDPTTcBfYPa9XletxuHLpHcXdx67w8EFn5AW3eVxCutE9dTVHgGa9VYe8vgsEA== - dependencies: - web3-bzz "1.10.4" - web3-core "1.10.4" - web3-eth "1.10.4" - web3-eth-personal "1.10.4" - web3-net "1.10.4" - web3-shh "1.10.4" - web3-utils "1.10.4" - -webidl-conversions@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" - integrity sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ== - -webidl-conversions@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-5.0.0.tgz#ae59c8a00b121543a2acc65c0434f57b0fc11aff" - integrity sha512-VlZwKPCkYKxQgeSbH5EyngOmRp7Ww7I9rQLERETtf5ofd9pGeswWiOtogpEO850jziPRarreGxn5QIiTqpb2wA== - -webidl-conversions@^6.1.0: - version "6.1.0" - resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-6.1.0.tgz#9111b4d7ea80acd40f5270d666621afa78b69514" - integrity sha512-qBIvFLGiBpLjfwmYAaHPXsn+ho5xZnGvyGvsarywGNc8VyQJUMHJ8OBKGGrPER0okBeMDaan4mNBlgBROxuI8w== - -websocket@^1.0.32: - version "1.0.35" - resolved "https://registry.yarnpkg.com/websocket/-/websocket-1.0.35.tgz#374197207d7d4cc4c36cbf8a1bb886ee52a07885" - integrity sha512-/REy6amwPZl44DDzvRCkaI1q1bIiQB0mEFQLUrhz3z2EK91cp3n72rAjUlrTP0zV22HJIUOVHQGPxhFRjxjt+Q== - dependencies: - bufferutil "^4.0.1" - debug "^2.2.0" - es5-ext "^0.10.63" - typedarray-to-buffer "^3.1.5" - utf-8-validate "^5.0.2" - yaeti "^0.0.6" - -whatwg-encoding@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/whatwg-encoding/-/whatwg-encoding-1.0.5.tgz#5abacf777c32166a51d085d6b4f3e7d27113ddb0" - integrity sha512-b5lim54JOPN9HtzvK9HFXvBma/rnfFeqsic0hSpjtDbVxR3dJKLc+KB4V6GgiGOvl7CY/KNh8rxSo9DKQrnUEw== - dependencies: - iconv-lite "0.4.24" - whatwg-fetch@>=0.10.0: version "3.6.20" resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-3.6.20.tgz#580ce6d791facec91d37c72890995a0b48d31c70" integrity sha512-EqhiFU6daOA8kpjOWTL0olhVOF3i7OrFzSYiGsEMB8GcXS+RrzauAERX65xMeNWVqxA6HXH2m69Z9LaKKdisfg== -whatwg-mimetype@^2.3.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz#3d4b1e0312d2079879f826aff18dbeeca5960fbf" - integrity sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g== - -whatwg-url@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d" - integrity sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw== - dependencies: - tr46 "~0.0.3" - webidl-conversions "^3.0.0" - -whatwg-url@^8.0.0, whatwg-url@^8.5.0: - version "8.7.0" - resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-8.7.0.tgz#656a78e510ff8f3937bc0bcbe9f5c0ac35941b77" - integrity sha512-gAojqb/m9Q8a5IV96E3fHJM70AzCkgt4uXYX2O7EmuyOnLrViCQlsEBmF9UQIu3/aeAIp2U17rtbpZWNntQqdg== - dependencies: - lodash "^4.7.0" - tr46 "^2.1.0" - webidl-conversions "^6.1.0" - -which-typed-array@^1.1.16, which-typed-array@^1.1.2: - version "1.1.19" - resolved "https://registry.yarnpkg.com/which-typed-array/-/which-typed-array-1.1.19.tgz#df03842e870b6b88e117524a4b364b6fc689f956" - integrity sha512-rEvr90Bck4WZt9HHFC4DJMsjvu7x+r6bImz0/BrbWb7A2djJ8hnZMrWnHo9F8ssv0OMErasDhftrfROTyqSDrw== +which-typed-array@^1.1.16: + version "1.1.22" + resolved "https://registry.yarnpkg.com/which-typed-array/-/which-typed-array-1.1.22.tgz#8f3cc78aefb40b437346dd40a1dbfa5d1da43fe9" + integrity sha512-fvO4ExWMFsqyhG3AiPAObMuY1lxaqgYcxbc49CNdWDDECOJNgQyvsOWVwbZc+qf3rzRtxojBK+CMEv0Ld5CYpw== dependencies: available-typed-arrays "^1.0.7" - call-bind "^1.0.8" + call-bind "^1.0.9" call-bound "^1.0.4" for-each "^0.3.5" get-proto "^1.0.1" @@ -6030,21 +3272,12 @@ which@^2.0.1: dependencies: isexe "^2.0.0" -wif@^2.0.1, wif@^2.0.6: - version "2.0.6" - resolved "https://registry.yarnpkg.com/wif/-/wif-2.0.6.tgz#08d3f52056c66679299726fade0d432ae74b4704" - integrity sha512-HIanZn1zmduSF+BQhkE+YXIbEiH0xPr1012QbFEGB0xsKqJii0/SqJjyn8dFv6y36kOznMgMB+LGcbZTJ1xACQ== - dependencies: - bs58check "<3.0.0" - -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" - integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== +wif@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/wif/-/wif-5.0.0.tgz#445e44b8f62e155144d1c970c01ca2ba3979cc3f" + integrity sha512-iFzrC/9ne740qFbNjTZ2FciSRJlHIXoxqk/Y5EnE08QOXu1WjJyCCswwDTYbohAOEnlCtLaAAQBhyaLRFh2hMA== dependencies: - ansi-styles "^4.0.0" - string-width "^4.1.0" - strip-ansi "^6.0.0" + bs58check "^4.0.0" wrap-ansi@^7.0.0: version "7.0.0" @@ -6055,97 +3288,23 @@ wrap-ansi@^7.0.0: string-width "^4.1.0" strip-ansi "^6.0.0" -wrap-ansi@^8.1.0: - version "8.1.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214" - integrity sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ== - dependencies: - ansi-styles "^6.1.0" - string-width "^5.0.1" - strip-ansi "^7.0.1" - wrappy@1: version "1.0.2" resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== -write-file-atomic@^1.1.4: - version "1.3.4" - resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-1.3.4.tgz#f807a4f0b1d9e913ae7a48112e6cc3af1991b45f" - integrity sha512-SdrHoC/yVBPpV0Xq/mUZQIpW2sWXAShb/V4pomcJXh92RuaO+f3UTWItiR3Px+pLnV2PvC2/bfn5cwr5X6Vfxw== - dependencies: - graceful-fs "^4.1.11" - imurmurhash "^0.1.4" - slide "^1.1.5" - -write-file-atomic@^3.0.0: - version "3.0.3" - resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-3.0.3.tgz#56bd5c5a5c70481cd19c571bd39ab965a5de56e8" - integrity sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q== +write-file-atomic@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-4.0.2.tgz#a9df01ae5b77858a027fd2e80768ee433555fcfd" + integrity sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg== dependencies: imurmurhash "^0.1.4" - is-typedarray "^1.0.0" - signal-exit "^3.0.2" - typedarray-to-buffer "^3.1.5" - -ws@8.18.0: - version "8.18.0" - resolved "https://registry.yarnpkg.com/ws/-/ws-8.18.0.tgz#0d7505a6eafe2b0e712d232b42279f53bc289bbc" - integrity sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw== - -ws@^3.0.0: - version "3.3.3" - resolved "https://registry.yarnpkg.com/ws/-/ws-3.3.3.tgz#f1cf84fe2d5e901ebce94efaece785f187a228f2" - integrity sha512-nnWLa/NwZSt4KQJu51MYlCcSQ5g7INpOrOMt4XV8j4dqTXdmlUmSHQ8/oLC069ckre0fRsgfvsKwbTdtKLCDkA== - dependencies: - async-limiter "~1.0.0" - safe-buffer "~5.1.0" - ultron "~1.1.0" - -ws@^7.4.6: - version "7.5.10" - resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.10.tgz#58b5c20dc281633f6c19113f39b349bd8bd558d9" - integrity sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ== - -xhr-request-promise@^0.1.2: - version "0.1.3" - resolved "https://registry.yarnpkg.com/xhr-request-promise/-/xhr-request-promise-0.1.3.tgz#2d5f4b16d8c6c893be97f1a62b0ed4cf3ca5f96c" - integrity sha512-YUBytBsuwgitWtdRzXDDkWAXzhdGB8bYm0sSzMPZT7Z2MBjMSTHFsyCT1yCRATY+XC69DUrQraRAEgcoCRaIPg== - dependencies: - xhr-request "^1.1.0" - -xhr-request@^1.0.1, xhr-request@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/xhr-request/-/xhr-request-1.1.0.tgz#f4a7c1868b9f198723444d82dcae317643f2e2ed" - integrity sha512-Y7qzEaR3FDtL3fP30k9wO/e+FBnBByZeybKOhASsGP30NIkRAAkKD/sCnLvgEfAIEC1rcmK7YG8f4oEnIrrWzA== - dependencies: - buffer-to-arraybuffer "^0.0.5" - object-assign "^4.1.1" - query-string "^5.0.1" - simple-get "^2.7.0" - timed-out "^4.0.1" - url-set-query "^1.0.0" - xhr "^2.0.4" - -xhr@^2.0.4, xhr@^2.3.3: - version "2.6.0" - resolved "https://registry.yarnpkg.com/xhr/-/xhr-2.6.0.tgz#b69d4395e792b4173d6b7df077f0fc5e4e2b249d" - integrity sha512-/eCGLb5rxjx5e3mF1A7s+pLlR6CGyqWN91fv1JgER5mVWg1MZmlhBvy9kjcsOdRk8RrIujotWyJamfyrp+WIcA== - dependencies: - global "~4.4.0" - is-function "^1.0.1" - parse-headers "^2.0.0" - xtend "^4.0.0" + signal-exit "^3.0.7" -xml-name-validator@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/xml-name-validator/-/xml-name-validator-3.0.0.tgz#6ae73e06de4d8c6e47f9fb181f78d648ad457c6a" - integrity sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw== - -xmlchars@^2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/xmlchars/-/xmlchars-2.2.0.tgz#060fe1bcb7f9c76fe2a17db86a9bc3ab894210cb" - integrity sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw== +ws@8.21.0: + version "8.21.0" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.21.0.tgz#012e413fc07429945121b0c153158c4343086951" + integrity sha512-Vsp28b7DRcimFQvrqu2Wek3z1iYxDCWqHYB8Qsnk/S4RfaCQzPGPyBNuVjJV3cd6UiKtUtp6sNM77gWvzcCH+g== xtend@^4.0.0, xtend@^4.0.1, xtend@~4.0.0: version "4.0.2" @@ -6157,30 +3316,30 @@ y18n@^5.0.5: resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55" integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA== -yaeti@^0.0.6: - version "0.0.6" - resolved "https://registry.yarnpkg.com/yaeti/-/yaeti-0.0.6.tgz#f26f484d72684cf42bedfb76970aa1608fbf9577" - integrity sha512-MvQa//+KcZCUkBTIC9blM+CU9J2GzuTytsOUwf2lidtvkx/6gnEp1QvJv34t9vdjhFmha/mUiNDbN0D0mJWdug== - -yallist@^3.0.0, yallist@^3.0.2, yallist@^3.1.1: +yallist@^3.0.2: version "3.1.1" resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd" integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g== -yargs-parser@^20.2.2: - version "20.2.9" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.9.tgz#2eb7dc3b0289718fc295f362753845c41a0c94ee" - integrity sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w== +yargs-parser@^21.1.1: + version "21.1.1" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35" + integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw== -yargs@^16.2.0: - version "16.2.0" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-16.2.0.tgz#1c82bf0f6b6a66eafce7ef30e376f49a12477f66" - integrity sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw== +yargs@^17.3.1: + version "17.7.3" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.7.3.tgz#779dffe6bcafec596a7172e983289a588647faaa" + integrity sha512-GZtjxm/J/4TSxuL3FNYjCmLktBTnIw/rVmKSIyKeYAZpmJB2ig9VauCC5xsa82GNKVKDAqpOn3KVzNt0zmrU0g== dependencies: - cliui "^7.0.2" + cliui "^8.0.1" escalade "^3.1.1" get-caller-file "^2.0.5" require-directory "^2.1.1" - string-width "^4.2.0" + string-width "^4.2.3" y18n "^5.0.5" - yargs-parser "^20.2.2" + yargs-parser "^21.1.1" + +yocto-queue@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" + integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q== diff --git a/yarn.lock b/yarn.lock index 912e18ee..5e83fe0a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,110 +2,95 @@ # yarn lockfile v1 -"@ampproject/remapping@^2.2.0": - version "2.3.0" - resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.3.0.tgz#ed441b6fa600072520ce18b43d2c8cc8caecc7f4" - integrity sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw== - dependencies: - "@jridgewell/gen-mapping" "^0.3.5" - "@jridgewell/trace-mapping" "^0.3.24" - -"@babel/code-frame@7.12.11": - version "7.12.11" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.12.11.tgz#f4ad435aa263db935b8f10f2c552d23fb716a63f" - integrity sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw== +"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.28.6", "@babel/code-frame@^7.29.7": + version "7.29.7" + resolved "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.29.7.tgz" + integrity sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw== dependencies: - "@babel/highlight" "^7.10.4" - -"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.27.1.tgz#200f715e66d52a23b221a9435534a91cc13ad5be" - integrity sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg== - dependencies: - "@babel/helper-validator-identifier" "^7.27.1" + "@babel/helper-validator-identifier" "^7.29.7" js-tokens "^4.0.0" picocolors "^1.1.1" -"@babel/compat-data@^7.27.2", "@babel/compat-data@^7.27.7", "@babel/compat-data@^7.28.0": - version "7.28.0" - resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.28.0.tgz#9fc6fd58c2a6a15243cd13983224968392070790" - integrity sha512-60X7qkglvrap8mn1lh2ebxXdZYtUcpd7gsmy9kLaBJ4i/WdY8PqTSdxyA8qraikqKQK5C1KRBKXqznrVapyNaw== - -"@babel/core@^7.1.0", "@babel/core@^7.12.3", "@babel/core@^7.17.4", "@babel/core@^7.7.2", "@babel/core@^7.8.0": - version "7.28.0" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.28.0.tgz#55dad808d5bf3445a108eefc88ea3fdf034749a4" - integrity sha512-UlLAnTPrFdNGoFtbSXwcGFQBtQZJCNjaN6hQNP3UPvuNXT1i82N26KL3dZeIpNalWywr9IuQuncaAfUaS1g6sQ== - dependencies: - "@ampproject/remapping" "^2.2.0" - "@babel/code-frame" "^7.27.1" - "@babel/generator" "^7.28.0" - "@babel/helper-compilation-targets" "^7.27.2" - "@babel/helper-module-transforms" "^7.27.3" - "@babel/helpers" "^7.27.6" - "@babel/parser" "^7.28.0" - "@babel/template" "^7.27.2" - "@babel/traverse" "^7.28.0" - "@babel/types" "^7.28.0" +"@babel/compat-data@^7.27.7", "@babel/compat-data@^7.28.6": + version "7.28.6" + resolved "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.28.6.tgz" + integrity sha512-2lfu57JtzctfIrcGMz992hyLlByuzgIk58+hhGCxjKZ3rWI82NnVLjXcaTqkI2NvlcvOskZaiZ5kjUALo3Lpxg== + +"@babel/core@^7.11.6", "@babel/core@^7.12.3", "@babel/core@^7.17.4", "@babel/core@^7.23.9": + version "7.28.6" + resolved "https://registry.npmjs.org/@babel/core/-/core-7.28.6.tgz" + integrity sha512-H3mcG6ZDLTlYfaSNi0iOKkigqMFvkTKlGUYlD8GW7nNOYRrevuA46iTypPyv+06V3fEmvvazfntkBU34L0azAw== + dependencies: + "@babel/code-frame" "^7.28.6" + "@babel/generator" "^7.28.6" + "@babel/helper-compilation-targets" "^7.28.6" + "@babel/helper-module-transforms" "^7.28.6" + "@babel/helpers" "^7.28.6" + "@babel/parser" "^7.28.6" + "@babel/template" "^7.28.6" + "@babel/traverse" "^7.28.6" + "@babel/types" "^7.28.6" + "@jridgewell/remapping" "^2.3.5" convert-source-map "^2.0.0" debug "^4.1.0" gensync "^1.0.0-beta.2" json5 "^2.2.3" semver "^6.3.1" -"@babel/generator@^7.28.0", "@babel/generator@^7.7.2": - version "7.28.0" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.28.0.tgz#9cc2f7bd6eb054d77dc66c2664148a0c5118acd2" - integrity sha512-lJjzvrbEeWrhB4P3QBsH7tey117PjLZnDbLiQEKjQ/fNJTjuq4HSqgFA+UNSwZT8D7dxxbnuSBMsa1lrWzKlQg== +"@babel/generator@^7.28.6", "@babel/generator@^7.29.7", "@babel/generator@^7.7.2": + version "7.29.7" + resolved "https://registry.npmjs.org/@babel/generator/-/generator-7.29.7.tgz" + integrity sha512-DkXD5OJQaAQIdZ1bt3UZdEnHAn9Imd3IVBdX03UFe+ony9Ojw5pzr9YVKGDY1jt+Gcn/FnGkNf8r+Vj5NOJWtQ== dependencies: - "@babel/parser" "^7.28.0" - "@babel/types" "^7.28.0" + "@babel/parser" "^7.29.7" + "@babel/types" "^7.29.7" "@jridgewell/gen-mapping" "^0.3.12" "@jridgewell/trace-mapping" "^0.3.28" jsesc "^3.0.2" "@babel/helper-annotate-as-pure@^7.27.1", "@babel/helper-annotate-as-pure@^7.27.3": version "7.27.3" - resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.27.3.tgz#f31fd86b915fc4daf1f3ac6976c59be7084ed9c5" + resolved "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.27.3.tgz" integrity sha512-fXSwMQqitTGeHLBC08Eq5yXz2m37E4pJX1qAU1+2cNedz/ifv/bVXft90VeSav5nFO61EcNgwr0aJxbyPaWBPg== dependencies: "@babel/types" "^7.27.3" -"@babel/helper-compilation-targets@^7.27.1", "@babel/helper-compilation-targets@^7.27.2": - version "7.27.2" - resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.27.2.tgz#46a0f6efab808d51d29ce96858dd10ce8732733d" - integrity sha512-2+1thGUUWWjLTYTHZWK1n8Yga0ijBz1XAhUXcKy81rd5g6yh7hGqMp45v7cadSbEHc9G3OTv45SyneRN3ps4DQ== +"@babel/helper-compilation-targets@^7.27.1", "@babel/helper-compilation-targets@^7.27.2", "@babel/helper-compilation-targets@^7.28.6": + version "7.28.6" + resolved "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.28.6.tgz" + integrity sha512-JYtls3hqi15fcx5GaSNL7SCTJ2MNmjrkHXg4FSpOA/grxK8KwyZ5bubHsCq8FXCkua6xhuaaBit+3b7+VZRfcA== dependencies: - "@babel/compat-data" "^7.27.2" + "@babel/compat-data" "^7.28.6" "@babel/helper-validator-option" "^7.27.1" browserslist "^4.24.0" lru-cache "^5.1.1" semver "^6.3.1" -"@babel/helper-create-class-features-plugin@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.27.1.tgz#5bee4262a6ea5ddc852d0806199eb17ca3de9281" - integrity sha512-QwGAmuvM17btKU5VqXfb+Giw4JcN0hjuufz3DYnpeVDvZLAObloM77bhMXiqry3Iio+Ai4phVRDwl6WU10+r5A== +"@babel/helper-create-class-features-plugin@^7.28.6": + version "7.28.6" + resolved "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.28.6.tgz" + integrity sha512-dTOdvsjnG3xNT9Y0AUg1wAl38y+4Rl4sf9caSQZOXdNqVn+H+HbbJ4IyyHaIqNR6SW9oJpA/RuRjsjCw2IdIow== dependencies: - "@babel/helper-annotate-as-pure" "^7.27.1" - "@babel/helper-member-expression-to-functions" "^7.27.1" + "@babel/helper-annotate-as-pure" "^7.27.3" + "@babel/helper-member-expression-to-functions" "^7.28.5" "@babel/helper-optimise-call-expression" "^7.27.1" - "@babel/helper-replace-supers" "^7.27.1" + "@babel/helper-replace-supers" "^7.28.6" "@babel/helper-skip-transparent-expression-wrappers" "^7.27.1" - "@babel/traverse" "^7.27.1" + "@babel/traverse" "^7.28.6" semver "^6.3.1" -"@babel/helper-create-regexp-features-plugin@^7.18.6", "@babel/helper-create-regexp-features-plugin@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.27.1.tgz#05b0882d97ba1d4d03519e4bce615d70afa18c53" - integrity sha512-uVDC72XVf8UbrH5qQTc18Agb8emwjTiZrQE11Nv3CuBEZmVvTwwE9CBUEvHku06gQCAyYf8Nv6ja1IN+6LMbxQ== +"@babel/helper-create-regexp-features-plugin@^7.18.6", "@babel/helper-create-regexp-features-plugin@^7.27.1", "@babel/helper-create-regexp-features-plugin@^7.28.5": + version "7.28.5" + resolved "https://registry.npmjs.org/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.28.5.tgz" + integrity sha512-N1EhvLtHzOvj7QQOUCCS3NrPJP8c5W6ZXCHDn7Yialuy1iu4r5EmIYkXlKNqT99Ciw+W0mDqWoR6HWMZlFP3hw== dependencies: - "@babel/helper-annotate-as-pure" "^7.27.1" - regexpu-core "^6.2.0" + "@babel/helper-annotate-as-pure" "^7.27.3" + regexpu-core "^6.3.1" semver "^6.3.1" "@babel/helper-define-polyfill-provider@^0.6.5": version "0.6.5" - resolved "https://registry.yarnpkg.com/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.6.5.tgz#742ccf1cb003c07b48859fc9fa2c1bbe40e5f753" + resolved "https://registry.npmjs.org/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.6.5.tgz" integrity sha512-uJnGFcPsWQK8fvjgGP5LZUZZsYGIoPeRjSF5PGwrelYgq7Q15/Ft9NGFp1zglwgIv//W0uG4BevRuSJRyylZPg== dependencies: "@babel/helper-compilation-targets" "^7.27.2" @@ -114,296 +99,286 @@ lodash.debounce "^4.0.8" resolve "^1.22.10" -"@babel/helper-globals@^7.28.0": - version "7.28.0" - resolved "https://registry.yarnpkg.com/@babel/helper-globals/-/helper-globals-7.28.0.tgz#b9430df2aa4e17bc28665eadeae8aa1d985e6674" - integrity sha512-+W6cISkXFa1jXsDEdYA8HeevQT/FULhxzR99pxphltZcVaugps53THCeiWA8SguxxpSp3gKPiuYfSWopkLQ4hw== +"@babel/helper-globals@^7.28.0", "@babel/helper-globals@^7.29.7": + version "7.29.7" + resolved "https://registry.npmjs.org/@babel/helper-globals/-/helper-globals-7.29.7.tgz" + integrity sha512-3nQVUAtvkKH9zahfWgw96Jc/uFOmjACE1kQz82E2lqWmHBgjzbNlsC22nuQTfahmWeQtTq5nQ/4Nnd2A1wj4zA== -"@babel/helper-member-expression-to-functions@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.27.1.tgz#ea1211276be93e798ce19037da6f06fbb994fa44" - integrity sha512-E5chM8eWjTp/aNoVpcbfM7mLxu9XGLWYise2eBKGQomAk/Mb4XoxyqXTZbuTohbsl8EKqdlMhnDI2CCLfcs9wA== +"@babel/helper-member-expression-to-functions@^7.28.5": + version "7.28.5" + resolved "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.28.5.tgz" + integrity sha512-cwM7SBRZcPCLgl8a7cY0soT1SptSzAlMH39vwiRpOQkJlh53r5hdHwLSCZpQdVLT39sZt+CRpNwYG4Y2v77atg== dependencies: - "@babel/traverse" "^7.27.1" - "@babel/types" "^7.27.1" + "@babel/traverse" "^7.28.5" + "@babel/types" "^7.28.5" -"@babel/helper-module-imports@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.27.1.tgz#7ef769a323e2655e126673bb6d2d6913bbead204" - integrity sha512-0gSFWUPNXNopqtIPQvlD5WgXYI5GY2kP2cCvoT8kczjbfcfuIljTbcWrulD1CIPIX2gt1wghbDy08yE1p+/r3w== +"@babel/helper-module-imports@^7.28.6", "@babel/helper-module-imports@^7.29.7": + version "7.29.7" + resolved "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.29.7.tgz" + integrity sha512-ejHwrQQYcm9xnTivShn2IDOlIzInN34AXskvq9QicvCtEzq1Vzclu/tKF8Jq1Cg8JG2GL6/EmjgsCT7lXepE3g== dependencies: - "@babel/traverse" "^7.27.1" - "@babel/types" "^7.27.1" + "@babel/traverse" "^7.29.7" + "@babel/types" "^7.29.7" -"@babel/helper-module-transforms@^7.27.1", "@babel/helper-module-transforms@^7.27.3": - version "7.27.3" - resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.27.3.tgz#db0bbcfba5802f9ef7870705a7ef8788508ede02" - integrity sha512-dSOvYwvyLsWBeIRyOeHXp5vPj5l1I011r52FM1+r1jCERv+aFXYk4whgQccYEGYxK2H3ZAIA8nuPkQ0HaUo3qg== +"@babel/helper-module-transforms@^7.27.1", "@babel/helper-module-transforms@^7.28.6", "@babel/helper-module-transforms@^7.29.7": + version "7.29.7" + resolved "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.29.7.tgz" + integrity sha512-UPUVSyXbOh627KiCIGQSgwWzGeBKLkaJ9PJEdrngIwMSzxLR4jS4+f1f1jb7VzBbg8nFLaYotvVPFCTqdrmTAg== dependencies: - "@babel/helper-module-imports" "^7.27.1" - "@babel/helper-validator-identifier" "^7.27.1" - "@babel/traverse" "^7.27.3" + "@babel/helper-module-imports" "^7.29.7" + "@babel/helper-validator-identifier" "^7.29.7" + "@babel/traverse" "^7.29.7" "@babel/helper-optimise-call-expression@^7.27.1": version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.27.1.tgz#c65221b61a643f3e62705e5dd2b5f115e35f9200" + resolved "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.27.1.tgz" integrity sha512-URMGH08NzYFhubNSGJrpUEphGKQwMQYBySzat5cAByY1/YgIRkULnIy3tAMeszlL/so2HbeilYloUmSpd7GdVw== dependencies: "@babel/types" "^7.27.1" -"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.14.5", "@babel/helper-plugin-utils@^7.18.6", "@babel/helper-plugin-utils@^7.27.1", "@babel/helper-plugin-utils@^7.8.0": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.27.1.tgz#ddb2f876534ff8013e6c2b299bf4d39b3c51d44c" - integrity sha512-1gn1Up5YXka3YYAHGKpbideQ5Yjf1tDa9qYcgysz+cNCXukyLl6DjPXhD3VRwSb8c0J9tA4b2+rHEZtc6R0tlw== +"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.14.5", "@babel/helper-plugin-utils@^7.18.6", "@babel/helper-plugin-utils@^7.27.1", "@babel/helper-plugin-utils@^7.28.6", "@babel/helper-plugin-utils@^7.29.7", "@babel/helper-plugin-utils@^7.8.0": + version "7.29.7" + resolved "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.29.7.tgz" + integrity sha512-G7sHYigPY17oO5SYWnfD/0MTBwVR781S/JI643e/JhUYgVgWE/61SoW3NH9KWUKyKq5LVh3npif99Wkt6j86Jw== "@babel/helper-remap-async-to-generator@^7.27.1": version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.27.1.tgz#4601d5c7ce2eb2aea58328d43725523fcd362ce6" + resolved "https://registry.npmjs.org/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.27.1.tgz" integrity sha512-7fiA521aVw8lSPeI4ZOD3vRFkoqkJcS+z4hFo82bFSH/2tNd6eJ5qCVMS5OzDmZh/kaHQeBaeyxK6wljcPtveA== dependencies: "@babel/helper-annotate-as-pure" "^7.27.1" "@babel/helper-wrap-function" "^7.27.1" "@babel/traverse" "^7.27.1" -"@babel/helper-replace-supers@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.27.1.tgz#b1ed2d634ce3bdb730e4b52de30f8cccfd692bc0" - integrity sha512-7EHz6qDZc8RYS5ElPoShMheWvEgERonFCs7IAonWLLUTXW59DP14bCZt89/GKyreYn8g3S83m21FelHKbeDCKA== +"@babel/helper-replace-supers@^7.27.1", "@babel/helper-replace-supers@^7.28.6": + version "7.28.6" + resolved "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.28.6.tgz" + integrity sha512-mq8e+laIk94/yFec3DxSjCRD2Z0TAjhVbEJY3UQrlwVo15Lmt7C2wAUbK4bjnTs4APkwsYLTahXRraQXhb1WCg== dependencies: - "@babel/helper-member-expression-to-functions" "^7.27.1" + "@babel/helper-member-expression-to-functions" "^7.28.5" "@babel/helper-optimise-call-expression" "^7.27.1" - "@babel/traverse" "^7.27.1" + "@babel/traverse" "^7.28.6" "@babel/helper-skip-transparent-expression-wrappers@^7.27.1": version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.27.1.tgz#62bb91b3abba8c7f1fec0252d9dbea11b3ee7a56" + resolved "https://registry.npmjs.org/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.27.1.tgz" integrity sha512-Tub4ZKEXqbPjXgWLl2+3JpQAYBJ8+ikpQ2Ocj/q/r0LwE3UhENh7EUabyHjz2kCEsrRY83ew2DQdHluuiDQFzg== dependencies: "@babel/traverse" "^7.27.1" "@babel/types" "^7.27.1" -"@babel/helper-string-parser@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz#54da796097ab19ce67ed9f88b47bb2ec49367687" - integrity sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA== +"@babel/helper-string-parser@^7.29.7": + version "7.29.7" + resolved "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.29.7.tgz" + integrity sha512-Pb5ijPrZ89GDH8223L4UP8i6QApWxs04RbPQJTeWDV0/keR2E36MeKnyr6LYmUUvqRRI+Iv87SuF1W6ErINzYw== -"@babel/helper-validator-identifier@^7.25.9", "@babel/helper-validator-identifier@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.27.1.tgz#a7054dcc145a967dd4dc8fee845a57c1316c9df8" - integrity sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow== +"@babel/helper-validator-identifier@^7.29.7": + version "7.29.7" + resolved "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.29.7.tgz" + integrity sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg== "@babel/helper-validator-option@^7.27.1": version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.27.1.tgz#fa52f5b1e7db1ab049445b421c4471303897702f" + resolved "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.27.1.tgz" integrity sha512-YvjJow9FxbhFFKDSuFnVCe2WxXk1zWc22fFePVNEaWJEu8IrZVlda6N0uHwzZrUM1il7NC9Mlp4MaJYbYd9JSg== "@babel/helper-wrap-function@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/helper-wrap-function/-/helper-wrap-function-7.27.1.tgz#b88285009c31427af318d4fe37651cd62a142409" - integrity sha512-NFJK2sHUvrjo8wAU/nQTWU890/zB2jj0qBcCbZbbf+005cAsv6tMjXz31fBign6M5ov1o0Bllu+9nbqkfsjjJQ== - dependencies: - "@babel/template" "^7.27.1" - "@babel/traverse" "^7.27.1" - "@babel/types" "^7.27.1" - -"@babel/helpers@^7.27.6": - version "7.28.2" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.28.2.tgz#80f0918fecbfebea9af856c419763230040ee850" - integrity sha512-/V9771t+EgXz62aCcyofnQhGM8DQACbRhvzKFsXKC9QM+5MadF8ZmIm0crDMaz3+o0h0zXfJnd4EhbYbxsrcFw== + version "7.28.6" + resolved "https://registry.npmjs.org/@babel/helper-wrap-function/-/helper-wrap-function-7.28.6.tgz" + integrity sha512-z+PwLziMNBeSQJonizz2AGnndLsP2DeGHIxDAn+wdHOGuo4Fo1x1HBPPXeE9TAOPHNNWQKCSlA2VZyYyyibDnQ== dependencies: - "@babel/template" "^7.27.2" - "@babel/types" "^7.28.2" + "@babel/template" "^7.28.6" + "@babel/traverse" "^7.28.6" + "@babel/types" "^7.28.6" -"@babel/highlight@^7.10.4": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.25.9.tgz#8141ce68fc73757946f983b343f1231f4691acc6" - integrity sha512-llL88JShoCsth8fF8R4SJnIn+WLvR6ccFxu1H3FlMhDontdcmZWf2HgIZ7AIqV3Xcck1idlohrN4EUBQz6klbw== +"@babel/helpers@^7.28.6": + version "7.28.6" + resolved "https://registry.npmjs.org/@babel/helpers/-/helpers-7.28.6.tgz" + integrity sha512-xOBvwq86HHdB7WUDTfKfT/Vuxh7gElQ+Sfti2Cy6yIWNW05P8iUslOVcZ4/sKbE+/jQaukQAdz/gf3724kYdqw== dependencies: - "@babel/helper-validator-identifier" "^7.25.9" - chalk "^2.4.2" - js-tokens "^4.0.0" - picocolors "^1.0.0" + "@babel/template" "^7.28.6" + "@babel/types" "^7.28.6" -"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.20.7", "@babel/parser@^7.27.2", "@babel/parser@^7.28.0": - version "7.28.0" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.28.0.tgz#979829fbab51a29e13901e5a80713dbcb840825e" - integrity sha512-jVZGvOxOuNSsuQuLRTh13nU0AogFlw32w/MT+LV6D3sP5WdbW61E77RnkbaO2dUvmPAYrBDJXGn5gGS6tH4j8g== +"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.20.7", "@babel/parser@^7.23.9", "@babel/parser@^7.28.6", "@babel/parser@^7.29.7": + version "7.29.7" + resolved "https://registry.npmjs.org/@babel/parser/-/parser-7.29.7.tgz" + integrity sha512-hnORnjP/1P/zFEndoeX+n+t1RwWRJiJpM/jO7FW32Kn9r5+sJB2JWOdYo4L6k78j15eCwY3Gm/7364B1EMwtNg== dependencies: - "@babel/types" "^7.28.0" + "@babel/types" "^7.29.7" -"@babel/plugin-bugfix-firefox-class-in-computed-class-key@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-firefox-class-in-computed-class-key/-/plugin-bugfix-firefox-class-in-computed-class-key-7.27.1.tgz#61dd8a8e61f7eb568268d1b5f129da3eee364bf9" - integrity sha512-QPG3C9cCVRQLxAVwmefEmwdTanECuUBMQZ/ym5kiw3XKCGA7qkuQLcjWWHcrD/GKbn/WmJwaezfuuAOcyKlRPA== +"@babel/plugin-bugfix-firefox-class-in-computed-class-key@^7.28.5": + version "7.28.5" + resolved "https://registry.npmjs.org/@babel/plugin-bugfix-firefox-class-in-computed-class-key/-/plugin-bugfix-firefox-class-in-computed-class-key-7.28.5.tgz" + integrity sha512-87GDMS3tsmMSi/3bWOte1UblL+YUTFMV8SZPZ2eSEL17s74Cw/l63rR6NmGVKMYW2GYi85nE+/d6Hw5N0bEk2Q== dependencies: "@babel/helper-plugin-utils" "^7.27.1" - "@babel/traverse" "^7.27.1" + "@babel/traverse" "^7.28.5" "@babel/plugin-bugfix-safari-class-field-initializer-scope@^7.27.1": version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-safari-class-field-initializer-scope/-/plugin-bugfix-safari-class-field-initializer-scope-7.27.1.tgz#43f70a6d7efd52370eefbdf55ae03d91b293856d" + resolved "https://registry.npmjs.org/@babel/plugin-bugfix-safari-class-field-initializer-scope/-/plugin-bugfix-safari-class-field-initializer-scope-7.27.1.tgz" integrity sha512-qNeq3bCKnGgLkEXUuFry6dPlGfCdQNZbn7yUAPCInwAJHMU7THJfrBSozkcWq5sNM6RcF3S8XyQL2A52KNR9IA== dependencies: "@babel/helper-plugin-utils" "^7.27.1" "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@^7.27.1": version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.27.1.tgz#beb623bd573b8b6f3047bd04c32506adc3e58a72" + resolved "https://registry.npmjs.org/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.27.1.tgz" integrity sha512-g4L7OYun04N1WyqMNjldFwlfPCLVkgB54A/YCXICZYBsvJJE3kByKv9c9+R/nAfmIfjl2rKYLNyMHboYbZaWaA== dependencies: "@babel/helper-plugin-utils" "^7.27.1" "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@^7.27.1": version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining/-/plugin-bugfix-v8-spread-parameters-in-optional-chaining-7.27.1.tgz#e134a5479eb2ba9c02714e8c1ebf1ec9076124fd" + resolved "https://registry.npmjs.org/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining/-/plugin-bugfix-v8-spread-parameters-in-optional-chaining-7.27.1.tgz" integrity sha512-oO02gcONcD5O1iTLi/6frMJBIwWEHceWGSGqrpCmEL8nogiS6J9PBlE48CaK20/Jx1LuRml9aDftLgdjXT8+Cw== dependencies: "@babel/helper-plugin-utils" "^7.27.1" "@babel/helper-skip-transparent-expression-wrappers" "^7.27.1" "@babel/plugin-transform-optional-chaining" "^7.27.1" -"@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly/-/plugin-bugfix-v8-static-class-fields-redefine-readonly-7.27.1.tgz#bb1c25af34d75115ce229a1de7fa44bf8f955670" - integrity sha512-6BpaYGDavZqkI6yT+KSPdpZFfpnd68UKXbcjI9pJ13pvHhPrCKWOOLp+ysvMeA+DxnhuPpgIaRpxRxo5A9t5jw== +"@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly@^7.28.6": + version "7.28.6" + resolved "https://registry.npmjs.org/@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly/-/plugin-bugfix-v8-static-class-fields-redefine-readonly-7.28.6.tgz" + integrity sha512-a0aBScVTlNaiUe35UtfxAN7A/tehvvG4/ByO6+46VPKTRSlfnAFsgKy0FUh+qAkQrDTmhDkT+IBOKlOoMUxQ0g== dependencies: - "@babel/helper-plugin-utils" "^7.27.1" - "@babel/traverse" "^7.27.1" + "@babel/helper-plugin-utils" "^7.28.6" + "@babel/traverse" "^7.28.6" "@babel/plugin-proposal-private-property-in-object@7.21.0-placeholder-for-preset-env.2": version "7.21.0-placeholder-for-preset-env.2" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.21.0-placeholder-for-preset-env.2.tgz#7844f9289546efa9febac2de4cfe358a050bd703" + resolved "https://registry.npmjs.org/@babel/plugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.21.0-placeholder-for-preset-env.2.tgz" integrity sha512-SOSkfJDddaM7mak6cPEpswyTRnuRltl429hMraQEglW+OkovnCzsiszTmsrlY//qLFjCpQDFRvjdm2wA5pPm9w== "@babel/plugin-syntax-async-generators@^7.8.4": version "7.8.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz#a983fb1aeb2ec3f6ed042a210f640e90e786fe0d" + resolved "https://registry.npmjs.org/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz" integrity sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw== dependencies: "@babel/helper-plugin-utils" "^7.8.0" "@babel/plugin-syntax-bigint@^7.8.3": version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-bigint/-/plugin-syntax-bigint-7.8.3.tgz#4c9a6f669f5d0cdf1b90a1671e9a146be5300cea" + resolved "https://registry.npmjs.org/@babel/plugin-syntax-bigint/-/plugin-syntax-bigint-7.8.3.tgz" integrity sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg== dependencies: "@babel/helper-plugin-utils" "^7.8.0" "@babel/plugin-syntax-class-properties@^7.12.13": version "7.12.13" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz#b5c987274c4a3a82b89714796931a6b53544ae10" + resolved "https://registry.npmjs.org/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz" integrity sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA== dependencies: "@babel/helper-plugin-utils" "^7.12.13" "@babel/plugin-syntax-class-static-block@^7.14.5": version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-class-static-block/-/plugin-syntax-class-static-block-7.14.5.tgz#195df89b146b4b78b3bf897fd7a257c84659d406" + resolved "https://registry.npmjs.org/@babel/plugin-syntax-class-static-block/-/plugin-syntax-class-static-block-7.14.5.tgz" integrity sha512-b+YyPmr6ldyNnM6sqYeMWE+bgJcJpO6yS4QD7ymxgH34GBPNDM/THBh8iunyvKIZztiwLH4CJZ0RxTk9emgpjw== dependencies: "@babel/helper-plugin-utils" "^7.14.5" -"@babel/plugin-syntax-import-assertions@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-assertions/-/plugin-syntax-import-assertions-7.27.1.tgz#88894aefd2b03b5ee6ad1562a7c8e1587496aecd" - integrity sha512-UT/Jrhw57xg4ILHLFnzFpPDlMbcdEicaAtjPQpbj9wa8T4r5KVWCimHcL/460g8Ht0DMxDyjsLgiWSkVjnwPFg== +"@babel/plugin-syntax-import-assertions@^7.28.6": + version "7.28.6" + resolved "https://registry.npmjs.org/@babel/plugin-syntax-import-assertions/-/plugin-syntax-import-assertions-7.28.6.tgz" + integrity sha512-pSJUpFHdx9z5nqTSirOCMtYVP2wFgoWhP0p3g8ONK/4IHhLIBd0B9NYqAvIUAhq+OkhO4VM1tENCt0cjlsNShw== dependencies: - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-plugin-utils" "^7.28.6" -"@babel/plugin-syntax-import-attributes@^7.24.7", "@babel/plugin-syntax-import-attributes@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-attributes/-/plugin-syntax-import-attributes-7.27.1.tgz#34c017d54496f9b11b61474e7ea3dfd5563ffe07" - integrity sha512-oFT0FrKHgF53f4vOsZGi2Hh3I35PfSmVs4IBFLFj4dnafP+hIWDLg3VyKmUHfLoLHlyxY4C7DGtmHuJgn+IGww== +"@babel/plugin-syntax-import-attributes@^7.24.7", "@babel/plugin-syntax-import-attributes@^7.28.6": + version "7.28.6" + resolved "https://registry.npmjs.org/@babel/plugin-syntax-import-attributes/-/plugin-syntax-import-attributes-7.28.6.tgz" + integrity sha512-jiLC0ma9XkQT3TKJ9uYvlakm66Pamywo+qwL+oL8HJOvc6TWdZXVfhqJr8CCzbSGUAbDOzlGHJC1U+vRfLQDvw== dependencies: - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-plugin-utils" "^7.28.6" "@babel/plugin-syntax-import-meta@^7.10.4": version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz#ee601348c370fa334d2207be158777496521fd51" + resolved "https://registry.npmjs.org/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz" integrity sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g== dependencies: "@babel/helper-plugin-utils" "^7.10.4" "@babel/plugin-syntax-json-strings@^7.8.3": version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz#01ca21b668cd8218c9e640cb6dd88c5412b2c96a" + resolved "https://registry.npmjs.org/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz" integrity sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA== dependencies: "@babel/helper-plugin-utils" "^7.8.0" -"@babel/plugin-syntax-jsx@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.27.1.tgz#2f9beb5eff30fa507c5532d107daac7b888fa34c" - integrity sha512-y8YTNIeKoyhGd9O0Jiyzyyqk8gdjnumGTQPsz0xOZOQ2RmkVJeZ1vmmfIvFEKqucBG6axJGBZDE/7iI5suUI/w== +"@babel/plugin-syntax-jsx@^7.27.1", "@babel/plugin-syntax-jsx@^7.7.2": + version "7.28.6" + resolved "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.28.6.tgz" + integrity sha512-wgEmr06G6sIpqr8YDwA2dSRTE3bJ+V0IfpzfSY3Lfgd7YWOaAdlykvJi13ZKBt8cZHfgH1IXN+CL656W3uUa4w== dependencies: - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-plugin-utils" "^7.28.6" "@babel/plugin-syntax-logical-assignment-operators@^7.10.4": version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz#ca91ef46303530448b906652bac2e9fe9941f699" + resolved "https://registry.npmjs.org/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz" integrity sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig== dependencies: "@babel/helper-plugin-utils" "^7.10.4" "@babel/plugin-syntax-nullish-coalescing-operator@^7.8.3": version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz#167ed70368886081f74b5c36c65a88c03b66d1a9" + resolved "https://registry.npmjs.org/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz" integrity sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ== dependencies: "@babel/helper-plugin-utils" "^7.8.0" "@babel/plugin-syntax-numeric-separator@^7.10.4": version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz#b9b070b3e33570cd9fd07ba7fa91c0dd37b9af97" + resolved "https://registry.npmjs.org/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz" integrity sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug== dependencies: "@babel/helper-plugin-utils" "^7.10.4" "@babel/plugin-syntax-object-rest-spread@^7.8.3": version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz#60e225edcbd98a640332a2e72dd3e66f1af55871" + resolved "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz" integrity sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA== dependencies: "@babel/helper-plugin-utils" "^7.8.0" "@babel/plugin-syntax-optional-catch-binding@^7.8.3": version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz#6111a265bcfb020eb9efd0fdfd7d26402b9ed6c1" + resolved "https://registry.npmjs.org/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz" integrity sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q== dependencies: "@babel/helper-plugin-utils" "^7.8.0" "@babel/plugin-syntax-optional-chaining@^7.8.3": version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz#4f69c2ab95167e0180cd5336613f8c5788f7d48a" + resolved "https://registry.npmjs.org/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz" integrity sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg== dependencies: "@babel/helper-plugin-utils" "^7.8.0" "@babel/plugin-syntax-private-property-in-object@^7.14.5": version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-private-property-in-object/-/plugin-syntax-private-property-in-object-7.14.5.tgz#0dc6671ec0ea22b6e94a1114f857970cd39de1ad" + resolved "https://registry.npmjs.org/@babel/plugin-syntax-private-property-in-object/-/plugin-syntax-private-property-in-object-7.14.5.tgz" integrity sha512-0wVnp9dxJ72ZUJDV27ZfbSj6iHLoytYZmh3rFcxNnvsJF3ktkzLDZPy/mA17HGsaQT3/DQsWYX1f1QGWkCoVUg== dependencies: "@babel/helper-plugin-utils" "^7.14.5" "@babel/plugin-syntax-top-level-await@^7.14.5": version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz#c1cfdadc35a646240001f06138247b741c34d94c" + resolved "https://registry.npmjs.org/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz" integrity sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw== dependencies: "@babel/helper-plugin-utils" "^7.14.5" -"@babel/plugin-syntax-typescript@^7.27.1", "@babel/plugin-syntax-typescript@^7.7.2": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.27.1.tgz#5147d29066a793450f220c63fa3a9431b7e6dd18" - integrity sha512-xfYCBMxveHrRMnAWl1ZlPXOZjzkN82THFvLhQhFXFt81Z5HnN+EtUkZhv/zcKpmT3fzmWZB0ywiBrbC3vogbwQ== +"@babel/plugin-syntax-typescript@^7.28.6", "@babel/plugin-syntax-typescript@^7.7.2": + version "7.28.6" + resolved "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.28.6.tgz" + integrity sha512-+nDNmQye7nlnuuHDboPbGm00Vqg3oO8niRRL27/4LYHUsHYh0zJ1xWOz0uRwNFmM1Avzk8wZbc6rdiYhomzv/A== dependencies: - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-plugin-utils" "^7.28.6" "@babel/plugin-syntax-unicode-sets-regex@^7.18.6": version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-unicode-sets-regex/-/plugin-syntax-unicode-sets-regex-7.18.6.tgz#d49a3b3e6b52e5be6740022317580234a6a47357" + resolved "https://registry.npmjs.org/@babel/plugin-syntax-unicode-sets-regex/-/plugin-syntax-unicode-sets-regex-7.18.6.tgz" integrity sha512-727YkEAPwSIQTv5im8QHz3upqp92JTWhidIC81Tdx4VJYIte/VndKf1qKrfnnhPLiPghStWfvC/iFaMCQu7Nqg== dependencies: "@babel/helper-create-regexp-features-plugin" "^7.18.6" @@ -411,142 +386,142 @@ "@babel/plugin-transform-arrow-functions@^7.27.1": version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.27.1.tgz#6e2061067ba3ab0266d834a9f94811196f2aba9a" + resolved "https://registry.npmjs.org/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.27.1.tgz" integrity sha512-8Z4TGic6xW70FKThA5HYEKKyBpOOsucTOD1DjU3fZxDg+K3zBJcXMFnt/4yQiZnf5+MiOMSXQ9PaEK/Ilh1DeA== dependencies: "@babel/helper-plugin-utils" "^7.27.1" -"@babel/plugin-transform-async-generator-functions@^7.28.0": - version "7.28.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-generator-functions/-/plugin-transform-async-generator-functions-7.28.0.tgz#1276e6c7285ab2cd1eccb0bc7356b7a69ff842c2" - integrity sha512-BEOdvX4+M765icNPZeidyADIvQ1m1gmunXufXxvRESy/jNNyfovIqUyE7MVgGBjWktCoJlzvFA1To2O4ymIO3Q== +"@babel/plugin-transform-async-generator-functions@^7.28.6": + version "7.28.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-async-generator-functions/-/plugin-transform-async-generator-functions-7.28.6.tgz" + integrity sha512-9knsChgsMzBV5Yh3kkhrZNxH3oCYAfMBkNNaVN4cP2RVlFPe8wYdwwcnOsAbkdDoV9UjFtOXWrWB52M8W4jNeA== dependencies: - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-plugin-utils" "^7.28.6" "@babel/helper-remap-async-to-generator" "^7.27.1" - "@babel/traverse" "^7.28.0" + "@babel/traverse" "^7.28.6" -"@babel/plugin-transform-async-to-generator@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.27.1.tgz#9a93893b9379b39466c74474f55af03de78c66e7" - integrity sha512-NREkZsZVJS4xmTr8qzE5y8AfIPqsdQfRuUiLRTEzb7Qii8iFWCyDKaUV2c0rCuh4ljDZ98ALHP/PetiBV2nddA== +"@babel/plugin-transform-async-to-generator@^7.28.6": + version "7.28.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.28.6.tgz" + integrity sha512-ilTRcmbuXjsMmcZ3HASTe4caH5Tpo93PkTxF9oG2VZsSWsahydmcEHhix9Ik122RcTnZnUzPbmux4wh1swfv7g== dependencies: - "@babel/helper-module-imports" "^7.27.1" - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-module-imports" "^7.28.6" + "@babel/helper-plugin-utils" "^7.28.6" "@babel/helper-remap-async-to-generator" "^7.27.1" "@babel/plugin-transform-block-scoped-functions@^7.27.1": version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.27.1.tgz#558a9d6e24cf72802dd3b62a4b51e0d62c0f57f9" + resolved "https://registry.npmjs.org/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.27.1.tgz" integrity sha512-cnqkuOtZLapWYZUYM5rVIdv1nXYuFVIltZ6ZJ7nIj585QsjKM5dhL2Fu/lICXZ1OyIAFc7Qy+bvDAtTXqGrlhg== dependencies: "@babel/helper-plugin-utils" "^7.27.1" -"@babel/plugin-transform-block-scoping@^7.28.0": - version "7.28.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.28.0.tgz#e7c50cbacc18034f210b93defa89638666099451" - integrity sha512-gKKnwjpdx5sER/wl0WN0efUBFzF/56YZO0RJrSYP4CljXnP31ByY7fol89AzomdlLNzI36AvOTmYHsnZTCkq8Q== +"@babel/plugin-transform-block-scoping@^7.28.6": + version "7.28.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.28.6.tgz" + integrity sha512-tt/7wOtBmwHPNMPu7ax4pdPz6shjFrmHDghvNC+FG9Qvj7D6mJcoRQIF5dy4njmxR941l6rgtvfSB2zX3VlUIw== dependencies: - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-plugin-utils" "^7.28.6" -"@babel/plugin-transform-class-properties@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-class-properties/-/plugin-transform-class-properties-7.27.1.tgz#dd40a6a370dfd49d32362ae206ddaf2bb082a925" - integrity sha512-D0VcalChDMtuRvJIu3U/fwWjf8ZMykz5iZsg77Nuj821vCKI3zCyRLwRdWbsuJ/uRwZhZ002QtCqIkwC/ZkvbA== +"@babel/plugin-transform-class-properties@^7.28.6": + version "7.28.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-class-properties/-/plugin-transform-class-properties-7.28.6.tgz" + integrity sha512-dY2wS3I2G7D697VHndN91TJr8/AAfXQNt5ynCTI/MpxMsSzHp+52uNivYT5wCPax3whc47DR8Ba7cmlQMg24bw== dependencies: - "@babel/helper-create-class-features-plugin" "^7.27.1" - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-create-class-features-plugin" "^7.28.6" + "@babel/helper-plugin-utils" "^7.28.6" -"@babel/plugin-transform-class-static-block@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-class-static-block/-/plugin-transform-class-static-block-7.27.1.tgz#7e920d5625b25bbccd3061aefbcc05805ed56ce4" - integrity sha512-s734HmYU78MVzZ++joYM+NkJusItbdRcbm+AGRgJCt3iA+yux0QpD9cBVdz3tKyrjVYWRl7j0mHSmv4lhV0aoA== +"@babel/plugin-transform-class-static-block@^7.28.6": + version "7.28.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-class-static-block/-/plugin-transform-class-static-block-7.28.6.tgz" + integrity sha512-rfQ++ghVwTWTqQ7w8qyDxL1XGihjBss4CmTgGRCTAC9RIbhVpyp4fOeZtta0Lbf+dTNIVJer6ych2ibHwkZqsQ== dependencies: - "@babel/helper-create-class-features-plugin" "^7.27.1" - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-create-class-features-plugin" "^7.28.6" + "@babel/helper-plugin-utils" "^7.28.6" -"@babel/plugin-transform-classes@^7.28.0": - version "7.28.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.28.0.tgz#12fa46cffc32a6e084011b650539e880add8a0f8" - integrity sha512-IjM1IoJNw72AZFlj33Cu8X0q2XK/6AaVC3jQu+cgQ5lThWD5ajnuUAml80dqRmOhmPkTH8uAwnpMu9Rvj0LTRA== +"@babel/plugin-transform-classes@^7.28.6": + version "7.28.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.28.6.tgz" + integrity sha512-EF5KONAqC5zAqT783iMGuM2ZtmEBy+mJMOKl2BCvPZ2lVrwvXnB6o+OBWCS+CoeCCpVRF2sA2RBKUxvT8tQT5Q== dependencies: "@babel/helper-annotate-as-pure" "^7.27.3" - "@babel/helper-compilation-targets" "^7.27.2" + "@babel/helper-compilation-targets" "^7.28.6" "@babel/helper-globals" "^7.28.0" - "@babel/helper-plugin-utils" "^7.27.1" - "@babel/helper-replace-supers" "^7.27.1" - "@babel/traverse" "^7.28.0" + "@babel/helper-plugin-utils" "^7.28.6" + "@babel/helper-replace-supers" "^7.28.6" + "@babel/traverse" "^7.28.6" -"@babel/plugin-transform-computed-properties@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.27.1.tgz#81662e78bf5e734a97982c2b7f0a793288ef3caa" - integrity sha512-lj9PGWvMTVksbWiDT2tW68zGS/cyo4AkZ/QTp0sQT0mjPopCmrSkzxeXkznjqBxzDI6TclZhOJbBmbBLjuOZUw== +"@babel/plugin-transform-computed-properties@^7.28.6": + version "7.28.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.28.6.tgz" + integrity sha512-bcc3k0ijhHbc2lEfpFHgx7eYw9KNXqOerKWfzbxEHUGKnS3sz9C4CNL9OiFN1297bDNfUiSO7DaLzbvHQQQ1BQ== dependencies: - "@babel/helper-plugin-utils" "^7.27.1" - "@babel/template" "^7.27.1" + "@babel/helper-plugin-utils" "^7.28.6" + "@babel/template" "^7.28.6" -"@babel/plugin-transform-destructuring@^7.28.0": - version "7.28.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.28.0.tgz#0f156588f69c596089b7d5b06f5af83d9aa7f97a" - integrity sha512-v1nrSMBiKcodhsyJ4Gf+Z0U/yawmJDBOTpEB3mcQY52r9RIyPneGyAS/yM6seP/8I+mWI3elOMtT5dB8GJVs+A== +"@babel/plugin-transform-destructuring@^7.28.5": + version "7.28.5" + resolved "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.28.5.tgz" + integrity sha512-Kl9Bc6D0zTUcFUvkNuQh4eGXPKKNDOJQXVyyM4ZAQPMveniJdxi8XMJwLo+xSoW3MIq81bD33lcUe9kZpl0MCw== dependencies: "@babel/helper-plugin-utils" "^7.27.1" - "@babel/traverse" "^7.28.0" + "@babel/traverse" "^7.28.5" -"@babel/plugin-transform-dotall-regex@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.27.1.tgz#aa6821de864c528b1fecf286f0a174e38e826f4d" - integrity sha512-gEbkDVGRvjj7+T1ivxrfgygpT7GUd4vmODtYpbs0gZATdkX8/iSnOtZSxiZnsgm1YjTgjI6VKBGSJJevkrclzw== +"@babel/plugin-transform-dotall-regex@^7.28.6": + version "7.28.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.28.6.tgz" + integrity sha512-SljjowuNKB7q5Oayv4FoPzeB74g3QgLt8IVJw9ADvWy3QnUb/01aw8I4AVv8wYnPvQz2GDDZ/g3GhcNyDBI4Bg== dependencies: - "@babel/helper-create-regexp-features-plugin" "^7.27.1" - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-create-regexp-features-plugin" "^7.28.5" + "@babel/helper-plugin-utils" "^7.28.6" "@babel/plugin-transform-duplicate-keys@^7.27.1": version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.27.1.tgz#f1fbf628ece18e12e7b32b175940e68358f546d1" + resolved "https://registry.npmjs.org/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.27.1.tgz" integrity sha512-MTyJk98sHvSs+cvZ4nOauwTTG1JeonDjSGvGGUNHreGQns+Mpt6WX/dVzWBHgg+dYZhkC4X+zTDfkTU+Vy9y7Q== dependencies: "@babel/helper-plugin-utils" "^7.27.1" -"@babel/plugin-transform-duplicate-named-capturing-groups-regex@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-duplicate-named-capturing-groups-regex/-/plugin-transform-duplicate-named-capturing-groups-regex-7.27.1.tgz#5043854ca620a94149372e69030ff8cb6a9eb0ec" - integrity sha512-hkGcueTEzuhB30B3eJCbCYeCaaEQOmQR0AdvzpD4LoN0GXMWzzGSuRrxR2xTnCrvNbVwK9N6/jQ92GSLfiZWoQ== +"@babel/plugin-transform-duplicate-named-capturing-groups-regex@^7.28.6": + version "7.28.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-duplicate-named-capturing-groups-regex/-/plugin-transform-duplicate-named-capturing-groups-regex-7.28.6.tgz" + integrity sha512-5suVoXjC14lUN6ZL9OLKIHCNVWCrqGqlmEp/ixdXjvgnEl/kauLvvMO/Xw9NyMc95Joj1AeLVPVMvibBgSoFlA== dependencies: - "@babel/helper-create-regexp-features-plugin" "^7.27.1" - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-create-regexp-features-plugin" "^7.28.5" + "@babel/helper-plugin-utils" "^7.28.6" "@babel/plugin-transform-dynamic-import@^7.27.1": version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dynamic-import/-/plugin-transform-dynamic-import-7.27.1.tgz#4c78f35552ac0e06aa1f6e3c573d67695e8af5a4" + resolved "https://registry.npmjs.org/@babel/plugin-transform-dynamic-import/-/plugin-transform-dynamic-import-7.27.1.tgz" integrity sha512-MHzkWQcEmjzzVW9j2q8LGjwGWpG2mjwaaB0BNQwst3FIjqsg8Ct/mIZlvSPJvfi9y2AC8mi/ktxbFVL9pZ1I4A== dependencies: "@babel/helper-plugin-utils" "^7.27.1" -"@babel/plugin-transform-explicit-resource-management@^7.28.0": - version "7.28.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-explicit-resource-management/-/plugin-transform-explicit-resource-management-7.28.0.tgz#45be6211b778dbf4b9d54c4e8a2b42fa72e09a1a" - integrity sha512-K8nhUcn3f6iB+P3gwCv/no7OdzOZQcKchW6N389V6PD8NUWKZHzndOd9sPDVbMoBsbmjMqlB4L9fm+fEFNVlwQ== +"@babel/plugin-transform-explicit-resource-management@^7.28.6": + version "7.28.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-explicit-resource-management/-/plugin-transform-explicit-resource-management-7.28.6.tgz" + integrity sha512-Iao5Konzx2b6g7EPqTy40UZbcdXE126tTxVFr/nAIj+WItNxjKSYTEw3RC+A2/ZetmdJsgueL1KhaMCQHkLPIg== dependencies: - "@babel/helper-plugin-utils" "^7.27.1" - "@babel/plugin-transform-destructuring" "^7.28.0" + "@babel/helper-plugin-utils" "^7.28.6" + "@babel/plugin-transform-destructuring" "^7.28.5" -"@babel/plugin-transform-exponentiation-operator@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.27.1.tgz#fc497b12d8277e559747f5a3ed868dd8064f83e1" - integrity sha512-uspvXnhHvGKf2r4VVtBpeFnuDWsJLQ6MF6lGJLC89jBR1uoVeqM416AZtTuhTezOfgHicpJQmoD5YUakO/YmXQ== +"@babel/plugin-transform-exponentiation-operator@^7.28.6": + version "7.28.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.28.6.tgz" + integrity sha512-WitabqiGjV/vJ0aPOLSFfNY1u9U3R7W36B03r5I2KoNix+a3sOhJ3pKFB3R5It9/UiK78NiO0KE9P21cMhlPkw== dependencies: - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-plugin-utils" "^7.28.6" "@babel/plugin-transform-export-namespace-from@^7.27.1": version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-export-namespace-from/-/plugin-transform-export-namespace-from-7.27.1.tgz#71ca69d3471edd6daa711cf4dfc3400415df9c23" + resolved "https://registry.npmjs.org/@babel/plugin-transform-export-namespace-from/-/plugin-transform-export-namespace-from-7.27.1.tgz" integrity sha512-tQvHWSZ3/jH2xuq/vZDy0jNn+ZdXJeM8gHvX4lnJmsc3+50yPlWdZXIc5ay+umX+2/tJIqHqiEqcJvxlmIvRvQ== dependencies: "@babel/helper-plugin-utils" "^7.27.1" "@babel/plugin-transform-for-of@^7.27.1": version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.27.1.tgz#bc24f7080e9ff721b63a70ac7b2564ca15b6c40a" + resolved "https://registry.npmjs.org/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.27.1.tgz" integrity sha512-BfbWFFEJFQzLCQ5N8VocnCtA8J1CLkNTe2Ms2wocj75dd6VpiqS5Z5quTYcUoo4Yq+DN0rtikODccuv7RU81sw== dependencies: "@babel/helper-plugin-utils" "^7.27.1" @@ -554,70 +529,70 @@ "@babel/plugin-transform-function-name@^7.27.1": version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.27.1.tgz#4d0bf307720e4dce6d7c30fcb1fd6ca77bdeb3a7" + resolved "https://registry.npmjs.org/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.27.1.tgz" integrity sha512-1bQeydJF9Nr1eBCMMbC+hdwmRlsv5XYOMu03YSWFwNs0HsAmtSxxF1fyuYPqemVldVyFmlCU7w8UE14LupUSZQ== dependencies: "@babel/helper-compilation-targets" "^7.27.1" "@babel/helper-plugin-utils" "^7.27.1" "@babel/traverse" "^7.27.1" -"@babel/plugin-transform-json-strings@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-json-strings/-/plugin-transform-json-strings-7.27.1.tgz#a2e0ce6ef256376bd527f290da023983527a4f4c" - integrity sha512-6WVLVJiTjqcQauBhn1LkICsR2H+zm62I3h9faTDKt1qP4jn2o72tSvqMwtGFKGTpojce0gJs+76eZ2uCHRZh0Q== +"@babel/plugin-transform-json-strings@^7.28.6": + version "7.28.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-json-strings/-/plugin-transform-json-strings-7.28.6.tgz" + integrity sha512-Nr+hEN+0geQkzhbdgQVPoqr47lZbm+5fCUmO70722xJZd0Mvb59+33QLImGj6F+DkK3xgDi1YVysP8whD6FQAw== dependencies: - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-plugin-utils" "^7.28.6" "@babel/plugin-transform-literals@^7.27.1": version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-literals/-/plugin-transform-literals-7.27.1.tgz#baaefa4d10a1d4206f9dcdda50d7d5827bb70b24" + resolved "https://registry.npmjs.org/@babel/plugin-transform-literals/-/plugin-transform-literals-7.27.1.tgz" integrity sha512-0HCFSepIpLTkLcsi86GG3mTUzxV5jpmbv97hTETW3yzrAij8aqlD36toB1D0daVFJM8NK6GvKO0gslVQmm+zZA== dependencies: "@babel/helper-plugin-utils" "^7.27.1" -"@babel/plugin-transform-logical-assignment-operators@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-logical-assignment-operators/-/plugin-transform-logical-assignment-operators-7.27.1.tgz#890cb20e0270e0e5bebe3f025b434841c32d5baa" - integrity sha512-SJvDs5dXxiae4FbSL1aBJlG4wvl594N6YEVVn9e3JGulwioy6z3oPjx/sQBO3Y4NwUu5HNix6KJ3wBZoewcdbw== +"@babel/plugin-transform-logical-assignment-operators@^7.28.6": + version "7.28.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-logical-assignment-operators/-/plugin-transform-logical-assignment-operators-7.28.6.tgz" + integrity sha512-+anKKair6gpi8VsM/95kmomGNMD0eLz1NQ8+Pfw5sAwWH9fGYXT50E55ZpV0pHUHWf6IUTWPM+f/7AAff+wr9A== dependencies: - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-plugin-utils" "^7.28.6" "@babel/plugin-transform-member-expression-literals@^7.27.1": version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.27.1.tgz#37b88ba594d852418e99536f5612f795f23aeaf9" + resolved "https://registry.npmjs.org/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.27.1.tgz" integrity sha512-hqoBX4dcZ1I33jCSWcXrP+1Ku7kdqXf1oeah7ooKOIiAdKQ+uqftgCFNOSzA5AMS2XIHEYeGFg4cKRCdpxzVOQ== dependencies: "@babel/helper-plugin-utils" "^7.27.1" "@babel/plugin-transform-modules-amd@^7.27.1": version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.27.1.tgz#a4145f9d87c2291fe2d05f994b65dba4e3e7196f" + resolved "https://registry.npmjs.org/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.27.1.tgz" integrity sha512-iCsytMg/N9/oFq6n+gFTvUYDZQOMK5kEdeYxmxt91fcJGycfxVP9CnrxoliM0oumFERba2i8ZtwRUCMhvP1LnA== dependencies: "@babel/helper-module-transforms" "^7.27.1" "@babel/helper-plugin-utils" "^7.27.1" -"@babel/plugin-transform-modules-commonjs@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.27.1.tgz#8e44ed37c2787ecc23bdc367f49977476614e832" - integrity sha512-OJguuwlTYlN0gBZFRPqwOGNWssZjfIUdS7HMYtN8c1KmwpwHFBwTeFZrg9XZa+DFTitWOW5iTAG7tyCUPsCCyw== +"@babel/plugin-transform-modules-commonjs@^7.27.1", "@babel/plugin-transform-modules-commonjs@^7.28.6": + version "7.28.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.28.6.tgz" + integrity sha512-jppVbf8IV9iWWwWTQIxJMAJCWBuuKx71475wHwYytrRGQ2CWiDvYlADQno3tcYpS/T2UUWFQp3nVtYfK/YBQrA== dependencies: - "@babel/helper-module-transforms" "^7.27.1" - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-module-transforms" "^7.28.6" + "@babel/helper-plugin-utils" "^7.28.6" -"@babel/plugin-transform-modules-systemjs@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.27.1.tgz#00e05b61863070d0f3292a00126c16c0e024c4ed" - integrity sha512-w5N1XzsRbc0PQStASMksmUeqECuzKuTJer7kFagK8AXgpCMkeDMO5S+aaFb7A51ZYDF7XI34qsTX+fkHiIm5yA== +"@babel/plugin-transform-modules-systemjs@^7.28.5": + version "7.29.7" + resolved "https://registry.npmjs.org/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.29.7.tgz" + integrity sha512-TM2ZcQLoG2/y4HODiStCo10DibYhWhGWAwVv+EQKmG/7GFl0N+AAmUiXOMKM+aiJ9XBJ9AHVZBvTzMnJ2sM3cQ== dependencies: - "@babel/helper-module-transforms" "^7.27.1" - "@babel/helper-plugin-utils" "^7.27.1" - "@babel/helper-validator-identifier" "^7.27.1" - "@babel/traverse" "^7.27.1" + "@babel/helper-module-transforms" "^7.29.7" + "@babel/helper-plugin-utils" "^7.29.7" + "@babel/helper-validator-identifier" "^7.29.7" + "@babel/traverse" "^7.29.7" "@babel/plugin-transform-modules-umd@^7.27.1": version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.27.1.tgz#63f2cf4f6dc15debc12f694e44714863d34cd334" + resolved "https://registry.npmjs.org/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.27.1.tgz" integrity sha512-iQBE/xC5BV1OxJbp6WG7jq9IWiD+xxlZhLrdwpPkTX3ydmXdvoCpyfJN7acaIBZaOqTfr76pgzqBJflNbeRK+w== dependencies: "@babel/helper-module-transforms" "^7.27.1" @@ -625,7 +600,7 @@ "@babel/plugin-transform-named-capturing-groups-regex@^7.27.1": version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.27.1.tgz#f32b8f7818d8fc0cc46ee20a8ef75f071af976e1" + resolved "https://registry.npmjs.org/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.27.1.tgz" integrity sha512-SstR5JYy8ddZvD6MhV0tM/j16Qds4mIpJTOd1Yu9J9pJjH93bxHECF7pgtc28XvkzTD6Pxcm/0Z73Hvk7kb3Ng== dependencies: "@babel/helper-create-regexp-features-plugin" "^7.27.1" @@ -633,259 +608,259 @@ "@babel/plugin-transform-new-target@^7.27.1": version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.27.1.tgz#259c43939728cad1706ac17351b7e6a7bea1abeb" + resolved "https://registry.npmjs.org/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.27.1.tgz" integrity sha512-f6PiYeqXQ05lYq3TIfIDu/MtliKUbNwkGApPUvyo6+tc7uaR4cPjPe7DFPr15Uyycg2lZU6btZ575CuQoYh7MQ== dependencies: "@babel/helper-plugin-utils" "^7.27.1" -"@babel/plugin-transform-nullish-coalescing-operator@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-nullish-coalescing-operator/-/plugin-transform-nullish-coalescing-operator-7.27.1.tgz#4f9d3153bf6782d73dd42785a9d22d03197bc91d" - integrity sha512-aGZh6xMo6q9vq1JGcw58lZ1Z0+i0xB2x0XaauNIUXd6O1xXc3RwoWEBlsTQrY4KQ9Jf0s5rgD6SiNkaUdJegTA== +"@babel/plugin-transform-nullish-coalescing-operator@^7.28.6": + version "7.28.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-nullish-coalescing-operator/-/plugin-transform-nullish-coalescing-operator-7.28.6.tgz" + integrity sha512-3wKbRgmzYbw24mDJXT7N+ADXw8BC/imU9yo9c9X9NKaLF1fW+e5H1U5QjMUBe4Qo4Ox/o++IyUkl1sVCLgevKg== dependencies: - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-plugin-utils" "^7.28.6" -"@babel/plugin-transform-numeric-separator@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-numeric-separator/-/plugin-transform-numeric-separator-7.27.1.tgz#614e0b15cc800e5997dadd9bd6ea524ed6c819c6" - integrity sha512-fdPKAcujuvEChxDBJ5c+0BTaS6revLV7CJL08e4m3de8qJfNIuCc2nc7XJYOjBoTMJeqSmwXJ0ypE14RCjLwaw== +"@babel/plugin-transform-numeric-separator@^7.28.6": + version "7.28.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-numeric-separator/-/plugin-transform-numeric-separator-7.28.6.tgz" + integrity sha512-SJR8hPynj8outz+SlStQSwvziMN4+Bq99it4tMIf5/Caq+3iOc0JtKyse8puvyXkk3eFRIA5ID/XfunGgO5i6w== dependencies: - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-plugin-utils" "^7.28.6" -"@babel/plugin-transform-object-rest-spread@^7.28.0": - version "7.28.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-rest-spread/-/plugin-transform-object-rest-spread-7.28.0.tgz#d23021857ffd7cd809f54d624299b8086402ed8d" - integrity sha512-9VNGikXxzu5eCiQjdE4IZn8sb9q7Xsk5EXLDBKUYg1e/Tve8/05+KJEtcxGxAgCY5t/BpKQM+JEL/yT4tvgiUA== +"@babel/plugin-transform-object-rest-spread@^7.28.6": + version "7.28.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-object-rest-spread/-/plugin-transform-object-rest-spread-7.28.6.tgz" + integrity sha512-5rh+JR4JBC4pGkXLAcYdLHZjXudVxWMXbB6u6+E9lRL5TrGVbHt1TjxGbZ8CkmYw9zjkB7jutzOROArsqtncEA== dependencies: - "@babel/helper-compilation-targets" "^7.27.2" - "@babel/helper-plugin-utils" "^7.27.1" - "@babel/plugin-transform-destructuring" "^7.28.0" + "@babel/helper-compilation-targets" "^7.28.6" + "@babel/helper-plugin-utils" "^7.28.6" + "@babel/plugin-transform-destructuring" "^7.28.5" "@babel/plugin-transform-parameters" "^7.27.7" - "@babel/traverse" "^7.28.0" + "@babel/traverse" "^7.28.6" "@babel/plugin-transform-object-super@^7.27.1": version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.27.1.tgz#1c932cd27bf3874c43a5cac4f43ebf970c9871b5" + resolved "https://registry.npmjs.org/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.27.1.tgz" integrity sha512-SFy8S9plRPbIcxlJ8A6mT/CxFdJx/c04JEctz4jf8YZaVS2px34j7NXRrlGlHkN/M2gnpL37ZpGRGVFLd3l8Ng== dependencies: "@babel/helper-plugin-utils" "^7.27.1" "@babel/helper-replace-supers" "^7.27.1" -"@babel/plugin-transform-optional-catch-binding@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-optional-catch-binding/-/plugin-transform-optional-catch-binding-7.27.1.tgz#84c7341ebde35ccd36b137e9e45866825072a30c" - integrity sha512-txEAEKzYrHEX4xSZN4kJ+OfKXFVSWKB2ZxM9dpcE3wT7smwkNmXo5ORRlVzMVdJbD+Q8ILTgSD7959uj+3Dm3Q== +"@babel/plugin-transform-optional-catch-binding@^7.28.6": + version "7.28.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-optional-catch-binding/-/plugin-transform-optional-catch-binding-7.28.6.tgz" + integrity sha512-R8ja/Pyrv0OGAvAXQhSTmWyPJPml+0TMqXlO5w+AsMEiwb2fg3WkOvob7UxFSL3OIttFSGSRFKQsOhJ/X6HQdQ== dependencies: - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-plugin-utils" "^7.28.6" -"@babel/plugin-transform-optional-chaining@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-optional-chaining/-/plugin-transform-optional-chaining-7.27.1.tgz#874ce3c4f06b7780592e946026eb76a32830454f" - integrity sha512-BQmKPPIuc8EkZgNKsv0X4bPmOoayeu4F1YCwx2/CfmDSXDbp7GnzlUH+/ul5VGfRg1AoFPsrIThlEBj2xb4CAg== +"@babel/plugin-transform-optional-chaining@^7.27.1", "@babel/plugin-transform-optional-chaining@^7.28.6": + version "7.28.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-optional-chaining/-/plugin-transform-optional-chaining-7.28.6.tgz" + integrity sha512-A4zobikRGJTsX9uqVFdafzGkqD30t26ck2LmOzAuLL8b2x6k3TIqRiT2xVvA9fNmFeTX484VpsdgmKNA0bS23w== dependencies: - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-plugin-utils" "^7.28.6" "@babel/helper-skip-transparent-expression-wrappers" "^7.27.1" "@babel/plugin-transform-parameters@^7.27.7": version "7.27.7" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.27.7.tgz#1fd2febb7c74e7d21cf3b05f7aebc907940af53a" + resolved "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.27.7.tgz" integrity sha512-qBkYTYCb76RRxUM6CcZA5KRu8K4SM8ajzVeUgVdMVO9NN9uI/GaVmBg/WKJJGnNokV9SY8FxNOVWGXzqzUidBg== dependencies: "@babel/helper-plugin-utils" "^7.27.1" -"@babel/plugin-transform-private-methods@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-private-methods/-/plugin-transform-private-methods-7.27.1.tgz#fdacbab1c5ed81ec70dfdbb8b213d65da148b6af" - integrity sha512-10FVt+X55AjRAYI9BrdISN9/AQWHqldOeZDUoLyif1Kn05a56xVBXb8ZouL8pZ9jem8QpXaOt8TS7RHUIS+GPA== +"@babel/plugin-transform-private-methods@^7.28.6": + version "7.28.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-private-methods/-/plugin-transform-private-methods-7.28.6.tgz" + integrity sha512-piiuapX9CRv7+0st8lmuUlRSmX6mBcVeNQ1b4AYzJxfCMuBfB0vBXDiGSmm03pKJw1v6cZ8KSeM+oUnM6yAExg== dependencies: - "@babel/helper-create-class-features-plugin" "^7.27.1" - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-create-class-features-plugin" "^7.28.6" + "@babel/helper-plugin-utils" "^7.28.6" -"@babel/plugin-transform-private-property-in-object@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-private-property-in-object/-/plugin-transform-private-property-in-object-7.27.1.tgz#4dbbef283b5b2f01a21e81e299f76e35f900fb11" - integrity sha512-5J+IhqTi1XPa0DXF83jYOaARrX+41gOewWbkPyjMNRDqgOCqdffGh8L3f/Ek5utaEBZExjSAzcyjmV9SSAWObQ== +"@babel/plugin-transform-private-property-in-object@^7.28.6": + version "7.28.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-private-property-in-object/-/plugin-transform-private-property-in-object-7.28.6.tgz" + integrity sha512-b97jvNSOb5+ehyQmBpmhOCiUC5oVK4PMnpRvO7+ymFBoqYjeDHIU9jnrNUuwHOiL9RpGDoKBpSViarV+BU+eVA== dependencies: - "@babel/helper-annotate-as-pure" "^7.27.1" - "@babel/helper-create-class-features-plugin" "^7.27.1" - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-annotate-as-pure" "^7.27.3" + "@babel/helper-create-class-features-plugin" "^7.28.6" + "@babel/helper-plugin-utils" "^7.28.6" "@babel/plugin-transform-property-literals@^7.27.1": version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.27.1.tgz#07eafd618800591e88073a0af1b940d9a42c6424" + resolved "https://registry.npmjs.org/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.27.1.tgz" integrity sha512-oThy3BCuCha8kDZ8ZkgOg2exvPYUlprMukKQXI1r1pJ47NCvxfkEy8vK+r/hT9nF0Aa4H1WUPZZjHTFtAhGfmQ== dependencies: "@babel/helper-plugin-utils" "^7.27.1" -"@babel/plugin-transform-regenerator@^7.28.0": - version "7.28.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.28.1.tgz#bde80603442ff4bb4e910bc8b35485295d556ab1" - integrity sha512-P0QiV/taaa3kXpLY+sXla5zec4E+4t4Aqc9ggHlfZ7a2cp8/x/Gv08jfwEtn9gnnYIMvHx6aoOZ8XJL8eU71Dg== +"@babel/plugin-transform-regenerator@^7.28.6": + version "7.28.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.28.6.tgz" + integrity sha512-eZhoEZHYQLL5uc1gS5e9/oTknS0sSSAtd5TkKMUp3J+S/CaUjagc0kOUPsEbDmMeva0nC3WWl4SxVY6+OBuxfw== dependencies: - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-plugin-utils" "^7.28.6" -"@babel/plugin-transform-regexp-modifiers@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-regexp-modifiers/-/plugin-transform-regexp-modifiers-7.27.1.tgz#df9ba5577c974e3f1449888b70b76169998a6d09" - integrity sha512-TtEciroaiODtXvLZv4rmfMhkCv8jx3wgKpL68PuiPh2M4fvz5jhsA7697N1gMvkvr/JTF13DrFYyEbY9U7cVPA== +"@babel/plugin-transform-regexp-modifiers@^7.28.6": + version "7.28.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-regexp-modifiers/-/plugin-transform-regexp-modifiers-7.28.6.tgz" + integrity sha512-QGWAepm9qxpaIs7UM9FvUSnCGlb8Ua1RhyM4/veAxLwt3gMat/LSGrZixyuj4I6+Kn9iwvqCyPTtbdxanYoWYg== dependencies: - "@babel/helper-create-regexp-features-plugin" "^7.27.1" - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-create-regexp-features-plugin" "^7.28.5" + "@babel/helper-plugin-utils" "^7.28.6" "@babel/plugin-transform-reserved-words@^7.27.1": version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.27.1.tgz#40fba4878ccbd1c56605a4479a3a891ac0274bb4" + resolved "https://registry.npmjs.org/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.27.1.tgz" integrity sha512-V2ABPHIJX4kC7HegLkYoDpfg9PVmuWy/i6vUM5eGK22bx4YVFD3M5F0QQnWQoDs6AGsUWTVOopBiMFQgHaSkVw== dependencies: "@babel/helper-plugin-utils" "^7.27.1" "@babel/plugin-transform-shorthand-properties@^7.27.1": version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.27.1.tgz#532abdacdec87bfee1e0ef8e2fcdee543fe32b90" + resolved "https://registry.npmjs.org/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.27.1.tgz" integrity sha512-N/wH1vcn4oYawbJ13Y/FxcQrWk63jhfNa7jef0ih7PHSIHX2LB7GWE1rkPrOnka9kwMxb6hMl19p7lidA+EHmQ== dependencies: "@babel/helper-plugin-utils" "^7.27.1" -"@babel/plugin-transform-spread@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-spread/-/plugin-transform-spread-7.27.1.tgz#1a264d5fc12750918f50e3fe3e24e437178abb08" - integrity sha512-kpb3HUqaILBJcRFVhFUs6Trdd4mkrzcGXss+6/mxUd273PfbWqSDHRzMT2234gIg2QYfAjvXLSquP1xECSg09Q== +"@babel/plugin-transform-spread@^7.28.6": + version "7.28.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-spread/-/plugin-transform-spread-7.28.6.tgz" + integrity sha512-9U4QObUC0FtJl05AsUcodau/RWDytrU6uKgkxu09mLR9HLDAtUMoPuuskm5huQsoktmsYpI+bGmq+iapDcriKA== dependencies: - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-plugin-utils" "^7.28.6" "@babel/helper-skip-transparent-expression-wrappers" "^7.27.1" "@babel/plugin-transform-sticky-regex@^7.27.1": version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.27.1.tgz#18984935d9d2296843a491d78a014939f7dcd280" + resolved "https://registry.npmjs.org/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.27.1.tgz" integrity sha512-lhInBO5bi/Kowe2/aLdBAawijx+q1pQzicSgnkB6dUPc1+RC8QmJHKf2OjvU+NZWitguJHEaEmbV6VWEouT58g== dependencies: "@babel/helper-plugin-utils" "^7.27.1" "@babel/plugin-transform-template-literals@^7.27.1": version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.27.1.tgz#1a0eb35d8bb3e6efc06c9fd40eb0bcef548328b8" + resolved "https://registry.npmjs.org/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.27.1.tgz" integrity sha512-fBJKiV7F2DxZUkg5EtHKXQdbsbURW3DZKQUWphDum0uRP6eHGGa/He9mc0mypL680pb+e/lDIthRohlv8NCHkg== dependencies: "@babel/helper-plugin-utils" "^7.27.1" "@babel/plugin-transform-typeof-symbol@^7.27.1": version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.27.1.tgz#70e966bb492e03509cf37eafa6dcc3051f844369" + resolved "https://registry.npmjs.org/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.27.1.tgz" integrity sha512-RiSILC+nRJM7FY5srIyc4/fGIwUhyDuuBSdWn4y6yT6gm652DpCHZjIipgn6B7MQ1ITOUnAKWixEUjQRIBIcLw== dependencies: "@babel/helper-plugin-utils" "^7.27.1" -"@babel/plugin-transform-typescript@^7.27.1": - version "7.28.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.28.0.tgz#796cbd249ab56c18168b49e3e1d341b72af04a6b" - integrity sha512-4AEiDEBPIZvLQaWlc9liCavE0xRM0dNca41WtBeM3jgFptfUOSG9z0uteLhq6+3rq+WB6jIvUwKDTpXEHPJ2Vg== +"@babel/plugin-transform-typescript@^7.28.5": + version "7.28.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.28.6.tgz" + integrity sha512-0YWL2RFxOqEm9Efk5PvreamxPME8OyY0wM5wh5lHjF+VtVhdneCWGzZeSqzOfiobVqQaNCd2z0tQvnI9DaPWPw== dependencies: "@babel/helper-annotate-as-pure" "^7.27.3" - "@babel/helper-create-class-features-plugin" "^7.27.1" - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-create-class-features-plugin" "^7.28.6" + "@babel/helper-plugin-utils" "^7.28.6" "@babel/helper-skip-transparent-expression-wrappers" "^7.27.1" - "@babel/plugin-syntax-typescript" "^7.27.1" + "@babel/plugin-syntax-typescript" "^7.28.6" "@babel/plugin-transform-unicode-escapes@^7.27.1": version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.27.1.tgz#3e3143f8438aef842de28816ece58780190cf806" + resolved "https://registry.npmjs.org/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.27.1.tgz" integrity sha512-Ysg4v6AmF26k9vpfFuTZg8HRfVWzsh1kVfowA23y9j/Gu6dOuahdUVhkLqpObp3JIv27MLSii6noRnuKN8H0Mg== dependencies: "@babel/helper-plugin-utils" "^7.27.1" -"@babel/plugin-transform-unicode-property-regex@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-property-regex/-/plugin-transform-unicode-property-regex-7.27.1.tgz#bdfe2d3170c78c5691a3c3be934c8c0087525956" - integrity sha512-uW20S39PnaTImxp39O5qFlHLS9LJEmANjMG7SxIhap8rCHqu0Ik+tLEPX5DKmHn6CsWQ7j3lix2tFOa5YtL12Q== +"@babel/plugin-transform-unicode-property-regex@^7.28.6": + version "7.28.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-unicode-property-regex/-/plugin-transform-unicode-property-regex-7.28.6.tgz" + integrity sha512-4Wlbdl/sIZjzi/8St0evF0gEZrgOswVO6aOzqxh1kDZOl9WmLrHq2HtGhnOJZmHZYKP8WZ1MDLCt5DAWwRo57A== dependencies: - "@babel/helper-create-regexp-features-plugin" "^7.27.1" - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-create-regexp-features-plugin" "^7.28.5" + "@babel/helper-plugin-utils" "^7.28.6" "@babel/plugin-transform-unicode-regex@^7.27.1": version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.27.1.tgz#25948f5c395db15f609028e370667ed8bae9af97" + resolved "https://registry.npmjs.org/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.27.1.tgz" integrity sha512-xvINq24TRojDuyt6JGtHmkVkrfVV3FPT16uytxImLeBZqW3/H52yN+kM1MGuyPkIQxrzKwPHs5U/MP3qKyzkGw== dependencies: "@babel/helper-create-regexp-features-plugin" "^7.27.1" "@babel/helper-plugin-utils" "^7.27.1" -"@babel/plugin-transform-unicode-sets-regex@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-sets-regex/-/plugin-transform-unicode-sets-regex-7.27.1.tgz#6ab706d10f801b5c72da8bb2548561fa04193cd1" - integrity sha512-EtkOujbc4cgvb0mlpQefi4NTPBzhSIevblFevACNLUspmrALgmEBdL/XfnyyITfd8fKBZrZys92zOWcik7j9Tw== +"@babel/plugin-transform-unicode-sets-regex@^7.28.6": + version "7.28.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-unicode-sets-regex/-/plugin-transform-unicode-sets-regex-7.28.6.tgz" + integrity sha512-/wHc/paTUmsDYN7SZkpWxogTOBNnlx7nBQYfy6JJlCT7G3mVhltk3e++N7zV0XfgGsrqBxd4rJQt9H16I21Y1Q== dependencies: - "@babel/helper-create-regexp-features-plugin" "^7.27.1" - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-create-regexp-features-plugin" "^7.28.5" + "@babel/helper-plugin-utils" "^7.28.6" "@babel/preset-env@^7.16.11": - version "7.28.0" - resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.28.0.tgz#d23a6bc17b43227d11db77081a0779c706b5569c" - integrity sha512-VmaxeGOwuDqzLl5JUkIRM1X2Qu2uKGxHEQWh+cvvbl7JuJRgKGJSfsEF/bUaxFhJl/XAyxBe7q7qSuTbKFuCyg== + version "7.28.6" + resolved "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.28.6.tgz" + integrity sha512-GaTI4nXDrs7l0qaJ6Rg06dtOXTBCG6TMDB44zbqofCIC4PqC7SEvmFFtpxzCDw9W5aJ7RKVshgXTLvLdBFV/qw== dependencies: - "@babel/compat-data" "^7.28.0" - "@babel/helper-compilation-targets" "^7.27.2" - "@babel/helper-plugin-utils" "^7.27.1" + "@babel/compat-data" "^7.28.6" + "@babel/helper-compilation-targets" "^7.28.6" + "@babel/helper-plugin-utils" "^7.28.6" "@babel/helper-validator-option" "^7.27.1" - "@babel/plugin-bugfix-firefox-class-in-computed-class-key" "^7.27.1" + "@babel/plugin-bugfix-firefox-class-in-computed-class-key" "^7.28.5" "@babel/plugin-bugfix-safari-class-field-initializer-scope" "^7.27.1" "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression" "^7.27.1" "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining" "^7.27.1" - "@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly" "^7.27.1" + "@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly" "^7.28.6" "@babel/plugin-proposal-private-property-in-object" "7.21.0-placeholder-for-preset-env.2" - "@babel/plugin-syntax-import-assertions" "^7.27.1" - "@babel/plugin-syntax-import-attributes" "^7.27.1" + "@babel/plugin-syntax-import-assertions" "^7.28.6" + "@babel/plugin-syntax-import-attributes" "^7.28.6" "@babel/plugin-syntax-unicode-sets-regex" "^7.18.6" "@babel/plugin-transform-arrow-functions" "^7.27.1" - "@babel/plugin-transform-async-generator-functions" "^7.28.0" - "@babel/plugin-transform-async-to-generator" "^7.27.1" + "@babel/plugin-transform-async-generator-functions" "^7.28.6" + "@babel/plugin-transform-async-to-generator" "^7.28.6" "@babel/plugin-transform-block-scoped-functions" "^7.27.1" - "@babel/plugin-transform-block-scoping" "^7.28.0" - "@babel/plugin-transform-class-properties" "^7.27.1" - "@babel/plugin-transform-class-static-block" "^7.27.1" - "@babel/plugin-transform-classes" "^7.28.0" - "@babel/plugin-transform-computed-properties" "^7.27.1" - "@babel/plugin-transform-destructuring" "^7.28.0" - "@babel/plugin-transform-dotall-regex" "^7.27.1" + "@babel/plugin-transform-block-scoping" "^7.28.6" + "@babel/plugin-transform-class-properties" "^7.28.6" + "@babel/plugin-transform-class-static-block" "^7.28.6" + "@babel/plugin-transform-classes" "^7.28.6" + "@babel/plugin-transform-computed-properties" "^7.28.6" + "@babel/plugin-transform-destructuring" "^7.28.5" + "@babel/plugin-transform-dotall-regex" "^7.28.6" "@babel/plugin-transform-duplicate-keys" "^7.27.1" - "@babel/plugin-transform-duplicate-named-capturing-groups-regex" "^7.27.1" + "@babel/plugin-transform-duplicate-named-capturing-groups-regex" "^7.28.6" "@babel/plugin-transform-dynamic-import" "^7.27.1" - "@babel/plugin-transform-explicit-resource-management" "^7.28.0" - "@babel/plugin-transform-exponentiation-operator" "^7.27.1" + "@babel/plugin-transform-explicit-resource-management" "^7.28.6" + "@babel/plugin-transform-exponentiation-operator" "^7.28.6" "@babel/plugin-transform-export-namespace-from" "^7.27.1" "@babel/plugin-transform-for-of" "^7.27.1" "@babel/plugin-transform-function-name" "^7.27.1" - "@babel/plugin-transform-json-strings" "^7.27.1" + "@babel/plugin-transform-json-strings" "^7.28.6" "@babel/plugin-transform-literals" "^7.27.1" - "@babel/plugin-transform-logical-assignment-operators" "^7.27.1" + "@babel/plugin-transform-logical-assignment-operators" "^7.28.6" "@babel/plugin-transform-member-expression-literals" "^7.27.1" "@babel/plugin-transform-modules-amd" "^7.27.1" - "@babel/plugin-transform-modules-commonjs" "^7.27.1" - "@babel/plugin-transform-modules-systemjs" "^7.27.1" + "@babel/plugin-transform-modules-commonjs" "^7.28.6" + "@babel/plugin-transform-modules-systemjs" "^7.28.5" "@babel/plugin-transform-modules-umd" "^7.27.1" "@babel/plugin-transform-named-capturing-groups-regex" "^7.27.1" "@babel/plugin-transform-new-target" "^7.27.1" - "@babel/plugin-transform-nullish-coalescing-operator" "^7.27.1" - "@babel/plugin-transform-numeric-separator" "^7.27.1" - "@babel/plugin-transform-object-rest-spread" "^7.28.0" + "@babel/plugin-transform-nullish-coalescing-operator" "^7.28.6" + "@babel/plugin-transform-numeric-separator" "^7.28.6" + "@babel/plugin-transform-object-rest-spread" "^7.28.6" "@babel/plugin-transform-object-super" "^7.27.1" - "@babel/plugin-transform-optional-catch-binding" "^7.27.1" - "@babel/plugin-transform-optional-chaining" "^7.27.1" + "@babel/plugin-transform-optional-catch-binding" "^7.28.6" + "@babel/plugin-transform-optional-chaining" "^7.28.6" "@babel/plugin-transform-parameters" "^7.27.7" - "@babel/plugin-transform-private-methods" "^7.27.1" - "@babel/plugin-transform-private-property-in-object" "^7.27.1" + "@babel/plugin-transform-private-methods" "^7.28.6" + "@babel/plugin-transform-private-property-in-object" "^7.28.6" "@babel/plugin-transform-property-literals" "^7.27.1" - "@babel/plugin-transform-regenerator" "^7.28.0" - "@babel/plugin-transform-regexp-modifiers" "^7.27.1" + "@babel/plugin-transform-regenerator" "^7.28.6" + "@babel/plugin-transform-regexp-modifiers" "^7.28.6" "@babel/plugin-transform-reserved-words" "^7.27.1" "@babel/plugin-transform-shorthand-properties" "^7.27.1" - "@babel/plugin-transform-spread" "^7.27.1" + "@babel/plugin-transform-spread" "^7.28.6" "@babel/plugin-transform-sticky-regex" "^7.27.1" "@babel/plugin-transform-template-literals" "^7.27.1" "@babel/plugin-transform-typeof-symbol" "^7.27.1" "@babel/plugin-transform-unicode-escapes" "^7.27.1" - "@babel/plugin-transform-unicode-property-regex" "^7.27.1" + "@babel/plugin-transform-unicode-property-regex" "^7.28.6" "@babel/plugin-transform-unicode-regex" "^7.27.1" - "@babel/plugin-transform-unicode-sets-regex" "^7.27.1" + "@babel/plugin-transform-unicode-sets-regex" "^7.28.6" "@babel/preset-modules" "0.1.6-no-external-plugins" babel-plugin-polyfill-corejs2 "^0.4.14" babel-plugin-polyfill-corejs3 "^0.13.0" @@ -895,7 +870,7 @@ "@babel/preset-modules@0.1.6-no-external-plugins": version "0.1.6-no-external-plugins" - resolved "https://registry.yarnpkg.com/@babel/preset-modules/-/preset-modules-0.1.6-no-external-plugins.tgz#ccb88a2c49c817236861fee7826080573b8a923a" + resolved "https://registry.npmjs.org/@babel/preset-modules/-/preset-modules-0.1.6-no-external-plugins.tgz" integrity sha512-HrcgcIESLm9aIR842yhJ5RWan/gebQUJ6E/E5+rf0y9o6oj7w0Br+sWuL6kEQ/o/AdfvR1Je9jG18/gnpwjEyA== dependencies: "@babel/helper-plugin-utils" "^7.0.0" @@ -903,88 +878,66 @@ esutils "^2.0.2" "@babel/preset-typescript@^7.16.7": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/preset-typescript/-/preset-typescript-7.27.1.tgz#190742a6428d282306648a55b0529b561484f912" - integrity sha512-l7WfQfX0WK4M0v2RudjuQK4u99BS6yLHYEmdtVPP7lKV013zr9DygFuWNlnbvQ9LR+LS0Egz/XAvGx5U9MX0fQ== + version "7.28.5" + resolved "https://registry.npmjs.org/@babel/preset-typescript/-/preset-typescript-7.28.5.tgz" + integrity sha512-+bQy5WOI2V6LJZpPVxY+yp66XdZ2yifu0Mc1aP5CQKgjn4QM5IN2i5fAZ4xKop47pr8rpVhiAeu+nDQa12C8+g== dependencies: "@babel/helper-plugin-utils" "^7.27.1" "@babel/helper-validator-option" "^7.27.1" "@babel/plugin-syntax-jsx" "^7.27.1" "@babel/plugin-transform-modules-commonjs" "^7.27.1" - "@babel/plugin-transform-typescript" "^7.27.1" - -"@babel/template@^7.27.1", "@babel/template@^7.27.2", "@babel/template@^7.3.3": - version "7.27.2" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.27.2.tgz#fa78ceed3c4e7b63ebf6cb39e5852fca45f6809d" - integrity sha512-LPDZ85aEJyYSd18/DkjNh4/y1ntkE5KwUHWTiqgRxruuZL2F1yuHligVHLvcHY2vMHXttKFpJn6LwfI7cw7ODw== - dependencies: - "@babel/code-frame" "^7.27.1" - "@babel/parser" "^7.27.2" - "@babel/types" "^7.27.1" - -"@babel/traverse@^7.27.1", "@babel/traverse@^7.27.3", "@babel/traverse@^7.28.0", "@babel/traverse@^7.7.2": - version "7.28.0" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.28.0.tgz#518aa113359b062042379e333db18380b537e34b" - integrity sha512-mGe7UK5wWyh0bKRfupsUchrQGqvDbZDbKJw+kcRGSmdHVYrv+ltd0pnpDTVpiTqnaBru9iEvA8pz8W46v0Amwg== - dependencies: - "@babel/code-frame" "^7.27.1" - "@babel/generator" "^7.28.0" - "@babel/helper-globals" "^7.28.0" - "@babel/parser" "^7.28.0" - "@babel/template" "^7.27.2" - "@babel/types" "^7.28.0" + "@babel/plugin-transform-typescript" "^7.28.5" + +"@babel/template@^7.28.6", "@babel/template@^7.29.7", "@babel/template@^7.3.3": + version "7.29.7" + resolved "https://registry.npmjs.org/@babel/template/-/template-7.29.7.tgz" + integrity sha512-puq+Gf35oI24FeN11LkoUQFqv9uwNeWpxXZi/Ji3rRIoKAzKnxRaZ+Gkj0vKS9ZCiTESfng1N9LyOyXvo+m+Gg== + dependencies: + "@babel/code-frame" "^7.29.7" + "@babel/parser" "^7.29.7" + "@babel/types" "^7.29.7" + +"@babel/traverse@^7.27.1", "@babel/traverse@^7.28.5", "@babel/traverse@^7.28.6", "@babel/traverse@^7.29.7": + version "7.29.7" + resolved "https://registry.npmjs.org/@babel/traverse/-/traverse-7.29.7.tgz" + integrity sha512-EhlfNQtZ+NK22w5BM61ciuiq1m58ed33Wr1Xan//ZRTy6hgjnwyCffRYwzsGXdASJSUJ1guZILsErh1eQcl+zw== + dependencies: + "@babel/code-frame" "^7.29.7" + "@babel/generator" "^7.29.7" + "@babel/helper-globals" "^7.29.7" + "@babel/parser" "^7.29.7" + "@babel/template" "^7.29.7" + "@babel/types" "^7.29.7" debug "^4.3.1" -"@babel/types@^7.0.0", "@babel/types@^7.20.7", "@babel/types@^7.27.1", "@babel/types@^7.27.3", "@babel/types@^7.28.0", "@babel/types@^7.28.2", "@babel/types@^7.3.3", "@babel/types@^7.4.4": - version "7.28.2" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.28.2.tgz#da9db0856a9a88e0a13b019881d7513588cf712b" - integrity sha512-ruv7Ae4J5dUYULmeXw1gmb7rYRz57OWCPM57pHojnLq/3Z1CK2lNSLTCVjxVk1F/TZHwOZZrOWi0ur95BbLxNQ== +"@babel/types@^7.0.0", "@babel/types@^7.20.7", "@babel/types@^7.27.1", "@babel/types@^7.27.3", "@babel/types@^7.28.2", "@babel/types@^7.28.5", "@babel/types@^7.28.6", "@babel/types@^7.29.7", "@babel/types@^7.3.3", "@babel/types@^7.4.4": + version "7.29.7" + resolved "https://registry.npmjs.org/@babel/types/-/types-7.29.7.tgz" + integrity sha512-4zBIxpPzowiZpusoFkyGVwakdRJUyuH5PxQ/PrqghfdFWWasvnCdPfQXHrenDai+gyLARulZjZowCOj6fjT4pA== dependencies: - "@babel/helper-string-parser" "^7.27.1" - "@babel/helper-validator-identifier" "^7.27.1" + "@babel/helper-string-parser" "^7.29.7" + "@babel/helper-validator-identifier" "^7.29.7" "@bcoe/v8-coverage@^0.2.3": version "0.2.3" - resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" + resolved "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@cspotcode/source-map-support@^0.8.0": - version "0.8.1" - resolved "https://registry.yarnpkg.com/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz#00629c35a688e05a88b1cda684fb9d5e73f000a1" - integrity sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw== - dependencies: - "@jridgewell/trace-mapping" "0.3.9" - -"@eslint-community/eslint-utils@^4.2.0": - version "4.7.0" - resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.7.0.tgz#607084630c6c033992a082de6e6fbc1a8b52175a" - integrity sha512-dyybb3AcajC7uha6CvhdVRJqaKyn7w2YKqKyAN37NKYgZT36w+iRb0Dymmc5qEJ549c/S31cMMSFd75bteCpCw== +"@eslint-community/eslint-utils@^4.2.0", "@eslint-community/eslint-utils@^4.4.0": + version "4.9.1" + resolved "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.9.1.tgz" + integrity sha512-phrYmNiYppR7znFEdqgfWHXR6NCkZEK7hwWDHZUjit/2/U0r6XvkDl0SYnoM51Hq7FhCGdLDT6zxCCOY1hexsQ== dependencies: eslint-visitor-keys "^3.4.3" -"@eslint-community/regexpp@^4.4.0", "@eslint-community/regexpp@^4.6.1": - version "4.12.1" - resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.12.1.tgz#cfc6cffe39df390a3841cde2abccf92eaa7ae0e0" - integrity sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ== - -"@eslint/eslintrc@^0.4.3": - version "0.4.3" - resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-0.4.3.tgz#9e42981ef035beb3dd49add17acb96e8ff6f394c" - integrity sha512-J6KFFz5QCYUJq3pf0mjEcCJVERbzv71PUIDczuh9JkwGEzced6CO5ADLHB1rbf/+oPBtoPfMYNOpGDzCANlbXw== - dependencies: - ajv "^6.12.4" - debug "^4.1.1" - espree "^7.3.0" - globals "^13.9.0" - ignore "^4.0.6" - import-fresh "^3.2.1" - js-yaml "^3.13.1" - minimatch "^3.0.4" - strip-json-comments "^3.1.1" +"@eslint-community/regexpp@^4.10.0", "@eslint-community/regexpp@^4.6.1": + version "4.12.2" + resolved "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.2.tgz" + integrity sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew== "@eslint/eslintrc@^2.1.4": version "2.1.4" - resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-2.1.4.tgz#388a269f0f25c1b6adc317b5a2c55714894c70ad" + resolved "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.4.tgz" integrity sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ== dependencies: ajv "^6.12.4" @@ -999,392 +952,31 @@ "@eslint/js@8.57.1": version "8.57.1" - resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.57.1.tgz#de633db3ec2ef6a3c89e2f19038063e8a122e2c2" + resolved "https://registry.npmjs.org/@eslint/js/-/js-8.57.1.tgz" integrity sha512-d9zaMRSTIKDLhctzH12MtXvJKSSUhaHcjV+2Z+GK+EEY7XKpP5yR4x+N3TAcHTcu963nIr+TMcCb4DBCYX1z6Q== -"@ethersproject/abi@5.8.0", "@ethersproject/abi@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/abi/-/abi-5.8.0.tgz#e79bb51940ac35fe6f3262d7fe2cdb25ad5f07d9" - integrity sha512-b9YS/43ObplgyV6SlyQsG53/vkSal0MNA1fskSC4mbnCMi8R+NkcH8K9FPYNESf6jUefBUniE4SOKms0E/KK1Q== - dependencies: - "@ethersproject/address" "^5.8.0" - "@ethersproject/bignumber" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/constants" "^5.8.0" - "@ethersproject/hash" "^5.8.0" - "@ethersproject/keccak256" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - "@ethersproject/strings" "^5.8.0" - -"@ethersproject/abstract-provider@5.8.0", "@ethersproject/abstract-provider@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/abstract-provider/-/abstract-provider-5.8.0.tgz#7581f9be601afa1d02b95d26b9d9840926a35b0c" - integrity sha512-wC9SFcmh4UK0oKuLJQItoQdzS/qZ51EJegK6EmAWlh+OptpQ/npECOR3QqECd8iGHC0RJb4WKbVdSfif4ammrg== - dependencies: - "@ethersproject/bignumber" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/networks" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - "@ethersproject/transactions" "^5.8.0" - "@ethersproject/web" "^5.8.0" - -"@ethersproject/abstract-signer@5.8.0", "@ethersproject/abstract-signer@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/abstract-signer/-/abstract-signer-5.8.0.tgz#8d7417e95e4094c1797a9762e6789c7356db0754" - integrity sha512-N0XhZTswXcmIZQdYtUnd79VJzvEwXQw6PK0dTl9VoYrEBxxCPXqS0Eod7q5TNKRxe1/5WUMuR0u0nqTF/avdCA== - dependencies: - "@ethersproject/abstract-provider" "^5.8.0" - "@ethersproject/bignumber" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - -"@ethersproject/address@5.8.0", "@ethersproject/address@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/address/-/address-5.8.0.tgz#3007a2c352eee566ad745dca1dbbebdb50a6a983" - integrity sha512-GhH/abcC46LJwshoN+uBNoKVFPxUuZm6dA257z0vZkKmU1+t8xTn8oK7B9qrj8W2rFRMch4gbJl6PmVxjxBEBA== - dependencies: - "@ethersproject/bignumber" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/keccak256" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/rlp" "^5.8.0" - -"@ethersproject/base64@5.8.0", "@ethersproject/base64@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/base64/-/base64-5.8.0.tgz#61c669c648f6e6aad002c228465d52ac93ee83eb" - integrity sha512-lN0oIwfkYj9LbPx4xEkie6rAMJtySbpOAFXSDVQaBnAzYfB4X2Qr+FXJGxMoc3Bxp2Sm8OwvzMrywxyw0gLjIQ== - dependencies: - "@ethersproject/bytes" "^5.8.0" - -"@ethersproject/basex@5.8.0", "@ethersproject/basex@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/basex/-/basex-5.8.0.tgz#1d279a90c4be84d1c1139114a1f844869e57d03a" - integrity sha512-PIgTszMlDRmNwW9nhS6iqtVfdTAKosA7llYXNmGPw4YAI1PUyMv28988wAb41/gHF/WqGdoLv0erHaRcHRKW2Q== - dependencies: - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - -"@ethersproject/bignumber@5.8.0", "@ethersproject/bignumber@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/bignumber/-/bignumber-5.8.0.tgz#c381d178f9eeb370923d389284efa19f69efa5d7" - integrity sha512-ZyaT24bHaSeJon2tGPKIiHszWjD/54Sz8t57Toch475lCLljC6MgPmxk7Gtzz+ddNN5LuHea9qhAe0x3D+uYPA== - dependencies: - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - bn.js "^5.2.1" - -"@ethersproject/bytes@5.8.0", "@ethersproject/bytes@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/bytes/-/bytes-5.8.0.tgz#9074820e1cac7507a34372cadeb035461463be34" - integrity sha512-vTkeohgJVCPVHu5c25XWaWQOZ4v+DkGoC42/TS2ond+PARCxTJvgTFUNDZovyQ/uAQ4EcpqqowKydcdmRKjg7A== - dependencies: - "@ethersproject/logger" "^5.8.0" - -"@ethersproject/constants@5.8.0", "@ethersproject/constants@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/constants/-/constants-5.8.0.tgz#12f31c2f4317b113a4c19de94e50933648c90704" - integrity sha512-wigX4lrf5Vu+axVTIvNsuL6YrV4O5AXl5ubcURKMEME5TnWBouUh0CDTWxZ2GpnRn1kcCgE7l8O5+VbV9QTTcg== - dependencies: - "@ethersproject/bignumber" "^5.8.0" - -"@ethersproject/contracts@5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/contracts/-/contracts-5.8.0.tgz#243a38a2e4aa3e757215ea64e276f8a8c9d8ed73" - integrity sha512-0eFjGz9GtuAi6MZwhb4uvUM216F38xiuR0yYCjKJpNfSEy4HUM8hvqqBj9Jmm0IUz8l0xKEhWwLIhPgxNY0yvQ== - dependencies: - "@ethersproject/abi" "^5.8.0" - "@ethersproject/abstract-provider" "^5.8.0" - "@ethersproject/abstract-signer" "^5.8.0" - "@ethersproject/address" "^5.8.0" - "@ethersproject/bignumber" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/constants" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - "@ethersproject/transactions" "^5.8.0" - -"@ethersproject/hash@5.8.0", "@ethersproject/hash@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/hash/-/hash-5.8.0.tgz#b8893d4629b7f8462a90102572f8cd65a0192b4c" - integrity sha512-ac/lBcTbEWW/VGJij0CNSw/wPcw9bSRgCB0AIBz8CvED/jfvDoV9hsIIiWfvWmFEi8RcXtlNwp2jv6ozWOsooA== - dependencies: - "@ethersproject/abstract-signer" "^5.8.0" - "@ethersproject/address" "^5.8.0" - "@ethersproject/base64" "^5.8.0" - "@ethersproject/bignumber" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/keccak256" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - "@ethersproject/strings" "^5.8.0" - -"@ethersproject/hdnode@5.8.0", "@ethersproject/hdnode@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/hdnode/-/hdnode-5.8.0.tgz#a51ae2a50bcd48ef6fd108c64cbae5e6ff34a761" - integrity sha512-4bK1VF6E83/3/Im0ERnnUeWOY3P1BZml4ZD3wcH8Ys0/d1h1xaFt6Zc+Dh9zXf9TapGro0T4wvO71UTCp3/uoA== - dependencies: - "@ethersproject/abstract-signer" "^5.8.0" - "@ethersproject/basex" "^5.8.0" - "@ethersproject/bignumber" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/pbkdf2" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - "@ethersproject/sha2" "^5.8.0" - "@ethersproject/signing-key" "^5.8.0" - "@ethersproject/strings" "^5.8.0" - "@ethersproject/transactions" "^5.8.0" - "@ethersproject/wordlists" "^5.8.0" - -"@ethersproject/json-wallets@5.8.0", "@ethersproject/json-wallets@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/json-wallets/-/json-wallets-5.8.0.tgz#d18de0a4cf0f185f232eb3c17d5e0744d97eb8c9" - integrity sha512-HxblNck8FVUtNxS3VTEYJAcwiKYsBIF77W15HufqlBF9gGfhmYOJtYZp8fSDZtn9y5EaXTE87zDwzxRoTFk11w== - dependencies: - "@ethersproject/abstract-signer" "^5.8.0" - "@ethersproject/address" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/hdnode" "^5.8.0" - "@ethersproject/keccak256" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/pbkdf2" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - "@ethersproject/random" "^5.8.0" - "@ethersproject/strings" "^5.8.0" - "@ethersproject/transactions" "^5.8.0" - aes-js "3.0.0" - scrypt-js "3.0.1" - -"@ethersproject/keccak256@5.8.0", "@ethersproject/keccak256@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/keccak256/-/keccak256-5.8.0.tgz#d2123a379567faf2d75d2aaea074ffd4df349e6a" - integrity sha512-A1pkKLZSz8pDaQ1ftutZoaN46I6+jvuqugx5KYNeQOPqq+JZ0Txm7dlWesCHB5cndJSu5vP2VKptKf7cksERng== - dependencies: - "@ethersproject/bytes" "^5.8.0" - js-sha3 "0.8.0" - -"@ethersproject/logger@5.8.0", "@ethersproject/logger@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/logger/-/logger-5.8.0.tgz#f0232968a4f87d29623a0481690a2732662713d6" - integrity sha512-Qe6knGmY+zPPWTC+wQrpitodgBfH7XoceCGL5bJVejmH+yCS3R8jJm8iiWuvWbG76RUmyEG53oqv6GMVWqunjA== - -"@ethersproject/networks@5.8.0", "@ethersproject/networks@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/networks/-/networks-5.8.0.tgz#8b4517a3139380cba9fb00b63ffad0a979671fde" - integrity sha512-egPJh3aPVAzbHwq8DD7Po53J4OUSsA1MjQp8Vf/OZPav5rlmWUaFLiq8cvQiGK0Z5K6LYzm29+VA/p4RL1FzNg== - dependencies: - "@ethersproject/logger" "^5.8.0" - -"@ethersproject/pbkdf2@5.8.0", "@ethersproject/pbkdf2@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/pbkdf2/-/pbkdf2-5.8.0.tgz#cd2621130e5dd51f6a0172e63a6e4a0c0a0ec37e" - integrity sha512-wuHiv97BrzCmfEaPbUFpMjlVg/IDkZThp9Ri88BpjRleg4iePJaj2SW8AIyE8cXn5V1tuAaMj6lzvsGJkGWskg== - dependencies: - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/sha2" "^5.8.0" - -"@ethersproject/properties@5.8.0", "@ethersproject/properties@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/properties/-/properties-5.8.0.tgz#405a8affb6311a49a91dabd96aeeae24f477020e" - integrity sha512-PYuiEoQ+FMaZZNGrStmN7+lWjlsoufGIHdww7454FIaGdbe/p5rnaCXTr5MtBYl3NkeoVhHZuyzChPeGeKIpQw== - dependencies: - "@ethersproject/logger" "^5.8.0" - -"@ethersproject/providers@5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/providers/-/providers-5.8.0.tgz#6c2ae354f7f96ee150439f7de06236928bc04cb4" - integrity sha512-3Il3oTzEx3o6kzcg9ZzbE+oCZYyY+3Zh83sKkn4s1DZfTUjIegHnN2Cm0kbn9YFy45FDVcuCLLONhU7ny0SsCw== - dependencies: - "@ethersproject/abstract-provider" "^5.8.0" - "@ethersproject/abstract-signer" "^5.8.0" - "@ethersproject/address" "^5.8.0" - "@ethersproject/base64" "^5.8.0" - "@ethersproject/basex" "^5.8.0" - "@ethersproject/bignumber" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/constants" "^5.8.0" - "@ethersproject/hash" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/networks" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - "@ethersproject/random" "^5.8.0" - "@ethersproject/rlp" "^5.8.0" - "@ethersproject/sha2" "^5.8.0" - "@ethersproject/strings" "^5.8.0" - "@ethersproject/transactions" "^5.8.0" - "@ethersproject/web" "^5.8.0" - bech32 "1.1.4" - ws "8.18.0" - -"@ethersproject/random@5.8.0", "@ethersproject/random@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/random/-/random-5.8.0.tgz#1bced04d49449f37c6437c701735a1a022f0057a" - integrity sha512-E4I5TDl7SVqyg4/kkA/qTfuLWAQGXmSOgYyO01So8hLfwgKvYK5snIlzxJMk72IFdG/7oh8yuSqY2KX7MMwg+A== - dependencies: - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - -"@ethersproject/rlp@5.8.0", "@ethersproject/rlp@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/rlp/-/rlp-5.8.0.tgz#5a0d49f61bc53e051532a5179472779141451de5" - integrity sha512-LqZgAznqDbiEunaUvykH2JAoXTT9NV0Atqk8rQN9nx9SEgThA/WMx5DnW8a9FOufo//6FZOCHZ+XiClzgbqV9Q== - dependencies: - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - -"@ethersproject/sha2@5.8.0", "@ethersproject/sha2@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/sha2/-/sha2-5.8.0.tgz#8954a613bb78dac9b46829c0a95de561ef74e5e1" - integrity sha512-dDOUrXr9wF/YFltgTBYS0tKslPEKr6AekjqDW2dbn1L1xmjGR+9GiKu4ajxovnrDbwxAKdHjW8jNcwfz8PAz4A== - dependencies: - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - hash.js "1.1.7" - -"@ethersproject/signing-key@5.8.0", "@ethersproject/signing-key@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/signing-key/-/signing-key-5.8.0.tgz#9797e02c717b68239c6349394ea85febf8893119" - integrity sha512-LrPW2ZxoigFi6U6aVkFN/fa9Yx/+4AtIUe4/HACTvKJdhm0eeb107EVCIQcrLZkxaSIgc/eCrX8Q1GtbH+9n3w== - dependencies: - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - bn.js "^5.2.1" - elliptic "6.6.1" - hash.js "1.1.7" - -"@ethersproject/solidity@5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/solidity/-/solidity-5.8.0.tgz#429bb9fcf5521307a9448d7358c26b93695379b9" - integrity sha512-4CxFeCgmIWamOHwYN9d+QWGxye9qQLilpgTU0XhYs1OahkclF+ewO+3V1U0mvpiuQxm5EHHmv8f7ClVII8EHsA== - dependencies: - "@ethersproject/bignumber" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/keccak256" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/sha2" "^5.8.0" - "@ethersproject/strings" "^5.8.0" - -"@ethersproject/strings@5.8.0", "@ethersproject/strings@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/strings/-/strings-5.8.0.tgz#ad79fafbf0bd272d9765603215ac74fd7953908f" - integrity sha512-qWEAk0MAvl0LszjdfnZ2uC8xbR2wdv4cDabyHiBh3Cldq/T8dPH3V4BbBsAYJUeonwD+8afVXld274Ls+Y1xXg== - dependencies: - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/constants" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - -"@ethersproject/transactions@5.8.0", "@ethersproject/transactions@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/transactions/-/transactions-5.8.0.tgz#1e518822403abc99def5a043d1c6f6fe0007e46b" - integrity sha512-UglxSDjByHG0TuU17bDfCemZ3AnKO2vYrL5/2n2oXvKzvb7Cz+W9gOWXKARjp2URVwcWlQlPOEQyAviKwT4AHg== - dependencies: - "@ethersproject/address" "^5.8.0" - "@ethersproject/bignumber" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/constants" "^5.8.0" - "@ethersproject/keccak256" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - "@ethersproject/rlp" "^5.8.0" - "@ethersproject/signing-key" "^5.8.0" - -"@ethersproject/units@5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/units/-/units-5.8.0.tgz#c12f34ba7c3a2de0e9fa0ed0ee32f3e46c5c2c6a" - integrity sha512-lxq0CAnc5kMGIiWW4Mr041VT8IhNM+Pn5T3haO74XZWFulk7wH1Gv64HqE96hT4a7iiNMdOCFEBgaxWuk8ETKQ== - dependencies: - "@ethersproject/bignumber" "^5.8.0" - "@ethersproject/constants" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - -"@ethersproject/wallet@5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/wallet/-/wallet-5.8.0.tgz#49c300d10872e6986d953e8310dc33d440da8127" - integrity sha512-G+jnzmgg6UxurVKRKvw27h0kvG75YKXZKdlLYmAHeF32TGUzHkOFd7Zn6QHOTYRFWnfjtSSFjBowKo7vfrXzPA== - dependencies: - "@ethersproject/abstract-provider" "^5.8.0" - "@ethersproject/abstract-signer" "^5.8.0" - "@ethersproject/address" "^5.8.0" - "@ethersproject/bignumber" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/hash" "^5.8.0" - "@ethersproject/hdnode" "^5.8.0" - "@ethersproject/json-wallets" "^5.8.0" - "@ethersproject/keccak256" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - "@ethersproject/random" "^5.8.0" - "@ethersproject/signing-key" "^5.8.0" - "@ethersproject/transactions" "^5.8.0" - "@ethersproject/wordlists" "^5.8.0" - -"@ethersproject/web@5.8.0", "@ethersproject/web@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/web/-/web-5.8.0.tgz#3e54badc0013b7a801463a7008a87988efce8a37" - integrity sha512-j7+Ksi/9KfGviws6Qtf9Q7KCqRhpwrYKQPs+JBA/rKVFF/yaWLHJEH3zfVP2plVu+eys0d2DlFmhoQJayFewcw== - dependencies: - "@ethersproject/base64" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - "@ethersproject/strings" "^5.8.0" - -"@ethersproject/wordlists@5.8.0", "@ethersproject/wordlists@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/wordlists/-/wordlists-5.8.0.tgz#7a5654ee8d1bb1f4dbe43f91d217356d650ad821" - integrity sha512-2df9bbXicZws2Sb5S6ET493uJ0Z84Fjr3pC4tu/qlnZERibZCeUVuqdtt+7Tv9xxhUxHoIekIA7avrKUWHrezg== - dependencies: - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/hash" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - "@ethersproject/strings" "^5.8.0" - "@humanwhocodes/config-array@^0.13.0": version "0.13.0" - resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.13.0.tgz#fb907624df3256d04b9aa2df50d7aa97ec648748" + resolved "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.13.0.tgz" integrity sha512-DZLEEqFWQFiyK6h5YIeynKx7JlvCYWL0cImfSRXZ9l4Sg2efkFGTuFf6vzXjK1cq6IYkU+Eg/JizXw+TD2vRNw== dependencies: "@humanwhocodes/object-schema" "^2.0.3" debug "^4.3.1" minimatch "^3.0.5" -"@humanwhocodes/config-array@^0.5.0": - version "0.5.0" - resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.5.0.tgz#1407967d4c6eecd7388f83acf1eaf4d0c6e58ef9" - integrity sha512-FagtKFz74XrTl7y6HCzQpwDfXP0yhxe9lHLD1UZxjvZIcbyRz8zTFF/yYNfSfzU414eDwZ1SrO0Qvtyf+wFMQg== - dependencies: - "@humanwhocodes/object-schema" "^1.2.0" - debug "^4.1.1" - minimatch "^3.0.4" - "@humanwhocodes/module-importer@^1.0.1": version "1.0.1" - resolved "https://registry.yarnpkg.com/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz#af5b2691a22b44be847b0ca81641c5fb6ad0172c" + resolved "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz" integrity sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA== -"@humanwhocodes/object-schema@^1.2.0": - version "1.2.1" - resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz#b520529ec21d8e5945a1851dfd1c32e94e39ff45" - integrity sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA== - "@humanwhocodes/object-schema@^2.0.3": version "2.0.3" - resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz#4a2868d75d6d6963e423bcf90b7fd1be343409d3" + resolved "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz" integrity sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA== -"@hutson/parse-repository-url@^3.0.0": - version "3.0.2" - resolved "https://registry.yarnpkg.com/@hutson/parse-repository-url/-/parse-repository-url-3.0.2.tgz#98c23c950a3d9b6c8f0daed06da6c3af06981340" - integrity sha512-H9XAx3hc0BQHY6l+IFSWHDySypcXsvsuLhgYLUGywmJ5pswRVQJUHpOsobnLYp2ZUaUlKiKDrgWWhosOwAEM8Q== - "@istanbuljs/load-nyc-config@^1.0.0": version "1.1.0" - resolved "https://registry.yarnpkg.com/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz#fd3db1d59ecf7cf121e80650bb86712f9b55eced" + resolved "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz" integrity sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ== dependencies: camelcase "^5.3.1" @@ -1393,237 +985,240 @@ js-yaml "^3.13.1" resolve-from "^5.0.0" -"@istanbuljs/schema@^0.1.2": +"@istanbuljs/schema@^0.1.2", "@istanbuljs/schema@^0.1.3": version "0.1.3" - resolved "https://registry.yarnpkg.com/@istanbuljs/schema/-/schema-0.1.3.tgz#e45e384e4b8ec16bce2fd903af78450f6bf7ec98" + resolved "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz" integrity sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA== -"@jest/console@^27.5.1": - version "27.5.1" - resolved "https://registry.yarnpkg.com/@jest/console/-/console-27.5.1.tgz#260fe7239602fe5130a94f1aa386eff54b014bba" - integrity sha512-kZ/tNpS3NXn0mlXXXPNuDZnb4c0oZ20r4K5eemM2k30ZC3G0T02nXUvyhf5YdbXWHPEJLc9qGLxEZ216MdL+Zg== +"@jest/console@^29.7.0": + version "29.7.0" + resolved "https://registry.npmjs.org/@jest/console/-/console-29.7.0.tgz" + integrity sha512-5Ni4CU7XHQi32IJ398EEP4RrB8eV09sXP2ROqD4bksHrnTree52PsxvX8tpL8LvTZ3pFzXyPbNQReSN41CAhOg== dependencies: - "@jest/types" "^27.5.1" + "@jest/types" "^29.6.3" "@types/node" "*" chalk "^4.0.0" - jest-message-util "^27.5.1" - jest-util "^27.5.1" + jest-message-util "^29.7.0" + jest-util "^29.7.0" slash "^3.0.0" -"@jest/core@^27.5.1": - version "27.5.1" - resolved "https://registry.yarnpkg.com/@jest/core/-/core-27.5.1.tgz#267ac5f704e09dc52de2922cbf3af9edcd64b626" - integrity sha512-AK6/UTrvQD0Cd24NSqmIA6rKsu0tKIxfiCducZvqxYdmMisOYAsdItspT+fQDQYARPf8XgjAFZi0ogW2agH5nQ== +"@jest/core@^29.7.0": + version "29.7.0" + resolved "https://registry.npmjs.org/@jest/core/-/core-29.7.0.tgz" + integrity sha512-n7aeXWKMnGtDA48y8TLWJPJmLmmZ642Ceo78cYWEpiD7FzDgmNDV/GCVRorPABdXLJZ/9wzzgZAlHjXjxDHGsg== dependencies: - "@jest/console" "^27.5.1" - "@jest/reporters" "^27.5.1" - "@jest/test-result" "^27.5.1" - "@jest/transform" "^27.5.1" - "@jest/types" "^27.5.1" + "@jest/console" "^29.7.0" + "@jest/reporters" "^29.7.0" + "@jest/test-result" "^29.7.0" + "@jest/transform" "^29.7.0" + "@jest/types" "^29.6.3" "@types/node" "*" ansi-escapes "^4.2.1" chalk "^4.0.0" - emittery "^0.8.1" + ci-info "^3.2.0" exit "^0.1.2" graceful-fs "^4.2.9" - jest-changed-files "^27.5.1" - jest-config "^27.5.1" - jest-haste-map "^27.5.1" - jest-message-util "^27.5.1" - jest-regex-util "^27.5.1" - jest-resolve "^27.5.1" - jest-resolve-dependencies "^27.5.1" - jest-runner "^27.5.1" - jest-runtime "^27.5.1" - jest-snapshot "^27.5.1" - jest-util "^27.5.1" - jest-validate "^27.5.1" - jest-watcher "^27.5.1" + jest-changed-files "^29.7.0" + jest-config "^29.7.0" + jest-haste-map "^29.7.0" + jest-message-util "^29.7.0" + jest-regex-util "^29.6.3" + jest-resolve "^29.7.0" + jest-resolve-dependencies "^29.7.0" + jest-runner "^29.7.0" + jest-runtime "^29.7.0" + jest-snapshot "^29.7.0" + jest-util "^29.7.0" + jest-validate "^29.7.0" + jest-watcher "^29.7.0" micromatch "^4.0.4" - rimraf "^3.0.0" + pretty-format "^29.7.0" slash "^3.0.0" strip-ansi "^6.0.0" -"@jest/environment@^27.5.1": - version "27.5.1" - resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-27.5.1.tgz#d7425820511fe7158abbecc010140c3fd3be9c74" - integrity sha512-/WQjhPJe3/ghaol/4Bq480JKXV/Rfw8nQdN7f41fM8VDHLcxKXou6QyXAh3EFr9/bVG3x74z1NWDkP87EiY8gA== +"@jest/environment@^29.7.0": + version "29.7.0" + resolved "https://registry.npmjs.org/@jest/environment/-/environment-29.7.0.tgz" + integrity sha512-aQIfHDq33ExsN4jP1NWGXhxgQ/wixs60gDiKO+XVMd8Mn0NWPWgc34ZQDTb2jKaUWQ7MuwoitXAsN2XVXNMpAw== dependencies: - "@jest/fake-timers" "^27.5.1" - "@jest/types" "^27.5.1" + "@jest/fake-timers" "^29.7.0" + "@jest/types" "^29.6.3" "@types/node" "*" - jest-mock "^27.5.1" + jest-mock "^29.7.0" -"@jest/fake-timers@^27.5.1": - version "27.5.1" - resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-27.5.1.tgz#76979745ce0579c8a94a4678af7a748eda8ada74" - integrity sha512-/aPowoolwa07k7/oM3aASneNeBGCmGQsc3ugN4u6s4C/+s5M64MFo/+djTdiwcbQlRfFElGuDXWzaWj6QgKObQ== +"@jest/expect-utils@^29.7.0": + version "29.7.0" + resolved "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-29.7.0.tgz" + integrity sha512-GlsNBWiFQFCVi9QVSx7f5AgMeLxe9YCCs5PuP2O2LdjDAA8Jh9eX7lA1Jq/xdXw3Wb3hyvlFNfZIfcRetSzYcA== dependencies: - "@jest/types" "^27.5.1" - "@sinonjs/fake-timers" "^8.0.1" + jest-get-type "^29.6.3" + +"@jest/expect@^29.7.0": + version "29.7.0" + resolved "https://registry.npmjs.org/@jest/expect/-/expect-29.7.0.tgz" + integrity sha512-8uMeAMycttpva3P1lBHB8VciS9V0XAr3GymPpipdyQXbBcuhkLQOSe8E/p92RyAdToS6ZD1tFkX+CkhoECE0dQ== + dependencies: + expect "^29.7.0" + jest-snapshot "^29.7.0" + +"@jest/fake-timers@^29.7.0": + version "29.7.0" + resolved "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-29.7.0.tgz" + integrity sha512-q4DH1Ha4TTFPdxLsqDXK1d3+ioSL7yL5oCMJZgDYm6i+6CygW5E5xVr/D1HdsGxjt1ZWSfUAs9OxSB/BNelWrQ== + dependencies: + "@jest/types" "^29.6.3" + "@sinonjs/fake-timers" "^10.0.2" "@types/node" "*" - jest-message-util "^27.5.1" - jest-mock "^27.5.1" - jest-util "^27.5.1" + jest-message-util "^29.7.0" + jest-mock "^29.7.0" + jest-util "^29.7.0" -"@jest/globals@^27.5.1": - version "27.5.1" - resolved "https://registry.yarnpkg.com/@jest/globals/-/globals-27.5.1.tgz#7ac06ce57ab966566c7963431cef458434601b2b" - integrity sha512-ZEJNB41OBQQgGzgyInAv0UUfDDj3upmHydjieSxFvTRuZElrx7tXg/uVQ5hYVEwiXs3+aMsAeEc9X7xiSKCm4Q== +"@jest/globals@^29.7.0": + version "29.7.0" + resolved "https://registry.npmjs.org/@jest/globals/-/globals-29.7.0.tgz" + integrity sha512-mpiz3dutLbkW2MNFubUGUEVLkTGiqW6yLVTA+JbP6fI6J5iL9Y0Nlg8k95pcF8ctKwCS7WVxteBs29hhfAotzQ== dependencies: - "@jest/environment" "^27.5.1" - "@jest/types" "^27.5.1" - expect "^27.5.1" + "@jest/environment" "^29.7.0" + "@jest/expect" "^29.7.0" + "@jest/types" "^29.6.3" + jest-mock "^29.7.0" -"@jest/reporters@^27.5.1": - version "27.5.1" - resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-27.5.1.tgz#ceda7be96170b03c923c37987b64015812ffec04" - integrity sha512-cPXh9hWIlVJMQkVk84aIvXuBB4uQQmFqZiacloFuGiP3ah1sbCxCosidXFDfqG8+6fO1oR2dTJTlsOy4VFmUfw== +"@jest/reporters@^29.7.0": + version "29.7.0" + resolved "https://registry.npmjs.org/@jest/reporters/-/reporters-29.7.0.tgz" + integrity sha512-DApq0KJbJOEzAFYjHADNNxAE3KbhxQB1y5Kplb5Waqw6zVbuWatSnMjE5gs8FUgEPmNsnZA3NCWl9NG0ia04Pg== dependencies: "@bcoe/v8-coverage" "^0.2.3" - "@jest/console" "^27.5.1" - "@jest/test-result" "^27.5.1" - "@jest/transform" "^27.5.1" - "@jest/types" "^27.5.1" + "@jest/console" "^29.7.0" + "@jest/test-result" "^29.7.0" + "@jest/transform" "^29.7.0" + "@jest/types" "^29.6.3" + "@jridgewell/trace-mapping" "^0.3.18" "@types/node" "*" chalk "^4.0.0" collect-v8-coverage "^1.0.0" exit "^0.1.2" - glob "^7.1.2" + glob "^7.1.3" graceful-fs "^4.2.9" istanbul-lib-coverage "^3.0.0" - istanbul-lib-instrument "^5.1.0" + istanbul-lib-instrument "^6.0.0" istanbul-lib-report "^3.0.0" istanbul-lib-source-maps "^4.0.0" istanbul-reports "^3.1.3" - jest-haste-map "^27.5.1" - jest-resolve "^27.5.1" - jest-util "^27.5.1" - jest-worker "^27.5.1" + jest-message-util "^29.7.0" + jest-util "^29.7.0" + jest-worker "^29.7.0" slash "^3.0.0" - source-map "^0.6.0" string-length "^4.0.1" - terminal-link "^2.0.0" - v8-to-istanbul "^8.1.0" + strip-ansi "^6.0.0" + v8-to-istanbul "^9.0.1" + +"@jest/schemas@^29.6.3": + version "29.6.3" + resolved "https://registry.npmjs.org/@jest/schemas/-/schemas-29.6.3.tgz" + integrity sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA== + dependencies: + "@sinclair/typebox" "^0.27.8" -"@jest/source-map@^27.5.1": - version "27.5.1" - resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-27.5.1.tgz#6608391e465add4205eae073b55e7f279e04e8cf" - integrity sha512-y9NIHUYF3PJRlHk98NdC/N1gl88BL08aQQgu4k4ZopQkCw9t9cV8mtl3TV8b/YCB8XaVTFrmUTAJvjsntDireg== +"@jest/source-map@^29.6.3": + version "29.6.3" + resolved "https://registry.npmjs.org/@jest/source-map/-/source-map-29.6.3.tgz" + integrity sha512-MHjT95QuipcPrpLM+8JMSzFx6eHp5Bm+4XeFDJlwsvVBjmKNiIAvasGK2fxz2WbGRlnvqehFbh07MMa7n3YJnw== dependencies: + "@jridgewell/trace-mapping" "^0.3.18" callsites "^3.0.0" graceful-fs "^4.2.9" - source-map "^0.6.0" -"@jest/test-result@^27.5.1": - version "27.5.1" - resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-27.5.1.tgz#56a6585fa80f7cdab72b8c5fc2e871d03832f5bb" - integrity sha512-EW35l2RYFUcUQxFJz5Cv5MTOxlJIQs4I7gxzi2zVU7PJhOwfYq1MdC5nhSmYjX1gmMmLPvB3sIaC+BkcHRBfag== +"@jest/test-result@^29.7.0": + version "29.7.0" + resolved "https://registry.npmjs.org/@jest/test-result/-/test-result-29.7.0.tgz" + integrity sha512-Fdx+tv6x1zlkJPcWXmMDAG2HBnaR9XPSd5aDWQVsfrZmLVT3lU1cwyxLgRmXR9yrq4NBoEm9BMsfgFzTQAbJYA== dependencies: - "@jest/console" "^27.5.1" - "@jest/types" "^27.5.1" + "@jest/console" "^29.7.0" + "@jest/types" "^29.6.3" "@types/istanbul-lib-coverage" "^2.0.0" collect-v8-coverage "^1.0.0" -"@jest/test-sequencer@^27.5.1": - version "27.5.1" - resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-27.5.1.tgz#4057e0e9cea4439e544c6353c6affe58d095745b" - integrity sha512-LCheJF7WB2+9JuCS7VB/EmGIdQuhtqjRNI9A43idHv3E4KltCTsPsLxvdaubFHSYwY/fNjMWjl6vNRhDiN7vpQ== +"@jest/test-sequencer@^29.7.0": + version "29.7.0" + resolved "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-29.7.0.tgz" + integrity sha512-GQwJ5WZVrKnOJuiYiAF52UNUJXgTZx1NHjFSEB0qEMmSZKAkdMoIzw/Cj6x6NF4AvV23AUqDpFzQkN/eYCYTxw== dependencies: - "@jest/test-result" "^27.5.1" + "@jest/test-result" "^29.7.0" graceful-fs "^4.2.9" - jest-haste-map "^27.5.1" - jest-runtime "^27.5.1" + jest-haste-map "^29.7.0" + slash "^3.0.0" -"@jest/transform@^27.5.1": - version "27.5.1" - resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-27.5.1.tgz#6c3501dcc00c4c08915f292a600ece5ecfe1f409" - integrity sha512-ipON6WtYgl/1329g5AIJVbUuEh0wZVbdpGwC99Jw4LwuoBNS95MVphU6zOeD9pDkon+LLbFL7lOQRapbB8SCHw== +"@jest/transform@^29.7.0": + version "29.7.0" + resolved "https://registry.npmjs.org/@jest/transform/-/transform-29.7.0.tgz" + integrity sha512-ok/BTPFzFKVMwO5eOHRrvnBVHdRy9IrsrW1GpMaQ9MCnilNLXQKmAX8s1YXDFaai9xJpac2ySzV0YeRRECr2Vw== dependencies: - "@babel/core" "^7.1.0" - "@jest/types" "^27.5.1" + "@babel/core" "^7.11.6" + "@jest/types" "^29.6.3" + "@jridgewell/trace-mapping" "^0.3.18" babel-plugin-istanbul "^6.1.1" chalk "^4.0.0" - convert-source-map "^1.4.0" - fast-json-stable-stringify "^2.0.0" + convert-source-map "^2.0.0" + fast-json-stable-stringify "^2.1.0" graceful-fs "^4.2.9" - jest-haste-map "^27.5.1" - jest-regex-util "^27.5.1" - jest-util "^27.5.1" + jest-haste-map "^29.7.0" + jest-regex-util "^29.6.3" + jest-util "^29.7.0" micromatch "^4.0.4" pirates "^4.0.4" slash "^3.0.0" - source-map "^0.6.1" - write-file-atomic "^3.0.0" + write-file-atomic "^4.0.2" -"@jest/types@^27.5.1": - version "27.5.1" - resolved "https://registry.yarnpkg.com/@jest/types/-/types-27.5.1.tgz#3c79ec4a8ba61c170bf937bcf9e98a9df175ec80" - integrity sha512-Cx46iJ9QpwQTjIdq5VJu2QTMMs3QlEjI0x1QbBP5W1+nMzyc2XmimiRR/CbX9TO0cPTeUlxWMOu8mslYsJ8DEw== +"@jest/types@^29.6.3": + version "29.6.3" + resolved "https://registry.npmjs.org/@jest/types/-/types-29.6.3.tgz" + integrity sha512-u3UPsIilWKOM3F9CXtrG8LEJmNxwoCQC/XVj4IKYXvvpx7QIi/Kg1LI5uDmDpKlac62NUtX7eLjRh+jVZcLOzw== dependencies: + "@jest/schemas" "^29.6.3" "@types/istanbul-lib-coverage" "^2.0.0" "@types/istanbul-reports" "^3.0.0" "@types/node" "*" - "@types/yargs" "^16.0.0" + "@types/yargs" "^17.0.8" chalk "^4.0.0" "@jridgewell/gen-mapping@^0.3.12", "@jridgewell/gen-mapping@^0.3.5": - version "0.3.12" - resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.12.tgz#2234ce26c62889f03db3d7fea43c1932ab3e927b" - integrity sha512-OuLGC46TjB5BbN1dH8JULVVZY4WTdkF7tV9Ys6wLL1rubZnCMstOhNHueU5bLCrnRuDhKPDM4g6sw4Bel5Gzqg== + version "0.3.13" + resolved "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz" + integrity sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA== dependencies: "@jridgewell/sourcemap-codec" "^1.5.0" "@jridgewell/trace-mapping" "^0.3.24" -"@jridgewell/resolve-uri@^3.0.3", "@jridgewell/resolve-uri@^3.1.0": +"@jridgewell/remapping@^2.3.5": + version "2.3.5" + resolved "https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.5.tgz" + integrity sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ== + dependencies: + "@jridgewell/gen-mapping" "^0.3.5" + "@jridgewell/trace-mapping" "^0.3.24" + +"@jridgewell/resolve-uri@^3.1.0": version "3.1.2" - resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz#7a0ee601f60f99a20c7c7c5ff0c80388c1189bd6" + resolved "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz" integrity sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw== -"@jridgewell/sourcemap-codec@^1.4.10", "@jridgewell/sourcemap-codec@^1.4.14", "@jridgewell/sourcemap-codec@^1.5.0": - version "1.5.4" - resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.4.tgz#7358043433b2e5da569aa02cbc4c121da3af27d7" - integrity sha512-VT2+G1VQs/9oz078bLrYbecdZKs912zQlkelYpuf+SXF+QvZDYJlbx/LSx+meSAwdDFnF8FVXW92AVjjkVmgFw== - -"@jridgewell/trace-mapping@0.3.9": - version "0.3.9" - resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz#6534fd5933a53ba7cbf3a17615e273a0d1273ff9" - integrity sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ== - dependencies: - "@jridgewell/resolve-uri" "^3.0.3" - "@jridgewell/sourcemap-codec" "^1.4.10" +"@jridgewell/sourcemap-codec@^1.4.14", "@jridgewell/sourcemap-codec@^1.5.0": + version "1.5.5" + resolved "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz" + integrity sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og== -"@jridgewell/trace-mapping@^0.3.24", "@jridgewell/trace-mapping@^0.3.28": - version "0.3.29" - resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.29.tgz#a58d31eaadaf92c6695680b2e1d464a9b8fbf7fc" - integrity sha512-uw6guiW/gcAGPDhLmd77/6lW8QLeiV5RUTsAX46Db6oLhGaVj4lhnPwb184s1bkc8kdVg/+h988dro8GRDpmYQ== +"@jridgewell/trace-mapping@^0.3.12", "@jridgewell/trace-mapping@^0.3.18", "@jridgewell/trace-mapping@^0.3.24", "@jridgewell/trace-mapping@^0.3.28": + version "0.3.31" + resolved "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz" + integrity sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw== dependencies: "@jridgewell/resolve-uri" "^3.1.0" "@jridgewell/sourcemap-codec" "^1.4.14" -"@ledgerhq/devices@^8.4.5": - version "8.4.8" - resolved "https://registry.yarnpkg.com/@ledgerhq/devices/-/devices-8.4.8.tgz#0eee2e6b7f946dedd7adebb10dcb2dc54c1aaf87" - integrity sha512-joodpi1lTIoPswpH6DBtlAieEfP0xB1NlM8RY3xj82EtO8eU1IRqTQz7wtsbstXJ1FdLRg/CJ5OL41omdBsrZQ== - dependencies: - "@ledgerhq/errors" "^6.23.0" - "@ledgerhq/logs" "^6.13.0" - rxjs "^7.8.1" - semver "^7.3.5" - -"@ledgerhq/errors@^6.23.0": - version "6.23.0" - resolved "https://registry.yarnpkg.com/@ledgerhq/errors/-/errors-6.23.0.tgz#fae7b61095ce4c033394d16085b5f14ca9f9d738" - integrity sha512-bM7tPYShPThtBy1Y+9D28iquOeP5W5s4p7KKD/cUQoaVaPibrtC7Mm4u+IeSlH4WGvFJkTmv0vmZJajuZtM79A== - -"@ledgerhq/logs@^6.13.0": - version "6.13.0" - resolved "https://registry.yarnpkg.com/@ledgerhq/logs/-/logs-6.13.0.tgz#0b083af64b6b85db0630c7b940a0ed74ff6262b6" - integrity sha512-4+qRW2Pc8V+btL0QEmdB2X+uyx0kOWMWE1/LWsq5sZy3Q5tpi4eItJS6mB0XL3wGW59RQ+8bchNQQ1OW/va8Og== - "@nodelib/fs.scandir@2.1.5": version "2.1.5" - resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5" + resolved "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz" integrity sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g== dependencies: "@nodelib/fs.stat" "2.0.5" @@ -1631,12 +1226,12 @@ "@nodelib/fs.stat@2.0.5", "@nodelib/fs.stat@^2.0.2": version "2.0.5" - resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz#5bd262af94e9d25bd1e71b05deed44876a222e8b" + resolved "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz" integrity sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A== "@nodelib/fs.walk@^1.2.3", "@nodelib/fs.walk@^1.2.8": version "1.2.8" - resolved "https://registry.yarnpkg.com/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz#e95737e8bb6746ddedf69c556953494f196fe69a" + resolved "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz" integrity sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg== dependencies: "@nodelib/fs.scandir" "2.1.5" @@ -1644,51 +1239,31 @@ "@rtsao/scc@^1.1.0": version "1.1.0" - resolved "https://registry.yarnpkg.com/@rtsao/scc/-/scc-1.1.0.tgz#927dd2fae9bc3361403ac2c7a00c32ddce9ad7e8" + resolved "https://registry.npmjs.org/@rtsao/scc/-/scc-1.1.0.tgz" integrity sha512-zt6OdqaDoOnJ1ZYsCYGt9YmWzDXl4vQdKTyJev62gFhRGKdx7mcT54V9KIjg+d2wi9EXsPvAPKe7i7WjfVWB8g== -"@sinonjs/commons@^1.7.0": - version "1.8.6" - resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-1.8.6.tgz#80c516a4dc264c2a69115e7578d62581ff455ed9" - integrity sha512-Ky+XkAkqPZSm3NLBeUng77EBQl3cmeJhITaGHdYH8kjVB+aun3S4XBRti2zt17mtt0mIUDiNxYeoJm6drVvBJQ== +"@sinclair/typebox@^0.27.8": + version "0.27.8" + resolved "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz" + integrity sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA== + +"@sinonjs/commons@^3.0.0": + version "3.0.1" + resolved "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.1.tgz" + integrity sha512-K3mCHKQ9sVh8o1C9cxkwxaOmXoAMlDxC1mYyHrjqOWEcBjYr76t96zL2zlj5dUGZ3HSw240X1qgH3Mjf1yJWpQ== dependencies: type-detect "4.0.8" -"@sinonjs/fake-timers@^8.0.1": - version "8.1.0" - resolved "https://registry.yarnpkg.com/@sinonjs/fake-timers/-/fake-timers-8.1.0.tgz#3fdc2b6cb58935b21bfb8d1625eb1300484316e7" - integrity sha512-OAPJUAtgeINhh/TAlUID4QTs53Njm7xzddaVlEs/SXwgtiD1tW22zAB/W1wdqfrpmikgaWQ9Fw6Ws+hsiRm5Vg== +"@sinonjs/fake-timers@^10.0.2": + version "10.3.0" + resolved "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-10.3.0.tgz" + integrity sha512-V4BG07kuYSUkTCSBHG8G8TNhM+F19jXFWnQtzj+we8DrkpSBCee9Z3Ms8yiGer/dlmhe35/Xdgyo3/0rQKg7YA== dependencies: - "@sinonjs/commons" "^1.7.0" + "@sinonjs/commons" "^3.0.0" -"@tootallnate/once@1": - version "1.1.2" - resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-1.1.2.tgz#ccb91445360179a04e7fe6aff78c00ffc1eeaf82" - integrity sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw== - -"@tsconfig/node10@^1.0.7": - version "1.0.11" - resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.11.tgz#6ee46400685f130e278128c7b38b7e031ff5b2f2" - integrity sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw== - -"@tsconfig/node12@^1.0.7": - version "1.0.11" - resolved "https://registry.yarnpkg.com/@tsconfig/node12/-/node12-1.0.11.tgz#ee3def1f27d9ed66dac6e46a295cffb0152e058d" - integrity sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag== - -"@tsconfig/node14@^1.0.0": - version "1.0.3" - resolved "https://registry.yarnpkg.com/@tsconfig/node14/-/node14-1.0.3.tgz#e4386316284f00b98435bf40f72f75a09dabf6c1" - integrity sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow== - -"@tsconfig/node16@^1.0.2": - version "1.0.4" - resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.4.tgz#0b92dcc0cc1c81f6f306a381f28e31b1a56536e9" - integrity sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA== - -"@types/babel__core@^7.0.0", "@types/babel__core@^7.1.14": +"@types/babel__core@^7.1.14": version "7.20.5" - resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.20.5.tgz#3df15f27ba85319caa07ba08d0721889bb39c017" + resolved "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz" integrity sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA== dependencies: "@babel/parser" "^7.20.7" @@ -1699,466 +1274,260 @@ "@types/babel__generator@*": version "7.27.0" - resolved "https://registry.yarnpkg.com/@types/babel__generator/-/babel__generator-7.27.0.tgz#b5819294c51179957afaec341442f9341e4108a9" + resolved "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.27.0.tgz" integrity sha512-ufFd2Xi92OAVPYsy+P4n7/U7e68fex0+Ee8gSG9KX7eo084CWiQ4sdxktvdl0bOPupXtVJPY19zk6EwWqUQ8lg== dependencies: "@babel/types" "^7.0.0" "@types/babel__template@*": version "7.4.4" - resolved "https://registry.yarnpkg.com/@types/babel__template/-/babel__template-7.4.4.tgz#5672513701c1b2199bc6dad636a9d7491586766f" + resolved "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.4.tgz" integrity sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A== dependencies: "@babel/parser" "^7.1.0" "@babel/types" "^7.0.0" -"@types/babel__traverse@*", "@types/babel__traverse@^7.0.4", "@types/babel__traverse@^7.0.6": - version "7.20.7" - resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.20.7.tgz#968cdc2366ec3da159f61166428ee40f370e56c2" - integrity sha512-dkO5fhS7+/oos4ciWxyEyjWe48zmG6wbCheo/G2ZnHx4fs3EU6YC6UM8rk56gAjNJ9P3MTH2jo5jb92/K6wbng== +"@types/babel__traverse@*", "@types/babel__traverse@^7.0.6": + version "7.28.0" + resolved "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.28.0.tgz" + integrity sha512-8PvcXf70gTDZBgt9ptxJ8elBeBjcLOAcOtoO/mPJjtji1+CdGbHgm77om1GrsPxsiE+uXIpNSK64UYaIwQXd4Q== dependencies: - "@babel/types" "^7.20.7" - -"@types/crypto-js@^4.1.0": - version "4.2.2" - resolved "https://registry.yarnpkg.com/@types/crypto-js/-/crypto-js-4.2.2.tgz#771c4a768d94eb5922cc202a3009558204df0cea" - integrity sha512-sDOLlVbHhXpAUAL0YHDUUwDZf3iN4Bwi4W6a0W0b+QcAezUbRtH4FVb+9J4h+XFPW7l/gQ9F8qC7P+Ec4k8QVQ== - -"@types/eslint-visitor-keys@^1.0.0": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@types/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#1ee30d79544ca84d68d4b3cdb0af4f205663dd2d" - integrity sha512-OCutwjDZ4aFS6PB1UZ988C4YgwlBHJd6wCeQqaLdmadZ/7e+w79+hbMUFC1QXDNCmdyoRfAFdm0RypzwR+Qpag== + "@babel/types" "^7.28.2" -"@types/graceful-fs@^4.1.2": +"@types/graceful-fs@^4.1.3": version "4.1.9" - resolved "https://registry.yarnpkg.com/@types/graceful-fs/-/graceful-fs-4.1.9.tgz#2a06bc0f68a20ab37b3e36aa238be6abdf49e8b4" + resolved "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.9.tgz" integrity sha512-olP3sd1qOEe5dXTSaFvQG+02VdRXcdytWLAZsAq1PecU8uqQAhkrnbli7DagjtXKW/Bl7YJbUsa8MPcuc8LHEQ== dependencies: "@types/node" "*" "@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0", "@types/istanbul-lib-coverage@^2.0.1": version "2.0.6" - resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz#7739c232a1fee9b4d3ce8985f314c0c6d33549d7" + resolved "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz" integrity sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w== "@types/istanbul-lib-report@*": version "3.0.3" - resolved "https://registry.yarnpkg.com/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.3.tgz#53047614ae72e19fc0401d872de3ae2b4ce350bf" + resolved "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.3.tgz" integrity sha512-NQn7AHQnk/RSLOxrBbGyJM/aVQ+pjj5HCgasFxc0K/KhoATfQ/47AyUl15I2yBUpihjmas+a+VJBOqecrFH+uA== dependencies: "@types/istanbul-lib-coverage" "*" "@types/istanbul-reports@^3.0.0": version "3.0.4" - resolved "https://registry.yarnpkg.com/@types/istanbul-reports/-/istanbul-reports-3.0.4.tgz#0f03e3d2f670fbdac586e34b433783070cc16f54" + resolved "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.4.tgz" integrity sha512-pk2B1NWalF9toCRu6gjBzR69syFjP4Od8WRAX+0mmf9lAjCRicLOWc+ZrxZHx/0XRjotgkF9t6iaMJ+aXcOdZQ== dependencies: "@types/istanbul-lib-report" "*" -"@types/jest@^27.4.0": - version "27.5.2" - resolved "https://registry.yarnpkg.com/@types/jest/-/jest-27.5.2.tgz#ec49d29d926500ffb9fd22b84262e862049c026c" - integrity sha512-mpT8LJJ4CMeeahobofYWIjFo0xonRS/HfxnVEPMPFSQdGUt1uHCnoPT7Zhb+sjDU2wz0oKV0OLUR0WzrHNgfeA== - dependencies: - jest-matcher-utils "^27.0.0" - pretty-format "^27.0.0" - -"@types/json-schema@^7.0.3", "@types/json-schema@^7.0.9": - version "7.0.15" - resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841" - integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA== - "@types/json5@^0.0.29": version "0.0.29" - resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee" + resolved "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz" integrity sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ== -"@types/lodash@^4.14.178": - version "4.17.20" - resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.17.20.tgz#1ca77361d7363432d29f5e55950d9ec1e1c6ea93" - integrity sha512-H3MHACvFUEiujabxhaI/ImO6gUrd8oOurg7LQtS7mbwIXA/cUqWrvBsaeJ23aZEPk1TAYkurjfMbSELfoCXlGA== - -"@types/minimist@^1.2.0": - version "1.2.5" - resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.5.tgz#ec10755e871497bcd83efe927e43ec46e8c0747e" - integrity sha512-hov8bUuiLiyFPGyFPE1lwWhmzYbirOXQNNo40+y3zow8aFVTeyn3VWL0VFFfdNddA8S4Vf0Tc062rzyNr7Paag== - "@types/node@*": - version "24.1.0" - resolved "https://registry.yarnpkg.com/@types/node/-/node-24.1.0.tgz#0993f7dc31ab5cc402d112315b463e383d68a49c" - integrity sha512-ut5FthK5moxFKH2T1CUOC6ctR67rQRvvHdFLCD2Ql6KXmMuCrjsSsRI9UsLCm9M18BMwClv4pn327UvB7eeO1w== + version "25.0.9" + resolved "https://registry.npmjs.org/@types/node/-/node-25.0.9.tgz" + integrity sha512-/rpCXHlCWeqClNBwUhDcusJxXYDjZTyE8v5oTO7WbL8eij2nKhUeU89/6xgjU7N4/Vh3He0BtyhJdQbDyhiXAw== dependencies: - undici-types "~7.8.0" - -"@types/node@^17.0.13": - version "17.0.45" - resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.45.tgz#2c0fafd78705e7a18b7906b5201a522719dc5190" - integrity sha512-w+tIMs3rq2afQdsPJlODhoUEKzFP1ayaoyl1CcnwtIlsVe7K7bA1NGm4s3PraqTLlXnbIN84zuBlxBWo1u9BLw== - -"@types/normalize-package-data@^2.4.0": - version "2.4.4" - resolved "https://registry.yarnpkg.com/@types/normalize-package-data/-/normalize-package-data-2.4.4.tgz#56e2cc26c397c038fab0e3a917a12d5c5909e901" - integrity sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA== - -"@types/prettier@^2.1.5": - version "2.7.3" - resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.7.3.tgz#3e51a17e291d01d17d3fc61422015a933af7a08f" - integrity sha512-+68kP9yzs4LMp7VNh8gdzMSPZFL44MLGqiHWvttYJe+6qnuVr4Ek9wSBQoveqY/r+LwjCcU29kNVkidwim+kYA== - -"@types/semver@^7.3.12": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.7.0.tgz#64c441bdae033b378b6eef7d0c3d77c329b9378e" - integrity sha512-k107IF4+Xr7UHjwDc7Cfd6PRQfbdkiRabXGRjo07b4WyPahFBZCZ1sE+BNxYIJPPg73UkfOsVOLwqVc/6ETrIA== + undici-types "~7.16.0" "@types/stack-utils@^2.0.0": version "2.0.3" - resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.3.tgz#6209321eb2c1712a7e7466422b8cb1fc0d9dd5d8" + resolved "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.3.tgz" integrity sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw== "@types/yargs-parser@*": version "21.0.3" - resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-21.0.3.tgz#815e30b786d2e8f0dcd85fd5bcf5e1a04d008f15" + resolved "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.3.tgz" integrity sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ== -"@types/yargs@^16.0.0": - version "16.0.9" - resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-16.0.9.tgz#ba506215e45f7707e6cbcaf386981155b7ab956e" - integrity sha512-tHhzvkFXZQeTECenFoRljLBYPZJ7jAVxqqtEI0qTLOmuultnFp4I9yKE17vTuhf7BkhCu7I4XuemPgikDVuYqA== +"@types/yargs@^17.0.8": + version "17.0.35" + resolved "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.35.tgz" + integrity sha512-qUHkeCyQFxMXg79wQfTtfndEC+N9ZZg76HJftDJp+qH2tV7Gj4OJi7l+PiWwJ+pWtW8GwSmqsDj/oymhrTWXjg== dependencies: "@types/yargs-parser" "*" -"@typescript-eslint/eslint-plugin@^5.10.1": - version "5.62.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.62.0.tgz#aeef0328d172b9e37d9bab6dbc13b87ed88977db" - integrity sha512-TiZzBSJja/LbhNPvk6yc0JrX9XqhQ0hdh6M2svYfsHGejaKFIAGd9MQ+ERIMzLGlN/kZoYIgdxFV0PuljTKXag== +"@typescript-eslint/eslint-plugin@^7.18.0": + version "7.18.0" + resolved "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.18.0.tgz" + integrity sha512-94EQTWZ40mzBc42ATNIBimBEDltSJ9RQHCC8vc/PDbxi4k8dVwUAv4o98dk50M1zB+JGFxp43FP7f8+FP8R6Sw== dependencies: - "@eslint-community/regexpp" "^4.4.0" - "@typescript-eslint/scope-manager" "5.62.0" - "@typescript-eslint/type-utils" "5.62.0" - "@typescript-eslint/utils" "5.62.0" - debug "^4.3.4" + "@eslint-community/regexpp" "^4.10.0" + "@typescript-eslint/scope-manager" "7.18.0" + "@typescript-eslint/type-utils" "7.18.0" + "@typescript-eslint/utils" "7.18.0" + "@typescript-eslint/visitor-keys" "7.18.0" graphemer "^1.4.0" - ignore "^5.2.0" - natural-compare-lite "^1.4.0" - semver "^7.3.7" - tsutils "^3.21.0" - -"@typescript-eslint/experimental-utils@3.10.1": - version "3.10.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-3.10.1.tgz#e179ffc81a80ebcae2ea04e0332f8b251345a686" - integrity sha512-DewqIgscDzmAfd5nOGe4zm6Bl7PKtMG2Ad0KG8CUZAHlXfAKTF9Ol5PXhiMh39yRL2ChRH1cuuUGOcVyyrhQIw== - dependencies: - "@types/json-schema" "^7.0.3" - "@typescript-eslint/types" "3.10.1" - "@typescript-eslint/typescript-estree" "3.10.1" - eslint-scope "^5.0.0" - eslint-utils "^2.0.0" - -"@typescript-eslint/parser@^3.0.0": - version "3.10.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-3.10.1.tgz#1883858e83e8b442627e1ac6f408925211155467" - integrity sha512-Ug1RcWcrJP02hmtaXVS3axPPTTPnZjupqhgj+NnZ6BCkwSImWk/283347+x9wN+lqOdK9Eo3vsyiyDHgsmiEJw== - dependencies: - "@types/eslint-visitor-keys" "^1.0.0" - "@typescript-eslint/experimental-utils" "3.10.1" - "@typescript-eslint/types" "3.10.1" - "@typescript-eslint/typescript-estree" "3.10.1" - eslint-visitor-keys "^1.1.0" - -"@typescript-eslint/parser@^5.10.1": - version "5.62.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.62.0.tgz#1b63d082d849a2fcae8a569248fbe2ee1b8a56c7" - integrity sha512-VlJEV0fOQ7BExOsHYAGrgbEiZoi8D+Bl2+f6V2RrXerRSylnp+ZBHmPvaIa8cz0Ajx7WO7Z5RqfgYg7ED1nRhA== - dependencies: - "@typescript-eslint/scope-manager" "5.62.0" - "@typescript-eslint/types" "5.62.0" - "@typescript-eslint/typescript-estree" "5.62.0" + ignore "^5.3.1" + natural-compare "^1.4.0" + ts-api-utils "^1.3.0" + +"@typescript-eslint/parser@^7.18.0": + version "7.18.0" + resolved "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.18.0.tgz" + integrity sha512-4Z+L8I2OqhZV8qA132M4wNL30ypZGYOQVBfMgxDH/K5UX0PNqTu1c6za9ST5r9+tavvHiTWmBnKzpCJ/GlVFtg== + dependencies: + "@typescript-eslint/scope-manager" "7.18.0" + "@typescript-eslint/types" "7.18.0" + "@typescript-eslint/typescript-estree" "7.18.0" + "@typescript-eslint/visitor-keys" "7.18.0" debug "^4.3.4" -"@typescript-eslint/scope-manager@5.62.0": - version "5.62.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.62.0.tgz#d9457ccc6a0b8d6b37d0eb252a23022478c5460c" - integrity sha512-VXuvVvZeQCQb5Zgf4HAxc04q5j+WrNAtNh9OwCsCgpKqESMTu3tF/jhZ3xG6T4NZwWl65Bg8KuS2uEvhSfLl0w== +"@typescript-eslint/scope-manager@7.18.0": + version "7.18.0" + resolved "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.18.0.tgz" + integrity sha512-jjhdIE/FPF2B7Z1uzc6i3oWKbGcHb87Qw7AWj6jmEqNOfDFbJWtjt/XfwCpvNkpGWlcJaog5vTR+VV8+w9JflA== dependencies: - "@typescript-eslint/types" "5.62.0" - "@typescript-eslint/visitor-keys" "5.62.0" + "@typescript-eslint/types" "7.18.0" + "@typescript-eslint/visitor-keys" "7.18.0" -"@typescript-eslint/type-utils@5.62.0": - version "5.62.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.62.0.tgz#286f0389c41681376cdad96b309cedd17d70346a" - integrity sha512-xsSQreu+VnfbqQpW5vnCJdq1Z3Q0U31qiWmRhr98ONQmcp/yhiPJFPq8MXiJVLiksmOKSjIldZzkebzHuCGzew== +"@typescript-eslint/type-utils@7.18.0": + version "7.18.0" + resolved "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.18.0.tgz" + integrity sha512-XL0FJXuCLaDuX2sYqZUUSOJ2sG5/i1AAze+axqmLnSkNEVMVYLF+cbwlB2w8D1tinFuSikHmFta+P+HOofrLeA== dependencies: - "@typescript-eslint/typescript-estree" "5.62.0" - "@typescript-eslint/utils" "5.62.0" + "@typescript-eslint/typescript-estree" "7.18.0" + "@typescript-eslint/utils" "7.18.0" debug "^4.3.4" - tsutils "^3.21.0" + ts-api-utils "^1.3.0" -"@typescript-eslint/types@3.10.1": - version "3.10.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-3.10.1.tgz#1d7463fa7c32d8a23ab508a803ca2fe26e758727" - integrity sha512-+3+FCUJIahE9q0lDi1WleYzjCwJs5hIsbugIgnbB+dSCYUxl8L6PwmsyOPFZde2hc1DlTo/xnkOgiTLSyAbHiQ== +"@typescript-eslint/types@7.18.0": + version "7.18.0" + resolved "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.18.0.tgz" + integrity sha512-iZqi+Ds1y4EDYUtlOOC+aUmxnE9xS/yCigkjA7XpTKV6nCBd3Hp/PRGGmdwnfkV2ThMyYldP1wRpm/id99spTQ== -"@typescript-eslint/types@5.62.0": - version "5.62.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.62.0.tgz#258607e60effa309f067608931c3df6fed41fd2f" - integrity sha512-87NVngcbVXUahrRTqIK27gD2t5Cu1yuCXxbLcFtCzZGlfyVWWh8mLHkoxzjsB6DDNnvdL+fW8MiwPEJyGJQDgQ== - -"@typescript-eslint/typescript-estree@3.10.1": - version "3.10.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-3.10.1.tgz#fd0061cc38add4fad45136d654408569f365b853" - integrity sha512-QbcXOuq6WYvnB3XPsZpIwztBoquEYLXh2MtwVU+kO8jgYCiv4G5xrSP/1wg4tkvrEE+esZVquIPX/dxPlePk1w== +"@typescript-eslint/typescript-estree@7.18.0": + version "7.18.0" + resolved "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.18.0.tgz" + integrity sha512-aP1v/BSPnnyhMHts8cf1qQ6Q1IFwwRvAQGRvBFkWlo3/lH29OXA3Pts+c10nxRxIBrDnoMqzhgdwVe5f2D6OzA== dependencies: - "@typescript-eslint/types" "3.10.1" - "@typescript-eslint/visitor-keys" "3.10.1" - debug "^4.1.1" - glob "^7.1.6" - is-glob "^4.0.1" - lodash "^4.17.15" - semver "^7.3.2" - tsutils "^3.17.1" - -"@typescript-eslint/typescript-estree@5.62.0": - version "5.62.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.62.0.tgz#7d17794b77fabcac615d6a48fb143330d962eb9b" - integrity sha512-CmcQ6uY7b9y694lKdRB8FEel7JbU/40iSAPomu++SjLMntB+2Leay2LO6i8VnJk58MtE9/nQSFIH6jpyRWyYzA== - dependencies: - "@typescript-eslint/types" "5.62.0" - "@typescript-eslint/visitor-keys" "5.62.0" + "@typescript-eslint/types" "7.18.0" + "@typescript-eslint/visitor-keys" "7.18.0" debug "^4.3.4" globby "^11.1.0" is-glob "^4.0.3" - semver "^7.3.7" - tsutils "^3.21.0" - -"@typescript-eslint/utils@5.62.0": - version "5.62.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.62.0.tgz#141e809c71636e4a75daa39faed2fb5f4b10df86" - integrity sha512-n8oxjeb5aIbPFEtmQxQYOLI0i9n5ySBEY/ZEHHZqKQSFnxio1rv6dthascc9dLuwrL0RC5mPCxB7vnAVGAYWAQ== - dependencies: - "@eslint-community/eslint-utils" "^4.2.0" - "@types/json-schema" "^7.0.9" - "@types/semver" "^7.3.12" - "@typescript-eslint/scope-manager" "5.62.0" - "@typescript-eslint/types" "5.62.0" - "@typescript-eslint/typescript-estree" "5.62.0" - eslint-scope "^5.1.1" - semver "^7.3.7" - -"@typescript-eslint/visitor-keys@3.10.1": - version "3.10.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-3.10.1.tgz#cd4274773e3eb63b2e870ac602274487ecd1e931" - integrity sha512-9JgC82AaQeglebjZMgYR5wgmfUdUc+EitGUUMW8u2nDckaeimzW+VsoLV6FoimPv2id3VQzfjwBxEMVz08ameQ== - dependencies: - eslint-visitor-keys "^1.1.0" - -"@typescript-eslint/visitor-keys@5.62.0": - version "5.62.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.62.0.tgz#2174011917ce582875954ffe2f6912d5931e353e" - integrity sha512-07ny+LHRzQXepkGg6w0mFY41fVUNBrL2Roj/++7V1txKugfjm/Ci/qSND03r2RhlJhJYMcTn9AhhSSqQp0Ysyw== - dependencies: - "@typescript-eslint/types" "5.62.0" - eslint-visitor-keys "^3.3.0" + minimatch "^9.0.4" + semver "^7.6.0" + ts-api-utils "^1.3.0" + +"@typescript-eslint/utils@7.18.0": + version "7.18.0" + resolved "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.18.0.tgz" + integrity sha512-kK0/rNa2j74XuHVcoCZxdFBMF+aq/vH83CXAOHieC+2Gis4mF8jJXT5eAfyD3K0sAxtPuwxaIOIOvhwzVDt/kw== + dependencies: + "@eslint-community/eslint-utils" "^4.4.0" + "@typescript-eslint/scope-manager" "7.18.0" + "@typescript-eslint/types" "7.18.0" + "@typescript-eslint/typescript-estree" "7.18.0" + +"@typescript-eslint/visitor-keys@7.18.0": + version "7.18.0" + resolved "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.18.0.tgz" + integrity sha512-cDF0/Gf81QpY3xYyJKDV14Zwdmid5+uuENhjH2EqFaF0ni+yAyq/LzMaIJdhNJXZI7uLzwIlA+V7oWoyn6Curg== + dependencies: + "@typescript-eslint/types" "7.18.0" + eslint-visitor-keys "^3.4.3" "@ungap/structured-clone@^1.2.0": version "1.3.0" - resolved "https://registry.yarnpkg.com/@ungap/structured-clone/-/structured-clone-1.3.0.tgz#d06bbb384ebcf6c505fde1c3d0ed4ddffe0aaff8" + resolved "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.0.tgz" integrity sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g== -JSONStream@^1.0.4: - version "1.3.5" - resolved "https://registry.yarnpkg.com/JSONStream/-/JSONStream-1.3.5.tgz#3208c1f08d3a4d99261ab64f92302bc15e111ca0" - integrity sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ== - dependencies: - jsonparse "^1.2.0" - through ">=2.2.7 <3" - -abab@^2.0.3, abab@^2.0.5: - version "2.0.6" - resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.6.tgz#41b80f2c871d19686216b82309231cfd3cb3d291" - integrity sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA== - -acorn-globals@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-6.0.0.tgz#46cdd39f0f8ff08a876619b55f5ac8a6dc770b45" - integrity sha512-ZQl7LOWaF5ePqqcX4hLuv/bLXYQNfNWw2c0/yX/TsPRKamzHcTGQnlCjHT3TsmkOUVEPS3crCxiPfdzE/Trlhg== - dependencies: - acorn "^7.1.1" - acorn-walk "^7.1.1" - -acorn-jsx@^5.2.0, acorn-jsx@^5.3.1, acorn-jsx@^5.3.2: +acorn-jsx@^5.3.2: version "5.3.2" - resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" + resolved "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz" integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ== -acorn-walk@^7.1.1: - version "7.2.0" - resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-7.2.0.tgz#0de889a601203909b0fbe07b8938dc21d2e967bc" - integrity sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA== - -acorn-walk@^8.1.1: - version "8.3.4" - resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.3.4.tgz#794dd169c3977edf4ba4ea47583587c5866236b7" - integrity sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g== - dependencies: - acorn "^8.11.0" - -acorn@^7.1.1, acorn@^7.4.0: - version "7.4.1" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.4.1.tgz#feaed255973d2e77555b83dbc08851a6c63520fa" - integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A== - -acorn@^8.11.0, acorn@^8.2.4, acorn@^8.4.1, acorn@^8.9.0: +acorn@^8.9.0: version "8.15.0" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.15.0.tgz#a360898bc415edaac46c8241f6383975b930b816" + resolved "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz" integrity sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg== -add-stream@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/add-stream/-/add-stream-1.0.0.tgz#6a7990437ca736d5e1288db92bd3266d5f5cb2aa" - integrity sha512-qQLMr+8o0WC4FZGQTcJiKBVC59JylcPSrTtk6usvmIDFUOCKegapy1VHQwRbFMOFyb/inzUVqHs+eMYKDM1YeQ== - -aes-js@3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-3.0.0.tgz#e21df10ad6c2053295bcbb8dab40b09dbea87e4d" - integrity sha512-H7wUZRn8WpTq9jocdxQ2c8x2sKo9ZVmzfRE13GiNJXfp7NcKYEdvl3vspKjXox6RIG2VtaRe4JFvxG4rqp2Zuw== - -agent-base@6: - version "6.0.2" - resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-6.0.2.tgz#49fff58577cfee3f37176feab4c22e00f86d7f77" - integrity sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ== - dependencies: - debug "4" - aggregate-error@^3.0.0: version "3.1.0" - resolved "https://registry.yarnpkg.com/aggregate-error/-/aggregate-error-3.1.0.tgz#92670ff50f5359bdb7a3e0d40d0ec30c5737687a" + resolved "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz" integrity sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA== dependencies: clean-stack "^2.0.0" indent-string "^4.0.0" -ajv@^6.10.0, ajv@^6.12.4: - version "6.12.6" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" - integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== +ajv@^6.12.4: + version "6.15.0" + resolved "https://registry.npmjs.org/ajv/-/ajv-6.15.0.tgz" + integrity sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw== dependencies: fast-deep-equal "^3.1.1" fast-json-stable-stringify "^2.0.0" json-schema-traverse "^0.4.1" uri-js "^4.2.2" -ajv@^8.0.1: - version "8.17.1" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.17.1.tgz#37d9a5c776af6bc92d7f4f9510eba4c0a60d11a6" - integrity sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g== - dependencies: - fast-deep-equal "^3.1.3" - fast-uri "^3.0.1" - json-schema-traverse "^1.0.0" - require-from-string "^2.0.2" - -ansi-colors@^4.1.1: - version "4.1.3" - resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.3.tgz#37611340eb2243e70cc604cad35d63270d48781b" - integrity sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw== - ansi-escapes@^4.2.1, ansi-escapes@^4.3.0: version "4.3.2" - resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.3.2.tgz#6b2291d1db7d98b6521d5f1efa42d0f3a9feb65e" + resolved "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz" integrity sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ== dependencies: type-fest "^0.21.3" -ansi-regex@^2.0.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" - integrity sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA== - -ansi-regex@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.1.tgz#123d6479e92ad45ad897d4054e3c7ca7db4944e1" - integrity sha512-+O9Jct8wf++lXxxFc4hc8LsjaSq0HFzzL7cVsw8pRDIPdjKD2mT4ytDZlLuSBZ4cLKZFXIrMGO7DbQCtMJJMKw== - ansi-regex@^5.0.1: version "5.0.1" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" + resolved "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz" integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== ansi-regex@^6.0.1: - version "6.1.0" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-6.1.0.tgz#95ec409c69619d6cb1b8b34f14b660ef28ebd654" - integrity sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA== - -ansi-styles@^2.2.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" - integrity sha512-kmCevFghRiWM7HB5zTPULl4r9bVFSWjz62MhqizDGUrq2NWuNMQyuv4tHHoKJHs69M/MF64lEcHdYIocrdWQYA== - -ansi-styles@^3.2.0, ansi-styles@^3.2.1: - version "3.2.1" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" - integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== - dependencies: - color-convert "^1.9.0" + version "6.2.2" + resolved "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz" + integrity sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg== ansi-styles@^4.0.0, ansi-styles@^4.1.0: version "4.3.0" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" + resolved "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz" integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== dependencies: color-convert "^2.0.1" ansi-styles@^5.0.0: version "5.2.0" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-5.2.0.tgz#07449690ad45777d1924ac2abb2fc8895dba836b" + resolved "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz" integrity sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA== ansi-styles@^6.0.0: - version "6.2.1" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-6.2.1.tgz#0e62320cf99c21afff3b3012192546aacbfb05c5" - integrity sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug== + version "6.2.3" + resolved "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz" + integrity sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg== anymatch@^3.0.3: version "3.1.3" - resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.3.tgz#790c58b19ba1720a84205b57c618d5ad8524973e" + resolved "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz" integrity sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw== dependencies: normalize-path "^3.0.0" picomatch "^2.0.4" -arg@^4.1.0: - version "4.1.3" - resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089" - integrity sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA== - argparse@^1.0.7: version "1.0.10" - resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" + resolved "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz" integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg== dependencies: sprintf-js "~1.0.2" argparse@^2.0.1: version "2.0.1" - resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" + resolved "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz" integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== array-buffer-byte-length@^1.0.1, array-buffer-byte-length@^1.0.2: version "1.0.2" - resolved "https://registry.yarnpkg.com/array-buffer-byte-length/-/array-buffer-byte-length-1.0.2.tgz#384d12a37295aec3769ab022ad323a18a51ccf8b" + resolved "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.2.tgz" integrity sha512-LHE+8BuR7RYGDKvnrmcuSq3tDcKv9OFEXQt/HpbZhY7V6h0zlUXutnAD82GiFx9rdieCMjkvtcsPqBwgUl1Iiw== dependencies: call-bound "^1.0.3" is-array-buffer "^3.0.5" -array-ify@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/array-ify/-/array-ify-1.0.0.tgz#9e528762b4a9066ad163a6962a364418e9626ece" - integrity sha512-c5AMf34bKdvPhQ7tBGhqkgKNUzMr4WUs+WDtC2ZUGOUncbxKMTvqxYctiseW3+L4bA8ec+GcZ6/A/FW4m8ukng== - array-includes@^3.1.9: version "3.1.9" - resolved "https://registry.yarnpkg.com/array-includes/-/array-includes-3.1.9.tgz#1f0ccaa08e90cdbc3eb433210f903ad0f17c3f3a" + resolved "https://registry.npmjs.org/array-includes/-/array-includes-3.1.9.tgz" integrity sha512-FmeCCAenzH0KH381SPT5FZmiA/TmpndpcaShhfgEN9eCVjnFBqq3l1xrI42y8+PPLI6hypzou4GXw00WHmPBLQ== dependencies: call-bind "^1.0.8" @@ -2172,12 +1541,12 @@ array-includes@^3.1.9: array-union@^2.1.0: version "2.1.0" - resolved "https://registry.yarnpkg.com/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d" + resolved "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz" integrity sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw== array.prototype.findlastindex@^1.2.6: version "1.2.6" - resolved "https://registry.yarnpkg.com/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.6.tgz#cfa1065c81dcb64e34557c9b81d012f6a421c564" + resolved "https://registry.npmjs.org/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.6.tgz" integrity sha512-F/TKATkzseUExPlfvmwQKGITM3DGTK+vkAsCZoDc5daVygbJBnjEUCbgkAvVFsgfXfX4YIqZ/27G3k3tdXrTxQ== dependencies: call-bind "^1.0.8" @@ -2190,7 +1559,7 @@ array.prototype.findlastindex@^1.2.6: array.prototype.flat@^1.3.3: version "1.3.3" - resolved "https://registry.yarnpkg.com/array.prototype.flat/-/array.prototype.flat-1.3.3.tgz#534aaf9e6e8dd79fb6b9a9917f839ef1ec63afe5" + resolved "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.3.tgz" integrity sha512-rwG/ja1neyLqCuGZ5YYrznA62D4mZXg0i1cIskIUKSiqF3Cje9/wXAls9B9s1Wa2fomMsIv8czB8jZcPmxCXFg== dependencies: call-bind "^1.0.8" @@ -2200,7 +1569,7 @@ array.prototype.flat@^1.3.3: array.prototype.flatmap@^1.3.3: version "1.3.3" - resolved "https://registry.yarnpkg.com/array.prototype.flatmap/-/array.prototype.flatmap-1.3.3.tgz#712cc792ae70370ae40586264629e33aab5dd38b" + resolved "https://registry.npmjs.org/array.prototype.flatmap/-/array.prototype.flatmap-1.3.3.tgz" integrity sha512-Y7Wt51eKJSyi80hFrJCePGGNo5ktJCslFuboqJsbf57CCPcm5zztluPlc4/aD8sWsKvlwatezpV4U1efk8kpjg== dependencies: call-bind "^1.0.8" @@ -2210,7 +1579,7 @@ array.prototype.flatmap@^1.3.3: arraybuffer.prototype.slice@^1.0.4: version "1.0.4" - resolved "https://registry.yarnpkg.com/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.4.tgz#9d760d84dbdd06d0cbf92c8849615a1a7ab3183c" + resolved "https://registry.npmjs.org/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.4.tgz" integrity sha512-BNoCY6SXXPQ7gF2opIP4GBE+Xw7U+pHMYKuzjgCN3GwiaIR09UUeKfheyIry77QtrCBlC0KK0q5/TER/tYh3PQ== dependencies: array-buffer-byte-length "^1.0.1" @@ -2221,50 +1590,39 @@ arraybuffer.prototype.slice@^1.0.4: get-intrinsic "^1.2.6" is-array-buffer "^3.0.4" -arrify@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" - integrity sha512-3CYzex9M9FGQjCGMGyi6/31c8GJbgb0qGyrx5HWxPd0aCwh4cB2YjMb2Xf9UuoogrMrlO9cTqnB5rI5GHZTcUA== - astral-regex@^2.0.0: version "2.0.0" - resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-2.0.0.tgz#483143c567aeed4785759c0865786dc77d7d2e31" + resolved "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz" integrity sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ== async-function@^1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/async-function/-/async-function-1.0.0.tgz#509c9fca60eaf85034c6829838188e4e4c8ffb2b" + resolved "https://registry.npmjs.org/async-function/-/async-function-1.0.0.tgz" integrity sha512-hsU18Ae8CDTR6Kgu9DYf0EbCr/a5iGL0rytQDobUcdpYOKokk8LEjVphnXkDkgpi0wYVsqrXuP0bZxJaTqdgoA== -asynckit@^0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" - integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q== - available-typed-arrays@^1.0.7: version "1.0.7" - resolved "https://registry.yarnpkg.com/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz#a5cc375d6a03c2efc87a553f3e0b1522def14846" + resolved "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz" integrity sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ== dependencies: possible-typed-array-names "^1.0.0" -babel-jest@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-27.5.1.tgz#a1bf8d61928edfefd21da27eb86a695bfd691444" - integrity sha512-cdQ5dXjGRd0IBRATiQ4mZGlGlRE8kJpjPOixdNRdT+m3UcNqmYWN6rK6nvtXYfY3D76cb8s/O1Ss8ea24PIwcg== +babel-jest@^29.7.0: + version "29.7.0" + resolved "https://registry.npmjs.org/babel-jest/-/babel-jest-29.7.0.tgz" + integrity sha512-BrvGY3xZSwEcCzKvKsCi2GgHqDqsYkOP4/by5xCgIwGXQxIEh+8ew3gmrE1y7XRR6LHZIj6yLYnUi/mm2KXKBg== dependencies: - "@jest/transform" "^27.5.1" - "@jest/types" "^27.5.1" + "@jest/transform" "^29.7.0" "@types/babel__core" "^7.1.14" babel-plugin-istanbul "^6.1.1" - babel-preset-jest "^27.5.1" + babel-preset-jest "^29.6.3" chalk "^4.0.0" graceful-fs "^4.2.9" slash "^3.0.0" babel-plugin-istanbul@^6.1.1: version "6.1.1" - resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz#fa88ec59232fd9b4e36dbbc540a8ec9a9b47da73" + resolved "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz" integrity sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA== dependencies: "@babel/helper-plugin-utils" "^7.0.0" @@ -2273,19 +1631,19 @@ babel-plugin-istanbul@^6.1.1: istanbul-lib-instrument "^5.0.4" test-exclude "^6.0.0" -babel-plugin-jest-hoist@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-27.5.1.tgz#9be98ecf28c331eb9f5df9c72d6f89deb8181c2e" - integrity sha512-50wCwD5EMNW4aRpOwtqzyZHIewTYNxLA4nhB+09d8BIssfNfzBRhkBIHiaPv1Si226TQSvp8gxAJm2iY2qs2hQ== +babel-plugin-jest-hoist@^29.6.3: + version "29.6.3" + resolved "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-29.6.3.tgz" + integrity sha512-ESAc/RJvGTFEzRwOTT4+lNDk/GNHMkKbNzsvT0qKRfDyyYTskxB5rnU2njIDYVxXCBHHEI1c0YwHob3WaYujOg== dependencies: "@babel/template" "^7.3.3" "@babel/types" "^7.3.3" - "@types/babel__core" "^7.0.0" + "@types/babel__core" "^7.1.14" "@types/babel__traverse" "^7.0.6" babel-plugin-polyfill-corejs2@^0.4.14: version "0.4.14" - resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.4.14.tgz#8101b82b769c568835611542488d463395c2ef8f" + resolved "https://registry.npmjs.org/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.4.14.tgz" integrity sha512-Co2Y9wX854ts6U8gAAPXfn0GmAyctHuK8n0Yhfjd6t30g7yvKjspvvOo9yG+z52PZRgFErt7Ka2pYnXCjLKEpg== dependencies: "@babel/compat-data" "^7.27.7" @@ -2294,7 +1652,7 @@ babel-plugin-polyfill-corejs2@^0.4.14: babel-plugin-polyfill-corejs3@^0.13.0: version "0.13.0" - resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.13.0.tgz#bb7f6aeef7addff17f7602a08a6d19a128c30164" + resolved "https://registry.npmjs.org/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.13.0.tgz" integrity sha512-U+GNwMdSFgzVmfhNm8GJUX88AadB3uo9KpJqS3FaqNIPKgySuvMb+bHPsOmmuWyIcuqZj/pzt1RUIUZns4y2+A== dependencies: "@babel/helper-define-polyfill-provider" "^0.6.5" @@ -2302,15 +1660,15 @@ babel-plugin-polyfill-corejs3@^0.13.0: babel-plugin-polyfill-regenerator@^0.6.5: version "0.6.5" - resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.6.5.tgz#32752e38ab6f6767b92650347bf26a31b16ae8c5" + resolved "https://registry.npmjs.org/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.6.5.tgz" integrity sha512-ISqQ2frbiNU9vIJkzg7dlPpznPZ4jOiUQ1uSmB0fEHeowtN3COYRsXr/xexn64NpU13P06jc/L5TgiJXOgrbEg== dependencies: "@babel/helper-define-polyfill-provider" "^0.6.5" babel-preset-current-node-syntax@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.1.0.tgz#9a929eafece419612ef4ae4f60b1862ebad8ef30" - integrity sha512-ldYss8SbBlWva1bs28q78Ju5Zq1F+8BrqBZZ0VFhLBvhh6lCpC2o3gDJi/5DRLs9FgYZCnmPYIVFU4lRXCkyUw== + version "1.2.0" + resolved "https://registry.npmjs.org/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.2.0.tgz" + integrity sha512-E/VlAEzRrsLEb2+dv8yp3bo4scof3l9nR4lrld+Iy5NyVqgVYUJnDAmunkhPMisRI32Qc4iRiz425d8vM++2fg== dependencies: "@babel/plugin-syntax-async-generators" "^7.8.4" "@babel/plugin-syntax-bigint" "^7.8.3" @@ -2328,91 +1686,79 @@ babel-preset-current-node-syntax@^1.0.0: "@babel/plugin-syntax-private-property-in-object" "^7.14.5" "@babel/plugin-syntax-top-level-await" "^7.14.5" -babel-preset-jest@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-27.5.1.tgz#91f10f58034cb7989cb4f962b69fa6eef6a6bc81" - integrity sha512-Nptf2FzlPCWYuJg41HBqXVT8ym6bXOevuCTbhxlUpjwtysGaIWFvDEjp4y+G7fl13FgOdjs7P/DmErqH7da0Ag== +babel-preset-jest@^29.6.3: + version "29.6.3" + resolved "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-29.6.3.tgz" + integrity sha512-0B3bhxR6snWXJZtR/RliHTDPRgn1sNHOR0yVtq/IiQFyuOVjFS+wuio/R4gSNkyYmKmJB4wGZv2NZanmKmTnNA== dependencies: - babel-plugin-jest-hoist "^27.5.1" + babel-plugin-jest-hoist "^29.6.3" babel-preset-current-node-syntax "^1.0.0" balanced-match@^1.0.0: version "1.0.2" - resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" + resolved "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz" integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== -bech32@1.1.4: - version "1.1.4" - resolved "https://registry.yarnpkg.com/bech32/-/bech32-1.1.4.tgz#e38c9f37bf179b8eb16ae3a772b40c356d4832e9" - integrity sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ== - -bn.js@^4.11.9: - version "4.12.2" - resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.12.2.tgz#3d8fed6796c24e177737f7cc5172ee04ef39ec99" - integrity sha512-n4DSx829VRTRByMRGdjQ9iqsN0Bh4OolPsFnaZBLcbi8iXcB+kJ9s7EnRt4wILZNV3kPLHkRVfOc/HvhC3ovDw== - -bn.js@^5.2.1: - version "5.2.2" - resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.2.tgz#82c09f9ebbb17107cd72cb7fd39bd1f9d0aaa566" - integrity sha512-v2YAxEmKaBLahNwE1mjp4WON6huMNeuDvagFZW+ASCuA/ku0bXR9hSMw0XpiqMoA3+rmnyck/tPRSFQkoC9Cuw== +baseline-browser-mapping@^2.9.0: + version "2.9.15" + resolved "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.9.15.tgz" + integrity sha512-kX8h7K2srmDyYnXRIppo4AH/wYgzWVCs+eKr3RusRSQ5PvRYoEFmR/I0PbdTjKFAoKqp5+kbxnNTFO9jOfSVJg== brace-expansion@^1.1.7: - version "1.1.12" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.12.tgz#ab9b454466e5a8cc3a187beaad580412a9c5b843" - integrity sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg== + version "1.1.15" + resolved "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.15.tgz" + integrity sha512-EwOCDEex4quD37XhqM3omwtMoJjr//isUZz1JopUNWms+4Z2ViyM/k1YIRePpoVNnQhENnxtFjLaxNHrT7xIUg== dependencies: balanced-match "^1.0.0" concat-map "0.0.1" +brace-expansion@^2.0.2: + version "2.1.1" + resolved "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.1.tgz" + integrity sha512-WR1cURNjuvBLMZBMbqM0UoE+WAfdUcEV1ccD8PVBVOI+Z3ND4+SZbN8RsfT2bMuG1qwz5RFvPukSZm5fF2D5eA== + dependencies: + balanced-match "^1.0.0" + braces@^3.0.3: version "3.0.3" - resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.3.tgz#490332f40919452272d55a8480adc0c441358789" + resolved "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz" integrity sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA== dependencies: fill-range "^7.1.1" -brorand@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f" - integrity sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w== - -browser-process-hrtime@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/browser-process-hrtime/-/browser-process-hrtime-1.0.0.tgz#3c9b4b7d782c8121e56f10106d84c0d0ffc94626" - integrity sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow== - -browserslist@^4.24.0, browserslist@^4.25.1: - version "4.25.1" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.25.1.tgz#ba9e8e6f298a1d86f829c9b975e07948967bb111" - integrity sha512-KGj0KoOMXLpSNkkEI6Z6mShmQy0bc1I+T7K9N81k4WWMrfz+6fQ6es80B/YLAeRoKvjYE1YSHHOW1qe9xIVzHw== +browserslist@^4.24.0, browserslist@^4.28.0: + version "4.28.1" + resolved "https://registry.npmjs.org/browserslist/-/browserslist-4.28.1.tgz" + integrity sha512-ZC5Bd0LgJXgwGqUknZY/vkUQ04r8NXnJZ3yYi4vDmSiZmC/pdSN0NbNRPxZpbtO4uAfDUAFffO8IZoM3Gj8IkA== dependencies: - caniuse-lite "^1.0.30001726" - electron-to-chromium "^1.5.173" - node-releases "^2.0.19" - update-browserslist-db "^1.1.3" + baseline-browser-mapping "^2.9.0" + caniuse-lite "^1.0.30001759" + electron-to-chromium "^1.5.263" + node-releases "^2.0.27" + update-browserslist-db "^1.2.0" -bs-logger@0.x: +bs-logger@^0.2.6: version "0.2.6" - resolved "https://registry.yarnpkg.com/bs-logger/-/bs-logger-0.2.6.tgz#eb7d365307a72cf974cc6cda76b68354ad336bd8" + resolved "https://registry.npmjs.org/bs-logger/-/bs-logger-0.2.6.tgz" integrity sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog== dependencies: fast-json-stable-stringify "2.x" bser@2.1.1: version "2.1.1" - resolved "https://registry.yarnpkg.com/bser/-/bser-2.1.1.tgz#e6787da20ece9d07998533cfd9de6f5c38f4bc05" + resolved "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz" integrity sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ== dependencies: node-int64 "^0.4.0" buffer-from@^1.0.0: version "1.1.2" - resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5" + resolved "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz" integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== call-bind-apply-helpers@^1.0.0, call-bind-apply-helpers@^1.0.1, call-bind-apply-helpers@^1.0.2: version "1.0.2" - resolved "https://registry.yarnpkg.com/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz#4b5428c222be985d79c3d82657479dbe0b59b2d6" + resolved "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz" integrity sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ== dependencies: es-errors "^1.3.0" @@ -2420,7 +1766,7 @@ call-bind-apply-helpers@^1.0.0, call-bind-apply-helpers@^1.0.1, call-bind-apply- call-bind@^1.0.7, call-bind@^1.0.8: version "1.0.8" - resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.8.tgz#0736a9660f537e3388826f440d5ec45f744eaa4c" + resolved "https://registry.npmjs.org/call-bind/-/call-bind-1.0.8.tgz" integrity sha512-oKlSFMcMwpUg2ednkhQ454wfWiU/ul3CkJe/PEHcTKuiX6RpbehUiFMXu13HalGZxfUwCQzZG747YXBn1im9ww== dependencies: call-bind-apply-helpers "^1.0.0" @@ -2430,7 +1776,7 @@ call-bind@^1.0.7, call-bind@^1.0.8: call-bound@^1.0.2, call-bound@^1.0.3, call-bound@^1.0.4: version "1.0.4" - resolved "https://registry.yarnpkg.com/call-bound/-/call-bound-1.0.4.tgz#238de935d2a2a692928c538c7ccfa91067fd062a" + resolved "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz" integrity sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg== dependencies: call-bind-apply-helpers "^1.0.2" @@ -2438,56 +1784,27 @@ call-bound@^1.0.2, call-bound@^1.0.3, call-bound@^1.0.4: callsites@^3.0.0: version "3.1.0" - resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" + resolved "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz" integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== -camelcase-keys@^6.2.2: - version "6.2.2" - resolved "https://registry.yarnpkg.com/camelcase-keys/-/camelcase-keys-6.2.2.tgz#5e755d6ba51aa223ec7d3d52f25778210f9dc3c0" - integrity sha512-YrwaA0vEKazPBkn0ipTiMpSajYDSe+KjQfrjhcBMxJt/znbvlHd8Pw/Vamaz5EB4Wfhs3SUR3Z9mwRu/P3s3Yg== - dependencies: - camelcase "^5.3.1" - map-obj "^4.0.0" - quick-lru "^4.0.1" - camelcase@^5.3.1: version "5.3.1" - resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" + resolved "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz" integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== camelcase@^6.2.0: version "6.3.0" - resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a" + resolved "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz" integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== -caniuse-lite@^1.0.30001726: - version "1.0.30001727" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001727.tgz#22e9706422ad37aa50556af8c10e40e2d93a8b85" - integrity sha512-pB68nIHmbN6L/4C6MH1DokyR3bYqFwjaSs/sWDHGj4CTcFtQUQMuJftVwWkXq7mNWOybD3KhUv3oWHoGxgP14Q== - -chalk@^1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" - integrity sha512-U3lRVLMSlsCfjqYPbLyVv11M9CPW4I728d6TCKMAOJueEeB9/8o+eSsMnxPJD+Q+K909sdESg7C+tIkoH6on1A== - dependencies: - ansi-styles "^2.2.1" - escape-string-regexp "^1.0.2" - has-ansi "^2.0.0" - strip-ansi "^3.0.0" - supports-color "^2.0.0" - -chalk@^2.4.2: - version "2.4.2" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" - integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== - dependencies: - ansi-styles "^3.2.1" - escape-string-regexp "^1.0.5" - supports-color "^5.3.0" +caniuse-lite@^1.0.30001759: + version "1.0.30001764" + resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001764.tgz" + integrity sha512-9JGuzl2M+vPL+pz70gtMF9sHdMFbY9FJaQBi186cHKH3pSzDvzoUJUPV6fqiKIMyXbud9ZLg4F3Yza1vJ1+93g== chalk@^4.0.0: version "4.1.2" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" + resolved "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz" integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== dependencies: ansi-styles "^4.1.0" @@ -2495,34 +1812,34 @@ chalk@^4.0.0: char-regex@^1.0.2: version "1.0.2" - resolved "https://registry.yarnpkg.com/char-regex/-/char-regex-1.0.2.tgz#d744358226217f981ed58f479b1d6bcc29545dcf" + resolved "https://registry.npmjs.org/char-regex/-/char-regex-1.0.2.tgz" integrity sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw== ci-info@^3.2.0: version "3.9.0" - resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-3.9.0.tgz#4279a62028a7b1f262f3473fc9605f5e218c59b4" + resolved "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz" integrity sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ== cjs-module-lexer@^1.0.0: version "1.4.3" - resolved "https://registry.yarnpkg.com/cjs-module-lexer/-/cjs-module-lexer-1.4.3.tgz#0f79731eb8cfe1ec72acd4066efac9d61991b00d" + resolved "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.4.3.tgz" integrity sha512-9z8TZaGM1pfswYeXrUpzPrkx8UnWYdhJclsiYMm6x/w5+nN+8Tf/LnAgfLGQCm59qAOxU8WwHEq2vNwF6i4j+Q== clean-stack@^2.0.0: version "2.2.0" - resolved "https://registry.yarnpkg.com/clean-stack/-/clean-stack-2.2.0.tgz#ee8472dbb129e727b31e8a10a427dee9dfe4008b" + resolved "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz" integrity sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A== cli-cursor@^3.1.0: version "3.1.0" - resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-3.1.0.tgz#264305a7ae490d1d03bf0c9ba7c925d1753af307" + resolved "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz" integrity sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw== dependencies: restore-cursor "^3.1.0" cli-truncate@^2.1.0: version "2.1.0" - resolved "https://registry.yarnpkg.com/cli-truncate/-/cli-truncate-2.1.0.tgz#c39e28bf05edcde5be3b98992a22deed5a2b93c7" + resolved "https://registry.npmjs.org/cli-truncate/-/cli-truncate-2.1.0.tgz" integrity sha512-n8fOixwDD6b/ObinzTrp1ZKFzbgvKZvuz/TvejnLn1aQfC6r52XEx85FmuC+3HI+JM7coBRXUvNqEU2PHVrHpg== dependencies: slice-ansi "^3.0.0" @@ -2530,338 +1847,95 @@ cli-truncate@^2.1.0: cli-truncate@^3.1.0: version "3.1.0" - resolved "https://registry.yarnpkg.com/cli-truncate/-/cli-truncate-3.1.0.tgz#3f23ab12535e3d73e839bb43e73c9de487db1389" + resolved "https://registry.npmjs.org/cli-truncate/-/cli-truncate-3.1.0.tgz" integrity sha512-wfOBkjXteqSnI59oPcJkcPl/ZmwvMMOj340qUIY1SKZCv0B9Cf4D4fAucRkIKQmsIuYK3x1rrgU7MeGRruiuiA== dependencies: slice-ansi "^5.0.0" string-width "^5.0.0" -cliui@^7.0.2: - version "7.0.4" - resolved "https://registry.yarnpkg.com/cliui/-/cliui-7.0.4.tgz#a0265ee655476fc807aea9df3df8df7783808b4f" - integrity sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ== +cliui@^8.0.1: + version "8.0.1" + resolved "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz" + integrity sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ== dependencies: string-width "^4.2.0" - strip-ansi "^6.0.0" + strip-ansi "^6.0.1" wrap-ansi "^7.0.0" co@^4.6.0: version "4.6.0" - resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" + resolved "https://registry.npmjs.org/co/-/co-4.6.0.tgz" integrity sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ== collect-v8-coverage@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/collect-v8-coverage/-/collect-v8-coverage-1.0.2.tgz#c0b29bcd33bcd0779a1344c2136051e6afd3d9e9" - integrity sha512-lHl4d5/ONEbLlJvaJNtsF/Lz+WvB07u2ycqTYbdrq7UypDXailES4valYb2eWiJFxZlVmpGekfqoxQhzyFdT4Q== - -color-convert@^1.9.0: - version "1.9.3" - resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" - integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== - dependencies: - color-name "1.1.3" + version "1.0.3" + resolved "https://registry.npmjs.org/collect-v8-coverage/-/collect-v8-coverage-1.0.3.tgz" + integrity sha512-1L5aqIkwPfiodaMgQunkF1zRhNqifHBmtbbbxcr6yVxxBnliw4TDOW6NxpO8DJLgJ16OT+Y4ztZqP6p/FtXnAw== color-convert@^2.0.1: version "2.0.1" - resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" + resolved "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz" integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== dependencies: color-name "~1.1.4" -color-name@1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" - integrity sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw== - color-name@~1.1.4: version "1.1.4" - resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" + resolved "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz" integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== colorette@^2.0.16: version "2.0.20" - resolved "https://registry.yarnpkg.com/colorette/-/colorette-2.0.20.tgz#9eb793e6833067f7235902fcd3b09917a000a95a" + resolved "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz" integrity sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w== -combined-stream@^1.0.8: - version "1.0.8" - resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" - integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== - dependencies: - delayed-stream "~1.0.0" - commander@^9.3.0: version "9.5.0" - resolved "https://registry.yarnpkg.com/commander/-/commander-9.5.0.tgz#bc08d1eb5cedf7ccb797a96199d41c7bc3e60d30" + resolved "https://registry.npmjs.org/commander/-/commander-9.5.0.tgz" integrity sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ== -common-tags@^1.4.0: - version "1.8.2" - resolved "https://registry.yarnpkg.com/common-tags/-/common-tags-1.8.2.tgz#94ebb3c076d26032745fd54face7f688ef5ac9c6" - integrity sha512-gk/Z852D2Wtb//0I+kRFNKKE9dIIVirjoqPoA1wJU+XePVXZfGeBpk45+A1rKO4Q43prqWBNY/MiIeRLbPWUaA== - -compare-func@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/compare-func/-/compare-func-2.0.0.tgz#fb65e75edbddfd2e568554e8b5b05fff7a51fcb3" - integrity sha512-zHig5N+tPWARooBnb0Zx1MFcdfpyJrfTJ3Y5L+IFvUm8rM74hHz66z0gw0x4tijh5CorKkKUCnW82R2vmpeCRA== - dependencies: - array-ify "^1.0.0" - dot-prop "^5.1.0" - -concat-map@0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" - integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== - -concat-stream@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-2.0.0.tgz#414cf5af790a48c60ab9be4527d56d5e41133cb1" - integrity sha512-MWufYdFw53ccGjCA+Ol7XJYpAlW6/prSMzuPOTRnJGcGzuhLn4Scrz7qf6o8bROZ514ltazcIFJZevcfbo0x7A== - dependencies: - buffer-from "^1.0.0" - inherits "^2.0.3" - readable-stream "^3.0.2" - typedarray "^0.0.6" - -confusing-browser-globals@^1.0.10: - version "1.0.11" - resolved "https://registry.yarnpkg.com/confusing-browser-globals/-/confusing-browser-globals-1.0.11.tgz#ae40e9b57cdd3915408a2805ebd3a5585608dc81" - integrity sha512-JsPKdmh8ZkmnHxDk55FZ1TqVLvEQTvoByJZRN9jzI0UjxK/QgAmsphz7PGtqgPieQZ/CQcHWXCR7ATDNhGe+YA== - -conventional-changelog-angular@^5.0.12: - version "5.0.13" - resolved "https://registry.yarnpkg.com/conventional-changelog-angular/-/conventional-changelog-angular-5.0.13.tgz#896885d63b914a70d4934b59d2fe7bde1832b28c" - integrity sha512-i/gipMxs7s8L/QeuavPF2hLnJgH6pEZAttySB6aiQLWcX3puWDL3ACVmvBhJGxnAy52Qc15ua26BufY6KpmrVA== - dependencies: - compare-func "^2.0.0" - q "^1.5.1" - -conventional-changelog-atom@^2.0.8: - version "2.0.8" - resolved "https://registry.yarnpkg.com/conventional-changelog-atom/-/conventional-changelog-atom-2.0.8.tgz#a759ec61c22d1c1196925fca88fe3ae89fd7d8de" - integrity sha512-xo6v46icsFTK3bb7dY/8m2qvc8sZemRgdqLb/bjpBsH2UyOS8rKNTgcb5025Hri6IpANPApbXMg15QLb1LJpBw== - dependencies: - q "^1.5.1" - -conventional-changelog-codemirror@^2.0.8: - version "2.0.8" - resolved "https://registry.yarnpkg.com/conventional-changelog-codemirror/-/conventional-changelog-codemirror-2.0.8.tgz#398e9530f08ce34ec4640af98eeaf3022eb1f7dc" - integrity sha512-z5DAsn3uj1Vfp7po3gpt2Boc+Bdwmw2++ZHa5Ak9k0UKsYAO5mH1UBTN0qSCuJZREIhX6WU4E1p3IW2oRCNzQw== - dependencies: - q "^1.5.1" - -conventional-changelog-config-spec@2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/conventional-changelog-config-spec/-/conventional-changelog-config-spec-2.1.0.tgz#874a635287ef8b581fd8558532bf655d4fb59f2d" - integrity sha512-IpVePh16EbbB02V+UA+HQnnPIohgXvJRxHcS5+Uwk4AT5LjzCZJm5sp/yqs5C6KZJ1jMsV4paEV13BN1pvDuxQ== - -conventional-changelog-conventionalcommits@4.6.3, conventional-changelog-conventionalcommits@^4.5.0: - version "4.6.3" - resolved "https://registry.yarnpkg.com/conventional-changelog-conventionalcommits/-/conventional-changelog-conventionalcommits-4.6.3.tgz#0765490f56424b46f6cb4db9135902d6e5a36dc2" - integrity sha512-LTTQV4fwOM4oLPad317V/QNQ1FY4Hju5qeBIM1uTHbrnCE+Eg4CdRZ3gO2pUeR+tzWdp80M2j3qFFEDWVqOV4g== - dependencies: - compare-func "^2.0.0" - lodash "^4.17.15" - q "^1.5.1" - -conventional-changelog-core@^4.2.1: - version "4.2.4" - resolved "https://registry.yarnpkg.com/conventional-changelog-core/-/conventional-changelog-core-4.2.4.tgz#e50d047e8ebacf63fac3dc67bf918177001e1e9f" - integrity sha512-gDVS+zVJHE2v4SLc6B0sLsPiloR0ygU7HaDW14aNJE1v4SlqJPILPl/aJC7YdtRE4CybBf8gDwObBvKha8Xlyg== - dependencies: - add-stream "^1.0.0" - conventional-changelog-writer "^5.0.0" - conventional-commits-parser "^3.2.0" - dateformat "^3.0.0" - get-pkg-repo "^4.0.0" - git-raw-commits "^2.0.8" - git-remote-origin-url "^2.0.0" - git-semver-tags "^4.1.1" - lodash "^4.17.15" - normalize-package-data "^3.0.0" - q "^1.5.1" - read-pkg "^3.0.0" - read-pkg-up "^3.0.0" - through2 "^4.0.0" - -conventional-changelog-ember@^2.0.9: - version "2.0.9" - resolved "https://registry.yarnpkg.com/conventional-changelog-ember/-/conventional-changelog-ember-2.0.9.tgz#619b37ec708be9e74a220f4dcf79212ae1c92962" - integrity sha512-ulzIReoZEvZCBDhcNYfDIsLTHzYHc7awh+eI44ZtV5cx6LVxLlVtEmcO+2/kGIHGtw+qVabJYjdI5cJOQgXh1A== - dependencies: - q "^1.5.1" - -conventional-changelog-eslint@^3.0.9: - version "3.0.9" - resolved "https://registry.yarnpkg.com/conventional-changelog-eslint/-/conventional-changelog-eslint-3.0.9.tgz#689bd0a470e02f7baafe21a495880deea18b7cdb" - integrity sha512-6NpUCMgU8qmWmyAMSZO5NrRd7rTgErjrm4VASam2u5jrZS0n38V7Y9CzTtLT2qwz5xEChDR4BduoWIr8TfwvXA== - dependencies: - q "^1.5.1" - -conventional-changelog-express@^2.0.6: - version "2.0.6" - resolved "https://registry.yarnpkg.com/conventional-changelog-express/-/conventional-changelog-express-2.0.6.tgz#420c9d92a347b72a91544750bffa9387665a6ee8" - integrity sha512-SDez2f3iVJw6V563O3pRtNwXtQaSmEfTCaTBPCqn0oG0mfkq0rX4hHBq5P7De2MncoRixrALj3u3oQsNK+Q0pQ== - dependencies: - q "^1.5.1" - -conventional-changelog-jquery@^3.0.11: - version "3.0.11" - resolved "https://registry.yarnpkg.com/conventional-changelog-jquery/-/conventional-changelog-jquery-3.0.11.tgz#d142207400f51c9e5bb588596598e24bba8994bf" - integrity sha512-x8AWz5/Td55F7+o/9LQ6cQIPwrCjfJQ5Zmfqi8thwUEKHstEn4kTIofXub7plf1xvFA2TqhZlq7fy5OmV6BOMw== - dependencies: - q "^1.5.1" - -conventional-changelog-jshint@^2.0.9: - version "2.0.9" - resolved "https://registry.yarnpkg.com/conventional-changelog-jshint/-/conventional-changelog-jshint-2.0.9.tgz#f2d7f23e6acd4927a238555d92c09b50fe3852ff" - integrity sha512-wMLdaIzq6TNnMHMy31hql02OEQ8nCQfExw1SE0hYL5KvU+JCTuPaDO+7JiogGT2gJAxiUGATdtYYfh+nT+6riA== - dependencies: - compare-func "^2.0.0" - q "^1.5.1" - -conventional-changelog-preset-loader@^2.3.4: - version "2.3.4" - resolved "https://registry.yarnpkg.com/conventional-changelog-preset-loader/-/conventional-changelog-preset-loader-2.3.4.tgz#14a855abbffd59027fd602581f1f34d9862ea44c" - integrity sha512-GEKRWkrSAZeTq5+YjUZOYxdHq+ci4dNwHvpaBC3+ENalzFWuCWa9EZXSuZBpkr72sMdKB+1fyDV4takK1Lf58g== - -conventional-changelog-writer@^5.0.0: - version "5.0.1" - resolved "https://registry.yarnpkg.com/conventional-changelog-writer/-/conventional-changelog-writer-5.0.1.tgz#e0757072f045fe03d91da6343c843029e702f359" - integrity sha512-5WsuKUfxW7suLblAbFnxAcrvf6r+0b7GvNaWUwUIk0bXMnENP/PEieGKVUQrjPqwPT4o3EPAASBXiY6iHooLOQ== - dependencies: - conventional-commits-filter "^2.0.7" - dateformat "^3.0.0" - handlebars "^4.7.7" - json-stringify-safe "^5.0.1" - lodash "^4.17.15" - meow "^8.0.0" - semver "^6.0.0" - split "^1.0.0" - through2 "^4.0.0" - -conventional-changelog@3.1.25: - version "3.1.25" - resolved "https://registry.yarnpkg.com/conventional-changelog/-/conventional-changelog-3.1.25.tgz#3e227a37d15684f5aa1fb52222a6e9e2536ccaff" - integrity sha512-ryhi3fd1mKf3fSjbLXOfK2D06YwKNic1nC9mWqybBHdObPd8KJ2vjaXZfYj1U23t+V8T8n0d7gwnc9XbIdFbyQ== - dependencies: - conventional-changelog-angular "^5.0.12" - conventional-changelog-atom "^2.0.8" - conventional-changelog-codemirror "^2.0.8" - conventional-changelog-conventionalcommits "^4.5.0" - conventional-changelog-core "^4.2.1" - conventional-changelog-ember "^2.0.9" - conventional-changelog-eslint "^3.0.9" - conventional-changelog-express "^2.0.6" - conventional-changelog-jquery "^3.0.11" - conventional-changelog-jshint "^2.0.9" - conventional-changelog-preset-loader "^2.3.4" - -conventional-commits-filter@^2.0.7: - version "2.0.7" - resolved "https://registry.yarnpkg.com/conventional-commits-filter/-/conventional-commits-filter-2.0.7.tgz#f8d9b4f182fce00c9af7139da49365b136c8a0b3" - integrity sha512-ASS9SamOP4TbCClsRHxIHXRfcGCnIoQqkvAzCSbZzTFLfcTqJVugB0agRgsEELsqaeWgsXv513eS116wnlSSPA== - dependencies: - lodash.ismatch "^4.4.0" - modify-values "^1.0.0" - -conventional-commits-parser@^3.2.0: - version "3.2.4" - resolved "https://registry.yarnpkg.com/conventional-commits-parser/-/conventional-commits-parser-3.2.4.tgz#a7d3b77758a202a9b2293d2112a8d8052c740972" - integrity sha512-nK7sAtfi+QXbxHCYfhpZsfRtaitZLIA6889kFIouLvz6repszQDgxBu7wf2WbU+Dco7sAnNCJYERCwt54WPC2Q== - dependencies: - JSONStream "^1.0.4" - is-text-path "^1.0.1" - lodash "^4.17.15" - meow "^8.0.0" - split2 "^3.0.0" - through2 "^4.0.0" - -conventional-recommended-bump@6.1.0: - version "6.1.0" - resolved "https://registry.yarnpkg.com/conventional-recommended-bump/-/conventional-recommended-bump-6.1.0.tgz#cfa623285d1de554012f2ffde70d9c8a22231f55" - integrity sha512-uiApbSiNGM/kkdL9GTOLAqC4hbptObFo4wW2QRyHsKciGAfQuLU1ShZ1BIVI/+K2BE/W1AWYQMCXAsv4dyKPaw== - dependencies: - concat-stream "^2.0.0" - conventional-changelog-preset-loader "^2.3.4" - conventional-commits-filter "^2.0.7" - conventional-commits-parser "^3.2.0" - git-raw-commits "^2.0.8" - git-semver-tags "^4.1.1" - meow "^8.0.0" - q "^1.5.1" - -convert-source-map@^1.4.0, convert-source-map@^1.6.0: - version "1.9.0" - resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.9.0.tgz#7faae62353fb4213366d0ca98358d22e8368b05f" - integrity sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A== - +concat-map@0.0.1: + version "0.0.1" + resolved "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz" + integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== + convert-source-map@^2.0.0: version "2.0.0" - resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-2.0.0.tgz#4b560f649fc4e918dd0ab75cf4961e8bc882d82a" + resolved "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz" integrity sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg== core-js-compat@^3.43.0: - version "3.44.0" - resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.44.0.tgz#62b9165b97e4cbdb8bca16b14818e67428b4a0f8" - integrity sha512-JepmAj2zfl6ogy34qfWtcE7nHKAJnKsQFRn++scjVS2bZFllwptzw61BZcZFYBPpUznLfAvh0LGhxKppk04ClA== + version "3.47.0" + resolved "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.47.0.tgz" + integrity sha512-IGfuznZ/n7Kp9+nypamBhvwdwLsW6KC8IOaURw2doAK5e98AG3acVLdh0woOnEqCfUtS+Vu882JE4k/DAm3ItQ== dependencies: - browserslist "^4.25.1" + browserslist "^4.28.0" -core-util-is@~1.0.0: - version "1.0.3" - resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.3.tgz#a6042d3634c2b27e9328f837b965fac83808db85" - integrity sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ== - -create-require@^1.1.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333" - integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ== +create-jest@^29.7.0: + version "29.7.0" + resolved "https://registry.npmjs.org/create-jest/-/create-jest-29.7.0.tgz" + integrity sha512-Adz2bdH0Vq3F53KEMJOoftQFutWCukm6J24wbPWRO4k1kMY7gS7ds/uoJkNuV8wDCtWWnuwGcJwpWcih+zEW1Q== + dependencies: + "@jest/types" "^29.6.3" + chalk "^4.0.0" + exit "^0.1.2" + graceful-fs "^4.2.9" + jest-config "^29.7.0" + jest-util "^29.7.0" + prompts "^2.0.1" cross-spawn@^7.0.2, cross-spawn@^7.0.3: version "7.0.6" - resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.6.tgz#8a58fe78f00dcd70c370451759dfbfaf03e8ee9f" + resolved "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz" integrity sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA== dependencies: path-key "^3.1.0" shebang-command "^2.0.0" which "^2.0.1" -cssom@^0.4.4: - version "0.4.4" - resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.4.4.tgz#5a66cf93d2d0b661d80bf6a44fb65f5c2e4e0a10" - integrity sha512-p3pvU7r1MyyqbTk+WbNJIgJjG2VmTIaB10rI93LzVPrmDJKkzKYMtxxyAvQXR/NS6otuzveI7+7BBq3SjBS2mw== - -cssom@~0.3.6: - version "0.3.8" - resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.3.8.tgz#9f1276f5b2b463f2114d3f2c75250af8c1a36f4a" - integrity sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg== - -cssstyle@^2.3.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/cssstyle/-/cssstyle-2.3.0.tgz#ff665a0ddbdc31864b09647f34163443d90b0852" - integrity sha512-AZL67abkUzIuvcHqk7c09cezpGNcxUxU4Ioi/05xHk4DQeTkWmGYftIE6ctU6AEt+Gn4n1lDStOtj7FKycP71A== - dependencies: - cssom "~0.3.6" - -dargs@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/dargs/-/dargs-7.0.0.tgz#04015c41de0bcb69ec84050f3d9be0caf8d6d5cc" - integrity sha512-2iy1EkLdlBzQGvbweYRFxmFath8+K7+AKB0TlhHWkNuH+TmovaMH/Wp7V7R4u7f4SnX3OgLsU9t1NI9ioDnUpg== - -data-urls@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/data-urls/-/data-urls-2.0.0.tgz#156485a72963a970f5d5821aaf642bef2bf2db9b" - integrity sha512-X5eWTSXO/BJmpdIKCRuKUgSCgAN0OwliVK3yPKbwIWU1Tdw5BRajxlzMidvh+gwko9AfQ9zIj52pzF91Q3YAvQ== - dependencies: - abab "^2.0.3" - whatwg-mimetype "^2.3.0" - whatwg-url "^8.0.0" - data-view-buffer@^1.0.2: version "1.0.2" - resolved "https://registry.yarnpkg.com/data-view-buffer/-/data-view-buffer-1.0.2.tgz#211a03ba95ecaf7798a8c7198d79536211f88570" + resolved "https://registry.npmjs.org/data-view-buffer/-/data-view-buffer-1.0.2.tgz" integrity sha512-EmKO5V3OLXh1rtK2wgXRansaK1/mtVdTUEiEI0W8RkvgT05kfxaH29PliLnpLP73yYO6142Q72QNa8Wx/A5CqQ== dependencies: call-bound "^1.0.3" @@ -2870,7 +1944,7 @@ data-view-buffer@^1.0.2: data-view-byte-length@^1.0.2: version "1.0.2" - resolved "https://registry.yarnpkg.com/data-view-byte-length/-/data-view-byte-length-1.0.2.tgz#9e80f7ca52453ce3e93d25a35318767ea7704735" + resolved "https://registry.npmjs.org/data-view-byte-length/-/data-view-byte-length-1.0.2.tgz" integrity sha512-tuhGbE6CfTM9+5ANGf+oQb72Ky/0+s3xKUpHvShfiz2RxMFgFPjsXuRLBVMtvMs15awe45SRb83D6wH4ew6wlQ== dependencies: call-bound "^1.0.3" @@ -2879,68 +1953,45 @@ data-view-byte-length@^1.0.2: data-view-byte-offset@^1.0.1: version "1.0.1" - resolved "https://registry.yarnpkg.com/data-view-byte-offset/-/data-view-byte-offset-1.0.1.tgz#068307f9b71ab76dbbe10291389e020856606191" + resolved "https://registry.npmjs.org/data-view-byte-offset/-/data-view-byte-offset-1.0.1.tgz" integrity sha512-BS8PfmtDGnrgYdOonGZQdLZslWIeCGFP9tpan0hi1Co2Zr2NKADsvGYA8XxuG/4UWgJ6Cjtv+YJnB6MM69QGlQ== dependencies: call-bound "^1.0.2" es-errors "^1.3.0" is-data-view "^1.0.1" -dateformat@^3.0.0: - version "3.0.3" - resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-3.0.3.tgz#a6e37499a4d9a9cf85ef5872044d62901c9889ae" - integrity sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q== - -debug@4, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2, debug@^4.3.4, debug@^4.4.1: - version "4.4.1" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.4.1.tgz#e5a8bc6cbc4c6cd3e64308b0693a3d4fa550189b" - integrity sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ== - dependencies: - ms "^2.1.3" - debug@^3.2.7: version "3.2.7" - resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.7.tgz#72580b7e9145fb39b6676f9c5e5fb100b934179a" + resolved "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz" integrity sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ== dependencies: ms "^2.1.1" -decamelize-keys@^1.1.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/decamelize-keys/-/decamelize-keys-1.1.1.tgz#04a2d523b2f18d80d0158a43b895d56dff8d19d8" - integrity sha512-WiPxgEirIV0/eIOMcnFBA3/IJZAZqKnwAwWyvvdi4lsr1WCN22nhdf/3db3DoZcUjTV2SqfzIwNyp6y2xs3nmg== +debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2, debug@^4.3.4, debug@^4.4.1: + version "4.4.3" + resolved "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz" + integrity sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA== dependencies: - decamelize "^1.1.0" - map-obj "^1.0.0" - -decamelize@^1.1.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" - integrity sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA== - -decimal.js@^10.2.1: - version "10.6.0" - resolved "https://registry.yarnpkg.com/decimal.js/-/decimal.js-10.6.0.tgz#e649a43e3ab953a72192ff5983865e509f37ed9a" - integrity sha512-YpgQiITW3JXGntzdUmyUR1V812Hn8T1YVXhCu+wO3OpS4eU9l4YdD3qjyiKdV6mvV29zapkMeD390UVEf2lkUg== + ms "^2.1.3" -dedent@^0.7.0: - version "0.7.0" - resolved "https://registry.yarnpkg.com/dedent/-/dedent-0.7.0.tgz#2495ddbaf6eb874abb0e1be9df22d2e5a544326c" - integrity sha512-Q6fKUPqnAHAyhiUgFU7BUzLiv0kd8saH9al7tnu5Q/okj6dnupxyTgFIBjVzJATdfIAm9NAsvXNzjaKa+bxVyA== +dedent@^1.0.0: + version "1.7.1" + resolved "https://registry.npmjs.org/dedent/-/dedent-1.7.1.tgz" + integrity sha512-9JmrhGZpOlEgOLdQgSm0zxFaYoQon408V1v49aqTWuXENVlnCuY9JBZcXZiCsZQWDjTm5Qf/nIvAy77mXDAjEg== deep-is@^0.1.3: version "0.1.4" - resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.4.tgz#a6f2dce612fadd2ef1f519b73551f17e85199831" + resolved "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz" integrity sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ== deepmerge@^4.2.2: version "4.3.1" - resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.3.1.tgz#44b5f2147cd3b00d4b56137685966f26fd25dd4a" + resolved "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz" integrity sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A== define-data-property@^1.0.1, define-data-property@^1.1.4: version "1.1.4" - resolved "https://registry.yarnpkg.com/define-data-property/-/define-data-property-1.1.4.tgz#894dc141bb7d3060ae4366f6a0107e68fbe48c5e" + resolved "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz" integrity sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A== dependencies: es-define-property "^1.0.0" @@ -2949,94 +2000,47 @@ define-data-property@^1.0.1, define-data-property@^1.1.4: define-properties@^1.2.1: version "1.2.1" - resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.2.1.tgz#10781cc616eb951a80a034bafcaa7377f6af2b6c" + resolved "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz" integrity sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg== dependencies: define-data-property "^1.0.1" has-property-descriptors "^1.0.0" object-keys "^1.1.1" -delayed-stream@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" - integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ== - -detect-indent@^6.0.0: - version "6.1.0" - resolved "https://registry.yarnpkg.com/detect-indent/-/detect-indent-6.1.0.tgz#592485ebbbf6b3b1ab2be175c8393d04ca0d57e6" - integrity sha512-reYkTUJAZb9gUuZ2RvVCNhVHdg62RHnJ7WJl8ftMi4diZ6NWlciOzQN88pUhSELEwflJht4oQDv0F0BMlwaYtA== - -detect-newline@^3.0.0, detect-newline@^3.1.0: +detect-newline@^3.0.0: version "3.1.0" - resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-3.1.0.tgz#576f5dfc63ae1a192ff192d8ad3af6308991b651" + resolved "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz" integrity sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA== -diff-sequences@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-27.5.1.tgz#eaecc0d327fd68c8d9672a1e64ab8dccb2ef5327" - integrity sha512-k1gCAXAsNgLwEL+Y8Wvl+M6oEFj5bgazfZULpS5CneoPPXRaCCW7dm+q21Ky2VEE5X+VeRDBVg1Pcvvsr4TtNQ== - -diff@^4.0.1: - version "4.0.2" - resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d" - integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A== +diff-sequences@^29.6.3: + version "29.6.3" + resolved "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.6.3.tgz" + integrity sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q== dir-glob@^3.0.1: version "3.0.1" - resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-3.0.1.tgz#56dbf73d992a4a93ba1584f4534063fd2e41717f" + resolved "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz" integrity sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA== dependencies: path-type "^4.0.0" -dlv@^1.1.0: - version "1.1.3" - resolved "https://registry.yarnpkg.com/dlv/-/dlv-1.1.3.tgz#5c198a8a11453596e751494d49874bc7732f2e79" - integrity sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA== - doctrine@^2.1.0: version "2.1.0" - resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.1.0.tgz#5cd01fc101621b42c4cd7f5d1a66243716d3f39d" + resolved "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz" integrity sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw== dependencies: esutils "^2.0.2" doctrine@^3.0.0: version "3.0.0" - resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-3.0.0.tgz#addebead72a6574db783639dc87a121773973961" + resolved "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz" integrity sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w== dependencies: esutils "^2.0.2" -domexception@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/domexception/-/domexception-2.0.1.tgz#fb44aefba793e1574b0af6aed2801d057529f304" - integrity sha512-yxJ2mFy/sibVQlu5qHjOkf9J3K6zgmCxgJ94u2EdvDOV09H+32LtRswEcUsmUWN72pVLOEnTSRaIVVzVQgS0dg== - dependencies: - webidl-conversions "^5.0.0" - -dot-prop@^5.1.0: - version "5.3.0" - resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-5.3.0.tgz#90ccce708cd9cd82cc4dc8c3ddd9abdd55b20e88" - integrity sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q== - dependencies: - is-obj "^2.0.0" - -dotenv@^16.0.3: - version "16.6.1" - resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.6.1.tgz#773f0e69527a8315c7285d5ee73c4459d20a8020" - integrity sha512-uBq4egWHTcTt33a72vpSG0z3HnPuIl6NqYcTrKEg2azoEyl2hpW0zqlxysq2pK9HlDIHyHyakeYaYnSAwd8bow== - -dotgitignore@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/dotgitignore/-/dotgitignore-2.1.0.tgz#a4b15a4e4ef3cf383598aaf1dfa4a04bcc089b7b" - integrity sha512-sCm11ak2oY6DglEPpCB8TixLjWAxd3kJTs6UIcSasNYxXdFPV+YKlye92c8H4kKFqV5qYMIh7d+cYecEg0dIkA== - dependencies: - find-up "^3.0.0" - minimatch "^3.0.4" - dunder-proto@^1.0.0, dunder-proto@^1.0.1: version "1.0.1" - resolved "https://registry.yarnpkg.com/dunder-proto/-/dunder-proto-1.0.1.tgz#d7ae667e1dc83482f8b70fd0f6eefc50da30f58a" + resolved "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz" integrity sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A== dependencies: call-bind-apply-helpers "^1.0.1" @@ -3045,61 +2049,40 @@ dunder-proto@^1.0.0, dunder-proto@^1.0.1: eastasianwidth@^0.2.0: version "0.2.0" - resolved "https://registry.yarnpkg.com/eastasianwidth/-/eastasianwidth-0.2.0.tgz#696ce2ec0aa0e6ea93a397ffcf24aa7840c827cb" + resolved "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz" integrity sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA== -electron-to-chromium@^1.5.173: - version "1.5.191" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.191.tgz#8ae49a471447b1ceaf1d4d183a9000082f52363c" - integrity sha512-xcwe9ELcuxYLUFqZZxL19Z6HVKcvNkIwhbHUz7L3us6u12yR+7uY89dSl570f/IqNthx8dAw3tojG7i4Ni4tDA== - -elliptic@6.6.1: - version "6.6.1" - resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.6.1.tgz#3b8ffb02670bf69e382c7f65bf524c97c5405c06" - integrity sha512-RaddvvMatK2LJHqFJ+YA4WysVN5Ita9E35botqIYspQ4TkRAlCicdzKOjlyv/1Za5RyTNn7di//eEV0uTAfe3g== - dependencies: - bn.js "^4.11.9" - brorand "^1.1.0" - hash.js "^1.0.0" - hmac-drbg "^1.0.1" - inherits "^2.0.4" - minimalistic-assert "^1.0.1" - minimalistic-crypto-utils "^1.0.1" - -emittery@^0.8.1: - version "0.8.1" - resolved "https://registry.yarnpkg.com/emittery/-/emittery-0.8.1.tgz#bb23cc86d03b30aa75a7f734819dee2e1ba70860" - integrity sha512-uDfvUjVrfGJJhymx/kz6prltenw1u7WrCg1oa94zYY8xxVpLLUu045LAT0dhDZdXG58/EpPL/5kA180fQ/qudg== +electron-to-chromium@^1.5.263: + version "1.5.267" + resolved "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.267.tgz" + integrity sha512-0Drusm6MVRXSOJpGbaSVgcQsuB4hEkMpHXaVstcPmhu5LIedxs1xNK/nIxmQIU/RPC0+1/o0AVZfBTkTNJOdUw== + +emittery@^0.13.1: + version "0.13.1" + resolved "https://registry.npmjs.org/emittery/-/emittery-0.13.1.tgz" + integrity sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ== emoji-regex@^8.0.0: version "8.0.0" - resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" + resolved "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz" integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== emoji-regex@^9.2.2: version "9.2.2" - resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-9.2.2.tgz#840c8803b0d8047f4ff0cf963176b32d4ef3ed72" + resolved "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz" integrity sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg== -enquirer@^2.3.5: - version "2.4.1" - resolved "https://registry.yarnpkg.com/enquirer/-/enquirer-2.4.1.tgz#93334b3fbd74fc7097b224ab4a8fb7e40bf4ae56" - integrity sha512-rRqJg/6gd538VHvR3PSrdRBb/1Vy2YfzHqzvbhGIQpDRKIa4FgV/54b5Q1xYSxOOwKvjXweS26E0Q+nAMwp2pQ== - dependencies: - ansi-colors "^4.1.1" - strip-ansi "^6.0.1" - error-ex@^1.3.1: - version "1.3.2" - resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf" - integrity sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g== + version "1.3.4" + resolved "https://registry.npmjs.org/error-ex/-/error-ex-1.3.4.tgz" + integrity sha512-sqQamAnR14VgCr1A618A3sGrygcpK+HEbenA/HiEAkkUwcZIIB/tgWqHFxWgOyDh4nB4JCRimh79dR5Ywc9MDQ== dependencies: is-arrayish "^0.2.1" es-abstract@^1.23.2, es-abstract@^1.23.5, es-abstract@^1.23.9, es-abstract@^1.24.0: - version "1.24.0" - resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.24.0.tgz#c44732d2beb0acc1ed60df840869e3106e7af328" - integrity sha512-WSzPgsdLtTcQwm4CROfS5ju2Wa1QQcVeT37jFjYzdFz1r9ahadC8B8/a4qxJxM+09F18iumCdRmlr96ZYkQvEg== + version "1.24.1" + resolved "https://registry.npmjs.org/es-abstract/-/es-abstract-1.24.1.tgz" + integrity sha512-zHXBLhP+QehSSbsS9Pt23Gg964240DPd6QCf8WpkqEXxQ7fhdZzYsocOr5u7apWonsS5EjZDmTF+/slGMyasvw== dependencies: array-buffer-byte-length "^1.0.2" arraybuffer.prototype.slice "^1.0.4" @@ -3158,24 +2141,24 @@ es-abstract@^1.23.2, es-abstract@^1.23.5, es-abstract@^1.23.9, es-abstract@^1.24 es-define-property@^1.0.0, es-define-property@^1.0.1: version "1.0.1" - resolved "https://registry.yarnpkg.com/es-define-property/-/es-define-property-1.0.1.tgz#983eb2f9a6724e9303f61addf011c72e09e0b0fa" + resolved "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz" integrity sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g== es-errors@^1.3.0: version "1.3.0" - resolved "https://registry.yarnpkg.com/es-errors/-/es-errors-1.3.0.tgz#05f75a25dab98e4fb1dcd5e1472c0546d5057c8f" + resolved "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz" integrity sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw== es-object-atoms@^1.0.0, es-object-atoms@^1.1.1: version "1.1.1" - resolved "https://registry.yarnpkg.com/es-object-atoms/-/es-object-atoms-1.1.1.tgz#1c4f2c4837327597ce69d2ca190a7fdd172338c1" + resolved "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz" integrity sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA== dependencies: es-errors "^1.3.0" es-set-tostringtag@^2.1.0: version "2.1.0" - resolved "https://registry.yarnpkg.com/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz#f31dbbe0c183b00a6d26eb6325c810c0fd18bd4d" + resolved "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz" integrity sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA== dependencies: es-errors "^1.3.0" @@ -3185,14 +2168,14 @@ es-set-tostringtag@^2.1.0: es-shim-unscopables@^1.0.2, es-shim-unscopables@^1.1.0: version "1.1.0" - resolved "https://registry.yarnpkg.com/es-shim-unscopables/-/es-shim-unscopables-1.1.0.tgz#438df35520dac5d105f3943d927549ea3b00f4b5" + resolved "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.1.0.tgz" integrity sha512-d9T8ucsEhh8Bi1woXCf+TIKDIROLG5WCkxg8geBCbvk22kzwC5G2OnXVMO6FUsvQlgUUXQ2itephWDLqDzbeCw== dependencies: hasown "^2.0.2" es-to-primitive@^1.3.0: version "1.3.0" - resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.3.0.tgz#96c89c82cc49fd8794a24835ba3e1ff87f214e18" + resolved "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.3.0.tgz" integrity sha512-w+5mJ3GuFL+NjVtJlvydShqE1eN3h3PbI7/5LAsYJP/2qtuMXjfL2LpHSRqo4b4eSF5K/DH1JXKUAHSB2UW50g== dependencies: is-callable "^1.2.7" @@ -3201,53 +2184,27 @@ es-to-primitive@^1.3.0: escalade@^3.1.1, escalade@^3.2.0: version "3.2.0" - resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.2.0.tgz#011a3f69856ba189dffa7dc8fcce99d2a87903e5" + resolved "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz" integrity sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA== -escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" - integrity sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg== - escape-string-regexp@^2.0.0: version "2.0.0" - resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz#a30304e99daa32e23b2fd20f51babd07cffca344" + resolved "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz" integrity sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w== escape-string-regexp@^4.0.0: version "4.0.0" - resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" + resolved "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz" integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== -escodegen@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-2.1.0.tgz#ba93bbb7a43986d29d6041f99f5262da773e2e17" - integrity sha512-2NlIDTwUWJN0mRPQOdtQBzbUHvdGY2P1VXSyU83Q3xKxM7WHX2Ql8dKq782Q9TgQUNOLEzEYu9bzLNj1q88I5w== - dependencies: - esprima "^4.0.1" - estraverse "^5.2.0" - esutils "^2.0.2" - optionalDependencies: - source-map "~0.6.1" - -eslint-config-airbnb-base@^15.0.0: - version "15.0.0" - resolved "https://registry.yarnpkg.com/eslint-config-airbnb-base/-/eslint-config-airbnb-base-15.0.0.tgz#6b09add90ac79c2f8d723a2580e07f3925afd236" - integrity sha512-xaX3z4ZZIcFLvh2oUNvcX5oEofXda7giYmuplVxoOg5A7EXJMrUyqRgR+mhDhPK8LZ4PttFOBvCYDbX3sUoUig== - dependencies: - confusing-browser-globals "^1.0.10" - object.assign "^4.1.2" - object.entries "^1.1.5" - semver "^6.3.0" - eslint-config-prettier@^8.5.0: version "8.10.2" - resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-8.10.2.tgz#0642e53625ebc62c31c24726b0f050df6bd97a2e" + resolved "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.10.2.tgz" integrity sha512-/IGJ6+Dka158JnP5n5YFMOszjDWrXggGz1LaK/guZq9vZTmniaKlHcsscvkAhn9y4U+BU3JuUdYvtAMcv30y4A== eslint-import-resolver-node@^0.3.9: version "0.3.9" - resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz#d4eaac52b8a2e7c3cd1903eb00f7e053356118ac" + resolved "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz" integrity sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g== dependencies: debug "^3.2.7" @@ -3256,14 +2213,14 @@ eslint-import-resolver-node@^0.3.9: eslint-module-utils@^2.12.1: version "2.12.1" - resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.12.1.tgz#f76d3220bfb83c057651359295ab5854eaad75ff" + resolved "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.12.1.tgz" integrity sha512-L8jSWTze7K2mTg0vos/RuLRS5soomksDPoJLXIslC7c8Wmut3bx7CPpJijDcBZtxQ5lrbUdM+s0OlNbz0DCDNw== dependencies: debug "^3.2.7" eslint-plugin-import@^2.25.4: version "2.32.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.32.0.tgz#602b55faa6e4caeaa5e970c198b5c00a37708980" + resolved "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.32.0.tgz" integrity sha512-whOE1HFo/qJDyX4SnXzP4N6zOWn79WhnCUY/iDR0mPfQZO8wcYE4JClzI2oZrhBnnMUCBCHZhO6VQyoBU95mZA== dependencies: "@rtsao/scc" "^1.1.0" @@ -3288,98 +2245,27 @@ eslint-plugin-import@^2.25.4: eslint-plugin-prettier@^4.0.0: version "4.2.5" - resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-4.2.5.tgz#91ca3f2f01a84f1272cce04e9717550494c0fe06" + resolved "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-4.2.5.tgz" integrity sha512-9Ni+xgemM2IWLq6aXEpP2+V/V30GeA/46Ar629vcMqVPodFFWC9skHu/D1phvuqtS8bJCFnNf01/qcmqYEwNfg== dependencies: prettier-linter-helpers "^1.0.0" -eslint-scope@^5.0.0, eslint-scope@^5.1.1: - version "5.1.1" - resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c" - integrity sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw== - dependencies: - esrecurse "^4.3.0" - estraverse "^4.1.1" - eslint-scope@^7.2.2: version "7.2.2" - resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-7.2.2.tgz#deb4f92563390f32006894af62a22dba1c46423f" + resolved "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz" integrity sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg== dependencies: esrecurse "^4.3.0" estraverse "^5.2.0" -eslint-utils@^2.0.0, eslint-utils@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-2.1.0.tgz#d2de5e03424e707dc10c74068ddedae708741b27" - integrity sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg== - dependencies: - eslint-visitor-keys "^1.1.0" - -eslint-visitor-keys@^1.1.0, eslint-visitor-keys@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz#30ebd1ef7c2fdff01c3a4f151044af25fab0523e" - integrity sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ== - -eslint-visitor-keys@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz#f65328259305927392c938ed44eb0a5c9b2bd303" - integrity sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw== - -eslint-visitor-keys@^3.3.0, eslint-visitor-keys@^3.4.1, eslint-visitor-keys@^3.4.3: +eslint-visitor-keys@^3.4.1, eslint-visitor-keys@^3.4.3: version "3.4.3" - resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz#0cd72fe8550e3c2eae156a96a4dddcd1c8ac5800" + resolved "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz" integrity sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag== -eslint@^7.9.0: - version "7.32.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.32.0.tgz#c6d328a14be3fb08c8d1d21e12c02fdb7a2a812d" - integrity sha512-VHZ8gX+EDfz+97jGcgyGCyRia/dPOd6Xh9yPv8Bl1+SoaIwD+a/vlrOmGRUyOYu7MwUhc7CxqeaDZU13S4+EpA== - dependencies: - "@babel/code-frame" "7.12.11" - "@eslint/eslintrc" "^0.4.3" - "@humanwhocodes/config-array" "^0.5.0" - ajv "^6.10.0" - chalk "^4.0.0" - cross-spawn "^7.0.2" - debug "^4.0.1" - doctrine "^3.0.0" - enquirer "^2.3.5" - escape-string-regexp "^4.0.0" - eslint-scope "^5.1.1" - eslint-utils "^2.1.0" - eslint-visitor-keys "^2.0.0" - espree "^7.3.1" - esquery "^1.4.0" - esutils "^2.0.2" - fast-deep-equal "^3.1.3" - file-entry-cache "^6.0.1" - functional-red-black-tree "^1.0.1" - glob-parent "^5.1.2" - globals "^13.6.0" - ignore "^4.0.6" - import-fresh "^3.0.0" - imurmurhash "^0.1.4" - is-glob "^4.0.0" - js-yaml "^3.13.1" - json-stable-stringify-without-jsonify "^1.0.1" - levn "^0.4.1" - lodash.merge "^4.6.2" - minimatch "^3.0.4" - natural-compare "^1.4.0" - optionator "^0.9.1" - progress "^2.0.0" - regexpp "^3.1.0" - semver "^7.2.1" - strip-ansi "^6.0.0" - strip-json-comments "^3.1.0" - table "^6.0.9" - text-table "^0.2.0" - v8-compile-cache "^2.0.3" - -eslint@^8.7.0: +eslint@^8.57.1: version "8.57.1" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.57.1.tgz#7df109654aba7e3bbe5c8eae533c5e461d3c6ca9" + resolved "https://registry.npmjs.org/eslint/-/eslint-8.57.1.tgz" integrity sha512-ypowyDxpVSYpkXr9WPv2PAZCtNip1Mv5KTW0SCurXv/9iOpcrH9PaqUElksqEB6pChqHGDRCFTyrZlGhnLNGiA== dependencies: "@eslint-community/eslint-utils" "^4.2.0" @@ -3421,106 +2307,47 @@ eslint@^8.7.0: strip-ansi "^6.0.1" text-table "^0.2.0" -espree@^6.2.1: - version "6.2.1" - resolved "https://registry.yarnpkg.com/espree/-/espree-6.2.1.tgz#77fc72e1fd744a2052c20f38a5b575832e82734a" - integrity sha512-ysCxRQY3WaXJz9tdbWOwuWr5Y/XrPTGX9Kiz3yoUXwW0VZ4w30HTkQLaGx/+ttFjF8i+ACbArnB4ce68a9m5hw== - dependencies: - acorn "^7.1.1" - acorn-jsx "^5.2.0" - eslint-visitor-keys "^1.1.0" - -espree@^7.3.0, espree@^7.3.1: - version "7.3.1" - resolved "https://registry.yarnpkg.com/espree/-/espree-7.3.1.tgz#f2df330b752c6f55019f8bd89b7660039c1bbbb6" - integrity sha512-v3JCNCE64umkFpmkFGqzVKsOT0tN1Zr+ueqLZfpV1Ob8e+CEgPWa+OxCoGH3tnhimMKIaBm4m/vaRpJ/krRz2g== - dependencies: - acorn "^7.4.0" - acorn-jsx "^5.3.1" - eslint-visitor-keys "^1.3.0" - espree@^9.6.0, espree@^9.6.1: version "9.6.1" - resolved "https://registry.yarnpkg.com/espree/-/espree-9.6.1.tgz#a2a17b8e434690a5432f2f8018ce71d331a48c6f" + resolved "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz" integrity sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ== dependencies: acorn "^8.9.0" acorn-jsx "^5.3.2" eslint-visitor-keys "^3.4.1" -esprima@^4.0.0, esprima@^4.0.1: +esprima@^4.0.0: version "4.0.1" - resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" + resolved "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz" integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== -esquery@^1.0.1, esquery@^1.4.0, esquery@^1.4.2: - version "1.6.0" - resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.6.0.tgz#91419234f804d852a82dceec3e16cdc22cf9dae7" - integrity sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg== +esquery@^1.4.2: + version "1.7.0" + resolved "https://registry.npmjs.org/esquery/-/esquery-1.7.0.tgz" + integrity sha512-Ap6G0WQwcU/LHsvLwON1fAQX9Zp0A2Y6Y/cJBl9r/JbW90Zyg4/zbG6zzKa2OTALELarYHmKu0GhpM5EO+7T0g== dependencies: estraverse "^5.1.0" esrecurse@^4.3.0: version "4.3.0" - resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.3.0.tgz#7ad7964d679abb28bee72cec63758b1c5d2c9921" + resolved "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz" integrity sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag== dependencies: estraverse "^5.2.0" -estraverse@^4.1.1: - version "4.3.0" - resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.3.0.tgz#398ad3f3c5a24948be7725e83d11a7de28cdbd1d" - integrity sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw== - estraverse@^5.1.0, estraverse@^5.2.0: version "5.3.0" - resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.3.0.tgz#2eea5290702f26ab8fe5370370ff86c965d21123" + resolved "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz" integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA== esutils@^2.0.2: version "2.0.3" - resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" + resolved "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz" integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== -ethers@^5.7.2: - version "5.8.0" - resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.8.0.tgz#97858dc4d4c74afce83ea7562fe9493cedb4d377" - integrity sha512-DUq+7fHrCg1aPDFCHx6UIPb3nmt2XMpM7Y/g2gLhsl3lIBqeAfOJIl1qEvRf2uq3BiKxmh6Fh5pfp2ieyek7Kg== - dependencies: - "@ethersproject/abi" "5.8.0" - "@ethersproject/abstract-provider" "5.8.0" - "@ethersproject/abstract-signer" "5.8.0" - "@ethersproject/address" "5.8.0" - "@ethersproject/base64" "5.8.0" - "@ethersproject/basex" "5.8.0" - "@ethersproject/bignumber" "5.8.0" - "@ethersproject/bytes" "5.8.0" - "@ethersproject/constants" "5.8.0" - "@ethersproject/contracts" "5.8.0" - "@ethersproject/hash" "5.8.0" - "@ethersproject/hdnode" "5.8.0" - "@ethersproject/json-wallets" "5.8.0" - "@ethersproject/keccak256" "5.8.0" - "@ethersproject/logger" "5.8.0" - "@ethersproject/networks" "5.8.0" - "@ethersproject/pbkdf2" "5.8.0" - "@ethersproject/properties" "5.8.0" - "@ethersproject/providers" "5.8.0" - "@ethersproject/random" "5.8.0" - "@ethersproject/rlp" "5.8.0" - "@ethersproject/sha2" "5.8.0" - "@ethersproject/signing-key" "5.8.0" - "@ethersproject/solidity" "5.8.0" - "@ethersproject/strings" "5.8.0" - "@ethersproject/transactions" "5.8.0" - "@ethersproject/units" "5.8.0" - "@ethersproject/wallet" "5.8.0" - "@ethersproject/web" "5.8.0" - "@ethersproject/wordlists" "5.8.0" - execa@^5.0.0, execa@^5.1.1: version "5.1.1" - resolved "https://registry.yarnpkg.com/execa/-/execa-5.1.1.tgz#f80ad9cbf4298f7bd1d4c9555c21e93741c411dd" + resolved "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz" integrity sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg== dependencies: cross-spawn "^7.0.3" @@ -3535,32 +2362,33 @@ execa@^5.0.0, execa@^5.1.1: exit@^0.1.2: version "0.1.2" - resolved "https://registry.yarnpkg.com/exit/-/exit-0.1.2.tgz#0632638f8d877cc82107d30a0fff1a17cba1cd0c" + resolved "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz" integrity sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ== -expect@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/expect/-/expect-27.5.1.tgz#83ce59f1e5bdf5f9d2b94b61d2050db48f3fef74" - integrity sha512-E1q5hSUG2AmYQwQJ041nvgpkODHQvB+RKlB4IYdru6uJsyFTRyZAP463M+1lINorwbqAmUggi6+WwkD8lCS/Dw== +expect@^29.7.0: + version "29.7.0" + resolved "https://registry.npmjs.org/expect/-/expect-29.7.0.tgz" + integrity sha512-2Zks0hf1VLFYI1kbh0I5jP3KHHyCHpkfyHBzsSXRFgl/Bg9mWYfMW8oD+PdMPlEwy5HNsR9JutYy6pMeOh61nw== dependencies: - "@jest/types" "^27.5.1" - jest-get-type "^27.5.1" - jest-matcher-utils "^27.5.1" - jest-message-util "^27.5.1" + "@jest/expect-utils" "^29.7.0" + jest-get-type "^29.6.3" + jest-matcher-utils "^29.7.0" + jest-message-util "^29.7.0" + jest-util "^29.7.0" fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: version "3.1.3" - resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" + resolved "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz" integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== fast-diff@^1.1.2: version "1.3.0" - resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.3.0.tgz#ece407fa550a64d638536cd727e129c61616e0f0" + resolved "https://registry.npmjs.org/fast-diff/-/fast-diff-1.3.0.tgz" integrity sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw== fast-glob@^3.2.9: version "3.3.3" - resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.3.tgz#d06d585ce8dba90a16b0505c543c3ccfb3aeb818" + resolved "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz" integrity sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg== dependencies: "@nodelib/fs.stat" "^2.0.2" @@ -3569,73 +2397,47 @@ fast-glob@^3.2.9: merge2 "^1.3.0" micromatch "^4.0.8" -fast-json-stable-stringify@2.x, fast-json-stable-stringify@^2.0.0: +fast-json-stable-stringify@2.x, fast-json-stable-stringify@^2.0.0, fast-json-stable-stringify@^2.1.0: version "2.1.0" - resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" + resolved "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz" integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== fast-levenshtein@^2.0.6: version "2.0.6" - resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" + resolved "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz" integrity sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw== -fast-uri@^3.0.1: - version "3.0.6" - resolved "https://registry.yarnpkg.com/fast-uri/-/fast-uri-3.0.6.tgz#88f130b77cfaea2378d56bf970dea21257a68748" - integrity sha512-Atfo14OibSv5wAp4VWNsFYE1AchQRTv9cBGWET4pZWHzYshFSS9NQI6I57rdKn9croWVMbYFbLhJ+yJvmZIIHw== - fastq@^1.6.0: - version "1.19.1" - resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.19.1.tgz#d50eaba803c8846a883c16492821ebcd2cda55f5" - integrity sha512-GwLTyxkCXjXbxqIhTsMI2Nui8huMPtnxg7krajPJAjnEG/iiOS7i+zCtWGZR9G0NBKbXKh6X9m9UIsYX/N6vvQ== + version "1.20.1" + resolved "https://registry.npmjs.org/fastq/-/fastq-1.20.1.tgz" + integrity sha512-GGToxJ/w1x32s/D2EKND7kTil4n8OVk/9mycTc4VDza13lOvpUZTGX3mFSCtV9ksdGBVzvsyAVLM6mHFThxXxw== dependencies: reusify "^1.0.4" fb-watchman@^2.0.0: version "2.0.2" - resolved "https://registry.yarnpkg.com/fb-watchman/-/fb-watchman-2.0.2.tgz#e9524ee6b5c77e9e5001af0f85f3adbb8623255c" + resolved "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.2.tgz" integrity sha512-p5161BqbuCaSnB8jIbzQHOlpgsPmK5rJVDfDKO91Axs5NC1uu3HRQm6wt9cd9/+GtQQIO53JdGXXoyDpTAsgYA== dependencies: bser "2.1.1" -figures@^3.1.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/figures/-/figures-3.2.0.tgz#625c18bd293c604dc4a8ddb2febf0c88341746af" - integrity sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg== - dependencies: - escape-string-regexp "^1.0.5" - file-entry-cache@^6.0.1: version "6.0.1" - resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-6.0.1.tgz#211b2dd9659cb0394b073e7323ac3c933d522027" + resolved "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz" integrity sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg== dependencies: flat-cache "^3.0.4" fill-range@^7.1.1: version "7.1.1" - resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.1.1.tgz#44265d3cac07e3ea7dc247516380643754a05292" + resolved "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz" integrity sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg== dependencies: to-regex-range "^5.0.1" -find-up@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/find-up/-/find-up-2.1.0.tgz#45d1b7e506c717ddd482775a2b77920a3c0c57a7" - integrity sha512-NWzkk0jSJtTt08+FBFMvXoeZnOJD+jTtsRmBYbAIzJdX6l7dLgR7CTubCM5/eDdPUBvLCeVasP1brfVR/9/EZQ== - dependencies: - locate-path "^2.0.0" - -find-up@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/find-up/-/find-up-3.0.0.tgz#49169f1d7993430646da61ecc5ae355c21c97b73" - integrity sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg== - dependencies: - locate-path "^3.0.0" - find-up@^4.0.0, find-up@^4.1.0: version "4.1.0" - resolved "https://registry.yarnpkg.com/find-up/-/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19" + resolved "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz" integrity sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw== dependencies: locate-path "^5.0.0" @@ -3643,7 +2445,7 @@ find-up@^4.0.0, find-up@^4.1.0: find-up@^5.0.0: version "5.0.0" - resolved "https://registry.yarnpkg.com/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc" + resolved "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz" integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng== dependencies: locate-path "^6.0.0" @@ -3651,7 +2453,7 @@ find-up@^5.0.0: flat-cache@^3.0.4: version "3.2.0" - resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-3.2.0.tgz#2c0c2d5040c99b1632771a9d105725c0115363ee" + resolved "https://registry.npmjs.org/flat-cache/-/flat-cache-3.2.0.tgz" integrity sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw== dependencies: flatted "^3.2.9" @@ -3659,46 +2461,35 @@ flat-cache@^3.0.4: rimraf "^3.0.2" flatted@^3.2.9: - version "3.3.3" - resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.3.3.tgz#67c8fad95454a7c7abebf74bb78ee74a44023358" - integrity sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg== + version "3.4.2" + resolved "https://registry.npmjs.org/flatted/-/flatted-3.4.2.tgz" + integrity sha512-PjDse7RzhcPkIJwy5t7KPWQSZ9cAbzQXcafsetQoD7sOJRQlGikNbx7yZp2OotDnJyrDcbyRq3Ttb18iYOqkxA== for-each@^0.3.3, for-each@^0.3.5: version "0.3.5" - resolved "https://registry.yarnpkg.com/for-each/-/for-each-0.3.5.tgz#d650688027826920feeb0af747ee7b9421a41d47" + resolved "https://registry.npmjs.org/for-each/-/for-each-0.3.5.tgz" integrity sha512-dKx12eRCVIzqCxFGplyFKJMPvLEWgmNtUrpTiJIR5u97zEhRG8ySrtboPHZXx7daLxQVrl643cTzbab2tkQjxg== dependencies: is-callable "^1.2.7" -form-data@^3.0.0: - version "3.0.4" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-3.0.4.tgz#938273171d3f999286a4557528ce022dc2c98df1" - integrity sha512-f0cRzm6dkyVYV3nPoooP8XlccPQukegwhAnpoLcXy+X+A8KfpGOoXwDr9FLZd3wzgLaBGQBE3lY93Zm/i1JvIQ== - dependencies: - asynckit "^0.4.0" - combined-stream "^1.0.8" - es-set-tostringtag "^2.1.0" - hasown "^2.0.2" - mime-types "^2.1.35" - fs.realpath@^1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" + resolved "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz" integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== fsevents@^2.3.2: version "2.3.3" - resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6" + resolved "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz" integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw== function-bind@^1.1.2: version "1.1.2" - resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.2.tgz#2c02d864d97f3ea6c8830c464cbd11ab6eab7a1c" + resolved "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz" integrity sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA== function.prototype.name@^1.1.6, function.prototype.name@^1.1.8: version "1.1.8" - resolved "https://registry.yarnpkg.com/function.prototype.name/-/function.prototype.name-1.1.8.tgz#e68e1df7b259a5c949eeef95cdbde53edffabb78" + resolved "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.8.tgz" integrity sha512-e5iwyodOHhbMr/yNrc7fDYG4qlbIvI5gajyzPnb5TCwyhjApznQh1BMFou9b30SevY43gCJKXycoCBjMbsuW0Q== dependencies: call-bind "^1.0.8" @@ -3708,29 +2499,29 @@ function.prototype.name@^1.1.6, function.prototype.name@^1.1.8: hasown "^2.0.2" is-callable "^1.2.7" -functional-red-black-tree@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" - integrity sha512-dsKNQNdj6xA3T+QlADDA7mOSlX0qiMINjn0cgr+eGHGsbSHzTabcIogz2+p/iqP1Xs6EP/sS2SbqH+brGTbq0g== - functions-have-names@^1.2.3: version "1.2.3" - resolved "https://registry.yarnpkg.com/functions-have-names/-/functions-have-names-1.2.3.tgz#0404fe4ee2ba2f607f0e0ec3c80bae994133b834" + resolved "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz" integrity sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ== +generator-function@^2.0.0: + version "2.0.1" + resolved "https://registry.npmjs.org/generator-function/-/generator-function-2.0.1.tgz" + integrity sha512-SFdFmIJi+ybC0vjlHN0ZGVGHc3lgE0DxPAT0djjVg+kjOnSqclqmj0KQ7ykTOLP6YxoqOvuAODGdcHJn+43q3g== + gensync@^1.0.0-beta.2: version "1.0.0-beta.2" - resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0" + resolved "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz" integrity sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg== get-caller-file@^2.0.5: version "2.0.5" - resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" + resolved "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz" integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== get-intrinsic@^1.2.4, get-intrinsic@^1.2.5, get-intrinsic@^1.2.6, get-intrinsic@^1.2.7, get-intrinsic@^1.3.0: version "1.3.0" - resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.3.0.tgz#743f0e3b6964a93a5491ed1bffaae054d7f98d01" + resolved "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz" integrity sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ== dependencies: call-bind-apply-helpers "^1.0.2" @@ -3746,22 +2537,12 @@ get-intrinsic@^1.2.4, get-intrinsic@^1.2.5, get-intrinsic@^1.2.6, get-intrinsic@ get-package-type@^0.1.0: version "0.1.0" - resolved "https://registry.yarnpkg.com/get-package-type/-/get-package-type-0.1.0.tgz#8de2d803cff44df3bc6c456e6668b36c3926e11a" + resolved "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz" integrity sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q== -get-pkg-repo@^4.0.0: - version "4.2.1" - resolved "https://registry.yarnpkg.com/get-pkg-repo/-/get-pkg-repo-4.2.1.tgz#75973e1c8050c73f48190c52047c4cee3acbf385" - integrity sha512-2+QbHjFRfGB74v/pYWjd5OhU3TDIC2Gv/YKUTk/tCvAz0pkn/Mz6P3uByuBimLOcPvN2jYdScl3xGFSrx0jEcA== - dependencies: - "@hutson/parse-repository-url" "^3.0.0" - hosted-git-info "^4.0.0" - through2 "^2.0.0" - yargs "^16.2.0" - -get-proto@^1.0.0, get-proto@^1.0.1: +get-proto@^1.0.1: version "1.0.1" - resolved "https://registry.yarnpkg.com/get-proto/-/get-proto-1.0.1.tgz#150b3f2743869ef3e851ec0c49d15b1d14d00ee1" + resolved "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz" integrity sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g== dependencies: dunder-proto "^1.0.1" @@ -3769,69 +2550,35 @@ get-proto@^1.0.0, get-proto@^1.0.1: get-stream@^6.0.0: version "6.0.1" - resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7" + resolved "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz" integrity sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg== get-symbol-description@^1.1.0: version "1.1.0" - resolved "https://registry.yarnpkg.com/get-symbol-description/-/get-symbol-description-1.1.0.tgz#7bdd54e0befe8ffc9f3b4e203220d9f1e881b6ee" + resolved "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.1.0.tgz" integrity sha512-w9UMqWwJxHNOvoNzSJ2oPF5wvYcvP7jUvYzhp67yEhTi17ZDBBC1z9pTdGuzjD+EFIqLSYRweZjqfiPzQ06Ebg== dependencies: call-bound "^1.0.3" es-errors "^1.3.0" get-intrinsic "^1.2.6" -git-raw-commits@^2.0.8: - version "2.0.11" - resolved "https://registry.yarnpkg.com/git-raw-commits/-/git-raw-commits-2.0.11.tgz#bc3576638071d18655e1cc60d7f524920008d723" - integrity sha512-VnctFhw+xfj8Va1xtfEqCUD2XDrbAPSJx+hSrE5K7fGdjZruW7XV+QOrN7LF/RJyvspRiD2I0asWsxFp0ya26A== - dependencies: - dargs "^7.0.0" - lodash "^4.17.15" - meow "^8.0.0" - split2 "^3.0.0" - through2 "^4.0.0" - -git-remote-origin-url@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/git-remote-origin-url/-/git-remote-origin-url-2.0.0.tgz#5282659dae2107145a11126112ad3216ec5fa65f" - integrity sha512-eU+GGrZgccNJcsDH5LkXR3PB9M958hxc7sbA8DFJjrv9j4L2P/eZfKhM+QD6wyzpiv+b1BpK0XrYCxkovtjSLw== - dependencies: - gitconfiglocal "^1.0.0" - pify "^2.3.0" - -git-semver-tags@^4.0.0, git-semver-tags@^4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/git-semver-tags/-/git-semver-tags-4.1.1.tgz#63191bcd809b0ec3e151ba4751c16c444e5b5780" - integrity sha512-OWyMt5zBe7xFs8vglMmhM9lRQzCWL3WjHtxNNfJTMngGym7pC1kh8sP6jevfydJ6LP3ZvGxfb6ABYgPUM0mtsA== - dependencies: - meow "^8.0.0" - semver "^6.0.0" - -gitconfiglocal@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/gitconfiglocal/-/gitconfiglocal-1.0.0.tgz#41d045f3851a5ea88f03f24ca1c6178114464b9b" - integrity sha512-spLUXeTAVHxDtKsJc8FkFVgFtMdEN9qPGpL23VfSHx4fP4+Ds097IXLvymbnDH8FnmxX5Nr9bPw3A+AQ6mWEaQ== - dependencies: - ini "^1.3.2" - glob-parent@^5.1.2: version "5.1.2" - resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" + resolved "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz" integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== dependencies: is-glob "^4.0.1" glob-parent@^6.0.2: version "6.0.2" - resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-6.0.2.tgz#6d237d99083950c79290f24c7642a3de9a28f9e3" + resolved "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz" integrity sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A== dependencies: is-glob "^4.0.3" -glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6: +glob@^7.1.3, glob@^7.1.4: version "7.2.3" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" + resolved "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz" integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q== dependencies: fs.realpath "^1.0.0" @@ -3841,16 +2588,16 @@ glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6: once "^1.3.0" path-is-absolute "^1.0.0" -globals@^13.19.0, globals@^13.6.0, globals@^13.9.0: +globals@^13.19.0: version "13.24.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-13.24.0.tgz#8432a19d78ce0c1e833949c36adb345400bb1171" + resolved "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz" integrity sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ== dependencies: type-fest "^0.20.2" globalthis@^1.0.4: version "1.0.4" - resolved "https://registry.yarnpkg.com/globalthis/-/globalthis-1.0.4.tgz#7430ed3a975d97bfb59bcce41f5cabbafa651236" + resolved "https://registry.npmjs.org/globalthis/-/globalthis-1.0.4.tgz" integrity sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ== dependencies: define-properties "^1.2.1" @@ -3858,7 +2605,7 @@ globalthis@^1.0.4: globby@^11.1.0: version "11.1.0" - resolved "https://registry.yarnpkg.com/globby/-/globby-11.1.0.tgz#bd4be98bb042f83d796f7e3811991fbe82a0d34b" + resolved "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz" integrity sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g== dependencies: array-union "^2.1.0" @@ -3870,23 +2617,23 @@ globby@^11.1.0: gopd@^1.0.1, gopd@^1.2.0: version "1.2.0" - resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.2.0.tgz#89f56b8217bdbc8802bd299df6d7f1081d7e51a1" + resolved "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz" integrity sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg== -graceful-fs@^4.1.2, graceful-fs@^4.2.9: +graceful-fs@^4.2.9: version "4.2.11" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" + resolved "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz" integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== graphemer@^1.4.0: version "1.4.0" - resolved "https://registry.yarnpkg.com/graphemer/-/graphemer-1.4.0.tgz#fb2f1d55e0e3a1849aeffc90c4fa0dd53a0e66c6" + resolved "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz" integrity sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag== -handlebars@^4.7.7: - version "4.7.8" - resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.7.8.tgz#41c42c18b1be2365439188c77c6afae71c0cd9e9" - integrity sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ== +handlebars@^4.7.8: + version "4.7.9" + resolved "https://registry.npmjs.org/handlebars/-/handlebars-4.7.9.tgz" + integrity sha512-4E71E0rpOaQuJR2A3xDZ+GM1HyWYv1clR58tC8emQNeQe3RH7MAzSbat+V0wG78LQBo6m6bzSG/L4pBuCsgnUQ== dependencies: minimist "^1.2.5" neo-async "^2.6.2" @@ -3895,154 +2642,72 @@ handlebars@^4.7.7: optionalDependencies: uglify-js "^3.1.4" -hard-rejection@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/hard-rejection/-/hard-rejection-2.1.0.tgz#1c6eda5c1685c63942766d79bb40ae773cecd883" - integrity sha512-VIZB+ibDhx7ObhAe7OVtoEbuP4h/MuOTHJ+J8h/eBXotJYl0fBgR72xDFCKgIh22OJZIOVNxBMWuhAr10r8HdA== - -has-ansi@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91" - integrity sha512-C8vBJ8DwUCx19vhm7urhTuUsr4/IyP6l4VzNQDv+ryHQObW3TTTp9yB68WpYgRe2bbaGuZ/se74IqFeVnMnLZg== - dependencies: - ansi-regex "^2.0.0" - has-bigints@^1.0.2: version "1.1.0" - resolved "https://registry.yarnpkg.com/has-bigints/-/has-bigints-1.1.0.tgz#28607e965ac967e03cd2a2c70a2636a1edad49fe" + resolved "https://registry.npmjs.org/has-bigints/-/has-bigints-1.1.0.tgz" integrity sha512-R3pbpkcIqv2Pm3dUwgjclDRVmWpTJW2DcMzcIhEXEx1oh/CEMObMm3KLmRJOdvhM7o4uQBnwr8pzRK2sJWIqfg== -has-flag@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" - integrity sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw== - has-flag@^4.0.0: version "4.0.0" - resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" + resolved "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz" integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== has-property-descriptors@^1.0.0, has-property-descriptors@^1.0.2: version "1.0.2" - resolved "https://registry.yarnpkg.com/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz#963ed7d071dc7bf5f084c5bfbe0d1b6222586854" + resolved "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz" integrity sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg== dependencies: es-define-property "^1.0.0" has-proto@^1.2.0: version "1.2.0" - resolved "https://registry.yarnpkg.com/has-proto/-/has-proto-1.2.0.tgz#5de5a6eabd95fdffd9818b43055e8065e39fe9d5" + resolved "https://registry.npmjs.org/has-proto/-/has-proto-1.2.0.tgz" integrity sha512-KIL7eQPfHQRC8+XluaIw7BHUwwqL19bQn4hzNgdr+1wXoU0KKj6rufu47lhY7KbJR2C6T6+PfyN0Ea7wkSS+qQ== dependencies: dunder-proto "^1.0.0" has-symbols@^1.0.3, has-symbols@^1.1.0: version "1.1.0" - resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.1.0.tgz#fc9c6a783a084951d0b971fe1018de813707a338" + resolved "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz" integrity sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ== has-tostringtag@^1.0.2: version "1.0.2" - resolved "https://registry.yarnpkg.com/has-tostringtag/-/has-tostringtag-1.0.2.tgz#2cdc42d40bef2e5b4eeab7c01a73c54ce7ab5abc" + resolved "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz" integrity sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw== dependencies: has-symbols "^1.0.3" -hash.js@1.1.7, hash.js@^1.0.0, hash.js@^1.0.3: - version "1.1.7" - resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.7.tgz#0babca538e8d4ee4a0f8988d68866537a003cf42" - integrity sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA== - dependencies: - inherits "^2.0.3" - minimalistic-assert "^1.0.1" - hasown@^2.0.2: version "2.0.2" - resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.2.tgz#003eaf91be7adc372e84ec59dc37252cedb80003" + resolved "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz" integrity sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ== dependencies: function-bind "^1.1.2" -hmac-drbg@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1" - integrity sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg== - dependencies: - hash.js "^1.0.3" - minimalistic-assert "^1.0.0" - minimalistic-crypto-utils "^1.0.1" - -hosted-git-info@^2.1.4: - version "2.8.9" - resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.9.tgz#dffc0bf9a21c02209090f2aa69429e1414daf3f9" - integrity sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw== - -hosted-git-info@^4.0.0, hosted-git-info@^4.0.1: - version "4.1.0" - resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-4.1.0.tgz#827b82867e9ff1c8d0c4d9d53880397d2c86d224" - integrity sha512-kyCuEOWjJqZuDbRHzL8V93NzQhwIB71oFWSyzVo+KPZI+pnQPPxucdkrOZvkLRnrf5URsQM+IJ09Dw29cRALIA== - dependencies: - lru-cache "^6.0.0" - -html-encoding-sniffer@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/html-encoding-sniffer/-/html-encoding-sniffer-2.0.1.tgz#42a6dc4fd33f00281176e8b23759ca4e4fa185f3" - integrity sha512-D5JbOMBIR/TVZkubHT+OyT2705QvogUW4IBn6nHd756OwieSF9aDYFj4dv6HHEVGYbHaLETa3WggZYWWMyy3ZQ== - dependencies: - whatwg-encoding "^1.0.5" - html-escaper@^2.0.0: version "2.0.2" - resolved "https://registry.yarnpkg.com/html-escaper/-/html-escaper-2.0.2.tgz#dfd60027da36a36dfcbe236262c00a5822681453" + resolved "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz" integrity sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg== -http-proxy-agent@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/http-proxy-agent/-/http-proxy-agent-4.0.1.tgz#8a8c8ef7f5932ccf953c296ca8291b95aa74aa3a" - integrity sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg== - dependencies: - "@tootallnate/once" "1" - agent-base "6" - debug "4" - -https-proxy-agent@^5.0.0: - version "5.0.1" - resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz#c59ef224a04fe8b754f3db0063a25ea30d0005d6" - integrity sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA== - dependencies: - agent-base "6" - debug "4" - human-signals@^2.1.0: version "2.1.0" - resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-2.1.0.tgz#dc91fcba42e4d06e4abaed33b3e7a3c02f514ea0" + resolved "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz" integrity sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw== husky@^7.0.4: version "7.0.4" - resolved "https://registry.yarnpkg.com/husky/-/husky-7.0.4.tgz#242048245dc49c8fb1bf0cc7cfb98dd722531535" + resolved "https://registry.npmjs.org/husky/-/husky-7.0.4.tgz" integrity sha512-vbaCKN2QLtP/vD4yvs6iz6hBEo6wkSzs8HpRah1Z6aGmF2KW5PdYuAd7uX5a+OyBZHBhd+TFLqgjUgytQr4RvQ== -iconv-lite@0.4.24: - version "0.4.24" - resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" - integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== - dependencies: - safer-buffer ">= 2.1.2 < 3" - -ignore@^4.0.6: - version "4.0.6" - resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc" - integrity sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg== - -ignore@^5.2.0: +ignore@^5.2.0, ignore@^5.3.1: version "5.3.2" - resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.3.2.tgz#3cd40e729f3643fd87cb04e50bf0eb722bc596f5" + resolved "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz" integrity sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g== -import-fresh@^3.0.0, import-fresh@^3.2.1: +import-fresh@^3.2.1: version "3.3.1" - resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.3.1.tgz#9cecb56503c0ada1f2741dbbd6546e4b13b57ccf" + resolved "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz" integrity sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ== dependencies: parent-module "^1.0.0" @@ -4050,7 +2715,7 @@ import-fresh@^3.0.0, import-fresh@^3.2.1: import-local@^3.0.2: version "3.2.0" - resolved "https://registry.yarnpkg.com/import-local/-/import-local-3.2.0.tgz#c3d5c745798c02a6f8b897726aba5100186ee260" + resolved "https://registry.npmjs.org/import-local/-/import-local-3.2.0.tgz" integrity sha512-2SPlun1JUPWoM6t3F0dw0FkCF/jWY8kttcY4f599GLTSjh2OCuuhdTkJQsEcZzBqbXZGKMK2OqW1oZsjtf/gQA== dependencies: pkg-dir "^4.2.0" @@ -4058,35 +2723,30 @@ import-local@^3.0.2: imurmurhash@^0.1.4: version "0.1.4" - resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" + resolved "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz" integrity sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA== indent-string@^4.0.0: version "4.0.0" - resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-4.0.0.tgz#624f8f4497d619b2d9768531d58f4122854d7251" + resolved "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz" integrity sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg== inflight@^1.0.4: version "1.0.6" - resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" + resolved "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz" integrity sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA== dependencies: once "^1.3.0" wrappy "1" -inherits@2, inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.3: +inherits@2: version "2.0.4" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" + resolved "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== -ini@^1.3.2: - version "1.3.8" - resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.8.tgz#a29da425b48806f34767a4efce397269af28432c" - integrity sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew== - internal-slot@^1.1.0: version "1.1.0" - resolved "https://registry.yarnpkg.com/internal-slot/-/internal-slot-1.1.0.tgz#1eac91762947d2f7056bc838d93e13b2e9604961" + resolved "https://registry.npmjs.org/internal-slot/-/internal-slot-1.1.0.tgz" integrity sha512-4gd7VpWNQNB4UKKCFFVcp1AVv+FMOgs9NKzjHKusc8jTMhd5eL1NqQqOpE0KzMds804/yHlglp3uxgluOqAPLw== dependencies: es-errors "^1.3.0" @@ -4095,7 +2755,7 @@ internal-slot@^1.1.0: is-array-buffer@^3.0.4, is-array-buffer@^3.0.5: version "3.0.5" - resolved "https://registry.yarnpkg.com/is-array-buffer/-/is-array-buffer-3.0.5.tgz#65742e1e687bd2cc666253068fd8707fe4d44280" + resolved "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.5.tgz" integrity sha512-DDfANUiiG2wC1qawP66qlTugJeL5HyzMpfr8lLK+jMQirGzNod0B12cFB/9q838Ru27sBwfw78/rdoU7RERz6A== dependencies: call-bind "^1.0.8" @@ -4104,12 +2764,12 @@ is-array-buffer@^3.0.4, is-array-buffer@^3.0.5: is-arrayish@^0.2.1: version "0.2.1" - resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" + resolved "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz" integrity sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg== is-async-function@^2.0.0: version "2.1.1" - resolved "https://registry.yarnpkg.com/is-async-function/-/is-async-function-2.1.1.tgz#3e69018c8e04e73b738793d020bfe884b9fd3523" + resolved "https://registry.npmjs.org/is-async-function/-/is-async-function-2.1.1.tgz" integrity sha512-9dgM/cZBnNvjzaMYHVoxxfPj2QXt22Ev7SuuPrs+xav0ukGB0S6d4ydZdEiM48kLx5kDV+QBPrpVnFyefL8kkQ== dependencies: async-function "^1.0.0" @@ -4120,14 +2780,14 @@ is-async-function@^2.0.0: is-bigint@^1.1.0: version "1.1.0" - resolved "https://registry.yarnpkg.com/is-bigint/-/is-bigint-1.1.0.tgz#dda7a3445df57a42583db4228682eba7c4170672" + resolved "https://registry.npmjs.org/is-bigint/-/is-bigint-1.1.0.tgz" integrity sha512-n4ZT37wG78iz03xPRKJrHTdZbe3IicyucEtdRsV5yglwc3GyUfbAfpSeD0FJ41NbUNSt5wbhqfp1fS+BgnvDFQ== dependencies: has-bigints "^1.0.2" is-boolean-object@^1.2.1: version "1.2.2" - resolved "https://registry.yarnpkg.com/is-boolean-object/-/is-boolean-object-1.2.2.tgz#7067f47709809a393c71ff5bb3e135d8a9215d9e" + resolved "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.2.2.tgz" integrity sha512-wa56o2/ElJMYqjCjGkXri7it5FbebW5usLw/nPmCMs5DeZ7eziSYZhSmPRn0txqeW4LnAmQQU7FgqLpsEFKM4A== dependencies: call-bound "^1.0.3" @@ -4135,19 +2795,19 @@ is-boolean-object@^1.2.1: is-callable@^1.2.7: version "1.2.7" - resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.7.tgz#3bc2a85ea742d9e36205dcacdd72ca1fdc51b055" + resolved "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz" integrity sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA== -is-core-module@^2.13.0, is-core-module@^2.16.0, is-core-module@^2.16.1, is-core-module@^2.5.0: +is-core-module@^2.13.0, is-core-module@^2.16.1: version "2.16.1" - resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.16.1.tgz#2a98801a849f43e2add644fbb6bc6229b19a4ef4" + resolved "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz" integrity sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w== dependencies: hasown "^2.0.2" is-data-view@^1.0.1, is-data-view@^1.0.2: version "1.0.2" - resolved "https://registry.yarnpkg.com/is-data-view/-/is-data-view-1.0.2.tgz#bae0a41b9688986c2188dda6657e56b8f9e63b8e" + resolved "https://registry.npmjs.org/is-data-view/-/is-data-view-1.0.2.tgz" integrity sha512-RKtWF8pGmS87i2D6gqQu/l7EYRlVdfzemCJN/P3UOs//x1QE7mfhvzHIApBTRf7axvT6DMGwSwBXYCT0nfB9xw== dependencies: call-bound "^1.0.2" @@ -4156,7 +2816,7 @@ is-data-view@^1.0.1, is-data-view@^1.0.2: is-date-object@^1.0.5, is-date-object@^1.1.0: version "1.1.0" - resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.1.0.tgz#ad85541996fc7aa8b2729701d27b7319f95d82f7" + resolved "https://registry.npmjs.org/is-date-object/-/is-date-object-1.1.0.tgz" integrity sha512-PwwhEakHVKTdRNVOw+/Gyh0+MzlCl4R6qKvkhuvLtPMggI1WAHt9sOwZxQLSGpUaDnrdyDsomoRgNnCfKNSXXg== dependencies: call-bound "^1.0.2" @@ -4164,61 +2824,62 @@ is-date-object@^1.0.5, is-date-object@^1.1.0: is-extglob@^2.1.1: version "2.1.1" - resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" + resolved "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz" integrity sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ== is-finalizationregistry@^1.1.0: version "1.1.1" - resolved "https://registry.yarnpkg.com/is-finalizationregistry/-/is-finalizationregistry-1.1.1.tgz#eefdcdc6c94ddd0674d9c85887bf93f944a97c90" + resolved "https://registry.npmjs.org/is-finalizationregistry/-/is-finalizationregistry-1.1.1.tgz" integrity sha512-1pC6N8qWJbWoPtEjgcL2xyhQOP491EQjeUo3qTKcmV8YSDDJrOepfG8pcC7h/QgnQHYSv0mJ3Z/ZWxmatVrysg== dependencies: call-bound "^1.0.3" is-fullwidth-code-point@^3.0.0: version "3.0.0" - resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" + resolved "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz" integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== is-fullwidth-code-point@^4.0.0: version "4.0.0" - resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-4.0.0.tgz#fae3167c729e7463f8461ce512b080a49268aa88" + resolved "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-4.0.0.tgz" integrity sha512-O4L094N2/dZ7xqVdrXhh9r1KODPJpFms8B5sGdJLPy664AgvXsreZUyCQQNItZRDlYug4xStLjNp/sz3HvBowQ== is-generator-fn@^2.0.0: version "2.1.0" - resolved "https://registry.yarnpkg.com/is-generator-fn/-/is-generator-fn-2.1.0.tgz#7d140adc389aaf3011a8f2a2a4cfa6faadffb118" + resolved "https://registry.npmjs.org/is-generator-fn/-/is-generator-fn-2.1.0.tgz" integrity sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ== is-generator-function@^1.0.10: - version "1.1.0" - resolved "https://registry.yarnpkg.com/is-generator-function/-/is-generator-function-1.1.0.tgz#bf3eeda931201394f57b5dba2800f91a238309ca" - integrity sha512-nPUB5km40q9e8UfN/Zc24eLlzdSf9OfKByBw9CIdw4H1giPMeA0OIJvbchsCu4npfI2QcMVBsGEBHKZ7wLTWmQ== + version "1.1.2" + resolved "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.1.2.tgz" + integrity sha512-upqt1SkGkODW9tsGNG5mtXTXtECizwtS2kA161M+gJPc1xdb/Ax629af6YrTwcOeQHbewrPNlE5Dx7kzvXTizA== dependencies: - call-bound "^1.0.3" - get-proto "^1.0.0" + call-bound "^1.0.4" + generator-function "^2.0.0" + get-proto "^1.0.1" has-tostringtag "^1.0.2" safe-regex-test "^1.1.0" is-glob@^4.0.0, is-glob@^4.0.1, is-glob@^4.0.3: version "4.0.3" - resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084" + resolved "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz" integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== dependencies: is-extglob "^2.1.1" is-map@^2.0.3: version "2.0.3" - resolved "https://registry.yarnpkg.com/is-map/-/is-map-2.0.3.tgz#ede96b7fe1e270b3c4465e3a465658764926d62e" + resolved "https://registry.npmjs.org/is-map/-/is-map-2.0.3.tgz" integrity sha512-1Qed0/Hr2m+YqxnM09CjA2d/i6YZNfF6R2oRAOj36eUdS6qIV/huPJNSEpKbupewFs+ZsJlxsjjPbc0/afW6Lw== is-negative-zero@^2.0.3: version "2.0.3" - resolved "https://registry.yarnpkg.com/is-negative-zero/-/is-negative-zero-2.0.3.tgz#ced903a027aca6381b777a5743069d7376a49747" + resolved "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.3.tgz" integrity sha512-5KoIu2Ngpyek75jXodFvnafB6DJgr3u8uuK0LEZJjrU19DrMD3EVERaR8sjz8CCGgpZvxPl9SuE1GMVPFHx1mw== is-number-object@^1.1.1: version "1.1.1" - resolved "https://registry.yarnpkg.com/is-number-object/-/is-number-object-1.1.1.tgz#144b21e95a1bc148205dcc2814a9134ec41b2541" + resolved "https://registry.npmjs.org/is-number-object/-/is-number-object-1.1.1.tgz" integrity sha512-lZhclumE1G6VYD8VHe35wFaIif+CTy5SJIi5+3y4psDgWu4wPDoBhF8NxUOinEc7pHgiTsT6MaBb92rKhhD+Xw== dependencies: call-bound "^1.0.3" @@ -4226,32 +2887,17 @@ is-number-object@^1.1.1: is-number@^7.0.0: version "7.0.0" - resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" + resolved "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz" integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== -is-obj@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/is-obj/-/is-obj-2.0.0.tgz#473fb05d973705e3fd9620545018ca8e22ef4982" - integrity sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w== - is-path-inside@^3.0.3: version "3.0.3" - resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-3.0.3.tgz#d231362e53a07ff2b0e0ea7fed049161ffd16283" + resolved "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz" integrity sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ== -is-plain-obj@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-1.1.0.tgz#71a50c8429dfca773c92a390a4a03b39fcd51d3e" - integrity sha512-yvkRyxmFKEOQ4pNXCmJG5AEQNlXJS5LaONXo5/cLdTZdWvsZ1ioJEonLGAosKlMWE8lwUy/bJzMjcw8az73+Fg== - -is-potential-custom-element-name@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz#171ed6f19e3ac554394edf78caa05784a45bebb5" - integrity sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ== - is-regex@^1.2.1: version "1.2.1" - resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.2.1.tgz#76d70a3ed10ef9be48eb577887d74205bf0cad22" + resolved "https://registry.npmjs.org/is-regex/-/is-regex-1.2.1.tgz" integrity sha512-MjYsKHO5O7mCsmRGxWcLWheFqN9DJ/2TmngvjKXihe6efViPqc274+Fx/4fYj/r03+ESvBdTXK0V6tA3rgez1g== dependencies: call-bound "^1.0.2" @@ -4261,24 +2907,24 @@ is-regex@^1.2.1: is-set@^2.0.3: version "2.0.3" - resolved "https://registry.yarnpkg.com/is-set/-/is-set-2.0.3.tgz#8ab209ea424608141372ded6e0cb200ef1d9d01d" + resolved "https://registry.npmjs.org/is-set/-/is-set-2.0.3.tgz" integrity sha512-iPAjerrse27/ygGLxw+EBR9agv9Y6uLeYVJMu+QNCoouJ1/1ri0mGrcWpfCqFZuzzx3WjtwxG098X+n4OuRkPg== is-shared-array-buffer@^1.0.4: version "1.0.4" - resolved "https://registry.yarnpkg.com/is-shared-array-buffer/-/is-shared-array-buffer-1.0.4.tgz#9b67844bd9b7f246ba0708c3a93e34269c774f6f" + resolved "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.4.tgz" integrity sha512-ISWac8drv4ZGfwKl5slpHG9OwPNty4jOWPRIhBpxOoD+hqITiwuipOQ2bNthAzwA3B4fIjO4Nln74N0S9byq8A== dependencies: call-bound "^1.0.3" is-stream@^2.0.0: version "2.0.1" - resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.1.tgz#fac1e3d53b97ad5a9d0ae9cef2389f5810a5c077" + resolved "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz" integrity sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg== is-string@^1.1.1: version "1.1.1" - resolved "https://registry.yarnpkg.com/is-string/-/is-string-1.1.1.tgz#92ea3f3d5c5b6e039ca8677e5ac8d07ea773cbb9" + resolved "https://registry.npmjs.org/is-string/-/is-string-1.1.1.tgz" integrity sha512-BtEeSsoaQjlSPBemMQIrY1MY0uM6vnS1g5fmufYOtnxLGUZM2178PKbhsk7Ffv58IX+ZtcvoGwccYsh0PglkAA== dependencies: call-bound "^1.0.3" @@ -4286,47 +2932,35 @@ is-string@^1.1.1: is-symbol@^1.0.4, is-symbol@^1.1.1: version "1.1.1" - resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.1.1.tgz#f47761279f532e2b05a7024a7506dbbedacd0634" + resolved "https://registry.npmjs.org/is-symbol/-/is-symbol-1.1.1.tgz" integrity sha512-9gGx6GTtCQM73BgmHQXfDmLtfjjTUDSyoxTCbp5WtoixAhfgsDirWIcVQ/IHpvI5Vgd5i/J5F7B9cN/WlVbC/w== dependencies: call-bound "^1.0.2" has-symbols "^1.1.0" safe-regex-test "^1.1.0" -is-text-path@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-text-path/-/is-text-path-1.0.1.tgz#4e1aa0fb51bfbcb3e92688001397202c1775b66e" - integrity sha512-xFuJpne9oFz5qDaodwmmG08e3CawH/2ZV8Qqza1Ko7Sk8POWbkRdwIoAWVhqvq0XeUzANEhKo2n0IXUGBm7A/w== - dependencies: - text-extensions "^1.0.0" - is-typed-array@^1.1.13, is-typed-array@^1.1.14, is-typed-array@^1.1.15: version "1.1.15" - resolved "https://registry.yarnpkg.com/is-typed-array/-/is-typed-array-1.1.15.tgz#4bfb4a45b61cee83a5a46fba778e4e8d59c0ce0b" + resolved "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.15.tgz" integrity sha512-p3EcsicXjit7SaskXHs1hA91QxgTw46Fv6EFKKGS5DRFLD8yKnohjF3hxoju94b/OcMZoQukzpPpBE9uLVKzgQ== dependencies: which-typed-array "^1.1.16" -is-typedarray@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" - integrity sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA== - is-weakmap@^2.0.2: version "2.0.2" - resolved "https://registry.yarnpkg.com/is-weakmap/-/is-weakmap-2.0.2.tgz#bf72615d649dfe5f699079c54b83e47d1ae19cfd" + resolved "https://registry.npmjs.org/is-weakmap/-/is-weakmap-2.0.2.tgz" integrity sha512-K5pXYOm9wqY1RgjpL3YTkF39tni1XajUIkawTLUo9EZEVUFga5gSQJF8nNS7ZwJQ02y+1YCNYcMh+HIf1ZqE+w== is-weakref@^1.0.2, is-weakref@^1.1.1: version "1.1.1" - resolved "https://registry.yarnpkg.com/is-weakref/-/is-weakref-1.1.1.tgz#eea430182be8d64174bd96bffbc46f21bf3f9293" + resolved "https://registry.npmjs.org/is-weakref/-/is-weakref-1.1.1.tgz" integrity sha512-6i9mGWSlqzNMEqpCp93KwRS1uUOodk2OJ6b+sq7ZPDSy2WuI5NFIxp/254TytR8ftefexkWn5xNiHUNpPOfSew== dependencies: call-bound "^1.0.3" is-weakset@^2.0.3: version "2.0.4" - resolved "https://registry.yarnpkg.com/is-weakset/-/is-weakset-2.0.4.tgz#c9f5deb0bc1906c6d6f1027f284ddf459249daca" + resolved "https://registry.npmjs.org/is-weakset/-/is-weakset-2.0.4.tgz" integrity sha512-mfcwb6IzQyOKTs84CQMrOwW4gQcaTOAWJ0zzJCl2WSPDrWk/OzDaImWFH3djXhb24g4eudZfLRozAvPGw4d9hQ== dependencies: call-bound "^1.0.3" @@ -4334,22 +2968,17 @@ is-weakset@^2.0.3: isarray@^2.0.5: version "2.0.5" - resolved "https://registry.yarnpkg.com/isarray/-/isarray-2.0.5.tgz#8af1e4c1221244cc62459faf38940d4e644a5723" + resolved "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz" integrity sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw== -isarray@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" - integrity sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ== - isexe@^2.0.0: version "2.0.0" - resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" + resolved "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz" integrity sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw== isomorphic-fetch@^3.0.0: version "3.0.0" - resolved "https://registry.yarnpkg.com/isomorphic-fetch/-/isomorphic-fetch-3.0.0.tgz#0267b005049046d2421207215d45d6a262b8b8b4" + resolved "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-3.0.0.tgz" integrity sha512-qvUtwJ3j6qwsF3jLxkZ72qCgjMysPzDfeV240JHiGZsANBYd+EEuu35v7dfrJ9Up0Ak07D7GGSkGhCHTqg/5wA== dependencies: node-fetch "^2.6.1" @@ -4357,12 +2986,12 @@ isomorphic-fetch@^3.0.0: istanbul-lib-coverage@^3.0.0, istanbul-lib-coverage@^3.2.0: version "3.2.2" - resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz#2d166c4b0644d43a39f04bf6c2edd1e585f31756" + resolved "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz" integrity sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg== -istanbul-lib-instrument@^5.0.4, istanbul-lib-instrument@^5.1.0: +istanbul-lib-instrument@^5.0.4: version "5.2.1" - resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-5.2.1.tgz#d10c8885c2125574e1c231cacadf955675e1ce3d" + resolved "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-5.2.1.tgz" integrity sha512-pzqtp31nLv/XFOzXGuvhCb8qhjmTVo5vjVk19XE4CRlSWz0KoeJ3bw9XsA7nOp9YBf4qHjwBxkDzKcME/J29Yg== dependencies: "@babel/core" "^7.12.3" @@ -4371,9 +3000,20 @@ istanbul-lib-instrument@^5.0.4, istanbul-lib-instrument@^5.1.0: istanbul-lib-coverage "^3.2.0" semver "^6.3.0" +istanbul-lib-instrument@^6.0.0: + version "6.0.3" + resolved "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-6.0.3.tgz" + integrity sha512-Vtgk7L/R2JHyyGW07spoFlB8/lpjiOLTjMdms6AFMraYt3BaJauod/NGrfnVG/y4Ix1JEuMRPDPEj2ua+zz1/Q== + dependencies: + "@babel/core" "^7.23.9" + "@babel/parser" "^7.23.9" + "@istanbuljs/schema" "^0.1.3" + istanbul-lib-coverage "^3.2.0" + semver "^7.5.4" + istanbul-lib-report@^3.0.0: version "3.0.1" - resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz#908305bac9a5bd175ac6a74489eafd0fc2445a7d" + resolved "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz" integrity sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw== dependencies: istanbul-lib-coverage "^3.0.0" @@ -4382,7 +3022,7 @@ istanbul-lib-report@^3.0.0: istanbul-lib-source-maps@^4.0.0: version "4.0.1" - resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz#895f3a709fcfba34c6de5a42939022f3e4358551" + resolved "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz" integrity sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw== dependencies: debug "^4.1.1" @@ -4390,563 +3030,448 @@ istanbul-lib-source-maps@^4.0.0: source-map "^0.6.1" istanbul-reports@^3.1.3: - version "3.1.7" - resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-3.1.7.tgz#daed12b9e1dca518e15c056e1e537e741280fa0b" - integrity sha512-BewmUXImeuRk2YY0PVbxgKAysvhRPUQE0h5QRM++nVWyubKGV0l8qQ5op8+B2DOmwSe63Jivj0BjkPQVf8fP5g== + version "3.2.0" + resolved "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.2.0.tgz" + integrity sha512-HGYWWS/ehqTV3xN10i23tkPkpH46MLCIMFNCaaKNavAXTF1RkqxawEPtnjnGZ6XKSInBKkiOA5BKS+aZiY3AvA== dependencies: html-escaper "^2.0.0" istanbul-lib-report "^3.0.0" -jest-changed-files@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-27.5.1.tgz#a348aed00ec9bf671cc58a66fcbe7c3dfd6a68f5" - integrity sha512-buBLMiByfWGCoMsLLzGUUSpAmIAGnbR2KJoMN10ziLhOLvP4e0SlypHnAel8iqQXTrcbmfEY9sSqae5sgUsTvw== +jest-changed-files@^29.7.0: + version "29.7.0" + resolved "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-29.7.0.tgz" + integrity sha512-fEArFiwf1BpQ+4bXSprcDc3/x4HSzL4al2tozwVpDFpsxALjLYdyiIK4e5Vz66GQJIbXJ82+35PtysofptNX2w== dependencies: - "@jest/types" "^27.5.1" execa "^5.0.0" - throat "^6.0.1" - -jest-circus@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-circus/-/jest-circus-27.5.1.tgz#37a5a4459b7bf4406e53d637b49d22c65d125ecc" - integrity sha512-D95R7x5UtlMA5iBYsOHFFbMD/GVA4R/Kdq15f7xYWUfWHBto9NYRsOvnSauTgdF+ogCpJ4tyKOXhUifxS65gdw== - dependencies: - "@jest/environment" "^27.5.1" - "@jest/test-result" "^27.5.1" - "@jest/types" "^27.5.1" + jest-util "^29.7.0" + p-limit "^3.1.0" + +jest-circus@^29.7.0: + version "29.7.0" + resolved "https://registry.npmjs.org/jest-circus/-/jest-circus-29.7.0.tgz" + integrity sha512-3E1nCMgipcTkCocFwM90XXQab9bS+GMsjdpmPrlelaxwD93Ad8iVEjX/vvHPdLPnFf+L40u+5+iutRdA1N9myw== + dependencies: + "@jest/environment" "^29.7.0" + "@jest/expect" "^29.7.0" + "@jest/test-result" "^29.7.0" + "@jest/types" "^29.6.3" "@types/node" "*" chalk "^4.0.0" co "^4.6.0" - dedent "^0.7.0" - expect "^27.5.1" + dedent "^1.0.0" is-generator-fn "^2.0.0" - jest-each "^27.5.1" - jest-matcher-utils "^27.5.1" - jest-message-util "^27.5.1" - jest-runtime "^27.5.1" - jest-snapshot "^27.5.1" - jest-util "^27.5.1" - pretty-format "^27.5.1" + jest-each "^29.7.0" + jest-matcher-utils "^29.7.0" + jest-message-util "^29.7.0" + jest-runtime "^29.7.0" + jest-snapshot "^29.7.0" + jest-util "^29.7.0" + p-limit "^3.1.0" + pretty-format "^29.7.0" + pure-rand "^6.0.0" slash "^3.0.0" stack-utils "^2.0.3" - throat "^6.0.1" -jest-cli@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-27.5.1.tgz#278794a6e6458ea8029547e6c6cbf673bd30b145" - integrity sha512-Hc6HOOwYq4/74/c62dEE3r5elx8wjYqxY0r0G/nFrLDPMFRu6RA/u8qINOIkvhxG7mMQ5EJsOGfRpI8L6eFUVw== +jest-cli@^29.7.0: + version "29.7.0" + resolved "https://registry.npmjs.org/jest-cli/-/jest-cli-29.7.0.tgz" + integrity sha512-OVVobw2IubN/GSYsxETi+gOe7Ka59EFMR/twOU3Jb2GnKKeMGJB5SGUUrEz3SFVmJASUdZUzy83sLNNQ2gZslg== dependencies: - "@jest/core" "^27.5.1" - "@jest/test-result" "^27.5.1" - "@jest/types" "^27.5.1" + "@jest/core" "^29.7.0" + "@jest/test-result" "^29.7.0" + "@jest/types" "^29.6.3" chalk "^4.0.0" + create-jest "^29.7.0" exit "^0.1.2" - graceful-fs "^4.2.9" import-local "^3.0.2" - jest-config "^27.5.1" - jest-util "^27.5.1" - jest-validate "^27.5.1" - prompts "^2.0.1" - yargs "^16.2.0" - -jest-config@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-27.5.1.tgz#5c387de33dca3f99ad6357ddeccd91bf3a0e4a41" - integrity sha512-5sAsjm6tGdsVbW9ahcChPAFCk4IlkQUknH5AvKjuLTSlcO/wCZKyFdn7Rg0EkC+OGgWODEy2hDpWB1PgzH0JNA== - dependencies: - "@babel/core" "^7.8.0" - "@jest/test-sequencer" "^27.5.1" - "@jest/types" "^27.5.1" - babel-jest "^27.5.1" + jest-config "^29.7.0" + jest-util "^29.7.0" + jest-validate "^29.7.0" + yargs "^17.3.1" + +jest-config@^29.7.0: + version "29.7.0" + resolved "https://registry.npmjs.org/jest-config/-/jest-config-29.7.0.tgz" + integrity sha512-uXbpfeQ7R6TZBqI3/TxCU4q4ttk3u0PJeC+E0zbfSoSjq6bJ7buBPxzQPL0ifrkY4DNu4JUdk0ImlBUYi840eQ== + dependencies: + "@babel/core" "^7.11.6" + "@jest/test-sequencer" "^29.7.0" + "@jest/types" "^29.6.3" + babel-jest "^29.7.0" chalk "^4.0.0" ci-info "^3.2.0" deepmerge "^4.2.2" - glob "^7.1.1" + glob "^7.1.3" graceful-fs "^4.2.9" - jest-circus "^27.5.1" - jest-environment-jsdom "^27.5.1" - jest-environment-node "^27.5.1" - jest-get-type "^27.5.1" - jest-jasmine2 "^27.5.1" - jest-regex-util "^27.5.1" - jest-resolve "^27.5.1" - jest-runner "^27.5.1" - jest-util "^27.5.1" - jest-validate "^27.5.1" + jest-circus "^29.7.0" + jest-environment-node "^29.7.0" + jest-get-type "^29.6.3" + jest-regex-util "^29.6.3" + jest-resolve "^29.7.0" + jest-runner "^29.7.0" + jest-util "^29.7.0" + jest-validate "^29.7.0" micromatch "^4.0.4" parse-json "^5.2.0" - pretty-format "^27.5.1" + pretty-format "^29.7.0" slash "^3.0.0" strip-json-comments "^3.1.1" -jest-diff@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-27.5.1.tgz#a07f5011ac9e6643cf8a95a462b7b1ecf6680def" - integrity sha512-m0NvkX55LDt9T4mctTEgnZk3fmEg3NRYutvMPWM/0iPnkFj2wIeF45O1718cMSOFO1vINkqmxqD8vE37uTEbqw== +jest-diff@^29.7.0: + version "29.7.0" + resolved "https://registry.npmjs.org/jest-diff/-/jest-diff-29.7.0.tgz" + integrity sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw== dependencies: chalk "^4.0.0" - diff-sequences "^27.5.1" - jest-get-type "^27.5.1" - pretty-format "^27.5.1" + diff-sequences "^29.6.3" + jest-get-type "^29.6.3" + pretty-format "^29.7.0" -jest-docblock@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-27.5.1.tgz#14092f364a42c6108d42c33c8cf30e058e25f6c0" - integrity sha512-rl7hlABeTsRYxKiUfpHrQrG4e2obOiTQWfMEH3PxPjOtdsfLQO4ReWSZaQ7DETm4xu07rl4q/h4zcKXyU0/OzQ== +jest-docblock@^29.7.0: + version "29.7.0" + resolved "https://registry.npmjs.org/jest-docblock/-/jest-docblock-29.7.0.tgz" + integrity sha512-q617Auw3A612guyaFgsbFeYpNP5t2aoUNLwBUbc/0kD1R4t9ixDbyFTHd1nok4epoVFpr7PmeWHrhvuV3XaJ4g== dependencies: detect-newline "^3.0.0" -jest-each@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-27.5.1.tgz#5bc87016f45ed9507fed6e4702a5b468a5b2c44e" - integrity sha512-1Ff6p+FbhT/bXQnEouYy00bkNSY7OUpfIcmdl8vZ31A1UUaurOLPA8a8BbJOF2RDUElwJhmeaV7LnagI+5UwNQ== +jest-each@^29.7.0: + version "29.7.0" + resolved "https://registry.npmjs.org/jest-each/-/jest-each-29.7.0.tgz" + integrity sha512-gns+Er14+ZrEoC5fhOfYCY1LOHHr0TI+rQUHZS8Ttw2l7gl+80eHc/gFf2Ktkw0+SIACDTeWvpFcv3B04VembQ== dependencies: - "@jest/types" "^27.5.1" + "@jest/types" "^29.6.3" chalk "^4.0.0" - jest-get-type "^27.5.1" - jest-util "^27.5.1" - pretty-format "^27.5.1" - -jest-environment-jsdom@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-27.5.1.tgz#ea9ccd1fc610209655a77898f86b2b559516a546" - integrity sha512-TFBvkTC1Hnnnrka/fUb56atfDtJ9VMZ94JkjTbggl1PEpwrYtUBKMezB3inLmWqQsXYLcMwNoDQwoBTAvFfsfw== - dependencies: - "@jest/environment" "^27.5.1" - "@jest/fake-timers" "^27.5.1" - "@jest/types" "^27.5.1" - "@types/node" "*" - jest-mock "^27.5.1" - jest-util "^27.5.1" - jsdom "^16.6.0" - -jest-environment-node@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-27.5.1.tgz#dedc2cfe52fab6b8f5714b4808aefa85357a365e" - integrity sha512-Jt4ZUnxdOsTGwSRAfKEnE6BcwsSPNOijjwifq5sDFSA2kesnXTvNqKHYgM0hDq3549Uf/KzdXNYn4wMZJPlFLw== - dependencies: - "@jest/environment" "^27.5.1" - "@jest/fake-timers" "^27.5.1" - "@jest/types" "^27.5.1" + jest-get-type "^29.6.3" + jest-util "^29.7.0" + pretty-format "^29.7.0" + +jest-environment-node@^29.7.0: + version "29.7.0" + resolved "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-29.7.0.tgz" + integrity sha512-DOSwCRqXirTOyheM+4d5YZOrWcdu0LNZ87ewUoywbcb2XR4wKgqiG8vNeYwhjFMbEkfju7wx2GYH0P2gevGvFw== + dependencies: + "@jest/environment" "^29.7.0" + "@jest/fake-timers" "^29.7.0" + "@jest/types" "^29.6.3" "@types/node" "*" - jest-mock "^27.5.1" - jest-util "^27.5.1" + jest-mock "^29.7.0" + jest-util "^29.7.0" -jest-get-type@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-27.5.1.tgz#3cd613c507b0f7ace013df407a1c1cd578bcb4f1" - integrity sha512-2KY95ksYSaK7DMBWQn6dQz3kqAf3BB64y2udeG+hv4KfSOb9qwcYQstTJc1KCbsix+wLZWZYN8t7nwX3GOBLRw== +jest-get-type@^29.6.3: + version "29.6.3" + resolved "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.6.3.tgz" + integrity sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw== -jest-haste-map@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-27.5.1.tgz#9fd8bd7e7b4fa502d9c6164c5640512b4e811e7f" - integrity sha512-7GgkZ4Fw4NFbMSDSpZwXeBiIbx+t/46nJ2QitkOjvwPYyZmqttu2TDSimMHP1EkPOi4xUZAN1doE5Vd25H4Jng== +jest-haste-map@^29.7.0: + version "29.7.0" + resolved "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-29.7.0.tgz" + integrity sha512-fP8u2pyfqx0K1rGn1R9pyE0/KTn+G7PxktWidOBTqFPLYX0b9ksaMFkhK5vrS3DVun09pckLdlx90QthlW7AmA== dependencies: - "@jest/types" "^27.5.1" - "@types/graceful-fs" "^4.1.2" + "@jest/types" "^29.6.3" + "@types/graceful-fs" "^4.1.3" "@types/node" "*" anymatch "^3.0.3" fb-watchman "^2.0.0" graceful-fs "^4.2.9" - jest-regex-util "^27.5.1" - jest-serializer "^27.5.1" - jest-util "^27.5.1" - jest-worker "^27.5.1" + jest-regex-util "^29.6.3" + jest-util "^29.7.0" + jest-worker "^29.7.0" micromatch "^4.0.4" - walker "^1.0.7" + walker "^1.0.8" optionalDependencies: fsevents "^2.3.2" -jest-jasmine2@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-27.5.1.tgz#a037b0034ef49a9f3d71c4375a796f3b230d1ac4" - integrity sha512-jtq7VVyG8SqAorDpApwiJJImd0V2wv1xzdheGHRGyuT7gZm6gG47QEskOlzsN1PG/6WNaCo5pmwMHDf3AkG2pQ== +jest-leak-detector@^29.7.0: + version "29.7.0" + resolved "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-29.7.0.tgz" + integrity sha512-kYA8IJcSYtST2BY9I+SMC32nDpBT3J2NvWJx8+JCuCdl/CR1I4EKUJROiP8XtCcxqgTTBGJNdbB1A8XRKbTetw== dependencies: - "@jest/environment" "^27.5.1" - "@jest/source-map" "^27.5.1" - "@jest/test-result" "^27.5.1" - "@jest/types" "^27.5.1" - "@types/node" "*" - chalk "^4.0.0" - co "^4.6.0" - expect "^27.5.1" - is-generator-fn "^2.0.0" - jest-each "^27.5.1" - jest-matcher-utils "^27.5.1" - jest-message-util "^27.5.1" - jest-runtime "^27.5.1" - jest-snapshot "^27.5.1" - jest-util "^27.5.1" - pretty-format "^27.5.1" - throat "^6.0.1" - -jest-leak-detector@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-27.5.1.tgz#6ec9d54c3579dd6e3e66d70e3498adf80fde3fb8" - integrity sha512-POXfWAMvfU6WMUXftV4HolnJfnPOGEu10fscNCA76KBpRRhcMN2c8d3iT2pxQS3HLbA+5X4sOUPzYO2NUyIlHQ== - dependencies: - jest-get-type "^27.5.1" - pretty-format "^27.5.1" - -jest-matcher-utils@^27.0.0, jest-matcher-utils@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-27.5.1.tgz#9c0cdbda8245bc22d2331729d1091308b40cf8ab" - integrity sha512-z2uTx/T6LBaCoNWNFWwChLBKYxTMcGBRjAt+2SbP929/Fflb9aa5LGma654Rz8z9HLxsrUaYzxE9T/EFIL/PAw== + jest-get-type "^29.6.3" + pretty-format "^29.7.0" + +jest-matcher-utils@^29.7.0: + version "29.7.0" + resolved "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-29.7.0.tgz" + integrity sha512-sBkD+Xi9DtcChsI3L3u0+N0opgPYnCRPtGcQYrgXmR+hmt/fYfWAL0xRXYU8eWOdfuLgBe0YCW3AFtnRLagq/g== dependencies: chalk "^4.0.0" - jest-diff "^27.5.1" - jest-get-type "^27.5.1" - pretty-format "^27.5.1" + jest-diff "^29.7.0" + jest-get-type "^29.6.3" + pretty-format "^29.7.0" -jest-message-util@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-27.5.1.tgz#bdda72806da10d9ed6425e12afff38cd1458b6cf" - integrity sha512-rMyFe1+jnyAAf+NHwTclDz0eAaLkVDdKVHHBFWsBWHnnh5YeJMNWWsv7AbFYXfK3oTqvL7VTWkhNLu1jX24D+g== +jest-message-util@^29.7.0: + version "29.7.0" + resolved "https://registry.npmjs.org/jest-message-util/-/jest-message-util-29.7.0.tgz" + integrity sha512-GBEV4GRADeP+qtB2+6u61stea8mGcOT4mCtrYISZwfu9/ISHFJ/5zOMXYbpBE9RsS5+Gb63DW4FgmnKJ79Kf6w== dependencies: "@babel/code-frame" "^7.12.13" - "@jest/types" "^27.5.1" + "@jest/types" "^29.6.3" "@types/stack-utils" "^2.0.0" chalk "^4.0.0" graceful-fs "^4.2.9" micromatch "^4.0.4" - pretty-format "^27.5.1" + pretty-format "^29.7.0" slash "^3.0.0" stack-utils "^2.0.3" -jest-mock@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-27.5.1.tgz#19948336d49ef4d9c52021d34ac7b5f36ff967d6" - integrity sha512-K4jKbY1d4ENhbrG2zuPWaQBvDly+iZ2yAW+T1fATN78hc0sInwn7wZB8XtlNnvHug5RMwV897Xm4LqmPM4e2Og== +jest-mock@^29.7.0: + version "29.7.0" + resolved "https://registry.npmjs.org/jest-mock/-/jest-mock-29.7.0.tgz" + integrity sha512-ITOMZn+UkYS4ZFh83xYAOzWStloNzJFO2s8DWrE4lhtGD+AorgnbkiKERe4wQVBydIGPx059g6riW5Btp6Llnw== dependencies: - "@jest/types" "^27.5.1" + "@jest/types" "^29.6.3" "@types/node" "*" + jest-util "^29.7.0" jest-pnp-resolver@^1.2.2: version "1.2.3" - resolved "https://registry.yarnpkg.com/jest-pnp-resolver/-/jest-pnp-resolver-1.2.3.tgz#930b1546164d4ad5937d5540e711d4d38d4cad2e" + resolved "https://registry.npmjs.org/jest-pnp-resolver/-/jest-pnp-resolver-1.2.3.tgz" integrity sha512-+3NpwQEnRoIBtx4fyhblQDPgJI0H1IEIkX7ShLUjPGA7TtUTvI1oiKi3SR4oBR0hQhQR80l4WAe5RrXBwWMA8w== -jest-regex-util@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-27.5.1.tgz#4da143f7e9fd1e542d4aa69617b38e4a78365b95" - integrity sha512-4bfKq2zie+x16okqDXjXn9ql2B0dScQu+vcwe4TvFVhkVyuWLqpZrZtXxLLWoXYgn0E87I6r6GRYHF7wFZBUvg== +jest-regex-util@^29.6.3: + version "29.6.3" + resolved "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-29.6.3.tgz" + integrity sha512-KJJBsRCyyLNWCNBOvZyRDnAIfUiRJ8v+hOBQYGn8gDyF3UegwiP4gwRR3/SDa42g1YbVycTidUF3rKjyLFDWbg== -jest-resolve-dependencies@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-27.5.1.tgz#d811ecc8305e731cc86dd79741ee98fed06f1da8" - integrity sha512-QQOOdY4PE39iawDn5rzbIePNigfe5B9Z91GDD1ae/xNDlu9kaat8QQ5EKnNmVWPV54hUdxCVwwj6YMgR2O7IOg== +jest-resolve-dependencies@^29.7.0: + version "29.7.0" + resolved "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-29.7.0.tgz" + integrity sha512-un0zD/6qxJ+S0et7WxeI3H5XSe9lTBBR7bOHCHXkKR6luG5mwDDlIzVQ0V5cZCuoTgEdcdwzTghYkTWfubi+nA== dependencies: - "@jest/types" "^27.5.1" - jest-regex-util "^27.5.1" - jest-snapshot "^27.5.1" + jest-regex-util "^29.6.3" + jest-snapshot "^29.7.0" -jest-resolve@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-27.5.1.tgz#a2f1c5a0796ec18fe9eb1536ac3814c23617b384" - integrity sha512-FFDy8/9E6CV83IMbDpcjOhumAQPDyETnU2KZ1O98DwTnz8AOBsW/Xv3GySr1mOZdItLR+zDZ7I/UdTFbgSOVCw== +jest-resolve@^29.7.0: + version "29.7.0" + resolved "https://registry.npmjs.org/jest-resolve/-/jest-resolve-29.7.0.tgz" + integrity sha512-IOVhZSrg+UvVAshDSDtHyFCCBUl/Q3AAJv8iZ6ZjnZ74xzvwuzLXid9IIIPgTnY62SJjfuupMKZsZQRsCvxEgA== dependencies: - "@jest/types" "^27.5.1" chalk "^4.0.0" graceful-fs "^4.2.9" - jest-haste-map "^27.5.1" + jest-haste-map "^29.7.0" jest-pnp-resolver "^1.2.2" - jest-util "^27.5.1" - jest-validate "^27.5.1" + jest-util "^29.7.0" + jest-validate "^29.7.0" resolve "^1.20.0" - resolve.exports "^1.1.0" + resolve.exports "^2.0.0" slash "^3.0.0" -jest-runner@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-27.5.1.tgz#071b27c1fa30d90540805c5645a0ec167c7b62e5" - integrity sha512-g4NPsM4mFCOwFKXO4p/H/kWGdJp9V8kURY2lX8Me2drgXqG7rrZAx5kv+5H7wtt/cdFIjhqYx1HrlqWHaOvDaQ== +jest-runner@^29.7.0: + version "29.7.0" + resolved "https://registry.npmjs.org/jest-runner/-/jest-runner-29.7.0.tgz" + integrity sha512-fsc4N6cPCAahybGBfTRcq5wFR6fpLznMg47sY5aDpsoejOcVYFb07AHuSnR0liMcPTgBsA3ZJL6kFOjPdoNipQ== dependencies: - "@jest/console" "^27.5.1" - "@jest/environment" "^27.5.1" - "@jest/test-result" "^27.5.1" - "@jest/transform" "^27.5.1" - "@jest/types" "^27.5.1" + "@jest/console" "^29.7.0" + "@jest/environment" "^29.7.0" + "@jest/test-result" "^29.7.0" + "@jest/transform" "^29.7.0" + "@jest/types" "^29.6.3" "@types/node" "*" chalk "^4.0.0" - emittery "^0.8.1" + emittery "^0.13.1" graceful-fs "^4.2.9" - jest-docblock "^27.5.1" - jest-environment-jsdom "^27.5.1" - jest-environment-node "^27.5.1" - jest-haste-map "^27.5.1" - jest-leak-detector "^27.5.1" - jest-message-util "^27.5.1" - jest-resolve "^27.5.1" - jest-runtime "^27.5.1" - jest-util "^27.5.1" - jest-worker "^27.5.1" - source-map-support "^0.5.6" - throat "^6.0.1" - -jest-runtime@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-27.5.1.tgz#4896003d7a334f7e8e4a53ba93fb9bcd3db0a1af" - integrity sha512-o7gxw3Gf+H2IGt8fv0RiyE1+r83FJBRruoA+FXrlHw6xEyBsU8ugA6IPfTdVyA0w8HClpbK+DGJxH59UrNMx8A== - dependencies: - "@jest/environment" "^27.5.1" - "@jest/fake-timers" "^27.5.1" - "@jest/globals" "^27.5.1" - "@jest/source-map" "^27.5.1" - "@jest/test-result" "^27.5.1" - "@jest/transform" "^27.5.1" - "@jest/types" "^27.5.1" + jest-docblock "^29.7.0" + jest-environment-node "^29.7.0" + jest-haste-map "^29.7.0" + jest-leak-detector "^29.7.0" + jest-message-util "^29.7.0" + jest-resolve "^29.7.0" + jest-runtime "^29.7.0" + jest-util "^29.7.0" + jest-watcher "^29.7.0" + jest-worker "^29.7.0" + p-limit "^3.1.0" + source-map-support "0.5.13" + +jest-runtime@^29.7.0: + version "29.7.0" + resolved "https://registry.npmjs.org/jest-runtime/-/jest-runtime-29.7.0.tgz" + integrity sha512-gUnLjgwdGqW7B4LvOIkbKs9WGbn+QLqRQQ9juC6HndeDiezIwhDP+mhMwHWCEcfQ5RUXa6OPnFF8BJh5xegwwQ== + dependencies: + "@jest/environment" "^29.7.0" + "@jest/fake-timers" "^29.7.0" + "@jest/globals" "^29.7.0" + "@jest/source-map" "^29.6.3" + "@jest/test-result" "^29.7.0" + "@jest/transform" "^29.7.0" + "@jest/types" "^29.6.3" + "@types/node" "*" chalk "^4.0.0" cjs-module-lexer "^1.0.0" collect-v8-coverage "^1.0.0" - execa "^5.0.0" glob "^7.1.3" graceful-fs "^4.2.9" - jest-haste-map "^27.5.1" - jest-message-util "^27.5.1" - jest-mock "^27.5.1" - jest-regex-util "^27.5.1" - jest-resolve "^27.5.1" - jest-snapshot "^27.5.1" - jest-util "^27.5.1" + jest-haste-map "^29.7.0" + jest-message-util "^29.7.0" + jest-mock "^29.7.0" + jest-regex-util "^29.6.3" + jest-resolve "^29.7.0" + jest-snapshot "^29.7.0" + jest-util "^29.7.0" slash "^3.0.0" strip-bom "^4.0.0" -jest-serializer@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-serializer/-/jest-serializer-27.5.1.tgz#81438410a30ea66fd57ff730835123dea1fb1f64" - integrity sha512-jZCyo6iIxO1aqUxpuBlwTDMkzOAJS4a3eYz3YzgxxVQFwLeSA7Jfq5cbqCY+JLvTDrWirgusI/0KwxKMgrdf7w== - dependencies: - "@types/node" "*" - graceful-fs "^4.2.9" - -jest-snapshot@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-27.5.1.tgz#b668d50d23d38054a51b42c4039cab59ae6eb6a1" - integrity sha512-yYykXI5a0I31xX67mgeLw1DZ0bJB+gpq5IpSuCAoyDi0+BhgU/RIrL+RTzDmkNTchvDFWKP8lp+w/42Z3us5sA== +jest-snapshot@^29.7.0: + version "29.7.0" + resolved "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-29.7.0.tgz" + integrity sha512-Rm0BMWtxBcioHr1/OX5YCP8Uov4riHvKPknOGs804Zg9JGZgmIBkbtlxJC/7Z4msKYVbIJtfU+tKb8xlYNfdkw== dependencies: - "@babel/core" "^7.7.2" + "@babel/core" "^7.11.6" "@babel/generator" "^7.7.2" + "@babel/plugin-syntax-jsx" "^7.7.2" "@babel/plugin-syntax-typescript" "^7.7.2" - "@babel/traverse" "^7.7.2" - "@babel/types" "^7.0.0" - "@jest/transform" "^27.5.1" - "@jest/types" "^27.5.1" - "@types/babel__traverse" "^7.0.4" - "@types/prettier" "^2.1.5" + "@babel/types" "^7.3.3" + "@jest/expect-utils" "^29.7.0" + "@jest/transform" "^29.7.0" + "@jest/types" "^29.6.3" babel-preset-current-node-syntax "^1.0.0" chalk "^4.0.0" - expect "^27.5.1" + expect "^29.7.0" graceful-fs "^4.2.9" - jest-diff "^27.5.1" - jest-get-type "^27.5.1" - jest-haste-map "^27.5.1" - jest-matcher-utils "^27.5.1" - jest-message-util "^27.5.1" - jest-util "^27.5.1" + jest-diff "^29.7.0" + jest-get-type "^29.6.3" + jest-matcher-utils "^29.7.0" + jest-message-util "^29.7.0" + jest-util "^29.7.0" natural-compare "^1.4.0" - pretty-format "^27.5.1" - semver "^7.3.2" + pretty-format "^29.7.0" + semver "^7.5.3" -jest-util@^27.0.0, jest-util@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-27.5.1.tgz#3ba9771e8e31a0b85da48fe0b0891fb86c01c2f9" - integrity sha512-Kv2o/8jNvX1MQ0KGtw480E/w4fBCDOnH6+6DmeKi6LZUIlKA5kwY0YNdlzaWTiVgxqAqik11QyxDOKk543aKXw== +jest-util@^29.7.0: + version "29.7.0" + resolved "https://registry.npmjs.org/jest-util/-/jest-util-29.7.0.tgz" + integrity sha512-z6EbKajIpqGKU56y5KBUgy1dt1ihhQJgWzUlZHArA/+X2ad7Cb5iF+AK1EWVL/Bo7Rz9uurpqw6SiBCefUbCGA== dependencies: - "@jest/types" "^27.5.1" + "@jest/types" "^29.6.3" "@types/node" "*" chalk "^4.0.0" ci-info "^3.2.0" graceful-fs "^4.2.9" picomatch "^2.2.3" -jest-validate@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-27.5.1.tgz#9197d54dc0bdb52260b8db40b46ae668e04df067" - integrity sha512-thkNli0LYTmOI1tDB3FI1S1RTp/Bqyd9pTarJwL87OIBFuqEb5Apv5EaApEudYg4g86e3CT6kM0RowkhtEnCBQ== +jest-validate@^29.7.0: + version "29.7.0" + resolved "https://registry.npmjs.org/jest-validate/-/jest-validate-29.7.0.tgz" + integrity sha512-ZB7wHqaRGVw/9hST/OuFUReG7M8vKeq0/J2egIGLdvjHCmYqGARhzXmtgi+gVeZ5uXFF219aOc3Ls2yLg27tkw== dependencies: - "@jest/types" "^27.5.1" + "@jest/types" "^29.6.3" camelcase "^6.2.0" chalk "^4.0.0" - jest-get-type "^27.5.1" + jest-get-type "^29.6.3" leven "^3.1.0" - pretty-format "^27.5.1" + pretty-format "^29.7.0" -jest-watcher@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-27.5.1.tgz#71bd85fb9bde3a2c2ec4dc353437971c43c642a2" - integrity sha512-z676SuD6Z8o8qbmEGhoEUFOM1+jfEiL3DXHK/xgEiG2EyNYfFG60jluWcupY6dATjfEsKQuibReS1djInQnoVw== +jest-watcher@^29.7.0: + version "29.7.0" + resolved "https://registry.npmjs.org/jest-watcher/-/jest-watcher-29.7.0.tgz" + integrity sha512-49Fg7WXkU3Vl2h6LbLtMQ/HyB6rXSIX7SqvBLQmssRBGN9I0PNvPmAmCWSOY6SOvrjhI/F7/bGAv9RtnsPA03g== dependencies: - "@jest/test-result" "^27.5.1" - "@jest/types" "^27.5.1" + "@jest/test-result" "^29.7.0" + "@jest/types" "^29.6.3" "@types/node" "*" ansi-escapes "^4.2.1" chalk "^4.0.0" - jest-util "^27.5.1" + emittery "^0.13.1" + jest-util "^29.7.0" string-length "^4.0.1" -jest-worker@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-27.5.1.tgz#8d146f0900e8973b106b6f73cc1e9a8cb86f8db0" - integrity sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg== +jest-worker@^29.7.0: + version "29.7.0" + resolved "https://registry.npmjs.org/jest-worker/-/jest-worker-29.7.0.tgz" + integrity sha512-eIz2msL/EzL9UFTFFx7jBTkeZfku0yUAyZZZmJ93H2TYEiroIx2PQjEXcwYtYl8zXCxb+PAmA2hLIt/6ZEkPHw== dependencies: "@types/node" "*" + jest-util "^29.7.0" merge-stream "^2.0.0" supports-color "^8.0.0" -jest@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest/-/jest-27.5.1.tgz#dadf33ba70a779be7a6fc33015843b51494f63fc" - integrity sha512-Yn0mADZB89zTtjkPJEXwrac3LHudkQMR+Paqa8uxJHCBr9agxztUifWCyiYrjhMPBoUVBjyny0I7XH6ozDr7QQ== +jest@^29.7.0: + version "29.7.0" + resolved "https://registry.npmjs.org/jest/-/jest-29.7.0.tgz" + integrity sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw== dependencies: - "@jest/core" "^27.5.1" + "@jest/core" "^29.7.0" + "@jest/types" "^29.6.3" import-local "^3.0.2" - jest-cli "^27.5.1" - -js-sha3@0.8.0: - version "0.8.0" - resolved "https://registry.yarnpkg.com/js-sha3/-/js-sha3-0.8.0.tgz#b9b7a5da73afad7dedd0f8c463954cbde6818840" - integrity sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q== + jest-cli "^29.7.0" js-tokens@^4.0.0: version "4.0.0" - resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" + resolved "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz" integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== js-yaml@^3.13.1: - version "3.14.1" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.1.tgz#dae812fdb3825fa306609a8717383c50c36a0537" - integrity sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g== + version "3.14.2" + resolved "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.2.tgz" + integrity sha512-PMSmkqxr106Xa156c2M265Z+FTrPl+oxd/rgOQy2tijQeK5TxQ43psO1ZCwhVOSdnn+RzkzlRz/eY4BgJBYVpg== dependencies: argparse "^1.0.7" esprima "^4.0.0" js-yaml@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602" - integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA== + version "4.1.1" + resolved "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz" + integrity sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA== dependencies: argparse "^2.0.1" -jsdom@^16.6.0: - version "16.7.0" - resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-16.7.0.tgz#918ae71965424b197c819f8183a754e18977b710" - integrity sha512-u9Smc2G1USStM+s/x1ru5Sxrl6mPYCbByG1U/hUmqaVsm4tbNyS7CicOSRyuGQYZhTu0h84qkZZQ/I+dzizSVw== - dependencies: - abab "^2.0.5" - acorn "^8.2.4" - acorn-globals "^6.0.0" - cssom "^0.4.4" - cssstyle "^2.3.0" - data-urls "^2.0.0" - decimal.js "^10.2.1" - domexception "^2.0.1" - escodegen "^2.0.0" - form-data "^3.0.0" - html-encoding-sniffer "^2.0.1" - http-proxy-agent "^4.0.1" - https-proxy-agent "^5.0.0" - is-potential-custom-element-name "^1.0.1" - nwsapi "^2.2.0" - parse5 "6.0.1" - saxes "^5.0.1" - symbol-tree "^3.2.4" - tough-cookie "^4.0.0" - w3c-hr-time "^1.0.2" - w3c-xmlserializer "^2.0.0" - webidl-conversions "^6.1.0" - whatwg-encoding "^1.0.5" - whatwg-mimetype "^2.3.0" - whatwg-url "^8.5.0" - ws "^7.4.6" - xml-name-validator "^3.0.0" - -jsesc@^3.0.2: +jsesc@^3.0.2, jsesc@~3.1.0: version "3.1.0" - resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-3.1.0.tgz#74d335a234f67ed19907fdadfac7ccf9d409825d" + resolved "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz" integrity sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA== -jsesc@~3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-3.0.2.tgz#bb8b09a6597ba426425f2e4a07245c3d00b9343e" - integrity sha512-xKqzzWXDttJuOcawBt4KnKHHIf5oQ/Cxax+0PWFG+DFDgHNAdi+TXECADI+RYiFUMmx8792xsMbbgXj4CwnP4g== - json-buffer@3.0.1: version "3.0.1" - resolved "https://registry.yarnpkg.com/json-buffer/-/json-buffer-3.0.1.tgz#9338802a30d3b6605fbe0613e094008ca8c05a13" + resolved "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz" integrity sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ== -json-parse-better-errors@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz#bb867cfb3450e69107c131d1c514bab3dc8bcaa9" - integrity sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw== - json-parse-even-better-errors@^2.3.0: version "2.3.1" - resolved "https://registry.yarnpkg.com/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz#7c47805a94319928e05777405dc12e1f7a4ee02d" + resolved "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz" integrity sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w== json-schema-traverse@^0.4.1: version "0.4.1" - resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" + resolved "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz" integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== -json-schema-traverse@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz#ae7bcb3656ab77a73ba5c49bf654f38e6b6860e2" - integrity sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug== - json-stable-stringify-without-jsonify@^1.0.1: version "1.0.1" - resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" + resolved "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz" integrity sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw== -json-stringify-safe@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" - integrity sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA== - -json5@2.x, json5@^2.2.3: - version "2.2.3" - resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283" - integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg== - json5@^1.0.2: version "1.0.2" - resolved "https://registry.yarnpkg.com/json5/-/json5-1.0.2.tgz#63d98d60f21b313b77c4d6da18bfa69d80e1d593" + resolved "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz" integrity sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA== dependencies: minimist "^1.2.0" -jsonparse@^1.2.0: - version "1.3.1" - resolved "https://registry.yarnpkg.com/jsonparse/-/jsonparse-1.3.1.tgz#3f4dae4a91fac315f71062f8521cc239f1366280" - integrity sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg== +json5@^2.2.3: + version "2.2.3" + resolved "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz" + integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg== keyv@^4.5.3: version "4.5.4" - resolved "https://registry.yarnpkg.com/keyv/-/keyv-4.5.4.tgz#a879a99e29452f942439f2a405e3af8b31d4de93" + resolved "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz" integrity sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw== dependencies: json-buffer "3.0.1" -kind-of@^6.0.3: - version "6.0.3" - resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.3.tgz#07c05034a6c349fa06e24fa35aa76db4580ce4dd" - integrity sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw== - kleur@^3.0.3: version "3.0.3" - resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e" + resolved "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz" integrity sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w== leven@^3.1.0: version "3.1.0" - resolved "https://registry.yarnpkg.com/leven/-/leven-3.1.0.tgz#77891de834064cccba82ae7842bb6b14a13ed7f2" + resolved "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz" integrity sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A== levn@^0.4.1: version "0.4.1" - resolved "https://registry.yarnpkg.com/levn/-/levn-0.4.1.tgz#ae4562c007473b932a6200d403268dd2fffc6ade" + resolved "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz" integrity sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ== dependencies: prelude-ls "^1.2.1" @@ -4954,17 +3479,17 @@ levn@^0.4.1: lilconfig@2.0.5: version "2.0.5" - resolved "https://registry.yarnpkg.com/lilconfig/-/lilconfig-2.0.5.tgz#19e57fd06ccc3848fd1891655b5a447092225b25" + resolved "https://registry.npmjs.org/lilconfig/-/lilconfig-2.0.5.tgz" integrity sha512-xaYmXZtTHPAw5m+xLN8ab9C+3a8YmV3asNSPOATITbtwrfbwaLJj8h66H1WMIpALCkqsIzK3h7oQ+PdX+LQ9Eg== lines-and-columns@^1.1.6: version "1.2.4" - resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632" + resolved "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz" integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg== lint-staged@^12.4.1: version "12.5.0" - resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-12.5.0.tgz#d6925747480ae0e380d13988522f9dd8ef9126e3" + resolved "https://registry.npmjs.org/lint-staged/-/lint-staged-12.5.0.tgz" integrity sha512-BKLUjWDsKquV/JuIcoQW4MSAI3ggwEImF1+sB4zaKvyVx1wBk3FsG7UK9bpnmBTN1pm7EH2BBcMwINJzCRv12g== dependencies: cli-truncate "^3.1.0" @@ -4984,7 +3509,7 @@ lint-staged@^12.4.1: listr2@^4.0.5: version "4.0.5" - resolved "https://registry.yarnpkg.com/listr2/-/listr2-4.0.5.tgz#9dcc50221583e8b4c71c43f9c7dfd0ef546b75d5" + resolved "https://registry.npmjs.org/listr2/-/listr2-4.0.5.tgz" integrity sha512-juGHV1doQdpNT3GSTs9IUN43QJb7KHdF9uqg7Vufs/tG9VTzpFphqF4pm/ICdAABGQxsyNn9CiYA3StkI6jpwA== dependencies: cli-truncate "^2.1.0" @@ -4996,79 +3521,38 @@ listr2@^4.0.5: through "^2.3.8" wrap-ansi "^7.0.0" -load-json-file@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-4.0.0.tgz#2f5f45ab91e33216234fd53adab668eb4ec0993b" - integrity sha512-Kx8hMakjX03tiGTLAIdJ+lL0htKnXjEZN6hk/tozf/WOuYGdZBJrZ+rCJRbVCugsjB3jMLn9746NsQIf5VjBMw== - dependencies: - graceful-fs "^4.1.2" - parse-json "^4.0.0" - pify "^3.0.0" - strip-bom "^3.0.0" - -locate-path@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e" - integrity sha512-NCI2kiDkyR7VeEKm27Kda/iQHyKJe1Bu0FlTbYp3CqJu+9IFe9bLyAjMxf5ZDDbEg+iMPzB5zYyUTSm8wVTKmA== - dependencies: - p-locate "^2.0.0" - path-exists "^3.0.0" - -locate-path@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-3.0.0.tgz#dbec3b3ab759758071b58fe59fc41871af21400e" - integrity sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A== - dependencies: - p-locate "^3.0.0" - path-exists "^3.0.0" - locate-path@^5.0.0: version "5.0.0" - resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-5.0.0.tgz#1afba396afd676a6d42504d0a67a3a7eb9f62aa0" + resolved "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz" integrity sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g== dependencies: p-locate "^4.1.0" locate-path@^6.0.0: version "6.0.0" - resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-6.0.0.tgz#55321eb309febbc59c4801d931a72452a681d286" + resolved "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz" integrity sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw== dependencies: p-locate "^5.0.0" lodash.debounce@^4.0.8: version "4.0.8" - resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af" + resolved "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz" integrity sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow== -lodash.ismatch@^4.4.0: - version "4.4.0" - resolved "https://registry.yarnpkg.com/lodash.ismatch/-/lodash.ismatch-4.4.0.tgz#756cb5150ca3ba6f11085a78849645f188f85f37" - integrity sha512-fPMfXjGQEV9Xsq/8MTSgUf255gawYRbjwMyDbcvDhXgV7enSZA0hynz6vMPnpAb5iONEzBHBPsT+0zes5Z301g== - -lodash.memoize@4.x: +lodash.memoize@^4.1.2: version "4.1.2" - resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe" + resolved "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz" integrity sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag== -lodash.merge@^4.6.0, lodash.merge@^4.6.2: +lodash.merge@^4.6.2: version "4.6.2" - resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" + resolved "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz" integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== -lodash.truncate@^4.4.2: - version "4.4.2" - resolved "https://registry.yarnpkg.com/lodash.truncate/-/lodash.truncate-4.4.2.tgz#5a350da0b1113b837ecfffd5812cbe58d6eae193" - integrity sha512-jttmRe7bRse52OsWIMDLaXxWqRAmtIUccAQ3garviCqJjafXOfNMO0yMfNpdD6zbGaTU0P5Nz7e7gAT6cKmJRw== - -lodash@^4.17.15, lodash@^4.7.0: - version "4.17.21" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" - integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== - log-update@^4.0.0: version "4.0.0" - resolved "https://registry.yarnpkg.com/log-update/-/log-update-4.0.0.tgz#589ecd352471f2a1c0c570287543a64dfd20e0a1" + resolved "https://registry.npmjs.org/log-update/-/log-update-4.0.0.tgz" integrity sha512-9fkkDevMefjg0mmzWFBW8YkFP91OrizzkW3diF7CpG+S2EYdy4+TVfGwz1zeF8x7hCx1ovSPTOE9Ngib74qqUg== dependencies: ansi-escapes "^4.3.0" @@ -5076,252 +3560,136 @@ log-update@^4.0.0: slice-ansi "^4.0.0" wrap-ansi "^6.2.0" -loglevel-colored-level-prefix@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/loglevel-colored-level-prefix/-/loglevel-colored-level-prefix-1.0.0.tgz#6a40218fdc7ae15fc76c3d0f3e676c465388603e" - integrity sha512-u45Wcxxc+SdAlh4yeF/uKlC1SPUPCy0gullSNKXod5I4bmifzk+Q4lSLExNEVn19tGaJipbZ4V4jbFn79/6mVA== - dependencies: - chalk "^1.1.3" - loglevel "^1.4.1" - -loglevel@^1.4.1: - version "1.9.2" - resolved "https://registry.yarnpkg.com/loglevel/-/loglevel-1.9.2.tgz#c2e028d6c757720107df4e64508530db6621ba08" - integrity sha512-HgMmCqIJSAKqo68l0rS2AanEWfkxaZ5wNiEFb5ggm08lDs9Xl2KxBlX3PTcaD2chBM1gXAYf491/M2Rv8Jwayg== - lru-cache@^5.1.1: version "5.1.1" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-5.1.1.tgz#1da27e6710271947695daf6848e847f01d84b920" + resolved "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz" integrity sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w== dependencies: yallist "^3.0.2" -lru-cache@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" - integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA== - dependencies: - yallist "^4.0.0" - make-dir@^4.0.0: version "4.0.0" - resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-4.0.0.tgz#c3c2307a771277cd9638305f915c29ae741b614e" + resolved "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz" integrity sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw== dependencies: semver "^7.5.3" -make-error@1.x, make-error@^1.1.1: +make-error@^1.3.6: version "1.3.6" - resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" + resolved "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz" integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== makeerror@1.0.12: version "1.0.12" - resolved "https://registry.yarnpkg.com/makeerror/-/makeerror-1.0.12.tgz#3e5dd2079a82e812e983cc6610c4a2cb0eaa801a" + resolved "https://registry.npmjs.org/makeerror/-/makeerror-1.0.12.tgz" integrity sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg== dependencies: tmpl "1.0.5" -map-obj@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/map-obj/-/map-obj-1.0.1.tgz#d933ceb9205d82bdcf4886f6742bdc2b4dea146d" - integrity sha512-7N/q3lyZ+LVCp7PzuxrJr4KMbBE2hW7BT7YNia330OFxIf4d3r5zVpicP2650l7CPN6RM9zOJRl3NGpqSiw3Eg== - -map-obj@^4.0.0: - version "4.3.0" - resolved "https://registry.yarnpkg.com/map-obj/-/map-obj-4.3.0.tgz#9304f906e93faae70880da102a9f1df0ea8bb05a" - integrity sha512-hdN1wVrZbb29eBGiGjJbeP8JbKjq1urkHJ/LIP/NY48MZ1QVXUsQBV1G1zvYFHn1XE06cwjBsOI2K3Ulnj1YXQ== - math-intrinsics@^1.1.0: version "1.1.0" - resolved "https://registry.yarnpkg.com/math-intrinsics/-/math-intrinsics-1.1.0.tgz#a0dd74be81e2aa5c2f27e65ce283605ee4e2b7f9" + resolved "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz" integrity sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g== -meow@^8.0.0: - version "8.1.2" - resolved "https://registry.yarnpkg.com/meow/-/meow-8.1.2.tgz#bcbe45bda0ee1729d350c03cffc8395a36c4e897" - integrity sha512-r85E3NdZ+mpYk1C6RjPFEMSE+s1iZMuHtsHAqY0DT3jZczl0diWUZ8g6oU7h0M9cD2EL+PzaYghhCLzR0ZNn5Q== - dependencies: - "@types/minimist" "^1.2.0" - camelcase-keys "^6.2.2" - decamelize-keys "^1.1.0" - hard-rejection "^2.1.0" - minimist-options "4.1.0" - normalize-package-data "^3.0.0" - read-pkg-up "^7.0.1" - redent "^3.0.0" - trim-newlines "^3.0.0" - type-fest "^0.18.0" - yargs-parser "^20.2.3" - merge-stream@^2.0.0: version "2.0.0" - resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" + resolved "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz" integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== merge2@^1.3.0, merge2@^1.4.1: version "1.4.1" - resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" + resolved "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz" integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== micromatch@^4.0.4, micromatch@^4.0.5, micromatch@^4.0.8: version "4.0.8" - resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.8.tgz#d66fa18f3a47076789320b9b1af32bd86d9fa202" + resolved "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz" integrity sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA== dependencies: braces "^3.0.3" picomatch "^2.3.1" -mime-db@1.52.0: - version "1.52.0" - resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70" - integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== - -mime-types@^2.1.35: - version "2.1.35" - resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a" - integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== - dependencies: - mime-db "1.52.0" - mimic-fn@^2.1.0: version "2.1.0" - resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" + resolved "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz" integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== -min-indent@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/min-indent/-/min-indent-1.0.1.tgz#a63f681673b30571fbe8bc25686ae746eefa9869" - integrity sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg== - -minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7" - integrity sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A== - -minimalistic-crypto-utils@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" - integrity sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg== - minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.1, minimatch@^3.1.2: - version "3.1.2" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" - integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== + version "3.1.5" + resolved "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz" + integrity sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w== dependencies: brace-expansion "^1.1.7" -minimist-options@4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/minimist-options/-/minimist-options-4.1.0.tgz#c0655713c53a8a2ebd77ffa247d342c40f010619" - integrity sha512-Q4r8ghd80yhO/0j1O3B2BjweX3fiHg9cdOwjJd2J76Q135c+NDxGCqdYKQ1SKBuFfgWbAUzBfvYjPUEeNgqN1A== +minimatch@^9.0.4: + version "9.0.9" + resolved "https://registry.npmjs.org/minimatch/-/minimatch-9.0.9.tgz" + integrity sha512-OBwBN9AL4dqmETlpS2zasx+vTeWclWzkblfZk7KTA5j3jeOONz/tRCnZomUyvNg83wL5Zv9Ss6HMJXAgL8R2Yg== dependencies: - arrify "^1.0.1" - is-plain-obj "^1.1.0" - kind-of "^6.0.3" - -minimist@1.2.6: - version "1.2.6" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44" - integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q== + brace-expansion "^2.0.2" minimist@^1.2.0, minimist@^1.2.5, minimist@^1.2.6: version "1.2.8" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c" + resolved "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz" integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA== -modify-values@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/modify-values/-/modify-values-1.0.1.tgz#b3939fa605546474e3e3e3c63d64bd43b4ee6022" - integrity sha512-xV2bxeN6F7oYjZWTe/YPAy6MN2M+sL4u/Rlm2AHCIVGfo2p1yGmBHQ6vHehl4bRTZBdHu3TSkWdYgkwpYzAGSw== - ms@^2.1.1, ms@^2.1.3: version "2.1.3" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" + resolved "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz" integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== -natural-compare-lite@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/natural-compare-lite/-/natural-compare-lite-1.4.0.tgz#17b09581988979fddafe0201e931ba933c96cbb4" - integrity sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g== - natural-compare@^1.4.0: version "1.4.0" - resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" + resolved "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz" integrity sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw== neo-async@^2.6.2: version "2.6.2" - resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f" + resolved "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz" integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw== node-fetch@^2.6.1: version "2.7.0" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d" + resolved "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz" integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A== dependencies: whatwg-url "^5.0.0" node-int64@^0.4.0: version "0.4.0" - resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" + resolved "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz" integrity sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw== -node-releases@^2.0.19: - version "2.0.19" - resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.19.tgz#9e445a52950951ec4d177d843af370b411caf314" - integrity sha512-xxOWJsBKtzAq7DY0J+DTzuz58K8e7sJbdgwkbMWQe8UYB6ekmsQ45q0M/tJDsGaZmbC+l7n57UV8Hl5tHxO9uw== - -normalize-package-data@^2.3.2, normalize-package-data@^2.5.0: - version "2.5.0" - resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.5.0.tgz#e66db1838b200c1dfc233225d12cb36520e234a8" - integrity sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA== - dependencies: - hosted-git-info "^2.1.4" - resolve "^1.10.0" - semver "2 || 3 || 4 || 5" - validate-npm-package-license "^3.0.1" - -normalize-package-data@^3.0.0: - version "3.0.3" - resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-3.0.3.tgz#dbcc3e2da59509a0983422884cd172eefdfa525e" - integrity sha512-p2W1sgqij3zMMyRC067Dg16bfzVH+w7hyegmpIvZ4JNjqtGOVAIvLmjBx3yP7YTe9vKJgkoNOPjwQGogDoMXFA== - dependencies: - hosted-git-info "^4.0.1" - is-core-module "^2.5.0" - semver "^7.3.4" - validate-npm-package-license "^3.0.1" +node-releases@^2.0.27: + version "2.0.27" + resolved "https://registry.npmjs.org/node-releases/-/node-releases-2.0.27.tgz" + integrity sha512-nmh3lCkYZ3grZvqcCH+fjmQ7X+H0OeZgP40OierEaAptX4XofMh5kwNbWh7lBduUzCcV/8kZ+NDLCwm2iorIlA== normalize-path@^3.0.0: version "3.0.0" - resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" + resolved "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz" integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== npm-run-path@^4.0.1: version "4.0.1" - resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-4.0.1.tgz#b7ecd1e5ed53da8e37a55e1c2269e0b97ed748ea" + resolved "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz" integrity sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw== dependencies: path-key "^3.0.0" -nwsapi@^2.2.0: - version "2.2.20" - resolved "https://registry.yarnpkg.com/nwsapi/-/nwsapi-2.2.20.tgz#22e53253c61e7b0e7e93cef42c891154bcca11ef" - integrity sha512-/ieB+mDe4MrrKMT8z+mQL8klXydZWGR5Dowt4RAGKbJ3kIGEx3X4ljUo+6V73IXtUPWgfOlU5B9MlGxFO5T+cA== - object-inspect@^1.12.2, object-inspect@^1.13.3, object-inspect@^1.13.4: version "1.13.4" - resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.13.4.tgz#8375265e21bc20d0fa582c22e1b13485d6e00213" + resolved "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz" integrity sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew== object-keys@^1.1.1: version "1.1.1" - resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e" + resolved "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz" integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA== -object.assign@^4.1.2, object.assign@^4.1.7: +object.assign@^4.1.7: version "4.1.7" - resolved "https://registry.yarnpkg.com/object.assign/-/object.assign-4.1.7.tgz#8c14ca1a424c6a561b0bb2a22f66f5049a945d3d" + resolved "https://registry.npmjs.org/object.assign/-/object.assign-4.1.7.tgz" integrity sha512-nK28WOo+QIjBkDduTINE4JkF/UJJKyf2EJxvJKfblDpyg0Q+pkOHNTL0Qwy6NP6FhE/EnzV73BxxqcJaXY9anw== dependencies: call-bind "^1.0.8" @@ -5331,19 +3699,9 @@ object.assign@^4.1.2, object.assign@^4.1.7: has-symbols "^1.1.0" object-keys "^1.1.1" -object.entries@^1.1.5: - version "1.1.9" - resolved "https://registry.yarnpkg.com/object.entries/-/object.entries-1.1.9.tgz#e4770a6a1444afb61bd39f984018b5bede25f8b3" - integrity sha512-8u/hfXFRBD1O0hPUjioLhoWFHRmt6tKA4/vZPyckBr18l1KE9uHrFaFaUi8MDRTpi4uak2goyPTSNJLXX2k2Hw== - dependencies: - call-bind "^1.0.8" - call-bound "^1.0.4" - define-properties "^1.2.1" - es-object-atoms "^1.1.1" - object.fromentries@^2.0.8: version "2.0.8" - resolved "https://registry.yarnpkg.com/object.fromentries/-/object.fromentries-2.0.8.tgz#f7195d8a9b97bd95cbc1999ea939ecd1a2b00c65" + resolved "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.8.tgz" integrity sha512-k6E21FzySsSK5a21KRADBd/NGneRegFO5pLHfdQLpRDETUNJueLXs3WCzyQ3tFRDYgbq3KHGXfTbi2bs8WQ6rQ== dependencies: call-bind "^1.0.7" @@ -5353,7 +3711,7 @@ object.fromentries@^2.0.8: object.groupby@^1.0.3: version "1.0.3" - resolved "https://registry.yarnpkg.com/object.groupby/-/object.groupby-1.0.3.tgz#9b125c36238129f6f7b61954a1e7176148d5002e" + resolved "https://registry.npmjs.org/object.groupby/-/object.groupby-1.0.3.tgz" integrity sha512-+Lhy3TQTuzXI5hevh8sBGqbmurHbbIjAi0Z4S63nthVLmLxfbj4T54a4CfZrXIrt9iP4mVAPYMo/v99taj3wjQ== dependencies: call-bind "^1.0.7" @@ -5362,7 +3720,7 @@ object.groupby@^1.0.3: object.values@^1.2.1: version "1.2.1" - resolved "https://registry.yarnpkg.com/object.values/-/object.values-1.2.1.tgz#deed520a50809ff7f75a7cfd4bc64c7a038c6216" + resolved "https://registry.npmjs.org/object.values/-/object.values-1.2.1.tgz" integrity sha512-gXah6aZrcUxjWg2zR2MwouP2eHlCBzdV4pygudehaKXSGW4v2AsRQUK+lwwXhii6KFZcunEnmSUoYp5CXibxtA== dependencies: call-bind "^1.0.8" @@ -5372,21 +3730,21 @@ object.values@^1.2.1: once@^1.3.0: version "1.4.0" - resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + resolved "https://registry.npmjs.org/once/-/once-1.4.0.tgz" integrity sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w== dependencies: wrappy "1" onetime@^5.1.0, onetime@^5.1.2: version "5.1.2" - resolved "https://registry.yarnpkg.com/onetime/-/onetime-5.1.2.tgz#d0e96ebb56b07476df1dd9c4806e5237985ca45e" + resolved "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz" integrity sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg== dependencies: mimic-fn "^2.1.0" -optionator@^0.9.1, optionator@^0.9.3: +optionator@^0.9.3: version "0.9.4" - resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.4.tgz#7ea1c1a5d91d764fb282139c88fe11e182a3a734" + resolved "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz" integrity sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g== dependencies: deep-is "^0.1.3" @@ -5398,97 +3756,63 @@ optionator@^0.9.1, optionator@^0.9.3: own-keys@^1.0.1: version "1.0.1" - resolved "https://registry.yarnpkg.com/own-keys/-/own-keys-1.0.1.tgz#e4006910a2bf913585289676eebd6f390cf51358" + resolved "https://registry.npmjs.org/own-keys/-/own-keys-1.0.1.tgz" integrity sha512-qFOyK5PjiWZd+QQIh+1jhdb9LpxTF0qs7Pm8o5QHYZ0M3vKqSqzsZaEB6oWlxZ+q2sJBMI/Ktgd2N5ZwQoRHfg== dependencies: get-intrinsic "^1.2.6" object-keys "^1.1.1" safe-push-apply "^1.0.0" -p-limit@^1.1.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.3.0.tgz#b86bd5f0c25690911c7590fcbfc2010d54b3ccb8" - integrity sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q== - dependencies: - p-try "^1.0.0" - -p-limit@^2.0.0, p-limit@^2.2.0: +p-limit@^2.2.0: version "2.3.0" - resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1" + resolved "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz" integrity sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w== dependencies: p-try "^2.0.0" -p-limit@^3.0.2: +p-limit@^3.0.2, p-limit@^3.1.0: version "3.1.0" - resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-3.1.0.tgz#e1daccbe78d0d1388ca18c64fea38e3e57e3706b" + resolved "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz" integrity sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ== dependencies: yocto-queue "^0.1.0" -p-locate@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-2.0.0.tgz#20a0103b222a70c8fd39cc2e580680f3dde5ec43" - integrity sha512-nQja7m7gSKuewoVRen45CtVfODR3crN3goVQ0DDZ9N3yHxgpkuBhZqsaiotSQRrADUrne346peY7kT3TSACykg== - dependencies: - p-limit "^1.1.0" - -p-locate@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-3.0.0.tgz#322d69a05c0264b25997d9f40cd8a891ab0064a4" - integrity sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ== - dependencies: - p-limit "^2.0.0" - p-locate@^4.1.0: version "4.1.0" - resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-4.1.0.tgz#a3428bb7088b3a60292f66919278b7c297ad4f07" + resolved "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz" integrity sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A== dependencies: p-limit "^2.2.0" p-locate@^5.0.0: version "5.0.0" - resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-5.0.0.tgz#83c8315c6785005e3bd021839411c9e110e6d834" + resolved "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz" integrity sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw== dependencies: p-limit "^3.0.2" p-map@^4.0.0: version "4.0.0" - resolved "https://registry.yarnpkg.com/p-map/-/p-map-4.0.0.tgz#bb2f95a5eda2ec168ec9274e06a747c3e2904d2b" + resolved "https://registry.npmjs.org/p-map/-/p-map-4.0.0.tgz" integrity sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ== dependencies: aggregate-error "^3.0.0" -p-try@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/p-try/-/p-try-1.0.0.tgz#cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3" - integrity sha512-U1etNYuMJoIz3ZXSrrySFjsXQTWOx2/jdi86L+2pRvph/qMKL6sbcCYdH23fqsbm8TH2Gn0OybpT4eSFlCVHww== - p-try@^2.0.0: version "2.2.0" - resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" + resolved "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz" integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== parent-module@^1.0.0: version "1.0.1" - resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2" + resolved "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz" integrity sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g== dependencies: callsites "^3.0.0" -parse-json@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-4.0.0.tgz#be35f5425be1f7f6c747184f98a788cb99477ee0" - integrity sha512-aOIos8bujGN93/8Ox/jPLh7RwVnPEysynVFE+fQZyg6jKELEHwzgKdLRFHUgXJL6kylijVSBC4BvN9OmsB48Rw== - dependencies: - error-ex "^1.3.1" - json-parse-better-errors "^1.0.1" - -parse-json@^5.0.0, parse-json@^5.2.0: +parse-json@^5.2.0: version "5.2.0" - resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-5.2.0.tgz#c76fc66dee54231c962b22bcc8a72cf2f99753cd" + resolved "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz" integrity sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg== dependencies: "@babel/code-frame" "^7.0.0" @@ -5496,266 +3820,120 @@ parse-json@^5.0.0, parse-json@^5.2.0: json-parse-even-better-errors "^2.3.0" lines-and-columns "^1.1.6" -parse5@6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/parse5/-/parse5-6.0.1.tgz#e1a1c085c569b3dc08321184f19a39cc27f7c30b" - integrity sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw== - -path-exists@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" - integrity sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ== - path-exists@^4.0.0: version "4.0.0" - resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" + resolved "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz" integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w== path-is-absolute@^1.0.0: version "1.0.1" - resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" + resolved "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz" integrity sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg== path-key@^3.0.0, path-key@^3.1.0: version "3.1.1" - resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" + resolved "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz" integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== path-parse@^1.0.7: version "1.0.7" - resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" + resolved "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz" integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== -path-type@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/path-type/-/path-type-3.0.0.tgz#cef31dc8e0a1a3bb0d105c0cd97cf3bf47f4e36f" - integrity sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg== - dependencies: - pify "^3.0.0" - path-type@^4.0.0: version "4.0.0" - resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" + resolved "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz" integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw== -picocolors@^1.0.0, picocolors@^1.1.1: +picocolors@^1.1.1: version "1.1.1" - resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.1.1.tgz#3d321af3eab939b083c8f929a1d12cda81c26b6b" + resolved "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz" integrity sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA== picomatch@^2.0.4, picomatch@^2.2.3, picomatch@^2.3.1: - version "2.3.1" - resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" - integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== + version "2.3.2" + resolved "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz" + integrity sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA== pidtree@^0.5.0: version "0.5.0" - resolved "https://registry.yarnpkg.com/pidtree/-/pidtree-0.5.0.tgz#ad5fbc1de78b8a5f99d6fbdd4f6e4eee21d1aca1" + resolved "https://registry.npmjs.org/pidtree/-/pidtree-0.5.0.tgz" integrity sha512-9nxspIM7OpZuhBxPg73Zvyq7j1QMPMPsGKTqRc2XOaFQauDvoNz9fM1Wdkjmeo7l9GXOZiRs97sPkuayl39wjA== -pify@^2.3.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" - integrity sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog== - -pify@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/pify/-/pify-3.0.0.tgz#e5a4acd2c101fdf3d9a4d07f0dbc4db49dd28176" - integrity sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg== - pirates@^4.0.4: version "4.0.7" - resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.7.tgz#643b4a18c4257c8a65104b73f3049ce9a0a15e22" + resolved "https://registry.npmjs.org/pirates/-/pirates-4.0.7.tgz" integrity sha512-TfySrs/5nm8fQJDcBDuUng3VOUKsd7S+zqvbOTiGXHfxX4wK31ard+hoNuvkicM/2YFzlpDgABOevKSsB4G/FA== pkg-dir@^4.2.0: version "4.2.0" - resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-4.2.0.tgz#f099133df7ede422e81d1d8448270eeb3e4261f3" + resolved "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz" integrity sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ== dependencies: find-up "^4.0.0" possible-typed-array-names@^1.0.0: version "1.1.0" - resolved "https://registry.yarnpkg.com/possible-typed-array-names/-/possible-typed-array-names-1.1.0.tgz#93e3582bc0e5426586d9d07b79ee40fc841de4ae" + resolved "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.1.0.tgz" integrity sha512-/+5VFTchJDoVj3bhoqi6UeymcD00DAwb1nJwamzPvHEszJ4FpF6SNNbUbOS8yI56qHzdV8eK0qEfOSiodkTdxg== prelude-ls@^1.2.1: version "1.2.1" - resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" + resolved "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz" integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g== -prettier-eslint@^13.0.0: - version "13.0.0" - resolved "https://registry.yarnpkg.com/prettier-eslint/-/prettier-eslint-13.0.0.tgz#769f5c04057278d071847d893ebc7b9817594184" - integrity sha512-P5K31qWgUOQCtJL/3tpvEe28KfP49qbr6MTVEXC7I2k7ci55bP3YDr+glhyCdhIzxGCVp2f8eobfQ5so52RIIA== - dependencies: - "@typescript-eslint/parser" "^3.0.0" - common-tags "^1.4.0" - dlv "^1.1.0" - eslint "^7.9.0" - indent-string "^4.0.0" - lodash.merge "^4.6.0" - loglevel-colored-level-prefix "^1.0.0" - prettier "^2.0.0" - pretty-format "^23.0.1" - require-relative "^0.8.7" - typescript "^3.9.3" - vue-eslint-parser "~7.1.0" - prettier-linter-helpers@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz#d23d41fe1375646de2d0104d3454a3008802cf7b" - integrity sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w== + version "1.0.1" + resolved "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.1.tgz" + integrity sha512-SxToR7P8Y2lWmv/kTzVLC1t/GDI2WGjMwNhLLE9qtH8Q13C+aEmuRlzDst4Up4s0Wc8sF2M+J57iB3cMLqftfg== dependencies: fast-diff "^1.1.2" -prettier@^2.0.0, prettier@^2.6.0: +prettier@^2.6.0: version "2.8.8" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.8.tgz#e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da" + resolved "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz" integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q== -pretty-format@^23.0.1: - version "23.6.0" - resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-23.6.0.tgz#5eaac8eeb6b33b987b7fe6097ea6a8a146ab5760" - integrity sha512-zf9NV1NSlDLDjycnwm6hpFATCGl/K1lt0R/GdkAK2O5LN/rwJoB+Mh93gGJjut4YbmecbfgLWVGSTCr0Ewvvbw== - dependencies: - ansi-regex "^3.0.0" - ansi-styles "^3.2.0" - -pretty-format@^27.0.0, pretty-format@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-27.5.1.tgz#2181879fdea51a7a5851fb39d920faa63f01d88e" - integrity sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ== +pretty-format@^29.7.0: + version "29.7.0" + resolved "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz" + integrity sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ== dependencies: - ansi-regex "^5.0.1" + "@jest/schemas" "^29.6.3" ansi-styles "^5.0.0" - react-is "^17.0.1" - -process-nextick-args@~2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" - integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag== - -progress@^2.0.0: - version "2.0.3" - resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8" - integrity sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA== + react-is "^18.0.0" prompts@^2.0.1: version "2.4.2" - resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.4.2.tgz#7b57e73b3a48029ad10ebd44f74b01722a4cb069" + resolved "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz" integrity sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q== dependencies: kleur "^3.0.3" sisteransi "^1.0.5" -psl@^1.1.33: - version "1.15.0" - resolved "https://registry.yarnpkg.com/psl/-/psl-1.15.0.tgz#bdace31896f1d97cec6a79e8224898ce93d974c6" - integrity sha512-JZd3gMVBAVQkSs6HdNZo9Sdo0LNcQeMNP3CozBJb3JYC/QUYZTnKxP+f8oWRX4rHP5EurWxqAHTSwUCjlNKa1w== - dependencies: - punycode "^2.3.1" - -punycode@^2.1.0, punycode@^2.1.1, punycode@^2.3.1: +punycode@^2.1.0: version "2.3.1" - resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.1.tgz#027422e2faec0b25e1549c3e1bd8309b9133b6e5" + resolved "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz" integrity sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg== -q@^1.5.1: - version "1.5.1" - resolved "https://registry.yarnpkg.com/q/-/q-1.5.1.tgz#7e32f75b41381291d04611f1bf14109ac00651d7" - integrity sha512-kV/CThkXo6xyFEZUugw/+pIOywXcDbFYgSct5cT3gqlbkBE1SJdwy6UQoZvodiWF/ckQLZyDE/Bu1M6gVu5lVw== - -querystringify@^2.1.1: - version "2.2.0" - resolved "https://registry.yarnpkg.com/querystringify/-/querystringify-2.2.0.tgz#3345941b4153cb9d082d8eee4cda2016a9aef7f6" - integrity sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ== +pure-rand@^6.0.0: + version "6.1.0" + resolved "https://registry.npmjs.org/pure-rand/-/pure-rand-6.1.0.tgz" + integrity sha512-bVWawvoZoBYpp6yIoQtQXHZjmz35RSVHnUOTefl8Vcjr8snTPY1wnpSPMWekcFwbxI6gtmT7rSYPFvz71ldiOA== queue-microtask@^1.2.2: version "1.2.3" - resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243" + resolved "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz" integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A== -quick-lru@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/quick-lru/-/quick-lru-4.0.1.tgz#5b8878f113a58217848c6482026c73e1ba57727f" - integrity sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g== - -react-is@^17.0.1: - version "17.0.2" - resolved "https://registry.yarnpkg.com/react-is/-/react-is-17.0.2.tgz#e691d4a8e9c789365655539ab372762b0efb54f0" - integrity sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w== - -read-pkg-up@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-3.0.0.tgz#3ed496685dba0f8fe118d0691dc51f4a1ff96f07" - integrity sha512-YFzFrVvpC6frF1sz8psoHDBGF7fLPc+llq/8NB43oagqWkx8ar5zYtsTORtOjw9W2RHLpWP+zTWwBvf1bCmcSw== - dependencies: - find-up "^2.0.0" - read-pkg "^3.0.0" - -read-pkg-up@^7.0.1: - version "7.0.1" - resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-7.0.1.tgz#f3a6135758459733ae2b95638056e1854e7ef507" - integrity sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg== - dependencies: - find-up "^4.1.0" - read-pkg "^5.2.0" - type-fest "^0.8.1" - -read-pkg@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-3.0.0.tgz#9cbc686978fee65d16c00e2b19c237fcf6e38389" - integrity sha512-BLq/cCO9two+lBgiTYNqD6GdtK8s4NpaWrl6/rCO9w0TUS8oJl7cmToOZfRYllKTISY6nt1U7jQ53brmKqY6BA== - dependencies: - load-json-file "^4.0.0" - normalize-package-data "^2.3.2" - path-type "^3.0.0" - -read-pkg@^5.2.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-5.2.0.tgz#7bf295438ca5a33e56cd30e053b34ee7250c93cc" - integrity sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg== - dependencies: - "@types/normalize-package-data" "^2.4.0" - normalize-package-data "^2.5.0" - parse-json "^5.0.0" - type-fest "^0.6.0" - -readable-stream@3, readable-stream@^3.0.0, readable-stream@^3.0.2: - version "3.6.2" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.2.tgz#56a9b36ea965c00c5a93ef31eb111a0f11056967" - integrity sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA== - dependencies: - inherits "^2.0.3" - string_decoder "^1.1.1" - util-deprecate "^1.0.1" - -readable-stream@~2.3.6: - version "2.3.8" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.8.tgz#91125e8042bba1b9887f49345f6277027ce8be9b" - integrity sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA== - dependencies: - core-util-is "~1.0.0" - inherits "~2.0.3" - isarray "~1.0.0" - process-nextick-args "~2.0.0" - safe-buffer "~5.1.1" - string_decoder "~1.1.1" - util-deprecate "~1.0.1" - -redent@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/redent/-/redent-3.0.0.tgz#e557b7998316bb53c9f1f56fa626352c6963059f" - integrity sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg== - dependencies: - indent-string "^4.0.0" - strip-indent "^3.0.0" +react-is@^18.0.0: + version "18.3.1" + resolved "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz" + integrity sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg== reflect.getprototypeof@^1.0.6, reflect.getprototypeof@^1.0.9: version "1.0.10" - resolved "https://registry.yarnpkg.com/reflect.getprototypeof/-/reflect.getprototypeof-1.0.10.tgz#c629219e78a3316d8b604c765ef68996964e7bf9" + resolved "https://registry.npmjs.org/reflect.getprototypeof/-/reflect.getprototypeof-1.0.10.tgz" integrity sha512-00o4I+DVrefhv+nX0ulyi3biSHCPDe+yLv5o/p6d/UVlirijB8E16FtfwSAi4g3tcqrQ4lRAqQSoFEZJehYEcw== dependencies: call-bind "^1.0.8" @@ -5767,21 +3945,21 @@ reflect.getprototypeof@^1.0.6, reflect.getprototypeof@^1.0.9: get-proto "^1.0.1" which-builtin-type "^1.2.1" -regenerate-unicode-properties@^10.2.0: - version "10.2.0" - resolved "https://registry.yarnpkg.com/regenerate-unicode-properties/-/regenerate-unicode-properties-10.2.0.tgz#626e39df8c372338ea9b8028d1f99dc3fd9c3db0" - integrity sha512-DqHn3DwbmmPVzeKj9woBadqmXxLvQoQIwu7nopMc72ztvxVmVk2SBhSnx67zuye5TP+lJsb/TBQsjLKhnDf3MA== +regenerate-unicode-properties@^10.2.2: + version "10.2.2" + resolved "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-10.2.2.tgz" + integrity sha512-m03P+zhBeQd1RGnYxrGyDAPpWX/epKirLrp8e3qevZdVkKtnCrjjWczIbYc8+xd6vcTStVlqfycTx1KR4LOr0g== dependencies: regenerate "^1.4.2" regenerate@^1.4.2: version "1.4.2" - resolved "https://registry.yarnpkg.com/regenerate/-/regenerate-1.4.2.tgz#b9346d8827e8f5a32f7ba29637d398b69014848a" + resolved "https://registry.npmjs.org/regenerate/-/regenerate-1.4.2.tgz" integrity sha512-zrceR/XhGYU/d/opr2EKO7aRHUeiBI8qjtfHqADTwZd6Szfy16la6kqD0MIUs5z5hx6AaKa+PixpPrR289+I0A== regexp.prototype.flags@^1.5.4: version "1.5.4" - resolved "https://registry.yarnpkg.com/regexp.prototype.flags/-/regexp.prototype.flags-1.5.4.tgz#1ad6c62d44a259007e55b3970e00f746efbcaa19" + resolved "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.4.tgz" integrity sha512-dYqgNSZbDwkaJ2ceRd9ojCGjBq+mOm9LmtXnAnEGyHhN/5R7iDW2TRw3h+o/jCFxus3P2LfWIIiwowAjANm7IA== dependencies: call-bind "^1.0.8" @@ -5791,89 +3969,69 @@ regexp.prototype.flags@^1.5.4: gopd "^1.2.0" set-function-name "^2.0.2" -regexpp@^3.1.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-3.2.0.tgz#0425a2768d8f23bad70ca4b90461fa2f1213e1b2" - integrity sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg== - -regexpu-core@^6.2.0: - version "6.2.0" - resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-6.2.0.tgz#0e5190d79e542bf294955dccabae04d3c7d53826" - integrity sha512-H66BPQMrv+V16t8xtmq+UC0CBpiTBA60V8ibS1QVReIp8T1z8hwFxqcGzm9K6lgsN7sB5edVH8a+ze6Fqm4weA== +regexpu-core@^6.3.1: + version "6.4.0" + resolved "https://registry.npmjs.org/regexpu-core/-/regexpu-core-6.4.0.tgz" + integrity sha512-0ghuzq67LI9bLXpOX/ISfve/Mq33a4aFRzoQYhnnok1JOFpmE/A2TBGkNVenOGEeSBCjIiWcc6MVOG5HEQv0sA== dependencies: regenerate "^1.4.2" - regenerate-unicode-properties "^10.2.0" + regenerate-unicode-properties "^10.2.2" regjsgen "^0.8.0" - regjsparser "^0.12.0" + regjsparser "^0.13.0" unicode-match-property-ecmascript "^2.0.0" - unicode-match-property-value-ecmascript "^2.1.0" + unicode-match-property-value-ecmascript "^2.2.1" regjsgen@^0.8.0: version "0.8.0" - resolved "https://registry.yarnpkg.com/regjsgen/-/regjsgen-0.8.0.tgz#df23ff26e0c5b300a6470cad160a9d090c3a37ab" + resolved "https://registry.npmjs.org/regjsgen/-/regjsgen-0.8.0.tgz" integrity sha512-RvwtGe3d7LvWiDQXeQw8p5asZUmfU1G/l6WbUXeHta7Y2PEIvBTwH6E2EfmYUK8pxcxEdEmaomqyp0vZZ7C+3Q== -regjsparser@^0.12.0: - version "0.12.0" - resolved "https://registry.yarnpkg.com/regjsparser/-/regjsparser-0.12.0.tgz#0e846df6c6530586429377de56e0475583b088dc" - integrity sha512-cnE+y8bz4NhMjISKbgeVJtqNbtf5QpjZP+Bslo+UqkIt9QPnX9q095eiRRASJG1/tz6dlNr6Z5NsBiWYokp6EQ== +regjsparser@^0.13.0: + version "0.13.0" + resolved "https://registry.npmjs.org/regjsparser/-/regjsparser-0.13.0.tgz" + integrity sha512-NZQZdC5wOE/H3UT28fVGL+ikOZcEzfMGk/c3iN9UGxzWHMa1op7274oyiUVrAG4B2EuFhus8SvkaYnhvW92p9Q== dependencies: - jsesc "~3.0.2" + jsesc "~3.1.0" require-directory@^2.1.1: version "2.1.1" - resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" + resolved "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz" integrity sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q== -require-from-string@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-2.0.2.tgz#89a7fdd938261267318eafe14f9c32e598c36909" - integrity sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw== - -require-relative@^0.8.7: - version "0.8.7" - resolved "https://registry.yarnpkg.com/require-relative/-/require-relative-0.8.7.tgz#7999539fc9e047a37928fa196f8e1563dabd36de" - integrity sha512-AKGr4qvHiryxRb19m3PsLRGuKVAbJLUD7E6eOaHkfKhwc+vSgVOCY5xNvm9EkolBKTOf0GrQAZKLimOCz81Khg== - -requires-port@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff" - integrity sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ== - resolve-cwd@^3.0.0: version "3.0.0" - resolved "https://registry.yarnpkg.com/resolve-cwd/-/resolve-cwd-3.0.0.tgz#0f0075f1bb2544766cf73ba6a6e2adfebcb13f2d" + resolved "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz" integrity sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg== dependencies: resolve-from "^5.0.0" resolve-from@^4.0.0: version "4.0.0" - resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6" + resolved "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz" integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g== resolve-from@^5.0.0: version "5.0.0" - resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-5.0.0.tgz#c35225843df8f776df21c57557bc087e9dfdfc69" + resolved "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz" integrity sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw== -resolve.exports@^1.1.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/resolve.exports/-/resolve.exports-1.1.1.tgz#05cfd5b3edf641571fd46fa608b610dda9ead999" - integrity sha512-/NtpHNDN7jWhAaQ9BvBUYZ6YTXsRBgfqWFWP7BZBaoMJO/I3G5OFzvTuWNlZC3aPjins1F+TNrLKsGbH4rfsRQ== +resolve.exports@^2.0.0: + version "2.0.3" + resolved "https://registry.npmjs.org/resolve.exports/-/resolve.exports-2.0.3.tgz" + integrity sha512-OcXjMsGdhL4XnbShKpAcSqPMzQoYkYyhbEaeSko47MjRP9NfEQMhZkXL1DoFlt9LWQn4YttrdnV6X2OiyzBi+A== -resolve@^1.10.0, resolve@^1.20.0, resolve@^1.22.10, resolve@^1.22.4: - version "1.22.10" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.10.tgz#b663e83ffb09bbf2386944736baae803029b8b39" - integrity sha512-NPRy+/ncIMeDlTAsuqwKIiferiawhefFJtkNSW0qZJEqMEb+qBt/77B/jGeeek+F0uOeN05CDa6HXbbIgtVX4w== +resolve@^1.20.0, resolve@^1.22.10, resolve@^1.22.4: + version "1.22.11" + resolved "https://registry.npmjs.org/resolve/-/resolve-1.22.11.tgz" + integrity sha512-RfqAvLnMl313r7c9oclB1HhUEAezcpLjz95wFH4LVuhk9JF/r22qmVP9AMmOU4vMX7Q8pN8jwNg/CSpdFnMjTQ== dependencies: - is-core-module "^2.16.0" + is-core-module "^2.16.1" path-parse "^1.0.7" supports-preserve-symlinks-flag "^1.0.0" restore-cursor@^3.1.0: version "3.1.0" - resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-3.1.0.tgz#39f67c54b3a7a58cea5236d95cf0034239631f7e" + resolved "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz" integrity sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA== dependencies: onetime "^5.1.0" @@ -5881,38 +4039,38 @@ restore-cursor@^3.1.0: reusify@^1.0.4: version "1.1.0" - resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.1.0.tgz#0fe13b9522e1473f51b558ee796e08f11f9b489f" + resolved "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz" integrity sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw== rfdc@^1.3.0: version "1.4.1" - resolved "https://registry.yarnpkg.com/rfdc/-/rfdc-1.4.1.tgz#778f76c4fb731d93414e8f925fbecf64cce7f6ca" + resolved "https://registry.npmjs.org/rfdc/-/rfdc-1.4.1.tgz" integrity sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA== -rimraf@^3.0.0, rimraf@^3.0.2: +rimraf@^3.0.2: version "3.0.2" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a" + resolved "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz" integrity sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA== dependencies: glob "^7.1.3" run-parallel@^1.1.9: version "1.2.0" - resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.2.0.tgz#66d1368da7bdf921eb9d95bd1a9229e7f21a43ee" + resolved "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz" integrity sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA== dependencies: queue-microtask "^1.2.2" -rxjs@^7.5.5, rxjs@^7.8.1: +rxjs@^7.5.5: version "7.8.2" - resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.8.2.tgz#955bc473ed8af11a002a2be52071bf475638607b" + resolved "https://registry.npmjs.org/rxjs/-/rxjs-7.8.2.tgz" integrity sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA== dependencies: tslib "^2.1.0" safe-array-concat@^1.1.3: version "1.1.3" - resolved "https://registry.yarnpkg.com/safe-array-concat/-/safe-array-concat-1.1.3.tgz#c9e54ec4f603b0bbb8e7e5007a5ee7aecd1538c3" + resolved "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.1.3.tgz" integrity sha512-AURm5f0jYEOydBj7VQlVvDrjeFgthDdEF5H1dP+6mNpoXOMo1quQqJ4wvJDyRZ9+pO3kGWoOdmV08cSv2aJV6Q== dependencies: call-bind "^1.0.8" @@ -5921,19 +4079,9 @@ safe-array-concat@^1.1.3: has-symbols "^1.1.0" isarray "^2.0.5" -safe-buffer@~5.1.0, safe-buffer@~5.1.1: - version "5.1.2" - resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" - integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== - -safe-buffer@~5.2.0: - version "5.2.1" - resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" - integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== - safe-push-apply@^1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/safe-push-apply/-/safe-push-apply-1.0.0.tgz#01850e981c1602d398c85081f360e4e6d03d27f5" + resolved "https://registry.npmjs.org/safe-push-apply/-/safe-push-apply-1.0.0.tgz" integrity sha512-iKE9w/Z7xCzUMIZqdBsp6pEQvwuEebH4vdpjcDWnyzaI6yl6O9FHvVpmGelvEHNsoY6wGblkxR6Zty/h00WiSA== dependencies: es-errors "^1.3.0" @@ -5941,48 +4089,26 @@ safe-push-apply@^1.0.0: safe-regex-test@^1.1.0: version "1.1.0" - resolved "https://registry.yarnpkg.com/safe-regex-test/-/safe-regex-test-1.1.0.tgz#7f87dfb67a3150782eaaf18583ff5d1711ac10c1" + resolved "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.1.0.tgz" integrity sha512-x/+Cz4YrimQxQccJf5mKEbIa1NzeCRNI5Ecl/ekmlYaampdNLPalVyIcCZNNH3MvmqBugV5TMYZXv0ljslUlaw== dependencies: call-bound "^1.0.2" es-errors "^1.3.0" is-regex "^1.2.1" -"safer-buffer@>= 2.1.2 < 3": - version "2.1.2" - resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" - integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== - -saxes@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/saxes/-/saxes-5.0.1.tgz#eebab953fa3b7608dbe94e5dadb15c888fa6696d" - integrity sha512-5LBh1Tls8c9xgGjw3QrMwETmTMVk0oFgvrFSvWx62llR2hcEInrKNZ2GZCCuuy2lvWrdl5jhbpeqc5hRYKFOcw== - dependencies: - xmlchars "^2.2.0" - -scrypt-js@3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/scrypt-js/-/scrypt-js-3.0.1.tgz#d314a57c2aef69d1ad98a138a21fe9eafa9ee312" - integrity sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA== - -"semver@2 || 3 || 4 || 5": - version "5.7.2" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.2.tgz#48d55db737c3287cd4835e17fa13feace1c41ef8" - integrity sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g== - -semver@7.x, semver@^7.1.1, semver@^7.2.1, semver@^7.3.2, semver@^7.3.4, semver@^7.3.5, semver@^7.3.7, semver@^7.5.3: - version "7.7.2" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.7.2.tgz#67d99fdcd35cec21e6f8b87a7fd515a33f982b58" - integrity sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA== - -semver@^6.0.0, semver@^6.3.0, semver@^6.3.1: +semver@^6.3.0, semver@^6.3.1: version "6.3.1" - resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" + resolved "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz" integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== +semver@^7.5.3, semver@^7.5.4, semver@^7.6.0, semver@^7.7.3: + version "7.7.3" + resolved "https://registry.npmjs.org/semver/-/semver-7.7.3.tgz" + integrity sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q== + set-function-length@^1.2.2: version "1.2.2" - resolved "https://registry.yarnpkg.com/set-function-length/-/set-function-length-1.2.2.tgz#aac72314198eaed975cf77b2c3b6b880695e5449" + resolved "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz" integrity sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg== dependencies: define-data-property "^1.1.4" @@ -5994,7 +4120,7 @@ set-function-length@^1.2.2: set-function-name@^2.0.2: version "2.0.2" - resolved "https://registry.yarnpkg.com/set-function-name/-/set-function-name-2.0.2.tgz#16a705c5a0dc2f5e638ca96d8a8cd4e1c2b90985" + resolved "https://registry.npmjs.org/set-function-name/-/set-function-name-2.0.2.tgz" integrity sha512-7PGFlmtwsEADb0WYyvCMa1t+yke6daIG4Wirafur5kcf+MhUnPms1UeR0CKQdTZD81yESwMHbtn+TR+dMviakQ== dependencies: define-data-property "^1.1.4" @@ -6004,7 +4130,7 @@ set-function-name@^2.0.2: set-proto@^1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/set-proto/-/set-proto-1.0.0.tgz#0760dbcff30b2d7e801fd6e19983e56da337565e" + resolved "https://registry.npmjs.org/set-proto/-/set-proto-1.0.0.tgz" integrity sha512-RJRdvCo6IAnPdsvP/7m6bsQqNnn1FCBX5ZNtFL98MmFF/4xAIJTIg1YbHW5DC2W5SKZanrC6i4HsJqlajw/dZw== dependencies: dunder-proto "^1.0.1" @@ -6013,19 +4139,19 @@ set-proto@^1.0.0: shebang-command@^2.0.0: version "2.0.0" - resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" + resolved "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz" integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA== dependencies: shebang-regex "^3.0.0" shebang-regex@^3.0.0: version "3.0.0" - resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" + resolved "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz" integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== side-channel-list@^1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/side-channel-list/-/side-channel-list-1.0.0.tgz#10cb5984263115d3b7a0e336591e290a830af8ad" + resolved "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz" integrity sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA== dependencies: es-errors "^1.3.0" @@ -6033,7 +4159,7 @@ side-channel-list@^1.0.0: side-channel-map@^1.0.1: version "1.0.1" - resolved "https://registry.yarnpkg.com/side-channel-map/-/side-channel-map-1.0.1.tgz#d6bb6b37902c6fef5174e5f533fab4c732a26f42" + resolved "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz" integrity sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA== dependencies: call-bound "^1.0.2" @@ -6043,7 +4169,7 @@ side-channel-map@^1.0.1: side-channel-weakmap@^1.0.2: version "1.0.2" - resolved "https://registry.yarnpkg.com/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz#11dda19d5368e40ce9ec2bdc1fb0ecbc0790ecea" + resolved "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz" integrity sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A== dependencies: call-bound "^1.0.2" @@ -6054,7 +4180,7 @@ side-channel-weakmap@^1.0.2: side-channel@^1.1.0: version "1.1.0" - resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.1.0.tgz#c3fcff9c4da932784873335ec9765fa94ff66bc9" + resolved "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz" integrity sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw== dependencies: es-errors "^1.3.0" @@ -6063,24 +4189,24 @@ side-channel@^1.1.0: side-channel-map "^1.0.1" side-channel-weakmap "^1.0.2" -signal-exit@^3.0.2, signal-exit@^3.0.3: +signal-exit@^3.0.2, signal-exit@^3.0.3, signal-exit@^3.0.7: version "3.0.7" - resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" + resolved "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz" integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== sisteransi@^1.0.5: version "1.0.5" - resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-1.0.5.tgz#134d681297756437cc05ca01370d3a7a571075ed" + resolved "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz" integrity sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg== slash@^3.0.0: version "3.0.0" - resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" + resolved "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz" integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== slice-ansi@^3.0.0: version "3.0.0" - resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-3.0.0.tgz#31ddc10930a1b7e0b67b08c96c2f49b77a789787" + resolved "https://registry.npmjs.org/slice-ansi/-/slice-ansi-3.0.0.tgz" integrity sha512-pSyv7bSTC7ig9Dcgbw9AuRNUb5k5V6oDudjZoMBSr13qpLBG7tB+zgCkARjq7xIUgdz5P1Qe8u+rSGdouOOIyQ== dependencies: ansi-styles "^4.0.0" @@ -6089,7 +4215,7 @@ slice-ansi@^3.0.0: slice-ansi@^4.0.0: version "4.0.0" - resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-4.0.0.tgz#500e8dd0fd55b05815086255b3195adf2a45fe6b" + resolved "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz" integrity sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ== dependencies: ansi-styles "^4.0.0" @@ -6098,105 +4224,40 @@ slice-ansi@^4.0.0: slice-ansi@^5.0.0: version "5.0.0" - resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-5.0.0.tgz#b73063c57aa96f9cd881654b15294d95d285c42a" + resolved "https://registry.npmjs.org/slice-ansi/-/slice-ansi-5.0.0.tgz" integrity sha512-FC+lgizVPfie0kkhqUScwRu1O/lF6NOgJmlCgK+/LYxDCTk8sGelYaHDhFcDN+Sn3Cv+3VSa4Byeo+IMCzpMgQ== dependencies: ansi-styles "^6.0.0" is-fullwidth-code-point "^4.0.0" -source-map-support@^0.5.6: - version "0.5.21" - resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.21.tgz#04fe7c7f9e1ed2d662233c28cb2b35b9f63f6e4f" - integrity sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w== +source-map-support@0.5.13: + version "0.5.13" + resolved "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.13.tgz" + integrity sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w== dependencies: buffer-from "^1.0.0" source-map "^0.6.0" -source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.1: +source-map@^0.6.0, source-map@^0.6.1: version "0.6.1" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" + resolved "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz" integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== -source-map@^0.7.3: - version "0.7.6" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.6.tgz#a3658ab87e5b6429c8a1f3ba0083d4c61ca3ef02" - integrity sha512-i5uvt8C3ikiWeNZSVZNWcfZPItFQOsYTUAOkcUPGd8DqDy1uOUikjt5dG+uRlwyvR108Fb9DOd4GvXfT0N2/uQ== - -spdx-correct@^3.0.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.2.0.tgz#4f5ab0668f0059e34f9c00dce331784a12de4e9c" - integrity sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA== - dependencies: - spdx-expression-parse "^3.0.0" - spdx-license-ids "^3.0.0" - -spdx-exceptions@^2.1.0: - version "2.5.0" - resolved "https://registry.yarnpkg.com/spdx-exceptions/-/spdx-exceptions-2.5.0.tgz#5d607d27fc806f66d7b64a766650fa890f04ed66" - integrity sha512-PiU42r+xO4UbUS1buo3LPJkjlO7430Xn5SVAhdpzzsPHsjbYVflnnFdATgabnLude+Cqu25p6N+g2lw/PFsa4w== - -spdx-expression-parse@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz#cf70f50482eefdc98e3ce0a6833e4a53ceeba679" - integrity sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q== - dependencies: - spdx-exceptions "^2.1.0" - spdx-license-ids "^3.0.0" - -spdx-license-ids@^3.0.0: - version "3.0.21" - resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.21.tgz#6d6e980c9df2b6fc905343a3b2d702a6239536c3" - integrity sha512-Bvg/8F5XephndSK3JffaRqdT+gyhfqIPwDHpX80tJrF8QQRYMo8sNMeaZ2Dp5+jhwKnUmIOyFFQfHRkjJm5nXg== - -split2@^3.0.0: - version "3.2.2" - resolved "https://registry.yarnpkg.com/split2/-/split2-3.2.2.tgz#bf2cf2a37d838312c249c89206fd7a17dd12365f" - integrity sha512-9NThjpgZnifTkJpzTZ7Eue85S49QwpNhZTq6GRJwObb6jnLFNGB7Qm73V5HewTROPyxD0C29xqmaI68bQtV+hg== - dependencies: - readable-stream "^3.0.0" - -split@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/split/-/split-1.0.1.tgz#605bd9be303aa59fb35f9229fbea0ddec9ea07d9" - integrity sha512-mTyOoPbrivtXnwnIxZRFYRrPNtEFKlpB2fvjSnCQUiAA6qAZzqwna5envK4uk6OIeP17CsdF3rSBGYVBsU0Tkg== - dependencies: - through "2" - sprintf-js@~1.0.2: version "1.0.3" - resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" + resolved "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz" integrity sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g== stack-utils@^2.0.3: version "2.0.6" - resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-2.0.6.tgz#aaf0748169c02fc33c8232abccf933f54a1cc34f" + resolved "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz" integrity sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ== dependencies: escape-string-regexp "^2.0.0" -standard-version@^9.3.2: - version "9.5.0" - resolved "https://registry.yarnpkg.com/standard-version/-/standard-version-9.5.0.tgz#851d6dcddf5320d5079601832aeb185dbf497949" - integrity sha512-3zWJ/mmZQsOaO+fOlsa0+QK90pwhNd042qEcw6hKFNoLFs7peGyvPffpEBbK/DSGPbyOvli0mUIFv5A4qTjh2Q== - dependencies: - chalk "^2.4.2" - conventional-changelog "3.1.25" - conventional-changelog-config-spec "2.1.0" - conventional-changelog-conventionalcommits "4.6.3" - conventional-recommended-bump "6.1.0" - detect-indent "^6.0.0" - detect-newline "^3.1.0" - dotgitignore "^2.1.0" - figures "^3.1.0" - find-up "^5.0.0" - git-semver-tags "^4.0.0" - semver "^7.1.1" - stringify-package "^1.0.1" - yargs "^16.0.0" - stop-iteration-iterator@^1.1.0: version "1.1.0" - resolved "https://registry.yarnpkg.com/stop-iteration-iterator/-/stop-iteration-iterator-1.1.0.tgz#f481ff70a548f6124d0312c3aa14cbfa7aa542ad" + resolved "https://registry.npmjs.org/stop-iteration-iterator/-/stop-iteration-iterator-1.1.0.tgz" integrity sha512-eLoXW/DHyl62zxY4SCaIgnRhuMr6ri4juEYARS8E6sCEqzKpOiE521Ucofdx+KnDZl5xmvGYaaKCk5FEOxJCoQ== dependencies: es-errors "^1.3.0" @@ -6204,12 +4265,12 @@ stop-iteration-iterator@^1.1.0: string-argv@^0.3.1: version "0.3.2" - resolved "https://registry.yarnpkg.com/string-argv/-/string-argv-0.3.2.tgz#2b6d0ef24b656274d957d54e0a4bbf6153dc02b6" + resolved "https://registry.npmjs.org/string-argv/-/string-argv-0.3.2.tgz" integrity sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q== string-length@^4.0.1: version "4.0.2" - resolved "https://registry.yarnpkg.com/string-length/-/string-length-4.0.2.tgz#a8a8dc7bd5c1a82b9b3c8b87e125f66871b6e57a" + resolved "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz" integrity sha512-+l6rNN5fYHNhZZy41RXsYptCjA2Igmq4EG7kZAYFQI1E1VTXarr6ZPXBg6eq7Y6eK4FEhY6AJlyuFIb/v/S0VQ== dependencies: char-regex "^1.0.2" @@ -6217,7 +4278,7 @@ string-length@^4.0.1: string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: version "4.2.3" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== dependencies: emoji-regex "^8.0.0" @@ -6226,7 +4287,7 @@ string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: string-width@^5.0.0: version "5.1.2" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-5.1.2.tgz#14f8daec6d81e7221d2a357e668cab73bdbca794" + resolved "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz" integrity sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA== dependencies: eastasianwidth "^0.2.0" @@ -6235,7 +4296,7 @@ string-width@^5.0.0: string.prototype.trim@^1.2.10: version "1.2.10" - resolved "https://registry.yarnpkg.com/string.prototype.trim/-/string.prototype.trim-1.2.10.tgz#40b2dd5ee94c959b4dcfb1d65ce72e90da480c81" + resolved "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.10.tgz" integrity sha512-Rs66F0P/1kedk5lyYyH9uBzuiI/kNRmwJAR9quK6VOtIpZ2G+hMZd+HQbbv25MgCA6gEffoMZYxlTod4WcdrKA== dependencies: call-bind "^1.0.8" @@ -6248,7 +4309,7 @@ string.prototype.trim@^1.2.10: string.prototype.trimend@^1.0.9: version "1.0.9" - resolved "https://registry.yarnpkg.com/string.prototype.trimend/-/string.prototype.trimend-1.0.9.tgz#62e2731272cd285041b36596054e9f66569b6942" + resolved "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.9.tgz" integrity sha512-G7Ok5C6E/j4SGfyLCloXTrngQIQU3PWtXGst3yM7Bea9FRURf1S42ZHlZZtsNque2FN2PoUhfZXYLNWwEr4dLQ== dependencies: call-bind "^1.0.8" @@ -6258,267 +4319,130 @@ string.prototype.trimend@^1.0.9: string.prototype.trimstart@^1.0.8: version "1.0.8" - resolved "https://registry.yarnpkg.com/string.prototype.trimstart/-/string.prototype.trimstart-1.0.8.tgz#7ee834dda8c7c17eff3118472bb35bfedaa34dde" + resolved "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.8.tgz" integrity sha512-UXSH262CSZY1tfu3G3Secr6uGLCFVPMhIqHjlgCUtCCcgihYc/xKs9djMTMUOb2j1mVSeU8EU6NWc/iQKU6Gfg== dependencies: call-bind "^1.0.7" define-properties "^1.2.1" es-object-atoms "^1.0.0" -string_decoder@^1.1.1: - version "1.3.0" - resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" - integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== - dependencies: - safe-buffer "~5.2.0" - -string_decoder@~1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" - integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg== - dependencies: - safe-buffer "~5.1.0" - -stringify-package@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/stringify-package/-/stringify-package-1.0.1.tgz#e5aa3643e7f74d0f28628b72f3dad5cecfc3ba85" - integrity sha512-sa4DUQsYciMP1xhKWGuFM04fB0LG/9DlluZoSVywUMRNvzid6XucHK0/90xGxRoHrAaROrcHK1aPKaijCtSrhg== - -strip-ansi@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" - integrity sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg== - dependencies: - ansi-regex "^2.0.0" - strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== dependencies: ansi-regex "^5.0.1" strip-ansi@^7.0.1: - version "7.1.0" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45" - integrity sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ== + version "7.1.2" + resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.2.tgz" + integrity sha512-gmBGslpoQJtgnMAvOVqGZpEz9dyoKTCzy2nfz/n8aIFhN/jCE/rCmcxabB6jOOHV+0WNnylOxaxBQPSvcWklhA== dependencies: ansi-regex "^6.0.1" strip-bom@^3.0.0: version "3.0.0" - resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" + resolved "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz" integrity sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA== strip-bom@^4.0.0: version "4.0.0" - resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-4.0.0.tgz#9c3505c1db45bcedca3d9cf7a16f5c5aa3901878" + resolved "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz" integrity sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w== strip-final-newline@^2.0.0: version "2.0.0" - resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad" + resolved "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz" integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA== -strip-indent@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/strip-indent/-/strip-indent-3.0.0.tgz#c32e1cee940b6b3432c771bc2c54bcce73cd3001" - integrity sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ== - dependencies: - min-indent "^1.0.0" - -strip-json-comments@^3.1.0, strip-json-comments@^3.1.1: +strip-json-comments@^3.1.1: version "3.1.1" - resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" + resolved "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz" integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== -supports-color@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" - integrity sha512-KKNVtd6pCYgPIKU4cp2733HWYCpplQhddZLBUryaAHou723x+FRzQ5Df824Fj+IyyuiQTRoub4SnIFfIcrp70g== - -supports-color@^5.3.0: - version "5.5.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" - integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== - dependencies: - has-flag "^3.0.0" - -supports-color@^7.0.0, supports-color@^7.1.0: +supports-color@^7.1.0: version "7.2.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" + resolved "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz" integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== dependencies: has-flag "^4.0.0" supports-color@^8.0.0: version "8.1.1" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz#cd6fc17e28500cff56c1b86c0a7fd4a54a73005c" + resolved "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz" integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q== dependencies: has-flag "^4.0.0" supports-color@^9.2.2: version "9.4.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-9.4.0.tgz#17bfcf686288f531db3dea3215510621ccb55954" + resolved "https://registry.npmjs.org/supports-color/-/supports-color-9.4.0.tgz" integrity sha512-VL+lNrEoIXww1coLPOmiEmK/0sGigko5COxI09KzHc2VJXJsQ37UaQ+8quuxjDeA7+KnLGTWRyOXSLLR2Wb4jw== -supports-hyperlinks@^2.0.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/supports-hyperlinks/-/supports-hyperlinks-2.3.0.tgz#3943544347c1ff90b15effb03fc14ae45ec10624" - integrity sha512-RpsAZlpWcDwOPQA22aCH4J0t7L8JmAvsCxfOSEwm7cQs3LshN36QaTkwd70DnBOXDWGssw2eUoc8CaRWT0XunA== - dependencies: - has-flag "^4.0.0" - supports-color "^7.0.0" - supports-preserve-symlinks-flag@^1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" + resolved "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz" integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== -symbol-tree@^3.2.4: - version "3.2.4" - resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2" - integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw== - -table@^6.0.9: - version "6.9.0" - resolved "https://registry.yarnpkg.com/table/-/table-6.9.0.tgz#50040afa6264141c7566b3b81d4d82c47a8668f5" - integrity sha512-9kY+CygyYM6j02t5YFHbNz2FN5QmYGv9zAjVp4lCDjlCw7amdckXlEt/bjMhUIfj4ThGRE4gCUH5+yGnNuPo5A== - dependencies: - ajv "^8.0.1" - lodash.truncate "^4.4.2" - slice-ansi "^4.0.0" - string-width "^4.2.3" - strip-ansi "^6.0.1" - -terminal-link@^2.0.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/terminal-link/-/terminal-link-2.1.1.tgz#14a64a27ab3c0df933ea546fba55f2d078edc994" - integrity sha512-un0FmiRUQNr5PJqy9kP7c40F5BOfpGlYTrxonDChEZB7pzZxRNp/bt+ymiy9/npwXya9KH99nJ/GXFIiUkYGFQ== - dependencies: - ansi-escapes "^4.2.1" - supports-hyperlinks "^2.0.0" - test-exclude@^6.0.0: version "6.0.0" - resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-6.0.0.tgz#04a8698661d805ea6fa293b6cb9e63ac044ef15e" + resolved "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz" integrity sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w== dependencies: "@istanbuljs/schema" "^0.1.2" glob "^7.1.4" minimatch "^3.0.4" -text-extensions@^1.0.0: - version "1.9.0" - resolved "https://registry.yarnpkg.com/text-extensions/-/text-extensions-1.9.0.tgz#1853e45fee39c945ce6f6c36b2d659b5aabc2a26" - integrity sha512-wiBrwC1EhBelW12Zy26JeOUkQ5mRu+5o8rpsJk5+2t+Y5vE7e842qtZDQ2g1NpX/29HdyFeJ4nSIhI47ENSxlQ== - text-table@^0.2.0: version "0.2.0" - resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" + resolved "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz" integrity sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw== -throat@^6.0.1: - version "6.0.2" - resolved "https://registry.yarnpkg.com/throat/-/throat-6.0.2.tgz#51a3fbb5e11ae72e2cf74861ed5c8020f89f29fe" - integrity sha512-WKexMoJj3vEuK0yFEapj8y64V0A6xcuPuK9Gt1d0R+dzCSJc0lHqQytAbSB4cDAK0dWh4T0E2ETkoLE2WZ41OQ== - -through2@^2.0.0: - version "2.0.5" - resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.5.tgz#01c1e39eb31d07cb7d03a96a70823260b23132cd" - integrity sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ== - dependencies: - readable-stream "~2.3.6" - xtend "~4.0.1" - -through2@^4.0.0: - version "4.0.2" - resolved "https://registry.yarnpkg.com/through2/-/through2-4.0.2.tgz#a7ce3ac2a7a8b0b966c80e7c49f0484c3b239764" - integrity sha512-iOqSav00cVxEEICeD7TjLB1sueEL+81Wpzp2bY17uZjZN0pWZPuo4suZ/61VujxmqSGFfgOcNuTZ85QJwNZQpw== - dependencies: - readable-stream "3" - -through@2, "through@>=2.2.7 <3", through@^2.3.8: +through@^2.3.8: version "2.3.8" - resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" + resolved "https://registry.npmjs.org/through/-/through-2.3.8.tgz" integrity sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg== tmpl@1.0.5: version "1.0.5" - resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.5.tgz#8683e0b902bb9c20c4f726e3c0b69f36518c07cc" + resolved "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz" integrity sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw== to-regex-range@^5.0.1: version "5.0.1" - resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" + resolved "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz" integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== dependencies: is-number "^7.0.0" -tough-cookie@^4.0.0: - version "4.1.4" - resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-4.1.4.tgz#945f1461b45b5a8c76821c33ea49c3ac192c1b36" - integrity sha512-Loo5UUvLD9ScZ6jh8beX1T6sO1w2/MpCRpEP7V280GKMVUQ0Jzar2U3UJPsrdbziLEMMhu3Ujnq//rhiFuIeag== - dependencies: - psl "^1.1.33" - punycode "^2.1.1" - universalify "^0.2.0" - url-parse "^1.5.3" - -tr46@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/tr46/-/tr46-2.1.0.tgz#fa87aa81ca5d5941da8cbf1f9b749dc969a4e240" - integrity sha512-15Ih7phfcdP5YxqiB+iDtLoaTz4Nd35+IiAv0kQ5FNKHzXgdWqPoTIqEDDJmXceQt4JZk6lVPT8lnDlPpGDppw== - dependencies: - punycode "^2.1.1" - tr46@~0.0.3: version "0.0.3" - resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" + resolved "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz" integrity sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw== -trim-newlines@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-3.0.1.tgz#260a5d962d8b752425b32f3a7db0dcacd176c144" - integrity sha512-c1PTsA3tYrIsLGkJkzHF+w9F2EyxfXGo4UyJc4pFL++FMjnq0HJS69T3M7d//gKrFKwy429bouPescbjecU+Zw== +ts-api-utils@^1.3.0: + version "1.4.3" + resolved "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.4.3.tgz" + integrity sha512-i3eMG77UTMD0hZhgRS562pv83RC6ukSAC2GMNWc+9dieh/+jDM5u5YG+NHX6VNDRHQcHwmsTHctP9LhbC3WxVw== -ts-jest@^27.1.3: - version "27.1.5" - resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-27.1.5.tgz#0ddf1b163fbaae3d5b7504a1e65c914a95cff297" - integrity sha512-Xv6jBQPoBEvBq/5i2TeSG9tt/nqkbpcurrEG1b+2yfBrcJelOZF9Ml6dmyMh7bcW9JyFbRYpR5rxROSlBLTZHA== +ts-jest@^29.4.0: + version "29.4.6" + resolved "https://registry.npmjs.org/ts-jest/-/ts-jest-29.4.6.tgz" + integrity sha512-fSpWtOO/1AjSNQguk43hb/JCo16oJDnMJf3CdEGNkqsEX3t0KX96xvyX1D7PfLCpVoKu4MfVrqUkFyblYoY4lA== dependencies: - bs-logger "0.x" - fast-json-stable-stringify "2.x" - jest-util "^27.0.0" - json5 "2.x" - lodash.memoize "4.x" - make-error "1.x" - semver "7.x" - yargs-parser "20.x" - -ts-node@^10.4.0: - version "10.9.2" - resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.9.2.tgz#70f021c9e185bccdca820e26dc413805c101c71f" - integrity sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ== - dependencies: - "@cspotcode/source-map-support" "^0.8.0" - "@tsconfig/node10" "^1.0.7" - "@tsconfig/node12" "^1.0.7" - "@tsconfig/node14" "^1.0.0" - "@tsconfig/node16" "^1.0.2" - acorn "^8.4.1" - acorn-walk "^8.1.1" - arg "^4.1.0" - create-require "^1.1.0" - diff "^4.0.1" - make-error "^1.1.1" - v8-compile-cache-lib "^3.0.1" - yn "3.1.1" + bs-logger "^0.2.6" + fast-json-stable-stringify "^2.1.0" + handlebars "^4.7.8" + json5 "^2.2.3" + lodash.memoize "^4.1.2" + make-error "^1.3.6" + semver "^7.7.3" + type-fest "^4.41.0" + yargs-parser "^21.1.1" tsconfig-paths@^3.15.0: version "3.15.0" - resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz#5299ec605e55b1abb23ec939ef15edaf483070d4" + resolved "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz" integrity sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg== dependencies: "@types/json5" "^0.0.29" @@ -6526,63 +4450,41 @@ tsconfig-paths@^3.15.0: minimist "^1.2.6" strip-bom "^3.0.0" -tslib@^1.8.1: - version "1.14.1" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" - integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== - -tslib@^2.1.0, tslib@^2.4.0: +tslib@^2.1.0: version "2.8.1" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.8.1.tgz#612efe4ed235d567e8aba5f2a5fab70280ade83f" + resolved "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz" integrity sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w== -tsutils@^3.17.1, tsutils@^3.21.0: - version "3.21.0" - resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.21.0.tgz#b48717d394cea6c1e096983eed58e9d61715b623" - integrity sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA== - dependencies: - tslib "^1.8.1" - type-check@^0.4.0, type-check@~0.4.0: version "0.4.0" - resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1" + resolved "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz" integrity sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew== dependencies: prelude-ls "^1.2.1" type-detect@4.0.8: version "4.0.8" - resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c" + resolved "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz" integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g== -type-fest@^0.18.0: - version "0.18.1" - resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.18.1.tgz#db4bc151a4a2cf4eebf9add5db75508db6cc841f" - integrity sha512-OIAYXk8+ISY+qTOwkHtKqzAuxchoMiD9Udx+FSGQDuiRR+PJKJHc2NJAXlbhkGwTt/4/nKZxELY1w3ReWOL8mw== - type-fest@^0.20.2: version "0.20.2" - resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.20.2.tgz#1bf207f4b28f91583666cb5fbd327887301cd5f4" + resolved "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz" integrity sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ== type-fest@^0.21.3: version "0.21.3" - resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.21.3.tgz#d260a24b0198436e133fa26a524a6d65fa3b2e37" + resolved "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz" integrity sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w== -type-fest@^0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.6.0.tgz#8d2a2370d3df886eb5c90ada1c5bf6188acf838b" - integrity sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg== - -type-fest@^0.8.1: - version "0.8.1" - resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d" - integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA== +type-fest@^4.41.0: + version "4.41.0" + resolved "https://registry.npmjs.org/type-fest/-/type-fest-4.41.0.tgz" + integrity sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA== typed-array-buffer@^1.0.3: version "1.0.3" - resolved "https://registry.yarnpkg.com/typed-array-buffer/-/typed-array-buffer-1.0.3.tgz#a72395450a4869ec033fd549371b47af3a2ee536" + resolved "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.3.tgz" integrity sha512-nAYYwfY3qnzX30IkA6AQZjVbtK6duGontcQm1WSG1MD94YLqK0515GNApXkoxKOWMusVssAHWLh9SeaoefYFGw== dependencies: call-bound "^1.0.3" @@ -6591,7 +4493,7 @@ typed-array-buffer@^1.0.3: typed-array-byte-length@^1.0.3: version "1.0.3" - resolved "https://registry.yarnpkg.com/typed-array-byte-length/-/typed-array-byte-length-1.0.3.tgz#8407a04f7d78684f3d252aa1a143d2b77b4160ce" + resolved "https://registry.npmjs.org/typed-array-byte-length/-/typed-array-byte-length-1.0.3.tgz" integrity sha512-BaXgOuIxz8n8pIq3e7Atg/7s+DpiYrxn4vdot3w9KbnBhcRQq6o3xemQdIfynqSeXeDrF32x+WvfzmOjPiY9lg== dependencies: call-bind "^1.0.8" @@ -6602,7 +4504,7 @@ typed-array-byte-length@^1.0.3: typed-array-byte-offset@^1.0.4: version "1.0.4" - resolved "https://registry.yarnpkg.com/typed-array-byte-offset/-/typed-array-byte-offset-1.0.4.tgz#ae3698b8ec91a8ab945016108aef00d5bff12355" + resolved "https://registry.npmjs.org/typed-array-byte-offset/-/typed-array-byte-offset-1.0.4.tgz" integrity sha512-bTlAFB/FBYMcuX81gbL4OcpH5PmlFHqlCCpAl8AlEzMz5k53oNDvN8p1PNOWLEmI2x4orp3raOFB51tv9X+MFQ== dependencies: available-typed-arrays "^1.0.7" @@ -6615,7 +4517,7 @@ typed-array-byte-offset@^1.0.4: typed-array-length@^1.0.7: version "1.0.7" - resolved "https://registry.yarnpkg.com/typed-array-length/-/typed-array-length-1.0.7.tgz#ee4deff984b64be1e118b0de8c9c877d5ce73d3d" + resolved "https://registry.npmjs.org/typed-array-length/-/typed-array-length-1.0.7.tgz" integrity sha512-3KS2b+kL7fsuk/eJZ7EQdnEmQoaho/r6KUef7hxvltNA5DR8NAUM+8wJMbJyZ4G9/7i3v5zPBIMN5aybAh2/Jg== dependencies: call-bind "^1.0.7" @@ -6625,36 +4527,19 @@ typed-array-length@^1.0.7: possible-typed-array-names "^1.0.0" reflect.getprototypeof "^1.0.6" -typedarray-to-buffer@^3.1.5: - version "3.1.5" - resolved "https://registry.yarnpkg.com/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz#a97ee7a9ff42691b9f783ff1bc5112fe3fca9080" - integrity sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q== - dependencies: - is-typedarray "^1.0.0" - -typedarray@^0.0.6: - version "0.0.6" - resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" - integrity sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA== - -typescript@^3.9.3: - version "3.9.10" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.9.10.tgz#70f3910ac7a51ed6bef79da7800690b19bf778b8" - integrity sha512-w6fIxVE/H1PkLKcCPsFqKE7Kv7QUwhU8qQY2MueZXWx5cPZdwFupLgKK3vntcK98BtNHZtAF4LA/yl2a7k8R6Q== - -typescript@^4.6.2: - version "4.9.5" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a" - integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g== +typescript@^5.3.3: + version "5.9.3" + resolved "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz" + integrity sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw== uglify-js@^3.1.4: version "3.19.3" - resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.19.3.tgz#82315e9bbc6f2b25888858acd1fff8441035b77f" + resolved "https://registry.npmjs.org/uglify-js/-/uglify-js-3.19.3.tgz" integrity sha512-v3Xu+yuwBXisp6QYTcH4UbH+xYJXqnq2m/LtQVWKWzYc1iehYnLixoQDN9FH6/j9/oybfd6W9Ghwkl8+UMKTKQ== unbox-primitive@^1.1.0: version "1.1.0" - resolved "https://registry.yarnpkg.com/unbox-primitive/-/unbox-primitive-1.1.0.tgz#8d9d2c9edeea8460c7f35033a88867944934d1e2" + resolved "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.1.0.tgz" integrity sha512-nWJ91DjeOkej/TA8pXQ3myruKpKEYgqvpw9lz4OPHj/NWFNluYrjbz9j01CJ8yKQd2g4jFoOkINCTW2I5LEEyw== dependencies: call-bound "^1.0.3" @@ -6662,179 +4547,86 @@ unbox-primitive@^1.1.0: has-symbols "^1.1.0" which-boxed-primitive "^1.1.1" -undici-types@~7.8.0: - version "7.8.0" - resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-7.8.0.tgz#de00b85b710c54122e44fbfd911f8d70174cd294" - integrity sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw== +undici-types@~7.16.0: + version "7.16.0" + resolved "https://registry.npmjs.org/undici-types/-/undici-types-7.16.0.tgz" + integrity sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw== unicode-canonical-property-names-ecmascript@^2.0.0: version "2.0.1" - resolved "https://registry.yarnpkg.com/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.1.tgz#cb3173fe47ca743e228216e4a3ddc4c84d628cc2" + resolved "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.1.tgz" integrity sha512-dA8WbNeb2a6oQzAQ55YlT5vQAWGV9WXOsi3SskE3bcCdM0P4SDd+24zS/OCacdRq5BkdsRj9q3Pg6YyQoxIGqg== unicode-match-property-ecmascript@^2.0.0: version "2.0.0" - resolved "https://registry.yarnpkg.com/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-2.0.0.tgz#54fd16e0ecb167cf04cf1f756bdcc92eba7976c3" + resolved "https://registry.npmjs.org/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-2.0.0.tgz" integrity sha512-5kaZCrbp5mmbz5ulBkDkbY0SsPOjKqVS35VpL9ulMPfSl0J0Xsm+9Evphv9CoIZFwre7aJoa94AY6seMKGVN5Q== dependencies: unicode-canonical-property-names-ecmascript "^2.0.0" unicode-property-aliases-ecmascript "^2.0.0" -unicode-match-property-value-ecmascript@^2.1.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-2.2.0.tgz#a0401aee72714598f739b68b104e4fe3a0cb3c71" - integrity sha512-4IehN3V/+kkr5YeSSDDQG8QLqO26XpL2XP3GQtqwlT/QYSECAwFztxVHjlbh0+gjJ3XmNLS0zDsbgs9jWKExLg== +unicode-match-property-value-ecmascript@^2.2.1: + version "2.2.1" + resolved "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-2.2.1.tgz" + integrity sha512-JQ84qTuMg4nVkx8ga4A16a1epI9H6uTXAknqxkGF/aFfRLw1xC/Bp24HNLaZhHSkWd3+84t8iXnp1J0kYcZHhg== unicode-property-aliases-ecmascript@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-2.1.0.tgz#43d41e3be698bd493ef911077c9b131f827e8ccd" - integrity sha512-6t3foTQI9qne+OZoVQB/8x8rk2k1eVy1gRXhV3oFQ5T6R1dqQ1xtin3XqSlx3+ATBkliTaR/hHyJBm+LVPNM8w== - -universalify@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.2.0.tgz#6451760566fa857534745ab1dde952d1b1761be0" - integrity sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg== + version "2.2.0" + resolved "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-2.2.0.tgz" + integrity sha512-hpbDzxUY9BFwX+UeBnxv3Sh1q7HFxj48DTmXchNgRa46lO8uj3/1iEn3MiNUYTg1g9ctIqXCCERn8gYZhHC5lQ== -update-browserslist-db@^1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.1.3.tgz#348377dd245216f9e7060ff50b15a1b740b75420" - integrity sha512-UxhIZQ+QInVdunkDAaiazvvT/+fXL5Osr0JZlJulepYu6Jd7qJtDZjlur0emRlT71EN3ScPoE7gvsuIKKNavKw== +update-browserslist-db@^1.2.0: + version "1.2.3" + resolved "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.2.3.tgz" + integrity sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w== dependencies: escalade "^3.2.0" picocolors "^1.1.1" uri-js@^4.2.2: version "4.4.1" - resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e" + resolved "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz" integrity sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg== dependencies: punycode "^2.1.0" -url-parse@^1.5.3: - version "1.5.10" - resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.5.10.tgz#9d3c2f736c1d75dd3bd2be507dcc111f1e2ea9c1" - integrity sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ== - dependencies: - querystringify "^2.1.1" - requires-port "^1.0.0" - -util-deprecate@^1.0.1, util-deprecate@~1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" - integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw== - -v8-compile-cache-lib@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz#6336e8d71965cb3d35a1bbb7868445a7c05264bf" - integrity sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg== - -v8-compile-cache@^2.0.3: - version "2.4.0" - resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.4.0.tgz#cdada8bec61e15865f05d097c5f4fd30e94dc128" - integrity sha512-ocyWc3bAHBB/guyqJQVI5o4BZkPhznPYUG2ea80Gond/BgNWpap8TOmLSeeQG7bnh2KMISxskdADG59j7zruhw== - -v8-to-istanbul@^8.1.0: - version "8.1.1" - resolved "https://registry.yarnpkg.com/v8-to-istanbul/-/v8-to-istanbul-8.1.1.tgz#77b752fd3975e31bbcef938f85e9bd1c7a8d60ed" - integrity sha512-FGtKtv3xIpR6BYhvgH8MI/y78oT7d8Au3ww4QIxymrCtZEh5b8gCw2siywE+puhEmuWKDtmfrvF5UlB298ut3w== +v8-to-istanbul@^9.0.1: + version "9.3.0" + resolved "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.3.0.tgz" + integrity sha512-kiGUalWN+rgBJ/1OHZsBtU4rXZOfj/7rKQxULKlIzwzQSvMJUUNgPwJEEh7gU6xEVxC0ahoOBvN2YI8GH6FNgA== dependencies: + "@jridgewell/trace-mapping" "^0.3.12" "@types/istanbul-lib-coverage" "^2.0.1" - convert-source-map "^1.6.0" - source-map "^0.7.3" - -validate-npm-package-license@^3.0.1: - version "3.0.4" - resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz#fc91f6b9c7ba15c857f4cb2c5defeec39d4f410a" - integrity sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew== - dependencies: - spdx-correct "^3.0.0" - spdx-expression-parse "^3.0.0" - -vue-eslint-parser@~7.1.0: - version "7.1.1" - resolved "https://registry.yarnpkg.com/vue-eslint-parser/-/vue-eslint-parser-7.1.1.tgz#c43c1c715ff50778b9a7e9a4e16921185f3425d3" - integrity sha512-8FdXi0gieEwh1IprIBafpiJWcApwrU+l2FEj8c1HtHFdNXMd0+2jUSjBVmcQYohf/E72irwAXEXLga6TQcB3FA== - dependencies: - debug "^4.1.1" - eslint-scope "^5.0.0" - eslint-visitor-keys "^1.1.0" - espree "^6.2.1" - esquery "^1.0.1" - lodash "^4.17.15" - -w3c-hr-time@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz#0a89cdf5cc15822df9c360543676963e0cc308cd" - integrity sha512-z8P5DvDNjKDoFIHK7q8r8lackT6l+jo/Ye3HOle7l9nICP9lf1Ci25fy9vHd0JOWewkIFzXIEig3TdKT7JQ5fQ== - dependencies: - browser-process-hrtime "^1.0.0" - -w3c-xmlserializer@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/w3c-xmlserializer/-/w3c-xmlserializer-2.0.0.tgz#3e7104a05b75146cc60f564380b7f683acf1020a" - integrity sha512-4tzD0mF8iSiMiNs30BiLO3EpfGLZUT2MSX/G+o7ZywDzliWQ3OPtTZ0PTC3B3ca1UAf4cJMHB+2Bf56EriJuRA== - dependencies: - xml-name-validator "^3.0.0" + convert-source-map "^2.0.0" -walker@^1.0.7: +walker@^1.0.8: version "1.0.8" - resolved "https://registry.yarnpkg.com/walker/-/walker-1.0.8.tgz#bd498db477afe573dc04185f011d3ab8a8d7653f" + resolved "https://registry.npmjs.org/walker/-/walker-1.0.8.tgz" integrity sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ== dependencies: makeerror "1.0.12" webidl-conversions@^3.0.0: version "3.0.1" - resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" + resolved "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz" integrity sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ== -webidl-conversions@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-5.0.0.tgz#ae59c8a00b121543a2acc65c0434f57b0fc11aff" - integrity sha512-VlZwKPCkYKxQgeSbH5EyngOmRp7Ww7I9rQLERETtf5ofd9pGeswWiOtogpEO850jziPRarreGxn5QIiTqpb2wA== - -webidl-conversions@^6.1.0: - version "6.1.0" - resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-6.1.0.tgz#9111b4d7ea80acd40f5270d666621afa78b69514" - integrity sha512-qBIvFLGiBpLjfwmYAaHPXsn+ho5xZnGvyGvsarywGNc8VyQJUMHJ8OBKGGrPER0okBeMDaan4mNBlgBROxuI8w== - -whatwg-encoding@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/whatwg-encoding/-/whatwg-encoding-1.0.5.tgz#5abacf777c32166a51d085d6b4f3e7d27113ddb0" - integrity sha512-b5lim54JOPN9HtzvK9HFXvBma/rnfFeqsic0hSpjtDbVxR3dJKLc+KB4V6GgiGOvl7CY/KNh8rxSo9DKQrnUEw== - dependencies: - iconv-lite "0.4.24" - whatwg-fetch@^3.4.1: version "3.6.20" - resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-3.6.20.tgz#580ce6d791facec91d37c72890995a0b48d31c70" + resolved "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.6.20.tgz" integrity sha512-EqhiFU6daOA8kpjOWTL0olhVOF3i7OrFzSYiGsEMB8GcXS+RrzauAERX65xMeNWVqxA6HXH2m69Z9LaKKdisfg== -whatwg-mimetype@^2.3.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz#3d4b1e0312d2079879f826aff18dbeeca5960fbf" - integrity sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g== - whatwg-url@^5.0.0: version "5.0.0" - resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d" + resolved "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz" integrity sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw== dependencies: tr46 "~0.0.3" webidl-conversions "^3.0.0" -whatwg-url@^8.0.0, whatwg-url@^8.5.0: - version "8.7.0" - resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-8.7.0.tgz#656a78e510ff8f3937bc0bcbe9f5c0ac35941b77" - integrity sha512-gAojqb/m9Q8a5IV96E3fHJM70AzCkgt4uXYX2O7EmuyOnLrViCQlsEBmF9UQIu3/aeAIp2U17rtbpZWNntQqdg== - dependencies: - lodash "^4.7.0" - tr46 "^2.1.0" - webidl-conversions "^6.1.0" - which-boxed-primitive@^1.1.0, which-boxed-primitive@^1.1.1: version "1.1.1" - resolved "https://registry.yarnpkg.com/which-boxed-primitive/-/which-boxed-primitive-1.1.1.tgz#d76ec27df7fa165f18d5808374a5fe23c29b176e" + resolved "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.1.1.tgz" integrity sha512-TbX3mj8n0odCBFVlY8AxkqcHASw3L60jIuF8jFP78az3C2YhmGvqbHBpAjTRH2/xqYunrJ9g1jSyjCjpoWzIAA== dependencies: is-bigint "^1.1.0" @@ -6845,7 +4637,7 @@ which-boxed-primitive@^1.1.0, which-boxed-primitive@^1.1.1: which-builtin-type@^1.2.1: version "1.2.1" - resolved "https://registry.yarnpkg.com/which-builtin-type/-/which-builtin-type-1.2.1.tgz#89183da1b4907ab089a6b02029cc5d8d6574270e" + resolved "https://registry.npmjs.org/which-builtin-type/-/which-builtin-type-1.2.1.tgz" integrity sha512-6iBczoX+kDQ7a3+YJBnh3T+KZRxM/iYNPXicqk66/Qfm1b93iu+yOImkg0zHbj5LNOcNv1TEADiZ0xa34B4q6Q== dependencies: call-bound "^1.0.2" @@ -6864,7 +4656,7 @@ which-builtin-type@^1.2.1: which-collection@^1.0.2: version "1.0.2" - resolved "https://registry.yarnpkg.com/which-collection/-/which-collection-1.0.2.tgz#627ef76243920a107e7ce8e96191debe4b16c2a0" + resolved "https://registry.npmjs.org/which-collection/-/which-collection-1.0.2.tgz" integrity sha512-K4jVyjnBdgvc86Y6BkaLZEN933SwYOuBFkdmBu9ZfkcAbdVbpITnDmjvZ/aQjRXQrv5EPkTnD1s39GiiqbngCw== dependencies: is-map "^2.0.3" @@ -6873,9 +4665,9 @@ which-collection@^1.0.2: is-weakset "^2.0.3" which-typed-array@^1.1.16, which-typed-array@^1.1.19: - version "1.1.19" - resolved "https://registry.yarnpkg.com/which-typed-array/-/which-typed-array-1.1.19.tgz#df03842e870b6b88e117524a4b364b6fc689f956" - integrity sha512-rEvr90Bck4WZt9HHFC4DJMsjvu7x+r6bImz0/BrbWb7A2djJ8hnZMrWnHo9F8ssv0OMErasDhftrfROTyqSDrw== + version "1.1.20" + resolved "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.20.tgz" + integrity sha512-LYfpUkmqwl0h9A2HL09Mms427Q1RZWuOHsukfVcKRq9q95iQxdw0ix1JQrqbcDR9PH1QDwf5Qo8OZb5lksZ8Xg== dependencies: available-typed-arrays "^1.0.7" call-bind "^1.0.8" @@ -6887,24 +4679,24 @@ which-typed-array@^1.1.16, which-typed-array@^1.1.19: which@^2.0.1: version "2.0.2" - resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" + resolved "https://registry.npmjs.org/which/-/which-2.0.2.tgz" integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== dependencies: isexe "^2.0.0" word-wrap@^1.2.5: version "1.2.5" - resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.5.tgz#d2c45c6dd4fbce621a66f136cbe328afd0410b34" + resolved "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz" integrity sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA== wordwrap@^1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" + resolved "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz" integrity sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q== wrap-ansi@^6.2.0: version "6.2.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-6.2.0.tgz#e9393ba07102e6c91a3b221478f0257cd2856e53" + resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz" integrity sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA== dependencies: ansi-styles "^4.0.0" @@ -6913,7 +4705,7 @@ wrap-ansi@^6.2.0: wrap-ansi@^7.0.0: version "7.0.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" + resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== dependencies: ansi-styles "^4.0.0" @@ -6922,88 +4714,51 @@ wrap-ansi@^7.0.0: wrappy@1: version "1.0.2" - resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + resolved "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz" integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== -write-file-atomic@^3.0.0: - version "3.0.3" - resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-3.0.3.tgz#56bd5c5a5c70481cd19c571bd39ab965a5de56e8" - integrity sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q== +write-file-atomic@^4.0.2: + version "4.0.2" + resolved "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-4.0.2.tgz" + integrity sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg== dependencies: imurmurhash "^0.1.4" - is-typedarray "^1.0.0" - signal-exit "^3.0.2" - typedarray-to-buffer "^3.1.5" - -ws@8.18.0: - version "8.18.0" - resolved "https://registry.yarnpkg.com/ws/-/ws-8.18.0.tgz#0d7505a6eafe2b0e712d232b42279f53bc289bbc" - integrity sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw== - -ws@^7.4.6: - version "7.5.10" - resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.10.tgz#58b5c20dc281633f6c19113f39b349bd8bd558d9" - integrity sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ== - -xml-name-validator@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/xml-name-validator/-/xml-name-validator-3.0.0.tgz#6ae73e06de4d8c6e47f9fb181f78d648ad457c6a" - integrity sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw== - -xmlchars@^2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/xmlchars/-/xmlchars-2.2.0.tgz#060fe1bcb7f9c76fe2a17db86a9bc3ab894210cb" - integrity sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw== - -xtend@~4.0.1: - version "4.0.2" - resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54" - integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ== + signal-exit "^3.0.7" y18n@^5.0.5: version "5.0.8" - resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55" + resolved "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz" integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA== yallist@^3.0.2: version "3.1.1" - resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd" + resolved "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz" integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g== -yallist@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" - integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== - yaml@^1.10.2: - version "1.10.2" - resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.10.2.tgz#2301c5ffbf12b467de8da2333a459e29e7920e4b" - integrity sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg== + version "1.10.3" + resolved "https://registry.npmjs.org/yaml/-/yaml-1.10.3.tgz" + integrity sha512-vIYeF1u3CjlhAFekPPAk2h/Kv4T3mAkMox5OymRiJQB0spDP10LHvt+K7G9Ny6NuuMAb25/6n1qyUjAcGNf/AA== -yargs-parser@20.x, yargs-parser@^20.2.2, yargs-parser@^20.2.3: - version "20.2.9" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.9.tgz#2eb7dc3b0289718fc295f362753845c41a0c94ee" - integrity sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w== +yargs-parser@^21.1.1: + version "21.1.1" + resolved "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz" + integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw== -yargs@^16.0.0, yargs@^16.2.0: - version "16.2.0" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-16.2.0.tgz#1c82bf0f6b6a66eafce7ef30e376f49a12477f66" - integrity sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw== +yargs@^17.3.1: + version "17.7.2" + resolved "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz" + integrity sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w== dependencies: - cliui "^7.0.2" + cliui "^8.0.1" escalade "^3.1.1" get-caller-file "^2.0.5" require-directory "^2.1.1" - string-width "^4.2.0" + string-width "^4.2.3" y18n "^5.0.5" - yargs-parser "^20.2.2" - -yn@3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50" - integrity sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q== + yargs-parser "^21.1.1" yocto-queue@^0.1.0: version "0.1.0" - resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" + resolved "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz" integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==