Skip to content

Commit

Permalink
fix(payloads): fix payload format for relay-signer (#604)
Browse files Browse the repository at this point in the history
* fix(payloads): fix payload format

* test(relay-signer): fix tests
  • Loading branch information
shahnami authored Oct 29, 2024
1 parent 82d3b74 commit 719ab30
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions packages/relay-signer/src/action/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ describe('ActionRelayer', () => {
expect(relayer.lambda.invoke).toHaveBeenCalledWith({
FunctionName: 'arn',
InvocationType: 'RequestResponse',
Payload: '{"action":"replace-tx","payload":{"to":"0x0","gasLimit":21000}}',
Payload: '{"action":"replace-tx","payload":{"to":"0x0","gasLimit":21000,"nonce":10}}',
});
});

Expand All @@ -97,7 +97,7 @@ describe('ActionRelayer', () => {
expect(relayer.lambda.invoke).toHaveBeenCalledWith({
FunctionName: 'arn',
InvocationType: 'RequestResponse',
Payload: '{"action":"replace-tx","txPayload":{"to":"0x0","gasLimit":21000,"id":"123-456-abc"}}',
Payload: '{"action":"replace-tx","payload":{"to":"0x0","gasLimit":21000,"id":"123-456-abc"}}',
});
});
});
Expand All @@ -108,7 +108,7 @@ describe('ActionRelayer', () => {
expect(relayer.lambda.invoke).toHaveBeenCalledWith({
FunctionName: 'arn',
InvocationType: 'RequestResponse',
Payload: '{"action":"cancel-tx","id":"123-456-abc"}',
Payload: '{"action":"cancel-tx","payload":"123-456-abc"}',
});
});
});
Expand Down
7 changes: 4 additions & 3 deletions packages/relay-signer/src/action/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,20 @@ export class ActionRelayer extends BaseActionClient implements IRelayer {

public async replaceTransactionById(id: string, payload: RelayerTransactionPayload): Promise<RelayerTransaction> {
const txPayload: RelayerTransactionPayload & { id: string } = { ...payload, id };
return this.execute({ action: 'replace-tx', txPayload });
return this.execute({ action: 'replace-tx', payload: txPayload });
}

public async replaceTransactionByNonce(
nonce: number,
payload: RelayerTransactionPayload,
): Promise<RelayerTransaction> {
const txPayload: RelayerTransactionPayload & { nonce: number } = { ...payload, nonce };
return this.execute({ action: 'replace-tx', payload });
return this.execute({ action: 'replace-tx', payload: txPayload });
}

public async cancelTransactionById(id: string): Promise<TransactionDeleteResponse> {
return this.execute({ action: 'cancel-tx', id });
const payload = id;
return this.execute({ action: 'cancel-tx', payload });
}

public async getRelayer(): Promise<RelayerGetResponse> {
Expand Down

0 comments on commit 719ab30

Please sign in to comment.