(blockchain: string, address: string)
| 12 | } |
| 13 | |
| 14 | export function detectAddressFormat(blockchain: string, address: string): string | undefined { |
| 15 | switch (blockchain) { |
| 16 | case BlockchainType.InternetComputer: |
| 17 | if (ICNativeApi.isValidAddress(address)) { |
| 18 | return AddressFormat.ICPNative; |
| 19 | } else if (ICRC1Api.isValidAddress(address)) { |
| 20 | return AddressFormat.ICRC1; |
| 21 | } else { |
| 22 | return; |
| 23 | } |
| 24 | case BlockchainType.Bitcoin: |
| 25 | case BlockchainType.Ethereum: |
| 26 | return; |
| 27 | default: |
| 28 | throw new Error(`Blockchain not supported ${blockchain}`); |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | export function detectAddressStandard( |
| 33 | asset: Asset, |
no test coverage detected