( asset: Asset, address: string, supportedBlockchains: SupportedBlockchain[], )
| 30 | } |
| 31 | |
| 32 | export function detectAddressStandard( |
| 33 | asset: Asset, |
| 34 | address: string, |
| 35 | supportedBlockchains: SupportedBlockchain[], |
| 36 | ): StandardData | undefined { |
| 37 | const maybeFormat = detectAddressFormat(asset.blockchain, address); |
| 38 | if (!maybeFormat) { |
| 39 | return; |
| 40 | } |
| 41 | |
| 42 | const supportedStandards = supportedBlockchains |
| 43 | .find(b => b.blockchain === asset.blockchain) |
| 44 | ?.supported_standards.filter(supportedStandard => |
| 45 | asset.standards.includes(supportedStandard.standard), |
| 46 | ); |
| 47 | |
| 48 | return supportedStandards?.find(s => s.supported_address_formats.includes(maybeFormat)); |
| 49 | } |
| 50 | |
| 51 | export function shortenIcrc1Address(address: string): string { |
| 52 | const account = decodeIcrcAccount(address); |
nothing calls this directly
no test coverage detected