Skip to content
Open
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
ae181b6
chore: pin the experimental viem-based hub3 evm build and dedupe viem
arlert-armin Oct 6, 2026
3481a1a
feat(wallets): sign ledger and trezor evm transactions through namesp…
arlert-armin Oct 6, 2026
5167ce2
feat(wallets): move safe and ledger wallet evm signing onto their nam…
arlert-armin Oct 6, 2026
ab8cb93
feat(wallets): expose an eip-1193 view of walletconnect 2 sessions to…
arlert-armin Oct 6, 2026
d503808
feat(wallets): register viem actions on injected evm wallets
arlert-armin Oct 6, 2026
ad312e7
feat(wallets): register viem actions on injected evm wallets
arlert-armin Oct 6, 2026
19f5fe2
feat(wallets): register viem actions on injected evm wallets
arlert-armin Oct 6, 2026
6d75b65
feat(wallets): accept rpc urls in every provider
arlert-armin Oct 6, 2026
6f9a006
feat(wallets): declare provider rpc urls once in provider-all
arlert-armin Oct 6, 2026
d00c2c0
feat(queue-manager): send evm transactions through the evm namespace
arlert-armin Oct 6, 2026
a2da811
fix(wallets-react): return the hub's registered provider from hubProv…
arlert-armin Oct 16, 2026
30b6656
chore: adopt the hub3 evm build with explicit viem action params
arlert-armin Oct 19, 2026
59f31fa
chore: pin the hub3 evm build with per-chain rpc urls and dedupe viem
arlert-armin Nov 3, 2026
eab29b0
feat(wallets): take chain-aware evm rpc urls and make them optional
arlert-armin Oct 28, 2026
4b8f06b
feat(wallets): take chain-aware evm rpc urls and make them optional
arlert-armin Oct 28, 2026
0ff8d2b
feat(wallets): take chain-aware evm rpc urls and make them optional
arlert-armin Oct 28, 2026
85f5507
feat(wallets): take chain-aware evm rpc urls and make them optional
arlert-armin Nov 3, 2026
f55b201
feat(wallets): take chain-aware evm rpc urls and make them optional
arlert-armin Nov 3, 2026
e508fcf
feat(widget): take per-chain rpc urls from the widget config instead …
arlert-armin Nov 3, 2026
0bdea50
test(wallets): check safe's own signMessage wins over the viem adapter's
arlert-armin Nov 3, 2026
be8a225
chore: pin hub3 evm and namespaces to their next prereleases instead …
arlert-armin Nov 9, 2026
4b1c73e
refactor(queue-manager): type hyperliquid typed data with the evm nam…
arlert-armin Nov 9, 2026
30c45ea
refactor(queue-manager): make evm approvals send through the namespac…
arlert-armin Nov 9, 2026
f199844
refactor(queue-manager): drop the server approval status check now th…
arlert-armin Nov 9, 2026
38ea29d
refactor(queue-manager): send evm transactions from their own execute…
arlert-armin Nov 9, 2026
fb3d5c2
chore: take viem 2.57.17 for typed-data struct names with ':', and re…
arlert-armin Nov 9, 2026
6ecf0df
refactor: apply the third round of review feedback
arlert-armin Nov 10, 2026
1a035ab
feat(widget): fall back to a public ethereum node when no rpc url is …
arlert-armin Nov 11, 2026
3e343f5
chore: pin hub3 evm to the next prerelease with TypedDataDefinition
arlert-armin Nov 11, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion blockchains/internal-blockchains/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
},
"dependencies": {
"@hub3js/bip122": "^0.4.0",
"@hub3js/evm": "^0.8.0",
"@hub3js/evm": "0.0.0-experimental-1b9b89b0-20261110",
"@hub3js/solana": "^0.7.0",
"@hub3js/starknet": "^0.6.0",
"@hub3js/stellar": "^0.6.0",
Expand Down
20 changes: 0 additions & 20 deletions patches/@reown+appkit-controllers+1.8.20.patch

This file was deleted.

File renamed without changes.
7 changes: 0 additions & 7 deletions patches/viem+2.52.2.patch

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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);

