Skip to content

Conversation

@Unheilbar
Copy link
Contributor

Description

Requires Dependencies

Resolves Dependencies

@cl-sonarqube-production
Copy link

Quality Gate failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 75%)

See analysis details on SonarQube

func GetOrCreateATAIx(
ctx context.Context,
client client.MultiClient,
mint, owner, payer solana.PublicKey,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we'll also want a tokenProgram solana.PublicKey in the signature too

mint, owner, payer solana.PublicKey,
) (ata solana.PublicKey, ix solana.Instruction, err error) {
// Derive ATA
ata, _, err = solana.FindAssociatedTokenAddress(owner, mint)
Copy link
Collaborator

Choose a reason for hiding this comment

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

The naming is kind of confusing but I think we'll want the tokens.FindAssociatedTokenAddress here instead. The import being "github.com/smartcontractkit/chainlink-ccip/chains/solana/utils/tokens"

client client.MultiClient,
mint, owner, payer solana.PublicKey,
) (ata solana.PublicKey, ix solana.Instruction, err error) {
// Derive ATA
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe it's overkill but in our existing ChainWriter code we also validate that the mint is a valid one before continuing. Maybe we can add that here too for safety.

accountInfo, err := client.GetAccountInfoWithOpts(ctx, mint.PublicKey, &rpc.GetAccountInfoOpts{
Commitment: rpc.CommitmentFinalized,
})
if err != nil {
return nil, fmt.Errorf("failed to fetch account info for token mint %s: %w", mint.PublicKey.String(), err)
}
if accountInfo == nil || accountInfo.Value == nil {
return nil, fmt.Errorf("failed to fetch account info for token mint %s", mint.PublicKey.String())
}

}

// Build ATA creation since Probe doesn't exists
ix = associatedtokenaccount.NewCreateInstruction(
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we want to stick to the tokens package and use tokens.CreateAssociatedTokenAccount here instead also

@github-actions
Copy link
Contributor

github-actions bot commented Feb 1, 2026

This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the Stale label Feb 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants