feat(pay): attribute every CLI-brokered payment with Tenjin's builder code - #187
feat(pay): attribute every CLI-brokered payment with Tenjin's builder code#187A1igator wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
6491386 to
b1cbb5c
Compare
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
|
Amended per the operator decision on the service-code question: the CLI now claims the existing registered code |
… code buildExactPayment registers the SDK's BuilderCodeClientExtension before it signs, so the payload carries Tenjin's registered code `bc_kc0altv3` in the ERC-8021 `s` (client service) field. buy and pay share that path, and the SDK fires the hook only for sellers whose 402 advertises the standard builder-code extension.
b1cbb5c to
c41880d
Compare
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
|
Rebased onto |
Scope
src/lib/x402-pay.ts:buildExactPaymentregisters the SDK'sBuilderCodeClientExtensionwith Tenjin's registered codebc_kc0altv3before it signs, so every payment the CLI brokers carries the code in the ERC-8021s(client service) field.buyandpayboth sign through this one function, so first-party and Bazaar-lane payments are covered by the same line.builder-codeextension, so a seller who never declared it gets an extension-free payload, andpayload.extensionsis never hand-set. The single-accept binding keepsextensionsthrough its spread, which is the one way this can silently stop working; a test asserts the code survives end to end.src/lib/x402-pay.test.tspins that the authorized from/to/value and the accepted requirement are identical with and without the extension.Why one code, not a CLI-specific second one
Base registers one builder code per account, and ERC-8021 Schema 2 separates the roles structurally: the seller-advertised code lands in
a, the client's ins, the facilitator's inw. So server-side and CLI-side volume stay fully distinguishable on-chain with a single value. A payment to a foreign seller carriesbc_kc0altv3insalone; a first-party buy carries it in bothaands. Tests cover both shapes. No owner action is required: the code is already registered and live on the three web 402s.Testing
pnpm lint,pnpm typecheck,pnpm format:check: clean.pnpm run check(build + full suite): 2190 passed, 10 skipped.src/lib/x402-pay.test.ts(spresent alongside a foreign seller's distincta; both roles filled when Tenjin is also the seller; no extension at all for a non-advertising seller; authorized terms identical either way), 3 insrc/commands/pay.test.ts(tenjin lane advertised and not-advertised, plus a Bazaar-lane pay whose registry-evidence verdict is unchanged), 1 insrc/commands/buy.test.ts(the paid retry's envelope carries the code and still authorizes the advertised price and payee).Definition of Done
builder-codereceives no extension..changeset/cli-builder-code.md).Refs the plan at
tenjin/docs/plans/2026-08-18-cli-vip-discover-builder-code.md(PR A) and #151.Stack: #151 → this PR → #189 (discover pins, based on this branch). This layer shares no file with #158.