unwallet-client-sdk 0.18.2 → 0.19.0

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/index.d.cts CHANGED
@@ -1,108 +1,113 @@
1
- import { Address, Hex } from 'viem';
1
+ import { Address, Hex } from "viem";
2
2
 
3
+ //#region src/config.d.ts
3
4
  declare const VALID_ENVS: readonly ["prod", "dev"];
4
5
  type Env = (typeof VALID_ENVS)[number];
5
6
  interface Config {
6
- env?: Env;
7
- clientID: string;
7
+ env?: Env;
8
+ clientID: string;
8
9
  }
9
10
  interface UnWalletXAPIConfig {
10
- url: string;
11
- connectionTimeout: number;
11
+ url: string;
12
+ connectionTimeout: number;
12
13
  }
13
-
14
+ //#endregion
15
+ //#region src/eip712.d.ts
14
16
  interface EIP712TypedData {
15
- types: Record<string, Array<EIP712TypedDataField>>;
16
- primaryType: string;
17
- domain: EIP712TypedDataDomain;
18
- message: Record<string, any>;
17
+ types: Record<string, Array<EIP712TypedDataField>>;
18
+ primaryType: string;
19
+ domain: EIP712TypedDataDomain;
20
+ message: Record<string, any>;
19
21
  }
20
22
  interface EIP712TypedDataDomain {
21
- name?: string;
22
- version?: string;
23
- chainId?: number;
24
- verifyingContract?: Address;
25
- salt?: Hex;
23
+ name?: string;
24
+ version?: string;
25
+ chainId?: number;
26
+ verifyingContract?: Address;
27
+ salt?: Hex;
26
28
  }
27
29
  interface EIP712TypedDataField {
28
- name: string;
29
- type: string;
30
+ name: string;
31
+ type: string;
30
32
  }
31
-
33
+ //#endregion
34
+ //#region src/error.d.ts
32
35
  declare const VALID_UW_ERROR_CODES: readonly ["CONNECTION_TIMEOUT", "CONNECTION_FAILED", "CONNECTION_NOT_OPENED", "CONNECTION_CLOSED", "INVALID_REQUEST", "REQUEST_IN_PROGRESS", "REQUEST_REJECTED", "INVALID_RESPONSE"];
33
36
  type UWErrorCode = (typeof VALID_UW_ERROR_CODES)[number];
34
37
  declare class UWError extends Error {
35
- readonly code: UWErrorCode;
36
- constructor(code: UWErrorCode, message?: string);
38
+ readonly code: UWErrorCode;
39
+ constructor(code: UWErrorCode, message?: string);
37
40
  }
38
-
41
+ //#endregion
42
+ //#region src/x.d.ts
39
43
  declare const VALID_X_RESPONSE_TYPES: readonly ["connectionID", "signature", "transactionID", "error"];
40
44
  type XResponseType = (typeof VALID_X_RESPONSE_TYPES)[number];
41
45
  interface XResponse {
42
- readonly type: XResponseType;
43
- readonly value: string;
46
+ readonly type: XResponseType;
47
+ readonly value: string;
44
48
  }
45
49
  interface XResponseHandler {
46
- resolve: (resp: XResponse) => void;
47
- reject: (err: UWError) => void;
50
+ resolve: (resp: XResponse) => void;
51
+ reject: (err: UWError) => void;
48
52
  }
49
53
  declare class XConnection {
50
- private socket;
51
- private responseHandler;
52
- readonly id: string;
53
- constructor(args: {
54
- socket: WebSocket;
55
- id: string;
56
- });
57
- private initListeners;
58
- get readyState(): number;
59
- get hasResponseHandler(): boolean;
60
- setResponseHandler(handler: XResponseHandler | null): void;
61
- static init(config: UnWalletXAPIConfig): Promise<XConnection>;
54
+ private socket;
55
+ private responseHandler;
56
+ readonly id: string;
57
+ constructor(args: {
58
+ socket: WebSocket;
59
+ id: string;
60
+ });
61
+ private initListeners;
62
+ get readyState(): number;
63
+ get hasResponseHandler(): boolean;
64
+ setResponseHandler(handler: XResponseHandler | null): void;
65
+ static init(config: UnWalletXAPIConfig): Promise<XConnection>;
62
66
  }
63
-
67
+ //#endregion
68
+ //#region src/unwallet.d.ts
64
69
  declare const VALID_AUTHORIZATION_RESPONSE_MODES: readonly ["fragment", "form_post"];
65
70
  type AuthorizationResponseMode = (typeof VALID_AUTHORIZATION_RESPONSE_MODES)[number];
66
71
  interface SignResult {
67
- digest: string;
68
- signature: string;
72
+ digest: string;
73
+ signature: string;
69
74
  }
70
75
  interface SendTransactionResult {
71
- transactionID: string;
76
+ transactionID: string;
72
77
  }
