Questions tagged [convert]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
3 votes
1 answer
79 views

How to use FixedU128?

I'm fetching floating value in offchain worker though lite-json. Json data: { "price": 0.5 } Here is the implementation to fetch the price: let price_str = match obj.clone() { ...
Deepak Chaudhary's user avatar
0 votes
2 answers
3k views

How to convert usize to u32 in ink!

How can I convert a usize to u32? For example I want to store the length of a Vector (usize) to a variable u32 I tried i32::from(v) // or v.into(). where v is the length of the vector but errored I ...
Sokrates's user avatar
  • 421
3 votes
2 answers
91 views

Transition to Parachain

This feels like a silly question, but I'm wondering... If I have an existing permissioned chain running on Substrate with a token and a large number of holders, can I safely transition the application ...
Greg Perrin's user avatar
7 votes
2 answers
370 views

How to get bytes [u8; 32] from AccountId?

There is a way to convert [u8; 32] to AccountId T::AccountId::decode(&mut &bytes[..]).unwrap_or_default(); but how to do the reverse? let sender: T::AccountId = ensure_signed(origin)?; let ...
Stefan Muto's user avatar
2 votes
1 answer
43 views

Using parent hash in a pallet - can't get the raw values from the associated type

I'm trying to use the parent block hash in my code, but I having trouble getting the raw numeric values. I can see that <frame_system::Pallet<T>>::parent_hash() returns the values inside ...
JelliedOwl - Paul's user avatar