Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in creating Mosaic using nem-sdk (javascript) #59

Open
johnmackyllego opened this issue Nov 13, 2018 · 1 comment
Open

Error in creating Mosaic using nem-sdk (javascript) #59

johnmackyllego opened this issue Nov 13, 2018 · 1 comment

Comments

@johnmackyllego
Copy link

johnmackyllego commented Nov 13, 2018

Error message:
{ code: 0, data: { timeStamp: 114514807, error: 'Internal Server Error', message: 'org.nem.core.serialization.SerializationException: java.lang.IllegalArgumentException: name does not match the desired pattern', status: 500 } }

our source code:
`
createMosaic : function(){
var privateKey = '7bfb69ab63df2a7ab4c690b206ddc4538dfae07e5cde4919dbe4ff385c6aff2a';
//var namespaceId = 'Brgy';
var mosaicName ='MoneyGram';
var initialSupply = 1000;
var divisibility = 2;
var transferable = true;
var supplyMutable = true;
var common = nem.model.objects.create('common')('', privateKey);

    // Get a MosaicDefinitionCreationTransaction object
    var tx = nem.model.objects.get("mosaicDefinitionTransaction");
    // Define the mosaic
    tx.mosaicName = mosaicName;
    tx.namespaceParent = {
        "fqn": "nanomoto"
    };
    tx.mosaicDescription = 'My mosaic';

    // Set properties (see https://nemproject.github.io/#mosaicProperties)
    tx.properties.initialSupply = initialSupply;
    tx.properties.divisibility = divisibility;
    tx.properties.transferable = transferable;
    tx.properties.supplyMutable = supplyMutable;
    tx.levy = {};
    //console.log(tx);
    
    // Prepare the transaction object
    var transactionEntity = nem.model.transactions.prepare("mosaicDefinitionTransaction")(common, tx, nem.model.network.data.testnet.id);
    console.log(transactionEntity);
    nem.model.transactions.send(common, transactionEntity, endpoint).then(function(res){
        console.log(res);
    },
        function(err){
        console.log(err);
    });

},`

We follow the instruction here:
https://github.com/QuantumMechanics/NEM-sdk/blob/master/examples/nodejs/createMosaic.js#L19

@riyazlafir
Copy link

@johnmackyllego please try mosaic name with lower case letters.
instead of this
tx.mosaicName = mosaicName;

try,
tx.mosaicName = mosaicname;

This solved the same issue which I had.

Cheers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants