diff --git a/Cargo.lock b/Cargo.lock index 931088a1..870375f2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -650,6 +650,7 @@ dependencies = [ "casper-json-rpc", "casper-types", "datasize", + "derive-new 0.6.0", "futures", "http", "hyper", diff --git a/resources/test/rpc_schema.json b/resources/test/rpc_schema.json index b3ac2b60..2629c65a 100644 --- a/resources/test/rpc_schema.json +++ b/resources/test/rpc_schema.json @@ -15,7 +15,7 @@ }, "servers": [ { - "name": "any Casper Network node", + "name": "any Sidecar with JSON RPC API enabled", "url": "http://IP:PORT/rpc/" } ], diff --git a/resources/test/speculative_rpc_schema.json b/resources/test/speculative_rpc_schema.json new file mode 100644 index 00000000..47f28473 --- /dev/null +++ b/resources/test/speculative_rpc_schema.json @@ -0,0 +1,3932 @@ +{ + "openrpc": "1.0.0-rc1", + "info": { + "version": "2.0.0", + "title": "Speculative execution client API of Casper Node", + "description": "This describes the JSON-RPC 2.0 API of the speculative execution functinality of a node on the Casper network.", + "contact": { + "name": "Casper Labs", + "url": "https://casperlabs.io" + }, + "license": { + "name": "APACHE LICENSE, VERSION 2.0", + "url": "https://www.apache.org/licenses/LICENSE-2.0" + } + }, + "servers": [ + { + "name": "any Sidecar with speculative JSON RPC API enabled", + "url": "http://IP:PORT/rpc/" + } + ], + "methods": [ + { + "name": "speculative_exec", + "summary": "receives a Deploy to be executed by the network (DEPRECATED: use `account_put_transaction` instead)", + "params": [ + { + "name": "deploy", + "schema": { + "description": "Deploy to execute.", + "$ref": "#/components/schemas/Deploy" + }, + "required": true + } + ], + "result": { + "name": "speculative_exec_result", + "schema": { + "description": "Result for \"speculative_exec_txn\" and \"speculative_exec\" RPC responses.", + "type": "object", + "required": [ + "api_version", + "execution_result" + ], + "properties": { + "api_version": { + "description": "The RPC API version.", + "type": "string" + }, + "execution_result": { + "description": "Result of the speculative execution.", + "$ref": "#/components/schemas/SpeculativeExecutionResult" + } + }, + "additionalProperties": false + } + }, + "examples": [ + { + "name": "speculative_exec_example", + "params": [ + { + "name": "deploy", + "value": { + "hash": "5c9b3b099c1378aa8e4a5f07f59ff1fcdc69a83179427c7e67ae0377d94d93fa", + "header": { + "account": "01d9bf2148748a85c89da5aad8ee0b0fc2d105fd39d41a4c796536354f0ae2900c", + "timestamp": "2020-11-17T00:39:24.072Z", + "ttl": "1h", + "gas_price": 1, + "body_hash": "d53cf72d17278fd47d399013ca389c50d589352f1a12593c0b8e01872a641b50", + "dependencies": [ + "0101010101010101010101010101010101010101010101010101010101010101" + ], + "chain_name": "casper-example" + }, + "payment": { + "StoredContractByName": { + "name": "casper-example", + "entry_point": "example-entry-point", + "args": [ + [ + "amount", + { + "cl_type": "I32", + "bytes": "e8030000", + "parsed": 1000 + } + ] + ] + } + }, + "session": { + "Transfer": { + "args": [ + [ + "amount", + { + "cl_type": "I32", + "bytes": "e8030000", + "parsed": 1000 + } + ] + ] + } + }, + "approvals": [ + { + "signer": "01d9bf2148748a85c89da5aad8ee0b0fc2d105fd39d41a4c796536354f0ae2900c", + "signature": "014c1a89f92e29dd74fc648f741137d9caf4edba97c5f9799ce0c9aa6b0c9b58db368c64098603dbecef645774c05dff057cb1f91f2cf390bbacce78aa6f084007" + } + ] + } + } + ], + "result": { + "name": "speculative_exec_example_result", + "value": { + "api_version": "2.0.0", + "execution_result": { + "block_hash": "0000000000000000000000000000000000000000000000000000000000000000", + "transfers": [], + "limit": "0", + "consumed": "0", + "effects": [], + "messages": [], + "error": null + } + } + } + } + ] + }, + { + "name": "speculative_exec_txn", + "summary": "receives a Deploy to be executed by the network (DEPRECATED: use `account_put_transaction` instead)", + "params": [ + { + "name": "transaction", + "schema": { + "description": "Transaction to execute.", + "$ref": "#/components/schemas/Transaction" + }, + "required": true + } + ], + "result": { + "name": "speculative_exec_txn_result", + "schema": { + "description": "Result for \"speculative_exec_txn\" and \"speculative_exec\" RPC responses.", + "type": "object", + "required": [ + "api_version", + "execution_result" + ], + "properties": { + "api_version": { + "description": "The RPC API version.", + "type": "string" + }, + "execution_result": { + "description": "Result of the speculative execution.", + "$ref": "#/components/schemas/SpeculativeExecutionResult" + } + }, + "additionalProperties": false + } + }, + "examples": [ + { + "name": "speculative_exec_txn_example", + "params": [ + { + "name": "transaction", + "value": { + "Version1": { + "hash": "52a75f3651e450cc2c3ed534bf130bae2515950707d70bb60067aada30b97ca8", + "header": { + "chain_name": "casper-example", + "timestamp": "2020-11-17T00:39:24.072Z", + "ttl": "1h", + "body_hash": "8c36f401d829378219b676ac6cceef90b08171499f5f5726ab5021df46d8b824", + "pricing_mode": { + "Fixed": { + "gas_price_tolerance": 5 + } + }, + "initiator_addr": { + "PublicKey": "01d9bf2148748a85c89da5aad8ee0b0fc2d105fd39d41a4c796536354f0ae2900c" + } + }, + "body": { + "args": [ + [ + "source", + { + "cl_type": { + "Option": "URef" + }, + "bytes": "010a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a07", + "parsed": "uref-0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a-007" + } + ], + [ + "target", + { + "cl_type": "URef", + "bytes": "1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b00", + "parsed": "uref-1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b-000" + } + ], + [ + "amount", + { + "cl_type": "U512", + "bytes": "0500ac23fc06", + "parsed": "30000000000" + } + ], + [ + "id", + { + "cl_type": { + "Option": "U64" + }, + "bytes": "01e703000000000000", + "parsed": 999 + } + ] + ], + "target": "Native", + "entry_point": "Transfer", + "scheduling": "Standard" + }, + "approvals": [ + { + "signer": "01d9bf2148748a85c89da5aad8ee0b0fc2d105fd39d41a4c796536354f0ae2900c", + "signature": "012eaaf83b1ed367ed424c859974bc5115a62d6b10d635f4b39d380414c4abcb2d54c01b7b96e0d27e00ed913f05f06d7bee9c25c31bbd8e9215961e61f835250d" + } + ] + } + } + } + ], + "result": { + "name": "speculative_exec_txn_example_result", + "value": { + "api_version": "2.0.0", + "execution_result": { + "block_hash": "0000000000000000000000000000000000000000000000000000000000000000", + "transfers": [], + "limit": "0", + "consumed": "0", + "effects": [], + "messages": [], + "error": null + } + } + } + } + ] + } + ], + "components": { + "schemas": { + "Deploy": { + "description": "A signed smart contract.", + "type": "object", + "required": [ + "approvals", + "hash", + "header", + "payment", + "session" + ], + "properties": { + "hash": { + "$ref": "#/components/schemas/DeployHash" + }, + "header": { + "$ref": "#/components/schemas/DeployHeader" + }, + "payment": { + "$ref": "#/components/schemas/ExecutableDeployItem" + }, + "session": { + "$ref": "#/components/schemas/ExecutableDeployItem" + }, + "approvals": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Approval" + }, + "uniqueItems": true + } + }, + "additionalProperties": false + }, + "DeployHash": { + "description": "Hex-encoded deploy hash.", + "allOf": [ + { + "$ref": "#/components/schemas/Digest" + } + ] + }, + "Digest": { + "description": "Hex-encoded hash digest.", + "type": "string" + }, + "DeployHeader": { + "description": "The header portion of a [`Deploy`].", + "type": "object", + "required": [ + "account", + "body_hash", + "chain_name", + "dependencies", + "gas_price", + "timestamp", + "ttl" + ], + "properties": { + "account": { + "$ref": "#/components/schemas/PublicKey" + }, + "timestamp": { + "$ref": "#/components/schemas/Timestamp" + }, + "ttl": { + "$ref": "#/components/schemas/TimeDiff" + }, + "gas_price": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "body_hash": { + "$ref": "#/components/schemas/Digest" + }, + "dependencies": { + "type": "array", + "items": { + "$ref": "#/components/schemas/DeployHash" + } + }, + "chain_name": { + "type": "string" + } + }, + "additionalProperties": false + }, + "PublicKey": { + "description": "Hex-encoded cryptographic public key, including the algorithm tag prefix.", + "examples": [ + { + "name": "SystemPublicKey", + "description": "A pseudo public key, used for example when the system proposes an immediate switch block after a network upgrade rather than a specific validator. Its hex-encoded value is always '00', as is the corresponding pseudo signature's", + "value": "00" + }, + { + "name": "Ed25519PublicKey", + "description": "An Ed25519 public key. Its hex-encoded value begins '01' and is followed by 64 characters", + "value": "018a88e3dd7409f195fd52db2d3cba5d72ca6709bf1d94121bf3748801b40f6f5c" + }, + { + "name": "Secp256k1PublicKey", + "description": "A secp256k1 public key. Its hex-encoded value begins '02' and is followed by 66 characters", + "value": "0203408e9526316fd1f8def480dd45b2cc72ffd732771c9ceb5d92ffa4051e6ee084" + } + ], + "type": "string" + }, + "Timestamp": { + "description": "Timestamp formatted as per RFC 3339", + "type": "string" + }, + "TimeDiff": { + "description": "Human-readable duration.", + "type": "string" + }, + "ExecutableDeployItem": { + "description": "The executable component of a [`Deploy`].", + "oneOf": [ + { + "description": "Executable specified as raw bytes that represent Wasm code and an instance of [`RuntimeArgs`].", + "type": "object", + "required": [ + "ModuleBytes" + ], + "properties": { + "ModuleBytes": { + "type": "object", + "required": [ + "args", + "module_bytes" + ], + "properties": { + "module_bytes": { + "description": "Hex-encoded raw Wasm bytes.", + "allOf": [ + { + "$ref": "#/components/schemas/Bytes" + } + ] + }, + "args": { + "description": "Runtime arguments.", + "allOf": [ + { + "$ref": "#/components/schemas/RuntimeArgs" + } + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Stored contract referenced by its [`AddressableEntityHash`], entry point and an instance of [`RuntimeArgs`].", + "type": "object", + "required": [ + "StoredContractByHash" + ], + "properties": { + "StoredContractByHash": { + "type": "object", + "required": [ + "args", + "entry_point", + "hash" + ], + "properties": { + "hash": { + "description": "Hex-encoded contract hash.", + "allOf": [ + { + "$ref": "#/components/schemas/AddressableEntityHash" + } + ] + }, + "entry_point": { + "description": "Name of an entry point.", + "type": "string" + }, + "args": { + "description": "Runtime arguments.", + "allOf": [ + { + "$ref": "#/components/schemas/RuntimeArgs" + } + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Stored contract referenced by a named key existing in the signer's account context, entry point and an instance of [`RuntimeArgs`].", + "type": "object", + "required": [ + "StoredContractByName" + ], + "properties": { + "StoredContractByName": { + "type": "object", + "required": [ + "args", + "entry_point", + "name" + ], + "properties": { + "name": { + "description": "Named key.", + "type": "string" + }, + "entry_point": { + "description": "Name of an entry point.", + "type": "string" + }, + "args": { + "description": "Runtime arguments.", + "allOf": [ + { + "$ref": "#/components/schemas/RuntimeArgs" + } + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Stored versioned contract referenced by its [`PackageHash`], entry point and an instance of [`RuntimeArgs`].", + "type": "object", + "required": [ + "StoredVersionedContractByHash" + ], + "properties": { + "StoredVersionedContractByHash": { + "type": "object", + "required": [ + "args", + "entry_point", + "hash" + ], + "properties": { + "hash": { + "description": "Hex-encoded contract package hash.", + "allOf": [ + { + "$ref": "#/components/schemas/PackageHash" + } + ] + }, + "version": { + "description": "An optional version of the contract to call. It will default to the highest enabled version if no value is specified.", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "entry_point": { + "description": "Entry point name.", + "type": "string" + }, + "args": { + "description": "Runtime arguments.", + "allOf": [ + { + "$ref": "#/components/schemas/RuntimeArgs" + } + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Stored versioned contract referenced by a named key existing in the signer's account context, entry point and an instance of [`RuntimeArgs`].", + "type": "object", + "required": [ + "StoredVersionedContractByName" + ], + "properties": { + "StoredVersionedContractByName": { + "type": "object", + "required": [ + "args", + "entry_point", + "name" + ], + "properties": { + "name": { + "description": "Named key.", + "type": "string" + }, + "version": { + "description": "An optional version of the contract to call. It will default to the highest enabled version if no value is specified.", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "entry_point": { + "description": "Entry point name.", + "type": "string" + }, + "args": { + "description": "Runtime arguments.", + "allOf": [ + { + "$ref": "#/components/schemas/RuntimeArgs" + } + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "A native transfer which does not contain or reference a Wasm code.", + "type": "object", + "required": [ + "Transfer" + ], + "properties": { + "Transfer": { + "type": "object", + "required": [ + "args" + ], + "properties": { + "args": { + "description": "Runtime arguments.", + "allOf": [ + { + "$ref": "#/components/schemas/RuntimeArgs" + } + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "Bytes": { + "description": "Hex-encoded bytes.", + "type": "string" + }, + "RuntimeArgs": { + "description": "Represents a collection of arguments passed to a smart contract.", + "type": "array", + "items": { + "$ref": "#/components/schemas/NamedArg" + } + }, + "NamedArg": { + "description": "Named arguments to a contract.", + "type": "array", + "items": [ + { + "type": "string" + }, + { + "$ref": "#/components/schemas/CLValue" + } + ], + "maxItems": 2, + "minItems": 2 + }, + "CLValue": { + "description": "A Casper value, i.e. a value which can be stored and manipulated by smart contracts.\n\nIt holds the underlying data as a type-erased, serialized `Vec` and also holds the CLType of the underlying data as a separate member.\n\nThe `parsed` field, representing the original value, is a convenience only available when a CLValue is encoded to JSON, and can always be set to null if preferred.", + "type": "object", + "required": [ + "bytes", + "cl_type" + ], + "properties": { + "cl_type": { + "$ref": "#/components/schemas/CLType" + }, + "bytes": { + "type": "string" + }, + "parsed": true + }, + "additionalProperties": false + }, + "CLType": { + "description": "Casper types, i.e. types which can be stored and manipulated by smart contracts.\n\nProvides a description of the underlying data type of a [`CLValue`](crate::CLValue).", + "oneOf": [ + { + "description": "`bool` primitive.", + "type": "string", + "enum": [ + "Bool" + ] + }, + { + "description": "`i32` primitive.", + "type": "string", + "enum": [ + "I32" + ] + }, + { + "description": "`i64` primitive.", + "type": "string", + "enum": [ + "I64" + ] + }, + { + "description": "`u8` primitive.", + "type": "string", + "enum": [ + "U8" + ] + }, + { + "description": "`u32` primitive.", + "type": "string", + "enum": [ + "U32" + ] + }, + { + "description": "`u64` primitive.", + "type": "string", + "enum": [ + "U64" + ] + }, + { + "description": "[`U128`] large unsigned integer type.", + "type": "string", + "enum": [ + "U128" + ] + }, + { + "description": "[`U256`] large unsigned integer type.", + "type": "string", + "enum": [ + "U256" + ] + }, + { + "description": "[`U512`] large unsigned integer type.", + "type": "string", + "enum": [ + "U512" + ] + }, + { + "description": "`()` primitive.", + "type": "string", + "enum": [ + "Unit" + ] + }, + { + "description": "`String` primitive.", + "type": "string", + "enum": [ + "String" + ] + }, + { + "description": "[`Key`] system type.", + "type": "string", + "enum": [ + "Key" + ] + }, + { + "description": "[`URef`] system type.", + "type": "string", + "enum": [ + "URef" + ] + }, + { + "description": "[`PublicKey`](crate::PublicKey) system type.", + "type": "string", + "enum": [ + "PublicKey" + ] + }, + { + "description": "`Option` of a `CLType`.", + "type": "object", + "required": [ + "Option" + ], + "properties": { + "Option": { + "$ref": "#/components/schemas/CLType" + } + }, + "additionalProperties": false + }, + { + "description": "Variable-length list of a single `CLType` (comparable to a `Vec`).", + "type": "object", + "required": [ + "List" + ], + "properties": { + "List": { + "$ref": "#/components/schemas/CLType" + } + }, + "additionalProperties": false + }, + { + "description": "Fixed-length list of a single `CLType` (comparable to a Rust array).", + "type": "object", + "required": [ + "ByteArray" + ], + "properties": { + "ByteArray": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + { + "description": "`Result` with `Ok` and `Err` variants of `CLType`s.", + "type": "object", + "required": [ + "Result" + ], + "properties": { + "Result": { + "type": "object", + "required": [ + "err", + "ok" + ], + "properties": { + "ok": { + "$ref": "#/components/schemas/CLType" + }, + "err": { + "$ref": "#/components/schemas/CLType" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Map with keys of a single `CLType` and values of a single `CLType`.", + "type": "object", + "required": [ + "Map" + ], + "properties": { + "Map": { + "type": "object", + "required": [ + "key", + "value" + ], + "properties": { + "key": { + "$ref": "#/components/schemas/CLType" + }, + "value": { + "$ref": "#/components/schemas/CLType" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "1-ary tuple of a `CLType`.", + "type": "object", + "required": [ + "Tuple1" + ], + "properties": { + "Tuple1": { + "type": "array", + "items": { + "$ref": "#/components/schemas/CLType" + }, + "maxItems": 1, + "minItems": 1 + } + }, + "additionalProperties": false + }, + { + "description": "2-ary tuple of `CLType`s.", + "type": "object", + "required": [ + "Tuple2" + ], + "properties": { + "Tuple2": { + "type": "array", + "items": { + "$ref": "#/components/schemas/CLType" + }, + "maxItems": 2, + "minItems": 2 + } + }, + "additionalProperties": false + }, + { + "description": "3-ary tuple of `CLType`s.", + "type": "object", + "required": [ + "Tuple3" + ], + "properties": { + "Tuple3": { + "type": "array", + "items": { + "$ref": "#/components/schemas/CLType" + }, + "maxItems": 3, + "minItems": 3 + } + }, + "additionalProperties": false + }, + { + "description": "Unspecified type.", + "type": "string", + "enum": [ + "Any" + ] + } + ] + }, + "AddressableEntityHash": { + "description": "The hex-encoded address of the addressable entity.", + "type": "string" + }, + "PackageHash": { + "description": "The hex-encoded address of the Package.", + "type": "string" + }, + "Approval": { + "description": "A struct containing a signature of a transaction hash and the public key of the signer.", + "type": "object", + "required": [ + "signature", + "signer" + ], + "properties": { + "signer": { + "$ref": "#/components/schemas/PublicKey" + }, + "signature": { + "$ref": "#/components/schemas/Signature" + } + }, + "additionalProperties": false + }, + "Signature": { + "description": "Hex-encoded cryptographic signature, including the algorithm tag prefix.", + "type": "string" + }, + "SpeculativeExecutionResult": { + "type": "object", + "required": [ + "block_hash", + "consumed", + "effects", + "limit", + "messages", + "transfers" + ], + "properties": { + "block_hash": { + "description": "Block hash against which the execution was performed.", + "allOf": [ + { + "$ref": "#/components/schemas/BlockHash" + } + ] + }, + "transfers": { + "description": "List of transfers that happened during execution.", + "type": "array", + "items": { + "$ref": "#/components/schemas/Transfer" + } + }, + "limit": { + "description": "Gas limit.", + "allOf": [ + { + "$ref": "#/components/schemas/Gas" + } + ] + }, + "consumed": { + "description": "Gas consumed.", + "allOf": [ + { + "$ref": "#/components/schemas/Gas" + } + ] + }, + "effects": { + "description": "Execution effects.", + "allOf": [ + { + "$ref": "#/components/schemas/Effects" + } + ] + }, + "messages": { + "description": "Messages emitted during execution.", + "type": "array", + "items": { + "$ref": "#/components/schemas/Message" + } + }, + "error": { + "description": "Did the wasm execute successfully?", + "type": [ + "string", + "null" + ] + } + } + }, + "BlockHash": { + "description": "Hex-encoded cryptographic hash of a block.", + "allOf": [ + { + "$ref": "#/components/schemas/Digest" + } + ] + }, + "Transfer": { + "description": "A versioned wrapper for a transfer.", + "oneOf": [ + { + "description": "A version 1 transfer.", + "type": "object", + "required": [ + "Version1" + ], + "properties": { + "Version1": { + "$ref": "#/components/schemas/TransferV1" + } + }, + "additionalProperties": false + }, + { + "description": "A version 2 transfer.", + "type": "object", + "required": [ + "Version2" + ], + "properties": { + "Version2": { + "$ref": "#/components/schemas/TransferV2" + } + }, + "additionalProperties": false + } + ] + }, + "TransferV1": { + "description": "Represents a version 1 transfer from one purse to another.", + "type": "object", + "required": [ + "amount", + "deploy_hash", + "from", + "gas", + "source", + "target" + ], + "properties": { + "deploy_hash": { + "description": "Hex-encoded Deploy hash of Deploy that created the transfer.", + "allOf": [ + { + "$ref": "#/components/schemas/DeployHash" + } + ] + }, + "from": { + "description": "Account from which transfer was executed", + "allOf": [ + { + "$ref": "#/components/schemas/AccountHash" + } + ] + }, + "to": { + "description": "Account to which funds are transferred", + "anyOf": [ + { + "$ref": "#/components/schemas/AccountHash" + }, + { + "type": "null" + } + ] + }, + "source": { + "description": "Source purse", + "allOf": [ + { + "$ref": "#/components/schemas/URef" + } + ] + }, + "target": { + "description": "Target purse", + "allOf": [ + { + "$ref": "#/components/schemas/URef" + } + ] + }, + "amount": { + "description": "Transfer amount", + "allOf": [ + { + "$ref": "#/components/schemas/U512" + } + ] + }, + "gas": { + "description": "Gas", + "allOf": [ + { + "$ref": "#/components/schemas/U512" + } + ] + }, + "id": { + "description": "User-defined id", + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + "AccountHash": { + "description": "Account hash as a formatted string.", + "type": "string" + }, + "URef": { + "description": "Hex-encoded, formatted URef.", + "type": "string" + }, + "U512": { + "description": "Decimal representation of a 512-bit integer.", + "type": "string" + }, + "TransferV2": { + "description": "Represents a version 2 transfer from one purse to another.", + "type": "object", + "required": [ + "amount", + "from", + "gas", + "source", + "target", + "transaction_hash" + ], + "properties": { + "transaction_hash": { + "description": "Transaction that created the transfer.", + "allOf": [ + { + "$ref": "#/components/schemas/TransactionHash" + } + ] + }, + "from": { + "description": "Entity from which transfer was executed.", + "allOf": [ + { + "$ref": "#/components/schemas/InitiatorAddr" + } + ] + }, + "to": { + "description": "Account to which funds are transferred.", + "anyOf": [ + { + "$ref": "#/components/schemas/AccountHash" + }, + { + "type": "null" + } + ] + }, + "source": { + "description": "Source purse.", + "allOf": [ + { + "$ref": "#/components/schemas/URef" + } + ] + }, + "target": { + "description": "Target purse.", + "allOf": [ + { + "$ref": "#/components/schemas/URef" + } + ] + }, + "amount": { + "description": "Transfer amount.", + "allOf": [ + { + "$ref": "#/components/schemas/U512" + } + ] + }, + "gas": { + "description": "Gas.", + "allOf": [ + { + "$ref": "#/components/schemas/Gas" + } + ] + }, + "id": { + "description": "User-defined ID.", + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + "TransactionHash": { + "description": "A versioned wrapper for a transaction hash or deploy hash.", + "oneOf": [ + { + "description": "A deploy hash.", + "type": "object", + "required": [ + "Deploy" + ], + "properties": { + "Deploy": { + "$ref": "#/components/schemas/DeployHash" + } + }, + "additionalProperties": false + }, + { + "description": "A version 1 transaction hash.", + "type": "object", + "required": [ + "Version1" + ], + "properties": { + "Version1": { + "$ref": "#/components/schemas/TransactionV1Hash" + } + }, + "additionalProperties": false + } + ] + }, + "TransactionV1Hash": { + "description": "Hex-encoded TransactionV1 hash.", + "allOf": [ + { + "$ref": "#/components/schemas/Digest" + } + ] + }, + "InitiatorAddr": { + "description": "The address of the initiator of a TransactionV1.", + "oneOf": [ + { + "description": "The public key of the initiator.", + "type": "object", + "required": [ + "PublicKey" + ], + "properties": { + "PublicKey": { + "$ref": "#/components/schemas/PublicKey" + } + }, + "additionalProperties": false + }, + { + "description": "The account hash derived from the public key of the initiator.", + "type": "object", + "required": [ + "AccountHash" + ], + "properties": { + "AccountHash": { + "$ref": "#/components/schemas/AccountHash" + } + }, + "additionalProperties": false + } + ] + }, + "Gas": { + "description": "The `Gas` struct represents a `U512` amount of gas.", + "allOf": [ + { + "$ref": "#/components/schemas/U512" + } + ] + }, + "Effects": { + "description": "A log of all transforms produced during execution.", + "type": "array", + "items": { + "$ref": "#/components/schemas/TransformV2" + } + }, + "TransformV2": { + "description": "A transformation performed while executing a deploy.", + "type": "object", + "required": [ + "key", + "kind" + ], + "properties": { + "key": { + "$ref": "#/components/schemas/Key" + }, + "kind": { + "$ref": "#/components/schemas/TransformKindV2" + } + }, + "additionalProperties": false + }, + "Key": { + "description": "The key as a formatted string, under which data (e.g. `CLValue`s, smart contracts, user accounts) are stored in global state.", + "type": "string" + }, + "TransformKindV2": { + "description": "Representation of a single transformation occurring during execution.\n\nNote that all arithmetic variants of `TransformKindV2` are commutative which means that a given collection of them can be executed in any order to produce the same end result.", + "oneOf": [ + { + "description": "An identity transformation that does not modify a value in the global state.\n\nCreated as a result of reading from the global state.", + "type": "string", + "enum": [ + "Identity" + ] + }, + { + "description": "Writes a new value in the global state.", + "type": "object", + "required": [ + "Write" + ], + "properties": { + "Write": { + "$ref": "#/components/schemas/StoredValue" + } + }, + "additionalProperties": false + }, + { + "description": "A wrapping addition of an `i32` to an existing numeric value (not necessarily an `i32`) in the global state.", + "type": "object", + "required": [ + "AddInt32" + ], + "properties": { + "AddInt32": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + }, + { + "description": "A wrapping addition of a `u64` to an existing numeric value (not necessarily an `u64`) in the global state.", + "type": "object", + "required": [ + "AddUInt64" + ], + "properties": { + "AddUInt64": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + { + "description": "A wrapping addition of a `U128` to an existing numeric value (not necessarily an `U128`) in the global state.", + "type": "object", + "required": [ + "AddUInt128" + ], + "properties": { + "AddUInt128": { + "$ref": "#/components/schemas/U128" + } + }, + "additionalProperties": false + }, + { + "description": "A wrapping addition of a `U256` to an existing numeric value (not necessarily an `U256`) in the global state.", + "type": "object", + "required": [ + "AddUInt256" + ], + "properties": { + "AddUInt256": { + "$ref": "#/components/schemas/U256" + } + }, + "additionalProperties": false + }, + { + "description": "A wrapping addition of a `U512` to an existing numeric value (not necessarily an `U512`) in the global state.", + "type": "object", + "required": [ + "AddUInt512" + ], + "properties": { + "AddUInt512": { + "$ref": "#/components/schemas/U512" + } + }, + "additionalProperties": false + }, + { + "description": "Adds new named keys to an existing entry in the global state.\n\nThis transform assumes that the existing stored value is either an Account or a Contract.", + "type": "object", + "required": [ + "AddKeys" + ], + "properties": { + "AddKeys": { + "$ref": "#/components/schemas/NamedKeys" + } + }, + "additionalProperties": false + }, + { + "description": "Removes the pathing to the global state entry of the specified key. The pruned element remains reachable from previously generated global state root hashes, but will not be included in the next generated global state root hash and subsequent state accumulated from it.", + "type": "object", + "required": [ + "Prune" + ], + "properties": { + "Prune": { + "$ref": "#/components/schemas/Key" + } + }, + "additionalProperties": false + }, + { + "description": "Represents the case where applying a transform would cause an error.", + "type": "object", + "required": [ + "Failure" + ], + "properties": { + "Failure": { + "$ref": "#/components/schemas/TransformError" + } + }, + "additionalProperties": false + } + ] + }, + "StoredValue": { + "description": "A value stored in Global State.", + "oneOf": [ + { + "description": "A CLValue.", + "type": "object", + "required": [ + "CLValue" + ], + "properties": { + "CLValue": { + "$ref": "#/components/schemas/CLValue" + } + }, + "additionalProperties": false + }, + { + "description": "An account.", + "type": "object", + "required": [ + "Account" + ], + "properties": { + "Account": { + "$ref": "#/components/schemas/Account" + } + }, + "additionalProperties": false + }, + { + "description": "Contract wasm.", + "type": "object", + "required": [ + "ContractWasm" + ], + "properties": { + "ContractWasm": { + "$ref": "#/components/schemas/ContractWasm" + } + }, + "additionalProperties": false + }, + { + "description": "A contract.", + "type": "object", + "required": [ + "Contract" + ], + "properties": { + "Contract": { + "$ref": "#/components/schemas/Contract" + } + }, + "additionalProperties": false + }, + { + "description": "A contract package.", + "type": "object", + "required": [ + "ContractPackage" + ], + "properties": { + "ContractPackage": { + "$ref": "#/components/schemas/ContractPackage" + } + }, + "additionalProperties": false + }, + { + "description": "A version 1 (legacy) transfer.", + "type": "object", + "required": [ + "LegacyTransfer" + ], + "properties": { + "LegacyTransfer": { + "$ref": "#/components/schemas/TransferV1" + } + }, + "additionalProperties": false + }, + { + "description": "Info about a deploy.", + "type": "object", + "required": [ + "DeployInfo" + ], + "properties": { + "DeployInfo": { + "$ref": "#/components/schemas/DeployInfo" + } + }, + "additionalProperties": false + }, + { + "description": "Info about an era.", + "type": "object", + "required": [ + "EraInfo" + ], + "properties": { + "EraInfo": { + "$ref": "#/components/schemas/EraInfo" + } + }, + "additionalProperties": false + }, + { + "description": "Variant that stores [`Bid`].", + "type": "object", + "required": [ + "Bid" + ], + "properties": { + "Bid": { + "$ref": "#/components/schemas/Bid" + } + }, + "additionalProperties": false + }, + { + "description": "Variant that stores withdraw information.", + "type": "object", + "required": [ + "Withdraw" + ], + "properties": { + "Withdraw": { + "type": "array", + "items": { + "$ref": "#/components/schemas/WithdrawPurse" + } + } + }, + "additionalProperties": false + }, + { + "description": "Unbonding information.", + "type": "object", + "required": [ + "Unbonding" + ], + "properties": { + "Unbonding": { + "type": "array", + "items": { + "$ref": "#/components/schemas/UnbondingPurse" + } + } + }, + "additionalProperties": false + }, + { + "description": "An `AddressableEntity`.", + "type": "object", + "required": [ + "AddressableEntity" + ], + "properties": { + "AddressableEntity": { + "$ref": "#/components/schemas/AddressableEntity" + } + }, + "additionalProperties": false + }, + { + "description": "Variant that stores [`BidKind`].", + "type": "object", + "required": [ + "BidKind" + ], + "properties": { + "BidKind": { + "$ref": "#/components/schemas/BidKind" + } + }, + "additionalProperties": false + }, + { + "description": "A `Package`.", + "type": "object", + "required": [ + "Package" + ], + "properties": { + "Package": { + "$ref": "#/components/schemas/Package" + } + }, + "additionalProperties": false + }, + { + "description": "A record of byte code.", + "type": "object", + "required": [ + "ByteCode" + ], + "properties": { + "ByteCode": { + "$ref": "#/components/schemas/ByteCode" + } + }, + "additionalProperties": false + }, + { + "description": "Variant that stores a message topic.", + "type": "object", + "required": [ + "MessageTopic" + ], + "properties": { + "MessageTopic": { + "$ref": "#/components/schemas/MessageTopicSummary" + } + }, + "additionalProperties": false + }, + { + "description": "Variant that stores a message digest.", + "type": "object", + "required": [ + "Message" + ], + "properties": { + "Message": { + "$ref": "#/components/schemas/MessageChecksum" + } + }, + "additionalProperties": false + }, + { + "description": "A NamedKey record.", + "type": "object", + "required": [ + "NamedKey" + ], + "properties": { + "NamedKey": { + "$ref": "#/components/schemas/NamedKeyValue" + } + }, + "additionalProperties": false + } + ] + }, + "Account": { + "description": "Represents an Account in the global state.", + "type": "object", + "required": [ + "account_hash", + "action_thresholds", + "associated_keys", + "main_purse", + "named_keys" + ], + "properties": { + "account_hash": { + "$ref": "#/components/schemas/AccountHash" + }, + "named_keys": { + "$ref": "#/components/schemas/NamedKeys" + }, + "main_purse": { + "$ref": "#/components/schemas/URef" + }, + "associated_keys": { + "$ref": "#/components/schemas/AccountAssociatedKeys" + }, + "action_thresholds": { + "$ref": "#/components/schemas/AccountActionThresholds" + } + }, + "additionalProperties": false + }, + "NamedKeys": { + "description": "A collection of named keys.", + "type": "array", + "items": { + "$ref": "#/components/schemas/NamedKey" + } + }, + "NamedKey": { + "description": "A key with a name.", + "type": "object", + "required": [ + "key", + "name" + ], + "properties": { + "name": { + "description": "The name of the entry.", + "type": "string" + }, + "key": { + "description": "The value of the entry: a casper `Key` type.", + "allOf": [ + { + "$ref": "#/components/schemas/Key" + } + ] + } + }, + "additionalProperties": false + }, + "AccountAssociatedKeys": { + "description": "A collection of weighted public keys (represented as account hashes) associated with an account.", + "allOf": [ + { + "$ref": "#/components/schemas/Array_of_AssociatedKey" + } + ] + }, + "Array_of_AssociatedKey": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AssociatedKey" + } + }, + "AssociatedKey": { + "description": "A weighted public key.", + "type": "object", + "required": [ + "account_hash", + "weight" + ], + "properties": { + "account_hash": { + "description": "The account hash of the public key.", + "allOf": [ + { + "$ref": "#/components/schemas/AccountHash" + } + ] + }, + "weight": { + "description": "The weight assigned to the public key.", + "allOf": [ + { + "$ref": "#/components/schemas/AccountAssociatedKeyWeight" + } + ] + } + } + }, + "AccountAssociatedKeyWeight": { + "description": "The weight associated with public keys in an account's associated keys.", + "type": "integer", + "format": "uint8", + "minimum": 0.0 + }, + "AccountActionThresholds": { + "description": "Thresholds that have to be met when executing an action of a certain type.", + "type": "object", + "required": [ + "deployment", + "key_management" + ], + "properties": { + "deployment": { + "description": "Threshold for deploy execution.", + "allOf": [ + { + "$ref": "#/components/schemas/AccountAssociatedKeyWeight" + } + ] + }, + "key_management": { + "description": "Threshold for managing action threshold.", + "allOf": [ + { + "$ref": "#/components/schemas/AccountAssociatedKeyWeight" + } + ] + } + } + }, + "ContractWasm": { + "description": "A container for contract's WASM bytes.", + "type": "object", + "required": [ + "bytes" + ], + "properties": { + "bytes": { + "$ref": "#/components/schemas/Bytes" + } + } + }, + "Contract": { + "description": "Methods and type signatures supported by a contract.", + "type": "object", + "required": [ + "contract_package_hash", + "contract_wasm_hash", + "entry_points", + "named_keys", + "protocol_version" + ], + "properties": { + "contract_package_hash": { + "$ref": "#/components/schemas/ContractPackageHash" + }, + "contract_wasm_hash": { + "$ref": "#/components/schemas/ContractWasmHash" + }, + "named_keys": { + "$ref": "#/components/schemas/NamedKeys" + }, + "entry_points": { + "$ref": "#/components/schemas/Array_of_NamedEntryPoint" + }, + "protocol_version": { + "$ref": "#/components/schemas/ProtocolVersion" + } + } + }, + "ContractPackageHash": { + "description": "The hash address of the contract package", + "type": "string" + }, + "ContractWasmHash": { + "description": "The hash address of the contract wasm", + "type": "string" + }, + "Array_of_NamedEntryPoint": { + "type": "array", + "items": { + "$ref": "#/components/schemas/NamedEntryPoint" + } + }, + "NamedEntryPoint": { + "type": "object", + "required": [ + "entry_point", + "name" + ], + "properties": { + "name": { + "type": "string" + }, + "entry_point": { + "allOf": [ + { + "$ref": "#/components/schemas/EntryPoint" + } + ] + } + } + }, + "EntryPoint": { + "description": "Type signature of a method. Order of arguments matter since can be referenced by index as well as name.", + "type": "object", + "required": [ + "access", + "args", + "entry_point_type", + "name", + "ret" + ], + "properties": { + "name": { + "type": "string" + }, + "args": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Parameter" + } + }, + "ret": { + "$ref": "#/components/schemas/CLType" + }, + "access": { + "$ref": "#/components/schemas/EntryPointAccess" + }, + "entry_point_type": { + "$ref": "#/components/schemas/EntryPointType" + } + } + }, + "Parameter": { + "description": "Parameter to a method", + "type": "object", + "required": [ + "cl_type", + "name" + ], + "properties": { + "name": { + "type": "string" + }, + "cl_type": { + "$ref": "#/components/schemas/CLType" + } + } + }, + "EntryPointAccess": { + "description": "Enum describing the possible access control options for a contract entry point (method).", + "oneOf": [ + { + "description": "Anyone can call this method (no access controls).", + "type": "string", + "enum": [ + "Public" + ] + }, + { + "description": "Only users from the listed groups may call this method. Note: if the list is empty then this method is not callable from outside the contract.", + "type": "object", + "required": [ + "Groups" + ], + "properties": { + "Groups": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Group" + } + } + }, + "additionalProperties": false + }, + { + "description": "Can't be accessed directly but are kept in the derived wasm bytes.", + "type": "string", + "enum": [ + "Template" + ] + } + ] + }, + "Group": { + "description": "A (labelled) \"user group\". Each method of a versioned contract may be associated with one or more user groups which are allowed to call it.", + "type": "string" + }, + "EntryPointType": { + "description": "Context of method execution\n\nMost significant bit represents version i.e. - 0b0 -> 0.x/1.x (session & contracts) - 0b1 -> 2.x and later (introduced installer, utility entry points)", + "oneOf": [ + { + "description": "Runs using the calling entity's context. In v1.x this was used for both \"session\" code run using the originating Account's context, and also for \"StoredSession\" code that ran in the caller's context. While this made systemic sense due to the way the runtime context nesting works, this dual usage was very confusing to most human beings.\n\nIn v2.x the renamed Caller variant is exclusively used for wasm run using the initiating account entity's context. Previously installed 1.x stored session code should continue to work as the binary value matches but we no longer allow such logic to be upgraded, nor do we allow new stored session to be installed.", + "type": "string", + "enum": [ + "Caller" + ] + }, + { + "description": "Runs using the called entity's context.", + "type": "string", + "enum": [ + "Called" + ] + }, + { + "description": "Extract a subset of bytecode and installs it as a new smart contract. Runs using the called entity's context.", + "type": "string", + "enum": [ + "Factory" + ] + } + ] + }, + "ProtocolVersion": { + "description": "Casper Platform protocol version", + "type": "string" + }, + "ContractPackage": { + "description": "Contract definition, metadata, and security container.", + "type": "object", + "required": [ + "access_key", + "disabled_versions", + "groups", + "lock_status", + "versions" + ], + "properties": { + "access_key": { + "description": "Key used to add or disable versions", + "allOf": [ + { + "$ref": "#/components/schemas/URef" + } + ] + }, + "versions": { + "description": "All versions (enabled & disabled)", + "allOf": [ + { + "$ref": "#/components/schemas/Array_of_ContractVersionAndHash" + } + ] + }, + "disabled_versions": { + "description": "Disabled versions", + "type": "array", + "items": { + "$ref": "#/components/schemas/ContractVersionKey" + }, + "uniqueItems": true + }, + "groups": { + "description": "Mapping maintaining the set of URefs associated with each \"user group\". This can be used to control access to methods in a particular version of the contract. A method is callable by any context which \"knows\" any of the URefs associated with the method's user group.", + "allOf": [ + { + "$ref": "#/components/schemas/Array_of_NamedUserGroup" + } + ] + }, + "lock_status": { + "description": "A flag that determines whether a contract is locked", + "allOf": [ + { + "$ref": "#/components/schemas/ContractPackageStatus" + } + ] + } + } + }, + "Array_of_ContractVersionAndHash": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ContractVersionAndHash" + } + }, + "ContractVersionAndHash": { + "type": "object", + "required": [ + "contract_entity_hash", + "contract_version_key" + ], + "properties": { + "contract_version_key": { + "allOf": [ + { + "$ref": "#/components/schemas/ContractVersionKey" + } + ] + }, + "contract_entity_hash": { + "allOf": [ + { + "$ref": "#/components/schemas/ContractHash" + } + ] + } + } + }, + "ContractVersionKey": { + "description": "Major element of `ProtocolVersion` combined with `ContractVersion`.", + "type": "array", + "items": [ + { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + ], + "maxItems": 2, + "minItems": 2 + }, + "ContractHash": { + "description": "The hash address of the contract", + "type": "string" + }, + "Array_of_NamedUserGroup": { + "type": "array", + "items": { + "$ref": "#/components/schemas/NamedUserGroup" + } + }, + "NamedUserGroup": { + "type": "object", + "required": [ + "group_name", + "group_users" + ], + "properties": { + "group_name": { + "allOf": [ + { + "$ref": "#/components/schemas/Group" + } + ] + }, + "group_users": { + "type": "array", + "items": { + "$ref": "#/components/schemas/URef" + }, + "uniqueItems": true + } + } + }, + "ContractPackageStatus": { + "description": "A enum to determine the lock status of the contract package.", + "oneOf": [ + { + "description": "The package is locked and cannot be versioned.", + "type": "string", + "enum": [ + "Locked" + ] + }, + { + "description": "The package is unlocked and can be versioned.", + "type": "string", + "enum": [ + "Unlocked" + ] + } + ] + }, + "DeployInfo": { + "description": "Information relating to the given Deploy.", + "type": "object", + "required": [ + "deploy_hash", + "from", + "gas", + "source", + "transfers" + ], + "properties": { + "deploy_hash": { + "description": "Hex-encoded Deploy hash.", + "allOf": [ + { + "$ref": "#/components/schemas/DeployHash" + } + ] + }, + "transfers": { + "description": "Version 1 transfers performed by the Deploy.", + "type": "array", + "items": { + "$ref": "#/components/schemas/TransferAddr" + } + }, + "from": { + "description": "Account identifier of the creator of the Deploy.", + "allOf": [ + { + "$ref": "#/components/schemas/AccountHash" + } + ] + }, + "source": { + "description": "Source purse used for payment of the Deploy.", + "allOf": [ + { + "$ref": "#/components/schemas/URef" + } + ] + }, + "gas": { + "description": "Gas cost of executing the Deploy.", + "allOf": [ + { + "$ref": "#/components/schemas/U512" + } + ] + } + }, + "additionalProperties": false + }, + "TransferAddr": { + "description": "Hex-encoded version 1 transfer address.", + "type": "string" + }, + "EraInfo": { + "description": "Auction metadata. Intended to be recorded at each era.", + "type": "object", + "required": [ + "seigniorage_allocations" + ], + "properties": { + "seigniorage_allocations": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SeigniorageAllocation" + } + } + }, + "additionalProperties": false + }, + "SeigniorageAllocation": { + "description": "Information about a seigniorage allocation", + "oneOf": [ + { + "description": "Info about a seigniorage allocation for a validator", + "type": "object", + "required": [ + "Validator" + ], + "properties": { + "Validator": { + "type": "object", + "required": [ + "amount", + "validator_public_key" + ], + "properties": { + "validator_public_key": { + "description": "Validator's public key", + "allOf": [ + { + "$ref": "#/components/schemas/PublicKey" + } + ] + }, + "amount": { + "description": "Allocated amount", + "allOf": [ + { + "$ref": "#/components/schemas/U512" + } + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Info about a seigniorage allocation for a delegator", + "type": "object", + "required": [ + "Delegator" + ], + "properties": { + "Delegator": { + "type": "object", + "required": [ + "amount", + "delegator_public_key", + "validator_public_key" + ], + "properties": { + "delegator_public_key": { + "description": "Delegator's public key", + "allOf": [ + { + "$ref": "#/components/schemas/PublicKey" + } + ] + }, + "validator_public_key": { + "description": "Validator's public key", + "allOf": [ + { + "$ref": "#/components/schemas/PublicKey" + } + ] + }, + "amount": { + "description": "Allocated amount", + "allOf": [ + { + "$ref": "#/components/schemas/U512" + } + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "Bid": { + "description": "An entry in the validator map.", + "type": "object", + "required": [ + "bonding_purse", + "delegation_rate", + "delegators", + "inactive", + "staked_amount", + "validator_public_key" + ], + "properties": { + "validator_public_key": { + "description": "Validator public key.", + "allOf": [ + { + "$ref": "#/components/schemas/PublicKey" + } + ] + }, + "bonding_purse": { + "description": "The purse that was used for bonding.", + "allOf": [ + { + "$ref": "#/components/schemas/URef" + } + ] + }, + "staked_amount": { + "description": "The amount of tokens staked by a validator (not including delegators).", + "allOf": [ + { + "$ref": "#/components/schemas/U512" + } + ] + }, + "delegation_rate": { + "description": "Delegation rate.", + "type": "integer", + "format": "uint8", + "minimum": 0.0 + }, + "vesting_schedule": { + "description": "Vesting schedule for a genesis validator. `None` if non-genesis validator.", + "anyOf": [ + { + "$ref": "#/components/schemas/VestingSchedule" + }, + { + "type": "null" + } + ] + }, + "delegators": { + "description": "This validator's delegators, indexed by their public keys.", + "allOf": [ + { + "$ref": "#/components/schemas/Array_of_PublicKeyAndDelegator" + } + ] + }, + "inactive": { + "description": "`true` if validator has been \"evicted\".", + "type": "boolean" + } + }, + "additionalProperties": false + }, + "VestingSchedule": { + "type": "object", + "required": [ + "initial_release_timestamp_millis" + ], + "properties": { + "initial_release_timestamp_millis": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "locked_amounts": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/components/schemas/U512" + }, + "maxItems": 14, + "minItems": 14 + } + }, + "additionalProperties": false + }, + "Array_of_PublicKeyAndDelegator": { + "type": "array", + "items": { + "$ref": "#/components/schemas/PublicKeyAndDelegator" + } + }, + "PublicKeyAndDelegator": { + "description": "A delegator associated with the given validator.", + "type": "object", + "required": [ + "delegator", + "delegator_public_key" + ], + "properties": { + "delegator_public_key": { + "description": "The public key of the delegator.", + "allOf": [ + { + "$ref": "#/components/schemas/PublicKey" + } + ] + }, + "delegator": { + "description": "The delegator details.", + "allOf": [ + { + "$ref": "#/components/schemas/Delegator" + } + ] + } + } + }, + "Delegator": { + "description": "Represents a party delegating their stake to a validator (or \"delegatee\")", + "type": "object", + "required": [ + "bonding_purse", + "delegator_public_key", + "staked_amount", + "validator_public_key" + ], + "properties": { + "delegator_public_key": { + "$ref": "#/components/schemas/PublicKey" + }, + "staked_amount": { + "$ref": "#/components/schemas/U512" + }, + "bonding_purse": { + "$ref": "#/components/schemas/URef" + }, + "validator_public_key": { + "$ref": "#/components/schemas/PublicKey" + }, + "vesting_schedule": { + "anyOf": [ + { + "$ref": "#/components/schemas/VestingSchedule" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false + }, + "WithdrawPurse": { + "description": "A withdraw purse, a legacy structure.", + "type": "object", + "required": [ + "amount", + "bonding_purse", + "era_of_creation", + "unbonder_public_key", + "validator_public_key" + ], + "properties": { + "bonding_purse": { + "description": "Bonding Purse", + "allOf": [ + { + "$ref": "#/components/schemas/URef" + } + ] + }, + "validator_public_key": { + "description": "Validators public key.", + "allOf": [ + { + "$ref": "#/components/schemas/PublicKey" + } + ] + }, + "unbonder_public_key": { + "description": "Unbonders public key.", + "allOf": [ + { + "$ref": "#/components/schemas/PublicKey" + } + ] + }, + "era_of_creation": { + "description": "Era in which this unbonding request was created.", + "allOf": [ + { + "$ref": "#/components/schemas/EraId" + } + ] + }, + "amount": { + "description": "Unbonding Amount.", + "allOf": [ + { + "$ref": "#/components/schemas/U512" + } + ] + } + }, + "additionalProperties": false + }, + "EraId": { + "description": "Era ID newtype.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "UnbondingPurse": { + "description": "Unbonding purse.", + "type": "object", + "required": [ + "amount", + "bonding_purse", + "era_of_creation", + "unbonder_public_key", + "validator_public_key" + ], + "properties": { + "bonding_purse": { + "description": "Bonding Purse", + "allOf": [ + { + "$ref": "#/components/schemas/URef" + } + ] + }, + "validator_public_key": { + "description": "Validators public key.", + "allOf": [ + { + "$ref": "#/components/schemas/PublicKey" + } + ] + }, + "unbonder_public_key": { + "description": "Unbonders public key.", + "allOf": [ + { + "$ref": "#/components/schemas/PublicKey" + } + ] + }, + "era_of_creation": { + "description": "Era in which this unbonding request was created.", + "allOf": [ + { + "$ref": "#/components/schemas/EraId" + } + ] + }, + "amount": { + "description": "Unbonding Amount.", + "allOf": [ + { + "$ref": "#/components/schemas/U512" + } + ] + }, + "new_validator": { + "description": "The validator public key to re-delegate to.", + "anyOf": [ + { + "$ref": "#/components/schemas/PublicKey" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false + }, + "AddressableEntity": { + "description": "Methods and type signatures supported by a contract.", + "type": "object", + "required": [ + "action_thresholds", + "associated_keys", + "byte_code_hash", + "entity_kind", + "entry_points", + "main_purse", + "message_topics", + "package_hash", + "protocol_version" + ], + "properties": { + "protocol_version": { + "$ref": "#/components/schemas/ProtocolVersion" + }, + "entity_kind": { + "$ref": "#/components/schemas/EntityKind" + }, + "package_hash": { + "$ref": "#/components/schemas/PackageHash" + }, + "byte_code_hash": { + "$ref": "#/components/schemas/ByteCodeHash" + }, + "main_purse": { + "$ref": "#/components/schemas/URef" + }, + "entry_points": { + "$ref": "#/components/schemas/Array_of_NamedEntryPoint" + }, + "associated_keys": { + "$ref": "#/components/schemas/EntityAssociatedKeys" + }, + "action_thresholds": { + "$ref": "#/components/schemas/EntityActionThresholds" + }, + "message_topics": { + "$ref": "#/components/schemas/Array_of_MessageTopic" + } + } + }, + "EntityKind": { + "description": "The type of Package.", + "oneOf": [ + { + "description": "Package associated with a native contract implementation.", + "type": "object", + "required": [ + "System" + ], + "properties": { + "System": { + "$ref": "#/components/schemas/SystemEntityType" + } + }, + "additionalProperties": false + }, + { + "description": "Package associated with an Account hash.", + "type": "object", + "required": [ + "Account" + ], + "properties": { + "Account": { + "$ref": "#/components/schemas/AccountHash" + } + }, + "additionalProperties": false + }, + { + "description": "Packages associated with Wasm stored on chain.", + "type": "string", + "enum": [ + "SmartContract" + ] + } + ] + }, + "SystemEntityType": { + "description": "System contract types.\n\nUsed by converting to a `u32` and passing as the `system_contract_index` argument of `ext_ffi::casper_get_system_contract()`.", + "oneOf": [ + { + "description": "Mint contract.", + "type": "string", + "enum": [ + "Mint" + ] + }, + { + "description": "Handle Payment contract.", + "type": "string", + "enum": [ + "HandlePayment" + ] + }, + { + "description": "Standard Payment contract.", + "type": "string", + "enum": [ + "StandardPayment" + ] + }, + { + "description": "Auction contract.", + "type": "string", + "enum": [ + "Auction" + ] + } + ] + }, + "ByteCodeHash": { + "description": "The hash address of the contract wasm", + "type": "string" + }, + "EntityAssociatedKeys": { + "description": "A collection of weighted public keys (represented as account hashes) associated with an account.", + "allOf": [ + { + "$ref": "#/components/schemas/Array_of_AssociatedKey" + } + ] + }, + "EntityActionThresholds": { + "description": "Thresholds that have to be met when executing an action of a certain type.", + "type": "object", + "required": [ + "deployment", + "key_management", + "upgrade_management" + ], + "properties": { + "deployment": { + "description": "Threshold for deploy execution.", + "allOf": [ + { + "$ref": "#/components/schemas/EntityAssociatedKeyWeight" + } + ] + }, + "upgrade_management": { + "description": "Threshold for upgrading contracts.", + "allOf": [ + { + "$ref": "#/components/schemas/EntityAssociatedKeyWeight" + } + ] + }, + "key_management": { + "description": "Threshold for managing action threshold.", + "allOf": [ + { + "$ref": "#/components/schemas/EntityAssociatedKeyWeight" + } + ] + } + } + }, + "EntityAssociatedKeyWeight": { + "description": "The weight associated with public keys in an account's associated keys.", + "type": "integer", + "format": "uint8", + "minimum": 0.0 + }, + "Array_of_MessageTopic": { + "type": "array", + "items": { + "$ref": "#/components/schemas/MessageTopic" + } + }, + "MessageTopic": { + "type": "object", + "required": [ + "topic_name", + "topic_name_hash" + ], + "properties": { + "topic_name": { + "type": "string" + }, + "topic_name_hash": { + "allOf": [ + { + "$ref": "#/components/schemas/TopicNameHash" + } + ] + } + } + }, + "TopicNameHash": { + "description": "The hash of the name of the message topic.", + "type": "string" + }, + "BidKind": { + "description": "Auction bid variants.", + "oneOf": [ + { + "description": "A unified record indexed on validator data, with an embedded collection of all delegator bids assigned to that validator. The Unified variant is for legacy retrograde support, new instances will not be created going forward.", + "type": "object", + "required": [ + "Unified" + ], + "properties": { + "Unified": { + "$ref": "#/components/schemas/Bid" + } + }, + "additionalProperties": false + }, + { + "description": "A bid record containing only validator data.", + "type": "object", + "required": [ + "Validator" + ], + "properties": { + "Validator": { + "$ref": "#/components/schemas/ValidatorBid" + } + }, + "additionalProperties": false + }, + { + "description": "A bid record containing only delegator data.", + "type": "object", + "required": [ + "Delegator" + ], + "properties": { + "Delegator": { + "$ref": "#/components/schemas/Delegator" + } + }, + "additionalProperties": false + } + ] + }, + "ValidatorBid": { + "description": "An entry in the validator map.", + "type": "object", + "required": [ + "bonding_purse", + "delegation_rate", + "inactive", + "staked_amount", + "validator_public_key" + ], + "properties": { + "validator_public_key": { + "description": "Validator public key", + "allOf": [ + { + "$ref": "#/components/schemas/PublicKey" + } + ] + }, + "bonding_purse": { + "description": "The purse that was used for bonding.", + "allOf": [ + { + "$ref": "#/components/schemas/URef" + } + ] + }, + "staked_amount": { + "description": "The amount of tokens staked by a validator (not including delegators).", + "allOf": [ + { + "$ref": "#/components/schemas/U512" + } + ] + }, + "delegation_rate": { + "description": "Delegation rate", + "type": "integer", + "format": "uint8", + "minimum": 0.0 + }, + "vesting_schedule": { + "description": "Vesting schedule for a genesis validator. `None` if non-genesis validator.", + "anyOf": [ + { + "$ref": "#/components/schemas/VestingSchedule" + }, + { + "type": "null" + } + ] + }, + "inactive": { + "description": "`true` if validator has been \"evicted\"", + "type": "boolean" + } + }, + "additionalProperties": false + }, + "Package": { + "description": "Entity definition, metadata, and security container.", + "type": "object", + "required": [ + "access_key", + "disabled_versions", + "groups", + "lock_status", + "versions" + ], + "properties": { + "access_key": { + "description": "Key used to add or disable versions.", + "allOf": [ + { + "$ref": "#/components/schemas/URef" + } + ] + }, + "versions": { + "description": "All versions (enabled & disabled).", + "allOf": [ + { + "$ref": "#/components/schemas/Array_of_EntityVersionAndHash" + } + ] + }, + "disabled_versions": { + "description": "Collection of disabled entity versions. The runtime will not permit disabled entity versions to be executed.", + "type": "array", + "items": { + "$ref": "#/components/schemas/EntityVersionKey" + }, + "uniqueItems": true + }, + "groups": { + "description": "Mapping maintaining the set of URefs associated with each \"user group\". This can be used to control access to methods in a particular version of the entity. A method is callable by any context which \"knows\" any of the URefs associated with the method's user group.", + "allOf": [ + { + "$ref": "#/components/schemas/Array_of_NamedUserGroup" + } + ] + }, + "lock_status": { + "description": "A flag that determines whether a entity is locked", + "allOf": [ + { + "$ref": "#/components/schemas/PackageStatus" + } + ] + } + } + }, + "Array_of_EntityVersionAndHash": { + "type": "array", + "items": { + "$ref": "#/components/schemas/EntityVersionAndHash" + } + }, + "EntityVersionAndHash": { + "type": "object", + "required": [ + "addressable_entity_hash", + "entity_version_key" + ], + "properties": { + "entity_version_key": { + "allOf": [ + { + "$ref": "#/components/schemas/EntityVersionKey" + } + ] + }, + "addressable_entity_hash": { + "allOf": [ + { + "$ref": "#/components/schemas/AddressableEntityHash" + } + ] + } + } + }, + "EntityVersionKey": { + "description": "Major element of `ProtocolVersion` combined with `EntityVersion`.", + "type": "object", + "required": [ + "entity_version", + "protocol_version_major" + ], + "properties": { + "protocol_version_major": { + "description": "Major element of `ProtocolVersion` a `ContractVersion` is compatible with.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "entity_version": { + "description": "Automatically incremented value for a contract version within a major `ProtocolVersion`.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + } + }, + "PackageStatus": { + "description": "A enum to determine the lock status of the package.", + "oneOf": [ + { + "description": "The package is locked and cannot be versioned.", + "type": "string", + "enum": [ + "Locked" + ] + }, + { + "description": "The package is unlocked and can be versioned.", + "type": "string", + "enum": [ + "Unlocked" + ] + } + ] + }, + "ByteCode": { + "description": "A container for contract's Wasm bytes.", + "type": "object", + "required": [ + "bytes", + "kind" + ], + "properties": { + "kind": { + "$ref": "#/components/schemas/ByteCodeKind" + }, + "bytes": { + "$ref": "#/components/schemas/Bytes" + } + } + }, + "ByteCodeKind": { + "description": "The type of Byte code.", + "oneOf": [ + { + "description": "Empty byte code.", + "type": "string", + "enum": [ + "Empty" + ] + }, + { + "description": "Byte code to be executed with the version 1 Casper execution engine.", + "type": "string", + "enum": [ + "V1CasperWasm" + ] + } + ] + }, + "MessageTopicSummary": { + "description": "Summary of a message topic that will be stored in global state.", + "type": "object", + "required": [ + "blocktime", + "message_count" + ], + "properties": { + "message_count": { + "description": "Number of messages in this topic.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "blocktime": { + "description": "Block timestamp in which these messages were emitted.", + "allOf": [ + { + "$ref": "#/components/schemas/BlockTime" + } + ] + } + } + }, + "BlockTime": { + "description": "A newtype wrapping a [`u64`] which represents the block time.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "MessageChecksum": { + "description": "Message checksum as a formatted string.", + "type": "string" + }, + "NamedKeyValue": { + "description": "A NamedKey value.", + "type": "object", + "required": [ + "name", + "named_key" + ], + "properties": { + "named_key": { + "description": "The actual `Key` encoded as a CLValue.", + "allOf": [ + { + "$ref": "#/components/schemas/CLValue" + } + ] + }, + "name": { + "description": "The name of the `Key` encoded as a CLValue.", + "allOf": [ + { + "$ref": "#/components/schemas/CLValue" + } + ] + } + } + }, + "U128": { + "description": "Decimal representation of a 128-bit integer.", + "type": "string" + }, + "U256": { + "description": "Decimal representation of a 256-bit integer.", + "type": "string" + }, + "TransformError": { + "description": "Error type for applying and combining transforms.\n\nA `TypeMismatch` occurs when a transform cannot be applied because the types are not compatible (e.g. trying to add a number to a string).", + "oneOf": [ + { + "description": "Error while (de)serializing data.", + "type": "object", + "required": [ + "Serialization" + ], + "properties": { + "Serialization": { + "$ref": "#/components/schemas/BytesreprError" + } + }, + "additionalProperties": false + }, + { + "description": "Type mismatch error.", + "type": "object", + "required": [ + "TypeMismatch" + ], + "properties": { + "TypeMismatch": { + "$ref": "#/components/schemas/TypeMismatch" + } + }, + "additionalProperties": false + }, + { + "description": "Type no longer supported.", + "type": "string", + "enum": [ + "Deprecated" + ] + } + ] + }, + "BytesreprError": { + "description": "Serialization and deserialization errors.", + "oneOf": [ + { + "description": "Early end of stream while deserializing.", + "type": "string", + "enum": [ + "EarlyEndOfStream" + ] + }, + { + "description": "Formatting error while deserializing.", + "type": "string", + "enum": [ + "Formatting" + ] + }, + { + "description": "Not all input bytes were consumed in [`deserialize`].", + "type": "string", + "enum": [ + "LeftOverBytes" + ] + }, + { + "description": "Out of memory error.", + "type": "string", + "enum": [ + "OutOfMemory" + ] + }, + { + "description": "No serialized representation is available for a value.", + "type": "string", + "enum": [ + "NotRepresentable" + ] + }, + { + "description": "Exceeded a recursion depth limit.", + "type": "string", + "enum": [ + "ExceededRecursionDepth" + ] + } + ] + }, + "TypeMismatch": { + "description": "An error struct representing a type mismatch in [`StoredValue`](crate::StoredValue) operations.", + "type": "object", + "required": [ + "expected", + "found" + ], + "properties": { + "expected": { + "description": "The name of the expected type.", + "type": "string" + }, + "found": { + "description": "The actual type found.", + "type": "string" + } + } + }, + "Message": { + "description": "Message that was emitted by an addressable entity during execution.", + "type": "object", + "required": [ + "block_index", + "entity_hash", + "message", + "topic_index", + "topic_name", + "topic_name_hash" + ], + "properties": { + "entity_hash": { + "description": "The identity of the entity that produced the message.", + "allOf": [ + { + "$ref": "#/components/schemas/EntityAddr" + } + ] + }, + "message": { + "description": "The payload of the message.", + "allOf": [ + { + "$ref": "#/components/schemas/MessagePayload" + } + ] + }, + "topic_name": { + "description": "The name of the topic on which the message was emitted on.", + "type": "string" + }, + "topic_name_hash": { + "description": "The hash of the name of the topic.", + "allOf": [ + { + "$ref": "#/components/schemas/TopicNameHash" + } + ] + }, + "topic_index": { + "description": "Message index in the topic.", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "block_index": { + "description": "Message index in the block.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + }, + "EntityAddr": { + "description": "The address for an AddressableEntity which contains the 32 bytes and tagging information.", + "anyOf": [ + { + "description": "The address for a system entity account or contract.", + "type": "string" + }, + { + "description": "The address of an entity that corresponds to an Account.", + "type": "string" + }, + { + "description": "The address of an entity that corresponds to a Userland smart contract.", + "type": "string" + } + ] + }, + "MessagePayload": { + "description": "The payload of the message emitted by an addressable entity during execution.", + "oneOf": [ + { + "description": "Human readable string message.", + "type": "object", + "required": [ + "String" + ], + "properties": { + "String": { + "type": "string" + } + }, + "additionalProperties": false + }, + { + "description": "Message represented as raw bytes.", + "type": "object", + "required": [ + "Bytes" + ], + "properties": { + "Bytes": { + "$ref": "#/components/schemas/Bytes" + } + }, + "additionalProperties": false + } + ] + }, + "Transaction": { + "description": "A versioned wrapper for a transaction or deploy.", + "oneOf": [ + { + "description": "A deploy.", + "type": "object", + "required": [ + "Deploy" + ], + "properties": { + "Deploy": { + "$ref": "#/components/schemas/Deploy" + } + }, + "additionalProperties": false + }, + { + "description": "A version 1 transaction.", + "type": "object", + "required": [ + "Version1" + ], + "properties": { + "Version1": { + "$ref": "#/components/schemas/TransactionV1" + } + }, + "additionalProperties": false + } + ] + }, + "TransactionV1": { + "description": "A unit of work sent by a client to the network, which when executed can cause global state to be altered.", + "type": "object", + "required": [ + "approvals", + "body", + "hash", + "header" + ], + "properties": { + "hash": { + "$ref": "#/components/schemas/TransactionV1Hash" + }, + "header": { + "$ref": "#/components/schemas/TransactionV1Header" + }, + "body": { + "$ref": "#/components/schemas/TransactionV1Body" + }, + "approvals": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Approval" + }, + "uniqueItems": true + } + }, + "additionalProperties": false + }, + "TransactionV1Header": { + "description": "The header portion of a TransactionV1.", + "type": "object", + "required": [ + "body_hash", + "chain_name", + "initiator_addr", + "pricing_mode", + "timestamp", + "ttl" + ], + "properties": { + "chain_name": { + "type": "string" + }, + "timestamp": { + "$ref": "#/components/schemas/Timestamp" + }, + "ttl": { + "$ref": "#/components/schemas/TimeDiff" + }, + "body_hash": { + "$ref": "#/components/schemas/Digest" + }, + "pricing_mode": { + "$ref": "#/components/schemas/PricingMode" + }, + "initiator_addr": { + "$ref": "#/components/schemas/InitiatorAddr" + } + }, + "additionalProperties": false + }, + "PricingMode": { + "description": "Pricing mode of a Transaction.", + "oneOf": [ + { + "description": "The original payment model, where the creator of the transaction specifies how much they will pay, at what gas price.", + "type": "object", + "required": [ + "Classic" + ], + "properties": { + "Classic": { + "type": "object", + "required": [ + "gas_price_tolerance", + "payment_amount", + "standard_payment" + ], + "properties": { + "payment_amount": { + "description": "User-specified payment amount.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "gas_price_tolerance": { + "description": "User-specified gas_price tolerance (minimum 1). This is interpreted to mean \"do not include this transaction in a block if the current gas price is greater than this number\"", + "type": "integer", + "format": "uint8", + "minimum": 0.0 + }, + "standard_payment": { + "description": "Standard payment.", + "type": "boolean" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "The cost of the transaction is determined by the cost table, per the transaction kind.", + "type": "object", + "required": [ + "Fixed" + ], + "properties": { + "Fixed": { + "type": "object", + "required": [ + "gas_price_tolerance" + ], + "properties": { + "gas_price_tolerance": { + "description": "User-specified gas_price tolerance (minimum 1). This is interpreted to mean \"do not include this transaction in a block if the current gas price is greater than this number\"", + "type": "integer", + "format": "uint8", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "The payment for this transaction was previously reserved, as proven by the receipt hash (this is for future use, not currently implemented).", + "type": "object", + "required": [ + "Reserved" + ], + "properties": { + "Reserved": { + "type": "object", + "required": [ + "paid_amount", + "receipt", + "strike_price" + ], + "properties": { + "receipt": { + "description": "Pre-paid receipt.", + "allOf": [ + { + "$ref": "#/components/schemas/Digest" + } + ] + }, + "paid_amount": { + "description": "Price paid in the past to reserve space in a future block.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "strike_price": { + "description": "The gas price at the time of reservation.", + "type": "integer", + "format": "uint8", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "TransactionV1Body": { + "description": "Body of a `TransactionV1`.", + "type": "object", + "required": [ + "args", + "entry_point", + "scheduling", + "target" + ], + "properties": { + "args": { + "$ref": "#/components/schemas/RuntimeArgs" + }, + "target": { + "$ref": "#/components/schemas/TransactionTarget" + }, + "entry_point": { + "$ref": "#/components/schemas/TransactionEntryPoint" + }, + "scheduling": { + "$ref": "#/components/schemas/TransactionScheduling" + } + }, + "additionalProperties": false + }, + "TransactionTarget": { + "description": "Execution target of a Transaction.", + "oneOf": [ + { + "description": "The execution target is a native operation (e.g. a transfer).", + "type": "string", + "enum": [ + "Native" + ] + }, + { + "description": "The execution target is a stored entity or package.", + "type": "object", + "required": [ + "Stored" + ], + "properties": { + "Stored": { + "type": "object", + "required": [ + "id", + "runtime" + ], + "properties": { + "id": { + "description": "The identifier of the stored execution target.", + "allOf": [ + { + "$ref": "#/components/schemas/TransactionInvocationTarget" + } + ] + }, + "runtime": { + "description": "The execution runtime to use.", + "allOf": [ + { + "$ref": "#/components/schemas/TransactionRuntime" + } + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "The execution target is the included module bytes, i.e. compiled Wasm.", + "type": "object", + "required": [ + "Session" + ], + "properties": { + "Session": { + "type": "object", + "required": [ + "kind", + "module_bytes", + "runtime" + ], + "properties": { + "kind": { + "description": "The kind of session.", + "allOf": [ + { + "$ref": "#/components/schemas/TransactionSessionKind" + } + ] + }, + "module_bytes": { + "description": "The compiled Wasm.", + "allOf": [ + { + "$ref": "#/components/schemas/Bytes" + } + ] + }, + "runtime": { + "description": "The execution runtime to use.", + "allOf": [ + { + "$ref": "#/components/schemas/TransactionRuntime" + } + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "TransactionInvocationTarget": { + "description": "Identifier of a `Stored` transaction target.", + "oneOf": [ + { + "description": "Hex-encoded entity address identifying the invocable entity.", + "type": "object", + "required": [ + "ByHash" + ], + "properties": { + "ByHash": { + "type": "string" + } + }, + "additionalProperties": false + }, + { + "description": "The alias identifying the invocable entity.", + "type": "object", + "required": [ + "ByName" + ], + "properties": { + "ByName": { + "type": "string" + } + }, + "additionalProperties": false + }, + { + "description": "The address and optional version identifying the package.", + "type": "object", + "required": [ + "ByPackageHash" + ], + "properties": { + "ByPackageHash": { + "type": "object", + "required": [ + "addr" + ], + "properties": { + "addr": { + "description": "Hex-encoded address of the package.", + "type": "string" + }, + "version": { + "description": "The package version.\n\nIf `None`, the latest enabled version is implied.", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "The alias and optional version identifying the package.", + "type": "object", + "required": [ + "ByPackageName" + ], + "properties": { + "ByPackageName": { + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "description": "The package name.", + "type": "string" + }, + "version": { + "description": "The package version.\n\nIf `None`, the latest enabled version is implied.", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "TransactionRuntime": { + "description": "Runtime used to execute a Transaction.", + "oneOf": [ + { + "description": "The Casper Version 1 Virtual Machine.", + "type": "string", + "enum": [ + "VmCasperV1" + ] + } + ] + }, + "TransactionSessionKind": { + "description": "Session kind of a Transaction.", + "oneOf": [ + { + "description": "A standard (non-special-case) session.\n\nThis kind of session is not allowed to install or upgrade a stored contract, but can call stored contracts.", + "type": "string", + "enum": [ + "Standard" + ] + }, + { + "description": "A session which installs a stored contract.", + "type": "string", + "enum": [ + "Installer" + ] + }, + { + "description": "A session which upgrades a previously-installed stored contract. Such a session must have \"package_id: PackageIdentifier\" runtime arg present.", + "type": "string", + "enum": [ + "Upgrader" + ] + }, + { + "description": "A session which doesn't call any stored contracts.\n\nThis kind of session is not allowed to install or upgrade a stored contract.", + "type": "string", + "enum": [ + "Isolated" + ] + } + ] + }, + "TransactionEntryPoint": { + "description": "Entry point of a Transaction.", + "oneOf": [ + { + "description": "A non-native, arbitrary entry point.", + "type": "object", + "required": [ + "Custom" + ], + "properties": { + "Custom": { + "type": "string" + } + }, + "additionalProperties": false + }, + { + "description": "The `transfer` native entry point, used to transfer `Motes` from a source purse to a target purse.", + "type": "string", + "enum": [ + "Transfer" + ] + }, + { + "description": "The `add_bid` native entry point, used to create or top off a bid purse.", + "type": "string", + "enum": [ + "AddBid" + ] + }, + { + "description": "The `withdraw_bid` native entry point, used to decrease a stake.", + "type": "string", + "enum": [ + "WithdrawBid" + ] + }, + { + "description": "The `delegate` native entry point, used to add a new delegator or increase an existing delegator's stake.", + "type": "string", + "enum": [ + "Delegate" + ] + }, + { + "description": "The `undelegate` native entry point, used to reduce a delegator's stake or remove the delegator if the remaining stake is 0.", + "type": "string", + "enum": [ + "Undelegate" + ] + }, + { + "description": "The `redelegate` native entry point, used to reduce a delegator's stake or remove the delegator if the remaining stake is 0, and after the unbonding delay, automatically delegate to a new validator.", + "type": "string", + "enum": [ + "Redelegate" + ] + }, + { + "description": "The `activate_bid` native entry point, used to used to reactivate an inactive bid.", + "type": "string", + "enum": [ + "ActivateBid" + ] + } + ] + }, + "TransactionScheduling": { + "description": "Scheduling mode of a Transaction.", + "oneOf": [ + { + "description": "No special scheduling applied.", + "type": "string", + "enum": [ + "Standard" + ] + }, + { + "description": "Execution should be scheduled for the specified era.", + "type": "object", + "required": [ + "FutureEra" + ], + "properties": { + "FutureEra": { + "$ref": "#/components/schemas/EraId" + } + }, + "additionalProperties": false + }, + { + "description": "Execution should be scheduled for the specified timestamp or later.", + "type": "object", + "required": [ + "FutureTimestamp" + ], + "properties": { + "FutureTimestamp": { + "$ref": "#/components/schemas/Timestamp" + } + }, + "additionalProperties": false + } + ] + } + } + } +} \ No newline at end of file diff --git a/rpc_sidecar/Cargo.toml b/rpc_sidecar/Cargo.toml index 01cbeb60..6ebf496a 100644 --- a/rpc_sidecar/Cargo.toml +++ b/rpc_sidecar/Cargo.toml @@ -41,6 +41,7 @@ tower = { version = "0.4.6", features = ["limit"] } tracing = { workspace = true, default-features = true } tracing-subscriber = { workspace = true, features = ["env-filter", "fmt", "json"] } warp = { version = "0.3.6", features = ["compression"] } +derive-new = "0.6.0" [dev-dependencies] assert-json-diff = "2" diff --git a/rpc_sidecar/src/http_server.rs b/rpc_sidecar/src/http_server.rs index a2d2af21..4ceb9ed2 100644 --- a/rpc_sidecar/src/http_server.rs +++ b/rpc_sidecar/src/http_server.rs @@ -17,7 +17,7 @@ use super::rpcs::{ chain::{ GetBlock, GetBlockTransfers, GetEraInfoBySwitchBlock, GetEraSummary, GetStateRootHash, }, - docs::ListRpcs, + docs::RpcDiscover, info::{GetChainspec, GetDeploy, GetValidatorChanges}, state::{ GetAccountInfo, GetAuctionInfo, GetBalance, GetDictionaryItem, GetItem, GetTrie, @@ -59,7 +59,7 @@ pub async fn run( GetAuctionInfo::register_as_handler(node.clone(), &mut handlers); GetTrie::register_as_handler(node.clone(), &mut handlers); GetValidatorChanges::register_as_handler(node.clone(), &mut handlers); - ListRpcs::register_as_handler(node.clone(), &mut handlers); + RpcDiscover::register_as_handler(node.clone(), &mut handlers); GetDictionaryItem::register_as_handler(node.clone(), &mut handlers); GetChainspec::register_as_handler(node.clone(), &mut handlers); QueryBalance::register_as_handler(node.clone(), &mut handlers); diff --git a/rpc_sidecar/src/lib.rs b/rpc_sidecar/src/lib.rs index 37dfa6cc..2359fb5e 100644 --- a/rpc_sidecar/src/lib.rs +++ b/rpc_sidecar/src/lib.rs @@ -126,6 +126,7 @@ mod tests { use crate::rpcs::docs::OPEN_RPC_SCHEMA; + use crate::rpcs::speculative_open_rpc_schema::SPECULATIVE_OPEN_RPC_SCHEMA; use crate::rpcs::{ docs::OpenRpcSchema, info::{GetChainspecResult, GetStatusResult, GetValidatorChangesResult}, @@ -133,43 +134,13 @@ mod tests { use schemars::schema_for; #[test] - fn json_schema_check() { - let schema_path = format!( - "{}/../resources/test/rpc_schema.json", - env!("CARGO_MANIFEST_DIR") - ); - assert_schema( - &schema_path, - &serde_json::to_string_pretty(&*OPEN_RPC_SCHEMA).unwrap(), - ); - - let schema = fs::read_to_string(&schema_path).unwrap(); + fn main_server_json_schema_check() { + json_schema_check("rpc_schema.json", &OPEN_RPC_SCHEMA); + } - // Check for the following pattern in the JSON as this points to a byte array or vec (e.g. - // a hash digest) not being represented as a hex-encoded string: - // - // ```json - // "type": "array", - // "items": { - // "type": "integer", - // "format": "uint8", - // "minimum": 0.0 - // }, - // ``` - // - // The type/variant in question (most easily identified from the git diff) might be easily - // fixed via application of a serde attribute, e.g. - // `#[serde(with = "serde_helpers::raw_32_byte_array")]`. It will likely require a - // schemars attribute too, indicating it is a hex-encoded string. See for example - // `TransactionInvocationTarget::Package::addr`. - let regex = Regex::new( - r#"\s*"type":\s*"array",\s*"items":\s*\{\s*"type":\s*"integer",\s*"format":\s*"uint8",\s*"minimum":\s*0\.0\s*\},"# - ).unwrap(); - assert!( - !regex.is_match(&schema), - "seems like a byte array is not hex-encoded - see comment in `json_schema_check` for \ - further info" - ); + #[test] + fn speculative_json_schema_check() { + json_schema_check("speculative_rpc_schema.json", &SPECULATIVE_OPEN_RPC_SCHEMA); } #[test] @@ -250,4 +221,44 @@ mod tests { ); assert_json_eq!(actual_schema, expected_schema); } + + fn json_schema_check(schema_filename: &str, rpc_schema: &OpenRpcSchema) { + let schema_path = format!( + "{}/../resources/test/{}", + env!("CARGO_MANIFEST_DIR"), + schema_filename, + ); + assert_schema( + &schema_path, + &serde_json::to_string_pretty(rpc_schema).unwrap(), + ); + + let schema = fs::read_to_string(&schema_path).unwrap(); + + // Check for the following pattern in the JSON as this points to a byte array or vec (e.g. + // a hash digest) not being represented as a hex-encoded string: + // + // ```json + // "type": "array", + // "items": { + // "type": "integer", + // "format": "uint8", + // "minimum": 0.0 + // }, + // ``` + // + // The type/variant in question (most easily identified from the git diff) might be easily + // fixed via application of a serde attribute, e.g. + // `#[serde(with = "serde_helpers::raw_32_byte_array")]`. It will likely require a + // schemars attribute too, indicating it is a hex-encoded string. See for example + // `TransactionInvocationTarget::Package::addr`. + let regex = Regex::new( + r#"\s*"type":\s*"array",\s*"items":\s*\{\s*"type":\s*"integer",\s*"format":\s*"uint8",\s*"minimum":\s*0\.0\s*\},"# + ).unwrap(); + assert!( + !regex.is_match(&schema), + "seems like a byte array is not hex-encoded - see comment in `json_schema_check` for \ + further info" + ); + } } diff --git a/rpc_sidecar/src/rpcs.rs b/rpc_sidecar/src/rpcs.rs index c9d54951..f4ab4143 100644 --- a/rpc_sidecar/src/rpcs.rs +++ b/rpc_sidecar/src/rpcs.rs @@ -10,6 +10,7 @@ mod error; mod error_code; pub mod info; pub mod speculative_exec; +pub mod speculative_open_rpc_schema; pub mod state; use std::{fmt, str, sync::Arc, time::Duration}; diff --git a/rpc_sidecar/src/rpcs/docs.rs b/rpc_sidecar/src/rpcs/docs.rs index 56bbf842..cb6bbb84 100644 --- a/rpc_sidecar/src/rpcs/docs.rs +++ b/rpc_sidecar/src/rpcs/docs.rs @@ -3,6 +3,7 @@ use std::sync::Arc; use async_trait::async_trait; +use derive_new::new; use once_cell::sync::Lazy; use schemars::{ gen::{SchemaGenerator, SchemaSettings}, @@ -29,40 +30,36 @@ use super::{ pub(crate) const DOCS_EXAMPLE_API_VERSION: ApiVersion = CURRENT_API_VERSION; const DEFINITIONS_PATH: &str = "#/components/schemas/"; +pub(crate) const OPEN_RPC_VERSION: &str = "1.0.0-rc1"; + +pub(crate) static CONTACT: Lazy = Lazy::new(|| OpenRpcContactField { + name: "Casper Labs".to_string(), + url: "https://casperlabs.io".to_string(), +}); + +pub(crate) static LICENSE: Lazy = Lazy::new(|| OpenRpcLicenseField { + name: "APACHE LICENSE, VERSION 2.0".to_string(), + url: "https://www.apache.org/licenses/LICENSE-2.0".to_string(), +}); + +static SERVER: Lazy = Lazy::new(|| { + OpenRpcServerEntry::new( + "any Sidecar with JSON RPC API enabled".to_string(), + "http://IP:PORT/rpc/".to_string(), + ) +}); // As per https://spec.open-rpc.org/#service-discovery-method. pub(crate) static OPEN_RPC_SCHEMA: Lazy = Lazy::new(|| { - let contact = OpenRpcContactField { - name: "Casper Labs".to_string(), - url: "https://casperlabs.io".to_string(), - }; - let license = OpenRpcLicenseField { - name: "APACHE LICENSE, VERSION 2.0".to_string(), - url: "https://www.apache.org/licenses/LICENSE-2.0".to_string(), - }; let info = OpenRpcInfoField { version: DOCS_EXAMPLE_API_VERSION.to_string(), title: "Client API of Casper Node".to_string(), description: "This describes the JSON-RPC 2.0 API of a node on the Casper network." .to_string(), - contact, - license, - }; - - let server = OpenRpcServerEntry { - name: "any Casper Network node".to_string(), - url: "http://IP:PORT/rpc/".to_string(), - }; - - let mut schema = OpenRpcSchema { - openrpc: "1.0.0-rc1".to_string(), - info, - servers: vec![server], - methods: vec![], - components: Components { - schemas: Map::new(), - }, + contact: CONTACT.clone(), + license: LICENSE.clone(), }; + let mut schema = OpenRpcSchema::new(OPEN_RPC_VERSION.to_string(), info, vec![SERVER.clone()]); schema.push_with_params::( "receives a Deploy to be executed by the network (DEPRECATED: use \ @@ -121,7 +118,7 @@ pub(crate) static OPEN_RPC_SCHEMA: Lazy = Lazy::new(|| { schema }); -static LIST_RPCS_RESULT: Lazy = Lazy::new(|| ListRpcsResult { +static LIST_RPCS_RESULT: Lazy = Lazy::new(|| RpcDiscoverResult { api_version: DOCS_EXAMPLE_API_VERSION, name: "OpenRPC Schema".to_string(), schema: OPEN_RPC_SCHEMA.clone(), @@ -145,6 +142,16 @@ pub struct OpenRpcSchema { } impl OpenRpcSchema { + pub fn new(openrpc: String, info: OpenRpcInfoField, servers: Vec) -> Self { + OpenRpcSchema { + openrpc, + info, + servers, + methods: vec![], + components: Components::default(), + } + } + fn new_generator() -> SchemaGenerator { let settings = SchemaSettings::default().with(|settings| { settings.definitions_path = DEFINITIONS_PATH.to_string(); @@ -152,7 +159,7 @@ impl OpenRpcSchema { settings.into_generator() } - fn push_with_params(&mut self, summary: &str) { + pub(crate) fn push_with_params(&mut self, summary: &str) { let mut generator = Self::new_generator(); let params_schema = T::RequestParams::json_schema(&mut generator); @@ -179,7 +186,7 @@ impl OpenRpcSchema { self.update_schemas::(); } - fn push_without_params(&mut self, summary: &str) { + pub(crate) fn push_without_params(&mut self, summary: &str) { let mut generator = Self::new_generator(); let result_schema = T::ResponseResult::json_schema(&mut generator); @@ -306,8 +313,8 @@ impl OpenRpcSchema { } } -#[derive(Clone, PartialEq, Serialize, Deserialize, Debug, JsonSchema)] -struct OpenRpcInfoField { +#[derive(Clone, PartialEq, Serialize, Deserialize, Debug, JsonSchema, new)] +pub(crate) struct OpenRpcInfoField { version: String, title: String, description: String, @@ -316,26 +323,26 @@ struct OpenRpcInfoField { } #[derive(Clone, PartialEq, Serialize, Deserialize, Debug, JsonSchema)] -struct OpenRpcContactField { +pub(crate) struct OpenRpcContactField { name: String, url: String, } #[derive(Clone, PartialEq, Serialize, Deserialize, Debug, JsonSchema)] -struct OpenRpcLicenseField { +pub(crate) struct OpenRpcLicenseField { name: String, url: String, } -#[derive(Clone, PartialEq, Serialize, Deserialize, Debug, JsonSchema)] -struct OpenRpcServerEntry { +#[derive(Clone, PartialEq, Serialize, Deserialize, Debug, JsonSchema, new)] +pub(crate) struct OpenRpcServerEntry { name: String, url: String, } /// The struct containing the documentation for the RPCs. #[derive(Clone, PartialEq, Serialize, Deserialize, Debug, JsonSchema)] -pub struct Method { +struct Method { name: String, summary: String, params: Vec, @@ -423,8 +430,8 @@ struct ExampleResult { value: Value, } -#[derive(Clone, PartialEq, Serialize, Deserialize, Debug, JsonSchema)] -struct Components { +#[derive(Clone, PartialEq, Serialize, Deserialize, Debug, JsonSchema, Default)] +pub struct Components { schemas: Map, } @@ -433,7 +440,7 @@ struct Components { // Fields named as per https://spec.open-rpc.org/#service-discovery-method. #[derive(Clone, PartialEq, Serialize, Deserialize, JsonSchema, Debug)] #[serde(deny_unknown_fields)] -pub struct ListRpcsResult { +pub struct RpcDiscoverResult { /// The RPC API version. #[schemars(with = "String")] api_version: ApiVersion, @@ -443,7 +450,7 @@ pub struct ListRpcsResult { schema: OpenRpcSchema, } -impl DocExample for ListRpcsResult { +impl DocExample for RpcDiscoverResult { fn doc_example() -> &'static Self { &LIST_RPCS_RESULT } @@ -451,18 +458,18 @@ impl DocExample for ListRpcsResult { /// "rpc.discover" RPC. #[derive(Clone, PartialEq, Eq, Serialize, Deserialize, Debug)] -pub struct ListRpcs {} +pub struct RpcDiscover {} #[async_trait] -impl RpcWithoutParams for ListRpcs { +impl RpcWithoutParams for RpcDiscover { // Named as per https://spec.open-rpc.org/#service-discovery-method. const METHOD: &'static str = "rpc.discover"; - type ResponseResult = ListRpcsResult; + type ResponseResult = RpcDiscoverResult; async fn do_handle_request( _node_client: Arc, ) -> Result { - Ok(ListRpcsResult::doc_example().clone()) + Ok(RpcDiscoverResult::doc_example().clone()) } } @@ -544,21 +551,7 @@ mod tests { contact, license, }; - - let server = OpenRpcServerEntry { - name: "any Casper Network node".to_string(), - url: "http://IP:PORT/rpc/".to_string(), - }; - - let schema = OpenRpcSchema { - openrpc: "1.0.0-rc1".to_string(), - info, - servers: vec![server], - methods: vec![], - components: Components { - schemas: Map::new(), - }, - }; + let schema = OpenRpcSchema::new("1.0.0-rc1".to_string(), info, vec![SERVER.clone()]); let params = schema.give_params_schema::(); let schema_object = params.into_object().object.expect("should be object"); schema_object diff --git a/rpc_sidecar/src/rpcs/speculative_exec.rs b/rpc_sidecar/src/rpcs/speculative_exec.rs index 7df8935a..f2ecddda 100644 --- a/rpc_sidecar/src/rpcs/speculative_exec.rs +++ b/rpc_sidecar/src/rpcs/speculative_exec.rs @@ -11,8 +11,9 @@ use serde::{Deserialize, Serialize}; use casper_types::{Deploy, Transaction}; use super::{ - docs::{DocExample, DOCS_EXAMPLE_API_VERSION}, - ApiVersion, Error, NodeClient, RpcError, RpcWithParams, CURRENT_API_VERSION, + docs::{DocExample, OpenRpcSchema, DOCS_EXAMPLE_API_VERSION}, + speculative_open_rpc_schema::SPECULATIVE_OPEN_RPC_SCHEMA, + ApiVersion, Error, NodeClient, RpcError, RpcWithParams, RpcWithoutParams, CURRENT_API_VERSION, }; static SPECULATIVE_EXEC_TXN_PARAMS: Lazy = @@ -122,6 +123,47 @@ async fn handle_request( }) } +#[derive(Clone, PartialEq, Serialize, Deserialize, JsonSchema, Debug)] +#[serde(deny_unknown_fields)] +pub struct SpeculativeRpcDiscoverResult { + /// The RPC API version. + #[schemars(with = "String")] + api_version: ApiVersion, + name: String, + /// The list of supported RPCs. + #[schemars(skip)] + schema: OpenRpcSchema, +} + +static SPECULATIVE_DISCOVER_RPC_RESULT: Lazy = + Lazy::new(|| SpeculativeRpcDiscoverResult { + api_version: DOCS_EXAMPLE_API_VERSION, + name: "OpenRPC Schema for speculative exectution server".to_string(), + schema: SPECULATIVE_OPEN_RPC_SCHEMA.clone(), + }); + +impl DocExample for SpeculativeRpcDiscoverResult { + fn doc_example() -> &'static Self { + &SPECULATIVE_DISCOVER_RPC_RESULT + } +} + +/// "rpc.discover" RPC. +#[derive(Clone, PartialEq, Eq, Serialize, Deserialize, Debug)] +pub struct SpeculativeRpcDiscover {} + +#[async_trait] +impl RpcWithoutParams for SpeculativeRpcDiscover { + const METHOD: &'static str = "rpc.discover"; + type ResponseResult = SpeculativeRpcDiscoverResult; + + async fn do_handle_request( + _node_client: Arc, + ) -> Result { + Ok(SpeculativeRpcDiscoverResult::doc_example().clone()) + } +} + #[cfg(test)] mod tests { use std::convert::TryFrom; diff --git a/rpc_sidecar/src/rpcs/speculative_open_rpc_schema.rs b/rpc_sidecar/src/rpcs/speculative_open_rpc_schema.rs new file mode 100644 index 00000000..8ee4afc1 --- /dev/null +++ b/rpc_sidecar/src/rpcs/speculative_open_rpc_schema.rs @@ -0,0 +1,37 @@ +use once_cell::sync::Lazy; + +use super::{ + docs::{ + OpenRpcInfoField, OpenRpcSchema, OpenRpcServerEntry, CONTACT, DOCS_EXAMPLE_API_VERSION, + LICENSE, OPEN_RPC_VERSION, + }, + speculative_exec::{SpeculativeExec, SpeculativeExecTxn}, +}; + +pub(crate) static SERVER: Lazy = Lazy::new(|| { + OpenRpcServerEntry::new( + "any Sidecar with speculative JSON RPC API enabled".to_string(), + "http://IP:PORT/rpc/".to_string(), + ) +}); + +pub(crate) static SPECULATIVE_OPEN_RPC_SCHEMA: Lazy = Lazy::new(|| { + let info = OpenRpcInfoField::new( + DOCS_EXAMPLE_API_VERSION.to_string(), + "Speculative execution client API of Casper Node".to_string(), + "This describes the JSON-RPC 2.0 API of the speculative execution functinality of a node on the Casper network." + .to_string(), + CONTACT.clone(), + LICENSE.clone(), + ); + let mut schema = OpenRpcSchema::new(OPEN_RPC_VERSION.to_string(), info, vec![SERVER.clone()]); + schema.push_with_params::( + "receives a Deploy to be executed by the network (DEPRECATED: use \ + `account_put_transaction` instead)", + ); + schema.push_with_params::( + "receives a Deploy to be executed by the network (DEPRECATED: use \ + `account_put_transaction` instead)", + ); + schema +}); diff --git a/rpc_sidecar/src/speculative_exec_server.rs b/rpc_sidecar/src/speculative_exec_server.rs index 5dfde0fc..10ea3bfe 100644 --- a/rpc_sidecar/src/speculative_exec_server.rs +++ b/rpc_sidecar/src/speculative_exec_server.rs @@ -7,8 +7,8 @@ use casper_json_rpc::{CorsOrigin, RequestHandlersBuilder}; use crate::{ node_client::NodeClient, rpcs::{ - speculative_exec::{SpeculativeExec, SpeculativeExecTxn}, - RpcWithParams, + speculative_exec::{SpeculativeExec, SpeculativeExecTxn, SpeculativeRpcDiscover}, + RpcWithParams, RpcWithoutParams, }, }; @@ -27,7 +27,8 @@ pub async fn run( ) { let mut handlers = RequestHandlersBuilder::new(); SpeculativeExecTxn::register_as_handler(node.clone(), &mut handlers); - SpeculativeExec::register_as_handler(node, &mut handlers); + SpeculativeExec::register_as_handler(node.clone(), &mut handlers); + SpeculativeRpcDiscover::register_as_handler(node, &mut handlers); let handlers = handlers.build(); match cors_origin.as_str() { diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 140037d9..38c87b26 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,5 +1,5 @@ [toolchain] -channel = "1.75.0" +channel = "1.77.2" components = [ "rustfmt", "clippy" ] targets = [ "wasm32-unknown-unknown" ] profile = "minimal" \ No newline at end of file