Skip to content
Merged
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
17 changes: 14 additions & 3 deletions packages/account-sdk/src/browser-entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,22 @@ import type {
SubscriptionResult,
} from './interface/payment/types.js';

// Extend Window interface for global exports
declare global {
interface Window {
base: typeof base;
createBaseAccountSDK: typeof createBaseAccountSDK;
BaseAccountSDK: {
VERSION: string;
};
}
}

// Expose to global window object
if (typeof window !== 'undefined') {
(window as any).base = base;
(window as any).createBaseAccountSDK = createBaseAccountSDK;
(window as any).BaseAccountSDK = {
window.base = base;
window.createBaseAccountSDK = createBaseAccountSDK;
window.BaseAccountSDK = {
VERSION: PACKAGE_VERSION,
};
}
Expand Down
1 change: 0 additions & 1 deletion packages/account-sdk/src/interface/payment/charge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ export async function charge(options: ChargeOptions): Promise<ChargeResult> {

// Step 4: Get the network-scoped smart wallet
const network = testnet ? 'base-sepolia' : 'base';
// biome-ignore lint/correctness/useHookAtTopLevel: useNetwork is not a React hook, it's a CDP SDK method
const networkSmartWallet = await smartWallet.useNetwork(network);

// Step 5: Execute the charge transaction(s) using the smart wallet
Expand Down
10 changes: 5 additions & 5 deletions packages/account-sdk/src/sign/base-account/Signer.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CB_WALLET_RPC_URL } from ':core/constants.js';
import { Hex, hexToNumber, isAddressEqual, numberToHex } from 'viem';
import { Hex, WalletSendCallsParameters, hexToNumber, isAddressEqual, numberToHex } from 'viem';

import { Communicator } from ':core/communicator/Communicator.js';
import { isActionableHttpRequestError, isViemError, standardErrors } from ':core/error/errors.js';
Expand Down Expand Up @@ -703,10 +703,10 @@ export class Signer {
});

// Determine effective chainId - use request chainId for wallet_sendCalls, default otherwise
const chainId =
request.method === 'wallet_sendCalls' && (request.params as any[])?.[0]?.chainId
? hexToNumber((request.params as any[])[0].chainId)
: this.chain.id;
const walletSendCallsChainId =
request.method === 'wallet_sendCalls' &&
(request.params as WalletSendCallsParameters)?.[0]?.chainId;
const chainId = walletSendCallsChainId ? hexToNumber(walletSendCallsChainId) : this.chain.id;

const client = getClient(chainId);
assertPresence(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export async function routeThroughGlobalAccount({
/** Optional calls to prepend to the request. */
prependCalls?: { to: Address; data: Hex; value: Hex }[] | undefined;
/** The function to use to send the request to the global account. */
globalAccountRequest: (request: RequestArguments) => Promise<any>;
globalAccountRequest: (request: RequestArguments) => Promise<unknown>;
}) {
// Construct call to execute the original calls using executeBatch
let originalSendCallsParams: WalletSendCallsParameters[0];
Expand Down
6 changes: 3 additions & 3 deletions packages/account-sdk/src/ui/Dialog/Dialog.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) 2018-2025 Coinbase, Inc. <https://www.coinbase.com/>

import { clsx } from 'clsx';
import { FunctionComponent, render } from 'preact';
import { FunctionComponent, JSX, render } from 'preact';

import { getDisplayableUsername } from ':core/username/getDisplayableUsername.js';
import { store } from ':store/store.js';
Expand Down Expand Up @@ -122,7 +122,7 @@ export const DialogContainer: FunctionComponent = (props) => {
const [startY, setStartY] = useState(0);

// Touch event handlers for drag-to-dismiss (entire dialog area)
const handleTouchStart = (e: any) => {
const handleTouchStart = (e: JSX.TargetedTouchEvent<HTMLDivElement>) => {
// Only enable drag on mobile portrait mode
if (!isPhonePortrait()) return;

Expand All @@ -131,7 +131,7 @@ export const DialogContainer: FunctionComponent = (props) => {
setIsDragging(true);
};

const handleTouchMove = (e: any) => {
const handleTouchMove = (e: JSX.TargetedTouchEvent<HTMLDivElement>) => {
if (!isDragging) return;

const touch = e.touches[0];
Expand Down