Skip to content

Commit da4346a

Browse files
committed
Merge branch 'reworkSetupFromTestUtils'
2 parents 4b891f7 + d43221a commit da4346a

File tree

17 files changed

+1064
-210
lines changed

17 files changed

+1064
-210
lines changed

README.md

Lines changed: 12 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -9,93 +9,32 @@ The BSV Wallet Toolbox builds on the [SDK](https://bitcoin-sv.github.io/ts-sdk)
99

1010
# Table of Contents
1111

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)
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)
1919

2020
## Objective
2121

2222
The BSV Wallet Toolbox Project aims to support building sophisticated applications and services on the BSV Blockchain technology stack.
2323

2424
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.
2525

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-
9226
## Documentation
9327

9428
[The Docs](https://bitcoin-sv.github.io/wallet-toolbox) are available here on Github pages.
9529
[Example code](https://docs.bsvblockchain.org/guides/sdks/ts/examples) is available over on our gitbook.
9630

9731
The Toolbox is richly documented with code-level annotations. This should show up well within editors like VSCode.
9832

33+
34+
## Features & Deliverables
35+
36+
- **Feature1**: Summary of feature1.
37+
9938
## Contribution Guidelines
10039

10140
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
12160
The license for the code in this repository is the Open BSV License. Refer to [LICENSE.txt](./LICENSE.txt) for the license text.
12261

12362
Thank you for being a part of the BSV Blockchain Libraries Project. Let's build the future of BSV Blockchain together!
124-

client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@bsv/wallet-toolbox-client",
3-
"version": "1.1.2",
3+
"version": "1.1.3",
44
"description": "Client only Wallet Storage",
55
"main": "./out/src/index.client.js",
66
"types": "./out/src/index.client.d.ts",

docs/README.md

Lines changed: 69 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,77 @@
22

33
The documentation is split into various pages, each covering a set of related functionality. The pages are as follows:
44

5-
- [Wallet](./wallet.md)
6-
- [Client](./client.md)
7-
- [Storage](./storage.md)
8-
- [Services](./services.md)
9-
- [Monitor](./monitor.md)
5+
- [Getting Started](#getting-started) -
6+
- [Wallet](./wallet.md)
7+
- [Client](./client.md)
8+
- [Storage](./storage.md)
9+
- [Services](./services.md)
10+
- [Monitor](./monitor.md)
1011

1112
## Swagger
1213

1314
[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.
1415

15-
- [Wallet JSON API Swagger](https://bitcoin-sv.github.io/ts-sdk/swagger)
16+
- [Wallet JSON API Swagger](https://bitcoin-sv.github.io/ts-sdk/swagger)
17+
18+
## Getting Started
19+
20+
### Installation
21+
22+
To install the toolbox, run:
23+
24+
```bash
25+
npm install @bsv/wallet-toolbox
26+
```
27+
28+
### Basic Usage
29+
30+
Here's a simple example of using the toolbox to create and fund a testnet wallet using SQLite for persistent storage:
31+
32+
```ts
33+
import { InternalizeActionArgs, PrivateKey, Utils } from '@bsv/sdk'
34+
import { Setup } from '@bsv/wallet-toolbox'
35+
36+
const rootKeyHex = PrivateKey.fromRandom().toString()
37+
console.log(`MAKE A SECURE COPY OF YOUR WALLET PRIVATE ROOT KEY: ${rootKeyHex}`)
38+
39+
const { wallet } = await Setup.createSQLiteWallet({
40+
filePath: './myTestWallet.sqlite',
41+
databaseName: 'myTestWallet',
42+
chain: 'test',
43+
rootKeyHex
44+
})
45+
46+
// Obtain a Wallet Payment for your new wallet from a testnet funding faucet.
47+
// Update or replace the values in the following example object with your actual funding payment.
48+
// Note that the values below will not be accepted as they are not intended for your new wallet.
49+
const r = {
50+
senderIdentityKey: '03ac2d10bdb0023f4145cc2eba2fcd2ad3070cb2107b0b48170c46a9440e4cc3fe',
51+
vout: 0,
52+
txid: '942f094cee517276182e5857369ea53d64763a327d433489312a9606db188dfb',
53+
derivationPrefix: 'jSlU588BWkw=',
54+
derivationSuffix: 'l37vv/Bn4Lw=',
55+
atomicBEEF: '01010101942f094cee517...a914b29d56273f6c1df90cd8f383c8117680f2bdd05188ac00000000'
56+
}
57+
58+
const args: InternalizeActionArgs = {
59+
tx: Utils.toArray(r.atomicBEEF, 'hex'),
60+
outputs: [
61+
{
62+
outputIndex: r.vout,
63+
protocol: 'wallet payment',
64+
paymentRemittance: {
65+
derivationPrefix: r.derivationPrefix,
66+
derivationSuffix: r.derivationSuffix,
67+
senderIdentityKey: r.senderIdentityKey
68+
}
69+
}
70+
],
71+
description: 'from faucet'
72+
}
73+
74+
const rw = await wallet.internalizeAction(args)
75+
console.log(rw.accepted)
76+
```
77+
78+
For a more detailed tutorial and advanced examples, check our [Documentation](#documentation).

0 commit comments

Comments
 (0)