blockfrost / blockfrost-js

Node.js SDK for the Blockfrost.io API.
https://blockfrost.io
Apache License 2.0
103 stars 25 forks source link

API for execution units evaluation #258

Closed jeffhappily closed 1 year ago

jeffhappily commented 1 year ago

I'm trying to use the execution units evaluation API but I can't seem to find it from the SDK, is it not implemented or did I miss it out?

slowbackspace commented 1 year ago

Hi @jeffhappily, sorry for the late reply. Methods for exec units evaluation were recently added, but are not yet released. If you are interested in trying them I published a beta version @blockfrost/blockfrost-js@5.3.0-beta.0 (changelog)

jeffhappily commented 1 year ago

@slowbackspace May I know what's the usage for the function?

I tried doing this

await bf.utilsTxsEvaluate(tx.to_hex())

tx is from cardano-serialization-lib, but I'm getting this error

{
  type: 'jsonwsp/fault',
  version: '1.0',
  servicename: 'ogmios',
  fault: {
    code: 'client',
    string: 'Invalid request: failed to decode payload from base64 or base16.'
  },
  reflection: { id: '167c0705-b723-42bf-a2ef-2904dae0f2d9' }
}

I even tried encoding the tx in base64 like this

Buffer.from(tx.to_hex()).toString("base64")

But I'm getting another error like this

{
  type: 'jsonwsp/fault',
  version: '1.0',
  servicename: 'ogmios',
  fault: {
    code: 'client',
    string: 'Invalid request: Deserialisation failure while decoding serialised transaction. CBOR failed with error: DeserialiseFailure 0 "end of input".'
  },
  reflection: { id: 'b9f08310-4430-4039-9fe2-d09df7287803' }
}

Did I do something wrong here?

vladimirvolek commented 1 year ago

@jeffhappily What version do you use?

Can you try https://github.com/blockfrost/blockfrost-js/releases/tag/v5.3.1