Skip to content

Commit

Permalink
more debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
luu-alex committed Oct 5, 2023
1 parent 4fd23d6 commit af0daa1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
5 changes: 4 additions & 1 deletion packages/web3-eth-contract/src/contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,10 @@ export class Contract<Abi extends ContractAbi>
? log
: decodeEventABI(abi, log as LogsInput, this._jsonInterface, returnFormat),
);

// eslint-disable-next-line
console.log(logs);
// eslint-disable-next-line
console.log(decodedLogs);
const filter = options?.filter ?? {};
const filterKeys = Object.keys(filter);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ along with web3.js. If not, see <http://www.gnu.org/licenses/>.
import Web3 from 'web3';
// eslint-disable-next-line import/no-extraneous-dependencies
import { Web3Account } from 'web3-eth-accounts';
import { EventLog } from 'web3-types';
import { Contract } from '../../../src';
import { ERC721TokenAbi, ERC721TokenBytecode } from '../../shared_fixtures/build/ERC721Token';
import { getSystemTestProvider, createLocalAccount } from '../../fixtures/system_test_utils';
Expand Down Expand Up @@ -79,8 +80,8 @@ describe('contract', () => {
tempAccount.address.toLowerCase(),
);


const tokenId = awardReceipt.events?.Transfer.returnValues.tokenId as string;
const logs = await contractDeployed.getPastEvents('Transfer');
const tokenId = (logs[0] as EventLog)?.returnValues?.tokenId as string;

expect(
toUpperCaseHex(
Expand Down Expand Up @@ -112,7 +113,8 @@ describe('contract', () => {
tempAccount.address.toLowerCase(),
);

const tokenId = awardReceipt.events?.Transfer.returnValues.tokenId as string;
const logs = await contractDeployed.getPastEvents('Transfer');
const tokenId = (logs[0] as EventLog)?.returnValues?.tokenId as string;
const transferFromReceipt = await contractDeployed.methods
.transferFrom(tempAccount.address, toAccount.address, tokenId)
.send({
Expand Down Expand Up @@ -162,7 +164,7 @@ describe('contract', () => {
).toBe(toUpperCaseHex(toAccount.address));
});

it.each(['0x1', '0x2'])('should approve and then transferFrom item %p', async type => {
it.only.each(['0x1', '0x2'])('should approve and then transferFrom item %p', async type => {
const tempAccount = await createLocalAccount(web3);
const toAccount = await createLocalAccount(web3);
const awardReceipt = await contractDeployed.methods
Expand All @@ -183,8 +185,9 @@ describe('contract', () => {
expect(String(awardReceipt.events?.Transfer.returnValues[1]).toLowerCase()).toBe(
tempAccount.address.toLowerCase(),
);

const tokenId = awardReceipt.events?.Transfer.returnValues.tokenId as string;

const logs = await contractDeployed.getPastEvents('Transfer');
const tokenId = (logs[0] as EventLog)?.returnValues?.tokenId as string;

const approveReceipt = await contractDeployed.methods
.approve(toAccount.address, tokenId)
Expand Down

0 comments on commit af0daa1

Please sign in to comment.