Skip to content

Commit

Permalink
fix: x and p send set address
Browse files Browse the repository at this point in the history
  • Loading branch information
vvava committed Oct 28, 2024
1 parent 68a849c commit e19795e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/pages/Send/components/SendAVM.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export const SendAVM = ({
token={nativeToken}
tokenList={tokenList}
onContactChanged={(contact) => {
if (contact?.addressXP) setAddress(contact.addressXP);
setAddress(contact?.addressXP ?? '');
}}
onAmountChanged={(newAmount) => setAmount(newAmount)}
onTokenChanged={() => {}} // noop, AVAX has only one token
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Send/components/SendPVM.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export const SendPVM = ({
token={nativeToken}
tokenList={tokenList}
onContactChanged={(contact) => {
if (contact?.addressXP) setAddress(contact.addressXP);
setAddress(contact?.addressXP ?? '');
}}
onAmountChanged={(newAmount) => setAmount(newAmount)}
onTokenChanged={() => {}} // noop, AVAX has only one token
Expand Down
11 changes: 8 additions & 3 deletions src/pages/Send/hooks/useIdentifyAddress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@ export const useIdentifyAddress = () => {
const identifyAddress = useCallback(
(address: string): Contact => {
if (!address)
return { ...UNSAVED_CONTACT_BASE, address: '', addressBTC: '' };
return {
...UNSAVED_CONTACT_BASE,
address: '',
addressBTC: '',
addressXP: '',
};
const addressLowerCase = address.toLowerCase();
for (const contact of contacts) {
if (
Expand Down Expand Up @@ -57,13 +62,13 @@ export const useIdentifyAddress = () => {
? { addressBTC: account.addressBTC, address: '' }
: isPchainNetwork(network)
? {
addressXP: account.addressPVM ? account.addressPVM : '',
addressXP: address,
address: '',
addressBTC: '',
}
: isXchainNetwork(network)
? {
addressXP: account.addressAVM ? account.addressAVM : '',
addressXP: address,
address: '',
addressBTC: '',
}
Expand Down

0 comments on commit e19795e

Please sign in to comment.