@ethereansos/interfaces-core 0.4.82 → 0.4.86
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 +139 -118
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +139 -118
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
@@ -32107,7 +32107,7 @@ function _getAddress() {
|
|
32107
32107
|
}]
|
32108
32108
|
}, {}, [30]);
|
32109
32109
|
|
32110
|
-
var web3
|
32110
|
+
var web3 = new Web3();
|
32111
32111
|
|
32112
32112
|
var getEtherscanAddress = function getEtherscanAddress(postFix, chainId) {
|
32113
32113
|
var address = 'http://';
|
@@ -32129,12 +32129,13 @@ var getEtherscanAddress = function getEtherscanAddress(postFix, chainId) {
|
|
32129
32129
|
return address;
|
32130
32130
|
};
|
32131
32131
|
|
32132
|
-
function sendBlockchainTransaction(provider, fromOrPlainPrivateKey, to, data, value) {
|
32132
|
+
function sendBlockchainTransaction(provider, fromOrPlainPrivateKey, to, data, value, additionalData) {
|
32133
|
+
additionalData = additionalData || {};
|
32133
32134
|
var address = fromOrPlainPrivateKey;
|
32134
32135
|
var privateKey;
|
32135
32136
|
|
32136
32137
|
try {
|
32137
|
-
address = web3
|
32138
|
+
address = web3.eth.accounts.privateKeyToAccount(fromOrPlainPrivateKey).address;
|
32138
32139
|
privateKey = Buffer.from(fromOrPlainPrivateKey, 'hex');
|
32139
32140
|
} catch (e) {}
|
32140
32141
|
|
@@ -32152,138 +32153,148 @@ function sendBlockchainTransaction(provider, fromOrPlainPrivateKey, to, data, va
|
|
32152
32153
|
|
32153
32154
|
case 4:
|
32154
32155
|
nonce = _context2.sent;
|
32155
|
-
nonce = web3
|
32156
|
+
nonce = web3.utils.toHex(nonce);
|
32156
32157
|
tx.nonce = nonce;
|
32157
32158
|
tx.from = address;
|
32158
32159
|
to && (tx.to = to);
|
32159
32160
|
tx.data = data;
|
32160
|
-
tx.value = web3
|
32161
|
-
_context2.t0 = web3
|
32161
|
+
tx.value = web3.utils.toHex(value || '0');
|
32162
|
+
_context2.t0 = web3.utils;
|
32162
32163
|
_context2.next = 14;
|
32163
32164
|
return sendAsync(provider, 'eth_chainId');
|
32164
32165
|
|
32165
32166
|
case 14:
|
32166
32167
|
_context2.t1 = _context2.sent;
|
32167
32168
|
tx.chainId = _context2.t0.toHex.call(_context2.t0, _context2.t1);
|
32168
|
-
_context2.t2 = web3
|
32169
|
-
_context2.
|
32169
|
+
_context2.t2 = web3.utils;
|
32170
|
+
_context2.t3 = additionalData.gasLimit;
|
32171
|
+
|
32172
|
+
if (_context2.t3) {
|
32173
|
+
_context2.next = 22;
|
32174
|
+
break;
|
32175
|
+
}
|
32176
|
+
|
32177
|
+
_context2.next = 21;
|
32170
32178
|
return sendAsync(provider, 'eth_getBlockByNumber', 'latest', false);
|
32171
32179
|
|
32172
|
-
case
|
32180
|
+
case 21:
|
32173
32181
|
_context2.t3 = _context2.sent.gasLimit;
|
32174
|
-
|
32182
|
+
|
32183
|
+
case 22:
|
32184
|
+
_context2.t4 = _context2.t3;
|
32185
|
+
tx.gasLimit = _context2.t2.toHex.call(_context2.t2, _context2.t4);
|
32175
32186
|
|
32176
32187
|
if (!provider.blockchainConnection) {
|
32177
|
-
_context2.next =
|
32188
|
+
_context2.next = 44;
|
32178
32189
|
break;
|
32179
32190
|
}
|
32180
32191
|
|
32181
|
-
_context2.prev =
|
32182
|
-
_context2.
|
32192
|
+
_context2.prev = 25;
|
32193
|
+
_context2.t5 = provider.accounts.indexOf(tx.from) === -1;
|
32183
32194
|
|
32184
|
-
if (!_context2.
|
32185
|
-
_context2.next =
|
32195
|
+
if (!_context2.t5) {
|
32196
|
+
_context2.next = 30;
|
32186
32197
|
break;
|
32187
32198
|
}
|
32188
32199
|
|
32189
|
-
_context2.next =
|
32200
|
+
_context2.next = 30;
|
32190
32201
|
return provider.blockchainConnection.unlockAccounts(tx.from);
|
32191
32202
|
|
32192
|
-
case
|
32193
|
-
_context2.next =
|
32203
|
+
case 30:
|
32204
|
+
_context2.next = 34;
|
32194
32205
|
break;
|
32195
32206
|
|
32196
|
-
case
|
32197
|
-
_context2.prev =
|
32198
|
-
_context2.
|
32199
|
-
|
32200
|
-
case 31:
|
32201
|
-
_context2.t6 = ok;
|
32202
|
-
_context2.t7 = sendAsync;
|
32203
|
-
_context2.t8 = provider;
|
32204
|
-
_context2.next = 36;
|
32205
|
-
return sendAsync(provider, 'eth_sendTransaction', tx);
|
32207
|
+
case 32:
|
32208
|
+
_context2.prev = 32;
|
32209
|
+
_context2.t6 = _context2["catch"](25);
|
32206
32210
|
|
32207
|
-
case
|
32208
|
-
_context2.
|
32211
|
+
case 34:
|
32212
|
+
_context2.t7 = ok;
|
32213
|
+
_context2.t8 = sendAsync;
|
32214
|
+
_context2.t9 = provider;
|
32209
32215
|
_context2.next = 39;
|
32210
|
-
return (
|
32216
|
+
return sendAsync(provider, 'eth_sendTransaction', tx);
|
32211
32217
|
|
32212
32218
|
case 39:
|
32213
32219
|
_context2.t10 = _context2.sent;
|
32214
|
-
|
32220
|
+
_context2.next = 42;
|
32221
|
+
return (0, _context2.t8)(_context2.t9, 'eth_getTransactionReceipt', _context2.t10);
|
32215
32222
|
|
32216
|
-
case
|
32217
|
-
|
32218
|
-
|
32223
|
+
case 42:
|
32224
|
+
_context2.t11 = _context2.sent;
|
32225
|
+
return _context2.abrupt("return", (0, _context2.t7)(_context2.t11));
|
32226
|
+
|
32227
|
+
case 44:
|
32228
|
+
if (!(window.bypassEstimation || additionalData.gasLimit)) {
|
32229
|
+
_context2.next = 48;
|
32219
32230
|
break;
|
32220
32231
|
}
|
32221
32232
|
|
32222
|
-
_context2.
|
32223
|
-
_context2.next =
|
32233
|
+
_context2.t12 = tx.gasLimit;
|
32234
|
+
_context2.next = 60;
|
32224
32235
|
break;
|
32225
32236
|
|
32226
|
-
case
|
32227
|
-
_context2.
|
32228
|
-
_context2.
|
32229
|
-
_context2.t14 = parseInt;
|
32237
|
+
case 48:
|
32238
|
+
_context2.t13 = web3.utils;
|
32239
|
+
_context2.t14 = web3.utils;
|
32230
32240
|
_context2.t15 = parseInt;
|
32231
|
-
_context2.
|
32241
|
+
_context2.t16 = parseInt;
|
32242
|
+
_context2.next = 54;
|
32232
32243
|
return sendAsync(provider, 'eth_estimateGas', tx);
|
32233
32244
|
|
32234
|
-
case
|
32235
|
-
_context2.
|
32236
|
-
_context2.
|
32237
|
-
_context2.
|
32238
|
-
_context2.
|
32239
|
-
_context2.
|
32240
|
-
_context2.
|
32245
|
+
case 54:
|
32246
|
+
_context2.t17 = _context2.sent;
|
32247
|
+
_context2.t18 = (0, _context2.t16)(_context2.t17);
|
32248
|
+
_context2.t19 = _context2.t18 * 1.10269;
|
32249
|
+
_context2.t20 = (0, _context2.t15)(_context2.t19);
|
32250
|
+
_context2.t21 = _context2.t14.toBN.call(_context2.t14, _context2.t20).toString();
|
32251
|
+
_context2.t12 = _context2.t13.toHex.call(_context2.t13, _context2.t21);
|
32241
32252
|
|
32242
|
-
case
|
32243
|
-
tx.gasLimit = _context2.
|
32244
|
-
_context2.
|
32253
|
+
case 60:
|
32254
|
+
tx.gasLimit = _context2.t12;
|
32255
|
+
_context2.t22 = !window.bypassEstimation;
|
32245
32256
|
|
32246
|
-
if (!_context2.
|
32247
|
-
_context2.next =
|
32257
|
+
if (!_context2.t22) {
|
32258
|
+
_context2.next = 65;
|
32248
32259
|
break;
|
32249
32260
|
}
|
32250
32261
|
|
32251
|
-
_context2.next =
|
32262
|
+
_context2.next = 65;
|
32252
32263
|
return sendAsync(provider, 'eth_estimateGas', tx);
|
32253
32264
|
|
32254
|
-
case
|
32265
|
+
case 65:
|
32255
32266
|
if (!privateKey) {
|
32256
|
-
_context2.next =
|
32267
|
+
_context2.next = 80;
|
32257
32268
|
break;
|
32258
32269
|
}
|
32259
32270
|
|
32260
|
-
_context2.
|
32261
|
-
_context2.
|
32262
|
-
_context2.
|
32263
|
-
_context2.next =
|
32271
|
+
_context2.t23 = global.EthereumJSTransaction.Transaction;
|
32272
|
+
_context2.t24 = tx;
|
32273
|
+
_context2.t25 = parseInt;
|
32274
|
+
_context2.next = 71;
|
32264
32275
|
return sendAsync(provider, 'eth_chainId');
|
32265
32276
|
|
32266
|
-
case
|
32267
|
-
_context2.
|
32268
|
-
_context2.
|
32269
|
-
_context2.
|
32270
|
-
chain: _context2.
|
32277
|
+
case 71:
|
32278
|
+
_context2.t26 = _context2.sent;
|
32279
|
+
_context2.t27 = (0, _context2.t25)(_context2.t26);
|
32280
|
+
_context2.t28 = {
|
32281
|
+
chain: _context2.t27
|
32271
32282
|
};
|
32272
|
-
transaction = new _context2.
|
32283
|
+
transaction = new _context2.t23(_context2.t24, _context2.t28);
|
32273
32284
|
transaction.sign(privateKey);
|
32274
32285
|
serializedTx = '0x' + transaction.serialize().toString('hex');
|
32275
32286
|
sendTransaction = sendAsync(provider, 'eth_sendRawTransaction', serializedTx);
|
32276
|
-
_context2.next =
|
32287
|
+
_context2.next = 81;
|
32277
32288
|
break;
|
32278
32289
|
|
32279
|
-
case
|
32290
|
+
case 80:
|
32280
32291
|
sendTransaction = sendAsync(provider, 'eth_sendTransaction', tx);
|
32281
32292
|
|
32282
|
-
case
|
32283
|
-
_context2.next =
|
32293
|
+
case 81:
|
32294
|
+
_context2.next = 83;
|
32284
32295
|
return sendTransaction;
|
32285
32296
|
|
32286
|
-
case
|
32297
|
+
case 83:
|
32287
32298
|
transactionHash = _context2.sent;
|
32288
32299
|
console.log(new Date().toUTCString(), 'Transaction!', getEtherscanAddress('tx/' + transactionHash, tx.chainId));
|
32289
32300
|
|
@@ -32341,20 +32352,20 @@ function sendBlockchainTransaction(provider, fromOrPlainPrivateKey, to, data, va
|
|
32341
32352
|
}();
|
32342
32353
|
|
32343
32354
|
setTimeout(timeout);
|
32344
|
-
_context2.next =
|
32355
|
+
_context2.next = 92;
|
32345
32356
|
break;
|
32346
32357
|
|
32347
|
-
case 86:
|
32348
|
-
_context2.prev = 86;
|
32349
|
-
_context2.t28 = _context2["catch"](0);
|
32350
|
-
return _context2.abrupt("return", ko(_context2.t28));
|
32351
|
-
|
32352
32358
|
case 89:
|
32359
|
+
_context2.prev = 89;
|
32360
|
+
_context2.t29 = _context2["catch"](0);
|
32361
|
+
return _context2.abrupt("return", ko(_context2.t29));
|
32362
|
+
|
32363
|
+
case 92:
|
32353
32364
|
case "end":
|
32354
32365
|
return _context2.stop();
|
32355
32366
|
}
|
32356
32367
|
}
|
32357
|
-
}, _callee2, null, [[0,
|
32368
|
+
}, _callee2, null, [[0, 89], [25, 32]]);
|
32358
32369
|
}));
|
32359
32370
|
|
32360
32371
|
return function (_x, _x2) {
|
@@ -32511,8 +32522,6 @@ var getAllContracts = function getAllContracts() {
|
|
32511
32522
|
return allContracts;
|
32512
32523
|
};
|
32513
32524
|
|
32514
|
-
var web3 = new Web3();
|
32515
|
-
|
32516
32525
|
function blockchainCall() {
|
32517
32526
|
return _blockchainCall.apply(this, arguments);
|
32518
32527
|
}
|
@@ -32527,8 +32536,10 @@ function _blockchainCall() {
|
|
32527
32536
|
data,
|
32528
32537
|
fromForSend,
|
32529
32538
|
to,
|
32539
|
+
dataInput,
|
32530
32540
|
result,
|
32531
32541
|
address,
|
32542
|
+
web3,
|
32532
32543
|
_args3 = arguments;
|
32533
32544
|
return regeneratorRuntime.wrap(function _callee3$(_context3) {
|
32534
32545
|
while (1) {
|
@@ -32544,74 +32555,76 @@ function _blockchainCall() {
|
|
32544
32555
|
method = (method.implementation ? method.get : method["new"] ? method["new"] : method).apply(void 0, _toConsumableArray(args));
|
32545
32556
|
} catch (e) {
|
32546
32557
|
data = args[args.length - 1];
|
32547
|
-
from = data.from || from;
|
32558
|
+
from = data.fromOrPlainPrivateKey || data.from || from;
|
32548
32559
|
value = data.value || value;
|
32549
32560
|
blockNumber = data.blockNumber || blockNumber;
|
32550
|
-
|
32561
|
+
args = args.slice(0, args.length - 1);
|
32562
|
+
method = (method.implementation ? method.get : method["new"] ? method["new"] : method).apply(void 0, _toConsumableArray(args));
|
32551
32563
|
}
|
32552
32564
|
|
32553
|
-
_context3.prev = 6;
|
32554
|
-
|
32555
32565
|
if (!(from === VOID_ETHEREUM_ADDRESS)) {
|
32556
|
-
_context3.next =
|
32566
|
+
_context3.next = 23;
|
32557
32567
|
break;
|
32558
32568
|
}
|
32559
32569
|
|
32560
|
-
_context3.
|
32561
|
-
|
32562
|
-
|
32563
|
-
});
|
32564
|
-
|
32565
|
-
case 10:
|
32566
|
-
_context3.t0 = _context3.sent;
|
32567
|
-
_context3.next = 14;
|
32570
|
+
_context3.prev = 7;
|
32571
|
+
from = method._parent.currentProvider.accounts[0];
|
32572
|
+
_context3.next = 23;
|
32568
32573
|
break;
|
32569
32574
|
|
32570
|
-
case
|
32571
|
-
_context3.
|
32575
|
+
case 11:
|
32576
|
+
_context3.prev = 11;
|
32577
|
+
_context3.t0 = _context3["catch"](7);
|
32578
|
+
_context3.prev = 13;
|
32579
|
+
_context3.next = 16;
|
32580
|
+
return method._parent.currentProvider.request({
|
32581
|
+
method: 'eth_requestAccounts'
|
32582
|
+
});
|
32572
32583
|
|
32573
|
-
case
|
32574
|
-
from = _context3.
|
32575
|
-
_context3.next =
|
32584
|
+
case 16:
|
32585
|
+
from = _context3.sent[0];
|
32586
|
+
_context3.next = 23;
|
32576
32587
|
break;
|
32577
32588
|
|
32578
|
-
case
|
32579
|
-
_context3.prev =
|
32580
|
-
_context3.t1 = _context3["catch"](
|
32589
|
+
case 19:
|
32590
|
+
_context3.prev = 19;
|
32591
|
+
_context3.t1 = _context3["catch"](13);
|
32581
32592
|
data = args[args.length - 1];
|
32582
32593
|
|
32583
32594
|
if (data) {
|
32584
|
-
from = data.from || from;
|
32595
|
+
from = data.fromOrPlainPrivateKey || data.from || from;
|
32585
32596
|
value = data.value || value;
|
32586
32597
|
blockNumber = data.blockNumber || blockNumber;
|
32587
32598
|
}
|
32588
32599
|
|
32589
|
-
case
|
32600
|
+
case 23:
|
32590
32601
|
fromForSend = from;
|
32591
32602
|
|
32592
32603
|
try {
|
32593
|
-
from =
|
32604
|
+
from = new Web3(method._parent.currentProvider).eth.accounts.privateKeyToAccount(fromForSend).address;
|
32594
32605
|
} catch (e) {}
|
32595
32606
|
|
32596
32607
|
to = method._parent.options.address;
|
32608
|
+
dataInput = data;
|
32597
32609
|
data = method.encodeABI();
|
32598
|
-
_context3.next =
|
32610
|
+
_context3.next = 30;
|
32599
32611
|
return method._method.stateMutability === 'view' || method._method.stateMutability === 'pure' ? method.call({
|
32600
32612
|
from: from,
|
32601
32613
|
value: value
|
32602
|
-
}, blockNumber) : sendBlockchainTransaction(method._parent.currentProvider, fromForSend, to, data, value);
|
32614
|
+
}, blockNumber) : sendBlockchainTransaction(method._parent.currentProvider, fromForSend, to, data, value, dataInput);
|
32603
32615
|
|
32604
|
-
case
|
32616
|
+
case 30:
|
32605
32617
|
result = _context3.sent;
|
32606
32618
|
|
32607
32619
|
if (to) {
|
32608
|
-
_context3.next =
|
32620
|
+
_context3.next = 38;
|
32609
32621
|
break;
|
32610
32622
|
}
|
32611
32623
|
|
32612
32624
|
method._parent.options.address = result.contractAddress;
|
32613
32625
|
address = method._parent.options.address;
|
32614
|
-
|
32626
|
+
web3 = new Web3(method._parent.currentProvider);
|
32627
|
+
_context3.next = 37;
|
32615
32628
|
return new Promise( /*#__PURE__*/function () {
|
32616
32629
|
var _ref = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(ok) {
|
32617
32630
|
var set;
|
@@ -32629,7 +32642,7 @@ function _blockchainCall() {
|
|
32629
32642
|
_context.prev = 0;
|
32630
32643
|
_context.t0 = web3.utils;
|
32631
32644
|
_context.next = 4;
|
32632
|
-
return
|
32645
|
+
return web3.eth.getCode(address);
|
32633
32646
|
|
32634
32647
|
case 4:
|
32635
32648
|
_context.t1 = _context.sent;
|
@@ -32680,18 +32693,18 @@ function _blockchainCall() {
|
|
32680
32693
|
};
|
32681
32694
|
}());
|
32682
32695
|
|
32683
|
-
case
|
32696
|
+
case 37:
|
32684
32697
|
return _context3.abrupt("return", method._parent);
|
32685
32698
|
|
32686
|
-
case
|
32699
|
+
case 38:
|
32687
32700
|
return _context3.abrupt("return", result);
|
32688
32701
|
|
32689
|
-
case
|
32702
|
+
case 39:
|
32690
32703
|
case "end":
|
32691
32704
|
return _context3.stop();
|
32692
32705
|
}
|
32693
32706
|
}
|
32694
|
-
}, _callee3, null, [[
|
32707
|
+
}, _callee3, null, [[7, 11], [13, 19]]);
|
32695
32708
|
}));
|
32696
32709
|
return _blockchainCall.apply(this, arguments);
|
32697
32710
|
}
|
@@ -34701,8 +34714,10 @@ function toEthereumSymbol(decimals) {
|
|
34701
34714
|
*/
|
34702
34715
|
|
34703
34716
|
function toDecimals(number, decimals) {
|
34704
|
-
|
34705
|
-
|
34717
|
+
var _number, _decimals;
|
34718
|
+
|
34719
|
+
number = numberToString(((_number = number) === null || _number === void 0 ? void 0 : _number.value) || number || 0);
|
34720
|
+
decimals = numberToString(((_decimals = decimals) === null || _decimals === void 0 ? void 0 : _decimals.value) || decimals || 0);
|
34706
34721
|
|
34707
34722
|
if (!number) {
|
34708
34723
|
number = '0';
|
@@ -48482,6 +48497,12 @@ function _tryRetrieveMetadata() {
|
|
48482
48497
|
return _tryRetrieveMetadata.apply(this, arguments);
|
48483
48498
|
}
|
48484
48499
|
|
48500
|
+
var conversionEncode = {
|
48501
|
+
100: '000064',
|
48502
|
+
500: '0001f4',
|
48503
|
+
3000: '000bb8',
|
48504
|
+
10000: '002710'
|
48505
|
+
};
|
48485
48506
|
function getTokenPriceInDollarsOnUniswap(_x, _x2, _x3, _x4) {
|
48486
48507
|
return _getTokenPriceInDollarsOnUniswap.apply(this, arguments);
|
48487
48508
|
}
|
@@ -48573,7 +48594,7 @@ function _getTokenPriceInDollarsOnUniswapV() {
|
|
48573
48594
|
uniTokenWeth = new Token(chainId, wethAddress, 18, 'ETH', 'Ethereum');
|
48574
48595
|
_context3.prev = 14;
|
48575
48596
|
_context3.next = 17;
|
48576
|
-
return Promise.all(Object.keys(
|
48597
|
+
return Promise.all(Object.keys(conversionEncode).map( /*#__PURE__*/function () {
|
48577
48598
|
var _ref3 = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(fee) {
|
48578
48599
|
var pool, slot0, price;
|
48579
48600
|
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|