Skip to content

Commit

Permalink
fix: explorer urls when adding networks (#200)
Browse files Browse the repository at this point in the history
<!--- Provide a general summary of your changes in the Title above -->

## Description

Fix adding explorer urls when adding networks into metamask

<!--- Describe your changes in detail -->

## Related Issue Or Context

<!--- If suggesting a new feature or change, please discuss it in an
issue first -->
<!--- If fixing a bug, there should be an issue describing it with steps
to reproduce -->
<!--- Otherwise, describe context and motivation for change here -->

Closes: #187 

## How Has This Been Tested? Testing details.

<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, and the tests you ran
to -->
<!--- see how your change affects other areas of the code, etc. -->

## Types of changes

<!--- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->

- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
- [ ] Documentation

## Checklist:

<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->

- [ ] I have commented my code, particularly in hard-to-understand
areas.
- [ ] I have ensured that all acceptance criteria (or expected behavior)
from issue are met
- [ ] I have updated the documentation locally and in sygma-docs.
- [ ] I have added tests to cover my changes.
- [ ] I have ensured that all the checks are passing and green, I've
signed the CLA bot

Co-authored-by: Saad Ahmed <[email protected]>
  • Loading branch information
wainola and saadahmsiddiqui authored May 20, 2024
1 parent 81bae38 commit d65d99a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/widget/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const DEFAULT_ETH_DECIMALS = 18;
export const MAINNET_EXPLORER_URL = 'https://scan.buildwithsygma.com/transfer/';
export const TESTNET_EXPLORER_URL =
'https://scan.test.buildwithsygma.com/transfer/';
export const CHAIN_ID_URL = 'https://chainid.network/chains_mini.json';
export const CHAIN_ID_URL = 'https://chainid.network/chains.json';

type WsUrl = `ws://${string}` | `wss://${string}`;
export const SUBSTRATE_RPCS: {
Expand Down
7 changes: 5 additions & 2 deletions packages/widget/src/controllers/wallet-manager/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type ChainData = {
name: string;
rpc: string[];
nativeCurrency: { name: string; symbol: string; decimals: number };
explorers: Array<{ name: string; standard: string; url: string }>;
};

type ChainDataResponse = Array<ChainData>;
Expand Down Expand Up @@ -282,7 +283,8 @@ export class WalletController implements ReactiveController {
chainId,
name,
nativeCurrency: { name: tokenName, symbol, decimals },
rpc
rpc,
explorers
} = chainData;
try {
await provider.request({
Expand All @@ -296,7 +298,8 @@ export class WalletController implements ReactiveController {
name: tokenName,
symbol: symbol,
decimals: decimals
}
},
blockExplorerUrls: explorers.map((explorer) => explorer.url)
}
]
});
Expand Down

0 comments on commit d65d99a

Please sign in to comment.