Skip to content

Commit

Permalink
chore: test e2e
Browse files Browse the repository at this point in the history
  • Loading branch information
npty committed Dec 7, 2023
1 parent 163225a commit d90cd8c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 12 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,4 @@ jobs:
# nohup sh -c "sui-test-validator" > nohup.out 2> nohup.err < /dev/null &
nohup sh -c "aptos node run-local-testnet --with-faucet" > nohup.out 2> nohup.err < /dev/null &
sleep 10
npm run test:cosmos
npm run test-e2e:cosmos
npm run test:e2e
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,19 @@ export class AxelarRelayerService extends Relayer {
async listenForEvents() {
if (this.listened) return;

this.axelarListener.listen(AxelarCosmosContractCallEvent, async (args) => {
this.updateCallContractEvents(args);
this.execute(this.commands);
});
this.axelarListener.listen(
AxelarCosmosContractCallEvent,
this.handleContractCallEvent.bind(this)
);

this.listened = true;
}

private async handleContractCallEvent(args: any) {
this.updateCallContractEvents(args);
await this.execute(this.commands);
}

async stopListening() {
await this.axelarListener.stop();

Expand Down Expand Up @@ -151,11 +156,15 @@ export class AxelarRelayerService extends Relayer {
);
}

private async executeEvmGateway(
to: Network,
commands: Command[]
): Promise<void> {
const data = arrayify(
private async executeEvmGateway(to: Network, commands: Command[]) {
const data = this.encodeGatewayData(to, commands);
const signedData = await getSignedExecuteInput(data, to.operatorWallet);

return this.sendExecuteTransaction(to, signedData);
}

private encodeGatewayData(to: Network, commands: Command[]) {
return arrayify(
defaultAbiCoder.encode(
["uint256", "bytes32[]", "string[]", "bytes[]"],
[
Expand All @@ -166,8 +175,9 @@ export class AxelarRelayerService extends Relayer {
]
)
);
const signedData = await getSignedExecuteInput(data, to.operatorWallet);
}

private async sendExecuteTransaction(to: Network, signedData: any) {
return to.gateway
.connect(to.ownerWallet)
.execute(signedData, { gasLimit: BigInt(8e6) })
Expand Down

0 comments on commit d90cd8c

Please sign in to comment.