Skip to content

Commit

Permalink
Merge pull request #6 from juliancwirko/additional-callback
Browse files Browse the repository at this point in the history
additional callbacks
  • Loading branch information
juliancwirko authored Nov 19, 2022
2 parents 94f6bb2 + 188e5f3 commit 2d0e3e3
Show file tree
Hide file tree
Showing 14 changed files with 424 additions and 383 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### [0.6.2](https://github.com/juliancwirko/elven.js/releases/tag/v0.6.2) (2022-11-19)
- added new callbacks for transactions `onTxSent` and `onTxError`. With `onTxSent`, you can get the transaction data before it is finalized on the chain and after signing it. Then you can use `onTxFinalized`. Check the source code of the demo example.
- dependencies updates

### [0.6.1](https://github.com/juliancwirko/elven.js/releases/tag/v0.6.1) (2022-10-31)
- make the WalletConnect bridge addresses configurable. You can use `ElvenJS.init({ walletConnectBridgeAddresses: ['https://...'], })` to overwrite the default ones.

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

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions build/types/events-store.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export declare class EventsStore {
private static events;
static set(name: string, fn: (arg?: any) => void): void;
static get(name: string): ((arg?: any) => void) | undefined;
static run(name: string, arg?: any): void;
static set(name: string, fn: (...args: any[]) => void): void;
static get(name: string): ((...args: any[]) => void) | undefined;
static run(name: string, ...args: any[]): void;
static clear(): void;
}
2 changes: 1 addition & 1 deletion build/types/network-provider.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export interface IAddress {
export interface SmartContractQueryArgs extends QueryArguments {
address: IAddress;
}
export declare type NetworkProviderOptions = Pick<InitOptions, 'apiUrl' | 'chainType' | 'apiTimeout'>;
export type NetworkProviderOptions = Pick<InitOptions, 'apiUrl' | 'chainType' | 'apiTimeout'>;
export interface AccountOnNetwork {
address: IAddress;
nonce: number;
Expand Down
4 changes: 3 additions & 1 deletion build/types/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,17 @@ export interface InitOptions {
onLoggedIn?: () => void;
onLogout?: () => void;
onTxStarted?: (transaction: Transaction) => void;
onTxSent?: (transaction: Transaction) => void;
onTxFinalized?: (transaction: Transaction) => void;
onTxError?: (transaction: Transaction, error: string) => void;
}
export declare enum LoginMethodsEnum {
ledger = "ledger",
maiarMobile = "maiar-mobile",
webWallet = "web-wallet",
maiarBrowserExtension = "maiar-browser-extension"
}
export declare type DappProvider = ExtensionProvider | WalletConnectProvider | WalletProvider | undefined;
export type DappProvider = ExtensionProvider | WalletConnectProvider | WalletProvider | undefined;
export interface LoginOptions {
qrCodeContainer?: string | HTMLElement;
token?: string;
Expand Down
18 changes: 9 additions & 9 deletions example/elven.js

Large diffs are not rendered by default.

12 changes: 8 additions & 4 deletions example/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,16 @@
href="https://devnet-elrond-esdt-faucet.netlify.app/" target="_blank"
rel="noopener noreferrer">https://devnet-elrond-esdt-faucet.netlify.app</a> (you can also modify the hardcoded
token and test it with yours locally, check the sourcecode of this website for more info).</div>
<div class="esdt-info">** The query will trigger a 'getMintedPerAddressTotal' with currently logged in user's address using
<div class="esdt-info">** The query will trigger a 'getMintedPerAddressTotal' with currently logged in user's
address using
the <a href="https://www.elven.tools">Elven Tools</a> Smart Contract.</div>

<div id="tx-hash-or-query-result" class="tx-hash-or-query-result"></div>
<div id="qr-code-container" class="qr-code-container"></div>

<h1>ElvenJS (demo)</h1>
<div><strong>All transactions will take place on the devent!</strong> Check how to use it on the testnet and mainnet in the docs.</div>
<div><strong>All transactions will take place on the devent!</strong> Check how to use it on the testnet and mainnet
in the docs.</div>
<h4>Docs and code: <a href="https://www.elvenjs.com">www.elvenjs.com</a></h4>
<p>Authenticate, sign and send transactions and messages on the Elrond blockchain in the browser. No need for
bundlers, frameworks, etc. Just attach the script source, and you are ready to go. You can incorporate it into
Expand Down Expand Up @@ -163,10 +165,12 @@ <h3>Other demos:</h3>
apiTimeout: 10000,
walletConnectBridgeAddresses: ['https://bridge.walletconnect.org'],
onLoginPending: () => { uiPending(true) },
onLoggedIn: () => { uiLoggedInState(true); uiPending(false); },
onLoggedIn: () => { uiLoggedInState(true); uiPending(false); },
onLogout: () => { uiLoggedInState(false); },
onTxStarted: () => { uiPending(true); },
onTxFinalized: (tx) => { tx?.hash && updateTxHashContainer(tx.hash); uiPending(false); }
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 2d0e3e3

Please sign in to comment.