diff --git a/README.md b/README.md
index 367266da..260c4c84 100644
--- a/README.md
+++ b/README.md
@@ -35,14 +35,14 @@ npm install lucid-cardano
For JavaScript and TypeScript
```js
-import { Lucid } from "https://deno.land/x/lucid@0.10.7/mod.ts";
+import { Lucid } from "https://deno.land/x/lucid@0.10.10/mod.ts";
```
#### Web
```html
```
@@ -67,7 +67,7 @@ Outputs a `dist` folder
### Basic usage
```js
-// import { Blockfrost, Lucid } from "https://deno.land/x/lucid@0.10.7/mod.ts"; Deno
+// import { Blockfrost, Lucid } from "https://deno.land/x/lucid@0.10.10/mod.ts"; Deno
import { Blockfrost, Lucid } from "lucid-cardano"; // NPM
const lucid = await Lucid.new(
diff --git a/blueprint.ts b/blueprint.ts
index cf2966ab..cf43ad5a 100644
--- a/blueprint.ts
+++ b/blueprint.ts
@@ -1,4 +1,4 @@
-import packageJson from "./package.json" assert { type: "json" };
+import packageJson from "./package.json" with { type: "json" };
import { parse } from "https://deno.land/std@0.185.0/flags/mod.ts";
const flags = parse(Deno.args, {
diff --git a/build.ts b/build.ts
index 8895e539..4e20961d 100644
--- a/build.ts
+++ b/build.ts
@@ -1,6 +1,6 @@
-import * as dnt from "https://deno.land/x/dnt@0.30.0/mod.ts";
+import * as dnt from "https://deno.land/x/dnt@0.40.0/mod.ts";
import * as esbuild from "https://deno.land/x/esbuild@v0.17.11/mod.js";
-import packageInfo from "./package.json" assert { type: "json" };
+import packageInfo from "./package.json" with { type: "json" };
await dnt.emptyDir("./dist");
diff --git a/deno.json b/deno.json
index ce245b29..b729f3a7 100644
--- a/deno.json
+++ b/deno.json
@@ -7,9 +7,7 @@
"test:core": "cd src/core/libs/cardano_multiplatform_lib && cargo test; cd ../cardano_message_signing && cargo test"
},
"lint": {
- "files": {
- "include": ["src/"],
- "exclude": ["src/core/"]
- }
+ "include": ["src/"],
+ "exclude": ["src/core/"]
}
}
diff --git a/package.json b/package.json
index 925a9938..1ee0d5ed 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "lucid-cardano",
- "version": "0.10.7",
+ "version": "0.10.10",
"license": "MIT",
"author": "Alessandro Konrad",
"description": "Lucid is a library, which allows you to create Cardano transactions and off-chain code for your Plutus contracts in JavaScript, Deno and Node.js.",
diff --git a/src/core/core.ts b/src/core/core.ts
index 86492da1..1c57467a 100644
--- a/src/core/core.ts
+++ b/src/core/core.ts
@@ -1,6 +1,6 @@
import * as C from "./libs/cardano_multiplatform_lib/cardano_multiplatform_lib.generated.js";
import * as M from "./libs/cardano_message_signing/cardano_message_signing.generated.js";
-import packageJson from "../../package.json" assert { type: "json" };
+import packageJson from "../../package.json" with { type: "json" };
async function unsafeInstantiate(module: any, url: string) {
try {
diff --git a/src/core/libs/cardano_message_signing/cardano_message_signing.generated.js b/src/core/libs/cardano_message_signing/cardano_message_signing.generated.js
index 3ea08e81..8e8d98d3 100644
--- a/src/core/libs/cardano_message_signing/cardano_message_signing.generated.js
+++ b/src/core/libs/cardano_message_signing/cardano_message_signing.generated.js
@@ -1144,7 +1144,7 @@ export class COSEEncrypt {
ciphertext() {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
- wasm.coseencrypt0_ciphertext(retptr, this.ptr);
+ wasm.coseencrypt_ciphertext(retptr, this.ptr);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
let v0;
@@ -1745,7 +1745,7 @@ export class COSESign {
payload() {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
- wasm.coseencrypt0_ciphertext(retptr, this.ptr);
+ wasm.coseencrypt_ciphertext(retptr, this.ptr);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
let v0;
@@ -1856,7 +1856,7 @@ export class COSESign1 {
payload() {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
- wasm.coseencrypt0_ciphertext(retptr, this.ptr);
+ wasm.coseencrypt_ciphertext(retptr, this.ptr);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
let v0;
@@ -2154,7 +2154,7 @@ export class COSESignature {
signature() {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
- wasm.cosesignature_signature(retptr, this.ptr);
+ wasm.cosesign1_signature(retptr, this.ptr);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var v0 = getArrayU8FromWasm0(r0, r1).slice();
diff --git a/src/core/libs/cardano_message_signing/cardano_message_signing_bg.wasm b/src/core/libs/cardano_message_signing/cardano_message_signing_bg.wasm
index 005b5601..ad64343d 100644
Binary files a/src/core/libs/cardano_message_signing/cardano_message_signing_bg.wasm and b/src/core/libs/cardano_message_signing/cardano_message_signing_bg.wasm differ
diff --git a/src/core/libs/cardano_message_signing/nodejs/cardano_message_signing.generated.js b/src/core/libs/cardano_message_signing/nodejs/cardano_message_signing.generated.js
index edefd41a..6222db2d 100644
--- a/src/core/libs/cardano_message_signing/nodejs/cardano_message_signing.generated.js
+++ b/src/core/libs/cardano_message_signing/nodejs/cardano_message_signing.generated.js
@@ -1162,7 +1162,7 @@ class COSEEncrypt {
ciphertext() {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
- wasm.coseencrypt0_ciphertext(retptr, this.ptr);
+ wasm.coseencrypt_ciphertext(retptr, this.ptr);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
let v0;
@@ -1768,7 +1768,7 @@ class COSESign {
payload() {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
- wasm.coseencrypt0_ciphertext(retptr, this.ptr);
+ wasm.coseencrypt_ciphertext(retptr, this.ptr);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
let v0;
@@ -1880,7 +1880,7 @@ class COSESign1 {
payload() {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
- wasm.coseencrypt0_ciphertext(retptr, this.ptr);
+ wasm.coseencrypt_ciphertext(retptr, this.ptr);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
let v0;
@@ -2181,7 +2181,7 @@ class COSESignature {
signature() {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
- wasm.cosesignature_signature(retptr, this.ptr);
+ wasm.cosesign1_signature(retptr, this.ptr);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var v0 = getArrayU8FromWasm0(r0, r1).slice();
diff --git a/src/core/libs/cardano_multiplatform_lib/cardano_multiplatform_lib.generated.js b/src/core/libs/cardano_multiplatform_lib/cardano_multiplatform_lib.generated.js
index f403dd59..b284a986 100644
--- a/src/core/libs/cardano_multiplatform_lib/cardano_multiplatform_lib.generated.js
+++ b/src/core/libs/cardano_multiplatform_lib/cardano_multiplatform_lib.generated.js
@@ -1,7 +1,7 @@
// @generated file from wasmbuild -- do not edit
// deno-lint-ignore-file
// deno-fmt-ignore-file
-// source-hash: ab17726f2df5571be15d036e67423022ed8f63e4
+// source-hash: bfd95ebe53d43f00db0f8f58f0273ee50ec6421a
let wasm;
const cachedTextDecoder = new TextDecoder("utf-8", {
@@ -207,12 +207,11 @@ function makeMutClosure(arg0, arg1, dtor, f) {
return real;
}
function __wbg_adapter_30(arg0, arg1, arg2) {
- wasm
- ._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h9de9452916ac8cca(
- arg0,
- arg1,
- addHeapObject(arg2),
- );
+ wasm.wasm_bindgen__convert__closures__invoke1_mut__h9aff1b1babe72eb2(
+ arg0,
+ arg1,
+ addHeapObject(arg2),
+ );
}
function _assertClass(instance, klass) {
@@ -338,15 +337,32 @@ export function decrypt_with_password(password, data) {
* @param {Transaction} tx
* @param {LinearFee} linear_fee
* @param {ExUnitPrices} ex_unit_prices
+ * @param {UnitInterval} minfee_refscript_cost_per_byte
+ * @param {TransactionOutputs} ref_script_outputs
* @returns {BigNum}
*/
-export function min_fee(tx, linear_fee, ex_unit_prices) {
+export function min_fee(
+ tx,
+ linear_fee,
+ ex_unit_prices,
+ minfee_refscript_cost_per_byte,
+ ref_script_outputs,
+) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
_assertClass(tx, Transaction);
_assertClass(linear_fee, LinearFee);
_assertClass(ex_unit_prices, ExUnitPrices);
- wasm.min_fee(retptr, tx.ptr, linear_fee.ptr, ex_unit_prices.ptr);
+ _assertClass(minfee_refscript_cost_per_byte, UnitInterval);
+ _assertClass(ref_script_outputs, TransactionOutputs);
+ wasm.min_fee(
+ retptr,
+ tx.ptr,
+ linear_fee.ptr,
+ ex_unit_prices.ptr,
+ minfee_refscript_cost_per_byte.ptr,
+ ref_script_outputs.ptr,
+ );
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var r2 = getInt32Memory0()[retptr / 4 + 2];
@@ -817,8 +833,8 @@ function handleError(f, args) {
wasm.__wbindgen_exn_store(addHeapObject(e));
}
}
-function __wbg_adapter_1680(arg0, arg1, arg2, arg3) {
- wasm.wasm_bindgen__convert__closures__invoke2_mut__h36afefe016e25d40(
+function __wbg_adapter_1684(arg0, arg1, arg2, arg3) {
+ wasm.wasm_bindgen__convert__closures__invoke2_mut__he7061673dd7691f9(
arg0,
arg1,
addHeapObject(arg2),
@@ -937,8 +953,10 @@ export const RedeemerTagKind = Object.freeze({
"2": "Cert",
Reward: 3,
"3": "Reward",
- Drep: 4,
- "4": "Drep",
+ Voting: 4,
+ "4": "Voting",
+ Proposing: 5,
+ "5": "Proposing",
});
/**
* JSON <-> PlutusData conversion schemas.
@@ -6390,7 +6408,7 @@ export class Ed25519Signature {
to_bytes() {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
- wasm.ed25519signature_to_bytes(retptr, this.ptr);
+ wasm.bip32publickey_as_bytes(retptr, this.ptr);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var v0 = getArrayU8FromWasm0(r0, r1).slice();
@@ -6721,7 +6739,7 @@ export class ExUnits {
* @returns {BigNum}
*/
mem() {
- const ret = wasm.constrplutusdata_alternative(this.ptr);
+ const ret = wasm.exunits_mem(this.ptr);
return BigNum.__wrap(ret);
}
/**
@@ -7935,7 +7953,7 @@ export class GovernanceActionId {
* @returns {BigNum}
*/
governance_action_index() {
- const ret = wasm.constrplutusdata_alternative(this.ptr);
+ const ret = wasm.governanceactionid_governance_action_index(this.ptr);
return BigNum.__wrap(ret);
}
/**
@@ -8391,7 +8409,7 @@ export class HeaderBody {
* @returns {BigNum}
*/
slot() {
- const ret = wasm.constrplutusdata_alternative(this.ptr);
+ const ret = wasm.headerbody_slot(this.ptr);
return BigNum.__wrap(ret);
}
/**
@@ -8658,7 +8676,7 @@ export class Int {
as_i32_or_nothing() {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
- wasm.int_as_i32(retptr, this.ptr);
+ wasm.int_as_i32_or_nothing(retptr, this.ptr);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
return r0 === 0 ? undefined : r1;
@@ -9477,7 +9495,7 @@ export class LegacyDaedalusPrivateKey {
as_bytes() {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
- wasm.legacydaedalusprivatekey_as_bytes(retptr, this.ptr);
+ wasm.bip32privatekey_as_bytes(retptr, this.ptr);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var v0 = getArrayU8FromWasm0(r0, r1).slice();
@@ -9493,7 +9511,7 @@ export class LegacyDaedalusPrivateKey {
chaincode() {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
- wasm.legacydaedalusprivatekey_chaincode(retptr, this.ptr);
+ wasm.bip32privatekey_chaincode(retptr, this.ptr);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var v0 = getArrayU8FromWasm0(r0, r1).slice();
@@ -9532,14 +9550,14 @@ export class LinearFee {
* @returns {BigNum}
*/
constant() {
- const ret = wasm.constrplutusdata_alternative(this.ptr);
+ const ret = wasm.linearfee_constant(this.ptr);
return BigNum.__wrap(ret);
}
/**
* @returns {BigNum}
*/
coefficient() {
- const ret = wasm.exunits_steps(this.ptr);
+ const ret = wasm.linearfee_coefficient(this.ptr);
return BigNum.__wrap(ret);
}
/**
@@ -11819,7 +11837,7 @@ export class NewConstitution {
* @returns {DataHash}
*/
hash() {
- const ret = wasm.newconstitution_hash(this.ptr);
+ const ret = wasm.genesiskeydelegation_vrf_keyhash(this.ptr);
return DataHash.__wrap(ret);
}
/**
@@ -12080,7 +12098,7 @@ export class OperationalCert {
* @returns {number}
*/
sequence_number() {
- const ret = wasm.networkinfo_protocol_magic(this.ptr);
+ const ret = wasm.operationalcert_sequence_number(this.ptr);
return ret >>> 0;
}
/**
@@ -12889,7 +12907,7 @@ export class PlutusWitness {
* @returns {PlutusData}
*/
redeemer() {
- const ret = wasm.data_get(this.ptr);
+ const ret = wasm.plutuswitness_redeemer(this.ptr);
return PlutusData.__wrap(ret);
}
/**
@@ -12948,7 +12966,7 @@ export class Pointer {
* @returns {BigNum}
*/
slot() {
- const ret = wasm.constrplutusdata_alternative(this.ptr);
+ const ret = wasm.exunits_mem(this.ptr);
return BigNum.__wrap(ret);
}
/**
@@ -12962,7 +12980,7 @@ export class Pointer {
* @returns {BigNum}
*/
cert_index() {
- const ret = wasm.pointer_cert_index(this.ptr);
+ const ret = wasm.constrplutusdata_alternative(this.ptr);
return BigNum.__wrap(ret);
}
}
@@ -13484,28 +13502,28 @@ export class PoolParams {
* @returns {VRFKeyHash}
*/
vrf_keyhash() {
- const ret = wasm.poolparams_vrf_keyhash(this.ptr);
+ const ret = wasm.governanceactionid_transaction_id(this.ptr);
return VRFKeyHash.__wrap(ret);
}
/**
* @returns {BigNum}
*/
pledge() {
- const ret = wasm.constrplutusdata_alternative(this.ptr);
+ const ret = wasm.headerbody_slot(this.ptr);
return BigNum.__wrap(ret);
}
/**
* @returns {BigNum}
*/
cost() {
- const ret = wasm.exunits_steps(this.ptr);
+ const ret = wasm.poolparams_cost(this.ptr);
return BigNum.__wrap(ret);
}
/**
* @returns {UnitInterval}
*/
margin() {
- const ret = wasm.drepvotingthresholds_committee_normal(this.ptr);
+ const ret = wasm.drepvotingthresholds_committee_no_confidence(this.ptr);
return UnitInterval.__wrap(ret);
}
/**
@@ -13876,7 +13894,7 @@ export class PoolRetirement {
* @returns {number}
*/
epoch() {
- const ret = wasm.networkinfo_protocol_magic(this.ptr);
+ const ret = wasm.poolretirement_epoch(this.ptr);
return ret >>> 0;
}
/**
@@ -14425,7 +14443,7 @@ export class ProposalProcedure {
* @returns {BigNum}
*/
deposit() {
- const ret = wasm.constrplutusdata_alternative(this.ptr);
+ const ret = wasm.proposalprocedure_deposit(this.ptr);
return BigNum.__wrap(ret);
}
/**
@@ -15402,6 +15420,23 @@ export class ProtocolParamUpdate {
wasm.__wbindgen_add_to_stack_pointer(16);
}
}
+ /**
+ * @param {UnitInterval} minfee_refscript_cost_per_byte
+ */
+ set_minfee_refscript_cost_per_byte(minfee_refscript_cost_per_byte) {
+ _assertClass(minfee_refscript_cost_per_byte, UnitInterval);
+ var ptr0 = minfee_refscript_cost_per_byte.__destroy_into_raw();
+ wasm.protocolparamupdate_set_minfee_refscript_cost_per_byte(this.ptr, ptr0);
+ }
+ /**
+ * @returns {UnitInterval | undefined}
+ */
+ minfee_refscript_cost_per_byte() {
+ const ret = wasm.protocolparamupdate_minfee_refscript_cost_per_byte(
+ this.ptr,
+ );
+ return ret === 0 ? undefined : UnitInterval.__wrap(ret);
+ }
/**
* @returns {ProtocolParamUpdate}
*/
@@ -15549,7 +15584,7 @@ export class ProtocolVersion {
* @returns {number}
*/
minor() {
- const ret = wasm.operationalcert_kes_period(this.ptr);
+ const ret = wasm.protocolversion_minor(this.ptr);
return ret >>> 0;
}
/**
@@ -15828,7 +15863,7 @@ export class Redeemer {
* @returns {ExUnits}
*/
ex_units() {
- const ret = wasm.drepvotingthresholds_update_constitution(this.ptr);
+ const ret = wasm.drepvotingthresholds_motion_no_confidence(this.ptr);
return ExUnits.__wrap(ret);
}
/**
@@ -15939,8 +15974,15 @@ export class RedeemerTag {
/**
* @returns {RedeemerTag}
*/
- static new_drep() {
- const ret = wasm.redeemertag_new_drep();
+ static new_voting() {
+ const ret = wasm.redeemertag_new_voting();
+ return RedeemerTag.__wrap(ret);
+ }
+ /**
+ * @returns {RedeemerTag}
+ */
+ static new_proposing() {
+ const ret = wasm.redeemertag_new_proposing();
return RedeemerTag.__wrap(ret);
}
/**
@@ -15986,7 +16028,7 @@ export class RedeemerWitnessKey {
* @returns {BigNum}
*/
index() {
- const ret = wasm.constrplutusdata_alternative(this.ptr);
+ const ret = wasm.exunits_mem(this.ptr);
return BigNum.__wrap(ret);
}
/**
@@ -16231,7 +16273,7 @@ export class RegCert {
* @returns {BigNum}
*/
coin() {
- const ret = wasm.constrplutusdata_alternative(this.ptr);
+ const ret = wasm.exunits_mem(this.ptr);
return BigNum.__wrap(ret);
}
/**
@@ -16378,14 +16420,14 @@ export class RegCommitteeHotKeyCert {
* @returns {Ed25519KeyHash}
*/
committee_cold_keyhash() {
- const ret = wasm.genesiskeydelegation_genesishash(this.ptr);
+ const ret = wasm.regcommitteehotkeycert_committee_cold_keyhash(this.ptr);
return Ed25519KeyHash.__wrap(ret);
}
/**
* @returns {Ed25519KeyHash}
*/
committee_hot_keyhash() {
- const ret = wasm.genesiskeydelegation_genesis_delegate_hash(this.ptr);
+ const ret = wasm.regcommitteehotkeycert_committee_hot_keyhash(this.ptr);
return Ed25519KeyHash.__wrap(ret);
}
/**
@@ -16542,7 +16584,7 @@ export class RegDrepCert {
* @returns {BigNum}
*/
coin() {
- const ret = wasm.constrplutusdata_alternative(this.ptr);
+ const ret = wasm.exunits_mem(this.ptr);
return BigNum.__wrap(ret);
}
/**
@@ -16935,7 +16977,7 @@ export class RequiredWitnessSet {
*/
add_vkey_key(vkey) {
_assertClass(vkey, Vkey);
- wasm.requiredwitnessset_add_vkey(this.ptr, vkey.ptr);
+ wasm.requiredwitnessset_add_vkey_key(this.ptr, vkey.ptr);
}
/**
* @param {Ed25519KeyHash} hash
@@ -18355,14 +18397,14 @@ export class ScriptNOfK {
* @returns {number}
*/
n() {
- const ret = wasm.networkinfo_protocol_magic(this.ptr);
+ const ret = wasm.scriptnofk_n(this.ptr);
return ret >>> 0;
}
/**
* @returns {NativeScripts}
*/
native_scripts() {
- const ret = wasm.scriptnofk_native_scripts(this.ptr);
+ const ret = wasm.scriptall_native_scripts(this.ptr);
return NativeScripts.__wrap(ret);
}
/**
@@ -18508,7 +18550,7 @@ export class ScriptPubkey {
* @returns {Ed25519KeyHash}
*/
addr_keyhash() {
- const ret = wasm.genesiskeydelegation_genesishash(this.ptr);
+ const ret = wasm.regcommitteehotkeycert_committee_cold_keyhash(this.ptr);
return Ed25519KeyHash.__wrap(ret);
}
/**
@@ -19585,7 +19627,7 @@ export class StakeDelegation {
* @returns {StakeCredential}
*/
stake_credential() {
- const ret = wasm.stakedelegation_stake_credential(this.ptr);
+ const ret = wasm.baseaddress_payment_cred(this.ptr);
return StakeCredential.__wrap(ret);
}
/**
@@ -19742,7 +19784,7 @@ export class StakeDeregistration {
* @returns {StakeCredential}
*/
stake_credential() {
- const ret = wasm.stakedelegation_stake_credential(this.ptr);
+ const ret = wasm.baseaddress_payment_cred(this.ptr);
return StakeCredential.__wrap(ret);
}
/**
@@ -19887,7 +19929,7 @@ export class StakeRegDelegCert {
* @returns {StakeCredential}
*/
stake_credential() {
- const ret = wasm.regcert_stake_credential(this.ptr);
+ const ret = wasm.stakeregdelegcert_stake_credential(this.ptr);
return StakeCredential.__wrap(ret);
}
/**
@@ -19901,7 +19943,7 @@ export class StakeRegDelegCert {
* @returns {BigNum}
*/
coin() {
- const ret = wasm.constrplutusdata_alternative(this.ptr);
+ const ret = wasm.exunits_mem(this.ptr);
return BigNum.__wrap(ret);
}
/**
@@ -20054,7 +20096,7 @@ export class StakeRegistration {
* @returns {StakeCredential}
*/
stake_credential() {
- const ret = wasm.stakedelegation_stake_credential(this.ptr);
+ const ret = wasm.baseaddress_payment_cred(this.ptr);
return StakeCredential.__wrap(ret);
}
/**
@@ -20199,14 +20241,14 @@ export class StakeVoteDelegCert {
* @returns {StakeCredential}
*/
stake_credential() {
- const ret = wasm.stakedelegation_stake_credential(this.ptr);
+ const ret = wasm.baseaddress_payment_cred(this.ptr);
return StakeCredential.__wrap(ret);
}
/**
* @returns {Ed25519KeyHash}
*/
pool_keyhash() {
- const ret = wasm.stakedelegation_pool_keyhash(this.ptr);
+ const ret = wasm.stakevotedelegcert_pool_keyhash(this.ptr);
return Ed25519KeyHash.__wrap(ret);
}
/**
@@ -20366,7 +20408,7 @@ export class StakeVoteRegDelegCert {
* @returns {StakeCredential}
*/
stake_credential() {
- const ret = wasm.regcert_stake_credential(this.ptr);
+ const ret = wasm.stakevoteregdelegcert_stake_credential(this.ptr);
return StakeCredential.__wrap(ret);
}
/**
@@ -20387,7 +20429,7 @@ export class StakeVoteRegDelegCert {
* @returns {BigNum}
*/
coin() {
- const ret = wasm.constrplutusdata_alternative(this.ptr);
+ const ret = wasm.exunits_mem(this.ptr);
return BigNum.__wrap(ret);
}
/**
@@ -20610,7 +20652,7 @@ export class TimelockExpiry {
* @returns {BigNum}
*/
slot() {
- const ret = wasm.constrplutusdata_alternative(this.ptr);
+ const ret = wasm.linearfee_constant(this.ptr);
return BigNum.__wrap(ret);
}
/**
@@ -20619,7 +20661,7 @@ export class TimelockExpiry {
*/
static new(slot) {
_assertClass(slot, BigNum);
- const ret = wasm.constrplutusdata_alternative(slot.ptr);
+ const ret = wasm.exunits_mem(slot.ptr);
return TimelockExpiry.__wrap(ret);
}
}
@@ -20755,7 +20797,7 @@ export class TimelockStart {
* @returns {BigNum}
*/
slot() {
- const ret = wasm.constrplutusdata_alternative(this.ptr);
+ const ret = wasm.linearfee_constant(this.ptr);
return BigNum.__wrap(ret);
}
/**
@@ -20764,7 +20806,7 @@ export class TimelockStart {
*/
static new(slot) {
_assertClass(slot, BigNum);
- const ret = wasm.constrplutusdata_alternative(slot.ptr);
+ const ret = wasm.exunits_mem(slot.ptr);
return TimelockStart.__wrap(ret);
}
}
@@ -21252,7 +21294,7 @@ export class TransactionBody {
* @returns {BigNum}
*/
fee() {
- const ret = wasm.constrplutusdata_alternative(this.ptr);
+ const ret = wasm.transactionbody_fee(this.ptr);
return BigNum.__wrap(ret);
}
/**
@@ -21340,7 +21382,7 @@ export class TransactionBody {
*/
set_validity_start_interval(validity_start_interval) {
_assertClass(validity_start_interval, BigNum);
- wasm.transactionbody_set_validity_start_interval(
+ wasm.protocolparamupdate_set_minfee_b(
this.ptr,
validity_start_interval.ptr,
);
@@ -21349,7 +21391,7 @@ export class TransactionBody {
* @returns {BigNum | undefined}
*/
validity_start_interval() {
- const ret = wasm.transactionbody_validity_start_interval(this.ptr);
+ const ret = wasm.protocolparamupdate_minfee_b(this.ptr);
return ret === 0 ? undefined : BigNum.__wrap(ret);
}
/**
@@ -21441,13 +21483,13 @@ export class TransactionBody {
*/
set_total_collateral(total_collateral) {
_assertClass(total_collateral, BigNum);
- wasm.transactionbody_set_total_collateral(this.ptr, total_collateral.ptr);
+ wasm.protocolparamupdate_set_key_deposit(this.ptr, total_collateral.ptr);
}
/**
* @returns {BigNum | undefined}
*/
total_collateral() {
- const ret = wasm.transactionbody_total_collateral(this.ptr);
+ const ret = wasm.protocolparamupdate_key_deposit(this.ptr);
return ret === 0 ? undefined : BigNum.__wrap(ret);
}
/**
@@ -21726,14 +21768,14 @@ export class TransactionBuilder {
*/
set_ttl(ttl) {
_assertClass(ttl, BigNum);
- wasm.transactionbuilder_set_ttl(this.ptr, ttl.ptr);
+ wasm.protocolparamupdate_set_minfee_b(this.ptr, ttl.ptr);
}
/**
* @param {BigNum} validity_start_interval
*/
set_validity_start_interval(validity_start_interval) {
_assertClass(validity_start_interval, BigNum);
- wasm.transactionbuilder_set_validity_start_interval(
+ wasm.protocolparamupdate_set_key_deposit(
this.ptr,
validity_start_interval.ptr,
);
@@ -22108,7 +22150,7 @@ export class TransactionBuilder {
* @returns {BigNum | undefined}
*/
get_fee_if_set() {
- const ret = wasm.transactionbuilder_get_fee_if_set(this.ptr);
+ const ret = wasm.protocolparamupdate_minfee_a(this.ptr);
return ret === 0 ? undefined : BigNum.__wrap(ret);
}
/**
@@ -22470,6 +22512,19 @@ export class TransactionBuilderConfigBuilder {
);
return TransactionBuilderConfigBuilder.__wrap(ret);
}
+ /**
+ * @param {UnitInterval} minfee_refscript_cost_per_byte
+ * @returns {TransactionBuilderConfigBuilder}
+ */
+ minfee_refscript_cost_per_byte(minfee_refscript_cost_per_byte) {
+ _assertClass(minfee_refscript_cost_per_byte, UnitInterval);
+ const ret = wasm
+ .transactionbuilderconfigbuilder_minfee_refscript_cost_per_byte(
+ this.ptr,
+ minfee_refscript_cost_per_byte.ptr,
+ );
+ return TransactionBuilderConfigBuilder.__wrap(ret);
+ }
/**
* @param {BigNum} zero_time
* @param {BigNum} zero_slot
@@ -22906,7 +22961,7 @@ export class TransactionInput {
* @returns {BigNum}
*/
index() {
- const ret = wasm.constrplutusdata_alternative(this.ptr);
+ const ret = wasm.governanceactionid_governance_action_index(this.ptr);
return BigNum.__wrap(ret);
}
/**
@@ -25116,7 +25171,7 @@ export class UnitInterval {
* @returns {BigNum}
*/
numerator() {
- const ret = wasm.constrplutusdata_alternative(this.ptr);
+ const ret = wasm.exunits_mem(this.ptr);
return BigNum.__wrap(ret);
}
/**
@@ -25285,7 +25340,7 @@ export class UnregCert {
* @returns {BigNum}
*/
coin() {
- const ret = wasm.constrplutusdata_alternative(this.ptr);
+ const ret = wasm.exunits_mem(this.ptr);
return BigNum.__wrap(ret);
}
/**
@@ -25432,7 +25487,7 @@ export class UnregCommitteeHotKeyCert {
* @returns {Ed25519KeyHash}
*/
committee_cold_keyhash() {
- const ret = wasm.genesiskeydelegation_genesishash(this.ptr);
+ const ret = wasm.regcommitteehotkeycert_committee_cold_keyhash(this.ptr);
return Ed25519KeyHash.__wrap(ret);
}
/**
@@ -25584,7 +25639,7 @@ export class UnregDrepCert {
* @returns {BigNum}
*/
coin() {
- const ret = wasm.constrplutusdata_alternative(this.ptr);
+ const ret = wasm.exunits_mem(this.ptr);
return BigNum.__wrap(ret);
}
/**
@@ -26449,7 +26504,7 @@ export class Value {
* @returns {BigNum}
*/
coin() {
- const ret = wasm.constrplutusdata_alternative(this.ptr);
+ const ret = wasm.value_coin(this.ptr);
return BigNum.__wrap(ret);
}
/**
@@ -26808,7 +26863,7 @@ export class Vkeywitness {
* @returns {Vkey}
*/
vkey() {
- const ret = wasm.vkey_new(this.ptr);
+ const ret = wasm.vkeywitness_vkey(this.ptr);
return Vkey.__wrap(ret);
}
/**
@@ -27162,14 +27217,14 @@ export class VoteDelegCert {
* @returns {StakeCredential}
*/
stake_credential() {
- const ret = wasm.stakedelegation_stake_credential(this.ptr);
+ const ret = wasm.baseaddress_payment_cred(this.ptr);
return StakeCredential.__wrap(ret);
}
/**
* @returns {Drep}
*/
drep() {
- const ret = wasm.votedelegcert_drep(this.ptr);
+ const ret = wasm.stakevotedelegcert_drep(this.ptr);
return Drep.__wrap(ret);
}
/**
@@ -27330,7 +27385,7 @@ export class VoteRegDelegCert {
* @returns {BigNum}
*/
coin() {
- const ret = wasm.constrplutusdata_alternative(this.ptr);
+ const ret = wasm.exunits_mem(this.ptr);
return BigNum.__wrap(ret);
}
/**
@@ -27699,7 +27754,7 @@ export class VotingProcedure {
* @returns {GovernanceActionId}
*/
governance_action_id() {
- const ret = wasm.transactionunspentoutput_input(this.ptr);
+ const ret = wasm.votingprocedure_governance_action_id(this.ptr);
return GovernanceActionId.__wrap(ret);
}
/**
@@ -28031,17 +28086,17 @@ const imports = {
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
},
- __wbg_transaction_new: function (arg0) {
- const ret = Transaction.__wrap(arg0);
- return addHeapObject(ret);
- },
__wbg_fetch_16f5dddfc5a913a4: function (arg0, arg1) {
const ret = getObject(arg0).fetch(getObject(arg1));
return addHeapObject(ret);
},
+ __wbg_transaction_new: function (arg0) {
+ const ret = Transaction.__wrap(arg0);
+ return addHeapObject(ret);
+ },
__wbindgen_string_get: function (arg0, arg1) {
const obj = getObject(arg1);
- const ret = typeof (obj) === "string" ? obj : undefined;
+ const ret = typeof obj === "string" ? obj : undefined;
var ptr0 = isLikeNone(ret)
? 0
: passStringToWasm0(
@@ -28103,23 +28158,13 @@ const imports = {
const ret = false;
return ret;
},
- __wbg_randomFillSync_2f6909f8132a175d: function () {
- return handleError(function (arg0, arg1, arg2) {
- getObject(arg0).randomFillSync(getArrayU8FromWasm0(arg1, arg2));
- }, arguments);
- },
- __wbg_getRandomValues_11a236fbf9914290: function () {
- return handleError(function (arg0, arg1) {
- getObject(arg0).getRandomValues(getObject(arg1));
- }, arguments);
- },
__wbg_process_5615a087a47ba544: function (arg0) {
const ret = getObject(arg0).process;
return addHeapObject(ret);
},
__wbindgen_is_object: function (arg0) {
const val = getObject(arg0);
- const ret = typeof (val) === "object" && val !== null;
+ const ret = typeof val === "object" && val !== null;
return ret;
},
__wbg_versions_8404a8b21b9337ae: function (arg0) {
@@ -28152,6 +28197,16 @@ const imports = {
const ret = module;
return addHeapObject(ret);
},
+ __wbg_randomFillSync_2f6909f8132a175d: function () {
+ return handleError(function (arg0, arg1, arg2) {
+ getObject(arg0).randomFillSync(getArrayU8FromWasm0(arg1, arg2));
+ }, arguments);
+ },
+ __wbg_getRandomValues_11a236fbf9914290: function () {
+ return handleError(function (arg0, arg1) {
+ getObject(arg0).getRandomValues(getObject(arg1));
+ }, arguments);
+ },
__wbg_self_e7c1f827057f6584: function () {
return handleError(function () {
const ret = self.self;
@@ -28221,7 +28276,7 @@ const imports = {
const a = state0.a;
state0.a = 0;
try {
- return __wbg_adapter_1680(a, state0.b, arg0, arg1);
+ return __wbg_adapter_1684(a, state0.b, arg0, arg1);
} finally {
state0.a = a;
}
@@ -28279,6 +28334,10 @@ const imports = {
const ret = getObject(arg0).self;
return addHeapObject(ret);
},
+ __wbg_require_0993fe224bf8e202: function (arg0, arg1) {
+ const ret = require(getStringFromWasm0(arg0, arg1));
+ return addHeapObject(ret);
+ },
__wbg_crypto_e95a6e54c5c2e37f: function (arg0) {
const ret = getObject(arg0).crypto;
return addHeapObject(ret);
@@ -28287,10 +28346,6 @@ const imports = {
const ret = getObject(arg0).getRandomValues;
return addHeapObject(ret);
},
- __wbg_require_0993fe224bf8e202: function (arg0, arg1) {
- const ret = require(getStringFromWasm0(arg0, arg1));
- return addHeapObject(ret);
- },
__wbg_randomFillSync_dd2297de5917c74e: function (arg0, arg1, arg2) {
getObject(arg0).randomFillSync(getArrayU8FromWasm0(arg1, arg2));
},
@@ -28315,8 +28370,8 @@ const imports = {
const ret = wasm.memory;
return addHeapObject(ret);
},
- __wbindgen_closure_wrapper7018: function (arg0, arg1, arg2) {
- const ret = makeMutClosure(arg0, arg1, 216, __wbg_adapter_30);
+ __wbindgen_closure_wrapper7045: function (arg0, arg1, arg2) {
+ const ret = makeMutClosure(arg0, arg1, 200, __wbg_adapter_30);
return addHeapObject(ret);
},
},
diff --git a/src/core/libs/cardano_multiplatform_lib/cardano_multiplatform_lib_bg.wasm b/src/core/libs/cardano_multiplatform_lib/cardano_multiplatform_lib_bg.wasm
index c3c2bd39..b2fae0e6 100644
Binary files a/src/core/libs/cardano_multiplatform_lib/cardano_multiplatform_lib_bg.wasm and b/src/core/libs/cardano_multiplatform_lib/cardano_multiplatform_lib_bg.wasm differ
diff --git a/src/core/libs/cardano_multiplatform_lib/nodejs/cardano_multiplatform_lib.generated.js b/src/core/libs/cardano_multiplatform_lib/nodejs/cardano_multiplatform_lib.generated.js
index c3ba5c58..01cfe01b 100644
--- a/src/core/libs/cardano_multiplatform_lib/nodejs/cardano_multiplatform_lib.generated.js
+++ b/src/core/libs/cardano_multiplatform_lib/nodejs/cardano_multiplatform_lib.generated.js
@@ -1,7 +1,7 @@
// @generated file from wasmbuild -- do not edit
// deno-lint-ignore-file
// deno-fmt-ignore-file
-// source-hash: ab17726f2df5571be15d036e67423022ed8f63e4
+// source-hash: bfd95ebe53d43f00db0f8f58f0273ee50ec6421a
let imports = {};
imports["__wbindgen_placeholder__"] = module.exports;
@@ -220,12 +220,11 @@ function makeMutClosure(arg0, arg1, dtor, f) {
return real;
}
function __wbg_adapter_30(arg0, arg1, arg2) {
- wasm
- ._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h9de9452916ac8cca(
- arg0,
- arg1,
- addHeapObject(arg2),
- );
+ wasm.wasm_bindgen__convert__closures__invoke1_mut__h9aff1b1babe72eb2(
+ arg0,
+ arg1,
+ addHeapObject(arg2),
+ );
}
function _assertClass(instance, klass) {
@@ -351,15 +350,32 @@ module.exports.decrypt_with_password = function (password, data) {
* @param {Transaction} tx
* @param {LinearFee} linear_fee
* @param {ExUnitPrices} ex_unit_prices
+ * @param {UnitInterval} minfee_refscript_cost_per_byte
+ * @param {TransactionOutputs} ref_script_outputs
* @returns {BigNum}
*/
-module.exports.min_fee = function (tx, linear_fee, ex_unit_prices) {
+module.exports.min_fee = function (
+ tx,
+ linear_fee,
+ ex_unit_prices,
+ minfee_refscript_cost_per_byte,
+ ref_script_outputs,
+) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
_assertClass(tx, Transaction);
_assertClass(linear_fee, LinearFee);
_assertClass(ex_unit_prices, ExUnitPrices);
- wasm.min_fee(retptr, tx.ptr, linear_fee.ptr, ex_unit_prices.ptr);
+ _assertClass(minfee_refscript_cost_per_byte, UnitInterval);
+ _assertClass(ref_script_outputs, TransactionOutputs);
+ wasm.min_fee(
+ retptr,
+ tx.ptr,
+ linear_fee.ptr,
+ ex_unit_prices.ptr,
+ minfee_refscript_cost_per_byte.ptr,
+ ref_script_outputs.ptr,
+ );
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var r2 = getInt32Memory0()[retptr / 4 + 2];
@@ -849,8 +865,8 @@ function handleError(f, args) {
wasm.__wbindgen_exn_store(addHeapObject(e));
}
}
-function __wbg_adapter_1680(arg0, arg1, arg2, arg3) {
- wasm.wasm_bindgen__convert__closures__invoke2_mut__h36afefe016e25d40(
+function __wbg_adapter_1684(arg0, arg1, arg2, arg3) {
+ wasm.wasm_bindgen__convert__closures__invoke2_mut__he7061673dd7691f9(
arg0,
arg1,
addHeapObject(arg2),
@@ -969,8 +985,10 @@ module.exports.RedeemerTagKind = Object.freeze({
"2": "Cert",
Reward: 3,
"3": "Reward",
- Drep: 4,
- "4": "Drep",
+ Voting: 4,
+ "4": "Voting",
+ Proposing: 5,
+ "5": "Proposing",
});
/**
* JSON <-> PlutusData conversion schemas.
@@ -6455,7 +6473,7 @@ class Ed25519Signature {
to_bytes() {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
- wasm.ed25519signature_to_bytes(retptr, this.ptr);
+ wasm.bip32publickey_as_bytes(retptr, this.ptr);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var v0 = getArrayU8FromWasm0(r0, r1).slice();
@@ -6789,7 +6807,7 @@ class ExUnits {
* @returns {BigNum}
*/
mem() {
- const ret = wasm.constrplutusdata_alternative(this.ptr);
+ const ret = wasm.exunits_mem(this.ptr);
return BigNum.__wrap(ret);
}
/**
@@ -8010,7 +8028,7 @@ class GovernanceActionId {
* @returns {BigNum}
*/
governance_action_index() {
- const ret = wasm.constrplutusdata_alternative(this.ptr);
+ const ret = wasm.governanceactionid_governance_action_index(this.ptr);
return BigNum.__wrap(ret);
}
/**
@@ -8469,7 +8487,7 @@ class HeaderBody {
* @returns {BigNum}
*/
slot() {
- const ret = wasm.constrplutusdata_alternative(this.ptr);
+ const ret = wasm.headerbody_slot(this.ptr);
return BigNum.__wrap(ret);
}
/**
@@ -8737,7 +8755,7 @@ class Int {
as_i32_or_nothing() {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
- wasm.int_as_i32(retptr, this.ptr);
+ wasm.int_as_i32_or_nothing(retptr, this.ptr);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
return r0 === 0 ? undefined : r1;
@@ -9563,7 +9581,7 @@ class LegacyDaedalusPrivateKey {
as_bytes() {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
- wasm.legacydaedalusprivatekey_as_bytes(retptr, this.ptr);
+ wasm.bip32privatekey_as_bytes(retptr, this.ptr);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var v0 = getArrayU8FromWasm0(r0, r1).slice();
@@ -9579,7 +9597,7 @@ class LegacyDaedalusPrivateKey {
chaincode() {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
- wasm.legacydaedalusprivatekey_chaincode(retptr, this.ptr);
+ wasm.bip32privatekey_chaincode(retptr, this.ptr);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var v0 = getArrayU8FromWasm0(r0, r1).slice();
@@ -9619,14 +9637,14 @@ class LinearFee {
* @returns {BigNum}
*/
constant() {
- const ret = wasm.constrplutusdata_alternative(this.ptr);
+ const ret = wasm.linearfee_constant(this.ptr);
return BigNum.__wrap(ret);
}
/**
* @returns {BigNum}
*/
coefficient() {
- const ret = wasm.exunits_steps(this.ptr);
+ const ret = wasm.linearfee_coefficient(this.ptr);
return BigNum.__wrap(ret);
}
/**
@@ -11921,7 +11939,7 @@ class NewConstitution {
* @returns {DataHash}
*/
hash() {
- const ret = wasm.newconstitution_hash(this.ptr);
+ const ret = wasm.genesiskeydelegation_vrf_keyhash(this.ptr);
return DataHash.__wrap(ret);
}
/**
@@ -12184,7 +12202,7 @@ class OperationalCert {
* @returns {number}
*/
sequence_number() {
- const ret = wasm.networkinfo_protocol_magic(this.ptr);
+ const ret = wasm.operationalcert_sequence_number(this.ptr);
return ret >>> 0;
}
/**
@@ -13000,7 +13018,7 @@ class PlutusWitness {
* @returns {PlutusData}
*/
redeemer() {
- const ret = wasm.data_get(this.ptr);
+ const ret = wasm.plutuswitness_redeemer(this.ptr);
return PlutusData.__wrap(ret);
}
/**
@@ -13060,7 +13078,7 @@ class Pointer {
* @returns {BigNum}
*/
slot() {
- const ret = wasm.constrplutusdata_alternative(this.ptr);
+ const ret = wasm.exunits_mem(this.ptr);
return BigNum.__wrap(ret);
}
/**
@@ -13074,7 +13092,7 @@ class Pointer {
* @returns {BigNum}
*/
cert_index() {
- const ret = wasm.pointer_cert_index(this.ptr);
+ const ret = wasm.constrplutusdata_alternative(this.ptr);
return BigNum.__wrap(ret);
}
}
@@ -13600,28 +13618,28 @@ class PoolParams {
* @returns {VRFKeyHash}
*/
vrf_keyhash() {
- const ret = wasm.poolparams_vrf_keyhash(this.ptr);
+ const ret = wasm.governanceactionid_transaction_id(this.ptr);
return VRFKeyHash.__wrap(ret);
}
/**
* @returns {BigNum}
*/
pledge() {
- const ret = wasm.constrplutusdata_alternative(this.ptr);
+ const ret = wasm.headerbody_slot(this.ptr);
return BigNum.__wrap(ret);
}
/**
* @returns {BigNum}
*/
cost() {
- const ret = wasm.exunits_steps(this.ptr);
+ const ret = wasm.poolparams_cost(this.ptr);
return BigNum.__wrap(ret);
}
/**
* @returns {UnitInterval}
*/
margin() {
- const ret = wasm.drepvotingthresholds_committee_normal(this.ptr);
+ const ret = wasm.drepvotingthresholds_committee_no_confidence(this.ptr);
return UnitInterval.__wrap(ret);
}
/**
@@ -13994,7 +14012,7 @@ class PoolRetirement {
* @returns {number}
*/
epoch() {
- const ret = wasm.networkinfo_protocol_magic(this.ptr);
+ const ret = wasm.poolretirement_epoch(this.ptr);
return ret >>> 0;
}
/**
@@ -14546,7 +14564,7 @@ class ProposalProcedure {
* @returns {BigNum}
*/
deposit() {
- const ret = wasm.constrplutusdata_alternative(this.ptr);
+ const ret = wasm.proposalprocedure_deposit(this.ptr);
return BigNum.__wrap(ret);
}
/**
@@ -15527,6 +15545,23 @@ class ProtocolParamUpdate {
wasm.__wbindgen_add_to_stack_pointer(16);
}
}
+ /**
+ * @param {UnitInterval} minfee_refscript_cost_per_byte
+ */
+ set_minfee_refscript_cost_per_byte(minfee_refscript_cost_per_byte) {
+ _assertClass(minfee_refscript_cost_per_byte, UnitInterval);
+ var ptr0 = minfee_refscript_cost_per_byte.__destroy_into_raw();
+ wasm.protocolparamupdate_set_minfee_refscript_cost_per_byte(this.ptr, ptr0);
+ }
+ /**
+ * @returns {UnitInterval | undefined}
+ */
+ minfee_refscript_cost_per_byte() {
+ const ret = wasm.protocolparamupdate_minfee_refscript_cost_per_byte(
+ this.ptr,
+ );
+ return ret === 0 ? undefined : UnitInterval.__wrap(ret);
+ }
/**
* @returns {ProtocolParamUpdate}
*/
@@ -15675,7 +15710,7 @@ class ProtocolVersion {
* @returns {number}
*/
minor() {
- const ret = wasm.operationalcert_kes_period(this.ptr);
+ const ret = wasm.protocolversion_minor(this.ptr);
return ret >>> 0;
}
/**
@@ -15957,7 +15992,7 @@ class Redeemer {
* @returns {ExUnits}
*/
ex_units() {
- const ret = wasm.drepvotingthresholds_update_constitution(this.ptr);
+ const ret = wasm.drepvotingthresholds_motion_no_confidence(this.ptr);
return ExUnits.__wrap(ret);
}
/**
@@ -16069,8 +16104,15 @@ class RedeemerTag {
/**
* @returns {RedeemerTag}
*/
- static new_drep() {
- const ret = wasm.redeemertag_new_drep();
+ static new_voting() {
+ const ret = wasm.redeemertag_new_voting();
+ return RedeemerTag.__wrap(ret);
+ }
+ /**
+ * @returns {RedeemerTag}
+ */
+ static new_proposing() {
+ const ret = wasm.redeemertag_new_proposing();
return RedeemerTag.__wrap(ret);
}
/**
@@ -16117,7 +16159,7 @@ class RedeemerWitnessKey {
* @returns {BigNum}
*/
index() {
- const ret = wasm.constrplutusdata_alternative(this.ptr);
+ const ret = wasm.exunits_mem(this.ptr);
return BigNum.__wrap(ret);
}
/**
@@ -16364,7 +16406,7 @@ class RegCert {
* @returns {BigNum}
*/
coin() {
- const ret = wasm.constrplutusdata_alternative(this.ptr);
+ const ret = wasm.exunits_mem(this.ptr);
return BigNum.__wrap(ret);
}
/**
@@ -16512,14 +16554,14 @@ class RegCommitteeHotKeyCert {
* @returns {Ed25519KeyHash}
*/
committee_cold_keyhash() {
- const ret = wasm.genesiskeydelegation_genesishash(this.ptr);
+ const ret = wasm.regcommitteehotkeycert_committee_cold_keyhash(this.ptr);
return Ed25519KeyHash.__wrap(ret);
}
/**
* @returns {Ed25519KeyHash}
*/
committee_hot_keyhash() {
- const ret = wasm.genesiskeydelegation_genesis_delegate_hash(this.ptr);
+ const ret = wasm.regcommitteehotkeycert_committee_hot_keyhash(this.ptr);
return Ed25519KeyHash.__wrap(ret);
}
/**
@@ -16677,7 +16719,7 @@ class RegDrepCert {
* @returns {BigNum}
*/
coin() {
- const ret = wasm.constrplutusdata_alternative(this.ptr);
+ const ret = wasm.exunits_mem(this.ptr);
return BigNum.__wrap(ret);
}
/**
@@ -17073,7 +17115,7 @@ class RequiredWitnessSet {
*/
add_vkey_key(vkey) {
_assertClass(vkey, Vkey);
- wasm.requiredwitnessset_add_vkey(this.ptr, vkey.ptr);
+ wasm.requiredwitnessset_add_vkey_key(this.ptr, vkey.ptr);
}
/**
* @param {Ed25519KeyHash} hash
@@ -18502,14 +18544,14 @@ class ScriptNOfK {
* @returns {number}
*/
n() {
- const ret = wasm.networkinfo_protocol_magic(this.ptr);
+ const ret = wasm.scriptnofk_n(this.ptr);
return ret >>> 0;
}
/**
* @returns {NativeScripts}
*/
native_scripts() {
- const ret = wasm.scriptnofk_native_scripts(this.ptr);
+ const ret = wasm.scriptall_native_scripts(this.ptr);
return NativeScripts.__wrap(ret);
}
/**
@@ -18656,7 +18698,7 @@ class ScriptPubkey {
* @returns {Ed25519KeyHash}
*/
addr_keyhash() {
- const ret = wasm.genesiskeydelegation_genesishash(this.ptr);
+ const ret = wasm.regcommitteehotkeycert_committee_cold_keyhash(this.ptr);
return Ed25519KeyHash.__wrap(ret);
}
/**
@@ -19740,7 +19782,7 @@ class StakeDelegation {
* @returns {StakeCredential}
*/
stake_credential() {
- const ret = wasm.stakedelegation_stake_credential(this.ptr);
+ const ret = wasm.baseaddress_payment_cred(this.ptr);
return StakeCredential.__wrap(ret);
}
/**
@@ -19898,7 +19940,7 @@ class StakeDeregistration {
* @returns {StakeCredential}
*/
stake_credential() {
- const ret = wasm.stakedelegation_stake_credential(this.ptr);
+ const ret = wasm.baseaddress_payment_cred(this.ptr);
return StakeCredential.__wrap(ret);
}
/**
@@ -20044,7 +20086,7 @@ class StakeRegDelegCert {
* @returns {StakeCredential}
*/
stake_credential() {
- const ret = wasm.regcert_stake_credential(this.ptr);
+ const ret = wasm.stakeregdelegcert_stake_credential(this.ptr);
return StakeCredential.__wrap(ret);
}
/**
@@ -20058,7 +20100,7 @@ class StakeRegDelegCert {
* @returns {BigNum}
*/
coin() {
- const ret = wasm.constrplutusdata_alternative(this.ptr);
+ const ret = wasm.exunits_mem(this.ptr);
return BigNum.__wrap(ret);
}
/**
@@ -20212,7 +20254,7 @@ class StakeRegistration {
* @returns {StakeCredential}
*/
stake_credential() {
- const ret = wasm.stakedelegation_stake_credential(this.ptr);
+ const ret = wasm.baseaddress_payment_cred(this.ptr);
return StakeCredential.__wrap(ret);
}
/**
@@ -20358,14 +20400,14 @@ class StakeVoteDelegCert {
* @returns {StakeCredential}
*/
stake_credential() {
- const ret = wasm.stakedelegation_stake_credential(this.ptr);
+ const ret = wasm.baseaddress_payment_cred(this.ptr);
return StakeCredential.__wrap(ret);
}
/**
* @returns {Ed25519KeyHash}
*/
pool_keyhash() {
- const ret = wasm.stakedelegation_pool_keyhash(this.ptr);
+ const ret = wasm.stakevotedelegcert_pool_keyhash(this.ptr);
return Ed25519KeyHash.__wrap(ret);
}
/**
@@ -20526,7 +20568,7 @@ class StakeVoteRegDelegCert {
* @returns {StakeCredential}
*/
stake_credential() {
- const ret = wasm.regcert_stake_credential(this.ptr);
+ const ret = wasm.stakevoteregdelegcert_stake_credential(this.ptr);
return StakeCredential.__wrap(ret);
}
/**
@@ -20547,7 +20589,7 @@ class StakeVoteRegDelegCert {
* @returns {BigNum}
*/
coin() {
- const ret = wasm.constrplutusdata_alternative(this.ptr);
+ const ret = wasm.exunits_mem(this.ptr);
return BigNum.__wrap(ret);
}
/**
@@ -20772,7 +20814,7 @@ class TimelockExpiry {
* @returns {BigNum}
*/
slot() {
- const ret = wasm.constrplutusdata_alternative(this.ptr);
+ const ret = wasm.linearfee_constant(this.ptr);
return BigNum.__wrap(ret);
}
/**
@@ -20781,7 +20823,7 @@ class TimelockExpiry {
*/
static new(slot) {
_assertClass(slot, BigNum);
- const ret = wasm.constrplutusdata_alternative(slot.ptr);
+ const ret = wasm.exunits_mem(slot.ptr);
return TimelockExpiry.__wrap(ret);
}
}
@@ -20918,7 +20960,7 @@ class TimelockStart {
* @returns {BigNum}
*/
slot() {
- const ret = wasm.constrplutusdata_alternative(this.ptr);
+ const ret = wasm.linearfee_constant(this.ptr);
return BigNum.__wrap(ret);
}
/**
@@ -20927,7 +20969,7 @@ class TimelockStart {
*/
static new(slot) {
_assertClass(slot, BigNum);
- const ret = wasm.constrplutusdata_alternative(slot.ptr);
+ const ret = wasm.exunits_mem(slot.ptr);
return TimelockStart.__wrap(ret);
}
}
@@ -21418,7 +21460,7 @@ class TransactionBody {
* @returns {BigNum}
*/
fee() {
- const ret = wasm.constrplutusdata_alternative(this.ptr);
+ const ret = wasm.transactionbody_fee(this.ptr);
return BigNum.__wrap(ret);
}
/**
@@ -21506,7 +21548,7 @@ class TransactionBody {
*/
set_validity_start_interval(validity_start_interval) {
_assertClass(validity_start_interval, BigNum);
- wasm.transactionbody_set_validity_start_interval(
+ wasm.protocolparamupdate_set_minfee_b(
this.ptr,
validity_start_interval.ptr,
);
@@ -21515,7 +21557,7 @@ class TransactionBody {
* @returns {BigNum | undefined}
*/
validity_start_interval() {
- const ret = wasm.transactionbody_validity_start_interval(this.ptr);
+ const ret = wasm.protocolparamupdate_minfee_b(this.ptr);
return ret === 0 ? undefined : BigNum.__wrap(ret);
}
/**
@@ -21607,13 +21649,13 @@ class TransactionBody {
*/
set_total_collateral(total_collateral) {
_assertClass(total_collateral, BigNum);
- wasm.transactionbody_set_total_collateral(this.ptr, total_collateral.ptr);
+ wasm.protocolparamupdate_set_key_deposit(this.ptr, total_collateral.ptr);
}
/**
* @returns {BigNum | undefined}
*/
total_collateral() {
- const ret = wasm.transactionbody_total_collateral(this.ptr);
+ const ret = wasm.protocolparamupdate_key_deposit(this.ptr);
return ret === 0 ? undefined : BigNum.__wrap(ret);
}
/**
@@ -21893,14 +21935,14 @@ class TransactionBuilder {
*/
set_ttl(ttl) {
_assertClass(ttl, BigNum);
- wasm.transactionbuilder_set_ttl(this.ptr, ttl.ptr);
+ wasm.protocolparamupdate_set_minfee_b(this.ptr, ttl.ptr);
}
/**
* @param {BigNum} validity_start_interval
*/
set_validity_start_interval(validity_start_interval) {
_assertClass(validity_start_interval, BigNum);
- wasm.transactionbuilder_set_validity_start_interval(
+ wasm.protocolparamupdate_set_key_deposit(
this.ptr,
validity_start_interval.ptr,
);
@@ -22275,7 +22317,7 @@ class TransactionBuilder {
* @returns {BigNum | undefined}
*/
get_fee_if_set() {
- const ret = wasm.transactionbuilder_get_fee_if_set(this.ptr);
+ const ret = wasm.protocolparamupdate_minfee_a(this.ptr);
return ret === 0 ? undefined : BigNum.__wrap(ret);
}
/**
@@ -22639,6 +22681,19 @@ class TransactionBuilderConfigBuilder {
);
return TransactionBuilderConfigBuilder.__wrap(ret);
}
+ /**
+ * @param {UnitInterval} minfee_refscript_cost_per_byte
+ * @returns {TransactionBuilderConfigBuilder}
+ */
+ minfee_refscript_cost_per_byte(minfee_refscript_cost_per_byte) {
+ _assertClass(minfee_refscript_cost_per_byte, UnitInterval);
+ const ret = wasm
+ .transactionbuilderconfigbuilder_minfee_refscript_cost_per_byte(
+ this.ptr,
+ minfee_refscript_cost_per_byte.ptr,
+ );
+ return TransactionBuilderConfigBuilder.__wrap(ret);
+ }
/**
* @param {BigNum} zero_time
* @param {BigNum} zero_slot
@@ -23079,7 +23134,7 @@ class TransactionInput {
* @returns {BigNum}
*/
index() {
- const ret = wasm.constrplutusdata_alternative(this.ptr);
+ const ret = wasm.governanceactionid_governance_action_index(this.ptr);
return BigNum.__wrap(ret);
}
/**
@@ -25304,7 +25359,7 @@ class UnitInterval {
* @returns {BigNum}
*/
numerator() {
- const ret = wasm.constrplutusdata_alternative(this.ptr);
+ const ret = wasm.exunits_mem(this.ptr);
return BigNum.__wrap(ret);
}
/**
@@ -25474,7 +25529,7 @@ class UnregCert {
* @returns {BigNum}
*/
coin() {
- const ret = wasm.constrplutusdata_alternative(this.ptr);
+ const ret = wasm.exunits_mem(this.ptr);
return BigNum.__wrap(ret);
}
/**
@@ -25622,7 +25677,7 @@ class UnregCommitteeHotKeyCert {
* @returns {Ed25519KeyHash}
*/
committee_cold_keyhash() {
- const ret = wasm.genesiskeydelegation_genesishash(this.ptr);
+ const ret = wasm.regcommitteehotkeycert_committee_cold_keyhash(this.ptr);
return Ed25519KeyHash.__wrap(ret);
}
/**
@@ -25775,7 +25830,7 @@ class UnregDrepCert {
* @returns {BigNum}
*/
coin() {
- const ret = wasm.constrplutusdata_alternative(this.ptr);
+ const ret = wasm.exunits_mem(this.ptr);
return BigNum.__wrap(ret);
}
/**
@@ -26646,7 +26701,7 @@ class Value {
* @returns {BigNum}
*/
coin() {
- const ret = wasm.constrplutusdata_alternative(this.ptr);
+ const ret = wasm.value_coin(this.ptr);
return BigNum.__wrap(ret);
}
/**
@@ -27008,7 +27063,7 @@ class Vkeywitness {
* @returns {Vkey}
*/
vkey() {
- const ret = wasm.vkey_new(this.ptr);
+ const ret = wasm.vkeywitness_vkey(this.ptr);
return Vkey.__wrap(ret);
}
/**
@@ -27365,14 +27420,14 @@ class VoteDelegCert {
* @returns {StakeCredential}
*/
stake_credential() {
- const ret = wasm.stakedelegation_stake_credential(this.ptr);
+ const ret = wasm.baseaddress_payment_cred(this.ptr);
return StakeCredential.__wrap(ret);
}
/**
* @returns {Drep}
*/
drep() {
- const ret = wasm.votedelegcert_drep(this.ptr);
+ const ret = wasm.stakevotedelegcert_drep(this.ptr);
return Drep.__wrap(ret);
}
/**
@@ -27534,7 +27589,7 @@ class VoteRegDelegCert {
* @returns {BigNum}
*/
coin() {
- const ret = wasm.constrplutusdata_alternative(this.ptr);
+ const ret = wasm.exunits_mem(this.ptr);
return BigNum.__wrap(ret);
}
/**
@@ -27905,7 +27960,7 @@ class VotingProcedure {
* @returns {GovernanceActionId}
*/
governance_action_id() {
- const ret = wasm.transactionunspentoutput_input(this.ptr);
+ const ret = wasm.votingprocedure_governance_action_id(this.ptr);
return GovernanceActionId.__wrap(ret);
}
/**
@@ -28242,19 +28297,19 @@ module.exports.__wbindgen_json_serialize = function (arg0, arg1) {
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
};
-module.exports.__wbg_transaction_new = function (arg0) {
- const ret = Transaction.__wrap(arg0);
+module.exports.__wbg_fetch_16f5dddfc5a913a4 = function (arg0, arg1) {
+ const ret = getObject(arg0).fetch(getObject(arg1));
return addHeapObject(ret);
};
-module.exports.__wbg_fetch_16f5dddfc5a913a4 = function (arg0, arg1) {
- const ret = getObject(arg0).fetch(getObject(arg1));
+module.exports.__wbg_transaction_new = function (arg0) {
+ const ret = Transaction.__wrap(arg0);
return addHeapObject(ret);
};
module.exports.__wbindgen_string_get = function (arg0, arg1) {
const obj = getObject(arg1);
- const ret = typeof (obj) === "string" ? obj : undefined;
+ const ret = typeof obj === "string" ? obj : undefined;
var ptr0 = isLikeNone(ret)
? 0
: passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
@@ -28317,18 +28372,6 @@ module.exports.__wbindgen_cb_drop = function (arg0) {
return ret;
};
-module.exports.__wbg_randomFillSync_2f6909f8132a175d = function () {
- return handleError(function (arg0, arg1, arg2) {
- getObject(arg0).randomFillSync(getArrayU8FromWasm0(arg1, arg2));
- }, arguments);
-};
-
-module.exports.__wbg_getRandomValues_11a236fbf9914290 = function () {
- return handleError(function (arg0, arg1) {
- getObject(arg0).getRandomValues(getObject(arg1));
- }, arguments);
-};
-
module.exports.__wbg_process_5615a087a47ba544 = function (arg0) {
const ret = getObject(arg0).process;
return addHeapObject(ret);
@@ -28336,7 +28379,7 @@ module.exports.__wbg_process_5615a087a47ba544 = function (arg0) {
module.exports.__wbindgen_is_object = function (arg0) {
const val = getObject(arg0);
- const ret = typeof (val) === "object" && val !== null;
+ const ret = typeof val === "object" && val !== null;
return ret;
};
@@ -28378,6 +28421,18 @@ module.exports.__wbg_static_accessor_NODE_MODULE_06b864c18e8ae506 =
return addHeapObject(ret);
};
+module.exports.__wbg_randomFillSync_2f6909f8132a175d = function () {
+ return handleError(function (arg0, arg1, arg2) {
+ getObject(arg0).randomFillSync(getArrayU8FromWasm0(arg1, arg2));
+ }, arguments);
+};
+
+module.exports.__wbg_getRandomValues_11a236fbf9914290 = function () {
+ return handleError(function (arg0, arg1) {
+ getObject(arg0).getRandomValues(getObject(arg1));
+ }, arguments);
+};
+
module.exports.__wbg_self_e7c1f827057f6584 = function () {
return handleError(function () {
const ret = self.self;
@@ -28454,7 +28509,7 @@ module.exports.__wbg_new_9d3a9ce4282a18a8 = function (arg0, arg1) {
const a = state0.a;
state0.a = 0;
try {
- return __wbg_adapter_1680(a, state0.b, arg0, arg1);
+ return __wbg_adapter_1684(a, state0.b, arg0, arg1);
} finally {
state0.a = a;
}
@@ -28525,6 +28580,11 @@ module.exports.__wbg_self_e0b3266d2d9eba1a = function (arg0) {
return addHeapObject(ret);
};
+module.exports.__wbg_require_0993fe224bf8e202 = function (arg0, arg1) {
+ const ret = require(getStringFromWasm0(arg0, arg1));
+ return addHeapObject(ret);
+};
+
module.exports.__wbg_crypto_e95a6e54c5c2e37f = function (arg0) {
const ret = getObject(arg0).crypto;
return addHeapObject(ret);
@@ -28535,11 +28595,6 @@ module.exports.__wbg_getRandomValues_dc67302a7bd1aec5 = function (arg0) {
return addHeapObject(ret);
};
-module.exports.__wbg_require_0993fe224bf8e202 = function (arg0, arg1) {
- const ret = require(getStringFromWasm0(arg0, arg1));
- return addHeapObject(ret);
-};
-
module.exports.__wbg_randomFillSync_dd2297de5917c74e = function (
arg0,
arg1,
@@ -28577,8 +28632,8 @@ module.exports.__wbindgen_memory = function () {
return addHeapObject(ret);
};
-module.exports.__wbindgen_closure_wrapper7018 = function (arg0, arg1, arg2) {
- const ret = makeMutClosure(arg0, arg1, 216, __wbg_adapter_30);
+module.exports.__wbindgen_closure_wrapper7045 = function (arg0, arg1, arg2) {
+ const ret = makeMutClosure(arg0, arg1, 200, __wbg_adapter_30);
return addHeapObject(ret);
};
diff --git a/src/core/libs/cardano_multiplatform_lib/src/fees.rs b/src/core/libs/cardano_multiplatform_lib/src/fees.rs
index 19db70fe..9971f8cc 100644
--- a/src/core/libs/cardano_multiplatform_lib/src/fees.rs
+++ b/src/core/libs/cardano_multiplatform_lib/src/fees.rs
@@ -32,6 +32,8 @@ pub fn min_fee(
tx: &Transaction,
linear_fee: &LinearFee,
ex_unit_prices: &ExUnitPrices,
+ minfee_refscript_cost_per_byte: &Rational,
+ ref_script_outputs: &TransactionOutputs,
) -> Result {
let mut fee = to_bignum(tx.to_bytes().len() as u64)
.checked_mul(&linear_fee.coefficient())?
@@ -57,6 +59,24 @@ pub fn min_fee(
);
fee = fee.checked_add(&script_fee)?;
}
+ if ref_script_outputs.len() > 0 {
+ let refscript_fee = to_bignum(
+ (Fraction::new(
+ from_bignum(&minfee_refscript_cost_per_byte.numerator),
+ from_bignum(&minfee_refscript_cost_per_byte.denominator),
+ )
+ .to_f64()
+ .unwrap()
+ * ref_script_outputs.0.iter().fold(0_u64, |acc, output| {
+ acc + match &output.script_ref {
+ Some(script) => script.to_bytes().len() as u64,
+ None => 0,
+ }
+ }) as f64)
+ .ceil() as u64,
+ );
+ fee = fee.checked_add(&refscript_fee)?;
+ }
Ok(fee)
}
@@ -124,9 +144,15 @@ mod tests {
"84a400818258203b40265111d8bb3c3c608d95b3a0bf83461ace32d79336579a1939b3aad1c0b700018182581d611c616f1acb460668a9b2f123c80372c2adad3583b9c6cd2b1deeed1c01021a00016f32030aa10081825820f9aa3fccb7fe539e471188ccc9ee65514c5961c070b06ca185962484a4813bee5840fae5de40c94d759ce13bf9886262159c4f26a289fd192e165995b785259e503f6887bf39dfa23a47cf163784c6eee23f61440e749bc1df3c73975f5231aeda0ff5f6"
);
assert_eq!(
- min_fee(&signed_tx, &linear_fee, &ExUnitPrices::from_float(0.0, 0.0))
- .unwrap()
- .to_str(),
+ min_fee(
+ &signed_tx,
+ &linear_fee,
+ &ExUnitPrices::from_float(0.0, 0.0),
+ &Rational::from_float(0.0),
+ &TransactionOutputs::new()
+ )
+ .unwrap()
+ .to_str(),
"94502" // todo: compare to Haskell fee to make sure the diff is not too big
);
}
@@ -180,9 +206,15 @@ mod tests {
"84a400818258203b40265111d8bb3c3c608d95b3a0bf83461ace32d79336579a1939b3aad1c0b700018182581d611c616f1acb460668a9b2f123c80372c2adad3583b9c6cd2b1deeed1c01021a0001b582030aa10281845820473811afd4d939b337c9be1a2ceeb2cb2c75108bddf224c5c21c51592a7b204a5840f0b04a852353eb23b9570df80b2aa6a61b723341ab45a2024a05b07cf58be7bdfbf722c09040db6cee61a0d236870d6ad1e1349ac999ec0db28f9471af25fb0c5820c8b95d0d35fe75a70f9f5633a3e2439b2994b9e2bc851c49e9f91d1a5dcbb1a341a0f5f6"
);
assert_eq!(
- min_fee(&signed_tx, &linear_fee, &ExUnitPrices::from_float(0.0, 0.0))
- .unwrap()
- .to_str(),
+ min_fee(
+ &signed_tx,
+ &linear_fee,
+ &ExUnitPrices::from_float(0.0, 0.0),
+ &Rational::from_float(0.0),
+ &TransactionOutputs::new()
+ )
+ .unwrap()
+ .to_str(),
"112502" // todo: compare to Haskell fee to make sure the diff is not too big
);
}
@@ -269,9 +301,15 @@ mod tests {
"84a400828258203b40265111d8bb3c3c608d95b3a0bf83461ace32d79336579a1939b3aad1c0b7182a82582082839f8200d81858248258203b40265111d8bb3c3c608d95b3a0bf83461ace3207018282581d611c616f1acb460668a9b2f123c80372c2adad3583b9c6cd2b1deeed1c19012182581d61bcd18fcffa797c16c007014e2b8553b8b9b1e94c507688726243d6111a3420989c021a0002ccce031903e7a10082825820f9aa3fccb7fe539e471188ccc9ee65514c5961c070b06ca185962484a4813bee58401ec3e56008650282ba2e1f8a20e81707810b2d0973c4d42a1b4df65b732bda81567c7824904840b2554d2f33861da5d70588a29d33b2b61042e3c3445301d8008258206872b0a874acfe1cace12b20ea348559a7ecc912f2fc7f674f43481df973d92c5840a0718fb5b37d89ddf926c08e456d3f4c7f749e91f78bb3e370751d5b632cbd20d38d385805291b1ef2541b02543728a235e01911f4b400bfb50e5fce589de907f5f6"
);
assert_eq!(
- min_fee(&signed_tx, &linear_fee, &ExUnitPrices::from_float(0.0, 0.0))
- .unwrap()
- .to_str(),
+ min_fee(
+ &signed_tx,
+ &linear_fee,
+ &ExUnitPrices::from_float(0.0, 0.0),
+ &Rational::from_float(0.0),
+ &TransactionOutputs::new()
+ )
+ .unwrap()
+ .to_str(),
"184002" // todo: compare to Haskell fee to make sure the diff is not too big
);
}
@@ -392,9 +430,15 @@ mod tests {
"84a500818258203b40265111d8bb3c3c608d95b3a0bf83461ace32d79336579a1939b3aad1c0b700018182581d611c616f1acb460668a9b2f123c80372c2adad3583b9c6cd2b1deeed1c01021a00040f12030a04818a03581c1c13374874c68016df54b1339b6cacdd801098431e7659b24928efc15820bd0000f498ccacdc917c28274cba51c415f3f21931ff41ca8dc1197499f8e1241a000f42401a000f4240d81e82031864581de151df9ba1b74a1c9608a487e114184556801e927d31d96425cb80af7081581c51df9ba1b74a1c9608a487e114184556801e927d31d96425cb80af7080f6a10083825820f9aa3fccb7fe539e471188ccc9ee65514c5961c070b06ca185962484a4813bee5840a7f305d7e46abfe0f7bea6098bdf853ab9ce8e7aa381be5a991a871852f895a718e20614e22be43494c4dc3a8c78c56cd44fd38e0e5fff3e2fbd19f70402fc02825820b24c040e65994bd5b0621a060166d32d356ef4be3cc1f848426a4cf386887089584013c372f82f1523484eab273241d66d92e1402507760e279480912aa5f0d88d656d6f25d41e65257f2f38c65ac5c918a6735297741adfc718394994f20a1cfd0082582054d1a9c5ad69586ceeb839c438400c376c0bd34825fb4c17cc2f58c54e1437f35840d326b993dfec21b9b3e1bd2f80adadc2cd673a1d8d033618cc413b0b02bc3b7efbb23d1ff99138abd05c398ce98e7983a641b50dcf0f64ed33f26c6e636b0b0ff5f6"
);
assert_eq!(
- min_fee(&signed_tx, &linear_fee, &ExUnitPrices::from_float(0.0, 0.0))
- .unwrap()
- .to_str(),
+ min_fee(
+ &signed_tx,
+ &linear_fee,
+ &ExUnitPrices::from_float(0.0, 0.0),
+ &Rational::from_float(0.0),
+ &TransactionOutputs::new()
+ )
+ .unwrap()
+ .to_str(),
"269502" // todo: compare to Haskell fee to make sure the diff is not too big
);
}
@@ -607,9 +651,15 @@ mod tests {
"84a500818258203b40265111d8bb3c3c608d95b3a0bf83461ace32d79336579a1939b3aad1c0b700018182581d611c616f1acb460668a9b2f123c80372c2adad3583b9c6cd2b1deeed1c01021a00027ac6030a05a1581de151df9ba1b74a1c9608a487e114184556801e927d31d96425cb80af70190539a10082825820f9aa3fccb7fe539e471188ccc9ee65514c5961c070b06ca185962484a4813bee5840fc0493f7121efe385d72830680e735ccdef99c3a31953fe877b89ad3a97fcdb871cc7f2cdd6a8104e52f6963bd9e10d814d4fabdbcdc8475bc63e872dcc94d0a82582054d1a9c5ad69586ceeb839c438400c376c0bd34825fb4c17cc2f58c54e1437f35840a051ba927582004aedab736b9f1f9330ff867c260f4751135d480074256e83cd23d2a4bb109f955c43afdcdc5d1841b28d5c1ea2148dfbb6252693590692bb00f5f6"
);
assert_eq!(
- min_fee(&signed_tx, &linear_fee, &ExUnitPrices::from_float(0.0, 0.0))
- .unwrap()
- .to_str(),
+ min_fee(
+ &signed_tx,
+ &linear_fee,
+ &ExUnitPrices::from_float(0.0, 0.0),
+ &Rational::from_float(0.0),
+ &TransactionOutputs::new()
+ )
+ .unwrap()
+ .to_str(),
"163002" // todo: compare to Haskell fee to make sure the diff is not too big
);
}
diff --git a/src/core/libs/cardano_multiplatform_lib/src/lib.rs b/src/core/libs/cardano_multiplatform_lib/src/lib.rs
index df36a7bf..34bae636 100644
--- a/src/core/libs/cardano_multiplatform_lib/src/lib.rs
+++ b/src/core/libs/cardano_multiplatform_lib/src/lib.rs
@@ -2554,6 +2554,7 @@ pub struct ProtocolParamUpdate {
governance_action_deposit: Option,
drep_deposit: Option,
drep_inactivity_period: Option,
+ minfee_refscript_cost_per_byte: Option,
}
to_from_bytes!(ProtocolParamUpdate);
@@ -2803,14 +2804,22 @@ impl ProtocolParamUpdate {
pub fn drep_deposit(&self) -> Option {
self.drep_deposit.clone()
}
+
pub fn set_drep_inactivity_period(&mut self, drep_inactivity_period: Epoch) {
self.drep_inactivity_period = Some(drep_inactivity_period)
}
-
pub fn drep_inactivity_period(&self) -> Option {
self.drep_inactivity_period.clone()
}
+ pub fn set_minfee_refscript_cost_per_byte(&mut self, minfee_refscript_cost_per_byte: Rational) {
+ self.minfee_refscript_cost_per_byte = Some(minfee_refscript_cost_per_byte)
+ }
+
+ pub fn minfee_refscript_cost_per_byte(&self) -> Option {
+ self.minfee_refscript_cost_per_byte.clone()
+ }
+
pub fn new() -> Self {
Self {
minfee_a: None,
@@ -2845,6 +2854,7 @@ impl ProtocolParamUpdate {
governance_action_deposit: None,
drep_deposit: None,
drep_inactivity_period: None,
+ minfee_refscript_cost_per_byte: None,
}
}
}
diff --git a/src/core/libs/cardano_multiplatform_lib/src/plutus.rs b/src/core/libs/cardano_multiplatform_lib/src/plutus.rs
index 3bcb67b4..c2b4c1ea 100644
--- a/src/core/libs/cardano_multiplatform_lib/src/plutus.rs
+++ b/src/core/libs/cardano_multiplatform_lib/src/plutus.rs
@@ -740,7 +740,8 @@ pub enum RedeemerTagKind {
Mint,
Cert,
Reward,
- Drep,
+ Voting,
+ Proposing,
}
#[wasm_bindgen]
@@ -778,8 +779,12 @@ impl RedeemerTag {
Self(RedeemerTagKind::Reward)
}
- pub fn new_drep() -> Self {
- Self(RedeemerTagKind::Drep)
+ pub fn new_voting() -> Self {
+ Self(RedeemerTagKind::Voting)
+ }
+
+ pub fn new_proposing() -> Self {
+ Self(RedeemerTagKind::Proposing)
}
pub fn kind(&self) -> RedeemerTagKind {
@@ -2044,6 +2049,8 @@ impl Deserialize for PlutusList {
}
}
+/// TODO: Redeemer serialization and deserialization should be updated soon,
+/// instead of array use a map according to specs. Array still valid tho in Conway
impl cbor_event::se::Serialize for Redeemer {
fn serialize<'se, W: Write>(
&self,
@@ -2100,7 +2107,8 @@ impl cbor_event::se::Serialize for RedeemerTagKind {
RedeemerTagKind::Mint => serializer.write_unsigned_integer(1u64),
RedeemerTagKind::Cert => serializer.write_unsigned_integer(2u64),
RedeemerTagKind::Reward => serializer.write_unsigned_integer(3u64),
- RedeemerTagKind::Drep => serializer.write_unsigned_integer(4u64),
+ RedeemerTagKind::Voting => serializer.write_unsigned_integer(4u64),
+ RedeemerTagKind::Proposing => serializer.write_unsigned_integer(5u64),
}
}
}
@@ -2113,7 +2121,8 @@ impl Deserialize for RedeemerTagKind {
Ok(1) => Ok(RedeemerTagKind::Mint),
Ok(2) => Ok(RedeemerTagKind::Cert),
Ok(3) => Ok(RedeemerTagKind::Reward),
- Ok(4) => Ok(RedeemerTagKind::Drep),
+ Ok(4) => Ok(RedeemerTagKind::Voting),
+ Ok(5) => Ok(RedeemerTagKind::Proposing),
Ok(_) | Err(_) => Err(DeserializeFailure::NoVariantMatched.into()),
}
})()
diff --git a/src/core/libs/cardano_multiplatform_lib/src/serialization.rs b/src/core/libs/cardano_multiplatform_lib/src/serialization.rs
index 7ba58e74..822f0f61 100644
--- a/src/core/libs/cardano_multiplatform_lib/src/serialization.rs
+++ b/src/core/libs/cardano_multiplatform_lib/src/serialization.rs
@@ -3886,6 +3886,9 @@ impl cbor_event::se::Serialize for ProtocolParamUpdate {
} + match &self.drep_inactivity_period {
Some(_) => 1,
None => 0,
+ } + match &self.minfee_refscript_cost_per_byte {
+ Some(_) => 1,
+ None => 0,
},
))?;
if let Some(field) = &self.minfee_a {
@@ -3985,37 +3988,42 @@ impl cbor_event::se::Serialize for ProtocolParamUpdate {
field.serialize(serializer)?;
}
if let Some(field) = &self.pool_voting_thresholds {
- serializer.write_unsigned_integer(24)?;
+ serializer.write_unsigned_integer(25)?;
field.serialize(serializer)?;
}
if let Some(field) = &self.drep_voting_thresholds {
- serializer.write_unsigned_integer(24)?;
+ serializer.write_unsigned_integer(26)?;
field.serialize(serializer)?;
}
if let Some(field) = &self.min_committee_size {
- serializer.write_unsigned_integer(24)?;
+ serializer.write_unsigned_integer(27)?;
field.serialize(serializer)?;
}
if let Some(field) = &self.committee_term_limit {
- serializer.write_unsigned_integer(24)?;
+ serializer.write_unsigned_integer(28)?;
field.serialize(serializer)?;
}
if let Some(field) = &self.governance_action_expiration {
- serializer.write_unsigned_integer(24)?;
+ serializer.write_unsigned_integer(29)?;
field.serialize(serializer)?;
}
if let Some(field) = &self.governance_action_deposit {
- serializer.write_unsigned_integer(24)?;
+ serializer.write_unsigned_integer(30)?;
field.serialize(serializer)?;
}
if let Some(field) = &self.drep_deposit {
- serializer.write_unsigned_integer(24)?;
+ serializer.write_unsigned_integer(31)?;
field.serialize(serializer)?;
}
if let Some(field) = &self.drep_inactivity_period {
- serializer.write_unsigned_integer(24)?;
+ serializer.write_unsigned_integer(32)?;
field.serialize(serializer)?;
}
+ if let Some(field) = &self.minfee_refscript_cost_per_byte {
+ serializer.write_unsigned_integer(33)?;
+ field.serialize(serializer)?;
+ }
+
Ok(serializer)
}
}
@@ -4057,6 +4065,7 @@ impl Deserialize for ProtocolParamUpdate {
let mut governance_action_deposit = None;
let mut drep_deposit = None;
let mut drep_inactivity_period = None;
+ let mut minfee_refscript_cost_per_byte = None;
let mut read = 0;
while match len {
@@ -4449,6 +4458,18 @@ impl Deserialize for ProtocolParamUpdate {
.map_err(|e| e.annotate("drep_inactivity_period"))?,
);
}
+ 33 => {
+ if minfee_refscript_cost_per_byte.is_some() {
+ return Err(DeserializeFailure::DuplicateKey(Key::Uint(33)).into());
+ }
+ minfee_refscript_cost_per_byte = Some(
+ (|| -> Result<_, DeserializeError> {
+ read_len.read_elems(1)?;
+ Ok(Rational::deserialize(raw)?)
+ })()
+ .map_err(|e| e.annotate("minfee_refscript_cost_per_byte"))?,
+ );
+ }
unknown_key => {
return Err(
DeserializeFailure::UnknownKey(Key::Uint(unknown_key)).into()
@@ -4513,6 +4534,7 @@ impl Deserialize for ProtocolParamUpdate {
governance_action_deposit,
drep_deposit,
drep_inactivity_period,
+ minfee_refscript_cost_per_byte,
})
})()
.map_err(|e| e.annotate("ProtocolParamUpdate"))
diff --git a/src/core/libs/cardano_multiplatform_lib/src/tx_builder.rs b/src/core/libs/cardano_multiplatform_lib/src/tx_builder.rs
index f077ac7d..51849508 100644
--- a/src/core/libs/cardano_multiplatform_lib/src/tx_builder.rs
+++ b/src/core/libs/cardano_multiplatform_lib/src/tx_builder.rs
@@ -252,10 +252,33 @@ fn min_fee(tx_builder: &mut TransactionBuilder) -> Result {
// }
let build = tx_builder.build()?;
let full_tx = fake_full_tx(tx_builder, build)?;
+
+ let mut ref_script_outputs = TransactionOutputs::new();
+
+ let mut ref_script_outputs_1: Vec = tx_builder
+ .inputs
+ .iter()
+ .map(|input| input.utxo.output.clone())
+ .collect();
+
+ let mut ref_script_outputs_2: Vec = tx_builder
+ .reference_inputs
+ .clone()
+ .unwrap_or(TransactionUnspentOutputs::new())
+ .0
+ .iter()
+ .map(|input| input.output.clone())
+ .collect();
+
+ ref_script_outputs.0.append(&mut ref_script_outputs_1);
+ ref_script_outputs.0.append(&mut ref_script_outputs_2);
+
fees::min_fee(
&full_tx,
&tx_builder.config.fee_algo,
&tx_builder.config.ex_unit_prices,
+ &tx_builder.config.minfee_refscript_cost_per_byte,
+ &ref_script_outputs,
)
}
@@ -299,17 +322,18 @@ struct TxBuilderWithdrawal {
#[derive(Clone, Debug)]
pub struct TransactionBuilderConfig {
fee_algo: fees::LinearFee,
- pool_deposit: BigNum, // protocol parameter
- key_deposit: BigNum, // protocol parameter
- max_value_size: u32, // protocol parameter
- max_tx_size: u32, // protocol parameter
- coins_per_utxo_byte: Coin, // protocol parameter
- ex_unit_prices: ExUnitPrices, // protocol parameter
- max_tx_ex_units: ExUnits, // protocol parameter
- costmdls: Costmdls, // protocol parameter
- collateral_percentage: u32, // protocol parameter
- max_collateral_inputs: u32, // protocol parameter
- slot_config: (BigNum, BigNum, u32), // (zero_time, zero_slot, slot_length)
+ pool_deposit: BigNum, // protocol parameter
+ key_deposit: BigNum, // protocol parameter
+ max_value_size: u32, // protocol parameter
+ max_tx_size: u32, // protocol parameter
+ coins_per_utxo_byte: Coin, // protocol parameter
+ ex_unit_prices: ExUnitPrices, // protocol parameter
+ max_tx_ex_units: ExUnits, // protocol parameter
+ costmdls: Costmdls, // protocol parameter
+ collateral_percentage: u32, // protocol parameter
+ max_collateral_inputs: u32, // protocol parameter
+ minfee_refscript_cost_per_byte: Rational, // protocol parameter
+ slot_config: (BigNum, BigNum, u32), // (zero_time, zero_slot, slot_length)
blockfrost: Blockfrost,
}
@@ -317,16 +341,17 @@ pub struct TransactionBuilderConfig {
#[derive(Clone, Debug)]
pub struct TransactionBuilderConfigBuilder {
fee_algo: Option,
- pool_deposit: Option, // protocol parameter
- key_deposit: Option, // protocol parameter
- max_value_size: Option, // protocol parameter
- max_tx_size: Option, // protocol parameter
- coins_per_utxo_byte: Option, // protocol parameter
- ex_unit_prices: Option, // protocol parameter
- max_tx_ex_units: Option, // protocol parameter
- costmdls: Option, // protocol parameter
- collateral_percentage: Option, // protocol parameter
- max_collateral_inputs: Option, // protocol parameter
+ pool_deposit: Option, // protocol parameter
+ key_deposit: Option, // protocol parameter
+ max_value_size: Option, // protocol parameter
+ max_tx_size: Option, // protocol parameter
+ coins_per_utxo_byte: Option, // protocol parameter
+ ex_unit_prices: Option, // protocol parameter
+ max_tx_ex_units: Option, // protocol parameter
+ costmdls: Option, // protocol parameter
+ collateral_percentage: Option, // protocol parameter
+ max_collateral_inputs: Option, // protocol parameter
+ minfee_refscript_cost_per_byte: Option, // protocol parameter
slot_config: Option<(BigNum, BigNum, u32)>, // (zero_time, zero_slot, slot_length)
blockfrost: Option,
}
@@ -346,6 +371,7 @@ impl TransactionBuilderConfigBuilder {
costmdls: None,
collateral_percentage: None,
max_collateral_inputs: None,
+ minfee_refscript_cost_per_byte: None,
slot_config: None,
blockfrost: None,
}
@@ -417,6 +443,15 @@ impl TransactionBuilderConfigBuilder {
cfg
}
+ pub fn minfee_refscript_cost_per_byte(
+ &self,
+ minfee_refscript_cost_per_byte: &Rational,
+ ) -> Self {
+ let mut cfg = self.clone();
+ cfg.minfee_refscript_cost_per_byte = Some(minfee_refscript_cost_per_byte.clone());
+ cfg
+ }
+
pub fn slot_config(&self, zero_time: &BigNum, zero_slot: &BigNum, slot_length: u32) -> Self {
let mut cfg = self.clone();
cfg.slot_config = Some((zero_time.clone(), zero_slot.clone(), slot_length));
@@ -469,6 +504,9 @@ impl TransactionBuilderConfigBuilder {
max_collateral_inputs: cfg.max_collateral_inputs.ok_or(JsError::from_str(
"uninitialized field: max_collateral_inputs",
))?,
+ minfee_refscript_cost_per_byte: cfg.minfee_refscript_cost_per_byte.ok_or(
+ JsError::from_str("uninitialized field: minfee_refscript_cost_per_byte"),
+ )?,
slot_config: if cfg.slot_config.is_some() {
cfg.slot_config.unwrap()
} else {
@@ -2754,6 +2792,7 @@ mod tests {
.ex_unit_prices(&ExUnitPrices::from_float(0.0, 0.0))
.collateral_percentage(150)
.max_collateral_inputs(3)
+ .minfee_refscript_cost_per_byte(&UnitInterval::from_float(0.0))
.build()
.unwrap();
TransactionBuilder::new(&cfg)
@@ -2806,6 +2845,7 @@ mod tests {
.ex_unit_prices(&ExUnitPrices::from_float(0.0, 0.0))
.collateral_percentage(150)
.max_collateral_inputs(3)
+ .minfee_refscript_cost_per_byte(&UnitInterval::from_float(0.0))
.build()
.unwrap(),
)
@@ -5180,6 +5220,7 @@ mod tests {
.ex_unit_prices(&ExUnitPrices::from_float(0.0, 0.0))
.collateral_percentage(150)
.max_collateral_inputs(3)
+ .minfee_refscript_cost_per_byte(&UnitInterval::from_float(0.0))
.build()
.unwrap();
let mut tx_builder = TransactionBuilder::new(&cfg);
@@ -5604,6 +5645,7 @@ mod tests {
.ex_unit_prices(&ExUnitPrices::from_float(0.0, 0.0))
.collateral_percentage(150)
.max_collateral_inputs(3)
+ .minfee_refscript_cost_per_byte(&UnitInterval::from_float(0.0))
.build()
.unwrap(),
);
diff --git a/src/core/libs/cardano_multiplatform_lib/src/utils.rs b/src/core/libs/cardano_multiplatform_lib/src/utils.rs
index 3c7c1257..e23480a9 100644
--- a/src/core/libs/cardano_multiplatform_lib/src/utils.rs
+++ b/src/core/libs/cardano_multiplatform_lib/src/utils.rs
@@ -1239,13 +1239,16 @@ pub fn hash_script_data(
) -> ScriptDataHash {
let mut buf = Vec::new();
if redeemers.len() == 0 && datums.is_some() {
- /*
+ /* (Deprecated)
; Finally, note that in the case that a transaction includes datums but does not
; include any redeemers, the script data format becomes (in hex):
; [ 80 | datums | A0 ]
; corresponding to a CBOR empty list and an empty map (our apologies).
*/
- buf.push(0x80);
+ /* Post Babbage:
+ ; [ A0 | datums | A0 ]
+ */
+ buf.push(0xA0);
if let Some(d) = &datums {
buf.extend(d.to_bytes());
}
diff --git a/src/lucid/lucid.ts b/src/lucid/lucid.ts
index b886fbe2..37528a0d 100644
--- a/src/lucid/lucid.ts
+++ b/src/lucid/lucid.ts
@@ -97,6 +97,11 @@ export class Lucid {
protocolParameters.priceStep,
),
)
+ .minfee_refscript_cost_per_byte(
+ C.UnitInterval.from_float(
+ protocolParameters.minfeeRefscriptCostPerByte,
+ ),
+ )
.slot_config(
C.BigNum.from_str(slotConfig.zeroTime.toString()),
C.BigNum.from_str(slotConfig.zeroSlot.toString()),
diff --git a/src/provider/blockfrost.ts b/src/provider/blockfrost.ts
index b0991796..7abcd3d3 100644
--- a/src/provider/blockfrost.ts
+++ b/src/provider/blockfrost.ts
@@ -15,7 +15,7 @@ import {
Unit,
UTxO,
} from "../types/mod.ts";
-import packageJson from "../../package.json" assert { type: "json" };
+import packageJson from "../../package.json" with { type: "json" };
export class Blockfrost implements Provider {
url: string;
@@ -46,6 +46,9 @@ export class Blockfrost implements Provider {
collateralPercentage: parseInt(result.collateral_percent),
maxCollateralInputs: parseInt(result.max_collateral_inputs),
costModels: result.cost_models,
+ minfeeRefscriptCostPerByte: parseInt(
+ result.min_fee_ref_script_cost_per_byte,
+ ),
};
}
diff --git a/src/provider/kupmios.ts b/src/provider/kupmios.ts
index 06214db7..74159101 100644
--- a/src/provider/kupmios.ts
+++ b/src/provider/kupmios.ts
@@ -31,9 +31,7 @@ export class Kupmios implements Provider {
}
async getProtocolParameters(): Promise {
- const client = await this.ogmiosWsp("Query", {
- query: "currentProtocolParameters",
- });
+ const client = await this.rpc("queryLedgerState/protocolParameters");
return new Promise((res, rej) => {
client.addEventListener("message", (msg: MessageEvent) => {
@@ -42,32 +40,39 @@ export class Kupmios implements Provider {
// deno-lint-ignore no-explicit-any
const costModels: any = {};
- Object.keys(result.costModels).forEach((v) => {
+ Object.keys(result.plutusCostModels).forEach((v) => {
const version = v.split(":")[1].toUpperCase();
const plutusVersion = "Plutus" + version;
- costModels[plutusVersion] = result.costModels[v];
+ costModels[plutusVersion] = result.plutusCostModels[v];
});
- const [memNum, memDenom] = result.prices.memory.split("/");
- const [stepsNum, stepsDenom] = result.prices.steps.split("/");
+ const [memNum, memDenom] = result.scriptExecutionPrices.memory.split(
+ "/",
+ );
+ const [stepsNum, stepsDenom] = result.scriptExecutionPrices.cpu.split(
+ "/",
+ );
res(
{
minFeeA: parseInt(result.minFeeCoefficient),
- minFeeB: parseInt(result.minFeeConstant),
- maxTxSize: parseInt(result.maxTxSize),
- maxValSize: parseInt(result.maxValueSize),
- keyDeposit: BigInt(result.stakeKeyDeposit),
- poolDeposit: BigInt(result.poolDeposit),
+ minFeeB: parseInt(result.minFeeConstant.ada.lovelace),
+ maxTxSize: parseInt(result.maxTransactionSize.bytes),
+ maxValSize: parseInt(result.maxValueSize.bytes),
+ keyDeposit: BigInt(result.stakeCredentialDeposit.ada.lovelace),
+ poolDeposit: BigInt(result.stakePoolDeposit.ada.lovelace),
priceMem: parseInt(memNum) / parseInt(memDenom),
priceStep: parseInt(stepsNum) / parseInt(stepsDenom),
maxTxExMem: BigInt(result.maxExecutionUnitsPerTransaction.memory),
maxTxExSteps: BigInt(
- result.maxExecutionUnitsPerTransaction.steps,
+ result.maxExecutionUnitsPerTransaction.cpu,
),
- coinsPerUtxoByte: BigInt(result.coinsPerUtxoByte),
+ coinsPerUtxoByte: BigInt(result.minUtxoDepositCoefficient),
collateralPercentage: parseInt(result.collateralPercentage),
maxCollateralInputs: parseInt(result.maxCollateralInputs),
costModels,
+ minfeeRefscriptCostPerByte: parseInt(
+ result.minFeeReferenceScripts.base,
+ ),
},
);
client.close();
@@ -148,22 +153,23 @@ export class Kupmios implements Provider {
}
async getDelegation(rewardAddress: RewardAddress): Promise {
- const client = await this.ogmiosWsp("Query", {
- query: { "delegationsAndRewards": [rewardAddress] },
- });
+ const client = await this.rpc(
+ "queryLedgerState/rewardAccountSummaries",
+ { keys: [rewardAddress] }, // TODO: Does this work for reward addresses that are scripts as well?
+ );
return new Promise((res, rej) => {
client.addEventListener("message", (msg: MessageEvent) => {
try {
const { result } = JSON.parse(msg.data);
const delegation = (result ? Object.values(result)[0] : {}) as {
- delegate: string;
- rewards: number;
+ delegate: { id: string };
+ rewards: { ada: { lovelace: number } };
};
res(
{
- poolId: delegation?.delegate || null,
- rewards: BigInt(delegation?.rewards || 0),
+ poolId: delegation?.delegate.id || null,
+ rewards: BigInt(delegation?.rewards.ada.lovelace || 0),
},
);
client.close();
@@ -200,17 +206,17 @@ export class Kupmios implements Provider {
}
async submitTx(tx: Transaction): Promise {
- const client = await this.ogmiosWsp("SubmitTx", {
- submit: tx,
+ const client = await this.rpc("submitTransaction", {
+ transaction: { cbor: tx },
});
return new Promise((res, rej) => {
client.addEventListener("message", (msg: MessageEvent) => {
try {
- const { result } = JSON.parse(msg.data);
+ const { result, error } = JSON.parse(msg.data);
- if (result.SubmitSuccess) res(result.SubmitSuccess.txId);
- else rej(result.SubmitFail);
+ if (result?.transaction) res(result.transaction.id);
+ else rej(error);
client.close();
} catch (e) {
rej(e);
@@ -264,20 +270,18 @@ export class Kupmios implements Provider {
}));
}
- private async ogmiosWsp(
- methodname: string,
- args: unknown,
+ private async rpc(
+ method: string,
+ params?: unknown,
): Promise {
const client = new WebSocket(this.ogmiosUrl);
await new Promise((res) => {
client.addEventListener("open", () => res(1), { once: true });
});
client.send(JSON.stringify({
- type: "jsonwsp/request",
- version: "1.0",
- servicename: "ogmios",
- methodname,
- args,
+ "jsonrpc": "2.0",
+ method,
+ params,
}));
return client;
}
diff --git a/src/provider/maestro.ts b/src/provider/maestro.ts
index 2bbd3902..77cf2500 100644
--- a/src/provider/maestro.ts
+++ b/src/provider/maestro.ts
@@ -17,38 +17,38 @@ import {
Unit,
UTxO,
} from "../types/mod.ts";
-import packageJson from "../../package.json" assert { type: "json" };
+import packageJson from "../../package.json" with { type: "json" };
-export type MaestroSupportedNetworks = "Mainnet" | "Preprod" | "Preview"
+export type MaestroSupportedNetworks = "Mainnet" | "Preprod" | "Preview";
export interface MaestroConfig {
- network: MaestroSupportedNetworks,
- apiKey: string,
- turboSubmit?: boolean // Read about paid turbo transaction submission feature at https://docs-v1.gomaestro.org/docs/Dapp%20Platform/Turbo%20Transaction.
+ network: MaestroSupportedNetworks;
+ apiKey: string;
+ turboSubmit?: boolean; // Read about paid turbo transaction submission feature at https://docs-v1.gomaestro.org/docs/Dapp%20Platform/Turbo%20Transaction.
}
export class Maestro implements Provider {
-
url: string;
apiKey: string;
turboSubmit: boolean;
constructor({ network, apiKey, turboSubmit = false }: MaestroConfig) {
- this.url = `https://${network}.gomaestro-api.org/v1`
+ this.url = `https://${network}.gomaestro-api.org/v1`;
this.apiKey = apiKey;
this.turboSubmit = turboSubmit;
}
async getProtocolParameters(): Promise {
- const timestampedResult = await fetch(`${this.url}/protocol-params`, {
+ const timestampedResult = await fetch(`${this.url}/protocol-parameters`, {
headers: this.commonHeaders(),
}).then((res) => res.json());
const result = timestampedResult.data;
// Decimal numbers in Maestro are given as ratio of two numbers represented by string of format "firstNumber/secondNumber".
const decimalFromRationalString = (str: string): number => {
const forwardSlashIndex = str.indexOf("/");
- return parseInt(str.slice(0, forwardSlashIndex)) / parseInt(str.slice(forwardSlashIndex + 1));
- }
+ return parseInt(str.slice(0, forwardSlashIndex)) /
+ parseInt(str.slice(forwardSlashIndex + 1));
+ };
// To rename keys in an object by the given key-map.
// deno-lint-ignore no-explicit-any
const renameKeysAndSort = (obj: any, newKeys: any) => {
@@ -66,29 +66,36 @@ export class Maestro implements Provider {
};
return {
minFeeA: parseInt(result.min_fee_coefficient),
- minFeeB: parseInt(result.min_fee_constant),
- maxTxSize: parseInt(result.max_tx_size),
- maxValSize: parseInt(result.max_value_size),
- keyDeposit: BigInt(result.stake_key_deposit),
- poolDeposit: BigInt(result.pool_deposit),
- priceMem: decimalFromRationalString(result.prices.memory),
- priceStep: decimalFromRationalString(result.prices.steps),
+ minFeeB: parseInt(result.min_fee_constant.ada.lovelace),
+ maxTxSize: parseInt(result.max_transaction_size.bytes),
+ maxValSize: parseInt(result.max_value_size.bytes),
+ keyDeposit: BigInt(result.stake_credential_deposit.ada.lovelace),
+ poolDeposit: BigInt(result.stake_pool_deposit.ada.lovelace),
+ priceMem: decimalFromRationalString(result.script_execution_prices.memory),
+ priceStep: decimalFromRationalString(result.script_execution_prices.cpu),
maxTxExMem: BigInt(result.max_execution_units_per_transaction.memory),
- maxTxExSteps: BigInt(result.max_execution_units_per_transaction.steps),
- coinsPerUtxoByte: BigInt(result.coins_per_utxo_byte),
+ maxTxExSteps: BigInt(result.max_execution_units_per_transaction.cpu),
+ coinsPerUtxoByte: BigInt(result.min_utxo_deposit_coefficient),
collateralPercentage: parseInt(result.collateral_percentage),
maxCollateralInputs: parseInt(result.max_collateral_inputs),
- costModels: renameKeysAndSort(result.cost_models, {
- "plutus:v1": "PlutusV1",
- "plutus:v2": "PlutusV2",
+ costModels: renameKeysAndSort(result.plutus_cost_models, {
+ "plutus_v1": "PlutusV1",
+ "plutus_v2": "PlutusV2",
+ "plutus_v3": "PlutusV3",
}),
+ minfeeRefscriptCostPerByte: parseFloat(result.min_fee_reference_scripts.base),
};
}
- async getUtxos(addressOrCredential: Address | Credential): Promise {
+ private async getUtxosInternal(
+ addressOrCredential: Address | Credential,
+ unit?: Unit,
+ ): Promise {
const queryPredicate = (() => {
- if (typeof addressOrCredential === "string") return "/addresses/" + addressOrCredential;
- let credentialBech32Query = "/addresses/cred/"
+ if (typeof addressOrCredential === "string") {
+ return "/addresses/" + addressOrCredential;
+ }
+ let credentialBech32Query = "/addresses/cred/";
credentialBech32Query += addressOrCredential.type === "Key"
? C.Ed25519KeyHash.from_hex(addressOrCredential.hash).to_bech32(
"addr_vkh",
@@ -98,31 +105,29 @@ export class Maestro implements Provider {
);
return credentialBech32Query;
})();
- let result: MaestroUtxos = [];
- let nextCursor = null;
- while (true) {
- const appendCursorString = nextCursor === null ? "" : `&cursor=${nextCursor}`
- const response = await fetch(
- `${this.url}${queryPredicate}/utxos?count=100${appendCursorString}`,
- { headers: this.commonHeaders() },
- );
- const pageResult = await response.json();
- if (!response.ok) {
- throw new Error("Could not fetch UTxOs from Maestro. Received status code: " + response.status);
- }
- nextCursor = pageResult.next_cursor;
- result = result.concat(pageResult.data as MaestroUtxos);
- if (nextCursor == null) break;
- }
+ const qparams = new URLSearchParams({
+ count: "100",
+ ...(unit && { asset: unit }),
+ });
+ const result: MaestroUtxos = await this.getAllPagesData(
+ async (qry: string) =>
+ await fetch(qry, { headers: this.commonHeaders() }),
+ `${this.url}${queryPredicate}/utxos`,
+ qparams,
+ "Location: getUtxosInternal. Error: Could not fetch UTxOs from Maestro",
+ );
return result.map(this.maestroUtxoToUtxo);
}
- async getUtxosWithUnit(
+ getUtxos(addressOrCredential: Address | Credential): Promise {
+ return this.getUtxosInternal(addressOrCredential);
+ }
+
+ getUtxosWithUnit(
addressOrCredential: Address | Credential,
unit: Unit,
): Promise {
- const utxos = await this.getUtxos(addressOrCredential);
- return utxos.filter((utxo) => utxo.assets[unit]);
+ return this.getUtxosInternal(addressOrCredential, unit);
}
async getUtxoByUnit(unit: Unit): Promise {
@@ -130,17 +135,24 @@ export class Maestro implements Provider {
`${this.url}/assets/${unit}/addresses?count=2`,
{ headers: this.commonHeaders() },
);
- const timestampedAddresses = await timestampedAddressesResponse.json()
+ const timestampedAddresses = await timestampedAddressesResponse.json();
if (!timestampedAddressesResponse.ok) {
- if (timestampedAddresses.message) throw new Error(timestampedAddresses.message)
- throw new Error("Couldn't perform query. Received status code: " + timestampedAddressesResponse.status)
+ if (timestampedAddresses.message) {
+ throw new Error(timestampedAddresses.message);
+ }
+ throw new Error(
+ "Location: getUtxoByUnit. Error: Couldn't perform query. Received status code: " +
+ timestampedAddressesResponse.status,
+ );
}
const addressesWithAmount = timestampedAddresses.data;
if (addressesWithAmount.length === 0) {
- throw new Error("Unit not found.");
+ throw new Error("Location: getUtxoByUnit. Error: Unit not found.");
}
if (addressesWithAmount.length > 1) {
- throw new Error("Unit needs to be an NFT or only held by one address.");
+ throw new Error(
+ "Location: getUtxoByUnit. Error: Unit needs to be an NFT or only held by one address.",
+ );
}
const address = addressesWithAmount[0].address;
@@ -148,24 +160,34 @@ export class Maestro implements Provider {
const utxos = await this.getUtxosWithUnit(address, unit);
if (utxos.length > 1) {
- throw new Error("Unit needs to be an NFT or only held by one address.");
+ throw new Error(
+ "Location: getUtxoByUnit. Error: Unit needs to be an NFT or only held by one address.",
+ );
}
return utxos[0];
}
async getUtxosByOutRef(outRefs: OutRef[]): Promise {
- const response = await fetch(`${this.url}/transactions/outputs`, {
- method: "POST",
- headers: {
- 'Content-Type': 'application/json',
- ...this.commonHeaders()
- },
- body: JSON.stringify(outRefs.map(({ txHash, outputIndex }) => `${txHash}#${outputIndex}`)),
- });
- if (!response.ok) return [];
- const utxos = (await response.json()).data;
- return utxos.map(this.maestroUtxoToUtxo)
+ const qry = `${this.url}/transactions/outputs`;
+ const body = JSON.stringify(
+ outRefs.map(({ txHash, outputIndex }) => `${txHash}#${outputIndex}`),
+ );
+ const utxos = await this.getAllPagesData(
+ async (qry: string) =>
+ await fetch(qry, {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ ...this.commonHeaders(),
+ },
+ body: body,
+ }),
+ qry,
+ new URLSearchParams({}),
+ "Location: getUtxosByOutRef. Error: Could not fetch UTxOs by references from Maestro",
+ );
+ return utxos.map(this.maestroUtxoToUtxo);
}
async getDelegation(rewardAddress: RewardAddress): Promise {
@@ -192,10 +214,14 @@ export class Maestro implements Provider {
},
);
if (!timestampedResultResponse.ok) {
- if (timestampedResultResponse.status === 404)
+ if (timestampedResultResponse.status === 404) {
throw new Error(`No datum found for datum hash: ${datumHash}`);
- else
- throw new Error("Couldn't successfully perform query. Received status code: " + timestampedResultResponse.status);
+ } else {
+ throw new Error(
+ "Location: getDatum. Error: Couldn't successfully perform query. Received status code: " +
+ timestampedResultResponse.status,
+ );
+ }
}
const timestampedResult = await timestampedResultResponse.json();
return timestampedResult.data.bytes;
@@ -211,7 +237,7 @@ export class Maestro implements Provider {
},
);
if (isConfirmedResponse.ok) {
- await isConfirmedResponse.json()
+ await isConfirmedResponse.json();
clearInterval(confirmation);
await new Promise((res) => setTimeout(() => res(1), 1000));
return res(true);
@@ -222,7 +248,7 @@ export class Maestro implements Provider {
async submitTx(tx: Transaction): Promise {
let queryUrl = `${this.url}/txmanager`;
- queryUrl += this.turboSubmit ? '/turbosubmit' : ''
+ queryUrl += this.turboSubmit ? "/turbosubmit" : "";
const response = await fetch(queryUrl, {
method: "POST",
headers: {
@@ -235,7 +261,10 @@ export class Maestro implements Provider {
const result = await response.text();
if (!response.ok) {
if (response.status === 400) throw new Error(result);
- else throw new Error("Could not submit transaction. Received status code: " + response.status);
+ else {throw new Error(
+ "Could not submit transaction. Received status code: " +
+ response.status,
+ );}
}
return result;
}
@@ -270,6 +299,31 @@ export class Maestro implements Provider {
: undefined,
};
}
+ private async getAllPagesData(
+ getResponse: (qry: string) => Promise,
+ qry: string,
+ paramsGiven: URLSearchParams,
+ errorMsg: string,
+ ): Promise> {
+ let nextCursor = null;
+ let result: Array = [];
+ while (true) {
+ if (nextCursor !== null) {
+ paramsGiven.set("cursor", nextCursor);
+ }
+ const response = await getResponse(`${qry}?` + paramsGiven);
+ const pageResult = await response.json();
+ if (!response.ok) {
+ throw new Error(
+ `${errorMsg}. Received status code: ${response.status}`,
+ );
+ }
+ nextCursor = pageResult.next_cursor;
+ result = result.concat(pageResult.data as Array);
+ if (nextCursor == null) break;
+ }
+ return result;
+ }
}
type MaestroDatumOptionType = "hash" | "inline";
diff --git a/src/types/types.ts b/src/types/types.ts
index e9a031a6..26f3548c 100644
--- a/src/types/types.ts
+++ b/src/types/types.ts
@@ -19,6 +19,7 @@ export type ProtocolParameters = {
collateralPercentage: number;
maxCollateralInputs: number;
costModels: CostModels;
+ minfeeRefscriptCostPerByte: number;
};
export type Slot = number;
diff --git a/src/utils/cost_model.ts b/src/utils/cost_model.ts
index ed1e40db..60ecfd9f 100644
--- a/src/utils/cost_model.ts
+++ b/src/utils/cost_model.ts
@@ -36,6 +36,7 @@ export const PROTOCOL_PARAMETERS_DEFAULT: ProtocolParameters = {
coinsPerUtxoByte: 4310n,
collateralPercentage: 150,
maxCollateralInputs: 3,
+ minfeeRefscriptCostPerByte: 15,
costModels: {
PlutusV1: {
"addInteger-cpu-arguments-intercept": 205665,
diff --git a/tests/mod.test.ts b/tests/mod.test.ts
index cae88b9c..bc96a8bd 100644
--- a/tests/mod.test.ts
+++ b/tests/mod.test.ts
@@ -68,6 +68,9 @@ lucid.txBuilderConfig = C.TransactionBuilderConfigBuilder.new()
protocolParameters.priceStep,
),
)
+ .minfee_refscript_cost_per_byte(
+ C.UnitInterval.from_float(protocolParameters.minfeeRefscriptCostPerByte),
+ )
.slot_config(
C.BigNum.from_str(slotConfig.zeroTime.toString()),
C.BigNum.from_str(slotConfig.zeroSlot.toString()),