Add ALM new styles (#373)

This commit is contained in:
Gerardo Nardelli 2020-06-26 12:47:45 -03:00 committed by GitHub
parent 2ca07e998a
commit 4a727dc159
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25 changed files with 1991 additions and 207 deletions

View File

@ -3,3 +3,4 @@ submodules
coverage
lib
dist
build

View File

@ -25,6 +25,7 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,700" rel="stylesheet">
<title>AMB Live Monitoring</title>
</head>
<body>

View File

@ -1,11 +1,14 @@
import React from 'react'
import { BrowserRouter } from 'react-router-dom'
import { MainPage } from './components/MainPage'
import { StateProvider } from './state/StateProvider'
function App() {
return (
<BrowserRouter>
<MainPage />
<StateProvider>
<MainPage />
</StateProvider>
</BrowserRouter>
)
}

View File

@ -0,0 +1,319 @@
import { AbiItem } from 'web3-utils'
const abi: AbiItem[] = [
{
constant: true,
inputs: [],
name: 'validatorCount',
outputs: [
{
name: '',
type: 'uint256'
}
],
payable: false,
stateMutability: 'view',
type: 'function'
},
{
constant: true,
inputs: [],
name: 'getBridgeValidatorsInterfacesVersion',
outputs: [
{
name: 'major',
type: 'uint64'
},
{
name: 'minor',
type: 'uint64'
},
{
name: 'patch',
type: 'uint64'
}
],
payable: false,
stateMutability: 'pure',
type: 'function'
},
{
constant: true,
inputs: [],
name: 'isInitialized',
outputs: [
{
name: '',
type: 'bool'
}
],
payable: false,
stateMutability: 'view',
type: 'function'
},
{
constant: true,
inputs: [],
name: 'validatorList',
outputs: [
{
name: '',
type: 'address[]'
}
],
payable: false,
stateMutability: 'view',
type: 'function'
},
{
constant: false,
inputs: [
{
name: '_requiredSignatures',
type: 'uint256'
}
],
name: 'setRequiredSignatures',
outputs: [],
payable: false,
stateMutability: 'nonpayable',
type: 'function'
},
{
constant: true,
inputs: [],
name: 'requiredSignatures',
outputs: [
{
name: '',
type: 'uint256'
}
],
payable: false,
stateMutability: 'view',
type: 'function'
},
{
constant: true,
inputs: [
{
name: '_address',
type: 'address'
}
],
name: 'getNextValidator',
outputs: [
{
name: '',
type: 'address'
}
],
payable: false,
stateMutability: 'view',
type: 'function'
},
{
constant: true,
inputs: [],
name: 'owner',
outputs: [
{
name: '',
type: 'address'
}
],
payable: false,
stateMutability: 'view',
type: 'function'
},
{
constant: true,
inputs: [
{
name: '_validator',
type: 'address'
}
],
name: 'isValidatorDuty',
outputs: [
{
name: '',
type: 'bool'
}
],
payable: false,
stateMutability: 'view',
type: 'function'
},
{
constant: true,
inputs: [],
name: 'deployedAtBlock',
outputs: [
{
name: '',
type: 'uint256'
}
],
payable: false,
stateMutability: 'view',
type: 'function'
},
{
constant: true,
inputs: [],
name: 'F_ADDR',
outputs: [
{
name: '',
type: 'address'
}
],
payable: false,
stateMutability: 'view',
type: 'function'
},
{
constant: false,
inputs: [
{
name: 'newOwner',
type: 'address'
}
],
name: 'transferOwnership',
outputs: [],
payable: false,
stateMutability: 'nonpayable',
type: 'function'
},
{
constant: true,
inputs: [
{
name: '_validator',
type: 'address'
}
],
name: 'isValidator',
outputs: [
{
name: '',
type: 'bool'
}
],
payable: false,
stateMutability: 'view',
type: 'function'
},
{
anonymous: false,
inputs: [
{
indexed: true,
name: 'validator',
type: 'address'
}
],
name: 'ValidatorAdded',
type: 'event'
},
{
anonymous: false,
inputs: [
{
indexed: true,
name: 'validator',
type: 'address'
}
],
name: 'ValidatorRemoved',
type: 'event'
},
{
anonymous: false,
inputs: [
{
indexed: false,
name: 'requiredSignatures',
type: 'uint256'
}
],
name: 'RequiredSignaturesChanged',
type: 'event'
},
{
anonymous: false,
inputs: [
{
indexed: false,
name: 'previousOwner',
type: 'address'
},
{
indexed: false,
name: 'newOwner',
type: 'address'
}
],
name: 'OwnershipTransferred',
type: 'event'
},
{
constant: false,
inputs: [
{
name: '_requiredSignatures',
type: 'uint256'
},
{
name: '_initialValidators',
type: 'address[]'
},
{
name: '_owner',
type: 'address'
}
],
name: 'initialize',
outputs: [
{
name: '',
type: 'bool'
}
],
payable: false,
stateMutability: 'nonpayable',
type: 'function'
},
{
constant: false,
inputs: [
{
name: '_validator',
type: 'address'
}
],
name: 'addValidator',
outputs: [],
payable: false,
stateMutability: 'nonpayable',
type: 'function'
},
{
constant: false,
inputs: [
{
name: '_validator',
type: 'address'
}
],
name: 'removeValidator',
outputs: [],
payable: false,
stateMutability: 'nonpayable',
type: 'function'
}
]
export default abi

589
alm/src/abis/ForeignAMB.ts Normal file
View File

@ -0,0 +1,589 @@
import { AbiItem } from 'web3-utils'
const abi: AbiItem[] = [
{
constant: true,
inputs: [],
name: 'transactionHash',
outputs: [
{
name: '',
type: 'bytes32'
}
],
payable: false,
stateMutability: 'view',
type: 'function'
},
{
constant: true,
inputs: [
{
name: '_txHash',
type: 'bytes32'
}
],
name: 'relayedMessages',
outputs: [
{
name: '',
type: 'bool'
}
],
payable: false,
stateMutability: 'view',
type: 'function'
},
{
constant: false,
inputs: [
{
name: '_sourceChainId',
type: 'uint256'
},
{
name: '_destinationChainId',
type: 'uint256'
},
{
name: '_validatorContract',
type: 'address'
},
{
name: '_maxGasPerTx',
type: 'uint256'
},
{
name: '_gasPrice',
type: 'uint256'
},
{
name: '_requiredBlockConfirmations',
type: 'uint256'
},
{
name: '_owner',
type: 'address'
}
],
name: 'initialize',
outputs: [
{
name: '',
type: 'bool'
}
],
payable: false,
stateMutability: 'nonpayable',
type: 'function'
},
{
constant: true,
inputs: [],
name: 'isInitialized',
outputs: [
{
name: '',
type: 'bool'
}
],
payable: false,
stateMutability: 'view',
type: 'function'
},
{
constant: true,
inputs: [],
name: 'requiredBlockConfirmations',
outputs: [
{
name: '',
type: 'uint256'
}
],
payable: false,
stateMutability: 'view',
type: 'function'
},
{
constant: false,
inputs: [
{
name: '_data',
type: 'bytes'
},
{
name: '_signatures',
type: 'bytes'
}
],
name: 'executeSignatures',
outputs: [],
payable: false,
stateMutability: 'nonpayable',
type: 'function'
},
{
constant: true,
inputs: [
{
name: '_data',
type: 'bytes'
}
],
name: 'getMinimumGasUsage',
outputs: [
{
name: 'gas',
type: 'uint256'
}
],
payable: false,
stateMutability: 'pure',
type: 'function'
},
{
constant: true,
inputs: [
{
name: '_messageId',
type: 'bytes32'
}
],
name: 'failedMessageReceiver',
outputs: [
{
name: '',
type: 'address'
}
],
payable: false,
stateMutability: 'view',
type: 'function'
},
{
constant: true,
inputs: [],
name: 'getBridgeMode',
outputs: [
{
name: '_data',
type: 'bytes4'
}
],
payable: false,
stateMutability: 'pure',
type: 'function'
},
{
constant: false,
inputs: [
{
name: '_sourceChainId',
type: 'uint256'
},
{
name: '_destinationChainId',
type: 'uint256'
}
],
name: 'setChainIds',
outputs: [],
payable: false,
stateMutability: 'nonpayable',
type: 'function'
},
{
constant: true,
inputs: [
{
name: '_messageId',
type: 'bytes32'
}
],
name: 'failedMessageSender',
outputs: [
{
name: '',
type: 'address'
}
],
payable: false,
stateMutability: 'view',
type: 'function'
},
{
constant: true,
inputs: [],
name: 'messageId',
outputs: [
{
name: '',
type: 'bytes32'
}
],
payable: false,
stateMutability: 'view',
type: 'function'
},
{
constant: false,
inputs: [
{
name: '_token',
type: 'address'
},
{
name: '_to',
type: 'address'
}
],
name: 'claimTokens',
outputs: [],
payable: false,
stateMutability: 'nonpayable',
type: 'function'
},
{
constant: false,
inputs: [
{
name: '_maxGasPerTx',
type: 'uint256'
}
],
name: 'setMaxGasPerTx',
outputs: [],
payable: false,
stateMutability: 'nonpayable',
type: 'function'
},
{
constant: true,
inputs: [],
name: 'requiredSignatures',
outputs: [
{
name: '',
type: 'uint256'
}
],
payable: false,
stateMutability: 'view',
type: 'function'
},
{
constant: true,
inputs: [],
name: 'owner',
outputs: [
{
name: '',
type: 'address'
}
],
payable: false,
stateMutability: 'view',
type: 'function'
},
{
constant: true,
inputs: [],
name: 'validatorContract',
outputs: [
{
name: '',
type: 'address'
}
],
payable: false,
stateMutability: 'view',
type: 'function'
},
{
constant: true,
inputs: [],
name: 'deployedAtBlock',
outputs: [
{
name: '',
type: 'uint256'
}
],
payable: false,
stateMutability: 'view',
type: 'function'
},
{
constant: true,
inputs: [],
name: 'getBridgeInterfacesVersion',
outputs: [
{
name: 'major',
type: 'uint64'
},
{
name: 'minor',
type: 'uint64'
},
{
name: 'patch',
type: 'uint64'
}
],
payable: false,
stateMutability: 'pure',
type: 'function'
},
{
constant: true,
inputs: [],
name: 'messageSourceChainId',
outputs: [
{
name: '',
type: 'uint256'
}
],
payable: false,
stateMutability: 'view',
type: 'function'
},
{
constant: false,
inputs: [
{
name: '_blockConfirmations',
type: 'uint256'
}
],
name: 'setRequiredBlockConfirmations',
outputs: [],
payable: false,
stateMutability: 'nonpayable',
type: 'function'
},
{
constant: false,
inputs: [
{
name: '_gasPrice',
type: 'uint256'
}
],
name: 'setGasPrice',
outputs: [],
payable: false,
stateMutability: 'nonpayable',
type: 'function'
},
{
constant: true,
inputs: [
{
name: '_messageId',
type: 'bytes32'
}
],
name: 'messageCallStatus',
outputs: [
{
name: '',
type: 'bool'
}
],
payable: false,
stateMutability: 'view',
type: 'function'
},
{
constant: true,
inputs: [],
name: 'messageSender',
outputs: [
{
name: '',
type: 'address'
}
],
payable: false,
stateMutability: 'view',
type: 'function'
},
{
constant: false,
inputs: [
{
name: '_contract',
type: 'address'
},
{
name: '_data',
type: 'bytes'
},
{
name: '_gas',
type: 'uint256'
}
],
name: 'requireToPassMessage',
outputs: [
{
name: '',
type: 'bytes32'
}
],
payable: false,
stateMutability: 'nonpayable',
type: 'function'
},
{
constant: true,
inputs: [
{
name: '_messageId',
type: 'bytes32'
}
],
name: 'failedMessageDataHash',
outputs: [
{
name: '',
type: 'bytes32'
}
],
payable: false,
stateMutability: 'view',
type: 'function'
},
{
constant: true,
inputs: [],
name: 'maxGasPerTx',
outputs: [
{
name: '',
type: 'uint256'
}
],
payable: false,
stateMutability: 'view',
type: 'function'
},
{
constant: false,
inputs: [
{
name: 'newOwner',
type: 'address'
}
],
name: 'transferOwnership',
outputs: [],
payable: false,
stateMutability: 'nonpayable',
type: 'function'
},
{
constant: true,
inputs: [],
name: 'gasPrice',
outputs: [
{
name: '',
type: 'uint256'
}
],
payable: false,
stateMutability: 'view',
type: 'function'
},
{
anonymous: false,
inputs: [
{
indexed: true,
name: 'messageId',
type: 'bytes32'
},
{
indexed: false,
name: 'encodedData',
type: 'bytes'
}
],
name: 'UserRequestForAffirmation',
type: 'event'
},
{
anonymous: false,
inputs: [
{
indexed: true,
name: 'sender',
type: 'address'
},
{
indexed: true,
name: 'executor',
type: 'address'
},
{
indexed: true,
name: 'messageId',
type: 'bytes32'
},
{
indexed: false,
name: 'status',
type: 'bool'
}
],
name: 'RelayedMessage',
type: 'event'
},
{
anonymous: false,
inputs: [
{
indexed: false,
name: 'gasPrice',
type: 'uint256'
}
],
name: 'GasPriceChanged',
type: 'event'
},
{
anonymous: false,
inputs: [
{
indexed: false,
name: 'requiredBlockConfirmations',
type: 'uint256'
}
],
name: 'RequiredBlockConfirmationChanged',
type: 'event'
},
{
anonymous: false,
inputs: [
{
indexed: false,
name: 'previousOwner',
type: 'address'
},
{
indexed: false,
name: 'newOwner',
type: 'address'
}
],
name: 'OwnershipTransferred',
type: 'event'
}
]
export default abi

777
alm/src/abis/HomeAMB.ts Normal file
View File

@ -0,0 +1,777 @@
import { AbiItem } from 'web3-utils'
const abi: AbiItem[] = [
{
constant: true,
inputs: [],
name: 'transactionHash',
outputs: [
{
name: '',
type: 'bytes32'
}
],
payable: false,
stateMutability: 'view',
type: 'function'
},
{
constant: true,
inputs: [
{
name: '_message',
type: 'bytes32'
}
],
name: 'numMessagesSigned',
outputs: [
{
name: '',
type: 'uint256'
}
],
payable: false,
stateMutability: 'view',
type: 'function'
},
{
constant: true,
inputs: [
{
name: '_hash',
type: 'bytes32'
},
{
name: '_index',
type: 'uint256'
}
],
name: 'signature',
outputs: [
{
name: '',
type: 'bytes'
}
],
payable: false,
stateMutability: 'view',
type: 'function'
},
{
constant: false,
inputs: [
{
name: '_sourceChainId',
type: 'uint256'
},
{
name: '_destinationChainId',
type: 'uint256'
},
{
name: '_validatorContract',
type: 'address'
},
{
name: '_maxGasPerTx',
type: 'uint256'
},
{
name: '_gasPrice',
type: 'uint256'
},
{
name: '_requiredBlockConfirmations',
type: 'uint256'
},
{
name: '_owner',
type: 'address'
}
],
name: 'initialize',
outputs: [
{
name: '',
type: 'bool'
}
],
payable: false,
stateMutability: 'nonpayable',
type: 'function'
},
{
constant: true,
inputs: [],
name: 'isInitialized',
outputs: [
{
name: '',
type: 'bool'
}
],
payable: false,
stateMutability: 'view',
type: 'function'
},
{
constant: true,
inputs: [],
name: 'requiredBlockConfirmations',
outputs: [
{
name: '',
type: 'uint256'
}
],
payable: false,
stateMutability: 'view',
type: 'function'
},
{
constant: true,
inputs: [
{
name: '_data',
type: 'bytes'
}
],
name: 'getMinimumGasUsage',
outputs: [
{
name: 'gas',
type: 'uint256'
}
],
payable: false,
stateMutability: 'pure',
type: 'function'
},
{
constant: true,
inputs: [
{
name: '_messageId',
type: 'bytes32'
}
],
name: 'failedMessageReceiver',
outputs: [
{
name: '',
type: 'address'
}
],
payable: false,
stateMutability: 'view',
type: 'function'
},
{
constant: true,
inputs: [],
name: 'getBridgeMode',
outputs: [
{
name: '_data',
type: 'bytes4'
}
],
payable: false,
stateMutability: 'pure',
type: 'function'
},
{
constant: false,
inputs: [
{
name: '_sourceChainId',
type: 'uint256'
},
{
name: '_destinationChainId',
type: 'uint256'
}
],
name: 'setChainIds',
outputs: [],
payable: false,
stateMutability: 'nonpayable',
type: 'function'
},
{
constant: true,
inputs: [
{
name: '_hash',
type: 'bytes32'
}
],
name: 'message',
outputs: [
{
name: '',
type: 'bytes'
}
],
payable: false,
stateMutability: 'view',
type: 'function'
},
{
constant: true,
inputs: [
{
name: '_messageId',
type: 'bytes32'
}
],
name: 'failedMessageSender',
outputs: [
{
name: '',
type: 'address'
}
],
payable: false,
stateMutability: 'view',
type: 'function'
},
{
constant: false,
inputs: [
{
name: 'signature',
type: 'bytes'
},
{
name: 'message',
type: 'bytes'
}
],
name: 'submitSignature',
outputs: [],
payable: false,
stateMutability: 'nonpayable',
type: 'function'
},
{
constant: true,
inputs: [],
name: 'messageId',
outputs: [
{
name: '',
type: 'bytes32'
}
],
payable: false,
stateMutability: 'view',
type: 'function'
},
{
constant: false,
inputs: [
{
name: '_token',
type: 'address'
},
{
name: '_to',
type: 'address'
}
],
name: 'claimTokens',
outputs: [],
payable: false,
stateMutability: 'nonpayable',
type: 'function'
},
{
constant: true,
inputs: [
{
name: '_hash',
type: 'bytes32'
}
],
name: 'numAffirmationsSigned',
outputs: [
{
name: '',
type: 'uint256'
}
],
payable: false,
stateMutability: 'view',
type: 'function'
},
{
constant: true,
inputs: [
{
name: '_hash',
type: 'bytes32'
}
],
name: 'affirmationsSigned',
outputs: [
{
name: '',
type: 'bool'
}
],
payable: false,
stateMutability: 'view',
type: 'function'
},
{
constant: false,
inputs: [
{
name: '_maxGasPerTx',
type: 'uint256'
}
],
name: 'setMaxGasPerTx',
outputs: [],
payable: false,
stateMutability: 'nonpayable',
type: 'function'
},
{
constant: true,
inputs: [],
name: 'requiredSignatures',
outputs: [
{
name: '',
type: 'uint256'
}
],
payable: false,
stateMutability: 'view',
type: 'function'
},
{
constant: true,
inputs: [],
name: 'owner',
outputs: [
{
name: '',
type: 'address'
}
],
payable: false,
stateMutability: 'view',
type: 'function'
},
{
constant: true,
inputs: [
{
name: '_message',
type: 'bytes32'
}
],
name: 'messagesSigned',
outputs: [
{
name: '',
type: 'bool'
}
],
payable: false,
stateMutability: 'view',
type: 'function'
},
{
constant: true,
inputs: [],
name: 'validatorContract',
outputs: [
{
name: '',
type: 'address'
}
],
payable: false,
stateMutability: 'view',
type: 'function'
},
{
constant: true,
inputs: [],
name: 'deployedAtBlock',
outputs: [
{
name: '',
type: 'uint256'
}
],
payable: false,
stateMutability: 'view',
type: 'function'
},
{
constant: true,
inputs: [],
name: 'getBridgeInterfacesVersion',
outputs: [
{
name: 'major',
type: 'uint64'
},
{
name: 'minor',
type: 'uint64'
},
{
name: 'patch',
type: 'uint64'
}
],
payable: false,
stateMutability: 'pure',
type: 'function'
},
{
constant: true,
inputs: [],
name: 'messageSourceChainId',
outputs: [
{
name: '',
type: 'uint256'
}
],
payable: false,
stateMutability: 'view',
type: 'function'
},
{
constant: false,
inputs: [
{
name: '_blockConfirmations',
type: 'uint256'
}
],
name: 'setRequiredBlockConfirmations',
outputs: [],
payable: false,
stateMutability: 'nonpayable',
type: 'function'
},
{
constant: false,
inputs: [
{
name: '_gasPrice',
type: 'uint256'
}
],
name: 'setGasPrice',
outputs: [],
payable: false,
stateMutability: 'nonpayable',
type: 'function'
},
{
constant: true,
inputs: [
{
name: '_messageId',
type: 'bytes32'
}
],
name: 'messageCallStatus',
outputs: [
{
name: '',
type: 'bool'
}
],
payable: false,
stateMutability: 'view',
type: 'function'
},
{
constant: true,
inputs: [],
name: 'messageSender',
outputs: [
{
name: '',
type: 'address'
}
],
payable: false,
stateMutability: 'view',
type: 'function'
},
{
constant: false,
inputs: [
{
name: '_contract',
type: 'address'
},
{
name: '_data',
type: 'bytes'
},
{
name: '_gas',
type: 'uint256'
}
],
name: 'requireToPassMessage',
outputs: [
{
name: '',
type: 'bytes32'
}
],
payable: false,
stateMutability: 'nonpayable',
type: 'function'
},
{
constant: true,
inputs: [
{
name: '_messageId',
type: 'bytes32'
}
],
name: 'failedMessageDataHash',
outputs: [
{
name: '',
type: 'bytes32'
}
],
payable: false,
stateMutability: 'view',
type: 'function'
},
{
constant: true,
inputs: [],
name: 'maxGasPerTx',
outputs: [
{
name: '',
type: 'uint256'
}
],
payable: false,
stateMutability: 'view',
type: 'function'
},
{
constant: false,
inputs: [
{
name: 'message',
type: 'bytes'
}
],
name: 'executeAffirmation',
outputs: [],
payable: false,
stateMutability: 'nonpayable',
type: 'function'
},
{
constant: false,
inputs: [
{
name: 'newOwner',
type: 'address'
}
],
name: 'transferOwnership',
outputs: [],
payable: false,
stateMutability: 'nonpayable',
type: 'function'
},
{
constant: true,
inputs: [],
name: 'gasPrice',
outputs: [
{
name: '',
type: 'uint256'
}
],
payable: false,
stateMutability: 'view',
type: 'function'
},
{
constant: true,
inputs: [
{
name: '_number',
type: 'uint256'
}
],
name: 'isAlreadyProcessed',
outputs: [
{
name: '',
type: 'bool'
}
],
payable: false,
stateMutability: 'pure',
type: 'function'
},
{
anonymous: false,
inputs: [
{
indexed: true,
name: 'messageId',
type: 'bytes32'
},
{
indexed: false,
name: 'encodedData',
type: 'bytes'
}
],
name: 'UserRequestForSignature',
type: 'event'
},
{
anonymous: false,
inputs: [
{
indexed: true,
name: 'sender',
type: 'address'
},
{
indexed: true,
name: 'executor',
type: 'address'
},
{
indexed: true,
name: 'messageId',
type: 'bytes32'
},
{
indexed: false,
name: 'status',
type: 'bool'
}
],
name: 'AffirmationCompleted',
type: 'event'
},
{
anonymous: false,
inputs: [
{
indexed: true,
name: 'signer',
type: 'address'
},
{
indexed: false,
name: 'messageHash',
type: 'bytes32'
}
],
name: 'SignedForUserRequest',
type: 'event'
},
{
anonymous: false,
inputs: [
{
indexed: true,
name: 'signer',
type: 'address'
},
{
indexed: false,
name: 'messageHash',
type: 'bytes32'
}
],
name: 'SignedForAffirmation',
type: 'event'
},
{
anonymous: false,
inputs: [
{
indexed: false,
name: 'authorityResponsibleForRelay',
type: 'address'
},
{
indexed: false,
name: 'messageHash',
type: 'bytes32'
},
{
indexed: false,
name: 'NumberOfCollectedSignatures',
type: 'uint256'
}
],
name: 'CollectedSignatures',
type: 'event'
},
{
anonymous: false,
inputs: [
{
indexed: false,
name: 'gasPrice',
type: 'uint256'
}
],
name: 'GasPriceChanged',
type: 'event'
},
{
anonymous: false,
inputs: [
{
indexed: false,
name: 'requiredBlockConfirmations',
type: 'uint256'
}
],
name: 'RequiredBlockConfirmationChanged',
type: 'event'
},
{
anonymous: false,
inputs: [
{
indexed: false,
name: 'previousOwner',
type: 'address'
},
{
indexed: false,
name: 'newOwner',
type: 'address'
}
],
name: 'OwnershipTransferred',
type: 'event'
}
]
export default abi

3
alm/src/abis/index.ts Normal file
View File

@ -0,0 +1,3 @@
export { default as HOME_AMB_ABI } from './HomeAMB'
export { default as FOREIGN_AMB_ABI } from './ForeignAMB'
export { default as BRIDGE_VALIDATORS_ABI } from './BridgeValidators'

View File

@ -23,7 +23,7 @@ const StatusResultLabel = styled.label`
`
const StyledConfirmationContainer = styled.div`
background-color: var(--color-primary);
background-color: var(--bg-color);
padding: 10px;
border-radius: 4px;
`

View File

@ -12,27 +12,39 @@ const LabelText = styled.label`
`
const Input = styled.input`
background-color: var(--color-primary);
background-color: var(--bg-color);
color: var(--font-color);
max-width: 100%;
border-color: var(--color-primary) !important;
&:hover,
&:active,
&:focus {
border-color: var(--button-color) !important;
}
`
export const Form = ({ onSubmit }: { onSubmit: ({ chainId, txHash }: FormSubmitParams) => void }) => {
export const Form = ({
onSubmit,
lastUsedChain
}: {
onSubmit: ({ chainId, txHash }: FormSubmitParams) => void
lastUsedChain: number
}) => {
const { home, foreign, loading } = useStateProvider()
const { chainId: paramChainId, txHash: paramTxHash } = useParams()
const [chainId, setChainId] = useState(0)
const [chainId, setChainId] = useState(lastUsedChain)
const [txHash, setTxHash] = useState('')
useEffect(
() => {
if (!paramChainId) {
setChainId(foreign.chainId)
setChainId(lastUsedChain > 0 ? lastUsedChain : foreign.chainId)
} else {
setChainId(parseInt(paramChainId))
setTxHash(paramTxHash)
}
},
[foreign.chainId, paramChainId, paramTxHash]
[foreign.chainId, paramChainId, paramTxHash, lastUsedChain]
)
const formSubmit = (e: FormEvent) => {
@ -55,7 +67,7 @@ export const Form = ({ onSubmit }: { onSubmit: ({ chainId, txHash }: FormSubmitP
/>
</div>
<div className="col-1">
<Button className="button dark" type="submit">
<Button className="button outline" type="submit">
Check
</Button>
</div>

View File

@ -1,9 +1,9 @@
import React from 'react'
import React, { useState } from 'react'
import styled from 'styled-components'
import { Route, useHistory, Link } from 'react-router-dom'
import { Route, useHistory } from 'react-router-dom'
import { Form } from './Form'
import { StatusContainer } from './StatusContainer'
import { StateProvider } from '../state/StateProvider'
import { useStateProvider } from '../state/StateProvider'
const StyledMainPage = styled.div`
text-align: center;
@ -11,15 +11,24 @@ const StyledMainPage = styled.div`
`
const Header = styled.header`
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: calc(10px + 2vmin);
background-color: #001529;
color: #ffffff;
margin-bottom: 50px;
`
const Title = styled.p`
color: var(--font-color);
const HeaderContainer = styled.header`
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
font-size: 16px;
height: 64px;
line-height: 64px;
padding: 0 50px;
@media (max-width: 600px) {
padding: 0 20px;
}
`
export interface FormSubmitParams {
@ -29,23 +38,46 @@ export interface FormSubmitParams {
export const MainPage = () => {
const history = useHistory()
const { home, foreign } = useStateProvider()
const [selectedChainId, setSelectedChainId] = useState(0)
const [networkName, setNetworkName] = useState('')
const setNetworkData = (chainId: number) => {
const network = chainId === home.chainId ? home.name : foreign.name
setNetworkName(network)
setSelectedChainId(chainId)
}
const onFormSubmit = ({ chainId, txHash }: FormSubmitParams) => {
setNetworkData(chainId)
history.push(`/${chainId}/${txHash}`)
}
const resetNetworkHeader = () => {
setNetworkName('')
}
const setNetworkFromParams = (chainId: number) => {
setNetworkData(chainId)
}
return (
<StateProvider>
<StyledMainPage>
<Header>
<Link to="/">
<Title>AMB Live Monitoring</Title>
</Link>
</Header>
<div className="container">
<Route exact path={['/']} children={<Form onSubmit={onFormSubmit} />} />
<Route path={['/:chainId/:txHash/:messageIdParam', '/:chainId/:txHash']} children={<StatusContainer />} />
</div>
</StyledMainPage>
</StateProvider>
<StyledMainPage>
<Header>
<HeaderContainer>
<span>AMB Live Monitoring</span>
<span>{networkName}</span>
</HeaderContainer>
</Header>
<div className="container">
<Route exact path={['/']} children={<Form onSubmit={onFormSubmit} lastUsedChain={selectedChainId} />} />
<Route
path={['/:chainId/:txHash/:messageIdParam', '/:chainId/:txHash']}
children={<StatusContainer onBackToMain={resetNetworkHeader} setNetworkFromParams={setNetworkFromParams} />}
/>
</div>
</StyledMainPage>
)
}

View File

@ -38,7 +38,7 @@ export const MessageSelector = ({ messages, onMessageSelected }: MessageSelector
))}
</div>
<div className="col-1-lg col-12 is-marginless">
<Button className="button dark" onClick={onSelect}>
<Button className="button outline" onClick={onSelect}>
Select
</Button>
</div>

View File

@ -1,4 +1,4 @@
import React from 'react'
import React, { useEffect } from 'react'
import { Link, useHistory, useParams } from 'react-router-dom'
import { useTransactionStatus } from '../hooks/useTransactionStatus'
import { formatTxHash, getExplorerTxUrl, getTransactionStatusDescription, validTxHash } from '../utils/networks'
@ -12,9 +12,12 @@ import { LeftArrow } from './commons/LeftArrow'
import styled from 'styled-components'
const BackButton = styled.button`
color: var(--font-color);
color: var(--button-color);
border-color: var(--font-color);
margin-top: 10px;
&:focus {
outline: var(--button-color);
}
`
const BackLabel = styled.label`
@ -22,7 +25,12 @@ const BackLabel = styled.label`
cursor: pointer;
`
export const StatusContainer = () => {
export interface StatusContainerParam {
onBackToMain: () => void
setNetworkFromParams: (chainId: number) => void
}
export const StatusContainer = ({ onBackToMain, setNetworkFromParams }: StatusContainerParam) => {
const { home, foreign } = useStateProvider()
const history = useHistory()
const { chainId, txHash, messageIdParam } = useParams()
@ -36,6 +44,15 @@ export const StatusContainer = () => {
const selectedMessageId = messageIdParam === undefined || messages[messageIdParam] === undefined ? -1 : messageIdParam
useEffect(
() => {
if (validChainId) {
setNetworkFromParams(parseInt(chainId))
}
},
[validChainId, chainId, setNetworkFromParams]
)
if (!validParameters && home.chainId && foreign.chainId) {
return (
<div>
@ -75,15 +92,12 @@ export const StatusContainer = () => {
{status && (
<p>
The request{' '}
<i>
{displayExplorerLink && (
<ExplorerTxLink href={txExplorerLink} target="blank">
{formattedMessageId}
</ExplorerTxLink>
)}
{!displayExplorerLink && <label>{formattedMessageId}</label>}
</i>{' '}
{displayedDescription}
{displayExplorerLink && (
<ExplorerTxLink href={txExplorerLink} target="blank">
{formattedMessageId}
</ExplorerTxLink>
)}
{!displayExplorerLink && <label>{formattedMessageId}</label>} {displayedDescription}
</p>
)}
{displayMessageSelector && <MessageSelector messages={messages} onMessageSelected={onMessageSelected} />}
@ -92,7 +106,7 @@ export const StatusContainer = () => {
)}
<div className="row is-center">
<div className="col-9">
<Link to="/">
<Link to="/" onClick={onBackToMain}>
<BackButton className="button outline is-left">
<LeftArrow />
<BackLabel>Search another transaction</BackLabel>

View File

@ -2,4 +2,9 @@ import styled from 'styled-components'
export const Button = styled.button`
height: 36px;
color: var(--button-color);
border-color: var(--button-color);
&:focus {
outline: var(--button-color);
}
`

View File

@ -3,4 +3,5 @@ import styled from 'styled-components'
export const ExplorerTxLink = styled.a`
color: var(--link-color);
text-decoration: underline;
font-weight: bold;
`

View File

@ -12,7 +12,7 @@ export const LeftArrow = () => {
width="24"
height="24"
viewBox="0 0 24 24"
fill={themeContext.fontColor}
fill={themeContext.buttonColor}
>
<path d="M20,11V13H8L13.5,18.5L12.08,19.92L4.16,12L12.08,4.08L13.5,5.5L8,11H20Z" />
</svg>

View File

@ -1,4 +1,5 @@
import React from 'react'
import React, { useContext } from 'react'
import { ThemeContext } from 'styled-components'
export interface LoadingParams {
width?: string
@ -6,156 +7,159 @@ export interface LoadingParams {
displayMessage?: boolean
}
export const Loading = ({ width = '50px', height = '50px', displayMessage = true }: LoadingParams) => (
<div className="row is-center">
<svg
xmlns="http://www.w3.org/2000/svg"
style={{ background: 'none', display: 'block', shapeRendering: 'auto' }}
width={width}
height={height}
viewBox="0 0 100 100"
preserveAspectRatio="xMidYMid"
>
<g transform="rotate(0 50 50)">
<rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#f5f5f5">
<animate
attributeName="opacity"
values="1;0"
keyTimes="0;1"
dur="1s"
begin="-0.9166666666666666s"
repeatCount="indefinite"
/>
</rect>
</g>
<g transform="rotate(30 50 50)">
<rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#f5f5f5">
<animate
attributeName="opacity"
values="1;0"
keyTimes="0;1"
dur="1s"
begin="-0.8333333333333334s"
repeatCount="indefinite"
/>
</rect>
</g>
<g transform="rotate(60 50 50)">
<rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#f5f5f5">
<animate
attributeName="opacity"
values="1;0"
keyTimes="0;1"
dur="1s"
begin="-0.75s"
repeatCount="indefinite"
/>
</rect>
</g>
<g transform="rotate(90 50 50)">
<rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#f5f5f5">
<animate
attributeName="opacity"
values="1;0"
keyTimes="0;1"
dur="1s"
begin="-0.6666666666666666s"
repeatCount="indefinite"
/>
</rect>
</g>
<g transform="rotate(120 50 50)">
<rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#f5f5f5">
<animate
attributeName="opacity"
values="1;0"
keyTimes="0;1"
dur="1s"
begin="-0.5833333333333334s"
repeatCount="indefinite"
/>
</rect>
</g>
<g transform="rotate(150 50 50)">
<rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#f5f5f5">
<animate
attributeName="opacity"
values="1;0"
keyTimes="0;1"
dur="1s"
begin="-0.5s"
repeatCount="indefinite"
/>
</rect>
</g>
<g transform="rotate(180 50 50)">
<rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#f5f5f5">
<animate
attributeName="opacity"
values="1;0"
keyTimes="0;1"
dur="1s"
begin="-0.4166666666666667s"
repeatCount="indefinite"
/>
</rect>
</g>
<g transform="rotate(210 50 50)">
<rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#f5f5f5">
<animate
attributeName="opacity"
values="1;0"
keyTimes="0;1"
dur="1s"
begin="-0.3333333333333333s"
repeatCount="indefinite"
/>
</rect>
</g>
<g transform="rotate(240 50 50)">
<rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#f5f5f5">
<animate
attributeName="opacity"
values="1;0"
keyTimes="0;1"
dur="1s"
begin="-0.25s"
repeatCount="indefinite"
/>
</rect>
</g>
<g transform="rotate(270 50 50)">
<rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#f5f5f5">
<animate
attributeName="opacity"
values="1;0"
keyTimes="0;1"
dur="1s"
begin="-0.16666666666666666s"
repeatCount="indefinite"
/>
</rect>
</g>
<g transform="rotate(300 50 50)">
<rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#f5f5f5">
<animate
attributeName="opacity"
values="1;0"
keyTimes="0;1"
dur="1s"
begin="-0.08333333333333333s"
repeatCount="indefinite"
/>
</rect>
</g>
<g transform="rotate(330 50 50)">
<rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#f5f5f5">
<animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="0s" repeatCount="indefinite" />
</rect>
</g>
</svg>
{displayMessage && <label>Loading...</label>}
</div>
)
export const Loading = ({ width = '50px', height = '50px', displayMessage = true }: LoadingParams) => {
const themeContext = useContext(ThemeContext)
return (
<div className="row is-center">
<svg
xmlns="http://www.w3.org/2000/svg"
style={{ background: 'none', display: 'block', shapeRendering: 'auto' }}
width={width}
height={height}
viewBox="0 0 100 100"
preserveAspectRatio="xMidYMid"
>
<g transform="rotate(0 50 50)">
<rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill={themeContext.buttonColor}>
<animate
attributeName="opacity"
values="1;0"
keyTimes="0;1"
dur="1s"
begin="-0.9166666666666666s"
repeatCount="indefinite"
/>
</rect>
</g>
<g transform="rotate(30 50 50)">
<rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill={themeContext.buttonColor}>
<animate
attributeName="opacity"
values="1;0"
keyTimes="0;1"
dur="1s"
begin="-0.8333333333333334s"
repeatCount="indefinite"
/>
</rect>
</g>
<g transform="rotate(60 50 50)">
<rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill={themeContext.buttonColor}>
<animate
attributeName="opacity"
values="1;0"
keyTimes="0;1"
dur="1s"
begin="-0.75s"
repeatCount="indefinite"
/>
</rect>
</g>
<g transform="rotate(90 50 50)">
<rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill={themeContext.buttonColor}>
<animate
attributeName="opacity"
values="1;0"
keyTimes="0;1"
dur="1s"
begin="-0.6666666666666666s"
repeatCount="indefinite"
/>
</rect>
</g>
<g transform="rotate(120 50 50)">
<rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill={themeContext.buttonColor}>
<animate
attributeName="opacity"
values="1;0"
keyTimes="0;1"
dur="1s"
begin="-0.5833333333333334s"
repeatCount="indefinite"
/>
</rect>
</g>
<g transform="rotate(150 50 50)">
<rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill={themeContext.buttonColor}>
<animate
attributeName="opacity"
values="1;0"
keyTimes="0;1"
dur="1s"
begin="-0.5s"
repeatCount="indefinite"
/>
</rect>
</g>
<g transform="rotate(180 50 50)">
<rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill={themeContext.buttonColor}>
<animate
attributeName="opacity"
values="1;0"
keyTimes="0;1"
dur="1s"
begin="-0.4166666666666667s"
repeatCount="indefinite"
/>
</rect>
</g>
<g transform="rotate(210 50 50)">
<rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill={themeContext.buttonColor}>
<animate
attributeName="opacity"
values="1;0"
keyTimes="0;1"
dur="1s"
begin="-0.3333333333333333s"
repeatCount="indefinite"
/>
</rect>
</g>
<g transform="rotate(240 50 50)">
<rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill={themeContext.buttonColor}>
<animate
attributeName="opacity"
values="1;0"
keyTimes="0;1"
dur="1s"
begin="-0.25s"
repeatCount="indefinite"
/>
</rect>
</g>
<g transform="rotate(270 50 50)">
<rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill={themeContext.buttonColor}>
<animate
attributeName="opacity"
values="1;0"
keyTimes="0;1"
dur="1s"
begin="-0.16666666666666666s"
repeatCount="indefinite"
/>
</rect>
</g>
<g transform="rotate(300 50 50)">
<rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill={themeContext.buttonColor}>
<animate
attributeName="opacity"
values="1;0"
keyTimes="0;1"
dur="1s"
begin="-0.08333333333333333s"
repeatCount="indefinite"
/>
</rect>
</g>
<g transform="rotate(330 50 50)">
<rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill={themeContext.buttonColor}>
<animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="0s" repeatCount="indefinite" />
</rect>
</g>
</svg>
{displayMessage && <label style={{ color: themeContext.buttonColor }}>Loading...</label>}
</div>
)
}
export const SimpleLoading = () => <Loading width="30px" height="30px" displayMessage={false} />

View File

@ -1,5 +1,5 @@
import { useEffect, useState } from 'react'
import { HOME_AMB_ABI, FOREIGN_AMB_ABI } from '../../../commons'
import { HOME_AMB_ABI, FOREIGN_AMB_ABI } from '../abis'
import { FOREIGN_BRIDGE_ADDRESS, HOME_BRIDGE_ADDRESS } from '../config/constants'
import { Contract } from 'web3-eth-contract'
import Web3 from 'web3'

View File

@ -200,7 +200,7 @@ export const useMessageConfirmations = ({
// To avoid making extra requests, this is only executed when validators finished waiting for blocks confirmations
useEffect(
() => {
if (!waitingBlocksResolved || !timestamp) return
if (!waitingBlocksResolved || !timestamp || !requiredSignatures) return
const subscriptions: Array<number> = []

View File

@ -2,7 +2,7 @@ import { useEffect, useState } from 'react'
import { Contract } from 'web3-eth-contract'
import Web3 from 'web3'
import { getRequiredSignatures, getValidatorAddress, getValidatorList } from '../utils/contract'
import { BRIDGE_VALIDATORS_ABI } from '../../../commons'
import { BRIDGE_VALIDATORS_ABI } from '../abis'
import { useStateProvider } from '../state/StateProvider'
import { TransactionReceipt } from 'web3-eth'

View File

@ -3,11 +3,11 @@ import ReactDOM from 'react-dom'
import { ThemeProvider } from 'styled-components'
import { GlobalStyle } from './themes/GlobalStyle'
import App from './App'
import Dark from './themes/Dark'
import Light from './themes/Light'
ReactDOM.render(
<React.StrictMode>
<ThemeProvider theme={Dark}>
<ThemeProvider theme={Light}>
<GlobalStyle />
<App />
</ThemeProvider>

View File

@ -1,6 +1,7 @@
const theme = {
backgroundColor: '#121212',
fontColor: '#f5f5f5',
buttonColor: '#f5f5f5',
colorPrimary: '#272727',
colorGrey: '#272727',
colorLightGrey: '#272727',

View File

@ -1,6 +1,6 @@
import { createGlobalStyle } from 'styled-components'
import theme from './Dark'
import theme from './Light'
type ThemeType = typeof theme
@ -17,6 +17,7 @@ export const GlobalStyle = createGlobalStyle<{ theme: ThemeType }>`
:root {
--bg-color: ${props => props.theme.backgroundColor};
--font-color: ${props => props.theme.fontColor};
--button-color: ${props => props.theme.buttonColor};
--color-primary: ${props => props.theme.colorPrimary};
--color-grey: ${props => props.theme.colorGrey};
--color-lightGrey: ${props => props.theme.colorLightGrey};

22
alm/src/themes/Light.ts Normal file
View File

@ -0,0 +1,22 @@
const theme = {
backgroundColor: '#FFFFFF',
fontColor: 'rgba(0, 0, 0, 0.65)',
buttonColor: '#1890ff',
colorPrimary: '#BDBDBD',
colorGrey: '#1890ff',
colorLightGrey: '#1890ff',
linkColor: '#1890ff',
success: {
textColor: '#388E3C',
backgroundColor: 'rgba(0,201,167,.1)'
},
notRequired: {
textColor: '#77838f',
backgroundColor: 'rgba(119,131,143,.1)'
},
failed: {
textColor: '#de4437',
backgroundColor: 'rgba(222,68,55,.1)'
}
}
export default theme

View File

@ -190,11 +190,10 @@ export const getConfirmationsForTx = async (
setPendingConfirmations: Function,
getSuccessTransactions: (args: GetFailedTransactionParams) => Promise<APITransaction[]>
) => {
if (!web3 || !validatorList || !bridgeContract || !waitingBlocksResolved) return
if (!web3 || !validatorList || !validatorList.length || !bridgeContract || !waitingBlocksResolved) return
// If all the information was not collected, then it should retry
let shouldRetry = false
const hashMsg = web3.utils.soliditySha3Raw(messageData)
let validatorConfirmations = await Promise.all(
validatorList.map(getValidatorConfirmation(web3, hashMsg, bridgeContract, confirmationContractMethod))

View File

@ -4,7 +4,7 @@ import { TransactionReceipt } from 'web3-eth'
import { AbiItem } from 'web3-utils'
import memoize from 'fast-memoize'
import promiseRetry from 'promise-retry'
import { HOME_AMB_ABI, FOREIGN_AMB_ABI } from '../../../commons'
import { HOME_AMB_ABI, FOREIGN_AMB_ABI } from '../abis'
export interface MessageObject {
id: string