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