Skip to content

Commit 96f6fcc

Browse files
committed
docs: restore warpcore comments
1 parent 0d2a9e6 commit 96f6fcc

2 files changed

Lines changed: 21 additions & 11 deletions

File tree

typescript/sdk/src/warp/WarpCore.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@ export class WarpCore {
125125
const { chainName, addressOrDenom } = parseTokenConnectionId(
126126
connection.token,
127127
);
128+
// If token1 has a warpRouteId, token2 must share it — disambiguates
129+
// tokens at the same address (e.g. M0 Portal: mUSD, wM, USDSC)
128130
const token2 = tokens.find(
129131
(token) =>
130132
token.chainName === chainName &&
@@ -1625,6 +1627,9 @@ export class WarpCore {
16251627
return destinationCandidates[0];
16261628
}
16271629

1630+
/**
1631+
* Search through token list to find token with matching chain and address
1632+
*/
16281633
findToken(
16291634
chainName: ChainName,
16301635
addressOrDenom?: Address | string,
@@ -1650,14 +1655,24 @@ export class WarpCore {
16501655
return null;
16511656
}
16521657

1658+
/**
1659+
* Get the list of chains referenced by the tokens in this WarpCore
1660+
*/
16531661
getTokenChains(): ChainName[] {
16541662
return [...new Set(this.tokens.map((token) => token.chainName)).values()];
16551663
}
16561664

1665+
/**
1666+
* Get the subset of tokens whose chain matches the given chainName
1667+
*/
16571668
getTokensForChain(chainName: ChainName): Token[] {
16581669
return this.tokens.filter((token) => token.chainName === chainName);
16591670
}
16601671

1672+
/**
1673+
* Get the subset of tokens whose chain matches the given chainName
1674+
* and which are connected to a token on the given destination chain
1675+
*/
16611676
getTokensForRoute(origin: ChainName, destination: ChainName): Token[] {
16621677
return this.tokens.filter(
16631678
(token) =>

typescript/widgets/src/walletIntegrations/radixWallet.ts

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ import type { AccountInfo, ActiveChainInfo, WalletDetails } from './types.js';
1717
const logger = widgetLogger.child({
1818
module: 'walletIntegrations/radixWallet',
1919
});
20+
const radixWalletDetails: WalletDetails = {
21+
name: 'Radix Wallet',
22+
logoUrl:
23+
'https://raw.githubusercontent.com/radixdlt/radix-dapp-toolkit/refs/heads/main/docs/radix-logo.png',
24+
};
2025

2126
export function useRadixAccount(
2227
_multiProvider: MinimalProviderRegistry,
@@ -37,17 +42,7 @@ export function useRadixAccount(
3742
}
3843

3944
export function useRadixWalletDetails(): WalletDetails {
40-
const name = 'Radix Wallet';
41-
const logoUrl =
42-
'https://raw.githubusercontent.com/radixdlt/radix-dapp-toolkit/refs/heads/main/docs/radix-logo.png';
43-
44-
return useMemo(
45-
() => ({
46-
name,
47-
logoUrl,
48-
}),
49-
[name, logoUrl],
50-
);
45+
return radixWalletDetails;
5146
}
5247

5348
export function useRadixConnectFn(): () => void {

0 commit comments

Comments
 (0)