@bsv/wallet-toolbox-client 1.1.23 → 1.1.26

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.
@@ -1,7 +1,6 @@
1
1
  export * as sdk from './sdk/index';
2
2
  export * from './utility/index.client';
3
3
  export * from './Wallet';
4
- export { SetupClient } from './SetupClient';
5
4
  export * from './signer/WalletSigner';
6
5
  export * from './storage/index.client';
7
6
  export * from './services/Services';
@@ -1 +1 @@
1
- {"version":3,"file":"index.client.d.ts","sourceRoot":"","sources":["../../../src/index.client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,aAAa,CAAA;AAClC,cAAc,wBAAwB,CAAA;AACtC,cAAc,UAAU,CAAA;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,cAAc,uBAAuB,CAAA;AACrC,cAAc,wBAAwB,CAAA;AACtC,cAAc,qBAAqB,CAAA;AACnC,cAAc,mBAAmB,CAAA"}
1
+ {"version":3,"file":"index.client.d.ts","sourceRoot":"","sources":["../../../src/index.client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,aAAa,CAAA;AAClC,cAAc,wBAAwB,CAAA;AACtC,cAAc,UAAU,CAAA;AACxB,cAAc,uBAAuB,CAAA;AACrC,cAAc,wBAAwB,CAAA;AACtC,cAAc,qBAAqB,CAAA;AACnC,cAAc,mBAAmB,CAAA"}
@@ -36,12 +36,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
36
36
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.SetupClient = exports.sdk = void 0;
39
+ exports.sdk = void 0;
40
40
  exports.sdk = __importStar(require("./sdk/index"));
41
41
  __exportStar(require("./utility/index.client"), exports);
42
42
  __exportStar(require("./Wallet"), exports);
43
- var SetupClient_1 = require("./SetupClient");
44
- Object.defineProperty(exports, "SetupClient", { enumerable: true, get: function () { return SetupClient_1.SetupClient; } });
45
43
  __exportStar(require("./signer/WalletSigner"), exports);
46
44
  __exportStar(require("./storage/index.client"), exports);
47
45
  __exportStar(require("./services/Services"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.client.js","sourceRoot":"","sources":["../../../src/index.client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAAkC;AAClC,yDAAsC;AACtC,2CAAwB;AACxB,6CAA2C;AAAlC,0GAAA,WAAW,OAAA;AACpB,wDAAqC;AACrC,yDAAsC;AACtC,sDAAmC;AACnC,oDAAiC"}
1
+ {"version":3,"file":"index.client.js","sourceRoot":"","sources":["../../../src/index.client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAAkC;AAClC,yDAAsC;AACtC,2CAAwB;AACxB,wDAAqC;AACrC,yDAAsC;AACtC,sDAAmC;AACnC,oDAAiC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bsv/wallet-toolbox-client",
3
- "version": "1.1.23",
3
+ "version": "1.1.26",
4
4
  "description": "Client only Wallet Storage",
5
5
  "main": "./out/src/index.client.js",
6
6
  "types": "./out/src/index.client.d.ts",
@@ -1,263 +0,0 @@
1
- import { BEEF, CreateActionOptions, CreateActionOutput, CreateActionResult, KeyDeriver, LockingScript, PrivateKey, PublicKey, WalletInterface } from '@bsv/sdk';
2
- import { Monitor, sdk, Services, Wallet, WalletStorageManager } from './index.client';
3
- /**
4
- * The `SetupClient` class provides static setup functions to construct BRC-100 compatible
5
- * wallets in a variety of configurations.
6
- *
7
- * It serves as a starting point for experimentation and customization.
8
- *
9
- * `SetupClient` references only browser compatible code including storage via `StorageClient`.
10
- * `Setup` extends `SetupClient` adding database storage via `Knex` and `StorageKnex`.
11
- *
12
- */
13
- export declare abstract class SetupClient {
14
- /**
15
- * @param chain
16
- * @returns true if .env is not valid for chain
17
- */
18
- static noEnv(chain: sdk.Chain): boolean;
19
- /**
20
- * Creates content for .env file with some private keys, identity keys, sample API keys, and sample MySQL connection string.
21
- *
22
- * Two new, random private keys are generated each time, with their associated public identity keys.
23
- *
24
- * Loading secrets from a .env file is intended only for experimentation and getting started.
25
- * Private keys should never be included directly in your source code.
26
- *
27
- * @publicbody
28
- */
29
- static makeEnv(): string;
30
- /**
31
- * Reads a .env file of the format created by `makeEnv`.
32
- *
33
- * Returns values for designated `chain`.
34
- *
35
- * Access private keys through the `devKeys` object: `devKeys[identityKey]`
36
- *
37
- * @param chain Which chain to use: 'test' or 'main'
38
- * @returns {SetupEnv} with configuration environment secrets used by `Setup` functions.
39
- *
40
- * @publicbody
41
- */
42
- static getEnv(chain: sdk.Chain): SetupEnv;
43
- /**
44
- * Create a `Wallet`. Storage can optionally be provided or configured later.
45
- *
46
- * The following components are configured: KeyDeriver, WalletStorageManager, WalletService, WalletStorage.
47
- * Optionally, PrivilegedKeyManager is also configured.
48
- *
49
- * @publicbody
50
- */
51
- static createWallet(args: SetupWalletArgs): Promise<SetupWallet>;
52
- /**
53
- * Setup a new `Wallet` without requiring a .env file.
54
- *
55
- * @param args.chain - 'main' or 'test'
56
- * @param args.rootKeyHex - Root private key for wallet's key deriver.
57
- * @param args.storageUrl - Optional. `StorageClient` and `chain` compatible endpoint URL.
58
- * @param args.privilegedKeyGetter - Optional. Method that will return the privileged `PrivateKey`, on demand.
59
- */
60
- static createWalletClientNoEnv(args: {
61
- chain: sdk.Chain;
62
- rootKeyHex: string;
63
- storageUrl?: string;
64
- privilegedKeyGetter?: () => Promise<PrivateKey>;
65
- }): Promise<Wallet>;
66
- /**
67
- * @publicbody
68
- */
69
- static createWalletClient(args: SetupWalletClientArgs): Promise<SetupWalletClient>;
70
- /**
71
- * @publicbody
72
- */
73
- static getKeyPair(priv?: string | PrivateKey): KeyPairAddress;
74
- /**
75
- * @publicbody
76
- */
77
- static getLockP2PKH(address: string): LockingScript;
78
- /**
79
- * @publicbody
80
- */
81
- static getUnlockP2PKH(priv: PrivateKey, satoshis: number): sdk.ScriptTemplateUnlock;
82
- /**
83
- * @publicbody
84
- */
85
- static createP2PKHOutputs(outputs: {
86
- address: string;
87
- satoshis: number;
88
- outputDescription?: string;
89
- basket?: string;
90
- tags?: string[];
91
- }[]): CreateActionOutput[];
92
- /**
93
- * @publicbody
94
- */
95
- static createP2PKHOutputsAction(wallet: WalletInterface, outputs: {
96
- address: string;
97
- satoshis: number;
98
- outputDescription?: string;
99
- basket?: string;
100
- tags?: string[];
101
- }[], options?: CreateActionOptions): Promise<{
102
- cr: CreateActionResult;
103
- outpoints: string[] | undefined;
104
- }>;
105
- /**
106
- * @publicbody
107
- */
108
- static fundWalletFromP2PKHOutpoints(wallet: WalletInterface, outpoints: string[], p2pkhKey: KeyPairAddress, inputBEEF?: BEEF): Promise<void>;
109
- }
110
- /**
111
- * A private key and associated public key and address.
112
- */
113
- export interface KeyPairAddress {
114
- privateKey: PrivateKey;
115
- publicKey: PublicKey;
116
- address: string;
117
- }
118
- /**
119
- * `SetupEnv` provides a starting point for managing secrets that
120
- * must not appear in source code.
121
- *
122
- * The `makeEnv` and `getEnv` functions of the `Setup` and `SetupClient` classes
123
- * provide an easy way to create and import these secrets and related properties.
124
- */
125
- export interface SetupEnv {
126
- /**
127
- * The chan being accessed: 'main' for mainnet, 'test' for 'testnet'.
128
- */
129
- chain: sdk.Chain;
130
- /**
131
- * The user's primary identity key (public key).
132
- */
133
- identityKey: string;
134
- /**
135
- * A secondary identity key (public key), used to test exchanges with other users.
136
- */
137
- identityKey2: string;
138
- /**
139
- * Filepath to sqlite file to be used for identityKey wallet.
140
- */
141
- filePath: string | undefined;
142
- /**
143
- * A vaild TAAL API key for use by `Services`
144
- */
145
- taalApiKey: string;
146
- /**
147
- * A map of public keys (identity keys, hex strings) to private keys (hex strings).
148
- */
149
- devKeys: Record<string, string>;
150
- /**
151
- * A MySQL connection string including user and password properties.
152
- * Must be valid to make use of MySQL `Setup` class support.
153
- */
154
- mySQLConnection: string;
155
- }
156
- /**
157
- * Arguments used by `createWallet` to construct a `SetupWallet`.
158
- *
159
- * Extension `SetupWalletClientArgs` used by `createWalletClient` to construct a `SetupWalletClient`.
160
- *
161
- * Extension `SetupWalletKnexArgs` used by `createWalletKnex` to construct a `SetupWalletKnex`.
162
- *
163
- * Extension `SetupWalletMySQLArgs` used by `createWalletMySQL` to construct a `SetupWalletKnex`.
164
- *
165
- * Extension `SetupWalletSQLiteArgs` used by `createWalletSQLite` to construct a `SetupWalletKnex`.
166
- */
167
- export interface SetupWalletArgs {
168
- /**
169
- * Configuration "secrets" typically obtained by `Setup.makeEnv` and `Setup.getEnv` functions.
170
- */
171
- env: SetupEnv;
172
- /**
173
- * Optional. The non-privileged private key used to initialize the `KeyDeriver` and determine the `identityKey`.
174
- * Defaults to `env.devKeys[env.identityKey]
175
- */
176
- rootKeyHex?: string;
177
- /**
178
- * Optional. The privileged private key getter used to initialize the `PrivilegedKeyManager`.
179
- * Defaults to undefined.
180
- */
181
- privilegedKeyGetter?: () => Promise<PrivateKey>;
182
- /**
183
- * Optional. Active wallet storage. Can be added later.
184
- */
185
- active?: sdk.WalletStorageProvider;
186
- /**
187
- * Optional. One or more storage providers managed as backup destinations. Can be added later.
188
- */
189
- backups?: sdk.WalletStorageProvider[];
190
- }
191
- /**
192
- * When creating a BRC-100 compatible `Wallet`, many components come into play.
193
- *
194
- * All of the `createWallet` functions in the `Setup` and `SetupClient` classes return
195
- * an object with direct access to each component to facilitate experimentation, testing
196
- * and customization.
197
- */
198
- export interface SetupWallet {
199
- /**
200
- * The rootKey of the `KeyDeriver`. The private key from which other keys are derived.
201
- */
202
- rootKey: PrivateKey;
203
- /**
204
- * The pubilc key associated with the `rootKey` which also serves as the wallet's identity.
205
- */
206
- identityKey: string;
207
- /**
208
- * The `KeyDeriver` component used by the wallet for key derivation and cryptographic functions.
209
- */
210
- keyDeriver: KeyDeriver;
211
- /**
212
- * The chain ('main' or 'test') which the wallet accesses.
213
- */
214
- chain: sdk.Chain;
215
- /**
216
- * The `WalletStorageManager` that manages all the configured storage providers (active and backups)
217
- * accessed by the wallet.
218
- */
219
- storage: WalletStorageManager;
220
- /**
221
- * The network `Services` component which provides the wallet with access to external services hosted
222
- * on the public network.
223
- */
224
- services: Services;
225
- /**
226
- * The background task `Monitor` component available to the wallet to offload tasks
227
- * that speed up wallet operations and maintain data integrity.
228
- */
229
- monitor: Monitor;
230
- /**
231
- * The actual BRC-100 `Wallet` to which all the other properties and components contribute.
232
- *
233
- * Note that internally, the wallet is itself linked to all these properties and components.
234
- * They are included in this interface to facilitate access after wallet construction for
235
- * experimentation, testing and customization. Any changes made to the configuration of these
236
- * components after construction may disrupt the normal operation of the wallet.
237
- */
238
- wallet: Wallet;
239
- }
240
- /**
241
- * Extension `SetupWalletClientArgs` of `SetupWalletArgs` is used by `createWalletClient`
242
- * to construct a `SetupWalletClient`.
243
- */
244
- export interface SetupWalletClientArgs extends SetupWalletArgs {
245
- /**
246
- * The endpoint URL of a service hosting the `StorageServer` JSON-RPC service to
247
- * which a `StorageClient` instance should connect to function as
248
- * the active storage provider of the newly created wallet.
249
- */
250
- endpointUrl?: string;
251
- }
252
- /**
253
- * Extension `SetupWalletClient` of `SetupWallet` is returned by `createWalletClient`
254
- */
255
- export interface SetupWalletClient extends SetupWallet {
256
- /**
257
- * The endpoint URL of the service hosting the `StorageServer` JSON-RPC service to
258
- * which a `StorageClient` instance is connected to function as
259
- * the active storage provider of the wallet.
260
- */
261
- endpointUrl: string;
262
- }
263
- //# sourceMappingURL=SetupClient.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SetupClient.d.ts","sourceRoot":"","sources":["../../../src/SetupClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EAEJ,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,UAAU,EACV,aAAa,EAEb,UAAU,EACV,SAAS,EACT,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;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,GAAG,EAAE,QAAQ,CAAA;IACb;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;;OAGG;IACH,mBAAmB,CAAC,EAAE,MAAM,OAAO,CAAC,UAAU,CAAC,CAAA;IAC/C;;OAEG;IACH,MAAM,CAAC,EAAE,GAAG,CAAC,qBAAqB,CAAA;IAClC;;OAEG;IACH,OAAO,CAAC,EAAE,GAAG,CAAC,qBAAqB,EAAE,CAAA;CACtC;AAED;;;;;;GAMG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,OAAO,EAAE,UAAU,CAAA;IACnB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAA;IACnB;;OAEG;IACH,UAAU,EAAE,UAAU,CAAA;IACtB;;OAEG;IACH,KAAK,EAAE,GAAG,CAAC,KAAK,CAAA;IAChB;;;OAGG;IACH,OAAO,EAAE,oBAAoB,CAAA;IAC7B;;;OAGG;IACH,QAAQ,EAAE,QAAQ,CAAA;IAClB;;;OAGG;IACH,OAAO,EAAE,OAAO,CAAA;IAChB;;;;;;;OAOG;IACH,MAAM,EAAE,MAAM,CAAA;CACf;AAED;;;GAGG;AACH,MAAM,WAAW,qBAAsB,SAAQ,eAAe;IAC5D;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAkB,SAAQ,WAAW;IACpD;;;;OAIG;IACH,WAAW,EAAE,MAAM,CAAA;CACpB"}
@@ -1,316 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.SetupClient = void 0;
37
- const sdk_1 = require("@bsv/sdk");
38
- const index_client_1 = require("./index.client");
39
- const dotenv = __importStar(require("dotenv"));
40
- dotenv.config();
41
- /**
42
- * The `SetupClient` class provides static setup functions to construct BRC-100 compatible
43
- * wallets in a variety of configurations.
44
- *
45
- * It serves as a starting point for experimentation and customization.
46
- *
47
- * `SetupClient` references only browser compatible code including storage via `StorageClient`.
48
- * `Setup` extends `SetupClient` adding database storage via `Knex` and `StorageKnex`.
49
- *
50
- */
51
- class SetupClient {
52
- /**
53
- * @param chain
54
- * @returns true if .env is not valid for chain
55
- */
56
- static noEnv(chain) {
57
- try {
58
- SetupClient.getEnv(chain);
59
- return false;
60
- }
61
- catch (_a) {
62
- return true;
63
- }
64
- }
65
- /**
66
- * Creates content for .env file with some private keys, identity keys, sample API keys, and sample MySQL connection string.
67
- *
68
- * Two new, random private keys are generated each time, with their associated public identity keys.
69
- *
70
- * Loading secrets from a .env file is intended only for experimentation and getting started.
71
- * Private keys should never be included directly in your source code.
72
- *
73
- * @publicbody
74
- */
75
- static makeEnv() {
76
- const testPrivKey1 = sdk_1.PrivateKey.fromRandom();
77
- const testIdentityKey1 = testPrivKey1.toPublicKey().toString();
78
- const testPrivKey2 = sdk_1.PrivateKey.fromRandom();
79
- const testIdentityKey2 = testPrivKey2.toPublicKey().toString();
80
- const mainPrivKey1 = sdk_1.PrivateKey.fromRandom();
81
- const mainIdentityKey1 = mainPrivKey1.toPublicKey().toString();
82
- const mainPrivKey2 = sdk_1.PrivateKey.fromRandom();
83
- const mainIdentityKey2 = mainPrivKey2.toPublicKey().toString();
84
- const log = `
85
- # .env file template for working with wallet-toolbox Setup functions.
86
- MY_TEST_IDENTITY = '${testIdentityKey1}'
87
- MY_TEST_IDENTITY2 = '${testIdentityKey2}'
88
- MY_MAIN_IDENTITY = '${mainIdentityKey1}'
89
- MY_MAIN_IDENTITY2 = '${mainIdentityKey2}'
90
- MAIN_TAAL_API_KEY='mainnet_9596de07e92300c6287e4393594ae39c'
91
- TEST_TAAL_API_KEY='testnet_0e6cf72133b43ea2d7861da2a38684e3'
92
- MYSQL_CONNECTION='{"port":3306,"host":"127.0.0.1","user":"root","password":"your_password","database":"your_database", "timezone": "Z"}'
93
- DEV_KEYS = '{
94
- "${testIdentityKey1}": "${testPrivKey1.toString()}",
95
- "${testIdentityKey2}": "${testPrivKey2.toString()}",
96
- "${mainIdentityKey1}": "${mainPrivKey1.toString()}",
97
- "${mainIdentityKey2}": "${mainPrivKey2.toString()}"
98
- }'
99
- `;
100
- console.log(log);
101
- return log;
102
- }
103
- /**
104
- * Reads a .env file of the format created by `makeEnv`.
105
- *
106
- * Returns values for designated `chain`.
107
- *
108
- * Access private keys through the `devKeys` object: `devKeys[identityKey]`
109
- *
110
- * @param chain Which chain to use: 'test' or 'main'
111
- * @returns {SetupEnv} with configuration environment secrets used by `Setup` functions.
112
- *
113
- * @publicbody
114
- */
115
- static getEnv(chain) {
116
- // Identity keys of the lead maintainer of this repo...
117
- const identityKey = chain === 'main'
118
- ? process.env.MY_MAIN_IDENTITY
119
- : process.env.MY_TEST_IDENTITY;
120
- const identityKey2 = chain === 'main'
121
- ? process.env.MY_MAIN_IDENTITY2
122
- : process.env.MY_TEST_IDENTITY2;
123
- const filePath = chain === 'main'
124
- ? process.env.MY_MAIN_FILEPATH
125
- : process.env.MY_TEST_FILEPATH;
126
- const DEV_KEYS = process.env.DEV_KEYS || '{}';
127
- const mySQLConnection = process.env.MYSQL_CONNECTION || '{}';
128
- const taalApiKey = (0, index_client_1.verifyTruthy)(chain === 'main'
129
- ? process.env.MAIN_TAAL_API_KEY
130
- : process.env.TEST_TAAL_API_KEY, `.env value for '${chain.toUpperCase()}_TAAL_API_KEY' is required.`);
131
- if (!identityKey || !identityKey2)
132
- throw new index_client_1.sdk.WERR_INVALID_OPERATION('.env is not a valid SetupEnv configuration.');
133
- return {
134
- chain,
135
- identityKey,
136
- identityKey2,
137
- filePath,
138
- taalApiKey,
139
- devKeys: JSON.parse(DEV_KEYS),
140
- mySQLConnection
141
- };
142
- }
143
- /**
144
- * Create a `Wallet`. Storage can optionally be provided or configured later.
145
- *
146
- * The following components are configured: KeyDeriver, WalletStorageManager, WalletService, WalletStorage.
147
- * Optionally, PrivilegedKeyManager is also configured.
148
- *
149
- * @publicbody
150
- */
151
- static async createWallet(args) {
152
- const chain = args.env.chain;
153
- args.rootKeyHex || (args.rootKeyHex = args.env.devKeys[args.env.identityKey]);
154
- const rootKey = sdk_1.PrivateKey.fromHex(args.rootKeyHex);
155
- const identityKey = rootKey.toPublicKey().toString();
156
- const keyDeriver = new sdk_1.KeyDeriver(rootKey);
157
- const storage = new index_client_1.WalletStorageManager(identityKey, args.active, args.backups);
158
- if (storage.stores.length > 0)
159
- await storage.makeAvailable();
160
- const serviceOptions = index_client_1.Services.createDefaultOptions(chain);
161
- serviceOptions.taalApiKey = args.env.taalApiKey;
162
- const services = new index_client_1.Services(serviceOptions);
163
- const monopts = index_client_1.Monitor.createDefaultWalletMonitorOptions(chain, storage, services);
164
- const monitor = new index_client_1.Monitor(monopts);
165
- monitor.addDefaultTasks();
166
- const privilegedKeyManager = args.privilegedKeyGetter
167
- ? new index_client_1.sdk.PrivilegedKeyManager(args.privilegedKeyGetter)
168
- : undefined;
169
- const wallet = new index_client_1.Wallet({
170
- chain,
171
- keyDeriver,
172
- storage,
173
- services,
174
- monitor,
175
- privilegedKeyManager
176
- });
177
- const r = {
178
- rootKey,
179
- identityKey,
180
- keyDeriver,
181
- chain,
182
- storage,
183
- services,
184
- monitor,
185
- wallet
186
- };
187
- return r;
188
- }
189
- /**
190
- * Setup a new `Wallet` without requiring a .env file.
191
- *
192
- * @param args.chain - 'main' or 'test'
193
- * @param args.rootKeyHex - Root private key for wallet's key deriver.
194
- * @param args.storageUrl - Optional. `StorageClient` and `chain` compatible endpoint URL.
195
- * @param args.privilegedKeyGetter - Optional. Method that will return the privileged `PrivateKey`, on demand.
196
- */
197
- static async createWalletClientNoEnv(args) {
198
- const chain = args.chain;
199
- const endpointUrl = args.storageUrl ||
200
- `https://${args.chain !== 'main' ? 'staging-' : ''}storage.babbage.systems`;
201
- const rootKey = sdk_1.PrivateKey.fromHex(args.rootKeyHex);
202
- const keyDeriver = new sdk_1.KeyDeriver(rootKey);
203
- const storage = new index_client_1.WalletStorageManager(keyDeriver.identityKey);
204
- const services = new index_client_1.Services(chain);
205
- const privilegedKeyManager = args.privilegedKeyGetter
206
- ? new index_client_1.sdk.PrivilegedKeyManager(args.privilegedKeyGetter)
207
- : undefined;
208
- const wallet = new index_client_1.Wallet({
209
- chain,
210
- keyDeriver,
211
- storage,
212
- services,
213
- privilegedKeyManager
214
- });
215
- const client = new index_client_1.StorageClient(wallet, endpointUrl);
216
- await storage.addWalletStorageProvider(client);
217
- await storage.makeAvailable();
218
- return wallet;
219
- }
220
- /**
221
- * @publicbody
222
- */
223
- static async createWalletClient(args) {
224
- const wo = await SetupClient.createWallet(args);
225
- const endpointUrl = args.endpointUrl ||
226
- `https://${args.env.chain !== 'main' ? 'staging-' : ''}storage.babbage.systems`;
227
- const client = new index_client_1.StorageClient(wo.wallet, endpointUrl);
228
- await wo.storage.addWalletStorageProvider(client);
229
- await wo.storage.makeAvailable();
230
- return {
231
- ...wo,
232
- endpointUrl
233
- };
234
- }
235
- /**
236
- * @publicbody
237
- */
238
- static getKeyPair(priv) {
239
- if (priv === undefined)
240
- priv = sdk_1.PrivateKey.fromRandom();
241
- else if (typeof priv === 'string')
242
- priv = new sdk_1.PrivateKey(priv, 'hex');
243
- const pub = sdk_1.PublicKey.fromPrivateKey(priv);
244
- const address = pub.toAddress();
245
- return { privateKey: priv, publicKey: pub, address };
246
- }
247
- /**
248
- * @publicbody
249
- */
250
- static getLockP2PKH(address) {
251
- const p2pkh = new sdk_1.P2PKH();
252
- const lock = p2pkh.lock(address);
253
- return lock;
254
- }
255
- /**
256
- * @publicbody
257
- */
258
- static getUnlockP2PKH(priv, satoshis) {
259
- const p2pkh = new sdk_1.P2PKH();
260
- const lock = SetupClient.getLockP2PKH(SetupClient.getKeyPair(priv).address);
261
- // Prepare to pay with SIGHASH_ALL and without ANYONE_CAN_PAY.
262
- // In otherwords:
263
- // - all outputs must remain in the current order, amount and locking scripts.
264
- // - all inputs must remain from the current outpoints and sequence numbers.
265
- // (unlock scripts are never signed)
266
- const unlock = p2pkh.unlock(priv, 'all', false, satoshis, lock);
267
- return unlock;
268
- }
269
- /**
270
- * @publicbody
271
- */
272
- static createP2PKHOutputs(outputs) {
273
- const os = [];
274
- const count = outputs.length;
275
- for (let i = 0; i < count; i++) {
276
- const o = outputs[i];
277
- os.push({
278
- basket: o.basket,
279
- tags: o.tags,
280
- satoshis: o.satoshis,
281
- lockingScript: SetupClient.getLockP2PKH(o.address).toHex(),
282
- outputDescription: o.outputDescription || `p2pkh ${i}`
283
- });
284
- }
285
- return os;
286
- }
287
- /**
288
- * @publicbody
289
- */
290
- static async createP2PKHOutputsAction(wallet, outputs, options) {
291
- const os = SetupClient.createP2PKHOutputs(outputs);
292
- const createArgs = {
293
- description: `createP2PKHOutputs`,
294
- outputs: os,
295
- options: {
296
- ...options,
297
- // Don't randomize so we can simplify outpoint creation
298
- randomizeOutputs: false
299
- }
300
- };
301
- const cr = await wallet.createAction(createArgs);
302
- let outpoints;
303
- if (cr.txid) {
304
- outpoints = os.map((o, i) => `${cr.txid}.${i}`);
305
- }
306
- return { cr, outpoints };
307
- }
308
- /**
309
- * @publicbody
310
- */
311
- static async fundWalletFromP2PKHOutpoints(wallet, outpoints, p2pkhKey, inputBEEF) {
312
- // TODO
313
- }
314
- }
315
- exports.SetupClient = SetupClient;
316
- //# sourceMappingURL=SetupClient.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SetupClient.js","sourceRoot":"","sources":["../../../src/SetupClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kCAYiB;AACjB,iDAQuB;AAEvB,+CAAgC;AAChC,MAAM,CAAC,MAAM,EAAE,CAAA;AAEf;;;;;;;;;GASG;AACH,MAAsB,WAAW;IAC/B;;;OAGG;IACH,MAAM,CAAC,KAAK,CAAC,KAAgB;QAC3B,IAAI,CAAC;YACH,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;YACzB,OAAO,KAAK,CAAA;QACd,CAAC;QAAC,WAAM,CAAC;YACP,OAAO,IAAI,CAAA;QACb,CAAC;IACH,CAAC;IAED;;;;;;;;;OASG;IACH,MAAM,CAAC,OAAO;QACZ,MAAM,YAAY,GAAG,gBAAU,CAAC,UAAU,EAAE,CAAA;QAC5C,MAAM,gBAAgB,GAAG,YAAY,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE,CAAA;QAC9D,MAAM,YAAY,GAAG,gBAAU,CAAC,UAAU,EAAE,CAAA;QAC5C,MAAM,gBAAgB,GAAG,YAAY,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE,CAAA;QAC9D,MAAM,YAAY,GAAG,gBAAU,CAAC,UAAU,EAAE,CAAA;QAC5C,MAAM,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