@@ -53,11 +53,10 @@ import ModalBody from '@/components/shared/modals/ModalBody.vue'
53
53
import type { BaseMintedCollection } from ' @/components/base/types'
54
54
import { CreateComponent } from ' @/composables/useCreate'
55
55
import { useFiatStore } from ' @/stores/fiat'
56
- import { usePreferencesStore } from ' @/stores/preferences'
57
56
import { availablePrefixes } from ' @/utils/chain'
58
57
import { calculateBalanceUsdValue } from ' @/utils/format/balance'
59
- import { BASE_FEE } from ' @/utils/support'
60
58
import type { AutoTeleportAction } from ' @/composables/autoTeleport/types'
59
+ import { calculateFees } from ' @/composables/transaction/mintToken/utils'
61
60
62
61
export type NftInformation = {
63
62
file: Blob | null
@@ -76,7 +75,7 @@ export type ExtendedInformation = NftInformation & {
76
75
networkFee: number
77
76
existentialDeposit: number
78
77
kodadotFee: number
79
- kodadotUSDFee : number
78
+ kodaUSDFee : number
80
79
carbonlessFee: number
81
80
carbonlessUSDFee: number
82
81
totalFee: number
@@ -98,7 +97,6 @@ const { isLogIn, accountId } = useAuth()
98
97
const { urlPrefix } = usePrefix ()
99
98
const { $i18n } = useNuxtApp ()
100
99
const fiatStore = useFiatStore ()
101
- const preferencesStore = usePreferencesStore ()
102
100
103
101
const { metadataDeposit, collectionDeposit, existentialDeposit, itemDeposit, attributeDeposit } = useDeposit (urlPrefix )
104
102
@@ -120,22 +118,31 @@ const decimals = computed(() => props.nftInformation.paidToken?.tokenDecimals)
120
118
const tokenPrice = computed (() =>
121
119
Number (fiatStore .getCurrentTokenValue (chainSymbol .value ) ?? 0 ),
122
120
)
123
- const kodadotFee = computed (
124
- () =>
125
- (( preferencesStore . hasSupport ? BASE_FEE : 0 ) / tokenPrice . value )
126
- * Math . pow ( 10 , decimals . value ),
127
- )
128
- const carbonlessFee = computed (
129
- ( ) =>
130
- (( preferencesStore . hasCarbonOffset && isNFT . value ? BASE_FEE * 2 : 0 )
131
- / tokenPrice . value )
132
- * Math . pow ( 10 , decimals .value ) ,
121
+ const { kodaUSDFee, carbonlessUSDFee : carbonlessUSDFeeValue } = calculateFees ()
122
+
123
+ const carbonlessUSDFee = computed (() => isNFT . value ? carbonlessUSDFeeValue : 0 )
124
+
125
+ const convertUSDFeeToToken = ( fee : number ) => ( fee / tokenPrice . value ) * Math . pow ( 10 , decimals . value )
126
+ const kodadotFee = computed (() => convertUSDFeeToToken ( kodaUSDFee ))
127
+ const carbonlessFee = computed (( ) => convertUSDFeeToToken ( carbonlessUSDFee . value ))
128
+
129
+ const totalFee = computed (() =>
130
+ deposit . value + carbonlessFee . value + kodadotFee . value + networkFee .value ,
133
131
)
134
- const totalFee = computed (() => {
135
- return (
136
- deposit .value + carbonlessFee .value + kodadotFee .value + networkFee .value
137
- )
138
- })
132
+
133
+ const extendedInformation = computed (() => ({
134
+ ... props .nftInformation ,
135
+ networkFee: networkFee .value ,
136
+ existentialDeposit: deposit .value ,
137
+ kodadotFee: kodadotFee .value ,
138
+ kodaUSDFee: kodaUSDFee ,
139
+ carbonlessFee: carbonlessFee .value ,
140
+ carbonlessUSDFee: carbonlessUSDFee ,
141
+ totalFee: totalFee .value ,
142
+ totalUSDFee: totalUSDFee .value ,
143
+ blockchain: blockchain .value ,
144
+ }))
145
+
139
146
const deposit = computed (
140
147
() =>
141
148
metadataDeposit .value
@@ -160,19 +167,6 @@ const btnLabel = computed(() => {
160
167
})
161
168
const disabled = computed (() => ! isLogIn .value )
162
169
163
- const extendedInformation = computed (() => ({
164
- ... props .nftInformation ,
165
- networkFee: networkFee .value ,
166
- existentialDeposit: deposit .value ,
167
- kodadotFee: kodadotFee .value ,
168
- kodadotUSDFee: BASE_FEE ,
169
- carbonlessFee: carbonlessFee .value ,
170
- carbonlessUSDFee: BASE_FEE * 2 ,
171
- totalFee: totalFee .value ,
172
- totalUSDFee: totalUSDFee .value ,
173
- blockchain: blockchain .value ,
174
- }))
175
-
176
170
const networkFee = computed (() => {
177
171
const extraCallsMultiplier = [
178
172
props .nftInformation .listForSale ,
0 commit comments