Questions tagged [types]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
2 answers
19 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<[ ...
Grum's user avatar
  • 163
0 votes
1 answer
47 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 ...
0x10's user avatar
  • 369
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,...
0x10's user avatar
  • 369
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 ...
0x10's user avatar
  • 369
1 vote
1 answer
82 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 ...
0x10's user avatar
  • 369
3 votes
1 answer
110 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 ...
0x10's user avatar
  • 369
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 ...
0x10's user avatar
  • 369
2 votes
2 answers
50 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 ...
Nik's user avatar
  • 23
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?
Rob's user avatar
  • 576
1 vote
1 answer
78 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 ...
Whirlybird's user avatar
2 votes
1 answer
81 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 ...
JJJ's user avatar
  • 557
0 votes
1 answer
73 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 ...
JJJ's user avatar
  • 557
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 ...
Darius's user avatar
  • 649
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. ...
Darius's user avatar
  • 649
1 vote
1 answer
83 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 ...
Darius's user avatar
  • 649
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 ...
Darius's user avatar
  • 649
3 votes
1 answer
169 views

Is it possible to convert types in SmartPy?

For example, converting a TMutez into a TString?
Darius's user avatar
  • 649
2 votes
1 answer
187 views

Convert address to string in LIGO

How do I convert an address type to a string type in LIGO?
Thorkil Værge's user avatar