Skip to content

Commit

Permalink
feat: Aptos (#5055)
Browse files Browse the repository at this point in the history
* new aptos app

* first commit for aptos pkg

* add more hooks

* add user menu

* fix menu

* fix build

* fix build

* fix tm

* add setting

* fix build

* add swap sdk

* fix build

* add aptos swap sdk

* fix footer

* fix types

* rename pkg as awgmi

* add wait tx

* add martian logo

* fix conflict

* add petra wallet icon

* fix initial network and add wait options

* update devnet chain id

* feat(uikit): extract swap UI (#3)

* extract swap ui

* fix conflict

* add more swap components

* aptos swap part 1

* fix test

* hide evm related footer

* refactor: merge Token types (#7)

* refactor: merge Token types

* fix test

* refactor(swap): SDK and currency search (#8)

* add currency search

* refactor(swap): SDK

* fix reset css order

* fix jest path mapping

* fix token lists type

* add test token faucet ui (#10)

* feat(aptos): Basic swap done (#9)

* feat(aptos): Basic swap done

* comment the log

* extract trade price

* swap modal

* fix build

* fix import

* implement native currency on aptos coin

* fix import

* fix import from aptos sdk

* aptos address as const

* feat(aptos): Add transactions (#12)

* feat(aptos): Add transactions

* fix import

* remove old reducer test

* rm log

* rm log

* add slippage setting

* chore(awgmi): add test, remove ait3 (#16)

* remove ait3

* test(awgmi): Add mock test

* fix type

* udpate pretter

* format

* fix isAddress

* feat: Update aptos swap to fit the new contract (#17)

* feat: Update aptos swap to fit the new contract

* update test

* remove unusded

* update test script

* feat(awgmi): Add simulateTransaction and swap error (#18)

* feat(aptos): Add more currency related hooks (#19)

* feat(aptos): Add more currency related hooks

* fix build

* add slippage

* fix build after next bump

* clean up state user

* feat(aptos): Add simple version of liquidity (#20)

* feat(liquidity): Add Liquidity  (#23)

* refactor(liquidity): Add Liquidity page

* chore(liquidity): Add skeleton

* chore(liquidity): Update typo

* chore(liquidity): Add Liquidity Addition skeleton

* chore(liquidity): Add remove skeleton

* chore(liquidity): Load lptokens having balance

* chore(liquidity): Add Choose Step

* chore(liquidity): Add Liquidity Form

* chore(liquidity): Add comment

* chore(liquidity): Add LiquidityAddModal mock UI

* chore(liquidity): Complete ChoosePair

* chore(liquidity): Add Liquidity Logic

* chore(liquidity): Clean up

* chore(liquidity): Update currency selector context

* chore(liquidity): Style Confirm Modal

* chore(liquidity): Update back buttons

* chore(liquidity): Integrate liquidity list

Co-authored-by: Philip <[email protected]>
Co-authored-by: Philip <[email protected]>

* chore: Clean up (#24)

* chore: Clean up

* revert unrelated

* fix import

* feat: Add Farm UI only  (#15)

* new aptos app

* first commit for aptos pkg

* add more hooks

* add user menu

* fix menu

* fix build

* fix build

* fix tm

* add setting

* fix build

* add swap sdk

* fix build

* add aptos swap sdk

* fix footer

* fix types

* rename pkg as awgmi

* add wait tx

* add martian logo

* fix conflict

* add petra wallet icon

* fix initial network and add wait options

* update devnet chain id

* feat(uikit): extract swap UI (#3)

* extract swap ui

* fix conflict

* add more swap components

* aptos swap part 1

* fix test

* hide evm related footer

* refactor: merge Token types (#7)

* refactor: merge Token types

* fix test

* refactor(swap): SDK and currency search (#8)

* add currency search

* refactor(swap): SDK

* fix reset css order

* fix jest path mapping

* fix token lists type

* add test token faucet ui (#10)

* feat: Add some farm components

* refactor: Aptos Farm UI 2

* new aptos app

* first commit for aptos pkg

* add more hooks

* add user menu

* fix menu

* fix build

* fix build

* fix tm

* add setting

* fix build

* add swap sdk

* fix build

* add aptos swap sdk

* fix footer

* fix types

* rename pkg as awgmi

* add wait tx

* add martian logo

* fix conflict

* add petra wallet icon

* fix initial network and add wait options

* update devnet chain id

* feat(uikit): extract swap UI (#3)

* extract swap ui

* fix conflict

* add more swap components

* aptos swap part 1

* fix test

* hide evm related footer

* refactor: merge Token types (#7)

* refactor: merge Token types

* fix test

* refactor(swap): SDK and currency search (#8)

* add currency search

* refactor(swap): SDK

* fix reset css order

* fix jest path mapping

* fix token lists type

* add test token faucet ui (#10)

* feat(aptos): Basic swap done (#9)

* feat(aptos): Basic swap done

* comment the log

* extract trade price

* swap modal

* fix build

* fix import

* implement native currency on aptos coin

* fix import

* fix import from aptos sdk

* aptos address as const

* feat(aptos): Add transactions (#12)

* feat(aptos): Add transactions

* fix import

* remove old reducer test

* rm log

* rm log

* add slippage setting

* chore(awgmi): add test, remove ait3 (#16)

* remove ait3

* test(awgmi): Add mock test

* fix type

* udpate pretter

* format

* fix isAddress

* refactor: Use uikit components

* refactor: Setup app layout

* refactor: Add FarmApyButton

* refactor: Aptos Farm

* refactor: Tags

* refactor: TokenImage and Farm Card DetailsSection

* refactor: RoiCalculatorModal

* feat: Add BASE_URL

* refactor: Move to Farms folder

* refactor: StakedLP

* refactor: Balance component move to uikit

* feat: Add getDisplayApr

* refactor: Farm WithdrawlModal

* refactor: Farm DepositModal

* perf: Remove moved file

* perf: Remove base url

* perf: Revert back MyApp

* perf: Existing user folder

Co-authored-by: ChefJoJo <[email protected]>

* fix build

* chore: update aptos (#27)

* update aptos

* fix types

* move files

* fix import

* fix path

* fix test

* chore: Update swap address (#29)

* chore: Update swap address

* revert sorts before

* refactor(aptos-sdk): strict Currency type (#11)

* refactor(aptos-sdk): strict Currency type

* fix types

* feat(swap): Update swap params and awgmi stale time (#30)

* chore: NextLinkFromReactRouter get from uikit (#28)

* chore: NextLinkFromReactRouter get from uikit

* chore: Set prefetch to false

* refactor(aptos): Remove add pairs state (#32)

* feat(liquidity): Add Remove UI (#25)

* chore(liquidity): Add default pair in currency route

* chore(liquidity): Add remove UI

* chore(liquidity): Clean up

* chore(liquidity: Clean up batch 2

* chore(liquidity): Clean up batch 3

* chore(liquidity): Integrate Remove Liquidity with SC

* chore(liquidity): Add slippage in liquidity addition

* chore(liquidity): Refactor code

* chore: Update menu link

* chore(liquidity): Add LP info in Remove page

* fix build

* add banner

* update image

* update layout and endpoint

* fix test token

* update readme

* chore(liquidity): Update resource address (#36)

* chore(liquidity): Update resource address

* chore(liquidity): Update address

* chore: Update useCoin query

* chore(liquidity): Enable detail section in Add Liquidity

* chore(liquidity): Avoid useTotalSupply cache

* small fix

* chore: Sync wagmi isolate query context (#37)

* refactor: Add account balance to reduce amount of fetch (#38)

* refactor: Add account balance to reduce amount of fetch

* fix types

* feat(swap): support multihop (#40)

* refactor(aptos): fine tune refresh interval and update tx updater (#42)

* refactor(aptos): fine tune refresh interval and update tx updater

* add watch to currency balance

* chore(ifo): Initial migration for Aptos (#39)

* sync develop

* add single hop and setting on swap

* unify low apt config

* update swap address

* fix build

* fix build

* add max button

* chore(liquidity): Fix minor glitches (#41)

* chore(liquidity): Update decimal

* chore(liquidity): Clean up

* chore(liquidity): Update test in sdk

* chore: Update snapshot

* refactor(liquidity): Move components into uikit

* refactor(liquidity): Move UI components into uikit

* chore(liquidity): Add TypeScript

* chore(liquidity): Add memo

* update swap address

* use account balance

* fix unwanted memo leading data undefined

* remove ts ignore

* update lp symbol

* contract lp name instead symbol for length limit

* add type filter

* feat(aptos): get cake price from api (#44)

* feat(aptos): Add cake price from api

* fix return cake price

* optional

* temp fix types

* fix cake responsive

* snapshot

* fix(liquidity): Symbol order (#43)

* fix(liquidity): Add space in remove confirm modal (#46)

* feat(aptos): add isHexStringEquals for address checking (#45)

* chore: Move 3dpan image (#48)

* chore(liquidity): Add cache (#47)

* perf(awgmi): useQueries workaround and memo select (#50)

* add watch in pair reserves

* test only change

* feat: support testnet (#51)

* feat(aptos): Try parse simulation vm error (#53)

* feat(aptos): Try parse simulation vm error

* add todo

* chore(ifo): Add hooks for token vesting (#54)

* chore(swap): Search unsupported tokens (#52)

* use correct translation

* feat: 🎸 add pools page layout (#35)

* no reset state on user rejected

* reuse contract address

* fix martian

* fix types

* fix: Minor Swap bugs (#56)

* chore: Shoe balance exact

* fix: Update APT_MIN

* fix martain pending tx not cancel

* add basic manifest

* move correct image path

* add cake mint

* chore: Add comparing address by bytes (#55)

* chore: Add comparing address by bytes

* chore: Add sortBefore decorator

* chore: Remove aptos dependency from token-list

* chore: Update name

* chore(ifo): Add `IfoFoldableCard` component and related logic (#58)

* fix: Remove steps, fix layout and title

* feat: Add refactored  component

* fix: Types

* fix: Remove approval logic

Co-authored-by: apt-waffle <[email protected]>

* chore: Fix minor liquidity bugs (#57)

* feat: Cross farming conflict (#61)

* chore(ifo): Remove profile logic (#60)

Co-authored-by: apt-waffle <[email protected]>

* feat: Update swap contract (#62)

* feat: Update swap contract

* fix

* fix(liquidity): Mismatch sortBefore between FE and SC (#65)

* fix(liquidity): Mismatch sortBefore between FE and SC

* chore: Add logo token

* feat: Pages add meta (#64)

* fix(ifo): Only support public sale in first iteration (#63)

* fix(ifo): Only support public sale in first iteration

* fix(ifo): Add correct types back

Co-authored-by: apt-waffle <[email protected]>

* feat(ifo): Add current IFO component (#67)

* feat(ifo): Add current IFO component

* fix: Remove achievements

Co-authored-by: apt-waffle <[email protected]>

* fix(liquidity: Minor UI bugs (#68)

* chore(liquidity): Showing loading when idle

* chore: Update swap address

* chore: Display output in 8 decimals

* refactor(liquidity): Move PositionCard out widget because Logo dependency

* chore: Enable logo image in liquidity

* chore: Not display LP receive for first provider

* update swap address (#69)

* feat: Seo and phish banner time (#70)

* wip

* use next-seo

* remove padding

* use estimate gas on simulatetx

* update aptos sdk

* fix: Lates branch conflict (#71)

* chore: Update LP APRs for Farms (#4921)

- Update LP APRs for Farms

Auto-generated by [create-pull-request][1]

[1]: https://github.com/peter-evans/create-pull-request

* chore: Update LP APRs for Farms (#4923)

- Update LP APRs for Farms

Auto-generated by [create-pull-request][1]

[1]: https://github.com/peter-evans/create-pull-request

* feat: List KRS IFO (#4920)

* refactor: Run update lp apr only on pcs repo (#4922)

* feat: Cross chain farming (#4669)

* chore: Add address and Abi

* fix: Switch error

* feat: Add SUPPORT_FARMS chain

* feat: Get Non BSC vault contract fee

* feat: ExchangeRate pow 18

* feat: Done deposit and withdraw

* feat: Add Multi-Chain modal

* fix: Withdraw and deposit

* feat: Farm cake earning amount

* feat: Harvest

* chore: Revert wagmi

* feat: Harvest Transaction Modal

* feat: Setup Multi Chain Harvest Modal

* feat: Add Transaction

* fix: Transaction Loding

* feat: Fetch Celer api

* feat: Done farm harvest transaction info

* perf: Only show one warning icon

* feat: Wallet modal add harvest claiming info

* chore: Revert wagmi

* chore: Add loading

* feat: Show FarmsPoolsRow chainId is BSC

* fix: Transactions PendingNumber

* fix: Error

* feat: Add disable when farm is harvest

* feat: Split non bsc vault address

* fix: Contract test

* chore: New Harvest Modal style

* feat: Remove disabled farm button when farm is pending

* refactor: Stake farms and unstake farm

* feat: Add new Farm Transaction Modal style

* feat: Non Bsc vault harvest

* feat: Farm stake and unstake add addTransaction

* Update transaction updater

* feat: Done stake and unstake

* fix: Some issue

* perf: Switch to testnet

* fix: Conflict

* chore: Update LightBulb icon

* fix: useToast

* perf: TransactionType only use non-bsc-farm

* feat: New contract

* chore: Remove getCrossFarmingAddress

* perf: Farm withdraw fee

* chore: Update contract

* fix: Test

* feat: Update new contract

* style: Font color

* chore: Latest contract address

* feat: Disabled withdraw button when is withdrawing

* fix: Decimal and handle gas error

* fix: Non BSC Farm

* feat: Update new contract and Fee calculation

* fix: Clear FarmTransactionModal when switch account

* chore: Remove wait

* feat: Update receiver address

* perf: DescriptionWithTx

* chore: Prettier

* feat: Update new contract

* fix: Conflict

* fix: Transaction Error

* chore: Hide pool router

* feat: Fee add buffer

* feat: List eth token

* feat: fetchAndUpdateLPsAPR with multichain

* chore: Update eth farm

* chore: Setup mock mainnet

* feat: Fix pendingCake

* feat: Disabled button when farm isPending

* fix: Harvest Modal button

* fix: Harvest button

* feat: Update LPsAPR

* feat: Update wording and first deposit fee

* pref: UseSWR instead of setInterval

* chore: Use useSWRImmutable

* fix exchange rate

* fix exchange percusion

* fix fee calucation

* add more buffer

* minor fix the updater

* slightly more buffer

* error translation

* use origin gas price

* fix: Onclick Loading logic

* chore: Checksummed

* feat: Get Liquidiry Url Path Parts

* chore: Revert mainnet token address

* fix: Wallet User Menu

* fix: Action Panel liquidityUrlPathParts

* feat: Add warning for cross farming modal

* feat: Update latest contract address

* chore: Update translations file

* chore: Hide farms test

* chore: Remove unused code

Co-authored-by: ChefJoJo <[email protected]>

* fix: Native StableLP (#4925)

* fix: Remove queries only when chainid change (#4926)

* perf: Check prev chain id first to not run list check if it is false (#4927)

* fix: Into page url (#4929)

* fix: Info url

* feat: Update info address

* fix: Proxy harvest (#4928)

* feat: Remove user gas fee for bsc (#4930)

* chore: Update LP APRs for Farms (#4933)

- Update LP APRs for Farms

Auto-generated by [create-pull-request][1]

[1]: https://github.com/peter-evans/create-pull-request

* feat(Pottery): Add WithdrawableDate and remaining period change to 'days' (#4919)

* feat(Pottery): Add remaingUnlockTime

* show Withdrawable date and ermaining period change to 'days'

* rename

* refactor: (workflow): Run stale issues flow only on pcs repo (#4936)

* fix: (ifo): View info link in token vesting doesn't point to the ifo component (#4938)

fix: View info link in token vesting doesn't point to the ifo component

* chore: info search adjustment (#4941)

* chore: info search adjustment

* chore: refetch interval

* fix: (trading-competition): Trading competition contract makes calls on different chains resulting error (#4916)

* chore: Optimize images (#4924)

[ImgBot] Optimize images

*Total -- 283.53kb -> 263.52kb (7.06%)

/public/images/ifos/co-bg.png -- 6.97kb -> 3.71kb (46.74%)
/public/images/tokens/0x936B6659Ad0C1b244Ba8Efe639092acae30dc8d6.png -- 1.79kb -> 1.33kb (26.12%)
/public/images/ifos/krs-bg.png -- 88.97kb -> 73.73kb (17.13%)
/public/images/tokens/0x37b53894e7429f794B56F22a32E1695567Ee9913.png -- 7.86kb -> 6.99kb (11.08%)
/public/images/achievements/ifo-krs.svg -- 5.96kb -> 5.91kb (0.87%)
/public/images/achievements/ifo-co.svg -- 6.62kb -> 6.58kb (0.63%)
/public/images/achievements/2-year.svg -- 14.47kb -> 14.42kb (0.38%)
/public/images/tokens/0x936B6659Ad0C1b244Ba8Efe639092acae30dc8d6.svg -- 1.61kb -> 1.60kb (0.36%)
/public/images/tokens/0x37b53894e7429f794B56F22a32E1695567Ee9913.svg -- 149.27kb -> 149.25kb (0.01%)

Signed-off-by: ImgBotApp <[email protected]>

Signed-off-by: ImgBotApp <[email protected]>
Co-authored-by: ImgBotApp <[email protected]>

* refactor: Remove timestamp store data from user redux and don't use delete operator (#4940)

* refactor: Remove timestamp store data from user redux

* refactor: Don't use delete operator

* feat: Update farm test (#4935)

* feat: Wallet modal v2 (#4795)

* add wallet modal v2

* basic desktop

* basic mobile

* switch new wallet modal

* remove useWallet

* fix build

* use cdn image

* fix injected

* add doc lang mapping

* sort wallets

* fix mobile deeplink onclick

* fix type

* split desktop

* fix test

* injected icon as fallback

* minimal rwd

* add drag to modal v2

* coinbase just launch it instead

* fix couple bugs

* fix ssr

* update images

* fix qrcode

* fix qr code

* error translation

* redefine installed and delay qrcode

* fix sorting

* preload image

* add custom data to wallet config

* fix preload image leak and types

* fix optional

* fix wallet switch chain flag

* chore: Update LP APRs for Farms (#4943)

- Update LP APRs for Farms

Auto-generated by [create-pull-request][1]

[1]: https://github.com/peter-evans/create-pull-request

* refactor: Remove array index as key usage (#4937)

* refactor: Remove array index as key usage

* fix: Revert topfarms and top pools

* refactor: Make getlpsymbol generic (#4939)

* feat: (ifo): Add dynamic cake to burn info for ifos (#4816)

* fix: (ifo banner): Fix ifo banner and status in other chains (#4895)

* chore: Remove static cake to burn info for krs ifo (#4947)

* feat: List KRS (#4945)

Farm info:
LP Symbol: KRS -BUSD
Address: 0xac747ad9d61884986ad7a4a6cc5de998ce21b253

Pool info:
Token address: 0x37b53894e7429f794B56F22a32E1695567Ee9913
Pool contract address: 0x067f926eb8f2a95f260327b01c29b2034a785029
Pool token rewards per block: 4.96

* feat: Add IFO NFT warning text (#4946)

* perf: Pools page add loading animation (#4944)

* chore(wallet): Update wallet wording (#4948)

* chore(wallet): Update wallet wording

* update wording

* style(wallet): Wallet connect v2 button height (#4949)

* style(IFO): Hide CakeVaultCard loading animation (#4950)

* revert: Revert wallet property hooks usage (#4952)

* chore: fix multi-chain watch list (#4953)

* feat: (swap): Add stable swap warning to swap tab (#4955)

* chore: Update LP APRs for Farms (#4957)

- Update LP APRs for Farms

Auto-generated by [create-pull-request][1]

[1]: https://github.com/peter-evans/create-pull-request

* feat: Astronaut bunny image (#4958)

* feat: Astronaut bunny image

* chore: Image rename

* fix(wallet): deeplink on dapp (#4960)

* fix(wallet): deeplink on dapp

* revert the metamask://

* fix: (wallet): Filter non installed wallets in mobile dapp browser (#4963)

* fix: (wallet): Missing translation in wallet modal (#4964)

* fix: Css

* fix: Conflict

Signed-off-by: ImgBotApp <[email protected]>
Co-authored-by: PancakeSwap Bot <[email protected]>
Co-authored-by: memoyil <[email protected]>
Co-authored-by: ChefJoJo <[email protected]>
Co-authored-by: Woody <[email protected]>
Co-authored-by: Chef Yogi <[email protected]>
Co-authored-by: imgbot[bot] <31301654+imgbot[bot]@users.noreply.github.com>
Co-authored-by: ImgBotApp <[email protected]>

* estimatePrioritizedGasUnitPrice false

* feat(awgmi): Add ans (#73)

* feat(aptos): Update wallet modal to v2 (#74)

* feat(aptos): Update wallet modal to v2

* remove unused

* chore: Format number display (#72)

* minor ui fix

* swap layout padding

* fix(awgmi): useSyncExternalStore shim import (#75)

* chore(aptos): Remove unstable flag on add and remove liquidity

* fix(liquidity): Update format number (#76)

* chore: Display correct ratio (#77)

* chore: Increase min apt when maximize (#78)

* chore: Increase min apt when maximize

* chore: Update minor ui

* chore: Disable Farm menu

* update

* feat(cli): Add aptos codegen (#2)

* feat(cli): Add aptos codegen

* add type args type

* test contracts

* update

* update contract

* udpate

* extract address [skip-ci]

* fix martian by setting gas amount

* remove no use

* feat: 🎸 pools page UI (#59)

* feat: 🎸 pools page UI

* feat: 🎸 add types & pools state

* feat: 🎸 PoolCard

* feat: 🎸 enable & deposit test

* feat: fetch pools

* feat: show users data

* feat: add pools action

* fix: change import path

* chore: 🤖 update address

* refactor(pool): Remove pool state (#80)

* refactor(pool): Remove pool state

* blocking page

* chore: Update Aptos meta title (#81)

* chore(trade): Increase MIN_APT for swap and add SettingButton in Liquidity (#82)

* chore: Increate MIN_APTOS for swap

* chore: Add SettingsButton

* update chain id (#83)

* feat(aptos): Add Pontem wallet (#84)

* feat(aptos): Add Pontem wallet

* construct block url by chain config

* chore(wallet): Add fewcha (#86)

* feat(aptos): Add blocto wallet (#85)

* feat(aptos): Add blocto wallet

* emit connecting earlier

* remove check

* update pontem logo

* fix empty account missing public key

* update connector config

* support ans mainnet

* rever max gas amount back

* add option to submit transaction

* rename restUrls to nodeUrls

* add nodereal and increase inteveral to 3s

* combine env

* feat(ifo): Add initial contract interaction (#87)

* update swap address and add advance resources filter (#88)

* feat(aptos): codegen const module name (#89)

* add testnet bases

* remove path on awgmi ts to avoid type conflict

* try add ponten public key

* fix(aptos): disconnect if switch account not connected

* feat(awgmi): Split connectors import (#90)

* add networkName to connect

* chore: Fix fewcha late loaded (#91)

* fix safari unknown group syntax

* add default chainid for blocto

* chore: Nav disabled ifo (#94)

* fix(aptos): Add blocto wallet icon on blocto dapp (#96)

* fix(aptos): Add blocto wallet icon on blocto dapp

* remove import

* refactor(ifo): Move fetch table item into shared hook (#95)

* fix: Remove IFO approve

* fix: Don't use default export

* refactor: Move into shared hook

* feat(awgmi): Add hook for fetching table item

* fix: Pool is always defined

Co-authored-by: apt-waffle <[email protected]>

* update nodereal

* fix(aptos): Skip multi sig wallet simulation (#97)

* chore: Use TraceMove as blockscan url (#98)

* rename

* feat(aptos): Add wrong network

* node real WITH_CREDENTIALS false

* hide wrong network close button

* hide common bases

* add ga

* chore(wallet): Add friendly error message in Fewcha (#101)

* chore: Remove redux and fix lint (#102)

* chore(aptos): Get ready for publish aptos swap sdk (#104)

* fix: Aptos branch config (#105)

* chore: Add wording to suggest change network

* chore(aptos): Update wallet wording (#108)

* fix unit test

* fix(swap): Not update URL when select existing input or output (#103)

* fix(aptos): coin sorting (#109)

* fix(aptos): coin sorting

* fix types

* clean up

* clean up

* update swap address

* add sign message (#111)

* feat(aptos): add trust walelt

* only show trust in ios

* hide trust wallet for now

* chore(aptos): Mainnet (#107)

* chore: Mainnet

* fix test

* add usdc name

* update turbo

* temp set default testnet

* revert

* add devnet temp

* revert devnet

* network swicher default chain

* 2px

* ci: Fix unit test git depth

* ci: Remove parallel and update snapshot

* fix deps

* fix(awgmi): Add missing published package.json

* chore: Flip default chain

* hide fewcha

Signed-off-by: ImgBotApp <[email protected]>
Co-authored-by: Philip <[email protected]>
Co-authored-by: Philip <[email protected]>
Co-authored-by: Philip <[email protected]>
Co-authored-by: ChefMomota <[email protected]>
Co-authored-by: apt-waffle <[email protected]>
Co-authored-by: bowen zhu <[email protected]>
Co-authored-by: apt-waffle <[email protected]>
Co-authored-by: PancakeSwap Bot <[email protected]>
Co-authored-by: memoyil <[email protected]>
Co-authored-by: Woody <[email protected]>
Co-authored-by: Chef Yogi <[email protected]>
Co-authored-by: imgbot[bot] <31301654+imgbot[bot]@users.noreply.github.com>
Co-authored-by: ImgBotApp <[email protected]>
Co-authored-by: chefmomota <[email protected]>
  • Loading branch information
15 people authored Oct 24, 2022
1 parent d66e4bf commit cff92be
Show file tree
Hide file tree
Showing 958 changed files with 33,867 additions and 4,105 deletions.
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"plugins": ["lodash"],
"extends": ["@pancakeswap/eslint-config-pancake", "plugin:react/jsx-runtime", "plugin:@next/next/recommended"],
"rules": {
"no-restricted-syntax": 0,
"import/no-unresolved": 0,
"no-console": ["warn", { "allow": ["info", "warn", "error", "debug"] }],
"no-plusplus": 0,
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/unitTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 2

- name: Setup Node
uses: actions/setup-node@v2
Expand All @@ -42,4 +44,4 @@ jobs:
run: yarn install --frozen-lockfile

- name: Run tests
run: yarn test
run: yarn test:ci
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@ node_modules
build
src/config/abi/types
.next
cli/aptos-codegen
dist
packages/farms/lists
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"deno.enablePaths": ["./cli/aptos-codegen"],
"deno.config": "./cli/aptos-codegen/deno.jsonc"
}
1 change: 1 addition & 0 deletions apps/aptos/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NEXT_PUBLIC_APEX_URL = "https://pancakeswap.finance"
35 changes: 35 additions & 0 deletions apps/aptos/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
1 change: 1 addition & 0 deletions apps/aptos/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Aptos
4 changes: 4 additions & 0 deletions apps/aptos/babel-test.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"presets": ["next/babel"],
"plugins": ["@vanilla-extract/babel-plugin"]
}
48 changes: 48 additions & 0 deletions apps/aptos/client.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { createClient } from '@pancakeswap/awgmi'
import { PetraConnector } from '@pancakeswap/awgmi/connectors/petra'
import { MartianConnector } from '@pancakeswap/awgmi/connectors/martian'
import { BloctoConnector } from '@pancakeswap/awgmi/connectors/blocto'
import { PontemConnector } from '@pancakeswap/awgmi/connectors/pontem'
import { FewchaConnector } from '@pancakeswap/awgmi/connectors/fewcha'
import { AptosClient } from 'aptos'
import { chains, defaultChain } from 'config/chains'

const NODE_REAL_API = process.env.NEXT_PUBLIC_NODE_REAL_API
const NODE_REAL_API_TESTNET = process.env.NEXT_PUBLIC_NODE_REAL_API_TESTNET

const nodeReal = {
...(NODE_REAL_API && {
mainnet: NODE_REAL_API,
}),
...(NODE_REAL_API_TESTNET && {
testnet: NODE_REAL_API_TESTNET,
}),
}

export const client = createClient({
connectors: [
new PetraConnector({ chains }),
new MartianConnector({ chains }),
new PontemConnector({ chains }),
new FewchaConnector({ chains }),
new BloctoConnector({ chains }),
new PetraConnector({ chains, options: { name: 'Trust Wallet', id: 'trustWallet' } }),
],
provider: ({ networkName }) => {
const networkNameLowerCase = networkName?.toLowerCase()
if (networkNameLowerCase) {
const foundChain = chains.find((c) => c.network === networkNameLowerCase)
if (foundChain) {
if (foundChain.nodeUrls.nodeReal && nodeReal[networkNameLowerCase]) {
return new AptosClient(`${foundChain.nodeUrls.nodeReal}/${nodeReal[networkNameLowerCase]}`, {
WITH_CREDENTIALS: false,
})
}
return new AptosClient(foundChain.nodeUrls.default)
}
}

return new AptosClient(defaultChain.nodeUrls.default)
},
autoConnect: true,
})
136 changes: 136 additions & 0 deletions apps/aptos/components/ApproveConfirmButtons.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
import styled from 'styled-components'
import { useTranslation } from '@pancakeswap/localization'
import { ChevronRightIcon, Button as UIKitButton, AutoRenewIcon, ChevronDownIcon, Box, Flex } from '@pancakeswap/uikit'

export enum ButtonArrangement {
ROW = 'row',
SEQUENTIAL = 'sequential',
}

interface ApproveConfirmButtonsProps {
isApproveDisabled: boolean
isApproving: boolean
isConfirming: boolean
isConfirmDisabled: boolean
onApprove: () => void
onConfirm: () => void
buttonArrangement?: ButtonArrangement
confirmLabel?: string
confirmId?: string
}

const StyledApproveConfirmButtonRow = styled.div`
align-items: center;
display: grid;
grid-template-columns: 1fr;
justify-content: center;
${({ theme }) => theme.mediaQueries.md} {
grid-template-columns: 1fr 24px 1fr;
}
`

const Button = styled(UIKitButton)`
width: 100%;
${({ theme }) => theme.mediaQueries.md} {
min-width: 160px;
}
`

const iconAttrs = { width: '24px', color: 'textDisabled' }

const ChevronRight = styled(ChevronRightIcon).attrs(iconAttrs)`
display: none;
${({ theme }) => theme.mediaQueries.md} {
display: block;
}
`

const ChevronBottom = styled(ChevronDownIcon).attrs(iconAttrs)`
display: block;
${({ theme }) => theme.mediaQueries.md} {
display: none;
}
`

const spinnerIcon = <AutoRenewIcon spin color="currentColor" />

const ApproveConfirmButtons: React.FC<React.PropsWithChildren<ApproveConfirmButtonsProps>> = ({
isApproveDisabled,
isApproving,
isConfirming,
isConfirmDisabled,
onApprove,
onConfirm,
buttonArrangement = ButtonArrangement.ROW,
confirmLabel,
confirmId,
}) => {
const { t } = useTranslation()
const confirmButtonText = confirmLabel ?? t('Confirm')

const ApproveConfirmRow = () => {
return (
<StyledApproveConfirmButtonRow>
<Box>
<Button
disabled={isApproveDisabled}
onClick={onApprove}
endIcon={isApproving ? spinnerIcon : undefined}
isLoading={isApproving}
>
{isApproving ? t('Enabling') : t('Enable')}
</Button>
</Box>
<Flex justifyContent="center">
<ChevronRight />
<ChevronBottom />
</Flex>
<Box>
<Button
id={confirmId}
onClick={onConfirm}
disabled={isConfirmDisabled}
isLoading={isConfirming}
endIcon={isConfirming ? spinnerIcon : undefined}
>
{isConfirming ? t('Confirming') : confirmButtonText}
</Button>
</Box>
</StyledApproveConfirmButtonRow>
)
}

const ApproveConfirmSequential = () => {
return (
<>
{isApproveDisabled ? (
<Box>
<Button
id={confirmId}
onClick={onConfirm}
disabled={isConfirmDisabled}
isLoading={isConfirming}
endIcon={isConfirming ? spinnerIcon : undefined}
>
{isConfirming ? t('Confirming') : confirmButtonText}
</Button>
</Box>
) : (
<Box>
<Button onClick={onApprove} endIcon={isApproving ? spinnerIcon : undefined} isLoading={isApproving}>
{isApproving ? t('Enabling') : t('Enable')}
</Button>
</Box>
)}
</>
)
}

return buttonArrangement === ButtonArrangement.ROW ? ApproveConfirmRow() : ApproveConfirmSequential()
}

export default ApproveConfirmButtons
9 changes: 9 additions & 0 deletions apps/aptos/components/Card/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { AtomBox, AtomBoxProps } from '@pancakeswap/ui'

const Card = (props: AtomBoxProps) => <AtomBox width="100%" padding="20px" borderRadius="default" {...props} />

export const LightCard = (props: AtomBoxProps) => <AtomBox border="1" backgroundColor="backgroundAlt" {...props} />
export const LightGreyCard = (props: AtomBoxProps) => <AtomBox border="1" backgroundColor="background" {...props} />
export const GreyCard = (props: AtomBoxProps) => <AtomBox backgroundColor="dropdown" {...props} />

export default Card
34 changes: 34 additions & 0 deletions apps/aptos/components/CommitButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { Button, ButtonProps } from '@pancakeswap/uikit'
import { useAccount } from '@pancakeswap/awgmi'
import { useIsMounted } from '@pancakeswap/hooks'
import { useActiveNetwork } from 'hooks/useNetwork'
import { ConnectWalletButton } from './ConnectWalletButton'
import Trans from './Trans'

const wrongNetworkProps: ButtonProps = {
variant: 'danger',
disabled: false,
children: <Trans>Wrong Network</Trans>,
}

export const CommitButton = (props: ButtonProps) => {
const { isWrongNetwork } = useActiveNetwork()
const isMounted = useIsMounted()
const { isConnected } = useAccount()

if (!isConnected && isMounted) {
return <ConnectWalletButton />
}

return (
<Button
{...props}
onClick={(e) => {
if (!isWrongNetwork) {
props.onClick?.(e)
}
}}
{...(isWrongNetwork && wrongNetworkProps)}
/>
)
}
32 changes: 32 additions & 0 deletions apps/aptos/components/ConnectWalletButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { Button, ButtonProps } from '@pancakeswap/uikit'
import { WalletModalV2 } from '@pancakeswap/ui-wallets'
import { Trans, useTranslation } from '@pancakeswap/localization'
import { useState } from 'react'
import { useAuth } from 'hooks/useAuth'
import { wallets } from 'config/wallets'

export const ConnectWalletButton = ({ children, ...props }: ButtonProps) => {
const [open, setOpen] = useState(false)
const { t } = useTranslation()
const { login } = useAuth()

const handleClick = () => {
setOpen(true)
}

return (
<>
<Button width="100%" onClick={handleClick} {...props}>
{children || <Trans>Connect Wallet</Trans>}
</Button>
<WalletModalV2
docText={t('Learn How to Create and Connect')}
docLink="https://docs.pancakeswap.finance/get-started-aptos/wallet-guide"
isOpen={open}
wallets={wallets}
login={login}
onDismiss={() => setOpen(false)}
/>
</>
)
}
Loading

1 comment on commit cff92be

@vercel
Copy link

@vercel vercel bot commented on cff92be Oct 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

aptos-web – ./apps/aptos

aptos.pancake.run
aptos-web.pancake.run
aptos-web-git-develop.pancake.run

Please sign in to comment.