difftreelog
test marketplace matcher contract
in: master
9 files changed
tests/src/eth/marketplace/MarketPlaceKSM.abidiffbeforeafterbothno changes
tests/src/eth/marketplace/MarketPlaceKSM.bindiffbeforeafterbothno changes
tests/src/eth/marketplace/MarketPlaceKSM.soldiffbeforeafterbothno changes
tests/src/eth/marketplace/MarketPlaceUNQ.abidiffbeforeafterbothno changes
tests/src/eth/marketplace/MarketPlaceUNQ.bindiffbeforeafterbothno changes
tests/src/eth/marketplace/MarketPlaceUNQ.soldiffbeforeafterbothno changes
tests/src/eth/marketplace/marketplace.test.tsdiffbeforeafterbothno changes
tests/src/eth/util/helpers.tsdiffbeforeafterboth141 return normalizeEvents(out);141 return normalizeEvents(out);142}142}143143144export function subToEth(eth: string): string {144export function subToEthLowercase(eth: string): string {145 const bytes = addressToEvm(eth);145 const bytes = addressToEvm(eth);146 const string = '0x' + Buffer.from(bytes).toString('hex');146 return '0x' + Buffer.from(bytes).toString('hex');147 return Web3.utils.toChecksumAddress(string);148}147}148149export function subToEth(eth: string): string {150 return Web3.utils.toChecksumAddress(subToEthLowercase(eth));151}149152150export function compileContract(name: string, src: string) {153export function compileContract(name: string, src: string) {151 const out = JSON.parse(solc.compile(JSON.stringify({154 const out = JSON.parse(solc.compile(JSON.stringify({223 return new web3.eth.Contract(contractHelpersAbi as any, '0x842899ECF380553E8a4de75bF534cdf6fBF64049', {from: caller, ...GAS_ARGS});226 return new web3.eth.Contract(contractHelpersAbi as any, '0x842899ECF380553E8a4de75bF534cdf6fBF64049', {from: caller, ...GAS_ARGS});224}227}228229export async function executeEthTxOnSub(api: ApiPromise, from: IKeyringPair, to: any, mkTx: (methods: any) => any, { value = 0 }: {value?: bigint | number} = { }) {230 const tx = api.tx.evm.call(231 subToEth(from.address),232 to.options.address,233 mkTx(to.methods).encodeABI(),234 value,235 GAS_ARGS.gas,236 GAS_ARGS.gasPrice,237 null,238 );239 const events = await submitTransactionAsync(from, tx);240 expect(events.find(({ event: {section, method}})=>section === 'evm' && method === 'Executed')).to.be.not.undefined;241}tests/src/util/helpers.tsdiffbeforeafterboth1164 });1164 });1165}1165}116611661167export async function queryNftOwner(api: ApiPromise, collectionId: number, tokenId: number): Promise<CrossAccountId> {1168 return normalizeAccountId((await api.query.nft.nftItemList(collectionId, tokenId) as any).toJSON().Owner);1169}