Skip to content

Commit 5ef9e48

Browse files
authored
Merge pull request #51 from privacy-scaling-explorations/fix/factory-arg-type
2 parents 6830cd4 + 2507ed7 commit 5ef9e48

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

packages/contracts/test/sdk/deploy.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ describe("deploy", () => {
1717
queryFilter: () => Promise.resolve([{ args: [ZeroAddress] }]),
1818
filters: { CloneDeployed: "CloneDeployed" },
1919
deploy: () => Promise.resolve({ wait: () => Promise.resolve(receipt) })
20-
} as unknown as IFactoryLike<unknown[]>,
20+
} as unknown as IFactoryLike,
2121
signer: {} as Signer,
2222
args: []
2323
}

packages/contracts/ts/deploy.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ export const getProxyContract = async <T = BaseContract>({
3030
* @param args deploy proxy clone arguments
3131
* @returns clone contract
3232
*/
33-
export const deployProxyClone = async <C = BaseContract, T = unknown[]>({
33+
export const deployProxyClone = async <C = BaseContract, T extends unknown[] = []>({
3434
factory,
3535
proxyFactory,
3636
signer,
3737
args
3838
}: IDeployCloneArgs<T>): Promise<C> => {
39-
const receipt = await proxyFactory.deploy(args).then((tx) => tx.wait())
39+
const receipt = await proxyFactory.deploy(...args).then((tx) => tx.wait())
4040

4141
return getProxyContract<C>({
4242
factory,

packages/contracts/ts/types.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ import type { TypedContractMethod } from "../typechain-types/common"
55
/**
66
* Type for the factory like contract
77
*/
8-
export type IFactoryLike<P extends unknown[] = []> = Factory &
8+
export type IFactoryLike = Factory &
99
BaseContract & {
10-
deploy: TypedContractMethod<P, [], "nonpayable">
10+
deploy: TypedContractMethod<unknown[], unknown, "nonpayable">
1111
}
1212

1313
/**
1414
* Interface that represents deploy clone arguments
1515
*/
16-
export interface IDeployCloneArgs<T = unknown[]> {
16+
export interface IDeployCloneArgs<T extends unknown[] = unknown[]> {
1717
/**
1818
* Arguments for clone initialization
1919
*/
@@ -27,7 +27,7 @@ export interface IDeployCloneArgs<T = unknown[]> {
2727
/**
2828
* Proxy contract factory
2929
*/
30-
proxyFactory: IFactoryLike<T[]>
30+
proxyFactory: IFactoryLike
3131

3232
/**
3333
* Ethereum signer

0 commit comments

Comments
 (0)