Skip to content

Commit

Permalink
fix: wallet addreses convertation
Browse files Browse the repository at this point in the history
  • Loading branch information
iGroza committed Oct 25, 2024
1 parent 91386c8 commit 09d90c6
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/helpers/get-rpc-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ export async function getRpcProvider(provider: ProviderModel) {
await EthRpcEndpointAvailability.awaitForInitialization();
return new ethers.providers.StaticJsonRpcProvider(provider.ethRpcEndpoint, {
chainId: provider.ethChainId,
name: provider.id,
name: provider.name,
});
}
21 changes: 16 additions & 5 deletions src/models/wallet/wallet.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -396,12 +396,23 @@ class WalletStore implements RPCObserver {

getById(id: string = '') {
return (
this.wallets.find(
wallet =>
this.wallets.find(wallet => {
if (
wallet.address.toLowerCase() === id.toLowerCase() ||
wallet.tronAddress?.toLowerCase() === id.toLowerCase() ||
wallet.cosmosAddress.toLowerCase() === id.toLowerCase(),
) ?? null
wallet.cosmosAddress.toLowerCase() === id.toLowerCase()
) {
return wallet;
}

if (
!!wallet.tronAddress &&
wallet.tronAddress.toLowerCase() === id.toLowerCase()
) {
return wallet;
}

return null;
}) ?? null
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
TransactionStackParamList,
TransactionStackRoutes,
} from '@app/route-types';
import {NetworkProviderTypes} from '@app/services/backend';
import {ModalType} from '@app/types';

const logger = Logger.create('TransactionAddressScreen');
Expand Down Expand Up @@ -99,9 +100,10 @@ export const TransactionAddressScreen = observer(() => {
const onDone = useCallback(
async (result: string) => {
try {
const converter = AddressUtils.getConverterByNetwork(
Provider.selectedProvider.networkType,
);
const networkType = Provider.selectedProvider.isTron
? NetworkProviderTypes.TRON
: NetworkProviderTypes.EVM;
const converter = AddressUtils.getConverterByNetwork(networkType);
setLoading(true);
const {nft, token} = route.params || {};
if (nft) {
Expand Down
5 changes: 5 additions & 0 deletions src/services/eth-network/eth-network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,11 @@ export class EthNetwork {
provider,
);
}
txParams = {
...txParams,
from: AddressUtils.toEth(from),
to: AddressUtils.toEth(to),
};
const rpcProvider = await getRpcProvider(provider);
const {maxFeePerGas, maxPriorityFeePerGas} =
await rpcProvider.getFeeData();
Expand Down

0 comments on commit 09d90c6

Please sign in to comment.