@aeternity/aepp-sdk 8.2.1 → 10.0.0
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.
- package/CHANGELOG.md +216 -337
- package/README.md +16 -9
- package/dist/aepp-sdk.browser-script.js +1 -1
- package/dist/aepp-sdk.browser-script.js.LICENSE.txt +0 -9
- package/dist/aepp-sdk.browser-script.js.map +1 -1
- package/dist/aepp-sdk.browser.js +1 -1
- package/dist/aepp-sdk.browser.js.map +1 -1
- package/dist/aepp-sdk.js +1 -1
- package/dist/aepp-sdk.js.map +1 -1
- package/es/account/base.js +36 -120
- package/es/account/base.js.map +1 -1
- package/es/account/memory.js +17 -19
- package/es/account/memory.js.map +1 -1
- package/es/account/multiple.js +79 -156
- package/es/account/multiple.js.map +1 -1
- package/es/ae/aens.js +205 -626
- package/es/ae/aens.js.map +1 -1
- package/es/ae/contract.js +114 -918
- package/es/ae/contract.js.map +1 -1
- package/es/ae/index.js +90 -250
- package/es/ae/index.js.map +1 -1
- package/es/ae/oracle.js +136 -504
- package/es/ae/oracle.js.map +1 -1
- package/es/ae/universal.js.map +1 -1
- package/es/chain/index.js +12 -27
- package/es/chain/index.js.map +1 -1
- package/es/chain/node.js +289 -1020
- package/es/chain/node.js.map +1 -1
- package/es/channel/handlers.js +597 -1086
- package/es/channel/handlers.js.map +1 -1
- package/es/channel/index.js +238 -465
- package/es/channel/index.js.map +1 -1
- package/es/channel/internal.js +129 -301
- package/es/channel/internal.js.map +1 -1
- package/es/contract/aci/index.js +328 -495
- package/es/contract/aci/index.js.map +1 -1
- package/es/contract/aci/transformation.js +35 -711
- package/es/contract/aci/transformation.js.map +1 -1
- package/es/contract/compiler.js +131 -203
- package/es/contract/compiler.js.map +1 -1
- package/es/contract/ga/helpers.js +17 -122
- package/es/contract/ga/helpers.js.map +1 -1
- package/es/contract/ga/index.js +108 -249
- package/es/contract/ga/index.js.map +1 -1
- package/es/contract/index.js +7 -3
- package/es/contract/index.js.map +1 -1
- package/es/index.js +3 -3
- package/es/index.js.map +1 -1
- package/es/node-pool/index.js +57 -74
- package/es/node-pool/index.js.map +1 -1
- package/es/node.js +65 -161
- package/es/node.js.map +1 -1
- package/es/other.d.ts +1 -1
- package/es/tx/builder/helpers.js +62 -115
- package/es/tx/builder/helpers.js.map +1 -1
- package/es/tx/builder/index.js +218 -309
- package/es/tx/builder/index.js.map +1 -1
- package/es/tx/builder/schema.js +586 -573
- package/es/tx/builder/schema.js.map +1 -1
- package/es/tx/index.js +102 -13
- package/es/tx/index.js.map +1 -1
- package/es/tx/tx-object.js +114 -138
- package/es/tx/tx-object.js.map +1 -1
- package/es/tx/tx.js +810 -1586
- package/es/tx/tx.js.map +1 -1
- package/es/tx/validator.js +191 -426
- package/es/tx/validator.js.map +1 -1
- package/es/utils/aepp-wallet-communication/connection/browser-runtime.js +20 -23
- package/es/utils/aepp-wallet-communication/connection/browser-runtime.js.map +1 -1
- package/es/utils/aepp-wallet-communication/connection/browser-window-message.js +53 -80
- package/es/utils/aepp-wallet-communication/connection/browser-window-message.js.map +1 -1
- package/es/utils/aepp-wallet-communication/connection/index.js +2 -1
- package/es/utils/aepp-wallet-communication/connection/index.js.map +1 -1
- package/es/utils/aepp-wallet-communication/content-script-bridge.js +24 -19
- package/es/utils/aepp-wallet-communication/content-script-bridge.js.map +1 -1
- package/es/utils/aepp-wallet-communication/helpers.js +60 -105
- package/es/utils/aepp-wallet-communication/helpers.js.map +1 -1
- package/es/utils/aepp-wallet-communication/rpc/aepp-rpc.js +191 -514
- package/es/utils/aepp-wallet-communication/rpc/aepp-rpc.js.map +1 -1
- package/es/utils/aepp-wallet-communication/rpc/rpc-client.js +78 -93
- package/es/utils/aepp-wallet-communication/rpc/rpc-client.js.map +1 -1
- package/es/utils/aepp-wallet-communication/rpc/wallet-rpc.js +381 -613
- package/es/utils/aepp-wallet-communication/rpc/wallet-rpc.js.map +1 -1
- package/es/utils/aepp-wallet-communication/schema.js +43 -39
- package/es/utils/aepp-wallet-communication/schema.js.map +1 -1
- package/es/utils/aepp-wallet-communication/wallet-detector.js +32 -58
- package/es/utils/aepp-wallet-communication/wallet-detector.js.map +1 -1
- package/es/utils/amount-formatter.js +41 -61
- package/es/utils/amount-formatter.js.map +1 -1
- package/es/utils/async-init.js +28 -64
- package/es/utils/async-init.js.map +1 -1
- package/es/utils/bignumber.js +3 -11
- package/es/utils/bignumber.js.map +1 -1
- package/es/utils/bytes.js +5 -9
- package/es/utils/bytes.js.map +1 -1
- package/es/utils/crypto.js +41 -106
- package/es/utils/crypto.js.map +1 -1
- package/es/utils/hd-wallet.js +45 -81
- package/es/utils/hd-wallet.js.map +1 -1
- package/es/utils/json-big.js +16 -49
- package/es/utils/json-big.js.map +1 -1
- package/es/utils/keystore.js +81 -246
- package/es/utils/keystore.js.map +1 -1
- package/es/utils/mptree.js +88 -134
- package/es/utils/mptree.js.map +1 -1
- package/es/utils/other.js +10 -60
- package/es/utils/other.js.map +1 -1
- package/es/utils/semver-satisfies.js +9 -28
- package/es/utils/semver-satisfies.js.map +1 -1
- package/es/utils/string.js +4 -13
- package/es/utils/string.js.map +1 -1
- package/es/utils/swagger.js +87 -224
- package/es/utils/swagger.js.map +1 -1
- package/package.json +51 -44
- package/src/account/base.js +11 -10
- package/src/account/multiple.js +24 -18
- package/src/ae/aens.js +64 -61
- package/src/ae/contract.js +71 -248
- package/src/ae/index.js +34 -9
- package/src/ae/oracle.js +30 -22
- package/src/ae/universal.js +3 -1
- package/src/chain/index.js +10 -16
- package/src/chain/node.js +38 -38
- package/src/channel/handlers.js +10 -4
- package/src/channel/index.js +44 -20
- package/src/contract/aci/index.js +234 -112
- package/src/contract/aci/transformation.js +30 -422
- package/src/contract/compiler.js +50 -5
- package/src/contract/ga/helpers.js +6 -14
- package/src/contract/ga/index.js +28 -28
- package/src/contract/index.js +6 -2
- package/src/index.js +4 -4
- package/src/node-pool/index.js +24 -13
- package/src/node.js +29 -30
- package/src/tx/builder/helpers.js +31 -56
- package/src/tx/builder/index.js +67 -28
- package/src/tx/builder/schema.js +79 -121
- package/src/tx/index.js +101 -12
- package/src/tx/tx-object.js +25 -8
- package/src/tx/tx.js +229 -150
- package/src/tx/validator.js +134 -202
- package/src/utils/aepp-wallet-communication/connection/browser-runtime.js +3 -2
- package/src/utils/aepp-wallet-communication/connection/browser-window-message.js +25 -7
- package/src/utils/aepp-wallet-communication/connection/index.js +2 -1
- package/src/utils/aepp-wallet-communication/content-script-bridge.js +10 -4
- package/src/utils/aepp-wallet-communication/helpers.js +4 -2
- package/src/utils/aepp-wallet-communication/rpc/aepp-rpc.js +33 -12
- package/src/utils/aepp-wallet-communication/rpc/rpc-client.js +9 -5
- package/src/utils/aepp-wallet-communication/rpc/wallet-rpc.js +59 -29
- package/src/utils/aepp-wallet-communication/schema.js +1 -3
- package/src/utils/aepp-wallet-communication/wallet-detector.js +4 -1
- package/src/utils/amount-formatter.ts +1 -1
- package/src/utils/bignumber.ts +2 -1
- package/src/utils/crypto.js +4 -68
- package/src/utils/keystore.js +10 -2
- package/src/utils/other.ts +1 -1
- package/src/utils/semver-satisfies.ts +1 -1
- package/src/utils/swagger.js +22 -10
- package/src/contract/aci/helpers.js +0 -140
package/es/chain/node.js
CHANGED
|
@@ -1,37 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); if (enumerableOnly) { symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
18
|
-
|
|
19
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context30; _forEachInstanceProperty(_context30 = ownKeys(Object(source), true)).call(_context30, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors) { _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)); } else { var _context31; _forEachInstanceProperty(_context31 = ownKeys(Object(source))).call(_context31, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
20
|
-
|
|
21
|
-
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
22
|
-
import _JSON$stringify from "@babel/runtime-corejs3/core-js-stable/json/stringify";
|
|
23
|
-
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
|
24
|
-
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
25
|
-
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
|
26
|
-
import _findInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/find";
|
|
1
|
+
/*
|
|
2
|
+
* ISC License (ISC)
|
|
3
|
+
* Copyright (c) 2018 aeternity developers
|
|
4
|
+
*
|
|
5
|
+
* Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
* purpose with or without fee is hereby granted, provided that the above
|
|
7
|
+
* copyright notice and this permission notice appear in all copies.
|
|
8
|
+
*
|
|
9
|
+
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
10
|
+
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
11
|
+
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
12
|
+
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
13
|
+
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
14
|
+
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
15
|
+
* PERFORMANCE OF THIS SOFTWARE.
|
|
16
|
+
*/
|
|
27
17
|
import Chain from './';
|
|
28
18
|
import { AE_AMOUNT_FORMATS, formatAmount } from '../utils/amount-formatter';
|
|
29
|
-
import
|
|
19
|
+
import verifyTransaction from '../tx/validator';
|
|
30
20
|
import NodePool from '../node-pool';
|
|
31
|
-
import { assertedType } from '../utils/crypto';
|
|
32
21
|
import { pause } from '../utils/other';
|
|
33
|
-
import { isNameValid, produceNameId } from '../tx/builder/helpers';
|
|
34
|
-
import { DRY_RUN_ACCOUNT
|
|
22
|
+
import { isNameValid, produceNameId, decode } from '../tx/builder/helpers';
|
|
23
|
+
import { DRY_RUN_ACCOUNT } from '../tx/builder/schema';
|
|
35
24
|
/**
|
|
36
25
|
* ChainNode module
|
|
37
26
|
*
|
|
@@ -41,205 +30,94 @@ import { DRY_RUN_ACCOUNT, NAME_ID_KEY } from '../tx/builder/schema';
|
|
|
41
30
|
* @example import { ChainNode } from '@aeternity/aepp-sdk'
|
|
42
31
|
*/
|
|
43
32
|
|
|
44
|
-
function sendTransaction(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
33
|
+
async function sendTransaction(tx) {
|
|
34
|
+
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
35
|
+
const {
|
|
36
|
+
waitMined,
|
|
37
|
+
verify
|
|
38
|
+
} = { ...this.Ae.defaults,
|
|
39
|
+
...options
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
if (verify) {
|
|
43
|
+
const validation = await verifyTransaction(tx, this.selectedNode.instance);
|
|
44
|
+
|
|
45
|
+
if (validation.length) {
|
|
46
|
+
const message = 'Transaction verification errors: ' + validation.map(v => v.message).join(', ');
|
|
47
|
+
throw Object.assign(new Error(message), {
|
|
48
|
+
code: 'TX_VERIFICATION_ERROR',
|
|
57
49
|
validation,
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
txData,
|
|
63
|
-
_args = arguments;
|
|
64
|
-
|
|
65
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
66
|
-
while (1) {
|
|
67
|
-
switch (_context.prev = _context.next) {
|
|
68
|
-
case 0:
|
|
69
|
-
options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
|
|
70
|
-
_R$merge = _merge(this.Ae.defaults, options), waitMined = _R$merge.waitMined, verify = _R$merge.verify; // Verify transaction before broadcast
|
|
71
|
-
|
|
72
|
-
if (!(verify || typeof verify !== 'boolean' && this.verifyTxBeforeSend)) {
|
|
73
|
-
_context.next = 11;
|
|
74
|
-
break;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
_context.next = 5;
|
|
78
|
-
return this.unpackAndVerify(tx);
|
|
79
|
-
|
|
80
|
-
case 5:
|
|
81
|
-
_yield$this$unpackAnd = _context.sent;
|
|
82
|
-
validation = _yield$this$unpackAnd.validation;
|
|
83
|
-
txObject = _yield$this$unpackAnd.tx;
|
|
84
|
-
txType = _yield$this$unpackAnd.txType;
|
|
85
|
-
|
|
86
|
-
if (!validation.length) {
|
|
87
|
-
_context.next = 11;
|
|
88
|
-
break;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
throw _Object$assign(new Error('Transaction verification error: ' + _JSON$stringify(validation)), {
|
|
92
|
-
code: 'TX_VERIFICATION_ERROR',
|
|
93
|
-
errorData: {
|
|
94
|
-
validation: validation,
|
|
95
|
-
tx: txObject,
|
|
96
|
-
txType: txType
|
|
97
|
-
},
|
|
98
|
-
txHash: tx
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
case 11:
|
|
102
|
-
_context.prev = 11;
|
|
103
|
-
_context.next = 14;
|
|
104
|
-
return this.api.postTransaction({
|
|
105
|
-
tx: tx
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
case 14:
|
|
109
|
-
_yield$this$api$postT = _context.sent;
|
|
110
|
-
txHash = _yield$this$api$postT.txHash;
|
|
111
|
-
|
|
112
|
-
if (!waitMined) {
|
|
113
|
-
_context.next = 37;
|
|
114
|
-
break;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
_context.t0 = _objectSpread;
|
|
118
|
-
_context.t1 = _objectSpread;
|
|
119
|
-
_context.t2 = {};
|
|
120
|
-
_context.next = 22;
|
|
121
|
-
return this.poll(txHash, options);
|
|
122
|
-
|
|
123
|
-
case 22:
|
|
124
|
-
_context.t3 = _context.sent;
|
|
125
|
-
_context.t4 = (0, _context.t1)(_context.t2, _context.t3);
|
|
126
|
-
_context.t5 = {};
|
|
127
|
-
_context.t6 = {
|
|
128
|
-
rawTx: tx
|
|
129
|
-
};
|
|
130
|
-
txData = (0, _context.t0)(_context.t4, _context.t5, _context.t6);
|
|
131
|
-
|
|
132
|
-
if (!options.confirm) {
|
|
133
|
-
_context.next = 36;
|
|
134
|
-
break;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
_context.t7 = _objectSpread;
|
|
138
|
-
_context.t8 = _objectSpread({}, txData);
|
|
139
|
-
_context.t9 = {};
|
|
140
|
-
_context.next = 33;
|
|
141
|
-
return this.waitForTxConfirm(txHash, options);
|
|
142
|
-
|
|
143
|
-
case 33:
|
|
144
|
-
_context.t10 = _context.sent;
|
|
145
|
-
_context.t11 = {
|
|
146
|
-
confirmationHeight: _context.t10
|
|
147
|
-
};
|
|
148
|
-
return _context.abrupt("return", (0, _context.t7)(_context.t8, _context.t9, _context.t11));
|
|
149
|
-
|
|
150
|
-
case 36:
|
|
151
|
-
return _context.abrupt("return", txData);
|
|
152
|
-
|
|
153
|
-
case 37:
|
|
154
|
-
return _context.abrupt("return", {
|
|
155
|
-
hash: txHash,
|
|
156
|
-
rawTx: tx
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
case 40:
|
|
160
|
-
_context.prev = 40;
|
|
161
|
-
_context.t12 = _context["catch"](11);
|
|
162
|
-
throw _Object$assign(_context.t12, {
|
|
163
|
-
rawTx: tx,
|
|
164
|
-
verifyTx: function verifyTx() {
|
|
165
|
-
return _this.unpackAndVerify(tx);
|
|
166
|
-
}
|
|
167
|
-
});
|
|
50
|
+
transaction: tx
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
168
54
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
55
|
+
try {
|
|
56
|
+
const {
|
|
57
|
+
txHash
|
|
58
|
+
} = await this.api.postTransaction({
|
|
59
|
+
tx
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
if (waitMined) {
|
|
63
|
+
const txData = { ...(await this.poll(txHash, options)),
|
|
64
|
+
rawTx: tx
|
|
65
|
+
}; // wait for transaction confirmation
|
|
66
|
+
|
|
67
|
+
if (options.confirm) {
|
|
68
|
+
return { ...txData,
|
|
69
|
+
confirmationHeight: await this.waitForTxConfirm(txHash, options)
|
|
70
|
+
};
|
|
173
71
|
}
|
|
174
|
-
}, _callee, this, [[11, 40]]);
|
|
175
|
-
}));
|
|
176
|
-
return _sendTransaction.apply(this, arguments);
|
|
177
|
-
}
|
|
178
72
|
|
|
179
|
-
|
|
180
|
-
|
|
73
|
+
return txData;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return {
|
|
77
|
+
hash: txHash,
|
|
78
|
+
rawTx: tx
|
|
79
|
+
};
|
|
80
|
+
} catch (error) {
|
|
81
|
+
throw Object.assign(error, {
|
|
82
|
+
rawTx: tx,
|
|
83
|
+
verifyTx: () => verifyTransaction(tx, this.selectedNode.instance)
|
|
84
|
+
});
|
|
85
|
+
}
|
|
181
86
|
}
|
|
182
87
|
|
|
183
|
-
function
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
blockHeight = _yield$this$tx.blockHeight;
|
|
207
|
-
_context2.next = 8;
|
|
208
|
-
return this.awaitHeight(blockHeight + options.confirm, options);
|
|
209
|
-
|
|
210
|
-
case 8:
|
|
211
|
-
height = _context2.sent;
|
|
212
|
-
_context2.next = 11;
|
|
213
|
-
return this.tx(txHash);
|
|
214
|
-
|
|
215
|
-
case 11:
|
|
216
|
-
_yield$this$tx2 = _context2.sent;
|
|
217
|
-
newBlockHeight = _yield$this$tx2.blockHeight;
|
|
218
|
-
_context2.t0 = newBlockHeight;
|
|
219
|
-
_context2.next = _context2.t0 === -1 ? 16 : _context2.t0 === blockHeight ? 17 : 18;
|
|
220
|
-
break;
|
|
221
|
-
|
|
222
|
-
case 16:
|
|
223
|
-
throw new Error("Transaction ".concat(txHash, " is removed from chain"));
|
|
224
|
-
|
|
225
|
-
case 17:
|
|
226
|
-
return _context2.abrupt("return", height);
|
|
227
|
-
|
|
228
|
-
case 18:
|
|
229
|
-
return _context2.abrupt("return", waitForTxConfirm(txHash, options));
|
|
230
|
-
|
|
231
|
-
case 19:
|
|
232
|
-
case "end":
|
|
233
|
-
return _context2.stop();
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
}, _callee2, this);
|
|
237
|
-
}));
|
|
238
|
-
return _waitForTxConfirm.apply(this, arguments);
|
|
88
|
+
async function waitForTxConfirm(txHash) {
|
|
89
|
+
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
90
|
+
confirm: 3
|
|
91
|
+
};
|
|
92
|
+
options.confirm = options.confirm === true ? 3 : options.confirm;
|
|
93
|
+
const {
|
|
94
|
+
blockHeight
|
|
95
|
+
} = await this.tx(txHash);
|
|
96
|
+
const height = await this.awaitHeight(blockHeight + options.confirm, options);
|
|
97
|
+
const {
|
|
98
|
+
blockHeight: newBlockHeight
|
|
99
|
+
} = await this.tx(txHash);
|
|
100
|
+
|
|
101
|
+
switch (newBlockHeight) {
|
|
102
|
+
case -1:
|
|
103
|
+
throw new Error(`Transaction ${txHash} is removed from chain`);
|
|
104
|
+
|
|
105
|
+
case blockHeight:
|
|
106
|
+
return height;
|
|
107
|
+
|
|
108
|
+
default:
|
|
109
|
+
return waitForTxConfirm(txHash, options);
|
|
110
|
+
}
|
|
239
111
|
}
|
|
240
112
|
|
|
241
|
-
function getAccount(
|
|
242
|
-
|
|
113
|
+
async function getAccount(address) {
|
|
114
|
+
let {
|
|
115
|
+
height,
|
|
116
|
+
hash
|
|
117
|
+
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
118
|
+
if (height) return this.api.getAccountByPubkeyAndHeight(address, height);
|
|
119
|
+
if (hash) return this.api.getAccountByPubkeyAndHash(address, hash);
|
|
120
|
+
return this.api.getAccountByPubkey(address);
|
|
243
121
|
}
|
|
244
122
|
/**
|
|
245
123
|
* @function
|
|
@@ -247,738 +125,236 @@ function getAccount(_x3) {
|
|
|
247
125
|
*/
|
|
248
126
|
|
|
249
127
|
|
|
250
|
-
function
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
case 6:
|
|
282
|
-
case "end":
|
|
283
|
-
return _context3.stop();
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
}, _callee3, this);
|
|
287
|
-
}));
|
|
288
|
-
return _getAccount.apply(this, arguments);
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
function balance(_x4) {
|
|
292
|
-
return _balance.apply(this, arguments);
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
function _balance() {
|
|
296
|
-
_balance = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(address) {
|
|
297
|
-
var _ref3,
|
|
298
|
-
height,
|
|
299
|
-
hash,
|
|
300
|
-
_ref3$format,
|
|
301
|
-
format,
|
|
302
|
-
_yield$this$getAccoun,
|
|
303
|
-
balance,
|
|
304
|
-
_args4 = arguments;
|
|
305
|
-
|
|
306
|
-
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
307
|
-
while (1) {
|
|
308
|
-
switch (_context4.prev = _context4.next) {
|
|
309
|
-
case 0:
|
|
310
|
-
_ref3 = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : {}, height = _ref3.height, hash = _ref3.hash, _ref3$format = _ref3.format, format = _ref3$format === void 0 ? AE_AMOUNT_FORMATS.AETTOS : _ref3$format;
|
|
311
|
-
_context4.next = 3;
|
|
312
|
-
return this.getAccount(address, {
|
|
313
|
-
hash: hash,
|
|
314
|
-
height: height
|
|
315
|
-
});
|
|
316
|
-
|
|
317
|
-
case 3:
|
|
318
|
-
_yield$this$getAccoun = _context4.sent;
|
|
319
|
-
balance = _yield$this$getAccoun.balance;
|
|
320
|
-
return _context4.abrupt("return", formatAmount(balance, {
|
|
321
|
-
targetDenomination: format
|
|
322
|
-
}).toString());
|
|
323
|
-
|
|
324
|
-
case 6:
|
|
325
|
-
case "end":
|
|
326
|
-
return _context4.stop();
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
}, _callee4, this);
|
|
128
|
+
async function balance(address) {
|
|
129
|
+
let {
|
|
130
|
+
height,
|
|
131
|
+
hash,
|
|
132
|
+
format = AE_AMOUNT_FORMATS.AETTOS
|
|
133
|
+
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
134
|
+
const {
|
|
135
|
+
balance
|
|
136
|
+
} = await this.getAccount(address, {
|
|
137
|
+
hash,
|
|
138
|
+
height
|
|
139
|
+
});
|
|
140
|
+
return formatAmount(balance, {
|
|
141
|
+
targetDenomination: format
|
|
142
|
+
}).toString();
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
async function getBalance(address) {
|
|
146
|
+
let {
|
|
147
|
+
height,
|
|
148
|
+
hash,
|
|
149
|
+
format = AE_AMOUNT_FORMATS.AETTOS
|
|
150
|
+
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
151
|
+
const {
|
|
152
|
+
balance
|
|
153
|
+
} = await this.getAccount(address, {
|
|
154
|
+
hash,
|
|
155
|
+
height
|
|
156
|
+
}).catch(_ => ({
|
|
157
|
+
balance: 0
|
|
330
158
|
}));
|
|
331
|
-
return
|
|
159
|
+
return formatAmount(balance, {
|
|
160
|
+
targetDenomination: format
|
|
161
|
+
}).toString();
|
|
332
162
|
}
|
|
333
163
|
|
|
334
|
-
function
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
function _getBalance() {
|
|
339
|
-
_getBalance = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(address) {
|
|
340
|
-
var _ref4,
|
|
341
|
-
height,
|
|
342
|
-
hash,
|
|
343
|
-
_ref4$format,
|
|
344
|
-
format,
|
|
345
|
-
_yield$this$getAccoun2,
|
|
346
|
-
balance,
|
|
347
|
-
_args5 = arguments;
|
|
348
|
-
|
|
349
|
-
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
350
|
-
while (1) {
|
|
351
|
-
switch (_context5.prev = _context5.next) {
|
|
352
|
-
case 0:
|
|
353
|
-
_ref4 = _args5.length > 1 && _args5[1] !== undefined ? _args5[1] : {}, height = _ref4.height, hash = _ref4.hash, _ref4$format = _ref4.format, format = _ref4$format === void 0 ? AE_AMOUNT_FORMATS.AETTOS : _ref4$format;
|
|
354
|
-
_context5.next = 3;
|
|
355
|
-
return this.getAccount(address, {
|
|
356
|
-
hash: hash,
|
|
357
|
-
height: height
|
|
358
|
-
})["catch"](function (_) {
|
|
359
|
-
return {
|
|
360
|
-
balance: 0
|
|
361
|
-
};
|
|
362
|
-
});
|
|
363
|
-
|
|
364
|
-
case 3:
|
|
365
|
-
_yield$this$getAccoun2 = _context5.sent;
|
|
366
|
-
balance = _yield$this$getAccoun2.balance;
|
|
367
|
-
return _context5.abrupt("return", formatAmount(balance, {
|
|
368
|
-
targetDenomination: format
|
|
369
|
-
}).toString());
|
|
164
|
+
async function tx(hash) {
|
|
165
|
+
let info = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
166
|
+
const tx = await this.api.getTransactionByHash(hash);
|
|
370
167
|
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
return _getBalance.apply(this, arguments);
|
|
379
|
-
}
|
|
168
|
+
if (['ContractCreateTx', 'ContractCallTx', 'ChannelForceProgressTx'].includes(tx.tx.type) && info && tx.blockHeight !== -1) {
|
|
169
|
+
try {
|
|
170
|
+
return { ...tx,
|
|
171
|
+
...(await this.getTxInfo(hash))
|
|
172
|
+
};
|
|
173
|
+
} catch (e) {}
|
|
174
|
+
}
|
|
380
175
|
|
|
381
|
-
|
|
382
|
-
return _tx.apply(this, arguments);
|
|
176
|
+
return tx;
|
|
383
177
|
}
|
|
384
178
|
|
|
385
|
-
function
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
tx,
|
|
391
|
-
_args6 = arguments;
|
|
392
|
-
return _regeneratorRuntime.wrap(function _callee6$(_context7) {
|
|
393
|
-
while (1) {
|
|
394
|
-
switch (_context7.prev = _context7.next) {
|
|
395
|
-
case 0:
|
|
396
|
-
info = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : true;
|
|
397
|
-
_context7.next = 3;
|
|
398
|
-
return this.api.getTransactionByHash(hash);
|
|
399
|
-
|
|
400
|
-
case 3:
|
|
401
|
-
tx = _context7.sent;
|
|
402
|
-
|
|
403
|
-
if (!(_includesInstanceProperty(_context6 = ['ContractCreateTx', 'ContractCallTx', 'ChannelForceProgressTx']).call(_context6, tx.tx.type) && info && tx.blockHeight !== -1)) {
|
|
404
|
-
_context7.next = 16;
|
|
405
|
-
break;
|
|
406
|
-
}
|
|
179
|
+
async function height() {
|
|
180
|
+
try {
|
|
181
|
+
if (!this._heightPromise) {
|
|
182
|
+
this._heightPromise = this.api.getCurrentKeyBlockHeight();
|
|
183
|
+
}
|
|
407
184
|
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
return this.getTxInfo(hash);
|
|
413
|
-
|
|
414
|
-
case 10:
|
|
415
|
-
_context7.t2 = _context7.sent;
|
|
416
|
-
return _context7.abrupt("return", (0, _context7.t0)(_context7.t1, _context7.t2));
|
|
417
|
-
|
|
418
|
-
case 14:
|
|
419
|
-
_context7.prev = 14;
|
|
420
|
-
_context7.t3 = _context7["catch"](5);
|
|
421
|
-
|
|
422
|
-
case 16:
|
|
423
|
-
return _context7.abrupt("return", tx);
|
|
424
|
-
|
|
425
|
-
case 17:
|
|
426
|
-
case "end":
|
|
427
|
-
return _context7.stop();
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
}, _callee6, this, [[5, 14]]);
|
|
431
|
-
}));
|
|
432
|
-
return _tx.apply(this, arguments);
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
function height() {
|
|
436
|
-
return _height.apply(this, arguments);
|
|
185
|
+
return (await this._heightPromise).height;
|
|
186
|
+
} finally {
|
|
187
|
+
delete this._heightPromise;
|
|
188
|
+
}
|
|
437
189
|
}
|
|
438
190
|
|
|
439
|
-
function
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
_context8.prev = 0;
|
|
446
|
-
|
|
447
|
-
if (!this._heightPromise) {
|
|
448
|
-
this._heightPromise = this.api.getCurrentKeyBlockHeight();
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
_context8.next = 4;
|
|
452
|
-
return this._heightPromise;
|
|
191
|
+
async function awaitHeight(height) {
|
|
192
|
+
let {
|
|
193
|
+
interval = 5000,
|
|
194
|
+
attempts = 20
|
|
195
|
+
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
196
|
+
let currentHeight;
|
|
453
197
|
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
delete this._heightPromise;
|
|
460
|
-
return _context8.finish(5);
|
|
461
|
-
|
|
462
|
-
case 8:
|
|
463
|
-
case "end":
|
|
464
|
-
return _context8.stop();
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
}, _callee7, this, [[0,, 5, 8]]);
|
|
468
|
-
}));
|
|
469
|
-
return _height.apply(this, arguments);
|
|
470
|
-
}
|
|
198
|
+
for (let i = 0; i < attempts; i++) {
|
|
199
|
+
if (i) await pause(interval);
|
|
200
|
+
currentHeight = await this.height();
|
|
201
|
+
if (currentHeight >= height) return currentHeight;
|
|
202
|
+
}
|
|
471
203
|
|
|
472
|
-
|
|
473
|
-
return _awaitHeight.apply(this, arguments);
|
|
204
|
+
throw new Error(`Giving up after ${(attempts - 1) * interval}ms, current height: ${currentHeight}, desired height: ${height}`);
|
|
474
205
|
}
|
|
475
206
|
/**
|
|
476
207
|
* @deprecated
|
|
477
208
|
*/
|
|
478
209
|
|
|
479
210
|
|
|
480
|
-
function
|
|
481
|
-
|
|
482
|
-
var _context9, _context10;
|
|
483
|
-
|
|
484
|
-
var _ref5,
|
|
485
|
-
_ref5$interval,
|
|
486
|
-
interval,
|
|
487
|
-
_ref5$attempts,
|
|
488
|
-
attempts,
|
|
489
|
-
currentHeight,
|
|
490
|
-
i,
|
|
491
|
-
_args8 = arguments;
|
|
492
|
-
|
|
493
|
-
return _regeneratorRuntime.wrap(function _callee8$(_context11) {
|
|
494
|
-
while (1) {
|
|
495
|
-
switch (_context11.prev = _context11.next) {
|
|
496
|
-
case 0:
|
|
497
|
-
_ref5 = _args8.length > 1 && _args8[1] !== undefined ? _args8[1] : {}, _ref5$interval = _ref5.interval, interval = _ref5$interval === void 0 ? 5000 : _ref5$interval, _ref5$attempts = _ref5.attempts, attempts = _ref5$attempts === void 0 ? 20 : _ref5$attempts;
|
|
498
|
-
i = 0;
|
|
499
|
-
|
|
500
|
-
case 2:
|
|
501
|
-
if (!(i < attempts)) {
|
|
502
|
-
_context11.next = 14;
|
|
503
|
-
break;
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
if (!i) {
|
|
507
|
-
_context11.next = 6;
|
|
508
|
-
break;
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
_context11.next = 6;
|
|
512
|
-
return pause(interval);
|
|
513
|
-
|
|
514
|
-
case 6:
|
|
515
|
-
_context11.next = 8;
|
|
516
|
-
return this.height();
|
|
517
|
-
|
|
518
|
-
case 8:
|
|
519
|
-
currentHeight = _context11.sent;
|
|
520
|
-
|
|
521
|
-
if (!(currentHeight >= height)) {
|
|
522
|
-
_context11.next = 11;
|
|
523
|
-
break;
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
return _context11.abrupt("return", currentHeight);
|
|
527
|
-
|
|
528
|
-
case 11:
|
|
529
|
-
i++;
|
|
530
|
-
_context11.next = 2;
|
|
531
|
-
break;
|
|
532
|
-
|
|
533
|
-
case 14:
|
|
534
|
-
throw new Error(_concatInstanceProperty(_context9 = _concatInstanceProperty(_context10 = "Giving up after ".concat((attempts - 1) * interval, "ms, current height: ")).call(_context10, currentHeight, ", desired height: ")).call(_context9, height));
|
|
535
|
-
|
|
536
|
-
case 15:
|
|
537
|
-
case "end":
|
|
538
|
-
return _context11.stop();
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
}, _callee8, this);
|
|
542
|
-
}));
|
|
543
|
-
return _awaitHeight.apply(this, arguments);
|
|
211
|
+
async function topBlock() {
|
|
212
|
+
return this.api.getTopHeader();
|
|
544
213
|
}
|
|
545
214
|
|
|
546
|
-
function
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
while (1) {
|
|
554
|
-
switch (_context12.prev = _context12.next) {
|
|
555
|
-
case 0:
|
|
556
|
-
return _context12.abrupt("return", this.api.getTopHeader());
|
|
557
|
-
|
|
558
|
-
case 1:
|
|
559
|
-
case "end":
|
|
560
|
-
return _context12.stop();
|
|
561
|
-
}
|
|
562
|
-
}
|
|
563
|
-
}, _callee9, this);
|
|
564
|
-
}));
|
|
565
|
-
return _topBlock.apply(this, arguments);
|
|
566
|
-
}
|
|
567
|
-
|
|
568
|
-
function poll(_x8) {
|
|
569
|
-
return _poll.apply(this, arguments);
|
|
570
|
-
}
|
|
571
|
-
|
|
572
|
-
function _poll() {
|
|
573
|
-
_poll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(th) {
|
|
574
|
-
var _context13;
|
|
575
|
-
|
|
576
|
-
var _ref6,
|
|
577
|
-
_ref6$blocks,
|
|
578
|
-
blocks,
|
|
579
|
-
_ref6$interval,
|
|
580
|
-
interval,
|
|
581
|
-
_ref6$allowUnsynced,
|
|
582
|
-
allowUnsynced,
|
|
583
|
-
max,
|
|
584
|
-
_tx2,
|
|
585
|
-
_args10 = arguments;
|
|
215
|
+
async function poll(th) {
|
|
216
|
+
let {
|
|
217
|
+
blocks = 10,
|
|
218
|
+
interval = 500,
|
|
219
|
+
allowUnsynced = false
|
|
220
|
+
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
221
|
+
const max = (await this.height()) + blocks;
|
|
586
222
|
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
switch (_context14.prev = _context14.next) {
|
|
590
|
-
case 0:
|
|
591
|
-
_ref6 = _args10.length > 1 && _args10[1] !== undefined ? _args10[1] : {}, _ref6$blocks = _ref6.blocks, blocks = _ref6$blocks === void 0 ? 10 : _ref6$blocks, _ref6$interval = _ref6.interval, interval = _ref6$interval === void 0 ? 5000 : _ref6$interval, _ref6$allowUnsynced = _ref6.allowUnsynced, allowUnsynced = _ref6$allowUnsynced === void 0 ? false : _ref6$allowUnsynced;
|
|
592
|
-
_context14.next = 3;
|
|
593
|
-
return this.height();
|
|
223
|
+
do {
|
|
224
|
+
const tx = await this.tx(th).catch(_ => null);
|
|
594
225
|
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
max = _context14.t0 + _context14.t1;
|
|
226
|
+
if (tx && (tx.blockHeight !== -1 || allowUnsynced && tx.height)) {
|
|
227
|
+
return tx;
|
|
228
|
+
}
|
|
599
229
|
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
return this.tx(th)["catch"](function (_) {
|
|
603
|
-
return null;
|
|
604
|
-
});
|
|
230
|
+
await pause(interval);
|
|
231
|
+
} while ((await this.height()) < max);
|
|
605
232
|
|
|
606
|
-
|
|
607
|
-
_tx2 = _context14.sent;
|
|
608
|
-
|
|
609
|
-
if (!(_tx2 && (_tx2.blockHeight !== -1 || allowUnsynced && _tx2.height))) {
|
|
610
|
-
_context14.next = 11;
|
|
611
|
-
break;
|
|
612
|
-
}
|
|
613
|
-
|
|
614
|
-
return _context14.abrupt("return", _tx2);
|
|
615
|
-
|
|
616
|
-
case 11:
|
|
617
|
-
_context14.next = 13;
|
|
618
|
-
return pause(interval);
|
|
619
|
-
|
|
620
|
-
case 13:
|
|
621
|
-
_context14.next = 15;
|
|
622
|
-
return this.height();
|
|
623
|
-
|
|
624
|
-
case 15:
|
|
625
|
-
_context14.t2 = _context14.sent;
|
|
626
|
-
_context14.t3 = max;
|
|
627
|
-
|
|
628
|
-
if (_context14.t2 < _context14.t3) {
|
|
629
|
-
_context14.next = 6;
|
|
630
|
-
break;
|
|
631
|
-
}
|
|
632
|
-
|
|
633
|
-
case 18:
|
|
634
|
-
throw new Error(_concatInstanceProperty(_context13 = "Giving up after ".concat(blocks, " blocks mined, transaction hash: ")).call(_context13, th));
|
|
635
|
-
|
|
636
|
-
case 19:
|
|
637
|
-
case "end":
|
|
638
|
-
return _context14.stop();
|
|
639
|
-
}
|
|
640
|
-
}
|
|
641
|
-
}, _callee10, this);
|
|
642
|
-
}));
|
|
643
|
-
return _poll.apply(this, arguments);
|
|
233
|
+
throw new Error(`Giving up after ${blocks} blocks mined, transaction hash: ${th}`);
|
|
644
234
|
}
|
|
645
235
|
|
|
646
|
-
function getTxInfo(
|
|
647
|
-
|
|
236
|
+
async function getTxInfo(hash) {
|
|
237
|
+
const result = await this.api.getTransactionInfoByHash(hash);
|
|
238
|
+
return result.callInfo || result;
|
|
648
239
|
}
|
|
649
240
|
|
|
650
|
-
function
|
|
651
|
-
|
|
652
|
-
var result;
|
|
653
|
-
return _regeneratorRuntime.wrap(function _callee11$(_context15) {
|
|
654
|
-
while (1) {
|
|
655
|
-
switch (_context15.prev = _context15.next) {
|
|
656
|
-
case 0:
|
|
657
|
-
_context15.next = 2;
|
|
658
|
-
return this.api.getTransactionInfoByHash(hash);
|
|
659
|
-
|
|
660
|
-
case 2:
|
|
661
|
-
result = _context15.sent;
|
|
662
|
-
return _context15.abrupt("return", result.callInfo || result);
|
|
663
|
-
|
|
664
|
-
case 4:
|
|
665
|
-
case "end":
|
|
666
|
-
return _context15.stop();
|
|
667
|
-
}
|
|
668
|
-
}
|
|
669
|
-
}, _callee11, this);
|
|
670
|
-
}));
|
|
671
|
-
return _getTxInfo.apply(this, arguments);
|
|
241
|
+
async function mempool() {
|
|
242
|
+
return this.api.getPendingTransactions();
|
|
672
243
|
}
|
|
673
244
|
|
|
674
|
-
function
|
|
675
|
-
return
|
|
245
|
+
async function getCurrentGeneration() {
|
|
246
|
+
return this.api.getCurrentGeneration();
|
|
676
247
|
}
|
|
677
248
|
|
|
678
|
-
function
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
switch (_context16.prev = _context16.next) {
|
|
683
|
-
case 0:
|
|
684
|
-
return _context16.abrupt("return", this.api.getPendingTransactions());
|
|
685
|
-
|
|
686
|
-
case 1:
|
|
687
|
-
case "end":
|
|
688
|
-
return _context16.stop();
|
|
689
|
-
}
|
|
690
|
-
}
|
|
691
|
-
}, _callee12, this);
|
|
692
|
-
}));
|
|
693
|
-
return _mempool.apply(this, arguments);
|
|
249
|
+
async function getGeneration(hashOrHeight) {
|
|
250
|
+
if (typeof hashOrHeight === 'string') return this.api.getGenerationByHash(hashOrHeight);
|
|
251
|
+
if (typeof hashOrHeight === 'number') return this.api.getGenerationByHeight(hashOrHeight);
|
|
252
|
+
throw new Error('Invalid param, param must be hash or height');
|
|
694
253
|
}
|
|
695
254
|
|
|
696
|
-
function
|
|
697
|
-
return
|
|
255
|
+
async function getMicroBlockTransactions(hash) {
|
|
256
|
+
return (await this.api.getMicroBlockTransactionsByHash(hash)).transactions;
|
|
698
257
|
}
|
|
699
258
|
|
|
700
|
-
function
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
switch (_context17.prev = _context17.next) {
|
|
705
|
-
case 0:
|
|
706
|
-
return _context17.abrupt("return", this.api.getCurrentGeneration());
|
|
707
|
-
|
|
708
|
-
case 1:
|
|
709
|
-
case "end":
|
|
710
|
-
return _context17.stop();
|
|
711
|
-
}
|
|
712
|
-
}
|
|
713
|
-
}, _callee13, this);
|
|
714
|
-
}));
|
|
715
|
-
return _getCurrentGeneration.apply(this, arguments);
|
|
259
|
+
async function getKeyBlock(hashOrHeight) {
|
|
260
|
+
if (typeof hashOrHeight === 'string') return this.api.getKeyBlockByHash(hashOrHeight);
|
|
261
|
+
if (typeof hashOrHeight === 'number') return this.api.getKeyBlockByHeight(hashOrHeight);
|
|
262
|
+
throw new Error('Invalid param, param must be hash or height');
|
|
716
263
|
}
|
|
717
264
|
|
|
718
|
-
function
|
|
719
|
-
return
|
|
265
|
+
async function getMicroBlockHeader(hash) {
|
|
266
|
+
return this.api.getMicroBlockHeaderByHash(hash);
|
|
720
267
|
}
|
|
721
268
|
|
|
722
|
-
function
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
case "end":
|
|
748
|
-
return _context18.stop();
|
|
749
|
-
}
|
|
750
|
-
}
|
|
751
|
-
}, _callee14, this);
|
|
752
|
-
}));
|
|
753
|
-
return _getGeneration.apply(this, arguments);
|
|
269
|
+
async function txDryRun(tx, accountAddress, options) {
|
|
270
|
+
const {
|
|
271
|
+
results: [{
|
|
272
|
+
result,
|
|
273
|
+
reason,
|
|
274
|
+
...resultPayload
|
|
275
|
+
}],
|
|
276
|
+
...other
|
|
277
|
+
} = await this.api.protectedDryRunTxs({ ...options,
|
|
278
|
+
txs: [{
|
|
279
|
+
tx
|
|
280
|
+
}],
|
|
281
|
+
accounts: [{
|
|
282
|
+
pubKey: accountAddress,
|
|
283
|
+
amount: DRY_RUN_ACCOUNT.amount
|
|
284
|
+
}]
|
|
285
|
+
});
|
|
286
|
+
if (result === 'ok') return { ...resultPayload,
|
|
287
|
+
...other
|
|
288
|
+
};
|
|
289
|
+
throw Object.assign(new Error('Dry run error, ' + reason), {
|
|
290
|
+
tx,
|
|
291
|
+
accountAddress,
|
|
292
|
+
options
|
|
293
|
+
});
|
|
754
294
|
}
|
|
755
295
|
|
|
756
|
-
function
|
|
757
|
-
return
|
|
296
|
+
async function getContractByteCode(contractId) {
|
|
297
|
+
return this.api.getContractCode(contractId);
|
|
758
298
|
}
|
|
759
299
|
|
|
760
|
-
function
|
|
761
|
-
|
|
762
|
-
return _regeneratorRuntime.wrap(function _callee15$(_context19) {
|
|
763
|
-
while (1) {
|
|
764
|
-
switch (_context19.prev = _context19.next) {
|
|
765
|
-
case 0:
|
|
766
|
-
_context19.next = 2;
|
|
767
|
-
return this.api.getMicroBlockTransactionsByHash(hash);
|
|
768
|
-
|
|
769
|
-
case 2:
|
|
770
|
-
return _context19.abrupt("return", _context19.sent.transactions);
|
|
771
|
-
|
|
772
|
-
case 3:
|
|
773
|
-
case "end":
|
|
774
|
-
return _context19.stop();
|
|
775
|
-
}
|
|
776
|
-
}
|
|
777
|
-
}, _callee15, this);
|
|
778
|
-
}));
|
|
779
|
-
return _getMicroBlockTransactions.apply(this, arguments);
|
|
780
|
-
}
|
|
781
|
-
|
|
782
|
-
function getKeyBlock(_x12) {
|
|
783
|
-
return _getKeyBlock.apply(this, arguments);
|
|
784
|
-
}
|
|
785
|
-
|
|
786
|
-
function _getKeyBlock() {
|
|
787
|
-
_getKeyBlock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16(hashOrHeight) {
|
|
788
|
-
return _regeneratorRuntime.wrap(function _callee16$(_context20) {
|
|
789
|
-
while (1) {
|
|
790
|
-
switch (_context20.prev = _context20.next) {
|
|
791
|
-
case 0:
|
|
792
|
-
if (!(typeof hashOrHeight === 'string')) {
|
|
793
|
-
_context20.next = 2;
|
|
794
|
-
break;
|
|
795
|
-
}
|
|
796
|
-
|
|
797
|
-
return _context20.abrupt("return", this.api.getKeyBlockByHash(hashOrHeight));
|
|
798
|
-
|
|
799
|
-
case 2:
|
|
800
|
-
if (!(typeof hashOrHeight === 'number')) {
|
|
801
|
-
_context20.next = 4;
|
|
802
|
-
break;
|
|
803
|
-
}
|
|
804
|
-
|
|
805
|
-
return _context20.abrupt("return", this.api.getKeyBlockByHeight(hashOrHeight));
|
|
806
|
-
|
|
807
|
-
case 4:
|
|
808
|
-
throw new Error('Invalid param, param must be hash or height');
|
|
809
|
-
|
|
810
|
-
case 5:
|
|
811
|
-
case "end":
|
|
812
|
-
return _context20.stop();
|
|
813
|
-
}
|
|
814
|
-
}
|
|
815
|
-
}, _callee16, this);
|
|
816
|
-
}));
|
|
817
|
-
return _getKeyBlock.apply(this, arguments);
|
|
300
|
+
async function getContract(contractId) {
|
|
301
|
+
return this.api.getContract(contractId);
|
|
818
302
|
}
|
|
819
303
|
|
|
820
|
-
function
|
|
821
|
-
return
|
|
822
|
-
}
|
|
823
|
-
|
|
824
|
-
function _getMicroBlockHeader() {
|
|
825
|
-
_getMicroBlockHeader = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17(hash) {
|
|
826
|
-
return _regeneratorRuntime.wrap(function _callee17$(_context21) {
|
|
827
|
-
while (1) {
|
|
828
|
-
switch (_context21.prev = _context21.next) {
|
|
829
|
-
case 0:
|
|
830
|
-
return _context21.abrupt("return", this.api.getMicroBlockHeaderByHash(hash));
|
|
831
|
-
|
|
832
|
-
case 1:
|
|
833
|
-
case "end":
|
|
834
|
-
return _context21.stop();
|
|
835
|
-
}
|
|
836
|
-
}
|
|
837
|
-
}, _callee17, this);
|
|
838
|
-
}));
|
|
839
|
-
return _getMicroBlockHeader.apply(this, arguments);
|
|
840
|
-
}
|
|
841
|
-
|
|
842
|
-
function txDryRun(_x14, _x15, _x16) {
|
|
843
|
-
return _txDryRun.apply(this, arguments);
|
|
844
|
-
}
|
|
845
|
-
|
|
846
|
-
function _txDryRun() {
|
|
847
|
-
_txDryRun = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18(tx, accountAddress, options) {
|
|
848
|
-
var _yield$this$api$prote, _yield$this$api$prote2, _yield$this$api$prote3, result, reason, resultPayload, other;
|
|
849
|
-
|
|
850
|
-
return _regeneratorRuntime.wrap(function _callee18$(_context22) {
|
|
851
|
-
while (1) {
|
|
852
|
-
switch (_context22.prev = _context22.next) {
|
|
853
|
-
case 0:
|
|
854
|
-
_context22.next = 2;
|
|
855
|
-
return this.api.protectedDryRunTxs(_objectSpread(_objectSpread({}, options), {}, {
|
|
856
|
-
txs: [{
|
|
857
|
-
tx: tx
|
|
858
|
-
}],
|
|
859
|
-
accounts: [{
|
|
860
|
-
pubKey: accountAddress,
|
|
861
|
-
amount: DRY_RUN_ACCOUNT.amount
|
|
862
|
-
}]
|
|
863
|
-
}));
|
|
864
|
-
|
|
865
|
-
case 2:
|
|
866
|
-
_yield$this$api$prote = _context22.sent;
|
|
867
|
-
_yield$this$api$prote2 = _slicedToArray(_yield$this$api$prote.results, 1);
|
|
868
|
-
_yield$this$api$prote3 = _yield$this$api$prote2[0];
|
|
869
|
-
result = _yield$this$api$prote3.result;
|
|
870
|
-
reason = _yield$this$api$prote3.reason;
|
|
871
|
-
resultPayload = _objectWithoutProperties(_yield$this$api$prote3, _excluded);
|
|
872
|
-
other = _objectWithoutProperties(_yield$this$api$prote, _excluded2);
|
|
873
|
-
|
|
874
|
-
if (!(result === 'ok')) {
|
|
875
|
-
_context22.next = 11;
|
|
876
|
-
break;
|
|
877
|
-
}
|
|
878
|
-
|
|
879
|
-
return _context22.abrupt("return", _objectSpread(_objectSpread({}, resultPayload), other));
|
|
880
|
-
|
|
881
|
-
case 11:
|
|
882
|
-
throw _Object$assign(new Error('Dry run error, ' + reason), {
|
|
883
|
-
tx: tx,
|
|
884
|
-
accountAddress: accountAddress,
|
|
885
|
-
options: options
|
|
886
|
-
});
|
|
887
|
-
|
|
888
|
-
case 12:
|
|
889
|
-
case "end":
|
|
890
|
-
return _context22.stop();
|
|
891
|
-
}
|
|
892
|
-
}
|
|
893
|
-
}, _callee18, this);
|
|
894
|
-
}));
|
|
895
|
-
return _txDryRun.apply(this, arguments);
|
|
896
|
-
}
|
|
897
|
-
|
|
898
|
-
function getContractByteCode(_x17) {
|
|
899
|
-
return _getContractByteCode.apply(this, arguments);
|
|
900
|
-
}
|
|
901
|
-
|
|
902
|
-
function _getContractByteCode() {
|
|
903
|
-
_getContractByteCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee19(contractId) {
|
|
904
|
-
return _regeneratorRuntime.wrap(function _callee19$(_context23) {
|
|
905
|
-
while (1) {
|
|
906
|
-
switch (_context23.prev = _context23.next) {
|
|
907
|
-
case 0:
|
|
908
|
-
return _context23.abrupt("return", this.api.getContractCode(contractId));
|
|
909
|
-
|
|
910
|
-
case 1:
|
|
911
|
-
case "end":
|
|
912
|
-
return _context23.stop();
|
|
913
|
-
}
|
|
914
|
-
}
|
|
915
|
-
}, _callee19, this);
|
|
916
|
-
}));
|
|
917
|
-
return _getContractByteCode.apply(this, arguments);
|
|
918
|
-
}
|
|
919
|
-
|
|
920
|
-
function getContract(_x18) {
|
|
921
|
-
return _getContract.apply(this, arguments);
|
|
922
|
-
}
|
|
923
|
-
|
|
924
|
-
function _getContract() {
|
|
925
|
-
_getContract = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee20(contractId) {
|
|
926
|
-
return _regeneratorRuntime.wrap(function _callee20$(_context24) {
|
|
927
|
-
while (1) {
|
|
928
|
-
switch (_context24.prev = _context24.next) {
|
|
929
|
-
case 0:
|
|
930
|
-
return _context24.abrupt("return", this.api.getContract(contractId));
|
|
931
|
-
|
|
932
|
-
case 1:
|
|
933
|
-
case "end":
|
|
934
|
-
return _context24.stop();
|
|
935
|
-
}
|
|
936
|
-
}
|
|
937
|
-
}, _callee20, this);
|
|
938
|
-
}));
|
|
939
|
-
return _getContract.apply(this, arguments);
|
|
940
|
-
}
|
|
941
|
-
|
|
942
|
-
function getName(_x19) {
|
|
943
|
-
return _getName.apply(this, arguments);
|
|
304
|
+
async function getName(name) {
|
|
305
|
+
return this.api.getNameEntryByName(name);
|
|
944
306
|
}
|
|
945
307
|
/**
|
|
946
308
|
* Resolve AENS name and return name hash
|
|
947
309
|
* @param {String} nameOrId
|
|
948
|
-
* @param {String}
|
|
310
|
+
* @param {String} key in AENS pointers record
|
|
949
311
|
* @param {Object} [options]
|
|
950
|
-
* @param {Boolean} [options.verify]
|
|
951
|
-
*
|
|
312
|
+
* @param {Boolean} [options.verify] To ensure that name exist and have a corresponding pointer
|
|
313
|
+
* // TODO: avoid that to don't trust to current api gateway
|
|
314
|
+
* @param {Boolean} [options.resolveByNode] Enables pointer resolving using node
|
|
952
315
|
* @return {String} Address or AENS name hash
|
|
953
316
|
*/
|
|
954
317
|
|
|
955
318
|
|
|
956
|
-
function
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
case 0:
|
|
962
|
-
return _context25.abrupt("return", this.api.getNameEntryByName(name));
|
|
319
|
+
async function resolveName(nameOrId, key) {
|
|
320
|
+
let {
|
|
321
|
+
verify,
|
|
322
|
+
resolveByNode
|
|
323
|
+
} = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
963
324
|
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
325
|
+
if (!nameOrId || typeof nameOrId !== 'string') {
|
|
326
|
+
throw new Error(`Name or address should be a string: ${nameOrId}`);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
try {
|
|
330
|
+
decode(nameOrId);
|
|
331
|
+
return nameOrId;
|
|
332
|
+
} catch (error) {}
|
|
333
|
+
|
|
334
|
+
if (isNameValid(nameOrId)) {
|
|
335
|
+
if (verify || resolveByNode) {
|
|
336
|
+
const name = await this.api.getNameEntryByName(nameOrId).catch(_ => null);
|
|
337
|
+
if (!name) throw new Error(`Name not found: ${nameOrId}`);
|
|
338
|
+
const pointer = name.pointers.find(pointer => pointer.key === key);
|
|
339
|
+
|
|
340
|
+
if (!pointer) {
|
|
341
|
+
throw new Error(`Name ${nameOrId} don't have pointers for ${key}`);
|
|
968
342
|
}
|
|
969
|
-
}, _callee21, this);
|
|
970
|
-
}));
|
|
971
|
-
return _getName.apply(this, arguments);
|
|
972
|
-
}
|
|
973
343
|
|
|
974
|
-
|
|
975
|
-
|
|
344
|
+
if (resolveByNode) return pointer.id;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
return produceNameId(nameOrId);
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
throw new Error(`Invalid name or address: ${nameOrId}`);
|
|
976
351
|
}
|
|
977
352
|
/**
|
|
978
353
|
* ChainNode Stamp
|
|
979
354
|
*
|
|
980
355
|
* This is implementation of {@link module:@aeternity/aepp-sdk/es/chain--Chain}
|
|
981
|
-
* composed with {@link module:@aeternity/aepp-sdk/es/contract/node--ContractNodeAPI} and
|
|
356
|
+
* composed with {@link module:@aeternity/aepp-sdk/es/contract/node--ContractNodeAPI} and
|
|
357
|
+
* {@link module:@aeternity/aepp-sdk/es/oracle/node--OracleNodeAPI}
|
|
982
358
|
* @function
|
|
983
359
|
* @alias module:@aeternity/aepp-sdk/es/chain/node
|
|
984
360
|
* @rtype Stamp
|
|
@@ -988,137 +364,30 @@ function resolveName(_x20, _x21) {
|
|
|
988
364
|
*/
|
|
989
365
|
|
|
990
366
|
|
|
991
|
-
|
|
992
|
-
_resolveName = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee22(nameOrId, prefix) {
|
|
993
|
-
var _ref7,
|
|
994
|
-
verify,
|
|
995
|
-
resolveByNode,
|
|
996
|
-
prefixes,
|
|
997
|
-
_context26,
|
|
998
|
-
_context27,
|
|
999
|
-
_context28,
|
|
1000
|
-
name,
|
|
1001
|
-
pointer,
|
|
1002
|
-
_args22 = arguments;
|
|
1003
|
-
|
|
1004
|
-
return _regeneratorRuntime.wrap(function _callee22$(_context29) {
|
|
1005
|
-
while (1) {
|
|
1006
|
-
switch (_context29.prev = _context29.next) {
|
|
1007
|
-
case 0:
|
|
1008
|
-
_ref7 = _args22.length > 2 && _args22[2] !== undefined ? _args22[2] : {}, verify = _ref7.verify, resolveByNode = _ref7.resolveByNode;
|
|
1009
|
-
|
|
1010
|
-
if (!(!nameOrId || typeof nameOrId !== 'string')) {
|
|
1011
|
-
_context29.next = 3;
|
|
1012
|
-
break;
|
|
1013
|
-
}
|
|
1014
|
-
|
|
1015
|
-
throw new Error('Invalid name or address. Should be a string');
|
|
1016
|
-
|
|
1017
|
-
case 3:
|
|
1018
|
-
prefixes = _Object$keys(NAME_ID_KEY);
|
|
1019
|
-
|
|
1020
|
-
if (_includesInstanceProperty(prefixes).call(prefixes, prefix)) {
|
|
1021
|
-
_context29.next = 6;
|
|
1022
|
-
break;
|
|
1023
|
-
}
|
|
1024
|
-
|
|
1025
|
-
throw new Error(_concatInstanceProperty(_context26 = "Invalid prefix ".concat(prefix, ". Should be one of [")).call(_context26, prefixes, "]"));
|
|
1026
|
-
|
|
1027
|
-
case 6:
|
|
1028
|
-
if (!assertedType(nameOrId, prefix, true)) {
|
|
1029
|
-
_context29.next = 8;
|
|
1030
|
-
break;
|
|
1031
|
-
}
|
|
1032
|
-
|
|
1033
|
-
return _context29.abrupt("return", nameOrId);
|
|
1034
|
-
|
|
1035
|
-
case 8:
|
|
1036
|
-
if (!isNameValid(nameOrId)) {
|
|
1037
|
-
_context29.next = 20;
|
|
1038
|
-
break;
|
|
1039
|
-
}
|
|
1040
|
-
|
|
1041
|
-
if (!(resolveByNode || verify)) {
|
|
1042
|
-
_context29.next = 19;
|
|
1043
|
-
break;
|
|
1044
|
-
}
|
|
1045
|
-
|
|
1046
|
-
_context29.next = 12;
|
|
1047
|
-
return this.getName(nameOrId)["catch"](function (_) {
|
|
1048
|
-
return null;
|
|
1049
|
-
});
|
|
1050
|
-
|
|
1051
|
-
case 12:
|
|
1052
|
-
name = _context29.sent;
|
|
1053
|
-
|
|
1054
|
-
if (name) {
|
|
1055
|
-
_context29.next = 15;
|
|
1056
|
-
break;
|
|
1057
|
-
}
|
|
1058
|
-
|
|
1059
|
-
throw new Error('Name not found');
|
|
1060
|
-
|
|
1061
|
-
case 15:
|
|
1062
|
-
pointer = _findInstanceProperty(_context27 = name.pointers).call(_context27, function (_ref8) {
|
|
1063
|
-
var id = _ref8.id;
|
|
1064
|
-
return id.split('_')[0] === prefix;
|
|
1065
|
-
});
|
|
1066
|
-
|
|
1067
|
-
if (pointer) {
|
|
1068
|
-
_context29.next = 18;
|
|
1069
|
-
break;
|
|
1070
|
-
}
|
|
1071
|
-
|
|
1072
|
-
throw new Error(_concatInstanceProperty(_context28 = "Name ".concat(nameOrId, " do not have pointers for ")).call(_context28, prefix));
|
|
1073
|
-
|
|
1074
|
-
case 18:
|
|
1075
|
-
return _context29.abrupt("return", pointer.id);
|
|
1076
|
-
|
|
1077
|
-
case 19:
|
|
1078
|
-
return _context29.abrupt("return", produceNameId(nameOrId));
|
|
1079
|
-
|
|
1080
|
-
case 20:
|
|
1081
|
-
throw new Error('Invalid name or address');
|
|
1082
|
-
|
|
1083
|
-
case 21:
|
|
1084
|
-
case "end":
|
|
1085
|
-
return _context29.stop();
|
|
1086
|
-
}
|
|
1087
|
-
}
|
|
1088
|
-
}, _callee22, this);
|
|
1089
|
-
}));
|
|
1090
|
-
return _resolveName.apply(this, arguments);
|
|
1091
|
-
}
|
|
1092
|
-
|
|
1093
|
-
var ChainNode = Chain.compose(TransactionValidator, NodePool, {
|
|
1094
|
-
init: function init(_ref) {
|
|
1095
|
-
var _ref$verifyTx = _ref.verifyTx,
|
|
1096
|
-
verifyTx = _ref$verifyTx === void 0 ? true : _ref$verifyTx;
|
|
1097
|
-
this.verifyTxBeforeSend = verifyTx;
|
|
1098
|
-
},
|
|
367
|
+
const ChainNode = Chain.compose(NodePool, {
|
|
1099
368
|
methods: {
|
|
1100
|
-
sendTransaction
|
|
1101
|
-
balance
|
|
1102
|
-
getBalance
|
|
1103
|
-
getAccount
|
|
1104
|
-
topBlock
|
|
1105
|
-
tx
|
|
1106
|
-
height
|
|
1107
|
-
awaitHeight
|
|
1108
|
-
poll
|
|
1109
|
-
getTxInfo
|
|
1110
|
-
mempool
|
|
1111
|
-
getCurrentGeneration
|
|
1112
|
-
getGeneration
|
|
1113
|
-
getMicroBlockHeader
|
|
1114
|
-
getMicroBlockTransactions
|
|
1115
|
-
getKeyBlock
|
|
1116
|
-
txDryRun
|
|
1117
|
-
getContractByteCode
|
|
1118
|
-
getContract
|
|
1119
|
-
getName
|
|
1120
|
-
waitForTxConfirm
|
|
1121
|
-
resolveName
|
|
369
|
+
sendTransaction,
|
|
370
|
+
balance,
|
|
371
|
+
getBalance,
|
|
372
|
+
getAccount,
|
|
373
|
+
topBlock,
|
|
374
|
+
tx,
|
|
375
|
+
height,
|
|
376
|
+
awaitHeight,
|
|
377
|
+
poll,
|
|
378
|
+
getTxInfo,
|
|
379
|
+
mempool,
|
|
380
|
+
getCurrentGeneration,
|
|
381
|
+
getGeneration,
|
|
382
|
+
getMicroBlockHeader,
|
|
383
|
+
getMicroBlockTransactions,
|
|
384
|
+
getKeyBlock,
|
|
385
|
+
txDryRun,
|
|
386
|
+
getContractByteCode,
|
|
387
|
+
getContract,
|
|
388
|
+
getName,
|
|
389
|
+
waitForTxConfirm,
|
|
390
|
+
resolveName
|
|
1122
391
|
}
|
|
1123
392
|
});
|
|
1124
393
|
export default ChainNode;
|