@arkade-os/sdk 0.4.66 → 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 +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-LTpeXYaD.d.cts} +2 -2
- package/dist/{asyncStorageTaskQueue-B6SijMi3.d.ts → asyncStorageTaskQueue-Za-e_zMk.d.ts} +2 -2
- package/dist/{chunk-ZIRFXBKL.cjs → chunk-2JV4VQ7C.cjs} +33 -13
- package/dist/chunk-2JV4VQ7C.cjs.map +1 -0
- package/dist/{chunk-J33ZEM3A.js → chunk-3WIWNE4P.js} +33 -14
- package/dist/chunk-3WIWNE4P.js.map +1 -0
- package/dist/{chunk-CYOI4PEA.js → chunk-6TAQF6EV.js} +107 -13
- package/dist/chunk-6TAQF6EV.js.map +1 -0
- package/dist/{chunk-DSC3G6QZ.js → chunk-AEWJU6NZ.js} +1006 -167
- package/dist/chunk-AEWJU6NZ.js.map +1 -0
- package/dist/{chunk-3S3JZUEN.cjs → chunk-CO3KKSWM.cjs} +17 -17
- package/dist/{chunk-3S3JZUEN.cjs.map → chunk-CO3KKSWM.cjs.map} +1 -1
- package/dist/{chunk-55ZZ6RBL.js → chunk-EALWOVHK.js} +4 -4
- package/dist/{chunk-55ZZ6RBL.js.map → chunk-EALWOVHK.js.map} +1 -1
- package/dist/{chunk-5E6IZNRG.cjs → chunk-MJUTO3PY.cjs} +1413 -563
- package/dist/chunk-MJUTO3PY.cjs.map +1 -0
- package/dist/{chunk-R5POS3RS.js → chunk-MZFUZUTQ.js} +4 -4
- package/dist/{chunk-R5POS3RS.js.map → chunk-MZFUZUTQ.js.map} +1 -1
- package/dist/{chunk-PXPPZF5K.cjs → chunk-OIZ2V2VD.cjs} +152 -58
- package/dist/chunk-OIZ2V2VD.cjs.map +1 -0
- package/dist/{chunk-IM6IKNSL.cjs → chunk-R2YAMONM.cjs} +17 -17
- package/dist/{chunk-IM6IKNSL.cjs.map → chunk-R2YAMONM.cjs.map} +1 -1
- package/dist/{chunk-2JZGPXU4.js → chunk-X3VEMUVV.js} +3 -3
- package/dist/{chunk-2JZGPXU4.js.map → chunk-X3VEMUVV.js.map} +1 -1
- package/dist/{chunk-LL47QIHD.cjs → chunk-YDRZDZPP.cjs} +10 -10
- package/dist/{chunk-LL47QIHD.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-YXupcWWJ.d.cts → delegate-Bz2e2zXY.d.cts} +1 -1
- package/dist/{delegate-T-vgxMYZ.d.ts → delegate-cdmzb2f9.d.ts} +1 -1
- package/dist/{wallet-CNibc3yJ.d.ts → hdWalletCapable-BSjuUYOO.d.cts} +318 -127
- package/dist/{wallet-DJN1QgFt.d.cts → hdWalletCapable-Hi12xjCJ.d.ts} +318 -127
- package/dist/{index-e7LYXk1d.d.cts → index-BiACuWaf.d.ts} +109 -13
- package/dist/{index-D_FgwLH9.d.ts → index-D2GjZxBr.d.cts} +109 -13
- package/dist/{index-uUE_uQPn.d.ts → index-DU5o_hz7.d.cts} +206 -19
- package/dist/{index-uUE_uQPn.d.cts → index-DU5o_hz7.d.ts} +206 -19
- package/dist/index.cjs +322 -278
- package/dist/index.d.cts +291 -41
- package/dist/index.d.ts +291 -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-BZJMLQ6g.d.cts} +2 -2
- package/dist/{taskRunner-DNyD1kXG.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-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
|
@@ -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-3WIWNE4P.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';
|
|
@@ -1455,6 +1455,8 @@ var VHTLC;
|
|
|
1455
1455
|
nonInteractiveClaimArkadeScript;
|
|
1456
1456
|
nonInteractiveRefundScript;
|
|
1457
1457
|
nonInteractiveRefundArkadeScript;
|
|
1458
|
+
nonInteractiveRefundWithoutReceiverScript;
|
|
1459
|
+
nonInteractiveRefundWithoutReceiverArkadeScript;
|
|
1458
1460
|
constructor(options, preimageCondition) {
|
|
1459
1461
|
validateOptions(options);
|
|
1460
1462
|
const {
|
|
@@ -1522,22 +1524,27 @@ var VHTLC;
|
|
|
1522
1524
|
}
|
|
1523
1525
|
let arkadeScriptNir;
|
|
1524
1526
|
let nonInteractiveRefundScript;
|
|
1527
|
+
let nonInteractiveRefundWithoutReceiverScript;
|
|
1525
1528
|
if (options.nonInteractiveRefund) {
|
|
1526
1529
|
arkadeScriptNir = enforcePayToMaybeAsset(
|
|
1527
1530
|
options.nonInteractiveRefund.senderPkScript,
|
|
1528
1531
|
options.asset
|
|
1529
1532
|
);
|
|
1533
|
+
const nirCosigner = computeArkadeScriptPublicKey(
|
|
1534
|
+
options.nonInteractiveRefund.emulatorPubkey,
|
|
1535
|
+
arkadeScriptNir
|
|
1536
|
+
);
|
|
1530
1537
|
nonInteractiveRefundScript = MultisigTapscript.encode({
|
|
1531
|
-
pubkeys: [
|
|
1532
|
-
server,
|
|
1533
|
-
receiver,
|
|
1534
|
-
computeArkadeScriptPublicKey(
|
|
1535
|
-
options.nonInteractiveRefund.emulatorPubkey,
|
|
1536
|
-
arkadeScriptNir
|
|
1537
|
-
)
|
|
1538
|
-
]
|
|
1538
|
+
pubkeys: [server, receiver, nirCosigner]
|
|
1539
1539
|
}).script;
|
|
1540
1540
|
scripts.push(nonInteractiveRefundScript);
|
|
1541
|
+
if (options.nonInteractiveRefund.withoutReceiver) {
|
|
1542
|
+
nonInteractiveRefundWithoutReceiverScript = CLTVMultisigTapscript.encode({
|
|
1543
|
+
absoluteTimelock: refundLocktime,
|
|
1544
|
+
pubkeys: [server, nirCosigner]
|
|
1545
|
+
}).script;
|
|
1546
|
+
scripts.push(nonInteractiveRefundWithoutReceiverScript);
|
|
1547
|
+
}
|
|
1541
1548
|
}
|
|
1542
1549
|
super(scripts);
|
|
1543
1550
|
this.options = options;
|
|
@@ -1557,6 +1564,12 @@ var VHTLC;
|
|
|
1557
1564
|
this.nonInteractiveRefundScript = hex.encode(nonInteractiveRefundScript);
|
|
1558
1565
|
this.nonInteractiveRefundArkadeScript = arkadeScriptNir;
|
|
1559
1566
|
}
|
|
1567
|
+
if (nonInteractiveRefundWithoutReceiverScript) {
|
|
1568
|
+
this.nonInteractiveRefundWithoutReceiverScript = hex.encode(
|
|
1569
|
+
nonInteractiveRefundWithoutReceiverScript
|
|
1570
|
+
);
|
|
1571
|
+
this.nonInteractiveRefundWithoutReceiverArkadeScript = arkadeScriptNir;
|
|
1572
|
+
}
|
|
1560
1573
|
}
|
|
1561
1574
|
/** Return the collaborative claim tapleaf script. */
|
|
1562
1575
|
claim() {
|
|
@@ -1602,6 +1615,67 @@ var VHTLC;
|
|
|
1602
1615
|
this.nonInteractiveRefundArkadeScript
|
|
1603
1616
|
];
|
|
1604
1617
|
}
|
|
1618
|
+
/**
|
|
1619
|
+
* Return the timelocked non-interactive refund tapleaf and its ArkadeScript.
|
|
1620
|
+
*
|
|
1621
|
+
* SPENDING THIS LEAF, CONCRETELY — confirmed from this SDK's own
|
|
1622
|
+
* emulator client and covenant-spend builder ({@link
|
|
1623
|
+
* EmulatorProvider} in `src/providers/emulator.ts`, and {@link
|
|
1624
|
+
* ArkadeTransactionBuilder} in `src/arkade/contract.ts`), which is
|
|
1625
|
+
* the general machinery every covenant leaf in this file goes
|
|
1626
|
+
* through:
|
|
1627
|
+
*
|
|
1628
|
+
* 1. Build the ark tx spending this leaf (this method's {@link
|
|
1629
|
+
* TapLeafScript} as `tapLeafScript`, this script's {@link
|
|
1630
|
+
* VtxoScript.encode} as `tapTree`), plus its checkpoint tx.
|
|
1631
|
+
* 2. Attach the ArkadeScript this method returns to the spent
|
|
1632
|
+
* input via an `EmulatorPacket` (type 1) — `{ vin, script:
|
|
1633
|
+
* <this ArkadeScript>, witness: <empty> }`, empty because the
|
|
1634
|
+
* script pushes its own input/output index with
|
|
1635
|
+
* `PUSHCURRENTINPUTINDEX` rather than reading one from the
|
|
1636
|
+
* witness — wrapped in an `Extension` OP_RETURN output on the
|
|
1637
|
+
* ark tx.
|
|
1638
|
+
* 3. Attach the spent input's OWN creating ark tx as `PrevArkTx` on
|
|
1639
|
+
* input 0 — required so the emulator can resolve that input's
|
|
1640
|
+
* prevout pkScript/value; it does not otherwise have them.
|
|
1641
|
+
* 4. POST the (base64-PSBT) ark tx and checkpoint(s) as `{ arkTx,
|
|
1642
|
+
* checkpointTxs }` to the emulator's `POST /v1/tx`.
|
|
1643
|
+
*
|
|
1644
|
+
* THE COVENANT CHECK the emulator runs against that ArkadeScript —
|
|
1645
|
+
* `enforcePayTo(senderPkScript)`, see that function above — is: the
|
|
1646
|
+
* output at this SAME input's index is a v1 P2TR output paying
|
|
1647
|
+
* `senderPkScript`, with a value at least the input's. Only on that
|
|
1648
|
+
* check passing does the emulator sign for `nirCosigner` (the
|
|
1649
|
+
* `emulatorPubkey` tweaked by this ArkadeScript's hash); the
|
|
1650
|
+
* response carries the fully co-signed `signedArkTx` and
|
|
1651
|
+
* `signedCheckpointTxs` — `ArkadeTransactionBuilder.send()`'s own
|
|
1652
|
+
* comment on this path: "the emulator executes the arkade script
|
|
1653
|
+
* and finalizes with arkd" — no separate call to arkd is made by
|
|
1654
|
+
* this SDK for a covenant spend.
|
|
1655
|
+
* Neither `server` nor `receiver` play any part in that check: this
|
|
1656
|
+
* leaf's tapscript still requires `server`'s own signature
|
|
1657
|
+
* alongside `nirCosigner`'s (see the class doc above), but that is
|
|
1658
|
+
* consensus-level multisig, not something the covenant enforces.
|
|
1659
|
+
*
|
|
1660
|
+
* NOT SPENDABLE UNTIL `refundLocktime` MATURES — the tapscript's
|
|
1661
|
+
* `OP_CHECKLOCKTIMEVERIFY` is arkd's concern, not the emulator's;
|
|
1662
|
+
* the emulator will happily co-sign an immature spend and arkd will
|
|
1663
|
+
* then refuse it. A block-height-typed `refundLocktime` (below the
|
|
1664
|
+
* standard height/timestamp boundary this SDK names
|
|
1665
|
+
* `CLTV_HEIGHT_THRESHOLD`, 500,000,000, in
|
|
1666
|
+
* `src/contracts/handlers/helpers.ts`) is refused by arkd for a
|
|
1667
|
+
* forfeit-eligible leaf independent of maturity — use a
|
|
1668
|
+
* seconds-typed (absolute Unix timestamp) value.
|
|
1669
|
+
*/
|
|
1670
|
+
nonInteractiveRefundWithoutReceiver() {
|
|
1671
|
+
if (!this.nonInteractiveRefundWithoutReceiverScript || !this.nonInteractiveRefundWithoutReceiverArkadeScript) {
|
|
1672
|
+
throw new Error("VHTLC has no non-interactive refund-without-receiver leaf");
|
|
1673
|
+
}
|
|
1674
|
+
return [
|
|
1675
|
+
this.findLeaf(this.nonInteractiveRefundWithoutReceiverScript),
|
|
1676
|
+
this.nonInteractiveRefundWithoutReceiverArkadeScript
|
|
1677
|
+
];
|
|
1678
|
+
}
|
|
1605
1679
|
}
|
|
1606
1680
|
class Script3 extends BaseScript {
|
|
1607
1681
|
constructor(options) {
|
|
@@ -2101,7 +2175,14 @@ var VHTLCV2ContractHandler = {
|
|
|
2101
2175
|
),
|
|
2102
2176
|
nonInteractiveRefundEmulatorPubkey: hex.encode(
|
|
2103
2177
|
params.nonInteractiveRefund.emulatorPubkey
|
|
2104
|
-
)
|
|
2178
|
+
),
|
|
2179
|
+
// Spread rather than a "false"/"undefined" string: a dropped
|
|
2180
|
+
// flag re-derives the EIGHT-leaf script, a different pkScript,
|
|
2181
|
+
// and registration dies at `upsertContractRow` with an opaque
|
|
2182
|
+
// `Script mismatch`. Same silent-drop class as the asset keys.
|
|
2183
|
+
...params.nonInteractiveRefund.withoutReceiver && {
|
|
2184
|
+
nonInteractiveRefundWithoutReceiver: "1"
|
|
2185
|
+
}
|
|
2105
2186
|
},
|
|
2106
2187
|
// The asset must round-trip, and its absence here used to be silent
|
|
2107
2188
|
// in the worst way. `ContractManager` re-derives a contract from
|
|
@@ -2141,6 +2222,16 @@ var VHTLCV2ContractHandler = {
|
|
|
2141
2222
|
"strictClaimAssetAmount without strictClaimAmount: reading this as 'not strict' would re-derive the default claim covenant, which is weaker than the row asked for"
|
|
2142
2223
|
);
|
|
2143
2224
|
}
|
|
2225
|
+
if (params.nonInteractiveRefundWithoutReceiver !== void 0 && !refund) {
|
|
2226
|
+
throw new Error(
|
|
2227
|
+
"nonInteractiveRefundWithoutReceiver without the nonInteractiveRefund keys it extends: reading this as 'not set' would re-derive a script without the leaf"
|
|
2228
|
+
);
|
|
2229
|
+
}
|
|
2230
|
+
if (params.nonInteractiveRefundWithoutReceiver !== void 0 && params.nonInteractiveRefundWithoutReceiver !== "1") {
|
|
2231
|
+
throw new Error(
|
|
2232
|
+
`nonInteractiveRefundWithoutReceiver must be "1" when present, got ` + JSON.stringify(params.nonInteractiveRefundWithoutReceiver)
|
|
2233
|
+
);
|
|
2234
|
+
}
|
|
2144
2235
|
const asset = params.assetTxid !== void 0 && params.assetGroupIndex !== void 0 ? {
|
|
2145
2236
|
txid: hex.decode(params.assetTxid),
|
|
2146
2237
|
groupIndex: parseGroupIndex(params.assetGroupIndex)
|
|
@@ -2174,7 +2265,10 @@ var VHTLCV2ContractHandler = {
|
|
|
2174
2265
|
...refund && {
|
|
2175
2266
|
nonInteractiveRefund: {
|
|
2176
2267
|
senderPkScript: refund.destination,
|
|
2177
|
-
emulatorPubkey: refund.emulatorPubkey
|
|
2268
|
+
emulatorPubkey: refund.emulatorPubkey,
|
|
2269
|
+
...params.nonInteractiveRefundWithoutReceiver === "1" && {
|
|
2270
|
+
withoutReceiver: true
|
|
2271
|
+
}
|
|
2178
2272
|
}
|
|
2179
2273
|
}
|
|
2180
2274
|
};
|
|
@@ -2942,5 +3036,5 @@ contractHandlers.register(BoardingContractHandler);
|
|
|
2942
3036
|
contractHandlers.register(ArkadeContractHandler);
|
|
2943
3037
|
|
|
2944
3038
|
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 };
|
|
2945
|
-
//# sourceMappingURL=chunk-
|
|
2946
|
-
//# sourceMappingURL=chunk-
|
|
3039
|
+
//# sourceMappingURL=chunk-6TAQF6EV.js.map
|
|
3040
|
+
//# sourceMappingURL=chunk-6TAQF6EV.js.map
|