Skip to content

Commit

Permalink
Add exported return type for GetTotalMintPriceAndFeesReturnType
Browse files Browse the repository at this point in the history
  • Loading branch information
vigneshka committed Dec 28, 2023
1 parent 23e48a8 commit 50dae27
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 24 deletions.
5 changes: 5 additions & 0 deletions .changeset/afraid-cameras-crash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@soundxyz/sdk': patch
---

Add exported return type for GetTotalMintPriceAndFeesReturnType
66 changes: 42 additions & 24 deletions packages/sdk/src/contract/edition-v2/read/mint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,34 +15,52 @@ export type GetTotalMintPriceAndFeesParams = {
editionAddress: Address
}

export type GetTotalMintPriceAndFeesReturnType = {
// The required Ether value.
// `subTotal + platformFlatFee`.
total: bigint
// The total price before any additive fees.
subTotal: bigint
// The price per token.
unitPrice: bigint
// The total platform fees.
// `platformFlatFee + platformMintBPSFee`.
platformFee: bigint
// The total platform flat fees.
// `platformTxFlatFee + platformMintFlatFee`.
platformFlatFee: bigint
// The platform per-transaction flat fees.
platformTxFlatFee: bigint
// The total platform per-token flat fees.
platformMintFlatFee: bigint
// The total platform per-token BPS fees.
platformMintBPSFee: bigint
// The total affiliate fees.
affiliateFee: bigint
}
export type GetTotalMintPriceAndFeesReturnType =
| {
// SuperMinterV1
version: '1'
// The required Ether value.
total: bigint
// The total price before any additive fees.
subTotal: bigint
// The price per token.
unitPrice: bigint
// The total platform fees.
// `platformFlatFee + platformMintBPSFee`.
platformFee: bigint
// The total platform flat fees.
// `platformTxFlatFee + platformMintFlatFee`.
platformFlatFee: bigint
// The platform per-transaction flat fees.
platformTxFlatFee: bigint
// The total platform per-token flat fees.
platformMintFlatFee: bigint
// The total platform per-token BPS fees.
platformMintBPSFee: bigint
// The total affiliate fees.
affiliateFee: bigint
}
| {
// SuperMinterV2
version: '2'
// The required Ether value.
total: bigint
// The total price before any additive fees.
subTotal: bigint
// The price per token.
unitPrice: bigint
// The total artist fees.
finalArtistFee: bigint
// The total platform fees.
finalAffiliateFee: bigint
// The total platform fees.
finalPlatformFee: bigint
}

export async function getTotalMintPriceAndFees<Client extends Pick<PublicClient, 'readContract' | 'multicall'>>(
client: Client,
{ tier, scheduleNum, quantity, editionAddress }: GetTotalMintPriceAndFeesParams,
) {
): Promise<GetTotalMintPriceAndFeesReturnType> {
const superMinter = await getSuperMinterForEdition(client, { editionAddress })

switch (superMinter.version) {
Expand Down

0 comments on commit 50dae27

Please sign in to comment.