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;
|
signer: boolean;
|
||||||
/** Indicates if the account is writable for this transaction */
|
/** Indicates if the account is writable for this transaction */
|
||||||
writable: boolean;
|
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,
|
pubkey: PublicKeyFromString,
|
||||||
signer: boolean(),
|
signer: boolean(),
|
||||||
writable: boolean(),
|
writable: boolean(),
|
||||||
|
source: optional(
|
||||||
|
union([literal('transaction'), literal('lookupTable')]),
|
||||||
|
),
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
instructions: array(ParsedOrRawInstruction),
|
instructions: array(ParsedOrRawInstruction),
|
||||||
|
|
|
@ -4564,15 +4564,33 @@ describe('Connection', function () {
|
||||||
);
|
);
|
||||||
expect(parsedTransaction).to.not.be.null;
|
expect(parsedTransaction).to.not.be.null;
|
||||||
expect(parsedTransaction?.version).to.eq(0);
|
expect(parsedTransaction?.version).to.eq(0);
|
||||||
expect(parsedTransaction?.meta?.loadedAddresses).to.eql({
|
// loaded addresses are not returned for parsed transactions
|
||||||
readonly: [],
|
expect(parsedTransaction?.meta?.loadedAddresses).to.be.undefined;
|
||||||
writable: [lookupTableAddresses[0]],
|
|
||||||
});
|
|
||||||
expect(parsedTransaction?.meta?.computeUnitsConsumed).to.not.be
|
expect(parsedTransaction?.meta?.computeUnitsConsumed).to.not.be
|
||||||
.undefined;
|
.undefined;
|
||||||
expect(
|
expect(
|
||||||
parsedTransaction?.transaction.message.addressTableLookups,
|
parsedTransaction?.transaction.message.addressTableLookups,
|
||||||
).to.eql(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 () => {
|
it('getBlock (failure)', async () => {
|
||||||
|
|
Loading…
Reference in New Issue