c66d7ed489
* Use new eslint rules and apply fixes. Use new logo component and shared theme + webpack config. * Add shared component to display a copy icon and copy to clipboard with confirmation state * Organise imports * Add copy mixnode identity key to list of mixnodes and detail view * Update nvm node version to 16 * Update GitHub Actions for Network Explorer to use yarn and yarn workspaces * Switch favicon for smaller N icon * Update README * Add error boundary
24 lines
603 B
TypeScript
24 lines
603 B
TypeScript
import { GatewayResponse } from '../typeDefs/explorer-api';
|
|
|
|
export type GatewayRowType = {
|
|
id: string;
|
|
owner: string;
|
|
identity_key: string;
|
|
bond: number;
|
|
host: string;
|
|
location: string;
|
|
};
|
|
|
|
export function gatewayToGridRow(arrayOfGateways: GatewayResponse): GatewayRowType[] {
|
|
return !arrayOfGateways
|
|
? []
|
|
: arrayOfGateways.map((gw) => ({
|
|
id: gw.owner,
|
|
owner: gw.owner,
|
|
identity_key: gw.gateway.identity_key || '',
|
|
location: gw?.gateway?.location || '',
|
|
bond: gw.pledge_amount.amount || 0,
|
|
host: gw.gateway.host || '',
|
|
}));
|
|
}
|