Skip to content

Commit

Permalink
Ln/update sell nft modal (deso-protocol#554)
Browse files Browse the repository at this point in the history
* show additional royalties in sell nft modal

* remove service fee which is no longer user
  • Loading branch information
lazynina authored Jan 20, 2022
1 parent 17f80b3 commit b16be30
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 9 deletions.
22 changes: 20 additions & 2 deletions src/app/sell-nft-modal/sell-nft-modal.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
</div>
</div>
<div class="row px-10px pb-10px">
<div class="col-6 m-0px">Creator royalty</div>
<div class="col-6 m-0px">NFT Creator royalty</div>
<div class="col-6 m-0px d-flex flex-wrap justify-content-end">
<div>
{{globalVars.abbreviateNumber(creatorRoyalty, 3)}} $DESO
Expand All @@ -93,14 +93,32 @@
</div>
</div>
<div class="row px-10px pb-10px">
<div class="col-6 m-0px">Coin-holder royalty</div>
<div class="col-6 m-0px">DESO Royalties to other users</div>
<div class="col-6 m-0px d-flex flex-wrap justify-content-end">
<div>
{{globalVars.abbreviateNumber(additionalCreatorRoyalty, 3)}} $DESO
</div>
<div class="text-grey7 d-lg-inline-block d-block">(~{{ globalVars.nanosToUSD(additionalCreatorRoyalty*1e9, 2) }})</div>
</div>
</div>
<div class="row px-10px pb-10px">
<div class="col-6 m-0px">NFT Creator Coin-holder royalty</div>
<div class="col-6 m-0px d-flex flex-wrap justify-content-end">
<div>
{{globalVars.abbreviateNumber(coinRoyalty, 3)}} $DESO
</div>
<div class="text-grey7 d-lg-inline-block d-block">(~{{ globalVars.nanosToUSD(coinRoyalty*1e9, 2) }})</div>
</div>
</div>
<div class="row px-10px pb-10px">
<div class="col-6 m-0px">Other Creator Coin-holder royalties</div>
<div class="col-6 m-0px d-flex flex-wrap justify-content-end">
<div>
{{globalVars.abbreviateNumber(additionalCoinRoyalty, 3)}} $DESO
</div>
<div class="text-grey7 d-lg-inline-block d-block">(~{{ globalVars.nanosToUSD(additionalCoinRoyalty*1e9, 2) }})</div>
</div>
</div>
</div>

<div class="d-flex align-items-center mb-15px">
Expand Down
29 changes: 22 additions & 7 deletions src/app/sell-nft-modal/sell-nft-modal.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ export class SellNftModalComponent implements OnInit {
@Input() selectedBidEntries: NFTBidEntryResponse[];
loading = false;
sellNFTDisabled = false;
sellingPrice = 2.0887;
earnings = 1.3587;
creatorRoyalty = 0.42;
coinRoyalty = 0.21;
serviceFee = 0.1;
sellingPrice = 0;
earnings = 0;
creatorRoyalty = 0;
additionalCreatorRoyalty = 0;
coinRoyalty = 0;
additionalCoinRoyalty = 0;
sellingNFT = false;

constructor(
Expand All @@ -40,10 +41,24 @@ export class SellNftModalComponent implements OnInit {
this.sellingPrice = _.sumBy(this.selectedBidEntries, "BidAmountNanos") / 1e9;
const coinRoyaltyBasisPoints = this.post.NFTRoyaltyToCoinBasisPoints;
const creatorRoyaltyBasisPoints = this.post.NFTRoyaltyToCreatorBasisPoints;

const additionalCoinRoyaltyBasisPoints = Object.values(this.post.AdditionalCoinRoyaltiesMap || {}).reduce(
(acc, val) => acc + val,
0
);
const additionalCreatorRoyaltyBasisPoitns = Object.values(this.post.AdditionalDESORoyaltiesMap || {}).reduce(
(acc, val) => acc + val,
0
);
this.creatorRoyalty = this.sellingPrice * (creatorRoyaltyBasisPoints / (100 * 100));
this.additionalCreatorRoyalty = this.sellingPrice * (additionalCreatorRoyaltyBasisPoitns / (100 * 100));
this.coinRoyalty = this.sellingPrice * (coinRoyaltyBasisPoints / (100 * 100));
this.earnings = this.sellingPrice - this.coinRoyalty - this.creatorRoyalty;
this.additionalCoinRoyalty = this.sellingPrice * (additionalCoinRoyaltyBasisPoints / (100 * 100));
this.earnings =
this.sellingPrice -
this.coinRoyalty -
this.creatorRoyalty -
this.additionalCreatorRoyalty -
this.additionalCoinRoyalty;
}

sellNFTTotal: number;
Expand Down

0 comments on commit b16be30

Please sign in to comment.