-
Notifications
You must be signed in to change notification settings - Fork 915
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix return type of getTokenAccountsByDelegate/Owner (#2027)
- Loading branch information
1 parent
acab173
commit 23420ec
Showing
3 changed files
with
40 additions
and
4 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
packages/rpc-core/src/rpc-methods/__typetests__/rpc-methods-test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { Address } from '@solana/addresses'; | ||
import { Rpc } from '@solana/rpc-transport'; | ||
|
||
import { SolanaRpcMethods } from '..'; | ||
|
||
const rpc = {} as unknown as Rpc<SolanaRpcMethods>; | ||
|
||
// getTokenAccountsByDelegate | ||
async () => { | ||
const tokenAccountsByDelegate = await rpc | ||
.getTokenAccountsByDelegate( | ||
'delegate' as Address, | ||
{ programId: 'program' as Address }, | ||
{ encoding: 'jsonParsed' }, | ||
) | ||
.send(); | ||
|
||
const firstAccount = tokenAccountsByDelegate.value[0]; | ||
firstAccount.pubkey satisfies Address; | ||
firstAccount.account.data.program satisfies Address; | ||
firstAccount.account.data.parsed.type satisfies 'account'; | ||
firstAccount.account.data.parsed.info.mint satisfies Address; | ||
}; | ||
|
||
// getTokenAccountsByOwner | ||
async () => { | ||
const tokenAccountsByOwner = await rpc | ||
.getTokenAccountsByOwner('owner' as Address, { programId: 'program' as Address }, { encoding: 'jsonParsed' }) | ||
.send(); | ||
|
||
const firstAccount = tokenAccountsByOwner.value[0]; | ||
firstAccount.pubkey satisfies Address; | ||
firstAccount.account.data.program satisfies Address; | ||
firstAccount.account.data.parsed.type satisfies 'account'; | ||
firstAccount.account.data.parsed.info.mint satisfies Address; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters