Skip to content

Commit

Permalink
sdk: add decodeTransactionEvents
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Richardson <[email protected]>
  • Loading branch information
awrichar committed Dec 14, 2024
1 parent a0e5168 commit 26d5e30
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 4 deletions.
2 changes: 1 addition & 1 deletion example/bond/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion example/zeto/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion sdk/typescript/src/interfaces/domains/pente.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ export interface IGroupInfo {

export interface IGroupInfoUnresolved {
salt: string;
members: PaladinVerifier[];
members: (string | PaladinVerifier)[];
}
11 changes: 11 additions & 0 deletions sdk/typescript/src/interfaces/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,14 @@ export interface IDecodedEvent {
data: any;
summary: string; // errors only
}

export interface IEventWithData {
blockNumber: number;
transactionIndex: number;
logIndex: number;
transactionHash: string;
signature: string;
soliditySignature: string;
address: string;
data: string;
}
15 changes: 14 additions & 1 deletion sdk/typescript/src/paladin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ import {
ITransactionReceipt,
ITransactionStates,
IDecodedEvent,
IEventWithData,
} from "./interfaces/transaction";
import { Algorithms, Verifiers } from "./interfaces";
import { ethers } from "ethers";
import { ethers, InterfaceAbi } from "ethers";
import { PaladinVerifier } from "./verifier";

const POLL_INTERVAL_MS = 100;
Expand Down Expand Up @@ -216,4 +217,16 @@ export default class PaladinClient {
throw err;
}
}

async decodeTransactionEvents(
transactionHash: string,
abi: InterfaceAbi,
resultFormat: string
) {
const res = await this.post<JsonRpcResult<IEventWithData[]>>(
"bidx_decodeTransactionEvents",
[transactionHash, abi, resultFormat]
);
return res.data;
}
}

0 comments on commit 26d5e30

Please sign in to comment.