Skip to content

Commit

Permalink
fix: destination address format (#197)
Browse files Browse the repository at this point in the history
<!--- Provide a general summary of your changes in the Title above -->

## Description

Fixes issue when entering invalid address format

<!--- Describe your changes in detail -->

## Related Issue Or Context

<!--- If suggesting a new feature or change, please discuss it in an
issue first -->
<!--- If fixing a bug, there should be an issue describing it with steps
to reproduce -->
<!--- Otherwise, describe context and motivation for change here -->

Closes: #189 

## How Has This Been Tested? Testing details.

<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, and the tests you ran
to -->
<!--- see how your change affects other areas of the code, etc. -->

## Types of changes

<!--- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->

- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
- [ ] Documentation

## Checklist:

<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->

- [ ] I have commented my code, particularly in hard-to-understand
areas.
- [ ] I have ensured that all acceptance criteria (or expected behavior)
from issue are met
- [ ] I have updated the documentation locally and in sygma-docs.
- [ ] I have added tests to cover my changes.
- [ ] I have ensured that all the checks are passing and green, I've
signed the CLA bot
  • Loading branch information
wainola authored Jun 12, 2024
1 parent 8c2cdad commit 250ea35
Showing 1 changed file with 14 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -338,18 +338,6 @@ export class FungibleTokenTransferController implements ReactiveController {
if (this.transferTransactionId) {
return FungibleTransferState.COMPLETED;
}
if (this.waitingUserConfirmation) {
return FungibleTransferState.WAITING_USER_CONFIRMATION;
}
if (this.waitingTxExecution) {
return FungibleTransferState.WAITING_TX_EXECUTION;
}
if (this.pendingEvmApprovalTransactions.length > 0) {
return FungibleTransferState.PENDING_APPROVALS;
}
if (this.pendingTransferTransaction) {
return FungibleTransferState.PENDING_TRANSFER;
}
if (!this.sourceNetwork) {
return FungibleTransferState.MISSING_SOURCE_NETWORK;
}
Expand All @@ -359,25 +347,31 @@ export class FungibleTokenTransferController implements ReactiveController {
if (!this.selectedResource) {
return FungibleTransferState.MISSING_RESOURCE;
}

if (this.destinationAddress === '') {
return FungibleTransferState.MISSING_DESTINATION_ADDRESS;
if (this.resourceAmount.eq(0)) {
return FungibleTransferState.MISSING_RESOURCE_AMOUNT;
}

if (
this.destinationAddress === null ||
this.destinationAddress === undefined ||
validateAddress(this.destinationAddress, this.destinationNetwork.type)
) {
return FungibleTransferState.INVALID_DESTINATION_ADDRESS;
}

if (this.resourceAmount.eq(0)) {
return FungibleTransferState.MISSING_RESOURCE_AMOUNT;
}
if (this.destinationAddress === '') {
return FungibleTransferState.MISSING_DESTINATION_ADDRESS;
}
if (this.waitingUserConfirmation) {
return FungibleTransferState.WAITING_USER_CONFIRMATION;
}
if (this.waitingTxExecution) {
return FungibleTransferState.WAITING_TX_EXECUTION;
}
if (this.pendingEvmApprovalTransactions.length > 0) {
return FungibleTransferState.PENDING_APPROVALS;
}
if (this.pendingTransferTransaction) {
return FungibleTransferState.PENDING_TRANSFER;
}
if (
!this.walletContext.value?.evmWallet &&
!this.walletContext.value?.substrateWallet
Expand Down

0 comments on commit 250ea35

Please sign in to comment.