尝试使用python API Nebli在testnet上发出令牌

2024-05-18 15:47:05 发布

您现在位置:Python中文网/ 问答频道 /正文

from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# create an instance of the API class
api_instance = swagger_client.TestnetNTP1Api()
body = swagger_client.IssueTokenRequest() # IssueTokenRequest | Object representing the token to be created

try:
    # Builds a transaction that issues a new NTP1 Token
    body.issue_address(issue_address="TUfp4Ss95xaKQPNGpbiZDsMPe4NR16CDiL")
    body.amount(1000)
    body.divisibility(0)
    body.fee(1000000000)    
    body.reissuable(False)
    body.metadata({"token_name": "STST", "issuer": "Septio", "description": "Septio_Test"})    
    api_response = api_instance.testnet_issue_token(body)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling NTP1Api->issue_token: %s\n" % e)

我正试着去测试NEBL的可能性,发行代币之类的东西。我做错什么了?在

我得到这样的错误:

raise ValueError("Invalid value for issue_address, must not be None") # noqa: E501

ValueError: Invalid value for issue_address, must not be None


Tags: theinstancefromimportclienttokenapiaddress
2条回答

谢谢你问了第一个问题!在

我们解决了这个问题。命名令牌的元数据是必需的,需要更新API文档以反映这一点。在

你想要这样的东西:

body = swagger_client.IssueTokenRequest(
    issue_address = "TUfp4Ss95xaKQPNGpbiZDsMPe4NR16CDiL",
    amount = 10000, 
    divisibility = 0,
    fee = 1000030000, 
    reissuable = False,
    metadata = swagger_client.IssueTokenRequestMetadata(
        token_name = "TEST",
        issuer = "Me",
        description = "My test token"
    )   
)  # IssueTokenRequest | Object representing the token to be created

通过查看-documentation here,我认为您需要将赋值改为

body.issue_address = "TUfp4Ss95xaKQPNGpbiZDsMPe4NR16CDiL"

也可以通过查看其他作业来尝试这种格式。在

body.issue_address("TUfp4Ss95xaKQPNGpbiZDsMPe4NR16CDiL")

相关问题 更多 >

    热门问题