feat: add dataSlice param to account fetching config (#28389)

This commit is contained in:
Justin Starry 2022-10-14 11:28:00 +08:00 committed by GitHub
parent f627b7d826
commit 36e5f33e67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -470,6 +470,8 @@ export type GetAccountInfoConfig = {
commitment?: Commitment;
/** The minimum slot that the request can be evaluated at */
minContextSlot?: number;
/** Optional data slice to limit the returned account data */
dataSlice?: DataSlice;
};
/**
@ -2396,6 +2398,8 @@ export type GetMultipleAccountsConfig = {
commitment?: Commitment;
/** The minimum slot that the request can be evaluated at */
minContextSlot?: number;
/** Optional data slice to limit the returned account data */
dataSlice?: DataSlice;
};
/**

View File

@ -4505,8 +4505,9 @@ describe('Connection', function () {
const transferToKey = lookupTableAddresses[0];
const transferToAccount = await connection.getAccountInfo(
transferToKey,
'confirmed',
{commitment: 'confirmed', dataSlice: {length: 0, offset: 0}},
);
expect(transferToAccount?.data.length).to.be.eq(0);
expect(transferToAccount?.lamports).to.be.eq(LAMPORTS_PER_SOL);
});