Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update bulk-mint.ts #33

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions src/bulk-mint.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AlchemyProvider } from '@ethersproject/providers';

Check warning on line 1 in src/bulk-mint.ts

View workflow job for this annotation

GitHub Actions / Lint

Run autofix to sort these imports!
import { Wallet } from '@ethersproject/wallet';
import { ImLogger, WinstonLogger } from '@imtbl/imlogging';
import { ImmutableXClient, ImmutableMethodParams } from '@imtbl/imx-sdk';
Expand Down Expand Up @@ -57,17 +57,22 @@
signer: new Wallet(env.privateKey1).connect(provider),
});

log.info(component, 'MINTER REGISTRATION');
const registerImxResult = await minter.registerImx({
etherKey: minter.address.toLowerCase(),
starkPublicKey: minter.starkPublicKey,
const accounts = await minter.getUser({
user: minter.address,
});
if (accounts.accounts.length === 0) {
log.info(component, 'MINTER REGISTRATION');
const registerImxResult = await minter.registerImx({
etherKey: minter.address.toLowerCase(),
starkPublicKey: minter.starkPublicKey,
});

if (registerImxResult.tx_hash === '') {
log.info(component, 'Minter registered, continuing...');
} else {
log.info(component, 'Waiting for minter registration...');
await waitForTransaction(Promise.resolve(registerImxResult.tx_hash));
if (registerImxResult.tx_hash === '') {
log.info(component, 'Minter registered, continuing...');
} else {
log.info(component, 'Waiting for minter registration...');
await waitForTransaction(Promise.resolve(registerImxResult.tx_hash));
}
}

log.info(component, `OFF-CHAIN MINT ${number} NFTS`);
Expand Down
Loading