diff --git a/src/provider/maestro.ts b/src/provider/maestro.ts index 26f37113..c2626561 100644 --- a/src/provider/maestro.ts +++ b/src/provider/maestro.ts @@ -109,7 +109,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", @@ -177,7 +179,7 @@ export class Maestro implements Provider { method: "POST", headers: { "Content-Type": "application/json", - ...this.commonHeaders(), + ...(this.requireAmountsAsStrings(this.commonHeaders())), }, body: body, }), @@ -206,7 +208,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(), }, @@ -271,6 +273,10 @@ export class Maestro implements Provider { return { "api-key": this.apiKey, lucid }; } + private requireAmountsAsStrings(obj: { "api-key": string; lucid: string }) { + return { ...obj, "amounts-as-strings": "true" }; + } + private maestroUtxoToUtxo(result: MaestroUtxo): UTxO { return { txHash: result.tx_hash, @@ -344,7 +350,7 @@ type MaestroScript = { type MaestroAsset = { unit: string; - amount: number; + amount: string; }; type MaestroUtxo = {