@arkade-os/sdk 0.4.27 → 0.4.28
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/README.md +31 -100
- package/dist/adapters/asyncStorage.cjs +48 -0
- package/dist/adapters/asyncStorage.cjs.map +1 -0
- package/dist/adapters/asyncStorage.d.cts +16 -0
- package/dist/{types/storage → adapters}/asyncStorage.d.ts +5 -2
- package/dist/adapters/asyncStorage.js +46 -0
- package/dist/adapters/asyncStorage.js.map +1 -0
- package/dist/adapters/expo.cjs +19 -0
- package/dist/adapters/expo.cjs.map +1 -0
- package/dist/adapters/expo.d.cts +48 -0
- package/dist/adapters/expo.d.ts +48 -0
- package/dist/adapters/expo.js +6 -0
- package/dist/adapters/expo.js.map +1 -0
- package/dist/adapters/fileSystem.cjs +116 -0
- package/dist/adapters/fileSystem.cjs.map +1 -0
- package/dist/adapters/fileSystem.d.cts +17 -0
- package/dist/{types/storage → adapters}/fileSystem.d.ts +5 -2
- package/dist/adapters/fileSystem.js +93 -0
- package/dist/adapters/fileSystem.js.map +1 -0
- package/dist/adapters/indexedDB.cjs +103 -0
- package/dist/adapters/indexedDB.cjs.map +1 -0
- package/dist/adapters/indexedDB.d.cts +18 -0
- package/dist/{types/storage → adapters}/indexedDB.d.ts +5 -2
- package/dist/adapters/indexedDB.js +101 -0
- package/dist/adapters/indexedDB.js.map +1 -0
- package/dist/adapters/localStorage.cjs +50 -0
- package/dist/adapters/localStorage.cjs.map +1 -0
- package/dist/{types/storage/inMemory.d.ts → adapters/localStorage.d.cts} +6 -3
- package/dist/{types/storage → adapters}/localStorage.d.ts +5 -2
- package/dist/adapters/localStorage.js +48 -0
- package/dist/adapters/localStorage.js.map +1 -0
- package/dist/ark-TZ1gXAXU.d.cts +3880 -0
- package/dist/ark-TZ1gXAXU.d.ts +3880 -0
- package/dist/{types/worker/expo/asyncStorageTaskQueue.d.ts → asyncStorageTaskQueue-Cb1F_Z9s.d.ts} +6 -3
- package/dist/asyncStorageTaskQueue-EFqSmYTg.d.cts +49 -0
- package/dist/chunk-5BLDMQED.cjs +18 -0
- package/dist/chunk-5BLDMQED.cjs.map +1 -0
- package/dist/chunk-5PG7DV7A.cjs +805 -0
- package/dist/chunk-5PG7DV7A.cjs.map +1 -0
- package/dist/chunk-A3EMF7RN.js +95 -0
- package/dist/chunk-A3EMF7RN.js.map +1 -0
- package/dist/chunk-ADV27S4N.cjs +2701 -0
- package/dist/chunk-ADV27S4N.cjs.map +1 -0
- package/dist/chunk-BQLHADL7.js +13805 -0
- package/dist/chunk-BQLHADL7.js.map +1 -0
- package/dist/chunk-CFZMTDWI.js +209 -0
- package/dist/chunk-CFZMTDWI.js.map +1 -0
- package/dist/chunk-FG5ACJJW.cjs +212 -0
- package/dist/chunk-FG5ACJJW.cjs.map +1 -0
- package/dist/chunk-HW3JJ323.js +768 -0
- package/dist/chunk-HW3JJ323.js.map +1 -0
- package/dist/chunk-I3DGUUCT.cjs +838 -0
- package/dist/chunk-I3DGUUCT.cjs.map +1 -0
- package/dist/chunk-IPX2R7FR.cjs +100 -0
- package/dist/chunk-IPX2R7FR.cjs.map +1 -0
- package/dist/chunk-NSBPE2FW.js +15 -0
- package/dist/chunk-NSBPE2FW.js.map +1 -0
- package/dist/chunk-T64LAI7L.js +829 -0
- package/dist/chunk-T64LAI7L.js.map +1 -0
- package/dist/chunk-ZBUDLTBO.js +2671 -0
- package/dist/chunk-ZBUDLTBO.js.map +1 -0
- package/dist/chunk-ZLO6NETT.cjs +13910 -0
- package/dist/chunk-ZLO6NETT.cjs.map +1 -0
- package/dist/contracts/handlers/index.cjs +26 -0
- package/dist/contracts/handlers/index.cjs.map +1 -0
- package/dist/contracts/handlers/index.d.cts +7 -0
- package/dist/contracts/handlers/index.d.ts +7 -0
- package/dist/contracts/handlers/index.js +5 -0
- package/dist/contracts/handlers/index.js.map +1 -0
- package/dist/delegate-BFZs69hp.d.cts +84 -0
- package/dist/delegate-aaVGfWsV.d.ts +84 -0
- package/dist/index-B22cA64m.d.cts +199 -0
- package/dist/{types/storage/index.d.ts → index-C0IanN1m.d.cts} +3 -1
- package/dist/index-C0IanN1m.d.ts +11 -0
- package/dist/index-NDla_UoJ.d.ts +199 -0
- package/dist/index.cjs +480 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +3343 -0
- package/dist/index.d.ts +3343 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/repositories/realm/index.cjs +513 -0
- package/dist/repositories/realm/index.cjs.map +1 -0
- package/dist/repositories/realm/index.d.cts +217 -0
- package/dist/{types/repositories/realm/schemas.d.ts → repositories/realm/index.d.ts} +80 -112
- package/dist/repositories/realm/index.js +507 -0
- package/dist/repositories/realm/index.js.map +1 -0
- package/dist/repositories/sqlite/index.cjs +588 -0
- package/dist/repositories/sqlite/index.cjs.map +1 -0
- package/dist/repositories/sqlite/index.d.cts +118 -0
- package/dist/{types/repositories/sqlite/walletRepository.d.ts → repositories/sqlite/index.d.ts} +58 -5
- package/dist/repositories/sqlite/index.js +585 -0
- package/dist/repositories/sqlite/index.js.map +1 -0
- package/dist/taskRunner-C6Ff4OaU.d.cts +114 -0
- package/dist/taskRunner-yvPN8Z0K.d.ts +114 -0
- package/dist/wallet/expo/background.cjs +93 -0
- package/dist/wallet/expo/background.cjs.map +1 -0
- package/dist/wallet/expo/background.d.cts +84 -0
- package/dist/wallet/expo/background.d.ts +84 -0
- package/dist/wallet/expo/background.js +68 -0
- package/dist/wallet/expo/background.js.map +1 -0
- package/dist/wallet/expo/index.cjs +171 -0
- package/dist/wallet/expo/index.cjs.map +1 -0
- package/dist/wallet/expo/index.d.cts +122 -0
- package/dist/{types/wallet/expo/wallet.d.ts → wallet/expo/index.d.ts} +45 -22
- package/dist/wallet/expo/index.js +169 -0
- package/dist/wallet/expo/index.js.map +1 -0
- package/dist/wallet-AF-p-OWj.d.cts +774 -0
- package/dist/wallet-D9NBRqvC.d.ts +774 -0
- package/dist/worker/expo/index.cjs +140 -0
- package/dist/worker/expo/index.cjs.map +1 -0
- package/dist/worker/expo/index.d.cts +29 -0
- package/dist/worker/expo/index.d.ts +29 -0
- package/dist/worker/expo/index.js +121 -0
- package/dist/worker/expo/index.js.map +1 -0
- package/package.json +110 -76
- package/dist/cjs/adapters/asyncStorage.js +0 -5
- package/dist/cjs/adapters/expo.js +0 -8
- package/dist/cjs/adapters/fileSystem.js +0 -5
- package/dist/cjs/adapters/indexedDB.js +0 -5
- package/dist/cjs/adapters/localStorage.js +0 -5
- package/dist/cjs/arkfee/celenv.js +0 -43
- package/dist/cjs/arkfee/estimator.js +0 -143
- package/dist/cjs/arkfee/index.js +0 -5
- package/dist/cjs/arkfee/types.js +0 -26
- package/dist/cjs/arknote/index.js +0 -128
- package/dist/cjs/bip322/index.js +0 -270
- package/dist/cjs/contracts/arkcontract.js +0 -147
- package/dist/cjs/contracts/contractManager.js +0 -649
- package/dist/cjs/contracts/contractWatcher.js +0 -598
- package/dist/cjs/contracts/handlers/default.js +0 -93
- package/dist/cjs/contracts/handlers/delegate.js +0 -90
- package/dist/cjs/contracts/handlers/helpers.js +0 -115
- package/dist/cjs/contracts/handlers/index.js +0 -19
- package/dist/cjs/contracts/handlers/registry.js +0 -89
- package/dist/cjs/contracts/handlers/vhtlc.js +0 -194
- package/dist/cjs/contracts/index.js +0 -41
- package/dist/cjs/contracts/types.js +0 -2
- package/dist/cjs/contracts/vtxoOwnership.js +0 -78
- package/dist/cjs/extension/asset/assetGroup.js +0 -228
- package/dist/cjs/extension/asset/assetId.js +0 -152
- package/dist/cjs/extension/asset/assetInput.js +0 -222
- package/dist/cjs/extension/asset/assetOutput.js +0 -174
- package/dist/cjs/extension/asset/assetRef.js +0 -148
- package/dist/cjs/extension/asset/index.js +0 -23
- package/dist/cjs/extension/asset/metadata.js +0 -187
- package/dist/cjs/extension/asset/packet.js +0 -114
- package/dist/cjs/extension/asset/types.js +0 -22
- package/dist/cjs/extension/asset/utils.js +0 -105
- package/dist/cjs/extension/index.js +0 -254
- package/dist/cjs/extension/packet.js +0 -20
- package/dist/cjs/forfeit.js +0 -45
- package/dist/cjs/identity/descriptor.js +0 -169
- package/dist/cjs/identity/descriptorProvider.js +0 -2
- package/dist/cjs/identity/hdCapableIdentity.js +0 -20
- package/dist/cjs/identity/index.js +0 -40
- package/dist/cjs/identity/seedIdentity.js +0 -477
- package/dist/cjs/identity/serialize.js +0 -171
- package/dist/cjs/identity/singleKey.js +0 -126
- package/dist/cjs/identity/staticDescriptorProvider.js +0 -65
- package/dist/cjs/index.js +0 -202
- package/dist/cjs/intent/index.js +0 -259
- package/dist/cjs/musig2/index.js +0 -11
- package/dist/cjs/musig2/keys.js +0 -57
- package/dist/cjs/musig2/nonces.js +0 -48
- package/dist/cjs/musig2/sign.js +0 -102
- package/dist/cjs/networks.js +0 -26
- package/dist/cjs/package.json +0 -3
- package/dist/cjs/providers/ark.js +0 -577
- package/dist/cjs/providers/delegator.js +0 -85
- package/dist/cjs/providers/electrum.js +0 -869
- package/dist/cjs/providers/errors.js +0 -59
- package/dist/cjs/providers/expoArk.js +0 -82
- package/dist/cjs/providers/expoIndexer.js +0 -111
- package/dist/cjs/providers/expoUtils.js +0 -124
- package/dist/cjs/providers/indexer.js +0 -630
- package/dist/cjs/providers/onchain.js +0 -262
- package/dist/cjs/providers/utils.js +0 -121
- package/dist/cjs/repositories/contractRepository.js +0 -2
- package/dist/cjs/repositories/inMemory/contractRepository.js +0 -55
- package/dist/cjs/repositories/inMemory/walletRepository.js +0 -115
- package/dist/cjs/repositories/index.js +0 -34
- package/dist/cjs/repositories/indexedDB/contractRepository.js +0 -187
- package/dist/cjs/repositories/indexedDB/db.js +0 -19
- package/dist/cjs/repositories/indexedDB/manager.js +0 -100
- package/dist/cjs/repositories/indexedDB/schema.js +0 -204
- package/dist/cjs/repositories/indexedDB/walletRepository.js +0 -474
- package/dist/cjs/repositories/indexedDB/websqlAdapter.js +0 -144
- package/dist/cjs/repositories/migrations/contractRepositoryImpl.js +0 -127
- package/dist/cjs/repositories/migrations/fromStorageAdapter.js +0 -66
- package/dist/cjs/repositories/migrations/walletRepositoryImpl.js +0 -184
- package/dist/cjs/repositories/realm/contractRepository.js +0 -116
- package/dist/cjs/repositories/realm/index.js +0 -11
- package/dist/cjs/repositories/realm/schemas.js +0 -157
- package/dist/cjs/repositories/realm/types.js +0 -7
- package/dist/cjs/repositories/realm/walletRepository.js +0 -305
- package/dist/cjs/repositories/scriptFromAddress.js +0 -16
- package/dist/cjs/repositories/serialization.js +0 -82
- package/dist/cjs/repositories/sqlite/contractRepository.js +0 -135
- package/dist/cjs/repositories/sqlite/index.js +0 -7
- package/dist/cjs/repositories/sqlite/types.js +0 -2
- package/dist/cjs/repositories/sqlite/walletRepository.js +0 -441
- package/dist/cjs/repositories/walletRepository.js +0 -2
- package/dist/cjs/script/address.js +0 -108
- package/dist/cjs/script/base.js +0 -185
- package/dist/cjs/script/default.js +0 -57
- package/dist/cjs/script/delegate.js +0 -53
- package/dist/cjs/script/tapscript.js +0 -619
- package/dist/cjs/script/vhtlc.js +0 -170
- package/dist/cjs/storage/asyncStorage.js +0 -50
- package/dist/cjs/storage/fileSystem.js +0 -141
- package/dist/cjs/storage/inMemory.js +0 -24
- package/dist/cjs/storage/index.js +0 -2
- package/dist/cjs/storage/indexedDB.js +0 -101
- package/dist/cjs/storage/localStorage.js +0 -51
- package/dist/cjs/tree/signingSession.js +0 -229
- package/dist/cjs/tree/txTree.js +0 -192
- package/dist/cjs/tree/validation.js +0 -107
- package/dist/cjs/utils/anchor.js +0 -35
- package/dist/cjs/utils/arkTransaction.js +0 -271
- package/dist/cjs/utils/bip21.js +0 -127
- package/dist/cjs/utils/syncCursors.js +0 -128
- package/dist/cjs/utils/timelock.js +0 -59
- package/dist/cjs/utils/transaction.js +0 -28
- package/dist/cjs/utils/transactionHistory.js +0 -183
- package/dist/cjs/utils/txSizeEstimator.js +0 -132
- package/dist/cjs/utils/unknownFields.js +0 -174
- package/dist/cjs/wallet/asset-manager.js +0 -330
- package/dist/cjs/wallet/asset.js +0 -119
- package/dist/cjs/wallet/batch.js +0 -183
- package/dist/cjs/wallet/delegator.js +0 -308
- package/dist/cjs/wallet/expo/background.js +0 -116
- package/dist/cjs/wallet/expo/index.js +0 -9
- package/dist/cjs/wallet/expo/wallet.js +0 -230
- package/dist/cjs/wallet/hdDescriptorProvider.js +0 -188
- package/dist/cjs/wallet/index.js +0 -82
- package/dist/cjs/wallet/inputSignerRouter.js +0 -98
- package/dist/cjs/wallet/onchain.js +0 -290
- package/dist/cjs/wallet/ramps.js +0 -216
- package/dist/cjs/wallet/serviceWorker/wallet-message-handler.js +0 -953
- package/dist/cjs/wallet/serviceWorker/wallet.js +0 -1174
- package/dist/cjs/wallet/signingErrors.js +0 -32
- package/dist/cjs/wallet/unroll.js +0 -293
- package/dist/cjs/wallet/utils.js +0 -111
- package/dist/cjs/wallet/validation.js +0 -154
- package/dist/cjs/wallet/vtxo-manager.js +0 -1142
- package/dist/cjs/wallet/wallet.js +0 -2195
- package/dist/cjs/wallet/walletReceiveRotator.js +0 -547
- package/dist/cjs/worker/browser/service-worker-manager.js +0 -183
- package/dist/cjs/worker/browser/utils.js +0 -67
- package/dist/cjs/worker/errors.js +0 -16
- package/dist/cjs/worker/expo/asyncStorageTaskQueue.js +0 -78
- package/dist/cjs/worker/expo/index.js +0 -13
- package/dist/cjs/worker/expo/processors/contractPollProcessor.js +0 -62
- package/dist/cjs/worker/expo/processors/index.js +0 -6
- package/dist/cjs/worker/expo/taskQueue.js +0 -41
- package/dist/cjs/worker/expo/taskRunner.js +0 -73
- package/dist/cjs/worker/messageBus.js +0 -474
- package/dist/esm/adapters/asyncStorage.js +0 -1
- package/dist/esm/adapters/expo.js +0 -3
- package/dist/esm/adapters/fileSystem.js +0 -1
- package/dist/esm/adapters/indexedDB.js +0 -1
- package/dist/esm/adapters/localStorage.js +0 -1
- package/dist/esm/arkfee/celenv.js +0 -40
- package/dist/esm/arkfee/estimator.js +0 -139
- package/dist/esm/arkfee/index.js +0 -1
- package/dist/esm/arkfee/types.js +0 -22
- package/dist/esm/arknote/index.js +0 -124
- package/dist/esm/bip322/index.js +0 -267
- package/dist/esm/contracts/arkcontract.js +0 -140
- package/dist/esm/contracts/contractManager.js +0 -645
- package/dist/esm/contracts/contractWatcher.js +0 -594
- package/dist/esm/contracts/handlers/default.js +0 -90
- package/dist/esm/contracts/handlers/delegate.js +0 -87
- package/dist/esm/contracts/handlers/helpers.js +0 -110
- package/dist/esm/contracts/handlers/index.js +0 -12
- package/dist/esm/contracts/handlers/registry.js +0 -86
- package/dist/esm/contracts/handlers/vhtlc.js +0 -191
- package/dist/esm/contracts/index.js +0 -13
- package/dist/esm/contracts/types.js +0 -1
- package/dist/esm/contracts/vtxoOwnership.js +0 -69
- package/dist/esm/extension/asset/assetGroup.js +0 -224
- package/dist/esm/extension/asset/assetId.js +0 -148
- package/dist/esm/extension/asset/assetInput.js +0 -217
- package/dist/esm/extension/asset/assetOutput.js +0 -169
- package/dist/esm/extension/asset/assetRef.js +0 -144
- package/dist/esm/extension/asset/index.js +0 -8
- package/dist/esm/extension/asset/metadata.js +0 -182
- package/dist/esm/extension/asset/packet.js +0 -110
- package/dist/esm/extension/asset/types.js +0 -19
- package/dist/esm/extension/asset/utils.js +0 -99
- package/dist/esm/extension/index.js +0 -248
- package/dist/esm/extension/packet.js +0 -16
- package/dist/esm/forfeit.js +0 -41
- package/dist/esm/identity/descriptor.js +0 -161
- package/dist/esm/identity/descriptorProvider.js +0 -1
- package/dist/esm/identity/hdCapableIdentity.js +0 -17
- package/dist/esm/identity/index.js +0 -13
- package/dist/esm/identity/seedIdentity.js +0 -469
- package/dist/esm/identity/serialize.js +0 -164
- package/dist/esm/identity/singleKey.js +0 -121
- package/dist/esm/identity/staticDescriptorProvider.js +0 -61
- package/dist/esm/index.js +0 -87
- package/dist/esm/intent/index.js +0 -255
- package/dist/esm/musig2/index.js +0 -3
- package/dist/esm/musig2/keys.js +0 -21
- package/dist/esm/musig2/nonces.js +0 -11
- package/dist/esm/musig2/sign.js +0 -63
- package/dist/esm/networks.js +0 -22
- package/dist/esm/package.json +0 -3
- package/dist/esm/providers/ark.js +0 -572
- package/dist/esm/providers/delegator.js +0 -81
- package/dist/esm/providers/electrum.js +0 -864
- package/dist/esm/providers/errors.js +0 -54
- package/dist/esm/providers/expoArk.js +0 -78
- package/dist/esm/providers/expoIndexer.js +0 -107
- package/dist/esm/providers/expoUtils.js +0 -87
- package/dist/esm/providers/indexer.js +0 -626
- package/dist/esm/providers/onchain.js +0 -258
- package/dist/esm/providers/utils.js +0 -117
- package/dist/esm/repositories/contractRepository.js +0 -1
- package/dist/esm/repositories/inMemory/contractRepository.js +0 -51
- package/dist/esm/repositories/inMemory/walletRepository.js +0 -111
- package/dist/esm/repositories/index.js +0 -10
- package/dist/esm/repositories/indexedDB/contractRepository.js +0 -183
- package/dist/esm/repositories/indexedDB/db.js +0 -4
- package/dist/esm/repositories/indexedDB/manager.js +0 -95
- package/dist/esm/repositories/indexedDB/schema.js +0 -199
- package/dist/esm/repositories/indexedDB/walletRepository.js +0 -470
- package/dist/esm/repositories/indexedDB/websqlAdapter.js +0 -138
- package/dist/esm/repositories/migrations/contractRepositoryImpl.js +0 -121
- package/dist/esm/repositories/migrations/fromStorageAdapter.js +0 -58
- package/dist/esm/repositories/migrations/walletRepositoryImpl.js +0 -180
- package/dist/esm/repositories/realm/contractRepository.js +0 -112
- package/dist/esm/repositories/realm/index.js +0 -3
- package/dist/esm/repositories/realm/schemas.js +0 -153
- package/dist/esm/repositories/realm/types.js +0 -6
- package/dist/esm/repositories/realm/walletRepository.js +0 -301
- package/dist/esm/repositories/scriptFromAddress.js +0 -13
- package/dist/esm/repositories/serialization.js +0 -67
- package/dist/esm/repositories/sqlite/contractRepository.js +0 -131
- package/dist/esm/repositories/sqlite/index.js +0 -2
- package/dist/esm/repositories/sqlite/types.js +0 -1
- package/dist/esm/repositories/sqlite/walletRepository.js +0 -437
- package/dist/esm/repositories/walletRepository.js +0 -1
- package/dist/esm/script/address.js +0 -104
- package/dist/esm/script/base.js +0 -179
- package/dist/esm/script/default.js +0 -54
- package/dist/esm/script/delegate.js +0 -50
- package/dist/esm/script/tapscript.js +0 -615
- package/dist/esm/script/vhtlc.js +0 -167
- package/dist/esm/storage/asyncStorage.js +0 -46
- package/dist/esm/storage/fileSystem.js +0 -104
- package/dist/esm/storage/inMemory.js +0 -20
- package/dist/esm/storage/index.js +0 -1
- package/dist/esm/storage/indexedDB.js +0 -97
- package/dist/esm/storage/localStorage.js +0 -47
- package/dist/esm/tree/signingSession.js +0 -191
- package/dist/esm/tree/txTree.js +0 -188
- package/dist/esm/tree/validation.js +0 -101
- package/dist/esm/utils/anchor.js +0 -31
- package/dist/esm/utils/arkTransaction.js +0 -264
- package/dist/esm/utils/bip21.js +0 -123
- package/dist/esm/utils/syncCursors.js +0 -119
- package/dist/esm/utils/timelock.js +0 -22
- package/dist/esm/utils/transaction.js +0 -24
- package/dist/esm/utils/transactionHistory.js +0 -180
- package/dist/esm/utils/txSizeEstimator.js +0 -128
- package/dist/esm/utils/unknownFields.js +0 -169
- package/dist/esm/wallet/asset-manager.js +0 -325
- package/dist/esm/wallet/asset.js +0 -113
- package/dist/esm/wallet/batch.js +0 -180
- package/dist/esm/wallet/delegator.js +0 -303
- package/dist/esm/wallet/expo/background.js +0 -111
- package/dist/esm/wallet/expo/index.js +0 -2
- package/dist/esm/wallet/expo/wallet.js +0 -193
- package/dist/esm/wallet/hdDescriptorProvider.js +0 -184
- package/dist/esm/wallet/index.js +0 -75
- package/dist/esm/wallet/inputSignerRouter.js +0 -94
- package/dist/esm/wallet/onchain.js +0 -285
- package/dist/esm/wallet/ramps.js +0 -212
- package/dist/esm/wallet/serviceWorker/wallet-message-handler.js +0 -946
- package/dist/esm/wallet/serviceWorker/wallet.js +0 -1169
- package/dist/esm/wallet/signingErrors.js +0 -27
- package/dist/esm/wallet/unroll.js +0 -289
- package/dist/esm/wallet/utils.js +0 -103
- package/dist/esm/wallet/validation.js +0 -142
- package/dist/esm/wallet/vtxo-manager.js +0 -1136
- package/dist/esm/wallet/wallet.js +0 -2186
- package/dist/esm/wallet/walletReceiveRotator.js +0 -540
- package/dist/esm/worker/browser/service-worker-manager.js +0 -177
- package/dist/esm/worker/browser/utils.js +0 -63
- package/dist/esm/worker/errors.js +0 -11
- package/dist/esm/worker/expo/asyncStorageTaskQueue.js +0 -74
- package/dist/esm/worker/expo/index.js +0 -4
- package/dist/esm/worker/expo/processors/contractPollProcessor.js +0 -59
- package/dist/esm/worker/expo/processors/index.js +0 -1
- package/dist/esm/worker/expo/taskQueue.js +0 -37
- package/dist/esm/worker/expo/taskRunner.js +0 -69
- package/dist/esm/worker/messageBus.js +0 -470
- package/dist/types/adapters/asyncStorage.d.ts +0 -2
- package/dist/types/adapters/expo.d.ts +0 -4
- package/dist/types/adapters/fileSystem.d.ts +0 -2
- package/dist/types/adapters/indexedDB.d.ts +0 -2
- package/dist/types/adapters/localStorage.d.ts +0 -2
- package/dist/types/arkfee/celenv.d.ts +0 -25
- package/dist/types/arkfee/estimator.d.ts +0 -49
- package/dist/types/arkfee/index.d.ts +0 -2
- package/dist/types/arkfee/types.d.ts +0 -38
- package/dist/types/arknote/index.d.ts +0 -84
- package/dist/types/bip322/index.d.ts +0 -55
- package/dist/types/contracts/arkcontract.d.ts +0 -99
- package/dist/types/contracts/contractManager.d.ts +0 -411
- package/dist/types/contracts/contractWatcher.d.ts +0 -217
- package/dist/types/contracts/handlers/default.d.ts +0 -19
- package/dist/types/contracts/handlers/delegate.d.ts +0 -21
- package/dist/types/contracts/handlers/helpers.d.ts +0 -19
- package/dist/types/contracts/handlers/index.d.ts +0 -7
- package/dist/types/contracts/handlers/registry.d.ts +0 -65
- package/dist/types/contracts/handlers/vhtlc.d.ts +0 -32
- package/dist/types/contracts/index.d.ts +0 -14
- package/dist/types/contracts/types.d.ts +0 -250
- package/dist/types/contracts/vtxoOwnership.d.ts +0 -33
- package/dist/types/extension/asset/assetGroup.d.ts +0 -119
- package/dist/types/extension/asset/assetId.d.ts +0 -83
- package/dist/types/extension/asset/assetInput.d.ts +0 -64
- package/dist/types/extension/asset/assetOutput.d.ts +0 -54
- package/dist/types/extension/asset/assetRef.d.ts +0 -91
- package/dist/types/extension/asset/index.d.ts +0 -8
- package/dist/types/extension/asset/metadata.d.ts +0 -52
- package/dist/types/extension/asset/packet.d.ts +0 -41
- package/dist/types/extension/asset/types.d.ts +0 -16
- package/dist/types/extension/asset/utils.d.ts +0 -21
- package/dist/types/extension/index.d.ts +0 -56
- package/dist/types/extension/packet.d.ts +0 -21
- package/dist/types/forfeit.d.ts +0 -18
- package/dist/types/identity/descriptor.d.ts +0 -61
- package/dist/types/identity/descriptorProvider.d.ts +0 -42
- package/dist/types/identity/hdCapableIdentity.d.ts +0 -71
- package/dist/types/identity/index.d.ts +0 -57
- package/dist/types/identity/seedIdentity.d.ts +0 -270
- package/dist/types/identity/serialize.d.ts +0 -96
- package/dist/types/identity/singleKey.d.ts +0 -62
- package/dist/types/identity/staticDescriptorProvider.d.ts +0 -18
- package/dist/types/index.d.ts +0 -59
- package/dist/types/intent/index.d.ts +0 -86
- package/dist/types/musig2/index.d.ts +0 -4
- package/dist/types/musig2/keys.d.ts +0 -9
- package/dist/types/musig2/nonces.d.ts +0 -14
- package/dist/types/musig2/sign.d.ts +0 -27
- package/dist/types/networks.d.ts +0 -16
- package/dist/types/providers/ark.d.ts +0 -369
- package/dist/types/providers/delegator.d.ts +0 -82
- package/dist/types/providers/electrum.d.ts +0 -312
- package/dist/types/providers/errors.d.ts +0 -13
- package/dist/types/providers/expoArk.d.ts +0 -22
- package/dist/types/providers/expoIndexer.d.ts +0 -18
- package/dist/types/providers/expoUtils.d.ts +0 -18
- package/dist/types/providers/indexer.d.ts +0 -301
- package/dist/types/providers/onchain.d.ts +0 -148
- package/dist/types/providers/utils.d.ts +0 -12
- package/dist/types/repositories/contractRepository.d.ts +0 -32
- package/dist/types/repositories/inMemory/contractRepository.d.ts +0 -17
- package/dist/types/repositories/inMemory/walletRepository.d.ts +0 -29
- package/dist/types/repositories/index.d.ts +0 -9
- package/dist/types/repositories/indexedDB/contractRepository.d.ts +0 -21
- package/dist/types/repositories/indexedDB/db.d.ts +0 -4
- package/dist/types/repositories/indexedDB/manager.d.ts +0 -25
- package/dist/types/repositories/indexedDB/schema.d.ts +0 -9
- package/dist/types/repositories/indexedDB/walletRepository.d.ts +0 -28
- package/dist/types/repositories/indexedDB/websqlAdapter.d.ts +0 -49
- package/dist/types/repositories/migrations/contractRepositoryImpl.d.ts +0 -24
- package/dist/types/repositories/migrations/fromStorageAdapter.d.ts +0 -19
- package/dist/types/repositories/migrations/walletRepositoryImpl.d.ts +0 -27
- package/dist/types/repositories/realm/contractRepository.d.ts +0 -24
- package/dist/types/repositories/realm/index.d.ts +0 -4
- package/dist/types/repositories/realm/types.d.ts +0 -16
- package/dist/types/repositories/realm/walletRepository.d.ts +0 -34
- package/dist/types/repositories/scriptFromAddress.d.ts +0 -9
- package/dist/types/repositories/serialization.d.ts +0 -65
- package/dist/types/repositories/sqlite/contractRepository.d.ts +0 -33
- package/dist/types/repositories/sqlite/index.d.ts +0 -3
- package/dist/types/repositories/sqlite/types.d.ts +0 -18
- package/dist/types/repositories/walletRepository.d.ts +0 -72
- package/dist/types/script/address.d.ts +0 -67
- package/dist/types/script/base.d.ts +0 -105
- package/dist/types/script/default.d.ts +0 -44
- package/dist/types/script/delegate.d.ts +0 -40
- package/dist/types/script/tapscript.d.ts +0 -169
- package/dist/types/script/vhtlc.d.ts +0 -66
- package/dist/types/tree/signingSession.d.ts +0 -37
- package/dist/types/tree/txTree.d.ts +0 -28
- package/dist/types/tree/validation.d.ts +0 -15
- package/dist/types/utils/anchor.d.ts +0 -19
- package/dist/types/utils/arkTransaction.d.ts +0 -49
- package/dist/types/utils/bip21.d.ts +0 -38
- package/dist/types/utils/syncCursors.d.ts +0 -60
- package/dist/types/utils/timelock.d.ts +0 -9
- package/dist/types/utils/transaction.d.ts +0 -13
- package/dist/types/utils/transactionHistory.d.ts +0 -15
- package/dist/types/utils/txSizeEstimator.d.ts +0 -40
- package/dist/types/utils/unknownFields.d.ts +0 -83
- package/dist/types/wallet/asset-manager.d.ts +0 -69
- package/dist/types/wallet/asset.d.ts +0 -21
- package/dist/types/wallet/batch.d.ts +0 -107
- package/dist/types/wallet/delegator.d.ts +0 -48
- package/dist/types/wallet/expo/background.d.ts +0 -66
- package/dist/types/wallet/expo/index.d.ts +0 -4
- package/dist/types/wallet/hdDescriptorProvider.d.ts +0 -114
- package/dist/types/wallet/index.d.ts +0 -789
- package/dist/types/wallet/inputSignerRouter.d.ts +0 -35
- package/dist/types/wallet/onchain.d.ts +0 -109
- package/dist/types/wallet/ramps.d.ts +0 -64
- package/dist/types/wallet/serviceWorker/wallet-message-handler.d.ts +0 -543
- package/dist/types/wallet/serviceWorker/wallet.d.ts +0 -248
- package/dist/types/wallet/signingErrors.d.ts +0 -19
- package/dist/types/wallet/unroll.d.ts +0 -114
- package/dist/types/wallet/utils.d.ts +0 -36
- package/dist/types/wallet/validation.d.ts +0 -24
- package/dist/types/wallet/vtxo-manager.d.ts +0 -476
- package/dist/types/wallet/wallet.d.ts +0 -409
- package/dist/types/wallet/walletReceiveRotator.d.ts +0 -306
- package/dist/types/worker/browser/service-worker-manager.d.ts +0 -32
- package/dist/types/worker/browser/utils.d.ts +0 -17
- package/dist/types/worker/errors.d.ts +0 -7
- package/dist/types/worker/expo/index.d.ts +0 -7
- package/dist/types/worker/expo/processors/contractPollProcessor.d.ts +0 -19
- package/dist/types/worker/expo/processors/index.d.ts +0 -1
- package/dist/types/worker/expo/taskQueue.d.ts +0 -50
- package/dist/types/worker/expo/taskRunner.d.ts +0 -66
- package/dist/types/worker/messageBus.d.ts +0 -189
|
@@ -1,306 +0,0 @@
|
|
|
1
|
-
import { DescriptorProvider } from "../identity/descriptorProvider.js";
|
|
2
|
-
import { ContractRepository } from "../repositories/contractRepository.js";
|
|
3
|
-
import { WalletRepository } from "../repositories/walletRepository.js";
|
|
4
|
-
import { IContractManager } from "../contracts/contractManager.js";
|
|
5
|
-
import { DefaultVtxo } from "../script/default.js";
|
|
6
|
-
import { DelegateVtxo } from "../script/delegate.js";
|
|
7
|
-
import type { WalletConfig } from "./index.js";
|
|
8
|
-
/**
|
|
9
|
-
* Inputs the wallet hands to a {@link ReceiveRotatorFactory} when
|
|
10
|
-
* asking it to construct the rotator at boot. The factory uses these
|
|
11
|
-
* to look up the wallet's current display contract (or allocate a
|
|
12
|
-
* fresh receive descriptor). Note: no `offchainTapscript` here — the
|
|
13
|
-
* factory's job is allocation, not script construction. The wallet's
|
|
14
|
-
* orchestrator (`WalletReceiveRotator.resolveBoot`) handles the
|
|
15
|
-
* tapscript rebuild on top of the factory's result.
|
|
16
|
-
*/
|
|
17
|
-
export interface ReceiveRotatorBootOpts {
|
|
18
|
-
walletRepository: WalletRepository;
|
|
19
|
-
contractRepository: ContractRepository;
|
|
20
|
-
serverPubKey: Uint8Array;
|
|
21
|
-
/**
|
|
22
|
-
* Expected contract family ("default" or "delegate"). When provided,
|
|
23
|
-
* boot will only consider contracts of this type when looking up the
|
|
24
|
-
* wallet's current display contract, preventing a default wallet from
|
|
25
|
-
* accidentally picking up a delegate contract or vice versa.
|
|
26
|
-
*/
|
|
27
|
-
expectedContractType?: "default" | "delegate";
|
|
28
|
-
/**
|
|
29
|
-
* Logger to receive rotation-failure + backoff diagnostics. Defaults
|
|
30
|
-
* to `console` when omitted. Any object implementing
|
|
31
|
-
* {@link Logger.error} works (winston, pino, Sentry breadcrumbs,
|
|
32
|
-
* the runtime's own logger).
|
|
33
|
-
*/
|
|
34
|
-
logger?: Logger;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Output of {@link ReceiveRotatorFactory.createReceiveRotator}: the
|
|
38
|
-
* constructed rotator paired with the receive pubkey it resolved at
|
|
39
|
-
* boot (either the existing tagged display contract's pubkey, or a
|
|
40
|
-
* freshly allocated one).
|
|
41
|
-
*/
|
|
42
|
-
export interface ReceiveRotatorBoot {
|
|
43
|
-
rotator: WalletReceiveRotator;
|
|
44
|
-
receivePubkey: Uint8Array;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Result returned by {@link WalletReceiveRotator.resolveBoot} to the
|
|
48
|
-
* wallet: the rotator plus the offchain tapscript the wallet should
|
|
49
|
-
* actually use (rebuilt to the resolved boot pubkey when it differs
|
|
50
|
-
* from the identity's static pubkey), plus the {@link DescriptorProvider}
|
|
51
|
-
* the rotator was built around. The wallet retains the provider so
|
|
52
|
-
* spending paths can route per-input signing through
|
|
53
|
-
* {@link DescriptorProvider.signWithDescriptor} instead of the
|
|
54
|
-
* identity's index-0 key.
|
|
55
|
-
*/
|
|
56
|
-
export interface ReceiveRotatorBootResult {
|
|
57
|
-
rotator: WalletReceiveRotator;
|
|
58
|
-
offchainTapscript: DefaultVtxo.Script | DelegateVtxo.Script;
|
|
59
|
-
provider: DescriptorProvider;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Opt-in extension to {@link DescriptorProvider} for providers that
|
|
63
|
-
* drive HD receive rotation. Implemented by {@link HDDescriptorProvider}
|
|
64
|
-
* out of the box; custom providers (HSMs, external signers, …) can also
|
|
65
|
-
* implement it when they want to participate.
|
|
66
|
-
*
|
|
67
|
-
* Kept out of the core `DescriptorProvider` interface so providers that
|
|
68
|
-
* only do allocation + signing don't have to know about the wallet's
|
|
69
|
-
* receive lifecycle. The wallet detects support via
|
|
70
|
-
* {@link hasReceiveRotatorFactory} (a duck-typed `instanceof`-style
|
|
71
|
-
* check) and falls back to {@link WalletReceiveRotator.defaultBoot}
|
|
72
|
-
* when the provider doesn't implement the extension.
|
|
73
|
-
*/
|
|
74
|
-
export interface ReceiveRotatorFactory {
|
|
75
|
-
createReceiveRotator(opts: ReceiveRotatorBootOpts): Promise<ReceiveRotatorBoot | undefined>;
|
|
76
|
-
}
|
|
77
|
-
/** Type guard: does this provider implement {@link ReceiveRotatorFactory}? */
|
|
78
|
-
export declare function hasReceiveRotatorFactory(provider: DescriptorProvider): provider is DescriptorProvider & ReceiveRotatorFactory;
|
|
79
|
-
/**
|
|
80
|
-
* Sentinel value stored in `contract.metadata.source` to identify the
|
|
81
|
-
* wallet's current display contract. Borrowed from btcpay-arkade's
|
|
82
|
-
* source-tagging pattern: every contract records "where and why it was
|
|
83
|
-
* generated", and the wallet only cares about the ones it generated for
|
|
84
|
-
* its own receive address.
|
|
85
|
-
*
|
|
86
|
-
* Tagging makes the boot lookup unambiguous — the rotator filters on
|
|
87
|
-
* `metadata.source === WALLET_RECEIVE_SOURCE` rather than on "any active
|
|
88
|
-
* default contract", so a contract repo that also holds default contracts
|
|
89
|
-
* created for other reasons (legacy timelock variants, external
|
|
90
|
-
* integrations) doesn't confuse the wallet's display state.
|
|
91
|
-
*/
|
|
92
|
-
export declare const WALLET_RECEIVE_SOURCE = "wallet-receive";
|
|
93
|
-
/**
|
|
94
|
-
* Thrown when a descriptor expected to be rangeable (have a wildcard
|
|
95
|
-
* leaf) cannot produce a leaf pubkey. Surfaces from the rotator's
|
|
96
|
-
* `defaultBoot` path so `resolveBoot` can distinguish a legitimate
|
|
97
|
-
* incompatibility (silent fallback under `walletMode: 'auto'`) from
|
|
98
|
-
* any other runtime failure.
|
|
99
|
-
*/
|
|
100
|
-
export declare class NonRangeableDescriptorError extends Error {
|
|
101
|
-
constructor(message: string, options?: {
|
|
102
|
-
cause?: unknown;
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* Minimal logging surface the rotator needs. `console` satisfies it
|
|
107
|
-
* out of the box; SDK consumers can pass a structured logger
|
|
108
|
-
* (winston / pino / Sentry adapter) via {@link ReceiveRotatorBootOpts}
|
|
109
|
-
* to capture rotation failures + backoff diagnostics through their
|
|
110
|
-
* own pipeline.
|
|
111
|
-
*/
|
|
112
|
-
export interface Logger {
|
|
113
|
-
error(message: string, ...args: unknown[]): void;
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Cap on the exponential backoff applied to repeated rotation
|
|
117
|
-
* failures. After this delay, every fresh `vtxo_received` event
|
|
118
|
-
* re-attempts a rotation at this rate until one succeeds (which
|
|
119
|
-
* resets the counter) or the wallet is disposed.
|
|
120
|
-
*/
|
|
121
|
-
export declare const ROTATION_MAX_BACKOFF_MS = 60000;
|
|
122
|
-
/**
|
|
123
|
-
* Narrow surface the rotator needs from the wallet at runtime: the
|
|
124
|
-
* mutable display tapscript, the display contract's script hex, the
|
|
125
|
-
* contract manager (for subscribing + registering rotated contracts),
|
|
126
|
-
* and the display address (for the contract's `address` field).
|
|
127
|
-
*
|
|
128
|
-
* Kept as an interface so the rotator module avoids a circular
|
|
129
|
-
* dependency on `wallet.ts`. `Wallet` implements this surface
|
|
130
|
-
* structurally — no `implements` clause is required.
|
|
131
|
-
*/
|
|
132
|
-
export interface RotatableWallet {
|
|
133
|
-
readonly defaultContractScript: string;
|
|
134
|
-
readonly network: {
|
|
135
|
-
hrp: string;
|
|
136
|
-
};
|
|
137
|
-
readonly arkServerPublicKey: Uint8Array;
|
|
138
|
-
readonly offchainTapscript: DefaultVtxo.Script | DelegateVtxo.Script;
|
|
139
|
-
/**
|
|
140
|
-
* @internal Sole sanctioned write path for `offchainTapscript`
|
|
141
|
-
* after construction. The rotator calls this once per rotation
|
|
142
|
-
* after persisting the new display contract.
|
|
143
|
-
*/
|
|
144
|
-
setOffchainTapscriptForRotation(tapscript: DefaultVtxo.Script | DelegateVtxo.Script): void;
|
|
145
|
-
getContractManager(): Promise<IContractManager>;
|
|
146
|
-
getAddress(): Promise<string>;
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* Owns the wallet's HD receive-rotation lifecycle.
|
|
150
|
-
*
|
|
151
|
-
* The rotator is constructed only when the wallet's `walletMode`
|
|
152
|
-
* resolves to a {@link DescriptorProvider}; static wallets and
|
|
153
|
-
* non-HD-capable wallets under `'auto'` never see one.
|
|
154
|
-
*
|
|
155
|
-
* Lifecycle:
|
|
156
|
-
* 1. `resolveBoot()` — pre-Wallet-construction. Resolves the provider
|
|
157
|
-
* from `walletMode`, then either reuses the existing display
|
|
158
|
-
* contract's pubkey (if any) or allocates the first descriptor.
|
|
159
|
-
* Returns the rotator paired with the boot pubkey.
|
|
160
|
-
* 2. `install(wallet)` — post-`getVtxoManager()`. Subscribes to
|
|
161
|
-
* `vtxo_received` on the contract manager and routes matching events
|
|
162
|
-
* through the rotation chain.
|
|
163
|
-
* 3. `dispose()` — tears down the subscription and drains any in-flight
|
|
164
|
-
* rotation so the contract manager can be disposed cleanly.
|
|
165
|
-
*
|
|
166
|
-
* This class follows the dotnet-sdk's split of responsibilities: the
|
|
167
|
-
* provider is a pure rotating allocator; "what address am I currently
|
|
168
|
-
* bound to?" is answered by querying the contract repository, not by
|
|
169
|
-
* asking the provider.
|
|
170
|
-
*/
|
|
171
|
-
export declare class WalletReceiveRotator {
|
|
172
|
-
private readonly provider;
|
|
173
|
-
private unsubscribe?;
|
|
174
|
-
private chain;
|
|
175
|
-
/**
|
|
176
|
-
* Script of the most-recent tagged display contract — populated
|
|
177
|
-
* either from the boot-time repo lookup or from the previous
|
|
178
|
-
* `rotate()` call within this session. The next `rotate()` marks
|
|
179
|
-
* this contract `inactive` once the new tagged contract is in
|
|
180
|
-
* place. `undefined` means the wallet's current display is the
|
|
181
|
-
* untagged index-0 baseline (no rotation has happened yet on this
|
|
182
|
-
* repo), and the baseline must NOT be deactivated.
|
|
183
|
-
*/
|
|
184
|
-
private currentTaggedScript;
|
|
185
|
-
/**
|
|
186
|
-
* Consecutive rotation failures since the last successful rotate.
|
|
187
|
-
* Drives an exponential backoff (capped at
|
|
188
|
-
* {@link ROTATION_MAX_BACKOFF_MS}) so a broken provider can't make
|
|
189
|
-
* the rotator hammer `getNextSigningDescriptor` + `createContract`
|
|
190
|
-
* on every inbound VTXO. Reset to zero on a successful rotate.
|
|
191
|
-
*/
|
|
192
|
-
private consecutiveFailures;
|
|
193
|
-
/**
|
|
194
|
-
* Unix-ms timestamp before which incoming `vtxo_received` events
|
|
195
|
-
* skip the rotation attempt entirely. Zero means "no backoff
|
|
196
|
-
* active" — the next event can rotate immediately.
|
|
197
|
-
*/
|
|
198
|
-
private nextRotationAllowedAt;
|
|
199
|
-
private readonly logger;
|
|
200
|
-
private constructor();
|
|
201
|
-
/**
|
|
202
|
-
* Phase 1 — pre-Wallet-construction. Resolves `walletMode` to a
|
|
203
|
-
* {@link DescriptorProvider}, then asks that provider to construct
|
|
204
|
-
* the rotator (delegated through
|
|
205
|
-
* {@link DescriptorProvider.createReceiveRotator}, which falls back
|
|
206
|
-
* to {@link defaultBoot} when the provider doesn't override it).
|
|
207
|
-
*
|
|
208
|
-
* Returns the rotator paired with the offchain tapscript the wallet
|
|
209
|
-
* should actually install (rebuilt to the resolved receive pubkey
|
|
210
|
-
* when it differs from the identity's static pubkey), or
|
|
211
|
-
* `undefined` when the wallet should stay on the static path.
|
|
212
|
-
*
|
|
213
|
-
* Errors during pubkey resolution propagate when:
|
|
214
|
-
* - `walletMode === 'hd'` (caller asked for HD; loud failure expected).
|
|
215
|
-
* - `walletMode` is a {@link DescriptorProvider} (caller supplied an
|
|
216
|
-
* explicit allocator; silently degrading would hide misconfig).
|
|
217
|
-
*
|
|
218
|
-
* Errors are silently swallowed (returning `undefined`) only under
|
|
219
|
-
* `walletMode: 'auto'` with the built-in HD provider, to preserve
|
|
220
|
-
* backwards compatibility with wallets whose identity descriptor
|
|
221
|
-
* isn't actually rangeable.
|
|
222
|
-
*/
|
|
223
|
-
static resolveBoot(config: WalletConfig, setup: ReceiveRotatorBootOpts & {
|
|
224
|
-
offchainTapscript: DefaultVtxo.Script | DelegateVtxo.Script;
|
|
225
|
-
}): Promise<ReceiveRotatorBootResult | undefined>;
|
|
226
|
-
/**
|
|
227
|
-
* Default factory-shaped boot any
|
|
228
|
-
* {@link ReceiveRotatorFactory.createReceiveRotator} implementation
|
|
229
|
-
* can delegate to. Pulls the wallet's current display contract from
|
|
230
|
-
* the contract repository (or allocates a fresh receive descriptor
|
|
231
|
-
* via the provider when no tagged display contract exists), and
|
|
232
|
-
* returns the rotator paired with the resolved receive pubkey.
|
|
233
|
-
*
|
|
234
|
-
* Used internally by `resolveBoot` when the provider doesn't
|
|
235
|
-
* implement {@link ReceiveRotatorFactory}. Exported so providers
|
|
236
|
-
* that *do* override can still invoke the default work for the
|
|
237
|
-
* parts of the boot path they don't want to customise. Tapscript
|
|
238
|
-
* construction is intentionally NOT in here — that's the
|
|
239
|
-
* orchestrator's job.
|
|
240
|
-
*/
|
|
241
|
-
static defaultBoot(provider: DescriptorProvider, opts: ReceiveRotatorBootOpts): Promise<ReceiveRotatorBoot>;
|
|
242
|
-
/**
|
|
243
|
-
* Phase 2 — post-`getVtxoManager()`. Subscribe to `vtxo_received`
|
|
244
|
-
* and trigger a rotation whenever the currently-active display
|
|
245
|
-
* contract receives funds. Old display contracts remain `active`
|
|
246
|
-
* in the repo so earlier shared addresses keep crediting this
|
|
247
|
-
* wallet.
|
|
248
|
-
*/
|
|
249
|
-
install(wallet: RotatableWallet): Promise<void>;
|
|
250
|
-
/**
|
|
251
|
-
* Run a single rotation attempt, applying exponential backoff on
|
|
252
|
-
* failure. Public-shaped behavior:
|
|
253
|
-
* - During a backoff window: log + skip (no `rotate()` call).
|
|
254
|
-
* - On success: reset failure count and backoff.
|
|
255
|
-
* - On failure: increment counter, schedule next attempt at
|
|
256
|
-
* `min(2^consecutiveFailures * 1s, ROTATION_MAX_BACKOFF_MS)`.
|
|
257
|
-
*
|
|
258
|
-
* Errors are deliberately swallowed (logged, not rethrown) so the
|
|
259
|
-
* surrounding `chain` Promise never settles to rejected — the next
|
|
260
|
-
* `vtxo_received` event must still get a chance to run.
|
|
261
|
-
*/
|
|
262
|
-
private runRotateWithBackoff;
|
|
263
|
-
/**
|
|
264
|
-
* Wait for any in-flight rotation to complete. Useful in tests
|
|
265
|
-
* that need to observe the post-rotation state after dispatching
|
|
266
|
-
* a `vtxo_received` event synchronously; production code rarely
|
|
267
|
-
* needs to call this directly.
|
|
268
|
-
*/
|
|
269
|
-
drain(): Promise<void>;
|
|
270
|
-
/**
|
|
271
|
-
* Tear down the subscription first so no late `vtxo_received` event
|
|
272
|
-
* can queue work on a disposing wallet, then drain any in-flight
|
|
273
|
-
* rotation so its `createContract` finishes before the contract
|
|
274
|
-
* manager itself disposes.
|
|
275
|
-
*/
|
|
276
|
-
dispose(): Promise<void>;
|
|
277
|
-
/**
|
|
278
|
-
* Allocate the next descriptor, swap it into the wallet's active
|
|
279
|
-
* offchain tapscript, register the new tagged contract, and retire
|
|
280
|
-
* the previous tagged contract (if any) by setting its state to
|
|
281
|
-
* `inactive`. The contract watcher keeps watching inactive
|
|
282
|
-
* contracts until their VTXOs are spent, so funds in flight at the
|
|
283
|
-
* old display address are not lost — only the address stops being
|
|
284
|
-
* advertised.
|
|
285
|
-
*
|
|
286
|
-
* Contract type matches the wallet's tapscript shape: a default
|
|
287
|
-
* wallet rotates to a new `default` contract, a delegate wallet to
|
|
288
|
-
* a new `delegate` contract.
|
|
289
|
-
*
|
|
290
|
-
* The first rotation on a fresh wallet does NOT deactivate
|
|
291
|
-
* anything: `currentTaggedScript` is `undefined` because the wallet
|
|
292
|
-
* was displaying the untagged index-0 baseline, which must stay
|
|
293
|
-
* active forever.
|
|
294
|
-
*/
|
|
295
|
-
private rotate;
|
|
296
|
-
}
|
|
297
|
-
/**
|
|
298
|
-
* Rebuild the given offchain tapscript with a different owner pubkey,
|
|
299
|
-
* preserving its {@link DelegateVtxo.Script} vs {@link DefaultVtxo.Script}
|
|
300
|
-
* shape and all other options.
|
|
301
|
-
*
|
|
302
|
-
* Exported because the wallet's boot path also needs to rebuild the
|
|
303
|
-
* initial tapscript when the resolved boot pubkey differs from the
|
|
304
|
-
* identity's default pubkey.
|
|
305
|
-
*/
|
|
306
|
-
export declare function rebuildTapscript(current: DefaultVtxo.Script | DelegateVtxo.Script, pubKey: Uint8Array): DefaultVtxo.Script | DelegateVtxo.Script;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
type SetupServiceWorkerOptions = {
|
|
2
|
-
path: string;
|
|
3
|
-
updateViaCache?: ServiceWorkerUpdateViaCache;
|
|
4
|
-
autoReload?: boolean;
|
|
5
|
-
onNeedRefresh?: () => void;
|
|
6
|
-
onUpdated?: () => void;
|
|
7
|
-
debug?: boolean;
|
|
8
|
-
activationTimeoutMs?: number;
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* Registers a service worker for the given path only once, attaches an
|
|
12
|
-
* update/activation handshake (SKIP_WAITING + controllerchange reload), and
|
|
13
|
-
* caches the registration promise for subsequent calls.
|
|
14
|
-
*
|
|
15
|
-
* @param pathOrOptions - Service worker script path or a configuration object.
|
|
16
|
-
* @throws if service workers are not supported or registration fails.
|
|
17
|
-
*/
|
|
18
|
-
export declare function setupServiceWorkerOnce(pathOrOptions: string | SetupServiceWorkerOptions): Promise<ServiceWorkerRegistration>;
|
|
19
|
-
/**
|
|
20
|
-
* Returns an active service worker instance, optionally ensuring a specific
|
|
21
|
-
* script path is registered before resolving.
|
|
22
|
-
*
|
|
23
|
-
* @param path - Optional service worker script path to register and prefer.
|
|
24
|
-
* @throws if service workers are not supported or no active worker is available.
|
|
25
|
-
*/
|
|
26
|
-
export declare function getActiveServiceWorker(path?: string): Promise<ServiceWorker>;
|
|
27
|
-
/**
|
|
28
|
-
* Clears the cached registration promises.
|
|
29
|
-
* Intended for tests to reset state between runs.
|
|
30
|
-
*/
|
|
31
|
-
export declare const __resetServiceWorkerManager: () => void;
|
|
32
|
-
export {};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export declare const DEFAULT_DB_NAME = "arkade-service-worker";
|
|
2
|
-
export declare const DEFAULT_SERVICE_WORKER_ACTIVATION_TIMEOUT_MS = 10000;
|
|
3
|
-
type SetupServiceWorkerOptions = {
|
|
4
|
-
path: string;
|
|
5
|
-
activationTimeoutMs?: number;
|
|
6
|
-
};
|
|
7
|
-
/**
|
|
8
|
-
* setupServiceWorker sets up the service worker.
|
|
9
|
-
* @param pathOrOptions - the path to the service worker script or setup options
|
|
10
|
-
* @throws if service workers are not supported or activation fails
|
|
11
|
-
* @example
|
|
12
|
-
* ```typescript
|
|
13
|
-
* const worker = await setupServiceWorker("/service-worker.js");
|
|
14
|
-
* ```
|
|
15
|
-
*/
|
|
16
|
-
export declare function setupServiceWorker(pathOrOptions: string | SetupServiceWorkerOptions): Promise<ServiceWorker>;
|
|
17
|
-
export {};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export declare const MESSAGE_BUS_NOT_INITIALIZED = "MessageBus not initialized";
|
|
2
|
-
export declare class MessageBusNotInitializedError extends Error {
|
|
3
|
-
constructor();
|
|
4
|
-
}
|
|
5
|
-
export declare class ServiceWorkerTimeoutError extends Error {
|
|
6
|
-
constructor(detail: string);
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export type { TaskItem, TaskResult, TaskQueue } from "./taskQueue.js";
|
|
2
|
-
export { InMemoryTaskQueue } from "./taskQueue.js";
|
|
3
|
-
export type { AsyncStorageLike } from "./asyncStorageTaskQueue.js";
|
|
4
|
-
export { AsyncStorageTaskQueue } from "./asyncStorageTaskQueue.js";
|
|
5
|
-
export type { TaskProcessor, TaskDependencies, CreateTaskDependenciesOptions, } from "./taskRunner.js";
|
|
6
|
-
export { runTasks, createTaskDependencies } from "./taskRunner.js";
|
|
7
|
-
export { contractPollProcessor, CONTRACT_POLL_TASK_TYPE } from "./processors/index.js";
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { TaskProcessor } from "../taskRunner.js";
|
|
2
|
-
export declare const CONTRACT_POLL_TASK_TYPE = "contract-poll";
|
|
3
|
-
/**
|
|
4
|
-
* Polls the indexer for the latest VTXO state of every contract and
|
|
5
|
-
* persists the results to the wallet repository.
|
|
6
|
-
*
|
|
7
|
-
* Replicates the polling subset of @see ContractManager.initialize:
|
|
8
|
-
* 1. Load all contracts from the contract repository.
|
|
9
|
-
* 2. Paginated fetch of every VTXO (including spent) from the indexer.
|
|
10
|
-
* 3. Extend each VTXO with tapscript data.
|
|
11
|
-
* 4. Save to the wallet repository.
|
|
12
|
-
*
|
|
13
|
-
* NOTE: the indexer query deliberately omits `spendableOnly`. Every
|
|
14
|
-
* repository implements `saveVtxos` as an upsert with no batch delete,
|
|
15
|
-
* so filtering to spendable-only would leave VTXOs that became spent
|
|
16
|
-
* between polls marked as spendable forever. Fetching the full set lets
|
|
17
|
-
* the upsert overwrite stale records with their latest state.
|
|
18
|
-
*/
|
|
19
|
-
export declare const contractPollProcessor: TaskProcessor;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { contractPollProcessor, CONTRACT_POLL_TASK_TYPE, } from "./contractPollProcessor.js";
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A task item represents a unit of work in the inbox.
|
|
3
|
-
*/
|
|
4
|
-
export interface TaskItem {
|
|
5
|
-
id: string;
|
|
6
|
-
type: string;
|
|
7
|
-
data: Record<string, unknown>;
|
|
8
|
-
createdAt: number;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* A task result represents the outcome of processing a task item.
|
|
12
|
-
*/
|
|
13
|
-
export interface TaskResult {
|
|
14
|
-
id: string;
|
|
15
|
-
taskItemId: string;
|
|
16
|
-
type: string;
|
|
17
|
-
status: "success" | "failed" | "noop";
|
|
18
|
-
data?: Record<string, unknown>;
|
|
19
|
-
executedAt: number;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Persistence layer for handing off work between foreground and background.
|
|
23
|
-
*
|
|
24
|
-
* - **Inbox**: tasks waiting to be processed.
|
|
25
|
-
* - **Outbox**: results produced by processors, waiting to be consumed.
|
|
26
|
-
*/
|
|
27
|
-
export interface TaskQueue {
|
|
28
|
-
addTask(task: TaskItem): Promise<void>;
|
|
29
|
-
removeTask(id: string): Promise<void>;
|
|
30
|
-
getTasks(type?: string): Promise<TaskItem[]>;
|
|
31
|
-
clearTasks(): Promise<void>;
|
|
32
|
-
pushResult(result: TaskResult): Promise<void>;
|
|
33
|
-
getResults(): Promise<TaskResult[]>;
|
|
34
|
-
acknowledgeResults(ids: string[]): Promise<void>;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* In-memory TaskQueue for testing and lightweight use.
|
|
38
|
-
* State is lost when the process exits.
|
|
39
|
-
*/
|
|
40
|
-
export declare class InMemoryTaskQueue implements TaskQueue {
|
|
41
|
-
private inbox;
|
|
42
|
-
private outbox;
|
|
43
|
-
addTask(task: TaskItem): Promise<void>;
|
|
44
|
-
removeTask(id: string): Promise<void>;
|
|
45
|
-
getTasks(type?: string): Promise<TaskItem[]>;
|
|
46
|
-
clearTasks(): Promise<void>;
|
|
47
|
-
pushResult(result: TaskResult): Promise<void>;
|
|
48
|
-
getResults(): Promise<TaskResult[]>;
|
|
49
|
-
acknowledgeResults(ids: string[]): Promise<void>;
|
|
50
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import type { TaskItem, TaskResult, TaskQueue } from "./taskQueue.js";
|
|
2
|
-
import type { WalletRepository } from "../../repositories/walletRepository.js";
|
|
3
|
-
import type { ContractRepository } from "../../repositories/contractRepository.js";
|
|
4
|
-
import type { IndexerProvider } from "../../providers/indexer.js";
|
|
5
|
-
import type { ArkProvider } from "../../providers/ark.js";
|
|
6
|
-
import type { ExtendedVirtualCoin, VirtualCoin } from "../../wallet/index.js";
|
|
7
|
-
import type { Contract } from "../../contracts/types.js";
|
|
8
|
-
/**
|
|
9
|
-
* Shared dependencies injected into every processor at runtime.
|
|
10
|
-
*
|
|
11
|
-
* `extendVtxo` requires the owning contract — processors must resolve each
|
|
12
|
-
* vtxo's `script` to a known contract (via the contract repository) before
|
|
13
|
-
* calling this. The strict signature prevents the footgun where a missing
|
|
14
|
-
* contract silently falls back to the wallet's default tapscript.
|
|
15
|
-
*/
|
|
16
|
-
export interface TaskDependencies {
|
|
17
|
-
walletRepository: WalletRepository;
|
|
18
|
-
contractRepository: ContractRepository;
|
|
19
|
-
indexerProvider: IndexerProvider;
|
|
20
|
-
arkProvider: ArkProvider;
|
|
21
|
-
extendVtxo: (vtxo: VirtualCoin, contract: Contract) => ExtendedVirtualCoin;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* A stateless unit that handles one type of task item.
|
|
25
|
-
*
|
|
26
|
-
* Processors must not keep in-memory state across invocations —
|
|
27
|
-
* all coordination lives in the @see TaskQueue and repositories.
|
|
28
|
-
*
|
|
29
|
-
* The `TDeps` parameter defaults to @see TaskDependencies but
|
|
30
|
-
* can be overridden for domain-specific processors (e.g. swap processing).
|
|
31
|
-
*/
|
|
32
|
-
export interface TaskProcessor<TDeps = TaskDependencies> {
|
|
33
|
-
readonly taskType: string;
|
|
34
|
-
execute(item: TaskItem, deps: TDeps): Promise<Omit<TaskResult, "id" | "executedAt">>;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Run all pending tasks from the queue through matching processors.
|
|
38
|
-
*
|
|
39
|
-
* For each task in the inbox:
|
|
40
|
-
* 1. Find the processor whose `taskType` matches `task.type`.
|
|
41
|
-
* 2. Execute it, producing a @see TaskResult.
|
|
42
|
-
* 3. Push the result to the outbox and remove the task from the inbox.
|
|
43
|
-
*
|
|
44
|
-
* Tasks with no matching processor produce a `"noop"` result.
|
|
45
|
-
* Processor errors produce a `"failed"` result with the error message.
|
|
46
|
-
*/
|
|
47
|
-
export declare function runTasks<TDeps = TaskDependencies>(queue: TaskQueue, processors: TaskProcessor<TDeps>[], deps: TDeps): Promise<TaskResult[]>;
|
|
48
|
-
/**
|
|
49
|
-
* Options for @see createTaskDependencies.
|
|
50
|
-
*/
|
|
51
|
-
export interface CreateTaskDependenciesOptions {
|
|
52
|
-
walletRepository: WalletRepository;
|
|
53
|
-
contractRepository: ContractRepository;
|
|
54
|
-
indexerProvider: IndexerProvider;
|
|
55
|
-
arkProvider: ArkProvider;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Build the @see TaskDependencies needed by task processors
|
|
59
|
-
* (e.g. `src/worker/expo/processors/contractPollProcessor.ts`)
|
|
60
|
-
*
|
|
61
|
-
* This is the same construction that `defineExpoBackgroundTask` does
|
|
62
|
-
* internally, extracted so that consumers with custom schedulers
|
|
63
|
-
* (e.g. bare React Native with `react-native-background-fetch`)
|
|
64
|
-
* can build deps without depending on Expo.
|
|
65
|
-
*/
|
|
66
|
-
export declare function createTaskDependencies(options: CreateTaskDependenciesOptions): TaskDependencies;
|