diff --git a/examples/starknet-react-next/src/components/providers/StarknetProvider.tsx b/examples/starknet-react-next/src/components/providers/StarknetProvider.tsx index 1c0bb841b..ca8268c0e 100644 --- a/examples/starknet-react-next/src/components/providers/StarknetProvider.tsx +++ b/examples/starknet-react-next/src/components/providers/StarknetProvider.tsx @@ -25,8 +25,8 @@ const ETH_TOKEN_ADDRESS = // const PAPER_TOKEN_ADDRESS = // "0x0410466536b5ae074f7fea81e5533b8134a9fa08b3dd077dd9db08f64997d113"; -const cartridge = new CartridgeConnector({ - policies: [ +const cartridge = new CartridgeConnector( + [ { target: ETH_TOKEN_ADDRESS, method: "approve", @@ -50,34 +50,35 @@ const cartridge = new CartridgeConnector({ method: "allowance", }, ], - url: - !process.env.NEXT_PUBLIC_VERCEL_BRANCH_URL || - process.env.NEXT_PUBLIC_VERCEL_BRANCH_URL.split(".")[0] === - "cartridge-starknet-react-next" - ? process.env.XFRAME_URL - : "https://" + - (process.env.NEXT_PUBLIC_VERCEL_BRANCH_URL ?? "").replace( - "cartridge-starknet-react-next", - "keychain", - ), - - rpc: process.env.NEXT_PUBLIC_RPC_SEPOLIA, - paymaster: { - caller: shortString.encodeShortString("ANY_CALLER"), + { + url: + !process.env.NEXT_PUBLIC_VERCEL_BRANCH_URL || + process.env.NEXT_PUBLIC_VERCEL_BRANCH_URL.split(".")[0] === + "cartridge-starknet-react-next" + ? process.env.XFRAME_URL + : "https://" + + (process.env.NEXT_PUBLIC_VERCEL_BRANCH_URL ?? "").replace( + "cartridge-starknet-react-next", + "keychain", + ), + rpc: process.env.NEXT_PUBLIC_RPC_SEPOLIA, + paymaster: { + caller: shortString.encodeShortString("ANY_CALLER"), + }, + // theme: "dope-wars", + // colorMode: "light" + // prefunds: [ + // { + // address: ETH_TOKEN_ADDRESS, + // min: "300000000000000", + // }, + // { + // address: PAPER_TOKEN_ADDRESS, + // min: "100", + // }, + // ], }, - // theme: "dope-wars", - // colorMode: "light" - // prefunds: [ - // { - // address: ETH_TOKEN_ADDRESS, - // min: "300000000000000", - // }, - // { - // address: PAPER_TOKEN_ADDRESS, - // min: "100", - // }, - // ], -}); +); function provider(chain: Chain) { switch (chain) { diff --git a/packages/keychain/src/Policies.tsx b/packages/keychain/src/Policies.tsx index 3f4bfe1ed..29037ff98 100644 --- a/packages/keychain/src/Policies.tsx +++ b/packages/keychain/src/Policies.tsx @@ -48,7 +48,7 @@ export function Policies({ // The container already set border radius (for top & bottom), but we // set the bottom radius for the last item here because for certain // browsers' scrolling behaviour (eg Firefox) just to make it look nicer. - borderBottomRadius={i === policies.length - 1 ? "base" : "none"} + borderBottomRadius={i === policies?.length - 1 ? "base" : "none"} > {({ isExpanded }) => ( <> diff --git a/packages/keychain/src/components/layout/Footer/index.tsx b/packages/keychain/src/components/layout/Footer/index.tsx index abb049401..dd0a11ccf 100644 --- a/packages/keychain/src/components/layout/Footer/index.tsx +++ b/packages/keychain/src/components/layout/Footer/index.tsx @@ -32,7 +32,7 @@ export function Footer({ const isExpandable = useMemo( () => !!origin && - !!policies.length && + !!policies?.length && variant === "connect" && !isSignup && !hideTxSummary, @@ -100,7 +100,7 @@ export function Footer({ onClick={footer.onToggle} _hover={{ cursor: "pointer" }} > - {!hideTxSummary && !!policies.length && ( + {!hideTxSummary && !!policies?.length && (