@unicitylabs/sphere-sdk 0.7.1-dev.3 → 0.7.2

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.
@@ -2363,6 +2363,20 @@ declare function signMessage(privateKeyHex: string, message: string): string;
2363
2363
  * @returns `true` if the signature is valid and matches the expected public key
2364
2364
  */
2365
2365
  declare function verifySignedMessage(message: string, signature: string, expectedPubkey: string): boolean;
2366
+ /**
2367
+ * Recover the compressed secp256k1 public key from a signed message.
2368
+ *
2369
+ * Use this when the server needs to identify the signer (not just verify
2370
+ * a signature against a known pubkey). Combined with `sphere.resolve(pubkey)`
2371
+ * it gives a fully cryptographically-attributable identity for backend auth,
2372
+ * without trusting any client-supplied identifier claim.
2373
+ *
2374
+ * @param message - The plaintext that was signed
2375
+ * @param signature - 130-char hex (v + r + s) as produced by `signMessage`
2376
+ * @returns - Compressed 66-char hex pubkey
2377
+ * @throws - On malformed signature length or out-of-range recovery byte
2378
+ */
2379
+ declare function recoverPubkeyFromSignature(message: string, signature: string): string;
2366
2380
 
2367
2381
  /**
2368
2382
  * Result of an instant split send operation
@@ -4313,6 +4327,42 @@ declare class PaymentsModule {
4313
4327
  * @returns MintNametagResult with success status and token if successful
4314
4328
  */
4315
4329
  mintNametag(nametag: string): Promise<MintNametagResult>;
4330
+ /**
4331
+ * Mint a fungible token directly to this wallet (genesis mint).
4332
+ *
4333
+ * Useful for test setups that need to seed a wallet with specific token
4334
+ * balances WITHOUT depending on the testnet faucet HTTP service. The
4335
+ * resulting token has the canonical CoinId bytes (passed in `coinIdHex`)
4336
+ * — when those bytes match a registered symbol in the TokenRegistry,
4337
+ * the token shows up under the symbol's name (e.g. "UCT"). There is no
4338
+ * cryptographic restriction on which key may issue a given CoinId; the
4339
+ * aggregator records the mint regardless of issuer identity.
4340
+ *
4341
+ * The flow:
4342
+ * 1. Generate a random TokenId.
4343
+ * 2. Build TokenCoinData with [(coinId, amount)].
4344
+ * 3. Build MintTransactionData with recipient = self (UnmaskedPredicate
4345
+ * from this wallet's signing service).
4346
+ * 4. Submit MintCommitment to the aggregator.
4347
+ * 5. Wait for the inclusion proof.
4348
+ * 6. Construct an SDK Token via Token.mint().
4349
+ * 7. Convert to wallet Token format and call addToken().
4350
+ *
4351
+ * @param coinIdHex - 64-char lowercase hex CoinId. Must match the bytes
4352
+ * used by the registered symbol if you want the wallet to recognize
4353
+ * the token as that symbol (e.g. UCT's coinId from the public registry).
4354
+ * @param amount - Amount in smallest units (multiply by 10^decimals
4355
+ * when converting from human values).
4356
+ * @returns Result with the resulting wallet Token and its on-chain id.
4357
+ */
4358
+ mintFungibleToken(coinIdHex: string, amount: bigint): Promise<{
4359
+ success: true;
4360
+ token: Token;
4361
+ tokenId: string;
4362
+ } | {
4363
+ success: false;
4364
+ error: string;
4365
+ }>;
4316
4366
  /**
4317
4367
  * Check if a nametag is available for minting
4318
4368
  * @param nametag - The nametag to check (e.g., "alice" or "@alice")
@@ -4792,6 +4842,24 @@ declare class AccountingModule {
4792
4842
  private dirtyLedgerEntries;
4793
4843
  /** Count of unknown (not in invoiceTermsCache) invoice IDs in the ledger. */
