25
25
</button >
26
26
{{ signedTxNonStandard }}
27
27
</li >
28
+ <li >
29
+ <hr />
30
+ <h3 >Send</h3 >
31
+ <label for =" toAmount1" >
32
+ to amount
33
+ <input
34
+ id =" toAmount1"
35
+ v-model =" toAmount"
36
+ placeholder =" amount"
37
+ /> </label
38
+ ><br />
39
+ <!-- <button v-show="userAddress !== ''" @click="sendTx">send</button>-->
40
+ <button @click =" sendTx" >send</button >
41
+ <h6 >Sends to the connected wallet address</h6 >
42
+ <h3 >Tx Hash:</h3 >
43
+ {{ txHash }}
44
+ </li >
28
45
<li >
29
46
<hr />
30
47
<h3 >Send</h3 >
35
52
v-model =" toAmount"
36
53
placeholder =" amount"
37
54
/> </label
55
+ >
56
+ <label for =" altNonce" >
57
+ alt nonce
58
+ <input
59
+ id =" altNonce"
60
+ v-model =" altNonce"
61
+ placeholder =" altNonce"
62
+ /> </label
63
+ >
64
+ <label for =" altGasPrice" >
65
+ altGasPrice
66
+ <input
67
+ id =" altGasPrice"
68
+ v-model =" altGasPrice"
69
+ placeholder =" altGasPrice"
70
+ /> </label
38
71
><br />
39
72
<!-- <button v-show="userAddress !== ''" @click="sendTx">send</button>-->
40
- <button @click =" sendTx " >send</button >
73
+ <button @click =" sendTx2 " >send alt-nonce </button >
41
74
<h6 >Sends to the connected wallet address</h6 >
42
75
<h3 >Tx Hash:</h3 >
43
76
{{ txHash }}
@@ -351,7 +384,9 @@ export default {
351
384
fromAddressDetailed: ' ' ,
352
385
thing: false ,
353
386
checker: false ,
354
- checkOne: ' '
387
+ checkOne: ' ' ,
388
+ altNonce: ' ' ,
389
+ altGasPrice: ' '
355
390
};
356
391
},
357
392
mounted () {
@@ -367,10 +402,11 @@ export default {
367
402
// 859569f6decc4446a5da1bb680e7e9cf
368
403
this .connect = new mewConnect.Provider ({
369
404
windowClosedError: true ,
370
- chainId: 1 ,
371
- // chainId: 3,
405
+ // chainId: 1,
406
+ chainId: 3 ,
372
407
// rpcUrl: 'https://mainnet.infura.io/v3/' //'wss://mainnet.infura.io/ws/v3/'
373
- rpcUrl: ' HTTP://127.0.0.1:7545'
408
+ // rpcUrl: 'HTTP://127.0.0.1:7545'
409
+ rpcUrl: ' https://ropsten.infura.io/v3/c9b249497d074ab59c47a97bdfe6b401'
374
410
// rpcUrl: 'ws://127.0.0.1:8545'
375
411
// infuraId: '7d06294ad2bd432887eada360c5e1986'
376
412
});
@@ -588,6 +624,44 @@ export default {
588
624
});
589
625
});
590
626
},
627
+ sendTx2 () {
628
+ this .web3 .eth .getBalance (this .userAddress ).then (bal => this .balance );
629
+ this .web3 .eth .getGasPrice ().then (gasPrice => {
630
+ if (this .altGasPrice !== ' ' ){
631
+ gasPrice = this .altGasPrice
632
+ }
633
+ console .log (' gasPrice' , gasPrice); // todo remove dev item
634
+ this .web3 .eth .getTransactionCount (this .userAddress ).then (nonce => {
635
+ if (this .altNonce !== ' ' ){
636
+ nonce = this .altNonce
637
+ }
638
+ console .log (' nonce' , nonce); // todo remove dev item
639
+ this .web3 .eth
640
+ .sendTransaction ({
641
+ from: this .userAddress ,
642
+ to: this .userAddress ,
643
+ nonce,
644
+ value: new BigNumber (this .toAmount )
645
+ .times (new BigNumber (10 ).pow (18 ))
646
+ .toFixed ()
647
+ /* gasPrice: gasPrice ,
648
+ gasLimit: '0xa'// 21000*/
649
+ })
650
+ .once (' transactionHash' , hash => {
651
+ console .log ([' Hash' , hash]);
652
+ this .txHash = hash;
653
+ })
654
+ .once (' receipt' , res => {
655
+ console .log ([' Receipt' , res]);
656
+ })
657
+ .on (' error' , err => {
658
+ console .log ([' Error' , err]);
659
+ })
660
+ .then (txhash => console .log (' THEN: ' , txhash))
661
+ .catch (err => console .error (err));
662
+ });
663
+ });
664
+ },
591
665
sendTxDetailed () {
592
666
this .sendTxDetailed2 ()
593
667
/* // this.web3.eth.getBalance(this.userAddress).then(bal => this.balance);
0 commit comments