Conversation
b659d98 to
ac398c3
Compare
| }); | ||
|
|
||
| describe("transfer hook accounts", () => { | ||
| const pk = (seed: number) => new PublicKey(new Uint8Array(32).fill(seed)); |
There was a problem hiding this comment.
I don't feel like shadowing globally available common function name, confusing ..
| const result = await instance.prepareTopupInstructions( | ||
| { id: streamPublicKey.toBase58(), amount: new BN(100) }, | ||
| { | ||
| invoker: { publicKey: pk(13) } as unknown as Keypair, |
There was a problem hiding this comment.
seems like only topup functions in the StreamClient are missing the abstracted type: IPrepareStreamExt instead of actual Keypair | Signer.
If you can update it in the service code, you may stop casting here
| const senderPublicKey = pk(13); | ||
| const transferHookProgramId = pk(14); | ||
| const mint = pk(16); | ||
| const senderTokens = pk(19); |
There was a problem hiding this comment.
tbqh it feels really hard to maintain, and it is getting tricky to not shoot all your knee caps accidentally by using same number multiple times 😅
the idea is good, but I'd prepopulate a list of keys, and reference them by name/key instead of creating keys all over the place (here, and below when a stream is being created, might be other places)
| ); | ||
|
|
||
| expect(result.ixs.at(-1)).toBeDefined(); | ||
| expect(mockAddExtraAccountMetasForExecute).toHaveBeenCalledTimes(1); |
There was a problem hiding this comment.
i wouldnt test internal implementation of solana/web3.js. it may call it more times in its own blackbox, no?
at most we care about resulting Tx structure and accounts list there, maybe we need to test these structures?
No description provided.