@arkade-os/sdk 0.4.26 → 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 +36 -125
- 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 -629
- 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 -2
- package/dist/cjs/identity/index.js +0 -38
- package/dist/cjs/identity/seedIdentity.js +0 -461
- 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 -200
- 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 -302
- 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 -159
- package/dist/cjs/wallet/index.js +0 -82
- 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 -1173
- package/dist/cjs/wallet/unroll.js +0 -289
- 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 -2049
- 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 -473
- 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 -625
- 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 -1
- package/dist/esm/identity/index.js +0 -12
- package/dist/esm/identity/seedIdentity.js +0 -453
- 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 -297
- 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 -155
- package/dist/esm/wallet/index.js +0 -75
- 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 -1168
- package/dist/esm/wallet/unroll.js +0 -285
- 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 -2041
- 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 -469
- 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 -381
- 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 -233
- 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 -35
- package/dist/types/identity/hdCapableIdentity.d.ts +0 -44
- package/dist/types/identity/index.d.ts +0 -56
- package/dist/types/identity/seedIdentity.d.ts +0 -254
- 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 -93
- package/dist/types/wallet/index.d.ts +0 -755
- 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 -238
- 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 -360
- 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 -188
package/dist/cjs/script/vhtlc.js
DELETED
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.VHTLC = void 0;
|
|
4
|
-
const btc_signer_1 = require("@scure/btc-signer");
|
|
5
|
-
const tapscript_1 = require("./tapscript");
|
|
6
|
-
const base_1 = require("@scure/base");
|
|
7
|
-
const base_2 = require("./base");
|
|
8
|
-
/** Virtual Hash Time Lock Contract (VHTLC) namespace. */
|
|
9
|
-
var VHTLC;
|
|
10
|
-
(function (VHTLC) {
|
|
11
|
-
/**
|
|
12
|
-
* Virtual Hash Time Lock Contract (VHTLC) script implementation.
|
|
13
|
-
*
|
|
14
|
-
* VHTLC enables atomic swaps and conditional payments in the Arkade protocol.
|
|
15
|
-
* It provides multiple spending paths:
|
|
16
|
-
*
|
|
17
|
-
* - **claim**: Receiver can claim funds by revealing the preimage
|
|
18
|
-
* - **refund**: Sender and receiver can collaboratively refund
|
|
19
|
-
* - **refundWithoutReceiver**: Sender can refund after locktime expires
|
|
20
|
-
* - **unilateralClaim**: Receiver can claim unilaterally after delay
|
|
21
|
-
* - **unilateralRefund**: Sender and receiver can refund unilaterally after delay
|
|
22
|
-
* - **unilateralRefundWithoutReceiver**: Sender can refund unilaterally after delay
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* ```typescript
|
|
26
|
-
* const vhtlc = new VHTLC.Script({
|
|
27
|
-
* sender: alicePubKey,
|
|
28
|
-
* receiver: bobPubKey,
|
|
29
|
-
* server: serverPubKey,
|
|
30
|
-
* preimageHash: hash160(secret),
|
|
31
|
-
* refundLocktime: BigInt(chainTip + 10),
|
|
32
|
-
* unilateralClaimDelay: { type: 'blocks', value: 100n },
|
|
33
|
-
* unilateralRefundDelay: { type: 'blocks', value: 102n },
|
|
34
|
-
* unilateralRefundWithoutReceiverDelay: { type: 'blocks', value: 103n }
|
|
35
|
-
* });
|
|
36
|
-
* ```
|
|
37
|
-
*/
|
|
38
|
-
class Script extends base_2.VtxoScript {
|
|
39
|
-
/** Create a VHTLC script from the supplied participant keys, hash, and timelocks. */
|
|
40
|
-
constructor(options) {
|
|
41
|
-
validateOptions(options);
|
|
42
|
-
const { sender, receiver, server, preimageHash, refundLocktime, unilateralClaimDelay, unilateralRefundDelay, unilateralRefundWithoutReceiverDelay, } = options;
|
|
43
|
-
const conditionScript = preimageConditionScript(preimageHash);
|
|
44
|
-
const claimScript = tapscript_1.ConditionMultisigTapscript.encode({
|
|
45
|
-
conditionScript,
|
|
46
|
-
pubkeys: [receiver, server],
|
|
47
|
-
}).script;
|
|
48
|
-
const refundScript = tapscript_1.MultisigTapscript.encode({
|
|
49
|
-
pubkeys: [sender, receiver, server],
|
|
50
|
-
}).script;
|
|
51
|
-
const refundWithoutReceiverScript = tapscript_1.CLTVMultisigTapscript.encode({
|
|
52
|
-
absoluteTimelock: refundLocktime,
|
|
53
|
-
pubkeys: [sender, server],
|
|
54
|
-
}).script;
|
|
55
|
-
const unilateralClaimScript = tapscript_1.ConditionCSVMultisigTapscript.encode({
|
|
56
|
-
conditionScript,
|
|
57
|
-
timelock: unilateralClaimDelay,
|
|
58
|
-
pubkeys: [receiver],
|
|
59
|
-
}).script;
|
|
60
|
-
const unilateralRefundScript = tapscript_1.CSVMultisigTapscript.encode({
|
|
61
|
-
timelock: unilateralRefundDelay,
|
|
62
|
-
pubkeys: [sender, receiver],
|
|
63
|
-
}).script;
|
|
64
|
-
const unilateralRefundWithoutReceiverScript = tapscript_1.CSVMultisigTapscript.encode({
|
|
65
|
-
timelock: unilateralRefundWithoutReceiverDelay,
|
|
66
|
-
pubkeys: [sender],
|
|
67
|
-
}).script;
|
|
68
|
-
super([
|
|
69
|
-
claimScript,
|
|
70
|
-
refundScript,
|
|
71
|
-
refundWithoutReceiverScript,
|
|
72
|
-
unilateralClaimScript,
|
|
73
|
-
unilateralRefundScript,
|
|
74
|
-
unilateralRefundWithoutReceiverScript,
|
|
75
|
-
]);
|
|
76
|
-
this.options = options;
|
|
77
|
-
this.claimScript = base_1.hex.encode(claimScript);
|
|
78
|
-
this.refundScript = base_1.hex.encode(refundScript);
|
|
79
|
-
this.refundWithoutReceiverScript = base_1.hex.encode(refundWithoutReceiverScript);
|
|
80
|
-
this.unilateralClaimScript = base_1.hex.encode(unilateralClaimScript);
|
|
81
|
-
this.unilateralRefundScript = base_1.hex.encode(unilateralRefundScript);
|
|
82
|
-
this.unilateralRefundWithoutReceiverScript = base_1.hex.encode(unilateralRefundWithoutReceiverScript);
|
|
83
|
-
}
|
|
84
|
-
/** Return the collaborative claim tapleaf script. */
|
|
85
|
-
claim() {
|
|
86
|
-
return this.findLeaf(this.claimScript);
|
|
87
|
-
}
|
|
88
|
-
/** Return the collaborative refund tapleaf script. */
|
|
89
|
-
refund() {
|
|
90
|
-
return this.findLeaf(this.refundScript);
|
|
91
|
-
}
|
|
92
|
-
/** Return the refund-without-receiver tapleaf script. */
|
|
93
|
-
refundWithoutReceiver() {
|
|
94
|
-
return this.findLeaf(this.refundWithoutReceiverScript);
|
|
95
|
-
}
|
|
96
|
-
/** Return the unilateral claim tapleaf script. */
|
|
97
|
-
unilateralClaim() {
|
|
98
|
-
return this.findLeaf(this.unilateralClaimScript);
|
|
99
|
-
}
|
|
100
|
-
/** Return the unilateral refund tapleaf script. */
|
|
101
|
-
unilateralRefund() {
|
|
102
|
-
return this.findLeaf(this.unilateralRefundScript);
|
|
103
|
-
}
|
|
104
|
-
/** Return the unilateral refund-without-receiver tapleaf script. */
|
|
105
|
-
unilateralRefundWithoutReceiver() {
|
|
106
|
-
return this.findLeaf(this.unilateralRefundWithoutReceiverScript);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
VHTLC.Script = Script;
|
|
110
|
-
function validateOptions(options) {
|
|
111
|
-
const { sender, receiver, server, preimageHash, refundLocktime, unilateralClaimDelay, unilateralRefundDelay, unilateralRefundWithoutReceiverDelay, } = options;
|
|
112
|
-
if (!preimageHash || preimageHash.length !== 20) {
|
|
113
|
-
throw new Error("preimage hash must be 20 bytes");
|
|
114
|
-
}
|
|
115
|
-
if (!receiver || receiver.length !== 32) {
|
|
116
|
-
throw new Error("Invalid public key length (receiver)");
|
|
117
|
-
}
|
|
118
|
-
if (!sender || sender.length !== 32) {
|
|
119
|
-
throw new Error("Invalid public key length (sender)");
|
|
120
|
-
}
|
|
121
|
-
if (!server || server.length !== 32) {
|
|
122
|
-
throw new Error("Invalid public key length (server)");
|
|
123
|
-
}
|
|
124
|
-
if (typeof refundLocktime !== "bigint" || refundLocktime <= 0n) {
|
|
125
|
-
throw new Error("refund locktime must be greater than 0");
|
|
126
|
-
}
|
|
127
|
-
if (!unilateralClaimDelay ||
|
|
128
|
-
typeof unilateralClaimDelay.value !== "bigint" ||
|
|
129
|
-
unilateralClaimDelay.value <= 0n) {
|
|
130
|
-
throw new Error("unilateral claim delay must greater than 0");
|
|
131
|
-
}
|
|
132
|
-
if (unilateralClaimDelay.type === "seconds" &&
|
|
133
|
-
unilateralClaimDelay.value % 512n !== 0n) {
|
|
134
|
-
throw new Error("seconds timelock must be multiple of 512");
|
|
135
|
-
}
|
|
136
|
-
if (unilateralClaimDelay.type === "seconds" &&
|
|
137
|
-
unilateralClaimDelay.value < 512n) {
|
|
138
|
-
throw new Error("seconds timelock must be greater or equal to 512");
|
|
139
|
-
}
|
|
140
|
-
if (!unilateralRefundDelay ||
|
|
141
|
-
typeof unilateralRefundDelay.value !== "bigint" ||
|
|
142
|
-
unilateralRefundDelay.value <= 0n) {
|
|
143
|
-
throw new Error("unilateral refund delay must greater than 0");
|
|
144
|
-
}
|
|
145
|
-
if (unilateralRefundDelay.type === "seconds" &&
|
|
146
|
-
unilateralRefundDelay.value % 512n !== 0n) {
|
|
147
|
-
throw new Error("seconds timelock must be multiple of 512");
|
|
148
|
-
}
|
|
149
|
-
if (unilateralRefundDelay.type === "seconds" &&
|
|
150
|
-
unilateralRefundDelay.value < 512n) {
|
|
151
|
-
throw new Error("seconds timelock must be greater or equal to 512");
|
|
152
|
-
}
|
|
153
|
-
if (!unilateralRefundWithoutReceiverDelay ||
|
|
154
|
-
typeof unilateralRefundWithoutReceiverDelay.value !== "bigint" ||
|
|
155
|
-
unilateralRefundWithoutReceiverDelay.value <= 0n) {
|
|
156
|
-
throw new Error("unilateral refund without receiver delay must greater than 0");
|
|
157
|
-
}
|
|
158
|
-
if (unilateralRefundWithoutReceiverDelay.type === "seconds" &&
|
|
159
|
-
unilateralRefundWithoutReceiverDelay.value % 512n !== 0n) {
|
|
160
|
-
throw new Error("seconds timelock must be multiple of 512");
|
|
161
|
-
}
|
|
162
|
-
if (unilateralRefundWithoutReceiverDelay.type === "seconds" &&
|
|
163
|
-
unilateralRefundWithoutReceiverDelay.value < 512n) {
|
|
164
|
-
throw new Error("seconds timelock must be greater or equal to 512");
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
})(VHTLC || (exports.VHTLC = VHTLC = {}));
|
|
168
|
-
function preimageConditionScript(preimageHash) {
|
|
169
|
-
return btc_signer_1.Script.encode(["HASH160", preimageHash, "EQUAL"]);
|
|
170
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AsyncStorageAdapter = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* @deprecated Use repositories instead
|
|
6
|
-
* Note: This requires @react-native-async-storage/async-storage to be installed
|
|
7
|
-
*/
|
|
8
|
-
class AsyncStorageAdapter {
|
|
9
|
-
constructor() {
|
|
10
|
-
try {
|
|
11
|
-
// Dynamic import to avoid errors in non-React Native environments
|
|
12
|
-
this.AsyncStorage =
|
|
13
|
-
require("@react-native-async-storage/async-storage").default;
|
|
14
|
-
}
|
|
15
|
-
catch (error) {
|
|
16
|
-
throw new Error("AsyncStorage is not available. Make sure @react-native-async-storage/async-storage is installed in React Native environment.");
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
async getItem(key) {
|
|
20
|
-
return await this.AsyncStorage.getItem(key);
|
|
21
|
-
}
|
|
22
|
-
async setItem(key, value) {
|
|
23
|
-
try {
|
|
24
|
-
await this.AsyncStorage.setItem(key, value);
|
|
25
|
-
}
|
|
26
|
-
catch (error) {
|
|
27
|
-
console.error(`Failed to set item for key ${key}:`, error);
|
|
28
|
-
throw error;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
async removeItem(key) {
|
|
32
|
-
try {
|
|
33
|
-
await this.AsyncStorage.removeItem(key);
|
|
34
|
-
}
|
|
35
|
-
catch (error) {
|
|
36
|
-
console.error(`Failed to remove item for key ${key}:`, error);
|
|
37
|
-
throw error;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
async clear() {
|
|
41
|
-
try {
|
|
42
|
-
await this.AsyncStorage.clear();
|
|
43
|
-
}
|
|
44
|
-
catch (error) {
|
|
45
|
-
console.error("Failed to clear AsyncStorage:", error);
|
|
46
|
-
throw error;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
exports.AsyncStorageAdapter = AsyncStorageAdapter;
|
|
@@ -1,141 +0,0 @@
|
|
|
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.FileSystemStorageAdapter = void 0;
|
|
37
|
-
const fs = __importStar(require("fs/promises"));
|
|
38
|
-
const path = __importStar(require("path"));
|
|
39
|
-
/**
|
|
40
|
-
* @deprecated Use repository implementations via `StorageConfig` instead.
|
|
41
|
-
*/
|
|
42
|
-
class FileSystemStorageAdapter {
|
|
43
|
-
constructor(dirPath) {
|
|
44
|
-
// Normalize and resolve the storage base path once
|
|
45
|
-
this.basePath = path.resolve(dirPath).replace(/[/\\]+$/, "");
|
|
46
|
-
}
|
|
47
|
-
validateAndGetFilePath(key) {
|
|
48
|
-
// Reject dangerous keys
|
|
49
|
-
if (key === "." || key === "..") {
|
|
50
|
-
throw new Error("Invalid key: '.' and '..' are not allowed");
|
|
51
|
-
}
|
|
52
|
-
// Check for null bytes
|
|
53
|
-
if (key.includes("\0")) {
|
|
54
|
-
throw new Error("Invalid key: null bytes are not allowed");
|
|
55
|
-
}
|
|
56
|
-
// Check for path traversal attempts before normalization
|
|
57
|
-
if (key.includes("..")) {
|
|
58
|
-
throw new Error("Invalid key: directory traversal is not allowed");
|
|
59
|
-
}
|
|
60
|
-
// Check for reserved Windows names (case-insensitive)
|
|
61
|
-
const reservedNames = /^(CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])$/i;
|
|
62
|
-
const keyWithoutExt = key.split(".")[0];
|
|
63
|
-
if (reservedNames.test(keyWithoutExt)) {
|
|
64
|
-
throw new Error(`Invalid key: '${key}' uses a reserved Windows name`);
|
|
65
|
-
}
|
|
66
|
-
// Check for trailing spaces or dots
|
|
67
|
-
if (key.endsWith(" ") || key.endsWith(".")) {
|
|
68
|
-
throw new Error("Invalid key: trailing spaces or dots are not allowed");
|
|
69
|
-
}
|
|
70
|
-
// Normalize path separators and sanitize key
|
|
71
|
-
const normalizedKey = key
|
|
72
|
-
.replace(/[/\\]/g, "_")
|
|
73
|
-
.replace(/[^a-zA-Z0-9._-]/g, "_");
|
|
74
|
-
// Resolve the full path and check for directory traversal
|
|
75
|
-
const resolved = path.resolve(this.basePath, normalizedKey);
|
|
76
|
-
const relative = path.relative(this.basePath, resolved);
|
|
77
|
-
// Reject if trying to escape the base directory
|
|
78
|
-
if (relative.startsWith("..") || relative.includes(path.sep + "..")) {
|
|
79
|
-
throw new Error("Invalid key: directory traversal is not allowed");
|
|
80
|
-
}
|
|
81
|
-
return resolved;
|
|
82
|
-
}
|
|
83
|
-
async ensureDirectory() {
|
|
84
|
-
try {
|
|
85
|
-
await fs.access(this.basePath);
|
|
86
|
-
}
|
|
87
|
-
catch {
|
|
88
|
-
await fs.mkdir(this.basePath, { recursive: true });
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
async getItem(key) {
|
|
92
|
-
try {
|
|
93
|
-
const filePath = this.validateAndGetFilePath(key);
|
|
94
|
-
const data = await fs.readFile(filePath, "utf-8");
|
|
95
|
-
return data;
|
|
96
|
-
}
|
|
97
|
-
catch (error) {
|
|
98
|
-
if (error.code === "ENOENT") {
|
|
99
|
-
return null;
|
|
100
|
-
}
|
|
101
|
-
console.error(`Failed to read file for key ${key}:`, error);
|
|
102
|
-
return null;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
async setItem(key, value) {
|
|
106
|
-
try {
|
|
107
|
-
await this.ensureDirectory();
|
|
108
|
-
const filePath = this.validateAndGetFilePath(key);
|
|
109
|
-
await fs.writeFile(filePath, value, "utf-8");
|
|
110
|
-
}
|
|
111
|
-
catch (error) {
|
|
112
|
-
console.error(`Failed to write file for key ${key}:`, error);
|
|
113
|
-
throw error;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
async removeItem(key) {
|
|
117
|
-
try {
|
|
118
|
-
const filePath = this.validateAndGetFilePath(key);
|
|
119
|
-
await fs.unlink(filePath);
|
|
120
|
-
}
|
|
121
|
-
catch (error) {
|
|
122
|
-
if (error.code !== "ENOENT") {
|
|
123
|
-
console.error(`Failed to remove file for key ${key}:`, error);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
async clear() {
|
|
128
|
-
try {
|
|
129
|
-
const entries = await fs.readdir(this.basePath);
|
|
130
|
-
await Promise.all(entries.map(async (entry) => {
|
|
131
|
-
const entryPath = path.join(this.basePath, entry);
|
|
132
|
-
// Use fs.rm with recursive option to handle both files and directories
|
|
133
|
-
await fs.rm(entryPath, { recursive: true, force: true });
|
|
134
|
-
}));
|
|
135
|
-
}
|
|
136
|
-
catch (error) {
|
|
137
|
-
console.error("Failed to clear storage directory:", error);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
exports.FileSystemStorageAdapter = FileSystemStorageAdapter;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InMemoryStorageAdapter = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* @deprecated Use repository implementations via `StorageConfig` instead.
|
|
6
|
-
*/
|
|
7
|
-
class InMemoryStorageAdapter {
|
|
8
|
-
constructor() {
|
|
9
|
-
this.store = new Map();
|
|
10
|
-
}
|
|
11
|
-
async getItem(key) {
|
|
12
|
-
return this.store.get(key) ?? null;
|
|
13
|
-
}
|
|
14
|
-
async setItem(key, value) {
|
|
15
|
-
this.store.set(key, value);
|
|
16
|
-
}
|
|
17
|
-
async removeItem(key) {
|
|
18
|
-
this.store.delete(key);
|
|
19
|
-
}
|
|
20
|
-
async clear() {
|
|
21
|
-
this.store.clear();
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
exports.InMemoryStorageAdapter = InMemoryStorageAdapter;
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.IndexedDBStorageAdapter = void 0;
|
|
4
|
-
const db_1 = require("../repositories/indexedDB/db");
|
|
5
|
-
/**
|
|
6
|
-
* @deprecated Use repository implementations via `StorageConfig` instead.
|
|
7
|
-
*/
|
|
8
|
-
class IndexedDBStorageAdapter {
|
|
9
|
-
constructor(dbName, version = db_1.DB_VERSION) {
|
|
10
|
-
this.db = null;
|
|
11
|
-
this.dbName = dbName;
|
|
12
|
-
this.version = version;
|
|
13
|
-
}
|
|
14
|
-
async getDB() {
|
|
15
|
-
if (this.db)
|
|
16
|
-
return this.db;
|
|
17
|
-
const globalObject = typeof window === "undefined" ? self : window;
|
|
18
|
-
if (!(globalObject && "indexedDB" in globalObject)) {
|
|
19
|
-
throw new Error("IndexedDB is not available in this environment");
|
|
20
|
-
}
|
|
21
|
-
return new Promise((resolve, reject) => {
|
|
22
|
-
const request = globalObject.indexedDB.open(this.dbName, this.version);
|
|
23
|
-
request.onerror = () => reject(request.error);
|
|
24
|
-
request.onsuccess = () => {
|
|
25
|
-
this.db = request.result;
|
|
26
|
-
resolve(this.db);
|
|
27
|
-
};
|
|
28
|
-
request.onupgradeneeded = () => {
|
|
29
|
-
const db = request.result;
|
|
30
|
-
if (!db.objectStoreNames.contains("storage")) {
|
|
31
|
-
db.createObjectStore("storage");
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
async getItem(key) {
|
|
37
|
-
try {
|
|
38
|
-
const db = await this.getDB();
|
|
39
|
-
return new Promise((resolve, reject) => {
|
|
40
|
-
const transaction = db.transaction(["storage"], "readonly");
|
|
41
|
-
const store = transaction.objectStore("storage");
|
|
42
|
-
const request = store.get(key);
|
|
43
|
-
request.onerror = () => reject(request.error);
|
|
44
|
-
request.onsuccess = () => {
|
|
45
|
-
resolve(request.result || null);
|
|
46
|
-
};
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
catch (error) {
|
|
50
|
-
console.error(`Failed to get item for key ${key}:`, error);
|
|
51
|
-
return null;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
async setItem(key, value) {
|
|
55
|
-
try {
|
|
56
|
-
const db = await this.getDB();
|
|
57
|
-
return new Promise((resolve, reject) => {
|
|
58
|
-
const transaction = db.transaction(["storage"], "readwrite");
|
|
59
|
-
const store = transaction.objectStore("storage");
|
|
60
|
-
const request = store.put(value, key);
|
|
61
|
-
request.onerror = () => reject(request.error);
|
|
62
|
-
request.onsuccess = () => resolve();
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
catch (error) {
|
|
66
|
-
console.error(`Failed to set item for key ${key}:`, error);
|
|
67
|
-
throw error;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
async removeItem(key) {
|
|
71
|
-
try {
|
|
72
|
-
const db = await this.getDB();
|
|
73
|
-
return new Promise((resolve, reject) => {
|
|
74
|
-
const transaction = db.transaction(["storage"], "readwrite");
|
|
75
|
-
const store = transaction.objectStore("storage");
|
|
76
|
-
const request = store.delete(key);
|
|
77
|
-
request.onerror = () => reject(request.error);
|
|
78
|
-
request.onsuccess = () => resolve();
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
catch (error) {
|
|
82
|
-
console.error(`Failed to remove item for key ${key}:`, error);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
async clear() {
|
|
86
|
-
try {
|
|
87
|
-
const db = await this.getDB();
|
|
88
|
-
return new Promise((resolve, reject) => {
|
|
89
|
-
const transaction = db.transaction(["storage"], "readwrite");
|
|
90
|
-
const store = transaction.objectStore("storage");
|
|
91
|
-
const request = store.clear();
|
|
92
|
-
request.onerror = () => reject(request.error);
|
|
93
|
-
request.onsuccess = () => resolve();
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
catch (error) {
|
|
97
|
-
console.error("Failed to clear storage:", error);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
exports.IndexedDBStorageAdapter = IndexedDBStorageAdapter;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LocalStorageAdapter = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* @deprecated Use repository implementations via `StorageConfig` instead.
|
|
6
|
-
*/
|
|
7
|
-
class LocalStorageAdapter {
|
|
8
|
-
getSafeLocalStorage() {
|
|
9
|
-
try {
|
|
10
|
-
if (typeof window === "undefined" || !window.localStorage) {
|
|
11
|
-
return null;
|
|
12
|
-
}
|
|
13
|
-
// Test access to ensure localStorage is actually available
|
|
14
|
-
window.localStorage.length;
|
|
15
|
-
return window.localStorage;
|
|
16
|
-
}
|
|
17
|
-
catch {
|
|
18
|
-
// localStorage may throw in some environments (e.g., private browsing, disabled storage)
|
|
19
|
-
return null;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
async getItem(key) {
|
|
23
|
-
const localStorage = this.getSafeLocalStorage();
|
|
24
|
-
if (!localStorage) {
|
|
25
|
-
throw new Error("localStorage is not available in this environment");
|
|
26
|
-
}
|
|
27
|
-
return localStorage.getItem(key);
|
|
28
|
-
}
|
|
29
|
-
async setItem(key, value) {
|
|
30
|
-
const localStorage = this.getSafeLocalStorage();
|
|
31
|
-
if (!localStorage) {
|
|
32
|
-
throw new Error("localStorage is not available in this environment");
|
|
33
|
-
}
|
|
34
|
-
localStorage.setItem(key, value);
|
|
35
|
-
}
|
|
36
|
-
async removeItem(key) {
|
|
37
|
-
const localStorage = this.getSafeLocalStorage();
|
|
38
|
-
if (!localStorage) {
|
|
39
|
-
throw new Error("localStorage is not available in this environment");
|
|
40
|
-
}
|
|
41
|
-
localStorage.removeItem(key);
|
|
42
|
-
}
|
|
43
|
-
async clear() {
|
|
44
|
-
const localStorage = this.getSafeLocalStorage();
|
|
45
|
-
if (!localStorage) {
|
|
46
|
-
throw new Error("localStorage is not available in this environment");
|
|
47
|
-
}
|
|
48
|
-
localStorage.clear();
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
exports.LocalStorageAdapter = LocalStorageAdapter;
|