Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New construction example #7

Merged
merged 2 commits into from
Oct 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions devnet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ export ROSETTA_OFFLINE=http://localhost:7092
Check the construction API:

```
rosetta-cli check:construction --configuration-file devnet-construction-with-metadata.json \
--online-url=${ROSETTA_ONLINE} --offline-url=${ROSETTA_OFFLINE}

rosetta-cli check:construction --configuration-file devnet-construction.json \
--online-url=${ROSETTA_ONLINE} --offline-url=${ROSETTA_OFFLINE}
```
Expand Down
35 changes: 35 additions & 0 deletions devnet/devnet-construction-with-metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"network": {
"blockchain": "Elrond",
"network": "devnet"
},
"data_directory": "",
"http_timeout": 200,
"max_retries": 3,
"max_online_connections": 120,
"max_sync_concurrency": 1,
"construction": {
"end_conditions": {
"transfer": 2
},
"stale_depth": 10,
"broadcast_limit": 5,
"constructor_dsl_file": "devnet-construction-with-metadata.ros",
"prefunded_accounts": [
{
"account_identifier": {
"address": "erd1ldjsdetjvegjdnda0qw2h62kq6rpvrklkc5pw9zxm0nwulfhtyqqtyc4vq"
},
"privkey": "3e4e89e501eb542c12403fb15c52479e8721f2f4dedc3b3ef0f3b47b37de006c",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is needed so that the example works out-of-the-box (test account).

"curve_type": "edwards25519",
"currency": {
"symbol": "XeGLD",
"decimals": 18
}
}
]
},
"data": {
"inactive_discrepancy_search_disabled": true
}
}
37 changes: 37 additions & 0 deletions devnet/devnet-construction-with-metadata.ros
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
transfer(1){
transfer{
transfer.network = {"network":"devnet", "blockchain":"Elrond"};
elrond_currency = {"symbol":"XeGLD", "decimals":18};
sender = {
"account_identifier": {
"address": "erd1ldjsdetjvegjdnda0qw2h62kq6rpvrklkc5pw9zxm0nwulfhtyqqtyc4vq"
},
"currency": {
"symbol": "XeGLD",
"decimals": 18
}
};

max_transfer_amount = "10000000000000000";
recipient_amount = random_number({"minimum": "1", "maximum": {{max_transfer_amount}}});

print_message({"recipient_amount":{{recipient_amount}}});

sender_amount = 0-{{recipient_amount}};
transfer.confirmation_depth = "10";
transfer.operations = [
{
"operation_identifier":{"index":0},
"type":"Transfer",
"account":{{sender.account_identifier}},
"amount":{
"value":{{sender_amount}},
"currency":{{elrond_currency}}
}
}
];
transfer.preprocess_metadata = {
"receiver": "erd1qyu5wthldzr8wx5c9ucg8kjagg0jfs53s8nr3zpz3hypefsdd8ssycr6th"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alice is in shard 1, while the sender is in shard 0.

};
}
}
5 changes: 1 addition & 4 deletions devnet/devnet-construction.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@
]
},
"data": {
"historical_balance_disabled": true,
"reconciliation_disabled": true,
"inactive_discrepancy_search_disabled": true,
"balance_tracking_disabled": true
"inactive_discrepancy_search_disabled": true
}
}
4 changes: 0 additions & 4 deletions devnet/devnet-construction.ros
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ transfer(1){
"account_identifier": {
"address": "erd1ldjsdetjvegjdnda0qw2h62kq6rpvrklkc5pw9zxm0nwulfhtyqqtyc4vq"
},
"privkey": "3e4e89e501eb542c12403fb15c52479e8721f2f4dedc3b3ef0f3b47b37de006c",
"curve_type": "edwards25519",
"currency": {
"symbol": "XeGLD",
"decimals": 18
Expand All @@ -25,8 +23,6 @@ transfer(1){
"account_identifier": {
"address": "erd1xtslmt67utuewwv8jsx729mxjxaa8dvyyzp7492hy99dl7hvcuqq30l98v"
},
"privkey": "e2cfd1bf75bd3d2f7a5cdc35f0d9d0ed395185e3beab941e0d03f5f8f9da4dec",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wasn't actually needed (is already in the parent JSON file).

"curve_type": "edwards25519",
"currency": {
"symbol": "XeGLD",
"decimals": 18
Expand Down