-
Notifications
You must be signed in to change notification settings - Fork 194
/
Copy pathmain.js
58 lines (49 loc) · 1.35 KB
/
main.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
// Add imports here
// Add functions here
/*
Do not edit code below this line.
*/
var mnemonicVue = new Vue({
el:"#app",
data: {
mnemonic: "",
privKey: "",
pubKey: "",
ETHaddress: "",
sampleTransaction: {
nonce: '0x00',
gasPrice: '0x09184e72a000',
gasLimit: '0x2710',
to: '0x31c1c0fec59ceb9cbe6ec474c31c1dc5b66555b6',
value: '0x10',
data: '0x7f7465737432000000000000000000000000000000000000000000000000000000600057',
chainId: 3
},
signedSample: {},
recoveredAddress: ""
},
methods:{
generateNew: function(){
this.mnemonic = generateMnemonic()
},
signSampleTx: function(){
this.signedSample = signTx(this.privKey, this.sampleTransaction)
console.log("signed Sample", this.signedSample)
}
},
watch: {
mnemonic: function(val){
this.privKey = generatePrivKey(val)
},
privKey: function(val){
this.pubKey = derivePubKey(val)
},
pubKey: function(val){
this.ETHaddress = deriveEthAddress(val)
this.recoveredAddress = ""
},
signedSample: function(val){
this.recoveredAddress = getSignerAddress(val)
}
}
})