3
votes
Accepted
Why can I not subtract 2 local variables of type nat from each other and assign that result to another local variable in a view in smartpy?
Subtractions are implicitly taken as int due to the possibility of negative results. Therefore, the variable sub is of type int here.
To resolve this, wrap sub as sp.as_nat(sub) on the dividend.
- 351
3
votes
Which hash function is used when converting an address from raw bytes?
It’s not hashed. You simply need to compute the base58 translation with the right prefix.
Proof that it’s not hashed: this process is reversible.
- 3,250
1
vote
Accepted
Receiving a "doesn't have a comparable type" error when returning a list from an on-chain view
You cannot compare lists in Tezos.
However, you can use scenario.verify_equal.
- 3,250
1
vote
Accepted
How can I assign values for a map-type in an archetype test script?
I think you should try with this:
const tmdMap : Array<[ string, Bytes ]> = [[" ", tmdBytes]]
In typescript, tuple and array have the same literal [].
And here, it is a tuple into an ...
1
vote
How can I assign values for a map-type in an archetype test script?
The expected type reads "an array of pairs of string and bytes", and [" ", tmdBytes] is just a pair, hence I guess the following value should make ti:
const tmdMap : Array<[ ...
- 489
1
vote
Accepted
How do you submit a pair when calling an entrypoint on a contract with Taquito?
Your code is correct, but you have to use the methodsObject property instead of methods if you want to use a JavaScript object as the parameter of the contract call.
Alternatively, you can split the ...
- 896
1
vote
Accepted
Why does unpacking a record that has a key containing bounded data fail with `to_value sp.TBounded` in smartpy?
It is unsafe without a dynamic check.
We need to determine what the most natural and/or appropriate decision is (very possibly: continue forbidding it).
- 3,250
Only top scored, non community-wiki answers of a minimum length are eligible