4794
4844
  private unknownLedgerCount;
4845
+ /**
4846
+ * Per-unknown-invoice first-seen timestamp for TTL eviction.
4847
+ *
4848
+ * W1 (steelman round-4): without TTL, an attacker who can deliver 500
4849
+ * inbound transfers with synthesized memo invoiceIds permanently exhausts
4850
+ * the unknown-ledger cap, after which legitimate orphan transfers (out-of-
4851
+ * order delivery for real swaps) are silently dropped at the cap-check.
4852
+ *
4853
+ * Round-5 perf: gated by `unknownLedgerNextSweepMs` to amortize the
4854
+ * sweep cost. The naive every-call sweep is O(N) where N=cap=500;
4855
+ * combined with the per-token cleanup loop inside the sweep it became
4856
+ * O(N×M) on every transfer under flood. Now we sweep at most every
4857
+ * `UNKNOWN_LEDGER_SWEEP_INTERVAL_MS` (60s) UNLESS the cap is currently
4858
+ * full, in which case we sweep on each call (the only path that can
4859
+ * actually drop a legitimate orphan).
4860
+ */
4861
+ private unknownLedgerFirstSeen;
4862
+ private unknownLedgerNextSweepMs;
4795
4863
  /** W17: Tracks whether tokenScanState has been mutated since last flush. */
4796
4864
  private tokenScanDirty;
4797
4865
  /** W2 fix: Serialization guard for _flushDirtyLedgerEntries. */
