@keplr-wallet/types 0.12.212 → 0.12.213

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/build/bip44.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export interface BIP44 {
2
2
  readonly coinType: number;
3
+ readonly purpose?: number;
3
4
  }
@@ -58,7 +58,14 @@ export interface StarknetChainInfo {
58
58
  readonly ethContractAddress: string;
59
59
  readonly strkContractAddress: string;
60
60
  }
61
- export type ChainInfoModule = "cosmos" | "starknet";
61
+ export interface BitcoinChainInfo {
62
+ readonly rpc: string;
63
+ readonly rest: string;
64
+ readonly chainId: string;
65
+ readonly bip44: BIP44;
66
+ readonly currencies: AppCurrency[];
67
+ }
68
+ export type ChainInfoModule = "cosmos" | "starknet" | "bitcoin";
62
69
  export type ModularChainInfo = {
63
70
  readonly chainId: string;
64
71
  readonly chainName: string;
@@ -69,4 +76,10 @@ export type ModularChainInfo = {
69
76
  readonly chainName: string;
70
77
  readonly chainSymbolImageUrl?: string;
71
78
  readonly starknet: StarknetChainInfo;
79
+ } | {
80
+ readonly chainId: string;
81
+ readonly chainName: string;
82
+ readonly chainSymbolImageUrl?: string;
83
+ readonly linkedChainKey: string;
84
+ readonly bitcoin: BitcoinChainInfo;
72
85
  };
@@ -0,0 +1,65 @@
1
+ /// <reference types="node" />
2
+ import EventEmitter from "events";
3
+ export declare enum BitcoinSignMessageType {
4
+ ECDSA = "ecdsa",
5
+ BIP322_SIMPLE = "bip322-simple"
6
+ }
7
+ export declare enum GenesisHash {
8
+ LIVENET = "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f",
9
+ TESTNET = "000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943",
10
+ SIGNET = "00000008819873e925422c1ff0f99f7cc9bbb232af63a077a480a3633bee1ef6"
11
+ }
12
+ export declare enum Network {
13
+ LIVENET = "livenet",
14
+ MAINNET = "mainnet",
15
+ TESTNET = "testnet",
16
+ SIGNET = "signet"
17
+ }
18
+ export declare enum ChainType {
19
+ BITCOIN_MAINNET = "BITCOIN_MAINNET",
20
+ BITCOIN_TESTNET = "BITCOIN_TESTNET",
21
+ BITCOIN_SIGNET = "BITCOIN_SIGNET"
22
+ }
23
+ export type SupportedPaymentType = "native-segwit" | "taproot";
24
+ export declare const GENESIS_HASH_TO_NETWORK: Record<GenesisHash, Network>;
25
+ export declare const NETWORK_TO_GENESIS_HASH: Record<Network, GenesisHash>;
26
+ export declare const GENESIS_HASH_TO_CHAIN_TYPE: Record<GenesisHash, ChainType>;
27
+ export declare const CHAIN_TYPE_TO_GENESIS_HASH: Record<ChainType, GenesisHash>;
28
+ export type SignPsbtOptions = {
29
+ autoFinalized?: boolean;
30
+ toSignInputs?: Array<{
31
+ index: number;
32
+ address?: string;
33
+ publicKey?: string;
34
+ sighashTypes?: number[];
35
+ disableTweakSigner?: boolean;
36
+ useTweakedSigner?: boolean;
37
+ }>;
38
+ };
39
+ export interface IBitcoinProvider extends EventEmitter {
40
+ getAccounts: () => Promise<string[]>;
41
+ requestAccounts: () => Promise<string[]>;
42
+ disconnect: () => Promise<void>;
43
+ getNetwork: () => Promise<Network>;
44
+ switchNetwork: (network: Network) => Promise<Network>;
45
+ getChain: () => Promise<{
46
+ enum: ChainType;
47
+ name: string;
48
+ network: Network;
49
+ }>;
50
+ switchChain: (chain: ChainType) => Promise<ChainType>;
51
+ getPublicKey: () => Promise<string>;
52
+ getBalance: () => Promise<{
53
+ confirmed: number;
54
+ unconfirmed: number;
55
+ total: number;
56
+ }>;
57
+ getInscriptions: () => Promise<string[]>;
58
+ signMessage: (message: string, type?: BitcoinSignMessageType) => Promise<string>;
59
+ sendBitcoin: (to: string, amount: number) => Promise<string>;
60
+ pushTx: (rawTxHex: string) => Promise<string>;
61
+ signPsbt: (psbtHex: string, options?: SignPsbtOptions) => Promise<string>;
62
+ signPsbts: (psbtsHexes: string[], options?: SignPsbtOptions) => Promise<string[]>;
63
+ getAddress: () => Promise<string>;
64
+ connectWallet: () => Promise<string[]>;
65
+ }
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CHAIN_TYPE_TO_GENESIS_HASH = exports.GENESIS_HASH_TO_CHAIN_TYPE = exports.NETWORK_TO_GENESIS_HASH = exports.GENESIS_HASH_TO_NETWORK = exports.ChainType = exports.Network = exports.GenesisHash = exports.BitcoinSignMessageType = void 0;
4
+ var BitcoinSignMessageType;
5
+ (function (BitcoinSignMessageType) {
6
+ BitcoinSignMessageType["ECDSA"] = "ecdsa";
7
+ BitcoinSignMessageType["BIP322_SIMPLE"] = "bip322-simple";
8
+ })(BitcoinSignMessageType = exports.BitcoinSignMessageType || (exports.BitcoinSignMessageType = {}));
9
+ var GenesisHash;
10
+ (function (GenesisHash) {
11
+ GenesisHash["LIVENET"] = "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f";
12
+ GenesisHash["TESTNET"] = "000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943";
13
+ GenesisHash["SIGNET"] = "00000008819873e925422c1ff0f99f7cc9bbb232af63a077a480a3633bee1ef6";
14
+ })(GenesisHash = exports.GenesisHash || (exports.GenesisHash = {}));
15
+ var Network;
16
+ (function (Network) {
17
+ // LIVENET is a default network same as MAINNET
18
+ Network["LIVENET"] = "livenet";
19
+ Network["MAINNET"] = "mainnet";
20
+ Network["TESTNET"] = "testnet";
21
+ Network["SIGNET"] = "signet";
22
+ })(Network = exports.Network || (exports.Network = {}));
23
+ var ChainType;
24
+ (function (ChainType) {
25
+ ChainType["BITCOIN_MAINNET"] = "BITCOIN_MAINNET";
26
+ ChainType["BITCOIN_TESTNET"] = "BITCOIN_TESTNET";
27
+ ChainType["BITCOIN_SIGNET"] = "BITCOIN_SIGNET";
28
+ })(ChainType = exports.ChainType || (exports.ChainType = {}));
29
+ exports.GENESIS_HASH_TO_NETWORK = {
30
+ [GenesisHash.LIVENET]: Network.LIVENET,
31
+ [GenesisHash.TESTNET]: Network.TESTNET,
32
+ [GenesisHash.SIGNET]: Network.SIGNET,
33
+ };
34
+ exports.NETWORK_TO_GENESIS_HASH = {
35
+ [Network.MAINNET]: GenesisHash.LIVENET,
36
+ [Network.LIVENET]: GenesisHash.LIVENET,
37
+ [Network.TESTNET]: GenesisHash.TESTNET,
38
+ [Network.SIGNET]: GenesisHash.SIGNET,
39
+ };
40
+ exports.GENESIS_HASH_TO_CHAIN_TYPE = {
41
+ [GenesisHash.LIVENET]: ChainType.BITCOIN_MAINNET,
42
+ [GenesisHash.TESTNET]: ChainType.BITCOIN_TESTNET,
43
+ [GenesisHash.SIGNET]: ChainType.BITCOIN_SIGNET,
44
+ };
45
+ exports.CHAIN_TYPE_TO_GENESIS_HASH = {
46
+ [ChainType.BITCOIN_MAINNET]: GenesisHash.LIVENET,
47
+ [ChainType.BITCOIN_TESTNET]: GenesisHash.TESTNET,
48
+ [ChainType.BITCOIN_SIGNET]: GenesisHash.SIGNET,
49
+ };
50
+ //# sourceMappingURL=bitcoin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bitcoin.js","sourceRoot":"","sources":["../../src/wallet/bitcoin.ts"],"names":[],"mappings":";;;AAEA,IAAY,sBAGX;AAHD,WAAY,sBAAsB;IAChC,yCAAe,CAAA;IACf,yDAA+B,CAAA;AACjC,CAAC,EAHW,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QAGjC;AAED,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,2FAA4E,CAAA;IAC5E,2FAA4E,CAAA;IAC5E,0FAA2E,CAAA;AAC7E,CAAC,EAJW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAItB;AAED,IAAY,OAMX;AAND,WAAY,OAAO;IACjB,+CAA+C;IAC/C,8BAAmB,CAAA;IACnB,8BAAmB,CAAA;IACnB,8BAAmB,CAAA;IACnB,4BAAiB,CAAA;AACnB,CAAC,EANW,OAAO,GAAP,eAAO,KAAP,eAAO,QAMlB;AAED,IAAY,SAIX;AAJD,WAAY,SAAS;IACnB,gDAAmC,CAAA;IACnC,gDAAmC,CAAA;IACnC,8CAAiC,CAAA;AACnC,CAAC,EAJW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAIpB;AAIY,QAAA,uBAAuB,GAAiC;IACnE,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,OAAO;IACtC,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,OAAO;IACtC,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,MAAM;CACrC,CAAC;AAEW,QAAA,uBAAuB,GAAiC;IACnE,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,WAAW,CAAC,OAAO;IACtC,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,WAAW,CAAC,OAAO;IACtC,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,WAAW,CAAC,OAAO;IACtC,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC,MAAM;CACrC,CAAC;AAEW,QAAA,0BAA0B,GAAmC;IACxE,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,SAAS,CAAC,eAAe;IAChD,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,SAAS,CAAC,eAAe;IAChD,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC,cAAc;CAC/C,CAAC;AAEW,QAAA,0BAA0B,GAAmC;IACxE,CAAC,SAAS,CAAC,eAAe,CAAC,EAAE,WAAW,CAAC,OAAO;IAChD,CAAC,SAAS,CAAC,eAAe,CAAC,EAAE,WAAW,CAAC,OAAO;IAChD,CAAC,SAAS,CAAC,cAAc,CAAC,EAAE,WAAW,CAAC,MAAM;CAC/C,CAAC"}
@@ -2,3 +2,4 @@ export * from "./keplr";
2
2
  export * from "./eip6963";
3
3
  export * from "./ethereum";
4
4
  export * from "./starknet";
5
+ export * from "./bitcoin";
@@ -18,4 +18,5 @@ __exportStar(require("./keplr"), exports);
18
18
  __exportStar(require("./eip6963"), exports);
19
19
  __exportStar(require("./ethereum"), exports);
20
20
  __exportStar(require("./starknet"), exports);
21
+ __exportStar(require("./bitcoin"), exports);
21
22
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/wallet/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,4CAA0B;AAC1B,6CAA2B;AAC3B,6CAA2B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/wallet/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,4CAA0B;AAC1B,6CAA2B;AAC3B,6CAA2B;AAC3B,4CAA0B"}
@@ -8,6 +8,7 @@ import { DirectAuxSignResponse } from "../cosmjs-alt";
8
8
  import { IEthereumProvider } from "./ethereum";
9
9
  import { IStarknetProvider } from "./starknet";
10
10
  import type { Call, DeployAccountSignerDetails, InvocationsSignerDetails } from "starknet";
11
+ import { IBitcoinProvider, SignPsbtOptions, SupportedPaymentType } from "./bitcoin";
11
12
  export interface Key {
12
13
  readonly name: string;
13
14
  readonly algo: string;
@@ -154,6 +155,23 @@ export interface Keplr {
154
155
  details: InvocationsSignerDetails;
155
156
  signature: string[];
156
157
  }>;
158
+ getBitcoinKey(chainId: string): Promise<{
159
+ name: string;
160
+ pubKey: Uint8Array;
161
+ address: string;
162
+ paymentType: SupportedPaymentType;
163
+ isNanoLedger: boolean;
164
+ }>;
165
+ getBitcoinKeysSettled(chainIds: string[]): Promise<SettledResponses<{
166
+ name: string;
167
+ pubKey: Uint8Array;
168
+ address: string;
169
+ paymentType: SupportedPaymentType;
170
+ isNanoLedger: boolean;
171
+ }>>;
172
+ signPsbt(chainId: string, psbtHex: string, options?: SignPsbtOptions): Promise<string>;
173
+ signPsbts(chainId: string, psbtsHexes: string[], options?: SignPsbtOptions): Promise<string[]>;
157
174
  readonly ethereum: IEthereumProvider;
158
175
  readonly starknet: IStarknetProvider;
176
+ readonly bitcoin: IBitcoinProvider;
159
177
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@keplr-wallet/types",
3
- "version": "0.12.212",
3
+ "version": "0.12.213",
4
4
  "main": "build/index.js",
5
5
  "author": "chainapsis",
6
6
  "license": "Apache-2.0",
@@ -21,5 +21,5 @@
21
21
  "peerDependencies": {
22
22
  "starknet": "^6"
23
23
  },
24
- "gitHead": "81e253e7cea338ee8469d2ac718c341bfa584f85"
24
+ "gitHead": "7b4427d3c6f9c93be0eb7df25e9bd75d5bfda224"
25
25
  }
package/src/bip44.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export interface BIP44 {
2
2
  readonly coinType: number;
3
+ readonly purpose?: number;
3
4
  }
package/src/chain-info.ts CHANGED
@@ -71,7 +71,15 @@ export interface StarknetChainInfo {
71
71
  readonly strkContractAddress: string;
72
72
  }
73
73
 
74
- export type ChainInfoModule = "cosmos" | "starknet";
74
+ export interface BitcoinChainInfo {
75
+ readonly rpc: string;
76
+ readonly rest: string;
77
+ readonly chainId: string;
78
+ readonly bip44: BIP44;
79
+ readonly currencies: AppCurrency[];
80
+ }
81
+
82
+ export type ChainInfoModule = "cosmos" | "starknet" | "bitcoin";
75
83
 
76
84
  export type ModularChainInfo =
77
85
  | {
@@ -85,4 +93,11 @@ export type ModularChainInfo =
85
93
  readonly chainName: string;
86
94
  readonly chainSymbolImageUrl?: string;
87
95
  readonly starknet: StarknetChainInfo;
96
+ }
97
+ | {
98
+ readonly chainId: string;
99
+ readonly chainName: string;
100
+ readonly chainSymbolImageUrl?: string;
101
+ readonly linkedChainKey: string;
102
+ readonly bitcoin: BitcoinChainInfo;
88
103
  };
@@ -0,0 +1,99 @@
1
+ import EventEmitter from "events";
2
+
3
+ export enum BitcoinSignMessageType {
4
+ ECDSA = "ecdsa",
5
+ BIP322_SIMPLE = "bip322-simple",
6
+ }
7
+
8
+ export enum GenesisHash {
9
+ LIVENET = "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f",
10
+ TESTNET = "000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943",
11
+ SIGNET = "00000008819873e925422c1ff0f99f7cc9bbb232af63a077a480a3633bee1ef6",
12
+ }
13
+
14
+ export enum Network {
15
+ // LIVENET is a default network same as MAINNET
16
+ LIVENET = "livenet",
17
+ MAINNET = "mainnet",
18
+ TESTNET = "testnet",
19
+ SIGNET = "signet",
20
+ }
21
+
22
+ export enum ChainType {
23
+ BITCOIN_MAINNET = "BITCOIN_MAINNET",
24
+ BITCOIN_TESTNET = "BITCOIN_TESTNET",
25
+ BITCOIN_SIGNET = "BITCOIN_SIGNET",
26
+ }
27
+
28
+ export type SupportedPaymentType = "native-segwit" | "taproot";
29
+
30
+ export const GENESIS_HASH_TO_NETWORK: Record<GenesisHash, Network> = {
31
+ [GenesisHash.LIVENET]: Network.LIVENET,
32
+ [GenesisHash.TESTNET]: Network.TESTNET,
33
+ [GenesisHash.SIGNET]: Network.SIGNET,
34
+ };
35
+
36
+ export const NETWORK_TO_GENESIS_HASH: Record<Network, GenesisHash> = {
37
+ [Network.MAINNET]: GenesisHash.LIVENET,
38
+ [Network.LIVENET]: GenesisHash.LIVENET,
39
+ [Network.TESTNET]: GenesisHash.TESTNET,
40
+ [Network.SIGNET]: GenesisHash.SIGNET,
41
+ };
42
+
43
+ export const GENESIS_HASH_TO_CHAIN_TYPE: Record<GenesisHash, ChainType> = {
44
+ [GenesisHash.LIVENET]: ChainType.BITCOIN_MAINNET,
45
+ [GenesisHash.TESTNET]: ChainType.BITCOIN_TESTNET,
46
+ [GenesisHash.SIGNET]: ChainType.BITCOIN_SIGNET,
47
+ };
48
+
49
+ export const CHAIN_TYPE_TO_GENESIS_HASH: Record<ChainType, GenesisHash> = {
50
+ [ChainType.BITCOIN_MAINNET]: GenesisHash.LIVENET,
51
+ [ChainType.BITCOIN_TESTNET]: GenesisHash.TESTNET,
52
+ [ChainType.BITCOIN_SIGNET]: GenesisHash.SIGNET,
53
+ };
54
+
55
+ export type SignPsbtOptions = {
56
+ autoFinalized?: boolean;
57
+ toSignInputs?: Array<{
58
+ index: number;
59
+ address?: string;
60
+ publicKey?: string;
61
+ sighashTypes?: number[];
62
+ disableTweakSigner?: boolean;
63
+ useTweakedSigner?: boolean;
64
+ }>;
65
+ };
66
+
67
+ export interface IBitcoinProvider extends EventEmitter {
68
+ getAccounts: () => Promise<string[]>;
69
+ requestAccounts: () => Promise<string[]>;
70
+ disconnect: () => Promise<void>;
71
+ getNetwork: () => Promise<Network>;
72
+ switchNetwork: (network: Network) => Promise<Network>;
73
+ getChain: () => Promise<{
74
+ enum: ChainType;
75
+ name: string;
76
+ network: Network;
77
+ }>;
78
+ switchChain: (chain: ChainType) => Promise<ChainType>;
79
+ getPublicKey: () => Promise<string>;
80
+ getBalance: () => Promise<{
81
+ confirmed: number;
82
+ unconfirmed: number;
83
+ total: number;
84
+ }>;
85
+ getInscriptions: () => Promise<string[]>;
86
+ signMessage: (
87
+ message: string,
88
+ type?: BitcoinSignMessageType
89
+ ) => Promise<string>;
90
+ sendBitcoin: (to: string, amount: number) => Promise<string>;
91
+ pushTx: (rawTxHex: string) => Promise<string>;
92
+ signPsbt: (psbtHex: string, options?: SignPsbtOptions) => Promise<string>;
93
+ signPsbts: (
94
+ psbtsHexes: string[],
95
+ options?: SignPsbtOptions
96
+ ) => Promise<string[]>;
97
+ getAddress: () => Promise<string>;
98
+ connectWallet: () => Promise<string[]>;
99
+ }
@@ -2,3 +2,4 @@ export * from "./keplr";
2
2
  export * from "./eip6963";
3
3
  export * from "./ethereum";
4
4
  export * from "./starknet";
5
+ export * from "./bitcoin";
@@ -20,6 +20,11 @@ import type {
20
20
  DeployAccountSignerDetails,
21
21
  InvocationsSignerDetails,
22
22
  } from "starknet";
23
+ import {
24
+ IBitcoinProvider,
25
+ SignPsbtOptions,
26
+ SupportedPaymentType,
27
+ } from "./bitcoin";
23
28
 
24
29
  export interface Key {
25
30
  // Name of the selected key store.
@@ -281,8 +286,35 @@ export interface Keplr {
281
286
  details: InvocationsSignerDetails;
282
287
  signature: string[];
283
288
  }>;
284
-
289
+ getBitcoinKey(chainId: string): Promise<{
290
+ name: string;
291
+ pubKey: Uint8Array;
292
+ address: string;
293
+ paymentType: SupportedPaymentType;
294
+ isNanoLedger: boolean;
295
+ }>;
296
+ getBitcoinKeysSettled(chainIds: string[]): Promise<
297
+ SettledResponses<{
298
+ name: string;
299
+ pubKey: Uint8Array;
300
+ address: string;
301
+ paymentType: SupportedPaymentType;
302
+ isNanoLedger: boolean;
303
+ }>
304
+ >;
305
+ signPsbt(
306
+ chainId: string,
307
+ psbtHex: string,
308
+ options?: SignPsbtOptions
309
+ ): Promise<string>;
310
+ signPsbts(
311
+ chainId: string,
312
+ psbtsHexes: string[],
313
+ options?: SignPsbtOptions
314
+ ): Promise<string[]>;
285
315
  readonly ethereum: IEthereumProvider;
286
316
 
287
317
  readonly starknet: IStarknetProvider;
318
+
319
+ readonly bitcoin: IBitcoinProvider;
288
320
  }