Skip to content

set default timeout to transport - PIM-903 #222

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 9, 2024
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
5 changes: 5 additions & 0 deletions .changeset/good-onions-scream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"permissionless": patch
---

Default timeout for waitForUserOperationReceipt is inherited from bundlerClient.transport
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{
"workspaces": [
"packages/*"
],
"workspaces": ["packages/*"],
"private": true,
"author": "Pimlico",
"type": "module",
Expand Down
20 changes: 10 additions & 10 deletions packages/create-permissionless-app/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "create-permissionless-app",
"version": "0.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC"
"name": "create-permissionless-app",
"version": "0.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type Chain, type Client, type Hex, type Transport } from "viem"
import type { Chain, Client, Hex, Transport } from "viem"
import { privateKeyToAccount } from "viem/accounts"
import type { ENTRYPOINT_ADDRESS_V06_TYPE, Prettify } from "../../types"
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,10 @@ export async function signerToBiconomySmartAccount<
account: viemSigner,
message
})
const potentiallyIncorrectV = parseInt(signature.slice(-2), 16)
const potentiallyIncorrectV = Number.parseInt(
signature.slice(-2),
16
)
if (![27, 28].includes(potentiallyIncorrectV)) {
const correctV = potentiallyIncorrectV + 27
signature = (signature.slice(0, -2) +
Expand Down Expand Up @@ -305,7 +308,10 @@ export async function signerToBiconomySmartAccount<
account: viemSigner,
...typedData
})
const potentiallyIncorrectV = parseInt(signature.slice(-2), 16)
const potentiallyIncorrectV = Number.parseInt(
signature.slice(-2),
16
)
if (![27, 28].includes(potentiallyIncorrectV)) {
const correctV = potentiallyIncorrectV + 27
signature = (signature.slice(0, -2) +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
import { KernelExecuteAbi } from "../abi/KernelAccountAbi"
import { KernelV3ExecuteAbi } from "../abi/KernelV3AccountAbi"
import { CALL_TYPE, EXEC_TYPE } from "../constants"
import { type KernelVersion } from "../signerToEcdsaKernelSmartAccount"
import type { KernelVersion } from "../signerToEcdsaKernelSmartAccount"
import { getExecMode } from "./getExecMode"

export const encodeCallData = (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { type Hex, concatHex, pad } from "viem"
import { CALL_TYPE, EXEC_TYPE } from "../constants"
import type { CALL_TYPE, EXEC_TYPE } from "../constants"

export const getExecMode = ({
callType,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { type Address, concatHex, maxUint16, pad, toHex } from "viem"
import { VALIDATOR_MODE, VALIDATOR_TYPE } from "../constants"
import { type KernelVersion } from "../signerToEcdsaKernelSmartAccount"
import type { KernelVersion } from "../signerToEcdsaKernelSmartAccount"

export const getNonceKeyWithEncoding = (
accountVerion: KernelVersion,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type Chain, type Client, type Hex, type Transport } from "viem"
import type { Chain, Client, Hex, Transport } from "viem"
import { privateKeyToAccount } from "viem/accounts"
import type { ENTRYPOINT_ADDRESS_V06_TYPE, Prettify } from "../../types"
import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type Chain, type Client, type Hex, type Transport } from "viem"
import type { Chain, Client, Hex, Transport } from "viem"
import { privateKeyToAccount } from "viem/accounts"
import type { ENTRYPOINT_ADDRESS_V06_TYPE, Prettify } from "../../types"
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ const adjustVInSignature = (
): Hex => {
const ETHEREUM_V_VALUES = [0, 1, 27, 28]
const MIN_VALID_V_VALUE_FOR_SAFE_ECDSA = 27
let signatureV = parseInt(signature.slice(-2), 16)
let signatureV = Number.parseInt(signature.slice(-2), 16)
if (!ETHEREUM_V_VALUES.includes(signatureV)) {
throw new Error("Invalid signature")
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
import {
type Address,
type Chain,
type Client,
type Hex,
type Transport
} from "viem"
import type { Address, Chain, Client, Hex, Transport } from "viem"
import { privateKeyToAccount } from "viem/accounts"
import type { EntryPoint, Prettify } from "../../types"
import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
import {
type Account,
BaseError,
type Chain,
type Client,
type Hex,
type Transport
} from "viem"
import type { Account, BaseError, Chain, Client, Hex, Transport } from "viem"
import type { PartialBy } from "viem/types/utils"
import type { BundlerClient } from "../../clients/createBundlerClient"
import type { Prettify } from "../../types/"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export const waitForUserOperationReceipt = <
{
hash,
pollingInterval = bundlerClient.pollingInterval,
timeout
timeout = bundlerClient.transport.timeout
}: Prettify<WaitForUserOperationReceiptParameters>
): Promise<Prettify<GetUserOperationReceiptReturnType>> => {
const observerId = stringify([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type {
Transport
} from "viem"
import type { Prettify } from "../../types/"
import { type PimlicoBundlerRpcSchema } from "../../types/pimlico"
import type { PimlicoBundlerRpcSchema } from "../../types/pimlico"

export type SendCompressedUserOperationParameters = {
compressedUserOperation: Hex
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import type { EntryPoint } from "../../types/entrypoint"
import { parseAccount } from "../../utils/"
import { AccountOrClientNotFoundError } from "../../utils/signUserOperationHashWithECDSA"
import { waitForUserOperationReceipt } from "../bundler/waitForUserOperationReceipt"
import { type Middleware } from "./prepareUserOperationRequest"
import type { Middleware } from "./prepareUserOperationRequest"
import { sendUserOperation } from "./sendUserOperation"

export type DeployContractParametersWithPaymaster<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type {
SignMessageReturnType,
Transport
} from "viem"
import { type SmartAccount } from "../../accounts/types"
import type { SmartAccount } from "../../accounts/types"
import type { EntryPoint } from "../../types/entrypoint"
import { AccountOrClientNotFoundError, parseAccount } from "../../utils/"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Address, Hex } from "viem"
import type { PartialBy } from "viem/types/utils"
import { type StackupPaymasterClient } from "../../clients/stackup"
import type { StackupPaymasterClient } from "../../clients/stackup"
import type {
ENTRYPOINT_ADDRESS_V06_TYPE,
EntryPoint
Expand Down
6 changes: 3 additions & 3 deletions packages/permissionless/clients/createSmartAccountClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import type {
WalletClientConfig
} from "viem"
import { createClient } from "viem"
import { type SmartAccount } from "../accounts/types"
import { type Middleware } from "../actions/smartAccount/prepareUserOperationRequest"
import type { SmartAccount } from "../accounts/types"
import type { Middleware } from "../actions/smartAccount/prepareUserOperationRequest"
import type { Prettify } from "../types/"
import { type BundlerRpcSchema } from "../types/bundler"
import type { BundlerRpcSchema } from "../types/bundler"
import type { EntryPoint } from "../types/entrypoint"
import {
type SmartAccountActions,
Expand Down
2 changes: 1 addition & 1 deletion packages/permissionless/clients/decorators/stackup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
sponsorUserOperation
} from "../../actions/stackup/sponsorUserOperation"
import type { EntryPoint } from "../../types/entrypoint"
import { type StackupPaymasterClient } from "../stackup"
import type { StackupPaymasterClient } from "../stackup"

export type StackupPaymasterClientActions<entryPoint extends EntryPoint> = {
/**
Expand Down
2 changes: 1 addition & 1 deletion packages/permissionless/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export {
}
import type { UserOperation } from "./types/userOperation"

export { type UserOperation }
export type { UserOperation }

import type { GetUserOperationHashParams } from "./utils/getUserOperationHash"
import { getUserOperationHash } from "./utils/getUserOperationHash"
Expand Down
8 changes: 1 addition & 7 deletions packages/permissionless/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,7 @@
"type": "module",
"sideEffects": false,
"description": "A utility library for working with ERC-4337",
"keywords": [
"ethereum",
"erc-4337",
"eip-4337",
"paymaster",
"bundler"
],
"keywords": ["ethereum", "erc-4337", "eip-4337", "paymaster", "bundler"],
"license": "MIT",
"exports": {
".": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { BaseError, UnknownNodeError } from "viem"
import { type BaseError, UnknownNodeError } from "viem"
import type { EstimateUserOperationGasParameters } from "../../actions/bundler/estimateUserOperationGas"
import {
EstimateUserOperationGasError,
type EstimateUserOperationGasErrorType
} from "../../errors/estimateUserOperationGas"
import { type ErrorType } from "../../errors/utils"
import type { ErrorType } from "../../errors/utils"
import type { EntryPoint } from "../../types/entrypoint"
import {
type GetBundlerErrorParameters,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BaseError, UnknownNodeError } from "viem"
import { type BaseError, UnknownNodeError } from "viem"
import type { SendUserOperationParameters } from "../../actions/bundler/sendUserOperation"
import { SendUserOperationError } from "../../errors"
import type { EntryPoint } from "../../types/entrypoint"
Expand Down
4 changes: 2 additions & 2 deletions packages/wagmi-test-demo/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import { safeSmartAccount } from "@permissionless/wagmi"
import { createPimlicoPaymasterClient } from "permissionless/clients/pimlico"
import { walletClientToSmartAccountSigner } from "permissionless/utils"
import React from "react"
import { http, Address, zeroAddress } from "viem"
import { http, type Address, zeroAddress } from "viem"
import {
CreateConnectorFn,
type CreateConnectorFn,
useAccount,
useConfig,
useConnect,
Expand Down
2 changes: 1 addition & 1 deletion packages/wagmi/connectors/simpleSmartAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
type SmartAccountSigner,
signerToSimpleSmartAccount
} from "permissionless/accounts"
import { type SponsorUserOperationMiddleware } from "permissionless/actions/smartAccount"
import type { SponsorUserOperationMiddleware } from "permissionless/actions/smartAccount"
import type { Prettify } from "permissionless/types"
import type { Address, Chain, PublicClient, Transport } from "viem"
import { smartAccount } from "./smartAccount"
Expand Down
2 changes: 1 addition & 1 deletion packages/wagmi/connectors/smartAccount.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { type SmartAccountClient, chainId } from "permissionless"
import { type SmartAccount } from "permissionless/accounts"
import type { SmartAccount } from "permissionless/accounts"
import type { Chain, Transport } from "viem"
import { createConnector } from "wagmi"

Expand Down