Skip to content

Testing merge - #4

Closed
CarsonRoscoe wants to merge 5 commits into
coinbase:mainfrom
x402-foundation:main
Closed

CarsonRoscoe wants to merge 5 commits into
coinbase:mainfrom
x402-foundation:main

Conversation

@CarsonRoscoe

Copy link
Copy Markdown

Description

Tests

Checklist

  • I have formatted and linted my code
  • All new and existing tests pass
  • My commits are signed (required for merge) -- you may need to rebase if you initially pushed unsigned commits
  • I added a changelog fragment for user-facing changes (docs-only changes can skip)

* feat: refactor coinbase/x402 references to x402-foundation/x402

* fix: format

* chore: changeset fragments for typescript, python and go
* chore: version typescript packages

* chore: version python package

* chore: version go package
hypeprinter007-stack pushed a commit to hypeprinter007-stack/x402-foundation that referenced this pull request Aug 5, 2026
…foundation#2390)

* feat(concordium): exact mechanism implementation

* feat(concordium): align exact impl with spec + examples

* fix(concordium): address exact mechanism review

* style(concordium): format advanced example readmes

* feat(concordium): add shared e2e testnet coverage

* test(concordium): fix offline facilitator signer mock

* build(typescript): fix x402 CI validation

* fix(concordium): address all PR x402-foundation#2390 review comments

