@depay/widgets 6.1.0 → 6.2.3
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/README.md +25 -0
- package/dist/esm/index.bundle.js +75 -67
- package/dist/esm/index.js +55 -47
- package/dist/umd/index.bundle.js +75 -67
- package/dist/umd/index.js +55 -47
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1316,6 +1316,31 @@ Which will resolve the `DePayWidgets.Login` request to the resolved account:
|
|
|
1316
1316
|
account // 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045
|
|
1317
1317
|
```
|
|
1318
1318
|
|
|
1319
|
+
You can also pass a `recover` function that takes care of signature recovery:
|
|
1320
|
+
|
|
1321
|
+
```javascript
|
|
1322
|
+
DePayWidgets.Login({ message, recover: ({ message, signature })=>{
|
|
1323
|
+
return new Promise((resolve, reject)=>{
|
|
1324
|
+
fetch('https://example.com/login', {
|
|
1325
|
+
method: 'POST',
|
|
1326
|
+
body: JSON.stringify({ message, signature })
|
|
1327
|
+
})
|
|
1328
|
+
.then((response)=>{
|
|
1329
|
+
if(response.status == 200) {
|
|
1330
|
+
response.text().then((account)=>{
|
|
1331
|
+
resolve(account)
|
|
1332
|
+
}).catch(reject)
|
|
1333
|
+
} else {
|
|
1334
|
+
response.text().then((text)=>{
|
|
1335
|
+
reject(text || 'Recovering login signature failed!')
|
|
1336
|
+
}).catch(reject)
|
|
1337
|
+
}
|
|
1338
|
+
})
|
|
1339
|
+
})
|
|
1340
|
+
}
|
|
1341
|
+
})
|
|
1342
|
+
```
|
|
1343
|
+
|
|
1319
1344
|
### Rejections
|
|
1320
1345
|
|
|
1321
1346
|
1. Rejects if user just closes the dialog without connecting any wallet:
|