forked from music/charkity
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
71 lines (56 loc) · 1.94 KB
/
test.js
File metadata and controls
71 lines (56 loc) · 1.94 KB
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
// test mainnet address: ALDdf8G5g77Y3JVomNpPcJjRrNgduVsu9B
var arkAPI = require("ark-api");
var arkJS = require("arkjs");
var bip39 = require("bip39");
window.arkAPI = arkAPI;
window.arkJS = arkJS;
window.bip39 = bip39;
// arkAPI.getBalance("DTBgCyvrZRoPunVipK9wWVhNC6b7s8UK6x", (error, success, response) => {
// console.log(response.balance / 100000000);
// });
// arkAPI.getAccount("DTBgCyvrZRoPunVipK9wWVhNC6b7s8UK6x", (error, success, response) => {
// console.log(response);
// });
// var seed = bip39.generateMnemonic();
// var keys = arkJS.crypto.getKeys(seed);
// console.log(keys.publicKey);
// var address = arkJS.crypto.getAddress(keys.publicKey, 0x1E);
// console.log(address);
// arkAPI.sendTransaction(
// "tuition biology right winner trial forget remain snake family multiply scrap saddle",
// "ignore",
// null,
// 345700000,
// "DHSjfthDB1LjMiofUqnKXjFU3vi3rEQ8va",
// function(error, success, response) {
// console.log(response);
// });
// function sendTransaction(seed, amount, address) {
// var precision = Math.pow(10, 1);
// var final_amount = Math.ceil(amount * precision) / precision;
// var difference = (final_amount - amount).toFixed(8);
// console.log("difference = " + difference);
// var charity = difference * Math.pow(10, 8);
// amount = parseInt(amount * 100000000);
// // send to actual recipient
// arkAPI.sendTransaction(
// seed,
// "ignore",
// null,
// amount,
// address,
// function(error, success, response) {
// console.log(response);
// });
// // send remainder to charity
// arkAPI.sendTransaction(
// seed,
// "ignore",
// null,
// charity,
// "DJ4uHVUCa5f83Y4Y3BFqUyRL47k2cWXkgE",
// function(error, success, response) {
// console.log(response);
// });
// }
// sendTransaction("tuition biology right winner trial forget remain snake family multiply scrap saddle", 4.002628, "DHSjfthDB1LjMiofUqnKXjFU3vi3rEQ8va");