Skip to content

Conversation

@Megha-Dev-19
Copy link
Collaborator

@Megha-Dev-19 Megha-Dev-19 commented Dec 29, 2025

image image

@Megha-Dev-19 Megha-Dev-19 marked this pull request as ready for review December 29, 2025 14:12
Copy link
Member

@akorchyn akorchyn left a comment

Choose a reason for hiding this comment

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

Sorry, I'm not ready to merge this. Please use components, and do not create your own implementation for things that could be used from Shadcn or already implemented.

E.g. modal.tsx

We don't want to have 10 implementations of the same things

@Megha-Dev-19 Megha-Dev-19 requested a review from akorchyn January 5, 2026 10:03
@Megha-Dev-19
Copy link
Collaborator Author

Hey @akorchyn,
We're hitting an issue with the REF SDK token metadata API when fetching data for 100+ tokens in the deposit flow.
The Problem:
The API returns inconsistent field naming across different tokens:
Some tokens have defuseAssetId (camelCase)
Some have defuse_asset_id (snake_case)
Some have BOTH in the same object (duplicate keys!)
Example of the inconsistency:

[  {    "defuseAssetId": "nep141:usdt...",    "defuse_asset_id": "nep141:usdt...",  // ❌ Duplicate!    "name": "USDT",    "chainName": "near"  },  {    "defuse_asset_id": "nep141:btc...",   // ✅ Only snake_case    "asset_name": "BTC",    "chain_name": "bitcoin"  },  {    "defuseAssetId": "nep141:eth...",     // ✅ Only camelCase    "name": "Ethereum",    "chainName": "eth"  }]

When serde tries to deserialize this into a struct, it fails with:
Error: duplicate field defuseAssetId
The Solution:
I've added a normalize_token_object() function that:
Detects duplicate fields (both camelCase and snake_case versions)
Removes duplicates, preferring camelCase (matches our struct definitions)
Converts snake_case → camelCase when only snake_case exists

@akorchyn akorchyn merged commit 66cac19 into main Jan 5, 2026
2 checks passed
@akorchyn akorchyn deleted the deposit-address branch January 5, 2026 15:47
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