Skip to content

Commit

Permalink
Merge branch 'main' into total-assets-additional-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nkuba authored May 8, 2024
2 parents c5e767e + a327646 commit d26bea6
Show file tree
Hide file tree
Showing 46 changed files with 1,690 additions and 604 deletions.
3 changes: 3 additions & 0 deletions dapp/src/acre-react/contexts/AcreSdkContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import React, { useCallback, useMemo, useState } from "react"
import { LedgerLiveEthereumSigner } from "#/web3"
import { Acre, EthereumNetwork } from "@acre-btc/sdk"

const TBTC_API_ENDPOINT = import.meta.env.VITE_TBTC_API_ENDPOINT

type AcreSdkContextValue = {
acre?: Acre
init: (ethereumAddress: string, network: EthereumNetwork) => Promise<void>
Expand All @@ -25,6 +27,7 @@ export function AcreSdkProvider({ children }: { children: React.ReactNode }) {
const sdk = await Acre.initializeEthereum(
await LedgerLiveEthereumSigner.fromAddress(ethereumAddress),
network,
TBTC_API_ENDPOINT,
)
setAcre(sdk)
setIsInitialized(true)
Expand Down
4 changes: 0 additions & 4 deletions dapp/src/acre-react/hooks/useStakeFlow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { useCallback, useState } from "react"
import {
StakeInitialization,
EthereumAddress,
DepositorProxy,
DepositReceipt,
} from "@acre-btc/sdk"
import { useAcreContext } from "./useAcreContext"
Expand All @@ -12,7 +11,6 @@ export type UseStakeFlowReturn = {
bitcoinRecoveryAddress: string,
ethereumAddress: string,
referral: number,
depositor?: DepositorProxy,
) => Promise<void>
btcAddress?: string
depositReceipt?: DepositReceipt
Expand All @@ -36,15 +34,13 @@ export function useStakeFlow(): UseStakeFlowReturn {
bitcoinRecoveryAddress: string,
ethereumAddress: string,
referral: number,
depositor?: DepositorProxy,
) => {
if (!acre || !isInitialized) throw new Error("Acre SDK not defined")

const initializedStakeFlow = await acre.staking.initializeStake(
bitcoinRecoveryAddress,
EthereumAddress.from(ethereumAddress),
referral,
depositor,
)

const btcDepositAddress = await initializedStakeFlow.getBitcoinAddress()
Expand Down
303 changes: 303 additions & 0 deletions dapp/src/assets/icons/BoostArrowIcon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,303 @@
import React from "react"
import { createIcon } from "@chakra-ui/react"

export const BoostArrowIcon = createIcon({
displayName: "BoostArrow",
viewBox: "0 0 230 300",
defaultProps: { w: 230, h: 300 },
path: [
<path fill="url(#a)" d="M80 181h22.667v119H80z" />,
<path fill="url(#b)" d="M110.667 198h22.667v102h-22.667z" />,
<path fill="url(#c)" d="M141.333 203H164v97h-22.667z" />,
<path
fill="#000"
fillOpacity=".6"
stroke="#231F20"
strokeLinejoin="round"
strokeWidth="8"
d="M100.898 34.707a4 4 0 0 0-1.073.898l-54.418 64.807a4 4 0 0 0 5.053 6.042l21.213-12.168a4 4 0 0 0 1.073-.897l54.419-64.807a4 4 0 0 0-5.053-6.042z"
/>,
<path
fill="#000"
fillOpacity=".6"
stroke="#231F20"
strokeLinejoin="round"
strokeWidth="8"
d="M46.48 99.514a4.003 4.003 0 0 0-1.074.898c-1.095 1.304-1.39 2.828-1.405 3.996-.015 1.191.249 2.344.628 3.343.724 1.907 2.19 4.059 4.422 5.248a4 4 0 0 0 3.872-.059l21.213-12.168a4 4 0 0 0-.11-7 1.311 1.311 0 0 1-.282-.28 2.872 2.872 0 0 1-.475-.902 4.001 4.001 0 0 0-5.577-5.243z"
/>,
<path
fill="#000"
fillOpacity=".6"
stroke="#231F20"
strokeLinejoin="round"
strokeWidth="8"
d="M48.942 105.999a4 4 0 0 0 .109 7l24.924 13.287a4 4 0 0 0 3.872-.06l21.213-12.167a4 4 0 0 0-.109-7L74.028 93.772a4 4 0 0 0-3.872.06z"
/>,
<path
fill="#000"
fillOpacity=".6"
stroke="#231F20"
strokeLinejoin="round"
strokeWidth="8"
d="M73.866 119.287a3.999 3.999 0 0 0 .1 6.995.953.953 0 0 1 .147.128c.109.11.233.266.348.457.116.191.202.383.257.553.057.173.065.274.066.293a4.001 4.001 0 0 0 5.988 3.351l21.213-12.167a3.999 3.999 0 0 0 2.008-3.588c-.052-1.758-.672-3.425-1.473-4.748-.795-1.315-1.991-2.661-3.569-3.502a4 4 0 0 0-3.871.06z"
/>,
<path
fill="#000"
fillOpacity=".6"
stroke="#231F20"
strokeLinejoin="round"
strokeWidth="8"
d="M76.791 124.125a4.002 4.002 0 0 0-2.008 3.589l1.283 43.306a4 4 0 0 0 5.989 3.351l21.213-12.168a3.999 3.999 0 0 0 2.008-3.588l-1.283-43.306a4.001 4.001 0 0 0-5.989-3.351z"
/>,
<path
fill="#000"
fillOpacity=".6"
stroke="#231F20"
strokeLinejoin="round"
strokeWidth="8"
d="M78.074 167.431a4 4 0 0 0-2.008 3.588c.052 1.758.673 3.425 1.473 4.748.795 1.315 1.992 2.661 3.57 3.502a4.002 4.002 0 0 0 3.871-.06l21.213-12.168a4 4 0 0 0-.1-6.995c-.003-.002-.057-.037-.146-.128a2.721 2.721 0 0 1-.606-1.01 1.182 1.182 0 0 1-.065-.293 4 4 0 0 0-5.989-3.351z"
/>,
<path
fill="#000"
fillOpacity=".6"
stroke="#231F20"
strokeLinejoin="round"
strokeWidth="8"
d="M81 172.269a4 4 0 0 0 .109 6.999l57.947 30.893a4 4 0 0 0 3.872-.059l21.213-12.168a3.999 3.999 0 0 0-.108-6.999l-57.948-30.893a4 4 0 0 0-3.872.06z"
/>,
<path
fill="#000"
fillOpacity=".6"
stroke="#231F20"
strokeLinejoin="round"
strokeWidth="8"
d="M138.947 203.162a4.001 4.001 0 0 0 .109 7c1.455.776 3.559 1.241 5.591.173l.128-.07 21.213-12.168a4 4 0 0 0-2.574-7.428 4.002 4.002 0 0 0-3.253.326z"
/>,
<path
fill="#817863"
stroke="#231F20"
strokeLinejoin="round"
strokeWidth="8"
d="M139.706 204.24a4 4 0 0 0 4.941 6.095 4.92 4.92 0 0 0 .286-.161l21.01-12.051c2.366-1.293 2.988-3.783 2.934-5.601a4.001 4.001 0 0 0-5.988-3.351l-21.214 12.167a4.003 4.003 0 0 0-1.969 2.902Z"
/>,
<path
fill="#817863"
stroke="#231F20"
strokeLinejoin="round"
strokeWidth="8"
d="M139.668 204.927a4 4 0 0 0 5.988 3.351l21.213-12.167a4.003 4.003 0 0 0 2.009-3.589l-1.284-43.306a4 4 0 0 0-5.988-3.351l-21.213 12.168a3.999 3.999 0 0 0-2.008 3.588z"
/>,
<path
fill="#817863"
stroke="#231F20"
strokeLinejoin="round"
strokeWidth="8"
d="M138.384 161.621a4.001 4.001 0 0 0 5.989 3.351l21.213-12.167a3.999 3.999 0 0 0 1.976-2.953 4 4 0 0 0-5.138-5.939l-21.213 12.167-.056.033c-2.242 1.334-2.823 3.734-2.771 5.508Z"
/>,
<path
fill="#000"
fillOpacity=".6"
stroke="#231F20"
strokeLinejoin="round"
strokeWidth="8"
d="M141.156 156.113a4 4 0 0 0 2.743 7.377 4.002 4.002 0 0 0 3.202-.342l21.213-12.168a4 4 0 0 0-.108-6.999c-1.51-.805-3.727-1.271-5.801-.057l-21.127 12.118c-.041.023-.082.046-.122.071Z"
/>,
<path
fill="#000"
fillOpacity=".6"
stroke="#231F20"
strokeLinejoin="round"
strokeWidth="8"
d="M143.12 156.208a4 4 0 0 0 .109 7l24.923 13.287a4 4 0 0 0 3.872-.06l21.213-12.167a4 4 0 0 0-.108-7l-24.924-13.287a4 4 0 0 0-3.872.06z"
/>,
<path
fill="#000"
fillOpacity=".6"
stroke="#231F20"
strokeLinejoin="round"
strokeWidth="8"
d="M168.044 169.495a4.001 4.001 0 0 0 .108 7c1.461.779 3.528 1.237 5.535.208.056-.028.111-.058.166-.09l21.213-12.167a4 4 0 0 0-2.528-7.434 4 4 0 0 0-3.281.316z"
/>,
<path
fill="#89806B"
stroke="#231F20"
strokeLinejoin="round"
strokeWidth="8"
d="m174.041 176.505 20.967-12.027c2.018-1.09 2.779-3.098 2.936-4.65.164-1.625-.222-3.285-.935-4.779a4 4 0 0 0-5.6-1.747l-21.214 12.167a4 4 0 0 0-1.619 5.193l.055.122a4 4 0 0 0 5.056 5.919 6 6 0 0 0 .354-.198Z"
/>,
<path
fill="#89806B"
stroke="#231F20"
strokeLinejoin="round"
strokeWidth="8"
d="M168.575 170.662a4 4 0 0 0 5.6 1.747l21.214-12.167a4 4 0 0 0 1.619-5.193L136.94 29.207a3.998 3.998 0 0 0-5.6-1.747l-21.213 12.167a4 4 0 0 0-1.62 5.193z"
/>,
<path
fill="#89806B"
stroke="#231F20"
strokeLinejoin="round"
strokeWidth="8"
d="M108.507 44.82a4.001 4.001 0 0 0 5.6 1.747L135.321 34.4a4 4 0 0 0 1.619-5.193c-1.314-2.753-3.264-5.054-5.476-6.515-2.054-1.356-5.249-2.51-8.306-.95-.059.03-.116.061-.173.094l-21.213 12.167a4 4 0 0 0 3.44 7.198c.124.042.33.136.631.335.854.564 1.898 1.678 2.664 3.284Zm-3.436-3.651c-.001-.002.015-.002.048.005-.032 0-.048-.004-.048-.005Z"
/>,
<path
fill="#000"
fillOpacity=".6"
stroke="#231F20"
strokeLinejoin="round"
strokeWidth="8"
d="m122.691 22.004-20.853 11.961a6.798 6.798 0 0 0-2.013 1.64 4 4 0 0 0 5.053 6.042l21.213-12.168a4 4 0 0 0 .931-.737 4 4 0 0 0-3.864-7c-.16.082-.315.17-.467.262Z"
/>,
<path
fill="#000"
fillOpacity=".6"
fillRule="evenodd"
d="m102.889 38.177-54.42 64.807 21.214-12.167 54.419-64.807z"
clipRule="evenodd"
/>,
<path
fill="#000"
fillOpacity=".6"
fillRule="evenodd"
d="M48.47 102.984c-1.26 1.5.169 5.263 2.462 6.486l21.214-12.168c-2.294-1.222-3.723-4.985-2.463-6.486z"
clipRule="evenodd"
/>,
<path
fill="#000"
fillOpacity=".6"
fillRule="evenodd"
d="m50.933 109.469 24.923 13.288 21.214-12.168-24.924-13.287z"
clipRule="evenodd"
/>,
<path
fill="#000"
fillOpacity=".6"
fillRule="evenodd"
d="M75.856 122.756c1.562.833 2.871 2.999 2.926 4.838l21.213-12.167c-.054-1.84-1.364-4.006-2.925-4.838zM78.781 127.595l1.283 43.306 21.214-12.167-1.284-43.306z"
clipRule="evenodd"
/>,
<path
fill="#000"
fillOpacity=".6"
fillRule="evenodd"
d="M80.065 170.901c.054 1.839 1.364 4.006 2.925 4.838l21.213-12.167c-1.561-.833-2.871-2.999-2.925-4.839z"
clipRule="evenodd"
/>,
<path
fill="#000"
fillOpacity=".6"
fillRule="evenodd"
d="m82.99 175.739 57.948 30.893 21.213-12.168-57.948-30.893zM140.938 206.632c.718.383 1.364.417 1.847.163l21.213-12.168c-.483.255-1.129.221-1.847-.162z"
clipRule="evenodd"
/>,
<path
fill="#817863"
fillRule="evenodd"
d="M142.785 206.795c.567-.298.91-.994.881-1.987l21.213-12.167c.029.993-.313 1.688-.881 1.986z"
clipRule="evenodd"
/>,
<path
fill="#817863"
fillRule="evenodd"
d="m143.666 204.808-1.283-43.306 21.213-12.167 1.283 43.306z"
clipRule="evenodd"
/>,
<path
fill="#817863"
fillRule="evenodd"
d="M142.383 161.502c-.029-.956.288-1.636.818-1.952l21.213-12.167c-.53.315-.847.995-.818 1.952z"
clipRule="evenodd"
/>,
<path
fill="#000"
fillOpacity=".6"
fillRule="evenodd"
d="M143.201 159.55c.489-.291 1.16-.272 1.91.128l21.213-12.168c-.749-.399-1.42-.419-1.91-.127z"
clipRule="evenodd"
/>,
<path
fill="#000"
fillOpacity=".6"
fillRule="evenodd"
d="m145.11 159.678 24.924 13.288 21.213-12.168-24.923-13.287z"
clipRule="evenodd"
/>,
<path
fill="#000"
fillOpacity=".6"
fillRule="evenodd"
d="M170.034 172.965c.734.391 1.361.418 1.829.179l21.213-12.168c-.468.24-1.095.213-1.829-.178z"
clipRule="evenodd"
/>,
<path
fill="url(#d)"
fillRule="evenodd"
d="M104.576 37.209c2.373-.39 5.685 1.999 7.541 5.888l60.068 125.842h.001c.909 1.907.689 3.565-.215 4.141l-.109.063a.533.533 0 0 0 .041-.022l.039-.022.029-.019 21.105-12.104c.993-.51 1.268-2.223.323-4.205l-.001.001L133.33 30.93c-2.08-4.359-5.988-6.832-8.355-5.625l-.003.002a2.71 2.71 0 0 0-.221.127l-20.989 12.039.003-.002-.003.002a2.796 2.796 0 0 0-.874.704z"
clipRule="evenodd"
/>,
<path
fill="url(#e)"
d="m102.888 38.176-54.419 64.807c-1.26 1.501.17 5.263 2.463 6.486l24.924 13.287c1.561.833 2.871 2.999 2.925 4.839l1.284 43.306c.054 1.839 1.364 4.005 2.925 4.838l57.948 30.893c1.561.832 2.782.015 2.728-1.824l-1.284-43.306c-.054-1.84 1.167-2.657 2.728-1.825l24.924 13.288c2.293 1.222 3.542-1.113 2.152-4.026L112.118 43.097c-2.365-4.953-7.088-7.471-9.23-4.92"
/>,
<path
fill="#231F20"
d="M39.058 15.639c.316-.885 1.568-.885 1.884 0l3.107 8.706a1 1 0 0 0 .606.606l8.706 3.107c.886.316.886 1.568 0 1.884l-8.706 3.107a1 1 0 0 0-.606.606l-3.107 8.706c-.316.886-1.568.886-1.884 0l-3.107-8.706a1 1 0 0 0-.606-.606l-8.706-3.107c-.886-.316-.886-1.568 0-1.884l8.706-3.107a1 1 0 0 0 .606-.606zM192.058 2.639c.316-.886 1.568-.886 1.884 0l3.107 8.706c.101.282.324.505.606.606l8.706 3.107c.886.316.886 1.568 0 1.884l-8.706 3.107c-.282.101-.505.323-.606.606l-3.107 8.706c-.316.886-1.568.886-1.884 0l-3.107-8.706a1.002 1.002 0 0 0-.606-.606l-8.706-3.107c-.886-.316-.886-1.568 0-1.884l8.706-3.107c.282-.101.505-.324.606-.606zM51.058 180.639c.316-.886 1.568-.886 1.884 0l3.107 8.706c.101.282.324.505.606.606l8.706 3.107c.885.316.885 1.568 0 1.884l-8.706 3.107a1.002 1.002 0 0 0-.606.606l-3.107 8.706c-.316.886-1.568.886-1.884 0l-3.107-8.706a1.002 1.002 0 0 0-.606-.606l-8.706-3.107c-.886-.316-.886-1.568 0-1.884l8.706-3.107c.282-.101.505-.324.606-.606zM214.058 98.639c.316-.885 1.568-.885 1.884 0l1.003 2.81a1 1 0 0 0 .606.606l2.81 1.003c.886.316.886 1.568 0 1.884l-2.81 1.003a1 1 0 0 0-.606.606l-1.003 2.81c-.316.886-1.568.886-1.884 0l-1.003-2.81a1 1 0 0 0-.606-.606l-2.81-1.003c-.886-.316-.886-1.568 0-1.884l2.81-1.003a1 1 0 0 0 .606-.606zM12.058 120.639c.316-.886 1.568-.886 1.884 0l2.318 6.495a1 1 0 0 0 .606.606l6.495 2.318c.886.316.886 1.568 0 1.884l-6.495 2.318a1 1 0 0 0-.606.606l-2.318 6.495c-.316.886-1.568.886-1.884 0l-2.318-6.495a1 1 0 0 0-.606-.606l-6.495-2.318c-.886-.316-.886-1.568 0-1.884l6.495-2.318a1 1 0 0 0 .606-.606zM216.058 180.639c.316-.886 1.568-.886 1.884 0l2.318 6.495a1 1 0 0 0 .606.606l6.495 2.318c.886.316.886 1.568 0 1.884l-6.495 2.318a1 1 0 0 0-.606.606l-2.318 6.495c-.316.886-1.568.886-1.884 0l-2.318-6.495a1 1 0 0 0-.606-.606l-6.495-2.318c-.886-.316-.886-1.568 0-1.884l6.495-2.318a1 1 0 0 0 .606-.606z"
/>,
<defs>
<linearGradient
id="a"
x1="91.333"
x2="91.333"
y1="181"
y2="300"
gradientUnits="userSpaceOnUse"
>
<stop stopColor="#999489" />
<stop offset=".659" stopColor="#FFF7E5" stopOpacity="0" />
</linearGradient>
<linearGradient
id="b"
x1="122"
x2="122"
y1="198"
y2="300"
gradientUnits="userSpaceOnUse"
>
<stop stopColor="#999489" />
<stop offset=".6" stopColor="#FFF7E5" stopOpacity="0" />
</linearGradient>
<linearGradient
id="c"
x1="152.666"
x2="152.666"
y1="203"
y2="300"
gradientUnits="userSpaceOnUse"
>
<stop stopColor="#999489" />
<stop offset=".801" stopColor="#FFF7E5" stopOpacity="0" />
</linearGradient>
<linearGradient
id="d"
x1="116.254"
x2="179.386"
y1="32"
y2="159.487"
gradientUnits="userSpaceOnUse"
>
<stop stopColor="#fff" />
<stop offset=".21" stopColor="#89846B" />
</linearGradient>
<linearGradient
id="e"
x1="110.384"
x2="110.384"
y1="37.167"
y2="128"
gradientUnits="userSpaceOnUse"
>
<stop stopColor="#fff" />
<stop offset="1" stopColor="#FFF8E6" />
</linearGradient>
</defs>,
],
})
1 change: 1 addition & 0 deletions dapp/src/assets/icons/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ export * from "./LoadingSpinnerSuccessIcon"
export * from "./BitcoinIcon"
export * from "./EthereumIcon"
export * from "./CableWithPlugIcon"
export * from "./BoostArrowIcon"
4 changes: 2 additions & 2 deletions dapp/src/components/shared/CurrencyBalance/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import {
getCurrencyByType,
numberToLocaleString,
} from "#/utils"
import { CurrencyType } from "#/types"
import { CurrencyType, AmountType } from "#/types"

export type CurrencyBalanceProps = {
currency: CurrencyType
amount?: string | number | bigint
amount?: AmountType
shouldBeFormatted?: boolean
desiredDecimals?: number
size?: string
Expand Down
27 changes: 27 additions & 0 deletions dapp/src/components/shared/IconTag.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import React from "react"
import { Tag, TagLeftIcon, TagLabel, TagProps, Icon } from "@chakra-ui/react"

type IconTagProps = TagProps & {
icon: typeof Icon
}

export default function IconTag(props: IconTagProps) {
const { children, icon, ...restProps } = props

return (
<Tag
borderWidth={0}
bg="gold.400"
fontSize="sm"
lineHeight={5}
fontWeight="bold"
pl={0}
py={2}
color="grey.700"
{...restProps}
>
<TagLeftIcon as={icon} w={12} h={12} mr={2} my={-4} role="presentation" />
<TagLabel>{children}</TagLabel>
</Tag>
)
}
Loading

0 comments on commit d26bea6

Please sign in to comment.