Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Vector outputs in multicalls #1189

Closed
camsjams opened this issue Aug 14, 2023 · 1 comment
Closed

Add support for Vector outputs in multicalls #1189

camsjams opened this issue Aug 14, 2023 · 1 comment

Comments

@camsjams
Copy link
Contributor

Motivation

Similar to a bug in RS-SDK, Multicall support with Vector output needs support

Usage example

it.skip('should handle multiple calls [with vectors]', async () => {
const INPUT_A = [hexlify(randomBytes(32)), hexlify(randomBytes(32)), hexlify(randomBytes(32))];
const INPUT_B = [hexlify(randomBytes(32))];
const INPUT_C = hexlify(randomBytes(32));
const INPUT_D = hexlify(randomBytes(32));
const { value: results } = await contractInstance
.multiCall([
contractInstance.functions.echo_b256_middle(INPUT_A, INPUT_B, INPUT_C, INPUT_D),
contractInstance.functions.echo_u8(13),
contractInstance.functions.echo_u8(23),
contractInstance.functions.echo_enum_small(SmallEnum.Empty),
contractInstance.functions.echo_b256_middle(INPUT_B, INPUT_A, INPUT_C, INPUT_D),
])
.call();
expect(results).toStrictEqual([INPUT_B, 13, 23, SmallEnum.Empty, INPUT_A]);
});
it.skip('should handle multiple calls [with vectors + stack data first]', async () => {
const INPUT_A = [hexlify(randomBytes(32)), hexlify(randomBytes(32)), hexlify(randomBytes(32))];
const INPUT_B = [hexlify(randomBytes(32))];
const INPUT_C = hexlify(randomBytes(32));
const INPUT_D = hexlify(randomBytes(32));
const { value: results } = await contractInstance
.multiCall([
contractInstance.functions.echo_u8(1),
contractInstance.functions.echo_u8(2),
contractInstance.functions.echo_enum_small(SmallEnum.Empty),
contractInstance.functions.echo_b256_middle(INPUT_A, INPUT_B, INPUT_C, INPUT_D),
contractInstance.functions.echo_b256_middle(INPUT_B, INPUT_A, INPUT_C, INPUT_D),
])
.call();
expect(results).toStrictEqual([1, 2, SmallEnum.Empty, INPUT_B, INPUT_A]);
});

Possible implementations

No response

@camsjams
Copy link
Contributor Author

Closed - see #1192

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant