Skip to content

Commit

Permalink
Support calling method multiple times in milticall
Browse files Browse the repository at this point in the history
  • Loading branch information
Lbqds committed Jul 24, 2024
1 parent 34fd181 commit 9d41147
Show file tree
Hide file tree
Showing 24 changed files with 281 additions and 140 deletions.
12 changes: 7 additions & 5 deletions artifacts/ts/Add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -381,14 +381,16 @@ export class AddInstance extends ContractInstance {
},
};

async multicall<Calls extends AddTypes.MultiCallParams>(
calls: Calls
): Promise<AddTypes.MultiCallResults<Calls>> {
async multicall<Callss extends AddTypes.MultiCallParams[]>(
...callss: Callss
): Promise<{
[index in keyof Callss]: AddTypes.MultiCallResults<Callss[index]>;
}> {
return (await multicallMethods(
Add,
this,
calls,
callss,
getContractByCodeHash
)) as AddTypes.MultiCallResults<Calls>;
)) as { [index in keyof Callss]: AddTypes.MultiCallResults<Callss[index]> };
}
}
18 changes: 13 additions & 5 deletions artifacts/ts/DeprecatedNFTTest1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,22 @@ export class DeprecatedNFTTest1Instance extends ContractInstance {
},
};

async multicall<Calls extends DeprecatedNFTTest1Types.MultiCallParams>(
calls: Calls
): Promise<DeprecatedNFTTest1Types.MultiCallResults<Calls>> {
async multicall<Callss extends DeprecatedNFTTest1Types.MultiCallParams[]>(
...callss: Callss
): Promise<{
[index in keyof Callss]: DeprecatedNFTTest1Types.MultiCallResults<
Callss[index]
>;
}> {
return (await multicallMethods(
DeprecatedNFTTest1,
this,
calls,
callss,
getContractByCodeHash
)) as DeprecatedNFTTest1Types.MultiCallResults<Calls>;
)) as {
[index in keyof Callss]: DeprecatedNFTTest1Types.MultiCallResults<
Callss[index]
>;
};
}
}
18 changes: 13 additions & 5 deletions artifacts/ts/DeprecatedNFTTest2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,14 +197,22 @@ export class DeprecatedNFTTest2Instance extends ContractInstance {
},
};

async multicall<Calls extends DeprecatedNFTTest2Types.MultiCallParams>(
calls: Calls
): Promise<DeprecatedNFTTest2Types.MultiCallResults<Calls>> {
async multicall<Callss extends DeprecatedNFTTest2Types.MultiCallParams[]>(
...callss: Callss
): Promise<{
[index in keyof Callss]: DeprecatedNFTTest2Types.MultiCallResults<
Callss[index]
>;
}> {
return (await multicallMethods(
DeprecatedNFTTest2,
this,
calls,
callss,
getContractByCodeHash
)) as DeprecatedNFTTest2Types.MultiCallResults<Calls>;
)) as {
[index in keyof Callss]: DeprecatedNFTTest2Types.MultiCallResults<
Callss[index]
>;
};
}
}
18 changes: 13 additions & 5 deletions artifacts/ts/DeprecatedNFTTest3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,14 +197,22 @@ export class DeprecatedNFTTest3Instance extends ContractInstance {
},
};

async multicall<Calls extends DeprecatedNFTTest3Types.MultiCallParams>(
calls: Calls
): Promise<DeprecatedNFTTest3Types.MultiCallResults<Calls>> {
async multicall<Callss extends DeprecatedNFTTest3Types.MultiCallParams[]>(
...callss: Callss
): Promise<{
[index in keyof Callss]: DeprecatedNFTTest3Types.MultiCallResults<
Callss[index]
>;
}> {
return (await multicallMethods(
DeprecatedNFTTest3,
this,
calls,
callss,
getContractByCodeHash
)) as DeprecatedNFTTest3Types.MultiCallResults<Calls>;
)) as {
[index in keyof Callss]: DeprecatedNFTTest3Types.MultiCallResults<
Callss[index]
>;
};
}
}
18 changes: 13 additions & 5 deletions artifacts/ts/DeprecatedNFTTest4.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,22 @@ export class DeprecatedNFTTest4Instance extends ContractInstance {
},
};

async multicall<Calls extends DeprecatedNFTTest4Types.MultiCallParams>(
calls: Calls
): Promise<DeprecatedNFTTest4Types.MultiCallResults<Calls>> {
async multicall<Callss extends DeprecatedNFTTest4Types.MultiCallParams[]>(
...callss: Callss
): Promise<{
[index in keyof Callss]: DeprecatedNFTTest4Types.MultiCallResults<
Callss[index]
>;
}> {
return (await multicallMethods(
DeprecatedNFTTest4,
this,
calls,
callss,
getContractByCodeHash
)) as DeprecatedNFTTest4Types.MultiCallResults<Calls>;
)) as {
[index in keyof Callss]: DeprecatedNFTTest4Types.MultiCallResults<
Callss[index]
>;
};
}
}
18 changes: 13 additions & 5 deletions artifacts/ts/DeprecatedNFTTest5.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,14 +204,22 @@ export class DeprecatedNFTTest5Instance extends ContractInstance {
},
};

