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