Skip to content

Add signing error codes and factories - #1902

Draft
mcintyre94 wants to merge 1 commit into
client-sign-transactionfrom
sign-tx-errors
Draft

Add signing error codes and factories#1902
mcintyre94 wants to merge 1 commit into
client-sign-transactionfrom
sign-tx-errors

Conversation

@mcintyre94

@mcintyre94 mcintyre94 commented Aug 7, 2026

Copy link
Copy Markdown
Member

Summary of Changes

This PR adds Kit error codes for a signTransaction plugin to use: SOLANA_ERROR__FAILED_TO_SIGN_TRANSACTION[s]

These have the same shaped context as sign, because while signTransaction is not expected to actually send a transaction to the network, it may for example simulate to estimate CUs. In this case logs and preflightData are useful context for a failed simulation during signing.

We also add helpers createFailedToSignTransactionError[s], again mirroring how the equivalent send helpers construct these errors. The only difference is that we skip the call to getFailedIndicator which attaches a preflight indicator or a signature, neither of which are useful for the sign error message.

The logic to implement these is shared with the send helpers.

@changeset-bot

changeset-bot Bot commented Aug 7, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 38a12b2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 48 packages
Name Type
@solana/errors Minor
@solana/instruction-plans Minor
@solana/accounts Minor
@solana/addresses Minor
@solana/assertions Minor
@solana/codecs-core Minor
@solana/codecs-data-structures Minor
@solana/codecs-numbers Minor
@solana/codecs-strings Minor
@solana/compat Minor
@solana/fixed-points Minor
@solana/instructions Minor
@solana/keys Minor
@solana/kit Minor
@solana/offchain-messages Minor
@solana/options Minor
@solana/program-client-core Minor
@solana/programs Minor
@solana/rpc-api Minor
@solana/rpc-spec-types Minor
@solana/rpc-spec Minor
@solana/rpc-subscriptions-channel-websocket Minor
@solana/rpc-subscriptions-spec Minor
@solana/rpc-subscriptions Minor
@solana/rpc-transformers Minor
@solana/rpc-transport-http Minor
@solana/rpc-types Minor
@solana/rpc Minor
@solana/signers Minor
@solana/subscribable Minor
@solana/sysvars Minor
@solana/transaction-confirmation Minor
@solana/transaction-introspection Minor
@solana/transaction-messages Minor
@solana/transactions Minor
@solana/wallet-account-signer Minor
@solana/plugin-interfaces Minor
@solana/rpc-graphql Minor
@solana/rpc-parsed-types Minor
@solana/rpc-subscriptions-api Minor
@solana/codecs Minor
@solana/react Minor
@solana/fast-stable-stringify Minor
@solana/functional Minor
@solana/nominal-types Minor
@solana/plugin-core Minor
@solana/promises Minor
@solana/webcrypto-ed25519-polyfill Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

mcintyre94 commented Aug 7, 2026

Copy link
Copy Markdown
Member Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@bundlemon

bundlemon Bot commented Aug 7, 2026

Copy link
Copy Markdown

BundleMon

Files updated (6)
Status Path Size Limits
errors/dist/index.node.mjs
21.85KB (+38B +0.17%) -
errors/dist/index.browser.mjs
21.82KB (+35B +0.16%) -
errors/dist/index.native.mjs
21.82KB (+35B +0.16%) -
wallet-account-signer/dist/index.native.mjs
18.51KB (+31B +0.16%) -
wallet-account-signer/dist/index.node.mjs
18.53KB (+31B +0.16%) -
wallet-account-signer/dist/index.browser.mjs
18.51KB (+30B +0.16%) -
Unchanged files (144)
Status Path Size Limits
@solana/kit production bundle
kit/dist/index.production.min.js
56.04KB -
rpc-graphql/dist/index.browser.mjs
18.82KB -
rpc-graphql/dist/index.native.mjs
18.82KB -
rpc-graphql/dist/index.node.mjs
18.82KB -
transaction-messages/dist/index.browser.mjs
11.34KB -
transaction-messages/dist/index.native.mjs
11.34KB -
transaction-messages/dist/index.node.mjs
11.34KB -
instruction-plans/dist/index.browser.mjs
7.06KB -
instruction-plans/dist/index.native.mjs
7.06KB -
instruction-plans/dist/index.node.mjs
7.06KB -
react/dist/index.browser.mjs
5.32KB -
react/dist/index.native.mjs
5.32KB -
react/dist/index.node.mjs
5.32KB -
codecs-data-structures/dist/index.browser.mjs
5.29KB -
codecs-data-structures/dist/index.native.mjs
5.29KB -
codecs-data-structures/dist/index.node.mjs
5.29KB -
offchain-messages/dist/index.browser.mjs
5.25KB -
offchain-messages/dist/index.native.mjs
5.24KB -
offchain-messages/dist/index.node.mjs
5.24KB -
fixed-points/dist/index.browser.mjs
5.08KB -
fixed-points/dist/index.native.mjs
5.07KB -
fixed-points/dist/index.node.mjs
5.07KB -
kit/dist/index.browser.mjs
4.86KB -
kit/dist/index.native.mjs
4.85KB -
kit/dist/index.node.mjs
4.85KB -
transactions/dist/index.browser.mjs
4.07KB -
transactions/dist/index.native.mjs
4.07KB -
transactions/dist/index.node.mjs
4.07KB -
codecs-core/dist/index.browser.mjs
3.62KB -
codecs-core/dist/index.native.mjs
3.62KB -
codecs-core/dist/index.node.mjs
3.62KB -
webcrypto-ed25519-polyfill/dist/index.node.mj
s
3.61KB -
webcrypto-ed25519-polyfill/dist/index.browser
.mjs
3.59KB -
webcrypto-ed25519-polyfill/dist/index.native.
mjs
3.57KB -
rpc-subscriptions/dist/index.browser.mjs
3.37KB -
rpc-subscriptions/dist/index.node.mjs
3.34KB -
rpc-subscriptions/dist/index.native.mjs
3.31KB -
signers/dist/index.browser.mjs
3.26KB -
signers/dist/index.native.mjs
3.26KB -
signers/dist/index.node.mjs
3.26KB -
rpc-transformers/dist/index.browser.mjs
3.18KB -
rpc-transformers/dist/index.native.mjs
3.18KB -
rpc-transformers/dist/index.node.mjs
3.18KB -
subscribable/dist/index.node.mjs
3.13KB -
keys/dist/index.node.mjs
3.06KB -
subscribable/dist/index.native.mjs
3.06KB -
subscribable/dist/index.browser.mjs
3.05KB -
addresses/dist/index.browser.mjs
2.93KB -
addresses/dist/index.native.mjs
2.92KB -
addresses/dist/index.node.mjs
2.92KB -
keys/dist/index.browser.mjs
2.85KB -
keys/dist/index.native.mjs
2.85KB -
transaction-introspection/dist/index.browser.
mjs
2.73KB -
transaction-introspection/dist/index.native.m
js
2.73KB -
transaction-introspection/dist/index.node.mjs
2.73KB -
codecs-strings/dist/index.browser.mjs
2.55KB -
codecs-strings/dist/index.node.mjs
2.51KB -
codecs-strings/dist/index.native.mjs
2.47KB -
transaction-confirmation/dist/index.node.mjs
2.42KB -
transaction-confirmation/dist/index.native.mj
s
2.37KB -
sysvars/dist/index.browser.mjs
2.37KB -
sysvars/dist/index.native.mjs
2.37KB -
transaction-confirmation/dist/index.browser.m
js
2.37KB -
sysvars/dist/index.node.mjs
2.37KB -
rpc-subscriptions-spec/dist/index.node.mjs
2.26KB -
rpc-subscriptions-spec/dist/index.native.mjs
2.21KB -
rpc-subscriptions-spec/dist/index.browser.mjs
2.21KB -
rpc/dist/index.node.mjs
1.95KB -
codecs-numbers/dist/index.browser.mjs
1.95KB -
codecs-numbers/dist/index.native.mjs
1.95KB -
codecs-numbers/dist/index.node.mjs
1.94KB -
rpc-types/dist/index.browser.mjs
1.9KB -
rpc-types/dist/index.native.mjs
1.9KB -
rpc-types/dist/index.node.mjs
1.9KB -
rpc-transport-http/dist/index.browser.mjs
1.89KB -
rpc-transport-http/dist/index.native.mjs
1.89KB -
rpc/dist/index.native.mjs
1.81KB -
rpc/dist/index.browser.mjs
1.8KB -
rpc-transport-http/dist/index.node.mjs
1.71KB -
rpc-spec-types/dist/index.browser.mjs
1.54KB -
rpc-spec-types/dist/index.native.mjs
1.54KB -
rpc-spec-types/dist/index.node.mjs
1.54KB -
rpc-subscriptions-channel-websocket/dist/inde
x.node.mjs
1.33KB -
rpc-subscriptions-channel-websocket/dist/inde
x.native.mjs
1.27KB -
rpc-subscriptions-channel-websocket/dist/inde
x.browser.mjs
1.26KB -
program-client-core/dist/index.browser.mjs
1.21KB -
program-client-core/dist/index.native.mjs
1.21KB -
program-client-core/dist/index.node.mjs
1.21KB -
plugin-core/dist/index.browser.mjs
1.18KB -
plugin-core/dist/index.native.mjs
1.18KB -
plugin-core/dist/index.node.mjs
1.18KB -
options/dist/index.browser.mjs
1.18KB -
options/dist/index.native.mjs
1.18KB -
options/dist/index.node.mjs
1.17KB -
accounts/dist/index.browser.mjs
1.17KB -
accounts/dist/index.native.mjs
1.17KB -
accounts/dist/index.node.mjs
1.16KB -
rpc-api/dist/index.browser.mjs
1.04KB -
rpc-api/dist/index.native.mjs
1.04KB -
rpc-api/dist/index.node.mjs
1.04KB -
compat/dist/index.browser.mjs
969B -
compat/dist/index.native.mjs
968B -
compat/dist/index.node.mjs
966B -
rpc-spec/dist/index.browser.mjs
928B -
rpc-spec/dist/index.native.mjs
928B -
rpc-spec/dist/index.node.mjs
926B -
rpc-subscriptions-api/dist/index.native.mjs
871B -
rpc-subscriptions-api/dist/index.browser.mjs
870B -
rpc-subscriptions-api/dist/index.node.mjs
870B -
promises/dist/index.native.mjs
841B -
promises/dist/index.node.mjs
840B -
promises/dist/index.browser.mjs
839B -
assertions/dist/index.browser.mjs
783B -
instructions/dist/index.browser.mjs
771B -
instructions/dist/index.native.mjs
770B -
instructions/dist/index.node.mjs
768B -
fast-stable-stringify/dist/index.browser.mjs
726B -
fast-stable-stringify/dist/index.native.mjs
725B -
assertions/dist/index.native.mjs
724B -
fast-stable-stringify/dist/index.node.mjs
724B -
assertions/dist/index.node.mjs
723B -
programs/dist/index.browser.mjs
329B -
programs/dist/index.native.mjs
327B -
programs/dist/index.node.mjs
325B -
fs-impl/dist/index.browser.mjs
245B -
event-target-impl/dist/index.node.mjs
230B -
functional/dist/index.browser.mjs
154B -
functional/dist/index.native.mjs
152B -
text-encoding-impl/dist/index.native.mjs
152B -
functional/dist/index.node.mjs
151B -
codecs/dist/index.browser.mjs
145B -
codecs/dist/index.native.mjs
144B -
codecs/dist/index.node.mjs
142B -
event-target-impl/dist/index.browser.mjs
133B -
ws-impl/dist/index.node.mjs
131B -
text-encoding-impl/dist/index.browser.mjs
122B -
fs-impl/dist/index.node.mjs
120B -
text-encoding-impl/dist/index.node.mjs
119B -
ws-impl/dist/index.browser.mjs
113B -
crypto-impl/dist/index.node.mjs
111B -
crypto-impl/dist/index.browser.mjs
109B -
rpc-parsed-types/dist/index.browser.mjs
66B -
rpc-parsed-types/dist/index.native.mjs
65B -
rpc-parsed-types/dist/index.node.mjs
63B -

Total files change +199B +0.03%

Final result: ✅

View report in BundleMon website ➡️


Current branch size history | Target branch size history

@bundlemon

bundlemon Bot commented Aug 7, 2026

Copy link
Copy Markdown

BundleMon

Files updated (13)
Status Path Size Limits
instruction-plans/dist/index.node.mjs
7.45KB (+440B +6.12%) -
instruction-plans/dist/index.browser.mjs
7.45KB (+439B +6.11%) -
instruction-plans/dist/index.native.mjs
7.45KB (+439B +6.11%) -
@solana/kit production bundle
kit/dist/index.production.min.js
55.77KB (+140B +0.25%) -
errors/dist/index.node.mjs
21.85KB (+38B +0.17%) -
transactions/dist/index.browser.mjs
4.1KB (+38B +0.91%) -
transactions/dist/index.native.mjs
4.1KB (+38B +0.91%) -
transactions/dist/index.node.mjs
4.1KB (+37B +0.89%) -
errors/dist/index.browser.mjs
21.82KB (+35B +0.16%) -
errors/dist/index.native.mjs
21.82KB (+35B +0.16%) -
wallet-account-signer/dist/index.native.mjs
18.51KB (+31B +0.16%) -
wallet-account-signer/dist/index.node.mjs
18.53KB (+31B +0.16%) -
wallet-account-signer/dist/index.browser.mjs
18.51KB (+30B +0.16%) -
Unchanged files (137)
Status Path Size Limits
rpc-graphql/dist/index.browser.mjs
18.82KB -
rpc-graphql/dist/index.native.mjs
18.82KB -
rpc-graphql/dist/index.node.mjs
18.82KB -
transaction-messages/dist/index.browser.mjs
11.34KB -
transaction-messages/dist/index.native.mjs
11.34KB -
transaction-messages/dist/index.node.mjs
11.34KB -
react/dist/index.browser.mjs
5.32KB -
react/dist/index.native.mjs
5.32KB -
react/dist/index.node.mjs
5.32KB -
codecs-data-structures/dist/index.browser.mjs
5.29KB -
codecs-data-structures/dist/index.native.mjs
5.29KB -
codecs-data-structures/dist/index.node.mjs
5.29KB -
offchain-messages/dist/index.browser.mjs
5.25KB -
offchain-messages/dist/index.native.mjs
5.24KB -
offchain-messages/dist/index.node.mjs
5.24KB -
fixed-points/dist/index.browser.mjs
5.08KB -
fixed-points/dist/index.native.mjs
5.07KB -
fixed-points/dist/index.node.mjs
5.07KB -
kit/dist/index.browser.mjs
4.61KB -
kit/dist/index.native.mjs
4.6KB -
kit/dist/index.node.mjs
4.6KB -
codecs-core/dist/index.browser.mjs
3.62KB -
codecs-core/dist/index.native.mjs
3.62KB -
codecs-core/dist/index.node.mjs
3.62KB -
webcrypto-ed25519-polyfill/dist/index.node.mj
s
3.61KB -
webcrypto-ed25519-polyfill/dist/index.browser
.mjs
3.59KB -
webcrypto-ed25519-polyfill/dist/index.native.
mjs
3.57KB -
rpc-subscriptions/dist/index.browser.mjs
3.37KB -
rpc-subscriptions/dist/index.node.mjs
3.34KB -
rpc-subscriptions/dist/index.native.mjs
3.31KB -
signers/dist/index.browser.mjs
3.26KB -
signers/dist/index.native.mjs
3.26KB -
signers/dist/index.node.mjs
3.26KB -
rpc-transformers/dist/index.browser.mjs
3.16KB -
rpc-transformers/dist/index.native.mjs
3.16KB -
rpc-transformers/dist/index.node.mjs
3.15KB -
subscribable/dist/index.node.mjs
3.13KB -
keys/dist/index.node.mjs
3.06KB -
subscribable/dist/index.native.mjs
3.06KB -
subscribable/dist/index.browser.mjs
3.05KB -
addresses/dist/index.browser.mjs
2.93KB -
addresses/dist/index.native.mjs
2.92KB -
addresses/dist/index.node.mjs
2.92KB -
keys/dist/index.browser.mjs
2.85KB -
keys/dist/index.native.mjs
2.85KB -
transaction-introspection/dist/index.browser.
mjs
2.73KB -
transaction-introspection/dist/index.native.m
js
2.73KB -
transaction-introspection/dist/index.node.mjs
2.73KB -
codecs-strings/dist/index.browser.mjs
2.55KB -
codecs-strings/dist/index.node.mjs
2.51KB -
codecs-strings/dist/index.native.mjs
2.47KB -
transaction-confirmation/dist/index.node.mjs
2.42KB -
transaction-confirmation/dist/index.native.mj
s
2.37KB -
sysvars/dist/index.browser.mjs
2.37KB -
sysvars/dist/index.native.mjs
2.37KB -
transaction-confirmation/dist/index.browser.m
js
2.37KB -
sysvars/dist/index.node.mjs
2.37KB -
rpc-subscriptions-spec/dist/index.node.mjs
2.23KB -
rpc-subscriptions-spec/dist/index.native.mjs
2.19KB -
rpc-subscriptions-spec/dist/index.browser.mjs
2.19KB -
rpc/dist/index.node.mjs
1.95KB -
codecs-numbers/dist/index.browser.mjs
1.95KB -
codecs-numbers/dist/index.native.mjs
1.95KB -
codecs-numbers/dist/index.node.mjs
1.94KB -
rpc-types/dist/index.browser.mjs
1.9KB -
rpc-types/dist/index.native.mjs
1.9KB -
rpc-types/dist/index.node.mjs
1.9KB -
rpc-transport-http/dist/index.browser.mjs
1.89KB -
rpc-transport-http/dist/index.native.mjs
1.89KB -
rpc/dist/index.native.mjs
1.81KB -
rpc/dist/index.browser.mjs
1.8KB -
rpc-transport-http/dist/index.node.mjs
1.71KB -
rpc-subscriptions-channel-websocket/dist/inde
x.node.mjs
1.33KB -
rpc-subscriptions-channel-websocket/dist/inde
x.native.mjs
1.27KB -
rpc-subscriptions-channel-websocket/dist/inde
x.browser.mjs
1.26KB -
program-client-core/dist/index.browser.mjs
1.21KB -
program-client-core/dist/index.native.mjs
1.21KB -
program-client-core/dist/index.node.mjs
1.21KB -
plugin-core/dist/index.browser.mjs
1.18KB -
plugin-core/dist/index.native.mjs
1.18KB -
plugin-core/dist/index.node.mjs
1.18KB -
options/dist/index.browser.mjs
1.18KB -
options/dist/index.native.mjs
1.18KB -
options/dist/index.node.mjs
1.17KB -
accounts/dist/index.browser.mjs
1.17KB -
accounts/dist/index.native.mjs
1.17KB -
accounts/dist/index.node.mjs
1.16KB -
rpc-spec-types/dist/index.browser.mjs
1.15KB -
rpc-spec-types/dist/index.native.mjs
1.15KB -
rpc-spec-types/dist/index.node.mjs
1.15KB -
rpc-api/dist/index.browser.mjs
1.04KB -
rpc-api/dist/index.native.mjs
1.04KB -
rpc-api/dist/index.node.mjs
1.04KB -
compat/dist/index.browser.mjs
969B -
compat/dist/index.native.mjs
968B -
compat/dist/index.node.mjs
966B -
rpc-spec/dist/index.browser.mjs
898B -
rpc-spec/dist/index.native.mjs
897B -
rpc-spec/dist/index.node.mjs
896B -
rpc-subscriptions-api/dist/index.native.mjs
871B -
rpc-subscriptions-api/dist/index.browser.mjs
870B -
rpc-subscriptions-api/dist/index.node.mjs
870B -
promises/dist/index.native.mjs
841B -
promises/dist/index.node.mjs
840B -
promises/dist/index.browser.mjs
839B -
assertions/dist/index.browser.mjs
783B -
instructions/dist/index.browser.mjs
771B -
instructions/dist/index.native.mjs
770B -
instructions/dist/index.node.mjs
768B -
fast-stable-stringify/dist/index.browser.mjs
726B -
fast-stable-stringify/dist/index.native.mjs
725B -
assertions/dist/index.native.mjs
724B -
fast-stable-stringify/dist/index.node.mjs
724B -
assertions/dist/index.node.mjs
723B -
programs/dist/index.browser.mjs
329B -
programs/dist/index.native.mjs
327B -
programs/dist/index.node.mjs
325B -
fs-impl/dist/index.browser.mjs
245B -
event-target-impl/dist/index.node.mjs
230B -
functional/dist/index.browser.mjs
154B -
functional/dist/index.native.mjs
152B -
text-encoding-impl/dist/index.native.mjs
152B -
functional/dist/index.node.mjs
151B -
codecs/dist/index.browser.mjs
145B -
codecs/dist/index.native.mjs
144B -
codecs/dist/index.node.mjs
142B -
event-target-impl/dist/index.browser.mjs
133B -
ws-impl/dist/index.node.mjs
131B -
text-encoding-impl/dist/index.browser.mjs
122B -
fs-impl/dist/index.node.mjs
120B -
text-encoding-impl/dist/index.node.mjs
119B -
ws-impl/dist/index.browser.mjs
113B -
crypto-impl/dist/index.node.mjs
111B -
crypto-impl/dist/index.browser.mjs
109B -
rpc-parsed-types/dist/index.browser.mjs
66B -
rpc-parsed-types/dist/index.native.mjs
65B -
rpc-parsed-types/dist/index.node.mjs
63B -

Total files change +1.73KB +0.31%

Final result: ✅

View report in BundleMon website ➡️


Current branch size history | Target branch size history

@mcintyre94

Copy link
Copy Markdown
Member Author

@trevor-cortex

@trevor-cortex trevor-cortex left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Summary

Adds SOLANA_ERROR__FAILED_TO_SIGN_TRANSACTION[S] error codes (13/14) to @solana/errors and their createFailedToSignTransaction[s]Error factories in @solana/instruction-plans, mirroring the existing failed-to-send codes. The implementation is a clean refactor: the bodies of the two send factories are extracted into shared getSingleFailureContext / getMultipleFailuresContext helpers, parameterized by an includeSubmissionIndicator flag that the sign variants set to false so the message drops the (preflight) / signature prefix while keeping logs and preflightData intact.

What I checked

  • Behavior preservation for send: the extracted helpers are line-for-line equivalent to the previous inlined logic when includeSubmissionIndicator is true — no behavioral change to the send factories.
  • Registry consistency: codes 13/14 are appended sequentially in the correct range, and the context.ts / messages.ts / SolanaErrorCode union entries are all present and alphabetically ordered. Context shapes exactly mirror the send counterparts, including the non-enumerable transactionPlanResult.
  • Message formatting: with an empty indicator, the single message becomes Failed to sign transaction: <cause> and plural lines become [Tx #1] <cause> — both covered by tests, including the edge case where a stray signature exists in the result context and is correctly omitted.
  • Tests: thorough coverage of preflight unwrapping, cause propagation (single vs. multiple failures), cancellation with/without abort reason, non-enumerable transactionPlanResult, and error codes — matching the structure of the existing send tests.
  • Changeset: present, minor for both packages, which fits an additive error-code + factory feature.

Notes for other reviewers

  • The true /* includeSubmissionIndicator */ / false /* ... */ call-site comments make the boolean flag readable enough that I don't think an options object is warranted for an internal helper.
  • createFailedToSignTransactionsError reuses TransactionPlanResultWithOptionalSignature as its parameter type even though sign flows never produce signatures. That's the pragmatic choice since the plumbing is shared with send; a narrower type would add surface area for no real safety gain, so I wouldn't push on it.
  • The helpers return Record<string, unknown> and rely on the SolanaError constructor accepting it, same as the pre-existing inlined code — no change in type rigor there.

LGTM — would approve, but I don't have approval permissions on this repo, so submitting as a comment instead.

@mcintyre94
mcintyre94 marked this pull request as ready for review August 7, 2026 16:01
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Documentation Preview: https://kit-docs-17x6mtvxu-anza-tech.vercel.app

@mcintyre94
mcintyre94 requested a review from lorisleiva August 7, 2026 16:14

@lorisleiva lorisleiva left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

@mcintyre94
mcintyre94 changed the base branch from client-sign-transaction to graphite-base/1902 August 12, 2026 10:46
@mcintyre94
mcintyre94 changed the base branch from graphite-base/1902 to main August 12, 2026 10:46
@mcintyre94
mcintyre94 enabled auto-merge August 12, 2026 10:46
@mcintyre94
mcintyre94 marked this pull request as draft August 12, 2026 11:05
auto-merge was automatically disabled August 12, 2026 11:05

Pull request was converted to draft

@mcintyre94
mcintyre94 changed the base branch from main to graphite-base/1902 August 14, 2026 13:03
@mcintyre94
mcintyre94 changed the base branch from graphite-base/1902 to client-sign-transaction August 14, 2026 13:03
@mcintyre94
mcintyre94 force-pushed the client-sign-transaction branch from 567e5e7 to d5ce66b Compare August 14, 2026 14:18
Signing a transaction can fail in most of the ways sending can — a signer refuses, a required signer is missing, or the simulation used to estimate resource limits fails — but Kit only had error codes for send failures, so a client capability that signs without submitting had nothing accurate to throw. This adds `SOLANA_ERROR__FAILED_TO_SIGN_TRANSACTION` and `SOLANA_ERROR__FAILED_TO_SIGN_TRANSACTIONS` along with the `createFailedToSignTransactionError` and `createFailedToSignTransactionsError` factories that raise them, so a signing wrapper can translate the low-level `SOLANA_ERROR__INSTRUCTION_PLANS__FAILED_TO_EXECUTE_TRANSACTION_PLAN` thrown by an executor into a user-facing error the same way the sending wrappers already do.

The context shapes are deliberately identical to their send counterparts, including the non-enumerable `transactionPlanResult` and the optional `logs` and `preflightData`. Those simulation fields are not vestigial for signing: resource-limit estimation runs inside `executeTransactionMessage` before the signing step, so an estimation failure lands on a failed leaf and reaches the error exactly as it does when sending. Keeping the shapes identical also lets one extracted context builder serve both pairs of factories and keeps the two codes interchangeable at the catch site.

Where the signing errors differ is the message, which carries no indicator of where the failure happened. That indicator locates a failure relative to network submission — `(preflight)` before it, or the transaction signature after it — and signing never submits, so neither branch has anything to say. A signature would actively mislead, implying the transaction reached the network when it never did. Only the prefix is dropped: `logs` and `preflightData` remain on the context, and the log snippet still appears in the message, so a simulation failure is still legible.

Extracting the shared context builders leaves the send factories behaviorally unchanged and every pre-existing send test unmodified, which is what guards the refactor.
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.

3 participants