public async Task CanAddFixedRoyaltyToTokenDefinition() { await using var fxAccount = await TestAccount.CreateAsync(_network); await using var comToken = await TestToken.CreateAsync(_network, null, fxAccount); await using var fxToken = await TestToken.CreateAsync(_network, null, fxAccount); var fixedRoyalties = new FixedRoyalty[] { new FixedRoyalty(fxAccount, comToken, 100) }; var receipt = await fxToken.Client.UpdateRoyaltiesAsync(fxToken, fixedRoyalties, fxToken.RoyaltiesPrivateKey); Assert.Equal(ResponseCode.Success, fxToken.Record.Status); var info = await fxToken.Client.GetTokenInfoAsync(fxToken.Record.Token); Assert.Single(info.Royalties); Assert.Equal(fixedRoyalties[0], info.Royalties[0]); }
public async Task CanAddFixedAndFractionalRoyaltiesToTokenDefinition() { await using var fxAccount = await TestAccount.CreateAsync(_network); await using var comToken = await TestToken.CreateAsync(_network, null, fxAccount); await using var fxToken = await TestToken.CreateAsync(_network, null, fxAccount); var fixedRoyalty = new FixedRoyalty(fxAccount, comToken, 100); var fractionalRoyalty = new TokenRoyalty(fxAccount, 1, 2, 1, 100); var receipt = await fxToken.Client.UpdateRoyaltiesAsync(fxToken, new IRoyalty[] { fixedRoyalty, fractionalRoyalty }, fxToken.RoyaltiesPrivateKey); Assert.Equal(ResponseCode.Success, fxToken.Record.Status); var info = await fxToken.Client.GetTokenInfoAsync(fxToken.Record.Token); Assert.Equal(2, info.Royalties.Count); Assert.Equal(fixedRoyalty, info.Royalties.First(f => f.RoyaltyType == RoyaltyType.Fixed)); Assert.Equal(fractionalRoyalty, info.Royalties.First(f => f.RoyaltyType == RoyaltyType.Token)); }
public async Task CanCreateTokenWithFixedAndFractionalRoyalties() { await using var fxAccount = await TestAccount.CreateAsync(_network); await using var comToken = await TestToken.CreateAsync(_network, null, fxAccount); var fixedRoyalty = new FixedRoyalty(fxAccount, comToken, 100); var fractionalRoyalty = new TokenRoyalty(fxAccount, 1, 2, 1, 100); await using var fxToken = await TestToken.CreateAsync(_network, fx => { fx.Params.Royalties = new IRoyalty[] { fixedRoyalty, fractionalRoyalty }; fx.Params.Signatory = new Signatory(fx.Params.Signatory, fxAccount.PrivateKey); }); Assert.Equal(ResponseCode.Success, fxToken.Record.Status); var info = await fxToken.Client.GetTokenInfoAsync(fxToken.Record.Token); Assert.Equal(2, info.Royalties.Count); Assert.Equal(fixedRoyalty, info.Royalties.First(f => f.RoyaltyType == RoyaltyType.Fixed)); Assert.Equal(fractionalRoyalty, info.Royalties.First(f => f.RoyaltyType == RoyaltyType.Token)); }