Skip to content

Commit

Permalink
Updated wasm
Browse files Browse the repository at this point in the history
  • Loading branch information
alessandrokonrad committed Jul 19, 2023
1 parent 65b769e commit 840db1f
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ npm test

### Additional

[Wasm packages](./src/wasm/) commit hash: [a4df25db0ae1b2ce6c7684d941fe538aff9a2f5b](https://github.com/spacebudz/lucid)
[Wasm packages](./src/wasm/) commit hash: [0d513ff8b81a7bfac04fc06258731740c1b7a4d9](https://github.com/spacebudz/lucid)

### Website

Expand Down
Binary file modified build.zip
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @generated file from wasmbuild -- do not edit
// deno-lint-ignore-file
// deno-fmt-ignore-file
// source-hash: 783b19dd84d46feeecff45257b573e95230d5002
// source-hash: ef749e5a83976e1564fbf4bbc6b641bffd5739e0
let wasm;

const cachedTextDecoder = new TextDecoder("utf-8", {
Expand Down Expand Up @@ -817,7 +817,7 @@ function handleError(f, args) {
wasm.__wbindgen_exn_store(addHeapObject(e));
}
}
function __wbg_adapter_1634(arg0, arg1, arg2, arg3) {
function __wbg_adapter_1638(arg0, arg1, arg2, arg3) {
wasm.wasm_bindgen__convert__closures__invoke2_mut__h36afefe016e25d40(
arg0,
arg1,
Expand Down Expand Up @@ -26447,6 +26447,34 @@ export class Vote {
wasm.__wbindgen_add_to_stack_pointer(16);
}
}
/**
* @returns {Vote}
*/
static new_no() {
const ret = wasm.language_new_plutus_v1();
return Vote.__wrap(ret);
}
/**
* @returns {Vote}
*/
static new_yes() {
const ret = wasm.language_new_plutus_v2();
return Vote.__wrap(ret);
}
/**
* @returns {Vote}
*/
static new_abstain() {
const ret = wasm.language_new_plutus_v3();
return Vote.__wrap(ret);
}
/**
* @returns {number}
*/
kind() {
const ret = wasm.vote_kind(this.ptr);
return ret >>> 0;
}
}

const VoteDelegCertFinalization = new FinalizationRegistry((ptr) =>
Expand Down Expand Up @@ -27643,7 +27671,7 @@ const imports = {
const a = state0.a;
state0.a = 0;
try {
return __wbg_adapter_1634(a, state0.b, arg0, arg1);
return __wbg_adapter_1638(a, state0.b, arg0, arg1);
} finally {
state0.a = a;
}
Expand Down Expand Up @@ -27737,7 +27765,7 @@ const imports = {
const ret = wasm.memory;
return addHeapObject(ret);
},
__wbindgen_closure_wrapper6917: function (arg0, arg1, arg2) {
__wbindgen_closure_wrapper6919: function (arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 214, __wbg_adapter_30);
return addHeapObject(ret);
},
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @generated file from wasmbuild -- do not edit
// deno-lint-ignore-file
// deno-fmt-ignore-file
// source-hash: 783b19dd84d46feeecff45257b573e95230d5002
// source-hash: ef749e5a83976e1564fbf4bbc6b641bffd5739e0

let imports = {};
imports["__wbindgen_placeholder__"] = module.exports;
Expand Down Expand Up @@ -849,7 +849,7 @@ function handleError(f, args) {
wasm.__wbindgen_exn_store(addHeapObject(e));
}
}
function __wbg_adapter_1634(arg0, arg1, arg2, arg3) {
function __wbg_adapter_1638(arg0, arg1, arg2, arg3) {
wasm.wasm_bindgen__convert__closures__invoke2_mut__h36afefe016e25d40(
arg0,
arg1,
Expand Down Expand Up @@ -26647,6 +26647,34 @@ class Vote {
wasm.__wbindgen_add_to_stack_pointer(16);
}
}
/**
* @returns {Vote}
*/
static new_no() {
const ret = wasm.language_new_plutus_v1();
return Vote.__wrap(ret);
}
/**
* @returns {Vote}
*/
static new_yes() {
const ret = wasm.language_new_plutus_v2();
return Vote.__wrap(ret);
}
/**
* @returns {Vote}
*/
static new_abstain() {
const ret = wasm.language_new_plutus_v3();
return Vote.__wrap(ret);
}
/**
* @returns {number}
*/
kind() {
const ret = wasm.vote_kind(this.ptr);
return ret >>> 0;
}
}
module.exports.Vote = Vote;

Expand Down Expand Up @@ -27874,7 +27902,7 @@ module.exports.__wbg_new_9d3a9ce4282a18a8 = function (arg0, arg1) {
const a = state0.a;
state0.a = 0;
try {
return __wbg_adapter_1634(a, state0.b, arg0, arg1);
return __wbg_adapter_1638(a, state0.b, arg0, arg1);
} finally {
state0.a = a;
}
Expand Down Expand Up @@ -27997,7 +28025,7 @@ module.exports.__wbindgen_memory = function () {
return addHeapObject(ret);
};

module.exports.__wbindgen_closure_wrapper6917 = function (arg0, arg1, arg2) {
module.exports.__wbindgen_closure_wrapper6919 = function (arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 214, __wbg_adapter_30);
return addHeapObject(ret);
};
Expand Down
25 changes: 22 additions & 3 deletions src/wasm/cardano_multiplatform_lib/src/conway.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,12 +289,12 @@ impl DeserializeEmbeddedGroup for ProposalProcedure {
_: cbor_event::Len,
) -> Result<Self, DeserializeError> {
let deposit = (|| -> Result<_, DeserializeError> { Ok(Coin::deserialize(raw)?) })()
.map_err(|e| e.annotate("Coin"))?;
.map_err(|e| e.annotate("deposit"))?;
let hash = (|| -> Result<_, DeserializeError> { Ok(ScriptHash::deserialize(raw)?) })()
.map_err(|e| e.annotate("ScriptHash"))?;
.map_err(|e| e.annotate("hash"))?;
let governance_action =
(|| -> Result<_, DeserializeError> { Ok(GovernanceAction::deserialize(raw)?) })()
.map_err(|e| e.annotate("GovernanceAction"))?;
.map_err(|e| e.annotate("governance_action"))?;
let anchor = (|| -> Result<_, DeserializeError> {
Ok(match raw.cbor_type()? != CBORType::Special {
true => Some(Anchor::deserialize(raw)?),
Expand Down Expand Up @@ -1570,6 +1570,25 @@ to_from_bytes!(Vote);

to_from_json!(Vote);

#[wasm_bindgen]
impl Vote {
pub fn new_no() -> Self {
Self(VoteKind::No)
}

pub fn new_yes() -> Self {
Self(VoteKind::Yes)
}

pub fn new_abstain() -> Self {
Self(VoteKind::Abstain)
}

pub fn kind(&self) -> VoteKind {
self.0.clone()
}
}

impl cbor_event::se::Serialize for Vote {
fn serialize<'se, W: Write>(
&self,
Expand Down

0 comments on commit 840db1f

Please sign in to comment.