diff --git a/packages/blaze-core/src/params.ts b/packages/blaze-core/src/params.ts index 200c73be..f305af3c 100644 --- a/packages/blaze-core/src/params.ts +++ b/packages/blaze-core/src/params.ts @@ -75,7 +75,7 @@ export const hardCodedProtocolParams: ProtocolParameters = { minPoolCost: 170000000, // The minimum pool cost. protocolVersion: { major: 9, minor: 0 }, // The protocol version. maxValueSize: 5000, // The maximum value size. - collateralPercentage: 150 / 100, // The collateral percentage. + collateralPercentage: 150, // The collateral percentage. maxCollateralInputs: 3, // The maximum collateral inputs. costModels: new Map() // The cost models. .set( diff --git a/packages/blaze-emulator/src/emulator.ts b/packages/blaze-emulator/src/emulator.ts index b75c190b..da93c726 100644 --- a/packages/blaze-emulator/src/emulator.ts +++ b/packages/blaze-emulator/src/emulator.ts @@ -504,7 +504,7 @@ export class Emulator { // Minimum collateral amount included const minCollateral = BigInt( - Math.ceil(this.params.collateralPercentage * Number(body.fee())), + Math.ceil((this.params.collateralPercentage * Number(body.fee())) / 100), ); // If any scripts have been invoked, minimum collateral must be included diff --git a/packages/blaze-query/src/blockfrost.ts b/packages/blaze-query/src/blockfrost.ts index 14c0051d..2991ea3f 100644 --- a/packages/blaze-query/src/blockfrost.ts +++ b/packages/blaze-query/src/blockfrost.ts @@ -112,7 +112,7 @@ export class Blockfrost implements Provider { minor: response.protocol_minor_ver, }, maxValueSize: response.max_val_size, - collateralPercentage: response.collateral_percent / 100, + collateralPercentage: response.collateral_percent, maxCollateralInputs: response.max_collateral_inputs, costModels: costModels, prices: { diff --git a/packages/blaze-query/src/maestro.ts b/packages/blaze-query/src/maestro.ts index e1c8af06..85aea232 100644 --- a/packages/blaze-query/src/maestro.ts +++ b/packages/blaze-query/src/maestro.ts @@ -94,7 +94,7 @@ export class Maestro implements Provider { minPoolCost: params.min_stake_pool_cost.ada.lovelace, protocolVersion: params.version, maxValueSize: params.max_value_size.bytes, - collateralPercentage: params.collateral_percentage / 100, + collateralPercentage: params.collateral_percentage, maxCollateralInputs: params.max_collateral_inputs, costModels: costModels, prices: { diff --git a/packages/blaze-tx/src/tx.ts b/packages/blaze-tx/src/tx.ts index b6eac40e..2c49ea2d 100644 --- a/packages/blaze-tx/src/tx.ts +++ b/packages/blaze-tx/src/tx.ts @@ -1413,8 +1413,9 @@ export class TxBuilder { // Calculate the total collateral based on the transaction fee and collateral percentage. const totalCollateral = BigInt( Math.ceil( - this.params.collateralPercentage * - Number(bigintMax(this.fee, this.minimumFee) + this.feePadding), + (this.params.collateralPercentage * + Number(bigintMax(this.fee, this.minimumFee) + this.feePadding)) / + 100, ), ); // Calculate the collateral value by summing up the amounts from collateral inputs. diff --git a/packages/blaze-uplc/src/utils.ts b/packages/blaze-uplc/src/utils.ts index 2324854a..e5a73038 100644 --- a/packages/blaze-uplc/src/utils.ts +++ b/packages/blaze-uplc/src/utils.ts @@ -7,6 +7,7 @@ import { CborReader, CborWriter, CborReaderState, + PlutusV3Script, } from "@blaze-cardano/core"; import { HexBlob } from "@blaze-cardano/core"; import { UPLCDecoder } from "./decoder"; @@ -123,7 +124,7 @@ export function cborToScript(cbor: string, type: ScriptType): Script { } else if (type === "PlutusV2") { return Script.newPlutusV2Script(new PlutusV2Script(cborHex)); } else { - throw new Error("Unsupported script type"); + return Script.newPlutusV3Script(new PlutusV3Script(cborHex)); } } }