@arkade-os/sdk 0.4.60 → 0.4.61
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/dist/adapters/expo.cjs +5 -5
- package/dist/adapters/expo.d.cts +4 -4
- package/dist/adapters/expo.d.ts +4 -4
- package/dist/adapters/expo.js +3 -3
- package/dist/adapters/indexedDB.cjs +5 -5
- package/dist/adapters/indexedDB.js +4 -4
- package/dist/{asyncStorageTaskQueue-CqijAAPG.d.cts → asyncStorageTaskQueue-BWDxp3Dr.d.cts} +2 -2
- package/dist/{asyncStorageTaskQueue-Vsp6uk8e.d.ts → asyncStorageTaskQueue-Cq9FpKv6.d.ts} +2 -2
- package/dist/{chunk-PRFL62ID.cjs → chunk-2JHN5RCY.cjs} +17 -17
- package/dist/{chunk-PRFL62ID.cjs.map → chunk-2JHN5RCY.cjs.map} +1 -1
- package/dist/{chunk-KNS5MTTI.cjs → chunk-3NUDA3MB.cjs} +1045 -461
- package/dist/chunk-3NUDA3MB.cjs.map +1 -0
- package/dist/{chunk-2DINXHGQ.js → chunk-6O5OLYTZ.js} +66 -35
- package/dist/chunk-6O5OLYTZ.js.map +1 -0
- package/dist/{chunk-Y54MUBT7.js → chunk-AUEXB42T.js} +654 -84
- package/dist/chunk-AUEXB42T.js.map +1 -0
- package/dist/{chunk-4A4GRSTB.cjs → chunk-FNCQJLR2.cjs} +3 -3
- package/dist/{chunk-4A4GRSTB.cjs.map → chunk-FNCQJLR2.cjs.map} +1 -1
- package/dist/{chunk-3Q7BBUWO.js → chunk-GDI2A65Z.js} +4 -4
- package/dist/{chunk-3Q7BBUWO.js.map → chunk-GDI2A65Z.js.map} +1 -1
- package/dist/{chunk-JBULXTCC.js → chunk-PVY6DMN5.js} +3 -3
- package/dist/{chunk-JBULXTCC.js.map → chunk-PVY6DMN5.js.map} +1 -1
- package/dist/{chunk-MZNLCMUP.cjs → chunk-SF5NKAUA.cjs} +113 -79
- package/dist/chunk-SF5NKAUA.cjs.map +1 -0
- package/dist/{chunk-H7JCHFM6.cjs → chunk-XFYFREPH.cjs} +17 -17
- package/dist/{chunk-H7JCHFM6.cjs.map → chunk-XFYFREPH.cjs.map} +1 -1
- package/dist/{chunk-B66RYHTB.js → chunk-XLHN5L2O.js} +4 -4
- package/dist/{chunk-B66RYHTB.js.map → chunk-XLHN5L2O.js.map} +1 -1
- package/dist/{chunk-2XLNQHG4.cjs → chunk-XMRB74HA.cjs} +10 -10
- package/dist/{chunk-2XLNQHG4.cjs.map → chunk-XMRB74HA.cjs.map} +1 -1
- package/dist/{chunk-FSKANUV4.js → chunk-YVQNHELA.js} +3 -3
- package/dist/{chunk-FSKANUV4.js.map → chunk-YVQNHELA.js.map} +1 -1
- package/dist/contracts/handlers/index.cjs +9 -9
- package/dist/contracts/handlers/index.d.cts +5 -5
- package/dist/contracts/handlers/index.d.ts +5 -5
- package/dist/contracts/handlers/index.js +2 -2
- package/dist/{delegate-DNEuM_nK.d.cts → delegate-BySzD37I.d.ts} +1 -1
- package/dist/{delegate-DidNTsKm.d.ts → delegate-C4Rl6h9l.d.cts} +1 -1
- package/dist/{ark-D2_yNhfz.d.cts → index-BcRCHnzN.d.cts} +4846 -4776
- package/dist/{ark-D2_yNhfz.d.ts → index-BcRCHnzN.d.ts} +4846 -4776
- package/dist/{index-DzQbNQUG.d.ts → index-Butfkm-K.d.cts} +102 -102
- package/dist/{index-BP8-zniX.d.cts → index-C29VNcxC.d.ts} +102 -102
- package/dist/index.cjs +320 -248
- package/dist/index.d.cts +256 -54
- package/dist/index.d.ts +256 -54
- package/dist/index.js +4 -4
- package/dist/repositories/realm/index.cjs +19 -19
- package/dist/repositories/realm/index.d.cts +4 -4
- package/dist/repositories/realm/index.d.ts +4 -4
- package/dist/repositories/realm/index.js +5 -5
- package/dist/repositories/sqlite/index.cjs +18 -18
- package/dist/repositories/sqlite/index.d.cts +4 -4
- package/dist/repositories/sqlite/index.d.ts +4 -4
- package/dist/repositories/sqlite/index.js +5 -5
- package/dist/{taskRunner-9gnlYEpb.d.ts → taskRunner-BTq3rMpI.d.cts} +2 -2
- package/dist/{taskRunner-BEQNFEa4.d.cts → taskRunner-DxMJYJ7Y.d.ts} +2 -2
- package/dist/wallet/expo/background.cjs +14 -14
- package/dist/wallet/expo/background.d.cts +5 -5
- package/dist/wallet/expo/background.d.ts +5 -5
- package/dist/wallet/expo/background.js +6 -6
- package/dist/wallet/expo/index.cjs +34 -14
- package/dist/wallet/expo/index.cjs.map +1 -1
- package/dist/wallet/expo/index.d.cts +12 -5
- package/dist/wallet/expo/index.d.ts +12 -5
- package/dist/wallet/expo/index.js +25 -5
- package/dist/wallet/expo/index.js.map +1 -1
- package/dist/{wallet-ipUA1XCp.d.cts → wallet-BVIfg2ic.d.ts} +79 -14
- package/dist/{wallet-C_MYHyOj.d.ts → wallet-DrSsUden.d.cts} +79 -14
- package/dist/worker/expo/index.cjs +9 -9
- package/dist/worker/expo/index.d.cts +6 -6
- package/dist/worker/expo/index.d.ts +6 -6
- package/dist/worker/expo/index.js +5 -5
- package/package.json +1 -1
- package/dist/chunk-2DINXHGQ.js.map +0 -1
- package/dist/chunk-KNS5MTTI.cjs.map +0 -1
- package/dist/chunk-MZNLCMUP.cjs.map +0 -1
- package/dist/chunk-Y54MUBT7.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { VtxoScript, MultisigTapscript, CSVMultisigTapscript, timelockToSequence, sequenceToTimelock, ConditionMultisigTapscript, CLTVMultisigTapscript, ConditionCSVMultisigTapscript, SCRIPT_QUERY_CHUNK_SIZE, getNormalizedVtxos, DEFAULT_PAGE_SIZE } from './chunk-
|
|
1
|
+
import { VtxoScript, MultisigTapscript, CSVMultisigTapscript, timelockToSequence, sequenceToTimelock, ConditionMultisigTapscript, CLTVMultisigTapscript, ConditionCSVMultisigTapscript, SCRIPT_QUERY_CHUNK_SIZE, getNormalizedVtxos, DEFAULT_PAGE_SIZE } from './chunk-PVY6DMN5.js';
|
|
2
2
|
import { __export } from './chunk-NSBPE2FW.js';
|
|
3
3
|
import { hex } from '@scure/base';
|
|
4
4
|
import { networks, expand } from '@bitcoinerlab/descriptors-scure';
|
|
@@ -210,6 +210,31 @@ function deriveDescriptorLeafCompressedPubKey(descriptor) {
|
|
|
210
210
|
}
|
|
211
211
|
return key.keyPath ? key.bip32.derivePath(key.keyPath.replace(/^\//, "")).publicKey : key.bip32.publicKey;
|
|
212
212
|
}
|
|
213
|
+
function parseHDDescriptor(descriptor) {
|
|
214
|
+
if (!isDescriptor(descriptor)) {
|
|
215
|
+
return null;
|
|
216
|
+
}
|
|
217
|
+
let expansion;
|
|
218
|
+
try {
|
|
219
|
+
const network = isMainnetDescriptor(descriptor) ? networks.bitcoin : networks.testnet;
|
|
220
|
+
expansion = expand({ descriptor, network });
|
|
221
|
+
} catch {
|
|
222
|
+
return null;
|
|
223
|
+
}
|
|
224
|
+
const key = expansion.expansionMap?.["@0"];
|
|
225
|
+
if (!key?.masterFingerprint || !key.originPath || !key.keyPath || !key.bip32) {
|
|
226
|
+
return null;
|
|
227
|
+
}
|
|
228
|
+
return {
|
|
229
|
+
fingerprint: hex.encode(key.masterFingerprint),
|
|
230
|
+
basePath: key.originPath.replace(/^\//, ""),
|
|
231
|
+
xpub: key.bip32.toBase58(),
|
|
232
|
+
derivationPath: key.keyPath.replace(/^\//, "")
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
async function identityDescriptor(identity) {
|
|
236
|
+
return normalizeToDescriptor(hex.encode(await identity.xOnlyPublicKey()));
|
|
237
|
+
}
|
|
213
238
|
|
|
214
239
|
// src/contracts/metadata.ts
|
|
215
240
|
var WALLET_RECEIVE_SOURCE = "wallet-receive";
|
|
@@ -1266,22 +1291,18 @@ var ArkadeScript = wrap({
|
|
|
1266
1291
|
w.byte(v);
|
|
1267
1292
|
continue;
|
|
1268
1293
|
} else if (typeof o === "number" || typeof o === "bigint") {
|
|
1269
|
-
if (o === 0 || o === 0n) {
|
|
1270
|
-
w.byte(0);
|
|
1271
|
-
continue;
|
|
1272
|
-
} else if (o >= 1 && o <= 16) {
|
|
1273
|
-
w.byte(OP.OP_1 - 1 + Number(o));
|
|
1274
|
-
continue;
|
|
1275
|
-
} else if (o === -1 || o === -1n) {
|
|
1276
|
-
w.byte(OP["1NEGATE"]);
|
|
1277
|
-
continue;
|
|
1278
|
-
}
|
|
1279
1294
|
const big = typeof o === "number" ? BigInt(o) : o;
|
|
1280
1295
|
o = encode(big);
|
|
1281
1296
|
}
|
|
1282
1297
|
if (!(o instanceof Uint8Array)) throw new Error(`Wrong Script OP=${o} (${typeof o})`);
|
|
1283
1298
|
const len = o.length;
|
|
1284
|
-
if (len
|
|
1299
|
+
if (len === 1 && o[0] >= 1 && o[0] <= 16) {
|
|
1300
|
+
w.byte(OP.OP_1 - 1 + o[0]);
|
|
1301
|
+
continue;
|
|
1302
|
+
} else if (len === 1 && o[0] === 129) {
|
|
1303
|
+
w.byte(OP["1NEGATE"]);
|
|
1304
|
+
continue;
|
|
1305
|
+
} else if (len < OP.PUSHDATA1) w.byte(len);
|
|
1285
1306
|
else if (len <= 255) {
|
|
1286
1307
|
w.byte(OP.PUSHDATA1);
|
|
1287
1308
|
w.byte(len);
|
|
@@ -1869,21 +1890,19 @@ var VHTLCContractHandler = {
|
|
|
1869
1890
|
* `refundWithoutReceiver` — `CLTV[sender, server]`, the sender's OWN
|
|
1870
1891
|
* refund, which the server rejects until `refundLocktime` matures. The
|
|
1871
1892
|
* reasons are that an escrowed lockup must not count toward the
|
|
1872
|
-
* `available` balance bucket
|
|
1873
|
-
*
|
|
1874
|
-
*
|
|
1875
|
-
*
|
|
1876
|
-
*
|
|
1877
|
-
*
|
|
1893
|
+
* `available` balance bucket, and that generic RENEWAL must not silently
|
|
1894
|
+
* execute a refund the caller never asked for — `runPeriodicSettle` selects
|
|
1895
|
+
* through `getSpendableVtxos`, which this gate filters, and it runs
|
|
1896
|
+
* unprompted whenever a wallet is built without an explicit
|
|
1897
|
+
* `settlementConfig`.
|
|
1898
|
+
*
|
|
1899
|
+
* **Inseparable from {@link deriveTapscripts}.** Deriving the leaf without
|
|
1900
|
+
* closing the gate hands generic renewal an escrow it had never been
|
|
1901
|
+
* offered before; before that method existed the answer here was
|
|
1902
|
+
* unobservable, so the two only ever made sense together.
|
|
1878
1903
|
*
|
|
1879
|
-
*
|
|
1880
|
-
*
|
|
1881
|
-
* reached this gate and the answer here was unobservable — the previous
|
|
1882
|
-
* `true` and the missing derivation were safe only by cancelling out.
|
|
1883
|
-
* Deriving the leaf without closing the gate would hand generic renewal an
|
|
1884
|
-
* escrow it had never been offered before. (The earlier `true` was
|
|
1885
|
-
* justified as preserving selection of in-flight swaps; no such selection
|
|
1886
|
-
* was ever reachable, for that same annotation reason.)
|
|
1904
|
+
* Recovery is filtered on {@link assertSpendableNow}, not on this: the gate
|
|
1905
|
+
* is permanent, and applying it there would strand a matured lockup.
|
|
1887
1906
|
*/
|
|
1888
1907
|
isGenericallySpendable: () => false,
|
|
1889
1908
|
/**
|
|
@@ -1911,7 +1930,12 @@ var VHTLCContractHandler = {
|
|
|
1911
1930
|
* on this leaf is only valid once `refundLocktime` has matured, so a
|
|
1912
1931
|
* recovery round that sweeps this VTXO early is rejected by the server.
|
|
1913
1932
|
* Nothing in this handler can enforce that, because the annotation is
|
|
1914
|
-
* derived per contract and knows no clock
|
|
1933
|
+
* derived per contract and knows no clock; `recoverVtxos` filters on
|
|
1934
|
+
* {@link assertSpendableNow} for it.
|
|
1935
|
+
*
|
|
1936
|
+
* **Role-blind.** A receiver's row gets the same leaf, which names keys that
|
|
1937
|
+
* wallet does not hold, so it is satisfiable only by the wallet holding the
|
|
1938
|
+
* lockup's `sender` key and fails at intent registration for anyone else.
|
|
1915
1939
|
*/
|
|
1916
1940
|
deriveTapscripts(script) {
|
|
1917
1941
|
const leaf = script.refundWithoutReceiver();
|
|
@@ -2157,10 +2181,12 @@ var VHTLCV2ContractHandler = {
|
|
|
2157
2181
|
* complete, or race a claim already in flight. The `vhtlc` handler now
|
|
2158
2182
|
* answers the same, for the same reason.
|
|
2159
2183
|
*
|
|
2160
|
-
*
|
|
2161
|
-
*
|
|
2162
|
-
*
|
|
2163
|
-
* refund
|
|
2184
|
+
* The gate covers `available` and renewal. Recovery is generic and names
|
|
2185
|
+
* nothing, so it is not covered here: `recoverVtxos` filters on
|
|
2186
|
+
* {@link assertSpendableNow} instead, which drops a lockup only while its
|
|
2187
|
+
* refund path is shut rather than forever. The explicit routes out —
|
|
2188
|
+
* `settle({ inputs })`, or `@arkade-os/swap`'s `pushRefundWithoutReceiver`
|
|
2189
|
+
* over `findLockupVtxos`' outpoints — are unaffected either way.
|
|
2164
2190
|
*/
|
|
2165
2191
|
isGenericallySpendable: () => false,
|
|
2166
2192
|
/**
|
|
@@ -2192,7 +2218,12 @@ var VHTLCV2ContractHandler = {
|
|
|
2192
2218
|
* round that sweeps this VTXO early is rejected by the server. That is the
|
|
2193
2219
|
* same constraint `packages/boltz-swap` encodes as "pre-CLTV recoverable →
|
|
2194
2220
|
* skipped"; nothing in this handler can enforce it, because the annotation
|
|
2195
|
-
* is derived per contract and knows no clock.
|
|
2221
|
+
* is derived per contract and knows no clock. `recoverVtxos` filters on
|
|
2222
|
+
* {@link assertSpendableNow} for it.
|
|
2223
|
+
*
|
|
2224
|
+
* **Role-blind.** A receiver's row gets the same leaf, which names keys that
|
|
2225
|
+
* wallet does not hold, so it is satisfiable only by the wallet holding the
|
|
2226
|
+
* lockup's `sender` key and fails at intent registration for anyone else.
|
|
2196
2227
|
*/
|
|
2197
2228
|
deriveTapscripts(script) {
|
|
2198
2229
|
const leaf = script.refundWithoutReceiver();
|
|
@@ -2763,6 +2794,6 @@ contractHandlers.register(VHTLCV2ContractHandler);
|
|
|
2763
2794
|
contractHandlers.register(BoardingContractHandler);
|
|
2764
2795
|
contractHandlers.register(ArkadeContractHandler);
|
|
2765
2796
|
|
|
2766
|
-
export { ARKADE_OP, ARKADE_OPCODES, ARKADE_OPCODE_NAMES, ARKADE_OPCODE_VALUES, ARKADE_OPS, ArkadeContractHandler, ArkadeProgramScript, ArkadeScript, BoardingContractHandler, DefaultContractHandler, DefaultVtxo, DelegateContractHandler, DelegateVtxo, OPCODE_NAMES, OPCODE_VALUES, SUPPORTED_PROGRAM_VERSION, VHTLC, VHTLCContractHandler, VHTLCV2ContractHandler, WALLET_RECEIVE_SOURCE, arkadeScriptHash, arkadeWitnessHash, asmToBytes, bignum_exports, bytesToASM, computeArkadeScriptPublicKey, contractHandlers, deriveDescriptorLeafCompressedPubKey, deriveDescriptorLeafPubKey, descriptorIsOurs, deserializeArkadeContractParams, fromASM, getOpcodeName, getOpcodeValue, inputName, isCltvSatisfied, isCsvSpendable, isMainnetDescriptor, parseArtifact, resolveAsm, serializeArkadeContractParams, speculativeReceiveMetadata, stringifyArtifact, toASM, validateProgram, witnessRefToBytes };
|
|
2767
|
-
//# sourceMappingURL=chunk-
|
|
2768
|
-
//# sourceMappingURL=chunk-
|
|
2797
|
+
export { ARKADE_OP, ARKADE_OPCODES, ARKADE_OPCODE_NAMES, ARKADE_OPCODE_VALUES, ARKADE_OPS, ArkadeContractHandler, ArkadeProgramScript, ArkadeScript, BoardingContractHandler, DefaultContractHandler, DefaultVtxo, DelegateContractHandler, DelegateVtxo, OPCODE_NAMES, OPCODE_VALUES, SUPPORTED_PROGRAM_VERSION, VHTLC, VHTLCContractHandler, VHTLCV2ContractHandler, WALLET_RECEIVE_SOURCE, arkadeScriptHash, arkadeWitnessHash, asmToBytes, bignum_exports, bytesToASM, computeArkadeScriptPublicKey, contractHandlers, deriveDescriptorLeafCompressedPubKey, deriveDescriptorLeafPubKey, descriptorIsOurs, deserializeArkadeContractParams, fromASM, getOpcodeName, getOpcodeValue, identityDescriptor, inputName, isCltvSatisfied, isCsvSpendable, isMainnetDescriptor, normalizeToDescriptor, parseArtifact, parseHDDescriptor, resolveAsm, serializeArkadeContractParams, speculativeReceiveMetadata, stringifyArtifact, toASM, validateProgram, witnessRefToBytes };
|
|
2798
|
+
//# sourceMappingURL=chunk-6O5OLYTZ.js.map
|
|
2799
|
+
//# sourceMappingURL=chunk-6O5OLYTZ.js.map
|