Can we parse a varialble of type sp.TAddress to sp.TString like this:
strAddress = sp.string(sp.address("tz1-add")) or strAddress = str(sp.address("tz1-add"))?
Smart Contract Example:
import smartpy as sp
class SmartContract(sp.Contract):
def init(self):
self.init(fromAddress = "")
@sp.entry_point
def transferEvent(self, params):
self.data.fromAddress = sp.string(params.fromAddress)
if "templates" not in name:
@sp.add_test(name = "Smart Contract")
def test():
c1 = SmartContract()
scenario = sp.test_scenario()
scenario += c1
scenario.h1("Smart Contract")
scenario += c1.transferEvent(strAddress = sp.address("tz1MFYTrMMhh7QBq8NRP6QMU2gcrcGhjSTrv"))
scenario.verify(c1.data.fromAddress == "tz1MFYTrMMhh7QBq8NRP6QMU2gcrcGhjSTrv")
As Error I get:
Error: Error in Scenario Literal format error: (string(attr(params 8)fromAddress 9)) Traceback (most recent call last):
Thanks.