-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Wait for Bitcoin funding transaction (#262)
Closes: #255 We want to initiate the stake when we are sure the BTC funding transaction is visible by Bitcoin node. The default implementation of minting in tbtc-v2 throws an error when the deposit tx is unavailable. In our SDK, we make sure the deposit transaction is available and then initiate minting/staking. Here we add the back off mechanism - the SDK retires the function that looks for a deposit transaction a `retries` number of times. The result will return the function's return value if no exceptions are thrown. In our case, we want to try to find the deposit transaction 5 times with a 5 seconds backoff step that will be increased exponentially for subsequent retry attempts. If it fails after 6 tries it will throw an error. The consumer (dapp) can override these options by passing them to `stake` function.
- Loading branch information
Showing
5 changed files
with
132 additions
and
15 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
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 @@ | ||
import { backoffRetrier } from "@keep-network/tbtc-v2.ts" | ||
|
||
type BackoffRetrierParameters = Parameters<typeof backoffRetrier> | ||
|
||
export { backoffRetrier, BackoffRetrierParameters } |
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export * from "./hex" | ||
export * from "./ethereum-signer" | ||
export * from "./backoff" |
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