Skip to content

Commit

Permalink
feat: add getParsedConfirmedTransaction API
Browse files Browse the repository at this point in the history
  • Loading branch information
jstarry committed Aug 6, 2020
1 parent 5a63c9d commit b36e607
Show file tree
Hide file tree
Showing 7 changed files with 412 additions and 131 deletions.
36 changes: 36 additions & 0 deletions web3.js/module.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,39 @@ declare module '@solana/web3.js' {
meta: ConfirmedTransactionMeta | null;
};

export type ParsedMessageAccount = {
pubkey: PublicKey;
signer: boolean;
writable: boolean;
};

export type ParsedInstruction = {
programId: PublicKey;
program: string;
parsed: string;
};

export type PartiallyDecodedInstruction = {
programId: PublicKey;
accounts: Array<PublicKey>;
data: string;
};

export type ParsedTransaction = {
signatures: Array<string>;
message: {
accountKeys: ParsedMessageAccount[];
instructions: (ParsedInstruction | PartiallyDecodedInstruction)[];
recentBlockhash: string;
};
};

export type ParsedConfirmedTransaction = {
slot: number;
transaction: ParsedTransaction;
meta: ConfirmedTransactionMeta | null;
};

export type KeyedAccountInfo = {
accountId: PublicKey;
accountInfo: AccountInfo;
Expand Down Expand Up @@ -288,6 +321,9 @@ declare module '@solana/web3.js' {
getConfirmedTransaction(
signature: TransactionSignature,
): Promise<ConfirmedTransaction | null>;
getParsedConfirmedTransaction(
signature: TransactionSignature,
): Promise<ParsedConfirmedTransaction | null>;
getConfirmedSignaturesForAddress(
address: PublicKey,
startSlot: number,
Expand Down
36 changes: 36 additions & 0 deletions web3.js/module.flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,39 @@ declare module '@solana/web3.js' {
meta: ConfirmedTransactionMeta | null,
};

declare export type ParsedMessageAccount = {
pubkey: PublicKey,
signer: boolean,
writable: boolean,
};

declare export type ParsedInstruction = {|
programId: PublicKey,
program: string,
parsed: string,
|};

declare export type PartiallyDecodedInstruction = {|
programId: PublicKey,
accounts: Array<PublicKey>,
data: string,
|};

declare export type ParsedTransaction = {
signatures: Array<string>,
message: {
accountKeys: ParsedMessageAccount[],
instructions: (ParsedInstruction | PartiallyDecodedInstruction)[],
recentBlockhash: string,
},
};

declare export type ParsedConfirmedTransaction = {
slot: number,
transaction: ParsedTransaction,
meta: ConfirmedTransactionMeta | null,
};

declare export type KeyedAccountInfo = {
accountId: PublicKey,
accountInfo: AccountInfo,
Expand Down Expand Up @@ -309,6 +342,9 @@ declare module '@solana/web3.js' {
getConfirmedTransaction(
signature: TransactionSignature,
): Promise<ConfirmedTransaction | null>;
getParsedConfirmedTransaction(
signature: TransactionSignature,
): Promise<ParsedConfirmedTransaction | null>;
getConfirmedSignaturesForAddress(
address: PublicKey,
startSlot: number,
Expand Down
37 changes: 7 additions & 30 deletions web3.js/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 web3.js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
"@babel/preset-flow": "^7.0.0",
"@commitlint/config-conventional": "^9.0.1",
"@commitlint/travis-cli": "^9.0.1",
"@solana/spl-token": "^0.0.4",
"@solana/spl-token": "^0.0.5",
"@typescript-eslint/eslint-plugin": "^2.18.0",
"@typescript-eslint/parser": "^2.18.0",
"acorn": "^7.0.0",
Expand Down
Loading

0 comments on commit b36e607

Please sign in to comment.