Skip to content

Conversation

@beeman
Copy link
Contributor

@beeman beeman commented Dec 7, 2025

Description

Simplify the create-and-send-spl-transaction and clean up the api.

Part of #508

Screenshots / Video

Checklist

  • Tests have been added for my change
  • Docs have been updated for my change

Important

Refactors SPL transaction creation by removing redundant parameters, simplifying logic, and introducing idempotent ATA creation, with updated tests to ensure correctness.

  • Behavior:
    • Simplifies createAndSendSplTransaction by removing decimals parameter and fetching it internally in create-and-send-spl-transaction.ts.
    • Refactors createSplTransferInstructions to handle associated token accounts idempotently in create-spl-transfer-instructions.ts.
    • Introduces createGetOrCreateAtaInstruction in create-get-or-create-ata-instruction.ts for idempotent ATA creation.
  • Tests:
    • Updates integration tests in create-and-send-spl-transaction.integration.test.ts to reflect refactored logic.
    • Modifies unit tests in create-spl-transfer-transaction.test.ts to cover new behavior and edge cases.
  • Misc:
    • Removes findAssociatedTokenPda usage from create-and-send-spl-transaction.ts and spl-token-mint-to.ts.
    • Adjusts portfolioTxSendMutationOptions in use-portfolio-tx-send.tsx to align with refactored SPL transaction logic.

This description was created by Ellipsis for 872a02a. You can customize this summary. It will automatically update as commits are pushed.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Dec 7, 2025

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
samui-wallet-web 34a8d77 Commit Preview URL

Branch Preview URL
Dec 16 2025, 09:28 AM

@beeman beeman force-pushed the beeman/solana-client-consistency branch from 38bc4e5 to bbcf51d Compare December 7, 2025 23:01
@bundlemon
Copy link

bundlemon bot commented Dec 7, 2025

BundleMon

