From 6d5a08723eda1d38cbb03ba74908b3888cea6e5a Mon Sep 17 00:00:00 2001 From: Joe Pegler Date: Tue, 31 Dec 2024 17:40:39 +0000 Subject: [PATCH] chore: introduce deferred terminology --- CHANGELOG.md | 6 ++ package.json | 2 +- .../clients/createNexusSessionClient.test.ts | 7 +- .../modules/smartSessionsValidator/Types.ts | 2 +- ...nAdvance.ts => grantDeferredPermission.ts} | 88 +++++++++---------- .../decorators/grantPermission.ts | 73 ++++++++------- .../decorators/index.ts | 37 ++++---- .../smartSessions.decorators.test.ts | 4 +- ...oSmartSessionValidator.enable.mode.test.ts | 2 +- .../toSmartSessionsValidator.advanced.test.ts | 39 ++++---- .../toSmartSessionsValidator.dx.test.ts | 2 +- .../toSmartSessionsValidator.policies.test.ts | 51 ++++++----- ...SmartSessionsValidator.sudo.policy.test.ts | 35 ++++---- .../toSmartSessionsValidator.test.ts | 7 +- ...oSmartSessionsValidator.uni.policy.test.ts | 6 +- src/test/playground.test.ts | 7 +- 16 files changed, 182 insertions(+), 186 deletions(-) rename src/sdk/modules/smartSessionsValidator/decorators/{grantPermissionInAdvance.ts => grantDeferredPermission.ts} (64%) diff --git a/CHANGELOG.md b/CHANGELOG.md index ba9259a4..87d8ff47 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # @biconomy/sdk +## 0.0.22 + +### Patch Changes + +- Smart sessions enable mode + ## 0.0.21 ### Patch Changes diff --git a/package.json b/package.json index 29e8b670..289776a0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@biconomy/sdk", - "version": "0.0.21", + "version": "0.0.22", "author": "Biconomy", "repository": "github:bcnmy/sdk", "main": "./dist/_cjs/index.js", diff --git a/src/sdk/clients/createNexusSessionClient.test.ts b/src/sdk/clients/createNexusSessionClient.test.ts index 2806e8cf..4ffd9262 100644 --- a/src/sdk/clients/createNexusSessionClient.test.ts +++ b/src/sdk/clients/createNexusSessionClient.test.ts @@ -129,10 +129,9 @@ describe("nexus.session.client", async () => { nexusClient.account.getCounterFactualAddress() - const createSessionsResponse = - await nexusSessionClient.grantPermissionInAdvance({ - sessionRequestedInfo - }) + const createSessionsResponse = await nexusSessionClient.grantPermission({ + sessionRequestedInfo + }) expect(createSessionsResponse.userOpHash).toBeDefined() expect(createSessionsResponse.permissionIds).toBeDefined() diff --git a/src/sdk/modules/smartSessionsValidator/Types.ts b/src/sdk/modules/smartSessionsValidator/Types.ts index 39be3a7a..b7442548 100644 --- a/src/sdk/modules/smartSessionsValidator/Types.ts +++ b/src/sdk/modules/smartSessionsValidator/Types.ts @@ -42,7 +42,7 @@ export type PreparePermissionResponse = { /** * Represents the response for creating sessions. */ -export type GrantPermissionInAdvanceResponse = { +export type GrantPermissionResponse = { /** The hash of the user operation. */ userOpHash: Hex } & PreparePermissionResponse diff --git a/src/sdk/modules/smartSessionsValidator/decorators/grantPermissionInAdvance.ts b/src/sdk/modules/smartSessionsValidator/decorators/grantDeferredPermission.ts similarity index 64% rename from src/sdk/modules/smartSessionsValidator/decorators/grantPermissionInAdvance.ts rename to src/sdk/modules/smartSessionsValidator/decorators/grantDeferredPermission.ts index fa71136f..f9fcc38a 100644 --- a/src/sdk/modules/smartSessionsValidator/decorators/grantPermissionInAdvance.ts +++ b/src/sdk/modules/smartSessionsValidator/decorators/grantDeferredPermission.ts @@ -1,13 +1,14 @@ -import type { Chain, Client, Hex, PublicClient, Transport } from "viem" -import { sendUserOperation } from "viem/account-abstraction" +import type { Chain, Client, PublicClient, Transport } from "viem" import { getAction, parseAccount } from "viem/utils" import { AccountNotFoundError } from "../../../account/utils/AccountNotFound" -import type { Call } from "../../../account/utils/Types" +import { + MAINNET_ADDRESS_K1_VALIDATOR_ADDRESS, + SmartSessionMode, + getAccount, + getEnableSessionDetails +} from "../../../constants" import type { ModularSmartAccount } from "../../utils/Types" -import type { - CreateSessionDataParams, - GrantPermissionInAdvanceResponse -} from "../Types" +import type { CreateSessionDataParams, SessionData } from "../Types" import { preparePermission } from "./preparePermission" /** @@ -15,27 +16,18 @@ import { preparePermission } from "./preparePermission" * * @template TModularSmartAccount - Type of the modular smart account, extending ModularSmartAccount or undefined. */ -export type GrantPermissionInAdvanceParameters< +export type GrantDeferredPermissionParameters< TModularSmartAccount extends ModularSmartAccount | undefined > = { /** Array of session data parameters for creating multiple sessions. */ sessionRequestedInfo: CreateSessionDataParams[] - /** The maximum fee per gas unit the transaction is willing to pay. */ - maxFeePerGas?: bigint - /** The maximum priority fee per gas unit the transaction is willing to pay. */ - maxPriorityFeePerGas?: bigint - /** The nonce of the transaction. If not provided, it will be determined automatically. */ - nonce?: bigint /** Optional public client for blockchain interactions. */ publicClient?: PublicClient /** The modular smart account to create sessions for. If not provided, the client's account will be used. */ account?: TModularSmartAccount - /** Optional attesters to trust. */ - attesters?: Hex[] - /** Additional calls to be included in the user operation. */ - calls?: Call[] } +export type GrantDeferredPermissionResponse = SessionData["moduleData"] /** * Adds multiple sessions to the SmartSessionValidator module of a given smart account. * @@ -53,9 +45,9 @@ export type GrantPermissionInAdvanceParameters< * * @example * ```typescript - * import { grantPermissionInAdvance } from '@biconomy/sdk' + * import { grantDeferredPermission } from '@biconomy/sdk' * - * const result = await grantPermissionInAdvance(nexusClient, { + * const result = await grantDeferredPermission(nexusClient, { * sessionRequestedInfo: [ * { * sessionKeyData: '0x...', @@ -80,19 +72,13 @@ export type GrantPermissionInAdvanceParameters< * - The number of sessions created is determined by the length of the `sessionRequestedInfo` array. * - Each session's policies and permissions are determined by the `actionPoliciesInfo` provided. */ -export async function grantPermissionInAdvance< +export async function grantDeferredPermission< TModularSmartAccount extends ModularSmartAccount | undefined >( client: Client, - parameters: GrantPermissionInAdvanceParameters -): Promise { - const { - account: account_ = client.account, - maxFeePerGas, - maxPriorityFeePerGas, - nonce, - calls: calls_ - } = parameters + parameters: GrantDeferredPermissionParameters +): Promise { + const { account: account_ = client.account } = parameters if (!account_) { throw new AccountNotFoundError({ @@ -101,6 +87,8 @@ export async function grantPermissionInAdvance< } const account = parseAccount(account_) as ModularSmartAccount + const publicClient = account?.client as PublicClient + if (!account || !account.address) { throw new Error("Account not found") } @@ -111,26 +99,30 @@ export async function grantPermissionInAdvance< "preparePermission" )(parameters) - const userOpHash = await getAction( - client, - sendUserOperation, - "sendUserOperation" - )({ - calls: [ - { - to: preparedPermission.action.target, - data: preparedPermission.action.callData - }, - ...(calls_ || []) - ], - maxFeePerGas, - maxPriorityFeePerGas, - nonce, - account + const nexusAccount = getAccount({ + address: account.address, + type: "nexus" + }) + + const sessionDetailsWithPermissionEnableHash = await getEnableSessionDetails({ + enableMode: SmartSessionMode.UNSAFE_ENABLE, + sessions: preparedPermission.sessions, + account: nexusAccount, + clients: [publicClient], + enableValidatorAddress: MAINNET_ADDRESS_K1_VALIDATOR_ADDRESS }) + const { permissionEnableHash, ...sessionDetails } = + sessionDetailsWithPermissionEnableHash + + sessionDetails.enableSessionData.enableSession.permissionEnableSig = + await account.signer.signMessage({ message: { raw: permissionEnableHash } }) + return { - userOpHash, - ...preparedPermission + permissionIds: preparedPermission.permissionIds, + action: preparedPermission.action, + mode: SmartSessionMode.UNSAFE_ENABLE, + sessions: preparedPermission.sessions, + enableSessionData: sessionDetails.enableSessionData } } diff --git a/src/sdk/modules/smartSessionsValidator/decorators/grantPermission.ts b/src/sdk/modules/smartSessionsValidator/decorators/grantPermission.ts index c44c19d5..9e133768 100644 --- a/src/sdk/modules/smartSessionsValidator/decorators/grantPermission.ts +++ b/src/sdk/modules/smartSessionsValidator/decorators/grantPermission.ts @@ -1,14 +1,10 @@ -import type { Chain, Client, PublicClient, Transport } from "viem" +import type { Chain, Client, Hex, PublicClient, Transport } from "viem" +import { sendUserOperation } from "viem/account-abstraction" import { getAction, parseAccount } from "viem/utils" import { AccountNotFoundError } from "../../../account/utils/AccountNotFound" -import { - MAINNET_ADDRESS_K1_VALIDATOR_ADDRESS, - SmartSessionMode, - getAccount, - getEnableSessionDetails -} from "../../../constants" +import type { Call } from "../../../account/utils/Types" import type { ModularSmartAccount } from "../../utils/Types" -import type { CreateSessionDataParams, SessionData } from "../Types" +import type { CreateSessionDataParams, GrantPermissionResponse } from "../Types" import { preparePermission } from "./preparePermission" /** @@ -21,13 +17,22 @@ export type GrantPermissionParameters< > = { /** Array of session data parameters for creating multiple sessions. */ sessionRequestedInfo: CreateSessionDataParams[] + /** The maximum fee per gas unit the transaction is willing to pay. */ + maxFeePerGas?: bigint + /** The maximum priority fee per gas unit the transaction is willing to pay. */ + maxPriorityFeePerGas?: bigint + /** The nonce of the transaction. If not provided, it will be determined automatically. */ + nonce?: bigint /** Optional public client for blockchain interactions. */ publicClient?: PublicClient /** The modular smart account to create sessions for. If not provided, the client's account will be used. */ account?: TModularSmartAccount + /** Optional attesters to trust. */ + attesters?: Hex[] + /** Additional calls to be included in the user operation. */ + calls?: Call[] } -export type GrantPermissionResponse = SessionData["moduleData"] /** * Adds multiple sessions to the SmartSessionValidator module of a given smart account. * @@ -78,7 +83,13 @@ export async function grantPermission< client: Client, parameters: GrantPermissionParameters ): Promise { - const { account: account_ = client.account } = parameters + const { + account: account_ = client.account, + maxFeePerGas, + maxPriorityFeePerGas, + nonce, + calls: calls_ + } = parameters if (!account_) { throw new AccountNotFoundError({ @@ -87,8 +98,6 @@ export async function grantPermission< } const account = parseAccount(account_) as ModularSmartAccount - const publicClient = account?.client as PublicClient - if (!account || !account.address) { throw new Error("Account not found") } @@ -99,30 +108,26 @@ export async function grantPermission< "preparePermission" )(parameters) - const nexusAccount = getAccount({ - address: account.address, - type: "nexus" - }) - - const sessionDetailsWithPermissionEnableHash = await getEnableSessionDetails({ - enableMode: SmartSessionMode.UNSAFE_ENABLE, - sessions: preparedPermission.sessions, - account: nexusAccount, - clients: [publicClient], - enableValidatorAddress: MAINNET_ADDRESS_K1_VALIDATOR_ADDRESS + const userOpHash = await getAction( + client, + sendUserOperation, + "sendUserOperation" + )({ + calls: [ + { + to: preparedPermission.action.target, + data: preparedPermission.action.callData + }, + ...(calls_ || []) + ], + maxFeePerGas, + maxPriorityFeePerGas, + nonce, + account }) - const { permissionEnableHash, ...sessionDetails } = - sessionDetailsWithPermissionEnableHash - - sessionDetails.enableSessionData.enableSession.permissionEnableSig = - await account.signer.signMessage({ message: { raw: permissionEnableHash } }) - return { - permissionIds: preparedPermission.permissionIds, - action: preparedPermission.action, - mode: SmartSessionMode.UNSAFE_ENABLE, - sessions: preparedPermission.sessions, - enableSessionData: sessionDetails.enableSessionData + userOpHash, + ...preparedPermission } } diff --git a/src/sdk/modules/smartSessionsValidator/decorators/index.ts b/src/sdk/modules/smartSessionsValidator/decorators/index.ts index 435ce705..85af0838 100644 --- a/src/sdk/modules/smartSessionsValidator/decorators/index.ts +++ b/src/sdk/modules/smartSessionsValidator/decorators/index.ts @@ -1,22 +1,22 @@ import type { Chain, Client, Hash, Transport } from "viem" import type { ModularSmartAccount, Module } from "../../utils/Types" import type { - GrantPermissionInAdvanceResponse, + GrantPermissionResponse, PreparePermissionResponse } from "../Types" import type { SmartSessionModule } from "../toSmartSessionsValidator" +import { + type GrantDeferredPermissionParameters, + grantDeferredPermission +} from "./grantDeferredPermission.ts" import { type GrantPermissionParameters, grantPermission -} from "./grantPermission.js" -import { - type GrantPermissionInAdvanceParameters, - grantPermissionInAdvance -} from "./grantPermissionInAdvance.js" +} from "./grantPermission.ts" import { type PreparePermissionParameters, preparePermission -} from "./preparePermission.js" +} from "./preparePermission" import { type TrustAttestersParameters, trustAttesters } from "./trustAttesters" import { type UsePermissionParameters, usePermission } from "./usePermission" /** @@ -29,27 +29,27 @@ export type SmartSessionCreateActions< > = { /** * Creates multiple sessions for a modular smart account. - * This differs from grantPermissionInAdvance in that it defers the moment that the permission is granted + * This differs from grantPermission in that it defers the moment that the permission is granted * on chain to the moment that the redemption user operation is sent/redeemed. It is also known as "ENABLE_MODE". - * It is the default mode for the grantPermission function. + * It is the default mode for the grantDeferredPermission function. * * @param args - Parameters for creating sessions. * @returns A promise that resolves to the creation response. */ - grantPermission: ( - args: GrantPermissionParameters + grantDeferredPermission: ( + args: GrantDeferredPermissionParameters ) => Promise /** - * Creates multiple sessions for a modular smart account. This differs from grantPermission in that it + * Creates multiple sessions for a modular smart account. This differs from grantDeferredPermission in that it * grants the permission on chain immediately. It is also known as "USE_MODE", and it means that the permission * is granted on chain immediately, and the permission is later redeemed when the user operation is sent. * * @param args - Parameters for creating sessions. * @returns A promise that resolves to the creation response. */ - grantPermissionInAdvance: ( - args: GrantPermissionInAdvanceParameters - ) => Promise + grantPermission: ( + args: GrantPermissionParameters + ) => Promise /** * Trusts attesters for a modular smart account. @@ -101,9 +101,8 @@ export function smartSessionCreateActions(_: Module) { client: Client ): SmartSessionCreateActions => { return { + grantDeferredPermission: (args) => grantDeferredPermission(client, args), grantPermission: (args) => grantPermission(client, args), - grantPermissionInAdvance: (args) => - grantPermissionInAdvance(client, args), trustAttesters: (args) => trustAttesters(client, args), preparePermission: (args) => preparePermission(client, args) } @@ -129,7 +128,7 @@ export function smartSessionUseActions( } } -export * from "./grantPermission" export * from "./trustAttesters" export * from "./usePermission" -export * from "./grantPermissionInAdvance.js" +export * from "./grantDeferredPermission" +export * from "./grantPermission" diff --git a/src/sdk/modules/smartSessionsValidator/decorators/smartSessions.decorators.test.ts b/src/sdk/modules/smartSessionsValidator/decorators/smartSessions.decorators.test.ts index 4f8c2f16..2a075d54 100644 --- a/src/sdk/modules/smartSessionsValidator/decorators/smartSessions.decorators.test.ts +++ b/src/sdk/modules/smartSessionsValidator/decorators/smartSessions.decorators.test.ts @@ -101,9 +101,9 @@ describe("modules.smartSessions.decorators", async () => { ) expect(nexusSessionClient).toBeDefined() - expect(nexusSessionClient.grantPermissionInAdvance).toBeTypeOf("function") + expect(nexusSessionClient.grantPermission).toBeTypeOf("function") expect(nexusSessionClient.trustAttesters).toBeTypeOf("function") - expect(nexusSessionClient.grantPermissionInAdvance).toBeTypeOf("function") + expect(nexusSessionClient.grantPermission).toBeTypeOf("function") }) test("should test use smart session decorators", async () => { diff --git a/src/sdk/modules/smartSessionsValidator/toSmartSessionValidator.enable.mode.test.ts b/src/sdk/modules/smartSessionsValidator/toSmartSessionValidator.enable.mode.test.ts index 442ae2ca..a8341d7e 100644 --- a/src/sdk/modules/smartSessionsValidator/toSmartSessionValidator.enable.mode.test.ts +++ b/src/sdk/modules/smartSessionsValidator/toSmartSessionValidator.enable.mode.test.ts @@ -248,7 +248,7 @@ describe("modules.smartSessions.enable.mode.dx", async () => { smartSessionCreateActions(sessionsModule) ) - const moduleData = await nexusSessionClient.grantPermission({ + const moduleData = await nexusSessionClient.grantDeferredPermission({ sessionRequestedInfo: [ { sessionPublicKey, // Public key of the session diff --git a/src/sdk/modules/smartSessionsValidator/toSmartSessionsValidator.advanced.test.ts b/src/sdk/modules/smartSessionsValidator/toSmartSessionsValidator.advanced.test.ts index 5d2330bb..e1d48c3f 100644 --- a/src/sdk/modules/smartSessionsValidator/toSmartSessionsValidator.advanced.test.ts +++ b/src/sdk/modules/smartSessionsValidator/toSmartSessionsValidator.advanced.test.ts @@ -114,26 +114,25 @@ describe("modules.smartSessions.dx", async () => { // Define the session parameters // This includes the session key, validator, and action policies - const createSessionsResponse = - await nexusSessionClient.grantPermissionInAdvance({ - sessionRequestedInfo: [ - { - sessionPublicKey, // Public key of the session - // sessionValidUntil: number - // sessionValidAfter: number - // chainIds: bigint[] - actionPoliciesInfo: [ - { - abi: CounterAbi, - contractAddress: testAddresses.Counter - // validUntil?: number - // validAfter?: number - // valueLimit?: bigint - } - ] - } - ] - }) + const createSessionsResponse = await nexusSessionClient.grantPermission({ + sessionRequestedInfo: [ + { + sessionPublicKey, // Public key of the session + // sessionValidUntil: number + // sessionValidAfter: number + // chainIds: bigint[] + actionPoliciesInfo: [ + { + abi: CounterAbi, + contractAddress: testAddresses.Counter + // validUntil?: number + // validAfter?: number + // valueLimit?: bigint + } + ] + } + ] + }) // Wait for the session creation transaction to be mined and check its success const { success: sessionCreateSuccess } = diff --git a/src/sdk/modules/smartSessionsValidator/toSmartSessionsValidator.dx.test.ts b/src/sdk/modules/smartSessionsValidator/toSmartSessionsValidator.dx.test.ts index d0e02670..12b9fef7 100644 --- a/src/sdk/modules/smartSessionsValidator/toSmartSessionsValidator.dx.test.ts +++ b/src/sdk/modules/smartSessionsValidator/toSmartSessionsValidator.dx.test.ts @@ -112,7 +112,7 @@ describe("modules.smartSessions.dx", async () => { expect(installSuccess).toBe(true) - const moduleData = await nexusSessionClient.grantPermission({ + const moduleData = await nexusSessionClient.grantDeferredPermission({ sessionRequestedInfo: [ { sessionPublicKey, // Public key of the session diff --git a/src/sdk/modules/smartSessionsValidator/toSmartSessionsValidator.policies.test.ts b/src/sdk/modules/smartSessionsValidator/toSmartSessionsValidator.policies.test.ts index 8d85aa44..031ad57d 100644 --- a/src/sdk/modules/smartSessionsValidator/toSmartSessionsValidator.policies.test.ts +++ b/src/sdk/modules/smartSessionsValidator/toSmartSessionsValidator.policies.test.ts @@ -113,32 +113,31 @@ describe("modules.smartSessions.policies", async () => { // Define the session parameters // This includes the session key, validator, and action policies - const createSessionsResponse = - await nexusSessionClient.grantPermissionInAdvance({ - sessionRequestedInfo: [ - { - sessionPublicKey, // Public key of the session - sessionValidUntil: Date.now() + 1000 * 60 * 60 * 24, // 1 day from now - chainIds: [BigInt(chain.id)], - actionPoliciesInfo: [ - { - contractAddress: testAddresses.Counter, - sudo: false, // covered in another test - tokenLimits: [ - { - token: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", // WETH - limit: BigInt(1000) - } - ], // covered in another test - // usageLimit: 1000n, // TODO: failing because of attestations - // valueLimit: 1000n, // TODO: failing because of attestations - validUntil: Date.now() + 1000 * 60 * 60 * 24, // 1 day from now - functionSelector: "0x871cc9d4" // decrementNumber - } - ] - } - ] - }) + const createSessionsResponse = await nexusSessionClient.grantPermission({ + sessionRequestedInfo: [ + { + sessionPublicKey, // Public key of the session + sessionValidUntil: Date.now() + 1000 * 60 * 60 * 24, // 1 day from now + chainIds: [BigInt(chain.id)], + actionPoliciesInfo: [ + { + contractAddress: testAddresses.Counter, + sudo: false, // covered in another test + tokenLimits: [ + { + token: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", // WETH + limit: BigInt(1000) + } + ], // covered in another test + // usageLimit: 1000n, // TODO: failing because of attestations + // valueLimit: 1000n, // TODO: failing because of attestations + validUntil: Date.now() + 1000 * 60 * 60 * 24, // 1 day from now + functionSelector: "0x871cc9d4" // decrementNumber + } + ] + } + ] + }) // Wait for the session creation transaction to be mined and check its success const { success: sessionCreateSuccess } = diff --git a/src/sdk/modules/smartSessionsValidator/toSmartSessionsValidator.sudo.policy.test.ts b/src/sdk/modules/smartSessionsValidator/toSmartSessionsValidator.sudo.policy.test.ts index 663cf653..c8521ebe 100644 --- a/src/sdk/modules/smartSessionsValidator/toSmartSessionsValidator.sudo.policy.test.ts +++ b/src/sdk/modules/smartSessionsValidator/toSmartSessionsValidator.sudo.policy.test.ts @@ -99,24 +99,23 @@ describe("modules.smartSessions.sudo.policy", async () => { smartSessionCreateActions(sessionsModule) ) - const createSessionsResponse = - await usersNexusClient.grantPermissionInAdvance({ - sessionRequestedInfo: [ - { - sessionPublicKey, - // sessionValidUntil: number - // sessionValidAfter: number - // chainIds: bigint[] - actionPoliciesInfo: [ - { - abi: CounterAbi, - contractAddress: testAddresses.Counter, - sudo: true - } - ] - } - ] - }) + const createSessionsResponse = await usersNexusClient.grantPermission({ + sessionRequestedInfo: [ + { + sessionPublicKey, + // sessionValidUntil: number + // sessionValidAfter: number + // chainIds: bigint[] + actionPoliciesInfo: [ + { + abi: CounterAbi, + contractAddress: testAddresses.Counter, + sudo: true + } + ] + } + ] + }) // Wait for the session creation transaction to be mined and check its success const { success: sessionCreateSuccess } = diff --git a/src/sdk/modules/smartSessionsValidator/toSmartSessionsValidator.test.ts b/src/sdk/modules/smartSessionsValidator/toSmartSessionsValidator.test.ts index 177cd988..a704a745 100644 --- a/src/sdk/modules/smartSessionsValidator/toSmartSessionsValidator.test.ts +++ b/src/sdk/modules/smartSessionsValidator/toSmartSessionsValidator.test.ts @@ -237,10 +237,9 @@ describe("modules.smartSessions", async () => { smartSessionCreateActions(sessionsModule) ) - const createSessionsResponse = - await nexusSessionClient.grantPermissionInAdvance({ - sessionRequestedInfo - }) + const createSessionsResponse = await nexusSessionClient.grantPermission({ + sessionRequestedInfo + }) expect(createSessionsResponse.userOpHash).toBeDefined() expect(createSessionsResponse.permissionIds).toBeDefined() diff --git a/src/sdk/modules/smartSessionsValidator/toSmartSessionsValidator.uni.policy.test.ts b/src/sdk/modules/smartSessionsValidator/toSmartSessionsValidator.uni.policy.test.ts index 52cb6860..1af73590 100644 --- a/src/sdk/modules/smartSessionsValidator/toSmartSessionsValidator.uni.policy.test.ts +++ b/src/sdk/modules/smartSessionsValidator/toSmartSessionsValidator.uni.policy.test.ts @@ -210,7 +210,7 @@ describe("modules.smartSessions.uni.policy", async () => { ] const createSessionsResponse = - await smartSessionNexusClient.grantPermissionInAdvance({ + await smartSessionNexusClient.grantPermission({ sessionRequestedInfo }) @@ -262,11 +262,11 @@ describe("modules.smartSessions.uni.policy", async () => { }) // Note: if you try to add more than maxUintDeposit then you would get this below error. - // Error: https://openchain.xyz/signatures?query=0x3b577361 + // Error: https://openchain.grantPermission/signatures?query=0x3b577361 const balToAddUint = 1234n // Note: if you try to add less than minBytes32Deposit then you would get this below error. - // Error: https://openchain.xyz/signatures?query=0x3b577361 + // Error: https://openchain.grantPermission/signatures?query=0x3b577361 const balToAddBytes32 = `0x${BigInt(1234567) .toString(16) .padStart(64, "0")}` diff --git a/src/test/playground.test.ts b/src/test/playground.test.ts index 1e27ed92..32f93d6a 100644 --- a/src/test/playground.test.ts +++ b/src/test/playground.test.ts @@ -214,10 +214,9 @@ describe.skipIf(!playgroundTrue())("playground", () => { smartSessionCreateActions(sessionsModule) ) - const createSessionsResponse = - await nexusSessionClient.grantPermissionInAdvance({ - sessionRequestedInfo - }) + const createSessionsResponse = await nexusSessionClient.grantPermission({ + sessionRequestedInfo + }) expect(createSessionsResponse.userOpHash).toBeDefined() expect(createSessionsResponse.permissionIds).toBeDefined()