@bsv/sdk 1.4.1 → 1.4.3

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.
Files changed (39) hide show
  1. package/dist/cjs/package.json +1 -1
  2. package/dist/cjs/src/registry/RegistryClient.js +112 -89
  3. package/dist/cjs/src/registry/RegistryClient.js.map +1 -1
  4. package/dist/cjs/src/storage/StorageDownloader.js +82 -0
  5. package/dist/cjs/src/storage/StorageDownloader.js.map +1 -0
  6. package/dist/cjs/src/storage/__test/StorageDownloader.test.js +144 -0
  7. package/dist/cjs/src/storage/__test/StorageDownloader.test.js.map +1 -0
  8. package/dist/cjs/src/storage/index.js +3 -1
  9. package/dist/cjs/src/storage/index.js.map +1 -1
  10. package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
  11. package/dist/esm/src/registry/RegistryClient.js +110 -88
  12. package/dist/esm/src/registry/RegistryClient.js.map +1 -1
  13. package/dist/esm/src/storage/StorageDownloader.js +75 -0
  14. package/dist/esm/src/storage/StorageDownloader.js.map +1 -0
  15. package/dist/esm/src/storage/__test/StorageDownloader.test.js +139 -0
  16. package/dist/esm/src/storage/__test/StorageDownloader.test.js.map +1 -0
  17. package/dist/esm/src/storage/index.js +1 -0
  18. package/dist/esm/src/storage/index.js.map +1 -1
  19. package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
  20. package/dist/types/src/registry/RegistryClient.d.ts +24 -24
  21. package/dist/types/src/registry/RegistryClient.d.ts.map +1 -1
  22. package/dist/types/src/registry/types/index.d.ts +46 -19
  23. package/dist/types/src/registry/types/index.d.ts.map +1 -1
  24. package/dist/types/src/storage/StorageDownloader.d.ts +25 -0
  25. package/dist/types/src/storage/StorageDownloader.d.ts.map +1 -0
  26. package/dist/types/src/storage/__test/StorageDownloader.test.d.ts +2 -0
  27. package/dist/types/src/storage/__test/StorageDownloader.test.d.ts.map +1 -0
  28. package/dist/types/src/storage/index.d.ts +1 -0
  29. package/dist/types/src/storage/index.d.ts.map +1 -1
  30. package/dist/types/tsconfig.types.tsbuildinfo +1 -1
  31. package/dist/umd/bundle.js +1 -1
  32. package/docs/storage.md +51 -0
  33. package/package.json +1 -1
  34. package/src/registry/RegistryClient.ts +142 -114
  35. package/src/registry/__tests/RegistryClient.test.ts +136 -100
  36. package/src/registry/types/index.ts +50 -20
  37. package/src/storage/StorageDownloader.ts +91 -0
  38. package/src/storage/__test/StorageDownloader.test.ts +170 -0
  39. package/src/storage/index.ts +3 -0
@@ -1,20 +1,20 @@
1
- import { WalletInterface } from '../wallet/index.js';
1
+ import { WalletInterface, WalletProtocol } from '../wallet/index.js';
2
2
  import { BroadcastResponse, BroadcastFailure } from '../transaction/index.js';
3
3
  import { DefinitionData, DefinitionType, RegistryQueryMapping, RegistryRecord } from './types/index.js';
4
4
  /**
5
5
  * RegistryClient manages on-chain registry definitions for three types:
6
- * - BasketMap (basket-based items)
7
- * - ProtoMap (protocol-based items)
8
- * - CertMap (certificate-based items)
6
+ * - basket (basket-based items)
7
+ * - protocol (protocol-based items)
8
+ * - certificate (certificate-based items)
9
9
  *
10
10
  * It provides methods to:
11
11
  * - Register new definitions using pushdrop-based UTXOs.
12
- * - Resolve existing definitions using a overlay lookup service.
12
+ * - Resolve existing definitions using a lookup service.
13
13
  * - List registry entries associated with the operator's wallet.
14
14
  * - Revoke an existing registry entry by spending its UTXO.
15
15
  *
16
16
  * Registry operators use this client to establish and manage
17
- * canonical references for baskets, protocols, and certificates types.
17
+ * canonical references for baskets, protocols, and certificate types.
18
18
  */
