Skip to content

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
DrW3RK committed Nov 3, 2024
1 parent 32caa0d commit 9953c7e
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 93 deletions.
10 changes: 5 additions & 5 deletions dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<link rel="stylesheet" href="/index-77823c9058aefd31.css" integrity="sha384&#x2D;vH0j4&#x2B;tJIhLSOHkJmBJvS2FJYcOydZadipBnTJ1gUtLEdtUCnfuRPrwCZ6paJ6ev"/>
<script nonce="ogvR2VpqEtGBEdtF28JIBA==">/**
<script nonce="JsKe985+RbW16ui4EEcOUQ==">/**
* The `@polkadot/extension-dapp` package can be dynamically imported.
* Usually it is wise to use a package manager like npm or yarn to install it as a dependency.
*
Expand Down Expand Up @@ -94,11 +94,11 @@
}
</script>
<title>Polkadot Utils</title>
<link rel="modulepreload" href="/polkadot_utils-322fd19e32d2d0c9.js" crossorigin=anonymous integrity="sha384-FSwsl1GGdLvRWfAtVbeRB44YfY/7ve9BTpP5+7EerKkSLNiq041P2Oa+01jK2rXx"><link rel="preload" href="/polkadot_utils-322fd19e32d2d0c9_bg.wasm" crossorigin=anonymous integrity="sha384-WNgPRx17Nk/xwqrYUmG2OkawUiFfD0jR5szru5qdYx3erA2+n4fbn9W+Lb2k13Cb" as="fetch" type="application/wasm"></head>
<link rel="modulepreload" href="/polkadot_utils-b21d58df25cd07bd.js" crossorigin=anonymous integrity="sha384-sYMTQKIOyR1Lw35ozKwrhZcp5+ucB34MM3MOSJpa50kt8Eipar8zNTYUIJM9/kAt"><link rel="preload" href="/polkadot_utils-b21d58df25cd07bd_bg.wasm" crossorigin=anonymous integrity="sha384-25hqJWu4KzSHjl19mwfV9IRbHoj5I5zPwJsuxxK8+yHG2DV7uHPJCr9AtH2mhceP" as="fetch" type="application/wasm"></head>
<body>
<script type="module" nonce="DjFcQPL+FpCHfWMTusO0nQ==">
import init, * as bindings from '/polkadot_utils-322fd19e32d2d0c9.js';
const wasm = await init('/polkadot_utils-322fd19e32d2d0c9_bg.wasm');
<script type="module" nonce="9K18BtZ6WbgZOEQGllIkog==">
import init, * as bindings from '/polkadot_utils-b21d58df25cd07bd.js';
const wasm = await init('/polkadot_utils-b21d58df25cd07bd_bg.wasm');


window.wasmBindings = bindings;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,35 +183,35 @@ function makeMutClosure(arg0, arg1, dtor, f) {
return real;
}
function __wbg_adapter_40(arg0, arg1, arg2) {
wasm.closure1391_externref_shim(arg0, arg1, arg2);
wasm.closure1376_externref_shim(arg0, arg1, arg2);
}

function __wbg_adapter_43(arg0, arg1) {
wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__ha4bc40c9cae6bfa0(arg0, arg1);
}

function __wbg_adapter_46(arg0, arg1, arg2) {
wasm.closure1389_externref_shim(arg0, arg1, arg2);
wasm.closure1374_externref_shim(arg0, arg1, arg2);
}

function __wbg_adapter_49(arg0, arg1, arg2) {
wasm.closure1385_externref_shim(arg0, arg1, arg2);
wasm.closure1370_externref_shim(arg0, arg1, arg2);
}

function __wbg_adapter_52(arg0, arg1) {
wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h55e5591b5d690f95(arg0, arg1);
}

function __wbg_adapter_55(arg0, arg1, arg2) {
wasm.closure1897_externref_shim(arg0, arg1, arg2);
wasm.closure1882_externref_shim(arg0, arg1, arg2);
}

function __wbg_adapter_58(arg0, arg1, arg2) {
wasm.closure1906_externref_shim(arg0, arg1, arg2);
wasm.closure1891_externref_shim(arg0, arg1, arg2);
}

function __wbg_adapter_61(arg0, arg1, arg2) {
wasm.closure1932_externref_shim(arg0, arg1, arg2);
wasm.closure1917_externref_shim(arg0, arg1, arg2);
}

function notDefined(what) { return () => { throw new Error(`${what} is not defined`); }; }
Expand Down Expand Up @@ -924,36 +924,36 @@ function __wbg_get_imports() {
const ret = wasm.memory;
return ret;
};
imports.wbg.__wbindgen_closure_wrapper13996 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 1392, __wbg_adapter_40);
imports.wbg.__wbindgen_closure_wrapper13960 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 1377, __wbg_adapter_40);
return ret;
};
imports.wbg.__wbindgen_closure_wrapper13998 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 1388, __wbg_adapter_43);
imports.wbg.__wbindgen_closure_wrapper13962 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 1373, __wbg_adapter_43);
return ret;
};
imports.wbg.__wbindgen_closure_wrapper14000 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 1390, __wbg_adapter_46);
imports.wbg.__wbindgen_closure_wrapper13964 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 1375, __wbg_adapter_46);
return ret;
};
imports.wbg.__wbindgen_closure_wrapper14002 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 1386, __wbg_adapter_49);
imports.wbg.__wbindgen_closure_wrapper13966 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 1371, __wbg_adapter_49);
return ret;
};
imports.wbg.__wbindgen_closure_wrapper21331 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 1876, __wbg_adapter_52);
imports.wbg.__wbindgen_closure_wrapper21295 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 1861, __wbg_adapter_52);
return ret;
};
imports.wbg.__wbindgen_closure_wrapper21634 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 1898, __wbg_adapter_55);
imports.wbg.__wbindgen_closure_wrapper21598 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 1883, __wbg_adapter_55);
return ret;
};
imports.wbg.__wbindgen_closure_wrapper21926 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 1907, __wbg_adapter_58);
imports.wbg.__wbindgen_closure_wrapper21890 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 1892, __wbg_adapter_58);
return ret;
};
imports.wbg.__wbindgen_closure_wrapper22538 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 1933, __wbg_adapter_61);
imports.wbg.__wbindgen_closure_wrapper22502 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 1918, __wbg_adapter_61);
return ret;
};
imports.wbg.__wbindgen_init_externref_table = function() {
Expand Down
Binary file not shown.
10 changes: 5 additions & 5 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<link rel="stylesheet" href="index-47812d4498fa1a07.css" integrity="sha384&#x2D;EJAF6aT0d1cCgFdxQqWFI7yH8hN49DqD649i7un&#x2F;TJG77E&#x2B;A3Z&#x2F;o0&#x2B;R4VarNlTtf"/>
<script nonce="AT38Lw1TH1HbOKdDD+LSzg==">/**
<script nonce="su5nsrzdWOm4aX5+/IXqnw==">/**
* The `@polkadot/extension-dapp` package can be dynamically imported.
* Usually it is wise to use a package manager like npm or yarn to install it as a dependency.
*
Expand Down Expand Up @@ -94,11 +94,11 @@
}
</script>
<title>Polkadot Utils</title>
<link rel="modulepreload" href="polkadot_utils-50338793d59371ae.js" crossorigin=anonymous integrity="sha384-I1teqoYcRDEvsrZ6KWF/c/um6oB7dx5d9gOZKyAtNHIpi6/rWa/jNk/FPiQZwWMV"><link rel="preload" href="polkadot_utils-50338793d59371ae_bg.wasm" crossorigin=anonymous integrity="sha384-SkMmDxYKUeNK/pcAHZw7OWFC2QoFPOfj4fv2JCvDZSpO81WpdTaSkTUGpTMMljSN" as="fetch" type="application/wasm"></head>
<link rel="modulepreload" href="polkadot_utils-8d94d765d977a674.js" crossorigin=anonymous integrity="sha384-wMbWrwut1WX8EIKxmvKalOfeOPwcv8lBIqD92SW7I3kd0Qbgy9FTouPtr3CaYGTH"><link rel="preload" href="polkadot_utils-8d94d765d977a674_bg.wasm" crossorigin=anonymous integrity="sha384-LWdBIzLALPCO5cZLcNF1y5TJxaH5K12EgZx6HTRUBVVnXFzidYR5x9XZD5/1jtH+" as="fetch" type="application/wasm"></head>
<body>
<script type="module" nonce="MkxAe+PySp6qL33hBm5xaQ==">
import init, * as bindings from './polkadot_utils-50338793d59371ae.js';
const wasm = await init('./polkadot_utils-50338793d59371ae_bg.wasm');
<script type="module" nonce="qyvpF1Qj99PDoxtdLPkx6Q==">
import init, * as bindings from './polkadot_utils-8d94d765d977a674.js';
const wasm = await init('./polkadot_utils-8d94d765d977a674_bg.wasm');


window.wasmBindings = bindings;
Expand Down
Binary file removed docs/polkadot_utils-50338793d59371ae_bg.wasm
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ function makeMutClosure(arg0, arg1, dtor, f) {
return real;
}
function __wbg_adapter_40(arg0, arg1, arg2) {
wasm.closure993_externref_shim(arg0, arg1, arg2);
wasm.closure994_externref_shim(arg0, arg1, arg2);
}

function __wbg_adapter_45(arg0, arg1) {
Expand Down Expand Up @@ -300,15 +300,6 @@ function __wbg_get_imports() {
const ret = getStringFromWasm0(arg0, arg1);
return ret;
};
imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
const obj = arg1;
const ret = typeof(obj) === 'string' ? obj : undefined;
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len1 = WASM_VECTOR_LEN;
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
};
imports.wbg.__wbg_getAccounts_ddedcb7f03b80e6e = typeof getAccounts == 'function' ? getAccounts : notDefined('getAccounts');
imports.wbg.__wbg_signPayload_e099eda806c93847 = function(arg0, arg1, arg2, arg3, arg4, arg5) {
let deferred0_0;
let deferred0_1;
Expand All @@ -331,6 +322,15 @@ function __wbg_get_imports() {
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
}
};
imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
const obj = arg1;
const ret = typeof(obj) === 'string' ? obj : undefined;
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len1 = WASM_VECTOR_LEN;
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
};
imports.wbg.__wbg_getAccounts_ddedcb7f03b80e6e = typeof getAccounts == 'function' ? getAccounts : notDefined('getAccounts');
imports.wbg.__wbindgen_is_string = function(arg0) {
const ret = typeof(arg0) === 'string';
return ret;
Expand Down Expand Up @@ -916,35 +916,35 @@ function __wbg_get_imports() {
const ret = wasm.memory;
return ret;
};
imports.wbg.__wbindgen_closure_wrapper2261 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 994, __wbg_adapter_40);
imports.wbg.__wbindgen_closure_wrapper2254 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 995, __wbg_adapter_40);
return ret;
};
imports.wbg.__wbindgen_closure_wrapper2263 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 994, __wbg_adapter_40);
imports.wbg.__wbindgen_closure_wrapper2256 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 995, __wbg_adapter_40);
return ret;
};
imports.wbg.__wbindgen_closure_wrapper2265 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 994, __wbg_adapter_45);
imports.wbg.__wbindgen_closure_wrapper2258 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 995, __wbg_adapter_45);
return ret;
};
imports.wbg.__wbindgen_closure_wrapper2267 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 994, __wbg_adapter_40);
imports.wbg.__wbindgen_closure_wrapper2260 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 995, __wbg_adapter_40);
return ret;
};
imports.wbg.__wbindgen_closure_wrapper3178 = function(arg0, arg1, arg2) {
imports.wbg.__wbindgen_closure_wrapper3171 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 1279, __wbg_adapter_50);
return ret;
};
imports.wbg.__wbindgen_closure_wrapper3260 = function(arg0, arg1, arg2) {
imports.wbg.__wbindgen_closure_wrapper3253 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 1314, __wbg_adapter_53);
return ret;
};
imports.wbg.__wbindgen_closure_wrapper3274 = function(arg0, arg1, arg2) {
imports.wbg.__wbindgen_closure_wrapper3267 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 1321, __wbg_adapter_56);
return ret;
};
imports.wbg.__wbindgen_closure_wrapper3313 = function(arg0, arg1, arg2) {
imports.wbg.__wbindgen_closure_wrapper3306 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 1340, __wbg_adapter_59);
return ret;
};
Expand Down
Binary file added docs/polkadot_utils-8d94d765d977a674_bg.wasm
Binary file not shown.
28 changes: 7 additions & 21 deletions src/routes/on_demand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use subxt::{OnlineClient, PolkadotConfig};

use subxt::config::DefaultExtrinsicParamsBuilder;
use subxt::ext::codec::{Decode, Encode};
use subxt::tx::Payload as _;
use subxt::tx::SubmittableExtrinsic;
use subxt::utils::{AccountId32, MultiSignature};
use crate::services::paseo::runtime_types::polkadot_parachain_primitives::primitives;
Expand All @@ -16,21 +15,12 @@ use yew::prelude::*;

pub struct OnDemandComponent {
message: String,
remark_call_bytes: Vec<u8>,
online_client: Option<OnlineClient<PolkadotConfig>>,
stage: SigningStage,
}

impl OnDemandComponent {
/// # Panics
/// panics if self.online_client is None.
fn set_message(&mut self, message: String) {
let remark_call = paseo::tx().system().remark(message.as_bytes().to_vec());
let online_client = self.online_client.as_ref().unwrap();
let remark_call_bytes = remark_call
.encode_call_data(&online_client.metadata())
.unwrap();
self.remark_call_bytes = remark_call_bytes;
self.message = message;
}
}
Expand All @@ -56,7 +46,7 @@ pub enum SubmittingStage {
},
Submitting,
Success {
remark_event: paseo::system::events::ExtrinsicSuccess,
success_event: paseo::system::events::ExtrinsicSuccess,
},
Error(anyhow::Error),
}
Expand All @@ -75,7 +65,7 @@ pub enum Message {
),
SubmitSigned,
ExtrinsicFinalized {
remark_event: paseo::system::events::ExtrinsicSuccess,
success_event: paseo::system::events::ExtrinsicSuccess,
},
ExtrinsicFailed(anyhow::Error),
}
Expand All @@ -96,7 +86,6 @@ impl Component for OnDemandComponent {
message: "".to_string(),
stage: SigningStage::CreatingOnlineClient,
online_client: None,
remark_call_bytes: vec![],
}
}

Expand Down Expand Up @@ -221,18 +210,18 @@ impl Component for OnDemandComponent {
)
.await
{
Ok(remark_event) => Message::ExtrinsicFinalized { remark_event },
Ok(success_event) => Message::ExtrinsicFinalized { success_event },
Err(err) => Message::ExtrinsicFailed(err),
}
});
}
}
Message::ExtrinsicFinalized { remark_event } => {
Message::ExtrinsicFinalized { success_event } => {
if let SigningStage::SigningSuccess {
submitting_stage, ..
} = &mut self.stage
{
*submitting_stage = SubmittingStage::Success { remark_event }
*submitting_stage = SubmittingStage::Success { success_event }
}
}
Message::ExtrinsicFailed(err) => {
Expand All @@ -255,9 +244,6 @@ impl Component for OnDemandComponent {
| SigningStage::EnterMessage
| SigningStage::CreatingOnlineClient => html!(<></>),
_ => {
let _remark_call = paseo::tx()
.system()
.remark(self.message.as_bytes().to_vec());
html!(
<div>
<div class="mb">
Expand Down Expand Up @@ -353,8 +339,8 @@ impl Component for OnDemandComponent {
SubmittingStage::Submitting => {
html!(<div class="loading"><b>{"Submitting Extrinsic... (please wait a few seconds)"}</b></div>)
}
SubmittingStage::Success { remark_event } => {
html!(<div style="overflow-wrap: break-word;"> <b>{"Successfully submitted Extrinsic. Event:"}</b> <br/> {format!("{:?}", remark_event)} </div>)
SubmittingStage::Success { success_event } => {
html!(<div style="overflow-wrap: break-word;"> <b>{"Successfully submitted Extrinsic. Event:"}</b> <br/> {format!("{:?}", success_event)} </div>)
}
SubmittingStage::Error(err) => {
html!(<div class="error"> {"Error: "} {err.to_string()} </div>)
Expand Down
Loading

0 comments on commit 9953c7e

Please sign in to comment.