IntersectMBO / IntersectMBO/evolution-sdk
Koios provider: lovelace fields will change from strings to numbers in Koios v1.5
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- TypeScript
- Sterne
- 22
- Forks
- 30
- Ø Merge
- 13 Std.
- Gemergte PRs (30 T.)
- 14
Beschreibung
Koios plans to change how it sends lovelace amounts. Today they come as strings ("2000000"). From Koios v1.5.0 they will come as JSON numbers (2000000). This is a breaking change on their side, with no date yet:
- the caution note in the v1.4.2 release
- cardano-community/koios-artifacts#412
- cardano-community/koios-artifacts#296
Why it matters for evolution-sdk
The Koios provider schemas expect strings for these fields. Some examples in sdk/provider/internal/Koios.ts:
- protocol parameters:
key_deposit,pool_deposit,coins_per_utxo_size,drep_deposit,gov_action_deposit,min_utxo_value,min_pool_cost - UTxOs:
valueand assetquantity - address balance, account
rewards_available, and txfee/deposit
I took today's mainnet /epoch_params response and turned those seven fields into numbers. Decoding it with ProtocolParametersSchema then fails:
gov_action_deposit: NumberFromString — Encoded side transformation failure
So once Koios v1.5 is live, getProtocolParameters() will fail. So will building a transaction that relies on it. I expect the other calls above to fail the same way.
Accepting numbers is not enough on its own. Some lovelace values are bigger than 2^53, like the stake totals. JSON.parse rounds those without any error.
Possible directions
- Ask Koios for text directly: adding
::textinselectworks today and should keep working after v1.5. For example,?select=epoch_no,key_deposit::text. Koios suggests this in their release note. I checked on mainnet: with their preview flag_lovelace_numeric=true,active_stakecomes back as a number, andactive_stake::textturns it back into a string. - Or read the JSON in a way that keeps big numbers exact.
- Tests with numbers in these fields would catch the change before Koios ships it.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne in sdk/provider/internal/Koios.ts und verfolge ProtocolParametersSchema durch getProtocolParameters(); untersuche anschließend die Schemas für UTxOs, Bilanzen, Rewards, Gebühren und Deposits. Reproduziere den Fehler mit numerischen lovelace-Feldern, vergleiche die im Issue beschriebenen Ansätze zum Erhalt der Payload und füge Tests hinzu, die Zahlen in allen betroffenen Feldern verwenden. Als abgeschlossen gilt die Aufgabe, wenn diese Responses ohne Präzisionsverlust dekodiert werden.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- typescript
- Bereich
- api, testing
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Aktiv
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 48/100