async multicall<Calls extends DeprecatedNFTTest5Types.MultiCallParams>(
calls: Calls
): Promise<DeprecatedNFTTest5Types.MultiCallResults<Calls>> {
async multicall<Callss extends DeprecatedNFTTest5Types.MultiCallParams[]>(
...callss: Callss
): Promise<{
[index in keyof Callss]: DeprecatedNFTTest5Types.MultiCallResults<
Callss[index]
>;
}> {
return (await multicallMethods(
DeprecatedNFTTest5,
this,
calls,
callss,
getContractByCodeHash
)) as DeprecatedNFTTest5Types.MultiCallResults<Calls>;
)) as {
[index in keyof Callss]: DeprecatedNFTTest5Types.MultiCallResults<
Callss[index]
>;
};
}
}
18 changes: 13 additions & 5 deletions artifacts/ts/DeprecatedNFTTest6.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,22 @@ export class DeprecatedNFTTest6Instance extends ContractInstance {
},
};

async multicall<Calls extends DeprecatedNFTTest6Types.MultiCallParams>(
calls: Calls
): Promise<DeprecatedNFTTest6Types.MultiCallResults<Calls>> {
async multicall<Callss extends DeprecatedNFTTest6Types.MultiCallParams[]>(
...callss: Callss
): Promise<{
[index in keyof Callss]: DeprecatedNFTTest6Types.MultiCallResults<
Callss[index]
>;
}> {
return (await multicallMethods(
DeprecatedNFTTest6,
this,
calls,
callss,
getContractByCodeHash
)) as DeprecatedNFTTest6Types.MultiCallResults<Calls>;
)) as {
[index in keyof Callss]: DeprecatedNFTTest6Types.MultiCallResults<
Callss[index]
>;
};
}
}
18 changes: 13 additions & 5 deletions artifacts/ts/DeprecatedNFTTest7.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,14 +204,22 @@ export class DeprecatedNFTTest7Instance extends ContractInstance {
},
};

async multicall<Calls extends DeprecatedNFTTest7Types.MultiCallParams>(
calls: Calls
): Promise<DeprecatedNFTTest7Types.MultiCallResults<Calls>> {
async multicall<Callss extends DeprecatedNFTTest7Types.MultiCallParams[]>(
...callss: Callss
): Promise<{
[index in keyof Callss]: DeprecatedNFTTest7Types.MultiCallResults<
Callss[index]
>;
}> {
return (await multicallMethods(
DeprecatedNFTTest7,
this,
calls,
callss,
getContractByCodeHash
)) as DeprecatedNFTTest7Types.MultiCallResults<Calls>;
)) as {
[index in keyof Callss]: DeprecatedNFTTest7Types.MultiCallResults<
Callss[index]
>;
};
}
}
16 changes: 11 additions & 5 deletions artifacts/ts/FakeTokenTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,14 +285,20 @@ export class FakeTokenTestInstance extends ContractInstance {
},
};

async multicall<Calls extends FakeTokenTestTypes.MultiCallParams>(
calls: Calls
): Promise<FakeTokenTestTypes.MultiCallResults<Calls>> {
async multicall<Callss extends FakeTokenTestTypes.MultiCallParams[]>(
...callss: Callss
): Promise<{
[index in keyof Callss]: FakeTokenTestTypes.MultiCallResults<Callss[index]>;
}> {
return (await multicallMethods(
FakeTokenTest,
this,
calls,
callss,
getContractByCodeHash
)) as FakeTokenTestTypes.MultiCallResults<Calls>;
)) as {
[index in keyof Callss]: FakeTokenTestTypes.MultiCallResults<
Callss[index]
>;
};
}
}
14 changes: 9 additions & 5 deletions artifacts/ts/Greeter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,14 +160,18 @@ export class GreeterInstance extends ContractInstance {
},
};

async multicall<Calls extends GreeterTypes.MultiCallParams>(
calls: Calls
): Promise<GreeterTypes.MultiCallResults<Calls>> {
async multicall<Callss extends GreeterTypes.MultiCallParams[]>(
...callss: Callss
): Promise<{
[index in keyof Callss]: GreeterTypes.MultiCallResults<Callss[index]>;
}> {
return (await multicallMethods(
Greeter,
this,
calls,
callss,
getContractByCodeHash
)) as GreeterTypes.MultiCallResults<Calls>;
)) as {
[index in keyof Callss]: GreeterTypes.MultiCallResults<Callss[index]>;
};
}
}
14 changes: 9 additions & 5 deletions artifacts/ts/MapTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,14 +308,18 @@ export class MapTestInstance extends ContractInstance {
},
};

