@arkade-os/sdk 0.4.76 → 0.4.77
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 +2 -2
- package/dist/adapters/expo.d.ts +2 -2
- package/dist/adapters/expo.js +3 -3
- package/dist/adapters/indexedDB.cjs +3 -5
- package/dist/adapters/indexedDB.cjs.map +1 -1
- package/dist/adapters/indexedDB.d.cts +1 -1
- package/dist/adapters/indexedDB.d.ts +1 -1
- package/dist/adapters/indexedDB.js +3 -5
- package/dist/adapters/indexedDB.js.map +1 -1
- package/dist/{asyncStorageTaskQueue-DrKbfleJ.d.ts → asyncStorageTaskQueue-DTl0WM7E.d.ts} +1 -1
- package/dist/{asyncStorageTaskQueue-D7BU-BdP.d.cts → asyncStorageTaskQueue-MmJyAnu-.d.cts} +1 -1
- package/dist/{chunk-2KFXM3N5.cjs → chunk-4LP6XOMW.cjs} +17 -17
- package/dist/{chunk-2KFXM3N5.cjs.map → chunk-4LP6XOMW.cjs.map} +1 -1
- package/dist/{chunk-F6YOCYWU.js → chunk-52OA3UIC.js} +25 -12
- package/dist/chunk-52OA3UIC.js.map +1 -0
- package/dist/{chunk-7UJLIZQU.js → chunk-ACPANSOX.js} +43 -11
- package/dist/chunk-ACPANSOX.js.map +1 -0
- package/dist/{chunk-P53OHGXY.cjs → chunk-CJN4CUEU.cjs} +25 -11
- package/dist/chunk-CJN4CUEU.cjs.map +1 -0
- package/dist/{chunk-T327OEMV.cjs → chunk-H62OOAS4.cjs} +17 -17
- package/dist/{chunk-T327OEMV.cjs.map → chunk-H62OOAS4.cjs.map} +1 -1
- package/dist/{chunk-54W6QBXL.js → chunk-HKOFYHZP.js} +3 -3
- package/dist/{chunk-54W6QBXL.js.map → chunk-HKOFYHZP.js.map} +1 -1
- package/dist/{chunk-CQNX4BTA.cjs → chunk-LUWSY2QO.cjs} +89 -57
- package/dist/chunk-LUWSY2QO.cjs.map +1 -0
- package/dist/{chunk-WMHELOHH.js → chunk-MLOZHTBN.js} +523 -104
- package/dist/chunk-MLOZHTBN.js.map +1 -0
- package/dist/{chunk-O2BIWLZC.js → chunk-T6MGH4V4.js} +4 -4
- package/dist/{chunk-O2BIWLZC.js.map → chunk-T6MGH4V4.js.map} +1 -1
- package/dist/{chunk-LQM6RHNT.cjs → chunk-Y4YK44IM.cjs} +10 -10
- package/dist/{chunk-LQM6RHNT.cjs.map → chunk-Y4YK44IM.cjs.map} +1 -1
- package/dist/{chunk-LHSVPDFJ.cjs → chunk-YJEWWLOQ.cjs} +959 -541
- package/dist/chunk-YJEWWLOQ.cjs.map +1 -0
- package/dist/{chunk-MUBPGYUE.js → chunk-YKNTUOUG.js} +4 -4
- package/dist/{chunk-MUBPGYUE.js.map → chunk-YKNTUOUG.js.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-BAYpqkEx.d.ts → delegate-CjcysR7s.d.ts} +1 -1
- package/dist/{delegate-CR7msIXK.d.cts → delegate-QPCGaD_z.d.cts} +1 -1
- package/dist/{hdWalletCapable-BSF29IjK.d.ts → hdWalletCapable--pMncWbC.d.ts} +6 -4
- package/dist/{hdWalletCapable-BbZxCUeZ.d.cts → hdWalletCapable-Bp_p0WLj.d.cts} +6 -4
- package/dist/{index-4NF3srcg.d.cts → index-BMY272ns.d.cts} +26 -8
- package/dist/{index-B_RYn9rg.d.cts → index-Ie_ak2zY.d.cts} +35 -9
- package/dist/{index-B_RYn9rg.d.ts → index-Ie_ak2zY.d.ts} +35 -9
- package/dist/{index-Dj2yOhQ2.d.ts → index-m-EM-e8D.d.ts} +26 -8
- package/dist/index.cjs +307 -303
- package/dist/index.d.cts +75 -13
- package/dist/index.d.ts +75 -13
- package/dist/index.js +4 -4
- package/dist/repositories/realm/index.cjs +36 -19
- package/dist/repositories/realm/index.cjs.map +1 -1
- package/dist/repositories/realm/index.d.cts +6 -3
- package/dist/repositories/realm/index.d.ts +6 -3
- package/dist/repositories/realm/index.js +22 -5
- package/dist/repositories/realm/index.js.map +1 -1
- package/dist/repositories/sqlite/index.cjs +42 -18
- package/dist/repositories/sqlite/index.cjs.map +1 -1
- package/dist/repositories/sqlite/index.d.cts +5 -2
- package/dist/repositories/sqlite/index.d.ts +5 -2
- package/dist/repositories/sqlite/index.js +29 -5
- package/dist/repositories/sqlite/index.js.map +1 -1
- package/dist/{taskRunner-DGxde-YU.d.cts → taskRunner-BgRowCqB.d.cts} +1 -1
- package/dist/{taskRunner-TzGUhxP-.d.ts → taskRunner-CqrlrJEt.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 +14 -14
- package/dist/wallet/expo/index.cjs.map +1 -1
- package/dist/wallet/expo/index.d.cts +5 -5
- package/dist/wallet/expo/index.d.ts +5 -5
- package/dist/wallet/expo/index.js +5 -5
- 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 +1 -1
- package/dist/chunk-7UJLIZQU.js.map +0 -1
- package/dist/chunk-CQNX4BTA.cjs.map +0 -1
- package/dist/chunk-F6YOCYWU.js.map +0 -1
- package/dist/chunk-LHSVPDFJ.cjs.map +0 -1
- package/dist/chunk-P53OHGXY.cjs.map +0 -1
- package/dist/chunk-WMHELOHH.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-52OA3UIC.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';
|
|
@@ -1159,7 +1159,6 @@ var ARKADE_OP = {
|
|
|
1159
1159
|
MODEXP: 218,
|
|
1160
1160
|
// VTXO Expiry & Emulator Clock (0xdb-0xdc)
|
|
1161
1161
|
PUSHEXPIRY: 219,
|
|
1162
|
-
// compiler artifacts use OP_CHECKTIME.
|
|
1163
1162
|
CHECKTIME: 220,
|
|
1164
1163
|
// 0xdd-0xdf are unassigned (OP_UNKNOWN221-223)
|
|
1165
1164
|
// EC Operations (0xe0-0xe2)
|
|
@@ -2582,6 +2581,7 @@ function collectParamRefs(program) {
|
|
|
2582
2581
|
const collect = (items) => {
|
|
2583
2582
|
for (const t of items ?? []) {
|
|
2584
2583
|
if (typeof t === "string" && t.startsWith("$")) refs.add(t.slice(1));
|
|
2584
|
+
else if (isTweakedSigner(t) && t.tweak.startsWith("$")) refs.add(t.tweak.slice(1));
|
|
2585
2585
|
}
|
|
2586
2586
|
};
|
|
2587
2587
|
for (const fn of Object.values(program.functions)) {
|
|
@@ -2634,10 +2634,15 @@ function validateProgram(program, args) {
|
|
|
2634
2634
|
if (typeof p !== "string") validateParamValue(p, args[p.name]);
|
|
2635
2635
|
}
|
|
2636
2636
|
}
|
|
2637
|
+
function isTweakedSigner(ref) {
|
|
2638
|
+
if (typeof ref !== "object" || ref === null || ref instanceof Uint8Array) return false;
|
|
2639
|
+
const { tweak, fn } = ref;
|
|
2640
|
+
return typeof tweak === "string" && typeof fn === "string";
|
|
2641
|
+
}
|
|
2637
2642
|
function resolveSigner(ref, args) {
|
|
2638
2643
|
if (ref instanceof Uint8Array) return ref;
|
|
2639
|
-
if (!ref.startsWith("$")) {
|
|
2640
|
-
throw new Error(`unknown signer reference '${ref}' \u2014 use '
|
|
2644
|
+
if (typeof ref !== "string" || !ref.startsWith("$")) {
|
|
2645
|
+
throw new Error(`unknown signer reference '${ref}' \u2014 use a '$param' or key bytes`);
|
|
2641
2646
|
}
|
|
2642
2647
|
const v = bindValue(args, ref.slice(1));
|
|
2643
2648
|
if (!(v instanceof Uint8Array)) {
|
|
@@ -2692,9 +2697,21 @@ function compileFunctions(program, args, keys) {
|
|
|
2692
2697
|
}
|
|
2693
2698
|
return defs.map((def, i) => {
|
|
2694
2699
|
validateTapscript(def.tapscript);
|
|
2695
|
-
const pubkeys = def.tapscript.signers.map((
|
|
2700
|
+
const pubkeys = def.tapscript.signers.map((signer) => {
|
|
2701
|
+
if (!isTweakedSigner(signer)) return resolveSigner(signer, args);
|
|
2702
|
+
const asm = functions[signer.fn]?.arkadeScript?.asm;
|
|
2703
|
+
if (!asm) {
|
|
2704
|
+
throw new Error(
|
|
2705
|
+
`ArkadeContract: function '${names[i]}' tweaks '${signer.fn}', which has no arkade script`
|
|
2706
|
+
);
|
|
2707
|
+
}
|
|
2708
|
+
return computeArkadeScriptPublicKey(
|
|
2709
|
+
resolveSigner(signer.tweak, args),
|
|
2710
|
+
resolveAsm(asm, args)
|
|
2711
|
+
);
|
|
2712
|
+
});
|
|
2696
2713
|
const arkadeScript = def.arkadeScript ? resolveAsm(def.arkadeScript.asm, args) : void 0;
|
|
2697
|
-
const leafPubkeys = arkadeScript ? [...pubkeys, computeArkadeScriptPublicKey(keys.emulatorKey, arkadeScript)] : pubkeys;
|
|
2714
|
+
const leafPubkeys = arkadeScript && def.tapscript.emulator !== null ? [...pubkeys, computeArkadeScriptPublicKey(keys.emulatorKey, arkadeScript)] : pubkeys;
|
|
2698
2715
|
const leafScript = encodeTapscriptSegment(def.tapscript, leafPubkeys, args).script;
|
|
2699
2716
|
return { name: names[i], def, leafScript, arkadeScript, signerKeys: pubkeys };
|
|
2700
2717
|
});
|
|
@@ -2722,17 +2739,31 @@ var ArkadeProgramScript = class extends VtxoScript {
|
|
|
2722
2739
|
}
|
|
2723
2740
|
};
|
|
2724
2741
|
function parseArtifact(artifact) {
|
|
2742
|
+
if (Array.isArray(artifact.functions)) {
|
|
2743
|
+
throw new Error(
|
|
2744
|
+
"parseArtifact: `functions` is an array, which is the arkadec artifact shape, not an SDK program \u2014 read it with programFromArtifact instead"
|
|
2745
|
+
);
|
|
2746
|
+
}
|
|
2747
|
+
if (typeof artifact.functions !== "object" || artifact.functions === null) {
|
|
2748
|
+
throw new Error("parseArtifact: `functions` must be an object keyed by function name");
|
|
2749
|
+
}
|
|
2725
2750
|
const hexToken = (t) => typeof t === "string" && t.startsWith("0x") ? hex.decode(t.slice(2)) : t;
|
|
2751
|
+
const signerRef = (s) => {
|
|
2752
|
+
if (s instanceof Uint8Array || typeof s === "string") return hexToken(s);
|
|
2753
|
+
if (isTweakedSigner(s)) return { tweak: s.tweak, fn: s.fn };
|
|
2754
|
+
throw new Error("parseArtifact: a tweaked signer needs string `tweak` and `fn`");
|
|
2755
|
+
};
|
|
2726
2756
|
const timelockValue = (v) => typeof v === "string" && v.startsWith("$") ? v : BigInt(v);
|
|
2727
2757
|
const functions = {};
|
|
2728
2758
|
for (const [name, fn] of Object.entries(artifact.functions)) {
|
|
2729
2759
|
const tap = fn.tapscript ?? {};
|
|
2730
2760
|
const tapscript = {
|
|
2731
|
-
signers: (tap.signers ?? []).map(
|
|
2761
|
+
signers: (tap.signers ?? []).map(signerRef),
|
|
2732
2762
|
...tap.asm ? { asm: tap.asm.map(hexToken) } : {},
|
|
2733
2763
|
...tap.witness ? { witness: tap.witness.map(hexToken) } : {},
|
|
2734
2764
|
...tap.csv ? { csv: { type: tap.csv.type, value: timelockValue(tap.csv.value) } } : {},
|
|
2735
|
-
...tap.cltv !== void 0 ? { cltv: timelockValue(tap.cltv) } : {}
|
|
2765
|
+
...tap.cltv !== void 0 ? { cltv: timelockValue(tap.cltv) } : {},
|
|
2766
|
+
..."emulator" in tap ? { emulator: tap.emulator } : {}
|
|
2736
2767
|
};
|
|
2737
2768
|
const arkadeScript = fn.arkadeScript ? {
|
|
2738
2769
|
asm: fn.arkadeScript.asm.map(hexToken),
|
|
@@ -2772,7 +2803,8 @@ function stringifyArtifact(program) {
|
|
|
2772
2803
|
...tap.asm ? { asm: tap.asm.map(token) } : {},
|
|
2773
2804
|
...tap.witness ? { witness: tap.witness.map(token) } : {},
|
|
2774
2805
|
...tap.csv ? { csv: { type: tap.csv.type, value: tap.csv.value.toString() } } : {},
|
|
2775
|
-
...tap.cltv !== void 0 ? { cltv: tap.cltv.toString() } : {}
|
|
2806
|
+
...tap.cltv !== void 0 ? { cltv: tap.cltv.toString() } : {},
|
|
2807
|
+
...tap.emulator !== void 0 ? { emulator: tap.emulator } : {}
|
|
2776
2808
|
},
|
|
2777
2809
|
...fn.arkadeScript ? {
|
|
2778
2810
|
arkadeScript: {
|
|
@@ -2995,5 +3027,5 @@ contractHandlers.register(BoardingContractHandler);
|
|
|
2995
3027
|
contractHandlers.register(ArkadeContractHandler);
|
|
2996
3028
|
|
|
2997
3029
|
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, toXOnly, validateProgram, witnessRefToBytes };
|
|
2998
|
-
//# sourceMappingURL=chunk-
|
|
2999
|
-
//# sourceMappingURL=chunk-
|
|
3030
|
+
//# sourceMappingURL=chunk-ACPANSOX.js.map
|
|
3031
|
+
//# sourceMappingURL=chunk-ACPANSOX.js.map
|