Skip to content

Commit

Permalink
Merge pull request #652 from multiversx/merge-dev-in-main
Browse files Browse the repository at this point in the history
Merge dev in main
  • Loading branch information
miiu96 committed Jul 4, 2023
2 parents bebc004 + 78f8d43 commit 8c898a0
Show file tree
Hide file tree
Showing 11 changed files with 177 additions and 71 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
64 changes: 62 additions & 2 deletions docs/sdk-and-tools/elastic-search-wrong-mappings-fix.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,76 @@ 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.
2. Force a `rollover` for the index with problems in this case `operations` index and the rollover have to contain the correct
mappings.
```
curl --request POST \
--url ${ES_CLUSTER_URL}/operations/_rollover \
--header 'Content-Type: application/json' \
--data '{
"mappings": {
"properties": {
"esdtValuesNum": {
"type": "double"
},
{ADD_THE_REST_OF_THE_MAPPINGS_OF_THE_INDEX}:{},
}
},
"settings": {
"index": {
"sort.field": [
"timestamp",
"nonce"
],
"sort.order": [
"desc",
"desc"
]
},
"number_of_replicas": 0,
"number_of_shards": 5
}
}'
```
3. Make alias `operations` to fetch data from both indices("operations-000001" and "operations-000002").

```
curl --request POST \
--url ${ES_CLUSTER_URL}/_aliases \
--header 'Content-Type: application/json' \
--data '{
"actions" : [
{ "add" : { "index" : "operations-000001", "alias" : "operations" } },
{ "add" : { "index" : "operations-000002", "alias" : "operations", "is_write_index" : true } }
]
}'
```

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:
- in order to do this, clone this [repository](https://github.com/multiversx/mx-chain-tools-go)
- checkout this branch `mappings-for-all-fields`
- `cd elasticreindexer/indices-creator`
- `cd elasticreindexer/cmd/indices-creator`
- open `config/cluster.toml` file and update it with the information about your cluster and at the `enabled-indices`
section put `["operations"]`
- build the binary and run it in order to create the index with the correct mappings.

4. After the index was created you can start again the observers.
5. Copy all the data from a public Elasticsearch cluster for the index with problems.
- in order to do this follow the steps from this [documentation](https://github.com/multiversx/mx-chain-tools-go/tree/mappings-for-all-fields/elasticreindexer#step-2) (only for the index/indices with problems)

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
Loading

0 comments on commit 8c898a0

Please sign in to comment.