async multicall<Calls extends MapTestTypes.MultiCallParams>(
calls: Calls
): Promise<MapTestTypes.MultiCallResults<Calls>> {
async multicall<Callss extends MapTestTypes.MultiCallParams[]>(
...callss: Callss
): Promise<{
[index in keyof Callss]: MapTestTypes.MultiCallResults<Callss[index]>;
}> {
return (await multicallMethods(
MapTest,
this,
calls,
callss,
getContractByCodeHash
)) as MapTestTypes.MultiCallResults<Calls>;
)) as {
[index in keyof Callss]: MapTestTypes.MultiCallResults<Callss[index]>;
};
}
}
18 changes: 13 additions & 5 deletions artifacts/ts/NFTCollectionTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,14 +314,22 @@ export class NFTCollectionTestInstance extends ContractInstance {
},
};

async multicall<Calls extends NFTCollectionTestTypes.MultiCallParams>(
calls: Calls
): Promise<NFTCollectionTestTypes.MultiCallResults<Calls>> {
async multicall<Callss extends NFTCollectionTestTypes.MultiCallParams[]>(
...callss: Callss
): Promise<{
[index in keyof Callss]: NFTCollectionTestTypes.MultiCallResults<
Callss[index]
>;
}> {
return (await multicallMethods(
NFTCollectionTest,
this,
calls,
callss,
getContractByCodeHash
)) as NFTCollectionTestTypes.MultiCallResults<Calls>;
)) as {
[index in keyof Callss]: NFTCollectionTestTypes.MultiCallResults<
Callss[index]
>;
};
}
}
18 changes: 13 additions & 5 deletions artifacts/ts/NFTCollectionWithRoyaltyTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -486,15 +486,23 @@ export class NFTCollectionWithRoyaltyTestInstance extends ContractInstance {
};

async multicall<
Calls extends NFTCollectionWithRoyaltyTestTypes.MultiCallParams
Callss extends NFTCollectionWithRoyaltyTestTypes.MultiCallParams[]
>(
calls: Calls
): Promise<NFTCollectionWithRoyaltyTestTypes.MultiCallResults<Calls>> {
...callss: Callss
): Promise<{
[index in keyof Callss]: NFTCollectionWithRoyaltyTestTypes.MultiCallResults<
Callss[index]
>;
}> {
return (await multicallMethods(
NFTCollectionWithRoyaltyTest,
this,
calls,
callss,
getContractByCodeHash
)) as NFTCollectionWithRoyaltyTestTypes.MultiCallResults<Calls>;
)) as {
[index in keyof Callss]: NFTCollectionWithRoyaltyTestTypes.MultiCallResults<
Callss[index]
>;
};
}
}
14 changes: 9 additions & 5 deletions artifacts/ts/NFTTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,14 +191,18 @@ export class NFTTestInstance extends ContractInstance {
},
};

async multicall<Calls extends NFTTestTypes.MultiCallParams>(
calls: Calls
): Promise<NFTTestTypes.MultiCallResults<Calls>> {
async multicall<Callss extends NFTTestTypes.MultiCallParams[]>(
...callss: Callss
): Promise<{
[index in keyof Callss]: NFTTestTypes.MultiCallResults<Callss[index]>;
}> {
return (await multicallMethods(
NFTTest,
this,
calls,
callss,
getContractByCodeHash
)) as NFTTestTypes.MultiCallResults<Calls>;
)) as {
[index in keyof Callss]: NFTTestTypes.MultiCallResults<Callss[index]>;
};
}
}
14 changes: 9 additions & 5 deletions artifacts/ts/NFTTestStd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,14 +228,18 @@ export class NFTTestStdInstance extends ContractInstance {
},
};

async multicall<Calls extends NFTTestStdTypes.MultiCallParams>(
calls: Calls
): Promise<NFTTestStdTypes.MultiCallResults<Calls>> {
async multicall<Callss extends NFTTestStdTypes.MultiCallParams[]>(
...callss: Callss
): Promise<{
[index in keyof Callss]: NFTTestStdTypes.MultiCallResults<Callss[index]>;
}> {
return (await multicallMethods(
NFTTestStd,
this,
calls,
callss,
getContractByCodeHash
)) as NFTTestStdTypes.MultiCallResults<Calls>;
)) as {
[index in keyof Callss]: NFTTestStdTypes.MultiCallResults<Callss[index]>;
};
}
}
Loading

0 comments on commit 9d41147

Please sign in to comment.