Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bitcoin native experience #371

Merged
merged 53 commits into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
2d624f4
Add `@orangekit/sdk` dependency
r-czajkowski Apr 18, 2024
7f7cbff
Init the OrangeKit SDK in Acre SDK
r-czajkowski Apr 18, 2024
37a58f8
Update the staking module
r-czajkowski Apr 18, 2024
c7733c9
Add unit test for integration with OrangeKit
r-czajkowski Apr 29, 2024
5b1d724
Merge branch 'main' into bitcoin-native-experience
r-czajkowski May 7, 2024
55ea425
Add `@swan-bitcoin/xpub-lib`
r-czajkowski May 7, 2024
d2027a8
Add `BitcoinProvider` interface
r-czajkowski May 7, 2024
0a80e29
Implement `LedgerLiveWalletApiBitcoinProvider`
r-czajkowski May 7, 2024
260877b
Update the `ethereum-signer` utils in SDK
r-czajkowski May 8, 2024
df7380c
Use `BitcoinProvider` to initialize the Acre SDK
r-czajkowski May 8, 2024
0965b4c
Update staking unit tests
r-czajkowski May 9, 2024
da302d8
Update docs
r-czajkowski May 9, 2024
aac6f6f
Rename variable
r-czajkowski May 9, 2024
d2f3a51
Remove @babel/preset-env
nkuba May 10, 2024
ddfaae4
Use JestConfigWithTsJest type in jest config file
nkuba May 10, 2024
553b5be
Fix Jest and @orangekit/sdk support
nkuba May 10, 2024
a3b16d1
Fix Jest and @orangekit/sdk support (#418)
r-czajkowski May 12, 2024
0614e45
Lock the version of `@swan-bitcoin/xpub-lib` lib
r-czajkowski May 14, 2024
6c2971c
Update constructo parameters names
r-czajkowski May 14, 2024
a48e63b
Update Acre SDK initialization fn
r-czajkowski May 14, 2024
769b1ba
Simplify custom ethereum signer utils
r-czajkowski May 14, 2024
c6dfc24
Avoid skipping `import/prefer-default-export` rule
r-czajkowski May 14, 2024
ce33d42
Add docs for bitcoin provider interfaces
r-czajkowski May 14, 2024
1a84644
Update the `Network` type in Ledger Live Provider
r-czajkowski May 14, 2024
14f572d
Update `@swan-bitcoin/xpub-lib` declaration types
r-czajkowski May 14, 2024
32ebcef
Rename variable
r-czajkowski May 14, 2024
4f0a13a
Merge branch 'main' into bitcoin-native-experience
r-czajkowski May 14, 2024
8bdb895
Fix linting errors
r-czajkowski May 14, 2024
855dc38
Update the docs in Ledger Live Bitcoin Provider
r-czajkowski May 14, 2024
3df3cf7
Update `getAddress` fn
r-czajkowski May 14, 2024
097cac2
Update `getAddress` fn in Ledger Live provider
r-czajkowski May 15, 2024
196b94f
Leave TODO in `LedgerLiveWalletApiBitcoinProvider`
r-czajkowski May 15, 2024
46ed33f
Remove Ethereum account from the wallet context
r-czajkowski Apr 24, 2024
315b545
Initialize the Acre SDK w/o Ethereum address
r-czajkowski Apr 24, 2024
bb91477
Init the Acre SDK in dapp w/o ethereum address
r-czajkowski May 8, 2024
9fb193c
Update Acre SDK initialization in dapp
r-czajkowski May 15, 2024
3cdb91e
Remove unused ethers signer for Ledger Live
r-czajkowski May 15, 2024
6499c9a
Mock `@orangekit/sdk` to run jest test
r-czajkowski May 15, 2024
4f05fe8
Fix formatting error
r-czajkowski May 15, 2024
c90a92d
Remove Ethereum account from wallet context (#379)
nkuba May 15, 2024
18170eb
Merge branch 'main' into bitcoin-native-experience
r-czajkowski May 15, 2024
30526c7
Fix `useInitializeAcreSdk` hook
r-czajkowski May 15, 2024
f351fa4
Rename variable
r-czajkowski May 16, 2024
a51688e
Update docs
r-czajkowski May 16, 2024
56aa212
Update `IEthereumSignerCompatibleWithEthersV5`
r-czajkowski May 16, 2024
c6228a7
Add unit tests for Ledger Live Wallet Api Provider
r-czajkowski May 21, 2024
34d8350
Merge branch 'main' into bitcoin-native-experience
r-czajkowski May 21, 2024
9c1c45b
Merge branch 'main' into bitcoin-native-experience
r-czajkowski May 29, 2024
37db599
Simplify the bitcoin network type in SDK
r-czajkowski May 29, 2024
60a2bf5
Simplify the the Acre initialization function
r-czajkowski May 29, 2024
219127e
Rename variables
r-czajkowski May 29, 2024
f0fecf0
Leave a `TODO` in the `BitcoinProvider` interface
r-czajkowski May 29, 2024
60c1231
Merge branch 'main' into bitcoin-native-experience
nkuba May 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 5 additions & 18 deletions dapp/src/acre-react/hooks/useStakeFlow.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
import { useCallback, useState } from "react"
import {
StakeInitialization,
EthereumAddress,
DepositReceipt,
} from "@acre-btc/sdk"
import { StakeInitialization, DepositReceipt } from "@acre-btc/sdk"
import { useAcreContext } from "./useAcreContext"

export type UseStakeFlowReturn = {
initStake: (
bitcoinRecoveryAddress: string,
ethereumAddress: string,
referral: number,
) => Promise<void>
initStake: (bitcoinAddress: string, referral: number) => Promise<void>
nkuba marked this conversation as resolved.
Show resolved Hide resolved
btcAddress?: string
depositReceipt?: DepositReceipt
signMessage: () => Promise<void>
Expand All @@ -30,16 +22,11 @@ export function useStakeFlow(): UseStakeFlowReturn {
>(undefined)

const initStake = useCallback(
async (
bitcoinRecoveryAddress: string,
ethereumAddress: string,
referral: number,
) => {
async (bitcoinAddress: string, referral: number) => {
if (!acre || !isInitialized) throw new Error("Acre SDK not defined")

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

Expand All @@ -58,7 +45,7 @@ export function useStakeFlow(): UseStakeFlowReturn {
const signMessage = useCallback(async () => {
if (!stakeFlow) throw new Error("Initialize stake first")

await stakeFlow.signMessage()
await Promise.resolve(stakeFlow.signMessage())
nkuba marked this conversation as resolved.
Show resolved Hide resolved
}, [stakeFlow])

const stake = useCallback(async () => {
Expand Down
3 changes: 1 addition & 2 deletions dapp/src/components/Layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from "react"
import React, { useState } from "react"
import { AnimatePresence, motion, Variants } from "framer-motion"
import { useState } from "react"
import { useLocation, useOutlet } from "react-router-dom"
import DocsDrawer from "./DocsDrawer"
import Header from "./Header"
Expand Down
182 changes: 182 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion sdk/jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import type { JestConfigWithTsJest } from "ts-jest"

const jestConfig: JestConfigWithTsJest = {
preset: "ts-jest",
preset: "ts-jest/presets/js-with-ts",
testPathIgnorePatterns: ["<rootDir>/dist/", "<rootDir>/node_modules/"],
transformIgnorePatterns: ["/node_modules/(?!@orangekit/sdk)/"],
}

export default jestConfig
3 changes: 3 additions & 0 deletions sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
"dependencies": {
"@acre-btc/contracts": "workspace:*",
"@keep-network/tbtc-v2.ts": "2.4.0-dev.3",
"@ledgerhq/wallet-api-client": "^1.5.0",
"@orangekit/sdk": "1.0.0-beta.9",
"@swan-bitcoin/xpub-lib": "0.1.5",
"ethers": "^6.10.0"
}
}
Loading
Loading