@getpara/stellar-sdk-v14-integration 3.12.0 → 3.14.0

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.
@@ -1,7 +1,21 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
4
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
5
19
  var __export = (target, all) => {
6
20
  for (var name in all)
7
21
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -54,7 +68,11 @@ class ParaStellarSigner {
54
68
  }
55
69
  const t = import_stellar_sdk.TransactionBuilder.fromXDR(xdr, passphrase);
56
70
  const txHash = t.hash();
57
- const signatureBuffer = yield this.signBytes(txHash);
71
+ const signatureBuffer = yield this.signBytesWithCanonicalTransaction(txHash, {
72
+ walletType: "STELLAR",
73
+ transactionXdr: xdr,
74
+ networkPassphrase: passphrase
75
+ });
58
76
  t.addSignature(this.address, signatureBuffer.toString("base64"));
59
77
  return { signedTxXdr: t.toXDR(), signerAddress: this.address };
60
78
  });
@@ -77,10 +95,15 @@ class ParaStellarSigner {
77
95
  }
78
96
  signBytes(bytes) {
79
97
  return __async(this, null, function* () {
80
- const res = yield this.para.signMessage({
98
+ return this.signBytesWithCanonicalTransaction(bytes);
99
+ });
100
+ }
101
+ signBytesWithCanonicalTransaction(bytes, canonicalTransaction) {
102
+ return __async(this, null, function* () {
103
+ const res = yield this.para.signMessage(__spreadValues({
81
104
  walletId: this.currentWalletId,
82
105
  messageBase64: bytes.toString("base64")
83
- });
106
+ }, canonicalTransaction ? { canonicalTransaction } : {}));
84
107
  if (res.transactionReviewUrl) {
85
108
  throw new import_core_sdk.TransactionReviewError(res.transactionReviewUrl);
86
109
  }
@@ -1,3 +1,19 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
4
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
5
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
+ var __spreadValues = (a, b) => {
7
+ for (var prop in b || (b = {}))
8
+ if (__hasOwnProp.call(b, prop))
9
+ __defNormalProp(a, prop, b[prop]);
10
+ if (__getOwnPropSymbols)
11
+ for (var prop of __getOwnPropSymbols(b)) {
12
+ if (__propIsEnum.call(b, prop))
13
+ __defNormalProp(a, prop, b[prop]);
14
+ }
15
+ return a;
16
+ };
1
17
  var __async = (__this, __arguments, generator) => {
2
18
  return new Promise((resolve, reject) => {
3
19
  var fulfilled = (value) => {
@@ -33,7 +49,11 @@ class ParaStellarSigner {
33
49
  }
34
50
  const t = TransactionBuilder.fromXDR(xdr, passphrase);
35
51
  const txHash = t.hash();
36
- const signatureBuffer = yield this.signBytes(txHash);
52
+ const signatureBuffer = yield this.signBytesWithCanonicalTransaction(txHash, {
53
+ walletType: "STELLAR",
54
+ transactionXdr: xdr,
55
+ networkPassphrase: passphrase
56
+ });
37
57
  t.addSignature(this.address, signatureBuffer.toString("base64"));
38
58
  return { signedTxXdr: t.toXDR(), signerAddress: this.address };
39
59
  });
@@ -56,10 +76,15 @@ class ParaStellarSigner {
56
76
  }
57
77
  signBytes(bytes) {
58
78
  return __async(this, null, function* () {
59
- const res = yield this.para.signMessage({
79
+ return this.signBytesWithCanonicalTransaction(bytes);
80
+ });
81
+ }
82
+ signBytesWithCanonicalTransaction(bytes, canonicalTransaction) {
83
+ return __async(this, null, function* () {
84
+ const res = yield this.para.signMessage(__spreadValues({
60
85
  walletId: this.currentWalletId,
61
86
  messageBase64: bytes.toString("base64")
62
- });
87
+ }, canonicalTransaction ? { canonicalTransaction } : {}));
63
88
  if (res.transactionReviewUrl) {
64
89
  throw new TransactionReviewError(res.transactionReviewUrl);
65
90
  }
@@ -10,6 +10,7 @@ export declare class ParaStellarSigner {
10
10
  address: string;
11
11
  constructor(para: ParaCore, networkPassphrase?: string, walletId?: string);
12
12
  signBytes(bytes: Buffer): Promise<Buffer>;
13
+ private signBytesWithCanonicalTransaction;
13
14
  signTransaction: contract.SignTransaction;
14
15
  signTransactionXDR(transactionXDR: string, networkPassphrase: string): Promise<string>;
15
16
  signAuthEntry: contract.SignAuthEntry;
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@getpara/stellar-sdk-v14-integration",
3
- "version": "3.12.0",
3
+ "version": "3.14.0",
4
4
  "dependencies": {
5
- "@getpara/core-sdk": "3.12.0",
5
+ "@getpara/core-sdk": "3.14.0",
6
6
  "bs58": "^6.0.0"
7
7
  },
8
8
  "devDependencies": {
@@ -36,5 +36,5 @@
36
36
  "sideEffects": false,
37
37
  "types": "dist/types/index.d.ts",
38
38
  "typings": "dist/types/index.d.ts",
39
- "gitHead": "d35527b231d0ba1c19fadab258ab2c61888ce392"
39
+ "gitHead": "2b83e73b639ad1733d1c03a5e628a92c87b399c1"
40
40
  }