Skip to content

feat: support transfer hook, partner link#350

Open
Yolley wants to merge 4 commits intomasterfrom
feat/transfer_hook_support
Open

feat: support transfer hook, partner link#350
Yolley wants to merge 4 commits intomasterfrom
feat/transfer_hook_support

Conversation

@Yolley
Copy link
Copy Markdown
Collaborator

@Yolley Yolley commented Apr 10, 2026

No description provided.

@Yolley Yolley force-pushed the feat/transfer_hook_support branch from b659d98 to ac398c3 Compare April 10, 2026 05:38
});

describe("transfer hook accounts", () => {
const pk = (seed: number) => new PublicKey(new Uint8Array(32).fill(seed));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment on lines +390 to +393
const senderPublicKey = pk(13);
const transferHookProgramId = pk(14);
const mint = pk(16);
const senderTokens = pk(19);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants