-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: display stake button for TAO token * feat: created bittensor validator hook, dinamically display pool info by chain id * feat: useGetStakingInfo hook, and auxiliary hooks to fetch staking for a given asset * feat: updated NoomPoolBondWizard, updated component types * feat: hooks for bittensor hotkeys and validators * feat: display bittensor validator name and unbound button * feat: hooks for fetching nomPooldata, consolidated data in useGetUnbondInfo * feat: unbond TAO, totalStaked and unbondPayload hooks * fix: poolname, unbond btn and loading sekeleton displayed when it should not * fix: staking TAO with remark * chore: added taostats api key to env and webpack * feat: unbond TAO, display tao unbond info * feat: useGetBittensorMinJoinBond * refactor: conslidated data in useGetStakeInfo hook * fix: max button not working before input, fetch payload with 0n plancks and invalidate form if pancks is < 0n * chore: tidy up useGetUnbondInfo * feat: added hooks to fetch and calculated if can stake bittensor * feat: display stake warning message and tooltip * chore: renamed NomPoolBond folder and items to "Bond" * chore: renamed NomPoolUnboond folder and items to "Unbond" * chore: created hooks folder, organized bittensor and nomPools hooks * fix: bittensor cooldown when switching accounts back and forth * chore: added comment * chore: renamed component name to be generic to bonds * feat: added BondSelectDrawer for popup UI * feat: added BittensorBondSelectDrawer * feat: hooks to fetch and merged Bittensor delegators data * feat: bondSelectDrawer, bond skeleton option * feat: sort delegators * feat: open modal with "select" option when asset is TAO * refactor: delegate select drawer to form in modal * fix: add 10 min staleTime for taostats queries * feat: hooks for fetching staked balance per delegator * fix: bondPoolName when doing anything but staking * refactor: display delegator stake position on AssetDetails components * fix: bondPooName should receive chainId as props * feat: unstake by delegator data * fix: stake cooldown when switching accounts * feat: track unstake block number and use it for stake cooldown * fix: bondOption token formartting, icon * chore: added changeset to util package * feat: fetch data from rpc instead of taostats, display TAO staked in all accounts * refactor: fetch total staked from rpc when unbonding, remove unused hooks * fix: delegators sorting race condition * chore: minor RemoteConfigStore type updates * chore: updated taostats api endpoint * chore: pr review change requests, added horizontal scrolling for sorting actions * chore: bond row label, bond form form grid spacing * feat: added taostats proxy api * feat: handle missing origin/auth headers * refactor: display UI errors * refactor: error handling * refactor: apr error msg, duplicated var assignement, null query key error * perf: memoized values and disabled queries when token is not tao or tao bal is 0 * chore: memoized variables, fixed transalation, removed eslint comment * refactor: broke down BondPoolName into multiple child components * refactor: broke down StakingUnbondingPeriod into multiple child components * fix: only display error msg in BondOption if there is actually an error * refactor: out with formatTokenDecials in planckToTokens * refactor: use minJoinBond to get an accurate fake fee estimation * refactor: moved onSuccess ot its opwn useEffect in TxProgressBase * chore: removed mocked remote config * chore: removed redundant translation, early bittensor delegator name button return * chore: early bittensor delegator name button return, cath api error * refactor: handle unbond success on useUnbondWizard, revert TxProgress changes * refactor: create store and custom hooks for keeping track of bittensor unbond block numbers * refactor: change bittensor staking flow, default poolId to the currently staked delegator, allow user delegator selection * feat: place recommented on top of delegators list * feat: recommended delegator loading skeleton * refactor: use app store to track usntaking tx block number * revert: uncommented code * style: changed color of non-blocking action messages * fix: center tooltip info icon, wait for blocknumber in stake cooldown warning on first load * refactor: remove redundand fallback for blockNumber * chore: fix text copy * refactor: updated BondOption design * style: minor spacing and color adjustments * chore: rename "direct staking" => "delegated staking" * chore: add separator after recommended validator in bittensor validator selection * chore: ran pnpm changeset * fix: nom pool staking warning copy * fix: canary build icon names * chore: updated copy to "featured" --------- Co-authored-by: Chid Gilovitz <[email protected]>
- Loading branch information
Showing
90 changed files
with
2,412 additions
and
492 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@talismn/balances": patch | ||
--- | ||
|
||
rename "direct staking" => "delegated staking" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@talismn/util": patch | ||
--- | ||
|
||
added formatTokenDecimals util fn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
111 changes: 111 additions & 0 deletions
111
apps/extension/src/@talisman/components/ScrollContainerDraggableHorizontal.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
import { classNames } from "@talismn/util" | ||
import React, { MouseEvent, TouchEvent, useEffect, useRef, useState } from "react" | ||
|
||
type ScrollContainerDraggableHorizontalProps = { | ||
children?: React.ReactNode | ||
className?: string | ||
} | ||
|
||
export const ScrollContainerDraggableHorizontal = ({ | ||
children, | ||
className, | ||
}: ScrollContainerDraggableHorizontalProps) => { | ||
const containerRef = useRef<HTMLDivElement>(null) | ||
|
||
// State to track dragging | ||
const [isDragging, setIsDragging] = useState<boolean>(false) | ||
const [startPosition, setStartPosition] = useState<number>(0) | ||
const [scrollLeft, setScrollLeft] = useState<number>(0) | ||
|
||
// State to track if there's more content to the left or right | ||
const [more, setMore] = useState<{ left: boolean; right: boolean }>({ | ||
left: false, | ||
right: false, | ||
}) | ||
|
||
useEffect(() => { | ||
const scrollable = containerRef.current | ||
if (!scrollable) return | ||
|
||
const handleDetectScroll = () => { | ||
setMore({ | ||
left: scrollable.scrollLeft > 0, | ||
right: scrollable.scrollWidth - scrollable.scrollLeft > scrollable.clientWidth, | ||
}) | ||
} | ||
|
||
// Attach event listeners | ||
scrollable.addEventListener("scroll", handleDetectScroll) | ||
window.addEventListener("resize", handleDetectScroll) | ||
|
||
// Initial detection | ||
handleDetectScroll() | ||
|
||
// Fix for initial load when scrollWidth might not be calculated yet | ||
setTimeout(handleDetectScroll, 50) | ||
|
||
// Cleanup | ||
return () => { | ||
scrollable.removeEventListener("scroll", handleDetectScroll) | ||
window.removeEventListener("resize", handleDetectScroll) | ||
} | ||
}, []) | ||
|
||
const handleDragStart = (e: MouseEvent<HTMLDivElement> | TouchEvent<HTMLDivElement>) => { | ||
e.preventDefault() | ||
setIsDragging(true) | ||
containerRef.current?.classList.add("cursor-grabbing") | ||
const pageX = "touches" in e ? e.touches[0].pageX : e.pageX | ||
setStartPosition(pageX) | ||
setScrollLeft(containerRef.current?.scrollLeft || 0) | ||
} | ||
|
||
const handleDragEnd = () => { | ||
setIsDragging(false) | ||
containerRef.current?.classList.remove("cursor-grabbing") | ||
} | ||
|
||
const handleDragMove = (e: MouseEvent<HTMLDivElement> | TouchEvent<HTMLDivElement>) => { | ||
if (!isDragging) return | ||
e.preventDefault() | ||
const pageX = "touches" in e ? e.touches[0].pageX : e.pageX | ||
const distance = pageX - startPosition | ||
if (containerRef.current) { | ||
containerRef.current.scrollLeft = scrollLeft - distance | ||
} | ||
} | ||
|
||
return ( | ||
<div className="relative z-0 overflow-hidden"> | ||
{/* eslint-disable-next-line jsx-a11y/no-static-element-interactions */} | ||
<div | ||
ref={containerRef} | ||
className={classNames( | ||
"no-scrollbar flex cursor-grab select-none overflow-x-auto", | ||
className, | ||
)} | ||
onMouseDown={handleDragStart} | ||
onMouseUp={handleDragEnd} | ||
onMouseLeave={handleDragEnd} | ||
onMouseMove={handleDragMove} | ||
onTouchStart={handleDragStart} | ||
onTouchEnd={handleDragEnd} | ||
onTouchMove={handleDragMove} | ||
> | ||
{children} | ||
</div> | ||
{/* Left gradient overlay */} | ||
<div | ||
className={`pointer-events-none absolute left-0 top-0 h-full w-12 bg-gradient-to-r from-black to-transparent transition-opacity duration-300 ${ | ||
more.left ? "opacity-100" : "opacity-0" | ||
}`} | ||
></div> | ||
{/* Right gradient overlay */} | ||
<div | ||
className={`pointer-events-none absolute right-0 top-0 h-full w-12 bg-gradient-to-l from-black to-transparent transition-opacity duration-300 ${ | ||
more.right ? "opacity-100" : "opacity-0" | ||
}`} | ||
></div> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.