fix: simulateTransaction accounts items can be null (#23229)
* fix: simulated accounts can be null * Use Missing rather than token program id Co-authored-by: Arrowana <8245419+Arrowana@users.noreply.github.com>
This commit is contained in:
parent
04d23a1597
commit
ebe3d2d59d
|
@ -469,7 +469,7 @@ export type SimulatedTransactionAccountInfo = {
|
||||||
export type SimulatedTransactionResponse = {
|
export type SimulatedTransactionResponse = {
|
||||||
err: TransactionError | string | null;
|
err: TransactionError | string | null;
|
||||||
logs: Array<string> | null;
|
logs: Array<string> | null;
|
||||||
accounts?: SimulatedTransactionAccountInfo[] | null;
|
accounts?: (SimulatedTransactionAccountInfo | null)[] | null;
|
||||||
unitsConsumed?: number;
|
unitsConsumed?: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -480,6 +480,7 @@ const SimulatedTransactionResponseStruct = jsonRpcResultAndContext(
|
||||||
accounts: optional(
|
accounts: optional(
|
||||||
nullable(
|
nullable(
|
||||||
array(
|
array(
|
||||||
|
nullable(
|
||||||
pick({
|
pick({
|
||||||
executable: boolean(),
|
executable: boolean(),
|
||||||
owner: string(),
|
owner: string(),
|
||||||
|
@ -490,6 +491,7 @@ const SimulatedTransactionResponseStruct = jsonRpcResultAndContext(
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
unitsConsumed: optional(number()),
|
unitsConsumed: optional(number()),
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
|
@ -3044,10 +3044,16 @@ describe('Connection', () => {
|
||||||
const results2 = await connection.simulateTransaction(
|
const results2 = await connection.simulateTransaction(
|
||||||
message,
|
message,
|
||||||
[account1],
|
[account1],
|
||||||
[account1.publicKey],
|
[
|
||||||
|
account1.publicKey,
|
||||||
|
new PublicKey('Missing111111111111111111111111111111111111'),
|
||||||
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(results2.value.accounts).lengthOf(1);
|
expect(results2.value.accounts).lengthOf(2);
|
||||||
|
if (results2.value.accounts) {
|
||||||
|
expect(results2.value.accounts[1]).to.be.null;
|
||||||
|
}
|
||||||
}).timeout(10000);
|
}).timeout(10000);
|
||||||
|
|
||||||
it('transaction', async () => {
|
it('transaction', async () => {
|
||||||
|
|
Loading…
Reference in New Issue