Skip to content

Commit

Permalink
Merge pull request #1422 from ACStoneCL/Update_JSON-RPC
Browse files Browse the repository at this point in the history
Updating JSON-RPC Docs
  • Loading branch information
ACStone-MTS authored Apr 1, 2024
2 parents c2e26c8 + 756e103 commit e99f14a
Show file tree
Hide file tree
Showing 4 changed files with 176 additions and 63 deletions.
90 changes: 47 additions & 43 deletions source/docs/casper/developers/json-rpc/json-rpc-informational.md
Original file line number Diff line number Diff line change
Expand Up @@ -1169,6 +1169,7 @@ This method returns the current status of a node.
|chainspec_name|String|The chainspec name, used to identify the currently connected network.|
|[last_added_block_info](types_chain.md#minimalblockinfo)|Object|The minimal info of the last Block from the linear chain.|
|[last_progress](types_chain.md#timestamp)|String|Timestamp of the last recorded progress in the reactor.|
|[latest_switch_block_hash](types_chain.md#blockhash)|Object|The hash of the latest switch block.|
|[next_upgrade](types_chain.md#nextupgrade)|Object|Information about the next scheduled upgrade.|
|[our_public_signing_key](types_chain.md#publickey)|String|Our public signing key.|
|[peers](types_chain.md#peersmap)|Array|The node ID and network address of each connected peer.|
Expand All @@ -1187,49 +1188,52 @@ This method returns the current status of a node.
"id": 1,
"jsonrpc": "2.0",
"result": {
"name": "info_get_status_result",
"value": {
"peers": [
{
"node_id": "tls:0101..0101",
"address": "127.0.0.1:54321"
}
],
"api_version": "1.4.8",
"build_version": "1.0.0-xxxxxxxxx@DEBUG",
"chainspec_name": "casper-example",
"starting_state_root_hash": null,
"last_added_block_info": {
"hash": "13c2d7a68ecdd4b74bf4393c88915c836c863fc4bf11d7f2bd930a1bbccacdcb",
"timestamp": "2020-11-17T00:39:24.072Z",
"era_id": 1,
"height": 10,
"state_root_hash": "0808080808080808080808080808080808080808080808080808080808080808",
"creator": "01d9bf2148748a85c89da5aad8ee0b0fc2d105fd39d41a4c796536354f0ae2900c"
},
"our_public_signing_key": "01d9bf2148748a85c89da5aad8ee0b0fc2d105fd39d41a4c796536354f0ae2900c",
"round_length": "1m 5s 536ms",
"next_upgrade": {
"activation_point": 42,
"protocol_version": "2.0.1"
},
"uptime": "13s",
"reactor_state": "Initialize",
"last_progress": "1970-01-01T00:00:00.000Z",
"available_block_range": {
"low": 0,
"high": 0
},
"block_sync": {
"historical": {
"block_hash": "16ddf28e2b3d2e17f4cef36f8b58827eca917af225d139b0c77df3b4a67dc55e",
"block_height": 40,
"acquisition_state": "have strict finality(40) for: block hash 16dd..c55e"
},
"forward": {
"block_hash": "59907b1e32a9158169c4d89d9ce5ac9164fc31240bfcfb0969227ece06d74983",
"block_height": 6701,
"acquisition_state": "have block body(6701) for: block hash 5990..4983"
"name": "info_get_status_example_result",
"value": {
"api_version": "2.0.0",
"peers": [
{
"node_id": "tls:0101..0101",
"address": "127.0.0.1:54321"
}
],
"build_version": "1.0.0-xxxxxxxxx@DEBUG",
"chainspec_name": "casper-example",
"starting_state_root_hash": "0000000000000000000000000000000000000000000000000000000000000000",
"last_added_block_info": {
"hash": "6a2dad7a71608f78e9b6b5f97eed60a374e75e70cb8cc925e6681c61c84165bd",
"timestamp": "2020-11-17T00:39:24.072Z",
"era_id": 1,
"height": 10,
"state_root_hash": "0808080808080808080808080808080808080808080808080808080808080808",
"creator": "01d9bf2148748a85c89da5aad8ee0b0fc2d105fd39d41a4c796536354f0ae2900c"
},
"our_public_signing_key": "01d9bf2148748a85c89da5aad8ee0b0fc2d105fd39d41a4c796536354f0ae2900c",
"round_length": "1m 5s 536ms",
"next_upgrade": {
"activation_point": 42,
"protocol_version": "2.0.1"
},
"uptime": "13s",
"reactor_state": "Initialize",
"last_progress": "1970-01-01T00:00:00.000Z",
"available_block_range": {
"low": 0,
"high": 0
},
"block_sync": {
"historical": {
"block_hash": "16ddf28e2b3d2e17f4cef36f8b58827eca917af225d139b0c77df3b4a67dc55e",
"block_height": 40,
"acquisition_state": "have strict finality(40) for: block hash 16dd..c55e"
},
"forward": {
"block_hash": "59907b1e32a9158169c4d89d9ce5ac9164fc31240bfcfb0969227ece06d74983",
"block_height": 6701,
"acquisition_state": "have block body(6701) for: block hash 5990..4983"
}
},
"latest_switch_block_hash": "0000000000000000000000000000000000000000000000000000000000000000"
}
}
}
Expand Down
143 changes: 126 additions & 17 deletions source/docs/casper/developers/json-rpc/types_chain.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,17 +226,18 @@ The body portion of a block.

Required Parameters:

* [`auction`](#transactionhash) The hashes of the auction transactions within the block.

* [`install_upgrade`](#transactionhash) The hashes of the installer/upgrader transactions within the block.

* [`mint`](#transactionhash) The hashes of the mint transactions within the block.

* [`proposer`](#publickey)

* [`rewarded_signatures`](#rewardedsignatures)

* [`staking`](#transactionhash) The hashes for non-transfer, native transactions within the block.

* [`standard`](#transactionhash) The hashes of all other transactions within the block.

* [`transfer`](#transactionhash) The hashes of the transfer transactions within the block.

## BlockHash {#blockhash}

Expand Down Expand Up @@ -404,6 +405,22 @@ One of:

* `V1CasperWasm` Byte code to be executed with the version 1 Casper execution engine.

## BytesreprError {#bytesreprerror}

Serialization and deserialization errors.

* `EarlyEndOfStream` Early end of stream while deserializing.

* `Formatting` Formatting error while deserializing.

* `LeftOverBytes` Not all input bytes were consumed.

* `OutOfMemory` Out of memory error.

* `NotRepresentable` No serialized representation is available for a value.

* `ExceededRecursionDepth` Exceeded a recursion depth limit.

## ChainspecRawBytes {#chainspecrawbytes}

The raw bytes of the chainspec.toml, genesis accounts.toml, and global_state.toml files.
Expand Down Expand Up @@ -622,6 +639,18 @@ Required Parameters:

A log of all [transforms](#tranform) produced during execution.

## EntityIdentifier {#entityidentifier}

Identifier of an addressable entity.

* [`PublicKey`](#publickey)

* [`AccountHash`](#accounthash)

* [`EntityHashForAccount`](#addressableentityhash)

* [`EntityHashForContract`](#addressableentityhash)

## EntityKind {#entitykind}

The type of [`Package`](#package).
Expand All @@ -634,6 +663,16 @@ One of:

* `SmartContract` Packages associated with Wasm stored on chain.

## EntityOrAccount {#entity-or-account}

An addressable entity or a legacy account.

One of:

* [`AddressableEntity`](#addressablentity)

* [`Account`](#account)

## EntityVersionAndHash {#entityversionandhash}

An entity version associated with the given hash.
Expand Down Expand Up @@ -1214,6 +1253,14 @@ Required Parameters:

A [collection of named keys](#array-of-namedkey).

## NamedKeyValue {#namedkeyvalue}

A `NamedKey` value.

* `name` The name of the `Key` encoded as a `CLValue`.

* `named_key` The actual `Key` encoded as a `CLValue`.

## NamedUserGroup {#namedusergroup}

A named [`group`](#group).
Expand Down Expand Up @@ -1318,6 +1365,10 @@ One of:

* `Unlocked` The package is unlocked and can be versioned.

## Peer {#peers}

Map of peer IDs to network addresses.

## PeerEntry {#peerentry}

Required Parameters:
Expand All @@ -1326,21 +1377,17 @@ Required Parameters:

* `node_id`

## PeersMap {#peersmap}

Map of peer IDs to network addresses.

## PricingMode {#pricingmode}

The pricing mode of a transaction.

One of:

* `GasPriceMultiplier` Multiplies the gas used by the given amount.
* `Classic` The original payment model, where the creator of the transaction specifies how much they will pay, at what gas price.

* `Fixed` First-in-first-out handling of transactions.
* `Fixed` The cost of the transaction is determined by the cost table, per the transaction kind.

* `Reserved` The payment for this transaction was previously reserved.
* `Reserved` The payment for this transaction was previously reserved (Not currently implemented).

## ProtocolVersion {#protocolversion}

Expand Down Expand Up @@ -1482,6 +1529,8 @@ Representation of a value stored in global state.

* [`Message`](#messagechecksum) A variant that stores a message digest.

* [`NamedKey`](#namedkey) A NamedKey record.

## SystemEntityType {#systementitytype}

System contract types.
Expand Down Expand Up @@ -1734,9 +1783,41 @@ Additional Parameters:

Hex-encoded transfer address.

## Transform {#transform}
## TransformError {#transformerror}

Error type for applying and combining transforms. A `TypeMismatch` occurs when a transform cannot be applied because the types are not compatible (e.g. trying to add a number to a string).

One of:

* [`serialization`](#bytesreprerror)

* [`typemismatch`](#typemismatch)

* `deprecated` Type no longer supported.

## TransformV1 {#transformv1}

The actual transformation performed while executing a Deploy.
A transformation performed while executing a Deploy.

Required Parameters:

* `key` The formatted string of the `Key`.

* [`transforms`](#transformkindv1) The transformation.

## Transformv2 {#transformv2}

A transformation performed while executing a Deploy.

Required Parameters:

* `key` The formatted string of the `Key`.

* [`kind`](#transformkindv2) The transformation.

## TransformKindV1 {#transformkindv1}

The actual transformation performed while executing a Deploy in version 1.

One of:

Expand Down Expand Up @@ -1784,15 +1865,39 @@ One of:

* `Failure` A failed transformation, containing an error message.

## TransformEntry {#transformentry}
## TransformKindV1 {#transformkindv1}

A transformation performed while executing a Deploy.
The actual transformation performed while executing a Deploy in version 2.

Required Parameters:
One of:

* `key` The formatted string of the `Key`.
* `Identity` A transform having no effect.

* [`transforms`](#transform) The transformation.
* `Write` Writes the new value in global state.

* `AddInt32` Adds the given `i32`.

* `AddUInt64` Adds the given `u64`.

* `AddUInt128` Adds the given [`U128`](#u128).

* `AddUInt256` Adds the given [`U256`](#u256).

* `AddUInt512` Adds the given [`U512`](#u512).

* `AddKeys` Adds the given collection of [named keys](#namedkey).

* `Prune` 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 states.

* `Failure` A failed transformation, containing an error message.

## TypeMismatch {#typemismatch}

An error struct representing a type mismatch in [`StoredValue`](#storedvalue) operations.

* `expected` The name of the expected type.

* `found` The actual type found.

## U128 {#u128}

Expand Down Expand Up @@ -1870,6 +1975,10 @@ Required Parameters:

Vesting schedule for a genesis validator.

* `initial_release_timestamp_millies` Timestamp of the initial release.

* [`locked_amounts`](#u512) The amount of locked motes.

## Weight {#weight}

The weight associated with public keys in an account's associated keys.
Expand Down
2 changes: 1 addition & 1 deletion source/docs/casper/resources/tokens/cep78/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ folder within the project folder.

### Upgrading to Version 1.1.1

Upgrade to v1.1.1 using a [Standard NamedKey Convention](https://github.com/casper-ecosystem/cep-78-enhanced-nft/blob/dev/tutorials/standard-migration-tutorial.md) or a [Custom NamedKey Convention](https://github.com/casper-ecosystem/cep-78-enhanced-nft/blob/dev/tutorials/custom-migration-tutorial.md).
Upgrade to v1.1.1 using a [Standard NamedKey Convention](https://github.com/casper-ecosystem/cep-78-enhanced-nft/blob/dev/docs/tutorials/standard-migration-tutorial.md) or a [Custom NamedKey Convention](https://github.com/casper-ecosystem/cep-78-enhanced-nft/blob/dev/docs/tutorials/custom-migration-tutorial.md).

## Installing and Interacting with the Contract using the Rust Casper Client

Expand Down
4 changes: 2 additions & 2 deletions source/docs/casper/resources/tokens/cep78/reverse-lookup.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ slug: /resources/tokens/cep78/reverse-lookup

# Owner Reverse Lookup Functionality

In version 1.0 of the CEP-78 Enhanced NFT Standard contract, tracking minted tokens consisted of a single, unbounded list that would grow in size with each additional token. As a result, gas costs would increase over time as the list must be overwritten with each new minting. The related tutorial can be found [here](https://github.com/casper-ecosystem/cep-78-enhanced-nft/blob/dev/tutorials/token-ownership-tutorial.md).
In version 1.0 of the CEP-78 Enhanced NFT Standard contract, tracking minted tokens consisted of a single, unbounded list that would grow in size with each additional token. As a result, gas costs would increase over time as the list must be overwritten with each new minting. The related tutorial can be found [here](https://github.com/casper-ecosystem/cep-78-enhanced-nft/blob/dev/docs/tutorials/token-ownership-tutorial.md).

In an effort to stabilize the gas costs of larger NFT collections, version 1.1 of CEP-78 includes the use of a pre-allocated page system to track ownership of NFTs within the contract.

Expand Down Expand Up @@ -50,4 +50,4 @@ You can determine the token number by multiplying the `page_number` by the `page

If the `NFTIdentifierMode` is set to `Ordinal`, this number corresponds directly to the token ID.

If it is set to `Hash`, you will need to reference the `HASH_BY_INDEX` dictionary to determine the mapping of token numbers to token hashes.
If it is set to `Hash`, you will need to reference the `HASH_BY_INDEX` dictionary to determine the mapping of token numbers to token hashes.

0 comments on commit e99f14a

Please sign in to comment.