From 495b818b1106b79e2e4cfa75ede3a0f743ef77ec Mon Sep 17 00:00:00 2001 From: coreyneal-immutable <108304844+coreyneal-immutable@users.noreply.github.com> Date: Tue, 19 Sep 2023 17:07:39 -0500 Subject: [PATCH 1/2] Update bulk-mint.ts fix for account_ether_key_already_registered error --- src/bulk-mint.ts | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/bulk-mint.ts b/src/bulk-mint.ts index a97dcb8..52a1c2b 100644 --- a/src/bulk-mint.ts +++ b/src/bulk-mint.ts @@ -57,17 +57,22 @@ const waitForTransaction = async (promise: Promise) => { 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`); From a40a145cbb3e62ca2dee793e686ead73a8ee0bad Mon Sep 17 00:00:00 2001 From: coreyneal-immutable <108304844+coreyneal-immutable@users.noreply.github.com> Date: Tue, 19 Sep 2023 17:22:29 -0500 Subject: [PATCH 2/2] Update bulk-mint.ts linting fix --- src/bulk-mint.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bulk-mint.ts b/src/bulk-mint.ts index 52a1c2b..2a20946 100644 --- a/src/bulk-mint.ts +++ b/src/bulk-mint.ts @@ -58,9 +58,9 @@ const waitForTransaction = async (promise: Promise) => { }); const accounts = await minter.getUser({ - user: minter.address + user: minter.address, }); - if(accounts.accounts.length === 0) { + if (accounts.accounts.length === 0) { log.info(component, 'MINTER REGISTRATION'); const registerImxResult = await minter.registerImx({ etherKey: minter.address.toLowerCase(),