Skip to content

Commit 8241c33

Browse files
committed
fix: refactor chain selection logic in blueprint_batch_mint.ts
- Introduced separate arrays for testnet and production chains for better organization, and because .testnet property is not always defined in viem. - Updated chain selection logic to determine if the selected chain is a testnet based on the new structure.
1 parent bcdb8da commit 8241c33

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

scripts/blueprint_batch_mint.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -71,22 +71,24 @@ async function main() {
7171
default: path.join(__dirname, "blueprint_batch_mint.csv"),
7272
});
7373

74-
const chains = [
74+
const testnetChains = [
7575
sepolia,
7676
arbitrumSepolia,
7777
baseSepolia,
7878
filecoinCalibration,
79-
optimism,
80-
celo,
81-
base,
82-
arbitrum,
8379
];
80+
81+
const prodChains = [optimism, celo, base, arbitrum];
82+
83+
const allChains = [...testnetChains, ...prodChains];
84+
8485
const chainId = await select({
8586
message: "Select chain",
86-
choices: [...chains.map((c) => ({ name: c.name, value: c.id }))],
87+
choices: [...allChains.map((c) => ({ name: c.name, value: c.id }))],
8788
});
8889

89-
const chain = chains.find((c) => c.id === chainId);
90+
const chain = allChains.find((c) => c.id === chainId);
91+
const isTestnet = testnetChains.some((c) => c.id === chainId);
9092

9193
if (!chain) {
9294
console.error("Chain not found");
@@ -120,12 +122,10 @@ async function main() {
120122
},
121123
});
122124

123-
console.log("signature", signature);
124-
125125
// const TESTNET_API_URL = "http://localhost:4000/v1";
126126
const TESTNET_API_URL = "https://staging-api.hypercerts.org/v1";
127127
const PROD_API_URL = "https://api.hypercerts.org/v1";
128-
const ENDPOINT = chain.testnet ? TESTNET_API_URL : PROD_API_URL;
128+
const ENDPOINT = isTestnet ? TESTNET_API_URL : PROD_API_URL;
129129

130130
for (const record of records) {
131131
const {

0 commit comments

Comments
 (0)