Skip to content

Commit

Permalink
Rename from builtDataStepCallback to dataBuiltStepCallback
Browse files Browse the repository at this point in the history
  • Loading branch information
kkosiorowska committed Nov 4, 2024
1 parent 3fbfbef commit 8ceb6b4
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
6 changes: 3 additions & 3 deletions dapp/src/acre-react/hooks/useInitializeWithdraw.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useCallback } from "react"
import {
BuiltDataStepCallback,
DataBuiltStepCallback,
MessageSignedStepCallback,
OnSignMessageStepCallback,
} from "@acre-btc/sdk/dist/src/lib/redeemer-proxy"
Expand All @@ -12,15 +12,15 @@ export default function useInitializeWithdraw() {
return useCallback(
async (
amount: bigint,
builtDataStepCallback?: BuiltDataStepCallback,
dataBuiltStepCallback?: DataBuiltStepCallback,
onSignMessageStep?: OnSignMessageStepCallback,
messageSignedStep?: MessageSignedStepCallback,
) => {
if (!acre || !isConnected) throw new Error("Account not connected")

return acre.account.initializeWithdrawal(
amount,
builtDataStepCallback,
dataBuiltStepCallback,
onSignMessageStep,
messageSignedStep,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export default function SignMessageModal() {
}
}, [])

const builtDataStepCallback = useCallback(() => {
const dataBuiltStepCallback = useCallback(() => {
setWaitingStatus("built-data")
return Promise.resolve()
}, [])
Expand Down Expand Up @@ -103,7 +103,7 @@ export default function SignMessageModal() {

const { redemptionKey } = await initializeWithdraw(
amount,
builtDataStepCallback,
dataBuiltStepCallback,
onSignMessageCallback,
)

Expand Down
10 changes: 5 additions & 5 deletions sdk/src/lib/redeemer-proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { OrangeKitSdk } from "@orangekit/sdk"
import { AcreContracts } from "./contracts"
import { BitcoinProvider } from "./bitcoin"

export type BuiltDataStepCallback = (safeTxData: Hex) => Promise<void>
export type DataBuiltStepCallback = (safeTxData: Hex) => Promise<void>
export type OnSignMessageStepCallback = (messageToSign: string) => Promise<void>
export type MessageSignedStepCallback = (signedMessage: string) => Promise<void>

Expand All @@ -26,7 +26,7 @@ export default class OrangeKitTbtcRedeemerProxy implements TbtcRedeemerProxy {

#sharesAmount: bigint

#builtDataStepCallback?: BuiltDataStepCallback
#dataBuiltStepCallback?: DataBuiltStepCallback

#onSignMessageStepCallback?: OnSignMessageStepCallback

Expand All @@ -42,7 +42,7 @@ export default class OrangeKitTbtcRedeemerProxy implements TbtcRedeemerProxy {
},
bitcoinProvider: BitcoinProvider,
sharesAmount: bigint,
builtDataStepCallback?: BuiltDataStepCallback,
dataBuiltStepCallback?: DataBuiltStepCallback,
onSignMessageStepCallback?: OnSignMessageStepCallback,
messageSignedStepCallback?: MessageSignedStepCallback,
) {
Expand All @@ -51,7 +51,7 @@ export default class OrangeKitTbtcRedeemerProxy implements TbtcRedeemerProxy {
this.#account = account
this.#bitcoinProvider = bitcoinProvider
this.#sharesAmount = sharesAmount
this.#builtDataStepCallback = builtDataStepCallback
this.#dataBuiltStepCallback = dataBuiltStepCallback
this.#onSignMessageStepCallback = onSignMessageStepCallback
this.#messageSignedStepCallback = messageSignedStepCallback
}
Expand All @@ -66,7 +66,7 @@ export default class OrangeKitTbtcRedeemerProxy implements TbtcRedeemerProxy {
this.#sharesAmount,
redemptionData,
)
await this.#builtDataStepCallback?.(safeTxData)
await this.#dataBuiltStepCallback?.(safeTxData)

const transactionHash = await this.#orangeKitSdk.sendTransaction(
`0x${this.#contracts.stBTC.getChainIdentifier().identifierHex}`,
Expand Down
8 changes: 4 additions & 4 deletions sdk/src/modules/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Tbtc from "./tbtc"
import AcreSubgraphApi from "../lib/api/AcreSubgraphApi"
import { DepositStatus } from "../lib/api/TbtcApi"
import OrangeKitTbtcRedeemerProxy, {
BuiltDataStepCallback,
DataBuiltStepCallback,
MessageSignedStepCallback,
OnSignMessageStepCallback,
} from "../lib/redeemer-proxy"
Expand Down Expand Up @@ -184,7 +184,7 @@ export default class Account {
/**
* Initializes the withdrawal process.
* @param amount Bitcoin amount to withdraw in 1e8 satoshi precision.
* @param builtDataStepCallback A callback triggered after the data
* @param dataBuiltStepCallback A callback triggered after the data
* building step.
* @param onSignMessageStepCallback A callback triggered before the message
* signing step.
Expand All @@ -194,7 +194,7 @@ export default class Account {
*/
async initializeWithdrawal(
btcAmount: bigint,
builtDataStepCallback?: BuiltDataStepCallback,
dataBuiltStepCallback?: DataBuiltStepCallback,
onSignMessageStepCallback?: OnSignMessageStepCallback,
messageSignedStepCallback?: MessageSignedStepCallback,
): Promise<{ transactionHash: string; redemptionKey: string }> {
Expand All @@ -213,7 +213,7 @@ export default class Account {
},
this.#bitcoinProvider,
shares,
builtDataStepCallback,
dataBuiltStepCallback,
onSignMessageStepCallback,
messageSignedStepCallback,
)
Expand Down

0 comments on commit 8ceb6b4

Please sign in to comment.