request_funds(1){ find_account{ currency = {"symbol":"SOL", "decimals":9}; random_account = find_balance({ "minimum_balance":{ "value": "0", "currency": {{currency}} }, "create_limit":1 }); }, // Create a separate scenario to request funds so that // the address we are using to request funds does not // get rolled back if funds do not yet exist. request{ loaded_account = find_balance({ "account_identifier": {{random_account.account_identifier}}, "minimum_balance":{ "value": "1", "currency": {{currency}} } }); } } create_account(1){ create{ network = {"network":"devnet", "blockchain":"solana"}; key = generate_key({"curve_type": "edwards25519"}); account = derive({ "network_identifier": {{network}}, "public_key": {{key.public_key}} }); // If the account is not saved, the key will be lost! save_account({ "account_identifier": {{account.account_identifier}}, "keypair": {{key}} }); } } transfer(1){ transfer{ transfer.network = {"network":"devnet", "blockchain":"solana"}; currency = {"symbol":"SOL", "decimals":9}; sender = find_balance({ "minimum_balance":{ "value": "1", "currency": {{currency}} } }); // Set the recipient_amount as some value <= sender.balance-max_fee max_fee = "100000"; available_amount = {{sender.balance.value}} - {{max_fee}}; //available_amount = "1000"; recipient_amount = random_number({"minimum": "1", "maximum": {{available_amount}}}); print_message({"recipient_amount":{{recipient_amount}}}); // Find recipient and construct operations sender_amount = 0 - {{recipient_amount}}; recipient = find_balance({ "not_account_identifier":[{{sender.account_identifier}}], "minimum_balance":{ "value": "0", "currency": {{currency}} }, "create_limit": 100, "create_probability": 50 }); transfer.confirmation_depth = "1"; transfer.operations = [ { "operation_identifier":{"index":0}, "type":"System__Transfer", "account":{{sender.account_identifier}}, "amount":{ "value":{{sender_amount}}, "currency":{{currency}} } }, { "operation_identifier":{"index":1}, "type":"System__Transfer", "account":{{recipient.account_identifier}}, "amount":{ "value":{{recipient_amount}}, "currency":{{currency}} } } ]; } }