#u64 from the CLI?
22 messages · Page 1 of 1 (latest)
Maybe trying using U64 -> SCV_OBJECT ?
{"object":{"u64":0}}
{"object":{"vec":[{"object":{"u64": 1800}}]} ??
right! that worked. Thanks! Probably would still be a good idea to accept u64 though.
I think the problem is u64 (native primitive) is treated different from U64 (object = custom type) when parsed from the --arg
so they are, actually different types 🙂
cc @dim vessel
Yes that's right when rendered in the JSON form the u64 type is inside an object because it is not a primitive type in the host types but rather a handle to a value stored on the host side.
However, I would have thought [0,1,2,...] would work fine for Vec<u64> because for some types the CLI will coerce simpler string values.
probably ~~ a case ~~(sorry, no "cases" in Rust, only match) was left out
Other question, why does an u63 trap? I encountered the same issue when writing my SCV guide
https://gist.github.com/Smephite/09b40e842ef454effe4693e0d18246d7#scv_u63-json-representation
hence the warning atm lol
Could you share an example where u63 traps?
The u63 type is only usable with i64 parameters. That might be what you're seeing if you try and use it with a u64 you'll see an error.
@dim vessel maybe I'm going into the rabbit hole more than I should but just what is a MeteredBigInt in the host?
https://github.com/stellar/rs-soroban-env/blob/main/soroban-env-host/src/host.rs#L663
ScObject::BigInt(sbi) => {
let bi = match sbi {
ScBigInt::Zero => MeteredBigInt::new(self.0.budget.clone())?,
ScBigInt::Positive(bytes) => MeteredBigInt::from_bytes_be(
self.0.budget.clone(),
Sign::Plus,
bytes.as_ref(),
)?,
ScBigInt::Negative(bytes) => MeteredBigInt::from_bytes_be(
self.0.budget.clone(),
Sign::Minus,
bytes.as_ref(),
)?,
};
Hmm. I think MeteredBigInt is probably not intended for use outside of the environment. What are you hoping to do with it?
Just understand as much as I can about Soroban 🙂 I honestly just like getting to know as much as I can, it sure helps a lot down the road (specially when debugging)