openchain-nodejs-ts-yxl 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/doc/SDK_CN.md +1 -1
  2. package/example/atp10TokenDemo.js +1 -1
  3. package/example/exchange.js +1 -1
  4. package/example/offlineSignatureDemo.js +1 -1
  5. package/example/submitTransactionDemo.js +1 -1
  6. package/index.d.ts +370 -21
  7. package/index.js +2 -0
  8. package/lib/common/buffer-polyfill.js +90 -0
  9. package/package.json +2 -2
  10. package/test/Ctp10Token.test.js +2 -2
  11. package/test/account.test.js +20 -15
  12. package/test/accountActivateOperation.test.js +20 -18
  13. package/test/accountSetMetadata.test.js +2 -2
  14. package/test/accountSetPrivilege.test.js +2 -2
  15. package/test/asset.test.js +10 -10
  16. package/test/assetIssueOperation.test.js +7 -6
  17. package/test/assetSendOperation.test.js +23 -23
  18. package/test/blob.test.js +4 -4
  19. package/test/block.test.js +5 -3
  20. package/test/buSendOperation.test.js +6 -6
  21. package/test/contract.test.js +1 -1
  22. package/test/contractCreateOperation.test.js +3 -3
  23. package/test/contractCreateTransaction.test.js +1 -1
  24. package/test/contractInvokeByAssetOperation.test.js +2 -2
  25. package/test/contractInvokeByBUOperation.test.js +1 -1
  26. package/test/ctp10TokenApproveOperation.test.js +4 -4
  27. package/test/ctp10TokenAssignOperation.test.js +1 -1
  28. package/test/ctp10TokenChangeOwnerOperation.test.js +1 -1
  29. package/test/ctp10TokenIssueOperation.test.js +1 -1
  30. package/test/ctp10TokenIssueOperationTransaction.test.js +1 -1
  31. package/test/ctp10TokenTransferFromOperation.test.js +1 -1
  32. package/test/ctp10TokenTransferOperation.test.js +1 -1
  33. package/test/log.transaction.test.js +1 -1
  34. package/test/transaction.test.js +2 -2
  35. package/test/util.test.js +1 -1
@@ -4,7 +4,7 @@ require('chai').should();
4
4
  const OpenChainSDK = require('../index');
5
5
 
6
6
  const sdk = new OpenChainSDK({
7
- host: 'http://localhost/node/api',
7
+ host: 'https://nodeapi.aospub.com',
8
8
  });
9
9
 
