This repository was archived by the owner on Nov 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathtest_hash_iris.js
More file actions
77 lines (69 loc) · 2.46 KB
/
test_hash_iris.js
File metadata and controls
77 lines (69 loc) · 2.46 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
72
73
74
75
76
const Irisnet = require('../index');
const common = require('./common');
const chai = require('chai');
const assert = chai.assert;
const url ="http://irisnet-lcd.dev.rainbow.one/tx/broadcast";
const chainName ="iris";
const threshold = 10;
const chain_id = "rainbow-dev";
describe('iris hash', function () {
it('test transfer hash', function () {
let crypto = Irisnet.getCrypto('iris', 'testnet');
let account1 = crypto.create();
let sequence = 1;
let base = 1000000000000000000;
for (let i = 1; i <= threshold; i++) {
let account2 = crypto.create();
let tx = {
chain_id: chain_id,
from: account1.address,
account_number: 0,
sequence: sequence,
fees: {denom: "iris-atto", amount: 100000000000000000},
gas: 10000,
memo: common.randomWord(100),
type: Irisnet.config.iris.tx.transfer.type,
msg: {
to: account2.address,
coins: [
{
denom: "iris-atto",
amount: base * Math.pow(10,i)
}
]
}
};
common.verifyTx(url,tx,account1.privateKey,chainName,verify);
sequence++;
}
});
it('test delegate hash', function () {
let crypto = Irisnet.getCrypto('iris', 'testnet');
let account1 = crypto.create();
let sequence = 1;
for (let i = 1; i <= threshold; i++) {
let tx = {
chain_id: chain_id,
from: account1.address,
account_number: 0,
sequence: sequence,
fees: {denom: "iris-atto", amount: 100000000000000000},
gas: 10000,
memo: common.randomWord(100),
type: Irisnet.config.iris.tx.delegate.type,
msg: {
validator_addr: "fva1aake3umjllpd9es5d3qmry4egcne0f8ajd7vdp",
delegation: {
denom: "iris-atto",
amount: 1000000000000000000000000
}
}
};
common.verifyTx(url,tx,account1.privateKey,chainName,verify);
sequence++;
}
});
});
function verify(act,exp,data) {
assert.strictEqual(act.hash,exp.hash,JSON.stringify(data))
}