@pioneer-platform/eth-network 8.1.66 → 8.1.68
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/lib/index.js +7 -3
- package/lib/types/client-types.js +1 -1
- package/package.json +3 -1
package/lib/index.js
CHANGED
@@ -72,6 +72,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
72
72
|
var TAG = " | eth-network | ";
|
73
73
|
var Web3 = require('web3');
|
74
74
|
var ethers_1 = require("ethers");
|
75
|
+
// @ts-ignore
|
76
|
+
var BigNumber = require('bignumber.js');
|
75
77
|
//
|
76
78
|
var Axios = require('axios');
|
77
79
|
var https = require('https');
|
@@ -392,7 +394,9 @@ var get_token_transfer_data = function (toAddress, amount, contract) {
|
|
392
394
|
return [4 /*yield*/, newContract.methods.decimals().call()];
|
393
395
|
case 2:
|
394
396
|
decimals = _a.sent();
|
395
|
-
value =
|
397
|
+
value = web3.utils.toBN(amount).mul(web3.utils.toBN(10).pow(web3.utils.toBN(decimals)));
|
398
|
+
log.info(tag, "value: ", value.toString());
|
399
|
+
log.info(tag, "value: ", value);
|
396
400
|
return [4 /*yield*/, web3.eth.abi.encodeFunctionCall({
|
397
401
|
name: 'transfer',
|
398
402
|
type: 'function',
|
@@ -838,7 +842,7 @@ var estimate_fee = function (sourceAsset, params) {
|
|
838
842
|
return [4 /*yield*/, get_fees(entry)];
|
839
843
|
case 3:
|
840
844
|
fees = (_b.sent()).fees;
|
841
|
-
minimumWeiCost =
|
845
|
+
minimumWeiCost = BigNumber.from(fees.average);
|
842
846
|
minimumWeiCost = minimumWeiCost.mul(estimateGas.toNumber());
|
843
847
|
return [2 /*return*/, minimumWeiCost];
|
844
848
|
case 4:
|
@@ -862,7 +866,7 @@ var get_gas_limit = function (_a) {
|
|
862
866
|
case 1:
|
863
867
|
_b.trys.push([1, 6, , 7]);
|
864
868
|
log.debug(tag, "input: ", { asset: asset, recipient: recipient, amount: amount, memo: memo });
|
865
|
-
txAmount =
|
869
|
+
txAmount = BigNumber.from(amount === null || amount === void 0 ? void 0 : amount.amount().toFixed());
|
866
870
|
assetAddress = void 0;
|
867
871
|
if (asset && (0, xchain_util_1.assetToString)(asset) !== (0, xchain_util_1.assetToString)(xchain_util_1.AssetETH)) {
|
868
872
|
assetAddress = (0, utils_1.getTokenAddress)(asset);
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@pioneer-platform/eth-network",
|
3
|
-
"version": "8.1.
|
3
|
+
"version": "8.1.68",
|
4
4
|
"main": "./lib/index.js",
|
5
5
|
"types": "./lib/index.d.ts",
|
6
6
|
"scripts": {
|
@@ -19,6 +19,8 @@
|
|
19
19
|
"@pioneer-platform/loggerdog": "^8.1.29",
|
20
20
|
"@xchainjs/xchain-util": "^0.2.6",
|
21
21
|
"axios": "^0.21.4",
|
22
|
+
"bignumber.js": "^9.1.1",
|
23
|
+
"decimal.js": "^10.4.3",
|
22
24
|
"dotenv": "^8.2.0",
|
23
25
|
"ethers": "^5.1.0",
|
24
26
|
"request-promise": "^4.2.6",
|