@@ -4976,6 +5044,21 @@ declare class AccountingModule {
4976
5044
  * @throws {SphereError} `NOT_INITIALIZED` — module not initialized.
4977
5045
  */
4978
5046
  getInvoice(invoiceId: string): InvoiceRef | null;
5047
+ /**
5048
+ * Return the set of token IDs that are currently linked to the given
5049
+ * invoice. Populated by both the on-chain `_processTokenTransactions`
5050
+ * path (tokens with `inv:` references) and the transport-memo orphan
5051
+ * buffering path in `_handleIncomingTransfer`.
5052
+ *
5053
+ * Used by callers that want to scope per-invoice operations (e.g.
5054
+ * SwapModule.verifyPayout's L3 validation) to only the tokens that
5055
+ * cover this invoice — avoiding false negatives when the wallet
5056
+ * contains unrelated tokens of the same currency in unconfirmed or
5057
+ * spent state.
5058
+ *
5059
+ * Returns an empty set if no tokens are currently linked.
5060
+ */
5061
+ getTokenIdsForInvoice(invoiceId: string): Set<string>;
4979
5062
  /**
4980
5063
  * Explicitly close an invoice. Only target parties may close (§8.3).
4981
5064
  *
@@ -5323,6 +5406,35 @@ declare class AccountingModule {
5323
5406
  * await and the null assignment, so we loop until the field is null.
5324
5407
  */
5325
5408
  private _drainFlushPromise;
5409
+ /**
5410
+ * Synchronously persist any pending provisional ledger entry for `invoiceId`
5411
+ * before returning to the caller. Used by `payInvoice` and
5412
+ * `returnInvoicePayment` to make the in-memory provisional entry durable
5413
+ * inside the same per-invoice gate that wrote it, closing the
5414
+ * crash-mid-conclude race that produces over-coverage on receivers.
5415
+ *
5416
+ * Implementation:
5417
+ * 1. Schedule a flush via the existing `_flushPromise` chain (so
5418
+ * concurrent `_handleTokenChange` callers waiting on the chain
5419
+ * observe ours as part of the sequence).
5420
+ * 2. Await OUR flush directly — NOT `_drainFlushPromise()`, which would
5421
+ * spin while concurrent token changes keep extending the chain and
5422
+ * hold the per-invoice gate for an unbounded number of additional
5423
+ * flushes. We only need OUR provisional entry durable.
5424
+ * 3. `_flushDirtyLedgerEntries` swallows per-invoice `storage.set`
5425
+ * rejections internally (sets a local `step1Failed` flag), leaving
5426
+ * the dirty entry on the set without re-throwing. So we post-check
5427
+ * `dirtyLedgerEntries.has(invoiceId)` and throw a `STORAGE_ERROR`
5428
+ * `SphereError` if our entry is still dirty — propagating to the
5429
+ * caller so they learn about the durability failure rather than
5430
+ * receiving a silent "success" return that lies on disk.
5431
+ *
5432
+ * @param invoiceId The invoice whose provisional entry must be durable.
5433
+ * @param callContext Used in the error message so the caller is named
5434
+ * ('payInvoice' / 'returnInvoicePayment') without
5435
+ * forcing a stack-trace inspection.
5436
+ */
5437
+ private _persistProvisionalAndVerify;
5326
5438
  /**
5327
5439
  * Handle an incoming transfer event from PaymentsModule (§6.2).
5328
5440
  *
@@ -7880,4 +7992,4 @@ interface CheckNetworkHealthOptions {
7880
7992
  */
7881
7993
  declare function checkNetworkHealth(network?: NetworkType, options?: CheckNetworkHealthOptions): Promise<NetworkHealthResult>;
7882
7994
 
7883
- export { type AddressInfo, type AddressModuleSet, CHARSET, type CheckNetworkHealthOptions, CurrencyUtils, DEFAULT_DERIVATION_PATH, DEFAULT_TOKEN_DECIMALS, type DerivedKey, type DiscoverAddressProgress, type DiscoverAddressesOptions, type DiscoverAddressesResult, type DiscoveredAddress, type EncryptedData, type EncryptionOptions, type InitProgress, type InitProgressCallback, type InitProgressStep, type KeyPair, type L1Config, type LogHandler, type LogLevel, type LoggerConfig, type MasterKey, SIGN_MESSAGE_PREFIX, type ScanAddressProgress, type ScanAddressesOptions, type ScanAddressesResult, type ScannedAddressResult, Sphere, type SphereCreateOptions, SphereError, type SphereErrorCode, type SphereImportOptions, type SphereInitOptions, type SphereInitResult, type SphereLoadOptions, base58Decode, base58Encode, bytesToHex, checkNetworkHealth, computeHash160, convertBits, createAddress, createBech32, createKeyPair, createSphere, decodeBech32, decrypt, decryptJson, decryptMnemonic, decryptSimple, decryptWithSalt, deriveAddressInfo, deriveChildKey, deriveKeyAtPath, deserializeEncrypted, discoverAddressesImpl, doubleSha256, ec, encodeBech32, encrypt, encryptMnemonic, encryptSimple, entropyToMnemonic, extractFromText, findPattern, formatAmount, generateAddressInfo, generateMasterKey, generateMnemonic, generateRandomKey, getAddressHrp, getPublicKey, getSphere, hash160, hash160ToBytes, hashSignMessage, hexToBytes, identityFromMnemonic, identityFromMnemonicSync, importSphere, initSphere, isEncryptedData, isSphereError, isValidBech32, isValidNametag, isValidPrivateKey, loadSphere, logger, mnemonicToEntropy, mnemonicToSeed, mnemonicToSeedSync, privateKeyToAddressInfo, publicKeyToAddress, randomBytes, randomHex, randomUUID, ripemd160, scanAddressesImpl, serializeEncrypted, sha256, signMessage, sleep, sphereExists, toHumanReadable, toSmallestUnit, validateMnemonic, verifySignedMessage };
7995
+ export { type AddressInfo, type AddressModuleSet, CHARSET, type CheckNetworkHealthOptions, CurrencyUtils, DEFAULT_DERIVATION_PATH, DEFAULT_TOKEN_DECIMALS, type DerivedKey, type DiscoverAddressProgress, type DiscoverAddressesOptions, type DiscoverAddressesResult, type DiscoveredAddress, type EncryptedData, type EncryptionOptions, type InitProgress, type InitProgressCallback, type InitProgressStep, type KeyPair, type L1Config, type LogHandler, type LogLevel, type LoggerConfig, type MasterKey, SIGN_MESSAGE_PREFIX, type ScanAddressProgress, type ScanAddressesOptions, type ScanAddressesResult, type ScannedAddressResult, Sphere, type SphereCreateOptions, SphereError, type SphereErrorCode, type SphereImportOptions, type SphereInitOptions, type SphereInitResult, type SphereLoadOptions, base58Decode, base58Encode, bytesToHex, checkNetworkHealth, computeHash160, convertBits, createAddress, createBech32, createKeyPair, createSphere, decodeBech32, decrypt, decryptJson, decryptMnemonic, decryptSimple, decryptWithSalt, deriveAddressInfo, deriveChildKey, deriveKeyAtPath, deserializeEncrypted, discoverAddressesImpl, doubleSha256, ec, encodeBech32, encrypt, encryptMnemonic, encryptSimple, entropyToMnemonic, extractFromText, findPattern, formatAmount, generateAddressInfo, generateMasterKey, generateMnemonic, generateRandomKey, getAddressHrp, getPublicKey, getSphere, hash160, hash160ToBytes, hashSignMessage, hexToBytes, identityFromMnemonic, identityFromMnemonicSync, importSphere, initSphere, isEncryptedData, isSphereError, isValidBech32, isValidNametag, isValidPrivateKey, loadSphere, logger, mnemonicToEntropy, mnemonicToSeed, mnemonicToSeedSync, privateKeyToAddressInfo, publicKeyToAddress, randomBytes, randomHex, randomUUID, recoverPubkeyFromSignature, ripemd160, scanAddressesImpl, serializeEncrypted, sha256, signMessage, sleep, sphereExists, toHumanReadable, toSmallestUnit, validateMnemonic, verifySignedMessage };
@@ -2363,6 +2363,20 @@ declare function signMessage(privateKeyHex: string, message: string): string;
2363
2363
  * @returns `true` if the signature is valid and matches the expected public key
2364
2364
  */
2365
2365
  declare function verifySignedMessage(message: string, signature: string, expectedPubkey: string): boolean;
2366
+ /**
2367
+ * Recover the compressed secp256k1 public key from a signed message.
2368
+ *
2369
+ * Use this when the server needs to identify the signer (not just verify
2370
+ * a signature against a known pubkey). Combined with `sphere.resolve(pubkey)`
2371
+ * it gives a fully cryptographically-attributable identity for backend auth,
2372
+ * without trusting any client-supplied identifier claim.
2373
+ *
2374
+ * @param message - The plaintext that was signed
2375
+ * @param signature - 130-char hex (v + r + s) as produced by `signMessage`
2376
+ * @returns - Compressed 66-char hex pubkey
2377
+ * @throws - On malformed signature length or out-of-range recovery byte
2378
+ */
2379
+ declare function recoverPubkeyFromSignature(message: string, signature: string): string;
2366
2380
 
2367
2381
  /**
2368
2382
  * Result of an instant split send operation
@@ -4313,6 +4327,42 @@ declare class PaymentsModule {
4313
4327
  * @returns MintNametagResult with success status and token if successful
4314
4328
  */
4315
4329
  mintNametag(nametag: string): Promise<MintNametagResult>;
4330
+ /**
4331
+ * Mint a fungible token directly to this wallet (genesis mint).
4332
+ *
4333
+ * Useful for test setups that need to seed a wallet with specific token
4334
+ * balances WITHOUT depending on the testnet faucet HTTP service. The
4335
+ * resulting token has the canonical CoinId bytes (passed in `coinIdHex`)
4336
+ * — when those bytes match a registered symbol in the TokenRegistry,
4337
+ * the token shows up under the symbol's name (e.g. "UCT"). There is no
4338
+ * cryptographic restriction on which key may issue a given CoinId; the
4339
+ * aggregator records the mint regardless of issuer identity.
4340
+ *
4341
+ * The flow:
4342
+ * 1. Generate a random TokenId.
4343
+ * 2. Build TokenCoinData with [(coinId, amount)].
4344
+ * 3. Build MintTransactionData with recipient = self (UnmaskedPredicate
4345
+ * from this wallet's signing service).
4346
+ * 4. Submit MintCommitment to the aggregator.
4347
+ * 5. Wait for the inclusion proof.
4348
+ * 6. Construct an SDK Token via Token.mint().
4349
+ * 7. Convert to wallet Token format and call addToken().
4350
+ *
4351
+ * @param coinIdHex - 64-char lowercase hex CoinId. Must match the bytes
4352
+ * used by the registered symbol if you want the wallet to recognize
4353
+ * the token as that symbol (e.g. UCT's coinId from the public registry).
4354
+ * @param amount - Amount in smallest units (multiply by 10^decimals
4355
+ * when converting from human values).
4356
+ * @returns Result with the resulting wallet Token and its on-chain id.
4357
+ */
4358
+ mintFungibleToken(coinIdHex: string, amount: bigint): Promise<{
4359
+ success: true;
4360
+ token: Token;
4361
+ tokenId: string;
4362
+ } | {
4363
+ success: false;
4364
+ error: string;
4365
+ }>;
4316
4366
  /**
4317
4367
  * Check if a nametag is available for minting
4318
4368
  * @param nametag - The nametag to check (e.g., "alice" or "@alice")
@@ -4792,6 +4842,24 @@ declare class AccountingModule {
4792
4842
  private dirtyLedgerEntries;
4793
4843
  /** Count of unknown (not in invoiceTermsCache) invoice IDs in the ledger. */
4794
4844
  private unknownLedgerCount;
4845
+ /**
4846
+ * Per-unknown-invoice first-seen timestamp for TTL eviction.
4847
+ *
4848
+ * W1 (steelman round-4): without TTL, an attacker who can deliver 500
4849
+ * inbound transfers with synthesized memo invoiceIds permanently exhausts
4850
+ * the unknown-ledger cap, after which legitimate orphan transfers (out-of-
4851
+ * order delivery for real swaps) are silently dropped at the cap-check.
4852
+ *
4853
+ * Round-5 perf: gated by `unknownLedgerNextSweepMs` to amortize the
4854
+ * sweep cost. The naive every-call sweep is O(N) where N=cap=500;
4855
+ * combined with the per-token cleanup loop inside the sweep it became
4856
+ * O(N×M) on every transfer under flood. Now we sweep at most every
4857
+ * `UNKNOWN_LEDGER_SWEEP_INTERVAL_MS` (60s) UNLESS the cap is currently
4858
+ * full, in which case we sweep on each call (the only path that can
4859
+ * actually drop a legitimate orphan).
4860
+ */
4861
+ private unknownLedgerFirstSeen;
4862
+ private unknownLedgerNextSweepMs;
4795
4863
  /** W17: Tracks whether tokenScanState has been mutated since last flush. */
4796
4864
  private tokenScanDirty;
4797
4865
  /** W2 fix: Serialization guard for _flushDirtyLedgerEntries. */
@@ -4976,6 +5044,21 @@ declare class AccountingModule {
4976
5044
  * @throws {SphereError} `NOT_INITIALIZED` — module not initialized.
4977
5045
  */
4978
5046
  getInvoice(invoiceId: string): InvoiceRef | null;
5047
+ /**
5048
+ * Return the set of token IDs that are currently linked to the given
5049
+ * invoice. Populated by both the on-chain `_processTokenTransactions`
5050
+ * path (tokens with `inv:` references) and the transport-memo orphan
5051
+ * buffering path in `_handleIncomingTransfer`.
5052
+ *
5053
+ * Used by callers that want to scope per-invoice operations (e.g.
5054
+ * SwapModule.verifyPayout's L3 validation) to only the tokens that
5055
+ * cover this invoice — avoiding false negatives when the wallet
5056
+ * contains unrelated tokens of the same currency in unconfirmed or
5057
+ * spent state.
5058
+ *
5059
+ * Returns an empty set if no tokens are currently linked.
5060
+ */
5061
+ getTokenIdsForInvoice(invoiceId: string): Set<string>;
4979
5062
  /**
4980
5063
  * Explicitly close an invoice. Only target parties may close (§8.3).
4981
5064
  *
@@ -5323,6 +5406,35 @@ declare class AccountingModule {
5323
5406
  * await and the null assignment, so we loop until the field is null.
5324
5407
  */
5325
5408
  private _drainFlushPromise;
5409
+ /**
5410
+ * Synchronously persist any pending provisional ledger entry for `invoiceId`
5411
+ * before returning to the caller. Used by `payInvoice` and
5412
+ * `returnInvoicePayment` to make the in-memory provisional entry durable
5413
+ * inside the same per-invoice gate that wrote it, closing the
5414
+ * crash-mid-conclude race that produces over-coverage on receivers.
5415
+ *
5416
+ * Implementation:
5417
+ * 1. Schedule a flush via the existing `_flushPromise` chain (so
5418
+ * concurrent `_handleTokenChange` callers waiting on the chain
5419
+ * observe ours as part of the sequence).
5420
+ * 2. Await OUR flush directly — NOT `_drainFlushPromise()`, which would
5421
+ * spin while concurrent token changes keep extending the chain and
5422
+ * hold the per-invoice gate for an unbounded number of additional
5423
+ * flushes. We only need OUR provisional entry durable.
5424
+ * 3. `_flushDirtyLedgerEntries` swallows per-invoice `storage.set`
5425
+ * rejections internally (sets a local `step1Failed` flag), leaving
5426
+ * the dirty entry on the set without re-throwing. So we post-check
5427
+ * `dirtyLedgerEntries.has(invoiceId)` and throw a `STORAGE_ERROR`
5428
+ * `SphereError` if our entry is still dirty — propagating to the
5429
+ * caller so they learn about the durability failure rather than
5430
+ * receiving a silent "success" return that lies on disk.
5431
+ *
5432
+ * @param invoiceId The invoice whose provisional entry must be durable.
5433
+ * @param callContext Used in the error message so the caller is named
5434
+ * ('payInvoice' / 'returnInvoicePayment') without
5435
+ * forcing a stack-trace inspection.
5436
+ */
5437
+ private _persistProvisionalAndVerify;
5326
5438
  /**
5327
5439
  * Handle an incoming transfer event from PaymentsModule (§6.2).
5328
5440
  *
@@ -7880,4 +7992,4 @@ interface CheckNetworkHealthOptions {
7880
7992
  */
7881
7993
  declare function checkNetworkHealth(network?: NetworkType, options?: CheckNetworkHealthOptions): Promise<NetworkHealthResult>;
7882
7994
 
7883
- export { type AddressInfo, type AddressModuleSet, CHARSET, type CheckNetworkHealthOptions, CurrencyUtils, DEFAULT_DERIVATION_PATH, DEFAULT_TOKEN_DECIMALS, type DerivedKey, type DiscoverAddressProgress, type DiscoverAddressesOptions, type DiscoverAddressesResult, type DiscoveredAddress, type EncryptedData, type EncryptionOptions, type InitProgress, type InitProgressCallback, type InitProgressStep, type KeyPair, type L1Config, type LogHandler, type LogLevel, type LoggerConfig, type MasterKey, SIGN_MESSAGE_PREFIX, type ScanAddressProgress, type ScanAddressesOptions, type ScanAddressesResult, type ScannedAddressResult, Sphere, type SphereCreateOptions, SphereError, type SphereErrorCode, type SphereImportOptions, type SphereInitOptions, type SphereInitResult, type SphereLoadOptions, base58Decode, base58Encode, bytesToHex, checkNetworkHealth, computeHash160, convertBits, createAddress, createBech32, createKeyPair, createSphere, decodeBech32, decrypt, decryptJson, decryptMnemonic, decryptSimple, decryptWithSalt, deriveAddressInfo, deriveChildKey, deriveKeyAtPath, deserializeEncrypted, discoverAddressesImpl, doubleSha256, ec, encodeBech32, encrypt, encryptMnemonic, encryptSimple, entropyToMnemonic, extractFromText, findPattern, formatAmount, generateAddressInfo, generateMasterKey, generateMnemonic, generateRandomKey, getAddressHrp, getPublicKey, getSphere, hash160, hash160ToBytes, hashSignMessage, hexToBytes, identityFromMnemonic, identityFromMnemonicSync, importSphere, initSphere, isEncryptedData, isSphereError, isValidBech32, isValidNametag, isValidPrivateKey, loadSphere, logger, mnemonicToEntropy, mnemonicToSeed, mnemonicToSeedSync, privateKeyToAddressInfo, publicKeyToAddress, randomBytes, randomHex, randomUUID, ripemd160, scanAddressesImpl, serializeEncrypted, sha256, signMessage, sleep, sphereExists, toHumanReadable, toSmallestUnit, validateMnemonic, verifySignedMessage };
7995
+ export { type AddressInfo, type AddressModuleSet, CHARSET, type CheckNetworkHealthOptions, CurrencyUtils, DEFAULT_DERIVATION_PATH, DEFAULT_TOKEN_DECIMALS, type DerivedKey, type DiscoverAddressProgress, type DiscoverAddressesOptions, type DiscoverAddressesResult, type DiscoveredAddress, type EncryptedData, type EncryptionOptions, type InitProgress, type InitProgressCallback, type InitProgressStep, type KeyPair, type L1Config, type LogHandler, type LogLevel, type LoggerConfig, type MasterKey, SIGN_MESSAGE_PREFIX, type ScanAddressProgress, type ScanAddressesOptions, type ScanAddressesResult, type ScannedAddressResult, Sphere, type SphereCreateOptions, SphereError, type SphereErrorCode, type SphereImportOptions, type SphereInitOptions, type SphereInitResult, type SphereLoadOptions, base58Decode, base58Encode, bytesToHex, checkNetworkHealth, computeHash160, convertBits, createAddress, createBech32, createKeyPair, createSphere, decodeBech32, decrypt, decryptJson, decryptMnemonic, decryptSimple, decryptWithSalt, deriveAddressInfo, deriveChildKey, deriveKeyAtPath, deserializeEncrypted, discoverAddressesImpl, doubleSha256, ec, encodeBech32, encrypt, encryptMnemonic, encryptSimple, entropyToMnemonic, extractFromText, findPattern, formatAmount, generateAddressInfo, generateMasterKey, generateMnemonic, generateRandomKey, getAddressHrp, getPublicKey, getSphere, hash160, hash160ToBytes, hashSignMessage, hexToBytes, identityFromMnemonic, identityFromMnemonicSync, importSphere, initSphere, isEncryptedData, isSphereError, isValidBech32, isValidNametag, isValidPrivateKey, loadSphere, logger, mnemonicToEntropy, mnemonicToSeed, mnemonicToSeedSync, privateKeyToAddressInfo, publicKeyToAddress, randomBytes, randomHex, randomUUID, recoverPubkeyFromSignature, ripemd160, scanAddressesImpl, serializeEncrypted, sha256, signMessage, sleep, sphereExists, toHumanReadable, toSmallestUnit, validateMnemonic, verifySignedMessage };