@injectivelabs/wallet-trezor 1.16.38-alpha.2 → 1.16.38-alpha.3
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/index.cjs +13 -12
- package/dist/cjs/index.d.cts +2 -1
- package/dist/esm/index.d.ts +2 -1
- package/dist/esm/index.js +2 -1
- package/package.json +4 -4
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
let viem = require("viem");
|
|
2
|
+
let __injectivelabs_sdk_ts_core_tx = require("@injectivelabs/sdk-ts/core/tx");
|
|
2
3
|
let __injectivelabs_wallet_base = require("@injectivelabs/wallet-base");
|
|
3
|
-
let
|
|
4
|
+
let __injectivelabs_sdk_ts_utils = require("@injectivelabs/sdk-ts/utils");
|
|
4
5
|
let __injectivelabs_exceptions = require("@injectivelabs/exceptions");
|
|
5
6
|
|
|
6
7
|
//#region src/types.ts
|
|
@@ -33,13 +34,13 @@ async function loadTrezorConnect() {
|
|
|
33
34
|
*/
|
|
34
35
|
const transformTypedData = (data, metamask_v4_compat = true) => {
|
|
35
36
|
if (!metamask_v4_compat) throw new __injectivelabs_exceptions.TrezorException(/* @__PURE__ */ new Error("Trezor: Only version 4 of typed data signing is supported"));
|
|
36
|
-
const version =
|
|
37
|
-
const { types, primaryType, domain, message } = (0,
|
|
38
|
-
const domainSeparatorHash = (0,
|
|
37
|
+
const version = __injectivelabs_sdk_ts_utils.SignTypedDataVersionV4;
|
|
38
|
+
const { types, primaryType, domain, message } = (0, __injectivelabs_sdk_ts_utils.TypedDataUtilsSanitizeData)(data);
|
|
39
|
+
const domainSeparatorHash = (0, __injectivelabs_sdk_ts_utils.TypedDataUtilsHashStruct)("EIP712Domain", (0, __injectivelabs_sdk_ts_utils.sanitizeTypedData)(domain), types, version).toString("hex");
|
|
39
40
|
let messageHash = null;
|
|
40
|
-
if (primaryType !== "EIP712Domain") messageHash = (0,
|
|
41
|
+
if (primaryType !== "EIP712Domain") messageHash = (0, __injectivelabs_sdk_ts_utils.TypedDataUtilsHashStruct)(primaryType, (0, __injectivelabs_sdk_ts_utils.sanitizeTypedData)(message), {
|
|
41
42
|
...types,
|
|
42
|
-
domain: (0,
|
|
43
|
+
domain: (0, __injectivelabs_sdk_ts_utils.sanitizeTypedData)(domain)
|
|
43
44
|
}, version).toString("hex");
|
|
44
45
|
return {
|
|
45
46
|
domain_separator_hash: domainSeparatorHash,
|
|
@@ -95,7 +96,7 @@ function _defineProperty(e, r, t) {
|
|
|
95
96
|
const addressOfHDKey = (hdKey) => {
|
|
96
97
|
const shouldSanitizePublicKey = true;
|
|
97
98
|
const derivedPublicKey = hdKey.publicKey;
|
|
98
|
-
return (0,
|
|
99
|
+
return (0, __injectivelabs_sdk_ts_utils.addHexPrefix)((0, __injectivelabs_sdk_ts_utils.uint8ArrayToHex)((0, __injectivelabs_sdk_ts_utils.publicKeyToAddress)(derivedPublicKey, shouldSanitizePublicKey)));
|
|
99
100
|
};
|
|
100
101
|
var AccountManager = class {
|
|
101
102
|
constructor() {
|
|
@@ -139,8 +140,8 @@ var AccountManager = class {
|
|
|
139
140
|
if (!result.success) throw new __injectivelabs_exceptions.TrezorException(new Error(result.payload && result.payload.error || "Please make sure your Trezor is connected and unlocked"));
|
|
140
141
|
for (const item of result.payload) {
|
|
141
142
|
const hdKey = {
|
|
142
|
-
publicKey: (0,
|
|
143
|
-
chainCode: (0,
|
|
143
|
+
publicKey: (0, __injectivelabs_sdk_ts_utils.hexToUint8Array)(item.publicKey),
|
|
144
|
+
chainCode: (0, __injectivelabs_sdk_ts_utils.hexToUint8Array)(item.chainCode)
|
|
144
145
|
};
|
|
145
146
|
const address = addressOfHDKey(hdKey);
|
|
146
147
|
this.wallets.push({
|
|
@@ -238,7 +239,7 @@ var TrezorBase = class extends __injectivelabs_wallet_base.BaseConcreteStrategy
|
|
|
238
239
|
}
|
|
239
240
|
}
|
|
240
241
|
async getSessionOrConfirm(address) {
|
|
241
|
-
return Promise.resolve(`0x${(0,
|
|
242
|
+
return Promise.resolve(`0x${(0, __injectivelabs_sdk_ts_utils.uint8ArrayToHex)((0, __injectivelabs_sdk_ts_utils.stringToUint8Array)(`Confirmation for ${address} at time: ${Date.now()}`))}`);
|
|
242
243
|
}
|
|
243
244
|
async sendEvmTransaction(txData, args) {
|
|
244
245
|
const signedTransaction = await this.signEvmTransaction(txData, args);
|
|
@@ -255,7 +256,7 @@ var TrezorBase = class extends __injectivelabs_wallet_base.BaseConcreteStrategy
|
|
|
255
256
|
async sendTransaction(transaction, options) {
|
|
256
257
|
const { endpoints, txTimeout } = options;
|
|
257
258
|
if (!endpoints) throw new __injectivelabs_exceptions.WalletException(/* @__PURE__ */ new Error("You have to pass endpoints.grpc within the options for using Ethereum native wallets"));
|
|
258
|
-
const response = await new
|
|
259
|
+
const response = await new __injectivelabs_sdk_ts_core_tx.TxGrpcApi(endpoints.grpc).broadcast(transaction, { txTimeout });
|
|
259
260
|
if (response.code !== 0) throw new __injectivelabs_exceptions.TransactionException(new Error(response.rawLog), {
|
|
260
261
|
code: __injectivelabs_exceptions.UnspecifiedErrorCode,
|
|
261
262
|
contextCode: response.code,
|
|
@@ -324,7 +325,7 @@ var TrezorBase = class extends __injectivelabs_wallet_base.BaseConcreteStrategy
|
|
|
324
325
|
const { derivationPath } = await this.getWalletForAddress(signer);
|
|
325
326
|
const response = await TrezorConnect.ethereumSignMessage({
|
|
326
327
|
path: derivationPath,
|
|
327
|
-
message: (0,
|
|
328
|
+
message: (0, __injectivelabs_sdk_ts_utils.toUtf8)(data)
|
|
328
329
|
});
|
|
329
330
|
if (!response.success) throw new Error(response.payload && response.payload.error || "Unknown error");
|
|
330
331
|
return response.payload.signature;
|
package/dist/cjs/index.d.cts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { BaseConcreteStrategy, ConcreteEvmWalletStrategyArgs, ConcreteWalletStrategy, SendTransactionOptions, StdSignDoc, WalletDeviceType } from "@injectivelabs/wallet-base";
|
|
2
2
|
import { AccountAddress, EvmChainId } from "@injectivelabs/ts-types";
|
|
3
|
-
import {
|
|
3
|
+
import { TxResponse } from "@injectivelabs/sdk-ts/core/tx";
|
|
4
|
+
import { AminoSignResponse, DirectSignResponse, TxRaw } from "@injectivelabs/sdk-ts/types";
|
|
4
5
|
|
|
5
6
|
//#region src/types.d.ts
|
|
6
7
|
interface HDNodeLike {
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { TxResponse } from "@injectivelabs/sdk-ts/core/tx";
|
|
1
2
|
import { BaseConcreteStrategy, ConcreteEvmWalletStrategyArgs, ConcreteWalletStrategy, SendTransactionOptions, StdSignDoc, WalletDeviceType } from "@injectivelabs/wallet-base";
|
|
2
|
-
import { AminoSignResponse, DirectSignResponse, TxRaw, TxResponse } from "@injectivelabs/sdk-ts";
|
|
3
3
|
import { AccountAddress, EvmChainId } from "@injectivelabs/ts-types";
|
|
4
|
+
import { AminoSignResponse, DirectSignResponse, TxRaw } from "@injectivelabs/sdk-ts/types";
|
|
4
5
|
|
|
5
6
|
//#region src/types.d.ts
|
|
6
7
|
interface HDNodeLike {
|
package/dist/esm/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { serializeTransaction, toHex } from "viem";
|
|
2
|
+
import { TxGrpcApi } from "@injectivelabs/sdk-ts/core/tx";
|
|
2
3
|
import { BaseConcreteStrategy, DEFAULT_ADDRESS_SEARCH_LIMIT, DEFAULT_BASE_DERIVATION_PATH, DEFAULT_NUM_ADDRESSES_TO_FETCH, WalletAction, WalletDeviceType, getViemPublicClient } from "@injectivelabs/wallet-base";
|
|
3
|
-
import { SignTypedDataVersionV4,
|
|
4
|
+
import { SignTypedDataVersionV4, TypedDataUtilsHashStruct, TypedDataUtilsSanitizeData, addHexPrefix, hexToUint8Array, publicKeyToAddress, sanitizeTypedData, stringToUint8Array, toUtf8, uint8ArrayToHex } from "@injectivelabs/sdk-ts/utils";
|
|
4
5
|
import { ErrorType, GeneralException, TransactionException, TrezorException, UnspecifiedErrorCode, WalletException } from "@injectivelabs/exceptions";
|
|
5
6
|
|
|
6
7
|
//#region src/types.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@injectivelabs/wallet-trezor",
|
|
3
|
-
"version": "1.16.38-alpha.
|
|
3
|
+
"version": "1.16.38-alpha.3",
|
|
4
4
|
"description": "Trezor wallet strategy for use with @injectivelabs/wallet-core.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -41,10 +41,10 @@
|
|
|
41
41
|
"@trezor/connect": "^9.6.4",
|
|
42
42
|
"@trezor/connect-web": "^9.6.4",
|
|
43
43
|
"viem": "^2.40.3",
|
|
44
|
-
"@injectivelabs/exceptions": "1.16.38-alpha.
|
|
44
|
+
"@injectivelabs/exceptions": "1.16.38-alpha.2",
|
|
45
45
|
"@injectivelabs/ts-types": "1.16.38-alpha.1",
|
|
46
|
-
"@injectivelabs/sdk-ts": "1.16.38-alpha.
|
|
47
|
-
"@injectivelabs/wallet-base": "1.16.38-alpha.
|
|
46
|
+
"@injectivelabs/sdk-ts": "1.16.38-alpha.3",
|
|
47
|
+
"@injectivelabs/wallet-base": "1.16.38-alpha.3"
|
|
48
48
|
},
|
|
49
49
|
"publishConfig": {
|
|
50
50
|
"access": "public"
|