@toruslabs/ethereum-controllers 4.10.1 → 4.11.0
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 +5 -38
- package/dist/ethereumControllers.cjs.js.map +1 -1
- package/dist/ethereumControllers.esm.js +6 -39
- package/dist/ethereumControllers.esm.js.map +1 -1
- package/dist/ethereumControllers.umd.min.js +1 -1
- package/dist/ethereumControllers.umd.min.js.map +1 -1
- package/dist/types/Preferences/PreferencesController.d.ts +1 -1
- package/package.json +6 -6
- package/src/Preferences/PreferencesController.ts +10 -45
|
@@ -4078,7 +4078,8 @@ class PreferencesController extends base_controllers_namespaceObject.BasePrefere
|
|
|
4078
4078
|
locale = "en-US",
|
|
4079
4079
|
type,
|
|
4080
4080
|
signatures,
|
|
4081
|
-
network
|
|
4081
|
+
network,
|
|
4082
|
+
web3AuthClientId
|
|
4082
4083
|
} = params;
|
|
4083
4084
|
await super.init(address, userInfo, jwtToken, {
|
|
4084
4085
|
type,
|
|
@@ -4110,7 +4111,8 @@ class PreferencesController extends base_controllers_namespaceObject.BasePrefere
|
|
|
4110
4111
|
calledFromEmbed,
|
|
4111
4112
|
rehydrate
|
|
4112
4113
|
},
|
|
4113
|
-
address
|
|
4114
|
+
address,
|
|
4115
|
+
web3AuthClientId
|
|
4114
4116
|
});
|
|
4115
4117
|
}
|
|
4116
4118
|
getSelectedAddress() {
|
|
@@ -4152,13 +4154,8 @@ class PreferencesController extends base_controllers_namespaceObject.BasePrefere
|
|
|
4152
4154
|
} finally {
|
|
4153
4155
|
Promise.all([this.getWalletOrders(address).catch(error => {
|
|
4154
4156
|
external_loglevel_default().error("unable to fetch wallet orders", error);
|
|
4155
|
-
}), this.getTopUpOrders(address).catch(error => {
|
|
4156
|
-
external_loglevel_default().error("unable to fetch top up orders", error);
|
|
4157
4157
|
})]).then(data => {
|
|
4158
|
-
const [walletTx
|
|
4159
|
-
if (paymentTx) {
|
|
4160
|
-
this.calculatePaymentTx(paymentTx, address);
|
|
4161
|
-
}
|
|
4158
|
+
const [walletTx] = data;
|
|
4162
4159
|
// eslint-disable-next-line promise/always-return
|
|
4163
4160
|
if (walletTx && walletTx.length > 0) {
|
|
4164
4161
|
this.updateState({
|
|
@@ -4363,36 +4360,6 @@ class PreferencesController extends base_controllers_namespaceObject.BasePrefere
|
|
|
4363
4360
|
return false;
|
|
4364
4361
|
}
|
|
4365
4362
|
}
|
|
4366
|
-
calculatePaymentTx(txs, address) {
|
|
4367
|
-
const accumulator = [];
|
|
4368
|
-
for (const x of txs) {
|
|
4369
|
-
let action = "";
|
|
4370
|
-
const lowerCaseAction = x.action.toLowerCase();
|
|
4371
|
-
if (base_controllers_namespaceObject.ACTIVITY_ACTION_TOPUP.includes(lowerCaseAction)) action = base_controllers_namespaceObject.ACTIVITY_ACTION_TOPUP;else if (base_controllers_namespaceObject.ACTIVITY_ACTION_SEND.includes(lowerCaseAction)) action = base_controllers_namespaceObject.ACTIVITY_ACTION_SEND;else if (base_controllers_namespaceObject.ACTIVITY_ACTION_RECEIVE.includes(lowerCaseAction)) action = base_controllers_namespaceObject.ACTIVITY_ACTION_RECEIVE;
|
|
4372
|
-
accumulator.push({
|
|
4373
|
-
id: x.id,
|
|
4374
|
-
date: new Date(x.date).toDateString(),
|
|
4375
|
-
from: x.from,
|
|
4376
|
-
slicedFrom: x.slicedFrom,
|
|
4377
|
-
action,
|
|
4378
|
-
to: x.to,
|
|
4379
|
-
slicedTo: x.slicedTo,
|
|
4380
|
-
totalAmount: x.totalAmount,
|
|
4381
|
-
totalAmountString: x.totalAmountString,
|
|
4382
|
-
currencyAmount: x.currencyAmount,
|
|
4383
|
-
currencyAmountString: x.currencyAmountString,
|
|
4384
|
-
amount: x.amount,
|
|
4385
|
-
ethRate: x.ethRate,
|
|
4386
|
-
status: x.status.toLowerCase(),
|
|
4387
|
-
etherscanLink: x.etherscanLink || "",
|
|
4388
|
-
blockExplorerLink: "",
|
|
4389
|
-
currencyUsed: x.currencyUsed
|
|
4390
|
-
});
|
|
4391
|
-
}
|
|
4392
|
-
this.updateState({
|
|
4393
|
-
paymentTx: accumulator
|
|
4394
|
-
}, address);
|
|
4395
|
-
}
|
|
4396
4363
|
getChainOptions() {
|
|
4397
4364
|
var _identities$address$c, _identities$address;
|
|
4398
4365
|
let address = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.state.selectedAddress;
|