pancake-swap-interface-v1 icon indicating copy to clipboard operation
pancake-swap-interface-v1 copied to clipboard

V2 Interface

Open saqarmax-arm opened this issue 4 years ago • 40 comments
trafficstars

Are you planning to create/sharee new v2 interface repository or you will use this one?

saqarmax-arm avatar Apr 28 '21 21:04 saqarmax-arm

They are using Pancake-FrontEnd I think

AliWisam avatar May 01 '21 20:05 AliWisam

They are using Pancake-FrontEnd I think

Looks like Pancake-FrontEnd didnt include swap part

saqarmax-arm avatar May 04 '21 19:05 saqarmax-arm

At this moment the v2 isn't available, any plan to release this?

matbrgz avatar May 06 '21 16:05 matbrgz

If anyone will find solution, please mention here.

saqarmax-arm avatar May 06 '21 21:05 saqarmax-arm

What is the major difference between both?

If I remove the v1 and start focus on pancakev2 LP it won't work?

matbrgz avatar May 08 '21 17:05 matbrgz

still waiting :)

g171210375 avatar May 09 '21 15:05 g171210375

With the V3 update, what happens to the tokens using V2 router such as moonshot? https://github.com/moonshot-platform/moonshot-ERC20/blob/main/contracts/Moonshot.sol

fdharamshi avatar May 10 '21 19:05 fdharamshi

isn't exactly all the same as v1, but it is just replace pancakeswap-libs/sdk with pancakeswap-libs/sdk-v2 ?

captainerd avatar May 11 '21 04:05 captainerd

Anyone found a solution to this ? And no, "pancakeswap-libs/sdk-v2" this doesnt work either.

isn't exactly all the same as v1, but it is just replace pancakeswap-libs/sdk with pancakeswap-libs/sdk-v2 ?

sachinkrishna avatar May 13 '21 16:05 sachinkrishna

Any solution? Also having the same problem. Not sure why they don't release V2 interface like Uniswap.

atropos0902 avatar May 14 '21 16:05 atropos0902

Worked it out myself, enjoy folks

Installing V2 Pancakeswap Exchange Interface

  • Clone PancakeSwap v1 interface git clone https://github.com/pancakeswap/pancake-swap-interface-v1.git .

  • Run Yarn in console from root yarn

  • Update ROUTER_ADDRESS to v2 in /src/constants/index.ts line 3 0x10ED43C718714eb63d5aA57B78B54704E256024E

  • Install v2 SDK npm i @overage69/pancake-sdk-v2

  • Install missing dependencies

npm i @reach/portal
npm i @uniswap/v2-core
npm i ajv
npm i cids
npm i ethers
npm i multicodec
npm i multihashes
npm i @types/node
  • Run yarn start and it should boot up using v2
yarn start

Optional extras - remove the component for the popup as this isn't needed.

jcorby24 avatar May 14 '21 17:05 jcorby24

hi @Corbyj1 Thank you for your reply. Now I have a typescript error on src/state/index.ts after adding @overage69/pancake-sdk-v2 library.

Type '(Middleware | Middleware<{}, any, Dispatch<AnyAction>>)[]' is not assignable to type '[any] | ((getDefaultMiddleware: CurriedGetDefaultMiddleware<{ application: ApplicationState; user: UserState; transactions: TransactionState; swap: SwapState; mint: MintState; burn: BurnState; multicall: MulticallState; lists: ListsState; toasts: ToastsState; }>) => [...]) | undefined'.
  Type '(Middleware | Middleware<{}, any, Dispatch<AnyAction>>)[]' is not assignable to type '[any]'.
    Target requires 1 element(s) but source may have fewer.  TS2322

    40 |     toasts
    41 |   },
  > 42 |   middleware: [...getDefaultMiddleware({ thunk: false }), save({ states: PERSISTED_KEYS })],
       |   ^
    43 |   preloadedState: loadedState,
    44 | })
    45 |

You didn't have that kind of issue?

atropos0902 avatar May 14 '21 18:05 atropos0902

hi @Corbyj1 You didn't have that kind of issue?

Sorry no didn't have that issue at all - did you try clean clone without modifying anything beforehand?

Did you make sure to run yarn as well before doing the above steps?

I'm running NPM 6.14.12 for reference

jcorby24 avatar May 14 '21 18:05 jcorby24

@Corbyj1 Amazing!!! It's working!!!! Thank you so much!!!!

atropos0902 avatar May 14 '21 18:05 atropos0902

hi @Corbyj1 Thank you for your reply. Now I have a typescript error on src/state/index.ts after adding @overage69/pancake-sdk-v2 library.

Type '(Middleware | Middleware<{}, any, Dispatch<AnyAction>>)[]' is not assignable to type '[any] | ((getDefaultMiddleware: CurriedGetDefaultMiddleware<{ application: ApplicationState; user: UserState; transactions: TransactionState; swap: SwapState; mint: MintState; burn: BurnState; multicall: MulticallState; lists: ListsState; toasts: ToastsState; }>) => [...]) | undefined'.
  Type '(Middleware | Middleware<{}, any, Dispatch<AnyAction>>)[]' is not assignable to type '[any]'.
    Target requires 1 element(s) but source may have fewer.  TS2322

    40 |     toasts
    41 |   },
  > 42 |   middleware: [...getDefaultMiddleware({ thunk: false }), save({ states: PERSISTED_KEYS })],
       |   ^
    43 |   preloadedState: loadedState,
    44 | })
    45 |

You didn't have that kind of issue?

How did you solve this issue ?

sachinkrishna avatar May 14 '21 19:05 sachinkrishna

@sachinkrishna Just defined type for middleware. So it could be

middleware: [...getDefaultMiddleware({ thunk: false }), save({ states: PERSISTED_KEYS })] as Middleware[]

atropos0902 avatar May 14 '21 19:05 atropos0902

Where did you import the name "Middleware" from ? Im a bit lost here.

sachinkrishna avatar May 14 '21 19:05 sachinkrishna

From @reduxjs/toolkit library.

atropos0902 avatar May 14 '21 19:05 atropos0902

From @reduxjs/toolkit library.

Thank you. But I have already tried that and it is throwing an error

/pancake-swap-interface-v1/src/state/multicall/hooks.ts TypeScript error in /pancake-swap-interface-v1/src/state/multicall/hooks.ts(188,56): Argument of type 'import("/pancake-swap-interface-v1/node_modules/@ethersproject/contracts/node_modules/@ethersproject/abi/lib/interface").Interface | undefined' is not assignable to parameter of type 'import("/pancake-swap-interface-v1/node_modules/@ethersproject/abi/lib/interface").Interface | undefined'. Type 'import("/pancake-swap-interface-v1/node_modules/@ethersproject/contracts/node_modules/@ethersproject/abi/lib/interface").Interface' is not assignable to type 'import("/pancake-swap-interface-v1/node_modules/@ethersproject/abi/lib/interface").Interface'. Types of property 'fragments' are incompatible. The type 'readonly Fragment[]' is 'readonly' and cannot be assigned to the mutable type 'Fragment[]'. TS2345

186 | 
187 |   return useMemo(() => {

188 | return results.map((result) => toCallState(result, contract?.interface, fragment, latestBlockNumber)) | ^ 189 | }, [fragment, contract, results, latestBlockNumber]) 190 | } 191 |

sachinkrishna avatar May 14 '21 19:05 sachinkrishna

Hmm... Weird... That error is really new to me. Can you try to remove node_modules and install again?

atropos0902 avatar May 14 '21 19:05 atropos0902

I have tried that. Didint work. I have added the above dependencies with yarn. But i dont think that, that would be the issue. Do you ?

sachinkrishna avatar May 14 '21 19:05 sachinkrishna

You mean these dependencies?

npm i @reach/portal
npm i @uniswap/v2-core
npm i ajv
npm i cids
npm i ethers
npm i multicodec
npm i multihashes
npm i @types/node

I didn't add the above dependencies since pancake-swap-interface-v1 repo already has those dependencies. I just added @overage69/pancake-sdk-v2

atropos0902 avatar May 14 '21 19:05 atropos0902

You mean these dependencies?

npm i @reach/portal
npm i @uniswap/v2-core
npm i ajv
npm i cids
npm i ethers
npm i multicodec
npm i multihashes
npm i @types/node

I didn't add the above dependencies since pancake-swap-interface-v1 repo already has those dependencies. I just added @overage69/pancake-sdk-v2

That was the issue. Thanks a lot man. Its working.

sachinkrishna avatar May 14 '21 19:05 sachinkrishna

@atropos0902 Anyway, adding liquidity is working ? No right ?

sachinkrishna avatar May 14 '21 20:05 sachinkrishna

@sachinkrishna I planned to work only on Swap future for now. Hopefully would work on Liquidity in the earliest future. Thanks!

atropos0902 avatar May 14 '21 20:05 atropos0902

