feat: add source field to parsed account key responses (#27702)
This commit is contained in:
parent
fc396f965c
commit
e42a39024d
|
@ -1029,6 +1029,8 @@ export type ParsedMessageAccount = {
|
|||
signer: boolean;
|
||||
/** Indicates if the account is writable for this transaction */
|
||||
writable: boolean;
|
||||
/** Indicates if the account key came from the transaction or a lookup table */
|
||||
source?: 'transaction' | 'lookupTable';
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -1966,6 +1968,9 @@ const ParsedConfirmedTransactionResult = pick({
|
|||
pubkey: PublicKeyFromString,
|
||||
signer: boolean(),
|
||||
writable: boolean(),
|
||||
source: optional(
|
||||
union([literal('transaction'), literal('lookupTable')]),
|
||||
),
|
||||
}),
|
||||
),
|
||||
instructions: array(ParsedOrRawInstruction),
|
||||
|
|
|
@ -4564,15 +4564,33 @@ describe('Connection', function () {
|
|||
);
|
||||
expect(parsedTransaction).to.not.be.null;
|
||||
expect(parsedTransaction?.version).to.eq(0);
|
||||
expect(parsedTransaction?.meta?.loadedAddresses).to.eql({
|
||||
readonly: [],
|
||||
writable: [lookupTableAddresses[0]],
|
||||
});
|
||||
// loaded addresses are not returned for parsed transactions
|
||||
expect(parsedTransaction?.meta?.loadedAddresses).to.be.undefined;
|
||||
expect(parsedTransaction?.meta?.computeUnitsConsumed).to.not.be
|
||||
.undefined;
|
||||
expect(
|
||||
parsedTransaction?.transaction.message.addressTableLookups,
|
||||
).to.eql(addressTableLookups);
|
||||
expect(parsedTransaction?.transaction.message.accountKeys).to.eql([
|
||||
{
|
||||
pubkey: payer.publicKey,
|
||||
signer: true,
|
||||
writable: true,
|
||||
source: 'transaction',
|
||||
},
|
||||
{
|
||||
pubkey: SystemProgram.programId,
|
||||
signer: false,
|
||||
writable: false,
|
||||
source: 'transaction',
|
||||
},
|
||||
{
|
||||
pubkey: lookupTableAddresses[0],
|
||||
signer: false,
|
||||
writable: true,
|
||||
source: 'lookupTable',
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
it('getBlock (failure)', async () => {
|
||||
|
|
Loading…
Reference in New Issue