@ututrust/web-components 1.1.8 → 1.1.9
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/index.js +17 -15
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -28695,7 +28695,8 @@
|
|
|
28695
28695
|
_addressSignatureVerification = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(apiUrl) {
|
|
28696
28696
|
var _window;
|
|
28697
28697
|
|
|
28698
|
-
var
|
|
28698
|
+
var walletProvider,
|
|
28699
|
+
cookies,
|
|
28699
28700
|
provider,
|
|
28700
28701
|
signer,
|
|
28701
28702
|
address,
|
|
@@ -28708,30 +28709,31 @@
|
|
|
28708
28709
|
while (1) {
|
|
28709
28710
|
switch (_context.prev = _context.next) {
|
|
28710
28711
|
case 0:
|
|
28711
|
-
|
|
28712
|
+
walletProvider = _args.length > 1 && _args[1] !== undefined ? _args[1] : null;
|
|
28713
|
+
cookies = _args.length > 2 && _args[2] !== undefined ? _args[2] : false;
|
|
28712
28714
|
|
|
28713
|
-
if ((_window = window) !== null && _window !== void 0 && _window.ethereum) {
|
|
28714
|
-
_context.next =
|
|
28715
|
+
if (!(!((_window = window) !== null && _window !== void 0 && _window.ethereum) && !walletProvider)) {
|
|
28716
|
+
_context.next = 4;
|
|
28715
28717
|
break;
|
|
28716
28718
|
}
|
|
28717
28719
|
|
|
28718
28720
|
return _context.abrupt("return", null);
|
|
28719
28721
|
|
|
28720
|
-
case
|
|
28722
|
+
case 4:
|
|
28721
28723
|
// @ts-ignore
|
|
28722
|
-
provider = new Web3Provider(window.ethereum);
|
|
28724
|
+
provider = new Web3Provider(walletProvider || window.ethereum);
|
|
28723
28725
|
signer = provider.getSigner();
|
|
28724
|
-
_context.next =
|
|
28726
|
+
_context.next = 8;
|
|
28725
28727
|
return signer.getAddress();
|
|
28726
28728
|
|
|
28727
|
-
case
|
|
28729
|
+
case 8:
|
|
28728
28730
|
address = _context.sent;
|
|
28729
|
-
_context.next =
|
|
28731
|
+
_context.next = 11;
|
|
28730
28732
|
return signer.signMessage("utu-trust-api");
|
|
28731
28733
|
|
|
28732
|
-
case
|
|
28734
|
+
case 11:
|
|
28733
28735
|
signature = _context.sent;
|
|
28734
|
-
_context.next =
|
|
28736
|
+
_context.next = 14;
|
|
28735
28737
|
return axios.post("".concat(apiUrl).concat(API_VERIFY_ADDRESS), {
|
|
28736
28738
|
address: address,
|
|
28737
28739
|
signature: signature
|
|
@@ -28739,16 +28741,16 @@
|
|
|
28739
28741
|
withCredentials: !!cookies
|
|
28740
28742
|
});
|
|
28741
28743
|
|
|
28742
|
-
case
|
|
28744
|
+
case 14:
|
|
28743
28745
|
_yield$axios$post = _context.sent;
|
|
28744
28746
|
data = _yield$axios$post.data;
|
|
28745
|
-
_context.next =
|
|
28747
|
+
_context.next = 18;
|
|
28746
28748
|
return localStorage.setItem(LOCAL_STORAGE_KEY_UTU_IDENTITY_DATA, JSON.stringify(data));
|
|
28747
28749
|
|
|
28748
|
-
case
|
|
28750
|
+
case 18:
|
|
28749
28751
|
return _context.abrupt("return", data);
|
|
28750
28752
|
|
|
28751
|
-
case
|
|
28753
|
+
case 20:
|
|
28752
28754
|
case "end":
|
|
28753
28755
|
return _context.stop();
|
|
28754
28756
|
}
|