73
78
  declare class UnWallet {
74
- private env;
75
- private clientID;
76
- private xConnection;
77
- constructor(args: {
78
- env: Env;
79
- clientID: string;
80
- xConnection: XConnection;
81
- });
82
- static init(config: Config): Promise<UnWallet>;
83
- private get unWalletConfig();
84
- authorize(args: {
85
- responseMode?: AuthorizationResponseMode;
86
- redirectURL: string;
87
- nonce?: string;
88
- isVirtual?: boolean;
89
- chainID?: number;
90
- }): void;
91
- sign(args: {
92
- message: string;
93
- ticketToken: string;
94
- }): Promise<SignResult>;
95
- signEIP712TypedData(args: {
96
- typedData: EIP712TypedData;
97
- ticketToken: string;
98
- }): Promise<SignResult>;
99
- sendTransaction(args: {
100
- chainID: number;
101
- toAddress: string;
102
- value?: string;
103
- data?: string;
104
- ticketToken: string;
105
- }): Promise<SendTransactionResult>;
79
+ private env;
80
+ private clientID;
81
+ private xConnection;
82
+ constructor(args: {
83
+ env: Env;
84
+ clientID: string;
85
+ xConnection: XConnection;
86
+ });
87
+ static init(config: Config): Promise<UnWallet>;
88
+ private get unWalletConfig();
89
+ authorize(args: {
90
+ responseMode?: AuthorizationResponseMode;
91
+ redirectURL: string;
92
+ nonce?: string;
93
+ isVirtual?: boolean;
94
+ chainID?: number;
95
+ }): void;
96
+ sign(args: {
97
+ message: string;
98
+ ticketToken: string;
99
+ }): Promise<SignResult>;
100
+ signEIP712TypedData(args: {
101
+ typedData: EIP712TypedData;
102
+ ticketToken: string;
103
+ }): Promise<SignResult>;
104
+ sendTransaction(args: {
105
+ chainID: number;
106
+ toAddress: string;
107
+ value?: string;
108
+ data?: string;
109
+ ticketToken: string;
110
+ }): Promise<SendTransactionResult>;
106
111
  }
107
-
108
- export { type AuthorizationResponseMode, type Config, type EIP712TypedData, type EIP712TypedDataDomain, type EIP712TypedDataField, type Env, type SendTransactionResult, type SignResult, UWError, type UWErrorCode, UnWallet };
112
+ //#endregion
113
+ export { type AuthorizationResponseMode, type Config, type EIP712TypedData, type EIP712TypedDataDomain, type EIP712TypedDataField, type Env, type SendTransactionResult, type SignResult, UWError, type UWErrorCode, UnWallet };
package/dist/index.d.ts CHANGED
@@ -1,108 +1,113 @@
1
- import { Address, Hex } from 'viem';
1
+ import { Address, Hex } from "viem";
2
2
 
3
+ //#region src/config.d.ts
3
4
  declare const VALID_ENVS: readonly ["prod", "dev"];
4
5
  type Env = (typeof VALID_ENVS)[number];
5
6
  interface Config {
6
- env?: Env;
7
- clientID: string;
7
+ env?: Env;
8
+ clientID: string;
8
9
  }
9
10
  interface UnWalletXAPIConfig {
10
- url: string;
11
- connectionTimeout: number;
11
+ url: string;
12
+ connectionTimeout: number;
12
13
  }
13
-
14
+ //#endregion
15
+ //#region src/eip712.d.ts
14
16
  interface EIP712TypedData {
15
- types: Record<string, Array<EIP712TypedDataField>>;
16
- primaryType: string;
17
- domain: EIP712TypedDataDomain;
18
- message: Record<string, any>;
17
+ types: Record<string, Array<EIP712TypedDataField>>;
18
+ primaryType: string;
19
+ domain: EIP712TypedDataDomain;
20
+ message: Record<string, any>;
19
21
  }
20
22
  interface EIP712TypedDataDomain {
21
- name?: string;
22
- version?: string;
23
- chainId?: number;
24
- verifyingContract?: Address;
25
- salt?: Hex;
23
+ name?: string;
24
+ version?: string;
25
+ chainId?: number;
26
+ verifyingContract?: Address;
27
+ salt?: Hex;
26
28
  }
27
29
  interface EIP712TypedDataField {
28
- name: string;
29
- type: string;
30
+ name: string;
31
+ type: string;
30
32
  }
31
-
33
+ //#endregion
34
+ //#region src/error.d.ts
32
35
  declare const VALID_UW_ERROR_CODES: readonly ["CONNECTION_TIMEOUT", "CONNECTION_FAILED", "CONNECTION_NOT_OPENED", "CONNECTION_CLOSED", "INVALID_REQUEST", "REQUEST_IN_PROGRESS", "REQUEST_REJECTED", "INVALID_RESPONSE"];
33
36
  type UWErrorCode = (typeof VALID_UW_ERROR_CODES)[number];
34
37
  declare class UWError extends Error {
35
- readonly code: UWErrorCode;
36
- constructor(code: UWErrorCode, message?: string);
38
+ readonly code: UWErrorCode;
39
+ constructor(code: UWErrorCode, message?: string);
37
40
  }
