@requestnetwork/utils 0.36.1-next.1872 → 0.36.1-next.1874
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.
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.estimateGasFees = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const ethers_1 = require("ethers");
|
|
6
|
-
const
|
|
6
|
+
const fee_suggestions_1 = require("@rainbow-me/fee-suggestions");
|
|
7
7
|
const index_1 = require("./index");
|
|
8
8
|
/**
|
|
9
9
|
* The function estimates gas fee with EIP-1559.
|
|
@@ -18,7 +18,7 @@ const index_1 = require("./index");
|
|
|
18
18
|
*/
|
|
19
19
|
function estimateGasFees({ provider, gasPriceMin, }) {
|
|
20
20
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
21
|
-
const suggestedFee = yield (0,
|
|
21
|
+
const suggestedFee = yield (0, fee_suggestions_1.suggestFees)(provider);
|
|
22
22
|
const baseFee = (0, index_1.maxBigNumber)(suggestedFee.baseFeeSuggestion, gasPriceMin || ethers_1.constants.Zero);
|
|
23
23
|
const maxPriorityFeePerGas = (0, index_1.maxBigNumber)(suggestedFee.maxPriorityFeeSuggestions.urgent, gasPriceMin || ethers_1.constants.Zero);
|
|
24
24
|
const maxFeePerGas = baseFee.add(maxPriorityFeePerGas);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"estimate-gas-fees.js","sourceRoot":"","sources":["../src/estimate-gas-fees.ts"],"names":[],"mappings":";;;;AAAA,mCAAyD;AACzD,
|
|
1
|
+
{"version":3,"file":"estimate-gas-fees.js","sourceRoot":"","sources":["../src/estimate-gas-fees.ts"],"names":[],"mappings":";;;;AAAA,mCAAyD;AACzD,iEAA0D;AAC1D,mCAAuC;AAEvC;;;;;;;;;;GAUG;AACH,SAAe,eAAe,CAAC,EAC7B,QAAQ,EACR,WAAW,GAIZ;;QAIC,MAAM,YAAY,GAAG,MAAM,IAAA,6BAAW,EAAC,QAAqC,CAAC,CAAC;QAE9E,MAAM,OAAO,GAAG,IAAA,oBAAY,EAAC,YAAY,CAAC,iBAAiB,EAAE,WAAW,IAAI,kBAAS,CAAC,IAAI,CAAC,CAAC;QAE5F,MAAM,oBAAoB,GAAG,IAAA,oBAAY,EACvC,YAAY,CAAC,yBAAyB,CAAC,MAAM,EAC7C,WAAW,IAAI,kBAAS,CAAC,IAAI,CAC9B,CAAC;QACF,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;QAEvD,IAAI,oBAAoB,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,YAAY,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE;YACpD,OAAO,EAAE,CAAC;SACX;QAED,OAAO;YACL,oBAAoB;YACpB,YAAY;SACb,CAAC;IACJ,CAAC;CAAA;AAEQ,0CAAe"}
|
package/dist/providers.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ type ProviderFactory = (network: string | undefined) => providers.Provider | str
|
|
|
7
7
|
*/
|
|
8
8
|
type CurrentProviderFactory = (network: string | undefined, defaultFactory: ProviderFactory) => providers.Provider | string;
|
|
9
9
|
/**
|
|
10
|
-
* Default API_KEYS configuration, can be
|
|
10
|
+
* Default API_KEYS configuration, can be overridden using initPaymentDetectionApiKeys
|
|
11
11
|
*/
|
|
12
12
|
declare let providersApiKeys: Record<string, string | (() => string)>;
|
|
13
13
|
/**
|
package/dist/providers.js
CHANGED
|
@@ -5,11 +5,11 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const ethers_1 = require("ethers");
|
|
6
6
|
let warned = false;
|
|
7
7
|
/**
|
|
8
|
-
* Default API_KEYS configuration, can be
|
|
8
|
+
* Default API_KEYS configuration, can be overridden using initPaymentDetectionApiKeys
|
|
9
9
|
*/
|
|
10
10
|
let providersApiKeys = {
|
|
11
|
-
// fallback to Ethers
|
|
12
|
-
infura: () => process.env.RN_INFURA_KEY || '
|
|
11
|
+
// fallback to Ethers v5 default projectId
|
|
12
|
+
infura: () => process.env.RN_INFURA_KEY || '84842078b09946638c03157f83405213',
|
|
13
13
|
};
|
|
14
14
|
/**
|
|
15
15
|
* @param defaultProviderOptions Default Provider Options as specified in https://docs.ethers.io/v5/api/providers/#providers-getDefaultProvider */
|
|
@@ -53,7 +53,7 @@ const defaultProviderFactory = (network) => {
|
|
|
53
53
|
if (networkRpcs[network]) {
|
|
54
54
|
return networkRpcs[network];
|
|
55
55
|
}
|
|
56
|
-
// use
|
|
56
|
+
// use Infura, if supported
|
|
57
57
|
try {
|
|
58
58
|
// try getting the URL for the given network. Will throw if not supported.
|
|
59
59
|
ethers_1.providers.InfuraProvider.getUrl(ethers_1.providers.getNetwork(network), {});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@requestnetwork/utils",
|
|
3
|
-
"version": "0.36.1-next.
|
|
3
|
+
"version": "0.36.1-next.1874+546dd9fd",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
"test:watch": "yarn test --watch"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@
|
|
43
|
+
"@rainbow-me/fee-suggestions": "2.1.0",
|
|
44
|
+
"@requestnetwork/types": "0.36.1-next.1874+546dd9fd",
|
|
44
45
|
"eccrypto": "1.1.6",
|
|
45
|
-
"eip1559-fee-suggestions-ethers": "1.3.3",
|
|
46
46
|
"ethers": "5.5.1",
|
|
47
47
|
"secp256k1": "4.0.2",
|
|
48
48
|
"tslib": "2.5.0"
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"ts-node": "10.9.1",
|
|
58
58
|
"typescript": "4.9.5"
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "546dd9fd6b5c5f55f0b652eb6a3eb897867465d6"
|
|
61
61
|
}
|