1
0
mirror of https://github.com/trezor/trezor-wallet synced 2024-11-15 21:08:57 +00:00
trezor-wallet/src/support/routes.js

120 lines
3.2 KiB
JavaScript
Raw Permalink Normal View History

/* @flow */
export type Route = {
2019-03-04 12:33:02 +00:00
+name: string,
+pattern: string,
fields: Array<string>,
};
export const routes: Array<Route> = [
{
name: 'landing-home',
pattern: '/',
2018-09-21 12:01:41 +00:00
fields: [],
},
{
name: 'landing-version',
pattern: '/version',
fields: ['version'],
},
{
name: 'landing-bridge',
pattern: '/bridge',
2018-09-21 12:01:41 +00:00
fields: ['bridge'],
},
{
2019-04-08 16:30:11 +00:00
name: 'wallet-import',
pattern: '/device/:device/import',
fields: ['device', 'import'],
},
{
2018-10-15 08:46:58 +00:00
name: 'wallet-settings',
pattern: '/settings',
2018-09-21 12:01:41 +00:00
fields: ['settings'],
},
{
name: 'wallet-acquire',
pattern: '/device/:device/acquire',
2018-09-21 12:01:41 +00:00
fields: ['device', 'acquire'],
},
{
name: 'wallet-unreadable',
pattern: '/device/:device/unreadable',
2018-09-21 12:01:41 +00:00
fields: ['device', 'unreadable'],
},
{
name: 'wallet-bootloader',
pattern: '/device/:device/bootloader',
2018-09-21 12:01:41 +00:00
fields: ['device', 'bootloader'],
},
{
name: 'wallet-initialize',
pattern: '/device/:device/initialize',
2018-09-21 12:01:41 +00:00
fields: ['device', 'initialize'],
},
2018-11-01 09:53:56 +00:00
{
name: 'wallet-seedless',
pattern: '/device/:device/seedless',
fields: ['device', 'seedless'],
},
2018-10-03 17:08:20 +00:00
{
name: 'wallet-firmware-update',
pattern: '/device/:device/firmware-update',
fields: ['device', 'firmware-update'],
},
2019-02-25 12:28:58 +00:00
{
name: 'wallet-backup',
pattern: '/device/:device/backup',
fields: ['device', 'backup'],
},
{
name: 'wallet-device-settings',
pattern: '/device/:device/settings',
2018-09-21 12:01:41 +00:00
fields: ['device', 'settings'],
},
{
name: 'wallet-dashboard',
pattern: '/device/:device',
2018-09-21 12:01:41 +00:00
fields: ['device'],
},
{
name: 'wallet-account-transactions',
pattern: '/device/:device/network/:network/account/:account/transactions',
fields: ['device', 'network', 'account', 'transactions'],
},
{
name: 'wallet-account-summary',
pattern: '/device/:device/network/:network/account/:account',
2018-09-21 12:01:41 +00:00
fields: ['device', 'network', 'account'],
},
{
name: 'wallet-account-send',
pattern: '/device/:device/network/:network/account/:account/send',
2018-09-21 12:01:41 +00:00
fields: ['device', 'network', 'account', 'send'],
},
{
name: 'wallet-account-send-override',
pattern: '/device/:device/network/:network/account/:account/send/override',
2018-09-21 12:01:41 +00:00
fields: ['device', 'network', 'account', 'send'],
},
{
name: 'wallet-account-receive',
pattern: '/device/:device/network/:network/account/:account/receive',
2018-09-21 12:01:41 +00:00
fields: ['device', 'network', 'account', 'receive'],
},
{
name: 'wallet-account-signverify',
pattern: '/device/:device/network/:network/account/:account/signverify',
2018-09-21 12:01:41 +00:00
fields: ['device', 'network', 'account', 'signverify'],
},
];
export const getPattern = (name: string): string => {
const entry = routes.find(r => r.name === name);
if (!entry) {
2018-09-21 12:01:41 +00:00
console.error(`Route for ${name} not found`);
return '/';
}
return entry.pattern;
2019-03-04 12:33:02 +00:00
};