1- import { accountNode , constantPdaSeedNodeFromProgramId , pdaLinkNode , pdaNode , programNode } from '@kinobi-so/nodes' ;
1+ import {
2+ accountNode ,
3+ constantPdaSeedNodeFromProgramId ,
4+ constantPdaSeedNodeFromString ,
5+ pdaLinkNode ,
6+ pdaNode ,
7+ programNode ,
8+ publicKeyTypeNode ,
9+ variablePdaSeedNode ,
10+ } from '@kinobi-so/nodes' ;
211import { visit } from '@kinobi-so/visitors-core' ;
312import { test } from 'vitest' ;
413
514import { getRenderMapVisitor } from '../src' ;
615import { renderMapContains } from './_setup' ;
716
8- test ( 'it renders PDA helpers for PDA with no seeds ' , async ( ) => {
9- // Given the following program with 1 account and 1 pda with empty seeds.
17+ test ( 'it renders PDA helpers for PDA' , async ( ) => {
18+ // Given the following program with 1 account and 1 pda with seeds.
1019 const node = programNode ( {
1120 accounts : [ accountNode ( { name : 'foo' , pda : pdaLinkNode ( 'bar' ) } ) ] ,
1221 name : 'myProgram' ,
13- pdas : [ pdaNode ( { name : 'bar' , seeds : [ constantPdaSeedNodeFromProgramId ( ) ] } ) ] ,
22+ pdas : [
23+ pdaNode ( {
24+ name : 'bar' ,
25+ seeds : [
26+ constantPdaSeedNodeFromProgramId ( ) ,
27+ constantPdaSeedNodeFromString ( 'utf8' , 'bar' ) ,
28+ variablePdaSeedNode ( 'authority' , publicKeyTypeNode ( ) ) ,
29+ ] ,
30+ } ) ,
31+ ] ,
1432 publicKey : '1111' ,
1533 } ) ;
1634
@@ -22,5 +40,8 @@ test('it renders PDA helpers for PDA with no seeds', async () => {
2240 'export function findFooPda' ,
2341 'export async function fetchFooFromSeeds' ,
2442 'export async function safeFetchFooFromSeeds' ,
43+ 'publicKeySerializer().serialize(programId)' ,
44+ "string({ size: 'variable' }).serialize('bar')" ,
45+ 'publicKeySerializer().serialize(seeds.authority)' ,
2546 ] ) ;
2647} ) ;
0 commit comments