From e76686be9d8dbfa983d0c959bbc96ea0742f4ced Mon Sep 17 00:00:00 2001 From: Tom Quirk <12551741+tomquirk@users.noreply.github.com> Date: Tue, 14 Nov 2023 20:47:19 +1000 Subject: [PATCH] dist limit changes --- .../hooks/juicebox/useEthDistributionLimit.ts | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/src/react/hooks/juicebox/useEthDistributionLimit.ts b/src/react/hooks/juicebox/useEthDistributionLimit.ts index 58cdc06..681d8ae 100644 --- a/src/react/hooks/juicebox/useEthDistributionLimit.ts +++ b/src/react/hooks/juicebox/useEthDistributionLimit.ts @@ -1,7 +1,8 @@ -import { JB_ETHER_ADDRESS } from "../../../constants"; -import { useJbFundAccessConstraintsStoreDistributionLimitOf } from "../../generated/hooks"; import { useJBContractContext } from "src/react/contexts"; +import { Ether } from "src/utils"; import { Address } from "viem"; +import { JBCurrency, JB_ETHER_ADDRESS } from "../../../constants"; +import { useJbFundAccessConstraintsStoreDistributionLimitOf } from "../../generated/hooks"; export interface EthDistributionLimitArgs { /** @@ -15,7 +16,7 @@ export interface EthDistributionLimitArgs { /** * The terminal from which distributions are being limited. */ - terminal: Address; + terminalAddress: Address; } /** @@ -26,19 +27,28 @@ export interface EthDistributionLimitArgs { export function useEthDistributionLimit({ projectId, configuration, - terminal, + terminalAddress, }: EthDistributionLimitArgs) { - const { contracts: { fundAccessConstraintsStore } } = useJBContractContext(); + const { + contracts: { fundAccessConstraintsStore }, + } = useJBContractContext(); const args = [ projectId, configuration, - terminal, + terminalAddress, JB_ETHER_ADDRESS, // _token - ] as const + ] as const; + const distributionLimit = useJbFundAccessConstraintsStoreDistributionLimitOf({ address: fundAccessConstraintsStore.data, - args + args, + select: ([distributionLimit, currency]) => { + return { + distributionLimit: new Ether(distributionLimit), + distributionLimitCurrency: currency as JBCurrency, + }; + }, }); return distributionLimit;