Exemple #1
0
        private void RandomSpreadNFT(Token token, int amount)
        {
            Throw.IfNull(token, nameof(token));
            Throw.If(token.IsFungible, "expected NFT");

            for (int i = 1; i < amount; i++)
            {
                var nftKey = KeyPair.Generate();
                _keys.Add(nftKey);
                var data = new SimNFTData()
                {
                    A = (byte)_rnd.Next(), B = (byte)_rnd.Next(), C = (byte)_rnd.Next()
                };
                GenerateNft(_owner, nftKey.Address, Nexus.RootChain, token, Serialization.Serialize(data), new byte[0]);
            }
        }
        private void RandomSpreadNFT(string tokenSymbol, int amount)
        {
            Throw.If(!Nexus.TokenExists(tokenSymbol), "Token does not exist: " + tokenSymbol);
            var tokenInfo = Nexus.GetTokenInfo(tokenSymbol);

            Throw.If(tokenInfo.IsFungible, "expected NFT");

            for (int i = 1; i < amount; i++)
            {
                var nftKey = KeyPair.Generate();
                _keys.Add(nftKey);
                var data = new SimNFTData()
                {
                    A = (byte)_rnd.Next(), B = (byte)_rnd.Next(), C = (byte)_rnd.Next()
                };
                GenerateNft(_owner, nftKey.Address, tokenSymbol, Serialization.Serialize(data), new byte[0]);
            }
        }