Skip to content

Commit

Permalink
Escape nullable policies
Browse files Browse the repository at this point in the history
  • Loading branch information
JunichiSugiura committed Aug 20, 2024
1 parent 5318c6b commit 4512e3c
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion packages/keychain/src/Policies.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) => (
<>
Expand Down
4 changes: 2 additions & 2 deletions packages/keychain/src/components/layout/Footer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export function Footer({
const isExpandable = useMemo(
() =>
!!origin &&
!!policies.length &&
!!policies?.length &&
variant === "connect" &&
!isSignup &&
!hideTxSummary,
Expand Down Expand Up @@ -100,7 +100,7 @@ export function Footer({
onClick={footer.onToggle}
_hover={{ cursor: "pointer" }}
>
{!hideTxSummary && !!policies.length && (
{!hideTxSummary && !!policies?.length && (
<TransactionSummary
isSlot={isSlot}
createSession={createSession}
Expand Down

0 comments on commit 4512e3c

Please sign in to comment.