Trying to issue tokens on testnet with python API

0 votes

I am using this code:

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)

I get such error:

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

ValueError: Invalid value for issue_address, must not be None
Sep 17, 2018 in Blockchain by slayer
• 29,370 points
849 views

2 answers to this question.

0 votes

Metadata naming the token is required and the API docs need to be updated to reflect this.

You want something like this:

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"
    )   
)
answered Sep 17, 2018 by digger
• 26,740 points
0 votes

By looking at - documentation here I think you need to change the assignment as

body.issue_address = "TUfp4Ss95xaKQPNGpbiZDsMPe4NR16CDiL"

Also try this format, by looking at other assignments.

body.issue_address("TUfp4Ss95xaKQPNGpbiZDsMPe4NR16CDiL")

answered Sep 17, 2018 by Khush

Related Questions In Blockchain

0 votes
2 answers

Why is network already up to date while trying to deploy a contract on truffle?

I guess you have ganache running already ...READ MORE

answered Apr 24, 2018 in Blockchain by Shashank
• 10,400 points
4,573 views
0 votes
1 answer
+1 vote
4 answers
+1 vote
3 answers

Removing double quotes from a string from JSON response in PHP

Just remove the json_encode call, and it should work: $resp ...READ MORE

answered Sep 12, 2018 in Blockchain by digger
• 26,740 points
45,225 views
0 votes
1 answer

How do I add multiple recipients for transactions via Blockchain API?

Convert the recipes into JSON objects. x = ...READ MORE

answered Jul 6, 2018 in Blockchain by Perry
• 17,100 points
891 views
0 votes
1 answer

Python request module for bitcoin json rpc

This should work: #!/usr/bin/env python import getpass import json import requests ...READ MORE

answered Aug 28, 2018 in Blockchain by digger
• 26,740 points
2,365 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
1,928 views
0 votes
1 answer

Korbit api with python http.client

http.client.HTTPSConnection accepts hostname, not a url. conn = http.client.HTTPSConnection("api.korbit.co.kr", ...READ MORE

answered Aug 28, 2018 in Blockchain by digger
• 26,740 points
1,424 views
0 votes
2 answers
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP