@xo-cash/utils 0.0.4 → 0.0.6-development.16438912955
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/index.d.mts +45 -45
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +42 -46
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -5
package/dist/index.d.mts
CHANGED
|
@@ -697,21 +697,15 @@ declare const xoTemplateLockingTypeSchema: z.ZodEnum<{
|
|
|
697
697
|
readonly P2SH: "p2sh";
|
|
698
698
|
}>;
|
|
699
699
|
/**
|
|
700
|
-
* Validation schema for a
|
|
701
|
-
* Accepts values from
|
|
700
|
+
* Validation schema for a primitive type identifier.
|
|
701
|
+
* Accepts values from XOTemplatePrimitiveTypes for the `hint` field on constants, variables, and data.
|
|
702
702
|
*/
|
|
703
|
-
declare const
|
|
703
|
+
declare const xoTemplatePrimitiveTypeSchema: z.ZodEnum<{
|
|
704
704
|
readonly BOOLEAN: "boolean";
|
|
705
705
|
readonly BYTES: "bytes";
|
|
706
706
|
readonly INTEGER: "integer";
|
|
707
707
|
readonly BIGINT: "bigint";
|
|
708
708
|
readonly STRING: "string";
|
|
709
|
-
}>;
|
|
710
|
-
/**
|
|
711
|
-
* Validation schema for a primitive type identifier.
|
|
712
|
-
* Accepts values from XOTemplatePrimitiveTypes for the `hint` field on constants, variables, and data.
|
|
713
|
-
*/
|
|
714
|
-
declare const xoTemplatePrimitiveTypeSchema: z.ZodEnum<{
|
|
715
709
|
readonly PRIVATE_KEY: "private_key";
|
|
716
710
|
readonly PUBLIC_KEY: "public_key";
|
|
717
711
|
readonly EXTENDED_PUBLIC_KEY: "extended_public_key";
|
|
@@ -722,6 +716,7 @@ declare const xoTemplatePrimitiveTypeSchema: z.ZodEnum<{
|
|
|
722
716
|
readonly TIMESTAMP: "timestamp";
|
|
723
717
|
readonly TOKEN_CATEGORY: "token_category";
|
|
724
718
|
readonly NFT_COMMITMENT: "nft_commitment";
|
|
719
|
+
readonly LOCKING_SCRIPT: "locking_script";
|
|
725
720
|
readonly TRANSACTION_HASH: "transaction_hash";
|
|
726
721
|
readonly TEMPLATE_IDENTIFIER: "template_identifier";
|
|
727
722
|
readonly SCHNORR_SIGNATURE: "signature";
|
|
@@ -729,7 +724,7 @@ declare const xoTemplatePrimitiveTypeSchema: z.ZodEnum<{
|
|
|
729
724
|
/**
|
|
730
725
|
* Validation schema for byte array fields i.e. Uint8Array instance.
|
|
731
726
|
*/
|
|
732
|
-
declare const uint8ArraySchema: z.
|
|
727
|
+
declare const uint8ArraySchema: z.ZodInstanceOf<Uint8Array<ArrayBuffer>>;
|
|
733
728
|
/**
|
|
734
729
|
* Validation schema for the Satoshis type i.e. bigint.
|
|
735
730
|
*/
|
|
@@ -1115,6 +1110,7 @@ declare const xoTemplateLockingScriptRoleSchema: z.ZodObject<{
|
|
|
1115
1110
|
nonfungibleTokens: z.ZodOptional<z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodString, z.ZodLiteral<true>]>>>;
|
|
1116
1111
|
}, z.core.$strict>>;
|
|
1117
1112
|
selectable: z.ZodOptional<z.ZodBoolean>;
|
|
1113
|
+
relevant: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>;
|
|
1118
1114
|
privacy: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
1119
1115
|
}, z.core.$strict>;
|
|
1120
1116
|
/**
|
|
@@ -1182,6 +1178,7 @@ declare const xoTemplateLockingScriptSchema: z.ZodObject<{
|
|
|
1182
1178
|
nonfungibleTokens: z.ZodOptional<z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodString, z.ZodLiteral<true>]>>>;
|
|
1183
1179
|
}, z.core.$strict>>;
|
|
1184
1180
|
selectable: z.ZodOptional<z.ZodBoolean>;
|
|
1181
|
+
relevant: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>;
|
|
1185
1182
|
privacy: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
1186
1183
|
}, z.core.$strict>>>;
|
|
1187
1184
|
}, z.core.$strict>;
|
|
@@ -1261,6 +1258,7 @@ declare const xoTemplateOutputSchema: z.ZodObject<{
|
|
|
1261
1258
|
nonfungibleTokens: z.ZodOptional<z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodString, z.ZodLiteral<true>]>>>;
|
|
1262
1259
|
}, z.core.$strict>>;
|
|
1263
1260
|
selectable: z.ZodOptional<z.ZodBoolean>;
|
|
1261
|
+
relevant: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>;
|
|
1264
1262
|
privacy: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
1265
1263
|
}, z.core.$strict>>>;
|
|
1266
1264
|
state: z.ZodOptional<z.ZodObject<{
|
|
@@ -1425,9 +1423,6 @@ declare const xoTemplateConstantSchema: z.ZodObject<{
|
|
|
1425
1423
|
readonly INTEGER: "integer";
|
|
1426
1424
|
readonly BIGINT: "bigint";
|
|
1427
1425
|
readonly STRING: "string";
|
|
1428
|
-
}>;
|
|
1429
|
-
value: z.ZodUnknown;
|
|
1430
|
-
hint: z.ZodOptional<z.ZodEnum<{
|
|
1431
1426
|
readonly PRIVATE_KEY: "private_key";
|
|
1432
1427
|
readonly PUBLIC_KEY: "public_key";
|
|
1433
1428
|
readonly EXTENDED_PUBLIC_KEY: "extended_public_key";
|
|
@@ -1438,10 +1433,13 @@ declare const xoTemplateConstantSchema: z.ZodObject<{
|
|
|
1438
1433
|
readonly TIMESTAMP: "timestamp";
|
|
1439
1434
|
readonly TOKEN_CATEGORY: "token_category";
|
|
1440
1435
|
readonly NFT_COMMITMENT: "nft_commitment";
|
|
1436
|
+
readonly LOCKING_SCRIPT: "locking_script";
|
|
1441
1437
|
readonly TRANSACTION_HASH: "transaction_hash";
|
|
1442
1438
|
readonly TEMPLATE_IDENTIFIER: "template_identifier";
|
|
1443
1439
|
readonly SCHNORR_SIGNATURE: "signature";
|
|
1444
|
-
}
|
|
1440
|
+
}>;
|
|
1441
|
+
value: z.ZodUnknown;
|
|
1442
|
+
hint: z.ZodOptional<z.ZodUnknown>;
|
|
1445
1443
|
}, z.core.$strict>;
|
|
1446
1444
|
/**
|
|
1447
1445
|
* Validation schema for a data field definition.
|
|
@@ -1461,9 +1459,6 @@ declare const xoTemplateDataSchema: z.ZodObject<{
|
|
|
1461
1459
|
readonly INTEGER: "integer";
|
|
1462
1460
|
readonly BIGINT: "bigint";
|
|
1463
1461
|
readonly STRING: "string";
|
|
1464
|
-
}>;
|
|
1465
|
-
value: z.ZodUnknown;
|
|
1466
|
-
hint: z.ZodOptional<z.ZodEnum<{
|
|
1467
1462
|
readonly PRIVATE_KEY: "private_key";
|
|
1468
1463
|
readonly PUBLIC_KEY: "public_key";
|
|
1469
1464
|
readonly EXTENDED_PUBLIC_KEY: "extended_public_key";
|
|
@@ -1474,10 +1469,13 @@ declare const xoTemplateDataSchema: z.ZodObject<{
|
|
|
1474
1469
|
readonly TIMESTAMP: "timestamp";
|
|
1475
1470
|
readonly TOKEN_CATEGORY: "token_category";
|
|
1476
1471
|
readonly NFT_COMMITMENT: "nft_commitment";
|
|
1472
|
+
readonly LOCKING_SCRIPT: "locking_script";
|
|
1477
1473
|
readonly TRANSACTION_HASH: "transaction_hash";
|
|
1478
1474
|
readonly TEMPLATE_IDENTIFIER: "template_identifier";
|
|
1479
1475
|
readonly SCHNORR_SIGNATURE: "signature";
|
|
1480
|
-
}
|
|
1476
|
+
}>;
|
|
1477
|
+
value: z.ZodUnknown;
|
|
1478
|
+
hint: z.ZodOptional<z.ZodUnknown>;
|
|
1481
1479
|
}, z.core.$strict>;
|
|
1482
1480
|
/**
|
|
1483
1481
|
* Validation schema for an import default value intent. Extends the base intent with optional
|
|
@@ -1525,8 +1523,6 @@ declare const xoTemplateVariableSchema: z.ZodObject<{
|
|
|
1525
1523
|
readonly INTEGER: "integer";
|
|
1526
1524
|
readonly BIGINT: "bigint";
|
|
1527
1525
|
readonly STRING: "string";
|
|
1528
|
-
}>>;
|
|
1529
|
-
hint: z.ZodOptional<z.ZodEnum<{
|
|
1530
1526
|
readonly PRIVATE_KEY: "private_key";
|
|
1531
1527
|
readonly PUBLIC_KEY: "public_key";
|
|
1532
1528
|
readonly EXTENDED_PUBLIC_KEY: "extended_public_key";
|
|
@@ -1537,10 +1533,12 @@ declare const xoTemplateVariableSchema: z.ZodObject<{
|
|
|
1537
1533
|
readonly TIMESTAMP: "timestamp";
|
|
1538
1534
|
readonly TOKEN_CATEGORY: "token_category";
|
|
1539
1535
|
readonly NFT_COMMITMENT: "nft_commitment";
|
|
1536
|
+
readonly LOCKING_SCRIPT: "locking_script";
|
|
1540
1537
|
readonly TRANSACTION_HASH: "transaction_hash";
|
|
1541
1538
|
readonly TEMPLATE_IDENTIFIER: "template_identifier";
|
|
1542
1539
|
readonly SCHNORR_SIGNATURE: "signature";
|
|
1543
1540
|
}>>;
|
|
1541
|
+
hint: z.ZodOptional<z.ZodUnknown>;
|
|
1544
1542
|
importDefaultValue: z.ZodOptional<z.ZodObject<{
|
|
1545
1543
|
templateIdentifier: z.ZodOptional<z.ZodString>;
|
|
1546
1544
|
role: z.ZodOptional<z.ZodString>;
|
|
@@ -1685,9 +1683,6 @@ declare const xoTemplateSchema: z.ZodObject<{
|
|
|
1685
1683
|
readonly INTEGER: "integer";
|
|
1686
1684
|
readonly BIGINT: "bigint";
|
|
1687
1685
|
readonly STRING: "string";
|
|
1688
|
-
}>;
|
|
1689
|
-
value: z.ZodUnknown;
|
|
1690
|
-
hint: z.ZodOptional<z.ZodEnum<{
|
|
1691
1686
|
readonly PRIVATE_KEY: "private_key";
|
|
1692
1687
|
readonly PUBLIC_KEY: "public_key";
|
|
1693
1688
|
readonly EXTENDED_PUBLIC_KEY: "extended_public_key";
|
|
@@ -1698,10 +1693,13 @@ declare const xoTemplateSchema: z.ZodObject<{
|
|
|
1698
1693
|
readonly TIMESTAMP: "timestamp";
|
|
1699
1694
|
readonly TOKEN_CATEGORY: "token_category";
|
|
1700
1695
|
readonly NFT_COMMITMENT: "nft_commitment";
|
|
1696
|
+
readonly LOCKING_SCRIPT: "locking_script";
|
|
1701
1697
|
readonly TRANSACTION_HASH: "transaction_hash";
|
|
1702
1698
|
readonly TEMPLATE_IDENTIFIER: "template_identifier";
|
|
1703
1699
|
readonly SCHNORR_SIGNATURE: "signature";
|
|
1704
|
-
}
|
|
1700
|
+
}>;
|
|
1701
|
+
value: z.ZodUnknown;
|
|
1702
|
+
hint: z.ZodOptional<z.ZodUnknown>;
|
|
1705
1703
|
}, z.core.$strict>>>;
|
|
1706
1704
|
transactions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
1707
1705
|
name: z.ZodString;
|
|
@@ -1784,6 +1782,7 @@ declare const xoTemplateSchema: z.ZodObject<{
|
|
|
1784
1782
|
nonfungibleTokens: z.ZodOptional<z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodString, z.ZodLiteral<true>]>>>;
|
|
1785
1783
|
}, z.core.$strict>>;
|
|
1786
1784
|
selectable: z.ZodOptional<z.ZodBoolean>;
|
|
1785
|
+
relevant: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>;
|
|
1787
1786
|
privacy: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
1788
1787
|
}, z.core.$strict>>>;
|
|
1789
1788
|
state: z.ZodOptional<z.ZodObject<{
|
|
@@ -1875,6 +1874,7 @@ declare const xoTemplateSchema: z.ZodObject<{
|
|
|
1875
1874
|
nonfungibleTokens: z.ZodOptional<z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodString, z.ZodLiteral<true>]>>>;
|
|
1876
1875
|
}, z.core.$strict>>;
|
|
1877
1876
|
selectable: z.ZodOptional<z.ZodBoolean>;
|
|
1877
|
+
relevant: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>;
|
|
1878
1878
|
privacy: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
1879
1879
|
}, z.core.$strict>>>;
|
|
1880
1880
|
}, z.core.$strict>>;
|
|
@@ -1889,9 +1889,6 @@ declare const xoTemplateSchema: z.ZodObject<{
|
|
|
1889
1889
|
readonly INTEGER: "integer";
|
|
1890
1890
|
readonly BIGINT: "bigint";
|
|
1891
1891
|
readonly STRING: "string";
|
|
1892
|
-
}>;
|
|
1893
|
-
value: z.ZodUnknown;
|
|
1894
|
-
hint: z.ZodOptional<z.ZodEnum<{
|
|
1895
1892
|
readonly PRIVATE_KEY: "private_key";
|
|
1896
1893
|
readonly PUBLIC_KEY: "public_key";
|
|
1897
1894
|
readonly EXTENDED_PUBLIC_KEY: "extended_public_key";
|
|
@@ -1902,10 +1899,13 @@ declare const xoTemplateSchema: z.ZodObject<{
|
|
|
1902
1899
|
readonly TIMESTAMP: "timestamp";
|
|
1903
1900
|
readonly TOKEN_CATEGORY: "token_category";
|
|
1904
1901
|
readonly NFT_COMMITMENT: "nft_commitment";
|
|
1902
|
+
readonly LOCKING_SCRIPT: "locking_script";
|
|
1905
1903
|
readonly TRANSACTION_HASH: "transaction_hash";
|
|
1906
1904
|
readonly TEMPLATE_IDENTIFIER: "template_identifier";
|
|
1907
1905
|
readonly SCHNORR_SIGNATURE: "signature";
|
|
1908
|
-
}
|
|
1906
|
+
}>;
|
|
1907
|
+
value: z.ZodUnknown;
|
|
1908
|
+
hint: z.ZodOptional<z.ZodUnknown>;
|
|
1909
1909
|
}, z.core.$strict>>>;
|
|
1910
1910
|
variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
1911
1911
|
name: z.ZodString;
|
|
@@ -1917,8 +1917,6 @@ declare const xoTemplateSchema: z.ZodObject<{
|
|
|
1917
1917
|
readonly INTEGER: "integer";
|
|
1918
1918
|
readonly BIGINT: "bigint";
|
|
1919
1919
|
readonly STRING: "string";
|
|
1920
|
-
}>>;
|
|
1921
|
-
hint: z.ZodOptional<z.ZodEnum<{
|
|
1922
1920
|
readonly PRIVATE_KEY: "private_key";
|
|
1923
1921
|
readonly PUBLIC_KEY: "public_key";
|
|
1924
1922
|
readonly EXTENDED_PUBLIC_KEY: "extended_public_key";
|
|
@@ -1929,10 +1927,12 @@ declare const xoTemplateSchema: z.ZodObject<{
|
|
|
1929
1927
|
readonly TIMESTAMP: "timestamp";
|
|
1930
1928
|
readonly TOKEN_CATEGORY: "token_category";
|
|
1931
1929
|
readonly NFT_COMMITMENT: "nft_commitment";
|
|
1930
|
+
readonly LOCKING_SCRIPT: "locking_script";
|
|
1932
1931
|
readonly TRANSACTION_HASH: "transaction_hash";
|
|
1933
1932
|
readonly TEMPLATE_IDENTIFIER: "template_identifier";
|
|
1934
1933
|
readonly SCHNORR_SIGNATURE: "signature";
|
|
1935
1934
|
}>>;
|
|
1935
|
+
hint: z.ZodOptional<z.ZodUnknown>;
|
|
1936
1936
|
importDefaultValue: z.ZodOptional<z.ZodObject<{
|
|
1937
1937
|
templateIdentifier: z.ZodOptional<z.ZodString>;
|
|
1938
1938
|
role: z.ZodOptional<z.ZodString>;
|
|
@@ -1980,8 +1980,8 @@ type CompileCashAssemblyStringParameters = {
|
|
|
1980
1980
|
*/
|
|
1981
1981
|
evaluationDecodeMode?: CompiledCashAssemblyDecodeMode;
|
|
1982
1982
|
/**
|
|
1983
|
-
* Optional template variable definitions. When provided, each `<name.method>` push whose `
|
|
1984
|
-
* maps to a
|
|
1983
|
+
* Optional template variable definitions. When provided, each `<name.method>` push whose `type`
|
|
1984
|
+
* maps to a method resolvable primitive class is resolved to bytes before CashAssembly compilation.
|
|
1985
1985
|
*/
|
|
1986
1986
|
templateVariables?: XOTemplate['variables'];
|
|
1987
1987
|
};
|
|
@@ -2057,11 +2057,11 @@ declare const compileCashAssemblyEvaluations: (evaluations: string[]) => Compile
|
|
|
2057
2057
|
* @param {CompiledCashAssemblyDecodeMode} [parameters.evaluationDecodeMode='utf8'] - The decode mode used
|
|
2058
2058
|
* after each evaluation is compiled. See {@link decodeCompiledCashAssemblyEvaluation}.
|
|
2059
2059
|
* @param {XOTemplate['variables']} [parameters.templateVariables] - Optional template variable definitions
|
|
2060
|
-
* used to resolve
|
|
2060
|
+
* used to resolve method resolvable `<name.method>` pushes via each variable's `type`.
|
|
2061
2061
|
* @returns {string} Compiled text with all evaluations replaced by decoded string values.
|
|
2062
2062
|
* @throws {@link CashAssemblyRequiredVariableMissingError} When a required variable is not present in the variables map.
|
|
2063
|
-
* @throws {@link CashAssemblyPrimitiveMethodMissingError} When a
|
|
2064
|
-
* @throws {@link CashAssemblyPrimitiveVariableMissingError} When a
|
|
2063
|
+
* @throws {@link CashAssemblyPrimitiveMethodMissingError} When a method resolvable primitive type has an unknown method.
|
|
2064
|
+
* @throws {@link CashAssemblyPrimitiveVariableMissingError} When a method resolvable primitive method is missing its runtime value.
|
|
2065
2065
|
* @throws {@link CashAssemblyUnsupportedValueTypeError} When a primitive method return type cannot be embedded as bytes.
|
|
2066
2066
|
* @throws {@link CashAssemblyNumberNotSafeIntegerError} When a number variable is not a safe integer.
|
|
2067
2067
|
* @throws {@link CashAssemblyVmNumberDecodeError} When `evaluationDecodeMode` is `bigint` and an evaluation is not a VM number.
|
|
@@ -2084,21 +2084,21 @@ type ResolvePrimitiveMethodBytesParameters = {
|
|
|
2084
2084
|
variables: Record<string, unknown>;
|
|
2085
2085
|
/**
|
|
2086
2086
|
* Template variable definitions. When omitted, no primitive methods are resolved.
|
|
2087
|
-
* The `
|
|
2087
|
+
* The `type` on each entry selects the primitive class.
|
|
2088
2088
|
*/
|
|
2089
2089
|
templateVariables?: XOTemplate['variables'];
|
|
2090
2090
|
};
|
|
2091
2091
|
/**
|
|
2092
|
-
* Resolves
|
|
2092
|
+
* Resolves method resolvable `base.method` identifiers to CashAssembly variable bytes.
|
|
2093
2093
|
*
|
|
2094
|
-
* Each single dot identifier whose `
|
|
2095
|
-
* the full identifier (`base.method`).
|
|
2094
|
+
* Each single dot identifier whose `type` is in `RESOLVABLE_PRIMITIVE_CLASS_BY_TYPE` is resolved and stored under
|
|
2095
|
+
* the full identifier (`base.method`). Other template types or multi dot identifiers are left for CashAssembly.
|
|
2096
2096
|
*
|
|
2097
2097
|
* When `templateVariables` is omitted, returns an empty map.
|
|
2098
2098
|
*
|
|
2099
2099
|
* @param {ResolvePrimitiveMethodBytesParameters} parameters - Identifiers, values, and optional template metadata.
|
|
2100
2100
|
* @returns {Record<string, Uint8Array>} Resolved method identifiers mapped to bytes for CashAssembly pushes.
|
|
2101
|
-
* @throws {@link CashAssemblyPrimitiveMethodMissingError} When the
|
|
2101
|
+
* @throws {@link CashAssemblyPrimitiveMethodMissingError} When the type is method resolvable but the method is missing.
|
|
2102
2102
|
* @throws {@link CashAssemblyPrimitiveVariableMissingError} When the runtime value is missing from the variables map.
|
|
2103
2103
|
* @throws {@link CashAssemblyUnsupportedValueTypeError} When the method return type cannot be embedded.
|
|
2104
2104
|
* @throws {@link CashAssemblyNumberNotSafeIntegerError} When a method return value is a number that is not a safe integer.
|
|
@@ -2172,7 +2172,7 @@ declare const CASHASSEMBLY_LITERAL_TOKEN_PATTERN: RegExp;
|
|
|
2172
2172
|
* `requestedSatoshis` does not match (no method)
|
|
2173
2173
|
* `key.schnorr_signature.all_outputs` does not match (more than one dot)
|
|
2174
2174
|
* `key.public_key` matches the pattern shape but it is only resolved
|
|
2175
|
-
* when `
|
|
2175
|
+
* when `type` maps to a primitive
|
|
2176
2176
|
*/
|
|
2177
2177
|
declare const CASHASSEMBLY_VARIABLE_METHOD_REFERENCE_PATTERN: RegExp;
|
|
2178
2178
|
//#endregion
|
|
@@ -2196,10 +2196,10 @@ declare class CashAssemblyVariableTypeMismatchError extends Error {
|
|
|
2196
2196
|
constructor(variableKey: string, expectedType: string, actualType: string);
|
|
2197
2197
|
}
|
|
2198
2198
|
/**
|
|
2199
|
-
* Error thrown when a
|
|
2199
|
+
* Error thrown when a method resolvable primitive type does not expose the requested method.
|
|
2200
2200
|
*/
|
|
2201
2201
|
declare class CashAssemblyPrimitiveMethodMissingError extends Error {
|
|
2202
|
-
constructor(identifier: string, methodName: string,
|
|
2202
|
+
constructor(identifier: string, methodName: string, type: string);
|
|
2203
2203
|
}
|
|
2204
2204
|
/**
|
|
2205
2205
|
* Error thrown when a value cannot be resolved as bytes.
|
|
@@ -2214,7 +2214,7 @@ declare class CashAssemblyNumberNotSafeIntegerError extends Error {
|
|
|
2214
2214
|
constructor(identifier: string, value: number);
|
|
2215
2215
|
}
|
|
2216
2216
|
/**
|
|
2217
|
-
* Error thrown when a
|
|
2217
|
+
* Error thrown when a method resolvable primitive is selected but its value is missing from the variables map.
|
|
2218
2218
|
*/
|
|
2219
2219
|
declare class CashAssemblyPrimitiveVariableMissingError extends Error {
|
|
2220
2220
|
constructor(identifier: string, variableName: string);
|
|
@@ -2237,5 +2237,5 @@ declare class CashAssemblyVmNumberDecodeError extends Error {
|
|
|
2237
2237
|
*/
|
|
2238
2238
|
declare const serializeTemplate: (template: XOTemplate) => string;
|
|
2239
2239
|
//#endregion
|
|
2240
|
-
export { AsyncPushIterator, CASHASSEMBLY_EVALUATION_PATTERN, CASHASSEMBLY_EXPRESSION_PATTERN, CASHASSEMBLY_LITERAL_TOKEN_PATTERN, CASHASSEMBLY_VARIABLE_METHOD_REFERENCE_PATTERN, CASHASSEMBLY_VARIABLE_PATTERN, CashAssemblyCompilationFailedError, CashAssemblyNumberNotSafeIntegerError, CashAssemblyPrimitiveMethodMissingError, CashAssemblyPrimitiveVariableMissingError, CashAssemblyRequiredVariableMissingError, CashAssemblyUnsupportedValueTypeError, CashAssemblyVariableTypeMismatchError, CashAssemblyVmNumberDecodeError, CompileCashAssemblyStringParameters, CompiledCashAssemblyDecodeMode, EventEmitter, EventMap, ExponentialBackoff, ExponentialBackoffCallbackParameters, ExponentialBackoffExternallyAbortable, ExponentialBackoffExternallyAbortableOptions, ExponentialBackoffMaxRetriesHitError, ExponentialBackoffNonIntegerError, ExponentialBackoffNumberNotFiniteError, ExponentialBackoffNumberOutOfBoundsError, ExponentialBackoffNumberTooSmallError, ExponentialBackoffOptions, ExponentialBackoffRunOptions, ExponentialBackoffStaticRunOptions, ExponentialBackoffStopRetriesFunction, ExponentialBackoffStoppedRetriesError, ExternallyAbortedExponentialBackoffExternalSignalAbortedError, ExternallyAbortedExponentialBackoffInternalSignalAbortedError, OffCallback, ResolvePrimitiveMethodBytesParameters, SSEEventParser, SSEEventParserOptions, TemplateInvalidError, TemplateJsonMalformedError, TemplateSerializationFailedError, VIEW_PROPERTIES_DESCRIPTION_MAX_LENGTH, VIEW_PROPERTIES_ICON_MAX_LENGTH, VIEW_PROPERTIES_NAME_MAX_LENGTH, WaitForTimeoutError, bchVmVersionSchema, buildErrorDescription, compileCashAssemblyEvaluations, compileCashAssemblyString, convertValueToBytes, decodeCompiledCashAssemblyEvaluation, extendedJsonReplacer, extendedJsonReviver, extractCashAssemblyEvaluations, extractVariablesFromEvaluations, fromExtendedJson, generateCashAssemblyBytecode, generateTemplateIdentifier, isCashAssemblyExpression, parseTemplate, resolvePrimitiveMethodBytes, satoshisSchema, scriptToScriptHash, serializeTemplate, toExtendedJson, uint8ArraySchema, xoTemplateActionIntentSchema, xoTemplateActionRequirementsSchema, xoTemplateActionRoleRequirementsSchema, xoTemplateActionRoleSchema, xoTemplateActionSchema, xoTemplateAssetAmountsSchema,
|
|
2240
|
+
export { AsyncPushIterator, CASHASSEMBLY_EVALUATION_PATTERN, CASHASSEMBLY_EXPRESSION_PATTERN, CASHASSEMBLY_LITERAL_TOKEN_PATTERN, CASHASSEMBLY_VARIABLE_METHOD_REFERENCE_PATTERN, CASHASSEMBLY_VARIABLE_PATTERN, CashAssemblyCompilationFailedError, CashAssemblyNumberNotSafeIntegerError, CashAssemblyPrimitiveMethodMissingError, CashAssemblyPrimitiveVariableMissingError, CashAssemblyRequiredVariableMissingError, CashAssemblyUnsupportedValueTypeError, CashAssemblyVariableTypeMismatchError, CashAssemblyVmNumberDecodeError, CompileCashAssemblyStringParameters, CompiledCashAssemblyDecodeMode, EventEmitter, EventMap, ExponentialBackoff, ExponentialBackoffCallbackParameters, ExponentialBackoffExternallyAbortable, ExponentialBackoffExternallyAbortableOptions, ExponentialBackoffMaxRetriesHitError, ExponentialBackoffNonIntegerError, ExponentialBackoffNumberNotFiniteError, ExponentialBackoffNumberOutOfBoundsError, ExponentialBackoffNumberTooSmallError, ExponentialBackoffOptions, ExponentialBackoffRunOptions, ExponentialBackoffStaticRunOptions, ExponentialBackoffStopRetriesFunction, ExponentialBackoffStoppedRetriesError, ExternallyAbortedExponentialBackoffExternalSignalAbortedError, ExternallyAbortedExponentialBackoffInternalSignalAbortedError, OffCallback, ResolvePrimitiveMethodBytesParameters, SSEEventParser, SSEEventParserOptions, TemplateInvalidError, TemplateJsonMalformedError, TemplateSerializationFailedError, VIEW_PROPERTIES_DESCRIPTION_MAX_LENGTH, VIEW_PROPERTIES_ICON_MAX_LENGTH, VIEW_PROPERTIES_NAME_MAX_LENGTH, WaitForTimeoutError, bchVmVersionSchema, buildErrorDescription, compileCashAssemblyEvaluations, compileCashAssemblyString, convertValueToBytes, decodeCompiledCashAssemblyEvaluation, extendedJsonReplacer, extendedJsonReviver, extractCashAssemblyEvaluations, extractVariablesFromEvaluations, fromExtendedJson, generateCashAssemblyBytecode, generateTemplateIdentifier, isCashAssemblyExpression, parseTemplate, resolvePrimitiveMethodBytes, satoshisSchema, scriptToScriptHash, serializeTemplate, toExtendedJson, uint8ArraySchema, xoTemplateActionIntentSchema, xoTemplateActionRequirementsSchema, xoTemplateActionRoleRequirementsSchema, xoTemplateActionRoleSchema, xoTemplateActionSchema, xoTemplateAssetAmountsSchema, xoTemplateConstantSchema, xoTemplateDataSchema, xoTemplateDefaultsSchema, xoTemplateIconSchema, xoTemplateImportDefaultValueSchema, xoTemplateInputSchema, xoTemplateIntentSchema, xoTemplateLockingScriptIntentSchema, xoTemplateLockingScriptRoleSchema, xoTemplateLockingScriptSchema, xoTemplateLockingTypeSchema, xoTemplateNftCapabilitySchema, xoTemplateNonFungibleTokenDetailsSchema, xoTemplateOutputIntentSchema, xoTemplateOutputSchema, xoTemplatePrimitiveTypeSchema, xoTemplateResourceSchema, xoTemplateRoleSlotSchema, xoTemplateRoleSlotsRequirementsSchema, xoTemplateSchema, xoTemplateStateSchema, xoTemplateTokenSchema, xoTemplateTransactionInputSchema, xoTemplateTransactionOutputSchema, xoTemplateTransactionRoleDataSchema, xoTemplateTransactionSchema, xoTemplateVariableSchema, xoTemplateViewPropertiesSchema };
|
|
2241
2241
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../source/errors.ts","../source/event-emitter.ts","../source/exponential-backoff/errors.ts","../source/exponential-backoff/exponential-backoff.ts","../source/exponential-backoff/exponential-backoff-externally-aborted.ts","../source/extended-json.ts","../source/script.ts","../source/sse-session/async-push-iterator.ts","../source/sse-session/types.ts","../source/sse-session/sse-event-parser.ts","../source/template/errors.ts","../source/template/identifier.ts","../source/template/parser.ts","../source/template/schemas.ts","../source/cash-assembly/evaluations.ts","../source/cash-assembly/primitive-evaluations.ts","../source/cash-assembly/bytes.ts","../source/cash-assembly/defaults.ts","../source/cash-assembly/errors.ts","../source/template/serialization.ts"],"mappings":";;;;;;;;;cAGa,mBAAA,SAA4B,KAAA;cACzB,IAAA;AAAA;;;KCCJ,QAAA,GAAW,MAAA;AAAA,KAElB,QAAA,OAAe,MAAA,EAAQ,CAAA;;;;KAuBhB,WAAA;AD3BZ;;;;AAAA,cCiCa,YAAA,WAAuB,QAAA;EAAA;EDhCpB;;;;;;ACChB;EA6CI,EAAA,iBAAmB,CAA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;;;;;;;;;;EQFpC,WAAA,CAAY,KAAA,EAAO,UAAA,GAAa,OAAA;ER8GA;;;;;;;EAAA,QQ1E/B,gBAAA;ERhFc;;;;;;EAAA,QQ4Fd,SAAA;ER9Ec;;;;;EAAA,QQiHd,UAAA;ERjHoF;;;;;;EAAA,QQ+HpF,aAAA;ER/F4C;;;;;;EAAA,QQ4G5C,mBAAA;AAAA;;;;;;;;AT3LZ;;cUQa,qBAAA,GAAyB,MAAA,EAAQ,SAAA;;;;cA0BjC,oBAAA,SAA6B,KAAA;cAC1B,OAAA;AAAA;;;;cAUH,0BAAA,SAAmC,KAAA;cAChC,MAAA;AAAA;;;AT5C+B;cSqDlC,gCAAA,SAAyC,KAAA;cACtC,MAAA;AAAA;;;;;;;;AVxDhB;;;cWSa,0BAAA,GAA8B,QAAA,EAAU,UAAA;;;;;;;;AXTrD;;;;;;cYaa,aAAA,GAAiB,aAAA,WAAwB,UAAA,KAAa,UAAA;;;;;;;;AZbnE;;;;;;;;cakBa,kBAAA,EAAkB,CAAA,CAAA,OAAA;EAAA;;;;;;;;AZhBgB;;;;;;;;;AAyB/C;;;;;AAMA;;;;;AA/B+C,cYqClC,6BAAA,EAA6B,CAAA,CAAA,OAAA;EAAA;;;;;;;;;;;;;;;;;;cAgB7B,2BAAA,EAA2B,CAAA,CAAA,OAAA;EAAA;;;;;;;;cAM3B,
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../source/errors.ts","../source/event-emitter.ts","../source/exponential-backoff/errors.ts","../source/exponential-backoff/exponential-backoff.ts","../source/exponential-backoff/exponential-backoff-externally-aborted.ts","../source/extended-json.ts","../source/script.ts","../source/sse-session/async-push-iterator.ts","../source/sse-session/types.ts","../source/sse-session/sse-event-parser.ts","../source/template/errors.ts","../source/template/identifier.ts","../source/template/parser.ts","../source/template/schemas.ts","../source/cash-assembly/evaluations.ts","../source/cash-assembly/primitive-evaluations.ts","../source/cash-assembly/bytes.ts","../source/cash-assembly/defaults.ts","../source/c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uB;;;;;;;;;AAyB/C;;;cckIa,2BAAA,GAA+B,UAAA,EAAY,qCAAA,KAAwC,MAAA,SAAe,UAAA;;;;;;;;;Af7J/G;;;cgBSa,mBAAA,GAAuB,KAAA,WAAgB,eAAA,aAA0B,UAAA;;;;;;;;;AhBT9E;;;;;;ciBSa,+BAAA,EAA+B,MAAA;;;;;;AhBP5C;;;;;cgBmBa,+BAAA,EAA+B,MAAA;;;;;;;;;AhBM5C;;cgBMa,6BAAA,EAA6B,MAAA;;;AhBA1C;;;;;;cgBUa,kCAAA,EAAkC,MAAA;;;;;;;;;;;;;cAclC,8CAAA,EAA8C,MAAA;;;;;;cCvD9C,wCAAA,SAAiD,KAAA;cAC9C,aAAA;AAAA;AlBHhB;;;AAAA,ckBgBa,kCAAA,SAA2C,KAAA;cACxC,OAAA;AAAA;;;;cASH,qCAAA,SAA8C,KAAA;cAC3C,WAAA,UAAqB,YAAA,UAAsB,UAAA;AAAA;AjBzB3D;;;AAAA,ciBkCa,uCAAA,SAAgD,KAAA;cAC7C,UAAA,UAAoB,UAAA,UAAoB,IAAA;AAAA;;;;cAS3C,qCAAA,SAA8C,KAAA;cAC3C,UAAA,UAAoB,YAAA;AAAA;;;AjBpBpC;ciB6Ba,qCAAA,SAA8C,KAAA;cAC3C,UAAA,UAAoB,KAAA;AAAA;;AjBxBpC;;ciBiCa,yCAAA,SAAkD,KAAA;cAC/C,UAAA,UAAoB,YAAA;AAAA;;;;cASvB,+BAAA,SAAwC,KAAA;cACrC,MAAA;AAAA;;;;;;;;AlB7EhB;;;cmBSa,iBAAA,GAAqB,QAAA,EAAU,UAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { bigIntToVmNumber, binToHex, binToUtf8, createCompilerBch, hexToBin, sha256, utf8ToBin, vmNumberToBigInt } from "@bitauth/libauth";
|
|
2
|
-
import { BchVmVersions,
|
|
2
|
+
import { BchVmVersions, XOTemplateLockingTypes, XOTemplateNftCapabilities, XOTemplatePrimitiveTypes } from "@xo-cash/types";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { FungibleTokenAmount, NFTCommitment, PublicKey, Satoshis, SchnorrSignature, TemplateIdentifier, Timestamp, TokenCategory, TransactionHash } from "@xo-cash/primitives";
|
|
5
5
|
|
|
@@ -1027,11 +1027,6 @@ const xoTemplateNftCapabilitySchema = z.enum(XOTemplateNftCapabilities);
|
|
|
1027
1027
|
*/
|
|
1028
1028
|
const xoTemplateLockingTypeSchema = z.enum(XOTemplateLockingTypes);
|
|
1029
1029
|
/**
|
|
1030
|
-
* Validation schema for a base type identifier.
|
|
1031
|
-
* Accepts values from XOTemplateBaseTypes for the `type` field on constants, variables, and data.
|
|
1032
|
-
*/
|
|
1033
|
-
const xoTemplateBaseTypeSchema = z.enum(XOTemplateBaseTypes);
|
|
1034
|
-
/**
|
|
1035
1030
|
* Validation schema for a primitive type identifier.
|
|
1036
1031
|
* Accepts values from XOTemplatePrimitiveTypes for the `hint` field on constants, variables, and data.
|
|
1037
1032
|
*/
|
|
@@ -1352,6 +1347,7 @@ const xoTemplateLockingScriptRoleSchema = xoTemplateViewPropertiesSchema.partial
|
|
|
1352
1347
|
actions: z.array(xoTemplateActionIntentSchema).optional().describe("List of action references available to this role."),
|
|
1353
1348
|
balance: xoTemplateAssetAmountsSchema.partial().optional().describe("Estimated ownership in the optional set of asset amounts specified."),
|
|
1354
1349
|
selectable: z.boolean().optional().describe("Whether outputs locked to this script should be available for coin selection."),
|
|
1350
|
+
relevant: z.union([z.boolean(), z.string()]).optional().describe("Whether this output or locking script should be tracked by the engine, When omitted, the engine treats this field as true.Accepts true, false, or a CashASM expression that evaluates to a boolean relevance value."),
|
|
1355
1351
|
privacy: z.union([z.number(), z.string()]).optional().describe("Privacy level for outputs locked to this script. A numeric level or a CashASM expression that evaluates to a privacy level.")
|
|
1356
1352
|
}).strict();
|
|
1357
1353
|
/**
|
|
@@ -1504,9 +1500,9 @@ const xoTemplateTransactionSchema = xoTemplateViewPropertiesSchema.extend({
|
|
|
1504
1500
|
* ```
|
|
1505
1501
|
*/
|
|
1506
1502
|
const xoTemplateConstantSchema = xoTemplateViewPropertiesSchema.extend({
|
|
1507
|
-
type:
|
|
1503
|
+
type: xoTemplatePrimitiveTypeSchema.describe("The data type of this constant."),
|
|
1508
1504
|
value: z.unknown().describe("The value of this constant."),
|
|
1509
|
-
hint:
|
|
1505
|
+
hint: z.unknown().optional().describe("An optional hint to help apps and users understand what this constant represents.")
|
|
1510
1506
|
}).strict();
|
|
1511
1507
|
/**
|
|
1512
1508
|
* Validation schema for a data field definition.
|
|
@@ -1520,9 +1516,9 @@ const xoTemplateConstantSchema = xoTemplateViewPropertiesSchema.extend({
|
|
|
1520
1516
|
* ```
|
|
1521
1517
|
*/
|
|
1522
1518
|
const xoTemplateDataSchema = z.object({
|
|
1523
|
-
type:
|
|
1519
|
+
type: xoTemplatePrimitiveTypeSchema.describe("The data type of this data field."),
|
|
1524
1520
|
value: z.unknown().describe("The value for this data field."),
|
|
1525
|
-
hint:
|
|
1521
|
+
hint: z.unknown().optional().describe("An optional hint to help apps and users understand this data field.")
|
|
1526
1522
|
}).strict();
|
|
1527
1523
|
/**
|
|
1528
1524
|
* Validation schema for an import default value intent. Extends the base intent with optional
|
|
@@ -1551,8 +1547,8 @@ const xoTemplateImportDefaultValueSchema = xoTemplateIntentSchema.extend(xoTempl
|
|
|
1551
1547
|
* ```
|
|
1552
1548
|
*/
|
|
1553
1549
|
const xoTemplateVariableSchema = xoTemplateViewPropertiesSchema.extend({
|
|
1554
|
-
type:
|
|
1555
|
-
hint:
|
|
1550
|
+
type: xoTemplatePrimitiveTypeSchema.optional().describe("The data type of this variable."),
|
|
1551
|
+
hint: z.unknown().optional().describe("A hint to help users understand what value to provide."),
|
|
1556
1552
|
importDefaultValue: xoTemplateImportDefaultValueSchema.optional().describe("A neutral intent that the engine uses to populate the default value for this variable.")
|
|
1557
1553
|
}).strict();
|
|
1558
1554
|
/**
|
|
@@ -1664,11 +1660,11 @@ var CashAssemblyVariableTypeMismatchError = class extends Error {
|
|
|
1664
1660
|
}
|
|
1665
1661
|
};
|
|
1666
1662
|
/**
|
|
1667
|
-
* Error thrown when a
|
|
1663
|
+
* Error thrown when a method resolvable primitive type does not expose the requested method.
|
|
1668
1664
|
*/
|
|
1669
1665
|
var CashAssemblyPrimitiveMethodMissingError = class extends Error {
|
|
1670
|
-
constructor(identifier, methodName,
|
|
1671
|
-
super(`CashAssembly primitive method does not exist: identifier "${identifier}", methodName "${methodName}",
|
|
1666
|
+
constructor(identifier, methodName, type) {
|
|
1667
|
+
super(`CashAssembly primitive method does not exist: identifier "${identifier}", methodName "${methodName}", type "${type}"`);
|
|
1672
1668
|
}
|
|
1673
1669
|
};
|
|
1674
1670
|
/**
|
|
@@ -1688,7 +1684,7 @@ var CashAssemblyNumberNotSafeIntegerError = class extends Error {
|
|
|
1688
1684
|
}
|
|
1689
1685
|
};
|
|
1690
1686
|
/**
|
|
1691
|
-
* Error thrown when a
|
|
1687
|
+
* Error thrown when a method resolvable primitive is selected but its value is missing from the variables map.
|
|
1692
1688
|
*/
|
|
1693
1689
|
var CashAssemblyPrimitiveVariableMissingError = class extends Error {
|
|
1694
1690
|
constructor(identifier, variableName) {
|
|
@@ -1760,7 +1756,7 @@ const CASHASSEMBLY_LITERAL_TOKEN_PATTERN = /^[0-9"']/;
|
|
|
1760
1756
|
* `requestedSatoshis` does not match (no method)
|
|
1761
1757
|
* `key.schnorr_signature.all_outputs` does not match (more than one dot)
|
|
1762
1758
|
* `key.public_key` matches the pattern shape but it is only resolved
|
|
1763
|
-
* when `
|
|
1759
|
+
* when `type` maps to a primitive
|
|
1764
1760
|
*/
|
|
1765
1761
|
const CASHASSEMBLY_VARIABLE_METHOD_REFERENCE_PATTERN = /^([^.]+)\.([^.]+)$/;
|
|
1766
1762
|
|
|
@@ -1790,10 +1786,10 @@ const convertValueToBytes = (value, valueIdentifier) => {
|
|
|
1790
1786
|
//#endregion
|
|
1791
1787
|
//#region source/cash-assembly/primitive-evaluations.ts
|
|
1792
1788
|
/**
|
|
1793
|
-
*
|
|
1794
|
-
* Keys are
|
|
1789
|
+
* Maps method resolvable template types to `@xo-cash/primitives` classes for `base.method` resolution.
|
|
1790
|
+
* Keys are a subset of {@link XOTemplatePrimitiveTypes}.
|
|
1795
1791
|
*/
|
|
1796
|
-
const
|
|
1792
|
+
const RESOLVABLE_PRIMITIVE_CLASS_BY_TYPE = {
|
|
1797
1793
|
[XOTemplatePrimitiveTypes.FUNGIBLE_TOKEN_AMOUNT]: FungibleTokenAmount,
|
|
1798
1794
|
[XOTemplatePrimitiveTypes.NFT_COMMITMENT]: NFTCommitment,
|
|
1799
1795
|
[XOTemplatePrimitiveTypes.PUBLIC_KEY]: PublicKey,
|
|
@@ -1805,55 +1801,55 @@ const PRIMITIVE_BY_TEMPLATE_HINT = {
|
|
|
1805
1801
|
[XOTemplatePrimitiveTypes.TRANSACTION_HASH]: TransactionHash
|
|
1806
1802
|
};
|
|
1807
1803
|
/**
|
|
1808
|
-
* Returns true when `
|
|
1804
|
+
* Returns true when `type` maps to a primitive class in `RESOLVABLE_PRIMITIVE_CLASS_BY_TYPE` for method resolution.
|
|
1809
1805
|
*
|
|
1810
|
-
* @param {XOTemplatePrimitiveType | undefined}
|
|
1811
|
-
* @returns {boolean} True when the
|
|
1806
|
+
* @param {XOTemplatePrimitiveType | undefined} type - Template variable type.
|
|
1807
|
+
* @returns {boolean} True when the type can resolve `base.method` through a primitive class.
|
|
1812
1808
|
*/
|
|
1813
|
-
const
|
|
1814
|
-
return
|
|
1809
|
+
const isResolvablePrimitiveType = (type) => {
|
|
1810
|
+
return type !== void 0 && Object.hasOwn(RESOLVABLE_PRIMITIVE_CLASS_BY_TYPE, type) === true;
|
|
1815
1811
|
};
|
|
1816
1812
|
/**
|
|
1817
|
-
* Returns true when `methodName` is an own function on the primitive class for `
|
|
1813
|
+
* Returns true when `methodName` is an own function on the primitive class for `type`.
|
|
1818
1814
|
*
|
|
1819
|
-
* @param {
|
|
1815
|
+
* @param {ResolvablePrimitiveType} type - Method resolvable template type.
|
|
1820
1816
|
* @param {string} methodName - Method name from the evaluation text, for example `toSatoshis`.
|
|
1821
1817
|
* @returns {boolean} True when that class exposes the named method.
|
|
1822
1818
|
*/
|
|
1823
|
-
const canResolvePrimitiveMethod = (
|
|
1824
|
-
const PrimitiveClass =
|
|
1819
|
+
const canResolvePrimitiveMethod = (type, methodName) => {
|
|
1820
|
+
const PrimitiveClass = RESOLVABLE_PRIMITIVE_CLASS_BY_TYPE[type];
|
|
1825
1821
|
if (Object.hasOwn(PrimitiveClass.prototype, methodName) === false) return false;
|
|
1826
1822
|
return typeof Reflect.get(PrimitiveClass.prototype, methodName) === "function";
|
|
1827
1823
|
};
|
|
1828
1824
|
/**
|
|
1829
1825
|
* Constructs a primitive from a raw value and calls one instance method on it.
|
|
1830
1826
|
*
|
|
1831
|
-
* Call only after `canResolvePrimitiveMethod` is true for the same
|
|
1827
|
+
* Call only after `canResolvePrimitiveMethod` is true for the same type and method.
|
|
1832
1828
|
*
|
|
1833
|
-
* @param {CallPrimitiveMethodParameters} parameters - Identifier, method, value, and
|
|
1829
|
+
* @param {CallPrimitiveMethodParameters} parameters - Identifier, method, value, and resolvable type.
|
|
1834
1830
|
* @returns {unknown} Method return value, later encoded as CashAssembly push bytes.
|
|
1835
1831
|
* @throws {@link CashAssemblyPrimitiveMethodMissingError} When the prototype member is not a function.
|
|
1836
1832
|
* @throws When the primitive constructor rejects the raw value (validation errors from `@xo-cash/primitives`).
|
|
1837
1833
|
*/
|
|
1838
1834
|
const callPrimitiveMethod = (parameters) => {
|
|
1839
|
-
const { identifier, methodName, value,
|
|
1840
|
-
const PrimitiveClass =
|
|
1835
|
+
const { identifier, methodName, value, type } = parameters;
|
|
1836
|
+
const PrimitiveClass = RESOLVABLE_PRIMITIVE_CLASS_BY_TYPE[type];
|
|
1841
1837
|
const primitiveInstance = new PrimitiveClass(value);
|
|
1842
1838
|
const primitiveMethod = Reflect.get(PrimitiveClass.prototype, methodName);
|
|
1843
|
-
if (typeof primitiveMethod !== "function") throw new CashAssemblyPrimitiveMethodMissingError(identifier, methodName,
|
|
1839
|
+
if (typeof primitiveMethod !== "function") throw new CashAssemblyPrimitiveMethodMissingError(identifier, methodName, type);
|
|
1844
1840
|
return primitiveMethod.call(primitiveInstance);
|
|
1845
1841
|
};
|
|
1846
1842
|
/**
|
|
1847
|
-
* Resolves
|
|
1843
|
+
* Resolves method resolvable `base.method` identifiers to CashAssembly variable bytes.
|
|
1848
1844
|
*
|
|
1849
|
-
* Each single dot identifier whose `
|
|
1850
|
-
* the full identifier (`base.method`).
|
|
1845
|
+
* Each single dot identifier whose `type` is in `RESOLVABLE_PRIMITIVE_CLASS_BY_TYPE` is resolved and stored under
|
|
1846
|
+
* the full identifier (`base.method`). Other template types or multi dot identifiers are left for CashAssembly.
|
|
1851
1847
|
*
|
|
1852
1848
|
* When `templateVariables` is omitted, returns an empty map.
|
|
1853
1849
|
*
|
|
1854
1850
|
* @param {ResolvePrimitiveMethodBytesParameters} parameters - Identifiers, values, and optional template metadata.
|
|
1855
1851
|
* @returns {Record<string, Uint8Array>} Resolved method identifiers mapped to bytes for CashAssembly pushes.
|
|
1856
|
-
* @throws {@link CashAssemblyPrimitiveMethodMissingError} When the
|
|
1852
|
+
* @throws {@link CashAssemblyPrimitiveMethodMissingError} When the type is method resolvable but the method is missing.
|
|
1857
1853
|
* @throws {@link CashAssemblyPrimitiveVariableMissingError} When the runtime value is missing from the variables map.
|
|
1858
1854
|
* @throws {@link CashAssemblyUnsupportedValueTypeError} When the method return type cannot be embedded.
|
|
1859
1855
|
* @throws {@link CashAssemblyNumberNotSafeIntegerError} When a method return value is a number that is not a safe integer.
|
|
@@ -1868,15 +1864,15 @@ const resolvePrimitiveMethodBytes = (parameters) => {
|
|
|
1868
1864
|
if (methodReferenceMatch === null) continue;
|
|
1869
1865
|
const [, baseName, methodName] = methodReferenceMatch;
|
|
1870
1866
|
if (Object.hasOwn(templateVariables, baseName) === false) continue;
|
|
1871
|
-
const
|
|
1872
|
-
if (
|
|
1873
|
-
if (canResolvePrimitiveMethod(
|
|
1867
|
+
const type = templateVariables[baseName].type;
|
|
1868
|
+
if (isResolvablePrimitiveType(type) === false) continue;
|
|
1869
|
+
if (canResolvePrimitiveMethod(type, methodName) === false) throw new CashAssemblyPrimitiveMethodMissingError(identifier, methodName, type);
|
|
1874
1870
|
if (Object.hasOwn(variables, baseName) === false) throw new CashAssemblyPrimitiveVariableMissingError(identifier, baseName);
|
|
1875
1871
|
resolvedBytes[identifier] = convertValueToBytes(callPrimitiveMethod({
|
|
1876
1872
|
identifier,
|
|
1877
1873
|
methodName,
|
|
1878
1874
|
value: variables[baseName],
|
|
1879
|
-
|
|
1875
|
+
type
|
|
1880
1876
|
}), identifier);
|
|
1881
1877
|
}
|
|
1882
1878
|
return resolvedBytes;
|
|
@@ -2021,11 +2017,11 @@ const compileCashAssemblyEvaluations = (evaluations) => {
|
|
|
2021
2017
|
* @param {CompiledCashAssemblyDecodeMode} [parameters.evaluationDecodeMode='utf8'] - The decode mode used
|
|
2022
2018
|
* after each evaluation is compiled. See {@link decodeCompiledCashAssemblyEvaluation}.
|
|
2023
2019
|
* @param {XOTemplate['variables']} [parameters.templateVariables] - Optional template variable definitions
|
|
2024
|
-
* used to resolve
|
|
2020
|
+
* used to resolve method resolvable `<name.method>` pushes via each variable's `type`.
|
|
2025
2021
|
* @returns {string} Compiled text with all evaluations replaced by decoded string values.
|
|
2026
2022
|
* @throws {@link CashAssemblyRequiredVariableMissingError} When a required variable is not present in the variables map.
|
|
2027
|
-
* @throws {@link CashAssemblyPrimitiveMethodMissingError} When a
|
|
2028
|
-
* @throws {@link CashAssemblyPrimitiveVariableMissingError} When a
|
|
2023
|
+
* @throws {@link CashAssemblyPrimitiveMethodMissingError} When a method resolvable primitive type has an unknown method.
|
|
2024
|
+
* @throws {@link CashAssemblyPrimitiveVariableMissingError} When a method resolvable primitive method is missing its runtime value.
|
|
2029
2025
|
* @throws {@link CashAssemblyUnsupportedValueTypeError} When a primitive method return type cannot be embedded as bytes.
|
|
2030
2026
|
* @throws {@link CashAssemblyNumberNotSafeIntegerError} When a number variable is not a safe integer.
|
|
2031
2027
|
* @throws {@link CashAssemblyVmNumberDecodeError} When `evaluationDecodeMode` is `bigint` and an evaluation is not a VM number.
|
|
@@ -2057,5 +2053,5 @@ const compileCashAssemblyString = (parameters) => {
|
|
|
2057
2053
|
};
|
|
2058
2054
|
|
|
2059
2055
|
//#endregion
|
|
2060
|
-
export { AsyncPushIterator, CASHASSEMBLY_EVALUATION_PATTERN, CASHASSEMBLY_EXPRESSION_PATTERN, CASHASSEMBLY_LITERAL_TOKEN_PATTERN, CASHASSEMBLY_VARIABLE_METHOD_REFERENCE_PATTERN, CASHASSEMBLY_VARIABLE_PATTERN, CashAssemblyCompilationFailedError, CashAssemblyNumberNotSafeIntegerError, CashAssemblyPrimitiveMethodMissingError, CashAssemblyPrimitiveVariableMissingError, CashAssemblyRequiredVariableMissingError, CashAssemblyUnsupportedValueTypeError, CashAssemblyVariableTypeMismatchError, CashAssemblyVmNumberDecodeError, EventEmitter, ExponentialBackoff, ExponentialBackoffExternallyAbortable, ExponentialBackoffMaxRetriesHitError, ExponentialBackoffNonIntegerError, ExponentialBackoffNumberNotFiniteError, ExponentialBackoffNumberOutOfBoundsError, ExponentialBackoffNumberTooSmallError, ExponentialBackoffStoppedRetriesError, ExternallyAbortedExponentialBackoffExternalSignalAbortedError, ExternallyAbortedExponentialBackoffInternalSignalAbortedError, SSEEventParser, TemplateInvalidError, TemplateJsonMalformedError, TemplateSerializationFailedError, VIEW_PROPERTIES_DESCRIPTION_MAX_LENGTH, VIEW_PROPERTIES_ICON_MAX_LENGTH, VIEW_PROPERTIES_NAME_MAX_LENGTH, WaitForTimeoutError, bchVmVersionSchema, buildErrorDescription, compileCashAssemblyEvaluations, compileCashAssemblyString, convertValueToBytes, decodeCompiledCashAssemblyEvaluation, extendedJsonReplacer, extendedJsonReviver, extractCashAssemblyEvaluations, extractVariablesFromEvaluations, fromExtendedJson, generateCashAssemblyBytecode, generateTemplateIdentifier, isCashAssemblyExpression, parseTemplate, resolvePrimitiveMethodBytes, satoshisSchema, scriptToScriptHash, serializeTemplate, toExtendedJson, uint8ArraySchema, xoTemplateActionIntentSchema, xoTemplateActionRequirementsSchema, xoTemplateActionRoleRequirementsSchema, xoTemplateActionRoleSchema, xoTemplateActionSchema, xoTemplateAssetAmountsSchema,
|
|
2056
|
+
export { AsyncPushIterator, CASHASSEMBLY_EVALUATION_PATTERN, CASHASSEMBLY_EXPRESSION_PATTERN, CASHASSEMBLY_LITERAL_TOKEN_PATTERN, CASHASSEMBLY_VARIABLE_METHOD_REFERENCE_PATTERN, CASHASSEMBLY_VARIABLE_PATTERN, CashAssemblyCompilationFailedError, CashAssemblyNumberNotSafeIntegerError, CashAssemblyPrimitiveMethodMissingError, CashAssemblyPrimitiveVariableMissingError, CashAssemblyRequiredVariableMissingError, CashAssemblyUnsupportedValueTypeError, CashAssemblyVariableTypeMismatchError, CashAssemblyVmNumberDecodeError, EventEmitter, ExponentialBackoff, ExponentialBackoffExternallyAbortable, ExponentialBackoffMaxRetriesHitError, ExponentialBackoffNonIntegerError, ExponentialBackoffNumberNotFiniteError, ExponentialBackoffNumberOutOfBoundsError, ExponentialBackoffNumberTooSmallError, ExponentialBackoffStoppedRetriesError, ExternallyAbortedExponentialBackoffExternalSignalAbortedError, ExternallyAbortedExponentialBackoffInternalSignalAbortedError, SSEEventParser, TemplateInvalidError, TemplateJsonMalformedError, TemplateSerializationFailedError, VIEW_PROPERTIES_DESCRIPTION_MAX_LENGTH, VIEW_PROPERTIES_ICON_MAX_LENGTH, VIEW_PROPERTIES_NAME_MAX_LENGTH, WaitForTimeoutError, bchVmVersionSchema, buildErrorDescription, compileCashAssemblyEvaluations, compileCashAssemblyString, convertValueToBytes, decodeCompiledCashAssemblyEvaluation, extendedJsonReplacer, extendedJsonReviver, extractCashAssemblyEvaluations, extractVariablesFromEvaluations, fromExtendedJson, generateCashAssemblyBytecode, generateTemplateIdentifier, isCashAssemblyExpression, parseTemplate, resolvePrimitiveMethodBytes, satoshisSchema, scriptToScriptHash, serializeTemplate, toExtendedJson, uint8ArraySchema, xoTemplateActionIntentSchema, xoTemplateActionRequirementsSchema, xoTemplateActionRoleRequirementsSchema, xoTemplateActionRoleSchema, xoTemplateActionSchema, xoTemplateAssetAmountsSchema, xoTemplateConstantSchema, xoTemplateDataSchema, xoTemplateDefaultsSchema, xoTemplateIconSchema, xoTemplateImportDefaultValueSchema, xoTemplateInputSchema, xoTemplateIntentSchema, xoTemplateLockingScriptIntentSchema, xoTemplateLockingScriptRoleSchema, xoTemplateLockingScriptSchema, xoTemplateLockingTypeSchema, xoTemplateNftCapabilitySchema, xoTemplateNonFungibleTokenDetailsSchema, xoTemplateOutputIntentSchema, xoTemplateOutputSchema, xoTemplatePrimitiveTypeSchema, xoTemplateResourceSchema, xoTemplateRoleSlotSchema, xoTemplateRoleSlotsRequirementsSchema, xoTemplateSchema, xoTemplateStateSchema, xoTemplateTokenSchema, xoTemplateTransactionInputSchema, xoTemplateTransactionOutputSchema, xoTemplateTransactionRoleDataSchema, xoTemplateTransactionSchema, xoTemplateVariableSchema, xoTemplateViewPropertiesSchema };
|
|
2061
2057
|
//# sourceMappingURL=index.mjs.map
|