@getpara/cosmjs-v0-integration 3.13.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.
@@ -99,12 +99,17 @@ class ParaProtoSigner extends ParaCosmosSigner {
99
99
  const hashedMessage = (0, import_crypto.sha256)(signBytes);
100
100
  const signDocJson = import_tx.SignDoc.toJSON(signDoc);
101
101
  const signDocJsonStringified = JSON.stringify(signDocJson);
102
- const signDocJsonStringEncoded = btoa(signDocJsonStringified);
102
+ const signDocJsonStringEncoded = Buffer.from(signDocJsonStringified).toString("base64");
103
103
  const res = yield this.para.signMessage({
104
104
  walletId: this.currentWallet.id,
105
105
  messageBase64: Buffer.from(hashedMessage.buffer).toString("base64"),
106
106
  timeoutMs: this.messageSigningTimeoutMs,
107
- cosmosSignDocBase64: signDocJsonStringEncoded
107
+ cosmosSignDocBase64: signDocJsonStringEncoded,
108
+ canonicalTransaction: {
109
+ walletType: "COSMOS",
110
+ signMode: "DIRECT",
111
+ signDocBase64: signDocJsonStringEncoded
112
+ }
108
113
  });
109
114
  const signature = (0, import_core_sdk.hexToSignature)(`0x${res.signature}`);
110
115
  const extendedSignature = new import_crypto.ExtendedSecp256k1Signature(
@@ -127,9 +132,15 @@ class ParaAminoSigner extends ParaCosmosSigner {
127
132
  throw new Error(`Address ${signerAddress} not found in wallet`);
128
133
  }
129
134
  const hashedMessage = new import_crypto.Sha256((0, import_amino.serializeSignDoc)(signDoc)).digest();
135
+ const signDocBase64 = Buffer.from(JSON.stringify(signDoc)).toString("base64");
130
136
  const res = yield this.para.signMessage({
131
137
  walletId: this.currentWallet.id,
132
- messageBase64: Buffer.from(hashedMessage.buffer).toString("base64")
138
+ messageBase64: Buffer.from(hashedMessage.buffer).toString("base64"),
139
+ canonicalTransaction: {
140
+ walletType: "COSMOS",
141
+ signMode: "AMINO",
142
+ signDocBase64
143
+ }
133
144
  });
134
145
  const signature = (0, import_core_sdk.hexToSignature)(`0x${res.signature}`);
135
146
  const extendedSignature = new import_crypto.ExtendedSecp256k1Signature(
@@ -64,12 +64,17 @@ class ParaProtoSigner extends ParaCosmosSigner {
64
64
  const hashedMessage = sha256(signBytes);
65
65
  const signDocJson = SignDoc.toJSON(signDoc);
66
66
  const signDocJsonStringified = JSON.stringify(signDocJson);
67
- const signDocJsonStringEncoded = btoa(signDocJsonStringified);
67
+ const signDocJsonStringEncoded = Buffer.from(signDocJsonStringified).toString("base64");
68
68
  const res = yield this.para.signMessage({
69
69
  walletId: this.currentWallet.id,
70
70
  messageBase64: Buffer.from(hashedMessage.buffer).toString("base64"),
71
71
  timeoutMs: this.messageSigningTimeoutMs,
72
- cosmosSignDocBase64: signDocJsonStringEncoded
72
+ cosmosSignDocBase64: signDocJsonStringEncoded,
73
+ canonicalTransaction: {
74
+ walletType: "COSMOS",
75
+ signMode: "DIRECT",
76
+ signDocBase64: signDocJsonStringEncoded
77
+ }
73
78
  });
74
79
  const signature = hexToSignature(`0x${res.signature}`);
75
80
  const extendedSignature = new ExtendedSecp256k1Signature(
@@ -92,9 +97,15 @@ class ParaAminoSigner extends ParaCosmosSigner {
92
97
  throw new Error(`Address ${signerAddress} not found in wallet`);
93
98
  }
94
99
  const hashedMessage = new Sha256(serializeSignDoc(signDoc)).digest();
100
+ const signDocBase64 = Buffer.from(JSON.stringify(signDoc)).toString("base64");
95
101
  const res = yield this.para.signMessage({
96
102
  walletId: this.currentWallet.id,
97
- messageBase64: Buffer.from(hashedMessage.buffer).toString("base64")
103
+ messageBase64: Buffer.from(hashedMessage.buffer).toString("base64"),
104
+ canonicalTransaction: {
105
+ walletType: "COSMOS",
106
+ signMode: "AMINO",
107
+ signDocBase64
108
+ }
98
109
  });
99
110
  const signature = hexToSignature(`0x${res.signature}`);
100
111
  const extendedSignature = new ExtendedSecp256k1Signature(
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@getpara/cosmjs-v0-integration",
3
- "version": "3.13.0",
3
+ "version": "3.14.0",
4
4
  "dependencies": {
5
- "@getpara/core-sdk": "3.13.0"
5
+ "@getpara/core-sdk": "3.14.0"
6
6
  },
7
7
  "devDependencies": {
8
8
  "@cosmjs/amino": "^0.32.4",
@@ -16,7 +16,7 @@
16
16
  "dist",
17
17
  "package.json"
18
18
  ],
19
- "gitHead": "e46840146acd41d5942c03096d93a3d1316857b3",
19
+ "gitHead": "2b83e73b639ad1733d1c03a5e628a92c87b399c1",
20
20
  "main": "dist/cjs/index.js",
21
21
  "module": "dist/esm/index.js",
22
22
  "peerDependencies": {
@@ -27,6 +27,7 @@
27
27
  },
28
28
  "scripts": {
29
29
  "build": "rm -rf dist && node ./scripts/build.mjs && yarn build:types",
30
+ "test": "vitest run",
30
31
  "build:cjs": "rm -rf dist/cjs && tsc --module commonjs --outDir dist/cjs && printf '{\"type\":\"commonjs\"}' > dist/cjs/package.json",
31
32
  "build:esm": "rm -rf dist/esm && tsc --module es6 --outDir dist/esm && printf '{\"type\":\"module\",\"sideEffects\":false}' > dist/esm/package.json",
32
33
  "build:types": "rm -rf dist/types && tsc --module es6 --declarationDir dist/types --emitDeclarationOnly --declaration",