Skip to content

Commit

Permalink
Add toAddress method.
Browse files Browse the repository at this point in the history
  • Loading branch information
barinbritva committed Feb 12, 2024
1 parent 1e05a46 commit c681dca
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/address/Address.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,14 @@ export class Address {
}
}

static toAddress(source: Address | string): Address {
if (typeof source === 'string') {
return Address.parse(source);
}

return source;
}

static parse(source: string) {
if (Address.isFriendly(source)) {
return this.parseFriendly(source).address;
Expand Down

0 comments on commit c681dca

Please sign in to comment.