Files updated (5)
Status Path Size Limits
apps/web/dist/assets/index.browser-(hash).js
5.92KB (+4.59KB +343.02%) -
apps/desktop/dist/assets/index.browser-(hash)
.js
5.92KB (+4.58KB +343.45%) -
apps/extension/.output/chrome-mv3/chunks/inde
x.browser-(hash).js
4.77KB (+3.97KB +498.77%) -
apps/web/dist/assets/settings-(hash).js
20.09KB (+11B +0.05%) -
apps/desktop/dist/assets/index-(hash).js
173B (-251.95KB -99.93%) -
Unchanged files (96)
Status Path Size Limits
apps/web/dist/assets/index-(hash).js
279.94KB -
apps/extension/.output/chrome-mv3/chunks/clie
nt-(hash).js
254.92KB -
apps/extension/.output/chrome-mv3/chunks/deri
ve-(hash).js
23.43KB -
apps/desktop/dist/assets/derive-(hash).js
23.42KB -
apps/web/dist/assets/derive-(hash).js
23.42KB -
apps/desktop/dist/assets/settings-(hash).js
20.09KB -
apps/extension/.output/chrome-mv3/chunks/sett
ings-(hash).js
20.08KB -
apps/desktop/dist/assets/form-(hash).js
11.03KB -
apps/extension/.output/chrome-mv3/chunks/form
-(hash).js
11.03KB -
apps/web/dist/assets/form-(hash).js
11.03KB -
apps/extension/.output/chrome-mv3/chunks/sele
ct-(hash).js
8.08KB -
apps/web/dist/assets/select-(hash).js
8.07KB -
apps/desktop/dist/assets/select-(hash).js
8.07KB -
apps/extension/.output/chrome-mv3/chunks/onbo
arding-(hash).js
5.26KB -
apps/web/dist/assets/onboarding-(hash).js
5.26KB -
apps/desktop/dist/assets/onboarding-(hash).js
5.26KB -
apps/extension/.output/chrome-mv3/chunks/crea
te-(hash).js
4.23KB -
apps/desktop/dist/assets/create-(hash).js
4.23KB -
apps/web/dist/assets/create-(hash).js
4.23KB -
apps/desktop/dist/assets/use-(hash).js
3.21KB -
apps/web/dist/assets/use-(hash).js
3.21KB -
apps/extension/.output/chrome-mv3/chunks/use-
(hash).js
3.2KB -
apps/extension/.output/chrome-mv3/chunks/cons
tants-(hash).js
3.16KB -
apps/web/dist/assets/constants-(hash).js
3.16KB -
apps/desktop/dist/assets/constants-(hash).js
3.15KB -
apps/desktop/dist/assets/vanity-(hash).js
2.68KB -
apps/web/dist/assets/vanity-(hash).js
2.68KB -
apps/desktop/dist/assets/portfolio-(hash).js
2.62KB -
apps/web/dist/assets/portfolio-(hash).js
2.62KB -
apps/extension/.output/chrome-mv3/chunks/port
folio-(hash).js
2.62KB -
apps/extension/.output/chrome-mv3/chunks/togg
le-(hash).js
2.46KB -
apps/desktop/dist/assets/toggle-(hash).js
2.45KB -
apps/web/dist/assets/toggle-(hash).js
2.45KB -
apps/extension/.output/chrome-mv3/chunks/drop
down-(hash).js
2.16KB -
apps/desktop/dist/assets/dropdown-(hash).js
2.16KB -
apps/web/dist/assets/dropdown-(hash).js
2.15KB -
apps/extension/.output/chrome-mv3/chunks/fiel
d-(hash).js
1.93KB -
apps/desktop/dist/assets/field-(hash).js
1.93KB -
apps/web/dist/assets/field-(hash).js
1.93KB -
apps/extension/.output/chrome-mv3/chunks/chec
kbox-(hash).js
1.89KB -
apps/desktop/dist/assets/checkbox-(hash).js
1.88KB -
apps/web/dist/assets/checkbox-(hash).js
1.88KB -
apps/desktop/dist/assets/request-(hash).js
1.87KB -
apps/extension/.output/chrome-mv3/chunks/requ
est-(hash).js
1.87KB -
apps/web/dist/assets/request-(hash).js
1.79KB -
apps/extension/.output/chrome-mv3/chunks/item
-(hash).js
1.22KB -
apps/desktop/dist/assets/item-(hash).js
1.22KB -
apps/web/dist/assets/item-(hash).js
1.21KB -
apps/extension/.output/chrome-mv3/chunks/tool
s-(hash).js
1.17KB -
apps/desktop/dist/assets/tools-(hash).js
1.16KB -
apps/web/dist/assets/tools-(hash).js
1.16KB -
apps/desktop/dist/assets/explorer-(hash).js
1.14KB -
apps/web/dist/assets/explorer-(hash).js
1.14KB -
apps/extension/.output/chrome-mv3/chunks/expl
orer-(hash).js
1.14KB -
apps/extension/.output/chrome-mv3/chunks/zod-
(hash).js
763B -
apps/web/dist/assets/zod-(hash).js
762B -
apps/desktop/dist/assets/zod-(hash).js
761B -
apps/extension/.output/chrome-mv3/chunks/badg
e-(hash).js
737B -
apps/desktop/dist/assets/badge-(hash).js
733B -
apps/web/dist/assets/badge-(hash).js
732B -
apps/web/dist/assets/standard-(hash).js
652B -
apps/extension/.output/chrome-mv3/chunks/stan
dard-(hash).js
650B -
apps/desktop/dist/assets/standard-(hash).js
649B -
apps/desktop/dist/assets/button-(hash).js
578B -
apps/extension/.output/chrome-mv3/chunks/butt
on-(hash).js
578B -
apps/web/dist/assets/button-(hash).js
578B -
apps/extension/.output/chrome-mv3/chunks/inpu
t-(hash).js
577B -
apps/desktop/dist/assets/input-(hash).js
576B -
apps/web/dist/assets/input-(hash).js
573B -
apps/extension/.output/chrome-mv3/chunks/ui-(
hash).js
528B -
apps/desktop/dist/assets/ui-(hash).js
527B -
apps/web/dist/assets/ui-(hash).js
526B -
apps/desktop/dist/assets/label-(hash).js
514B -
apps/extension/.output/chrome-mv3/chunks/labe
l-(hash).js
514B -
apps/web/dist/assets/label-(hash).js
512B -
apps/desktop/dist/assets/get-(hash).js
492B -
apps/extension/.output/chrome-mv3/chunks/get-
(hash).js
492B -
apps/web/dist/assets/get-(hash).js
492B -
apps/extension/.output/chrome-mv3/chunks/conv
ert-(hash).js
424B -
apps/desktop/dist/assets/convert-(hash).js
422B -
apps/web/dist/assets/convert-(hash).js
421B -
apps/extension/.output/chrome-mv3/chunks/sol-
(hash).js
418B -
apps/web/dist/assets/sol-(hash).js
417B -
apps/desktop/dist/assets/sol-(hash).js
415B -
apps/web/dist/assets/dev-(hash).js
278B -
apps/desktop/dist/assets/dev-(hash).js
276B -
apps/extension/.output/chrome-mv3/chunks/dev-
(hash).js
273B -
apps/extension/.output/chrome-mv3/chunks/side
panel-(hash).js
202B -
apps/extension/.output/chrome-mv3/chunks/popu
p-(hash).js
200B -
apps/extension/.output/chrome-mv3/chunks/inde
x-(hash).js
173B -
apps/desktop/dist/assets/ellipsify-(hash).js
145B -
apps/extension/.output/chrome-mv3/chunks/elli
psify-(hash).js
145B -
apps/web/dist/assets/ellipsify-(hash).js
145B -
apps/desktop/dist/assets/network-(hash).js
121B -
apps/extension/.output/chrome-mv3/chunks/netw
ork-(hash).js
121B -
apps/web/dist/assets/network-(hash).js
121B -

