generated from proofoftom/buidler-waffle-typechain-quasar
-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add metadata validation and code cleanup
- Loading branch information
Showing
12 changed files
with
554 additions
and
388 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/** | ||
* Fund Receiving Address | ||
*/ | ||
export class ReceivingAddress { | ||
/** | ||
* Convert the receiving addresses from string to a lookup dictionary | ||
* @param addresses array of EIP3770 addresses (e.g. eth:0x1234...) | ||
* @returns a dictionary of chain short name to address | ||
*/ | ||
static fromArray(addresses: string[]): Record<string, string> { | ||
const result: Record<string, string> = addresses.reduce( | ||
(addresses, item) => { | ||
const chainAddress = item.split(':') | ||
|
||
if (chainAddress.length === 2) { | ||
addresses[chainAddress[0]] = chainAddress[1] | ||
} | ||
return addresses | ||
}, | ||
{} | ||
) | ||
|
||
return result | ||
} | ||
|
||
/** | ||
* Convert a chain-address dictionary to an array of EIP3770 addresses | ||
* @param addresses a dictionary with chain short name to address | ||
* @returns an array of EIP3770 addresses | ||
*/ | ||
static toArray(addresses: Record<string, string>): string[] { | ||
return Object.entries(addresses).map( | ||
([chain, address]) => `${chain}:${address}` | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.