@bigmi/core 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/LICENSE.md +21 -0
- package/README.md +137 -0
- package/dist/cjs/actions/getBalance.d.ts +7 -0
- package/dist/cjs/actions/getBalance.js +11 -0
- package/dist/cjs/actions/getBalance.js.map +1 -0
- package/dist/cjs/actions/getBlock.d.ts +12 -0
- package/dist/cjs/actions/getBlock.js +31 -0
- package/dist/cjs/actions/getBlock.js.map +1 -0
- package/dist/cjs/actions/getBlockCount.d.ts +4 -0
- package/dist/cjs/actions/getBlockCount.js +11 -0
- package/dist/cjs/actions/getBlockCount.js.map +1 -0
- package/dist/cjs/actions/getBlockStats.d.ts +14 -0
- package/dist/cjs/actions/getBlockStats.js +27 -0
- package/dist/cjs/actions/getBlockStats.js.map +1 -0
- package/dist/cjs/actions/getUTXOTransaction.d.ts +9 -0
- package/dist/cjs/actions/getUTXOTransaction.js +24 -0
- package/dist/cjs/actions/getUTXOTransaction.js.map +1 -0
- package/dist/cjs/actions/sendUTXOTransaction.d.ts +8 -0
- package/dist/cjs/actions/sendUTXOTransaction.js +15 -0
- package/dist/cjs/actions/sendUTXOTransaction.js.map +1 -0
- package/dist/cjs/actions/signPsbt.d.ts +3 -0
- package/dist/cjs/actions/signPsbt.js +11 -0
- package/dist/cjs/actions/signPsbt.js.map +1 -0
- package/dist/cjs/actions/waitForTransaction.d.ts +32 -0
- package/dist/cjs/actions/waitForTransaction.js +185 -0
- package/dist/cjs/actions/waitForTransaction.js.map +1 -0
- package/dist/cjs/actions/watchBlockNumber.d.ts +14 -0
- package/dist/cjs/actions/watchBlockNumber.js +45 -0
- package/dist/cjs/actions/watchBlockNumber.js.map +1 -0
- package/dist/cjs/chains/bitcoin.d.ts +36 -0
- package/dist/cjs/chains/bitcoin.js +21 -0
- package/dist/cjs/chains/bitcoin.js.map +1 -0
- package/dist/cjs/clients/types.d.ts +27 -0
- package/dist/cjs/clients/types.js +3 -0
- package/dist/cjs/clients/types.js.map +1 -0
- package/dist/cjs/decorators/UTXOAPIActions.d.ts +6 -0
- package/dist/cjs/decorators/UTXOAPIActions.js +10 -0
- package/dist/cjs/decorators/UTXOAPIActions.js.map +1 -0
- package/dist/cjs/decorators/UTXOActions.d.ts +10 -0
- package/dist/cjs/decorators/UTXOActions.js +14 -0
- package/dist/cjs/decorators/UTXOActions.js.map +1 -0
- package/dist/cjs/index.d.ts +38 -0
- package/dist/cjs/index.js +58 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/transports/ankr.d.ts +2 -0
- package/dist/cjs/transports/ankr.js +21 -0
- package/dist/cjs/transports/ankr.js.map +1 -0
- package/dist/cjs/transports/blockchair.d.ts +2 -0
- package/dist/cjs/transports/blockchair.js +24 -0
- package/dist/cjs/transports/blockchair.js.map +1 -0
- package/dist/cjs/transports/blockcypher.d.ts +2 -0
- package/dist/cjs/transports/blockcypher.js +21 -0
- package/dist/cjs/transports/blockcypher.js.map +1 -0
- package/dist/cjs/transports/getHttpRpcClient.d.ts +19 -0
- package/dist/cjs/transports/getHttpRpcClient.js +77 -0
- package/dist/cjs/transports/getHttpRpcClient.js.map +1 -0
- package/dist/cjs/transports/getRpcProviderMethods.d.ts +2 -0
- package/dist/cjs/transports/getRpcProviderMethods.js +22 -0
- package/dist/cjs/transports/getRpcProviderMethods.js.map +1 -0
- package/dist/cjs/transports/mempool.d.ts +2 -0
- package/dist/cjs/transports/mempool.js +17 -0
- package/dist/cjs/transports/mempool.js.map +1 -0
- package/dist/cjs/transports/types.d.ts +60 -0
- package/dist/cjs/transports/types.js +3 -0
- package/dist/cjs/transports/types.js.map +1 -0
- package/dist/cjs/transports/utxo.d.ts +6 -0
- package/dist/cjs/transports/utxo.js +56 -0
- package/dist/cjs/transports/utxo.js.map +1 -0
- package/dist/cjs/types/blockStats.d.ts +34 -0
- package/dist/cjs/types/blockStats.js +3 -0
- package/dist/cjs/types/blockStats.js.map +1 -0
- package/dist/cjs/types/transaction.d.ts +41 -0
- package/dist/cjs/types/transaction.js +3 -0
- package/dist/cjs/types/transaction.js.map +1 -0
- package/dist/cjs/utils/cancelTransaction.d.ts +2 -0
- package/dist/cjs/utils/cancelTransaction.js +51 -0
- package/dist/cjs/utils/cancelTransaction.js.map +1 -0
- package/dist/cjs/utils/getUTXOAddress.d.ts +19 -0
- package/dist/cjs/utils/getUTXOAddress.js +120 -0
- package/dist/cjs/utils/getUTXOAddress.js.map +1 -0
- package/dist/cjs/utils/isUTXOAddress.d.ts +2 -0
- package/dist/cjs/utils/isUTXOAddress.js +18 -0
- package/dist/cjs/utils/isUTXOAddress.js.map +1 -0
- package/dist/cjs/utils/modifyFee.d.ts +2 -0
- package/dist/cjs/utils/modifyFee.js +50 -0
- package/dist/cjs/utils/modifyFee.js.map +1 -0
- package/dist/cjs/utils/observe.d.ts +11 -0
- package/dist/cjs/utils/observe.js +48 -0
- package/dist/cjs/utils/observe.js.map +1 -0
- package/dist/cjs/utils/poll.d.ts +9 -0
- package/dist/cjs/utils/poll.js +30 -0
- package/dist/cjs/utils/poll.js.map +1 -0
- package/dist/cjs/utils/sleep.d.ts +1 -0
- package/dist/cjs/utils/sleep.js +9 -0
- package/dist/cjs/utils/sleep.js.map +1 -0
- package/dist/esm/actions/getBalance.d.ts +8 -0
- package/dist/esm/actions/getBalance.js +8 -0
- package/dist/esm/actions/getBalance.js.map +1 -0
- package/dist/esm/actions/getBlock.d.ts +12 -0
- package/dist/esm/actions/getBlock.js +28 -0
- package/dist/esm/actions/getBlock.js.map +1 -0
- package/dist/esm/actions/getBlockCount.d.ts +4 -0
- package/dist/esm/actions/getBlockCount.js +8 -0
- package/dist/esm/actions/getBlockCount.js.map +1 -0
- package/dist/esm/actions/getBlockStats.d.ts +14 -0
- package/dist/esm/actions/getBlockStats.js +24 -0
- package/dist/esm/actions/getBlockStats.js.map +1 -0
- package/dist/esm/actions/getUTXOTransaction.d.ts +11 -0
- package/dist/esm/actions/getUTXOTransaction.js +21 -0
- package/dist/esm/actions/getUTXOTransaction.js.map +1 -0
- package/dist/esm/actions/sendUTXOTransaction.d.ts +10 -0
- package/dist/esm/actions/sendUTXOTransaction.js +12 -0
- package/dist/esm/actions/sendUTXOTransaction.js.map +1 -0
- package/dist/esm/actions/signPsbt.d.ts +3 -0
- package/dist/esm/actions/signPsbt.js +8 -0
- package/dist/esm/actions/signPsbt.js.map +1 -0
- package/dist/esm/actions/waitForTransaction.d.ts +75 -0
- package/dist/esm/actions/waitForTransaction.js +230 -0
- package/dist/esm/actions/waitForTransaction.js.map +1 -0
- package/dist/esm/actions/watchBlockNumber.d.ts +25 -0
- package/dist/esm/actions/watchBlockNumber.js +58 -0
- package/dist/esm/actions/watchBlockNumber.js.map +1 -0
- package/dist/esm/chains/bitcoin.d.ts +36 -0
- package/dist/esm/chains/bitcoin.js +18 -0
- package/dist/esm/chains/bitcoin.js.map +1 -0
- package/dist/esm/clients/types.d.ts +43 -0
- package/dist/esm/clients/types.js +2 -0
- package/dist/esm/clients/types.js.map +1 -0
- package/dist/esm/decorators/UTXOAPIActions.d.ts +6 -0
- package/dist/esm/decorators/UTXOAPIActions.js +7 -0
- package/dist/esm/decorators/UTXOAPIActions.js.map +1 -0
- package/dist/esm/decorators/UTXOActions.d.ts +10 -0
- package/dist/esm/decorators/UTXOActions.js +11 -0
- package/dist/esm/decorators/UTXOActions.js.map +1 -0
- package/dist/esm/index.d.ts +38 -0
- package/dist/esm/index.js +31 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/package.json +1 -0
- package/dist/esm/transports/ankr.d.ts +2 -0
- package/dist/esm/transports/ankr.js +18 -0
- package/dist/esm/transports/ankr.js.map +1 -0
- package/dist/esm/transports/blockchair.d.ts +2 -0
- package/dist/esm/transports/blockchair.js +21 -0
- package/dist/esm/transports/blockchair.js.map +1 -0
- package/dist/esm/transports/blockcypher.d.ts +2 -0
- package/dist/esm/transports/blockcypher.js +18 -0
- package/dist/esm/transports/blockcypher.js.map +1 -0
- package/dist/esm/transports/getHttpRpcClient.d.ts +24 -0
- package/dist/esm/transports/getHttpRpcClient.js +74 -0
- package/dist/esm/transports/getHttpRpcClient.js.map +1 -0
- package/dist/esm/transports/getRpcProviderMethods.d.ts +2 -0
- package/dist/esm/transports/getRpcProviderMethods.js +19 -0
- package/dist/esm/transports/getRpcProviderMethods.js.map +1 -0
- package/dist/esm/transports/mempool.d.ts +2 -0
- package/dist/esm/transports/mempool.js +14 -0
- package/dist/esm/transports/mempool.js.map +1 -0
- package/dist/esm/transports/types.d.ts +60 -0
- package/dist/esm/transports/types.js +2 -0
- package/dist/esm/transports/types.js.map +1 -0
- package/dist/esm/transports/utxo.d.ts +6 -0
- package/dist/esm/transports/utxo.js +53 -0
- package/dist/esm/transports/utxo.js.map +1 -0
- package/dist/esm/types/blockStats.d.ts +34 -0
- package/dist/esm/types/blockStats.js +2 -0
- package/dist/esm/types/blockStats.js.map +1 -0
- package/dist/esm/types/transaction.d.ts +41 -0
- package/dist/esm/types/transaction.js +2 -0
- package/dist/esm/types/transaction.js.map +1 -0
- package/dist/esm/utils/cancelTransaction.d.ts +2 -0
- package/dist/esm/utils/cancelTransaction.js +55 -0
- package/dist/esm/utils/cancelTransaction.js.map +1 -0
- package/dist/esm/utils/getUTXOAddress.d.ts +19 -0
- package/dist/esm/utils/getUTXOAddress.js +116 -0
- package/dist/esm/utils/getUTXOAddress.js.map +1 -0
- package/dist/esm/utils/isUTXOAddress.d.ts +2 -0
- package/dist/esm/utils/isUTXOAddress.js +14 -0
- package/dist/esm/utils/isUTXOAddress.js.map +1 -0
- package/dist/esm/utils/modifyFee.d.ts +2 -0
- package/dist/esm/utils/modifyFee.js +53 -0
- package/dist/esm/utils/modifyFee.js.map +1 -0
- package/dist/esm/utils/observe.d.ts +18 -0
- package/dist/esm/utils/observe.js +51 -0
- package/dist/esm/utils/observe.js.map +1 -0
- package/dist/esm/utils/poll.d.ts +12 -0
- package/dist/esm/utils/poll.js +30 -0
- package/dist/esm/utils/poll.js.map +1 -0
- package/dist/esm/utils/sleep.d.ts +1 -0
- package/dist/esm/utils/sleep.js +6 -0
- package/dist/esm/utils/sleep.js.map +1 -0
- package/dist/types/actions/getBalance.d.ts +9 -0
- package/dist/types/actions/getBalance.d.ts.map +1 -0
- package/dist/types/actions/getBlock.d.ts +13 -0
- package/dist/types/actions/getBlock.d.ts.map +1 -0
- package/dist/types/actions/getBlockCount.d.ts +5 -0
- package/dist/types/actions/getBlockCount.d.ts.map +1 -0
- package/dist/types/actions/getBlockStats.d.ts +15 -0
- package/dist/types/actions/getBlockStats.d.ts.map +1 -0
- package/dist/types/actions/getUTXOTransaction.d.ts +12 -0
- package/dist/types/actions/getUTXOTransaction.d.ts.map +1 -0
- package/dist/types/actions/sendUTXOTransaction.d.ts +11 -0
- package/dist/types/actions/sendUTXOTransaction.d.ts.map +1 -0
- package/dist/types/actions/signPsbt.d.ts +4 -0
- package/dist/types/actions/signPsbt.d.ts.map +1 -0
- package/dist/types/actions/waitForTransaction.d.ts +76 -0
- package/dist/types/actions/waitForTransaction.d.ts.map +1 -0
- package/dist/types/actions/watchBlockNumber.d.ts +26 -0
- package/dist/types/actions/watchBlockNumber.d.ts.map +1 -0
- package/dist/types/chains/bitcoin.d.ts +37 -0
- package/dist/types/chains/bitcoin.d.ts.map +1 -0
- package/dist/types/clients/types.d.ts +44 -0
- package/dist/types/clients/types.d.ts.map +1 -0
- package/dist/types/decorators/UTXOAPIActions.d.ts +7 -0
- package/dist/types/decorators/UTXOAPIActions.d.ts.map +1 -0
- package/dist/types/decorators/UTXOActions.d.ts +11 -0
- package/dist/types/decorators/UTXOActions.d.ts.map +1 -0
- package/dist/types/index.d.ts +39 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/transports/ankr.d.ts +3 -0
- package/dist/types/transports/ankr.d.ts.map +1 -0
- package/dist/types/transports/blockchair.d.ts +3 -0
- package/dist/types/transports/blockchair.d.ts.map +1 -0
- package/dist/types/transports/blockcypher.d.ts +3 -0
- package/dist/types/transports/blockcypher.d.ts.map +1 -0
- package/dist/types/transports/getHttpRpcClient.d.ts +25 -0
- package/dist/types/transports/getHttpRpcClient.d.ts.map +1 -0
- package/dist/types/transports/getRpcProviderMethods.d.ts +3 -0
- package/dist/types/transports/getRpcProviderMethods.d.ts.map +1 -0
- package/dist/types/transports/mempool.d.ts +3 -0
- package/dist/types/transports/mempool.d.ts.map +1 -0
- package/dist/types/transports/types.d.ts +61 -0
- package/dist/types/transports/types.d.ts.map +1 -0
- package/dist/types/transports/utxo.d.ts +7 -0
- package/dist/types/transports/utxo.d.ts.map +1 -0
- package/dist/types/types/blockStats.d.ts +35 -0
- package/dist/types/types/blockStats.d.ts.map +1 -0
- package/dist/types/types/transaction.d.ts +42 -0
- package/dist/types/types/transaction.d.ts.map +1 -0
- package/dist/types/utils/cancelTransaction.d.ts +3 -0
- package/dist/types/utils/cancelTransaction.d.ts.map +1 -0
- package/dist/types/utils/getUTXOAddress.d.ts +20 -0
- package/dist/types/utils/getUTXOAddress.d.ts.map +1 -0
- package/dist/types/utils/isUTXOAddress.d.ts +3 -0
- package/dist/types/utils/isUTXOAddress.d.ts.map +1 -0
- package/dist/types/utils/modifyFee.d.ts +3 -0
- package/dist/types/utils/modifyFee.d.ts.map +1 -0
- package/dist/types/utils/observe.d.ts +19 -0
- package/dist/types/utils/observe.d.ts.map +1 -0
- package/dist/types/utils/poll.d.ts +13 -0
- package/dist/types/utils/poll.d.ts.map +1 -0
- package/dist/types/utils/sleep.d.ts +2 -0
- package/dist/types/utils/sleep.d.ts.map +1 -0
- package/package.json +50 -0
- package/src/actions/getBalance.ts +26 -0
- package/src/actions/getBlock.ts +58 -0
- package/src/actions/getBlockCount.ts +20 -0
- package/src/actions/getBlockStats.ts +55 -0
- package/src/actions/getUTXOTransaction.ts +43 -0
- package/src/actions/sendUTXOTransaction.ts +29 -0
- package/src/actions/signPsbt.ts +23 -0
- package/src/actions/waitForTransaction.ts +387 -0
- package/src/actions/watchBlockNumber.ts +105 -0
- package/src/chains/bitcoin.ts +18 -0
- package/src/clients/types.ts +48 -0
- package/src/decorators/UTXOAPIActions.ts +20 -0
- package/src/decorators/UTXOActions.ts +37 -0
- package/src/index.ts +97 -0
- package/src/transports/ankr.ts +30 -0
- package/src/transports/blockchair.ts +27 -0
- package/src/transports/blockcypher.ts +32 -0
- package/src/transports/getHttpRpcClient.ts +122 -0
- package/src/transports/getRpcProviderMethods.ts +22 -0
- package/src/transports/mempool.ts +34 -0
- package/src/transports/types.ts +71 -0
- package/src/transports/utxo.ts +84 -0
- package/src/types/blockStats.ts +35 -0
- package/src/types/transaction.ts +43 -0
- package/src/utils/cancelTransaction.ts +75 -0
- package/src/utils/getUTXOAddress.ts +148 -0
- package/src/utils/isUTXOAddress.ts +18 -0
- package/src/utils/modifyFee.ts +78 -0
- package/src/utils/observe.ts +81 -0
- package/src/utils/poll.ts +48 -0
- package/src/utils/sleep.ts +5 -0
- package/tsconfig.json +10 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
|
+
|
|
5
|
+
### 0.0.1 (2024-10-15)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* biome checks ([bc348fa](https://github.com/lifinance/bigmi/commit/bc348faad5cec9ddada1a0c82f4d34e68b85c1c4))
|
|
11
|
+
* tsconfig ([bf6ccea](https://github.com/lifinance/bigmi/commit/bf6cceae3a1602b99b4825ee3695b367d5935226))
|
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Bigmi
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
<h1 align="center">Bigmi</h1>
|
|
4
|
+
<p align="center"><strong>TypeScript library and reactive primitives for Bitcoin apps.</strong></p>
|
|
5
|
+
|
|
6
|
+
[](/LICENSE.md)
|
|
7
|
+
[](https://www.npmjs.com/package/@bigmi/core)
|
|
8
|
+
[](https://www.npmjs.com/package/@bigmi/core)
|
|
9
|
+
|
|
10
|
+
</div>
|
|
11
|
+
|
|
12
|
+
**Bigmi** (short for *Bitcoin Is Gonna Make It*) is a TypeScript library that provides reactive primitives for building Bitcoin applications. Bigmi simplifies Bitcoin app development by offering:
|
|
13
|
+
|
|
14
|
+
- Abstractions over the [Bitcoin JSON-RPC API](https://developer.bitcoin.org/reference/rpc/)
|
|
15
|
+
- First-class APIs for interacting with the [Bitcoin](https://bitcoin.design/) network, including sending transactions and tracking with [Replace-By-Fee (RBF)](https://github.com/bitcoin/bips/blob/master/bip-0125.mediawiki) support
|
|
16
|
+
- Connectors for popular Bitcoin wallet extensions
|
|
17
|
+
- TypeScript support
|
|
18
|
+
|
|
19
|
+
Whether you're building a Node.js application or a client-side app, Bigmi provides the tools you need to interact with the Bitcoin.
|
|
20
|
+
|
|
21
|
+
### Packages
|
|
22
|
+
|
|
23
|
+
Bigmi is modularized into several packages, each suited to different use cases:
|
|
24
|
+
|
|
25
|
+
- [@bigmi/core](https://www.npmjs.com/package/@bigmi/core) - Actions, transports, utilities, and other core primitives for Node.js or client-side applications.
|
|
26
|
+
- [@bigmi/react](https://www.npmjs.com/package/@bigmi/react) - Hooks, providers, and other useful primitives for React applications.
|
|
27
|
+
- [@bigmi/client](https://www.npmjs.com/package/@bigmi/client) - Wallet connectors and other tools to connect wallet extensions with Bitcoin applications.
|
|
28
|
+
|
|
29
|
+
## Installation
|
|
30
|
+
|
|
31
|
+
```sh
|
|
32
|
+
pnpm add @bigmi/react
|
|
33
|
+
```
|
|
34
|
+
```sh
|
|
35
|
+
pnpm add @bigmi/core
|
|
36
|
+
```
|
|
37
|
+
```sh
|
|
38
|
+
pnpm add @bigmi/client
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Getting Started
|
|
42
|
+
|
|
43
|
+
Here is an example of a basic usage:
|
|
44
|
+
|
|
45
|
+
```tsx
|
|
46
|
+
import {
|
|
47
|
+
type UTXOAPISchema,
|
|
48
|
+
bitcoin,
|
|
49
|
+
getBalance,
|
|
50
|
+
getBlockCount,
|
|
51
|
+
sendUTXOTransaction,
|
|
52
|
+
utxo,
|
|
53
|
+
waitForTransaction,
|
|
54
|
+
} from '@bigmi/core'
|
|
55
|
+
import { createClient, fallback, rpcSchema } from 'viem'
|
|
56
|
+
|
|
57
|
+
// Create a public client for interactions with the Bitcoin
|
|
58
|
+
const publicClient = createClient({
|
|
59
|
+
chain: bitcoin,
|
|
60
|
+
rpcSchema: rpcSchema<UTXOAPISchema>(),
|
|
61
|
+
transport: fallback([
|
|
62
|
+
utxo('https://api.blockchair.com', {
|
|
63
|
+
key: 'blockchair',
|
|
64
|
+
includeChainToURL: true,
|
|
65
|
+
}),
|
|
66
|
+
utxo('https://rpc.ankr.com/http/btc_blockbook/api/v2', {
|
|
67
|
+
key: 'ankr',
|
|
68
|
+
}),
|
|
69
|
+
utxo('https://api.blockcypher.com/v1/btc/main', {
|
|
70
|
+
key: 'blockcypher',
|
|
71
|
+
}),
|
|
72
|
+
utxo('https://mempool.space/api', {
|
|
73
|
+
key: 'mempool',
|
|
74
|
+
}),
|
|
75
|
+
]),
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
// Define the Bitcoin address you're working with
|
|
79
|
+
const address = 'BITCOIN_ADDRESS';
|
|
80
|
+
|
|
81
|
+
// Fetch the balance of the address
|
|
82
|
+
const balance = await getBalance(publicClient, { address });
|
|
83
|
+
console.log(`Balance for ${address}:`, balance);
|
|
84
|
+
|
|
85
|
+
// Fetch the current block count (height)
|
|
86
|
+
const blockCount = await getBlockCount(publicClient);
|
|
87
|
+
console.log('Current block count:', blockCount);
|
|
88
|
+
|
|
89
|
+
// Prepare the transaction hex (as a string)
|
|
90
|
+
const txHex = 'TRANSACTION_HEX';
|
|
91
|
+
|
|
92
|
+
// Send the transaction to the network
|
|
93
|
+
const txId = await sendUTXOTransaction(publicClient, { hex: txHex });
|
|
94
|
+
console.log('Transaction sent with ID:', txId);
|
|
95
|
+
|
|
96
|
+
// Wait for the transaction to be confirmed
|
|
97
|
+
const transaction = await waitForTransaction(publicClient, {
|
|
98
|
+
txId,
|
|
99
|
+
txHex,
|
|
100
|
+
senderAddress: address,
|
|
101
|
+
onReplaced: (response) => {
|
|
102
|
+
console.log('Transaction replaced due to:', response.reason);
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
console.log('Transaction confirmed:', transaction);
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Examples
|
|
110
|
+
|
|
111
|
+
We are working on examples to showcase Bigmi's capabilities. Stay tuned!
|
|
112
|
+
|
|
113
|
+
In the meantime, explore the [LI.FI Widget](https://github.com/lifinance/widget) and [LI.FI SDK](https://github.com/lifinance/sdk) for inspiration.
|
|
114
|
+
|
|
115
|
+
## Documentation
|
|
116
|
+
|
|
117
|
+
Detailed documentation is coming soon. For now, refer to the source code and type definitions for guidance.
|
|
118
|
+
|
|
119
|
+
## Support
|
|
120
|
+
|
|
121
|
+
If you encounter any issues or have questions, please open an issue.
|
|
122
|
+
|
|
123
|
+
## Contributing
|
|
124
|
+
|
|
125
|
+
We welcome contributions from the community!
|
|
126
|
+
|
|
127
|
+
## Changelog
|
|
128
|
+
|
|
129
|
+
The [changelog](/CHANGELOG.md) is regularly updated to reflect what's changed in each new release.
|
|
130
|
+
|
|
131
|
+
## License
|
|
132
|
+
|
|
133
|
+
This project is licensed under the terms of the [MIT License](/LICENSE.md).
|
|
134
|
+
|
|
135
|
+
## Acknowledgments
|
|
136
|
+
|
|
137
|
+
Bigmi is inspired by the [wevm](https://github.com/wevm) stack. We appreciate the open-source community's contributions to advancing blockchain development.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Account, Chain, Client, Transport } from 'viem';
|
|
2
|
+
import type { UTXOAPISchema } from '../transports/types.js';
|
|
3
|
+
export type GetBalanceParameters = {
|
|
4
|
+
address: string;
|
|
5
|
+
};
|
|
6
|
+
export type GetBalanceReturnType = bigint;
|
|
7
|
+
export declare function getBalance<C extends Chain | undefined, A extends Account | undefined = Account | undefined>(client: Client<Transport, C, A, UTXOAPISchema>, params: GetBalanceParameters): Promise<GetBalanceReturnType>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getBalance = getBalance;
|
|
4
|
+
async function getBalance(client, params) {
|
|
5
|
+
const data = await client.request({
|
|
6
|
+
method: 'getBalance',
|
|
7
|
+
params,
|
|
8
|
+
}, { dedupe: true });
|
|
9
|
+
return data;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=getBalance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getBalance.js","sourceRoot":"","sources":["../../../src/actions/getBalance.ts"],"names":[],"mappings":";;AAUA,gCAeC;AAfM,KAAK,UAAU,UAAU,CAI9B,MAA8C,EAC9C,MAA4B;IAE5B,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,OAAO,CAC/B;QACE,MAAM,EAAE,YAAY;QACpB,MAAM;KACP,EACD,EAAE,MAAM,EAAE,IAAI,EAAE,CACjB,CAAA;IACD,OAAO,IAAI,CAAA;AACb,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Block } from 'bitcoinjs-lib';
|
|
2
|
+
import { type Account, type Chain, type Client, type Transport } from 'viem';
|
|
3
|
+
import type { UTXOSchema } from '../transports/types.js';
|
|
4
|
+
export type GetBlockParameters = {
|
|
5
|
+
blockHash: string;
|
|
6
|
+
blockNumber?: never;
|
|
7
|
+
} | {
|
|
8
|
+
blockHash?: never;
|
|
9
|
+
blockNumber: number;
|
|
10
|
+
};
|
|
11
|
+
export type GetBlockReturnType = Block;
|
|
12
|
+
export declare function getBlock<C extends Chain | undefined, A extends Account | undefined = Account | undefined>(client: Client<Transport, C, A, UTXOSchema>, { blockHash, blockNumber }: GetBlockParameters): Promise<GetBlockReturnType>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getBlock = getBlock;
|
|
4
|
+
const bitcoinjs_lib_1 = require("bitcoinjs-lib");
|
|
5
|
+
const viem_1 = require("viem");
|
|
6
|
+
async function getBlock(client, { blockHash, blockNumber }) {
|
|
7
|
+
let blockHex;
|
|
8
|
+
try {
|
|
9
|
+
let _blockHash = blockHash;
|
|
10
|
+
if (!_blockHash && blockNumber) {
|
|
11
|
+
_blockHash = await client.request({
|
|
12
|
+
method: 'getblockhash',
|
|
13
|
+
params: [blockNumber],
|
|
14
|
+
}, { dedupe: true });
|
|
15
|
+
}
|
|
16
|
+
if (_blockHash) {
|
|
17
|
+
blockHex = await client.request({
|
|
18
|
+
method: 'getblock',
|
|
19
|
+
params: [_blockHash, 0],
|
|
20
|
+
}, { dedupe: true });
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
catch (_error) {
|
|
24
|
+
throw new viem_1.BlockNotFoundError({ blockHash, blockNumber });
|
|
25
|
+
}
|
|
26
|
+
if (!blockHex) {
|
|
27
|
+
throw new viem_1.BlockNotFoundError({ blockHash, blockNumber });
|
|
28
|
+
}
|
|
29
|
+
return bitcoinjs_lib_1.Block.fromHex(blockHex);
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=getBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getBlock.js","sourceRoot":"","sources":["../../../src/actions/getBlock.ts"],"names":[],"mappings":";;AAsBA,4BAmCC;AAzDD,iDAAqC;AACrC,+BAMa;AAeN,KAAK,UAAU,QAAQ,CAI5B,MAA2C,EAC3C,EAAE,SAAS,EAAE,WAAW,EAAsB;IAE9C,IAAI,QAA4B,CAAA;IAChC,IAAI,CAAC;QACH,IAAI,UAAU,GAAG,SAAS,CAAA;QAC1B,IAAI,CAAC,UAAU,IAAI,WAAW,EAAE,CAAC;YAC/B,UAAU,GAAG,MAAM,MAAM,CAAC,OAAO,CAC/B;gBACE,MAAM,EAAE,cAAc;gBACtB,MAAM,EAAE,CAAC,WAAW,CAAC;aACtB,EACD,EAAE,MAAM,EAAE,IAAI,EAAE,CACjB,CAAA;QACH,CAAC;QACD,IAAI,UAAU,EAAE,CAAC;YACf,QAAQ,GAAG,MAAM,MAAM,CAAC,OAAO,CAC7B;gBACE,MAAM,EAAE,UAAU;gBAClB,MAAM,EAAE,CAAC,UAAU,EAAE,CAAC,CAAC;aACxB,EACD,EAAE,MAAM,EAAE,IAAI,EAAE,CACjB,CAAA;QACH,CAAC;IACH,CAAC;IAAC,OAAO,MAAM,EAAE,CAAC;QAChB,MAAM,IAAI,yBAAkB,CAAC,EAAE,SAAS,EAAE,WAAW,EAAW,CAAC,CAAA;IACnE,CAAC;IACD,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,yBAAkB,CAAC,EAAE,SAAS,EAAE,WAAW,EAAW,CAAC,CAAA;IACnE,CAAC;IACD,OAAO,qBAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;AAChC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Account, Chain, Client, Transport } from 'viem';
|
|
2
|
+
import type { UTXOSchema } from '../transports/types.js';
|
|
3
|
+
export type GetBlockCountReturnType = number;
|
|
4
|
+
export declare function getBlockCount<C extends Chain | undefined, A extends Account | undefined = Account | undefined>(client: Client<Transport, C, A, UTXOSchema>): Promise<GetBlockCountReturnType>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getBlockCount = getBlockCount;
|
|
4
|
+
async function getBlockCount(client) {
|
|
5
|
+
const data = await client.request({
|
|
6
|
+
method: 'getblockcount',
|
|
7
|
+
params: [],
|
|
8
|
+
}, { dedupe: true });
|
|
9
|
+
return data;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=getBlockCount.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getBlockCount.js","sourceRoot":"","sources":["../../../src/actions/getBlockCount.ts"],"names":[],"mappings":";;AAKA,sCAcC;AAdM,KAAK,UAAU,aAAa,CAIjC,MAA2C;IAE3C,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,OAAO,CAC/B;QACE,MAAM,EAAE,eAAe;QACvB,MAAM,EAAE,EAAE;KACX,EACD,EAAE,MAAM,EAAE,IAAI,EAAE,CACjB,CAAA;IACD,OAAO,IAAI,CAAA;AACb,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type Account, type Chain, type Client, type Transport } from 'viem';
|
|
2
|
+
import type { UTXOSchema } from '../transports/types.js';
|
|
3
|
+
import type { BlockStats, BlockStatsKeys } from '../types/blockStats.js';
|
|
4
|
+
export type GetBlockStatsParameters = ({
|
|
5
|
+
blockHash: string;
|
|
6
|
+
blockNumber?: never;
|
|
7
|
+
} | {
|
|
8
|
+
blockHash?: never;
|
|
9
|
+
blockNumber: number;
|
|
10
|
+
}) & {
|
|
11
|
+
stats?: Array<BlockStatsKeys>;
|
|
12
|
+
};
|
|
13
|
+
export type GetBlockStatsReturnType = BlockStats;
|
|
14
|
+
export declare function getBlockStats<C extends Chain | undefined, A extends Account | undefined = Account | undefined>(client: Client<Transport, C, A, UTXOSchema>, { blockHash, blockNumber, stats }: GetBlockStatsParameters): Promise<GetBlockStatsReturnType>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getBlockStats = getBlockStats;
|
|
4
|
+
const viem_1 = require("viem");
|
|
5
|
+
async function getBlockStats(client, { blockHash, blockNumber, stats }) {
|
|
6
|
+
const blockHashOrNumber = blockHash || blockNumber;
|
|
7
|
+
if (!blockHashOrNumber) {
|
|
8
|
+
throw new viem_1.BlockNotFoundError({ blockHash, blockNumber });
|
|
9
|
+
}
|
|
10
|
+
try {
|
|
11
|
+
const params = [
|
|
12
|
+
blockHashOrNumber,
|
|
13
|
+
];
|
|
14
|
+
if (stats) {
|
|
15
|
+
params.push(stats);
|
|
16
|
+
}
|
|
17
|
+
const data = await client.request({
|
|
18
|
+
method: 'getblockstats',
|
|
19
|
+
params: params,
|
|
20
|
+
}, { dedupe: true });
|
|
21
|
+
return data;
|
|
22
|
+
}
|
|
23
|
+
catch (_error) {
|
|
24
|
+
throw new viem_1.BlockNotFoundError({ blockHash, blockNumber });
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=getBlockStats.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getBlockStats.js","sourceRoot":"","sources":["../../../src/actions/getBlockStats.ts"],"names":[],"mappings":";;AAyBA,sCA6BC;AAtDD,+BAMa;AAmBN,KAAK,UAAU,aAAa,CAIjC,MAA2C,EAC3C,EAAE,SAAS,EAAE,WAAW,EAAE,KAAK,EAA2B;IAE1D,MAAM,iBAAiB,GAAG,SAAS,IAAI,WAAW,CAAA;IAClD,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACvB,MAAM,IAAI,yBAAkB,CAAC,EAAE,SAAS,EAAE,WAAW,EAAW,CAAC,CAAA;IACnE,CAAC;IACD,IAAI,CAAC;QACH,MAAM,MAAM,GAA8C;YACxD,iBAAiB;SAClB,CAAA;QACD,IAAI,KAAK,EAAE,CAAC;YACV,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACpB,CAAC;QACD,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,OAAO,CAC/B;YACE,MAAM,EAAE,eAAe;YACvB,MAAM,EAAE,MAAM;SACf,EACD,EAAE,MAAM,EAAE,IAAI,EAAE,CACjB,CAAA;QACD,OAAO,IAAI,CAAA;IACb,CAAC;IAAC,OAAO,MAAM,EAAE,CAAC;QAChB,MAAM,IAAI,yBAAkB,CAAC,EAAE,SAAS,EAAE,WAAW,EAAW,CAAC,CAAA;IACnE,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type Account, type Chain, type Client, type Transport } from 'viem';
|
|
2
|
+
import type { UTXOSchema } from '../transports/types.js';
|
|
3
|
+
import type { UTXOTransaction } from '../types/transaction.js';
|
|
4
|
+
export type GetUTXOTransactionParameters = {
|
|
5
|
+
txId: string;
|
|
6
|
+
blockHash?: string;
|
|
7
|
+
};
|
|
8
|
+
export type GetUTXOTransactionReturnType = UTXOTransaction;
|
|
9
|
+
export declare function getUTXOTransaction<C extends Chain | undefined, A extends Account | undefined = Account | undefined>(client: Client<Transport, C, A, UTXOSchema>, { txId, blockHash }: GetUTXOTransactionParameters): Promise<GetUTXOTransactionReturnType>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getUTXOTransaction = getUTXOTransaction;
|
|
4
|
+
const viem_1 = require("viem");
|
|
5
|
+
async function getUTXOTransaction(client, { txId, blockHash }) {
|
|
6
|
+
try {
|
|
7
|
+
const params = [txId, true];
|
|
8
|
+
if (blockHash) {
|
|
9
|
+
params.push(blockHash);
|
|
10
|
+
}
|
|
11
|
+
const data = await client.request({
|
|
12
|
+
method: 'getrawtransaction',
|
|
13
|
+
params: params,
|
|
14
|
+
});
|
|
15
|
+
return data;
|
|
16
|
+
}
|
|
17
|
+
catch (_error) {
|
|
18
|
+
throw new viem_1.TransactionNotFoundError({
|
|
19
|
+
blockHash: blockHash,
|
|
20
|
+
hash: txId,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=getUTXOTransaction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getUTXOTransaction.js","sourceRoot":"","sources":["../../../src/actions/getUTXOTransaction.ts"],"names":[],"mappings":";;AAmBA,gDAuBC;AA1CD,+BAMa;AAaN,KAAK,UAAU,kBAAkB,CAItC,MAA2C,EAC3C,EAAE,IAAI,EAAE,SAAS,EAAgC;IAEjD,IAAI,CAAC;QACH,MAAM,MAAM,GAA+B,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;QACvD,IAAI,SAAS,EAAE,CAAC;YACd,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;QACxB,CAAC;QACD,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC;YAChC,MAAM,EAAE,mBAAmB;YAC3B,MAAM,EAAE,MAAM;SACf,CAAC,CAAA;QACF,OAAO,IAAI,CAAA;IACb,CAAC;IAAC,OAAO,MAAM,EAAE,CAAC;QAChB,MAAM,IAAI,+BAAwB,CAAC;YACjC,SAAS,EAAE,SAAkB;YAC7B,IAAI,EAAE,IAAa;SACpB,CAAC,CAAA;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Account, Chain, Client, Transport } from 'viem';
|
|
2
|
+
import type { UTXOSchema } from '../transports/types.js';
|
|
3
|
+
export type SendUTXOTransactionParameters = {
|
|
4
|
+
hex: string;
|
|
5
|
+
maxFeeRate?: number;
|
|
6
|
+
};
|
|
7
|
+
export type SendUTXOTransactionReturnType = string;
|
|
8
|
+
export declare function sendUTXOTransaction<C extends Chain | undefined, A extends Account | undefined = Account | undefined>(client: Client<Transport, C, A, UTXOSchema>, { hex, maxFeeRate }: SendUTXOTransactionParameters): Promise<SendUTXOTransactionReturnType>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sendUTXOTransaction = sendUTXOTransaction;
|
|
4
|
+
async function sendUTXOTransaction(client, { hex, maxFeeRate }) {
|
|
5
|
+
const params = [hex];
|
|
6
|
+
if (maxFeeRate) {
|
|
7
|
+
params.push(maxFeeRate);
|
|
8
|
+
}
|
|
9
|
+
const data = await client.request({
|
|
10
|
+
method: 'sendrawtransaction',
|
|
11
|
+
params: params,
|
|
12
|
+
});
|
|
13
|
+
return data;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=sendUTXOTransaction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sendUTXOTransaction.js","sourceRoot":"","sources":["../../../src/actions/sendUTXOTransaction.ts"],"names":[],"mappings":";;AAYA,kDAgBC;AAhBM,KAAK,UAAU,mBAAmB,CAIvC,MAA2C,EAC3C,EAAE,GAAG,EAAE,UAAU,EAAiC;IAElD,MAAM,MAAM,GAAsB,CAAC,GAAG,CAAC,CAAA;IACvC,IAAI,UAAU,EAAE,CAAC;QACf,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;IACzB,CAAC;IACD,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC;QAChC,MAAM,EAAE,oBAAoB;QAC5B,MAAM,EAAE,MAAM;KACf,CAAC,CAAA;IACF,OAAO,IAAI,CAAA;AACb,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { Account, Chain, Client, Transport } from 'viem';
|
|
2
|
+
import type { SignPsbtParameters, SignPsbtReturnType, UTXOWalletSchema } from '../clients/types.js';
|
|
3
|
+
export declare function signPsbt<C extends Chain | undefined, A extends Account | undefined = Account | undefined>(client: Client<Transport, C, A, UTXOWalletSchema>, params: SignPsbtParameters): Promise<SignPsbtReturnType>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.signPsbt = signPsbt;
|
|
4
|
+
async function signPsbt(client, params) {
|
|
5
|
+
const data = await client.request({
|
|
6
|
+
method: 'signPsbt',
|
|
7
|
+
params: params,
|
|
8
|
+
}, { dedupe: true });
|
|
9
|
+
return data;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=signPsbt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signPsbt.js","sourceRoot":"","sources":["../../../src/actions/signPsbt.ts"],"names":[],"mappings":";;AAOA,4BAeC;AAfM,KAAK,UAAU,QAAQ,CAI5B,MAAiD,EACjD,MAA0B;IAE1B,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,OAAO,CAC/B;QACE,MAAM,EAAE,UAAU;QAClB,MAAM,EAAE,MAAM;KACf,EACD,EAAE,MAAM,EAAE,IAAI,EAAE,CACjB,CAAA;IACD,OAAO,IAAI,CAAA;AACb,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Transaction } from 'bitcoinjs-lib';
|
|
2
|
+
import { type Chain, type Client, type Transport } from 'viem';
|
|
3
|
+
import type { UTXOTransaction } from '../types/transaction.js';
|
|
4
|
+
export type ReplacementReason = 'cancelled' | 'replaced' | 'repriced';
|
|
5
|
+
export type ReplacementReturnType = {
|
|
6
|
+
reason: ReplacementReason;
|
|
7
|
+
replacedTransaction: Transaction;
|
|
8
|
+
transaction: UTXOTransaction;
|
|
9
|
+
};
|
|
10
|
+
export type WaitForTransactionReceiptReturnType = UTXOTransaction;
|
|
11
|
+
export type WithRetryParameters = {
|
|
12
|
+
delay?: ((config: {
|
|
13
|
+
count: number;
|
|
14
|
+
error: Error;
|
|
15
|
+
}) => number) | number | undefined;
|
|
16
|
+
retryCount?: number | undefined;
|
|
17
|
+
};
|
|
18
|
+
export type WaitForTransactionReceiptParameters = {
|
|
19
|
+
txId: string;
|
|
20
|
+
txHex: string;
|
|
21
|
+
senderAddress?: string;
|
|
22
|
+
confirmations?: number | undefined;
|
|
23
|
+
onReplaced?: ((response: ReplacementReturnType) => void) | undefined;
|
|
24
|
+
pollingInterval?: number | undefined;
|
|
25
|
+
retryCount?: number;
|
|
26
|
+
retryDelay?: ((config: {
|
|
27
|
+
count: number;
|
|
28
|
+
error: Error;
|
|
29
|
+
}) => number) | number;
|
|
30
|
+
timeout?: number | undefined;
|
|
31
|
+
};
|
|
32
|
+
export declare function waitForTransaction<chain extends Chain | undefined>(client: Client<Transport, chain>, { confirmations, txId, txHex, senderAddress, onReplaced, pollingInterval, retryCount, retryDelay, timeout, }: WaitForTransactionReceiptParameters): Promise<WaitForTransactionReceiptReturnType>;
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.waitForTransaction = waitForTransaction;
|
|
4
|
+
const bitcoinjs_lib_1 = require("bitcoinjs-lib");
|
|
5
|
+
const viem_1 = require("viem");
|
|
6
|
+
const utils_1 = require("viem/utils");
|
|
7
|
+
const observe_js_1 = require("../utils/observe.js");
|
|
8
|
+
const getBlock_js_1 = require("./getBlock.js");
|
|
9
|
+
const getBlockStats_js_1 = require("./getBlockStats.js");
|
|
10
|
+
const getUTXOTransaction_js_1 = require("./getUTXOTransaction.js");
|
|
11
|
+
const watchBlockNumber_js_1 = require("./watchBlockNumber.js");
|
|
12
|
+
async function waitForTransaction(client, { confirmations = 1, txId, txHex, senderAddress, onReplaced, pollingInterval = client.pollingInterval, retryCount = 10, retryDelay = 3000, timeout, }) {
|
|
13
|
+
const observerId = (0, viem_1.stringify)(['waitForTransaction', client.uid, txId]);
|
|
14
|
+
let count = 0;
|
|
15
|
+
let transaction;
|
|
16
|
+
let replacedTransaction;
|
|
17
|
+
let retrying = false;
|
|
18
|
+
return new Promise((resolve, reject) => {
|
|
19
|
+
if (timeout) {
|
|
20
|
+
setTimeout(() => reject(new viem_1.WaitForTransactionReceiptTimeoutError({ hash: txId })), timeout);
|
|
21
|
+
}
|
|
22
|
+
const _unobserve = (0, observe_js_1.observe)(observerId, { onReplaced, resolve, reject }, (emit) => {
|
|
23
|
+
const _unwatch = (0, utils_1.getAction)(client, watchBlockNumber_js_1.watchBlockNumber, 'watchBlockNumber')({
|
|
24
|
+
emitMissed: true,
|
|
25
|
+
emitOnBegin: true,
|
|
26
|
+
pollingInterval,
|
|
27
|
+
async onBlockNumber(blockNumber_) {
|
|
28
|
+
const done = (fn) => {
|
|
29
|
+
_unwatch();
|
|
30
|
+
fn();
|
|
31
|
+
_unobserve();
|
|
32
|
+
};
|
|
33
|
+
let blockNumber = blockNumber_;
|
|
34
|
+
if (retrying) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
if (count > retryCount) {
|
|
38
|
+
done(() => emit.reject(new viem_1.WaitForTransactionReceiptTimeoutError({
|
|
39
|
+
hash: txId,
|
|
40
|
+
})));
|
|
41
|
+
}
|
|
42
|
+
try {
|
|
43
|
+
if (transaction?.blockhash) {
|
|
44
|
+
const blockStats = await (0, utils_1.getAction)(client, getBlockStats_js_1.getBlockStats, 'getBlockStats')({
|
|
45
|
+
blockHash: transaction.blockhash,
|
|
46
|
+
stats: ['height'],
|
|
47
|
+
});
|
|
48
|
+
if (confirmations > 1 &&
|
|
49
|
+
(!blockStats.height ||
|
|
50
|
+
blockNumber - blockStats.height + 1 < confirmations)) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
done(() => emit.resolve(transaction));
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
retrying = true;
|
|
57
|
+
transaction = await (0, viem_1.withRetry)(() => (0, utils_1.getAction)(client, getUTXOTransaction_js_1.getUTXOTransaction, 'getUTXOTransaction')({ txId: transaction?.txid || txId }), {
|
|
58
|
+
delay: retryDelay,
|
|
59
|
+
retryCount,
|
|
60
|
+
});
|
|
61
|
+
if (transaction.blockhash) {
|
|
62
|
+
const blockStats = await (0, utils_1.getAction)(client, getBlockStats_js_1.getBlockStats, 'getBlockStats')({
|
|
63
|
+
blockHash: transaction.blockhash,
|
|
64
|
+
stats: ['height'],
|
|
65
|
+
});
|
|
66
|
+
if (blockStats.height) {
|
|
67
|
+
blockNumber = blockStats.height;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
retrying = false;
|
|
71
|
+
if (!transaction?.confirmations) {
|
|
72
|
+
throw new viem_1.TransactionReceiptNotFoundError({
|
|
73
|
+
hash: txId,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
if (transaction.confirmations < confirmations) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
done(() => emit.resolve(transaction));
|
|
80
|
+
}
|
|
81
|
+
catch (err) {
|
|
82
|
+
if (err instanceof viem_1.TransactionNotFoundError ||
|
|
83
|
+
err instanceof viem_1.TransactionReceiptNotFoundError) {
|
|
84
|
+
try {
|
|
85
|
+
replacedTransaction = bitcoinjs_lib_1.Transaction.fromHex(transaction?.hex || txHex);
|
|
86
|
+
retrying = true;
|
|
87
|
+
const block = await (0, viem_1.withRetry)(() => (0, utils_1.getAction)(client, getBlock_js_1.getBlock, 'getBlock')({
|
|
88
|
+
blockNumber,
|
|
89
|
+
}), {
|
|
90
|
+
delay: retryDelay,
|
|
91
|
+
retryCount,
|
|
92
|
+
});
|
|
93
|
+
retrying = false;
|
|
94
|
+
const replacedTransactionInputs = new Set();
|
|
95
|
+
for (const input of replacedTransaction.ins) {
|
|
96
|
+
const txid = Array.from(input.hash)
|
|
97
|
+
.reverse()
|
|
98
|
+
.map((byte) => `00${byte.toString(16)}`.slice(-2))
|
|
99
|
+
.join('');
|
|
100
|
+
const vout = input.index;
|
|
101
|
+
const inputId = `${txid}:${vout}`;
|
|
102
|
+
replacedTransactionInputs.add(inputId);
|
|
103
|
+
}
|
|
104
|
+
let replacementTransaction;
|
|
105
|
+
for (const tx of block.transactions) {
|
|
106
|
+
if (tx.isCoinbase()) {
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
109
|
+
for (const input of tx.ins) {
|
|
110
|
+
const txid = Array.from(input.hash)
|
|
111
|
+
.reverse()
|
|
112
|
+
.map((byte) => `00${byte.toString(16)}`.slice(-2))
|
|
113
|
+
.join('');
|
|
114
|
+
const vout = input.index;
|
|
115
|
+
const inputId = `${txid}:${vout}`;
|
|
116
|
+
if (replacedTransactionInputs.has(inputId)) {
|
|
117
|
+
replacementTransaction = tx;
|
|
118
|
+
break;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
if (replacementTransaction) {
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
if (!replacementTransaction) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
transaction = await (0, utils_1.getAction)(client, getUTXOTransaction_js_1.getUTXOTransaction, 'getUTXOTransaction')({
|
|
129
|
+
txId: replacementTransaction.getId(),
|
|
130
|
+
});
|
|
131
|
+
if (transaction.confirmations &&
|
|
132
|
+
transaction.confirmations < confirmations) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
let reason = 'replaced';
|
|
136
|
+
function getOutputAddresses(tx) {
|
|
137
|
+
const addresses = [];
|
|
138
|
+
for (const output of tx.outs) {
|
|
139
|
+
try {
|
|
140
|
+
const outputAddress = bitcoinjs_lib_1.address.fromOutputScript(output.script);
|
|
141
|
+
addresses.push(outputAddress);
|
|
142
|
+
}
|
|
143
|
+
catch (_e) {
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return addresses;
|
|
147
|
+
}
|
|
148
|
+
const originalOutputAddresses = getOutputAddresses(replacedTransaction);
|
|
149
|
+
const replacementOutputAddresses = getOutputAddresses(replacementTransaction);
|
|
150
|
+
if (originalOutputAddresses.length ===
|
|
151
|
+
replacementOutputAddresses.length &&
|
|
152
|
+
originalOutputAddresses.every((address) => replacementOutputAddresses.includes(address))) {
|
|
153
|
+
reason = 'repriced';
|
|
154
|
+
}
|
|
155
|
+
else if (senderAddress &&
|
|
156
|
+
replacementOutputAddresses.length === 1 &&
|
|
157
|
+
replacementOutputAddresses.includes(senderAddress)) {
|
|
158
|
+
reason = 'cancelled';
|
|
159
|
+
}
|
|
160
|
+
done(() => {
|
|
161
|
+
emit.onReplaced?.({
|
|
162
|
+
reason,
|
|
163
|
+
replacedTransaction: replacedTransaction,
|
|
164
|
+
transaction: transaction,
|
|
165
|
+
});
|
|
166
|
+
emit.resolve(transaction);
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
catch (err_) {
|
|
170
|
+
done(() => emit.reject(err_));
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
done(() => emit.reject(err));
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
finally {
|
|
178
|
+
count++;
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
});
|
|
182
|
+
});
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
//# sourceMappingURL=waitForTransaction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"waitForTransaction.js","sourceRoot":"","sources":["../../../src/actions/waitForTransaction.ts"],"names":[],"mappings":";;AA6FA,gDAqSC;AAlYD,iDAAoD;AACpD,+BASa;AACb,sCAAsC;AAEtC,oDAA6C;AAC7C,+CAAwC;AACxC,yDAAkD;AAClD,mEAA4D;AAC5D,+DAAwD;AA4EjD,KAAK,UAAU,kBAAkB,CACtC,MAAgC,EAChC,EACE,aAAa,GAAG,CAAC,EACjB,IAAI,EACJ,KAAK,EACL,aAAa,EACb,UAAU,EACV,eAAe,GAAG,MAAM,CAAC,eAAe,EACxC,UAAU,GAAG,EAAE,EACf,UAAU,GAAG,IAAK,EAClB,OAAO,GAC6B;IAEtC,MAAM,UAAU,GAAG,IAAA,gBAAS,EAAC,CAAC,oBAAoB,EAAE,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAA;IAEtE,IAAI,KAAK,GAAG,CAAC,CAAA;IACb,IAAI,WAAwC,CAAA;IAC5C,IAAI,mBAA4C,CAAA;IAChD,IAAI,QAAQ,GAAG,KAAK,CAAA;IAEpB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,IAAI,OAAO,EAAE,CAAC;YACZ,UAAU,CACR,GAAG,EAAE,CACH,MAAM,CACJ,IAAI,4CAAqC,CAAC,EAAE,IAAI,EAAE,IAAa,EAAE,CAAC,CACnE,EACH,OAAO,CACR,CAAA;QACH,CAAC;QAED,MAAM,UAAU,GAAG,IAAA,oBAAO,EACxB,UAAU,EACV,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,EAC/B,CAAC,IAAI,EAAE,EAAE;YACP,MAAM,QAAQ,GAAG,IAAA,iBAAS,EAC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