import { BigNumber, ethers } from 'ethers'; import 'jest'; import { difference } from 'lodash'; import { ChainId } from '../config/constants'; import { Collection } from '../Collection'; import { CollectionCreator } from '../CollectionCreator'; import config from '../config/config'; import { CollectionsRegistry } from '../contracts/CollectionsRegistry'; import { ERC721Native } from '../contracts/ERC721Native'; import { BridgeBroker, DeployType } from '../types'; import { getTestConfig } from './utils'; const chainId = getTestConfig().chainId; const targetChainId = ChainId.RINKEBY; const sourceCollectionAddress = '0x29d9b96fb1e6df756669ff694c87a14c70e5810d'; const targetCollectionAddress = '0xea33f6cb3a572f4176b99d65c939f5933e10bd67'; describe('Collection', () => { beforeEach(async () => { if (getTestConfig().rpcUrl.includes('localhost')) { const provider = new ethers.providers.JsonRpcProvider( getTestConfig().rpcUrl ); await provider.send('hardhat_reset', [ { forking: { blockNumber: require('../../hardhat/hardhat.config.js') .networks.hardhat.forking.blockNumber, jsonRpcUrl: require('../../hardhat/hardhat.config.js') .networks.hardhat.forking.url, }, }, ]); } await config.initialize({ supportedChains: [ chainId, ChainId.BSCT, ChainId.MUMBAI, ChainId.RINKEBY, ChainId.ROPSTEN, ], moralisApiKey: '', pinataJWTToken: '', providerRpcUrls: { [chainId]: getTestConfig().rpcUrl, [ChainId.BSCT]: 'https://data-seed-prebsc-1-s1.binance.org:8545/', [ChainId.MUMBAI]: getTestConfig().mumbaiRpcUrl, [ChainId.RINKEBY]: 'https://rinkeby.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161', [ChainId.ROPSTEN]: 'https://ropsten.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161', }, }); }, 30000); describe('LayerZero', () => { it.only('should mint token on target chain', async () => { const provider = new ethers.providers.JsonRpcProvider( getTestConfig().rpcUrl ); const wallet = new ethers.Wallet( getTestConfig().privateKey, provider ) as unknown as ethers.providers.JsonRpcSigner; const collection = new Collection(wallet, sourceCollectionAddress); const result = await collection.mintOnTargetChain( targetChainId, BridgeBroker.LayerZero, { tokenId: BigNumber.from(11), }, 'QmNNvuUaB5cd8mP7oMhcEeax1AMSHcWfp2GzY3YfoZJLD3' ); console.log(result); }, 240000); }); });