The Smartpy compiler allow to compile a contract (compiling the code and the initial storage) but I don't see any "compile-parameter" option, that would allow to convert a smartpy command to a michelson representation.
How can I call a deployed smartpy contract ?
ps : I tried to add a compilation target like this:
sp.add_expression_compilation_target("minting", FA12(admin=sp.address("tz1cpb3rLapo7RbsZNE3Qy6TMzqNWCxk9hXA"), config = FA12_config(
support_upgradable_metadata = True,
use_token_metadata_offchain_view = True
),
token_metadata = {
"decimals" : "18", # Mandatory by the spec
"name" : "TestToken", # Recommended
"symbol" : "TEST", # Recommended
# Extra fields
"icon" : 'https://smartpy.io/static/img/logo-only.svg'
}).mint({"address" : sp.address("tz1cpb3rLapo7RbsZNE3Qy6TMzqNWCxk9hXA"), "value" : 12}))
but the compilator give me this error:
Traceback (most recent call last):
File "contracts/FA12.py", line 453, in <module>
sp.add_expression_compilation_target("minting", FA12(admin=sp.address("tz1cpb3rLapo7RbsZNE3Qy6TMzqNWCxk9hXA"), config = FA12_config(
File "contracts/FA12.py", line 130, in mint
sp.set_type(params, sp.TRecord(address = sp.TAddress, value = sp.TNat))
Exception: New command outside of contract (line 130 of contracts/FA12.py):
(set_type (map ("contracts/FA12.py" 130) ((literal (string "address") ("contracts/FA12.py" 130)) (literal (address "tz1cpb3rLapo7RbsZNE3Qy6TMzqNWCxk9hXA") ("contracts/FA12.py" 463))) ((literal (string "value") ("contracts/FA12.py" 130)) (literal (intOrNat 12) ("contracts/FA12.py" 130)))) (record ((address "address") (value "nat")) None) ("contracts/FA12.py" 130))
ps2: I tried to add another compilation target like this:
sp.add_expression_compilation_target("minting", mint({"address" : sp.address("tz1cpb3rLapo7RbsZNE3Qy6TMzqNWCxk9hXA"), "value" : 12}))
but the compilator give me this error (this is why I have tried to reinit the smart contract in my previous attempt):
File "contracts/FA12.py", line 453, in <module>
sp.add_expression_compilation_target("minting", mint({"address" : sp.address("tz1cpb3rLapo7RbsZNE3Qy6TMzqNWCxk9hXA"), "value" : 12}))
NameError: name 'mint' is not defined
Any idea ?