Skip to content

Commit

Permalink
fix: fix build errors
Browse files Browse the repository at this point in the history
  • Loading branch information
VGabriel45 committed Sep 23, 2024
1 parent 4e08712 commit 5c72935
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 18 deletions.
4 changes: 2 additions & 2 deletions src/sdk/clients/decorators/erc7579/getPreviousModule.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Address, type Client, type Hex } from "viem"
import { type Address, type Client, type Hex } from "viem"
import { type GetSmartAccountParameter, type SmartAccount } from "viem/account-abstraction"
import { getAddress } from "viem/utils"
import { AccountNotFoundError } from "../../../account/utils/AccountNotFound"
import { ModuleType } from "@rhinestone/module-sdk"
import { type ModuleType } from "@rhinestone/module-sdk"

const SENTINEL_ADDRESS = '0x0000000000000000000000000000000000000001' as const

Expand Down
4 changes: 2 additions & 2 deletions src/sdk/clients/decorators/erc7579/installModule.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type Client, type Hex, encodeFunctionData, getAddress } from "viem"
import { type Chain, type Client, type Hex, type Transport, encodeFunctionData, getAddress } from "viem"
import {
type GetSmartAccountParameter,
type SmartAccount,
Expand Down Expand Up @@ -41,7 +41,7 @@ export type InstallModuleParameters<
export async function installModule<
TSmartAccount extends SmartAccount | undefined
>(
client: Client,
client: Client<Transport, Chain | undefined, TSmartAccount>,
parameters: InstallModuleParameters<TSmartAccount>
): Promise<Hex> {
const {
Expand Down
23 changes: 11 additions & 12 deletions src/sdk/modules/validators/OwnableValidator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ import {
parseAbi,
parseAbiParameters
} from "viem"
import type { Hex } from "viem"
import { NexusAccount, Signer, toSigner } from "../../account/index.js"
import type { Hex, PublicClient } from "viem"
import { type NexusAccount, type Signer, toSigner } from "../../account/index.js"
import { BaseValidationModule } from "../base/BaseValidationModule.js"
import { Module } from "../../clients/index.js"
import { MasterClient } from "../../../test/testUtils.js"
import { type Module } from "../../clients/index.js"

export class OwnableValidator extends BaseValidationModule {
public owners: Address[]
Expand Down Expand Up @@ -49,8 +48,8 @@ export class OwnableValidator extends BaseValidationModule {
}): Promise<OwnableValidator> {
let moduleInfo: Module
let installData: Hex
const masterClient = smartAccount.client as MasterClient;
const isInitialized = await masterClient.readContract({
const client = smartAccount.client as PublicClient;
const isInitialized = await client.readContract({
address, // @todo: change to real module address
abi: parseAbi([
"function isInitialized(address smartAccount) public view returns (bool)"
Expand All @@ -59,15 +58,15 @@ export class OwnableValidator extends BaseValidationModule {
args: [await smartAccount.getAddress()]
})
if (isInitialized) {
const _owners = await masterClient.readContract({
const _owners = await client.readContract({
address, // @todo: change to real module address
abi: parseAbi([
"function getOwners(address account) external view returns (address[])"
]),
functionName: "getOwners",
args: [await smartAccount.getAddress()]
})
const _threshold = await masterClient.readContract({
const _threshold = await client.readContract({
address, // @todo: change to real module address
abi: parseAbi([
"function threshold(address account) external view returns (uint256)"
Expand Down Expand Up @@ -184,8 +183,8 @@ export class OwnableValidator extends BaseValidationModule {

// public async getOwners(): Promise<Address[]> {
// try {
// const masterClient = this.smartAccount.client as MasterClient;
// const owners = (await masterClient.readContract({
// const client = this.smartAccount.client as MasterClient;
// const owners = (await client.readContract({
// address: this.address,
// abi: parseAbi([
// "function getOwners(address account) external view returns (address[])"
Expand Down Expand Up @@ -229,8 +228,8 @@ export class OwnableValidator extends BaseValidationModule {
}

// public async isModuleInitialized(): Promise<boolean> {
// const masterClient = this.smartAccount.client as MasterClient;
// const isInitialized = await masterClient.readContract({
// const client = this.smartAccount.client as MasterClient;
// const isInitialized = await client.readContract({
// address: this.address,
// abi: parseAbi([
// "function isInitialized(address account) external view returns (bool)"
Expand Down
3 changes: 1 addition & 2 deletions src/test/callDatas.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { Hex } from "viem"
import type { DeployerParams } from "./testUtils"

export const TEST_CONTRACTS: Record<string, DeployerParams> = {
export const TEST_CONTRACTS: Record<string, { chainId: number; name: string; address: Hex }> = {
// Rhinestone Ownables
OwnableValidator: {
chainId: 84532,
Expand Down

0 comments on commit 5c72935

Please sign in to comment.