-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.d.ts
72 lines (72 loc) · 2.01 KB
/
types.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import { AccAddress, CreateTxOptions, LCDClientConfig, PublicKey, Tx } from '@terra-money/feather.js';
export type NetworkInfo = Record<string, LCDClientConfig>;
export interface TxResult extends CreateTxOptions {
result: {
height: number;
raw_log: string;
txhash: string;
};
success: boolean;
}
export interface SignResult extends CreateTxOptions {
result: Tx;
success: boolean;
}
export interface SignBytesResult {
result: {
recid: number;
signature: Uint8Array;
public_key?: PublicKey;
};
success: boolean;
}
export declare enum WalletStatus {
INITIALIZING = "INITIALIZING",
WALLET_NOT_CONNECTED = "WALLET_NOT_CONNECTED",
WALLET_CONNECTED = "WALLET_CONNECTED"
}
export declare enum ConnectType {
/** Terra Station Extension or compatible browser extensions */
EXTENSION = "EXTENSION",
/** Terra Station Mobile or compatible mobile wallets */
WALLETCONNECT = "WALLETCONNECT",
/** Read only mode - View an address */
READONLY = "READONLY",
/** Plugins injected from app */
PLUGINS = "PLUGINS"
}
export interface Connection {
type: ConnectType;
identifier?: string;
name: string;
icon: string;
}
export interface Installation {
type: ConnectType;
identifier: string;
name: string;
icon: string;
url: string;
}
export interface WalletInfo {
connectType: ConnectType;
addresses: Record<string, AccAddress>;
design?: string;
metadata?: {
[key: string]: any;
};
}
export type WalletStates = {
status: WalletStatus.INITIALIZING;
network: NetworkInfo;
} | {
status: WalletStatus.WALLET_NOT_CONNECTED;
network: NetworkInfo;
} | {
status: WalletStatus.WALLET_CONNECTED;
connection: Connection;
network: NetworkInfo;
wallets: WalletInfo[];
/** This type is same as `import type { TerraWebExtensionFeatures } from '@terra-money/web-extension-interface'` */
supportFeatures: Set<'post' | 'sign' | 'sign-bytes' | 'cw20-token' | 'network'>;
};