@toruslabs/ethereum-controllers 6.1.4 → 6.2.1
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/ethereumControllers.cjs.js +17 -7
- package/dist/ethereumControllers.esm.js +17 -7
- package/dist/ethereumControllers.umd.min.js +1 -1
- package/dist/lib.cjs/Nfts/NftsController.js +1 -1
- package/dist/lib.cjs/Preferences/PreferencesController.js +9 -0
- package/dist/lib.cjs/Transaction/TransactionController.js +2 -1
- package/dist/lib.cjs/utils/constants.js +5 -5
- package/dist/lib.esm/Nfts/NftsController.js +1 -1
- package/dist/lib.esm/Preferences/PreferencesController.js +9 -0
- package/dist/lib.esm/Transaction/TransactionController.js +2 -1
- package/dist/lib.esm/utils/constants.js +5 -5
- package/dist/types/Currency/CurrencyController.d.ts +1 -1
- package/dist/types/Preferences/PreferencesController.d.ts +16 -0
- package/package.json +3 -3
|
@@ -753,8 +753,8 @@ const SUPPORTED_NETWORKS = {
|
|
|
753
753
|
displayName: "Polygon",
|
|
754
754
|
logo: "polygon.svg",
|
|
755
755
|
rpcTarget: `https://polygon-mainnet.infura.io/v3/${INFURA_KEY}`,
|
|
756
|
-
ticker: "
|
|
757
|
-
tickerName: "
|
|
756
|
+
ticker: "POL",
|
|
757
|
+
tickerName: "Polygon Ecosystem Token"
|
|
758
758
|
},
|
|
759
759
|
[BSC_MAINNET_CHAIN_ID]: {
|
|
760
760
|
chainNamespace: base_controllers_namespaceObject.CHAIN_NAMESPACES.EIP155,
|
|
@@ -853,8 +853,8 @@ const SUPPORTED_NETWORKS = {
|
|
|
853
853
|
displayName: "Polygon Amoy",
|
|
854
854
|
logo: "polygon.svg",
|
|
855
855
|
rpcTarget: `https://polygon-amoy.infura.io/v3/${INFURA_KEY}`,
|
|
856
|
-
ticker: "
|
|
857
|
-
tickerName: "
|
|
856
|
+
ticker: "POL",
|
|
857
|
+
tickerName: "Polygon Ecosystem Token",
|
|
858
858
|
isTestnet: true
|
|
859
859
|
},
|
|
860
860
|
[BSC_TESTNET_CHAIN_ID]: {
|
|
@@ -980,7 +980,7 @@ const COINGECKO_SUPPORTED_CURRENCIES = new Set(["btc", "eth", "ltc", "bch", "bnb
|
|
|
980
980
|
const COINGECKO_PLATFORMS_CHAIN_CODE_MAP = {
|
|
981
981
|
[POLYGON_CHAIN_ID]: {
|
|
982
982
|
platform: "polygon-pos",
|
|
983
|
-
currency: "
|
|
983
|
+
currency: "pol"
|
|
984
984
|
},
|
|
985
985
|
[BSC_MAINNET_CHAIN_ID]: {
|
|
986
986
|
platform: "binance-smart-chain",
|
|
@@ -4239,7 +4239,7 @@ class NftsController extends base_controllers_namespaceObject.BaseController {
|
|
|
4239
4239
|
return undefined;
|
|
4240
4240
|
}
|
|
4241
4241
|
}));
|
|
4242
|
-
const nonZeroTokens = promiseSettledResult.filter(x => x.status === "fulfilled").map(x => x.value);
|
|
4242
|
+
const nonZeroTokens = promiseSettledResult.filter(x => x.status === "fulfilled" && x).map(x => x.value);
|
|
4243
4243
|
this.update({
|
|
4244
4244
|
nfts: {
|
|
4245
4245
|
[userAddress]: external_deepmerge_default()(this.userNfts, nonZeroTokens)
|
|
@@ -4493,6 +4493,15 @@ class PreferencesController extends base_controllers_namespaceObject.BasePrefere
|
|
|
4493
4493
|
return [];
|
|
4494
4494
|
}
|
|
4495
4495
|
}
|
|
4496
|
+
async fetchQuote(parameters) {
|
|
4497
|
+
try {
|
|
4498
|
+
const response = await this.wsApiClient.authPost("quote", parameters, this.authCredentials());
|
|
4499
|
+
return response.success ? response.data : [];
|
|
4500
|
+
} catch (error) {
|
|
4501
|
+
external_loglevel_default().error("unable to get swap quote", error);
|
|
4502
|
+
return [];
|
|
4503
|
+
}
|
|
4504
|
+
}
|
|
4496
4505
|
async getEtherScanTokens(address, chainId) {
|
|
4497
4506
|
const selectedAddress = address;
|
|
4498
4507
|
const result = await this.wsApiClient.authGet(`tokens?chainId=${chainId}&address=${selectedAddress}`, this.authCredentials());
|
|
@@ -6085,7 +6094,8 @@ class TransactionController extends TransactionStateManager {
|
|
|
6085
6094
|
maxFeePerGas: txMeta.transaction.maxFeePerGas,
|
|
6086
6095
|
maxPriorityFeePerGas: txMeta.transaction.maxPriorityFeePerGas,
|
|
6087
6096
|
nonce: Number.parseInt(txMeta.transaction.nonce, 16),
|
|
6088
|
-
to: txMeta.transaction.to
|
|
6097
|
+
to: txMeta.transaction.to,
|
|
6098
|
+
value: txMeta.transaction.value
|
|
6089
6099
|
};
|
|
6090
6100
|
const fromAddress = txMeta.transaction.from;
|
|
6091
6101
|
const tx = external_ethers_namespaceObject.Transaction.from(txParams);
|
|
@@ -565,8 +565,8 @@ const SUPPORTED_NETWORKS = {
|
|
|
565
565
|
displayName: "Polygon",
|
|
566
566
|
logo: "polygon.svg",
|
|
567
567
|
rpcTarget: `https://polygon-mainnet.infura.io/v3/${INFURA_KEY}`,
|
|
568
|
-
ticker: "
|
|
569
|
-
tickerName: "
|
|
568
|
+
ticker: "POL",
|
|
569
|
+
tickerName: "Polygon Ecosystem Token"
|
|
570
570
|
},
|
|
571
571
|
[BSC_MAINNET_CHAIN_ID]: {
|
|
572
572
|
chainNamespace: CHAIN_NAMESPACES.EIP155,
|
|
@@ -665,8 +665,8 @@ const SUPPORTED_NETWORKS = {
|
|
|
665
665
|
displayName: "Polygon Amoy",
|
|
666
666
|
logo: "polygon.svg",
|
|
667
667
|
rpcTarget: `https://polygon-amoy.infura.io/v3/${INFURA_KEY}`,
|
|
668
|
-
ticker: "
|
|
669
|
-
tickerName: "
|
|
668
|
+
ticker: "POL",
|
|
669
|
+
tickerName: "Polygon Ecosystem Token",
|
|
670
670
|
isTestnet: true
|
|
671
671
|
},
|
|
672
672
|
[BSC_TESTNET_CHAIN_ID]: {
|
|
@@ -792,7 +792,7 @@ const COINGECKO_SUPPORTED_CURRENCIES = new Set(["btc", "eth", "ltc", "bch", "bnb
|
|
|
792
792
|
const COINGECKO_PLATFORMS_CHAIN_CODE_MAP = {
|
|
793
793
|
[POLYGON_CHAIN_ID]: {
|
|
794
794
|
platform: "polygon-pos",
|
|
795
|
-
currency: "
|
|
795
|
+
currency: "pol"
|
|
796
796
|
},
|
|
797
797
|
[BSC_MAINNET_CHAIN_ID]: {
|
|
798
798
|
platform: "binance-smart-chain",
|
|
@@ -3872,7 +3872,7 @@ class NftsController extends BaseController {
|
|
|
3872
3872
|
return undefined;
|
|
3873
3873
|
}
|
|
3874
3874
|
}));
|
|
3875
|
-
const nonZeroTokens = promiseSettledResult.filter(x => x.status === "fulfilled").map(x => x.value);
|
|
3875
|
+
const nonZeroTokens = promiseSettledResult.filter(x => x.status === "fulfilled" && x).map(x => x.value);
|
|
3876
3876
|
this.update({
|
|
3877
3877
|
nfts: {
|
|
3878
3878
|
[userAddress]: deepmerge(this.userNfts, nonZeroTokens)
|
|
@@ -4119,6 +4119,15 @@ class PreferencesController extends BasePreferencesController {
|
|
|
4119
4119
|
return [];
|
|
4120
4120
|
}
|
|
4121
4121
|
}
|
|
4122
|
+
async fetchQuote(parameters) {
|
|
4123
|
+
try {
|
|
4124
|
+
const response = await this.wsApiClient.authPost("quote", parameters, this.authCredentials());
|
|
4125
|
+
return response.success ? response.data : [];
|
|
4126
|
+
} catch (error) {
|
|
4127
|
+
log.error("unable to get swap quote", error);
|
|
4128
|
+
return [];
|
|
4129
|
+
}
|
|
4130
|
+
}
|
|
4122
4131
|
async getEtherScanTokens(address, chainId) {
|
|
4123
4132
|
const selectedAddress = address;
|
|
4124
4133
|
const result = await this.wsApiClient.authGet(`tokens?chainId=${chainId}&address=${selectedAddress}`, this.authCredentials());
|
|
@@ -5647,7 +5656,8 @@ class TransactionController extends TransactionStateManager {
|
|
|
5647
5656
|
maxFeePerGas: txMeta.transaction.maxFeePerGas,
|
|
5648
5657
|
maxPriorityFeePerGas: txMeta.transaction.maxPriorityFeePerGas,
|
|
5649
5658
|
nonce: Number.parseInt(txMeta.transaction.nonce, 16),
|
|
5650
|
-
to: txMeta.transaction.to
|
|
5659
|
+
to: txMeta.transaction.to,
|
|
5660
|
+
value: txMeta.transaction.value
|
|
5651
5661
|
};
|
|
5652
5662
|
const fromAddress = txMeta.transaction.from;
|
|
5653
5663
|
const tx = Transaction.from(txParams);
|