@aeternity/aepp-sdk 9.0.1 → 11.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/README.md +15 -14
- package/dist/aepp-sdk.browser-script.js +1 -1
- package/dist/aepp-sdk.browser-script.js.LICENSE.txt +7 -36
- 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.mjs +179 -0
- package/es/account/base.mjs.map +1 -0
- package/es/account/memory.mjs +99 -0
- package/es/account/memory.mjs.map +1 -0
- package/es/account/multiple.mjs +179 -0
- package/es/account/multiple.mjs.map +1 -0
- package/es/ae/aens.mjs +404 -0
- package/es/ae/aens.mjs.map +1 -0
- package/es/ae/{aepp.js → aepp.mjs} +9 -9
- package/es/ae/aepp.mjs.map +1 -0
- package/es/ae/contract.mjs +159 -0
- package/es/ae/contract.mjs.map +1 -0
- package/es/ae/index.mjs +207 -0
- package/es/ae/index.mjs.map +1 -0
- package/es/ae/oracle.mjs +339 -0
- package/es/ae/oracle.mjs.map +1 -0
- package/es/ae/{universal.js → universal.mjs} +10 -10
- package/es/ae/universal.mjs.map +1 -0
- package/es/ae/{wallet.js → wallet.mjs} +10 -10
- package/es/ae/wallet.mjs.map +1 -0
- package/es/aepp-wallet-communication/schema.d.ts +74 -0
- package/es/bignumber.d.ts +1 -7
- package/es/chain/{index.js → index.mjs} +29 -9
- package/es/chain/index.mjs.map +1 -0
- package/es/chain/node.mjs +442 -0
- package/es/chain/node.mjs.map +1 -0
- package/es/channel/handlers.mjs +1110 -0
- package/es/channel/handlers.mjs.map +1 -0
- package/es/channel/{index.js → index.mjs} +245 -472
- package/es/channel/index.mjs.map +1 -0
- package/es/channel/internal.mjs +283 -0
- package/es/channel/internal.mjs.map +1 -0
- package/es/contract/aci.mjs +477 -0
- package/es/contract/aci.mjs.map +1 -0
- package/es/contract/compiler.mjs +115 -0
- package/es/contract/compiler.mjs.map +1 -0
- package/es/contract/ga/helpers.mjs +30 -0
- package/es/contract/ga/helpers.mjs.map +1 -0
- package/es/contract/ga/index.mjs +178 -0
- package/es/contract/ga/index.mjs.map +1 -0
- package/es/errors.d.ts +284 -0
- package/es/index.mjs +57 -0
- package/es/index.mjs.map +1 -0
- package/es/node-pool/index.mjs +188 -0
- package/es/node-pool/index.mjs.map +1 -0
- package/es/node.mjs +133 -0
- package/es/node.mjs.map +1 -0
- package/es/other.d.ts +1 -1
- package/es/tx/builder/field-types.mjs +74 -0
- package/es/tx/builder/field-types.mjs.map +1 -0
- package/es/tx/builder/helpers.mjs +363 -0
- package/es/tx/builder/helpers.mjs.map +1 -0
- package/es/tx/builder/index.mjs +606 -0
- package/es/tx/builder/index.mjs.map +1 -0
- package/es/tx/builder/schema.mjs +760 -0
- package/es/tx/builder/schema.mjs.map +1 -0
- package/es/tx/{index.js → index.mjs} +107 -15
- package/es/tx/index.mjs.map +1 -0
- package/es/tx/tx-object.mjs +283 -0
- package/es/tx/tx-object.mjs.map +1 -0
- package/es/tx/tx.mjs +938 -0
- package/es/tx/tx.mjs.map +1 -0
- package/es/tx/validator.mjs +247 -0
- package/es/tx/validator.mjs.map +1 -0
- package/es/typings/blakejs/index.d.mjs +2 -0
- package/es/typings/blakejs/{index.d.js.map → index.d.mjs.map} +1 -1
- package/es/utils/aepp-wallet-communication/connection/{browser-runtime.js → browser-runtime.mjs} +27 -29
- package/es/utils/aepp-wallet-communication/connection/browser-runtime.mjs.map +1 -0
- package/es/utils/aepp-wallet-communication/connection/browser-window-message.mjs +183 -0
- package/es/utils/aepp-wallet-communication/connection/browser-window-message.mjs.map +1 -0
- package/es/utils/aepp-wallet-communication/connection/{index.js → index.mjs} +7 -3
- package/es/utils/aepp-wallet-communication/connection/index.mjs.map +1 -0
- package/es/utils/aepp-wallet-communication/{content-script-bridge.js → content-script-bridge.mjs} +29 -23
- package/es/utils/aepp-wallet-communication/content-script-bridge.mjs.map +1 -0
- package/es/utils/aepp-wallet-communication/helpers.mjs +92 -0
- package/es/utils/aepp-wallet-communication/helpers.mjs.map +1 -0
- package/es/utils/aepp-wallet-communication/rpc/aepp-rpc.mjs +375 -0
- package/es/utils/aepp-wallet-communication/rpc/aepp-rpc.mjs.map +1 -0
- package/es/utils/aepp-wallet-communication/rpc/rpc-client.mjs +275 -0
- package/es/utils/aepp-wallet-communication/rpc/rpc-client.mjs.map +1 -0
- package/es/utils/aepp-wallet-communication/rpc/wallet-rpc.mjs +541 -0
- package/es/utils/aepp-wallet-communication/rpc/wallet-rpc.mjs.map +1 -0
- package/es/utils/aepp-wallet-communication/schema.mjs +102 -0
- package/es/utils/aepp-wallet-communication/schema.mjs.map +1 -0
- package/es/utils/aepp-wallet-communication/wallet-detector.mjs +110 -0
- package/es/utils/aepp-wallet-communication/wallet-detector.mjs.map +1 -0
- package/es/utils/amount-formatter.mjs +139 -0
- package/es/utils/amount-formatter.mjs.map +1 -0
- package/es/utils/async-init.mjs +64 -0
- package/es/utils/async-init.mjs.map +1 -0
- package/es/utils/bignumber.mjs +21 -0
- package/es/utils/bignumber.mjs.map +1 -0
- package/es/utils/{bytes.js → bytes.mjs} +16 -12
- package/es/utils/bytes.mjs.map +1 -0
- package/es/utils/{crypto-ts.js → crypto-ts.mjs} +11 -3
- package/es/utils/crypto-ts.mjs.map +1 -0
- package/es/utils/crypto.mjs +239 -0
- package/es/utils/crypto.mjs.map +1 -0
- package/es/utils/errors.mjs +689 -0
- package/es/utils/errors.mjs.map +1 -0
- package/es/utils/hd-wallet.mjs +111 -0
- package/es/utils/hd-wallet.mjs.map +1 -0
- package/es/utils/json-big.mjs +45 -0
- package/es/utils/json-big.mjs.map +1 -0
- package/es/utils/keystore.mjs +240 -0
- package/es/utils/keystore.mjs.map +1 -0
- package/es/utils/mptree.mjs +161 -0
- package/es/utils/mptree.mjs.map +1 -0
- package/es/utils/other.mjs +43 -0
- package/es/utils/other.mjs.map +1 -0
- package/es/utils/semver-satisfies.mjs +16 -0
- package/es/utils/semver-satisfies.mjs.map +1 -0
- package/es/utils/{string.js → string.mjs} +5 -14
- package/es/utils/string.mjs.map +1 -0
- package/es/utils/swagger.mjs +164 -0
- package/es/utils/swagger.mjs.map +1 -0
- package/package.json +55 -62
- package/src/account/base.js +3 -1
- package/src/account/memory.js +13 -8
- package/src/account/multiple.js +31 -22
- package/src/ae/aens.js +75 -77
- package/src/ae/aepp.js +2 -2
- package/src/ae/contract.js +27 -291
- package/src/ae/index.js +9 -7
- package/src/ae/oracle.js +51 -28
- package/src/ae/universal.js +4 -2
- package/src/ae/wallet.js +2 -2
- package/src/chain/index.js +29 -6
- package/src/chain/node.js +95 -67
- package/src/channel/handlers.js +30 -21
- package/src/channel/index.js +44 -20
- package/src/channel/internal.js +30 -24
- package/src/contract/aci.js +376 -0
- package/src/contract/compiler.js +41 -91
- package/src/contract/ga/helpers.js +10 -13
- package/src/contract/ga/index.js +42 -33
- package/src/index.js +9 -10
- package/src/node-pool/index.js +29 -17
- package/src/node.js +33 -36
- package/src/tx/builder/field-types.js +61 -0
- package/src/tx/builder/helpers.js +126 -84
- package/src/tx/builder/index.js +83 -41
- package/src/tx/builder/schema.js +50 -40
- package/src/tx/index.js +101 -12
- package/src/tx/tx-object.js +35 -15
- package/src/tx/tx.js +232 -153
- package/src/tx/validator.js +34 -12
- package/src/utils/aepp-wallet-communication/connection/browser-runtime.js +11 -5
- package/src/utils/aepp-wallet-communication/connection/browser-window-message.js +35 -13
- package/src/utils/aepp-wallet-communication/connection/index.js +2 -1
- package/src/utils/aepp-wallet-communication/content-script-bridge.js +14 -7
- package/src/utils/aepp-wallet-communication/helpers.js +6 -14
- package/src/utils/aepp-wallet-communication/rpc/aepp-rpc.js +107 -60
- package/src/utils/aepp-wallet-communication/rpc/rpc-client.js +24 -11
- package/src/utils/aepp-wallet-communication/rpc/wallet-rpc.js +98 -56
- package/src/utils/aepp-wallet-communication/schema.ts +80 -0
- package/src/utils/aepp-wallet-communication/wallet-detector.js +6 -2
- package/src/utils/amount-formatter.ts +4 -3
- package/src/utils/async-init.js +10 -6
- package/src/utils/bignumber.ts +3 -10
- package/src/utils/bytes.ts +3 -2
- package/src/utils/crypto-ts.ts +2 -2
- package/src/utils/crypto.js +10 -144
- package/src/utils/errors.ts +683 -0
- package/src/utils/hd-wallet.js +11 -26
- package/src/utils/keystore.js +57 -53
- package/src/utils/mptree.ts +12 -6
- package/src/utils/other.ts +1 -1
- package/src/utils/semver-satisfies.ts +1 -1
- package/src/utils/swagger.js +75 -45
- package/es/account/base.js +0 -259
- package/es/account/base.js.map +0 -1
- package/es/account/memory.js +0 -86
- package/es/account/memory.js.map +0 -1
- package/es/account/multiple.js +0 -267
- package/es/account/multiple.js.map +0 -1
- package/es/ae/aens.js +0 -829
- package/es/ae/aens.js.map +0 -1
- package/es/ae/aepp.js.map +0 -1
- package/es/ae/contract.js +0 -985
- package/es/ae/contract.js.map +0 -1
- package/es/ae/index.js +0 -442
- package/es/ae/index.js.map +0 -1
- package/es/ae/oracle.js +0 -690
- package/es/ae/oracle.js.map +0 -1
- package/es/ae/universal.js.map +0 -1
- package/es/ae/wallet.js.map +0 -1
- package/es/chain/index.js.map +0 -1
- package/es/chain/node.js +0 -1119
- package/es/chain/node.js.map +0 -1
- package/es/channel/handlers.js +0 -1601
- package/es/channel/handlers.js.map +0 -1
- package/es/channel/index.js.map +0 -1
- package/es/channel/internal.js +0 -438
- package/es/channel/internal.js.map +0 -1
- package/es/contract/aci/helpers.js +0 -298
- package/es/contract/aci/helpers.js.map +0 -1
- package/es/contract/aci/index.js +0 -517
- package/es/contract/aci/index.js.map +0 -1
- package/es/contract/aci/transformation.js +0 -742
- package/es/contract/aci/transformation.js.map +0 -1
- package/es/contract/compiler.js +0 -316
- package/es/contract/compiler.js.map +0 -1
- package/es/contract/ga/helpers.js +0 -120
- package/es/contract/ga/helpers.js.map +0 -1
- package/es/contract/ga/index.js +0 -307
- package/es/contract/ga/index.js.map +0 -1
- package/es/contract/index.js +0 -158
- package/es/contract/index.js.map +0 -1
- package/es/index.js +0 -57
- package/es/index.js.map +0 -1
- package/es/node-pool/index.js +0 -204
- package/es/node-pool/index.js.map +0 -1
- package/es/node.js +0 -228
- package/es/node.js.map +0 -1
- package/es/tx/builder/helpers.js +0 -355
- package/es/tx/builder/helpers.js.map +0 -1
- package/es/tx/builder/index.js +0 -686
- package/es/tx/builder/index.js.map +0 -1
- package/es/tx/builder/schema.js +0 -695
- package/es/tx/builder/schema.js.map +0 -1
- package/es/tx/index.js.map +0 -1
- package/es/tx/tx-object.js +0 -297
- package/es/tx/tx-object.js.map +0 -1
- package/es/tx/tx.js +0 -1757
- package/es/tx/tx.js.map +0 -1
- package/es/tx/validator.js +0 -344
- package/es/tx/validator.js.map +0 -1
- package/es/typings/blakejs/index.d.js +0 -2
- package/es/utils/aepp-wallet-communication/connection/browser-runtime.js.map +0 -1
- package/es/utils/aepp-wallet-communication/connection/browser-window-message.js +0 -211
- package/es/utils/aepp-wallet-communication/connection/browser-window-message.js.map +0 -1
- package/es/utils/aepp-wallet-communication/connection/index.js.map +0 -1
- package/es/utils/aepp-wallet-communication/content-script-bridge.js.map +0 -1
- package/es/utils/aepp-wallet-communication/helpers.js +0 -148
- package/es/utils/aepp-wallet-communication/helpers.js.map +0 -1
- package/es/utils/aepp-wallet-communication/rpc/aepp-rpc.js +0 -652
- package/es/utils/aepp-wallet-communication/rpc/aepp-rpc.js.map +0 -1
- package/es/utils/aepp-wallet-communication/rpc/rpc-client.js +0 -285
- package/es/utils/aepp-wallet-communication/rpc/rpc-client.js.map +0 -1
- package/es/utils/aepp-wallet-communication/rpc/wallet-rpc.js +0 -763
- package/es/utils/aepp-wallet-communication/rpc/wallet-rpc.js.map +0 -1
- package/es/utils/aepp-wallet-communication/schema.js +0 -103
- package/es/utils/aepp-wallet-communication/schema.js.map +0 -1
- package/es/utils/aepp-wallet-communication/wallet-detector.js +0 -135
- package/es/utils/aepp-wallet-communication/wallet-detector.js.map +0 -1
- package/es/utils/amount-formatter.js +0 -152
- package/es/utils/amount-formatter.js.map +0 -1
- package/es/utils/async-init.js +0 -103
- package/es/utils/async-init.js.map +0 -1
- package/es/utils/bignumber.js +0 -36
- package/es/utils/bignumber.js.map +0 -1
- package/es/utils/bytes.js.map +0 -1
- package/es/utils/crypto-ts.js.map +0 -1
- package/es/utils/crypto.js +0 -358
- package/es/utils/crypto.js.map +0 -1
- package/es/utils/hd-wallet.js +0 -148
- package/es/utils/hd-wallet.js.map +0 -1
- package/es/utils/json-big.js +0 -78
- package/es/utils/json-big.js.map +0 -1
- package/es/utils/keystore.js +0 -393
- package/es/utils/keystore.js.map +0 -1
- package/es/utils/mptree.js +0 -198
- package/es/utils/mptree.js.map +0 -1
- package/es/utils/other.js +0 -93
- package/es/utils/other.js.map +0 -1
- package/es/utils/semver-satisfies.js +0 -35
- package/es/utils/semver-satisfies.js.map +0 -1
- package/es/utils/string.js.map +0 -1
- package/es/utils/swagger.js +0 -269
- package/es/utils/swagger.js.map +0 -1
- package/src/contract/aci/helpers.js +0 -140
- package/src/contract/aci/index.js +0 -191
- package/src/contract/aci/transformation.js +0 -464
- package/src/contract/index.js +0 -159
- package/src/utils/aepp-wallet-communication/schema.js +0 -110
package/es/tx/tx.js
DELETED
|
@@ -1,1757 +0,0 @@
|
|
|
1
|
-
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
|
2
|
-
import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
|
|
3
|
-
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
4
|
-
import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor";
|
|
5
|
-
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
|
6
|
-
import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
|
|
7
|
-
import _Object$defineProperties from "@babel/runtime-corejs3/core-js-stable/object/define-properties";
|
|
8
|
-
import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
|
|
9
|
-
import _last from "ramda/src/last";
|
|
10
|
-
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/objectWithoutProperties";
|
|
11
|
-
import _merge from "ramda/src/merge";
|
|
12
|
-
import _head from "ramda/src/head";
|
|
13
|
-
import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
|
|
14
|
-
import _contains from "ramda/src/contains";
|
|
15
|
-
import _asyncToGenerator from "@babel/runtime-corejs3/helpers/asyncToGenerator";
|
|
16
|
-
var _excluded = ["tx", "payerId"];
|
|
17
|
-
import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
|
|
18
|
-
|
|
19
|
-
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; }
|
|
20
|
-
|
|
21
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context24; _forEachInstanceProperty(_context24 = ownKeys(Object(source), true)).call(_context24, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors) { _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)); } else { var _context25; _forEachInstanceProperty(_context25 = ownKeys(Object(source))).call(_context25, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
22
|
-
|
|
23
|
-
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
24
|
-
import _parseInt from "@babel/runtime-corejs3/core-js-stable/parse-int";
|
|
25
|
-
import ChainNode from '../chain/node';
|
|
26
|
-
import Tx from './';
|
|
27
|
-
import { buildTx, calculateFee, unpackTx } from './builder';
|
|
28
|
-
import { ABI_VERSIONS, MIN_GAS_PRICE, PROTOCOL_VM_ABI, TX_TYPE, TX_TTL } from './builder/schema';
|
|
29
|
-
import { buildContractId } from './builder/helpers';
|
|
30
|
-
import { TxObject } from './tx-object';
|
|
31
|
-
|
|
32
|
-
function spendTx(_x) {
|
|
33
|
-
return _spendTx.apply(this, arguments);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function _spendTx() {
|
|
37
|
-
_spendTx = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref) {
|
|
38
|
-
var senderId,
|
|
39
|
-
recipientId,
|
|
40
|
-
amount,
|
|
41
|
-
_ref$payload,
|
|
42
|
-
payload,
|
|
43
|
-
_yield$this$prepareTx,
|
|
44
|
-
fee,
|
|
45
|
-
ttl,
|
|
46
|
-
nonce,
|
|
47
|
-
_ref22,
|
|
48
|
-
tx,
|
|
49
|
-
_args = arguments;
|
|
50
|
-
|
|
51
|
-
return _regeneratorRuntime.wrap(function _callee$(_context3) {
|
|
52
|
-
while (1) {
|
|
53
|
-
switch (_context3.prev = _context3.next) {
|
|
54
|
-
case 0:
|
|
55
|
-
senderId = _ref.senderId, recipientId = _ref.recipientId, amount = _ref.amount, _ref$payload = _ref.payload, payload = _ref$payload === void 0 ? '' : _ref$payload;
|
|
56
|
-
_context3.next = 3;
|
|
57
|
-
return this.prepareTxParams(TX_TYPE.spend, _objectSpread(_objectSpread({
|
|
58
|
-
senderId: senderId
|
|
59
|
-
}, _head(_args)), {}, {
|
|
60
|
-
payload: payload
|
|
61
|
-
}));
|
|
62
|
-
|
|
63
|
-
case 3:
|
|
64
|
-
_yield$this$prepareTx = _context3.sent;
|
|
65
|
-
fee = _yield$this$prepareTx.fee;
|
|
66
|
-
ttl = _yield$this$prepareTx.ttl;
|
|
67
|
-
nonce = _yield$this$prepareTx.nonce;
|
|
68
|
-
|
|
69
|
-
if (!this.nativeMode) {
|
|
70
|
-
_context3.next = 11;
|
|
71
|
-
break;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
_context3.t0 = {
|
|
75
|
-
tx: TxObject({
|
|
76
|
-
params: _merge(_head(_args), {
|
|
77
|
-
recipientId: recipientId,
|
|
78
|
-
senderId: senderId,
|
|
79
|
-
nonce: nonce,
|
|
80
|
-
ttl: ttl,
|
|
81
|
-
payload: payload
|
|
82
|
-
}),
|
|
83
|
-
type: TX_TYPE.spend
|
|
84
|
-
}).encodedTx
|
|
85
|
-
};
|
|
86
|
-
_context3.next = 14;
|
|
87
|
-
break;
|
|
88
|
-
|
|
89
|
-
case 11:
|
|
90
|
-
_context3.next = 13;
|
|
91
|
-
return this.api.postSpend(_merge(_head(_args), {
|
|
92
|
-
amount: _parseInt(amount),
|
|
93
|
-
recipientId: recipientId,
|
|
94
|
-
senderId: senderId,
|
|
95
|
-
nonce: nonce,
|
|
96
|
-
ttl: ttl,
|
|
97
|
-
fee: _parseInt(fee),
|
|
98
|
-
payload: payload
|
|
99
|
-
}));
|
|
100
|
-
|
|
101
|
-
case 13:
|
|
102
|
-
_context3.t0 = _context3.sent;
|
|
103
|
-
|
|
104
|
-
case 14:
|
|
105
|
-
_ref22 = _context3.t0;
|
|
106
|
-
tx = _ref22.tx;
|
|
107
|
-
return _context3.abrupt("return", tx);
|
|
108
|
-
|
|
109
|
-
case 17:
|
|
110
|
-
case "end":
|
|
111
|
-
return _context3.stop();
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}, _callee, this);
|
|
115
|
-
}));
|
|
116
|
-
return _spendTx.apply(this, arguments);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
function namePreclaimTx(_x2) {
|
|
120
|
-
return _namePreclaimTx.apply(this, arguments);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
function _namePreclaimTx() {
|
|
124
|
-
_namePreclaimTx = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref2) {
|
|
125
|
-
var accountId,
|
|
126
|
-
commitmentId,
|
|
127
|
-
_yield$this$prepareTx2,
|
|
128
|
-
fee,
|
|
129
|
-
ttl,
|
|
130
|
-
nonce,
|
|
131
|
-
_ref23,
|
|
132
|
-
tx,
|
|
133
|
-
_args2 = arguments;
|
|
134
|
-
|
|
135
|
-
return _regeneratorRuntime.wrap(function _callee2$(_context4) {
|
|
136
|
-
while (1) {
|
|
137
|
-
switch (_context4.prev = _context4.next) {
|
|
138
|
-
case 0:
|
|
139
|
-
accountId = _ref2.accountId, commitmentId = _ref2.commitmentId;
|
|
140
|
-
_context4.next = 3;
|
|
141
|
-
return this.prepareTxParams(TX_TYPE.namePreClaim, _objectSpread({
|
|
142
|
-
senderId: accountId
|
|
143
|
-
}, _head(_args2)));
|
|
144
|
-
|
|
145
|
-
case 3:
|
|
146
|
-
_yield$this$prepareTx2 = _context4.sent;
|
|
147
|
-
fee = _yield$this$prepareTx2.fee;
|
|
148
|
-
ttl = _yield$this$prepareTx2.ttl;
|
|
149
|
-
nonce = _yield$this$prepareTx2.nonce;
|
|
150
|
-
|
|
151
|
-
if (!this.nativeMode) {
|
|
152
|
-
_context4.next = 11;
|
|
153
|
-
break;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
_context4.t0 = {
|
|
157
|
-
tx: TxObject({
|
|
158
|
-
params: _merge(_head(_args2), {
|
|
159
|
-
nonce: nonce,
|
|
160
|
-
ttl: ttl,
|
|
161
|
-
fee: fee
|
|
162
|
-
}),
|
|
163
|
-
type: TX_TYPE.namePreClaim
|
|
164
|
-
}).encodedTx
|
|
165
|
-
};
|
|
166
|
-
_context4.next = 14;
|
|
167
|
-
break;
|
|
168
|
-
|
|
169
|
-
case 11:
|
|
170
|
-
_context4.next = 13;
|
|
171
|
-
return this.api.postNamePreclaim(_merge(_head(_args2), {
|
|
172
|
-
nonce: nonce,
|
|
173
|
-
ttl: ttl,
|
|
174
|
-
fee: _parseInt(fee)
|
|
175
|
-
}));
|
|
176
|
-
|
|
177
|
-
case 13:
|
|
178
|
-
_context4.t0 = _context4.sent;
|
|
179
|
-
|
|
180
|
-
case 14:
|
|
181
|
-
_ref23 = _context4.t0;
|
|
182
|
-
tx = _ref23.tx;
|
|
183
|
-
return _context4.abrupt("return", tx);
|
|
184
|
-
|
|
185
|
-
case 17:
|
|
186
|
-
case "end":
|
|
187
|
-
return _context4.stop();
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
}, _callee2, this);
|
|
191
|
-
}));
|
|
192
|
-
return _namePreclaimTx.apply(this, arguments);
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
function nameClaimTx(_x3) {
|
|
196
|
-
return _nameClaimTx.apply(this, arguments);
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
function _nameClaimTx() {
|
|
200
|
-
_nameClaimTx = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref3) {
|
|
201
|
-
var accountId,
|
|
202
|
-
name,
|
|
203
|
-
nameSalt,
|
|
204
|
-
_ref3$vsn,
|
|
205
|
-
vsn,
|
|
206
|
-
_yield$this$prepareTx3,
|
|
207
|
-
fee,
|
|
208
|
-
ttl,
|
|
209
|
-
nonce,
|
|
210
|
-
_ref24,
|
|
211
|
-
tx,
|
|
212
|
-
_args3 = arguments;
|
|
213
|
-
|
|
214
|
-
return _regeneratorRuntime.wrap(function _callee3$(_context5) {
|
|
215
|
-
while (1) {
|
|
216
|
-
switch (_context5.prev = _context5.next) {
|
|
217
|
-
case 0:
|
|
218
|
-
accountId = _ref3.accountId, name = _ref3.name, nameSalt = _ref3.nameSalt, _ref3$vsn = _ref3.vsn, vsn = _ref3$vsn === void 0 ? 2 : _ref3$vsn;
|
|
219
|
-
_context5.next = 3;
|
|
220
|
-
return this.prepareTxParams(TX_TYPE.nameClaim, _objectSpread(_objectSpread({
|
|
221
|
-
senderId: accountId
|
|
222
|
-
}, _head(_args3)), {}, {
|
|
223
|
-
vsn: vsn
|
|
224
|
-
}));
|
|
225
|
-
|
|
226
|
-
case 3:
|
|
227
|
-
_yield$this$prepareTx3 = _context5.sent;
|
|
228
|
-
fee = _yield$this$prepareTx3.fee;
|
|
229
|
-
ttl = _yield$this$prepareTx3.ttl;
|
|
230
|
-
nonce = _yield$this$prepareTx3.nonce;
|
|
231
|
-
|
|
232
|
-
if (!this.nativeMode) {
|
|
233
|
-
_context5.next = 11;
|
|
234
|
-
break;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
_context5.t0 = {
|
|
238
|
-
tx: TxObject({
|
|
239
|
-
params: _merge(_head(_args3), {
|
|
240
|
-
nonce: nonce,
|
|
241
|
-
ttl: ttl,
|
|
242
|
-
fee: fee,
|
|
243
|
-
vsn: vsn
|
|
244
|
-
}),
|
|
245
|
-
type: TX_TYPE.nameClaim
|
|
246
|
-
}).encodedTx
|
|
247
|
-
};
|
|
248
|
-
_context5.next = 14;
|
|
249
|
-
break;
|
|
250
|
-
|
|
251
|
-
case 11:
|
|
252
|
-
_context5.next = 13;
|
|
253
|
-
return this.api.postNameClaim(_merge(_head(_args3), {
|
|
254
|
-
nonce: nonce,
|
|
255
|
-
ttl: ttl,
|
|
256
|
-
fee: _parseInt(fee)
|
|
257
|
-
}));
|
|
258
|
-
|
|
259
|
-
case 13:
|
|
260
|
-
_context5.t0 = _context5.sent;
|
|
261
|
-
|
|
262
|
-
case 14:
|
|
263
|
-
_ref24 = _context5.t0;
|
|
264
|
-
tx = _ref24.tx;
|
|
265
|
-
return _context5.abrupt("return", tx);
|
|
266
|
-
|
|
267
|
-
case 17:
|
|
268
|
-
case "end":
|
|
269
|
-
return _context5.stop();
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
}, _callee3, this);
|
|
273
|
-
}));
|
|
274
|
-
return _nameClaimTx.apply(this, arguments);
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
function nameTransferTx(_x4) {
|
|
278
|
-
return _nameTransferTx.apply(this, arguments);
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
function _nameTransferTx() {
|
|
282
|
-
_nameTransferTx = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref4) {
|
|
283
|
-
var accountId,
|
|
284
|
-
nameId,
|
|
285
|
-
recipientId,
|
|
286
|
-
_yield$this$prepareTx4,
|
|
287
|
-
fee,
|
|
288
|
-
ttl,
|
|
289
|
-
nonce,
|
|
290
|
-
_ref25,
|
|
291
|
-
tx,
|
|
292
|
-
_args4 = arguments;
|
|
293
|
-
|
|
294
|
-
return _regeneratorRuntime.wrap(function _callee4$(_context6) {
|
|
295
|
-
while (1) {
|
|
296
|
-
switch (_context6.prev = _context6.next) {
|
|
297
|
-
case 0:
|
|
298
|
-
accountId = _ref4.accountId, nameId = _ref4.nameId, recipientId = _ref4.recipientId;
|
|
299
|
-
_context6.next = 3;
|
|
300
|
-
return this.prepareTxParams(TX_TYPE.nameTransfer, _objectSpread({
|
|
301
|
-
senderId: accountId
|
|
302
|
-
}, _head(_args4)));
|
|
303
|
-
|
|
304
|
-
case 3:
|
|
305
|
-
_yield$this$prepareTx4 = _context6.sent;
|
|
306
|
-
fee = _yield$this$prepareTx4.fee;
|
|
307
|
-
ttl = _yield$this$prepareTx4.ttl;
|
|
308
|
-
nonce = _yield$this$prepareTx4.nonce;
|
|
309
|
-
|
|
310
|
-
if (!this.nativeMode) {
|
|
311
|
-
_context6.next = 11;
|
|
312
|
-
break;
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
_context6.t0 = {
|
|
316
|
-
tx: TxObject({
|
|
317
|
-
params: _merge(_head(_args4), {
|
|
318
|
-
recipientId: recipientId,
|
|
319
|
-
nonce: nonce,
|
|
320
|
-
ttl: ttl,
|
|
321
|
-
fee: fee
|
|
322
|
-
}),
|
|
323
|
-
type: TX_TYPE.nameTransfer
|
|
324
|
-
}).encodedTx
|
|
325
|
-
};
|
|
326
|
-
_context6.next = 14;
|
|
327
|
-
break;
|
|
328
|
-
|
|
329
|
-
case 11:
|
|
330
|
-
_context6.next = 13;
|
|
331
|
-
return this.api.postNameTransfer(_merge(_head(_args4), {
|
|
332
|
-
recipientId: recipientId,
|
|
333
|
-
nonce: nonce,
|
|
334
|
-
ttl: ttl,
|
|
335
|
-
fee: _parseInt(fee)
|
|
336
|
-
}));
|
|
337
|
-
|
|
338
|
-
case 13:
|
|
339
|
-
_context6.t0 = _context6.sent;
|
|
340
|
-
|
|
341
|
-
case 14:
|
|
342
|
-
_ref25 = _context6.t0;
|
|
343
|
-
tx = _ref25.tx;
|
|
344
|
-
return _context6.abrupt("return", tx);
|
|
345
|
-
|
|
346
|
-
case 17:
|
|
347
|
-
case "end":
|
|
348
|
-
return _context6.stop();
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
}, _callee4, this);
|
|
352
|
-
}));
|
|
353
|
-
return _nameTransferTx.apply(this, arguments);
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
function nameUpdateTx(_x5) {
|
|
357
|
-
return _nameUpdateTx.apply(this, arguments);
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
function _nameUpdateTx() {
|
|
361
|
-
_nameUpdateTx = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(_ref5) {
|
|
362
|
-
var accountId,
|
|
363
|
-
nameId,
|
|
364
|
-
nameTtl,
|
|
365
|
-
pointers,
|
|
366
|
-
clientTtl,
|
|
367
|
-
_yield$this$prepareTx5,
|
|
368
|
-
fee,
|
|
369
|
-
ttl,
|
|
370
|
-
nonce,
|
|
371
|
-
_ref26,
|
|
372
|
-
tx,
|
|
373
|
-
_args5 = arguments;
|
|
374
|
-
|
|
375
|
-
return _regeneratorRuntime.wrap(function _callee5$(_context7) {
|
|
376
|
-
while (1) {
|
|
377
|
-
switch (_context7.prev = _context7.next) {
|
|
378
|
-
case 0:
|
|
379
|
-
accountId = _ref5.accountId, nameId = _ref5.nameId, nameTtl = _ref5.nameTtl, pointers = _ref5.pointers, clientTtl = _ref5.clientTtl;
|
|
380
|
-
_context7.next = 3;
|
|
381
|
-
return this.prepareTxParams(TX_TYPE.nameUpdate, _objectSpread({
|
|
382
|
-
senderId: accountId
|
|
383
|
-
}, _head(_args5)));
|
|
384
|
-
|
|
385
|
-
case 3:
|
|
386
|
-
_yield$this$prepareTx5 = _context7.sent;
|
|
387
|
-
fee = _yield$this$prepareTx5.fee;
|
|
388
|
-
ttl = _yield$this$prepareTx5.ttl;
|
|
389
|
-
nonce = _yield$this$prepareTx5.nonce;
|
|
390
|
-
|
|
391
|
-
if (!this.nativeMode) {
|
|
392
|
-
_context7.next = 11;
|
|
393
|
-
break;
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
_context7.t0 = {
|
|
397
|
-
tx: TxObject({
|
|
398
|
-
params: _merge(_head(_args5), {
|
|
399
|
-
nonce: nonce,
|
|
400
|
-
ttl: ttl,
|
|
401
|
-
fee: fee
|
|
402
|
-
}),
|
|
403
|
-
type: TX_TYPE.nameUpdate
|
|
404
|
-
}).encodedTx
|
|
405
|
-
};
|
|
406
|
-
_context7.next = 14;
|
|
407
|
-
break;
|
|
408
|
-
|
|
409
|
-
case 11:
|
|
410
|
-
_context7.next = 13;
|
|
411
|
-
return this.api.postNameUpdate(_merge(_head(_args5), {
|
|
412
|
-
nonce: nonce,
|
|
413
|
-
ttl: ttl,
|
|
414
|
-
fee: _parseInt(fee)
|
|
415
|
-
}));
|
|
416
|
-
|
|
417
|
-
case 13:
|
|
418
|
-
_context7.t0 = _context7.sent;
|
|
419
|
-
|
|
420
|
-
case 14:
|
|
421
|
-
_ref26 = _context7.t0;
|
|
422
|
-
tx = _ref26.tx;
|
|
423
|
-
return _context7.abrupt("return", tx);
|
|
424
|
-
|
|
425
|
-
case 17:
|
|
426
|
-
case "end":
|
|
427
|
-
return _context7.stop();
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
}, _callee5, this);
|
|
431
|
-
}));
|
|
432
|
-
return _nameUpdateTx.apply(this, arguments);
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
function nameRevokeTx(_x6) {
|
|
436
|
-
return _nameRevokeTx.apply(this, arguments);
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
function _nameRevokeTx() {
|
|
440
|
-
_nameRevokeTx = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(_ref6) {
|
|
441
|
-
var accountId,
|
|
442
|
-
nameId,
|
|
443
|
-
_yield$this$prepareTx6,
|
|
444
|
-
fee,
|
|
445
|
-
ttl,
|
|
446
|
-
nonce,
|
|
447
|
-
_ref27,
|
|
448
|
-
tx,
|
|
449
|
-
_args6 = arguments;
|
|
450
|
-
|
|
451
|
-
return _regeneratorRuntime.wrap(function _callee6$(_context8) {
|
|
452
|
-
while (1) {
|
|
453
|
-
switch (_context8.prev = _context8.next) {
|
|
454
|
-
case 0:
|
|
455
|
-
accountId = _ref6.accountId, nameId = _ref6.nameId;
|
|
456
|
-
_context8.next = 3;
|
|
457
|
-
return this.prepareTxParams(TX_TYPE.nameRevoke, _objectSpread({
|
|
458
|
-
senderId: accountId
|
|
459
|
-
}, _head(_args6)));
|
|
460
|
-
|
|
461
|
-
case 3:
|
|
462
|
-
_yield$this$prepareTx6 = _context8.sent;
|
|
463
|
-
fee = _yield$this$prepareTx6.fee;
|
|
464
|
-
ttl = _yield$this$prepareTx6.ttl;
|
|
465
|
-
nonce = _yield$this$prepareTx6.nonce;
|
|
466
|
-
|
|
467
|
-
if (!this.nativeMode) {
|
|
468
|
-
_context8.next = 11;
|
|
469
|
-
break;
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
_context8.t0 = {
|
|
473
|
-
tx: TxObject({
|
|
474
|
-
params: _merge(_head(_args6), {
|
|
475
|
-
nonce: nonce,
|
|
476
|
-
ttl: ttl,
|
|
477
|
-
fee: fee
|
|
478
|
-
}),
|
|
479
|
-
type: TX_TYPE.nameRevoke
|
|
480
|
-
}).encodedTx
|
|
481
|
-
};
|
|
482
|
-
_context8.next = 14;
|
|
483
|
-
break;
|
|
484
|
-
|
|
485
|
-
case 11:
|
|
486
|
-
_context8.next = 13;
|
|
487
|
-
return this.api.postNameRevoke(_merge(_head(_args6), {
|
|
488
|
-
nonce: nonce,
|
|
489
|
-
ttl: ttl,
|
|
490
|
-
fee: _parseInt(fee)
|
|
491
|
-
}));
|
|
492
|
-
|
|
493
|
-
case 13:
|
|
494
|
-
_context8.t0 = _context8.sent;
|
|
495
|
-
|
|
496
|
-
case 14:
|
|
497
|
-
_ref27 = _context8.t0;
|
|
498
|
-
tx = _ref27.tx;
|
|
499
|
-
return _context8.abrupt("return", tx);
|
|
500
|
-
|
|
501
|
-
case 17:
|
|
502
|
-
case "end":
|
|
503
|
-
return _context8.stop();
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
}, _callee6, this);
|
|
507
|
-
}));
|
|
508
|
-
return _nameRevokeTx.apply(this, arguments);
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
function contractCreateTx(_x7) {
|
|
512
|
-
return _contractCreateTx.apply(this, arguments);
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
function _contractCreateTx() {
|
|
516
|
-
_contractCreateTx = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(_ref7) {
|
|
517
|
-
var ownerId,
|
|
518
|
-
code,
|
|
519
|
-
vmVersion,
|
|
520
|
-
abiVersion,
|
|
521
|
-
deposit,
|
|
522
|
-
amount,
|
|
523
|
-
gas,
|
|
524
|
-
_ref7$gasPrice,
|
|
525
|
-
gasPrice,
|
|
526
|
-
callData,
|
|
527
|
-
ctVersion,
|
|
528
|
-
_yield$this$prepareTx7,
|
|
529
|
-
fee,
|
|
530
|
-
ttl,
|
|
531
|
-
nonce,
|
|
532
|
-
_args7 = arguments;
|
|
533
|
-
|
|
534
|
-
return _regeneratorRuntime.wrap(function _callee7$(_context9) {
|
|
535
|
-
while (1) {
|
|
536
|
-
switch (_context9.prev = _context9.next) {
|
|
537
|
-
case 0:
|
|
538
|
-
ownerId = _ref7.ownerId, code = _ref7.code, vmVersion = _ref7.vmVersion, abiVersion = _ref7.abiVersion, deposit = _ref7.deposit, amount = _ref7.amount, gas = _ref7.gas, _ref7$gasPrice = _ref7.gasPrice, gasPrice = _ref7$gasPrice === void 0 ? MIN_GAS_PRICE : _ref7$gasPrice, callData = _ref7.callData;
|
|
539
|
-
// Get VM_ABI version
|
|
540
|
-
ctVersion = this.getVmVersion(TX_TYPE.contractCreate, _head(_args7)); // Calculate fee, get absolute ttl (ttl + height), get account nonce
|
|
541
|
-
|
|
542
|
-
_context9.next = 4;
|
|
543
|
-
return this.prepareTxParams(TX_TYPE.contractCreate, _objectSpread(_objectSpread({
|
|
544
|
-
senderId: ownerId
|
|
545
|
-
}, _head(_args7)), {}, {
|
|
546
|
-
ctVersion: ctVersion,
|
|
547
|
-
gasPrice: gasPrice
|
|
548
|
-
}));
|
|
549
|
-
|
|
550
|
-
case 4:
|
|
551
|
-
_yield$this$prepareTx7 = _context9.sent;
|
|
552
|
-
fee = _yield$this$prepareTx7.fee;
|
|
553
|
-
ttl = _yield$this$prepareTx7.ttl;
|
|
554
|
-
nonce = _yield$this$prepareTx7.nonce;
|
|
555
|
-
return _context9.abrupt("return", this.nativeMode ? {
|
|
556
|
-
tx: TxObject({
|
|
557
|
-
params: _merge(_head(_args7), {
|
|
558
|
-
nonce: nonce,
|
|
559
|
-
ttl: ttl,
|
|
560
|
-
fee: fee,
|
|
561
|
-
ctVersion: ctVersion,
|
|
562
|
-
gasPrice: gasPrice
|
|
563
|
-
}),
|
|
564
|
-
type: TX_TYPE.contractCreate
|
|
565
|
-
}).encodedTx,
|
|
566
|
-
contractId: buildContractId(ownerId, nonce)
|
|
567
|
-
} : this.api.postContractCreate(_merge(_head(_args7), {
|
|
568
|
-
nonce: nonce,
|
|
569
|
-
ttl: ttl,
|
|
570
|
-
fee: _parseInt(fee),
|
|
571
|
-
gas: _parseInt(gas),
|
|
572
|
-
gasPrice: gasPrice,
|
|
573
|
-
vmVersion: ctVersion.vmVersion,
|
|
574
|
-
abiVersion: ctVersion.abiVersion
|
|
575
|
-
})));
|
|
576
|
-
|
|
577
|
-
case 9:
|
|
578
|
-
case "end":
|
|
579
|
-
return _context9.stop();
|
|
580
|
-
}
|
|
581
|
-
}
|
|
582
|
-
}, _callee7, this);
|
|
583
|
-
}));
|
|
584
|
-
return _contractCreateTx.apply(this, arguments);
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
function contractCallTx(_x8) {
|
|
588
|
-
return _contractCallTx.apply(this, arguments);
|
|
589
|
-
}
|
|
590
|
-
|
|
591
|
-
function _contractCallTx() {
|
|
592
|
-
_contractCallTx = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(_ref8) {
|
|
593
|
-
var callerId,
|
|
594
|
-
contractId,
|
|
595
|
-
abiVersion,
|
|
596
|
-
amount,
|
|
597
|
-
gas,
|
|
598
|
-
_ref8$gasPrice,
|
|
599
|
-
gasPrice,
|
|
600
|
-
callData,
|
|
601
|
-
ctVersion,
|
|
602
|
-
_yield$this$prepareTx8,
|
|
603
|
-
fee,
|
|
604
|
-
ttl,
|
|
605
|
-
nonce,
|
|
606
|
-
_ref28,
|
|
607
|
-
tx,
|
|
608
|
-
_args8 = arguments;
|
|
609
|
-
|
|
610
|
-
return _regeneratorRuntime.wrap(function _callee8$(_context10) {
|
|
611
|
-
while (1) {
|
|
612
|
-
switch (_context10.prev = _context10.next) {
|
|
613
|
-
case 0:
|
|
614
|
-
callerId = _ref8.callerId, contractId = _ref8.contractId, abiVersion = _ref8.abiVersion, amount = _ref8.amount, gas = _ref8.gas, _ref8$gasPrice = _ref8.gasPrice, gasPrice = _ref8$gasPrice === void 0 ? MIN_GAS_PRICE : _ref8$gasPrice, callData = _ref8.callData;
|
|
615
|
-
ctVersion = this.getVmVersion(TX_TYPE.contractCall, _head(_args8)); // Calculate fee, get absolute ttl (ttl + height), get account nonce
|
|
616
|
-
|
|
617
|
-
_context10.next = 4;
|
|
618
|
-
return this.prepareTxParams(TX_TYPE.contractCall, _objectSpread(_objectSpread({
|
|
619
|
-
senderId: callerId
|
|
620
|
-
}, _head(_args8)), {}, {
|
|
621
|
-
gasPrice: gasPrice,
|
|
622
|
-
abiVersion: ctVersion.abiVersion
|
|
623
|
-
}));
|
|
624
|
-
|
|
625
|
-
case 4:
|
|
626
|
-
_yield$this$prepareTx8 = _context10.sent;
|
|
627
|
-
fee = _yield$this$prepareTx8.fee;
|
|
628
|
-
ttl = _yield$this$prepareTx8.ttl;
|
|
629
|
-
nonce = _yield$this$prepareTx8.nonce;
|
|
630
|
-
|
|
631
|
-
if (!this.nativeMode) {
|
|
632
|
-
_context10.next = 12;
|
|
633
|
-
break;
|
|
634
|
-
}
|
|
635
|
-
|
|
636
|
-
_context10.t0 = {
|
|
637
|
-
tx: TxObject({
|
|
638
|
-
params: _merge(_head(_args8), {
|
|
639
|
-
nonce: nonce,
|
|
640
|
-
ttl: ttl,
|
|
641
|
-
fee: fee,
|
|
642
|
-
abiVersion: ctVersion.abiVersion,
|
|
643
|
-
gasPrice: gasPrice
|
|
644
|
-
}),
|
|
645
|
-
type: TX_TYPE.contractCall
|
|
646
|
-
}).encodedTx
|
|
647
|
-
};
|
|
648
|
-
_context10.next = 15;
|
|
649
|
-
break;
|
|
650
|
-
|
|
651
|
-
case 12:
|
|
652
|
-
_context10.next = 14;
|
|
653
|
-
return this.api.postContractCall(_merge(_head(_args8), {
|
|
654
|
-
nonce: nonce,
|
|
655
|
-
ttl: ttl,
|
|
656
|
-
fee: _parseInt(fee),
|
|
657
|
-
gas: _parseInt(gas),
|
|
658
|
-
gasPrice: gasPrice,
|
|
659
|
-
abiVersion: ctVersion.abiVersion
|
|
660
|
-
}));
|
|
661
|
-
|
|
662
|
-
case 14:
|
|
663
|
-
_context10.t0 = _context10.sent;
|
|
664
|
-
|
|
665
|
-
case 15:
|
|
666
|
-
_ref28 = _context10.t0;
|
|
667
|
-
tx = _ref28.tx;
|
|
668
|
-
return _context10.abrupt("return", tx);
|
|
669
|
-
|
|
670
|
-
case 18:
|
|
671
|
-
case "end":
|
|
672
|
-
return _context10.stop();
|
|
673
|
-
}
|
|
674
|
-
}
|
|
675
|
-
}, _callee8, this);
|
|
676
|
-
}));
|
|
677
|
-
return _contractCallTx.apply(this, arguments);
|
|
678
|
-
}
|
|
679
|
-
|
|
680
|
-
function oracleRegisterTx(_x9) {
|
|
681
|
-
return _oracleRegisterTx.apply(this, arguments);
|
|
682
|
-
}
|
|
683
|
-
|
|
684
|
-
function _oracleRegisterTx() {
|
|
685
|
-
_oracleRegisterTx = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(_ref9) {
|
|
686
|
-
var accountId,
|
|
687
|
-
queryFormat,
|
|
688
|
-
responseFormat,
|
|
689
|
-
queryFee,
|
|
690
|
-
oracleTtl,
|
|
691
|
-
_ref9$abiVersion,
|
|
692
|
-
abiVersion,
|
|
693
|
-
_yield$this$prepareTx9,
|
|
694
|
-
fee,
|
|
695
|
-
ttl,
|
|
696
|
-
nonce,
|
|
697
|
-
_ref29,
|
|
698
|
-
tx,
|
|
699
|
-
_args9 = arguments;
|
|
700
|
-
|
|
701
|
-
return _regeneratorRuntime.wrap(function _callee9$(_context11) {
|
|
702
|
-
while (1) {
|
|
703
|
-
switch (_context11.prev = _context11.next) {
|
|
704
|
-
case 0:
|
|
705
|
-
accountId = _ref9.accountId, queryFormat = _ref9.queryFormat, responseFormat = _ref9.responseFormat, queryFee = _ref9.queryFee, oracleTtl = _ref9.oracleTtl, _ref9$abiVersion = _ref9.abiVersion, abiVersion = _ref9$abiVersion === void 0 ? ABI_VERSIONS.NO_ABI : _ref9$abiVersion;
|
|
706
|
-
_context11.next = 3;
|
|
707
|
-
return this.prepareTxParams(TX_TYPE.oracleRegister, _objectSpread(_objectSpread({
|
|
708
|
-
senderId: accountId
|
|
709
|
-
}, _head(_args9)), {}, {
|
|
710
|
-
abiVersion: abiVersion
|
|
711
|
-
}));
|
|
712
|
-
|
|
713
|
-
case 3:
|
|
714
|
-
_yield$this$prepareTx9 = _context11.sent;
|
|
715
|
-
fee = _yield$this$prepareTx9.fee;
|
|
716
|
-
ttl = _yield$this$prepareTx9.ttl;
|
|
717
|
-
nonce = _yield$this$prepareTx9.nonce;
|
|
718
|
-
|
|
719
|
-
if (!this.nativeMode) {
|
|
720
|
-
_context11.next = 11;
|
|
721
|
-
break;
|
|
722
|
-
}
|
|
723
|
-
|
|
724
|
-
_context11.t0 = {
|
|
725
|
-
tx: TxObject({
|
|
726
|
-
params: {
|
|
727
|
-
accountId: accountId,
|
|
728
|
-
queryFee: queryFee,
|
|
729
|
-
abiVersion: abiVersion,
|
|
730
|
-
fee: fee,
|
|
731
|
-
oracleTtl: oracleTtl,
|
|
732
|
-
nonce: nonce,
|
|
733
|
-
ttl: ttl,
|
|
734
|
-
queryFormat: queryFormat,
|
|
735
|
-
responseFormat: responseFormat
|
|
736
|
-
},
|
|
737
|
-
type: TX_TYPE.oracleRegister
|
|
738
|
-
}).encodedTx
|
|
739
|
-
};
|
|
740
|
-
_context11.next = 14;
|
|
741
|
-
break;
|
|
742
|
-
|
|
743
|
-
case 11:
|
|
744
|
-
_context11.next = 13;
|
|
745
|
-
return this.api.postOracleRegister({
|
|
746
|
-
accountId: accountId,
|
|
747
|
-
queryFee: queryFee,
|
|
748
|
-
abiVersion: abiVersion,
|
|
749
|
-
fee: _parseInt(fee),
|
|
750
|
-
oracleTtl: oracleTtl,
|
|
751
|
-
nonce: nonce,
|
|
752
|
-
ttl: ttl,
|
|
753
|
-
queryFormat: queryFormat,
|
|
754
|
-
responseFormat: responseFormat
|
|
755
|
-
});
|
|
756
|
-
|
|
757
|
-
case 13:
|
|
758
|
-
_context11.t0 = _context11.sent;
|
|
759
|
-
|
|
760
|
-
case 14:
|
|
761
|
-
_ref29 = _context11.t0;
|
|
762
|
-
tx = _ref29.tx;
|
|
763
|
-
return _context11.abrupt("return", tx);
|
|
764
|
-
|
|
765
|
-
case 17:
|
|
766
|
-
case "end":
|
|
767
|
-
return _context11.stop();
|
|
768
|
-
}
|
|
769
|
-
}
|
|
770
|
-
}, _callee9, this);
|
|
771
|
-
}));
|
|
772
|
-
return _oracleRegisterTx.apply(this, arguments);
|
|
773
|
-
}
|
|
774
|
-
|
|
775
|
-
function oracleExtendTx(_x10) {
|
|
776
|
-
return _oracleExtendTx.apply(this, arguments);
|
|
777
|
-
}
|
|
778
|
-
|
|
779
|
-
function _oracleExtendTx() {
|
|
780
|
-
_oracleExtendTx = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(_ref10) {
|
|
781
|
-
var oracleId,
|
|
782
|
-
callerId,
|
|
783
|
-
oracleTtl,
|
|
784
|
-
_yield$this$prepareTx10,
|
|
785
|
-
fee,
|
|
786
|
-
ttl,
|
|
787
|
-
nonce,
|
|
788
|
-
_ref30,
|
|
789
|
-
tx,
|
|
790
|
-
_args10 = arguments;
|
|
791
|
-
|
|
792
|
-
return _regeneratorRuntime.wrap(function _callee10$(_context12) {
|
|
793
|
-
while (1) {
|
|
794
|
-
switch (_context12.prev = _context12.next) {
|
|
795
|
-
case 0:
|
|
796
|
-
oracleId = _ref10.oracleId, callerId = _ref10.callerId, oracleTtl = _ref10.oracleTtl;
|
|
797
|
-
_context12.next = 3;
|
|
798
|
-
return this.prepareTxParams(TX_TYPE.oracleExtend, _objectSpread({
|
|
799
|
-
senderId: callerId
|
|
800
|
-
}, _head(_args10)));
|
|
801
|
-
|
|
802
|
-
case 3:
|
|
803
|
-
_yield$this$prepareTx10 = _context12.sent;
|
|
804
|
-
fee = _yield$this$prepareTx10.fee;
|
|
805
|
-
ttl = _yield$this$prepareTx10.ttl;
|
|
806
|
-
nonce = _yield$this$prepareTx10.nonce;
|
|
807
|
-
|
|
808
|
-
if (!this.nativeMode) {
|
|
809
|
-
_context12.next = 11;
|
|
810
|
-
break;
|
|
811
|
-
}
|
|
812
|
-
|
|
813
|
-
_context12.t0 = {
|
|
814
|
-
tx: TxObject({
|
|
815
|
-
params: {
|
|
816
|
-
oracleId: oracleId,
|
|
817
|
-
fee: fee,
|
|
818
|
-
oracleTtl: oracleTtl,
|
|
819
|
-
nonce: nonce,
|
|
820
|
-
ttl: ttl
|
|
821
|
-
},
|
|
822
|
-
type: TX_TYPE.oracleExtend
|
|
823
|
-
}).encodedTx
|
|
824
|
-
};
|
|
825
|
-
_context12.next = 14;
|
|
826
|
-
break;
|
|
827
|
-
|
|
828
|
-
case 11:
|
|
829
|
-
_context12.next = 13;
|
|
830
|
-
return this.api.postOracleExtend({
|
|
831
|
-
oracleId: oracleId,
|
|
832
|
-
fee: _parseInt(fee),
|
|
833
|
-
oracleTtl: oracleTtl,
|
|
834
|
-
nonce: nonce,
|
|
835
|
-
ttl: ttl
|
|
836
|
-
});
|
|
837
|
-
|
|
838
|
-
case 13:
|
|
839
|
-
_context12.t0 = _context12.sent;
|
|
840
|
-
|
|
841
|
-
case 14:
|
|
842
|
-
_ref30 = _context12.t0;
|
|
843
|
-
tx = _ref30.tx;
|
|
844
|
-
return _context12.abrupt("return", tx);
|
|
845
|
-
|
|
846
|
-
case 17:
|
|
847
|
-
case "end":
|
|
848
|
-
return _context12.stop();
|
|
849
|
-
}
|
|
850
|
-
}
|
|
851
|
-
}, _callee10, this);
|
|
852
|
-
}));
|
|
853
|
-
return _oracleExtendTx.apply(this, arguments);
|
|
854
|
-
}
|
|
855
|
-
|
|
856
|
-
function oraclePostQueryTx(_x11) {
|
|
857
|
-
return _oraclePostQueryTx.apply(this, arguments);
|
|
858
|
-
}
|
|
859
|
-
|
|
860
|
-
function _oraclePostQueryTx() {
|
|
861
|
-
_oraclePostQueryTx = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(_ref11) {
|
|
862
|
-
var oracleId,
|
|
863
|
-
responseTtl,
|
|
864
|
-
query,
|
|
865
|
-
queryTtl,
|
|
866
|
-
queryFee,
|
|
867
|
-
senderId,
|
|
868
|
-
_yield$this$prepareTx11,
|
|
869
|
-
fee,
|
|
870
|
-
ttl,
|
|
871
|
-
nonce,
|
|
872
|
-
_ref31,
|
|
873
|
-
tx,
|
|
874
|
-
_args11 = arguments;
|
|
875
|
-
|
|
876
|
-
return _regeneratorRuntime.wrap(function _callee11$(_context13) {
|
|
877
|
-
while (1) {
|
|
878
|
-
switch (_context13.prev = _context13.next) {
|
|
879
|
-
case 0:
|
|
880
|
-
oracleId = _ref11.oracleId, responseTtl = _ref11.responseTtl, query = _ref11.query, queryTtl = _ref11.queryTtl, queryFee = _ref11.queryFee, senderId = _ref11.senderId;
|
|
881
|
-
_context13.next = 3;
|
|
882
|
-
return this.prepareTxParams(TX_TYPE.oracleQuery, _objectSpread({
|
|
883
|
-
senderId: senderId
|
|
884
|
-
}, _head(_args11)));
|
|
885
|
-
|
|
886
|
-
case 3:
|
|
887
|
-
_yield$this$prepareTx11 = _context13.sent;
|
|
888
|
-
fee = _yield$this$prepareTx11.fee;
|
|
889
|
-
ttl = _yield$this$prepareTx11.ttl;
|
|
890
|
-
nonce = _yield$this$prepareTx11.nonce;
|
|
891
|
-
|
|
892
|
-
if (!this.nativeMode) {
|
|
893
|
-
_context13.next = 11;
|
|
894
|
-
break;
|
|
895
|
-
}
|
|
896
|
-
|
|
897
|
-
_context13.t0 = {
|
|
898
|
-
tx: TxObject({
|
|
899
|
-
params: {
|
|
900
|
-
oracleId: oracleId,
|
|
901
|
-
responseTtl: responseTtl,
|
|
902
|
-
query: query,
|
|
903
|
-
queryTtl: queryTtl,
|
|
904
|
-
fee: fee,
|
|
905
|
-
queryFee: queryFee,
|
|
906
|
-
ttl: ttl,
|
|
907
|
-
nonce: nonce,
|
|
908
|
-
senderId: senderId
|
|
909
|
-
},
|
|
910
|
-
type: TX_TYPE.oracleQuery
|
|
911
|
-
}).encodedTx
|
|
912
|
-
};
|
|
913
|
-
_context13.next = 14;
|
|
914
|
-
break;
|
|
915
|
-
|
|
916
|
-
case 11:
|
|
917
|
-
_context13.next = 13;
|
|
918
|
-
return this.api.postOracleQuery({
|
|
919
|
-
oracleId: oracleId,
|
|
920
|
-
responseTtl: responseTtl,
|
|
921
|
-
query: query,
|
|
922
|
-
queryTtl: queryTtl,
|
|
923
|
-
fee: _parseInt(fee),
|
|
924
|
-
queryFee: queryFee,
|
|
925
|
-
ttl: ttl,
|
|
926
|
-
nonce: nonce,
|
|
927
|
-
senderId: senderId
|
|
928
|
-
});
|
|
929
|
-
|
|
930
|
-
case 13:
|
|
931
|
-
_context13.t0 = _context13.sent;
|
|
932
|
-
|
|
933
|
-
case 14:
|
|
934
|
-
_ref31 = _context13.t0;
|
|
935
|
-
tx = _ref31.tx;
|
|
936
|
-
return _context13.abrupt("return", tx);
|
|
937
|
-
|
|
938
|
-
case 17:
|
|
939
|
-
case "end":
|
|
940
|
-
return _context13.stop();
|
|
941
|
-
}
|
|
942
|
-
}
|
|
943
|
-
}, _callee11, this);
|
|
944
|
-
}));
|
|
945
|
-
return _oraclePostQueryTx.apply(this, arguments);
|
|
946
|
-
}
|
|
947
|
-
|
|
948
|
-
function oracleRespondTx(_x12) {
|
|
949
|
-
return _oracleRespondTx.apply(this, arguments);
|
|
950
|
-
}
|
|
951
|
-
|
|
952
|
-
function _oracleRespondTx() {
|
|
953
|
-
_oracleRespondTx = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(_ref12) {
|
|
954
|
-
var oracleId,
|
|
955
|
-
callerId,
|
|
956
|
-
responseTtl,
|
|
957
|
-
queryId,
|
|
958
|
-
response,
|
|
959
|
-
_yield$this$prepareTx12,
|
|
960
|
-
fee,
|
|
961
|
-
ttl,
|
|
962
|
-
nonce,
|
|
963
|
-
_ref32,
|
|
964
|
-
tx,
|
|
965
|
-
_args12 = arguments;
|
|
966
|
-
|
|
967
|
-
return _regeneratorRuntime.wrap(function _callee12$(_context14) {
|
|
968
|
-
while (1) {
|
|
969
|
-
switch (_context14.prev = _context14.next) {
|
|
970
|
-
case 0:
|
|
971
|
-
oracleId = _ref12.oracleId, callerId = _ref12.callerId, responseTtl = _ref12.responseTtl, queryId = _ref12.queryId, response = _ref12.response;
|
|
972
|
-
_context14.next = 3;
|
|
973
|
-
return this.prepareTxParams(TX_TYPE.oracleResponse, _objectSpread({
|
|
974
|
-
senderId: callerId
|
|
975
|
-
}, _head(_args12)));
|
|
976
|
-
|
|
977
|
-
case 3:
|
|
978
|
-
_yield$this$prepareTx12 = _context14.sent;
|
|
979
|
-
fee = _yield$this$prepareTx12.fee;
|
|
980
|
-
ttl = _yield$this$prepareTx12.ttl;
|
|
981
|
-
nonce = _yield$this$prepareTx12.nonce;
|
|
982
|
-
|
|
983
|
-
if (!this.nativeMode) {
|
|
984
|
-
_context14.next = 11;
|
|
985
|
-
break;
|
|
986
|
-
}
|
|
987
|
-
|
|
988
|
-
_context14.t0 = {
|
|
989
|
-
tx: TxObject({
|
|
990
|
-
params: {
|
|
991
|
-
oracleId: oracleId,
|
|
992
|
-
responseTtl: responseTtl,
|
|
993
|
-
queryId: queryId,
|
|
994
|
-
response: response,
|
|
995
|
-
fee: fee,
|
|
996
|
-
ttl: ttl,
|
|
997
|
-
nonce: nonce
|
|
998
|
-
},
|
|
999
|
-
type: TX_TYPE.oracleResponse
|
|
1000
|
-
}).encodedTx
|
|
1001
|
-
};
|
|
1002
|
-
_context14.next = 14;
|
|
1003
|
-
break;
|
|
1004
|
-
|
|
1005
|
-
case 11:
|
|
1006
|
-
_context14.next = 13;
|
|
1007
|
-
return this.api.postOracleRespond({
|
|
1008
|
-
oracleId: oracleId,
|
|
1009
|
-
responseTtl: responseTtl,
|
|
1010
|
-
queryId: queryId,
|
|
1011
|
-
response: response,
|
|
1012
|
-
fee: _parseInt(fee),
|
|
1013
|
-
ttl: ttl,
|
|
1014
|
-
nonce: nonce
|
|
1015
|
-
});
|
|
1016
|
-
|
|
1017
|
-
case 13:
|
|
1018
|
-
_context14.t0 = _context14.sent;
|
|
1019
|
-
|
|
1020
|
-
case 14:
|
|
1021
|
-
_ref32 = _context14.t0;
|
|
1022
|
-
tx = _ref32.tx;
|
|
1023
|
-
return _context14.abrupt("return", tx);
|
|
1024
|
-
|
|
1025
|
-
case 17:
|
|
1026
|
-
case "end":
|
|
1027
|
-
return _context14.stop();
|
|
1028
|
-
}
|
|
1029
|
-
}
|
|
1030
|
-
}, _callee12, this);
|
|
1031
|
-
}));
|
|
1032
|
-
return _oracleRespondTx.apply(this, arguments);
|
|
1033
|
-
}
|
|
1034
|
-
|
|
1035
|
-
function channelCloseSoloTx(_x13) {
|
|
1036
|
-
return _channelCloseSoloTx.apply(this, arguments);
|
|
1037
|
-
}
|
|
1038
|
-
|
|
1039
|
-
function _channelCloseSoloTx() {
|
|
1040
|
-
_channelCloseSoloTx = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(_ref13) {
|
|
1041
|
-
var channelId,
|
|
1042
|
-
fromId,
|
|
1043
|
-
payload,
|
|
1044
|
-
poi,
|
|
1045
|
-
_yield$this$prepareTx13,
|
|
1046
|
-
fee,
|
|
1047
|
-
ttl,
|
|
1048
|
-
nonce,
|
|
1049
|
-
_ref33,
|
|
1050
|
-
tx,
|
|
1051
|
-
_args13 = arguments;
|
|
1052
|
-
|
|
1053
|
-
return _regeneratorRuntime.wrap(function _callee13$(_context15) {
|
|
1054
|
-
while (1) {
|
|
1055
|
-
switch (_context15.prev = _context15.next) {
|
|
1056
|
-
case 0:
|
|
1057
|
-
channelId = _ref13.channelId, fromId = _ref13.fromId, payload = _ref13.payload, poi = _ref13.poi;
|
|
1058
|
-
_context15.next = 3;
|
|
1059
|
-
return this.prepareTxParams(TX_TYPE.channelCloseSolo, _objectSpread(_objectSpread({
|
|
1060
|
-
senderId: fromId
|
|
1061
|
-
}, _head(_args13)), {}, {
|
|
1062
|
-
payload: payload
|
|
1063
|
-
}));
|
|
1064
|
-
|
|
1065
|
-
case 3:
|
|
1066
|
-
_yield$this$prepareTx13 = _context15.sent;
|
|
1067
|
-
fee = _yield$this$prepareTx13.fee;
|
|
1068
|
-
ttl = _yield$this$prepareTx13.ttl;
|
|
1069
|
-
nonce = _yield$this$prepareTx13.nonce;
|
|
1070
|
-
|
|
1071
|
-
if (!this.nativeMode) {
|
|
1072
|
-
_context15.next = 11;
|
|
1073
|
-
break;
|
|
1074
|
-
}
|
|
1075
|
-
|
|
1076
|
-
_context15.t0 = buildTx(_merge(_head(_args13), {
|
|
1077
|
-
channelId: channelId,
|
|
1078
|
-
fromId: fromId,
|
|
1079
|
-
payload: payload,
|
|
1080
|
-
poi: poi,
|
|
1081
|
-
ttl: ttl,
|
|
1082
|
-
fee: fee,
|
|
1083
|
-
nonce: nonce
|
|
1084
|
-
}), TX_TYPE.channelCloseSolo);
|
|
1085
|
-
_context15.next = 14;
|
|
1086
|
-
break;
|
|
1087
|
-
|
|
1088
|
-
case 11:
|
|
1089
|
-
_context15.next = 13;
|
|
1090
|
-
return this.api.postChannelCloseSolo(_merge(_head(_args13), {
|
|
1091
|
-
channelId: channelId,
|
|
1092
|
-
fromId: fromId,
|
|
1093
|
-
payload: payload,
|
|
1094
|
-
poi: poi,
|
|
1095
|
-
ttl: ttl,
|
|
1096
|
-
fee: _parseInt(fee),
|
|
1097
|
-
nonce: nonce
|
|
1098
|
-
}));
|
|
1099
|
-
|
|
1100
|
-
case 13:
|
|
1101
|
-
_context15.t0 = _context15.sent;
|
|
1102
|
-
|
|
1103
|
-
case 14:
|
|
1104
|
-
_ref33 = _context15.t0;
|
|
1105
|
-
tx = _ref33.tx;
|
|
1106
|
-
return _context15.abrupt("return", tx);
|
|
1107
|
-
|
|
1108
|
-
case 17:
|
|
1109
|
-
case "end":
|
|
1110
|
-
return _context15.stop();
|
|
1111
|
-
}
|
|
1112
|
-
}
|
|
1113
|
-
}, _callee13, this);
|
|
1114
|
-
}));
|
|
1115
|
-
return _channelCloseSoloTx.apply(this, arguments);
|
|
1116
|
-
}
|
|
1117
|
-
|
|
1118
|
-
function channelSlashTx(_x14) {
|
|
1119
|
-
return _channelSlashTx.apply(this, arguments);
|
|
1120
|
-
}
|
|
1121
|
-
|
|
1122
|
-
function _channelSlashTx() {
|
|
1123
|
-
_channelSlashTx = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14(_ref14) {
|
|
1124
|
-
var channelId,
|
|
1125
|
-
fromId,
|
|
1126
|
-
payload,
|
|
1127
|
-
poi,
|
|
1128
|
-
_yield$this$prepareTx14,
|
|
1129
|
-
fee,
|
|
1130
|
-
ttl,
|
|
1131
|
-
nonce,
|
|
1132
|
-
_ref34,
|
|
1133
|
-
tx,
|
|
1134
|
-
_args14 = arguments;
|
|
1135
|
-
|
|
1136
|
-
return _regeneratorRuntime.wrap(function _callee14$(_context16) {
|
|
1137
|
-
while (1) {
|
|
1138
|
-
switch (_context16.prev = _context16.next) {
|
|
1139
|
-
case 0:
|
|
1140
|
-
channelId = _ref14.channelId, fromId = _ref14.fromId, payload = _ref14.payload, poi = _ref14.poi;
|
|
1141
|
-
_context16.next = 3;
|
|
1142
|
-
return this.prepareTxParams(TX_TYPE.channelSlash, _objectSpread(_objectSpread({
|
|
1143
|
-
senderId: fromId
|
|
1144
|
-
}, _head(_args14)), {}, {
|
|
1145
|
-
payload: payload
|
|
1146
|
-
}));
|
|
1147
|
-
|
|
1148
|
-
case 3:
|
|
1149
|
-
_yield$this$prepareTx14 = _context16.sent;
|
|
1150
|
-
fee = _yield$this$prepareTx14.fee;
|
|
1151
|
-
ttl = _yield$this$prepareTx14.ttl;
|
|
1152
|
-
nonce = _yield$this$prepareTx14.nonce;
|
|
1153
|
-
|
|
1154
|
-
if (!this.nativeMode) {
|
|
1155
|
-
_context16.next = 11;
|
|
1156
|
-
break;
|
|
1157
|
-
}
|
|
1158
|
-
|
|
1159
|
-
_context16.t0 = buildTx(_merge(_head(_args14), {
|
|
1160
|
-
channelId: channelId,
|
|
1161
|
-
fromId: fromId,
|
|
1162
|
-
payload: payload,
|
|
1163
|
-
poi: poi,
|
|
1164
|
-
ttl: ttl,
|
|
1165
|
-
fee: fee,
|
|
1166
|
-
nonce: nonce
|
|
1167
|
-
}), TX_TYPE.channelSlash);
|
|
1168
|
-
_context16.next = 14;
|
|
1169
|
-
break;
|
|
1170
|
-
|
|
1171
|
-
case 11:
|
|
1172
|
-
_context16.next = 13;
|
|
1173
|
-
return this.api.postChannelSlash(_merge(_head(_args14), {
|
|
1174
|
-
channelId: channelId,
|
|
1175
|
-
fromId: fromId,
|
|
1176
|
-
payload: payload,
|
|
1177
|
-
poi: poi,
|
|
1178
|
-
ttl: ttl,
|
|
1179
|
-
fee: _parseInt(fee),
|
|
1180
|
-
nonce: nonce
|
|
1181
|
-
}));
|
|
1182
|
-
|
|
1183
|
-
case 13:
|
|
1184
|
-
_context16.t0 = _context16.sent;
|
|
1185
|
-
|
|
1186
|
-
case 14:
|
|
1187
|
-
_ref34 = _context16.t0;
|
|
1188
|
-
tx = _ref34.tx;
|
|
1189
|
-
return _context16.abrupt("return", tx);
|
|
1190
|
-
|
|
1191
|
-
case 17:
|
|
1192
|
-
case "end":
|
|
1193
|
-
return _context16.stop();
|
|
1194
|
-
}
|
|
1195
|
-
}
|
|
1196
|
-
}, _callee14, this);
|
|
1197
|
-
}));
|
|
1198
|
-
return _channelSlashTx.apply(this, arguments);
|
|
1199
|
-
}
|
|
1200
|
-
|
|
1201
|
-
function channelSettleTx(_x15) {
|
|
1202
|
-
return _channelSettleTx.apply(this, arguments);
|
|
1203
|
-
}
|
|
1204
|
-
|
|
1205
|
-
function _channelSettleTx() {
|
|
1206
|
-
_channelSettleTx = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(_ref15) {
|
|
1207
|
-
var channelId,
|
|
1208
|
-
fromId,
|
|
1209
|
-
initiatorAmountFinal,
|
|
1210
|
-
responderAmountFinal,
|
|
1211
|
-
_yield$this$prepareTx15,
|
|
1212
|
-
fee,
|
|
1213
|
-
ttl,
|
|
1214
|
-
nonce,
|
|
1215
|
-
_ref35,
|
|
1216
|
-
tx,
|
|
1217
|
-
_args15 = arguments;
|
|
1218
|
-
|
|
1219
|
-
return _regeneratorRuntime.wrap(function _callee15$(_context17) {
|
|
1220
|
-
while (1) {
|
|
1221
|
-
switch (_context17.prev = _context17.next) {
|
|
1222
|
-
case 0:
|
|
1223
|
-
channelId = _ref15.channelId, fromId = _ref15.fromId, initiatorAmountFinal = _ref15.initiatorAmountFinal, responderAmountFinal = _ref15.responderAmountFinal;
|
|
1224
|
-
_context17.next = 3;
|
|
1225
|
-
return this.prepareTxParams(TX_TYPE.channelSettle, _objectSpread({
|
|
1226
|
-
senderId: fromId
|
|
1227
|
-
}, _head(_args15)));
|
|
1228
|
-
|
|
1229
|
-
case 3:
|
|
1230
|
-
_yield$this$prepareTx15 = _context17.sent;
|
|
1231
|
-
fee = _yield$this$prepareTx15.fee;
|
|
1232
|
-
ttl = _yield$this$prepareTx15.ttl;
|
|
1233
|
-
nonce = _yield$this$prepareTx15.nonce;
|
|
1234
|
-
|
|
1235
|
-
if (!this.nativeMode) {
|
|
1236
|
-
_context17.next = 11;
|
|
1237
|
-
break;
|
|
1238
|
-
}
|
|
1239
|
-
|
|
1240
|
-
_context17.t0 = buildTx(_merge(_head(_args15), {
|
|
1241
|
-
channelId: channelId,
|
|
1242
|
-
fromId: fromId,
|
|
1243
|
-
initiatorAmountFinal: initiatorAmountFinal,
|
|
1244
|
-
responderAmountFinal: responderAmountFinal,
|
|
1245
|
-
ttl: ttl,
|
|
1246
|
-
fee: fee,
|
|
1247
|
-
nonce: nonce
|
|
1248
|
-
}), TX_TYPE.channelSettle);
|
|
1249
|
-
_context17.next = 14;
|
|
1250
|
-
break;
|
|
1251
|
-
|
|
1252
|
-
case 11:
|
|
1253
|
-
_context17.next = 13;
|
|
1254
|
-
return this.api.postChannelSettle(_merge(_head(_args15), {
|
|
1255
|
-
channelId: channelId,
|
|
1256
|
-
fromId: fromId,
|
|
1257
|
-
initiatorAmountFinal: _parseInt(initiatorAmountFinal),
|
|
1258
|
-
responderAmountFinal: _parseInt(responderAmountFinal),
|
|
1259
|
-
ttl: ttl,
|
|
1260
|
-
fee: _parseInt(fee),
|
|
1261
|
-
nonce: nonce
|
|
1262
|
-
}));
|
|
1263
|
-
|
|
1264
|
-
case 13:
|
|
1265
|
-
_context17.t0 = _context17.sent;
|
|
1266
|
-
|
|
1267
|
-
case 14:
|
|
1268
|
-
_ref35 = _context17.t0;
|
|
1269
|
-
tx = _ref35.tx;
|
|
1270
|
-
return _context17.abrupt("return", tx);
|
|
1271
|
-
|
|
1272
|
-
case 17:
|
|
1273
|
-
case "end":
|
|
1274
|
-
return _context17.stop();
|
|
1275
|
-
}
|
|
1276
|
-
}
|
|
1277
|
-
}, _callee15, this);
|
|
1278
|
-
}));
|
|
1279
|
-
return _channelSettleTx.apply(this, arguments);
|
|
1280
|
-
}
|
|
1281
|
-
|
|
1282
|
-
function channelSnapshotSoloTx(_x16) {
|
|
1283
|
-
return _channelSnapshotSoloTx.apply(this, arguments);
|
|
1284
|
-
}
|
|
1285
|
-
|
|
1286
|
-
function _channelSnapshotSoloTx() {
|
|
1287
|
-
_channelSnapshotSoloTx = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16(_ref16) {
|
|
1288
|
-
var channelId,
|
|
1289
|
-
fromId,
|
|
1290
|
-
payload,
|
|
1291
|
-
_yield$this$prepareTx16,
|
|
1292
|
-
fee,
|
|
1293
|
-
ttl,
|
|
1294
|
-
nonce,
|
|
1295
|
-
_ref36,
|
|
1296
|
-
tx,
|
|
1297
|
-
_args16 = arguments;
|
|
1298
|
-
|
|
1299
|
-
return _regeneratorRuntime.wrap(function _callee16$(_context18) {
|
|
1300
|
-
while (1) {
|
|
1301
|
-
switch (_context18.prev = _context18.next) {
|
|
1302
|
-
case 0:
|
|
1303
|
-
channelId = _ref16.channelId, fromId = _ref16.fromId, payload = _ref16.payload;
|
|
1304
|
-
_context18.next = 3;
|
|
1305
|
-
return this.prepareTxParams(TX_TYPE.channelSnapshotSolo, _objectSpread(_objectSpread({
|
|
1306
|
-
senderId: fromId
|
|
1307
|
-
}, _head(_args16)), {}, {
|
|
1308
|
-
payload: payload
|
|
1309
|
-
}));
|
|
1310
|
-
|
|
1311
|
-
case 3:
|
|
1312
|
-
_yield$this$prepareTx16 = _context18.sent;
|
|
1313
|
-
fee = _yield$this$prepareTx16.fee;
|
|
1314
|
-
ttl = _yield$this$prepareTx16.ttl;
|
|
1315
|
-
nonce = _yield$this$prepareTx16.nonce;
|
|
1316
|
-
|
|
1317
|
-
if (!this.nativeMode) {
|
|
1318
|
-
_context18.next = 11;
|
|
1319
|
-
break;
|
|
1320
|
-
}
|
|
1321
|
-
|
|
1322
|
-
_context18.t0 = buildTx(_merge(_head(_args16), {
|
|
1323
|
-
channelId: channelId,
|
|
1324
|
-
fromId: fromId,
|
|
1325
|
-
payload: payload,
|
|
1326
|
-
ttl: ttl,
|
|
1327
|
-
fee: fee,
|
|
1328
|
-
nonce: nonce
|
|
1329
|
-
}), TX_TYPE.channelSnapshotSolo);
|
|
1330
|
-
_context18.next = 14;
|
|
1331
|
-
break;
|
|
1332
|
-
|
|
1333
|
-
case 11:
|
|
1334
|
-
_context18.next = 13;
|
|
1335
|
-
return this.api.postChannelSnapshotSolo(_merge(_head(_args16), {
|
|
1336
|
-
channelId: channelId,
|
|
1337
|
-
fromId: fromId,
|
|
1338
|
-
payload: payload,
|
|
1339
|
-
ttl: ttl,
|
|
1340
|
-
fee: _parseInt(fee),
|
|
1341
|
-
nonce: nonce
|
|
1342
|
-
}));
|
|
1343
|
-
|
|
1344
|
-
case 13:
|
|
1345
|
-
_context18.t0 = _context18.sent;
|
|
1346
|
-
|
|
1347
|
-
case 14:
|
|
1348
|
-
_ref36 = _context18.t0;
|
|
1349
|
-
tx = _ref36.tx;
|
|
1350
|
-
return _context18.abrupt("return", tx);
|
|
1351
|
-
|
|
1352
|
-
case 17:
|
|
1353
|
-
case "end":
|
|
1354
|
-
return _context18.stop();
|
|
1355
|
-
}
|
|
1356
|
-
}
|
|
1357
|
-
}, _callee16, this);
|
|
1358
|
-
}));
|
|
1359
|
-
return _channelSnapshotSoloTx.apply(this, arguments);
|
|
1360
|
-
}
|
|
1361
|
-
|
|
1362
|
-
function gaAttachTx(_x17) {
|
|
1363
|
-
return _gaAttachTx.apply(this, arguments);
|
|
1364
|
-
}
|
|
1365
|
-
|
|
1366
|
-
function _gaAttachTx() {
|
|
1367
|
-
_gaAttachTx = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17(_ref17) {
|
|
1368
|
-
var ownerId,
|
|
1369
|
-
code,
|
|
1370
|
-
vmVersion,
|
|
1371
|
-
abiVersion,
|
|
1372
|
-
authFun,
|
|
1373
|
-
gas,
|
|
1374
|
-
_ref17$gasPrice,
|
|
1375
|
-
gasPrice,
|
|
1376
|
-
callData,
|
|
1377
|
-
ctVersion,
|
|
1378
|
-
_yield$this$prepareTx17,
|
|
1379
|
-
fee,
|
|
1380
|
-
ttl,
|
|
1381
|
-
nonce,
|
|
1382
|
-
_args17 = arguments;
|
|
1383
|
-
|
|
1384
|
-
return _regeneratorRuntime.wrap(function _callee17$(_context19) {
|
|
1385
|
-
while (1) {
|
|
1386
|
-
switch (_context19.prev = _context19.next) {
|
|
1387
|
-
case 0:
|
|
1388
|
-
ownerId = _ref17.ownerId, code = _ref17.code, vmVersion = _ref17.vmVersion, abiVersion = _ref17.abiVersion, authFun = _ref17.authFun, gas = _ref17.gas, _ref17$gasPrice = _ref17.gasPrice, gasPrice = _ref17$gasPrice === void 0 ? MIN_GAS_PRICE : _ref17$gasPrice, callData = _ref17.callData;
|
|
1389
|
-
// Get VM_ABI version
|
|
1390
|
-
ctVersion = this.getVmVersion(TX_TYPE.contractCreate, _head(_args17)); // Calculate fee, get absolute ttl (ttl + height), get account nonce
|
|
1391
|
-
|
|
1392
|
-
_context19.next = 4;
|
|
1393
|
-
return this.prepareTxParams(TX_TYPE.gaAttach, _objectSpread(_objectSpread({
|
|
1394
|
-
senderId: ownerId
|
|
1395
|
-
}, _head(_args17)), {}, {
|
|
1396
|
-
ctVersion: ctVersion,
|
|
1397
|
-
gasPrice: gasPrice
|
|
1398
|
-
}));
|
|
1399
|
-
|
|
1400
|
-
case 4:
|
|
1401
|
-
_yield$this$prepareTx17 = _context19.sent;
|
|
1402
|
-
fee = _yield$this$prepareTx17.fee;
|
|
1403
|
-
ttl = _yield$this$prepareTx17.ttl;
|
|
1404
|
-
nonce = _yield$this$prepareTx17.nonce;
|
|
1405
|
-
return _context19.abrupt("return", {
|
|
1406
|
-
tx: TxObject({
|
|
1407
|
-
params: _merge(_head(_args17), {
|
|
1408
|
-
nonce: nonce,
|
|
1409
|
-
ttl: ttl,
|
|
1410
|
-
fee: fee,
|
|
1411
|
-
ctVersion: ctVersion,
|
|
1412
|
-
gasPrice: gasPrice
|
|
1413
|
-
}),
|
|
1414
|
-
type: TX_TYPE.gaAttach
|
|
1415
|
-
}).encodedTx,
|
|
1416
|
-
contractId: buildContractId(ownerId, nonce)
|
|
1417
|
-
});
|
|
1418
|
-
|
|
1419
|
-
case 9:
|
|
1420
|
-
case "end":
|
|
1421
|
-
return _context19.stop();
|
|
1422
|
-
}
|
|
1423
|
-
}
|
|
1424
|
-
}, _callee17, this);
|
|
1425
|
-
}));
|
|
1426
|
-
return _gaAttachTx.apply(this, arguments);
|
|
1427
|
-
}
|
|
1428
|
-
|
|
1429
|
-
function payingForTx(_x18) {
|
|
1430
|
-
return _payingForTx.apply(this, arguments);
|
|
1431
|
-
}
|
|
1432
|
-
/**
|
|
1433
|
-
* Validated vm/abi version or get default based on transaction type and NODE version
|
|
1434
|
-
*
|
|
1435
|
-
* @param {string} txType Type of transaction
|
|
1436
|
-
* @param {object} vmAbi Object with vm and abi version fields
|
|
1437
|
-
* @return {object} Object with vm/abi version ({ vmVersion: number, abiVersion: number })
|
|
1438
|
-
*/
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
function _payingForTx() {
|
|
1442
|
-
_payingForTx = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18(_ref18) {
|
|
1443
|
-
var tx, payerId, args, params, _yield$this$prepareTx18, fee, nonce;
|
|
1444
|
-
|
|
1445
|
-
return _regeneratorRuntime.wrap(function _callee18$(_context20) {
|
|
1446
|
-
while (1) {
|
|
1447
|
-
switch (_context20.prev = _context20.next) {
|
|
1448
|
-
case 0:
|
|
1449
|
-
tx = _ref18.tx, payerId = _ref18.payerId, args = _objectWithoutProperties(_ref18, _excluded);
|
|
1450
|
-
params = {
|
|
1451
|
-
tx: unpackTx(tx),
|
|
1452
|
-
payerId: payerId
|
|
1453
|
-
};
|
|
1454
|
-
_context20.next = 4;
|
|
1455
|
-
return this.prepareTxParams(TX_TYPE.payingFor, _objectSpread(_objectSpread(_objectSpread({}, params), args), {}, {
|
|
1456
|
-
senderId: payerId
|
|
1457
|
-
}));
|
|
1458
|
-
|
|
1459
|
-
case 4:
|
|
1460
|
-
_yield$this$prepareTx18 = _context20.sent;
|
|
1461
|
-
fee = _yield$this$prepareTx18.fee;
|
|
1462
|
-
nonce = _yield$this$prepareTx18.nonce;
|
|
1463
|
-
return _context20.abrupt("return", buildTx(_objectSpread(_objectSpread(_objectSpread({}, params), args), {}, {
|
|
1464
|
-
fee: fee,
|
|
1465
|
-
nonce: nonce
|
|
1466
|
-
}), TX_TYPE.payingFor).tx);
|
|
1467
|
-
|
|
1468
|
-
case 8:
|
|
1469
|
-
case "end":
|
|
1470
|
-
return _context20.stop();
|
|
1471
|
-
}
|
|
1472
|
-
}
|
|
1473
|
-
}, _callee18, this);
|
|
1474
|
-
}));
|
|
1475
|
-
return _payingForTx.apply(this, arguments);
|
|
1476
|
-
}
|
|
1477
|
-
|
|
1478
|
-
function getVmVersion(txType) {
|
|
1479
|
-
var _context, _context2;
|
|
1480
|
-
|
|
1481
|
-
var _ref19 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
1482
|
-
vmVersion = _ref19.vmVersion,
|
|
1483
|
-
abiVersion = _ref19.abiVersion;
|
|
1484
|
-
|
|
1485
|
-
var _this$getNodeInfo = this.getNodeInfo(),
|
|
1486
|
-
consensusProtocolVersion = _this$getNodeInfo.consensusProtocolVersion;
|
|
1487
|
-
|
|
1488
|
-
var supportedProtocol = PROTOCOL_VM_ABI[consensusProtocolVersion];
|
|
1489
|
-
if (!supportedProtocol) throw new Error('Not supported consensus protocol version');
|
|
1490
|
-
var protocolForTX = supportedProtocol[txType];
|
|
1491
|
-
if (!protocolForTX) throw new Error('Not supported tx type');
|
|
1492
|
-
var ctVersion = {
|
|
1493
|
-
abiVersion: abiVersion || protocolForTX.abiVersion[0],
|
|
1494
|
-
vmVersion: vmVersion || protocolForTX.vmVersion[0]
|
|
1495
|
-
};
|
|
1496
|
-
if (protocolForTX.vmVersion.length && !_contains(ctVersion.vmVersion, protocolForTX.vmVersion)) throw new Error(_concatInstanceProperty(_context = "VM VERSION ".concat(ctVersion.vmVersion, " do not support by this node. Supported: [")).call(_context, protocolForTX.vmVersion, "]"));
|
|
1497
|
-
if (protocolForTX.abiVersion.length && !_contains(ctVersion.abiVersion, protocolForTX.abiVersion)) throw new Error(_concatInstanceProperty(_context2 = "ABI VERSION ".concat(ctVersion.abiVersion, " do not support by this node. Supported: [")).call(_context2, protocolForTX.abiVersion, "]"));
|
|
1498
|
-
return ctVersion;
|
|
1499
|
-
}
|
|
1500
|
-
/**
|
|
1501
|
-
* Compute the absolute ttl by adding the ttl to the current height of the chain
|
|
1502
|
-
*
|
|
1503
|
-
* @param {number} ttl
|
|
1504
|
-
* @param {boolean} relative ttl is absolute or relative(default: true(relative))
|
|
1505
|
-
* @return {number} Absolute Ttl
|
|
1506
|
-
*/
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
function calculateTtl() {
|
|
1510
|
-
return _calculateTtl.apply(this, arguments);
|
|
1511
|
-
}
|
|
1512
|
-
/**
|
|
1513
|
-
* Get the next nonce to be used for a transaction for an account
|
|
1514
|
-
*
|
|
1515
|
-
* @param {string} accountId
|
|
1516
|
-
* @param {number} nonce
|
|
1517
|
-
* @return {number} Next Nonce
|
|
1518
|
-
*/
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
function _calculateTtl() {
|
|
1522
|
-
_calculateTtl = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee19() {
|
|
1523
|
-
var ttl,
|
|
1524
|
-
relative,
|
|
1525
|
-
_yield$this$api$getCu,
|
|
1526
|
-
height,
|
|
1527
|
-
_args19 = arguments;
|
|
1528
|
-
|
|
1529
|
-
return _regeneratorRuntime.wrap(function _callee19$(_context21) {
|
|
1530
|
-
while (1) {
|
|
1531
|
-
switch (_context21.prev = _context21.next) {
|
|
1532
|
-
case 0:
|
|
1533
|
-
ttl = _args19.length > 0 && _args19[0] !== undefined ? _args19[0] : TX_TTL;
|
|
1534
|
-
relative = _args19.length > 1 && _args19[1] !== undefined ? _args19[1] : true;
|
|
1535
|
-
|
|
1536
|
-
if (!(ttl === 0)) {
|
|
1537
|
-
_context21.next = 4;
|
|
1538
|
-
break;
|
|
1539
|
-
}
|
|
1540
|
-
|
|
1541
|
-
return _context21.abrupt("return", 0);
|
|
1542
|
-
|
|
1543
|
-
case 4:
|
|
1544
|
-
if (!(ttl < 0)) {
|
|
1545
|
-
_context21.next = 6;
|
|
1546
|
-
break;
|
|
1547
|
-
}
|
|
1548
|
-
|
|
1549
|
-
throw new Error('ttl must be greater than 0');
|
|
1550
|
-
|
|
1551
|
-
case 6:
|
|
1552
|
-
if (!relative) {
|
|
1553
|
-
_context21.next = 12;
|
|
1554
|
-
break;
|
|
1555
|
-
}
|
|
1556
|
-
|
|
1557
|
-
_context21.next = 9;
|
|
1558
|
-
return this.api.getCurrentKeyBlock();
|
|
1559
|
-
|
|
1560
|
-
case 9:
|
|
1561
|
-
_yield$this$api$getCu = _context21.sent;
|
|
1562
|
-
height = _yield$this$api$getCu.height;
|
|
1563
|
-
return _context21.abrupt("return", +height + ttl);
|
|
1564
|
-
|
|
1565
|
-
case 12:
|
|
1566
|
-
return _context21.abrupt("return", ttl);
|
|
1567
|
-
|
|
1568
|
-
case 13:
|
|
1569
|
-
case "end":
|
|
1570
|
-
return _context21.stop();
|
|
1571
|
-
}
|
|
1572
|
-
}
|
|
1573
|
-
}, _callee19, this);
|
|
1574
|
-
}));
|
|
1575
|
-
return _calculateTtl.apply(this, arguments);
|
|
1576
|
-
}
|
|
1577
|
-
|
|
1578
|
-
function getAccountNonce(_x19, _x20) {
|
|
1579
|
-
return _getAccountNonce.apply(this, arguments);
|
|
1580
|
-
}
|
|
1581
|
-
/**
|
|
1582
|
-
* Calculate fee, get absolute ttl (ttl + height), get account nonce
|
|
1583
|
-
*
|
|
1584
|
-
* @param {String} txType Type of transaction
|
|
1585
|
-
* @param {Object} params Object which contains all tx data
|
|
1586
|
-
* @return {Object} { ttl, nonce, fee } Object with account nonce, absolute ttl and transaction fee
|
|
1587
|
-
*/
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
function _getAccountNonce() {
|
|
1591
|
-
_getAccountNonce = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee20(accountId, nonce) {
|
|
1592
|
-
var _yield$this$api$getAc, accountNonce;
|
|
1593
|
-
|
|
1594
|
-
return _regeneratorRuntime.wrap(function _callee20$(_context22) {
|
|
1595
|
-
while (1) {
|
|
1596
|
-
switch (_context22.prev = _context22.next) {
|
|
1597
|
-
case 0:
|
|
1598
|
-
if (!nonce) {
|
|
1599
|
-
_context22.next = 2;
|
|
1600
|
-
break;
|
|
1601
|
-
}
|
|
1602
|
-
|
|
1603
|
-
return _context22.abrupt("return", nonce);
|
|
1604
|
-
|
|
1605
|
-
case 2:
|
|
1606
|
-
_context22.next = 4;
|
|
1607
|
-
return this.api.getAccountByPubkey(accountId)["catch"](function () {
|
|
1608
|
-
return {
|
|
1609
|
-
nonce: 0
|
|
1610
|
-
};
|
|
1611
|
-
});
|
|
1612
|
-
|
|
1613
|
-
case 4:
|
|
1614
|
-
_yield$this$api$getAc = _context22.sent;
|
|
1615
|
-
accountNonce = _yield$this$api$getAc.nonce;
|
|
1616
|
-
return _context22.abrupt("return", accountNonce + 1);
|
|
1617
|
-
|
|
1618
|
-
case 7:
|
|
1619
|
-
case "end":
|
|
1620
|
-
return _context22.stop();
|
|
1621
|
-
}
|
|
1622
|
-
}
|
|
1623
|
-
}, _callee20, this);
|
|
1624
|
-
}));
|
|
1625
|
-
return _getAccountNonce.apply(this, arguments);
|
|
1626
|
-
}
|
|
1627
|
-
|
|
1628
|
-
function prepareTxParams(_x21, _x22) {
|
|
1629
|
-
return _prepareTxParams.apply(this, arguments);
|
|
1630
|
-
}
|
|
1631
|
-
/**
|
|
1632
|
-
* Transaction Stamp
|
|
1633
|
-
*
|
|
1634
|
-
* This is implementation of [Tx](api/tx.md) relays
|
|
1635
|
-
* the creation of transactions to {@link module:@aeternity/aepp-sdk/es/Node}.
|
|
1636
|
-
* This stamp provide ability to create native transaction's,
|
|
1637
|
-
* or transaction's using Node API.
|
|
1638
|
-
* As there is no built-in security between Node and client communication,
|
|
1639
|
-
* creating transaction using {@link module:@aeternity/aepp-sdk/es/Node} API
|
|
1640
|
-
* must never be used for production but can be very useful to verify other
|
|
1641
|
-
* implementations.
|
|
1642
|
-
* @function
|
|
1643
|
-
* @alias module:@aeternity/aepp-sdk/es/tx/tx
|
|
1644
|
-
* @rtype Stamp
|
|
1645
|
-
* @param {Object} [options={}] - Initializer object
|
|
1646
|
-
* @param {Boolean} [options.nativeMode=true] options.nativeMode - Use Native build of transaction's
|
|
1647
|
-
* @param {String} options.url - Node url
|
|
1648
|
-
* @param {String} options.internalUrl - Node internal url
|
|
1649
|
-
* @return {Object} Transaction instance
|
|
1650
|
-
* @example Transaction({url: 'https://testnet.aeternity.io/'})
|
|
1651
|
-
*/
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
function _prepareTxParams() {
|
|
1655
|
-
_prepareTxParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee21(txType, _ref20) {
|
|
1656
|
-
var senderId,
|
|
1657
|
-
n,
|
|
1658
|
-
t,
|
|
1659
|
-
f,
|
|
1660
|
-
gas,
|
|
1661
|
-
absoluteTtl,
|
|
1662
|
-
vsn,
|
|
1663
|
-
account,
|
|
1664
|
-
ttl,
|
|
1665
|
-
fee,
|
|
1666
|
-
_args21 = arguments;
|
|
1667
|
-
return _regeneratorRuntime.wrap(function _callee21$(_context23) {
|
|
1668
|
-
while (1) {
|
|
1669
|
-
switch (_context23.prev = _context23.next) {
|
|
1670
|
-
case 0:
|
|
1671
|
-
senderId = _ref20.senderId, n = _ref20.nonce, t = _ref20.ttl, f = _ref20.fee, gas = _ref20.gas, absoluteTtl = _ref20.absoluteTtl, vsn = _ref20.vsn;
|
|
1672
|
-
_context23.next = 3;
|
|
1673
|
-
return this.getAccount(senderId)["catch"](function (e) {
|
|
1674
|
-
return {
|
|
1675
|
-
nonce: 0
|
|
1676
|
-
};
|
|
1677
|
-
});
|
|
1678
|
-
|
|
1679
|
-
case 3:
|
|
1680
|
-
account = _context23.sent;
|
|
1681
|
-
|
|
1682
|
-
// Is GA account
|
|
1683
|
-
if (account.contractId) {
|
|
1684
|
-
n = 0;
|
|
1685
|
-
} else {
|
|
1686
|
-
n = n || account.nonce + 1;
|
|
1687
|
-
}
|
|
1688
|
-
|
|
1689
|
-
_context23.next = 7;
|
|
1690
|
-
return calculateTtl.call(this, t, !absoluteTtl);
|
|
1691
|
-
|
|
1692
|
-
case 7:
|
|
1693
|
-
ttl = _context23.sent;
|
|
1694
|
-
fee = calculateFee(f, txType, {
|
|
1695
|
-
showWarning: this.showWarning,
|
|
1696
|
-
gas: gas,
|
|
1697
|
-
params: _merge(_last(_args21), {
|
|
1698
|
-
nonce: n,
|
|
1699
|
-
ttl: ttl
|
|
1700
|
-
}),
|
|
1701
|
-
vsn: vsn
|
|
1702
|
-
});
|
|
1703
|
-
return _context23.abrupt("return", {
|
|
1704
|
-
fee: fee,
|
|
1705
|
-
ttl: ttl,
|
|
1706
|
-
nonce: n
|
|
1707
|
-
});
|
|
1708
|
-
|
|
1709
|
-
case 10:
|
|
1710
|
-
case "end":
|
|
1711
|
-
return _context23.stop();
|
|
1712
|
-
}
|
|
1713
|
-
}
|
|
1714
|
-
}, _callee21, this);
|
|
1715
|
-
}));
|
|
1716
|
-
return _prepareTxParams.apply(this, arguments);
|
|
1717
|
-
}
|
|
1718
|
-
|
|
1719
|
-
var Transaction = ChainNode.compose(Tx, {
|
|
1720
|
-
init: function init(_ref21) {
|
|
1721
|
-
var _ref21$nativeMode = _ref21.nativeMode,
|
|
1722
|
-
nativeMode = _ref21$nativeMode === void 0 ? true : _ref21$nativeMode,
|
|
1723
|
-
_ref21$showWarning = _ref21.showWarning,
|
|
1724
|
-
showWarning = _ref21$showWarning === void 0 ? false : _ref21$showWarning;
|
|
1725
|
-
this.nativeMode = nativeMode;
|
|
1726
|
-
this.showWarning = showWarning;
|
|
1727
|
-
},
|
|
1728
|
-
props: {
|
|
1729
|
-
nativeMode: true,
|
|
1730
|
-
showWarning: false
|
|
1731
|
-
},
|
|
1732
|
-
methods: {
|
|
1733
|
-
spendTx: spendTx,
|
|
1734
|
-
namePreclaimTx: namePreclaimTx,
|
|
1735
|
-
nameClaimTx: nameClaimTx,
|
|
1736
|
-
nameTransferTx: nameTransferTx,
|
|
1737
|
-
nameUpdateTx: nameUpdateTx,
|
|
1738
|
-
nameRevokeTx: nameRevokeTx,
|
|
1739
|
-
contractCreateTx: contractCreateTx,
|
|
1740
|
-
contractCallTx: contractCallTx,
|
|
1741
|
-
prepareTxParams: prepareTxParams,
|
|
1742
|
-
oracleRegisterTx: oracleRegisterTx,
|
|
1743
|
-
oracleExtendTx: oracleExtendTx,
|
|
1744
|
-
oraclePostQueryTx: oraclePostQueryTx,
|
|
1745
|
-
oracleRespondTx: oracleRespondTx,
|
|
1746
|
-
channelCloseSoloTx: channelCloseSoloTx,
|
|
1747
|
-
channelSlashTx: channelSlashTx,
|
|
1748
|
-
channelSettleTx: channelSettleTx,
|
|
1749
|
-
channelSnapshotSoloTx: channelSnapshotSoloTx,
|
|
1750
|
-
gaAttachTx: gaAttachTx,
|
|
1751
|
-
payingForTx: payingForTx,
|
|
1752
|
-
getAccountNonce: getAccountNonce,
|
|
1753
|
-
getVmVersion: getVmVersion
|
|
1754
|
-
}
|
|
1755
|
-
});
|
|
1756
|
-
export default Transaction;
|
|
1757
|
-
//# sourceMappingURL=tx.js.map
|