diff --git a/example/new_account.dart b/example/new_account.dart new file mode 100644 index 0000000..4ae91bd --- /dev/null +++ b/example/new_account.dart @@ -0,0 +1,76 @@ +import 'package:eosdart/eosdart.dart'; + +main() { + EOSClient client = EOSClient('https://jungle3.cryptolions.io', 'v1', privateKeys: ["5J9b3xMkbvcT6gYv2EpQ8FD4ZBjgypuNKwE1jxkd7Wd1DYzhk88"]); + + //privateKeys can also be set after client was constructed, as following + //client.privateKeys = ["5J9b3xMkbvcT6gYv2EpQ8FD4ZBjgypuNKwE1jxkd7Wd1DYzhk88"]; + + List auth = [ + Authorization() + ..actor = 'xuelongqy2cn' + ..permission = 'active' + ]; + + Map data = { + 'creator': 'xuelongqy2cn', + 'name': 'xuelongqy3cn', + 'owner': { + 'threshold': 1, + 'keys': [ + { + 'key': "EOS65xaKR6zw4cjy9kuwuCbi7vTTbWNYSHdVgNf7492VAjCPi6gT6", + 'weight': 1, + } + ], + 'accounts': [], + 'waits': [] + }, + 'active': { + 'threshold': 1, + 'keys': [ + { + 'key': "EOS65xaKR6zw4cjy9kuwuCbi7vTTbWNYSHdVgNf7492VAjCPi6gT6", + 'weight': 1, + } + ], + 'accounts': [], + 'waits': [] + }, + }; + + List actions = [ + Action() + ..account = 'eosio' + ..name = 'newaccount' + ..authorization = auth + ..data = data, + Action() + ..account = 'eosio' + ..name = 'buyram' + ..authorization = auth + ..data = { + 'payer': "xuelongqy2cn", + 'receiver': "xuelongqy3cn", + 'quant': "2.0000 EOS", + }, + Action() + ..account = 'eosio' + ..name = 'delegatebw' + ..authorization = auth + ..data = { + 'from': "xuelongqy2cn", + 'receiver': "xuelongqy3cn", + 'stake_net_quantity': "1.0000 EOS", + 'stake_cpu_quantity': "1.0000 EOS", + 'transfer': false, + } + ]; + + Transaction transaction = Transaction()..actions = actions; + + // print result + client.pushTransaction(transaction, broadcast: true).then((trx) { + print(trx); + }); +} diff --git a/lib/src/jsons.dart b/lib/src/jsons.dart index bc42dd2..aa9748f 100644 --- a/lib/src/jsons.dart +++ b/lib/src/jsons.dart @@ -16,6 +16,150 @@ String abiJson = ''' } ] }, + { + "name": "newaccount", + "base": "", + "fields": [ + { + "name": "creator", + "type": "name" + }, + { + "name": "name", + "type": "name" + }, + { + "name": "owner", + "type": "authority" + }, + { + "name": "active", + "type": "authority" + } + ] + }, + { + "name": "authority", + "base": "", + "fields": [ + { + "name": "threshold", + "type": "uint32" + }, + { + "name": "keys", + "type": "key_weight[]" + }, + { + "name": "accounts", + "type": "permission_level_weight[]" + }, + { + "name": "waits", + "type": "wait_weight[]" + } + ] + }, + { + "name": "key_weight", + "base": "", + "fields": [ + { + "name": "key", + "type": "public_key" + }, + { + "name": "weight", + "type": "uint16" + } + ] + }, + { + "name": "permission_level_weight", + "base": "", + "fields": [ + { + "name": "permission", + "type": "permission_level" + }, + { + "name": "weight", + "type": "uint16" + } + ] + }, + { + "name": "wait_weight", + "base": "", + "fields": [ + { + "name": "wait_sec", + "type": "uint32" + }, + { + "name": "weight", + "type": "uint16" + } + ] + }, + { + "name": "permission_level", + "base": "", + "fields": [ + { + "name": "actor", + "type": "name" + }, + { + "name": "permission", + "type": "name" + } + ] + }, + { + "name": "buyram", + "base": "", + "fields": [ + { + "name": "payer", + "type": "name" + }, + { + "name": "receiver", + "type": "name" + }, + { + "name": "quant", + "type": "asset" + } + ] + }, + { + "name": "delegatebw", + "base": "", + "fields": [ + { + "name": "from", + "type": "name" + }, + { + "name": "receiver", + "type": "name" + }, + { + "name": "stake_net_quantity", + "type": "asset" + }, + { + "name": "stake_cpu_quantity", + "type": "asset" + }, + { + "name": "transfer", + "type": "bool" + } + ] + }, { "name": "type_def", "base": "",