Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,11 @@ pub fn transfer_tokens(accounts: &[AccountInfo], args: TransferTokensArgs) -> Pr
from_associated_token_account.key,
to_associated_token_account.key,
owner.key,
&[owner.key, recipient.key],
// Empty: `owner` is a plain wallet authority, not a multisig account.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

can we remove the comments that are self explanatory

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in d89b110 — trimmed the comment to 2 lines.

// A non-empty list here marks `owner` as non-signer and instead
// requires each listed pubkey to co-sign as a multisig member — which
// wrongly forced the recipient to sign just to receive tokens.
&[],
args.quantity,
)?,
&[
Expand Down
2 changes: 1 addition & 1 deletion tokens/transfer-tokens/native/tests/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ describe('Transferring Tokens', () => {
await findAssociatedTokenAddress(mint, payer.address),
await findAssociatedTokenAddress(mint, recipientWallet.address),
payer,
recipientWallet,
recipientWallet.address,
payer,
programId,
quantity,
Expand Down
6 changes: 4 additions & 2 deletions tokens/transfer-tokens/native/ts/instructions/transfer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function createTransferTokensInstruction(
fromAssociatedTokenAccount: Address,
toAssociatedTokenAccount: Address,
owner: TransactionSigner,
recipient: TransactionSigner,
recipient: Address,
payer: TransactionSigner,
programId: Address,
quantity: bigint,
Expand All @@ -33,7 +33,9 @@ export function createTransferTokensInstruction(
{ address: fromAssociatedTokenAccount, role: AccountRole.WRITABLE },
{ address: toAssociatedTokenAccount, role: AccountRole.WRITABLE },
{ address: owner.address, role: AccountRole.WRITABLE_SIGNER, signer: owner },
{ address: recipient.address, role: AccountRole.WRITABLE_SIGNER, signer: recipient },
// Recipient just needs to be named, not to sign — receiving tokens
// must never require the recipient's approval.
{ address: recipient, role: AccountRole.READONLY },
{ address: payer.address, role: AccountRole.WRITABLE_SIGNER, signer: payer },
{ address: SYSTEM_PROGRAM_ADDRESS, role: AccountRole.READONLY },
{ address: TOKEN_PROGRAM_ADDRESS, role: AccountRole.READONLY },
Expand Down
Loading