Skip to content

Commit

Permalink
Merge pull request #555 from multiversx/document-new-field-from-es-da…
Browse files Browse the repository at this point in the history
…tabase

Document new field from the es database
  • Loading branch information
miiu96 committed Jul 4, 2023
2 parents 8075f26 + a295ca3 commit 36a261b
Show file tree
Hide file tree
Showing 11 changed files with 118 additions and 70 deletions.
4 changes: 2 additions & 2 deletions docs/developers/tutorials/staking-contract.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,6 @@ Every smart contract needs to have a function annotated with `#[init]`. This fun

[comment]: # (mx-context-auto)


### Creating a devnet wallet

:::note
Expand Down Expand Up @@ -248,7 +247,6 @@ Now that we've created a wallet, it's time to deploy our contract. **Make sure y

```bash


mxpy --verbose contract deploy --bytecode=~/Projects/tutorials/staking-contract/output/staking-contract.wasm \
--recall-nonce --pem=~/Downloads/tutorialKey.pem \
--gas-limit=10000000 \
Expand All @@ -264,6 +262,8 @@ More details can be found [here](/developers/constants/).

The things you need to edit are the CLI parameters --pem and --project with your local paths.

[comment]: # (mx-context-auto)

### Account was not found? But I just created the wallet!

You're going to see an error like the following:
Expand Down
4 changes: 3 additions & 1 deletion docs/sdk-and-tools/elastic-search-wrong-mappings-fix.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ for an index, then one should follow the next steps:

In the example below we will repair the `operations` index.

[comment]: # (mx-context-auto)

## Solution 1

1. Stop the observers nodes that index data in the Elasticsearch cluster.
Expand Down Expand Up @@ -64,14 +66,14 @@ In the example below we will repair the `operations` index.

4. Start again the observers.

[comment]: # (mx-context-auto)

## Solution 2
:::caution
This solution will take more time because all the documents from the index with problems
have to be reindexed from a public cluster.
:::


1. Stop the observers nodes that index data in the Elasticsearch cluster.
2. Delete affected index: `operations`
3. Create the index again with the correct mappings:
Expand Down
36 changes: 28 additions & 8 deletions docs/sdk-and-tools/indices/accounts.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,17 @@ The `_id` field of this index is represented by a bech32 encoded address.

## Fields

| Field | Description |
|------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| address | The address field holds the address in a bech32 encoding. Should be equal to the _id field. |
| balance | The balance field holds the amount of EGLD the address possesses. It is a string that also includes the number of decimals. Example: "1500000000000000000" (equivalent to 1.5 EGLD). |
| balanceNum | The balanceNum field holds the amount of EGLD the address possesses, in a numeric format. Example: 1.5. |
| nonce | The nonce field represents the sequence number of the address. |
| shardID | The shardID field represents the shard where the address belongs to, based on its bytes. |
| timestamp | The timestamp field represents the last moment when the address balance was changed. |
| Field | Description |
|------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| address | The address field holds the address in a bech32 encoding. Should be equal to the _id field. |
| balance | The balance field holds the amount of EGLD the address possesses. It is a string that also includes the number of decimals. Example: "1500000000000000000" (equivalent to 1.5 EGLD). |
| balanceNum | The balanceNum field holds the amount of EGLD the address possesses, in a numeric format. Example: 1.5. |
| nonce | The nonce field represents the sequence number of the address. |
| shardID | The shardID field represents the shard where the address belongs to, based on its bytes. |
| timestamp | The timestamp field represents the last moment when the address balance was changed. |
| developerRewards | The developerRewards represents the fees that were accumulated after all the smart contract calls. They can be claimed by the owner. |
| currentOwner | The currentOwner field holds the address in a bech32 format of the current owner of the smart contract. This field is populated only for the smart contract addresses. |
| userName | The userName field contains the herotag the address possesses. |

[comment]: # (mx-context-auto)

Expand Down Expand Up @@ -74,3 +77,20 @@ curl --request GET \
"size":10
}'
```

[comment]: # (mx-context-auto)

### Fetch addresses with username

```
curl --request GET \
--url ${ES_URL}/accounts/_search \
--header 'Content-Type: application/json' \
--data '{
"query": {
"exists": {
"field": "userName"
}
}
}'
```
23 changes: 12 additions & 11 deletions docs/sdk-and-tools/indices/accountsesdt.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,18 @@ The `_id` field of this index is composed in this way: `{bech32address}_{tokenId

## Fields

| Field | Description |
|-------------|---------------------------------------------------------------------------------------------------------------------------------------|
| identifier | The identifier field consists of `token` field and the `nonce` field hex encoded (example: `TOKEN-01abdc-01`). |
| address | The address field holds the address in a bech32 encoding. |
| balance | The balance field holds the amount of ESDT token the address possesses. It includes the number of decimals. |
| balanceNum | The balanceNum field holds the amount of ESDT tokens the address possesses, in a numeric format. |
| data | The data field is a structure that contains extra data about a token, such as the creator of an NFT. |
| tokenNonce | The tokenNonce field holds the sequence number of the token. This field is empty in the case of `FungibleESDT`. |
| token | The token field holds the name of the token. |
| timestamp | The timestamp field represents the timestamp when the address balance was changed. |
| type | The type field represents the type of the ESDT token. It can be `FungibleESDT`, `NonFungibleESDT`, `SemiFungibleESDT`, or `MetaESDT`. |
| Field | Description |
|------------|---------------------------------------------------------------------------------------------------------------------------------------|
| identifier | The identifier field consists of `token` field and the `nonce` field hex encoded (example: `TOKEN-01abdc-01`). |
| address | The address field holds the address in a bech32 encoding. |
| balance | The balance field holds the amount of ESDT token the address possesses. It includes the number of decimals. |
| balanceNum | The balanceNum field holds the amount of ESDT tokens the address possesses, in a numeric format. |
| data | The data field is a structure that contains extra data about a token, such as the creator of an NFT. |
| tokenNonce | The tokenNonce field holds the sequence number of the token. This field is empty in the case of `FungibleESDT`. |
| token | The token field holds the name of the token. |
| timestamp | The timestamp field represents the timestamp when the address balance was changed. |
| type | The type field represents the type of the ESDT token. It can be `FungibleESDT`, `NonFungibleESDT`, `SemiFungibleESDT`, or `MetaESDT`. |
| frozen | The frozen field is set to true when the address possesses a current ESDT token that is in a frozen state. |

Docs with a non-empty `tokenNonce` field will have the `data` field populated with the following structure:

Expand Down
18 changes: 10 additions & 8 deletions docs/sdk-and-tools/indices/accountsesdthistory.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,16 @@ The `_id` field of this index is composed in this way: `{bech32address}_{tokenId

## Fields

| Field | Description |
|------------|---------------------------------------------------------------------------------------------------------------------|
| address | The address field holds the address in a bech32 encoding. |
| balance | The balance field holds the amount of ESDT tokens the address possesses. |
| token | The token field holds the token name of the token. |
| identifier | The identifier field is composed of the `token` field and the `nonce` field, hex encoded. |
| tokenNonce | The tokenNonce field holds the sequence number of the token. This field can be empty in the case of `FungibleESDT`. |
| timestamp | The timestamp field represents the timestamp when the address balance was changed. |
| Field | Description |
|-----------------|---------------------------------------------------------------------------------------------------------------------|
| address | The address field holds the address in a bech32 encoding. |
| balance | The balance field holds the amount of ESDT tokens the address possesses. |
| token | The token field holds the token name of the token. |
| identifier | The identifier field is composed of the `token` field and the `nonce` field, hex encoded. |
| tokenNonce | The tokenNonce field holds the sequence number of the token. This field can be empty in the case of `FungibleESDT`. |
| timestamp | The timestamp field represents the timestamp when the address balance was changed. |
| isSmartContract | The isSmartContract field is true if the address is a smart contract address. |
| shardID | The shardID field represents the shard where the address belongs to, based on its bytes. |

[comment]: # (mx-context-auto)

Expand Down
14 changes: 8 additions & 6 deletions docs/sdk-and-tools/indices/accountshistory.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@ The `_id` field of this index is composed in this way: `{bech32address}_{timesta

## Fields

| Field | Description |
|-----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| address | The address field holds the address in a bech32 encoding. |
| balance | The balance field holds the amount of EGLD the address possesses. It is a string that also includes the number of decimals. Example: "1500000000000000000" (equivalent to 1.5 EGLD). |
| isSender | The isSender field is true if the address was the sender when the balance has changed. |
| timestamp | The timestamp field represents the timestamp when the address balance was changed. |
| Field | Description |
|------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| address | The address field holds the address in a bech32 encoding. |
| balance | The balance field holds the amount of EGLD the address possesses. It is a string that also includes the number of decimals. Example: "1500000000000000000" (equivalent to 1.5 EGLD). |
| isSender | The isSender field is true if the address was the sender when the balance has changed. |
| timestamp | The timestamp field represents the timestamp when the address balance was changed. |
| isSmartContract | The isSmartContract field is true if the address is a smart contract address. |
| shardID | The shardID field represents the shard where the address belongs to, based on its bytes. |

[comment]: # (mx-context-auto)

Expand Down
10 changes: 10 additions & 0 deletions docs/sdk-and-tools/indices/delegators.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@ The `_id` field of this index is composed in this way: `blake2bHash(delegatorAdd
| contract | This field holds the bech32 encoded address of the staking provider contract to whom it was delegated to. |
| activeStake | The activeStake field holds the EGLD amount of the active stake (not undelegated nor unbondable). |
| activeStakeNum | The activeStake field holds the EGLD amount of the active stake (not undelegated nor unbondable), in a numeric format. Example: 1.5. |
| unDelegateInfo | The unDelegateInfo contains a list with data about the unDelegated values. |
| timestamp | The timestamp field represents the last moment of an interaction with the delegation contract. |

The `unDelegateInfo` field is populated with the fields below:

| unDelegateInfo fields | Description |
|-----------------------|-------------------------------------------------------------------------------------------------|
| value | The value field holds the EGLD amount that was undelegated. |
| valueNum | The value field holds the EGLD amount that was undelegated, in a numeric format (example: 1.5). |
| timestamp | The timestamp field represents the timestamp when the unDelegation operation was done. |

[comment]: # (mx-context-auto)

Expand Down
1 change: 1 addition & 0 deletions docs/sdk-and-tools/indices/scresults.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ The `_id` field for this index is composed of hex encoded smart contract result
| operation | The operation field represents the operation of the smart contract result based on the data field. |
| function | The function field holds the name of the function that is called in case of a smart contract call. |
| originalSender | The originalSender field holds the sender's address of the original transaction. |
| hasLogs | The hasLogs field is true if the transaction has logs. |

[comment]: # (mx-context-auto)

Expand Down
1 change: 1 addition & 0 deletions docs/sdk-and-tools/indices/tokens.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ The `_id` field of this index is represented by token identifier of an ESDT toke
| type | The type field holds the type of the token. It can be `FungibleESDT`, `NonFungibleESDT`, `SemiFungibleESDT`, or `MetaESDT`. |
| timestamp | The timestamp field represents the timestamp of the block in which the token was created. |
| ownersHistory | The ownersHistory field holds a list of all the owners of a token. |
| paused | The paused field is true if the token is paused. |

[comment]: # (mx-context-auto)

Expand Down
Loading

0 comments on commit 36a261b

Please sign in to comment.