diff --git a/src/main.ts b/src/main.ts index 60d3f85..0eb877b 100644 --- a/src/main.ts +++ b/src/main.ts @@ -490,87 +490,87 @@ async function main() { } ); - app.post( - '/eth-collection-contract', - requireAuth, - async (req: IRequest, res) => { - console.log('/eth-collection-contract - START'); - const collectionAddress = req.body.collectionAddress; - const _type = req.body.type; - - console.log( - '/eth-collection-contract - collectionAddress', - collectionAddress, - typeof collectionAddress - ); - - if (!collectionAddress || (_type !== 'ERC1155' && _type !== 'ERC721')) { - return res.status(400).send({ error: 'Invalid body!' }); - } - - const type = _type === 'ERC1155' ? 1155 : 721; - const CHAIN_NONCE = 5; - const signer = getEthSigner(); - - /* ================================================ - check mapping in bridge - ================================================ */ - - const response = await checkIfMappingExistsInBridge( - signer, - collectionAddress - ); - - console.log('handleAddContractToBridge', { response }); - - if (response.status === 'exists') { - return res - .status(200) - .send({ msg: 'Already deployed!', data: response.address }); - } else if (response.status === 'error') { - return res.status(500).send({ error: 'Internal server error!' }); - } - - /* ================================================ - deploy contract - ================================================ */ - - let contractAddress: string | undefined; - console.log('handleAddContractToBridge deploy contract'); - try { - contractAddress = await deployNoWhitelistEvmContract({ - signer, - type, - }); - console.log('handleAddContractToBridge', { contractAddress }); - if (!contractAddress) { - return res.status(500).send({ error: 'Internal server error!' }); - } - } catch (error) { - console.error('deployContractListener - error', error); - return res.status(500).send({ error: 'Internal server error!' }); - } - - const randomNonce = getRandomArbitrary(); - const actionId = BN(parseInt(collectionAddress, 16)) - .plus(BN(CHAIN_NONCE)) - .plus(randomNonce); - - io.emit( - 'deploy_contract', - CHAIN_NONCE, - collectionAddress, - type, - actionId, - contractAddress - ); - - return res.status(200).send({ - collectionAddress, - status: 'SUCCESS', - }); - } - ); + // app.post( + // '/eth-collection-contract', + // requireAuth, + // async (req: IRequest, res) => { + // console.log('/eth-collection-contract - START'); + // const collectionAddress = req.body.collectionAddress; + // const _type = req.body.type; + + // console.log( + // '/eth-collection-contract - collectionAddress', + // collectionAddress, + // typeof collectionAddress + // ); + + // if (!collectionAddress || (_type !== 'ERC1155' && _type !== 'ERC721')) { + // return res.status(400).send({ error: 'Invalid body!' }); + // } + + // const type = _type === 'ERC1155' ? 1155 : 721; + // const CHAIN_NONCE = 5; + // const signer = getEthSigner(); + + // /* ================================================ + // check mapping in bridge + // ================================================ */ + + // const response = await checkIfMappingExistsInBridge( + // signer, + // collectionAddress + // ); + + // console.log('handleAddContractToBridge', { response }); + + // if (response.status === 'exists') { + // return res + // .status(200) + // .send({ msg: 'Already deployed!', data: response.address }); + // } else if (response.status === 'error') { + // return res.status(500).send({ error: 'Internal server error!' }); + // } + + // /* ================================================ + // deploy contract + // ================================================ */ + + // let contractAddress: string | undefined; + // console.log('handleAddContractToBridge deploy contract'); + // try { + // contractAddress = await deployNoWhitelistEvmContract({ + // signer, + // type, + // }); + // console.log('handleAddContractToBridge', { contractAddress }); + // if (!contractAddress) { + // return res.status(500).send({ error: 'Internal server error!' }); + // } + // } catch (error) { + // console.error('deployContractListener - error', error); + // return res.status(500).send({ error: 'Internal server error!' }); + // } + + // const randomNonce = getRandomArbitrary(); + // const actionId = BN(parseInt(collectionAddress, 16)) + // .plus(BN(CHAIN_NONCE)) + // .plus(randomNonce); + + // io.emit( + // 'deploy_contract', + // CHAIN_NONCE, + // collectionAddress, + // type, + // actionId, + // contractAddress + // ); + + // return res.status(200).send({ + // collectionAddress, + // status: 'SUCCESS', + // }); + // } + // ); app.post( '/whitelist',