Skip to content

Commit

Permalink
mints: l1fee + value fix (#5167)
Browse files Browse the repository at this point in the history
* mints: l1fee + value fix

* fix issues

* lowercase mintdotfun

* bump reservior package

* rm depdebug import

* reservior client api updates
  • Loading branch information
skylarbarrera authored Oct 27, 2023
1 parent 43e0855 commit 452fdcd
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 20 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
"@react-navigation/material-top-tabs": "6.6.2",
"@react-navigation/native": "6.1.6",
"@react-navigation/stack": "6.3.16",
"@reservoir0x/reservoir-sdk": "1.4.5",
"@reservoir0x/reservoir-sdk": "1.5.4",
"@segment/analytics-react-native": "2.15.0",
"@segment/sovran-react-native": "1.0.4",
"@sentry/react-native": "3.4.1",
Expand Down
2 changes: 1 addition & 1 deletion src/languages/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -1152,7 +1152,7 @@
"minting": "Minting...",
"minted": "Minted",
"mint_unavailable": "Mint Unavailable",
"mint_on_mintdotfun": "􀮶 Mint on Mint.fun",
"mint_on_mintdotfun": "􀮶 Mint on mint.fun",
"error_minting": "Error Minting",
"mint_price": "Mint Price",
"free": "Free",
Expand Down
13 changes: 7 additions & 6 deletions src/resources/reservoir/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,42 +19,43 @@ export function initializeReservoirClient() {
createClient({
chains: [
{
name: getMainnetNetworkObject().value,
id: getMainnetNetworkObject().id,
baseApiUrl: 'https://api.reservoir.tools',
active: true,
apiKey: RESERVOIR_API_KEY,
},
{
name: getPolygonNetworkObject().value,
id: getPolygonNetworkObject().id,
baseApiUrl: 'https://api-polygon.reservoir.tools',
active: false,
apiKey: RESERVOIR_API_KEY,
},
{
name: getZoraNetworkObject().value,
id: getZoraNetworkObject().id,
baseApiUrl: 'https://api-zora.reservoir.tools',
active: false,
apiKey: RESERVOIR_API_KEY,
},
{
name: getBaseNetworkObject().value,
id: getBaseNetworkObject().id,
baseApiUrl: 'https://api-base.reservoir.tools',
active: false,
apiKey: RESERVOIR_API_KEY,
},
{
name: getOptimismNetworkObject().value,
id: getOptimismNetworkObject().id,
baseApiUrl: 'https://api-optimism.reservoir.tools',
active: false,
apiKey: RESERVOIR_API_KEY,
},
{
name: getArbitrumNetworkObject().value,
id: getArbitrumNetworkObject().id,
baseApiUrl: 'https://api-arbitrum.reservoir.tools',
active: false,
apiKey: RESERVOIR_API_KEY,
},
],
apiKey: RESERVOIR_API_KEY,
logLevel: IS_PROD ? 1 : 4,
});
}
24 changes: 16 additions & 8 deletions src/screens/mints/MintSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -228,18 +228,15 @@ const MintSheet = () => {
updateTxFee,
startPollingGasFees,
stopPollingGasFees,
isSufficientGas,
isValidGas,
getTotalGasPrice,
} = useGas();

const imageUrl = maybeSignUri(mintCollection.image || '');
const { result: aspectRatio } = usePersistentAspectRatio(imageUrl || '');

// isMintingPublicSale handles if theres a time based mint, otherwise if there is a price we should be able to mint
const isMintingAvailable =
!(isReadOnlyWallet || isHardwareWallet) &&
(mintCollection.isMintingPublicSale || price) &&
!!mintCollection.publicMintInfo &&
!gasError;

const imageColor =
Expand Down Expand Up @@ -343,13 +340,25 @@ const MintSheet = () => {
to: item.data?.to,
from: item.data?.from,
data: item.data?.data,
value: multiply(price.amount || '0', quantity),
value: item.data?.value,
};

const gas = await estimateGas(tx, provider);

let l1GasFeeOptimism = null;
// add l1Fee for OP Chains
if (getNetworkObj(currentNetwork).gas.OptimismTxFee) {
l1GasFeeOptimism = await ethereumUtils.calculateL1FeeOptimism(
tx,
provider
);
}
if (gas) {
setGasError(false);
updateTxFee(gas, null);
if (l1GasFeeOptimism) {
updateTxFee(gas, null, l1GasFeeOptimism);
} else {
updateTxFee(gas, null);
}
}
});
});
Expand All @@ -367,7 +376,6 @@ const MintSheet = () => {
accountAddress,
currentNetwork,
mintCollection.id,
price,
quantity,
updateTxFee,
]);
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3566,10 +3566,10 @@
color "^4.2.3"
warn-once "^0.1.0"

"@reservoir0x/reservoir-sdk@1.4.5":
version "1.4.5"
resolved "https://registry.yarnpkg.com/@reservoir0x/reservoir-sdk/-/reservoir-sdk-1.4.5.tgz#6ff0fd61fea203de4cdde019048fa9d0b0ab08e9"
integrity sha512-Yi4Z0c85fUfPB2mo1FdeCpEgrpN36fDV8gU4RDmsl6IuFYD8pwA/SMtxoo5M0uEN3at+VpVV9utyvB8XlHUFMQ==
"@reservoir0x/reservoir-sdk@1.5.4":
version "1.5.4"
resolved "https://registry.yarnpkg.com/@reservoir0x/reservoir-sdk/-/reservoir-sdk-1.5.4.tgz#5390e6d23bf9009c6bcebe68744fc1d514bc5443"
integrity sha512-1sStxOp6PcvDvYUx1mKzWP+/Bu5n0v6lEu1PbLtPylCkr8Yh4aWU+00ABA+jM27VdqW3I7R/oJZBTlqWuVjnAQ==
dependencies:
axios "^0.27.2"

Expand Down

0 comments on commit 452fdcd

Please sign in to comment.