@getpara/cosmjs-v0-integration 3.20.0 → 3.21.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.
- package/dist/cjs/cosmosSigners.js +6 -14
- package/dist/esm/cosmosSigners.js +7 -15
- package/dist/types/cosmosSigners.d.ts +6 -3
- package/package.json +12 -17
|
@@ -89,6 +89,10 @@ class ParaCosmosSigner {
|
|
|
89
89
|
});
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
|
+
function toFixedLengthCosmosSignature(signatureHex) {
|
|
93
|
+
const signature = (0, import_core_sdk.hexToSignature)(`0x${signatureHex}`);
|
|
94
|
+
return new Uint8Array([...(0, import_core_sdk.hexToUint8Array)(signature.r), ...(0, import_core_sdk.hexToUint8Array)(signature.s)]);
|
|
95
|
+
}
|
|
92
96
|
class ParaProtoSigner extends ParaCosmosSigner {
|
|
93
97
|
signDirect(address, signDoc) {
|
|
94
98
|
return __async(this, null, function* () {
|
|
@@ -111,13 +115,7 @@ class ParaProtoSigner extends ParaCosmosSigner {
|
|
|
111
115
|
signDocBase64: signDocJsonStringEncoded
|
|
112
116
|
}
|
|
113
117
|
});
|
|
114
|
-
const
|
|
115
|
-
const extendedSignature = new import_crypto.ExtendedSecp256k1Signature(
|
|
116
|
-
(0, import_core_sdk.hexToUint8Array)(signature.r),
|
|
117
|
-
(0, import_core_sdk.hexToUint8Array)(signature.s),
|
|
118
|
-
Number(signature.v)
|
|
119
|
-
);
|
|
120
|
-
const signatureBytes = new Uint8Array([...extendedSignature.r(32), ...extendedSignature.s(32)]);
|
|
118
|
+
const signatureBytes = toFixedLengthCosmosSignature((0, import_core_sdk.requireSuccessfulSignature)(res));
|
|
121
119
|
return {
|
|
122
120
|
signed: signDoc,
|
|
123
121
|
signature: (0, import_amino.encodeSecp256k1Signature)(this.publicKey, signatureBytes)
|
|
@@ -142,13 +140,7 @@ class ParaAminoSigner extends ParaCosmosSigner {
|
|
|
142
140
|
signDocBase64
|
|
143
141
|
}
|
|
144
142
|
});
|
|
145
|
-
const
|
|
146
|
-
const extendedSignature = new import_crypto.ExtendedSecp256k1Signature(
|
|
147
|
-
(0, import_core_sdk.hexToUint8Array)(signature.r),
|
|
148
|
-
(0, import_core_sdk.hexToUint8Array)(signature.s),
|
|
149
|
-
Number(signature.v)
|
|
150
|
-
);
|
|
151
|
-
const signatureBytes = new Uint8Array([...extendedSignature.r(32), ...extendedSignature.s(32)]);
|
|
143
|
+
const signatureBytes = toFixedLengthCosmosSignature((0, import_core_sdk.requireSuccessfulSignature)(res));
|
|
152
144
|
return {
|
|
153
145
|
signed: signDoc,
|
|
154
146
|
signature: (0, import_amino.encodeSecp256k1Signature)(this.publicKey, signatureBytes)
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
encodeSecp256k1Signature,
|
|
6
6
|
serializeSignDoc
|
|
7
7
|
} from "@cosmjs/amino";
|
|
8
|
-
import { Secp256k1, Sha256, sha256
|
|
8
|
+
import { Secp256k1, Sha256, sha256 } from "@cosmjs/crypto";
|
|
9
9
|
import { makeSignBytes } from "@cosmjs/proto-signing";
|
|
10
10
|
import { SignDoc } from "cosmjs-types/cosmos/tx/v1beta1/tx";
|
|
11
11
|
import {
|
|
@@ -55,6 +55,10 @@ class ParaCosmosSigner {
|
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
+
function toFixedLengthCosmosSignature(signatureHex) {
|
|
59
|
+
const signature = hexToSignature(`0x${signatureHex}`);
|
|
60
|
+
return new Uint8Array([...hexToUint8Array(signature.r), ...hexToUint8Array(signature.s)]);
|
|
61
|
+
}
|
|
58
62
|
class ParaProtoSigner extends ParaCosmosSigner {
|
|
59
63
|
signDirect(address, signDoc) {
|
|
60
64
|
return __async(this, null, function* () {
|
|
@@ -77,13 +81,7 @@ class ParaProtoSigner extends ParaCosmosSigner {
|
|
|
77
81
|
signDocBase64: signDocJsonStringEncoded
|
|
78
82
|
}
|
|
79
83
|
});
|
|
80
|
-
const
|
|
81
|
-
const extendedSignature = new ExtendedSecp256k1Signature(
|
|
82
|
-
hexToUint8Array(signature.r),
|
|
83
|
-
hexToUint8Array(signature.s),
|
|
84
|
-
Number(signature.v)
|
|
85
|
-
);
|
|
86
|
-
const signatureBytes = new Uint8Array([...extendedSignature.r(32), ...extendedSignature.s(32)]);
|
|
84
|
+
const signatureBytes = toFixedLengthCosmosSignature(requireSuccessfulSignature(res));
|
|
87
85
|
return {
|
|
88
86
|
signed: signDoc,
|
|
89
87
|
signature: encodeSecp256k1Signature(this.publicKey, signatureBytes)
|
|
@@ -108,13 +106,7 @@ class ParaAminoSigner extends ParaCosmosSigner {
|
|
|
108
106
|
signDocBase64
|
|
109
107
|
}
|
|
110
108
|
});
|
|
111
|
-
const
|
|
112
|
-
const extendedSignature = new ExtendedSecp256k1Signature(
|
|
113
|
-
hexToUint8Array(signature.r),
|
|
114
|
-
hexToUint8Array(signature.s),
|
|
115
|
-
Number(signature.v)
|
|
116
|
-
);
|
|
117
|
-
const signatureBytes = new Uint8Array([...extendedSignature.r(32), ...extendedSignature.s(32)]);
|
|
109
|
+
const signatureBytes = toFixedLengthCosmosSignature(requireSuccessfulSignature(res));
|
|
118
110
|
return {
|
|
119
111
|
signed: signDoc,
|
|
120
112
|
signature: encodeSecp256k1Signature(this.publicKey, signatureBytes)
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { AccountData, AminoSignResponse, OfflineAminoSigner, StdSignDoc } from '@cosmjs/amino';
|
|
2
|
-
import {
|
|
1
|
+
import { type AccountData, type AminoSignResponse, type OfflineAminoSigner, type StdSignDoc } from '@cosmjs/amino';
|
|
2
|
+
import { type DirectSignResponse, type OfflineDirectSigner } from '@cosmjs/proto-signing';
|
|
3
3
|
import { SignDoc } from 'cosmjs-types/cosmos/tx/v1beta1/tx';
|
|
4
4
|
import ParaCore, { Wallet, type CreateParaSignerBaseOptions } from '@getpara/core-sdk';
|
|
5
|
+
type ParaCosmosAccountData = AccountData & {
|
|
6
|
+
readonly algo: 'secp256k1';
|
|
7
|
+
};
|
|
5
8
|
declare class ParaCosmosSigner {
|
|
6
9
|
readonly prefix: string;
|
|
7
10
|
readonly para: ParaCore;
|
|
@@ -19,7 +22,7 @@ declare class ParaCosmosSigner {
|
|
|
19
22
|
get currentWallet(): Wallet;
|
|
20
23
|
get publicKey(): Uint8Array;
|
|
21
24
|
get address(): string;
|
|
22
|
-
getAccounts(): Promise<readonly
|
|
25
|
+
getAccounts(): Promise<readonly ParaCosmosAccountData[]>;
|
|
23
26
|
}
|
|
24
27
|
export declare class ParaProtoSigner extends ParaCosmosSigner implements OfflineDirectSigner {
|
|
25
28
|
signDirect(address: string, signDoc: SignDoc): Promise<DirectSignResponse>;
|
package/package.json
CHANGED
|
@@ -1,37 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpara/cosmjs-v0-integration",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.21.0",
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"@
|
|
5
|
+
"@cosmjs/amino": ">=0.32.4",
|
|
6
|
+
"@cosmjs/crypto": ">=0.32.4",
|
|
7
|
+
"@cosmjs/proto-signing": ">=0.32.4",
|
|
8
|
+
"@cosmjs/stargate": ">=0.32.4",
|
|
9
|
+
"@getpara/core-sdk": "3.21.0",
|
|
10
|
+
"cosmjs-types": ">=0.9.0"
|
|
6
11
|
},
|
|
7
12
|
"devDependencies": {
|
|
8
|
-
"@cosmjs/amino": "^0.32.4",
|
|
9
|
-
"@cosmjs/encoding": "^0.32.4",
|
|
10
|
-
"@cosmjs/proto-signing": "^0.32.4",
|
|
11
|
-
"@cosmjs/stargate": "^0.32.4",
|
|
12
|
-
"cosmjs-types": "^0.9.0",
|
|
13
13
|
"typescript": "^5.8.3"
|
|
14
14
|
},
|
|
15
15
|
"files": [
|
|
16
16
|
"dist",
|
|
17
17
|
"package.json"
|
|
18
18
|
],
|
|
19
|
-
"gitHead": "
|
|
19
|
+
"gitHead": "e1ca81fb06f6337aaa7cc1860584b7ba5d1d9ca8",
|
|
20
20
|
"main": "dist/cjs/index.js",
|
|
21
21
|
"module": "dist/esm/index.js",
|
|
22
|
-
"peerDependencies": {
|
|
23
|
-
"@cosmjs/amino": "^0.32.4",
|
|
24
|
-
"@cosmjs/encoding": "^0.32.4",
|
|
25
|
-
"@cosmjs/proto-signing": "^0.32.4",
|
|
26
|
-
"@cosmjs/stargate": "^0.32.4"
|
|
27
|
-
},
|
|
28
22
|
"scripts": {
|
|
29
23
|
"build": "rm -rf dist && node ./scripts/build.mjs && yarn build:types",
|
|
30
|
-
"test": "vitest run",
|
|
24
|
+
"test": "vitest run --coverage",
|
|
31
25
|
"build:cjs": "rm -rf dist/cjs && tsc --module commonjs --outDir dist/cjs && printf '{\"type\":\"commonjs\"}' > dist/cjs/package.json",
|
|
32
26
|
"build:esm": "rm -rf dist/esm && tsc --module es6 --outDir dist/esm && printf '{\"type\":\"module\",\"sideEffects\":false}' > dist/esm/package.json",
|
|
33
|
-
"build:types": "
|
|
34
|
-
"old-build": "yarn build:cjs && yarn build:esm && yarn build:types"
|
|
27
|
+
"build:types": "tsc --emitDeclarationOnly",
|
|
28
|
+
"old-build": "yarn build:cjs && yarn build:esm && yarn build:types",
|
|
29
|
+
"typecheck": "tsc --noEmit"
|
|
35
30
|
},
|
|
36
31
|
"sideEffects": false,
|
|
37
32
|
"types": "dist/types/index.d.ts",
|