@meshsdk/wallet 1.9.0-beta.73 → 1.9.0-beta.75

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
@@ -907,7 +907,7 @@ var AppWallet = class {
907
907
  );
908
908
  }
909
909
  }
910
- async signTx(unsignedTx, partialSign = false, accountIndex = 0, keyIndex = 0) {
910
+ async signTx(unsignedTx, partialSign = false, returnFullTx = true, accountIndex = 0, keyIndex = 0) {
911
911
  try {
912
912
  const tx = (0, import_core_cst2.deserializeTx)(unsignedTx);
913
913
  if (!partialSign && tx.witnessSet().vkeys() !== void 0 && tx.witnessSet().vkeys().size() !== 0)
@@ -919,6 +919,16 @@ var AppWallet = class {
919
919
  accountIndex,
920
920
  keyIndex
921
921
  );
922
+ if (!returnFullTx) {
923
+ let witnessSet = new import_core_cst2.TransactionWitnessSet();
924
+ witnessSet.setVkeys(
925
+ import_core_cst2.Serialization.CborSet.fromCore(
926
+ [newSignatures.toCore()],
927
+ import_core_cst2.VkeyWitness.fromCore
928
+ )
929
+ );
930
+ return witnessSet.toCbor();
931
+ }
922
932
  let signedTx = EmbeddedWallet.addWitnessSets(unsignedTx, [newSignatures]);
923
933
  return signedTx;
924
934
  } catch (error) {
@@ -1146,13 +1156,17 @@ var BrowserWallet = class _BrowserWallet {
1146
1156
  *
1147
1157
  * @param unsignedTx - a transaction in CBOR
1148
1158
  * @param partialSign - if the transaction is signed partially
1159
+ * @param returnFullTx - if the full tx should be returned or only the witness set (default: true)
1149
1160
  * @returns a signed transaction in CBOR
1150
1161
  */
1151
- async signTx(unsignedTx, partialSign = false) {
1162
+ async signTx(unsignedTx, partialSign = false, returnFullTx = true) {
1152
1163
  const witness = await this._walletInstance.signTx(unsignedTx, partialSign);
1153
1164
  if (witness === "") {
1154
1165
  return unsignedTx;
1155
1166
  }
1167
+ if (!returnFullTx) {
1168
+ return witness;
1169
+ }
1156
1170
  return _BrowserWallet.addBrowserWitnesses(unsignedTx, witness);
1157
1171
  }
1158
1172
  /**
@@ -1866,9 +1880,10 @@ var MeshWallet = class {
1866
1880
  *
1867
1881
  * @param unsignedTx - a transaction in CBOR
1868
1882
  * @param partialSign - if the transaction is partially signed (default: false)
1883
+ * @param returnFullTx - if the full tx should be returned or only the witness set (default: true)
1869
1884
  * @returns a signed transaction in CBOR
1870
1885
  */
1871
- async signTx(unsignedTx, partialSign = false) {
1886
+ async signTx(unsignedTx, partialSign = false, returnFullTx = true) {
1872
1887
  await this.init();
1873
1888
  if (!this._wallet) {
1874
1889
  throw new Error(
@@ -1886,6 +1901,16 @@ var MeshWallet = class {
1886
1901
  this._keyIndex,
1887
1902
  this._accountType
1888
1903
  );
1904
+ if (!returnFullTx) {
1905
+ let witnessSet = new import_core_cst5.TransactionWitnessSet();
1906
+ witnessSet.setVkeys(
1907
+ import_core_cst5.Serialization.CborSet.fromCore(
1908
+ [newSignatures.toCore()],
1909
+ import_core_cst5.VkeyWitness.fromCore
1910
+ )
1911
+ );
1912
+ return witnessSet.toCbor();
1913
+ }
1889
1914
  let signedTx = EmbeddedWallet.addWitnessSets(unsignedTx, [newSignatures]);
1890
1915
  return signedTx;
1891
1916
  }
package/dist/index.d.cts CHANGED
@@ -97,7 +97,7 @@ declare class AppWallet implements ISigner, ISubmitter {
97
97
  getUsedAddress(accountIndex?: number, keyIndex?: number, addressType?: GetAddressType): Address;
98
98
  getUnspentOutputs(accountIndex?: number, addressType?: GetAddressType): Promise<TransactionUnspentOutput[]>;
99
99
  signData(address: string, payload: string, accountIndex?: number, keyIndex?: number): Promise<DataSignature>;
100
- signTx(unsignedTx: string, partialSign?: boolean, accountIndex?: number, keyIndex?: number): Promise<string>;
100
+ signTx(unsignedTx: string, partialSign?: boolean, returnFullTx?: boolean, accountIndex?: number, keyIndex?: number): Promise<string>;
101
101
  signTxSync(unsignedTx: string, partialSign?: boolean, accountIndex?: number, keyIndex?: number): string;
102
102
  signTxs(unsignedTxs: string[], partialSign: boolean): Promise<string[]>;
103
103
  submitTx(tx: string): Promise<string>;
@@ -226,9 +226,10 @@ declare class BrowserWallet implements IWallet {
226
226
  *
227
227
  * @param unsignedTx - a transaction in CBOR
228
228
  * @param partialSign - if the transaction is signed partially
229
+ * @param returnFullTx - if the full tx should be returned or only the witness set (default: true)
229
230
  * @returns a signed transaction in CBOR
230
231
  */
231
- signTx(unsignedTx: string, partialSign?: boolean): Promise<string>;
232
+ signTx(unsignedTx: string, partialSign?: boolean, returnFullTx?: boolean): Promise<string>;
232
233
  /**
233
234
  * Experimental feature - sign multiple transactions at once (Supported wallet(s): Typhon)
234
235
  *
@@ -664,9 +665,10 @@ declare class MeshWallet implements IWallet {
664
665
  *
665
666
  * @param unsignedTx - a transaction in CBOR
666
667
  * @param partialSign - if the transaction is partially signed (default: false)
668
+ * @param returnFullTx - if the full tx should be returned or only the witness set (default: true)
667
669
  * @returns a signed transaction in CBOR
668
670
  */
669
- signTx(unsignedTx: string, partialSign?: boolean): Promise<string>;
671
+ signTx(unsignedTx: string, partialSign?: boolean, returnFullTx?: boolean): Promise<string>;
670
672
  /**
671
673
  * Experimental feature - sign multiple transactions at once.
672
674
  *
package/dist/index.d.ts CHANGED
@@ -97,7 +97,7 @@ declare class AppWallet implements ISigner, ISubmitter {
97
97
  getUsedAddress(accountIndex?: number, keyIndex?: number, addressType?: GetAddressType): Address;
98
98
  getUnspentOutputs(accountIndex?: number, addressType?: GetAddressType): Promise<TransactionUnspentOutput[]>;
99
99
  signData(address: string, payload: string, accountIndex?: number, keyIndex?: number): Promise<DataSignature>;
100
- signTx(unsignedTx: string, partialSign?: boolean, accountIndex?: number, keyIndex?: number): Promise<string>;
100
+ signTx(unsignedTx: string, partialSign?: boolean, returnFullTx?: boolean, accountIndex?: number, keyIndex?: number): Promise<string>;
101
101
  signTxSync(unsignedTx: string, partialSign?: boolean, accountIndex?: number, keyIndex?: number): string;
102
102
  signTxs(unsignedTxs: string[], partialSign: boolean): Promise<string[]>;
103
103
  submitTx(tx: string): Promise<string>;
@@ -226,9 +226,10 @@ declare class BrowserWallet implements IWallet {
226
226
  *
227
227
  * @param unsignedTx - a transaction in CBOR
228
228
  * @param partialSign - if the transaction is signed partially
229
+ * @param returnFullTx - if the full tx should be returned or only the witness set (default: true)
229
230
  * @returns a signed transaction in CBOR
230
231
  */
231
- signTx(unsignedTx: string, partialSign?: boolean): Promise<string>;
232
+ signTx(unsignedTx: string, partialSign?: boolean, returnFullTx?: boolean): Promise<string>;
232
233
  /**
233
234
  * Experimental feature - sign multiple transactions at once (Supported wallet(s): Typhon)
234
235
  *
@@ -664,9 +665,10 @@ declare class MeshWallet implements IWallet {
664
665
  *
665
666
  * @param unsignedTx - a transaction in CBOR
666
667
  * @param partialSign - if the transaction is partially signed (default: false)
668
+ * @param returnFullTx - if the full tx should be returned or only the witness set (default: true)
667
669
  * @returns a signed transaction in CBOR
668
670
  */
669
- signTx(unsignedTx: string, partialSign?: boolean): Promise<string>;
671
+ signTx(unsignedTx: string, partialSign?: boolean, returnFullTx?: boolean): Promise<string>;
670
672
  /**
671
673
  * Experimental feature - sign multiple transactions at once.
672
674
  *
package/dist/index.js CHANGED
@@ -287,8 +287,11 @@ var require_dist = __commonJS({
287
287
  // src/app/index.ts
288
288
  import {
289
289
  deserializeTx as deserializeTx2,
290
+ Serialization as Serialization2,
290
291
  toAddress,
291
- toTxUnspentOutput
292
+ toTxUnspentOutput,
293
+ TransactionWitnessSet,
294
+ VkeyWitness as VkeyWitness2
292
295
  } from "@meshsdk/core-cst";
293
296
 
294
297
  // ../../node_modules/@scure/base/lib/esm/index.js
@@ -917,7 +920,7 @@ var AppWallet = class {
917
920
  );
918
921
  }
919
922
  }
920
- async signTx(unsignedTx, partialSign = false, accountIndex = 0, keyIndex = 0) {
923
+ async signTx(unsignedTx, partialSign = false, returnFullTx = true, accountIndex = 0, keyIndex = 0) {
921
924
  try {
922
925
  const tx = deserializeTx2(unsignedTx);
923
926
  if (!partialSign && tx.witnessSet().vkeys() !== void 0 && tx.witnessSet().vkeys().size() !== 0)
@@ -929,6 +932,16 @@ var AppWallet = class {
929
932
  accountIndex,
930
933
  keyIndex
931
934
  );
935
+ if (!returnFullTx) {
936
+ let witnessSet = new TransactionWitnessSet();
937
+ witnessSet.setVkeys(
938
+ Serialization2.CborSet.fromCore(
939
+ [newSignatures.toCore()],
940
+ VkeyWitness2.fromCore
941
+ )
942
+ );
943
+ return witnessSet.toCbor();
944
+ }
932
945
  let signedTx = EmbeddedWallet.addWitnessSets(unsignedTx, [newSignatures]);
933
946
  return signedTx;
934
947
  } catch (error) {
@@ -977,10 +990,10 @@ import {
977
990
  fromTxUnspentOutput,
978
991
  fromValue,
979
992
  hexToBech32 as hexToBech322,
980
- Serialization as Serialization2,
993
+ Serialization as Serialization3,
981
994
  toAddress as toAddress2,
982
995
  Transaction as Transaction2,
983
- VkeyWitness as VkeyWitness2
996
+ VkeyWitness as VkeyWitness3
984
997
  } from "@meshsdk/core-cst";
985
998
  var BrowserWallet = class _BrowserWallet {
986
999
  constructor(_walletInstance, _walletName) {
@@ -1177,13 +1190,17 @@ var BrowserWallet = class _BrowserWallet {
1177
1190
  *
1178
1191
  * @param unsignedTx - a transaction in CBOR
1179
1192
  * @param partialSign - if the transaction is signed partially
1193
+ * @param returnFullTx - if the full tx should be returned or only the witness set (default: true)
1180
1194
  * @returns a signed transaction in CBOR
1181
1195
  */
1182
- async signTx(unsignedTx, partialSign = false) {
1196
+ async signTx(unsignedTx, partialSign = false, returnFullTx = true) {
1183
1197
  const witness = await this._walletInstance.signTx(unsignedTx, partialSign);
1184
1198
  if (witness === "") {
1185
1199
  return unsignedTx;
1186
1200
  }
1201
+ if (!returnFullTx) {
1202
+ return witness;
1203
+ }
1187
1204
  return _BrowserWallet.addBrowserWitnesses(unsignedTx, witness);
1188
1205
  }
1189
1206
  /**
@@ -1441,7 +1458,7 @@ var BrowserWallet = class _BrowserWallet {
1441
1458
  }
1442
1459
  }
1443
1460
  static addBrowserWitnesses(unsignedTx, witnesses) {
1444
- const cWitness = Serialization2.TransactionWitnessSet.fromCbor(
1461
+ const cWitness = Serialization3.TransactionWitnessSet.fromCbor(
1445
1462
  CardanoSDKUtil.HexBlob(witnesses)
1446
1463
  ).vkeys()?.values();
1447
1464
  if (cWitness === void 0) {
@@ -1452,9 +1469,9 @@ var BrowserWallet = class _BrowserWallet {
1452
1469
  let witnessSetVkeys = witnessSet.vkeys();
1453
1470
  let witnessSetVkeysValues = witnessSetVkeys ? [...witnessSetVkeys.values(), ...cWitness] : [...cWitness];
1454
1471
  witnessSet.setVkeys(
1455
- Serialization2.CborSet.fromCore(
1472
+ Serialization3.CborSet.fromCore(
1456
1473
  witnessSetVkeysValues.map((vkw) => vkw.toCore()),
1457
- VkeyWitness2.fromCore
1474
+ VkeyWitness3.fromCore
1458
1475
  )
1459
1476
  );
1460
1477
  return new Transaction2(tx.body(), witnessSet, tx.auxiliaryData()).toCbor();
@@ -1642,8 +1659,11 @@ import {
1642
1659
  fromTxUnspentOutput as fromTxUnspentOutput2,
1643
1660
  Hash28ByteBase16 as Hash28ByteBase162,
1644
1661
  resolvePrivateKey,
1662
+ Serialization as Serialization4,
1645
1663
  toAddress as toAddress3,
1646
- toTxUnspentOutput as toTxUnspentOutput2
1664
+ toTxUnspentOutput as toTxUnspentOutput2,
1665
+ TransactionWitnessSet as TransactionWitnessSet2,
1666
+ VkeyWitness as VkeyWitness4
1647
1667
  } from "@meshsdk/core-cst";
1648
1668
  import { Transaction as Transaction3 } from "@meshsdk/transaction";
1649
1669
  var MeshWallet = class {
@@ -1913,9 +1933,10 @@ var MeshWallet = class {
1913
1933
  *
1914
1934
  * @param unsignedTx - a transaction in CBOR
1915
1935
  * @param partialSign - if the transaction is partially signed (default: false)
1936
+ * @param returnFullTx - if the full tx should be returned or only the witness set (default: true)
1916
1937
  * @returns a signed transaction in CBOR
1917
1938
  */
1918
- async signTx(unsignedTx, partialSign = false) {
1939
+ async signTx(unsignedTx, partialSign = false, returnFullTx = true) {
1919
1940
  await this.init();
1920
1941
  if (!this._wallet) {
1921
1942
  throw new Error(
@@ -1933,6 +1954,16 @@ var MeshWallet = class {
1933
1954
  this._keyIndex,
1934
1955
  this._accountType
1935
1956
  );
1957
+ if (!returnFullTx) {
1958
+ let witnessSet = new TransactionWitnessSet2();
1959
+ witnessSet.setVkeys(
1960
+ Serialization4.CborSet.fromCore(
1961
+ [newSignatures.toCore()],
1962
+ VkeyWitness4.fromCore
1963
+ )
1964
+ );
1965
+ return witnessSet.toCbor();
1966
+ }
1936
1967
  let signedTx = EmbeddedWallet.addWitnessSets(unsignedTx, [newSignatures]);
1937
1968
  return signedTx;
1938
1969
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meshsdk/wallet",
3
- "version": "1.9.0-beta.73",
3
+ "version": "1.9.0-beta.75",
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.73",
39
- "@meshsdk/core-cst": "1.9.0-beta.73",
40
- "@meshsdk/transaction": "1.9.0-beta.73",
38
+ "@meshsdk/common": "1.9.0-beta.75",
39
+ "@meshsdk/core-cst": "1.9.0-beta.75",
40
+ "@meshsdk/transaction": "1.9.0-beta.75",
41
41
  "@simplewebauthn/browser": "^13.0.0"
42
42
  },
43
43
  "prettier": "@meshsdk/configs/prettier",