@arkade-os/sdk 0.4.65 → 0.4.67
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 +66 -15
- package/dist/adapters/expo.cjs +5 -5
- package/dist/adapters/expo.d.cts +3 -6
- package/dist/adapters/expo.d.ts +3 -6
- package/dist/adapters/expo.js +3 -3
- package/dist/adapters/indexedDB.cjs +5 -5
- package/dist/adapters/indexedDB.js +4 -4
- package/dist/{asyncStorageTaskQueue-Chwe60Ce.d.cts → asyncStorageTaskQueue-LTpeXYaD.d.cts} +2 -2
- package/dist/{asyncStorageTaskQueue-Dq_UcvDx.d.ts → asyncStorageTaskQueue-Za-e_zMk.d.ts} +2 -2
- package/dist/{chunk-G552MISJ.cjs → chunk-2JV4VQ7C.cjs} +56 -28
- package/dist/chunk-2JV4VQ7C.cjs.map +1 -0
- package/dist/{chunk-TFSVXMTM.js → chunk-3WIWNE4P.js} +56 -29
- package/dist/chunk-3WIWNE4P.js.map +1 -0
- package/dist/{chunk-XMOIRDLF.js → chunk-6TAQF6EV.js} +118 -16
- package/dist/chunk-6TAQF6EV.js.map +1 -0
- package/dist/{chunk-5YTSQSLE.js → chunk-AEWJU6NZ.js} +1033 -193
- package/dist/chunk-AEWJU6NZ.js.map +1 -0
- package/dist/{chunk-XN55B6EP.cjs → chunk-CO3KKSWM.cjs} +46 -19
- package/dist/chunk-CO3KKSWM.cjs.map +1 -0
- package/dist/{chunk-RESN6QHP.js → chunk-EALWOVHK.js} +4 -4
- package/dist/{chunk-RESN6QHP.js.map → chunk-EALWOVHK.js.map} +1 -1
- package/dist/{chunk-GFZNEMGL.cjs → chunk-MJUTO3PY.cjs} +1425 -574
- package/dist/chunk-MJUTO3PY.cjs.map +1 -0
- package/dist/{chunk-TYTPVPKD.js → chunk-MZFUZUTQ.js} +4 -4
- package/dist/{chunk-TYTPVPKD.js.map → chunk-MZFUZUTQ.js.map} +1 -1
- package/dist/{chunk-BABJ77NG.cjs → chunk-OIZ2V2VD.cjs} +163 -60
- package/dist/chunk-OIZ2V2VD.cjs.map +1 -0
- package/dist/{chunk-SJQM5AVB.cjs → chunk-R2YAMONM.cjs} +17 -17
- package/dist/{chunk-SJQM5AVB.cjs.map → chunk-R2YAMONM.cjs.map} +1 -1
- package/dist/{chunk-3G5V564P.js → chunk-X3VEMUVV.js} +32 -6
- package/dist/chunk-X3VEMUVV.js.map +1 -0
- package/dist/{chunk-7X744EFF.cjs → chunk-YDRZDZPP.cjs} +10 -10
- package/dist/{chunk-7X744EFF.cjs.map → chunk-YDRZDZPP.cjs.map} +1 -1
- 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-BBQW61ym.d.cts → delegate-Bz2e2zXY.d.cts} +1 -1
- package/dist/{delegate-Dv_9OVHv.d.ts → delegate-cdmzb2f9.d.ts} +1 -1
- package/dist/{wallet-DJUnN939.d.ts → hdWalletCapable-BSjuUYOO.d.cts} +319 -128
- package/dist/{wallet-C2NvHjWB.d.cts → hdWalletCapable-Hi12xjCJ.d.ts} +319 -128
- package/dist/{index-fDDiA1-L.d.ts → index-BiACuWaf.d.ts} +109 -13
- package/dist/{index-BtTtQFUX.d.cts → index-D2GjZxBr.d.cts} +109 -13
- package/dist/{index-CFOMyVMt.d.cts → index-DU5o_hz7.d.cts} +275 -51
- package/dist/{index-CFOMyVMt.d.ts → index-DU5o_hz7.d.ts} +275 -51
- package/dist/index.cjs +328 -276
- package/dist/index.d.cts +312 -41
- package/dist/index.d.ts +312 -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-CIKOS2OO.d.cts → taskRunner-BZJMLQ6g.d.cts} +2 -2
- package/dist/{taskRunner-BDzWbpct.d.ts → taskRunner-DATaRQus.d.ts} +2 -2
- 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-3G5V564P.js.map +0 -1
- package/dist/chunk-5YTSQSLE.js.map +0 -1
- package/dist/chunk-BABJ77NG.cjs.map +0 -1
- package/dist/chunk-G552MISJ.cjs.map +0 -1
- package/dist/chunk-GFZNEMGL.cjs.map +0 -1
- package/dist/chunk-TFSVXMTM.js.map +0 -1
- package/dist/chunk-XMOIRDLF.js.map +0 -1
- package/dist/chunk-XN55B6EP.cjs.map +0 -1
|
@@ -1010,7 +1010,7 @@ function resolveEventSource(override) {
|
|
|
1010
1010
|
}
|
|
1011
1011
|
|
|
1012
1012
|
// package.json
|
|
1013
|
-
var version = "0.4.
|
|
1013
|
+
var version = "0.4.67";
|
|
1014
1014
|
|
|
1015
1015
|
// src/utils/fetch.ts
|
|
1016
1016
|
var buildVersion = "0.9.9";
|
|
@@ -1327,6 +1327,9 @@ function prepareCoinAsIntentProofInput(coin) {
|
|
|
1327
1327
|
if (coin.extraWitness) {
|
|
1328
1328
|
unknown.push(ConditionWitness.encode(coin.extraWitness));
|
|
1329
1329
|
}
|
|
1330
|
+
if (coin.prevTx) {
|
|
1331
|
+
unknown.push(PrevArkTxField.encode(coin.prevTx));
|
|
1332
|
+
}
|
|
1330
1333
|
return {
|
|
1331
1334
|
txid: hex.decode(coin.txid),
|
|
1332
1335
|
index: coin.vout,
|
|
@@ -1591,6 +1594,11 @@ var SettlementEventType = /* @__PURE__ */ ((SettlementEventType2) => {
|
|
|
1591
1594
|
SettlementEventType2["StreamStarted"] = "stream_started";
|
|
1592
1595
|
return SettlementEventType2;
|
|
1593
1596
|
})(SettlementEventType || {});
|
|
1597
|
+
function advertisedLimit(fromServer) {
|
|
1598
|
+
if (fromServer == null) return void 0;
|
|
1599
|
+
const limit = BigInt(fromServer);
|
|
1600
|
+
return limit > 0n ? limit : void 0;
|
|
1601
|
+
}
|
|
1594
1602
|
var RestArkProvider = class {
|
|
1595
1603
|
constructor(serverUrl = DEFAULT_ARKADE_SERVER_URL, options = {}) {
|
|
1596
1604
|
this.serverUrl = serverUrl;
|
|
@@ -1600,17 +1608,17 @@ var RestArkProvider = class {
|
|
|
1600
1608
|
/** Overrides {@link configureEventSource} for this provider's streams. */
|
|
1601
1609
|
eventSource;
|
|
1602
1610
|
/**
|
|
1603
|
-
* Last server-info digest seen
|
|
1604
|
-
*
|
|
1605
|
-
* stale. Empty until the first {@link getInfo}.
|
|
1611
|
+
* Last server-info digest seen from {@link getInfo}. Sent as `X-Digest`
|
|
1612
|
+
* so arkd can reject stale client configuration.
|
|
1606
1613
|
*/
|
|
1607
1614
|
_digest = "";
|
|
1615
|
+
_hasServerInfo = false;
|
|
1616
|
+
_suppressNextGetInfoChangeEmit = false;
|
|
1608
1617
|
_serverInfoListeners = /* @__PURE__ */ new Set();
|
|
1609
1618
|
/**
|
|
1610
|
-
* Subscribe to server-info changes. Fired
|
|
1611
|
-
* `DIGEST_MISMATCH`
|
|
1612
|
-
*
|
|
1613
|
-
* an unsubscribe function.
|
|
1619
|
+
* Subscribe to server-info changes. Fired after a stale-info
|
|
1620
|
+
* `DIGEST_MISMATCH` refresh or when {@link getInfo} observes a changed digest.
|
|
1621
|
+
* Returns an unsubscribe function.
|
|
1614
1622
|
*/
|
|
1615
1623
|
onServerInfoChanged(listener) {
|
|
1616
1624
|
this._serverInfoListeners.add(listener);
|
|
@@ -1665,7 +1673,13 @@ var RestArkProvider = class {
|
|
|
1665
1673
|
if (!arkError) throwIfHttpUnavailable(response, "arkade");
|
|
1666
1674
|
if (!isArkError(arkError, ArkErrorName.DIGEST_MISMATCH)) return response;
|
|
1667
1675
|
this._digest = "";
|
|
1668
|
-
|
|
1676
|
+
this._suppressNextGetInfoChangeEmit = true;
|
|
1677
|
+
let info;
|
|
1678
|
+
try {
|
|
1679
|
+
info = await this.getInfo();
|
|
1680
|
+
} finally {
|
|
1681
|
+
this._suppressNextGetInfoChangeEmit = false;
|
|
1682
|
+
}
|
|
1669
1683
|
this.emitServerInfoChanged(info);
|
|
1670
1684
|
throw new DigestMismatchError(
|
|
1671
1685
|
"Arkade server reported a configuration digest mismatch; server info was refreshed. Rebuild and retry the request under the new server info."
|
|
@@ -1714,13 +1728,21 @@ var RestArkProvider = class {
|
|
|
1714
1728
|
signerPubkey: fromServer.signerPubkey ?? "",
|
|
1715
1729
|
unilateralExitDelay: BigInt(fromServer.unilateralExitDelay ?? 0),
|
|
1716
1730
|
vtxoTreeExpiry: fromServer.vtxoTreeExpiry != null ? BigInt(fromServer.vtxoTreeExpiry) : void 0,
|
|
1731
|
+
maxTxWeight: advertisedLimit(fromServer.maxTxWeight),
|
|
1732
|
+
maxOpReturnOutputs: advertisedLimit(fromServer.maxOpReturnOutputs),
|
|
1717
1733
|
utxoMaxAmount: BigInt(fromServer.utxoMaxAmount ?? -1),
|
|
1718
1734
|
utxoMinAmount: BigInt(fromServer.utxoMinAmount ?? 0),
|
|
1719
1735
|
version: fromServer.version ?? "",
|
|
1720
1736
|
vtxoMaxAmount: BigInt(fromServer.vtxoMaxAmount ?? -1),
|
|
1721
1737
|
vtxoMinAmount: BigInt(fromServer.vtxoMinAmount ?? 0)
|
|
1722
1738
|
};
|
|
1739
|
+
const previousDigest = this._digest;
|
|
1740
|
+
const hadServerInfo = this._hasServerInfo;
|
|
1723
1741
|
this._digest = info.digest;
|
|
1742
|
+
this._hasServerInfo = true;
|
|
1743
|
+
if (hadServerInfo && previousDigest !== info.digest && !this._suppressNextGetInfoChangeEmit) {
|
|
1744
|
+
this.emitServerInfoChanged(info);
|
|
1745
|
+
}
|
|
1724
1746
|
return info;
|
|
1725
1747
|
}
|
|
1726
1748
|
async submitTx(signedArkTx, checkpointTxs) {
|
|
@@ -2105,24 +2127,16 @@ var RestArkProvider = class {
|
|
|
2105
2127
|
}
|
|
2106
2128
|
parseTransactionNotification(data) {
|
|
2107
2129
|
if (data.commitmentTx) {
|
|
2108
|
-
return {
|
|
2109
|
-
commitmentTx: {
|
|
2110
|
-
txid: data.commitmentTx.txid,
|
|
2111
|
-
tx: data.commitmentTx.tx,
|
|
2112
|
-
spentVtxos: data.commitmentTx.spentVtxos.map(mapVtxo),
|
|
2113
|
-
spendableVtxos: data.commitmentTx.spendableVtxos.map(mapVtxo),
|
|
2114
|
-
checkpointTxs: data.commitmentTx.checkpointTxs
|
|
2115
|
-
}
|
|
2116
|
-
};
|
|
2130
|
+
return { commitmentTx: mapTxNotification(data.commitmentTx) };
|
|
2117
2131
|
}
|
|
2118
2132
|
if (data.arkTx) {
|
|
2133
|
+
return { arkTx: mapTxNotification(data.arkTx) };
|
|
2134
|
+
}
|
|
2135
|
+
if (data.sweepTx) {
|
|
2119
2136
|
return {
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
spentVtxos: data.arkTx.spentVtxos.map(mapVtxo),
|
|
2124
|
-
spendableVtxos: data.arkTx.spendableVtxos.map(mapVtxo),
|
|
2125
|
-
checkpointTxs: data.arkTx.checkpointTxs
|
|
2137
|
+
sweepTx: {
|
|
2138
|
+
...mapTxNotification(data.sweepTx),
|
|
2139
|
+
sweptVtxos: data.sweepTx.sweptVtxos ?? []
|
|
2126
2140
|
}
|
|
2127
2141
|
};
|
|
2128
2142
|
}
|
|
@@ -2165,6 +2179,15 @@ function isFetchTimeoutError(err) {
|
|
|
2165
2179
|
};
|
|
2166
2180
|
return checkError(err) || checkError(err.cause);
|
|
2167
2181
|
}
|
|
2182
|
+
function mapTxNotification(data) {
|
|
2183
|
+
return {
|
|
2184
|
+
txid: data.txid,
|
|
2185
|
+
tx: data.tx,
|
|
2186
|
+
spentVtxos: data.spentVtxos.map(mapVtxo),
|
|
2187
|
+
spendableVtxos: data.spendableVtxos.map(mapVtxo),
|
|
2188
|
+
checkpointTxs: data.checkpointTxs
|
|
2189
|
+
};
|
|
2190
|
+
}
|
|
2168
2191
|
function mapVtxo(vtxo) {
|
|
2169
2192
|
return {
|
|
2170
2193
|
outpoint: {
|
|
@@ -2354,11 +2377,15 @@ function isPastExpiry(vtxo, now) {
|
|
|
2354
2377
|
}
|
|
2355
2378
|
function canSpendOffchain(vtxo, now) {
|
|
2356
2379
|
const n = normalizeVtxo(vtxo);
|
|
2357
|
-
return !hasTerminalSpend(n) && !(n.isSwept || isPastExpiry(n, now));
|
|
2380
|
+
return !hasTerminalSpend(n) && !n.isUnrolled && !(n.isSwept || isPastExpiry(n, now));
|
|
2358
2381
|
}
|
|
2359
2382
|
function canRecoverOnchain(vtxo, now) {
|
|
2360
2383
|
const n = normalizeVtxo(vtxo);
|
|
2361
|
-
return !hasTerminalSpend(n) && (n.isSwept || isPastExpiry(n, now));
|
|
2384
|
+
return !hasTerminalSpend(n) && !n.isUnrolled && (n.isSwept || isPastExpiry(n, now));
|
|
2385
|
+
}
|
|
2386
|
+
function canSweepOnchain(vtxo) {
|
|
2387
|
+
const n = normalizeVtxo(vtxo);
|
|
2388
|
+
return !hasTerminalSpend(n) && !!n.isUnrolled;
|
|
2362
2389
|
}
|
|
2363
2390
|
function toOffchainInputFeeParams(vtxo) {
|
|
2364
2391
|
const batchExpiry = toBatchExpiry(vtxo);
|
|
@@ -2385,6 +2412,6 @@ function isExpired(vtxo) {
|
|
|
2385
2412
|
return n.isSwept || n.expiresAt !== void 0 && n.expiresAt.getTime() <= Date.now();
|
|
2386
2413
|
}
|
|
2387
2414
|
|
|
2388
|
-
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 };
|
|
2389
|
-
//# sourceMappingURL=chunk-
|
|
2390
|
-
//# sourceMappingURL=chunk-
|
|
2415
|
+
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, canSweepOnchain, 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 };
|
|
2416
|
+
//# sourceMappingURL=chunk-3WIWNE4P.js.map
|
|
2417
|
+
//# sourceMappingURL=chunk-3WIWNE4P.js.map
|