- Query
- QueryToken --QueryToken
- QueryTokens --QueryTokens
- QueryFees --QueryFees
- QueryParams --QueryParams
- TX
- IssueToken --IssueToken
- EditToken --EditToken
- TransferToken --TransferToken
- MintToken --MintToken
Query a single token
token, err := client.Token.QueryToken("test1")
Query all tokens
token, err := client.Token.QueryTokens("")
Inquiry fee
token, err := client.Token.QueryFees("test1")
Query parameters
res, err := client.Token.QueryParams()
Issue tokens You need to import the private key before you can operate,Please see the key package for importing the private key
baseTx := types.BaseTx{
From: "demo", //Account name
Password: "123123123",
Gas: 200000,
Mode: types.Commit,
Memo: "test",
}
baseTx.Fee, err = types.ParseDecCoins("2000plug") //Fee
issueTokenReq := token.IssueTokenRequest{
Symbol: "test1",
Name: "testToken",
Scale: 8,
MinUnit: "tt1",
InitialSupply: 10000000,
MaxSupply: 21000000,
Mintable: true,
}
rs, err := client.Token.IssueToken(issueTokenReq, baseTx)
Modify token You need to import the private key before you can operate,Please see the key package for importing the private key
baseTx := types.BaseTx{
From: "demo", //Account name
Password: "123123123",
Gas: 200000,
Mode: types.Commit,
Memo: "test",
}
baseTx.Fee, err = types.ParseDecCoins("2000plug") //Fee
editTokenReq := token.EditTokenRequest{
Symbol: "test1",
Name: "testToken66",
MaxSupply: 22000000,
}
rs, err := client.Token.EditToken(editTokenReq, baseTx)
Transfer token ownership You need to import the private key before you can operate,Please see the key package for importing the private key
baseTx := types.BaseTx{
From: "demo", //Account name
Password: "123123123",
Gas: 200000,
Mode: types.Commit,
Memo: "test",
}
baseTx.Fee, err = types.ParseDecCoins("2000plug") //Fee
rs, err := client.Token.TransferToken("gx1akqhezuftdcc0eqzkq5peqpjlucgmyr7srx54j", "test1", baseTx)
Coinage token You need to import the private key before you can operate,Please see the key package for importing the private key
baseTx := types.BaseTx{
From: "demo", //Account name
Password: "123123123",
Gas: 200000,
Mode: types.Commit,
Memo: "test",
}
baseTx.Fee, err = types.ParseDecCoins("2000plug") //Fee
rs, err = client.Token.MintToken("test1", 11000000, "gx1yhf7w0sq8yn6gqre2pulnqwyy30tjfc4v08f3x", baseTx)