diff --git a/README.md b/README.md index 0941c72..161089b 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,11 @@ optimizeDeps: { import { Maestro, Translucent } from "translucent-cardano"; const translucent = await Translucent.new( - new Maestro({ network: "Mainnet", apiKey: "" }), + new Maestro({ + network: "Mainnet", + apiKey: "", + turboSubmit: true + }), "Mainnet", ); diff --git a/src/provider/maestro.ts b/src/provider/maestro.ts index c290042..a7cf594 100644 --- a/src/provider/maestro.ts +++ b/src/provider/maestro.ts @@ -114,7 +114,9 @@ export class Maestro implements Provider { }); const result: MaestroUtxos = await this.getAllPagesData( async (qry: string) => - await fetch(qry, { headers: this.commonHeaders() }), + await fetch(qry, { + headers: this.requireAmountsAsStrings(this.commonHeaders()), + }), `${this.url}${queryPredicate}/utxos`, qparams, "Location: getUtxosInternal. Error: Could not fetch UTxOs from Maestro", @@ -182,7 +184,7 @@ export class Maestro implements Provider { method: "POST", headers: { "Content-Type": "application/json", - ...this.commonHeaders(), + ...(this.requireAmountsAsStrings(this.commonHeaders())), }, body: body, }), @@ -211,7 +213,7 @@ export class Maestro implements Provider { async getDatum(datumHash: DatumHash): Promise { const timestampedResultResponse = await fetch( - `${this.url}/datum/${datumHash}`, + `${this.url}/datums/${datumHash}`, { headers: this.commonHeaders(), }, @@ -278,6 +280,10 @@ export class Maestro implements Provider { return { "api-key": this.apiKey, translucent: packageJson.version }; } + private requireAmountsAsStrings(obj: { "api-key": string; translucent: string }) { + return { ...obj, "amounts-as-strings": "true" }; + } + private maestroUtxoToUtxo(result: MaestroUtxo): UTxO { return { txHash: result.tx_hash, @@ -356,7 +362,7 @@ type MaestroScript = { type MaestroAsset = { unit: string; - amount: number; + amount: string; }; type MaestroUtxo = {