@1sat/wallet 0.0.3 → 0.0.4
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/OneSatWallet.d.ts +222 -0
- package/dist/OneSatWallet.d.ts.map +1 -0
- package/dist/OneSatWallet.js +754 -0
- package/dist/OneSatWallet.js.map +1 -0
- package/dist/address-sync/AddressManager.d.ts +86 -0
- package/dist/address-sync/AddressManager.d.ts.map +1 -0
- package/dist/address-sync/AddressManager.js +108 -0
- package/dist/address-sync/AddressManager.js.map +1 -0
- package/dist/address-sync/AddressSyncManager.d.ts +204 -0
- package/dist/address-sync/AddressSyncManager.d.ts.map +1 -0
- package/dist/address-sync/AddressSyncManager.js +525 -0
- package/dist/address-sync/AddressSyncManager.js.map +1 -0
- package/dist/address-sync/AddressSyncQueueIdb.d.ts +31 -0
- package/dist/address-sync/AddressSyncQueueIdb.d.ts.map +1 -0
- package/dist/address-sync/AddressSyncQueueIdb.js +356 -0
- package/dist/address-sync/AddressSyncQueueIdb.js.map +1 -0
- package/dist/address-sync/AddressSyncQueueSqlite.d.ts +55 -0
- package/dist/address-sync/AddressSyncQueueSqlite.d.ts.map +1 -0
- package/dist/address-sync/AddressSyncQueueSqlite.js +198 -0
- package/dist/address-sync/AddressSyncQueueSqlite.js.map +1 -0
- package/dist/address-sync/index.d.ts +8 -0
- package/dist/address-sync/index.d.ts.map +1 -0
- package/dist/address-sync/index.js +5 -0
- package/dist/address-sync/index.js.map +1 -0
- package/dist/backup/FileBackupProvider.d.ts +97 -0
- package/dist/backup/FileBackupProvider.d.ts.map +1 -0
- package/dist/backup/FileBackupProvider.js +185 -0
- package/dist/backup/FileBackupProvider.js.map +1 -0
- package/dist/backup/FileRestoreReader.d.ts +59 -0
- package/dist/backup/FileRestoreReader.d.ts.map +1 -0
- package/dist/backup/FileRestoreReader.js +89 -0
- package/dist/backup/FileRestoreReader.js.map +1 -0
- package/dist/backup/index.d.ts +6 -0
- package/dist/backup/index.d.ts.map +1 -0
- package/dist/backup/index.js +5 -0
- package/dist/backup/index.js.map +1 -0
- package/dist/backup/types.d.ts +32 -0
- package/dist/backup/types.d.ts.map +1 -0
- package/dist/backup/types.js +2 -0
- package/dist/backup/types.js.map +1 -0
- package/dist/browser.d.ts +6 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +6 -0
- package/dist/browser.js.map +1 -0
- package/dist/cwi/chrome.d.ts +12 -0
- package/dist/cwi/chrome.d.ts.map +1 -0
- package/dist/cwi/chrome.js +44 -0
- package/dist/cwi/chrome.js.map +1 -0
- package/dist/cwi/event.d.ts +12 -0
- package/dist/cwi/event.d.ts.map +1 -0
- package/dist/cwi/event.js +39 -0
- package/dist/cwi/event.js.map +1 -0
- package/dist/cwi/factory.d.ts +15 -0
- package/dist/cwi/factory.d.ts.map +1 -0
- package/dist/cwi/factory.js +45 -0
- package/dist/cwi/factory.js.map +1 -0
- package/dist/cwi/index.d.ts +12 -0
- package/dist/cwi/index.d.ts.map +1 -0
- package/dist/cwi/index.js +12 -0
- package/dist/cwi/index.js.map +1 -0
- package/dist/cwi/types.d.ts +40 -0
- package/dist/cwi/types.d.ts.map +1 -0
- package/dist/cwi/types.js +40 -0
- package/dist/cwi/types.js.map +1 -0
- package/dist/factory/createWebWallet.d.ts +73 -0
- package/dist/factory/createWebWallet.d.ts.map +1 -0
- package/dist/factory/createWebWallet.js +251 -0
- package/dist/factory/createWebWallet.js.map +1 -0
- package/dist/factory/fullSync.d.ts +58 -0
- package/dist/factory/fullSync.d.ts.map +1 -0
- package/dist/factory/fullSync.js +92 -0
- package/dist/factory/fullSync.js.map +1 -0
- package/dist/factory/index.d.ts +5 -0
- package/dist/factory/index.d.ts.map +1 -0
- package/dist/factory/index.js +3 -0
- package/dist/factory/index.js.map +1 -0
- package/dist/index.d.ts +18 -20
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +24 -21
- package/dist/index.js.map +1 -1
- package/dist/indexers/Bsv21Indexer.d.ts +36 -0
- package/dist/indexers/Bsv21Indexer.d.ts.map +1 -0
- package/dist/indexers/Bsv21Indexer.js +232 -0
- package/dist/indexers/Bsv21Indexer.js.map +1 -0
- package/dist/indexers/CosignIndexer.d.ts +14 -0
- package/dist/indexers/CosignIndexer.d.ts.map +1 -0
- package/dist/indexers/CosignIndexer.js +27 -0
- package/dist/indexers/CosignIndexer.js.map +1 -0
- package/dist/indexers/FundIndexer.d.ts +20 -0
- package/dist/indexers/FundIndexer.d.ts.map +1 -0
- package/dist/indexers/FundIndexer.js +65 -0
- package/dist/indexers/FundIndexer.js.map +1 -0
- package/dist/indexers/InscriptionIndexer.d.ts +33 -0
- package/dist/indexers/InscriptionIndexer.d.ts.map +1 -0
- package/dist/indexers/InscriptionIndexer.js +116 -0
- package/dist/indexers/InscriptionIndexer.js.map +1 -0
- package/dist/indexers/LockIndexer.d.ts +11 -0
- package/dist/indexers/LockIndexer.d.ts.map +1 -0
- package/dist/indexers/LockIndexer.js +44 -0
- package/dist/indexers/LockIndexer.js.map +1 -0
- package/dist/indexers/MapIndexer.d.ts +14 -0
- package/dist/indexers/MapIndexer.d.ts.map +1 -0
- package/dist/indexers/MapIndexer.js +65 -0
- package/dist/indexers/MapIndexer.js.map +1 -0
- package/dist/indexers/OpNSIndexer.d.ts +10 -0
- package/dist/indexers/OpNSIndexer.d.ts.map +1 -0
- package/dist/indexers/OpNSIndexer.js +39 -0
- package/dist/indexers/OpNSIndexer.js.map +1 -0
- package/dist/indexers/OrdLockIndexer.d.ts +18 -0
- package/dist/indexers/OrdLockIndexer.d.ts.map +1 -0
- package/dist/indexers/OrdLockIndexer.js +65 -0
- package/dist/indexers/OrdLockIndexer.js.map +1 -0
- package/dist/indexers/OriginIndexer.d.ts +38 -0
- package/dist/indexers/OriginIndexer.d.ts.map +1 -0
- package/dist/indexers/OriginIndexer.js +241 -0
- package/dist/indexers/OriginIndexer.js.map +1 -0
- package/dist/indexers/Outpoint.d.ts +11 -0
- package/dist/indexers/Outpoint.d.ts.map +1 -0
- package/dist/indexers/Outpoint.js +62 -0
- package/dist/indexers/Outpoint.js.map +1 -0
- package/dist/indexers/SigmaIndexer.d.ts +29 -0
- package/dist/indexers/SigmaIndexer.d.ts.map +1 -0
- package/dist/indexers/SigmaIndexer.js +134 -0
- package/dist/indexers/SigmaIndexer.js.map +1 -0
- package/dist/indexers/index.d.ts +14 -0
- package/dist/indexers/index.d.ts.map +1 -0
- package/dist/indexers/index.js +14 -0
- package/dist/indexers/index.js.map +1 -0
- package/dist/indexers/parseAddress.d.ts +10 -0
- package/dist/indexers/parseAddress.d.ts.map +1 -0
- package/dist/indexers/parseAddress.js +25 -0
- package/dist/indexers/parseAddress.js.map +1 -0
- package/dist/node.d.ts +6 -0
- package/dist/node.d.ts.map +1 -0
- package/dist/node.js +6 -0
- package/dist/node.js.map +1 -0
- package/dist/signers/ReadOnlySigner.d.ts +16 -0
- package/dist/signers/ReadOnlySigner.d.ts.map +1 -0
- package/dist/signers/ReadOnlySigner.js +48 -0
- package/dist/signers/ReadOnlySigner.js.map +1 -0
- package/package.json +21 -8
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { AddressSyncQueueIdb } from './AddressSyncQueueIdb';
|
|
2
|
+
export { AddressSyncQueueSqlite } from './AddressSyncQueueSqlite';
|
|
3
|
+
export { AddressManager, BRC29_PROTOCOL_ID, YOURS_PREFIX, } from './AddressManager';
|
|
4
|
+
export { AddressSyncFetcher, AddressSyncManager, AddressSyncProcessor, } from './AddressSyncManager';
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/address-sync/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAA;AACjE,OAAO,EACN,cAAc,EACd,iBAAiB,EACjB,YAAY,GACZ,MAAM,kBAAkB,CAAA;AAEzB,OAAO,EACN,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,GACpB,MAAM,sBAAsB,CAAA"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import type { sdk } from '@bsv/wallet-toolbox-mobile/out/src/index.client.js';
|
|
2
|
+
import type { TableSettings } from '@bsv/wallet-toolbox-mobile/out/src/storage/schema/tables/TableSettings.js';
|
|
3
|
+
import type { TableSyncState } from '@bsv/wallet-toolbox-mobile/out/src/storage/schema/tables/TableSyncState.js';
|
|
4
|
+
import type { TableUser } from '@bsv/wallet-toolbox-mobile/out/src/storage/schema/tables/TableUser.js';
|
|
5
|
+
import { Zip, ZipDeflate } from 'fflate';
|
|
6
|
+
type AuthId = sdk.AuthId;
|
|
7
|
+
type ProcessSyncChunkResult = sdk.ProcessSyncChunkResult;
|
|
8
|
+
type RequestSyncChunkArgs = sdk.RequestSyncChunkArgs;
|
|
9
|
+
type SyncChunk = sdk.SyncChunk;
|
|
10
|
+
type WalletStorageProvider = sdk.WalletStorageProvider;
|
|
11
|
+
type WalletServices = sdk.WalletServices;
|
|
12
|
+
/**
|
|
13
|
+
* FileBackupProvider implements WalletStorageProvider to receive sync chunks
|
|
14
|
+
* during wallet export. It encodes each chunk with MessagePack and streams
|
|
15
|
+
* it directly to a fflate Zip instance.
|
|
16
|
+
*
|
|
17
|
+
* Usage:
|
|
18
|
+
* 1. Create fflate.Zip with streaming callback
|
|
19
|
+
* 2. Create FileBackupProvider with the zip instance
|
|
20
|
+
* 3. Call storage.syncToWriter(auth, provider)
|
|
21
|
+
* 4. Provider receives processSyncChunk() calls and writes to zip
|
|
22
|
+
* 5. Call provider.getChunkCount() to get chunk count for manifest
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* import { Zip } from 'fflate';
|
|
27
|
+
*
|
|
28
|
+
* const chunks: Uint8Array[] = [];
|
|
29
|
+
* const zip = new Zip((err, data, final) => {
|
|
30
|
+
* if (err) throw err;
|
|
31
|
+
* chunks.push(data);
|
|
32
|
+
* if (final) {
|
|
33
|
+
* const blob = new Blob(chunks, { type: 'application/zip' });
|
|
34
|
+
* // Download or save blob
|
|
35
|
+
* }
|
|
36
|
+
* });
|
|
37
|
+
*
|
|
38
|
+
* const provider = new FileBackupProvider(zip, storage.getSettings(), identityKey);
|
|
39
|
+
* await storage.syncToWriter(auth, provider);
|
|
40
|
+
* console.log(`Exported ${provider.getChunkCount()} chunks`);
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export declare class FileBackupProvider implements WalletStorageProvider {
|
|
44
|
+
private zip;
|
|
45
|
+
private chunkCount;
|
|
46
|
+
private settings;
|
|
47
|
+
private identityKey;
|
|
48
|
+
constructor(zip: Zip, settings: TableSettings, identityKey: string);
|
|
49
|
+
/**
|
|
50
|
+
* Get the number of chunks written. Call after sync completes.
|
|
51
|
+
*/
|
|
52
|
+
getChunkCount(): number;
|
|
53
|
+
/**
|
|
54
|
+
* Add a file to the zip archive with compression.
|
|
55
|
+
* Creates a ZipDeflate stream and pushes the data in one chunk.
|
|
56
|
+
*/
|
|
57
|
+
private addFileToZip;
|
|
58
|
+
isStorageProvider(): boolean;
|
|
59
|
+
setServices(_v: WalletServices): void;
|
|
60
|
+
findOrInsertSyncStateAuth(_auth: AuthId, _storageIdentityKey: string, _storageName: string): Promise<{
|
|
61
|
+
syncState: TableSyncState;
|
|
62
|
+
isNew: boolean;
|
|
63
|
+
}>;
|
|
64
|
+
setActive(_auth: AuthId, _newActiveStorageIdentityKey: string): Promise<number>;
|
|
65
|
+
getSyncChunk(_args: RequestSyncChunkArgs): Promise<SyncChunk>;
|
|
66
|
+
/**
|
|
67
|
+
* Receives sync chunks from WalletStorageManager.syncToWriter().
|
|
68
|
+
* Encodes each chunk with MessagePack and adds to the zip.
|
|
69
|
+
*/
|
|
70
|
+
processSyncChunk(_args: RequestSyncChunkArgs, chunk: SyncChunk): Promise<ProcessSyncChunkResult>;
|
|
71
|
+
makeAvailable(): Promise<TableSettings>;
|
|
72
|
+
migrate(_storageName: string, _storageIdentityKey: string): Promise<string>;
|
|
73
|
+
destroy(): Promise<void>;
|
|
74
|
+
findOrInsertUser(identityKey: string): Promise<{
|
|
75
|
+
user: TableUser;
|
|
76
|
+
isNew: boolean;
|
|
77
|
+
}>;
|
|
78
|
+
abortAction(_auth: AuthId, _args: unknown): Promise<never>;
|
|
79
|
+
createAction(_auth: AuthId, _args: unknown): Promise<never>;
|
|
80
|
+
processAction(_auth: AuthId, _args: unknown): Promise<never>;
|
|
81
|
+
internalizeAction(_auth: AuthId, _args: unknown): Promise<never>;
|
|
82
|
+
insertCertificateAuth(_auth: AuthId, _certificate: unknown): Promise<number>;
|
|
83
|
+
relinquishCertificate(_auth: AuthId, _args: unknown): Promise<number>;
|
|
84
|
+
relinquishOutput(_auth: AuthId, _args: unknown): Promise<number>;
|
|
85
|
+
isAvailable(): boolean;
|
|
86
|
+
getServices(): WalletServices;
|
|
87
|
+
getSettings(): TableSettings;
|
|
88
|
+
findCertificatesAuth(_auth: AuthId, _args: unknown): Promise<never[]>;
|
|
89
|
+
findOutputBasketsAuth(_auth: AuthId, _args: unknown): Promise<never[]>;
|
|
90
|
+
findOutputsAuth(_auth: AuthId, _args: unknown): Promise<never[]>;
|
|
91
|
+
findProvenTxReqs(_args: unknown): Promise<never[]>;
|
|
92
|
+
listActions(_auth: AuthId, _vargs: unknown): Promise<never>;
|
|
93
|
+
listCertificates(_auth: AuthId, _vargs: unknown): Promise<never>;
|
|
94
|
+
listOutputs(_auth: AuthId, _vargs: unknown): Promise<never>;
|
|
95
|
+
}
|
|
96
|
+
export { Zip, ZipDeflate };
|
|
97
|
+
//# sourceMappingURL=FileBackupProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileBackupProvider.d.ts","sourceRoot":"","sources":["../../src/backup/FileBackupProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE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B,WAAW,IAAI,aAAa;IAItB,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;IAIrE,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;IAItE,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;IAIhE,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;IAIlD,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC;IAI3D,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC;IAIhE,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC;CAGjE;AAGD,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,CAAA"}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { encode } from '@msgpack/msgpack';
|
|
2
|
+
import { Zip, ZipDeflate } from 'fflate';
|
|
3
|
+
/**
|
|
4
|
+
* FileBackupProvider implements WalletStorageProvider to receive sync chunks
|
|
5
|
+
* during wallet export. It encodes each chunk with MessagePack and streams
|
|
6
|
+
* it directly to a fflate Zip instance.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* 1. Create fflate.Zip with streaming callback
|
|
10
|
+
* 2. Create FileBackupProvider with the zip instance
|
|
11
|
+
* 3. Call storage.syncToWriter(auth, provider)
|
|
12
|
+
* 4. Provider receives processSyncChunk() calls and writes to zip
|
|
13
|
+
* 5. Call provider.getChunkCount() to get chunk count for manifest
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* import { Zip } from 'fflate';
|
|
18
|
+
*
|
|
19
|
+
* const chunks: Uint8Array[] = [];
|
|
20
|
+
* const zip = new Zip((err, data, final) => {
|
|
21
|
+
* if (err) throw err;
|
|
22
|
+
* chunks.push(data);
|
|
23
|
+
* if (final) {
|
|
24
|
+
* const blob = new Blob(chunks, { type: 'application/zip' });
|
|
25
|
+
* // Download or save blob
|
|
26
|
+
* }
|
|
27
|
+
* });
|
|
28
|
+
*
|
|
29
|
+
* const provider = new FileBackupProvider(zip, storage.getSettings(), identityKey);
|
|
30
|
+
* await storage.syncToWriter(auth, provider);
|
|
31
|
+
* console.log(`Exported ${provider.getChunkCount()} chunks`);
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export class FileBackupProvider {
|
|
35
|
+
zip;
|
|
36
|
+
chunkCount = 0;
|
|
37
|
+
settings;
|
|
38
|
+
identityKey;
|
|
39
|
+
constructor(zip, settings, identityKey) {
|
|
40
|
+
this.zip = zip;
|
|
41
|
+
this.settings = settings;
|
|
42
|
+
this.identityKey = identityKey;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Get the number of chunks written. Call after sync completes.
|
|
46
|
+
*/
|
|
47
|
+
getChunkCount() {
|
|
48
|
+
return this.chunkCount;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Add a file to the zip archive with compression.
|
|
52
|
+
* Creates a ZipDeflate stream and pushes the data in one chunk.
|
|
53
|
+
*/
|
|
54
|
+
addFileToZip(filename, data) {
|
|
55
|
+
const deflate = new ZipDeflate(filename, { level: 6 });
|
|
56
|
+
this.zip.add(deflate);
|
|
57
|
+
deflate.push(data, true); // true = final chunk
|
|
58
|
+
}
|
|
59
|
+
// WalletStorageProvider interface methods
|
|
60
|
+
isStorageProvider() {
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
setServices(_v) {
|
|
64
|
+
// Not needed for backup
|
|
65
|
+
}
|
|
66
|
+
// WalletStorageSync interface methods
|
|
67
|
+
async findOrInsertSyncStateAuth(_auth, _storageIdentityKey, _storageName) {
|
|
68
|
+
throw new Error('Not supported: findOrInsertSyncStateAuth');
|
|
69
|
+
}
|
|
70
|
+
async setActive(_auth, _newActiveStorageIdentityKey) {
|
|
71
|
+
throw new Error('Not supported: setActive');
|
|
72
|
+
}
|
|
73
|
+
async getSyncChunk(_args) {
|
|
74
|
+
throw new Error('Not supported: getSyncChunk - this is a write-only provider');
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Receives sync chunks from WalletStorageManager.syncToWriter().
|
|
78
|
+
* Encodes each chunk with MessagePack and adds to the zip.
|
|
79
|
+
*/
|
|
80
|
+
async processSyncChunk(_args, chunk) {
|
|
81
|
+
const chunkName = `chunk-${String(this.chunkCount).padStart(4, '0')}.bin`;
|
|
82
|
+
const encoded = encode(chunk);
|
|
83
|
+
// Add chunk to zip with compression using ZipDeflate
|
|
84
|
+
this.addFileToZip(chunkName, new Uint8Array(encoded));
|
|
85
|
+
this.chunkCount++;
|
|
86
|
+
// Check if this chunk has any data - if all arrays are empty or undefined, we're done
|
|
87
|
+
const hasData = (chunk.provenTxs && chunk.provenTxs.length > 0) ||
|
|
88
|
+
(chunk.provenTxReqs && chunk.provenTxReqs.length > 0) ||
|
|
89
|
+
(chunk.outputBaskets && chunk.outputBaskets.length > 0) ||
|
|
90
|
+
(chunk.txLabels && chunk.txLabels.length > 0) ||
|
|
91
|
+
(chunk.outputTags && chunk.outputTags.length > 0) ||
|
|
92
|
+
(chunk.transactions && chunk.transactions.length > 0) ||
|
|
93
|
+
(chunk.txLabelMaps && chunk.txLabelMaps.length > 0) ||
|
|
94
|
+
(chunk.commissions && chunk.commissions.length > 0) ||
|
|
95
|
+
(chunk.outputs && chunk.outputs.length > 0) ||
|
|
96
|
+
(chunk.outputTagMaps && chunk.outputTagMaps.length > 0) ||
|
|
97
|
+
(chunk.certificates && chunk.certificates.length > 0) ||
|
|
98
|
+
(chunk.certificateFields && chunk.certificateFields.length > 0);
|
|
99
|
+
return {
|
|
100
|
+
done: !hasData,
|
|
101
|
+
maxUpdated_at: undefined,
|
|
102
|
+
updates: 0,
|
|
103
|
+
inserts: 0,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
// WalletStorageWriter interface methods (throw not supported)
|
|
107
|
+
async makeAvailable() {
|
|
108
|
+
return this.settings;
|
|
109
|
+
}
|
|
110
|
+
async migrate(_storageName, _storageIdentityKey) {
|
|
111
|
+
throw new Error('Not supported: migrate');
|
|
112
|
+
}
|
|
113
|
+
async destroy() {
|
|
114
|
+
throw new Error('Not supported: destroy');
|
|
115
|
+
}
|
|
116
|
+
async findOrInsertUser(identityKey) {
|
|
117
|
+
// Return a mock user for backup purposes
|
|
118
|
+
const now = new Date();
|
|
119
|
+
return {
|
|
120
|
+
user: {
|
|
121
|
+
userId: 1,
|
|
122
|
+
identityKey: identityKey || this.identityKey,
|
|
123
|
+
activeStorage: this.settings.storageIdentityKey || '',
|
|
124
|
+
created_at: now,
|
|
125
|
+
updated_at: now,
|
|
126
|
+
},
|
|
127
|
+
isNew: false,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
async abortAction(_auth, _args) {
|
|
131
|
+
throw new Error('Not supported: abortAction');
|
|
132
|
+
}
|
|
133
|
+
async createAction(_auth, _args) {
|
|
134
|
+
throw new Error('Not supported: createAction');
|
|
135
|
+
}
|
|
136
|
+
async processAction(_auth, _args) {
|
|
137
|
+
throw new Error('Not supported: processAction');
|
|
138
|
+
}
|
|
139
|
+
async internalizeAction(_auth, _args) {
|
|
140
|
+
throw new Error('Not supported: internalizeAction');
|
|
141
|
+
}
|
|
142
|
+
async insertCertificateAuth(_auth, _certificate) {
|
|
143
|
+
throw new Error('Not supported: insertCertificateAuth');
|
|
144
|
+
}
|
|
145
|
+
async relinquishCertificate(_auth, _args) {
|
|
146
|
+
throw new Error('Not supported: relinquishCertificate');
|
|
147
|
+
}
|
|
148
|
+
async relinquishOutput(_auth, _args) {
|
|
149
|
+
throw new Error('Not supported: relinquishOutput');
|
|
150
|
+
}
|
|
151
|
+
// WalletStorageReader interface methods (throw not supported)
|
|
152
|
+
isAvailable() {
|
|
153
|
+
return true;
|
|
154
|
+
}
|
|
155
|
+
getServices() {
|
|
156
|
+
throw new Error('Not supported: getServices');
|
|
157
|
+
}
|
|
158
|
+
getSettings() {
|
|
159
|
+
return this.settings;
|
|
160
|
+
}
|
|
161
|
+
async findCertificatesAuth(_auth, _args) {
|
|
162
|
+
throw new Error('Not supported: findCertificatesAuth');
|
|
163
|
+
}
|
|
164
|
+
async findOutputBasketsAuth(_auth, _args) {
|
|
165
|
+
throw new Error('Not supported: findOutputBasketsAuth');
|
|
166
|
+
}
|
|
167
|
+
async findOutputsAuth(_auth, _args) {
|
|
168
|
+
throw new Error('Not supported: findOutputsAuth');
|
|
169
|
+
}
|
|
170
|
+
async findProvenTxReqs(_args) {
|
|
171
|
+
throw new Error('Not supported: findProvenTxReqs');
|
|
172
|
+
}
|
|
173
|
+
async listActions(_auth, _vargs) {
|
|
174
|
+
throw new Error('Not supported: listActions');
|
|
175
|
+
}
|
|
176
|
+
async listCertificates(_auth, _vargs) {
|
|
177
|
+
throw new Error('Not supported: listCertificates');
|
|
178
|
+
}
|
|
179
|
+
async listOutputs(_auth, _vargs) {
|
|
180
|
+
throw new Error('Not supported: listOutputs');
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
// Re-export Zip and ZipDeflate for convenience
|
|
184
|
+
export { Zip, ZipDeflate };
|
|
185
|
+
//# sourceMappingURL=FileBackupProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileBackupProvider.js","sourceRoot":"","sources":["../../src/backup/FileBackupProvider.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAA;AASxC;;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AC;IAED,KAAK,CAAC,gBAAgB,CAAC,KAAa,EAAE,MAAe;QACpD,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAA;IACnD,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,KAAa,EAAE,MAAe;QAC/C,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAA;IAC9C,CAAC;CACD;AAED,+CAA+C;AAC/C,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,CAAA"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { sdk } from '@bsv/wallet-toolbox-mobile/out/src/index.client.js';
|
|
2
|
+
import type { TableSettings } from '@bsv/wallet-toolbox-mobile/out/src/storage/schema/tables/TableSettings.js';
|
|
3
|
+
import type { Unzipped } from 'fflate';
|
|
4
|
+
import type { BackupManifest } from './types';
|
|
5
|
+
type RequestSyncChunkArgs = sdk.RequestSyncChunkArgs;
|
|
6
|
+
type SyncChunk = sdk.SyncChunk;
|
|
7
|
+
type WalletStorageSyncReader = sdk.WalletStorageSyncReader;
|
|
8
|
+
/**
|
|
9
|
+
* FileRestoreReader implements WalletStorageSyncReader to serve sync chunks
|
|
10
|
+
* from a previously exported backup ZIP file during wallet restore.
|
|
11
|
+
*
|
|
12
|
+
* Usage:
|
|
13
|
+
* 1. Unzip the backup file with fflate.unzip()
|
|
14
|
+
* 2. Read and parse manifest.json
|
|
15
|
+
* 3. Create FileRestoreReader with unzipped data and manifest
|
|
16
|
+
* 4. Call storage.syncFromReader(identityKey, reader)
|
|
17
|
+
* 5. Reader serves chunks sequentially via getSyncChunk()
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* import { unzip } from 'fflate';
|
|
22
|
+
*
|
|
23
|
+
* const zipData = new Uint8Array(await file.arrayBuffer());
|
|
24
|
+
* const unzipped = await new Promise<Unzipped>((resolve, reject) => {
|
|
25
|
+
* unzip(zipData, (err, data) => (err ? reject(err) : resolve(data)));
|
|
26
|
+
* });
|
|
27
|
+
*
|
|
28
|
+
* const manifest = JSON.parse(
|
|
29
|
+
* new TextDecoder().decode(unzipped['manifest.json'])
|
|
30
|
+
* );
|
|
31
|
+
*
|
|
32
|
+
* const reader = new FileRestoreReader(unzipped, manifest);
|
|
33
|
+
* await storage.syncFromReader(manifest.identityKey, reader);
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare class FileRestoreReader implements WalletStorageSyncReader {
|
|
37
|
+
private unzipped;
|
|
38
|
+
private manifest;
|
|
39
|
+
private currentChunkIndex;
|
|
40
|
+
private settings;
|
|
41
|
+
constructor(unzipped: Unzipped, manifest: BackupManifest);
|
|
42
|
+
/**
|
|
43
|
+
* Get the backup manifest.
|
|
44
|
+
*/
|
|
45
|
+
getManifest(): BackupManifest;
|
|
46
|
+
/**
|
|
47
|
+
* Reset the reader to start from the beginning.
|
|
48
|
+
* Call this if you need to re-read the backup.
|
|
49
|
+
*/
|
|
50
|
+
reset(): void;
|
|
51
|
+
makeAvailable(): Promise<TableSettings>;
|
|
52
|
+
/**
|
|
53
|
+
* Returns sync chunks sequentially from the backup.
|
|
54
|
+
* When all chunks are consumed, returns an empty chunk to signal completion.
|
|
55
|
+
*/
|
|
56
|
+
getSyncChunk(args: RequestSyncChunkArgs): Promise<SyncChunk>;
|
|
57
|
+
}
|
|
58
|
+
export {};
|
|
59
|
+
//# sourceMappingURL=FileRestoreReader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileRestoreReader.d.ts","sourceRoot":"","sources":["../../src/backup/FileRestoreReader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,oDAAoD,CAAA;AAC7E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2EAA2E,CAAA;AAE9G,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AACtC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAE7C,KAAK,oBAAoB,GAAG,GAAG,CAAC,oBAAoB,CAAA;AACpD,KAAK,SAAS,GAAG,GAAG,CAAC,SAAS,CAAA;AAC9B,KAAK,uBAAuB,GAAG,GAAG,CAAC,uBAAuB,CAAA;AAE1D;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,qBAAa,iBAAkB,YAAW,uBAAuB;IAChE,OAAO,CAAC,QAAQ,CAAU;IAC1B,OAAO,CAAC,QAAQ,CAAgB;IAChC,OAAO,CAAC,iBAAiB,CAAI;IAC7B,OAAO,CAAC,QAAQ,CAAe;gBAEnB,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,cAAc;IAgBxD;;OAEG;IACH,WAAW,IAAI,cAAc;IAI7B;;;OAGG;IACH,KAAK,IAAI,IAAI;IAMP,aAAa,IAAI,OAAO,CAAC,aAAa,CAAC;IAI7C;;;OAGG;IACG,YAAY,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,SAAS,CAAC;CAsBlE"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { decode } from '@msgpack/msgpack';
|
|
2
|
+
/**
|
|
3
|
+
* FileRestoreReader implements WalletStorageSyncReader to serve sync chunks
|
|
4
|
+
* from a previously exported backup ZIP file during wallet restore.
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
* 1. Unzip the backup file with fflate.unzip()
|
|
8
|
+
* 2. Read and parse manifest.json
|
|
9
|
+
* 3. Create FileRestoreReader with unzipped data and manifest
|
|
10
|
+
* 4. Call storage.syncFromReader(identityKey, reader)
|
|
11
|
+
* 5. Reader serves chunks sequentially via getSyncChunk()
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* import { unzip } from 'fflate';
|
|
16
|
+
*
|
|
17
|
+
* const zipData = new Uint8Array(await file.arrayBuffer());
|
|
18
|
+
* const unzipped = await new Promise<Unzipped>((resolve, reject) => {
|
|
19
|
+
* unzip(zipData, (err, data) => (err ? reject(err) : resolve(data)));
|
|
20
|
+
* });
|
|
21
|
+
*
|
|
22
|
+
* const manifest = JSON.parse(
|
|
23
|
+
* new TextDecoder().decode(unzipped['manifest.json'])
|
|
24
|
+
* );
|
|
25
|
+
*
|
|
26
|
+
* const reader = new FileRestoreReader(unzipped, manifest);
|
|
27
|
+
* await storage.syncFromReader(manifest.identityKey, reader);
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export class FileRestoreReader {
|
|
31
|
+
unzipped;
|
|
32
|
+
manifest;
|
|
33
|
+
currentChunkIndex = 0;
|
|
34
|
+
settings;
|
|
35
|
+
constructor(unzipped, manifest) {
|
|
36
|
+
this.unzipped = unzipped;
|
|
37
|
+
this.manifest = manifest;
|
|
38
|
+
// Create settings from manifest
|
|
39
|
+
this.settings = {
|
|
40
|
+
created_at: new Date(manifest.createdAt),
|
|
41
|
+
updated_at: new Date(manifest.createdAt),
|
|
42
|
+
storageIdentityKey: `backup-${manifest.identityKey.slice(0, 16)}`,
|
|
43
|
+
storageName: 'FileBackup',
|
|
44
|
+
chain: manifest.chain,
|
|
45
|
+
dbtype: 'IndexedDB',
|
|
46
|
+
maxOutputScript: 256,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Get the backup manifest.
|
|
51
|
+
*/
|
|
52
|
+
getManifest() {
|
|
53
|
+
return this.manifest;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Reset the reader to start from the beginning.
|
|
57
|
+
* Call this if you need to re-read the backup.
|
|
58
|
+
*/
|
|
59
|
+
reset() {
|
|
60
|
+
this.currentChunkIndex = 0;
|
|
61
|
+
}
|
|
62
|
+
// WalletStorageSyncReader interface methods
|
|
63
|
+
async makeAvailable() {
|
|
64
|
+
return this.settings;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Returns sync chunks sequentially from the backup.
|
|
68
|
+
* When all chunks are consumed, returns an empty chunk to signal completion.
|
|
69
|
+
*/
|
|
70
|
+
async getSyncChunk(args) {
|
|
71
|
+
if (this.currentChunkIndex >= this.manifest.chunkCount) {
|
|
72
|
+
// Return empty chunk to signal completion
|
|
73
|
+
return {
|
|
74
|
+
fromStorageIdentityKey: this.settings.storageIdentityKey,
|
|
75
|
+
toStorageIdentityKey: args.toStorageIdentityKey,
|
|
76
|
+
userIdentityKey: this.manifest.identityKey,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
const chunkName = `chunk-${String(this.currentChunkIndex).padStart(4, '0')}.bin`;
|
|
80
|
+
const chunkData = this.unzipped[chunkName];
|
|
81
|
+
if (!chunkData) {
|
|
82
|
+
throw new Error(`Missing chunk file: ${chunkName}`);
|
|
83
|
+
}
|
|
84
|
+
const chunk = decode(chunkData);
|
|
85
|
+
this.currentChunkIndex++;
|
|
86
|
+
return chunk;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=FileRestoreReader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileRestoreReader.js","sourceRoot":"","sources":["../../src/backup/FileRestoreReader.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAQzC;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,OAAO,iBAAiB;IACrB,QAAQ,CAAU;IAClB,QAAQ,CAAgB;IACxB,iBAAiB,GAAG,CAAC,CAAA;IACrB,QAAQ,CAAe;IAE/B,YAAY,QAAkB,EAAE,QAAwB;QACvD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;QACxB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;QAExB,gCAAgC;QAChC,IAAI,CAAC,QAAQ,GAAG;YACf,UAAU,EAAE,IAAI,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC;YACxC,UAAU,EAAE,IAAI,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC;YAC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
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { FileBackupProvider, Zip, ZipDeflate } from './FileBackupProvider';
|
|
2
|
+
export { FileRestoreReader } from './FileRestoreReader';
|
|
3
|
+
export type { BackupManifest, BackupProgressEvent, BackupProgressCallback, } from './types';
|
|
4
|
+
export { unzip } from 'fflate';
|
|
5
|
+
export type { Unzipped } from 'fflate';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/backup/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AACvD,YAAY,EACX,cAAc,EACd,mBAAmB,EACnB,sBAAsB,GACtB,MAAM,SAAS,CAAA;AAGhB,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAC9B,YAAY,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/backup/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAOvD,gDAAgD;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { sdk } from '@bsv/wallet-toolbox-mobile/out/src/index.client.js';
|
|
2
|
+
type Chain = sdk.Chain;
|
|
3
|
+
/**
|
|
4
|
+
* Manifest stored in the backup ZIP file describing the backup contents.
|
|
5
|
+
*/
|
|
6
|
+
export interface BackupManifest {
|
|
7
|
+
/** Backup format version */
|
|
8
|
+
version: 1;
|
|
9
|
+
/** ISO timestamp when backup was created */
|
|
10
|
+
createdAt: string;
|
|
11
|
+
/** Network chain (main or test) */
|
|
12
|
+
chain: Chain;
|
|
13
|
+
/** Wallet identity public key */
|
|
14
|
+
identityKey: string;
|
|
15
|
+
/** Number of sync chunks in the backup */
|
|
16
|
+
chunkCount: number;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Progress events emitted during backup/restore operations.
|
|
20
|
+
*/
|
|
21
|
+
export interface BackupProgressEvent {
|
|
22
|
+
stage: 'preparing' | 'exporting' | 'downloading' | 'uploading' | 'importing' | 'complete';
|
|
23
|
+
message: string;
|
|
24
|
+
/** Optional progress percentage (0-100) */
|
|
25
|
+
progress?: number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Callback type for progress updates during backup/restore.
|
|
29
|
+
*/
|
|
30
|
+
export type BackupProgressCallback = (event: BackupProgressEvent) => void;
|
|
31
|
+
export {};
|
|
32
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/backup/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,oDAAoD,CAAA;AAE7E,KAAK,KAAK,GAAG,GAAG,CAAC,KAAK,CAAA;AAEtB;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B,4BAA4B;IAC5B,OAAO,EAAE,CAAC,CAAA;IACV,4CAA4C;IAC5C,SAAS,EAAE,MAAM,CAAA;IACjB,mCAAmC;IACnC,KAAK,EAAE,KAAK,CAAA;IACZ,iCAAiC;IACjC,WAAW,EAAE,MAAM,CAAA;IACnB,0CAA0C;IAC1C,UAAU,EAAE,MAAM,CAAA;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IACnC,KAAK,EACF,WAAW,GACX,WAAW,GACX,aAAa,GACb,WAAW,GACX,WAAW,GACX,UAAU,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;IACf,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,MAAM,CAAA;CACjB;AAED;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/backup/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser entrypoint for @1sat/wallet.
|
|
3
|
+
*/
|
|
4
|
+
export * from './index';
|
|
5
|
+
export { Monitor, Services, StorageClient, StorageIdb, StorageProvider, Wallet, WalletStorageManager, type sdk as walletSdk, } from '@bsv/wallet-toolbox-mobile/out/src/index.client.js';
|
|
6
|
+
//# sourceMappingURL=browser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,SAAS,CAAA;AACvB,OAAO,EACN,OAAO,EACP,QAAQ,EACR,aAAa,EACb,UAAU,EACV,eAAe,EACf,MAAM,EACN,oBAAoB,EACpB,KAAK,GAAG,IAAI,SAAS,GACrB,MAAM,oDAAoD,CAAA"}
|
package/dist/browser.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser entrypoint for @1sat/wallet.
|
|
3
|
+
*/
|
|
4
|
+
export * from './index';
|
|
5
|
+
export { Monitor, Services, StorageClient, StorageIdb, StorageProvider, Wallet, WalletStorageManager, } from '@bsv/wallet-toolbox-mobile/out/src/index.client.js';
|
|
6
|
+
//# sourceMappingURL=browser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,SAAS,CAAA;AACvB,OAAO,EACN,OAAO,EACP,QAAQ,EACR,aAAa,EACb,UAAU,EACV,eAAe,EACf,MAAM,EACN,oBAAoB,GAEpB,MAAM,oDAAoD,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CWI Chrome Transport - For extension popup/options pages
|
|
3
|
+
* Uses chrome.runtime.sendMessage directly to service worker
|
|
4
|
+
*/
|
|
5
|
+
import type { WalletInterface } from '@bsv/sdk';
|
|
6
|
+
/**
|
|
7
|
+
* Create a CWI for extension context (popup, options page).
|
|
8
|
+
* Uses chrome.runtime.sendMessage directly to communicate with service worker.
|
|
9
|
+
*/
|
|
10
|
+
export declare const createChromeCWI: () => WalletInterface;
|
|
11
|
+
export declare const ChromeCWI: WalletInterface;
|
|
12
|
+
//# sourceMappingURL=chrome.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chrome.d.ts","sourceRoot":"","sources":["../../src/cwi/chrome.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AA6C/C;;;GAGG;AACH,eAAO,MAAM,eAAe,QAAO,eAA6C,CAAA;AAGhF,eAAO,MAAM,SAAS,iBAAoB,CAAA"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CWI Chrome Transport - For extension popup/options pages
|
|
3
|
+
* Uses chrome.runtime.sendMessage directly to service worker
|
|
4
|
+
*/
|
|
5
|
+
import { createCWI } from './factory';
|
|
6
|
+
/**
|
|
7
|
+
* chrome.runtime.sendMessage-based transport for extension context.
|
|
8
|
+
* Communicates directly with service worker without content script intermediary.
|
|
9
|
+
*/
|
|
10
|
+
const chromeTransport = (action, params) => {
|
|
11
|
+
return new Promise((resolve, reject) => {
|
|
12
|
+
// Use originator at message level (BRC-100 standard)
|
|
13
|
+
// Format as chrome-extension://<id> to match the admin originator in initWallet.ts
|
|
14
|
+
const originator = `chrome-extension://${chrome.runtime?.id}`;
|
|
15
|
+
console.log('[ChromeCWI] Sending message:', {
|
|
16
|
+
action,
|
|
17
|
+
originator,
|
|
18
|
+
paramsType: typeof params,
|
|
19
|
+
});
|
|
20
|
+
chrome.runtime.sendMessage({ action, params, originator }, (response) => {
|
|
21
|
+
if (chrome.runtime.lastError) {
|
|
22
|
+
console.error('[ChromeCWI] Runtime error:', chrome.runtime.lastError.message);
|
|
23
|
+
reject(new Error(chrome.runtime.lastError.message));
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (response.success) {
|
|
27
|
+
console.log('[ChromeCWI] Success:', action);
|
|
28
|
+
resolve(response.data);
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
console.error('[ChromeCWI] Failed:', action, response.error);
|
|
32
|
+
reject(new Error(response.error || 'Unknown error'));
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Create a CWI for extension context (popup, options page).
|
|
39
|
+
* Uses chrome.runtime.sendMessage directly to communicate with service worker.
|
|
40
|
+
*/
|
|
41
|
+
export const createChromeCWI = () => createCWI(chromeTransport);
|
|
42
|
+
// Default instance for convenience
|
|
43
|
+
export const ChromeCWI = createChromeCWI();
|
|
44
|
+
//# sourceMappingURL=chrome.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chrome.js","sourceRoot":"","sources":["../../src/cwi/chrome.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAqB,SAAS,EAAE,MAAM,WAAW,CAAA;AAGxD;;;GAGG;AACH,MAAM,eAAe,GAAiB,CACrC,MAAoB,EACpB,MAAe,EACI,EAAE;IACrB,OAAO,IAAI,OAAO,CAAU,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC/C,qDAAqD;QACrD,mFAAmF;QACnF,MAAM,UAAU,GAAG,sBAAsB,MAAM,CAAC,OAAO,EAAE,E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warded by content script to service worker
|
|
4
|
+
*/
|
|
5
|
+
import type { WalletInterface } from '@bsv/sdk';
|
|
6
|
+
/**
|
|
7
|
+
* Create a CWI for browser page context.
|
|
8
|
+
* Uses CustomEvent pattern - requires content script to forward to service worker.
|
|
9
|
+
*/
|
|
10
|
+
export declare const createEventCWI: () => WalletInterface;
|
|
11
|
+
export declare const CWI: WalletInterface;
|
|
12
|
+
//# sourceMappingURL=event.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../../src/cwi/event.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAwC/C;;;GAGG;AACH,eAAO,MAAM,cAAc,QAAO,eAA4C,CAAA;AAG9E,eAAO,MAAM,GAAG,iBAAmB,CAAA"}
|