MCPcopy Create free account
hub / github.com/cardstack/cardstack / fromAddress

Method fromAddress

packages/cardpay-subgraph/src/static-tokens.ts:36–50  ·  view source on GitHub ↗
(tokenAddress: Address)

Source from the content-addressed store, hash-verified

34
35 // Helper for hardcoded tokens
36 static fromAddress(tokenAddress: Address): StaticToken | null {
37 let staticDefinitions = this.getStaticTokens();
38 let tokenAddressHex = tokenAddress.toHexString();
39
40 // Search the definition using the address
41 for (let i = 0; i < staticDefinitions.length; i++) {
42 let staticDefinition = staticDefinitions[i];
43 if (staticDefinition.address.toHexString() == tokenAddressHex) {
44 return staticDefinition;
45 }
46 }
47
48 // If not found, return null
49 return null;
50 }
51}

Callers 4

decodeFunction · 0.80
fetchTokenSymbolFunction · 0.80
fetchTokenNameFunction · 0.80
fetchTokenDecimalsFunction · 0.80

Calls 1

getStaticTokensMethod · 0.95

Tested by

no test coverage detected