MCPcopy Create free account
hub / github.com/dfinity/orbit / detectAddressStandard

Function detectAddressStandard

apps/wallet/src/utils/asset.utils.ts:32–49  ·  view source on GitHub ↗
(
  asset: Asset,
  address: string,
  supportedBlockchains: SupportedBlockchain[],
)

Source from the content-addressed store, hash-verified

30}
31
32export 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
51export function shortenIcrc1Address(address: string): string {
52 const account = decodeIcrcAccount(address);

Callers

nothing calls this directly

Calls 1

detectAddressFormatFunction · 0.85

Tested by

no test coverage detected