Total files change -238.83KB -21.73%

Groups updated (3)
Status Path Size Limits
apps/web/dist/**/*-.js
461.49KB (-15B 0%) -
apps/desktop/dist/**/*-.js
435.29KB (-77B -0.02%) -
apps/extension/.output/chrome-mv3/**/*-
.js
433.41KB (-137B -0.03%) -

Final result: ✅

View report in BundleMon website ➡️


Current branch size history | Target branch size history

@beeman beeman force-pushed the beeman/solana-client-consistency branch 4 times, most recently from 9e86fb4 to 441eeab Compare December 11, 2025 19:40
@beeman beeman marked this pull request as ready for review December 11, 2025 19:40
@beeman beeman force-pushed the beeman/solana-client-consistency branch from 441eeab to 2c49cf1 Compare December 11, 2025 19:42
Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Caution

Changes requested ❌

Reviewed everything up to 441eeab in 3 minutes and 0 seconds. Click for details.
  • Reviewed 805 lines of code in 9 files
  • Skipped 0 files when reviewing.
  • Skipped posting 4 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. packages/portfolio/src/data-access/use-create-and-send-spl-transaction.tsx:18
  • Draft comment:
    Removed the 'decimals' parameter; ensure that callers are updated accordingly since decimals is now fetched from mint info in the client.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
2. packages/solana-client/src/create-and-send-spl-transaction.ts:30
  • Draft comment:
    Decimals is now computed via fetchMint (line 30–32). Confirm that the mint metadata is always available to avoid unexpected errors.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
3. packages/solana-client/test/create-spl-transfer-transaction.test.ts:277
  • Draft comment:
    The test 'should throw error when sender is not a keypair signer' still references a 'sender' property, which is outdated. Update the test to use 'transactionSigner' instead.
  • Reason this comment was not posted:
    Comment was on unchanged code.
4. packages/solana-client/src/spl-token-mint-to.ts:3
  • Draft comment:
    There's an unnecessary trailing comma in the import statement on line 3. Consider removing the comma after 'getMintToCheckedInstruction' for consistency with the project's style.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% This is a very minor stylistic issue - a trailing comma in an import statement. While it's technically correct that there's a trailing comma, this falls under "obvious or unimportant" comments. The rules explicitly state "Do NOT make comments that are obvious or unimportant." A trailing comma in an import is a trivial formatting issue that would typically be caught by a linter or formatter, and doesn't affect functionality. It's also the kind of thing that would be automatically fixed by tools like ESLint or Prettier if the project uses them. This is not a meaningful code change that requires human review. Could this be part of a broader style guide enforcement that's important to the project? Maybe the project doesn't use automated formatters and relies on manual review for style consistency? Even if the project doesn't use automated formatters, this is still an extremely minor and obvious issue. The rules explicitly say not to make obvious or unimportant comments, and a trailing comma in an import statement clearly falls into that category. If style consistency were critical enough to warrant manual review of trailing commas, the project would use automated tooling. This comment should be deleted. It's about a trivial formatting issue (trailing comma in import) that is obvious and unimportant, violating the rule against making such comments.

Workflow ID: wflow_Jtq3tRQQm5G70YZn

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Caution

Changes requested ❌

Reviewed 2c49cf1 in 3 minutes and 26 seconds. Click for details.
  • Reviewed 805 lines of code in 9 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. packages/solana-client/test/create-spl-transfer-transaction.test.ts:62
  • Draft comment:
    The mocks for findAssociatedTokenPda return an empty array, causing destination and source ATAs to be undefined in the instructions. Consider enhancing the mock to return realistic ATA addresses to better simulate production behavior.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% The tests explicitly assert that destination: undefined and source: undefined are passed to the instruction functions (lines 46, 48, 74, 86, 88). This strongly suggests that the empty array return from findAssociatedTokenPda is intentional - it's testing the behavior when ATAs are undefined. The comment suggests this is a problem and recommends returning "realistic ATA addresses," but doing so would break the test assertions that explicitly check for undefined values. The comment appears to misunderstand the test's purpose, which is to verify the function works correctly even when ATAs are undefined (perhaps the actual implementation derives them internally). Could the comment be suggesting that having undefined ATAs doesn't match production behavior, and therefore the tests aren't realistic? Maybe in production, findAssociatedTokenPda would always return valid addresses, and testing with undefined is not representative of real usage. Even if that's the intent, the tests are explicitly designed to verify undefined behavior - this is clear from the assertions. If the test author wanted to test with real ATA addresses, they would have mocked different return values and changed the assertions. The comment is suggesting a change that would fundamentally alter what these tests are verifying, without evidence that the current approach is wrong. This falls under "speculative" comments - the comment assumes there's a problem without proof. The comment should be deleted. The tests explicitly assert that undefined values are passed for destination and source ATAs (lines 46, 48, 74, 86, 88), indicating this is intentional test behavior. The comment suggests changing the mock in a way that would break these assertions, without providing evidence that the current approach is incorrect.

