Skip to content

feat: check max commits #933

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 33 additions & 33 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"dependencies": {
"@apollo/client": "^3.8.1",
"@bosonprotocol/chat-sdk": "^1.3.1-alpha.9",
"@bosonprotocol/react-kit": "^0.22.0-alpha.12",
"@bosonprotocol/react-kit": "^0.22.0-alpha.15",
"@davatar/react": "^1.10.4",
"@ethersproject/address": "^5.6.1",
"@ethersproject/units": "^5.6.1",
Expand Down
2 changes: 1 addition & 1 deletion src/components/detail/DetailWidget/DetailWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@ const DetailWidget: React.FC<IDetailWidget> = ({
const offerCurationList = useCustomStoreQueryParameter("offerCurationList");
const { isConditionMet } = useCheckTokenGatedOffer({
commitProxyAddress,
condition: offer.condition
offer
});
const numSellers = new Set(
sellerCurationList
Expand Down
5 changes: 3 additions & 2 deletions src/components/detail/DetailWidget/TokenGated.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,11 @@ const TokenGated = ({
(async () => {
if (condition?.tokenAddress && condition?.tokenType === 0) {
try {
const { name, decimals, symbol } = await core.getExchangeTokenInfo(
const result = await core.getExchangeTokenInfo(
condition.tokenAddress
);
setTokenInfo({ name, decimals: decimals?.toString(), symbol });
const { name = "", decimals, symbol = "" } = result;
setTokenInfo({ name, decimals: decimals?.toString() ?? "", symbol });
} catch (error) {
setTokenInfo({ name: "", decimals: "", symbol: "" });
}
Expand Down
9 changes: 5 additions & 4 deletions src/lib/utils/hooks/offer/useCheckTokenGatedOffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,22 @@ import { useAccount, useSigner } from "../connection/connection";

interface Props {
commitProxyAddress?: string | undefined;
condition?: Offer["condition"] | undefined;
offer: Offer | undefined;
}

export default function useCheckTokenGatedOffer({
commitProxyAddress,
condition
offer
}: Props) {
const signer = useSigner();
const { account: address } = useAccount();
const { id: offerId, condition } = offer ?? {};

const core = useCoreSDK();
const [isConditionMet, setConditionMet] = useState<boolean>(false);

useEffect(() => {
if (!address || !condition) {
if (!address || !condition || !offerId) {
return;
}
(async () => {
Expand Down Expand Up @@ -58,7 +59,7 @@ export default function useCheckTokenGatedOffer({
}

try {
const met = await core.checkTokenGatedCondition(condition, address);
const met = await core.checkTokenGatedCondition(offerId, address);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this invocation refer to this method here

setConditionMet(met);
} catch (error) {
console.error(error);
Expand Down