@1sat/wallet 0.0.46 → 0.0.48
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/factory.d.ts +29 -1
- package/dist/factory.d.ts.map +1 -1
- package/dist/factory.js +108 -42
- package/dist/factory.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/storagePaymentAutoRetry.d.ts +66 -0
- package/dist/storagePaymentAutoRetry.d.ts.map +1 -0
- package/dist/storagePaymentAutoRetry.js +132 -0
- package/dist/storagePaymentAutoRetry.js.map +1 -0
- package/package.json +46 -37
package/dist/factory.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { OneSatServices } from '@1sat/client';
|
|
2
2
|
import { type PrivateKey } from '@bsv/sdk';
|
|
3
3
|
import type { sdk as toolboxSdk } from '@bsv/wallet-toolbox';
|
|
4
|
+
import { type StoragePaymentHook } from './storagePaymentAutoRetry';
|
|
4
5
|
type WalletStorageProvider = toolboxSdk.WalletStorageProvider;
|
|
5
6
|
export type Chain = 'main' | 'test';
|
|
6
7
|
export declare const DEFAULT_FEE_MODEL: {
|
|
@@ -20,11 +21,31 @@ export interface WalletCoreConfig {
|
|
|
20
21
|
connectionTimeout?: number;
|
|
21
22
|
onTransactionBroadcasted?: (txid: string) => void;
|
|
22
23
|
onTransactionProven?: (txid: string, blockHeight: number) => void;
|
|
24
|
+
/**
|
|
25
|
+
* Interval in ms between periodic `updateBackups()` runs when local
|
|
26
|
+
* storage is the active store. Defaults to 5 minutes. Set to 0 to
|
|
27
|
+
* disable (caller drives sync manually). Ignored when `activeRemote`
|
|
28
|
+
* is set — remote-active deployments treat the remote as canonical
|
|
29
|
+
* and don't push local-to-remote on a schedule.
|
|
30
|
+
*/
|
|
31
|
+
backupSyncIntervalMs?: number;
|
|
32
|
+
/**
|
|
33
|
+
* Optional consent hook for 507 Insufficient Storage auto-retry. Fires
|
|
34
|
+
* when an active-remote billable op returns 507; receives the remote's
|
|
35
|
+
* current pricing + next-payment derivation. Return true to fund and
|
|
36
|
+
* retry, false to propagate the error. Default when omitted is true
|
|
37
|
+
* (auto-fund). Full consent UX layers on top in a later pass.
|
|
38
|
+
*
|
|
39
|
+
* Only engages when an `activeRemote` is set — local-active wallets
|
|
40
|
+
* can't hit a 507.
|
|
41
|
+
*/
|
|
42
|
+
onStoragePaymentRequired?: StoragePaymentHook;
|
|
23
43
|
}
|
|
24
44
|
export interface WalletCoreResult {
|
|
25
45
|
wallet: InstanceType<any>;
|
|
26
46
|
services: OneSatServices;
|
|
27
47
|
storage: InstanceType<any>;
|
|
48
|
+
monitor: InstanceType<any>;
|
|
28
49
|
destroy: () => Promise<void>;
|
|
29
50
|
remoteClients: InstanceType<any>[];
|
|
30
51
|
/**
|
|
@@ -40,6 +61,13 @@ export interface WalletCoreResult {
|
|
|
40
61
|
* active store. No-op if the URL is already registered.
|
|
41
62
|
*/
|
|
42
63
|
addRemote: (url: string) => Promise<void>;
|
|
64
|
+
/**
|
|
65
|
+
* Returns the currently active storage provider. Live getter: reflects
|
|
66
|
+
* the result of any prior setActiveStorage call. Intended for callers
|
|
67
|
+
* (e.g. an RPC server) that need to expose the raw provider directly
|
|
68
|
+
* rather than go through the single-tenant WalletStorageManager.
|
|
69
|
+
*/
|
|
70
|
+
getActiveStorage: () => WalletStorageProvider;
|
|
43
71
|
feeModel: {
|
|
44
72
|
model: 'sat/kb';
|
|
45
73
|
value: number;
|
|
@@ -51,7 +79,7 @@ export declare function createWalletCore(config: WalletCoreConfig, localStorage:
|
|
|
51
79
|
StorageProvider: any;
|
|
52
80
|
Wallet: any;
|
|
53
81
|
WalletStorageManager: any;
|
|
54
|
-
Monitor
|
|
82
|
+
Monitor: any;
|
|
55
83
|
}): Promise<WalletCoreResult>;
|
|
56
84
|
export {};
|
|
57
85
|
//# sourceMappingURL=factory.d.ts.map
|
package/dist/factory.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,EAAc,KAAK,UAAU,EAAwB,MAAM,UAAU,CAAA;AAC5E,OAAO,KAAK,EAAE,GAAG,IAAI,UAAU,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,EAAc,KAAK,UAAU,EAAwB,MAAM,UAAU,CAAA;AAC5E,OAAO,KAAK,EAAE,GAAG,IAAI,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAE5D,OAAO,EAEN,KAAK,kBAAkB,EACvB,MAAM,2BAA2B,CAAA;AAGlC,KAAK,qBAAqB,GAAG,UAAU,CAAC,qBAAqB,CAAA;AAE7D,MAAM,MAAM,KAAK,GAAG,MAAM,GAAG,MAAM,CAAA;AAEnC,eAAO,MAAM,iBAAiB;;;CAA2C,CAAA;AACzE,eAAO,MAAM,0BAA0B,OAAO,CAAA;AAE9C,MAAM,WAAW,gBAAgB;IAChC,UAAU,EAAE,UAAU,GAAG,MAAM,CAAA;IAC/B,KAAK,EAAE,KAAK,CAAA;IACZ,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,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,wBAAwB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IACjD,mBAAmB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW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'@1sat/client';
|
|
2
2
|
import { KeyDeriver } from '@bsv/sdk';
|
|
3
3
|
import { parsePrivateKey } from './parsePrivateKey';
|
|
4
|
+
import { installStoragePaymentAutoRetry, } from './storagePaymentAutoRetry';
|
|
4
5
|
export const DEFAULT_FEE_MODEL = { model: 'sat/kb', value: 100 };
|
|
5
6
|
export const DEFAULT_CONNECTION_TIMEOUT = 5000;
|
|
6
7
|
export async function createWalletCore(config, localStorage, toolbox) {
|
|
@@ -58,47 +59,60 @@ export async function createWalletCore(config, localStorage, toolbox) {
|
|
|
58
59
|
await connectRemote(url);
|
|
59
60
|
}
|
|
60
61
|
}
|
|
61
|
-
//
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
return;
|
|
66
|
-
if (storage.getBackupStores().length === 0)
|
|
67
|
-
return;
|
|
68
|
-
backupInterceptionWired = true;
|
|
69
|
-
const originalCreateAction = wallet.createAction.bind(wallet);
|
|
70
|
-
wallet.createAction = async (args) => {
|
|
71
|
-
const result = await originalCreateAction(args);
|
|
72
|
-
if (result.txid) {
|
|
73
|
-
storage.updateBackups().catch((err) => {
|
|
74
|
-
console.error('[wallet-core] post-action backup failed:', err);
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
return result;
|
|
78
|
-
};
|
|
79
|
-
const originalSignAction = wallet.signAction.bind(wallet);
|
|
80
|
-
wallet.signAction = async (args) => {
|
|
81
|
-
const result = await originalSignAction(args);
|
|
82
|
-
if (result.txid) {
|
|
83
|
-
storage.updateBackups().catch((err) => {
|
|
84
|
-
console.error('[wallet-core] post-action backup failed:', err);
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
return result;
|
|
88
|
-
};
|
|
89
|
-
};
|
|
90
|
-
wireBackupInterception();
|
|
91
|
-
// Initial backup sync: push current active state into every backup store
|
|
92
|
-
// so fresh or wiped backups are populated before the wallet is used.
|
|
93
|
-
// Never fail wallet creation on backup failure — the active store is
|
|
94
|
-
// already usable; the caller can retry sync via updateBackups() later.
|
|
95
|
-
if (storage.getBackupStores().length > 0) {
|
|
62
|
+
// Install 507 auto-retry on billable methods. Only meaningful when an
|
|
63
|
+
// active remote is (or may later become) in play; the hook bails early
|
|
64
|
+
// when local is active.
|
|
65
|
+
const getActiveRemoteUrl = () => {
|
|
96
66
|
try {
|
|
97
|
-
|
|
67
|
+
const active = storage.getActive();
|
|
68
|
+
if (active?.isStorageProvider?.())
|
|
69
|
+
return undefined;
|
|
70
|
+
return active?.endpointUrl;
|
|
98
71
|
}
|
|
99
|
-
catch
|
|
100
|
-
|
|
72
|
+
catch {
|
|
73
|
+
return undefined;
|
|
101
74
|
}
|
|
75
|
+
};
|
|
76
|
+
installStoragePaymentAutoRetry({
|
|
77
|
+
wallet: wallet,
|
|
78
|
+
getActiveRemoteUrl,
|
|
79
|
+
onStoragePaymentRequired: config.onStoragePaymentRequired,
|
|
80
|
+
});
|
|
81
|
+
// Monitor is always constructed. Whether its task loop actually runs is
|
|
82
|
+
// the caller's choice (via startTasks / runOnce). With a remote active,
|
|
83
|
+
// callers should skip starting — the server owns its own monitor. With
|
|
84
|
+
// local active, start as needed.
|
|
85
|
+
const monitor = new toolbox.Monitor({
|
|
86
|
+
chain: config.chain,
|
|
87
|
+
services: oneSatServices,
|
|
88
|
+
storage,
|
|
89
|
+
chaintracks: oneSatServices.chaintracks,
|
|
90
|
+
msecsWaitPerMerkleProofServiceReq: 500,
|
|
91
|
+
taskRunWaitMsecs: 5000,
|
|
92
|
+
abandonedMsecs: 300000,
|
|
93
|
+
unprovenAttemptsLimitTest: 10,
|
|
94
|
+
unprovenAttemptsLimitMain: 144,
|
|
95
|
+
});
|
|
96
|
+
monitor.addDefaultTasks();
|
|
97
|
+
// Periodic backup sync task. Fires only when local is the active store;
|
|
98
|
+
// with a remote active, pushing local-to-remote on a schedule would be
|
|
99
|
+
// unnecessary (remote is canonical) and the auto-retry payment path can
|
|
100
|
+
// deadlock against the manager's locks if it fires inside a scheduled
|
|
101
|
+
// backup task. Interval defaults to 5 min.
|
|
102
|
+
const backupSyncIntervalMs = config.backupSyncIntervalMs ?? 5 * 60 * 1000;
|
|
103
|
+
if (backupSyncIntervalMs > 0) {
|
|
104
|
+
monitor.addTask(buildBackupSyncTask(monitor, backupSyncIntervalMs, storage));
|
|
105
|
+
}
|
|
106
|
+
if (config.onTransactionBroadcasted) {
|
|
107
|
+
monitor.onTransactionBroadcasted = async (result) => {
|
|
108
|
+
if (result.txid)
|
|
109
|
+
config.onTransactionBroadcasted(result.txid);
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
if (config.onTransactionProven) {
|
|
113
|
+
monitor.onTransactionProven = async (status) => {
|
|
114
|
+
config.onTransactionProven(status.txid, status.blockHeight);
|
|
115
|
+
};
|
|
102
116
|
}
|
|
103
117
|
// 6. Remote management operations
|
|
104
118
|
const setActiveStorage = async (target) => {
|
|
@@ -106,8 +120,7 @@ export async function createWalletCore(config, localStorage, toolbox) {
|
|
|
106
120
|
if (!localStorage) {
|
|
107
121
|
throw new Error('setActiveStorage("local") called on a wallet with no local storage');
|
|
108
122
|
}
|
|
109
|
-
const localKey = (await localStorage.makeAvailable())
|
|
110
|
-
.storageIdentityKey;
|
|
123
|
+
const localKey = (await localStorage.makeAvailable()).storageIdentityKey;
|
|
111
124
|
await storage.setActive(localKey);
|
|
112
125
|
return;
|
|
113
126
|
}
|
|
@@ -124,28 +137,81 @@ export async function createWalletCore(config, localStorage, toolbox) {
|
|
|
124
137
|
if (settings?.storageIdentityKey) {
|
|
125
138
|
await storage.setActive(settings.storageIdentityKey);
|
|
126
139
|
}
|
|
127
|
-
wireBackupInterception();
|
|
128
140
|
};
|
|
129
141
|
const addRemote = async (url) => {
|
|
130
142
|
const existing = remoteClients.find((c) => c.endpointUrl === url);
|
|
131
143
|
if (existing)
|
|
132
144
|
return;
|
|
133
145
|
await connectRemote(url);
|
|
134
|
-
wireBackupInterception();
|
|
135
146
|
};
|
|
136
147
|
// 7. Destroy
|
|
137
148
|
const destroy = async () => {
|
|
149
|
+
try {
|
|
150
|
+
monitor.stopTasks();
|
|
151
|
+
if (monitor._tasksRunningPromise) {
|
|
152
|
+
await monitor._tasksRunningPromise;
|
|
153
|
+
}
|
|
154
|
+
await monitor.destroy();
|
|
155
|
+
}
|
|
156
|
+
catch { }
|
|
138
157
|
await wallet.destroy();
|
|
139
158
|
};
|
|
140
159
|
return {
|
|
141
160
|
wallet,
|
|
142
161
|
services: oneSatServices,
|
|
143
162
|
storage,
|
|
163
|
+
monitor,
|
|
144
164
|
destroy,
|
|
145
165
|
remoteClients,
|
|
146
166
|
setActiveStorage,
|
|
147
167
|
addRemote,
|
|
168
|
+
getActiveStorage: () => storage.getActive(),
|
|
148
169
|
feeModel,
|
|
149
170
|
};
|
|
150
171
|
}
|
|
172
|
+
/**
|
|
173
|
+
* Builds a plain-object Monitor task that calls `storage.updateBackups()`
|
|
174
|
+
* periodically. Shape-compatible with `WalletMonitorTask` — no class
|
|
175
|
+
* extension needed, so the factory doesn't need to import the abstract
|
|
176
|
+
* class from whichever wallet-toolbox variant the caller uses.
|
|
177
|
+
*
|
|
178
|
+
* Only fires when local is the active store — with a remote active,
|
|
179
|
+
* pushing local-to-remote on a schedule is unnecessary (remote is
|
|
180
|
+
* canonical) and in a metered-remote setup it can trigger the auto-retry
|
|
181
|
+
* payment path to deadlock against the manager's locks.
|
|
182
|
+
*/
|
|
183
|
+
function buildBackupSyncTask(monitor, triggerMsecs, storage) {
|
|
184
|
+
return {
|
|
185
|
+
monitor,
|
|
186
|
+
storage: monitor.storage,
|
|
187
|
+
name: 'BackupSync',
|
|
188
|
+
lastRunMsecsSinceEpoch: 0,
|
|
189
|
+
async asyncSetup() { },
|
|
190
|
+
trigger(nowMsecsSinceEpoch) {
|
|
191
|
+
if (nowMsecsSinceEpoch - this.lastRunMsecsSinceEpoch < triggerMsecs) {
|
|
192
|
+
return { run: false };
|
|
193
|
+
}
|
|
194
|
+
if (storage.getBackupStores().length === 0)
|
|
195
|
+
return { run: false };
|
|
196
|
+
try {
|
|
197
|
+
const active = storage.getActive();
|
|
198
|
+
if (!active?.isStorageProvider?.())
|
|
199
|
+
return { run: false };
|
|
200
|
+
}
|
|
201
|
+
catch {
|
|
202
|
+
return { run: false };
|
|
203
|
+
}
|
|
204
|
+
return { run: true };
|
|
205
|
+
},
|
|
206
|
+
async runTask() {
|
|
207
|
+
try {
|
|
208
|
+
await storage.updateBackups();
|
|
209
|
+
return 'backup sync complete';
|
|
210
|
+
}
|
|
211
|
+
catch (err) {
|
|
212
|
+
return `backup sync failed: ${err.message}`;
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
};
|
|
216
|
+
}
|
|
151
217
|
//# sourceMappingURL=factory.js.map
|
package/dist/factory.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.js","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,EAAE,UAAU,EAAyC,MAAM,UAAU,CAAA;AAE5E,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"factory.js","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,EAAE,UAAU,EAAyC,MAAM,UAAU,CAAA;AAE5E,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EACN,8BAA8B,GAE9B,MAAM,2BAA2B,CAAA;AAOlC,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,KAAK,EAAE,QAAiB,EAAE,KAAK,EAAE,GAAG,EAAE,CAAA;AACzE,MAAM,CAAC,MAAM,0BAA0B,GAAG,IAAI,CAAA;AA8D9C,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACrC,MAAwB,EACxB,YAA+C,EAC/C,OAOC;IAED,MAAM,EAAE,K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,GAAG,EAAE,KAAK,EAAE,CAAA;YACtB,CAAC;YACD,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC,MAAM,KAAK,CAAC;gBAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,CAAA;YACjE,IAAI,CAAC;gBACJ,MAAM,MAAM,GAAG,OAAO,CAAC,SAAS,EAAS,CAAA;gBACzC,IAAI,CAAC,MAAM,EAAE,iBAAiB,EAAE,EAAE;oBAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,CAAA;YAC1D,CAAC;YAAC,MAAM,CAAC;gBACR,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,CAAA;YACtB,CAAC;YACD,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,CAAA;QACrB,CAAC;QACD,KAAK,CAAC,OAAO;YACZ,IAAI,CAAC;gBACJ,MAAM,OAAO,CAAC,aAAa,EAAE,CAAA;gBAC7B,OAAO,sBAAsB,CAAA;YAC9B,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACd,OAAO,uBAAwB,GAAa,CAAC,OAAO,EAAE,CAAA;YACvD,CAAC;QACF,CAAC;KACD,CAAA;AACF,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export { FileBackupProvider, FileRestoreReader, Zip, ZipDeflate, unzip, type Bac
|
|
|
8
8
|
export { ChromeCWI, CWIEventName, EventCWI, createChromeCWI, createCWI, createEventCWI, createSigmaCWI, createWebCWI, type CWIResponseDetail, type CWITransport, type SigmaCWIConfig, type SigmaCWIResult, type WebCWIConfig, type WebCWIResult, } from './cwi';
|
|
9
9
|
export { parsePrivateKey } from './parsePrivateKey';
|
|
10
10
|
export { createWalletCore, DEFAULT_FEE_MODEL, DEFAULT_CONNECTION_TIMEOUT, type Chain, type WalletCoreConfig, type WalletCoreResult, } from './factory';
|
|
11
|
+
export { installStoragePaymentAutoRetry, type AutoRetryConfig, type StoragePaymentHook, type StoragePaymentRequiredInfo, } from './storagePaymentAutoRetry';
|
|
11
12
|
export { filterGroupedByMissing, InMemoryPermissionStore, isExpired, LocalWalletPermissionsManager, normalizeOriginator, permissionKeyFromRequest, permissionKeysFromGroup, permissionKeyToString, } from './permissions';
|
|
12
13
|
export type { IPermissionStore, ListGrantsFilter, LocalWalletPermissionsManagerOptions, PermissionKey, PermissionType, StoredGrant, } from './permissions';
|
|
13
14
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAC7C,YAAY,EACX,eAAe,EACf,cAAc,EACd,oBAAoB,EACpB,UAAU,EACV,aAAa,EACb,UAAU,GACV,MAAM,aAAa,CAAA;AAGpB,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAGzD,OAAO,EACN,YAAY,EACZ,UAAU,EACV,UAAU,EACV,WAAW,EACX,iBAAiB,EACjB,WAAW,EACX,WAAW,EACX,aAAa,EACb,SAAS,GACT,MAAM,cAAc,CAAA;AAGrB,OAAO,EACN,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,WAAW,EACX,OAAO,EACP,kBAAkB,EAClB,WAAW,EACX,OAAO,EACP,UAAU,EACV,WAAW,EACX,cAAc,EACd,aAAa,EACb,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,KAAK,KAAK,EACV,KAAK,UAAU,EACf,KAAK,IAAI,EACT,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,MAAM,EACX,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,KAAK,EACV,KAAK,GAAG,GACR,MAAM,YAAY,CAAA;AAGnB,OAAO,EACN,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,KAAK,iBAAiB,GACtB,MAAM,gBAAgB,CAAA;AAGvB,OAAO,EACN,kBAAkB,EAClB,iBAAiB,EACjB,GAAG,EACH,UAAU,EACV,KAAK,EACL,KAAK,cAAc,EACnB,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,QAAQ,GACb,MAAM,UAAU,CAAA;AAGjB,OAAO,EACN,SAAS,EACT,YAAY,EACZ,QAAQ,EACR,eAAe,EACf,SAAS,EACT,cAAc,EACd,cAAc,EACd,YAAY,EACZ,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,YAAY,GACjB,MAAM,OAAO,CAAA;AAMd,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAGnD,OAAO,EACN,gBAAgB,EAChB,iBAAiB,EACjB,0BAA0B,EAC1B,KAAK,KAAK,EACV,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,GACrB,MAAM,WAAW,CAAA;AAGlB,OAAO,EACN,sBAAsB,EACtB,uBAAuB,EACvB,SAAS,EACT,6BAA6B,EAC7B,mBAAmB,EACnB,wBAAwB,EACxB,uBAAuB,EACvB,qBAAqB,GACrB,MAAM,eAAe,CAAA;AACtB,YAAY,EACX,gBAAgB,EAChB,gBAAgB,EAChB,oCAAoC,EACpC,aAAa,EACb,cAAc,EACd,WAAW,GACX,MAAM,eAAe,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAC7C,YAAY,EACX,eAAe,EACf,cAAc,EACd,oBAAoB,EACpB,UAAU,EACV,aAAa,EACb,UAAU,GACV,MAAM,aAAa,CAAA;AAGpB,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAGzD,OAAO,EACN,YAAY,EACZ,UAAU,EACV,UAAU,EACV,WAAW,EACX,iBAAiB,EACjB,WAAW,EACX,WAAW,EACX,aAAa,EAC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AA2B,CAAA;AAGlC,OAAO,EACN,sBAAsB,EACtB,uBAAuB,EACvB,SAAS,EACT,6BAA6B,EAC7B,mBAAmB,EACnB,wBAAwB,EACxB,uBAAuB,EACvB,qBAAqB,GACrB,MAAM,eAAe,CAAA;AACtB,YAAY,EACX,gBAAgB,EAChB,gBAAgB,EAChB,oCAAoC,EACpC,aAAa,EACb,cAAc,EACd,WAAW,GACX,MAAM,eAAe,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -18,6 +18,8 @@ export { ChromeCWI, CWIEventName, EventCWI, createChromeCWI, createCWI, createEv
|
|
|
18
18
|
export { parsePrivateKey } from './parsePrivateKey';
|
|
19
19
|
// Factory core
|
|
20
20
|
export { createWalletCore, DEFAULT_FEE_MODEL, DEFAULT_CONNECTION_TIMEOUT, } from './factory';
|
|
21
|
+
// 507 auto-retry
|
|
22
|
+
export { installStoragePaymentAutoRetry, } from './storagePaymentAutoRetry';
|
|
21
23
|
// Permissions — local-storage-backed WalletPermissionsManager
|
|
22
24
|
export { filterGroupedByMissing, InMemoryPermissionStore, isExpired, LocalWalletPermissionsManager, normalizeOriginator, permissionKeyFromRequest, permissionKeysFromGroup, permissionKeyToString, } from './permissions';
|
|
23
25
|
//# 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,WAAW;AACX,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAU7C,UAAU;AACV,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAEzD,cAAc;AACd,OAAO,EACN,YAAY,EACZ,UAAU,EACV,UAAU,EACV,WAAW,EACX,iBAAiB,EACjB,WAAW,EACX,WAAW,EACX,aAAa,EACb,SAAS,GACT,MAAM,cAAc,CAAA;AAErB,WAAW;AACX,OAAO,EACN,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,WAAW,EACX,OAAO,EACP,kBAAkB,EAClB,WAAW,EACX,OAAO,EACP,UAAU,EACV,WAAW,EACX,cAAc,EACd,aAAa,EACb,QAAQ,EACR,YAAY,EACZ,YAAY,GAYZ,MAAM,YAAY,CAAA;AAEnB,eAAe;AACf,OAAO,EACN,cAAc,EACd,iBAAiB,EACjB,YAAY,GAEZ,MAAM,gBAAgB,CAAA;AAEvB,SAAS;AACT,OAAO,EACN,kBAAkB,EAClB,iBAAiB,EACjB,GAAG,EACH,UAAU,EACV,KAAK,GAKL,MAAM,UAAU,CAAA;AAEjB,+BAA+B;AAC/B,OAAO,EACN,SAAS,EACT,YAAY,EACZ,QAAQ,EACR,eAAe,EACf,SAAS,EACT,cAAc,EACd,cAAc,EACd,YAAY,GAOZ,MAAM,OAAO,CAAA;AAEd,8EAA8E;AAC9E,sDAAsD;AAEtD,oBAAoB;AACpB,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAEnD,eAAe;AACf,OAAO,EACN,gBAAgB,EAChB,iBAAiB,EACjB,0BAA0B,GAI1B,MAAM,WAAW,CAAA;AAElB,8DAA8D;AAC9D,OAAO,EACN,sBAAsB,EACtB,uBAAuB,EACvB,SAAS,EACT,6BAA6B,EAC7B,mBAAmB,EACnB,wBAAwB,EACxB,uBAAuB,EACvB,qBAAqB,GACrB,MAAM,eAAe,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,WAAW;AACX,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAU7C,UAAU;AACV,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAEzD,cAAc;AACd,OAAO,EACN,YAAY,EACZ,UAAU,EACV,UAAU,EACV,WAAW,EACX,iBAAiB,EACjB,WAAW,EACX,WAAW,EACX,aAAa,EACb,SAAS,GACT,MAAM,cAAc,CAAA;AAErB,WAAW;AACX,OAAO,EACN,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,WAAW,EACX,OAAO,EACP,kBAAkB,EAClB,WAAW,EACX,OAAO,EACP,UAAU,EACV,WAAW,EACX,cAAc,EACd,aAAa,EACb,QAAQ,EACR,YAAY,EACZ,YAAY,GAYZ,MAAM,YAAY,CAAA;AAEnB,eAAe;AACf,OAAO,EACN,cAAc,EACd,iBAAiB,EACjB,YAAY,GAEZ,MAAM,gBAAgB,CAAA;AAEvB,SAAS;AACT,OAAO,EACN,kBAAkB,EAClB,iBAAiB,EACjB,GAAG,EACH,UAAU,EACV,KAAK,GAKL,MAAM,UAAU,CAAA;AAEjB,+BAA+B;AAC/B,OAAO,EACN,SAAS,EACT,YAAY,EACZ,QAAQ,EACR,eAAe,EACf,SAAS,EACT,cAAc,EACd,cAAc,EACd,YAAY,GAOZ,MAAM,OAAO,CAAA;AAEd,8EAA8E;AAC9E,sDAAsD;AAEtD,oBAAoB;AACpB,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAEnD,eAAe;AACf,OAAO,EACN,gBAAgB,EAChB,iBAAiB,EACjB,0BAA0B,GAI1B,MAAM,WAAW,CAAA;AAElB,iBAAiB;AACjB,OAAO,EACN,8BAA8B,GAI9B,MAAM,2BAA2B,CAAA;AAElC,8DAA8D;AAC9D,OAAO,EACN,sBAAsB,EACtB,uBAAuB,EACvB,SAAS,EACT,6BAA6B,EAC7B,mBAAmB,EACnB,wBAAwB,EACxB,uBAAuB,EACvB,qBAAqB,GACrB,MAAM,eAAe,CAAA"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Factory-level 507 auto-retry. Wraps `wallet.createAction`, `signAction`,
|
|
3
|
+
* and `internalizeAction` so that when the active remote returns a 507
|
|
4
|
+
* Insufficient Storage, we:
|
|
5
|
+
*
|
|
6
|
+
* 1. Consult an optional consent hook (default: auto-pay).
|
|
7
|
+
* 2. Fetch current pricing + next-payment derivation from the remote's
|
|
8
|
+
* `/account/status` (the 507 body is not visible to the client
|
|
9
|
+
* because `StorageClient.rpcCall` only preserves HTTP status text).
|
|
10
|
+
* 3. Build + broadcast a BRC-29 self-payment via the *unwrapped*
|
|
11
|
+
* `createAction` (so we don't re-enter our own retry logic).
|
|
12
|
+
* 4. Retry the original operation.
|
|
13
|
+
*
|
|
14
|
+
* The consent hook shape is deliberately minimal for now — the full
|
|
15
|
+
* consent/approval UX is designed in a later pass. Today the hook exists
|
|
16
|
+
* only as a seam: callers who don't supply one get the default auto-pay
|
|
17
|
+
* behavior (which is correct for test CLIs and for an already-consented
|
|
18
|
+
* yours-wallet active remote).
|
|
19
|
+
*/
|
|
20
|
+
import { type WalletInterface } from '@bsv/sdk';
|
|
21
|
+
/**
|
|
22
|
+
* Information supplied to the consent hook when a 507 is encountered on
|
|
23
|
+
* the active remote. Reflects the remote's current pricing state — future
|
|
24
|
+
* consent logic may compare these fields to a stored consent record.
|
|
25
|
+
*/
|
|
26
|
+
export interface StoragePaymentRequiredInfo {
|
|
27
|
+
remoteUrl: string;
|
|
28
|
+
serverIdentityKey: string;
|
|
29
|
+
deficitBytes: number;
|
|
30
|
+
satsRequired: number;
|
|
31
|
+
pricing: {
|
|
32
|
+
purchaseUnitBytes: number;
|
|
33
|
+
satsPerUnit: number;
|
|
34
|
+
durationBlocks: number;
|
|
35
|
+
};
|
|
36
|
+
nextPayment: {
|
|
37
|
+
derivationPrefix: string;
|
|
38
|
+
derivationSuffix: string;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export type StoragePaymentHook = (info: StoragePaymentRequiredInfo) => Promise<boolean>;
|
|
42
|
+
export interface AutoRetryConfig {
|
|
43
|
+
/** The wallet whose billable methods should be wrapped. */
|
|
44
|
+
wallet: WalletInterface;
|
|
45
|
+
/**
|
|
46
|
+
* Returns the currently-active remote URL, or undefined if local is
|
|
47
|
+
* active (in which case no 507 is possible and no retry ever fires).
|
|
48
|
+
*/
|
|
49
|
+
getActiveRemoteUrl(): string | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* Optional. Called when a 507 is seen on the active remote. Returns
|
|
52
|
+
* `true` to proceed with auto-funding, `false` to propagate the 507
|
|
53
|
+
* to the caller. Default when omitted: `true`. Full consent UX
|
|
54
|
+
* (pricing bounds, remembered approvals) layers on top of this hook
|
|
55
|
+
* in a later pass.
|
|
56
|
+
*/
|
|
57
|
+
onStoragePaymentRequired?: StoragePaymentHook;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Install the 507 auto-retry wrappers on the given wallet. Mutates the
|
|
61
|
+
* wallet in-place so every caller of `wallet.createAction` / `signAction`
|
|
62
|
+
* / `internalizeAction` goes through the retry path. Returns the wallet
|
|
63
|
+
* for convenience.
|
|
64
|
+
*/
|
|
65
|
+
export declare function installStoragePaymentAutoRetry(config: AutoRetryConfig): WalletInterface;
|
|
66
|
+
//# sourceMappingURL=storagePaymentAutoRetry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storagePaymentAutoRetry.d.ts","sourceRoot":"","sources":["../src/storagePaymentAutoRetry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAGN,KAAK,eAAe,EAOpB,MAAM,UAAU,CAAA;AAiCjB;;;;GAIG;AACH,MAAM,WAAW,0BAA0B;IAC1C,SAAS,EAAE,MAAM,CAAA;IACjB,iBAAiB,EAAE,MAAM,CAAA;IACzB,YAAY,EAAE,MAAM,CAAA;IACpB,YAAY,EAAE,MAAM,CAAA;IACpB,OAAO,EAAE;QACR,iBAAiB,EAAE,MAAM,CAAA;QACzB,WAAW,EAAE,MAAM,CAAA;QACnB,cAAc,EAAE,MAAM,CAAA;KACtB,CAAA;IACD,WAAW,EAAE;QACZ,gBAAgB,EAAE,MAAM,CAAA;QACxB,gBAAgB,EAAE,MAAM,CAAA;KACxB,CAAA;CACD;AAED,MAAM,MAAM,kBAAkB,GAAG,CAChC,IAAI,EAAE,0BAA0B,KAC5B,OAAO,CAAC,OAAO,CAAC,CAAA;AAErB,MAAM,WAAW,eAAe;IAC/B,2DAA2D;IAC3D,MAAM,EAAE,eAAe,CAAA;IACvB;;;OAGG;IACH,kBAAkB,IAAI,MAAM,GAAG,SAAS,CAAA;IACxC;;;;;;OAMG;IACH,wBAAwB,CAAC,EAAE,kBAAkB,CAAA;CAC7C;AAED;;;;;GAKG;AACH,wBAAgB,8BAA8B,CAC7C,MAAM,EAAE,eAAe,GACrB,eAAe,CAqCjB"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Factory-level 507 auto-retry. Wraps `wallet.createAction`, `signAction`,
|
|
3
|
+
* and `internalizeAction` so that when the active remote returns a 507
|
|
4
|
+
* Insufficient Storage, we:
|
|
5
|
+
*
|
|
6
|
+
* 1. Consult an optional consent hook (default: auto-pay).
|
|
7
|
+
* 2. Fetch current pricing + next-payment derivation from the remote's
|
|
8
|
+
* `/account/status` (the 507 body is not visible to the client
|
|
9
|
+
* because `StorageClient.rpcCall` only preserves HTTP status text).
|
|
10
|
+
* 3. Build + broadcast a BRC-29 self-payment via the *unwrapped*
|
|
11
|
+
* `createAction` (so we don't re-enter our own retry logic).
|
|
12
|
+
* 4. Retry the original operation.
|
|
13
|
+
*
|
|
14
|
+
* The consent hook shape is deliberately minimal for now — the full
|
|
15
|
+
* consent/approval UX is designed in a later pass. Today the hook exists
|
|
16
|
+
* only as a seam: callers who don't supply one get the default auto-pay
|
|
17
|
+
* behavior (which is correct for test CLIs and for an already-consented
|
|
18
|
+
* yours-wallet active remote).
|
|
19
|
+
*/
|
|
20
|
+
import { P2PKH, PublicKey, } from '@bsv/sdk';
|
|
21
|
+
import { AuthFetch } from '@bsv/sdk/auth';
|
|
22
|
+
/** BRC-29 protocol ID for wallet payments. */
|
|
23
|
+
const BRC29_PROTOCOL_ID = [2, '3241645161d8'];
|
|
24
|
+
/**
|
|
25
|
+
* Install the 507 auto-retry wrappers on the given wallet. Mutates the
|
|
26
|
+
* wallet in-place so every caller of `wallet.createAction` / `signAction`
|
|
27
|
+
* / `internalizeAction` goes through the retry path. Returns the wallet
|
|
28
|
+
* for convenience.
|
|
29
|
+
*/
|
|
30
|
+
export function installStoragePaymentAutoRetry(config) {
|
|
31
|
+
const { wallet } = config;
|
|
32
|
+
const originalCreateAction = wallet.createAction.bind(wallet);
|
|
33
|
+
const originalSignAction = wallet.signAction.bind(wallet);
|
|
34
|
+
const originalInternalizeAction = wallet.internalizeAction.bind(wallet);
|
|
35
|
+
const runWithRetry = async (op) => {
|
|
36
|
+
try {
|
|
37
|
+
return await op();
|
|
38
|
+
}
|
|
39
|
+
catch (err) {
|
|
40
|
+
if (!isInsufficientStorageError(err))
|
|
41
|
+
throw err;
|
|
42
|
+
const url = config.getActiveRemoteUrl();
|
|
43
|
+
if (!url)
|
|
44
|
+
throw err;
|
|
45
|
+
const info = await fetchPaymentInfo(wallet, url);
|
|
46
|
+
if (!info)
|
|
47
|
+
throw err;
|
|
48
|
+
const hook = config.onStoragePaymentRequired;
|
|
49
|
+
const ok = hook ? await hook(info) : true;
|
|
50
|
+
if (!ok)
|
|
51
|
+
throw err;
|
|
52
|
+
await buildAndBroadcastPayment(originalCreateAction, wallet, info);
|
|
53
|
+
return await op();
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
wallet.createAction = (args) => runWithRetry(() => originalCreateAction(args));
|
|
57
|
+
wallet.signAction = (args) => runWithRetry(() => originalSignAction(args));
|
|
58
|
+
wallet.internalizeAction = (args) => runWithRetry(() => originalInternalizeAction(args));
|
|
59
|
+
return wallet;
|
|
60
|
+
}
|
|
61
|
+
function isInsufficientStorageError(err) {
|
|
62
|
+
if (!err || typeof err !== 'object')
|
|
63
|
+
return false;
|
|
64
|
+
const msg = err.message;
|
|
65
|
+
if (typeof msg !== 'string')
|
|
66
|
+
return false;
|
|
67
|
+
// StorageClient.rpcCall throws "network error 507 507" on non-ok HTTP.
|
|
68
|
+
return /\bnetwork error 507\b/.test(msg);
|
|
69
|
+
}
|
|
70
|
+
async function fetchPaymentInfo(wallet, remoteUrl) {
|
|
71
|
+
const authFetch = new AuthFetch(wallet);
|
|
72
|
+
const statusUrl = joinUrl(remoteUrl, 'account/status');
|
|
73
|
+
const response = await authFetch.fetch(statusUrl, { method: 'GET' });
|
|
74
|
+
if (!response.ok)
|
|
75
|
+
return undefined;
|
|
76
|
+
const status = (await response.json());
|
|
77
|
+
if (!('accountsEnabled' in status) || !status.accountsEnabled) {
|
|
78
|
+
return undefined;
|
|
79
|
+
}
|
|
80
|
+
if (status.deficitBytes <= 0)
|
|
81
|
+
return undefined;
|
|
82
|
+
const units = Math.ceil(status.deficitBytes / status.pricing.purchaseUnitBytes);
|
|
83
|
+
const satsRequired = units * status.pricing.satsPerUnit;
|
|
84
|
+
return {
|
|
85
|
+
remoteUrl,
|
|
86
|
+
serverIdentityKey: status.serverIdentityKey,
|
|
87
|
+
deficitBytes: status.deficitBytes,
|
|
88
|
+
satsRequired,
|
|
89
|
+
pricing: status.pricing,
|
|
90
|
+
nextPayment: status.nextPayment,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
async function buildAndBroadcastPayment(createAction, wallet, info) {
|
|
94
|
+
const units = Math.ceil(info.deficitBytes / info.pricing.purchaseUnitBytes);
|
|
95
|
+
const keyID = `${info.nextPayment.derivationPrefix} ${info.nextPayment.derivationSuffix}`;
|
|
96
|
+
const { publicKey } = await wallet.getPublicKey({
|
|
97
|
+
protocolID: BRC29_PROTOCOL_ID,
|
|
98
|
+
keyID,
|
|
99
|
+
counterparty: info.serverIdentityKey,
|
|
100
|
+
forSelf: false,
|
|
101
|
+
});
|
|
102
|
+
const address = PublicKey.fromString(publicKey).toAddress();
|
|
103
|
+
const lockingScript = new P2PKH().lock(address).toHex();
|
|
104
|
+
const result = await createAction({
|
|
105
|
+
description: `storage payment (${units} unit${units === 1 ? '' : 's'})`,
|
|
106
|
+
labels: [`account-payment:${info.serverIdentityKey}`],
|
|
107
|
+
outputs: [
|
|
108
|
+
{
|
|
109
|
+
lockingScript,
|
|
110
|
+
satoshis: info.satsRequired,
|
|
111
|
+
outputDescription: 'storage capacity payment',
|
|
112
|
+
customInstructions: JSON.stringify({
|
|
113
|
+
derivationPrefix: info.nextPayment.derivationPrefix,
|
|
114
|
+
derivationSuffix: info.nextPayment.derivationSuffix,
|
|
115
|
+
}),
|
|
116
|
+
},
|
|
117
|
+
],
|
|
118
|
+
options: {
|
|
119
|
+
randomizeOutputs: false,
|
|
120
|
+
acceptDelayedBroadcast: false,
|
|
121
|
+
},
|
|
122
|
+
});
|
|
123
|
+
if (!result.txid) {
|
|
124
|
+
throw new Error('storage auto-retry: payment createAction did not return a txid');
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
function joinUrl(base, path) {
|
|
128
|
+
const b = base.endsWith('/') ? base.slice(0, -1) : base;
|
|
129
|
+
const p = path.startsWith('/') ? path.slice(1) : path;
|
|
130
|
+
return `${b}/${p}`;
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=storagePaymentAutoRetry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storagePaymentAutoRetry.js","sourceRoot":"","sources":["../src/storagePaymentAutoRetry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EACN,KAAK,EACL,SAAS,GAQT,MAAM,UAAU,CAAA;AACjB,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAEzC,8CAA8C;AAC9C,MAAM,iBAAiB,GAAgB,CAAC,CAAC,EAAE,cAAc,CAAC,CAAA;AAwE1D;;;;;GAKG;AACH,MAAM,UAAU,8BAA8B,CAC7C,MAAuB;IAEvB,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAAA;IACzB,MAAM,oBAAoB,GAAG,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAE5B,CAAA;IAChC,MAAM,kBAAkB,GAAG,MAAM,CAAC,UAAU,CAAC,IAAI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|
|
37
|
-
|
|
38
|
-
|
|
2
|
+
"name": "@1sat/wallet",
|
|
3
|
+
"version": "0.0.48",
|
|
4
|
+
"description": "BRC-100 wallet engine for 1Sat Ordinals SDK",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"bun": "./src/index.ts",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "tsc",
|
|
20
|
+
"dev": "tsc --watch",
|
|
21
|
+
"clean": "rm -rf dist"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"1sat",
|
|
25
|
+
"bsv",
|
|
26
|
+
"ordinals",
|
|
27
|
+
"wallet",
|
|
28
|
+
"brc-100"
|
|
29
|
+
],
|
|
30
|
+
"license": "MIT",
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@1sat/client": "0.0.21",
|
|
33
|
+
"@1sat/types": "0.0.17",
|
|
34
|
+
"@1sat/templates": "0.0.8",
|
|
35
|
+
"@bopen-io/templates": "^1.2.3",
|
|
36
|
+
"@msgpack/msgpack": "^3.1.3",
|
|
37
|
+
"fflate": "^0.8.2"
|
|
38
|
+
},
|
|
39
|
+
"peerDependencies": {
|
|
40
|
+
"@bsv/sdk": "^2.0.13",
|
|
41
|
+
"@bsv/wallet-toolbox": "^2.1.21"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@bsv/sdk": "^2.0.13",
|
|
45
|
+
"@types/chrome": "^0.1.32",
|
|
46
|
+
"typescript": "^5.9.3"
|
|
47
|
+
}
|
|
39
48
|
}
|