@meshsdk/wallet 1.9.0-beta.74 → 1.9.0-beta.76

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1734,6 +1734,18 @@ var MeshWallet = class {
1734
1734
  }
1735
1735
  return this.addresses.enterpriseAddressBech32;
1736
1736
  }
1737
+ /**
1738
+ * Returns an address owned by the wallet that should be used as a change address to return leftover assets during transaction creation back to the connected wallet in hex format.
1739
+ *
1740
+ * @returns an address in hex format
1741
+ */
1742
+ async getChangeAddressHex(addressType = "payment") {
1743
+ await this.init();
1744
+ if (this.addresses.baseAddress && addressType === "payment") {
1745
+ return this.addresses.baseAddress.toBytes().toString();
1746
+ }
1747
+ return this.addresses.enterpriseAddress.toBytes().toString();
1748
+ }
1737
1749
  /**
1738
1750
  * This function shall return a list of one or more UTXOs (unspent transaction outputs) controlled by the wallet that are required to reach AT LEAST the combined ADA value target specified in amount AND the best suitable to be used as collateral inputs for transactions with plutus script inputs (pure ADA-only UTXOs).
1739
1751
  *
@@ -1749,6 +1761,21 @@ var MeshWallet = class {
1749
1761
  return (0, import_core_cst5.fromTxUnspentOutput)(utxo);
1750
1762
  });
1751
1763
  }
1764
+ /**
1765
+ * This function shall return a list of one or more UTXOs (unspent transaction outputs) controlled by the wallet that are required to reach AT LEAST the combined ADA value target specified in amount AND the best suitable to be used as collateral inputs for transactions with plutus script inputs (pure ADA-only UTXOs).
1766
+ *
1767
+ * If this cannot be attained, an error message with an explanation of the blocking problem shall be returned. NOTE: wallets are free to return UTXOs that add up to a greater total ADA value than requested in the amount parameter, but wallets must never return any result where UTXOs would sum up to a smaller total ADA value, instead in a case like that an error message must be returned.
1768
+ *
1769
+ * @param addressType - the type of address to fetch UTXOs from (default: payment)
1770
+ * @returns a list of UTXOs in hex format
1771
+ */
1772
+ async getCollateralHex(addressType = "payment") {
1773
+ await this.init();
1774
+ const utxos = await this.getCollateralUnspentOutput(addressType);
1775
+ return utxos.map((utxo) => {
1776
+ return utxo.toCbor().toString();
1777
+ });
1778
+ }
1752
1779
  /**
1753
1780
  * Return a list of supported CIPs of the wallet.
1754
1781
  *
@@ -1813,6 +1840,13 @@ var MeshWallet = class {
1813
1840
  async getRewardAddresses() {
1814
1841
  return [this.addresses.rewardAddressBech32];
1815
1842
  }
1843
+ /**
1844
+ * Returns a list of reward addresses owned by the wallet. A reward address is a stake address that is used to receive rewards from staking.
1845
+ * @returns a list of reward addresses in hex format
1846
+ */
1847
+ async getRewardAddressesHex() {
1848
+ return [this.addresses.rewardAddress.toBytes().toString()];
1849
+ }
1816
1850
  /**
1817
1851
  * Returns a list of unused addresses controlled by the wallet.
1818
1852
  *
@@ -1821,6 +1855,14 @@ var MeshWallet = class {
1821
1855
  async getUnusedAddresses() {
1822
1856
  return [await this.getChangeAddress()];
1823
1857
  }
1858
+ /**
1859
+ * Returns a list of unused addresses controlled by the wallet.
1860
+ *
1861
+ * @returns a list of unused addresses in hex format
1862
+ */
1863
+ async getUnusedAddressesHex() {
1864
+ return [await this.getChangeAddressHex()];
1865
+ }
1824
1866
  /**
1825
1867
  * Returns a list of used addresses controlled by the wallet.
1826
1868
  *
@@ -1829,6 +1871,14 @@ var MeshWallet = class {
1829
1871
  async getUsedAddresses() {
1830
1872
  return [await this.getChangeAddress()];
1831
1873
  }
1874
+ /**
1875
+ * Returns a list of used addresses controlled by the wallet.
1876
+ *
1877
+ * @returns a list of used addresses in hex format
1878
+ */
1879
+ async getUsedAddressesHex() {
1880
+ return [await this.getChangeAddressHex()];
1881
+ }
1832
1882
  /**
1833
1883
  * Get a list of UTXOs to be used for transaction building.
1834
1884
  *
@@ -1851,6 +1901,16 @@ var MeshWallet = class {
1851
1901
  const utxos = await this.getUsedUTxOs(addressType);
1852
1902
  return utxos.map((c) => (0, import_core_cst5.fromTxUnspentOutput)(c));
1853
1903
  }
1904
+ /**
1905
+ * Return a list of all UTXOs (unspent transaction outputs) controlled by the wallet.
1906
+ *
1907
+ * @param addressType - the type of address to fetch UTXOs from (default: payment)
1908
+ * @returns a list of UTXOs in hex format
1909
+ */
1910
+ async getUtxosHex(addressType = "payment") {
1911
+ const utxos = await this.getUsedUTxOs(addressType);
1912
+ return utxos.map((c) => c.toCbor().toString());
1913
+ }
1854
1914
  /**
1855
1915
  * This endpoint utilizes the [CIP-8 - Message Signing](https://cips.cardano.org/cips/cip8/) to sign arbitrary data, to verify the data was signed by the owner of the private key.
1856
1916
  *
@@ -1909,7 +1969,7 @@ var MeshWallet = class {
1909
1969
  import_core_cst5.VkeyWitness.fromCore
1910
1970
  )
1911
1971
  );
1912
- return witnessSet.toCbor();
1972
+ return witnessSet.toCbor().toString();
1913
1973
  }
1914
1974
  let signedTx = EmbeddedWallet.addWitnessSets(unsignedTx, [newSignatures]);
1915
1975
  return signedTx;
@@ -1921,7 +1981,7 @@ var MeshWallet = class {
1921
1981
  * @param partialSign - if the transactions are signed partially
1922
1982
  * @returns array of signed transactions CborHex string
1923
1983
  */