Workflow ID: wflow_YwIr3aspqcoaNkTp

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

@beeman beeman force-pushed the beeman/solana-client-consistency branch from 2c49cf1 to 872a02a Compare December 12, 2025 19:55
Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed 872a02a in 2 minutes and 31 seconds. Click for details.
  • Reviewed 806 lines of code in 9 files
  • Skipped 0 files when reviewing.
  • Skipped posting 4 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. packages/solana-client/src/create-spl-transfer-instructions.ts:43
  • Draft comment:
    Destructuring the results from 'findAssociatedTokenPda' assumes a non‐empty array. If no ATA is found the destructured values become undefined—please document or handle this case explicitly.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% The comment appears to misunderstand how PDA (Program Derived Address) functions work in Solana. Functions like findAssociatedTokenPda don't search for existing accounts - they deterministically compute addresses based on seeds. They should always return a valid address (and typically a bump seed), never an empty array. The destructuring pattern [[sourceATA], [destinationATA]] is taking the first element from each returned array, which is standard for PDA functions that return [address, bump] tuples. This is not a case where the array could be empty - it's a mathematical derivation. The comment is likely incorrect and shows a misunderstanding of Solana's PDA mechanism. I might be wrong about the exact return type of findAssociatedTokenPda without seeing its implementation. Perhaps this specific function has different behavior than typical PDA functions. However, the name and usage pattern strongly suggest it's a standard PDA derivation function. Even if I'm not 100% certain about the implementation, the burden of proof should be on the comment to show strong evidence of a problem. The standard behavior of PDA functions in Solana is to always return a deterministic address. Without clear evidence that this function behaves differently, the comment appears to be speculative and based on a misunderstanding. This comment should be deleted. It appears to misunderstand how PDA derivation functions work in Solana - they compute addresses deterministically and don't return empty arrays. The comment is speculative without strong evidence of an actual issue.
2. packages/solana-client/src/create-and-send-spl-transaction.ts:31
  • Draft comment:
    Good refactoring: computing 'decimals' from mint info removes the need for a separate input and reduces potential inconsistency.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
3. packages/portfolio/src/data-access/use-create-and-send-spl-transaction.tsx:29
  • Draft comment:
    Removing the 'decimals' parameter from the mutation options streamlines the API, as decimals are now fetched from the mint info. Ensure that mint info is reliably available to avoid unexpected issues.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
4. packages/solana-client/test/create-spl-transfer-transaction.test.ts:7
  • Draft comment:
    The mock for 'findAssociatedTokenPda' returns an empty array, so ATA values become undefined. While tests pass, consider using more realistic mock values to better exercise ATA computation logic.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% This comment is suggesting a test improvement - using more realistic mock values instead of an empty array. However, the tests are working as intended and explicitly checking for undefined values. This is not pointing out a bug or required change. The comment starts with "While tests pass, consider..." which is a suggestion, not a required change. According to the rules, I should not keep comments that are purely informative or suggestive unless they identify a clear issue. The comment is about code quality/test quality improvement, not a functional bug. The comment might be valid if the undefined values in the tests indicate that the actual implementation logic for ATA computation isn't being properly tested. If the real code relies on findAssociatedTokenPda returning actual values, then mocking it to return an empty array might mean the tests aren't exercising the real code paths. While that's a fair point, the comment explicitly states "While tests pass" which acknowledges the tests are working. The comment is asking to "consider" using better mocks, which is a suggestion for improvement, not identifying a bug. According to the rules, I should not keep comments that are suggestions unless they identify a clear required change. This is a test quality suggestion, not a functional issue. This comment should be deleted. It's a suggestion for test improvement ("consider using more realistic mock values") rather than identifying a required code change or bug. The comment acknowledges the tests pass and is purely advisory about test quality.

Workflow ID: wflow_jLR05nU9VcP44ASc

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

@beeman beeman force-pushed the beeman/solana-client-consistency branch from 872a02a to 34a8d77 Compare December 16, 2025 09:27
@beeman beeman enabled auto-merge (rebase) December 16, 2025 09:34
@beeman beeman merged commit d80298e into main Dec 16, 2025
21 checks passed
@beeman beeman deleted the beeman/solana-client-consistency branch December 16, 2025 09:34
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