@pioneer-platform/eth-network 8.28.2 → 8.28.4
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/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +18 -0
- package/lib/types/client-types.d.ts +1 -2
- package/lib/utils.d.ts +3 -3
- package/lib/utils.js +10 -7
- package/package.json +4 -4
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
[0m[2m[35m$[0m [2m[1mtsc -p
|
|
2
|
+
[0m[2m[35m$[0m [2m[1mtsc -p . --skipLibCheck[0m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @pioneer-platform/eth-network
|
|
2
2
|
|
|
3
|
+
## 8.28.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- chore: fix: transaction event channel mismatch + add networkId to event payload
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @pioneer-platform/blockbook@8.27.5
|
|
10
|
+
- @pioneer-platform/nodes@8.26.2
|
|
11
|
+
|
|
12
|
+
## 8.28.3
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- fix: transaction event channel mismatch + add networkId to event payload
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
- @pioneer-platform/blockbook@8.27.4
|
|
19
|
+
- @pioneer-platform/nodes@8.26.1
|
|
20
|
+
|
|
3
21
|
## 8.28.2
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/lib/utils.d.ts
CHANGED
|
@@ -4,11 +4,11 @@ import { Network as EthNetwork, Address, ETHTransactionInfo, TokenTransactionInf
|
|
|
4
4
|
import { BigNumber } from '@ethersproject/bignumber';
|
|
5
5
|
export declare const ETH_DECIMAL = 18;
|
|
6
6
|
export declare const ETHPLORER_FREEKEY = "freekey";
|
|
7
|
-
export declare const SIMPLE_GAS_COST:
|
|
8
|
-
export declare const BASE_TOKEN_GAS_COST:
|
|
7
|
+
export declare const SIMPLE_GAS_COST: bigint;
|
|
8
|
+
export declare const BASE_TOKEN_GAS_COST: bigint;
|
|
9
9
|
export declare const DEFAULT_GAS_PRICE = 50;
|
|
10
10
|
export declare const ETHAddress = "0x0000000000000000000000000000000000000000";
|
|
11
|
-
export declare const MAX_APPROVAL:
|
|
11
|
+
export declare const MAX_APPROVAL: bigint;
|
|
12
12
|
/**
|
|
13
13
|
* XChainNetwork -> EthNetwork
|
|
14
14
|
*
|
package/lib/utils.js
CHANGED
|
@@ -3,19 +3,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.erc20ABI = exports.filterSelfTxs = exports.getPrefix = exports.getDefaultGasPrices = exports.getDefaultFees = exports.estimateDefaultFeesWithGasPricesAndLimits = exports.getFee = exports.getTxFromEthTransaction = exports.getTxFromTokenTransaction = exports.validateSymbol = exports.getTokenAddress = exports.validateAddress = exports.ethNetworkToXchains = exports.xchainNetworkToEths = exports.MAX_APPROVAL = exports.ETHAddress = exports.DEFAULT_GAS_PRICE = exports.BASE_TOKEN_GAS_COST = exports.SIMPLE_GAS_COST = exports.ETHPLORER_FREEKEY = exports.ETH_DECIMAL = void 0;
|
|
4
4
|
const xchain_util_1 = require("@xchainjs/xchain-util");
|
|
5
5
|
const types_1 = require("./types");
|
|
6
|
-
const bignumber_1 = require("@ethersproject/bignumber");
|
|
7
6
|
const ethers_1 = require("ethers");
|
|
7
|
+
const bignumber_1 = require("@ethersproject/bignumber");
|
|
8
8
|
const utils_1 = require("ethers/lib/utils");
|
|
9
|
+
// Define AssetETH and ETHChain locally since they're not exported in xchain-util@0.2.8
|
|
10
|
+
const AssetETH = { chain: 'ETH', symbol: 'ETH', ticker: 'ETH', type: 0 }; // AssetType.NATIVE = 0
|
|
11
|
+
const ETHChain = 'ETH';
|
|
9
12
|
exports.ETH_DECIMAL = 18;
|
|
10
13
|
exports.ETHPLORER_FREEKEY = 'freekey';
|
|
11
14
|
// from https://github.com/MetaMask/metamask-extension/blob/ee205b893fe61dc4736efc576e0663189a9d23da/ui/app/pages/send/send.constants.js#L39
|
|
12
15
|
// and based on recommendations of https://ethgasstation.info/blog/gas-limit/
|
|
13
|
-
exports.SIMPLE_GAS_COST =
|
|
14
|
-
exports.BASE_TOKEN_GAS_COST =
|
|
16
|
+
exports.SIMPLE_GAS_COST = BigInt(21000);
|
|
17
|
+
exports.BASE_TOKEN_GAS_COST = BigInt(100000);
|
|
15
18
|
// default gas price in gwei
|
|
16
19
|
exports.DEFAULT_GAS_PRICE = 50;
|
|
17
20
|
exports.ETHAddress = '0x0000000000000000000000000000000000000000';
|
|
18
|
-
exports.MAX_APPROVAL =
|
|
21
|
+
exports.MAX_APPROVAL = (BigInt(2) ** BigInt(256)) - BigInt(1);
|
|
19
22
|
/**
|
|
20
23
|
* XChainNetwork -> EthNetwork
|
|
21
24
|
*
|
|
@@ -105,7 +108,7 @@ const getTxFromTokenTransaction = (tx) => {
|
|
|
105
108
|
const symbol = tx.tokenSymbol;
|
|
106
109
|
const address = tx.contractAddress;
|
|
107
110
|
if ((0, exports.validateSymbol)(symbol) && (0, exports.validateAddress)(address)) {
|
|
108
|
-
const tokenAsset = (0, xchain_util_1.assetFromString)(`${
|
|
111
|
+
const tokenAsset = (0, xchain_util_1.assetFromString)(`${ETHChain}.${symbol}-${address}`);
|
|
109
112
|
if (tokenAsset) {
|
|
110
113
|
return {
|
|
111
114
|
asset: tokenAsset,
|
|
@@ -138,7 +141,7 @@ exports.getTxFromTokenTransaction = getTxFromTokenTransaction;
|
|
|
138
141
|
*/
|
|
139
142
|
const getTxFromEthTransaction = (tx) => {
|
|
140
143
|
return {
|
|
141
|
-
asset:
|
|
144
|
+
asset: AssetETH,
|
|
142
145
|
from: [
|
|
143
146
|
{
|
|
144
147
|
from: tx.from,
|
|
@@ -172,7 +175,7 @@ const estimateDefaultFeesWithGasPricesAndLimits = (asset) => {
|
|
|
172
175
|
};
|
|
173
176
|
const { fast: fastGP, fastest: fastestGP, average: averageGP } = gasPrices;
|
|
174
177
|
let assetAddress;
|
|
175
|
-
if (asset && (0, xchain_util_1.assetToString)(asset) !== (0, xchain_util_1.assetToString)(
|
|
178
|
+
if (asset && (0, xchain_util_1.assetToString)(asset) !== (0, xchain_util_1.assetToString)(AssetETH)) {
|
|
176
179
|
assetAddress = (0, exports.getTokenAddress)(asset);
|
|
177
180
|
}
|
|
178
181
|
let gasLimit;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pioneer-platform/eth-network",
|
|
3
|
-
"version": "8.28.
|
|
3
|
+
"version": "8.28.4",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"types": "./lib/index.d.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"test": "pnpm run build && node __tests__/test-module.js",
|
|
10
10
|
"test-dev": "pnpm run build && node lib/index.js",
|
|
11
11
|
"start": "pnpm run build:live",
|
|
12
|
-
"build": "tsc -p .",
|
|
12
|
+
"build": "tsc -p . --skipLibCheck",
|
|
13
13
|
"prepublish": "pnpm run build",
|
|
14
14
|
"build:watch": "pnpm run build && onchange 'src/**/*.ts' -- pnpm run build"
|
|
15
15
|
},
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
"@ethersproject/abstract-provider": "^5.8.0",
|
|
19
19
|
"@ethersproject/bignumber": "^5.8.0",
|
|
20
20
|
"@ethersproject/providers": "^5.8.0",
|
|
21
|
-
"@pioneer-platform/blockbook": "^8.27.
|
|
21
|
+
"@pioneer-platform/blockbook": "^8.27.5",
|
|
22
22
|
"@pioneer-platform/loggerdog": "^8.11.0",
|
|
23
|
-
"@pioneer-platform/nodes": "^8.26.
|
|
23
|
+
"@pioneer-platform/nodes": "^8.26.2",
|
|
24
24
|
"@pioneer-platform/pioneer-caip": "^9.19.0",
|
|
25
25
|
"@xchainjs/xchain-client": "0.9.0",
|
|
26
26
|
"@xchainjs/xchain-util": "0.2.6",
|