@arkade-os/sdk 0.5.4 → 0.5.5
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 +103 -17
- package/dist/adapters/expo.cjs +7 -6
- package/dist/adapters/expo.d.cts +4 -3
- package/dist/adapters/expo.d.ts +4 -3
- package/dist/adapters/expo.js +4 -3
- package/dist/{asyncStorageTaskQueue-DTBa8EH7.d.cts → asyncStorageTaskQueue-BbH-THYJ.d.cts} +1 -1
- package/dist/{asyncStorageTaskQueue-DHMIxY04.d.ts → asyncStorageTaskQueue-BlvkJyTa.d.ts} +1 -1
- package/dist/base-C-Y5t_0F.d.cts +359 -0
- package/dist/base-C-Y5t_0F.d.ts +359 -0
- package/dist/{chunk-AG4TFD6F.js → chunk-4I53THL6.js} +79 -884
- package/dist/chunk-4I53THL6.js.map +1 -0
- package/dist/{chunk-B6VNKGIH.cjs → chunk-5SYUEVJH.cjs} +10 -10
- package/dist/{chunk-B6VNKGIH.cjs.map → chunk-5SYUEVJH.cjs.map} +1 -1
- package/dist/{chunk-BTRCN4JJ.js → chunk-7GIKLFHC.js} +64 -4
- package/dist/chunk-7GIKLFHC.js.map +1 -0
- package/dist/{chunk-E6OOJEHL.cjs → chunk-AMH7Q3DF.cjs} +60 -934
- package/dist/chunk-AMH7Q3DF.cjs.map +1 -0
- package/dist/{chunk-6CUP6ZIF.js → chunk-BCA6D255.js} +17 -841
- package/dist/chunk-BCA6D255.js.map +1 -0
- package/dist/{chunk-TUOLZBNC.js → chunk-CE46RS6L.js} +5 -4
- package/dist/chunk-CE46RS6L.js.map +1 -0
- package/dist/chunk-DNFTHG73.js +829 -0
- package/dist/chunk-DNFTHG73.js.map +1 -0
- package/dist/chunk-FDJ734CH.js +882 -0
- package/dist/chunk-FDJ734CH.js.map +1 -0
- package/dist/chunk-FLPWNMX3.cjs +930 -0
- package/dist/chunk-FLPWNMX3.cjs.map +1 -0
- package/dist/{chunk-MWVAWFX6.js → chunk-FVVXCDNE.js} +4 -4
- package/dist/{chunk-MWVAWFX6.js.map → chunk-FVVXCDNE.js.map} +1 -1
- package/dist/{chunk-DNITZVNG.cjs → chunk-HQQ4NRXI.cjs} +18 -17
- package/dist/chunk-HQQ4NRXI.cjs.map +1 -0
- package/dist/chunk-JFJNB7ZH.cjs +884 -0
- package/dist/chunk-JFJNB7ZH.cjs.map +1 -0
- package/dist/{chunk-GHUUT54D.cjs → chunk-KCL5AVML.cjs} +89 -933
- package/dist/chunk-KCL5AVML.cjs.map +1 -0
- package/dist/{chunk-ZJHLLDBP.js → chunk-OO2KEK64.js} +2624 -1277
- package/dist/chunk-OO2KEK64.js.map +1 -0
- package/dist/{chunk-F3FAE7VJ.cjs → chunk-T254PXSN.cjs} +3115 -1752
- package/dist/chunk-T254PXSN.cjs.map +1 -0
- package/dist/chunk-V3ZLL5VY.js +380 -0
- package/dist/chunk-V3ZLL5VY.js.map +1 -0
- package/dist/chunk-X6ZI53DZ.cjs +383 -0
- package/dist/chunk-X6ZI53DZ.cjs.map +1 -0
- package/dist/{chunk-WXNSISXK.cjs → chunk-XWUCNMPN.cjs} +79 -18
- package/dist/chunk-XWUCNMPN.cjs.map +1 -0
- package/dist/compiler.cjs +50 -0
- package/dist/compiler.cjs.map +1 -0
- package/dist/compiler.d.cts +38 -0
- package/dist/compiler.d.ts +38 -0
- package/dist/compiler.js +47 -0
- package/dist/compiler.js.map +1 -0
- package/dist/contracts/handlers/index.cjs +11 -9
- package/dist/contracts/handlers/index.d.cts +6 -4
- package/dist/contracts/handlers/index.d.ts +6 -4
- package/dist/contracts/handlers/index.js +4 -2
- package/dist/{delegate-xrSBNybC.d.ts → delegate-gGkUnYpi.d.cts} +1 -1
- package/dist/{delegate-f4_t864Z.d.cts → delegate-iyDum4fw.d.ts} +1 -1
- package/dist/{index-BJDz15ms.d.ts → index-BWwVnJhU.d.cts} +5 -270
- package/dist/{index-BjiVGtp8.d.cts → index-Bx-iArDs.d.ts} +5 -270
- package/dist/{index-DRwe0UDN.d.ts → index-DCml4QJn.d.ts} +1593 -1711
- package/dist/{index-DRwe0UDN.d.cts → index-DkyzIzKL.d.cts} +1593 -1711
- package/dist/index.cjs +457 -378
- package/dist/index.d.cts +633 -378
- package/dist/index.d.ts +633 -378
- package/dist/index.js +7 -4
- package/dist/{wallet-jVBDQl6R.d.cts → keyringDescriptorProvider-CS4w4PWd.d.ts} +412 -361
- package/dist/{wallet-Oc3Wd5gv.d.ts → keyringDescriptorProvider-CmHXrIXd.d.cts} +412 -361
- package/dist/program-BARSNg3X.d.ts +286 -0
- package/dist/program-znrWkxE4.d.cts +286 -0
- package/dist/repositories/realm/index.cjs +71 -51
- package/dist/repositories/realm/index.cjs.map +1 -1
- package/dist/repositories/realm/index.d.cts +20 -9
- package/dist/repositories/realm/index.d.ts +20 -9
- package/dist/repositories/realm/index.js +42 -23
- package/dist/repositories/realm/index.js.map +1 -1
- package/dist/repositories/sqlite/index.cjs +81 -56
- package/dist/repositories/sqlite/index.cjs.map +1 -1
- package/dist/repositories/sqlite/index.d.cts +17 -8
- package/dist/repositories/sqlite/index.d.ts +17 -8
- package/dist/repositories/sqlite/index.js +55 -31
- package/dist/repositories/sqlite/index.js.map +1 -1
- package/dist/{taskRunner-CDlNeth0.d.ts → taskRunner-DgMLSk_O.d.ts} +1 -1
- package/dist/{taskRunner-BPPU-YHG.d.cts → taskRunner-buh6aFpG.d.cts} +1 -1
- package/dist/wallet/expo/background.cjs +17 -14
- package/dist/wallet/expo/background.cjs.map +1 -1
- package/dist/wallet/expo/background.d.cts +5 -4
- package/dist/wallet/expo/background.d.ts +5 -4
- package/dist/wallet/expo/background.js +9 -6
- package/dist/wallet/expo/background.js.map +1 -1
- package/dist/wallet/expo/index.cjs +29 -16
- package/dist/wallet/expo/index.cjs.map +1 -1
- package/dist/wallet/expo/index.d.cts +12 -7
- package/dist/wallet/expo/index.d.ts +12 -7
- package/dist/wallet/expo/index.js +19 -6
- package/dist/wallet/expo/index.js.map +1 -1
- package/dist/worker/expo/index.cjs +12 -9
- package/dist/worker/expo/index.cjs.map +1 -1
- package/dist/worker/expo/index.d.cts +6 -5
- package/dist/worker/expo/index.d.ts +6 -5
- package/dist/worker/expo/index.js +8 -5
- package/dist/worker/expo/index.js.map +1 -1
- package/package.json +16 -1
- package/dist/chunk-6CUP6ZIF.js.map +0 -1
- package/dist/chunk-AG4TFD6F.js.map +0 -1
- package/dist/chunk-BTRCN4JJ.js.map +0 -1
- package/dist/chunk-DNITZVNG.cjs.map +0 -1
- package/dist/chunk-E6OOJEHL.cjs.map +0 -1
- package/dist/chunk-F3FAE7VJ.cjs.map +0 -1
- package/dist/chunk-GHUUT54D.cjs.map +0 -1
- package/dist/chunk-TUOLZBNC.js.map +0 -1
- package/dist/chunk-WXNSISXK.cjs.map +0 -1
- package/dist/chunk-ZJHLLDBP.js.map +0 -1
package/README.md
CHANGED
|
@@ -398,6 +398,68 @@ import { Ramps } from '@arkade-os/sdk'
|
|
|
398
398
|
const boardingTxId = await new Ramps(wallet).onboard();
|
|
399
399
|
```
|
|
400
400
|
|
|
401
|
+
### Onchain cosigning
|
|
402
|
+
|
|
403
|
+
Boarding UTXOs and server-supported unrolled virtual outputs can be spent immediately with a server cosignature, without waiting for the exit timelock or joining a batch. This needs an Arkade server that exposes onchain cosigning (`POST /v1/tx/onchain/cosign`) and accepts the selected coin type; automatic flows fall back to the previous paths on an unsupported endpoint or a definite server rejection.
|
|
404
|
+
|
|
405
|
+
```typescript
|
|
406
|
+
// Pay onchain from boarding / unrolled coins
|
|
407
|
+
const txid = await wallet.sendOnchain({
|
|
408
|
+
outputs: [{ address: 'bc1q...', amount: 50_000 }]
|
|
409
|
+
})
|
|
410
|
+
|
|
411
|
+
// Sweep every cosignable onchain coin (inputs minus fee) to one address
|
|
412
|
+
await wallet.sendOnchain({ outputs: [], sweepTo: 'bc1q...' })
|
|
413
|
+
|
|
414
|
+
// Cosign a PSBT built elsewhere; returns the broadcast txid
|
|
415
|
+
await wallet.cosignOnchainTx(psbt) // base64 string or Transaction
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
For `cosignOnchainTx`, foreign inputs must already be signed but not finalized: the wallet signs only its own inputs, and arkd refuses a finalized input and finalizes the transaction itself.
|
|
419
|
+
|
|
420
|
+
Preflight: a confirmed wallet input must be more than `onchainCosignMarginBlocks` (wallet config, default 6) blocks from exit maturity; an unconfirmed one is accepted, since its exit cannot have matured. arkd cosigns at most 64 inputs, so a sweep takes the 64 largest coins and leaves the rest for the next one. Failures surface as `OnchainCosignPreflightError` (nothing was submitted), `OnchainCosignRejectedError` (server refused; `arkErrorName` holds its error code) or `OnchainCosignUnsupportedError` (server lacks the endpoint). Use `isCosignFallback(e)` to decide whether paying another way is safe; the automatic paths below do exactly that:
|
|
421
|
+
|
|
422
|
+
```typescript
|
|
423
|
+
import { isCosignFallback, OnchainCosignAmbiguousError } from '@arkade-os/sdk'
|
|
424
|
+
|
|
425
|
+
try {
|
|
426
|
+
await wallet.sendOnchain({ outputs: [{ address, amount }] })
|
|
427
|
+
} catch (e) {
|
|
428
|
+
if (!isCosignFallback(e)) throw e // includes OnchainCosignAmbiguousError
|
|
429
|
+
await payThroughABatch()
|
|
430
|
+
}
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
`OnchainCosignAmbiguousError` means the transaction may have been broadcast (a transport failure, or a server error after submission): do not retry with other coins. The inputs stay pending until the chain resolves.
|
|
434
|
+
|
|
435
|
+
Contracts carry a `scope`: `"offchain"`, `"onchain"` or `"both"`. It controls whether the contract's onchain coins are watched and spent through cosigning; boarding contracts default to `"onchain"`.
|
|
436
|
+
|
|
437
|
+
Automatic behaviour:
|
|
438
|
+
|
|
439
|
+
- `VtxoManager` renews boarding coins that are near expiry via cosign, falling back to the CSV path. It never sweeps unrolled outputs (that would undo the exit); spend those with `sendOnchain` or `cosignOnchainTx`.
|
|
440
|
+
- `Ramps.offboardExact` and the payment router's onchain rail spend onchain coins directly when they alone cover the amount; otherwise they use the batch path. `Ramps.offboard` always uses the batch path.
|
|
441
|
+
|
|
442
|
+
#### Arkade contracts
|
|
443
|
+
|
|
444
|
+
Arkade contracts can spend their own onchain UTXOs. Pass an `emulator` (cosigner for covenant leaves) and an `onchain` provider to `connect`:
|
|
445
|
+
|
|
446
|
+
```typescript
|
|
447
|
+
import { arkade } from '@arkade-os/sdk'
|
|
448
|
+
|
|
449
|
+
const ark = await arkade.Arkade.connect({ arkade: arkProvider, emulator, onchain })
|
|
450
|
+
const contract = ark.contract(program)
|
|
451
|
+
|
|
452
|
+
const txid = await contract.functions
|
|
453
|
+
.claim(/* args */)
|
|
454
|
+
.from(utxo)
|
|
455
|
+
.to(destinationScript, 40_000n)
|
|
456
|
+
.onchainFee(500n) // must not exceed the surplus; without change() it must equal it
|
|
457
|
+
.change(changeScript)
|
|
458
|
+
.sendOnchain() // or .buildOnchain() for the unsigned Transaction
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
Covenant leaves spent onchain must not include the Arkade server key; the emulator's onchain endpoint refuses them.
|
|
462
|
+
|
|
401
463
|
### Checking Balance
|
|
402
464
|
|
|
403
465
|
```typescript
|
|
@@ -414,7 +476,7 @@ const balance = await wallet.getBalance()
|
|
|
414
476
|
| `preconfirmed` | Owned offchain funds not yet finalized in a batch. |
|
|
415
477
|
| `available` | What `send` and every other automatic coin selection can spend now. |
|
|
416
478
|
| `contractLocked` | Held by a contract that generic spending refuses (chiefly swap escrow); only that contract can spend it ([Contract Management](#contract-management)). |
|
|
417
|
-
| `pendingSettlement` | Committed to an in-flight
|
|
479
|
+
| `pendingSettlement` | Committed to an in-flight batch registration; back in `available` when the registration ends. Always `0` without `storage.intentRepository`. |
|
|
418
480
|
| `reserved` | Held by [`reserveVtxos`](#holding-vtxos-for-your-own-use) until released. |
|
|
419
481
|
| `recoverable` | Swept or subdust virtual outputs that [`recoverVtxos`](#recovery-reclaim-swept-vtxos) can reclaim; `getRecoverableBalance()` gives what a batch would return today. |
|
|
420
482
|
| `deprecatedSignerLocked` | Under an operator signer past its cutoff, which the operator no longer cosigns; recovers once swept and re-settled. |
|
|
@@ -804,8 +866,8 @@ const wallet = await Wallet.create({
|
|
|
804
866
|
identity: MnemonicIdentity.fromMnemonic('abandon abandon...'),
|
|
805
867
|
})
|
|
806
868
|
|
|
807
|
-
// Get fee information from the
|
|
808
|
-
const { fees: feeInfo } = await wallet.
|
|
869
|
+
// Get fee information from the operator
|
|
870
|
+
const { fees: feeInfo } = await wallet.getOperatorInfo();
|
|
809
871
|
|
|
810
872
|
const exitTxid = await new Ramps(wallet).offboard(
|
|
811
873
|
'bc1p...',
|
|
@@ -813,9 +875,9 @@ const exitTxid = await new Ramps(wallet).offboard(
|
|
|
813
875
|
);
|
|
814
876
|
```
|
|
815
877
|
|
|
816
|
-
`
|
|
817
|
-
service-worker and Expo wallets too. It answers with the
|
|
818
|
-
to the snapshot persisted at wallet construction when the
|
|
878
|
+
`getOperatorInfo()` is part of the `IReadonlyWallet` interface, so the same call works on the
|
|
879
|
+
service-worker and Expo wallets too. It answers with the operator's live `OperatorInfo`, falling back
|
|
880
|
+
to the snapshot persisted at wallet construction when the operator is unreachable.
|
|
819
881
|
|
|
820
882
|
### Concurrent Spending & Coin Reservations
|
|
821
883
|
|
|
@@ -884,12 +946,12 @@ If your app keeps its own reserved-outpoint set, call `reserveVtxos` where you a
|
|
|
884
946
|
|
|
885
947
|
### Talking to the operator through the wallet
|
|
886
948
|
|
|
887
|
-
`
|
|
888
|
-
|
|
949
|
+
`getOperatorInfo()` is one of three seams that let a plugin work from a wallet alone, never an
|
|
950
|
+
operator URL of its own:
|
|
889
951
|
|
|
890
952
|
| Seam | Interface | For |
|
|
891
953
|
| --- | --- | --- |
|
|
892
|
-
| `
|
|
954
|
+
| `getOperatorInfo()` | `IReadonlyWallet` | Network, signer key, delays, dust, fees, limits |
|
|
893
955
|
| `getArkadeReader()` | `IReadonlyWallet` | Chain reads for scripts the wallet does not own |
|
|
894
956
|
| `getArkadeBroadcaster()` | `IWallet` | `submitTx` / `finalizeTx` |
|
|
895
957
|
|
|
@@ -1137,7 +1199,7 @@ import {
|
|
|
1137
1199
|
WalletMessageHandler,
|
|
1138
1200
|
IndexedDBWalletRepository,
|
|
1139
1201
|
IndexedDBContractRepository,
|
|
1140
|
-
|
|
1202
|
+
IndexedDBBatchRegistrationRepository,
|
|
1141
1203
|
} from '@arkade-os/sdk'
|
|
1142
1204
|
|
|
1143
1205
|
const walletRepo = new IndexedDBWalletRepository()
|
|
@@ -1147,10 +1209,10 @@ const bus = new MessageBus(walletRepo, contractRepo, {
|
|
|
1147
1209
|
messageHandlers: [new WalletMessageHandler()],
|
|
1148
1210
|
tickIntervalMs: 10_000, // default 10s
|
|
1149
1211
|
// Optional, same opt-in as `storage.intentRepository` on a main-thread
|
|
1150
|
-
// wallet. Omit it and the worker persists no
|
|
1151
|
-
// none on restart, and counts
|
|
1212
|
+
// wallet. Omit it and the worker persists no batch registration, reconciles
|
|
1213
|
+
// none on restart, and counts registration-locked virtual outputs as available
|
|
1152
1214
|
// (`pendingSettlement` stays 0).
|
|
1153
|
-
intentRepository: new
|
|
1215
|
+
intentRepository: new IndexedDBBatchRegistrationRepository(),
|
|
1154
1216
|
})
|
|
1155
1217
|
|
|
1156
1218
|
bus.start()
|
|
@@ -1230,7 +1292,7 @@ SDK uses IndexedDB repositories with the default database name.
|
|
|
1230
1292
|
#### Paged repository reads
|
|
1231
1293
|
|
|
1232
1294
|
Collection repositories expose `getVtxosPage`, `getVtxosForScriptPage`, `getUtxosPage`,
|
|
1233
|
-
`getTransactionHistoryPage`, `getContractsPage`, and `
|
|
1295
|
+
`getTransactionHistoryPage`, `getContractsPage`, and `getBatchRegistrationsPage`.
|
|
1234
1296
|
Each accepts `{ limit, after? }` and returns
|
|
1235
1297
|
`{ items, nextCursor? }`; pass `nextCursor` as `after` until it is absent.
|
|
1236
1298
|
Limits must be 1–500. History pages are ordered by `(createdAt, transaction key)`;
|
|
@@ -1238,7 +1300,7 @@ Limits must be 1–500. History pages are ordered by `(createdAt, transaction ke
|
|
|
1238
1300
|
by their script and intent transaction ID. Filters must stay the same across
|
|
1239
1301
|
pages. Repository collection reads use pages directly; `collectVtxos`,
|
|
1240
1302
|
`collectScriptVtxos`, `collectUtxos`, `collectTransactionHistory`, `collectContracts`, and
|
|
1241
|
-
`
|
|
1303
|
+
`collectBatchRegistrations` traverse all pages when a complete snapshot is required.
|
|
1242
1304
|
Wallet spending paths consume every VTXO or UTXO page before coin selection.
|
|
1243
1305
|
In `@arkade-os/swap`, RFQ page `since` values use Unix seconds instead.
|
|
1244
1306
|
|
|
@@ -1256,7 +1318,7 @@ do {
|
|
|
1256
1318
|
|
|
1257
1319
|
#### Repository Versioning
|
|
1258
1320
|
|
|
1259
|
-
`WalletRepository`, `ContractRepository`, `
|
|
1321
|
+
`WalletRepository`, `ContractRepository`, `BatchRegistrationRepository`,
|
|
1260
1322
|
`VirtualTxRepository`, and `AssetSwapRepository` (in `@arkade-os/swap`) each
|
|
1261
1323
|
declare a `readonly version` field with a literal type. All built-in
|
|
1262
1324
|
implementations set this to the current version. If you maintain a custom
|
|
@@ -1508,7 +1570,7 @@ import { arkade, Arkade, ArkAddress } from '@arkade-os/sdk'
|
|
|
1508
1570
|
|
|
1509
1571
|
const program = arkade.programFromArtifact(artifactJson)
|
|
1510
1572
|
const client = await Arkade.connect({
|
|
1511
|
-
service: { network: 'bitcoin' }, // operator, indexer
|
|
1573
|
+
service: { network: 'bitcoin' }, // operator, indexer and esplora
|
|
1512
1574
|
identity: wallet.identity,
|
|
1513
1575
|
contractManager: await wallet.getContractManager(),
|
|
1514
1576
|
})
|
|
@@ -1532,6 +1594,30 @@ The connected operator supplies `<SERVER_KEY>` (the reserved `server` parameter
|
|
|
1532
1594
|
|
|
1533
1595
|
For compiler-derived programs, call arguments are covenant inputs in declaration order, followed by non-signature leaf inputs in declaration order, one argument per source parameter: a struct or array input is passed whole, as in `contract.functions.spend(request, oracles)`. Same-named inputs in the two scopes remain separate positional arguments. Leaf signatures are PSBT signatures, not condition arguments: `send()` supports the connected identity and infrastructure signers; additional identities and covenant-tweaked leaf keys require explicit PSBT signing via `build()`. Covenant signature arguments remain caller-provided; transaction-bound Arkade `checkSig` signatures require an Arkade-specific digest helper, which is deferred. CSV leaves require aged onchain outputs and cannot use this offchain builder. Typed call validation and these spending limits apply to every normalized Program. The public `SignerRef` union is unchanged; version 1 programs store emulator signer placement in optional `emulatorIndex` metadata.
|
|
1534
1596
|
|
|
1597
|
+
#### Compiling Arkade source
|
|
1598
|
+
|
|
1599
|
+
`@arkade-os/sdk/compiler` compiles Arkade source into the same Program, without a separate compile step. It needs the optional peer `@arkade-os/compiler`, which you install and pin yourself: `npm install --save-exact @arkade-os/compiler`. The root SDK never loads it. `files` maps relative `.ark` paths to their source, and imports resolve relative to the importing file.
|
|
1600
|
+
|
|
1601
|
+
```typescript
|
|
1602
|
+
import { compile, CompileError } from '@arkade-os/sdk/compiler'
|
|
1603
|
+
|
|
1604
|
+
try {
|
|
1605
|
+
const { program, diagnostics } = await compile({
|
|
1606
|
+
entry: 'contracts/vault.ark',
|
|
1607
|
+
files: { 'contracts/vault.ark': vaultSource, 'shared/limits.ark': limitsSource },
|
|
1608
|
+
})
|
|
1609
|
+
for (const d of diagnostics) console.warn(`${d.file}:${d.start?.line} ${d.message}`)
|
|
1610
|
+
const contract = client.contract(program, { owner, minimum: 1_000n })
|
|
1611
|
+
} catch (e) {
|
|
1612
|
+
if (e instanceof CompileError) for (const d of e.diagnostics) console.error(d.message)
|
|
1613
|
+
else throw e
|
|
1614
|
+
}
|
|
1615
|
+
```
|
|
1616
|
+
|
|
1617
|
+
Warnings come back in `diagnostics`, and source errors reject with `CompileError`. The result's `artifact` is the compiler's raw output, with the source bundle, compiler version and fingerprint. CommonJS callers can `require('@arkade-os/sdk/compiler')`, which loads the ESM-only compiler through `import()` on the first call. In a browser, the bundler must emit the compiler's WASM asset; see the `@arkade-os/compiler` README.
|
|
1618
|
+
|
|
1619
|
+
By default the result also carries `debug`, the compiler's debug file, and each covenant in `program` carries its `sourceMap`: the `asm` range of each statement, its line and column in the entry file, and its `require()` message when it has one. Pass `{ debug: false }` to leave both out. A file written by `arkadec --debug` attaches the same way through `arkade.programFromArtifact(artifact, debug)`, which refuses a file whose fingerprint does not match the artifact's. Source maps live in memory only: `stringifyArtifact` does not write them, so a restored contract has none.
|
|
1620
|
+
|
|
1535
1621
|
#### HD look-ahead window
|
|
1536
1622
|
|
|
1537
1623
|
HD wallets (`walletMode: 'hd'`, or an explicit HD `DescriptorProvider`) also watch a band of *unused* offchain receive scripts around their allocation watermark, so a payment to an address that some other party issued from the same seed — a merchant backend such as BTCPay Server, or the .NET SDK driving the same wallet — arrives without the user calling `restore()`. `lookAheadWindow` (default `20`) is the per-side width of that band: the wallet watches `[watermark - N, watermark + N]`. Speculative entries are subscription-only; they become contract rows, and enter balances, only once funded.
|
package/dist/adapters/expo.cjs
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
5
|
-
require('../chunk-
|
|
3
|
+
var chunkHQQ4NRXI_cjs = require('../chunk-HQQ4NRXI.cjs');
|
|
4
|
+
require('../chunk-XWUCNMPN.cjs');
|
|
5
|
+
require('../chunk-KCL5AVML.cjs');
|
|
6
|
+
require('../chunk-FLPWNMX3.cjs');
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
Object.defineProperty(exports, "ExpoArkProvider", {
|
|
10
11
|
enumerable: true,
|
|
11
|
-
get: function () { return
|
|
12
|
+
get: function () { return chunkHQQ4NRXI_cjs.ExpoArkProvider; }
|
|
12
13
|
});
|
|
13
14
|
Object.defineProperty(exports, "ExpoIndexerProvider", {
|
|
14
15
|
enumerable: true,
|
|
15
|
-
get: function () { return
|
|
16
|
+
get: function () { return chunkHQQ4NRXI_cjs.ExpoIndexerProvider; }
|
|
16
17
|
});
|
|
17
18
|
Object.defineProperty(exports, "ExpoOperatorProvider", {
|
|
18
19
|
enumerable: true,
|
|
19
|
-
get: function () { return
|
|
20
|
+
get: function () { return chunkHQQ4NRXI_cjs.ExpoOperatorProvider; }
|
|
20
21
|
});
|
|
21
22
|
//# sourceMappingURL=expo.cjs.map
|
|
22
23
|
//# sourceMappingURL=expo.cjs.map
|
package/dist/adapters/expo.d.cts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { s as RestOperatorProvider, o as SettlementEvent, T as TxNotificationEvent, t as RestIndexerProvider, u as SubscriptionEvent, v as SubscriptionHeartbeat } from '../index-DkyzIzKL.cjs';
|
|
2
|
+
export { w as ArkProvider, x as IndexerProvider, O as OperatorProvider } from '../index-DkyzIzKL.cjs';
|
|
3
3
|
import '@scure/btc-signer/utils.js';
|
|
4
|
-
import '@scure/btc-signer/psbt.js';
|
|
5
4
|
import '@scure/btc-signer';
|
|
5
|
+
import '@scure/btc-signer/psbt.js';
|
|
6
|
+
import '../base-C-Y5t_0F.cjs';
|
|
6
7
|
import '@scure/btc-signer/transaction.js';
|
|
7
8
|
|
|
8
9
|
/**
|
package/dist/adapters/expo.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { s as RestOperatorProvider, o as SettlementEvent, T as TxNotificationEvent, t as RestIndexerProvider, u as SubscriptionEvent, v as SubscriptionHeartbeat } from '../index-DCml4QJn.js';
|
|
2
|
+
export { w as ArkProvider, x as IndexerProvider, O as OperatorProvider } from '../index-DCml4QJn.js';
|
|
3
3
|
import '@scure/btc-signer/utils.js';
|
|
4
|
-
import '@scure/btc-signer/psbt.js';
|
|
5
4
|
import '@scure/btc-signer';
|
|
5
|
+
import '@scure/btc-signer/psbt.js';
|
|
6
|
+
import '../base-C-Y5t_0F.js';
|
|
6
7
|
import '@scure/btc-signer/transaction.js';
|
|
7
8
|
|
|
8
9
|
/**
|
package/dist/adapters/expo.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export { ExpoArkProvider, ExpoIndexerProvider, ExpoOperatorProvider } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
3
|
-
import '../chunk-
|
|
1
|
+
export { ExpoArkProvider, ExpoIndexerProvider, ExpoOperatorProvider } from '../chunk-CE46RS6L.js';
|
|
2
|
+
import '../chunk-7GIKLFHC.js';
|
|
3
|
+
import '../chunk-4I53THL6.js';
|
|
4
|
+
import '../chunk-FDJ734CH.js';
|
|
4
5
|
//# sourceMappingURL=expo.js.map
|
|
5
6
|
//# sourceMappingURL=expo.js.map
|
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
import { NETWORK } from '@scure/btc-signer';
|
|
2
|
+
import { PSBTOutput } from '@scure/btc-signer/psbt.js';
|
|
3
|
+
import { Bytes } from '@scure/btc-signer/utils.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* RelativeTimelock lets to create timelocked with CHECKSEQUENCEVERIFY script.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* const timelock = { value: 144n, type: "blocks" }; // 1 day in blocks
|
|
11
|
+
* const timelock = { value: 512n, type: "seconds" }; // 8 minutes in seconds
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
type RelativeTimelock = {
|
|
15
|
+
value: bigint;
|
|
16
|
+
type: "seconds" | "blocks";
|
|
17
|
+
};
|
|
18
|
+
declare enum TapscriptType {
|
|
19
|
+
Multisig = "multisig",
|
|
20
|
+
CSVMultisig = "csv-multisig",
|
|
21
|
+
ConditionCSVMultisig = "condition-csv-multisig",
|
|
22
|
+
ConditionMultisig = "condition-multisig",
|
|
23
|
+
CLTVMultisig = "cltv-multisig"
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* ArkTapscript is the base element of vtxo scripts.
|
|
27
|
+
* It is used to encode and decode the different types of vtxo scripts.
|
|
28
|
+
*/
|
|
29
|
+
interface ArkTapscript<T extends TapscriptType, Params> {
|
|
30
|
+
type: T;
|
|
31
|
+
params: Params;
|
|
32
|
+
script: Uint8Array;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* decodeTapscript is a function that decodes an Arkade tapscript from a raw script.
|
|
36
|
+
*
|
|
37
|
+
* @throws {Error} if the script is not a valid Arkade tapscript
|
|
38
|
+
* @example
|
|
39
|
+
* ```typescript
|
|
40
|
+
* const arkTapscript = decodeTapscript(new Uint8Array(32));
|
|
41
|
+
* console.log("type:", arkTapscript.type);
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
declare function decodeTapscript(script: Uint8Array): ArkTapscript<TapscriptType, any>;
|
|
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
|
+
declare namespace MultisigTapscript {
|
|
56
|
+
type Type = ArkTapscript<TapscriptType.Multisig, Params>;
|
|
57
|
+
enum MultisigType {
|
|
58
|
+
CHECKSIG = 0,
|
|
59
|
+
CHECKSIGADD = 1
|
|
60
|
+
}
|
|
61
|
+
type Params = {
|
|
62
|
+
pubkeys: Bytes[];
|
|
63
|
+
type?: MultisigType;
|
|
64
|
+
};
|
|
65
|
+
/** Encode a plain multisig tapscript. */
|
|
66
|
+
function encode(params: Params): Type;
|
|
67
|
+
/** Decode a plain multisig tapscript from raw script bytes. */
|
|
68
|
+
function decode(script: Uint8Array): Type;
|
|
69
|
+
/** Return true when the tapscript is a plain multisig tapscript. */
|
|
70
|
+
function is(tapscript: ArkTapscript<any, any>): tapscript is Type;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Implements a relative timelock script that requires all specified pubkeys to sign
|
|
74
|
+
* after the relative timelock has expired. The timelock can be specified in blocks or seconds.
|
|
75
|
+
*
|
|
76
|
+
* This is the standard exit closure and it is also used for the sweep closure in vtxo trees.
|
|
77
|
+
*
|
|
78
|
+
* <sequence> CHECKSEQUENCEVERIFY DROP <pubkey> CHECKSIG
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```typescript
|
|
82
|
+
* const csvMultisigTapscript = CSVMultisigTapscript.encode({ timelock: { type: "blocks", value: 144 }, pubkeys: [new Uint8Array(32), new Uint8Array(32)] });
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
declare namespace CSVMultisigTapscript {
|
|
86
|
+
type Type = ArkTapscript<TapscriptType.CSVMultisig, Params>;
|
|
87
|
+
type Params = {
|
|
88
|
+
timelock: RelativeTimelock;
|
|
89
|
+
} & MultisigTapscript.Params;
|
|
90
|
+
/** Encode a CSV multisig tapscript. */
|
|
91
|
+
function encode(params: Params): Type;
|
|
92
|
+
/** Decode a CSV multisig tapscript from raw script bytes. */
|
|
93
|
+
function decode(script: Uint8Array): Type;
|
|
94
|
+
/** Return true when the tapscript is a CSV multisig tapscript. */
|
|
95
|
+
function is(tapscript: ArkTapscript<any, any>): tapscript is Type;
|
|
96
|
+
function isScriptValid(script: Uint8Array): true | Error;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Combines a condition script with an exit closure. The resulting script requires
|
|
100
|
+
* the condition to be met, followed by the standard exit closure requirements
|
|
101
|
+
* (timelock and signatures).
|
|
102
|
+
*
|
|
103
|
+
* <conditionScript> VERIFY <sequence> CHECKSEQUENCEVERIFY DROP <pubkey> CHECKSIGVERIFY <pubkey> CHECKSIG
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* ```typescript
|
|
107
|
+
* const conditionCSVMultisigTapscript = ConditionCSVMultisigTapscript.encode({ conditionScript: new Uint8Array(32), pubkeys: [new Uint8Array(32), new Uint8Array(32)] });
|
|
108
|
+
* ```
|
|
109
|
+
*/
|
|
110
|
+
declare namespace ConditionCSVMultisigTapscript {
|
|
111
|
+
type Type = ArkTapscript<TapscriptType.ConditionCSVMultisig, Params>;
|
|
112
|
+
type Params = {
|
|
113
|
+
conditionScript: Bytes;
|
|
114
|
+
} & CSVMultisigTapscript.Params;
|
|
115
|
+
/** Encode a condition + CSV multisig tapscript. */
|
|
116
|
+
function encode(params: Params): Type;
|
|
117
|
+
/** Decode a condition + CSV multisig tapscript from raw script bytes. */
|
|
118
|
+
function decode(script: Uint8Array): Type;
|
|
119
|
+
/** Return true when the tapscript is a condition + CSV multisig tapscript. */
|
|
120
|
+
function is(tapscript: ArkTapscript<any, any>): tapscript is Type;
|
|
121
|
+
function isScriptValid(script: Uint8Array): true | Error;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Combines a condition script with a forfeit closure. The resulting script requires
|
|
125
|
+
* the condition to be met, followed by the standard forfeit closure requirements
|
|
126
|
+
* (multi-signature).
|
|
127
|
+
*
|
|
128
|
+
* <conditionScript> VERIFY <pubkey> CHECKSIGVERIFY <pubkey> CHECKSIG
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* ```typescript
|
|
132
|
+
* const conditionMultisigTapscript = ConditionMultisigTapscript.encode({ conditionScript: new Uint8Array(32), pubkeys: [new Uint8Array(32), new Uint8Array(32)] });
|
|
133
|
+
* ```
|
|
134
|
+
*/
|
|
135
|
+
declare namespace ConditionMultisigTapscript {
|
|
136
|
+
type Type = ArkTapscript<TapscriptType.ConditionMultisig, Params>;
|
|
137
|
+
type Params = {
|
|
138
|
+
conditionScript: Bytes;
|
|
139
|
+
} & MultisigTapscript.Params;
|
|
140
|
+
/** Encode a condition + multisig tapscript. */
|
|
141
|
+
function encode(params: Params): Type;
|
|
142
|
+
/** Decode a condition + multisig tapscript from raw script bytes. */
|
|
143
|
+
function decode(script: Uint8Array): Type;
|
|
144
|
+
/** Return true when the tapscript is a condition + multisig tapscript. */
|
|
145
|
+
function is(tapscript: ArkTapscript<any, any>): tapscript is Type;
|
|
146
|
+
function isScriptValid(script: Uint8Array): true | Error;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Implements an absolute timelock (CLTV) script combined with a forfeit closure.
|
|
150
|
+
* The script requires waiting until a specific block height/timestamp before the
|
|
151
|
+
* forfeit closure conditions can be met.
|
|
152
|
+
*
|
|
153
|
+
* <locktime> CHECKLOCKTIMEVERIFY DROP <pubkey> CHECKSIGVERIFY <pubkey> CHECKSIG
|
|
154
|
+
*
|
|
155
|
+
* @example
|
|
156
|
+
* ```typescript
|
|
157
|
+
* const cltvMultisigTapscript = CLTVMultisigTapscript.encode({ absoluteTimelock: 144, pubkeys: [new Uint8Array(32), new Uint8Array(32)] });
|
|
158
|
+
* ```
|
|
159
|
+
*/
|
|
160
|
+
declare namespace CLTVMultisigTapscript {
|
|
161
|
+
type Type = ArkTapscript<TapscriptType.CLTVMultisig, Params>;
|
|
162
|
+
type Params = {
|
|
163
|
+
absoluteTimelock: bigint;
|
|
164
|
+
} & MultisigTapscript.Params;
|
|
165
|
+
/** Encode a CLTV multisig tapscript. */
|
|
166
|
+
function encode(params: Params): Type;
|
|
167
|
+
/** Decode a CLTV multisig tapscript from raw script bytes. */
|
|
168
|
+
function decode(script: Uint8Array): Type;
|
|
169
|
+
/** Return true when the tapscript is a CLTV multisig tapscript. */
|
|
170
|
+
function is(tapscript: ArkTapscript<any, any>): tapscript is Type;
|
|
171
|
+
function isScriptValid(script: Uint8Array): true | Error;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* ArkAddress allows creating and decoding bech32m-encoded Arkade addresses: an hrp plus a
|
|
176
|
+
* 65-byte payload of version byte ‖ 32-byte server pubkey ‖ 32-byte VTXO taproot key.
|
|
177
|
+
*
|
|
178
|
+
* @remarks
|
|
179
|
+
* This is an Arkade-specific address format.
|
|
180
|
+
* It is distinct from the Taproot onchain address returned by `VtxoScript.onchainAddress`.
|
|
181
|
+
*
|
|
182
|
+
* @see VtxoScript
|
|
183
|
+
*
|
|
184
|
+
* @example
|
|
185
|
+
* ```typescript
|
|
186
|
+
* const address = new ArkAddress(
|
|
187
|
+
* new Uint8Array(32), // server public key
|
|
188
|
+
* new Uint8Array(32), // vtxo taproot public key
|
|
189
|
+
* "ark"
|
|
190
|
+
* );
|
|
191
|
+
*
|
|
192
|
+
* const encoded = address.encode();
|
|
193
|
+
* console.log("address: ", encoded);
|
|
194
|
+
*
|
|
195
|
+
* const decoded = ArkAddress.decode(encoded);
|
|
196
|
+
* ```
|
|
197
|
+
*/
|
|
198
|
+
declare class ArkAddress {
|
|
199
|
+
readonly serverPubKey: Bytes;
|
|
200
|
+
readonly vtxoTaprootKey: Bytes;
|
|
201
|
+
readonly hrp: string;
|
|
202
|
+
readonly version: number;
|
|
203
|
+
/**
|
|
204
|
+
* Create an Arkade address from its server public key, Taproot output key, and prefix.
|
|
205
|
+
*
|
|
206
|
+
* @param serverPubKey - 32-byte Arkade server public key
|
|
207
|
+
* @param vtxoTaprootKey - 32-byte Taproot output key (a.k.a. tweaked public key)
|
|
208
|
+
* @param hrp - Bech32 human-readable prefix
|
|
209
|
+
* @param version - Address version byte
|
|
210
|
+
* @defaultValue `version = 0`
|
|
211
|
+
* @throws Error if either public key is not 32 bytes long
|
|
212
|
+
*/
|
|
213
|
+
constructor(serverPubKey: Bytes, vtxoTaprootKey: Bytes, hrp?: string, version?: number);
|
|
214
|
+
/**
|
|
215
|
+
* Decode an Arkade address from its bech32m string form.
|
|
216
|
+
*
|
|
217
|
+
* @param address - Bech32m-encoded Arkade address
|
|
218
|
+
* @returns Decoded Arkade address
|
|
219
|
+
* @throws Error if the address is malformed or has an invalid payload length
|
|
220
|
+
* @see encode
|
|
221
|
+
*/
|
|
222
|
+
static decode(address: string): ArkAddress;
|
|
223
|
+
/**
|
|
224
|
+
* Encode the address to its bech32m string form.
|
|
225
|
+
*
|
|
226
|
+
* @returns Bech32m-encoded Arkade address
|
|
227
|
+
* @see decode
|
|
228
|
+
*/
|
|
229
|
+
encode(): string;
|
|
230
|
+
/** ScriptPubKey used to send non-dust funds to the address. */
|
|
231
|
+
get pkScript(): Bytes;
|
|
232
|
+
/** ScriptPubKey used to send sub-dust funds to the address. */
|
|
233
|
+
get subdustPkScript(): Bytes;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
type TapLeafScript = [
|
|
237
|
+
{
|
|
238
|
+
version: number;
|
|
239
|
+
internalKey: Bytes;
|
|
240
|
+
merklePath: Bytes[];
|
|
241
|
+
},
|
|
242
|
+
Bytes
|
|
243
|
+
];
|
|
244
|
+
declare const TapTreeCoder: (typeof PSBTOutput.tapTree)[2];
|
|
245
|
+
declare function scriptFromTapLeafScript(leaf: TapLeafScript): Bytes;
|
|
246
|
+
/**
|
|
247
|
+
* VtxoScript is a script that contains a list of tapleaf scripts.
|
|
248
|
+
* It is used to create virtual output scripts.
|
|
249
|
+
*
|
|
250
|
+
* @see ArkAddress
|
|
251
|
+
*
|
|
252
|
+
* @example
|
|
253
|
+
* ```typescript
|
|
254
|
+
* const vtxoScript = new VtxoScript([new Uint8Array(32), new Uint8Array(32)]);
|
|
255
|
+
* ```
|
|
256
|
+
*/
|
|
257
|
+
declare class VtxoScript {
|
|
258
|
+
readonly scripts: Bytes[];
|
|
259
|
+
readonly leaves: TapLeafScript[];
|
|
260
|
+
readonly tweakedPublicKey: Bytes;
|
|
261
|
+
readonly pkScript: Bytes;
|
|
262
|
+
/**
|
|
263
|
+
* Decode a virtual output script from an encoded TapTree.
|
|
264
|
+
*
|
|
265
|
+
* Leaves are normally read in construction order and their depths
|
|
266
|
+
* ignored: that covers the {@link encode} form (every depth 1) and the
|
|
267
|
+
* placeholder depths other writers use, such as arkd's. The exception is
|
|
268
|
+
* the BIP-371 form {@link toBIP371TapTree} writes, whose leaves are in the
|
|
269
|
+
* tree's DFS order: for some leaf counts (6, 7, 10, ...) that differs from
|
|
270
|
+
* construction order. A tree whose depths are exactly the shape
|
|
271
|
+
* `assembleBtcdTaprootTree` builds is that form, so its leaves are mapped
|
|
272
|
+
* back to construction order first. No construction-order writer produces
|
|
273
|
+
* that depth sequence when the two orders differ, so this never reorders
|
|
274
|
+
* a tree that decoded correctly before.
|
|
275
|
+
*
|
|
276
|
+
* Every leaf must carry the base tapscript version: the tree is rebuilt
|
|
277
|
+
* with {@link TAP_LEAF_VERSION} leaves, so any other version would
|
|
278
|
+
* silently derive a different taproot key.
|
|
279
|
+
*
|
|
280
|
+
* @param tapTree - Encoded TapTree bytes
|
|
281
|
+
* @returns Decoded virtual output script
|
|
282
|
+
* @throws Error if the TapTree cannot be decoded into a valid script set
|
|
283
|
+
* or a leaf carries a version other than {@link TAP_LEAF_VERSION}
|
|
284
|
+
* @see encode
|
|
285
|
+
*/
|
|
286
|
+
static decode(tapTree: Bytes): VtxoScript;
|
|
287
|
+
/**
|
|
288
|
+
* Create a virtual output script from its tapleaf scripts.
|
|
289
|
+
*
|
|
290
|
+
* The Taproot script tree is assembled using btcd's algorithm
|
|
291
|
+
* (`txscript.AssembleTaprootScriptTree`) so the derived taproot output
|
|
292
|
+
* key agrees with arkd for any leaf count. `@scure/btc-signer`'s
|
|
293
|
+
* default `taprootListToTree` is a Huffman builder that only agrees
|
|
294
|
+
* with arkd for power-of-2 leaf counts.
|
|
295
|
+
*
|
|
296
|
+
* @param scripts - Raw tapscript bytes for each leaf
|
|
297
|
+
* @throws Error if the provided leaves cannot produce a valid Taproot tree
|
|
298
|
+
*/
|
|
299
|
+
constructor(scripts: Bytes[]);
|
|
300
|
+
/**
|
|
301
|
+
* Encode the virtual output script to a TapTree byte representation.
|
|
302
|
+
*
|
|
303
|
+
* @returns Encoded TapTree bytes
|
|
304
|
+
* @see decode
|
|
305
|
+
*/
|
|
306
|
+
encode(): Bytes;
|
|
307
|
+
/**
|
|
308
|
+
* Build the Arkade address corresponding to this virtual output script.
|
|
309
|
+
*
|
|
310
|
+
* @param prefix - Bech32 human-readable prefix
|
|
311
|
+
* @param serverPubKey - 32-byte Arkade server public key
|
|
312
|
+
* @returns Arkade address for this script
|
|
313
|
+
* @see ArkAddress
|
|
314
|
+
*/
|
|
315
|
+
address(prefix: string | undefined, serverPubKey: Bytes): ArkAddress;
|
|
316
|
+
/**
|
|
317
|
+
* Build the Taproot onchain address corresponding to this virtual output script.
|
|
318
|
+
*
|
|
319
|
+
* @param network - Bitcoin network descriptor
|
|
320
|
+
* @returns Taproot onchain address
|
|
321
|
+
* @see address
|
|
322
|
+
*/
|
|
323
|
+
onchainAddress(network?: typeof NETWORK): string;
|
|
324
|
+
/**
|
|
325
|
+
* Look up a tapleaf script by its hex-encoded tapscript body.
|
|
326
|
+
*
|
|
327
|
+
* @param scriptHex - Hex-encoded tapscript body without the leaf version byte
|
|
328
|
+
* @returns Matching tapleaf script
|
|
329
|
+
* @throws Error if no matching leaf exists
|
|
330
|
+
*/
|
|
331
|
+
findLeaf(scriptHex: string): TapLeafScript;
|
|
332
|
+
/**
|
|
333
|
+
* Return all unilateral exit paths embedded in the virtual output script.
|
|
334
|
+
*
|
|
335
|
+
* @returns CSV-based exit paths found in the leaves
|
|
336
|
+
* @see getSequence
|
|
337
|
+
*/
|
|
338
|
+
exitPaths(): Array<CSVMultisigTapscript.Type | ConditionCSVMultisigTapscript.Type>;
|
|
339
|
+
}
|
|
340
|
+
type EncodedVtxoScript = {
|
|
341
|
+
tapTree: Bytes;
|
|
342
|
+
};
|
|
343
|
+
/**
|
|
344
|
+
* Extract the timelock value encoded in a timelocked tapleaf, if any.
|
|
345
|
+
*
|
|
346
|
+
* The return value is unit-ambiguous: for a CSV leaf it is a BIP-68
|
|
347
|
+
* nSequence (relative timelock); for a CLTV leaf it is an absolute
|
|
348
|
+
* nLockTime. Callers must know which leaf shape they are inspecting to
|
|
349
|
+
* interpret the number correctly, and must not copy a CSV result into
|
|
350
|
+
* `Transaction.lockTime` (or vice versa).
|
|
351
|
+
*
|
|
352
|
+
* @param tapLeafScript - Tapleaf script to inspect
|
|
353
|
+
* @returns The encoded timelock value, or `undefined` when neither a CSV
|
|
354
|
+
* nor CLTV path is present
|
|
355
|
+
* @see VtxoScript.exitPaths
|
|
356
|
+
*/
|
|
357
|
+
declare function getSequence(tapLeafScript: TapLeafScript): number | undefined;
|
|
358
|
+
|
|
359
|
+
export { ArkAddress as A, CSVMultisigTapscript as C, type EncodedVtxoScript as E, MultisigTapscript as M, type RelativeTimelock as R, type TapLeafScript as T, VtxoScript as V, type ArkTapscript as a, CLTVMultisigTapscript as b, ConditionCSVMultisigTapscript as c, ConditionMultisigTapscript as d, TapTreeCoder as e, TapscriptType as f, decodeTapscript as g, getSequence as h, scriptFromTapLeafScript as s };
|