Skip to content

Commit

Permalink
Merge pull request #40 from pimlicolabs/feat/multiplTransactions
Browse files Browse the repository at this point in the history
Allow custom nonce
  • Loading branch information
kristofgazso authored Nov 22, 2023
2 parents ad32d31 + b95e9e5 commit ffa5c0a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/orange-llamas-train.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"permissionless": patch
---

Enable setting custom nonce for user operations
4 changes: 3 additions & 1 deletion src/actions/smartAccount/sendTransaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export async function sendTransaction<
maxPriorityFeePerGas,
to,
value,
nonce,
sponsorUserOperation
} = args

Expand Down Expand Up @@ -119,7 +120,8 @@ export async function sendTransaction<
paymasterAndData: "0x",
maxFeePerGas: maxFeePerGas || 0n,
maxPriorityFeePerGas: maxPriorityFeePerGas || 0n,
callData: callData
callData: callData,
nonce: nonce ? BigInt(nonce) : undefined
},
account: account,
sponsorUserOperation
Expand Down
7 changes: 5 additions & 2 deletions src/actions/smartAccount/sendTransactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export type SendTransactionsWithPaymasterParameters<
SponsorUserOperationMiddleware & {
maxFeePerGas?: bigint
maxPriorityFeePerGas?: bigint
nonce?: bigint
}

/**
Expand Down Expand Up @@ -86,7 +87,8 @@ export async function sendTransactions<
transactions,
sponsorUserOperation,
maxFeePerGas,
maxPriorityFeePerGas
maxPriorityFeePerGas,
nonce
} = args

if (!account_) {
Expand Down Expand Up @@ -121,7 +123,8 @@ export async function sendTransactions<
paymasterAndData: "0x",
maxFeePerGas: maxFeePerGas || 0n,
maxPriorityFeePerGas: maxPriorityFeePerGas || 0n,
callData: callData
callData: callData,
nonce: nonce
},
account: account,
sponsorUserOperation
Expand Down
5 changes: 0 additions & 5 deletions test/safeSmartAccount.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ import {

dotenv.config()

let testPrivateKey: Hex
let factoryAddress: Address

beforeAll(() => {
if (!process.env.PIMLICO_API_KEY) {
throw new Error("PIMLICO_API_KEY environment variable not set")
Expand All @@ -53,8 +50,6 @@ beforeAll(() => {
if (!process.env.GREETER_ADDRESS) {
throw new Error("ENTRYPOINT_ADDRESS environment variable not set")
}
testPrivateKey = process.env.TEST_PRIVATE_KEY as Hex
factoryAddress = process.env.FACTORY_ADDRESS as Address
})

describe("Safe Account", () => {
Expand Down

0 comments on commit ffa5c0a

Please sign in to comment.