@bsv/wallet-toolbox 1.3.20 → 1.3.22
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/.github/workflows/push.yaml +5 -0
- package/mobile/out/src/CWIStyleWalletManager.d.ts +437 -0
- package/mobile/out/src/CWIStyleWalletManager.d.ts.map +1 -0
- package/mobile/out/src/CWIStyleWalletManager.js +1255 -0
- package/mobile/out/src/CWIStyleWalletManager.js.map +1 -0
- package/mobile/out/src/SetupClient.d.ts +126 -0
- package/mobile/out/src/SetupClient.d.ts.map +1 -0
- package/mobile/out/src/SetupClient.js +220 -0
- package/mobile/out/src/SetupClient.js.map +1 -0
- package/mobile/out/src/SetupWallet.d.ts +100 -0
- package/mobile/out/src/SetupWallet.d.ts.map +1 -0
- package/mobile/out/src/SetupWallet.js +3 -0
- package/mobile/out/src/SetupWallet.js.map +1 -0
- package/mobile/out/src/SimpleWalletManager.d.ts +169 -0
- package/mobile/out/src/SimpleWalletManager.d.ts.map +1 -0
- package/mobile/out/src/SimpleWalletManager.js +315 -0
- package/mobile/out/src/SimpleWalletManager.js.map +1 -0
- package/mobile/out/src/Wallet.d.ts +177 -0
- package/mobile/out/src/Wallet.d.ts.map +1 -0
- package/mobile/out/src/Wallet.js +742 -0
- package/mobile/out/src/Wallet.js.map +1 -0
- package/mobile/out/src/WalletAuthenticationManager.d.ts +33 -0
- package/mobile/out/src/WalletAuthenticationManager.d.ts.map +1 -0
- package/mobile/out/src/WalletAuthenticationManager.js +113 -0
- package/mobile/out/src/WalletAuthenticationManager.js.map +1 -0
- package/mobile/out/src/WalletPermissionsManager.d.ts +598 -0
- package/mobile/out/src/WalletPermissionsManager.d.ts.map +1 -0
- package/mobile/out/src/WalletPermissionsManager.js +1868 -0
- package/mobile/out/src/WalletPermissionsManager.js.map +1 -0
- package/mobile/out/src/WalletSettingsManager.d.ts +52 -0
- package/mobile/out/src/WalletSettingsManager.d.ts.map +1 -0
- package/mobile/out/src/WalletSettingsManager.js +82 -0
- package/mobile/out/src/WalletSettingsManager.js.map +1 -0
- package/mobile/out/src/index.client.d.ts +19 -0
- package/mobile/out/src/index.client.d.ts.map +1 -0
- package/mobile/out/src/index.client.js +58 -0
- package/mobile/out/src/index.client.js.map +1 -0
- package/mobile/out/src/index.mobile.d.ts +19 -0
- package/mobile/out/src/index.mobile.d.ts.map +1 -0
- package/mobile/out/src/index.mobile.js +58 -0
- package/mobile/out/src/index.mobile.js.map +1 -0
- package/mobile/out/src/monitor/Monitor.d.ts +91 -0
- package/mobile/out/src/monitor/Monitor.d.ts.map +1 -0
- package/mobile/out/src/monitor/Monitor.js +298 -0
- package/mobile/out/src/monitor/Monitor.js.map +1 -0
- package/mobile/out/src/monitor/tasks/TaskCheckForProofs.d.ts +53 -0
- package/mobile/out/src/monitor/tasks/TaskCheckForProofs.d.ts.map +1 -0
- package/mobile/out/src/monitor/tasks/TaskCheckForProofs.js +194 -0
- package/mobile/out/src/monitor/tasks/TaskCheckForProofs.js.map +1 -0
- package/mobile/out/src/monitor/tasks/TaskCheckNoSends.d.ts +33 -0
- package/mobile/out/src/monitor/tasks/TaskCheckNoSends.d.ts.map +1 -0
- package/mobile/out/src/monitor/tasks/TaskCheckNoSends.js +65 -0
- package/mobile/out/src/monitor/tasks/TaskCheckNoSends.js.map +1 -0
- package/mobile/out/src/monitor/tasks/TaskClock.d.ts +14 -0
- package/mobile/out/src/monitor/tasks/TaskClock.d.ts.map +1 -0
- package/mobile/out/src/monitor/tasks/TaskClock.js +27 -0
- package/mobile/out/src/monitor/tasks/TaskClock.js.map +1 -0
- package/mobile/out/src/monitor/tasks/TaskFailAbandoned.d.ts +20 -0
- package/mobile/out/src/monitor/tasks/TaskFailAbandoned.d.ts.map +1 -0
- package/mobile/out/src/monitor/tasks/TaskFailAbandoned.js +52 -0
- package/mobile/out/src/monitor/tasks/TaskFailAbandoned.js.map +1 -0
- package/mobile/out/src/monitor/tasks/TaskNewHeader.d.ts +15 -0
- package/mobile/out/src/monitor/tasks/TaskNewHeader.d.ts.map +1 -0
- package/mobile/out/src/monitor/tasks/TaskNewHeader.js +43 -0
- package/mobile/out/src/monitor/tasks/TaskNewHeader.js.map +1 -0
- package/mobile/out/src/monitor/tasks/TaskPurge.d.ts +45 -0
- package/mobile/out/src/monitor/tasks/TaskPurge.d.ts.map +1 -0
- package/mobile/out/src/monitor/tasks/TaskPurge.js +34 -0
- package/mobile/out/src/monitor/tasks/TaskPurge.js.map +1 -0
- package/mobile/out/src/monitor/tasks/TaskReviewStatus.d.ts +26 -0
- package/mobile/out/src/monitor/tasks/TaskReviewStatus.d.ts.map +1 -0
- package/mobile/out/src/monitor/tasks/TaskReviewStatus.js +43 -0
- package/mobile/out/src/monitor/tasks/TaskReviewStatus.js.map +1 -0
- package/mobile/out/src/monitor/tasks/TaskSendWaiting.d.ts +35 -0
- package/mobile/out/src/monitor/tasks/TaskSendWaiting.d.ts.map +1 -0
- package/mobile/out/src/monitor/tasks/TaskSendWaiting.js +107 -0
- package/mobile/out/src/monitor/tasks/TaskSendWaiting.js.map +1 -0
- package/mobile/out/src/monitor/tasks/TaskSyncWhenIdle.d.ts +12 -0
- package/mobile/out/src/monitor/tasks/TaskSyncWhenIdle.d.ts.map +1 -0
- package/mobile/out/src/monitor/tasks/TaskSyncWhenIdle.js +22 -0
- package/mobile/out/src/monitor/tasks/TaskSyncWhenIdle.js.map +1 -0
- package/mobile/out/src/monitor/tasks/TaskUnFail.d.ts +41 -0
- package/mobile/out/src/monitor/tasks/TaskUnFail.d.ts.map +1 -0
- package/mobile/out/src/monitor/tasks/TaskUnFail.js +144 -0
- package/mobile/out/src/monitor/tasks/TaskUnFail.js.map +1 -0
- package/mobile/out/src/monitor/tasks/WalletMonitorTask.d.ts +40 -0
- package/mobile/out/src/monitor/tasks/WalletMonitorTask.d.ts.map +1 -0
- package/mobile/out/src/monitor/tasks/WalletMonitorTask.js +37 -0
- package/mobile/out/src/monitor/tasks/WalletMonitorTask.js.map +1 -0
- package/mobile/out/src/sdk/CertOpsWallet.d.ts +7 -0
- package/mobile/out/src/sdk/CertOpsWallet.d.ts.map +1 -0
- package/mobile/out/src/sdk/CertOpsWallet.js +3 -0
- package/mobile/out/src/sdk/CertOpsWallet.js.map +1 -0
- package/mobile/out/src/sdk/PrivilegedKeyManager.d.ts +125 -0
- package/mobile/out/src/sdk/PrivilegedKeyManager.d.ts.map +1 -0
- package/mobile/out/src/sdk/PrivilegedKeyManager.js +293 -0
- package/mobile/out/src/sdk/PrivilegedKeyManager.js.map +1 -0
- package/mobile/out/src/sdk/WERR_errors.d.ts +115 -0
- package/mobile/out/src/sdk/WERR_errors.d.ts.map +1 -0
- package/mobile/out/src/sdk/WERR_errors.js +158 -0
- package/mobile/out/src/sdk/WERR_errors.js.map +1 -0
- package/mobile/out/src/sdk/WalletError.d.ts +44 -0
- package/mobile/out/src/sdk/WalletError.d.ts.map +1 -0
- package/mobile/out/src/sdk/WalletError.js +118 -0
- package/mobile/out/src/sdk/WalletError.js.map +1 -0
- package/mobile/out/src/sdk/WalletServices.interfaces.d.ts +430 -0
- package/mobile/out/src/sdk/WalletServices.interfaces.d.ts.map +1 -0
- package/mobile/out/src/sdk/WalletServices.interfaces.js +3 -0
- package/mobile/out/src/sdk/WalletServices.interfaces.js.map +1 -0
- package/mobile/out/src/sdk/WalletSigner.interfaces.d.ts +10 -0
- package/mobile/out/src/sdk/WalletSigner.interfaces.d.ts.map +1 -0
- package/mobile/out/src/sdk/WalletSigner.interfaces.js +3 -0
- package/mobile/out/src/sdk/WalletSigner.interfaces.js.map +1 -0
- package/mobile/out/src/sdk/WalletStorage.interfaces.d.ts +452 -0
- package/mobile/out/src/sdk/WalletStorage.interfaces.d.ts.map +1 -0
- package/mobile/out/src/sdk/WalletStorage.interfaces.js +3 -0
- package/mobile/out/src/sdk/WalletStorage.interfaces.js.map +1 -0
- package/mobile/out/src/sdk/index.d.ts +10 -0
- package/mobile/out/src/sdk/index.d.ts.map +1 -0
- package/mobile/out/src/sdk/index.js +26 -0
- package/mobile/out/src/sdk/index.js.map +1 -0
- package/mobile/out/src/sdk/types.d.ts +158 -0
- package/mobile/out/src/sdk/types.d.ts.map +1 -0
- package/mobile/out/src/sdk/types.js +90 -0
- package/mobile/out/src/sdk/types.js.map +1 -0
- package/mobile/out/src/sdk/validationHelpers.d.ts +301 -0
- package/mobile/out/src/sdk/validationHelpers.d.ts.map +1 -0
- package/mobile/out/src/sdk/validationHelpers.js +629 -0
- package/mobile/out/src/sdk/validationHelpers.js.map +1 -0
- package/mobile/out/src/services/ServiceCollection.d.ts +25 -0
- package/mobile/out/src/services/ServiceCollection.d.ts.map +1 -0
- package/mobile/out/src/services/ServiceCollection.js +43 -0
- package/mobile/out/src/services/ServiceCollection.js.map +1 -0
- package/mobile/out/src/services/Services.d.ts +67 -0
- package/mobile/out/src/services/Services.d.ts.map +1 -0
- package/mobile/out/src/services/Services.js +391 -0
- package/mobile/out/src/services/Services.js.map +1 -0
- package/mobile/out/src/services/chaintracker/ChaintracksChainTracker.d.ts +15 -0
- package/mobile/out/src/services/chaintracker/ChaintracksChainTracker.d.ts.map +1 -0
- package/mobile/out/src/services/chaintracker/ChaintracksChainTracker.js +51 -0
- package/mobile/out/src/services/chaintracker/ChaintracksChainTracker.js.map +1 -0
- package/mobile/out/src/services/chaintracker/chaintracks/BlockHeaderApi.d.ts +98 -0
- package/mobile/out/src/services/chaintracker/chaintracks/BlockHeaderApi.d.ts.map +1 -0
- package/mobile/out/src/services/chaintracker/chaintracks/BlockHeaderApi.js +38 -0
- package/mobile/out/src/services/chaintracker/chaintracks/BlockHeaderApi.js.map +1 -0
- package/mobile/out/src/services/chaintracker/chaintracks/ChaintracksServiceClient.d.ts +36 -0
- package/mobile/out/src/services/chaintracker/chaintracks/ChaintracksServiceClient.d.ts.map +1 -0
- package/mobile/out/src/services/chaintracker/chaintracks/ChaintracksServiceClient.js +128 -0
- package/mobile/out/src/services/chaintracker/chaintracks/ChaintracksServiceClient.js.map +1 -0
- package/mobile/out/src/services/chaintracker/chaintracks/index.d.ts +3 -0
- package/mobile/out/src/services/chaintracker/chaintracks/index.d.ts.map +1 -0
- package/mobile/out/src/services/chaintracker/chaintracks/index.js +19 -0
- package/mobile/out/src/services/chaintracker/chaintracks/index.js.map +1 -0
- package/mobile/out/src/services/chaintracker/index.d.ts +3 -0
- package/mobile/out/src/services/chaintracker/index.d.ts.map +1 -0
- package/mobile/out/src/services/chaintracker/index.js +19 -0
- package/mobile/out/src/services/chaintracker/index.js.map +1 -0
- package/mobile/out/src/services/createDefaultWalletServicesOptions.d.ts +4 -0
- package/mobile/out/src/services/createDefaultWalletServicesOptions.d.ts.map +1 -0
- package/mobile/out/src/services/createDefaultWalletServicesOptions.js +46 -0
- package/mobile/out/src/services/createDefaultWalletServicesOptions.js.map +1 -0
- package/mobile/out/src/services/index.d.ts +2 -0
- package/mobile/out/src/services/index.d.ts.map +1 -0
- package/mobile/out/src/services/index.js +18 -0
- package/mobile/out/src/services/index.js.map +1 -0
- package/mobile/out/src/services/providers/ARC.d.ts +91 -0
- package/mobile/out/src/services/providers/ARC.d.ts.map +1 -0
- package/mobile/out/src/services/providers/ARC.js +267 -0
- package/mobile/out/src/services/providers/ARC.js.map +1 -0
- package/mobile/out/src/services/providers/Bitails.d.ts +49 -0
- package/mobile/out/src/services/providers/Bitails.d.ts.map +1 -0
- package/mobile/out/src/services/providers/Bitails.js +222 -0
- package/mobile/out/src/services/providers/Bitails.js.map +1 -0
- package/mobile/out/src/services/providers/SdkWhatsOnChain.d.ts +21 -0
- package/mobile/out/src/services/providers/SdkWhatsOnChain.d.ts.map +1 -0
- package/mobile/out/src/services/providers/SdkWhatsOnChain.js +67 -0
- package/mobile/out/src/services/providers/SdkWhatsOnChain.js.map +1 -0
- package/mobile/out/src/services/providers/WhatsOnChain.d.ts +71 -0
- package/mobile/out/src/services/providers/WhatsOnChain.d.ts.map +1 -0
- package/mobile/out/src/services/providers/WhatsOnChain.js +582 -0
- package/mobile/out/src/services/providers/WhatsOnChain.js.map +1 -0
- package/mobile/out/src/services/providers/echangeRates.d.ts +12 -0
- package/mobile/out/src/services/providers/echangeRates.d.ts.map +1 -0
- package/mobile/out/src/services/providers/echangeRates.js +237 -0
- package/mobile/out/src/services/providers/echangeRates.js.map +1 -0
- package/mobile/out/src/services/providers/getBeefForTxid.d.ts +4 -0
- package/mobile/out/src/services/providers/getBeefForTxid.d.ts.map +1 -0
- package/mobile/out/src/services/providers/getBeefForTxid.js +286 -0
- package/mobile/out/src/services/providers/getBeefForTxid.js.map +1 -0
- package/mobile/out/src/signer/WalletSigner.d.ts +11 -0
- package/mobile/out/src/signer/WalletSigner.d.ts.map +1 -0
- package/mobile/out/src/signer/WalletSigner.js +13 -0
- package/mobile/out/src/signer/WalletSigner.js.map +1 -0
- package/mobile/out/src/signer/methods/acquireDirectCertificate.d.ts +4 -0
- package/mobile/out/src/signer/methods/acquireDirectCertificate.d.ts.map +1 -0
- package/mobile/out/src/signer/methods/acquireDirectCertificate.js +45 -0
- package/mobile/out/src/signer/methods/acquireDirectCertificate.js.map +1 -0
- package/mobile/out/src/signer/methods/buildSignableTransaction.d.ts +10 -0
- package/mobile/out/src/signer/methods/buildSignableTransaction.d.ts.map +1 -0
- package/mobile/out/src/signer/methods/buildSignableTransaction.js +126 -0
- package/mobile/out/src/signer/methods/buildSignableTransaction.js.map +1 -0
- package/mobile/out/src/signer/methods/createAction.d.ts +20 -0
- package/mobile/out/src/signer/methods/createAction.d.ts.map +1 -0
- package/mobile/out/src/signer/methods/createAction.js +160 -0
- package/mobile/out/src/signer/methods/createAction.js.map +1 -0
- package/mobile/out/src/signer/methods/internalizeAction.d.ts +31 -0
- package/mobile/out/src/signer/methods/internalizeAction.d.ts.map +1 -0
- package/mobile/out/src/signer/methods/internalizeAction.js +95 -0
- package/mobile/out/src/signer/methods/internalizeAction.js.map +1 -0
- package/mobile/out/src/signer/methods/proveCertificate.d.ts +4 -0
- package/mobile/out/src/signer/methods/proveCertificate.d.ts.map +1 -0
- package/mobile/out/src/signer/methods/proveCertificate.js +29 -0
- package/mobile/out/src/signer/methods/proveCertificate.js.map +1 -0
- package/mobile/out/src/signer/methods/signAction.d.ts +13 -0
- package/mobile/out/src/signer/methods/signAction.d.ts.map +1 -0
- package/mobile/out/src/signer/methods/signAction.js +89 -0
- package/mobile/out/src/signer/methods/signAction.js.map +1 -0
- package/mobile/out/src/storage/StorageIdb.d.ts +208 -0
- package/mobile/out/src/storage/StorageIdb.d.ts.map +1 -0
- package/mobile/out/src/storage/StorageIdb.js +2296 -0
- package/mobile/out/src/storage/StorageIdb.js.map +1 -0
- package/mobile/out/src/storage/StorageProvider.d.ts +209 -0
- package/mobile/out/src/storage/StorageProvider.d.ts.map +1 -0
- package/mobile/out/src/storage/StorageProvider.js +550 -0
- package/mobile/out/src/storage/StorageProvider.js.map +1 -0
- package/mobile/out/src/storage/StorageReader.d.ts +76 -0
- package/mobile/out/src/storage/StorageReader.d.ts.map +1 -0
- package/mobile/out/src/storage/StorageReader.js +129 -0
- package/mobile/out/src/storage/StorageReader.js.map +1 -0
- package/mobile/out/src/storage/StorageReaderWriter.d.ts +87 -0
- package/mobile/out/src/storage/StorageReaderWriter.d.ts.map +1 -0
- package/mobile/out/src/storage/StorageReaderWriter.js +338 -0
- package/mobile/out/src/storage/StorageReaderWriter.js.map +1 -0
- package/mobile/out/src/storage/StorageSyncReader.d.ts +17 -0
- package/mobile/out/src/storage/StorageSyncReader.d.ts.map +1 -0
- package/mobile/out/src/storage/StorageSyncReader.js +38 -0
- package/mobile/out/src/storage/StorageSyncReader.js.map +1 -0
- package/mobile/out/src/storage/WalletStorageManager.d.ts +184 -0
- package/mobile/out/src/storage/WalletStorageManager.d.ts.map +1 -0
- package/mobile/out/src/storage/WalletStorageManager.js +665 -0
- package/mobile/out/src/storage/WalletStorageManager.js.map +1 -0
- package/mobile/out/src/storage/index.client.d.ts +8 -0
- package/mobile/out/src/storage/index.client.d.ts.map +1 -0
- package/mobile/out/src/storage/index.client.js +24 -0
- package/mobile/out/src/storage/index.client.js.map +1 -0
- package/mobile/out/src/storage/index.mobile.d.ts +7 -0
- package/mobile/out/src/storage/index.mobile.d.ts.map +1 -0
- package/mobile/out/src/storage/index.mobile.js +23 -0
- package/mobile/out/src/storage/index.mobile.js.map +1 -0
- package/mobile/out/src/storage/methods/ListActionsSpecOp.d.ts +16 -0
- package/mobile/out/src/storage/methods/ListActionsSpecOp.d.ts.map +1 -0
- package/mobile/out/src/storage/methods/ListActionsSpecOp.js +40 -0
- package/mobile/out/src/storage/methods/ListActionsSpecOp.js.map +1 -0
- package/mobile/out/src/storage/methods/ListOutputsSpecOp.d.ts +26 -0
- package/mobile/out/src/storage/methods/ListOutputsSpecOp.d.ts.map +1 -0
- package/mobile/out/src/storage/methods/ListOutputsSpecOp.js +71 -0
- package/mobile/out/src/storage/methods/ListOutputsSpecOp.js.map +1 -0
- package/mobile/out/src/storage/methods/attemptToPostReqsToNetwork.d.ts +41 -0
- package/mobile/out/src/storage/methods/attemptToPostReqsToNetwork.d.ts.map +1 -0
- package/mobile/out/src/storage/methods/attemptToPostReqsToNetwork.js +320 -0
- package/mobile/out/src/storage/methods/attemptToPostReqsToNetwork.js.map +1 -0
- package/mobile/out/src/storage/methods/createAction.d.ts +24 -0
- package/mobile/out/src/storage/methods/createAction.d.ts.map +1 -0
- package/mobile/out/src/storage/methods/createAction.js +705 -0
- package/mobile/out/src/storage/methods/createAction.js.map +1 -0
- package/mobile/out/src/storage/methods/generateChange.d.ts +119 -0
- package/mobile/out/src/storage/methods/generateChange.d.ts.map +1 -0
- package/mobile/out/src/storage/methods/generateChange.js +448 -0
- package/mobile/out/src/storage/methods/generateChange.js.map +1 -0
- package/mobile/out/src/storage/methods/getBeefForTransaction.d.ts +22 -0
- package/mobile/out/src/storage/methods/getBeefForTransaction.d.ts.map +1 -0
- package/mobile/out/src/storage/methods/getBeefForTransaction.js +92 -0
- package/mobile/out/src/storage/methods/getBeefForTransaction.js.map +1 -0
- package/mobile/out/src/storage/methods/getSyncChunk.d.ts +10 -0
- package/mobile/out/src/storage/methods/getSyncChunk.d.ts.map +1 -0
- package/mobile/out/src/storage/methods/getSyncChunk.js +271 -0
- package/mobile/out/src/storage/methods/getSyncChunk.js.map +1 -0
- package/mobile/out/src/storage/methods/internalizeAction.d.ts +38 -0
- package/mobile/out/src/storage/methods/internalizeAction.d.ts.map +1 -0
- package/mobile/out/src/storage/methods/internalizeAction.js +371 -0
- package/mobile/out/src/storage/methods/internalizeAction.js.map +1 -0
- package/mobile/out/src/storage/methods/listActionsIdb.d.ts +5 -0
- package/mobile/out/src/storage/methods/listActionsIdb.d.ts.map +1 -0
- package/mobile/out/src/storage/methods/listActionsIdb.js +155 -0
- package/mobile/out/src/storage/methods/listActionsIdb.js.map +1 -0
- package/mobile/out/src/storage/methods/listCertificates.d.ts +5 -0
- package/mobile/out/src/storage/methods/listCertificates.d.ts.map +1 -0
- package/mobile/out/src/storage/methods/listCertificates.js +68 -0
- package/mobile/out/src/storage/methods/listCertificates.js.map +1 -0
- package/mobile/out/src/storage/methods/listOutputsIdb.d.ts +5 -0
- package/mobile/out/src/storage/methods/listOutputsIdb.d.ts.map +1 -0
- package/mobile/out/src/storage/methods/listOutputsIdb.js +181 -0
- package/mobile/out/src/storage/methods/listOutputsIdb.js.map +1 -0
- package/mobile/out/src/storage/methods/processAction.d.ts +35 -0
- package/mobile/out/src/storage/methods/processAction.d.ts.map +1 -0
- package/mobile/out/src/storage/methods/processAction.js +311 -0
- package/mobile/out/src/storage/methods/processAction.js.map +1 -0
- package/mobile/out/src/storage/methods/purgeDataIdb.d.ts +4 -0
- package/mobile/out/src/storage/methods/purgeDataIdb.d.ts.map +1 -0
- package/mobile/out/src/storage/methods/purgeDataIdb.js +9 -0
- package/mobile/out/src/storage/methods/purgeDataIdb.js.map +1 -0
- package/mobile/out/src/storage/methods/reviewStatusIdb.d.ts +20 -0
- package/mobile/out/src/storage/methods/reviewStatusIdb.d.ts.map +1 -0
- package/mobile/out/src/storage/methods/reviewStatusIdb.js +35 -0
- package/mobile/out/src/storage/methods/reviewStatusIdb.js.map +1 -0
- package/mobile/out/src/storage/remoting/StorageClient.d.ts +283 -0
- package/mobile/out/src/storage/remoting/StorageClient.d.ts.map +1 -0
- package/mobile/out/src/storage/remoting/StorageClient.js +477 -0
- package/mobile/out/src/storage/remoting/StorageClient.js.map +1 -0
- package/mobile/out/src/storage/schema/StorageIdbSchema.d.ts +133 -0
- package/mobile/out/src/storage/schema/StorageIdbSchema.d.ts.map +1 -0
- package/mobile/out/src/storage/schema/StorageIdbSchema.js +3 -0
- package/mobile/out/src/storage/schema/StorageIdbSchema.js.map +1 -0
- package/mobile/out/src/storage/schema/entities/EntityBase.d.ts +105 -0
- package/mobile/out/src/storage/schema/entities/EntityBase.d.ts.map +1 -0
- package/mobile/out/src/storage/schema/entities/EntityBase.js +100 -0
- package/mobile/out/src/storage/schema/entities/EntityBase.js.map +1 -0
- package/mobile/out/src/storage/schema/entities/EntityCertificate.d.ts +43 -0
- package/mobile/out/src/storage/schema/entities/EntityCertificate.d.ts.map +1 -0
- package/mobile/out/src/storage/schema/entities/EntityCertificate.js +162 -0
- package/mobile/out/src/storage/schema/entities/EntityCertificate.js.map +1 -0
- package/mobile/out/src/storage/schema/entities/EntityCertificateField.d.ts +32 -0
- package/mobile/out/src/storage/schema/entities/EntityCertificateField.d.ts.map +1 -0
- package/mobile/out/src/storage/schema/entities/EntityCertificateField.js +111 -0
- package/mobile/out/src/storage/schema/entities/EntityCertificateField.js.map +1 -0
- package/mobile/out/src/storage/schema/entities/EntityCommission.d.ts +37 -0
- package/mobile/out/src/storage/schema/entities/EntityCommission.d.ts.map +1 -0
- package/mobile/out/src/storage/schema/entities/EntityCommission.js +127 -0
- package/mobile/out/src/storage/schema/entities/EntityCommission.js.map +1 -0
- package/mobile/out/src/storage/schema/entities/EntityOutput.d.ts +67 -0
- package/mobile/out/src/storage/schema/entities/EntityOutput.d.ts.map +1 -0
- package/mobile/out/src/storage/schema/entities/EntityOutput.js +264 -0
- package/mobile/out/src/storage/schema/entities/EntityOutput.js.map +1 -0
- package/mobile/out/src/storage/schema/entities/EntityOutputBasket.d.ts +35 -0
- package/mobile/out/src/storage/schema/entities/EntityOutputBasket.d.ts.map +1 -0
- package/mobile/out/src/storage/schema/entities/EntityOutputBasket.js +133 -0
- package/mobile/out/src/storage/schema/entities/EntityOutputBasket.js.map +1 -0
- package/mobile/out/src/storage/schema/entities/EntityOutputTag.d.ts +31 -0
- package/mobile/out/src/storage/schema/entities/EntityOutputTag.d.ts.map +1 -0
- package/mobile/out/src/storage/schema/entities/EntityOutputTag.js +104 -0
- package/mobile/out/src/storage/schema/entities/EntityOutputTag.js.map +1 -0
- package/mobile/out/src/storage/schema/entities/EntityOutputTagMap.d.ts +28 -0
- package/mobile/out/src/storage/schema/entities/EntityOutputTagMap.d.ts.map +1 -0
- package/mobile/out/src/storage/schema/entities/EntityOutputTagMap.js +97 -0
- package/mobile/out/src/storage/schema/entities/EntityOutputTagMap.js.map +1 -0
- package/mobile/out/src/storage/schema/entities/EntityProvenTx.d.ts +84 -0
- package/mobile/out/src/storage/schema/entities/EntityProvenTx.d.ts.map +1 -0
- package/mobile/out/src/storage/schema/entities/EntityProvenTx.js +276 -0
- package/mobile/out/src/storage/schema/entities/EntityProvenTx.js.map +1 -0
- package/mobile/out/src/storage/schema/entities/EntityProvenTxReq.d.ts +135 -0
- package/mobile/out/src/storage/schema/entities/EntityProvenTxReq.d.ts.map +1 -0
- package/mobile/out/src/storage/schema/entities/EntityProvenTxReq.js +522 -0
- package/mobile/out/src/storage/schema/entities/EntityProvenTxReq.js.map +1 -0
- package/mobile/out/src/storage/schema/entities/EntitySyncState.d.ts +67 -0
- package/mobile/out/src/storage/schema/entities/EntitySyncState.d.ts.map +1 -0
- package/mobile/out/src/storage/schema/entities/EntitySyncState.js +319 -0
- package/mobile/out/src/storage/schema/entities/EntitySyncState.js.map +1 -0
- package/mobile/out/src/storage/schema/entities/EntityTransaction.d.ts +67 -0
- package/mobile/out/src/storage/schema/entities/EntityTransaction.d.ts.map +1 -0
- package/mobile/out/src/storage/schema/entities/EntityTransaction.js +255 -0
- package/mobile/out/src/storage/schema/entities/EntityTransaction.js.map +1 -0
- package/mobile/out/src/storage/schema/entities/EntityTxLabel.d.ts +31 -0
- package/mobile/out/src/storage/schema/entities/EntityTxLabel.d.ts.map +1 -0
- package/mobile/out/src/storage/schema/entities/EntityTxLabel.js +104 -0
- package/mobile/out/src/storage/schema/entities/EntityTxLabel.js.map +1 -0
- package/mobile/out/src/storage/schema/entities/EntityTxLabelMap.d.ts +28 -0
- package/mobile/out/src/storage/schema/entities/EntityTxLabelMap.d.ts.map +1 -0
- package/mobile/out/src/storage/schema/entities/EntityTxLabelMap.js +97 -0
- package/mobile/out/src/storage/schema/entities/EntityTxLabelMap.js.map +1 -0
- package/mobile/out/src/storage/schema/entities/EntityUser.d.ts +29 -0
- package/mobile/out/src/storage/schema/entities/EntityUser.d.ts.map +1 -0
- package/mobile/out/src/storage/schema/entities/EntityUser.js +98 -0
- package/mobile/out/src/storage/schema/entities/EntityUser.js.map +1 -0
- package/mobile/out/src/storage/schema/entities/MergeEntity.d.ts +33 -0
- package/mobile/out/src/storage/schema/entities/MergeEntity.d.ts.map +1 -0
- package/mobile/out/src/storage/schema/entities/MergeEntity.js +62 -0
- package/mobile/out/src/storage/schema/entities/MergeEntity.js.map +1 -0
- package/mobile/out/src/storage/schema/entities/index.d.ts +17 -0
- package/mobile/out/src/storage/schema/entities/index.d.ts.map +1 -0
- package/mobile/out/src/storage/schema/entities/index.js +33 -0
- package/mobile/out/src/storage/schema/entities/index.js.map +1 -0
- package/mobile/out/src/storage/schema/tables/TableCertificate.d.ts +20 -0
- package/mobile/out/src/storage/schema/tables/TableCertificate.d.ts.map +1 -0
- package/mobile/out/src/storage/schema/tables/TableCertificate.js +3 -0
- package/mobile/out/src/storage/schema/tables/TableCertificate.js.map +1 -0
- package/mobile/out/src/storage/schema/tables/TableCertificateField.d.ts +12 -0
- package/mobile/out/src/storage/schema/tables/TableCertificateField.d.ts.map +1 -0
- package/mobile/out/src/storage/schema/tables/TableCertificateField.js +3 -0
- package/mobile/out/src/storage/schema/tables/TableCertificateField.js.map +1 -0
- package/mobile/out/src/storage/schema/tables/TableCommission.d.ts +13 -0
- package/mobile/out/src/storage/schema/tables/TableCommission.d.ts.map +1 -0
- package/mobile/out/src/storage/schema/tables/TableCommission.js +3 -0
- package/mobile/out/src/storage/schema/tables/TableCommission.js.map +1 -0
- package/mobile/out/src/storage/schema/tables/TableMonitorEvent.d.ts +9 -0
- package/mobile/out/src/storage/schema/tables/TableMonitorEvent.d.ts.map +1 -0
- package/mobile/out/src/storage/schema/tables/TableMonitorEvent.js +3 -0
- package/mobile/out/src/storage/schema/tables/TableMonitorEvent.js.map +1 -0
- package/mobile/out/src/storage/schema/tables/TableOutput.d.ts +36 -0
- package/mobile/out/src/storage/schema/tables/TableOutput.d.ts.map +1 -0
- package/mobile/out/src/storage/schema/tables/TableOutput.js +31 -0
- package/mobile/out/src/storage/schema/tables/TableOutput.js.map +1 -0
- package/mobile/out/src/storage/schema/tables/TableOutputBasket.d.ts +12 -0
- package/mobile/out/src/storage/schema/tables/TableOutputBasket.d.ts.map +1 -0
- package/mobile/out/src/storage/schema/tables/TableOutputBasket.js +3 -0
- package/mobile/out/src/storage/schema/tables/TableOutputBasket.js.map +1 -0
- package/mobile/out/src/storage/schema/tables/TableOutputTag.d.ts +10 -0
- package/mobile/out/src/storage/schema/tables/TableOutputTag.d.ts.map +1 -0
- package/mobile/out/src/storage/schema/tables/TableOutputTag.js +3 -0
- package/mobile/out/src/storage/schema/tables/TableOutputTag.js.map +1 -0
- package/mobile/out/src/storage/schema/tables/TableOutputTagMap.d.ts +9 -0
- package/mobile/out/src/storage/schema/tables/TableOutputTagMap.d.ts.map +1 -0
- package/mobile/out/src/storage/schema/tables/TableOutputTagMap.js +3 -0
- package/mobile/out/src/storage/schema/tables/TableOutputTagMap.js.map +1 -0
- package/mobile/out/src/storage/schema/tables/TableProvenTx.d.ts +14 -0
- package/mobile/out/src/storage/schema/tables/TableProvenTx.d.ts.map +1 -0
- package/mobile/out/src/storage/schema/tables/TableProvenTx.js +3 -0
- package/mobile/out/src/storage/schema/tables/TableProvenTx.js.map +1 -0
- package/mobile/out/src/storage/schema/tables/TableProvenTxReq.d.ts +64 -0
- package/mobile/out/src/storage/schema/tables/TableProvenTxReq.d.ts.map +1 -0
- package/mobile/out/src/storage/schema/tables/TableProvenTxReq.js +3 -0
- package/mobile/out/src/storage/schema/tables/TableProvenTxReq.js.map +1 -0
- package/mobile/out/src/storage/schema/tables/TableSettings.d.ts +17 -0
- package/mobile/out/src/storage/schema/tables/TableSettings.d.ts.map +1 -0
- package/mobile/out/src/storage/schema/tables/TableSettings.js +3 -0
- package/mobile/out/src/storage/schema/tables/TableSettings.js.map +1 -0
- package/mobile/out/src/storage/schema/tables/TableSyncState.d.ts +18 -0
- package/mobile/out/src/storage/schema/tables/TableSyncState.d.ts.map +1 -0
- package/mobile/out/src/storage/schema/tables/TableSyncState.js +3 -0
- package/mobile/out/src/storage/schema/tables/TableSyncState.js.map +1 -0
- package/mobile/out/src/storage/schema/tables/TableTransaction.d.ts +37 -0
- package/mobile/out/src/storage/schema/tables/TableTransaction.d.ts.map +1 -0
- package/mobile/out/src/storage/schema/tables/TableTransaction.js +21 -0
- package/mobile/out/src/storage/schema/tables/TableTransaction.js.map +1 -0
- package/mobile/out/src/storage/schema/tables/TableTxLabel.d.ts +10 -0
- package/mobile/out/src/storage/schema/tables/TableTxLabel.d.ts.map +1 -0
- package/mobile/out/src/storage/schema/tables/TableTxLabel.js +3 -0
- package/mobile/out/src/storage/schema/tables/TableTxLabel.js.map +1 -0
- package/mobile/out/src/storage/schema/tables/TableTxLabelMap.d.ts +9 -0
- package/mobile/out/src/storage/schema/tables/TableTxLabelMap.d.ts.map +1 -0
- package/mobile/out/src/storage/schema/tables/TableTxLabelMap.js +3 -0
- package/mobile/out/src/storage/schema/tables/TableTxLabelMap.js.map +1 -0
- package/mobile/out/src/storage/schema/tables/TableUser.d.ts +16 -0
- package/mobile/out/src/storage/schema/tables/TableUser.d.ts.map +1 -0
- package/mobile/out/src/storage/schema/tables/TableUser.js +3 -0
- package/mobile/out/src/storage/schema/tables/TableUser.js.map +1 -0
- package/mobile/out/src/storage/schema/tables/index.d.ts +17 -0
- package/mobile/out/src/storage/schema/tables/index.d.ts.map +1 -0
- package/mobile/out/src/storage/schema/tables/index.js +33 -0
- package/mobile/out/src/storage/schema/tables/index.js.map +1 -0
- package/mobile/out/src/utility/ScriptTemplateBRC29.d.ts +25 -0
- package/mobile/out/src/utility/ScriptTemplateBRC29.d.ts.map +1 -0
- package/mobile/out/src/utility/ScriptTemplateBRC29.js +48 -0
- package/mobile/out/src/utility/ScriptTemplateBRC29.js.map +1 -0
- package/mobile/out/src/utility/identityUtils.d.ts +31 -0
- package/mobile/out/src/utility/identityUtils.d.ts.map +1 -0
- package/mobile/out/src/utility/identityUtils.js +116 -0
- package/mobile/out/src/utility/identityUtils.js.map +1 -0
- package/mobile/out/src/utility/index.client.d.ts +7 -0
- package/mobile/out/src/utility/index.client.d.ts.map +1 -0
- package/mobile/out/src/utility/index.client.js +23 -0
- package/mobile/out/src/utility/index.client.js.map +1 -0
- package/mobile/out/src/utility/parseTxScriptOffsets.d.ts +14 -0
- package/mobile/out/src/utility/parseTxScriptOffsets.d.ts.map +1 -0
- package/mobile/out/src/utility/parseTxScriptOffsets.js +26 -0
- package/mobile/out/src/utility/parseTxScriptOffsets.js.map +1 -0
- package/mobile/out/src/utility/stampLog.d.ts +18 -0
- package/mobile/out/src/utility/stampLog.d.ts.map +1 -0
- package/mobile/out/src/utility/stampLog.js +72 -0
- package/mobile/out/src/utility/stampLog.js.map +1 -0
- package/mobile/out/src/utility/tscProofToMerklePath.d.ts +8 -0
- package/mobile/out/src/utility/tscProofToMerklePath.d.ts.map +1 -0
- package/mobile/out/src/utility/tscProofToMerklePath.js +41 -0
- package/mobile/out/src/utility/tscProofToMerklePath.js.map +1 -0
- package/mobile/out/src/utility/utilityHelpers.d.ts +129 -0
- package/mobile/out/src/utility/utilityHelpers.d.ts.map +1 -0
- package/mobile/out/src/utility/utilityHelpers.js +266 -0
- package/mobile/out/src/utility/utilityHelpers.js.map +1 -0
- package/mobile/out/src/utility/utilityHelpers.noBuffer.d.ts +9 -0
- package/mobile/out/src/utility/utilityHelpers.noBuffer.d.ts.map +1 -0
- package/mobile/out/src/utility/utilityHelpers.noBuffer.js +23 -0
- package/mobile/out/src/utility/utilityHelpers.noBuffer.js.map +1 -0
- package/mobile/out/src/wab-client/WABClient.d.ts +49 -0
- package/mobile/out/src/wab-client/WABClient.d.ts.map +1 -0
- package/mobile/out/src/wab-client/WABClient.js +80 -0
- package/mobile/out/src/wab-client/WABClient.js.map +1 -0
- package/mobile/out/src/wab-client/auth-method-interactors/AuthMethodInteractor.d.ts +34 -0
- package/mobile/out/src/wab-client/auth-method-interactors/AuthMethodInteractor.d.ts.map +1 -0
- package/mobile/out/src/wab-client/auth-method-interactors/AuthMethodInteractor.js +16 -0
- package/mobile/out/src/wab-client/auth-method-interactors/AuthMethodInteractor.js.map +1 -0
- package/mobile/out/src/wab-client/auth-method-interactors/PersonaIDInteractor.d.ts +7 -0
- package/mobile/out/src/wab-client/auth-method-interactors/PersonaIDInteractor.d.ts.map +1 -0
- package/mobile/out/src/wab-client/auth-method-interactors/PersonaIDInteractor.js +36 -0
- package/mobile/out/src/wab-client/auth-method-interactors/PersonaIDInteractor.js.map +1 -0
- package/mobile/out/src/wab-client/auth-method-interactors/TwilioPhoneInteractor.d.ts +28 -0
- package/mobile/out/src/wab-client/auth-method-interactors/TwilioPhoneInteractor.d.ts.map +1 -0
- package/mobile/out/src/wab-client/auth-method-interactors/TwilioPhoneInteractor.js +69 -0
- package/mobile/out/src/wab-client/auth-method-interactors/TwilioPhoneInteractor.js.map +1 -0
- package/mobile/out/tsconfig.mobile.tsbuildinfo +1 -0
- package/mobile/package-lock.json +22 -0
- package/mobile/package.json +25 -0
- package/out/src/index.mobile.d.ts +19 -0
- package/out/src/index.mobile.d.ts.map +1 -0
- package/out/src/index.mobile.js +58 -0
- package/out/src/index.mobile.js.map +1 -0
- package/out/src/storage/index.mobile.d.ts +7 -0
- package/out/src/storage/index.mobile.d.ts.map +1 -0
- package/out/src/storage/index.mobile.js +23 -0
- package/out/src/storage/index.mobile.js.map +1 -0
- package/out/src/wab-client/WABClient.js +2 -5
- package/out/src/wab-client/WABClient.js.map +1 -1
- package/out/tsconfig.all.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/index.mobile.ts +18 -0
- package/src/storage/index.mobile.ts +6 -0
- package/src/wab-client/WABClient.ts +2 -2
- package/tsconfig.json +3 -0
- package/tsconfig.mobile.json +22 -0
|
@@ -0,0 +1,742 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.Wallet = void 0;
|
|
37
|
+
const sdk_1 = require("@bsv/sdk");
|
|
38
|
+
const sdk = __importStar(require("./sdk"));
|
|
39
|
+
const acquireDirectCertificate_1 = require("./signer/methods/acquireDirectCertificate");
|
|
40
|
+
const proveCertificate_1 = require("./signer/methods/proveCertificate");
|
|
41
|
+
const createAction_1 = require("./signer/methods/createAction");
|
|
42
|
+
const signAction_1 = require("./signer/methods/signAction");
|
|
43
|
+
const internalizeAction_1 = require("./signer/methods/internalizeAction");
|
|
44
|
+
const WalletSettingsManager_1 = require("./WalletSettingsManager");
|
|
45
|
+
const identityUtils_1 = require("./utility/identityUtils");
|
|
46
|
+
const generateChange_1 = require("./storage/methods/generateChange");
|
|
47
|
+
const sdk_2 = require("./sdk");
|
|
48
|
+
const utilityHelpers_1 = require("./utility/utilityHelpers");
|
|
49
|
+
const ScriptTemplateBRC29_1 = require("./utility/ScriptTemplateBRC29");
|
|
50
|
+
function isWalletSigner(args) {
|
|
51
|
+
return args['isWalletSigner'];
|
|
52
|
+
}
|
|
53
|
+
class Wallet {
|
|
54
|
+
constructor(argsOrSigner, services, monitor, privilegedKeyManager) {
|
|
55
|
+
/**
|
|
56
|
+
* If true, signableTransactions will include sourceTransaction for each input,
|
|
57
|
+
* including those that do not require signature and those that were also contained
|
|
58
|
+
* in the inputBEEF.
|
|
59
|
+
*/
|
|
60
|
+
this.includeAllSourceTransactions = true;
|
|
61
|
+
/**
|
|
62
|
+
* If true, txids that are known to the wallet's party beef do not need to be returned from storage.
|
|
63
|
+
*/
|
|
64
|
+
this.autoKnownTxids = false;
|
|
65
|
+
/**
|
|
66
|
+
* If true, beefs returned to the user may contain txidOnly transactions.
|
|
67
|
+
*/
|
|
68
|
+
this.returnTxidOnly = false;
|
|
69
|
+
/**
|
|
70
|
+
* For repeatability testing, set to an array of random numbers from [0..1).
|
|
71
|
+
*/
|
|
72
|
+
this.randomVals = undefined;
|
|
73
|
+
const args = !isWalletSigner(argsOrSigner)
|
|
74
|
+
? argsOrSigner
|
|
75
|
+
: {
|
|
76
|
+
chain: argsOrSigner.chain,
|
|
77
|
+
keyDeriver: argsOrSigner.keyDeriver,
|
|
78
|
+
storage: argsOrSigner.storage,
|
|
79
|
+
services,
|
|
80
|
+
monitor,
|
|
81
|
+
privilegedKeyManager
|
|
82
|
+
};
|
|
83
|
+
if (args.storage._authId.identityKey != args.keyDeriver.identityKey)
|
|
84
|
+
throw new sdk.WERR_INVALID_PARAMETER('storage', `authenticated as the same identityKey (${args.storage._authId.identityKey}) as the keyDeriver (${args.keyDeriver.identityKey}).`);
|
|
85
|
+
this.settingsManager = args.settingsManager || new WalletSettingsManager_1.WalletSettingsManager(this);
|
|
86
|
+
this.chain = args.chain;
|
|
87
|
+
this.lookupResolver =
|
|
88
|
+
args.lookupResolver ||
|
|
89
|
+
new sdk_1.LookupResolver({
|
|
90
|
+
networkPreset: (0, utilityHelpers_1.toWalletNetwork)(this.chain)
|
|
91
|
+
});
|
|
92
|
+
this.keyDeriver = args.keyDeriver;
|
|
93
|
+
this.storage = args.storage;
|
|
94
|
+
this.proto = new sdk_1.ProtoWallet(args.keyDeriver);
|
|
95
|
+
this.services = args.services;
|
|
96
|
+
this.monitor = args.monitor;
|
|
97
|
+
this.privilegedKeyManager = args.privilegedKeyManager;
|
|
98
|
+
this.identityKey = this.keyDeriver.identityKey;
|
|
99
|
+
this.pendingSignActions = {};
|
|
100
|
+
this.userParty = `user ${this.getClientChangeKeyPair().publicKey}`;
|
|
101
|
+
this.beef = new sdk_1.BeefParty([this.userParty]);
|
|
102
|
+
this.trustSelf = 'known';
|
|
103
|
+
if (this.services) {
|
|
104
|
+
this.storage.setServices(this.services);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
async destroy() {
|
|
108
|
+
await this.storage.destroy();
|
|
109
|
+
if (this.privilegedKeyManager)
|
|
110
|
+
await this.privilegedKeyManager.destroyKey();
|
|
111
|
+
}
|
|
112
|
+
getClientChangeKeyPair() {
|
|
113
|
+
const kp = {
|
|
114
|
+
privateKey: this.keyDeriver.rootKey.toString(),
|
|
115
|
+
publicKey: this.keyDeriver.rootKey.toPublicKey().toString()
|
|
116
|
+
};
|
|
117
|
+
return kp;
|
|
118
|
+
}
|
|
119
|
+
async getIdentityKey() {
|
|
120
|
+
return (await this.getPublicKey({ identityKey: true })).publicKey;
|
|
121
|
+
}
|
|
122
|
+
getPublicKey(args, originator) {
|
|
123
|
+
if (args.privileged) {
|
|
124
|
+
if (!this.privilegedKeyManager) {
|
|
125
|
+
throw new Error('Privileged operations require the Wallet to be configured with a privileged key manager.');
|
|
126
|
+
}
|
|
127
|
+
return this.privilegedKeyManager.getPublicKey(args);
|
|
128
|
+
}
|
|
129
|
+
return this.proto.getPublicKey(args);
|
|
130
|
+
}
|
|
131
|
+
revealCounterpartyKeyLinkage(args, originator) {
|
|
132
|
+
if (args.privileged) {
|
|
133
|
+
if (!this.privilegedKeyManager) {
|
|
134
|
+
throw new Error('Privileged operations require the Wallet to be configured with a privileged key manager.');
|
|
135
|
+
}
|
|
136
|
+
return this.privilegedKeyManager.revealCounterpartyKeyLinkage(args);
|
|
137
|
+
}
|
|
138
|
+
return this.proto.revealCounterpartyKeyLinkage(args);
|
|
139
|
+
}
|
|
140
|
+
revealSpecificKeyLinkage(args, originator) {
|
|
141
|
+
if (args.privileged) {
|
|
142
|
+
if (!this.privilegedKeyManager) {
|
|
143
|
+
throw new Error('Privileged operations require the Wallet to be configured with a privileged key manager.');
|
|
144
|
+
}
|
|
145
|
+
return this.privilegedKeyManager.revealSpecificKeyLinkage(args);
|
|
146
|
+
}
|
|
147
|
+
return this.proto.revealSpecificKeyLinkage(args);
|
|
148
|
+
}
|
|
149
|
+
encrypt(args, originator) {
|
|
150
|
+
if (args.privileged) {
|
|
151
|
+
if (!this.privilegedKeyManager) {
|
|
152
|
+
throw new Error('Privileged operations require the Wallet to be configured with a privileged key manager.');
|
|
153
|
+
}
|
|
154
|
+
return this.privilegedKeyManager.encrypt(args);
|
|
155
|
+
}
|
|
156
|
+
return this.proto.encrypt(args);
|
|
157
|
+
}
|
|
158
|
+
decrypt(args, originator) {
|
|
159
|
+
if (args.privileged) {
|
|
160
|
+
if (!this.privilegedKeyManager) {
|
|
161
|
+
throw new Error('Privileged operations require the Wallet to be configured with a privileged key manager.');
|
|
162
|
+
}
|
|
163
|
+
return this.privilegedKeyManager.decrypt(args);
|
|
164
|
+
}
|
|
165
|
+
return this.proto.decrypt(args);
|
|
166
|
+
}
|
|
167
|
+
createHmac(args, originator) {
|
|
168
|
+
if (args.privileged) {
|
|
169
|
+
if (!this.privilegedKeyManager) {
|
|
170
|
+
throw new Error('Privileged operations require the Wallet to be configured with a privileged key manager.');
|
|
171
|
+
}
|
|
172
|
+
return this.privilegedKeyManager.createHmac(args);
|
|
173
|
+
}
|
|
174
|
+
return this.proto.createHmac(args);
|
|
175
|
+
}
|
|
176
|
+
verifyHmac(args, originator) {
|
|
177
|
+
if (args.privileged) {
|
|
178
|
+
if (!this.privilegedKeyManager) {
|
|
179
|
+
throw new Error('Privileged operations require the Wallet to be configured with a privileged key manager.');
|
|
180
|
+
}
|
|
181
|
+
return this.privilegedKeyManager.verifyHmac(args);
|
|
182
|
+
}
|
|
183
|
+
return this.proto.verifyHmac(args);
|
|
184
|
+
}
|
|
185
|
+
createSignature(args, originator) {
|
|
186
|
+
if (args.privileged) {
|
|
187
|
+
if (!this.privilegedKeyManager) {
|
|
188
|
+
throw new Error('Privileged operations require the Wallet to be configured with a privileged key manager.');
|
|
189
|
+
}
|
|
190
|
+
return this.privilegedKeyManager.createSignature(args);
|
|
191
|
+
}
|
|
192
|
+
return this.proto.createSignature(args);
|
|
193
|
+
}
|
|
194
|
+
verifySignature(args, originator) {
|
|
195
|
+
if (args.privileged) {
|
|
196
|
+
if (!this.privilegedKeyManager) {
|
|
197
|
+
throw new Error('Privileged operations require the Wallet to be configured with a privileged key manager.');
|
|
198
|
+
}
|
|
199
|
+
return this.privilegedKeyManager.verifySignature(args);
|
|
200
|
+
}
|
|
201
|
+
return this.proto.verifySignature(args);
|
|
202
|
+
}
|
|
203
|
+
getServices() {
|
|
204
|
+
if (!this.services)
|
|
205
|
+
throw new sdk.WERR_INVALID_PARAMETER('services', 'valid in constructor arguments to be retreived here.');
|
|
206
|
+
return this.services;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* @returns the full list of txids whose validity this wallet claims to know.
|
|
210
|
+
*
|
|
211
|
+
* @param newKnownTxids Optional. Additional new txids known to be valid by the caller to be merged.
|
|
212
|
+
*/
|
|
213
|
+
getKnownTxids(newKnownTxids) {
|
|
214
|
+
if (newKnownTxids) {
|
|
215
|
+
for (const txid of newKnownTxids)
|
|
216
|
+
this.beef.mergeTxidOnly(txid);
|
|
217
|
+
}
|
|
218
|
+
const r = this.beef.sortTxs();
|
|
219
|
+
const knownTxids = r.valid;
|
|
220
|
+
return knownTxids;
|
|
221
|
+
}
|
|
222
|
+
getStorageIdentity() {
|
|
223
|
+
const s = this.storage.getSettings();
|
|
224
|
+
return {
|
|
225
|
+
storageIdentityKey: s.storageIdentityKey,
|
|
226
|
+
storageName: s.storageName
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
validateAuthAndArgs(args, validate) {
|
|
230
|
+
const vargs = validate(args);
|
|
231
|
+
const auth = { identityKey: this.identityKey };
|
|
232
|
+
return { vargs, auth };
|
|
233
|
+
}
|
|
234
|
+
//////////////////
|
|
235
|
+
// List Methods
|
|
236
|
+
//////////////////
|
|
237
|
+
async listActions(args, originator) {
|
|
238
|
+
sdk.validateOriginator(originator);
|
|
239
|
+
const { vargs } = this.validateAuthAndArgs(args, sdk.validateListActionsArgs);
|
|
240
|
+
const r = await this.storage.listActions(vargs);
|
|
241
|
+
return r;
|
|
242
|
+
}
|
|
243
|
+
get storageParty() {
|
|
244
|
+
return `storage ${this.getStorageIdentity().storageIdentityKey}`;
|
|
245
|
+
}
|
|
246
|
+
async listOutputs(args, originator) {
|
|
247
|
+
sdk.validateOriginator(originator);
|
|
248
|
+
const { vargs } = this.validateAuthAndArgs(args, sdk.validateListOutputsArgs);
|
|
249
|
+
if (this.autoKnownTxids && !vargs.knownTxids) {
|
|
250
|
+
vargs.knownTxids = this.getKnownTxids();
|
|
251
|
+
}
|
|
252
|
+
const r = await this.storage.listOutputs(vargs);
|
|
253
|
+
if (r.BEEF) {
|
|
254
|
+
this.beef.mergeBeefFromParty(this.storageParty, r.BEEF);
|
|
255
|
+
r.BEEF = this.verifyReturnedTxidOnlyBEEF(r.BEEF);
|
|
256
|
+
}
|
|
257
|
+
return r;
|
|
258
|
+
}
|
|
259
|
+
async listCertificates(args, originator) {
|
|
260
|
+
sdk.validateOriginator(originator);
|
|
261
|
+
const { vargs } = this.validateAuthAndArgs(args, sdk.validateListCertificatesArgs);
|
|
262
|
+
const r = await this.storage.listCertificates(vargs);
|
|
263
|
+
return r;
|
|
264
|
+
}
|
|
265
|
+
//////////////////
|
|
266
|
+
// Certificates
|
|
267
|
+
//////////////////
|
|
268
|
+
async acquireCertificate(args, originator) {
|
|
269
|
+
sdk.validateOriginator(originator);
|
|
270
|
+
if (args.acquisitionProtocol === 'direct') {
|
|
271
|
+
const { auth, vargs } = this.validateAuthAndArgs(args, sdk.validateAcquireDirectCertificateArgs);
|
|
272
|
+
vargs.subject = (await this.getPublicKey({
|
|
273
|
+
identityKey: true,
|
|
274
|
+
privileged: args.privileged,
|
|
275
|
+
privilegedReason: args.privilegedReason
|
|
276
|
+
})).publicKey;
|
|
277
|
+
try {
|
|
278
|
+
// Confirm that the information received adds up to a usable certificate...
|
|
279
|
+
// TODO: Clean up MasterCertificate to support decrypt on instance
|
|
280
|
+
const cert = new sdk_1.MasterCertificate(vargs.type, vargs.serialNumber, vargs.subject, vargs.certifier, vargs.revocationOutpoint, vargs.fields, vargs.keyringForSubject, vargs.signature);
|
|
281
|
+
await cert.verify();
|
|
282
|
+
// Verify certificate details
|
|
283
|
+
await sdk_1.MasterCertificate.decryptFields(this, vargs.keyringForSubject, vargs.fields, vargs.certifier, vargs.privileged, vargs.privilegedReason);
|
|
284
|
+
}
|
|
285
|
+
catch (eu) {
|
|
286
|
+
const e = sdk.WalletError.fromUnknown(eu);
|
|
287
|
+
throw new sdk.WERR_INVALID_PARAMETER('args', `valid encrypted and signed certificate and keyring from revealer. ${e.name}: ${e.message}`);
|
|
288
|
+
}
|
|
289
|
+
const r = await (0, acquireDirectCertificate_1.acquireDirectCertificate)(this, auth, vargs);
|
|
290
|
+
return r;
|
|
291
|
+
}
|
|
292
|
+
if (args.acquisitionProtocol === 'issuance') {
|
|
293
|
+
const { auth, vargs } = this.validateAuthAndArgs(args, sdk.validateAcquireIssuanceCertificateArgs);
|
|
294
|
+
// Create a random nonce that the server can verify
|
|
295
|
+
const clientNonce = await (0, sdk_1.createNonce)(this, vargs.certifier);
|
|
296
|
+
// TODO: Consider adding support to request certificates from a certifier before acquiring a certificate.
|
|
297
|
+
const authClient = new sdk_1.AuthFetch(this);
|
|
298
|
+
// Create a certificate master keyring
|
|
299
|
+
// The certifier is able to decrypt these fields as they are the counterparty
|
|
300
|
+
const { certificateFields, masterKeyring } = await sdk_1.MasterCertificate.createCertificateFields(this, vargs.certifier, vargs.fields);
|
|
301
|
+
// Make a Certificate Signing Request (CSR) to the certifier
|
|
302
|
+
const response = await authClient.fetch(`${vargs.certifierUrl}/signCertificate`, {
|
|
303
|
+
method: 'POST',
|
|
304
|
+
headers: {
|
|
305
|
+
'Content-Type': 'application/json'
|
|
306
|
+
},
|
|
307
|
+
body: JSON.stringify({
|
|
308
|
+
clientNonce,
|
|
309
|
+
type: vargs.type,
|
|
310
|
+
fields: certificateFields,
|
|
311
|
+
masterKeyring
|
|
312
|
+
})
|
|
313
|
+
});
|
|
314
|
+
if (response.headers.get('x-bsv-auth-identity-key') !== vargs.certifier) {
|
|
315
|
+
throw new Error(`Invalid certifier! Expected: ${vargs.certifier}, Received: ${response.headers.get('x-bsv-auth-identity-key')}`);
|
|
316
|
+
}
|
|
317
|
+
const { certificate, serverNonce } = await response.json();
|
|
318
|
+
// Validate the server response
|
|
319
|
+
if (!certificate) {
|
|
320
|
+
throw new Error('No certificate received from certifier!');
|
|
321
|
+
}
|
|
322
|
+
if (!serverNonce) {
|
|
323
|
+
throw new Error('No serverNonce received from certifier!');
|
|
324
|
+
}
|
|
325
|
+
const signedCertificate = new sdk_1.Certificate(certificate.type, certificate.serialNumber, certificate.subject, certificate.certifier, certificate.revocationOutpoint, certificate.fields, certificate.signature);
|
|
326
|
+
// Validate server nonce
|
|
327
|
+
await (0, sdk_1.verifyNonce)(serverNonce, this, vargs.certifier);
|
|
328
|
+
// Verify the server included our nonce
|
|
329
|
+
const { valid } = await this.verifyHmac({
|
|
330
|
+
hmac: sdk_1.Utils.toArray(signedCertificate.serialNumber, 'base64'),
|
|
331
|
+
data: sdk_1.Utils.toArray(clientNonce + serverNonce, 'base64'),
|
|
332
|
+
protocolID: [2, 'certificate issuance'],
|
|
333
|
+
keyID: serverNonce + clientNonce,
|
|
334
|
+
counterparty: vargs.certifier
|
|
335
|
+
});
|
|
336
|
+
if (!valid)
|
|
337
|
+
throw new Error('Invalid serialNumber');
|
|
338
|
+
// Validate the certificate received
|
|
339
|
+
if (signedCertificate.type !== vargs.type) {
|
|
340
|
+
throw new Error(`Invalid certificate type! Expected: ${vargs.type}, Received: ${signedCertificate.type}`);
|
|
341
|
+
}
|
|
342
|
+
if (signedCertificate.subject !== this.identityKey) {
|
|
343
|
+
throw new Error(`Invalid certificate subject! Expected: ${this.identityKey}, Received: ${signedCertificate.subject}`);
|
|
344
|
+
}
|
|
345
|
+
if (signedCertificate.certifier !== vargs.certifier) {
|
|
346
|
+
throw new Error(`Invalid certifier! Expected: ${vargs.certifier}, Received: ${signedCertificate.certifier}`);
|
|
347
|
+
}
|
|
348
|
+
if (!signedCertificate.revocationOutpoint) {
|
|
349
|
+
throw new Error(`Invalid revocationOutpoint!`);
|
|
350
|
+
}
|
|
351
|
+
if (Object.keys(signedCertificate.fields).length !== Object.keys(certificateFields).length) {
|
|
352
|
+
throw new Error(`Fields mismatch! Objects have different numbers of keys.`);
|
|
353
|
+
}
|
|
354
|
+
for (const field of Object.keys(certificateFields)) {
|
|
355
|
+
if (!(field in signedCertificate.fields)) {
|
|
356
|
+
throw new Error(`Missing field: ${field} in certificate.fields`);
|
|
357
|
+
}
|
|
358
|
+
if (signedCertificate.fields[field] !== certificateFields[field]) {
|
|
359
|
+
throw new Error(`Invalid field! Expected: ${certificateFields[field]}, Received: ${signedCertificate.fields[field]}`);
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
await signedCertificate.verify();
|
|
363
|
+
// Test decryption works
|
|
364
|
+
await sdk_1.MasterCertificate.decryptFields(this, masterKeyring, certificate.fields, vargs.certifier);
|
|
365
|
+
// Store the newly issued certificate
|
|
366
|
+
return await (0, acquireDirectCertificate_1.acquireDirectCertificate)(this, auth, {
|
|
367
|
+
...certificate,
|
|
368
|
+
keyringRevealer: 'certifier',
|
|
369
|
+
keyringForSubject: masterKeyring,
|
|
370
|
+
privileged: vargs.privileged
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
throw new sdk.WERR_INVALID_PARAMETER('acquisitionProtocol', `valid.${args.acquisitionProtocol} is unrecognized.`);
|
|
374
|
+
}
|
|
375
|
+
async relinquishCertificate(args, originator) {
|
|
376
|
+
sdk.validateOriginator(originator);
|
|
377
|
+
this.validateAuthAndArgs(args, sdk.validateRelinquishCertificateArgs);
|
|
378
|
+
const r = await this.storage.relinquishCertificate(args);
|
|
379
|
+
return { relinquished: true };
|
|
380
|
+
}
|
|
381
|
+
async proveCertificate(args, originator) {
|
|
382
|
+
originator = sdk.validateOriginator(originator);
|
|
383
|
+
const { auth, vargs } = this.validateAuthAndArgs(args, sdk.validateProveCertificateArgs);
|
|
384
|
+
const r = await (0, proveCertificate_1.proveCertificate)(this, auth, vargs);
|
|
385
|
+
return r;
|
|
386
|
+
}
|
|
387
|
+
async discoverByIdentityKey(args, originator) {
|
|
388
|
+
sdk.validateOriginator(originator);
|
|
389
|
+
this.validateAuthAndArgs(args, sdk.validateDiscoverByIdentityKeyArgs);
|
|
390
|
+
const trustSettings = (await this.settingsManager.get()).trustSettings;
|
|
391
|
+
const results = await (0, identityUtils_1.queryOverlay)({
|
|
392
|
+
identityKey: args.identityKey,
|
|
393
|
+
certifiers: trustSettings.trustedCertifiers.map(certifier => certifier.identityKey)
|
|
394
|
+
}, this.lookupResolver);
|
|
395
|
+
if (!results) {
|
|
396
|
+
return {
|
|
397
|
+
totalCertificates: 0,
|
|
398
|
+
certificates: []
|
|
399
|
+
};
|
|
400
|
+
}
|
|
401
|
+
return (0, identityUtils_1.transformVerifiableCertificatesWithTrust)(trustSettings, results);
|
|
402
|
+
}
|
|
403
|
+
async discoverByAttributes(args, originator) {
|
|
404
|
+
sdk.validateOriginator(originator);
|
|
405
|
+
this.validateAuthAndArgs(args, sdk.validateDiscoverByAttributesArgs);
|
|
406
|
+
const trustSettings = (await this.settingsManager.get()).trustSettings;
|
|
407
|
+
const results = await (0, identityUtils_1.queryOverlay)({
|
|
408
|
+
attributes: args.attributes,
|
|
409
|
+
certifiers: trustSettings.trustedCertifiers.map(certifier => certifier.identityKey)
|
|
410
|
+
}, this.lookupResolver);
|
|
411
|
+
if (!results) {
|
|
412
|
+
return {
|
|
413
|
+
totalCertificates: 0,
|
|
414
|
+
certificates: []
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
return (0, identityUtils_1.transformVerifiableCertificatesWithTrust)(trustSettings, results);
|
|
418
|
+
}
|
|
419
|
+
verifyReturnedTxidOnly(beef, knownTxids) {
|
|
420
|
+
if (this.returnTxidOnly)
|
|
421
|
+
return beef;
|
|
422
|
+
const onlyTxids = beef.txs.filter(btx => btx.isTxidOnly).map(btx => btx.txid);
|
|
423
|
+
for (const txid of onlyTxids) {
|
|
424
|
+
if (knownTxids && knownTxids.indexOf(txid) >= 0)
|
|
425
|
+
continue;
|
|
426
|
+
const btx = beef.findTxid(txid);
|
|
427
|
+
const tx = this.beef.findAtomicTransaction(txid);
|
|
428
|
+
if (!tx)
|
|
429
|
+
throw new sdk.WERR_INTERNAL(`unable to merge txid ${txid} into beef`);
|
|
430
|
+
beef.mergeTransaction(tx);
|
|
431
|
+
}
|
|
432
|
+
for (const btx of beef.txs) {
|
|
433
|
+
if (knownTxids && knownTxids.indexOf(btx.txid) >= 0)
|
|
434
|
+
continue;
|
|
435
|
+
if (btx.isTxidOnly)
|
|
436
|
+
throw new sdk.WERR_INTERNAL(`remaining txidOnly ${btx.txid} is not known`);
|
|
437
|
+
}
|
|
438
|
+
return beef;
|
|
439
|
+
}
|
|
440
|
+
verifyReturnedTxidOnlyAtomicBEEF(beef, knownTxids) {
|
|
441
|
+
if (this.returnTxidOnly)
|
|
442
|
+
return beef;
|
|
443
|
+
const b = sdk_1.Beef.fromBinary(beef);
|
|
444
|
+
if (!b.atomicTxid)
|
|
445
|
+
throw new sdk.WERR_INTERNAL();
|
|
446
|
+
return this.verifyReturnedTxidOnly(b, knownTxids).toBinaryAtomic(b.atomicTxid);
|
|
447
|
+
}
|
|
448
|
+
verifyReturnedTxidOnlyBEEF(beef) {
|
|
449
|
+
if (this.returnTxidOnly)
|
|
450
|
+
return beef;
|
|
451
|
+
const b = sdk_1.Beef.fromBinary(beef);
|
|
452
|
+
return this.verifyReturnedTxidOnly(b).toBinary();
|
|
453
|
+
}
|
|
454
|
+
//////////////////
|
|
455
|
+
// Actions
|
|
456
|
+
//////////////////
|
|
457
|
+
async createAction(args, originator) {
|
|
458
|
+
var _a;
|
|
459
|
+
var _b;
|
|
460
|
+
sdk.validateOriginator(originator);
|
|
461
|
+
if (!args.options)
|
|
462
|
+
args.options = {};
|
|
463
|
+
(_b = args.options).trustSelf || (_b.trustSelf = this.trustSelf);
|
|
464
|
+
if (this.autoKnownTxids && !args.options.knownTxids) {
|
|
465
|
+
args.options.knownTxids = this.getKnownTxids(args.options.knownTxids);
|
|
466
|
+
}
|
|
467
|
+
const { auth, vargs } = this.validateAuthAndArgs(args, sdk.validateCreateActionArgs);
|
|
468
|
+
if (vargs.labels.indexOf(sdk_2.specOpThrowReviewActions) >= 0)
|
|
469
|
+
throwDummyReviewActions();
|
|
470
|
+
vargs.includeAllSourceTransactions = this.includeAllSourceTransactions;
|
|
471
|
+
if (this.randomVals && this.randomVals.length > 1) {
|
|
472
|
+
vargs.randomVals = [...this.randomVals];
|
|
473
|
+
}
|
|
474
|
+
const r = await (0, createAction_1.createAction)(this, auth, vargs);
|
|
475
|
+
if (r.tx) {
|
|
476
|
+
this.beef.mergeBeefFromParty(this.storageParty, r.tx);
|
|
477
|
+
}
|
|
478
|
+
if (r.tx)
|
|
479
|
+
r.tx = this.verifyReturnedTxidOnlyAtomicBEEF(r.tx, (_a = args.options) === null || _a === void 0 ? void 0 : _a.knownTxids);
|
|
480
|
+
if (!vargs.isDelayed)
|
|
481
|
+
throwIfAnyUnsuccessfulCreateActions(r);
|
|
482
|
+
return r;
|
|
483
|
+
}
|
|
484
|
+
async signAction(args, originator) {
|
|
485
|
+
var _a;
|
|
486
|
+
sdk.validateOriginator(originator);
|
|
487
|
+
const { auth, vargs } = this.validateAuthAndArgs(args, sdk.validateSignActionArgs);
|
|
488
|
+
// createAction options are merged with undefined signAction options before validation...
|
|
489
|
+
const r = await (0, signAction_1.signAction)(this, auth, args);
|
|
490
|
+
if (!vargs.isDelayed)
|
|
491
|
+
throwIfAnyUnsuccessfulSignActions(r);
|
|
492
|
+
const prior = this.pendingSignActions[args.reference];
|
|
493
|
+
if (r.tx)
|
|
494
|
+
r.tx = this.verifyReturnedTxidOnlyAtomicBEEF(r.tx, (_a = prior.args.options) === null || _a === void 0 ? void 0 : _a.knownTxids);
|
|
495
|
+
return r;
|
|
496
|
+
}
|
|
497
|
+
async abortAction(args, originator) {
|
|
498
|
+
sdk.validateOriginator(originator);
|
|
499
|
+
const { auth } = this.validateAuthAndArgs(args, sdk.validateAbortActionArgs);
|
|
500
|
+
const r = await this.storage.abortAction(args);
|
|
501
|
+
return r;
|
|
502
|
+
}
|
|
503
|
+
async internalizeAction(args, originator) {
|
|
504
|
+
sdk.validateOriginator(originator);
|
|
505
|
+
const { auth, vargs } = this.validateAuthAndArgs(args, sdk.validateInternalizeActionArgs);
|
|
506
|
+
const r = await (0, internalizeAction_1.internalizeAction)(this, auth, args);
|
|
507
|
+
return r;
|
|
508
|
+
}
|
|
509
|
+
async relinquishOutput(args, originator) {
|
|
510
|
+
sdk.validateOriginator(originator);
|
|
511
|
+
const { vargs } = this.validateAuthAndArgs(args, sdk.validateRelinquishOutputArgs);
|
|
512
|
+
const r = await this.storage.relinquishOutput(args);
|
|
513
|
+
return { relinquished: true };
|
|
514
|
+
}
|
|
515
|
+
async isAuthenticated(args, originator) {
|
|
516
|
+
sdk.validateOriginator(originator);
|
|
517
|
+
const r = {
|
|
518
|
+
authenticated: true
|
|
519
|
+
};
|
|
520
|
+
return r;
|
|
521
|
+
}
|
|
522
|
+
async waitForAuthentication(args, originator) {
|
|
523
|
+
sdk.validateOriginator(originator);
|
|
524
|
+
return { authenticated: true };
|
|
525
|
+
}
|
|
526
|
+
async getHeight(args, originator) {
|
|
527
|
+
sdk.validateOriginator(originator);
|
|
528
|
+
const height = await this.getServices().getHeight();
|
|
529
|
+
return { height };
|
|
530
|
+
}
|
|
531
|
+
async getHeaderForHeight(args, originator) {
|
|
532
|
+
sdk.validateOriginator(originator);
|
|
533
|
+
const serializedHeader = await this.getServices().getHeaderForHeight(args.height);
|
|
534
|
+
return { header: sdk_1.Utils.toHex(serializedHeader) };
|
|
535
|
+
}
|
|
536
|
+
async getNetwork(args, originator) {
|
|
537
|
+
sdk.validateOriginator(originator);
|
|
538
|
+
return { network: (0, utilityHelpers_1.toWalletNetwork)(this.chain) };
|
|
539
|
+
}
|
|
540
|
+
async getVersion(args, originator) {
|
|
541
|
+
sdk.validateOriginator(originator);
|
|
542
|
+
return { version: 'wallet-brc100-1.0.0' };
|
|
543
|
+
}
|
|
544
|
+
/**
|
|
545
|
+
* Transfer all possible satoshis held by this wallet to `toWallet`.
|
|
546
|
+
*
|
|
547
|
+
* @param toWallet wallet which will receive this wallet's satoshis.
|
|
548
|
+
*/
|
|
549
|
+
async sweepTo(toWallet) {
|
|
550
|
+
const derivationPrefix = (0, utilityHelpers_1.randomBytesBase64)(8);
|
|
551
|
+
const derivationSuffix = (0, utilityHelpers_1.randomBytesBase64)(8);
|
|
552
|
+
const keyDeriver = this.keyDeriver;
|
|
553
|
+
const t = new ScriptTemplateBRC29_1.ScriptTemplateBRC29({
|
|
554
|
+
derivationPrefix,
|
|
555
|
+
derivationSuffix,
|
|
556
|
+
keyDeriver
|
|
557
|
+
});
|
|
558
|
+
const label = 'sweep';
|
|
559
|
+
const satoshis = generateChange_1.maxPossibleSatoshis;
|
|
560
|
+
const car = await this.createAction({
|
|
561
|
+
outputs: [
|
|
562
|
+
{
|
|
563
|
+
lockingScript: t.lock(keyDeriver.rootKey.toString(), toWallet.identityKey).toHex(),
|
|
564
|
+
satoshis,
|
|
565
|
+
outputDescription: label,
|
|
566
|
+
tags: ['relinquish'],
|
|
567
|
+
customInstructions: JSON.stringify({
|
|
568
|
+
derivationPrefix,
|
|
569
|
+
derivationSuffix,
|
|
570
|
+
type: 'BRC29'
|
|
571
|
+
})
|
|
572
|
+
}
|
|
573
|
+
],
|
|
574
|
+
options: {
|
|
575
|
+
randomizeOutputs: false,
|
|
576
|
+
acceptDelayedBroadcast: false
|
|
577
|
+
},
|
|
578
|
+
labels: [label],
|
|
579
|
+
description: label
|
|
580
|
+
});
|
|
581
|
+
const iar = await toWallet.internalizeAction({
|
|
582
|
+
tx: car.tx,
|
|
583
|
+
outputs: [
|
|
584
|
+
{
|
|
585
|
+
outputIndex: 0,
|
|
586
|
+
protocol: 'wallet payment',
|
|
587
|
+
paymentRemittance: {
|
|
588
|
+
derivationPrefix,
|
|
589
|
+
derivationSuffix,
|
|
590
|
+
senderIdentityKey: this.identityKey
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
],
|
|
594
|
+
description: label,
|
|
595
|
+
labels: [label]
|
|
596
|
+
});
|
|
597
|
+
}
|
|
598
|
+
/**
|
|
599
|
+
* Uses `listOutputs` to iterate over chunks of up to 1000 outputs to
|
|
600
|
+
* compute the sum of output satoshis.
|
|
601
|
+
*
|
|
602
|
+
* @param {string} basket - Optional. Defaults to 'default', the wallet change basket.
|
|
603
|
+
* @returns {sdk.WalletBalance} total sum of output satoshis and utxo details (satoshis and outpoints)
|
|
604
|
+
*/
|
|
605
|
+
async balanceAndUtxos(basket = 'default') {
|
|
606
|
+
const r = { total: 0, utxos: [] };
|
|
607
|
+
let offset = 0;
|
|
608
|
+
for (;;) {
|
|
609
|
+
const change = await this.listOutputs({
|
|
610
|
+
basket,
|
|
611
|
+
limit: 1000,
|
|
612
|
+
offset
|
|
613
|
+
});
|
|
614
|
+
if (change.totalOutputs === 0)
|
|
615
|
+
break;
|
|
616
|
+
for (const o of change.outputs) {
|
|
617
|
+
r.total += o.satoshis;
|
|
618
|
+
r.utxos.push({ satoshis: o.satoshis, outpoint: o.outpoint });
|
|
619
|
+
}
|
|
620
|
+
offset += change.outputs.length;
|
|
621
|
+
}
|
|
622
|
+
return r;
|
|
623
|
+
}
|
|
624
|
+
/**
|
|
625
|
+
* Uses `listOutputs` special operation to compute the total value (of satoshis) for
|
|
626
|
+
* all spendable outputs in the 'default' basket.
|
|
627
|
+
*
|
|
628
|
+
* @returns {number} sum of output satoshis
|
|
629
|
+
*/
|
|
630
|
+
async balance() {
|
|
631
|
+
const args = {
|
|
632
|
+
basket: sdk_2.specOpWalletBalance
|
|
633
|
+
};
|
|
634
|
+
const r = await this.listOutputs(args);
|
|
635
|
+
return r.totalOutputs;
|
|
636
|
+
}
|
|
637
|
+
/**
|
|
638
|
+
* Uses `listOutputs` special operation to review the spendability via `Services` of
|
|
639
|
+
* outputs currently considered spendable. Returns the outputs that fail to verify.
|
|
640
|
+
*
|
|
641
|
+
* Ignores the `limit` and `offset` properties.
|
|
642
|
+
*
|
|
643
|
+
* @param all Defaults to false. If false, only change outputs ('default' basket) are reviewed. If true, all spendable outputs are reviewed.
|
|
644
|
+
* @param release Defaults to false. If true, sets outputs that fail to verify to un-spendable (spendable: false)
|
|
645
|
+
* @param optionalArgs Optional. Additional tags will constrain the outputs processed.
|
|
646
|
+
* @returns outputs which are/where considered spendable but currently fail to verify as spendable.
|
|
647
|
+
*/
|
|
648
|
+
async reviewSpendableOutputs(all = false, release = false, optionalArgs) {
|
|
649
|
+
const args = {
|
|
650
|
+
...(optionalArgs || {}),
|
|
651
|
+
basket: sdk_2.specOpInvalidChange
|
|
652
|
+
};
|
|
653
|
+
args.tags || (args.tags = []);
|
|
654
|
+
if (all)
|
|
655
|
+
args.tags.push('all');
|
|
656
|
+
if (release)
|
|
657
|
+
args.tags.push('release');
|
|
658
|
+
const r = await this.listOutputs(args);
|
|
659
|
+
return r;
|
|
660
|
+
}
|
|
661
|
+
/**
|
|
662
|
+
* Uses `listOutputs` special operation to update the 'default' basket's automatic
|
|
663
|
+
* change generation parameters.
|
|
664
|
+
*
|
|
665
|
+
* @param count target number of change UTXOs to maintain.
|
|
666
|
+
* @param satoshis target value for new change outputs.
|
|
667
|
+
*/
|
|
668
|
+
async setWalletChangeParams(count, satoshis) {
|
|
669
|
+
const args = {
|
|
670
|
+
basket: sdk_2.specOpSetWalletChangeParams,
|
|
671
|
+
tags: [count.toString(), satoshis.toString()]
|
|
672
|
+
};
|
|
673
|
+
await this.listOutputs(args);
|
|
674
|
+
}
|
|
675
|
+
/**
|
|
676
|
+
* Uses `listActions` special operation to return only actions with status 'nosend'.
|
|
677
|
+
*
|
|
678
|
+
* @param abort Defaults to false. If true, runs `abortAction` on each 'nosend' action.
|
|
679
|
+
* @returns {ListActionsResult} start `listActions` result restricted to 'nosend' (or 'failed' if aborted) actions.
|
|
680
|
+
*/
|
|
681
|
+
async listNoSendActions(args, abort = false) {
|
|
682
|
+
const { vargs } = this.validateAuthAndArgs(args, sdk.validateListActionsArgs);
|
|
683
|
+
vargs.labels.push(sdk_2.specOpNoSendActions);
|
|
684
|
+
if (abort)
|
|
685
|
+
vargs.labels.push('abort');
|
|
686
|
+
const r = await this.storage.listActions(vargs);
|
|
687
|
+
return r;
|
|
688
|
+
}
|
|
689
|
+
/**
|
|
690
|
+
* Uses `listActions` special operation to return only actions with status 'failed'.
|
|
691
|
+
*
|
|
692
|
+
* @param unfail Defaults to false. If true, queues the action for attempted recovery.
|
|
693
|
+
* @returns {ListActionsResult} start `listActions` result restricted to 'failed' status actions.
|
|
694
|
+
*/
|
|
695
|
+
async listFailedActions(args, unfail = false) {
|
|
696
|
+
const { vargs } = this.validateAuthAndArgs(args, sdk.validateListActionsArgs);
|
|
697
|
+
vargs.labels.push(sdk_2.specOpFailedActions);
|
|
698
|
+
if (unfail)
|
|
699
|
+
vargs.labels.push('unfail');
|
|
700
|
+
const r = await this.storage.listActions(vargs);
|
|
701
|
+
return r;
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
exports.Wallet = Wallet;
|
|
705
|
+
function throwIfAnyUnsuccessfulCreateActions(r) {
|
|
706
|
+
const ndrs = r.notDelayedResults;
|
|
707
|
+
const swrs = r.sendWithResults;
|
|
708
|
+
if (!ndrs || !swrs || swrs.every(r => r.status === 'unproven'))
|
|
709
|
+
return;
|
|
710
|
+
throw new sdk.WERR_REVIEW_ACTIONS(ndrs, swrs, r.txid, r.tx, r.noSendChange);
|
|
711
|
+
}
|
|
712
|
+
function throwIfAnyUnsuccessfulSignActions(r) {
|
|
713
|
+
const ndrs = r.notDelayedResults;
|
|
714
|
+
const swrs = r.sendWithResults;
|
|
715
|
+
if (!ndrs || !swrs || swrs.every(r => r.status === 'unproven'))
|
|
716
|
+
return;
|
|
717
|
+
throw new sdk.WERR_REVIEW_ACTIONS(ndrs, swrs, r.txid, r.tx);
|
|
718
|
+
}
|
|
719
|
+
/**
|
|
720
|
+
* Throws a WERR_REVIEW_ACTIONS with a full set of properties to test data formats and propagation.
|
|
721
|
+
*/
|
|
722
|
+
function throwDummyReviewActions() {
|
|
723
|
+
const b58Beef = 'gno9MC7VXii1KoCkc2nsVyYJpqzN3dhBzYATETJcys62emMKfpBof4R7GozwYEaSapUtnNvqQ57aaYYjm3U2dv9eUJ1sV46boHkQgppYmAz9YH8FdZduV8aJayPViaKcyPmbDhEw6UW8TM5iFZLXNs7HBnJHUKCeTdNK4FUEL7vAugxAV9WUUZ43BZjJk2SmSeps9TCXjt1Ci9fKWp3d9QSoYvTpxwzyUFHjRKtbUgwq55ZfkBp5bV2Bpz9qSuKywKewW7Hh4S1nCUScwwzpKDozb3zic1V9p2k8rQxoPsRxjUJ8bjhNDdsN8d7KukFuc3n47fXzdWttvnxwsujLJRGnQbgJuknQqx3KLf5kJXHzwjG6TzigZk2t24qeB6d3hbYiaDr2fFkUJBL3tukTHhfNkQYRXuz3kucVDzvejHyqJaF51mXG8BjMN5aQj91ZJXCaPVqkMWCzmvyaqmXMdRiJdSAynhXbQK91xf6RwdNhz1tg5f9B6oJJMhsi9UYSVymmax8VLKD9AKzBCBDcfyD83m3jyS1VgKGZn3SkQmr6bsoWq88L3GsMnnmYUGogvdAYarTqg3pzkjCMxHzmJBMN6ofnUk8c1sRTXQue7BbyUaN5uZu3KW6CmFsEfpuqVvnqFW93TU1jrPP2S8yz8AexAnARPCKE8Yz7RfVaT6RCavwQKL3u5iookwRWEZXW1QWmM37yJWHD87SjVynyg327a1CLwcBxmE2CB48QeNVGyQki4CTQMqw2o8TMhDPJej1g68oniAjBcxBLSCs7KGvK3k7AfrHbCMULX9CTibYhCjdFjbsbBoocqJpxxcvkMo1fEEiAzZuiBVZQDYktDdTVbhKHvYkW25HcYX75NJrpNAhm7AjFeKLzEVxqAQkMfvTufpESNRZF4kQqg2Rg8h2ajcKTd5cpEPwXCrZLHm4EaZEmZVbg3QNfGhn7BJu1bHMtLqPD4y8eJxm2uGrW6saf6qKYmmu64F8A667NbD4yskPRQ1S863VzwGpxxmgLc1Ta3R46jEqsAoRDoZVUaCgBBZG3Yg1CTgi1EVBMXU7qvY4n3h8o2FLCEMWY4KadnV3iD4FbcdCmg4yxBosNAZgbPjhgGjCimjh4YsLd9zymGLmivmz2ZBg5m3xaiXT9NN81X9C1JUujd';
|
|
724
|
+
const beef = sdk_1.Beef.fromBinary(sdk_1.Utils.fromBase58(b58Beef));
|
|
725
|
+
const btx = beef.txs.slice(-1)[0];
|
|
726
|
+
const txid = btx.txid;
|
|
727
|
+
debugger;
|
|
728
|
+
throw new sdk.WERR_REVIEW_ACTIONS([
|
|
729
|
+
{
|
|
730
|
+
txid, // only care that it is syntactically a txid
|
|
731
|
+
status: 'doubleSpend',
|
|
732
|
+
competingTxs: [txid], // a txid in the beef
|
|
733
|
+
competingBeef: beef.toBinary()
|
|
734
|
+
}
|
|
735
|
+
], [
|
|
736
|
+
{
|
|
737
|
+
txid,
|
|
738
|
+
status: 'failed'
|
|
739
|
+
}
|
|
740
|
+
], txid, beef.toBinaryAtomic(txid), [`${txid}.0`]);
|
|
741
|
+
}
|
|
742
|
+
//# sourceMappingURL=Wallet.js.map
|