-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtypes.ts
108 lines (94 loc) · 2.44 KB
/
types.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
import { Value } from './lib/ExperimentalContainer';
export type Cip30Function =
| 'getNetworkId'
| 'getUtxos'
| 'getCollateral'
| 'getBalance'
| 'getUsedAddresses'
| 'getUnusedAddresses'
| 'getChangeAddress'
| 'getRewardAddresses'
| 'signTx'
| 'signData'
| 'submitTx';
export type ExperimentalRpcEndpoint =
| 'invokeExperimental'
| 'invokeEnableExperimental';
export type Cbor = string;
export type Bytes = string;
export type Paginate = {
page: number;
limit: number;
};
type CoseSign1CborHex = string;
type CoseKeyCborHex = string;
export type Cip30DataSignature = {
key: CoseKeyCborHex;
signature: CoseSign1CborHex;
};
export type deviceType = 'mobile' | 'desktop'
export type mobileOsType = 'ios' | 'android'
export type appType = 'browser' | 'pwa' | 'native'
export type osInfo = {
deviceType: deviceType,
mobileOsType?: mobileOsType,
mobileType?: appType,
url?: String
}
export type PeerConnectApi = {
apiVersion: string;
name: string;
icon: string;
methods: Array<Cip30Function>;
experimentalApi: string; // This is a serialized TypeMapping
fullExperimentalApi: string; // This is a serialized TypeMapping
};
export type Cip30Api = {
enable: () => Promise<{
[key in Cip30Function | 'experimental']?: Function | Record<string, Value>;
}>;
isEnabled: () => Promise<boolean>;
experimental: Record<string, Value>;
apiVersion: string;
icon: string;
name: string;
identifier: string;
};
export interface IDAppInfos {
name: string;
url: string;
address: string;
icon?: string;
}
export interface IConnectMessage {
dApp: IDAppInfos;
address?: string;
connected: boolean;
error: boolean;
errorMessage?: string;
autoConnect?: boolean;
}
export interface IWalletInfo {
address?: string;
name: string;
version: string;
icon: string;
requestAutoconnect?: boolean;
osInfo?: osInfo
}
export interface DAppPeerConnectParameters {
dAppInfo: Omit<IDAppInfos, 'address'>;
seed?: string;
discoverySeed?: string;
announce?: Array<string>;
loggingEnabled?: boolean;
verifyConnection?: (
walletInfo: IWalletInfo,
callback: (granted: boolean, allowAutoConnect: boolean, walletInfo?: IWalletInfo) => void
) => void;
onConnect?: (address: string, walletInfo?: IWalletInfo) => void;
onDisconnect?: (address: string) => void;
onApiEject?: (name: string, address: string) => void;
onApiInject?: (name: string, address: string) => void;
useWalletDiscovery?: boolean;
}