2018-09-21 10:41:13 +00:00
|
|
|
/* @flow */
|
|
|
|
|
|
|
|
export type Route = {
|
2019-03-04 12:33:02 +00:00
|
|
|
+name: string,
|
|
|
|
+pattern: string,
|
|
|
|
fields: Array<string>,
|
|
|
|
};
|
2018-09-21 10:41:13 +00:00
|
|
|
|
|
|
|
export const routes: Array<Route> = [
|
|
|
|
{
|
|
|
|
name: 'landing-home',
|
|
|
|
pattern: '/',
|
2018-09-21 12:01:41 +00:00
|
|
|
fields: [],
|
2018-09-21 10:41:13 +00:00
|
|
|
},
|
2019-02-19 20:48:48 +00:00
|
|
|
{
|
|
|
|
name: 'landing-version',
|
|
|
|
pattern: '/version',
|
|
|
|
fields: ['version'],
|
|
|
|
},
|
2018-09-21 10:41:13 +00:00
|
|
|
{
|
|
|
|
name: 'landing-bridge',
|
|
|
|
pattern: '/bridge',
|
2018-09-21 12:01:41 +00:00
|
|
|
fields: ['bridge'],
|
2018-09-21 10:41:13 +00:00
|
|
|
},
|
|
|
|
{
|
2019-04-08 16:30:11 +00:00
|
|
|
name: 'wallet-import',
|
|
|
|
pattern: '/device/:device/import',
|
|
|
|
fields: ['device', 'import'],
|
2018-09-21 10:41:13 +00:00
|
|
|
},
|
|
|
|
{
|
2018-10-15 08:46:58 +00:00
|
|
|
name: 'wallet-settings',
|
2018-09-21 10:41:13 +00:00
|
|
|
pattern: '/settings',
|
2018-09-21 12:01:41 +00:00
|
|
|
fields: ['settings'],
|
2018-09-21 10:41:13 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'wallet-acquire',
|
|
|
|
pattern: '/device/:device/acquire',
|
2018-09-21 12:01:41 +00:00
|
|
|
fields: ['device', 'acquire'],
|
2018-09-21 10:41:13 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'wallet-unreadable',
|
|
|
|
pattern: '/device/:device/unreadable',
|
2018-09-21 12:01:41 +00:00
|
|
|
fields: ['device', 'unreadable'],
|
2018-09-21 10:41:13 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'wallet-bootloader',
|
|
|
|
pattern: '/device/:device/bootloader',
|
2018-09-21 12:01:41 +00:00
|
|
|
fields: ['device', 'bootloader'],
|
2018-09-21 10:41:13 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'wallet-initialize',
|
|
|
|
pattern: '/device/:device/initialize',
|
2018-09-21 12:01:41 +00:00
|
|
|
fields: ['device', 'initialize'],
|
2018-09-21 10:41:13 +00:00
|
|
|
},
|
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'],
|
|
|
|
},
|
2018-09-21 10:41:13 +00:00
|
|
|
{
|
|
|
|
name: 'wallet-device-settings',
|
|
|
|
pattern: '/device/:device/settings',
|
2018-09-21 12:01:41 +00:00
|
|
|
fields: ['device', 'settings'],
|
2018-09-21 10:41:13 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'wallet-dashboard',
|
|
|
|
pattern: '/device/:device',
|
2018-09-21 12:01:41 +00:00
|
|
|
fields: ['device'],
|
2018-09-21 10:41:13 +00:00
|
|
|
},
|
2019-04-26 15:21:39 +00:00
|
|
|
{
|
|
|
|
name: 'wallet-account-transactions',
|
|
|
|
pattern: '/device/:device/network/:network/account/:account/transactions',
|
|
|
|
fields: ['device', 'network', 'account', 'transactions'],
|
|
|
|
},
|
2018-09-21 10:41:13 +00:00
|
|
|
{
|
|
|
|
name: 'wallet-account-summary',
|
|
|
|
pattern: '/device/:device/network/:network/account/:account',
|
2018-09-21 12:01:41 +00:00
|
|
|
fields: ['device', 'network', 'account'],
|
2018-09-21 10:41:13 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
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'],
|
2018-09-21 10:41:13 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
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'],
|
2018-09-21 10:41:13 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
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'],
|
2018-09-21 10:41:13 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
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'],
|
|
|
|
},
|
2018-09-21 10:41:13 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
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`);
|
2018-09-21 10:41:13 +00:00
|
|
|
return '/';
|
|
|
|
}
|
|
|
|
return entry.pattern;
|
2019-03-04 12:33:02 +00:00
|
|
|
};
|