diff --git a/v3-sdk/collecting-fees/src/example/Example.tsx b/v3-sdk/collecting-fees/src/example/Example.tsx index 61f453dd..84467f50 100644 --- a/v3-sdk/collecting-fees/src/example/Example.tsx +++ b/v3-sdk/collecting-fees/src/example/Example.tsx @@ -92,9 +92,12 @@ const Example = () => { return (
- {CurrentConfig.rpc.mainnet === '' && ( -

Please set your mainnet RPC URL in config.ts

- )} + {CurrentConfig.rpc.mainnet === '' && + CurrentConfig.env === Environment.PRODUCTION && ( +

+ Please set your mainnet RPC URL in config.ts +

+ )} {CurrentConfig.env === Environment.WALLET_EXTENSION && getProvider() === null && (

@@ -122,7 +125,8 @@ const Example = () => { disabled={ txState === TransactionState.Sending || getProvider() === null || - CurrentConfig.rpc.mainnet === '' + (CurrentConfig.rpc.mainnet === '' && + CurrentConfig.env === Environment.PRODUCTION) }>

Mint Position

diff --git a/v3-sdk/minting-position/README.md b/v3-sdk/minting-position/README.md index ee3b1a51..8457cbbd 100644 --- a/v3-sdk/minting-position/README.md +++ b/v3-sdk/minting-position/README.md @@ -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: diff --git a/v3-sdk/minting-position/src/example/Example.tsx b/v3-sdk/minting-position/src/example/Example.tsx index f58ccd34..dc7528cb 100644 --- a/v3-sdk/minting-position/src/example/Example.tsx +++ b/v3-sdk/minting-position/src/example/Example.tsx @@ -80,9 +80,12 @@ const Example = () => { return (
- {CurrentConfig.rpc.mainnet === '' && ( -

Please set your mainnet RPC URL in config.ts

- )} + {CurrentConfig.rpc.mainnet === '' && + CurrentConfig.env === Environment.MAINNET && ( +

+ Please set your mainnet RPC URL in config.ts +

+ )} {CurrentConfig.env === Environment.WALLET_EXTENSION && getProvider() === null && (

diff --git a/v3-sdk/offchain-simulations/README.md b/v3-sdk/offchain-simulations/README.md index 2e879c71..f43b3abc 100644 --- a/v3-sdk/offchain-simulations/README.md +++ b/v3-sdk/offchain-simulations/README.md @@ -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 diff --git a/v3-sdk/offchain-simulations/src/example/Example.tsx b/v3-sdk/offchain-simulations/src/example/Example.tsx index a3d06a0a..828bc846 100644 --- a/v3-sdk/offchain-simulations/src/example/Example.tsx +++ b/v3-sdk/offchain-simulations/src/example/Example.tsx @@ -36,6 +36,8 @@ const Example = () => { const [txState, setTxState] = useState(TransactionState.New) const [blockNumber, setBlockNumber] = useState(0) + const [fetching, setFetching] = useState() + // Listen for new blocks and update the wallet useOnBlockUpdated(async (blockNumber: number) => { refreshBalances() @@ -67,7 +69,9 @@ const Example = () => { }, [refreshBalances]) const onInitializePools = useCallback(async () => { + setFetching(true) setPools(await initializePools()) + setFetching(false) }, []) const onCreateTrade = useCallback(async () => { @@ -87,9 +91,12 @@ const Example = () => { return (
- {CurrentConfig.rpc.mainnet === '' && ( -

Please set your mainnet RPC URL in config.ts

- )} + {CurrentConfig.rpc.mainnet === '' && + CurrentConfig.env === Environment.MAINNET && ( +

+ Please set your mainnet RPC URL in config.ts +

+ )} {CurrentConfig.env === Environment.WALLET_EXTENSION && getProvider() === null && (

@@ -110,10 +117,12 @@ const Example = () => { {pools === undefined &&

{`Initialize Pools to simulate trade`}

} {pools !== undefined &&

{`Pools initialized successfully`}

} - - + {!fetching && ( + + )} + {fetching &&

Fetching...

} diff --git a/v3-sdk/quoting/src/config.ts b/v3-sdk/quoting/src/config.ts index 89db1e27..995bedf9 100644 --- a/v3-sdk/quoting/src/config.ts +++ b/v3-sdk/quoting/src/config.ts @@ -19,7 +19,7 @@ export interface ExampleConfig { export const CurrentConfig: ExampleConfig = { rpc: { - mainnet: 'https://mainnet.infura.io/v3/0ac57a06f2994538829c14745750d721', + mainnet: '', }, tokens: { in: USDC_TOKEN, diff --git a/v3-sdk/range-order/README.md b/v3-sdk/range-order/README.md index 22097e53..839b3d7c 100644 --- a/v3-sdk/range-order/README.md +++ b/v3-sdk/range-order/README.md @@ -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 ` in a separate terminal session to start up a copy of the mainnet blockchain locally ### Setup your wallet diff --git a/v3-sdk/range-order/package.json b/v3-sdk/range-order/package.json index d65afdf6..28b51a8a 100644 --- a/v3-sdk/range-order/package.json +++ b/v3-sdk/range-order/package.json @@ -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": [ diff --git a/v3-sdk/trading/src/example/Example.tsx b/v3-sdk/trading/src/example/Example.tsx index 7608f4d9..d300c3a5 100644 --- a/v3-sdk/trading/src/example/Example.tsx +++ b/v3-sdk/trading/src/example/Example.tsx @@ -73,9 +73,12 @@ const Example = () => { return (
- {CurrentConfig.rpc.mainnet === '' && ( -

Please set your mainnet RPC URL in config.ts

- )} + {CurrentConfig.rpc.mainnet === '' && + CurrentConfig.env === Environment.MAINNET && ( +

+ Please set your mainnet RPC URL in config.ts +

+ )} {CurrentConfig.env === Environment.WALLET_EXTENSION && getProvider() === null && (