Skip to content

magic.sdk.rpcProvider not comaptible with viem EIP1193ProviderΒ #930

@johanneskares

Description

@johanneskares

βœ… Prerequisites

  • Did you perform a cursory search of open issues? Is this bug already reported elsewhere?
  • Are you running the latest SDK version?
  • Are you reporting to the correct repository (magic-sdk)?

πŸ› Description

magic.sdk.rpcProvider is not type compatible with viem's EIP1193Provider. The EIP1193Provider is very simple, and just needs 3 functions implemented: request, on, and removeListener.

🧩 Steps to Reproduce

  1. Try to pass magic.sdk.rpcProvider to a viem EIP1193Provider
  2. You get this very long type error
Argument of type 'RPCProviderModule' is not assignable to parameter of type '{ on: <event extends keyof EIP1193EventMap>(event: event, listener: EIP1193EventMap[event]) => void; removeListener: <event extends keyof EIP1193EventMap>(event: event, listener: EIP1193EventMap[event]) => void; request: EIP1193RequestFn<[{ Method: "web3_clientVersion"; Parameters?: undefined; ReturnType: string; }, { Method: "web3_sha3"; Parameters: [data: `0x${string}`]; ReturnType: string; }, { Method: "net_listening"; Parameters?: undefined; ReturnType: boolean; }, { Method: "net_peerCount"; Parameters?: undefined; ReturnType: `0x${string}`; }, { Method: "net_version"; Parameters?: undefined; ReturnType: `0x${string}`; }, { Method: "eth_blobBaseFee"; Parameters?: undefined; ReturnType: `0x${string}`; }, { Method: "eth_blockNumber"; Parameters?: undefined; ReturnType: `0x${string}`; }, { Method: "eth_call"; Parameters: readonly [transaction: ExactPartial<RpcTransactionRequest>] | readonly [transaction: ExactPartial<RpcTransactionRequest>, block: `0x${string}` | BlockTag | RpcBlockIdentifier] | readonly [transaction: ExactPartial<RpcTransactionRequest>, block: `0x${string}` | BlockTag | RpcBlockIdentifier, stateOverrideSet: RpcStateOverride] | readonly [transaction: ExactPartial<RpcTransactionRequest>, block: `0x${string}` | BlockTag | RpcBlockIdentifier, stateOverrideSet: RpcStateOverride, blockOverrides: Rpc]; ReturnType: `0x${string}`; }, { Method: "eth_createAccessList"; Parameters: [transaction: ExactPartial<RpcTransactionRequest>] | [transaction: ExactPartial<RpcTransactionRequest>, block: `0x${string}` | BlockTag | RpcBlockIdentifier]; ReturnType: { accessList: AccessList; gasUsed: `0x${string}`; }; }, { Method: "eth_chainId"; Parameters?: undefined; ReturnType: `0x${string}`; }, { Method: "eth_coinbase"; Parameters?: undefined; ReturnType: `0x${string}`; }, { Method: "eth_estimateGas"; Parameters: [transaction: RpcTransactionRequest] | [transaction: RpcTransactionRequest, block: `0x${string}` | BlockTag] | [transaction: RpcTransactionRequest, block: `0x${string}` | BlockTag, stateOverride: RpcStateOverride]; ReturnType: `0x${string}`; }, { Method: "eth_feeHistory"; Parameters: [blockCount: `0x${string}`, newestBlock: `0x${string}` | BlockTag, rewardPercentiles: number[] | undefined]; ReturnType: RpcFeeHistory; }, { Method: "eth_gasPrice"; Parameters?: undefined; ReturnType: `0x${string}`; }, { Method: "eth_getBalance"; Parameters: [address: `0x${string}`, block: `0x${string}` | BlockTag | RpcBlockIdentifier]; ReturnType: `0x${string}`; }, { Method: "eth_getBlockByHash"; Parameters: [hash: `0x${string}`, includeTransactionObjects: boolean]; ReturnType: RpcBlock | null; }, { Method: "eth_getBlockByNumber"; Parameters: [block: `0x${string}` | BlockTag, includeTransactionObjects: boolean]; ReturnType: RpcBlock | null; }, { Method: "eth_getBlockTransactionCountByHash"; Parameters: [hash: `0x${string}`]; ReturnType: `0x${string}`; }, { Method: "eth_getBlockTransactionCountByNumber"; Parameters: [block: `0x${string}` | BlockTag]; ReturnType: `0x${string}`; }, { Method: "eth_getCode"; Parameters: [address: `0x${string}`, block: `0x${string}` | BlockTag | RpcBlockIdentifier]; ReturnType: `0x${string}`; }, { Method: "eth_getFilterChanges"; Parameters: [filterId: `0x${string}`]; ReturnType: `0x${string}`[] | RpcLog[]; }, { Method: "eth_getFilterLogs"; Parameters: [filterId: `0x${string}`]; ReturnType: RpcLog[]; }, { Method: "eth_getLogs"; Parameters: [{ address?: `0x${string}` | `0x${string}`[] | undefined; topics?: LogTopic[] | undefined; } & ({ fromBlock?: `0x${string}` | BlockTag | undefined; toBlock?: `0x${string}` | BlockTag | undefined; blockHash?: undefined; } | { fromBlock?: undefined; toBlock?: undefined; blockHash?: `0x${string}` | undefined; })]; ReturnType: RpcLog[]; }, { Method: "eth_getProof"; Parameters: [address: `0x${string}`, storageKeys: `0x${string}`[], block: `0x${string}` | BlockTag]; ReturnType: RpcProof; }, { Method: "eth_getStorageAt"; Parameters: [address: `0x${string}`, index: `0x${string}`, block: `0x${string}` | BlockTag | RpcBlockIdentifier]; ReturnType: `0x${string}`; }, { Method: "eth_getTransactionByBlockHashAndIndex"; Parameters: [hash: `0x${string}`, index: `0x${string}`]; ReturnType: RpcTransaction | null; }, { Method: "eth_getTransactionByBlockNumberAndIndex"; Parameters: [block: `0x${string}` | BlockTag, index: `0x${string}`]; ReturnType: RpcTransaction | null; }, { Method: "eth_getTransactionByHash"; Parameters: [hash: `0x${string}`]; ReturnType: RpcTransaction | null; }, { Method: "eth_getTransactionCount"; Parameters: [address: `0x${string}`, block: `0x${string}` | BlockTag | RpcBlockIdentifier]; ReturnType: `0x${string}`; }, { Method: "eth_getTransactionReceipt"; Parameters: [hash: `0x${string}`]; ReturnType: RpcTransactionReceipt | null; }, { Method: "eth_getUncleByBlockHashAndIndex"; Parameters: [hash: `0x${string}`, index: `0x${string}`]; ReturnType: RpcUncle | null; }, { Method: "eth_getUncleByBlockNumberAndIndex"; Parameters: [block: `0x${string}` | BlockTag, index: `0x${string}`]; ReturnType: RpcUncle | null; }, { Method: "eth_getUncleCountByBlockHash"; Parameters: [hash: `0x${string}`]; ReturnType: `0x${string}`; }, { Method: "eth_getUncleCountByBlockNumber"; Parameters: [block: `0x${string}` | BlockTag]; ReturnType: `0x${string}`; }, { Method: "eth_maxPriorityFeePerGas"; Parameters?: undefined; ReturnType: `0x${string}`; }, { Method: "eth_newBlockFilter"; Parameters?: undefined; ReturnType: `0x${string}`; }, { Method: "eth_newFilter"; Parameters: [filter: { fromBlock?: `0x${string}` | BlockTag | undefined; toBlock?: `0x${string}` | BlockTag | undefined; address?: `0x${string}` | `0x${string}`[] | undefined; topics?: LogTopic[] | undefined; }]; ReturnType: `0x${string}`; }, { Method: "eth_newPendingTransactionFilter"; Parameters?: undefined; ReturnType: `0x${string}`; }, { Method: "eth_protocolVersion"; Parameters?: undefined; ReturnType: string; }, { Method: "eth_sendRawTransaction"; Parameters: [signedTransaction: `0x${string}`]; ReturnType: `0x${string}`; }, { Method: "eth_simulateV1"; Parameters: [{ blockStateCalls: readonly { blockOverrides?: Rpc | undefined; calls?: readonly ExactPartial<RpcTransactionRequest>[] | undefined; stateOverrides?: RpcStateOverride | undefined; }[]; returnFullTransactions?: boolean | undefined; traceTransfers?: boolean | undefined; validation?: boolean | undefined; }, `0x${string}` | BlockTag]; ReturnType: readonly (RpcBlock & { calls: readonly { error?: { data?: `0x${string}` | undefined; code: number; message: string; } | undefined; logs?: readonly RpcLog[] | undefined; gasUsed: `0x${string}`; returnData: `0x${string}`; status: `0x${string}`; }[]; })[]; }, { Method: "eth_uninstallFilter"; Parameters: [filterId: `0x${string}`]; ReturnType: boolean; }, { Method: "eth_accounts"; Parameters?: undefined; ReturnType: `0x${string}`[]; }, { Method: "eth_chainId"; Parameters?: undefined; ReturnType: `0x${string}`; }, { Method: "eth_estimateGas"; Parameters: [transaction: RpcTransactionRequest] | [transaction: RpcTransactionRequest, block: `0x${string}` | BlockTag] | [transaction: RpcTransactionRequest, block: `0x${string}` | BlockTag, stateOverride: RpcStateOverride]; ReturnType: `0x${string}`; }, { Method: "eth_requestAccounts"; Parameters?: undefined; ReturnType: `0x${string}`[]; }, { Method: "eth_sendTransaction"; Parameters: [transaction: RpcTransactionRequest]; ReturnType: `0x${string}`; }, { Method: "eth_sendRawTransaction"; Parameters: [signedTransaction: `0x${string}`]; ReturnType: `0x${string}`; }, { Method: "eth_sign"; Parameters: [address: `0x${string}`, data: `0x${string}`]; ReturnType: `0x${string}`; }, { Method: "eth_signTransaction"; Parameters: [request: RpcTransactionRequest]; ReturnType: `0x${string}`; }, { Method: "eth_signTypedData_v4"; Parameters: [address: `0x${string}`, message: string]; ReturnType: `0x${string}`; }, { Method: "eth_syncing"; Parameters?: undefined; ReturnType: false | NetworkSync; }, { Method: "personal_sign"; Parameters: [data: `0x${string}`, address: `0x${string}`]; ReturnType: `0x${string}`; }, { Method: "wallet_addEthereumChain"; Parameters: [chain: AddEthereumChainParameter]; ReturnType: null; }, { Method: "wallet_addSubAccount"; Parameters: [{ account: OneOf<{ keys: readonly { publicKey: `0x${string}`; type: "address" | "p256" | "webcrypto-p256" | "webauthn-p256"; }[]; type: "create"; } | { address: `0x${string}`; chainId?: number | undefined; type: "deployed"; } | { address: `0x${string}`; chainId?: number | undefined; factory: `0x${string}`; factoryData: `0x${string}`; type: "undeployed"; }>; version: string; }]; ReturnType: { address: `0x${string}`; factory?: `0x${string}` | undefined; factoryData?: `0x${string}` | undefined; }; }, { Method: "wallet_connect"; Parameters: [{ capabilities?: { [key: string]: any; } | undefined; version: string; }]; ReturnType: { accounts: readonly { address: `0x${string}`; capabilities?: { [key: string]: any; } | undefined; }[]; }; }, { Method: "wallet_disconnect"; Parameters?: undefined; ReturnType: void; }, { Method: "wallet_getCallsStatus"; Parameters?: [string] | undefined; ReturnType: WalletGetCallsStatusReturnType<{ [key: string]: any; }, `0x${string}`, `0x${string}`, `0x${string}`>; }, { Method: "wallet_getCapabilities"; Parameters?: readonly [] | readonly [`0x${string}` | undefined] | readonly [`0x${string}` | undefined, readonly `0x${string}`[] | undefined] | undefined; ReturnType: { [x: `0x${string}`]: { [key: string]: any; }; }; }, { Method: "wallet_getPermissions"; Parameters?: undefined; ReturnType: WalletPermission[]; }, { Method: "wallet_grantPermissions"; Parameters?: [WalletGrantPermissionsParameters] | undefined; ReturnType: { expiry: number; factory?: `0x${string}` | undefined; factoryData?: string | undefined; grantedPermissions: readonly { data: unknown; policies: readonly { data: unknown; type: string; }[]; required?: boolean | undefined; type: string; }[]; permissionsContext: string; signerData?: { userOpBuilder?: `0x${string}` | undefined; submitToAddress?: `0x${string}` | undefined; } | undefined; }; }, { Method: "wallet_requestPermissions"; Parameters: [permissions: { eth_accounts: Record<string, any>; }]; ReturnType: WalletPermission[]; }, { Method: "wallet_revokePermissions"; Parameters: [permissions: { eth_accounts: Record<string, any>; }]; ReturnType: null; }, { Method: "wallet_sendCalls"; Parameters?: WalletSendCallsParameters<{ [key: string]: any; }, `0x${string}`, `0x${string}`> | undefined; ReturnType: WalletSendCallsReturnType<{ [key: string]: any; }>; }, { Method: "wallet_sendTransaction"; Parameters: [transaction: RpcTransactionRequest]; ReturnType: `0x${string}`; }, { Method: "wallet_showCallsStatus"; Parameters?: [string] | undefined; ReturnType: void; }, { Method: "wallet_switchEthereumChain"; Parameters: [chain: { chainId: string; }]; ReturnType: null; }, { Method: "wallet_watchAsset"; Parameters: WatchAssetParams; ReturnType: boolean; }, { Method: "eth_chainId"; Parameters?: undefined; ReturnType: `0x${string}`; }, { Method: "eth_estimateUserOperationGas"; Parameters: [userOperation: RpcUserOperation, entrypoint: `0x${string}`] | [userOperation: RpcUserOperation, entrypoint: `0x${string}`, stateOverrideSet: RpcStateOverride]; ReturnType: RpcEstimateUserOperationGasReturnType; }, { Method: "eth_getUserOperationByHash"; Parameters: [hash: `0x${string}`]; ReturnType: RpcGetUserOperationByHashReturnType | null; }, { Method: "eth_getUserOperationReceipt"; Parameters: [hash: `0x${string}`]; ReturnType: RpcUserOperationReceipt | null; }, { Method: "eth_sendUserOperation"; Parameters: [userOperation: RpcUserOperation, entrypoint: `0x${string}`]; ReturnType: `0x${string}`; }, { Method: "eth_supportedEntryPoints"; Parameters?: undefined; ReturnType: readonly `0x${string}`[]; }, { Method: "pm_getPaymasterStubData"; Parameters?: [userOperation: OneOf<PartialBy<Pick<RpcUserOperation<"0.6">, "nonce" | "maxFeePerGas" | "maxPriorityFeePerGas" | "callData" | "callGasLimit" | "preVerificationGas" | "sender" | "verificationGasLimit" | "initCode">, "maxFeePerGas" | "maxPriorityFeePerGas" | "callGasLimit" | "preVerificationGas" | "verificationGasLimit" | "initCode"> | PartialBy<Pick<RpcUserOperation<"0.7">, "nonce" | "maxFeePerGas" | "maxPriorityFeePerGas" | "factory" | "factoryData" | "callData" | "callGasLimit" | "preVerificationGas" | "sender" | "verificationGasLimit">, "maxFeePerGas" | "maxPriorityFeePerGas" | "factory" | "factoryData" | "callGasLimit" | "preVerificationGas" | "verificationGasLimit">>, entrypoint: `0x${string}`, chainId: `0x${string}`, context: unknown] | undefined; ReturnType: OneOf<{ paymasterAndData: `0x${string}`; } | { paymaster: `0x${string}`; paymasterData: `0x${string}`; paymasterVerificationGasLimit: `0x${string}`; paymasterPostOpGasLimit: `0x${string}`; }> & { sponsor?: { name: string; icon?: string | undefined; } | undefined; isFinal?: boolean | undefined; }; }, { Method: "pm_getPaymasterData"; Parameters?: [userOperation: Pick<RpcUserOperation<"0.6">, "nonce" | "maxFeePerGas" | "maxPriorityFeePerGas" | "callData" | "callGasLimit" | "preVerificationGas" | "sender" | "verificationGasLimit" | "initCode"> | Pick<RpcUserOperation<"0.7">, "nonce" | "maxFeePerGas" | "maxPriorityFeePerGas" | "factory" | "factoryData" | "callData" | "callGasLimit" | "preVerificationGas" | "sender" | "verificationGasLimit">, entrypoint: `0x${string}`, chainId: `0x${string}`, context: unknown] | undefined; ReturnType: OneOf<{ paymasterAndData: `0x${string}`; } | { paymaster: `0x${string}`; paymasterData: `0x${string}`; paymasterVerificationGasLimit: `0x${string}`; paymasterPostOpGasLimit: `0x${string}`; }>; }], false>; }'.
  Property 'request' is protected in type 'RPCProviderModule' but public in type '{ on: <event extends keyof EIP1193EventMap>(event: event, listener: EIP1193EventMap[event]) => void; removeListener: <event extends keyof EIP1193EventMap>(event: event, listener: EIP1193EventMap[event]) => void; request: EIP1193RequestFn<[{ Method: "web3_clientVersion"; Parameters?: undefined; ReturnType: string; }, { Method: "web3_sha3"; Parameters: [data: `0x${string}`]; ReturnType: string; }, { Method: "net_listening"; Parameters?: undefined; ReturnType: boolean; }, { Method: "net_peerCount"; Parameters?: undefined; ReturnType: `0x${string}`; }, { Method: "net_version"; Parameters?: undefined; ReturnType: `0x${string}`; }, { Method: "eth_blobBaseFee"; Parameters?: undefined; ReturnType: `0x${string}`; }, { Method: "eth_blockNumber"; Parameters?: undefined; ReturnType: `0x${string}`; }, { Method: "eth_call"; Parameters: readonly [transaction: ExactPartial<RpcTransactionRequest>] | readonly [transaction: ExactPartial<RpcTransactionRequest>, block: `0x${string}` | BlockTag | RpcBlockIdentifier] | readonly [transaction: ExactPartial<RpcTransactionRequest>, block: `0x${string}` | BlockTag | RpcBlockIdentifier, stateOverrideSet: RpcStateOverride] | readonly [transaction: ExactPartial<RpcTransactionRequest>, block: `0x${string}` | BlockTag | RpcBlockIdentifier, stateOverrideSet: RpcStateOverride, blockOverrides: Rpc]; ReturnType: `0x${string}`; }, { Method: "eth_createAccessList"; Parameters: [transaction: ExactPartial<RpcTransactionRequest>] | [transaction: ExactPartial<RpcTransactionRequest>, block: `0x${string}` | BlockTag | RpcBlockIdentifier]; ReturnType: { accessList: AccessList; gasUsed: `0x${string}`; }; }, { Method: "eth_chainId"; Parameters?: undefined; ReturnType: `0x${string}`; }, { Method: "eth_coinbase"; Parameters?: undefined; ReturnType: `0x${string}`; }, { Method: "eth_estimateGas"; Parameters: [transaction: RpcTransactionRequest] | [transaction: RpcTransactionRequest, block: `0x${string}` | BlockTag] | [transaction: RpcTransactionRequest, block: `0x${string}` | BlockTag, stateOverride: RpcStateOverride]; ReturnType: `0x${string}`; }, { Method: "eth_feeHistory"; Parameters: [blockCount: `0x${string}`, newestBlock: `0x${string}` | BlockTag, rewardPercentiles: number[] | undefined]; ReturnType: RpcFeeHistory; }, { Method: "eth_gasPrice"; Parameters?: undefined; ReturnType: `0x${string}`; }, { Method: "eth_getBalance"; Parameters: [address: `0x${string}`, block: `0x${string}` | BlockTag | RpcBlockIdentifier]; ReturnType: `0x${string}`; }, { Method: "eth_getBlockByHash"; Parameters: [hash: `0x${string}`, includeTransactionObjects: boolean]; ReturnType: RpcBlock | null; }, { Method: "eth_getBlockByNumber"; Parameters: [block: `0x${string}` | BlockTag, includeTransactionObjects: boolean]; ReturnType: RpcBlock | null; }, { Method: "eth_getBlockTransactionCountByHash"; Parameters: [hash: `0x${string}`]; ReturnType: `0x${string}`; }, { Method: "eth_getBlockTransactionCountByNumber"; Parameters: [block: `0x${string}` | BlockTag]; ReturnType: `0x${string}`; }, { Method: "eth_getCode"; Parameters: [address: `0x${string}`, block: `0x${string}` | BlockTag | RpcBlockIdentifier]; ReturnType: `0x${string}`; }, { Method: "eth_getFilterChanges"; Parameters: [filterId: `0x${string}`]; ReturnType: `0x${string}`[] | RpcLog[]; }, { Method: "eth_getFilterLogs"; Parameters: [filterId: `0x${string}`]; ReturnType: RpcLog[]; }, { Method: "eth_getLogs"; Parameters: [{ address?: `0x${string}` | `0x${string}`[] | undefined; topics?: LogTopic[] | undefined; } & ({ fromBlock?: `0x${string}` | BlockTag | undefined; toBlock?: `0x${string}` | BlockTag | undefined; blockHash?: undefined; } | { fromBlock?: undefined; toBlock?: undefined; blockHash?: `0x${string}` | undefined; })]; ReturnType: RpcLog[]; }, { Method: "eth_getProof"; Parameters: [address: `0x${string}`, storageKeys: `0x${string}`[], block: `0x${string}` | BlockTag]; ReturnType: RpcProof; }, { Method: "eth_getStorageAt"; Parameters: [address: `0x${string}`, index: `0x${string}`, block: `0x${string}` | BlockTag | RpcBlockIdentifier]; ReturnType: `0x${string}`; }, { Method: "eth_getTransactionByBlockHashAndIndex"; Parameters: [hash: `0x${string}`, index: `0x${string}`]; ReturnType: RpcTransaction | null; }, { Method: "eth_getTransactionByBlockNumberAndIndex"; Parameters: [block: `0x${string}` | BlockTag, index: `0x${string}`]; ReturnType: RpcTransaction | null; }, { Method: "eth_getTransactionByHash"; Parameters: [hash: `0x${string}`]; ReturnType: RpcTransaction | null; }, { Method: "eth_getTransactionCount"; Parameters: [address: `0x${string}`, block: `0x${string}` | BlockTag | RpcBlockIdentifier]; ReturnType: `0x${string}`; }, { Method: "eth_getTransactionReceipt"; Parameters: [hash: `0x${string}`]; ReturnType: RpcTransactionReceipt | null; }, { Method: "eth_getUncleByBlockHashAndIndex"; Parameters: [hash: `0x${string}`, index: `0x${string}`]; ReturnType: RpcUncle | null; }, { Method: "eth_getUncleByBlockNumberAndIndex"; Parameters: [block: `0x${string}` | BlockTag, index: `0x${string}`]; ReturnType: RpcUncle | null; }, { Method: "eth_getUncleCountByBlockHash"; Parameters: [hash: `0x${string}`]; ReturnType: `0x${string}`; }, { Method: "eth_getUncleCountByBlockNumber"; Parameters: [block: `0x${string}` | BlockTag]; ReturnType: `0x${string}`; }, { Method: "eth_maxPriorityFeePerGas"; Parameters?: undefined; ReturnType: `0x${string}`; }, { Method: "eth_newBlockFilter"; Parameters?: undefined; ReturnType: `0x${string}`; }, { Method: "eth_newFilter"; Parameters: [filter: { fromBlock?: `0x${string}` | BlockTag | undefined; toBlock?: `0x${string}` | BlockTag | undefined; address?: `0x${string}` | `0x${string}`[] | undefined; topics?: LogTopic[] | undefined; }]; ReturnType: `0x${string}`; }, { Method: "eth_newPendingTransactionFilter"; Parameters?: undefined; ReturnType: `0x${string}`; }, { Method: "eth_protocolVersion"; Parameters?: undefined; ReturnType: string; }, { Method: "eth_sendRawTransaction"; Parameters: [signedTransaction: `0x${string}`]; ReturnType: `0x${string}`; }, { Method: "eth_simulateV1"; Parameters: [{ blockStateCalls: readonly { blockOverrides?: Rpc | undefined; calls?: readonly ExactPartial<RpcTransactionRequest>[] | undefined; stateOverrides?: RpcStateOverride | undefined; }[]; returnFullTransactions?: boolean | undefined; traceTransfers?: boolean | undefined; validation?: boolean | undefined; }, `0x${string}` | BlockTag]; ReturnType: readonly (RpcBlock & { calls: readonly { error?: { data?: `0x${string}` | undefined; code: number; message: string; } | undefined; logs?: readonly RpcLog[] | undefined; gasUsed: `0x${string}`; returnData: `0x${string}`; status: `0x${string}`; }[]; })[]; }, { Method: "eth_uninstallFilter"; Parameters: [filterId: `0x${string}`]; ReturnType: boolean; }, { Method: "eth_accounts"; Parameters?: undefined; ReturnType: `0x${string}`[]; }, { Method: "eth_chainId"; Parameters?: undefined; ReturnType: `0x${string}`; }, { Method: "eth_estimateGas"; Parameters: [transaction: RpcTransactionRequest] | [transaction: RpcTransactionRequest, block: `0x${string}` | BlockTag] | [transaction: RpcTransactionRequest, block: `0x${string}` | BlockTag, stateOverride: RpcStateOverride]; ReturnType: `0x${string}`; }, { Method: "eth_requestAccounts"; Parameters?: undefined; ReturnType: `0x${string}`[]; }, { Method: "eth_sendTransaction"; Parameters: [transaction: RpcTransactionRequest]; ReturnType: `0x${string}`; }, { Method: "eth_sendRawTransaction"; Parameters: [signedTransaction: `0x${string}`]; ReturnType: `0x${string}`; }, { Method: "eth_sign"; Parameters: [address: `0x${string}`, data: `0x${string}`]; ReturnType: `0x${string}`; }, { Method: "eth_signTransaction"; Parameters: [request: RpcTransactionRequest]; ReturnType: `0x${string}`; }, { Method: "eth_signTypedData_v4"; Parameters: [address: `0x${string}`, message: string]; ReturnType: `0x${string}`; }, { Method: "eth_syncing"; Parameters?: undefined; ReturnType: false | NetworkSync; }, { Method: "personal_sign"; Parameters: [data: `0x${string}`, address: `0x${string}`]; ReturnType: `0x${string}`; }, { Method: "wallet_addEthereumChain"; Parameters: [chain: AddEthereumChainParameter]; ReturnType: null; }, { Method: "wallet_addSubAccount"; Parameters: [{ account: OneOf<{ keys: readonly { publicKey: `0x${string}`; type: "address" | "p256" | "webcrypto-p256" | "webauthn-p256"; }[]; type: "create"; } | { address: `0x${string}`; chainId?: number | undefined; type: "deployed"; } | { address: `0x${string}`; chainId?: number | undefined; factory: `0x${string}`; factoryData: `0x${string}`; type: "undeployed"; }>; version: string; }]; ReturnType: { address: `0x${string}`; factory?: `0x${string}` | undefined; factoryData?: `0x${string}` | undefined; }; }, { Method: "wallet_connect"; Parameters: [{ capabilities?: { [key: string]: any; } | undefined; version: string; }]; ReturnType: { accounts: readonly { address: `0x${string}`; capabilities?: { [key: string]: any; } | undefined; }[]; }; }, { Method: "wallet_disconnect"; Parameters?: undefined; ReturnType: void; }, { Method: "wallet_getCallsStatus"; Parameters?: [string] | undefined; ReturnType: WalletGetCallsStatusReturnType<{ [key: string]: any; }, `0x${string}`, `0x${string}`, `0x${string}`>; }, { Method: "wallet_getCapabilities"; Parameters?: readonly [] | readonly [`0x${string}` | undefined] | readonly [`0x${string}` | undefined, readonly `0x${string}`[] | undefined] | undefined; ReturnType: { [x: `0x${string}`]: { [key: string]: any; }; }; }, { Method: "wallet_getPermissions"; Parameters?: undefined; ReturnType: WalletPermission[]; }, { Method: "wallet_grantPermissions"; Parameters?: [WalletGrantPermissionsParameters] | undefined; ReturnType: { expiry: number; factory?: `0x${string}` | undefined; factoryData?: string | undefined; grantedPermissions: readonly { data: unknown; policies: readonly { data: unknown; type: string; }[]; required?: boolean | undefined; type: string; }[]; permissionsContext: string; signerData?: { userOpBuilder?: `0x${string}` | undefined; submitToAddress?: `0x${string}` | undefined; } | undefined; }; }, { Method: "wallet_requestPermissions"; Parameters: [permissions: { eth_accounts: Record<string, any>; }]; ReturnType: WalletPermission[]; }, { Method: "wallet_revokePermissions"; Parameters: [permissions: { eth_accounts: Record<string, any>; }]; ReturnType: null; }, { Method: "wallet_sendCalls"; Parameters?: WalletSendCallsParameters<{ [key: string]: any; }, `0x${string}`, `0x${string}`> | undefined; ReturnType: WalletSendCallsReturnType<{ [key: string]: any; }>; }, { Method: "wallet_sendTransaction"; Parameters: [transaction: RpcTransactionRequest]; ReturnType: `0x${string}`; }, { Method: "wallet_showCallsStatus"; Parameters?: [string] | undefined; ReturnType: void; }, { Method: "wallet_switchEthereumChain"; Parameters: [chain: { chainId: string; }]; ReturnType: null; }, { Method: "wallet_watchAsset"; Parameters: WatchAssetParams; ReturnType: boolean; }, { Method: "eth_chainId"; Parameters?: undefined; ReturnType: `0x${string}`; }, { Method: "eth_estimateUserOperationGas"; Parameters: [userOperation: RpcUserOperation, entrypoint: `0x${string}`] | [userOperation: RpcUserOperation, entrypoint: `0x${string}`, stateOverrideSet: RpcStateOverride]; ReturnType: RpcEstimateUserOperationGasReturnType; }, { Method: "eth_getUserOperationByHash"; Parameters: [hash: `0x${string}`]; ReturnType: RpcGetUserOperationByHashReturnType | null; }, { Method: "eth_getUserOperationReceipt"; Parameters: [hash: `0x${string}`]; ReturnType: RpcUserOperationReceipt | null; }, { Method: "eth_sendUserOperation"; Parameters: [userOperation: RpcUserOperation, entrypoint: `0x${string}`]; ReturnType: `0x${string}`; }, { Method: "eth_supportedEntryPoints"; Parameters?: undefined; ReturnType: readonly `0x${string}`[]; }, { Method: "pm_getPaymasterStubData"; Parameters?: [userOperation: OneOf<PartialBy<Pick<RpcUserOperation<"0.6">, "nonce" | "maxFeePerGas" | "maxPriorityFeePerGas" | "callData" | "callGasLimit" | "preVerificationGas" | "sender" | "verificationGasLimit" | "initCode">, "maxFeePerGas" | "maxPriorityFeePerGas" | "callGasLimit" | "preVerificationGas" | "verificationGasLimit" | "initCode"> | PartialBy<Pick<RpcUserOperation<"0.7">, "nonce" | "maxFeePerGas" | "maxPriorityFeePerGas" | "factory" | "factoryData" | "callData" | "callGasLimit" | "preVerificationGas" | "sender" | "verificationGasLimit">, "maxFeePerGas" | "maxPriorityFeePerGas" | "factory" | "factoryData" | "callGasLimit" | "preVerificationGas" | "verificationGasLimit">>, entrypoint: `0x${string}`, chainId: `0x${string}`, context: unknown] | undefined; ReturnType: OneOf<{ paymasterAndData: `0x${string}`; } | { paymaster: `0x${string}`; paymasterData: `0x${string}`; paymasterVerificationGasLimit: `0x${string}`; paymasterPostOpGasLimit: `0x${string}`; }> & { sponsor?: { name: string; icon?: string | undefined; } | undefined; isFinal?: boolean | undefined; }; }, { Method: "pm_getPaymasterData"; Parameters?: [userOperation: Pick<RpcUserOperation<"0.6">, "nonce" | "maxFeePerGas" | "maxPriorityFeePerGas" | "callData" | "callGasLimit" | "preVerificationGas" | "sender" | "verificationGasLimit" | "initCode"> | Pick<RpcUserOperation<"0.7">, "nonce" | "maxFeePerGas" | "maxPriorityFeePerGas" | "factory" | "factoryData" | "callData" | "callGasLimit" | "preVerificationGas" | "sender" | "verificationGasLimit">, entrypoint: `0x${string}`, chainId: `0x${string}`, context: unknown] | undefined; ReturnType: OneOf<{ paymasterAndData: `0x${string}`; } | { paymaster: `0x${string}`; paymasterData: `0x${string}`; paymasterVerificationGasLimit: `0x${string}`; paymasterPostOpGasLimit: `0x${string}`; }>; }], false>; }'.

πŸ€” Expected behavior

Types are compatible. Seems like the main problem is that the request function is protected.

🌎 Environment

Software Version(s)
magic-sdk 29.4.2
viem 2.33.3
typescript 5.9.2

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions