Skip to content

feat(examples): add SOL v1 payment send examples - #10120

Open
bhavidhingra wants to merge 1 commit into
masterfrom
bhavi/chalo-1940-sol-v1-examples
Open

bhavidhingra wants to merge 1 commit into
masterfrom
bhavi/chalo-1940-sol-v1-examples

Conversation

@bhavidhingra

Copy link
Copy Markdown
Contributor

Description

Two runnable examples for Solana v1 (SIMD-0296/0385) native SOL payments. They cover the two different claims that keep getting conflated:

File Claim
examples/ts/sol/v1-payment-bitgo-send.ts BitGo builds and broadcasts. Intent carries version: 1, wallet platform produces the 0x81 wire, the SDK signs the txRequest, POST /wallet/{id}/tx/send accepts the signed wire.
examples/ts/sol/v1-payment-broadcast.ts The SDK builds it. V1PaymentBuilder produces a valid v1 wire, the parser round-trips it byte-for-byte, and a node accepts it.

examples/ts/sol/sdk-ct-v1-broadcast.ts already covers the CT variant; there was no plain v1 payment example in the tree (an earlier ad-hoc one was kept untracked and lost).

Both examples assert the things that make a silent v0 fallback impossible:

  • wire[0] === 0x81 and (SDK) wire.length <= 4096
  • txRequest.intent.version === 1 on the intent-bearing prebuild
  • parser round-trip fromRawTransaction → toBroadcastFormat byte-identical (SDK)
  • the cluster reports version: 1 for the landed transaction, read through raw JSON-RPC (web3.js rejects maxSupportedTransactionVersion: 1 client-side)

They also report per stage (PREBUILD / SIGN / SEND / CONFIRM) so a failure names the leg that broke, and v1-payment-broadcast.ts supports DRY_RUN=1 to build and assert without broadcasting.

No production code changes — these are examples under examples/ts/sol/, using the repo's existing conventions (repo-root .env via dotenv, tsx, no hardcoded passphrases).

Issue Number

CHALO-1940 — v1 (0x81) wire could not be deserialized in the /tx/send path. The examples are the reproducible proof for that fix.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Static checks on both files:

tsc --noEmit --strict        → 0 errors
prettier                     → no diff
eslint                       → 0 errors (no-console warnings only, same as the existing examples)

End-to-end on BitGo staging (tsol = devnet), 2026-11-03, after BitGo/bitgo-microservices#63793 reached staging:

[1/4] PREBUILD  v1 wire (411 bytes, hex), txRequest state=pendingUserCommitment, intent.version=1
[2/4] SIGN      signed wire is v1 (411 bytes)
[3/4] SEND      accepted by /tx/send
[4/4] CONFIRM   slot=518234581 version=1

Independently confirmed with raw getTransaction (maxSupportedTransactionVersion: 1):

  • txid 4hp72wPr5eKrj6NzAamCRUgkMpE7ukJQD94pMJVftDv82Jsa77AyYMBcAaLc6U8HN6CxhKSNyD2p7x5enkvEr53t
  • version: 1, slot: 518234581, err: null, fee 10,000 lamports
  • balance deltas [-11000, 0, 0, +1000, 0, 0] — 1,000 lamports transferred, fee exact

To reproduce, see the header of either file. Required env: SOL_WALLET_ID, SOL_WALLET_PASSPHRASE, RECIPIENT (and SOL_DEVNET_RPC for the confirm stage). Note wallet permissions are per-wallet (users[]) — an enterprise token with wallet_spend_all still gets 403 missing required wallet permission on a wallet where the user is view.

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • My code compiles correctly for both Node and Browser environments (types check; examples run under Node via tsx)
  • I have commented my code, particularly in hard-to-understand areas
  • My commits follow Conventional Commits and I have properly described any BREAKING CHANGES
  • The ticket or github issue was included in the commit message as a reference
  • I have made corresponding changes to the documentation and on any new/updated functions and/or methods - jsdoc
  • I have added tests that prove my fix is effective or that my feature works — N/A: example scripts, not a code path; verification is the staging run above
  • New and existing unit tests pass locally with my changes — N/A (no module code touched)

v1-payment-bitgo-send.ts drives the BitGo API path (prebuild version:1 ->
sign -> /tx/send -> confirm) and asserts the 0x81 prefix and intent.version
at prebuild, so a silent v0 fallback cannot read as success.

v1-payment-broadcast.ts covers the SDK-direct counterpart through
V1PaymentBuilder with wire, 4096-byte, round-trip and on-chain version
assertions, plus DRY_RUN.

Both proven on staging 2026-11-03: 411-byte v1 wire, /tx/send 200, devnet
reports version 1 (txid 4hp72wPr...Er53t).

Refs: CHALO-1940
@bhavidhingra
bhavidhingra requested a review from a team as a code owner November 3, 2026 13:49

@claude claude Bot 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.

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

@linear-code

linear-code Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

CHALO-1940

@MohammedRyaan786 MohammedRyaan786 left a comment

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.

LGTM

This branch has not been deployed

No deployments
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