Skip to content

Commit

Permalink
test balance checks
Browse files Browse the repository at this point in the history
  • Loading branch information
jhesgodi committed Jun 19, 2024
1 parent d0ef575 commit d974134
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-console */
import { Web3Provider } from '@ethersproject/providers';
import { BigNumber, Contract } from 'ethers';
import {
Expand Down Expand Up @@ -85,8 +86,16 @@ const getERC721Balances = async (
// Convert ERC721 ownership into a balance result
const erc721Owners = await Promise.all(erc721OwnershipPromises.values());
const erc721OwnersPromiseIds = Array.from(erc721OwnershipPromises.keys());

debugger; // eslint-disable-line

erc721Owners.forEach((erc721OwnerAddress, index) => {
const itemRequirement = erc721s.get(erc721OwnersPromiseIds[index]);
console.log('πŸš€ ~ itemRequirement:', itemRequirement);
console.log('πŸš€ ~ ownerAddress:', ownerAddress);
console.log('πŸš€ ~ erc721OwnerAddress:', erc721OwnerAddress);
console.log('πŸš€ ~ isMatchingAddress:', isMatchingAddress(ownerAddress, erc721OwnerAddress));

let itemCount = 0;
if (itemRequirement && isMatchingAddress(ownerAddress, erc721OwnerAddress)) {
itemCount = 1;
Expand Down
7 changes: 6 additions & 1 deletion packages/checkout/sdk/src/smartCheckout/smartCheckout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,12 @@ export const smartCheckout = async (
onFundingRoute?: (fundingRoute: FundingRoute) => void,
fundingRouteFullAmount: boolean = false,
): Promise<SmartCheckoutResult> => {
const ownerAddress = await provider.getSigner().getAddress();
const signer = provider.getSigner();
const ownerAddress = await signer.getAddress();

if (ownerAddress === undefined) {
throw new Error('Owner address is undefined');
}

let aggregatedItems = itemAggregator(itemRequirements);

Expand Down

0 comments on commit d974134

Please sign in to comment.