{"version":3,"sources":["../src/update.ts","../src/cache/actions.ts","../src/upload/arweave.ts","../src/constants.ts","../src/upload/helpers.ts","../src/upload/transactions.ts","../src/upload/config.ts","../src/enums.ts","../src/mint/helpers.ts","../src/upload/upload.ts","../src/mint/mint.ts"],"sourcesContent":["/* eslint-disable no-console */\n/* eslint-disable @typescript-eslint/no-unsafe-argument */\n/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\nimport { Program } from '@project-serum/anchor'\nimport { PublicKey } from '@solana/web3.js'\nimport { ICache, saveCache } from './cache'\n\n/**\n *\n * Update a given candy machine with the new settings passed and cache.\n * At the end of the update, the updated cache can be downloaded.\n * @newSettings The new settings to update the candy machine with.\n * @candyMachinePubkey The public key of the candy machine to update.\n * @publicKey The public key of the authority of the candy machine\n * @treasuryWallet The public key of the treasury wallet\n * @anchorProgram The program that is used to update the candy machine.\n * @cache The cache to update the candy machine with.\n * @newAuthority (Optional) The new authority of the candy machine.\n */\n\nexport async function updateV2({\n    newSettings,\n    candyMachinePubkey,\n    publicKey,\n    treasuryWallet,\n    anchorProgram,\n    cache,\n    newAuthority,\n}: {\n    newSettings: any\n    candyMachinePubkey: string | string[]\n    publicKey: PublicKey\n    treasuryWallet: PublicKey\n    anchorProgram: Program\n    cache: string\n    newAuthority: string\n}) {\n    try {\n        const cacheContent: ICache = JSON.parse(cache)\n        const env = cacheContent.env\n        const cacheName = cacheContent.cacheName\n\n        const tx = await anchorProgram.methods\n            .updateCandyMachine(newSettings)\n            .accounts({\n                candyMachine: new PublicKey(candyMachinePubkey),\n                authority: publicKey,\n                wallet: treasuryWallet,\n            })\n            .signers([])\n            .rpc()\n\n        cacheContent.startDate = newSettings.goLiveDate\n\n        console.log('update_candy_machine finished', tx)\n\n        if (newAuthority) {\n            const tx = await anchorProgram.methods\n                .updateAuthority(new PublicKey(newAuthority))\n                .accounts({\n                    candyMachine: new PublicKey(candyMachinePubkey),\n                    authority: publicKey,\n                    wallet: treasuryWallet,\n                })\n                .rpc()\n\n            cacheContent.authority = new PublicKey(newAuthority).toBase58()\n            console.log(` - updated authority: ${cacheContent.authority}`)\n            console.log('update_authority finished', tx)\n        }\n\n        saveCache(cacheName, env, cacheContent)\n    } catch (err) {\n        console.error(err)\n        throw new Error()\n    }\n}\n","/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\nimport fileDownloader from 'js-file-download'\nimport { ICache } from './interfaces'\n\n// export function cachePath(\n//   env: string,\n//   cacheName: string,\n//   cPath: string = CACHE_PATH,\n//   legacy: boolean = false,\n// ) {\n//   const filename = `${env}-${cacheName}`;\n//   return path.join(cPath, legacy ? filename : `${filename}.json`);\n// }\n\n// export function loadCache(\n//   cacheName: string,\n//   env: string,\n//   cPath: string = CACHE_PATH,\n//   legacy: boolean = false,\n// ) {\n//   const path = cachePath(env, cacheName, cPath, legacy);\n\n//   if (!fs.existsSync(path)) {\n//     if (!legacy) {\n//       return loadCache(cacheName, env, cPath, true);\n//     }\n//     return undefined;\n//   }\n\n//   return JSON.parse(fs.readFileSync(path).toString());\n// }\n\n/**\n * Save the cache to the cache path.\n * @param cacheName The name of the cache to save.\n * @param env The environment used 'mainnet-beta' | 'devnet' | 'testnet'\n * @param cacheContent The content of the cache to save.\n */\n\nexport function saveCache(cacheName: string, env: string, cacheContent: ICache) {\n    cacheContent.env = env\n    cacheContent.cacheName = cacheName\n    fileDownloader(JSON.stringify(cacheContent), cacheName)\n}\n","/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable no-console */\nimport { calculate } from '@metaplex/arweave-cost'\nimport * as anchor from '@project-serum/anchor'\nimport { ARWEAVE_PAYMENT_WALLET, ARWEAVE_UPLOAD_ENDPOINT, JSON_EXTENSION } from '../constants'\nimport { Manifest } from '../types'\nimport { getFileExtension } from './helpers'\nimport { sendTransactionWithRetryWithKeypair } from './transactions'\n\n/**\n * @param fileSizes - array of file sizes\n * @returns {Promise<number>} - estimated cost to store files in lamports\n */\nasync function fetchAssetCostToStore(fileSizes: number[]): Promise<number> {\n    const result = await calculate(fileSizes)\n    console.log('Arweave cost estimates:', result)\n\n    return result.solana * anchor.web3.LAMPORTS_PER_SOL\n}\n\n/**\n * After doing a tx to the metaplex arweave wallet to store the NFTs and their metadata, this function calls a serverless function from metaplex\n * in which the files to upload are attached to the http form.\n * @param data - FormData object\n * @param manifest json manifest containing metadata\n * @param index index of the NFTs to upload\n * @returns http response\n */\nasync function upload(data: FormData, manifest: Manifest, index: number) {\n    console.log(`trying to upload image ${index}: ${manifest.name}`)\n    const res = await (\n        await fetch(ARWEAVE_UPLOAD_ENDPOINT, {\n            method: 'POST',\n            body: data,\n        })\n    ).json()\n    return res\n}\n\nfunction estimateManifestSize(filenames: string[]) {\n    const paths: { [key: string]: any } = {}\n    for (const name of filenames) {\n        console.log('name', name)\n        paths[name] = {\n            id: 'artestaC_testsEaEmAGFtestEGtestmMGmgMGAV438',\n            ext: getFileExtension(name),\n        }\n    }\n\n    const manifest = {\n        manifest: 'arweave/paths',\n        version: '0.1.0',\n        paths,\n        index: {\n            path: 'metadata.json',\n        },\n    }\n\n    const data = Buffer.from(JSON.stringify(manifest), 'utf8')\n    console.log('Estimated manifest size:', data.length)\n    return data.length\n}\n/**\n * Upload the NFTs and their metadata to the Arweave network.\n * @param walletKeyPair - keypair of the wallet to use for the mint transaction\n * @param anchorProgram  - anchor program to use for the mint transaction\n * @param env  - environment to use for the mint transaction (mainnet-beta, devnet, testnet)\n * @param image  - image to upload\n * @param manifestBuffer  - buffer of the manifest to upload\n * @param manifest  - manifest to upload\n * @param index  - index of the image to upload\n * @returns  - The links for the manifest and the image in Arweave.\n */\nexport async function arweaveUpload(\n    walletKeyPair: any,\n    anchorProgram: anchor.Program,\n    env: string,\n    image: File,\n    manifestBuffer: Buffer,\n    manifest: Manifest,\n    index: number\n) {\n    const imageExt = image.type\n    const estimatedManifestSize = estimateManifestSize([image.name, 'metadata.json'])\n\n    const storageCost = await fetchAssetCostToStore([image.size, manifestBuffer.length, estimatedManifestSize])\n\n    console.log(`lamport cost to store ${image.name}: ${storageCost}`)\n\n    const instructions = [\n        anchor.web3.SystemProgram.transfer({\n            fromPubkey: walletKeyPair.publicKey,\n            toPubkey: ARWEAVE_PAYMENT_WALLET,\n            lamports: Math.round(storageCost),\n        }),\n    ]\n\n    const tx = await sendTransactionWithRetryWithKeypair(\n        anchorProgram.provider.connection,\n        walletKeyPair,\n        instructions,\n        'confirmed'\n    )\n    console.log(`solana transaction (${env}) for arweave payment:`, tx)\n\n    const data = new FormData()\n    const manifestBlob = new Blob([manifestBuffer], { type: JSON_EXTENSION })\n\n    data.append('transaction', tx['txid'])\n    data.append('env', env)\n    data.append('file[]', image, image.name)\n    data.append('file[]', manifestBlob, 'metadata.json')\n\n    const result = await upload(data, manifest, index)\n\n    console.log('result', result)\n\n    const metadataFile = result.messages?.find((m: any) => m.filename === 'manifest.json')\n    const imageFile = result.messages?.find((m: any) => m.filename === image.name)\n\n    if (metadataFile?.transactionId) {\n        const link = `https://arweave.net/${metadataFile.transactionId}`\n        const imageLink = `https://arweave.net/${imageFile.transactionId}?ext=${imageExt.replace('.', '')}`\n        console.log(`File uploaded: ${link}`)\n        console.log(`imageLink uploaded: ${imageLink}`)\n\n        return [link, imageLink]\n    } else {\n        // @todo improve\n        throw new Error(`No transaction ID for upload: ${index}`)\n    }\n}\n","export const SUPPORTED_IMAGE_TYPES = ['image/png', 'image/gif', 'image/jpeg']\nexport const SUPPORTED_ANIMATION_TYPES = [\n    'video/mp4',\n    'video/quicktime',\n    'audio/mpeg',\n    'audio/x-flac',\n    'audio/wav',\n    'model/gltf-binary',\n    'text/html',\n]\n\nexport const DEFAULT_GATEKEEPER = {\n    gatekeeperNetwork: 'ignREusXmGrscGNUesoU9mxfds9AiYTezUKex2PsZV6',\n    expireOnUse: true,\n}\n\nexport const JSON_EXTENSION = 'application/json'\nexport const DEFAULT_TIMEOUT = 30000\nexport const NOTIFICATION_TIMEOUT_NEVER = -1\nexport const NOTIFICATION_TIMEOUT_DEFAULT = 5000\nimport { PublicKey } from '@solana/web3.js'\nexport const CANDY_MACHINE = 'candy_machine'\nexport const AUCTION_HOUSE = 'auction_house'\nexport const TOKEN_ENTANGLER = 'token_entangler'\nexport const ESCROW = 'escrow'\nexport const A = 'A'\nexport const B = 'B'\nexport const FEE_PAYER = 'fee_payer'\nexport const TREASURY = 'treasury'\nexport const MAX_NAME_LENGTH = 32\nexport const MAX_URI_LENGTH = 200\nexport const MAX_SYMBOL_LENGTH = 10\nexport const MAX_CREATOR_LEN = 32 + 1 + 1\nexport const MAX_CREATOR_LIMIT = 5\nexport const ARWEAVE_PAYMENT_WALLET = new PublicKey('6FKvsq4ydWFci6nGq9ckbjYMtnmaqAoatz5c9XWjiDuS')\nexport const CANDY_MACHINE_PROGRAM_ID = new PublicKey('cndyAnrLdpjq1Ssp1z8xxDsB8dxe7u4HL5Nxi2K5WXZ')\n\nexport const CANDY_MACHINE_PROGRAM_V2_ID = new PublicKey('cndy3Z4yapfJBmL3ShUp5exZKqR3z33thTzeNMm2gRZ')\nexport const TOKEN_METADATA_PROGRAM_ID = new PublicKey('metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s')\nexport const SPL_ASSOCIATED_TOKEN_ACCOUNT_PROGRAM_ID = new PublicKey('ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL')\nexport const TOKEN_PROGRAM_ID = new PublicKey('TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA')\nexport const FAIR_LAUNCH_PROGRAM_ID = new PublicKey('faircnAB9k59Y4TXmLabBULeuTLgV7TkGMGNkjnA15j')\nexport const AUCTION_HOUSE_PROGRAM_ID = new PublicKey('hausS13jsjafwWwGqZTUQRmWyvyxn9EQpqMwV1PBBmk')\nexport const TOKEN_ENTANGLEMENT_PROGRAM_ID = new PublicKey('qntmGodpGkrM42mN68VCZHXnKqDCT8rdY23wFcXCLPd')\nexport const WRAPPED_SOL_MINT = new PublicKey('So11111111111111111111111111111111111111112')\n\nexport const ARWEAVE_UPLOAD_ENDPOINT = 'https://us-central1-metaplex-studios.cloudfunctions.net/uploadFile'\n\nexport const CONFIG_ARRAY_START =\n    32 + // authority\n    4 +\n    6 + // uuid + u32 len\n    4 +\n    10 + // u32 len + symbol\n    2 + // seller fee basis points\n    1 +\n    4 +\n    5 * 34 + // optional + u32 len + actual vec\n    8 + // max supply\n    1 + // is mutable\n    1 + // retain authority\n    4 // max number of lines;\n\nexport const CONFIG_ARRAY_START_V2 =\n    8 + // key\n    32 + // authority\n    32 + // wallet\n    33 + // token mint\n    4 +\n    6 + // uuid\n    8 + // price\n    8 + // items available\n    9 + // go live\n    10 + // end settings\n    4 +\n    MAX_SYMBOL_LENGTH + // u32 len + symbol\n    2 + // seller fee basis points\n    4 +\n    MAX_CREATOR_LIMIT * MAX_CREATOR_LEN + // optional + u32 len + actual vec\n    8 + // max supply\n    1 + // is mutable\n    1 + // retain authority\n    1 + // option for hidden setting\n    4 +\n    MAX_NAME_LENGTH + // name length,\n    4 +\n    MAX_URI_LENGTH + // uri length,\n    32 + // hash\n    4 + // max number of lines;\n    8 + // items redeemed\n    1 + // whitelist option\n    1 + // whitelist mint mode\n    1 + // allow presale\n    9 + // discount price\n    32 + // mint key for whitelist\n    1 +\n    32 +\n    1 // gatekeeper\n\nexport const CONFIG_LINE_SIZE_V2 = 4 + 32 + 4 + 200\nexport const CONFIG_LINE_SIZE = 4 + 32 + 4 + 200\nexport const CACHE_PATH = './.cache'\n","/* eslint-disable no-console */\n/* eslint-disable @typescript-eslint/no-unsafe-argument */\n/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\nimport * as anchor from '@project-serum/anchor'\nimport { Keypair, PublicKey, SystemProgram } from '@solana/web3.js'\nimport { CANDY_MACHINE_PROGRAM_V2_ID, CONFIG_ARRAY_START_V2, CONFIG_LINE_SIZE_V2 } from '../constants'\nimport { ICandyMachineData } from '../interfaces'\n/**\n * Parse a date.\n * @param date The date to parse.\n * @returns  The parsed date.\n */\nexport function parseDate(date: string) {\n    if (date === 'now') {\n        return Date.now() / 1000\n    }\n    return Date.parse(date) / 1000\n}\nexport function sleep(milliseconds: number): Promise<void> {\n    return new Promise((resolve) => setTimeout(resolve, milliseconds))\n}\n\nexport function uuidFromConfigPubkey(configAccount: PublicKey) {\n    return configAccount.toBase58().slice(0, 6)\n}\n/**\n * Create a candy machine v2.\n * @param anchorProgram The anchor program to use.\n * @param payerWallet  The payer wallet to use.\n * @param treasuryWallet  The treasury wallet to use.\n * @param candyData  The candy machine data to use.\n * @returns  The config account.\n */\nexport const createCandyMachineV2 = async function (\n    anchorProgram: anchor.Program,\n    payerWallet: any,\n    treasuryWallet: PublicKey,\n    // splToken: PublicKey,\n    candyData: ICandyMachineData\n) {\n    const candyAccount = Keypair.generate()\n    candyData.uuid = uuidFromConfigPubkey(candyAccount.publicKey)\n\n    if (!candyData.symbol) {\n        throw new Error('Invalid config, there must be a symbol.')\n    }\n\n    if (!candyData.creators || candyData.creators.length === 0) {\n        throw new Error('Invalid config, there must be at least one creator.')\n    }\n\n    const totalShare = (candyData.creators || []).reduce((acc, curr) => acc + curr.share, 0)\n\n    if (totalShare !== 100) {\n        throw new Error('Invalid config, creators shares must add up to 100')\n    }\n\n    const remainingAccounts: any[] = []\n    // if (splToken) {\n    //   remainingAccounts.push({\n    //     pubkey: splToken,\n    //     isSigner: false,\n    //     isWritable: false,\n    //   });\n    // }\n    const cmCreation = {\n        candyMachine: candyAccount.publicKey,\n        uuid: candyData.uuid,\n        txId: await anchorProgram.methods\n            .initializeCandyMachine(candyData)\n            .accounts({\n                candyMachine: candyAccount.publicKey,\n                wallet: treasuryWallet,\n                authority: payerWallet.publicKey,\n                payer: payerWallet.publicKey,\n                systemProgram: SystemProgram.programId,\n                rent: anchor.web3.SYSVAR_RENT_PUBKEY,\n            })\n            // MAYBE NEED TO ADD PAYER WALLET\n            .signers([candyAccount])\n            .remainingAccounts(remainingAccounts)\n            .preInstructions([\n                await createCandyMachineV2Account(anchorProgram, candyData, payerWallet.publicKey, candyAccount.publicKey),\n            ])\n            .rpc(),\n    }\n    console.log('cmCreation', cmCreation)\n    return cmCreation\n}\n\n/**\n * Create a candy machine v2 account.\n * @param anchorProgram The anchor program to use.\n * @param candyData    The candy machine data to use.\n * @param payerWallet  The payer wallet to use.\n * @param candyAccount  The candy machine account to use.\n * @returns  The instruction to create the candy machine account.\n */\nexport async function createCandyMachineV2Account(\n    anchorProgram: anchor.Program,\n    candyData: ICandyMachineData,\n    payerWallet: PublicKey,\n    candyAccount: PublicKey\n) {\n    console.log('creating v2 account')\n    const size =\n        CONFIG_ARRAY_START_V2 +\n        4 +\n        candyData.itemsAvailable.toNumber() * CONFIG_LINE_SIZE_V2 +\n        8 +\n        2 * (Math.floor(candyData.itemsAvailable.toNumber() / 8) + 1)\n\n    const candyMachineAccount = anchor.web3.SystemProgram.createAccount({\n        fromPubkey: payerWallet,\n        newAccountPubkey: candyAccount,\n        space: size,\n        lamports: await anchorProgram.provider.connection.getMinimumBalanceForRentExemption(size),\n        programId: CANDY_MACHINE_PROGRAM_V2_ID,\n    })\n    console.log('account created', candyMachineAccount)\n    return candyMachineAccount\n}\n\nexport const getUnixTs = () => new Date().getTime() / 1000\n\nexport const getFileName = (fileName: string) => fileName.split('.')[0]\n\nexport const getFileExtension = (fileName: string) => fileName.split('.')[1]\n","/* eslint-disable @typescript-eslint/ban-ts-comment */\n/* eslint-disable @typescript-eslint/no-floating-promises */\n/* eslint-disable @typescript-eslint/no-unsafe-argument */\n/* eslint-disable no-console */\n/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\nimport {\n    Blockhash,\n    Commitment,\n    Connection,\n    RpcResponseAndContext,\n    SignatureStatus,\n    SimulatedTransactionResponse,\n    Transaction,\n    TransactionInstruction,\n    TransactionSignature,\n    Keypair,\n} from '@solana/web3.js'\nimport { DEFAULT_TIMEOUT } from '../constants'\nimport { getUnixTs, sleep } from './helpers'\n\ninterface IBlockhashAndFeeCalculator {\n    blockhash: Blockhash\n    lastValidBlockHeight: number\n}\n/**\n * Attempt to send a transaction to the network.\n * @param connection  The connection to the cluster.\n * @param wallet  The wallet to use for signing.\n * @param instructions  The instructions to sign.\n * @param commitment  The commitment to use for the transaction.\n * @param block  The blockhash to use for the transaction.\n * @param beforeSend  The function to call before sending the transaction.\n * @returns  The transaction signature.\n */\nexport const sendTransactionWithRetryWithKeypair = async (\n    connection: Connection,\n    wallet: any,\n    instructions: TransactionInstruction[],\n    commitment: Commitment = 'singleGossip',\n    block?: IBlockhashAndFeeCalculator,\n    beforeSend?: () => void\n) => {\n    const transaction = new Transaction()\n    instructions.forEach((instruction) => transaction.add(instruction))\n    transaction.recentBlockhash = (block || (await connection.getLatestBlockhash(commitment))).blockhash\n    transaction.feePayer = wallet.publicKey\n    await wallet.signTransaction(transaction)\n\n    if (beforeSend) {\n        beforeSend()\n    }\n\n    const { txid, slot } = await sendSignedTransaction({\n        connection,\n        signedTransaction: transaction,\n    })\n\n    return { txid, slot }\n}\n/**\n * Attempt to send a signed transaction to the network.\n * @param signedTransaction The signed transaction to send.\n * @param connection The connection to the cluster.\n * @returns  The transaction id and slot.\n */\nexport async function sendSignedTransaction({\n    signedTransaction,\n    connection,\n    timeout = DEFAULT_TIMEOUT,\n}: {\n    signedTransaction: Transaction\n    connection: Connection\n    sendingMessage?: string\n    sentMessage?: string\n    successMessage?: string\n    timeout?: number\n}): Promise<{ txid: string; slot: number }> {\n    const rawTransaction = signedTransaction.serialize()\n    const startTime = getUnixTs()\n    let slot = 0\n\n    let txid: TransactionSignature = await connection.sendRawTransaction(rawTransaction, {\n        skipPreflight: true,\n    })\n\n    console.log('Started awaiting confirmation for', txid)\n\n    let done = false\n    ;(async () => {\n        while (!done && getUnixTs() - startTime < timeout) {\n            connection.sendRawTransaction(rawTransaction, {\n                skipPreflight: true,\n            })\n            await sleep(500)\n        }\n    })()\n\n    try {\n        const confirmation = await awaitTransactionSignatureConfirmation(txid, timeout, connection, 'confirmed', true)\n        if (!confirmation) throw new Error('Timed out awaiting confirmation on transaction')\n\n        if (confirmation.err) {\n            console.error(confirmation.err)\n            throw new Error('Transaction failed: Custom instruction error')\n        }\n        slot = confirmation?.slot || 0\n    } catch (err) {\n        console.error('Timeout Error caught', err)\n        // @ts-ignore\n        if (err.timeout) {\n            throw new Error('Timed out awaiting confirmation on transaction')\n        }\n        let simulateResult: SimulatedTransactionResponse | null = null\n        try {\n            simulateResult = (await simulateTransaction(connection, signedTransaction, 'single')).value\n        } catch (e) {\n            console.error('Simulate Transaction error', e)\n        }\n        if (simulateResult && simulateResult.err) {\n            if (simulateResult.logs) {\n                for (let i = simulateResult.logs.length - 1; i >= 0; --i) {\n                    const line = simulateResult.logs[i]\n                    if (line.startsWith('Program log: ')) {\n                        throw new Error('Transaction failed: ' + line.slice('Program log: '.length))\n                    }\n                }\n            }\n            throw new Error(JSON.stringify(simulateResult.err))\n        }\n        console.error('Got this far.')\n        txid = simulateResult?.err as string\n        // throw new Error('Transaction failed');\n    } finally {\n        done = true\n    }\n\n    console.log('Latency (ms)', txid, getUnixTs() - startTime)\n    return { txid, slot }\n}\n/**\n * Simualate a transaction.\n * @param connection The connection to the cluster.\n * @param transaction  The transaction to simulate.\n * @param commitment  The commitment to use for the transaction.\n * @returns  The simulated transaction response.\n */\nasync function simulateTransaction(\n    connection: Connection,\n    transaction: Transaction,\n    commitment: Commitment\n): Promise<RpcResponseAndContext<SimulatedTransactionResponse>> {\n    transaction.recentBlockhash = (await connection.getLatestBlockhash()).blockhash\n\n    const signData = transaction.serializeMessage()\n    const encodedTransaction = signData.toString('base64')\n    const config: any = { encoding: 'base64', commitment }\n    const args = [encodedTransaction, config]\n\n    // @ts-ignore\n    const res = await connection._rpcRequest('simulateTransaction', args)\n    if (res.error) {\n        throw new Error('failed to simulate transaction: ' + res.error.message)\n    }\n    return res.result\n}\n/**\n * Wait for a transaction to be confirmed.\n * @param txid The transaction id to await confirmation for.\n * @param timeout  The timeout in milliseconds.\n * @param connection  The connection to the cluster.\n * @param commitment  The commitment to use for the transaction.\n * @param queryStatus  Whether to query the status of the transaction.\n * @returns  The transaction signature.\n */\nexport async function awaitTransactionSignatureConfirmation(\n    txid: TransactionSignature,\n    timeout: number,\n    connection: Connection,\n    commitment: Commitment = 'recent',\n    queryStatus = false\n): Promise<SignatureStatus | null | void> {\n    let done = false\n    let status: SignatureStatus | null | void = {\n        slot: 0,\n        confirmations: 0,\n        err: null,\n    }\n    let subId = 0\n    // eslint-disable-next-line no-async-promise-executor, @typescript-eslint/no-misused-promises\n    status = await new Promise(async (resolve, reject) => {\n        setTimeout(() => {\n            if (done) {\n                return\n            }\n            done = true\n            console.warn('Rejecting for timeout...')\n            reject({ timeout: true })\n        }, timeout)\n        try {\n            subId = connection.onSignature(\n                txid,\n                (result, context) => {\n                    done = true\n                    status = {\n                        err: result.err,\n                        slot: context.slot,\n                        confirmations: 0,\n                    }\n                    if (result.err) {\n                        console.warn('Rejected via websocket', result.err)\n                        reject(status)\n                    } else {\n                        console.log('Resolved via websocket', result)\n                        resolve(status)\n                    }\n                },\n                commitment\n            )\n        } catch (e) {\n            done = true\n            console.error('WS error in setup', txid, e)\n        }\n        while (!done && queryStatus) {\n            // eslint-disable-next-line no-loop-func, no-extra-semi, @typescript-eslint/no-extra-semi\n            ;(async () => {\n                try {\n                    const signatureStatuses = await connection.getSignatureStatuses([txid])\n                    status = signatureStatuses && signatureStatuses.value[0]\n                    if (!done) {\n                        if (!status) {\n                            console.log('REST null result for', txid, status)\n                        } else if (status.err) {\n                            console.error('REST error for', txid, status)\n                            done = true\n                            reject(status.err)\n                        } else if (!status.confirmations) {\n                            console.log('REST no confirmations for', txid, status)\n                        } else {\n                            console.log('REST confirmation for', txid, status)\n                            done = true\n                            resolve(status)\n                        }\n                    }\n                } catch (e) {\n                    if (!done) {\n                        console.error('REST connection error: txid', txid, e)\n                    }\n                }\n            })()\n            await sleep(2000)\n        }\n    })\n\n    //   //@ts-ignore\n    //   if (connection._signatureSubscriptions[subId])\n    connection.removeSignatureListener(subId)\n    done = true\n    console.log('Returning status', status)\n    return status\n}\n\nexport enum SequenceType {\n    Sequential,\n    Parallel,\n    StopOnFailure,\n}\n/**\n * Execute a sequence of transactions.\n * @returns  The transaction signature.\n */\nexport const sendTransactions = async (\n    connection: Connection,\n    wallet: any,\n    instructionSet: TransactionInstruction[][],\n    signersSet: Keypair[][],\n    sequenceType: SequenceType = SequenceType.Parallel,\n    commitment: Commitment = 'singleGossip',\n    successCallback: (txid: string, ind: number) => void = (txid, ind) => {},\n    failCallback: (reason: string, ind: number) => boolean = (txid, ind) => false,\n    block?: IBlockhashAndFeeCalculator,\n    beforeTransactions: Transaction[] = [],\n    afterTransactions: Transaction[] = []\n): Promise<{ number: number; txs: { txid: string; slot: number }[] }> => {\n    if (!wallet.publicKey) throw new Error('Wallet not connected')\n\n    const unsignedTxns: Transaction[] = beforeTransactions\n\n    if (!block) {\n        block = await connection.getLatestBlockhash(commitment)\n    }\n\n    for (let i = 0; i < instructionSet.length; i++) {\n        const instructions = instructionSet[i]\n        const signers = signersSet[i]\n\n        if (instructions.length === 0) {\n            continue\n        }\n\n        const transaction = new Transaction()\n        instructions.forEach((instruction) => transaction.add(instruction))\n        transaction.recentBlockhash = block.blockhash\n        transaction.setSigners(\n            // fee payed by the wallet owner\n            wallet.publicKey,\n            ...signers.map((s) => s.publicKey)\n        )\n\n        if (signers.length > 0) {\n            transaction.partialSign(...signers)\n        }\n\n        unsignedTxns.push(transaction)\n    }\n    unsignedTxns.push(...afterTransactions)\n\n    const partiallySignedTransactions = unsignedTxns.filter((t) =>\n        t.signatures.find((sig) => sig.publicKey.equals(wallet.publicKey))\n    )\n    const fullySignedTransactions = unsignedTxns.filter(\n        (t) => !t.signatures.find((sig) => sig.publicKey.equals(wallet.publicKey))\n    )\n    let signedTxns = await wallet.signAllTransactions(partiallySignedTransactions)\n    signedTxns = fullySignedTransactions.concat(signedTxns)\n    const pendingTxns: Promise<{ txid: string; slot: number }>[] = []\n\n    console.log('Signed txns length', signedTxns.length, 'vs handed in length', instructionSet.length)\n    for (let i = 0; i < signedTxns.length; i++) {\n        const signedTxnPromise = sendSignedTransaction({\n            connection,\n            signedTransaction: signedTxns[i],\n        })\n\n        if (sequenceType !== SequenceType.Parallel) {\n            try {\n                await signedTxnPromise.then(({ txid, slot }) => successCallback(txid, i))\n                pendingTxns.push(signedTxnPromise)\n            } catch (e) {\n                console.log('Failed at txn index:', i)\n                console.log('Caught failure:', e)\n\n                failCallback(signedTxns[i], i)\n                if (sequenceType === SequenceType.StopOnFailure) {\n                    return {\n                        number: i,\n                        txs: await Promise.all(pendingTxns),\n                    }\n                }\n            }\n        } else {\n            pendingTxns.push(signedTxnPromise)\n        }\n    }\n\n    if (sequenceType !== SequenceType.Parallel) {\n        const result = await Promise.all(pendingTxns)\n        return { number: signedTxns.length, txs: result }\n    }\n\n    return { number: signedTxns.length, txs: await Promise.all(pendingTxns) }\n}\n","/* eslint-disable @typescript-eslint/no-extra-semi */\n/* eslint-disable no-extra-semi */\n/* eslint-disable @typescript-eslint/no-unsafe-argument */\n/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */\n/* eslint-disable no-console */\n/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\nimport * as anchor from '@project-serum/anchor'\nimport { getAccount, getMint, TOKEN_PROGRAM_ID } from '@solana/spl-token'\nimport { PublicKey } from '@solana/web3.js'\nimport { CANDY_MACHINE_PROGRAM_V2_ID, SUPPORTED_ANIMATION_TYPES, SUPPORTED_IMAGE_TYPES } from '../constants'\nimport { StorageType } from '../enums'\nimport { ICandyMachineConfig } from '../interfaces'\nimport { JSON_EXTENSION } from '../constants'\nimport { getAtaForMint } from '../mint/helpers'\nimport { parseDate } from './helpers'\n\n/**\n * Load the candy program v2..\n * @param provider The anchor provider.\n * @param customRpcUrl (Optional) The custom rpc url of the candy machine.\n * @returns The IDL.\n *\n */\nexport async function loadCandyProgramV2(provider: anchor.Provider, customRpcUrl?: string) {\n    if (customRpcUrl) console.log('USING CUSTOM URL', customRpcUrl)\n    const idl = (await anchor.Program.fetchIdl(CANDY_MACHINE_PROGRAM_V2_ID, provider)) as anchor.Idl\n\n    const program = new anchor.Program(idl, CANDY_MACHINE_PROGRAM_V2_ID, provider)\n    console.log('program id from anchor', program.programId.toBase58())\n    return program\n}\n/**\n * Get the candy machine settings.\n * @param walletKeyPair The wallet key pair.\n * @param configForm  The config form.\n * @param anchorProgram  The anchor program.\n * @returns  The settings of the candy machine.\n */\nexport async function getCandyMachineV2Config(\n    walletKeyPair: PublicKey,\n    configForm: ICandyMachineConfig,\n    anchorProgram: anchor.Program<anchor.Idl>\n): Promise<{\n    storage: StorageType\n    nftStorageKey: string | null\n    ipfsInfuraProjectId: string | null\n    number: number\n    ipfsInfuraSecret: string | null\n    pinataJwt: string | null\n    pinataGateway: string | null\n    awsS3Bucket: string | null\n    retainAuthority: boolean\n    mutable: boolean\n    batchSize: number | null\n    price: anchor.BN\n    treasuryWallet: PublicKey\n    splToken: PublicKey | null\n    gatekeeper: null | {\n        expireOnUse: boolean\n        gatekeeperNetwork: PublicKey\n    }\n    endSettings: null | [number, anchor.BN]\n    whitelistMintSettings: null | {\n        mode: any\n        mint: PublicKey\n        presale: boolean\n        discountPrice: null | anchor.BN\n    }\n    hiddenSettings: null | {\n        name: string\n        uri: string\n        hash: Uint8Array\n    }\n    goLiveDate: anchor.BN | null\n    uuid: string | null\n    arweaveJwk: string | null\n}> {\n    if (configForm === undefined) {\n        throw new Error('The configForm is undefined')\n    }\n\n    const config = configForm\n\n    const {\n        storage,\n        nftStorageKey,\n        ipfsInfuraProjectId,\n        number,\n        ipfsInfuraSecret,\n        pinataJwt,\n        pinataGateway,\n        awsS3Bucket,\n        noRetainAuthority,\n        noMutable,\n        batchSize,\n        price,\n        splToken,\n        splTokenAccount,\n        solTreasuryAccount,\n        gatekeeper,\n        endSettings,\n        hiddenSettings,\n        whitelistMintSettings,\n        goLiveDate,\n        uuid,\n        arweaveJwk,\n    } = config\n\n    let wallet\n    let parsedPrice = price\n\n    const splTokenAccountFigured = splTokenAccount\n        ? splTokenAccount\n        : splToken\n        ? (await getAtaForMint(new PublicKey(splToken), walletKeyPair))[0]\n        : null\n\n    if (splToken) {\n        if (solTreasuryAccount) {\n            throw new Error('If spl-token-account or spl-token is set then sol-treasury-account cannot be set')\n        }\n        if (!splToken) {\n            throw new Error('If spl-token-account is set, spl-token must also be set')\n        }\n        const splTokenKey = new PublicKey(splToken)\n        const splTokenAccountKey = new PublicKey(splTokenAccountFigured as anchor.web3.PublicKey)\n        if (!splTokenAccountFigured) {\n            throw new Error('If spl-token is set, spl-token-account must also be set')\n        }\n\n        console.log('anchor program loaded', anchorProgram)\n\n        const mintInfo = await getMint(anchorProgram.provider.connection, splTokenKey, undefined, TOKEN_PROGRAM_ID)\n        if (!mintInfo.isInitialized) {\n            throw new Error('The specified spl-token is not initialized')\n        }\n        const tokenAccount = await getAccount(anchorProgram.provider.connection, splTokenAccountKey, undefined, TOKEN_PROGRAM_ID)\n        if (!tokenAccount.isInitialized) {\n            throw new Error('The specified spl-token-account is not initialized')\n        }\n        if (!tokenAccount.mint.equals(splTokenKey)) {\n            throw new Error(\n                `The spl-token-account's mint (${tokenAccount.mint.toString()}) does not match specified spl-token ${splTokenKey.toString()}`\n            )\n        }\n\n        wallet = new PublicKey(splTokenAccountKey)\n        parsedPrice = price * 10 ** mintInfo.decimals\n        if (\n            (whitelistMintSettings && whitelistMintSettings?.discountPrice) ||\n            (whitelistMintSettings && whitelistMintSettings?.discountPrice?.toNumber() === 0)\n        ) {\n            ;(whitelistMintSettings.discountPrice as any) *= 10 ** mintInfo.decimals\n        }\n    } else {\n        parsedPrice = price * 10 ** 9\n        if (whitelistMintSettings?.discountPrice || whitelistMintSettings?.discountPrice?.toNumber() === 0) {\n            ;(whitelistMintSettings.discountPrice as any) *= 10 ** 9\n        }\n        wallet = solTreasuryAccount ? new PublicKey(solTreasuryAccount) : walletKeyPair\n    }\n\n    if (whitelistMintSettings) {\n        whitelistMintSettings.mint = new PublicKey(whitelistMintSettings.mint)\n        if (whitelistMintSettings?.discountPrice || whitelistMintSettings?.discountPrice?.toNumber() === 0) {\n            whitelistMintSettings.discountPrice = new anchor.BN(whitelistMintSettings.discountPrice)\n        }\n    }\n\n    if (endSettings) {\n        if (endSettings.endSettingType.date) {\n            endSettings.number = new anchor.BN(parseDate(endSettings.value))\n        } else if (endSettings.endSettingType.amount) {\n            endSettings.number = new anchor.BN(endSettings.value)\n        }\n        delete endSettings.value\n    }\n\n    if (hiddenSettings) {\n        const utf8Encode = new TextEncoder()\n        hiddenSettings.hash = utf8Encode.encode(hiddenSettings.hash.toString())\n    }\n    console.log('correct config')\n\n    return {\n        storage,\n        nftStorageKey,\n        ipfsInfuraProjectId,\n        number,\n        ipfsInfuraSecret,\n        pinataJwt,\n        pinataGateway: pinataGateway ? pinataGateway : null,\n        awsS3Bucket,\n        retainAuthority: !noRetainAuthority,\n        mutable: !noMutable,\n        batchSize,\n        price: new anchor.BN(parsedPrice),\n        treasuryWallet: wallet,\n        splToken: splToken ? new PublicKey(splToken) : null,\n        gatekeeper: gatekeeper\n            ? {\n                  gatekeeperNetwork: new PublicKey(gatekeeper.gatekeeperNetwork),\n                  expireOnUse: gatekeeper.expireOnUse,\n              }\n            : null,\n        endSettings,\n        hiddenSettings,\n        whitelistMintSettings,\n        goLiveDate: goLiveDate ? new anchor.BN(parseDate(goLiveDate)) : null,\n        uuid,\n        arweaveJwk,\n    }\n}\n\n/**\n * @typedef {Object} VerifiedAssets\n * @property {File[]} supportedFiles how the person is called\n * @property {number} elemCount how many years the person lived\n */\n\n/**\n *\n * @param files : list of files to analuze (json+image)\n * @param storage : Storage to use\n * @param number :number of assets\n * @returns {VerifiedAssets} returns an array of verified assets and the number of assets\n */\n\nexport function verifyAssets(files: File[], storage: StorageType, number: number): { supportedFiles: File[]; elemCount: number } {\n    let imageFileCount = 0\n    let animationFileCount = 0\n    let jsonFileCount = 0\n\n    /**\n     * From the files list, check that the files are valid images and animations or json files.\n     */\n    const supportedFiles = files.filter((it) => {\n        if (SUPPORTED_IMAGE_TYPES.some((e) => e === it.type)) {\n            imageFileCount++\n        } else if (SUPPORTED_ANIMATION_TYPES.some((e) => e === it.type)) {\n            animationFileCount++\n        } else if (it.type == JSON_EXTENSION) {\n            jsonFileCount++\n        } else {\n            console.warn(`WARNING: Skipping unsupported file type ${it}`)\n            return false\n        }\n\n        return true\n    })\n\n    if (animationFileCount !== 0 && storage === StorageType.Arweave) {\n        throw new Error(\n            'The \"arweave\" storage option is incompatible with animation files. Please try again with another storage option using `--storage <option>`.'\n        )\n    }\n\n    if (animationFileCount !== 0 && animationFileCount !== jsonFileCount) {\n        throw new Error(\n            `number of animation files (${animationFileCount}) is different than the number of json files (${jsonFileCount})`\n        )\n    } else if (imageFileCount !== jsonFileCount) {\n        throw new Error(`number of img files (${imageFileCount}) is different than the number of json files (${jsonFileCount})`)\n    }\n\n    const elemCount = number ? number : imageFileCount\n    if (elemCount < imageFileCount) {\n        throw new Error(\n            `max number (${elemCount}) cannot be smaller than the number of images in the source folder (${imageFileCount})`\n        )\n    }\n\n    if (animationFileCount === 0) {\n        console.info(`Beginning the upload for ${elemCount} (img+json) pairs`)\n    } else {\n        console.info(`Beginning the upload for ${elemCount} (img+animation+json) sets`)\n    }\n    console.log('supportedFiles', supportedFiles)\n    return { supportedFiles, elemCount }\n}\n","export enum StorageType {\n    ArweaveBundle = 'arweave-bundle',\n    ArweaveSol = 'arweave-sol',\n    Arweave = 'arweave',\n    Ipfs = 'ipfs',\n    Aws = 'aws',\n    NftStorage = 'nft-storage',\n    Pinata = 'pinata',\n}\n","/* eslint-disable no-return-await */\nimport { web3 } from '@project-serum/anchor'\nimport {\n    CANDY_MACHINE_PROGRAM_V2_ID,\n    SPL_ASSOCIATED_TOKEN_ACCOUNT_PROGRAM_ID,\n    TOKEN_METADATA_PROGRAM_ID,\n    TOKEN_PROGRAM_ID,\n} from '../constants'\n\n/**\n * Get the associated token account from a mint and the owner.\n *\n * @param mint The mint to get the associated token account of.\n * @param buyer The owner of the associated token account.\n * @returns The associated token account\n */\nexport const getAtaForMint = async (mint: web3.PublicKey, buyer: web3.PublicKey): Promise<[web3.PublicKey, number]> =>\n    await web3.PublicKey.findProgramAddress(\n        [buyer.toBuffer(), TOKEN_PROGRAM_ID.toBuffer(), mint.toBuffer()],\n        SPL_ASSOCIATED_TOKEN_ACCOUNT_PROGRAM_ID\n    )\n\n/**\n * Get the mint metadata.\n *\n * @param mint The mint to get the metadata of.\n * @returns The mint metadata.\n * */\n\nexport const getMetadata = async (mint: web3.PublicKey): Promise<web3.PublicKey> =>\n    (\n        await web3.PublicKey.findProgramAddress(\n            [Buffer.from('metadata'), TOKEN_METADATA_PROGRAM_ID.toBuffer(), mint.toBuffer()],\n            TOKEN_METADATA_PROGRAM_ID\n        )\n    )[0]\n\n/**\n * Get the mint edition.\n * @param mint The mint to get the edition of.\n * @returns The mint edition.\n *\n **/\nexport const getMasterEdition = async (mint: web3.PublicKey): Promise<web3.PublicKey> =>\n    (\n        await web3.PublicKey.findProgramAddress(\n            [Buffer.from('metadata'), TOKEN_METADATA_PROGRAM_ID.toBuffer(), mint.toBuffer(), Buffer.from('edition')],\n            TOKEN_METADATA_PROGRAM_ID\n        )\n    )[0]\n/**\n * Get the creator of a candy machine.\n * @param candyMachine The candy machine to get the mint of.\n * @returns The creator of the Candy Machine.\n */\nexport const getCandyMachineCreator = async (candyMachine: web3.PublicKey): Promise<[web3.PublicKey, number]> =>\n    await web3.PublicKey.findProgramAddress([Buffer.from('candy_machine'), candyMachine.toBuffer()], CANDY_MACHINE_PROGRAM_V2_ID)\n","/* eslint-disable @typescript-eslint/no-unsafe-argument */\n/* eslint-disable @typescript-eslint/no-non-null-assertion */\n/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */\n/* eslint-disable no-console */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { BN, Program, web3 } from '@project-serum/anchor'\nimport { PublicKey } from '@solana/web3.js'\nimport { PromisePool } from '@supercharge/promise-pool'\nimport { ICache, saveCache } from './../cache'\nimport { StorageType } from '../enums'\nimport { JSON_EXTENSION } from '../constants'\n// import {\n//   makeArweaveBundleUploadGenerator,\n//   withdrawBundlr,\n// } from '../helpers/upload/arweave-bundle';\n// import { awsUpload } from '../helpers/upload/aws';\n// import { ipfsCreds, ipfsUpload } from '../helpers/upload/ipfs';\nimport { Manifest } from '../types'\nimport { arweaveUpload } from './arweave'\nimport { createCandyMachineV2, getFileExtension, getFileName, sleep } from './helpers'\n\n// import { nftStorageUpload } from '../helpers/upload/nft-storage';\n// import { pinataUpload } from '../helpers/upload/pinata';\n// import { setCollection } from './set-collection';\n\ntype AssetKey = { mediaExt: string; index: string }\ntype Env = 'mainnet-beta' | 'devnet'\n\n/**\n *\n * Upload a new candy machine with the settings passed and cache.\n * At the end of the upload, the cache can be downloaded.\n */\nexport async function uploadV2({\n    files,\n    cacheName,\n    env,\n    totalNFTs,\n    storage,\n    retainAuthority,\n    mutable,\n    // nftStorageKey,\n    // ipfsCredentials,\n    // pinataJwt,\n    // pinataGateway,\n    // awsS3Bucket,\n    batchSize,\n    price,\n    treasuryWallet,\n    // splToken,\n    gatekeeper,\n    goLiveDate,\n    endSettings,\n    whitelistMintSettings,\n    hiddenSettings,\n    // uuid,\n    walletKeyPair,\n    anchorProgram,\n    rateLimit,\n}: // arweaveJwk,\n// collectionMintPubkey,\n// rpcUrl,\n// setCollectionMint,\n\n{\n    files: File[]\n    cacheName: string\n    env: Env\n    totalNFTs: number\n    storage: string\n    retainAuthority: boolean\n    mutable: boolean\n    // nftStorageKey: string;\n    // ipfsCredentials: ipfsCreds;\n    // pinataJwt: string;\n    // pinataGateway: string;\n    // awsS3Bucket: string;\n    batchSize: number | null\n    price: BN\n    treasuryWallet: PublicKey\n    // splToken: PublicKey;\n    gatekeeper: null | {\n        expireOnUse: boolean\n        gatekeeperNetwork: web3.PublicKey\n    }\n    goLiveDate: null | BN\n    endSettings: null | [number, BN]\n    whitelistMintSettings: null | {\n        mode: any\n        mint: PublicKey\n        presale: boolean\n        discountPrice: null | BN\n    }\n    hiddenSettings: null | {\n        name: string\n        uri: string\n        hash: Uint8Array\n    }\n    // uuid: string;\n    walletKeyPair: any\n    anchorProgram: Program\n    // arweaveJwk: string;\n    rateLimit: number | null\n    // collectionMintPubkey: null | PublicKey;\n    // setCollectionMint: boolean;\n    // rpcUrl: null | string;\n}): Promise<boolean | string> {\n    // const savedContent = loadCache(cacheName, env);\n    const cacheContent: Partial<ICache> = {\n        program: {\n            uuid: '',\n            candyMachine: '',\n        },\n        items: {},\n    }\n    const filesNames = files.map((file) => file.name)\n\n    // if (!cacheContent.program) {\n    //   cacheContent.program = {};\n    // }\n\n    // if (!cacheContent.items) {\n    //   cacheContent.items = {};\n    // }\n\n    const dedupedAssetKeys = getAssetKeysNeedingUpload(cacheContent.items as ICache['items'], filesNames)\n    console.log('dedupedAssetKeys', dedupedAssetKeys)\n\n    let candyMachine =\n        // cacheContent.program.candyMachine\n        //   ? new PublicKey(cacheContent.program.candyMachine)\n        //   :\n        undefined\n\n    if (!cacheContent?.program?.uuid) {\n        const firstManifestFile = files.find((file) => file.name === '0.json')\n        if (!firstManifestFile) throw new Error('0.json must be present')\n        const firstAssetManifest = JSON.parse(await firstManifestFile.text()) as unknown as Manifest\n\n        try {\n            // TODO - SPL TOKEN PAYMENT\n\n            if (!firstAssetManifest.properties?.creators?.every((creator) => creator.address !== undefined)) {\n                throw new Error('Creator address is missing')\n            }\n\n            // initialize candy\n            console.info('initializing candy machine')\n            const res = await createCandyMachineV2(\n                anchorProgram,\n                walletKeyPair,\n                treasuryWallet,\n                // splToken,\n                {\n                    itemsAvailable: new BN(totalNFTs),\n                    uuid: null,\n                    symbol: firstAssetManifest.symbol,\n                    sellerFeeBasisPoints: firstAssetManifest.seller_fee_basis_points,\n                    isMutable: mutable,\n                    maxSupply: new BN(0),\n                    retainAuthority: retainAuthority,\n                    gatekeeper,\n                    goLiveDate,\n                    price,\n                    endSettings,\n                    whitelistMintSettings,\n                    hiddenSettings,\n                    creators: firstAssetManifest.properties.creators.map((creator) => ({\n                        address: new PublicKey(creator.address),\n                        verified: true,\n                        share: creator.share,\n                    })),\n                }\n            )\n            console.log('res', res)\n            cacheContent.program!.uuid = res.uuid\n            cacheContent.program!.candyMachine = res.candyMachine.toBase58()\n            cacheContent.startDate = goLiveDate\n\n            candyMachine = res.candyMachine\n\n            // TODO - set collection mint\n\n            console.info(`initialized config for a candy machine with publickey: ${res.candyMachine.toBase58()}`)\n\n            // saveCache(cacheName, env, cacheContent);\n        } catch (exx) {\n            console.error('Error deploying config to Solana network.', exx)\n            throw exx\n        }\n    } else {\n        console.info(\n            `config for a candy machine with publickey: ${cacheContent?.program.candyMachine} has been already initialized`\n        )\n    }\n\n    // TODO CHANGE ANY\n    const uploadedItems = Object.values(cacheContent.items!).filter((f: any) => !!f.link).length\n\n    console.info(`[${uploadedItems}] out of [${totalNFTs}] items have been uploaded`)\n\n    if (dedupedAssetKeys.length) {\n        console.info(`Starting upload for [${dedupedAssetKeys.length}] items, format ${JSON.stringify(dedupedAssetKeys[0])}`)\n    }\n\n    if (dedupedAssetKeys.length) {\n        // TODO - progress bar\n\n        // TODO make single promise not overlap each other\n        await PromisePool.withConcurrency(batchSize || 1)\n            .for(dedupedAssetKeys)\n            .handleError(async (err, asset) => {\n                console.error(`\\nError uploading ${JSON.stringify(asset)} asset (skipping)`, err.message)\n                await sleep(5000)\n            })\n\n            .process(async (asset) => {\n                console.log('processing asset: ', asset)\n                const jsonFile = files.find((file) => getFileName(file.name) === asset.index && file.type === JSON_EXTENSION)\n                const imageFile = files.find((file) => getFileName(file.name) === asset.index && file.type.startsWith('image/'))\n                if (!jsonFile) {\n                    throw new Error(`JSON file ${asset.index}.json is missing`)\n                }\n                const manifest = getAssetManifest(asset.index, JSON.parse(await jsonFile?.text()) as unknown as Manifest)\n\n                // TODO - ADD ANIMATIONS\n\n                const manifestBuffer = Buffer.from(JSON.stringify(manifest))\n                if (!imageFile) throw new Error(`Image file ${asset.index} is missing`)\n                let link, imageLink, animationLink\n                try {\n                    switch (storage) {\n                        case StorageType.Arweave:\n                        default:\n                            // eslint-disable-next-line no-extra-semi, @typescript-eslint/no-extra-semi\n                            ;[link, imageLink] = await arweaveUpload(\n                                walletKeyPair,\n                                anchorProgram,\n                                env,\n                                imageFile,\n                                manifestBuffer,\n                                manifest,\n                                Number(asset.index)\n                            )\n\n                            if (link && imageLink) {\n                                cacheContent.items![asset.index] = {\n                                    link,\n                                    imageLink,\n                                    name: manifest.name,\n                                    onChain: false,\n                                }\n                            }\n                    }\n                } catch (err) {\n                    saveCache(cacheName, env, cacheContent as ICache)\n                    console.error(err)\n                }\n            })\n    }\n\n    let uploadSuccessful = true\n    try {\n        if (!hiddenSettings && candyMachine) {\n            uploadSuccessful = await writeIndices({\n                anchorProgram,\n                cacheContent,\n                cacheName,\n                env,\n                candyMachine,\n                walletKeyPair,\n                rateLimit,\n            })\n            console.log('cache content: ', cacheContent)\n            const uploadedItems = Object.values(cacheContent.items!).filter((f: any) => !!f.link).length\n            console.log('uploadedItems: ', uploadedItems)\n            console.log('totalNFTs: ', totalNFTs)\n            console.log('uploadSuccessful: ', uploadSuccessful)\n\n            uploadSuccessful = uploadSuccessful && uploadedItems == totalNFTs\n        } else {\n            console.log('Skipping upload to chain as this is a hidden Candy Machine')\n        }\n\n        console.log(`Done. Successful = ${uploadSuccessful}.`)\n        return cacheContent.program!.candyMachine\n    } catch (err) {\n        console.error(err)\n        return false\n    }\n}\n\n/**\n * From the Cache object & a list of file paths, return a list of asset keys\n * (filenames without extension nor path) that should be uploaded, sorted numerically in ascending order.\n * Assets which should be uploaded either are not present in the Cache object,\n * or do not truthy value for the `link` property.\n */\nfunction getAssetKeysNeedingUpload(items: ICache['items'], files: string[]): AssetKey[] {\n    const all = [...new Set([...Object.keys(items), ...files])]\n    const keyMap: any = {}\n    const assets = all\n        .filter((k) => !k.includes('.json'))\n        .reduce((acc: AssetKey[], assetKey) => {\n            const key = getFileName(assetKey)\n            const ext = getFileExtension(assetKey)\n\n            if (!items[key]?.link && !keyMap[key]) {\n                keyMap[key] = true\n                acc.push({ mediaExt: ext, index: key })\n            }\n            return acc\n        }, [])\n        .sort((a, b) => Number.parseInt(a.index, 10) - Number.parseInt(b.index, 10))\n    console.log(assets)\n    return assets\n}\n\n/**\n * Returns a Manifest from a path and an assetKey\n * Replaces image.ext => index.ext\n * Replaces animation_url.ext => index.ext\n */\nexport function getAssetManifest(assetIndex: string, manifest: Manifest): Manifest {\n    manifest.image = manifest.image.replace('image', assetIndex)\n\n    if ('animation_url' in manifest) {\n        manifest.animation_url = manifest.animation_url.replace('animation_url', assetIndex)\n    }\n    return manifest\n}\n\n/**\n * For each asset present in the Cache object, write to the deployed\n * configuration an additional line with the name of the asset and the link\n * to its manifest, if the asset was not already written according to the\n * value of `onChain` property in the Cache object, for said asset.\n */\nasync function writeIndices({\n    anchorProgram,\n    cacheContent,\n    cacheName,\n    env,\n    candyMachine,\n    walletKeyPair,\n    rateLimit,\n}: {\n    anchorProgram: Program\n    cacheContent: any\n    cacheName: string\n    env: string\n    candyMachine: PublicKey\n    walletKeyPair: any\n    rateLimit: number | null\n}) {\n    let uploadSuccessful = true\n    const keys = Object.keys(cacheContent.items)\n    const poolArray = []\n    const allIndicesInSlice = Array.from(Array(keys.length).keys())\n    let offset = 0\n    while (offset < allIndicesInSlice.length) {\n        let length = 0\n        let lineSize = 0\n        let configLines = allIndicesInSlice.slice(offset, offset + 16)\n        while (length < 850 && lineSize < 16 && configLines[lineSize] !== undefined) {\n            length +=\n                cacheContent.items[keys[configLines[lineSize]]].link.length +\n                cacheContent.items[keys[configLines[lineSize]]].name.length\n            if (length < 850) lineSize++\n        }\n        configLines = allIndicesInSlice.slice(offset, offset + lineSize)\n        offset += lineSize\n        const onChain = configLines.filter((i) => cacheContent.items[keys[i]]?.onChain || false)\n        const index = keys[configLines[0]]\n        if (onChain.length != configLines.length) {\n            poolArray.push({ index, configLines })\n        }\n    }\n    console.info(`Writing all indices in ${poolArray.length} transactions...`)\n\n    // TODO - progress bar\n    const addConfigLines = async ({ index, configLines }: { index: any; configLines: any[] }) => {\n        const response = await anchorProgram.methods\n            .addConfigLines(\n                index,\n                configLines.map((i) => ({\n                    uri: cacheContent.items[keys[i]].link,\n                    name: cacheContent.items[keys[i]].name,\n                }))\n            )\n            .accounts({\n                candyMachine,\n                authority: walletKeyPair.publicKey,\n            })\n            .signers([])\n            .rpc()\n        console.log(response)\n        configLines.forEach((i) => {\n            cacheContent.items[keys[i]] = {\n                ...cacheContent.items[keys[i]],\n                onChain: true,\n                verifyRun: false,\n            }\n        })\n        // saveCache(cacheName, env, cacheContent);\n\n        // progressBar.increment();\n    }\n\n    await PromisePool.withConcurrency(rateLimit || 5)\n        .for(poolArray)\n        .handleError(async (err, { index, configLines }) => {\n            console.error(`\\nFailed writing indices ${index}-${keys[configLines[configLines.length - 1]]}: ${err.message}`)\n            await sleep(5000)\n            uploadSuccessful = false\n        })\n        .process(async ({ index, configLines }) => {\n            await addConfigLines({ index, configLines })\n        })\n    // progressBar.stop();\n    saveCache(cacheName, env, cacheContent)\n    return uploadSuccessful\n}\n","/* eslint-disable @typescript-eslint/ban-ts-comment */\n/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/no-unsafe-argument */\n/* eslint-disable @typescript-eslint/await-thenable */\n/* eslint-disable no-console */\n/* eslint-disable no-return-await */\nimport { web3 } from '@project-serum/anchor'\nimport { Transaction, SYSVAR_SLOT_HASHES_PUBKEY, SystemProgram } from '@solana/web3.js'\nimport { CANDY_MACHINE_PROGRAM_V2_ID, TOKEN_METADATA_PROGRAM_ID, TOKEN_PROGRAM_ID } from '../constants'\nimport { getAtaForMint, getCandyMachineCreator, getMasterEdition, getMetadata } from './helpers'\nimport { SetupState, CandyMachineAccount } from '../interfaces'\nimport {\n    createInitializeMintInstruction,\n    createMintToInstruction,\n    createAssociatedTokenAccountInstruction,\n    MintLayout,\n} from '@solana/spl-token'\nimport { sendTransactions, SequenceType } from '../upload/transactions'\n\n/**\n * Get the collection PDA from a Candy Machine Account.\n * @param candyMachineAddress The address of the candy machine.\n * @returns The collection PDA from a candy Machine\n */\n\nexport const getCollectionPDA = async (candyMachineAddress: web3.PublicKey): Promise<[web3.PublicKey, number]> =>\n    await web3.PublicKey.findProgramAddress(\n        [Buffer.from('collection'), candyMachineAddress.toBuffer()],\n        CANDY_MACHINE_PROGRAM_V2_ID\n    )\n\n/**\n * Get the collection autrhority record PDA.\n * @param mint The mint to get the creator of.\n * @param newAuthority  The new authority to set.\n * @returns  The collection autrhority record PDA.\n */\nconst getCollectionAuthorityRecordPDA = async (mint: web3.PublicKey, newAuthority: web3.PublicKey): Promise<web3.PublicKey> =>\n    (\n        await web3.PublicKey.findProgramAddress(\n            [\n                Buffer.from('metadata'),\n                TOKEN_METADATA_PROGRAM_ID.toBuffer(),\n                mint.toBuffer(),\n                Buffer.from('collection_authority'),\n                newAuthority.toBuffer(),\n            ],\n            TOKEN_METADATA_PROGRAM_ID\n        )\n    )[0]\n/**\n * Create the associated token account for a mint.\n * @param candyMachine The candy machine to get the mint of.\n * @param payer  The payer to pay for the transaction.\n * @returns The associated token account for a mint.\n */\nexport const createAccountsForMint = async (\n    candyMachine: CandyMachineAccount | undefined,\n    payer: web3.PublicKey\n): Promise<SetupState | undefined> => {\n    const mint = web3.Keypair.generate()\n    const userTokenAccountAddress = (await getAtaForMint(mint.publicKey, payer))[0]\n    const signers: web3.Keypair[] = [mint]\n\n    if (!candyMachine) return\n\n    const instructions = [\n        web3.SystemProgram.createAccount({\n            fromPubkey: payer,\n            newAccountPubkey: mint.publicKey,\n            space: MintLayout.span,\n            lamports: await candyMachine.program.provider.connection.getMinimumBalanceForRentExemption(MintLayout.span),\n            programId: TOKEN_PROGRAM_ID,\n        }),\n        createInitializeMintInstruction(mint.publicKey, 0, payer, payer, TOKEN_PROGRAM_ID),\n        createAssociatedTokenAccountInstruction(payer, userTokenAccountAddress, payer, mint.publicKey),\n        createMintToInstruction(mint.publicKey, userTokenAccountAddress, payer, 1, [], TOKEN_PROGRAM_ID),\n    ]\n\n    const sendTx = await sendTransactions(\n        candyMachine.program.provider.connection,\n        // @ts-ignore\n        candyMachine.program.provider.wallet,\n        [instructions],\n        [signers],\n        SequenceType.StopOnFailure,\n        'singleGossip',\n        () => {},\n        () => false,\n        undefined,\n        [],\n        []\n    )\n    console.log(sendTx)\n\n    const txid = sendTx.txs[0].txid\n\n    return {\n        mint: mint,\n        userTokenAccount: userTokenAccountAddress,\n        transaction: txid,\n    }\n}\n\ntype MintResult = {\n    mintTxId: string\n    metadataKey: web3.PublicKey\n}\n/**\n * Attempt to mint one nft.\n * @param candyMachine The candy machine to mint to.\n * @param payer  The payer to pay for the transaction.\n * @param beforeTransactions  The transactions to run before minting.\n * @param afterTransactions  The transactions to run after minting.\n * @param setupState  The setup state to use.\n * @returns  The mint result.\n */\nexport const mintOneNft = async (\n    candyMachine: CandyMachineAccount | undefined,\n    payer: web3.PublicKey,\n    beforeTransactions: Transaction[] = [],\n    afterTransactions: Transaction[] = [],\n    setupState?: SetupState\n): Promise<MintResult | null> => {\n    const mint = setupState?.mint ?? web3.Keypair.generate()\n    const userTokenAccountAddress = (await getAtaForMint(mint.publicKey, payer))[0]\n\n    if (!candyMachine) return null\n    const userPayingAccountAddress = candyMachine.state.tokenMint\n        ? (await getAtaForMint(candyMachine.state.tokenMint, payer))[0]\n        : payer\n\n    const candyMachineAddress = candyMachine.id\n    const remainingAccounts = []\n    const instructions = []\n    const signers: web3.Keypair[] = []\n    if (!setupState) {\n        signers.push(mint)\n        instructions.push(\n            ...[\n                web3.SystemProgram.createAccount({\n                    fromPubkey: payer,\n                    newAccountPubkey: mint.publicKey,\n                    space: MintLayout.span,\n                    lamports: await candyMachine.program.provider.connection.getMinimumBalanceForRentExemption(MintLayout.span),\n                    programId: TOKEN_PROGRAM_ID,\n                }),\n                createInitializeMintInstruction(mint.publicKey, 0, payer, payer, TOKEN_PROGRAM_ID),\n                createAssociatedTokenAccountInstruction(payer, userTokenAccountAddress, payer, mint.publicKey),\n                createMintToInstruction(mint.publicKey, userTokenAccountAddress, payer, 1, [], TOKEN_PROGRAM_ID),\n            ]\n        )\n    }\n\n    if (candyMachine.state.whitelistMintSettings) {\n        const mint = new web3.PublicKey(candyMachine.state.whitelistMintSettings.mint)\n\n        const whitelistToken = (await getAtaForMint(mint, payer))[0]\n        remainingAccounts.push({\n            pubkey: whitelistToken,\n            isWritable: true,\n            isSigner: false,\n        })\n\n        if (candyMachine.state.whitelistMintSettings.mode.burnEveryTime) {\n            remainingAccounts.push({\n                pubkey: mint,\n                isWritable: true,\n                isSigner: false,\n            })\n            remainingAccounts.push({\n                pubkey: payer,\n                isWritable: false,\n                isSigner: true,\n            })\n        }\n    }\n\n    if (candyMachine.state.tokenMint) {\n        remainingAccounts.push({\n            pubkey: userPayingAccountAddress,\n            isWritable: true,\n            isSigner: false,\n        })\n        remainingAccounts.push({\n            pubkey: payer,\n            isWritable: false,\n            isSigner: true,\n        })\n    }\n    const metadataAddress = await getMetadata(mint.publicKey)\n    const masterEdition = await getMasterEdition(mint.publicKey)\n\n    const [candyMachineCreator, creatorBump] = await getCandyMachineCreator(candyMachineAddress)\n\n    instructions.push(\n        await candyMachine.program.instruction.mintNft(creatorBump, {\n            accounts: {\n                candyMachine: candyMachineAddress,\n                candyMachineCreator,\n                payer: payer,\n                wallet: candyMachine.state.treasury,\n                mint: mint.publicKey,\n                metadata: metadataAddress,\n                masterEdition,\n                mintAuthority: payer,\n                updateAuthority: payer,\n                tokenMetadataProgram: TOKEN_METADATA_PROGRAM_ID,\n                tokenProgram: TOKEN_PROGRAM_ID,\n                systemProgram: SystemProgram.programId,\n                rent: web3.SYSVAR_RENT_PUBKEY,\n                clock: web3.SYSVAR_CLOCK_PUBKEY,\n                recentBlockhashes: SYSVAR_SLOT_HASHES_PUBKEY,\n                instructionSysvarAccount: web3.SYSVAR_INSTRUCTIONS_PUBKEY,\n            },\n            remainingAccounts: remainingAccounts.length > 0 ? remainingAccounts : undefined,\n        })\n    )\n\n    const [collectionPDA] = await getCollectionPDA(candyMachineAddress)\n    const collectionPDAAccount = await candyMachine.program.provider.connection.getAccountInfo(collectionPDA)\n\n    if (collectionPDAAccount && candyMachine.state.retainAuthority) {\n        try {\n            const collectionData = (await candyMachine.program.account.collectionPda.fetch(collectionPDA)) as any\n            const collectionMint = collectionData.mint\n            const collectionAuthorityRecord = await getCollectionAuthorityRecordPDA(collectionMint, collectionPDA)\n            if (collectionMint) {\n                const collectionMetadata = await getMetadata(collectionMint)\n                const collectionMasterEdition = await getMasterEdition(collectionMint)\n                instructions.push(\n                    await candyMachine.program.instruction.setCollectionDuringMint({\n                        accounts: {\n                            candyMachine: candyMachineAddress,\n                            metadata: metadataAddress,\n                            payer: payer,\n                            collectionPda: collectionPDA,\n                            tokenMetadataProgram: TOKEN_METADATA_PROGRAM_ID,\n                            instructions: web3.SYSVAR_INSTRUCTIONS_PUBKEY,\n                            collectionMint,\n                            collectionMetadata,\n                            collectionMasterEdition,\n                            authority: candyMachine.state.authority,\n                            collectionAuthorityRecord,\n                        },\n                    })\n                )\n            }\n        } catch (error) {\n            console.error(error)\n        }\n    }\n\n    try {\n        const txns = (\n            await sendTransactions(\n                candyMachine.program.provider.connection,\n                // @ts-ignore\n                candyMachine.program.provider.wallet,\n                [instructions],\n                [signers],\n                SequenceType.StopOnFailure,\n                'singleGossip',\n                () => {},\n                () => false,\n                undefined,\n                beforeTransactions,\n                afterTransactions\n            )\n        ).txs.map((t) => t.txid)\n        const mintTxn = txns[0]\n        return {\n            mintTxId: mintTxn,\n            metadataKey: metadataAddress,\n        }\n    } catch (e) {\n        console.log(e)\n    }\n    return null\n}\n"],"mappings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ID","BN","PublicKey","BN","PublicKey","uploadedItems","_0","web3","SystemProgram","web3","mint","SystemProgram"]}