-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(bridge-ui-v2): merge main into alpha 5 (#14681)
Co-authored-by: xiaodino <ruby@taiko.xyz> Co-authored-by: Roger <50648015+RogerLamTd@users.noreply.github.com> Co-authored-by: D <51912515+adaki2004@users.noreply.github.com> Co-authored-by: jeff <113397187+cyberhorsey@users.noreply.github.com> Co-authored-by: Daniel Wang <99078276+dantaik@users.noreply.github.com> Co-authored-by: dave | d1onys1us <13951458+d1onys1us@users.noreply.github.com> Co-authored-by: Kenk <kenghin_lim@hotmail.com>
- Loading branch information
1 parent
8db2241
commit ac019c0
Showing
55 changed files
with
4,769 additions
and
3,009 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
packages/bridge-ui-v2/src/components/Bridge/ChainSelectorWrapper.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 88 additions & 0 deletions
88
packages/bridge-ui-v2/src/libs/relayer/RelayerAPIService.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import axios from 'axios'; | ||
import type { Address } from 'viem'; | ||
|
||
import { RelayerAPIService } from './RelayerAPIService'; | ||
|
||
vi.mock('axios'); | ||
|
||
function setupMocks() { | ||
vi.mock('$customToken', () => { | ||
return { | ||
customToken: [ | ||
{ | ||
name: 'Bull Token', | ||
addresses: { | ||
'31336': '0xA51c1fc2f0D1a1b8494Ed1FE312d7C3a78Ed91C0', | ||
'167002': '0x9A9f2CCfdE556A7E9Ff0848998Aa4a0CFD8863AE', | ||
}, | ||
symbol: 'BLL', | ||
decimals: 18, | ||
type: 'ERC20', | ||
logoURI: 'ipfs://QmezMTpT6ovJ3szb3SKDM9GVGeQ1R8DfjYyXG12ppMe2BY', | ||
mintable: true, | ||
}, | ||
{ | ||
name: 'Horse Token', | ||
addresses: { | ||
'31336': '0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e', | ||
'167002': '0x959922bE3CAee4b8Cd9a407cc3ac1C251C2007B1', | ||
}, | ||
symbol: 'HORSE', | ||
decimals: 18, | ||
type: 'ERC20', | ||
logoURI: 'ipfs://QmU52ZxmSiGX24uDPNUGG3URyZr5aQdLpACCiD6tap4Mgc', | ||
mintable: true, | ||
}, | ||
], | ||
}; | ||
}); | ||
} | ||
|
||
describe('RelayerAPIService', () => { | ||
beforeEach(() => { | ||
setupMocks(); | ||
}); | ||
|
||
// Given | ||
const mockedAxios = vi.mocked(axios, true); | ||
|
||
test('getTransactionsFromAPI should return API response', async () => { | ||
// Given | ||
const baseUrl = 'http://example.com'; | ||
const relayerAPIService = new RelayerAPIService(baseUrl); | ||
const params = { address: '0x123' as Address, chainID: 1, event: 'MessageSent' }; | ||
const mockResponse = { | ||
data: { | ||
page: 1, | ||
size: 10, | ||
total: 100, | ||
items: [], | ||
}, | ||
status: 200, | ||
}; | ||
mockedAxios.get.mockResolvedValue(mockResponse); | ||
|
||
// When | ||
const result = await relayerAPIService.getTransactionsFromAPI(params); | ||
|
||
// Then | ||
expect(result).toEqual(mockResponse.data); | ||
}); | ||
|
||
test('getAllBridgeTransactionByAddress should return filtered transactions', async () => { | ||
// Given | ||
const baseUrl = 'http://example.com'; | ||
const relayerAPIService = new RelayerAPIService(baseUrl); | ||
const address = '0x123'; | ||
const paginationParams = { page: 1, size: 10 }; | ||
const chainID = 1; | ||
|
||
// When | ||
const result = await relayerAPIService.getAllBridgeTransactionByAddress(address, paginationParams, chainID); | ||
|
||
// Then | ||
expect(result).toBeDefined(); | ||
expect(result.txs).toBeInstanceOf(Array); | ||
expect(result.paginationInfo).toBeDefined(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.