@onekeyfe/onekey-cosmos-provider 2.1.17-alpha.0 → 2.1.17
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.
|
@@ -12,6 +12,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
12
12
|
import { bytesToHex, hexToBytes } from '@noble/hashes/utils';
|
|
13
13
|
import { getOrCreateExtInjectedJsBridge } from '@onekeyfe/extension-bridge-injected';
|
|
14
14
|
import { ProviderCosmosBase } from './ProviderCosmosBase';
|
|
15
|
+
// @ts-ignore
|
|
15
16
|
import Long from 'long';
|
|
16
17
|
import { CosmJSOfflineSigner, CosmJSOfflineSignerOnlyAmino } from './cosmjs';
|
|
17
18
|
import { isArray } from 'lodash';
|
|
@@ -185,8 +186,8 @@ class ProviderCosmos extends ProviderCosmosBase {
|
|
|
185
186
|
});
|
|
186
187
|
}
|
|
187
188
|
signDirect(chainId, signer, signDoc, signOptions) {
|
|
188
|
-
var _a;
|
|
189
189
|
return __awaiter(this, void 0, void 0, function* () {
|
|
190
|
+
var _a;
|
|
190
191
|
const res = yield this._callBridge({
|
|
191
192
|
method: 'signDirect',
|
|
192
193
|
// @ts-expect-error
|
|
@@ -197,6 +198,7 @@ class ProviderCosmos extends ProviderCosmosBase {
|
|
|
197
198
|
bodyBytes: (signDoc === null || signDoc === void 0 ? void 0 : signDoc.bodyBytes) ? bytesToHex(signDoc === null || signDoc === void 0 ? void 0 : signDoc.bodyBytes) : null,
|
|
198
199
|
authInfoBytes: (signDoc === null || signDoc === void 0 ? void 0 : signDoc.authInfoBytes) ? bytesToHex(signDoc === null || signDoc === void 0 ? void 0 : signDoc.authInfoBytes) : null,
|
|
199
200
|
chainId: signDoc.chainId,
|
|
201
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
|
|
200
202
|
accountNumber: (_a = signDoc === null || signDoc === void 0 ? void 0 : signDoc.accountNumber) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
201
203
|
},
|
|
202
204
|
signOptions,
|
|
@@ -207,7 +209,8 @@ class ProviderCosmos extends ProviderCosmosBase {
|
|
|
207
209
|
bodyBytes: hexToBytes(res.signed.bodyBytes),
|
|
208
210
|
// @ts-expect-error
|
|
209
211
|
authInfoBytes: hexToBytes(res.signed.authInfoBytes),
|
|
210
|
-
// @ts-
|
|
212
|
+
// @ts-ignore
|
|
213
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
|
|
211
214
|
accountNumber: Long.fromString(res.signed.accountNumber),
|
|
212
215
|
chainId: res.signed.chainId,
|
|
213
216
|
} });
|
|
@@ -18,6 +18,7 @@ exports.ProviderCosmos = void 0;
|
|
|
18
18
|
const utils_1 = require("@noble/hashes/utils");
|
|
19
19
|
const extension_bridge_injected_1 = require("@onekeyfe/extension-bridge-injected");
|
|
20
20
|
const ProviderCosmosBase_1 = require("./ProviderCosmosBase");
|
|
21
|
+
// @ts-ignore
|
|
21
22
|
const long_1 = __importDefault(require("long"));
|
|
22
23
|
const cosmjs_1 = require("./cosmjs");
|
|
23
24
|
const lodash_1 = require("lodash");
|
|
@@ -191,8 +192,8 @@ class ProviderCosmos extends ProviderCosmosBase_1.ProviderCosmosBase {
|
|
|
191
192
|
});
|
|
192
193
|
}
|
|
193
194
|
signDirect(chainId, signer, signDoc, signOptions) {
|
|
194
|
-
var _a;
|
|
195
195
|
return __awaiter(this, void 0, void 0, function* () {
|
|
196
|
+
var _a;
|
|
196
197
|
const res = yield this._callBridge({
|
|
197
198
|
method: 'signDirect',
|
|
198
199
|
// @ts-expect-error
|
|
@@ -203,6 +204,7 @@ class ProviderCosmos extends ProviderCosmosBase_1.ProviderCosmosBase {
|
|
|
203
204
|
bodyBytes: (signDoc === null || signDoc === void 0 ? void 0 : signDoc.bodyBytes) ? (0, utils_1.bytesToHex)(signDoc === null || signDoc === void 0 ? void 0 : signDoc.bodyBytes) : null,
|
|
204
205
|
authInfoBytes: (signDoc === null || signDoc === void 0 ? void 0 : signDoc.authInfoBytes) ? (0, utils_1.bytesToHex)(signDoc === null || signDoc === void 0 ? void 0 : signDoc.authInfoBytes) : null,
|
|
205
206
|
chainId: signDoc.chainId,
|
|
207
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
|
|
206
208
|
accountNumber: (_a = signDoc === null || signDoc === void 0 ? void 0 : signDoc.accountNumber) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
207
209
|
},
|
|
208
210
|
signOptions,
|
|
@@ -213,7 +215,8 @@ class ProviderCosmos extends ProviderCosmosBase_1.ProviderCosmosBase {
|
|
|
213
215
|
bodyBytes: (0, utils_1.hexToBytes)(res.signed.bodyBytes),
|
|
214
216
|
// @ts-expect-error
|
|
215
217
|
authInfoBytes: (0, utils_1.hexToBytes)(res.signed.authInfoBytes),
|
|
216
|
-
// @ts-
|
|
218
|
+
// @ts-ignore
|
|
219
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
|
|
217
220
|
accountNumber: long_1.default.fromString(res.signed.accountNumber),
|
|
218
221
|
chainId: res.signed.chainId,
|
|
219
222
|
} });
|
package/dist/cjs/cosmjs.js
CHANGED
|
@@ -13,6 +13,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.CosmJSOfflineSigner = exports.CosmJSOfflineSignerOnlyAmino = void 0;
|
|
16
|
+
// @ts-ignore
|
|
16
17
|
const long_1 = __importDefault(require("long"));
|
|
17
18
|
class CosmJSOfflineSignerOnlyAmino {
|
|
18
19
|
constructor(chainId, service) {
|
|
@@ -70,6 +71,7 @@ class CosmJSOfflineSigner extends CosmJSOfflineSignerOnlyAmino {
|
|
|
70
71
|
return yield this.service.signDirect(this.chainId, signerAddress, {
|
|
71
72
|
bodyBytes: signDoc.bodyBytes,
|
|
72
73
|
authInfoBytes: signDoc.authInfoBytes,
|
|
74
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
|
|
73
75
|
accountNumber: long_1.default.fromValue(signDoc.accountNumber),
|
|
74
76
|
chainId: signDoc.chainId,
|
|
75
77
|
});
|
package/dist/cjs/types/type.js
CHANGED
package/dist/cjs/utils/hex.js
CHANGED
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
To reduce the bundle size of provider, put them directly here.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
7
|
+
exports.toHex = toHex;
|
|
8
|
+
exports.fromHex = fromHex;
|
|
8
9
|
function toHex(data) {
|
|
9
10
|
let out = "";
|
|
10
11
|
for (const byte of data) {
|
|
@@ -12,7 +13,6 @@ function toHex(data) {
|
|
|
12
13
|
}
|
|
13
14
|
return out;
|
|
14
15
|
}
|
|
15
|
-
exports.toHex = toHex;
|
|
16
16
|
function fromHex(hexstring) {
|
|
17
17
|
if (hexstring.length % 2 !== 0) {
|
|
18
18
|
throw new Error("hex string length must be a multiple of 2");
|
|
@@ -27,4 +27,3 @@ function fromHex(hexstring) {
|
|
|
27
27
|
}
|
|
28
28
|
return new Uint8Array(listOfInts);
|
|
29
29
|
}
|
|
30
|
-
exports.fromHex = fromHex;
|
package/dist/cosmjs.js
CHANGED
|
@@ -7,6 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
+
// @ts-ignore
|
|
10
11
|
import Long from 'long';
|
|
11
12
|
export class CosmJSOfflineSignerOnlyAmino {
|
|
12
13
|
constructor(chainId, service) {
|
|
@@ -63,6 +64,7 @@ export class CosmJSOfflineSigner extends CosmJSOfflineSignerOnlyAmino {
|
|
|
63
64
|
return yield this.service.signDirect(this.chainId, signerAddress, {
|
|
64
65
|
bodyBytes: signDoc.bodyBytes,
|
|
65
66
|
authInfoBytes: signDoc.authInfoBytes,
|
|
67
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
|
|
66
68
|
accountNumber: Long.fromValue(signDoc.accountNumber),
|
|
67
69
|
chainId: signDoc.chainId,
|
|
68
70
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/onekey-cosmos-provider",
|
|
3
|
-
"version": "2.1.17
|
|
3
|
+
"version": "2.1.17",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"cross-inpage-provider"
|
|
6
6
|
],
|
|
@@ -29,13 +29,13 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@noble/hashes": "^1.3.0",
|
|
32
|
-
"@onekeyfe/cross-inpage-provider-core": "2.1.17
|
|
33
|
-
"@onekeyfe/cross-inpage-provider-errors": "2.1.17
|
|
34
|
-
"@onekeyfe/cross-inpage-provider-types": "2.1.17
|
|
35
|
-
"@onekeyfe/extension-bridge-injected": "2.1.17
|
|
32
|
+
"@onekeyfe/cross-inpage-provider-core": "2.1.17",
|
|
33
|
+
"@onekeyfe/cross-inpage-provider-errors": "2.1.17",
|
|
34
|
+
"@onekeyfe/cross-inpage-provider-types": "2.1.17",
|
|
35
|
+
"@onekeyfe/extension-bridge-injected": "2.1.17",
|
|
36
36
|
"eth-rpc-errors": "^4.0.3",
|
|
37
37
|
"long": "^5.2.1",
|
|
38
38
|
"mitt": "^3.0.0"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "6b9e350734a850a60dbf9fa4406190900f8f13f2"
|
|
41
41
|
}
|