@toruslabs/ethereum-controllers 5.6.0 → 5.6.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.
|
@@ -2939,8 +2939,8 @@ class AddChainController extends AbstractMessageController {
|
|
|
2939
2939
|
this.initialize();
|
|
2940
2940
|
}
|
|
2941
2941
|
async processAddChain(messageId) {
|
|
2942
|
+
const msgObject = this.getMessage(messageId);
|
|
2942
2943
|
try {
|
|
2943
|
-
const msgObject = this.getMessage(messageId);
|
|
2944
2944
|
await this.approveMessage(messageId, msgObject.messageParams);
|
|
2945
2945
|
await this.addChain(msgObject.messageParams);
|
|
2946
2946
|
this.updateMessage(objectSpread2_default()(objectSpread2_default()({}, msgObject), {}, {
|
|
@@ -2950,6 +2950,7 @@ class AddChainController extends AbstractMessageController {
|
|
|
2950
2950
|
return null;
|
|
2951
2951
|
} catch (error) {
|
|
2952
2952
|
external_loglevel_default().error(error);
|
|
2953
|
+
msgObject.error = (error === null || error === void 0 ? void 0 : error.message) || (error === null || error === void 0 ? void 0 : error.toString());
|
|
2953
2954
|
this.setMessageStatus(messageId, MessageStatus.FAILED);
|
|
2954
2955
|
}
|
|
2955
2956
|
}
|
|
@@ -3009,8 +3010,8 @@ class DecryptMessageController extends AbstractMessageController {
|
|
|
3009
3010
|
this.initialize();
|
|
3010
3011
|
}
|
|
3011
3012
|
async processDecryptMessage(messageId) {
|
|
3013
|
+
const msgObject = this.getMessage(messageId);
|
|
3012
3014
|
try {
|
|
3013
|
-
const msgObject = this.getMessage(messageId);
|
|
3014
3015
|
const cleanMsgParams = await this.approveMessage(messageId, msgObject.messageParams);
|
|
3015
3016
|
const parsedData = parseDecryptMessageData(cleanMsgParams.data);
|
|
3016
3017
|
const rawSig = this.decryptMessage(parsedData, cleanMsgParams.from);
|
|
@@ -3021,6 +3022,7 @@ class DecryptMessageController extends AbstractMessageController {
|
|
|
3021
3022
|
return rawSig;
|
|
3022
3023
|
} catch (error) {
|
|
3023
3024
|
external_loglevel_default().error(error);
|
|
3025
|
+
msgObject.error = (error === null || error === void 0 ? void 0 : error.message) || (error === null || error === void 0 ? void 0 : error.toString());
|
|
3024
3026
|
this.setMessageStatus(messageId, MessageStatus.FAILED);
|
|
3025
3027
|
}
|
|
3026
3028
|
}
|
|
@@ -3081,8 +3083,8 @@ class EncryptionPublicKeyController extends AbstractMessageController {
|
|
|
3081
3083
|
this.initialize();
|
|
3082
3084
|
}
|
|
3083
3085
|
async processGetEncryptionPublicKey(messageId) {
|
|
3086
|
+
const msgObject = this.getMessage(messageId);
|
|
3084
3087
|
try {
|
|
3085
|
-
const msgObject = this.getMessage(messageId);
|
|
3086
3088
|
const cleanMsgParams = await this.approveMessage(messageId, msgObject.messageParams);
|
|
3087
3089
|
const publicKey = this.signEncryptionPublicKey(cleanMsgParams.from);
|
|
3088
3090
|
this.updateMessage(objectSpread2_default()(objectSpread2_default()({}, msgObject), {}, {
|
|
@@ -3092,6 +3094,7 @@ class EncryptionPublicKeyController extends AbstractMessageController {
|
|
|
3092
3094
|
return publicKey;
|
|
3093
3095
|
} catch (error) {
|
|
3094
3096
|
external_loglevel_default().error(error);
|
|
3097
|
+
msgObject.error = (error === null || error === void 0 ? void 0 : error.message) || (error === null || error === void 0 ? void 0 : error.toString());
|
|
3095
3098
|
this.setMessageStatus(messageId, MessageStatus.FAILED);
|
|
3096
3099
|
}
|
|
3097
3100
|
}
|
|
@@ -3153,8 +3156,8 @@ class MessageController extends AbstractMessageController {
|
|
|
3153
3156
|
this.initialize();
|
|
3154
3157
|
}
|
|
3155
3158
|
async processSignMessage(messageId) {
|
|
3159
|
+
const msgObject = this.getMessage(messageId);
|
|
3156
3160
|
try {
|
|
3157
|
-
const msgObject = this.getMessage(messageId);
|
|
3158
3161
|
const cleanMsgParams = await this.approveMessage(messageId, msgObject.messageParams);
|
|
3159
3162
|
const rawSig = await this.signMessage(cleanMsgParams.data, cleanMsgParams.from);
|
|
3160
3163
|
this.updateMessage(objectSpread2_default()(objectSpread2_default()({}, msgObject), {}, {
|
|
@@ -3164,6 +3167,7 @@ class MessageController extends AbstractMessageController {
|
|
|
3164
3167
|
return rawSig;
|
|
3165
3168
|
} catch (error) {
|
|
3166
3169
|
external_loglevel_default().error(error);
|
|
3170
|
+
msgObject.error = (error === null || error === void 0 ? void 0 : error.message) || (error === null || error === void 0 ? void 0 : error.toString());
|
|
3167
3171
|
this.setMessageStatus(messageId, MessageStatus.FAILED);
|
|
3168
3172
|
}
|
|
3169
3173
|
}
|
|
@@ -3223,8 +3227,8 @@ class PersonalMessageController extends AbstractMessageController {
|
|
|
3223
3227
|
this.initialize();
|
|
3224
3228
|
}
|
|
3225
3229
|
async processSignPersonalMessage(messageId) {
|
|
3230
|
+
const msgObject = this.getMessage(messageId);
|
|
3226
3231
|
try {
|
|
3227
|
-
const msgObject = this.getMessage(messageId);
|
|
3228
3232
|
const cleanMsgParams = await this.approveMessage(messageId, msgObject.messageParams);
|
|
3229
3233
|
const rawSig = await this.signPersonalMessage(cleanMsgParams.data, cleanMsgParams.from);
|
|
3230
3234
|
this.updateMessage(objectSpread2_default()(objectSpread2_default()({}, msgObject), {}, {
|
|
@@ -3234,6 +3238,7 @@ class PersonalMessageController extends AbstractMessageController {
|
|
|
3234
3238
|
return rawSig;
|
|
3235
3239
|
} catch (error) {
|
|
3236
3240
|
external_loglevel_default().error(error);
|
|
3241
|
+
msgObject.error = (error === null || error === void 0 ? void 0 : error.message) || (error === null || error === void 0 ? void 0 : error.toString());
|
|
3237
3242
|
this.setMessageStatus(messageId, MessageStatus.FAILED);
|
|
3238
3243
|
}
|
|
3239
3244
|
}
|
|
@@ -3293,8 +3298,8 @@ class SwitchChainController extends AbstractMessageController {
|
|
|
3293
3298
|
this.initialize();
|
|
3294
3299
|
}
|
|
3295
3300
|
async processSwitchChain(messageId) {
|
|
3301
|
+
const msgObject = this.getMessage(messageId);
|
|
3296
3302
|
try {
|
|
3297
|
-
const msgObject = this.getMessage(messageId);
|
|
3298
3303
|
await this.approveMessage(messageId, msgObject.messageParams);
|
|
3299
3304
|
this.switchChain({
|
|
3300
3305
|
chainId: msgObject.messageParams.chainId
|
|
@@ -3306,6 +3311,7 @@ class SwitchChainController extends AbstractMessageController {
|
|
|
3306
3311
|
return null;
|
|
3307
3312
|
} catch (error) {
|
|
3308
3313
|
external_loglevel_default().error(error);
|
|
3314
|
+
msgObject.error = (error === null || error === void 0 ? void 0 : error.message) || (error === null || error === void 0 ? void 0 : error.toString());
|
|
3309
3315
|
this.setMessageStatus(messageId, MessageStatus.FAILED);
|
|
3310
3316
|
}
|
|
3311
3317
|
}
|
|
@@ -3377,8 +3383,8 @@ class TypedMessageController extends AbstractMessageController {
|
|
|
3377
3383
|
this.initialize();
|
|
3378
3384
|
}
|
|
3379
3385
|
async processSignTypedMessage(messageId) {
|
|
3386
|
+
const msgObject = this.getMessage(messageId);
|
|
3380
3387
|
try {
|
|
3381
|
-
const msgObject = this.getMessage(messageId);
|
|
3382
3388
|
const cleanMsgParams = await this.approveMessage(messageId, msgObject.messageParams);
|
|
3383
3389
|
const msgData = cleanMsgParams.version === eth_sig_util_namespaceObject.SignTypedDataVersion.V1 ? cleanMsgParams.data : JSON.parse(cleanMsgParams.data);
|
|
3384
3390
|
const rawSig = await this.signTypedData(msgData, cleanMsgParams.from, cleanMsgParams.version);
|
|
@@ -3389,6 +3395,7 @@ class TypedMessageController extends AbstractMessageController {
|
|
|
3389
3395
|
return rawSig;
|
|
3390
3396
|
} catch (error) {
|
|
3391
3397
|
external_loglevel_default().error(error);
|
|
3398
|
+
msgObject.error = (error === null || error === void 0 ? void 0 : error.message) || (error === null || error === void 0 ? void 0 : error.toString());
|
|
3392
3399
|
this.setMessageStatus(messageId, MessageStatus.FAILED);
|
|
3393
3400
|
}
|
|
3394
3401
|
}
|
|
@@ -4682,6 +4689,7 @@ class PreferencesController extends base_controllers_namespaceObject.BasePrefere
|
|
|
4682
4689
|
async refetchEtherscanTx(address) {
|
|
4683
4690
|
var _this$getAddressState3;
|
|
4684
4691
|
const selectedAddress = address || this.state.selectedAddress;
|
|
4692
|
+
const lowerCaseSelectedAddress = selectedAddress.toLowerCase();
|
|
4685
4693
|
if ((_this$getAddressState3 = this.getAddressState(selectedAddress)) !== null && _this$getAddressState3 !== void 0 && _this$getAddressState3.jwtToken) {
|
|
4686
4694
|
const {
|
|
4687
4695
|
chainId
|
|
@@ -4691,7 +4699,7 @@ class PreferencesController extends base_controllers_namespaceObject.BasePrefere
|
|
|
4691
4699
|
selectedAddress,
|
|
4692
4700
|
chainId: this.getProviderConfig().chainId
|
|
4693
4701
|
});
|
|
4694
|
-
const finalEthScanTxn = await addEtherscanTransactions(etherscanTxn,
|
|
4702
|
+
const finalEthScanTxn = await addEtherscanTransactions(etherscanTxn, lowerCaseSelectedAddress, this.provider, chainId);
|
|
4695
4703
|
external_loglevel_default().info("Formatted Etherscan Response", finalEthScanTxn);
|
|
4696
4704
|
this.updateState({
|
|
4697
4705
|
etherscanTransactions: finalEthScanTxn
|
|
@@ -2628,8 +2628,8 @@ class AddChainController extends AbstractMessageController {
|
|
|
2628
2628
|
this.initialize();
|
|
2629
2629
|
}
|
|
2630
2630
|
async processAddChain(messageId) {
|
|
2631
|
+
const msgObject = this.getMessage(messageId);
|
|
2631
2632
|
try {
|
|
2632
|
-
const msgObject = this.getMessage(messageId);
|
|
2633
2633
|
await this.approveMessage(messageId, msgObject.messageParams);
|
|
2634
2634
|
await this.addChain(msgObject.messageParams);
|
|
2635
2635
|
this.updateMessage(_objectSpread(_objectSpread({}, msgObject), {}, {
|
|
@@ -2639,6 +2639,7 @@ class AddChainController extends AbstractMessageController {
|
|
|
2639
2639
|
return null;
|
|
2640
2640
|
} catch (error) {
|
|
2641
2641
|
log.error(error);
|
|
2642
|
+
msgObject.error = (error === null || error === void 0 ? void 0 : error.message) || (error === null || error === void 0 ? void 0 : error.toString());
|
|
2642
2643
|
this.setMessageStatus(messageId, MessageStatus.FAILED);
|
|
2643
2644
|
}
|
|
2644
2645
|
}
|
|
@@ -2690,8 +2691,8 @@ class DecryptMessageController extends AbstractMessageController {
|
|
|
2690
2691
|
this.initialize();
|
|
2691
2692
|
}
|
|
2692
2693
|
async processDecryptMessage(messageId) {
|
|
2694
|
+
const msgObject = this.getMessage(messageId);
|
|
2693
2695
|
try {
|
|
2694
|
-
const msgObject = this.getMessage(messageId);
|
|
2695
2696
|
const cleanMsgParams = await this.approveMessage(messageId, msgObject.messageParams);
|
|
2696
2697
|
const parsedData = parseDecryptMessageData(cleanMsgParams.data);
|
|
2697
2698
|
const rawSig = this.decryptMessage(parsedData, cleanMsgParams.from);
|
|
@@ -2702,6 +2703,7 @@ class DecryptMessageController extends AbstractMessageController {
|
|
|
2702
2703
|
return rawSig;
|
|
2703
2704
|
} catch (error) {
|
|
2704
2705
|
log.error(error);
|
|
2706
|
+
msgObject.error = (error === null || error === void 0 ? void 0 : error.message) || (error === null || error === void 0 ? void 0 : error.toString());
|
|
2705
2707
|
this.setMessageStatus(messageId, MessageStatus.FAILED);
|
|
2706
2708
|
}
|
|
2707
2709
|
}
|
|
@@ -2754,8 +2756,8 @@ class EncryptionPublicKeyController extends AbstractMessageController {
|
|
|
2754
2756
|
this.initialize();
|
|
2755
2757
|
}
|
|
2756
2758
|
async processGetEncryptionPublicKey(messageId) {
|
|
2759
|
+
const msgObject = this.getMessage(messageId);
|
|
2757
2760
|
try {
|
|
2758
|
-
const msgObject = this.getMessage(messageId);
|
|
2759
2761
|
const cleanMsgParams = await this.approveMessage(messageId, msgObject.messageParams);
|
|
2760
2762
|
const publicKey = this.signEncryptionPublicKey(cleanMsgParams.from);
|
|
2761
2763
|
this.updateMessage(_objectSpread(_objectSpread({}, msgObject), {}, {
|
|
@@ -2765,6 +2767,7 @@ class EncryptionPublicKeyController extends AbstractMessageController {
|
|
|
2765
2767
|
return publicKey;
|
|
2766
2768
|
} catch (error) {
|
|
2767
2769
|
log.error(error);
|
|
2770
|
+
msgObject.error = (error === null || error === void 0 ? void 0 : error.message) || (error === null || error === void 0 ? void 0 : error.toString());
|
|
2768
2771
|
this.setMessageStatus(messageId, MessageStatus.FAILED);
|
|
2769
2772
|
}
|
|
2770
2773
|
}
|
|
@@ -2819,8 +2822,8 @@ class MessageController extends AbstractMessageController {
|
|
|
2819
2822
|
this.initialize();
|
|
2820
2823
|
}
|
|
2821
2824
|
async processSignMessage(messageId) {
|
|
2825
|
+
const msgObject = this.getMessage(messageId);
|
|
2822
2826
|
try {
|
|
2823
|
-
const msgObject = this.getMessage(messageId);
|
|
2824
2827
|
const cleanMsgParams = await this.approveMessage(messageId, msgObject.messageParams);
|
|
2825
2828
|
const rawSig = await this.signMessage(cleanMsgParams.data, cleanMsgParams.from);
|
|
2826
2829
|
this.updateMessage(_objectSpread(_objectSpread({}, msgObject), {}, {
|
|
@@ -2830,6 +2833,7 @@ class MessageController extends AbstractMessageController {
|
|
|
2830
2833
|
return rawSig;
|
|
2831
2834
|
} catch (error) {
|
|
2832
2835
|
log.error(error);
|
|
2836
|
+
msgObject.error = (error === null || error === void 0 ? void 0 : error.message) || (error === null || error === void 0 ? void 0 : error.toString());
|
|
2833
2837
|
this.setMessageStatus(messageId, MessageStatus.FAILED);
|
|
2834
2838
|
}
|
|
2835
2839
|
}
|
|
@@ -2882,8 +2886,8 @@ class PersonalMessageController extends AbstractMessageController {
|
|
|
2882
2886
|
this.initialize();
|
|
2883
2887
|
}
|
|
2884
2888
|
async processSignPersonalMessage(messageId) {
|
|
2889
|
+
const msgObject = this.getMessage(messageId);
|
|
2885
2890
|
try {
|
|
2886
|
-
const msgObject = this.getMessage(messageId);
|
|
2887
2891
|
const cleanMsgParams = await this.approveMessage(messageId, msgObject.messageParams);
|
|
2888
2892
|
const rawSig = await this.signPersonalMessage(cleanMsgParams.data, cleanMsgParams.from);
|
|
2889
2893
|
this.updateMessage(_objectSpread(_objectSpread({}, msgObject), {}, {
|
|
@@ -2893,6 +2897,7 @@ class PersonalMessageController extends AbstractMessageController {
|
|
|
2893
2897
|
return rawSig;
|
|
2894
2898
|
} catch (error) {
|
|
2895
2899
|
log.error(error);
|
|
2900
|
+
msgObject.error = (error === null || error === void 0 ? void 0 : error.message) || (error === null || error === void 0 ? void 0 : error.toString());
|
|
2896
2901
|
this.setMessageStatus(messageId, MessageStatus.FAILED);
|
|
2897
2902
|
}
|
|
2898
2903
|
}
|
|
@@ -2945,8 +2950,8 @@ class SwitchChainController extends AbstractMessageController {
|
|
|
2945
2950
|
this.initialize();
|
|
2946
2951
|
}
|
|
2947
2952
|
async processSwitchChain(messageId) {
|
|
2953
|
+
const msgObject = this.getMessage(messageId);
|
|
2948
2954
|
try {
|
|
2949
|
-
const msgObject = this.getMessage(messageId);
|
|
2950
2955
|
await this.approveMessage(messageId, msgObject.messageParams);
|
|
2951
2956
|
this.switchChain({
|
|
2952
2957
|
chainId: msgObject.messageParams.chainId
|
|
@@ -2958,6 +2963,7 @@ class SwitchChainController extends AbstractMessageController {
|
|
|
2958
2963
|
return null;
|
|
2959
2964
|
} catch (error) {
|
|
2960
2965
|
log.error(error);
|
|
2966
|
+
msgObject.error = (error === null || error === void 0 ? void 0 : error.message) || (error === null || error === void 0 ? void 0 : error.toString());
|
|
2961
2967
|
this.setMessageStatus(messageId, MessageStatus.FAILED);
|
|
2962
2968
|
}
|
|
2963
2969
|
}
|
|
@@ -3021,8 +3027,8 @@ class TypedMessageController extends AbstractMessageController {
|
|
|
3021
3027
|
this.initialize();
|
|
3022
3028
|
}
|
|
3023
3029
|
async processSignTypedMessage(messageId) {
|
|
3030
|
+
const msgObject = this.getMessage(messageId);
|
|
3024
3031
|
try {
|
|
3025
|
-
const msgObject = this.getMessage(messageId);
|
|
3026
3032
|
const cleanMsgParams = await this.approveMessage(messageId, msgObject.messageParams);
|
|
3027
3033
|
const msgData = cleanMsgParams.version === SignTypedDataVersion.V1 ? cleanMsgParams.data : JSON.parse(cleanMsgParams.data);
|
|
3028
3034
|
const rawSig = await this.signTypedData(msgData, cleanMsgParams.from, cleanMsgParams.version);
|
|
@@ -3033,6 +3039,7 @@ class TypedMessageController extends AbstractMessageController {
|
|
|
3033
3039
|
return rawSig;
|
|
3034
3040
|
} catch (error) {
|
|
3035
3041
|
log.error(error);
|
|
3042
|
+
msgObject.error = (error === null || error === void 0 ? void 0 : error.message) || (error === null || error === void 0 ? void 0 : error.toString());
|
|
3036
3043
|
this.setMessageStatus(messageId, MessageStatus.FAILED);
|
|
3037
3044
|
}
|
|
3038
3045
|
}
|
|
@@ -4281,6 +4288,7 @@ class PreferencesController extends BasePreferencesController {
|
|
|
4281
4288
|
async refetchEtherscanTx(address) {
|
|
4282
4289
|
var _this$getAddressState3;
|
|
4283
4290
|
const selectedAddress = address || this.state.selectedAddress;
|
|
4291
|
+
const lowerCaseSelectedAddress = selectedAddress.toLowerCase();
|
|
4284
4292
|
if ((_this$getAddressState3 = this.getAddressState(selectedAddress)) !== null && _this$getAddressState3 !== void 0 && _this$getAddressState3.jwtToken) {
|
|
4285
4293
|
const {
|
|
4286
4294
|
chainId
|
|
@@ -4290,7 +4298,7 @@ class PreferencesController extends BasePreferencesController {
|
|
|
4290
4298
|
selectedAddress,
|
|
4291
4299
|
chainId: this.getProviderConfig().chainId
|
|
4292
4300
|
});
|
|
4293
|
-
const finalEthScanTxn = await addEtherscanTransactions(etherscanTxn,
|
|
4301
|
+
const finalEthScanTxn = await addEtherscanTransactions(etherscanTxn, lowerCaseSelectedAddress, this.provider, chainId);
|
|
4294
4302
|
log.info("Formatted Etherscan Response", finalEthScanTxn);
|
|
4295
4303
|
this.updateState({
|
|
4296
4304
|
etherscanTransactions: finalEthScanTxn
|