- Build fix: cast ccdNetwork as Network in all_networks.ts (coinbase#29)
- v2-only: getRequiredAmount() returns requirements.amount directly (coinbase#22)
- Remove offline e2e test (coinbase#4)
- Add defaultMoneyConversion() for Concordium native CCD (coinbase#8/coinbase#35)
- Private key support: new overload accepting hex-encoded Ed25519 key (coinbase#11/coinbase#19)
- Client runtime: traced createPaymentPayload path, all guards correct (coinbase#30)
- Tx simulation: addressed as chain limitation, preflightLikelyToSucceed correct (coinbase#3)
- Fix lint: JSDoc completeness for signer overloads, unused param naming

* fix(concordium): update e2e facilitator and integration tests for private key support

- e2e facilitator: support CCD_FACILITATOR_PRIVATE_KEY + CCD_FACILITATOR_ADDRESS
  env vars as preferred path, with wallet export as fallback
- e2e test.config.json: add new CCD env vars to optional list
- Integration tests: support CONCORDIUM_CLIENT_PRIVATE_KEY + CONCORDIUM_CLIENT_ADDRESS
  and CONCORDIUM_FACILITATOR_PRIVATE_KEY + CONCORDIUM_FACILITATOR_ADDRESS
  as alternatives to wallet export files
- Fix integration test expectations: asset field is 'CCD' for native CCD
  (matches actual parseAssetAmount/defaultMoneyConversion behavior)
- Fix AssetAmount pass-through test: amount is converted to atomic units

* fix(concordium): remove sponsor_as_recipient safety check

The check blocked the standard x402 deployment model where the service
provider runs both the facilitator (sponsoring gas) and the server
(receiving payment). No other mechanism (EVM, SVM, Aptos, Hedera,
Stellar, TVM) has this restriction.

Verified with on-chain integration tests:
- wallet 1 → wallet 2 (client pays service provider)
- wallet 2 sponsors the transaction
- Both CCD payment flows confirmed on Concordium testnet

* fix(concordium): pass token decimals from server to client for PLT transfers

Server parseAssetAmount now includes decimals in extra, which flows
through PaymentRequirements.extra to the client. Client buildPltTransfer
reads decimals from requirements.extra and uses it in TokenAmount.create
instead of hardcoding 0.

This fixes the invalid_token_amount_decimals error during facilitator
verification of PLT token payments (e.g. EURR with 6 decimals).

Integration tests: 10/10 pass including on-chain EURR transfer.

* fix(e2e): support CCD private key env vars in e2e test runner

Adds CCD_PRIVATE_KEY + CCD_ADDRESS as an alternative to
CCD_WALLET_PATH across the entire e2e stack:

- ClientConfig + FacilitatorConfig types: new optional fields
- GenericClientProxy + GenericFacilitatorProxy: map to env vars
- FacilitatorManager: pass through from process.env
- fetch + axios clients: prefer private key, fall back to wallet
- e2e/test.ts: read new env vars, OR-logic validation for CCD

Backward compatible: wallet export path still works when
private key vars are not set.

* style(concordium): fix lint and format issues

- Fix corrupted JSDoc in _get_tokens.ts
- Add missing @PARAM decimals description in client scheme
- Fix unused decodedPayload param in checkPayloadSafety (rename to _)
- Fix _decodedPayload → decodedPayload in verify() local variable
- Apply prettier formatting to integration test and server scheme

* test(concordium): add USDR PLT token integration test case

* fix: minimize e2e diff — revert refactoring, keep only Concordium additions

Reverted 7 e2e runtime files to upstream2/main baseline and re-applied
only Concordium-specific additions as localized inserts. Zero existing
code touched — EVM, SVM, and all other chains completely unchanged.

Also:
- Restore EVM/SVM to required in all test.config.json files
- Fix missing/extra braces in fastify Keeta/CCD route blocks
- Fix duplicate ProtocolFamily type in networks.ts + types.ts
- Remove trailing newline in DEFAULT_ASSETS.md
- Revert EVM/SVM ! -> || '' in e2e/test.ts
- Hardcode CCD testnet in facilitator example

E2e runtime diff: 305 lines added (was 2,839 — 89% reduction)
Zero Concordium-related tsc errors. All tests passing.

* test(concordium): expand unit + integration coverage — large amounts, unknown token, asset deduplication

- Unit: 106 tests covering buildCcdTransfer, buildPltTransfer, validation, edge cases
- Integration: 32 tests covering happy path, large amounts, non-existent token, asset dedup
- Total: 138 Concordium tests, all green

* fix(concordium): simplify server scheme and fetch token decimals from RPC

- Server scheme: remove registerAsset, getAsset, getSupportedAssets,
  getSupportedSymbols, parseAssetAmount, assetKey, toWholeUnits,
  isAssetAmount, defaultMoneyConversion, CCD_NATIVE, ConcordiumAssetInfo,
  AssetType (291→140 lines)
- AssetAmount pass-through in atomic units, asset field required (throws
  if missing)
- Money (string/number) throws unless money parser registered — no
  silent CCD fallback
- Client: fetch PLT token decimals from gRPC getTokenInfo instead of
  trusting server-provided metadata
- Update unit + integration tests for new scheme behavior

* fix(concordium): replace CCD_WALLET_PATH with private key + address

- e2e: replace CLIENT_CCD_WALLET_PATH/FACILITATOR_CCD_WALLET_PATH with
  CCD_PRIVATE_KEY + CCD_ADDRESS throughout test runner, clients,
  facilitators, and README
- e2e/README.md: remove Concordium offline e2e section
- examples/clients/advanced: CCD_WALLET_PATH → CCD_PRIVATE_KEY +
  CCD_ADDRESS, parseWallet → buildBasicAccountSigner
- examples/servers/advanced/README.md: simplify Concordium testnet
  funding instructions

* docs(concordium): update README and package metadata for new scheme

- README: remove registerAsset() examples, add AssetAmount +
  registerMoneyParser() patterns, update Amount Format section
- README: fix Supported Assets table (PLT decimals token-dependent),
  wildcard description
- typescript/package.json: reorder devDependencies
- e2e/package.json: minor dependency update

* test(concordium): add unit and integration tests for review round 5 gaps

- Server (7 tests): no-decimals leak, money parser chain, asset required, extra preservation
- Facilitator (6 tests): preflight nonce/balance checks, PLT token balance preflight
- Client (3 tests): decimal edge cases (0, 18, large+6)
- Integration (7 tests): null/undefined/empty asset, no-decimals leak, preflight CCD+PLT, large-amount preflight

Addresses D1-D3, E1, O2 from PR x402-foundation#2390 review round 5

* chore: resolve e2e/pnpm-lock.yaml conflict with upstream/main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

1 participant