Fix up args to pass isSandbox
This commit is contained in:
committed by
Jędrzej Stuczyński
parent
6cd59124a2
commit
854128ee21
@@ -17,11 +17,11 @@
|
||||
<body>
|
||||
<div>
|
||||
<h1>Credential</h1>
|
||||
<input placeholder="mnemonic"></input>
|
||||
<input placeholder="amount"></input>
|
||||
<input id="mnemonic" placeholder="mnemonic"></input>
|
||||
<input id="coin" placeholder="amount" value="1unym"></input>
|
||||
<button id="button">Get Credential</button>
|
||||
<div id="credential"></div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
</html>
|
||||
|
||||
@@ -5,11 +5,14 @@ async function main() {
|
||||
const mnemonic = document.getElementById('mnemonic') as HTMLInputElement;
|
||||
const coin = document.getElementById('coin') as HTMLInputElement;
|
||||
const button = document.getElementById('button') as HTMLButtonElement;
|
||||
|
||||
const client = await createNymCredentialsClient({ isSandbox: true }); // options: {isSandbox?: boolean; networkDetails?: {}}
|
||||
|
||||
const client = await createNymCredentialsClient();
|
||||
|
||||
const generateCredential = async () => {
|
||||
const credential = await client.comlink.acquireCredential(coin.value, mnemonic.value, {});
|
||||
const amount = coin.value;
|
||||
const mnemonicString = mnemonic.value;
|
||||
console.log({ amount, mnemonicString });
|
||||
const credential = await client.comlink.acquireCredential(amount, mnemonicString, { isSandbox: true }); // options: {isSandbox?: boolean; networkDetails?: {}}
|
||||
appendOutput(JSON.stringify(credential, null, 2));
|
||||
};
|
||||
|
||||
@@ -23,4 +26,3 @@ window.addEventListener('DOMContentLoaded', () => {
|
||||
// let's do this!
|
||||
main();
|
||||
});
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import * as Comlink from 'comlink';
|
||||
import InlineWasmWebWorker from 'web-worker:./worker';
|
||||
import { EventKinds, CredentialClientOpts, INymCredentialClientWebWorker, NymCredentialsClient } from './types';
|
||||
import { EventKinds, INymCredentialClientWebWorker, NymCredentialsClient } from './types';
|
||||
|
||||
export const createNymCredentialsClient = async (options?: CredentialClientOpts): Promise<NymCredentialsClient> => {
|
||||
export const createNymCredentialsClient = async (): Promise<NymCredentialsClient> => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
||||
const worker = await createWorker();
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ async function main() {
|
||||
const webWorker: INymCredentialClientWebWorker = {
|
||||
async acquireCredential(coin: string, mnemonic: string, opts: CredentialClientOpts) {
|
||||
console.log('[Worker] --- acquireCredential ---', { coin, mnemonic, opts });
|
||||
return acquireCredential(coin, mnemonic, opts);
|
||||
return acquireCredential(mnemonic, coin, opts);
|
||||
},
|
||||
};
|
||||
|
||||
@@ -47,4 +47,4 @@ async function main() {
|
||||
postMessageWithType<LoadedEvent>({ kind: EventKinds.Loaded, args: { loaded: true } });
|
||||
}
|
||||
|
||||
main().catch((e: any) => console.error('Unhandled exception in credential worker', e));;
|
||||
main().catch((e: any) => console.error('Unhandled exception in credential worker', e));
|
||||
|
||||
Reference in New Issue
Block a user