Skip to content

feat: change cryptoNetwork from string to enum#331

Open
pengying wants to merge 1 commit intomainfrom
04-10-feat_change_cryptonetwork_from_string_to_enum_truncate_environment_postfix
Open

feat: change cryptoNetwork from string to enum#331
pengying wants to merge 1 commit intomainfrom
04-10-feat_change_cryptonetwork_from_string_to_enum_truncate_environment_postfix

Conversation

@pengying
Copy link
Copy Markdown
Contributor

Summary

  • Creates a shared CryptoNetwork enum schema with values: BITCOIN, ETHEREUM, SOLANA, BASE, SPARK, LIGHTNING
  • Environment (mainnet/testnet/devnet) is now determined automatically by the API environment, removing _MAINNET/_TESTNET/_DEVNET/_REGTEST suffixes
  • Updates all 4 schemas that reference cryptoNetwork to use the shared enum (EstimateCryptoWithdrawalFeeRequest, ExternalAccount, ExternalAccountCreateRequest, RealtimeFundingQuoteSource)
  • Full list of networks sourced from webdev's sparklib/money/crypto_network.py

Test plan

  • make build — OpenAPI bundle succeeds
  • make lint-openapi — validation passes
  • Verify API reference renders the enum dropdown correctly on affected endpoints
  • Confirm server-side mapping from truncated values to environment-specific values works

🤖 Generated with Claude Code

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 10, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
grid-flow-builder Ready Ready Preview, Comment Apr 10, 2026 8:00pm

Request Review

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 10, 2026

✱ Stainless preview builds

This PR will update the grid SDKs with the following commit messages.

kotlin

fix(types): change cryptoNetwork to enum in crypto/external account models

openapi

feat(types): add CryptoNetwork type, update external accounts/quotes/withdrawals

python

fix(types): constrain crypto_network to enum across crypto/external_accounts/quotes

typescript

fix(types): change cryptoNetwork to enum in crypto/externalAccounts/quotes

Edit this comment to update them. They will appear in their respective SDK's changelogs.

grid-kotlin studio · code · diff

Your SDK build had at least one "error" diagnostic, but this did not represent a regression.
generate ❗build ✅lint ✅test ✅

grid-openapi studio · code · diff

Your SDK build had at least one "error" diagnostic, but this did not represent a regression.
generate ❗

grid-python studio · code · diff

Your SDK build had at least one "error" diagnostic, but this did not represent a regression.
generate ❗build ✅lint ❗test ✅

pip install https://pkg.stainless.com/s/grid-python/f2372265778e8de9aebc88983026e523bf9b75a4/grid-0.0.1-py3-none-any.whl
grid-typescript studio · code · diff

Your SDK build had at least one "error" diagnostic, but this did not represent a regression.
generate ❗build ✅lint ❗test ✅

npm install https://pkg.stainless.com/s/grid-typescript/85fdd4540e988e4594a28f4852b14266b69d6dc4/dist.tar.gz

This comment is auto-generated by GitHub Actions and is automatically kept up to date as you push.
If you push custom code to the preview branch, re-run this workflow to update the comment.
Last updated: 2026-04-10 20:05:54 UTC

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 10, 2026

Greptile Summary

This PR consolidates four independent inline cryptoNetwork string fields into a single shared CryptoNetwork enum schema (BITCOIN, ETHEREUM, SOLANA, BASE, SPARK, LIGHTNING), removing the old environment-suffixed values (_MAINNET/_TESTNET/_DEVNET/_REGTEST) in favour of automatic environment resolution based on the API endpoint. The bundled files were regenerated via make build and lint passes cleanly.

Confidence Score: 5/5

Safe to merge — clean enum consolidation with no remaining old values anywhere in the spec or docs.

All four schemas are updated consistently, no old suffixed values remain in the codebase, the bundled outputs match the source changes, and lint passes. Previous P2 comments about bare-$ref descriptions have been noted by the team. No new P0/P1 issues found.

No files require special attention.

Important Files Changed

Filename Overview
openapi/components/schemas/crypto/CryptoNetwork.yaml New shared enum schema with 6 values; description includes a clear mainnet/sandbox mapping table.
openapi/components/schemas/crypto/EstimateCryptoWithdrawalFeeRequest.yaml Replaced inline string definition for cryptoNetwork with $ref to shared enum; field remains required.
openapi/components/schemas/external_accounts/ExternalAccount.yaml Swapped cryptoNetwork to use shared $ref; field is correctly kept optional (not in required array).
openapi/components/schemas/external_accounts/ExternalAccountCreateRequest.yaml Swapped cryptoNetwork to use shared $ref; field is correctly optional in the request schema.
openapi/components/schemas/quotes/RealtimeFundingQuoteSource.yaml Uses allOf + $ref pattern with a property-level description — the best pattern of the four updated schemas.
openapi/paths/crypto/crypto_estimate-withdrawal-fee.yaml Example value updated from old suffixed format to SOLANA to match new enum.
openapi.yaml Bundled output correctly reflects the new CryptoNetwork component and all four updated schema references.
mintlify/openapi.yaml Mintlify copy of the bundle updated to match; generated by make build.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[CryptoNetwork.yaml\nenum: BITCOIN, ETHEREUM,\nSOLANA, BASE, SPARK, LIGHTNING] --> B[EstimateCryptoWithdrawalFeeRequest\ncryptoNetwork: required]
    A --> C[ExternalAccount\ncryptoNetwork: optional]
    A --> D[ExternalAccountCreateRequest\ncryptoNetwork: optional]
    A --> E[RealtimeFundingQuoteSource\ncryptoNetwork: optional]

    F[API Environment] -->|production| G[mainnet variant\ne.g. BITCOIN → Bitcoin mainnet]
    F -->|sandbox| H[testnet/devnet variant\ne.g. BITCOIN → Bitcoin testnet]
Loading

Reviews (2): Last reviewed commit: "feat: change cryptoNetwork from string t..." | Re-trigger Greptile

…postfix

Creates a shared CryptoNetwork enum schema with values: BITCOIN, ETHEREUM,
SOLANA, BASE, SPARK, LIGHTNING. The environment (mainnet/testnet) is now
determined by which API environment the request targets, removing the
_MAINNET/_TESTNET/_DEVNET/_REGTEST suffixes.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@pengying pengying force-pushed the 04-10-feat_change_cryptonetwork_from_string_to_enum_truncate_environment_postfix branch from 9528bcb to b09cf0e Compare April 10, 2026 20:00
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.

1 participant