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
5 changes: 5 additions & 0 deletions .changeset/tame-mirrors-stick.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rhinestone/sdk": patch
---

Use provider param in smart session
7 changes: 6 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,12 @@ async function createRhinestoneAccount(

function experimental_getSessionDetails(sessions: Session[]) {
const account = getAddress()
return getSessionDetailsInternal(account, sessions, config.useDevContracts)
return getSessionDetailsInternal(
account,
sessions,
config.provider,
config.useDevContracts,
)
}

function experimental_isSessionEnabled(session: Session) {
Expand Down
7 changes: 4 additions & 3 deletions src/modules/validators/smart-sessions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
encodePacked,
type Hex,
hashStruct,
http,
isHex,
keccak256,
maxUint256,
Expand Down Expand Up @@ -381,12 +380,13 @@ function packSignature(
async function getSessionDetails(
account: Address,
sessions: Session[],
provider: ProviderConfig | undefined,
useDevContracts?: boolean,
): Promise<SessionDetails> {
const lockTag = '0x000000000000000000000000'
const sessionNonces = await Promise.all(
sessions.map((session) =>
getSessionNonce(account, session, lockTag, useDevContracts),
getSessionNonce(account, session, lockTag, provider, useDevContracts),
),
)
const sessionDatas = sessions.map((session) => getSessionData(session))
Expand Down Expand Up @@ -474,11 +474,12 @@ async function getSessionNonce(
account: Address,
session: Session,
lockTag: Hex,
provider: ProviderConfig | undefined,
useDevContracts?: boolean,
): Promise<bigint> {
const publicClient = createPublicClient({
chain: session.chain,
transport: http(),
transport: createTransport(session.chain, provider),
})
const nonce = await publicClient.readContract({
address: getSmartSessionEmissaryAddress(useDevContracts),
Expand Down