Skip to content

Commit

Permalink
Fix/polkadot address validation (#1119)
Browse files Browse the repository at this point in the history
* fix polkadot address validation

* Fix polkadot address validation

---------

Co-authored-by: Marek Epicode <[email protected]>
  • Loading branch information
0xepicode and msadura authored Dec 9, 2024
1 parent 18f1bd7 commit baeb2e6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/giant-snails-chew.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@swapkit/toolbox-substrate": patch
---

Fix polkadot address validation
10 changes: 8 additions & 2 deletions packages/toolboxes/substrate/src/toolbox/baseSubstrateToolbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,16 @@ export const substrateValidateAddress = ({
}: { address: string; chain: Chain.Polkadot | Chain.Chainflip }) => {
switch (chain) {
case Chain.Polkadot: {
return validateAddress(address, Network.DOT.prefix || Network.GENERIC.prefix);
return (
validateAddress(address, Network.DOT.prefix) ||
validateAddress(address, Network.GENERIC.prefix)
);
}
case Chain.Chainflip: {
return validateAddress(address, Network.FLIP.prefix || Network.GENERIC.prefix);
return (
validateAddress(address, Network.FLIP.prefix) ||
validateAddress(address, Network.GENERIC.prefix)
);
}
}
return false;
Expand Down

0 comments on commit baeb2e6

Please sign in to comment.