From ae181b61d166d31727e41b964de3fee71ea20ba6 Mon Sep 17 00:00:00 2001 From: arlert-armin Date: Tue, 6 Oct 2026 19:45:08 +0000 Subject: [PATCH 01/29] chore: pin the experimental viem-based hub3 evm build and dedupe viem Pin @hub3js/evm and @hub3js/namespaces to the experimental build that exposes viem's actions on the EVM namespace, dedupe viem to 2.57.3 and move its ox patch to the matching version. Providers gain @hub3js/namespaces and drop @rango-dev/signer-evm, which they no longer use. --- patches/{viem++ox+0.14.29.patch => viem++ox+0.14.45.patch} | 0 patches/viem+2.52.2.patch | 7 ------- wallets/provider-binance/package.json | 1 - wallets/provider-brave/package.json | 1 - wallets/provider-coin98/package.json | 1 - wallets/provider-coinbase/package.json | 1 - wallets/provider-default/package.json | 1 - wallets/provider-enkrypt/package.json | 1 - wallets/provider-exodus/package.json | 1 - wallets/provider-ledger-wallet/package.json | 4 +--- wallets/provider-ledger/package.json | 1 - wallets/provider-math-wallet/package.json | 1 - wallets/provider-metamask/package.json | 1 - wallets/provider-rabby/package.json | 1 - wallets/provider-safe/package.json | 5 +---- wallets/provider-safepal/package.json | 1 - wallets/provider-taho/package.json | 1 - wallets/provider-tokenpocket/package.json | 1 - wallets/provider-tomo/package.json | 1 - wallets/provider-trustwallet/package.json | 1 - 20 files changed, 2 insertions(+), 30 deletions(-) rename patches/{viem++ox+0.14.29.patch => viem++ox+0.14.45.patch} (100%) delete mode 100644 patches/viem+2.52.2.patch diff --git a/patches/viem++ox+0.14.29.patch b/patches/viem++ox+0.14.45.patch similarity index 100% rename from patches/viem++ox+0.14.29.patch rename to patches/viem++ox+0.14.45.patch diff --git a/patches/viem+2.52.2.patch b/patches/viem+2.52.2.patch deleted file mode 100644 index 1e31bbcedc..0000000000 --- a/patches/viem+2.52.2.patch +++ /dev/null @@ -1,7 +0,0 @@ -diff --git a/node_modules/viem/_types/package.json b/node_modules/viem/_types/package.json -new file mode 100644 -index 0000000000000000000000000000000000000000..089153bcb5adf57dc25f206a9dad3114c9cff80d ---- /dev/null -+++ b/node_modules/viem/_types/package.json -@@ -0,0 +1 @@ -+{"type":"module"} diff --git a/wallets/provider-binance/package.json b/wallets/provider-binance/package.json index ae449e4363..9cff373505 100644 --- a/wallets/provider-binance/package.json +++ b/wallets/provider-binance/package.json @@ -22,7 +22,6 @@ "lint": "eslint \"**/*.{ts,tsx}\"" }, "dependencies": { - "@rango-dev/signer-evm": "^0.47.1", "rango-types": "^0.6.0" }, "devDependencies": { diff --git a/wallets/provider-brave/package.json b/wallets/provider-brave/package.json index 7b7466a2b6..bcb1465108 100644 --- a/wallets/provider-brave/package.json +++ b/wallets/provider-brave/package.json @@ -22,7 +22,6 @@ "lint": "eslint \"**/*.{ts,tsx}\"" }, "dependencies": { - "@rango-dev/signer-evm": "^0.47.1", "@rango-dev/signer-solana": "^0.51.1-next.0", "rango-types": "^0.6.0" }, diff --git a/wallets/provider-coin98/package.json b/wallets/provider-coin98/package.json index 2a890a1101..e24b5129a8 100644 --- a/wallets/provider-coin98/package.json +++ b/wallets/provider-coin98/package.json @@ -22,7 +22,6 @@ "lint": "eslint \"**/*.{ts,tsx}\"" }, "dependencies": { - "@rango-dev/signer-evm": "^0.47.1", "@rango-dev/signer-solana": "^0.51.1-next.0", "@solana/web3.js": "^1.91.4", "bs58": "^5.0.0", diff --git a/wallets/provider-coinbase/package.json b/wallets/provider-coinbase/package.json index d0352d4aa9..ae354ecdf5 100644 --- a/wallets/provider-coinbase/package.json +++ b/wallets/provider-coinbase/package.json @@ -22,7 +22,6 @@ "lint": "eslint \"**/*.{ts,tsx}\"" }, "dependencies": { - "@rango-dev/signer-evm": "^0.47.1", "@rango-dev/signer-solana": "^0.51.1-next.0", "bs58": "^5.0.0", "rango-types": "^0.6.0" diff --git a/wallets/provider-default/package.json b/wallets/provider-default/package.json index d99290faa5..8d9c634f1a 100644 --- a/wallets/provider-default/package.json +++ b/wallets/provider-default/package.json @@ -22,7 +22,6 @@ "lint": "eslint \"**/*.{ts,tsx}\"" }, "dependencies": { - "@rango-dev/signer-evm": "^0.47.1", "rango-types": "^0.6.0" }, "devDependencies": { diff --git a/wallets/provider-enkrypt/package.json b/wallets/provider-enkrypt/package.json index d1d878b70b..3a6286c06d 100644 --- a/wallets/provider-enkrypt/package.json +++ b/wallets/provider-enkrypt/package.json @@ -22,7 +22,6 @@ "lint": "eslint \"**/*.{ts,tsx}\"" }, "dependencies": { - "@rango-dev/signer-evm": "^0.47.1", "rango-types": "^0.6.0" }, "devDependencies": { diff --git a/wallets/provider-exodus/package.json b/wallets/provider-exodus/package.json index b819c0c86d..5594f00b3d 100644 --- a/wallets/provider-exodus/package.json +++ b/wallets/provider-exodus/package.json @@ -22,7 +22,6 @@ "lint": "eslint \"**/*.{ts,tsx}\"" }, "dependencies": { - "@rango-dev/signer-evm": "^0.47.1", "@rango-dev/signer-solana": "^0.51.1-next.0", "bs58": "^5.0.0", "rango-types": "^0.6.0" diff --git a/wallets/provider-ledger-wallet/package.json b/wallets/provider-ledger-wallet/package.json index dd0e8b4424..248420c30d 100644 --- a/wallets/provider-ledger-wallet/package.json +++ b/wallets/provider-ledger-wallet/package.json @@ -22,9 +22,7 @@ "lint": "eslint \"**/*.{ts,tsx}\"" }, "dependencies": { - "@ledgerhq/ledger-wallet-provider": "^1.4.2", - "@rango-dev/signer-evm": "^0.47.1", - "rango-types": "^0.6.0" + "@ledgerhq/ledger-wallet-provider": "^1.4.2" }, "devDependencies": { "@hub3js/core": "^0.64.0", diff --git a/wallets/provider-ledger/package.json b/wallets/provider-ledger/package.json index e79446f1a0..08020c8c11 100644 --- a/wallets/provider-ledger/package.json +++ b/wallets/provider-ledger/package.json @@ -28,7 +28,6 @@ "@ledgerhq/hw-transport-webhid": "^6.28.6", "@ledgerhq/types-cryptoassets": "^7.11.0", "@ledgerhq/types-devices": "^6.24.0", - "@rango-dev/signer-evm": "^0.47.1", "@rango-dev/signer-solana": "^0.51.1-next.0", "@solana/web3.js": "^1.91.4", "@types/w3c-web-hid": "^1.0.2", diff --git a/wallets/provider-math-wallet/package.json b/wallets/provider-math-wallet/package.json index f58a624f94..7aa628dc36 100644 --- a/wallets/provider-math-wallet/package.json +++ b/wallets/provider-math-wallet/package.json @@ -22,7 +22,6 @@ "lint": "eslint \"**/*.{ts,tsx}\"" }, "dependencies": { - "@rango-dev/signer-evm": "^0.47.1", "@rango-dev/signer-solana": "^0.51.1-next.0", "rango-types": "^0.6.0" }, diff --git a/wallets/provider-metamask/package.json b/wallets/provider-metamask/package.json index 70fea34656..849a95d488 100644 --- a/wallets/provider-metamask/package.json +++ b/wallets/provider-metamask/package.json @@ -22,7 +22,6 @@ "lint": "eslint \"**/*.{ts,tsx}\"" }, "dependencies": { - "@rango-dev/signer-evm": "^0.47.1", "@rango-dev/signer-solana": "^0.51.1-next.0", "@wallet-standard/app": "^1.1.0", "bs58": "^5.0.0", diff --git a/wallets/provider-rabby/package.json b/wallets/provider-rabby/package.json index 4dbbb7269e..688585098d 100644 --- a/wallets/provider-rabby/package.json +++ b/wallets/provider-rabby/package.json @@ -22,7 +22,6 @@ "lint": "eslint \"**/*.{ts,tsx}\"" }, "dependencies": { - "@rango-dev/signer-evm": "^0.47.1", "rango-types": "^0.6.0" }, "devDependencies": { diff --git a/wallets/provider-safe/package.json b/wallets/provider-safe/package.json index ddc7a8d2ac..c3e1f727ee 100644 --- a/wallets/provider-safe/package.json +++ b/wallets/provider-safe/package.json @@ -22,11 +22,8 @@ "lint": "eslint \"**/*.{ts,tsx}\"" }, "dependencies": { - "@rango-dev/signer-evm": "^0.47.1", "@safe-global/safe-apps-provider": "^0.18.6", - "@safe-global/safe-apps-sdk": "^9.1.0", - "ethers": "^6.13.2", - "rango-types": "^0.6.0" + "@safe-global/safe-apps-sdk": "^9.1.0" }, "devDependencies": { "@hub3js/core": "^0.64.0", diff --git a/wallets/provider-safepal/package.json b/wallets/provider-safepal/package.json index 7121b924c3..e72730eda8 100644 --- a/wallets/provider-safepal/package.json +++ b/wallets/provider-safepal/package.json @@ -22,7 +22,6 @@ "lint": "eslint \"**/*.{ts,tsx}\"" }, "dependencies": { - "@rango-dev/signer-evm": "^0.47.1", "@rango-dev/signer-solana": "^0.51.1-next.0", "ethers": "^6.13.2", "rango-types": "^0.6.0" diff --git a/wallets/provider-taho/package.json b/wallets/provider-taho/package.json index d32fa61751..bc6892977f 100644 --- a/wallets/provider-taho/package.json +++ b/wallets/provider-taho/package.json @@ -22,7 +22,6 @@ "lint": "eslint \"**/*.{ts,tsx}\"" }, "dependencies": { - "@rango-dev/signer-evm": "^0.47.1", "rango-types": "^0.6.0" }, "devDependencies": { diff --git a/wallets/provider-tokenpocket/package.json b/wallets/provider-tokenpocket/package.json index 59a3157fa0..caca4bf77d 100644 --- a/wallets/provider-tokenpocket/package.json +++ b/wallets/provider-tokenpocket/package.json @@ -22,7 +22,6 @@ "lint": "eslint \"**/*.{ts,tsx}\"" }, "dependencies": { - "@rango-dev/signer-evm": "^0.47.1", "rango-types": "^0.6.0" }, "devDependencies": { diff --git a/wallets/provider-tomo/package.json b/wallets/provider-tomo/package.json index 49d72fcdb1..04119de12e 100644 --- a/wallets/provider-tomo/package.json +++ b/wallets/provider-tomo/package.json @@ -22,7 +22,6 @@ "lint": "eslint \"**/*.{ts,tsx}\"" }, "dependencies": { - "@rango-dev/signer-evm": "^0.47.1", "rango-types": "^0.6.0" }, "devDependencies": { diff --git a/wallets/provider-trustwallet/package.json b/wallets/provider-trustwallet/package.json index 32a8c746b9..0804ad1393 100644 --- a/wallets/provider-trustwallet/package.json +++ b/wallets/provider-trustwallet/package.json @@ -22,7 +22,6 @@ "lint": "eslint \"**/*.{ts,tsx}\"" }, "dependencies": { - "@rango-dev/signer-evm": "^0.47.1", "@rango-dev/signer-solana": "^0.51.1-next.0", "bs58": "^5.0.0", "rango-types": "^0.6.0" From 3481a1a823967b5828e225ac3899984605f96914 Mon Sep 17 00:00:00 2001 From: arlert-armin Date: Tue, 6 Oct 2026 19:50:11 +0000 Subject: [PATCH 02/29] feat(wallets): sign ledger and trezor evm transactions through namespace actions Ledger and Trezor have no injected provider. Their EVM namespaces now register the public viem actions, including the receipt ones, and sign on the device through their own `sendTransaction` and `signMessage` actions, so they no longer need an EVM signer or a JSON-RPC provider of their own. The allowance is read with the public client's `readContract`. --- wallets/provider-ledger/src/namespaces/evm.ts | 102 +++--- wallets/provider-ledger/src/provider.ts | 15 +- wallets/provider-ledger/src/signer.ts | 2 - .../provider-ledger/src/signers/ethereum.ts | 294 ++++++++++-------- wallets/provider-ledger/src/utils.ts | 19 -- wallets/provider-trezor/src/namespaces/evm.ts | 101 +++--- wallets/provider-trezor/src/provider.ts | 14 +- wallets/provider-trezor/src/signer.ts | 2 - .../provider-trezor/src/signers/ethereum.ts | 292 +++++++++-------- wallets/provider-trezor/src/utils.ts | 19 -- 10 files changed, 449 insertions(+), 411 deletions(-) diff --git a/wallets/provider-ledger/src/namespaces/evm.ts b/wallets/provider-ledger/src/namespaces/evm.ts index 91f57f90c1..1391d0b196 100644 --- a/wallets/provider-ledger/src/namespaces/evm.ts +++ b/wallets/provider-ledger/src/namespaces/evm.ts @@ -1,25 +1,35 @@ import type { Context } from '@hub3js/core'; -import type { - AllowanceParams, - EvmActions, - EvmTransactionReceipt, -} from '@hub3js/evm'; +import type { AllowanceParams, EvmActions } from '@hub3js/evm'; import type { CaipAccount } from '@hub3js/std/types'; import { Hub3Error, NamespaceBuilder } from '@hub3js/core'; -import { builders, CAIP_NAMESPACE } from '@hub3js/evm'; +import { + builders, + CAIP_NAMESPACE, + viemPublicActions, + viemPublicAdapter, +} from '@hub3js/evm'; import * as commonBuilders from '@hub3js/std/builders'; import { standardizeAndThrowError } from '@hub3js/std/operators'; import { AccountId } from 'caip'; -import { Contract, toBeHex } from 'ethers'; import { ETHEREUM_CHAIN_ID, WALLET_ID } from '../constants.js'; +import { sendTransaction, signMessage } from '../signers/ethereum.js'; import { setDerivationPath } from '../state.js'; -import { getEthereumAccounts, getEvmRpcProvider } from '../utils.js'; +import { getEthereumAccounts } from '../utils.js'; const ERC20_ALLOWANCE_ABI = [ - 'function allowance(address owner, address spender) view returns (uint256)', -]; + { + type: 'function', + name: 'allowance', + stateMutability: 'view', + inputs: [ + { name: 'owner', type: 'address' }, + { name: 'spender', type: 'address' }, + ], + outputs: [{ name: '', type: 'uint256' }], + }, +] as const; const connect = builders .connect() @@ -62,58 +72,44 @@ const getChainId = builders .build(); /* - * Ledger injects no EIP-1193 provider, so these read actions talk to the shared - * JSON-RPC provider directly rather than through the default hub3js/evm actions. + * Ledger injects no EIP-1193 provider, so the allowance is read with the public + * client's `readContract`, which `buildEvm` registers. */ const getAllowance = builders .getAllowance() .action( async ( - _context: Context, + context: Context, params: AllowanceParams ): Promise => { - const token = new Contract( - params.token, - ERC20_ALLOWANCE_ABI, - getEvmRpcProvider() - ); - const currentAllowance: bigint = await token.allowance( - params.owner, - params.spender - ); - return currentAllowance.toString(); - } - ) - .build(); - -const getTransactionReceipt = builders - .getTransactionReceipt() - .action( - async ( - _context: Context, - transactionHash: `0x${string}` - ): Promise => { - const receipt = await getEvmRpcProvider().getTransactionReceipt( - transactionHash - ); - if (!receipt) { - return null; - } - return { - status: receipt.status === 1 ? '0x1' : '0x0', - transactionHash: receipt.hash, - blockNumber: toBeHex(receipt.blockNumber), - }; + const allowance = (await context.action('readContract', { + address: params.token, + abi: ERC20_ALLOWANCE_ABI, + functionName: 'allowance', + args: [params.owner, params.spender], + })) as bigint; + return allowance.toString(); } ) .build(); -const evm = new NamespaceBuilder('EVM', WALLET_ID) - .action(connect) - .action(disconnect) - .action(getChainId) - .action(getAllowance) - .action(getTransactionReceipt) - .build(); +const buildEvm = (rpcUrl: string) => + new NamespaceBuilder('EVM', WALLET_ID) + .action(connect) + .action(disconnect) + .action(getChainId) + .action(getAllowance) + // Every public action except the receipt ones, which are picked below. + .action(viemPublicAdapter(rpcUrl)) + .action( + viemPublicActions(rpcUrl, [ + 'getTransactionReceipt', + 'waitForTransactionReceipt', + ]) + ) + // Signed on the device, see `signers/ethereum.ts`. + .action('sendTransaction', sendTransaction) + .action('signMessage', signMessage) + .build(); -export { evm }; +export { buildEvm }; diff --git a/wallets/provider-ledger/src/provider.ts b/wallets/provider-ledger/src/provider.ts index 1351fa110a..b7e44b4d68 100644 --- a/wallets/provider-ledger/src/provider.ts +++ b/wallets/provider-ledger/src/provider.ts @@ -1,12 +1,18 @@ +import type { NamespacesRPCUrls } from '@hub3js/namespaces'; + import { ProviderBuilder } from '@hub3js/core'; import { metadata, WALLET_ID } from './constants.js'; -import { evm } from './namespaces/evm.js'; +import { buildEvm } from './namespaces/evm.js'; import { solana } from './namespaces/solana.js'; import { ledger as ledgerInstance } from './utils.js'; -const buildProvider = () => - new ProviderBuilder(WALLET_ID) +const buildProvider = (rpcURLs: NamespacesRPCUrls) => { + if (!rpcURLs?.evm) { + throw new Error('An RPC URL for the EVM namespace is required.'); + } + + return new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); @@ -16,7 +22,8 @@ const buildProvider = () => }) .config('metadata', metadata) .add('solana', solana) - .add('evm', evm) + .add('evm', buildEvm(rpcURLs.evm)) .build(); +}; export { buildProvider }; diff --git a/wallets/provider-ledger/src/signer.ts b/wallets/provider-ledger/src/signer.ts index 201a9fe140..4aa676e619 100644 --- a/wallets/provider-ledger/src/signer.ts +++ b/wallets/provider-ledger/src/signer.ts @@ -2,12 +2,10 @@ import type { SignerFactory } from 'rango-types'; import { DefaultSignerFactory, TransactionType as TxType } from 'rango-types'; -import { EthereumSigner } from './signers/ethereum'; import { SolanaSigner } from './signers/solana'; export default async function getSigners(): Promise { const signers = new DefaultSignerFactory(); - signers.registerSigner(TxType.EVM, new EthereumSigner()); signers.registerSigner(TxType.SOLANA, new SolanaSigner()); return signers; } diff --git a/wallets/provider-ledger/src/signers/ethereum.ts b/wallets/provider-ledger/src/signers/ethereum.ts index a2deef4e21..0a9e2834e6 100644 --- a/wallets/provider-ledger/src/signers/ethereum.ts +++ b/wallets/provider-ledger/src/signers/ethereum.ts @@ -1,11 +1,11 @@ -import type { FeeData, TransactionLike } from 'ethers'; -import type { GenericSigner } from 'rango-types'; -import type { EvmTransaction } from 'rango-types/mainApi'; +import type { Context, FunctionWithContext } from '@hub3js/core'; +import type { EvmActions } from '@hub3js/evm'; +import type { TransactionLike } from 'ethers'; -import { getEthereumRpcUrl } from '@rango-dev/signer-evm'; -import { JsonRpcProvider, Transaction } from 'ethers'; +import { Transaction } from 'ethers'; import { SignerError, SignerErrorCode } from 'rango-types'; +import { ETHEREUM_CHAIN_ID } from '../constants.js'; import { getDerivationPath } from '../state.js'; import { getLedgerError, @@ -13,9 +13,19 @@ import { transportDisconnect, } from '../utils.js'; -/** Whether a transaction already prices itself under either scheme. */ -function hasGasPricing(tx: EvmTransaction): boolean { - return !!tx.gasPrice || (!!tx.maxFeePerGas && !!tx.maxPriorityFeePerGas); +type Pricing = { + gasPrice: bigint | null; + maxFeePerGas: bigint | null; + maxPriorityFeePerGas: bigint | null; +}; + +const ZERO = BigInt(0); + +function getAddress(account: unknown): `0x${string}` { + if (typeof account === 'string') { + return account as `0x${string}`; + } + return (account as { address: `0x${string}` }).address; } /** @@ -23,133 +33,161 @@ function hasGasPricing(tx: EvmTransaction): boolean { * exclusive in a signed transaction, so EIP-1559 is used wherever the chain * quotes it and a legacy price is the fallback. */ -function pricingFromFeeData(fees: FeeData) { - if (fees.maxFeePerGas && fees.maxPriorityFeePerGas) { +async function getPricingFromNode( + context: Context +): Promise { + try { + const fees = (await context.action('estimateFeesPerGas')) as { + maxFeePerGas: bigint; + maxPriorityFeePerGas: bigint; + }; return { gasPrice: null, - maxFeePerGas: fees.maxFeePerGas.toString(), - maxPriorityFeePerGas: fees.maxPriorityFeePerGas.toString(), + maxFeePerGas: fees.maxFeePerGas, + maxPriorityFeePerGas: fees.maxPriorityFeePerGas, + }; + } catch { + return { + gasPrice: (await context.action('getGasPrice')) as bigint, + maxFeePerGas: null, + maxPriorityFeePerGas: null, }; } - - return { - gasPrice: fees.gasPrice?.toString() ?? null, - maxFeePerGas: null, - maxPriorityFeePerGas: null, - }; } -export class EthereumSigner implements GenericSigner { - async signMessage(msg: string): Promise { - try { - const transport = await transportConnect(); - const LedgerAppEth = (await import('@ledgerhq/hw-app-eth')).default; - const eth = new LedgerAppEth(transport); - - const result = await eth.signPersonalMessage( - getDerivationPath(), - Buffer.from(msg).toString('hex') - ); - // eslint-disable-next-line @typescript-eslint/no-magic-numbers - let v = (result['v'] - 27).toString(16); - if (v.length < 2) { - v = '0' + v; - } - return '0x' + result['r'] + result['s'] + v; - } catch (error) { - throw new SignerError(SignerErrorCode.SIGN_TX_ERROR, undefined, error); - } +export const signMessage: FunctionWithContext< + EvmActions['signMessage'], + Context +> = async (_context, params) => { + const message = params?.message; + if (typeof message !== 'string') { + throw new SignerError( + SignerErrorCode.SIGN_TX_ERROR, + undefined, + 'Ledger can only sign text messages.' + ); } - async signAndSendTx( - tx: EvmTransaction, - fromAddress: string, - chainId: string | null - ): Promise<{ hash: string }> { - try { - const provider = new JsonRpcProvider(getEthereumRpcUrl()); // Provider to broadcast transaction - - const transactionCount = await provider.getTransactionCount(fromAddress); // Get nonce - - /* - * Ledger signs a raw transaction on-device and does not estimate gas, so - * a limit has to be present. Server-built transactions arrive with one; - * client-built ones - approve prerequisites among them - do not, so it is - * estimated here. Everything else is taken as the transaction sends it. - */ - const gasLimit = - tx.gasLimit ?? - ( - await provider.estimateGas({ - from: fromAddress, - to: tx.to, - data: tx.data ?? undefined, - value: tx.value ?? undefined, - }) - ).toString(); - - /* - * Whatever pricing the transaction came with wins - a server-built one - * always carries it, and it is signed with exactly what it was created - * with. Only a client-built transaction, which leaves both schemes null, - * is priced from the node. - */ - const pricing = hasGasPricing(tx) - ? { - gasPrice: tx.gasPrice, - maxFeePerGas: tx.maxFeePerGas, - maxPriorityFeePerGas: tx.maxPriorityFeePerGas, - } - : pricingFromFeeData(await provider.getFeeData()); - - const transaction: TransactionLike = { - to: tx.to, - gasPrice: pricing.gasPrice, - gasLimit, - nonce: transactionCount, - chainId: chainId, - data: tx.data, - value: tx.value, - maxPriorityFeePerGas: pricing.maxPriorityFeePerGas, - maxFeePerGas: pricing.maxFeePerGas, - }; - - const unsignedTx = - Transaction.from(transaction).unsignedSerialized.substring(2); // Create unsigned transaction - - const transport = await transportConnect(); - const LedgerHqAppEth = await import('@ledgerhq/hw-app-eth'); - - const LedgerAppEth = LedgerHqAppEth.default; - const eth = new LedgerAppEth(transport); - - const resolution = await LedgerHqAppEth.ledgerService.resolveTransaction( - unsignedTx, - {}, - {} - ); // metadata necessary to allow the device to clear sign information - const signature = await eth.signTransaction( - getDerivationPath(), - unsignedTx, - resolution - ); - - const signedTx = Transaction.from({ - ...transaction, - signature: { - r: '0x' + signature.r, - s: '0x' + signature.s, - v: parseInt(signature.v), - }, - }).serialized; - - const broadcastResult = await provider.broadcastTransaction(signedTx); - - return { hash: broadcastResult.hash }; - } catch (error) { - throw getLedgerError(error); - } finally { - await transportDisconnect(); + try { + const transport = await transportConnect(); + const LedgerAppEth = (await import('@ledgerhq/hw-app-eth')).default; + const eth = new LedgerAppEth(transport); + + const result = await eth.signPersonalMessage( + getDerivationPath(), + Buffer.from(message).toString('hex') + ); + // eslint-disable-next-line @typescript-eslint/no-magic-numbers + let v = (result['v'] - 27).toString(16); + if (v.length < 2) { + v = '0' + v; } + return `0x${result['r']}${result['s']}${v}`; + } catch (error) { + throw new SignerError(SignerErrorCode.SIGN_TX_ERROR, undefined, error); } -} +}; + +/** + * Ledger has no injected provider: the transaction is completed through the + * namespace's public client, signed on the device, then broadcast. + */ +export const sendTransaction: FunctionWithContext< + EvmActions['sendTransaction'], + Context +> = async (context, request) => { + if (!request) { + throw new Error('A transaction is required.'); + } + const from = getAddress(request.account); + const { to, data, value } = request; + + try { + const nonce = + request.nonce ?? + ((await context.action('getTransactionCount', { + address: from, + })) as number); + + /* + * Ledger signs a raw transaction on-device and does not estimate gas, so + * a limit has to be present. Server-built transactions arrive with one; + * client-built ones - approve prerequisites among them - do not, so it is + * estimated here. Everything else is taken as the transaction sends it. + */ + const gasLimit = + request.gas ?? + ((await context.action('estimateGas', { + account: from, + to, + data, + value, + })) as bigint); + + /* + * Whatever pricing the transaction came with wins - a server-built one + * always carries it, and it is signed with exactly what it was created + * with. Only a client-built transaction, which leaves both schemes null, + * is priced from the node. + */ + const hasPricing = + !!request.gasPrice || + (!!request.maxFeePerGas && !!request.maxPriorityFeePerGas); + const pricing: Pricing = hasPricing + ? { + gasPrice: request.gasPrice ?? null, + maxFeePerGas: request.maxFeePerGas ?? null, + maxPriorityFeePerGas: request.maxPriorityFeePerGas ?? null, + } + : await getPricingFromNode(context); + + const transaction: TransactionLike = { + to: to ?? null, + gasPrice: pricing.gasPrice, + gasLimit, + nonce, + chainId: ETHEREUM_CHAIN_ID, + data: data ?? '0x', + value: value ?? ZERO, + maxPriorityFeePerGas: pricing.maxPriorityFeePerGas, + maxFeePerGas: pricing.maxFeePerGas, + }; + + const unsignedTx = + Transaction.from(transaction).unsignedSerialized.substring(2); // Create unsigned transaction + + const transport = await transportConnect(); + const LedgerHqAppEth = await import('@ledgerhq/hw-app-eth'); + + const LedgerAppEth = LedgerHqAppEth.default; + const eth = new LedgerAppEth(transport); + + const resolution = await LedgerHqAppEth.ledgerService.resolveTransaction( + unsignedTx, + {}, + {} + ); // metadata necessary to allow the device to clear sign information + const signature = await eth.signTransaction( + getDerivationPath(), + unsignedTx, + resolution + ); + + const signedTx = Transaction.from({ + ...transaction, + signature: { + r: '0x' + signature.r, + s: '0x' + signature.s, + v: parseInt(signature.v), + }, + }).serialized as `0x${string}`; + + return (await context.action('sendRawTransaction', { + serializedTransaction: signedTx, + })) as `0x${string}`; + } catch (error) { + throw getLedgerError(error); + } finally { + await transportDisconnect(); + } +}; diff --git a/wallets/provider-ledger/src/utils.ts b/wallets/provider-ledger/src/utils.ts index bc152adbca..9982c31414 100644 --- a/wallets/provider-ledger/src/utils.ts +++ b/wallets/provider-ledger/src/utils.ts @@ -4,9 +4,7 @@ import { getErrorMessage, Hub3Error } from '@hub3js/core'; import { EVM_NAMESPACE, SOLANA_NAMESPACE } from '@hub3js/namespaces'; import { CAIP_SOLANA_CHAIN_ID } from '@hub3js/solana'; import { getAltStatusMessage } from '@ledgerhq/errors'; -import { getEthereumRpcUrl } from '@rango-dev/signer-evm'; import bs58 from 'bs58'; -import { JsonRpcProvider } from 'ethers'; import { ETHEREUM_CHAIN_ID, @@ -17,23 +15,6 @@ import { getDerivationPath } from './state.js'; export type Provider = Map; -/** - * Ledger EVM is Ethereum-only today and has no injected provider, so a single - * JSON-RPC provider over the Ethereum endpoint serves both the signer (nonce + - * broadcast) and the read-only namespace actions (allowance, receipt). - * - * NOTE: If Ledger EVM support ever expands beyond Ethereum, this must select - * the RPC per chain instead of the single Ethereum endpoint. - */ -let evmRpcProvider: { url: string; provider: JsonRpcProvider } | undefined; -export function getEvmRpcProvider(): JsonRpcProvider { - const url = getEthereumRpcUrl(); - if (evmRpcProvider?.url !== url) { - evmRpcProvider = { url, provider: new JsonRpcProvider(url) }; - } - return evmRpcProvider.provider; -} - type DeviceAccounts = { accounts: string[]; chainId: string; diff --git a/wallets/provider-trezor/src/namespaces/evm.ts b/wallets/provider-trezor/src/namespaces/evm.ts index fe5f7b9a2a..776cfbe39c 100644 --- a/wallets/provider-trezor/src/namespaces/evm.ts +++ b/wallets/provider-trezor/src/namespaces/evm.ts @@ -1,28 +1,37 @@ import type { Context } from '@hub3js/core'; -import type { - AllowanceParams, - EvmActions, - EvmTransactionReceipt, -} from '@hub3js/evm'; +import type { AllowanceParams, EvmActions } from '@hub3js/evm'; import { Hub3Error, NamespaceBuilder } from '@hub3js/core'; -import { builders, utils } from '@hub3js/evm'; +import { + builders, + utils, + viemPublicActions, + viemPublicAdapter, +} from '@hub3js/evm'; import * as commonBuilders from '@hub3js/std/builders'; import { standardizeAndThrowError } from '@hub3js/std/operators'; -import { Contract, toBeHex } from 'ethers'; import { ETHEREUM_CHAIN_ID, WALLET_ID } from '../constants.js'; import { initTrezor } from '../init.js'; +import { sendTransaction, signMessage } from '../signers/ethereum.js'; import { setDerivationPath } from '../state.js'; import { getEthereumAccounts, - getEvmRpcProvider, getTrezorNormalizedDerivationPath, } from '../utils.js'; const ERC20_ALLOWANCE_ABI = [ - 'function allowance(address owner, address spender) view returns (uint256)', -]; + { + type: 'function', + name: 'allowance', + stateMutability: 'view', + inputs: [ + { name: 'owner', type: 'address' }, + { name: 'spender', type: 'address' }, + ], + outputs: [{ name: '', type: 'uint256' }], + }, +] as const; const connect = builders .connect() @@ -62,58 +71,44 @@ const getChainId = builders .build(); /* - * Trezor injects no EIP-1193 provider, so these read actions talk to the shared - * JSON-RPC provider directly rather than through the default hub3js/evm actions. + * Trezor injects no EIP-1193 provider, so the allowance is read with the public + * client's `readContract`, which `buildEvm` registers. */ const getAllowance = builders .getAllowance() .action( async ( - _context: Context, + context: Context, params: AllowanceParams ): Promise => { - const token = new Contract( - params.token, - ERC20_ALLOWANCE_ABI, - getEvmRpcProvider() - ); - const currentAllowance: bigint = await token.allowance( - params.owner, - params.spender - ); - return currentAllowance.toString(); + const allowance = (await context.action('readContract', { + address: params.token, + abi: ERC20_ALLOWANCE_ABI, + functionName: 'allowance', + args: [params.owner, params.spender], + })) as bigint; + return allowance.toString(); } ) .build(); -const getTransactionReceipt = builders - .getTransactionReceipt() - .action( - async ( - _context: Context, - transactionHash: `0x${string}` - ): Promise => { - const receipt = await getEvmRpcProvider().getTransactionReceipt( - transactionHash - ); - if (!receipt) { - return null; - } - return { - status: receipt.status === 1 ? '0x1' : '0x0', - transactionHash: receipt.hash, - blockNumber: toBeHex(receipt.blockNumber), - }; - } - ) - .build(); - -const evm = new NamespaceBuilder('EVM', WALLET_ID) - .action(connect) - .action(disconnect) - .action(getChainId) - .action(getAllowance) - .action(getTransactionReceipt) - .build(); +const buildEvm = (rpcUrl: string) => + new NamespaceBuilder('EVM', WALLET_ID) + .action(connect) + .action(disconnect) + .action(getChainId) + .action(getAllowance) + // Every public action except the receipt ones, which are picked below. + .action(viemPublicAdapter(rpcUrl)) + .action( + viemPublicActions(rpcUrl, [ + 'getTransactionReceipt', + 'waitForTransactionReceipt', + ]) + ) + // Signed on the device, see `signers/ethereum.ts`. + .action('sendTransaction', sendTransaction) + .action('signMessage', signMessage) + .build(); -export { evm }; +export { buildEvm }; diff --git a/wallets/provider-trezor/src/provider.ts b/wallets/provider-trezor/src/provider.ts index 381c697908..b835082c25 100644 --- a/wallets/provider-trezor/src/provider.ts +++ b/wallets/provider-trezor/src/provider.ts @@ -1,17 +1,22 @@ import type { Environments } from './types.js'; +import type { NamespacesRPCUrls } from '@hub3js/namespaces'; import { ProviderBuilder } from '@hub3js/core'; import { metadata, WALLET_ID } from './constants.js'; -import { evm } from './namespaces/evm.js'; +import { buildEvm } from './namespaces/evm.js'; import { utxo } from './namespaces/utxo.js'; let trezorManifest: Environments['manifest']; export const getTrezorManifest = () => trezorManifest; -const buildProvider = () => - new ProviderBuilder(WALLET_ID) +const buildProvider = (rpcURLs: NamespacesRPCUrls) => { + if (!rpcURLs?.evm) { + throw new Error('An RPC URL for the EVM namespace is required.'); + } + + return new ProviderBuilder(WALLET_ID) .init(function (context, environments: Environments) { const [, setState] = context.state(); @@ -24,8 +29,9 @@ const buildProvider = () => console.debug('[trezor] instance detected.', context); }) .config('metadata', metadata) - .add('evm', evm) + .add('evm', buildEvm(rpcURLs.evm)) .add('utxo', utxo) .build(); +}; export { buildProvider }; diff --git a/wallets/provider-trezor/src/signer.ts b/wallets/provider-trezor/src/signer.ts index 5cc9f2a888..82da303112 100644 --- a/wallets/provider-trezor/src/signer.ts +++ b/wallets/provider-trezor/src/signer.ts @@ -4,9 +4,7 @@ import { DefaultSignerFactory, TransactionType as TxType } from 'rango-types'; export default async function getSigners(): Promise { const signers = new DefaultSignerFactory(); - const { EthereumSigner } = await import('./signers/ethereum.js'); const { BTCSigner } = await import('./signers/utxo.js'); - signers.registerSigner(TxType.EVM, new EthereumSigner()); signers.registerSigner(TxType.TRANSFER, new BTCSigner()); return signers; } diff --git a/wallets/provider-trezor/src/signers/ethereum.ts b/wallets/provider-trezor/src/signers/ethereum.ts index 1d5e14b094..38b5507dd4 100644 --- a/wallets/provider-trezor/src/signers/ethereum.ts +++ b/wallets/provider-trezor/src/signers/ethereum.ts @@ -1,20 +1,31 @@ -import type { FeeData } from 'ethers'; -import type { EvmTransaction } from 'rango-types/mainApi'; +import type { Context, FunctionWithContext } from '@hub3js/core'; +import type { EvmActions } from '@hub3js/evm'; -import { - cleanEvmError, - getEthereumRpcUrl, - toHexQuantity, -} from '@rango-dev/signer-evm'; -import { JsonRpcProvider, Transaction } from 'ethers'; -import { type GenericSigner } from 'rango-types'; +import { Transaction } from 'ethers'; +import { ETHEREUM_CHAIN_ID } from '../constants.js'; import { getDerivationPath } from '../state.js'; import { getTrezorModule, trezorErrorMessages } from '../utils.js'; -/** Whether a transaction already prices itself under either scheme. */ -function hasGasPricing(tx: EvmTransaction): boolean { - return !!tx.gasPrice || (!!tx.maxFeePerGas && !!tx.maxPriorityFeePerGas); +type Pricing = { + gasPrice: bigint | null; + maxFeePerGas: bigint | null; + maxPriorityFeePerGas: bigint | null; +}; + +const ZERO = BigInt(0); + +const HEXADECIMAL_BASE = 16; + +/** TrezorConnect parses quantities as hex. */ +const toHexQuantity = (value: bigint | number): string => + `0x${value.toString(HEXADECIMAL_BASE)}`; + +function getAddress(account: unknown): `0x${string}` { + if (typeof account === 'string') { + return account as `0x${string}`; + } + return (account as { address: `0x${string}` }).address; } /** @@ -22,23 +33,29 @@ function hasGasPricing(tx: EvmTransaction): boolean { * exclusive in a signed transaction, so EIP-1559 is used wherever the chain * quotes it and a legacy price is the fallback. */ -function pricingFromFeeData(fees: FeeData) { - if (fees.maxFeePerGas && fees.maxPriorityFeePerGas) { +async function getPricingFromNode( + context: Context +): Promise { + try { + const fees = (await context.action('estimateFeesPerGas')) as { + maxFeePerGas: bigint; + maxPriorityFeePerGas: bigint; + }; return { gasPrice: null, - maxFeePerGas: fees.maxFeePerGas.toString(), - maxPriorityFeePerGas: fees.maxPriorityFeePerGas.toString(), + maxFeePerGas: fees.maxFeePerGas, + maxPriorityFeePerGas: fees.maxPriorityFeePerGas, + }; + } catch { + return { + gasPrice: (await context.action('getGasPrice')) as bigint, + maxFeePerGas: null, + maxPriorityFeePerGas: null, }; } - - return { - gasPrice: fees.gasPrice?.toString() ?? null, - maxFeePerGas: null, - maxPriorityFeePerGas: null, - }; } -export function getTrezorErrorMessage(error: unknown) { +function getTrezorErrorMessage(error: unknown) { if ( typeof error === 'object' && error !== null && @@ -51,119 +68,140 @@ export function getTrezorErrorMessage(error: unknown) { */ return new Error(error.shortMessage, { cause: error }); } - return cleanEvmError(error); + return error; } -export class EthereumSigner implements GenericSigner { - async signMessage(msg: string): Promise { +export const signMessage: FunctionWithContext< + EvmActions['signMessage'], + Context +> = async (_context, params) => { + const message = params?.message; + if (typeof message !== 'string') { + throw new Error('Trezor can only sign text messages.'); + } + + const TrezorConnect = await getTrezorModule(); + + const { success, payload } = await TrezorConnect.ethereumSignMessage({ + message, + path: getDerivationPath(), + }); + if (!success) { + throw new Error(payload.error); + } + return payload.signature as `0x${string}`; +}; + +/** + * Trezor has no injected provider: the transaction is completed through the + * namespace's public client, signed on the device, then broadcast. + */ +export const sendTransaction: FunctionWithContext< + EvmActions['sendTransaction'], + Context +> = async (context, request) => { + if (!request) { + throw new Error('A transaction is required.'); + } + const from = getAddress(request.account); + const { to, data, value } = request; + + try { const TrezorConnect = await getTrezorModule(); - const { success, payload } = await TrezorConnect.ethereumSignMessage({ - message: msg, + const nonce = + request.nonce ?? + ((await context.action('getTransactionCount', { + address: from, + })) as number); + + /* + * Trezor signs a raw transaction on-device and does not estimate gas, so + * a limit has to be present. Server-built transactions arrive with one; + * client-built ones - approve prerequisites among them - do not, so it is + * estimated here. Everything else is taken as the transaction sends it. + */ + const gasLimit = + request.gas ?? + ((await context.action('estimateGas', { + account: from, + to, + data, + value, + })) as bigint); + + /* + * Whatever pricing the transaction came with wins - a server-built one + * always carries it, and it is signed with exactly what it was created + * with. Only a client-built transaction, which leaves both schemes null, + * is priced from the node. + */ + const hasPricing = + !!request.gasPrice || + (!!request.maxFeePerGas && !!request.maxPriorityFeePerGas); + const pricing: Pricing = hasPricing + ? { + gasPrice: request.gasPrice ?? null, + maxFeePerGas: request.maxFeePerGas ?? null, + maxPriorityFeePerGas: request.maxPriorityFeePerGas ?? null, + } + : await getPricingFromNode(context); + + const isEIP1559 = !!pricing.maxFeePerGas && !!pricing.maxPriorityFeePerGas; + + if (!isEIP1559 && !pricing.gasPrice) { + throw new Error('Missing gasPrice'); + } + + const additionalFields = isEIP1559 + ? { + maxFeePerGas: toHexQuantity(pricing.maxFeePerGas ?? ZERO), + maxPriorityFeePerGas: toHexQuantity( + pricing.maxPriorityFeePerGas ?? ZERO + ), + } + : { + gasPrice: toHexQuantity(pricing.gasPrice ?? ZERO), + }; + + const transaction = { + to: to ?? null, + data: data ?? '0x', + value: toHexQuantity(value ?? ZERO), + gasLimit: toHexQuantity(gasLimit), + chainId: Number(ETHEREUM_CHAIN_ID), + nonce: toHexQuantity(nonce), + ...additionalFields, + }; + + const { success, payload } = await TrezorConnect.ethereumSignTransaction({ path: getDerivationPath(), + transaction, }); + if (!success) { - throw new Error(payload.error); + const errorMessage = + trezorErrorMessages[payload?.code || ''] || payload.error; + throw new Error(errorMessage); } - return payload.signature; - } - - async signAndSendTx( - tx: EvmTransaction, - fromAddress: string, - chainId: string - ): Promise<{ hash: string }> { - try { - const TrezorConnect = await getTrezorModule(); - const provider = new JsonRpcProvider(getEthereumRpcUrl()); // Provider to broadcast transaction - const transactionCount = await provider.getTransactionCount(fromAddress); // Get nonce + const { r, s, v } = payload; + const serializedTx = Transaction.from({ + ...transaction, + nonce: Number.parseInt(transaction.nonce), /* - * Trezor signs a raw transaction on-device and does not estimate gas, so - * a limit has to be present. Server-built transactions arrive with one; - * client-built ones - approve prerequisites among them - do not, so it is - * estimated here. Everything else is taken as the transaction sends it. + * Type 0: This refers to the legacy transaction type that has been used since Ethereum's inception. + * Type 2: This refers to the new transaction type introduced with the EIP-1559 (Ethereum Improvement Proposal 1559) update, + * which was part of the London hard fork. */ - const gasLimit = - tx.gasLimit ?? - ( - await provider.estimateGas({ - from: fromAddress, - to: tx.to, - data: tx.data ?? undefined, - value: tx.value ?? undefined, - }) - ).toString(); - /* - * Whatever pricing the transaction came with wins - a server-built one - * always carries it, and it is signed with exactly what it was created - * with. Only a client-built transaction, which leaves both schemes null, - * is priced from the node. - */ - const pricing = hasGasPricing(tx) - ? { - gasPrice: tx.gasPrice, - maxFeePerGas: tx.maxFeePerGas, - maxPriorityFeePerGas: tx.maxPriorityFeePerGas, - } - : pricingFromFeeData(await provider.getFeeData()); - - const isEIP1559 = - !!pricing.maxFeePerGas && !!pricing.maxPriorityFeePerGas; - - if (!isEIP1559 && !pricing.gasPrice) { - throw new Error('Missing gasPrice'); - } - - const additionalFields = isEIP1559 - ? { - maxFeePerGas: toHexQuantity(pricing.maxFeePerGas || '0'), - maxPriorityFeePerGas: toHexQuantity( - pricing.maxPriorityFeePerGas || '0' - ), - } - : { - gasPrice: toHexQuantity(pricing.gasPrice || '0'), - }; - - const transaction = { - to: tx.to, - data: tx.data || '0x', - value: toHexQuantity(tx.value?.toString() || '0'), - gasLimit: toHexQuantity(gasLimit), - chainId: Number.parseInt(chainId), - nonce: toHexQuantity(transactionCount.toString()), - ...additionalFields, - }; - - const { success, payload } = await TrezorConnect.ethereumSignTransaction({ - path: getDerivationPath(), - transaction, - }); - - if (!success) { - const errorMessage = - trezorErrorMessages[payload?.code || ''] || payload.error; - throw new Error(errorMessage); - } - const { r, s, v } = payload; - - const serializedTx = Transaction.from({ - ...transaction, - nonce: Number.parseInt(transaction.nonce), - /* - * Type 0: This refers to the legacy transaction type that has been used since Ethereum's inception. - * Type 2: This refers to the new transaction type introduced with the EIP-1559 (Ethereum Improvement Proposal 1559) update, - * which was part of the London hard fork. - */ - type: isEIP1559 ? 2 : 0, - signature: { r, s, v: parseInt(v) }, - }).serialized; - const broadcastResult = await provider.broadcastTransaction(serializedTx); - - return { hash: broadcastResult.hash }; - } catch (error) { - throw getTrezorErrorMessage(error); - } + type: isEIP1559 ? 2 : 0, + signature: { r, s, v: parseInt(v) }, + }).serialized as `0x${string}`; + + return (await context.action('sendRawTransaction', { + serializedTransaction: serializedTx, + })) as `0x${string}`; + } catch (error) { + throw getTrezorErrorMessage(error); } -} +}; diff --git a/wallets/provider-trezor/src/utils.ts b/wallets/provider-trezor/src/utils.ts index 8b0c7ca058..6ad9d0d960 100644 --- a/wallets/provider-trezor/src/utils.ts +++ b/wallets/provider-trezor/src/utils.ts @@ -1,8 +1,6 @@ import type { TrezorConnect } from '@trezor/connect-web'; import { Hub3Error } from '@hub3js/core'; -import { getEthereumRpcUrl } from '@rango-dev/signer-evm'; -import { JsonRpcProvider } from 'ethers'; import { ETHEREUM_CHAIN_ID, @@ -16,23 +14,6 @@ type DeviceAccounts = { derivationPath: string; }; -/** - * Trezor EVM is Ethereum-only today and has no injected provider, so a single - * JSON-RPC provider over the Ethereum endpoint serves both the signer (nonce + - * broadcast) and the read-only namespace actions (allowance, receipt). - * - * NOTE: If Trezor EVM support ever expands beyond Ethereum, this must select - * the RPC per chain instead of the single Ethereum endpoint. - */ -let evmRpcProvider: { url: string; provider: JsonRpcProvider } | undefined; -export function getEvmRpcProvider(): JsonRpcProvider { - const url = getEthereumRpcUrl(); - if (evmRpcProvider?.url !== url) { - evmRpcProvider = { url, provider: new JsonRpcProvider(url) }; - } - return evmRpcProvider.provider; -} - // Trezor resolves a failed connect call instead of throwing; its `code`, not its `error` text, says whether the user cancelled. export function throwTrezorConnectionError(payload: { error: string; From 5167ce21ed1d47168fd26f5e8173192f6f167bcc Mon Sep 17 00:00:00 2001 From: arlert-armin Date: Tue, 6 Oct 2026 19:50:37 +0000 Subject: [PATCH 03/29] feat(wallets): move safe and ledger wallet evm signing onto their namespaces Both now send through viem's wallet actions. Safe resolves its safeTxHash to the on-chain hash with a `resolveTransactionHash` namespace action and signs messages off-chain through its SDK. Their EVM signers are removed. --- .../provider-ledger-wallet/src/constants.ts | 6 - .../src/namespaces/evm.ts | 35 +++-- .../provider-ledger-wallet/src/provider.ts | 14 +- wallets/provider-ledger-wallet/src/signer.ts | 11 -- .../provider-ledger-wallet/src/signers/evm.ts | 143 ------------------ wallets/provider-safe/src/constants.ts | 7 - wallets/provider-safe/src/namespaces/evm.ts | 69 +++++++-- wallets/provider-safe/src/provider.ts | 15 +- wallets/provider-safe/src/signer.ts | 14 -- wallets/provider-safe/src/signers/evm.ts | 101 ------------- wallets/provider-safe/src/transactionHash.ts | 50 ++++++ 11 files changed, 155 insertions(+), 310 deletions(-) delete mode 100644 wallets/provider-ledger-wallet/src/signer.ts delete mode 100644 wallets/provider-ledger-wallet/src/signers/evm.ts delete mode 100644 wallets/provider-safe/src/signer.ts delete mode 100644 wallets/provider-safe/src/signers/evm.ts create mode 100644 wallets/provider-safe/src/transactionHash.ts diff --git a/wallets/provider-ledger-wallet/src/constants.ts b/wallets/provider-ledger-wallet/src/constants.ts index 1e7ab9575e..6452034fd5 100644 --- a/wallets/provider-ledger-wallet/src/constants.ts +++ b/wallets/provider-ledger-wallet/src/constants.ts @@ -15,8 +15,6 @@ import { } from '@hub3js/evm'; import { getChainIdFromCaip2ChainId } from '@hub3js/std/utils'; -import getSigners from './signer.js'; - export const WALLET_ID = 'ledger-wallet'; /* @@ -64,10 +62,6 @@ export const metadata: ProviderMetadata = { ], }, }, - { - name: 'signers', - value: { getSigners: async () => getSigners() }, - }, { name: 'details', value: { diff --git a/wallets/provider-ledger-wallet/src/namespaces/evm.ts b/wallets/provider-ledger-wallet/src/namespaces/evm.ts index 9f9f40c3b9..59376feb7d 100644 --- a/wallets/provider-ledger-wallet/src/namespaces/evm.ts +++ b/wallets/provider-ledger-wallet/src/namespaces/evm.ts @@ -2,7 +2,13 @@ import type { Context } from '@hub3js/core'; import type { Chain, ChainId, EvmActions } from '@hub3js/evm'; import { NamespaceBuilder } from '@hub3js/core'; -import { actions, builders, utils } from '@hub3js/evm'; +import { + actions, + builders, + utils, + viemPublicAdapter, + viemWalletAdapter, +} from '@hub3js/evm'; import * as commonBuilders from '@hub3js/std/builders'; import { standardizeAndThrowError } from '@hub3js/std/operators'; @@ -106,14 +112,23 @@ const getTransactionReceipt = builders .action(actions.getTransactionReceipt(getProvider)) .build(); -const evm = new NamespaceBuilder('EVM', WALLET_ID) - .action(connect) - .action(disconnect) - .action(canEagerConnect) - .action(canSwitchNetwork) - .action(getChainId) - .action(getAllowance) - .action(getTransactionReceipt) +const waitForTransactionReceipt = builders + .waitForTransactionReceipt() + .action(actions.waitForTransactionReceipt(getProvider)) .build(); -export { evm }; +const buildEvm = (rpcUrl: string) => + new NamespaceBuilder('EVM', WALLET_ID) + .action(connect) + .action(disconnect) + .action(canEagerConnect) + .action(canSwitchNetwork) + .action(getChainId) + .action(getAllowance) + .action(getTransactionReceipt) + .action(waitForTransactionReceipt) + .action(viemWalletAdapter(getProvider)) + .action(viemPublicAdapter(rpcUrl)) + .build(); + +export { buildEvm }; diff --git a/wallets/provider-ledger-wallet/src/provider.ts b/wallets/provider-ledger-wallet/src/provider.ts index 6a1bc95534..dd286d9461 100644 --- a/wallets/provider-ledger-wallet/src/provider.ts +++ b/wallets/provider-ledger-wallet/src/provider.ts @@ -1,17 +1,22 @@ import type { Environments } from './types.js'; import type { ProviderAPI } from '@hub3js/evm'; +import type { NamespacesRPCUrls } from '@hub3js/namespaces'; import type { EIP6963ProviderDetail } from '@ledgerhq/ledger-wallet-provider'; import { ProviderBuilder } from '@hub3js/core'; import { metadata, WALLET_ID } from './constants.js'; import { setProvider } from './ledgerProvider.js'; -import { evm } from './namespaces/evm.js'; +import { buildEvm } from './namespaces/evm.js'; const LEDGER_PROVIDER_NAME = 'Ledger Wallet'; -const buildProvider = () => - new ProviderBuilder(WALLET_ID) +const buildProvider = (rpcURLs: NamespacesRPCUrls) => { + if (!rpcURLs?.evm) { + throw new Error('An RPC URL for the EVM namespace is required.'); + } + + return new ProviderBuilder(WALLET_ID) .init(function (context, environments: Environments) { const [, setState] = context.state(); @@ -92,7 +97,8 @@ const buildProvider = () => }; }) .config('metadata', metadata) - .add('evm', evm) + .add('evm', buildEvm(rpcURLs.evm)) .build(); +}; export { buildProvider }; diff --git a/wallets/provider-ledger-wallet/src/signer.ts b/wallets/provider-ledger-wallet/src/signer.ts deleted file mode 100644 index 6192079114..0000000000 --- a/wallets/provider-ledger-wallet/src/signer.ts +++ /dev/null @@ -1,11 +0,0 @@ -import type { SignerFactory } from 'rango-types'; - -import { DefaultSignerFactory, TransactionType as TxType } from 'rango-types'; - -export default async function getSigners(): Promise { - const signers = new DefaultSignerFactory(); - const { CustomEvmSigner } = await import('./signers/evm.js'); - signers.registerSigner(TxType.EVM, new CustomEvmSigner()); - - return signers; -} diff --git a/wallets/provider-ledger-wallet/src/signers/evm.ts b/wallets/provider-ledger-wallet/src/signers/evm.ts deleted file mode 100644 index f9790dc4a8..0000000000 --- a/wallets/provider-ledger-wallet/src/signers/evm.ts +++ /dev/null @@ -1,143 +0,0 @@ -import type { TypedData } from '@rango-dev/signer-evm'; -import type { GenericSigner } from 'rango-types'; -import type { EvmTransaction } from 'rango-types/mainApi'; - -import { cleanEvmError, DefaultEvmSigner } from '@rango-dev/signer-evm'; - -import { getProvider } from '../ledgerProvider.js'; - -const HEXADECIMAL_BASE = 16; - -/* - * Ledger's eth_sendTransaction params (see EthSendTransactionParams): - * - use `gas`, not ethers' `gasLimit`. TransactionHelper only reads - * `transaction.gas` → ethers gasLimit; a `gasLimit` key is ignored. - * - quantities should be hex. Ledger parses nonce with parseInt(nonce, 16), - * so a decimal nonce would be wrong. Hex also keeps fees in JSON-RPC form. - * - * If gas + maxFeePerGas + maxPriorityFeePerGas are not all set, Ledger - * re-estimates and overwrites those three fields (EIP-1559). So for swaps we - * must pass the full triad when Rango provides EIP-1559 fees; otherwise Rango's - * gas limit is dropped. - * https://developers.ledger.com/docs/ledger-wallet-provider/api-reference - */ -type LedgerTransactionParams = { - data: string; - from?: string; - to?: string; - value?: string; - nonce?: string; - gas?: string; - gasPrice?: string; - maxFeePerGas?: string; - maxPriorityFeePerGas?: string; -}; - -/** Hex-encode a Rango quantity (`0x…` or decimal string). BigInt accepts both. */ -const toHexQuantity = (value: string): string => - '0x' + BigInt(value).toString(HEXADECIMAL_BASE); - -/* - * Map Rango's EvmTransaction to Ledger's JSON-RPC shape: gasLimit → gas, - * quantities hex-encoded, EIP-1559 preferred over legacy gasPrice. - */ -const buildLedgerTx = (tx: EvmTransaction): LedgerTransactionParams => { - /* - * Always send data and value: - * - data: `0x` instead of undefined (same as DefaultEvmSigner.buildTx). - * - value: Ledger's internal Transaction type requires value; omit it on - * zero-value txs (approvals) and fee estimation / serialization can - * break. Default to 0x0. - */ - const params: LedgerTransactionParams = { - data: tx.data || '0x', - value: tx.value ? toHexQuantity(tx.value) : '0x0', - }; - if (tx.from) { - params.from = tx.from; - } - if (tx.to) { - params.to = tx.to; - } - if (tx.nonce) { - params.nonce = toHexQuantity(tx.nonce); - } - if (tx.gasLimit) { - params.gas = toHexQuantity(tx.gasLimit); - } - if (tx.maxFeePerGas && tx.maxPriorityFeePerGas) { - params.maxFeePerGas = toHexQuantity(tx.maxFeePerGas); - params.maxPriorityFeePerGas = toHexQuantity(tx.maxPriorityFeePerGas); - } else if (tx.gasPrice) { - /* - * Legacy path: Ledger still requires maxFee* to skip re-estimation, so it - * will overwrite gas/fees with its own EIP-1559 estimate. We only forward - * gasPrice for wallets that honor it; do not expect Rango's gasLimit to - * stick on this path. - */ - params.gasPrice = toHexQuantity(tx.gasPrice); - } - return params; -}; - -/* - * Implement GenericSigner so signAndSendTx can return only `{ hash }` — - * Ledger's eth_sendTransaction never yields an ethers TransactionResponse. - * Delegate personal_sign / eth_signTypedData_v4 to DefaultEvmSigner (supported - * by Ledger). Do not use its signAndSendTx: ethers then polls - * eth_getTransactionByHash, which Ledger does not support. - */ -export class CustomEvmSigner implements GenericSigner { - private defaultEvmSigner: DefaultEvmSigner; - - constructor() { - /* - * Provider comes from the EIP-6963 announce stashed in ledgerProvider - * (getSigners runs after connect, so it should already be set). - */ - this.defaultEvmSigner = new DefaultEvmSigner(getProvider()); - } - - async signMessage(msg: string): Promise { - return await this.defaultEvmSigner.signMessage(msg); - } - - async signTypedData(typedData: TypedData): Promise { - return await this.defaultEvmSigner.signTypedData(typedData); - } - - async signAndSendTx( - tx: EvmTransaction, - /* - * Unused on purpose: - * - Ledger eth_sendTransaction does not validate tx.from against the - * selected account (unlike eth_signTypedData*), so an address check - * here cannot stop a wrong-account sign. - * - Network is enforced upstream by - * checkEnvironmentBeforeExecuteTransaction. - */ - _address: string, - _chainId: string | null - ): Promise<{ hash: string }> { - try { - const provider = getProvider(); - - const hash = await provider.request({ - method: 'eth_sendTransaction', - params: [buildLedgerTx(tx)], - }); - - return { hash }; - } catch (error) { - throw cleanEvmError(error); - } - } - - /* - * Tx is already broadcast; Ledger cannot serve getTransaction/receipts. - * Return the hash so checkStatus can continue via the API watcher. - */ - async wait(txHash: string): Promise<{ hash: string }> { - return { hash: txHash }; - } -} diff --git a/wallets/provider-safe/src/constants.ts b/wallets/provider-safe/src/constants.ts index 70a723815d..61c1e76dcd 100644 --- a/wallets/provider-safe/src/constants.ts +++ b/wallets/provider-safe/src/constants.ts @@ -2,9 +2,6 @@ import type { ProviderMetadata } from '@hub3js/core'; import { isEvmNamespace } from '@hub3js/evm'; -import getSigners from './signer.js'; -import { evmSafe } from './utils.js'; - export const WALLET_ID = 'safe'; export const metadata: ProviderMetadata = { @@ -32,9 +29,5 @@ export const metadata: ProviderMetadata = { name: 'details', value: { isContractWallet: true }, }, - { - name: 'signers', - value: { getSigners: async () => getSigners(evmSafe()) }, - }, ], }; diff --git a/wallets/provider-safe/src/namespaces/evm.ts b/wallets/provider-safe/src/namespaces/evm.ts index 73cd13e099..a266c482d9 100644 --- a/wallets/provider-safe/src/namespaces/evm.ts +++ b/wallets/provider-safe/src/namespaces/evm.ts @@ -1,11 +1,21 @@ +import type { Context, FunctionWithContext } from '@hub3js/core'; import type { EvmActions } from '@hub3js/evm'; +import type { OffChainSignMessageResponse } from '@safe-global/safe-apps-sdk'; import { NamespaceBuilder } from '@hub3js/core'; -import { actions, builders, hooks } from '@hub3js/evm'; +import { + actions, + builders, + hooks, + viemPublicAdapter, + viemWalletAdapter, +} from '@hub3js/evm'; import * as commonBuilders from '@hub3js/std/builders'; import { standardizeAndThrowError } from '@hub3js/std/operators'; import { WALLET_ID } from '../constants.js'; +import { sdk } from '../safe.js'; +import { resolveTransactionHash } from '../transactionHash.js'; import { evmSafe, getSafeAccounts } from '../utils.js'; const [changeAccountSubscriber, changeAccountCleanup] = @@ -49,14 +59,53 @@ const getTransactionReceipt = builders .action(actions.getTransactionReceipt(evmSafe)) .build(); -const evm = new NamespaceBuilder('EVM', WALLET_ID) - .action(connect) - .action(disconnect) - .action(canEagerConnect) - .action(canSwitchNetwork) - .action(getChainId) - .action(getAllowance) - .action(getTransactionReceipt) +const waitForTransactionReceipt = builders + .waitForTransactionReceipt() + .action(actions.waitForTransactionReceipt(evmSafe)) .build(); -export { evm }; +// Safe signs messages off-chain through its SDK. +const signMessage: FunctionWithContext< + EvmActions['signMessage'], + Context +> = async (_context, params) => { + const message = params?.message; + if (typeof message !== 'string') { + throw new Error('Safe can only sign text messages.'); + } + const { signature } = (await sdk.txs.signMessage( + message + )) as OffChainSignMessageResponse & { signature: `0x${string}` }; + return signature; +}; + +/* + * Safe's `sendTransaction` returns a safeTxHash. This extra action, which + * queue-manager looks up by name, maps it to the on-chain hash. + */ +const RESOLVE_TRANSACTION_HASH = 'resolveTransactionHash' as keyof EvmActions; +const resolveTransactionHashAction = (async ( + _context: Context, + hash: string +) => resolveTransactionHash(hash)) as unknown as FunctionWithContext< + EvmActions[keyof EvmActions], + Context +>; + +const buildEvm = (rpcUrl: string) => + new NamespaceBuilder('EVM', WALLET_ID) + .action(connect) + .action(disconnect) + .action(canEagerConnect) + .action(canSwitchNetwork) + .action(getChainId) + .action(getAllowance) + .action(getTransactionReceipt) + .action(waitForTransactionReceipt) + .action(viemWalletAdapter(evmSafe)) + .action(viemPublicAdapter(rpcUrl)) + .action('signMessage', signMessage) + .action(RESOLVE_TRANSACTION_HASH, resolveTransactionHashAction) + .build(); + +export { buildEvm }; diff --git a/wallets/provider-safe/src/provider.ts b/wallets/provider-safe/src/provider.ts index 0581f7b145..d3d68ab20d 100644 --- a/wallets/provider-safe/src/provider.ts +++ b/wallets/provider-safe/src/provider.ts @@ -1,11 +1,17 @@ +import type { NamespacesRPCUrls } from '@hub3js/namespaces'; + import { ProviderBuilder } from '@hub3js/core'; import { metadata, WALLET_ID } from './constants.js'; -import { evm } from './namespaces/evm.js'; +import { buildEvm } from './namespaces/evm.js'; import { initSafe } from './safe.js'; -const buildProvider = () => - new ProviderBuilder(WALLET_ID) +const buildProvider = (rpcURLs: NamespacesRPCUrls) => { + if (!rpcURLs?.evm) { + throw new Error('An RPC URL for the EVM namespace is required.'); + } + + return new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); @@ -24,7 +30,8 @@ const buildProvider = () => void detectSafe(); }) .config('metadata', metadata) - .add('evm', evm) + .add('evm', buildEvm(rpcURLs.evm)) .build(); +}; export { buildProvider }; diff --git a/wallets/provider-safe/src/signer.ts b/wallets/provider-safe/src/signer.ts deleted file mode 100644 index 7b152e56fc..0000000000 --- a/wallets/provider-safe/src/signer.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type { ProviderAPI } from '@hub3js/evm'; -import type { SignerFactory } from 'rango-types'; - -import { DefaultSignerFactory, TransactionType as TxType } from 'rango-types'; - -export default async function getSigners( - provider: ProviderAPI -): Promise { - const signers = new DefaultSignerFactory(); - const { CustomEvmSigner } = await import('./signers/evm.js'); - signers.registerSigner(TxType.EVM, new CustomEvmSigner(provider)); - - return signers; -} diff --git a/wallets/provider-safe/src/signers/evm.ts b/wallets/provider-safe/src/signers/evm.ts deleted file mode 100644 index fa9402b42a..0000000000 --- a/wallets/provider-safe/src/signers/evm.ts +++ /dev/null @@ -1,101 +0,0 @@ -import type { ProviderAPI } from '@hub3js/evm'; -import type { OffChainSignMessageResponse } from '@safe-global/safe-apps-sdk'; -import type { TransactionResponse } from 'ethers'; -import type { GenericSigner } from 'rango-types'; -import type { EvmTransaction } from 'rango-types/mainApi'; - -import { DefaultEvmSigner, waitMs } from '@rango-dev/signer-evm'; -import { TransactionStatus } from '@safe-global/safe-apps-sdk'; - -import { sdk } from '../safe.ts'; - -type SafeTransactionResponse = Partial & { - hashRequiringUpdate: boolean; -}; - -export async function getTxHash(safeHash: string): Promise<{ txHash: string }> { - let txHash; - const timeout = 5_000; - - while (!txHash) { - try { - /** The SDK will be pinged until a txHash is available and the txStatus is in an end-state */ - const queued = await sdk.txs.getBySafeTxHash(safeHash); - if ( - queued.txStatus === TransactionStatus.AWAITING_CONFIRMATIONS || - queued.txStatus === TransactionStatus.AWAITING_EXECUTION - ) { - /** Mimic a status watcher by checking once every 5 seconds */ - await waitMs(timeout); - } else if (queued.txHash) { - /** The txStatus is in an end-state (e.g. success) so we probably have a valid, on chain txHash*/ - txHash = queued.txHash; - } - } catch { - txHash = safeHash; - } - } - return { txHash }; -} - -export class CustomEvmSigner implements GenericSigner { - private signer; - - constructor(provider: ProviderAPI) { - this.signer = new DefaultEvmSigner(provider); - } - - async signMessage(msg: string): Promise { - const { signature } = (await sdk.txs.signMessage( - msg - )) as OffChainSignMessageResponse & { signature: string }; - - return signature; - } - - async signAndSendTx( - tx: EvmTransaction, - address: string, - chainId: string | null - ): Promise<{ hash: string; response: SafeTransactionResponse }> { - const { hash, response } = await this.signer.signAndSendTx( - tx, - address, - chainId - ); - return { - hash, - response: { ...response, hashRequiringUpdate: true }, - }; - } - - async wait( - safeHash: string, - chainId: string, - response: SafeTransactionResponse - ): Promise<{ - hash: string; - response: SafeTransactionResponse; - chainId: string; - }> { - /* - * `wait` is called on every status poll. On the first poll `safeHash` is the - * safeTxHash, which `getTxHash` maps to the on-chain hash; the queue then - * updates `executedTransactionId` to that on-chain hash. From the next poll - * onwards `wait` receives the on-chain hash, and querying the Safe gateway - * with it 404s (the gateway resolves by safeTxHash, not the on-chain hash), - * which makes Safe{Wallet} log a harmless `Code 901`. Once the hash no longer - * requires updating we already have the final hash, so skip the lookup. - */ - if (response && !response.hashRequiringUpdate) { - return { hash: safeHash, response, chainId }; - } - - const { txHash: hash } = await getTxHash(safeHash); - return { - hash, - response: { ...response, hashRequiringUpdate: false }, - chainId, - }; - } -} diff --git a/wallets/provider-safe/src/transactionHash.ts b/wallets/provider-safe/src/transactionHash.ts new file mode 100644 index 0000000000..dba5e2a4b1 --- /dev/null +++ b/wallets/provider-safe/src/transactionHash.ts @@ -0,0 +1,50 @@ +import { TransactionStatus } from '@safe-global/safe-apps-sdk'; + +import { sdk } from './safe.js'; + +const POLL_INTERVAL = 5_000; + +const waitMs = async (ms: number) => + new Promise((resolve) => setTimeout(resolve, ms)); + +/** + * On-chain hashes already resolved, so a later lookup with one of them skips + * the Safe gateway: it resolves by safeTxHash, and an on-chain hash makes + * Safe{Wallet} log a harmless `Code 901`. + */ +const resolvedHashes = new Set(); + +/** + * Safe's `eth_sendTransaction` returns a safeTxHash. This waits for the Safe + * transaction to reach an end state and returns its on-chain hash. + */ +export async function resolveTransactionHash( + safeHash: string +): Promise { + if (resolvedHashes.has(safeHash)) { + return safeHash; + } + + let txHash: string | undefined; + while (!txHash) { + try { + /** The SDK will be pinged until a txHash is available and the txStatus is in an end-state */ + const queued = await sdk.txs.getBySafeTxHash(safeHash); + if ( + queued.txStatus === TransactionStatus.AWAITING_CONFIRMATIONS || + queued.txStatus === TransactionStatus.AWAITING_EXECUTION + ) { + /** Mimic a status watcher by checking once every 5 seconds */ + await waitMs(POLL_INTERVAL); + } else if (queued.txHash) { + /** The txStatus is in an end-state (e.g. success) so we probably have a valid, on chain txHash*/ + txHash = queued.txHash; + } + } catch { + txHash = safeHash; + } + } + + resolvedHashes.add(txHash); + return txHash; +} From ab8cb938e966d5501949637da65428320bcc3248 Mon Sep 17 00:00:00 2001 From: arlert-armin Date: Tue, 6 Oct 2026 19:50:56 +0000 Subject: [PATCH 04/29] feat(wallets): expose an eip-1193 view of walletconnect 2 sessions to viem Methods the session negotiated go to the wallet over the relay, and reads go to a node for the session's active chain. viem's wallet actions and the receipt actions run on it, so the EVM signer is removed. --- .../src/adapter/adapter.ts | 60 +++-- .../provider-walletconnect-2/src/constants.ts | 6 - .../src/namespaces/evm/namespace.ts | 51 ++-- .../provider-walletconnect-2/src/provider.ts | 14 +- .../provider-walletconnect-2/src/signer.ts | 23 -- .../src/signers/evm.ts | 221 ------------------ wallets/provider-walletconnect-2/src/utils.ts | 8 - 7 files changed, 80 insertions(+), 303 deletions(-) delete mode 100644 wallets/provider-walletconnect-2/src/signer.ts delete mode 100644 wallets/provider-walletconnect-2/src/signers/evm.ts diff --git a/wallets/provider-walletconnect-2/src/adapter/adapter.ts b/wallets/provider-walletconnect-2/src/adapter/adapter.ts index 4114806149..72729411e5 100644 --- a/wallets/provider-walletconnect-2/src/adapter/adapter.ts +++ b/wallets/provider-walletconnect-2/src/adapter/adapter.ts @@ -1,16 +1,12 @@ import type { WalletConnectNamespace } from '../types.js'; -import type { - AllowanceParams, - Chain, - EvmTransactionReceipt, -} from '@hub3js/evm'; +import type { AllowanceParams, Chain, ProviderAPI } from '@hub3js/evm'; import type { SessionTypes } from '@walletconnect/types'; import type UniversalProvider from '@walletconnect/universal-provider'; import type { BlockchainMeta } from 'rango-types'; import { utils } from '@hub3js/evm'; import { debug } from '@rango-dev/logging-core'; -import { JsonRpcProvider, toBeHex } from 'ethers'; +import { JsonRpcProvider } from 'ethers'; import { ensureConnectedToChain as ensureConnectedToChainHelper, @@ -147,21 +143,47 @@ export class WalletConnectAdapter { return BigInt(result === '0x' ? 0 : result).toString(); } - /** Reads a transaction receipt from the active chain's node. */ - async getTransactionReceipt( - txHash: `0x${string}` - ): Promise { - const provider = await this.#getRpcProvider(); - const receipt = await provider.getTransactionReceipt(txHash); - if (!receipt) { - return null; - } + /** + * An EIP-1193 view of the EVM session, for viem and hub3's EVM actions. + * + * The methods the session negotiated go to the wallet over the relay, on the + * session's active chain. Everything else (reads such as + * `eth_getTransactionReceipt`) goes to a node for that chain, for the reasons + * given on `#getRpcProvider`. + */ + getEip1193Provider(): ProviderAPI { + const request = async ({ + method, + params, + }: { + method: string; + params?: unknown; + }): Promise => { + const session = this.getSession('evm'); + const negotiatedMethods = + session?.namespaces[NAMESPACES.ETHEREUM]?.methods; + + if (session && negotiatedMethods?.includes(method)) { + const reference = await this.resolveActiveChainReference(); + if (!reference) { + throw new Error( + 'Unable to determine EVM chain id from WalletConnect session.' + ); + } + + return (await this.getClient()).request({ + topic: session.topic, + chainId: `${NAMESPACES.ETHEREUM}:${reference}`, + request: { method, params }, + }); + } - return { - status: receipt.status === 1 ? '0x1' : '0x0', - transactionHash: receipt.hash, - blockNumber: toBeHex(receipt.blockNumber), + const provider = await this.#getRpcProvider(); + return provider.send(method, (params as unknown[] | undefined) ?? []); }; + + // Session events reach the namespace through its own hooks, not this view. + return { request } as unknown as ProviderAPI; } getSession(namespace: WalletConnectNamespace): SessionTypes.Struct | null { diff --git a/wallets/provider-walletconnect-2/src/constants.ts b/wallets/provider-walletconnect-2/src/constants.ts index 598e2b2918..51ac3d696c 100644 --- a/wallets/provider-walletconnect-2/src/constants.ts +++ b/wallets/provider-walletconnect-2/src/constants.ts @@ -4,8 +4,6 @@ import { EIP1193_USER_REJECTED_REQUEST } from '@hub3js/core'; import { isEvmNamespace } from '@hub3js/evm'; import { getSdkError } from '@walletconnect/utils'; -import getSigners from './signer.js'; - export const WALLET_ID = 'wallet-connect-2'; // The documented codes a wallet answers a session proposal with when the user rejects it, plus the EIP-1193 code some wallets answer with instead. @@ -36,10 +34,6 @@ export const metadata: ProviderMetadata = { ], }, }, - { - name: 'signers', - value: { getSigners: async () => getSigners() }, - }, { name: 'details', value: { diff --git a/wallets/provider-walletconnect-2/src/namespaces/evm/namespace.ts b/wallets/provider-walletconnect-2/src/namespaces/evm/namespace.ts index fe1d94c087..3b8d90bff7 100644 --- a/wallets/provider-walletconnect-2/src/namespaces/evm/namespace.ts +++ b/wallets/provider-walletconnect-2/src/namespaces/evm/namespace.ts @@ -1,12 +1,14 @@ import type { Context } from '@hub3js/core'; -import type { - AllowanceParams, - EvmActions, - EvmTransactionReceipt, -} from '@hub3js/evm'; +import type { AllowanceParams, EvmActions } from '@hub3js/evm'; import { getErrorMessage, Hub3Error, NamespaceBuilder } from '@hub3js/core'; -import { actions, builders, utils } from '@hub3js/evm'; +import { + actions, + builders, + utils, + viemPublicAdapter, + viemWalletAdapter, +} from '@hub3js/evm'; import * as commonBuilders from '@hub3js/std/builders'; import { standardizeAndThrowError } from '@hub3js/std/operators'; @@ -126,25 +128,30 @@ const getAllowance = builders ) .build(); +const getEip1193Provider = () => getAdapter().getEip1193Provider(); + const getTransactionReceipt = builders .getTransactionReceipt() - .action( - async ( - _context: Context, - txHash: `0x${string}` - ): Promise => - getAdapter().getTransactionReceipt(txHash) - ) + .action(actions.getTransactionReceipt(getEip1193Provider)) .build(); -const evm = new NamespaceBuilder('EVM', WALLET_ID) - .action(connect) - .action(canEagerConnect) - .action(canSwitchNetwork) - .action(disconnect) - .action(getChainId) - .action(getAllowance) - .action(getTransactionReceipt) +const waitForTransactionReceipt = builders + .waitForTransactionReceipt() + .action(actions.waitForTransactionReceipt(getEip1193Provider)) .build(); -export { evm }; +const buildEvm = (rpcUrl: string) => + new NamespaceBuilder('EVM', WALLET_ID) + .action(connect) + .action(canEagerConnect) + .action(canSwitchNetwork) + .action(disconnect) + .action(getChainId) + .action(getAllowance) + .action(getTransactionReceipt) + .action(waitForTransactionReceipt) + .action(viemWalletAdapter(getEip1193Provider)) + .action(viemPublicAdapter(rpcUrl)) + .build(); + +export { buildEvm }; diff --git a/wallets/provider-walletconnect-2/src/provider.ts b/wallets/provider-walletconnect-2/src/provider.ts index 74b0a003ef..986be89045 100644 --- a/wallets/provider-walletconnect-2/src/provider.ts +++ b/wallets/provider-walletconnect-2/src/provider.ts @@ -1,14 +1,19 @@ import type { Environments } from './types.js'; +import type { NamespacesRPCUrls } from '@hub3js/namespaces'; import { ProviderBuilder } from '@hub3js/core'; import { WalletConnectAdapter } from './adapter/adapter.js'; import { setAdapter } from './adapter/registry.js'; import { metadata, WALLET_ID } from './constants.js'; -import { evm } from './namespaces/evm/namespace.js'; +import { buildEvm } from './namespaces/evm/namespace.js'; -const buildProvider = () => - new ProviderBuilder(WALLET_ID) +const buildProvider = (rpcURLs: NamespacesRPCUrls) => { + if (!rpcURLs?.evm) { + throw new Error('An RPC URL for the EVM namespace is required.'); + } + + return new ProviderBuilder(WALLET_ID) .init(function (context, environments: Environments) { const [, setState] = context.state(); @@ -29,7 +34,8 @@ const buildProvider = () => console.debug('[wallet-connect-2] provider initialized.', context); }) .config('metadata', metadata) - .add('evm', evm) + .add('evm', buildEvm(rpcURLs.evm)) .build(); +}; export { buildProvider }; diff --git a/wallets/provider-walletconnect-2/src/signer.ts b/wallets/provider-walletconnect-2/src/signer.ts deleted file mode 100644 index ca80e28856..0000000000 --- a/wallets/provider-walletconnect-2/src/signer.ts +++ /dev/null @@ -1,23 +0,0 @@ -import type { SignerFactory } from 'rango-types'; - -import { DefaultSignerFactory, TransactionType as TxType } from 'rango-types'; - -import { getAdapter } from './adapter/registry.js'; - -export default async function getSigners(): Promise { - const adapter = getAdapter(); - if (!adapter) { - throw new Error('WalletConnect provider has not been initialized.'); - } - - const client = await adapter.getClient(); - - const signers = new DefaultSignerFactory(); - const EVMSigner = (await import('./signers/evm.js')).default; - signers.registerSigner( - TxType.EVM, - new EVMSigner(client, () => adapter.getSession('evm')) - ); - - return signers; -} diff --git a/wallets/provider-walletconnect-2/src/signers/evm.ts b/wallets/provider-walletconnect-2/src/signers/evm.ts deleted file mode 100644 index 2f4b12b137..0000000000 --- a/wallets/provider-walletconnect-2/src/signers/evm.ts +++ /dev/null @@ -1,221 +0,0 @@ -import type { ISignClient, SessionTypes } from '@walletconnect/types'; -import type { EvmTransaction } from 'rango-types/mainApi'; - -import { cleanEvmError, toHexQuantity } from '@rango-dev/signer-evm'; -import { AccountId, ChainId } from 'caip'; -import { type GenericSigner } from 'rango-types'; - -import { utf8ToHex } from '../utils.js'; -import { EthereumRPCMethods, NAMESPACES } from '../wcConstants.js'; - -const NAMESPACE_NAME = NAMESPACES.ETHEREUM; - -type SessionGetter = () => SessionTypes.Struct | null; - -type WalletConnectEvmTx = { - from?: string; - to?: string; - data: string; - value: string; - gas?: string; - gasPrice?: string; - maxFeePerGas?: string; - maxPriorityFeePerGas?: string; - nonce?: string; -}; - -class EVMSigner implements GenericSigner { - private client: ISignClient; - private getSession: SessionGetter; - - constructor(client: ISignClient, getSession: SessionGetter) { - this.client = client; - this.getSession = getSession; - } - - private get session(): SessionTypes.Struct { - const session = this.getSession(); - if (!session) { - throw new Error('EVM WalletConnect session is not available.'); - } - return session; - } - - /** - * Map Rango's EvmTransaction to WalletConnect eth_sendTransaction params. - * - * Unlike DefaultEvmSigner.buildTx (ethers TransactionRequest with gasLimit + - * decimal fee strings), WC sends params raw over the relay. Wallets like - * Ledger Live parse QUANTITY as hex, so decimal fees get inflated (~40x+). - * - * This builder: - * - uses `gas` (JSON-RPC), not ethers' `gasLimit` - * - hex-encodes gas, fees, value, and nonce - */ - static buildTx(evmTx: EvmTransaction): WalletConnectEvmTx { - const tx: WalletConnectEvmTx = { - data: evmTx.data || '0x', - /* - * Approvals and many contract calls have value=null from the API. - * Some WC wallets reject missing value; send 0x0 explicitly. - */ - value: evmTx.value ? toHexQuantity(evmTx.value) : '0x0', - }; - - if (evmTx.from) { - tx.from = evmTx.from; - } - if (evmTx.to) { - tx.to = evmTx.to; - } - if (evmTx.nonce) { - tx.nonce = toHexQuantity(evmTx.nonce); - } - if (evmTx.gasLimit) { - tx.gas = toHexQuantity(evmTx.gasLimit); - } - if (evmTx.maxFeePerGas && evmTx.maxPriorityFeePerGas) { - tx.maxFeePerGas = toHexQuantity(evmTx.maxFeePerGas); - tx.maxPriorityFeePerGas = toHexQuantity(evmTx.maxPriorityFeePerGas); - } else if (evmTx.gasPrice) { - tx.gasPrice = toHexQuantity(evmTx.gasPrice); - } - - return tx; - } - - public async signMessage( - msg: string, - address: string, - chainId: string | null - ): Promise { - const requestedFor = this.isNetworkAndAccountExistInSession({ - address, - chainId, - }); - - const caipChainId = new ChainId({ - namespace: NAMESPACE_NAME, - reference: requestedFor.chainId, - }); - const hexMsg = utf8ToHex(msg, true); - - const params = [hexMsg, address]; - - let signature: string; - try { - // Send message to wallet (using relayer) - signature = await this.client.request({ - topic: this.session.topic, - chainId: caipChainId.toString(), - request: { - method: EthereumRPCMethods.PERSONAL_SIGN, - params, - }, - }); - } catch (error) { - throw cleanEvmError(error); - } - - /* - * TODO: We can also verify the signature here - * Check web-examples: dapps/react-dapp-v2/src/contexts/JsonRpcContext.tsx - */ - - return signature; - } - - async signAndSendTx( - tx: EvmTransaction, - address: string, - chainId: string | null - ): Promise<{ hash: string }> { - try { - const requestedFor = this.isNetworkAndAccountExistInSession({ - address, - chainId, - }); - const transaction = EVMSigner.buildTx(tx); - const hash: string = await this.client.request({ - topic: this.session.topic, - chainId: requestedFor.caipChainId, - request: { - method: EthereumRPCMethods.SEND_TRANSACTION, - params: [transaction], - }, - }); - // Some wallets e.g. Rainbow wallet are returning invalid hash (e.g. 'null') in case of the rejection - if (!hash?.startsWith('0x')) { - throw new Error( - `Received an invalid hash on signing the transaction. (hash=${hash})` - ); - } - - return { - hash, - }; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - } catch (error: any) { - const modifiedError = cleanEvmError(error); - const session = this.session; - const context = { - namspaces: session?.namespaces, - peering: session?.peer?.metadata, - code: error?.code, - }; - modifiedError.context = context; - throw modifiedError; - } - } - - private isNetworkAndAccountExistInSession(requestedFor: { - address: string; - chainId: string | null; - }) { - const { address, chainId } = requestedFor; - - if (!chainId) { - throw new Error( - 'You need to set your chain for signing message/transaction.' - ); - } - - /* - * TODO: We need to make sure we are using a single format for chain ids, it should be hex or number. - * This is a quick fix for evm. - */ - const chainIdNumber = chainId.startsWith('0x') - ? String(parseInt(chainId)) - : chainId; - - const caipAddress = new AccountId({ - chainId: { - namespace: NAMESPACE_NAME, - reference: chainIdNumber, - }, - address, - }); - const addresses = this.session.namespaces[NAMESPACE_NAME]?.accounts.map( - (address) => address.toLowerCase() - ); - - if (!addresses || !addresses.includes(caipAddress.toString())) { - throw new Error( - `Your requested address doesn't exist on your wallect connect session. Please reconnect your wallet.` - ); - } - - const caipChainId = new ChainId({ - namespace: NAMESPACE_NAME, - reference: chainIdNumber, - }); - - return { - chainId: chainIdNumber, - address, - caipChainId: caipChainId.toString(), - }; - } -} - -export default EVMSigner; diff --git a/wallets/provider-walletconnect-2/src/utils.ts b/wallets/provider-walletconnect-2/src/utils.ts index eebc749b43..1da8ff258e 100644 --- a/wallets/provider-walletconnect-2/src/utils.ts +++ b/wallets/provider-walletconnect-2/src/utils.ts @@ -23,14 +23,6 @@ export async function timeout( return Promise.race([forPromise, timeoutPromise]); } -export function utf8ToHex(value: string, prefixed = false): string { - const hex = Array.from(new TextEncoder().encode(value)) - .map((byte) => byte.toString(HEX_RADIX).padStart(2, '0')) - .join(''); - - return prefixed ? `0x${hex}` : hex; -} - /** Normalizes hub chain input (hex, decimal, or AddEthereumChainParameter) to a decimal reference. */ export function parseChainReference( chain?: string | Chain From d50380864702590418ab45a653757fc4ee97a73b Mon Sep 17 00:00:00 2001 From: arlert-armin Date: Tue, 6 Oct 2026 19:52:16 +0000 Subject: [PATCH 05/29] feat(wallets): register viem actions on injected evm wallets Their EVM namespaces register `viemWalletAdapter` and `viemPublicAdapter`, plus wallet-transport `getTransactionReceipt` and `waitForTransactionReceipt`, and are built with the EVM RPC URL. EVM signers are no longer registered; providers left without a signer drop their `signers` property. --- wallets/provider-binance/src/constants.ts | 7 ---- .../provider-binance/src/namespaces/evm.ts | 33 ++++++++++++----- wallets/provider-binance/src/provider.ts | 15 +++++--- wallets/provider-binance/src/signer.ts | 17 --------- wallets/provider-binance/src/utils.ts | 12 ------- wallets/provider-bitget/src/namespaces/evm.ts | 35 +++++++++++++------ wallets/provider-bitget/src/provider.ts | 15 +++++--- wallets/provider-bitget/src/signer.ts | 11 +----- wallets/provider-brave/src/namespaces/evm.ts | 35 +++++++++++++------ wallets/provider-brave/src/provider.ts | 15 +++++--- wallets/provider-brave/src/signer.ts | 7 +--- wallets/provider-coin98/src/namespaces/evm.ts | 32 ++++++++++++----- wallets/provider-coin98/src/provider.ts | 15 +++++--- wallets/provider-coin98/src/signer.ts | 7 +--- .../provider-coinbase/src/namespaces/evm.ts | 35 +++++++++++++------ wallets/provider-coinbase/src/provider.ts | 15 +++++--- wallets/provider-coinbase/src/signer.ts | 7 +--- wallets/provider-default/src/constants.ts | 7 ---- .../provider-default/src/namespaces/evm.ts | 35 +++++++++++++------ wallets/provider-default/src/provider.ts | 15 +++++--- wallets/provider-default/src/signer.ts | 17 --------- wallets/provider-default/src/utils.ts | 10 ------ wallets/provider-enkrypt/src/constants.ts | 7 ---- .../provider-enkrypt/src/namespaces/evm.ts | 35 +++++++++++++------ wallets/provider-enkrypt/src/provider.ts | 15 +++++--- wallets/provider-enkrypt/src/signer.ts | 20 ----------- wallets/provider-enkrypt/src/utils.ts | 12 ------- 27 files changed, 253 insertions(+), 233 deletions(-) delete mode 100644 wallets/provider-binance/src/signer.ts delete mode 100644 wallets/provider-default/src/signer.ts delete mode 100644 wallets/provider-enkrypt/src/signer.ts diff --git a/wallets/provider-binance/src/constants.ts b/wallets/provider-binance/src/constants.ts index 3c840564f6..dbba3ad3cb 100644 --- a/wallets/provider-binance/src/constants.ts +++ b/wallets/provider-binance/src/constants.ts @@ -21,9 +21,6 @@ import { } from '@hub3js/evm'; import { getChainIdFromCaip2ChainId } from '@hub3js/std/utils'; -import getSigners from './signer.js'; -import { getInstanceOrThrow } from './utils.js'; - export const WALLET_ID = 'binance'; export const EVM_SUPPORTED_CHAINS = [ CAIP_ETHEREUM_CHAIN_ID, @@ -73,9 +70,5 @@ export const metadata: ProviderMetadata = { ], }, }, - { - name: 'signers', - value: { getSigners: async () => getSigners(getInstanceOrThrow()) }, - }, ], }; diff --git a/wallets/provider-binance/src/namespaces/evm.ts b/wallets/provider-binance/src/namespaces/evm.ts index 474c87e9d2..150203c420 100644 --- a/wallets/provider-binance/src/namespaces/evm.ts +++ b/wallets/provider-binance/src/namespaces/evm.ts @@ -1,7 +1,13 @@ import type { EvmActions } from '@hub3js/evm'; import { NamespaceBuilder } from '@hub3js/core'; -import { actions, builders, utils } from '@hub3js/evm'; +import { + actions, + builders, + utils, + viemPublicAdapter, + viemWalletAdapter, +} from '@hub3js/evm'; import * as commonBuilders from '@hub3js/std/builders'; import { standardizeAndThrowError } from '@hub3js/std/operators'; @@ -57,13 +63,22 @@ const getTransactionReceipt = builders .action(actions.getTransactionReceipt(evmBinance)) .build(); -const evm = new NamespaceBuilder('EVM', WALLET_ID) - .action(connect) - .action(disconnect) - .action(canSwitchNetwork) - .action(getChainId) - .action(getAllowance) - .action(getTransactionReceipt) +const waitForTransactionReceipt = builders + .waitForTransactionReceipt() + .action(actions.waitForTransactionReceipt(evmBinance)) .build(); -export { evm }; +const buildEvm = (rpcUrl: string) => + new NamespaceBuilder('EVM', WALLET_ID) + .action(connect) + .action(disconnect) + .action(canSwitchNetwork) + .action(getChainId) + .action(getAllowance) + .action(getTransactionReceipt) + .action(waitForTransactionReceipt) + .action(viemWalletAdapter(evmBinance)) + .action(viemPublicAdapter(rpcUrl)) + .build(); + +export { buildEvm }; diff --git a/wallets/provider-binance/src/provider.ts b/wallets/provider-binance/src/provider.ts index 37ff60ac28..18e1d06026 100644 --- a/wallets/provider-binance/src/provider.ts +++ b/wallets/provider-binance/src/provider.ts @@ -1,11 +1,17 @@ +import type { NamespacesRPCUrls } from '@hub3js/namespaces'; + import { ProviderBuilder } from '@hub3js/core'; import { metadata, WALLET_ID } from './constants.js'; -import { evm } from './namespaces/evm.js'; +import { buildEvm } from './namespaces/evm.js'; import { binance as binanceInstance } from './utils.js'; -const buildProvider = () => - new ProviderBuilder(WALLET_ID) +const buildProvider = (rpcURLs: NamespacesRPCUrls) => { + if (!rpcURLs?.evm) { + throw new Error('An RPC URL for the EVM namespace is required.'); + } + + return new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); if (binanceInstance()) { @@ -14,7 +20,8 @@ const buildProvider = () => } }) .config('metadata', metadata) - .add('evm', evm) + .add('evm', buildEvm(rpcURLs.evm)) .build(); +}; export { buildProvider }; diff --git a/wallets/provider-binance/src/signer.ts b/wallets/provider-binance/src/signer.ts deleted file mode 100644 index 6f05aa1495..0000000000 --- a/wallets/provider-binance/src/signer.ts +++ /dev/null @@ -1,17 +0,0 @@ -import type { Provider } from './types.js'; -import type { SignerFactory } from 'rango-types'; - -import { EVM_NAMESPACE } from '@hub3js/namespaces'; -import { DefaultSignerFactory, TransactionType as TxType } from 'rango-types'; - -export default async function getSigners( - provider: Provider -): Promise { - const evmProvider = provider.get(EVM_NAMESPACE); - const signers = new DefaultSignerFactory(); - const { DefaultEvmSigner } = await import('@rango-dev/signer-evm'); - if (!!evmProvider) { - signers.registerSigner(TxType.EVM, new DefaultEvmSigner(evmProvider)); - } - return signers; -} diff --git a/wallets/provider-binance/src/utils.ts b/wallets/provider-binance/src/utils.ts index 42354495c9..c6a05ff78b 100644 --- a/wallets/provider-binance/src/utils.ts +++ b/wallets/provider-binance/src/utils.ts @@ -22,18 +22,6 @@ export function binance(): Provider | null { return instances; } -export function getInstanceOrThrow(): Provider { - const instances = binance(); - - if (!instances) { - throw new Error( - 'Binance Wallet is not injected. Please check your wallet.' - ); - } - - return instances; -} - export function evmBinance(): EvmProviderApi { const instances = binance(); diff --git a/wallets/provider-bitget/src/namespaces/evm.ts b/wallets/provider-bitget/src/namespaces/evm.ts index f490add445..54ae5d348b 100644 --- a/wallets/provider-bitget/src/namespaces/evm.ts +++ b/wallets/provider-bitget/src/namespaces/evm.ts @@ -1,7 +1,13 @@ import type { EvmActions } from '@hub3js/evm'; import { NamespaceBuilder } from '@hub3js/core'; -import { actions, builders, hooks } from '@hub3js/evm'; +import { + actions, + builders, + hooks, + viemPublicAdapter, + viemWalletAdapter, +} from '@hub3js/evm'; import * as commonBuilders from '@hub3js/std/builders'; import { standardizeAndThrowError } from '@hub3js/std/operators'; @@ -48,14 +54,23 @@ const getTransactionReceipt = builders .action(actions.getTransactionReceipt(evmBitget)) .build(); -const evm = new NamespaceBuilder('EVM', WALLET_ID) - .action(connect) - .action(disconnect) - .action(getChainId) - .action(canEagerConnect) - .action(canSwitchNetwork) - .action(getAllowance) - .action(getTransactionReceipt) +const waitForTransactionReceipt = builders + .waitForTransactionReceipt() + .action(actions.waitForTransactionReceipt(evmBitget)) .build(); -export { evm }; +const buildEvm = (rpcUrl: string) => + new NamespaceBuilder('EVM', WALLET_ID) + .action(connect) + .action(disconnect) + .action(getChainId) + .action(canEagerConnect) + .action(canSwitchNetwork) + .action(getAllowance) + .action(getTransactionReceipt) + .action(waitForTransactionReceipt) + .action(viemWalletAdapter(evmBitget)) + .action(viemPublicAdapter(rpcUrl)) + .build(); + +export { buildEvm }; diff --git a/wallets/provider-bitget/src/provider.ts b/wallets/provider-bitget/src/provider.ts index 453cc14347..4f5134fa32 100644 --- a/wallets/provider-bitget/src/provider.ts +++ b/wallets/provider-bitget/src/provider.ts @@ -1,13 +1,19 @@ +import type { NamespacesRPCUrls } from '@hub3js/namespaces'; + import { ProviderBuilder } from '@hub3js/core'; import { metadata, WALLET_ID } from './constants.js'; -import { evm } from './namespaces/evm.js'; +import { buildEvm } from './namespaces/evm.js'; import { tron } from './namespaces/tron.js'; import { utxo } from './namespaces/utxo.js'; import { bitget } from './utils.js'; -const buildProvider = () => - new ProviderBuilder(WALLET_ID) +const buildProvider = (rpcURLs: NamespacesRPCUrls) => { + if (!rpcURLs?.evm) { + throw new Error('An RPC URL for the EVM namespace is required.'); + } + + return new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); @@ -18,8 +24,9 @@ const buildProvider = () => }) .config('metadata', metadata) .add('tron', tron) - .add('evm', evm) + .add('evm', buildEvm(rpcURLs.evm)) .add('utxo', utxo) .build(); +}; export { buildProvider }; diff --git a/wallets/provider-bitget/src/signer.ts b/wallets/provider-bitget/src/signer.ts index 6a32e27393..a727f350e6 100644 --- a/wallets/provider-bitget/src/signer.ts +++ b/wallets/provider-bitget/src/signer.ts @@ -1,11 +1,7 @@ import type { Provider } from './types.js'; import type { SignerFactory } from 'rango-types'; -import { - EVM_NAMESPACE, - TRON_NAMESPACE, - UTXO_NAMESPACE, -} from '@hub3js/namespaces'; +import { TRON_NAMESPACE, UTXO_NAMESPACE } from '@hub3js/namespaces'; import { DefaultSignerFactory, TransactionType as TxType } from 'rango-types'; import { BitgetUTXOSigner } from './signers/utxo.js'; @@ -13,16 +9,11 @@ import { BitgetUTXOSigner } from './signers/utxo.js'; export default async function getSigners( provider: Provider ): Promise { - const ethProvider = provider.get(EVM_NAMESPACE); const tronProvider = provider.get(TRON_NAMESPACE); const utxoProvider = provider.get(UTXO_NAMESPACE); const signers = new DefaultSignerFactory(); - const { DefaultEvmSigner } = await import('@rango-dev/signer-evm'); const { DefaultTronSigner } = await import('@rango-dev/signer-tron'); - if (!!ethProvider) { - signers.registerSigner(TxType.EVM, new DefaultEvmSigner(ethProvider)); - } if (!!tronProvider) { signers.registerSigner(TxType.TRON, new DefaultTronSigner(tronProvider)); } diff --git a/wallets/provider-brave/src/namespaces/evm.ts b/wallets/provider-brave/src/namespaces/evm.ts index ce4df376fc..a883f47fbc 100644 --- a/wallets/provider-brave/src/namespaces/evm.ts +++ b/wallets/provider-brave/src/namespaces/evm.ts @@ -1,7 +1,13 @@ import type { EvmActions } from '@hub3js/evm'; import { NamespaceBuilder } from '@hub3js/core'; -import { actions, builders, hooks } from '@hub3js/evm'; +import { + actions, + builders, + hooks, + viemPublicAdapter, + viemWalletAdapter, +} from '@hub3js/evm'; import * as commonBuilders from '@hub3js/std/builders'; import { standardizeAndThrowError } from '@hub3js/std/operators'; @@ -48,14 +54,23 @@ const getTransactionReceipt = builders .action(actions.getTransactionReceipt(evmBrave)) .build(); -const evm = new NamespaceBuilder('EVM', WALLET_ID) - .action(connect) - .action(disconnect) - .action(canEagerConnect) - .action(canSwitchNetwork) - .action(getChainId) - .action(getAllowance) - .action(getTransactionReceipt) +const waitForTransactionReceipt = builders + .waitForTransactionReceipt() + .action(actions.waitForTransactionReceipt(evmBrave)) .build(); -export { evm }; +const buildEvm = (rpcUrl: string) => + new NamespaceBuilder('EVM', WALLET_ID) + .action(connect) + .action(disconnect) + .action(canEagerConnect) + .action(canSwitchNetwork) + .action(getChainId) + .action(getAllowance) + .action(getTransactionReceipt) + .action(waitForTransactionReceipt) + .action(viemWalletAdapter(evmBrave)) + .action(viemPublicAdapter(rpcUrl)) + .build(); + +export { buildEvm }; diff --git a/wallets/provider-brave/src/provider.ts b/wallets/provider-brave/src/provider.ts index 8af23ea3cf..c6432ec2dc 100644 --- a/wallets/provider-brave/src/provider.ts +++ b/wallets/provider-brave/src/provider.ts @@ -1,12 +1,18 @@ +import type { NamespacesRPCUrls } from '@hub3js/namespaces'; + import { ProviderBuilder } from '@hub3js/core'; import { metadata, WALLET_ID } from './constants.js'; -import { evm } from './namespaces/evm.js'; +import { buildEvm } from './namespaces/evm.js'; import { solana } from './namespaces/solana.js'; import { brave } from './utils.js'; -const buildProvider = () => - new ProviderBuilder(WALLET_ID) +const buildProvider = (rpcURLs: NamespacesRPCUrls) => { + if (!rpcURLs?.evm) { + throw new Error('An RPC URL for the EVM namespace is required.'); + } + + return new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); @@ -17,7 +23,8 @@ const buildProvider = () => }) .config('metadata', metadata) .add('solana', solana) - .add('evm', evm) + .add('evm', buildEvm(rpcURLs.evm)) .build(); +}; export { buildProvider }; diff --git a/wallets/provider-brave/src/signer.ts b/wallets/provider-brave/src/signer.ts index a28099e14e..de16a31a7a 100644 --- a/wallets/provider-brave/src/signer.ts +++ b/wallets/provider-brave/src/signer.ts @@ -1,7 +1,7 @@ import type { Provider } from './types.js'; import type { SignerFactory } from 'rango-types'; -import { EVM_NAMESPACE, SOLANA_NAMESPACE } from '@hub3js/namespaces'; +import { SOLANA_NAMESPACE } from '@hub3js/namespaces'; import { DefaultSignerFactory, TransactionType as TxType } from 'rango-types'; import { BraveSolanaSigner } from './signers/solana.js'; @@ -9,13 +9,8 @@ import { BraveSolanaSigner } from './signers/solana.js'; export default async function getSigners( provider: Provider ): Promise { - const ethProvider = provider.get(EVM_NAMESPACE); const solProvider = provider.get(SOLANA_NAMESPACE); const signers = new DefaultSignerFactory(); - const { DefaultEvmSigner } = await import('@rango-dev/signer-evm'); - if (!!ethProvider) { - signers.registerSigner(TxType.EVM, new DefaultEvmSigner(ethProvider)); - } if (!!solProvider) { signers.registerSigner(TxType.SOLANA, new BraveSolanaSigner(solProvider)); } diff --git a/wallets/provider-coin98/src/namespaces/evm.ts b/wallets/provider-coin98/src/namespaces/evm.ts index 018135af40..800fd295f8 100644 --- a/wallets/provider-coin98/src/namespaces/evm.ts +++ b/wallets/provider-coin98/src/namespaces/evm.ts @@ -1,7 +1,12 @@ import type { EvmActions } from '@hub3js/evm'; import { NamespaceBuilder } from '@hub3js/core'; -import { actions, builders } from '@hub3js/evm'; +import { + actions, + builders, + viemPublicAdapter, + viemWalletAdapter, +} from '@hub3js/evm'; import * as commonBuilders from '@hub3js/std/builders'; import { standardizeAndThrowError } from '@hub3js/std/operators'; @@ -45,13 +50,22 @@ const getTransactionReceipt = builders .action(actions.getTransactionReceipt(evmCoin98)) .build(); -const evm = new NamespaceBuilder('EVM', WALLET_ID) - .action(connect) - .action(disconnect) - .action(canSwitchNetwork) - .action(getChainId) - .action(getAllowance) - .action(getTransactionReceipt) +const waitForTransactionReceipt = builders + .waitForTransactionReceipt() + .action(actions.waitForTransactionReceipt(evmCoin98)) .build(); -export { evm }; +const buildEvm = (rpcUrl: string) => + new NamespaceBuilder('EVM', WALLET_ID) + .action(connect) + .action(disconnect) + .action(canSwitchNetwork) + .action(getChainId) + .action(getAllowance) + .action(getTransactionReceipt) + .action(waitForTransactionReceipt) + .action(viemWalletAdapter(evmCoin98)) + .action(viemPublicAdapter(rpcUrl)) + .build(); + +export { buildEvm }; diff --git a/wallets/provider-coin98/src/provider.ts b/wallets/provider-coin98/src/provider.ts index 5038f3c2d8..a2275582e0 100644 --- a/wallets/provider-coin98/src/provider.ts +++ b/wallets/provider-coin98/src/provider.ts @@ -1,12 +1,18 @@ +import type { NamespacesRPCUrls } from '@hub3js/namespaces'; + import { ProviderBuilder } from '@hub3js/core'; import { COIN98_INJECTION_DELAY, metadata, WALLET_ID } from './constants.js'; -import { evm } from './namespaces/evm.js'; +import { buildEvm } from './namespaces/evm.js'; import { solana } from './namespaces/solana.js'; import { coin98 } from './utils.js'; -const buildProvider = () => - new ProviderBuilder(WALLET_ID) +const buildProvider = (rpcURLs: NamespacesRPCUrls) => { + if (!rpcURLs?.evm) { + throw new Error('An RPC URL for the EVM namespace is required.'); + } + + return new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); @@ -18,8 +24,9 @@ const buildProvider = () => }, COIN98_INJECTION_DELAY); }) .config('metadata', metadata) - .add('evm', evm) + .add('evm', buildEvm(rpcURLs.evm)) .add('solana', solana) .build(); +}; export { buildProvider }; diff --git a/wallets/provider-coin98/src/signer.ts b/wallets/provider-coin98/src/signer.ts index 6747998b4e..48e938533e 100644 --- a/wallets/provider-coin98/src/signer.ts +++ b/wallets/provider-coin98/src/signer.ts @@ -1,7 +1,7 @@ import type { Provider } from './types.js'; import type { SignerFactory } from 'rango-types'; -import { EVM_NAMESPACE, SOLANA_NAMESPACE } from '@hub3js/namespaces'; +import { SOLANA_NAMESPACE } from '@hub3js/namespaces'; import { DefaultSignerFactory, TransactionType as TxType } from 'rango-types'; import { Coin98SolanaSigner } from './signers/solana.js'; @@ -9,13 +9,8 @@ import { Coin98SolanaSigner } from './signers/solana.js'; export default async function getSigners( provider: Provider ): Promise { - const ethProvider = provider.get(EVM_NAMESPACE); const solProvider = provider.get(SOLANA_NAMESPACE); const signers = new DefaultSignerFactory(); - const { DefaultEvmSigner } = await import('@rango-dev/signer-evm'); - if (!!ethProvider) { - signers.registerSigner(TxType.EVM, new DefaultEvmSigner(ethProvider)); - } if (!!solProvider) { signers.registerSigner(TxType.SOLANA, new Coin98SolanaSigner(solProvider)); } diff --git a/wallets/provider-coinbase/src/namespaces/evm.ts b/wallets/provider-coinbase/src/namespaces/evm.ts index d8938b1a2b..09b4ce8864 100644 --- a/wallets/provider-coinbase/src/namespaces/evm.ts +++ b/wallets/provider-coinbase/src/namespaces/evm.ts @@ -1,7 +1,13 @@ import type { EvmActions } from '@hub3js/evm'; import { ActionBuilder, NamespaceBuilder } from '@hub3js/core'; -import { actions, builders, utils } from '@hub3js/evm'; +import { + actions, + builders, + utils, + viemPublicAdapter, + viemWalletAdapter, +} from '@hub3js/evm'; import * as commonBuilders from '@hub3js/std/builders'; import { connectAndUpdateStateForMultiNetworks, @@ -83,14 +89,23 @@ const getTransactionReceipt = builders .action(actions.getTransactionReceipt(evmCoinbase)) .build(); -const evm = new NamespaceBuilder('EVM', WALLET_ID) - .action(connect) - .action(disconnect) - .action(canEagerConnect) - .action(canSwitchNetwork) - .action(getChainId) - .action(getAllowance) - .action(getTransactionReceipt) +const waitForTransactionReceipt = builders + .waitForTransactionReceipt() + .action(actions.waitForTransactionReceipt(evmCoinbase)) .build(); -export { evm }; +const buildEvm = (rpcUrl: string) => + new NamespaceBuilder('EVM', WALLET_ID) + .action(connect) + .action(disconnect) + .action(canEagerConnect) + .action(canSwitchNetwork) + .action(getChainId) + .action(getAllowance) + .action(getTransactionReceipt) + .action(waitForTransactionReceipt) + .action(viemWalletAdapter(evmCoinbase)) + .action(viemPublicAdapter(rpcUrl)) + .build(); + +export { buildEvm }; diff --git a/wallets/provider-coinbase/src/provider.ts b/wallets/provider-coinbase/src/provider.ts index b3de61c4c7..cc98cd8878 100644 --- a/wallets/provider-coinbase/src/provider.ts +++ b/wallets/provider-coinbase/src/provider.ts @@ -1,12 +1,18 @@ +import type { NamespacesRPCUrls } from '@hub3js/namespaces'; + import { ProviderBuilder } from '@hub3js/core'; import { metadata, WALLET_ID } from './constants.js'; -import { evm } from './namespaces/evm.js'; +import { buildEvm } from './namespaces/evm.js'; import { solana } from './namespaces/solana.js'; import { coinbase as coinbaseInstance } from './utils.js'; -const buildProvider = () => - new ProviderBuilder(WALLET_ID) +const buildProvider = (rpcURLs: NamespacesRPCUrls) => { + if (!rpcURLs?.evm) { + throw new Error('An RPC URL for the EVM namespace is required.'); + } + + return new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); @@ -17,7 +23,8 @@ const buildProvider = () => }) .config('metadata', metadata) .add('solana', solana) - .add('evm', evm) + .add('evm', buildEvm(rpcURLs.evm)) .build(); +}; export { buildProvider }; diff --git a/wallets/provider-coinbase/src/signer.ts b/wallets/provider-coinbase/src/signer.ts index bbbe35c54c..d73522e975 100644 --- a/wallets/provider-coinbase/src/signer.ts +++ b/wallets/provider-coinbase/src/signer.ts @@ -1,7 +1,7 @@ import type { Provider } from './utils.js'; import type { SignerFactory } from 'rango-types'; -import { EVM_NAMESPACE, SOLANA_NAMESPACE } from '@hub3js/namespaces'; +import { SOLANA_NAMESPACE } from '@hub3js/namespaces'; import { DefaultSignerFactory, TransactionType as TxType } from 'rango-types'; import { CustomSolanaSigner } from './signers/solana-signer.js'; @@ -9,13 +9,8 @@ import { CustomSolanaSigner } from './signers/solana-signer.js'; export default async function getSigners( provider: Provider ): Promise { - const ethProvider = provider.get(EVM_NAMESPACE); const solProvider = provider.get(SOLANA_NAMESPACE); const signers = new DefaultSignerFactory(); - const { DefaultEvmSigner } = await import('@rango-dev/signer-evm'); - if (!!ethProvider) { - signers.registerSigner(TxType.EVM, new DefaultEvmSigner(ethProvider)); - } if (!!solProvider) { signers.registerSigner(TxType.SOLANA, new CustomSolanaSigner(solProvider)); } diff --git a/wallets/provider-default/src/constants.ts b/wallets/provider-default/src/constants.ts index e9dc0d8cc2..f0a5e4a55a 100644 --- a/wallets/provider-default/src/constants.ts +++ b/wallets/provider-default/src/constants.ts @@ -2,9 +2,6 @@ import type { ProviderMetadata } from '@hub3js/core'; import { isEvmNamespace } from '@hub3js/evm'; -import getSigners from './signer.js'; -import { getInstanceOrThrow } from './utils.js'; - export const WALLET_ID = 'default'; export const INJECTION_DELAY = 1000; @@ -33,9 +30,5 @@ export const metadata: ProviderMetadata = { ], }, }, - { - name: 'signers', - value: { getSigners: async () => getSigners(getInstanceOrThrow()) }, - }, ], }; diff --git a/wallets/provider-default/src/namespaces/evm.ts b/wallets/provider-default/src/namespaces/evm.ts index b40907b3ea..a54201b529 100644 --- a/wallets/provider-default/src/namespaces/evm.ts +++ b/wallets/provider-default/src/namespaces/evm.ts @@ -1,7 +1,13 @@ import type { EvmActions } from '@hub3js/evm'; import { NamespaceBuilder } from '@hub3js/core'; -import { actions, builders, hooks } from '@hub3js/evm'; +import { + actions, + builders, + hooks, + viemPublicAdapter, + viemWalletAdapter, +} from '@hub3js/evm'; import * as commonBuilders from '@hub3js/std/builders'; import { standardizeAndThrowError } from '@hub3js/std/operators'; @@ -49,14 +55,23 @@ const getTransactionReceipt = builders .action(actions.getTransactionReceipt(evmDefault)) .build(); -const evm = new NamespaceBuilder('EVM', WALLET_ID) - .action(connect) - .action(disconnect) - .action(canEagerConnect) - .action(canSwitchNetwork) - .action(getChainId) - .action(getAllowance) - .action(getTransactionReceipt) +const waitForTransactionReceipt = builders + .waitForTransactionReceipt() + .action(actions.waitForTransactionReceipt(evmDefault)) .build(); -export { evm }; +const buildEvm = (rpcUrl: string) => + new NamespaceBuilder('EVM', WALLET_ID) + .action(connect) + .action(disconnect) + .action(canEagerConnect) + .action(canSwitchNetwork) + .action(getChainId) + .action(getAllowance) + .action(getTransactionReceipt) + .action(waitForTransactionReceipt) + .action(viemWalletAdapter(evmDefault)) + .action(viemPublicAdapter(rpcUrl)) + .build(); + +export { buildEvm }; diff --git a/wallets/provider-default/src/provider.ts b/wallets/provider-default/src/provider.ts index 949b51114a..46aff4715d 100644 --- a/wallets/provider-default/src/provider.ts +++ b/wallets/provider-default/src/provider.ts @@ -1,11 +1,17 @@ +import type { NamespacesRPCUrls } from '@hub3js/namespaces'; + import { ProviderBuilder } from '@hub3js/core'; import { INJECTION_DELAY, metadata, WALLET_ID } from './constants.js'; -import { evm } from './namespaces/evm.js'; +import { buildEvm } from './namespaces/evm.js'; import { defaultInjected } from './utils.js'; -const buildProvider = () => - new ProviderBuilder(WALLET_ID) +const buildProvider = (rpcURLs: NamespacesRPCUrls) => { + if (!rpcURLs?.evm) { + throw new Error('An RPC URL for the EVM namespace is required.'); + } + + return new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); @@ -17,7 +23,8 @@ const buildProvider = () => }, INJECTION_DELAY); }) .config('metadata', metadata) - .add('evm', evm) + .add('evm', buildEvm(rpcURLs.evm)) .build(); +}; export { buildProvider }; diff --git a/wallets/provider-default/src/signer.ts b/wallets/provider-default/src/signer.ts deleted file mode 100644 index 6f05aa1495..0000000000 --- a/wallets/provider-default/src/signer.ts +++ /dev/null @@ -1,17 +0,0 @@ -import type { Provider } from './types.js'; -import type { SignerFactory } from 'rango-types'; - -import { EVM_NAMESPACE } from '@hub3js/namespaces'; -import { DefaultSignerFactory, TransactionType as TxType } from 'rango-types'; - -export default async function getSigners( - provider: Provider -): Promise { - const evmProvider = provider.get(EVM_NAMESPACE); - const signers = new DefaultSignerFactory(); - const { DefaultEvmSigner } = await import('@rango-dev/signer-evm'); - if (!!evmProvider) { - signers.registerSigner(TxType.EVM, new DefaultEvmSigner(evmProvider)); - } - return signers; -} diff --git a/wallets/provider-default/src/utils.ts b/wallets/provider-default/src/utils.ts index 5f136ca444..59012f3b92 100644 --- a/wallets/provider-default/src/utils.ts +++ b/wallets/provider-default/src/utils.ts @@ -21,16 +21,6 @@ export function defaultInjected(): Provider | null { return instances; } -export function getInstanceOrThrow(): Provider { - const instances = defaultInjected(); - - if (!instances) { - throw new Error('ethereum is not injected. Please check your wallet.'); - } - - return instances; -} - export function evmDefault(): EvmProviderApi { const instances = defaultInjected(); diff --git a/wallets/provider-enkrypt/src/constants.ts b/wallets/provider-enkrypt/src/constants.ts index fd0059d02c..77f913e04c 100644 --- a/wallets/provider-enkrypt/src/constants.ts +++ b/wallets/provider-enkrypt/src/constants.ts @@ -2,9 +2,6 @@ import type { ProviderMetadata } from '@hub3js/core'; import { isEvmNamespace } from '@hub3js/evm'; -import getSigners from './signer.js'; -import { getInstanceOrThrow } from './utils.js'; - export const WALLET_ID = 'enkrypt'; // Enkrypt rejects with a bare string, not an error object. export const ENKRYPT_REJECTION = @@ -37,9 +34,5 @@ export const metadata: ProviderMetadata = { ], }, }, - { - name: 'signers', - value: { getSigners: async () => getSigners(getInstanceOrThrow()) }, - }, ], }; diff --git a/wallets/provider-enkrypt/src/namespaces/evm.ts b/wallets/provider-enkrypt/src/namespaces/evm.ts index ab1fb4a929..7424b3b138 100644 --- a/wallets/provider-enkrypt/src/namespaces/evm.ts +++ b/wallets/provider-enkrypt/src/namespaces/evm.ts @@ -1,7 +1,13 @@ import type { EvmActions } from '@hub3js/evm'; import { NamespaceBuilder } from '@hub3js/core'; -import { actions, builders, hooks } from '@hub3js/evm'; +import { + actions, + builders, + hooks, + viemPublicAdapter, + viemWalletAdapter, +} from '@hub3js/evm'; import * as commonBuilders from '@hub3js/std/builders'; import { standardizeAndThrowError } from '@hub3js/std/operators'; @@ -50,14 +56,23 @@ const getTransactionReceipt = builders .action(actions.getTransactionReceipt(evmEnkrypt)) .build(); -const evm = new NamespaceBuilder('EVM', WALLET_ID) - .action(connect) - .action(disconnect) - .action(canEagerConnect) - .action(canSwitchNetwork) - .action(getChainId) - .action(getAllowance) - .action(getTransactionReceipt) +const waitForTransactionReceipt = builders + .waitForTransactionReceipt() + .action(actions.waitForTransactionReceipt(evmEnkrypt)) .build(); -export { evm }; +const buildEvm = (rpcUrl: string) => + new NamespaceBuilder('EVM', WALLET_ID) + .action(connect) + .action(disconnect) + .action(canEagerConnect) + .action(canSwitchNetwork) + .action(getChainId) + .action(getAllowance) + .action(getTransactionReceipt) + .action(waitForTransactionReceipt) + .action(viemWalletAdapter(evmEnkrypt)) + .action(viemPublicAdapter(rpcUrl)) + .build(); + +export { buildEvm }; diff --git a/wallets/provider-enkrypt/src/provider.ts b/wallets/provider-enkrypt/src/provider.ts index 7ff1b0b9c3..62f912246d 100644 --- a/wallets/provider-enkrypt/src/provider.ts +++ b/wallets/provider-enkrypt/src/provider.ts @@ -1,11 +1,17 @@ +import type { NamespacesRPCUrls } from '@hub3js/namespaces'; + import { ProviderBuilder } from '@hub3js/core'; import { metadata, WALLET_ID } from './constants.js'; -import { evm } from './namespaces/evm.js'; +import { buildEvm } from './namespaces/evm.js'; import { enkrypt } from './utils.js'; -const buildProvider = () => - new ProviderBuilder(WALLET_ID) +const buildProvider = (rpcURLs: NamespacesRPCUrls) => { + if (!rpcURLs?.evm) { + throw new Error('An RPC URL for the EVM namespace is required.'); + } + + return new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); @@ -15,7 +21,8 @@ const buildProvider = () => } }) .config('metadata', metadata) - .add('evm', evm) + .add('evm', buildEvm(rpcURLs.evm)) .build(); +}; export { buildProvider }; diff --git a/wallets/provider-enkrypt/src/signer.ts b/wallets/provider-enkrypt/src/signer.ts deleted file mode 100644 index 767e5ff5f0..0000000000 --- a/wallets/provider-enkrypt/src/signer.ts +++ /dev/null @@ -1,20 +0,0 @@ -import type { Provider } from './types.js'; -import type { SignerFactory } from 'rango-types'; - -import { EVM_NAMESPACE } from '@hub3js/namespaces'; -import { DefaultSignerFactory, TransactionType } from 'rango-types'; - -export default async function getSigners( - provider: Provider -): Promise { - const ethProvider = provider.get(EVM_NAMESPACE); - const signers = new DefaultSignerFactory(); - const { DefaultEvmSigner } = await import('@rango-dev/signer-evm'); - if (!!ethProvider) { - signers.registerSigner( - TransactionType.EVM, - new DefaultEvmSigner(ethProvider) - ); - } - return signers; -} diff --git a/wallets/provider-enkrypt/src/utils.ts b/wallets/provider-enkrypt/src/utils.ts index d7903addb7..3e3e877556 100644 --- a/wallets/provider-enkrypt/src/utils.ts +++ b/wallets/provider-enkrypt/src/utils.ts @@ -14,18 +14,6 @@ export function enkrypt(): Provider | null { return instances; } -export function getInstanceOrThrow(): Provider { - const instances = enkrypt(); - - if (!instances) { - throw new Error( - 'Enkrypt Wallet is not injected. Please check your wallet.' - ); - } - - return instances; -} - export function evmEnkrypt(): EnkryptEvmProvider { const instances = enkrypt(); From ad312e7c47703767b695468240e7c167f144cd0f Mon Sep 17 00:00:00 2001 From: arlert-armin Date: Tue, 6 Oct 2026 19:53:21 +0000 Subject: [PATCH 06/29] feat(wallets): register viem actions on injected evm wallets Their EVM namespaces register `viemWalletAdapter` and `viemPublicAdapter`, plus wallet-transport `getTransactionReceipt` and `waitForTransactionReceipt`, and are built with the EVM RPC URL. EVM signers are no longer registered; providers left without a signer drop their `signers` property. --- wallets/provider-exodus/src/namespaces/evm.ts | 34 ++++++++++++------ wallets/provider-exodus/src/provider.ts | 15 +++++--- wallets/provider-exodus/src/signer.ts | 7 +--- .../src/namespaces/evm.ts | 34 ++++++++++++------ wallets/provider-math-wallet/src/provider.ts | 15 +++++--- wallets/provider-math-wallet/src/signer.ts | 7 +--- .../provider-metamask/src/namespaces/evm.ts | 35 +++++++++++++------ wallets/provider-metamask/src/provider.ts | 15 +++++--- wallets/provider-metamask/src/signer.ts | 7 +--- wallets/provider-okx/src/namespaces/evm.ts | 35 +++++++++++++------ wallets/provider-okx/src/provider.ts | 14 +++++--- wallets/provider-okx/src/signer.ts | 6 ---- .../provider-phantom/src/namespaces/evm.ts | 35 +++++++++++++------ wallets/provider-phantom/src/provider.ts | 15 +++++--- wallets/provider-phantom/src/signer.ts | 11 +----- wallets/provider-rabby/src/constants.ts | 7 ---- wallets/provider-rabby/src/namespaces/evm.ts | 35 +++++++++++++------ wallets/provider-rabby/src/provider.ts | 15 +++++--- wallets/provider-rabby/src/signer.ts | 17 --------- wallets/provider-rabby/src/utils.ts | 10 ------ wallets/provider-safepal/src/constants.ts | 7 ---- .../provider-safepal/src/namespaces/evm.ts | 32 ++++++++++++----- wallets/provider-safepal/src/provider.ts | 15 +++++--- wallets/provider-safepal/src/signer.ts | 17 --------- wallets/provider-safepal/src/utils.ts | 9 ----- 25 files changed, 251 insertions(+), 198 deletions(-) delete mode 100644 wallets/provider-rabby/src/signer.ts delete mode 100644 wallets/provider-safepal/src/signer.ts diff --git a/wallets/provider-exodus/src/namespaces/evm.ts b/wallets/provider-exodus/src/namespaces/evm.ts index 7261f579c9..ec1ee6ece9 100644 --- a/wallets/provider-exodus/src/namespaces/evm.ts +++ b/wallets/provider-exodus/src/namespaces/evm.ts @@ -1,7 +1,12 @@ import type { EvmActions } from '@hub3js/evm'; import { NamespaceBuilder } from '@hub3js/core'; -import { actions, builders } from '@hub3js/evm'; +import { + actions, + builders, + viemPublicAdapter, + viemWalletAdapter, +} from '@hub3js/evm'; import * as commonBuilders from '@hub3js/std/builders'; import { standardizeAndThrowError } from '@hub3js/std/operators'; @@ -41,14 +46,23 @@ const getTransactionReceipt = builders .action(actions.getTransactionReceipt(evmExodus)) .build(); -const evm = new NamespaceBuilder('EVM', WALLET_ID) - .action(connect) - .action(disconnect) - .action(canEagerConnect) - .action(getChainId) - .action(canSwitchNetwork) - .action(getAllowance) - .action(getTransactionReceipt) +const waitForTransactionReceipt = builders + .waitForTransactionReceipt() + .action(actions.waitForTransactionReceipt(evmExodus)) .build(); -export { evm }; +const buildEvm = (rpcUrl: string) => + new NamespaceBuilder('EVM', WALLET_ID) + .action(connect) + .action(disconnect) + .action(canEagerConnect) + .action(getChainId) + .action(canSwitchNetwork) + .action(getAllowance) + .action(getTransactionReceipt) + .action(waitForTransactionReceipt) + .action(viemWalletAdapter(evmExodus)) + .action(viemPublicAdapter(rpcUrl)) + .build(); + +export { buildEvm }; diff --git a/wallets/provider-exodus/src/provider.ts b/wallets/provider-exodus/src/provider.ts index 63e433704f..14781c8da6 100644 --- a/wallets/provider-exodus/src/provider.ts +++ b/wallets/provider-exodus/src/provider.ts @@ -1,13 +1,19 @@ +import type { NamespacesRPCUrls } from '@hub3js/namespaces'; + import { ProviderBuilder } from '@hub3js/core'; import { metadata, WALLET_ID } from './constants.js'; -import { evm } from './namespaces/evm.js'; +import { buildEvm } from './namespaces/evm.js'; import { solana } from './namespaces/solana.js'; import { exodus as exodusInstance } from './utils.js'; const WALLET_INJECTION_DELAY_MS = 1000; -const buildProvider = () => - new ProviderBuilder(WALLET_ID) +const buildProvider = (rpcURLs: NamespacesRPCUrls) => { + if (!rpcURLs?.evm) { + throw new Error('An RPC URL for the EVM namespace is required.'); + } + + return new ProviderBuilder(WALLET_ID) .init((context) => setTimeout(function () { const [, setState] = context.state(); @@ -20,7 +26,8 @@ const buildProvider = () => ) .config('metadata', metadata) .add('solana', solana) - .add('evm', evm) + .add('evm', buildEvm(rpcURLs.evm)) .build(); +}; export { buildProvider }; diff --git a/wallets/provider-exodus/src/signer.ts b/wallets/provider-exodus/src/signer.ts index ec19abe758..1bd591f171 100644 --- a/wallets/provider-exodus/src/signer.ts +++ b/wallets/provider-exodus/src/signer.ts @@ -1,7 +1,7 @@ import type { Provider } from './types.js'; import type { SignerFactory } from 'rango-types'; -import { EVM_NAMESPACE, SOLANA_NAMESPACE } from '@hub3js/namespaces'; +import { SOLANA_NAMESPACE } from '@hub3js/namespaces'; import { DefaultSignerFactory, TransactionType as TxType } from 'rango-types'; import { ExodusSolanaSigner } from './signers/solana.js'; @@ -9,13 +9,8 @@ import { ExodusSolanaSigner } from './signers/solana.js'; export default async function getSigners( provider: Provider ): Promise { - const ethProvider = provider.get(EVM_NAMESPACE); const solProvider = provider.get(SOLANA_NAMESPACE); const signers = new DefaultSignerFactory(); - const { DefaultEvmSigner } = await import('@rango-dev/signer-evm'); - if (!!ethProvider) { - signers.registerSigner(TxType.EVM, new DefaultEvmSigner(ethProvider)); - } if (!!solProvider) { signers.registerSigner(TxType.SOLANA, new ExodusSolanaSigner(solProvider)); } diff --git a/wallets/provider-math-wallet/src/namespaces/evm.ts b/wallets/provider-math-wallet/src/namespaces/evm.ts index 284128a7fe..8d2fae2cc8 100644 --- a/wallets/provider-math-wallet/src/namespaces/evm.ts +++ b/wallets/provider-math-wallet/src/namespaces/evm.ts @@ -1,7 +1,12 @@ import type { EvmActions } from '@hub3js/evm'; import { NamespaceBuilder } from '@hub3js/core'; -import { actions, builders } from '@hub3js/evm'; +import { + actions, + builders, + viemPublicAdapter, + viemWalletAdapter, +} from '@hub3js/evm'; import * as commonBuilders from '@hub3js/std/builders'; import { standardizeAndThrowError } from '@hub3js/std/operators'; @@ -42,14 +47,23 @@ const getTransactionReceipt = builders .action(actions.getTransactionReceipt(evmMathWallet)) .build(); -const evm = new NamespaceBuilder('EVM', WALLET_ID) - .action(connect) - .action(disconnect) - .action(canSwitchNetwork) - .action(canEagerConnect) - .action(getChainId) - .action(getAllowance) - .action(getTransactionReceipt) +const waitForTransactionReceipt = builders + .waitForTransactionReceipt() + .action(actions.waitForTransactionReceipt(evmMathWallet)) .build(); -export { evm }; +const buildEvm = (rpcUrl: string) => + new NamespaceBuilder('EVM', WALLET_ID) + .action(connect) + .action(disconnect) + .action(canSwitchNetwork) + .action(canEagerConnect) + .action(getChainId) + .action(getAllowance) + .action(getTransactionReceipt) + .action(waitForTransactionReceipt) + .action(viemWalletAdapter(evmMathWallet)) + .action(viemPublicAdapter(rpcUrl)) + .build(); + +export { buildEvm }; diff --git a/wallets/provider-math-wallet/src/provider.ts b/wallets/provider-math-wallet/src/provider.ts index 23def3e94b..9049fb9f0e 100644 --- a/wallets/provider-math-wallet/src/provider.ts +++ b/wallets/provider-math-wallet/src/provider.ts @@ -1,3 +1,5 @@ +import type { NamespacesRPCUrls } from '@hub3js/namespaces'; + import { ProviderBuilder } from '@hub3js/core'; import { @@ -5,12 +7,16 @@ import { metadata, WALLET_ID, } from './constants.js'; -import { evm } from './namespaces/evm.js'; +import { buildEvm } from './namespaces/evm.js'; import { solana } from './namespaces/solana.js'; import { mathWallet } from './utils.js'; -const buildProvider = () => - new ProviderBuilder(WALLET_ID) +const buildProvider = (rpcURLs: NamespacesRPCUrls) => { + if (!rpcURLs?.evm) { + throw new Error('An RPC URL for the EVM namespace is required.'); + } + + return new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); @@ -23,7 +29,8 @@ const buildProvider = () => }) .config('metadata', metadata) .add('solana', solana) - .add('evm', evm) + .add('evm', buildEvm(rpcURLs.evm)) .build(); +}; export { buildProvider }; diff --git a/wallets/provider-math-wallet/src/signer.ts b/wallets/provider-math-wallet/src/signer.ts index 96bc2f2064..d47dbaf392 100644 --- a/wallets/provider-math-wallet/src/signer.ts +++ b/wallets/provider-math-wallet/src/signer.ts @@ -1,22 +1,17 @@ import type { Provider } from './types.js'; import type { SignerFactory } from 'rango-types'; -import { EVM_NAMESPACE, SOLANA_NAMESPACE } from '@hub3js/namespaces'; +import { SOLANA_NAMESPACE } from '@hub3js/namespaces'; import { DefaultSignerFactory, TransactionType as TxType } from 'rango-types'; export default async function getSigners( provider: Provider ): Promise { - const ethProvider = provider.get(EVM_NAMESPACE); const solProvider = provider.get(SOLANA_NAMESPACE); const signers = new DefaultSignerFactory(); - const { DefaultEvmSigner } = await import('@rango-dev/signer-evm'); const { DefaultSolanaSigner } = await import('@rango-dev/signer-solana'); - if (!!ethProvider) { - signers.registerSigner(TxType.EVM, new DefaultEvmSigner(ethProvider)); - } if (!!solProvider) { signers.registerSigner(TxType.SOLANA, new DefaultSolanaSigner(solProvider)); } diff --git a/wallets/provider-metamask/src/namespaces/evm.ts b/wallets/provider-metamask/src/namespaces/evm.ts index ae95ac3a2f..de068af637 100644 --- a/wallets/provider-metamask/src/namespaces/evm.ts +++ b/wallets/provider-metamask/src/namespaces/evm.ts @@ -1,7 +1,13 @@ import type { EvmActions } from '@hub3js/evm'; import { ActionBuilder, NamespaceBuilder } from '@hub3js/core'; -import { actions, builders, utils } from '@hub3js/evm'; +import { + actions, + builders, + utils, + viemPublicAdapter, + viemWalletAdapter, +} from '@hub3js/evm'; import * as commonBuilders from '@hub3js/std/builders'; import { connectAndUpdateStateForMultiNetworks, @@ -76,14 +82,23 @@ const getTransactionReceipt = builders .action(actions.getTransactionReceipt(evmMetamask)) .build(); -const evm = new NamespaceBuilder('EVM', WALLET_ID) - .action(connect) - .action(disconnect) - .action(canSwitchNetwork) - .action(canEagerConnect) - .action(getChainId) - .action(getAllowance) - .action(getTransactionReceipt) +const waitForTransactionReceipt = builders + .waitForTransactionReceipt() + .action(actions.waitForTransactionReceipt(evmMetamask)) .build(); -export { evm }; +const buildEvm = (rpcUrl: string) => + new NamespaceBuilder('EVM', WALLET_ID) + .action(connect) + .action(disconnect) + .action(canSwitchNetwork) + .action(canEagerConnect) + .action(getChainId) + .action(getAllowance) + .action(getTransactionReceipt) + .action(waitForTransactionReceipt) + .action(viemWalletAdapter(evmMetamask)) + .action(viemPublicAdapter(rpcUrl)) + .build(); + +export { buildEvm }; diff --git a/wallets/provider-metamask/src/provider.ts b/wallets/provider-metamask/src/provider.ts index 00ce5736d6..8238579c30 100644 --- a/wallets/provider-metamask/src/provider.ts +++ b/wallets/provider-metamask/src/provider.ts @@ -1,12 +1,18 @@ +import type { NamespacesRPCUrls } from '@hub3js/namespaces'; + import { ProviderBuilder } from '@hub3js/core'; import { metadata, WALLET_ID } from './constants.js'; -import { evm } from './namespaces/evm.js'; +import { buildEvm } from './namespaces/evm.js'; import { solana } from './namespaces/solana.js'; import { metamask as metamask } from './utils.js'; -const buildProvider = () => - new ProviderBuilder(WALLET_ID) +const buildProvider = (rpcURLs: NamespacesRPCUrls) => { + if (!rpcURLs?.evm) { + throw new Error('An RPC URL for the EVM namespace is required.'); + } + + return new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); @@ -16,8 +22,9 @@ const buildProvider = () => } }) .config('metadata', metadata) - .add('evm', evm) + .add('evm', buildEvm(rpcURLs.evm)) .add('solana', solana) .build(); +}; export { buildProvider }; diff --git a/wallets/provider-metamask/src/signer.ts b/wallets/provider-metamask/src/signer.ts index 800dcfd61b..2d3c639ec7 100644 --- a/wallets/provider-metamask/src/signer.ts +++ b/wallets/provider-metamask/src/signer.ts @@ -1,7 +1,7 @@ import type { Provider } from './types.js'; import type { SignerFactory } from 'rango-types'; -import { EVM_NAMESPACE, SOLANA_NAMESPACE } from '@hub3js/namespaces'; +import { SOLANA_NAMESPACE } from '@hub3js/namespaces'; import { DefaultSignerFactory, TransactionType as TxType } from 'rango-types'; import { MetamaskSolanaSigner } from './signers/solana.js'; @@ -9,14 +9,9 @@ import { MetamaskSolanaSigner } from './signers/solana.js'; export default async function getSigners( provider: Provider ): Promise { - const ethProvider = provider.get(EVM_NAMESPACE); const solanaProvider = provider.get(SOLANA_NAMESPACE); const signers = new DefaultSignerFactory(); - const { DefaultEvmSigner } = await import('@rango-dev/signer-evm'); - if (!!ethProvider) { - signers.registerSigner(TxType.EVM, new DefaultEvmSigner(ethProvider)); - } if (!!solanaProvider) { signers.registerSigner( TxType.SOLANA, diff --git a/wallets/provider-okx/src/namespaces/evm.ts b/wallets/provider-okx/src/namespaces/evm.ts index ea97e0cd7b..67436561d7 100644 --- a/wallets/provider-okx/src/namespaces/evm.ts +++ b/wallets/provider-okx/src/namespaces/evm.ts @@ -1,7 +1,13 @@ import type { EvmActions } from '@hub3js/evm'; import { NamespaceBuilder } from '@hub3js/core'; -import { actions, builders, utils } from '@hub3js/evm'; +import { + actions, + builders, + utils, + viemPublicAdapter, + viemWalletAdapter, +} from '@hub3js/evm'; import * as commonBuilders from '@hub3js/std/builders'; import { standardizeAndThrowError } from '@hub3js/std/operators'; @@ -66,14 +72,23 @@ const getTransactionReceipt = builders .action(actions.getTransactionReceipt(evmOKX)) .build(); -const evm = new NamespaceBuilder('EVM', WALLET_ID) - .action(connect) - .action(disconnect) - .action(canEagerConnect) - .action(canSwitchNetwork) - .action(getChainId) - .action(getAllowance) - .action(getTransactionReceipt) +const waitForTransactionReceipt = builders + .waitForTransactionReceipt() + .action(actions.waitForTransactionReceipt(evmOKX)) .build(); -export { evm }; +const buildEvm = (rpcUrl: string) => + new NamespaceBuilder('EVM', WALLET_ID) + .action(connect) + .action(disconnect) + .action(canEagerConnect) + .action(canSwitchNetwork) + .action(getChainId) + .action(getAllowance) + .action(getTransactionReceipt) + .action(waitForTransactionReceipt) + .action(viemWalletAdapter(evmOKX)) + .action(viemPublicAdapter(rpcUrl)) + .build(); + +export { buildEvm }; diff --git a/wallets/provider-okx/src/provider.ts b/wallets/provider-okx/src/provider.ts index 47ad312f9e..b7fa2ff605 100644 --- a/wallets/provider-okx/src/provider.ts +++ b/wallets/provider-okx/src/provider.ts @@ -1,9 +1,10 @@ import type { Environments } from './namespaces/ton/types.js'; +import type { NamespacesRPCUrls } from '@hub3js/namespaces'; import { ProviderBuilder } from '@hub3js/core'; import { metadata, WALLET_ID } from './constants.js'; -import { evm } from './namespaces/evm.js'; +import { buildEvm } from './namespaces/evm.js'; import { solana } from './namespaces/solana.js'; import { sui } from './namespaces/sui.js'; import { ton } from './namespaces/ton/ton.js'; @@ -12,8 +13,12 @@ import { tron } from './namespaces/tron.js'; import { utxo } from './namespaces/utxo.js'; import { okx as okxInstance } from './utils.js'; -const buildProvider = () => - new ProviderBuilder(WALLET_ID) +const buildProvider = (rpcURLs: NamespacesRPCUrls) => { + if (!rpcURLs?.evm) { + throw new Error('An RPC URL for the EVM namespace is required.'); + } + + return new ProviderBuilder(WALLET_ID) .init(function (context, environments?: Environments) { setEnvironments(environments); const [, setState] = context.state(); @@ -25,12 +30,13 @@ const buildProvider = () => }) .config('metadata', metadata) .add('solana', solana) - .add('evm', evm) + .add('evm', buildEvm(rpcURLs.evm)) .add('utxo', utxo) .add('ton', ton) .add('tron', tron) .add('sui', sui) .build(); +}; export { buildProvider }; diff --git a/wallets/provider-okx/src/signer.ts b/wallets/provider-okx/src/signer.ts index fee0de50cf..e8a793dd0f 100644 --- a/wallets/provider-okx/src/signer.ts +++ b/wallets/provider-okx/src/signer.ts @@ -2,7 +2,6 @@ import type { Provider } from './types.js'; import type { SignerFactory } from 'rango-types'; import { - EVM_NAMESPACE, SOLANA_NAMESPACE, TON_NAMESPACE, TRON_NAMESPACE, @@ -18,18 +17,13 @@ import { suiWalletInstance } from './utils.js'; export default async function getSigners( provider: Provider ): Promise { - const ethProvider = provider.get(EVM_NAMESPACE); const solProvider = provider.get(SOLANA_NAMESPACE); const utxoProvider = provider.get(UTXO_NAMESPACE); const tonProvider = provider.get(TON_NAMESPACE); const tronProvider = provider.get(TRON_NAMESPACE); const signers = new DefaultSignerFactory(); - const { DefaultEvmSigner } = await import('@rango-dev/signer-evm'); const { DefaultTronSigner } = await import('@rango-dev/signer-tron'); - if (!!ethProvider) { - signers.registerSigner(TxType.EVM, new DefaultEvmSigner(ethProvider)); - } if (!!solProvider) { signers.registerSigner(TxType.SOLANA, new OKXSolanaSigner(solProvider)); } diff --git a/wallets/provider-phantom/src/namespaces/evm.ts b/wallets/provider-phantom/src/namespaces/evm.ts index 5c65f2ef9d..195493a99f 100644 --- a/wallets/provider-phantom/src/namespaces/evm.ts +++ b/wallets/provider-phantom/src/namespaces/evm.ts @@ -1,7 +1,13 @@ import type { EvmActions } from '@hub3js/evm'; import { NamespaceBuilder } from '@hub3js/core'; -import { actions, builders, hooks } from '@hub3js/evm'; +import { + actions, + builders, + hooks, + viemPublicAdapter, + viemWalletAdapter, +} from '@hub3js/evm'; import * as commonBuilders from '@hub3js/std/builders'; import { standardizeAndThrowError } from '@hub3js/std/operators'; @@ -55,14 +61,23 @@ const getTransactionReceipt = builders .action(actions.getTransactionReceipt(evmPhantom)) .build(); -const evm = new NamespaceBuilder('EVM', WALLET_ID) - .action(connect) - .action(disconnect) - .action(canEagerConnect) - .action(canSwitchNetwork) - .action(getChainId) - .action(getAllowance) - .action(getTransactionReceipt) +const waitForTransactionReceipt = builders + .waitForTransactionReceipt() + .action(actions.waitForTransactionReceipt(evmPhantom)) .build(); -export { evm }; +const buildEvm = (rpcUrl: string) => + new NamespaceBuilder('EVM', WALLET_ID) + .action(connect) + .action(disconnect) + .action(canEagerConnect) + .action(canSwitchNetwork) + .action(getChainId) + .action(getAllowance) + .action(getTransactionReceipt) + .action(waitForTransactionReceipt) + .action(viemWalletAdapter(evmPhantom)) + .action(viemPublicAdapter(rpcUrl)) + .build(); + +export { buildEvm }; diff --git a/wallets/provider-phantom/src/provider.ts b/wallets/provider-phantom/src/provider.ts index 3a8c9f3cd6..f401885d3a 100644 --- a/wallets/provider-phantom/src/provider.ts +++ b/wallets/provider-phantom/src/provider.ts @@ -1,12 +1,18 @@ +import type { NamespacesRPCUrls } from '@hub3js/namespaces'; + import { ProviderBuilder } from '@hub3js/core'; import { metadata, WALLET_ID } from './constants.js'; -import { evm } from './namespaces/evm.js'; +import { buildEvm } from './namespaces/evm.js'; import { solana } from './namespaces/solana.js'; import { phantom as phantomInstance } from './utils.js'; -const buildProvider = () => - new ProviderBuilder(WALLET_ID) +const buildProvider = (rpcURLs: NamespacesRPCUrls) => { + if (!rpcURLs?.evm) { + throw new Error('An RPC URL for the EVM namespace is required.'); + } + + return new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); @@ -17,7 +23,8 @@ const buildProvider = () => }) .config('metadata', metadata) .add('solana', solana) - .add('evm', evm) + .add('evm', buildEvm(rpcURLs.evm)) .build(); +}; export { buildProvider }; diff --git a/wallets/provider-phantom/src/signer.ts b/wallets/provider-phantom/src/signer.ts index 1f90765f6e..c63026c7dd 100644 --- a/wallets/provider-phantom/src/signer.ts +++ b/wallets/provider-phantom/src/signer.ts @@ -1,30 +1,21 @@ import type { Provider } from './utils.js'; import type { SignerFactory } from 'rango-types'; -import { - EVM_NAMESPACE, - SOLANA_NAMESPACE, - UTXO_NAMESPACE, -} from '@hub3js/namespaces'; +import { SOLANA_NAMESPACE, UTXO_NAMESPACE } from '@hub3js/namespaces'; import { DefaultSignerFactory, TransactionType as TxType } from 'rango-types'; export default async function getSigners( provider: Provider ): Promise { const solProvider = provider.get(SOLANA_NAMESPACE); - const evmProvider = provider.get(EVM_NAMESPACE); const bitcoinInstance = provider.get(UTXO_NAMESPACE); - const { DefaultEvmSigner } = await import('@rango-dev/signer-evm'); const { DefaultSolanaSigner } = await import('@rango-dev/signer-solana'); const { BTCSigner } = await import('./signers/utxoSigner.js'); const signers = new DefaultSignerFactory(); if (!!solProvider) { signers.registerSigner(TxType.SOLANA, new DefaultSolanaSigner(solProvider)); } - if (!!evmProvider) { - signers.registerSigner(TxType.EVM, new DefaultEvmSigner(evmProvider)); - } if (!!bitcoinInstance) { signers.registerSigner(TxType.TRANSFER, new BTCSigner(bitcoinInstance)); } diff --git a/wallets/provider-rabby/src/constants.ts b/wallets/provider-rabby/src/constants.ts index d7f557afee..4ebd6ca24c 100644 --- a/wallets/provider-rabby/src/constants.ts +++ b/wallets/provider-rabby/src/constants.ts @@ -2,9 +2,6 @@ import type { ProviderMetadata } from '@hub3js/core'; import { isEvmNamespace } from '@hub3js/evm'; -import getSigners from './signer.js'; -import { getInstanceOrThrow } from './utils.js'; - export const WALLET_ID = 'rabby'; export const metadata: ProviderMetadata = { @@ -33,9 +30,5 @@ export const metadata: ProviderMetadata = { ], }, }, - { - name: 'signers', - value: { getSigners: async () => getSigners(getInstanceOrThrow()) }, - }, ], }; diff --git a/wallets/provider-rabby/src/namespaces/evm.ts b/wallets/provider-rabby/src/namespaces/evm.ts index 73d692a2ff..aac3fe9442 100644 --- a/wallets/provider-rabby/src/namespaces/evm.ts +++ b/wallets/provider-rabby/src/namespaces/evm.ts @@ -1,7 +1,13 @@ import type { EvmActions } from '@hub3js/evm'; import { NamespaceBuilder } from '@hub3js/core'; -import { actions, builders, hooks } from '@hub3js/evm'; +import { + actions, + builders, + hooks, + viemPublicAdapter, + viemWalletAdapter, +} from '@hub3js/evm'; import * as commonBuilders from '@hub3js/std/builders'; import { standardizeAndThrowError } from '@hub3js/std/operators'; @@ -49,14 +55,23 @@ const getTransactionReceipt = builders .action(actions.getTransactionReceipt(evmRabby)) .build(); -const evm = new NamespaceBuilder('EVM', WALLET_ID) - .action(connect) - .action(disconnect) - .action(canEagerConnect) - .action(canSwitchNetwork) - .action(getChainId) - .action(getAllowance) - .action(getTransactionReceipt) +const waitForTransactionReceipt = builders + .waitForTransactionReceipt() + .action(actions.waitForTransactionReceipt(evmRabby)) .build(); -export { evm }; +const buildEvm = (rpcUrl: string) => + new NamespaceBuilder('EVM', WALLET_ID) + .action(connect) + .action(disconnect) + .action(canEagerConnect) + .action(canSwitchNetwork) + .action(getChainId) + .action(getAllowance) + .action(getTransactionReceipt) + .action(waitForTransactionReceipt) + .action(viemWalletAdapter(evmRabby)) + .action(viemPublicAdapter(rpcUrl)) + .build(); + +export { buildEvm }; diff --git a/wallets/provider-rabby/src/provider.ts b/wallets/provider-rabby/src/provider.ts index 2b3bd56073..1892ac31dd 100644 --- a/wallets/provider-rabby/src/provider.ts +++ b/wallets/provider-rabby/src/provider.ts @@ -1,11 +1,17 @@ +import type { NamespacesRPCUrls } from '@hub3js/namespaces'; + import { ProviderBuilder } from '@hub3js/core'; import { metadata, WALLET_ID } from './constants.js'; -import { evm } from './namespaces/evm.js'; +import { buildEvm } from './namespaces/evm.js'; import { rabby as rabbyInstance } from './utils.js'; -const buildProvider = () => - new ProviderBuilder(WALLET_ID) +const buildProvider = (rpcURLs: NamespacesRPCUrls) => { + if (!rpcURLs?.evm) { + throw new Error('An RPC URL for the EVM namespace is required.'); + } + + return new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); if (rabbyInstance()) { @@ -14,7 +20,8 @@ const buildProvider = () => } }) .config('metadata', metadata) - .add('evm', evm) + .add('evm', buildEvm(rpcURLs.evm)) .build(); +}; export { buildProvider }; diff --git a/wallets/provider-rabby/src/signer.ts b/wallets/provider-rabby/src/signer.ts deleted file mode 100644 index e8cde811ef..0000000000 --- a/wallets/provider-rabby/src/signer.ts +++ /dev/null @@ -1,17 +0,0 @@ -import type { Provider } from './utils.js'; -import type { SignerFactory } from 'rango-types'; - -import { EVM_NAMESPACE } from '@hub3js/namespaces'; -import { DefaultSignerFactory, TransactionType as TxType } from 'rango-types'; - -export default async function getSigners( - provider: Provider -): Promise { - const evmProvider = provider.get(EVM_NAMESPACE); - const signers = new DefaultSignerFactory(); - const { DefaultEvmSigner } = await import('@rango-dev/signer-evm'); - if (!!evmProvider) { - signers.registerSigner(TxType.EVM, new DefaultEvmSigner(evmProvider)); - } - return signers; -} diff --git a/wallets/provider-rabby/src/utils.ts b/wallets/provider-rabby/src/utils.ts index 2d10100ec2..7834e181b7 100644 --- a/wallets/provider-rabby/src/utils.ts +++ b/wallets/provider-rabby/src/utils.ts @@ -27,16 +27,6 @@ export function rabby(): Provider | null { return instances; } -export function getInstanceOrThrow(): Provider { - const instances = rabby(); - - if (!instances) { - throw new Error('Rabby is not injected. Please check your wallet.'); - } - - return instances; -} - export function evmRabby(): EvmProviderApi { const instances = rabby(); diff --git a/wallets/provider-safepal/src/constants.ts b/wallets/provider-safepal/src/constants.ts index f20cc21434..0e6e7cae3c 100644 --- a/wallets/provider-safepal/src/constants.ts +++ b/wallets/provider-safepal/src/constants.ts @@ -2,9 +2,6 @@ import type { ProviderMetadata } from '@hub3js/core'; import { isEvmNamespace } from '@hub3js/evm'; -import getSigners from './signer.js'; -import { getInstanceOrThrow } from './utils.js'; - export const WALLET_ID = 'safepal'; export const metadata: ProviderMetadata = { name: 'SafePal', @@ -33,9 +30,5 @@ export const metadata: ProviderMetadata = { ], }, }, - { - name: 'signers', - value: { getSigners: async () => getSigners(getInstanceOrThrow()) }, - }, ], }; diff --git a/wallets/provider-safepal/src/namespaces/evm.ts b/wallets/provider-safepal/src/namespaces/evm.ts index 7d1cad9a63..c3c37a2982 100644 --- a/wallets/provider-safepal/src/namespaces/evm.ts +++ b/wallets/provider-safepal/src/namespaces/evm.ts @@ -1,7 +1,12 @@ import type { EvmActions } from '@hub3js/evm'; import { ActionBuilder, NamespaceBuilder } from '@hub3js/core'; -import { actions, builders } from '@hub3js/evm'; +import { + actions, + builders, + viemPublicAdapter, + viemWalletAdapter, +} from '@hub3js/evm'; import * as commonBuilders from '@hub3js/std/builders'; import { connectAndUpdateStateForMultiNetworks, @@ -66,13 +71,22 @@ const getTransactionReceipt = builders .action(actions.getTransactionReceipt(evmSafepal)) .build(); -const evm = new NamespaceBuilder('EVM', WALLET_ID) - .action(connect) - .action(disconnect) - .action(canSwitchNetwork) - .action(getChainId) - .action(getAllowance) - .action(getTransactionReceipt) +const waitForTransactionReceipt = builders + .waitForTransactionReceipt() + .action(actions.waitForTransactionReceipt(evmSafepal)) .build(); -export { evm }; +const buildEvm = (rpcUrl: string) => + new NamespaceBuilder('EVM', WALLET_ID) + .action(connect) + .action(disconnect) + .action(canSwitchNetwork) + .action(getChainId) + .action(getAllowance) + .action(getTransactionReceipt) + .action(waitForTransactionReceipt) + .action(viemWalletAdapter(evmSafepal)) + .action(viemPublicAdapter(rpcUrl)) + .build(); + +export { buildEvm }; diff --git a/wallets/provider-safepal/src/provider.ts b/wallets/provider-safepal/src/provider.ts index 329d18dea5..3de1c83c56 100644 --- a/wallets/provider-safepal/src/provider.ts +++ b/wallets/provider-safepal/src/provider.ts @@ -1,12 +1,18 @@ +import type { NamespacesRPCUrls } from '@hub3js/namespaces'; + import { ProviderBuilder } from '@hub3js/core'; import { metadata, WALLET_ID } from './constants.js'; -import { evm } from './namespaces/evm.js'; +import { buildEvm } from './namespaces/evm.js'; import { safepal as safepalInstance } from './utils.js'; const WAIT_TO_LOAD_INSTANCE_DELAY = 1000; -const buildProvider = () => - new ProviderBuilder(WALLET_ID) +const buildProvider = (rpcURLs: NamespacesRPCUrls) => { + if (!rpcURLs?.evm) { + throw new Error('An RPC URL for the EVM namespace is required.'); + } + + return new ProviderBuilder(WALLET_ID) .init(function (context) { setTimeout(() => { if (safepalInstance()) { @@ -18,7 +24,8 @@ const buildProvider = () => }) .config('metadata', metadata) - .add('evm', evm) + .add('evm', buildEvm(rpcURLs.evm)) .build(); +}; export { buildProvider }; diff --git a/wallets/provider-safepal/src/signer.ts b/wallets/provider-safepal/src/signer.ts deleted file mode 100644 index eb60bb881c..0000000000 --- a/wallets/provider-safepal/src/signer.ts +++ /dev/null @@ -1,17 +0,0 @@ -import type { Provider } from './utils.js'; -import type { SignerFactory } from 'rango-types'; - -import { EVM_NAMESPACE } from '@hub3js/namespaces'; -import { DefaultSignerFactory, TransactionType as TxType } from 'rango-types'; - -export default async function getSigners( - provider: Provider -): Promise { - const ethProvider = provider.get(EVM_NAMESPACE); - const signers = new DefaultSignerFactory(); - const { DefaultEvmSigner } = await import('@rango-dev/signer-evm'); - if (!!ethProvider) { - signers.registerSigner(TxType.EVM, new DefaultEvmSigner(ethProvider)); - } - return signers; -} diff --git a/wallets/provider-safepal/src/utils.ts b/wallets/provider-safepal/src/utils.ts index af93bdb280..42e9de86e3 100644 --- a/wallets/provider-safepal/src/utils.ts +++ b/wallets/provider-safepal/src/utils.ts @@ -31,15 +31,6 @@ export function evmSafepal(): EvmProviderApi { } return evmInstance; } -export function getInstanceOrThrow(): Provider { - const instances = safepal(); - - if (!instances) { - throw new Error('Trust Wallet is not injected. Please check your wallet.'); - } - - return instances; -} /** * Return true if address is a valid EVM address. * Accepts: From 19f5fe236b00a8413858878b5890dbac0b2f9959 Mon Sep 17 00:00:00 2001 From: arlert-armin Date: Tue, 6 Oct 2026 19:54:01 +0000 Subject: [PATCH 07/29] feat(wallets): register viem actions on injected evm wallets Their EVM namespaces register `viemWalletAdapter` and `viemPublicAdapter`, plus wallet-transport `getTransactionReceipt` and `waitForTransactionReceipt`, and are built with the EVM RPC URL. EVM signers are no longer registered; providers left without a signer drop their `signers` property. --- wallets/provider-taho/src/constants.ts | 7 ---- wallets/provider-taho/src/namespaces/evm.ts | 35 +++++++++++++------ wallets/provider-taho/src/provider.ts | 15 +++++--- wallets/provider-taho/src/signer.ts | 20 ----------- wallets/provider-taho/src/utils.ts | 10 ------ wallets/provider-tokenpocket/src/constants.ts | 7 ---- .../src/namespaces/evm.ts | 35 +++++++++++++------ wallets/provider-tokenpocket/src/provider.ts | 15 +++++--- wallets/provider-tokenpocket/src/signer.ts | 20 ----------- wallets/provider-tokenpocket/src/utils.ts | 12 ------- wallets/provider-tomo/src/constants.ts | 9 ----- wallets/provider-tomo/src/namespaces/evm.ts | 34 ++++++++++++------ wallets/provider-tomo/src/provider.ts | 15 +++++--- wallets/provider-tomo/src/signer.ts | 17 --------- wallets/provider-tomo/src/utils.ts | 11 ------ .../src/namespaces/evm.ts | 33 ++++++++++++----- wallets/provider-trustwallet/src/provider.ts | 15 +++++--- wallets/provider-trustwallet/src/signer.ts | 7 +--- 18 files changed, 143 insertions(+), 174 deletions(-) delete mode 100644 wallets/provider-taho/src/signer.ts delete mode 100644 wallets/provider-tokenpocket/src/signer.ts delete mode 100644 wallets/provider-tomo/src/signer.ts diff --git a/wallets/provider-taho/src/constants.ts b/wallets/provider-taho/src/constants.ts index 487d3815d9..295ec1c93b 100644 --- a/wallets/provider-taho/src/constants.ts +++ b/wallets/provider-taho/src/constants.ts @@ -11,9 +11,6 @@ import { } from '@hub3js/evm'; import { getChainIdFromCaip2ChainId } from '@hub3js/std/utils'; -import getSigners from './signer.js'; -import { getInstanceOrThrow } from './utils.js'; - export const TAHO_WALLET_SUPPORTED_EVM_CHAINS = [ CAIP_ETHEREUM_CHAIN_ID, CAIP_POLYGON_CHAIN_ID, @@ -53,9 +50,5 @@ export const metadata: ProviderMetadata = { ], }, }, - { - name: 'signers', - value: { getSigners: async () => getSigners(getInstanceOrThrow()) }, - }, ], }; diff --git a/wallets/provider-taho/src/namespaces/evm.ts b/wallets/provider-taho/src/namespaces/evm.ts index fe598b1aca..65927820b6 100644 --- a/wallets/provider-taho/src/namespaces/evm.ts +++ b/wallets/provider-taho/src/namespaces/evm.ts @@ -1,7 +1,13 @@ import type { EvmActions } from '@hub3js/evm'; import { NamespaceBuilder } from '@hub3js/core'; -import { actions, builders, hooks } from '@hub3js/evm'; +import { + actions, + builders, + hooks, + viemPublicAdapter, + viemWalletAdapter, +} from '@hub3js/evm'; import * as commonBuilders from '@hub3js/std/builders'; import { standardizeAndThrowError } from '@hub3js/std/operators'; @@ -48,14 +54,23 @@ const getTransactionReceipt = builders .action(actions.getTransactionReceipt(evmTaho)) .build(); -const evm = new NamespaceBuilder('EVM', WALLET_ID) - .action(connect) - .action(disconnect) - .action(canEagerConnect) - .action(canSwitchNetwork) - .action(getChainId) - .action(getAllowance) - .action(getTransactionReceipt) +const waitForTransactionReceipt = builders + .waitForTransactionReceipt() + .action(actions.waitForTransactionReceipt(evmTaho)) .build(); -export { evm }; +const buildEvm = (rpcUrl: string) => + new NamespaceBuilder('EVM', WALLET_ID) + .action(connect) + .action(disconnect) + .action(canEagerConnect) + .action(canSwitchNetwork) + .action(getChainId) + .action(getAllowance) + .action(getTransactionReceipt) + .action(waitForTransactionReceipt) + .action(viemWalletAdapter(evmTaho)) + .action(viemPublicAdapter(rpcUrl)) + .build(); + +export { buildEvm }; diff --git a/wallets/provider-taho/src/provider.ts b/wallets/provider-taho/src/provider.ts index f1442810e5..b4f25a0e56 100644 --- a/wallets/provider-taho/src/provider.ts +++ b/wallets/provider-taho/src/provider.ts @@ -1,11 +1,17 @@ +import type { NamespacesRPCUrls } from '@hub3js/namespaces'; + import { ProviderBuilder } from '@hub3js/core'; import { metadata, WALLET_ID } from './constants.js'; -import { evm } from './namespaces/evm.js'; +import { buildEvm } from './namespaces/evm.js'; import { taho } from './utils.js'; -const buildProvider = () => - new ProviderBuilder(WALLET_ID) +const buildProvider = (rpcURLs: NamespacesRPCUrls) => { + if (!rpcURLs?.evm) { + throw new Error('An RPC URL for the EVM namespace is required.'); + } + + return new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); @@ -15,7 +21,8 @@ const buildProvider = () => } }) .config('metadata', metadata) - .add('evm', evm) + .add('evm', buildEvm(rpcURLs.evm)) .build(); +}; export { buildProvider }; diff --git a/wallets/provider-taho/src/signer.ts b/wallets/provider-taho/src/signer.ts deleted file mode 100644 index 767e5ff5f0..0000000000 --- a/wallets/provider-taho/src/signer.ts +++ /dev/null @@ -1,20 +0,0 @@ -import type { Provider } from './types.js'; -import type { SignerFactory } from 'rango-types'; - -import { EVM_NAMESPACE } from '@hub3js/namespaces'; -import { DefaultSignerFactory, TransactionType } from 'rango-types'; - -export default async function getSigners( - provider: Provider -): Promise { - const ethProvider = provider.get(EVM_NAMESPACE); - const signers = new DefaultSignerFactory(); - const { DefaultEvmSigner } = await import('@rango-dev/signer-evm'); - if (!!ethProvider) { - signers.registerSigner( - TransactionType.EVM, - new DefaultEvmSigner(ethProvider) - ); - } - return signers; -} diff --git a/wallets/provider-taho/src/utils.ts b/wallets/provider-taho/src/utils.ts index 8b9efd42da..6dc1e910e4 100644 --- a/wallets/provider-taho/src/utils.ts +++ b/wallets/provider-taho/src/utils.ts @@ -14,16 +14,6 @@ export function taho(): Provider | null { return instances; } -export function getInstanceOrThrow(): Provider { - const instances = taho(); - - if (!instances) { - throw new Error('Taho Wallet is not injected. Please check your wallet.'); - } - - return instances; -} - export function evmTaho(): EvmProviderApi { const instances = taho(); diff --git a/wallets/provider-tokenpocket/src/constants.ts b/wallets/provider-tokenpocket/src/constants.ts index 404fcfd1ab..d499fc4132 100644 --- a/wallets/provider-tokenpocket/src/constants.ts +++ b/wallets/provider-tokenpocket/src/constants.ts @@ -2,9 +2,6 @@ import type { ProviderMetadata } from '@hub3js/core'; import { isEvmNamespace } from '@hub3js/evm'; -import getSigners from './signer.js'; -import { getInstanceOrThrow } from './utils.js'; - export const WALLET_ID = 'token-pocket'; export const metadata: ProviderMetadata = { name: 'Token Pocket', @@ -31,9 +28,5 @@ export const metadata: ProviderMetadata = { ], }, }, - { - name: 'signers', - value: { getSigners: async () => getSigners(getInstanceOrThrow()) }, - }, ], }; diff --git a/wallets/provider-tokenpocket/src/namespaces/evm.ts b/wallets/provider-tokenpocket/src/namespaces/evm.ts index f6b3e610d6..ed1152cc6b 100644 --- a/wallets/provider-tokenpocket/src/namespaces/evm.ts +++ b/wallets/provider-tokenpocket/src/namespaces/evm.ts @@ -1,7 +1,13 @@ import type { EvmActions } from '@hub3js/evm'; import { NamespaceBuilder } from '@hub3js/core'; -import { actions, builders, hooks } from '@hub3js/evm'; +import { + actions, + builders, + hooks, + viemPublicAdapter, + viemWalletAdapter, +} from '@hub3js/evm'; import * as commonBuilders from '@hub3js/std/builders'; import { standardizeAndThrowError } from '@hub3js/std/operators'; @@ -48,14 +54,23 @@ const getTransactionReceipt = builders .action(actions.getTransactionReceipt(evmTokenPocket)) .build(); -const evm = new NamespaceBuilder('EVM', WALLET_ID) - .action(connect) - .action(disconnect) - .action(canEagerConnect) - .action(canSwitchNetwork) - .action(getChainId) - .action(getAllowance) - .action(getTransactionReceipt) +const waitForTransactionReceipt = builders + .waitForTransactionReceipt() + .action(actions.waitForTransactionReceipt(evmTokenPocket)) .build(); -export { evm }; +const buildEvm = (rpcUrl: string) => + new NamespaceBuilder('EVM', WALLET_ID) + .action(connect) + .action(disconnect) + .action(canEagerConnect) + .action(canSwitchNetwork) + .action(getChainId) + .action(getAllowance) + .action(getTransactionReceipt) + .action(waitForTransactionReceipt) + .action(viemWalletAdapter(evmTokenPocket)) + .action(viemPublicAdapter(rpcUrl)) + .build(); + +export { buildEvm }; diff --git a/wallets/provider-tokenpocket/src/provider.ts b/wallets/provider-tokenpocket/src/provider.ts index 58d0f1b3f8..f807d09cc1 100644 --- a/wallets/provider-tokenpocket/src/provider.ts +++ b/wallets/provider-tokenpocket/src/provider.ts @@ -1,11 +1,17 @@ +import type { NamespacesRPCUrls } from '@hub3js/namespaces'; + import { ProviderBuilder } from '@hub3js/core'; import { metadata, WALLET_ID } from './constants.js'; -import { evm } from './namespaces/evm.js'; +import { buildEvm } from './namespaces/evm.js'; import { tokenPocket } from './utils.js'; -const buildProvider = () => - new ProviderBuilder(WALLET_ID) +const buildProvider = (rpcURLs: NamespacesRPCUrls) => { + if (!rpcURLs?.evm) { + throw new Error('An RPC URL for the EVM namespace is required.'); + } + + return new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); @@ -15,7 +21,8 @@ const buildProvider = () => } }) .config('metadata', metadata) - .add('evm', evm) + .add('evm', buildEvm(rpcURLs.evm)) .build(); +}; export { buildProvider }; diff --git a/wallets/provider-tokenpocket/src/signer.ts b/wallets/provider-tokenpocket/src/signer.ts deleted file mode 100644 index 767e5ff5f0..0000000000 --- a/wallets/provider-tokenpocket/src/signer.ts +++ /dev/null @@ -1,20 +0,0 @@ -import type { Provider } from './types.js'; -import type { SignerFactory } from 'rango-types'; - -import { EVM_NAMESPACE } from '@hub3js/namespaces'; -import { DefaultSignerFactory, TransactionType } from 'rango-types'; - -export default async function getSigners( - provider: Provider -): Promise { - const ethProvider = provider.get(EVM_NAMESPACE); - const signers = new DefaultSignerFactory(); - const { DefaultEvmSigner } = await import('@rango-dev/signer-evm'); - if (!!ethProvider) { - signers.registerSigner( - TransactionType.EVM, - new DefaultEvmSigner(ethProvider) - ); - } - return signers; -} diff --git a/wallets/provider-tokenpocket/src/utils.ts b/wallets/provider-tokenpocket/src/utils.ts index a13014559b..7fce638f80 100644 --- a/wallets/provider-tokenpocket/src/utils.ts +++ b/wallets/provider-tokenpocket/src/utils.ts @@ -15,18 +15,6 @@ export function tokenPocket(): Provider | null { return instances; } -export function getInstanceOrThrow(): Provider { - const instances = tokenPocket(); - - if (!instances) { - throw new Error( - 'TokenPocket Wallet is not injected. Please check your wallet.' - ); - } - - return instances; -} - export function evmTokenPocket(): ProviderAPI { const instances = tokenPocket(); diff --git a/wallets/provider-tomo/src/constants.ts b/wallets/provider-tomo/src/constants.ts index 8a51a3cd6a..9ca59fbf28 100644 --- a/wallets/provider-tomo/src/constants.ts +++ b/wallets/provider-tomo/src/constants.ts @@ -2,9 +2,6 @@ import type { ProviderMetadata } from '@hub3js/core'; import { isEvmNamespace } from '@hub3js/evm'; -import getSigners from './signer.js'; -import { getInstanceOrThrow } from './utils.js'; - export const WALLET_ID = 'tomo'; export const TOMO_INJECTION_DELAY = 1000; export const metadata: ProviderMetadata = { @@ -32,11 +29,5 @@ export const metadata: ProviderMetadata = { ], }, }, - { - name: 'signers', - value: { - getSigners: async () => getSigners(getInstanceOrThrow()), - }, - }, ], }; diff --git a/wallets/provider-tomo/src/namespaces/evm.ts b/wallets/provider-tomo/src/namespaces/evm.ts index 9074644dd9..903cc9959f 100644 --- a/wallets/provider-tomo/src/namespaces/evm.ts +++ b/wallets/provider-tomo/src/namespaces/evm.ts @@ -1,7 +1,12 @@ import type { EvmActions } from '@hub3js/evm'; import { ActionBuilder, NamespaceBuilder } from '@hub3js/core'; -import { actions, builders } from '@hub3js/evm'; +import { + actions, + builders, + viemPublicAdapter, + viemWalletAdapter, +} from '@hub3js/evm'; import * as commonBuilders from '@hub3js/std/builders'; import { connectAndUpdateStateForMultiNetworks, @@ -68,14 +73,23 @@ const getTransactionReceipt = builders .action(actions.getTransactionReceipt(evmTomo)) .build(); -const evm = new NamespaceBuilder('EVM', WALLET_ID) - .action(connect) - .action(disconnect) - .action(canSwitchNetwork) - .action(canEagerConnect) - .action(getChainId) - .action(getAllowance) - .action(getTransactionReceipt) +const waitForTransactionReceipt = builders + .waitForTransactionReceipt() + .action(actions.waitForTransactionReceipt(evmTomo)) .build(); -export { evm }; +const buildEvm = (rpcUrl: string) => + new NamespaceBuilder('EVM', WALLET_ID) + .action(connect) + .action(disconnect) + .action(canSwitchNetwork) + .action(canEagerConnect) + .action(getChainId) + .action(getAllowance) + .action(getTransactionReceipt) + .action(waitForTransactionReceipt) + .action(viemWalletAdapter(evmTomo)) + .action(viemPublicAdapter(rpcUrl)) + .build(); + +export { buildEvm }; diff --git a/wallets/provider-tomo/src/provider.ts b/wallets/provider-tomo/src/provider.ts index 9c2d1684d7..4d70071d08 100644 --- a/wallets/provider-tomo/src/provider.ts +++ b/wallets/provider-tomo/src/provider.ts @@ -1,11 +1,17 @@ +import type { NamespacesRPCUrls } from '@hub3js/namespaces'; + import { ProviderBuilder } from '@hub3js/core'; import { metadata, TOMO_INJECTION_DELAY, WALLET_ID } from './constants.js'; -import { evm } from './namespaces/evm.js'; +import { buildEvm } from './namespaces/evm.js'; import { tomo } from './utils.js'; -const buildProvider = () => - new ProviderBuilder(WALLET_ID) +const buildProvider = (rpcURLs: NamespacesRPCUrls) => { + if (!rpcURLs?.evm) { + throw new Error('An RPC URL for the EVM namespace is required.'); + } + + return new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); @@ -17,7 +23,8 @@ const buildProvider = () => }, TOMO_INJECTION_DELAY); }) .config('metadata', metadata) - .add('evm', evm) + .add('evm', buildEvm(rpcURLs.evm)) .build(); +}; export { buildProvider }; diff --git a/wallets/provider-tomo/src/signer.ts b/wallets/provider-tomo/src/signer.ts deleted file mode 100644 index d78f485552..0000000000 --- a/wallets/provider-tomo/src/signer.ts +++ /dev/null @@ -1,17 +0,0 @@ -import type { Provider } from './types.js'; -import type { SignerFactory } from 'rango-types'; - -import { EVM_NAMESPACE } from '@hub3js/namespaces'; -import { DefaultSignerFactory, TransactionType as TxType } from 'rango-types'; - -export default async function getSigners( - provider: Provider -): Promise { - const ethProvider = provider.get(EVM_NAMESPACE); - const signers = new DefaultSignerFactory(); - const { DefaultEvmSigner } = await import('@rango-dev/signer-evm'); - if (!!ethProvider) { - signers.registerSigner(TxType.EVM, new DefaultEvmSigner(ethProvider)); - } - return signers; -} diff --git a/wallets/provider-tomo/src/utils.ts b/wallets/provider-tomo/src/utils.ts index 042793681e..1dd0c90e94 100644 --- a/wallets/provider-tomo/src/utils.ts +++ b/wallets/provider-tomo/src/utils.ts @@ -1,4 +1,3 @@ -import type { Provider } from './types.js'; import type { ProviderAPI as EvmProviderApi } from '@hub3js/evm'; import { EVM_NAMESPACE } from '@hub3js/namespaces'; @@ -17,16 +16,6 @@ export function tomo() { return instances; } -export function getInstanceOrThrow(): Provider { - const instances = tomo(); - - if (!instances) { - throw new Error('Tomo is not injected. Please check your wallet.'); - } - - return instances; -} - export function evmTomo(): EvmProviderApi { const instances = tomo(); const evmInstance = instances?.get(EVM_NAMESPACE); diff --git a/wallets/provider-trustwallet/src/namespaces/evm.ts b/wallets/provider-trustwallet/src/namespaces/evm.ts index 2bf96bee03..421b1eae5b 100644 --- a/wallets/provider-trustwallet/src/namespaces/evm.ts +++ b/wallets/provider-trustwallet/src/namespaces/evm.ts @@ -1,7 +1,13 @@ import type { EvmActions } from '@hub3js/evm'; import { NamespaceBuilder } from '@hub3js/core'; -import { actions, builders, hooks } from '@hub3js/evm'; +import { + actions, + builders, + hooks, + viemPublicAdapter, + viemWalletAdapter, +} from '@hub3js/evm'; import * as commonBuilders from '@hub3js/std/builders'; import { standardizeAndThrowError } from '@hub3js/std/operators'; @@ -46,13 +52,22 @@ const getTransactionReceipt = builders .action(actions.getTransactionReceipt(evmTrustWallet)) .build(); -const evm = new NamespaceBuilder('EVM', WALLET_ID) - .action(connect) - .action(disconnect) - .action(canSwitchNetwork) - .action(getChainId) - .action(getAllowance) - .action(getTransactionReceipt) +const waitForTransactionReceipt = builders + .waitForTransactionReceipt() + .action(actions.waitForTransactionReceipt(evmTrustWallet)) .build(); -export { evm }; +const buildEvm = (rpcUrl: string) => + new NamespaceBuilder('EVM', WALLET_ID) + .action(connect) + .action(disconnect) + .action(canSwitchNetwork) + .action(getChainId) + .action(getAllowance) + .action(getTransactionReceipt) + .action(waitForTransactionReceipt) + .action(viemWalletAdapter(evmTrustWallet)) + .action(viemPublicAdapter(rpcUrl)) + .build(); + +export { buildEvm }; diff --git a/wallets/provider-trustwallet/src/provider.ts b/wallets/provider-trustwallet/src/provider.ts index 860573aef3..f23939f1fd 100644 --- a/wallets/provider-trustwallet/src/provider.ts +++ b/wallets/provider-trustwallet/src/provider.ts @@ -1,12 +1,18 @@ +import type { NamespacesRPCUrls } from '@hub3js/namespaces'; + import { ProviderBuilder } from '@hub3js/core'; import { metadata, WALLET_ID } from './constants.js'; -import { evm } from './namespaces/evm.js'; +import { buildEvm } from './namespaces/evm.js'; import { solana } from './namespaces/solana.js'; import { trustWallet as trustwalletInstance } from './utils.js'; -const buildProvider = () => - new ProviderBuilder(WALLET_ID) +const buildProvider = (rpcURLs: NamespacesRPCUrls) => { + if (!rpcURLs?.evm) { + throw new Error('An RPC URL for the EVM namespace is required.'); + } + + return new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); @@ -16,8 +22,9 @@ const buildProvider = () => } }) .config('metadata', metadata) - .add('evm', evm) + .add('evm', buildEvm(rpcURLs.evm)) .add('solana', solana) .build(); +}; export { buildProvider }; diff --git a/wallets/provider-trustwallet/src/signer.ts b/wallets/provider-trustwallet/src/signer.ts index f1669bbd56..74b254ec86 100644 --- a/wallets/provider-trustwallet/src/signer.ts +++ b/wallets/provider-trustwallet/src/signer.ts @@ -1,22 +1,17 @@ import type { Provider } from './utils.js'; import type { SignerFactory } from 'rango-types'; -import { EVM_NAMESPACE, SOLANA_NAMESPACE } from '@hub3js/namespaces'; +import { SOLANA_NAMESPACE } from '@hub3js/namespaces'; import { DefaultSignerFactory, TransactionType as TxType } from 'rango-types'; export default async function getSigners( provider: Provider ): Promise { - const ethProvider = provider.get(EVM_NAMESPACE); const solProvider = provider.get(SOLANA_NAMESPACE); const signers = new DefaultSignerFactory(); - const { DefaultEvmSigner } = await import('@rango-dev/signer-evm'); const { CustomSolanaSigner } = await import('./signers/solanaSigner.js'); - if (!!ethProvider) { - signers.registerSigner(TxType.EVM, new DefaultEvmSigner(ethProvider)); - } if (!!solProvider) { signers.registerSigner(TxType.SOLANA, new CustomSolanaSigner(solProvider)); } From 6d75b65200afa0d911663ae0f2580dd4c5e49d5e Mon Sep 17 00:00:00 2001 From: arlert-armin Date: Tue, 6 Oct 2026 19:54:41 +0000 Subject: [PATCH 08/29] feat(wallets): accept rpc urls in every provider Providers without an EVM namespace take the RPC URLs too, so any of their namespaces can start using one. --- wallets/provider-braavos/src/provider.ts | 5 ++++- wallets/provider-freighter/src/provider.ts | 5 ++++- wallets/provider-gemwallet/src/provider.ts | 5 ++++- wallets/provider-noir-wallet/src/provider.ts | 5 ++++- wallets/provider-ready/src/provider.ts | 5 ++++- wallets/provider-slush/src/provider.ts | 5 ++++- wallets/provider-solflare/src/provider.ts | 5 ++++- wallets/provider-tonconnect/src/provider.ts | 4 +++- wallets/provider-tron-link/src/provider.ts | 5 ++++- wallets/provider-unisat/src/provider.ts | 5 ++++- wallets/provider-vultisig/src/provider.ts | 5 ++++- wallets/provider-xverse/src/provider.ts | 5 ++++- 12 files changed, 47 insertions(+), 12 deletions(-) diff --git a/wallets/provider-braavos/src/provider.ts b/wallets/provider-braavos/src/provider.ts index cfc9e6b98c..b1a3e25a9a 100644 --- a/wallets/provider-braavos/src/provider.ts +++ b/wallets/provider-braavos/src/provider.ts @@ -1,10 +1,13 @@ +import type { NamespacesRPCUrls } from '@hub3js/namespaces'; + import { ProviderBuilder } from '@hub3js/core'; import { metadata, WALLET_ID } from './constants.js'; import { starknet } from './namespaces/starknet.js'; import { braavos } from './utils.js'; -const buildProvider = () => +// RPC URLs are accepted for every namespace, so any of them can start using one. +const buildProvider = (_rpcURLs: NamespacesRPCUrls) => new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); diff --git a/wallets/provider-freighter/src/provider.ts b/wallets/provider-freighter/src/provider.ts index b03fb34f97..9f44e9dc63 100644 --- a/wallets/provider-freighter/src/provider.ts +++ b/wallets/provider-freighter/src/provider.ts @@ -1,10 +1,13 @@ +import type { NamespacesRPCUrls } from '@hub3js/namespaces'; + import { ProviderBuilder } from '@hub3js/core'; import { metadata, WALLET_ID } from './constants.js'; import { namespace as stellar } from './namespaces/stellar/namespace.js'; import { checkInstallation } from './utils.js'; -const buildProvider = () => +// RPC URLs are accepted for every namespace, so any of them can start using one. +const buildProvider = (_rpcURLs: NamespacesRPCUrls) => new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); diff --git a/wallets/provider-gemwallet/src/provider.ts b/wallets/provider-gemwallet/src/provider.ts index d615d2b743..f8897d4b70 100644 --- a/wallets/provider-gemwallet/src/provider.ts +++ b/wallets/provider-gemwallet/src/provider.ts @@ -1,10 +1,13 @@ +import type { NamespacesRPCUrls } from '@hub3js/namespaces'; + import { ProviderBuilder } from '@hub3js/core'; import { info, WALLET_ID } from './constants.js'; import { namespace as xrpl } from './namespaces/xrpl/mod.js'; import { checkInstallationOnLoad } from './utils.js'; -const buildProvider = () => +// RPC URLs are accepted for every namespace, so any of them can start using one. +const buildProvider = (_rpcURLs: NamespacesRPCUrls) => new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); diff --git a/wallets/provider-noir-wallet/src/provider.ts b/wallets/provider-noir-wallet/src/provider.ts index 7d53f63cb9..8471c2429a 100644 --- a/wallets/provider-noir-wallet/src/provider.ts +++ b/wallets/provider-noir-wallet/src/provider.ts @@ -1,10 +1,13 @@ +import type { NamespacesRPCUrls } from '@hub3js/namespaces'; + import { ProviderBuilder } from '@hub3js/core'; import { isNoirWalletInstalled } from '@noir-wallet/sdk'; import { info, WALLET_ID } from './constants.js'; import { namespace as utxo } from './namespaces/utxo.js'; -const buildProvider = () => +// RPC URLs are accepted for every namespace, so any of them can start using one. +const buildProvider = (_rpcURLs: NamespacesRPCUrls) => new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); diff --git a/wallets/provider-ready/src/provider.ts b/wallets/provider-ready/src/provider.ts index d7e6698c41..670aef6539 100644 --- a/wallets/provider-ready/src/provider.ts +++ b/wallets/provider-ready/src/provider.ts @@ -1,10 +1,13 @@ +import type { NamespacesRPCUrls } from '@hub3js/namespaces'; + import { ProviderBuilder } from '@hub3js/core'; import { metadata, WALLET_ID } from './constants.js'; import { starknet } from './namespaces/starknet.js'; import { ready } from './utils.js'; -const buildProvider = () => +// RPC URLs are accepted for every namespace, so any of them can start using one. +const buildProvider = (_rpcURLs: NamespacesRPCUrls) => new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); diff --git a/wallets/provider-slush/src/provider.ts b/wallets/provider-slush/src/provider.ts index bb0c11df63..a701974a12 100644 --- a/wallets/provider-slush/src/provider.ts +++ b/wallets/provider-slush/src/provider.ts @@ -1,10 +1,13 @@ +import type { NamespacesRPCUrls } from '@hub3js/namespaces'; + import { ProviderBuilder } from '@hub3js/core'; import { metadata, WALLET_ID } from './constants.js'; import { sui } from './namespaces/sui.js'; import { suiWalletInstance } from './utils.js'; -const buildProvider = () => +// RPC URLs are accepted for every namespace, so any of them can start using one. +const buildProvider = (_rpcURLs: NamespacesRPCUrls) => new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); diff --git a/wallets/provider-solflare/src/provider.ts b/wallets/provider-solflare/src/provider.ts index e0b6087b6f..0e2f6a9436 100644 --- a/wallets/provider-solflare/src/provider.ts +++ b/wallets/provider-solflare/src/provider.ts @@ -1,10 +1,13 @@ +import type { NamespacesRPCUrls } from '@hub3js/namespaces'; + import { ProviderBuilder } from '@hub3js/core'; import { metadata, SOLFLARE_INJECTION_DELAY, WALLET_ID } from './constants.js'; import { solana } from './namespaces/solana.js'; import { solflare } from './utils.js'; -const buildProvider = () => +// RPC URLs are accepted for every namespace, so any of them can start using one. +const buildProvider = (_rpcURLs: NamespacesRPCUrls) => new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); diff --git a/wallets/provider-tonconnect/src/provider.ts b/wallets/provider-tonconnect/src/provider.ts index dc9652c0ee..dfc928377f 100644 --- a/wallets/provider-tonconnect/src/provider.ts +++ b/wallets/provider-tonconnect/src/provider.ts @@ -1,4 +1,5 @@ import type { Environments } from './types.js'; +import type { NamespacesRPCUrls } from '@hub3js/namespaces'; import { ProviderBuilder } from '@hub3js/core'; @@ -6,7 +7,8 @@ import { metadata, WALLET_ID } from './constants.js'; import { ton } from './namespaces/ton.js'; import { tonConnect } from './utils.js'; -const buildProvider = () => +// RPC URLs are accepted for every namespace, so any of them can start using one. +const buildProvider = (_rpcURLs: NamespacesRPCUrls) => new ProviderBuilder(WALLET_ID) .init(function (context, environments: Environments) { const [, setState] = context.state(); diff --git a/wallets/provider-tron-link/src/provider.ts b/wallets/provider-tron-link/src/provider.ts index 821d95744e..f9a8153a88 100644 --- a/wallets/provider-tron-link/src/provider.ts +++ b/wallets/provider-tron-link/src/provider.ts @@ -1,10 +1,13 @@ +import type { NamespacesRPCUrls } from '@hub3js/namespaces'; + import { ProviderBuilder } from '@hub3js/core'; import { metadata, TRONLINK_INJECTION_DELAY, WALLET_ID } from './constants.js'; import { tron } from './namespaces/tron.js'; import { tronlink } from './utils.js'; -const buildProvider = () => +// RPC URLs are accepted for every namespace, so any of them can start using one. +const buildProvider = (_rpcURLs: NamespacesRPCUrls) => new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); diff --git a/wallets/provider-unisat/src/provider.ts b/wallets/provider-unisat/src/provider.ts index 46ced3f849..9826e77dc3 100644 --- a/wallets/provider-unisat/src/provider.ts +++ b/wallets/provider-unisat/src/provider.ts @@ -1,10 +1,13 @@ +import type { NamespacesRPCUrls } from '@hub3js/namespaces'; + import { ProviderBuilder } from '@hub3js/core'; import { metadata, WALLET_ID } from './constants.js'; import { utxo } from './namespaces/utxo.js'; import { unisat as unisatInstance } from './utils.js'; -const buildProvider = () => +// RPC URLs are accepted for every namespace, so any of them can start using one. +const buildProvider = (_rpcURLs: NamespacesRPCUrls) => new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); diff --git a/wallets/provider-vultisig/src/provider.ts b/wallets/provider-vultisig/src/provider.ts index 43d476fbc2..cd8a88f48c 100644 --- a/wallets/provider-vultisig/src/provider.ts +++ b/wallets/provider-vultisig/src/provider.ts @@ -1,10 +1,13 @@ +import type { NamespacesRPCUrls } from '@hub3js/namespaces'; + import { ProviderBuilder } from '@hub3js/core'; import { info, WALLET_ID } from './constants.js'; import { namespace as utxo } from './namespaces/utxo/namespace.js'; import { vultisig } from './utils.js'; -const buildProvider = () => +// RPC URLs are accepted for every namespace, so any of them can start using one. +const buildProvider = (_rpcURLs: NamespacesRPCUrls) => new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); diff --git a/wallets/provider-xverse/src/provider.ts b/wallets/provider-xverse/src/provider.ts index 977ffad2c2..6c9f20aa6c 100644 --- a/wallets/provider-xverse/src/provider.ts +++ b/wallets/provider-xverse/src/provider.ts @@ -1,10 +1,13 @@ +import type { NamespacesRPCUrls } from '@hub3js/namespaces'; + import { ProviderBuilder } from '@hub3js/core'; import { metadata, WALLET_ID, XVERSE_INJECTION_DELAY_MS } from './constants.js'; import { utxo } from './namespaces/utxo.js'; import { xverse as unisatInstance } from './utils.js'; -const buildProvider = () => +// RPC URLs are accepted for every namespace, so any of them can start using one. +const buildProvider = (_rpcURLs: NamespacesRPCUrls) => new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); From 6f9a006f92264c16606cb8fb4a2c5c884680df1a Mon Sep 17 00:00:00 2001 From: arlert-armin Date: Tue, 6 Oct 2026 19:55:29 +0000 Subject: [PATCH 09/29] feat(wallets): declare provider rpc urls once in provider-all `RPC_URLS` holds the RPC endpoint of each namespace, and is passed to every provider where providers are built: the widget, the playground and the queue-manager demo. BREAKING CHANGE: `buildProvider` of every `@rango-dev/provider-*` package, and each builder returned by `allProviders()`, now requires the RPC URLs of its namespaces, e.g. `buildProvider(RPC_URLS)`. Providers no longer expose an EVM signer. --- .../src/components/Wallets/index.tsx | 4 ++-- queue-manager/queue-manager-demo/src/index.tsx | 4 ++-- wallets/provider-all/src/index.ts | 14 +++++++++++++- wallets/readme.md | 12 +++++++----- widget/embedded/src/store/slices/config.ts | 3 ++- .../FunctionalLayout/FunctionalLayout.utils.ts | 7 +++++-- 6 files changed, 31 insertions(+), 13 deletions(-) diff --git a/queue-manager/queue-manager-demo/src/components/Wallets/index.tsx b/queue-manager/queue-manager-demo/src/components/Wallets/index.tsx index 1feb9bad34..3b33bfaf7c 100644 --- a/queue-manager/queue-manager-demo/src/components/Wallets/index.tsx +++ b/queue-manager/queue-manager-demo/src/components/Wallets/index.tsx @@ -1,8 +1,8 @@ -import { allProviders } from '@rango-dev/provider-all'; +import { allProviders, RPC_URLS } from '@rango-dev/provider-all'; import { useWallets } from '@rango-dev/wallets-react'; import React from 'react'; -export const providers = allProviders().map((build) => build()); +export const providers = allProviders().map((build) => build(RPC_URLS)); export const wallets = providers.map((provider) => provider.id); diff --git a/queue-manager/queue-manager-demo/src/index.tsx b/queue-manager/queue-manager-demo/src/index.tsx index 1622c114ed..54d369fc75 100644 --- a/queue-manager/queue-manager-demo/src/index.tsx +++ b/queue-manager/queue-manager-demo/src/index.tsx @@ -1,7 +1,7 @@ import type { WalletType } from '@hub3js/core'; import type { BlockchainMeta } from 'rango-types'; -import { allProviders, WalletTypes } from '@rango-dev/provider-all'; +import { allProviders, RPC_URLS, WalletTypes } from '@rango-dev/provider-all'; import { Events, Provider } from '@rango-dev/wallets-react'; import { RangoClient } from 'rango-sdk'; import React, { useEffect, useState } from 'react'; @@ -14,7 +14,7 @@ import { WC_PROJECT_ID, } from './configs'; -const providers = allProviders().map((build) => build()); +const providers = allProviders().map((build) => build(RPC_URLS)); function AppContainer() { const [connectedWallets, setConnectedWallets] = useState([]); diff --git a/wallets/provider-all/src/index.ts b/wallets/provider-all/src/index.ts index 2310793ce3..915817d62b 100644 --- a/wallets/provider-all/src/index.ts +++ b/wallets/provider-all/src/index.ts @@ -1,4 +1,5 @@ import type { Provider } from '@hub3js/core'; +import type { NamespacesRPCUrls } from '@hub3js/namespaces'; import { buildProvider as binance } from '@rango-dev/provider-binance'; import { buildProvider as bitget } from '@rango-dev/provider-bitget'; @@ -38,9 +39,20 @@ import { buildProvider as xverse } from '@rango-dev/provider-xverse'; export { WalletTypes } from './walletTypes.js'; +/** + * The RPC endpoints every provider is built with, declared once for all of + * them. Namespaces read their own entry, e.g. the EVM namespace's public viem + * actions go to `evm`. + */ +export const RPC_URLS: NamespacesRPCUrls = { + evm: 'https://rpc.ankr.com/eth/8d43f5e842676d766141cb1943b9b4e12821f463665e180c209bd3dab9639df2', +}; + // Providers register different namespaces, so the list is typed loosely instead of `Provider`. // eslint-disable-next-line @typescript-eslint/no-explicit-any -export const allProviders = (): (() => Provider)[] => { +type BuildProvider = (rpcURLs: NamespacesRPCUrls) => Provider; + +export const allProviders = (): BuildProvider[] => { return [ safe, defaultInjected, diff --git a/wallets/readme.md b/wallets/readme.md index 5b86cc69c8..7fe1df182d 100644 --- a/wallets/readme.md +++ b/wallets/readme.md @@ -35,9 +35,9 @@ After adding the dependencies, you can use them. Using all supported wallets (`p ```js import { Provider } from '@rango-dev/wallets-react'; -import { allProviders } from '@rango-dev/provider-all'; +import { allProviders, RPC_URLS } from '@rango-dev/provider-all'; -const providers = allProviders().map((build) => build()); +const providers = allProviders().map((build) => build(RPC_URLS)); export function App() { const blockchains = [...] // An array of blockchains @@ -57,7 +57,9 @@ import { Provider } from '@rango-dev/wallets-react'; import { buildProvider as metamask } from '@rango-dev/provider-metamask'; import { buildProvider as phantom } from '@rango-dev/provider-phantom'; -const providers = [metamask(), phantom()]; +// RPC endpoints per namespace, shared by every provider. +const rpcURLs = { evm: 'https://your-ethereum-rpc' }; +const providers = [metamask(rpcURLs), phantom(rpcURLs)]; export function App() { const blockchains = [...] // An array of blockchains @@ -103,9 +105,9 @@ With the use of auto-connect, after reloading the app, wallet provider will auto ```js import { Provider } from '@rango-dev/wallets-react'; -import { allProviders } from '@rango-dev/provider-all'; +import { allProviders, RPC_URLS } from '@rango-dev/provider-all'; -const providers = allProviders().map((build) => build()); +const providers = allProviders().map((build) => build(RPC_URLS)); export function App() { const blockchains = [...] // An array of blockchains diff --git a/widget/embedded/src/store/slices/config.ts b/widget/embedded/src/store/slices/config.ts index 136207dd00..4d3e272475 100644 --- a/widget/embedded/src/store/slices/config.ts +++ b/widget/embedded/src/store/slices/config.ts @@ -9,6 +9,7 @@ import type { Provider } from '@hub3js/core'; import { allProviders as getAllProviders, + RPC_URLS, WalletTypes, } from '@rango-dev/provider-all'; @@ -86,7 +87,7 @@ function generateProviders( config: WidgetConfigWithoutLegacyProviders ): Provider[] { const allProviders = getAllProviders(); - const allBuiltProviders = allProviders.map((build) => build()); + const allBuiltProviders = allProviders.map((build) => build(RPC_URLS)); return allBuiltProviders.filter((provider) => hasRequiredConfig(provider.id, config) diff --git a/widget/playground/src/containers/FunctionalLayout/FunctionalLayout.utils.ts b/widget/playground/src/containers/FunctionalLayout/FunctionalLayout.utils.ts index 77de8fd5d8..cb7633cb84 100644 --- a/widget/playground/src/containers/FunctionalLayout/FunctionalLayout.utils.ts +++ b/widget/playground/src/containers/FunctionalLayout/FunctionalLayout.utils.ts @@ -3,7 +3,10 @@ import type { Provider } from '@hub3js/core'; import type { BlockchainMeta } from 'rango-sdk'; import { getSupportedChainsFromProvider } from '@rango-dev/internal-blockchains'; -import { allProviders as getAllProviders } from '@rango-dev/provider-all'; +import { + allProviders as getAllProviders, + RPC_URLS, +} from '@rango-dev/provider-all'; import { getCategoryNetworks } from '../../utils/blockchains'; import { excludedWallets } from '../../utils/common'; @@ -13,7 +16,7 @@ export function getWalletsList( blockchains: BlockchainMeta[] ): MapSupportedList[] { const allProviders = getAllProviders(); - const allBuiltProviders = allProviders.map((build) => build()); + const allBuiltProviders = allProviders.map((build) => build(RPC_URLS)); const walletsList: MapSupportedList[] = []; allBuiltProviders.forEach((provider: Provider) => { if (excludedWallets.includes(provider.id)) { From d00c2c056bfb57682a6de210a642a338c3613b72 Mon Sep 17 00:00:00 2001 From: arlert-armin Date: Tue, 6 Oct 2026 19:55:48 +0000 Subject: [PATCH 10/29] feat(queue-manager): send evm transactions through the evm namespace EVM swaps, approvals and Hyperliquid signing go through the wallet's EVM namespace instead of the EVM signer. `common/evm.ts` converts Rango's EVM transaction for viem and keeps what the signer did: the wallet address and chain checks, the retry without EIP-1559 fees, error mapping that still recognises a user rejection, and, while waiting for the receipt, replacement handling and the Tenderly failure lookup. Wallets whose `sendTransaction` returns another kind of hash can register `resolveTransactionHash`. EVM approvals read viem's receipt: `getTransactionReceipt({ hash })`, which throws while pending and reports `'success' | 'reverted'`. --- .../src/actions/checkApprove/adapters/evm.ts | 45 ++- .../src/actions/checkApprove/checkApprove.ts | 23 +- .../src/actions/checkApprove/types.ts | 12 +- .../rango-preset/src/actions/checkStatus.ts | 70 ++-- .../src/actions/common/evm.test.ts | 220 ++++++++++++ .../rango-preset/src/actions/common/evm.ts | 335 ++++++++++++++++++ .../executeHyperliquidTransaction.ts | 41 ++- .../executeHyperliquidTransaction/types.ts | 11 +- .../executeHyperliquidTransaction/utils.ts | 14 +- .../executeTransaction/executeTransaction.ts | 27 ++ 10 files changed, 723 insertions(+), 75 deletions(-) create mode 100644 queue-manager/rango-preset/src/actions/common/evm.test.ts create mode 100644 queue-manager/rango-preset/src/actions/common/evm.ts diff --git a/queue-manager/rango-preset/src/actions/checkApprove/adapters/evm.ts b/queue-manager/rango-preset/src/actions/checkApprove/adapters/evm.ts index ca49897c16..16776ab35b 100644 --- a/queue-manager/rango-preset/src/actions/checkApprove/adapters/evm.ts +++ b/queue-manager/rango-preset/src/actions/checkApprove/adapters/evm.ts @@ -14,8 +14,24 @@ import { } from 'rango-types'; import { Ok } from 'ts-results'; -/** A receipt reporting a transaction that did not revert. */ -const RECEIPT_STATUS_SUCCESS = 1; +import { sendEvmTransaction } from '../../common/evm'; + +/** + * viem throws this while the transaction is pending. It is matched by name so + * queue-manager doesn't depend on viem. + */ +const RECEIPT_NOT_FOUND_ERROR_NAME = 'TransactionReceiptNotFoundError'; + +function isReceiptNotFoundError(error: unknown): boolean { + let current: unknown = error; + while (current instanceof Error) { + if (current.name === RECEIPT_NOT_FOUND_ERROR_NAME) { + return true; + } + current = current.cause; + } + return false; +} export const evmApproveAdapter: ApproveAdapter<'evm', EvmTransaction> = { prerequisiteType: EVM_APPROVE_TYPE, @@ -49,23 +65,22 @@ export const evmApproveAdapter: ApproveAdapter<'evm', EvmTransaction> = { }) ), + sendTransaction: sendEvmTransaction, + getTransactionStatus: async ( namespace, executedTransactionHash ): Promise => { - const receipt = await namespace.getTransactionReceipt( - executedTransactionHash as `0x${string}` - ); - if (!receipt) { - return 'pending'; + try { + const receipt = await namespace.getTransactionReceipt({ + hash: executedTransactionHash as `0x${string}`, + }); + return receipt.status === 'success' ? 'success' : 'failed'; + } catch (error) { + if (isReceiptNotFoundError(error)) { + return 'pending'; + } + throw error; } - /* - * The receipt status is a quantity, and wallets are not consistent about - * how they hand it over - `0x1`, `0x01` and `1` all occur - so it is - * compared as a number rather than as the exact string the spec suggests. - */ - return Number(receipt.status) === RECEIPT_STATUS_SUCCESS - ? 'success' - : 'failed'; }, }; diff --git a/queue-manager/rango-preset/src/actions/checkApprove/checkApprove.ts b/queue-manager/rango-preset/src/actions/checkApprove/checkApprove.ts index 8cc07e0888..7e094a7036 100644 --- a/queue-manager/rango-preset/src/actions/checkApprove/checkApprove.ts +++ b/queue-manager/rango-preset/src/actions/checkApprove/checkApprove.ts @@ -203,9 +203,20 @@ export async function checkApprove< const chainId = meta.blockchains[unmetApproveMeta.prerequisite.blockChain]?.chainId; const walletAddress = getCurrentAddressOf(swap, currentStep); - const walletSigners = await getSigners(sourceWallet.walletType); - const signer: GenericSigner = - walletSigners.getSigner(approveAdapter.signerTxType); + const sendApproveTransaction = async (transaction: TTransaction) => { + if (approveAdapter.sendTransaction) { + return approveAdapter.sendTransaction( + namespace, + transaction, + walletAddress, + chainId ?? null + ); + } + const walletSigners = await getSigners(sourceWallet.walletType); + const signer: GenericSigner = + walletSigners.getSigner(approveAdapter.signerTxType); + return signer.signAndSendTx(transaction, walletAddress, chainId); + }; /* * Approving takes two waits, and telling them apart matters to the user: a @@ -235,10 +246,8 @@ export async function checkApprove< isApproval: true, }); - const transactionResult = await signer.signAndSendTx( - approveTransactionResult.val, - walletAddress, - chainId + const transactionResult = await sendApproveTransaction( + approveTransactionResult.val ); updateStorageWithPrerequisiteResult(actions, { diff --git a/queue-manager/rango-preset/src/actions/checkApprove/types.ts b/queue-manager/rango-preset/src/actions/checkApprove/types.ts index 065e18599f..bf0296342a 100644 --- a/queue-manager/rango-preset/src/actions/checkApprove/types.ts +++ b/queue-manager/rango-preset/src/actions/checkApprove/types.ts @@ -65,7 +65,7 @@ export interface ApproveAdapter< prerequisiteType: TransactionPrerequisiteType; /** The hub namespace key backing this chain, e.g. `'evm'` | `'tron'`. */ namespaceKey: K; - /** The signer transaction type used to sign the approve tx. */ + /** The signer transaction type used to sign the approve tx, when `sendTransaction` isn't set. */ signerTxType: TransactionType; /** Type guard for this chain's approve prerequisite. */ isApprovePrerequisite: ( @@ -80,6 +80,16 @@ export interface ApproveAdapter< prerequisite: ApprovePrerequisite, namespace: ApproveCapableNamespace ) => Promise>; + /** + * Sends the approve transaction through the namespace. Without it, the + * wallet's signer for `signerTxType` sends it. + */ + sendTransaction?: ( + namespace: ApproveCapableNamespace, + transaction: TTransaction, + walletAddress: string, + chainId: string | null + ) => Promise<{ hash: string }>; /** Reads the on-chain status of a submitted approve transaction. */ getTransactionStatus: ( namespace: ApproveCapableNamespace, diff --git a/queue-manager/rango-preset/src/actions/checkStatus.ts b/queue-manager/rango-preset/src/actions/checkStatus.ts index 7ac9154dba..87e69fe5c3 100644 --- a/queue-manager/rango-preset/src/actions/checkStatus.ts +++ b/queue-manager/rango-preset/src/actions/checkStatus.ts @@ -2,12 +2,12 @@ import type { SwapQueueContext, SwapStorage } from '../types'; import type { ExecuterActions } from '@rango-dev/queue-manager-core'; import type { CheckTxStatusRequest, - Transaction, TransactionStatusResponse, } from 'rango-sdk'; +import type { PendingSwap, PendingSwapStep } from 'rango-types'; import { warn } from '@rango-dev/logging-core'; -import { type GenericSigner, SignerError } from 'rango-types'; +import { SignerError, TransactionType } from 'rango-types'; import { createStepFailedEvent, @@ -35,9 +35,48 @@ import { import { prettifyErrorMessage } from '../shared-errors'; import { StepEventType, SwapActionTypes } from '../types'; +import { waitForEvmTransaction } from './common/evm'; + const INTERVAL_FOR_CHECK_STATUS = 5_000; const INTERVAL_FOR_CHECK_APPROVAL = 5_000; +type TransactionWaiter = ( + txId: string, + chainId: string | undefined, + // eslint-disable-next-line @typescript-eslint/no-explicit-any + txResponse: any + // eslint-disable-next-line @typescript-eslint/no-explicit-any +) => Promise<{ hash: string; response?: any }>; + +/** + * Finds what waits for the current step's transaction to be mined: the + * wallet's EVM namespace for EVM transactions, the wallet's signer otherwise. + * Throws when the wallet isn't connected yet. + */ +async function getTransactionWaiter( + context: SwapQueueContext, + swap: PendingSwap, + currentStep: PendingSwapStep +): Promise { + const txType = getCurrentStepTxType(currentStep); + const sourceWallet = getRelatedWallet(swap, currentStep); + if (!txType || !sourceWallet) { + return null; + } + + if (txType === TransactionType.EVM) { + const namespace = context.hubProvider(sourceWallet.walletType).get('evm'); + return namespace + ? async (txId, chainId) => waitForEvmTransaction(namespace, txId, chainId) + : null; + } + + const signer = (await context.getSigners(sourceWallet.walletType)).getSigner( + txType + ); + return signer.wait ? signer.wait.bind(signer) : null; +} + /** * Subscribe to status of swap transaction by checking from server periodically. * After getting the status, notify the user and schedule `SCHEDULE_NEXT_STEP`. @@ -68,18 +107,12 @@ async function checkTransactionStatus({ let txId = currentStep.executedTransactionId; let getTxReceiptFailed = false; let status: TransactionStatusResponse | null = null; - let signer: GenericSigner | null = null; + let waitForTransaction: TransactionWaiter | null = null; const { getTransactionDataByHash, setTransactionDataByHash } = inMemoryTransactionsData(); try { - const txType = getCurrentStepTxType(currentStep); - const sourceWallet = getRelatedWallet(swap, currentStep); - if (txType && sourceWallet) { - signer = (await context.getSigners(sourceWallet.walletType)).getSigner( - txType - ); - } + waitForTransaction = await getTransactionWaiter(context, swap, currentStep); // eslint-disable-next-line @typescript-eslint/no-unused-vars } catch (error) { /* @@ -92,12 +125,12 @@ async function checkTransactionStatus({ // if wallet is connected, try to get transaction reciept const { response: txResponse, receiptReceived } = getTransactionDataByHash(txId); - if (signer?.wait && !receiptReceived) { + if (waitForTransaction && !receiptReceived) { const chainId = (tx?.blockChain && meta.blockchains?.[tx?.blockChain]?.chainId) || undefined; const { hash: updatedTxHash, response: updatedTxResponse } = - await signer.wait(txId, chainId, txResponse); + await waitForTransaction(txId, chainId, txResponse); if (updatedTxHash !== txId) { currentStep.executedTransactionId = updatedTxHash || currentStep.executedTransactionId; @@ -323,14 +356,9 @@ async function checkApprovalStatus({ } let txId = currentStep.executedTransactionId; - let signer: GenericSigner | null = null; + let waitForTransaction: TransactionWaiter | null = null; try { - const txType = getCurrentStepTxType(currentStep); - const sourceWallet = getRelatedWallet(swap, currentStep); - if (txType && sourceWallet) { - const walletSigners = await context.getSigners(sourceWallet.walletType); - signer = walletSigners.getSigner(txType); - } + waitForTransaction = await getTransactionWaiter(context, swap, currentStep); // eslint-disable-next-line @typescript-eslint/no-unused-vars } catch (error) { /* @@ -343,12 +371,12 @@ async function checkApprovalStatus({ const { response: txResponse, receiptReceived } = getTransactionDataByHash(txId); // if wallet is connected, try to get transaction reciept - if (signer?.wait && !receiptReceived) { + if (waitForTransaction && !receiptReceived) { const chainId = (tx?.blockChain && meta.blockchains?.[tx?.blockChain]?.chainId) || undefined; const { hash: updatedTxHash, response: updatedTxResponse } = - await signer.wait(txId, chainId, txResponse); + await waitForTransaction(txId, chainId, txResponse); if (updatedTxHash !== txId) { currentStep.executedTransactionId = updatedTxHash || currentStep.executedTransactionId; diff --git a/queue-manager/rango-preset/src/actions/common/evm.test.ts b/queue-manager/rango-preset/src/actions/common/evm.test.ts new file mode 100644 index 0000000000..883bc7ae4e --- /dev/null +++ b/queue-manager/rango-preset/src/actions/common/evm.test.ts @@ -0,0 +1,220 @@ +import type { EvmActions, ProviderAPI } from '@hub3js/evm'; +import type { EvmTransaction } from 'rango-sdk'; + +import { createStore, NamespaceBuilder, ProviderBuilder } from '@hub3js/core'; +import { viemWalletAdapter } from '@hub3js/evm'; +import { + RPCErrorCode, + SignerError, + SignerErrorCode, + TransactionType, +} from 'rango-types'; +import { describe, expect, test, vi } from 'vitest'; + +import { sendEvmTransaction } from './evm'; + +const ADDRESS = '0x1111111111111111111111111111111111111111'; +const TO = '0x2222222222222222222222222222222222222222'; +const HASH_BYTES = 32; +const TEST_WALLET_METADATA = { + name: 'Test Wallet', + icon: 'https://example.com/icon.svg', + extensions: { homepage: 'https://example.com' }, +}; +const HASH = `0x${'ab'.repeat(HASH_BYTES)}`; + +function createEvmTransaction( + overrides: Partial = {} +): EvmTransaction { + return { + type: TransactionType.EVM, + blockChain: 'ETH', + isApprovalTx: false, + from: ADDRESS, + to: TO, + data: '0xabcdef', + value: null, + nonce: null, + gasLimit: '21000', + gasPrice: null, + maxFeePerGas: '30000000000', + maxPriorityFeePerGas: '1000000000', + prerequisites: [], + ...overrides, + }; +} + +/** + * A namespace with viem's wallet actions over a fake EIP-1193 provider, so the + * exact `eth_sendTransaction` params can be asserted. + */ +function createNamespace( + sendTransaction: (params: unknown) => unknown = () => HASH +) { + const request = vi.fn( + async ({ method, params }: { method: string; params?: unknown[] }) => { + if (method === 'eth_sendTransaction') { + return sendTransaction(params?.[0]); + } + if (method === 'eth_chainId') { + return '0x1'; + } + throw new Error(`Unexpected method: ${method}`); + } + ); + const instance = { request } as unknown as ProviderAPI; + + const evm = new NamespaceBuilder('EVM', 'test-wallet') + .action('getChainId', async () => '0x1') + .action(viemWalletAdapter(() => instance)) + .build(); + const provider = new ProviderBuilder('test-wallet', { + store: createStore(), + }) + .config('metadata', TEST_WALLET_METADATA) + .add('evm', evm) + .build(); + provider.init(); + + const [, setState] = evm.state(); + setState('connected', true); + setState('accounts', [`eip155:1:${ADDRESS}`]); + setState('network', '0x1'); + + return { namespace: evm, request }; +} + +function sentParams(request: ReturnType) { + return request.mock.calls + .map(([args]) => args) + .filter(({ method }) => method === 'eth_sendTransaction') + .map(({ params }) => params[0]); +} + +describe('sendEvmTransaction', () => { + test('sends hex quantities, gas and an explicit zero value', async () => { + const { namespace, request } = createNamespace(); + + const result = await sendEvmTransaction( + namespace, + createEvmTransaction(), + ADDRESS, + '1' + ); + + expect(result).toEqual({ hash: HASH }); + expect(sentParams(request)).toEqual([ + { + from: ADDRESS, + to: TO, + data: '0xabcdef', + value: '0x0', + gas: '0x5208', + maxFeePerGas: '0x6fc23ac00', + maxPriorityFeePerGas: '0x3b9aca00', + }, + ]); + }); + + test('sends a legacy gas price and a nonce when given', async () => { + const { namespace, request } = createNamespace(); + + await sendEvmTransaction( + namespace, + createEvmTransaction({ + value: '1000', + nonce: '7', + gasPrice: '20000000000', + maxFeePerGas: null, + maxPriorityFeePerGas: null, + }), + ADDRESS, + '1' + ); + + expect(sentParams(request)[0]).toMatchObject({ + value: '0x3e8', + nonce: '0x7', + gasPrice: '0x4a817c800', + }); + }); + + test('retries without EIP-1559 fees when the wallet rejects them', async () => { + let attempts = 0; + const { namespace, request } = createNamespace(() => { + attempts++; + if (attempts === 1) { + throw new Error('EIP-1559 is not supported'); + } + return HASH; + }); + + await sendEvmTransaction( + namespace, + createEvmTransaction({ gasPrice: '20000000000' }), + ADDRESS, + '1' + ); + + const [first, retry] = sentParams(request); + expect(first).toHaveProperty('maxFeePerGas'); + expect(retry).not.toHaveProperty('maxFeePerGas'); + expect(retry).toMatchObject({ gasPrice: '0x4a817c800' }); + }); + + test('reports a user rejection as a rejection', async () => { + const { namespace } = createNamespace(() => { + throw Object.assign(new Error('User rejected the request.'), { + code: 4001, + }); + }); + + const error = await sendEvmTransaction( + namespace, + createEvmTransaction(), + ADDRESS, + '1' + ).catch((error: unknown) => error); + + expect(SignerError.isSignerError(error)).toBe(true); + expect((error as SignerError).rpcCode).toBe(RPCErrorCode.REJECTION); + }); + + test("refuses to send when the wallet's chain doesn't match", async () => { + const { namespace, request } = createNamespace(); + + const error = await sendEvmTransaction( + namespace, + createEvmTransaction(), + ADDRESS, + '137' + ).catch((error: unknown) => error); + + expect((error as SignerError).code).toBe( + SignerErrorCode.UNEXPECTED_BEHAVIOUR + ); + expect((error as SignerError).getErrorDetail().detail).toMatch( + /doesn't match with required chainId/ + ); + expect(sentParams(request)).toHaveLength(0); + }); + + test("refuses to send when the wallet's address doesn't match", async () => { + const { namespace, request } = createNamespace(); + + const error = await sendEvmTransaction( + namespace, + createEvmTransaction(), + '0x3333333333333333333333333333333333333333', + '1' + ).catch((error: unknown) => error); + + expect((error as SignerError).code).toBe( + SignerErrorCode.UNEXPECTED_BEHAVIOUR + ); + expect((error as SignerError).getErrorDetail().detail).toMatch( + /doesn't match with required address/ + ); + expect(sentParams(request)).toHaveLength(0); + }); +}); diff --git a/queue-manager/rango-preset/src/actions/common/evm.ts b/queue-manager/rango-preset/src/actions/common/evm.ts new file mode 100644 index 0000000000..3d81ad474a --- /dev/null +++ b/queue-manager/rango-preset/src/actions/common/evm.ts @@ -0,0 +1,335 @@ +import type { FindProxiedNamespace } from '@hub3js/core'; +import type { EvmActions } from '@hub3js/evm'; +import type { DefaultNamespaces } from '@hub3js/namespaces'; +import type { EvmTransaction } from 'rango-sdk'; + +import { RPCErrorCode, SignerError, SignerErrorCode } from 'rango-types'; + +export type EvmNamespace = FindProxiedNamespace<'evm', DefaultNamespaces>; + +type SendTransactionParameters = NonNullable< + Parameters[0] +>; +type SignTypedDataParameters = NonNullable< + Parameters[0] +>; + +/** + * A namespace action some wallets add when the hash `sendTransaction` returns + * is not the on-chain one, e.g. Safe returns a safeTxHash. It resolves the + * on-chain hash, and is skipped for wallets that don't register it. + */ +const RESOLVE_TRANSACTION_HASH_ACTION = 'resolveTransactionHash'; +type ResolveTransactionHash = (hash: string) => Promise; + +/** EIP-1193 code for a request the user rejected. */ +const USER_REJECTED_REQUEST_CODE = 4001; + +function* errorChain(error: unknown) { + let current: unknown = error; + while (current) { + yield current as { name?: string; code?: unknown; message?: string }; + current = current instanceof Error ? current.cause : undefined; + } +} + +function errorChainIncludes(error: unknown, text: string): boolean { + for (const item of errorChain(error)) { + if (typeof item.message === 'string' && item.message.includes(text)) { + return true; + } + } + return false; +} + +/** + * Turns what a wallet or viem throws into a `SignerError`. viem wraps the + * wallet's error, so a rejection is looked for along the `cause` chain. + */ +export function toEvmSignerError( + error: unknown, + code: SignerErrorCode = SignerErrorCode.SEND_TX_ERROR +): SignerError { + if (SignerError.isSignerError(error)) { + return error; + } + if (!error) { + return new SignerError(code); + } + + let isRejected = false; + for (const item of errorChain(error)) { + if ( + item.code === USER_REJECTED_REQUEST_CODE || + item.name === 'UserRejectedRequestError' + ) { + isRejected = true; + break; + } + } + + const message = + error instanceof Error + ? (error as Error & { shortMessage?: string }).shortMessage || + error.message + : error; + + return new SignerError( + code, + undefined, + message, + isRejected ? RPCErrorCode.REJECTION : RPCErrorCode.UNKNOWN_ERROR, + error + ); +} + +/** + * Converts a transaction from Rango's API into the request viem's + * `sendTransaction` takes. `legacyGas` drops the EIP-1559 fees in favour of + * `gasPrice`, for wallets that reject them. + * + * The request holds bigints, so it is built right before sending and never + * stored with the swap. + */ +export function toEvmTransactionRequest( + tx: EvmTransaction, + account: string, + options: { legacyGas?: boolean } = {} +): SendTransactionParameters { + const request: Record = { + account, + // The network is checked before sending, so viem doesn't assert it again. + chain: null, + to: tx.to, + /* + * `0x` rather than undefined, otherwise some wallets could face issue + * https://github.com/WalletConnect/web3modal/issues/1082#issuecomment-1637793242 + */ + data: tx.data || '0x', + // Some wallets reject a missing value, so a zero value is sent explicitly. + value: BigInt(tx.value || 0), + }; + + if (tx.nonce) { + request.nonce = Number(BigInt(tx.nonce)); + } + if (tx.gasLimit) { + request.gas = BigInt(tx.gasLimit); + } + if (!options.legacyGas && tx.maxFeePerGas && tx.maxPriorityFeePerGas) { + request.maxFeePerGas = BigInt(tx.maxFeePerGas); + request.maxPriorityFeePerGas = BigInt(tx.maxPriorityFeePerGas); + } else if (tx.gasPrice) { + request.gasPrice = BigInt(tx.gasPrice); + } + + return request; +} + +function getActiveAddress(namespace: EvmNamespace): string | undefined { + const [getState] = namespace.state(); + const accounts = getState('accounts') as string[] | null | undefined; + // Accounts are CAIP-10 (`eip155:1:0xabc`), the address is the last part. + return accounts?.[0]?.split(':').pop(); +} + +async function assertWalletMatches( + namespace: EvmNamespace, + address: string, + chainId: string | null +) { + if (chainId) { + const walletChainId = await namespace.getChainId(); + if (walletChainId && Number(walletChainId) !== Number(chainId)) { + throw new SignerError( + SignerErrorCode.UNEXPECTED_BEHAVIOUR, + undefined, + `Wallet chainId: '${Number( + walletChainId + )}' doesn't match with required chainId: '${Number(chainId)}' for tx.` + ); + } + } + + const walletAddress = getActiveAddress(namespace); + if ( + walletAddress && + address && + walletAddress.toLowerCase() !== address.toLowerCase() + ) { + throw new SignerError( + SignerErrorCode.UNEXPECTED_BEHAVIOUR, + undefined, + `Wallet address: '${walletAddress.toLowerCase()}' doesn't match with required address: '${address.toLowerCase()}' for tx.` + ); + } +} + +/** + * Sends a transaction from Rango's API through the wallet's EVM namespace. + */ +export async function sendEvmTransaction( + namespace: EvmNamespace, + tx: EvmTransaction, + address: string, + chainId: string | null +): Promise<{ hash: string }> { + if (!('sendTransaction' in namespace)) { + throw SignerError.UnsupportedError('executeEvmTransaction'); + } + + try { + await assertWalletMatches(namespace, address, chainId); + + try { + const hash = await namespace.sendTransaction( + toEvmTransactionRequest(tx, address) + ); + return { hash }; + } catch (error) { + // Some wallets reject EIP-1559 fees, retry with a legacy gas price. + if (errorChainIncludes(error, 'EIP-1559')) { + console.log('retrying EIP-1559 error without v2 fields ...'); + const hash = await namespace.sendTransaction( + toEvmTransactionRequest(tx, address, { legacyGas: true }) + ); + return { hash }; + } + throw error; + } + } catch (error) { + throw toEvmSignerError(error); + } +} + +/** + * Signs EIP-712 typed data through the wallet's EVM namespace. + */ +export async function signEvmTypedData( + namespace: EvmNamespace, + typedData: Omit, + address: string +): Promise<`0x${string}`> { + try { + return await namespace.signTypedData({ + ...typedData, + account: address, + } as SignTypedDataParameters); + } catch (error) { + throw toEvmSignerError(error, SignerErrorCode.SIGN_TX_ERROR); + } +} + +interface TenderlyResponse { + error_message: string; +} + +async function getTenderlyError( + chainId: string | undefined, + txHash: string +): Promise { + if (!chainId || !txHash) { + return; + } + try { + const url = `https://api.tenderly.co/api/v1/public-contract/${parseInt( + chainId + )}/tx/${txHash}`; + const response = await fetch(url, { method: 'GET' }); + if (!response.ok) { + return; + } + const data: TenderlyResponse = await response.json(); + return data?.error_message; + } catch { + return; + } +} + +function hasResolveTransactionHash(namespace: EvmNamespace): boolean { + return RESOLVE_TRANSACTION_HASH_ACTION in namespace; +} + +/** + * Waits for a sent EVM transaction to be mined, following it if it gets + * replaced. Returns the hash to track it by, which differs from `hash` when the + * wallet returned another kind of hash or the transaction was replaced. + * + * Only a cancelled transaction, or one that reverted for a reason Tenderly can + * give, throws. Anything else is left to the backend's status check. + */ +export async function waitForEvmTransaction( + namespace: EvmNamespace, + hash: string, + chainId: string | undefined +): Promise<{ hash: string }> { + let txHash = hash; + + try { + if (hasResolveTransactionHash(namespace)) { + const resolveTransactionHash = ( + namespace as unknown as Record + )[RESOLVE_TRANSACTION_HASH_ACTION]; + txHash = await resolveTransactionHash(hash); + } + + /* + * The receipt is read through the wallet, which only sees the chain it's on. + * If the user has switched networks in the meantime, leave it to the + * backend's status check. + */ + const [getState] = namespace.state(); + if (!getState('connected') || !chainId) { + return { hash: txHash }; + } + const walletChainId = await namespace.getChainId(); + if ( + Number(walletChainId) !== Number(chainId) || + !('waitForTransactionReceipt' in namespace) + ) { + return { hash: txHash }; + } + + let replacementReason: string | undefined; + const receipt = await namespace.waitForTransactionReceipt({ + hash: txHash as `0x${string}`, + onReplaced: (replacement) => { + replacementReason = replacement.reason; + }, + }); + + if (replacementReason === 'cancelled') { + throw new SignerError( + SignerErrorCode.SEND_TX_ERROR, + undefined, + 'Transaction replaced and canceled by user' + ); + } + + if (receipt.status === 'reverted') { + const tenderlyError = await getTenderlyError( + chainId, + receipt.transactionHash + ); + if (tenderlyError) { + throw new SignerError( + SignerErrorCode.TX_FAILED_IN_BLOCKCHAIN, + 'Transaction failed in blockchain', + tenderlyError, + RPCErrorCode.CALL_EXCEPTION + ); + } + } + + return { hash: receipt.transactionHash }; + } catch (error) { + if (SignerError.isSignerError(error)) { + throw error; + } + /* + * RPCs sometimes fail even when the transaction succeeded, so other errors + * are ignored and the status check carries on. + */ + return { hash: txHash }; + } +} diff --git a/queue-manager/rango-preset/src/actions/executeHyperliquidTransaction/executeHyperliquidTransaction.ts b/queue-manager/rango-preset/src/actions/executeHyperliquidTransaction/executeHyperliquidTransaction.ts index c0200d7439..11e292f9e1 100644 --- a/queue-manager/rango-preset/src/actions/executeHyperliquidTransaction/executeHyperliquidTransaction.ts +++ b/queue-manager/rango-preset/src/actions/executeHyperliquidTransaction/executeHyperliquidTransaction.ts @@ -1,9 +1,7 @@ import type { SwapQueueContext, SwapStorage } from '../../types'; import type { NextTransactionStateError } from '../common/produceNextStateForTransaction'; import type { ExecuterActions } from '@rango-dev/queue-manager-core'; -import type { EvmTransaction } from 'rango-sdk'; -import { type GenericSigner, TransactionType } from 'rango-types'; import { Err } from 'ts-results'; import { @@ -14,6 +12,7 @@ import { import { getCurrentAddressOf, getRelatedWallet } from '../../shared'; import { SwapActionTypes } from '../../types'; import { checkEnvironmentBeforeExecuteTransaction } from '../common/checkEnvironmentBeforeExecuteTransaction'; +import { signEvmTypedData } from '../common/evm'; import { onNextStateError, onNextStateOk, @@ -23,7 +22,7 @@ import { requestBlockQueue } from '../common/utils'; import { ensureHyperliquidTransactionIsValid, - getEthersV6CompatibleTypedDataFromMessage, + getTypedDataFromMessage, initiateWithdrawalRequest, splitSignature, } from './utils'; @@ -38,7 +37,6 @@ export async function executeHyperliquidTransaction( } const { failed, getStorage, context, schedule, next } = actions; - const { getSigners } = context; const swap = getStorage().swapDetails; const currentStep = getCurrentStep(swap)!; @@ -89,22 +87,29 @@ export async function executeHyperliquidTransaction( const sourceWallet = getRelatedWallet(swap, currentStep); const walletAddress = getCurrentAddressOf(swap, currentStep); - let signer: GenericSigner; - try { - const walletSigners = await getSigners(sourceWallet.walletType); - signer = walletSigners.getSigner(TransactionType.EVM); // We need EVM signer for Hyperliquid transactions - } catch (error) { - handleRejectedSign(actions)(error); - onFinish(); + // Hyperliquid transactions are EIP-712 messages signed by the EVM wallet. + const namespace = context.hubProvider(sourceWallet.walletType).get('evm'); + if (!namespace) { + handleErr( + new Err({ + nextStatus: 'failed', + nextStepStatus: 'failed', + message: + 'Unexpected Error: The EVM namespace is not available on your wallet.', + details: undefined, + errorCode: 'CLIENT_UNEXPECTED_BEHAVIOUR', + }) + ); return; } - if (!signer?.signTypedData) { + if (!('signTypedData' in namespace)) { handleErr( new Err({ nextStatus: 'failed', nextStepStatus: 'failed', - message: 'Unexpected Error: Signer does not support signTypedData.', + message: + 'Unexpected Error: Your wallet does not support signTypedData.', details: undefined, errorCode: 'CLIENT_UNEXPECTED_BEHAVIOUR', }) @@ -112,9 +117,7 @@ export async function executeHyperliquidTransaction( return; } - const typedData = getEthersV6CompatibleTypedDataFromMessage( - hyperliquidTransaction.message - ); + const typedData = getTypedDataFromMessage(hyperliquidTransaction.message); if (typedData.err) { handleErr(typedData); return; @@ -122,11 +125,7 @@ export async function executeHyperliquidTransaction( let signature: `0x${string}`; try { - signature = (await signer.signTypedData( - typedData.val, - walletAddress, - hyperliquidTransaction.action.signatureChainId - )) as `0x${string}`; + signature = await signEvmTypedData(namespace, typedData.val, walletAddress); } catch (error) { handleRejectedSign(actions)(error); onFinish(); diff --git a/queue-manager/rango-preset/src/actions/executeHyperliquidTransaction/types.ts b/queue-manager/rango-preset/src/actions/executeHyperliquidTransaction/types.ts index 5189fa67bb..dc0922a492 100644 --- a/queue-manager/rango-preset/src/actions/executeHyperliquidTransaction/types.ts +++ b/queue-manager/rango-preset/src/actions/executeHyperliquidTransaction/types.ts @@ -1,5 +1,10 @@ -export type EthersV6CompatibleTypedData = { - domain: unknown; +/** + * EIP-712 typed data in the shape viem's `signTypedData` takes. `types` holds + * only the primary type: `EIP712Domain` is derived from `domain`. + */ +export type HyperliquidTypedData = { + domain: Record; types: Record; - value: Record; + primaryType: string; + message: Record; }; diff --git a/queue-manager/rango-preset/src/actions/executeHyperliquidTransaction/utils.ts b/queue-manager/rango-preset/src/actions/executeHyperliquidTransaction/utils.ts index 4207058482..c3d1b67557 100644 --- a/queue-manager/rango-preset/src/actions/executeHyperliquidTransaction/utils.ts +++ b/queue-manager/rango-preset/src/actions/executeHyperliquidTransaction/utils.ts @@ -1,5 +1,5 @@ /* eslint-disable @typescript-eslint/no-magic-numbers */ -import type { EthersV6CompatibleTypedData } from './types'; +import type { HyperliquidTypedData } from './types'; import type { NextTransactionStateError } from '../common/produceNextStateForTransaction'; import type { HyperliquidTransaction, Transaction } from 'rango-sdk'; import type { Result } from 'ts-results'; @@ -56,19 +56,19 @@ export function ensureHyperliquidTransactionIsValid( return Ok(tx); } -export function getEthersV6CompatibleTypedDataFromMessage( +export function getTypedDataFromMessage( message: string -): Result { +): Result { try { const typedData = JSON.parse(message); - const ethersV6CompatibleTypedData = { + return Ok({ domain: typedData.domain, types: { [typedData.primaryType]: typedData.types[typedData.primaryType], }, - value: typedData.message, - }; - return Ok(ethersV6CompatibleTypedData); + primaryType: typedData.primaryType, + message: typedData.message, + }); } catch { return new Err({ nextStatus: 'failed', diff --git a/queue-manager/rango-preset/src/actions/executeTransaction/executeTransaction.ts b/queue-manager/rango-preset/src/actions/executeTransaction/executeTransaction.ts index 37a0d96e54..3f4226732b 100644 --- a/queue-manager/rango-preset/src/actions/executeTransaction/executeTransaction.ts +++ b/queue-manager/rango-preset/src/actions/executeTransaction/executeTransaction.ts @@ -6,6 +6,8 @@ import type { import type { ExecuterActions } from '@rango-dev/queue-manager-core'; import type { SignerFactory } from 'rango-types'; +import { TransactionType } from 'rango-types'; + import { getCurrentStep, getCurrentStepTx, @@ -16,6 +18,7 @@ import { } from '../../helpers'; import { getCurrentAddressOf, getRelatedWallet } from '../../shared'; import { checkEnvironmentBeforeExecuteTransaction } from '../common/checkEnvironmentBeforeExecuteTransaction'; +import { sendEvmTransaction } from '../common/evm'; import { onNextStateError, onNextStateOk, @@ -83,6 +86,30 @@ export async function executeTransaction( const chainId = meta.blockchains?.[tx.blockChain]?.chainId; + // EVM transactions go through the wallet's EVM namespace. + if (tx.type === TransactionType.EVM) { + const namespace = context.hubProvider(sourceWallet.walletType).get('evm'); + if (!namespace) { + handleRejectedSign(actions)( + new Error('The EVM namespace is not available on your wallet.') + ); + onFinish(); + return; + } + + await sendEvmTransaction(namespace, tx, walletAddress, chainId ?? null) + .then( + handleSuccessfulSign(actions, { + isApproval, + }), + handleRejectedSign(actions) + ) + .finally(() => { + onFinish(); + }); + return; + } + let walletSigners: SignerFactory; try { walletSigners = await getSigners(sourceWallet.walletType); From a2da811da2a3ebe96845a66e795803083bfed6c6 Mon Sep 17 00:00:00 2001 From: arlert-armin Date: Fri, 16 Oct 2026 15:41:31 +0000 Subject: [PATCH 11/29] fix(wallets-react): return the hub's registered provider from hubProvider hubProvider returned the provider from the configured list. The widget rebuilds that list with the same ids, while the hub keeps the instances it registered first, so the returned provider could have no store, and its namespaces threw "You need to set your store using `.store` method first." as soon as an action read their state, e.g. signing an EVM transaction. Return the hub's own instance instead. --- wallets/provider-all/src/index.ts | 4 +- .../provider-binance/src/namespaces/evm.ts | 38 ++++----------- wallets/provider-binance/src/provider.ts | 11 ++--- wallets/provider-bitget/src/namespaces/evm.ts | 40 ++++------------ wallets/provider-bitget/src/provider.ts | 11 ++--- wallets/provider-brave/src/namespaces/evm.ts | 40 ++++------------ wallets/provider-brave/src/provider.ts | 11 ++--- wallets/provider-coin98/src/namespaces/evm.ts | 37 ++++----------- wallets/provider-coin98/src/provider.ts | 11 ++--- .../provider-coinbase/src/namespaces/evm.ts | 40 ++++------------ wallets/provider-coinbase/src/provider.ts | 11 ++--- .../provider-default/src/namespaces/evm.ts | 40 ++++------------ wallets/provider-default/src/provider.ts | 11 ++--- .../provider-enkrypt/src/namespaces/evm.ts | 40 ++++------------ wallets/provider-enkrypt/src/provider.ts | 11 ++--- wallets/provider-exodus/src/namespaces/evm.ts | 39 ++++------------ wallets/provider-exodus/src/provider.ts | 11 ++--- .../src/namespaces/evm.ts | 40 ++++------------ .../provider-ledger-wallet/src/provider.ts | 11 ++--- wallets/provider-ledger/src/namespaces/evm.ts | 19 ++------ .../src/namespaces/evm.ts | 39 ++++------------ wallets/provider-math-wallet/src/provider.ts | 11 ++--- .../provider-metamask/src/namespaces/evm.ts | 40 ++++------------ wallets/provider-metamask/src/provider.ts | 11 ++--- wallets/provider-okx/src/namespaces/evm.ts | 40 ++++------------ wallets/provider-okx/src/provider.ts | 11 ++--- .../provider-phantom/src/namespaces/evm.ts | 40 ++++------------ wallets/provider-phantom/src/provider.ts | 11 ++--- wallets/provider-rabby/src/namespaces/evm.ts | 40 ++++------------ wallets/provider-rabby/src/provider.ts | 11 ++--- wallets/provider-safe/src/namespaces/evm.ts | 46 ++++++------------- wallets/provider-safe/src/provider.ts | 11 ++--- .../provider-safepal/src/namespaces/evm.ts | 37 ++++----------- wallets/provider-safepal/src/provider.ts | 11 ++--- wallets/provider-taho/src/namespaces/evm.ts | 40 ++++------------ wallets/provider-taho/src/provider.ts | 11 ++--- .../src/namespaces/evm.ts | 40 ++++------------ wallets/provider-tokenpocket/src/provider.ts | 11 ++--- wallets/provider-tomo/src/namespaces/evm.ts | 39 ++++------------ wallets/provider-tomo/src/provider.ts | 11 ++--- wallets/provider-trezor/src/namespaces/evm.ts | 19 ++------ .../src/namespaces/evm.ts | 38 ++++----------- wallets/provider-trustwallet/src/provider.ts | 11 ++--- .../src/namespaces/evm/namespace.ts | 40 ++++------------ .../provider-walletconnect-2/src/provider.ts | 11 ++--- wallets/react/src/hub/useHubAdapter.ts | 8 +++- 46 files changed, 310 insertions(+), 804 deletions(-) diff --git a/wallets/provider-all/src/index.ts b/wallets/provider-all/src/index.ts index 915817d62b..c159404b87 100644 --- a/wallets/provider-all/src/index.ts +++ b/wallets/provider-all/src/index.ts @@ -45,7 +45,9 @@ export { WalletTypes } from './walletTypes.js'; * actions go to `evm`. */ export const RPC_URLS: NamespacesRPCUrls = { - evm: 'https://rpc.ankr.com/eth/8d43f5e842676d766141cb1943b9b4e12821f463665e180c209bd3dab9639df2', + evm: [ + 'https://rpc.ankr.com/eth/8d43f5e842676d766141cb1943b9b4e12821f463665e180c209bd3dab9639df2', + ], }; // Providers register different namespaces, so the list is typed loosely instead of `Provider`. diff --git a/wallets/provider-binance/src/namespaces/evm.ts b/wallets/provider-binance/src/namespaces/evm.ts index 150203c420..1ada9c56b0 100644 --- a/wallets/provider-binance/src/namespaces/evm.ts +++ b/wallets/provider-binance/src/namespaces/evm.ts @@ -1,13 +1,7 @@ import type { EvmActions } from '@hub3js/evm'; import { NamespaceBuilder } from '@hub3js/core'; -import { - actions, - builders, - utils, - viemPublicAdapter, - viemWalletAdapter, -} from '@hub3js/evm'; +import { actions, builders, utils, viemWalletAdapter } from '@hub3js/evm'; import * as commonBuilders from '@hub3js/std/builders'; import { standardizeAndThrowError } from '@hub3js/std/operators'; @@ -58,27 +52,13 @@ const getAllowance = builders .action(actions.getAllowance(evmBinance)) .build(); -const getTransactionReceipt = builders - .getTransactionReceipt() - .action(actions.getTransactionReceipt(evmBinance)) +const evm = new NamespaceBuilder('EVM', WALLET_ID) + .action(viemWalletAdapter(evmBinance)) + .action(connect) + .action(disconnect) + .action(canSwitchNetwork) + .action(getChainId) + .action(getAllowance) .build(); -const waitForTransactionReceipt = builders - .waitForTransactionReceipt() - .action(actions.waitForTransactionReceipt(evmBinance)) - .build(); - -const buildEvm = (rpcUrl: string) => - new NamespaceBuilder('EVM', WALLET_ID) - .action(connect) - .action(disconnect) - .action(canSwitchNetwork) - .action(getChainId) - .action(getAllowance) - .action(getTransactionReceipt) - .action(waitForTransactionReceipt) - .action(viemWalletAdapter(evmBinance)) - .action(viemPublicAdapter(rpcUrl)) - .build(); - -export { buildEvm }; +export { evm }; diff --git a/wallets/provider-binance/src/provider.ts b/wallets/provider-binance/src/provider.ts index 18e1d06026..f197c66f6d 100644 --- a/wallets/provider-binance/src/provider.ts +++ b/wallets/provider-binance/src/provider.ts @@ -3,14 +3,11 @@ import type { NamespacesRPCUrls } from '@hub3js/namespaces'; import { ProviderBuilder } from '@hub3js/core'; import { metadata, WALLET_ID } from './constants.js'; -import { buildEvm } from './namespaces/evm.js'; +import { evm } from './namespaces/evm.js'; import { binance as binanceInstance } from './utils.js'; -const buildProvider = (rpcURLs: NamespacesRPCUrls) => { - if (!rpcURLs?.evm) { - throw new Error('An RPC URL for the EVM namespace is required.'); - } - +// RPC URLs are accepted for every namespace, so any of them can start using one. +const buildProvider = (_rpcURLs: NamespacesRPCUrls) => { return new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); @@ -20,7 +17,7 @@ const buildProvider = (rpcURLs: NamespacesRPCUrls) => { } }) .config('metadata', metadata) - .add('evm', buildEvm(rpcURLs.evm)) + .add('evm', evm) .build(); }; diff --git a/wallets/provider-bitget/src/namespaces/evm.ts b/wallets/provider-bitget/src/namespaces/evm.ts index 54ae5d348b..a57ea065fe 100644 --- a/wallets/provider-bitget/src/namespaces/evm.ts +++ b/wallets/provider-bitget/src/namespaces/evm.ts @@ -1,13 +1,7 @@ import type { EvmActions } from '@hub3js/evm'; import { NamespaceBuilder } from '@hub3js/core'; -import { - actions, - builders, - hooks, - viemPublicAdapter, - viemWalletAdapter, -} from '@hub3js/evm'; +import { actions, builders, hooks, viemWalletAdapter } from '@hub3js/evm'; import * as commonBuilders from '@hub3js/std/builders'; import { standardizeAndThrowError } from '@hub3js/std/operators'; @@ -49,28 +43,14 @@ const getAllowance = builders .action(actions.getAllowance(evmBitget)) .build(); -const getTransactionReceipt = builders - .getTransactionReceipt() - .action(actions.getTransactionReceipt(evmBitget)) +const evm = new NamespaceBuilder('EVM', WALLET_ID) + .action(viemWalletAdapter(evmBitget)) + .action(connect) + .action(disconnect) + .action(getChainId) + .action(canEagerConnect) + .action(canSwitchNetwork) + .action(getAllowance) .build(); -const waitForTransactionReceipt = builders - .waitForTransactionReceipt() - .action(actions.waitForTransactionReceipt(evmBitget)) - .build(); - -const buildEvm = (rpcUrl: string) => - new NamespaceBuilder('EVM', WALLET_ID) - .action(connect) - .action(disconnect) - .action(getChainId) - .action(canEagerConnect) - .action(canSwitchNetwork) - .action(getAllowance) - .action(getTransactionReceipt) - .action(waitForTransactionReceipt) - .action(viemWalletAdapter(evmBitget)) - .action(viemPublicAdapter(rpcUrl)) - .build(); - -export { buildEvm }; +export { evm }; diff --git a/wallets/provider-bitget/src/provider.ts b/wallets/provider-bitget/src/provider.ts index 4f5134fa32..4a031ac46f 100644 --- a/wallets/provider-bitget/src/provider.ts +++ b/wallets/provider-bitget/src/provider.ts @@ -3,16 +3,13 @@ import type { NamespacesRPCUrls } from '@hub3js/namespaces'; import { ProviderBuilder } from '@hub3js/core'; import { metadata, WALLET_ID } from './constants.js'; -import { buildEvm } from './namespaces/evm.js'; +import { evm } from './namespaces/evm.js'; import { tron } from './namespaces/tron.js'; import { utxo } from './namespaces/utxo.js'; import { bitget } from './utils.js'; -const buildProvider = (rpcURLs: NamespacesRPCUrls) => { - if (!rpcURLs?.evm) { - throw new Error('An RPC URL for the EVM namespace is required.'); - } - +// RPC URLs are accepted for every namespace, so any of them can start using one. +const buildProvider = (_rpcURLs: NamespacesRPCUrls) => { return new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); @@ -24,7 +21,7 @@ const buildProvider = (rpcURLs: NamespacesRPCUrls) => { }) .config('metadata', metadata) .add('tron', tron) - .add('evm', buildEvm(rpcURLs.evm)) + .add('evm', evm) .add('utxo', utxo) .build(); }; diff --git a/wallets/provider-brave/src/namespaces/evm.ts b/wallets/provider-brave/src/namespaces/evm.ts index a883f47fbc..78c0d9baae 100644 --- a/wallets/provider-brave/src/namespaces/evm.ts +++ b/wallets/provider-brave/src/namespaces/evm.ts @@ -1,13 +1,7 @@ import type { EvmActions } from '@hub3js/evm'; import { NamespaceBuilder } from '@hub3js/core'; -import { - actions, - builders, - hooks, - viemPublicAdapter, - viemWalletAdapter, -} from '@hub3js/evm'; +import { actions, builders, hooks, viemWalletAdapter } from '@hub3js/evm'; import * as commonBuilders from '@hub3js/std/builders'; import { standardizeAndThrowError } from '@hub3js/std/operators'; @@ -49,28 +43,14 @@ const getAllowance = builders .action(actions.getAllowance(evmBrave)) .build(); -const getTransactionReceipt = builders - .getTransactionReceipt() - .action(actions.getTransactionReceipt(evmBrave)) +const evm = new NamespaceBuilder('EVM', WALLET_ID) + .action(viemWalletAdapter(evmBrave)) + .action(connect) + .action(disconnect) + .action(canEagerConnect) + .action(canSwitchNetwork) + .action(getChainId) + .action(getAllowance) .build(); -const waitForTransactionReceipt = builders - .waitForTransactionReceipt() - .action(actions.waitForTransactionReceipt(evmBrave)) - .build(); - -const buildEvm = (rpcUrl: string) => - new NamespaceBuilder('EVM', WALLET_ID) - .action(connect) - .action(disconnect) - .action(canEagerConnect) - .action(canSwitchNetwork) - .action(getChainId) - .action(getAllowance) - .action(getTransactionReceipt) - .action(waitForTransactionReceipt) - .action(viemWalletAdapter(evmBrave)) - .action(viemPublicAdapter(rpcUrl)) - .build(); - -export { buildEvm }; +export { evm }; diff --git a/wallets/provider-brave/src/provider.ts b/wallets/provider-brave/src/provider.ts index c6432ec2dc..bce7c4e0c5 100644 --- a/wallets/provider-brave/src/provider.ts +++ b/wallets/provider-brave/src/provider.ts @@ -3,15 +3,12 @@ import type { NamespacesRPCUrls } from '@hub3js/namespaces'; import { ProviderBuilder } from '@hub3js/core'; import { metadata, WALLET_ID } from './constants.js'; -import { buildEvm } from './namespaces/evm.js'; +import { evm } from './namespaces/evm.js'; import { solana } from './namespaces/solana.js'; import { brave } from './utils.js'; -const buildProvider = (rpcURLs: NamespacesRPCUrls) => { - if (!rpcURLs?.evm) { - throw new Error('An RPC URL for the EVM namespace is required.'); - } - +// RPC URLs are accepted for every namespace, so any of them can start using one. +const buildProvider = (_rpcURLs: NamespacesRPCUrls) => { return new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); @@ -23,7 +20,7 @@ const buildProvider = (rpcURLs: NamespacesRPCUrls) => { }) .config('metadata', metadata) .add('solana', solana) - .add('evm', buildEvm(rpcURLs.evm)) + .add('evm', evm) .build(); }; diff --git a/wallets/provider-coin98/src/namespaces/evm.ts b/wallets/provider-coin98/src/namespaces/evm.ts index 800fd295f8..2c2dfd66e8 100644 --- a/wallets/provider-coin98/src/namespaces/evm.ts +++ b/wallets/provider-coin98/src/namespaces/evm.ts @@ -1,12 +1,7 @@ import type { EvmActions } from '@hub3js/evm'; import { NamespaceBuilder } from '@hub3js/core'; -import { - actions, - builders, - viemPublicAdapter, - viemWalletAdapter, -} from '@hub3js/evm'; +import { actions, builders, viemWalletAdapter } from '@hub3js/evm'; import * as commonBuilders from '@hub3js/std/builders'; import { standardizeAndThrowError } from '@hub3js/std/operators'; @@ -45,27 +40,13 @@ const getAllowance = builders .action(actions.getAllowance(evmCoin98)) .build(); -const getTransactionReceipt = builders - .getTransactionReceipt() - .action(actions.getTransactionReceipt(evmCoin98)) +const evm = new NamespaceBuilder('EVM', WALLET_ID) + .action(viemWalletAdapter(evmCoin98)) + .action(connect) + .action(disconnect) + .action(canSwitchNetwork) + .action(getChainId) + .action(getAllowance) .build(); -const waitForTransactionReceipt = builders - .waitForTransactionReceipt() - .action(actions.waitForTransactionReceipt(evmCoin98)) - .build(); - -const buildEvm = (rpcUrl: string) => - new NamespaceBuilder('EVM', WALLET_ID) - .action(connect) - .action(disconnect) - .action(canSwitchNetwork) - .action(getChainId) - .action(getAllowance) - .action(getTransactionReceipt) - .action(waitForTransactionReceipt) - .action(viemWalletAdapter(evmCoin98)) - .action(viemPublicAdapter(rpcUrl)) - .build(); - -export { buildEvm }; +export { evm }; diff --git a/wallets/provider-coin98/src/provider.ts b/wallets/provider-coin98/src/provider.ts index a2275582e0..2672345ee8 100644 --- a/wallets/provider-coin98/src/provider.ts +++ b/wallets/provider-coin98/src/provider.ts @@ -3,15 +3,12 @@ import type { NamespacesRPCUrls } from '@hub3js/namespaces'; import { ProviderBuilder } from '@hub3js/core'; import { COIN98_INJECTION_DELAY, metadata, WALLET_ID } from './constants.js'; -import { buildEvm } from './namespaces/evm.js'; +import { evm } from './namespaces/evm.js'; import { solana } from './namespaces/solana.js'; import { coin98 } from './utils.js'; -const buildProvider = (rpcURLs: NamespacesRPCUrls) => { - if (!rpcURLs?.evm) { - throw new Error('An RPC URL for the EVM namespace is required.'); - } - +// RPC URLs are accepted for every namespace, so any of them can start using one. +const buildProvider = (_rpcURLs: NamespacesRPCUrls) => { return new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); @@ -24,7 +21,7 @@ const buildProvider = (rpcURLs: NamespacesRPCUrls) => { }, COIN98_INJECTION_DELAY); }) .config('metadata', metadata) - .add('evm', buildEvm(rpcURLs.evm)) + .add('evm', evm) .add('solana', solana) .build(); }; diff --git a/wallets/provider-coinbase/src/namespaces/evm.ts b/wallets/provider-coinbase/src/namespaces/evm.ts index 09b4ce8864..b0b50d0d00 100644 --- a/wallets/provider-coinbase/src/namespaces/evm.ts +++ b/wallets/provider-coinbase/src/namespaces/evm.ts @@ -1,13 +1,7 @@ import type { EvmActions } from '@hub3js/evm'; import { ActionBuilder, NamespaceBuilder } from '@hub3js/core'; -import { - actions, - builders, - utils, - viemPublicAdapter, - viemWalletAdapter, -} from '@hub3js/evm'; +import { actions, builders, utils, viemWalletAdapter } from '@hub3js/evm'; import * as commonBuilders from '@hub3js/std/builders'; import { connectAndUpdateStateForMultiNetworks, @@ -84,28 +78,14 @@ const getAllowance = builders .action(actions.getAllowance(evmCoinbase)) .build(); -const getTransactionReceipt = builders - .getTransactionReceipt() - .action(actions.getTransactionReceipt(evmCoinbase)) - .build(); - -const waitForTransactionReceipt = builders - .waitForTransactionReceipt() - .action(actions.waitForTransactionReceipt(evmCoinbase)) +const evm = new NamespaceBuilder('EVM', WALLET_ID) + .action(viemWalletAdapter(evmCoinbase)) + .action(connect) + .action(disconnect) + .action(canEagerConnect) + .action(canSwitchNetwork) + .action(getChainId) + .action(getAllowance) .build(); -const buildEvm = (rpcUrl: string) => - new NamespaceBuilder('EVM', WALLET_ID) - .action(connect) - .action(disconnect) - .action(canEagerConnect) - .action(canSwitchNetwork) - .action(getChainId) - .action(getAllowance) - .action(getTransactionReceipt) - .action(waitForTransactionReceipt) - .action(viemWalletAdapter(evmCoinbase)) - .action(viemPublicAdapter(rpcUrl)) - .build(); - -export { buildEvm }; +export { evm }; diff --git a/wallets/provider-coinbase/src/provider.ts b/wallets/provider-coinbase/src/provider.ts index cc98cd8878..294eb3a4df 100644 --- a/wallets/provider-coinbase/src/provider.ts +++ b/wallets/provider-coinbase/src/provider.ts @@ -3,15 +3,12 @@ import type { NamespacesRPCUrls } from '@hub3js/namespaces'; import { ProviderBuilder } from '@hub3js/core'; import { metadata, WALLET_ID } from './constants.js'; -import { buildEvm } from './namespaces/evm.js'; +import { evm } from './namespaces/evm.js'; import { solana } from './namespaces/solana.js'; import { coinbase as coinbaseInstance } from './utils.js'; -const buildProvider = (rpcURLs: NamespacesRPCUrls) => { - if (!rpcURLs?.evm) { - throw new Error('An RPC URL for the EVM namespace is required.'); - } - +// RPC URLs are accepted for every namespace, so any of them can start using one. +const buildProvider = (_rpcURLs: NamespacesRPCUrls) => { return new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); @@ -23,7 +20,7 @@ const buildProvider = (rpcURLs: NamespacesRPCUrls) => { }) .config('metadata', metadata) .add('solana', solana) - .add('evm', buildEvm(rpcURLs.evm)) + .add('evm', evm) .build(); }; diff --git a/wallets/provider-default/src/namespaces/evm.ts b/wallets/provider-default/src/namespaces/evm.ts index a54201b529..81219a81f1 100644 --- a/wallets/provider-default/src/namespaces/evm.ts +++ b/wallets/provider-default/src/namespaces/evm.ts @@ -1,13 +1,7 @@ import type { EvmActions } from '@hub3js/evm'; import { NamespaceBuilder } from '@hub3js/core'; -import { - actions, - builders, - hooks, - viemPublicAdapter, - viemWalletAdapter, -} from '@hub3js/evm'; +import { actions, builders, hooks, viemWalletAdapter } from '@hub3js/evm'; import * as commonBuilders from '@hub3js/std/builders'; import { standardizeAndThrowError } from '@hub3js/std/operators'; @@ -50,28 +44,14 @@ const getAllowance = builders .action(actions.getAllowance(evmDefault)) .build(); -const getTransactionReceipt = builders - .getTransactionReceipt() - .action(actions.getTransactionReceipt(evmDefault)) +const evm = new NamespaceBuilder('EVM', WALLET_ID) + .action(viemWalletAdapter(evmDefault)) + .action(connect) + .action(disconnect) + .action(canEagerConnect) + .action(canSwitchNetwork) + .action(getChainId) + .action(getAllowance) .build(); -const waitForTransactionReceipt = builders - .waitForTransactionReceipt() - .action(actions.waitForTransactionReceipt(evmDefault)) - .build(); - -const buildEvm = (rpcUrl: string) => - new NamespaceBuilder('EVM', WALLET_ID) - .action(connect) - .action(disconnect) - .action(canEagerConnect) - .action(canSwitchNetwork) - .action(getChainId) - .action(getAllowance) - .action(getTransactionReceipt) - .action(waitForTransactionReceipt) - .action(viemWalletAdapter(evmDefault)) - .action(viemPublicAdapter(rpcUrl)) - .build(); - -export { buildEvm }; +export { evm }; diff --git a/wallets/provider-default/src/provider.ts b/wallets/provider-default/src/provider.ts index 46aff4715d..321ae53f46 100644 --- a/wallets/provider-default/src/provider.ts +++ b/wallets/provider-default/src/provider.ts @@ -3,14 +3,11 @@ import type { NamespacesRPCUrls } from '@hub3js/namespaces'; import { ProviderBuilder } from '@hub3js/core'; import { INJECTION_DELAY, metadata, WALLET_ID } from './constants.js'; -import { buildEvm } from './namespaces/evm.js'; +import { evm } from './namespaces/evm.js'; import { defaultInjected } from './utils.js'; -const buildProvider = (rpcURLs: NamespacesRPCUrls) => { - if (!rpcURLs?.evm) { - throw new Error('An RPC URL for the EVM namespace is required.'); - } - +// RPC URLs are accepted for every namespace, so any of them can start using one. +const buildProvider = (_rpcURLs: NamespacesRPCUrls) => { return new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); @@ -23,7 +20,7 @@ const buildProvider = (rpcURLs: NamespacesRPCUrls) => { }, INJECTION_DELAY); }) .config('metadata', metadata) - .add('evm', buildEvm(rpcURLs.evm)) + .add('evm', evm) .build(); }; diff --git a/wallets/provider-enkrypt/src/namespaces/evm.ts b/wallets/provider-enkrypt/src/namespaces/evm.ts index 7424b3b138..648a73b560 100644 --- a/wallets/provider-enkrypt/src/namespaces/evm.ts +++ b/wallets/provider-enkrypt/src/namespaces/evm.ts @@ -1,13 +1,7 @@ import type { EvmActions } from '@hub3js/evm'; import { NamespaceBuilder } from '@hub3js/core'; -import { - actions, - builders, - hooks, - viemPublicAdapter, - viemWalletAdapter, -} from '@hub3js/evm'; +import { actions, builders, hooks, viemWalletAdapter } from '@hub3js/evm'; import * as commonBuilders from '@hub3js/std/builders'; import { standardizeAndThrowError } from '@hub3js/std/operators'; @@ -51,28 +45,14 @@ const getAllowance = builders .action(actions.getAllowance(evmEnkrypt)) .build(); -const getTransactionReceipt = builders - .getTransactionReceipt() - .action(actions.getTransactionReceipt(evmEnkrypt)) +const evm = new NamespaceBuilder('EVM', WALLET_ID) + .action(viemWalletAdapter(evmEnkrypt)) + .action(connect) + .action(disconnect) + .action(canEagerConnect) + .action(canSwitchNetwork) + .action(getChainId) + .action(getAllowance) .build(); -const waitForTransactionReceipt = builders - .waitForTransactionReceipt() - .action(actions.waitForTransactionReceipt(evmEnkrypt)) - .build(); - -const buildEvm = (rpcUrl: string) => - new NamespaceBuilder('EVM', WALLET_ID) - .action(connect) - .action(disconnect) - .action(canEagerConnect) - .action(canSwitchNetwork) - .action(getChainId) - .action(getAllowance) - .action(getTransactionReceipt) - .action(waitForTransactionReceipt) - .action(viemWalletAdapter(evmEnkrypt)) - .action(viemPublicAdapter(rpcUrl)) - .build(); - -export { buildEvm }; +export { evm }; diff --git a/wallets/provider-enkrypt/src/provider.ts b/wallets/provider-enkrypt/src/provider.ts index 62f912246d..c34f599942 100644 --- a/wallets/provider-enkrypt/src/provider.ts +++ b/wallets/provider-enkrypt/src/provider.ts @@ -3,14 +3,11 @@ import type { NamespacesRPCUrls } from '@hub3js/namespaces'; import { ProviderBuilder } from '@hub3js/core'; import { metadata, WALLET_ID } from './constants.js'; -import { buildEvm } from './namespaces/evm.js'; +import { evm } from './namespaces/evm.js'; import { enkrypt } from './utils.js'; -const buildProvider = (rpcURLs: NamespacesRPCUrls) => { - if (!rpcURLs?.evm) { - throw new Error('An RPC URL for the EVM namespace is required.'); - } - +// RPC URLs are accepted for every namespace, so any of them can start using one. +const buildProvider = (_rpcURLs: NamespacesRPCUrls) => { return new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); @@ -21,7 +18,7 @@ const buildProvider = (rpcURLs: NamespacesRPCUrls) => { } }) .config('metadata', metadata) - .add('evm', buildEvm(rpcURLs.evm)) + .add('evm', evm) .build(); }; diff --git a/wallets/provider-exodus/src/namespaces/evm.ts b/wallets/provider-exodus/src/namespaces/evm.ts index ec1ee6ece9..f59e382b7b 100644 --- a/wallets/provider-exodus/src/namespaces/evm.ts +++ b/wallets/provider-exodus/src/namespaces/evm.ts @@ -1,12 +1,7 @@ import type { EvmActions } from '@hub3js/evm'; import { NamespaceBuilder } from '@hub3js/core'; -import { - actions, - builders, - viemPublicAdapter, - viemWalletAdapter, -} from '@hub3js/evm'; +import { actions, builders, viemWalletAdapter } from '@hub3js/evm'; import * as commonBuilders from '@hub3js/std/builders'; import { standardizeAndThrowError } from '@hub3js/std/operators'; @@ -41,28 +36,14 @@ const getAllowance = builders .action(actions.getAllowance(evmExodus)) .build(); -const getTransactionReceipt = builders - .getTransactionReceipt() - .action(actions.getTransactionReceipt(evmExodus)) +const evm = new NamespaceBuilder('EVM', WALLET_ID) + .action(viemWalletAdapter(evmExodus)) + .action(connect) + .action(disconnect) + .action(canEagerConnect) + .action(getChainId) + .action(canSwitchNetwork) + .action(getAllowance) .build(); -const waitForTransactionReceipt = builders - .waitForTransactionReceipt() - .action(actions.waitForTransactionReceipt(evmExodus)) - .build(); - -const buildEvm = (rpcUrl: string) => - new NamespaceBuilder('EVM', WALLET_ID) - .action(connect) - .action(disconnect) - .action(canEagerConnect) - .action(getChainId) - .action(canSwitchNetwork) - .action(getAllowance) - .action(getTransactionReceipt) - .action(waitForTransactionReceipt) - .action(viemWalletAdapter(evmExodus)) - .action(viemPublicAdapter(rpcUrl)) - .build(); - -export { buildEvm }; +export { evm }; diff --git a/wallets/provider-exodus/src/provider.ts b/wallets/provider-exodus/src/provider.ts index 14781c8da6..9e038c33c3 100644 --- a/wallets/provider-exodus/src/provider.ts +++ b/wallets/provider-exodus/src/provider.ts @@ -3,16 +3,13 @@ import type { NamespacesRPCUrls } from '@hub3js/namespaces'; import { ProviderBuilder } from '@hub3js/core'; import { metadata, WALLET_ID } from './constants.js'; -import { buildEvm } from './namespaces/evm.js'; +import { evm } from './namespaces/evm.js'; import { solana } from './namespaces/solana.js'; import { exodus as exodusInstance } from './utils.js'; const WALLET_INJECTION_DELAY_MS = 1000; -const buildProvider = (rpcURLs: NamespacesRPCUrls) => { - if (!rpcURLs?.evm) { - throw new Error('An RPC URL for the EVM namespace is required.'); - } - +// RPC URLs are accepted for every namespace, so any of them can start using one. +const buildProvider = (_rpcURLs: NamespacesRPCUrls) => { return new ProviderBuilder(WALLET_ID) .init((context) => setTimeout(function () { @@ -26,7 +23,7 @@ const buildProvider = (rpcURLs: NamespacesRPCUrls) => { ) .config('metadata', metadata) .add('solana', solana) - .add('evm', buildEvm(rpcURLs.evm)) + .add('evm', evm) .build(); }; diff --git a/wallets/provider-ledger-wallet/src/namespaces/evm.ts b/wallets/provider-ledger-wallet/src/namespaces/evm.ts index 59376feb7d..b224141353 100644 --- a/wallets/provider-ledger-wallet/src/namespaces/evm.ts +++ b/wallets/provider-ledger-wallet/src/namespaces/evm.ts @@ -2,13 +2,7 @@ import type { Context } from '@hub3js/core'; import type { Chain, ChainId, EvmActions } from '@hub3js/evm'; import { NamespaceBuilder } from '@hub3js/core'; -import { - actions, - builders, - utils, - viemPublicAdapter, - viemWalletAdapter, -} from '@hub3js/evm'; +import { actions, builders, utils, viemWalletAdapter } from '@hub3js/evm'; import * as commonBuilders from '@hub3js/std/builders'; import { standardizeAndThrowError } from '@hub3js/std/operators'; @@ -107,28 +101,14 @@ const getAllowance = builders .action(actions.getAllowance(getProvider)) .build(); -const getTransactionReceipt = builders - .getTransactionReceipt() - .action(actions.getTransactionReceipt(getProvider)) +const evm = new NamespaceBuilder('EVM', WALLET_ID) + .action(viemWalletAdapter(getProvider)) + .action(connect) + .action(disconnect) + .action(canEagerConnect) + .action(canSwitchNetwork) + .action(getChainId) + .action(getAllowance) .build(); -const waitForTransactionReceipt = builders - .waitForTransactionReceipt() - .action(actions.waitForTransactionReceipt(getProvider)) - .build(); - -const buildEvm = (rpcUrl: string) => - new NamespaceBuilder('EVM', WALLET_ID) - .action(connect) - .action(disconnect) - .action(canEagerConnect) - .action(canSwitchNetwork) - .action(getChainId) - .action(getAllowance) - .action(getTransactionReceipt) - .action(waitForTransactionReceipt) - .action(viemWalletAdapter(getProvider)) - .action(viemPublicAdapter(rpcUrl)) - .build(); - -export { buildEvm }; +export { evm }; diff --git a/wallets/provider-ledger-wallet/src/provider.ts b/wallets/provider-ledger-wallet/src/provider.ts index dd286d9461..183eb80c07 100644 --- a/wallets/provider-ledger-wallet/src/provider.ts +++ b/wallets/provider-ledger-wallet/src/provider.ts @@ -7,15 +7,12 @@ import { ProviderBuilder } from '@hub3js/core'; import { metadata, WALLET_ID } from './constants.js'; import { setProvider } from './ledgerProvider.js'; -import { buildEvm } from './namespaces/evm.js'; +import { evm } from './namespaces/evm.js'; const LEDGER_PROVIDER_NAME = 'Ledger Wallet'; -const buildProvider = (rpcURLs: NamespacesRPCUrls) => { - if (!rpcURLs?.evm) { - throw new Error('An RPC URL for the EVM namespace is required.'); - } - +// RPC URLs are accepted for every namespace, so any of them can start using one. +const buildProvider = (_rpcURLs: NamespacesRPCUrls) => { return new ProviderBuilder(WALLET_ID) .init(function (context, environments: Environments) { const [, setState] = context.state(); @@ -97,7 +94,7 @@ const buildProvider = (rpcURLs: NamespacesRPCUrls) => { }; }) .config('metadata', metadata) - .add('evm', buildEvm(rpcURLs.evm)) + .add('evm', evm) .build(); }; diff --git a/wallets/provider-ledger/src/namespaces/evm.ts b/wallets/provider-ledger/src/namespaces/evm.ts index 1391d0b196..7cd08ec0e8 100644 --- a/wallets/provider-ledger/src/namespaces/evm.ts +++ b/wallets/provider-ledger/src/namespaces/evm.ts @@ -3,12 +3,7 @@ import type { AllowanceParams, EvmActions } from '@hub3js/evm'; import type { CaipAccount } from '@hub3js/std/types'; import { Hub3Error, NamespaceBuilder } from '@hub3js/core'; -import { - builders, - CAIP_NAMESPACE, - viemPublicActions, - viemPublicAdapter, -} from '@hub3js/evm'; +import { builders, CAIP_NAMESPACE, viemPublicAdapter } from '@hub3js/evm'; import * as commonBuilders from '@hub3js/std/builders'; import { standardizeAndThrowError } from '@hub3js/std/operators'; import { AccountId } from 'caip'; @@ -93,20 +88,14 @@ const getAllowance = builders ) .build(); -const buildEvm = (rpcUrl: string) => +const buildEvm = (rpcUrls: string[]) => new NamespaceBuilder('EVM', WALLET_ID) + // No wallet RPC, so viem's public actions go to our RPC endpoints. + .action(viemPublicAdapter(rpcUrls)) .action(connect) .action(disconnect) .action(getChainId) .action(getAllowance) - // Every public action except the receipt ones, which are picked below. - .action(viemPublicAdapter(rpcUrl)) - .action( - viemPublicActions(rpcUrl, [ - 'getTransactionReceipt', - 'waitForTransactionReceipt', - ]) - ) // Signed on the device, see `signers/ethereum.ts`. .action('sendTransaction', sendTransaction) .action('signMessage', signMessage) diff --git a/wallets/provider-math-wallet/src/namespaces/evm.ts b/wallets/provider-math-wallet/src/namespaces/evm.ts index 8d2fae2cc8..43701acdc0 100644 --- a/wallets/provider-math-wallet/src/namespaces/evm.ts +++ b/wallets/provider-math-wallet/src/namespaces/evm.ts @@ -1,12 +1,7 @@ import type { EvmActions } from '@hub3js/evm'; import { NamespaceBuilder } from '@hub3js/core'; -import { - actions, - builders, - viemPublicAdapter, - viemWalletAdapter, -} from '@hub3js/evm'; +import { actions, builders, viemWalletAdapter } from '@hub3js/evm'; import * as commonBuilders from '@hub3js/std/builders'; import { standardizeAndThrowError } from '@hub3js/std/operators'; @@ -42,28 +37,14 @@ const getAllowance = builders .action(actions.getAllowance(evmMathWallet)) .build(); -const getTransactionReceipt = builders - .getTransactionReceipt() - .action(actions.getTransactionReceipt(evmMathWallet)) +const evm = new NamespaceBuilder('EVM', WALLET_ID) + .action(viemWalletAdapter(evmMathWallet)) + .action(connect) + .action(disconnect) + .action(canSwitchNetwork) + .action(canEagerConnect) + .action(getChainId) + .action(getAllowance) .build(); -const waitForTransactionReceipt = builders - .waitForTransactionReceipt() - .action(actions.waitForTransactionReceipt(evmMathWallet)) - .build(); - -const buildEvm = (rpcUrl: string) => - new NamespaceBuilder('EVM', WALLET_ID) - .action(connect) - .action(disconnect) - .action(canSwitchNetwork) - .action(canEagerConnect) - .action(getChainId) - .action(getAllowance) - .action(getTransactionReceipt) - .action(waitForTransactionReceipt) - .action(viemWalletAdapter(evmMathWallet)) - .action(viemPublicAdapter(rpcUrl)) - .build(); - -export { buildEvm }; +export { evm }; diff --git a/wallets/provider-math-wallet/src/provider.ts b/wallets/provider-math-wallet/src/provider.ts index 9049fb9f0e..3fd4397ec6 100644 --- a/wallets/provider-math-wallet/src/provider.ts +++ b/wallets/provider-math-wallet/src/provider.ts @@ -7,15 +7,12 @@ import { metadata, WALLET_ID, } from './constants.js'; -import { buildEvm } from './namespaces/evm.js'; +import { evm } from './namespaces/evm.js'; import { solana } from './namespaces/solana.js'; import { mathWallet } from './utils.js'; -const buildProvider = (rpcURLs: NamespacesRPCUrls) => { - if (!rpcURLs?.evm) { - throw new Error('An RPC URL for the EVM namespace is required.'); - } - +// RPC URLs are accepted for every namespace, so any of them can start using one. +const buildProvider = (_rpcURLs: NamespacesRPCUrls) => { return new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); @@ -29,7 +26,7 @@ const buildProvider = (rpcURLs: NamespacesRPCUrls) => { }) .config('metadata', metadata) .add('solana', solana) - .add('evm', buildEvm(rpcURLs.evm)) + .add('evm', evm) .build(); }; diff --git a/wallets/provider-metamask/src/namespaces/evm.ts b/wallets/provider-metamask/src/namespaces/evm.ts index de068af637..f447ff5a98 100644 --- a/wallets/provider-metamask/src/namespaces/evm.ts +++ b/wallets/provider-metamask/src/namespaces/evm.ts @@ -1,13 +1,7 @@ import type { EvmActions } from '@hub3js/evm'; import { ActionBuilder, NamespaceBuilder } from '@hub3js/core'; -import { - actions, - builders, - utils, - viemPublicAdapter, - viemWalletAdapter, -} from '@hub3js/evm'; +import { actions, builders, utils, viemWalletAdapter } from '@hub3js/evm'; import * as commonBuilders from '@hub3js/std/builders'; import { connectAndUpdateStateForMultiNetworks, @@ -77,28 +71,14 @@ const getAllowance = builders .action(actions.getAllowance(evmMetamask)) .build(); -const getTransactionReceipt = builders - .getTransactionReceipt() - .action(actions.getTransactionReceipt(evmMetamask)) - .build(); - -const waitForTransactionReceipt = builders - .waitForTransactionReceipt() - .action(actions.waitForTransactionReceipt(evmMetamask)) +const evm = new NamespaceBuilder('EVM', WALLET_ID) + .action(viemWalletAdapter(evmMetamask)) + .action(connect) + .action(disconnect) + .action(canSwitchNetwork) + .action(canEagerConnect) + .action(getChainId) + .action(getAllowance) .build(); -const buildEvm = (rpcUrl: string) => - new NamespaceBuilder('EVM', WALLET_ID) - .action(connect) - .action(disconnect) - .action(canSwitchNetwork) - .action(canEagerConnect) - .action(getChainId) - .action(getAllowance) - .action(getTransactionReceipt) - .action(waitForTransactionReceipt) - .action(viemWalletAdapter(evmMetamask)) - .action(viemPublicAdapter(rpcUrl)) - .build(); - -export { buildEvm }; +export { evm }; diff --git a/wallets/provider-metamask/src/provider.ts b/wallets/provider-metamask/src/provider.ts index 8238579c30..20ee345115 100644 --- a/wallets/provider-metamask/src/provider.ts +++ b/wallets/provider-metamask/src/provider.ts @@ -3,15 +3,12 @@ import type { NamespacesRPCUrls } from '@hub3js/namespaces'; import { ProviderBuilder } from '@hub3js/core'; import { metadata, WALLET_ID } from './constants.js'; -import { buildEvm } from './namespaces/evm.js'; +import { evm } from './namespaces/evm.js'; import { solana } from './namespaces/solana.js'; import { metamask as metamask } from './utils.js'; -const buildProvider = (rpcURLs: NamespacesRPCUrls) => { - if (!rpcURLs?.evm) { - throw new Error('An RPC URL for the EVM namespace is required.'); - } - +// RPC URLs are accepted for every namespace, so any of them can start using one. +const buildProvider = (_rpcURLs: NamespacesRPCUrls) => { return new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); @@ -22,7 +19,7 @@ const buildProvider = (rpcURLs: NamespacesRPCUrls) => { } }) .config('metadata', metadata) - .add('evm', buildEvm(rpcURLs.evm)) + .add('evm', evm) .add('solana', solana) .build(); }; diff --git a/wallets/provider-okx/src/namespaces/evm.ts b/wallets/provider-okx/src/namespaces/evm.ts index 67436561d7..5ce3d56824 100644 --- a/wallets/provider-okx/src/namespaces/evm.ts +++ b/wallets/provider-okx/src/namespaces/evm.ts @@ -1,13 +1,7 @@ import type { EvmActions } from '@hub3js/evm'; import { NamespaceBuilder } from '@hub3js/core'; -import { - actions, - builders, - utils, - viemPublicAdapter, - viemWalletAdapter, -} from '@hub3js/evm'; +import { actions, builders, utils, viemWalletAdapter } from '@hub3js/evm'; import * as commonBuilders from '@hub3js/std/builders'; import { standardizeAndThrowError } from '@hub3js/std/operators'; @@ -67,28 +61,14 @@ const getAllowance = builders .action(actions.getAllowance(evmOKX)) .build(); -const getTransactionReceipt = builders - .getTransactionReceipt() - .action(actions.getTransactionReceipt(evmOKX)) +const evm = new NamespaceBuilder('EVM', WALLET_ID) + .action(viemWalletAdapter(evmOKX)) + .action(connect) + .action(disconnect) + .action(canEagerConnect) + .action(canSwitchNetwork) + .action(getChainId) + .action(getAllowance) .build(); -const waitForTransactionReceipt = builders - .waitForTransactionReceipt() - .action(actions.waitForTransactionReceipt(evmOKX)) - .build(); - -const buildEvm = (rpcUrl: string) => - new NamespaceBuilder('EVM', WALLET_ID) - .action(connect) - .action(disconnect) - .action(canEagerConnect) - .action(canSwitchNetwork) - .action(getChainId) - .action(getAllowance) - .action(getTransactionReceipt) - .action(waitForTransactionReceipt) - .action(viemWalletAdapter(evmOKX)) - .action(viemPublicAdapter(rpcUrl)) - .build(); - -export { buildEvm }; +export { evm }; diff --git a/wallets/provider-okx/src/provider.ts b/wallets/provider-okx/src/provider.ts index b7fa2ff605..1919c67887 100644 --- a/wallets/provider-okx/src/provider.ts +++ b/wallets/provider-okx/src/provider.ts @@ -4,7 +4,7 @@ import type { NamespacesRPCUrls } from '@hub3js/namespaces'; import { ProviderBuilder } from '@hub3js/core'; import { metadata, WALLET_ID } from './constants.js'; -import { buildEvm } from './namespaces/evm.js'; +import { evm } from './namespaces/evm.js'; import { solana } from './namespaces/solana.js'; import { sui } from './namespaces/sui.js'; import { ton } from './namespaces/ton/ton.js'; @@ -13,11 +13,8 @@ import { tron } from './namespaces/tron.js'; import { utxo } from './namespaces/utxo.js'; import { okx as okxInstance } from './utils.js'; -const buildProvider = (rpcURLs: NamespacesRPCUrls) => { - if (!rpcURLs?.evm) { - throw new Error('An RPC URL for the EVM namespace is required.'); - } - +// RPC URLs are accepted for every namespace, so any of them can start using one. +const buildProvider = (_rpcURLs: NamespacesRPCUrls) => { return new ProviderBuilder(WALLET_ID) .init(function (context, environments?: Environments) { setEnvironments(environments); @@ -30,7 +27,7 @@ const buildProvider = (rpcURLs: NamespacesRPCUrls) => { }) .config('metadata', metadata) .add('solana', solana) - .add('evm', buildEvm(rpcURLs.evm)) + .add('evm', evm) .add('utxo', utxo) .add('ton', ton) .add('tron', tron) diff --git a/wallets/provider-phantom/src/namespaces/evm.ts b/wallets/provider-phantom/src/namespaces/evm.ts index 195493a99f..ff60114310 100644 --- a/wallets/provider-phantom/src/namespaces/evm.ts +++ b/wallets/provider-phantom/src/namespaces/evm.ts @@ -1,13 +1,7 @@ import type { EvmActions } from '@hub3js/evm'; import { NamespaceBuilder } from '@hub3js/core'; -import { - actions, - builders, - hooks, - viemPublicAdapter, - viemWalletAdapter, -} from '@hub3js/evm'; +import { actions, builders, hooks, viemWalletAdapter } from '@hub3js/evm'; import * as commonBuilders from '@hub3js/std/builders'; import { standardizeAndThrowError } from '@hub3js/std/operators'; @@ -56,28 +50,14 @@ const getAllowance = builders .action(actions.getAllowance(evmPhantom)) .build(); -const getTransactionReceipt = builders - .getTransactionReceipt() - .action(actions.getTransactionReceipt(evmPhantom)) +const evm = new NamespaceBuilder('EVM', WALLET_ID) + .action(viemWalletAdapter(evmPhantom)) + .action(connect) + .action(disconnect) + .action(canEagerConnect) + .action(canSwitchNetwork) + .action(getChainId) + .action(getAllowance) .build(); -const waitForTransactionReceipt = builders - .waitForTransactionReceipt() - .action(actions.waitForTransactionReceipt(evmPhantom)) - .build(); - -const buildEvm = (rpcUrl: string) => - new NamespaceBuilder('EVM', WALLET_ID) - .action(connect) - .action(disconnect) - .action(canEagerConnect) - .action(canSwitchNetwork) - .action(getChainId) - .action(getAllowance) - .action(getTransactionReceipt) - .action(waitForTransactionReceipt) - .action(viemWalletAdapter(evmPhantom)) - .action(viemPublicAdapter(rpcUrl)) - .build(); - -export { buildEvm }; +export { evm }; diff --git a/wallets/provider-phantom/src/provider.ts b/wallets/provider-phantom/src/provider.ts index f401885d3a..7522efa7e3 100644 --- a/wallets/provider-phantom/src/provider.ts +++ b/wallets/provider-phantom/src/provider.ts @@ -3,15 +3,12 @@ import type { NamespacesRPCUrls } from '@hub3js/namespaces'; import { ProviderBuilder } from '@hub3js/core'; import { metadata, WALLET_ID } from './constants.js'; -import { buildEvm } from './namespaces/evm.js'; +import { evm } from './namespaces/evm.js'; import { solana } from './namespaces/solana.js'; import { phantom as phantomInstance } from './utils.js'; -const buildProvider = (rpcURLs: NamespacesRPCUrls) => { - if (!rpcURLs?.evm) { - throw new Error('An RPC URL for the EVM namespace is required.'); - } - +// RPC URLs are accepted for every namespace, so any of them can start using one. +const buildProvider = (_rpcURLs: NamespacesRPCUrls) => { return new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); @@ -23,7 +20,7 @@ const buildProvider = (rpcURLs: NamespacesRPCUrls) => { }) .config('metadata', metadata) .add('solana', solana) - .add('evm', buildEvm(rpcURLs.evm)) + .add('evm', evm) .build(); }; diff --git a/wallets/provider-rabby/src/namespaces/evm.ts b/wallets/provider-rabby/src/namespaces/evm.ts index aac3fe9442..8084a1ec1c 100644 --- a/wallets/provider-rabby/src/namespaces/evm.ts +++ b/wallets/provider-rabby/src/namespaces/evm.ts @@ -1,13 +1,7 @@ import type { EvmActions } from '@hub3js/evm'; import { NamespaceBuilder } from '@hub3js/core'; -import { - actions, - builders, - hooks, - viemPublicAdapter, - viemWalletAdapter, -} from '@hub3js/evm'; +import { actions, builders, hooks, viemWalletAdapter } from '@hub3js/evm'; import * as commonBuilders from '@hub3js/std/builders'; import { standardizeAndThrowError } from '@hub3js/std/operators'; @@ -50,28 +44,14 @@ const getAllowance = builders .action(actions.getAllowance(evmRabby)) .build(); -const getTransactionReceipt = builders - .getTransactionReceipt() - .action(actions.getTransactionReceipt(evmRabby)) +const evm = new NamespaceBuilder('EVM', WALLET_ID) + .action(viemWalletAdapter(evmRabby)) + .action(connect) + .action(disconnect) + .action(canEagerConnect) + .action(canSwitchNetwork) + .action(getChainId) + .action(getAllowance) .build(); -const waitForTransactionReceipt = builders - .waitForTransactionReceipt() - .action(actions.waitForTransactionReceipt(evmRabby)) - .build(); - -const buildEvm = (rpcUrl: string) => - new NamespaceBuilder('EVM', WALLET_ID) - .action(connect) - .action(disconnect) - .action(canEagerConnect) - .action(canSwitchNetwork) - .action(getChainId) - .action(getAllowance) - .action(getTransactionReceipt) - .action(waitForTransactionReceipt) - .action(viemWalletAdapter(evmRabby)) - .action(viemPublicAdapter(rpcUrl)) - .build(); - -export { buildEvm }; +export { evm }; diff --git a/wallets/provider-rabby/src/provider.ts b/wallets/provider-rabby/src/provider.ts index 1892ac31dd..4f27314f9b 100644 --- a/wallets/provider-rabby/src/provider.ts +++ b/wallets/provider-rabby/src/provider.ts @@ -3,14 +3,11 @@ import type { NamespacesRPCUrls } from '@hub3js/namespaces'; import { ProviderBuilder } from '@hub3js/core'; import { metadata, WALLET_ID } from './constants.js'; -import { buildEvm } from './namespaces/evm.js'; +import { evm } from './namespaces/evm.js'; import { rabby as rabbyInstance } from './utils.js'; -const buildProvider = (rpcURLs: NamespacesRPCUrls) => { - if (!rpcURLs?.evm) { - throw new Error('An RPC URL for the EVM namespace is required.'); - } - +// RPC URLs are accepted for every namespace, so any of them can start using one. +const buildProvider = (_rpcURLs: NamespacesRPCUrls) => { return new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); @@ -20,7 +17,7 @@ const buildProvider = (rpcURLs: NamespacesRPCUrls) => { } }) .config('metadata', metadata) - .add('evm', buildEvm(rpcURLs.evm)) + .add('evm', evm) .build(); }; diff --git a/wallets/provider-safe/src/namespaces/evm.ts b/wallets/provider-safe/src/namespaces/evm.ts index a266c482d9..6020532de1 100644 --- a/wallets/provider-safe/src/namespaces/evm.ts +++ b/wallets/provider-safe/src/namespaces/evm.ts @@ -3,13 +3,7 @@ import type { EvmActions } from '@hub3js/evm'; import type { OffChainSignMessageResponse } from '@safe-global/safe-apps-sdk'; import { NamespaceBuilder } from '@hub3js/core'; -import { - actions, - builders, - hooks, - viemPublicAdapter, - viemWalletAdapter, -} from '@hub3js/evm'; +import { actions, builders, hooks, viemWalletAdapter } from '@hub3js/evm'; import * as commonBuilders from '@hub3js/std/builders'; import { standardizeAndThrowError } from '@hub3js/std/operators'; @@ -54,16 +48,6 @@ const getAllowance = builders .action(actions.getAllowance(evmSafe)) .build(); -const getTransactionReceipt = builders - .getTransactionReceipt() - .action(actions.getTransactionReceipt(evmSafe)) - .build(); - -const waitForTransactionReceipt = builders - .waitForTransactionReceipt() - .action(actions.waitForTransactionReceipt(evmSafe)) - .build(); - // Safe signs messages off-chain through its SDK. const signMessage: FunctionWithContext< EvmActions['signMessage'], @@ -92,20 +76,16 @@ const resolveTransactionHashAction = (async ( Context >; -const buildEvm = (rpcUrl: string) => - new NamespaceBuilder('EVM', WALLET_ID) - .action(connect) - .action(disconnect) - .action(canEagerConnect) - .action(canSwitchNetwork) - .action(getChainId) - .action(getAllowance) - .action(getTransactionReceipt) - .action(waitForTransactionReceipt) - .action(viemWalletAdapter(evmSafe)) - .action(viemPublicAdapter(rpcUrl)) - .action('signMessage', signMessage) - .action(RESOLVE_TRANSACTION_HASH, resolveTransactionHashAction) - .build(); +const evm = new NamespaceBuilder('EVM', WALLET_ID) + .action(viemWalletAdapter(evmSafe)) + .action(connect) + .action(disconnect) + .action(canEagerConnect) + .action(canSwitchNetwork) + .action(getChainId) + .action(getAllowance) + .action('signMessage', signMessage) + .action(RESOLVE_TRANSACTION_HASH, resolveTransactionHashAction) + .build(); -export { buildEvm }; +export { evm }; diff --git a/wallets/provider-safe/src/provider.ts b/wallets/provider-safe/src/provider.ts index d3d68ab20d..0a7516854d 100644 --- a/wallets/provider-safe/src/provider.ts +++ b/wallets/provider-safe/src/provider.ts @@ -3,14 +3,11 @@ import type { NamespacesRPCUrls } from '@hub3js/namespaces'; import { ProviderBuilder } from '@hub3js/core'; import { metadata, WALLET_ID } from './constants.js'; -import { buildEvm } from './namespaces/evm.js'; +import { evm } from './namespaces/evm.js'; import { initSafe } from './safe.js'; -const buildProvider = (rpcURLs: NamespacesRPCUrls) => { - if (!rpcURLs?.evm) { - throw new Error('An RPC URL for the EVM namespace is required.'); - } - +// RPC URLs are accepted for every namespace, so any of them can start using one. +const buildProvider = (_rpcURLs: NamespacesRPCUrls) => { return new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); @@ -30,7 +27,7 @@ const buildProvider = (rpcURLs: NamespacesRPCUrls) => { void detectSafe(); }) .config('metadata', metadata) - .add('evm', buildEvm(rpcURLs.evm)) + .add('evm', evm) .build(); }; diff --git a/wallets/provider-safepal/src/namespaces/evm.ts b/wallets/provider-safepal/src/namespaces/evm.ts index c3c37a2982..f8110a67f0 100644 --- a/wallets/provider-safepal/src/namespaces/evm.ts +++ b/wallets/provider-safepal/src/namespaces/evm.ts @@ -1,12 +1,7 @@ import type { EvmActions } from '@hub3js/evm'; import { ActionBuilder, NamespaceBuilder } from '@hub3js/core'; -import { - actions, - builders, - viemPublicAdapter, - viemWalletAdapter, -} from '@hub3js/evm'; +import { actions, builders, viemWalletAdapter } from '@hub3js/evm'; import * as commonBuilders from '@hub3js/std/builders'; import { connectAndUpdateStateForMultiNetworks, @@ -66,27 +61,13 @@ const getAllowance = builders .action(actions.getAllowance(evmSafepal)) .build(); -const getTransactionReceipt = builders - .getTransactionReceipt() - .action(actions.getTransactionReceipt(evmSafepal)) - .build(); - -const waitForTransactionReceipt = builders - .waitForTransactionReceipt() - .action(actions.waitForTransactionReceipt(evmSafepal)) +const evm = new NamespaceBuilder('EVM', WALLET_ID) + .action(viemWalletAdapter(evmSafepal)) + .action(connect) + .action(disconnect) + .action(canSwitchNetwork) + .action(getChainId) + .action(getAllowance) .build(); -const buildEvm = (rpcUrl: string) => - new NamespaceBuilder('EVM', WALLET_ID) - .action(connect) - .action(disconnect) - .action(canSwitchNetwork) - .action(getChainId) - .action(getAllowance) - .action(getTransactionReceipt) - .action(waitForTransactionReceipt) - .action(viemWalletAdapter(evmSafepal)) - .action(viemPublicAdapter(rpcUrl)) - .build(); - -export { buildEvm }; +export { evm }; diff --git a/wallets/provider-safepal/src/provider.ts b/wallets/provider-safepal/src/provider.ts index 3de1c83c56..0f4e7bd57d 100644 --- a/wallets/provider-safepal/src/provider.ts +++ b/wallets/provider-safepal/src/provider.ts @@ -3,15 +3,12 @@ import type { NamespacesRPCUrls } from '@hub3js/namespaces'; import { ProviderBuilder } from '@hub3js/core'; import { metadata, WALLET_ID } from './constants.js'; -import { buildEvm } from './namespaces/evm.js'; +import { evm } from './namespaces/evm.js'; import { safepal as safepalInstance } from './utils.js'; const WAIT_TO_LOAD_INSTANCE_DELAY = 1000; -const buildProvider = (rpcURLs: NamespacesRPCUrls) => { - if (!rpcURLs?.evm) { - throw new Error('An RPC URL for the EVM namespace is required.'); - } - +// RPC URLs are accepted for every namespace, so any of them can start using one. +const buildProvider = (_rpcURLs: NamespacesRPCUrls) => { return new ProviderBuilder(WALLET_ID) .init(function (context) { setTimeout(() => { @@ -24,7 +21,7 @@ const buildProvider = (rpcURLs: NamespacesRPCUrls) => { }) .config('metadata', metadata) - .add('evm', buildEvm(rpcURLs.evm)) + .add('evm', evm) .build(); }; diff --git a/wallets/provider-taho/src/namespaces/evm.ts b/wallets/provider-taho/src/namespaces/evm.ts index 65927820b6..12e0fa219e 100644 --- a/wallets/provider-taho/src/namespaces/evm.ts +++ b/wallets/provider-taho/src/namespaces/evm.ts @@ -1,13 +1,7 @@ import type { EvmActions } from '@hub3js/evm'; import { NamespaceBuilder } from '@hub3js/core'; -import { - actions, - builders, - hooks, - viemPublicAdapter, - viemWalletAdapter, -} from '@hub3js/evm'; +import { actions, builders, hooks, viemWalletAdapter } from '@hub3js/evm'; import * as commonBuilders from '@hub3js/std/builders'; import { standardizeAndThrowError } from '@hub3js/std/operators'; @@ -49,28 +43,14 @@ const getAllowance = builders .action(actions.getAllowance(evmTaho)) .build(); -const getTransactionReceipt = builders - .getTransactionReceipt() - .action(actions.getTransactionReceipt(evmTaho)) +const evm = new NamespaceBuilder('EVM', WALLET_ID) + .action(viemWalletAdapter(evmTaho)) + .action(connect) + .action(disconnect) + .action(canEagerConnect) + .action(canSwitchNetwork) + .action(getChainId) + .action(getAllowance) .build(); -const waitForTransactionReceipt = builders - .waitForTransactionReceipt() - .action(actions.waitForTransactionReceipt(evmTaho)) - .build(); - -const buildEvm = (rpcUrl: string) => - new NamespaceBuilder('EVM', WALLET_ID) - .action(connect) - .action(disconnect) - .action(canEagerConnect) - .action(canSwitchNetwork) - .action(getChainId) - .action(getAllowance) - .action(getTransactionReceipt) - .action(waitForTransactionReceipt) - .action(viemWalletAdapter(evmTaho)) - .action(viemPublicAdapter(rpcUrl)) - .build(); - -export { buildEvm }; +export { evm }; diff --git a/wallets/provider-taho/src/provider.ts b/wallets/provider-taho/src/provider.ts index b4f25a0e56..b8aa06a487 100644 --- a/wallets/provider-taho/src/provider.ts +++ b/wallets/provider-taho/src/provider.ts @@ -3,14 +3,11 @@ import type { NamespacesRPCUrls } from '@hub3js/namespaces'; import { ProviderBuilder } from '@hub3js/core'; import { metadata, WALLET_ID } from './constants.js'; -import { buildEvm } from './namespaces/evm.js'; +import { evm } from './namespaces/evm.js'; import { taho } from './utils.js'; -const buildProvider = (rpcURLs: NamespacesRPCUrls) => { - if (!rpcURLs?.evm) { - throw new Error('An RPC URL for the EVM namespace is required.'); - } - +// RPC URLs are accepted for every namespace, so any of them can start using one. +const buildProvider = (_rpcURLs: NamespacesRPCUrls) => { return new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); @@ -21,7 +18,7 @@ const buildProvider = (rpcURLs: NamespacesRPCUrls) => { } }) .config('metadata', metadata) - .add('evm', buildEvm(rpcURLs.evm)) + .add('evm', evm) .build(); }; diff --git a/wallets/provider-tokenpocket/src/namespaces/evm.ts b/wallets/provider-tokenpocket/src/namespaces/evm.ts index ed1152cc6b..536de4b882 100644 --- a/wallets/provider-tokenpocket/src/namespaces/evm.ts +++ b/wallets/provider-tokenpocket/src/namespaces/evm.ts @@ -1,13 +1,7 @@ import type { EvmActions } from '@hub3js/evm'; import { NamespaceBuilder } from '@hub3js/core'; -import { - actions, - builders, - hooks, - viemPublicAdapter, - viemWalletAdapter, -} from '@hub3js/evm'; +import { actions, builders, hooks, viemWalletAdapter } from '@hub3js/evm'; import * as commonBuilders from '@hub3js/std/builders'; import { standardizeAndThrowError } from '@hub3js/std/operators'; @@ -49,28 +43,14 @@ const getAllowance = builders .action(actions.getAllowance(evmTokenPocket)) .build(); -const getTransactionReceipt = builders - .getTransactionReceipt() - .action(actions.getTransactionReceipt(evmTokenPocket)) +const evm = new NamespaceBuilder('EVM', WALLET_ID) + .action(viemWalletAdapter(evmTokenPocket)) + .action(connect) + .action(disconnect) + .action(canEagerConnect) + .action(canSwitchNetwork) + .action(getChainId) + .action(getAllowance) .build(); -const waitForTransactionReceipt = builders - .waitForTransactionReceipt() - .action(actions.waitForTransactionReceipt(evmTokenPocket)) - .build(); - -const buildEvm = (rpcUrl: string) => - new NamespaceBuilder('EVM', WALLET_ID) - .action(connect) - .action(disconnect) - .action(canEagerConnect) - .action(canSwitchNetwork) - .action(getChainId) - .action(getAllowance) - .action(getTransactionReceipt) - .action(waitForTransactionReceipt) - .action(viemWalletAdapter(evmTokenPocket)) - .action(viemPublicAdapter(rpcUrl)) - .build(); - -export { buildEvm }; +export { evm }; diff --git a/wallets/provider-tokenpocket/src/provider.ts b/wallets/provider-tokenpocket/src/provider.ts index f807d09cc1..61c43ab65b 100644 --- a/wallets/provider-tokenpocket/src/provider.ts +++ b/wallets/provider-tokenpocket/src/provider.ts @@ -3,14 +3,11 @@ import type { NamespacesRPCUrls } from '@hub3js/namespaces'; import { ProviderBuilder } from '@hub3js/core'; import { metadata, WALLET_ID } from './constants.js'; -import { buildEvm } from './namespaces/evm.js'; +import { evm } from './namespaces/evm.js'; import { tokenPocket } from './utils.js'; -const buildProvider = (rpcURLs: NamespacesRPCUrls) => { - if (!rpcURLs?.evm) { - throw new Error('An RPC URL for the EVM namespace is required.'); - } - +// RPC URLs are accepted for every namespace, so any of them can start using one. +const buildProvider = (_rpcURLs: NamespacesRPCUrls) => { return new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); @@ -21,7 +18,7 @@ const buildProvider = (rpcURLs: NamespacesRPCUrls) => { } }) .config('metadata', metadata) - .add('evm', buildEvm(rpcURLs.evm)) + .add('evm', evm) .build(); }; diff --git a/wallets/provider-tomo/src/namespaces/evm.ts b/wallets/provider-tomo/src/namespaces/evm.ts index 903cc9959f..7284765a43 100644 --- a/wallets/provider-tomo/src/namespaces/evm.ts +++ b/wallets/provider-tomo/src/namespaces/evm.ts @@ -1,12 +1,7 @@ import type { EvmActions } from '@hub3js/evm'; import { ActionBuilder, NamespaceBuilder } from '@hub3js/core'; -import { - actions, - builders, - viemPublicAdapter, - viemWalletAdapter, -} from '@hub3js/evm'; +import { actions, builders, viemWalletAdapter } from '@hub3js/evm'; import * as commonBuilders from '@hub3js/std/builders'; import { connectAndUpdateStateForMultiNetworks, @@ -68,28 +63,14 @@ const getAllowance = builders .action(actions.getAllowance(evmTomo)) .build(); -const getTransactionReceipt = builders - .getTransactionReceipt() - .action(actions.getTransactionReceipt(evmTomo)) - .build(); - -const waitForTransactionReceipt = builders - .waitForTransactionReceipt() - .action(actions.waitForTransactionReceipt(evmTomo)) +const evm = new NamespaceBuilder('EVM', WALLET_ID) + .action(viemWalletAdapter(evmTomo)) + .action(connect) + .action(disconnect) + .action(canSwitchNetwork) + .action(canEagerConnect) + .action(getChainId) + .action(getAllowance) .build(); -const buildEvm = (rpcUrl: string) => - new NamespaceBuilder('EVM', WALLET_ID) - .action(connect) - .action(disconnect) - .action(canSwitchNetwork) - .action(canEagerConnect) - .action(getChainId) - .action(getAllowance) - .action(getTransactionReceipt) - .action(waitForTransactionReceipt) - .action(viemWalletAdapter(evmTomo)) - .action(viemPublicAdapter(rpcUrl)) - .build(); - -export { buildEvm }; +export { evm }; diff --git a/wallets/provider-tomo/src/provider.ts b/wallets/provider-tomo/src/provider.ts index 4d70071d08..f1c22eb577 100644 --- a/wallets/provider-tomo/src/provider.ts +++ b/wallets/provider-tomo/src/provider.ts @@ -3,14 +3,11 @@ import type { NamespacesRPCUrls } from '@hub3js/namespaces'; import { ProviderBuilder } from '@hub3js/core'; import { metadata, TOMO_INJECTION_DELAY, WALLET_ID } from './constants.js'; -import { buildEvm } from './namespaces/evm.js'; +import { evm } from './namespaces/evm.js'; import { tomo } from './utils.js'; -const buildProvider = (rpcURLs: NamespacesRPCUrls) => { - if (!rpcURLs?.evm) { - throw new Error('An RPC URL for the EVM namespace is required.'); - } - +// RPC URLs are accepted for every namespace, so any of them can start using one. +const buildProvider = (_rpcURLs: NamespacesRPCUrls) => { return new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); @@ -23,7 +20,7 @@ const buildProvider = (rpcURLs: NamespacesRPCUrls) => { }, TOMO_INJECTION_DELAY); }) .config('metadata', metadata) - .add('evm', buildEvm(rpcURLs.evm)) + .add('evm', evm) .build(); }; diff --git a/wallets/provider-trezor/src/namespaces/evm.ts b/wallets/provider-trezor/src/namespaces/evm.ts index 776cfbe39c..68fabe154f 100644 --- a/wallets/provider-trezor/src/namespaces/evm.ts +++ b/wallets/provider-trezor/src/namespaces/evm.ts @@ -2,12 +2,7 @@ import type { Context } from '@hub3js/core'; import type { AllowanceParams, EvmActions } from '@hub3js/evm'; import { Hub3Error, NamespaceBuilder } from '@hub3js/core'; -import { - builders, - utils, - viemPublicActions, - viemPublicAdapter, -} from '@hub3js/evm'; +import { builders, utils, viemPublicAdapter } from '@hub3js/evm'; import * as commonBuilders from '@hub3js/std/builders'; import { standardizeAndThrowError } from '@hub3js/std/operators'; @@ -92,20 +87,14 @@ const getAllowance = builders ) .build(); -const buildEvm = (rpcUrl: string) => +const buildEvm = (rpcUrls: string[]) => new NamespaceBuilder('EVM', WALLET_ID) + // No wallet RPC, so viem's public actions go to our RPC endpoints. + .action(viemPublicAdapter(rpcUrls)) .action(connect) .action(disconnect) .action(getChainId) .action(getAllowance) - // Every public action except the receipt ones, which are picked below. - .action(viemPublicAdapter(rpcUrl)) - .action( - viemPublicActions(rpcUrl, [ - 'getTransactionReceipt', - 'waitForTransactionReceipt', - ]) - ) // Signed on the device, see `signers/ethereum.ts`. .action('sendTransaction', sendTransaction) .action('signMessage', signMessage) diff --git a/wallets/provider-trustwallet/src/namespaces/evm.ts b/wallets/provider-trustwallet/src/namespaces/evm.ts index 421b1eae5b..23f30a7616 100644 --- a/wallets/provider-trustwallet/src/namespaces/evm.ts +++ b/wallets/provider-trustwallet/src/namespaces/evm.ts @@ -1,13 +1,7 @@ import type { EvmActions } from '@hub3js/evm'; import { NamespaceBuilder } from '@hub3js/core'; -import { - actions, - builders, - hooks, - viemPublicAdapter, - viemWalletAdapter, -} from '@hub3js/evm'; +import { actions, builders, hooks, viemWalletAdapter } from '@hub3js/evm'; import * as commonBuilders from '@hub3js/std/builders'; import { standardizeAndThrowError } from '@hub3js/std/operators'; @@ -47,27 +41,13 @@ const getAllowance = builders .action(actions.getAllowance(evmTrustWallet)) .build(); -const getTransactionReceipt = builders - .getTransactionReceipt() - .action(actions.getTransactionReceipt(evmTrustWallet)) +const evm = new NamespaceBuilder('EVM', WALLET_ID) + .action(viemWalletAdapter(evmTrustWallet)) + .action(connect) + .action(disconnect) + .action(canSwitchNetwork) + .action(getChainId) + .action(getAllowance) .build(); -const waitForTransactionReceipt = builders - .waitForTransactionReceipt() - .action(actions.waitForTransactionReceipt(evmTrustWallet)) - .build(); - -const buildEvm = (rpcUrl: string) => - new NamespaceBuilder('EVM', WALLET_ID) - .action(connect) - .action(disconnect) - .action(canSwitchNetwork) - .action(getChainId) - .action(getAllowance) - .action(getTransactionReceipt) - .action(waitForTransactionReceipt) - .action(viemWalletAdapter(evmTrustWallet)) - .action(viemPublicAdapter(rpcUrl)) - .build(); - -export { buildEvm }; +export { evm }; diff --git a/wallets/provider-trustwallet/src/provider.ts b/wallets/provider-trustwallet/src/provider.ts index f23939f1fd..8816f38681 100644 --- a/wallets/provider-trustwallet/src/provider.ts +++ b/wallets/provider-trustwallet/src/provider.ts @@ -3,15 +3,12 @@ import type { NamespacesRPCUrls } from '@hub3js/namespaces'; import { ProviderBuilder } from '@hub3js/core'; import { metadata, WALLET_ID } from './constants.js'; -import { buildEvm } from './namespaces/evm.js'; +import { evm } from './namespaces/evm.js'; import { solana } from './namespaces/solana.js'; import { trustWallet as trustwalletInstance } from './utils.js'; -const buildProvider = (rpcURLs: NamespacesRPCUrls) => { - if (!rpcURLs?.evm) { - throw new Error('An RPC URL for the EVM namespace is required.'); - } - +// RPC URLs are accepted for every namespace, so any of them can start using one. +const buildProvider = (_rpcURLs: NamespacesRPCUrls) => { return new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); @@ -22,7 +19,7 @@ const buildProvider = (rpcURLs: NamespacesRPCUrls) => { } }) .config('metadata', metadata) - .add('evm', buildEvm(rpcURLs.evm)) + .add('evm', evm) .add('solana', solana) .build(); }; diff --git a/wallets/provider-walletconnect-2/src/namespaces/evm/namespace.ts b/wallets/provider-walletconnect-2/src/namespaces/evm/namespace.ts index 3b8d90bff7..4d505e2df3 100644 --- a/wallets/provider-walletconnect-2/src/namespaces/evm/namespace.ts +++ b/wallets/provider-walletconnect-2/src/namespaces/evm/namespace.ts @@ -2,13 +2,7 @@ import type { Context } from '@hub3js/core'; import type { AllowanceParams, EvmActions } from '@hub3js/evm'; import { getErrorMessage, Hub3Error, NamespaceBuilder } from '@hub3js/core'; -import { - actions, - builders, - utils, - viemPublicAdapter, - viemWalletAdapter, -} from '@hub3js/evm'; +import { actions, builders, utils, viemWalletAdapter } from '@hub3js/evm'; import * as commonBuilders from '@hub3js/std/builders'; import { standardizeAndThrowError } from '@hub3js/std/operators'; @@ -130,28 +124,14 @@ const getAllowance = builders const getEip1193Provider = () => getAdapter().getEip1193Provider(); -const getTransactionReceipt = builders - .getTransactionReceipt() - .action(actions.getTransactionReceipt(getEip1193Provider)) - .build(); - -const waitForTransactionReceipt = builders - .waitForTransactionReceipt() - .action(actions.waitForTransactionReceipt(getEip1193Provider)) +const evm = new NamespaceBuilder('EVM', WALLET_ID) + .action(viemWalletAdapter(getEip1193Provider)) + .action(connect) + .action(canEagerConnect) + .action(canSwitchNetwork) + .action(disconnect) + .action(getChainId) + .action(getAllowance) .build(); -const buildEvm = (rpcUrl: string) => - new NamespaceBuilder('EVM', WALLET_ID) - .action(connect) - .action(canEagerConnect) - .action(canSwitchNetwork) - .action(disconnect) - .action(getChainId) - .action(getAllowance) - .action(getTransactionReceipt) - .action(waitForTransactionReceipt) - .action(viemWalletAdapter(getEip1193Provider)) - .action(viemPublicAdapter(rpcUrl)) - .build(); - -export { buildEvm }; +export { evm }; diff --git a/wallets/provider-walletconnect-2/src/provider.ts b/wallets/provider-walletconnect-2/src/provider.ts index 986be89045..7f175afae3 100644 --- a/wallets/provider-walletconnect-2/src/provider.ts +++ b/wallets/provider-walletconnect-2/src/provider.ts @@ -6,13 +6,10 @@ import { ProviderBuilder } from '@hub3js/core'; import { WalletConnectAdapter } from './adapter/adapter.js'; import { setAdapter } from './adapter/registry.js'; import { metadata, WALLET_ID } from './constants.js'; -import { buildEvm } from './namespaces/evm/namespace.js'; - -const buildProvider = (rpcURLs: NamespacesRPCUrls) => { - if (!rpcURLs?.evm) { - throw new Error('An RPC URL for the EVM namespace is required.'); - } +import { evm } from './namespaces/evm/namespace.js'; +// RPC URLs are accepted for every namespace, so any of them can start using one. +const buildProvider = (_rpcURLs: NamespacesRPCUrls) => { return new ProviderBuilder(WALLET_ID) .init(function (context, environments: Environments) { const [, setState] = context.state(); @@ -34,7 +31,7 @@ const buildProvider = (rpcURLs: NamespacesRPCUrls) => { console.debug('[wallet-connect-2] provider initialized.', context); }) .config('metadata', metadata) - .add('evm', buildEvm(rpcURLs.evm)) + .add('evm', evm) .build(); }; diff --git a/wallets/react/src/hub/useHubAdapter.ts b/wallets/react/src/hub/useHubAdapter.ts index 655e904b7d..b928a12aff 100644 --- a/wallets/react/src/hub/useHubAdapter.ts +++ b/wallets/react/src/hub/useHubAdapter.ts @@ -34,7 +34,6 @@ import { LastConnectedWalletsFromStorage } from './lastConnectedWallets.js'; import { useAutoConnect } from './useAutoConnect.js'; import { useHubRefs } from './useHubRefs.js'; import { - findProviderByType, isEvmNamespace, isSolanaNamespace, isUtxoNamespace, @@ -562,7 +561,12 @@ export function useHubAdapter(params: UseAdapterParams): ProviderContext { ); }, hubProvider(type) { - const provider = findProviderByType(params.providers, type); + /* + * Return the instance registered in the hub, which holds the store. A + * provider list can be rebuilt with the same ids, and the hub keeps the + * instances it registered first, so a rebuilt one would have no store. + */ + const provider = getHub().get(type); if (!provider) { throw new Error( From 30b6656b9dcc20f2c140fa4c99af69fabf4f63b8 Mon Sep 17 00:00:00 2001 From: arlert-armin Date: Mon, 19 Oct 2026 13:45:03 +0000 Subject: [PATCH 12/29] chore: adopt the hub3 evm build with explicit viem action params Pin @hub3js/evm and @hub3js/namespaces to 0.0.0-experimental-9a7dcf8b-20261019. Ledger Wallet reads what its provider doesn't serve, e.g. transaction receipts, from the public RPC. --- .../rango-preset/src/actions/common/evm.ts | 3 +- .../src/namespaces/evm.ts | 70 ++++++++++++++++--- .../provider-ledger-wallet/src/provider.ts | 11 +-- 3 files changed, 68 insertions(+), 16 deletions(-) diff --git a/queue-manager/rango-preset/src/actions/common/evm.ts b/queue-manager/rango-preset/src/actions/common/evm.ts index 3d81ad474a..2ae5908f99 100644 --- a/queue-manager/rango-preset/src/actions/common/evm.ts +++ b/queue-manager/rango-preset/src/actions/common/evm.ts @@ -123,7 +123,8 @@ export function toEvmTransactionRequest( request.gasPrice = BigInt(tx.gasPrice); } - return request; + // Built loosely because viem types each fee scheme as its own variant. + return request as SendTransactionParameters; } function getActiveAddress(namespace: EvmNamespace): string | undefined { diff --git a/wallets/provider-ledger-wallet/src/namespaces/evm.ts b/wallets/provider-ledger-wallet/src/namespaces/evm.ts index b224141353..36c8bf548e 100644 --- a/wallets/provider-ledger-wallet/src/namespaces/evm.ts +++ b/wallets/provider-ledger-wallet/src/namespaces/evm.ts @@ -2,7 +2,13 @@ import type { Context } from '@hub3js/core'; import type { Chain, ChainId, EvmActions } from '@hub3js/evm'; import { NamespaceBuilder } from '@hub3js/core'; -import { actions, builders, utils, viemWalletAdapter } from '@hub3js/evm'; +import { + actions, + builders, + utils, + viemPublicAdapter, + viemWalletAdapter, +} from '@hub3js/evm'; import * as commonBuilders from '@hub3js/std/builders'; import { standardizeAndThrowError } from '@hub3js/std/operators'; @@ -101,14 +107,56 @@ const getAllowance = builders .action(actions.getAllowance(getProvider)) .build(); -const evm = new NamespaceBuilder('EVM', WALLET_ID) - .action(viemWalletAdapter(getProvider)) - .action(connect) - .action(disconnect) - .action(canEagerConnect) - .action(canSwitchNetwork) - .action(getChainId) - .action(getAllowance) - .build(); +/* + * viem's public actions that only use the reads the Ledger provider forwards + * to its node: `eth_blockNumber`, `eth_getBalance`, `eth_getCode`, + * `eth_estimateGas` and `eth_call`. It rejects every other read, e.g. + * `eth_getTransactionReceipt`, with 4200 (unsupported method). + * + * Ledger's list (`BROADCASTED_TO_NODE_RPC_METHODS`), as of the latest release + * (`@ledgerhq/ledger-wallet-provider` 2.0.2): + * https://github.com/LedgerHQ/ledger-button-public/blob/cc33f953aa/packages/ledger-wallet-provider-evm/src/utils/supportedRpcMethods.ts + * `eth_getTransactionReceipt` is added on their develop branch, so the receipt + * actions can move here once it's released. + */ +const LEDGER_PUBLIC_ACTIONS: ReadonlyArray = [ + 'getBalance', + 'getBlockNumber', + 'getCode', + 'getBytecode', + 'estimateGas', + 'estimateContractGas', + 'call', + 'readContract', + 'simulateContract', +]; + +const buildEvm = (rpcUrls: string[]) => { + const publicActions = viemPublicAdapter(rpcUrls); + const publicActionNames = new Set(publicActions.map(([name]) => name)); + + return ( + new NamespaceBuilder('EVM', WALLET_ID) + // Every public action from our RPC, for the reads Ledger doesn't serve. + .action(publicActions) + /* + * Wallet actions, and the reads Ledger serves, come from the wallet (on + * the chain it's on). Its other reads are left to the actions above. + */ + .action( + viemWalletAdapter(getProvider).filter( + ([name]) => + !publicActionNames.has(name) || LEDGER_PUBLIC_ACTIONS.includes(name) + ) + ) + .action(connect) + .action(disconnect) + .action(canEagerConnect) + .action(canSwitchNetwork) + .action(getChainId) + .action(getAllowance) + .build() + ); +}; -export { evm }; +export { buildEvm }; diff --git a/wallets/provider-ledger-wallet/src/provider.ts b/wallets/provider-ledger-wallet/src/provider.ts index 183eb80c07..dd286d9461 100644 --- a/wallets/provider-ledger-wallet/src/provider.ts +++ b/wallets/provider-ledger-wallet/src/provider.ts @@ -7,12 +7,15 @@ import { ProviderBuilder } from '@hub3js/core'; import { metadata, WALLET_ID } from './constants.js'; import { setProvider } from './ledgerProvider.js'; -import { evm } from './namespaces/evm.js'; +import { buildEvm } from './namespaces/evm.js'; const LEDGER_PROVIDER_NAME = 'Ledger Wallet'; -// RPC URLs are accepted for every namespace, so any of them can start using one. -const buildProvider = (_rpcURLs: NamespacesRPCUrls) => { +const buildProvider = (rpcURLs: NamespacesRPCUrls) => { + if (!rpcURLs?.evm) { + throw new Error('An RPC URL for the EVM namespace is required.'); + } + return new ProviderBuilder(WALLET_ID) .init(function (context, environments: Environments) { const [, setState] = context.state(); @@ -94,7 +97,7 @@ const buildProvider = (_rpcURLs: NamespacesRPCUrls) => { }; }) .config('metadata', metadata) - .add('evm', evm) + .add('evm', buildEvm(rpcURLs.evm)) .build(); }; From 59f31fa77a27a49cea21761b69be2895fb5ed0fa Mon Sep 17 00:00:00 2001 From: arlert-armin Date: Tue, 3 Nov 2026 18:00:36 +0000 Subject: [PATCH 13/29] chore: pin the hub3 evm build with per-chain rpc urls and dedupe viem Pin @hub3js/evm and @hub3js/namespaces to 0.0.0-experimental-1c5b27eb-20261024. In that build, EVM RPC urls are given per viem chain, and viemPublicAdapter reads the current chain's urls on each call. viem is deduped to 2.57.16, and its ox patch moves to the matching version. The namespaces package depends on a caret range of the same experimental build, so the lockfile points that range at it too. --- blockchains/internal-blockchains/package.json | 2 +- ...x+0.14.45.patch => viem++ox+0.14.59.patch} | 0 queue-manager/rango-preset/package.json | 2 +- wallets/provider-all/package.json | 8 +- wallets/provider-binance/package.json | 8 +- wallets/provider-bitget/package.json | 8 +- wallets/provider-braavos/package.json | 4 +- wallets/provider-brave/package.json | 8 +- wallets/provider-coin98/package.json | 8 +- wallets/provider-coinbase/package.json | 8 +- wallets/provider-default/package.json | 8 +- wallets/provider-enkrypt/package.json | 8 +- wallets/provider-exodus/package.json | 8 +- wallets/provider-ledger-wallet/package.json | 4 +- wallets/provider-ledger/package.json | 8 +- wallets/provider-math-wallet/package.json | 8 +- wallets/provider-metamask/package.json | 8 +- wallets/provider-okx/package.json | 8 +- wallets/provider-phantom/package.json | 8 +- wallets/provider-rabby/package.json | 8 +- wallets/provider-ready/package.json | 4 +- wallets/provider-safe/package.json | 4 +- wallets/provider-safepal/package.json | 8 +- wallets/provider-solflare/package.json | 4 +- wallets/provider-taho/package.json | 8 +- wallets/provider-tokenpocket/package.json | 8 +- wallets/provider-tomo/package.json | 8 +- wallets/provider-tonconnect/package.json | 4 +- wallets/provider-trezor/package.json | 4 +- wallets/provider-tron-link/package.json | 4 +- wallets/provider-trustwallet/package.json | 8 +- wallets/provider-unisat/package.json | 4 +- wallets/provider-vultisig/package.json | 4 +- wallets/provider-walletconnect-2/package.json | 4 +- wallets/provider-xverse/package.json | 4 +- wallets/react/package.json | 4 +- widget/embedded/package.json | 4 +- yarn.lock | 139 ++++++++++++++---- 38 files changed, 220 insertions(+), 139 deletions(-) rename patches/{viem++ox+0.14.45.patch => viem++ox+0.14.59.patch} (100%) diff --git a/blockchains/internal-blockchains/package.json b/blockchains/internal-blockchains/package.json index bb3cec877f..4fc034f0b1 100644 --- a/blockchains/internal-blockchains/package.json +++ b/blockchains/internal-blockchains/package.json @@ -29,7 +29,7 @@ }, "dependencies": { "@hub3js/bip122": "^0.4.0", - "@hub3js/evm": "^0.8.0", + "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/solana": "^0.7.0", "@hub3js/starknet": "^0.6.0", "@hub3js/stellar": "^0.6.0", diff --git a/patches/viem++ox+0.14.45.patch b/patches/viem++ox+0.14.59.patch similarity index 100% rename from patches/viem++ox+0.14.45.patch rename to patches/viem++ox+0.14.59.patch diff --git a/queue-manager/rango-preset/package.json b/queue-manager/rango-preset/package.json index 36de0bc06c..97434e242f 100644 --- a/queue-manager/rango-preset/package.json +++ b/queue-manager/rango-preset/package.json @@ -36,7 +36,7 @@ }, "dependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "^0.8.0", + "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/stellar": "^0.6.0", "@hub3js/xrpl": "^0.6.0", "@rango-dev/internal-blockchains": "^0.3.1-next.1", diff --git a/wallets/provider-all/package.json b/wallets/provider-all/package.json index 321840a14d..1b5c53734a 100644 --- a/wallets/provider-all/package.json +++ b/wallets/provider-all/package.json @@ -61,8 +61,8 @@ "devDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/evm": "^0.8.0", - "@hub3js/namespaces": "^0.8.0", + "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/solana": "^0.7.0", "@hub3js/starknet": "^0.6.0", "@hub3js/std": "^0.6.0", @@ -75,8 +75,8 @@ "peerDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/evm": "^0.8.0", - "@hub3js/namespaces": "^0.8.0", + "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/solana": "^0.7.0", "@hub3js/starknet": "^0.6.0", "@hub3js/std": "^0.6.0", diff --git a/wallets/provider-binance/package.json b/wallets/provider-binance/package.json index 9cff373505..44d678deba 100644 --- a/wallets/provider-binance/package.json +++ b/wallets/provider-binance/package.json @@ -26,14 +26,14 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "^0.8.0", - "@hub3js/namespaces": "^0.8.0", + "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "^0.8.0", - "@hub3js/namespaces": "^0.8.0", + "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/std": "^0.6.0" }, "publishConfig": { diff --git a/wallets/provider-bitget/package.json b/wallets/provider-bitget/package.json index d9d77d7dd7..a1a4139107 100644 --- a/wallets/provider-bitget/package.json +++ b/wallets/provider-bitget/package.json @@ -31,16 +31,16 @@ "devDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/evm": "^0.8.0", - "@hub3js/namespaces": "^0.8.0", + "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/std": "^0.6.0", "@hub3js/tron": "^0.3.0" }, "peerDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/evm": "^0.8.0", - "@hub3js/namespaces": "^0.8.0", + "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/std": "^0.6.0", "@hub3js/tron": "^0.3.0" }, diff --git a/wallets/provider-braavos/package.json b/wallets/provider-braavos/package.json index e3164b4802..714360d8f1 100644 --- a/wallets/provider-braavos/package.json +++ b/wallets/provider-braavos/package.json @@ -27,13 +27,13 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "^0.8.0", + "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/starknet": "^0.6.0", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "^0.8.0", + "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/starknet": "^0.6.0", "@hub3js/std": "^0.6.0" }, diff --git a/wallets/provider-brave/package.json b/wallets/provider-brave/package.json index bcb1465108..f6dd6e5b3c 100644 --- a/wallets/provider-brave/package.json +++ b/wallets/provider-brave/package.json @@ -27,15 +27,15 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "^0.8.0", - "@hub3js/namespaces": "^0.8.0", + "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "^0.8.0", - "@hub3js/namespaces": "^0.8.0", + "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, diff --git a/wallets/provider-coin98/package.json b/wallets/provider-coin98/package.json index e24b5129a8..dbf5eca49b 100644 --- a/wallets/provider-coin98/package.json +++ b/wallets/provider-coin98/package.json @@ -29,15 +29,15 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "^0.8.0", - "@hub3js/namespaces": "^0.8.0", + "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "^0.8.0", - "@hub3js/namespaces": "^0.8.0", + "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, diff --git a/wallets/provider-coinbase/package.json b/wallets/provider-coinbase/package.json index ae354ecdf5..8eb66a4b24 100644 --- a/wallets/provider-coinbase/package.json +++ b/wallets/provider-coinbase/package.json @@ -28,15 +28,15 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "^0.8.0", - "@hub3js/namespaces": "^0.8.0", + "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "^0.8.0", - "@hub3js/namespaces": "^0.8.0", + "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, diff --git a/wallets/provider-default/package.json b/wallets/provider-default/package.json index 8d9c634f1a..101dae88e6 100644 --- a/wallets/provider-default/package.json +++ b/wallets/provider-default/package.json @@ -26,14 +26,14 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "^0.8.0", - "@hub3js/namespaces": "^0.8.0", + "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "^0.8.0", - "@hub3js/namespaces": "^0.8.0", + "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/std": "^0.6.0" }, "publishConfig": { diff --git a/wallets/provider-enkrypt/package.json b/wallets/provider-enkrypt/package.json index 3a6286c06d..afffc3123a 100644 --- a/wallets/provider-enkrypt/package.json +++ b/wallets/provider-enkrypt/package.json @@ -26,14 +26,14 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "^0.8.0", - "@hub3js/namespaces": "^0.8.0", + "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "^0.8.0", - "@hub3js/namespaces": "^0.8.0", + "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/std": "^0.6.0" }, "publishConfig": { diff --git a/wallets/provider-exodus/package.json b/wallets/provider-exodus/package.json index 5594f00b3d..6099aa8393 100644 --- a/wallets/provider-exodus/package.json +++ b/wallets/provider-exodus/package.json @@ -28,15 +28,15 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "^0.8.0", - "@hub3js/namespaces": "^0.8.0", + "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "^0.8.0", - "@hub3js/namespaces": "^0.8.0", + "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, diff --git a/wallets/provider-ledger-wallet/package.json b/wallets/provider-ledger-wallet/package.json index 248420c30d..5df289259e 100644 --- a/wallets/provider-ledger-wallet/package.json +++ b/wallets/provider-ledger-wallet/package.json @@ -26,12 +26,12 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "^0.8.0", + "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "^0.8.0", + "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/std": "^0.6.0" }, "publishConfig": { diff --git a/wallets/provider-ledger/package.json b/wallets/provider-ledger/package.json index 08020c8c11..137b961065 100644 --- a/wallets/provider-ledger/package.json +++ b/wallets/provider-ledger/package.json @@ -38,15 +38,15 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "^0.8.0", - "@hub3js/namespaces": "^0.8.0", + "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "^0.8.0", - "@hub3js/namespaces": "^0.8.0", + "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, diff --git a/wallets/provider-math-wallet/package.json b/wallets/provider-math-wallet/package.json index 7aa628dc36..a5913be3c2 100644 --- a/wallets/provider-math-wallet/package.json +++ b/wallets/provider-math-wallet/package.json @@ -27,15 +27,15 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "^0.8.0", - "@hub3js/namespaces": "^0.8.0", + "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "^0.8.0", - "@hub3js/namespaces": "^0.8.0", + "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, diff --git a/wallets/provider-metamask/package.json b/wallets/provider-metamask/package.json index 849a95d488..fb67c91649 100644 --- a/wallets/provider-metamask/package.json +++ b/wallets/provider-metamask/package.json @@ -29,8 +29,8 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "^0.8.0", - "@hub3js/namespaces": "^0.8.0", + "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0", "@solana/wallet-standard-features": "^1.3.0", @@ -39,8 +39,8 @@ }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "^0.8.0", - "@hub3js/namespaces": "^0.8.0", + "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, diff --git a/wallets/provider-okx/package.json b/wallets/provider-okx/package.json index 73e6322c0a..79966cb40f 100644 --- a/wallets/provider-okx/package.json +++ b/wallets/provider-okx/package.json @@ -34,8 +34,8 @@ "devDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/evm": "^0.8.0", - "@hub3js/namespaces": "^0.8.0", + "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0", "@hub3js/sui": "^0.6.0", @@ -45,8 +45,8 @@ "peerDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/evm": "^0.8.0", - "@hub3js/namespaces": "^0.8.0", + "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0", "@hub3js/sui": "^0.6.0", diff --git a/wallets/provider-phantom/package.json b/wallets/provider-phantom/package.json index ba9bd7e855..3dbbafebe0 100644 --- a/wallets/provider-phantom/package.json +++ b/wallets/provider-phantom/package.json @@ -33,16 +33,16 @@ "devDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/evm": "^0.8.0", - "@hub3js/namespaces": "^0.8.0", + "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/evm": "^0.8.0", - "@hub3js/namespaces": "^0.8.0", + "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, diff --git a/wallets/provider-rabby/package.json b/wallets/provider-rabby/package.json index 688585098d..59685e7e0b 100644 --- a/wallets/provider-rabby/package.json +++ b/wallets/provider-rabby/package.json @@ -26,14 +26,14 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "^0.8.0", - "@hub3js/namespaces": "^0.8.0", + "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "^0.8.0", - "@hub3js/namespaces": "^0.8.0", + "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/std": "^0.6.0" }, "publishConfig": { diff --git a/wallets/provider-ready/package.json b/wallets/provider-ready/package.json index b98fedd343..9976c0b6a3 100644 --- a/wallets/provider-ready/package.json +++ b/wallets/provider-ready/package.json @@ -27,13 +27,13 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "^0.8.0", + "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/starknet": "^0.6.0", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "^0.8.0", + "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/starknet": "^0.6.0", "@hub3js/std": "^0.6.0" }, diff --git a/wallets/provider-safe/package.json b/wallets/provider-safe/package.json index c3e1f727ee..a83cf15588 100644 --- a/wallets/provider-safe/package.json +++ b/wallets/provider-safe/package.json @@ -27,12 +27,12 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "^0.8.0", + "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "^0.8.0", + "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/std": "^0.6.0" }, "publishConfig": { diff --git a/wallets/provider-safepal/package.json b/wallets/provider-safepal/package.json index e72730eda8..2c1fb7cc67 100644 --- a/wallets/provider-safepal/package.json +++ b/wallets/provider-safepal/package.json @@ -28,14 +28,14 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "^0.8.0", - "@hub3js/namespaces": "^0.8.0", + "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "^0.8.0", - "@hub3js/namespaces": "^0.8.0", + "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/std": "^0.6.0" }, "publishConfig": { diff --git a/wallets/provider-solflare/package.json b/wallets/provider-solflare/package.json index 4ea4493404..07ef479b5b 100644 --- a/wallets/provider-solflare/package.json +++ b/wallets/provider-solflare/package.json @@ -29,13 +29,13 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "^0.8.0", + "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "^0.8.0", + "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, diff --git a/wallets/provider-taho/package.json b/wallets/provider-taho/package.json index bc6892977f..472168a10f 100644 --- a/wallets/provider-taho/package.json +++ b/wallets/provider-taho/package.json @@ -26,14 +26,14 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "^0.8.0", - "@hub3js/namespaces": "^0.8.0", + "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "^0.8.0", - "@hub3js/namespaces": "^0.8.0", + "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/std": "^0.6.0" }, "publishConfig": { diff --git a/wallets/provider-tokenpocket/package.json b/wallets/provider-tokenpocket/package.json index caca4bf77d..6a30cecfe8 100644 --- a/wallets/provider-tokenpocket/package.json +++ b/wallets/provider-tokenpocket/package.json @@ -26,14 +26,14 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "^0.8.0", - "@hub3js/namespaces": "^0.8.0", + "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "^0.8.0", - "@hub3js/namespaces": "^0.8.0", + "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/std": "^0.6.0" }, "publishConfig": { diff --git a/wallets/provider-tomo/package.json b/wallets/provider-tomo/package.json index 04119de12e..beefdf6d21 100644 --- a/wallets/provider-tomo/package.json +++ b/wallets/provider-tomo/package.json @@ -26,14 +26,14 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "^0.8.0", - "@hub3js/namespaces": "^0.8.0", + "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "^0.8.0", - "@hub3js/namespaces": "^0.8.0", + "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/std": "^0.6.0" }, "publishConfig": { diff --git a/wallets/provider-tonconnect/package.json b/wallets/provider-tonconnect/package.json index 8674c39959..8b3f8b6fd1 100644 --- a/wallets/provider-tonconnect/package.json +++ b/wallets/provider-tonconnect/package.json @@ -30,13 +30,13 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "^0.8.0", + "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/std": "^0.6.0", "@hub3js/tvm": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "^0.8.0", + "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/std": "^0.6.0", "@hub3js/tvm": "^0.6.0" }, diff --git a/wallets/provider-trezor/package.json b/wallets/provider-trezor/package.json index b55895a940..717651ff82 100644 --- a/wallets/provider-trezor/package.json +++ b/wallets/provider-trezor/package.json @@ -33,13 +33,13 @@ "devDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/evm": "^0.8.0", + "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/evm": "^0.8.0", + "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/std": "^0.6.0" }, "publishConfig": { diff --git a/wallets/provider-tron-link/package.json b/wallets/provider-tron-link/package.json index e4960533b7..f088a51c79 100644 --- a/wallets/provider-tron-link/package.json +++ b/wallets/provider-tron-link/package.json @@ -27,13 +27,13 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "^0.8.0", + "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/std": "^0.6.0", "@hub3js/tron": "^0.3.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "^0.8.0", + "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/std": "^0.6.0", "@hub3js/tron": "^0.3.0" }, diff --git a/wallets/provider-trustwallet/package.json b/wallets/provider-trustwallet/package.json index 0804ad1393..a2ca8f1a02 100644 --- a/wallets/provider-trustwallet/package.json +++ b/wallets/provider-trustwallet/package.json @@ -28,15 +28,15 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "^0.8.0", - "@hub3js/namespaces": "^0.8.0", + "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "^0.8.0", - "@hub3js/namespaces": "^0.8.0", + "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, diff --git a/wallets/provider-unisat/package.json b/wallets/provider-unisat/package.json index c35bf6af2c..94184ff5b8 100644 --- a/wallets/provider-unisat/package.json +++ b/wallets/provider-unisat/package.json @@ -30,13 +30,13 @@ "devDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "^0.8.0", + "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "^0.8.0", + "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/std": "^0.6.0" }, "publishConfig": { diff --git a/wallets/provider-vultisig/package.json b/wallets/provider-vultisig/package.json index 5904c40f56..d89fe55f66 100644 --- a/wallets/provider-vultisig/package.json +++ b/wallets/provider-vultisig/package.json @@ -28,13 +28,13 @@ "devDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "^0.8.0", + "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "^0.8.0", + "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/std": "^0.6.0" }, "publishConfig": { diff --git a/wallets/provider-walletconnect-2/package.json b/wallets/provider-walletconnect-2/package.json index 05526aad3a..d3e52d964a 100644 --- a/wallets/provider-walletconnect-2/package.json +++ b/wallets/provider-walletconnect-2/package.json @@ -40,14 +40,14 @@ "devDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/evm": "^0.8.0", + "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/std": "^0.6.0", "@walletconnect/types": "2.23.7" }, "peerDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/evm": "^0.8.0", + "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/std": "^0.6.0" }, "publishConfig": { diff --git a/wallets/provider-xverse/package.json b/wallets/provider-xverse/package.json index 65a635959b..9fba70667b 100644 --- a/wallets/provider-xverse/package.json +++ b/wallets/provider-xverse/package.json @@ -28,13 +28,13 @@ "devDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "^0.8.0", + "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "^0.8.0", + "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/std": "^0.6.0" }, "publishConfig": { diff --git a/wallets/react/package.json b/wallets/react/package.json index aae1688064..e0223b2e96 100644 --- a/wallets/react/package.json +++ b/wallets/react/package.json @@ -33,8 +33,8 @@ "dependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/evm": "^0.8.0", - "@hub3js/namespaces": "^0.8.0", + "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0", "@hub3js/sui": "^0.6.0", diff --git a/widget/embedded/package.json b/widget/embedded/package.json index 7fe96946e2..6de2d48a93 100644 --- a/widget/embedded/package.json +++ b/widget/embedded/package.json @@ -25,8 +25,8 @@ "dependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/evm": "^0.8.0", - "@hub3js/namespaces": "^0.8.0", + "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", "@hub3js/solana": "^0.7.0", "@hub3js/starknet": "^0.6.0", "@hub3js/std": "^0.6.0", diff --git a/yarn.lock b/yarn.lock index d12f362352..7b807588f5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2910,6 +2910,14 @@ resolved "https://registry.yarnpkg.com/@graphql-typed-document-node/core/-/core-3.2.0.tgz#5f3d96ec6b2354ad6d8a28bf216a1d97b5426861" integrity sha512-mB9oAsNCm9aM3/SOv4YtBMqZbYj10R7dkq8byBqxGY/ncFwhf2oQzMV+LCRlWoDSEBJ3COiR1yeDvMtsoOsuFQ== +"@hub3js/bip122@^0.3.0": + version "0.3.0" + resolved "https://registry.yarnpkg.com/@hub3js/bip122/-/bip122-0.3.0.tgz#1158fbd1a791c9073120a6691bdade5f6217ae94" + integrity sha512-PMhpx1XdvwTlU5GABV8/0PUR+3wUDlsaQzHZl4jFmW+ncs9y3YyV2mMYsGEY2mSYZekkBAEirRjiRKtuC6V1IQ== + dependencies: + "@hub3js/std" "^0.5.0" + caip "^1.1.1" + "@hub3js/bip122@^0.4.0": version "0.4.0" resolved "https://registry.yarnpkg.com/@hub3js/bip122/-/bip122-0.4.0.tgz#c5d32e5ed612e881f67116d8e2c3366f6d1ba590" @@ -2927,29 +2935,39 @@ rango-types "^0.6.0" zustand "^4.5.2" -"@hub3js/evm@^0.8.0": - version "0.8.0" - resolved "https://registry.yarnpkg.com/@hub3js/evm/-/evm-0.8.0.tgz#609fb53a75983679bb53c577f05361931407548e" - integrity sha512-QcvCTcd8AMUpSYA6dsJhc8Nw6MyLwOBCoFHSvL4UoBpqi7ICs8z7BkhbPcbmdBb5x3MxdQJ2OfsAjrZvx23bfw== +"@hub3js/evm@0.0.0-experimental-1c5b27eb-20261024", "@hub3js/evm@^0.0.0-experimental-1c5b27eb-20261024": + version "0.0.0-experimental-1c5b27eb-20261024" + resolved "https://registry.yarnpkg.com/@hub3js/evm/-/evm-0.0.0-experimental-1c5b27eb-20261024.tgz#3237f6bb6f7c0344c9c639c4e2a70ff0126d6349" + integrity sha512-a94smFzrghCtHXXJ0ddjHxWH1ZT7cubkGf1JJmQZoP8/QYZzJRmOS5znhLTLNaCLbvTL7Al0yeKvXabVuz9CoA== dependencies: - "@hub3js/std" "^0.6.0" + "@hub3js/std" "^0.5.0" + caip "^1.1.1" + rango-types "^0.6.0" + viem "^2.56.8" + +"@hub3js/namespaces@0.0.0-experimental-1c5b27eb-20261024": + version "0.0.0-experimental-1c5b27eb-20261024" + resolved "https://registry.yarnpkg.com/@hub3js/namespaces/-/namespaces-0.0.0-experimental-1c5b27eb-20261024.tgz#3666d9bdf13736b4274fae4700b07baf4f0b84c9" + integrity sha512-ysIeLRX2MlFbOCHM9r/bvjksBOI1p4Kuupih6xqrnuh/BfD2mL+VT78CfQUO+nnM43TpthlS2KBN8MWk80bh2Q== + dependencies: + "@hub3js/bip122" "^0.3.0" + "@hub3js/evm" "^0.0.0-experimental-1c5b27eb-20261024" + "@hub3js/solana" "^0.6.0" + "@hub3js/starknet" "^0.5.0" + "@hub3js/stellar" "^0.5.0" + "@hub3js/sui" "^0.5.0" + "@hub3js/tron" "^0.2.0" + "@hub3js/tvm" "^0.5.0" + "@hub3js/xrpl" "^0.5.0" + +"@hub3js/solana@^0.6.0": + version "0.6.0" + resolved "https://registry.yarnpkg.com/@hub3js/solana/-/solana-0.6.0.tgz#20c480725db4ddd0c40e24e727d3587e11f37e54" + integrity sha512-kFVmHnvFWL9zdiB/QHpIHJVQ0UGO4cKR+sMFQaCTsycni7ZMwBgvcuRInAtM7ZDwpt823ZRadQgsk7z5uwl0Bg== + dependencies: + "@hub3js/std" "^0.5.0" caip "^1.1.1" rango-types "^0.6.0" - -"@hub3js/namespaces@^0.8.0": - version "0.8.0" - resolved "https://registry.yarnpkg.com/@hub3js/namespaces/-/namespaces-0.8.0.tgz#e4441871203f043d8ed2fe91b710c77ff9d3729b" - integrity sha512-cMXTgRIAeBBnMXlNBoz/BPfD5ouIBa1PCM3g6a5srFFbx0D21pQhGliox/waDCk0sYn6A0B/bMdiOh0w6rrTnA== - dependencies: - "@hub3js/bip122" "^0.4.0" - "@hub3js/evm" "^0.8.0" - "@hub3js/solana" "^0.7.0" - "@hub3js/starknet" "^0.6.0" - "@hub3js/stellar" "^0.6.0" - "@hub3js/sui" "^0.6.0" - "@hub3js/tron" "^0.3.0" - "@hub3js/tvm" "^0.6.0" - "@hub3js/xrpl" "^0.6.0" "@hub3js/solana@^0.7.0": version "0.7.0" @@ -2960,6 +2978,15 @@ caip "^1.1.1" rango-types "^0.6.0" +"@hub3js/starknet@^0.5.0": + version "0.5.0" + resolved "https://registry.yarnpkg.com/@hub3js/starknet/-/starknet-0.5.0.tgz#acb444d9d74871d6a6fbbb1885aa551d8721ee8d" + integrity sha512-CUilSgF57CPD5+Ajf+Gg+cpRmW2VG2pjmYK6NJBSYT5IvTjbnZrfbv/0zosw00AeB1hlzCIzWoSO29Nxl0ztTA== + dependencies: + "@hub3js/std" "^0.5.0" + caip "^1.1.1" + rango-types "^0.6.0" + "@hub3js/starknet@^0.6.0": version "0.6.0" resolved "https://registry.yarnpkg.com/@hub3js/starknet/-/starknet-0.6.0.tgz#57e8c3efbc25101e9ae128bd124850539397f458" @@ -2969,6 +2996,13 @@ caip "^1.1.1" rango-types "^0.6.0" +"@hub3js/std@^0.5.0": + version "0.5.0" + resolved "https://registry.yarnpkg.com/@hub3js/std/-/std-0.5.0.tgz#a9d966917e29f2db8c0f540a785fde74695de184" + integrity sha512-LMYJA04C/hTHfV8CGh9WmW8s9gwK9oWRh5Eosiyl7/T8ORMQX9TOWPbNoVZuS2S78a4Z6XRcrUZs8toI0qqAIw== + dependencies: + caip "^1.1.1" + "@hub3js/std@^0.6.0": version "0.6.0" resolved "https://registry.yarnpkg.com/@hub3js/std/-/std-0.6.0.tgz#ad6e82c52345775260583016b9c6b9ff9e1475ea" @@ -2976,6 +3010,16 @@ dependencies: caip "^1.1.1" +"@hub3js/stellar@^0.5.0": + version "0.5.0" + resolved "https://registry.yarnpkg.com/@hub3js/stellar/-/stellar-0.5.0.tgz#b3e55ca7bad07efff3fb6d6ed961f5cc233b26ae" + integrity sha512-dFTcSsU+WohSnhTOCtPFQ531/stNV79ezXW1FMKSuztah1+9T+FROGFpD9ewF0Hoxf12DHUVGazkSoCsEQ4ZaQ== + dependencies: + "@hub3js/std" "^0.5.0" + "@stellar/stellar-sdk" "^15.0.1" + caip "^1.1.1" + rango-types "^0.6.0" + "@hub3js/stellar@^0.6.0": version "0.6.0" resolved "https://registry.yarnpkg.com/@hub3js/stellar/-/stellar-0.6.0.tgz#7b9253f22579f2d5a5b5e5a7cbf7378bcaf1812e" @@ -2986,6 +3030,16 @@ caip "^1.1.1" rango-types "^0.6.0" +"@hub3js/sui@^0.5.0": + version "0.5.0" + resolved "https://registry.yarnpkg.com/@hub3js/sui/-/sui-0.5.0.tgz#c425a105a55c514097cb494fb3f4d4cff2397f47" + integrity sha512-V+05VN8dbAe3MnsV5DG2IJahP3XugE393bsGaIaxMz9aP6OAif8NCPTdsAqraNnJoJjEsajxP20XPXyEpPG/6w== + dependencies: + "@hub3js/std" "^0.5.0" + "@mysten/wallet-standard" "^0.13.26" + caip "^1.1.1" + rango-types "^0.6.0" + "@hub3js/sui@^0.6.0": version "0.6.0" resolved "https://registry.yarnpkg.com/@hub3js/sui/-/sui-0.6.0.tgz#a15f1d4b1e54e72adb8e7adb68ea90e78cd7e667" @@ -2996,6 +3050,14 @@ caip "^1.1.1" rango-types "^0.6.0" +"@hub3js/tron@^0.2.0": + version "0.2.0" + resolved "https://registry.yarnpkg.com/@hub3js/tron/-/tron-0.2.0.tgz#22bce9ba45fa9e9e8366dc12c4773d3a5d700985" + integrity sha512-qLFqqreoaB/q+lCPjCH+218oe4m4f2Fb2SfVFVTqBJywvASQj6nxzc60XxSjaSXow5wPdmDVVB7+X0+MkKakDw== + dependencies: + "@hub3js/std" "^0.5.0" + caip "^1.1.1" + "@hub3js/tron@^0.3.0": version "0.3.0" resolved "https://registry.yarnpkg.com/@hub3js/tron/-/tron-0.3.0.tgz#6a3331e3bddf489cd2ea171368579209b15a48a9" @@ -3004,6 +3066,15 @@ "@hub3js/std" "^0.6.0" caip "^1.1.1" +"@hub3js/tvm@^0.5.0": + version "0.5.0" + resolved "https://registry.yarnpkg.com/@hub3js/tvm/-/tvm-0.5.0.tgz#95e6f42d41975f79464e31ec42b66a7cc5c85454" + integrity sha512-DYnm41LrPxbMX8mqKhgTAWZkBt7g2CdvmV5wg+u/brkhcoLkF+G36ZN0TP/qGEtoAiohYkP+hm5Jb/NbbTKPNg== + dependencies: + "@hub3js/std" "^0.5.0" + caip "^1.1.1" + rango-types "^0.6.0" + "@hub3js/tvm@^0.6.0": version "0.6.0" resolved "https://registry.yarnpkg.com/@hub3js/tvm/-/tvm-0.6.0.tgz#56a16368b7fccac77302ef035c41d53d97a12dc5" @@ -3013,6 +3084,16 @@ caip "^1.1.1" rango-types "^0.6.0" +"@hub3js/xrpl@^0.5.0": + version "0.5.0" + resolved "https://registry.yarnpkg.com/@hub3js/xrpl/-/xrpl-0.5.0.tgz#42a0d0e19f0b0a37de563a65329a7b179659b066" + integrity sha512-tbthdAufnrOXyvz0I2CyhHRNEGypafavY+aFKXoEk8doQaDlcPhalxQnBnh3p7jcOmQTzhJYkXmc7OlCIH8tVg== + dependencies: + "@hub3js/std" "^0.5.0" + caip "^1.1.1" + rango-types "^0.6.0" + xrpl "^4.2.0" + "@hub3js/xrpl@^0.6.0": version "0.6.0" resolved "https://registry.yarnpkg.com/@hub3js/xrpl/-/xrpl-0.6.0.tgz#a86018d220bf7f1bbf58aedc9471a4a6a5f5f047" @@ -15074,10 +15155,10 @@ own-keys@^1.0.1: object-keys "^1.1.1" safe-push-apply "^1.0.0" -ox@0.14.30: - version "0.14.30" - resolved "https://registry.yarnpkg.com/ox/-/ox-0.14.30.tgz#aee7e72c8f179d8666a7f14e1ae7e28a0fcbea98" - integrity sha512-LI11uu+8iiM1B3CLckgd++YF1a0A2k5wDoM9ZeQMiL21BOzQs6L//BLS6hb1HSEKCyycdDIQLsVQx9MjpcC0hA== +ox@0.14.59: + version "0.14.59" + resolved "https://registry.yarnpkg.com/ox/-/ox-0.14.59.tgz#815d60b1f89afc306623536794a8a9ef3170c53d" + integrity sha512-Y+DPEQScTEGKteQATjtytE1JRQ5cg1R2+DvYQ/lbhUCm/xS9n0Jnkkf2AqQyIntefQxs8xY6dZ+kyNZ7zf2FzA== dependencies: "@adraffy/ens-normalize" "^1.11.0" "@noble/ciphers" "^1.3.0" @@ -18004,10 +18085,10 @@ varuint-bitcoin@^1.1.2: dependencies: safe-buffer "^5.1.1" -viem@>=2.45.0, viem@^2.27.2, viem@^2.31.7, viem@^2.47.0: - version "2.54.6" - resolved "https://registry.yarnpkg.com/viem/-/viem-2.54.6.tgz#df97b26ebf4ca67cc1f9ebf49c07076d6edb9b87" - integrity sha512-OfybECKJYVmhiNqz+SHhed+O2h6niQ+0Wjg9J0b4bV+/QrvLgjxhfKO7hZqsuK1YtZ/0BErBKy708Zp+cU5T0Q== +viem@>=2.45.0, viem@^2.27.2, viem@^2.31.7, viem@^2.47.0, viem@^2.56.8: + version "2.57.16" + resolved "https://registry.yarnpkg.com/viem/-/viem-2.57.16.tgz#487349adb52405ffd9103e3969ade6a0b5040355" + integrity sha512-+4uaUw3NfkqjaqsZp8Zci94K33oc9rv7mIUgvPduJxsY/tI0ASi2YkaXoUVSBGfdIw/QPWuVnIf9LTFf35IoMg== dependencies: "@noble/curves" "1.9.1" "@noble/hashes" "1.8.0" @@ -18015,7 +18096,7 @@ viem@>=2.45.0, viem@^2.27.2, viem@^2.31.7, viem@^2.47.0: "@scure/bip39" "1.6.0" abitype "1.2.3" isows "1.0.7" - ox "0.14.30" + ox "0.14.59" ws "8.21.0" viem@^2.1.1: From eab29b083bfbf11d1e295c86a84568623aa4a341 Mon Sep 17 00:00:00 2001 From: arlert-armin Date: Wed, 28 Oct 2026 14:48:44 +0000 Subject: [PATCH 14/29] feat(wallets): take chain-aware evm rpc urls and make them optional Every provider's `buildProvider` takes its RPC URLs as optional, and the EVM ones carry their chain (`EvmRpcUrls`), as the viem EVM namespace expects. --- wallets/provider-binance/src/provider.ts | 2 +- wallets/provider-bitget/src/provider.ts | 2 +- wallets/provider-braavos/src/provider.ts | 2 +- wallets/provider-default/src/provider.ts | 2 +- wallets/provider-enkrypt/src/provider.ts | 2 +- wallets/provider-freighter/src/provider.ts | 2 +- wallets/provider-gemwallet/src/provider.ts | 2 +- .../provider-ledger-wallet/src/namespaces/evm.ts | 4 ++-- wallets/provider-ledger-wallet/src/provider.ts | 8 ++------ wallets/readme.md | 14 ++++++++++---- 10 files changed, 21 insertions(+), 19 deletions(-) diff --git a/wallets/provider-binance/src/provider.ts b/wallets/provider-binance/src/provider.ts index f197c66f6d..d6d8861c6a 100644 --- a/wallets/provider-binance/src/provider.ts +++ b/wallets/provider-binance/src/provider.ts @@ -7,7 +7,7 @@ import { evm } from './namespaces/evm.js'; import { binance as binanceInstance } from './utils.js'; // RPC URLs are accepted for every namespace, so any of them can start using one. -const buildProvider = (_rpcURLs: NamespacesRPCUrls) => { +const buildProvider = (_rpcURLs?: NamespacesRPCUrls) => { return new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); diff --git a/wallets/provider-bitget/src/provider.ts b/wallets/provider-bitget/src/provider.ts index 4a031ac46f..03d33ee6ce 100644 --- a/wallets/provider-bitget/src/provider.ts +++ b/wallets/provider-bitget/src/provider.ts @@ -9,7 +9,7 @@ import { utxo } from './namespaces/utxo.js'; import { bitget } from './utils.js'; // RPC URLs are accepted for every namespace, so any of them can start using one. -const buildProvider = (_rpcURLs: NamespacesRPCUrls) => { +const buildProvider = (_rpcURLs?: NamespacesRPCUrls) => { return new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); diff --git a/wallets/provider-braavos/src/provider.ts b/wallets/provider-braavos/src/provider.ts index b1a3e25a9a..5da24257da 100644 --- a/wallets/provider-braavos/src/provider.ts +++ b/wallets/provider-braavos/src/provider.ts @@ -7,7 +7,7 @@ import { starknet } from './namespaces/starknet.js'; import { braavos } from './utils.js'; // RPC URLs are accepted for every namespace, so any of them can start using one. -const buildProvider = (_rpcURLs: NamespacesRPCUrls) => +const buildProvider = (_rpcURLs?: NamespacesRPCUrls) => new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); diff --git a/wallets/provider-default/src/provider.ts b/wallets/provider-default/src/provider.ts index 321ae53f46..9345f2d41a 100644 --- a/wallets/provider-default/src/provider.ts +++ b/wallets/provider-default/src/provider.ts @@ -7,7 +7,7 @@ import { evm } from './namespaces/evm.js'; import { defaultInjected } from './utils.js'; // RPC URLs are accepted for every namespace, so any of them can start using one. -const buildProvider = (_rpcURLs: NamespacesRPCUrls) => { +const buildProvider = (_rpcURLs?: NamespacesRPCUrls) => { return new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); diff --git a/wallets/provider-enkrypt/src/provider.ts b/wallets/provider-enkrypt/src/provider.ts index c34f599942..02a91d1fc7 100644 --- a/wallets/provider-enkrypt/src/provider.ts +++ b/wallets/provider-enkrypt/src/provider.ts @@ -7,7 +7,7 @@ import { evm } from './namespaces/evm.js'; import { enkrypt } from './utils.js'; // RPC URLs are accepted for every namespace, so any of them can start using one. -const buildProvider = (_rpcURLs: NamespacesRPCUrls) => { +const buildProvider = (_rpcURLs?: NamespacesRPCUrls) => { return new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); diff --git a/wallets/provider-freighter/src/provider.ts b/wallets/provider-freighter/src/provider.ts index 9f44e9dc63..d646481ff3 100644 --- a/wallets/provider-freighter/src/provider.ts +++ b/wallets/provider-freighter/src/provider.ts @@ -7,7 +7,7 @@ import { namespace as stellar } from './namespaces/stellar/namespace.js'; import { checkInstallation } from './utils.js'; // RPC URLs are accepted for every namespace, so any of them can start using one. -const buildProvider = (_rpcURLs: NamespacesRPCUrls) => +const buildProvider = (_rpcURLs?: NamespacesRPCUrls) => new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); diff --git a/wallets/provider-gemwallet/src/provider.ts b/wallets/provider-gemwallet/src/provider.ts index f8897d4b70..65c94bac0d 100644 --- a/wallets/provider-gemwallet/src/provider.ts +++ b/wallets/provider-gemwallet/src/provider.ts @@ -7,7 +7,7 @@ import { namespace as xrpl } from './namespaces/xrpl/mod.js'; import { checkInstallationOnLoad } from './utils.js'; // RPC URLs are accepted for every namespace, so any of them can start using one. -const buildProvider = (_rpcURLs: NamespacesRPCUrls) => +const buildProvider = (_rpcURLs?: NamespacesRPCUrls) => new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); diff --git a/wallets/provider-ledger-wallet/src/namespaces/evm.ts b/wallets/provider-ledger-wallet/src/namespaces/evm.ts index 36c8bf548e..1c9ebb673b 100644 --- a/wallets/provider-ledger-wallet/src/namespaces/evm.ts +++ b/wallets/provider-ledger-wallet/src/namespaces/evm.ts @@ -1,5 +1,5 @@ import type { Context } from '@hub3js/core'; -import type { Chain, ChainId, EvmActions } from '@hub3js/evm'; +import type { Chain, ChainId, EvmActions, EvmRpcUrls } from '@hub3js/evm'; import { NamespaceBuilder } from '@hub3js/core'; import { @@ -131,7 +131,7 @@ const LEDGER_PUBLIC_ACTIONS: ReadonlyArray = [ 'simulateContract', ]; -const buildEvm = (rpcUrls: string[]) => { +const buildEvm = (rpcUrls?: EvmRpcUrls) => { const publicActions = viemPublicAdapter(rpcUrls); const publicActionNames = new Set(publicActions.map(([name]) => name)); diff --git a/wallets/provider-ledger-wallet/src/provider.ts b/wallets/provider-ledger-wallet/src/provider.ts index dd286d9461..5b68f1ffb8 100644 --- a/wallets/provider-ledger-wallet/src/provider.ts +++ b/wallets/provider-ledger-wallet/src/provider.ts @@ -11,11 +11,7 @@ import { buildEvm } from './namespaces/evm.js'; const LEDGER_PROVIDER_NAME = 'Ledger Wallet'; -const buildProvider = (rpcURLs: NamespacesRPCUrls) => { - if (!rpcURLs?.evm) { - throw new Error('An RPC URL for the EVM namespace is required.'); - } - +const buildProvider = (rpcURLs?: NamespacesRPCUrls) => { return new ProviderBuilder(WALLET_ID) .init(function (context, environments: Environments) { const [, setState] = context.state(); @@ -97,7 +93,7 @@ const buildProvider = (rpcURLs: NamespacesRPCUrls) => { }; }) .config('metadata', metadata) - .add('evm', buildEvm(rpcURLs.evm)) + .add('evm', buildEvm(rpcURLs?.evm)) .build(); }; diff --git a/wallets/readme.md b/wallets/readme.md index 7fe1df182d..94a9c83a06 100644 --- a/wallets/readme.md +++ b/wallets/readme.md @@ -56,10 +56,16 @@ or some specific wallets: import { Provider } from '@rango-dev/wallets-react'; import { buildProvider as metamask } from '@rango-dev/provider-metamask'; import { buildProvider as phantom } from '@rango-dev/provider-phantom'; - -// RPC endpoints per namespace, shared by every provider. -const rpcURLs = { evm: 'https://your-ethereum-rpc' }; -const providers = [metamask(rpcURLs), phantom(rpcURLs)]; +import { mainnet } from 'viem/chains'; + +// RPC endpoints per namespace, shared by every provider. They're optional: +// wallets with their own RPC (e.g. MetaMask) don't need them, while wallets +// without one (Ledger, Trezor) read from them and reject reads on chains +// without urls. +const rpcURLs = { + evm: [{ chain: mainnet, rpcUrls: ['https://your-ethereum-rpc'] }], +}; +const providers = [metamask(rpcURLs), phantom()]; export function App() { const blockchains = [...] // An array of blockchains From 4b8f06b4f30052f4257dbd950b31f54558df60a1 Mon Sep 17 00:00:00 2001 From: arlert-armin Date: Wed, 28 Oct 2026 14:49:19 +0000 Subject: [PATCH 15/29] feat(wallets): take chain-aware evm rpc urls and make them optional Every provider's `buildProvider` takes its RPC URLs as optional, and the EVM ones carry their chain (`EvmRpcUrls`), as the viem EVM namespace expects. --- wallets/provider-noir-wallet/src/provider.ts | 2 +- wallets/provider-rabby/src/provider.ts | 2 +- wallets/provider-ready/src/provider.ts | 2 +- wallets/provider-safe/src/provider.ts | 2 +- wallets/provider-safepal/src/provider.ts | 2 +- wallets/provider-slush/src/provider.ts | 2 +- wallets/provider-taho/src/provider.ts | 2 +- wallets/provider-tokenpocket/src/provider.ts | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/wallets/provider-noir-wallet/src/provider.ts b/wallets/provider-noir-wallet/src/provider.ts index 8471c2429a..18fe7b71a9 100644 --- a/wallets/provider-noir-wallet/src/provider.ts +++ b/wallets/provider-noir-wallet/src/provider.ts @@ -7,7 +7,7 @@ import { info, WALLET_ID } from './constants.js'; import { namespace as utxo } from './namespaces/utxo.js'; // RPC URLs are accepted for every namespace, so any of them can start using one. -const buildProvider = (_rpcURLs: NamespacesRPCUrls) => +const buildProvider = (_rpcURLs?: NamespacesRPCUrls) => new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); diff --git a/wallets/provider-rabby/src/provider.ts b/wallets/provider-rabby/src/provider.ts index 4f27314f9b..656861dc09 100644 --- a/wallets/provider-rabby/src/provider.ts +++ b/wallets/provider-rabby/src/provider.ts @@ -7,7 +7,7 @@ import { evm } from './namespaces/evm.js'; import { rabby as rabbyInstance } from './utils.js'; // RPC URLs are accepted for every namespace, so any of them can start using one. -const buildProvider = (_rpcURLs: NamespacesRPCUrls) => { +const buildProvider = (_rpcURLs?: NamespacesRPCUrls) => { return new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); diff --git a/wallets/provider-ready/src/provider.ts b/wallets/provider-ready/src/provider.ts index 670aef6539..6c832751e4 100644 --- a/wallets/provider-ready/src/provider.ts +++ b/wallets/provider-ready/src/provider.ts @@ -7,7 +7,7 @@ import { starknet } from './namespaces/starknet.js'; import { ready } from './utils.js'; // RPC URLs are accepted for every namespace, so any of them can start using one. -const buildProvider = (_rpcURLs: NamespacesRPCUrls) => +const buildProvider = (_rpcURLs?: NamespacesRPCUrls) => new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); diff --git a/wallets/provider-safe/src/provider.ts b/wallets/provider-safe/src/provider.ts index 0a7516854d..7fe9fe9284 100644 --- a/wallets/provider-safe/src/provider.ts +++ b/wallets/provider-safe/src/provider.ts @@ -7,7 +7,7 @@ import { evm } from './namespaces/evm.js'; import { initSafe } from './safe.js'; // RPC URLs are accepted for every namespace, so any of them can start using one. -const buildProvider = (_rpcURLs: NamespacesRPCUrls) => { +const buildProvider = (_rpcURLs?: NamespacesRPCUrls) => { return new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); diff --git a/wallets/provider-safepal/src/provider.ts b/wallets/provider-safepal/src/provider.ts index 0f4e7bd57d..cadd4359e4 100644 --- a/wallets/provider-safepal/src/provider.ts +++ b/wallets/provider-safepal/src/provider.ts @@ -8,7 +8,7 @@ import { safepal as safepalInstance } from './utils.js'; const WAIT_TO_LOAD_INSTANCE_DELAY = 1000; // RPC URLs are accepted for every namespace, so any of them can start using one. -const buildProvider = (_rpcURLs: NamespacesRPCUrls) => { +const buildProvider = (_rpcURLs?: NamespacesRPCUrls) => { return new ProviderBuilder(WALLET_ID) .init(function (context) { setTimeout(() => { diff --git a/wallets/provider-slush/src/provider.ts b/wallets/provider-slush/src/provider.ts index a701974a12..83aea28399 100644 --- a/wallets/provider-slush/src/provider.ts +++ b/wallets/provider-slush/src/provider.ts @@ -7,7 +7,7 @@ import { sui } from './namespaces/sui.js'; import { suiWalletInstance } from './utils.js'; // RPC URLs are accepted for every namespace, so any of them can start using one. -const buildProvider = (_rpcURLs: NamespacesRPCUrls) => +const buildProvider = (_rpcURLs?: NamespacesRPCUrls) => new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); diff --git a/wallets/provider-taho/src/provider.ts b/wallets/provider-taho/src/provider.ts index b8aa06a487..64f9a334a8 100644 --- a/wallets/provider-taho/src/provider.ts +++ b/wallets/provider-taho/src/provider.ts @@ -7,7 +7,7 @@ import { evm } from './namespaces/evm.js'; import { taho } from './utils.js'; // RPC URLs are accepted for every namespace, so any of them can start using one. -const buildProvider = (_rpcURLs: NamespacesRPCUrls) => { +const buildProvider = (_rpcURLs?: NamespacesRPCUrls) => { return new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); diff --git a/wallets/provider-tokenpocket/src/provider.ts b/wallets/provider-tokenpocket/src/provider.ts index 61c43ab65b..3923c32c68 100644 --- a/wallets/provider-tokenpocket/src/provider.ts +++ b/wallets/provider-tokenpocket/src/provider.ts @@ -7,7 +7,7 @@ import { evm } from './namespaces/evm.js'; import { tokenPocket } from './utils.js'; // RPC URLs are accepted for every namespace, so any of them can start using one. -const buildProvider = (_rpcURLs: NamespacesRPCUrls) => { +const buildProvider = (_rpcURLs?: NamespacesRPCUrls) => { return new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); From 0ff8d2b06cd609f8faf19cc0280f006a43f621cc Mon Sep 17 00:00:00 2001 From: arlert-armin Date: Wed, 28 Oct 2026 14:49:54 +0000 Subject: [PATCH 16/29] feat(wallets): take chain-aware evm rpc urls and make them optional Every provider's `buildProvider` takes its RPC URLs as optional, and the EVM ones carry their chain (`EvmRpcUrls`), as the viem EVM namespace expects. --- wallets/provider-tomo/src/provider.ts | 2 +- wallets/provider-tonconnect/src/provider.ts | 2 +- wallets/provider-trezor/src/namespaces/evm.ts | 4 ++-- wallets/provider-trezor/src/provider.ts | 8 ++------ wallets/provider-tron-link/src/provider.ts | 2 +- wallets/provider-unisat/src/provider.ts | 2 +- wallets/provider-vultisig/src/provider.ts | 2 +- wallets/provider-walletconnect-2/src/provider.ts | 2 +- wallets/provider-xverse/src/provider.ts | 2 +- 9 files changed, 11 insertions(+), 15 deletions(-) diff --git a/wallets/provider-tomo/src/provider.ts b/wallets/provider-tomo/src/provider.ts index f1c22eb577..3eebb86c49 100644 --- a/wallets/provider-tomo/src/provider.ts +++ b/wallets/provider-tomo/src/provider.ts @@ -7,7 +7,7 @@ import { evm } from './namespaces/evm.js'; import { tomo } from './utils.js'; // RPC URLs are accepted for every namespace, so any of them can start using one. -const buildProvider = (_rpcURLs: NamespacesRPCUrls) => { +const buildProvider = (_rpcURLs?: NamespacesRPCUrls) => { return new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); diff --git a/wallets/provider-tonconnect/src/provider.ts b/wallets/provider-tonconnect/src/provider.ts index dfc928377f..7e29a0a03d 100644 --- a/wallets/provider-tonconnect/src/provider.ts +++ b/wallets/provider-tonconnect/src/provider.ts @@ -8,7 +8,7 @@ import { ton } from './namespaces/ton.js'; import { tonConnect } from './utils.js'; // RPC URLs are accepted for every namespace, so any of them can start using one. -const buildProvider = (_rpcURLs: NamespacesRPCUrls) => +const buildProvider = (_rpcURLs?: NamespacesRPCUrls) => new ProviderBuilder(WALLET_ID) .init(function (context, environments: Environments) { const [, setState] = context.state(); diff --git a/wallets/provider-trezor/src/namespaces/evm.ts b/wallets/provider-trezor/src/namespaces/evm.ts index 68fabe154f..50a41b37b3 100644 --- a/wallets/provider-trezor/src/namespaces/evm.ts +++ b/wallets/provider-trezor/src/namespaces/evm.ts @@ -1,5 +1,5 @@ import type { Context } from '@hub3js/core'; -import type { AllowanceParams, EvmActions } from '@hub3js/evm'; +import type { AllowanceParams, EvmActions, EvmRpcUrls } from '@hub3js/evm'; import { Hub3Error, NamespaceBuilder } from '@hub3js/core'; import { builders, utils, viemPublicAdapter } from '@hub3js/evm'; @@ -87,7 +87,7 @@ const getAllowance = builders ) .build(); -const buildEvm = (rpcUrls: string[]) => +const buildEvm = (rpcUrls?: EvmRpcUrls) => new NamespaceBuilder('EVM', WALLET_ID) // No wallet RPC, so viem's public actions go to our RPC endpoints. .action(viemPublicAdapter(rpcUrls)) diff --git a/wallets/provider-trezor/src/provider.ts b/wallets/provider-trezor/src/provider.ts index b835082c25..3b8d6dd8d5 100644 --- a/wallets/provider-trezor/src/provider.ts +++ b/wallets/provider-trezor/src/provider.ts @@ -11,11 +11,7 @@ let trezorManifest: Environments['manifest']; export const getTrezorManifest = () => trezorManifest; -const buildProvider = (rpcURLs: NamespacesRPCUrls) => { - if (!rpcURLs?.evm) { - throw new Error('An RPC URL for the EVM namespace is required.'); - } - +const buildProvider = (rpcURLs?: NamespacesRPCUrls) => { return new ProviderBuilder(WALLET_ID) .init(function (context, environments: Environments) { const [, setState] = context.state(); @@ -29,7 +25,7 @@ const buildProvider = (rpcURLs: NamespacesRPCUrls) => { console.debug('[trezor] instance detected.', context); }) .config('metadata', metadata) - .add('evm', buildEvm(rpcURLs.evm)) + .add('evm', buildEvm(rpcURLs?.evm)) .add('utxo', utxo) .build(); }; diff --git a/wallets/provider-tron-link/src/provider.ts b/wallets/provider-tron-link/src/provider.ts index f9a8153a88..740112f789 100644 --- a/wallets/provider-tron-link/src/provider.ts +++ b/wallets/provider-tron-link/src/provider.ts @@ -7,7 +7,7 @@ import { tron } from './namespaces/tron.js'; import { tronlink } from './utils.js'; // RPC URLs are accepted for every namespace, so any of them can start using one. -const buildProvider = (_rpcURLs: NamespacesRPCUrls) => +const buildProvider = (_rpcURLs?: NamespacesRPCUrls) => new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); diff --git a/wallets/provider-unisat/src/provider.ts b/wallets/provider-unisat/src/provider.ts index 9826e77dc3..3c5a90b2e2 100644 --- a/wallets/provider-unisat/src/provider.ts +++ b/wallets/provider-unisat/src/provider.ts @@ -7,7 +7,7 @@ import { utxo } from './namespaces/utxo.js'; import { unisat as unisatInstance } from './utils.js'; // RPC URLs are accepted for every namespace, so any of them can start using one. -const buildProvider = (_rpcURLs: NamespacesRPCUrls) => +const buildProvider = (_rpcURLs?: NamespacesRPCUrls) => new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); diff --git a/wallets/provider-vultisig/src/provider.ts b/wallets/provider-vultisig/src/provider.ts index cd8a88f48c..5c26020f71 100644 --- a/wallets/provider-vultisig/src/provider.ts +++ b/wallets/provider-vultisig/src/provider.ts @@ -7,7 +7,7 @@ import { namespace as utxo } from './namespaces/utxo/namespace.js'; import { vultisig } from './utils.js'; // RPC URLs are accepted for every namespace, so any of them can start using one. -const buildProvider = (_rpcURLs: NamespacesRPCUrls) => +const buildProvider = (_rpcURLs?: NamespacesRPCUrls) => new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); diff --git a/wallets/provider-walletconnect-2/src/provider.ts b/wallets/provider-walletconnect-2/src/provider.ts index 7f175afae3..a35392ca43 100644 --- a/wallets/provider-walletconnect-2/src/provider.ts +++ b/wallets/provider-walletconnect-2/src/provider.ts @@ -9,7 +9,7 @@ import { metadata, WALLET_ID } from './constants.js'; import { evm } from './namespaces/evm/namespace.js'; // RPC URLs are accepted for every namespace, so any of them can start using one. -const buildProvider = (_rpcURLs: NamespacesRPCUrls) => { +const buildProvider = (_rpcURLs?: NamespacesRPCUrls) => { return new ProviderBuilder(WALLET_ID) .init(function (context, environments: Environments) { const [, setState] = context.state(); diff --git a/wallets/provider-xverse/src/provider.ts b/wallets/provider-xverse/src/provider.ts index 6c9f20aa6c..4286416737 100644 --- a/wallets/provider-xverse/src/provider.ts +++ b/wallets/provider-xverse/src/provider.ts @@ -7,7 +7,7 @@ import { utxo } from './namespaces/utxo.js'; import { xverse as unisatInstance } from './utils.js'; // RPC URLs are accepted for every namespace, so any of them can start using one. -const buildProvider = (_rpcURLs: NamespacesRPCUrls) => +const buildProvider = (_rpcURLs?: NamespacesRPCUrls) => new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); From 85f5507ec84bd944a3bac4020ad47554a6babe5e Mon Sep 17 00:00:00 2001 From: arlert-armin Date: Tue, 3 Nov 2026 18:30:25 +0000 Subject: [PATCH 17/29] feat(wallets): take chain-aware evm rpc urls and make them optional Every provider's `buildProvider` takes its RPC URLs as optional, and the EVM ones carry their chain (`EvmRpcUrls`), as the viem EVM namespace expects. Ledger no longer throws without an EVM url. Its reads reject on a chain without urls instead. --- wallets/provider-brave/src/provider.ts | 2 +- wallets/provider-coin98/src/provider.ts | 2 +- wallets/provider-coinbase/src/provider.ts | 2 +- wallets/provider-exodus/src/provider.ts | 2 +- wallets/provider-math-wallet/src/provider.ts | 2 +- wallets/provider-metamask/src/provider.ts | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/wallets/provider-brave/src/provider.ts b/wallets/provider-brave/src/provider.ts index bce7c4e0c5..426bead7e8 100644 --- a/wallets/provider-brave/src/provider.ts +++ b/wallets/provider-brave/src/provider.ts @@ -8,7 +8,7 @@ import { solana } from './namespaces/solana.js'; import { brave } from './utils.js'; // RPC URLs are accepted for every namespace, so any of them can start using one. -const buildProvider = (_rpcURLs: NamespacesRPCUrls) => { +const buildProvider = (_rpcURLs?: NamespacesRPCUrls) => { return new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); diff --git a/wallets/provider-coin98/src/provider.ts b/wallets/provider-coin98/src/provider.ts index 2672345ee8..24c8faf777 100644 --- a/wallets/provider-coin98/src/provider.ts +++ b/wallets/provider-coin98/src/provider.ts @@ -8,7 +8,7 @@ import { solana } from './namespaces/solana.js'; import { coin98 } from './utils.js'; // RPC URLs are accepted for every namespace, so any of them can start using one. -const buildProvider = (_rpcURLs: NamespacesRPCUrls) => { +const buildProvider = (_rpcURLs?: NamespacesRPCUrls) => { return new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); diff --git a/wallets/provider-coinbase/src/provider.ts b/wallets/provider-coinbase/src/provider.ts index 294eb3a4df..5237a56cc2 100644 --- a/wallets/provider-coinbase/src/provider.ts +++ b/wallets/provider-coinbase/src/provider.ts @@ -8,7 +8,7 @@ import { solana } from './namespaces/solana.js'; import { coinbase as coinbaseInstance } from './utils.js'; // RPC URLs are accepted for every namespace, so any of them can start using one. -const buildProvider = (_rpcURLs: NamespacesRPCUrls) => { +const buildProvider = (_rpcURLs?: NamespacesRPCUrls) => { return new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); diff --git a/wallets/provider-exodus/src/provider.ts b/wallets/provider-exodus/src/provider.ts index 9e038c33c3..bfd4219b1b 100644 --- a/wallets/provider-exodus/src/provider.ts +++ b/wallets/provider-exodus/src/provider.ts @@ -9,7 +9,7 @@ import { exodus as exodusInstance } from './utils.js'; const WALLET_INJECTION_DELAY_MS = 1000; // RPC URLs are accepted for every namespace, so any of them can start using one. -const buildProvider = (_rpcURLs: NamespacesRPCUrls) => { +const buildProvider = (_rpcURLs?: NamespacesRPCUrls) => { return new ProviderBuilder(WALLET_ID) .init((context) => setTimeout(function () { diff --git a/wallets/provider-math-wallet/src/provider.ts b/wallets/provider-math-wallet/src/provider.ts index 3fd4397ec6..e91fdeca2c 100644 --- a/wallets/provider-math-wallet/src/provider.ts +++ b/wallets/provider-math-wallet/src/provider.ts @@ -12,7 +12,7 @@ import { solana } from './namespaces/solana.js'; import { mathWallet } from './utils.js'; // RPC URLs are accepted for every namespace, so any of them can start using one. -const buildProvider = (_rpcURLs: NamespacesRPCUrls) => { +const buildProvider = (_rpcURLs?: NamespacesRPCUrls) => { return new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); diff --git a/wallets/provider-metamask/src/provider.ts b/wallets/provider-metamask/src/provider.ts index 20ee345115..5c079cd439 100644 --- a/wallets/provider-metamask/src/provider.ts +++ b/wallets/provider-metamask/src/provider.ts @@ -8,7 +8,7 @@ import { solana } from './namespaces/solana.js'; import { metamask as metamask } from './utils.js'; // RPC URLs are accepted for every namespace, so any of them can start using one. -const buildProvider = (_rpcURLs: NamespacesRPCUrls) => { +const buildProvider = (_rpcURLs?: NamespacesRPCUrls) => { return new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); From f55b20199fc4208433e315a566fd01715aa88729 Mon Sep 17 00:00:00 2001 From: arlert-armin Date: Tue, 3 Nov 2026 18:31:14 +0000 Subject: [PATCH 18/29] feat(wallets): take chain-aware evm rpc urls and make them optional Every provider's `buildProvider` takes its RPC URLs as optional, and the EVM ones carry their chain (`EvmRpcUrls`), as the viem EVM namespace expects. Ledger no longer throws without an EVM url. Its reads reject on a chain without urls instead. --- wallets/provider-ledger/src/namespaces/evm.ts | 4 ++-- wallets/provider-ledger/src/provider.ts | 8 ++------ wallets/provider-okx/src/provider.ts | 2 +- wallets/provider-phantom/src/provider.ts | 2 +- wallets/provider-solflare/src/provider.ts | 2 +- wallets/provider-trustwallet/src/provider.ts | 2 +- 6 files changed, 8 insertions(+), 12 deletions(-) diff --git a/wallets/provider-ledger/src/namespaces/evm.ts b/wallets/provider-ledger/src/namespaces/evm.ts index 7cd08ec0e8..cdaf5e711c 100644 --- a/wallets/provider-ledger/src/namespaces/evm.ts +++ b/wallets/provider-ledger/src/namespaces/evm.ts @@ -1,5 +1,5 @@ import type { Context } from '@hub3js/core'; -import type { AllowanceParams, EvmActions } from '@hub3js/evm'; +import type { AllowanceParams, EvmActions, EvmRpcUrls } from '@hub3js/evm'; import type { CaipAccount } from '@hub3js/std/types'; import { Hub3Error, NamespaceBuilder } from '@hub3js/core'; @@ -88,7 +88,7 @@ const getAllowance = builders ) .build(); -const buildEvm = (rpcUrls: string[]) => +const buildEvm = (rpcUrls?: EvmRpcUrls) => new NamespaceBuilder('EVM', WALLET_ID) // No wallet RPC, so viem's public actions go to our RPC endpoints. .action(viemPublicAdapter(rpcUrls)) diff --git a/wallets/provider-ledger/src/provider.ts b/wallets/provider-ledger/src/provider.ts index b7e44b4d68..9c0cbdfa07 100644 --- a/wallets/provider-ledger/src/provider.ts +++ b/wallets/provider-ledger/src/provider.ts @@ -7,11 +7,7 @@ import { buildEvm } from './namespaces/evm.js'; import { solana } from './namespaces/solana.js'; import { ledger as ledgerInstance } from './utils.js'; -const buildProvider = (rpcURLs: NamespacesRPCUrls) => { - if (!rpcURLs?.evm) { - throw new Error('An RPC URL for the EVM namespace is required.'); - } - +const buildProvider = (rpcURLs?: NamespacesRPCUrls) => { return new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); @@ -22,7 +18,7 @@ const buildProvider = (rpcURLs: NamespacesRPCUrls) => { }) .config('metadata', metadata) .add('solana', solana) - .add('evm', buildEvm(rpcURLs.evm)) + .add('evm', buildEvm(rpcURLs?.evm)) .build(); }; diff --git a/wallets/provider-okx/src/provider.ts b/wallets/provider-okx/src/provider.ts index 1919c67887..6c450a907a 100644 --- a/wallets/provider-okx/src/provider.ts +++ b/wallets/provider-okx/src/provider.ts @@ -14,7 +14,7 @@ import { utxo } from './namespaces/utxo.js'; import { okx as okxInstance } from './utils.js'; // RPC URLs are accepted for every namespace, so any of them can start using one. -const buildProvider = (_rpcURLs: NamespacesRPCUrls) => { +const buildProvider = (_rpcURLs?: NamespacesRPCUrls) => { return new ProviderBuilder(WALLET_ID) .init(function (context, environments?: Environments) { setEnvironments(environments); diff --git a/wallets/provider-phantom/src/provider.ts b/wallets/provider-phantom/src/provider.ts index 7522efa7e3..38df366551 100644 --- a/wallets/provider-phantom/src/provider.ts +++ b/wallets/provider-phantom/src/provider.ts @@ -8,7 +8,7 @@ import { solana } from './namespaces/solana.js'; import { phantom as phantomInstance } from './utils.js'; // RPC URLs are accepted for every namespace, so any of them can start using one. -const buildProvider = (_rpcURLs: NamespacesRPCUrls) => { +const buildProvider = (_rpcURLs?: NamespacesRPCUrls) => { return new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); diff --git a/wallets/provider-solflare/src/provider.ts b/wallets/provider-solflare/src/provider.ts index 0e2f6a9436..9da60249a7 100644 --- a/wallets/provider-solflare/src/provider.ts +++ b/wallets/provider-solflare/src/provider.ts @@ -7,7 +7,7 @@ import { solana } from './namespaces/solana.js'; import { solflare } from './utils.js'; // RPC URLs are accepted for every namespace, so any of them can start using one. -const buildProvider = (_rpcURLs: NamespacesRPCUrls) => +const buildProvider = (_rpcURLs?: NamespacesRPCUrls) => new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); diff --git a/wallets/provider-trustwallet/src/provider.ts b/wallets/provider-trustwallet/src/provider.ts index 8816f38681..54f38f2f94 100644 --- a/wallets/provider-trustwallet/src/provider.ts +++ b/wallets/provider-trustwallet/src/provider.ts @@ -8,7 +8,7 @@ import { solana } from './namespaces/solana.js'; import { trustWallet as trustwalletInstance } from './utils.js'; // RPC URLs are accepted for every namespace, so any of them can start using one. -const buildProvider = (_rpcURLs: NamespacesRPCUrls) => { +const buildProvider = (_rpcURLs?: NamespacesRPCUrls) => { return new ProviderBuilder(WALLET_ID) .init(function (context) { const [, setState] = context.state(); From e508fcf9f8dceb7a43e7b526a04ea0c21d9b5d7d Mon Sep 17 00:00:00 2001 From: arlert-armin Date: Tue, 3 Nov 2026 18:32:00 +0000 Subject: [PATCH 19/29] feat(widget): take per-chain rpc urls from the widget config instead of hardcoding them provider-all no longer ships `RPC_URLS`, which had a keyed Ethereum url. An EVM url only serves one chain, so the urls now come from the app. - provider-all exports `toNamespacesRPCUrls`. It turns `{ evm: { [chainId]: string[] } }` into the per-chain `EvmRpcUrls` that providers are built with. - The widget has a new `rpcUrls` config. The store converts it before it builds any provider, and `signers.customEthereumRPC` goes first for chain 1. With nothing configured, providers get no urls, and reads on a chain without urls reject. - Ledger and Trezor read the RPC through their namespace now, so the `setEvmSignerConfig` call and widget-embedded's signer-evm dependency are dropped. - The playground and the queue-manager demo build providers without urls. --- .../src/components/Wallets/index.tsx | 4 +- .../queue-manager-demo/src/index.tsx | 4 +- wallets/provider-all/src/index.ts | 15 ++----- wallets/provider-all/src/rpcUrls.test.ts | 45 +++++++++++++++++++ wallets/provider-all/src/rpcUrls.ts | 41 +++++++++++++++++ wallets/readme.md | 13 ++++-- widget/embedded/package.json | 1 - .../WidgetProvider/WidgetProvider.tsx | 7 --- .../embedded/src/store/slices/config.test.ts | 43 ++++++++++++++++++ widget/embedded/src/store/slices/config.ts | 26 ++++++++++- widget/embedded/src/types/config.ts | 7 +++ .../FunctionalLayout.utils.ts | 8 ++-- 12 files changed, 179 insertions(+), 35 deletions(-) create mode 100644 wallets/provider-all/src/rpcUrls.test.ts create mode 100644 wallets/provider-all/src/rpcUrls.ts create mode 100644 widget/embedded/src/store/slices/config.test.ts diff --git a/queue-manager/queue-manager-demo/src/components/Wallets/index.tsx b/queue-manager/queue-manager-demo/src/components/Wallets/index.tsx index 3b33bfaf7c..1feb9bad34 100644 --- a/queue-manager/queue-manager-demo/src/components/Wallets/index.tsx +++ b/queue-manager/queue-manager-demo/src/components/Wallets/index.tsx @@ -1,8 +1,8 @@ -import { allProviders, RPC_URLS } from '@rango-dev/provider-all'; +import { allProviders } from '@rango-dev/provider-all'; import { useWallets } from '@rango-dev/wallets-react'; import React from 'react'; -export const providers = allProviders().map((build) => build(RPC_URLS)); +export const providers = allProviders().map((build) => build()); export const wallets = providers.map((provider) => provider.id); diff --git a/queue-manager/queue-manager-demo/src/index.tsx b/queue-manager/queue-manager-demo/src/index.tsx index 54d369fc75..1622c114ed 100644 --- a/queue-manager/queue-manager-demo/src/index.tsx +++ b/queue-manager/queue-manager-demo/src/index.tsx @@ -1,7 +1,7 @@ import type { WalletType } from '@hub3js/core'; import type { BlockchainMeta } from 'rango-types'; -import { allProviders, RPC_URLS, WalletTypes } from '@rango-dev/provider-all'; +import { allProviders, WalletTypes } from '@rango-dev/provider-all'; import { Events, Provider } from '@rango-dev/wallets-react'; import { RangoClient } from 'rango-sdk'; import React, { useEffect, useState } from 'react'; @@ -14,7 +14,7 @@ import { WC_PROJECT_ID, } from './configs'; -const providers = allProviders().map((build) => build(RPC_URLS)); +const providers = allProviders().map((build) => build()); function AppContainer() { const [connectedWallets, setConnectedWallets] = useState([]); diff --git a/wallets/provider-all/src/index.ts b/wallets/provider-all/src/index.ts index c159404b87..ce28d3d8d9 100644 --- a/wallets/provider-all/src/index.ts +++ b/wallets/provider-all/src/index.ts @@ -38,21 +38,12 @@ import { buildProvider as walletconnect2 } from '@rango-dev/provider-walletconne import { buildProvider as xverse } from '@rango-dev/provider-xverse'; export { WalletTypes } from './walletTypes.js'; - -/** - * The RPC endpoints every provider is built with, declared once for all of - * them. Namespaces read their own entry, e.g. the EVM namespace's public viem - * actions go to `evm`. - */ -export const RPC_URLS: NamespacesRPCUrls = { - evm: [ - 'https://rpc.ankr.com/eth/8d43f5e842676d766141cb1943b9b4e12821f463665e180c209bd3dab9639df2', - ], -}; +export { toNamespacesRPCUrls } from './rpcUrls.js'; +export type { RpcUrlsConfig } from './rpcUrls.js'; // Providers register different namespaces, so the list is typed loosely instead of `Provider`. // eslint-disable-next-line @typescript-eslint/no-explicit-any -type BuildProvider = (rpcURLs: NamespacesRPCUrls) => Provider; +type BuildProvider = (rpcURLs?: NamespacesRPCUrls) => Provider; export const allProviders = (): BuildProvider[] => { return [ diff --git a/wallets/provider-all/src/rpcUrls.test.ts b/wallets/provider-all/src/rpcUrls.test.ts new file mode 100644 index 0000000000..f41faa4c61 --- /dev/null +++ b/wallets/provider-all/src/rpcUrls.test.ts @@ -0,0 +1,45 @@ +import { describe, expect, test } from 'vitest'; + +import { toNamespacesRPCUrls } from './rpcUrls.js'; + +const BSC_CHAIN_ID = 56; +const POLYGON_CHAIN_ID = 137; + +describe('toNamespacesRPCUrls', () => { + test('gives every EVM chain its own urls and viem chain', () => { + const { evm } = toNamespacesRPCUrls({ + evm: { + 1: ['https://eth.example'], + [BSC_CHAIN_ID]: ['https://a.bsc', 'https://b.bsc'], + }, + }); + + expect(evm).toHaveLength(2); + expect(evm?.map(({ chain, rpcUrls }) => [chain.id, rpcUrls])).toEqual([ + [1, ['https://eth.example']], + [BSC_CHAIN_ID, ['https://a.bsc', 'https://b.bsc']], + ]); + expect(evm?.[1]?.chain.rpcUrls.default.http).toEqual([ + 'https://a.bsc', + 'https://b.bsc', + ]); + }); + + test('leaves out chains without urls and invalid chain ids', () => { + const { evm } = toNamespacesRPCUrls({ + evm: { 1: [], 10: [''], [POLYGON_CHAIN_ID]: ['https://polygon.example'] }, + }); + + expect(evm?.map(({ chain }) => chain.id)).toEqual([POLYGON_CHAIN_ID]); + expect( + toNamespacesRPCUrls({ + evm: { 0: ['https://x'] }, + }) + ).toEqual({}); + }); + + test('has no urls of its own', () => { + expect(toNamespacesRPCUrls()).toEqual({}); + expect(toNamespacesRPCUrls({})).toEqual({}); + }); +}); diff --git a/wallets/provider-all/src/rpcUrls.ts b/wallets/provider-all/src/rpcUrls.ts new file mode 100644 index 0000000000..3e976bd71d --- /dev/null +++ b/wallets/provider-all/src/rpcUrls.ts @@ -0,0 +1,41 @@ +import type { EvmRpcUrls } from '@hub3js/evm'; +import type { NamespacesRPCUrls } from '@hub3js/namespaces'; + +/** + * RPC urls as an app configures them. An EVM url serves one chain, so EVM urls + * are keyed by chain id, e.g. `{ evm: { 1: ['https://…'], 56: ['https://…'] } }`. + */ +export type RpcUrlsConfig = { + evm?: Record; +}; + +/** + * Turns configured RPC urls into the shape providers are built with. Each EVM + * chain gets a minimal viem chain: its id and urls are what reads need. Chains + * without urls are left out, so reads on them reject instead of going to a url + * we don't control. + */ +export function toNamespacesRPCUrls(config?: RpcUrlsConfig): NamespacesRPCUrls { + const evm: EvmRpcUrls = []; + + for (const [key, urls] of Object.entries(config?.evm ?? {})) { + const id = Number(key); + const rpcUrls = urls.filter(Boolean); + + if (!Number.isInteger(id) || id <= 0 || rpcUrls.length === 0) { + continue; + } + + evm.push({ + chain: { + id, + name: `EVM chain ${id}`, + nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 }, + rpcUrls: { default: { http: rpcUrls } }, + }, + rpcUrls, + }); + } + + return evm.length ? { evm } : {}; +} diff --git a/wallets/readme.md b/wallets/readme.md index 94a9c83a06..82323d8f8f 100644 --- a/wallets/readme.md +++ b/wallets/readme.md @@ -35,9 +35,14 @@ After adding the dependencies, you can use them. Using all supported wallets (`p ```js import { Provider } from '@rango-dev/wallets-react'; -import { allProviders, RPC_URLS } from '@rango-dev/provider-all'; +import { allProviders, toNamespacesRPCUrls } from '@rango-dev/provider-all'; -const providers = allProviders().map((build) => build(RPC_URLS)); +// Optional. Wallets without an RPC of their own (Ledger, Trezor) read each EVM +// chain through these urls, keyed by chain id. No url is built in. +const rpcURLs = toNamespacesRPCUrls({ + evm: { 1: ['https://your-ethereum-rpc'], 56: ['https://your-bsc-rpc'] }, +}); +const providers = allProviders().map((build) => build(rpcURLs)); export function App() { const blockchains = [...] // An array of blockchains @@ -111,9 +116,9 @@ With the use of auto-connect, after reloading the app, wallet provider will auto ```js import { Provider } from '@rango-dev/wallets-react'; -import { allProviders, RPC_URLS } from '@rango-dev/provider-all'; +import { allProviders } from '@rango-dev/provider-all'; -const providers = allProviders().map((build) => build(RPC_URLS)); +const providers = allProviders().map((build) => build()); export function App() { const blockchains = [...] // An array of blockchains diff --git a/widget/embedded/package.json b/widget/embedded/package.json index 6de2d48a93..fa3440ca7f 100644 --- a/widget/embedded/package.json +++ b/widget/embedded/package.json @@ -43,7 +43,6 @@ "@rango-dev/queue-manager-core": "^0.36.1-next.0", "@rango-dev/queue-manager-rango-preset": "^0.66.1-next.1", "@rango-dev/queue-manager-react": "^0.36.1-next.0", - "@rango-dev/signer-evm": "^0.47.1", "@rango-dev/signer-solana": "^0.51.1-next.0", "@rango-dev/ui": "^0.67.1-next.1", "@rango-dev/wallets-react": "^0.50.1-next.1", diff --git a/widget/embedded/src/containers/WidgetProvider/WidgetProvider.tsx b/widget/embedded/src/containers/WidgetProvider/WidgetProvider.tsx index 0ab52631d1..35c8566f72 100644 --- a/widget/embedded/src/containers/WidgetProvider/WidgetProvider.tsx +++ b/widget/embedded/src/containers/WidgetProvider/WidgetProvider.tsx @@ -1,7 +1,6 @@ import type { PropTypes } from './WidgetProvider.types'; import type { PropsWithChildren } from 'react'; -import { setEvmSignerConfig } from '@rango-dev/signer-evm'; import { setSolanaSignerConfig } from '@rango-dev/signer-solana'; import React, { useEffect, useMemo } from 'react'; @@ -54,12 +53,6 @@ export function WidgetProvider(props: PropsWithChildren) { } }, [props.config?.signers?.customSolanaRPC]); - useEffect(() => { - if (props.config?.signers?.customEthereumRPC) { - setEvmSignerConfig('customRPC', props.config.signers.customEthereumRPC); - } - }, [props.config?.signers?.customEthereumRPC]); - return ( [0]) => + rpcURLsFromConfig(config).evm?.map(({ chain, rpcUrls }) => [ + chain.id, + rpcUrls, + ]); + +describe('rpcURLsFromConfig', () => { + test('passes no urls when none are configured', () => { + expect(rpcURLsFromConfig({ apiKey: '' })).toEqual({}); + }); + + test('takes EVM urls per chain from rpcUrls', () => { + expect( + urlsByChain({ + apiKey: '', + rpcUrls: { evm: { [BSC_CHAIN_ID]: ['https://bsc.example'] } }, + }) + ).toEqual([[BSC_CHAIN_ID, ['https://bsc.example']]]); + }); + + test('tries customEthereumRPC first on Ethereum', () => { + expect( + urlsByChain({ + apiKey: '', + signers: { customEthereumRPC: 'https://custom.eth' }, + rpcUrls: { evm: { 1: ['https://eth.example'] } }, + }) + ).toEqual([[1, ['https://custom.eth', 'https://eth.example']]]); + + expect( + urlsByChain({ + apiKey: '', + signers: { customEthereumRPC: 'https://custom.eth' }, + }) + ).toEqual([[1, ['https://custom.eth']]]); + }); +}); diff --git a/widget/embedded/src/store/slices/config.ts b/widget/embedded/src/store/slices/config.ts index 4d3e272475..8d57c65091 100644 --- a/widget/embedded/src/store/slices/config.ts +++ b/widget/embedded/src/store/slices/config.ts @@ -9,7 +9,7 @@ import type { Provider } from '@hub3js/core'; import { allProviders as getAllProviders, - RPC_URLS, + toNamespacesRPCUrls, WalletTypes, } from '@rango-dev/provider-all'; @@ -20,6 +20,8 @@ import { } from '../../utils/providers'; import { matchTokensFromConfigWithMeta } from '../utils'; +const ETHEREUM_CHAIN_ID = 1; + function makeProvidersOptionsFromConfig( config: WidgetConfig ): ProvidersOptions { @@ -83,11 +85,31 @@ export interface ConfigSlice { getAvailableProviders: () => Provider[]; } +/** + * The RPC urls from the config, with `signers.customEthereumRPC` tried first on + * Ethereum. Providers get them when they're built, so they never fall back to + * an RPC the dapp didn't configure. + */ +export function rpcURLsFromConfig(config: WidgetConfigWithoutLegacyProviders) { + const evm = { ...config.rpcUrls?.evm }; + const customEthereumRPC = config.signers?.customEthereumRPC; + + if (customEthereumRPC) { + evm[ETHEREUM_CHAIN_ID] = [ + customEthereumRPC, + ...(evm[ETHEREUM_CHAIN_ID] ?? []), + ]; + } + + return toNamespacesRPCUrls({ ...config.rpcUrls, evm }); +} + function generateProviders( config: WidgetConfigWithoutLegacyProviders ): Provider[] { const allProviders = getAllProviders(); - const allBuiltProviders = allProviders.map((build) => build(RPC_URLS)); + const rpcURLs = rpcURLsFromConfig(config); + const allBuiltProviders = allProviders.map((build) => build(rpcURLs)); return allBuiltProviders.filter((provider) => hasRequiredConfig(provider.id, config) diff --git a/widget/embedded/src/types/config.ts b/widget/embedded/src/types/config.ts index e9be5b99b8..8b7e7ebe71 100644 --- a/widget/embedded/src/types/config.ts +++ b/widget/embedded/src/types/config.ts @@ -1,4 +1,5 @@ import type { Provider, WalletType } from '@hub3js/core'; +import type { RpcUrlsConfig } from '@rango-dev/provider-all'; import type { Language, theme } from '@rango-dev/ui'; import type { ProviderInterface } from '@rango-dev/wallets-react'; import type { Asset } from 'rango-sdk'; @@ -114,6 +115,7 @@ export type BlockchainAndTokenConfig = { * * @property {string | string[]} customSolanaRPC - This is an optional property that can be used to set custom Solana RPCs. * @property {string} customEthereumRPC - This is an optional property that can be used to set a custom Ethereum RPC. + * It's tried first for chain 1, before any url in `rpcUrls.evm`. */ export type SignersConfig = { customSolanaRPC?: string | string[]; @@ -258,6 +260,10 @@ export type LedgerWalletConfig = { * - 'avoidNativeFee': If you want to exclude swappers that have native tokens as fee, for example when you are using an AA account, you could set this parameter. * - 'experimental': Use this parameter to enable experimental routes. This settings shouldn't be used in your production environment. * - 'enableCentralizedSwappers': If you want to enable routing from the centralized protocols like XO Swap, you could set this parameter. + * @property {RpcUrlsConfig} rpcUrls - Optional RPC urls that wallets without an RPC of their own + * (e.g. Ledger and Trezor) read the chain through. EVM urls are keyed by chain id, e.g. + * `{ evm: { 1: ['https://…'], 56: ['https://…'] } }`. `signers.customEthereumRPC`, if set, is tried + * first for chain 1. Reads on a chain without urls fail. * @property {WidgetVariant} variant * If it is expanded, multiple routes will show up on the home page; * If it is full-expanded, multiple routes will show up on the home page with full routes; @@ -292,6 +298,7 @@ export type WidgetConfig = { features?: Features; variant?: WidgetVariant; signers?: SignersConfig; + rpcUrls?: RpcUrlsConfig; // These are likely to change or remove at anytime. Please use with a caution. __UNSTABLE_OR_INTERNAL__?: { walletConnectListedDesktopWalletLink?: string; diff --git a/widget/playground/src/containers/FunctionalLayout/FunctionalLayout.utils.ts b/widget/playground/src/containers/FunctionalLayout/FunctionalLayout.utils.ts index cb7633cb84..f94771bf33 100644 --- a/widget/playground/src/containers/FunctionalLayout/FunctionalLayout.utils.ts +++ b/widget/playground/src/containers/FunctionalLayout/FunctionalLayout.utils.ts @@ -3,10 +3,7 @@ import type { Provider } from '@hub3js/core'; import type { BlockchainMeta } from 'rango-sdk'; import { getSupportedChainsFromProvider } from '@rango-dev/internal-blockchains'; -import { - allProviders as getAllProviders, - RPC_URLS, -} from '@rango-dev/provider-all'; +import { allProviders as getAllProviders } from '@rango-dev/provider-all'; import { getCategoryNetworks } from '../../utils/blockchains'; import { excludedWallets } from '../../utils/common'; @@ -16,7 +13,8 @@ export function getWalletsList( blockchains: BlockchainMeta[] ): MapSupportedList[] { const allProviders = getAllProviders(); - const allBuiltProviders = allProviders.map((build) => build(RPC_URLS)); + // Built only to read each wallet's info, so no RPC urls are needed. + const allBuiltProviders = allProviders.map((build) => build()); const walletsList: MapSupportedList[] = []; allBuiltProviders.forEach((provider: Provider) => { if (excludedWallets.includes(provider.id)) { From 0bdea50e44ef919aa30337c25088efd4582155ec Mon Sep 17 00:00:00 2001 From: arlert-armin Date: Tue, 3 Nov 2026 18:32:23 +0000 Subject: [PATCH 20/29] test(wallets): check safe's own signMessage wins over the viem adapter's viemWalletAdapter registers `signMessage` too, which would sign through the wallet's personal_sign. Providers register their own actions after the adapter, so the provider's version wins. The test fails if Safe's adapter is moved after its own actions. --- .../provider-safe/src/namespaces/evm.test.ts | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 wallets/provider-safe/src/namespaces/evm.test.ts diff --git a/wallets/provider-safe/src/namespaces/evm.test.ts b/wallets/provider-safe/src/namespaces/evm.test.ts new file mode 100644 index 0000000000..01890b8254 --- /dev/null +++ b/wallets/provider-safe/src/namespaces/evm.test.ts @@ -0,0 +1,49 @@ +import { beforeEach, describe, expect, test, vi } from 'vitest'; + +const SAFE_SIGNATURE = '0x5afe'; +const ACCOUNT = '0x1111111111111111111111111111111111111111'; + +const safeSdk = vi.hoisted(() => ({ + txs: { signMessage: vi.fn() }, +})); +const walletRequest = vi.hoisted(() => vi.fn()); + +vi.mock('../safe.js', () => ({ sdk: safeSdk })); +vi.mock('../utils.js', () => ({ + evmSafe: () => ({ request: walletRequest }), + getSafeAccounts: vi.fn(), +})); + +const { evm } = await import('./evm.js'); + +describe('Safe EVM namespace', () => { + beforeEach(() => { + vi.clearAllMocks(); + safeSdk.txs.signMessage.mockResolvedValue({ signature: SAFE_SIGNATURE }); + }); + + /* + * viemWalletAdapter registers a `signMessage` too, which would sign through + * the wallet's EIP-1193 `personal_sign`. Safe's own action is registered + * after the adapter, so it has to win. + */ + test("signs messages with Safe's own action, not the viem adapter's", async () => { + const signature = await evm.signMessage({ + account: ACCOUNT, + message: 'hello', + }); + + expect(signature).toBe(SAFE_SIGNATURE); + expect(safeSdk.txs.signMessage).toHaveBeenCalledWith('hello'); + expect(walletRequest).not.toHaveBeenCalled(); + }); + + test("keeps viem's wallet actions that Safe doesn't define", async () => { + walletRequest.mockResolvedValue('0x10'); + + await expect(evm.getBlockNumber()).resolves.toBe(BigInt('0x10')); + expect(walletRequest).toHaveBeenCalledWith( + expect.objectContaining({ method: 'eth_blockNumber' }) + ); + }); +}); From be8a22514bf7b16069a2f955c8b2f035d13b1851 Mon Sep 17 00:00:00 2001 From: arlert-armin Date: Mon, 9 Nov 2026 09:47:54 +0000 Subject: [PATCH 21/29] chore: pin hub3 evm and namespaces to their next prereleases instead of experimental builds --- blockchains/internal-blockchains/package.json | 2 +- queue-manager/rango-preset/package.json | 2 +- wallets/provider-all/package.json | 8 +- wallets/provider-binance/package.json | 8 +- wallets/provider-bitget/package.json | 8 +- wallets/provider-braavos/package.json | 4 +- wallets/provider-brave/package.json | 8 +- wallets/provider-coin98/package.json | 8 +- wallets/provider-coinbase/package.json | 8 +- wallets/provider-default/package.json | 8 +- wallets/provider-enkrypt/package.json | 8 +- wallets/provider-exodus/package.json | 8 +- wallets/provider-ledger-wallet/package.json | 4 +- wallets/provider-ledger/package.json | 8 +- wallets/provider-math-wallet/package.json | 8 +- wallets/provider-metamask/package.json | 8 +- wallets/provider-okx/package.json | 8 +- wallets/provider-phantom/package.json | 8 +- wallets/provider-rabby/package.json | 8 +- wallets/provider-ready/package.json | 4 +- wallets/provider-safe/package.json | 4 +- wallets/provider-safepal/package.json | 8 +- wallets/provider-solflare/package.json | 4 +- wallets/provider-taho/package.json | 8 +- wallets/provider-tokenpocket/package.json | 8 +- wallets/provider-tomo/package.json | 8 +- wallets/provider-tonconnect/package.json | 4 +- wallets/provider-trezor/package.json | 4 +- wallets/provider-tron-link/package.json | 4 +- wallets/provider-trustwallet/package.json | 8 +- wallets/provider-unisat/package.json | 4 +- wallets/provider-vultisig/package.json | 4 +- wallets/provider-walletconnect-2/package.json | 4 +- wallets/provider-xverse/package.json | 4 +- wallets/react/package.json | 4 +- widget/embedded/package.json | 4 +- yarn.lock | 118 +++--------------- 37 files changed, 129 insertions(+), 209 deletions(-) diff --git a/blockchains/internal-blockchains/package.json b/blockchains/internal-blockchains/package.json index 4fc034f0b1..b68b5fa069 100644 --- a/blockchains/internal-blockchains/package.json +++ b/blockchains/internal-blockchains/package.json @@ -29,7 +29,7 @@ }, "dependencies": { "@hub3js/bip122": "^0.4.0", - "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/evm": "0.8.1-next.1", "@hub3js/solana": "^0.7.0", "@hub3js/starknet": "^0.6.0", "@hub3js/stellar": "^0.6.0", diff --git a/queue-manager/rango-preset/package.json b/queue-manager/rango-preset/package.json index 97434e242f..b7f843260c 100644 --- a/queue-manager/rango-preset/package.json +++ b/queue-manager/rango-preset/package.json @@ -36,7 +36,7 @@ }, "dependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/stellar": "^0.6.0", "@hub3js/xrpl": "^0.6.0", "@rango-dev/internal-blockchains": "^0.3.1-next.1", diff --git a/wallets/provider-all/package.json b/wallets/provider-all/package.json index 1b5c53734a..6a0d440ea6 100644 --- a/wallets/provider-all/package.json +++ b/wallets/provider-all/package.json @@ -61,8 +61,8 @@ "devDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", - "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/evm": "0.8.1-next.1", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/solana": "^0.7.0", "@hub3js/starknet": "^0.6.0", "@hub3js/std": "^0.6.0", @@ -75,8 +75,8 @@ "peerDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", - "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/evm": "0.8.1-next.1", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/solana": "^0.7.0", "@hub3js/starknet": "^0.6.0", "@hub3js/std": "^0.6.0", diff --git a/wallets/provider-binance/package.json b/wallets/provider-binance/package.json index 44d678deba..6d4a3ed047 100644 --- a/wallets/provider-binance/package.json +++ b/wallets/provider-binance/package.json @@ -26,14 +26,14 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", - "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/evm": "0.8.1-next.1", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", - "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/evm": "0.8.1-next.1", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0" }, "publishConfig": { diff --git a/wallets/provider-bitget/package.json b/wallets/provider-bitget/package.json index a1a4139107..7e98f27b57 100644 --- a/wallets/provider-bitget/package.json +++ b/wallets/provider-bitget/package.json @@ -31,16 +31,16 @@ "devDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", - "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/evm": "0.8.1-next.1", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0", "@hub3js/tron": "^0.3.0" }, "peerDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", - "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/evm": "0.8.1-next.1", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0", "@hub3js/tron": "^0.3.0" }, diff --git a/wallets/provider-braavos/package.json b/wallets/provider-braavos/package.json index 714360d8f1..5d3afffeb3 100644 --- a/wallets/provider-braavos/package.json +++ b/wallets/provider-braavos/package.json @@ -27,13 +27,13 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/starknet": "^0.6.0", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/starknet": "^0.6.0", "@hub3js/std": "^0.6.0" }, diff --git a/wallets/provider-brave/package.json b/wallets/provider-brave/package.json index f6dd6e5b3c..fc47828ba0 100644 --- a/wallets/provider-brave/package.json +++ b/wallets/provider-brave/package.json @@ -27,15 +27,15 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", - "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/evm": "0.8.1-next.1", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", - "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/evm": "0.8.1-next.1", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, diff --git a/wallets/provider-coin98/package.json b/wallets/provider-coin98/package.json index dbf5eca49b..7d391f6329 100644 --- a/wallets/provider-coin98/package.json +++ b/wallets/provider-coin98/package.json @@ -29,15 +29,15 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", - "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/evm": "0.8.1-next.1", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", - "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/evm": "0.8.1-next.1", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, diff --git a/wallets/provider-coinbase/package.json b/wallets/provider-coinbase/package.json index 8eb66a4b24..7873112d7d 100644 --- a/wallets/provider-coinbase/package.json +++ b/wallets/provider-coinbase/package.json @@ -28,15 +28,15 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", - "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/evm": "0.8.1-next.1", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", - "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/evm": "0.8.1-next.1", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, diff --git a/wallets/provider-default/package.json b/wallets/provider-default/package.json index 101dae88e6..dec1959dd7 100644 --- a/wallets/provider-default/package.json +++ b/wallets/provider-default/package.json @@ -26,14 +26,14 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", - "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/evm": "0.8.1-next.1", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", - "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/evm": "0.8.1-next.1", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0" }, "publishConfig": { diff --git a/wallets/provider-enkrypt/package.json b/wallets/provider-enkrypt/package.json index afffc3123a..ac5d5857bd 100644 --- a/wallets/provider-enkrypt/package.json +++ b/wallets/provider-enkrypt/package.json @@ -26,14 +26,14 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", - "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/evm": "0.8.1-next.1", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", - "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/evm": "0.8.1-next.1", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0" }, "publishConfig": { diff --git a/wallets/provider-exodus/package.json b/wallets/provider-exodus/package.json index 6099aa8393..eecb77a25a 100644 --- a/wallets/provider-exodus/package.json +++ b/wallets/provider-exodus/package.json @@ -28,15 +28,15 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", - "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/evm": "0.8.1-next.1", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", - "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/evm": "0.8.1-next.1", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, diff --git a/wallets/provider-ledger-wallet/package.json b/wallets/provider-ledger-wallet/package.json index 5df289259e..b7c8eb56a0 100644 --- a/wallets/provider-ledger-wallet/package.json +++ b/wallets/provider-ledger-wallet/package.json @@ -26,12 +26,12 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/evm": "0.8.1-next.1", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/evm": "0.8.1-next.1", "@hub3js/std": "^0.6.0" }, "publishConfig": { diff --git a/wallets/provider-ledger/package.json b/wallets/provider-ledger/package.json index 137b961065..387d502986 100644 --- a/wallets/provider-ledger/package.json +++ b/wallets/provider-ledger/package.json @@ -38,15 +38,15 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", - "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/evm": "0.8.1-next.1", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", - "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/evm": "0.8.1-next.1", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, diff --git a/wallets/provider-math-wallet/package.json b/wallets/provider-math-wallet/package.json index a5913be3c2..9d7b173fb4 100644 --- a/wallets/provider-math-wallet/package.json +++ b/wallets/provider-math-wallet/package.json @@ -27,15 +27,15 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", - "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/evm": "0.8.1-next.1", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", - "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/evm": "0.8.1-next.1", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, diff --git a/wallets/provider-metamask/package.json b/wallets/provider-metamask/package.json index fb67c91649..1d6f9ca870 100644 --- a/wallets/provider-metamask/package.json +++ b/wallets/provider-metamask/package.json @@ -29,8 +29,8 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", - "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/evm": "0.8.1-next.1", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0", "@solana/wallet-standard-features": "^1.3.0", @@ -39,8 +39,8 @@ }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", - "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/evm": "0.8.1-next.1", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, diff --git a/wallets/provider-okx/package.json b/wallets/provider-okx/package.json index 79966cb40f..70633b948d 100644 --- a/wallets/provider-okx/package.json +++ b/wallets/provider-okx/package.json @@ -34,8 +34,8 @@ "devDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", - "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/evm": "0.8.1-next.1", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0", "@hub3js/sui": "^0.6.0", @@ -45,8 +45,8 @@ "peerDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", - "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/evm": "0.8.1-next.1", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0", "@hub3js/sui": "^0.6.0", diff --git a/wallets/provider-phantom/package.json b/wallets/provider-phantom/package.json index 3dbbafebe0..09d38099e3 100644 --- a/wallets/provider-phantom/package.json +++ b/wallets/provider-phantom/package.json @@ -33,16 +33,16 @@ "devDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", - "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/evm": "0.8.1-next.1", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", - "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/evm": "0.8.1-next.1", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, diff --git a/wallets/provider-rabby/package.json b/wallets/provider-rabby/package.json index 59685e7e0b..61dad3bcce 100644 --- a/wallets/provider-rabby/package.json +++ b/wallets/provider-rabby/package.json @@ -26,14 +26,14 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", - "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/evm": "0.8.1-next.1", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", - "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/evm": "0.8.1-next.1", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0" }, "publishConfig": { diff --git a/wallets/provider-ready/package.json b/wallets/provider-ready/package.json index 9976c0b6a3..8fa53e2002 100644 --- a/wallets/provider-ready/package.json +++ b/wallets/provider-ready/package.json @@ -27,13 +27,13 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/starknet": "^0.6.0", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/starknet": "^0.6.0", "@hub3js/std": "^0.6.0" }, diff --git a/wallets/provider-safe/package.json b/wallets/provider-safe/package.json index a83cf15588..ac140be43f 100644 --- a/wallets/provider-safe/package.json +++ b/wallets/provider-safe/package.json @@ -27,12 +27,12 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/evm": "0.8.1-next.1", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/evm": "0.8.1-next.1", "@hub3js/std": "^0.6.0" }, "publishConfig": { diff --git a/wallets/provider-safepal/package.json b/wallets/provider-safepal/package.json index 2c1fb7cc67..06cf6bd876 100644 --- a/wallets/provider-safepal/package.json +++ b/wallets/provider-safepal/package.json @@ -28,14 +28,14 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", - "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/evm": "0.8.1-next.1", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", - "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/evm": "0.8.1-next.1", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0" }, "publishConfig": { diff --git a/wallets/provider-solflare/package.json b/wallets/provider-solflare/package.json index 07ef479b5b..a06befa2c6 100644 --- a/wallets/provider-solflare/package.json +++ b/wallets/provider-solflare/package.json @@ -29,13 +29,13 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, diff --git a/wallets/provider-taho/package.json b/wallets/provider-taho/package.json index 472168a10f..d7f5847e27 100644 --- a/wallets/provider-taho/package.json +++ b/wallets/provider-taho/package.json @@ -26,14 +26,14 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", - "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/evm": "0.8.1-next.1", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", - "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/evm": "0.8.1-next.1", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0" }, "publishConfig": { diff --git a/wallets/provider-tokenpocket/package.json b/wallets/provider-tokenpocket/package.json index 6a30cecfe8..441defdd0b 100644 --- a/wallets/provider-tokenpocket/package.json +++ b/wallets/provider-tokenpocket/package.json @@ -26,14 +26,14 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", - "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/evm": "0.8.1-next.1", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", - "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/evm": "0.8.1-next.1", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0" }, "publishConfig": { diff --git a/wallets/provider-tomo/package.json b/wallets/provider-tomo/package.json index beefdf6d21..a88aa0a9bb 100644 --- a/wallets/provider-tomo/package.json +++ b/wallets/provider-tomo/package.json @@ -26,14 +26,14 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", - "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/evm": "0.8.1-next.1", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", - "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/evm": "0.8.1-next.1", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0" }, "publishConfig": { diff --git a/wallets/provider-tonconnect/package.json b/wallets/provider-tonconnect/package.json index 8b3f8b6fd1..f039c8884a 100644 --- a/wallets/provider-tonconnect/package.json +++ b/wallets/provider-tonconnect/package.json @@ -30,13 +30,13 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0", "@hub3js/tvm": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0", "@hub3js/tvm": "^0.6.0" }, diff --git a/wallets/provider-trezor/package.json b/wallets/provider-trezor/package.json index 717651ff82..64c60401c1 100644 --- a/wallets/provider-trezor/package.json +++ b/wallets/provider-trezor/package.json @@ -33,13 +33,13 @@ "devDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/evm": "0.8.1-next.1", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/evm": "0.8.1-next.1", "@hub3js/std": "^0.6.0" }, "publishConfig": { diff --git a/wallets/provider-tron-link/package.json b/wallets/provider-tron-link/package.json index f088a51c79..133e36718f 100644 --- a/wallets/provider-tron-link/package.json +++ b/wallets/provider-tron-link/package.json @@ -27,13 +27,13 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0", "@hub3js/tron": "^0.3.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0", "@hub3js/tron": "^0.3.0" }, diff --git a/wallets/provider-trustwallet/package.json b/wallets/provider-trustwallet/package.json index a2ca8f1a02..fa978fef99 100644 --- a/wallets/provider-trustwallet/package.json +++ b/wallets/provider-trustwallet/package.json @@ -28,15 +28,15 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", - "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/evm": "0.8.1-next.1", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", - "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/evm": "0.8.1-next.1", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, diff --git a/wallets/provider-unisat/package.json b/wallets/provider-unisat/package.json index 94184ff5b8..c306d70f86 100644 --- a/wallets/provider-unisat/package.json +++ b/wallets/provider-unisat/package.json @@ -30,13 +30,13 @@ "devDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0" }, "publishConfig": { diff --git a/wallets/provider-vultisig/package.json b/wallets/provider-vultisig/package.json index d89fe55f66..79c9fe571b 100644 --- a/wallets/provider-vultisig/package.json +++ b/wallets/provider-vultisig/package.json @@ -28,13 +28,13 @@ "devDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0" }, "publishConfig": { diff --git a/wallets/provider-walletconnect-2/package.json b/wallets/provider-walletconnect-2/package.json index d3e52d964a..fde2d1986b 100644 --- a/wallets/provider-walletconnect-2/package.json +++ b/wallets/provider-walletconnect-2/package.json @@ -40,14 +40,14 @@ "devDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/evm": "0.8.1-next.1", "@hub3js/std": "^0.6.0", "@walletconnect/types": "2.23.7" }, "peerDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/evm": "0.8.1-next.1", "@hub3js/std": "^0.6.0" }, "publishConfig": { diff --git a/wallets/provider-xverse/package.json b/wallets/provider-xverse/package.json index 9fba70667b..a21b2f93aa 100644 --- a/wallets/provider-xverse/package.json +++ b/wallets/provider-xverse/package.json @@ -28,13 +28,13 @@ "devDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0" }, "publishConfig": { diff --git a/wallets/react/package.json b/wallets/react/package.json index e0223b2e96..99894e5fa8 100644 --- a/wallets/react/package.json +++ b/wallets/react/package.json @@ -33,8 +33,8 @@ "dependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", - "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/evm": "0.8.1-next.1", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0", "@hub3js/sui": "^0.6.0", diff --git a/widget/embedded/package.json b/widget/embedded/package.json index fa3440ca7f..494dc93275 100644 --- a/widget/embedded/package.json +++ b/widget/embedded/package.json @@ -25,8 +25,8 @@ "dependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1c5b27eb-20261024", - "@hub3js/namespaces": "0.0.0-experimental-1c5b27eb-20261024", + "@hub3js/evm": "0.8.1-next.1", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/solana": "^0.7.0", "@hub3js/starknet": "^0.6.0", "@hub3js/std": "^0.6.0", diff --git a/yarn.lock b/yarn.lock index 7b807588f5..eed52d9fdb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2910,14 +2910,6 @@ resolved "https://registry.yarnpkg.com/@graphql-typed-document-node/core/-/core-3.2.0.tgz#5f3d96ec6b2354ad6d8a28bf216a1d97b5426861" integrity sha512-mB9oAsNCm9aM3/SOv4YtBMqZbYj10R7dkq8byBqxGY/ncFwhf2oQzMV+LCRlWoDSEBJ3COiR1yeDvMtsoOsuFQ== -"@hub3js/bip122@^0.3.0": - version "0.3.0" - resolved "https://registry.yarnpkg.com/@hub3js/bip122/-/bip122-0.3.0.tgz#1158fbd1a791c9073120a6691bdade5f6217ae94" - integrity sha512-PMhpx1XdvwTlU5GABV8/0PUR+3wUDlsaQzHZl4jFmW+ncs9y3YyV2mMYsGEY2mSYZekkBAEirRjiRKtuC6V1IQ== - dependencies: - "@hub3js/std" "^0.5.0" - caip "^1.1.1" - "@hub3js/bip122@^0.4.0": version "0.4.0" resolved "https://registry.yarnpkg.com/@hub3js/bip122/-/bip122-0.4.0.tgz#c5d32e5ed612e881f67116d8e2c3366f6d1ba590" @@ -2935,39 +2927,30 @@ rango-types "^0.6.0" zustand "^4.5.2" -"@hub3js/evm@0.0.0-experimental-1c5b27eb-20261024", "@hub3js/evm@^0.0.0-experimental-1c5b27eb-20261024": - version "0.0.0-experimental-1c5b27eb-20261024" - resolved "https://registry.yarnpkg.com/@hub3js/evm/-/evm-0.0.0-experimental-1c5b27eb-20261024.tgz#3237f6bb6f7c0344c9c639c4e2a70ff0126d6349" - integrity sha512-a94smFzrghCtHXXJ0ddjHxWH1ZT7cubkGf1JJmQZoP8/QYZzJRmOS5znhLTLNaCLbvTL7Al0yeKvXabVuz9CoA== +"@hub3js/evm@0.8.1-next.1", "@hub3js/evm@^0.8.1-next.1": + version "0.8.1-next.1" + resolved "https://registry.yarnpkg.com/@hub3js/evm/-/evm-0.8.1-next.1.tgz#56708f95bd514156ae07626f85943453949eef3d" + integrity sha512-PjrCgiV6oixYA/2bQ5TcP4seNBN7znHOEa8eryiEYAfPawf1Z90I2GXbHTNEPz3sl4GIOnFNkkeZhW4UMSIyTg== dependencies: - "@hub3js/std" "^0.5.0" + "@hub3js/std" "^0.6.0" caip "^1.1.1" rango-types "^0.6.0" viem "^2.56.8" -"@hub3js/namespaces@0.0.0-experimental-1c5b27eb-20261024": - version "0.0.0-experimental-1c5b27eb-20261024" - resolved "https://registry.yarnpkg.com/@hub3js/namespaces/-/namespaces-0.0.0-experimental-1c5b27eb-20261024.tgz#3666d9bdf13736b4274fae4700b07baf4f0b84c9" - integrity sha512-ysIeLRX2MlFbOCHM9r/bvjksBOI1p4Kuupih6xqrnuh/BfD2mL+VT78CfQUO+nnM43TpthlS2KBN8MWk80bh2Q== - dependencies: - "@hub3js/bip122" "^0.3.0" - "@hub3js/evm" "^0.0.0-experimental-1c5b27eb-20261024" - "@hub3js/solana" "^0.6.0" - "@hub3js/starknet" "^0.5.0" - "@hub3js/stellar" "^0.5.0" - "@hub3js/sui" "^0.5.0" - "@hub3js/tron" "^0.2.0" - "@hub3js/tvm" "^0.5.0" - "@hub3js/xrpl" "^0.5.0" - -"@hub3js/solana@^0.6.0": - version "0.6.0" - resolved "https://registry.yarnpkg.com/@hub3js/solana/-/solana-0.6.0.tgz#20c480725db4ddd0c40e24e727d3587e11f37e54" - integrity sha512-kFVmHnvFWL9zdiB/QHpIHJVQ0UGO4cKR+sMFQaCTsycni7ZMwBgvcuRInAtM7ZDwpt823ZRadQgsk7z5uwl0Bg== - dependencies: - "@hub3js/std" "^0.5.0" - caip "^1.1.1" - rango-types "^0.6.0" +"@hub3js/namespaces@0.8.1-next.1": + version "0.8.1-next.1" + resolved "https://registry.yarnpkg.com/@hub3js/namespaces/-/namespaces-0.8.1-next.1.tgz#94bf15efa7ac57e5d87b8902c5c27ab9389d9a99" + integrity sha512-mnd/zARrhBdySL8QI+twBoZGcQCccGQ5BDtdebUn3PISMMn2x6MXzAMS696S08Ls3EEdbmnhtLB3/j8tyD+1Yg== + dependencies: + "@hub3js/bip122" "^0.4.0" + "@hub3js/evm" "^0.8.1-next.1" + "@hub3js/solana" "^0.7.0" + "@hub3js/starknet" "^0.6.0" + "@hub3js/stellar" "^0.6.0" + "@hub3js/sui" "^0.6.0" + "@hub3js/tron" "^0.3.0" + "@hub3js/tvm" "^0.6.0" + "@hub3js/xrpl" "^0.6.0" "@hub3js/solana@^0.7.0": version "0.7.0" @@ -2978,15 +2961,6 @@ caip "^1.1.1" rango-types "^0.6.0" -"@hub3js/starknet@^0.5.0": - version "0.5.0" - resolved "https://registry.yarnpkg.com/@hub3js/starknet/-/starknet-0.5.0.tgz#acb444d9d74871d6a6fbbb1885aa551d8721ee8d" - integrity sha512-CUilSgF57CPD5+Ajf+Gg+cpRmW2VG2pjmYK6NJBSYT5IvTjbnZrfbv/0zosw00AeB1hlzCIzWoSO29Nxl0ztTA== - dependencies: - "@hub3js/std" "^0.5.0" - caip "^1.1.1" - rango-types "^0.6.0" - "@hub3js/starknet@^0.6.0": version "0.6.0" resolved "https://registry.yarnpkg.com/@hub3js/starknet/-/starknet-0.6.0.tgz#57e8c3efbc25101e9ae128bd124850539397f458" @@ -2996,13 +2970,6 @@ caip "^1.1.1" rango-types "^0.6.0" -"@hub3js/std@^0.5.0": - version "0.5.0" - resolved "https://registry.yarnpkg.com/@hub3js/std/-/std-0.5.0.tgz#a9d966917e29f2db8c0f540a785fde74695de184" - integrity sha512-LMYJA04C/hTHfV8CGh9WmW8s9gwK9oWRh5Eosiyl7/T8ORMQX9TOWPbNoVZuS2S78a4Z6XRcrUZs8toI0qqAIw== - dependencies: - caip "^1.1.1" - "@hub3js/std@^0.6.0": version "0.6.0" resolved "https://registry.yarnpkg.com/@hub3js/std/-/std-0.6.0.tgz#ad6e82c52345775260583016b9c6b9ff9e1475ea" @@ -3010,16 +2977,6 @@ dependencies: caip "^1.1.1" -"@hub3js/stellar@^0.5.0": - version "0.5.0" - resolved "https://registry.yarnpkg.com/@hub3js/stellar/-/stellar-0.5.0.tgz#b3e55ca7bad07efff3fb6d6ed961f5cc233b26ae" - integrity sha512-dFTcSsU+WohSnhTOCtPFQ531/stNV79ezXW1FMKSuztah1+9T+FROGFpD9ewF0Hoxf12DHUVGazkSoCsEQ4ZaQ== - dependencies: - "@hub3js/std" "^0.5.0" - "@stellar/stellar-sdk" "^15.0.1" - caip "^1.1.1" - rango-types "^0.6.0" - "@hub3js/stellar@^0.6.0": version "0.6.0" resolved "https://registry.yarnpkg.com/@hub3js/stellar/-/stellar-0.6.0.tgz#7b9253f22579f2d5a5b5e5a7cbf7378bcaf1812e" @@ -3030,16 +2987,6 @@ caip "^1.1.1" rango-types "^0.6.0" -"@hub3js/sui@^0.5.0": - version "0.5.0" - resolved "https://registry.yarnpkg.com/@hub3js/sui/-/sui-0.5.0.tgz#c425a105a55c514097cb494fb3f4d4cff2397f47" - integrity sha512-V+05VN8dbAe3MnsV5DG2IJahP3XugE393bsGaIaxMz9aP6OAif8NCPTdsAqraNnJoJjEsajxP20XPXyEpPG/6w== - dependencies: - "@hub3js/std" "^0.5.0" - "@mysten/wallet-standard" "^0.13.26" - caip "^1.1.1" - rango-types "^0.6.0" - "@hub3js/sui@^0.6.0": version "0.6.0" resolved "https://registry.yarnpkg.com/@hub3js/sui/-/sui-0.6.0.tgz#a15f1d4b1e54e72adb8e7adb68ea90e78cd7e667" @@ -3050,14 +2997,6 @@ caip "^1.1.1" rango-types "^0.6.0" -"@hub3js/tron@^0.2.0": - version "0.2.0" - resolved "https://registry.yarnpkg.com/@hub3js/tron/-/tron-0.2.0.tgz#22bce9ba45fa9e9e8366dc12c4773d3a5d700985" - integrity sha512-qLFqqreoaB/q+lCPjCH+218oe4m4f2Fb2SfVFVTqBJywvASQj6nxzc60XxSjaSXow5wPdmDVVB7+X0+MkKakDw== - dependencies: - "@hub3js/std" "^0.5.0" - caip "^1.1.1" - "@hub3js/tron@^0.3.0": version "0.3.0" resolved "https://registry.yarnpkg.com/@hub3js/tron/-/tron-0.3.0.tgz#6a3331e3bddf489cd2ea171368579209b15a48a9" @@ -3066,15 +3005,6 @@ "@hub3js/std" "^0.6.0" caip "^1.1.1" -"@hub3js/tvm@^0.5.0": - version "0.5.0" - resolved "https://registry.yarnpkg.com/@hub3js/tvm/-/tvm-0.5.0.tgz#95e6f42d41975f79464e31ec42b66a7cc5c85454" - integrity sha512-DYnm41LrPxbMX8mqKhgTAWZkBt7g2CdvmV5wg+u/brkhcoLkF+G36ZN0TP/qGEtoAiohYkP+hm5Jb/NbbTKPNg== - dependencies: - "@hub3js/std" "^0.5.0" - caip "^1.1.1" - rango-types "^0.6.0" - "@hub3js/tvm@^0.6.0": version "0.6.0" resolved "https://registry.yarnpkg.com/@hub3js/tvm/-/tvm-0.6.0.tgz#56a16368b7fccac77302ef035c41d53d97a12dc5" @@ -3084,16 +3014,6 @@ caip "^1.1.1" rango-types "^0.6.0" -"@hub3js/xrpl@^0.5.0": - version "0.5.0" - resolved "https://registry.yarnpkg.com/@hub3js/xrpl/-/xrpl-0.5.0.tgz#42a0d0e19f0b0a37de563a65329a7b179659b066" - integrity sha512-tbthdAufnrOXyvz0I2CyhHRNEGypafavY+aFKXoEk8doQaDlcPhalxQnBnh3p7jcOmQTzhJYkXmc7OlCIH8tVg== - dependencies: - "@hub3js/std" "^0.5.0" - caip "^1.1.1" - rango-types "^0.6.0" - xrpl "^4.2.0" - "@hub3js/xrpl@^0.6.0": version "0.6.0" resolved "https://registry.yarnpkg.com/@hub3js/xrpl/-/xrpl-0.6.0.tgz#a86018d220bf7f1bbf58aedc9471a4a6a5f5f047" From 4b1c73e426dc14d2c178b5d6837d2d11d34dac0c Mon Sep 17 00:00:00 2001 From: arlert-armin Date: Mon, 9 Nov 2026 09:29:00 +0000 Subject: [PATCH 22/29] refactor(queue-manager): type hyperliquid typed data with the evm namespace's signTypedData params --- queue-manager/rango-preset/src/actions/common/evm.ts | 7 ++++++- .../src/actions/executeHyperliquidTransaction/types.ts | 10 ---------- .../src/actions/executeHyperliquidTransaction/utils.ts | 5 +++-- 3 files changed, 9 insertions(+), 13 deletions(-) delete mode 100644 queue-manager/rango-preset/src/actions/executeHyperliquidTransaction/types.ts diff --git a/queue-manager/rango-preset/src/actions/common/evm.ts b/queue-manager/rango-preset/src/actions/common/evm.ts index 2ae5908f99..14c2927efa 100644 --- a/queue-manager/rango-preset/src/actions/common/evm.ts +++ b/queue-manager/rango-preset/src/actions/common/evm.ts @@ -13,6 +13,11 @@ type SendTransactionParameters = NonNullable< type SignTypedDataParameters = NonNullable< Parameters[0] >; +/** + * EIP-712 typed data in the shape the EVM namespace's `signTypedData` (viem's) + * takes, without the signing account. + */ +export type EvmTypedData = Omit; /** * A namespace action some wallets add when the hash `sendTransaction` returns @@ -208,7 +213,7 @@ export async function sendEvmTransaction( */ export async function signEvmTypedData( namespace: EvmNamespace, - typedData: Omit, + typedData: EvmTypedData, address: string ): Promise<`0x${string}`> { try { diff --git a/queue-manager/rango-preset/src/actions/executeHyperliquidTransaction/types.ts b/queue-manager/rango-preset/src/actions/executeHyperliquidTransaction/types.ts deleted file mode 100644 index dc0922a492..0000000000 --- a/queue-manager/rango-preset/src/actions/executeHyperliquidTransaction/types.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * EIP-712 typed data in the shape viem's `signTypedData` takes. `types` holds - * only the primary type: `EIP712Domain` is derived from `domain`. - */ -export type HyperliquidTypedData = { - domain: Record; - types: Record; - primaryType: string; - message: Record; -}; diff --git a/queue-manager/rango-preset/src/actions/executeHyperliquidTransaction/utils.ts b/queue-manager/rango-preset/src/actions/executeHyperliquidTransaction/utils.ts index c3d1b67557..09b1ae75f1 100644 --- a/queue-manager/rango-preset/src/actions/executeHyperliquidTransaction/utils.ts +++ b/queue-manager/rango-preset/src/actions/executeHyperliquidTransaction/utils.ts @@ -1,5 +1,5 @@ /* eslint-disable @typescript-eslint/no-magic-numbers */ -import type { HyperliquidTypedData } from './types'; +import type { EvmTypedData } from '../common/evm'; import type { NextTransactionStateError } from '../common/produceNextStateForTransaction'; import type { HyperliquidTransaction, Transaction } from 'rango-sdk'; import type { Result } from 'ts-results'; @@ -58,9 +58,10 @@ export function ensureHyperliquidTransactionIsValid( export function getTypedDataFromMessage( message: string -): Result { +): Result { try { const typedData = JSON.parse(message); + // `types` holds only the primary type: `EIP712Domain` is derived from `domain`. return Ok({ domain: typedData.domain, types: { From 30c45ea79f036724102b24b2be669c9c14b35670 Mon Sep 17 00:00:00 2001 From: arlert-armin Date: Mon, 9 Nov 2026 09:30:35 +0000 Subject: [PATCH 23/29] refactor(queue-manager): make evm approvals send through the namespace by type --- .../src/actions/checkApprove/adapters/evm.ts | 3 +- .../src/actions/checkApprove/adapters/tron.ts | 3 +- .../src/actions/checkApprove/checkApprove.ts | 11 +++-- .../src/actions/checkApprove/types.ts | 48 ++++++++++++++----- 4 files changed, 47 insertions(+), 18 deletions(-) diff --git a/queue-manager/rango-preset/src/actions/checkApprove/adapters/evm.ts b/queue-manager/rango-preset/src/actions/checkApprove/adapters/evm.ts index 16776ab35b..d2e6a45f8d 100644 --- a/queue-manager/rango-preset/src/actions/checkApprove/adapters/evm.ts +++ b/queue-manager/rango-preset/src/actions/checkApprove/adapters/evm.ts @@ -36,7 +36,6 @@ function isReceiptNotFoundError(error: unknown): boolean { export const evmApproveAdapter: ApproveAdapter<'evm', EvmTransaction> = { prerequisiteType: EVM_APPROVE_TYPE, namespaceKey: 'evm', - signerTxType: TransactionType.EVM, isApprovePrerequisite: isEvmApprovePrerequisite, @@ -65,7 +64,7 @@ export const evmApproveAdapter: ApproveAdapter<'evm', EvmTransaction> = { }) ), - sendTransaction: sendEvmTransaction, + send: { through: 'namespace', sendTransaction: sendEvmTransaction }, getTransactionStatus: async ( namespace, diff --git a/queue-manager/rango-preset/src/actions/checkApprove/adapters/tron.ts b/queue-manager/rango-preset/src/actions/checkApprove/adapters/tron.ts index 537cdc5f87..e838f10e35 100644 --- a/queue-manager/rango-preset/src/actions/checkApprove/adapters/tron.ts +++ b/queue-manager/rango-preset/src/actions/checkApprove/adapters/tron.ts @@ -19,7 +19,8 @@ import { Err, Ok } from 'ts-results'; export const tronApproveAdapter: ApproveAdapter<'tron', TronTransaction> = { prerequisiteType: TRON_APPROVE_TYPE, namespaceKey: 'tron', - signerTxType: TransactionType.TRON, + // The Tron namespace has no signing actions yet. + send: { through: 'signer', txType: TransactionType.TRON }, isApprovePrerequisite: isTronApprovePrerequisite, diff --git a/queue-manager/rango-preset/src/actions/checkApprove/checkApprove.ts b/queue-manager/rango-preset/src/actions/checkApprove/checkApprove.ts index 7e094a7036..4ceaf1f9bc 100644 --- a/queue-manager/rango-preset/src/actions/checkApprove/checkApprove.ts +++ b/queue-manager/rango-preset/src/actions/checkApprove/checkApprove.ts @@ -2,6 +2,8 @@ import type { ApproveAdapter, ApproveCapableNamespaceId, ApprovePrerequisite, + NamespaceApproveSender, + SignerApproveSender, } from './types'; import type { SwapQueueContext, SwapStorage } from '../../types'; import type { NextTransactionStateError } from '../common/produceNextStateForTransaction'; @@ -203,9 +205,12 @@ export async function checkApprove< const chainId = meta.blockchains[unmetApproveMeta.prerequisite.blockChain]?.chainId; const walletAddress = getCurrentAddressOf(swap, currentStep); + const sender: + | NamespaceApproveSender + | SignerApproveSender = approveAdapter.send; const sendApproveTransaction = async (transaction: TTransaction) => { - if (approveAdapter.sendTransaction) { - return approveAdapter.sendTransaction( + if (sender.through === 'namespace') { + return sender.sendTransaction( namespace, transaction, walletAddress, @@ -214,7 +219,7 @@ export async function checkApprove< } const walletSigners = await getSigners(sourceWallet.walletType); const signer: GenericSigner = - walletSigners.getSigner(approveAdapter.signerTxType); + walletSigners.getSigner(sender.txType); return signer.signAndSendTx(transaction, walletAddress, chainId); }; diff --git a/queue-manager/rango-preset/src/actions/checkApprove/types.ts b/queue-manager/rango-preset/src/actions/checkApprove/types.ts index bf0296342a..955693683d 100644 --- a/queue-manager/rango-preset/src/actions/checkApprove/types.ts +++ b/queue-manager/rango-preset/src/actions/checkApprove/types.ts @@ -52,6 +52,40 @@ export type ExecutedApproveResult = Extract< { data: { executedTransactionHash: string } } >; +/** Sends the approve transaction through the wallet's namespace. */ +export type NamespaceApproveSender< + K extends ApproveCapableNamespaceId, + TTransaction extends Transaction +> = { + through: 'namespace'; + sendTransaction: ( + namespace: ApproveCapableNamespace, + transaction: TTransaction, + walletAddress: string, + chainId: string | null + ) => Promise<{ hash: string }>; +}; + +/** + * Sends the approve transaction through the wallet's signer for `txType`, for + * chains whose namespace can't sign yet. + */ +export type SignerApproveSender = { + through: 'signer'; + txType: TransactionType; +}; + +/** + * EVM approvals always go through the namespace; only other chains may still + * fall back to a signer. + */ +export type ApproveSender< + K extends ApproveCapableNamespaceId, + TTransaction extends Transaction +> = [K] extends ['evm'] + ? NamespaceApproveSender + : NamespaceApproveSender | SignerApproveSender; + /** * Per-chain strategy for the generic approve-prerequisite actions. Everything * that differs between EVM and Tron is captured here; the actions themselves are @@ -65,8 +99,6 @@ export interface ApproveAdapter< prerequisiteType: TransactionPrerequisiteType; /** The hub namespace key backing this chain, e.g. `'evm'` | `'tron'`. */ namespaceKey: K; - /** The signer transaction type used to sign the approve tx, when `sendTransaction` isn't set. */ - signerTxType: TransactionType; /** Type guard for this chain's approve prerequisite. */ isApprovePrerequisite: ( prerequisite: TransactionPrerequisite @@ -80,16 +112,8 @@ export interface ApproveAdapter< prerequisite: ApprovePrerequisite, namespace: ApproveCapableNamespace ) => Promise>; - /** - * Sends the approve transaction through the namespace. Without it, the - * wallet's signer for `signerTxType` sends it. - */ - sendTransaction?: ( - namespace: ApproveCapableNamespace, - transaction: TTransaction, - walletAddress: string, - chainId: string | null - ) => Promise<{ hash: string }>; + /** How the signed approve transaction is sent. */ + send: ApproveSender; /** Reads the on-chain status of a submitted approve transaction. */ getTransactionStatus: ( namespace: ApproveCapableNamespace, From f199844efaefa35dd4ec288bf14215116780cab3 Mon Sep 17 00:00:00 2001 From: arlert-armin Date: Mon, 9 Nov 2026 09:32:17 +0000 Subject: [PATCH 24/29] refactor(queue-manager): drop the server approval status check now that approvals are prerequisites --- .../rango-preset/src/actions/checkStatus.ts | 257 ++---------------- 1 file changed, 20 insertions(+), 237 deletions(-) diff --git a/queue-manager/rango-preset/src/actions/checkStatus.ts b/queue-manager/rango-preset/src/actions/checkStatus.ts index 87e69fe5c3..27a685e0a5 100644 --- a/queue-manager/rango-preset/src/actions/checkStatus.ts +++ b/queue-manager/rango-preset/src/actions/checkStatus.ts @@ -38,7 +38,6 @@ import { StepEventType, SwapActionTypes } from '../types'; import { waitForEvmTransaction } from './common/evm'; const INTERVAL_FOR_CHECK_STATUS = 5_000; -const INTERVAL_FOR_CHECK_APPROVAL = 5_000; type TransactionWaiter = ( txId: string, @@ -322,251 +321,35 @@ async function checkTransactionStatus({ } /** - * Subscribe to status of approval transaction by checking from server periodically. - * After getting the status, notify the user and schedule `SCHEDULE_NEXT_STEP`. + * Approvals now run as transaction prerequisites, which track their own status, + * so a step only waits for an approval here when it was saved by an older + * version that sent the server-built approve transaction. Its approve + * transaction is dropped and the step starts over: the prerequisite flow reads + * the allowance on-chain, so a mined approval isn't asked for again. */ -async function checkApprovalStatus({ +function restartLegacyApproval({ getStorage, setStorage, - next, schedule, - retry, - failed, - context, -}: ExecuterActions< - SwapStorage, - SwapActionTypes, - SwapQueueContext ->): Promise { + next, +}: ExecuterActions): void { const swap = getStorage().swapDetails; - const { meta } = context; - const { getTransactionDataByHash, setTransactionDataByHash } = - inMemoryTransactionsData(); - const checkApprovalStatusError = new Error('check approval status error'); - - const currentStep = getCurrentStep(swap); - if (!currentStep) { - console.log('ignore check status, current step is null'); - return; - } - const tx = getCurrentStepTx(currentStep); - - if (!currentStep?.executedTransactionId) { - return; - } - let txId = currentStep.executedTransactionId; - - let waitForTransaction: TransactionWaiter | null = null; - try { - waitForTransaction = await getTransactionWaiter(context, swap, currentStep); - // eslint-disable-next-line @typescript-eslint/no-unused-vars - } catch (error) { - /* - * wallet is not connected yet - * no need to do anything - */ - } - - try { - const { response: txResponse, receiptReceived } = - getTransactionDataByHash(txId); - // if wallet is connected, try to get transaction reciept - if (waitForTransaction && !receiptReceived) { - const chainId = - (tx?.blockChain && meta.blockchains?.[tx?.blockChain]?.chainId) || - undefined; - const { hash: updatedTxHash, response: updatedTxResponse } = - await waitForTransaction(txId, chainId, txResponse); - if (updatedTxHash !== txId) { - currentStep.executedTransactionId = - updatedTxHash || currentStep.executedTransactionId; - const currentStepNamespace = getCurrentNamespaceOf(swap, currentStep); - let explorerUrl: string | undefined; - const blockchainsMetaNotEmpty = !!Object.keys(meta.blockchains).length; - if (blockchainsMetaNotEmpty) { - explorerUrl = getScannerUrl( - currentStep.executedTransactionId, - currentStepNamespace.network, - meta.blockchains - ); - } - if (explorerUrl) { - if (currentStep.explorerUrl && currentStep.explorerUrl?.length >= 1) { - currentStep.explorerUrl[currentStep.explorerUrl.length - 1] = { - url: explorerUrl, - description: 'Replaced Approve', - }; - } - } - txId = currentStep.executedTransactionId; - if (updatedTxHash && updatedTxResponse) { - setTransactionDataByHash(updatedTxHash, { - response: updatedTxResponse, - }); - } - } else { - setTransactionDataByHash(updatedTxHash, { - receiptReceived: true, - }); - } - } - } catch (error) { - const { extraMessage, extraMessageDetail, extraMessageErrorCode } = - prettifyErrorMessage(error); - const updateResult = updateSwapStatus({ - getStorage, - setStorage, - nextStatus: 'failed', - nextStepStatus: 'failed', - message: extraMessage, - details: extraMessageDetail, - errorCode: extraMessageErrorCode, - }); - - const event = createStepFailedEvent( - swap, - extraMessage, - updateResult.failureType - ); - - notifier({ - event, - ...updateResult, - }); - warn(checkApprovalStatusError, { - tags: { - type: 'singer-error', - reason: event.reason, - reasonCode: event.reasonCode, - message: extraMessage, - messageDetail: extraMessageDetail, - pendingSwap: swap, - }, - context: SignerError.isSignerError(error) ? error.getErrorContext() : {}, - }); - return failed(); - } - - let isApproved = false; - const request: { requestId: string; txId?: string } = { - requestId: swap.requestId, - txId: currentStep.executedTransactionId, - }; - - try { - const response = await httpService().checkApproval( - request.requestId, - request.txId - ); - // If user cancel swap during check status api call, we should ignore check approval response - if (currentStep?.status === 'failed') { - return; - } - - isApproved = response.isApproved; - if ( - !isApproved && - (response.txStatus === 'failed' || response.txStatus === 'success') - ) { - let message, details; - if (response.txStatus === 'failed') { - message = 'Approve transaction failed'; - details = 'Smart contract approval tx failed in blockchain.'; - } else { - message = 'Not enough approval'; - if (response.requiredApprovedAmount && response.currentApprovedAmount) { - details = `Required approval: ${response.requiredApprovedAmount}, current approval: ${response.currentApprovedAmount}`; - } else { - details = `You still don't have enough approval for this swap.`; - } - } - /* - * approve transaction failed on - * we should fail the whole swap - */ - const updateResult = updateSwapStatus({ - getStorage, - setStorage, - nextStatus: 'failed', - nextStepStatus: 'failed', - errorCode: 'INSUFFICIENT_APPROVE', - message: message, - details: details, - }); - - const event = createStepFailedEvent( - swap, - message, - updateResult.failureType - ); - - notifier({ - event, - ...updateResult, - }); - - warn(checkApprovalStatusError, { - tags: { - type: 'approval-failed', - message: swap.extraMessage, - messageDetails: swap.extraMessageDetail, - pendingSwap: swap, - }, - }); - - failed(); - } else if (!isApproved) { - // it is needed to set notification after reloading the page - notifier({ - event: { type: StepEventType.CHECK_STATUS }, - swap, - step: currentStep, - }); - } - // eslint-disable-next-line @typescript-eslint/no-unused-vars - } catch (e) { - isApproved = false; - warn(checkApprovalStatusError, { - tags: { type: 'request-error', requestBody: request, pendingSwap: swap }, - }); - } - if (isApproved) { - currentStep.status = 'approved'; - swap.extraMessage = `Spending ${currentStep.fromSymbol} approved successfully.`; - swap.extraMessageDetail = null; - swap.extraMessageSeverity = MessageSeverity.success; - currentStep.evmApprovalTransaction = null; - currentStep.executedTransactionId = null; - currentStep.executedTransactionTime = null; - currentStep.starknetApprovalTransaction = null; - currentStep.tronApprovalTransaction = null; + const currentStep = getCurrentStep(swap)!; - setStorage({ - ...getStorage(), - swapDetails: swap, - }); + currentStep.status = 'created'; + currentStep.evmApprovalTransaction = null; + currentStep.starknetApprovalTransaction = null; + currentStep.tronApprovalTransaction = null; + currentStep.executedTransactionId = null; + currentStep.executedTransactionTime = null; - notifier({ - event: { type: StepEventType.APPROVAL_TX_SUCCEEDED }, - swap: swap, - step: currentStep, - }); - - schedule(SwapActionTypes.SCHEDULE_NEXT_STEP); - next(); - } else { - await delay(INTERVAL_FOR_CHECK_APPROVAL); - retry(); - } + setStorage({ ...getStorage(), swapDetails: swap }); + schedule(SwapActionTypes.SCHEDULE_NEXT_STEP); + next(); } /** - * - * For doing a swap the user needs to accept a `contract` so it can use the user balance. - * There is two types of check status: - * 1. Checking approval transaction (Give permission to a contract) - * 2. Checking swap transaction. - * + * Checks the status of the current step's swap transaction. */ export async function checkStatus( actions: ExecuterActions @@ -587,6 +370,6 @@ export async function checkStatus( if (currentStep.status === 'running') { await checkTransactionStatus(actions); } else if (currentStep.status === 'waitingForApproval') { - await checkApprovalStatus(actions); + restartLegacyApproval(actions); } } From 38ea29ddf73a1506da920b3021fa33fc776d5e39 Mon Sep 17 00:00:00 2001 From: arlert-armin Date: Mon, 9 Nov 2026 09:47:32 +0000 Subject: [PATCH 25/29] refactor(queue-manager): send evm transactions from their own execute action EVM sending, its environment checks (network and parallel claim) and the receipt wait move into executeEvmTransaction. The generic execute action keeps only the wallet check, and hands EVM transactions stored by older versions over. The status check waits on EVM transactions directly, since no other signer waits. --- .../src/actions/checkApprove/adapters/evm.ts | 2 +- .../src/actions/checkApprove/checkApprove.ts | 6 +- .../checkPrerequisites/checkPrerequisites.ts | 3 + .../rango-preset/src/actions/checkStatus.ts | 81 +++-------- ...heckEnvironmentBeforeExecuteTransaction.ts | 108 +-------------- ...kEnvironmentBeforeExecuteEvmTransaction.ts | 126 ++++++++++++++++++ .../executeEvmTransaction.ts | 90 +++++++++++++ .../actions/executeEvmTransaction/index.ts | 9 ++ .../utils.test.ts} | 2 +- .../evm.ts => executeEvmTransaction/utils.ts} | 36 ++++- .../executeHyperliquidTransaction.ts | 10 +- .../executeHyperliquidTransaction/utils.ts | 2 +- .../executeTransaction/executeTransaction.ts | 50 +++---- queue-manager/rango-preset/src/queueDef.ts | 2 + queue-manager/rango-preset/src/types.ts | 1 + 15 files changed, 320 insertions(+), 208 deletions(-) create mode 100644 queue-manager/rango-preset/src/actions/executeEvmTransaction/checkEnvironmentBeforeExecuteEvmTransaction.ts create mode 100644 queue-manager/rango-preset/src/actions/executeEvmTransaction/executeEvmTransaction.ts create mode 100644 queue-manager/rango-preset/src/actions/executeEvmTransaction/index.ts rename queue-manager/rango-preset/src/actions/{common/evm.test.ts => executeEvmTransaction/utils.test.ts} (99%) rename queue-manager/rango-preset/src/actions/{common/evm.ts => executeEvmTransaction/utils.ts} (91%) diff --git a/queue-manager/rango-preset/src/actions/checkApprove/adapters/evm.ts b/queue-manager/rango-preset/src/actions/checkApprove/adapters/evm.ts index d2e6a45f8d..5727d663be 100644 --- a/queue-manager/rango-preset/src/actions/checkApprove/adapters/evm.ts +++ b/queue-manager/rango-preset/src/actions/checkApprove/adapters/evm.ts @@ -14,7 +14,7 @@ import { } from 'rango-types'; import { Ok } from 'ts-results'; -import { sendEvmTransaction } from '../../common/evm'; +import { sendEvmTransaction } from '../../executeEvmTransaction'; /** * viem throws this while the transaction is pending. It is matched by name so diff --git a/queue-manager/rango-preset/src/actions/checkApprove/checkApprove.ts b/queue-manager/rango-preset/src/actions/checkApprove/checkApprove.ts index 4ceaf1f9bc..441507811b 100644 --- a/queue-manager/rango-preset/src/actions/checkApprove/checkApprove.ts +++ b/queue-manager/rango-preset/src/actions/checkApprove/checkApprove.ts @@ -31,6 +31,7 @@ import { import { checkEnvironmentBeforeExecuteTransaction } from '../common/checkEnvironmentBeforeExecuteTransaction'; import { onNextStateError } from '../common/produceNextStateForTransaction'; import { requestBlockQueue } from '../common/utils'; +import { checkEnvironmentBeforeExecuteEvmTransaction } from '../executeEvmTransaction'; import { isAllowanceSufficient } from './utils'; @@ -139,7 +140,10 @@ export async function checkApprove< * 3. Ensure wallet is connected and is on the correct network. * */ - const checkResult = await checkEnvironmentBeforeExecuteTransaction(actions); + const checkResult = + approveAdapter.namespaceKey === 'evm' + ? await checkEnvironmentBeforeExecuteEvmTransaction(actions) + : checkEnvironmentBeforeExecuteTransaction(actions); if (checkResult.err) { requestBlockQueue(actions, checkResult.val); return; diff --git a/queue-manager/rango-preset/src/actions/checkPrerequisites/checkPrerequisites.ts b/queue-manager/rango-preset/src/actions/checkPrerequisites/checkPrerequisites.ts index 3ccf10e040..73ad8785d9 100644 --- a/queue-manager/rango-preset/src/actions/checkPrerequisites/checkPrerequisites.ts +++ b/queue-manager/rango-preset/src/actions/checkPrerequisites/checkPrerequisites.ts @@ -7,6 +7,7 @@ import { Networks } from '@rango-dev/internal-blockchains'; import { EVM_APPROVE_TYPE, STELLAR_CHANGE_TRUSTLINE_TYPE, + TransactionType, TRON_APPROVE_TYPE, XRPL_CHANGE_TRUSTLINE_TYPE, } from 'rango-types'; @@ -121,6 +122,8 @@ export async function checkPrerequisites( result = new Ok(SwapActionTypes.EXECUTE_XRPL_TRANSACTION); } else if (currentStep.fromBlockchain === Networks.HYPERLIQUID) { result = new Ok(SwapActionTypes.EXECUTE_HYPERLIQUID_TRANSACTION); + } else if (getCurrentStepTx(currentStep)?.type === TransactionType.EVM) { + result = new Ok(SwapActionTypes.EXECUTE_EVM_TRANSACTION); } else { result = new Ok(SwapActionTypes.EXECUTE_TRANSACTION); } diff --git a/queue-manager/rango-preset/src/actions/checkStatus.ts b/queue-manager/rango-preset/src/actions/checkStatus.ts index 27a685e0a5..db563e6706 100644 --- a/queue-manager/rango-preset/src/actions/checkStatus.ts +++ b/queue-manager/rango-preset/src/actions/checkStatus.ts @@ -4,17 +4,15 @@ import type { CheckTxStatusRequest, TransactionStatusResponse, } from 'rango-sdk'; -import type { PendingSwap, PendingSwapStep } from 'rango-types'; import { warn } from '@rango-dev/logging-core'; -import { SignerError, TransactionType } from 'rango-types'; +import { SignerError } from 'rango-types'; import { createStepFailedEvent, delay, getCurrentStep, getCurrentStepTx, - getCurrentStepTxType, getLastFinishedStepInput, getLastFinishedStepInputUsd, getLastSuccessfulStepOutputUsd, @@ -28,54 +26,19 @@ import { notifier } from '../services/eventEmitter'; import { getCurrentNamespaceOf, getNextStep, - getRelatedWallet, getScannerUrl, MessageSeverity, } from '../shared'; import { prettifyErrorMessage } from '../shared-errors'; import { StepEventType, SwapActionTypes } from '../types'; -import { waitForEvmTransaction } from './common/evm'; +import { + getEvmNamespaceOfStep, + waitForEvmTransaction, +} from './executeEvmTransaction'; const INTERVAL_FOR_CHECK_STATUS = 5_000; -type TransactionWaiter = ( - txId: string, - chainId: string | undefined, - // eslint-disable-next-line @typescript-eslint/no-explicit-any - txResponse: any - // eslint-disable-next-line @typescript-eslint/no-explicit-any -) => Promise<{ hash: string; response?: any }>; - -/** - * Finds what waits for the current step's transaction to be mined: the - * wallet's EVM namespace for EVM transactions, the wallet's signer otherwise. - * Throws when the wallet isn't connected yet. - */ -async function getTransactionWaiter( - context: SwapQueueContext, - swap: PendingSwap, - currentStep: PendingSwapStep -): Promise { - const txType = getCurrentStepTxType(currentStep); - const sourceWallet = getRelatedWallet(swap, currentStep); - if (!txType || !sourceWallet) { - return null; - } - - if (txType === TransactionType.EVM) { - const namespace = context.hubProvider(sourceWallet.walletType).get('evm'); - return namespace - ? async (txId, chainId) => waitForEvmTransaction(namespace, txId, chainId) - : null; - } - - const signer = (await context.getSigners(sourceWallet.walletType)).getSigner( - txType - ); - return signer.wait ? signer.wait.bind(signer) : null; -} - /** * Subscribe to status of swap transaction by checking from server periodically. * After getting the status, notify the user and schedule `SCHEDULE_NEXT_STEP`. @@ -106,30 +69,25 @@ async function checkTransactionStatus({ let txId = currentStep.executedTransactionId; let getTxReceiptFailed = false; let status: TransactionStatusResponse | null = null; - let waitForTransaction: TransactionWaiter | null = null; const { getTransactionDataByHash, setTransactionDataByHash } = inMemoryTransactionsData(); + /* + * Only EVM transactions are waited for through the wallet, which also tells + * when one was replaced. Null when the wallet isn't connected yet. + */ + const evmNamespace = getEvmNamespaceOfStep(context, swap, currentStep); try { - waitForTransaction = await getTransactionWaiter(context, swap, currentStep); - // eslint-disable-next-line @typescript-eslint/no-unused-vars - } catch (error) { - /* - * wallet is not connected yet - * no need to do anything - */ - } - - try { - // if wallet is connected, try to get transaction reciept - const { response: txResponse, receiptReceived } = - getTransactionDataByHash(txId); - if (waitForTransaction && !receiptReceived) { + const { receiptReceived } = getTransactionDataByHash(txId); + if (evmNamespace && !receiptReceived) { const chainId = (tx?.blockChain && meta.blockchains?.[tx?.blockChain]?.chainId) || undefined; - const { hash: updatedTxHash, response: updatedTxResponse } = - await waitForTransaction(txId, chainId, txResponse); + const { hash: updatedTxHash } = await waitForEvmTransaction( + evmNamespace, + txId, + chainId + ); if (updatedTxHash !== txId) { currentStep.executedTransactionId = updatedTxHash || currentStep.executedTransactionId; @@ -152,11 +110,6 @@ async function checkTransactionStatus({ } } txId = currentStep.executedTransactionId; - if (updatedTxHash && updatedTxResponse) { - setTransactionDataByHash(updatedTxHash, { - response: updatedTxResponse, - }); - } } else { setTransactionDataByHash(updatedTxHash, { receiptReceived: true, diff --git a/queue-manager/rango-preset/src/actions/common/checkEnvironmentBeforeExecuteTransaction.ts b/queue-manager/rango-preset/src/actions/common/checkEnvironmentBeforeExecuteTransaction.ts index 0222c88539..45928656b2 100644 --- a/queue-manager/rango-preset/src/actions/common/checkEnvironmentBeforeExecuteTransaction.ts +++ b/queue-manager/rango-preset/src/actions/common/checkEnvironmentBeforeExecuteTransaction.ts @@ -8,80 +8,28 @@ import type { ExecuterActions, } from '@rango-dev/queue-manager-core'; -import { PendingSwapNetworkStatus } from 'rango-types'; import { Err, Ok, type Result } from 'ts-results'; import { - ERROR_MESSAGE_DEPENDS_ON_OTHER_QUEUES, - ERROR_MESSAGE_WAIT_FOR_CHANGE_NETWORK, ERROR_MESSAGE_WAIT_FOR_WALLET_DESCRIPTION, ERROR_MESSAGE_WAIT_FOR_WALLET_DESCRIPTION_WRONG_WALLET, } from '../../constants'; import { - claimQueue, - getCurrentStep, - getRequiredSignNetwork, getRequiredWallet, - isNeedBlockQueueForParallel, - isNetworkMatchedForTransaction, isRequiredWalletConnected, isWalletNull, - updateNetworkStatus, } from '../../helpers'; -import { getCurrentNamespaceOf } from '../../shared'; import { BlockReason } from '../../types'; -import { isClaimedByCurrentQueue } from './utils'; - /** - * Check for network & address be matched and queue to not be blocked and update the swap accordingly. + * Makes sure the wallet the transaction needs is connected, and the connected + * wallet's address matches the transaction's. EVM transactions run more checks + * on top, see `checkEnvironmentBeforeExecuteEvmTransaction`. */ -export async function checkEnvironmentBeforeExecuteTransaction( +export function checkEnvironmentBeforeExecuteTransaction( actions: ExecuterActions -): Promise> { - const { getStorage, context } = actions; - - const swap = getStorage().swapDetails; - - const currentStep = getCurrentStep(swap)!; - - /* Make sure wallet is connected and also the connected wallet is matched with tx by checking address. */ - const addressCheckResult = ensureRequiredWalletIsConnected(actions); - if (addressCheckResult.err) { - return addressCheckResult; - } - - /* Wallet should be on correct network */ - const networkResult = await ensureWalletIsOnCorrectNetwork(actions); - if (networkResult.err) { - return networkResult; - } - - if (currentStep.networkStatus === PendingSwapNetworkStatus.NetworkChanged) { - // Considering that network is matched now, if currently network status of the current step is equal to `NetworkChanged`, we need to update the network status to mark it as network changed successfully. - updateNetworkStatus(actions, { - message: '', - details: 'The network has been successfully changed.', - status: PendingSwapNetworkStatus.NetworkChanged, - }); - } - - /* - *For avoiding conflict by making too many requests to wallet, we need to make sure - *We only run one request at a time (In parallel mode). - */ - const needsToBlockQueue = isNeedBlockQueueForParallel(currentStep); - const isClaimed = isClaimedByCurrentQueue(context); - if (needsToBlockQueue && !isClaimed) { - const blockedFor = { - reason: BlockReason.DEPENDS_ON_OTHER_QUEUES, - description: ERROR_MESSAGE_DEPENDS_ON_OTHER_QUEUES, - details: {}, - }; - return new Err(blockedFor); - } - - return new Ok(true); +): Result { + return ensureRequiredWalletIsConnected(actions); } function ensureRequiredWalletIsConnected( @@ -111,47 +59,3 @@ function ensureRequiredWalletIsConnected( return new Ok(true); } - -async function ensureWalletIsOnCorrectNetwork( - actions: ExecuterActions -): Promise> { - const { getStorage, context } = actions; - const { meta, wallets, hubProvider } = context; - const swap = getStorage().swapDetails; - const currentStep = getCurrentStep(swap)!; - - const networkMatched = await isNetworkMatchedForTransaction( - swap, - currentStep, - wallets, - meta, - hubProvider - ); - - const { claimedBy } = claimQueue(); - const claimerId = claimedBy(); - const isClaimedByAnyQueue = !!claimerId && !isClaimedByCurrentQueue(context); - - if (isClaimedByAnyQueue && !networkMatched) { - const details = ERROR_MESSAGE_DEPENDS_ON_OTHER_QUEUES; - - const blockedFor = { - reason: BlockReason.DEPENDS_ON_OTHER_QUEUES, - details: details, - }; - return new Err(blockedFor); - } else if (!networkMatched) { - const fromNamespace = getCurrentNamespaceOf(swap, currentStep); - const details = ERROR_MESSAGE_WAIT_FOR_CHANGE_NETWORK( - getRequiredSignNetwork(currentStep, fromNamespace.network) - ); - - const blockedFor = { - reason: BlockReason.WAIT_FOR_NETWORK_CHANGE, - details: details, - }; - return new Err(blockedFor); - } - - return new Ok(true); -} diff --git a/queue-manager/rango-preset/src/actions/executeEvmTransaction/checkEnvironmentBeforeExecuteEvmTransaction.ts b/queue-manager/rango-preset/src/actions/executeEvmTransaction/checkEnvironmentBeforeExecuteEvmTransaction.ts new file mode 100644 index 0000000000..946c82448e --- /dev/null +++ b/queue-manager/rango-preset/src/actions/executeEvmTransaction/checkEnvironmentBeforeExecuteEvmTransaction.ts @@ -0,0 +1,126 @@ +import type { + SwapActionTypes, + SwapQueueContext, + SwapStorage, +} from '../../types'; +import type { + BlockedReason, + ExecuterActions, +} from '@rango-dev/queue-manager-core'; + +import { PendingSwapNetworkStatus } from 'rango-types'; +import { Err, Ok, type Result } from 'ts-results'; + +import { + ERROR_MESSAGE_DEPENDS_ON_OTHER_QUEUES, + ERROR_MESSAGE_WAIT_FOR_CHANGE_NETWORK, +} from '../../constants'; +import { + claimQueue, + getCurrentStep, + getRequiredSignNetwork, + isNeedBlockQueueForParallel, + isNetworkMatchedForTransaction, + updateNetworkStatus, +} from '../../helpers'; +import { getCurrentNamespaceOf } from '../../shared'; +import { BlockReason } from '../../types'; +import { checkEnvironmentBeforeExecuteTransaction } from '../common/checkEnvironmentBeforeExecuteTransaction'; +import { isClaimedByCurrentQueue } from '../common/utils'; + +/** + * The checks an EVM transaction needs before it's sent to the wallet: the + * wallet is connected with the right address, it's on the transaction's + * network, and no other queue is using the wallet (in parallel mode). + */ +export async function checkEnvironmentBeforeExecuteEvmTransaction( + actions: ExecuterActions +): Promise> { + const { getStorage, context } = actions; + + const swap = getStorage().swapDetails; + + const currentStep = getCurrentStep(swap)!; + + /* Make sure wallet is connected and also the connected wallet is matched with tx by checking address. */ + const addressCheckResult = checkEnvironmentBeforeExecuteTransaction(actions); + if (addressCheckResult.err) { + return addressCheckResult; + } + + /* Wallet should be on correct network */ + const networkResult = await ensureWalletIsOnCorrectNetwork(actions); + if (networkResult.err) { + return networkResult; + } + + if (currentStep.networkStatus === PendingSwapNetworkStatus.NetworkChanged) { + // Considering that network is matched now, if currently network status of the current step is equal to `NetworkChanged`, we need to update the network status to mark it as network changed successfully. + updateNetworkStatus(actions, { + message: '', + details: 'The network has been successfully changed.', + status: PendingSwapNetworkStatus.NetworkChanged, + }); + } + + /* + *For avoiding conflict by making too many requests to wallet, we need to make sure + *We only run one request at a time (In parallel mode). + */ + const needsToBlockQueue = isNeedBlockQueueForParallel(currentStep); + const isClaimed = isClaimedByCurrentQueue(context); + if (needsToBlockQueue && !isClaimed) { + const blockedFor = { + reason: BlockReason.DEPENDS_ON_OTHER_QUEUES, + description: ERROR_MESSAGE_DEPENDS_ON_OTHER_QUEUES, + details: {}, + }; + return new Err(blockedFor); + } + + return new Ok(true); +} + +async function ensureWalletIsOnCorrectNetwork( + actions: ExecuterActions +): Promise> { + const { getStorage, context } = actions; + const { meta, wallets, hubProvider } = context; + const swap = getStorage().swapDetails; + const currentStep = getCurrentStep(swap)!; + + const networkMatched = await isNetworkMatchedForTransaction( + swap, + currentStep, + wallets, + meta, + hubProvider + ); + + const { claimedBy } = claimQueue(); + const claimerId = claimedBy(); + const isClaimedByAnyQueue = !!claimerId && !isClaimedByCurrentQueue(context); + + if (isClaimedByAnyQueue && !networkMatched) { + const details = ERROR_MESSAGE_DEPENDS_ON_OTHER_QUEUES; + + const blockedFor = { + reason: BlockReason.DEPENDS_ON_OTHER_QUEUES, + details: details, + }; + return new Err(blockedFor); + } else if (!networkMatched) { + const fromNamespace = getCurrentNamespaceOf(swap, currentStep); + const details = ERROR_MESSAGE_WAIT_FOR_CHANGE_NETWORK( + getRequiredSignNetwork(currentStep, fromNamespace.network) + ); + + const blockedFor = { + reason: BlockReason.WAIT_FOR_NETWORK_CHANGE, + details: details, + }; + return new Err(blockedFor); + } + + return new Ok(true); +} diff --git a/queue-manager/rango-preset/src/actions/executeEvmTransaction/executeEvmTransaction.ts b/queue-manager/rango-preset/src/actions/executeEvmTransaction/executeEvmTransaction.ts new file mode 100644 index 0000000000..4d6be7a59f --- /dev/null +++ b/queue-manager/rango-preset/src/actions/executeEvmTransaction/executeEvmTransaction.ts @@ -0,0 +1,90 @@ +import type { + SwapActionTypes, + SwapQueueContext, + SwapStorage, +} from '../../types'; +import type { ExecuterActions } from '@rango-dev/queue-manager-core'; +import type { EvmTransaction } from 'rango-sdk'; + +import { + getCurrentStep, + getCurrentStepTx, + handleRejectedSign, + handleSuccessfulSign, + isApprovalCurrentStepTx, + resetNetworkStatus, +} from '../../helpers'; +import { getCurrentAddressOf } from '../../shared'; +import { + onNextStateError, + onNextStateOk, + produceNextStateForTransaction, +} from '../common/produceNextStateForTransaction'; +import { requestBlockQueue } from '../common/utils'; + +import { checkEnvironmentBeforeExecuteEvmTransaction } from './checkEnvironmentBeforeExecuteEvmTransaction'; +import { getEvmNamespaceOfStep, sendEvmTransaction } from './utils'; + +/** + * Sends the current step's EVM transaction through the wallet's EVM namespace. + * + * Parallel swaps that share a wallet go through a `claim` mechanism, so only + * one of them talks to the wallet at a time. The claim is released once the + * wallet returns, and the transaction is then followed by the status check. + */ +export async function executeEvmTransaction( + actions: ExecuterActions +): Promise { + const checkResult = await checkEnvironmentBeforeExecuteEvmTransaction( + actions + ); + if (checkResult.err) { + requestBlockQueue(actions, checkResult.val); + return; + } + + resetNetworkStatus(actions); + + const { failed, getStorage, context } = actions; + const { meta } = context; + + const swap = getStorage().swapDetails; + const currentStep = getCurrentStep(swap)!; + const isApproval = isApprovalCurrentStepTx(currentStep); + + const onFinish = () => { + if (actions.context.resetClaimedBy) { + actions.context.resetClaimedBy(); + } + }; + + const nextStateResult = produceNextStateForTransaction(actions); + if (nextStateResult.err) { + onNextStateError(actions, nextStateResult.val); + failed(); + onFinish(); + return; + } + onNextStateOk(actions, nextStateResult.val); + + // `produceNextStateForTransaction` has checked the tx isn't null. + const tx = getCurrentStepTx(currentStep) as EvmTransaction; + const walletAddress = getCurrentAddressOf(swap, currentStep); + const chainId = meta.blockchains?.[tx.blockChain]?.chainId ?? null; + + const namespace = getEvmNamespaceOfStep(context, swap, currentStep); + if (!namespace) { + handleRejectedSign(actions)( + new Error('The EVM namespace is not available on your wallet.') + ); + onFinish(); + return; + } + + await sendEvmTransaction(namespace, tx, walletAddress, chainId) + .then( + handleSuccessfulSign(actions, { isApproval }), + handleRejectedSign(actions) + ) + .finally(onFinish); +} diff --git a/queue-manager/rango-preset/src/actions/executeEvmTransaction/index.ts b/queue-manager/rango-preset/src/actions/executeEvmTransaction/index.ts new file mode 100644 index 0000000000..b593c0d169 --- /dev/null +++ b/queue-manager/rango-preset/src/actions/executeEvmTransaction/index.ts @@ -0,0 +1,9 @@ +export { executeEvmTransaction } from './executeEvmTransaction.js'; +export { checkEnvironmentBeforeExecuteEvmTransaction } from './checkEnvironmentBeforeExecuteEvmTransaction.js'; +export { + getEvmNamespaceOfStep, + sendEvmTransaction, + signEvmTypedData, + waitForEvmTransaction, +} from './utils.js'; +export type { EvmNamespace, EvmTypedData } from './utils.js'; diff --git a/queue-manager/rango-preset/src/actions/common/evm.test.ts b/queue-manager/rango-preset/src/actions/executeEvmTransaction/utils.test.ts similarity index 99% rename from queue-manager/rango-preset/src/actions/common/evm.test.ts rename to queue-manager/rango-preset/src/actions/executeEvmTransaction/utils.test.ts index 883bc7ae4e..8facfa853c 100644 --- a/queue-manager/rango-preset/src/actions/common/evm.test.ts +++ b/queue-manager/rango-preset/src/actions/executeEvmTransaction/utils.test.ts @@ -11,7 +11,7 @@ import { } from 'rango-types'; import { describe, expect, test, vi } from 'vitest'; -import { sendEvmTransaction } from './evm'; +import { sendEvmTransaction } from './utils'; const ADDRESS = '0x1111111111111111111111111111111111111111'; const TO = '0x2222222222222222222222222222222222222222'; diff --git a/queue-manager/rango-preset/src/actions/common/evm.ts b/queue-manager/rango-preset/src/actions/executeEvmTransaction/utils.ts similarity index 91% rename from queue-manager/rango-preset/src/actions/common/evm.ts rename to queue-manager/rango-preset/src/actions/executeEvmTransaction/utils.ts index 14c2927efa..d9631ae12e 100644 --- a/queue-manager/rango-preset/src/actions/common/evm.ts +++ b/queue-manager/rango-preset/src/actions/executeEvmTransaction/utils.ts @@ -1,9 +1,19 @@ +import type { SwapQueueContext } from '../../types'; import type { FindProxiedNamespace } from '@hub3js/core'; import type { EvmActions } from '@hub3js/evm'; import type { DefaultNamespaces } from '@hub3js/namespaces'; import type { EvmTransaction } from 'rango-sdk'; +import type { PendingSwap, PendingSwapStep } from 'rango-types'; -import { RPCErrorCode, SignerError, SignerErrorCode } from 'rango-types'; +import { + RPCErrorCode, + SignerError, + SignerErrorCode, + TransactionType, +} from 'rango-types'; + +import { getCurrentStepTxType } from '../../helpers'; +import { getRelatedWalletOrNull } from '../../shared'; export type EvmNamespace = FindProxiedNamespace<'evm', DefaultNamespaces>; @@ -132,6 +142,30 @@ export function toEvmTransactionRequest( return request as SendTransactionParameters; } +/** + * The EVM namespace of the wallet that sends the step's transaction. Null when + * the transaction isn't EVM, or the wallet has no EVM namespace or isn't + * connected yet. + */ +export function getEvmNamespaceOfStep( + context: SwapQueueContext, + swap: PendingSwap, + step: PendingSwapStep +): EvmNamespace | null { + if (getCurrentStepTxType(step) !== TransactionType.EVM) { + return null; + } + const sourceWallet = getRelatedWalletOrNull(swap, step); + if (!sourceWallet) { + return null; + } + try { + return context.hubProvider(sourceWallet.walletType).get('evm') ?? null; + } catch { + return null; + } +} + function getActiveAddress(namespace: EvmNamespace): string | undefined { const [getState] = namespace.state(); const accounts = getState('accounts') as string[] | null | undefined; diff --git a/queue-manager/rango-preset/src/actions/executeHyperliquidTransaction/executeHyperliquidTransaction.ts b/queue-manager/rango-preset/src/actions/executeHyperliquidTransaction/executeHyperliquidTransaction.ts index 11e292f9e1..4a02c82cae 100644 --- a/queue-manager/rango-preset/src/actions/executeHyperliquidTransaction/executeHyperliquidTransaction.ts +++ b/queue-manager/rango-preset/src/actions/executeHyperliquidTransaction/executeHyperliquidTransaction.ts @@ -11,14 +11,16 @@ import { } from '../../helpers'; import { getCurrentAddressOf, getRelatedWallet } from '../../shared'; import { SwapActionTypes } from '../../types'; -import { checkEnvironmentBeforeExecuteTransaction } from '../common/checkEnvironmentBeforeExecuteTransaction'; -import { signEvmTypedData } from '../common/evm'; import { onNextStateError, onNextStateOk, produceNextStateForTransaction, } from '../common/produceNextStateForTransaction'; import { requestBlockQueue } from '../common/utils'; +import { + checkEnvironmentBeforeExecuteEvmTransaction, + signEvmTypedData, +} from '../executeEvmTransaction'; import { ensureHyperliquidTransactionIsValid, @@ -30,7 +32,9 @@ import { export async function executeHyperliquidTransaction( actions: ExecuterActions ): Promise { - const checkResult = await checkEnvironmentBeforeExecuteTransaction(actions); + const checkResult = await checkEnvironmentBeforeExecuteEvmTransaction( + actions + ); if (checkResult.err) { requestBlockQueue(actions, checkResult.val); return; diff --git a/queue-manager/rango-preset/src/actions/executeHyperliquidTransaction/utils.ts b/queue-manager/rango-preset/src/actions/executeHyperliquidTransaction/utils.ts index 09b1ae75f1..8b38448a04 100644 --- a/queue-manager/rango-preset/src/actions/executeHyperliquidTransaction/utils.ts +++ b/queue-manager/rango-preset/src/actions/executeHyperliquidTransaction/utils.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-magic-numbers */ -import type { EvmTypedData } from '../common/evm'; import type { NextTransactionStateError } from '../common/produceNextStateForTransaction'; +import type { EvmTypedData } from '../executeEvmTransaction'; import type { HyperliquidTransaction, Transaction } from 'rango-sdk'; import type { Result } from 'ts-results'; diff --git a/queue-manager/rango-preset/src/actions/executeTransaction/executeTransaction.ts b/queue-manager/rango-preset/src/actions/executeTransaction/executeTransaction.ts index 3f4226732b..cb5e18a17a 100644 --- a/queue-manager/rango-preset/src/actions/executeTransaction/executeTransaction.ts +++ b/queue-manager/rango-preset/src/actions/executeTransaction/executeTransaction.ts @@ -18,28 +18,34 @@ import { } from '../../helpers'; import { getCurrentAddressOf, getRelatedWallet } from '../../shared'; import { checkEnvironmentBeforeExecuteTransaction } from '../common/checkEnvironmentBeforeExecuteTransaction'; -import { sendEvmTransaction } from '../common/evm'; import { onNextStateError, onNextStateOk, produceNextStateForTransaction, } from '../common/produceNextStateForTransaction'; import { requestBlockQueue } from '../common/utils'; +import { executeEvmTransaction } from '../executeEvmTransaction'; /** - * - * Excecute a created transaction. - * - * This function implemented the parallel mode by `claim` mechanism which means - * All the queues the meet certain situation (like multiple evm transaction) will go through - * a `claim` mechanims that decides which queue should be run and it blocks other ones. - * - * A queue will be go to sign process, if the wallet and network is matched. + * Executes a created transaction through the wallet's signer, for the chains + * that don't have their own execute action. A queue goes to signing once the + * required wallet is connected. */ export async function executeTransaction( actions: ExecuterActions ): Promise { - const checkResult = await checkEnvironmentBeforeExecuteTransaction(actions); + const currentStepTx = getCurrentStepTx( + getCurrentStep(actions.getStorage().swapDetails)! + ); + /* + * EVM transactions have their own action. A swap stored by an older version + * can still resume here with one, so it's handed over. + */ + if (currentStepTx?.type === TransactionType.EVM) { + return executeEvmTransaction(actions); + } + + const checkResult = checkEnvironmentBeforeExecuteTransaction(actions); if (checkResult.err) { requestBlockQueue(actions, checkResult.val); return; @@ -86,30 +92,6 @@ export async function executeTransaction( const chainId = meta.blockchains?.[tx.blockChain]?.chainId; - // EVM transactions go through the wallet's EVM namespace. - if (tx.type === TransactionType.EVM) { - const namespace = context.hubProvider(sourceWallet.walletType).get('evm'); - if (!namespace) { - handleRejectedSign(actions)( - new Error('The EVM namespace is not available on your wallet.') - ); - onFinish(); - return; - } - - await sendEvmTransaction(namespace, tx, walletAddress, chainId ?? null) - .then( - handleSuccessfulSign(actions, { - isApproval, - }), - handleRejectedSign(actions) - ) - .finally(() => { - onFinish(); - }); - return; - } - let walletSigners: SignerFactory; try { walletSigners = await getSigners(sourceWallet.walletType); diff --git a/queue-manager/rango-preset/src/queueDef.ts b/queue-manager/rango-preset/src/queueDef.ts index 77a4126f66..bc9cc01926 100644 --- a/queue-manager/rango-preset/src/queueDef.ts +++ b/queue-manager/rango-preset/src/queueDef.ts @@ -13,6 +13,7 @@ import { checkStellarTrustline } from './actions/checkStellarTrustline'; import { checkXrplTrustline } from './actions/checkXrplTrustline'; import { checkXrplTrustLineTransactionStatus } from './actions/checkXrplTrustlineTransactionStatus'; import { createTransaction } from './actions/createTransaction'; +import { executeEvmTransaction } from './actions/executeEvmTransaction'; import { executeHyperliquidTransaction } from './actions/executeHyperliquidTransaction'; import { executeStellarTransaction } from './actions/executeStellarTransaction'; import { executeTransaction } from './actions/executeTransaction'; @@ -53,6 +54,7 @@ export const swapQueueDef: SwapQueueDef = { [SwapActionTypes.CHECK_TRON_APPROVE_TRANSACTION_STATUS]: async (actions) => checkApproveTransactionStatus(actions, tronApproveAdapter), [SwapActionTypes.EXECUTE_TRANSACTION]: executeTransaction, + [SwapActionTypes.EXECUTE_EVM_TRANSACTION]: executeEvmTransaction, [SwapActionTypes.EXECUTE_XRPL_TRANSACTION]: executeXrplTransaction, [SwapActionTypes.EXECUTE_STELLAR_TRANSACTION]: executeStellarTransaction, [SwapActionTypes.EXECUTE_HYPERLIQUID_TRANSACTION]: diff --git a/queue-manager/rango-preset/src/types.ts b/queue-manager/rango-preset/src/types.ts index dcbb1799cf..fc147b79e9 100644 --- a/queue-manager/rango-preset/src/types.ts +++ b/queue-manager/rango-preset/src/types.ts @@ -61,6 +61,7 @@ export enum SwapActionTypes { CHECK_TRON_APPROVE_TRANSACTION_STATUS = 'CHECK_TRON_APPROVE_TRANSACTION_STATUS', EXECUTE_TRANSACTION = 'EXECUTE_TRANSACTION', + EXECUTE_EVM_TRANSACTION = 'EXECUTE_EVM_TRANSACTION', EXECUTE_XRPL_TRANSACTION = 'EXECUTE_XRPL_TRANSACTION', EXECUTE_STELLAR_TRANSACTION = 'EXECUTE_STELLAR_TRANSACTION', EXECUTE_HYPERLIQUID_TRANSACTION = 'EXECUTE_HYPERLIQUID_TRANSACTION', From fb3d5c2a0161779586e3de6a601cf30c3fab3258 Mon Sep 17 00:00:00 2001 From: arlert-armin Date: Mon, 9 Nov 2026 11:04:12 +0000 Subject: [PATCH 26/29] chore: take viem 2.57.17 for typed-data struct names with ':', and reown 1.8.24 to match viem 2.57.13 to 2.57.16 reject ':' in EIP-712 struct names, which broke signing Hyperliquid's HyperliquidTransaction:UsdSend. 2.57.17 allows it again. reown 1.8.20's typings don't accept 2.57.17's new prepare phase, so reown moves to 1.8.24, whose typings check without the old appkit-controllers patch. The ox patch moves to the ox version 2.57.17 uses. --- .../@reown+appkit-controllers+1.8.20.patch | 20 --- ...x+0.14.59.patch => viem++ox+0.14.63.patch} | 0 wallets/provider-walletconnect-2/package.json | 2 +- yarn.lock | 160 +++++++++--------- 4 files changed, 81 insertions(+), 101 deletions(-) delete mode 100644 patches/@reown+appkit-controllers+1.8.20.patch rename patches/{viem++ox+0.14.59.patch => viem++ox+0.14.63.patch} (100%) diff --git a/patches/@reown+appkit-controllers+1.8.20.patch b/patches/@reown+appkit-controllers+1.8.20.patch deleted file mode 100644 index dc6e261e90..0000000000 --- a/patches/@reown+appkit-controllers+1.8.20.patch +++ /dev/null @@ -1,20 +0,0 @@ -diff --git a/node_modules/@reown/appkit-controllers/dist/types/src/utils/ViemUtil.d.ts b/node_modules/@reown/appkit-controllers/dist/types/src/utils/ViemUtil.d.ts -index 7fd38b994b976acf71b6e782cd888305d78fbf65..27a040e6aeecfbb8d2a7a9e9f4d53a963f5a6f9f 100644 ---- a/node_modules/@reown/appkit-controllers/dist/types/src/utils/ViemUtil.d.ts -+++ b/node_modules/@reown/appkit-controllers/dist/types/src/utils/ViemUtil.d.ts -@@ -4479,6 +4479,7 @@ export declare const ViemUtil: { - authorizationList: import("viem").TransactionSerializableEIP7702["authorizationList"]; - } ? "eip7702" : never) | (request["type"] extends string | undefined ? Extract : never)>) ? T_25 extends "eip7702" ? import("viem").TransactionRequestEIP7702 : never : never : never)>> & { - chainId?: number | undefined; -+// @ts-ignore -- generated against an older viem; generics mismatch viem@2.52.x (TS2344/TS2536). Only these 2 sites; rest of file stays checked. - }, (request["parameters"] extends readonly import("viem").PrepareTransactionRequestParameterType[] ? request["parameters"][number] : "fees" | "chainId" | "type" | "gas" | "nonce" | "blobVersionedHashes") extends infer T_26 ? T_26 extends (request["parameters"] extends readonly import("viem").PrepareTransactionRequestParameterType[] ? request["parameters"][number] : "fees" | "chainId" | "type" | "gas" | "nonce" | "blobVersionedHashes") ? T_26 extends "fees" ? "gasPrice" | "maxFeePerGas" | "maxPriorityFeePerGas" : T_26 : never : never> & (unknown extends request["kzg"] ? {} : Pick) extends infer T ? { [K in keyof T]: (import("viem").UnionRequiredBy : never)>) ? T_12 extends "eip7702" ? import("viem").TransactionRequestEIP7702 : never : never : never)>> & { - chainId?: number | undefined; -+// @ts-ignore -- generated against an older viem; generics mismatch viem@2.52.x (TS2344/TS2536). Only these 2 sites; rest of file stays checked. - }, (request["parameters"] extends readonly import("viem").PrepareTransactionRequestParameterType[] ? request["parameters"][number] : "fees" | "chainId" | "type" | "gas" | "nonce" | "blobVersionedHashes") extends infer T_13 ? T_13 extends (request["parameters"] extends readonly import("viem").PrepareTransactionRequestParameterType[] ? request["parameters"][number] : "fees" | "chainId" | "type" | "gas" | "nonce" | "blobVersionedHashes") ? T_13 extends "fees" ? "gasPrice" | "maxFeePerGas" | "maxPriorityFeePerGas" : T_13 : never : never> & (unknown extends request["kzg"] ? {} : Pick))[K]; } : never>; - readContract: , const args extends import("viem").ContractFunctionArgs>(args: import("viem").ReadContractParameters) => Promise>; - sendRawTransaction: (args: import("viem").SendRawTransactionParameters) => Promise; diff --git a/patches/viem++ox+0.14.59.patch b/patches/viem++ox+0.14.63.patch similarity index 100% rename from patches/viem++ox+0.14.59.patch rename to patches/viem++ox+0.14.63.patch diff --git a/wallets/provider-walletconnect-2/package.json b/wallets/provider-walletconnect-2/package.json index fde2d1986b..9d3f46ace5 100644 --- a/wallets/provider-walletconnect-2/package.json +++ b/wallets/provider-walletconnect-2/package.json @@ -26,7 +26,7 @@ "@rango-dev/internal-blockchains": "^0.3.1-next.1", "@rango-dev/logging-core": "^0.16.1-next.1", "@rango-dev/signer-evm": "^0.47.0", - "@reown/appkit": "1.8.20", + "@reown/appkit": "1.8.24", "@walletconnect/encoding": "^1.0.2", "@walletconnect/sign-client": "2.23.7", "@walletconnect/universal-provider": "2.23.7", diff --git a/yarn.lock b/yarn.lock index eed52d9fdb..feacac3f2b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5375,118 +5375,118 @@ resolved "https://registry.yarnpkg.com/@remix-run/router/-/router-1.13.0.tgz#7e29c4ee85176d9c08cb0f4456bff74d092c5065" integrity sha512-5dMOnVnefRsl4uRnAdoWjtVTdh8e6aZqgM4puy9nmEADH72ck+uXwzpJLEKE9Q6F8ZljNewLgmTfkxUrBdv4WA== -"@reown/appkit-common@1.8.20": - version "1.8.20" - resolved "https://registry.yarnpkg.com/@reown/appkit-common/-/appkit-common-1.8.20.tgz#53657077c18eac6509ff89a3b308e7b8a7225cc1" - integrity sha512-x6Yc8FaZZaEnsRCu6crYD/s1MA+Ffk35rJNZpug8I26iAJgi+o3rar/0lwZ70dl/QA9ytnwFUFWzhXqkT3O7Og== +"@reown/appkit-common@1.8.24": + version "1.8.24" + resolved "https://registry.yarnpkg.com/@reown/appkit-common/-/appkit-common-1.8.24.tgz#c7bb6fd9b0505e6de93f1d9a9de86693c8d25543" + integrity sha512-BoAGwKwGm4WJ4nkOPk4OsIVGf9NmdINbk5QaCo50j6QJIaIAcL7GVnsV322NBiSuBxobmwbZ3lIezsZCd3G45A== dependencies: big.js "6.2.2" dayjs "1.11.13" - viem ">=2.45.0" + viem ">=2.55.13" -"@reown/appkit-controllers@1.8.20": - version "1.8.20" - resolved "https://registry.yarnpkg.com/@reown/appkit-controllers/-/appkit-controllers-1.8.20.tgz#83d7190e18489448fbad870db0303f13ca0563aa" - integrity sha512-2Gdi/ScftfBK3MwfAJcf/bGRByHgHzaAK8rCzKrYYUqLjbRFR9I/uq7gd6D+w4Xm+NRCpdiKFJY/0zPSfq+gpw== +"@reown/appkit-controllers@1.8.24": + version "1.8.24" + resolved "https://registry.yarnpkg.com/@reown/appkit-controllers/-/appkit-controllers-1.8.24.tgz#fcfd20ec8c2e73814719b0fd82294d36e509b33e" + integrity sha512-ZEB17sTYfNSMGO5lkWWGn4Q53N0tOSFAqHZt4f5Sxj8certjFXNAcKNjf0Z+bxNgU4Pjv3tisZ+6S4ShOxe6Zw== dependencies: - "@reown/appkit-common" "1.8.20" - "@reown/appkit-wallet" "1.8.20" + "@reown/appkit-common" "1.8.24" + "@reown/appkit-wallet" "1.8.24" "@walletconnect/universal-provider" "2.23.7" valtio "2.1.7" - viem ">=2.45.0" + viem ">=2.55.13" -"@reown/appkit-pay@1.8.20": - version "1.8.20" - resolved "https://registry.yarnpkg.com/@reown/appkit-pay/-/appkit-pay-1.8.20.tgz#322a7a86b6b903bef7d9efda5a9d5eab58a0dfe6" - integrity sha512-JEoTVetCWNFJnbkYGtwvdWa7ZW7xF0uOH+jmJvnAbYSXTR+Bd8HdQOMn/AoWulSu6qmjKjNpZQmNjkIUf5yiUw== +"@reown/appkit-pay@1.8.24": + version "1.8.24" + resolved "https://registry.yarnpkg.com/@reown/appkit-pay/-/appkit-pay-1.8.24.tgz#5f0b63cd1aaf4e69f31e634b3b90ebf04149df57" + integrity sha512-/djGjg2xfSLDxI9Bk0DGxplgzg9npFCa5bY+OUTXaSCBPDNFKMBD8e/EAq+UL43fv/wfJewuK0F4FiLnlVDR8w== dependencies: - "@reown/appkit-common" "1.8.20" - "@reown/appkit-controllers" "1.8.20" - "@reown/appkit-ui" "1.8.20" - "@reown/appkit-utils" "1.8.20" + "@reown/appkit-common" "1.8.24" + "@reown/appkit-controllers" "1.8.24" + "@reown/appkit-ui" "1.8.24" + "@reown/appkit-utils" "1.8.24" lit "3.3.0" valtio "2.1.7" -"@reown/appkit-polyfills@1.8.20": - version "1.8.20" - resolved "https://registry.yarnpkg.com/@reown/appkit-polyfills/-/appkit-polyfills-1.8.20.tgz#2cdb91b4cd18298416320a2153cf610e453633d7" - integrity sha512-88qJedSBYkhCZxeyODcQhqKt45OkS28VbZGNsay6t7FexvPcoibYMtkHaP79ojE8OuhV7k3FlrssrjPES3OFCw== +"@reown/appkit-polyfills@1.8.24": + version "1.8.24" + resolved "https://registry.yarnpkg.com/@reown/appkit-polyfills/-/appkit-polyfills-1.8.24.tgz#efe948ed07a86154a04248190d46490e9394a36f" + integrity sha512-HQr6p5lvx73Q+NHSNQpw9IHuxkpT9ri+z5Hpa/W3hrFsA+Z20x5+H3oQoUivEqQGV2LVVQ75v6h7dfWBnRKy1g== dependencies: buffer "6.0.3" -"@reown/appkit-scaffold-ui@1.8.20": - version "1.8.20" - resolved "https://registry.yarnpkg.com/@reown/appkit-scaffold-ui/-/appkit-scaffold-ui-1.8.20.tgz#28bb7a3b07068e7c502d931d911abf2f18d17722" - integrity sha512-Vx0qib30UUbcKT8VeNcCcZkkhtaOT28TtClQ8nKC0EdOkLA08Lxt0j32XpEat2c4Fl6xzAIIOuZO7HRBTxMfzA== - dependencies: - "@reown/appkit-common" "1.8.20" - "@reown/appkit-controllers" "1.8.20" - "@reown/appkit-pay" "1.8.20" - "@reown/appkit-ui" "1.8.20" - "@reown/appkit-utils" "1.8.20" - "@reown/appkit-wallet" "1.8.20" +"@reown/appkit-scaffold-ui@1.8.24": + version "1.8.24" + resolved "https://registry.yarnpkg.com/@reown/appkit-scaffold-ui/-/appkit-scaffold-ui-1.8.24.tgz#04f61814b5a42fc56b3d47e3fa5cea8a4ddf5bee" + integrity sha512-bA5fJQAYAejwWeNUvOQM3luGE1mK9jfzvixx/tNZnatBOavUX07793hXrXksi82QpxOM/H9notgwGGeryDK00w== + dependencies: + "@reown/appkit-common" "1.8.24" + "@reown/appkit-controllers" "1.8.24" + "@reown/appkit-pay" "1.8.24" + "@reown/appkit-ui" "1.8.24" + "@reown/appkit-utils" "1.8.24" + "@reown/appkit-wallet" "1.8.24" lit "3.3.0" -"@reown/appkit-ui@1.8.20": - version "1.8.20" - resolved "https://registry.yarnpkg.com/@reown/appkit-ui/-/appkit-ui-1.8.20.tgz#95c8d7ac21100674b58e2a4f234f0f68b885e4ce" - integrity sha512-ObWhgu+4capnVhxtEG0VMRtGHwr6bso9VUcxDIfUDpjNAMi1HQBvXiBJ/R098Gvjmjz0QLwNe8YNVe50KaCTVw== +"@reown/appkit-ui@1.8.24": + version "1.8.24" + resolved "https://registry.yarnpkg.com/@reown/appkit-ui/-/appkit-ui-1.8.24.tgz#9017ac7e08a916d37c98f00cf0ae2417c72ebbb1" + integrity sha512-Ex4/s9TtFZfrj0vjNBeH3uy23bIkZbOikcfJ3rInjGAN2ujyrb0ed9ZUWaiNTveVh06hjglYdgQ7B6nYDTBxSw== dependencies: "@phosphor-icons/webcomponents" "2.1.5" - "@reown/appkit-common" "1.8.20" - "@reown/appkit-controllers" "1.8.20" - "@reown/appkit-wallet" "1.8.20" + "@reown/appkit-common" "1.8.24" + "@reown/appkit-controllers" "1.8.24" + "@reown/appkit-wallet" "1.8.24" lit "3.3.0" qrcode "1.5.3" -"@reown/appkit-utils@1.8.20": - version "1.8.20" - resolved "https://registry.yarnpkg.com/@reown/appkit-utils/-/appkit-utils-1.8.20.tgz#8c20c8f501680dc88f1ce598a058ada9fa403b6a" - integrity sha512-ZVPUhZm/8TbR5MI1GzhazpUShrjVhZCC8Fyc7m+VXSPVZkPiW7K2AtTDAqhfYeStvBSJIvC6jbKwhlaWGR1TDQ== +"@reown/appkit-utils@1.8.24": + version "1.8.24" + resolved "https://registry.yarnpkg.com/@reown/appkit-utils/-/appkit-utils-1.8.24.tgz#dd90e205d930f5e235930b72d7ae95dc9079e1d9" + integrity sha512-HsGAgbWg4SPlZJJGNaKeynrtRZwa9iDPIXQ3iSi/Rc4g0IxZ6ahIGciZzLR/t1QM2Ehmx2MhM6LXVHa4PGbC3A== dependencies: - "@reown/appkit-common" "1.8.20" - "@reown/appkit-controllers" "1.8.20" - "@reown/appkit-polyfills" "1.8.20" - "@reown/appkit-wallet" "1.8.20" + "@reown/appkit-common" "1.8.24" + "@reown/appkit-controllers" "1.8.24" + "@reown/appkit-polyfills" "1.8.24" + "@reown/appkit-wallet" "1.8.24" "@wallet-standard/wallet" "1.1.0" "@walletconnect/logger" "3.0.2" "@walletconnect/universal-provider" "2.23.7" valtio "2.1.7" - viem ">=2.45.0" + viem ">=2.55.13" optionalDependencies: "@base-org/account" "2.4.0" "@coinbase/wallet-sdk" "4.3.6" "@safe-global/safe-apps-provider" "0.18.6" "@safe-global/safe-apps-sdk" "9.1.0" -"@reown/appkit-wallet@1.8.20": - version "1.8.20" - resolved "https://registry.yarnpkg.com/@reown/appkit-wallet/-/appkit-wallet-1.8.20.tgz#a439e7e6063a734ff0a0438ec6f28e270744d463" - integrity sha512-fEYnCQTQFSi8qtGfdQp7BHAVD8yiijPgjXhel0jFLKTX5leufGKjrERtnn2vABoUHQucwQzI+Q958Bnx/lHE2w== +"@reown/appkit-wallet@1.8.24": + version "1.8.24" + resolved "https://registry.yarnpkg.com/@reown/appkit-wallet/-/appkit-wallet-1.8.24.tgz#59bb9f9512b8ed8313b2fe9c2e5c8382c210a7c3" + integrity sha512-MgJ5H25m7PgHwPzzv5nKnzdrMI6F+9zU3oIYsIWT/I/h4EfnN2COt+WuI7uX2Z2J2pWyHi0uDrysRgHU7DPAOw== dependencies: - "@reown/appkit-common" "1.8.20" - "@reown/appkit-polyfills" "1.8.20" + "@reown/appkit-common" "1.8.24" + "@reown/appkit-polyfills" "1.8.24" "@walletconnect/logger" "3.0.2" zod "3.22.4" -"@reown/appkit@1.8.20": - version "1.8.20" - resolved "https://registry.yarnpkg.com/@reown/appkit/-/appkit-1.8.20.tgz#ca6216e76da79493054e285c015c8b6bdbd83004" - integrity sha512-+OI1TWg3XcMRhZ5RGVF0+AjkUvTPpODP6HFIgmxsV8HCf6bfE+jaYYE+JJcaz05TYJJ2TCXSYDyRfRvjSUzMzg== - dependencies: - "@reown/appkit-common" "1.8.20" - "@reown/appkit-controllers" "1.8.20" - "@reown/appkit-pay" "1.8.20" - "@reown/appkit-polyfills" "1.8.20" - "@reown/appkit-scaffold-ui" "1.8.20" - "@reown/appkit-ui" "1.8.20" - "@reown/appkit-utils" "1.8.20" - "@reown/appkit-wallet" "1.8.20" +"@reown/appkit@1.8.24": + version "1.8.24" + resolved "https://registry.yarnpkg.com/@reown/appkit/-/appkit-1.8.24.tgz#5bf85af4f45ada612cf4507d947fa4b7da2e399a" + integrity sha512-FXxZk+H/1PMABskdaMo+iuzr/9Oi6EYUw75PxeqzvGFVdB5YLAv9HIlIEc/nQiYv8SPoRy6y19TAae9ndiHmqA== + dependencies: + "@reown/appkit-common" "1.8.24" + "@reown/appkit-controllers" "1.8.24" + "@reown/appkit-pay" "1.8.24" + "@reown/appkit-polyfills" "1.8.24" + "@reown/appkit-scaffold-ui" "1.8.24" + "@reown/appkit-ui" "1.8.24" + "@reown/appkit-utils" "1.8.24" + "@reown/appkit-wallet" "1.8.24" "@walletconnect/universal-provider" "2.23.7" bs58 "6.0.0" semver "7.7.2" valtio "2.1.7" - viem ">=2.45.0" + viem ">=2.55.13" optionalDependencies: "@lit/react" "1.0.8" @@ -15075,10 +15075,10 @@ own-keys@^1.0.1: object-keys "^1.1.1" safe-push-apply "^1.0.0" -ox@0.14.59: - version "0.14.59" - resolved "https://registry.yarnpkg.com/ox/-/ox-0.14.59.tgz#815d60b1f89afc306623536794a8a9ef3170c53d" - integrity sha512-Y+DPEQScTEGKteQATjtytE1JRQ5cg1R2+DvYQ/lbhUCm/xS9n0Jnkkf2AqQyIntefQxs8xY6dZ+kyNZ7zf2FzA== +ox@0.14.63: + version "0.14.63" + resolved "https://registry.yarnpkg.com/ox/-/ox-0.14.63.tgz#5d8136d832d885c53cc16814899af1c8ab465cb7" + integrity sha512-TSKYN151boL1Aq/vsFrd8Buvd7v+oTQr8V7z4f4QQTSMB+ohD8cbNbHCtKRLI0Gs8LuYKirf5qvElTKVIFe2jw== dependencies: "@adraffy/ens-normalize" "^1.11.0" "@noble/ciphers" "^1.3.0" @@ -18005,10 +18005,10 @@ varuint-bitcoin@^1.1.2: dependencies: safe-buffer "^5.1.1" -viem@>=2.45.0, viem@^2.27.2, viem@^2.31.7, viem@^2.47.0, viem@^2.56.8: - version "2.57.16" - resolved "https://registry.yarnpkg.com/viem/-/viem-2.57.16.tgz#487349adb52405ffd9103e3969ade6a0b5040355" - integrity sha512-+4uaUw3NfkqjaqsZp8Zci94K33oc9rv7mIUgvPduJxsY/tI0ASi2YkaXoUVSBGfdIw/QPWuVnIf9LTFf35IoMg== +viem@>=2.55.13, viem@^2.27.2, viem@^2.31.7, viem@^2.47.0, viem@^2.56.8: + version "2.57.17" + resolved "https://registry.yarnpkg.com/viem/-/viem-2.57.17.tgz#9fd4060ade0f09cdc8a9d73910867f0929efe7ed" + integrity sha512-yIMqNoKoVAMwX+zVbqkxfqq7qbGHmKXZidh/xfVpiPTJlAbbDDdDIMH5dDQWxhZcj56L8tPOwsIIxF618P+TOg== dependencies: "@noble/curves" "1.9.1" "@noble/hashes" "1.8.0" @@ -18016,7 +18016,7 @@ viem@>=2.45.0, viem@^2.27.2, viem@^2.31.7, viem@^2.47.0, viem@^2.56.8: "@scure/bip39" "1.6.0" abitype "1.2.3" isows "1.0.7" - ox "0.14.59" + ox "0.14.63" ws "8.21.0" viem@^2.1.1: From 6ecf0dfa5d279ef661866778cc7ad08e893faf3e Mon Sep 17 00:00:00 2001 From: arlert-armin Date: Tue, 10 Nov 2026 09:19:23 +0000 Subject: [PATCH 27/29] refactor: apply the third round of review feedback - Type hyperliquid typed data with viem's TypedDataDefinition, re-exported by @hub3js/evm. evm and namespaces are pinned to the experimental hub3 build that adds the export, and rango-preset declares @hub3js/evm. - Reject a sent EVM transaction whose hash doesn't start with 0x, after both the first send and the legacy gas retry (some wallets resolve 'null'). - Keep the WalletConnect session context on relayed request errors, and pass wallet error context through to the signer error. - Pass a chain 1 rpc url in widget/app, the playground and the queue-manager demo, so Ledger and Trezor reads work there. - Declare @hub3js/namespaces in the providers that import it, and drop the unused @rango-dev/signer-evm from bitget, okx, trezor and walletconnect-2. --- blockchains/internal-blockchains/package.json | 2 +- .../src/components/Wallets/index.tsx | 8 ++- .../queue-manager-demo/src/configs.ts | 10 +++- .../queue-manager-demo/src/index.tsx | 11 +++- queue-manager/rango-preset/package.json | 3 +- .../actions/executeEvmTransaction/index.ts | 2 +- .../executeEvmTransaction/utils.test.ts | 55 +++++++++++++++++++ .../actions/executeEvmTransaction/utils.ts | 50 ++++++++++++----- .../executeHyperliquidTransaction/utils.ts | 4 +- wallets/provider-all/package.json | 8 +-- wallets/provider-binance/package.json | 8 +-- wallets/provider-bitget/package.json | 9 ++- wallets/provider-braavos/package.json | 4 +- wallets/provider-brave/package.json | 8 +-- wallets/provider-coin98/package.json | 8 +-- wallets/provider-coinbase/package.json | 8 +-- wallets/provider-default/package.json | 8 +-- wallets/provider-enkrypt/package.json | 8 +-- wallets/provider-exodus/package.json | 8 +-- wallets/provider-freighter/package.json | 2 + wallets/provider-gemwallet/package.json | 2 + wallets/provider-ledger-wallet/package.json | 6 +- wallets/provider-ledger/package.json | 8 +-- wallets/provider-math-wallet/package.json | 8 +-- wallets/provider-metamask/package.json | 8 +-- wallets/provider-noir-wallet/package.json | 2 + wallets/provider-okx/package.json | 9 ++- wallets/provider-phantom/package.json | 8 +-- wallets/provider-rabby/package.json | 8 +-- wallets/provider-ready/package.json | 4 +- wallets/provider-safe/package.json | 6 +- wallets/provider-safepal/package.json | 8 +-- wallets/provider-slush/package.json | 2 + wallets/provider-solflare/package.json | 4 +- wallets/provider-taho/package.json | 8 +-- wallets/provider-tokenpocket/package.json | 8 +-- wallets/provider-tomo/package.json | 8 +-- wallets/provider-tonconnect/package.json | 4 +- wallets/provider-trezor/package.json | 7 ++- wallets/provider-tron-link/package.json | 4 +- wallets/provider-trustwallet/package.json | 8 +-- wallets/provider-unisat/package.json | 4 +- wallets/provider-vultisig/package.json | 4 +- wallets/provider-walletconnect-2/package.json | 7 ++- .../src/adapter/adapter.ts | 43 +++++++++++++-- wallets/provider-xverse/package.json | 4 +- wallets/react/package.json | 4 +- widget/app/src/App.tsx | 2 + widget/app/src/constants.ts | 8 +++ widget/embedded/package.json | 4 +- widget/playground/src/store/config.ts | 2 + widget/playground/src/utils/configs.ts | 8 +++ yarn.lock | 24 ++++---- 53 files changed, 314 insertions(+), 154 deletions(-) diff --git a/blockchains/internal-blockchains/package.json b/blockchains/internal-blockchains/package.json index b68b5fa069..8ac3c5a1b3 100644 --- a/blockchains/internal-blockchains/package.json +++ b/blockchains/internal-blockchains/package.json @@ -29,7 +29,7 @@ }, "dependencies": { "@hub3js/bip122": "^0.4.0", - "@hub3js/evm": "0.8.1-next.1", + "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/solana": "^0.7.0", "@hub3js/starknet": "^0.6.0", "@hub3js/stellar": "^0.6.0", diff --git a/queue-manager/queue-manager-demo/src/components/Wallets/index.tsx b/queue-manager/queue-manager-demo/src/components/Wallets/index.tsx index 1feb9bad34..9637b4b195 100644 --- a/queue-manager/queue-manager-demo/src/components/Wallets/index.tsx +++ b/queue-manager/queue-manager-demo/src/components/Wallets/index.tsx @@ -1,8 +1,12 @@ -import { allProviders } from '@rango-dev/provider-all'; +import { allProviders, toNamespacesRPCUrls } from '@rango-dev/provider-all'; import { useWallets } from '@rango-dev/wallets-react'; import React from 'react'; -export const providers = allProviders().map((build) => build()); +import { RPC_URLS } from '../../configs'; + +export const providers = allProviders().map((build) => + build(toNamespacesRPCUrls(RPC_URLS)) +); export const wallets = providers.map((provider) => provider.id); diff --git a/queue-manager/queue-manager-demo/src/configs.ts b/queue-manager/queue-manager-demo/src/configs.ts index f6d8f26f39..d4342fa835 100644 --- a/queue-manager/queue-manager-demo/src/configs.ts +++ b/queue-manager/queue-manager-demo/src/configs.ts @@ -22,7 +22,7 @@ export function getConfig(name: keyof Configs) { return configs[name]; } -export function setConfig(name: keyof Configs, value: any) { +export function setConfig(name: K, value: Configs[K]) { configs[name] = value; return value; @@ -32,3 +32,11 @@ export function initConfig(nextConfigs: Configs) { configs = structuredClone(nextConfigs); return configs; } + +/** + * RPC urls for wallets that can't read the chain through themselves, such as + * Ledger and Trezor. Only Ethereum is configured here, on a public node. + */ +export const RPC_URLS = { + evm: { 1: ['https://ethereum-rpc.publicnode.com'] }, +}; diff --git a/queue-manager/queue-manager-demo/src/index.tsx b/queue-manager/queue-manager-demo/src/index.tsx index 1622c114ed..603c7cff8c 100644 --- a/queue-manager/queue-manager-demo/src/index.tsx +++ b/queue-manager/queue-manager-demo/src/index.tsx @@ -1,7 +1,11 @@ import type { WalletType } from '@hub3js/core'; import type { BlockchainMeta } from 'rango-types'; -import { allProviders, WalletTypes } from '@rango-dev/provider-all'; +import { + allProviders, + toNamespacesRPCUrls, + WalletTypes, +} from '@rango-dev/provider-all'; import { Events, Provider } from '@rango-dev/wallets-react'; import { RangoClient } from 'rango-sdk'; import React, { useEffect, useState } from 'react'; @@ -9,12 +13,15 @@ import { createRoot } from 'react-dom/client'; import { App } from './App'; import { + RPC_URLS, TON_CONNECT_MANIFEST_URL, TREZOR_MANIFEST, WC_PROJECT_ID, } from './configs'; -const providers = allProviders().map((build) => build()); +const providers = allProviders().map((build) => + build(toNamespacesRPCUrls(RPC_URLS)) +); function AppContainer() { const [connectedWallets, setConnectedWallets] = useState([]); diff --git a/queue-manager/rango-preset/package.json b/queue-manager/rango-preset/package.json index b7f843260c..54dc0f5b6f 100644 --- a/queue-manager/rango-preset/package.json +++ b/queue-manager/rango-preset/package.json @@ -36,7 +36,8 @@ }, "dependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "0.8.1-next.1", + "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/stellar": "^0.6.0", "@hub3js/xrpl": "^0.6.0", "@rango-dev/internal-blockchains": "^0.3.1-next.1", diff --git a/queue-manager/rango-preset/src/actions/executeEvmTransaction/index.ts b/queue-manager/rango-preset/src/actions/executeEvmTransaction/index.ts index b593c0d169..b16b05c519 100644 --- a/queue-manager/rango-preset/src/actions/executeEvmTransaction/index.ts +++ b/queue-manager/rango-preset/src/actions/executeEvmTransaction/index.ts @@ -6,4 +6,4 @@ export { signEvmTypedData, waitForEvmTransaction, } from './utils.js'; -export type { EvmNamespace, EvmTypedData } from './utils.js'; +export type { EvmNamespace } from './utils.js'; diff --git a/queue-manager/rango-preset/src/actions/executeEvmTransaction/utils.test.ts b/queue-manager/rango-preset/src/actions/executeEvmTransaction/utils.test.ts index 8facfa853c..41bb86a9f4 100644 --- a/queue-manager/rango-preset/src/actions/executeEvmTransaction/utils.test.ts +++ b/queue-manager/rango-preset/src/actions/executeEvmTransaction/utils.test.ts @@ -180,6 +180,61 @@ describe('sendEvmTransaction', () => { expect((error as SignerError).rpcCode).toBe(RPCErrorCode.REJECTION); }); + test("fails when the wallet resolves with 'null' instead of a hash", async () => { + const { namespace } = createNamespace(() => 'null'); + + const error = await sendEvmTransaction( + namespace, + createEvmTransaction(), + ADDRESS, + '1' + ).catch((error: unknown) => error); + + expect((error as SignerError).code).toBe(SignerErrorCode.SEND_TX_ERROR); + expect((error as SignerError).getErrorDetail().detail).toMatch( + /invalid hash.*hash=null/ + ); + }); + + test("fails when the legacy gas retry resolves with 'null'", async () => { + let attempts = 0; + const { namespace, request } = createNamespace(() => { + attempts++; + if (attempts === 1) { + throw new Error('EIP-1559 is not supported'); + } + return 'null'; + }); + + const error = await sendEvmTransaction( + namespace, + createEvmTransaction({ gasPrice: '20000000000' }), + ADDRESS, + '1' + ).catch((error: unknown) => error); + + expect(sentParams(request)).toHaveLength(2); + expect((error as SignerError).getErrorDetail().detail).toMatch( + /invalid hash.*hash=null/ + ); + }); + + test('keeps the context the wallet attached to its error', async () => { + const context = { peering: { name: 'Rainbow' }, code: 5000 }; + const { namespace } = createNamespace(() => { + throw Object.assign(new Error('Relay request failed'), { context }); + }); + + const error = await sendEvmTransaction( + namespace, + createEvmTransaction(), + ADDRESS, + '1' + ).catch((error: unknown) => error); + + expect((error as SignerError).getErrorContext()).toMatchObject(context); + }); + test("refuses to send when the wallet's chain doesn't match", async () => { const { namespace, request } = createNamespace(); diff --git a/queue-manager/rango-preset/src/actions/executeEvmTransaction/utils.ts b/queue-manager/rango-preset/src/actions/executeEvmTransaction/utils.ts index d9631ae12e..3c34907b1d 100644 --- a/queue-manager/rango-preset/src/actions/executeEvmTransaction/utils.ts +++ b/queue-manager/rango-preset/src/actions/executeEvmTransaction/utils.ts @@ -1,6 +1,6 @@ import type { SwapQueueContext } from '../../types'; import type { FindProxiedNamespace } from '@hub3js/core'; -import type { EvmActions } from '@hub3js/evm'; +import type { EvmActions, TypedDataDefinition } from '@hub3js/evm'; import type { DefaultNamespaces } from '@hub3js/namespaces'; import type { EvmTransaction } from 'rango-sdk'; import type { PendingSwap, PendingSwapStep } from 'rango-types'; @@ -20,14 +20,6 @@ export type EvmNamespace = FindProxiedNamespace<'evm', DefaultNamespaces>; type SendTransactionParameters = NonNullable< Parameters[0] >; -type SignTypedDataParameters = NonNullable< - Parameters[0] ->; -/** - * EIP-712 typed data in the shape the EVM namespace's `signTypedData` (viem's) - * takes, without the signing account. - */ -export type EvmTypedData = Omit; /** * A namespace action some wallets add when the hash `sendTransaction` returns @@ -73,7 +65,17 @@ export function toEvmSignerError( } let isRejected = false; + let context: Record | undefined; for (const item of errorChain(error)) { + /* + * A wallet can attach context for the logs to the error it throws, e.g. + * WalletConnect adds the session's peer. viem wraps it, so it's looked for + * along the chain. + */ + const itemContext = (item as { context?: unknown }).context; + if (!context && itemContext && typeof itemContext === 'object') { + context = itemContext as Record; + } if ( item.code === USER_REJECTED_REQUEST_CODE || item.name === 'UserRejectedRequestError' @@ -94,7 +96,8 @@ export function toEvmSignerError( undefined, message, isRejected ? RPCErrorCode.REJECTION : RPCErrorCode.UNKNOWN_ERROR, - error + error, + context ); } @@ -205,6 +208,23 @@ async function assertWalletMatches( } } +/** + * Some wallets (e.g. Rainbow over WalletConnect) resolve `eth_sendTransaction` + * with `'null'` instead of throwing when the user rejects it. Neither viem nor + * the namespace checks the result, so it's checked here, before it can be + * stored and polled as the transaction's hash. + */ +function assertTransactionHash(hash: unknown): `0x${string}` { + if (typeof hash !== 'string' || !hash.startsWith('0x')) { + throw new Error( + `Received an invalid hash on signing the transaction. (hash=${String( + hash + )})` + ); + } + return hash as `0x${string}`; +} + /** * Sends a transaction from Rango's API through the wallet's EVM namespace. */ @@ -225,7 +245,7 @@ export async function sendEvmTransaction( const hash = await namespace.sendTransaction( toEvmTransactionRequest(tx, address) ); - return { hash }; + return { hash: assertTransactionHash(hash) }; } catch (error) { // Some wallets reject EIP-1559 fees, retry with a legacy gas price. if (errorChainIncludes(error, 'EIP-1559')) { @@ -233,7 +253,7 @@ export async function sendEvmTransaction( const hash = await namespace.sendTransaction( toEvmTransactionRequest(tx, address, { legacyGas: true }) ); - return { hash }; + return { hash: assertTransactionHash(hash) }; } throw error; } @@ -247,14 +267,14 @@ export async function sendEvmTransaction( */ export async function signEvmTypedData( namespace: EvmNamespace, - typedData: EvmTypedData, + typedData: TypedDataDefinition, address: string ): Promise<`0x${string}`> { try { return await namespace.signTypedData({ ...typedData, - account: address, - } as SignTypedDataParameters); + account: address as `0x${string}`, + }); } catch (error) { throw toEvmSignerError(error, SignerErrorCode.SIGN_TX_ERROR); } diff --git a/queue-manager/rango-preset/src/actions/executeHyperliquidTransaction/utils.ts b/queue-manager/rango-preset/src/actions/executeHyperliquidTransaction/utils.ts index 8b38448a04..f537793557 100644 --- a/queue-manager/rango-preset/src/actions/executeHyperliquidTransaction/utils.ts +++ b/queue-manager/rango-preset/src/actions/executeHyperliquidTransaction/utils.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-magic-numbers */ import type { NextTransactionStateError } from '../common/produceNextStateForTransaction'; -import type { EvmTypedData } from '../executeEvmTransaction'; +import type { TypedDataDefinition } from '@hub3js/evm'; import type { HyperliquidTransaction, Transaction } from 'rango-sdk'; import type { Result } from 'ts-results'; @@ -58,7 +58,7 @@ export function ensureHyperliquidTransactionIsValid( export function getTypedDataFromMessage( message: string -): Result { +): Result { try { const typedData = JSON.parse(message); // `types` holds only the primary type: `EIP712Domain` is derived from `domain`. diff --git a/wallets/provider-all/package.json b/wallets/provider-all/package.json index 6a0d440ea6..e6cc35099a 100644 --- a/wallets/provider-all/package.json +++ b/wallets/provider-all/package.json @@ -61,8 +61,8 @@ "devDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.8.1-next.1", - "@hub3js/namespaces": "0.8.1-next.1", + "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/solana": "^0.7.0", "@hub3js/starknet": "^0.6.0", "@hub3js/std": "^0.6.0", @@ -75,8 +75,8 @@ "peerDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.8.1-next.1", - "@hub3js/namespaces": "0.8.1-next.1", + "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/solana": "^0.7.0", "@hub3js/starknet": "^0.6.0", "@hub3js/std": "^0.6.0", diff --git a/wallets/provider-binance/package.json b/wallets/provider-binance/package.json index 6d4a3ed047..ebf88b5874 100644 --- a/wallets/provider-binance/package.json +++ b/wallets/provider-binance/package.json @@ -26,14 +26,14 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.8.1-next.1", - "@hub3js/namespaces": "0.8.1-next.1", + "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.8.1-next.1", - "@hub3js/namespaces": "0.8.1-next.1", + "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/std": "^0.6.0" }, "publishConfig": { diff --git a/wallets/provider-bitget/package.json b/wallets/provider-bitget/package.json index 7e98f27b57..1142b0aeda 100644 --- a/wallets/provider-bitget/package.json +++ b/wallets/provider-bitget/package.json @@ -23,7 +23,6 @@ }, "dependencies": { "@rango-dev/internal-blockchains": "^0.3.1-next.1", - "@rango-dev/signer-evm": "^0.47.0", "@rango-dev/signer-tron": "^0.44.1-next.0", "bitcoinjs-lib": "^6.1.7", "rango-types": "^0.6.0" @@ -31,16 +30,16 @@ "devDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.8.1-next.1", - "@hub3js/namespaces": "0.8.1-next.1", + "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/std": "^0.6.0", "@hub3js/tron": "^0.3.0" }, "peerDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.8.1-next.1", - "@hub3js/namespaces": "0.8.1-next.1", + "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/std": "^0.6.0", "@hub3js/tron": "^0.3.0" }, diff --git a/wallets/provider-braavos/package.json b/wallets/provider-braavos/package.json index 5d3afffeb3..d6fce4a259 100644 --- a/wallets/provider-braavos/package.json +++ b/wallets/provider-braavos/package.json @@ -27,13 +27,13 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "0.8.1-next.1", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/starknet": "^0.6.0", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "0.8.1-next.1", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/starknet": "^0.6.0", "@hub3js/std": "^0.6.0" }, diff --git a/wallets/provider-brave/package.json b/wallets/provider-brave/package.json index fc47828ba0..91b8dc145d 100644 --- a/wallets/provider-brave/package.json +++ b/wallets/provider-brave/package.json @@ -27,15 +27,15 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.8.1-next.1", - "@hub3js/namespaces": "0.8.1-next.1", + "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.8.1-next.1", - "@hub3js/namespaces": "0.8.1-next.1", + "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, diff --git a/wallets/provider-coin98/package.json b/wallets/provider-coin98/package.json index 7d391f6329..7dcb1dd7c8 100644 --- a/wallets/provider-coin98/package.json +++ b/wallets/provider-coin98/package.json @@ -29,15 +29,15 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.8.1-next.1", - "@hub3js/namespaces": "0.8.1-next.1", + "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.8.1-next.1", - "@hub3js/namespaces": "0.8.1-next.1", + "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, diff --git a/wallets/provider-coinbase/package.json b/wallets/provider-coinbase/package.json index 7873112d7d..70b12305b6 100644 --- a/wallets/provider-coinbase/package.json +++ b/wallets/provider-coinbase/package.json @@ -28,15 +28,15 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.8.1-next.1", - "@hub3js/namespaces": "0.8.1-next.1", + "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.8.1-next.1", - "@hub3js/namespaces": "0.8.1-next.1", + "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, diff --git a/wallets/provider-default/package.json b/wallets/provider-default/package.json index dec1959dd7..ec0941717d 100644 --- a/wallets/provider-default/package.json +++ b/wallets/provider-default/package.json @@ -26,14 +26,14 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.8.1-next.1", - "@hub3js/namespaces": "0.8.1-next.1", + "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.8.1-next.1", - "@hub3js/namespaces": "0.8.1-next.1", + "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/std": "^0.6.0" }, "publishConfig": { diff --git a/wallets/provider-enkrypt/package.json b/wallets/provider-enkrypt/package.json index ac5d5857bd..bff39bcc64 100644 --- a/wallets/provider-enkrypt/package.json +++ b/wallets/provider-enkrypt/package.json @@ -26,14 +26,14 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.8.1-next.1", - "@hub3js/namespaces": "0.8.1-next.1", + "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.8.1-next.1", - "@hub3js/namespaces": "0.8.1-next.1", + "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/std": "^0.6.0" }, "publishConfig": { diff --git a/wallets/provider-exodus/package.json b/wallets/provider-exodus/package.json index eecb77a25a..2235392569 100644 --- a/wallets/provider-exodus/package.json +++ b/wallets/provider-exodus/package.json @@ -28,15 +28,15 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.8.1-next.1", - "@hub3js/namespaces": "0.8.1-next.1", + "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.8.1-next.1", - "@hub3js/namespaces": "0.8.1-next.1", + "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, diff --git a/wallets/provider-freighter/package.json b/wallets/provider-freighter/package.json index d17a207139..d96ce75990 100644 --- a/wallets/provider-freighter/package.json +++ b/wallets/provider-freighter/package.json @@ -28,11 +28,13 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/std": "^0.6.0", "@hub3js/stellar": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/std": "^0.6.0", "@hub3js/stellar": "^0.6.0" }, diff --git a/wallets/provider-gemwallet/package.json b/wallets/provider-gemwallet/package.json index 711f90bbeb..7e5f13a6a2 100644 --- a/wallets/provider-gemwallet/package.json +++ b/wallets/provider-gemwallet/package.json @@ -28,11 +28,13 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/std": "^0.6.0", "@hub3js/xrpl": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/std": "^0.6.0", "@hub3js/xrpl": "^0.6.0" }, diff --git a/wallets/provider-ledger-wallet/package.json b/wallets/provider-ledger-wallet/package.json index b7c8eb56a0..cc18fd56c6 100644 --- a/wallets/provider-ledger-wallet/package.json +++ b/wallets/provider-ledger-wallet/package.json @@ -26,12 +26,14 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.8.1-next.1", + "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.8.1-next.1", + "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/std": "^0.6.0" }, "publishConfig": { diff --git a/wallets/provider-ledger/package.json b/wallets/provider-ledger/package.json index 387d502986..0b73058136 100644 --- a/wallets/provider-ledger/package.json +++ b/wallets/provider-ledger/package.json @@ -38,15 +38,15 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.8.1-next.1", - "@hub3js/namespaces": "0.8.1-next.1", + "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.8.1-next.1", - "@hub3js/namespaces": "0.8.1-next.1", + "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, diff --git a/wallets/provider-math-wallet/package.json b/wallets/provider-math-wallet/package.json index 9d7b173fb4..bac40baef8 100644 --- a/wallets/provider-math-wallet/package.json +++ b/wallets/provider-math-wallet/package.json @@ -27,15 +27,15 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.8.1-next.1", - "@hub3js/namespaces": "0.8.1-next.1", + "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.8.1-next.1", - "@hub3js/namespaces": "0.8.1-next.1", + "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, diff --git a/wallets/provider-metamask/package.json b/wallets/provider-metamask/package.json index 1d6f9ca870..ab1fd8752d 100644 --- a/wallets/provider-metamask/package.json +++ b/wallets/provider-metamask/package.json @@ -29,8 +29,8 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.8.1-next.1", - "@hub3js/namespaces": "0.8.1-next.1", + "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0", "@solana/wallet-standard-features": "^1.3.0", @@ -39,8 +39,8 @@ }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.8.1-next.1", - "@hub3js/namespaces": "0.8.1-next.1", + "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, diff --git a/wallets/provider-noir-wallet/package.json b/wallets/provider-noir-wallet/package.json index 132e9865e2..0e383c384d 100644 --- a/wallets/provider-noir-wallet/package.json +++ b/wallets/provider-noir-wallet/package.json @@ -30,11 +30,13 @@ "devDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/std": "^0.6.0" }, "publishConfig": { diff --git a/wallets/provider-okx/package.json b/wallets/provider-okx/package.json index 70633b948d..47ee85a5c0 100644 --- a/wallets/provider-okx/package.json +++ b/wallets/provider-okx/package.json @@ -23,7 +23,6 @@ }, "dependencies": { "@rango-dev/internal-blockchains": "^0.3.1-next.1", - "@rango-dev/signer-evm": "^0.47.0", "@rango-dev/signer-solana": "^0.51.1-next.0", "@rango-dev/signer-sui": "^0.13.1-next.0", "@rango-dev/signer-ton": "^0.31.1-next.0", @@ -34,8 +33,8 @@ "devDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.8.1-next.1", - "@hub3js/namespaces": "0.8.1-next.1", + "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0", "@hub3js/sui": "^0.6.0", @@ -45,8 +44,8 @@ "peerDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.8.1-next.1", - "@hub3js/namespaces": "0.8.1-next.1", + "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0", "@hub3js/sui": "^0.6.0", diff --git a/wallets/provider-phantom/package.json b/wallets/provider-phantom/package.json index 09d38099e3..284b07e54b 100644 --- a/wallets/provider-phantom/package.json +++ b/wallets/provider-phantom/package.json @@ -33,16 +33,16 @@ "devDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.8.1-next.1", - "@hub3js/namespaces": "0.8.1-next.1", + "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.8.1-next.1", - "@hub3js/namespaces": "0.8.1-next.1", + "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, diff --git a/wallets/provider-rabby/package.json b/wallets/provider-rabby/package.json index 61dad3bcce..e8219018d6 100644 --- a/wallets/provider-rabby/package.json +++ b/wallets/provider-rabby/package.json @@ -26,14 +26,14 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.8.1-next.1", - "@hub3js/namespaces": "0.8.1-next.1", + "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.8.1-next.1", - "@hub3js/namespaces": "0.8.1-next.1", + "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/std": "^0.6.0" }, "publishConfig": { diff --git a/wallets/provider-ready/package.json b/wallets/provider-ready/package.json index 8fa53e2002..b999408545 100644 --- a/wallets/provider-ready/package.json +++ b/wallets/provider-ready/package.json @@ -27,13 +27,13 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "0.8.1-next.1", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/starknet": "^0.6.0", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "0.8.1-next.1", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/starknet": "^0.6.0", "@hub3js/std": "^0.6.0" }, diff --git a/wallets/provider-safe/package.json b/wallets/provider-safe/package.json index ac140be43f..a6a8269126 100644 --- a/wallets/provider-safe/package.json +++ b/wallets/provider-safe/package.json @@ -27,12 +27,14 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.8.1-next.1", + "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.8.1-next.1", + "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/std": "^0.6.0" }, "publishConfig": { diff --git a/wallets/provider-safepal/package.json b/wallets/provider-safepal/package.json index 06cf6bd876..aa33589b90 100644 --- a/wallets/provider-safepal/package.json +++ b/wallets/provider-safepal/package.json @@ -28,14 +28,14 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.8.1-next.1", - "@hub3js/namespaces": "0.8.1-next.1", + "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.8.1-next.1", - "@hub3js/namespaces": "0.8.1-next.1", + "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/std": "^0.6.0" }, "publishConfig": { diff --git a/wallets/provider-slush/package.json b/wallets/provider-slush/package.json index 6dd972fd2a..e932593d13 100644 --- a/wallets/provider-slush/package.json +++ b/wallets/provider-slush/package.json @@ -29,11 +29,13 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/std": "^0.6.0", "@hub3js/sui": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/std": "^0.6.0", "@hub3js/sui": "^0.6.0" }, diff --git a/wallets/provider-solflare/package.json b/wallets/provider-solflare/package.json index a06befa2c6..b2611f59f4 100644 --- a/wallets/provider-solflare/package.json +++ b/wallets/provider-solflare/package.json @@ -29,13 +29,13 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "0.8.1-next.1", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "0.8.1-next.1", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, diff --git a/wallets/provider-taho/package.json b/wallets/provider-taho/package.json index d7f5847e27..9974b565a3 100644 --- a/wallets/provider-taho/package.json +++ b/wallets/provider-taho/package.json @@ -26,14 +26,14 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.8.1-next.1", - "@hub3js/namespaces": "0.8.1-next.1", + "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.8.1-next.1", - "@hub3js/namespaces": "0.8.1-next.1", + "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/std": "^0.6.0" }, "publishConfig": { diff --git a/wallets/provider-tokenpocket/package.json b/wallets/provider-tokenpocket/package.json index 441defdd0b..3dbf825804 100644 --- a/wallets/provider-tokenpocket/package.json +++ b/wallets/provider-tokenpocket/package.json @@ -26,14 +26,14 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.8.1-next.1", - "@hub3js/namespaces": "0.8.1-next.1", + "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.8.1-next.1", - "@hub3js/namespaces": "0.8.1-next.1", + "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/std": "^0.6.0" }, "publishConfig": { diff --git a/wallets/provider-tomo/package.json b/wallets/provider-tomo/package.json index a88aa0a9bb..5f358eabf5 100644 --- a/wallets/provider-tomo/package.json +++ b/wallets/provider-tomo/package.json @@ -26,14 +26,14 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.8.1-next.1", - "@hub3js/namespaces": "0.8.1-next.1", + "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.8.1-next.1", - "@hub3js/namespaces": "0.8.1-next.1", + "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/std": "^0.6.0" }, "publishConfig": { diff --git a/wallets/provider-tonconnect/package.json b/wallets/provider-tonconnect/package.json index f039c8884a..410f8c39e4 100644 --- a/wallets/provider-tonconnect/package.json +++ b/wallets/provider-tonconnect/package.json @@ -30,13 +30,13 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "0.8.1-next.1", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/std": "^0.6.0", "@hub3js/tvm": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "0.8.1-next.1", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/std": "^0.6.0", "@hub3js/tvm": "^0.6.0" }, diff --git a/wallets/provider-trezor/package.json b/wallets/provider-trezor/package.json index 64c60401c1..1aba9b6dcb 100644 --- a/wallets/provider-trezor/package.json +++ b/wallets/provider-trezor/package.json @@ -24,7 +24,6 @@ "dependencies": { "@bitcoinerlab/secp256k1": "^1.2.0", "@rango-dev/internal-blockchains": "^0.3.1-next.1", - "@rango-dev/signer-evm": "^0.47.0", "@trezor/connect-web": "^9.5.0", "bitcoinjs-lib": "^6.1.7", "ethers": "^6.13.2", @@ -33,13 +32,15 @@ "devDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.8.1-next.1", + "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.8.1-next.1", + "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/std": "^0.6.0" }, "publishConfig": { diff --git a/wallets/provider-tron-link/package.json b/wallets/provider-tron-link/package.json index 133e36718f..6b1ca78a7c 100644 --- a/wallets/provider-tron-link/package.json +++ b/wallets/provider-tron-link/package.json @@ -27,13 +27,13 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "0.8.1-next.1", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/std": "^0.6.0", "@hub3js/tron": "^0.3.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "0.8.1-next.1", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/std": "^0.6.0", "@hub3js/tron": "^0.3.0" }, diff --git a/wallets/provider-trustwallet/package.json b/wallets/provider-trustwallet/package.json index fa978fef99..fc74f874a2 100644 --- a/wallets/provider-trustwallet/package.json +++ b/wallets/provider-trustwallet/package.json @@ -28,15 +28,15 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.8.1-next.1", - "@hub3js/namespaces": "0.8.1-next.1", + "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.8.1-next.1", - "@hub3js/namespaces": "0.8.1-next.1", + "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, diff --git a/wallets/provider-unisat/package.json b/wallets/provider-unisat/package.json index c306d70f86..d734a21dd1 100644 --- a/wallets/provider-unisat/package.json +++ b/wallets/provider-unisat/package.json @@ -30,13 +30,13 @@ "devDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "0.8.1-next.1", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "0.8.1-next.1", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/std": "^0.6.0" }, "publishConfig": { diff --git a/wallets/provider-vultisig/package.json b/wallets/provider-vultisig/package.json index 79c9fe571b..d3f70a898c 100644 --- a/wallets/provider-vultisig/package.json +++ b/wallets/provider-vultisig/package.json @@ -28,13 +28,13 @@ "devDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "0.8.1-next.1", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "0.8.1-next.1", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/std": "^0.6.0" }, "publishConfig": { diff --git a/wallets/provider-walletconnect-2/package.json b/wallets/provider-walletconnect-2/package.json index 9d3f46ace5..eaf6382508 100644 --- a/wallets/provider-walletconnect-2/package.json +++ b/wallets/provider-walletconnect-2/package.json @@ -25,7 +25,6 @@ "@bitcoinerlab/secp256k1": "^1.2.0", "@rango-dev/internal-blockchains": "^0.3.1-next.1", "@rango-dev/logging-core": "^0.16.1-next.1", - "@rango-dev/signer-evm": "^0.47.0", "@reown/appkit": "1.8.24", "@walletconnect/encoding": "^1.0.2", "@walletconnect/sign-client": "2.23.7", @@ -40,14 +39,16 @@ "devDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.8.1-next.1", + "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/std": "^0.6.0", "@walletconnect/types": "2.23.7" }, "peerDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.8.1-next.1", + "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/std": "^0.6.0" }, "publishConfig": { diff --git a/wallets/provider-walletconnect-2/src/adapter/adapter.ts b/wallets/provider-walletconnect-2/src/adapter/adapter.ts index 72729411e5..7041ec6eb6 100644 --- a/wallets/provider-walletconnect-2/src/adapter/adapter.ts +++ b/wallets/provider-walletconnect-2/src/adapter/adapter.ts @@ -54,6 +54,29 @@ export interface WalletConnectAdapterConfig { modalZIndex?: number; } +/** + * Attaches the session's namespaces and peer metadata, and the wallet's error + * code, to an error a relayed request failed with. + */ +function withSessionContext(error: unknown, session: SessionTypes.Struct) { + const wrapped = + error instanceof Error + ? error + : Object.assign( + new Error( + (error as { message?: string } | null)?.message ?? String(error) + ), + { code: (error as { code?: unknown } | null)?.code } + ); + return Object.assign(wrapped, { + context: { + namespaces: session.namespaces, + peering: session.peer?.metadata, + code: (error as { code?: unknown } | null)?.code, + }, + }); +} + export class WalletConnectAdapter { readonly #projectId: string; readonly #disableModalLink?: string; @@ -171,11 +194,21 @@ export class WalletConnectAdapter { ); } - return (await this.getClient()).request({ - topic: session.topic, - chainId: `${NAMESPACES.ETHEREUM}:${reference}`, - request: { method, params }, - }); + try { + return await ( + await this.getClient() + ).request({ + topic: session.topic, + chainId: `${NAMESPACES.ETHEREUM}:${reference}`, + request: { method, params }, + }); + } catch (error) { + /* + * Tells the logs which wallet app the session is with. queue-manager + * passes it on as the signer error's context. + */ + throw withSessionContext(error, session); + } } const provider = await this.#getRpcProvider(); diff --git a/wallets/provider-xverse/package.json b/wallets/provider-xverse/package.json index a21b2f93aa..7917a96a6c 100644 --- a/wallets/provider-xverse/package.json +++ b/wallets/provider-xverse/package.json @@ -28,13 +28,13 @@ "devDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "0.8.1-next.1", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "0.8.1-next.1", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/std": "^0.6.0" }, "publishConfig": { diff --git a/wallets/react/package.json b/wallets/react/package.json index 99894e5fa8..db848b7112 100644 --- a/wallets/react/package.json +++ b/wallets/react/package.json @@ -33,8 +33,8 @@ "dependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.8.1-next.1", - "@hub3js/namespaces": "0.8.1-next.1", + "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0", "@hub3js/sui": "^0.6.0", diff --git a/widget/app/src/App.tsx b/widget/app/src/App.tsx index fca2fdbcc3..f6b5f4263e 100644 --- a/widget/app/src/App.tsx +++ b/widget/app/src/App.tsx @@ -5,6 +5,7 @@ import React, { useRef } from 'react'; import { Route, Routes, useSearchParams } from 'react-router-dom'; import { + RPC_URLS, TON_CONNECT_MANIFEST_URL, TREZOR_MANIFEST, WC_PROJECT_ID, @@ -41,6 +42,7 @@ export function App() { walletConnectProjectId: WC_PROJECT_ID, trezorManifest: TREZOR_MANIFEST, tonConnect: { manifestUrl: TON_CONNECT_MANIFEST_URL }, + rpcUrls: RPC_URLS, }; } if (!!config) { diff --git a/widget/app/src/constants.ts b/widget/app/src/constants.ts index 02a20ef1ea..bd4ea19715 100644 --- a/widget/app/src/constants.ts +++ b/widget/app/src/constants.ts @@ -5,3 +5,11 @@ export const TREZOR_MANIFEST = { }; export const TON_CONNECT_MANIFEST_URL = 'https://raw.githubusercontent.com/rango-exchange/assets/refs/heads/main/manifests/tonconnect/manifest.json'; + +/** + * RPC urls for wallets that can't read the chain through themselves, such as + * Ledger and Trezor. Only Ethereum is configured here, on a public node. + */ +export const RPC_URLS = { + evm: { 1: ['https://ethereum-rpc.publicnode.com'] }, +}; diff --git a/widget/embedded/package.json b/widget/embedded/package.json index 494dc93275..b4684078ef 100644 --- a/widget/embedded/package.json +++ b/widget/embedded/package.json @@ -25,8 +25,8 @@ "dependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.8.1-next.1", - "@hub3js/namespaces": "0.8.1-next.1", + "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", "@hub3js/solana": "^0.7.0", "@hub3js/starknet": "^0.6.0", "@hub3js/std": "^0.6.0", diff --git a/widget/playground/src/store/config.ts b/widget/playground/src/store/config.ts index 343ff01e97..9b63a27478 100644 --- a/widget/playground/src/store/config.ts +++ b/widget/playground/src/store/config.ts @@ -15,6 +15,7 @@ import { immer } from 'zustand/middleware/immer'; import { DEFAULT_THEME_COLORS } from '../constants'; import { getConfig, + RPC_URLS, TON_CONNECT_MANIFEST_URL, TREZOR_MANIFEST, } from '../utils/configs'; @@ -81,6 +82,7 @@ export const initialConfig: WidgetConfig = { walletConnectProjectId: getConfig('WC_PROJECT_ID'), trezorManifest: TREZOR_MANIFEST, tonConnect: { manifestUrl: TON_CONNECT_MANIFEST_URL }, + rpcUrls: RPC_URLS, amount: undefined, externalWallets: false, variant: 'default', diff --git a/widget/playground/src/utils/configs.ts b/widget/playground/src/utils/configs.ts index 305a212915..86054ee6fc 100644 --- a/widget/playground/src/utils/configs.ts +++ b/widget/playground/src/utils/configs.ts @@ -55,3 +55,11 @@ export const isConfigChanged = (widgetConfig: WidgetConfig) => { filterConfig(widgetConfig, initialConfig)?.filteredConfigForExport ); }; + +/** + * RPC urls for wallets that can't read the chain through themselves, such as + * Ledger and Trezor. Only Ethereum is configured here, on a public node. + */ +export const RPC_URLS = { + evm: { 1: ['https://ethereum-rpc.publicnode.com'] }, +}; diff --git a/yarn.lock b/yarn.lock index feacac3f2b..af1ab0dcec 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2927,23 +2927,23 @@ rango-types "^0.6.0" zustand "^4.5.2" -"@hub3js/evm@0.8.1-next.1", "@hub3js/evm@^0.8.1-next.1": - version "0.8.1-next.1" - resolved "https://registry.yarnpkg.com/@hub3js/evm/-/evm-0.8.1-next.1.tgz#56708f95bd514156ae07626f85943453949eef3d" - integrity sha512-PjrCgiV6oixYA/2bQ5TcP4seNBN7znHOEa8eryiEYAfPawf1Z90I2GXbHTNEPz3sl4GIOnFNkkeZhW4UMSIyTg== +"@hub3js/evm@0.0.0-experimental-1b9b89b0-20261110", "@hub3js/evm@^0.0.0-experimental-1b9b89b0-20261110": + version "0.0.0-experimental-1b9b89b0-20261110" + resolved "https://registry.yarnpkg.com/@hub3js/evm/-/evm-0.0.0-experimental-1b9b89b0-20261110.tgz#d82ff391885f9933f1e69d89817cf6b5c9bdd852" + integrity sha512-y04RaGvAHj1RwFVt1Yu6Nq8S0qVDv1JT2sBaDdhDRBMNWW6Lv4m1FXcaJXfrNfDZ9TD2ndrJdJhTYESHR9kcjA== dependencies: "@hub3js/std" "^0.6.0" - caip "^1.1.1" - rango-types "^0.6.0" - viem "^2.56.8" + "caip" "^1.1.1" + "rango-types" "^0.6.0" + "viem" "^2.56.8" -"@hub3js/namespaces@0.8.1-next.1": - version "0.8.1-next.1" - resolved "https://registry.yarnpkg.com/@hub3js/namespaces/-/namespaces-0.8.1-next.1.tgz#94bf15efa7ac57e5d87b8902c5c27ab9389d9a99" - integrity sha512-mnd/zARrhBdySL8QI+twBoZGcQCccGQ5BDtdebUn3PISMMn2x6MXzAMS696S08Ls3EEdbmnhtLB3/j8tyD+1Yg== +"@hub3js/namespaces@0.0.0-experimental-1b9b89b0-20261110": + version "0.0.0-experimental-1b9b89b0-20261110" + resolved "https://registry.yarnpkg.com/@hub3js/namespaces/-/namespaces-0.0.0-experimental-1b9b89b0-20261110.tgz#b7ef5268a76f61f7894152a9ec94dafa86faf588" + integrity sha512-G5fXEy5TyHkpWEMiDuOhRCTC+U+/n4dhg/EzNTL4uY6KIjc0RDBoFwpWPox2A50TgxQMnkTcO58yFHhSUN7LuA== dependencies: "@hub3js/bip122" "^0.4.0" - "@hub3js/evm" "^0.8.1-next.1" + "@hub3js/evm" "^0.0.0-experimental-1b9b89b0-20261110" "@hub3js/solana" "^0.7.0" "@hub3js/starknet" "^0.6.0" "@hub3js/stellar" "^0.6.0" From 1a035ab534409b67fb7eb7ac088c84a9ff297f73 Mon Sep 17 00:00:00 2001 From: arlert-armin Date: Wed, 11 Nov 2026 10:52:02 +0000 Subject: [PATCH 28/29] feat(widget): fall back to a public ethereum node when no rpc url is configured Ledger and Trezor read Ethereum through the EVM signer's public node before rpcUrls existed. Dapps that predate rpcUrls pass none, so the widget now uses that node for chain 1 when neither rpcUrls.evm[1] nor customEthereumRPC is set. Providers still get no url of their own. --- .../embedded/src/store/slices/config.test.ts | 22 +++++++++++++++---- widget/embedded/src/store/slices/config.ts | 15 +++++++++++-- widget/embedded/src/types/config.ts | 3 ++- 3 files changed, 33 insertions(+), 7 deletions(-) diff --git a/widget/embedded/src/store/slices/config.test.ts b/widget/embedded/src/store/slices/config.test.ts index b1459e855a..d35240f800 100644 --- a/widget/embedded/src/store/slices/config.test.ts +++ b/widget/embedded/src/store/slices/config.test.ts @@ -1,6 +1,6 @@ import { describe, expect, test } from 'vitest'; -import { rpcURLsFromConfig } from './config'; +import { DEFAULT_ETHEREUM_RPC_URL, rpcURLsFromConfig } from './config'; const BSC_CHAIN_ID = 56; @@ -11,8 +11,10 @@ const urlsByChain = (config: Parameters[0]) => ]); describe('rpcURLsFromConfig', () => { - test('passes no urls when none are configured', () => { - expect(rpcURLsFromConfig({ apiKey: '' })).toEqual({}); + test('falls back to the default node on Ethereum when nothing is configured', () => { + expect(urlsByChain({ apiKey: '' })).toEqual([ + [1, [DEFAULT_ETHEREUM_RPC_URL]], + ]); }); test('takes EVM urls per chain from rpcUrls', () => { @@ -21,7 +23,19 @@ describe('rpcURLsFromConfig', () => { apiKey: '', rpcUrls: { evm: { [BSC_CHAIN_ID]: ['https://bsc.example'] } }, }) - ).toEqual([[BSC_CHAIN_ID, ['https://bsc.example']]]); + ).toEqual([ + [1, [DEFAULT_ETHEREUM_RPC_URL]], + [BSC_CHAIN_ID, ['https://bsc.example']], + ]); + }); + + test("doesn't add the default node when Ethereum has urls", () => { + expect( + urlsByChain({ + apiKey: '', + rpcUrls: { evm: { 1: ['https://eth.example'] } }, + }) + ).toEqual([[1, ['https://eth.example']]]); }); test('tries customEthereumRPC first on Ethereum', () => { diff --git a/widget/embedded/src/store/slices/config.ts b/widget/embedded/src/store/slices/config.ts index 8d57c65091..2126130d85 100644 --- a/widget/embedded/src/store/slices/config.ts +++ b/widget/embedded/src/store/slices/config.ts @@ -85,10 +85,18 @@ export interface ConfigSlice { getAvailableProviders: () => Provider[]; } +/** + * The public Ethereum node wallets without an RPC of their own (Ledger, Trezor) + * read through when the dapp configures none, the same node the EVM signer + * used. It keeps them working for dapps that predate `rpcUrls`. + */ +export const DEFAULT_ETHEREUM_RPC_URL = 'https://ethereum-rpc.publicnode.com'; + /** * The RPC urls from the config, with `signers.customEthereumRPC` tried first on - * Ethereum. Providers get them when they're built, so they never fall back to - * an RPC the dapp didn't configure. + * Ethereum. Providers get them when they're built. Ethereum falls back to + * `DEFAULT_ETHEREUM_RPC_URL` when nothing is configured for it; other chains + * only get the urls the dapp configures. */ export function rpcURLsFromConfig(config: WidgetConfigWithoutLegacyProviders) { const evm = { ...config.rpcUrls?.evm }; @@ -100,6 +108,9 @@ export function rpcURLsFromConfig(config: WidgetConfigWithoutLegacyProviders) { ...(evm[ETHEREUM_CHAIN_ID] ?? []), ]; } + if (!evm[ETHEREUM_CHAIN_ID]?.length) { + evm[ETHEREUM_CHAIN_ID] = [DEFAULT_ETHEREUM_RPC_URL]; + } return toNamespacesRPCUrls({ ...config.rpcUrls, evm }); } diff --git a/widget/embedded/src/types/config.ts b/widget/embedded/src/types/config.ts index 8b7e7ebe71..6f4b14c16f 100644 --- a/widget/embedded/src/types/config.ts +++ b/widget/embedded/src/types/config.ts @@ -263,7 +263,8 @@ export type LedgerWalletConfig = { * @property {RpcUrlsConfig} rpcUrls - Optional RPC urls that wallets without an RPC of their own * (e.g. Ledger and Trezor) read the chain through. EVM urls are keyed by chain id, e.g. * `{ evm: { 1: ['https://…'], 56: ['https://…'] } }`. `signers.customEthereumRPC`, if set, is tried - * first for chain 1. Reads on a chain without urls fail. + * first for chain 1. Without any url for chain 1, a public Ethereum node is used, as before `rpcUrls` existed. + * Reads on any other chain without urls fail. * @property {WidgetVariant} variant * If it is expanded, multiple routes will show up on the home page; * If it is full-expanded, multiple routes will show up on the home page with full routes; From 3e343f5a93f12a10cf2fe19e26cca4d849e05489 Mon Sep 17 00:00:00 2001 From: arlert-armin Date: Wed, 11 Nov 2026 11:23:09 +0000 Subject: [PATCH 29/29] chore: pin hub3 evm to the next prerelease with TypedDataDefinition The export is merged and released as @hub3js/evm 0.8.1-next.2, so the experimental build is no longer needed. @hub3js/namespaces stays on 0.8.1-next.1, which takes that evm. Later namespaces prereleases bring a tron package whose TronWeb types don't compile in the providers. --- blockchains/internal-blockchains/package.json | 2 +- queue-manager/rango-preset/package.json | 4 ++-- wallets/provider-all/package.json | 8 +++---- wallets/provider-binance/package.json | 8 +++---- wallets/provider-bitget/package.json | 8 +++---- wallets/provider-braavos/package.json | 4 ++-- wallets/provider-brave/package.json | 8 +++---- wallets/provider-coin98/package.json | 8 +++---- wallets/provider-coinbase/package.json | 8 +++---- wallets/provider-default/package.json | 8 +++---- wallets/provider-enkrypt/package.json | 8 +++---- wallets/provider-exodus/package.json | 8 +++---- wallets/provider-freighter/package.json | 4 ++-- wallets/provider-gemwallet/package.json | 4 ++-- wallets/provider-ledger-wallet/package.json | 8 +++---- wallets/provider-ledger/package.json | 8 +++---- wallets/provider-math-wallet/package.json | 8 +++---- wallets/provider-metamask/package.json | 8 +++---- wallets/provider-noir-wallet/package.json | 4 ++-- wallets/provider-okx/package.json | 8 +++---- wallets/provider-phantom/package.json | 8 +++---- wallets/provider-rabby/package.json | 8 +++---- wallets/provider-ready/package.json | 4 ++-- wallets/provider-safe/package.json | 8 +++---- wallets/provider-safepal/package.json | 8 +++---- wallets/provider-slush/package.json | 4 ++-- wallets/provider-solflare/package.json | 4 ++-- wallets/provider-taho/package.json | 8 +++---- wallets/provider-tokenpocket/package.json | 8 +++---- wallets/provider-tomo/package.json | 8 +++---- wallets/provider-tonconnect/package.json | 4 ++-- wallets/provider-trezor/package.json | 8 +++---- wallets/provider-tron-link/package.json | 4 ++-- wallets/provider-trustwallet/package.json | 8 +++---- wallets/provider-unisat/package.json | 4 ++-- wallets/provider-vultisig/package.json | 4 ++-- wallets/provider-walletconnect-2/package.json | 8 +++---- wallets/provider-xverse/package.json | 4 ++-- wallets/react/package.json | 4 ++-- widget/embedded/package.json | 4 ++-- yarn.lock | 24 +++++++++---------- 41 files changed, 139 insertions(+), 139 deletions(-) diff --git a/blockchains/internal-blockchains/package.json b/blockchains/internal-blockchains/package.json index 8ac3c5a1b3..826263bdc7 100644 --- a/blockchains/internal-blockchains/package.json +++ b/blockchains/internal-blockchains/package.json @@ -29,7 +29,7 @@ }, "dependencies": { "@hub3js/bip122": "^0.4.0", - "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/evm": "0.8.1-next.2", "@hub3js/solana": "^0.7.0", "@hub3js/starknet": "^0.6.0", "@hub3js/stellar": "^0.6.0", diff --git a/queue-manager/rango-preset/package.json b/queue-manager/rango-preset/package.json index 54dc0f5b6f..7ee324aa56 100644 --- a/queue-manager/rango-preset/package.json +++ b/queue-manager/rango-preset/package.json @@ -36,8 +36,8 @@ }, "dependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/evm": "0.8.1-next.2", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/stellar": "^0.6.0", "@hub3js/xrpl": "^0.6.0", "@rango-dev/internal-blockchains": "^0.3.1-next.1", diff --git a/wallets/provider-all/package.json b/wallets/provider-all/package.json index e6cc35099a..c34b2f86c7 100644 --- a/wallets/provider-all/package.json +++ b/wallets/provider-all/package.json @@ -61,8 +61,8 @@ "devDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/evm": "0.8.1-next.2", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/solana": "^0.7.0", "@hub3js/starknet": "^0.6.0", "@hub3js/std": "^0.6.0", @@ -75,8 +75,8 @@ "peerDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/evm": "0.8.1-next.2", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/solana": "^0.7.0", "@hub3js/starknet": "^0.6.0", "@hub3js/std": "^0.6.0", diff --git a/wallets/provider-binance/package.json b/wallets/provider-binance/package.json index ebf88b5874..a6f4ecaa50 100644 --- a/wallets/provider-binance/package.json +++ b/wallets/provider-binance/package.json @@ -26,14 +26,14 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/evm": "0.8.1-next.2", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/evm": "0.8.1-next.2", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0" }, "publishConfig": { diff --git a/wallets/provider-bitget/package.json b/wallets/provider-bitget/package.json index 1142b0aeda..a4d45d8deb 100644 --- a/wallets/provider-bitget/package.json +++ b/wallets/provider-bitget/package.json @@ -30,16 +30,16 @@ "devDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/evm": "0.8.1-next.2", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0", "@hub3js/tron": "^0.3.0" }, "peerDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/evm": "0.8.1-next.2", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0", "@hub3js/tron": "^0.3.0" }, diff --git a/wallets/provider-braavos/package.json b/wallets/provider-braavos/package.json index d6fce4a259..5d3afffeb3 100644 --- a/wallets/provider-braavos/package.json +++ b/wallets/provider-braavos/package.json @@ -27,13 +27,13 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/starknet": "^0.6.0", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/starknet": "^0.6.0", "@hub3js/std": "^0.6.0" }, diff --git a/wallets/provider-brave/package.json b/wallets/provider-brave/package.json index 91b8dc145d..a076213130 100644 --- a/wallets/provider-brave/package.json +++ b/wallets/provider-brave/package.json @@ -27,15 +27,15 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/evm": "0.8.1-next.2", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/evm": "0.8.1-next.2", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, diff --git a/wallets/provider-coin98/package.json b/wallets/provider-coin98/package.json index 7dcb1dd7c8..0f99f6ce3f 100644 --- a/wallets/provider-coin98/package.json +++ b/wallets/provider-coin98/package.json @@ -29,15 +29,15 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/evm": "0.8.1-next.2", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/evm": "0.8.1-next.2", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, diff --git a/wallets/provider-coinbase/package.json b/wallets/provider-coinbase/package.json index 70b12305b6..dbda686d9e 100644 --- a/wallets/provider-coinbase/package.json +++ b/wallets/provider-coinbase/package.json @@ -28,15 +28,15 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/evm": "0.8.1-next.2", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/evm": "0.8.1-next.2", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, diff --git a/wallets/provider-default/package.json b/wallets/provider-default/package.json index ec0941717d..4f95d769ec 100644 --- a/wallets/provider-default/package.json +++ b/wallets/provider-default/package.json @@ -26,14 +26,14 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/evm": "0.8.1-next.2", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/evm": "0.8.1-next.2", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0" }, "publishConfig": { diff --git a/wallets/provider-enkrypt/package.json b/wallets/provider-enkrypt/package.json index bff39bcc64..2651fc11af 100644 --- a/wallets/provider-enkrypt/package.json +++ b/wallets/provider-enkrypt/package.json @@ -26,14 +26,14 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/evm": "0.8.1-next.2", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/evm": "0.8.1-next.2", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0" }, "publishConfig": { diff --git a/wallets/provider-exodus/package.json b/wallets/provider-exodus/package.json index 2235392569..020bb64dbf 100644 --- a/wallets/provider-exodus/package.json +++ b/wallets/provider-exodus/package.json @@ -28,15 +28,15 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/evm": "0.8.1-next.2", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/evm": "0.8.1-next.2", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, diff --git a/wallets/provider-freighter/package.json b/wallets/provider-freighter/package.json index d96ce75990..9e77e99d83 100644 --- a/wallets/provider-freighter/package.json +++ b/wallets/provider-freighter/package.json @@ -28,13 +28,13 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0", "@hub3js/stellar": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0", "@hub3js/stellar": "^0.6.0" }, diff --git a/wallets/provider-gemwallet/package.json b/wallets/provider-gemwallet/package.json index 7e5f13a6a2..4db0c18926 100644 --- a/wallets/provider-gemwallet/package.json +++ b/wallets/provider-gemwallet/package.json @@ -28,13 +28,13 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0", "@hub3js/xrpl": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0", "@hub3js/xrpl": "^0.6.0" }, diff --git a/wallets/provider-ledger-wallet/package.json b/wallets/provider-ledger-wallet/package.json index cc18fd56c6..a79ce20143 100644 --- a/wallets/provider-ledger-wallet/package.json +++ b/wallets/provider-ledger-wallet/package.json @@ -26,14 +26,14 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/evm": "0.8.1-next.2", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/evm": "0.8.1-next.2", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0" }, "publishConfig": { diff --git a/wallets/provider-ledger/package.json b/wallets/provider-ledger/package.json index 0b73058136..abcf82d985 100644 --- a/wallets/provider-ledger/package.json +++ b/wallets/provider-ledger/package.json @@ -38,15 +38,15 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/evm": "0.8.1-next.2", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/evm": "0.8.1-next.2", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, diff --git a/wallets/provider-math-wallet/package.json b/wallets/provider-math-wallet/package.json index bac40baef8..319d96046f 100644 --- a/wallets/provider-math-wallet/package.json +++ b/wallets/provider-math-wallet/package.json @@ -27,15 +27,15 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/evm": "0.8.1-next.2", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/evm": "0.8.1-next.2", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, diff --git a/wallets/provider-metamask/package.json b/wallets/provider-metamask/package.json index ab1fd8752d..15db47644b 100644 --- a/wallets/provider-metamask/package.json +++ b/wallets/provider-metamask/package.json @@ -29,8 +29,8 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/evm": "0.8.1-next.2", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0", "@solana/wallet-standard-features": "^1.3.0", @@ -39,8 +39,8 @@ }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/evm": "0.8.1-next.2", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, diff --git a/wallets/provider-noir-wallet/package.json b/wallets/provider-noir-wallet/package.json index 0e383c384d..032e6e5886 100644 --- a/wallets/provider-noir-wallet/package.json +++ b/wallets/provider-noir-wallet/package.json @@ -30,13 +30,13 @@ "devDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0" }, "publishConfig": { diff --git a/wallets/provider-okx/package.json b/wallets/provider-okx/package.json index 47ee85a5c0..c788f25ae5 100644 --- a/wallets/provider-okx/package.json +++ b/wallets/provider-okx/package.json @@ -33,8 +33,8 @@ "devDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/evm": "0.8.1-next.2", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0", "@hub3js/sui": "^0.6.0", @@ -44,8 +44,8 @@ "peerDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/evm": "0.8.1-next.2", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0", "@hub3js/sui": "^0.6.0", diff --git a/wallets/provider-phantom/package.json b/wallets/provider-phantom/package.json index 284b07e54b..ebbd0a76c0 100644 --- a/wallets/provider-phantom/package.json +++ b/wallets/provider-phantom/package.json @@ -33,16 +33,16 @@ "devDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/evm": "0.8.1-next.2", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/evm": "0.8.1-next.2", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, diff --git a/wallets/provider-rabby/package.json b/wallets/provider-rabby/package.json index e8219018d6..6462c2dae0 100644 --- a/wallets/provider-rabby/package.json +++ b/wallets/provider-rabby/package.json @@ -26,14 +26,14 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/evm": "0.8.1-next.2", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/evm": "0.8.1-next.2", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0" }, "publishConfig": { diff --git a/wallets/provider-ready/package.json b/wallets/provider-ready/package.json index b999408545..8fa53e2002 100644 --- a/wallets/provider-ready/package.json +++ b/wallets/provider-ready/package.json @@ -27,13 +27,13 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/starknet": "^0.6.0", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/starknet": "^0.6.0", "@hub3js/std": "^0.6.0" }, diff --git a/wallets/provider-safe/package.json b/wallets/provider-safe/package.json index a6a8269126..38b74aa7f6 100644 --- a/wallets/provider-safe/package.json +++ b/wallets/provider-safe/package.json @@ -27,14 +27,14 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/evm": "0.8.1-next.2", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/evm": "0.8.1-next.2", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0" }, "publishConfig": { diff --git a/wallets/provider-safepal/package.json b/wallets/provider-safepal/package.json index aa33589b90..ec0e58b96e 100644 --- a/wallets/provider-safepal/package.json +++ b/wallets/provider-safepal/package.json @@ -28,14 +28,14 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/evm": "0.8.1-next.2", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/evm": "0.8.1-next.2", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0" }, "publishConfig": { diff --git a/wallets/provider-slush/package.json b/wallets/provider-slush/package.json index e932593d13..a71782c33e 100644 --- a/wallets/provider-slush/package.json +++ b/wallets/provider-slush/package.json @@ -29,13 +29,13 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0", "@hub3js/sui": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0", "@hub3js/sui": "^0.6.0" }, diff --git a/wallets/provider-solflare/package.json b/wallets/provider-solflare/package.json index b2611f59f4..a06befa2c6 100644 --- a/wallets/provider-solflare/package.json +++ b/wallets/provider-solflare/package.json @@ -29,13 +29,13 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, diff --git a/wallets/provider-taho/package.json b/wallets/provider-taho/package.json index 9974b565a3..2f78b37793 100644 --- a/wallets/provider-taho/package.json +++ b/wallets/provider-taho/package.json @@ -26,14 +26,14 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/evm": "0.8.1-next.2", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/evm": "0.8.1-next.2", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0" }, "publishConfig": { diff --git a/wallets/provider-tokenpocket/package.json b/wallets/provider-tokenpocket/package.json index 3dbf825804..3c4fb6b148 100644 --- a/wallets/provider-tokenpocket/package.json +++ b/wallets/provider-tokenpocket/package.json @@ -26,14 +26,14 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/evm": "0.8.1-next.2", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/evm": "0.8.1-next.2", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0" }, "publishConfig": { diff --git a/wallets/provider-tomo/package.json b/wallets/provider-tomo/package.json index 5f358eabf5..5735f64779 100644 --- a/wallets/provider-tomo/package.json +++ b/wallets/provider-tomo/package.json @@ -26,14 +26,14 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/evm": "0.8.1-next.2", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/evm": "0.8.1-next.2", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0" }, "publishConfig": { diff --git a/wallets/provider-tonconnect/package.json b/wallets/provider-tonconnect/package.json index 410f8c39e4..f039c8884a 100644 --- a/wallets/provider-tonconnect/package.json +++ b/wallets/provider-tonconnect/package.json @@ -30,13 +30,13 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0", "@hub3js/tvm": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0", "@hub3js/tvm": "^0.6.0" }, diff --git a/wallets/provider-trezor/package.json b/wallets/provider-trezor/package.json index 1aba9b6dcb..cea0dc707c 100644 --- a/wallets/provider-trezor/package.json +++ b/wallets/provider-trezor/package.json @@ -32,15 +32,15 @@ "devDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/evm": "0.8.1-next.2", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/evm": "0.8.1-next.2", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0" }, "publishConfig": { diff --git a/wallets/provider-tron-link/package.json b/wallets/provider-tron-link/package.json index 6b1ca78a7c..133e36718f 100644 --- a/wallets/provider-tron-link/package.json +++ b/wallets/provider-tron-link/package.json @@ -27,13 +27,13 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0", "@hub3js/tron": "^0.3.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0", "@hub3js/tron": "^0.3.0" }, diff --git a/wallets/provider-trustwallet/package.json b/wallets/provider-trustwallet/package.json index fc74f874a2..92ad9c9637 100644 --- a/wallets/provider-trustwallet/package.json +++ b/wallets/provider-trustwallet/package.json @@ -28,15 +28,15 @@ }, "devDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/evm": "0.8.1-next.2", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/evm": "0.8.1-next.2", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0" }, diff --git a/wallets/provider-unisat/package.json b/wallets/provider-unisat/package.json index d734a21dd1..c306d70f86 100644 --- a/wallets/provider-unisat/package.json +++ b/wallets/provider-unisat/package.json @@ -30,13 +30,13 @@ "devDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0" }, "publishConfig": { diff --git a/wallets/provider-vultisig/package.json b/wallets/provider-vultisig/package.json index d3f70a898c..79c9fe571b 100644 --- a/wallets/provider-vultisig/package.json +++ b/wallets/provider-vultisig/package.json @@ -28,13 +28,13 @@ "devDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0" }, "publishConfig": { diff --git a/wallets/provider-walletconnect-2/package.json b/wallets/provider-walletconnect-2/package.json index eaf6382508..64f4ffa119 100644 --- a/wallets/provider-walletconnect-2/package.json +++ b/wallets/provider-walletconnect-2/package.json @@ -39,16 +39,16 @@ "devDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/evm": "0.8.1-next.2", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0", "@walletconnect/types": "2.23.7" }, "peerDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/evm": "0.8.1-next.2", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0" }, "publishConfig": { diff --git a/wallets/provider-xverse/package.json b/wallets/provider-xverse/package.json index 7917a96a6c..a21b2f93aa 100644 --- a/wallets/provider-xverse/package.json +++ b/wallets/provider-xverse/package.json @@ -28,13 +28,13 @@ "devDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0" }, "peerDependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/std": "^0.6.0" }, "publishConfig": { diff --git a/wallets/react/package.json b/wallets/react/package.json index db848b7112..02f16f94fd 100644 --- a/wallets/react/package.json +++ b/wallets/react/package.json @@ -33,8 +33,8 @@ "dependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/evm": "0.8.1-next.2", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/solana": "^0.7.0", "@hub3js/std": "^0.6.0", "@hub3js/sui": "^0.6.0", diff --git a/widget/embedded/package.json b/widget/embedded/package.json index b4684078ef..51d57e40c0 100644 --- a/widget/embedded/package.json +++ b/widget/embedded/package.json @@ -25,8 +25,8 @@ "dependencies": { "@hub3js/bip122": "^0.4.0", "@hub3js/core": "^0.64.0", - "@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110", - "@hub3js/namespaces": "0.0.0-experimental-1b9b89b0-20261110", + "@hub3js/evm": "0.8.1-next.2", + "@hub3js/namespaces": "0.8.1-next.1", "@hub3js/solana": "^0.7.0", "@hub3js/starknet": "^0.6.0", "@hub3js/std": "^0.6.0", diff --git a/yarn.lock b/yarn.lock index af1ab0dcec..caaca46022 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2927,23 +2927,23 @@ rango-types "^0.6.0" zustand "^4.5.2" -"@hub3js/evm@0.0.0-experimental-1b9b89b0-20261110", "@hub3js/evm@^0.0.0-experimental-1b9b89b0-20261110": - version "0.0.0-experimental-1b9b89b0-20261110" - resolved "https://registry.yarnpkg.com/@hub3js/evm/-/evm-0.0.0-experimental-1b9b89b0-20261110.tgz#d82ff391885f9933f1e69d89817cf6b5c9bdd852" - integrity sha512-y04RaGvAHj1RwFVt1Yu6Nq8S0qVDv1JT2sBaDdhDRBMNWW6Lv4m1FXcaJXfrNfDZ9TD2ndrJdJhTYESHR9kcjA== +"@hub3js/evm@0.8.1-next.2", "@hub3js/evm@^0.8.1-next.1": + version "0.8.1-next.2" + resolved "https://registry.yarnpkg.com/@hub3js/evm/-/evm-0.8.1-next.2.tgz#dfe14be111fed84fcb6bb18736a561dd1382e828" + integrity sha512-Eu7DPQleA6xvUYGmcRV98nyj5B6nZNwTUaDy0R/AwDzOg1fy/LQDvyHfEef7mOo2VB3z5+eluR60crgipza/Ng== dependencies: "@hub3js/std" "^0.6.0" - "caip" "^1.1.1" - "rango-types" "^0.6.0" - "viem" "^2.56.8" + caip "^1.1.1" + rango-types "^0.6.0" + viem "^2.56.8" -"@hub3js/namespaces@0.0.0-experimental-1b9b89b0-20261110": - version "0.0.0-experimental-1b9b89b0-20261110" - resolved "https://registry.yarnpkg.com/@hub3js/namespaces/-/namespaces-0.0.0-experimental-1b9b89b0-20261110.tgz#b7ef5268a76f61f7894152a9ec94dafa86faf588" - integrity sha512-G5fXEy5TyHkpWEMiDuOhRCTC+U+/n4dhg/EzNTL4uY6KIjc0RDBoFwpWPox2A50TgxQMnkTcO58yFHhSUN7LuA== +"@hub3js/namespaces@0.8.1-next.1": + version "0.8.1-next.1" + resolved "https://registry.yarnpkg.com/@hub3js/namespaces/-/namespaces-0.8.1-next.1.tgz#94bf15efa7ac57e5d87b8902c5c27ab9389d9a99" + integrity sha512-mnd/zARrhBdySL8QI+twBoZGcQCccGQ5BDtdebUn3PISMMn2x6MXzAMS696S08Ls3EEdbmnhtLB3/j8tyD+1Yg== dependencies: "@hub3js/bip122" "^0.4.0" - "@hub3js/evm" "^0.0.0-experimental-1b9b89b0-20261110" + "@hub3js/evm" "^0.8.1-next.1" "@hub3js/solana" "^0.7.0" "@hub3js/starknet" "^0.6.0" "@hub3js/stellar" "^0.6.0"