38
-
41
+ //#endregion
42
+ //#region src/x.d.ts
39
43
  declare const VALID_X_RESPONSE_TYPES: readonly ["connectionID", "signature", "transactionID", "error"];
40
44
  type XResponseType = (typeof VALID_X_RESPONSE_TYPES)[number];
41
45
  interface XResponse {
42
- readonly type: XResponseType;
43
- readonly value: string;
46
+ readonly type: XResponseType;
47
+ readonly value: string;
44
48
  }
45
49
  interface XResponseHandler {
46
- resolve: (resp: XResponse) => void;
47
- reject: (err: UWError) => void;
50
+ resolve: (resp: XResponse) => void;
51
+ reject: (err: UWError) => void;
48
52
  }
49
53
  declare class XConnection {
50
- private socket;
51
- private responseHandler;
52
- readonly id: string;
53
- constructor(args: {
54
- socket: WebSocket;
55
- id: string;
56
- });
57
- private initListeners;
58
- get readyState(): number;
59
- get hasResponseHandler(): boolean;
60
- setResponseHandler(handler: XResponseHandler | null): void;
61
- static init(config: UnWalletXAPIConfig): Promise<XConnection>;
54
+ private socket;
55
+ private responseHandler;
56
+ readonly id: string;
57
+ constructor(args: {
58
+ socket: WebSocket;
59
+ id: string;
60
+ });
61
+ private initListeners;
62
+ get readyState(): number;
63
+ get hasResponseHandler(): boolean;
64
+ setResponseHandler(handler: XResponseHandler | null): void;
65
+ static init(config: UnWalletXAPIConfig): Promise<XConnection>;
62
66
  }
63
-
67
+ //#endregion
68
+ //#region src/unwallet.d.ts
64
69
  declare const VALID_AUTHORIZATION_RESPONSE_MODES: readonly ["fragment", "form_post"];
65
70
  type AuthorizationResponseMode = (typeof VALID_AUTHORIZATION_RESPONSE_MODES)[number];
66
71
  interface SignResult {
67
- digest: string;
68
- signature: string;
72
+ digest: string;
73
+ signature: string;
69
74
  }
70
75
  interface SendTransactionResult {
71
- transactionID: string;
76
+ transactionID: string;
72
77
  }
73
78
  declare class UnWallet {
74
- private env;
75
- private clientID;
76
- private xConnection;
77
- constructor(args: {
78
- env: Env;
79
- clientID: string;
80
- xConnection: XConnection;
81
- });
82
- static init(config: Config): Promise<UnWallet>;
83
- private get unWalletConfig();
84
- authorize(args: {
85
- responseMode?: AuthorizationResponseMode;
86
- redirectURL: string;
87
- nonce?: string;
88
- isVirtual?: boolean;
89
- chainID?: number;
90
- }): void;
91
- sign(args: {
92
- message: string;
93
- ticketToken: string;
94
- }): Promise<SignResult>;
95
- signEIP712TypedData(args: {
96
- typedData: EIP712TypedData;
97
- ticketToken: string;
98
- }): Promise<SignResult>;
99
- sendTransaction(args: {
100
- chainID: number;
101
- toAddress: string;
102
- value?: string;
103
- data?: string;
104
- ticketToken: string;
105
- }): Promise<SendTransactionResult>;
79
+ private env;
80
+ private clientID;
81
+ private xConnection;
82
+ constructor(args: {
83
+ env: Env;
84
+ clientID: string;
85
+ xConnection: XConnection;
86
+ });
87
+ static init(config: Config): Promise<UnWallet>;
88
+ private get unWalletConfig();
89
+ authorize(args: {
90
+ responseMode?: AuthorizationResponseMode;
91
+ redirectURL: string;
92
+ nonce?: string;
93
+ isVirtual?: boolean;
94
+ chainID?: number;
95
+ }): void;
96
+ sign(args: {
97
+ message: string;
98
+ ticketToken: string;
99
+ }): Promise<SignResult>;
100
+ signEIP712TypedData(args: {
101
+ typedData: EIP712TypedData;
102
+ ticketToken: string;
103
+ }): Promise<SignResult>;
104
+ sendTransaction(args: {
105
+ chainID: number;
106
+ toAddress: string;
107
+ value?: string;
108
+ data?: string;
109
+ ticketToken: string;
110
+ }): Promise<SendTransactionResult>;
106
111
  }
107
-
108
- export { type AuthorizationResponseMode, type Config, type EIP712TypedData, type EIP712TypedDataDomain, type EIP712TypedDataField, type Env, type SendTransactionResult, type SignResult, UWError, type UWErrorCode, UnWallet };
112
+ //#endregion
113
+ export { type AuthorizationResponseMode, type Config, type EIP712TypedData, type EIP712TypedDataDomain, type EIP712TypedDataField, type Env, type SendTransactionResult, type SignResult, UWError, type UWErrorCode, UnWallet };