Skip to content

Commit 24bded1

Browse files
authored
chore: smart sessions update ++ (#167)
1 parent 9714916 commit 24bded1

24 files changed

+1381
-474
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# @biconomy/sdk
22

3+
## 0.0.25
4+
5+
### Patch Changes
6+
7+
- Upgrade smart session and rhinestone sdk version
8+
39
## 0.0.24
410

511
### Patch Changes

bun.lockb

62 Bytes
Binary file not shown.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@biconomy/sdk",
3-
"version": "0.0.24",
3+
"version": "0.0.25",
44
"author": "Biconomy",
55
"repository": "github:bcnmy/sdk",
66
"main": "./dist/_cjs/index.js",
@@ -38,12 +38,12 @@
3838
"viem": "2.21.6",
3939
"vitest": "^1.3.1",
4040
"yargs": "^17.7.2",
41-
"@rhinestone/module-sdk": "0.1.28"
41+
"@rhinestone/module-sdk": ">=0.1.0 <=0.2.3"
4242
},
4343
"peerDependencies": {
4444
"typescript": "^5",
4545
"viem": "^2.20.0",
46-
"@rhinestone/module-sdk": "0.1.28"
46+
"@rhinestone/module-sdk": ">=0.1.0 <=0.2.3"
4747
},
4848
"exports": {
4949
".": {

src/sdk/account/toNexusAccount.addresses.test.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ describe("nexus.account.addresses", async () => {
7878
const counterfactualAddressFromHelper = await getCounterFactualAddress(
7979
testClient as unknown as PublicClient,
8080
eoaAccount.address,
81-
true,
8281
0n,
8382
[RHINESTONE_ATTESTER_ADDRESS],
8483
1,
@@ -96,7 +95,6 @@ describe("nexus.account.addresses", async () => {
9695
const counterfactualAddressFromHelper = await getCounterFactualAddress(
9796
testClient as unknown as PublicClient,
9897
eoaAccount.address,
99-
true,
10098
0n,
10199
[RHINESTONE_ATTESTER_ADDRESS],
102100
1,
@@ -146,6 +144,6 @@ describe("nexus.account.addresses", async () => {
146144
const testnetAddress = await testnetClient.account.getAddress()
147145
const mainnetAddress = await mainnetClient.account.getAddress()
148146

149-
expect(testnetAddress).not.toBe(mainnetAddress)
147+
expect(testnetAddress).toBe(mainnetAddress)
150148
})
151149
})

src/sdk/account/toNexusAccount.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ import {
4848
ENTRY_POINT_ADDRESS,
4949
MAINNET_ADDRESS_K1_VALIDATOR_ADDRESS,
5050
MAINNET_ADDRESS_K1_VALIDATOR_FACTORY_ADDRESS,
51-
MOCK_ATTESTER_ADDRESS,
5251
RHINESTONE_ATTESTER_ADDRESS
5352
} from "../constants"
5453
// Constants
@@ -216,7 +215,6 @@ export const toNexusAccount = async (
216215

217216
// Review:
218217
// Todo: attesters can be added here to do one time setup upon deployment.
219-
chain?.testnet && attesters_.push(MOCK_ATTESTER_ADDRESS)
220218
const factoryData = encodeFunctionData({
221219
abi: parseAbi([
222220
"function createAccount(address eoaOwner, uint256 index, address[] attesters, uint8 threshold) external returns (address)"
@@ -255,7 +253,6 @@ export const toNexusAccount = async (
255253
const addressFromFactory = await getCounterFactualAddress_(
256254
publicClient,
257255
signerAddress,
258-
false,
259256
index,
260257
attesters_,
261258
attesterThreshold,

src/sdk/account/utils/getCounterFactualAddress.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import type { Address } from "viem"
22
import type { PublicClient } from "viem"
33
import {
44
MAINNET_ADDRESS_K1_VALIDATOR_FACTORY_ADDRESS,
5-
MOCK_ATTESTER_ADDRESS,
65
RHINESTONE_ATTESTER_ADDRESS
76
} from "../../constants"
87

@@ -26,16 +25,11 @@ import {
2625
export const getCounterFactualAddress = async (
2726
publicClient: PublicClient,
2827
signerAddress: Address,
29-
isTestnet = false,
3028
index = 0n,
3129
attesters = [RHINESTONE_ATTESTER_ADDRESS],
3230
threshold = 1,
3331
factoryAddress = MAINNET_ADDRESS_K1_VALIDATOR_FACTORY_ADDRESS
3432
) => {
35-
if (isTestnet) {
36-
attesters.push(MOCK_ATTESTER_ADDRESS)
37-
}
38-
3933
return await publicClient.readContract({
4034
address: factoryAddress,
4135
abi: [

src/sdk/clients/createBicoPaymasterClient.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ describe("bico.paymaster", async () => {
145145
bundlerTransport: http(bundlerUrl)
146146
})
147147

148+
console.log(nexusClient.account.address, "nexusClient.account.address")
149+
148150
const initialBalance = await publicClient.getBalance({
149151
address: nexusAccountAddress
150152
})
@@ -160,6 +162,7 @@ describe("bico.paymaster", async () => {
160162
feeTokenAddress: baseSepoliaUSDCAddress
161163
})
162164
const receipt = await nexusClient.waitForUserOperationReceipt({ hash })
165+
163166
expect(receipt.success).toBe("true")
164167

165168
// Get final balance

src/sdk/clients/createNexusSessionClient.test.ts

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { isSessionEnabled } from "@rhinestone/module-sdk"
12
import { http, type Address, type Chain, type Hex } from "viem"
23
import type { LocalAccount, PublicClient } from "viem"
34
import { encodeFunctionData } from "viem"
@@ -13,11 +14,7 @@ import {
1314
} from "../../test/testUtils"
1415
import type { MasterClient, NetworkConfig } from "../../test/testUtils"
1516
import { SMART_SESSIONS_ADDRESS, SmartSessionMode } from "../constants"
16-
import {
17-
isPermissionEnabled,
18-
parse,
19-
stringify
20-
} from "../modules/smartSessionsValidator/Helpers"
17+
import { parse, stringify } from "../modules/smartSessionsValidator/Helpers"
2118
import type {
2219
CreateSessionDataParams,
2320
SessionData
@@ -121,7 +118,8 @@ describe("nexus.session.client", async () => {
121118
actionPoliciesInfo: [
122119
{
123120
contractAddress: testAddresses.Counter, // counter address
124-
functionSelector: "0x273ea3e3" as Hex // function selector for increment count
121+
functionSelector: "0x273ea3e3" as Hex, // function selector for increment count,
122+
sudo: true
125123
}
126124
]
127125
}
@@ -157,9 +155,13 @@ describe("nexus.session.client", async () => {
157155

158156
expect(receipt.success).toBe(true)
159157

160-
const isEnabled = await isPermissionEnabled({
158+
const isEnabled = await isSessionEnabled({
161159
client: nexusClient.account.client as PublicClient,
162-
accountAddress: nexusClient.account.address,
160+
account: {
161+
type: "nexus",
162+
address: nexusClient.account.address,
163+
deployedOnChains: [chain.id]
164+
},
163165
permissionId: createSessionsResponse.permissionIds[0]
164166
})
165167
expect(isEnabled).toBe(true)
@@ -243,9 +245,13 @@ describe("nexus.session.client", async () => {
243245
smartSessionUseActions(usePermissionsModule)
244246
)
245247

246-
const isEnabled = await isPermissionEnabled({
248+
const isEnabled = await isSessionEnabled({
247249
client: testClient as unknown as PublicClient,
248-
accountAddress: nexusClient.account.address,
250+
account: {
251+
type: "nexus",
252+
address: nexusClient.account.address,
253+
deployedOnChains: [chain.id]
254+
},
249255
permissionId: sessionData.moduleData.permissionIds[0]
250256
})
251257
expect(isEnabled).toBe(true)

0 commit comments

Comments
 (0)