@arkade-os/sdk 0.5.0-rc.26 → 0.5.0-rc.28
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 +37 -0
- 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/{index-BfvbSL0W.d.cts → ark-CgZYyMpf.d.cts} +4369 -4205
- package/dist/{index-BfvbSL0W.d.ts → ark-CgZYyMpf.d.ts} +4369 -4205
- package/dist/{asyncStorageTaskQueue-CFWscYpG.d.cts → asyncStorageTaskQueue-B099Jii3.d.cts} +1 -1
- package/dist/{asyncStorageTaskQueue-DrFapzPg.d.ts → asyncStorageTaskQueue-BeQji1Ee.d.ts} +1 -1
- package/dist/{chunk-K2YTDYQF.cjs → chunk-3P7SXAAC.cjs} +16 -16
- package/dist/{chunk-K2YTDYQF.cjs.map → chunk-3P7SXAAC.cjs.map} +1 -1
- package/dist/{chunk-B2YMUJD5.cjs → chunk-4BT6HBZQ.cjs} +1155 -701
- package/dist/chunk-4BT6HBZQ.cjs.map +1 -0
- package/dist/{chunk-FEBAG2K2.cjs → chunk-6BJJ47JM.cjs} +18 -18
- package/dist/{chunk-FEBAG2K2.cjs.map → chunk-6BJJ47JM.cjs.map} +1 -1
- package/dist/{chunk-HPUKFTZV.js → chunk-BDTASM5W.js} +4 -4
- package/dist/{chunk-HPUKFTZV.js.map → chunk-BDTASM5W.js.map} +1 -1
- package/dist/{chunk-U5ZRDVVB.js → chunk-BIN2DVKS.js} +675 -222
- package/dist/chunk-BIN2DVKS.js.map +1 -0
- package/dist/{chunk-HTCIPDVW.js → chunk-CG7S6CDR.js} +5 -4
- package/dist/chunk-CG7S6CDR.js.map +1 -0
- package/dist/{chunk-N2VM6V6K.js → chunk-CR5YHHEM.js} +154 -51
- package/dist/chunk-CR5YHHEM.js.map +1 -0
- package/dist/{chunk-VVFCCNU2.cjs → chunk-FGKBQH5S.cjs} +5 -3
- package/dist/chunk-FGKBQH5S.cjs.map +1 -0
- package/dist/{chunk-Y5VSJURH.js → chunk-FSSINCR6.js} +4 -4
- package/dist/{chunk-Y5VSJURH.js.map → chunk-FSSINCR6.js.map} +1 -1
- package/dist/{chunk-QCD3SJOL.cjs → chunk-HFSC7T5I.cjs} +10 -10
- package/dist/{chunk-QCD3SJOL.cjs.map → chunk-HFSC7T5I.cjs.map} +1 -1
- package/dist/{chunk-5JQ5EOYE.js → chunk-PHSUZSRH.js} +3 -3
- package/dist/{chunk-5JQ5EOYE.js.map → chunk-PHSUZSRH.js.map} +1 -1
- package/dist/{chunk-CFOIHLON.cjs → chunk-YFQOJTG3.cjs} +201 -96
- package/dist/chunk-YFQOJTG3.cjs.map +1 -0
- 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-Cz8FnLqi.d.ts → delegate-B8KSoeVz.d.ts} +1 -1
- package/dist/{delegate-r3jh7UcH.d.cts → delegate-wuf6DBpr.d.cts} +1 -1
- package/dist/{index-DOION7Ta.d.cts → index-1pLGuueL.d.ts} +58 -52
- package/dist/{index-Chgwl4dO.d.ts → index-CP3v0PVS.d.cts} +58 -52
- package/dist/index.cjs +328 -316
- package/dist/index.d.cts +332 -286
- package/dist/index.d.ts +332 -286
- package/dist/index.js +4 -4
- package/dist/repositories/realm/index.cjs +35 -35
- 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 +33 -33
- 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-CXAcjtdU.d.ts → taskRunner-D4IF7tc8.d.cts} +1 -1
- package/dist/{taskRunner-BO8a-SQh.d.cts → taskRunner-DzEg63qV.d.ts} +1 -1
- 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 +15 -15
- package/dist/wallet/expo/index.d.cts +4 -4
- package/dist/wallet/expo/index.d.ts +4 -4
- package/dist/wallet/expo/index.js +5 -5
- package/dist/{wallet-CFIfUlQP.d.ts → walletRepository-BA5C6Slk.d.cts} +29 -29
- package/dist/{wallet-s90p-vIk.d.cts → walletRepository-BE2yiIHF.d.ts} +29 -29
- 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-B2YMUJD5.cjs.map +0 -1
- package/dist/chunk-CFOIHLON.cjs.map +0 -1
- package/dist/chunk-HTCIPDVW.js.map +0 -1
- package/dist/chunk-N2VM6V6K.js.map +0 -1
- package/dist/chunk-U5ZRDVVB.js.map +0 -1
- package/dist/chunk-VVFCCNU2.cjs.map +0 -1
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../../chunk-
|
|
3
|
+
var chunkYFQOJTG3_cjs = require('../../chunk-YFQOJTG3.cjs');
|
|
4
|
+
require('../../chunk-FGKBQH5S.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
Object.defineProperty(exports, "ArkadeContractHandler", {
|
|
9
9
|
enumerable: true,
|
|
10
|
-
get: function () { return
|
|
10
|
+
get: function () { return chunkYFQOJTG3_cjs.ArkadeContractHandler; }
|
|
11
11
|
});
|
|
12
12
|
Object.defineProperty(exports, "BoardingContractHandler", {
|
|
13
13
|
enumerable: true,
|
|
14
|
-
get: function () { return
|
|
14
|
+
get: function () { return chunkYFQOJTG3_cjs.BoardingContractHandler; }
|
|
15
15
|
});
|
|
16
16
|
Object.defineProperty(exports, "DefaultContractHandler", {
|
|
17
17
|
enumerable: true,
|
|
18
|
-
get: function () { return
|
|
18
|
+
get: function () { return chunkYFQOJTG3_cjs.DefaultContractHandler; }
|
|
19
19
|
});
|
|
20
20
|
Object.defineProperty(exports, "DelegateContractHandler", {
|
|
21
21
|
enumerable: true,
|
|
22
|
-
get: function () { return
|
|
22
|
+
get: function () { return chunkYFQOJTG3_cjs.DelegateContractHandler; }
|
|
23
23
|
});
|
|
24
24
|
Object.defineProperty(exports, "VHTLCContractHandler", {
|
|
25
25
|
enumerable: true,
|
|
26
|
-
get: function () { return
|
|
26
|
+
get: function () { return chunkYFQOJTG3_cjs.VHTLCContractHandler; }
|
|
27
27
|
});
|
|
28
28
|
Object.defineProperty(exports, "VHTLCV2ContractHandler", {
|
|
29
29
|
enumerable: true,
|
|
30
|
-
get: function () { return
|
|
30
|
+
get: function () { return chunkYFQOJTG3_cjs.VHTLCV2ContractHandler; }
|
|
31
31
|
});
|
|
32
32
|
Object.defineProperty(exports, "contractHandlers", {
|
|
33
33
|
enumerable: true,
|
|
34
|
-
get: function () { return
|
|
34
|
+
get: function () { return chunkYFQOJTG3_cjs.contractHandlers; }
|
|
35
35
|
});
|
|
36
36
|
//# sourceMappingURL=index.cjs.map
|
|
37
37
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { o as ArkadeContractHandler, B as BoardingContractHandler, q as BoardingContractParams, D as DefaultContractHandler, t as DefaultContractParams, u as DelegateContractHandler, x as DelegateContractParams, y as VHTLCContractHandler, z as VHTLCContractParams, E as VHTLCV2ContractHandler, F as VHTLCV2ContractParams, G as contractHandlers } from '../../index-
|
|
2
|
-
import '../../
|
|
3
|
-
import '@scure/btc-signer/utils.js';
|
|
4
|
-
import '@scure/btc-signer/psbt.js';
|
|
1
|
+
export { o as ArkadeContractHandler, B as BoardingContractHandler, q as BoardingContractParams, D as DefaultContractHandler, t as DefaultContractParams, u as DelegateContractHandler, x as DelegateContractParams, y as VHTLCContractHandler, z as VHTLCContractParams, E as VHTLCV2ContractHandler, F as VHTLCV2ContractParams, G as contractHandlers } from '../../index-CP3v0PVS.cjs';
|
|
2
|
+
import '../../ark-CgZYyMpf.cjs';
|
|
5
3
|
import '@scure/btc-signer';
|
|
6
4
|
import '@scure/btc-signer/transaction.js';
|
|
7
|
-
import '
|
|
5
|
+
import '@scure/btc-signer/utils.js';
|
|
6
|
+
import '@scure/btc-signer/psbt.js';
|
|
7
|
+
import '../../delegate-wuf6DBpr.cjs';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { o as ArkadeContractHandler, B as BoardingContractHandler, q as BoardingContractParams, D as DefaultContractHandler, t as DefaultContractParams, u as DelegateContractHandler, x as DelegateContractParams, y as VHTLCContractHandler, z as VHTLCContractParams, E as VHTLCV2ContractHandler, F as VHTLCV2ContractParams, G as contractHandlers } from '../../index-
|
|
2
|
-
import '../../
|
|
3
|
-
import '@scure/btc-signer/utils.js';
|
|
4
|
-
import '@scure/btc-signer/psbt.js';
|
|
1
|
+
export { o as ArkadeContractHandler, B as BoardingContractHandler, q as BoardingContractParams, D as DefaultContractHandler, t as DefaultContractParams, u as DelegateContractHandler, x as DelegateContractParams, y as VHTLCContractHandler, z as VHTLCContractParams, E as VHTLCV2ContractHandler, F as VHTLCV2ContractParams, G as contractHandlers } from '../../index-1pLGuueL.js';
|
|
2
|
+
import '../../ark-CgZYyMpf.js';
|
|
5
3
|
import '@scure/btc-signer';
|
|
6
4
|
import '@scure/btc-signer/transaction.js';
|
|
7
|
-
import '
|
|
5
|
+
import '@scure/btc-signer/utils.js';
|
|
6
|
+
import '@scure/btc-signer/psbt.js';
|
|
7
|
+
import '../../delegate-B8KSoeVz.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { ArkadeContractHandler, BoardingContractHandler, DefaultContractHandler, DelegateContractHandler, VHTLCContractHandler, VHTLCV2ContractHandler, contractHandlers } from '../../chunk-
|
|
2
|
-
import '../../chunk-
|
|
1
|
+
export { ArkadeContractHandler, BoardingContractHandler, DefaultContractHandler, DelegateContractHandler, VHTLCContractHandler, VHTLCV2ContractHandler, contractHandlers } from '../../chunk-CR5YHHEM.js';
|
|
2
|
+
import '../../chunk-CG7S6CDR.js';
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Bytes } from '@scure/btc-signer/utils.js';
|
|
2
|
-
import { w as RelativeTimelock, V as VtxoScript, x as TapLeafScript } from './
|
|
2
|
+
import { w as RelativeTimelock, V as VtxoScript, x as TapLeafScript } from './ark-CgZYyMpf.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* DefaultVtxo is the default implementation of a VtxoScript.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Bytes } from '@scure/btc-signer/utils.js';
|
|
2
|
-
import { w as RelativeTimelock, V as VtxoScript, x as TapLeafScript } from './
|
|
2
|
+
import { w as RelativeTimelock, V as VtxoScript, x as TapLeafScript } from './ark-CgZYyMpf.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* DefaultVtxo is the default implementation of a VtxoScript.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { D as DefaultVtxo, a as DelegateVtxo } from './delegate-
|
|
1
|
+
import { bD as ContractHandler, w as RelativeTimelock, bP as Discoverable, V as VtxoScript, x as TapLeafScript, dI as TapscriptDeriving } from './ark-CgZYyMpf.js';
|
|
2
|
+
import { D as DefaultVtxo, a as DelegateVtxo } from './delegate-B8KSoeVz.js';
|
|
3
3
|
import { Bytes } from '@scure/btc-signer/utils.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -366,15 +366,15 @@ declare const BoardingContractHandler: ContractHandler<BoardingContractParams, D
|
|
|
366
366
|
/**
|
|
367
367
|
* Arkade Program model & compiler.
|
|
368
368
|
*
|
|
369
|
-
* A {@link Program} is the
|
|
370
|
-
*
|
|
369
|
+
* A {@link Program} is the normalized SDK model: named functions, each
|
|
370
|
+
* split into a `tapscript` segment enforced
|
|
371
371
|
* on-chain and an optional `arkadeScript` segment emulated by the co-signing
|
|
372
372
|
* service. This module owns everything that is *pure data → script*:
|
|
373
373
|
*
|
|
374
374
|
* - the Program/segment/token types,
|
|
375
375
|
* - `$param` resolution ({@link resolveAsm}), witness and timelock resolution,
|
|
376
|
-
* - program validation ({@link validateProgram}) —
|
|
377
|
-
*
|
|
376
|
+
* - program validation ({@link validateProgram}) — every referenced constructor
|
|
377
|
+
* parameter must be declared and bound,
|
|
378
378
|
* - {@link ArkadeProgramScript} — a {@link VtxoScript} compiled from a
|
|
379
379
|
* program, its constructor args and the signer keys,
|
|
380
380
|
* - artifact JSON (de)serialization ({@link parseArtifact} /
|
|
@@ -394,12 +394,20 @@ type AsmToken = string | number | bigint | Uint8Array;
|
|
|
394
394
|
type ArkadeParamValue = Uint8Array | bigint | number;
|
|
395
395
|
/** A function call argument (function input). */
|
|
396
396
|
type ArkadeArgValue = Uint8Array | bigint | number;
|
|
397
|
-
/**
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
397
|
+
/** Native scalar types and their compiler witness encodings. */
|
|
398
|
+
declare const ARKADE_TYPE_ENCODINGS: {
|
|
399
|
+
readonly pubkey: "raw";
|
|
400
|
+
readonly signature: "schnorr-64";
|
|
401
|
+
readonly bytes: "raw";
|
|
402
|
+
readonly bytes20: "raw-20";
|
|
403
|
+
readonly bytes32: "raw-32";
|
|
404
|
+
readonly asset: "raw-32";
|
|
405
|
+
readonly int: "scriptnum";
|
|
406
|
+
readonly bool: "scriptnum";
|
|
407
|
+
readonly AssetGroup: "scriptnum";
|
|
408
|
+
};
|
|
409
|
+
/** A native Arkade scalar type for a constructor parameter or call input. */
|
|
410
|
+
type ArkadeArgType = keyof typeof ARKADE_TYPE_ENCODINGS;
|
|
403
411
|
/**
|
|
404
412
|
* Maps an {@link ArkadeArgType} to its TypeScript argument type.
|
|
405
413
|
* @internal
|
|
@@ -407,22 +415,21 @@ type ArkadeArgType = "bytes" | "pubkey" | "sig" | "hash" | "int";
|
|
|
407
415
|
interface ArkadeValueType {
|
|
408
416
|
bytes: Uint8Array;
|
|
409
417
|
pubkey: Uint8Array;
|
|
410
|
-
|
|
411
|
-
|
|
418
|
+
signature: Uint8Array;
|
|
419
|
+
bytes20: Uint8Array;
|
|
420
|
+
bytes32: Uint8Array;
|
|
421
|
+
asset: Uint8Array;
|
|
412
422
|
int: bigint | number;
|
|
423
|
+
bool: bigint | number;
|
|
424
|
+
AssetGroup: bigint | number;
|
|
413
425
|
}
|
|
414
426
|
/** A typed function input or constructor param: a name plus its {@link ArkadeArgType}. */
|
|
415
427
|
interface InputDef {
|
|
416
428
|
name: string;
|
|
417
429
|
type: ArkadeArgType;
|
|
418
430
|
}
|
|
419
|
-
/**
|
|
420
|
-
|
|
421
|
-
* `{ name, type }` (the argument is statically typed and its bound value is
|
|
422
|
-
* validated) or a bare name string (the argument falls back to the loose
|
|
423
|
-
* {@link ArkadeArgValue}).
|
|
424
|
-
*/
|
|
425
|
-
type InputRef = string | InputDef;
|
|
431
|
+
/** A typed function input or constructor parameter. */
|
|
432
|
+
type InputRef = InputDef;
|
|
426
433
|
/** Constructor pubkey `$param` tweaked by `fn`'s covenant. */
|
|
427
434
|
interface TweakedSigner {
|
|
428
435
|
tweak: string;
|
|
@@ -435,16 +442,20 @@ type WitnessRef = string | number | bigint | Uint8Array;
|
|
|
435
442
|
/** Bitcoin Script segment of a spending path — enforced on-chain. */
|
|
436
443
|
interface TapscriptSegment {
|
|
437
444
|
/**
|
|
438
|
-
* Required signers. A path with `arkadeScript` also
|
|
439
|
-
* co-signer, unless `emulator` is `null`.
|
|
445
|
+
* Required signers. A path with `arkadeScript` also inserts the emulator
|
|
446
|
+
* co-signer at `emulatorIndex` (last by default), unless `emulator` is `null`.
|
|
440
447
|
*/
|
|
441
448
|
signers: SignerRef[];
|
|
449
|
+
/** Caller signature ABI; satisfied through PSBT signing, never ConditionWitness. */
|
|
450
|
+
signatures?: InputDef[];
|
|
442
451
|
/**
|
|
443
452
|
* Covenant named by `<EMULATOR_KEY:fn>`. `null` when this leaf belongs to a
|
|
444
453
|
* covenant but signs with a constructor-key tweak instead. Omitted on
|
|
445
454
|
* hand-written programs, which still append the co-signer.
|
|
446
455
|
*/
|
|
447
456
|
emulator?: string | null;
|
|
457
|
+
/** Emulator's position in the full signer list; omitted to append it. */
|
|
458
|
+
emulatorIndex?: number;
|
|
448
459
|
/**
|
|
449
460
|
* Optional standard-opcode condition (e.g. a hashlock), encoded into a
|
|
450
461
|
* ConditionMultisig leaf — or ConditionCSVMultisig when combined with `csv`.
|
|
@@ -478,18 +489,26 @@ interface ArkadeSegment {
|
|
|
478
489
|
}
|
|
479
490
|
/** One named spending path. */
|
|
480
491
|
interface ArkadeFunction {
|
|
481
|
-
/**
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
* {@link ArkadeArgValue}). Absent for nullary paths (e.g. exit/cancel).
|
|
486
|
-
*/
|
|
487
|
-
inputs?: readonly InputRef[];
|
|
492
|
+
/** Compiler spend group, used to resolve named covenant commitments. */
|
|
493
|
+
group?: string;
|
|
494
|
+
/** Ordered typed call arguments; absent for nullary paths. */
|
|
495
|
+
inputs?: readonly InputDef[];
|
|
488
496
|
tapscript: TapscriptSegment;
|
|
489
497
|
/** Present for covenant paths; absent for pure-tapscript paths (cancel/exit). */
|
|
490
498
|
arkadeScript?: ArkadeSegment;
|
|
491
499
|
}
|
|
492
|
-
|
|
500
|
+
/** Supported normalized Program version. */
|
|
501
|
+
declare const SUPPORTED_PROGRAM_VERSION = 1;
|
|
502
|
+
/**
|
|
503
|
+
* A Program written for a version this SDK cannot read. Typed so a stored row in that format is
|
|
504
|
+
* reported as unsupported rather than broken: its script stays unknown until it is recovered with
|
|
505
|
+
* an SDK that reads that version, or re-created from fresh params.
|
|
506
|
+
*/
|
|
507
|
+
declare class UnsupportedProgramVersionError extends Error {
|
|
508
|
+
readonly version: unknown;
|
|
509
|
+
readonly name = "UnsupportedProgramVersionError";
|
|
510
|
+
constructor(version: unknown, context: string);
|
|
511
|
+
}
|
|
493
512
|
/** An Arkade contract program (hand-written or compiler-emitted). */
|
|
494
513
|
interface Program {
|
|
495
514
|
version: number;
|
|
@@ -498,12 +517,8 @@ interface Program {
|
|
|
498
517
|
* artifact JSON, never used in compilation or the taproot tree.
|
|
499
518
|
*/
|
|
500
519
|
name?: string;
|
|
501
|
-
/**
|
|
502
|
-
|
|
503
|
-
* (the legacy hand-written form); typed descriptors `{ name, type }` make
|
|
504
|
-
* the list authoritative — see {@link validateProgram}.
|
|
505
|
-
*/
|
|
506
|
-
params?: readonly InputRef[];
|
|
520
|
+
/** Ordered typed constructor parameters. */
|
|
521
|
+
params?: readonly InputDef[];
|
|
507
522
|
functions: Record<string, ArkadeFunction>;
|
|
508
523
|
}
|
|
509
524
|
/**
|
|
@@ -511,8 +526,8 @@ interface Program {
|
|
|
511
526
|
* pass everything else (opcode names, numbers, raw byte pushes) through to the
|
|
512
527
|
* Arkade script encoder. The SDK does not interpret opcodes — this is pure
|
|
513
528
|
* substitution + encoding. To embed a signer key (server, user, or any
|
|
514
|
-
* other), pass it as a `$param` in the constructor args
|
|
515
|
-
*
|
|
529
|
+
* other), pass it as a `$param` in the constructor args. Compiler `<...>`
|
|
530
|
+
* placeholders are normalized by {@link programFromArtifact} before this step.
|
|
516
531
|
*/
|
|
517
532
|
declare function resolveAsm(asm: AsmToken[], bind: Record<string, ArkadeParamValue>): Uint8Array;
|
|
518
533
|
/**
|
|
@@ -525,16 +540,7 @@ declare function resolveAsm(asm: AsmToken[], bind: Record<string, ArkadeParamVal
|
|
|
525
540
|
* (throws when the input is unbound — e.g. outside a function call).
|
|
526
541
|
*/
|
|
527
542
|
declare function witnessRefToBytes(ref: WitnessRef, callArgs: Record<string, ArkadeArgValue>, programArgs: Record<string, ArkadeParamValue>): Uint8Array;
|
|
528
|
-
/**
|
|
529
|
-
* Validate a program's constructor-parameter declarations against the bound
|
|
530
|
-
* args. A `params` list of bare name strings is documentation only (the
|
|
531
|
-
* legacy hand-written form — no checks). When at least one entry is a typed
|
|
532
|
-
* descriptor (the compiler-emitted form), the list is authoritative: every
|
|
533
|
-
* declared param must be bound in `args`, every `"$name"` reference in the
|
|
534
|
-
* program must be declared, and typed entries validate their bound value
|
|
535
|
-
* (bytes-like types require a Uint8Array — 32 bytes for `pubkey`, 64 for
|
|
536
|
-
* `sig`; `int` requires a bigint/number).
|
|
537
|
-
*/
|
|
543
|
+
/** Validate declared constructor values and reject undeclared references. */
|
|
538
544
|
declare function validateProgram(program: Program, args: Record<string, ArkadeParamValue>): void;
|
|
539
545
|
/** The signer keys a program is compiled against. */
|
|
540
546
|
interface ProgramKeys {
|
|
@@ -594,11 +600,11 @@ declare class ArkadeProgramScript extends VtxoScript {
|
|
|
594
600
|
declare function parseArtifact(artifact: {
|
|
595
601
|
version?: number;
|
|
596
602
|
name?: string;
|
|
597
|
-
params?: readonly
|
|
603
|
+
params?: readonly InputDef[];
|
|
598
604
|
functions: unknown;
|
|
599
605
|
}): Program;
|
|
600
606
|
/**
|
|
601
|
-
* Serialize a {@link Program} to
|
|
607
|
+
* Serialize a {@link Program} to normalized Program JSON — the inverse of
|
|
602
608
|
* {@link parseArtifact}: bytes become `0x`-hex strings; bigint tokens become
|
|
603
609
|
* plain numbers (or, above `Number.MAX_SAFE_INTEGER`, `0x`-hex of their
|
|
604
610
|
* minimal script-num bytes, which the script encoder pushes identically);
|
|
@@ -636,4 +642,4 @@ declare function deserializeArkadeContractParams(params: Record<string, string>)
|
|
|
636
642
|
*/
|
|
637
643
|
declare const ArkadeContractHandler: ContractHandler<ArkadeContractParams, ArkadeProgramScript> & TapscriptDeriving<ArkadeProgramScript>;
|
|
638
644
|
|
|
639
|
-
export { type ArkadeParamValue as A, BoardingContractHandler as B, type CompiledProgramFunction as C, DefaultContractHandler as D, VHTLCV2ContractHandler as E, type VHTLCV2ContractParams as F, contractHandlers as G, type
|
|
645
|
+
export { type ArkadeParamValue as A, BoardingContractHandler as B, type CompiledProgramFunction as C, DefaultContractHandler as D, VHTLCV2ContractHandler as E, type VHTLCV2ContractParams as F, contractHandlers as G, type InputDef as I, type Program as P, SUPPORTED_PROGRAM_VERSION as S, type TapscriptSegment as T, UnsupportedProgramVersionError as U, VHTLC as V, type WitnessRef as W, ArkadeProgramScript as a, type ProgramKeys as b, type ArkadeArgValue as c, type ArkadeFunction as d, type ArkadeValueType as e, type ArkadeArgType as f, type ArkadeContractParams as g, type ArkadeSegment as h, type AsmToken as i, type InputRef as j, type SignerRef as k, type TweakedSigner as l, deserializeArkadeContractParams as m, stringifyArtifact as n, ArkadeContractHandler as o, parseArtifact as p, type BoardingContractParams as q, resolveAsm as r, serializeArkadeContractParams as s, type DefaultContractParams as t, DelegateContractHandler as u, validateProgram as v, witnessRefToBytes as w, type DelegateContractParams as x, VHTLCContractHandler as y, type VHTLCContractParams as z };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { D as DefaultVtxo, a as DelegateVtxo } from './delegate-
|
|
1
|
+
import { bD as ContractHandler, w as RelativeTimelock, bP as Discoverable, V as VtxoScript, x as TapLeafScript, dI as TapscriptDeriving } from './ark-CgZYyMpf.cjs';
|
|
2
|
+
import { D as DefaultVtxo, a as DelegateVtxo } from './delegate-wuf6DBpr.cjs';
|
|
3
3
|
import { Bytes } from '@scure/btc-signer/utils.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -366,15 +366,15 @@ declare const BoardingContractHandler: ContractHandler<BoardingContractParams, D
|
|
|
366
366
|
/**
|
|
367
367
|
* Arkade Program model & compiler.
|
|
368
368
|
*
|
|
369
|
-
* A {@link Program} is the
|
|
370
|
-
*
|
|
369
|
+
* A {@link Program} is the normalized SDK model: named functions, each
|
|
370
|
+
* split into a `tapscript` segment enforced
|
|
371
371
|
* on-chain and an optional `arkadeScript` segment emulated by the co-signing
|
|
372
372
|
* service. This module owns everything that is *pure data → script*:
|
|
373
373
|
*
|
|
374
374
|
* - the Program/segment/token types,
|
|
375
375
|
* - `$param` resolution ({@link resolveAsm}), witness and timelock resolution,
|
|
376
|
-
* - program validation ({@link validateProgram}) —
|
|
377
|
-
*
|
|
376
|
+
* - program validation ({@link validateProgram}) — every referenced constructor
|
|
377
|
+
* parameter must be declared and bound,
|
|
378
378
|
* - {@link ArkadeProgramScript} — a {@link VtxoScript} compiled from a
|
|
379
379
|
* program, its constructor args and the signer keys,
|
|
380
380
|
* - artifact JSON (de)serialization ({@link parseArtifact} /
|
|
@@ -394,12 +394,20 @@ type AsmToken = string | number | bigint | Uint8Array;
|
|
|
394
394
|
type ArkadeParamValue = Uint8Array | bigint | number;
|
|
395
395
|
/** A function call argument (function input). */
|
|
396
396
|
type ArkadeArgValue = Uint8Array | bigint | number;
|
|
397
|
-
/**
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
397
|
+
/** Native scalar types and their compiler witness encodings. */
|
|
398
|
+
declare const ARKADE_TYPE_ENCODINGS: {
|
|
399
|
+
readonly pubkey: "raw";
|
|
400
|
+
readonly signature: "schnorr-64";
|
|
401
|
+
readonly bytes: "raw";
|
|
402
|
+
readonly bytes20: "raw-20";
|
|
403
|
+
readonly bytes32: "raw-32";
|
|
404
|
+
readonly asset: "raw-32";
|
|
405
|
+
readonly int: "scriptnum";
|
|
406
|
+
readonly bool: "scriptnum";
|
|
407
|
+
readonly AssetGroup: "scriptnum";
|
|
408
|
+
};
|
|
409
|
+
/** A native Arkade scalar type for a constructor parameter or call input. */
|
|
410
|
+
type ArkadeArgType = keyof typeof ARKADE_TYPE_ENCODINGS;
|
|
403
411
|
/**
|
|
404
412
|
* Maps an {@link ArkadeArgType} to its TypeScript argument type.
|
|
405
413
|
* @internal
|
|
@@ -407,22 +415,21 @@ type ArkadeArgType = "bytes" | "pubkey" | "sig" | "hash" | "int";
|
|
|
407
415
|
interface ArkadeValueType {
|
|
408
416
|
bytes: Uint8Array;
|
|
409
417
|
pubkey: Uint8Array;
|
|
410
|
-
|
|
411
|
-
|
|
418
|
+
signature: Uint8Array;
|
|
419
|
+
bytes20: Uint8Array;
|
|
420
|
+
bytes32: Uint8Array;
|
|
421
|
+
asset: Uint8Array;
|
|
412
422
|
int: bigint | number;
|
|
423
|
+
bool: bigint | number;
|
|
424
|
+
AssetGroup: bigint | number;
|
|
413
425
|
}
|
|
414
426
|
/** A typed function input or constructor param: a name plus its {@link ArkadeArgType}. */
|
|
415
427
|
interface InputDef {
|
|
416
428
|
name: string;
|
|
417
429
|
type: ArkadeArgType;
|
|
418
430
|
}
|
|
419
|
-
/**
|
|
420
|
-
|
|
421
|
-
* `{ name, type }` (the argument is statically typed and its bound value is
|
|
422
|
-
* validated) or a bare name string (the argument falls back to the loose
|
|
423
|
-
* {@link ArkadeArgValue}).
|
|
424
|
-
*/
|
|
425
|
-
type InputRef = string | InputDef;
|
|
431
|
+
/** A typed function input or constructor parameter. */
|
|
432
|
+
type InputRef = InputDef;
|
|
426
433
|
/** Constructor pubkey `$param` tweaked by `fn`'s covenant. */
|
|
427
434
|
interface TweakedSigner {
|
|
428
435
|
tweak: string;
|
|
@@ -435,16 +442,20 @@ type WitnessRef = string | number | bigint | Uint8Array;
|
|
|
435
442
|
/** Bitcoin Script segment of a spending path — enforced on-chain. */
|
|
436
443
|
interface TapscriptSegment {
|
|
437
444
|
/**
|
|
438
|
-
* Required signers. A path with `arkadeScript` also
|
|
439
|
-
* co-signer, unless `emulator` is `null`.
|
|
445
|
+
* Required signers. A path with `arkadeScript` also inserts the emulator
|
|
446
|
+
* co-signer at `emulatorIndex` (last by default), unless `emulator` is `null`.
|
|
440
447
|
*/
|
|
441
448
|
signers: SignerRef[];
|
|
449
|
+
/** Caller signature ABI; satisfied through PSBT signing, never ConditionWitness. */
|
|
450
|
+
signatures?: InputDef[];
|
|
442
451
|
/**
|
|
443
452
|
* Covenant named by `<EMULATOR_KEY:fn>`. `null` when this leaf belongs to a
|
|
444
453
|
* covenant but signs with a constructor-key tweak instead. Omitted on
|
|
445
454
|
* hand-written programs, which still append the co-signer.
|
|
446
455
|
*/
|
|
447
456
|
emulator?: string | null;
|
|
457
|
+
/** Emulator's position in the full signer list; omitted to append it. */
|
|
458
|
+
emulatorIndex?: number;
|
|
448
459
|
/**
|
|
449
460
|
* Optional standard-opcode condition (e.g. a hashlock), encoded into a
|
|
450
461
|
* ConditionMultisig leaf — or ConditionCSVMultisig when combined with `csv`.
|
|
@@ -478,18 +489,26 @@ interface ArkadeSegment {
|
|
|
478
489
|
}
|
|
479
490
|
/** One named spending path. */
|
|
480
491
|
interface ArkadeFunction {
|
|
481
|
-
/**
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
* {@link ArkadeArgValue}). Absent for nullary paths (e.g. exit/cancel).
|
|
486
|
-
*/
|
|
487
|
-
inputs?: readonly InputRef[];
|
|
492
|
+
/** Compiler spend group, used to resolve named covenant commitments. */
|
|
493
|
+
group?: string;
|
|
494
|
+
/** Ordered typed call arguments; absent for nullary paths. */
|
|
495
|
+
inputs?: readonly InputDef[];
|
|
488
496
|
tapscript: TapscriptSegment;
|
|
489
497
|
/** Present for covenant paths; absent for pure-tapscript paths (cancel/exit). */
|
|
490
498
|
arkadeScript?: ArkadeSegment;
|
|
491
499
|
}
|
|
492
|
-
|
|
500
|
+
/** Supported normalized Program version. */
|
|
501
|
+
declare const SUPPORTED_PROGRAM_VERSION = 1;
|
|
502
|
+
/**
|
|
503
|
+
* A Program written for a version this SDK cannot read. Typed so a stored row in that format is
|
|
504
|
+
* reported as unsupported rather than broken: its script stays unknown until it is recovered with
|
|
505
|
+
* an SDK that reads that version, or re-created from fresh params.
|
|
506
|
+
*/
|
|
507
|
+
declare class UnsupportedProgramVersionError extends Error {
|
|
508
|
+
readonly version: unknown;
|
|
509
|
+
readonly name = "UnsupportedProgramVersionError";
|
|
510
|
+
constructor(version: unknown, context: string);
|
|
511
|
+
}
|
|
493
512
|
/** An Arkade contract program (hand-written or compiler-emitted). */
|
|
494
513
|
interface Program {
|
|
495
514
|
version: number;
|
|
@@ -498,12 +517,8 @@ interface Program {
|
|
|
498
517
|
* artifact JSON, never used in compilation or the taproot tree.
|
|
499
518
|
*/
|
|
500
519
|
name?: string;
|
|
501
|
-
/**
|
|
502
|
-
|
|
503
|
-
* (the legacy hand-written form); typed descriptors `{ name, type }` make
|
|
504
|
-
* the list authoritative — see {@link validateProgram}.
|
|
505
|
-
*/
|
|
506
|
-
params?: readonly InputRef[];
|
|
520
|
+
/** Ordered typed constructor parameters. */
|
|
521
|
+
params?: readonly InputDef[];
|
|
507
522
|
functions: Record<string, ArkadeFunction>;
|
|
508
523
|
}
|
|
509
524
|
/**
|
|
@@ -511,8 +526,8 @@ interface Program {
|
|
|
511
526
|
* pass everything else (opcode names, numbers, raw byte pushes) through to the
|
|
512
527
|
* Arkade script encoder. The SDK does not interpret opcodes — this is pure
|
|
513
528
|
* substitution + encoding. To embed a signer key (server, user, or any
|
|
514
|
-
* other), pass it as a `$param` in the constructor args
|
|
515
|
-
*
|
|
529
|
+
* other), pass it as a `$param` in the constructor args. Compiler `<...>`
|
|
530
|
+
* placeholders are normalized by {@link programFromArtifact} before this step.
|
|
516
531
|
*/
|
|
517
532
|
declare function resolveAsm(asm: AsmToken[], bind: Record<string, ArkadeParamValue>): Uint8Array;
|
|
518
533
|
/**
|
|
@@ -525,16 +540,7 @@ declare function resolveAsm(asm: AsmToken[], bind: Record<string, ArkadeParamVal
|
|
|
525
540
|
* (throws when the input is unbound — e.g. outside a function call).
|
|
526
541
|
*/
|
|
527
542
|
declare function witnessRefToBytes(ref: WitnessRef, callArgs: Record<string, ArkadeArgValue>, programArgs: Record<string, ArkadeParamValue>): Uint8Array;
|
|
528
|
-
/**
|
|
529
|
-
* Validate a program's constructor-parameter declarations against the bound
|
|
530
|
-
* args. A `params` list of bare name strings is documentation only (the
|
|
531
|
-
* legacy hand-written form — no checks). When at least one entry is a typed
|
|
532
|
-
* descriptor (the compiler-emitted form), the list is authoritative: every
|
|
533
|
-
* declared param must be bound in `args`, every `"$name"` reference in the
|
|
534
|
-
* program must be declared, and typed entries validate their bound value
|
|
535
|
-
* (bytes-like types require a Uint8Array — 32 bytes for `pubkey`, 64 for
|
|
536
|
-
* `sig`; `int` requires a bigint/number).
|
|
537
|
-
*/
|
|
543
|
+
/** Validate declared constructor values and reject undeclared references. */
|
|
538
544
|
declare function validateProgram(program: Program, args: Record<string, ArkadeParamValue>): void;
|
|
539
545
|
/** The signer keys a program is compiled against. */
|
|
540
546
|
interface ProgramKeys {
|
|
@@ -594,11 +600,11 @@ declare class ArkadeProgramScript extends VtxoScript {
|
|
|
594
600
|
declare function parseArtifact(artifact: {
|
|
595
601
|
version?: number;
|
|
596
602
|
name?: string;
|
|
597
|
-
params?: readonly
|
|
603
|
+
params?: readonly InputDef[];
|
|
598
604
|
functions: unknown;
|
|
599
605
|
}): Program;
|
|
600
606
|
/**
|
|
601
|
-
* Serialize a {@link Program} to
|
|
607
|
+
* Serialize a {@link Program} to normalized Program JSON — the inverse of
|
|
602
608
|
* {@link parseArtifact}: bytes become `0x`-hex strings; bigint tokens become
|
|
603
609
|
* plain numbers (or, above `Number.MAX_SAFE_INTEGER`, `0x`-hex of their
|
|
604
610
|
* minimal script-num bytes, which the script encoder pushes identically);
|
|
@@ -636,4 +642,4 @@ declare function deserializeArkadeContractParams(params: Record<string, string>)
|
|
|
636
642
|
*/
|
|
637
643
|
declare const ArkadeContractHandler: ContractHandler<ArkadeContractParams, ArkadeProgramScript> & TapscriptDeriving<ArkadeProgramScript>;
|
|
638
644
|
|
|
639
|
-
export { type ArkadeParamValue as A, BoardingContractHandler as B, type CompiledProgramFunction as C, DefaultContractHandler as D, VHTLCV2ContractHandler as E, type VHTLCV2ContractParams as F, contractHandlers as G, type
|
|
645
|
+
export { type ArkadeParamValue as A, BoardingContractHandler as B, type CompiledProgramFunction as C, DefaultContractHandler as D, VHTLCV2ContractHandler as E, type VHTLCV2ContractParams as F, contractHandlers as G, type InputDef as I, type Program as P, SUPPORTED_PROGRAM_VERSION as S, type TapscriptSegment as T, UnsupportedProgramVersionError as U, VHTLC as V, type WitnessRef as W, ArkadeProgramScript as a, type ProgramKeys as b, type ArkadeArgValue as c, type ArkadeFunction as d, type ArkadeValueType as e, type ArkadeArgType as f, type ArkadeContractParams as g, type ArkadeSegment as h, type AsmToken as i, type InputRef as j, type SignerRef as k, type TweakedSigner as l, deserializeArkadeContractParams as m, stringifyArtifact as n, ArkadeContractHandler as o, parseArtifact as p, type BoardingContractParams as q, resolveAsm as r, serializeArkadeContractParams as s, type DefaultContractParams as t, DelegateContractHandler as u, validateProgram as v, witnessRefToBytes as w, type DelegateContractParams as x, VHTLCContractHandler as y, type VHTLCContractParams as z };
|