@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
|
@@ -27,6 +27,18 @@ var Transaction = class extends Transaction$1 {
|
|
|
27
27
|
function withArkOpts(opts) {
|
|
28
28
|
return { ...Transaction.ARK_TX_OPTS, ...opts };
|
|
29
29
|
}
|
|
30
|
+
function formatSighash(type) {
|
|
31
|
+
return `0x${type.toString(16).padStart(2, "0")}`;
|
|
32
|
+
}
|
|
33
|
+
function assertAllowedSighashTypes(tx, allowedSighashTypes = [SigHash.DEFAULT]) {
|
|
34
|
+
for (let i = 0; i < tx.inputsLength; i++) {
|
|
35
|
+
const declared = tx.getInput(i).sighashType;
|
|
36
|
+
if (declared === void 0) continue;
|
|
37
|
+
if (!allowedSighashTypes.includes(declared)) {
|
|
38
|
+
throw new Error(`Unallowed sighash type ${formatSighash(declared)} for input ${i}.`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
30
42
|
function timelockToSequence(timelock) {
|
|
31
43
|
return bip68.encode(
|
|
32
44
|
timelock.type === "blocks" ? { blocks: Number(timelock.value) } : { seconds: Number(timelock.value) }
|
|
@@ -1010,7 +1022,7 @@ function resolveEventSource(override) {
|
|
|
1010
1022
|
}
|
|
1011
1023
|
|
|
1012
1024
|
// package.json
|
|
1013
|
-
var version = "0.4.
|
|
1025
|
+
var version = "0.4.68";
|
|
1014
1026
|
|
|
1015
1027
|
// src/utils/fetch.ts
|
|
1016
1028
|
var buildVersion = "0.9.9";
|
|
@@ -1327,6 +1339,9 @@ function prepareCoinAsIntentProofInput(coin) {
|
|
|
1327
1339
|
if (coin.extraWitness) {
|
|
1328
1340
|
unknown.push(ConditionWitness.encode(coin.extraWitness));
|
|
1329
1341
|
}
|
|
1342
|
+
if (coin.prevTx) {
|
|
1343
|
+
unknown.push(PrevArkTxField.encode(coin.prevTx));
|
|
1344
|
+
}
|
|
1330
1345
|
return {
|
|
1331
1346
|
txid: hex.decode(coin.txid),
|
|
1332
1347
|
index: coin.vout,
|
|
@@ -1605,17 +1620,17 @@ var RestArkProvider = class {
|
|
|
1605
1620
|
/** Overrides {@link configureEventSource} for this provider's streams. */
|
|
1606
1621
|
eventSource;
|
|
1607
1622
|
/**
|
|
1608
|
-
* Last server-info digest seen
|
|
1609
|
-
*
|
|
1610
|
-
* stale. Empty until the first {@link getInfo}.
|
|
1623
|
+
* Last server-info digest seen from {@link getInfo}. Sent as `X-Digest`
|
|
1624
|
+
* so arkd can reject stale client configuration.
|
|
1611
1625
|
*/
|
|
1612
1626
|
_digest = "";
|
|
1627
|
+
_hasServerInfo = false;
|
|
1628
|
+
_suppressNextGetInfoChangeEmit = false;
|
|
1613
1629
|
_serverInfoListeners = /* @__PURE__ */ new Set();
|
|
1614
1630
|
/**
|
|
1615
|
-
* Subscribe to server-info changes. Fired
|
|
1616
|
-
* `DIGEST_MISMATCH`
|
|
1617
|
-
*
|
|
1618
|
-
* an unsubscribe function.
|
|
1631
|
+
* Subscribe to server-info changes. Fired after a stale-info
|
|
1632
|
+
* `DIGEST_MISMATCH` refresh or when {@link getInfo} observes a changed digest.
|
|
1633
|
+
* Returns an unsubscribe function.
|
|
1619
1634
|
*/
|
|
1620
1635
|
onServerInfoChanged(listener) {
|
|
1621
1636
|
this._serverInfoListeners.add(listener);
|
|
@@ -1670,7 +1685,13 @@ var RestArkProvider = class {
|
|
|
1670
1685
|
if (!arkError) throwIfHttpUnavailable(response, "arkade");
|
|
1671
1686
|
if (!isArkError(arkError, ArkErrorName.DIGEST_MISMATCH)) return response;
|
|
1672
1687
|
this._digest = "";
|
|
1673
|
-
|
|
1688
|
+
this._suppressNextGetInfoChangeEmit = true;
|
|
1689
|
+
let info;
|
|
1690
|
+
try {
|
|
1691
|
+
info = await this.getInfo();
|
|
1692
|
+
} finally {
|
|
1693
|
+
this._suppressNextGetInfoChangeEmit = false;
|
|
1694
|
+
}
|
|
1674
1695
|
this.emitServerInfoChanged(info);
|
|
1675
1696
|
throw new DigestMismatchError(
|
|
1676
1697
|
"Arkade server reported a configuration digest mismatch; server info was refreshed. Rebuild and retry the request under the new server info."
|
|
@@ -1727,7 +1748,13 @@ var RestArkProvider = class {
|
|
|
1727
1748
|
vtxoMaxAmount: BigInt(fromServer.vtxoMaxAmount ?? -1),
|
|
1728
1749
|
vtxoMinAmount: BigInt(fromServer.vtxoMinAmount ?? 0)
|
|
1729
1750
|
};
|
|
1751
|
+
const previousDigest = this._digest;
|
|
1752
|
+
const hadServerInfo = this._hasServerInfo;
|
|
1730
1753
|
this._digest = info.digest;
|
|
1754
|
+
this._hasServerInfo = true;
|
|
1755
|
+
if (hadServerInfo && previousDigest !== info.digest && !this._suppressNextGetInfoChangeEmit) {
|
|
1756
|
+
this.emitServerInfoChanged(info);
|
|
1757
|
+
}
|
|
1731
1758
|
return info;
|
|
1732
1759
|
}
|
|
1733
1760
|
async submitTx(signedArkTx, checkpointTxs) {
|
|
@@ -2362,11 +2389,15 @@ function isPastExpiry(vtxo, now) {
|
|
|
2362
2389
|
}
|
|
2363
2390
|
function canSpendOffchain(vtxo, now) {
|
|
2364
2391
|
const n = normalizeVtxo(vtxo);
|
|
2365
|
-
return !hasTerminalSpend(n) && !(n.isSwept || isPastExpiry(n, now));
|
|
2392
|
+
return !hasTerminalSpend(n) && !n.isUnrolled && !(n.isSwept || isPastExpiry(n, now));
|
|
2366
2393
|
}
|
|
2367
2394
|
function canRecoverOnchain(vtxo, now) {
|
|
2368
2395
|
const n = normalizeVtxo(vtxo);
|
|
2369
|
-
return !hasTerminalSpend(n) && (n.isSwept || isPastExpiry(n, now));
|
|
2396
|
+
return !hasTerminalSpend(n) && !n.isUnrolled && (n.isSwept || isPastExpiry(n, now));
|
|
2397
|
+
}
|
|
2398
|
+
function canSweepOnchain(vtxo) {
|
|
2399
|
+
const n = normalizeVtxo(vtxo);
|
|
2400
|
+
return !hasTerminalSpend(n) && !!n.isUnrolled;
|
|
2370
2401
|
}
|
|
2371
2402
|
function toOffchainInputFeeParams(vtxo) {
|
|
2372
2403
|
const batchExpiry = toBatchExpiry(vtxo);
|
|
@@ -2393,6 +2424,6 @@ function isExpired(vtxo) {
|
|
|
2393
2424
|
return n.isSwept || n.expiresAt !== void 0 && n.expiresAt.getTime() <= Date.now();
|
|
2394
2425
|
}
|
|
2395
2426
|
|
|
2396
|
-
export { ArkAddress, ArkError, ArkErrorName, ArkPsbtFieldKey, ArkPsbtFieldKeyType, BITCOIN_EMULATOR_PUBKEY, CLTVMultisigTapscript, CSVMultisigTapscript, ConditionCSVMultisigTapscript, ConditionMultisigTapscript, ConditionWitness, CosignerPublicKey, DEFAULT_ARKADE_SERVER_URL, DEFAULT_NETWORK, DEFAULT_NETWORK_NAME, DEFAULT_PAGE_SIZE, DigestMismatchError, EventSourceUnavailableError, FetchError, Intent, MUTINYNET_EMULATOR_PUBKEY, MultisigTapscript, OP_RETURN_EMPTY_PKSCRIPT, PrevArkTxField, PrevoutTxField, ProviderUnavailableError, REGTEST_EMULATOR_PUBKEY, RestArkProvider, SCRIPT_QUERY_CHUNK_SIZE, ServerResponseMismatchError, SettlementEventType, TapTreeCoder, Transaction, VtxoScript, VtxoTaprootTree, VtxoTreeExpiry, assembleBtcdTaprootTree, baseFetch, buildVersion, canRecoverOnchain, canSpendOffchain, configureEventSource, convertVtxo, craftToSpendTx, decodeTapscript, defaultEmulatorPubkey, eventSourceIterator, fetch, fetchVtxoCreatedAtByTxid, getAllNormalizedVtxos, getArkPsbtFields, getConfiguredEventSource, getNetwork, getNormalizedVtxos, getSequence, hasTerminalSpend, isArkError, isEventSourceError, isEventSourceUnavailableError, isExpired, isFetchTimeoutError, isPastExpiry, isRecoverable, isRetryableProviderError, isSpendable, isVirtualCoin, maybeArkError, networks, normalizeVtxo, parseLegacyExpiry, rateGate, resolveEmulatorPubkey, resolveEventSource, resolveTimeHeight, scriptFromTapLeafScript, sdkVersion, sequenceToTimelock, setArkPsbtField, throwIfHttpUnavailable, timelockToSequence, toBatchExpiry, toOffchainInputFeeParams, toProviderUnavailable, toVirtualStatus };
|
|
2397
|
-
//# sourceMappingURL=chunk-
|
|
2398
|
-
//# sourceMappingURL=chunk-
|
|
2427
|
+
export { ArkAddress, ArkError, ArkErrorName, ArkPsbtFieldKey, ArkPsbtFieldKeyType, BITCOIN_EMULATOR_PUBKEY, CLTVMultisigTapscript, CSVMultisigTapscript, ConditionCSVMultisigTapscript, ConditionMultisigTapscript, ConditionWitness, CosignerPublicKey, DEFAULT_ARKADE_SERVER_URL, DEFAULT_NETWORK, DEFAULT_NETWORK_NAME, DEFAULT_PAGE_SIZE, DigestMismatchError, EventSourceUnavailableError, FetchError, Intent, MUTINYNET_EMULATOR_PUBKEY, MultisigTapscript, OP_RETURN_EMPTY_PKSCRIPT, PrevArkTxField, PrevoutTxField, ProviderUnavailableError, REGTEST_EMULATOR_PUBKEY, RestArkProvider, SCRIPT_QUERY_CHUNK_SIZE, ServerResponseMismatchError, SettlementEventType, TapTreeCoder, Transaction, VtxoScript, VtxoTaprootTree, VtxoTreeExpiry, assembleBtcdTaprootTree, assertAllowedSighashTypes, baseFetch, buildVersion, canRecoverOnchain, canSpendOffchain, canSweepOnchain, configureEventSource, convertVtxo, craftToSpendTx, decodeTapscript, defaultEmulatorPubkey, eventSourceIterator, fetch, fetchVtxoCreatedAtByTxid, formatSighash, getAllNormalizedVtxos, getArkPsbtFields, getConfiguredEventSource, getNetwork, getNormalizedVtxos, getSequence, hasTerminalSpend, isArkError, isEventSourceError, isEventSourceUnavailableError, isExpired, isFetchTimeoutError, isPastExpiry, isRecoverable, isRetryableProviderError, isSpendable, isVirtualCoin, maybeArkError, networks, normalizeVtxo, parseLegacyExpiry, rateGate, resolveEmulatorPubkey, resolveEventSource, resolveTimeHeight, scriptFromTapLeafScript, sdkVersion, sequenceToTimelock, setArkPsbtField, throwIfHttpUnavailable, timelockToSequence, toBatchExpiry, toOffchainInputFeeParams, toProviderUnavailable, toVirtualStatus };
|
|
2428
|
+
//# sourceMappingURL=chunk-4CMXV5SF.js.map
|
|
2429
|
+
//# sourceMappingURL=chunk-4CMXV5SF.js.map
|