From f06deb45b2587ae5964df77cdd3343b2849f2e0f Mon Sep 17 00:00:00 2001 From: a <a@a.a> Date: Wed, 21 Sep 2022 13:27:46 -0500 Subject: [PATCH] ok --- openrpc/out/generate.go | 2 +- openrpc/out/generated_api.go | 411 ++++++++++++++++++ .../out/{generated_spec.json => spec.json} | 0 3 files changed, 412 insertions(+), 1 deletion(-) create mode 100755 openrpc/out/generated_api.go rename openrpc/out/{generated_spec.json => spec.json} (100%) diff --git a/openrpc/out/generate.go b/openrpc/out/generate.go index 56b417c..cd74886 100644 --- a/openrpc/out/generate.go +++ b/openrpc/out/generate.go @@ -1,3 +1,3 @@ package out -//go:generate go run gfx.cafe/open/jrpc/openrpc/cmd generate -p out -s generated_spec.json -o generated_api.go -t ../templates/types.gotmpl +//go:generate go run gfx.cafe/open/jrpc/openrpc/cmd generate -p out -s spec.json -o generated_api.go -t ../templates/types.gotmpl diff --git a/openrpc/out/generated_api.go b/openrpc/out/generated_api.go new file mode 100755 index 0000000..c191af8 --- /dev/null +++ b/openrpc/out/generated_api.go @@ -0,0 +1,411 @@ +// Code generated by go-openrpc. DO NOT EDIT. + +package out + +type GoOpenRPCService interface { + // Returns an RLP-encoded header. + DebugGetRawHeader( + Block BlockNumberOrTag, + ) (HeaderRLP Bytes) + // Returns an RLP-encoded block. + DebugGetRawBlock( + Block BlockNumberOrTag, + ) (BlockRLP Bytes) + // Returns an array of EIP-2718 binary-encoded transactions. + DebugGetRawTransaction( + TransactionHash Hash32, + ) (EIP2718BinaryEncodedTransaction Bytes) + // Returns an array of EIP-2718 binary-encoded receipts. + DebugGetRawReceipts( + Block BlockNumberOrTag, + ) (Receipts []Bytes) + // Returns an array of recent bad blocks that the client has seen on the network. + DebugGetBadBlocks() (Blocks []BadBlock) + // Returns information about a block by hash. + EthGetBlockByHash( + BlockHash Hash32, + HydratedTransactions bool, + ) (BlockInformation Block) + // Returns information about a block by number. + EthGetBlockByNumber( + Block BlockNumberOrTag, + HydratedTransactions bool, + ) (BlockInformation Block) + // Returns the number of transactions in a block from a block matching the given block hash. + EthGetBlockTransactionCountByHash( + BlockHash Hash32, + ) (TransactionCount Uint) + // Returns the number of transactions in a block matching the given block number. + EthGetBlockTransactionCountByNumber( + Block BlockNumberOrTag, + ) (TransactionCount Uint) + // Returns the number of uncles in a block from a block matching the given block hash. + EthGetUncleCountByBlockHash( + BlockHash Hash32, + ) (UncleCount Uint) + // Returns the number of transactions in a block matching the given block number. + EthGetUncleCountByBlockNumber( + Block BlockNumberOrTag, + ) (UncleCount Uint) + // Returns the chain ID of the current network. + EthChainId() (ChainID Uint) + // Returns an object with data about the sync status or false. + EthSyncing() (SyncingStatus SyncingStatus) + // Returns the client coinbase address. + EthCoinbase() (CoinbaseAddress Address) + // Returns a list of addresses owned by client. + EthAccounts() (Accounts []Address) + // Returns the number of most recent block. + EthBlockNumber() (BlockNumber Uint) + // Executes a new message call immediately without creating a transaction on the block chain. + EthCall( + Transaction GenericTransaction, + Block BlockNumberOrTag, + ) (ReturnData Bytes) + // Generates and returns an estimate of how much gas is necessary to allow the transaction to complete. + EthEstimateGas( + Transaction GenericTransaction, + Block BlockNumberOrTag, + ) (GasUsed Uint) + // Generates an access list for a transaction. + EthCreateAccessList( + Transaction GenericTransaction, + Block BlockNumberOrTag, + ) (GasUsed struct { + AccessList AccessList `json:"accessList"` + Error string `json:"error"` + GasUsed Uint `json:"gasUsed"` + }) + // Returns the current price per gas in wei. + EthGasPrice() (GasPrice Uint) + // Returns the current maxPriorityFeePerGas per gas in wei. + EthMaxPriorityFeePerGas() (MaxPriorityFeePerGas Uint) + // Transaction fee history + EthFeeHistory( + BlockCount Uint, + NewestBlock BlockNumberOrTag, + RewardPercentiles []float64, + ) (FeeHistoryResult struct { + BaseFeePerGas []Uint `json:"baseFeePerGas"` + OldestBlock Uint `json:"oldestBlock"` + Reward [][]Uint `json:"reward"` + }) + // Creates a filter object, based on filter options, to notify when the state changes (logs). + EthNewFilter( + Filter Filter, + ) (FilterIdentifier Uint) + // Creates a filter in the node, to notify when a new block arrives. + EthNewBlockFilter() (FilterIdentifier Uint) + // Creates a filter in the node, to notify when new pending transactions arrive. + EthNewPendingTransactionFilter() (FilterIdentifier Uint) + // Uninstalls a filter with given id. + EthUninstallFilter( + FilterIdentifier Uint, + ) (Success bool) + // Polling method for a filter, which returns an array of logs which occurred since last poll. + EthGetFilterChanges( + FilterIdentifier Uint, + ) (LogObjects FilterResults) + // Returns an array of all logs matching filter with given id. + EthGetFilterLogs( + FilterIdentifier Uint, + ) (LogObjects FilterResults) + // Returns an array of all logs matching filter with given id. + EthGetLogs( + Filter Filter, + ) (LogObjects FilterResults) + // Returns whether the client is actively mining new blocks. + EthMining() (MiningStatus bool) + // Returns the number of hashes per second that the node is mining with. + EthHashrate() (MiningStatus Uint) + // Returns the hash of the current block, the seedHash, and the boundary condition to be met (“targetâ€). + EthGetWork() (CurrentWork []Bytes32) + // Used for submitting a proof-of-work solution. + EthSubmitWork( + Nonce Bytes8, + Hash Bytes32, + Digest Bytes32, + ) (Success bool) + // Used for submitting mining hashrate. + EthSubmitHashrate( + Hashrate Bytes32, + Id Bytes32, + ) (Success bool) + // Returns an EIP-191 signature over the provided data. + EthSign( + Address Address, + Message Bytes, + ) (Signature Bytes65) + // Returns an RLP encoded transaction signed by the specified account. + EthSignTransaction( + Transaction GenericTransaction, + ) (EncodedTransaction Bytes) + // Returns the balance of the account of given address. + EthGetBalance( + Address Address, + Block BlockNumberOrTag, + ) (Balance Uint) + // Returns the value from a storage position at a given address. + EthGetStorageAt( + Address Address, + StorageSlot Uint256, + Block BlockNumberOrTag, + ) (Value Bytes) + // Returns the number of transactions sent from an address. + EthGetTransactionCount( + Address Address, + Block BlockNumberOrTag, + ) (TransactionCount Uint) + // Returns code at a given address. + EthGetCode( + Address Address, + Block BlockNumberOrTag, + ) (Bytecode Bytes) + // Returns the merkle proof for a given account and optionally some storage keys. + EthGetProof( + Address Address, + StorageKeys []Hash32, + Block BlockNumberOrTag, + ) (Account AccountProof) + // Signs and submits a transaction. + EthSendTransaction( + Transaction GenericTransaction, + ) (TransactionHash Hash32) + // Submits a raw transaction. + EthSendRawTransaction( + Transaction Bytes, + ) (TransactionHash Hash32) + // Returns the information about a transaction requested by transaction hash. + EthGetTransactionByHash( + TransactionHash Hash32, + ) (TransactionInformation TransactionInfo) + // Returns information about a transaction by block hash and transaction index position. + EthGetTransactionByBlockHashAndIndex( + BlockHash Hash32, + TransactionIndex Uint, + ) (TransactionInformation TransactionInfo) + // Returns information about a transaction by block number and transaction index position. + EthGetTransactionByBlockNumberAndIndex( + Block BlockNumberOrTag, + TransactionIndex Uint, + ) (TransactionInformation TransactionInfo) + // Returns the receipt of a transaction by transaction hash. + EthGetTransactionReceipt( + TransactionHash Hash32, + ) (ReceiptInformation ReceiptInfo) +} +type AccessList []AccessListEntry +type AccessListEntry struct { + Address Address `json:"address"` + StorageKeys []Hash32 `json:"storageKeys"` +} +type AccountProof struct { + AccountProof []Bytes `json:"accountProof"` + Address Address `json:"address"` + Balance Uint256 `json:"balance"` + CodeHash Hash32 `json:"codeHash"` + Nonce Uint64 `json:"nonce"` + StorageHash Hash32 `json:"storageHash"` + StorageProof []StorageProof `json:"storageProof"` +} +type BadBlock struct { + Block Bytes `json:"block"` + Hash Hash32 `json:"hash"` + Rlp Bytes `json:"rlp"` +} +type Block struct { + BaseFeePerGas Uint `json:"baseFeePerGas"` + Difficulty Bytes `json:"difficulty"` + ExtraData Bytes `json:"extraData"` + GasLimit Uint `json:"gasLimit"` + GasUsed Uint `json:"gasUsed"` + LogsBloom Bytes256 `json:"logsBloom"` + Miner Address `json:"miner"` + MixHash Hash32 `json:"mixHash"` + Nonce Bytes8 `json:"nonce"` + Number Uint `json:"number"` + ParentHash Hash32 `json:"parentHash"` + ReceiptsRoot Hash32 `json:"receiptsRoot"` + Sha3Uncles Hash32 `json:"sha3Uncles"` + Size Uint `json:"size"` + StateRoot Hash32 `json:"stateRoot"` + Timestamp Uint `json:"timestamp"` + TotalDifficulty Uint `json:"totalDifficulty"` + Transactions struct { + Option0 []Hash32 + Option1 []TransactionSigned + } `json:"transactions"` + TransactionsRoot Hash32 `json:"transactionsRoot"` + Uncles []Hash32 `json:"uncles"` +} +type BlockNumberOrTag struct { + Option0 Uint + Option1 BlockTag +} +type BlockTag string +type Filter struct { + Address struct { + Option0 Address + Option1 Addresses + } `json:"address"` + FromBlock Uint `json:"fromBlock"` + ToBlock Uint `json:"toBlock"` + Topics FilterTopics `json:"topics"` +} +type FilterResults struct { + Option0 []Hash32 + Option1 []Hash32 + Option2 []Log +} +type FilterTopic struct { + Option0 struct{} + Option1 Bytes32 + Option2 []Bytes32 +} +type FilterTopics []FilterTopic +type GenericTransaction struct { + AccessList AccessList `json:"accessList"` + ChainId Uint `json:"chainId"` + From Address `json:"from"` + Gas Uint `json:"gas"` + GasPrice Uint `json:"gasPrice"` + Input Bytes `json:"input"` + MaxFeePerGas Uint `json:"maxFeePerGas"` + MaxPriorityFeePerGas Uint `json:"maxPriorityFeePerGas"` + Nonce Uint `json:"nonce"` + To Address `json:"to"` + Type Byte `json:"type"` + Value Uint `json:"value"` +} +type Log struct { + Address Address `json:"address"` + BlockHash Hash32 `json:"blockHash"` + BlockNumber Uint `json:"blockNumber"` + Data Bytes `json:"data"` + LogIndex Uint `json:"logIndex"` + Removed bool `json:"removed"` + Topics []Bytes32 `json:"topics"` + TransactionHash Hash32 `json:"transactionHash"` + TransactionIndex Uint `json:"transactionIndex"` +} +type ReceiptInfo struct { + BlockHash Hash32 `json:"blockHash"` + BlockNumber Uint `json:"blockNumber"` + ContractAddress struct { + Option0 Address + Option1 struct{} + } `json:"contractAddress"` + CumulativeGasUsed Uint `json:"cumulativeGasUsed"` + EffectiveGasPrice Uint `json:"effectiveGasPrice"` + From Address `json:"from"` + GasUsed Uint `json:"gasUsed"` + Logs []Log `json:"logs"` + LogsBloom Bytes256 `json:"logsBloom"` + Root Bytes32 `json:"root"` + Status Uint `json:"status"` + To Address `json:"to"` + TransactionHash Hash32 `json:"transactionHash"` + TransactionIndex Uint `json:"transactionIndex"` +} +type StorageProof struct { + Key Hash32 `json:"key"` + Proof []Bytes `json:"proof"` + Value Uint256 `json:"value"` +} +type SyncingStatus struct { + Option0 struct { + CurrentBlock Uint `json:"currentBlock"` + HighestBlock Uint `json:"highestBlock"` + StartingBlock Uint `json:"startingBlock"` + } + Option1 bool +} +type Transaction1559Signed struct { + Field0 Transaction1559Unsigned + Field1 struct { + R Uint `json:"r"` + S Uint `json:"s"` + YParity Uint `json:"yParity"` + } +} +type Transaction1559Unsigned struct { + AccessList AccessList `json:"accessList"` + ChainId Uint `json:"chainId"` + Gas Uint `json:"gas"` + Input Bytes `json:"input"` + MaxFeePerGas Uint `json:"maxFeePerGas"` + MaxPriorityFeePerGas Uint `json:"maxPriorityFeePerGas"` + Nonce Uint `json:"nonce"` + To Address `json:"to"` + Type Byte `json:"type"` + Value Uint `json:"value"` +} +type Transaction2930Signed struct { + Field0 Transaction2930Unsigned + Field1 struct { + R Uint `json:"r"` + S Uint `json:"s"` + YParity Uint `json:"yParity"` + } +} +type Transaction2930Unsigned struct { + AccessList AccessList `json:"accessList"` + ChainId Uint `json:"chainId"` + Gas Uint `json:"gas"` + GasPrice Uint `json:"gasPrice"` + Input Bytes `json:"input"` + Nonce Uint `json:"nonce"` + To Address `json:"to"` + Type Byte `json:"type"` + Value Uint `json:"value"` +} +type TransactionInfo struct { + Field0 struct { + BlockHash Hash32 `json:"blockHash"` + BlockNumber Uint `json:"blockNumber"` + From Address `json:"from"` + Hash Hash32 `json:"hash"` + TransactionIndex Uint `json:"transactionIndex"` + } + Field1 TransactionSigned +} +type TransactionLegacySigned struct { + Field0 TransactionLegacyUnsigned + Field1 struct { + R Uint `json:"r"` + S Uint `json:"s"` + V Uint `json:"v"` + } +} +type TransactionLegacyUnsigned struct { + ChainId Uint `json:"chainId"` + Gas Uint `json:"gas"` + GasPrice Uint `json:"gasPrice"` + Input Bytes `json:"input"` + Nonce Uint `json:"nonce"` + To Address `json:"to"` + Type Byte `json:"type"` + Value Uint `json:"value"` +} +type TransactionSigned struct { + Option0 Transaction1559Signed + Option1 Transaction2930Signed + Option2 TransactionLegacySigned +} +type TransactionUnsigned struct { + Option0 Transaction1559Unsigned + Option1 Transaction2930Unsigned + Option2 TransactionLegacyUnsigned +} +type Address string +type Addresses []Address +type Byte string +type Bytes string +type Bytes256 string +type Bytes32 string +type Bytes65 string +type Bytes8 string +type Hash32 string +type Uint string +type Uint256 string +type Uint64 string diff --git a/openrpc/out/generated_spec.json b/openrpc/out/spec.json similarity index 100% rename from openrpc/out/generated_spec.json rename to openrpc/out/spec.json -- GitLab