1924
- async signTxs(unsignedTxs, partialSign = false) {
1984
+ async signTxs(unsignedTxs, partialSign = false, returnFullTx = true) {
1925
1985
  await this.init();
1926
1986
  if (!this._wallet) {
1927
1987
  throw new Error(
@@ -1930,7 +1990,7 @@ var MeshWallet = class {
1930
1990
  }
1931
1991
  const signedTxs = [];
1932
1992
  for (const unsignedTx of unsignedTxs) {
1933
- const signedTx = await this.signTx(unsignedTx, partialSign);
1993
+ const signedTx = await this.signTx(unsignedTx, partialSign, returnFullTx);
1934
1994
  signedTxs.push(signedTx);
1935
1995
  }
1936
1996
  return signedTxs;
package/dist/index.d.cts CHANGED
@@ -577,6 +577,12 @@ declare class MeshWallet implements IWallet {
577
577
  * @returns an address
578
578
  */
579
579
  getChangeAddress(addressType?: GetAddressType): Promise<string>;
580
+ /**
581
+ * Returns an address owned by the wallet that should be used as a change address to return leftover assets during transaction creation back to the connected wallet in hex format.
582
+ *
583
+ * @returns an address in hex format
584
+ */
585
+ getChangeAddressHex(addressType?: GetAddressType): Promise<string>;
580
586
  /**
581
587
  * This function shall return a list of one or more UTXOs (unspent transaction outputs) controlled by the wallet that are required to reach AT LEAST the combined ADA value target specified in amount AND the best suitable to be used as collateral inputs for transactions with plutus script inputs (pure ADA-only UTXOs).
582
588
  *
@@ -586,6 +592,15 @@ declare class MeshWallet implements IWallet {
586
592
  * @returns a list of UTXOs
587
593
  */
588
594
  getCollateral(addressType?: GetAddressType): Promise<UTxO[]>;
595
+ /**
596
+ * This function shall return a list of one or more UTXOs (unspent transaction outputs) controlled by the wallet that are required to reach AT LEAST the combined ADA value target specified in amount AND the best suitable to be used as collateral inputs for transactions with plutus script inputs (pure ADA-only UTXOs).
597
+ *
598
+ * If this cannot be attained, an error message with an explanation of the blocking problem shall be returned. NOTE: wallets are free to return UTXOs that add up to a greater total ADA value than requested in the amount parameter, but wallets must never return any result where UTXOs would sum up to a smaller total ADA value, instead in a case like that an error message must be returned.
599
+ *
600
+ * @param addressType - the type of address to fetch UTXOs from (default: payment)
601
+ * @returns a list of UTXOs in hex format
602
+ */
603
+ getCollateralHex(addressType?: GetAddressType): Promise<string[]>;
589
604
  /**
590
605
  * Return a list of supported CIPs of the wallet.
591
606
  *
@@ -624,18 +639,35 @@ declare class MeshWallet implements IWallet {
624
639
  * @returns a list of reward addresses
625
640
  */
626
641
  getRewardAddresses(): Promise<string[]>;
642
+ /**
643
+ * Returns a list of reward addresses owned by the wallet. A reward address is a stake address that is used to receive rewards from staking.
644
+ * @returns a list of reward addresses in hex format
645
+ */
646
+ getRewardAddressesHex(): Promise<string[]>;
627
647
  /**
628
648
  * Returns a list of unused addresses controlled by the wallet.
629
649
  *
630
650
  * @returns a list of unused addresses
631
651
  */
632
652
  getUnusedAddresses(): Promise<string[]>;
653
+ /**
654
+ * Returns a list of unused addresses controlled by the wallet.
655
+ *
656
+ * @returns a list of unused addresses in hex format
657
+ */
658
+ getUnusedAddressesHex(): Promise<string[]>;
633
659
  /**
634
660
  * Returns a list of used addresses controlled by the wallet.
635
661
  *
636
662
  * @returns a list of used addresses
637
663
  */
638
664
  getUsedAddresses(): Promise<string[]>;
665
+ /**
666
+ * Returns a list of used addresses controlled by the wallet.
667
+ *
668
+ * @returns a list of used addresses in hex format
669
+ */
670
+ getUsedAddressesHex(): Promise<string[]>;
639
671
  /**
640
672
  * Get a list of UTXOs to be used for transaction building.
641
673
  *
@@ -652,6 +684,13 @@ declare class MeshWallet implements IWallet {
652
684
  * @returns a list of UTXOs
653
685
  */
654
686
  getUtxos(addressType?: GetAddressType): Promise<UTxO[]>;
687
+ /**
688
+ * Return a list of all UTXOs (unspent transaction outputs) controlled by the wallet.
689
+ *
690
+ * @param addressType - the type of address to fetch UTXOs from (default: payment)
691
+ * @returns a list of UTXOs in hex format
692
+ */
693
+ getUtxosHex(addressType?: GetAddressType): Promise<string[]>;
655
694
  /**
656
695
  * This endpoint utilizes the [CIP-8 - Message Signing](https://cips.cardano.org/cips/cip8/) to sign arbitrary data, to verify the data was signed by the owner of the private key.
657
696
  *
@@ -676,7 +715,7 @@ declare class MeshWallet implements IWallet {
676
715
  * @param partialSign - if the transactions are signed partially
677
716
  * @returns array of signed transactions CborHex string
678
717
  */
679
- signTxs(unsignedTxs: string[], partialSign?: boolean): Promise<string[]>;
718
+ signTxs(unsignedTxs: string[], partialSign?: boolean, returnFullTx?: boolean): Promise<string[]>;
680
719
  /**
681
720
  * Submits the signed transaction to the blockchain network.
682
721
  *
package/dist/index.d.ts CHANGED
@@ -577,6 +577,12 @@ declare class MeshWallet implements IWallet {
577
577
  * @returns an address
578
578
  */
579
579
  getChangeAddress(addressType?: GetAddressType): Promise<string>;
580
+ /**
581
+ * Returns an address owned by the wallet that should be used as a change address to return leftover assets during transaction creation back to the connected wallet in hex format.
582
+ *
583
+ * @returns an address in hex format
584
+ */
585
+ getChangeAddressHex(addressType?: GetAddressType): Promise<string>;
580
586
  /**
581
587
  * This function shall return a list of one or more UTXOs (unspent transaction outputs) controlled by the wallet that are required to reach AT LEAST the combined ADA value target specified in amount AND the best suitable to be used as collateral inputs for transactions with plutus script inputs (pure ADA-only UTXOs).
582
588
  *
@@ -586,6 +592,15 @@ declare class MeshWallet implements IWallet {
586
592
  * @returns a list of UTXOs
587
593
  */
588
594
  getCollateral(addressType?: GetAddressType): Promise<UTxO[]>;
595
+ /**
596
+ * This function shall return a list of one or more UTXOs (unspent transaction outputs) controlled by the wallet that are required to reach AT LEAST the combined ADA value target specified in amount AND the best suitable to be used as collateral inputs for transactions with plutus script inputs (pure ADA-only UTXOs).
597
+ *
598
+ * If this cannot be attained, an error message with an explanation of the blocking problem shall be returned. NOTE: wallets are free to return UTXOs that add up to a greater total ADA value than requested in the amount parameter, but wallets must never return any result where UTXOs would sum up to a smaller total ADA value, instead in a case like that an error message must be returned.
599
+ *
600
+ * @param addressType - the type of address to fetch UTXOs from (default: payment)
601
+ * @returns a list of UTXOs in hex format
602
+ */
603
+ getCollateralHex(addressType?: GetAddressType): Promise<string[]>;
589
604
  /**
590
605
  * Return a list of supported CIPs of the wallet.
591
606
  *
@@ -624,18 +639,35 @@ declare class MeshWallet implements IWallet {
624
639
  * @returns a list of reward addresses
625
640
  */
626
641
  getRewardAddresses(): Promise<string[]>;
642
+ /**
643
+ * Returns a list of reward addresses owned by the wallet. A reward address is a stake address that is used to receive rewards from staking.
644
+ * @returns a list of reward addresses in hex format
645
+ */
646
+ getRewardAddressesHex(): Promise<string[]>;
627
647
  /**
628
648
  * Returns a list of unused addresses controlled by the wallet.
629
649
  *
630
650
  * @returns a list of unused addresses
631
651
  */
632
652
  getUnusedAddresses(): Promise<string[]>;
653
+ /**
654
+ * Returns a list of unused addresses controlled by the wallet.
655
+ *
656
+ * @returns a list of unused addresses in hex format
657
+ */
658
+ getUnusedAddressesHex(): Promise<string[]>;
633
659
  /**
634
660
  * Returns a list of used addresses controlled by the wallet.
635
661
  *
636
662
  * @returns a list of used addresses
637
663
  */
638
664
  getUsedAddresses(): Promise<string[]>;
665
+ /**
666
+ * Returns a list of used addresses controlled by the wallet.
667
+ *
668
+ * @returns a list of used addresses in hex format
669
+ */
670
+ getUsedAddressesHex(): Promise<string[]>;
639
671
  /**
640
672
  * Get a list of UTXOs to be used for transaction building.
641
673
  *
@@ -652,6 +684,13 @@ declare class MeshWallet implements IWallet {
652
684
  * @returns a list of UTXOs
653
685
  */
654
686
  getUtxos(addressType?: GetAddressType): Promise<UTxO[]>;
687
+ /**
688
+ * Return a list of all UTXOs (unspent transaction outputs) controlled by the wallet.
689
+ *
690
+ * @param addressType - the type of address to fetch UTXOs from (default: payment)
691
+ * @returns a list of UTXOs in hex format
692
+ */
693
+ getUtxosHex(addressType?: GetAddressType): Promise<string[]>;
655
694
  /**
656
695
  * This endpoint utilizes the [CIP-8 - Message Signing](https://cips.cardano.org/cips/cip8/) to sign arbitrary data, to verify the data was signed by the owner of the private key.
657
696
  *
@@ -676,7 +715,7 @@ declare class MeshWallet implements IWallet {
676
715
  * @param partialSign - if the transactions are signed partially
677
716
  * @returns array of signed transactions CborHex string
678
717
  */
679
- signTxs(unsignedTxs: string[], partialSign?: boolean): Promise<string[]>;
718
+ signTxs(unsignedTxs: string[], partialSign?: boolean, returnFullTx?: boolean): Promise<string[]>;
680
719
  /**
681
720
  * Submits the signed transaction to the blockchain network.
682
721
  *
package/dist/index.js CHANGED
@@ -1787,6 +1787,18 @@ var MeshWallet = class {
1787
1787
  }
1788
1788
  return this.addresses.enterpriseAddressBech32;
1789
1789
  }
1790
+ /**
1791
+ * Returns an address owned by the wallet that should be used as a change address to return leftover assets during transaction creation back to the connected wallet in hex format.
1792
+ *
1793
+ * @returns an address in hex format
1794
+ */
1795
+ async getChangeAddressHex(addressType = "payment") {
1796
+ await this.init();
1797
+ if (this.addresses.baseAddress && addressType === "payment") {
1798
+ return this.addresses.baseAddress.toBytes().toString();
1799
+ }
1800
+ return this.addresses.enterpriseAddress.toBytes().toString();
1801
+ }
1790
1802
  /**
1791
1803
  * This function shall return a list of one or more UTXOs (unspent transaction outputs) controlled by the wallet that are required to reach AT LEAST the combined ADA value target specified in amount AND the best suitable to be used as collateral inputs for transactions with plutus script inputs (pure ADA-only UTXOs).
1792
1804
  *
@@ -1802,6 +1814,21 @@ var MeshWallet = class {
1802
1814
  return fromTxUnspentOutput2(utxo);
1803
1815
  });
1804
1816
  }
1817
+ /**
1818
+ * This function shall return a list of one or more UTXOs (unspent transaction outputs) controlled by the wallet that are required to reach AT LEAST the combined ADA value target specified in amount AND the best suitable to be used as collateral inputs for transactions with plutus script inputs (pure ADA-only UTXOs).
1819
+ *
1820
+ * If this cannot be attained, an error message with an explanation of the blocking problem shall be returned. NOTE: wallets are free to return UTXOs that add up to a greater total ADA value than requested in the amount parameter, but wallets must never return any result where UTXOs would sum up to a smaller total ADA value, instead in a case like that an error message must be returned.
1821
+ *
1822
+ * @param addressType - the type of address to fetch UTXOs from (default: payment)
1823
+ * @returns a list of UTXOs in hex format
1824
+ */
1825
+ async getCollateralHex(addressType = "payment") {
1826
+ await this.init();
1827
+ const utxos = await this.getCollateralUnspentOutput(addressType);
1828
+ return utxos.map((utxo) => {
1829
+ return utxo.toCbor().toString();
1830
+ });
1831
+ }
1805
1832
  /**
1806
1833
  * Return a list of supported CIPs of the wallet.
1807
1834
  *
@@ -1866,6 +1893,13 @@ var MeshWallet = class {
1866
1893
  async getRewardAddresses() {
1867
1894
  return [this.addresses.rewardAddressBech32];
1868
1895
  }
1896
+ /**
1897
+ * Returns a list of reward addresses owned by the wallet. A reward address is a stake address that is used to receive rewards from staking.
1898
+ * @returns a list of reward addresses in hex format
1899
+ */
1900
+ async getRewardAddressesHex() {
1901
+ return [this.addresses.rewardAddress.toBytes().toString()];
1902
+ }
1869
1903
  /**
1870
1904
  * Returns a list of unused addresses controlled by the wallet.
1871
1905
  *
@@ -1874,6 +1908,14 @@ var MeshWallet = class {
1874
1908
  async getUnusedAddresses() {
1875
1909
  return [await this.getChangeAddress()];
1876
1910
  }
1911
+ /**
1912
+ * Returns a list of unused addresses controlled by the wallet.
1913
+ *
1914
+ * @returns a list of unused addresses in hex format
1915
+ */
1916
+ async getUnusedAddressesHex() {
1917
+ return [await this.getChangeAddressHex()];
1918
+ }
1877
1919
  /**
1878
1920
  * Returns a list of used addresses controlled by the wallet.
1879
1921
  *
@@ -1882,6 +1924,14 @@ var MeshWallet = class {
1882
1924
  async getUsedAddresses() {
1883
1925
  return [await this.getChangeAddress()];
1884
1926
  }
1927
+ /**
1928
+ * Returns a list of used addresses controlled by the wallet.
1929
+ *
1930
+ * @returns a list of used addresses in hex format
1931
+ */
1932
+ async getUsedAddressesHex() {
1933
+ return [await this.getChangeAddressHex()];
1934
+ }
1885
1935
  /**
1886
1936
  * Get a list of UTXOs to be used for transaction building.
1887
1937
  *
@@ -1904,6 +1954,16 @@ var MeshWallet = class {
1904
1954
  const utxos = await this.getUsedUTxOs(addressType);
1905
1955
  return utxos.map((c) => fromTxUnspentOutput2(c));
1906
1956
  }
1957
+ /**
1958
+ * Return a list of all UTXOs (unspent transaction outputs) controlled by the wallet.
1959
+ *
1960
+ * @param addressType - the type of address to fetch UTXOs from (default: payment)
1961
+ * @returns a list of UTXOs in hex format
1962
+ */
1963
+ async getUtxosHex(addressType = "payment") {
1964
+ const utxos = await this.getUsedUTxOs(addressType);
1965
+ return utxos.map((c) => c.toCbor().toString());
1966
+ }
1907
1967
  /**
1908
1968
  * This endpoint utilizes the [CIP-8 - Message Signing](https://cips.cardano.org/cips/cip8/) to sign arbitrary data, to verify the data was signed by the owner of the private key.
1909
1969
  *
@@ -1962,7 +2022,7 @@ var MeshWallet = class {
1962
2022
  VkeyWitness4.fromCore
1963
2023
  )
1964
2024
  );
1965
- return witnessSet.toCbor();
2025
+ return witnessSet.toCbor().toString();
1966
2026
  }
1967
2027
  let signedTx = EmbeddedWallet.addWitnessSets(unsignedTx, [newSignatures]);
1968
2028
  return signedTx;
@@ -1974,7 +2034,7 @@ var MeshWallet = class {
1974
2034
  * @param partialSign - if the transactions are signed partially
1975
2035
  * @returns array of signed transactions CborHex string
1976
2036
  */
1977
- async signTxs(unsignedTxs, partialSign = false) {
2037
+ async signTxs(unsignedTxs, partialSign = false, returnFullTx = true) {
1978
2038
  await this.init();
1979
2039
  if (!this._wallet) {
1980
2040
  throw new Error(
@@ -1983,7 +2043,7 @@ var MeshWallet = class {
1983
2043
  }
1984
2044
  const signedTxs = [];
1985
2045
  for (const unsignedTx of unsignedTxs) {
1986
- const signedTx = await this.signTx(unsignedTx, partialSign);
2046
+ const signedTx = await this.signTx(unsignedTx, partialSign, returnFullTx);
1987
2047
  signedTxs.push(signedTx);
1988
2048
  }
1989
2049
  return signedTxs;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meshsdk/wallet",
3
- "version": "1.9.0-beta.74",
3
+ "version": "1.9.0-beta.76",
4
4
  "description": "Wallets - https://meshjs.dev/apis/wallets",
5
5
  "main": "./dist/index.cjs",
6
6
  "browser": "./dist/index.js",
@@ -35,9 +35,9 @@
35
35
  "typescript": "^5.3.3"
36
36
  },
37
37
  "dependencies": {
38
- "@meshsdk/common": "1.9.0-beta.74",
39
- "@meshsdk/core-cst": "1.9.0-beta.74",
40
- "@meshsdk/transaction": "1.9.0-beta.74",
38
+ "@meshsdk/common": "1.9.0-beta.76",
39
+ "@meshsdk/core-cst": "1.9.0-beta.76",
40
+ "@meshsdk/transaction": "1.9.0-beta.76",
41
41
  "@simplewebauthn/browser": "^13.0.0"
42
42
  },
43
43
  "prettier": "@meshsdk/configs/prettier",