Skip to content

Commit

Permalink
minor improvements in demo and main code
Browse files Browse the repository at this point in the history
  • Loading branch information
juliancwirko committed Mar 2, 2023
1 parent 1a23bea commit 5daccf8
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 10 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
### [0.8.1](https://github.com/juliancwirko/elven.js/releases/tag/v0.8.1) (2023-03-02)
- minor improvements in the code and demo

### [0.8.0](https://github.com/juliancwirko/elven.js/releases/tag/v0.8.0) (2023-03-01)
- WalletConnect 2 integration through a new version of `@elrondnetwork/erdjs-wallet-connect-provider` - lets you use 'xPortal Login'.
- two new callbacks: `onQrPending` and `onQrLoaded` - usefull when waiting for the QR and WalletConnect Pairings list, but it shouldn't take much time to load
Expand Down
2 changes: 1 addition & 1 deletion build/elven.js

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions example/demo-styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -207,3 +207,7 @@ a {
.elven-wc-pairing-item-description {
text-align: left;
}

.elven-wc-pairing-item-confirm-msessage {
margin-bottom: 10px;
}
2 changes: 1 addition & 1 deletion example/elven.js

Large diffs are not rendered by default.

13 changes: 11 additions & 2 deletions example/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,10 @@ <h3>Other demos:</h3>
document.getElementById('button-login-extension').addEventListener('click', async () => {
try {
clearQrCodeContainer();
await ElvenJS.login('browser-extension');
await ElvenJS.login('browser-extension', {
// The token is optional, but without it you won't get the signature back, if you don't need it you can omit passing it
token: 'your_token_here'
});
} catch (e) {
console.log('Login: Something went wrong, try again!', e?.message);
}
Expand All @@ -204,6 +207,8 @@ <h3>Other demos:</h3>
// You can also use the DOM element here:
// qrCodeContainer: document.querySelector('#qr-code-container')
qrCodeContainer: 'qr-code-container',
// The token is optional, but without it you won't get the signature back, if you don't need it you can omit passing it
token: 'your_token_here'
});
} catch (e) {
console.log('Login: Something went wrong, try again!', e?.message);
Expand All @@ -213,7 +218,11 @@ <h3>Other demos:</h3>
document.getElementById('button-login-web').addEventListener('click', async () => {
try {
clearQrCodeContainer();
await ElvenJS.login('web-wallet', { callbackRoute: '/' });
await ElvenJS.login('web-wallet', {
callbackRoute: '/',
// The token is optional, but without it you won't get the signature back, if you don't need it you can omit passing it
token: 'your_token_here'
});
} catch (e) {
console.log('Login: Something went wrong, try again!', e?.message);
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "elven.js",
"version": "0.8.0",
"version": "0.8.1",
"description": "Authenticate, sign and send transactions on the MultiversX blockchain in the browser.",
"browser": {
".": "./build/elven.js"
Expand Down
15 changes: 11 additions & 4 deletions src/auth/qr-code-and-pairings-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const buildDeepLink = (walletConnectUri: string) => {
aElem.setAttribute('href', hrefVal);
aElem.setAttribute('rel', 'noopener noreferrer nofollow');
aElem.setAttribute('target', '_blank');
aElem.textContent = 'Maiar login';
aElem.textContent = 'xPortal login';
aElem.classList.add('elven-qr-code-deep-link');

return aElem;
Expand Down Expand Up @@ -55,9 +55,16 @@ const buildPairingsRemoveButton = (

pairingRemoveControllers[pairing.topic] = new AbortController();

btn.addEventListener('click', () => removeExistingPairing(pairing.topic), {
signal: pairingRemoveControllers[pairing.topic].signal,
});
btn.addEventListener(
'click',
(e) => {
e.stopImmediatePropagation();
removeExistingPairing(pairing.topic);
},
{
signal: pairingRemoveControllers[pairing.topic].signal,
}
);

return btn;
};
Expand Down
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ export class ElvenJS {
const isLoggedOut = await logout(this);
this.dappProvider = undefined;
return isLoggedOut;
} catch(e) {
} catch (e) {
const err = errorParse(e);
console.warn('Something went wrong when logging out: ', err);
}
Expand Down

0 comments on commit 5daccf8

Please sign in to comment.