Skip to content

Commit

Permalink
Merge pull request #23 from uniswapfoundation/fix/release-patch
Browse files Browse the repository at this point in the history
Fix/release patch
  • Loading branch information
Florian-S-A-W authored Jan 8, 2024
2 parents ba3833d + 64c53fe commit 4d2cf9a
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 20 deletions.
12 changes: 8 additions & 4 deletions v3-sdk/collecting-fees/src/example/Example.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,12 @@ const Example = () => {

return (
<div className="App">
{CurrentConfig.rpc.mainnet === '' && (
<h2 className="error">Please set your mainnet RPC URL in config.ts</h2>
)}
{CurrentConfig.rpc.mainnet === '' &&
CurrentConfig.env === Environment.PRODUCTION && (
<h2 className="error">
Please set your mainnet RPC URL in config.ts
</h2>
)}
{CurrentConfig.env === Environment.WALLET_EXTENSION &&
getProvider() === null && (
<h2 className="error">
Expand Down Expand Up @@ -122,7 +125,8 @@ const Example = () => {
disabled={
txState === TransactionState.Sending ||
getProvider() === null ||
CurrentConfig.rpc.mainnet === ''
(CurrentConfig.rpc.mainnet === '' &&
CurrentConfig.env === Environment.PRODUCTION)
}>
<p>Mint Position</p>
</button>
Expand Down
3 changes: 3 additions & 0 deletions v3-sdk/minting-position/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ This is an example of minting a position in a liquidity pool that includes runni

The core functionality of this example can be found in [`mintPosition`](./src/libs/positions.ts#L27).

Make sure your wallet holds enough of each required currency.
If you are using a local chain, you can use the trading examples to quickly get the tokens required.

## Configuration

This application can be configured to interact with:
Expand Down
9 changes: 6 additions & 3 deletions v3-sdk/minting-position/src/example/Example.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,12 @@ const Example = () => {

return (
<div className="App">
{CurrentConfig.rpc.mainnet === '' && (
<h2 className="error">Please set your mainnet RPC URL in config.ts</h2>
)}
{CurrentConfig.rpc.mainnet === '' &&
CurrentConfig.env === Environment.MAINNET && (
<h2 className="error">
Please set your mainnet RPC URL in config.ts
</h2>
)}
{CurrentConfig.env === Environment.WALLET_EXTENSION &&
getProvider() === null && (
<h2 className="error">
Expand Down
6 changes: 6 additions & 0 deletions v3-sdk/offchain-simulations/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Offchain Simulations

## Overview

This is an example of initializing Pools with tickdata and simulating trades offchain.
This example makes an extremely high amount of requests and needs a very fast RPC endpoint to work properly.
Be aware of the costs associated.

If the example does not seem to work, you are most likely ratelimited by your RPC provider.

## Configuration

Expand Down
23 changes: 16 additions & 7 deletions v3-sdk/offchain-simulations/src/example/Example.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ const Example = () => {
const [txState, setTxState] = useState<TransactionState>(TransactionState.New)
const [blockNumber, setBlockNumber] = useState<number>(0)

const [fetching, setFetching] = useState<boolean>()

// Listen for new blocks and update the wallet
useOnBlockUpdated(async (blockNumber: number) => {
refreshBalances()
Expand Down Expand Up @@ -67,7 +69,9 @@ const Example = () => {
}, [refreshBalances])

const onInitializePools = useCallback(async () => {
setFetching(true)
setPools(await initializePools())
setFetching(false)
}, [])

const onCreateTrade = useCallback(async () => {
Expand All @@ -87,9 +91,12 @@ const Example = () => {

return (
<div className="App">
{CurrentConfig.rpc.mainnet === '' && (
<h2 className="error">Please set your mainnet RPC URL in config.ts</h2>
)}
{CurrentConfig.rpc.mainnet === '' &&
CurrentConfig.env === Environment.MAINNET && (
<h2 className="error">
Please set your mainnet RPC URL in config.ts
</h2>
)}
{CurrentConfig.env === Environment.WALLET_EXTENSION &&
getProvider() === null && (
<h2 className="error">
Expand All @@ -110,10 +117,12 @@ const Example = () => {
</button>
{pools === undefined && <h3>{`Initialize Pools to simulate trade`}</h3>}
{pools !== undefined && <h3>{`Pools initialized successfully`}</h3>}
<button onClick={onInitializePools} disabled={getProvider() === null}>
<p>Initialize Pools</p>
</button>

{!fetching && (
<button onClick={onInitializePools} disabled={getProvider() === null}>
<p>Initialize Pools</p>
</button>
)}
{fetching && <h3>Fetching...</h3>}
<button onClick={onCreateTrade} disabled={pools === undefined}>
<p>Create Trade offchain</p>
</button>
Expand Down
2 changes: 1 addition & 1 deletion v3-sdk/quoting/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export interface ExampleConfig {

export const CurrentConfig: ExampleConfig = {
rpc: {
mainnet: 'https://mainnet.infura.io/v3/0ac57a06f2994538829c14745750d721',
mainnet: '',
},
tokens: {
in: USDC_TOKEN,
Expand Down
2 changes: 1 addition & 1 deletion v3-sdk/range-order/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ The [configuration](./src/config.ts) includes control of the environment as well

### Run your local chain

1. Run `yarn start:chain` in a separate terminal session to start up a copy of the mainnet blockchain locally
1. Run `yarn start:chain <provider_API_URL>` in a separate terminal session to start up a copy of the mainnet blockchain locally

### Setup your wallet

Expand Down
2 changes: 1 addition & 1 deletion v3-sdk/range-order/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"build": "react-scripts build",
"lint": "yarn eslint .",
"install:chain": "curl -L https://foundry.paradigm.xyz | bash && clear && echo $0 | exec && foundryup",
"start:chain": "anvil --fork-url https://mainnet.infura.io/v3/0ac57a06f2994538829c14745750d721"
"start:chain": "anvil --chain-id 1 --fork-url"
},
"eslintConfig": {
"extends": [
Expand Down
9 changes: 6 additions & 3 deletions v3-sdk/trading/src/example/Example.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,12 @@ const Example = () => {

return (
<div className="App">
{CurrentConfig.rpc.mainnet === '' && (
<h2 className="error">Please set your mainnet RPC URL in config.ts</h2>
)}
{CurrentConfig.rpc.mainnet === '' &&
CurrentConfig.env === Environment.MAINNET && (
<h2 className="error">
Please set your mainnet RPC URL in config.ts
</h2>
)}
{CurrentConfig.env === Environment.WALLET_EXTENSION &&
getProvider() === null && (
<h2 className="error">
Expand Down

0 comments on commit 4d2cf9a

Please sign in to comment.