Move to types bundle (#4011)
* support ethereum addresses * corrections * add standalone url and ethereum identicons * add moonbeam config * added changes from the old pr * add new config * added dummy rpc method declarations for eth methods * wip fix address add modal * support ethereum addresses * corrections * add standalone url and ethereum identicons * add moonbeam config * added changes from the old pr * add new config * added dummy rpc method declarations for eth methods * wip fix address add modal * wip repair app with new keyring * use isDevelopement false for ethereum * lint * more formatng * eth addresses by default for account creation * added many more types to support moonbeam * added color * add h160 to types and components * add rpc methods to app-config * lint * polish * Update packages/react-params/src/initValue.ts Co-authored-by: Jaco Greeff <jacogr@gmail.com> * Apply suggestions from code review Co-authored-by: Jaco Greeff <jacogr@gmail.com> * mobe to typesBundle * added right type for types declaration * lint * corrected type and removed moobeam specs Co-authored-by: Jaco Greeff <jacogr@gmail.com>
This commit is contained in:
parent
acd97c0a78
commit
4ab0781175
@ -3,11 +3,16 @@
|
||||
|
||||
import acala from './acala';
|
||||
import laminar from './laminar';
|
||||
import moonbeam from './moonbeam';
|
||||
import soraSubstrate from './soraSubstrate';
|
||||
|
||||
export default {
|
||||
acala,
|
||||
laminar,
|
||||
mandala: acala,
|
||||
'moonbase-alphanet': moonbeam,
|
||||
moonbeam,
|
||||
'moonbeam-standalone': moonbeam,
|
||||
'node-moonbeam': moonbeam,
|
||||
'sora-substrate': soraSubstrate
|
||||
};
|
||||
|
||||
85
packages/apps-config/src/api/bundle/spec/moonbeam.ts
Normal file
85
packages/apps-config/src/api/bundle/spec/moonbeam.ts
Normal file
@ -0,0 +1,85 @@
|
||||
// Copyright 2017-2020 @polkadot/apps-config authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { OverrideBundleDefinition } from "@polkadot/types/types";
|
||||
|
||||
// structs need to be in order
|
||||
/* eslint-disable sort-keys */
|
||||
|
||||
export default {
|
||||
types: [
|
||||
{
|
||||
minmax: [0, undefined],
|
||||
types: {
|
||||
AccountId: "EthereumAccountId",
|
||||
Address: "AccountId",
|
||||
Balance: "u128",
|
||||
RefCount: "u8",
|
||||
LookupSource: "AccountId",
|
||||
Account: {
|
||||
nonce: "U256",
|
||||
balance: "u128"
|
||||
},
|
||||
TransactionCondition: {
|
||||
_enum: {
|
||||
block: "u64",
|
||||
time: "u64"
|
||||
}
|
||||
},
|
||||
Transaction: {
|
||||
block_hash: "Option<H256>",
|
||||
block_number: "Option<U256>",
|
||||
chain_id: "Option<u64>",
|
||||
condition: "Option<TransactionCondition>",
|
||||
creates: "Option<H160>",
|
||||
from: "H160",
|
||||
gas: "U256",
|
||||
gas_price: "U256",
|
||||
hash: "H256",
|
||||
input: "Bytes",
|
||||
nonce: "U256",
|
||||
public_key: "Option<H512>",
|
||||
r: "U256",
|
||||
raw: "Bytes",
|
||||
standard_v: "U256",
|
||||
to: "Option<H160>",
|
||||
transaction_index: "Option<U256>",
|
||||
v: "U256",
|
||||
value: "U256"
|
||||
},
|
||||
TransactionStatus: {
|
||||
transaction_hash: "H256",
|
||||
transaction_index: "u32",
|
||||
from: "H160",
|
||||
to: "Option<H160>",
|
||||
contract_address: "Option<H160>",
|
||||
logs: "Vec<Log>",
|
||||
logs_bloom: "Bloom"
|
||||
},
|
||||
Receipt: {
|
||||
transaction_hash: "Option<H256>",
|
||||
transaction_index: "Option<U256>",
|
||||
block_hash: "Option<H256>",
|
||||
from: "Option<H160>",
|
||||
to: "Option<H160>",
|
||||
block_number: "Option<U256>",
|
||||
cumulative_gas_used: "U256",
|
||||
gas_used: "Option<U256>",
|
||||
contract_address: "Option<H160>",
|
||||
logs: "Vec<Log>",
|
||||
state_root: "Option<H256>",
|
||||
logs_bloom: "H2048",
|
||||
status_code: "Option<U64>"
|
||||
},
|
||||
ExitReason: {
|
||||
_enum: {
|
||||
ExitSucceed: "bool",
|
||||
ExitError: "bool",
|
||||
ExitRevert: "bool",
|
||||
ExitFatal: "bool"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
} as OverrideBundleDefinition;
|
||||
@ -24,40 +24,120 @@ export default function (): Record<string, Record<string, DefinitionRpc>> {
|
||||
accounts: generateDescription('Returns accounts list.', 'Vec<H160>'),
|
||||
blockNumber: generateDescription('Returns balance of the given account.', 'U256'),
|
||||
call: generateDescription('Call contract, returning the output data.', 'Bytes', [reqParam, numberParam]),
|
||||
chainId: generateDescription('Returns the chain ID used for transaction signing at the current best block. None is returned if not available.', 'U64'),
|
||||
chainId: generateDescription(
|
||||
'Returns the chain ID used for transaction signing at the current best block. None is returned if not available.',
|
||||
'U64'
|
||||
),
|
||||
coinbase: generateDescription('Returns block author.', 'H160'),
|
||||
estimateGas: generateDescription('Estimate gas needed for execution of given contract.', 'U256', [reqParam, numberParam]),
|
||||
estimateGas: generateDescription('Estimate gas needed for execution of given contract.', 'U256', [
|
||||
reqParam,
|
||||
numberParam
|
||||
]),
|
||||
gasPrice: generateDescription('Returns current gas_price.', 'U256'),
|
||||
getBalance: generateDescription('Returns balance of the given account.', 'U256', [addressParam, numberParam]),
|
||||
getBlockByHash: generateDescription('Returns block with given hash.', 'RichBlock', [hashParam, { isOptional: true, name: 'full', type: 'bool' }]),
|
||||
getBlockByNumber: generateDescription('Returns block with given number.', 'RichBlock', [blockParam, { isOptional: true, name: 'full', type: 'bool' }]),
|
||||
getBlockTransactionCountByHash: generateDescription('Returns the number of transactions in a block with given hash.', 'U256', [hashParam]),
|
||||
getBlockTransactionCountByNumber: generateDescription('Returns the number of transactions in a block with given block number.', 'U256', [blockParam]),
|
||||
getCode: generateDescription('Returns the code at given address at given time (block number).', 'Bytes', [addressParam, numberParam]),
|
||||
getLogs: generateDescription('Returns logs matching given filter object.', 'Vec<Log>', [{ name: 'filter', type: 'Filter' }]),
|
||||
getStorageAt: generateDescription('Returns content of the storage at given address.', 'H256', [addressParam, indexParam, numberParam]),
|
||||
getTransactionByBlockHashAndIndex: generateDescription('Returns transaction at given block hash and index.', 'Transaction', [hashParam, indexParam]),
|
||||
getTransactionByBlockNumberAndIndex: generateDescription('Returns transaction by given block number and index.', 'Transaction', [numberParam, indexParam]),
|
||||
getBlockByHash: generateDescription('Returns block with given hash.', 'RichBlock', [
|
||||
hashParam,
|
||||
{ isOptional: true, name: 'full', type: 'bool' }
|
||||
]),
|
||||
getBlockByNumber: generateDescription('Returns block with given number.', 'RichBlock', [
|
||||
blockParam,
|
||||
{ isOptional: true, name: 'full', type: 'bool' }
|
||||
]),
|
||||
getBlockTransactionCountByHash: generateDescription(
|
||||
'Returns the number of transactions in a block with given hash.',
|
||||
'U256',
|
||||
[hashParam]
|
||||
),
|
||||
getBlockTransactionCountByNumber: generateDescription(
|
||||
'Returns the number of transactions in a block with given block number.',
|
||||
'U256',
|
||||
[blockParam]
|
||||
),
|
||||
getCode: generateDescription('Returns the code at given address at given time (block number).', 'Bytes', [
|
||||
addressParam,
|
||||
numberParam
|
||||
]),
|
||||
getLogs: generateDescription('Returns logs matching given filter object.', 'Vec<Log>', [
|
||||
{ name: 'filter', type: 'Filter' }
|
||||
]),
|
||||
getStorageAt: generateDescription('Returns content of the storage at given address.', 'H256', [
|
||||
addressParam,
|
||||
indexParam,
|
||||
numberParam
|
||||
]),
|
||||
getTransactionByBlockHashAndIndex: generateDescription(
|
||||
'Returns transaction at given block hash and index.',
|
||||
'Transaction',
|
||||
[hashParam, indexParam]
|
||||
),
|
||||
getTransactionByBlockNumberAndIndex: generateDescription(
|
||||
'Returns transaction by given block number and index.',
|
||||
'Transaction',
|
||||
[numberParam, indexParam]
|
||||
),
|
||||
getTransactionByHash: generateDescription('Get transaction by its hash.', 'Transaction', [hashParam]),
|
||||
getTransactionCount: generateDescription('Returns the number of transactions sent from given address at given time (block number).', 'U256', [hashParam, numberParam]),
|
||||
getTransactionReceipt: generateDescription('Returns transaction receipt by transaction hash.', 'Receipt', [hashParam]),
|
||||
getUncleByBlockHashAndIndex: generateDescription('Returns an uncles at given block and index.', 'RichBlock', [hashParam, indexParam]),
|
||||
getUncleByBlockNumberAndIndex: generateDescription('Returns an uncles at given block and index.', 'RichBlock', [numberParam, indexParam]),
|
||||
getUncleCountByBlockHash: generateDescription('Returns the number of uncles in a block with given hash.', 'U256', [hashParam]),
|
||||
getUncleCountByBlockNumber: generateDescription('Returns the number of uncles in a block with given block number.', 'U256', [numberParam]),
|
||||
getWork: generateDescription('Returns the hash of the current block, the seedHash, and the boundary condition to be met.', 'Work'),
|
||||
getTransactionCount: generateDescription(
|
||||
'Returns the number of transactions sent from given address at given time (block number).',
|
||||
'U256',
|
||||
[hashParam, numberParam]
|
||||
),
|
||||
getTransactionReceipt: generateDescription('Returns transaction receipt by transaction hash.', 'Receipt', [
|
||||
hashParam
|
||||
]),
|
||||
getUncleByBlockHashAndIndex: generateDescription('Returns an uncles at given block and index.', 'RichBlock', [
|
||||
hashParam,
|
||||
indexParam
|
||||
]),
|
||||
getUncleByBlockNumberAndIndex: generateDescription('Returns an uncles at given block and index.', 'RichBlock', [
|
||||
numberParam,
|
||||
indexParam
|
||||
]),
|
||||
getUncleCountByBlockHash: generateDescription(
|
||||
'Returns the number of uncles in a block with given hash.',
|
||||
'U256',
|
||||
[hashParam]
|
||||
),
|
||||
getUncleCountByBlockNumber: generateDescription(
|
||||
'Returns the number of uncles in a block with given block number.',
|
||||
'U256',
|
||||
[numberParam]
|
||||
),
|
||||
getWork: generateDescription(
|
||||
'Returns the hash of the current block, the seedHash, and the boundary condition to be met.',
|
||||
'Work'
|
||||
),
|
||||
hashrate: generateDescription('Returns the number of hashes per second that the node is mining with.', 'U256'),
|
||||
mining: generateDescription('Returns true if client is actively mining new blocks.', 'bool'),
|
||||
protocolVersion: generateDescription('Returns protocol version encoded as a string (quotes are necessary).', 'u64'),
|
||||
sendRawTransaction: generateDescription('Sends signed transaction, returning its hash.', 'BoxFuture<H256>', [{ name: 'bytes', type: 'Bytes' }]),
|
||||
protocolVersion: generateDescription(
|
||||
'Returns protocol version encoded as a string (quotes are necessary).',
|
||||
'u64'
|
||||
),
|
||||
sendRawTransaction: generateDescription('Sends signed transaction, returning its hash.', 'BoxFuture<H256>', [
|
||||
{ name: 'bytes', type: 'Bytes' }
|
||||
]),
|
||||
submitHashrate: generateDescription('Used for submitting mining hashrate.', 'bool', [indexParam, hashParam]),
|
||||
submitWork: generateDescription('Used for submitting a proof-of-work solution.', 'bool', [{ name: '_', type: 'H64' }, { name: '_', type: 'H256' }, { name: '_', type: 'H256' }]),
|
||||
subscribe: generateDescription('Subscribe to Eth subscription.', '', [{ name: '_metadata', type: 'Self::Metadata' }, { name: 'subscriber', type: 'Subscriber<PubSubResult>' }, { name: 'kind', type: 'Kind' }, { isOptional: true, name: 'params', type: 'Params' }]),
|
||||
submitWork: generateDescription('Used for submitting a proof-of-work solution.', 'bool', [
|
||||
{ name: '_', type: 'H64' },
|
||||
{ name: '_', type: 'H256' },
|
||||
{ name: '_', type: 'H256' }
|
||||
]),
|
||||
subscribe: generateDescription('Subscribe to Eth subscription.', '', [
|
||||
{ name: '_metadata', type: 'Self::Metadata' },
|
||||
{ name: 'subscriber', type: 'Subscriber<PubSubResult>' },
|
||||
{ name: 'kind', type: 'Kind' },
|
||||
{ isOptional: true, name: 'params', type: 'Params' }
|
||||
]),
|
||||
syncing: generateDescription('Returns an object with data about the sync status or false. (wtf?)', 'SyncStatus'),
|
||||
unsubscribe: generateDescription('nsubscribe from existing Eth subscription.', '', [{ name: '_metadata', type: 'Self::Metadata' }, { name: 'subscription_id', type: 'Self::SubscriptionId' }])
|
||||
unsubscribe: generateDescription('nsubscribe from existing Eth subscription.', '', [
|
||||
{ name: '_metadata', type: 'Self::Metadata' },
|
||||
{ name: 'subscription_id', type: 'Self::SubscriptionId' }
|
||||
])
|
||||
},
|
||||
net: {
|
||||
listening: generateDescription('Returns true if client is actively listening for network connections. Otherwise false.', 'bool'),
|
||||
listening: generateDescription(
|
||||
'Returns true if client is actively listening for network connections. Otherwise false.',
|
||||
'bool'
|
||||
),
|
||||
peerCount: generateDescription('Returns number of peers connected to node.', 'String'),
|
||||
version: generateDescription('Returns protocol version.', 'String')
|
||||
}
|
||||
|
||||
@ -18,7 +18,6 @@ import equilibrium from './equilibrium';
|
||||
import hanonycash from './hanonycash';
|
||||
import kilt from './kilt';
|
||||
import kulupu from './kulupu';
|
||||
import moonbeam from './moonbeam';
|
||||
import nodeTemplate from './node-template';
|
||||
import nodle from './nodle';
|
||||
import phala from './phala';
|
||||
@ -49,9 +48,6 @@ export default {
|
||||
hanonycash,
|
||||
kulupu,
|
||||
'mashnet-node': kilt,
|
||||
'moonbase-alphanet': moonbeam,
|
||||
'moonbeam-standalone': moonbeam,
|
||||
'node-moonbeam': moonbeam,
|
||||
'node-template': nodeTemplate,
|
||||
'nodle-chain': nodle,
|
||||
'phala-node': phala,
|
||||
|
||||
@ -1,74 +0,0 @@
|
||||
// Copyright 2017-2020 @polkadot/apps-config authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// structs need to be in order
|
||||
/* eslint-disable sort-keys */
|
||||
|
||||
export default {
|
||||
AccountId: 'EthereumAccountId',
|
||||
Address: 'AccountId',
|
||||
Balance: 'u128',
|
||||
RefCount: 'u8',
|
||||
LookupSource: 'AccountId',
|
||||
Account: {
|
||||
nonce: 'U256',
|
||||
balance: 'u128'
|
||||
},
|
||||
TransactionCondition: {
|
||||
_enum: {
|
||||
block: 'u64',
|
||||
time: 'u64'
|
||||
}
|
||||
},
|
||||
Transaction: {
|
||||
block_hash: 'Option<H256>',
|
||||
block_number: 'Option<U256>',
|
||||
chain_id: 'Option<u64>',
|
||||
condition: 'Option<TransactionCondition>',
|
||||
creates: 'Option<H160>',
|
||||
from: 'H160',
|
||||
gas: 'U256',
|
||||
gas_price: 'U256',
|
||||
hash: 'H256',
|
||||
input: 'Bytes',
|
||||
nonce: 'U256',
|
||||
public_key: 'Option<H512>',
|
||||
r: 'U256',
|
||||
raw: 'Bytes',
|
||||
standard_v: 'U256',
|
||||
to: 'Option<H160>',
|
||||
transaction_index: 'Option<U256>',
|
||||
v: 'U256',
|
||||
value: 'U256'
|
||||
},
|
||||
TransactionStatus: {
|
||||
transaction_hash: 'H256',
|
||||
transaction_index: 'u32',
|
||||
from: 'H160',
|
||||
to: 'Option<H160>',
|
||||
contract_address: 'Option<H160>',
|
||||
logs: 'Vec<Log>',
|
||||
logs_bloom: 'Bloom'
|
||||
},
|
||||
Receipt: {
|
||||
transaction_hash: 'Option<H256>',
|
||||
transaction_index: 'Option<U256>',
|
||||
block_hash: 'Option<H256>',
|
||||
from: 'Option<H160>',
|
||||
to: 'Option<H160>',
|
||||
block_number: 'Option<U256>',
|
||||
cumulative_gas_used: 'U256',
|
||||
gas_used: 'Option<U256>',
|
||||
contract_address: 'Option<H160>',
|
||||
logs: 'Vec<Log>',
|
||||
state_root: 'Option<H256>',
|
||||
logs_bloom: 'H2048',
|
||||
status_code: 'Option<U64>'
|
||||
},
|
||||
ExitReason: { _enum: {
|
||||
ExitSucceed: 'bool',
|
||||
ExitError: 'bool',
|
||||
ExitRevert: 'bool',
|
||||
ExitFatal: 'bool'
|
||||
} }
|
||||
};
|
||||
Loading…
Reference in New Issue
Block a user