has anyone figured out how to get liquidity pools working on a fork with v2? I keep running into "You can't add liquidity in v1" but I'm using the v2 router address on the test net: 0xD99D1c33F9fC3444f8101754aBC46c52416550D1

I followed steps here to add liquidity but no luck: https://forum.openzeppelin.com/t/cant-add-liquidity-on-pancakeswap-with-burnable-erc20-token/6993/10

msolomonTMG avatar May 18 '21 04:05 msolomonTMG

Worked it out myself, enjoy folks

Installing V2 Pancakeswap Exchange Interface

  • Clone PancakeSwap v1 interface git clone https://github.com/pancakeswap/pancake-swap-interface-v1.git .
  • Run Yarn in console from root yarn
  • Update ROUTER_ADDRESS to v2 in /src/constants/index.ts line 3 0x10ED43C718714eb63d5aA57B78B54704E256024E
  • Install v2 SDK npm i @overage69/pancake-sdk-v2
  • Install missing dependencies
npm i @reach/portal
npm i @uniswap/v2-core
npm i ajv
npm i cids
npm i ethers
npm i multicodec
npm i multihashes
npm i @types/node
  • Run yarn start and it should boot up using v2
yarn start

Optional extras - remove the component for the popup as this isn't needed.

I did as you said, clone the official repository, change the wallet address, install the dependencies and the sdk-v2.

the application starts up correctly, but if I look for a v2 contract I can't find it, nothing seems to change, it seems to be still using v1.

if I install the dependencies you have listed I get a lot of errors, I also use node 6.14.12.

any suggestions?

EDIT i searched and replaced throughout the project @pancakeswap-libs/sdk with @overage69/pancake-sdk-v2

seems to be working now

EDIT 2 yarn build working on localhost, not working on pages.cloudflare

<!--StartFragment-->
18:57:44.108 | Type '(Middleware \| Middleware&lt;{}, any, Dispatch&lt;AnyAction&gt;&gt;)[]' is not assignable to type '[any] \| ((getDefaultMiddleware: CurriedGetDefaultMiddleware&lt;{ application: ApplicationState; user: UserState; transactions: TransactionState; swap: SwapState; mint: MintState; burn: BurnState; multicall: MulticallState; lists: ListsState; toasts: ToastsState; }&gt;) =&gt; [...]) \| undefined'.
-- | --
18:57:44.108 | Type '(Middleware \| Middleware&lt;{}, any, Dispatch&lt;AnyAction&gt;&gt;)[]' is not assignable to type '[any]'.
18:57:44.108 | Target requires 1 element(s) but source may have fewer.  TS2322
18:57:44.109 | &nbsp;
18:57:44.109 | 40 \|     toasts
18:57:44.109 | 41 \|   },
18:57:44.109 | &gt; 42 \|   middleware: [...getDefaultMiddleware({ thunk: false }), save({ states: PERSISTED_KEYS })],
18:57:44.109 | \|   ^
18:57:44.109 | 43 \|   preloadedState: loadedState,
18:57:44.109 | 44 \| })
18:57:44.109 | 45 \|
18:57:44.109 | &nbsp;
18:57:44.110 | &nbsp;
18:57:44.171 | error Command failed with exit code 1.
18:57:44.172 | info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
18:57:44.175 | Failed: build command exited with code: 1

<!--EndFragment-->

any tips?

ubuntutest avatar May 20 '21 13:05 ubuntutest

Hello, dears! I did as follows.

Worked it out myself, enjoy folks

Installing V2 Pancakeswap Exchange Interface

Clone PancakeSwap v1 interface git clone https://github.com/pancakeswap/pancake-swap-interface-v1.git . Run Yarn in console from root yarn Update ROUTER_ADDRESS to v2 in /src/constants/index.ts line 3 0x10ED43C718714eb63d5aA57B78B54704E256024E Install v2 SDK npm i @overage69/pancake-sdk-v2 Install missing dependencies npm i @reach/portal npm i @uniswap/v2-core npm i ajv npm i cids npm i ethers npm i multicodec npm i multihashes npm i @types/node Run yarn start and it should boot up using v2 yarn start Optional extras - remove the component for the popup as this isn't needed.

But I got such this error. Please help me~~~~~~~~~~~ Screenshot_56

talent-blockchain avatar May 27 '21 11:05 talent-blockchain

Please it's necessary

xenabyte avatar Jun 11 '21 07:06 xenabyte

This code is working for middleware middleware: () => [...getDefaultMiddleware({ thunk: false }), save({ states: PERSISTED_KEYS })],

Akekarat avatar Jun 11 '21 18:06 Akekarat