Questions tagged [types]
The types tag has no usage guidance.
18
questions
3
votes
1
answer
70
views
How can I avoid sp.TOption type when using sp.unpack()?
Within my smartpy contract, I want to convert from one type into another using sp.pack() and sp.unpack.
Below is an example of the method I am trying to use, converting a string to bytes.
...
3
votes
1
answer
184
views
Is it possible to convert types in SmartPy?
For example, converting a TMutez into a TString?
2
votes
1
answer
79
views
How much storage do numbers take?
I'm trying to figure out how byte storage works for numbers. What size is a Nat vs an Int in bytes? Or, is there a way to encode a u8 vs a u64?
2
votes
1
answer
60
views
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?
I am trying to do some maths operations inside an on-chain view and am getting an unexpected result.
The reproduction contract tries to perform the following steps:
Define an internal contract ...
2
votes
1
answer
191
views
Convert address to string in LIGO
How do I convert an address type to a string type in LIGO?
2
votes
2
answers
53
views
Smartpy restrict entrypoint for originated addresses (KT1)
I would like to know if the entrypoint of my smart contract is called from an implicit(tz1) or an originated address(KT1). How can i do the check in smartpy?
Looking at the Smartpy documentation, it's ...
2
votes
1
answer
84
views
Smartpy Michelson errors only on deployment (inconsistent_annotations, inconsistent_types)
Getting this error ONLY when deploying the smartpy contract. There are otherwise no errors when testing/compiling the code. Is there a way to get a better error message? Is there a way to trigger ...
2
votes
1
answer
120
views
How to use internal hacks to convert from String to Address (or from Address to String) in SmartPy
There is a similar question but it does not fully answer this question.
In the answer for that question posted here there is mention that while it is officially not possible it is actually technically ...
1
vote
1
answer
92
views
Which hash function is used when converting an address from raw bytes?
With the raw address 0x0000861299624c9a3b52be10762c64bac282b1c02316 the first 4 characters (0000 in this case) represent tz1 and the rest of the string is the raw Tezos address.
From my research it ...
1
vote
2
answers
66
views
What is a 'valid case' for bls12_381_fr?
I am trying to originate a contract using bls12_381_fr types and am running into an error. The same contract originated successfully on the edo branch of the Metastate repository.
Now I am running the ...
1
vote
1
answer
29
views
Receiving a "doesn't have a comparable type" error when returning a list from an on-chain view
When I return a list from an on-chain view am receiving a type error but am unsure where to set the type in order to fix it.
Returning a string or integer from the view works fine. Is there a set ...
1
vote
1
answer
79
views
value is invalid for type
I'm trying to call the addLiquidity entrypoint of this contract, which is a copy of the Liquidity Baking CPMM contract, which is itself a copy of the Dexter contract.
The original Dexter docs give an ...
1
vote
1
answer
84
views
What's the best way to convert from TMutez to TBytes?
Previously when I asked about converting types, I got this useful suggestion:
For mutez, you could start to convert to int (by dividing by 1 mutez) and then use the same techniques.
I'm wondering if ...
1
vote
1
answer
37
views
How to format storage for a contract call with parameters?
I am trying to construct the storage needed to do an on chain contract call but I'm having trouble passing in the parameters. What is making it tricky is that one of the parameters is of type ...
0
votes
2
answers
20
views
How can I assign values for a map-type in an archetype test script?
I have the following typescript in my test script:
const tmdBytes = Bytes.hex_encode("ipfs://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
const tmdMap : Array<[ ...
0
votes
1
answer
82
views
error Type sp.TInt / sp.TNat mismatch
Error: Type sp.TInt / sp.TNat mismatch
sp.is_nat expects a sp.TInt
Got: sp.TNat
line 119
Line: 119
self.data.shop_items[item_to_purchase.key].amount -= sp.as_nat(item_to_purchase.value)
I'm ...
0
votes
1
answer
50
views
How do you submit a pair when calling an entrypoint on a contract with Taquito?
I am trying to submit a Pair of Bytes in a contract call with Taquito but am receiving an error.
The contract interaction documentation does not go into exactly how to submit a Pair, but it does go ...
0
votes
1
answer
37
views
Why does unpacking a record that has a key containing bounded data fail with `to_value sp.TBounded` in smartpy?
Tests are throwing a to_value error in the scenario when trying to unpack a record that contains a key with a bounded type TNat inside the entrypoint being called.
There's a minimal reproduction below,...