-
Notifications
You must be signed in to change notification settings - Fork 1
/
createAccount.js
73 lines (70 loc) · 1.79 KB
/
createAccount.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
'use strict';
const eosInstance = require('./eos-instance');
const creator = 'yoafkunfjhoo';
const accountName = 'amagicwallet';
const owner_pubkey = 'EOS8WWEv86zWADVyF66ibiwUW6zEN6D9Ao87rXj1LRwuZPKH35NSR'
const active_pubkey = 'EOS7yRrYEGvQ7cx7jUMwRSjR8YX5aqcgbHiYdcHJcXTHLWfWSh6NY'
eosInstance.transact({
actions: [{
account: 'eosio',
name: 'newaccount',
authorization: [{
actor: creator,
permission: 'active',
}],
data: {
creator: creator,
name: accountName,
owner: {
"threshold": 1,
"keys": [{
"key": owner_pubkey,
"weight": 1
}],
accounts: [],
waits:[]
},
active: {
"threshold": 1,
"keys": [{
"key": active_pubkey,
"weight": 1
}],
accounts: [],
waits:[]
}
}
}, {
account: 'eosio',
name: 'buyrambytes',
authorization: [{
actor: creator,
permission: 'active',
}],
data: {
payer: creator,
receiver: accountName,
bytes: 8192
}
}, {
account: 'eosio',
name: 'delegatebw',
authorization: [{
actor: creator,
permission: 'active',
}],
data: {
from: creator,
receiver: accountName,
stake_net_quantity: '10.0000 TNT',
stake_cpu_quantity: '10.0000 TNT',
transfer: false
}
}]
}, {
blocksBehind: 3,
expireSeconds: 30,
}).then(console.log)
.catch(e => {
console.error(e);
})