@ethereansos/interfaces-core 0.4.90 → 0.4.94
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/index.cjs.js +68 -104
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +68 -104
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
@@ -32118,6 +32118,7 @@ var getEtherscanAddress = function getEtherscanAddress(postFix, chainId) {
|
|
32118
32118
|
};
|
32119
32119
|
|
32120
32120
|
function sendBlockchainTransaction(provider, fromOrPlainPrivateKey, to, data, value, additionalData) {
|
32121
|
+
provider = window.ganache || provider;
|
32121
32122
|
additionalData = additionalData || {};
|
32122
32123
|
var address = fromOrPlainPrivateKey;
|
32123
32124
|
var privateKey;
|
@@ -32172,119 +32173,99 @@ function sendBlockchainTransaction(provider, fromOrPlainPrivateKey, to, data, va
|
|
32172
32173
|
_context2.t4 = _context2.t3;
|
32173
32174
|
tx.gasLimit = _context2.t2.toHex.call(_context2.t2, _context2.t4);
|
32174
32175
|
|
32175
|
-
if (!
|
32176
|
-
_context2.next =
|
32177
|
-
break;
|
32178
|
-
}
|
32179
|
-
|
32180
|
-
_context2.prev = 25;
|
32181
|
-
_context2.t5 = provider.accounts.indexOf(tx.from) === -1;
|
32182
|
-
|
32183
|
-
if (!_context2.t5) {
|
32184
|
-
_context2.next = 30;
|
32176
|
+
if (!window.ganache) {
|
32177
|
+
_context2.next = 35;
|
32185
32178
|
break;
|
32186
32179
|
}
|
32187
32180
|
|
32181
|
+
_context2.t5 = ok;
|
32182
|
+
_context2.t6 = sendAsync;
|
32183
|
+
_context2.t7 = window.ganache;
|
32188
32184
|
_context2.next = 30;
|
32189
|
-
return provider.blockchainConnection.unlockAccounts(tx.from);
|
32190
|
-
|
32191
|
-
case 30:
|
32192
|
-
_context2.next = 34;
|
32193
|
-
break;
|
32194
|
-
|
32195
|
-
case 32:
|
32196
|
-
_context2.prev = 32;
|
32197
|
-
_context2.t6 = _context2["catch"](25);
|
32198
|
-
|
32199
|
-
case 34:
|
32200
|
-
_context2.t7 = ok;
|
32201
|
-
_context2.t8 = sendAsync;
|
32202
|
-
_context2.t9 = provider;
|
32203
|
-
_context2.next = 39;
|
32204
32185
|
return sendAsync(provider, 'eth_sendTransaction', tx);
|
32205
32186
|
|
32206
|
-
case
|
32207
|
-
_context2.
|
32208
|
-
_context2.next =
|
32209
|
-
return (0, _context2.
|
32187
|
+
case 30:
|
32188
|
+
_context2.t8 = _context2.sent;
|
32189
|
+
_context2.next = 33;
|
32190
|
+
return (0, _context2.t6)(_context2.t7, 'eth_getTransactionReceipt', _context2.t8);
|
32210
32191
|
|
32211
|
-
case
|
32212
|
-
_context2.
|
32213
|
-
return _context2.abrupt("return", (0, _context2.
|
32192
|
+
case 33:
|
32193
|
+
_context2.t9 = _context2.sent;
|
32194
|
+
return _context2.abrupt("return", (0, _context2.t5)(_context2.t9));
|
32214
32195
|
|
32215
|
-
case
|
32196
|
+
case 35:
|
32216
32197
|
if (!(window.bypassEstimation || additionalData.gasLimit)) {
|
32217
|
-
_context2.next =
|
32198
|
+
_context2.next = 39;
|
32218
32199
|
break;
|
32219
32200
|
}
|
32220
32201
|
|
32221
|
-
_context2.
|
32222
|
-
_context2.next =
|
32202
|
+
_context2.t10 = tx.gasLimit;
|
32203
|
+
_context2.next = 51;
|
32223
32204
|
break;
|
32224
32205
|
|
32225
|
-
case
|
32226
|
-
_context2.
|
32227
|
-
_context2.
|
32228
|
-
_context2.
|
32229
|
-
_context2.
|
32230
|
-
_context2.next =
|
32206
|
+
case 39:
|
32207
|
+
_context2.t11 = web3.utils;
|
32208
|
+
_context2.t12 = web3.utils;
|
32209
|
+
_context2.t13 = parseInt;
|
32210
|
+
_context2.t14 = parseInt;
|
32211
|
+
_context2.next = 45;
|
32231
32212
|
return sendAsync(provider, 'eth_estimateGas', tx);
|
32232
32213
|
|
32233
|
-
case
|
32234
|
-
_context2.
|
32235
|
-
_context2.
|
32236
|
-
_context2.
|
32237
|
-
_context2.
|
32238
|
-
_context2.
|
32239
|
-
_context2.
|
32214
|
+
case 45:
|
32215
|
+
_context2.t15 = _context2.sent;
|
32216
|
+
_context2.t16 = (0, _context2.t14)(_context2.t15);
|
32217
|
+
_context2.t17 = _context2.t16 * 1.10269;
|
32218
|
+
_context2.t18 = (0, _context2.t13)(_context2.t17);
|
32219
|
+
_context2.t19 = _context2.t12.toBN.call(_context2.t12, _context2.t18).toString();
|
32220
|
+
_context2.t10 = _context2.t11.toHex.call(_context2.t11, _context2.t19);
|
32240
32221
|
|
32241
|
-
case
|
32242
|
-
tx.gasLimit = _context2.
|
32243
|
-
_context2.
|
32222
|
+
case 51:
|
32223
|
+
tx.gasLimit = _context2.t10;
|
32224
|
+
_context2.t20 = !window.bypassEstimation;
|
32244
32225
|
|
32245
|
-
if (!_context2.
|
32246
|
-
_context2.next =
|
32226
|
+
if (!_context2.t20) {
|
32227
|
+
_context2.next = 56;
|
32247
32228
|
break;
|
32248
32229
|
}
|
32249
32230
|
|
32250
|
-
_context2.next =
|
32231
|
+
_context2.next = 56;
|
32251
32232
|
return sendAsync(provider, 'eth_estimateGas', tx);
|
32252
32233
|
|
32253
|
-
case
|
32234
|
+
case 56:
|
32254
32235
|
tx.gas = tx.gasLimit;
|
32255
32236
|
|
32256
32237
|
if (!privateKey) {
|
32257
|
-
_context2.next =
|
32238
|
+
_context2.next = 72;
|
32258
32239
|
break;
|
32259
32240
|
}
|
32260
32241
|
|
32261
|
-
_context2.
|
32262
|
-
_context2.
|
32263
|
-
_context2.
|
32264
|
-
_context2.next =
|
32242
|
+
_context2.t21 = global.EthereumJSTransaction.Transaction;
|
32243
|
+
_context2.t22 = tx;
|
32244
|
+
_context2.t23 = parseInt;
|
32245
|
+
_context2.next = 63;
|
32265
32246
|
return sendAsync(provider, 'eth_chainId');
|
32266
32247
|
|
32267
|
-
case
|
32268
|
-
_context2.
|
32269
|
-
_context2.
|
32270
|
-
_context2.
|
32271
|
-
chain: _context2.
|
32248
|
+
case 63:
|
32249
|
+
_context2.t24 = _context2.sent;
|
32250
|
+
_context2.t25 = (0, _context2.t23)(_context2.t24);
|
32251
|
+
_context2.t26 = {
|
32252
|
+
chain: _context2.t25
|
32272
32253
|
};
|
32273
|
-
transaction = new _context2.
|
32254
|
+
transaction = new _context2.t21(_context2.t22, _context2.t26);
|
32274
32255
|
transaction.sign(privateKey);
|
32275
32256
|
serializedTx = '0x' + transaction.serialize().toString('hex');
|
32276
32257
|
sendTransaction = sendAsync(provider, 'eth_sendRawTransaction', serializedTx);
|
32277
|
-
_context2.next =
|
32258
|
+
_context2.next = 73;
|
32278
32259
|
break;
|
32279
32260
|
|
32280
|
-
case
|
32261
|
+
case 72:
|
32281
32262
|
sendTransaction = sendAsync(provider, 'eth_sendTransaction', tx);
|
32282
32263
|
|
32283
|
-
case
|
32284
|
-
_context2.next =
|
32264
|
+
case 73:
|
32265
|
+
_context2.next = 75;
|
32285
32266
|
return sendTransaction;
|
32286
32267
|
|
32287
|
-
case
|
32268
|
+
case 75:
|
32288
32269
|
transactionHash = _context2.sent;
|
32289
32270
|
console.log(new Date().toUTCString(), 'Transaction!', getEtherscanAddress('tx/' + transactionHash, tx.chainId));
|
32290
32271
|
|
@@ -32300,35 +32281,18 @@ function sendBlockchainTransaction(provider, fromOrPlainPrivateKey, to, data, va
|
|
32300
32281
|
|
32301
32282
|
case 2:
|
32302
32283
|
receipt = _context.sent;
|
32303
|
-
_context.t0 = !receipt || !receipt.blockNumber;
|
32304
|
-
|
32305
|
-
if (_context.t0) {
|
32306
|
-
_context.next = 12;
|
32307
|
-
break;
|
32308
|
-
}
|
32309
|
-
|
32310
|
-
_context.t1 = parseInt;
|
32311
|
-
_context.next = 8;
|
32312
|
-
return sendAsync(provider, 'eth_getBlockByNumber', 'latest', false);
|
32313
|
-
|
32314
|
-
case 8:
|
32315
|
-
_context.t2 = _context.sent.number;
|
32316
|
-
_context.t3 = (0, _context.t1)(_context.t2);
|
32317
|
-
_context.t4 = parseInt(receipt.blockNumber);
|
32318
|
-
_context.t0 = _context.t3 <= _context.t4;
|
32319
32284
|
|
32320
|
-
|
32321
|
-
|
32322
|
-
_context.next = 14;
|
32285
|
+
if (!(!receipt || !receipt.blockNumber)) {
|
32286
|
+
_context.next = 5;
|
32323
32287
|
break;
|
32324
32288
|
}
|
32325
32289
|
|
32326
32290
|
return _context.abrupt("return", setTimeout(timeout, 3000));
|
32327
32291
|
|
32328
|
-
case
|
32292
|
+
case 5:
|
32329
32293
|
return _context.abrupt("return", ok(receipt));
|
32330
32294
|
|
32331
|
-
case
|
32295
|
+
case 6:
|
32332
32296
|
case "end":
|
32333
32297
|
return _context.stop();
|
32334
32298
|
}
|
@@ -32342,20 +32306,20 @@ function sendBlockchainTransaction(provider, fromOrPlainPrivateKey, to, data, va
|
|
32342
32306
|
}();
|
32343
32307
|
|
32344
32308
|
setTimeout(timeout);
|
32345
|
-
_context2.next =
|
32309
|
+
_context2.next = 84;
|
32346
32310
|
break;
|
32347
32311
|
|
32348
|
-
case
|
32349
|
-
_context2.prev =
|
32350
|
-
_context2.
|
32351
|
-
return _context2.abrupt("return", ko(_context2.
|
32312
|
+
case 81:
|
32313
|
+
_context2.prev = 81;
|
32314
|
+
_context2.t27 = _context2["catch"](0);
|
32315
|
+
return _context2.abrupt("return", ko(_context2.t27));
|
32352
32316
|
|
32353
|
-
case
|
32317
|
+
case 84:
|
32354
32318
|
case "end":
|
32355
32319
|
return _context2.stop();
|
32356
32320
|
}
|
32357
32321
|
}
|
32358
|
-
}, _callee2, null, [[0,
|
32322
|
+
}, _callee2, null, [[0, 81]]);
|
32359
32323
|
}));
|
32360
32324
|
|
32361
32325
|
return function (_x, _x2) {
|
@@ -34686,7 +34650,7 @@ var symbols = {
|
|
34686
34650
|
*/
|
34687
34651
|
|
34688
34652
|
function toEthereumSymbol(decimals) {
|
34689
|
-
var d = '1' + new Array(decimals + 1).join('0');
|
34653
|
+
var d = '1' + new Array(parseInt(decimals) + 1).join('0');
|
34690
34654
|
return (Object.entries(symbols).find(function (_ref) {
|
34691
34655
|
var _ref2 = _slicedToArray(_ref, 2);
|
34692
34656
|
_ref2[0];
|
@@ -34961,10 +34925,10 @@ function formatMoney(value, decPlaces, thouSeparator, decSeparator) {
|
|
34961
34925
|
function fromDecimals(number, decimals, skipFormat) {
|
34962
34926
|
var _number, _decimals;
|
34963
34927
|
|
34964
|
-
number =
|
34928
|
+
number = !isNaN((_number = number) === null || _number === void 0 ? void 0 : _number.value) ? number.value : number;
|
34965
34929
|
decimals = Number(!isNaN((_decimals = decimals) === null || _decimals === void 0 ? void 0 : _decimals.value) ? decimals.value : decimals);
|
34966
34930
|
|
34967
|
-
if (!number) {
|
34931
|
+
if (!number || number === '0') {
|
34968
34932
|
number = '0';
|
34969
34933
|
}
|
34970
34934
|
|
@@ -34972,7 +34936,7 @@ function fromDecimals(number, decimals, skipFormat) {
|
|
34972
34936
|
return number;
|
34973
34937
|
}
|
34974
34938
|
|
34975
|
-
if (!number || !decimals) {
|
34939
|
+
if (!number || number === '0' || !decimals) {
|
34976
34940
|
return '0';
|
34977
34941
|
}
|
34978
34942
|
|