19
19
  export declare class RegistryClient {
20
20
  private readonly wallet;
@@ -27,7 +27,7 @@ export declare class RegistryClient {
27
27
  * Registry operators (i.e., identity key owners) can create these definitions
28
28
  * to establish canonical references for basket IDs, protocol specs, or certificate schemas.
29
29
  *
30
- * @param data - The structured information needed to register an item of kind 'basket', 'protocol', or 'certificate'.
30
+ * @param data - Structured information about a 'basket', 'protocol', or 'certificate'.
31
31
  * @returns A promise with the broadcast result or failure.
32
32
  */
33
33
  registerDefinition(data: DefinitionData): Promise<BroadcastResponse | BroadcastFailure>;
@@ -38,7 +38,7 @@ export declare class RegistryClient {
38
38
  * - For "basket", the query is of type BasketMapQuery:
39
39
  * { basketID?: string; name?: string; registryOperators?: string[]; }
40
40
  * - For "protocol", the query is of type ProtoMapQuery:
41
- * { name?: string; registryOperators?: string[]; protocolID?: string; securityLevel?: number; }
41
+ * { name?: string; registryOperators?: string[]; protocolID?: WalletProtocol; }
42
42
  * - For "certificate", the query is of type CertMapQuery:
43
43
  * { type?: string; name?: string; registryOperators?: string[]; }
44
44
  *
@@ -59,36 +59,36 @@ export declare class RegistryClient {
59
59
  /**
60
60
  * Revokes a registry record by spending its associated UTXO.
61
61
  *
62
- * This function creates a transaction that spends the UTXO corresponding to the provided registry record,
63
- * revoking the registry entry. It prepares an unlocker using the appropriate wallet protocol,
64
- * builds a signable transaction, signs it, and then broadcasts the finalized transaction.
65
- *
66
- * @param registryRecord - The registry record to revoke. It must include a valid txid, outputIndex, and lockingScript.
67
- * @returns A promise that resolves with either a BroadcastResponse upon success or a BroadcastFailure on error.
68
- * @throws If required fields are missing or if transaction creation/signing fails.
62
+ * @param registryRecord - Must have valid txid, outputIndex, and lockingScript.
63
+ * @returns Broadcast success/failure.
69
64
  */
70
65
  revokeOwnRegistryEntry(registryRecord: RegistryRecord): Promise<BroadcastResponse | BroadcastFailure>;
66
+ /**
67
+ * Convert definition data into an array of pushdrop fields (strings).
68
+ * Each definition type has a slightly different shape.
69
+ */
71
70
  private buildPushDropFields;
72
71
  /**
73
- * Decodes a pushdrop locking script for a given registry kind,
72
+ * Decodes a pushdrop locking script for a given definition type,
74
73
  * returning a typed record with the appropriate fields.
75
74
  */
76
75
  private parseLockingScript;
77
76
  /**
78
- * Returns the (protocolID, keyID) used for pushdrop based on the registry kind.
77
+ * Convert our definitionType to the wallet protocol format ([protocolID, keyID]).
79
78
  */
80
- private getWalletProtocol;
79
+ private mapDefinitionTypeToWalletProtocol;
81
80
  /**
82
- * Returns the name of the basket used by the wallet
81
+ * Convert 'basket'|'protocol'|'certificate' to the basket name used by the wallet.
83
82
  */
84
- private getBasketName;
83
+ private mapDefinitionTypeToBasketName;
85
84
  /**
86
- * Returns the broadcast topic to be used with SHIPBroadcaster.
85
+ * Convert 'basket'|'protocol'|'certificate' to the broadcast topic name.
87
86
  */
88
- private getBroadcastTopic;
87
+ private mapDefinitionTypeToTopic;
89
88
  /**
90
- * Returns the lookup service name to use.
89
+ * Convert 'basket'|'protocol'|'certificate' to the lookup service name.
91
90
  */
92
- private getServiceName;
91
+ private mapDefinitionTypeToServiceName;
93
92
  }
93
+ export declare function deserializeWalletProtocol(str: string): WalletProtocol;
94
94
  //# sourceMappingURL=RegistryClient.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RegistryClient.d.ts","sourceRoot":"","sources":["../../../../src/registry/RegistryClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAKhB,MAAM,oBAAoB,CAAA;AAI3B,OAAO,EAEL,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,yBAAyB,CAAA;AAShC,OAAO,EAEL,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,cAAc,EACf,MAAM,kBAAkB,CAAA;AAIzB;;;;;;;;;;;;;;GAcG;AACH,qBAAa,cAAc;IAGvB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAFzB,OAAO,CAAC,OAAO,CAAuB;gBAEnB,MAAM,GAAE,eAAoC;IAG/D;;;;;;;;;OASG;IACG,kBAAkB,CAAE,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,iBAAiB,GAAG,gBAAgB,CAAC;IA2C9F;;;;;;;;;;;;;;OAcG;IACG,OAAO,CAAC,CAAC,SAAS,cAAc,EACpC,cAAc,EAAE,CAAC,EACjB,KAAK,EAAE,oBAAoB,CAAC,CAAC,CAAC,GAC7B,OAAO,CAAC,cAAc,EAAE,CAAC;IA2B5B;;;;;;;OAOG;IACG,sBAAsB,CAAE,cAAc,E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1B,cAAc,EAAE,cAAc,GAC7B,OAAO,CAAC,iBAAiB,GAAG,gBAAgB,CAAC;IAgFhD;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IA6C3B;;;OAGG;YACW,kBAAkB;IAwGhC;;OAEG;IACH,OAAO,CAAC,iCAAiC;IAazC;;OAEG;IACH,OAAO,CAAC,6BAA6B;IAarC;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAahC;;OAEG;IACH,OAAO,CAAC,8BAA8B;CAYvC;AAED,wBAAgB,yBAAyB,CAAE,GAAG,EAAE,MAAM,GAAG,cAAc,CAsBtE"}
@@ -1,9 +1,7 @@
1
- import { PubKeyHex } from '../../wallet/index.js';
1
+ import { BEEF, PubKeyHex, WalletProtocol } from '../../wallet/index.js';
2
2
  /**
3
- * Determines which category of registry item we are working with.
4
- * - "basket" corresponds to BasketMap
5
- * - "protocol" corresponds to ProtoMap
6
- * - "certificate" corresponds to CertMap
3
+ * We unify the registry “type” to these three strings everywhere:
4
+ * 'basket' | 'protocol' | 'certificate'
7
5
  */
8
6
  export type DefinitionType = 'basket' | 'protocol' | 'certificate';
9
7
  /**
@@ -16,7 +14,7 @@ export interface CertificateFieldDescriptor {
16
14
  fieldIcon: string;
17
15
  }
18
16
  /**
19
- * Registry data for a Basket-style record (BasketMap).
17
+ * Registry data for a Basket-style record.
20
18
  */
21
19
  export interface BasketDefinitionData {
22
20
  definitionType: 'basket';
@@ -28,12 +26,11 @@ export interface BasketDefinitionData {
28
26
  registryOperator?: PubKeyHex;
29
27
  }
30
28
  /**
31
- * Registry data for a Proto-style record (ProtoMap).
29
+ * Registry data for a Protocol-style record.
32
30
  */
33
31
  export interface ProtocolDefinitionData {
34
32
  definitionType: 'protocol';
35
- protocolID: string;
36
- securityLevel: 0 | 1 | 2;
33
+ protocolID: WalletProtocol;
37
34
  name: string;
38
35
  iconURL: string;
39
36
  description: string;
@@ -41,7 +38,7 @@ export interface ProtocolDefinitionData {
41
38
  registryOperator?: PubKeyHex;
42
39
  }
43
40
  /**
44
- * Registry data for a Cert-style record (CertMap).
41
+ * Registry data for a Certificate-style record.
45
42
  */
46
43
  export interface CertificateDefinitionData {
47
44
  definitionType: 'certificate';
@@ -53,34 +50,64 @@ export interface CertificateDefinitionData {
53
50
  fields: Record<string, CertificateFieldDescriptor>;
54
51
  registryOperator?: PubKeyHex;
55
52
  }
53
+ /**
54
+ * Union of all possible definition data objects.
55
+ */
56
56
  export type DefinitionData = BasketDefinitionData | ProtocolDefinitionData | CertificateDefinitionData;
57
+ /**
58
+ * Common info for the on-chain token/UTXO that points to a registry entry.
59
+ */
57
60
  export interface TokenData {
58
61
  txid: string;
59
62
  outputIndex: number;
60
63
  satoshis: number;
61
64
  lockingScript: string;
65
+ beef: BEEF;
62
66
  }
67
+ /**
68
+ * A registry record is a combination of the typed definition data
69
+ * plus the on-chain token data for the UTXO holding it.
70
+ */
63
71
  export type RegistryRecord = DefinitionData & TokenData;
64
- interface BasketMapQuery {
72
+ /**
73
+ * When searching for basket definitions, we can filter by:
74
+ * - basketID
75
+ * - registryOperators
76
+ * - name
77
+ */
78
+ export interface BasketQuery {
65
79
  basketID?: string;
66
80
  registryOperators?: string[];
67
81
  name?: string;
68
82
  }
69
- interface ProtoMapQuery {
83
+ /**
84
+ * When searching for protocol definitions, we can filter by:
85
+ * - name
86
+ * - registryOperators
87
+ * - protocolID
88
+ */
89
+ export interface ProtocolQuery {
70
90
  name?: string;
71
91
  registryOperators?: string[];
72
- protocolID?: string;
73
- securityLevel?: number;
92
+ protocolID?: WalletProtocol;
74
93
  }
75
- interface CertMapQuery {
94
+ /**
95
+ * When searching for certificate definitions, we can filter by:
96
+ * - type
97
+ * - name
98
+ * - registryOperators
99
+ */
100
+ export interface CertificateQuery {
76
101
  type?: string;
77
102
  name?: string;
78
103
  registryOperators?: string[];
79
104
  }
105
+ /**
106
+ * A lookup-service mapping of queries by each definition type.
107
+ */
80
108
  export interface RegistryQueryMapping {
81
- basket: BasketMapQuery;
82
- protocol: ProtoMapQuery;
83
- certificate: CertMapQuery;
109
+ basket: BasketQuery;
110
+ protocol: ProtocolQuery;
111
+ certificate: CertificateQuery;
84
112
  }
85
- export {};
86
113
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/registry/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAEjD;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,UAAU,GAAG,aAAa,CAAA;AAElE;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,YAAY,EAAE,MAAM,CAAA;IACpB,WAAW,EAAE,MAAM,CAAA;IACnB,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,OAAO,CAAA;IACnC,SAAS,EAAE,MAAM,CAAA;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,cAAc,EAAE,QAAQ,CAAA;IACxB,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,EAAE,MAAM,CAAA;IACnB,gBAAgB,EAAE,MAAM,CAAA;IACxB,gBAAgB,CAAC,EAAE,SAAS,CAAA;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,cAAc,EAAE,UAAU,CAAA;IAC1B,UAAU,EAAE,MAAM,CAAA;IAClB,aAAa,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,EAAE,MAAM,CAAA;IACnB,gBAAgB,EAAE,MAAM,CAAA;IACxB,gBAAgB,CAAC,EAAE,SAAS,CAAA;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,cAAc,EAAE,aAAa,CAAA;IAC7B,IAAI,EAAE,MAAM,CAAA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7B;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,MAAM,CAAA;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,IAAI,CAAA;CACX;AAED;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,cAAc,GAAG,SAAS,CAAA;AAMvD;;;;;GAKG;AACH,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC5B,UAAU,CAAC,EAAE,cAAc,CAAA;CAC5B;AAED;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAA;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,WAAW,CAAA;IACnB,QAAQ,EAAE,aAAa,CAAA;IACvB,WAAW,EAAE,gBAAgB,CAAA;CAC9B"}
@@ -0,0 +1,25 @@
1
+ export interface DownloaderConfig {
2
+ networkPreset: 'mainnet' | 'testnet' | 'local';
3
+ }
4
+ export interface DownloadResult {
5
+ data: number[];
6
+ mimeType: string | null;
7
+ }
8
+ /**
9
+ * Locates HTTP URLs where content can be downloaded. It uses the passed or the default one.
10
+ *
11
+ * @param {Object} obj All parameters are passed in an object.
12
+ * @param {String} obj.uhrpUrl The UHRP url to resolve.
13
+ * @param {string} obj.confederacyHost HTTPS URL for for the with default setting.
14
+ *
15
+ * @return {Array<String>} An array of HTTP URLs where content can be downloaded.
16
+ * @throws {Error} If UHRP url parameter invalid or is not an array
17
+ * or there is an error retrieving url(s) stored in the UHRP token.
18
+ */
19
+ export declare class StorageDownloader {
20
+ private readonly networkPreset?;
21
+ constructor(config?: DownloaderConfig);
22
+ resolve(uhrpUrl: string): Promise<string[]>;
23
+ download(uhrpUrl: string): Promise<DownloadResult>;
24
+ }
25
+ //# sourceMappingURL=StorageDownloader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StorageDownloader.d.ts","sourceRoot":"","sources":["../../../../src/storage/StorageDownloader.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,gBAAgB;IAC/B,aAAa,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,CAAA;CAC/C;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,EAAE,CAAA;IACd,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;CACxB;AAED;;;;;;;;;;GAUG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,CAA6C;gBAE/D,MAAM,CAAC,EAAE,gBAAgB;IAIzB,OAAO,CAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAgB5C,QAAQ,CAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;CAyCjE"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=StorageDownloader.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StorageDownloader.test.d.ts","sourceRoot":"","sources":["../../../../../src/storage/__test/StorageDownloader.test.ts"],"names":[],"mappings":""}
@@ -1,3 +1,4 @@
1
1
  export * as StorageUtils from './StorageUtils.js';
2
2
  export { StorageUploader } from './StorageUploader.js';
3
+ export { StorageDownloader } from './StorageDownloader.js';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAA;AAEjD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAEtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA"}