mirror of https://github.com/trezor/trezor-wallet
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
94 lines
2.4 KiB
94 lines
2.4 KiB
6 years ago
|
/* @flow */
|
||
|
|
||
|
export type Route = {
|
||
|
+name: string;
|
||
|
+pattern: string;
|
||
|
fields: Array<string>;
|
||
|
}
|
||
|
|
||
|
export const routes: Array<Route> = [
|
||
|
{
|
||
|
name: 'landing-home',
|
||
|
pattern: '/',
|
||
|
fields: []
|
||
|
},
|
||
|
{
|
||
|
name: 'landing-bridge',
|
||
|
pattern: '/bridge',
|
||
|
fields: ['bridge']
|
||
|
},
|
||
|
{
|
||
|
name: 'landing-import',
|
||
|
pattern: '/import',
|
||
|
fields: ['import']
|
||
|
},
|
||
|
{
|
||
|
name: 'wallet-setting',
|
||
|
pattern: '/settings',
|
||
|
fields: ['settings']
|
||
|
},
|
||
|
{
|
||
|
name: 'wallet-acquire',
|
||
|
pattern: '/device/:device/acquire',
|
||
|
fields: ['device', 'acquire']
|
||
|
},
|
||
|
{
|
||
|
name: 'wallet-unreadable',
|
||
|
pattern: '/device/:device/unreadable',
|
||
|
fields: ['device', 'unreadable']
|
||
|
},
|
||
|
{
|
||
|
name: 'wallet-bootloader',
|
||
|
pattern: '/device/:device/bootloader',
|
||
|
fields: ['device', 'bootloader']
|
||
|
},
|
||
|
{
|
||
|
name: 'wallet-initialize',
|
||
|
pattern: '/device/:device/initialize',
|
||
|
fields: ['device', 'initialize']
|
||
|
},
|
||
|
{
|
||
|
name: 'wallet-device-settings',
|
||
|
pattern: '/device/:device/settings',
|
||
|
fields: ['device', 'settings']
|
||
|
},
|
||
|
{
|
||
|
name: 'wallet-dashboard',
|
||
|
pattern: '/device/:device',
|
||
|
fields: ['device']
|
||
|
},
|
||
|
{
|
||
|
name: 'wallet-account-summary',
|
||
|
pattern: '/device/:device/network/:network/account/:account',
|
||
|
fields: ['device', 'network', 'account']
|
||
|
},
|
||
|
{
|
||
|
name: 'wallet-account-send',
|
||
|
pattern: '/device/:device/network/:network/account/:account/send',
|
||
|
fields: ['device', 'network', 'account', 'send']
|
||
|
},
|
||
|
{
|
||
|
name: 'wallet-account-send-override',
|
||
|
pattern: '/device/:device/network/:network/account/:account/send/override',
|
||
|
fields: ['device', 'network', 'account', 'send']
|
||
|
},
|
||
|
{
|
||
|
name: 'wallet-account-receive',
|
||
|
pattern: '/device/:device/network/:network/account/:account/receive',
|
||
|
fields: ['device', 'network', 'account', 'receive']
|
||
|
},
|
||
|
{
|
||
|
name: 'wallet-account-signverify',
|
||
|
pattern: '/device/:device/network/:network/account/:account/signverify',
|
||
|
fields: ['device', 'network', 'account', 'signverify']
|
||
|
}
|
||
|
];
|
||
|
|
||
|
export const getPattern = (name: string): string => {
|
||
|
const entry = routes.find(r => r.name === name);
|
||
|
if (!entry) {
|
||
|
console.error(`Route for ${ name } not found`);
|
||
|
return '/';
|
||
|
}
|
||
|
return entry.pattern;
|
||
|
}
|