@1sat/wallet-node 0.0.24 → 0.0.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.
- package/dist/createNodeWallet.d.ts +3 -29
- package/dist/createNodeWallet.d.ts.map +1 -1
- package/dist/createNodeWallet.js +3 -47
- package/dist/createNodeWallet.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,24 +1,6 @@
|
|
|
1
1
|
import type { OneSatServices } from '@1sat/client';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { Monitor, type PermissionsManagerConfig, StorageClient, Wallet, WalletStorageManager } from '@bsv/wallet-toolbox';
|
|
5
|
-
/**
|
|
6
|
-
* BRC-100 permission configuration for `createNodeWallet`.
|
|
7
|
-
*
|
|
8
|
-
* In headless Node/server contexts the originator is typically hard-coded
|
|
9
|
-
* (admin), in which case WPM skips all checks and `prompt` is never
|
|
10
|
-
* invoked. Supply a throwing or auto-deny prompt handler if external
|
|
11
|
-
* originators could reach the wallet.
|
|
12
|
-
*/
|
|
13
|
-
export interface NodeWalletPermissionsOptions {
|
|
14
|
-
adminOriginator: string;
|
|
15
|
-
prompt: PermissionPromptHandler;
|
|
16
|
-
/** Defaults to `InMemoryPermissionStore`. Supply a persistent implementation for production. */
|
|
17
|
-
permissionStore?: IPermissionStore;
|
|
18
|
-
permissionsConfig?: Partial<PermissionsManagerConfig>;
|
|
19
|
-
}
|
|
20
|
-
/** See `@1sat/wallet-browser` for the field-by-field documentation. */
|
|
21
|
-
export declare const DEFAULT_PERMISSIONS_CONFIG: PermissionsManagerConfig;
|
|
2
|
+
import type { PrivateKey } from '@bsv/sdk';
|
|
3
|
+
import { Monitor, StorageClient, Wallet, WalletStorageManager } from '@bsv/wallet-toolbox';
|
|
22
4
|
export interface NodeWalletConfig {
|
|
23
5
|
privateKey: PrivateKey | string;
|
|
24
6
|
chain: 'main' | 'test';
|
|
@@ -33,17 +15,9 @@ export interface NodeWalletConfig {
|
|
|
33
15
|
filename?: string;
|
|
34
16
|
onTransactionBroadcasted?: (txid: string) => void;
|
|
35
17
|
onTransactionProven?: (txid: string, blockHeight: number) => void;
|
|
36
|
-
/**
|
|
37
|
-
* When set, wraps the wallet with `WalletPermissionsManager` + a
|
|
38
|
-
* `PermissionLedgerAdapter`. Omit to get the unwrapped `Wallet` (callers
|
|
39
|
-
* can still wrap WPM themselves for the legacy on-chain grant flow).
|
|
40
|
-
*/
|
|
41
|
-
permissions?: NodeWalletPermissionsOptions;
|
|
42
18
|
}
|
|
43
19
|
export interface NodeWalletResult {
|
|
44
|
-
wallet:
|
|
45
|
-
baseWallet?: Wallet;
|
|
46
|
-
adapter?: PermissionLedgerAdapter;
|
|
20
|
+
wallet: Wallet;
|
|
47
21
|
services: OneSatServices;
|
|
48
22
|
monitor?: Monitor;
|
|
49
23
|
destroy: () => Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createNodeWallet.d.ts","sourceRoot":"","sources":["../src/createNodeWallet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"createNodeWallet.d.ts","sourceRoot":"","sources":["../src/createNodeWallet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAElD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAC1C,OAAO,EACN,OAAO,EAEP,aAAa,EAEb,MAAM,EACN,oBAAoB,EACpB,MAAM,qBAAqB,CAAA;AAM5B,MAAM,WAAW,gBAAgB;IAChC,UAAU,EAAE,UAAU,GAAG,MAAM,CAAA;IAC/B,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;IACtB,QAAQ,CAAC,EAAE;QAAE,KAAK,EAAE,QAAQ,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAA;IAC7C,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,kBAAkB,EAAE,MAAM,CAAA;IAC1B,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,wBAAwB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IACjD,mBAAmB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,KAAK,IAAI,CAAA;CACjE;AAED,MAAM,WAAW,gBAAgB;IAChC,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,cAAc,CAAA;IACxB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IAC5B,OAAO,EAAE,oBAAoB,CAAA;IAC7B,aAAa,CAAC,EAAE,aAAa,CAAA;IAC7B,aAAa,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CAC7C;AAED,wBAAsB,gBAAgB,CACrC,MAAM,EAAE,gBAAgB,GACtB,OAAO,CAAC,gBAAgB,CAAC,CAyE3B"}
|
package/dist/createNodeWallet.js
CHANGED
|
@@ -1,31 +1,8 @@
|
|
|
1
|
-
import { DEFAULT_FEE_MODEL,
|
|
2
|
-
import { Monitor, Services, StorageClient, StorageProvider, Wallet,
|
|
1
|
+
import { DEFAULT_FEE_MODEL, createWalletCore } from '@1sat/wallet';
|
|
2
|
+
import { Monitor, Services, StorageClient, StorageProvider, Wallet, WalletStorageManager, } from '@bsv/wallet-toolbox';
|
|
3
3
|
import { StorageBunSqlite } from './storage-bun-sqlite';
|
|
4
4
|
const DEFAULT_STORAGE_NAME = 'wallet';
|
|
5
5
|
const DEFAULT_FILENAME = './wallet.db';
|
|
6
|
-
/** See `@1sat/wallet-browser` for the field-by-field documentation. */
|
|
7
|
-
export const DEFAULT_PERMISSIONS_CONFIG = {
|
|
8
|
-
seekProtocolPermissionsForSigning: true,
|
|
9
|
-
seekProtocolPermissionsForEncrypting: true,
|
|
10
|
-
seekProtocolPermissionsForHMAC: true,
|
|
11
|
-
seekPermissionsForKeyLinkageRevelation: true,
|
|
12
|
-
seekPermissionsForPublicKeyRevelation: false,
|
|
13
|
-
seekPermissionsForIdentityKeyRevelation: true,
|
|
14
|
-
seekPermissionsForIdentityResolution: true,
|
|
15
|
-
seekBasketInsertionPermissions: true,
|
|
16
|
-
seekBasketRemovalPermissions: true,
|
|
17
|
-
seekBasketListingPermissions: false,
|
|
18
|
-
seekPermissionWhenApplyingActionLabels: false,
|
|
19
|
-
seekPermissionWhenListingActionsByLabel: false,
|
|
20
|
-
seekCertificateDisclosurePermissions: true,
|
|
21
|
-
seekCertificateAcquisitionPermissions: true,
|
|
22
|
-
seekCertificateRelinquishmentPermissions: true,
|
|
23
|
-
seekCertificateListingPermissions: false,
|
|
24
|
-
encryptWalletMetadata: true,
|
|
25
|
-
seekSpendingPermissions: true,
|
|
26
|
-
seekGroupedPermission: true,
|
|
27
|
-
differentiatePrivilegedOperations: true,
|
|
28
|
-
};
|
|
29
6
|
export async function createNodeWallet(config) {
|
|
30
7
|
const feeModel = config.feeModel ?? DEFAULT_FEE_MODEL;
|
|
31
8
|
const storageOptions = StorageProvider.createStorageBaseOptions(config.chain);
|
|
@@ -69,27 +46,8 @@ export async function createNodeWallet(config) {
|
|
|
69
46
|
};
|
|
70
47
|
}
|
|
71
48
|
}
|
|
72
|
-
const baseWallet = core.wallet;
|
|
73
|
-
let wallet = baseWallet;
|
|
74
|
-
let adapter;
|
|
75
|
-
if (config.permissions) {
|
|
76
|
-
const permissionsConfig = {
|
|
77
|
-
...DEFAULT_PERMISSIONS_CONFIG,
|
|
78
|
-
...(config.permissions.permissionsConfig ?? {}),
|
|
79
|
-
};
|
|
80
|
-
const manager = new WalletPermissionsManager(baseWallet, config.permissions.adminOriginator, permissionsConfig);
|
|
81
|
-
const store = config.permissions.permissionStore ?? new InMemoryPermissionStore();
|
|
82
|
-
adapter = new PermissionLedgerAdapter({
|
|
83
|
-
wallet: manager,
|
|
84
|
-
store,
|
|
85
|
-
prompt: config.permissions.prompt,
|
|
86
|
-
});
|
|
87
|
-
wallet = manager;
|
|
88
|
-
}
|
|
89
49
|
const destroy = async () => {
|
|
90
50
|
try {
|
|
91
|
-
if (adapter)
|
|
92
|
-
adapter.dispose();
|
|
93
51
|
if (monitor) {
|
|
94
52
|
monitor.stopTasks();
|
|
95
53
|
if (monitor._tasksRunningPromise) {
|
|
@@ -105,9 +63,7 @@ export async function createNodeWallet(config) {
|
|
|
105
63
|
catch { }
|
|
106
64
|
};
|
|
107
65
|
return {
|
|
108
|
-
wallet,
|
|
109
|
-
baseWallet: config.permissions ? baseWallet : undefined,
|
|
110
|
-
adapter,
|
|
66
|
+
wallet: core.wallet,
|
|
111
67
|
services: core.services,
|
|
112
68
|
monitor,
|
|
113
69
|
destroy,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createNodeWallet.js","sourceRoot":"","sources":["../src/createNodeWallet.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"createNodeWallet.js","sourceRoot":"","sources":["../src/createNodeWallet.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAElE,OAAO,EACN,OAAO,EACP,QAAQ,EACR,aAAa,EACb,eAAe,EACf,MAAM,EACN,oBAAoB,GACpB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAEvD,MAAM,oBAAoB,GAAG,QAAQ,CAAA;AACrC,MAAM,gBAAgB,GAAG,aAAa,CAAA;AAyBtC,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACrC,MAAwB;IAExB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C,CAAA;QACF,CAAC;QACD,IAAI,MAAM,CAAC,mBAAmB,EAAE,CAAC;YAChC,OAAO,CAAC,mBAAmB,GAAG,KAAK,EAAE,MAAM,EAAE,EAAE;gBAC9C,MAAM,CAAC,mBAAoB,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,WAAW,CAAC,CAAA;YAC7D,CAAC,CAAA;QACF,CAAC;IACF,CAAC;IAED,MAAM,OAAO,GAAG,KAAK,IAAmB,EAAE;QACzC,IAAI,CAAC;YACJ,IAAI,OAAO,EAAE,CAAC;gBACb,OAAO,CAAC,SAAS,EAAE,CAAA;gBACnB,IAAI,OAAO,CAAC,oBAAoB,EAAE,CAAC;oBAClC,MAAM,OAAO,CAAC,oBAAoB,CAAA;gBACnC,CAAC;gBACD,MAAM,OAAO,CAAC,OAAO,EAAE,CAAA;YACxB,CAAC;QACF,CAAC;QAAC,MAAM,CAAC,CAAA,CAAC;QACV,IAAI,CAAC;YACJ,MAAM,IAAI,CAAC,OAAO,EAAE,CAAA;QACrB,CAAC;QAAC,MAAM,CAAC,CAAA,CAAC;IACX,CAAC,CAAA;IAED,OAAO;QACN,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,OAAO;QACP,OAAO;QACP,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,aAAa,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;QACpC,aAAa,EAAE,IAAI,CAAC,aAAa;KACjC,CAAA;AACF,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from '@1sat/wallet';
|
|
2
|
-
export {
|
|
3
|
-
export type { NodeWalletConfig,
|
|
2
|
+
export { createNodeWallet } from './createNodeWallet';
|
|
3
|
+
export type { NodeWalletConfig, NodeWalletResult } from './createNodeWallet';
|
|
4
4
|
export { StorageBunSqlite } from './storage-bun-sqlite';
|
|
5
5
|
export type { StorageBunSqliteOptions } from './storage-bun-sqlite';
|
|
6
6
|
export { Monitor, Services, StorageClient, StorageProvider, Wallet, WalletPermissionsManager, WalletStorageManager, type sdk as walletSdk, } from '@bsv/wallet-toolbox';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAE5B,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAE5B,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAE5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AACvD,YAAY,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAA;AAEnE,OAAO,EACN,OAAO,EACP,QAAQ,EACR,aAAa,EACb,eAAe,EACf,MAAM,EACN,wBAAwB,EACxB,oBAAoB,EACpB,KAAK,GAAG,IAAI,SAAS,GACrB,MAAM,qBAAqB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * from '@1sat/wallet';
|
|
2
|
-
export {
|
|
2
|
+
export { createNodeWallet } from './createNodeWallet';
|
|
3
3
|
export { StorageBunSqlite } from './storage-bun-sqlite';
|
|
4
4
|
export { Monitor, Services, StorageClient, StorageProvider, Wallet, WalletPermissionsManager, WalletStorageManager, } from '@bsv/wallet-toolbox';
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAE5B,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAE5B,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAGrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAGvD,OAAO,EACN,OAAO,EACP,QAAQ,EACR,aAAa,EACb,eAAe,EACf,MAAM,EACN,wBAAwB,EACxB,oBAAoB,GAEpB,MAAM,qBAAqB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@1sat/wallet-node",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.26",
|
|
4
4
|
"description": "Node/Bun wallet factory for 1Sat Ordinals SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
],
|
|
31
31
|
"license": "MIT",
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@1sat/wallet": "0.0.
|
|
33
|
+
"@1sat/wallet": "0.0.44"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"@bsv/sdk": "^2.0.13",
|
|
@@ -47,4 +47,4 @@
|
|
|
47
47
|
"@bsv/wallet-toolbox": "^2.1.21",
|
|
48
48
|
"typescript": "^5.9.3"
|
|
49
49
|
}
|
|
50
|
-
}
|
|
50
|
+
}
|