Skip to content

Commit d3a7c54

Browse files
dan437MajorLift
authored andcommitted
Enable token detection for the Aurora network (#1327)
1 parent cd5385c commit d3a7c54

File tree

5 files changed

+27
-0
lines changed

5 files changed

+27
-0
lines changed

packages/assets-controllers/src/AssetsContractController.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ export const SINGLE_CALL_BALANCES_ADDRESS_BY_CHAINID: Record<string, string> = {
3030
'0x2352c63A83f9Fd126af8676146721Fa00924d7e4',
3131
[SupportedTokenDetectionNetworks.avax]:
3232
'0xD023D153a0DFa485130ECFdE2FAA7e612EF94818',
33+
[SupportedTokenDetectionNetworks.aurora]:
34+
'0x1286415D333855237f89Df27D388127181448538',
3335
};
3436

3537
export const MISSING_PROVIDER_ERROR =

packages/assets-controllers/src/TokenDetectionController.test.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,21 @@ describe('TokenDetectionController', () => {
276276
expect(tokensController.state.detectedTokens).toStrictEqual([sampleTokenA]);
277277
});
278278

279+
it('should detect tokens correctly on the Aurora network', async () => {
280+
const auroraMainnet = {
281+
chainId: NetworksChainId.aurora,
282+
type: NetworkType.mainnet,
283+
};
284+
preferences.update({ selectedAddress: '0x1' });
285+
changeNetwork(auroraMainnet);
286+
287+
getBalancesInSingleCall.resolves({
288+
[sampleTokenA.address]: new BN(1),
289+
});
290+
await tokenDetection.start();
291+
expect(tokensController.state.detectedTokens).toStrictEqual([sampleTokenA]);
292+
});
293+
279294
it('should update detectedTokens when new tokens are detected', async () => {
280295
preferences.update({ selectedAddress: '0x1' });
281296
changeNetwork(mainnet);

packages/assets-controllers/src/assetsUtil.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,14 @@ describe('assetsUtil', () => {
264264
).toBe(true);
265265
});
266266

267+
it('returns true for the Aurora network', () => {
268+
expect(
269+
assetsUtil.isTokenDetectionSupportedForNetwork(
270+
assetsUtil.SupportedTokenDetectionNetworks.aurora,
271+
),
272+
).toBe(true);
273+
});
274+
267275
it('returns false for testnets such as Goerli', () => {
268276
expect(assetsUtil.isTokenDetectionSupportedForNetwork('5')).toBe(false);
269277
});

packages/assets-controllers/src/assetsUtil.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ export enum SupportedTokenDetectionNetworks {
143143
bsc = '56',
144144
polygon = '137',
145145
avax = '43114',
146+
aurora = '1313161554',
146147
}
147148

148149
/**

packages/controller-utils/src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export enum NetworksChainId {
3434
mainnet = '1',
3535
goerli = '5',
3636
sepolia = '11155111',
37+
aurora = '1313161554',
3738
rpc = '',
3839
}
3940

0 commit comments

Comments
 (0)