Skip to content

Commit

Permalink
Feature/add more polkadot js types (#104)
Browse files Browse the repository at this point in the history
* added polkadot-js types

* turn lint on save on

* remove parachain types and comments

* added new types

* added rpc types

* skip lines

* update types

* updated exitReason type

* Update alphanet-types.json

* generated json file for function descriptions

* edit editorconfig to allow long lines in json

* prettier json
  • Loading branch information
joelamouche authored Nov 17, 2020
1 parent 216ffc2 commit 556274a
Show file tree
Hide file tree
Showing 5 changed files with 635 additions and 23 deletions.
1 change: 0 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ max_line_length=100
[*.json]
indent_style=space
indent_size=2
max_line_length=100

[*.md]
trim_trailing_whitespace=false
100 changes: 89 additions & 11 deletions polkadot-js/alphanet-types.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,96 @@
"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",
"action": "String",
"gas_price": "u64",
"gas_limit": "u64",
"value": "U256",
"input": "Vec<u8>",
"signature": "Signature"
},
"Signature": {
"v": "u64",
"r": "H256",
"s": "H256"
"public_key": "Option<H512>",
"r": "U256",
"raw": "Bytes",
"s": "U256",
"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": {
"Succeed": "ExitSucceed",
"Error": "ExitError",
"Revert": "ExitRevert",
"Fatal": "ExitFatal"
}
},
"ExitSucceed": {
"_enum": ["Stopped", "Returned", "Suicided"]
},
"ExitError": {
"_enum": [
"StackUnderflow",
"StackOverflow",
"InvalidJump",
"InvalidRange",
"DesignatedInvalid",
"CallTooDeep",
"CreateCollision",
"CreateContractLimit",
"OutOfOffset",
"OutOfGas",
"OutOfFund",
"PCUnderflow",
"CreateEmpty",
"Other(Cow<'static, str>)"
]
},
"ExitRevert": {
"_enum": ["Reverted"]
},
"ExitFatal": {
"_enum": [
"NotSupported",
"UnhandledInterrupt",
"CallErrorAsFatal(ExitError)",
"Other(Cow<'static, str>)"
]
}
}
245 changes: 245 additions & 0 deletions polkadot-js/frontier-rpc-types.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,245 @@
{
"eth": {
"accounts": {
"description": "Returns accounts list.",
"params": [],
"type": "Vec<H160>"
},
"blockNumber": {
"description": "Returns balance of the given account.",
"params": [],
"type": "U256"
},
"call": {
"description": "Call contract, returning the output data.",
"params": [
{ "name": "request", "type": "CallRequest" },
{ "isOptional": true, "name": "number", "type": "BlockNumber" }
],
"type": "Bytes"
},
"chainId": {
"description": "Returns the chain ID used for transaction signing at the current best block. None is returned if not available.",
"params": [],
"type": "U64"
},
"coinbase": {
"description": "Returns block author.",
"params": [],
"type": "H160"
},
"estimateGas": {
"description": "Estimate gas needed for execution of given contract.",
"params": [
{ "name": "request", "type": "CallRequest" },
{ "isOptional": true, "name": "number", "type": "BlockNumber" }
],
"type": "U256"
},
"gasPrice": {
"description": "Returns current gas_price.",
"params": [],
"type": "U256"
},
"getBalance": {
"description": "Returns balance of the given account.",
"params": [
{ "name": "address", "type": "H160" },
{ "isOptional": true, "name": "number", "type": "BlockNumber" }
],
"type": "U256"
},
"getBlockByHash": {
"description": "Returns block with given hash.",
"params": [
{ "name": "hash", "type": "H256" },
{ "isOptional": true, "name": "full", "type": "bool" }
],
"type": "RichBlock"
},
"getBlockByNumber": {
"description": "Returns block with given number.",
"params": [
{ "name": "block", "type": "BlockNumber" },
{ "isOptional": true, "name": "full", "type": "bool" }
],
"type": "RichBlock"
},
"getBlockTransactionCountByHash": {
"description": "Returns the number of transactions in a block with given hash.",
"params": [{ "name": "hash", "type": "H256" }],
"type": "U256"
},
"getBlockTransactionCountByNumber": {
"description": "Returns the number of transactions in a block with given block number.",
"params": [{ "name": "block", "type": "BlockNumber" }],
"type": "U256"
},
"getCode": {
"description": "Returns the code at given address at given time (block number).",
"params": [
{ "name": "address", "type": "H160" },
{ "isOptional": true, "name": "number", "type": "BlockNumber" }
],
"type": "Bytes"
},
"getLogs": {
"description": "Returns logs matching given filter object.",
"params": [{ "name": "filter", "type": "Filter" }],
"type": "Vec<Log>"
},
"getStorageAt": {
"description": "Returns content of the storage at given address.",
"params": [
{ "name": "address", "type": "H160" },
{ "name": "index", "type": "U256" },
{ "isOptional": true, "name": "number", "type": "BlockNumber" }
],
"type": "H256"
},
"getTransactionByBlockHashAndIndex": {
"description": "Returns transaction at given block hash and index.",
"params": [
{ "name": "hash", "type": "H256" },
{ "name": "index", "type": "U256" }
],
"type": "Transaction"
},
"getTransactionByBlockNumberAndIndex": {
"description": "Returns transaction by given block number and index.",
"params": [
{ "isOptional": true, "name": "number", "type": "BlockNumber" },
{ "name": "index", "type": "U256" }
],
"type": "Transaction"
},
"getTransactionByHash": {
"description": "Get transaction by its hash.",
"params": [{ "name": "hash", "type": "H256" }],
"type": "Transaction"
},
"getTransactionCount": {
"description": "Returns the number of transactions sent from given address at given time (block number).",
"params": [
{ "name": "hash", "type": "H256" },
{ "isOptional": true, "name": "number", "type": "BlockNumber" }
],
"type": "U256"
},
"getTransactionReceipt": {
"description": "Returns transaction receipt by transaction hash.",
"params": [{ "name": "hash", "type": "H256" }],
"type": "Receipt"
},
"getUncleByBlockHashAndIndex": {
"description": "Returns an uncles at given block and index.",
"params": [
{ "name": "hash", "type": "H256" },
{ "name": "index", "type": "U256" }
],
"type": "RichBlock"
},
"getUncleByBlockNumberAndIndex": {
"description": "Returns an uncles at given block and index.",
"params": [
{ "isOptional": true, "name": "number", "type": "BlockNumber" },
{ "name": "index", "type": "U256" }
],
"type": "RichBlock"
},
"getUncleCountByBlockHash": {
"description": "Returns the number of uncles in a block with given hash.",
"params": [{ "name": "hash", "type": "H256" }],
"type": "U256"
},
"getUncleCountByBlockNumber": {
"description": "Returns the number of uncles in a block with given block number.",
"params": [
{ "isOptional": true, "name": "number", "type": "BlockNumber" }
],
"type": "U256"
},
"getWork": {
"description": "Returns the hash of the current block, the seedHash, and the boundary condition to be met.",
"params": [],
"type": "Work"
},
"hashrate": {
"description": "Returns the number of hashes per second that the node is mining with.",
"params": [],
"type": "U256"
},
"mining": {
"description": "Returns true if client is actively mining new blocks.",
"params": [],
"type": "bool"
},
"protocolVersion": {
"description": "Returns protocol version encoded as a string (quotes are necessary).",
"params": [],
"type": "u64"
},
"sendRawTransaction": {
"description": "Sends signed transaction, returning its hash.",
"params": [{ "name": "bytes", "type": "Bytes" }],
"type": "BoxFuture<H256>"
},
"submitHashrate": {
"description": "Used for submitting mining hashrate.",
"params": [
{ "name": "index", "type": "U256" },
{ "name": "hash", "type": "H256" }
],
"type": "bool"
},
"submitWork": {
"description": "Used for submitting a proof-of-work solution.",
"params": [
{ "name": "_", "type": "H64" },
{ "name": "_", "type": "H256" },
{ "name": "_", "type": "H256" }
],
"type": "bool"
},
"subscribe": {
"description": "Subscribe to Eth subscription.",
"params": [
{ "name": "_metadata", "type": "Self::Metadata" },
{ "name": "subscriber", "type": "Subscriber<PubSubResult>" },
{ "name": "kind", "type": "Kind" },
{ "isOptional": true, "name": "params", "type": "Params" }
],
"type": ""
},
"syncing": {
"description": "Returns an object with data about the sync status or false. (wtf?)",
"params": [],
"type": "SyncStatus"
},
"unsubscribe": {
"description": "nsubscribe from existing Eth subscription.",
"params": [
{ "name": "_metadata", "type": "Self::Metadata" },
{ "name": "subscription_id", "type": "Self::SubscriptionId" }
],
"type": ""
}
},
"net": {
"listening": {
"description": "Returns true if client is actively listening for network connections. Otherwise false.",
"params": [],
"type": "bool"
},
"peerCount": {
"description": "Returns number of peers connected to node.",
"params": [],
"type": "String"
},
"version": {
"description": "Returns protocol version.",
"params": [],
"type": "String"
}
}
}
Loading

0 comments on commit 556274a

Please sign in to comment.