@aeternity/aepp-sdk 9.0.1 → 10.0.0-beta.1
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/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 +30 -122
- 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 +73 -164
- package/es/account/multiple.js.map +1 -1
- package/es/ae/aens.js +164 -599
- package/es/ae/aens.js.map +1 -1
- package/es/ae/contract.js +82 -759
- package/es/ae/contract.js.map +1 -1
- package/es/ae/index.js +78 -315
- package/es/ae/index.js.map +1 -1
- package/es/ae/oracle.js +130 -498
- package/es/ae/oracle.js.map +1 -1
- package/es/chain/index.js +1 -1
- package/es/chain/index.js.map +1 -1
- package/es/chain/node.js +288 -1008
- 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 +203 -451
- 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 +319 -480
- 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 +129 -203
- package/es/contract/compiler.js.map +1 -1
- package/es/contract/ga/helpers.js +16 -114
- package/es/contract/ga/helpers.js.map +1 -1
- package/es/contract/ga/index.js +101 -242
- package/es/contract/ga/index.js.map +1 -1
- package/es/contract/index.js +1 -1
- package/es/contract/index.js.map +1 -1
- package/es/index.js +1 -2
- package/es/index.js.map +1 -1
- package/es/node-pool/index.js +54 -73
- package/es/node-pool/index.js.map +1 -1
- package/es/node.js +56 -157
- package/es/node.js.map +1 -1
- package/es/other.d.ts +1 -1
- package/es/tx/builder/helpers.js +38 -75
- package/es/tx/builder/helpers.js.map +1 -1
- package/es/tx/builder/index.js +196 -294
- package/es/tx/builder/index.js.map +1 -1
- package/es/tx/builder/schema.js +577 -459
- package/es/tx/builder/schema.js.map +1 -1
- package/es/tx/index.js +1 -1
- package/es/tx/index.js.map +1 -1
- package/es/tx/tx-object.js +105 -132
- package/es/tx/tx-object.js.map +1 -1
- package/es/tx/tx.js +808 -1628
- package/es/tx/tx.js.map +1 -1
- package/es/tx/validator.js +132 -268
- package/es/tx/validator.js.map +1 -1
- package/es/utils/aepp-wallet-communication/connection/browser-runtime.js +17 -21
- package/es/utils/aepp-wallet-communication/connection/browser-runtime.js.map +1 -1
- package/es/utils/aepp-wallet-communication/connection/browser-window-message.js +38 -74
- package/es/utils/aepp-wallet-communication/connection/browser-window-message.js.map +1 -1
- package/es/utils/aepp-wallet-communication/content-script-bridge.js +14 -15
- 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 +179 -510
- package/es/utils/aepp-wallet-communication/rpc/aepp-rpc.js.map +1 -1
- package/es/utils/aepp-wallet-communication/rpc/rpc-client.js +70 -89
- package/es/utils/aepp-wallet-communication/rpc/rpc-client.js.map +1 -1
- package/es/utils/aepp-wallet-communication/rpc/wallet-rpc.js +353 -600
- 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 +47 -62
- 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 +85 -224
- package/es/utils/swagger.js.map +1 -1
- package/package.json +44 -40
- package/src/account/multiple.js +18 -19
- package/src/ae/aens.js +25 -21
- package/src/ae/contract.js +32 -163
- package/src/ae/index.js +3 -3
- package/src/ae/oracle.js +18 -14
- package/src/chain/node.js +2 -4
- package/src/channel/handlers.js +0 -1
- package/src/channel/index.js +4 -5
- package/src/contract/aci/index.js +221 -102
- package/src/contract/aci/transformation.js +30 -422
- package/src/contract/compiler.js +45 -4
- package/src/contract/ga/helpers.js +1 -8
- package/src/contract/ga/index.js +13 -11
- package/src/index.js +0 -2
- package/src/node-pool/index.js +21 -12
- package/src/node.js +22 -26
- package/src/tx/builder/index.js +2 -1
- package/src/tx/builder/schema.js +2 -1
- package/src/tx/tx.js +147 -143
- package/src/tx/validator.js +9 -7
- package/src/utils/aepp-wallet-communication/rpc/aepp-rpc.js +1 -3
- package/src/utils/aepp-wallet-communication/rpc/wallet-rpc.js +3 -3
- package/src/utils/aepp-wallet-communication/schema.js +1 -3
- package/src/utils/bignumber.ts +2 -1
- package/src/utils/other.ts +1 -1
- package/src/utils/semver-satisfies.ts +1 -1
- package/src/utils/swagger.js +14 -7
- package/src/contract/aci/helpers.js +0 -140
package/es/tx/tx.js
CHANGED
|
@@ -1,27 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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; }
|
|
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
|
+
*/
|
|
22
17
|
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Transaction module
|
|
20
|
+
* @module @aeternity/aepp-sdk/es/tx/tx
|
|
21
|
+
* @export Transaction
|
|
22
|
+
* @example import { Transaction } from '@aeternity/aepp-sdk'
|
|
23
|
+
*/
|
|
25
24
|
import ChainNode from '../chain/node';
|
|
26
25
|
import Tx from './';
|
|
27
26
|
import { buildTx, calculateFee, unpackTx } from './builder';
|
|
@@ -29,1405 +28,729 @@ import { ABI_VERSIONS, MIN_GAS_PRICE, PROTOCOL_VM_ABI, TX_TYPE, TX_TTL } from '.
|
|
|
29
28
|
import { buildContractId } from './builder/helpers';
|
|
30
29
|
import { TxObject } from './tx-object';
|
|
31
30
|
|
|
32
|
-
function spendTx(
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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],
|
|
39
54
|
recipientId,
|
|
40
|
-
|
|
41
|
-
_ref$payload,
|
|
42
|
-
payload,
|
|
43
|
-
_yield$this$prepareTx,
|
|
44
|
-
fee,
|
|
45
|
-
ttl,
|
|
55
|
+
senderId,
|
|
46
56
|
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
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],
|
|
130
94
|
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
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],
|
|
209
131
|
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
132
|
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
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,
|
|
369
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],
|
|
370
206
|
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
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],
|
|
446
240
|
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
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],
|
|
531
283
|
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
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],
|
|
605
331
|
nonce,
|
|
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
|
-
|
|
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,
|
|
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,
|
|
689
377
|
queryFee,
|
|
690
|
-
oracleTtl,
|
|
691
|
-
_ref9$abiVersion,
|
|
692
378
|
abiVersion,
|
|
693
|
-
_yield$this$prepareTx9,
|
|
694
379
|
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
380
|
oracleTtl,
|
|
784
|
-
|
|
785
|
-
fee,
|
|
381
|
+
nonce,
|
|
786
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,
|
|
787
426
|
nonce,
|
|
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
|
-
|
|
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,
|
|
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,
|
|
863
466
|
responseTtl,
|
|
864
467
|
query,
|
|
865
468
|
queryTtl,
|
|
866
|
-
queryFee,
|
|
867
|
-
senderId,
|
|
868
|
-
_yield$this$prepareTx11,
|
|
869
469
|
fee,
|
|
470
|
+
queryFee,
|
|
870
471
|
ttl,
|
|
871
472
|
nonce,
|
|
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
|
-
|
|
913
|
-
|
|
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,
|
|
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,
|
|
956
515
|
responseTtl,
|
|
957
516
|
queryId,
|
|
958
517
|
response,
|
|
959
|
-
_yield$this$prepareTx12,
|
|
960
518
|
fee,
|
|
961
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],
|
|
962
720
|
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
721
|
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
722
|
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
723
|
ctVersion,
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
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);
|
|
724
|
+
gasPrice
|
|
725
|
+
},
|
|
726
|
+
type: TX_TYPE.gaAttach
|
|
727
|
+
}).encodedTx,
|
|
728
|
+
contractId: buildContractId(ownerId, nonce)
|
|
729
|
+
};
|
|
1427
730
|
}
|
|
1428
731
|
|
|
1429
|
-
function payingForTx(
|
|
1430
|
-
|
|
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;
|
|
1431
754
|
}
|
|
1432
755
|
/**
|
|
1433
756
|
* Validated vm/abi version or get default based on transaction type and NODE version
|
|
@@ -1438,64 +761,33 @@ function payingForTx(_x18) {
|
|
|
1438
761
|
*/
|
|
1439
762
|
|
|
1440
763
|
|
|
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
764
|
function getVmVersion(txType) {
|
|
1479
|
-
|
|
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];
|
|
1480
778
|
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
779
|
+
if (!protocolForTX.vmVersion.includes(vmVersion)) {
|
|
780
|
+
throw new Error(`VM VERSION ${vmVersion} do not support by this node. Supported: [${protocolForTX.vmVersion}]`);
|
|
781
|
+
}
|
|
1484
782
|
|
|
1485
|
-
|
|
1486
|
-
|
|
783
|
+
if (!protocolForTX.abiVersion.includes(abiVersion)) {
|
|
784
|
+
throw new Error(`ABI VERSION ${abiVersion} do not support by this node. Supported: [${protocolForTX.abiVersion}]`);
|
|
785
|
+
}
|
|
1487
786
|
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
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]
|
|
787
|
+
return {
|
|
788
|
+
vmVersion,
|
|
789
|
+
abiVersion
|
|
1495
790
|
};
|
|
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
791
|
}
|
|
1500
792
|
/**
|
|
1501
793
|
* Compute the absolute ttl by adding the ttl to the current height of the chain
|
|
@@ -1506,8 +798,20 @@ function getVmVersion(txType) {
|
|
|
1506
798
|
*/
|
|
1507
799
|
|
|
1508
800
|
|
|
1509
|
-
function calculateTtl() {
|
|
1510
|
-
|
|
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;
|
|
1511
815
|
}
|
|
1512
816
|
/**
|
|
1513
817
|
* Get the next nonce to be used for a transaction for an account
|
|
@@ -1518,65 +822,14 @@ function calculateTtl() {
|
|
|
1518
822
|
*/
|
|
1519
823
|
|
|
1520
824
|
|
|
1521
|
-
function
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
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);
|
|
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
|
|
1574
831
|
}));
|
|
1575
|
-
return
|
|
1576
|
-
}
|
|
1577
|
-
|
|
1578
|
-
function getAccountNonce(_x19, _x20) {
|
|
1579
|
-
return _getAccountNonce.apply(this, arguments);
|
|
832
|
+
return accountNonce + 1;
|
|
1580
833
|
}
|
|
1581
834
|
/**
|
|
1582
835
|
* Calculate fee, get absolute ttl (ttl + height), get account nonce
|
|
@@ -1587,46 +840,37 @@ function getAccountNonce(_x19, _x20) {
|
|
|
1587
840
|
*/
|
|
1588
841
|
|
|
1589
842
|
|
|
1590
|
-
function
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
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);
|
|
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
|
+
};
|
|
1630
874
|
}
|
|
1631
875
|
/**
|
|
1632
876
|
* Transaction Stamp
|
|
@@ -1651,106 +895,42 @@ function prepareTxParams(_x21, _x22) {
|
|
|
1651
895
|
*/
|
|
1652
896
|
|
|
1653
897
|
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
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;
|
|
898
|
+
const Transaction = ChainNode.compose(Tx, {
|
|
899
|
+
init(_ref20) {
|
|
900
|
+
let {
|
|
901
|
+
nativeMode = true,
|
|
902
|
+
showWarning = false
|
|
903
|
+
} = _ref20;
|
|
1725
904
|
this.nativeMode = nativeMode;
|
|
1726
905
|
this.showWarning = showWarning;
|
|
1727
906
|
},
|
|
907
|
+
|
|
1728
908
|
props: {
|
|
1729
909
|
nativeMode: true,
|
|
1730
910
|
showWarning: false
|
|
1731
911
|
},
|
|
1732
912
|
methods: {
|
|
1733
|
-
spendTx
|
|
1734
|
-
namePreclaimTx
|
|
1735
|
-
nameClaimTx
|
|
1736
|
-
nameTransferTx
|
|
1737
|
-
nameUpdateTx
|
|
1738
|
-
nameRevokeTx
|
|
1739
|
-
contractCreateTx
|
|
1740
|
-
contractCallTx
|
|
1741
|
-
prepareTxParams
|
|
1742
|
-
oracleRegisterTx
|
|
1743
|
-
oracleExtendTx
|
|
1744
|
-
oraclePostQueryTx
|
|
1745
|
-
oracleRespondTx
|
|
1746
|
-
channelCloseSoloTx
|
|
1747
|
-
channelSlashTx
|
|
1748
|
-
channelSettleTx
|
|
1749
|
-
channelSnapshotSoloTx
|
|
1750
|
-
gaAttachTx
|
|
1751
|
-
payingForTx
|
|
1752
|
-
getAccountNonce
|
|
1753
|
-
getVmVersion
|
|
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
|
|
1754
934
|
}
|
|
1755
935
|
});
|
|
1756
936
|
export default Transaction;
|