I tried creating an asset by following this link: Issuing Assets.
I am able to successfully issue asset and transfer to another account. But when I check the balance of other accounts, I get:
Type: credit_alphanum12 , Balance: 10.0000000
Type: credit_alphanum12 , Balance: 10.0000000
Type: native , Balance: 9981.9998400
I don't know why the assets name didn't appear. I can't distinguish between assest if I don't see their names.
This is the code snippet I used:
To issuse asset
// Create an object to represent the new asset
//var astroDollar = new StellarSdk.Asset('AstroDollar', issuingKeys.publicKey());
Complete code:
var StellarSdk = require('stellar-sdk');
StellarSdk.Network.useTestNetwork();
var server = new StellarSdk.Server('http://127.0.0.1:8000', {allowHttp: true});
// Keys for accounts to issue and receive the new asset
var issuingKeys = StellarSdk.Keypair
.fromSecret('______secret key_issuer__________');
var receivingKeys = StellarSdk.Keypair
.fromSecret('______secret key_receiver__________');
// Create an object to represent the new asset
//var astroDollar = new StellarSdk.Asset('AstroDollar', issuingKeys.publicKey());
var astroDollar = new StellarSdk.Asset('AstroDollar', issuingKeys.publicKey());
// First, the receiving account must trust the asset
server.loadAccount(receivingKeys.publicKey())
.then(function(receiver) {
var transaction = new StellarSdk.TransactionBuilder(receiver)
// The `changeTrust` operation creates (or alters) a trustline
// The `limit` parameter below is optional
.addOperation(StellarSdk.Operation.changeTrust({
asset: astroDollar,
limit: '1000'
}))
.build();
transaction.sign(receivingKeys);
return server.submitTransaction(transaction);
})
// Second, the issuing account actually sends a payment using the asset
.then(function() {
return server.loadAccount(issuingKeys.publicKey())
})
.then(function(issuer) {
var transaction = new StellarSdk.TransactionBuilder(issuer)
.addOperation(StellarSdk.Operation.payment({
destination: receivingKeys.publicKey(),
asset: astroDollar,
amount: '10'
}))
.build();
transaction.sign(issuingKeys);
console.log("success")
return server.submitTransaction(transaction);
})
.catch(function(error) {
console.error('Error!', error);
});
What exactly am I missing?