@arkade-os/sdk 0.4.66 → 0.4.68
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 +71 -15
- package/dist/adapters/expo.cjs +5 -5
- package/dist/adapters/expo.d.cts +2 -2
- package/dist/adapters/expo.d.ts +2 -2
- package/dist/adapters/expo.js +3 -3
- package/dist/adapters/indexedDB.cjs +5 -5
- package/dist/adapters/indexedDB.js +4 -4
- package/dist/{asyncStorageTaskQueue-BZcIN7sA.d.cts → asyncStorageTaskQueue-B2CcXIHU.d.cts} +1 -1
- package/dist/{asyncStorageTaskQueue-B6SijMi3.d.ts → asyncStorageTaskQueue-DaZlVTbM.d.ts} +1 -1
- package/dist/{chunk-2JZGPXU4.js → chunk-33Q2RFET.js} +3 -3
- package/dist/{chunk-2JZGPXU4.js.map → chunk-33Q2RFET.js.map} +1 -1
- package/dist/{chunk-CYOI4PEA.js → chunk-45FKMOJH.js} +160 -114
- package/dist/chunk-45FKMOJH.js.map +1 -0
- package/dist/{chunk-J33ZEM3A.js → chunk-4CMXV5SF.js} +45 -14
- package/dist/chunk-4CMXV5SF.js.map +1 -0
- package/dist/{chunk-LL47QIHD.cjs → chunk-4KCVS4ZN.cjs} +10 -10
- package/dist/{chunk-LL47QIHD.cjs.map → chunk-4KCVS4ZN.cjs.map} +1 -1
- package/dist/{chunk-PXPPZF5K.cjs → chunk-6YUACVX4.cjs} +205 -159
- package/dist/chunk-6YUACVX4.cjs.map +1 -0
- package/dist/{chunk-ZIRFXBKL.cjs → chunk-EJOFL5WH.cjs} +47 -13
- package/dist/chunk-EJOFL5WH.cjs.map +1 -0
- package/dist/{chunk-R5POS3RS.js → chunk-G4I6PU5H.js} +4 -4
- package/dist/{chunk-R5POS3RS.js.map → chunk-G4I6PU5H.js.map} +1 -1
- package/dist/{chunk-55ZZ6RBL.js → chunk-GQ4NMQGR.js} +4 -4
- package/dist/{chunk-55ZZ6RBL.js.map → chunk-GQ4NMQGR.js.map} +1 -1
- package/dist/{chunk-IM6IKNSL.cjs → chunk-JGMSZIE4.cjs} +17 -17
- package/dist/{chunk-IM6IKNSL.cjs.map → chunk-JGMSZIE4.cjs.map} +1 -1
- package/dist/{chunk-3S3JZUEN.cjs → chunk-PJR63FTK.cjs} +17 -17
- package/dist/{chunk-3S3JZUEN.cjs.map → chunk-PJR63FTK.cjs.map} +1 -1
- package/dist/{chunk-DSC3G6QZ.js → chunk-VBHXBI7F.js} +1060 -185
- package/dist/chunk-VBHXBI7F.js.map +1 -0
- package/dist/{chunk-5E6IZNRG.cjs → chunk-WCJVKFAP.cjs} +1467 -581
- package/dist/chunk-WCJVKFAP.cjs.map +1 -0
- package/dist/contracts/handlers/index.cjs +9 -9
- package/dist/contracts/handlers/index.d.cts +3 -3
- package/dist/contracts/handlers/index.d.ts +3 -3
- package/dist/contracts/handlers/index.js +2 -2
- package/dist/{delegate-T-vgxMYZ.d.ts → delegate-AomVWxO_.d.ts} +1 -1
- package/dist/{delegate-YXupcWWJ.d.cts → delegate-Bffc5f54.d.cts} +1 -1
- package/dist/{wallet-CNibc3yJ.d.ts → hdWalletCapable-B5nRs3RH.d.cts} +318 -127
- package/dist/{wallet-DJN1QgFt.d.cts → hdWalletCapable-DZdIVa23.d.ts} +318 -127
- package/dist/{index-uUE_uQPn.d.ts → index-C7RZCfoY.d.cts} +222 -19
- package/dist/{index-uUE_uQPn.d.cts → index-C7RZCfoY.d.ts} +222 -19
- package/dist/{index-e7LYXk1d.d.cts → index-jouvy8FD.d.ts} +172 -99
- package/dist/{index-D_FgwLH9.d.ts → index-nfyQM33h.d.cts} +172 -99
- package/dist/index.cjs +326 -278
- package/dist/index.d.cts +295 -41
- package/dist/index.d.ts +295 -41
- package/dist/index.js +4 -4
- package/dist/repositories/realm/index.cjs +19 -19
- package/dist/repositories/realm/index.d.cts +2 -2
- package/dist/repositories/realm/index.d.ts +2 -2
- package/dist/repositories/realm/index.js +5 -5
- package/dist/repositories/sqlite/index.cjs +18 -18
- package/dist/repositories/sqlite/index.d.cts +2 -2
- package/dist/repositories/sqlite/index.d.ts +2 -2
- package/dist/repositories/sqlite/index.js +5 -5
- package/dist/{taskRunner-BOVcIH1N.d.cts → taskRunner-D2vnpPBT.d.cts} +1 -1
- package/dist/{taskRunner-DNyD1kXG.d.ts → taskRunner-DuwK9t8O.d.ts} +1 -1
- package/dist/wallet/expo/background.cjs +14 -14
- package/dist/wallet/expo/background.d.cts +3 -3
- package/dist/wallet/expo/background.d.ts +3 -3
- package/dist/wallet/expo/background.js +6 -6
- package/dist/wallet/expo/index.cjs +18 -14
- package/dist/wallet/expo/index.cjs.map +1 -1
- package/dist/wallet/expo/index.d.cts +7 -5
- package/dist/wallet/expo/index.d.ts +7 -5
- package/dist/wallet/expo/index.js +10 -6
- package/dist/wallet/expo/index.js.map +1 -1
- package/dist/worker/expo/index.cjs +9 -9
- package/dist/worker/expo/index.d.cts +4 -4
- package/dist/worker/expo/index.d.ts +4 -4
- package/dist/worker/expo/index.js +5 -5
- package/package.json +3 -3
- package/dist/chunk-5E6IZNRG.cjs.map +0 -1
- package/dist/chunk-CYOI4PEA.js.map +0 -1
- package/dist/chunk-DSC3G6QZ.js.map +0 -1
- package/dist/chunk-J33ZEM3A.js.map +0 -1
- package/dist/chunk-PXPPZF5K.cjs.map +0 -1
- package/dist/chunk-ZIRFXBKL.cjs.map +0 -1
|
@@ -49,6 +49,18 @@ var Transaction = class extends btcSigner.Transaction {
|
|
|
49
49
|
function withArkOpts(opts) {
|
|
50
50
|
return { ...Transaction.ARK_TX_OPTS, ...opts };
|
|
51
51
|
}
|
|
52
|
+
function formatSighash(type) {
|
|
53
|
+
return `0x${type.toString(16).padStart(2, "0")}`;
|
|
54
|
+
}
|
|
55
|
+
function assertAllowedSighashTypes(tx, allowedSighashTypes = [btcSigner.SigHash.DEFAULT]) {
|
|
56
|
+
for (let i = 0; i < tx.inputsLength; i++) {
|
|
57
|
+
const declared = tx.getInput(i).sighashType;
|
|
58
|
+
if (declared === void 0) continue;
|
|
59
|
+
if (!allowedSighashTypes.includes(declared)) {
|
|
60
|
+
throw new Error(`Unallowed sighash type ${formatSighash(declared)} for input ${i}.`);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
52
64
|
function timelockToSequence(timelock) {
|
|
53
65
|
return bip68__namespace.encode(
|
|
54
66
|
timelock.type === "blocks" ? { blocks: Number(timelock.value) } : { seconds: Number(timelock.value) }
|
|
@@ -1032,7 +1044,7 @@ function resolveEventSource(override) {
|
|
|
1032
1044
|
}
|
|
1033
1045
|
|
|
1034
1046
|
// package.json
|
|
1035
|
-
var version = "0.4.
|
|
1047
|
+
var version = "0.4.68";
|
|
1036
1048
|
|
|
1037
1049
|
// src/utils/fetch.ts
|
|
1038
1050
|
var buildVersion = "0.9.9";
|
|
@@ -1349,6 +1361,9 @@ function prepareCoinAsIntentProofInput(coin) {
|
|
|
1349
1361
|
if (coin.extraWitness) {
|
|
1350
1362
|
unknown.push(ConditionWitness.encode(coin.extraWitness));
|
|
1351
1363
|
}
|
|
1364
|
+
if (coin.prevTx) {
|
|
1365
|
+
unknown.push(PrevArkTxField.encode(coin.prevTx));
|
|
1366
|
+
}
|
|
1352
1367
|
return {
|
|
1353
1368
|
txid: base.hex.decode(coin.txid),
|
|
1354
1369
|
index: coin.vout,
|
|
@@ -1627,17 +1642,17 @@ var RestArkProvider = class {
|
|
|
1627
1642
|
/** Overrides {@link configureEventSource} for this provider's streams. */
|
|
1628
1643
|
eventSource;
|
|
1629
1644
|
/**
|
|
1630
|
-
* Last server-info digest seen
|
|
1631
|
-
*
|
|
1632
|
-
* stale. Empty until the first {@link getInfo}.
|
|
1645
|
+
* Last server-info digest seen from {@link getInfo}. Sent as `X-Digest`
|
|
1646
|
+
* so arkd can reject stale client configuration.
|
|
1633
1647
|
*/
|
|
1634
1648
|
_digest = "";
|
|
1649
|
+
_hasServerInfo = false;
|
|
1650
|
+
_suppressNextGetInfoChangeEmit = false;
|
|
1635
1651
|
_serverInfoListeners = /* @__PURE__ */ new Set();
|
|
1636
1652
|
/**
|
|
1637
|
-
* Subscribe to server-info changes. Fired
|
|
1638
|
-
* `DIGEST_MISMATCH`
|
|
1639
|
-
*
|
|
1640
|
-
* an unsubscribe function.
|
|
1653
|
+
* Subscribe to server-info changes. Fired after a stale-info
|
|
1654
|
+
* `DIGEST_MISMATCH` refresh or when {@link getInfo} observes a changed digest.
|
|
1655
|
+
* Returns an unsubscribe function.
|
|
1641
1656
|
*/
|
|
1642
1657
|
onServerInfoChanged(listener) {
|
|
1643
1658
|
this._serverInfoListeners.add(listener);
|
|
@@ -1692,7 +1707,13 @@ var RestArkProvider = class {
|
|
|
1692
1707
|
if (!arkError) throwIfHttpUnavailable(response, "arkade");
|
|
1693
1708
|
if (!isArkError(arkError, ArkErrorName.DIGEST_MISMATCH)) return response;
|
|
1694
1709
|
this._digest = "";
|
|
1695
|
-
|
|
1710
|
+
this._suppressNextGetInfoChangeEmit = true;
|
|
1711
|
+
let info;
|
|
1712
|
+
try {
|
|
1713
|
+
info = await this.getInfo();
|
|
1714
|
+
} finally {
|
|
1715
|
+
this._suppressNextGetInfoChangeEmit = false;
|
|
1716
|
+
}
|
|
1696
1717
|
this.emitServerInfoChanged(info);
|
|
1697
1718
|
throw new DigestMismatchError(
|
|
1698
1719
|
"Arkade server reported a configuration digest mismatch; server info was refreshed. Rebuild and retry the request under the new server info."
|
|
@@ -1749,7 +1770,13 @@ var RestArkProvider = class {
|
|
|
1749
1770
|
vtxoMaxAmount: BigInt(fromServer.vtxoMaxAmount ?? -1),
|
|
1750
1771
|
vtxoMinAmount: BigInt(fromServer.vtxoMinAmount ?? 0)
|
|
1751
1772
|
};
|
|
1773
|
+
const previousDigest = this._digest;
|
|
1774
|
+
const hadServerInfo = this._hasServerInfo;
|
|
1752
1775
|
this._digest = info.digest;
|
|
1776
|
+
this._hasServerInfo = true;
|
|
1777
|
+
if (hadServerInfo && previousDigest !== info.digest && !this._suppressNextGetInfoChangeEmit) {
|
|
1778
|
+
this.emitServerInfoChanged(info);
|
|
1779
|
+
}
|
|
1753
1780
|
return info;
|
|
1754
1781
|
}
|
|
1755
1782
|
async submitTx(signedArkTx, checkpointTxs) {
|
|
@@ -2384,11 +2411,15 @@ function isPastExpiry(vtxo, now) {
|
|
|
2384
2411
|
}
|
|
2385
2412
|
function canSpendOffchain(vtxo, now) {
|
|
2386
2413
|
const n = normalizeVtxo(vtxo);
|
|
2387
|
-
return !hasTerminalSpend(n) && !(n.isSwept || isPastExpiry(n, now));
|
|
2414
|
+
return !hasTerminalSpend(n) && !n.isUnrolled && !(n.isSwept || isPastExpiry(n, now));
|
|
2388
2415
|
}
|
|
2389
2416
|
function canRecoverOnchain(vtxo, now) {
|
|
2390
2417
|
const n = normalizeVtxo(vtxo);
|
|
2391
|
-
return !hasTerminalSpend(n) && (n.isSwept || isPastExpiry(n, now));
|
|
2418
|
+
return !hasTerminalSpend(n) && !n.isUnrolled && (n.isSwept || isPastExpiry(n, now));
|
|
2419
|
+
}
|
|
2420
|
+
function canSweepOnchain(vtxo) {
|
|
2421
|
+
const n = normalizeVtxo(vtxo);
|
|
2422
|
+
return !hasTerminalSpend(n) && !!n.isUnrolled;
|
|
2392
2423
|
}
|
|
2393
2424
|
function toOffchainInputFeeParams(vtxo) {
|
|
2394
2425
|
const batchExpiry = toBatchExpiry(vtxo);
|
|
@@ -2446,10 +2477,12 @@ exports.VtxoScript = VtxoScript;
|
|
|
2446
2477
|
exports.VtxoTaprootTree = VtxoTaprootTree;
|
|
2447
2478
|
exports.VtxoTreeExpiry = VtxoTreeExpiry;
|
|
2448
2479
|
exports.assembleBtcdTaprootTree = assembleBtcdTaprootTree;
|
|
2480
|
+
exports.assertAllowedSighashTypes = assertAllowedSighashTypes;
|
|
2449
2481
|
exports.baseFetch = baseFetch;
|
|
2450
2482
|
exports.buildVersion = buildVersion;
|
|
2451
2483
|
exports.canRecoverOnchain = canRecoverOnchain;
|
|
2452
2484
|
exports.canSpendOffchain = canSpendOffchain;
|
|
2485
|
+
exports.canSweepOnchain = canSweepOnchain;
|
|
2453
2486
|
exports.configureEventSource = configureEventSource;
|
|
2454
2487
|
exports.convertVtxo = convertVtxo;
|
|
2455
2488
|
exports.craftToSpendTx = craftToSpendTx;
|
|
@@ -2458,6 +2491,7 @@ exports.defaultEmulatorPubkey = defaultEmulatorPubkey;
|
|
|
2458
2491
|
exports.eventSourceIterator = eventSourceIterator;
|
|
2459
2492
|
exports.fetch = fetch;
|
|
2460
2493
|
exports.fetchVtxoCreatedAtByTxid = fetchVtxoCreatedAtByTxid;
|
|
2494
|
+
exports.formatSighash = formatSighash;
|
|
2461
2495
|
exports.getAllNormalizedVtxos = getAllNormalizedVtxos;
|
|
2462
2496
|
exports.getArkPsbtFields = getArkPsbtFields;
|
|
2463
2497
|
exports.getConfiguredEventSource = getConfiguredEventSource;
|
|
@@ -2493,5 +2527,5 @@ exports.toBatchExpiry = toBatchExpiry;
|
|
|
2493
2527
|
exports.toOffchainInputFeeParams = toOffchainInputFeeParams;
|
|
2494
2528
|
exports.toProviderUnavailable = toProviderUnavailable;
|
|
2495
2529
|
exports.toVirtualStatus = toVirtualStatus;
|
|
2496
|
-
//# sourceMappingURL=chunk-
|
|
2497
|
-
//# sourceMappingURL=chunk-
|
|
2530
|
+
//# sourceMappingURL=chunk-EJOFL5WH.cjs.map
|
|
2531
|
+
//# sourceMappingURL=chunk-EJOFL5WH.cjs.map
|