@injectivelabs/wallet-base 1.16.38-alpha.2 → 1.16.38-alpha.4
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 +8 -4
- package/dist/cjs/index.d.cts +31 -4
- package/dist/esm/index.d.ts +31 -4
- package/dist/esm/index.js +7 -3
- package/package.json +5 -6
package/dist/cjs/index.cjs
CHANGED
|
@@ -34,6 +34,7 @@ viem_chains = __toESM(viem_chains);
|
|
|
34
34
|
let __injectivelabs_ts_types = require("@injectivelabs/ts-types");
|
|
35
35
|
let viem = require("viem");
|
|
36
36
|
let __injectivelabs_sdk_ts = require("@injectivelabs/sdk-ts");
|
|
37
|
+
let __injectivelabs_sdk_ts_utils = require("@injectivelabs/sdk-ts/utils");
|
|
37
38
|
|
|
38
39
|
//#region src/types/enums.ts
|
|
39
40
|
const BroadcastMode = {
|
|
@@ -54,6 +55,7 @@ const Wallet = {
|
|
|
54
55
|
Rainbow: "rainbow",
|
|
55
56
|
Turnkey: "turnkey",
|
|
56
57
|
Metamask: "metamask",
|
|
58
|
+
KeplrEvm: "keplr-evm",
|
|
57
59
|
OkxWallet: "okx-wallet",
|
|
58
60
|
PrivateKey: "private-key",
|
|
59
61
|
TrustWallet: "trust-wallet",
|
|
@@ -95,7 +97,7 @@ const TurnkeyProvider = {
|
|
|
95
97
|
};
|
|
96
98
|
|
|
97
99
|
//#endregion
|
|
98
|
-
//#region ../../../node_modules/.pnpm/bignumber.js@9.1
|
|
100
|
+
//#region ../../../node_modules/.pnpm/bignumber.js@9.3.1/node_modules/bignumber.js/bignumber.mjs
|
|
99
101
|
var isNumeric = /^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i, mathceil = Math.ceil, mathfloor = Math.floor, bignumberError = "[BigNumber Error] ", tooManyDigits = bignumberError + "Number primitive has more than 15 significant digits: ", BASE = 0x5af3107a4000, LOG_BASE = 14, MAX_SAFE_INTEGER = 9007199254740991, POWS_TEN = [
|
|
100
102
|
1,
|
|
101
103
|
10,
|
|
@@ -617,7 +619,7 @@ function clone(configObject) {
|
|
|
617
619
|
for (; len < i; str += "0", len++);
|
|
618
620
|
str = toExponential(str, e);
|
|
619
621
|
} else {
|
|
620
|
-
i -= ne;
|
|
622
|
+
i -= ne + (id === 2 && e > ne);
|
|
621
623
|
str = toFixedPoint(str, e, "0");
|
|
622
624
|
if (e + 1 > len) {
|
|
623
625
|
if (--i > 0) for (str += "."; i--; str += "0");
|
|
@@ -1712,6 +1714,7 @@ const isEvmWallet = (wallet) => [
|
|
|
1712
1714
|
Wallet.Rainbow,
|
|
1713
1715
|
Wallet.Turnkey,
|
|
1714
1716
|
Wallet.Metamask,
|
|
1717
|
+
Wallet.KeplrEvm,
|
|
1715
1718
|
Wallet.OkxWallet,
|
|
1716
1719
|
Wallet.PrivateKey,
|
|
1717
1720
|
Wallet.TrezorBip32,
|
|
@@ -1728,6 +1731,7 @@ const isEvmBrowserWallet = (wallet) => [
|
|
|
1728
1731
|
Wallet.Phantom,
|
|
1729
1732
|
Wallet.Rainbow,
|
|
1730
1733
|
Wallet.Metamask,
|
|
1734
|
+
Wallet.KeplrEvm,
|
|
1731
1735
|
Wallet.OkxWallet,
|
|
1732
1736
|
Wallet.TrustWallet
|
|
1733
1737
|
].includes(wallet);
|
|
@@ -1762,13 +1766,13 @@ const createCosmosSignDocFromSignDoc = (signDoc) => {
|
|
|
1762
1766
|
const getInjectiveSignerAddress = (address) => {
|
|
1763
1767
|
if (!address) return "";
|
|
1764
1768
|
if (address.startsWith("inj")) return address;
|
|
1765
|
-
if (address.startsWith("0x")) return (0,
|
|
1769
|
+
if (address.startsWith("0x")) return (0, __injectivelabs_sdk_ts_utils.getInjectiveAddress)(address);
|
|
1766
1770
|
return "";
|
|
1767
1771
|
};
|
|
1768
1772
|
const getEthereumSignerAddress = (address) => {
|
|
1769
1773
|
if (!address) return "";
|
|
1770
1774
|
if (address.startsWith("0x")) return address;
|
|
1771
|
-
if (address.startsWith("inj")) return (0,
|
|
1775
|
+
if (address.startsWith("inj")) return (0, __injectivelabs_sdk_ts_utils.getEthereumAddress)(address);
|
|
1772
1776
|
return "";
|
|
1773
1777
|
};
|
|
1774
1778
|
|
package/dist/cjs/index.d.cts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { StdSignDoc } from "@keplr-wallet/types";
|
|
2
2
|
import { OfflineSigner } from "@cosmjs/proto-signing";
|
|
3
|
+
import { TxResponse } from "@injectivelabs/sdk-ts/core/tx";
|
|
3
4
|
import { AccountAddress, ChainId, CosmosChainId, EvmChainId } from "@injectivelabs/ts-types";
|
|
4
|
-
import { AminoSignResponse,
|
|
5
|
+
import { AminoSignResponse, DirectSignResponse, TxRaw } from "@injectivelabs/sdk-ts/types";
|
|
5
6
|
import { EIP1193Provider } from "eip1193-provider";
|
|
7
|
+
import { Msgs } from "@injectivelabs/sdk-ts/core/modules";
|
|
6
8
|
import { Account, Chain, LocalAccount, PublicClient, WalletClient } from "viem";
|
|
7
|
-
import {
|
|
9
|
+
import { CosmosTxV1Beta1TxPb } from "@injectivelabs/sdk-ts";
|
|
8
10
|
|
|
9
11
|
//#region src/types/enums.d.ts
|
|
10
12
|
declare const BroadcastMode: {
|
|
@@ -26,6 +28,7 @@ declare const Wallet: {
|
|
|
26
28
|
readonly Rainbow: "rainbow";
|
|
27
29
|
readonly Turnkey: "turnkey";
|
|
28
30
|
readonly Metamask: "metamask";
|
|
31
|
+
readonly KeplrEvm: "keplr-evm";
|
|
29
32
|
readonly OkxWallet: "okx-wallet";
|
|
30
33
|
readonly PrivateKey: "private-key";
|
|
31
34
|
readonly TrustWallet: "trust-wallet";
|
|
@@ -147,6 +150,8 @@ interface WalletMetadata {
|
|
|
147
150
|
turnkey?: Partial<TurnkeyMetadata>;
|
|
148
151
|
walletConnect?: WalletConnectMetadata;
|
|
149
152
|
privateKey?: PrivateKeyMetadata;
|
|
153
|
+
derivationPath?: string;
|
|
154
|
+
baseDerivationPath?: string;
|
|
150
155
|
}
|
|
151
156
|
interface ConcreteWalletStrategyArgs {
|
|
152
157
|
chainId: ChainId;
|
|
@@ -165,6 +170,14 @@ interface ConcreteCosmosWalletStrategy {
|
|
|
165
170
|
* The accounts from the wallet (addresses)
|
|
166
171
|
*/
|
|
167
172
|
getAddresses(args?: unknown): Promise<string[]>;
|
|
173
|
+
/**
|
|
174
|
+
* The accounts from the wallet with derivation path info (for hardware wallets)
|
|
175
|
+
*/
|
|
176
|
+
getAddressesInfo(args?: unknown): Promise<{
|
|
177
|
+
address: string;
|
|
178
|
+
derivationPath: string;
|
|
179
|
+
baseDerivationPath: string;
|
|
180
|
+
}[]>;
|
|
168
181
|
/**
|
|
169
182
|
* Return the WalletDeviceType connected on the
|
|
170
183
|
* wallet provider (extension, mobile, hardware wallet)
|
|
@@ -207,6 +220,14 @@ interface WalletStrategyArguments {
|
|
|
207
220
|
strategies: ConcreteStrategiesArg;
|
|
208
221
|
}
|
|
209
222
|
interface ConcreteWalletStrategy extends Omit<ConcreteCosmosWalletStrategy, 'sendTransaction' | 'isChainIdSupported' | 'signAminoTransaction'> {
|
|
223
|
+
/**
|
|
224
|
+
* The accounts from the wallet with derivation path info (for hardware wallets)
|
|
225
|
+
*/
|
|
226
|
+
getAddressesInfo(args?: unknown): Promise<{
|
|
227
|
+
address: string;
|
|
228
|
+
derivationPath: string;
|
|
229
|
+
baseDerivationPath: string;
|
|
230
|
+
}[]>;
|
|
210
231
|
/**
|
|
211
232
|
* Sends Cosmos transaction. Returns a transaction hash
|
|
212
233
|
* @param transaction should implement TransactionConfig
|
|
@@ -284,10 +305,15 @@ interface WalletStrategy {
|
|
|
284
305
|
metadata?: WalletMetadata;
|
|
285
306
|
getWallet(): Wallet;
|
|
286
307
|
getWalletClient?<T>(): Promise<T>;
|
|
287
|
-
setWallet(wallet: Wallet): void
|
|
308
|
+
setWallet(wallet: Wallet): Promise<void>;
|
|
288
309
|
setMetadata(metadata?: WalletMetadata): void;
|
|
289
310
|
getStrategy(): ConcreteWalletStrategy;
|
|
290
311
|
getAddresses(args?: unknown): Promise<AccountAddress[]>;
|
|
312
|
+
getAddressesInfo(args?: unknown): Promise<{
|
|
313
|
+
address: string;
|
|
314
|
+
derivationPath: string;
|
|
315
|
+
baseDerivationPath: string;
|
|
316
|
+
}[]>;
|
|
291
317
|
getWalletDeviceType(): Promise<WalletDeviceType>;
|
|
292
318
|
getPubKey(address?: string): Promise<string>;
|
|
293
319
|
enable(args?: unknown): Promise<boolean>;
|
|
@@ -326,6 +352,7 @@ interface WalletStrategy {
|
|
|
326
352
|
interface BrowserEip1993Provider extends EIP1193Provider {
|
|
327
353
|
removeAllListeners(): void;
|
|
328
354
|
isTrust: boolean;
|
|
355
|
+
isKeplr: boolean;
|
|
329
356
|
isRabby: boolean;
|
|
330
357
|
isRainbow: boolean;
|
|
331
358
|
isPhantom: boolean;
|
|
@@ -395,7 +422,7 @@ declare const createEip712StdSignDoc: ({
|
|
|
395
422
|
};
|
|
396
423
|
msgs: {
|
|
397
424
|
type: string;
|
|
398
|
-
value: ObjectRepresentation | SnakeCaseKeys$
|
|
425
|
+
value: ObjectRepresentation | SnakeCaseKeys$1<ProtoRepresentation>;
|
|
399
426
|
}[];
|
|
400
427
|
memo: string;
|
|
401
428
|
};
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { AccountAddress, ChainId, CosmosChainId, EvmChainId } from "@injectivelabs/ts-types";
|
|
2
2
|
import { Account, Chain, LocalAccount, PublicClient, WalletClient } from "viem";
|
|
3
|
-
import {
|
|
3
|
+
import { CosmosTxV1Beta1TxPb } from "@injectivelabs/sdk-ts";
|
|
4
4
|
import { StdSignDoc } from "@keplr-wallet/types";
|
|
5
5
|
import { OfflineSigner } from "@cosmjs/proto-signing";
|
|
6
|
+
import { TxResponse } from "@injectivelabs/sdk-ts/core/tx";
|
|
7
|
+
import { AminoSignResponse, DirectSignResponse, TxRaw } from "@injectivelabs/sdk-ts/types";
|
|
6
8
|
import { EIP1193Provider } from "eip1193-provider";
|
|
7
|
-
import {
|
|
9
|
+
import { Msgs } from "@injectivelabs/sdk-ts/core/modules";
|
|
8
10
|
|
|
9
11
|
//#region src/types/enums.d.ts
|
|
10
12
|
declare const BroadcastMode: {
|
|
@@ -26,6 +28,7 @@ declare const Wallet: {
|
|
|
26
28
|
readonly Rainbow: "rainbow";
|
|
27
29
|
readonly Turnkey: "turnkey";
|
|
28
30
|
readonly Metamask: "metamask";
|
|
31
|
+
readonly KeplrEvm: "keplr-evm";
|
|
29
32
|
readonly OkxWallet: "okx-wallet";
|
|
30
33
|
readonly PrivateKey: "private-key";
|
|
31
34
|
readonly TrustWallet: "trust-wallet";
|
|
@@ -147,6 +150,8 @@ interface WalletMetadata {
|
|
|
147
150
|
turnkey?: Partial<TurnkeyMetadata>;
|
|
148
151
|
walletConnect?: WalletConnectMetadata;
|
|
149
152
|
privateKey?: PrivateKeyMetadata;
|
|
153
|
+
derivationPath?: string;
|
|
154
|
+
baseDerivationPath?: string;
|
|
150
155
|
}
|
|
151
156
|
interface ConcreteWalletStrategyArgs {
|
|
152
157
|
chainId: ChainId;
|
|
@@ -165,6 +170,14 @@ interface ConcreteCosmosWalletStrategy {
|
|
|
165
170
|
* The accounts from the wallet (addresses)
|
|
166
171
|
*/
|
|
167
172
|
getAddresses(args?: unknown): Promise<string[]>;
|
|
173
|
+
/**
|
|
174
|
+
* The accounts from the wallet with derivation path info (for hardware wallets)
|
|
175
|
+
*/
|
|
176
|
+
getAddressesInfo(args?: unknown): Promise<{
|
|
177
|
+
address: string;
|
|
178
|
+
derivationPath: string;
|
|
179
|
+
baseDerivationPath: string;
|
|
180
|
+
}[]>;
|
|
168
181
|
/**
|
|
169
182
|
* Return the WalletDeviceType connected on the
|
|
170
183
|
* wallet provider (extension, mobile, hardware wallet)
|
|
@@ -207,6 +220,14 @@ interface WalletStrategyArguments {
|
|
|
207
220
|
strategies: ConcreteStrategiesArg;
|
|
208
221
|
}
|
|
209
222
|
interface ConcreteWalletStrategy extends Omit<ConcreteCosmosWalletStrategy, 'sendTransaction' | 'isChainIdSupported' | 'signAminoTransaction'> {
|
|
223
|
+
/**
|
|
224
|
+
* The accounts from the wallet with derivation path info (for hardware wallets)
|
|
225
|
+
*/
|
|
226
|
+
getAddressesInfo(args?: unknown): Promise<{
|
|
227
|
+
address: string;
|
|
228
|
+
derivationPath: string;
|
|
229
|
+
baseDerivationPath: string;
|
|
230
|
+
}[]>;
|
|
210
231
|
/**
|
|
211
232
|
* Sends Cosmos transaction. Returns a transaction hash
|
|
212
233
|
* @param transaction should implement TransactionConfig
|
|
@@ -284,10 +305,15 @@ interface WalletStrategy {
|
|
|
284
305
|
metadata?: WalletMetadata;
|
|
285
306
|
getWallet(): Wallet;
|
|
286
307
|
getWalletClient?<T>(): Promise<T>;
|
|
287
|
-
setWallet(wallet: Wallet): void
|
|
308
|
+
setWallet(wallet: Wallet): Promise<void>;
|
|
288
309
|
setMetadata(metadata?: WalletMetadata): void;
|
|
289
310
|
getStrategy(): ConcreteWalletStrategy;
|
|
290
311
|
getAddresses(args?: unknown): Promise<AccountAddress[]>;
|
|
312
|
+
getAddressesInfo(args?: unknown): Promise<{
|
|
313
|
+
address: string;
|
|
314
|
+
derivationPath: string;
|
|
315
|
+
baseDerivationPath: string;
|
|
316
|
+
}[]>;
|
|
291
317
|
getWalletDeviceType(): Promise<WalletDeviceType>;
|
|
292
318
|
getPubKey(address?: string): Promise<string>;
|
|
293
319
|
enable(args?: unknown): Promise<boolean>;
|
|
@@ -326,6 +352,7 @@ interface WalletStrategy {
|
|
|
326
352
|
interface BrowserEip1993Provider extends EIP1193Provider {
|
|
327
353
|
removeAllListeners(): void;
|
|
328
354
|
isTrust: boolean;
|
|
355
|
+
isKeplr: boolean;
|
|
329
356
|
isRabby: boolean;
|
|
330
357
|
isRainbow: boolean;
|
|
331
358
|
isPhantom: boolean;
|
|
@@ -395,7 +422,7 @@ declare const createEip712StdSignDoc: ({
|
|
|
395
422
|
};
|
|
396
423
|
msgs: {
|
|
397
424
|
type: string;
|
|
398
|
-
value: ObjectRepresentation | SnakeCaseKeys$
|
|
425
|
+
value: ObjectRepresentation | SnakeCaseKeys$1<ProtoRepresentation>;
|
|
399
426
|
}[];
|
|
400
427
|
memo: string;
|
|
401
428
|
};
|
package/dist/esm/index.js
CHANGED
|
@@ -5,7 +5,8 @@ import * as viemChains from "viem/chains";
|
|
|
5
5
|
import { injective } from "viem/chains";
|
|
6
6
|
import { EvmChainId } from "@injectivelabs/ts-types";
|
|
7
7
|
import { createPublicClient, createWalletClient, custom, extractChain, http } from "viem";
|
|
8
|
-
import { CosmosTxV1Beta1TxPb
|
|
8
|
+
import { CosmosTxV1Beta1TxPb } from "@injectivelabs/sdk-ts";
|
|
9
|
+
import { getEthereumAddress, getInjectiveAddress } from "@injectivelabs/sdk-ts/utils";
|
|
9
10
|
|
|
10
11
|
//#region src/types/enums.ts
|
|
11
12
|
const BroadcastMode = {
|
|
@@ -26,6 +27,7 @@ const Wallet = {
|
|
|
26
27
|
Rainbow: "rainbow",
|
|
27
28
|
Turnkey: "turnkey",
|
|
28
29
|
Metamask: "metamask",
|
|
30
|
+
KeplrEvm: "keplr-evm",
|
|
29
31
|
OkxWallet: "okx-wallet",
|
|
30
32
|
PrivateKey: "private-key",
|
|
31
33
|
TrustWallet: "trust-wallet",
|
|
@@ -67,7 +69,7 @@ const TurnkeyProvider = {
|
|
|
67
69
|
};
|
|
68
70
|
|
|
69
71
|
//#endregion
|
|
70
|
-
//#region ../../../node_modules/.pnpm/bignumber.js@9.1
|
|
72
|
+
//#region ../../../node_modules/.pnpm/bignumber.js@9.3.1/node_modules/bignumber.js/bignumber.mjs
|
|
71
73
|
var isNumeric = /^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i, mathceil = Math.ceil, mathfloor = Math.floor, bignumberError = "[BigNumber Error] ", tooManyDigits = bignumberError + "Number primitive has more than 15 significant digits: ", BASE = 0x5af3107a4000, LOG_BASE = 14, MAX_SAFE_INTEGER = 9007199254740991, POWS_TEN = [
|
|
72
74
|
1,
|
|
73
75
|
10,
|
|
@@ -589,7 +591,7 @@ function clone(configObject) {
|
|
|
589
591
|
for (; len < i; str += "0", len++);
|
|
590
592
|
str = toExponential(str, e);
|
|
591
593
|
} else {
|
|
592
|
-
i -= ne;
|
|
594
|
+
i -= ne + (id === 2 && e > ne);
|
|
593
595
|
str = toFixedPoint(str, e, "0");
|
|
594
596
|
if (e + 1 > len) {
|
|
595
597
|
if (--i > 0) for (str += "."; i--; str += "0");
|
|
@@ -1422,6 +1424,7 @@ const isEvmWallet = (wallet) => [
|
|
|
1422
1424
|
Wallet.Rainbow,
|
|
1423
1425
|
Wallet.Turnkey,
|
|
1424
1426
|
Wallet.Metamask,
|
|
1427
|
+
Wallet.KeplrEvm,
|
|
1425
1428
|
Wallet.OkxWallet,
|
|
1426
1429
|
Wallet.PrivateKey,
|
|
1427
1430
|
Wallet.TrezorBip32,
|
|
@@ -1438,6 +1441,7 @@ const isEvmBrowserWallet = (wallet) => [
|
|
|
1438
1441
|
Wallet.Phantom,
|
|
1439
1442
|
Wallet.Rainbow,
|
|
1440
1443
|
Wallet.Metamask,
|
|
1444
|
+
Wallet.KeplrEvm,
|
|
1441
1445
|
Wallet.OkxWallet,
|
|
1442
1446
|
Wallet.TrustWallet
|
|
1443
1447
|
].includes(wallet);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@injectivelabs/wallet-base",
|
|
3
|
-
"version": "1.16.38-alpha.
|
|
3
|
+
"version": "1.16.38-alpha.4",
|
|
4
4
|
"description": "Base wallet strategy for use with @injectivelabs/wallet-core.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -39,11 +39,10 @@
|
|
|
39
39
|
],
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"eip1193-provider": "^1.0.1",
|
|
42
|
-
"viem": "^2.
|
|
43
|
-
"@injectivelabs/
|
|
44
|
-
"@injectivelabs/
|
|
45
|
-
"@injectivelabs/
|
|
46
|
-
"@injectivelabs/sdk-ts": "1.16.38-alpha.2"
|
|
42
|
+
"viem": "^2.41.2",
|
|
43
|
+
"@injectivelabs/ts-types": "1.16.38-alpha.2",
|
|
44
|
+
"@injectivelabs/sdk-ts": "1.16.38-alpha.4",
|
|
45
|
+
"@injectivelabs/exceptions": "1.16.38-alpha.3"
|
|
47
46
|
},
|
|
48
47
|
"publishConfig": {
|
|
49
48
|
"access": "public"
|