Created
June 20, 2022 15:04
-
-
Save xembook/aa83aba2d34b80d07bd52827a3fdd294 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alice = sym.Account.createFromPrivateKey("896E43895B908AF5847ECCB2645543751D94BD87E71058B003417FED512*****",networkType); | |
supplyMutable = false; //供給量変更の可否 | |
transferable = false; //第三者への譲渡可否 | |
restrictable = true; //制限設定の可否 | |
revokable = true; //発行者からの還収可否 | |
//モザイク定義 | |
nonce = sym.MosaicNonce.createRandom(); | |
mosaicDefTx = sym.MosaicDefinitionTransaction.create( | |
undefined, | |
nonce, | |
sym.MosaicId.createFromNonce(nonce, alice.address), //モザイクID | |
sym.MosaicFlags.create(supplyMutable, transferable, restrictable, revokable), | |
0,//divisibility:可分性 | |
sym.UInt64.fromUint(0), //duration:有効期限 | |
networkType | |
); | |
//モザイク数量固定 | |
mosaicChangeTx = sym.MosaicSupplyChangeTransaction.create( | |
undefined,mosaicDefTx.mosaicId, | |
sym.MosaicSupplyChangeAction.Increase, //増やす | |
sym.UInt64.fromUint(1), //数量1 | |
networkType | |
); | |
//NFTデータ | |
nftTx = sym.TransferTransaction.create( | |
undefined, //Deadline:有効期限 | |
alice.address, | |
[], | |
sym.PlainMessage.create("Hello Symbol!"), //NFTデータ実体 | |
networkType | |
) | |
//モザイクの生成とNFTデータをアグリゲートしてブロックに登録 | |
aggregateTx = sym.AggregateTransaction.createComplete( | |
sym.Deadline.create(epochAdjustment), | |
[ | |
mosaicDefTx.toAggregate(alice.publicAccount), | |
mosaicChangeTx.toAggregate(alice.publicAccount), | |
nftTx.toAggregate(alice.publicAccount) | |
], | |
networkType,[], | |
).setMaxFeeForAggregate(100, 0); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment