@ethereansos/interfaces-core 0.4.84 → 0.4.88
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 +130 -115
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +130 -115
- package/dist/index.esm.js.map +1 -1
- package/package.json +2 -2
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,150 @@ 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:
|
32266
|
+
tx.gas = tx.gasLimit;
|
32267
|
+
|
32255
32268
|
if (!privateKey) {
|
32256
|
-
_context2.next =
|
32269
|
+
_context2.next = 81;
|
32257
32270
|
break;
|
32258
32271
|
}
|
32259
32272
|
|
32260
|
-
_context2.
|
32261
|
-
_context2.
|
32262
|
-
_context2.
|
32263
|
-
_context2.next =
|
32273
|
+
_context2.t23 = global.EthereumJSTransaction.Transaction;
|
32274
|
+
_context2.t24 = tx;
|
32275
|
+
_context2.t25 = parseInt;
|
32276
|
+
_context2.next = 72;
|
32264
32277
|
return sendAsync(provider, 'eth_chainId');
|
32265
32278
|
|
32266
|
-
case
|
32267
|
-
_context2.
|
32268
|
-
_context2.
|
32269
|
-
_context2.
|
32270
|
-
chain: _context2.
|
32279
|
+
case 72:
|
32280
|
+
_context2.t26 = _context2.sent;
|
32281
|
+
_context2.t27 = (0, _context2.t25)(_context2.t26);
|
32282
|
+
_context2.t28 = {
|
32283
|
+
chain: _context2.t27
|
32271
32284
|
};
|
32272
|
-
transaction = new _context2.
|
32285
|
+
transaction = new _context2.t23(_context2.t24, _context2.t28);
|
32273
32286
|
transaction.sign(privateKey);
|
32274
32287
|
serializedTx = '0x' + transaction.serialize().toString('hex');
|
32275
32288
|
sendTransaction = sendAsync(provider, 'eth_sendRawTransaction', serializedTx);
|
32276
|
-
_context2.next =
|
32289
|
+
_context2.next = 82;
|
32277
32290
|
break;
|
32278
32291
|
|
32279
|
-
case
|
32292
|
+
case 81:
|
32280
32293
|
sendTransaction = sendAsync(provider, 'eth_sendTransaction', tx);
|
32281
32294
|
|
32282
|
-
case
|
32283
|
-
_context2.next =
|
32295
|
+
case 82:
|
32296
|
+
_context2.next = 84;
|
32284
32297
|
return sendTransaction;
|
32285
32298
|
|
32286
|
-
case
|
32299
|
+
case 84:
|
32287
32300
|
transactionHash = _context2.sent;
|
32288
32301
|
console.log(new Date().toUTCString(), 'Transaction!', getEtherscanAddress('tx/' + transactionHash, tx.chainId));
|
32289
32302
|
|
@@ -32341,20 +32354,20 @@ function sendBlockchainTransaction(provider, fromOrPlainPrivateKey, to, data, va
|
|
32341
32354
|
}();
|
32342
32355
|
|
32343
32356
|
setTimeout(timeout);
|
32344
|
-
_context2.next =
|
32357
|
+
_context2.next = 93;
|
32345
32358
|
break;
|
32346
32359
|
|
32347
|
-
case
|
32348
|
-
_context2.prev =
|
32349
|
-
_context2.
|
32350
|
-
return _context2.abrupt("return", ko(_context2.
|
32360
|
+
case 90:
|
32361
|
+
_context2.prev = 90;
|
32362
|
+
_context2.t29 = _context2["catch"](0);
|
32363
|
+
return _context2.abrupt("return", ko(_context2.t29));
|
32351
32364
|
|
32352
|
-
case
|
32365
|
+
case 93:
|
32353
32366
|
case "end":
|
32354
32367
|
return _context2.stop();
|
32355
32368
|
}
|
32356
32369
|
}
|
32357
|
-
}, _callee2, null, [[0,
|
32370
|
+
}, _callee2, null, [[0, 90], [25, 32]]);
|
32358
32371
|
}));
|
32359
32372
|
|
32360
32373
|
return function (_x, _x2) {
|
@@ -32511,8 +32524,6 @@ var getAllContracts = function getAllContracts() {
|
|
32511
32524
|
return allContracts;
|
32512
32525
|
};
|
32513
32526
|
|
32514
|
-
var web3 = new Web3();
|
32515
|
-
|
32516
32527
|
function blockchainCall() {
|
32517
32528
|
return _blockchainCall.apply(this, arguments);
|
32518
32529
|
}
|
@@ -32527,8 +32538,10 @@ function _blockchainCall() {
|
|
32527
32538
|
data,
|
32528
32539
|
fromForSend,
|
32529
32540
|
to,
|
32541
|
+
dataInput,
|
32530
32542
|
result,
|
32531
32543
|
address,
|
32544
|
+
web3,
|
32532
32545
|
_args3 = arguments;
|
32533
32546
|
return regeneratorRuntime.wrap(function _callee3$(_context3) {
|
32534
32547
|
while (1) {
|
@@ -32544,74 +32557,76 @@ function _blockchainCall() {
|
|
32544
32557
|
method = (method.implementation ? method.get : method["new"] ? method["new"] : method).apply(void 0, _toConsumableArray(args));
|
32545
32558
|
} catch (e) {
|
32546
32559
|
data = args[args.length - 1];
|
32547
|
-
from = data.from || from;
|
32560
|
+
from = data.fromOrPlainPrivateKey || data.from || from;
|
32548
32561
|
value = data.value || value;
|
32549
32562
|
blockNumber = data.blockNumber || blockNumber;
|
32550
|
-
|
32563
|
+
args = args.slice(0, args.length - 1);
|
32564
|
+
method = (method.implementation ? method.get : method["new"] ? method["new"] : method).apply(void 0, _toConsumableArray(args));
|
32551
32565
|
}
|
32552
32566
|
|
32553
|
-
_context3.prev = 6;
|
32554
|
-
|
32555
32567
|
if (!(from === VOID_ETHEREUM_ADDRESS)) {
|
32556
|
-
_context3.next =
|
32568
|
+
_context3.next = 23;
|
32557
32569
|
break;
|
32558
32570
|
}
|
32559
32571
|
|
32560
|
-
_context3.
|
32561
|
-
|
32562
|
-
|
32563
|
-
});
|
32564
|
-
|
32565
|
-
case 10:
|
32566
|
-
_context3.t0 = _context3.sent;
|
32567
|
-
_context3.next = 14;
|
32572
|
+
_context3.prev = 7;
|
32573
|
+
from = method._parent.currentProvider.accounts[0];
|
32574
|
+
_context3.next = 23;
|
32568
32575
|
break;
|
32569
32576
|
|
32570
|
-
case
|
32571
|
-
_context3.
|
32577
|
+
case 11:
|
32578
|
+
_context3.prev = 11;
|
32579
|
+
_context3.t0 = _context3["catch"](7);
|
32580
|
+
_context3.prev = 13;
|
32581
|
+
_context3.next = 16;
|
32582
|
+
return method._parent.currentProvider.request({
|
32583
|
+
method: 'eth_requestAccounts'
|
32584
|
+
});
|
32572
32585
|
|
32573
|
-
case
|
32574
|
-
from = _context3.
|
32575
|
-
_context3.next =
|
32586
|
+
case 16:
|
32587
|
+
from = _context3.sent[0];
|
32588
|
+
_context3.next = 23;
|
32576
32589
|
break;
|
32577
32590
|
|
32578
|
-
case
|
32579
|
-
_context3.prev =
|
32580
|
-
_context3.t1 = _context3["catch"](
|
32591
|
+
case 19:
|
32592
|
+
_context3.prev = 19;
|
32593
|
+
_context3.t1 = _context3["catch"](13);
|
32581
32594
|
data = args[args.length - 1];
|
32582
32595
|
|
32583
32596
|
if (data) {
|
32584
|
-
from = data.from || from;
|
32597
|
+
from = data.fromOrPlainPrivateKey || data.from || from;
|
32585
32598
|
value = data.value || value;
|
32586
32599
|
blockNumber = data.blockNumber || blockNumber;
|
32587
32600
|
}
|
32588
32601
|
|
32589
|
-
case
|
32602
|
+
case 23:
|
32590
32603
|
fromForSend = from;
|
32591
32604
|
|
32592
32605
|
try {
|
32593
|
-
from =
|
32606
|
+
from = new Web3(method._parent.currentProvider).eth.accounts.privateKeyToAccount(fromForSend).address;
|
32594
32607
|
} catch (e) {}
|
32595
32608
|
|
32596
32609
|
to = method._parent.options.address;
|
32610
|
+
dataInput = data;
|
32597
32611
|
data = method.encodeABI();
|
32598
|
-
_context3.next =
|
32612
|
+
_context3.next = 30;
|
32599
32613
|
return method._method.stateMutability === 'view' || method._method.stateMutability === 'pure' ? method.call({
|
32600
32614
|
from: from,
|
32601
32615
|
value: value
|
32602
|
-
}, blockNumber) : sendBlockchainTransaction(method._parent.currentProvider, fromForSend, to, data, value);
|
32616
|
+
}, blockNumber) : sendBlockchainTransaction(method._parent.currentProvider, fromForSend, to, data, value, dataInput);
|
32603
32617
|
|
32604
|
-
case
|
32618
|
+
case 30:
|
32605
32619
|
result = _context3.sent;
|
32606
32620
|
|
32607
32621
|
if (to) {
|
32608
|
-
_context3.next =
|
32622
|
+
_context3.next = 38;
|
32609
32623
|
break;
|
32610
32624
|
}
|
32611
32625
|
|
32612
32626
|
method._parent.options.address = result.contractAddress;
|
32613
32627
|
address = method._parent.options.address;
|
32614
|
-
|
32628
|
+
web3 = new Web3(method._parent.currentProvider);
|
32629
|
+
_context3.next = 37;
|
32615
32630
|
return new Promise( /*#__PURE__*/function () {
|
32616
32631
|
var _ref = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(ok) {
|
32617
32632
|
var set;
|
@@ -32629,7 +32644,7 @@ function _blockchainCall() {
|
|
32629
32644
|
_context.prev = 0;
|
32630
32645
|
_context.t0 = web3.utils;
|
32631
32646
|
_context.next = 4;
|
32632
|
-
return
|
32647
|
+
return web3.eth.getCode(address);
|
32633
32648
|
|
32634
32649
|
case 4:
|
32635
32650
|
_context.t1 = _context.sent;
|
@@ -32680,18 +32695,18 @@ function _blockchainCall() {
|
|
32680
32695
|
};
|
32681
32696
|
}());
|
32682
32697
|
|
32683
|
-
case
|
32698
|
+
case 37:
|
32684
32699
|
return _context3.abrupt("return", method._parent);
|
32685
32700
|
|
32686
|
-
case
|
32701
|
+
case 38:
|
32687
32702
|
return _context3.abrupt("return", result);
|
32688
32703
|
|
32689
|
-
case
|
32704
|
+
case 39:
|
32690
32705
|
case "end":
|
32691
32706
|
return _context3.stop();
|
32692
32707
|
}
|
32693
32708
|
}
|
32694
|
-
}, _callee3, null, [[
|
32709
|
+
}, _callee3, null, [[7, 11], [13, 19]]);
|
32695
32710
|
}));
|
32696
32711
|
return _blockchainCall.apply(this, arguments);
|
32697
32712
|
}
|