@biglup/cometa 1.0.7 → 1.0.112
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 +276 -10
- package/dist/cjs/index.d.mts +1304 -381
- package/dist/cjs/index.d.ts +1304 -381
- package/dist/cjs/index.js +2 -13
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.d.mts +1304 -381
- package/dist/esm/index.d.ts +1304 -381
- package/dist/esm/index.js +2 -13
- package/dist/esm/index.js.map +1 -1
- package/dist/iife/index.global.js +8 -0
- package/dist/iife/index.global.js.map +1 -0
- package/package.json +5 -2
package/dist/cjs/index.d.mts
CHANGED
|
@@ -1004,6 +1004,13 @@ declare const uint8ArrayToHex: (byteArray: Uint8Array) => string;
|
|
|
1004
1004
|
* @returns {Uint8Array} The converted Uint8Array.
|
|
1005
1005
|
*/
|
|
1006
1006
|
declare const utf8ToUint8Array: (str: string) => Uint8Array;
|
|
1007
|
+
/**
|
|
1008
|
+
* Converts a UTF-8 string to its hex string representation.
|
|
1009
|
+
*
|
|
1010
|
+
* @param {string} str - The UTF-8 string to convert.
|
|
1011
|
+
* @returns {string} The hex string representation of the UTF-8 string.
|
|
1012
|
+
*/
|
|
1013
|
+
declare const utf8ToHex: (str: string) => string;
|
|
1007
1014
|
/**
|
|
1008
1015
|
* Converts a Uint8Array to a UTF-8 string.
|
|
1009
1016
|
*
|
|
@@ -1011,6 +1018,15 @@ declare const utf8ToUint8Array: (str: string) => Uint8Array;
|
|
|
1011
1018
|
* @returns {string} The converted UTF-8 string.
|
|
1012
1019
|
*/
|
|
1013
1020
|
declare const uint8ArrayToUtf8: (uint8Array: Uint8Array) => string;
|
|
1021
|
+
/**
|
|
1022
|
+
* Decodes a Base64 encoded string to a Uint8Array.
|
|
1023
|
+
* This function is isomorphic, providing an optimized path for Node.js
|
|
1024
|
+
* and a universal fallback for browsers.
|
|
1025
|
+
*
|
|
1026
|
+
* @param {string} base64 - The Base64 encoded string to decode.
|
|
1027
|
+
* @returns {Uint8Array} A Uint8Array containing the decoded bytes.
|
|
1028
|
+
*/
|
|
1029
|
+
declare const base64ToBytes: (base64: string) => Uint8Array;
|
|
1014
1030
|
/**
|
|
1015
1031
|
* A simple state tracker to manually signal when an async operation,
|
|
1016
1032
|
* callable from WASM, has been initiated.
|
|
@@ -1038,11 +1054,11 @@ interface Anchor {
|
|
|
1038
1054
|
*/
|
|
1039
1055
|
declare enum Vote {
|
|
1040
1056
|
/** A vote against the governance action. */
|
|
1041
|
-
|
|
1057
|
+
No = 0,
|
|
1042
1058
|
/** A vote in favor of the governance action. */
|
|
1043
|
-
|
|
1059
|
+
Yes = 1,
|
|
1044
1060
|
/** A vote to abstain, neither for nor against the action. */
|
|
1045
|
-
|
|
1061
|
+
Abstain = 2
|
|
1046
1062
|
}
|
|
1047
1063
|
/**
|
|
1048
1064
|
* Encapsulates a single voting action, including the vote itself
|
|
@@ -1123,6 +1139,49 @@ declare const isDRepNoConfidence: (drep: DRep) => drep is AlwaysNoConfidence;
|
|
|
1123
1139
|
* @returns {boolean} True if the DRep is of the 'Credential' type.
|
|
1124
1140
|
*/
|
|
1125
1141
|
declare const isDRepCredential: (drep: DRep) => drep is Credential;
|
|
1142
|
+
/**
|
|
1143
|
+
* Deserializes a Bech32-encoded governance action ID string into a GovernanceActionId object.
|
|
1144
|
+
*
|
|
1145
|
+
* This function parses a governance action ID string (e.g., "gov_action1...") according to the
|
|
1146
|
+
* [CIP-129](https://cips.cardano.org/cip/CIP-129) specification and returns a structured object
|
|
1147
|
+
* containing the transaction ID and action index.
|
|
1148
|
+
*
|
|
1149
|
+
* @param {string} bech32 - The CIP-129 formatted, Bech32-encoded governance action ID string.
|
|
1150
|
+
* @returns {GovernanceActionId} A structured object representing the governance action ID.
|
|
1151
|
+
* @throws {Error} Throws an error if the Bech32 string is malformed or invalid.
|
|
1152
|
+
* @see {@link https://cips.cardano.org/cip/CIP-129|CIP-129} for the official specification.
|
|
1153
|
+
* @example
|
|
1154
|
+
* const bech32Id = 'gov_action1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpzklpgpf';
|
|
1155
|
+
* const govActionId = govActionIdFromBech32(bech32Id);
|
|
1156
|
+
*
|
|
1157
|
+
* console.log(govActionId.id);
|
|
1158
|
+
* //-> "0000000000000000000000000000000000000000000000000000000000000000"
|
|
1159
|
+
*
|
|
1160
|
+
* console.log(govActionId.actionIndex);
|
|
1161
|
+
* //-> 11
|
|
1162
|
+
*/
|
|
1163
|
+
declare const govActionIdFromBech32: (bech32: string) => GovernanceActionId;
|
|
1164
|
+
/**
|
|
1165
|
+
* Serializes a GovernanceActionId object into its Bech32 string representation.
|
|
1166
|
+
*
|
|
1167
|
+
* This function converts a structured GovernanceActionId object (containing a transaction ID
|
|
1168
|
+
* and action index) into its CIP-129 formatted Bech32 string (e.g., "gov_action1...").
|
|
1169
|
+
*
|
|
1170
|
+
* @param {GovernanceActionId} govActionId - The structured object to serialize.
|
|
1171
|
+
* @returns {string} The Bech32-encoded governance action ID string.
|
|
1172
|
+
* @throws {Error} Throws an error if the serialization fails.
|
|
1173
|
+
* @see {@link https://cips.cardano.org/cip/CIP-129|CIP-129} for the official specification.
|
|
1174
|
+
* @example
|
|
1175
|
+
* const govActionId = {
|
|
1176
|
+
* id: '0000000000000000000000000000000000000000000000000000000000000000',
|
|
1177
|
+
* actionIndex: 11
|
|
1178
|
+
* };
|
|
1179
|
+
* const bech32Id = govActionIdToBech32(govActionId);
|
|
1180
|
+
*
|
|
1181
|
+
* console.log(bech32Id);
|
|
1182
|
+
* //-> "gov_action1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpzklpgpf"
|
|
1183
|
+
*/
|
|
1184
|
+
declare const govActionIdToBech32: (govActionId: GovernanceActionId) => string;
|
|
1126
1185
|
|
|
1127
1186
|
/**
|
|
1128
1187
|
* This relay points to a single host via its ipv4/ipv6 address and a given port.
|
|
@@ -1572,6 +1631,291 @@ interface CostModel {
|
|
|
1572
1631
|
costs: number[];
|
|
1573
1632
|
}
|
|
1574
1633
|
|
|
1634
|
+
/** Plutus script type. */
|
|
1635
|
+
declare enum ScriptType {
|
|
1636
|
+
Native = "native",
|
|
1637
|
+
Plutus = "plutus"
|
|
1638
|
+
}
|
|
1639
|
+
/** native script kind. */
|
|
1640
|
+
declare enum NativeScriptKind {
|
|
1641
|
+
RequireSignature = 0,
|
|
1642
|
+
RequireAllOf = 1,
|
|
1643
|
+
RequireAnyOf = 2,
|
|
1644
|
+
RequireNOf = 3,
|
|
1645
|
+
RequireTimeAfter = 4,
|
|
1646
|
+
RequireTimeBefore = 5
|
|
1647
|
+
}
|
|
1648
|
+
/**
|
|
1649
|
+
* This script evaluates to true if the transaction also includes a valid key witness
|
|
1650
|
+
* where the witness verification key hashes to the given hash.
|
|
1651
|
+
*
|
|
1652
|
+
* In other words, this checks that the transaction is signed by a particular key, identified by its verification
|
|
1653
|
+
* key hash.
|
|
1654
|
+
*/
|
|
1655
|
+
interface RequireSignatureScript {
|
|
1656
|
+
/** Script type. */
|
|
1657
|
+
type: ScriptType.Native;
|
|
1658
|
+
/** The hash of a verification key. */
|
|
1659
|
+
keyHash: string;
|
|
1660
|
+
/** The native script kind. */
|
|
1661
|
+
kind: NativeScriptKind.RequireSignature;
|
|
1662
|
+
}
|
|
1663
|
+
/**
|
|
1664
|
+
* This script evaluates to true if all the sub-scripts evaluate to true.
|
|
1665
|
+
*
|
|
1666
|
+
* If the list of sub-scripts is empty, this script evaluates to true.
|
|
1667
|
+
*/
|
|
1668
|
+
interface RequireAllOfScript {
|
|
1669
|
+
/** Script type. */
|
|
1670
|
+
type: ScriptType.Native;
|
|
1671
|
+
/** The list of sub-scripts. */
|
|
1672
|
+
scripts: NativeScript[];
|
|
1673
|
+
/** The native script kind. */
|
|
1674
|
+
kind: NativeScriptKind.RequireAllOf;
|
|
1675
|
+
}
|
|
1676
|
+
/**
|
|
1677
|
+
* This script evaluates to true if any the sub-scripts evaluate to true. That is, if one
|
|
1678
|
+
* or more evaluate to true.
|
|
1679
|
+
*
|
|
1680
|
+
* If the list of sub-scripts is empty, this script evaluates to false.
|
|
1681
|
+
*/
|
|
1682
|
+
interface RequireAnyOfScript {
|
|
1683
|
+
/** Script type. */
|
|
1684
|
+
type: ScriptType.Native;
|
|
1685
|
+
/** The list of sub-scripts. */
|
|
1686
|
+
scripts: NativeScript[];
|
|
1687
|
+
/** The native script kind. */
|
|
1688
|
+
kind: NativeScriptKind.RequireAnyOf;
|
|
1689
|
+
}
|
|
1690
|
+
/** This script evaluates to true if at least M (required field) of the sub-scripts evaluate to true. */
|
|
1691
|
+
interface RequireAtLeastScript {
|
|
1692
|
+
/** Script type. */
|
|
1693
|
+
type: ScriptType.Native;
|
|
1694
|
+
/** The number of sub-scripts that must evaluate to true for this script to evaluate to true. */
|
|
1695
|
+
required: number;
|
|
1696
|
+
/** The list of sub-scripts. */
|
|
1697
|
+
scripts: NativeScript[];
|
|
1698
|
+
/** The native script kind. */
|
|
1699
|
+
kind: NativeScriptKind.RequireNOf;
|
|
1700
|
+
}
|
|
1701
|
+
/**
|
|
1702
|
+
* This script evaluates to true if the upper bound of the transaction validity interval is a
|
|
1703
|
+
* slot number Y, and X <= Y.
|
|
1704
|
+
*
|
|
1705
|
+
* This condition guarantees that the actual slot number in which the transaction is included is
|
|
1706
|
+
* (strictly) less than slot number X.
|
|
1707
|
+
*/
|
|
1708
|
+
interface RequireTimeBeforeScript {
|
|
1709
|
+
/** Script type. */
|
|
1710
|
+
type: ScriptType.Native;
|
|
1711
|
+
/** The slot number specifying the upper bound of the validity interval. */
|
|
1712
|
+
slot: number;
|
|
1713
|
+
/** The native script kind. */
|
|
1714
|
+
kind: NativeScriptKind.RequireTimeBefore;
|
|
1715
|
+
}
|
|
1716
|
+
/**
|
|
1717
|
+
* This script evaluates to true if the lower bound of the transaction validity interval is a
|
|
1718
|
+
* slot number Y, and Y <= X.
|
|
1719
|
+
*
|
|
1720
|
+
* This condition guarantees that the actual slot number in which the transaction is included
|
|
1721
|
+
* is greater than or equal to slot number X.
|
|
1722
|
+
*/
|
|
1723
|
+
interface RequireTimeAfterScript {
|
|
1724
|
+
/** Script type. */
|
|
1725
|
+
type: ScriptType.Native;
|
|
1726
|
+
/** The slot number specifying the lower bound of the validity interval. */
|
|
1727
|
+
slot: number;
|
|
1728
|
+
/** The native script kind. */
|
|
1729
|
+
kind: NativeScriptKind.RequireTimeAfter;
|
|
1730
|
+
}
|
|
1731
|
+
/**
|
|
1732
|
+
* The Native scripts form an expression tree, the evaluation of the script produces either true or false.
|
|
1733
|
+
*
|
|
1734
|
+
* Note that it is recursive. There are no constraints on the nesting or size, except that imposed by the overall
|
|
1735
|
+
* transaction size limit (given that the script must be included in the transaction in a script witnesses).
|
|
1736
|
+
*/
|
|
1737
|
+
type NativeScript = RequireAllOfScript | RequireSignatureScript | RequireAnyOfScript | RequireAtLeastScript | RequireTimeBeforeScript | RequireTimeAfterScript;
|
|
1738
|
+
/**
|
|
1739
|
+
* The Cardano ledger tags scripts with a language that determines what the ledger will do with the script.
|
|
1740
|
+
*
|
|
1741
|
+
* In most cases this language will be very similar to the ones that came before, we refer to these as
|
|
1742
|
+
* 'Plutus language versions'. However, from the ledger’s perspective they are entirely unrelated and there
|
|
1743
|
+
* is generally no requirement that they be similar or compatible in any way.
|
|
1744
|
+
*/
|
|
1745
|
+
declare enum PlutusLanguageVersion {
|
|
1746
|
+
/** V1 was the initial version of Plutus, introduced in the Alonzo hard fork. */
|
|
1747
|
+
V1 = 0,
|
|
1748
|
+
/**
|
|
1749
|
+
* V2 was introduced in the Vasil hard fork.
|
|
1750
|
+
*
|
|
1751
|
+
* The main changes in V2 of Plutus were to the interface to scripts. The ScriptContext was extended
|
|
1752
|
+
* to include the following information:
|
|
1753
|
+
*
|
|
1754
|
+
* - The full “redeemers” structure, which contains all the redeemers used in the transaction
|
|
1755
|
+
* - Reference inputs in the transaction (proposed in CIP-31)
|
|
1756
|
+
* - Inline datums in the transaction (proposed in CIP-32)
|
|
1757
|
+
* - Reference scripts in the transaction (proposed in CIP-33)
|
|
1758
|
+
*/
|
|
1759
|
+
V2 = 1,
|
|
1760
|
+
/**
|
|
1761
|
+
* V3 was introduced in the Conway hard fork.
|
|
1762
|
+
*
|
|
1763
|
+
* The main changes in V3 of Plutus introduce:
|
|
1764
|
+
*
|
|
1765
|
+
* - The value of costmdls map at key 2 is encoded as a definite length list.
|
|
1766
|
+
*/
|
|
1767
|
+
V3 = 2
|
|
1768
|
+
}
|
|
1769
|
+
/**
|
|
1770
|
+
* Plutus scripts are pieces of code that implement pure functions with True or False outputs. These functions take
|
|
1771
|
+
* several inputs such as Datum, Redeemer and the transaction context to decide whether an output can be spent or not.
|
|
1772
|
+
*/
|
|
1773
|
+
interface PlutusScript {
|
|
1774
|
+
type: ScriptType.Plutus;
|
|
1775
|
+
bytes: string;
|
|
1776
|
+
version: PlutusLanguageVersion;
|
|
1777
|
+
}
|
|
1778
|
+
/** Program that decides whether the transaction that spends the output is authorized to do so. */
|
|
1779
|
+
type Script = NativeScript | PlutusScript;
|
|
1780
|
+
/**
|
|
1781
|
+
* Predicate that returns true if the given core script is a native script.
|
|
1782
|
+
*
|
|
1783
|
+
* @param script The Script to check.
|
|
1784
|
+
*/
|
|
1785
|
+
declare const isNativeScript: (script: Script) => script is NativeScript;
|
|
1786
|
+
/**
|
|
1787
|
+
* Predicate that returns true if the given core script is a plutus script.
|
|
1788
|
+
*
|
|
1789
|
+
* @param script The Script to check.
|
|
1790
|
+
*/
|
|
1791
|
+
declare const isPlutusScript: (script: Script) => script is PlutusScript;
|
|
1792
|
+
/**
|
|
1793
|
+
* Performs a deep equality check on two Script.
|
|
1794
|
+
*
|
|
1795
|
+
* @param a The first Script object.
|
|
1796
|
+
* @param b The second Script object.
|
|
1797
|
+
* @returns True if the objects are deeply equal, false otherwise.
|
|
1798
|
+
*/
|
|
1799
|
+
declare const deepEqualsScript: (a: Script, b: Script) => boolean;
|
|
1800
|
+
/**
|
|
1801
|
+
* Computes the hash of a Script object.
|
|
1802
|
+
*
|
|
1803
|
+
* This function calculates the Blake2b hash of the provided Script.
|
|
1804
|
+
*
|
|
1805
|
+
* @param script The Script object to hash.
|
|
1806
|
+
* @returns The hexadecimal string representation of the hash.
|
|
1807
|
+
*/
|
|
1808
|
+
declare const computeScriptHash: (script: Script) => string;
|
|
1809
|
+
/**
|
|
1810
|
+
* Derives a script address (enterprise address) from a script.
|
|
1811
|
+
*
|
|
1812
|
+
* This function calculates the script's hash, creates a script credential from it,
|
|
1813
|
+
* and then constructs an enterprise address for the specified network.
|
|
1814
|
+
*
|
|
1815
|
+
* @param {Script} script The script (Native or Plutus) from which to derive the address.
|
|
1816
|
+
* @param {NetworkId} networkId The network identifier (e.g., Mainnet or Testnet).
|
|
1817
|
+
* @returns {Address} An Address object representing the script address.
|
|
1818
|
+
* @throws {Error} If any step of the address creation process fails.
|
|
1819
|
+
*/
|
|
1820
|
+
declare const getScriptAddress: (script: Script, networkId: NetworkId) => Address;
|
|
1821
|
+
/**
|
|
1822
|
+
* Serializes a Script object into its CBOR hexadecimal string representation.
|
|
1823
|
+
*
|
|
1824
|
+
* @param data The Script object to serialize.
|
|
1825
|
+
* @returns A hex-encoded CBOR string.
|
|
1826
|
+
*/
|
|
1827
|
+
declare const scriptToCbor: (data: Script) => string;
|
|
1828
|
+
/**
|
|
1829
|
+
* Deserializes a CBOR hexadecimal string into a Script object.
|
|
1830
|
+
*
|
|
1831
|
+
* @param cborHex The hex-encoded CBOR string to deserialize.
|
|
1832
|
+
* @returns The deserialized Script object.
|
|
1833
|
+
*/
|
|
1834
|
+
declare const cborToScript: (cborHex: string) => Script;
|
|
1835
|
+
/**
|
|
1836
|
+
* Converts a json representation of a native script into a NativeScript.
|
|
1837
|
+
*
|
|
1838
|
+
* @param json The JSON representation of a native script. The JSON must conform
|
|
1839
|
+
* to the following format:
|
|
1840
|
+
*
|
|
1841
|
+
* https://github.com/input-output-hk/cardano-node/blob/master/doc/reference/simple-scripts.md
|
|
1842
|
+
*/
|
|
1843
|
+
declare const jsonToNativeScript: (json: any) => NativeScript;
|
|
1844
|
+
/**
|
|
1845
|
+
* Converts a NativeScript into its json representation.
|
|
1846
|
+
*
|
|
1847
|
+
* @param script The native script to be converted to JSON following the format described at:
|
|
1848
|
+
*
|
|
1849
|
+
* https://github.com/input-output-hk/cardano-node/blob/master/doc/reference/simple-scripts.md
|
|
1850
|
+
*/
|
|
1851
|
+
declare const nativeScriptToJson: (script: NativeScript) => any;
|
|
1852
|
+
|
|
1853
|
+
/**
|
|
1854
|
+
* Build a **CIP-105** DRep ID from a governance credential.
|
|
1855
|
+
*
|
|
1856
|
+
* @param credential - Credential containing `type` and hex `hash`.
|
|
1857
|
+
* @returns Bech32-encoded CIP-105 DRep ID (`drep1...` or `drep_script1...`).
|
|
1858
|
+
*/
|
|
1859
|
+
declare const cip105DRepFromCredential: (credential: Credential) => string;
|
|
1860
|
+
/**
|
|
1861
|
+
* Build a **CIP-129** DRep ID from a governance credential.
|
|
1862
|
+
*
|
|
1863
|
+
* Prepends the appropriate 1-byte header (0x22 for key-hash, 0x23 for script-hash)
|
|
1864
|
+
* before Bech32-encoding with HRP `drep`.
|
|
1865
|
+
*
|
|
1866
|
+
* @param credential - Credential containing `type` and hex `hash`.
|
|
1867
|
+
* @returns Bech32-encoded CIP-129 DRep ID (`drep1...`).
|
|
1868
|
+
*/
|
|
1869
|
+
declare const cip129DRepFromCredential: (credential: Credential) => string;
|
|
1870
|
+
/**
|
|
1871
|
+
* Construct a **CIP-129** DRep ID from a public key.
|
|
1872
|
+
* @param publicKey - Hex-encoded Ed25519 public key.
|
|
1873
|
+
*/
|
|
1874
|
+
declare const cip129DRepFromPublicKey: (publicKey: string) => string;
|
|
1875
|
+
/**
|
|
1876
|
+
* Construct a **CIP-129** DRep ID from a script.
|
|
1877
|
+
* @param script - Script that controls the DRep credential.
|
|
1878
|
+
*/
|
|
1879
|
+
declare const cip129DRepFromScript: (script: Script) => string;
|
|
1880
|
+
/**
|
|
1881
|
+
* Decode a DRep ID (CIP-105 or CIP-129) back to a governance credential.
|
|
1882
|
+
*
|
|
1883
|
+
* - For **CIP-105**, the credential type is inferred from the HRP (`drep` vs `drep_script`).
|
|
1884
|
+
* - For **CIP-129**, the credential type is inferred from the header byte.
|
|
1885
|
+
*
|
|
1886
|
+
* @param drepId - Bech32-encoded DRep ID (`drep1...` or `drep_script1...`).
|
|
1887
|
+
* @returns The extracted `Credential` (`{ hash, type }`).
|
|
1888
|
+
* @throws Error if the payload length is not `CIP_105_DREP_ID_LENGTH` or `CIP_129_DREP_ID_LENGTH`,
|
|
1889
|
+
* or if a CIP-129 header does not indicate a DRep governance credential.
|
|
1890
|
+
* @see toCip105DRepID
|
|
1891
|
+
* @see toCip129DRepID
|
|
1892
|
+
*/
|
|
1893
|
+
declare const dRepToCredential: (drepId: string) => Credential;
|
|
1894
|
+
/**
|
|
1895
|
+
* Convert any DRep ID (CIP-105 or CIP-129) to **CIP-105** form.
|
|
1896
|
+
*
|
|
1897
|
+
* @param drepId - Bech32 DRep ID.
|
|
1898
|
+
* @returns CIP-105 DRep ID (`drep1...` or `drep_script1...`).
|
|
1899
|
+
*/
|
|
1900
|
+
declare const toCip105DRepID: (drepId: string) => string;
|
|
1901
|
+
/**
|
|
1902
|
+
* Convert any DRep ID (CIP-105 or CIP-129) to **CIP-129** form.
|
|
1903
|
+
*
|
|
1904
|
+
* @param drepId - Bech32 DRep ID.
|
|
1905
|
+
* @returns CIP-129 DRep ID (`drep1...`).
|
|
1906
|
+
*/
|
|
1907
|
+
declare const toCip129DRepID: (drepId: string) => string;
|
|
1908
|
+
/**
|
|
1909
|
+
* Construct a **mainnet enterprise address** from a DRep ID, if possible.
|
|
1910
|
+
*
|
|
1911
|
+
* Uses the extracted governance credential (key-hash or script-hash) as the payment credential.
|
|
1912
|
+
*
|
|
1913
|
+
* @param drepId - Bech32 DRep ID.
|
|
1914
|
+
* @returns A mainnet `EnterpriseAddress`, or `undefined` if construction fails upstream.
|
|
1915
|
+
* @note This always uses `NetworkId.Mainnet`. If you need testnet, create a variant that accepts a `NetworkId`.
|
|
1916
|
+
*/
|
|
1917
|
+
declare const dRepToAddress: (drepId: string) => EnterpriseAddress | undefined;
|
|
1918
|
+
|
|
1575
1919
|
/**
|
|
1576
1920
|
* Interface representing a unit interval, which is a fraction with a numerator and denominator.
|
|
1577
1921
|
*/
|
|
@@ -1725,371 +2069,152 @@ interface ExUnits {
|
|
|
1725
2069
|
*/
|
|
1726
2070
|
memory: number;
|
|
1727
2071
|
/**
|
|
1728
|
-
* The number of CPU steps.
|
|
1729
|
-
*/
|
|
1730
|
-
steps: number;
|
|
1731
|
-
}
|
|
1732
|
-
|
|
1733
|
-
/**
|
|
1734
|
-
* Interface representing the prices of execution units (ExUnits) in a Plutus script.
|
|
1735
|
-
* It includes the cost of memory and steps, represented as unit intervals.
|
|
1736
|
-
*/
|
|
1737
|
-
interface ExUnitsPrices {
|
|
1738
|
-
/**
|
|
1739
|
-
* The price of memory usage, represented as a unit interval.
|
|
1740
|
-
*/
|
|
1741
|
-
memory: UnitInterval;
|
|
1742
|
-
/**
|
|
1743
|
-
* The price of CPU steps, represented as a unit interval.
|
|
1744
|
-
*/
|
|
1745
|
-
steps: UnitInterval;
|
|
1746
|
-
}
|
|
1747
|
-
|
|
1748
|
-
/**
|
|
1749
|
-
* \brief Enumerates the available Cardano network environments.
|
|
1750
|
-
*
|
|
1751
|
-
* This enumeration defines the different network environments that can be used
|
|
1752
|
-
* with the Cardano provider.
|
|
1753
|
-
*/
|
|
1754
|
-
declare enum NetworkMagic {
|
|
1755
|
-
/**
|
|
1756
|
-
* \brief The Pre-Production test network.
|
|
1757
|
-
*
|
|
1758
|
-
* The Pre-Production network is a Cardano testnet used for testing features
|
|
1759
|
-
* before they are deployed to the Mainnet. It closely mirrors the Mainnet
|
|
1760
|
-
* environment, providing a final testing ground for applications.
|
|
1761
|
-
*/
|
|
1762
|
-
PREPROD = 1,
|
|
1763
|
-
/**
|
|
1764
|
-
* \brief The Preview test network.
|
|
1765
|
-
*
|
|
1766
|
-
* The Preview network is a Cardano testnet used for testing upcoming features
|
|
1767
|
-
* before they are released to the Pre-Production network. It allows developers
|
|
1768
|
-
* to experiment with new functionalities in a controlled environment.
|
|
1769
|
-
*/
|
|
1770
|
-
PREVIEW = 2,
|
|
1771
|
-
/**
|
|
1772
|
-
* \brief The SanchoNet test network.
|
|
1773
|
-
*
|
|
1774
|
-
* SanchoNet is the testnet for rolling out governance features for the Cardano blockchain,
|
|
1775
|
-
* aligning with the comprehensive CIP-1694 specifications.
|
|
1776
|
-
*/
|
|
1777
|
-
SANCHONET = 4,
|
|
1778
|
-
/**
|
|
1779
|
-
* \brief The Mainnet network.
|
|
1780
|
-
*
|
|
1781
|
-
* The Mainnet is the live Cardano network where real transactions occur.
|
|
1782
|
-
* Applications interacting with the Mainnet are dealing with actual ADA and
|
|
1783
|
-
* other assets. Caution should be exercised to ensure correctness and security.
|
|
1784
|
-
*/
|
|
1785
|
-
MAINNET = 764824073
|
|
1786
|
-
}
|
|
1787
|
-
|
|
1788
|
-
/**
|
|
1789
|
-
* Interface representing the voting thresholds for various governance actions that
|
|
1790
|
-
* pool operators can participate in.
|
|
1791
|
-
*/
|
|
1792
|
-
interface PoolVotingThresholds {
|
|
1793
|
-
motionNoConfidence: UnitInterval;
|
|
1794
|
-
committeeNormal: UnitInterval;
|
|
1795
|
-
committeeNoConfidence: UnitInterval;
|
|
1796
|
-
hardForkInitiation: UnitInterval;
|
|
1797
|
-
securityRelevantParamVotingThreshold: UnitInterval;
|
|
1798
|
-
}
|
|
1799
|
-
|
|
1800
|
-
/**
|
|
1801
|
-
* Interface representing a protocol version with major and minor numbers.
|
|
1802
|
-
*/
|
|
1803
|
-
interface ProtocolVersion {
|
|
1804
|
-
major: number;
|
|
1805
|
-
minor: number;
|
|
1806
|
-
}
|
|
1807
|
-
|
|
1808
|
-
/**
|
|
1809
|
-
* Interface representing the protocol parameters of the Cardano blockchain.
|
|
1810
|
-
* These parameters define the rules and limits for transactions, blocks, and governance actions.
|
|
1811
|
-
*/
|
|
1812
|
-
interface ProtocolParameters {
|
|
1813
|
-
minFeeA: number;
|
|
1814
|
-
minFeeB: number;
|
|
1815
|
-
maxBlockBodySize: number;
|
|
1816
|
-
maxTxSize: number;
|
|
1817
|
-
maxBlockHeaderSize: number;
|
|
1818
|
-
keyDeposit: number;
|
|
1819
|
-
poolDeposit: number;
|
|
1820
|
-
maxEpoch: number;
|
|
1821
|
-
nOpt: number;
|
|
1822
|
-
poolPledgeInfluence: UnitInterval;
|
|
1823
|
-
treasuryGrowthRate: UnitInterval;
|
|
1824
|
-
expansionRate: UnitInterval;
|
|
1825
|
-
decentralisationParam: UnitInterval;
|
|
1826
|
-
extraEntropy: string | null;
|
|
1827
|
-
protocolVersion: ProtocolVersion;
|
|
1828
|
-
minPoolCost: number;
|
|
1829
|
-
adaPerUtxoByte: number;
|
|
1830
|
-
costModels: CostModel[];
|
|
1831
|
-
executionCosts: ExUnitsPrices;
|
|
1832
|
-
maxTxExUnits: ExUnits;
|
|
1833
|
-
maxBlockExUnits: ExUnits;
|
|
1834
|
-
maxValueSize: number;
|
|
1835
|
-
collateralPercent: number;
|
|
1836
|
-
maxCollateralInputs: number;
|
|
1837
|
-
poolVotingThresholds: PoolVotingThresholds;
|
|
1838
|
-
drepVotingThresholds: DRepThresholds;
|
|
1839
|
-
minCommitteeSize: number;
|
|
1840
|
-
committeeTermLimit: number;
|
|
1841
|
-
governanceActionValidityPeriod: number;
|
|
1842
|
-
governanceActionDeposit: number;
|
|
1843
|
-
drepDeposit: number;
|
|
1844
|
-
drepInactivityPeriod: number;
|
|
1845
|
-
refScriptCostPerByte: UnitInterval;
|
|
1846
|
-
}
|
|
1847
|
-
/**
|
|
1848
|
-
* Type representing an update to the protocol parameters.
|
|
1849
|
-
* This allows for partial updates to the existing protocol parameters.
|
|
1850
|
-
*/
|
|
1851
|
-
type ProtocolParametersUpdate = Partial<ProtocolParameters>;
|
|
1852
|
-
|
|
1853
|
-
/**
|
|
1854
|
-
* Enum representing the purpose of a redeemer in a Plutus script.
|
|
1855
|
-
* Each purpose corresponds to a specific action that the redeemer is intended to perform.
|
|
1856
|
-
*/
|
|
1857
|
-
declare enum RedeemerPurpose {
|
|
1858
|
-
spend = "spend",
|
|
1859
|
-
mint = "mint",
|
|
1860
|
-
certificate = "certificate",
|
|
1861
|
-
withdrawal = "withdrawal",
|
|
1862
|
-
propose = "propose",
|
|
1863
|
-
vote = "vote"
|
|
1864
|
-
}
|
|
1865
|
-
/**
|
|
1866
|
-
* Interface representing a redeemer for a Plutus script.
|
|
1867
|
-
*/
|
|
1868
|
-
interface Redeemer {
|
|
1869
|
-
index: number;
|
|
1870
|
-
purpose: RedeemerPurpose;
|
|
1871
|
-
data: PlutusData;
|
|
1872
|
-
executionUnits: ExUnits;
|
|
1873
|
-
}
|
|
1874
|
-
|
|
1875
|
-
/** Plutus script type. */
|
|
1876
|
-
declare enum ScriptType {
|
|
1877
|
-
Native = "native",
|
|
1878
|
-
Plutus = "plutus"
|
|
1879
|
-
}
|
|
1880
|
-
/** native script kind. */
|
|
1881
|
-
declare enum NativeScriptKind {
|
|
1882
|
-
RequireSignature = 0,
|
|
1883
|
-
RequireAllOf = 1,
|
|
1884
|
-
RequireAnyOf = 2,
|
|
1885
|
-
RequireNOf = 3,
|
|
1886
|
-
RequireTimeAfter = 4,
|
|
1887
|
-
RequireTimeBefore = 5
|
|
1888
|
-
}
|
|
1889
|
-
/**
|
|
1890
|
-
* This script evaluates to true if the transaction also includes a valid key witness
|
|
1891
|
-
* where the witness verification key hashes to the given hash.
|
|
1892
|
-
*
|
|
1893
|
-
* In other words, this checks that the transaction is signed by a particular key, identified by its verification
|
|
1894
|
-
* key hash.
|
|
1895
|
-
*/
|
|
1896
|
-
interface RequireSignatureScript {
|
|
1897
|
-
/** Script type. */
|
|
1898
|
-
__type: ScriptType.Native;
|
|
1899
|
-
/** The hash of a verification key. */
|
|
1900
|
-
keyHash: string;
|
|
1901
|
-
/** The native script kind. */
|
|
1902
|
-
kind: NativeScriptKind.RequireSignature;
|
|
1903
|
-
}
|
|
1904
|
-
/**
|
|
1905
|
-
* This script evaluates to true if all the sub-scripts evaluate to true.
|
|
1906
|
-
*
|
|
1907
|
-
* If the list of sub-scripts is empty, this script evaluates to true.
|
|
1908
|
-
*/
|
|
1909
|
-
interface RequireAllOfScript {
|
|
1910
|
-
/** Script type. */
|
|
1911
|
-
__type: ScriptType.Native;
|
|
1912
|
-
/** The list of sub-scripts. */
|
|
1913
|
-
scripts: NativeScript[];
|
|
1914
|
-
/** The native script kind. */
|
|
1915
|
-
kind: NativeScriptKind.RequireAllOf;
|
|
1916
|
-
}
|
|
1917
|
-
/**
|
|
1918
|
-
* This script evaluates to true if any the sub-scripts evaluate to true. That is, if one
|
|
1919
|
-
* or more evaluate to true.
|
|
1920
|
-
*
|
|
1921
|
-
* If the list of sub-scripts is empty, this script evaluates to false.
|
|
1922
|
-
*/
|
|
1923
|
-
interface RequireAnyOfScript {
|
|
1924
|
-
/** Script type. */
|
|
1925
|
-
__type: ScriptType.Native;
|
|
1926
|
-
/** The list of sub-scripts. */
|
|
1927
|
-
scripts: NativeScript[];
|
|
1928
|
-
/** The native script kind. */
|
|
1929
|
-
kind: NativeScriptKind.RequireAnyOf;
|
|
1930
|
-
}
|
|
1931
|
-
/** This script evaluates to true if at least M (required field) of the sub-scripts evaluate to true. */
|
|
1932
|
-
interface RequireAtLeastScript {
|
|
1933
|
-
/** Script type. */
|
|
1934
|
-
__type: ScriptType.Native;
|
|
1935
|
-
/** The number of sub-scripts that must evaluate to true for this script to evaluate to true. */
|
|
1936
|
-
required: number;
|
|
1937
|
-
/** The list of sub-scripts. */
|
|
1938
|
-
scripts: NativeScript[];
|
|
1939
|
-
/** The native script kind. */
|
|
1940
|
-
kind: NativeScriptKind.RequireNOf;
|
|
1941
|
-
}
|
|
1942
|
-
/**
|
|
1943
|
-
* This script evaluates to true if the upper bound of the transaction validity interval is a
|
|
1944
|
-
* slot number Y, and X <= Y.
|
|
1945
|
-
*
|
|
1946
|
-
* This condition guarantees that the actual slot number in which the transaction is included is
|
|
1947
|
-
* (strictly) less than slot number X.
|
|
1948
|
-
*/
|
|
1949
|
-
interface RequireTimeBeforeScript {
|
|
1950
|
-
/** Script type. */
|
|
1951
|
-
__type: ScriptType.Native;
|
|
1952
|
-
/** The slot number specifying the upper bound of the validity interval. */
|
|
1953
|
-
slot: number;
|
|
1954
|
-
/** The native script kind. */
|
|
1955
|
-
kind: NativeScriptKind.RequireTimeBefore;
|
|
1956
|
-
}
|
|
1957
|
-
/**
|
|
1958
|
-
* This script evaluates to true if the lower bound of the transaction validity interval is a
|
|
1959
|
-
* slot number Y, and Y <= X.
|
|
1960
|
-
*
|
|
1961
|
-
* This condition guarantees that the actual slot number in which the transaction is included
|
|
1962
|
-
* is greater than or equal to slot number X.
|
|
1963
|
-
*/
|
|
1964
|
-
interface RequireTimeAfterScript {
|
|
1965
|
-
/** Script type. */
|
|
1966
|
-
__type: ScriptType.Native;
|
|
1967
|
-
/** The slot number specifying the lower bound of the validity interval. */
|
|
1968
|
-
slot: number;
|
|
1969
|
-
/** The native script kind. */
|
|
1970
|
-
kind: NativeScriptKind.RequireTimeAfter;
|
|
2072
|
+
* The number of CPU steps.
|
|
2073
|
+
*/
|
|
2074
|
+
steps: number;
|
|
1971
2075
|
}
|
|
2076
|
+
|
|
1972
2077
|
/**
|
|
1973
|
-
*
|
|
1974
|
-
*
|
|
1975
|
-
* Note that it is recursive. There are no constraints on the nesting or size, except that imposed by the overall
|
|
1976
|
-
* transaction size limit (given that the script must be included in the transaction in a script witnesses).
|
|
2078
|
+
* Interface representing the prices of execution units (ExUnits) in a Plutus script.
|
|
2079
|
+
* It includes the cost of memory and steps, represented as unit intervals.
|
|
1977
2080
|
*/
|
|
1978
|
-
|
|
2081
|
+
interface ExUnitsPrices {
|
|
2082
|
+
/**
|
|
2083
|
+
* The price of memory usage, represented as a unit interval.
|
|
2084
|
+
*/
|
|
2085
|
+
memory: UnitInterval;
|
|
2086
|
+
/**
|
|
2087
|
+
* The price of CPU steps, represented as a unit interval.
|
|
2088
|
+
*/
|
|
2089
|
+
steps: UnitInterval;
|
|
2090
|
+
}
|
|
2091
|
+
|
|
1979
2092
|
/**
|
|
1980
|
-
*
|
|
2093
|
+
* Enumerates the available Cardano network environments.
|
|
1981
2094
|
*
|
|
1982
|
-
*
|
|
1983
|
-
*
|
|
1984
|
-
* is generally no requirement that they be similar or compatible in any way.
|
|
2095
|
+
* This enumeration defines the different network environments that can be used
|
|
2096
|
+
* with the Cardano provider.
|
|
1985
2097
|
*/
|
|
1986
|
-
declare enum
|
|
1987
|
-
/** V1 was the initial version of Plutus, introduced in the Alonzo hard fork. */
|
|
1988
|
-
V1 = 0,
|
|
2098
|
+
declare enum NetworkMagic {
|
|
1989
2099
|
/**
|
|
1990
|
-
*
|
|
2100
|
+
* The Pre-Production test network.
|
|
1991
2101
|
*
|
|
1992
|
-
* The
|
|
1993
|
-
* to
|
|
2102
|
+
* The Pre-Production network is a Cardano testnet used for testing features
|
|
2103
|
+
* before they are deployed to the Mainnet. It closely mirrors the Mainnet
|
|
2104
|
+
* environment, providing a final testing ground for applications.
|
|
2105
|
+
*/
|
|
2106
|
+
Preprod = 1,
|
|
2107
|
+
/**
|
|
2108
|
+
* The Preview test network.
|
|
1994
2109
|
*
|
|
1995
|
-
*
|
|
1996
|
-
*
|
|
1997
|
-
*
|
|
1998
|
-
* - Reference scripts in the transaction (proposed in CIP-33)
|
|
2110
|
+
* The Preview network is a Cardano testnet used for testing upcoming features
|
|
2111
|
+
* before they are released to the Pre-Production network. It allows developers
|
|
2112
|
+
* to experiment with new functionalities in a controlled environment.
|
|
1999
2113
|
*/
|
|
2000
|
-
|
|
2114
|
+
Preview = 2,
|
|
2001
2115
|
/**
|
|
2002
|
-
*
|
|
2116
|
+
* The SanchoNet test network.
|
|
2003
2117
|
*
|
|
2004
|
-
*
|
|
2118
|
+
* SanchoNet is the testnet for rolling out governance features for the Cardano blockchain,
|
|
2119
|
+
* aligning with the comprehensive CIP-1694 specifications.
|
|
2120
|
+
*/
|
|
2121
|
+
Sanchonet = 4,
|
|
2122
|
+
/**
|
|
2123
|
+
* The Mainnet network.
|
|
2005
2124
|
*
|
|
2006
|
-
*
|
|
2125
|
+
* The Mainnet is the live Cardano network where real transactions occur.
|
|
2126
|
+
* Applications interacting with the Mainnet are dealing with actual ADA and
|
|
2127
|
+
* other assets. Caution should be exercised to ensure correctness and security.
|
|
2007
2128
|
*/
|
|
2008
|
-
|
|
2129
|
+
Mainnet = 764824073
|
|
2009
2130
|
}
|
|
2131
|
+
|
|
2010
2132
|
/**
|
|
2011
|
-
*
|
|
2012
|
-
*
|
|
2133
|
+
* Interface representing the voting thresholds for various governance actions that
|
|
2134
|
+
* pool operators can participate in.
|
|
2013
2135
|
*/
|
|
2014
|
-
interface
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2136
|
+
interface PoolVotingThresholds {
|
|
2137
|
+
motionNoConfidence: UnitInterval;
|
|
2138
|
+
committeeNormal: UnitInterval;
|
|
2139
|
+
committeeNoConfidence: UnitInterval;
|
|
2140
|
+
hardForkInitiation: UnitInterval;
|
|
2141
|
+
securityRelevantParamVotingThreshold: UnitInterval;
|
|
2018
2142
|
}
|
|
2019
|
-
|
|
2020
|
-
type Script = NativeScript | PlutusScript;
|
|
2021
|
-
/**
|
|
2022
|
-
* Predicate that returns true if the given core script is a native script.
|
|
2023
|
-
*
|
|
2024
|
-
* @param script The Script to check.
|
|
2025
|
-
*/
|
|
2026
|
-
declare const isNativeScript: (script: Script) => script is NativeScript;
|
|
2027
|
-
/**
|
|
2028
|
-
* Predicate that returns true if the given core script is a plutus script.
|
|
2029
|
-
*
|
|
2030
|
-
* @param script The Script to check.
|
|
2031
|
-
*/
|
|
2032
|
-
declare const isPlutusScript: (script: Script) => script is PlutusScript;
|
|
2033
|
-
/**
|
|
2034
|
-
* Performs a deep equality check on two Script.
|
|
2035
|
-
*
|
|
2036
|
-
* @param a The first Script object.
|
|
2037
|
-
* @param b The second Script object.
|
|
2038
|
-
* @returns True if the objects are deeply equal, false otherwise.
|
|
2039
|
-
*/
|
|
2040
|
-
declare const deepEqualsScript: (a: Script, b: Script) => boolean;
|
|
2041
|
-
/**
|
|
2042
|
-
* Computes the hash of a Script object.
|
|
2043
|
-
*
|
|
2044
|
-
* This function calculates the Blake2b hash of the provided Script.
|
|
2045
|
-
*
|
|
2046
|
-
* @param script The Script object to hash.
|
|
2047
|
-
* @returns The hexadecimal string representation of the hash.
|
|
2048
|
-
*/
|
|
2049
|
-
declare const computeScriptHash: (script: Script) => string;
|
|
2143
|
+
|
|
2050
2144
|
/**
|
|
2051
|
-
*
|
|
2052
|
-
*
|
|
2053
|
-
* This function calculates the script's hash, creates a script credential from it,
|
|
2054
|
-
* and then constructs an enterprise address for the specified network.
|
|
2055
|
-
*
|
|
2056
|
-
* @param {Script} script The script (Native or Plutus) from which to derive the address.
|
|
2057
|
-
* @param {NetworkId} networkId The network identifier (e.g., Mainnet or Testnet).
|
|
2058
|
-
* @returns {Address} An Address object representing the script address.
|
|
2059
|
-
* @throws {Error} If any step of the address creation process fails.
|
|
2145
|
+
* Interface representing a protocol version with major and minor numbers.
|
|
2060
2146
|
*/
|
|
2061
|
-
|
|
2147
|
+
interface ProtocolVersion {
|
|
2148
|
+
major: number;
|
|
2149
|
+
minor: number;
|
|
2150
|
+
}
|
|
2151
|
+
|
|
2062
2152
|
/**
|
|
2063
|
-
*
|
|
2064
|
-
*
|
|
2065
|
-
* @param data The Script object to serialize.
|
|
2066
|
-
* @returns A hex-encoded CBOR string.
|
|
2153
|
+
* Interface representing the protocol parameters of the Cardano blockchain.
|
|
2154
|
+
* These parameters define the rules and limits for transactions, blocks, and governance actions.
|
|
2067
2155
|
*/
|
|
2068
|
-
|
|
2156
|
+
interface ProtocolParameters {
|
|
2157
|
+
minFeeA: number;
|
|
2158
|
+
minFeeB: number;
|
|
2159
|
+
maxBlockBodySize: number;
|
|
2160
|
+
maxTxSize: number;
|
|
2161
|
+
maxBlockHeaderSize: number;
|
|
2162
|
+
keyDeposit: number;
|
|
2163
|
+
poolDeposit: number;
|
|
2164
|
+
maxEpoch: number;
|
|
2165
|
+
nOpt: number;
|
|
2166
|
+
poolPledgeInfluence: UnitInterval;
|
|
2167
|
+
treasuryGrowthRate: UnitInterval;
|
|
2168
|
+
expansionRate: UnitInterval;
|
|
2169
|
+
decentralisationParam: UnitInterval;
|
|
2170
|
+
extraEntropy: string | null;
|
|
2171
|
+
protocolVersion: ProtocolVersion;
|
|
2172
|
+
minPoolCost: number;
|
|
2173
|
+
adaPerUtxoByte: number;
|
|
2174
|
+
costModels: CostModel[];
|
|
2175
|
+
executionCosts: ExUnitsPrices;
|
|
2176
|
+
maxTxExUnits: ExUnits;
|
|
2177
|
+
maxBlockExUnits: ExUnits;
|
|
2178
|
+
maxValueSize: number;
|
|
2179
|
+
collateralPercent: number;
|
|
2180
|
+
maxCollateralInputs: number;
|
|
2181
|
+
poolVotingThresholds: PoolVotingThresholds;
|
|
2182
|
+
drepVotingThresholds: DRepThresholds;
|
|
2183
|
+
minCommitteeSize: number;
|
|
2184
|
+
committeeTermLimit: number;
|
|
2185
|
+
governanceActionValidityPeriod: number;
|
|
2186
|
+
governanceActionDeposit: number;
|
|
2187
|
+
drepDeposit: number;
|
|
2188
|
+
drepInactivityPeriod: number;
|
|
2189
|
+
refScriptCostPerByte: UnitInterval;
|
|
2190
|
+
}
|
|
2069
2191
|
/**
|
|
2070
|
-
*
|
|
2071
|
-
*
|
|
2072
|
-
* @param cborHex The hex-encoded CBOR string to deserialize.
|
|
2073
|
-
* @returns The deserialized Script object.
|
|
2192
|
+
* Type representing an update to the protocol parameters.
|
|
2193
|
+
* This allows for partial updates to the existing protocol parameters.
|
|
2074
2194
|
*/
|
|
2075
|
-
|
|
2195
|
+
type ProtocolParametersUpdate = Partial<ProtocolParameters>;
|
|
2196
|
+
|
|
2076
2197
|
/**
|
|
2077
|
-
*
|
|
2078
|
-
*
|
|
2079
|
-
* @param json The JSON representation of a native script. The JSON must conform
|
|
2080
|
-
* to the following format:
|
|
2081
|
-
*
|
|
2082
|
-
* https://github.com/input-output-hk/cardano-node/blob/master/doc/reference/simple-scripts.md
|
|
2198
|
+
* Enum representing the purpose of a redeemer in a Plutus script.
|
|
2199
|
+
* Each purpose corresponds to a specific action that the redeemer is intended to perform.
|
|
2083
2200
|
*/
|
|
2084
|
-
declare
|
|
2201
|
+
declare enum RedeemerPurpose {
|
|
2202
|
+
spend = "spend",
|
|
2203
|
+
mint = "mint",
|
|
2204
|
+
certificate = "certificate",
|
|
2205
|
+
withdrawal = "withdrawal",
|
|
2206
|
+
propose = "propose",
|
|
2207
|
+
vote = "vote"
|
|
2208
|
+
}
|
|
2085
2209
|
/**
|
|
2086
|
-
*
|
|
2087
|
-
*
|
|
2088
|
-
* @param script The native script to be converted to JSON following the format described at:
|
|
2089
|
-
*
|
|
2090
|
-
* https://github.com/input-output-hk/cardano-node/blob/master/doc/reference/simple-scripts.md
|
|
2210
|
+
* Interface representing a redeemer for a Plutus script.
|
|
2091
2211
|
*/
|
|
2092
|
-
|
|
2212
|
+
interface Redeemer {
|
|
2213
|
+
index: number;
|
|
2214
|
+
purpose: RedeemerPurpose;
|
|
2215
|
+
data: PlutusData;
|
|
2216
|
+
executionUnits: ExUnits;
|
|
2217
|
+
}
|
|
2093
2218
|
|
|
2094
2219
|
/**
|
|
2095
2220
|
* Interface representing a transaction input in the Cardano blockchain.
|
|
@@ -4329,6 +4454,28 @@ interface Bip32SecureKeyHandler {
|
|
|
4329
4454
|
* @note During this operation, the root private key is temporarily decrypted in memory and securely wiped immediately after use.
|
|
4330
4455
|
*/
|
|
4331
4456
|
signTransaction(txCbor: string, derivationPaths: DerivationPath[]): Promise<VkeyWitnessSet>;
|
|
4457
|
+
/**
|
|
4458
|
+
* Signs arbitrary data using a BIP32-derived key.
|
|
4459
|
+
* @param data - The hex-encoded data to be signed.
|
|
4460
|
+
* @param derivationPath - The derivation path specifying which key to use for signing.
|
|
4461
|
+
*
|
|
4462
|
+
* @returns {Promise<{ signature: string; key: string }>} A promise that resolves with an object containing the signature and the public key.
|
|
4463
|
+
*/
|
|
4464
|
+
signData(data: string, derivationPath: DerivationPath): Promise<{
|
|
4465
|
+
signature: string;
|
|
4466
|
+
key: string;
|
|
4467
|
+
}>;
|
|
4468
|
+
/**
|
|
4469
|
+
* Retrieves the securely stored private key.
|
|
4470
|
+
*
|
|
4471
|
+
* @param derivationPath - The derivation path specifying which key to retrieve.
|
|
4472
|
+
*
|
|
4473
|
+
* @warning This operation exposes the private key in memory and should be used with extreme caution.
|
|
4474
|
+
* The caller is responsible for securely handling and wiping the key from memory after use.
|
|
4475
|
+
*
|
|
4476
|
+
* @returns {Promise<Ed25519PrivateKey>} A promise that resolves with the private key.
|
|
4477
|
+
*/
|
|
4478
|
+
getPrivateKey(derivationPath: DerivationPath): Promise<Ed25519PrivateKey>;
|
|
4332
4479
|
/**
|
|
4333
4480
|
* Derives and returns an extended account public key from the root key.
|
|
4334
4481
|
*
|
|
@@ -4360,6 +4507,25 @@ interface Ed25519SecureKeyHandler {
|
|
|
4360
4507
|
* @returns {Promise<VkeyWitnessSet>} A promise that resolves with the `VkeyWitnessSet` containing the signature.
|
|
4361
4508
|
*/
|
|
4362
4509
|
signTransaction(transaction: string): Promise<VkeyWitnessSet>;
|
|
4510
|
+
/**
|
|
4511
|
+
* Signs arbitrary data using the securely stored Ed25519 private key.
|
|
4512
|
+
* @param data - The hex-encoded data to be signed.
|
|
4513
|
+
*
|
|
4514
|
+
* @returns {Promise<{ signature: string; key: string }>} A promise that resolves with an object containing the signature and the public key.
|
|
4515
|
+
*/
|
|
4516
|
+
signData(data: string): Promise<{
|
|
4517
|
+
signature: string;
|
|
4518
|
+
key: string;
|
|
4519
|
+
}>;
|
|
4520
|
+
/**
|
|
4521
|
+
* Retrieves the securely stored private key.
|
|
4522
|
+
*
|
|
4523
|
+
* @warning This operation exposes the private key in memory and should be used with extreme caution.
|
|
4524
|
+
* The caller is responsible for securely handling and wiping the key from memory after use.
|
|
4525
|
+
*
|
|
4526
|
+
* @returns {Promise<Ed25519PrivateKey>} A promise that resolves with the private key.
|
|
4527
|
+
*/
|
|
4528
|
+
getPrivateKey(): Promise<Ed25519PrivateKey>;
|
|
4363
4529
|
/**
|
|
4364
4530
|
* Retrieves the public key corresponding to the securely stored private key.
|
|
4365
4531
|
*
|
|
@@ -4412,7 +4578,7 @@ declare class SoftwareBip32SecureKeyHandler implements Bip32SecureKeyHandler {
|
|
|
4412
4578
|
* @returns {Promise<Bip32SecureKeyHandler>} A new instance of the key handler.
|
|
4413
4579
|
* @warning For security, this function will zero out the `entropy` and `passphrase` Uint8Array buffers after they are used. Do not reuse them.
|
|
4414
4580
|
*/
|
|
4415
|
-
static fromEntropy(entropy: Uint8Array, passphrase: Uint8Array, getPassphrase: () => Promise<Uint8Array>):
|
|
4581
|
+
static fromEntropy(entropy: Uint8Array, passphrase: Uint8Array, getPassphrase: () => Promise<Uint8Array>): Bip32SecureKeyHandler;
|
|
4416
4582
|
/**
|
|
4417
4583
|
* Deserializes an encrypted key handler from a byte array.
|
|
4418
4584
|
*
|
|
@@ -4442,6 +4608,28 @@ declare class SoftwareBip32SecureKeyHandler implements Bip32SecureKeyHandler {
|
|
|
4442
4608
|
* @note During this operation, the root key is temporarily decrypted in memory and then securely wiped immediately after use.
|
|
4443
4609
|
*/
|
|
4444
4610
|
signTransaction(txCbor: string, derivationPaths: DerivationPath[]): Promise<VkeyWitnessSet>;
|
|
4611
|
+
/**
|
|
4612
|
+
* Signs arbitrary data using a BIP32-derived key.
|
|
4613
|
+
* @param data - The hex-encoded data to be signed.
|
|
4614
|
+
* @param path - The derivation path specifying which key to use for signing.
|
|
4615
|
+
*
|
|
4616
|
+
* @returns {Promise<{ signature: string; key: string }>} A promise that resolves with an object containing the signature and the public key.
|
|
4617
|
+
*/
|
|
4618
|
+
signData(data: string, path: DerivationPath): Promise<{
|
|
4619
|
+
signature: string;
|
|
4620
|
+
key: string;
|
|
4621
|
+
}>;
|
|
4622
|
+
/**
|
|
4623
|
+
* Retrieves the securely stored private key.
|
|
4624
|
+
*
|
|
4625
|
+
* @param derivationPath - The derivation path specifying which key to retrieve.
|
|
4626
|
+
*
|
|
4627
|
+
* @warning This operation exposes the private key in memory and should be used with extreme caution.
|
|
4628
|
+
* The caller is responsible for securely handling and wiping the key from memory after use.
|
|
4629
|
+
*
|
|
4630
|
+
* @returns {Promise<Ed25519PrivateKey>} A promise that resolves with the private key.
|
|
4631
|
+
*/
|
|
4632
|
+
getPrivateKey(derivationPath: DerivationPath): Promise<Ed25519PrivateKey>;
|
|
4445
4633
|
/**
|
|
4446
4634
|
* Derives and returns an extended account public key.
|
|
4447
4635
|
*
|
|
@@ -4514,6 +4702,25 @@ declare class SoftwareEd25519SecureKeyHandler implements Ed25519SecureKeyHandler
|
|
|
4514
4702
|
* @note During this operation, the private key is temporarily decrypted in memory and then securely wiped immediately after use.
|
|
4515
4703
|
*/
|
|
4516
4704
|
signTransaction(txCbor: string): Promise<VkeyWitnessSet>;
|
|
4705
|
+
/**
|
|
4706
|
+
* Signs arbitrary data using the securely stored Ed25519 private key.
|
|
4707
|
+
* @param data - The hex-encoded data to be signed.
|
|
4708
|
+
*
|
|
4709
|
+
* @returns {Promise<{ signature: string; key: string }>} A promise that resolves with an object containing the signature and the public key.
|
|
4710
|
+
*/
|
|
4711
|
+
signData(data: string): Promise<{
|
|
4712
|
+
signature: string;
|
|
4713
|
+
key: string;
|
|
4714
|
+
}>;
|
|
4715
|
+
/**
|
|
4716
|
+
* Retrieves the securely stored private key.
|
|
4717
|
+
*
|
|
4718
|
+
* @warning This operation exposes the private key in memory and should be used with extreme caution.
|
|
4719
|
+
* The caller is responsible for securely handling and wiping the key from memory after use.
|
|
4720
|
+
*
|
|
4721
|
+
* @returns {Promise<Ed25519PrivateKey>} A promise that resolves with the private key.
|
|
4722
|
+
*/
|
|
4723
|
+
getPrivateKey(): Promise<Ed25519PrivateKey>;
|
|
4517
4724
|
/**
|
|
4518
4725
|
* Retrieves the public key corresponding to the securely stored private key.
|
|
4519
4726
|
*
|
|
@@ -4603,12 +4810,9 @@ declare const readBlake2bHashData: (bufferPtr: number, freeNativeObject?: boolea
|
|
|
4603
4810
|
* and their corresponding WASM memory representations.
|
|
4604
4811
|
*/
|
|
4605
4812
|
declare const bridgeCallbacks: {
|
|
4606
|
-
get_provider_from_registry(objectId: number): any;
|
|
4607
4813
|
get_coin_selector_from_registry(objectId: number): any;
|
|
4814
|
+
get_provider_from_registry(objectId: number): any;
|
|
4608
4815
|
get_tx_evaluator_from_registry(objectId: number): any;
|
|
4609
|
-
report_provider_bridge_error(objectId: number, exception: any): void;
|
|
4610
|
-
report_coin_selector_bridge_error(objectId: number, exception: any): void;
|
|
4611
|
-
report_tx_evaluator_bridge_error(objectId: number, exception: any): void;
|
|
4612
4816
|
marshal_blake2b_hash_from_hex(jsHexString: string): number;
|
|
4613
4817
|
marshal_plutus_data(jsPlutusDataCborHex: string): number;
|
|
4614
4818
|
marshal_protocol_parameters(params: ProtocolParameters): number;
|
|
@@ -4617,8 +4821,11 @@ declare const bridgeCallbacks: {
|
|
|
4617
4821
|
marshal_utxo_list(jsUtxoArray: UTxO[]): number;
|
|
4618
4822
|
marshall_address(addressPtr: number): string;
|
|
4619
4823
|
marshall_asset_id(assetIdPtr: number): string;
|
|
4824
|
+
report_coin_selector_bridge_error(objectId: number, exception: any): void;
|
|
4620
4825
|
marshall_blake2b_hash(hashPtr: number): string;
|
|
4826
|
+
report_provider_bridge_error(objectId: number, exception: any): void;
|
|
4621
4827
|
marshall_reward_address(rewardAddressPtr: number): string;
|
|
4828
|
+
report_tx_evaluator_bridge_error(objectId: number, exception: any): void;
|
|
4622
4829
|
marshall_transaction_to_cbor_hex(txPtr: number): string;
|
|
4623
4830
|
marshall_tx_input_set(inputSetPtr: number): TxIn[];
|
|
4624
4831
|
marshall_utxo_list_to_js(utxoListPtr: number): UTxO[];
|
|
@@ -5593,6 +5800,16 @@ declare const utf8ByteLen: (str: string) => number;
|
|
|
5593
5800
|
* @returns {string} A human-readable string describing the error, or `'Unknown error'` if the conversion fails.
|
|
5594
5801
|
*/
|
|
5595
5802
|
declare const getErrorString: (error: number) => string;
|
|
5803
|
+
/**
|
|
5804
|
+
* Reads a null-terminated UTF-8 string from the WebAssembly memory.
|
|
5805
|
+
*
|
|
5806
|
+
* @param {number} ptr - The pointer to the beginning of the string in Wasm memory.
|
|
5807
|
+
* @returns {string} The resulting JavaScript string.
|
|
5808
|
+
* @remarks
|
|
5809
|
+
* This function only reads the string; it does not free the pointer. The caller is
|
|
5810
|
+
* responsible for managing the memory of the C string if it was dynamically allocated.
|
|
5811
|
+
*/
|
|
5812
|
+
declare const readStringFromMemory: (ptr: number) => string;
|
|
5596
5813
|
|
|
5597
5814
|
/**
|
|
5598
5815
|
* @hidden
|
|
@@ -5612,6 +5829,32 @@ declare const writeTransactionToCbor: (transactionPtr: number) => string;
|
|
|
5612
5829
|
* @throws {Error} Throws an error if the deserialization fails, including a descriptive message from the CBOR parser.
|
|
5613
5830
|
*/
|
|
5614
5831
|
declare const readTransactionFromCbor: (transactionCbor: string) => number;
|
|
5832
|
+
/**
|
|
5833
|
+
* @hidden
|
|
5834
|
+
* Extracts the unique set of public key hashes (signers) required to authorize a Cardano transaction.
|
|
5835
|
+
*
|
|
5836
|
+
* This function computes the required signers by analyzing the transaction body and a list of
|
|
5837
|
+
* resolved input UTxOs.
|
|
5838
|
+
*
|
|
5839
|
+
* @param {string} transactionCbor - The CBOR representation of the transaction as a hex string.
|
|
5840
|
+
* @param {UTxO[]} utxos - An array of resolved UTxO objects that are spent by the transaction. If
|
|
5841
|
+
* empty, the function won't resolve signers from inputs or collateral inputs. Additionally if the resolved
|
|
5842
|
+
* inputs are provided, they must account for all inputs and collateral inputs in the transaction or the function will fail.
|
|
5843
|
+
* @returns {string[]} An array of unique public key hashes (signers) as hex strings.
|
|
5844
|
+
* @throws {Error} Throws an error if any part of the process fails.
|
|
5845
|
+
*/
|
|
5846
|
+
declare const getUniqueSigners: (transactionCbor: string, utxos: UTxO[]) => string[];
|
|
5847
|
+
/**
|
|
5848
|
+
* @brief Inspects a Cardano transaction CBOR string and converts it into a structured JavaScript object (JSON).
|
|
5849
|
+
*
|
|
5850
|
+
* This function takes a hexadecimal CBOR representation of a Cardano transaction and then serializes it
|
|
5851
|
+
* into a CIP-116 compliant JSON string. Finally, it parses the JSON string into a native JavaScript object.
|
|
5852
|
+
*
|
|
5853
|
+
* @param {string} transactionCbor The hexadecimal string representation of the Cardano transaction CBOR.
|
|
5854
|
+
* @returns {any} A JavaScript object representing the decoded Cardano transaction structure (CIP-116 JSON format).
|
|
5855
|
+
* @throws {Error} If CBOR reading fails, JSON encoding fails, or memory allocation fails.
|
|
5856
|
+
*/
|
|
5857
|
+
declare const inspectTx: (transactionCbor: string) => any;
|
|
5615
5858
|
|
|
5616
5859
|
/**
|
|
5617
5860
|
* @hidden
|
|
@@ -5678,6 +5921,15 @@ declare const readTxOut: (ptr: number) => TxOut;
|
|
|
5678
5921
|
* @throws {Error} Throws an error if any part of the creation fails (e.g., invalid address format).
|
|
5679
5922
|
*/
|
|
5680
5923
|
declare const writeTxOut: (txOut: TxOut) => number;
|
|
5924
|
+
/**
|
|
5925
|
+
* @hidden
|
|
5926
|
+
* Deserializes a TxOut from its CBOR hex string representation into a TxOut object.
|
|
5927
|
+
*
|
|
5928
|
+
* @param {string} txOutCbor - The CBOR representation of the TxOut, encoded as a hexadecimal string.
|
|
5929
|
+
* @returns {number} A pointer to the newly created value object in WASM memory.
|
|
5930
|
+
* @throws {Error} Throws an error if the deserialization fails, including a descriptive message from the CBOR parser.
|
|
5931
|
+
*/
|
|
5932
|
+
declare const readTxOutFromCbor: (txOutCbor: string) => TxOut;
|
|
5681
5933
|
|
|
5682
5934
|
/**
|
|
5683
5935
|
* @hidden
|
|
@@ -5771,6 +6023,15 @@ declare const writeUtxoList: (utxos: UTxO[]) => number;
|
|
|
5771
6023
|
* @returns {UTxO[]} The JavaScript representation of the UTxO list.
|
|
5772
6024
|
*/
|
|
5773
6025
|
declare const readUtxoList: (ptr: number) => UTxO[];
|
|
6026
|
+
/**
|
|
6027
|
+
* @hidden
|
|
6028
|
+
* Deserializes a UTxO from its CBOR hex string representation into a UTxO object.
|
|
6029
|
+
*
|
|
6030
|
+
* @param {string} utxoCbor - The CBOR representation of the UTxO, encoded as a hexadecimal string.
|
|
6031
|
+
* @returns {number} A pointer to the newly created value object in WASM memory.
|
|
6032
|
+
* @throws {Error} Throws an error if the deserialization fails, including a descriptive message from the CBOR parser.
|
|
6033
|
+
*/
|
|
6034
|
+
declare const readUTxOtFromCbor: (utxoCbor: string) => UTxO;
|
|
5774
6035
|
|
|
5775
6036
|
/**
|
|
5776
6037
|
* @hidden
|
|
@@ -5792,6 +6053,15 @@ declare const readValue: (ptr: number) => Value;
|
|
|
5792
6053
|
* @throws {Error} If adding an asset to the native value object fails.
|
|
5793
6054
|
*/
|
|
5794
6055
|
declare const writeValue: (value: Value) => number;
|
|
6056
|
+
/**
|
|
6057
|
+
* @hidden
|
|
6058
|
+
* Deserializes a value from its CBOR hex string representation into a Value object.
|
|
6059
|
+
*
|
|
6060
|
+
* @param {string} valueCbor - The CBOR representation of the value, encoded as a hexadecimal string.
|
|
6061
|
+
* @returns {number} A pointer to the newly created value object in WASM memory.
|
|
6062
|
+
* @throws {Error} Throws an error if the deserialization fails, including a descriptive message from the CBOR parser.
|
|
6063
|
+
*/
|
|
6064
|
+
declare const readValueFromCbor: (valueCbor: string) => Value;
|
|
5795
6065
|
|
|
5796
6066
|
/**
|
|
5797
6067
|
* @hidden
|
|
@@ -5819,12 +6089,13 @@ declare const writeVoter: (voter: Voter) => number;
|
|
|
5819
6089
|
declare const readGovernanceActionId: (ptr: number) => GovernanceActionId;
|
|
5820
6090
|
/**
|
|
5821
6091
|
* @hidden
|
|
5822
|
-
* Serializes a JavaScript `GovernanceActionId` object
|
|
6092
|
+
* Serializes a JavaScript `GovernanceActionId` object or Bech32 string into a
|
|
6093
|
+
* native `cardano_governance_action_id_t` object pointer.
|
|
5823
6094
|
*
|
|
5824
|
-
* @param {GovernanceActionId} govActionId - The `GovernanceActionId` object to serialize.
|
|
6095
|
+
* @param {GovernanceActionId | string} govActionId - The `GovernanceActionId` object or Bech32 string to serialize.
|
|
5825
6096
|
* @returns {number} A pointer to the newly created native `cardano_governance_action_id_t` object.
|
|
5826
6097
|
*/
|
|
5827
|
-
declare const writeGovernanceActionId: (govActionId: GovernanceActionId) => number;
|
|
6098
|
+
declare const writeGovernanceActionId: (govActionId: GovernanceActionId | string) => number;
|
|
5828
6099
|
/**
|
|
5829
6100
|
* @hidden
|
|
5830
6101
|
* Deserializes a native `cardano_voting_procedure_t` object into a JavaScript `VotingProcedure` object.
|
|
@@ -5850,6 +6121,7 @@ declare const writeVotingProcedure: (votingProcedure: VotingProcedure) => number
|
|
|
5850
6121
|
*/
|
|
5851
6122
|
declare const readVkeyWitnessSet: (setPtr: number) => VkeyWitnessSet;
|
|
5852
6123
|
/**
|
|
6124
|
+
* @hidden
|
|
5853
6125
|
* Serializes a JavaScript `VkeyWitnessSet` array into a native C `cardano_vkey_witness_set_t`.
|
|
5854
6126
|
*
|
|
5855
6127
|
* @param {VkeyWitnessSet} set - The array of `VkeyWitness` objects to serialize.
|
|
@@ -5866,7 +6138,23 @@ declare const writeVkeyWitnessSet: (set: VkeyWitnessSet) => number;
|
|
|
5866
6138
|
* The caller is responsible for freeing this memory using `module._free()`.
|
|
5867
6139
|
*/
|
|
5868
6140
|
declare const writeDerivationPaths: (paths: DerivationPath[]) => number;
|
|
6141
|
+
/**
|
|
6142
|
+
* @hidden
|
|
6143
|
+
* Serializes a JavaScript `AccountDerivationPath` object into a C-style struct
|
|
6144
|
+
* @param path - The `AccountDerivationPath` object to serialize.
|
|
6145
|
+
*
|
|
6146
|
+
* @return {number} A pointer to the start of the allocated memory block for the C struct.
|
|
6147
|
+
*/
|
|
5869
6148
|
declare const writeAccountDerivationPaths: (path: AccountDerivationPath) => number;
|
|
6149
|
+
/**
|
|
6150
|
+
* @hidden
|
|
6151
|
+
* Deserializes a vkey witness set from a transaction witness set in CBOR hex string representation into a VkeyWitnessSet.
|
|
6152
|
+
*
|
|
6153
|
+
* @param {string} witnessSetCbor - The CBOR representation of the witness set, encoded as a hexadecimal string.
|
|
6154
|
+
* @returns {VkeyWitnessSet} The deserialized `VkeyWitnessSet` object containing an array of `VkeyWitness` objects.
|
|
6155
|
+
* @throws {Error} Throws an error if the deserialization fails, including a descriptive message from the CBOR parser.
|
|
6156
|
+
*/
|
|
6157
|
+
declare const readVkeyWitnessSetFromWitnessSetCbor: (witnessSetCbor: string) => VkeyWitnessSet;
|
|
5870
6158
|
|
|
5871
6159
|
/**
|
|
5872
6160
|
* @hidden
|
|
@@ -6015,6 +6303,17 @@ interface Provider {
|
|
|
6015
6303
|
* @returns {[object, object]} A tuple containing the JSON for the input and the output.
|
|
6016
6304
|
*/
|
|
6017
6305
|
declare const prepareUtxoForEvaluation: (utxo: UTxO) => [object, object];
|
|
6306
|
+
/**
|
|
6307
|
+
* Configuration options for the BlockfrostProvider.
|
|
6308
|
+
*/
|
|
6309
|
+
type BlockfrostProviderConfig = {
|
|
6310
|
+
/** The network identifier (e.g., Mainnet, Preprod). This is ignored if a custom `url` is provided. */
|
|
6311
|
+
network: NetworkMagic;
|
|
6312
|
+
/** The Blockfrost project ID for authentication. */
|
|
6313
|
+
projectId: string;
|
|
6314
|
+
/** An optional, custom base URL for the Blockfrost API. Overrides the `network` setting for URL construction. */
|
|
6315
|
+
baseUrl?: string;
|
|
6316
|
+
};
|
|
6018
6317
|
/**
|
|
6019
6318
|
* BlockfrostProvider is a provider for interacting with the Blockfrost API.
|
|
6020
6319
|
*
|
|
@@ -6028,19 +6327,19 @@ declare class BlockfrostProvider implements Provider {
|
|
|
6028
6327
|
/**
|
|
6029
6328
|
* Creates an instance of BlockfrostProvider.
|
|
6030
6329
|
*
|
|
6031
|
-
* @param {
|
|
6032
|
-
* @param {string} projectId The Blockfrost project ID.
|
|
6330
|
+
* @param {BlockfrostProviderConfig} config - The configuration object for the provider.
|
|
6331
|
+
* @param {string} config.projectId - The Blockfrost project ID for authentication.
|
|
6332
|
+
* @param {string} [config.baseUrl] - An optional, custom base URL for the API. If provided, this URL is used directly and the `network` parameter is ignored for URL construction.
|
|
6333
|
+
* @param {NetworkMagic} [config.network] - The network identifier (e.g., Mainnet, Preprod). This is required if a custom `url` is not provided.
|
|
6033
6334
|
*/
|
|
6034
|
-
constructor({ network, projectId }:
|
|
6035
|
-
network: NetworkMagic;
|
|
6036
|
-
projectId: string;
|
|
6037
|
-
});
|
|
6335
|
+
constructor({ network, projectId, baseUrl }: BlockfrostProviderConfig);
|
|
6038
6336
|
/**
|
|
6039
6337
|
* Returns the headers required for Blockfrost API requests.
|
|
6040
6338
|
*
|
|
6041
6339
|
* @returns {Object} An object containing the project ID header.
|
|
6042
6340
|
*/
|
|
6043
6341
|
headers(): {
|
|
6342
|
+
Origin: string;
|
|
6044
6343
|
project_id: string;
|
|
6045
6344
|
};
|
|
6046
6345
|
/**
|
|
@@ -6361,25 +6660,75 @@ declare class TransactionBuilder {
|
|
|
6361
6660
|
* This function marks the transaction as invalid if it is not included in a block
|
|
6362
6661
|
* before the specified time.
|
|
6363
6662
|
*
|
|
6364
|
-
* @param {number | bigint
|
|
6365
|
-
*
|
|
6366
|
-
|
|
6663
|
+
* @param {number | bigint} slot The absolute **slot number** after which this transaction will be invalid.
|
|
6664
|
+
* @returns {TransactionBuilder} The builder instance for chaining.
|
|
6665
|
+
*/
|
|
6666
|
+
setInvalidAfter(slot: number | bigint): TransactionBuilder;
|
|
6667
|
+
/**
|
|
6668
|
+
* Sets the transaction to be valid for a specific duration from now.
|
|
6669
|
+
*
|
|
6670
|
+
* This is a convenience method that calculates a future expiration date and sets it.
|
|
6671
|
+
* The transaction will be marked as invalid if it is not included in a block
|
|
6672
|
+
* within the specified duration.
|
|
6673
|
+
*
|
|
6674
|
+
* @param {number} seconds - The number of seconds from now that the transaction should remain valid.
|
|
6675
|
+
* @returns {TransactionBuilder} The builder instance for chaining.
|
|
6676
|
+
*
|
|
6677
|
+
* @example
|
|
6678
|
+
* // Set the transaction to expire in 3 minutes (180 seconds) from now.
|
|
6679
|
+
* txBuilder.setValidFor(180);
|
|
6680
|
+
*/
|
|
6681
|
+
expiresIn(seconds: number): TransactionBuilder;
|
|
6682
|
+
/**
|
|
6683
|
+
* Sets the transaction's expiration to a specific, absolute date and time.
|
|
6684
|
+
*
|
|
6685
|
+
* This function marks the transaction as invalid if it is not included in a block
|
|
6686
|
+
* before the specified date.
|
|
6687
|
+
*
|
|
6688
|
+
* @param {Date} date - The absolute date and time after which the transaction will be invalid.
|
|
6367
6689
|
* @returns {TransactionBuilder} The builder instance for chaining.
|
|
6690
|
+
*
|
|
6691
|
+
* @example
|
|
6692
|
+
* // Set the transaction to expire on New Year's Day, 2026.
|
|
6693
|
+
* const expiryDate = new Date('2026-01-01T00:00:00Z');
|
|
6694
|
+
* txBuilder.expiresAfter(expiryDate);
|
|
6368
6695
|
*/
|
|
6369
|
-
|
|
6696
|
+
expiresAfter(date: Date): TransactionBuilder;
|
|
6370
6697
|
/**
|
|
6371
|
-
* Sets the transaction's validity start time.
|
|
6698
|
+
* Sets the transaction's validity start time using an absolute slot number.
|
|
6372
6699
|
*
|
|
6373
6700
|
* This function marks the transaction as invalid if it is included in a block
|
|
6374
|
-
* created before the specified
|
|
6375
|
-
*
|
|
6701
|
+
* created before the specified slot.
|
|
6702
|
+
*
|
|
6703
|
+
* @param {number | bigint} slot The absolute slot number before which this transaction is invalid.
|
|
6704
|
+
* @returns {TransactionBuilder} The builder instance for chaining.
|
|
6705
|
+
*/
|
|
6706
|
+
setInvalidBefore(slot: number | bigint): TransactionBuilder;
|
|
6707
|
+
/**
|
|
6708
|
+
* Sets the transaction's validity start time to a specific, absolute date and time.
|
|
6709
|
+
* The transaction will be invalid if processed before this date.
|
|
6710
|
+
*
|
|
6711
|
+
* @param {Date} date The absolute date and time from which the transaction will be valid.
|
|
6712
|
+
* @returns {TransactionBuilder} The builder instance for chaining.
|
|
6713
|
+
*
|
|
6714
|
+
* @example
|
|
6715
|
+
* // Make the transaction valid starting on New Year's Day, 2026.
|
|
6716
|
+
* const startDate = new Date('2026-01-01T00:00:00Z');
|
|
6717
|
+
* txBuilder.validFromDate(startDate);
|
|
6718
|
+
*/
|
|
6719
|
+
validFromDate(date: Date): TransactionBuilder;
|
|
6720
|
+
/**
|
|
6721
|
+
* Sets the transaction to become valid only after a specified duration from now.
|
|
6722
|
+
* This is a convenience method that calculates a future start date.
|
|
6376
6723
|
*
|
|
6377
|
-
* @param {number
|
|
6378
|
-
* - If a `number` or `bigint` is provided, it is treated as an absolute **slot number**.
|
|
6379
|
-
* - If a `Date` object is provided, it is converted to a **Unix timestamp** (in seconds).
|
|
6724
|
+
* @param {number} seconds The number of seconds from now to wait before the transaction becomes valid.
|
|
6380
6725
|
* @returns {TransactionBuilder} The builder instance for chaining.
|
|
6726
|
+
*
|
|
6727
|
+
* @example
|
|
6728
|
+
* // Make the transaction valid only after 1 hour (3600 seconds) has passed.
|
|
6729
|
+
* txBuilder.validAfter(3600);
|
|
6381
6730
|
*/
|
|
6382
|
-
|
|
6731
|
+
validAfter(seconds: number): TransactionBuilder;
|
|
6383
6732
|
/**
|
|
6384
6733
|
* Adds a reference input to the transaction.
|
|
6385
6734
|
*
|
|
@@ -6556,12 +6905,12 @@ declare class TransactionBuilder {
|
|
|
6556
6905
|
* stake credentials.
|
|
6557
6906
|
*
|
|
6558
6907
|
* @param {Object} params - The parameters for the function.
|
|
6559
|
-
* @param {string | RewardAddress} params.
|
|
6908
|
+
* @param {string | RewardAddress} params.rewardAddress The stake address to register, as a bech32 string or a RewardAddress object.
|
|
6560
6909
|
* @param {PlutusData} [params.redeemer] Optional. The redeemer for a script-controlled stake credential.
|
|
6561
6910
|
* @returns {TransactionBuilder} The builder instance for chaining.
|
|
6562
6911
|
*/
|
|
6563
|
-
registerStakeAddress({
|
|
6564
|
-
|
|
6912
|
+
registerStakeAddress({ rewardAddress, redeemer }: {
|
|
6913
|
+
rewardAddress: string | RewardAddress;
|
|
6565
6914
|
redeemer?: PlutusData;
|
|
6566
6915
|
}): TransactionBuilder;
|
|
6567
6916
|
/**
|
|
@@ -6571,12 +6920,12 @@ declare class TransactionBuilder {
|
|
|
6571
6920
|
* An optional redeemer can be provided for script-controlled stake credentials.
|
|
6572
6921
|
*
|
|
6573
6922
|
* @param {Object} params - The parameters for the function.
|
|
6574
|
-
* @param {string | RewardAddress} params.
|
|
6923
|
+
* @param {string | RewardAddress} params.rewardAddress - The stake address to deregister, as a bech32 string or a RewardAddress object.
|
|
6575
6924
|
* @param {PlutusData} [params.redeemer] - Optional. The redeemer for a script-controlled stake credential.
|
|
6576
6925
|
* @returns {TransactionBuilder} The builder instance for chaining.
|
|
6577
6926
|
*/
|
|
6578
|
-
deregisterStakeAddress({
|
|
6579
|
-
|
|
6927
|
+
deregisterStakeAddress({ rewardAddress, redeemer }: {
|
|
6928
|
+
rewardAddress: string | RewardAddress;
|
|
6580
6929
|
redeemer?: PlutusData;
|
|
6581
6930
|
}): TransactionBuilder;
|
|
6582
6931
|
/**
|
|
@@ -6586,13 +6935,13 @@ declare class TransactionBuilder {
|
|
|
6586
6935
|
* An optional redeemer can be provided for script-controlled stake credentials.
|
|
6587
6936
|
*
|
|
6588
6937
|
* @param {Object} params - The parameters for the function.
|
|
6589
|
-
* @param {string | RewardAddress} params.
|
|
6938
|
+
* @param {string | RewardAddress} params.rewardAddress The bech32-encoded stake address to delegate from.
|
|
6590
6939
|
* @param {string} params.poolId The bech32-encoded ID of the stake pool to delegate to.
|
|
6591
6940
|
* @param {PlutusData} [params.redeemer] Optional. The redeemer for a script-controlled stake credential.
|
|
6592
6941
|
* @returns {TransactionBuilder} The builder instance for chaining.
|
|
6593
6942
|
*/
|
|
6594
|
-
delegateStake({
|
|
6595
|
-
|
|
6943
|
+
delegateStake({ rewardAddress, poolId, redeemer }: {
|
|
6944
|
+
rewardAddress: string | RewardAddress;
|
|
6596
6945
|
poolId: string;
|
|
6597
6946
|
redeemer?: PlutusData;
|
|
6598
6947
|
}): TransactionBuilder;
|
|
@@ -6603,14 +6952,14 @@ declare class TransactionBuilder {
|
|
|
6603
6952
|
* (Decentralized Representative) for on-chain governance.
|
|
6604
6953
|
*
|
|
6605
6954
|
* @param {Object} params - The parameters for the function.
|
|
6606
|
-
* @param {string | RewardAddress} params.
|
|
6955
|
+
* @param {string | RewardAddress} params.rewardAddress The bech32-encoded stake address to delegate from.
|
|
6607
6956
|
* @param {string} params.drepId The bech32-encoded ID of the DRep to delegate to. The DRep ID can be
|
|
6608
6957
|
* in CIP-129 format or CIP-105 format.
|
|
6609
6958
|
* @param {PlutusData} [params.redeemer] Optional. The redeemer for a script-controlled stake credential.
|
|
6610
6959
|
* @returns {TransactionBuilder} The builder instance for chaining.
|
|
6611
6960
|
*/
|
|
6612
|
-
delegateVotingPower({
|
|
6613
|
-
|
|
6961
|
+
delegateVotingPower({ rewardAddress, drepId, redeemer }: {
|
|
6962
|
+
rewardAddress: string | RewardAddress;
|
|
6614
6963
|
drepId: string;
|
|
6615
6964
|
redeemer?: PlutusData;
|
|
6616
6965
|
}): TransactionBuilder;
|
|
@@ -6675,7 +7024,7 @@ declare class TransactionBuilder {
|
|
|
6675
7024
|
*/
|
|
6676
7025
|
vote({ voter, actionId, votingProcedure, redeemer }: {
|
|
6677
7026
|
voter: Voter;
|
|
6678
|
-
actionId: GovernanceActionId;
|
|
7027
|
+
actionId: GovernanceActionId | string;
|
|
6679
7028
|
votingProcedure: VotingProcedure;
|
|
6680
7029
|
redeemer?: PlutusData;
|
|
6681
7030
|
}): TransactionBuilder;
|
|
@@ -6885,9 +7234,9 @@ interface CoinSelectorParams {
|
|
|
6885
7234
|
*/
|
|
6886
7235
|
availableUtxo: UTxO[];
|
|
6887
7236
|
/**
|
|
6888
|
-
* The target
|
|
7237
|
+
* The target value that the selection must cover.
|
|
6889
7238
|
*/
|
|
6890
|
-
targetValue:
|
|
7239
|
+
targetValue: Value;
|
|
6891
7240
|
}
|
|
6892
7241
|
/**
|
|
6893
7242
|
* Defines the contract for a coin selection strategy.
|
|
@@ -6938,6 +7287,10 @@ declare class EmscriptenCoinSelector implements CoinSelector {
|
|
|
6938
7287
|
select(params: CoinSelectorParams): Promise<CoinSelectorResult>;
|
|
6939
7288
|
}
|
|
6940
7289
|
|
|
7290
|
+
/**
|
|
7291
|
+
* Interface for transaction evaluation strategies. This will compute the required
|
|
7292
|
+
* execution units for each redeemer in a transaction.
|
|
7293
|
+
*/
|
|
6941
7294
|
interface TxEvaluator {
|
|
6942
7295
|
/**
|
|
6943
7296
|
* Gets the human-readable name of the coin selection strategy.
|
|
@@ -6985,4 +7338,574 @@ declare class EmscriptenTxEvaluator implements TxEvaluator {
|
|
|
6985
7338
|
evaluate(tx: string, additionalUtxos?: UTxO[]): Promise<Redeemer[]>;
|
|
6986
7339
|
}
|
|
6987
7340
|
|
|
6988
|
-
|
|
7341
|
+
/**
|
|
7342
|
+
* Represents a CIP-30 compatible Cardano wallet for dApp interaction.
|
|
7343
|
+
*/
|
|
7344
|
+
interface Cip30Wallet {
|
|
7345
|
+
/**
|
|
7346
|
+
* Returns the wallet's current network ID.
|
|
7347
|
+
* @returns {Promise<number>} A promise that resolves to the network ID (0 for Testnet, 1 for Mainnet).
|
|
7348
|
+
* @remarks This is used to ensure the dApp and wallet are operating on the same network.
|
|
7349
|
+
*/
|
|
7350
|
+
getNetworkId(): Promise<number>;
|
|
7351
|
+
/**
|
|
7352
|
+
* Returns a list of all Unspent Transaction Outputs (UTXOs) controlled by the wallet.
|
|
7353
|
+
* @returns {Promise<string[] | undefined>} A promise that resolves to an array of UTXOs.
|
|
7354
|
+
* @remarks UTXOs represent the "coins" or assets in the wallet that are available to be spent.
|
|
7355
|
+
*/
|
|
7356
|
+
getUtxos(): Promise<string[] | undefined>;
|
|
7357
|
+
/**
|
|
7358
|
+
* Returns the total balance of all assets controlled by the wallet.
|
|
7359
|
+
* @returns {Promise<string>} A promise that resolves to the wallet's total balance, including Lovelace and any native tokens.
|
|
7360
|
+
*/
|
|
7361
|
+
getBalance(): Promise<string>;
|
|
7362
|
+
/**
|
|
7363
|
+
* Returns a list of addresses that have been used in past transactions.
|
|
7364
|
+
* @returns {Promise<string[]>} A promise that resolves to an array of used, Bech32-encoded addresses.
|
|
7365
|
+
*/
|
|
7366
|
+
getUsedAddresses(): Promise<string[]>;
|
|
7367
|
+
/**
|
|
7368
|
+
* Returns a list of unused addresses for receiving payments.
|
|
7369
|
+
* @returns {Promise<string[]>} A promise that resolves to an array of unused, Bech32-encoded addresses.
|
|
7370
|
+
* @remarks Using a fresh address for each transaction can improve user privacy.
|
|
7371
|
+
*/
|
|
7372
|
+
getUnusedAddresses(): Promise<string[]>;
|
|
7373
|
+
/**
|
|
7374
|
+
* Returns a single, unused address suitable for receiving change from a transaction.
|
|
7375
|
+
* @returns {Promise<string>} A promise that resolves to a Bech32-encoded change address.
|
|
7376
|
+
*/
|
|
7377
|
+
getChangeAddress(): Promise<string>;
|
|
7378
|
+
/**
|
|
7379
|
+
* Returns the wallet's reward addresses, used for receiving staking rewards.
|
|
7380
|
+
* @returns {Promise<string[]>} A promise that resolves to an array of Bech32-encoded reward addresses.
|
|
7381
|
+
*/
|
|
7382
|
+
getRewardAddresses(): Promise<string[]>;
|
|
7383
|
+
/**
|
|
7384
|
+
* Requests the user to sign a given transaction.
|
|
7385
|
+
* @param {string} tx - The transaction to be signed, provided as a CBOR hex string.
|
|
7386
|
+
* @param {boolean} partialSign - If true, the wallet will only add its witness and not require all signatures to be present. This is for multi-signature transactions.
|
|
7387
|
+
* @returns {Promise<string>} A promise that resolves to the CBOR hex string of the transaction witness set.
|
|
7388
|
+
*/
|
|
7389
|
+
signTx(tx: string, partialSign: boolean): Promise<string>;
|
|
7390
|
+
/**
|
|
7391
|
+
* Requests the user to sign arbitrary data with a specific address, compliant with CIP-8.
|
|
7392
|
+
* @param {string} address - The Bech32-encoded address to sign with.
|
|
7393
|
+
* @param {string} payload - The hex-encoded data payload to be signed.
|
|
7394
|
+
* @returns {Promise<{ signature: string; key: string }>} A promise that resolves to the signature and public key.
|
|
7395
|
+
* @remarks This is useful for proving ownership of an address without creating a blockchain transaction.
|
|
7396
|
+
*/
|
|
7397
|
+
signData(address: string, payload: string): Promise<{
|
|
7398
|
+
signature: string;
|
|
7399
|
+
key: string;
|
|
7400
|
+
}>;
|
|
7401
|
+
/**
|
|
7402
|
+
* Submits a fully signed transaction to the blockchain through the wallet's provider.
|
|
7403
|
+
* @param {string} tx - The fully signed transaction, provided as a CBOR hex string.
|
|
7404
|
+
* @returns {Promise<string>} A promise that resolves to the transaction ID (hash).
|
|
7405
|
+
*/
|
|
7406
|
+
submitTx(tx: string): Promise<string>;
|
|
7407
|
+
/**
|
|
7408
|
+
* Returns a list of UTXOs that are designated as collateral.
|
|
7409
|
+
* @returns {Promise<string[]>} A promise that resolves to an array of collateral UTXOs.
|
|
7410
|
+
* @remarks Collateral is required for transactions that interact with Plutus smart contracts to cover potential script execution failure fees.
|
|
7411
|
+
*/
|
|
7412
|
+
getCollateral(): Promise<string[]>;
|
|
7413
|
+
/**
|
|
7414
|
+
* Namespace for CIP-142 methods.
|
|
7415
|
+
* @see {@link https://cips.cardano.org/cip/CIP-142}
|
|
7416
|
+
*/
|
|
7417
|
+
cip142: {
|
|
7418
|
+
/**
|
|
7419
|
+
* Returns the "network magic," a unique number identifying the Cardano network.
|
|
7420
|
+
* @returns {Promise<number>} A promise that resolves to the network magic number (e.g., Mainnet: `764824073`, Preprod: `1`).
|
|
7421
|
+
*/
|
|
7422
|
+
getNetworkMagic: () => Promise<number>;
|
|
7423
|
+
};
|
|
7424
|
+
/**
|
|
7425
|
+
* Namespace for CIP-95 governance methods, supporting the Voltaire era.
|
|
7426
|
+
* @see {@link https://cips.cardano.org/cip/CIP-95}
|
|
7427
|
+
*/
|
|
7428
|
+
cip95: {
|
|
7429
|
+
/**
|
|
7430
|
+
* Returns the wallet's active public DRep (Delegated Representative) key.
|
|
7431
|
+
* @returns {Promise<string>} A promise that resolves to the hex-encoded public DRep key.
|
|
7432
|
+
*/
|
|
7433
|
+
getPubDRepKey: () => Promise<string>;
|
|
7434
|
+
/**
|
|
7435
|
+
* Returns public stake keys from the wallet that are currently registered for on-chain governance voting.
|
|
7436
|
+
* @returns {Promise<string[]>} A promise that resolves to an array of hex-encoded public stake keys.
|
|
7437
|
+
*/
|
|
7438
|
+
getRegisteredPubStakeKeys: () => Promise<string[]>;
|
|
7439
|
+
/**
|
|
7440
|
+
* Returns public stake keys from the wallet that are NOT yet registered for on-chain governance voting.
|
|
7441
|
+
* @returns {Promise<string[]>} A promise that resolves to an array of hex-encoded public stake keys.
|
|
7442
|
+
*/
|
|
7443
|
+
getUnregisteredPubStakeKeys: () => Promise<string[]>;
|
|
7444
|
+
};
|
|
7445
|
+
}
|
|
7446
|
+
|
|
7447
|
+
/**
|
|
7448
|
+
* Defines the standard interface for a Cardano wallet.
|
|
7449
|
+
* This interface provides dApps with a consistent way to interact with a user's wallet for querying information
|
|
7450
|
+
* and requesting transaction creation.
|
|
7451
|
+
*/
|
|
7452
|
+
interface Wallet {
|
|
7453
|
+
/**
|
|
7454
|
+
* Returns the wallet's current network ID.
|
|
7455
|
+
* @returns {Promise<NetworkId>} A promise that resolves to the network ID (0 for Testnet, 1 for Mainnet).
|
|
7456
|
+
* @remarks This is used to ensure the dApp and wallet are operating on the same network.
|
|
7457
|
+
*/
|
|
7458
|
+
getNetworkId(): Promise<NetworkId>;
|
|
7459
|
+
/**
|
|
7460
|
+
* Returns a list of all Unspent Transaction Outputs (UTxOs) controlled by the wallet.
|
|
7461
|
+
* @returns {Promise<UTxO[]>} A promise that resolves to an array of UTxOs.
|
|
7462
|
+
* @remarks UTxOs represent the "coins" or assets in the wallet that are available to be spent.
|
|
7463
|
+
*/
|
|
7464
|
+
getUnspentOutputs(): Promise<UTxO[]>;
|
|
7465
|
+
/**
|
|
7466
|
+
* Returns the total balance of all assets controlled by the wallet.
|
|
7467
|
+
* @returns {Promise<Value>} A promise that resolves to the wallet's total balance, including Lovelace and any native tokens.
|
|
7468
|
+
*/
|
|
7469
|
+
getBalance(): Promise<Value>;
|
|
7470
|
+
/**
|
|
7471
|
+
* Returns a list of addresses that have been used in past transactions.
|
|
7472
|
+
* @returns {Promise<string[]>} A promise that resolves to an array of used, Bech32-encoded addresses.
|
|
7473
|
+
*/
|
|
7474
|
+
getUsedAddresses(): Promise<Address[]>;
|
|
7475
|
+
/**
|
|
7476
|
+
* Returns a list of unused addresses for receiving payments.
|
|
7477
|
+
* @returns {Promise<string[]>} A promise that resolves to an array of unused, Bech32-encoded addresses.
|
|
7478
|
+
* @remarks Using a fresh address for each transaction can improve user privacy.
|
|
7479
|
+
*/
|
|
7480
|
+
getUnusedAddresses(): Promise<Address[]>;
|
|
7481
|
+
/**
|
|
7482
|
+
* Returns a single, unused address suitable for receiving change from a transaction.
|
|
7483
|
+
* @returns {Promise<string>} A promise that resolves to a Bech32-encoded change address.
|
|
7484
|
+
*/
|
|
7485
|
+
getChangeAddress(): Promise<Address>;
|
|
7486
|
+
/**
|
|
7487
|
+
* Returns the wallet's reward addresses, used for receiving staking rewards.
|
|
7488
|
+
* @returns {Promise<string[]>} A promise that resolves to an array of Bech32-encoded reward addresses.
|
|
7489
|
+
*/
|
|
7490
|
+
getRewardAddresses(): Promise<RewardAddress[]>;
|
|
7491
|
+
/**
|
|
7492
|
+
* Requests the user to sign a given transaction.
|
|
7493
|
+
* @param {string} txCbor - The transaction to be signed, provided as a CBOR hex string.
|
|
7494
|
+
* @param {boolean} partialSign - If true, the wallet will only add its witness and not require all signatures to be present. This is for multi-signature transactions.
|
|
7495
|
+
* @returns {Promise<VkeyWitness>} A promise that resolves to the CBOR hex string of the transaction witness set.
|
|
7496
|
+
*/
|
|
7497
|
+
signTransaction(txCbor: string, partialSign: boolean): Promise<VkeyWitnessSet>;
|
|
7498
|
+
/**
|
|
7499
|
+
* Requests the user to sign arbitrary data with a specific address, compliant with CIP-8.
|
|
7500
|
+
* @param {Address | string} address - The Bech32-encoded address to sign with.
|
|
7501
|
+
* @param {string} payload - The hex-encoded data payload to be signed.
|
|
7502
|
+
* @returns {Promise<{ signature: string; key: string }>} A promise that resolves to the signature and public key.
|
|
7503
|
+
* @remarks This is useful for proving ownership of an address without creating a blockchain transaction.
|
|
7504
|
+
*/
|
|
7505
|
+
signData(address: Address | string, payload: string): Promise<{
|
|
7506
|
+
signature: string;
|
|
7507
|
+
key: string;
|
|
7508
|
+
}>;
|
|
7509
|
+
/**
|
|
7510
|
+
* Submits a fully signed transaction to the blockchain through the wallet's provider.
|
|
7511
|
+
* @param {string} txCbor - The fully signed transaction, provided as a CBOR hex string.
|
|
7512
|
+
* @returns {Promise<string>} A promise that resolves to the transaction ID (hash).
|
|
7513
|
+
*/
|
|
7514
|
+
submitTransaction(txCbor: string): Promise<string>;
|
|
7515
|
+
/**
|
|
7516
|
+
* Returns a list of UTxOs that are designated as collateral.
|
|
7517
|
+
* @returns {Promise<UTxO[]>} A promise that resolves to an array of collateral UTxOs.
|
|
7518
|
+
* @remarks Collateral is required for transactions that interact with Plutus smart contracts to cover potential script execution failure fees.
|
|
7519
|
+
*/
|
|
7520
|
+
getCollateral(): Promise<UTxO[]>;
|
|
7521
|
+
/**
|
|
7522
|
+
* Returns the "network magic," a unique number identifying the Cardano network.
|
|
7523
|
+
* @returns {Promise<number>} A promise that resolves to the network magic number (e.g., Mainnet: `764824073`, Preprod: `1`).
|
|
7524
|
+
*/
|
|
7525
|
+
getNetworkMagic: () => Promise<number>;
|
|
7526
|
+
/**
|
|
7527
|
+
* Returns the wallet's active public DRep (Delegated Representative) key.
|
|
7528
|
+
* @returns {Promise<string>} A promise that resolves to the hex-encoded public DRep key.
|
|
7529
|
+
*/
|
|
7530
|
+
getPubDRepKey: () => Promise<string>;
|
|
7531
|
+
/**
|
|
7532
|
+
* Returns public stake keys from the wallet that are currently registered for on-chain governance voting.
|
|
7533
|
+
* @returns {Promise<string[]>} A promise that resolves to an array of hex-encoded public stake keys.
|
|
7534
|
+
*/
|
|
7535
|
+
getRegisteredPubStakeKeys: () => Promise<string[]>;
|
|
7536
|
+
/**
|
|
7537
|
+
* Returns public stake keys from the wallet that are NOT yet registered for on-chain governance voting.
|
|
7538
|
+
* @returns {Promise<string[]>} A promise that resolves to an array of hex-encoded public stake keys.
|
|
7539
|
+
*/
|
|
7540
|
+
getUnregisteredPubStakeKeys: () => Promise<string[]>;
|
|
7541
|
+
/**
|
|
7542
|
+
* Creates and initializes a new transaction builder with the wallet's current state.
|
|
7543
|
+
*
|
|
7544
|
+
* @returns {Promise<TransactionBuilder>} A promise that resolves to a pre-configured `TransactionBuilder` instance.
|
|
7545
|
+
* @remarks
|
|
7546
|
+
* This method simplifies transaction construction by automatically pre-populating the builder with:
|
|
7547
|
+
* 1. The wallet's available UTxOs as inputs.
|
|
7548
|
+
* 2. The wallet's change address to receive any leftover funds.
|
|
7549
|
+
* 3. The network parameters from the wallet's provider.
|
|
7550
|
+
*
|
|
7551
|
+
* The returned builder is ready for you to add outputs and other transaction details.
|
|
7552
|
+
*/
|
|
7553
|
+
createTransactionBuilder(): Promise<TransactionBuilder>;
|
|
7554
|
+
}
|
|
7555
|
+
|
|
7556
|
+
/**
|
|
7557
|
+
* Defines part of the BIP-44 derivation path components for a single Cardano address.
|
|
7558
|
+
* @property {number} account - The account index.
|
|
7559
|
+
* @property {number} paymentIndex - The address index for the payment key (role 0).
|
|
7560
|
+
* @property {number} [stakingIndex] - The address index for the staking key (role 2). If provided, a **Base address** (payment + staking) will be derived. If omitted, an **Enterprise address** (payment only) will be derived.
|
|
7561
|
+
* @property {number} [drepIndex] - The address index for the DRep key (role 3). If not provided, 0 will be assumed.
|
|
7562
|
+
*/
|
|
7563
|
+
type SingleAddressCredentialsConfig = {
|
|
7564
|
+
account: number;
|
|
7565
|
+
paymentIndex: number;
|
|
7566
|
+
stakingIndex?: number;
|
|
7567
|
+
drepIndex?: number;
|
|
7568
|
+
};
|
|
7569
|
+
/**
|
|
7570
|
+
* Configuration for creating a `SingleAddressWallet` instance from pre-existing key objects.
|
|
7571
|
+
* @property {Bip32SecureKeyHandler} secureKeyHandler - The handler that manages encrypted private keys.
|
|
7572
|
+
* @property {Bip32PublicKey} accountRootPublicKey - The public key for the specified account from which addresses are derived.
|
|
7573
|
+
* @property {Provider} provider - The provider instance for interacting with the Cardano blockchain.
|
|
7574
|
+
* @property {SingleAddressCredentialsConfig} credentialsConfig - Specifies the derivation path for the address this wallet will manage.
|
|
7575
|
+
*/
|
|
7576
|
+
type SingleAddressWalletConfig = {
|
|
7577
|
+
secureKeyHandler: Bip32SecureKeyHandler;
|
|
7578
|
+
accountRootPublicKey: Bip32PublicKey;
|
|
7579
|
+
provider: Provider;
|
|
7580
|
+
credentialsConfig: SingleAddressCredentialsConfig;
|
|
7581
|
+
};
|
|
7582
|
+
/**
|
|
7583
|
+
* Configuration for creating a `SingleAddressWallet` instance from a mnemonic phrase.
|
|
7584
|
+
* @property {string[]} mnemonics - The mnemonic (seed) phrase used to derive the root key.
|
|
7585
|
+
* @property {Provider} provider - The provider instance for interacting with the Cardano blockchain.
|
|
7586
|
+
* @property {SingleAddressCredentialsConfig} credentialsConfig - Specifies the derivation path for the address this wallet will manage.
|
|
7587
|
+
* @property {() => Promise<Uint8Array>} getPassword - An async callback function that securely provides the password for encrypting the derived keys.
|
|
7588
|
+
*/
|
|
7589
|
+
type SingleAddressWalletFromMnemonicsConfig = {
|
|
7590
|
+
mnemonics: string[];
|
|
7591
|
+
provider: Provider;
|
|
7592
|
+
credentialsConfig: SingleAddressCredentialsConfig;
|
|
7593
|
+
getPassword: () => Promise<Uint8Array>;
|
|
7594
|
+
};
|
|
7595
|
+
/**
|
|
7596
|
+
* A simple, single-address wallet implementation for programmatic use.
|
|
7597
|
+
*
|
|
7598
|
+
* @class SingleAddressWallet
|
|
7599
|
+
* @implements {Wallet}
|
|
7600
|
+
* @remarks
|
|
7601
|
+
* This class provides a straightforward wallet interface that manages a single
|
|
7602
|
+
* payment and staking key pair derived from a specific path. It is not a
|
|
7603
|
+
* full Hierarchical Deterministic (HD) wallet and does not perform address
|
|
7604
|
+
* discovery. Its simplicity makes it ideal for testing, scripting, or backend
|
|
7605
|
+
* applications where interaction with a single, known address is required.
|
|
7606
|
+
*/
|
|
7607
|
+
declare class SingleAddressWallet implements Wallet {
|
|
7608
|
+
private secureKeyHandler;
|
|
7609
|
+
private provider;
|
|
7610
|
+
private credentialsConfig;
|
|
7611
|
+
private accountRootPublicKey;
|
|
7612
|
+
private paymentAddress;
|
|
7613
|
+
private rewardAddress;
|
|
7614
|
+
private drepPubKey;
|
|
7615
|
+
private protocolParams;
|
|
7616
|
+
/**
|
|
7617
|
+
* Constructs a new instance of the SingleAddressWallet.
|
|
7618
|
+
* @param {SingleAddressWalletConfig} config - The configuration object for the wallet.
|
|
7619
|
+
* @remarks This constructor is private. Use the static `createFromMnemonics` method to create an instance.
|
|
7620
|
+
*/
|
|
7621
|
+
constructor({ secureKeyHandler, provider, credentialsConfig, accountRootPublicKey }: SingleAddressWalletConfig);
|
|
7622
|
+
/**
|
|
7623
|
+
* Creates a new wallet instance from a mnemonic phrase.
|
|
7624
|
+
*
|
|
7625
|
+
* This factory method is the primary way to instantiate a wallet from a user's
|
|
7626
|
+
* seed phrase, handling the necessary key derivation and encryption.
|
|
7627
|
+
*
|
|
7628
|
+
* @param {SingleAddressWalletFromMnemonicsConfig} config - The configuration options for creating the wallet.
|
|
7629
|
+
* @returns {Promise<SingleAddressWallet>} A promise that resolves to the newly created wallet instance.
|
|
7630
|
+
*/
|
|
7631
|
+
static createFromMnemonics({ mnemonics, provider, credentialsConfig, getPassword }: SingleAddressWalletFromMnemonicsConfig): Promise<SingleAddressWallet>;
|
|
7632
|
+
/**
|
|
7633
|
+
* Returns the wallet's current network ID.
|
|
7634
|
+
* @returns {Promise<NetworkId>} A promise that resolves to the network ID (0 for Testnet, 1 for Mainnet).
|
|
7635
|
+
*/
|
|
7636
|
+
getNetworkId(): Promise<NetworkId>;
|
|
7637
|
+
/**
|
|
7638
|
+
* Fetches all Unspent Transaction Outputs (UTxOs) for the wallet's address.
|
|
7639
|
+
* @returns {Promise<UTxO[]>} A promise that resolves to an array of the wallet's UTxOs.
|
|
7640
|
+
*/
|
|
7641
|
+
getUnspentOutputs(): Promise<UTxO[]>;
|
|
7642
|
+
/**
|
|
7643
|
+
* Fetches and deserializes the total balance of all assets controlled by the wallet.
|
|
7644
|
+
* @returns {Promise<Value>} A promise that resolves to a `Value` object representing the wallet's complete balance.
|
|
7645
|
+
*/
|
|
7646
|
+
getBalance(): Promise<Value>;
|
|
7647
|
+
/**
|
|
7648
|
+
* Fetches and parses all used addresses controlled by the wallet.
|
|
7649
|
+
* @returns {Promise<Address[]>} A promise that resolves to an array of parsed `Address` objects.
|
|
7650
|
+
*/
|
|
7651
|
+
getUsedAddresses(): Promise<Address[]>;
|
|
7652
|
+
/**
|
|
7653
|
+
* Fetches and parses all unused addresses controlled by the wallet.
|
|
7654
|
+
* @returns {Promise<Address[]>} A promise that resolves to an array of parsed `Address` objects.
|
|
7655
|
+
* @remarks This method is currently not supported and always returns an empty array.
|
|
7656
|
+
*/
|
|
7657
|
+
getUnusedAddresses(): Promise<Address[]>;
|
|
7658
|
+
/**
|
|
7659
|
+
* Fetches and parses a single change address from the wallet.
|
|
7660
|
+
* @returns {Promise<Address>} A promise that resolves to a parsed `Address` object.
|
|
7661
|
+
*/
|
|
7662
|
+
getChangeAddress(): Promise<Address>;
|
|
7663
|
+
/**
|
|
7664
|
+
* Fetches and parses all reward addresses controlled by the wallet.
|
|
7665
|
+
* @returns {Promise<RewardAddress[]>} A promise that resolves to an array of parsed `RewardAddress` objects.
|
|
7666
|
+
*/
|
|
7667
|
+
getRewardAddresses(): Promise<RewardAddress[]>;
|
|
7668
|
+
/**
|
|
7669
|
+
* Requests a signature for a transaction using the wallet's keys.
|
|
7670
|
+
* @param {string} txCbor - The transaction to be signed, provided as a CBOR hex string.
|
|
7671
|
+
* @param {boolean} _partialSign - A flag to control which credentials are used for signing.
|
|
7672
|
+
* @returns {Promise<VkeyWitnessSet>} A promise that resolves to the deserialized `VkeyWitnessSet`.
|
|
7673
|
+
*/
|
|
7674
|
+
signTransaction(txCbor: string, _partialSign: boolean): Promise<VkeyWitnessSet>;
|
|
7675
|
+
/**
|
|
7676
|
+
* Requests a CIP-8 compliant data signature from the wallet.
|
|
7677
|
+
* @param {Address | string} address - The address to sign with (as an `Address` object or Bech32 string).
|
|
7678
|
+
* @param {string} payload - The hex-encoded data payload to be signed.
|
|
7679
|
+
* @returns {Promise<{ signature: string; key: string }>} A promise that resolves to the signature and public key.
|
|
7680
|
+
*/
|
|
7681
|
+
signData(address: Address | string, payload: string): Promise<{
|
|
7682
|
+
signature: string;
|
|
7683
|
+
key: string;
|
|
7684
|
+
}>;
|
|
7685
|
+
/**
|
|
7686
|
+
* Submits a fully signed transaction to the blockchain via the wallet's provider.
|
|
7687
|
+
* @param {string} txCbor - The fully signed transaction as a CBOR hex string.
|
|
7688
|
+
* @returns {Promise<string>} A promise that resolves to the transaction ID (hash).
|
|
7689
|
+
*/
|
|
7690
|
+
submitTransaction(txCbor: string): Promise<string>;
|
|
7691
|
+
/**
|
|
7692
|
+
* Fetches and deserializes the wallet's collateral UTxOs.
|
|
7693
|
+
* @returns {Promise<TxOut[]>} A promise that resolves to an array of collateral `TxOut` objects.
|
|
7694
|
+
* @remarks This method is currently not supported and always returns an empty array.
|
|
7695
|
+
*/
|
|
7696
|
+
getCollateral(): Promise<UTxO[]>;
|
|
7697
|
+
/**
|
|
7698
|
+
* Returns the "network magic," a unique number identifying the Cardano network.
|
|
7699
|
+
* @returns {Promise<number>} A promise that resolves to the network magic number (e.g., Mainnet: `764824073`, Preprod: `1`).
|
|
7700
|
+
*/
|
|
7701
|
+
getNetworkMagic(): Promise<NetworkMagic>;
|
|
7702
|
+
/**
|
|
7703
|
+
* Returns the wallet's active public DRep (Delegated Representative) key.
|
|
7704
|
+
* @returns {Promise<string>} A promise that resolves to the hex-encoded public DRep key.
|
|
7705
|
+
*/
|
|
7706
|
+
getPubDRepKey(): Promise<string>;
|
|
7707
|
+
/**
|
|
7708
|
+
* Returns public stake keys from the wallet that are currently registered for on-chain governance voting.
|
|
7709
|
+
* @returns {Promise<string[]>} A promise that resolves to an array of hex-encoded public stake keys.
|
|
7710
|
+
* @remarks This method is currently not supported and always returns an empty array.
|
|
7711
|
+
*/
|
|
7712
|
+
getRegisteredPubStakeKeys(): Promise<string[]>;
|
|
7713
|
+
/**
|
|
7714
|
+
* Returns public stake keys from the wallet that are NOT yet registered for on-chain governance voting.
|
|
7715
|
+
* @returns {Promise<string[]>} A promise that resolves to an array of hex-encoded public stake keys.
|
|
7716
|
+
* @remarks This method is currently not supported and always returns an empty array.
|
|
7717
|
+
*/
|
|
7718
|
+
getUnregisteredPubStakeKeys(): Promise<string[]>;
|
|
7719
|
+
/**
|
|
7720
|
+
* Creates and initializes a new transaction builder with the wallet's current state.
|
|
7721
|
+
*
|
|
7722
|
+
* @returns {Promise<TransactionBuilder>} A promise that resolves to a pre-configured `TransactionBuilder` instance.
|
|
7723
|
+
* @remarks
|
|
7724
|
+
* This method simplifies transaction construction by automatically pre-populating the builder with:
|
|
7725
|
+
* 1. The wallet's available UTxOs as inputs.
|
|
7726
|
+
* 2. The wallet's change address to receive any leftover funds.
|
|
7727
|
+
* 3. The network parameters from the wallet's provider.
|
|
7728
|
+
*
|
|
7729
|
+
* The returned builder is ready for you to add outputs and other transaction details.
|
|
7730
|
+
*/
|
|
7731
|
+
createTransactionBuilder(): Promise<TransactionBuilder>;
|
|
7732
|
+
/**
|
|
7733
|
+
* Derives the payment address based on the wallet's configuration.
|
|
7734
|
+
* @returns {Promise<Address>} A promise resolving to a BaseAddress (with staking) or an EnterpriseAddress (without staking).
|
|
7735
|
+
*/
|
|
7736
|
+
private getAddress;
|
|
7737
|
+
/**
|
|
7738
|
+
* Derives the rewards address based on the wallet's configuration.
|
|
7739
|
+
* @returns {Promise<Address>} A promise resolving to a Rewards.
|
|
7740
|
+
*/
|
|
7741
|
+
private getRewardAddress;
|
|
7742
|
+
/**
|
|
7743
|
+
* Helper to sign data using the STAKING key associated with a Reward Address.
|
|
7744
|
+
*/
|
|
7745
|
+
private signWithRewardKey;
|
|
7746
|
+
/**
|
|
7747
|
+
* Helper to sign data using the DREP key associated with an Enterprise Address.
|
|
7748
|
+
*/
|
|
7749
|
+
private signWithDRepKey;
|
|
7750
|
+
/**
|
|
7751
|
+
* Helper to sign data using the PAYMENT key associated with Base or Enterprise Address.
|
|
7752
|
+
*/
|
|
7753
|
+
private signWithPaymentKey;
|
|
7754
|
+
}
|
|
7755
|
+
|
|
7756
|
+
/**
|
|
7757
|
+
* This class acts as an adapter, consuming the raw, CBOR-based API of a CIP-30 wallet
|
|
7758
|
+
* and exposing methods that return deserialized, object types from Cometa.
|
|
7759
|
+
*/
|
|
7760
|
+
declare class BrowserExtensionWallet implements Wallet {
|
|
7761
|
+
private cip30Wallet;
|
|
7762
|
+
private protocolParams;
|
|
7763
|
+
private provider;
|
|
7764
|
+
/**
|
|
7765
|
+
* Constructs a new instance of the BrowserExtensionWallet.
|
|
7766
|
+
* @param {Cip30Wallet} cip30Wallet - The raw CIP-30 wallet API provided by the browser extension.
|
|
7767
|
+
* @param {Provider} provider - The provider used to fetch additional data.
|
|
7768
|
+
*/
|
|
7769
|
+
constructor(cip30Wallet: Cip30Wallet, provider: Provider);
|
|
7770
|
+
/**
|
|
7771
|
+
* Returns the wallet's current network ID.
|
|
7772
|
+
* @returns {Promise<NetworkId>} A promise that resolves to the network ID (0 for Testnet, 1 for Mainnet).
|
|
7773
|
+
*/
|
|
7774
|
+
getNetworkId(): Promise<NetworkId>;
|
|
7775
|
+
/**
|
|
7776
|
+
* Fetches the wallet's UTxOs and deserializes them from CBOR into an array of `TxOut` objects.
|
|
7777
|
+
* @returns {Promise<UTxO[]>} A promise that resolves to an array of the wallet's UTxOs.
|
|
7778
|
+
*/
|
|
7779
|
+
getUnspentOutputs(): Promise<UTxO[]>;
|
|
7780
|
+
/**
|
|
7781
|
+
* Fetches and deserializes the total balance of all assets controlled by the wallet.
|
|
7782
|
+
* @returns {Promise<Value>} A promise that resolves to a `Value` object representing the wallet's complete balance.
|
|
7783
|
+
*/
|
|
7784
|
+
getBalance(): Promise<Value>;
|
|
7785
|
+
/**
|
|
7786
|
+
* Fetches and parses all used addresses controlled by the wallet.
|
|
7787
|
+
* @returns {Promise<Address[]>} A promise that resolves to an array of parsed `Address` objects.
|
|
7788
|
+
*/
|
|
7789
|
+
getUsedAddresses(): Promise<Address[]>;
|
|
7790
|
+
/**
|
|
7791
|
+
* Fetches and parses all unused addresses controlled by the wallet.
|
|
7792
|
+
* @returns {Promise<Address[]>} A promise that resolves to an array of parsed `Address` objects.
|
|
7793
|
+
*/
|
|
7794
|
+
getUnusedAddresses(): Promise<Address[]>;
|
|
7795
|
+
/**
|
|
7796
|
+
* Fetches and parses a single change address from the wallet.
|
|
7797
|
+
* @returns {Promise<Address>} A promise that resolves to a parsed `Address` object.
|
|
7798
|
+
*/
|
|
7799
|
+
getChangeAddress(): Promise<Address>;
|
|
7800
|
+
/**
|
|
7801
|
+
* Fetches and parses all reward addresses controlled by the wallet.
|
|
7802
|
+
* @returns {Promise<RewardAddress[]>} A promise that resolves to an array of parsed `RewardAddress` objects.
|
|
7803
|
+
*/
|
|
7804
|
+
getRewardAddresses(): Promise<RewardAddress[]>;
|
|
7805
|
+
/**
|
|
7806
|
+
* Requests a transaction signature from the wallet and deserializes the resulting witness set.
|
|
7807
|
+
* @param {string} txCbor - The transaction to be signed, provided as a CBOR hex string.
|
|
7808
|
+
* @param {boolean} partialSign - If true, the wallet will only add its witness for multi-signature transactions.
|
|
7809
|
+
* @returns {Promise<VkeyWitnessSet>} A promise that resolves to the deserialized `VkeyWitnessSet`.
|
|
7810
|
+
*/
|
|
7811
|
+
signTransaction(txCbor: string, partialSign: boolean): Promise<VkeyWitnessSet>;
|
|
7812
|
+
/**
|
|
7813
|
+
* Requests a CIP-8 compliant data signature from the wallet.
|
|
7814
|
+
* @param {Address | string} address - The address to sign with (as an `Address` object or Bech32 string).
|
|
7815
|
+
* @param {string} payload - The hex-encoded data payload to be signed.
|
|
7816
|
+
* @returns {Promise<{ signature: string; key: string }>} A promise that resolves to the signature and public key.
|
|
7817
|
+
*/
|
|
7818
|
+
signData(address: Address | string, payload: string): Promise<{
|
|
7819
|
+
signature: string;
|
|
7820
|
+
key: string;
|
|
7821
|
+
}>;
|
|
7822
|
+
/**
|
|
7823
|
+
* Submits a fully signed transaction to the blockchain via the wallet's provider.
|
|
7824
|
+
* @param {string} txCbor - The fully signed transaction as a CBOR hex string.
|
|
7825
|
+
* @returns {Promise<string>} A promise that resolves to the transaction ID (hash).
|
|
7826
|
+
*/
|
|
7827
|
+
submitTransaction(txCbor: string): Promise<string>;
|
|
7828
|
+
/**
|
|
7829
|
+
* Fetches and deserializes the wallet's collateral UTxOs.
|
|
7830
|
+
* @returns {Promise<TxOut[]>} A promise that resolves to an array of collateral `TxOut` objects.
|
|
7831
|
+
* @remarks Collateral is required for transactions involving Plutus smart contracts.
|
|
7832
|
+
*/
|
|
7833
|
+
getCollateral(): Promise<UTxO[]>;
|
|
7834
|
+
/**
|
|
7835
|
+
* Returns the "network magic," a unique number identifying the Cardano network.
|
|
7836
|
+
* @returns {Promise<number>} A promise that resolves to the network magic number (e.g., Mainnet: `764824073`, Preprod: `1`).
|
|
7837
|
+
*/
|
|
7838
|
+
getNetworkMagic(): Promise<NetworkMagic>;
|
|
7839
|
+
/**
|
|
7840
|
+
* Returns the wallet's active public DRep (Delegated Representative) key.
|
|
7841
|
+
* @returns {Promise<string>} A promise that resolves to the hex-encoded public DRep key.
|
|
7842
|
+
*/
|
|
7843
|
+
getPubDRepKey(): Promise<string>;
|
|
7844
|
+
/**
|
|
7845
|
+
* Returns public stake keys from the wallet that are currently registered for on-chain governance voting.
|
|
7846
|
+
* @returns {Promise<string[]>} A promise that resolves to an array of hex-encoded public stake keys.
|
|
7847
|
+
*/
|
|
7848
|
+
getRegisteredPubStakeKeys(): Promise<string[]>;
|
|
7849
|
+
/**
|
|
7850
|
+
* Returns public stake keys from the wallet that are NOT yet registered for on-chain governance voting.
|
|
7851
|
+
* @returns {Promise<string[]>} A promise that resolves to an array of hex-encoded public stake keys.
|
|
7852
|
+
*/
|
|
7853
|
+
getUnregisteredPubStakeKeys(): Promise<string[]>;
|
|
7854
|
+
/**
|
|
7855
|
+
* Creates and initializes a new transaction builder with the wallet's current state.
|
|
7856
|
+
*
|
|
7857
|
+
* @returns {Promise<TransactionBuilder>} A promise that resolves to a pre-configured `TransactionBuilder` instance.
|
|
7858
|
+
* @remarks
|
|
7859
|
+
* This method simplifies transaction construction by automatically pre-populating the builder with:
|
|
7860
|
+
* 1. The wallet's available UTxOs as inputs.
|
|
7861
|
+
* 2. The wallet's change address to receive any leftover funds.
|
|
7862
|
+
* 3. The network parameters from the wallet's provider.
|
|
7863
|
+
*
|
|
7864
|
+
* The returned builder is ready for you to add outputs and other transaction details.
|
|
7865
|
+
*/
|
|
7866
|
+
createTransactionBuilder(): Promise<TransactionBuilder>;
|
|
7867
|
+
}
|
|
7868
|
+
|
|
7869
|
+
/**
|
|
7870
|
+
* The result of a CIP-8 signing operation, containing the COSE_Sign1 and COSE_Key
|
|
7871
|
+
* CBOR-encoded buffers.
|
|
7872
|
+
*
|
|
7873
|
+
* @typedef {Object} Cip8SignResult
|
|
7874
|
+
* @property {Uint8Array} coseSign1 - The CBOR-encoded COSE_Sign1 structure.
|
|
7875
|
+
* @property {Uint8Array} coseKey - The CBOR-encoded COSE_Key structure.
|
|
7876
|
+
*/
|
|
7877
|
+
type Cip8SignResult = {
|
|
7878
|
+
coseSign1: Uint8Array;
|
|
7879
|
+
coseKey: Uint8Array;
|
|
7880
|
+
};
|
|
7881
|
+
/**
|
|
7882
|
+
* A utility class for creating CIP-8 / COSE signatures using Cardano types.
|
|
7883
|
+
*
|
|
7884
|
+
* These functions produce the necessary COSE_Sign1 and COSE_Key structures
|
|
7885
|
+
* required by the CIP-30 `signData` API.
|
|
7886
|
+
*/
|
|
7887
|
+
declare class Cip8 {
|
|
7888
|
+
private constructor();
|
|
7889
|
+
/**
|
|
7890
|
+
* Signs arbitrary data and binds the signature to a Cardano address.
|
|
7891
|
+
*
|
|
7892
|
+
* @param {Uint8Array} message - The raw message bytes to sign.
|
|
7893
|
+
* @param {Address} address - The Cardano address object.
|
|
7894
|
+
* @param {Ed25519PrivateKey} signingKey - The Ed25519 private key object.
|
|
7895
|
+
* @returns {Cip8SignResult} - An object containing the COSE_Sign1 and COSE_Key buffers.
|
|
7896
|
+
* @throws {Error} - If the signing fails or inputs are invalid.
|
|
7897
|
+
*/
|
|
7898
|
+
static sign(message: Uint8Array, address: Address, signingKey: Ed25519PrivateKey): Cip8SignResult;
|
|
7899
|
+
/**
|
|
7900
|
+
* Signs arbitrary data and binds the signature to a key hash.
|
|
7901
|
+
*
|
|
7902
|
+
* @param {Uint8Array} message - The raw message bytes to sign.
|
|
7903
|
+
* @param {Uint8Array} keyHash - The raw bytes of the Blake2b-224 key hash (28 bytes) to bind the signature to.
|
|
7904
|
+
* @param {Ed25519PrivateKey} signingKey - The Ed25519 private key wrapper object.
|
|
7905
|
+
* @returns {Cip8SignResult} - An object containing the COSE_Sign1 and COSE_Key buffers.
|
|
7906
|
+
* @throws {Error} - If the signing fails or inputs are invalid.
|
|
7907
|
+
*/
|
|
7908
|
+
static signEx(message: Uint8Array, keyHash: Uint8Array, signingKey: Ed25519PrivateKey): Cip8SignResult;
|
|
7909
|
+
}
|
|
7910
|
+
|
|
7911
|
+
export { type AccountDerivationPath, Address, AddressType, type AlwaysAbstain, type AlwaysNoConfidence, type Anchor, type AssetAmounts, type AuthCommitteeHotCertificate, Base58, BaseAddress, Bech32, type Bech32DecodeResult, Bip32PrivateKey, Bip32PublicKey, type Bip32SecureKeyHandler, Blake2b, BlockfrostProvider, type BlockfrostProviderConfig, BrowserExtensionWallet, ByronAddress, ByronAddressType, CborMajorType, CborReader, CborReaderState, CborSimpleValue, CborTag, CborWriter, type Certificate, CertificateType, type Cip30Wallet, Cip8, type Cip8SignResult, type CoinSelector, type CoinSelectorParams, type CoinSelectorResult, CoinType, type CommitteeMember, type CommitteeMembers, type Constitution, type ConstrPlutusData, type CostModel, Crc32, type Credential, type CredentialSet, CredentialType, type DRep, type DRepRegistrationCertificate, type DRepThresholds, type DRepUnregistrationCertificate, type Datum, DatumType, type DerivationPath, Ed25519PrivateKey, Ed25519PublicKey, type Ed25519SecureKeyHandler, Ed25519Signature, Emip003, EmscriptenCoinSelector, EmscriptenProvider, EmscriptenTxEvaluator, EnterpriseAddress, type ExUnits, type ExUnitsPrices, type GenesisKeyDelegationCertificate, type GovernanceActionId, InstanceType, KeyDerivationPurpose, KeyDerivationRole, MAX_SIGNED_64BIT, MAX_UNSIGNED_64BIT, MIN_SIGNED_64BIT, type MirCertificate, MirCertificateKind, MirCertificatePot, type MirToPot, type MirToStakeCreds, type NativeScript, NativeScriptKind, NetworkId, NetworkMagic, Pbkdf2HmacSha512, type PlutusData, PlutusLanguageVersion, type PlutusList, type PlutusMap, type PlutusScript, PointerAddress, type PoolParameters, type PoolRegistrationCertificate, type PoolRetirementCertificate, type PoolVotingThresholds, type ProtocolParameters, type ProtocolParametersUpdate, type ProtocolVersion, type Provider, type Redeemer, RedeemerPurpose, type RegistrationCertificate, type Relay, type RelayByAddress, type RelayByName, type RelayByNameMultihost, type RequireAllOfScript, type RequireAnyOfScript, type RequireAtLeastScript, type RequireSignatureScript, type RequireTimeAfterScript, type RequireTimeBeforeScript, type ResignCommitteeColdCertificate, RewardAddress, type Script, ScriptType, type SecureKeyHandler, type SingleAddressCredentialsConfig, SingleAddressWallet, type SingleAddressWalletConfig, type SingleAddressWalletFromMnemonicsConfig, SoftwareBip32SecureKeyHandler, SoftwareEd25519SecureKeyHandler, type StakeDelegationCertificate, type StakeDeregistrationCertificate, type StakePointer, type StakeRegistrationCertificate, type StakeRegistrationDelegationCertificate, type StakeVoteDelegationCertificate, type StakeVoteRegistrationDelegationCertificate, TransactionBuilder, type TxEvaluator, type TxIn, type TxOut, type UTxO, type UnitInterval, type UnregistrationCertificate, type UpdateDRepCertificate, type Value, type VkeyWitness, type VkeyWitnessSet, Vote, type VoteDelegationCertificate, type VoteRegistrationDelegationCertificate, type Voter, VoterType, type VotingProcedure, type Wallet, type Withdrawals, addWithdrawal, applyVkeyWitnessSet, assertSuccess, assetIdFromParts, assetNameFromAssetId, asyncifyStateTracker, base64ToBytes, blake2bHashFromBytes, blake2bHashFromHex, bridgeCallbacks, cborToPlutusData, cborToScript, cip105DRepFromCredential, cip129DRepFromCredential, cip129DRepFromPublicKey, cip129DRepFromScript, computeScriptHash, dRepToAddress, dRepToCredential, deepEqualsPlutusData, deepEqualsScript, derefCostModel, derefCostModels, derefDRepVotingThresholds, derefExUnitPrices, derefExUnits, derefPoolVotingThresholds, derefProtocolParameters, derefProtocolVersion, derefUnitInterval, entropyToMnemonic, finalizationRegistry, getErrorString, getFromInstanceRegistry, getLibCardanoCVersion, getModule, getScriptAddress, getUniqueSigners, govActionIdFromBech32, govActionIdToBech32, harden, hexToBufferObject, hexToUint8Array, inspectTx, isDRepAbstain, isDRepCredential, isDRepNoConfidence, isNativeScript, isPlutusDataBigInt, isPlutusDataByteArray, isPlutusDataConstr, isPlutusDataList, isPlutusDataMap, isPlutusDataWithCborCache, isPlutusScript, isReady, jsonToNativeScript, mnemonicToEntropy, nativeScriptToJson, plutusDataToCbor, policyIdFromAssetId, prepareUtxoForEvaluation, readAnchor, readAssetId, readAuthCommitteeHotCertificate, readBlake2bHashData, readBufferData, readCertificate, readCommitteeMembersMap, readConstitution, readCostModel, readCostModels, readCredential, readCredentialSet, readDRepRegistrationCertificate, readDRepUnregistrationCertificate, readDRepVotingThresholds, readDatum, readExUnitPrices, readExUnits, readGenesisKeyDelegationCertificate, readGovernanceActionId, readI64, readInputSet, readIntervalComponents, readMoveInstantaneousRewardsCertificate, readPlutusData, readPoolParameters, readPoolRegistrationCertificate, readPoolRetirementCertificate, readPoolVotingThresholds, readProtocolParamUpdate, readProtocolParameters, readProtocolVersion, readRedeemer, readRedeemerList, readRedeemersFromTx, readRegistrationCertificate, readResignCommitteeColdCertificate, readScript, readStakeDelegationCertificate, readStakeDeregistrationCertificate, readStakeRegistrationCertificate, readStakeRegistrationDelegationCertificate, readStakeVoteDelegationCertificate, readStakeVoteRegistrationDelegationCertificate, readStringFromMemory, readTransactionFromCbor, readTxIn, readTxOut, readTxOutFromCbor, readUTxOtFromCbor, readUnitIntervalAsDouble, readUnregistrationCertificate, readUpdateDRepCertificate, readUtxo, readUtxoList, readValue, readValueFromCbor, readVkeyWitnessSet, readVkeyWitnessSetFromWitnessSetCbor, readVoteDelegationCertificate, readVoteRegistrationDelegationCertificate, readVoter, readVotingProcedure, readWithdrawalMap, ready, registerBridgeErrorHandler, registerInstance, reportBridgeError, scriptToCbor, splitToLowHigh64bit, toCip105DRepID, toCip129DRepID, toUnitInterval, uint8ArrayToHex, uint8ArrayToUtf8, unrefObject, unregisterBridgeErrorHandler, unregisterInstance, utf8ByteLen, utf8ToHex, utf8ToUint8Array, writeAccountDerivationPaths, writeAnchor, writeAssetId, writeAuthCommitteeHotCertificate, writeBytesToMemory, writeCertificate, writeCommitteeMembersMap, writeConstitution, writeCostModel, writeCostModels, writeCredential, writeCredentialSet, writeDRepRegistrationCertificate, writeDRepUnregistrationCertificate, writeDRepVotingThresholds, writeDatum, writeDerivationPaths, writeExUnitPrices, writeExUnits, writeGenesisKeyDelegationCertificate, writeGovernanceActionId, writeI64, writeInputSet, writeMoveInstantaneousRewardsCertificate, writePlutusData, writePoolParameters, writePoolRegistrationCertificate, writePoolRetirementCertificate, writePoolVotingThresholds, writeProtocolParamUpdate, writeProtocolParameters, writeProtocolVersion, writeRedeemer, writeRedeemerList, writeRegistrationCertificate, writeResignCommitteeColdCertificate, writeScript, writeStakeDelegationCertificate, writeStakeDeregistrationCertificate, writeStakeRegistrationCertificate, writeStakeRegistrationDelegationCertificate, writeStakeVoteDelegationCertificate, writeStakeVoteRegistrationDelegationCertificate, writeStringToMemory, writeTransactionToCbor, writeTxIn, writeTxOut, writeUnitInterval, writeUnitIntervalAsDouble, writeUnregistrationCertificate, writeUpdateDRepCertificate, writeUtxo, writeUtxoList, writeValue, writeVkeyWitnessSet, writeVoteDelegationCertificate, writeVoteRegistrationDelegationCertificate, writeVoter, writeVotingProcedure, writeWithdrawalMap };
|