@@ -11,8 +11,8 @@ export type GetTotalMintPriceAndFeesParams = {
11
11
tier : number
12
12
scheduleNum : number
13
13
quantity : number
14
-
15
14
editionAddress : Address
15
+ hasValidAffiliate ?: boolean
16
16
}
17
17
18
18
export type GetTotalMintPriceAndFeesReturnType = {
@@ -48,14 +48,14 @@ export type GetTotalMintPriceAndFeesReturnType = {
48
48
finalArtistFee : bigint
49
49
/** The total platform fees. */
50
50
finalAffiliateFee : bigint
51
- /** The total platform fees. */
51
+ /** The total affiliate fees. */
52
52
finalPlatformFee : bigint
53
53
}
54
54
)
55
55
56
56
export async function getTotalMintPriceAndFees < Client extends Pick < PublicClient , 'readContract' | 'multicall' > > (
57
57
client : Client ,
58
- { tier, scheduleNum, quantity, editionAddress } : GetTotalMintPriceAndFeesParams ,
58
+ { tier, scheduleNum, quantity, editionAddress, hasValidAffiliate } : GetTotalMintPriceAndFeesParams ,
59
59
) : Promise < GetTotalMintPriceAndFeesReturnType > {
60
60
const superMinter = await getSuperMinterForEdition ( client , { editionAddress } )
61
61
@@ -69,7 +69,11 @@ export async function getTotalMintPriceAndFees<Client extends Pick<PublicClient,
69
69
functionName : 'totalPriceAndFees' ,
70
70
args : [ editionAddress , tier , scheduleNum , quantity ] ,
71
71
} )
72
- . then ( ( res ) => ( { ...res , version : superMinter . version } ) )
72
+ . then ( ( res ) => ( {
73
+ ...res ,
74
+ affiliateFee : ! ! hasValidAffiliate ? res . affiliateFee : 0n ,
75
+ version : superMinter . version ,
76
+ } ) )
73
77
}
74
78
75
79
case '2' : {
@@ -79,7 +83,7 @@ export async function getTotalMintPriceAndFees<Client extends Pick<PublicClient,
79
83
abi,
80
84
address,
81
85
functionName : 'totalPriceAndFees' ,
82
- args : [ editionAddress , tier , scheduleNum , quantity , false ] ,
86
+ args : [ editionAddress , tier , scheduleNum , quantity , ! ! hasValidAffiliate ] ,
83
87
} )
84
88
. then ( ( res ) => ( { ...res , version : superMinter . version } ) )
85
89
}
0 commit comments