@1sat/wallet 0.0.47 → 0.0.49
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 +40 -0
- package/dist/factory.d.ts.map +1 -1
- package/dist/factory.js +114 -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,37 @@ 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
|
+
/**
|
|
49
|
+
* Present only when the caller supplies a `Monitor` class in the toolbox
|
|
50
|
+
* (wallet-node, wallet-browser). Remote-active wrappers (wallet-remote)
|
|
51
|
+
* omit the class; the server owns the monitor loop and the client's
|
|
52
|
+
* result has `monitor: undefined`.
|
|
53
|
+
*/
|
|
54
|
+
monitor: InstanceType<any> | undefined;
|
|
28
55
|
destroy: () => Promise<void>;
|
|
29
56
|
remoteClients: InstanceType<any>[];
|
|
30
57
|
/**
|
|
@@ -40,6 +67,13 @@ export interface WalletCoreResult {
|
|
|
40
67
|
* active store. No-op if the URL is already registered.
|
|
41
68
|
*/
|
|
42
69
|
addRemote: (url: string) => Promise<void>;
|
|
70
|
+
/**
|
|
71
|
+
* Returns the currently active storage provider. Live getter: reflects
|
|
72
|
+
* the result of any prior setActiveStorage call. Intended for callers
|
|
73
|
+
* (e.g. an RPC server) that need to expose the raw provider directly
|
|
74
|
+
* rather than go through the single-tenant WalletStorageManager.
|
|
75
|
+
*/
|
|
76
|
+
getActiveStorage: () => WalletStorageProvider;
|
|
43
77
|
feeModel: {
|
|
44
78
|
model: 'sat/kb';
|
|
45
79
|
value: number;
|
|
@@ -51,6 +85,12 @@ export declare function createWalletCore(config: WalletCoreConfig, localStorage:
|
|
|
51
85
|
StorageProvider: any;
|
|
52
86
|
Wallet: any;
|
|
53
87
|
WalletStorageManager: any;
|
|
88
|
+
/**
|
|
89
|
+
* Optional. When the caller supplies a Monitor class, the factory
|
|
90
|
+
* constructs an idle instance and wires the periodic BackupSync task.
|
|
91
|
+
* Wrappers that don't own a monitor loop (e.g. `wallet-remote` —
|
|
92
|
+
* the server runs its own monitor) should omit this.
|
|
93
|
+
*/
|
|
54
94
|
Monitor?: any;
|
|
55
95
|
}): Promise<WalletCoreResult>;
|
|
56
96
|
export {};
|
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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BAAgB,EACxB,YAAY,EAAE,qBAAqB,GAAG,SAAS,EAC/C,OAAO,EAAE;IACR,QAAQ,EAAE,GAAG,CAAA;IACb,aAAa,EAAE,GAAG,CAAA;IAClB,eAAe,EAAE,GAAG,CAAA;IACpB,MAAM,EAAE,GAAG,CAAA;IACX,oBAAoB,EAAE,GAAG,CAAA;IACzB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,GAAG,CAAA;CACb,GACC,OAAO,CAAC,gBAAgB,CAAC,CAwM3B"}
|
package/dist/factory.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { OneSatServices } from '@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,46 +59,63 @@ 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;
|
|
71
|
+
}
|
|
72
|
+
catch {
|
|
73
|
+
return undefined;
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
installStoragePaymentAutoRetry({
|
|
77
|
+
wallet: wallet,
|
|
78
|
+
getActiveRemoteUrl,
|
|
79
|
+
onStoragePaymentRequired: config.onStoragePaymentRequired,
|
|
80
|
+
});
|
|
81
|
+
// Monitor only exists when the caller supplied a Monitor class in the
|
|
82
|
+
// toolbox. wallet-node and wallet-browser do; wallet-remote doesn't
|
|
83
|
+
// (server owns the monitor loop). When present, the task loop is still
|
|
84
|
+
// caller-driven via startTasks / runOnce — factory just constructs and
|
|
85
|
+
// wires defaults.
|
|
86
|
+
let monitor;
|
|
87
|
+
if (toolbox.Monitor) {
|
|
88
|
+
monitor = new toolbox.Monitor({
|
|
89
|
+
chain: config.chain,
|
|
90
|
+
services: oneSatServices,
|
|
91
|
+
storage,
|
|
92
|
+
chaintracks: oneSatServices.chaintracks,
|
|
93
|
+
msecsWaitPerMerkleProofServiceReq: 500,
|
|
94
|
+
taskRunWaitMsecs: 5000,
|
|
95
|
+
abandonedMsecs: 300000,
|
|
96
|
+
unprovenAttemptsLimitTest: 10,
|
|
97
|
+
unprovenAttemptsLimitMain: 144,
|
|
98
|
+
});
|
|
99
|
+
monitor.addDefaultTasks();
|
|
100
|
+
// Periodic backup sync task. Fires only when local is the active store;
|
|
101
|
+
// with a remote active, pushing local-to-remote on a schedule would be
|
|
102
|
+
// unnecessary (remote is canonical) and the auto-retry payment path can
|
|
103
|
+
// deadlock against the manager's locks if it fires inside a scheduled
|
|
104
|
+
// backup task. Interval defaults to 5 min.
|
|
105
|
+
const backupSyncIntervalMs = config.backupSyncIntervalMs ?? 5 * 60 * 1000;
|
|
106
|
+
if (backupSyncIntervalMs > 0) {
|
|
107
|
+
monitor.addTask(buildBackupSyncTask(monitor, backupSyncIntervalMs, storage));
|
|
108
|
+
}
|
|
109
|
+
if (config.onTransactionBroadcasted) {
|
|
110
|
+
monitor.onTransactionBroadcasted = async (result) => {
|
|
111
|
+
if (result.txid)
|
|
112
|
+
config.onTransactionBroadcasted(result.txid);
|
|
113
|
+
};
|
|
98
114
|
}
|
|
99
|
-
|
|
100
|
-
|
|
115
|
+
if (config.onTransactionProven) {
|
|
116
|
+
monitor.onTransactionProven = async (status) => {
|
|
117
|
+
config.onTransactionProven(status.txid, status.blockHeight);
|
|
118
|
+
};
|
|
101
119
|
}
|
|
102
120
|
}
|
|
103
121
|
// 6. Remote management operations
|
|
@@ -106,8 +124,7 @@ export async function createWalletCore(config, localStorage, toolbox) {
|
|
|
106
124
|
if (!localStorage) {
|
|
107
125
|
throw new Error('setActiveStorage("local") called on a wallet with no local storage');
|
|
108
126
|
}
|
|
109
|
-
const localKey = (await localStorage.makeAvailable())
|
|
110
|
-
.storageIdentityKey;
|
|
127
|
+
const localKey = (await localStorage.makeAvailable()).storageIdentityKey;
|
|
111
128
|
await storage.setActive(localKey);
|
|
112
129
|
return;
|
|
113
130
|
}
|
|
@@ -124,28 +141,83 @@ export async function createWalletCore(config, localStorage, toolbox) {
|
|
|
124
141
|
if (settings?.storageIdentityKey) {
|
|
125
142
|
await storage.setActive(settings.storageIdentityKey);
|
|
126
143
|
}
|
|
127
|
-
wireBackupInterception();
|
|
128
144
|
};
|
|
129
145
|
const addRemote = async (url) => {
|
|
130
146
|
const existing = remoteClients.find((c) => c.endpointUrl === url);
|
|
131
147
|
if (existing)
|
|
132
148
|
return;
|
|
133
149
|
await connectRemote(url);
|
|
134
|
-
wireBackupInterception();
|
|
135
150
|
};
|
|
136
151
|
// 7. Destroy
|
|
137
152
|
const destroy = async () => {
|
|
153
|
+
if (monitor) {
|
|
154
|
+
try {
|
|
155
|
+
monitor.stopTasks();
|
|
156
|
+
if (monitor._tasksRunningPromise) {
|
|
157
|
+
await monitor._tasksRunningPromise;
|
|
158
|
+
}
|
|
159
|
+
await monitor.destroy();
|
|
160
|
+
}
|
|
161
|
+
catch { }
|
|
162
|
+
}
|
|
138
163
|
await wallet.destroy();
|
|
139
164
|
};
|
|
140
165
|
return {
|
|
141
166
|
wallet,
|
|
142
167
|
services: oneSatServices,
|
|
143
168
|
storage,
|
|
169
|
+
monitor,
|
|
144
170
|
destroy,
|
|
145
171
|
remoteClients,
|
|
146
172
|
setActiveStorage,
|
|
147
173
|
addRemote,
|
|
174
|
+
getActiveStorage: () => storage.getActive(),
|
|
148
175
|
feeModel,
|
|
149
176
|
};
|
|
150
177
|
}
|
|
178
|
+
/**
|
|
179
|
+
* Builds a plain-object Monitor task that calls `storage.updateBackups()`
|
|
180
|
+
* periodically. Shape-compatible with `WalletMonitorTask` — no class
|
|
181
|
+
* extension needed, so the factory doesn't need to import the abstract
|
|
182
|
+
* class from whichever wallet-toolbox variant the caller uses.
|
|
183
|
+
*
|
|
184
|
+
* Only fires when local is the active store — with a remote active,
|
|
185
|
+
* pushing local-to-remote on a schedule is unnecessary (remote is
|
|
186
|
+
* canonical) and in a metered-remote setup it can trigger the auto-retry
|
|
187
|
+
* payment path to deadlock against the manager's locks.
|
|
188
|
+
*/
|
|
189
|
+
function buildBackupSyncTask(monitor, triggerMsecs, storage) {
|
|
190
|
+
return {
|
|
191
|
+
monitor,
|
|
192
|
+
storage: monitor.storage,
|
|
193
|
+
name: 'BackupSync',
|
|
194
|
+
lastRunMsecsSinceEpoch: 0,
|
|
195
|
+
async asyncSetup() { },
|
|
196
|
+
trigger(nowMsecsSinceEpoch) {
|
|
197
|
+
if (nowMsecsSinceEpoch - this.lastRunMsecsSinceEpoch < triggerMsecs) {
|
|
198
|
+
return { run: false };
|
|
199
|
+
}
|
|
200
|
+
if (storage.getBackupStores().length === 0)
|
|
201
|
+
return { run: false };
|
|
202
|
+
try {
|
|
203
|
+
const active = storage.getActive();
|
|
204
|
+
if (!active?.isStorageProvider?.())
|
|
205
|
+
return { run: false };
|
|
206
|
+
}
|
|
207
|
+
catch {
|
|
208
|
+
return { run: false };
|
|
209
|
+
}
|
|
210
|
+
return { run: true };
|
|
211
|
+
},
|
|
212
|
+
async runTask() {
|
|
213
|
+
try {
|
|
214
|
+
await storage.updateBackups();
|
|
215
|
+
return 'backup sync complete';
|
|
216
|
+
}
|
|
217
|
+
catch (err) {
|
|
218
|
+
return `backup sync failed: ${err.message}`;
|
|
219
|
+
}
|
|
220
|
+
},
|
|
221
|
+
};
|
|
222
|
+
}
|
|
151
223
|
//# 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","s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AC,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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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,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,8BAA8B,EAC9B,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,0BAA0B,GAC/B,MAAM,2BAA2B,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,CAAC,MAAM,CAE1B,CAAA;IAC9B,MAAM,yBAAyB,GAAG,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAEjC,CAAA;IAErC,MAAM,YAAY,GAAG,KAAK,EAAK,EAAoB,EAAc,EAAE;QAClE,IAAI,CAAC;YACJ,OAAO,MAAM,EAAE,EAAE,CAAA;QAClB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACd,IAAI,CAAC,0BAA0B,CAAC,GAAG,CAAC;gBAAE,MAAM,GAAG,CAAA;YAC/C,MAAM,GAAG,GAAG,MAAM,CAAC,kBAAkB,EAAE,CAAA;YACvC,IAAI,CAAC,GAAG;gBAAE,MAAM,GAAG,CAAA;YACnB,MAAM,IAAI,GAAG,MAAM,gBAAgB,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;YAChD,IAAI,CAAC,IAAI;gBAAE,MAAM,GAAG,CAAA;YACpB,MAAM,IAAI,GAAG,MAAM,CAAC,wBAAw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AC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;IACrD,OAAO,GAAG,CAAC,IAAI,CAAC,EAAE,CAAA;AACnB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,39 +1,48 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
2
|
+
"name": "@1sat/wallet",
|
|
3
|
+
"version": "0.0.49",
|
|
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
|
}
|