@bsv/wallet-toolbox 1.1.2 → 1.1.4
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/README.md +12 -74
- package/docs/README.md +70 -6
- package/docs/client.md +401 -54
- package/docs/monitor.md +1 -2
- package/docs/setup.md +510 -0
- package/docs/storage.md +6 -8
- package/docs/wallet.md +401 -54
- package/out/src/Setup.d.ts +57 -0
- package/out/src/Setup.d.ts.map +1 -0
- package/out/src/Setup.js +88 -0
- package/out/src/Setup.js.map +1 -0
- package/out/src/SetupClient.d.ts +125 -0
- package/out/src/SetupClient.d.ts.map +1 -0
- package/out/src/SetupClient.js +222 -0
- package/out/src/SetupClient.js.map +1 -0
- package/out/src/Wallet.d.ts +10 -0
- package/out/src/Wallet.d.ts.map +1 -1
- package/out/src/Wallet.js.map +1 -1
- package/out/src/index.all.d.ts +2 -0
- package/out/src/index.all.d.ts.map +1 -1
- package/out/src/index.all.js +4 -1
- package/out/src/index.all.js.map +1 -1
- package/out/src/index.client.d.ts +1 -0
- package/out/src/index.client.d.ts.map +1 -1
- package/out/src/index.client.js +3 -1
- package/out/src/index.client.js.map +1 -1
- package/out/src/index.d.ts +0 -1
- package/out/src/index.d.ts.map +1 -1
- package/out/src/index.js +0 -24
- package/out/src/index.js.map +1 -1
- package/out/src/sdk/types.d.ts +5 -0
- package/out/src/sdk/types.d.ts.map +1 -1
- package/out/src/sdk/types.js.map +1 -1
- package/out/src/services/chaintracker/__tests/ChaintracksChainTracker.test.js +14 -11
- package/out/src/services/chaintracker/__tests/ChaintracksChainTracker.test.js.map +1 -1
- package/out/test/examples/README.man.test.js +9 -8
- package/out/test/examples/README.man.test.js.map +1 -1
- package/out/test/utils/TestUtilsWalletStorage.d.ts +11 -2
- package/out/test/utils/TestUtilsWalletStorage.d.ts.map +1 -1
- package/out/test/utils/TestUtilsWalletStorage.js +13 -4
- package/out/test/utils/TestUtilsWalletStorage.js.map +1 -1
- package/out/test/wallet/list/listActions2.test.js +121 -155
- package/out/test/wallet/list/listActions2.test.js.map +1 -1
- package/out/tsconfig.all.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/Setup.ts +130 -0
- package/src/SetupClient.ts +364 -0
- package/src/Wallet.ts +10 -0
- package/src/index.all.ts +10 -0
- package/src/index.client.ts +1 -0
- package/src/index.ts +0 -1
- package/src/sdk/types.ts +7 -0
- package/src/services/chaintracker/__tests/ChaintracksChainTracker.test.ts +22 -17
- package/test/examples/README.man.test.ts +11 -11
- package/test/utils/TestUtilsWalletStorage.ts +23 -5
- package/test/wallet/list/listActions2.test.ts +119 -173
- package/ts2md.json +6 -0
package/README.md
CHANGED
|
@@ -9,13 +9,13 @@ The BSV Wallet Toolbox builds on the [SDK](https://bitcoin-sv.github.io/ts-sdk)
|
|
|
9
9
|
|
|
10
10
|
# Table of Contents
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
- [Objective](#objective)
|
|
13
|
+
- [Getting Started](#getting-started)
|
|
14
|
+
- [Features \& Deliverables](#features--deliverables)
|
|
15
|
+
- [Documentation](#documentation)
|
|
16
|
+
- [Contribution Guidelines](#contribution-guidelines)
|
|
17
|
+
- [Support \& Contacts](#support--contacts)
|
|
18
|
+
- [License](#license)
|
|
19
19
|
|
|
20
20
|
## Objective
|
|
21
21
|
|
|
@@ -23,72 +23,6 @@ The BSV Wallet Toolbox Project aims to support building sophisticated applicatio
|
|
|
23
23
|
|
|
24
24
|
By providing interlocking building blocks for persistent storage and protocol based key derivation, it serves as an essential toolbox for developers looking to build on the BSV Blockchain.
|
|
25
25
|
|
|
26
|
-
## Getting Started
|
|
27
|
-
|
|
28
|
-
### Installation
|
|
29
|
-
|
|
30
|
-
To install the toolbox, run:
|
|
31
|
-
|
|
32
|
-
```bash
|
|
33
|
-
npm install @bsv/wallet-toolbox
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
### Basic Usage
|
|
37
|
-
|
|
38
|
-
Here's a simple example of using the toolbox to create and fund a testnet wallet using SQLite for persistent storage:
|
|
39
|
-
|
|
40
|
-
```javascript
|
|
41
|
-
import { InternalizeActionArgs, PrivateKey, Utils } from '@bsv/sdk'
|
|
42
|
-
import { test } from '@bsv/wallet-toolbox'
|
|
43
|
-
|
|
44
|
-
const rootKeyHex = PrivateKey.fromRandom().toString()
|
|
45
|
-
console.log(`MAKE A SECURE COPY OF YOUR WALLET PRIVATE ROOT KEY: ${rootKeyHex}`)
|
|
46
|
-
|
|
47
|
-
const { wallet } = await test._tu.createSQLiteTestWallet({
|
|
48
|
-
filePath: './myTestWallet.sqlite',
|
|
49
|
-
databaseName: 'myTestWallet',
|
|
50
|
-
chain: 'test',
|
|
51
|
-
rootKeyHex
|
|
52
|
-
})
|
|
53
|
-
|
|
54
|
-
// Obtain a Wallet Payment for your new wallet from a testnet funding faucet.
|
|
55
|
-
// Update or replace the values in the following example object with your actual funding payment.
|
|
56
|
-
// Note that the values below will not be accepted as they are not intended for your new wallet.
|
|
57
|
-
const r = {
|
|
58
|
-
senderIdentityKey: '03ac2d10bdb0023f4145cc2eba2fcd2ad3070cb2107b0b48170c46a9440e4cc3fe',
|
|
59
|
-
vout: 0,
|
|
60
|
-
txid: '942f094cee517276182e5857369ea53d64763a327d433489312a9606db188dfb',
|
|
61
|
-
derivationPrefix: 'jSlU588BWkw=',
|
|
62
|
-
derivationSuffix: 'l37vv/Bn4Lw=',
|
|
63
|
-
atomicBEEF: '01010101942f094cee517...a914b29d56273f6c1df90cd8f383c8117680f2bdd05188ac00000000'
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
const args: InternalizeActionArgs = {
|
|
67
|
-
tx: Utils.toArray(r.atomicBEEF, 'hex'),
|
|
68
|
-
outputs: [
|
|
69
|
-
{
|
|
70
|
-
outputIndex: r.vout,
|
|
71
|
-
protocol: 'wallet payment',
|
|
72
|
-
paymentRemittance: {
|
|
73
|
-
derivationPrefix: r.derivationPrefix,
|
|
74
|
-
derivationSuffix: r.derivationSuffix,
|
|
75
|
-
senderIdentityKey: r.senderIdentityKey
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
],
|
|
79
|
-
description: 'from faucet'
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
const rw = await wallet.internalizeAction(args)
|
|
83
|
-
console.log(rw.accepted)
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
For a more detailed tutorial and advanced examples, check our [Documentation](#documentation).
|
|
87
|
-
|
|
88
|
-
## Features & Deliverables
|
|
89
|
-
|
|
90
|
-
- **Feature1**: Summary of feature1.
|
|
91
|
-
|
|
92
26
|
## Documentation
|
|
93
27
|
|
|
94
28
|
[The Docs](https://bitcoin-sv.github.io/wallet-toolbox) are available here on Github pages.
|
|
@@ -96,6 +30,11 @@ For a more detailed tutorial and advanced examples, check our [Documentation](#d
|
|
|
96
30
|
|
|
97
31
|
The Toolbox is richly documented with code-level annotations. This should show up well within editors like VSCode.
|
|
98
32
|
|
|
33
|
+
|
|
34
|
+
## Features & Deliverables
|
|
35
|
+
|
|
36
|
+
- **Feature1**: Summary of feature1.
|
|
37
|
+
|
|
99
38
|
## Contribution Guidelines
|
|
100
39
|
|
|
101
40
|
We're always looking for contributors to help us improve the SDK. Whether it's bug reports, feature requests, or pull requests - all contributions are welcome.
|
|
@@ -121,4 +60,3 @@ For questions, bug reports, or feature requests, please open an issue on GitHub
|
|
|
121
60
|
The license for the code in this repository is the Open BSV License. Refer to [LICENSE.txt](./LICENSE.txt) for the license text.
|
|
122
61
|
|
|
123
62
|
Thank you for being a part of the BSV Blockchain Libraries Project. Let's build the future of BSV Blockchain together!
|
|
124
|
-
|
package/docs/README.md
CHANGED
|
@@ -2,14 +2,78 @@
|
|
|
2
2
|
|
|
3
3
|
The documentation is split into various pages, each covering a set of related functionality. The pages are as follows:
|
|
4
4
|
|
|
5
|
-
- [
|
|
6
|
-
- [
|
|
7
|
-
- [
|
|
8
|
-
- [
|
|
9
|
-
- [
|
|
5
|
+
- [Getting Started](#getting-started) -
|
|
6
|
+
- [Setup](./setup.md) —
|
|
7
|
+
- [Wallet](./wallet.md) —
|
|
8
|
+
- [Client](./client.md) —
|
|
9
|
+
- [Storage](./storage.md) —
|
|
10
|
+
- [Services](./services.md) —
|
|
11
|
+
- [Monitor](./monitor.md) —
|
|
10
12
|
|
|
11
13
|
## Swagger
|
|
12
14
|
|
|
13
15
|
[BRC-100](https://brc.dev/100) defines a Unified, Vendor-Neutral, Unchanging, and Open BSV Blockchain Standard Wallet-to-Application Interface which is implemented in this library within the WalletClient class. The API is laid out here as a swagger openapi document to offer a fast-track to understanding the interface which is implemented across multiple substrates. The JSON api is generally considered a developer friendly introduction to the WalletClient, where an binary equivalent ABI may be preferred for production use cases.
|
|
14
16
|
|
|
15
|
-
- [Wallet JSON API Swagger](https://bitcoin-sv.github.io/ts-sdk/swagger)
|
|
17
|
+
- [Wallet JSON API Swagger](https://bitcoin-sv.github.io/ts-sdk/swagger)
|
|
18
|
+
|
|
19
|
+
## Getting Started
|
|
20
|
+
|
|
21
|
+
### Installation
|
|
22
|
+
|
|
23
|
+
To install the toolbox, run:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npm install @bsv/wallet-toolbox
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Basic Usage
|
|
30
|
+
|
|
31
|
+
Here's a simple example of using the toolbox to create and fund a testnet wallet using SQLite for persistent storage:
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
import { InternalizeActionArgs, PrivateKey, Utils } from '@bsv/sdk'
|
|
35
|
+
import { Setup } from '@bsv/wallet-toolbox'
|
|
36
|
+
|
|
37
|
+
const rootKeyHex = PrivateKey.fromRandom().toString()
|
|
38
|
+
console.log(`MAKE A SECURE COPY OF YOUR WALLET PRIVATE ROOT KEY: ${rootKeyHex}`)
|
|
39
|
+
|
|
40
|
+
const { wallet } = await Setup.createSQLiteWallet({
|
|
41
|
+
filePath: './myTestWallet.sqlite',
|
|
42
|
+
databaseName: 'myTestWallet',
|
|
43
|
+
chain: 'test',
|
|
44
|
+
rootKeyHex
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
// Obtain a Wallet Payment for your new wallet from a testnet funding faucet.
|
|
48
|
+
// Update or replace the values in the following example object with your actual funding payment.
|
|
49
|
+
// Note that the values below will not be accepted as they are not intended for your new wallet.
|
|
50
|
+
const r = {
|
|
51
|
+
senderIdentityKey: '03ac2d10bdb0023f4145cc2eba2fcd2ad3070cb2107b0b48170c46a9440e4cc3fe',
|
|
52
|
+
vout: 0,
|
|
53
|
+
txid: '942f094cee517276182e5857369ea53d64763a327d433489312a9606db188dfb',
|
|
54
|
+
derivationPrefix: 'jSlU588BWkw=',
|
|
55
|
+
derivationSuffix: 'l37vv/Bn4Lw=',
|
|
56
|
+
atomicBEEF: '01010101942f094cee517...a914b29d56273f6c1df90cd8f383c8117680f2bdd05188ac00000000'
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const args: InternalizeActionArgs = {
|
|
60
|
+
tx: Utils.toArray(r.atomicBEEF, 'hex'),
|
|
61
|
+
outputs: [
|
|
62
|
+
{
|
|
63
|
+
outputIndex: r.vout,
|
|
64
|
+
protocol: 'wallet payment',
|
|
65
|
+
paymentRemittance: {
|
|
66
|
+
derivationPrefix: r.derivationPrefix,
|
|
67
|
+
derivationSuffix: r.derivationSuffix,
|
|
68
|
+
senderIdentityKey: r.senderIdentityKey
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
],
|
|
72
|
+
description: 'from faucet'
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const rw = await wallet.internalizeAction(args)
|
|
76
|
+
console.log(rw.accepted)
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
For a more detailed tutorial and advanced examples, check our [Documentation](#documentation).
|