Expand Down
10 changes: 9 additions & 1 deletion queue-manager/queue-manager-demo/src/configs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function getConfig(name: keyof Configs) {
return configs[name];
}

export function setConfig(name: keyof Configs, value: any) {
export function setConfig<K extends keyof Configs>(name: K, value: Configs[K]) {
configs[name] = value;

return value;
Expand All @@ -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'] },
};
11 changes: 9 additions & 2 deletions queue-manager/queue-manager-demo/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
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';
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<WalletType[]>([]);
Expand Down
3 changes: 2 additions & 1 deletion queue-manager/rango-preset/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
},
"dependencies": {
"@hub3js/core": "^0.64.0",
"@hub3js/namespaces": "^0.8.0",
"@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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,28 @@ 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 '../../executeEvmTransaction';

/**
* 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,
namespaceKey: 'evm',
signerTxType: TransactionType.EVM,

isApprovePrerequisite: isEvmApprovePrerequisite,

Expand Down Expand Up @@ -49,23 +64,22 @@ export const evmApproveAdapter: ApproveAdapter<'evm', EvmTransaction> = {
})
),

send: { through: 'namespace', sendTransaction: sendEvmTransaction },

getTransactionStatus: async (
namespace,
executedTransactionHash
): Promise<ApproveTransactionStatus> => {
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';
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -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,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -29,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';

Expand Down Expand Up @@ -137,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;
Expand Down Expand Up @@ -203,9 +209,23 @@ 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<TTransaction> =
walletSigners.getSigner<TTransaction>(approveAdapter.signerTxType);
const sender:
| NamespaceApproveSender<K, TTransaction>
| SignerApproveSender = approveAdapter.send;
const sendApproveTransaction = async (transaction: TTransaction) => {
if (sender.through === 'namespace') {
return sender.sendTransaction(
namespace,
transaction,
walletAddress,
chainId ?? null
);
}
const walletSigners = await getSigners(sourceWallet.walletType);
const signer: GenericSigner<TTransaction> =
walletSigners.getSigner<TTransaction>(sender.txType);
return signer.signAndSendTx(transaction, walletAddress, chainId);
Comment thread
RyukTheCoder marked this conversation as resolved.
Resolved
};

/*
* Approving takes two waits, and telling them apart matters to the user: a
Expand Down Expand Up @@ -235,10 +255,8 @@ export async function checkApprove<
isApproval: true,
});

const transactionResult = await signer.signAndSendTx(
approveTransactionResult.val,
walletAddress,
chainId
const transactionResult = await sendApproveTransaction(
approveTransactionResult.val
);

updateStorageWithPrerequisiteResult(actions, {
Expand Down
38 changes: 36 additions & 2 deletions queue-manager/rango-preset/src/actions/checkApprove/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<K>,
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<K, TTransaction>
: NamespaceApproveSender<K, TTransaction> | SignerApproveSender;

/**
* Per-chain strategy for the generic approve-prerequisite actions. Everything
* that differs between EVM and Tron is captured here; the actions themselves are
Expand All @@ -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. */
signerTxType: TransactionType;
/** Type guard for this chain's approve prerequisite. */
isApprovePrerequisite: (
prerequisite: TransactionPrerequisite
Expand All @@ -80,6 +112,8 @@ export interface ApproveAdapter<
prerequisite: ApprovePrerequisite,
namespace: ApproveCapableNamespace<K>
) => Promise<Result<TTransaction, NextTransactionStateError>>;
/** How the signed approve transaction is sent. */
send: ApproveSender<K, TTransaction>;
/** Reads the on-chain status of a submitted approve transaction. */
getTransactionStatus: (
namespace: ApproveCapableNamespace<K>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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);
}
Expand Down
Loading
Loading