@arkade-os/sdk 0.4.27 → 0.4.29
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 +45 -116
- 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-ChhTwpLf.d.cts +3892 -0
- package/dist/ark-ChhTwpLf.d.ts +3892 -0
- package/dist/asyncStorageTaskQueue-DW1-BpI7.d.cts +49 -0
- package/dist/{types/worker/expo/asyncStorageTaskQueue.d.ts → asyncStorageTaskQueue-DZ0nUuEJ.d.ts} +6 -3
- package/dist/chunk-5BLDMQED.cjs +18 -0
- package/dist/chunk-5BLDMQED.cjs.map +1 -0
- package/dist/chunk-6FLL2Q36.cjs +2701 -0
- package/dist/chunk-6FLL2Q36.cjs.map +1 -0
- package/dist/chunk-6NWNOLL3.js +2671 -0
- package/dist/chunk-6NWNOLL3.js.map +1 -0
- package/dist/chunk-ABWRLTX5.js +210 -0
- package/dist/chunk-ABWRLTX5.js.map +1 -0
- package/dist/chunk-BVP2U66Q.js +13943 -0
- package/dist/chunk-BVP2U66Q.js.map +1 -0
- package/dist/chunk-GDCTOSMV.cjs +14058 -0
- package/dist/chunk-GDCTOSMV.cjs.map +1 -0
- package/dist/chunk-GIGILVVP.cjs +213 -0
- package/dist/chunk-GIGILVVP.cjs.map +1 -0
- package/dist/chunk-IEO3XDKI.cjs +838 -0
- package/dist/chunk-IEO3XDKI.cjs.map +1 -0
- package/dist/chunk-NSBPE2FW.js +15 -0
- package/dist/chunk-NSBPE2FW.js.map +1 -0
- package/dist/chunk-PJUFOJ2L.cjs +100 -0
- package/dist/chunk-PJUFOJ2L.cjs.map +1 -0
- package/dist/chunk-TH6T23XG.js +95 -0
- package/dist/chunk-TH6T23XG.js.map +1 -0
- package/dist/chunk-TU3LVAPX.js +769 -0
- package/dist/chunk-TU3LVAPX.js.map +1 -0
- package/dist/chunk-WMIPYZSB.cjs +803 -0
- package/dist/chunk-WMIPYZSB.cjs.map +1 -0
- package/dist/chunk-YA4G7RFB.js +829 -0
- package/dist/chunk-YA4G7RFB.js.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-4JBUkUhR.d.cts +84 -0
- package/dist/delegate-DN7RELL1.d.ts +84 -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-Cn82bBUu.d.ts +199 -0
- package/dist/index-DfT5xzgY.d.cts +199 -0
- package/dist/index.cjs +504 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +3469 -0
- package/dist/index.d.ts +3469 -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-B-aPfHhK.d.cts +114 -0
- package/dist/taskRunner-B-vG08pX.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 +175 -0
- package/dist/wallet/expo/index.cjs.map +1 -0
- package/dist/wallet/expo/index.d.cts +124 -0
- package/dist/wallet/expo/index.d.ts +124 -0
- package/dist/wallet/expo/index.js +173 -0
- package/dist/wallet/expo/index.js.map +1 -0
- package/dist/wallet-CCtqT2Wb.d.ts +778 -0
- package/dist/wallet-DjgFb_4T.d.cts +778 -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/expo/wallet.d.ts +0 -99
- 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,619 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CLTVMultisigTapscript = exports.ConditionMultisigTapscript = exports.ConditionCSVMultisigTapscript = exports.CSVMultisigTapscript = exports.MultisigTapscript = exports.TapscriptType = void 0;
|
|
4
|
-
exports.decodeTapscript = decodeTapscript;
|
|
5
|
-
const btc_signer_1 = require("@scure/btc-signer");
|
|
6
|
-
const base_1 = require("@scure/base");
|
|
7
|
-
const timelock_1 = require("../utils/timelock");
|
|
8
|
-
const MinimalScriptNum = (0, btc_signer_1.ScriptNum)(undefined, true);
|
|
9
|
-
var TapscriptType;
|
|
10
|
-
(function (TapscriptType) {
|
|
11
|
-
TapscriptType["Multisig"] = "multisig";
|
|
12
|
-
TapscriptType["CSVMultisig"] = "csv-multisig";
|
|
13
|
-
TapscriptType["ConditionCSVMultisig"] = "condition-csv-multisig";
|
|
14
|
-
TapscriptType["ConditionMultisig"] = "condition-multisig";
|
|
15
|
-
TapscriptType["CLTVMultisig"] = "cltv-multisig";
|
|
16
|
-
})(TapscriptType || (exports.TapscriptType = TapscriptType = {}));
|
|
17
|
-
/**
|
|
18
|
-
* decodeTapscript is a function that decodes an Arkade tapscript from a raw script.
|
|
19
|
-
*
|
|
20
|
-
* @throws {Error} if the script is not a valid Arkade tapscript
|
|
21
|
-
* @example
|
|
22
|
-
* ```typescript
|
|
23
|
-
* const arkTapscript = decodeTapscript(new Uint8Array(32));
|
|
24
|
-
* console.log("type:", arkTapscript.type);
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
function decodeTapscript(script) {
|
|
28
|
-
const types = [
|
|
29
|
-
MultisigTapscript,
|
|
30
|
-
CSVMultisigTapscript,
|
|
31
|
-
ConditionCSVMultisigTapscript,
|
|
32
|
-
ConditionMultisigTapscript,
|
|
33
|
-
CLTVMultisigTapscript,
|
|
34
|
-
];
|
|
35
|
-
for (const type of types) {
|
|
36
|
-
try {
|
|
37
|
-
return type.decode(script);
|
|
38
|
-
}
|
|
39
|
-
catch (error) {
|
|
40
|
-
continue;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
throw new Error(`Failed to decode: script ${base_1.hex.encode(script)} is not a valid tapscript`);
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Implements a multi-signature tapscript.
|
|
47
|
-
*
|
|
48
|
-
* <pubkey> CHECKSIGVERIFY <pubkey> CHECKSIG
|
|
49
|
-
*
|
|
50
|
-
* @example
|
|
51
|
-
* ```typescript
|
|
52
|
-
* const multisigTapscript = MultisigTapscript.encode({ pubkeys: [new Uint8Array(32), new Uint8Array(32)] });
|
|
53
|
-
* ```
|
|
54
|
-
*/
|
|
55
|
-
var MultisigTapscript;
|
|
56
|
-
(function (MultisigTapscript) {
|
|
57
|
-
let MultisigType;
|
|
58
|
-
(function (MultisigType) {
|
|
59
|
-
MultisigType[MultisigType["CHECKSIG"] = 0] = "CHECKSIG";
|
|
60
|
-
MultisigType[MultisigType["CHECKSIGADD"] = 1] = "CHECKSIGADD";
|
|
61
|
-
})(MultisigType = MultisigTapscript.MultisigType || (MultisigTapscript.MultisigType = {}));
|
|
62
|
-
/** Encode a plain multisig tapscript. */
|
|
63
|
-
function encode(params) {
|
|
64
|
-
if (params.pubkeys.length === 0) {
|
|
65
|
-
throw new Error("At least 1 pubkey is required");
|
|
66
|
-
}
|
|
67
|
-
for (const pubkey of params.pubkeys) {
|
|
68
|
-
if (pubkey.length !== 32) {
|
|
69
|
-
throw new Error(`Invalid pubkey length: expected 32, got ${pubkey.length}`);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
if (!params.type) {
|
|
73
|
-
params.type = MultisigType.CHECKSIG;
|
|
74
|
-
}
|
|
75
|
-
if (params.type === MultisigType.CHECKSIGADD) {
|
|
76
|
-
return {
|
|
77
|
-
type: TapscriptType.Multisig,
|
|
78
|
-
params,
|
|
79
|
-
script: (0, btc_signer_1.p2tr_ms)(params.pubkeys.length, params.pubkeys).script,
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
const asm = [];
|
|
83
|
-
for (let i = 0; i < params.pubkeys.length; i++) {
|
|
84
|
-
asm.push(params.pubkeys[i]);
|
|
85
|
-
// CHECKSIGVERIFY except the last pubkey
|
|
86
|
-
if (i < params.pubkeys.length - 1) {
|
|
87
|
-
asm.push("CHECKSIGVERIFY");
|
|
88
|
-
}
|
|
89
|
-
else {
|
|
90
|
-
asm.push("CHECKSIG");
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
return {
|
|
94
|
-
type: TapscriptType.Multisig,
|
|
95
|
-
params,
|
|
96
|
-
script: btc_signer_1.Script.encode(asm),
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
MultisigTapscript.encode = encode;
|
|
100
|
-
/** Decode a plain multisig tapscript from raw script bytes. */
|
|
101
|
-
function decode(script) {
|
|
102
|
-
if (script.length === 0) {
|
|
103
|
-
throw new Error("Failed to decode: script is empty");
|
|
104
|
-
}
|
|
105
|
-
try {
|
|
106
|
-
// Try decoding as checksigAdd first
|
|
107
|
-
return decodeChecksigAdd(script);
|
|
108
|
-
}
|
|
109
|
-
catch (error) {
|
|
110
|
-
// If checksigAdd fails, try regular checksig
|
|
111
|
-
try {
|
|
112
|
-
return decodeChecksig(script);
|
|
113
|
-
}
|
|
114
|
-
catch (error2) {
|
|
115
|
-
throw new Error(`Failed to decode script: ${error2 instanceof Error ? error2.message : String(error2)}`);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
MultisigTapscript.decode = decode;
|
|
120
|
-
// <pubkey> CHECKSIG <pubkey> CHECKSIGADD <len_keys> NUMEQUAL
|
|
121
|
-
function decodeChecksigAdd(script) {
|
|
122
|
-
const asm = btc_signer_1.Script.decode(script);
|
|
123
|
-
const pubkeys = [];
|
|
124
|
-
let foundNumEqual = false;
|
|
125
|
-
// Parse through ASM operations
|
|
126
|
-
for (let i = 0; i < asm.length; i++) {
|
|
127
|
-
const op = asm[i];
|
|
128
|
-
// If it's a data push, it should be a 32-byte pubkey
|
|
129
|
-
if (typeof op !== "string" && typeof op !== "number") {
|
|
130
|
-
if (op.length !== 32) {
|
|
131
|
-
throw new Error(`Invalid pubkey length: expected 32, got ${op.length}`);
|
|
132
|
-
}
|
|
133
|
-
pubkeys.push(op);
|
|
134
|
-
// Check next operation is CHECKSIGADD or CHECKSIG
|
|
135
|
-
if (i + 1 >= asm.length ||
|
|
136
|
-
(asm[i + 1] !== "CHECKSIGADD" && asm[i + 1] !== "CHECKSIG")) {
|
|
137
|
-
throw new Error("Expected CHECKSIGADD or CHECKSIG after pubkey");
|
|
138
|
-
}
|
|
139
|
-
i++; // Skip the CHECKSIGADD op
|
|
140
|
-
continue;
|
|
141
|
-
}
|
|
142
|
-
// Last operation should be NUMEQUAL
|
|
143
|
-
if (i === asm.length - 1) {
|
|
144
|
-
if (op !== "NUMEQUAL") {
|
|
145
|
-
throw new Error("Expected NUMEQUAL at end of script");
|
|
146
|
-
}
|
|
147
|
-
foundNumEqual = true;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
if (!foundNumEqual) {
|
|
151
|
-
throw new Error("Missing NUMEQUAL operation");
|
|
152
|
-
}
|
|
153
|
-
if (pubkeys.length === 0) {
|
|
154
|
-
throw new Error("Invalid script: must have at least 1 pubkey");
|
|
155
|
-
}
|
|
156
|
-
// Verify the script by re-encoding and comparing
|
|
157
|
-
const reconstructed = encode({
|
|
158
|
-
pubkeys,
|
|
159
|
-
type: MultisigType.CHECKSIGADD,
|
|
160
|
-
});
|
|
161
|
-
if (base_1.hex.encode(reconstructed.script) !== base_1.hex.encode(script)) {
|
|
162
|
-
throw new Error("Invalid script format: script reconstruction mismatch");
|
|
163
|
-
}
|
|
164
|
-
return {
|
|
165
|
-
type: TapscriptType.Multisig,
|
|
166
|
-
params: { pubkeys, type: MultisigType.CHECKSIGADD },
|
|
167
|
-
script,
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
|
-
// <pubkey> CHECKSIGVERIFY <pubkey> CHECKSIG
|
|
171
|
-
function decodeChecksig(script) {
|
|
172
|
-
const asm = btc_signer_1.Script.decode(script);
|
|
173
|
-
const pubkeys = [];
|
|
174
|
-
// Parse through ASM operations
|
|
175
|
-
for (let i = 0; i < asm.length; i++) {
|
|
176
|
-
const op = asm[i];
|
|
177
|
-
// If it's a data push, it should be a 32-byte pubkey
|
|
178
|
-
if (typeof op !== "string" && typeof op !== "number") {
|
|
179
|
-
if (op.length !== 32) {
|
|
180
|
-
throw new Error(`Invalid pubkey length: expected 32, got ${op.length}`);
|
|
181
|
-
}
|
|
182
|
-
pubkeys.push(op);
|
|
183
|
-
// Check next operation
|
|
184
|
-
if (i + 1 >= asm.length) {
|
|
185
|
-
throw new Error("Unexpected end of script");
|
|
186
|
-
}
|
|
187
|
-
const nextOp = asm[i + 1];
|
|
188
|
-
if (nextOp !== "CHECKSIGVERIFY" && nextOp !== "CHECKSIG") {
|
|
189
|
-
throw new Error("Expected CHECKSIGVERIFY or CHECKSIG after pubkey");
|
|
190
|
-
}
|
|
191
|
-
// Last operation must be CHECKSIG, not CHECKSIGVERIFY
|
|
192
|
-
if (i === asm.length - 2 && nextOp !== "CHECKSIG") {
|
|
193
|
-
throw new Error("Last operation must be CHECKSIG");
|
|
194
|
-
}
|
|
195
|
-
i++; // Skip the CHECKSIG/CHECKSIGVERIFY op
|
|
196
|
-
continue;
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
if (pubkeys.length === 0) {
|
|
200
|
-
throw new Error("Invalid script: must have at least 1 pubkey");
|
|
201
|
-
}
|
|
202
|
-
// Verify the script by re-encoding and comparing
|
|
203
|
-
const reconstructed = encode({ pubkeys, type: MultisigType.CHECKSIG });
|
|
204
|
-
if (base_1.hex.encode(reconstructed.script) !== base_1.hex.encode(script)) {
|
|
205
|
-
throw new Error("Invalid script format: script reconstruction mismatch");
|
|
206
|
-
}
|
|
207
|
-
return {
|
|
208
|
-
type: TapscriptType.Multisig,
|
|
209
|
-
params: { pubkeys, type: MultisigType.CHECKSIG },
|
|
210
|
-
script,
|
|
211
|
-
};
|
|
212
|
-
}
|
|
213
|
-
/** Return true when the tapscript is a plain multisig tapscript. */
|
|
214
|
-
function is(tapscript) {
|
|
215
|
-
return tapscript.type === TapscriptType.Multisig;
|
|
216
|
-
}
|
|
217
|
-
MultisigTapscript.is = is;
|
|
218
|
-
})(MultisigTapscript || (exports.MultisigTapscript = MultisigTapscript = {}));
|
|
219
|
-
/**
|
|
220
|
-
* Implements a relative timelock script that requires all specified pubkeys to sign
|
|
221
|
-
* after the relative timelock has expired. The timelock can be specified in blocks or seconds.
|
|
222
|
-
*
|
|
223
|
-
* This is the standard exit closure and it is also used for the sweep closure in vtxo trees.
|
|
224
|
-
*
|
|
225
|
-
* <sequence> CHECKSEQUENCEVERIFY DROP <pubkey> CHECKSIG
|
|
226
|
-
*
|
|
227
|
-
* @example
|
|
228
|
-
* ```typescript
|
|
229
|
-
* const csvMultisigTapscript = CSVMultisigTapscript.encode({ timelock: { type: "blocks", value: 144 }, pubkeys: [new Uint8Array(32), new Uint8Array(32)] });
|
|
230
|
-
* ```
|
|
231
|
-
*/
|
|
232
|
-
var CSVMultisigTapscript;
|
|
233
|
-
(function (CSVMultisigTapscript) {
|
|
234
|
-
/** Encode a CSV multisig tapscript. */
|
|
235
|
-
function encode(params) {
|
|
236
|
-
for (const pubkey of params.pubkeys) {
|
|
237
|
-
if (pubkey.length !== 32) {
|
|
238
|
-
throw new Error(`Invalid pubkey length: expected 32, got ${pubkey.length}`);
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
const sequence = MinimalScriptNum.encode(BigInt((0, timelock_1.timelockToSequence)(params.timelock)));
|
|
242
|
-
const asm = [
|
|
243
|
-
sequence.length === 1 ? sequence[0] : sequence,
|
|
244
|
-
"CHECKSEQUENCEVERIFY",
|
|
245
|
-
"DROP",
|
|
246
|
-
];
|
|
247
|
-
const multisigScript = MultisigTapscript.encode(params);
|
|
248
|
-
const script = new Uint8Array([
|
|
249
|
-
...btc_signer_1.Script.encode(asm),
|
|
250
|
-
...multisigScript.script,
|
|
251
|
-
]);
|
|
252
|
-
return {
|
|
253
|
-
type: TapscriptType.CSVMultisig,
|
|
254
|
-
params,
|
|
255
|
-
script,
|
|
256
|
-
};
|
|
257
|
-
}
|
|
258
|
-
CSVMultisigTapscript.encode = encode;
|
|
259
|
-
/** Decode a CSV multisig tapscript from raw script bytes. */
|
|
260
|
-
function decode(script) {
|
|
261
|
-
if (script.length === 0) {
|
|
262
|
-
throw new Error("Failed to decode: script is empty");
|
|
263
|
-
}
|
|
264
|
-
const isValid = isScriptValid(script);
|
|
265
|
-
if (isValid instanceof Error) {
|
|
266
|
-
throw isValid;
|
|
267
|
-
}
|
|
268
|
-
const asm = btc_signer_1.Script.decode(script);
|
|
269
|
-
const sequence = asm[0];
|
|
270
|
-
const multisigScript = new Uint8Array(btc_signer_1.Script.encode(asm.slice(3)));
|
|
271
|
-
let multisig;
|
|
272
|
-
try {
|
|
273
|
-
multisig = MultisigTapscript.decode(multisigScript);
|
|
274
|
-
}
|
|
275
|
-
catch (error) {
|
|
276
|
-
throw new Error(`Invalid multisig script: ${error instanceof Error ? error.message : String(error)}`);
|
|
277
|
-
}
|
|
278
|
-
let sequenceNum;
|
|
279
|
-
if (typeof sequence === "number") {
|
|
280
|
-
sequenceNum = sequence;
|
|
281
|
-
}
|
|
282
|
-
else {
|
|
283
|
-
sequenceNum = Number(MinimalScriptNum.decode(sequence));
|
|
284
|
-
}
|
|
285
|
-
const timelock = (0, timelock_1.sequenceToTimelock)(sequenceNum);
|
|
286
|
-
const reconstructed = encode({
|
|
287
|
-
timelock,
|
|
288
|
-
...multisig.params,
|
|
289
|
-
});
|
|
290
|
-
if (base_1.hex.encode(reconstructed.script) !== base_1.hex.encode(script)) {
|
|
291
|
-
throw new Error("Invalid script format: script reconstruction mismatch");
|
|
292
|
-
}
|
|
293
|
-
return {
|
|
294
|
-
type: TapscriptType.CSVMultisig,
|
|
295
|
-
params: {
|
|
296
|
-
timelock,
|
|
297
|
-
...multisig.params,
|
|
298
|
-
},
|
|
299
|
-
script,
|
|
300
|
-
};
|
|
301
|
-
}
|
|
302
|
-
CSVMultisigTapscript.decode = decode;
|
|
303
|
-
/** Return true when the tapscript is a CSV multisig tapscript. */
|
|
304
|
-
function is(tapscript) {
|
|
305
|
-
return tapscript.type === TapscriptType.CSVMultisig;
|
|
306
|
-
}
|
|
307
|
-
CSVMultisigTapscript.is = is;
|
|
308
|
-
function isScriptValid(script) {
|
|
309
|
-
const asm = btc_signer_1.Script.decode(script);
|
|
310
|
-
if (asm.length < 3) {
|
|
311
|
-
return new Error(`Invalid script: too short (expected at least 3)`);
|
|
312
|
-
}
|
|
313
|
-
const sequence = asm[0];
|
|
314
|
-
if (typeof sequence === "string") {
|
|
315
|
-
return new Error("Invalid script: expected sequence number");
|
|
316
|
-
}
|
|
317
|
-
if (asm[1] !== "CHECKSEQUENCEVERIFY" || asm[2] !== "DROP") {
|
|
318
|
-
return new Error("Invalid script: expected CHECKSEQUENCEVERIFY DROP");
|
|
319
|
-
}
|
|
320
|
-
return true;
|
|
321
|
-
}
|
|
322
|
-
CSVMultisigTapscript.isScriptValid = isScriptValid;
|
|
323
|
-
})(CSVMultisigTapscript || (exports.CSVMultisigTapscript = CSVMultisigTapscript = {}));
|
|
324
|
-
/**
|
|
325
|
-
* Combines a condition script with an exit closure. The resulting script requires
|
|
326
|
-
* the condition to be met, followed by the standard exit closure requirements
|
|
327
|
-
* (timelock and signatures).
|
|
328
|
-
*
|
|
329
|
-
* <conditionScript> VERIFY <sequence> CHECKSEQUENCEVERIFY DROP <pubkey> CHECKSIGVERIFY <pubkey> CHECKSIG
|
|
330
|
-
*
|
|
331
|
-
* @example
|
|
332
|
-
* ```typescript
|
|
333
|
-
* const conditionCSVMultisigTapscript = ConditionCSVMultisigTapscript.encode({ conditionScript: new Uint8Array(32), pubkeys: [new Uint8Array(32), new Uint8Array(32)] });
|
|
334
|
-
* ```
|
|
335
|
-
*/
|
|
336
|
-
var ConditionCSVMultisigTapscript;
|
|
337
|
-
(function (ConditionCSVMultisigTapscript) {
|
|
338
|
-
/** Encode a condition + CSV multisig tapscript. */
|
|
339
|
-
function encode(params) {
|
|
340
|
-
const script = new Uint8Array([
|
|
341
|
-
...params.conditionScript,
|
|
342
|
-
...btc_signer_1.Script.encode(["VERIFY"]),
|
|
343
|
-
...CSVMultisigTapscript.encode(params).script,
|
|
344
|
-
]);
|
|
345
|
-
return {
|
|
346
|
-
type: TapscriptType.ConditionCSVMultisig,
|
|
347
|
-
params,
|
|
348
|
-
script,
|
|
349
|
-
};
|
|
350
|
-
}
|
|
351
|
-
ConditionCSVMultisigTapscript.encode = encode;
|
|
352
|
-
/** Decode a condition + CSV multisig tapscript from raw script bytes. */
|
|
353
|
-
function decode(script) {
|
|
354
|
-
if (script.length === 0) {
|
|
355
|
-
throw new Error("Failed to decode: script is empty");
|
|
356
|
-
}
|
|
357
|
-
const isValid = isScriptValid(script);
|
|
358
|
-
if (isValid instanceof Error) {
|
|
359
|
-
throw isValid;
|
|
360
|
-
}
|
|
361
|
-
const asm = btc_signer_1.Script.decode(script);
|
|
362
|
-
let verifyIndex = getVerifyIndex(asm);
|
|
363
|
-
if (verifyIndex === -1) {
|
|
364
|
-
throw Error("Invalid script: missing VERIFY operation");
|
|
365
|
-
}
|
|
366
|
-
const conditionScript = new Uint8Array(btc_signer_1.Script.encode(asm.slice(0, verifyIndex)));
|
|
367
|
-
const csvMultisigScript = new Uint8Array(btc_signer_1.Script.encode(asm.slice(verifyIndex + 1)));
|
|
368
|
-
let csvMultisig;
|
|
369
|
-
try {
|
|
370
|
-
csvMultisig = CSVMultisigTapscript.decode(csvMultisigScript);
|
|
371
|
-
}
|
|
372
|
-
catch (error) {
|
|
373
|
-
throw new Error(`Invalid CSV multisig script: ${error instanceof Error ? error.message : String(error)}`);
|
|
374
|
-
}
|
|
375
|
-
const reconstructed = encode({
|
|
376
|
-
conditionScript,
|
|
377
|
-
...csvMultisig.params,
|
|
378
|
-
});
|
|
379
|
-
if (base_1.hex.encode(reconstructed.script) !== base_1.hex.encode(script)) {
|
|
380
|
-
throw new Error("Invalid script format: script reconstruction mismatch");
|
|
381
|
-
}
|
|
382
|
-
return {
|
|
383
|
-
type: TapscriptType.ConditionCSVMultisig,
|
|
384
|
-
params: {
|
|
385
|
-
conditionScript,
|
|
386
|
-
...csvMultisig.params,
|
|
387
|
-
},
|
|
388
|
-
script,
|
|
389
|
-
};
|
|
390
|
-
}
|
|
391
|
-
ConditionCSVMultisigTapscript.decode = decode;
|
|
392
|
-
/** Return true when the tapscript is a condition + CSV multisig tapscript. */
|
|
393
|
-
function is(tapscript) {
|
|
394
|
-
return tapscript.type === TapscriptType.ConditionCSVMultisig;
|
|
395
|
-
}
|
|
396
|
-
ConditionCSVMultisigTapscript.is = is;
|
|
397
|
-
function getVerifyIndex(asm) {
|
|
398
|
-
let verifyIndex = -1;
|
|
399
|
-
for (let i = asm.length - 1; i >= 0; i--) {
|
|
400
|
-
if (asm[i] === "VERIFY") {
|
|
401
|
-
verifyIndex = i;
|
|
402
|
-
return verifyIndex;
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
return verifyIndex;
|
|
406
|
-
}
|
|
407
|
-
function isScriptValid(script) {
|
|
408
|
-
const asm = btc_signer_1.Script.decode(script);
|
|
409
|
-
if (asm.length < 1) {
|
|
410
|
-
return new Error(`Invalid script: too short (expected at least 1)`);
|
|
411
|
-
}
|
|
412
|
-
let verifyIndex = getVerifyIndex(asm);
|
|
413
|
-
if (verifyIndex === -1) {
|
|
414
|
-
return new Error("Invalid script: missing VERIFY operation");
|
|
415
|
-
}
|
|
416
|
-
return true;
|
|
417
|
-
}
|
|
418
|
-
ConditionCSVMultisigTapscript.isScriptValid = isScriptValid;
|
|
419
|
-
})(ConditionCSVMultisigTapscript || (exports.ConditionCSVMultisigTapscript = ConditionCSVMultisigTapscript = {}));
|
|
420
|
-
/**
|
|
421
|
-
* Combines a condition script with a forfeit closure. The resulting script requires
|
|
422
|
-
* the condition to be met, followed by the standard forfeit closure requirements
|
|
423
|
-
* (multi-signature).
|
|
424
|
-
*
|
|
425
|
-
* <conditionScript> VERIFY <pubkey> CHECKSIGVERIFY <pubkey> CHECKSIG
|
|
426
|
-
*
|
|
427
|
-
* @example
|
|
428
|
-
* ```typescript
|
|
429
|
-
* const conditionMultisigTapscript = ConditionMultisigTapscript.encode({ conditionScript: new Uint8Array(32), pubkeys: [new Uint8Array(32), new Uint8Array(32)] });
|
|
430
|
-
* ```
|
|
431
|
-
*/
|
|
432
|
-
var ConditionMultisigTapscript;
|
|
433
|
-
(function (ConditionMultisigTapscript) {
|
|
434
|
-
/** Encode a condition + multisig tapscript. */
|
|
435
|
-
function encode(params) {
|
|
436
|
-
const script = new Uint8Array([
|
|
437
|
-
...params.conditionScript,
|
|
438
|
-
...btc_signer_1.Script.encode(["VERIFY"]),
|
|
439
|
-
...MultisigTapscript.encode(params).script,
|
|
440
|
-
]);
|
|
441
|
-
return {
|
|
442
|
-
type: TapscriptType.ConditionMultisig,
|
|
443
|
-
params,
|
|
444
|
-
script,
|
|
445
|
-
};
|
|
446
|
-
}
|
|
447
|
-
ConditionMultisigTapscript.encode = encode;
|
|
448
|
-
/** Decode a condition + multisig tapscript from raw script bytes. */
|
|
449
|
-
function decode(script) {
|
|
450
|
-
if (script.length === 0) {
|
|
451
|
-
throw new Error("Failed to decode: script is empty");
|
|
452
|
-
}
|
|
453
|
-
const isValid = isScriptValid(script);
|
|
454
|
-
if (isValid instanceof Error) {
|
|
455
|
-
throw isValid;
|
|
456
|
-
}
|
|
457
|
-
const asm = btc_signer_1.Script.decode(script);
|
|
458
|
-
let verifyIndex = getVerifyIndex(asm);
|
|
459
|
-
if (verifyIndex === -1) {
|
|
460
|
-
throw Error("Invalid script: missing VERIFY operation");
|
|
461
|
-
}
|
|
462
|
-
const conditionScript = new Uint8Array(btc_signer_1.Script.encode(asm.slice(0, verifyIndex)));
|
|
463
|
-
const multisigScript = new Uint8Array(btc_signer_1.Script.encode(asm.slice(verifyIndex + 1)));
|
|
464
|
-
let multisig;
|
|
465
|
-
try {
|
|
466
|
-
multisig = MultisigTapscript.decode(multisigScript);
|
|
467
|
-
}
|
|
468
|
-
catch (error) {
|
|
469
|
-
throw new Error(`Invalid multisig script: ${error instanceof Error ? error.message : String(error)}`);
|
|
470
|
-
}
|
|
471
|
-
const reconstructed = encode({
|
|
472
|
-
conditionScript,
|
|
473
|
-
...multisig.params,
|
|
474
|
-
});
|
|
475
|
-
if (base_1.hex.encode(reconstructed.script) !== base_1.hex.encode(script)) {
|
|
476
|
-
throw new Error("Invalid script format: script reconstruction mismatch");
|
|
477
|
-
}
|
|
478
|
-
return {
|
|
479
|
-
type: TapscriptType.ConditionMultisig,
|
|
480
|
-
params: {
|
|
481
|
-
conditionScript,
|
|
482
|
-
...multisig.params,
|
|
483
|
-
},
|
|
484
|
-
script,
|
|
485
|
-
};
|
|
486
|
-
}
|
|
487
|
-
ConditionMultisigTapscript.decode = decode;
|
|
488
|
-
/** Return true when the tapscript is a condition + multisig tapscript. */
|
|
489
|
-
function is(tapscript) {
|
|
490
|
-
return tapscript.type === TapscriptType.ConditionMultisig;
|
|
491
|
-
}
|
|
492
|
-
ConditionMultisigTapscript.is = is;
|
|
493
|
-
function getVerifyIndex(asm) {
|
|
494
|
-
let verifyIndex = -1;
|
|
495
|
-
for (let i = asm.length - 1; i >= 0; i--) {
|
|
496
|
-
if (asm[i] === "VERIFY") {
|
|
497
|
-
verifyIndex = i;
|
|
498
|
-
return verifyIndex;
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
return verifyIndex;
|
|
502
|
-
}
|
|
503
|
-
function isScriptValid(script) {
|
|
504
|
-
const asm = btc_signer_1.Script.decode(script);
|
|
505
|
-
if (asm.length < 1) {
|
|
506
|
-
return new Error(`Invalid script: too short (expected at least 1)`);
|
|
507
|
-
}
|
|
508
|
-
let verifyIndex = getVerifyIndex(asm);
|
|
509
|
-
if (verifyIndex === -1) {
|
|
510
|
-
return new Error("Invalid script: missing VERIFY operation");
|
|
511
|
-
}
|
|
512
|
-
return true;
|
|
513
|
-
}
|
|
514
|
-
ConditionMultisigTapscript.isScriptValid = isScriptValid;
|
|
515
|
-
})(ConditionMultisigTapscript || (exports.ConditionMultisigTapscript = ConditionMultisigTapscript = {}));
|
|
516
|
-
/**
|
|
517
|
-
* Implements an absolute timelock (CLTV) script combined with a forfeit closure.
|
|
518
|
-
* The script requires waiting until a specific block height/timestamp before the
|
|
519
|
-
* forfeit closure conditions can be met.
|
|
520
|
-
*
|
|
521
|
-
* <locktime> CHECKLOCKTIMEVERIFY DROP <pubkey> CHECKSIGVERIFY <pubkey> CHECKSIG
|
|
522
|
-
*
|
|
523
|
-
* @example
|
|
524
|
-
* ```typescript
|
|
525
|
-
* const cltvMultisigTapscript = CLTVMultisigTapscript.encode({ absoluteTimelock: 144, pubkeys: [new Uint8Array(32), new Uint8Array(32)] });
|
|
526
|
-
* ```
|
|
527
|
-
*/
|
|
528
|
-
var CLTVMultisigTapscript;
|
|
529
|
-
(function (CLTVMultisigTapscript) {
|
|
530
|
-
/** Encode a CLTV multisig tapscript. */
|
|
531
|
-
function encode(params) {
|
|
532
|
-
const locktime = MinimalScriptNum.encode(params.absoluteTimelock);
|
|
533
|
-
const asm = [
|
|
534
|
-
locktime.length === 1 ? locktime[0] : locktime,
|
|
535
|
-
"CHECKLOCKTIMEVERIFY",
|
|
536
|
-
"DROP",
|
|
537
|
-
];
|
|
538
|
-
const timelockedScript = btc_signer_1.Script.encode(asm);
|
|
539
|
-
const script = new Uint8Array([
|
|
540
|
-
...timelockedScript,
|
|
541
|
-
...MultisigTapscript.encode(params).script,
|
|
542
|
-
]);
|
|
543
|
-
return {
|
|
544
|
-
type: TapscriptType.CLTVMultisig,
|
|
545
|
-
params,
|
|
546
|
-
script,
|
|
547
|
-
};
|
|
548
|
-
}
|
|
549
|
-
CLTVMultisigTapscript.encode = encode;
|
|
550
|
-
/** Decode a CLTV multisig tapscript from raw script bytes. */
|
|
551
|
-
function decode(script) {
|
|
552
|
-
if (script.length === 0) {
|
|
553
|
-
throw new Error("Failed to decode: script is empty");
|
|
554
|
-
}
|
|
555
|
-
const isValid = isScriptValid(script);
|
|
556
|
-
if (isValid instanceof Error) {
|
|
557
|
-
throw isValid;
|
|
558
|
-
}
|
|
559
|
-
const asm = btc_signer_1.Script.decode(script);
|
|
560
|
-
const locktime = asm[0];
|
|
561
|
-
if (typeof locktime === "string") {
|
|
562
|
-
throw new Error("Invalid script: expected locktime number");
|
|
563
|
-
}
|
|
564
|
-
if (asm[1] !== "CHECKLOCKTIMEVERIFY" || asm[2] !== "DROP") {
|
|
565
|
-
throw new Error("Invalid script: expected CHECKLOCKTIMEVERIFY DROP");
|
|
566
|
-
}
|
|
567
|
-
const multisigScript = new Uint8Array(btc_signer_1.Script.encode(asm.slice(3)));
|
|
568
|
-
let multisig;
|
|
569
|
-
try {
|
|
570
|
-
multisig = MultisigTapscript.decode(multisigScript);
|
|
571
|
-
}
|
|
572
|
-
catch (error) {
|
|
573
|
-
throw new Error(`Invalid multisig script: ${error instanceof Error ? error.message : String(error)}`);
|
|
574
|
-
}
|
|
575
|
-
let absoluteTimelock;
|
|
576
|
-
if (typeof locktime === "number") {
|
|
577
|
-
absoluteTimelock = BigInt(locktime);
|
|
578
|
-
}
|
|
579
|
-
else {
|
|
580
|
-
absoluteTimelock = MinimalScriptNum.decode(locktime);
|
|
581
|
-
}
|
|
582
|
-
const reconstructed = encode({
|
|
583
|
-
absoluteTimelock,
|
|
584
|
-
...multisig.params,
|
|
585
|
-
});
|
|
586
|
-
if (base_1.hex.encode(reconstructed.script) !== base_1.hex.encode(script)) {
|
|
587
|
-
throw new Error("Invalid script format: script reconstruction mismatch");
|
|
588
|
-
}
|
|
589
|
-
return {
|
|
590
|
-
type: TapscriptType.CLTVMultisig,
|
|
591
|
-
params: {
|
|
592
|
-
absoluteTimelock,
|
|
593
|
-
...multisig.params,
|
|
594
|
-
},
|
|
595
|
-
script,
|
|
596
|
-
};
|
|
597
|
-
}
|
|
598
|
-
CLTVMultisigTapscript.decode = decode;
|
|
599
|
-
/** Return true when the tapscript is a CLTV multisig tapscript. */
|
|
600
|
-
function is(tapscript) {
|
|
601
|
-
return tapscript.type === TapscriptType.CLTVMultisig;
|
|
602
|
-
}
|
|
603
|
-
CLTVMultisigTapscript.is = is;
|
|
604
|
-
function isScriptValid(script) {
|
|
605
|
-
const asm = btc_signer_1.Script.decode(script);
|
|
606
|
-
if (asm.length < 3) {
|
|
607
|
-
return new Error(`Invalid script: too short (expected at least 3)`);
|
|
608
|
-
}
|
|
609
|
-
const locktime = asm[0];
|
|
610
|
-
if (typeof locktime === "string") {
|
|
611
|
-
return new Error("Invalid script: expected locktime as number or bytes");
|
|
612
|
-
}
|
|
613
|
-
if (asm[1] !== "CHECKLOCKTIMEVERIFY" || asm[2] !== "DROP") {
|
|
614
|
-
return new Error("Invalid script: expected CHECKLOCKTIMEVERIFY DROP");
|
|
615
|
-
}
|
|
616
|
-
return true;
|
|
617
|
-
}
|
|
618
|
-
CLTVMultisigTapscript.isScriptValid = isScriptValid;
|
|
619
|
-
})(CLTVMultisigTapscript || (exports.CLTVMultisigTapscript = CLTVMultisigTapscript = {}));
|