10
10
  describe('Test token.ctp10Token', function() {
@@ -13,7 +13,7 @@ describe('Test token.ctp10Token', function() {
13
13
  let address = 'YxLSTjYcKBcCJ3tDnBM6z8u8uvFNaZ7L8pse';
14
14
  let data = await sdk.token.ctp10Token.checkValid(address);
15
15
  data.result.isValid.should.equal(true);
16
- address = 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t';
16
+ address = 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz';
17
17
  data = await sdk.token.ctp10Token.checkValid(address);
18
18
  data.errorCode.should.equal(11037)
19
19
  });
@@ -4,37 +4,38 @@ require('chai').should();
4
4
  const OpenChainSDK = require('../index');
5
5
 
6
6
  const sdk = new OpenChainSDK({
7
- host: 'http://localhost/node/api',
7
+ host: 'nodeapi.aospub.com',
8
8
  });
9
9
 
10
10
  describe('Test openchain-sdk account service', function() {
11
11
 
12
12
  it('test account.create()', async() => {
13
13
  const keypair = await sdk.account.create();
14
- console.log('keypair',keypair);
14
+ // console.log('keypair',keypair);
15
15
  keypair.errorCode.should.equal(0);
16
16
  keypair.result.should.be.a('object');
17
17
  keypair.result.should.have.property('privateKey').with.lengthOf(56);
18
18
  keypair.result.should.have.property('publicKey').with.lengthOf(76);
19
- keypair.result.should.have.property('address').with.lengthOf(36);
19
+ keypair.result.should.have.property('address').with.lengthOf(37);
20
20
  });
21
21
 
22
22
 
23
23
  it('test account.getInfo(address)', async() => {
24
- let address = 'YxLEhaVxxbXABBuj4trYir51UH9SwfyiS6CF';
24
+ let address = 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz';
25
25
  let data = await sdk.account.getInfo(address);
26
+ // console.log('getInfo',data);
26
27
  data.should.be.a('object');
27
28
  data.errorCode.should.equal(0);
28
29
 
29
30
  address = '';
30
31
  data = await sdk.account.getInfo(address);
32
+ // console.log('getInfo',data);
31
33
  data.should.be.a('object');
32
34
  data.errorCode.should.equal(11006);
33
35
 
34
- address = 'YxLA2RjoKvdx2FcKD63zXi2UQnUsmDVoDvFj';
35
- // YxLA2RjoKvdx2FcKD63zXi2UQnUsmDVoDvFj
36
- // aco2EeSCcBjqnjffFP59nxTvrX1iWvs3KANF9
36
+ address = 'YxLVUVPMHrDy5yaAcckXt2aHwckH4frmJVVP';
37
37
  data = await sdk.account.getInfo(address);
38
+ // console.log('getInfo',data);
38
39
  data.should.be.a('object');
39
40
  data.errorCode.should.equal(11006);
40
41
 
@@ -45,12 +46,12 @@ describe('Test openchain-sdk account service', function() {
45
46
  });
46
47
 
47
48
  it('test account.checkValid(address)', async() => {
48
- let data = await sdk.account.checkValid('YxLA2RjoKvdx2FcKD63zXi2UQnUsmDVoDvFj');
49
+ let data = await sdk.account.checkValid('YxLVUVPMHrDy5yaAcckXt2aHwckH4frmJVVPW');
49
50
  data.should.be.a('object');
50
51
  data.result.should.be.a('object');
51
52
  data.result.should.have.property('isValid').equal(true);
52
53
 
53
- data = await sdk.account.checkValid('YxLA2RjoKvdx2FcKD63zXi2UQnUsmDVoDvFj');
54
+ data = await sdk.account.checkValid('YxLVf7XWy6cMwzKozQUZ71wdn4sQRUX6hfcaO');
54
55
  data.should.be.a('object');
55
56
  data.result.should.be.a('object');
56
57
  data.result.should.have.property('isValid').equal(false);
@@ -68,7 +69,7 @@ describe('Test openchain-sdk account service', function() {
68
69
  });
69
70
 
70
71
  it('test account.getBalance(address)', async() => {
71
- let address = 'YxLA2RjoKvdx2FcKD63zXi2UQnUsmDVoDvFj';
72
+ let address = 'YxLVUVPMHrDy5yaAcckXt2aHwckH4frmJVVPW';
72
73
  let data = await sdk.account.getBalance(address);
73
74
  data.should.be.a('object');
74
75
  data.errorCode.should.equal(0);
@@ -91,7 +92,7 @@ describe('Test openchain-sdk account service', function() {
91
92
  });
92
93
 
93
94
  it('test account.getNonce(address)', async() => {
94
- let address = 'YxLA2RjoKvdx2FcKD63zXi2UQnUsmDVoDvFj';
95
+ let address = 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz';
95
96
  let data = await sdk.account.getNonce(address);
96
97
  data.should.be.a('object');
97
98
  data.errorCode.should.equal(0);
@@ -105,26 +106,30 @@ describe('Test openchain-sdk account service', function() {
105
106
 
106
107
  it('test account.getMetadata()', async() => {
107
108
  let data = await sdk.account.getMetadata({
108
- address: 'adxScpCtbeLP2KGRaCkbtrmz8iB5mu6DQcW3r',
109
- key: 'mykey1'
109
+ address: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
110
+ key: ''
110
111
  });
111
112
  console.log(data);
112
113
  console.log(JSON.stringify(data));
113
114
  });
114
115
 
115
116
  it('test account.isActivated()', async() => {
116
- let data = await sdk.account.isActivated('adxScpCtbeLP2KGRaCkbtrmz8iB5mu6DQcW3r');
117
+ let data = await sdk.account.isActivated('YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz');
118
+ console.log('isActivated',data);
117
119
  data.errorCode.should.equal(0);
118
120
  data.result.isActivated.should.equal(true);
119
121
 
120
- data = await sdk.account.isActivated('YxLA2RjoKvdx2FcKD63zXi2UQnUsmDVoDvFj');
122
+ data = await sdk.account.isActivated('YxLVf7XWy6cMwzKozQUZ71wdn4sQRUX6hfcaM');
123
+ console.log('isActivated',data);
121
124
  data.errorCode.should.equal(0);
122
125
  data.result.isActivated.should.equal(false);
123
126
 
124
127
  data = await sdk.account.isActivated();
128
+ console.log('isActivated0',data);
125
129
  data.errorCode.should.equal(15016);
126
130
 
127
131
  data = await sdk.account.isActivated('');
132
+ console.log('isActivated 00',data);
128
133
  data.errorCode.should.equal(11006);
129
134
 
130
135
  });
@@ -4,7 +4,7 @@ require('chai').should();
4
4
  const OpenChainSDK = require('../index');
5
5
 
6
6
  const sdk = new OpenChainSDK({
7
- host: 'localhost/node/api',
7
+ host: 'nodeapi.aospub.com',
8
8
  });
9
9
 
10
10
  describe('Test account activate operation', function() {
@@ -12,12 +12,14 @@ describe('Test account activate operation', function() {
12
12
  it('test operation.accountActivateOperation()', function() {
13
13
 
14
14
  let data = sdk.operation.accountActivateOperation({
15
- sourceAddress: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
16
- destAddress: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
15
+ sourceAddress: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
16
+ destAddress: 'YxLVf7XWy6cMwzKozQUZ71wdn4sQRUX6hfcaM',
17
17
  initBalance: '1000',
18
18
  metadata: 'Test Account Activate',
19
19
  });
20
20
 
21
+ console.log(data);
22
+
21
23
  data.should.be.a('object');
22
24
  data.errorCode.should.equal(0);
23
25
  data.result.should.have.property('operation').be.a('object');
@@ -28,21 +30,21 @@ describe('Test account activate operation', function() {
28
30
  // Invalid sourceAddress
29
31
  data = sdk.operation.accountActivateOperation({
30
32
  sourceAddress: '',
31
- destAddress: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
33
+ destAddress: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
32
34
  initBalance: '1000',
33
35
  });
34
36
  data.errorCode.should.equal(11002);
35
37
 
36
38
  data = sdk.operation.accountActivateOperation({
37
39
  sourceAddress: null,
38
- destAddress: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
40
+ destAddress: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
39
41
  initBalance: '1000',
40
42
  });
41
43
  data.errorCode.should.equal(11002);
42
44
 
43
45
  // Invalid destAddress
44
46
  data = sdk.operation.accountActivateOperation({
45
- sourceAddress: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
47
+ sourceAddress: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
46
48
  destAddress: '',
47
49
  initBalance: '1000',
48
50
  });
@@ -50,45 +52,45 @@ describe('Test account activate operation', function() {
50
52
 
51
53
  // sourceAddress === destAddress
52
54
  data = sdk.operation.accountActivateOperation({
53
- sourceAddress: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
54
- destAddress: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
55
+ sourceAddress: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
56
+ destAddress: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
55
57
  initBalance: '1000',
56
58
  });
57
59
  data.errorCode.should.equal(11005);
58
60
 
59
61
  // Invalid initBalance
60
62
  data = sdk.operation.accountActivateOperation({
61
- sourceAddress: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
62
- destAddress: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
63
+ sourceAddress: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
64
+ destAddress: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
63
65
  initBalance: 1000,
64
66
  });
65
67
  data.errorCode.should.equal(11004);
66
68
 
67
69
  data = sdk.operation.accountActivateOperation({
68
- sourceAddress: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
69
- destAddress: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
70
+ sourceAddress: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
71
+ destAddress: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
70
72
  initBalance: '',
71
73
  });
72
74
  data.errorCode.should.equal(11004);
73
75
 
74
76
  data = sdk.operation.accountActivateOperation({
75
- sourceAddress: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
76
- destAddress: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
77
+ sourceAddress: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
78
+ destAddress: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
77
79
  });
78
80
  data.errorCode.should.equal(11004);
79
81
 
80
82
  // Invalid metadata
81
83
  data = sdk.operation.accountActivateOperation({
82
- sourceAddress: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
83
- destAddress: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
84
+ sourceAddress: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
85
+ destAddress: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
84
86
  initBalance: '1000',
85
87
  metadata: '',
86
88
  });
87
89
  data.errorCode.should.equal(15028);
88
90
 
89
91
  data = sdk.operation.accountActivateOperation({
90
- sourceAddress: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
91
- destAddress: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
92
+ sourceAddress: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
93
+ destAddress: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
92
94
  initBalance: '1000',
93
95
  metadata: 123,
94
96
  });
@@ -5,7 +5,7 @@ const OpenChainSDK = require('../index');
5
5
  const BigNumber = require('bignumber.js');
6
6
 
7
7
  const sdk = new OpenChainSDK({
8
- host: 'localhost/node/api',
8
+ host: 'nodeapi.aospub.com',
9
9
  });
10
10
 
11
11
  describe('Test account Set Metadata Operation', function() {
@@ -13,7 +13,7 @@ describe('Test account Set Metadata Operation', function() {
13
13
  it('test operation.accountSetMetadataOperation()', async() => {
14
14
 
15
15
  const privateKey = 'private key';
16
- const sourceAddress = 'adxScpCtbeLP2KGRaCkbtrmz8iB5mu6DQcW3r';
16
+ const sourceAddress = 'YxLVf7XWy6cMwzKozQUZ71wdn4sQRUX6hfcaM';
17
17
 
18
18
  // Get nonce
19
19
  const result = await sdk.account.getNonce(sourceAddress);
@@ -5,7 +5,7 @@ const OpenChainSDK = require('../index');
5
5
  const BigNumber = require('bignumber.js');
6
6
 
7
7
  const sdk = new OpenChainSDK({
8
- host: 'localhost/node/api',
8
+ host: 'nodeapi.aospub.com',
9
9
  });
10
10
 
11
11
  describe('Test account Set Privilege Operation', function() {
@@ -13,7 +13,7 @@ describe('Test account Set Privilege Operation', function() {
13
13
  it('test operation.accountSetPrivilegeOperation()', async() => {
14
14
 
15
15
  const privateKey = 'private key';
16
- const sourceAddress = 'adxScpCtbeLP2KGRaCkbtrmz8iB5mu6DQcW3r';
16
+ const sourceAddress = 'YxLVf7XWy6cMwzKozQUZ71wdn4sQRUX6hfcaM';
17
17
 
18
18
  // Get nonce
19
19
  const result = await sdk.account.getNonce(sourceAddress);
@@ -4,16 +4,16 @@ require('chai').should();
4
4
  const OpenChainSDK = require('../index');
5
5
 
6
6
  const sdk = new OpenChainSDK({
7
- host: 'localhost/node/api',
7
+ host: 'nodeapi.aospub.com',
8
8
  });
9
9
 
10
10
  describe('Test asset service', function() {
11
11
 
12
12
  it('test asset.getInfo()', async() => {
13
13
  let data = await sdk.token.asset.getInfo({
14
- address: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
14
+ address: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
15
15
  code: 'BTC',
16
- issuer: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
16
+ issuer: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
17
17
  });
18
18
  data.errorCode.should.equal(0);
19
19
  data.result.should.be.a('object');
@@ -28,31 +28,31 @@ describe('Test asset service', function() {
28
28
  data = await sdk.token.asset.getInfo({
29
29
  address: '',
30
30
  code: 'BTC',
31
- issuer: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
31
+ issuer: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
32
32
  });
33
33
  data.errorCode.should.equal(11006);
34
34
 
35
35
  // invalid code
36
36
  data = await sdk.token.asset.getInfo({
37
- address: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
37
+ address: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
38
38
  code: '',
39
- issuer: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
39
+ issuer: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
40
40
  });
41
41
  data.errorCode.should.equal(11023);
42
42
 
43
43
  // invalid issuer address
44
44
  data = await sdk.token.asset.getInfo({
45
- address: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
45
+ address: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
46
46
  code: 'BTC',
47
- issuer: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2tA',
47
+ issuer: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPzA',
48
48
  });
49
49
  data.errorCode.should.equal(11027);
50
50
 
51
51
  // BTCDEMO asset does not exist
52
52
  data = await sdk.token.asset.getInfo({
53
- address: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
53
+ address: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
54
54
  code: 'BTCDEMO',
55
- issuer: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
55
+ issuer: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
56
56
  });
57
57
  data.errorCode.should.equal(0);
58
58
  data.result.should.be.a('object');
@@ -4,17 +4,18 @@ require('chai').should();
4
4
  const OpenChainSDK = require('../index');
5
5
 
6
6
  const sdk = new OpenChainSDK({
7
- host: 'localhost/node/api',
7
+ host: 'nodeapi.aospub.com',
8
8
  });
9
9
 
10
10
  describe('Test asset issue operation', function() {
11
11
  it('test operation.assetIssueOperation(args)', function() {
12
12
  let data = sdk.operation.assetIssueOperation({
13
- sourceAddress: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
13
+ sourceAddress: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
14
14
  code: 'leo',
15
15
  assetAmount: '20000',
16
16
  metadata: 'oh my issue asset',
17
17
  });
18
+ console.log(data);
18
19
  data.errorCode.should.equal(0);
19
20
  data.result.should.be.a('object');
20
21
  data.result.should.have.property('operation');
@@ -41,7 +42,7 @@ describe('Test asset issue operation', function() {
41
42
 
42
43
  // Invalid code
43
44
  data = sdk.operation.assetIssueOperation({
44
- sourceAddress: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
45
+ sourceAddress: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
45
46
  code: '',
46
47
  assetAmount: '20000',
47
48
  metadata: 'oh my issue asset',
@@ -50,7 +51,7 @@ describe('Test asset issue operation', function() {
50
51
 
51
52
  // Invalid assetAmount
52
53
  data = sdk.operation.assetIssueOperation({
53
- sourceAddress: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
54
+ sourceAddress: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
54
55
  code: 'leo',
55
56
  assetAmount: '',
56
57
  metadata: 'oh my issue asset',
@@ -59,7 +60,7 @@ describe('Test asset issue operation', function() {
59
60
 
60
61
  // Invalid metadata
61
62
  data = sdk.operation.assetIssueOperation({
62
- sourceAddress: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
63
+ sourceAddress: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
63
64
  code: 'leo',
64
65
  assetAmount: '20000',
65
66
  metadata: '',
@@ -68,7 +69,7 @@ describe('Test asset issue operation', function() {
68
69
 
69
70
  // metadata is undefined
70
71
  data = sdk.operation.assetIssueOperation({
71
- sourceAddress: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
72
+ sourceAddress: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
72
73
  code: 'leo',
73
74
  assetAmount: '20000',
74
75
  });
@@ -4,17 +4,17 @@ require('chai').should();
4
4
  const OpenChainSDK = require('../index');
5
5
 
6
6
  const sdk = new OpenChainSDK({
7
- host: 'localhost/node/api',
7
+ host: 'nodeapi.aospub.com',
8
8
  });
9
9
 
10
10
  describe('Test asset send operation', function() {
11
11
 
12
12
  it('test operation.assetSendOperation(args)', function() {
13
13
  let data = sdk.operation.assetSendOperation({
14
- sourceAddress: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
15
- destAddress: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
14
+ sourceAddress: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
15
+ destAddress: 'YxLVtTueWjChHzajuFLQzM9HgP8AyHwRbGK5C',
16
16
  code: 'leo',
17
- issuer: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
17
+ issuer: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
18
18
  assetAmount: '100',
19
19
  metadata: 'oh my test send asset',
20
20
  });
@@ -27,10 +27,10 @@ describe('Test asset send operation', function() {
27
27
 
28
28
  // sourceAddress === destAddress
29
29
  data = sdk.operation.assetSendOperation({
30
- sourceAddress: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
31
- destAddress: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
30
+ sourceAddress: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
31
+ destAddress: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
32
32
  code: 'leo',
33
- issuer: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
33
+ issuer: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
34
34
  assetAmount: '100',
35
35
  metadata: 'oh my test send asset',
36
36
  });
@@ -39,9 +39,9 @@ describe('Test asset send operation', function() {
39
39
  // Invalid sourceAddress
40
40
  data = sdk.operation.assetSendOperation({
41
41
  sourceAddress: '',
42
- destAddress: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
42
+ destAddress: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
43
43
  code: 'leo',
44
- issuer: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
44
+ issuer: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
45
45
  assetAmount: '100',
46
46
  metadata: 'oh my test send asset',
47
47
  });
@@ -49,9 +49,9 @@ describe('Test asset send operation', function() {
49
49
 
50
50
  // sourceAddress is undefined
51
51
  data = sdk.operation.assetSendOperation({
52
- destAddress: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
52
+ destAddress: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
53
53
  code: 'leo',
54
- issuer: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
54
+ issuer: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
55
55
  assetAmount: '100',
56
56
  metadata: 'oh my test send asset',
57
57
  });
@@ -59,10 +59,10 @@ describe('Test asset send operation', function() {
59
59
 
60
60
  // Invalid code
61
61
  data = sdk.operation.assetSendOperation({
62
- sourceAddress: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
63
- destAddress: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
62
+ sourceAddress: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
63
+ destAddress: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
64
64
  code: '',
65
- issuer: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
65
+ issuer: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
66
66
  assetAmount: '100',
67
67
  metadata: 'oh my test send asset',
68
68
  });
@@ -70,10 +70,10 @@ describe('Test asset send operation', function() {
70
70
 
71
71
  // Invalid assetAmount
72
72
  data = sdk.operation.assetSendOperation({
73
- sourceAddress: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
74
- destAddress: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
73
+ sourceAddress: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
74
+ destAddress: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
75
75
  code: 'leo',
76
- issuer: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
76
+ issuer: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
77
77
  assetAmount: '',
78
78
  metadata: 'oh my test send asset',
79
79
  });
@@ -81,10 +81,10 @@ describe('Test asset send operation', function() {
81
81
 
82
82
  // Invalid metadata
83
83
  data = sdk.operation.assetSendOperation({
84
- sourceAddress: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
85
- destAddress: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
84
+ sourceAddress: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
85
+ destAddress: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
86
86
  code: 'leo',
87
- issuer: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
87
+ issuer: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
88
88
  assetAmount: '100',
89
89
  metadata: '',
90
90
  });
@@ -92,10 +92,10 @@ describe('Test asset send operation', function() {
92
92
 
93
93
  // metadata is undefined
94
94
  data = sdk.operation.assetSendOperation({
95
- sourceAddress: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
96
- destAddress: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
95
+ sourceAddress: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
96
+ destAddress: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
97
97
  code: 'leo',
98
- issuer: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
98
+ issuer: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
99
99
  assetAmount: '100',
100
100
  });
101
101
  data.errorCode.should.equal(0);
package/test/blob.test.js CHANGED
@@ -6,13 +6,13 @@ const BigNumber = require('bignumber.js');
6
6
  const OpenChainSDK = require('../index');
7
7
 
8
8
  const sdk = new OpenChainSDK({
9
- host: 'localhost/node/api',
9
+ host: 'nodeapi.aospub.com',
10
10
  });
11
11
 
12
12
  describe('Test build blob', function() {
13
13
 
14
14
  it('test transaction.buildBlob()', async () => {
15
- const sourceAddress = 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t';
15
+ const sourceAddress = 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz';
16
16
  const accountInfo = await sdk.account.getInfo(sourceAddress);
17
17
 
18
18
  if (accountInfo.errorCode !== 0) {
@@ -26,8 +26,8 @@ describe('Test build blob', function() {
26
26
  const acountActivateOperation = {
27
27
  type: 'activateAccount',
28
28
  data: {
29
- sourceAddress: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
30
- destAddress: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
29
+ sourceAddress: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
30
+ destAddress: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
31
31
  initBalance: '1000',
32
32
  metadata: 'Test Account Activate',
33
33
  },
@@ -4,7 +4,7 @@ require('chai').should();
4
4
  const OpenChainSDK = require('../index');
5
5
 
6
6
  const sdk = new OpenChainSDK({
7
- host: 'localhost/node/api',
7
+ host: 'nodeapi.aospub.com',
8
8
  });
9
9
 
10
10
  describe('Test openchain-sdk block service', function() {
@@ -23,7 +23,8 @@ describe('Test openchain-sdk block service', function() {
23
23
  });
24
24
 
25
25
  it('test block.getTransactions(blockNumber)', async() => {
26
- let data = await sdk.block.getTransactions('100');
26
+ let data = await sdk.block.getTransactions('11680');
27
+ console.log(data);
27
28
  data.errorCode.should.equal(0);
28
29
  data.result.should.be.a('object');
29
30
  data.result.should.have.property('total_count');
@@ -80,7 +81,8 @@ describe('Test openchain-sdk block service', function() {
80
81
  });
81
82
 
82
83
  it('test block.getValidators(blockNumber)', async() => {
83
- let data = await sdk.block.getValidators('100');
84
+ let data = await sdk.block.getValidators('200');
85
+ console.log('getValidators',data);
84
86
  data.errorCode.should.equal(0);
85
87
  data.result.should.be.a('object');
86
88
  data.result.should.have.property('validators').be.a('array');
@@ -5,14 +5,14 @@ const OpenChainSDK = require('../index');
5
5
 
6
6
 
7
7
  const sdk = new OpenChainSDK({
8
- host: 'localhost/node/api',
8
+ host: 'nodeapi.aospub.com',
9
9
  });
10
10
 
11
11
  describe('Test bu send operation', function() {
12
12
 
13
13
  it('test operation.buSendOperation()', function() {
14
14
  let data = sdk.operation.buSendOperation({
15
- sourceAddress: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
15
+ sourceAddress: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
16
16
  destAddress: 'adxSqKcX8wGCMKhzNUBoDWfbeQaMhfnGdtyG2',
17
17
  buAmount: '6000',
18
18
  metadata: 'oh my send bu',
@@ -26,7 +26,7 @@ describe('Test bu send operation', function() {
26
26
 
27
27
  // Invalid sourceAddress
28
28
  data = sdk.operation.buSendOperation({
29
- sourceAddress: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2tA',
29
+ sourceAddress: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPzA',
30
30
  destAddress: 'adxSqKcX8wGCMKhzNUBoDWfbeQaMhfnGdtyG2',
31
31
  buAmount: '6000',
32
32
  metadata: 'oh my send bu',
@@ -34,7 +34,7 @@ describe('Test bu send operation', function() {
34
34
  data.errorCode.should.equal(11002);
35
35
 
36
36
  data = sdk.operation.buSendOperation({
37
- sourceAddress: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
37
+ sourceAddress: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
38
38
  destAddress: 'adxSqKcX8wGCMKhzNUBoDWfbeQaMhfnGdtyG2A',
39
39
  buAmount: '6000',
40
40
  metadata: 'oh my send bu',
@@ -43,7 +43,7 @@ describe('Test bu send operation', function() {
43
43
 
44
44
  // Invalid buAmount
45
45
  data = sdk.operation.buSendOperation({
46
- sourceAddress: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
46
+ sourceAddress: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
47
47
  destAddress: 'adxSqKcX8wGCMKhzNUBoDWfbeQaMhfnGdtyG2',
48
48
  buAmount: '6000A',
49
49
  metadata: 'oh my send bu',
@@ -52,7 +52,7 @@ describe('Test bu send operation', function() {
52
52
 
53
53
  // Invalid metadata
54
54
  data = sdk.operation.buSendOperation({
55
- sourceAddress: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
55
+ sourceAddress: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
56
56
  destAddress: 'adxSqKcX8wGCMKhzNUBoDWfbeQaMhfnGdtyG2',
57
57
  buAmount: '6000',
58
58
  metadata: '',
@@ -4,7 +4,7 @@ require('chai').should();
4
4
  const OpenChainSDK = require('../index');
5
5
 
6
6
  const sdk = new OpenChainSDK({
7
- host: 'localhost/node/api',
7
+ host: 'nodeapi.aospub.com',
8
8
  });
9
9
 
10
10
  describe('Test openchain-sdk contract service', function() {
@@ -4,7 +4,7 @@ require('chai').should();
4
4
  const OpenChainSDK = require('../index');
5
5
 
6
6
  const sdk = new OpenChainSDK({
7
- host: 'localhost/node/api',
7
+ host: 'nodeapi.aospub.com',
8
8
  });
9
9
 
10
10
  describe('Test contract create operation', function() {
@@ -12,7 +12,7 @@ describe('Test contract create operation', function() {
12
12
  it('test operation.contractCreateOperation()', function() {
13
13
 
14
14
  let contractCreateOperation = sdk.operation.contractCreateOperation({
15
- sourceAddress: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
15
+ sourceAddress: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
16
16
  initBalance: '1000',
17
17
  type: 0,
18
18
  payload: 'afasfsaff',
@@ -28,7 +28,7 @@ describe('Test contract create operation', function() {
28
28
  const operationItem = contractCreateOperation.result.operation;
29
29
 
30
30
  const blobInfo = sdk.transaction.buildBlob({
31
- sourceAddress: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
31
+ sourceAddress: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
32
32
  gasPrice: '1000',
33
33
  feeLimit: '1000000',
34
34
  nonce: '123',
@@ -7,7 +7,7 @@ const co = require('co');
7
7
  const OpenChainSDK = require('../index');
8
8
 
9
9
  const sdk = new OpenChainSDK({
10
- host: 'localhost/node/api',
10
+ host: 'nodeapi.aospub.com',
11
11
  // host: '192.168.1.34:36002',
12
12
  });
13
13