EstimateCost - read

Estimate current inscribing cost

Script parameters

Key
Required
FType
Description

mimeType

t.String

for 𝔉rc20 use "text/plain"

data

t.String

the data string of each inscription

protocol

t.String

for 𝔉rc20 use "frc20"

Code example

import scEstimateCost from "@fixes/contracts/scripts/estimate-cost.cdc?raw";

async function estimateInscriptionCost(data: string) {
  return await flowSrv.executeScript(
      scEstimateCost,
      (arg, t) => [
        arg("text/plain", t.String),
        arg(data, t.String),
        arg("frc20", t.String),
      ],
      "0.001"
    );
}

Script source code

https://github.com/fixes-world/fixes/blob/main/cadence/scripts/estimate-cost.cdc
import "Fixes"

access(all)
fun main(
    mimeType: String,
    data: String,
    protocol: String
): UFix64 {
    return Fixes.estimateValue(
        index: Fixes.totalInscriptions + 1,
        mimeType: mimeType,
        data: data.utf8,
        protocol: protocol,
        encoding: nil
    ) + 0.0001
}

Last updated