尝试使用python API在testnet上发布令牌 - Neblio

时间:2018-04-25 13:54:17

标签: python python-3.x api blockchain neblio

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的可能性,发行令牌和类似的东西。我做错了什么?

我收到了这样的错误:

  

引发ValueError(“issue_address的值无效”,不得为   None“)#noqa:E501

     

ValueError:issue_address的值无效,不得为None

2 个答案:

答案 0 :(得分:3)

感谢您提出第一个Neblio SO问题!

我们在不和谐中对此进行了整理。需要命名令牌的元数据,并且需要更新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

答案 1 :(得分:1)

通过查看 - documentation here我认为您需要将作业更改为

body.issue_address = "TUfp4Ss95xaKQPNGpbiZDsMPe4NR16CDiL"

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

body.issue_address("TUfp4Ss95xaKQPNGpbiZDsMPe4NR16CDiL")