Skip to content

Commit

Permalink
update paymaster functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
alissacrane-cb committed Oct 28, 2024
1 parent 6d6b8f8 commit 5ae8e5f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
1 change: 1 addition & 0 deletions playground/nextjs-app-router/components/DemoOptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export default function DemoOptions({
{commonOptions}
<Chain />
<PaymasterUrl />
<IsSponsored />
<CheckoutOptions />
</>
);
Expand Down
9 changes: 4 additions & 5 deletions playground/nextjs-app-router/components/demo/Checkout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { useCapabilities } from '@/lib/hooks';
import {
Checkout,
CheckoutButton,
Expand All @@ -10,8 +9,8 @@ import { useContext } from 'react';
import { AppContext, CheckoutTypes } from '../AppProvider';

export default function CheckoutDemo() {
const { checkoutTypes, checkoutOptions } = useContext(AppContext);
const capabilities = useCapabilities();
const { checkoutTypes, checkoutOptions, isSponsored } =
useContext(AppContext);

const chargeIDKey = useMemo(() => {
return `${checkoutOptions?.chargeId}`;
Expand Down Expand Up @@ -41,7 +40,7 @@ export default function CheckoutDemo() {
key={productIDKey}
productId={checkoutOptions?.productId}
onStatus={handleOnStatus}
isSponsored={capabilities?.paymasterService?.url != null}
isSponsored={isSponsored}
>
<CheckoutButton
coinbaseBranded={true}
Expand Down Expand Up @@ -69,7 +68,7 @@ export default function CheckoutDemo() {
key={chargeIDKey}
chargeHandler={createCharge}
onStatus={handleOnStatus}
isSponsored={capabilities?.paymasterService?.url != null}
isSponsored={isSponsored}
>
<CheckoutButton
coinbaseBranded={true}
Expand Down
5 changes: 1 addition & 4 deletions playground/nextjs-app-router/components/demo/Transaction.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { useCapabilities } from '@/lib/hooks';
import { clickCalls, clickContracts } from '@/lib/transactions';
import type { Call } from '@/onchainkit/esm/transaction/types';
import type { LifecycleStatus } from '@/onchainkit/src/transaction';
Expand All @@ -20,7 +19,6 @@ import { AppContext, TransactionTypes } from '../AppProvider';

function TransactionDemo() {
const { chainId, transactionType, isSponsored } = useContext(AppContext);
const capabilities = useCapabilities();
const contracts = clickContracts as ContractFunctionParameters[];
const calls = clickCalls as Call[];
const promiseCalls = new Promise((resolve) => {
Expand Down Expand Up @@ -100,7 +98,7 @@ function TransactionDemo() {
case TransactionTypes.ContractsCallback:
return { calls: undefined, contracts: contractsCallback };
default:
return { calls: undefined, contracts: undefined };
return { calls, contracts: undefined };
}
}, [
calls,
Expand All @@ -117,7 +115,6 @@ function TransactionDemo() {
<Transaction
chainId={chainId ?? 84532} // something breaks if we don't have default network?
{...transactions}
capabilities={capabilities}
isSponsored={isSponsored}
onStatus={handleOnStatus}
>
Expand Down

0 comments on commit 5ae8e5f

Please sign in to comment.