import { Authenticator } from '@smontero/nostr-ual'; import { Kind, Event, Sub } from 'nostr-tools'; import { SmartVaultsKind } from './enum'; import { NostrClient, Store } from './service'; import { PaginationOpts } from './util'; import { BasicTrxDetails, BaseOwnedSigner, BitcoinUtil, Contact, PublishedPolicy, TrxDetails } from './models'; import * as SmartVaultsTypes from './types'; export declare class SmartVaults { authenticator: Authenticator; bitcoinUtil: BitcoinUtil; nostrClient: NostrClient; stores: Map; private eventKindHandlerFactor; constructor({ authenticator, bitcoinUtil, nostrClient, }: { authenticator: Authenticator; bitcoinUtil: BitcoinUtil; nostrClient: NostrClient; }); initStores(): void; initEventKindHandlerFactory(): void; setAuthenticator(authenticator: Authenticator): void; getStore(eventKind: number): Store; /** * Asynchronously upserts contacts and publishes a Contacts event. * * @async * @param {Contact | Contact[]} newContacts - Single or array of Contact objects. * @returns {Promise>} - Resolves to an Event of Kind.Contacts. * @throws {Error} - If event publishing fails or if the authenticated user is trying to add himself as a contact. * * @example * const contact = new Contact({ publicKey: 'somePubKey', relay: 'some.relay.com' }); * await upsertContacts(contact); */ upsertContacts(newContacts: Contact | Contact[]): Promise>; /** * Asynchronously removes contacts by publicKey and publishes a Contacts event. * * @async * @param {string | string[]} contactsToRemove - publicKeys of contacts to remove. * @returns {Promise>} - Resolves to an Event of Kind.Contacts. * @throws {Error} - If removal or event publishing fails. * * @example * await removeContacts('somePubKey'); * await removeContacts(['somePubKey', 'otherPubKey']); */ removeContacts(contactsToRemove: string | string[]): Promise>; /** * Sets the profile metadata and publishes a Metadata event. * * @async * @param {SmartVaultsTypes.Metadata} metadata - Metadata for the profile. * @returns {Promise} - The updated profile. * @throws {Error} - On failure to set metadata or publish the event. * @example * await setProfile({ name: 'Alice', about: 'Learning about Smart Vaults' }); */ setProfile(metadata: SmartVaultsTypes.Metadata): Promise; /** * Retrieves a profile by a given public key or uses the instance's public key if not provided. * * @async * @param {string} [publicKey] - Optional public key to fetch the profile. * @returns {Promise} - The fetched profile. * @example * const profile = await getProfile('publicKey123'); */ getProfile(publicKey?: string): Promise; /** * Retrieves multiple profiles by their public keys. * * @async * @param {string[]} publicKeys - Array of public keys. * @returns {Promise} - Array of fetched profiles. * @example * const profiles = await getProfiles(['publicKey1', 'publicKey2']); */ getProfiles(publicKeys: string[]): Promise; /** * Retrieves profiles for given contacts or for all contacts if none are provided. * * @async * @param {Contact[]} [contacts] - Optional array of contacts. * @returns {Promise>} - Array of profiles or contacts. * @example * const contactProfiles = await getContactProfiles([{ publicKey: 'key1' }, { publicKey: 'key2' }]); */ getContactProfiles(contacts?: Contact[]): Promise>; /** * Retrieves all contacts for the authenticated user. * * @async * @returns {Promise} - Array of contacts. * @example * const contacts = await getContacts(); */ getContacts(): Promise; /** * Retrieves a list of recommended contacts based on shared signers. * * @async * @returns {Promise>} - Array of profiles or public keys. * @throws {Error} - On failure to fetch shared signers or contacts. * @example * const recommendedContacts = await getRecommendedContacts(); */ getRecommendedContacts(): Promise>; /** * Asynchronously saves a new policy and associated shared keys, then publishes the policy event. * * @async * @param {SmartVaultsTypes.SavePolicyPayload} payload - Payload containing policy details. * @param {string} payload.name - The name of the policy. * @param {string} payload.description - Description of the policy. * @param {string} payload.miniscript - Miniscript representing the policy. * @param {string[]} payload.nostrPublicKeys - Public keys of the members of the policy. * @param {Date} payload.createdAt - Creation date of the policy. * * @returns {Promise} - A PublishedPolicy instance. * @throws {Error} - If the policy cannot be saved or events cannot be published. * * @example * const payload = { * name: 'My Policy', * description: 'Description here', * miniscript: 'miniscriptString', * nostrPublicKeys: ['key1', 'key2'], * createdAt: new Date() * }; * const publishedPolicy = await savePolicy(payload); */ savePolicy({ name, description, miniscript, nostrPublicKeys, createdAt }: SmartVaultsTypes.SavePolicyPayload): Promise; private createSharedKeysAsync; private createSharedKeysSync; /** * Asynchronously retrieves policies within a specified pagination scope. * * @async * @param {PaginationOpts} [paginationOpts={}] - Pagination options for fetching policies. * @returns {Promise} - An array of PublishedPolicy objects. * @throws {Error} - If unable to fetch policies. * * @example * const paginationOpts = { limit: 10, page: 2 }; * const policies = await getPolicies(paginationOpts); */ getPolicies(paginationOpts?: PaginationOpts): Promise; /** * Asynchronously retrieves policies by their IDs. * * @async * @param {string[]} ids - An array of policy IDs. * @returns {Promise>} - A map where the key is the policy ID and the value is the PublishedPolicy object. * @throws {Error} - If unable to fetch policies by IDs. * * @example * const ids = ['id1', 'id2']; * const policiesById = await getPoliciesById(ids); */ getPoliciesById(ids: string[]): Promise>; /** * Asynchronously retrieves shared keys by their IDs. * * @async * @param {string[]} ids - An array of shared key IDs. * @returns {Promise>} - A map where the key is the shared key ID and the value is the SharedKeyAuthenticator object. * @throws {Error} - If unable to fetch shared keys by IDs. * * @example * const ids = ['id1', 'id2']; * const sharedKeysById = await getSharedKeysById(ids); */ getSharedKeysById: (ids: string[]) => Promise>; private _getPolicies; private _getSharedKeys; getPolicyEvent(policy_id: string): Promise; /** * Asynchronously initiates a spending proposal. * * @async * @param {SmartVaultsTypes.SpendProposalPayload} payload - Payload for the spending proposal. * @param {Policy} payload.policy - The policy under which the spending will be proposed. * @param {string} payload.to_address - The target address where funds will be sent. * @param {string} payload.description - A description of the spend proposal. * @param {number} payload.amountDescriptor - The amount to be sent, can be max or an amount in sats. * @param {string | number} payload.feeRatePriority - Can be low, medium, high or a numeric value for the target block. * @param {Map} payload.policyPath - The policy path (a map where the key is the policy node id and the value is the list of the indexes of the items that are intended to be satisfied from the policy node). * @param {string[]} [payload.utxos] - Optional: The UTXOs to be used. * @param {boolean} [payload.useFrozenUtxos=false] - Optional: Whether or not to use frozen UTXOs. * * @returns {Promise} - The published spending proposal. * * @throws {Error} - If invalid UTXOs are provided. * @throws {Error} - If frozen UTXOs are provided but 'useFrozenUtxos' is not set to true. * @throws {Error} - If an error occurs while building the transaction. * @throws {Error} - If an error occurs while publishing the proposal. * * @example * const payload = { * policy, * to_address: "abc123", * description: "A spending proposal", * amountDescriptor: 10, * feeRatePriority: 'high', * policyPath: new Map([['nodeId',[0,1,2]]]), * utxos: ["utxo1", "utxo2"], * useFrozenUtxos: false * }; * const spendingProposal = await spend(payload); */ spend({ policy, to_address, description, amountDescriptor, feeRatePriority, policyPath, utxos, useFrozenUtxos }: SmartVaultsTypes.SpendProposalPayload): Promise; /** * Subscribes to specified kinds of events and handles them using a provided callback function. * * @param {(SmartVaultsKind | Kind)[] | (SmartVaultsKind | Kind)} kinds - The event kinds to subscribe to. This can either be an array or a single value. * @param {(eventKind: number, payload: any) => void} callback - The callback function to handle incoming events. It receives the kind of event and the associated payload. * * @returns {Sub} - A subscription object that can be used to manage the subscription. * * @throws {Error} - If an error occurs while processing an event, the error is caught and logged, but does not break the subscription. * * @example * const kindsToSubscribe = [SmartVaultsKind.Policy, SmartVaultsKind.Proposal]; * const myCallback = (kind, payload) => { * console.log(`Received event of kind ${kind} with payload:`, payload); * }; * * const mySubscription = subscribe(kindsToSubscribe, myCallback); * * // To unsubscribe * mySubscription.disconnect(); */ subscribe(kinds: (SmartVaultsKind | Kind)[] | (SmartVaultsKind | Kind), callback: (eventKind: number, payload: any) => void): Sub; private buildFilter; private subscriptionFilters; /** * Disconnects from the SmartVaults instance relay. * * @returns {void} - No return value. * * @example * * smartVaults.disconnect(); */ disconnect(): void; private _getOwnedSigners; /** * Fetches signers owned by the user and returns them as an array of BaseOwnedSigner objects. * * * @returns {Promise} A promise that resolves to an array of BaseOwnedSigner objects. * Each BaseOwnedSigner object represents an owned signer and contains all the properties of the base signer object, plus `ownerPubKey' and 'createdAt' properties. * * @throws {Error} Throws an error if there's an issue in fetching signer events or decrypting content. * * @async */ getOwnedSigners: () => Promise; /** * Asynchronously fetches signers the user has shared. * If IDs are provided, the method fetches signers corresponding to those IDs. * Otherwise, it fetches all shared signers based. * * @async * @param {string | string[] | undefined} [id] - Optional ID(s) of the signers to fetch. * @returns {Promise>>} * - A promise that resolves to a Map of shared signers, mapped by their IDs. * * @throws Will throw an error if any issue occurs during the request to the relay. * * @example * // Fetch a single shared signer by ID * const result = await getMySharedSigners("some-signer-id"); * * // Fetch multiple shared signers by IDs * const result = await getMySharedSigners(["id1", "id2"]); * * // Fetch all shared signers * const result = await getMySharedSigners(); * * @see SmartVaultsTypes.MySharedSigner - For the structure of MySharedSigner objects. */ getMySharedSigners: (id?: string | string[]) => Promise>>; private _getSharedSigners; /** * Asynchronously fetches signers shared with the user based on specified public keys. * Returns them as an array of PublishedSharedSigner objects, each containing details such as owner's public key and creation time. * * @async * @param {string | string[] | undefined} [publicKeys] - Optional public keys to filter the fetched signers. Can be a single string or an array of strings. * @returns {Promise} - A promise that resolves to an array of PublishedSharedSigner objects. * * @throws {Error} - Throws an error if any issue occurs during the fetching of signer events or decryption of content. * * @example * // Fetch shared signers by a specific public key * const result = await getSharedSigners("some-public-key"); * * // Fetch shared signers by multiple public keys * const result = await getSharedSigners(["key1", "key2"]); * * // Fetch all shared signers * const result = await getSharedSigners(); * * @see SmartVaultsTypes.PublishedSharedSigner - For the structure of PublishedSharedSigner objects. */ getSharedSigners: (publicKeys?: string | string[]) => Promise; extractKey(descriptor: string): string; /** * Asynchronously saves an owned signer by encrypting its properties, building a new event, * and publishing it via `NostrClient`. * * @async * @param {Object} params - Parameters for the owned signer, including `description`, `descriptor`, * `fingerprint`, `name`, `t`. * @returns {Promise} A promise that resolves to an BaseOwnedSigner object with encrypted * data and includes the owner's public key and creation date. * @throws Will throw an error if the event publishing fails. * @example * const signer = await saveOwnedSigner({description, descriptor, fingerprint, name, t}); */ saveOwnedSigner({ description, descriptor, fingerprint, name, t, }: BaseOwnedSigner): Promise; /** * Asynchronously creates and publishes a 'SharedSigners' event. * * @async * @param {Object} params - Parameters for the shared signer, including `descriptor` and `fingerpring` * @param {string} pubKey - Public key of the user with whom the signer is being shared. * @returns {Promise} A promise that resolves to a PublishedSharedSigner object, includes * the owner's public key and shared date. * @throws Will throw an error if the event publishing fails or if the user tries to share a signer with themselves. * @example * const signer = await saveSharedSigner({descriptor, fingerprint}, pubKey); */ saveSharedSigner(ownedSigner: SmartVaultsTypes.PublishedOwnedSigner, pubKeys: string | string[]): Promise; private sendDirectMsg; /** * @ignore * Get direct messages * @returns {Promise} */ getDirectMessages(paginationOpts?: PaginationOpts): Promise; private buildSharedSignersFilter; private buildOwnedSignersFilter; private buildMySharedSignersFilter; private buildProposalsFilter; private buildCompletedProposalsFilter; private buildApprovedProposalsFilter; private buildLabelsFilter; private getProposalEvent; private _getCompletedProposals; /** * Asynchronously fetches completed proposals by their IDs. * * @async * @param {string[] | string} ids - The IDs of the completed proposals to fetch. * * @param {PaginationOpts} [paginationOpts={}] - Optional pagination options to limit the number of returned proposals or to fetch from a specific offset. * * @returns {Promise>} * - A promise that resolves to a map where the keys are proposal IDs and the values are either PublishedCompletedSpendingProposal or PublishedCompletedProofOfReserveProposal objects. * * @throws {Error} - Throws an error if the network request fails. * * @example * // Fetch a single proposal by ID * const proposals = await getCompletedProposalsById("some-proposal-id"); * * // Fetch multiple proposals by IDs with pagination * const proposals = await getCompletedProposalsById(["id1", "id2"], { since: new Date() }); * * @see SmartVaultsTypes.PublishedCompletedSpendingProposal - For the structure of a PublishedCompletedSpendingProposal object. * @see SmartVaultsTypes.PublishedCompletedProofOfReserveProposal - For the structure of a PublishedCompletedProofOfReserveProposal object. */ getCompletedProposalsById(ids: string[] | string, paginationOpts?: PaginationOpts): Promise>; /** * Asynchronously fetches completed proposals by their associated policy IDs. * * @async * @method * @param {string[] | string} policy_ids - The policy IDs corresponding to the completed proposals to fetch. * * @param {PaginationOpts} [paginationOpts={}] - Optional pagination options to limit the number of returned proposals or to fetch from a specific offset. * * @returns {Promise * >>} * - A promise that resolves to a map where the keys are policy IDs and the values are either single or arrays of PublishedCompletedSpendingProposal or PublishedCompletedProofOfReserveProposal objects. * * @throws {Error} - Throws an error if the network request fails or if the internal store is inconsistent. * * @example * // Fetch a single proposal by policy ID * const proposals = await getCompletedProposalsByPolicyId("some-policy-id"); * * // Fetch multiple proposals by policy IDs with pagination * const proposals = await getCompletedProposalsByPolicyId(["policy-id1", "policy-id2"], { since : new Date() }); * * @see SmartVaultsTypes.PublishedCompletedSpendingProposal - For the structure of a PublishedCompletedSpendingProposal object. * @see SmartVaultsTypes.PublishedCompletedProofOfReserveProposal - For the structure of a PublishedCompletedProofOfReserveProposal object. */ getCompletedProposalsByPolicyId: (policy_ids: string[] | string, paginationOpts?: PaginationOpts) => Promise>>; /** * Asynchronously fetches all completed proposals, optionally with pagination. * * @async * @method * @param {PaginationOpts} [paginationOpts={}] - Optional pagination options to control the returned data. * * @returns {Promise<(SmartVaultsTypes.PublishedCompletedSpendingProposal | SmartVaultsTypes.PublishedCompletedProofOfReserveProposal)[]>} * - A promise that resolves to an array of either PublishedCompletedSpendingProposal or PublishedCompletedProofOfReserveProposal objects. * * @throws {Error} - Throws an error if there is a failure in fetching the proposals. * * @example * // Fetch completed proposals with default settings * const proposals = await getCompletedProposals(); * * // Fetch completed proposals with pagination * const proposals = await getCompletedProposals({ limit: 5 }); * * @see SmartVaultsTypes.PublishedCompletedSpendingProposal - For the structure of a PublishedCompletedSpendingProposal object. * @see SmartVaultsTypes.PublishedCompletedProofOfReserveProposal - For the structure of a PublishedCompletedProofOfReserveProposal object. */ getCompletedProposals(paginationOpts?: PaginationOpts): Promise<(SmartVaultsTypes.PublishedCompletedSpendingProposal | SmartVaultsTypes.PublishedCompletedProofOfReserveProposal)[]>; private _getApprovals; /** * Asynchronously fetches approvals associated with given proposal IDs. * * @async * @param {string[] | string} [proposal_ids] - Optional proposal IDs to filter the approvals by. * @returns {Promise>} - * A Promise that resolves to a Map. Each key in the map is a proposal ID, and the corresponding value is an array * of approved proposals associated with that proposal ID. * * @example * const approvalsMap = await getApprovals(['proposal1', 'proposal2']); * const allApprovalsMap = await getApprovals(); * * @throws {Error} - Throws an error if there is a failure in fetching approvals. */ getApprovals: (proposal_ids?: string[] | string) => Promise>; /** * Asynchronously fetches approved proposals by their associated policy IDs. * * @async * @method * @param {string[] | string} policy_ids - A single policy ID or an array of policy IDs for which to fetch approved proposals. * If this is not specified, the function fetches approvals for all available policy IDs. * @returns {Promise>>} * - A promise that resolves to a Map. Each key in the map corresponds to a policy ID. * The value is either a single PublishedApprovedProposal object or an array of PublishedApprovedProposal objects. * * @throws {Error} - Throws an error if there is a failure in fetching the approved proposals. * * @example * // Fetch approvals for a single policy ID * const approvals = await getApprovalsByPolicyId('some-policy-id'); * * // Fetch approvals for multiple policy IDs * const approvals = await getApprovalsByPolicyId(['policy-id-1', 'policy-id-2']); * * @see SmartVaultsTypes.PublishedApprovedProposal - For the structure of a PublishedApprovedProposal object. */ getApprovalsByPolicyId: (policy_ids: string[] | string) => Promise>>; /** * @ignore */ private _getProposals; /** * Asynchronously fetches proposals by their IDs. * * @async * @param {string[] | string} proposal_ids - A single proposal ID or an array of proposal IDs to fetch. * @param {PaginationOpts} [paginationOpts={}] - Optional pagination options. * @returns {Promise>} * - A promise that resolves to a Map. Each key corresponds to a proposal ID, and the value is either a PublishedSpendingProposal or PublishedProofOfReserveProposal object. * * @throws {Error} - Throws an error if there is a failure in fetching the proposals. * * @example * const proposalsById = await getProposalsById('some-proposal-id'); */ getProposalsById(proposal_ids: string[] | string, paginationOpts?: PaginationOpts): Promise>; /** * Asynchronously fetches proposals by associated policy IDs. * * @async * @param {string[] | string} policy_ids - A single policy ID or an array of policy IDs for which to fetch proposals. * @param {PaginationOpts} [paginationOpts={}] - Optional pagination options. * @returns {Promise>>} * - A promise that resolves to a Map. Each key corresponds to a policy ID, and the value is either a single PublishedSpendingProposal or PublishedProofOfReserveProposal object or an array of them. * * @throws {Error} - Throws an error if there is a failure in fetching the proposals. * * @example * const proposalsByPolicyId = await getProposalsByPolicyId('some-policy-id'); */ getProposalsByPolicyId: (policy_ids: string[] | string, paginationOpts?: PaginationOpts) => Promise>>; /** * Method to retrieve and decrypt not completed proposals. * * This method retrieves all not completed proposals. * * @returns A Promise that resolves to an array of decrypted proposals. */ getProposals(paginationOpts?: PaginationOpts): Promise>; /** * Method to check if a proposal's PSBTs can be finalized. * * This method retrieves all approvals for a given proposal ID, filters out the approvals that are expired, * and checks if the PSBTs for the active approvals can be finalized. * * @param proposalId - The ID of the proposal to check. * * @returns A Promise that resolves to a boolean indicating whether the PSBTs for the given proposal can be finalized. */ checkPsbts: (proposalId: string) => Promise; /** * Method to finalize a spending proposal. * * This method finalizes a spending proposal by doing the following: * 1. It retrieves the proposal by ID and ensures it's a spending proposal. * 2. It fetches the associated policy. * 3. It retrieves all active approvals for the given proposal ID and checks if their PSBTs can be finalized. * 4. If the PSBTs can be finalized, it proceeds to finalize the transaction and broadcast the proposal. * 5. It then encrypts the completed proposal and builds two events: a completed proposal event and a proposal deletion event. * 6. Both events are published * 7. Finally, it constructs and returns the published completed proposal. * * @param proposalId - The ID of the spending proposal to finalize. * * @returns A Promise that resolves to a `PublishedCompletedSpendingProposal` object representing the finalized proposal. * * @throws An error if the proposal or policy cannot be found, if there are no approvals for the proposal, if the PSBTs cannot be finalized, or if the proposal cannot be broadcast. */ finalizeSpendingProposal(proposalId: string): Promise; private getProposalsWithCommonUtxos; /** * Retrieves a completed proposal based on the provided transaction details. * * @async * @function getCompletedProposalByTx * @param {TrxDetails | BasicTrxDetails} tx - Object containing the transaction details. * @returns {Promise} A Promise that resolves with the completed proposal, if found, or null. * * @example * getCompletedProposalByTx({txid: '1234', confirmation_time: {confirmedAt: new Date()}, net: -1}) * */ getCompletedProposalByTx(tx: TrxDetails | BasicTrxDetails): Promise; /** * Asynchronously deletes approvals with the given IDs. * * @async * @param {string | string[]} ids - Single or multiple approval IDs to be deleted. * @returns {Promise} - A promise that resolves to `void` when the operation is successful. * @throws {Error} - Throws an error if the deletion process fails. * * @example * await deleteApprovals('some-approval-id'); */ deleteApprovals(ids: string | string[]): Promise; /** * Asynchronously deletes proposals with the given IDs. * * @async * @param {string | string[]} ids - Single or multiple proposal IDs to be deleted. * @returns {Promise} - A promise that resolves to `void` when the operation is successful. * @throws {Error} - Throws an error if the deletion process fails. * * @example * await deleteProposals('some-proposal-id'); */ deleteProposals(ids: string | string[]): Promise; /** * Asynchronously deletes completed proposals with the given IDs. * * @async * @param {string | string[]} ids - Single or multiple completed proposal IDs to be deleted. * @returns {Promise} - A promise that resolves to `void` when the operation is successful. * @throws {Error} - Throws an error if the deletion process fails. * * @example * await deleteCompletedProposals('some-completed-proposal-id'); */ deleteCompletedProposals(ids: string | string[]): Promise; /** * Asynchronously deletes signers with the given IDs. * * @async * @param {string | string[]} ids - Single or multiple signer IDs to be deleted. * @returns {Promise} - A promise that resolves to `void` when the operation is successful. * @throws {Error} - Throws an error if the deletion process fails. * * @example * await deleteSigners('some-signer-id'); */ deleteSigners(ids: string | string[]): Promise; /** * Asynchronously deletes policies with the given IDs. * * @async * @param {string | string[]} ids - Single or multiple policy IDs to be deleted. * @returns {Promise} - A promise that resolves to `void` when the operation is successful. * @throws {Error} - Throws an error if the deletion process fails. * * @example * await deletePolicies('some-policy-id'); */ deletePolicies(ids: string | string[]): Promise; /** * Asynchronously revokes shared signers with the given IDs. * * @async * @param {string | string[]} ids - Single or multiple shared signer IDs to be revoked ( not signer ids ). * @returns {Promise} - A promise that resolves to `void` when the operation is successful. * @throws {Error} - Throws an error if the revocation process fails or if a shared signer with the given ID is not found. * * @example * await revokeMySharedSigners('some-shared-signer-id'); */ revokeMySharedSigners(ids: string | string[]): Promise; /** * @ignore */ _saveProofOfReserveProposal(policy_id: string, { "ProofOfReserve": { message, psbt, descriptor } }: { ProofOfReserve: { message: any; psbt: any; descriptor: any; }; }): Promise; /** * @ignore */ _saveApprovedProposal(proposal_id: string): Promise; /** * @ignore */ _saveCompletedProposal(proposal_id: string, payload: SmartVaultsTypes.CompletedProofOfReserveProposal | SmartVaultsTypes.CompletedSpendingProposal): Promise; private sha256; private generateIdentifier; /** * Asynchronously saves a label associated with a given policy ID. * * The method creates and publishes a Labels event. * * @async * @param {string} policyId - The ID of the policy to which the label is to be associated. * @param {SmartVaultsTypes.Label} label - The label object containing the data to be saved. * @returns {Promise} - A promise that resolves to the published label. * * @throws {Error} - Throws an error if the policy event retrieval fails, or if shared keys are not found. * * @example * const publishedLabel = await saveLabel('some-policy-id', { data: { 'Address': 'some-address' }, text: 'some-label-text' }); */ saveLabel(policyId: string, label: SmartVaultsTypes.Label): Promise; private _getLabels; /** * Asynchronously retrieves labels based on the given pagination options. * * @async * @param {PaginationOpts} [paginationOpts={}] - Optional pagination options for fetching labels. * @returns {Promise} - A promise that resolves to an array of published labels. * * @example * const labels = await getLabels(); */ getLabels(paginationOpts?: PaginationOpts): Promise; /** * Asynchronously retrieves labels associated with one or more policy IDs. * * This method first converts the input into an array of policy IDs (if not already), * builds the appropriate filter with pagination options, and then fetches the labels. * * @async * @param {string[] | string} policy_ids - The policy IDs to filter labels by. * @param {PaginationOpts} [paginationOpts={}] - Optional pagination options. * @returns {Promise>>} - * A promise that resolves to a map where the keys are policy IDs and the values are the associated labels. * * @example * const labelsMap = await getLabelsByPolicyId(['policy1', 'policy2']); */ getLabelsByPolicyId: (policy_ids: string[] | string, paginationOpts?: PaginationOpts) => Promise>>; /** * Asynchronously retrieves one or more labels by their IDs. * * @async * @param {string[] | string} label_ids - The label IDs to fetch. * @param {PaginationOpts} [paginationOpts={}] - Optional pagination options. * @returns {Promise>} - * A promise that resolves to a map where the keys are label IDs and the values are the corresponding labels. * * @example * const labelsMap = await getLabelById(['label1', 'label2']); */ getLabelById(label_ids: string[] | string, paginationOpts?: PaginationOpts): Promise>; }