@lit-protocol/e2e
Version:
Lit Protocol E2E testing package for running comprehensive integration tests
32 lines (30 loc) • 1.08 kB
JavaScript
export const createExecuteJsTest = (ctx, getAuthContext, pubkey) => {
return async () => {
const litActionCode = `
(async () => {
const { sigName, toSign, publicKey } = jsParams;
const { keccak256, arrayify } = ethers.utils;
const toSignBytes = new TextEncoder().encode(toSign);
const toSignBytes32 = keccak256(toSignBytes);
const toSignBytes32Array = arrayify(toSignBytes32);
const sigShare = await Lit.Actions.signEcdsa({
toSign: toSignBytes32Array,
publicKey,
sigName,
});
})();`;
const result = await ctx.litClient.executeJs({
code: litActionCode,
authContext: getAuthContext(),
jsParams: {
message: 'Test message from e2e executeJs',
sigName: 'e2e-test-sig',
toSign: 'Test message from e2e executeJs',
publicKey: pubkey || ctx.aliceViemAccountPkp.pubkey,
},
});
expect(result).toBeDefined();
expect(result.signatures).toBeDefined();
};
};
//# sourceMappingURL=execute-js.js.map