Skip to content

Commit

Permalink
allow triggering transactions before the previous ones are finished
Browse files Browse the repository at this point in the history
  • Loading branch information
juliancwirko committed Jul 16, 2023
1 parent b2f9783 commit de229d2
Show file tree
Hide file tree
Showing 17 changed files with 2,508 additions and 2,972 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
### [0.11.0](https://github.com/elven-js/elven.js/releases/tag/v0.11.0) (2023-07-16)
- allow triggering transactions before the previous ones are finished
- updated dependencies
- adjust the code for newest versions of Multiversx tools
- run login pending state when native auth is fetching

### [0.10.2](https://github.com/elven-js/elven.js/releases/tag/v0.10.2) (2023-05-29)
- fix native auth when signing using browser extension

Expand Down
42 changes: 24 additions & 18 deletions build/elven.js

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion build/types/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ export interface LoginOptions {
callbackRoute?: string;
}
export declare enum DappCoreWCV2CustomMethodsEnum {
mvx_cancelAction = "mvx_cancelAction"
mvx_cancelAction = "mvx_cancelAction",
mvx_signNativeAuthToken = "mvx_signNativeAuthToken"
}
export declare enum EventStoreEvents {
onLoginPending = "onLoginPending",
Expand Down
21 changes: 12 additions & 9 deletions example/demo-styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,6 @@ a {

.overlay {
display: none;
position: fixed;
inset: 0;
background-color: rgba(0, 0, 0, .6);
justify-content: center;
align-items: center;
}
Expand All @@ -91,24 +88,30 @@ a {
display: flex;
}

.transaction-link {
display: inline-block;
margin-top: 8px;
margin-bottom: 8px;
}

/* SPINNER */
/* https://projects.lukehaas.me/css-loaders/ */

.loader,
.loader:after {
border-radius: 50%;
width: 10em;
height: 10em;
width: 3em;
height: 3em;
}

.loader {
font-size: 10px;
position: relative;
text-indent: -9999em;
border-top: 1.1em solid rgba(255, 255, 255, 0.2);
border-right: 1.1em solid rgba(255, 255, 255, 0.2);
border-bottom: 1.1em solid rgba(255, 255, 255, 0.2);
border-left: 1.1em solid #ffffff;
border-top: 0.5em solid rgba(0, 0, 0, 0.2);
border-right: 0.5em solid rgba(0, 0, 0, 0.2);
border-bottom: 0.5em solid rgba(0, 0, 0, 0.2);
border-left: 0.5em solid #000;
-webkit-transform: translateZ(0);
-ms-transform: translateZ(0);
transform: translateZ(0);
Expand Down
5 changes: 1 addition & 4 deletions example/demo-ui-tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,14 @@ export const uiLoggedInState = (loggedIn) => {
};

export const updateTxHashContainer = (txHash) => {
const txHashContainer = document.getElementById('tx-hash-or-query-result');
if (txHash) {
txHashContainer?.replaceChildren();
const txHashContainer = document.getElementById('tx-hash-or-query-result');
const url = `https://devnet-explorer.multiversx.com/transactions/${txHash}`;
const link = document.createElement('a');
link.setAttribute('href', url);
link.classList.add('transaction-link');
link.innerText = `➡️ ${url}`;
txHashContainer?.appendChild(link);
} else {
txHashContainer?.replaceChildren();
}
};

Expand Down
42 changes: 24 additions & 18 deletions example/elven.js

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions example/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@
</head>

<body>
<div class="overlay">
<div class="loader">Loading...</div>
</div>
<div class="container">
<div class="header" id="header">
<button class="button" id="button-tx" style="display: none;">EGLD transaction</button>
Expand All @@ -40,7 +37,11 @@
with xPortal</button>
<button class="button" id="button-login-web" style="display: block;">Login
with Web Wallet</button>

<button class="button" id="button-logout" style="display: none;">Logout</button>
<div class="overlay">
<div class="loader">Loading...</div>
</div>
<a class="button right" href="https://github.com/elven-js/elven.js" target="_blank"
rel="noopener noreferrer">GitHub</a>
</div>
Expand Down Expand Up @@ -175,7 +176,7 @@ <h3>Other demos:</h3>
onLoginPending: () => { uiPending(true) },
onLoggedIn: () => { uiLoggedInState(true); uiPending(false); },
onLogout: () => { uiLoggedInState(false); },
onTxStarted: () => { uiPending(true); },
onTxStarted: (tx) => { uiPending(true); },
onTxSent: (tx) => { console.log('Tx sent, not finalized on chain yet! ', tx.getHash().toString()) },
onTxFinalized: (tx) => { tx?.hash && updateTxHashContainer(tx.hash); uiPending(false); },
onTxError: (tx, error) => { console.log('Tx error: ', error); uiPending(false); },
Expand Down
Loading

0 comments on commit de229d2

Please sign in to comment.