zigap-utils 0.0.811 → 2.0.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/README.md +149 -115
- package/dist/components/LoginQR/LoginQR.types.d.ts +2 -0
- package/dist/components/SendTransactionQR/SendTransactionQR.d.ts +4 -0
- package/dist/components/SendTransactionQR/SendTransactionQR.types.d.ts +58 -0
- package/dist/components/SendTransactionQR/index.d.ts +2 -0
- package/dist/components/SignatureQR/SignatureQR.d.ts +4 -0
- package/dist/components/SignatureQR/SignatureQR.types.d.ts +59 -0
- package/dist/components/SignatureQR/index.d.ts +2 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/index.es.js +9406 -5113
- package/dist/preprocessEnv.d.ts +1 -0
- package/dist/utils/cryptoUtils.d.ts +1 -1
- package/dist/utils/sendTransaction.d.ts +15 -0
- package/dist/utils/signature.d.ts +15 -0
- package/dist/utils/socketService.d.ts +6 -3
- package/dist/utils/types.d.ts +15 -0
- package/dist/xphere/evm-sign.d.ts +7 -0
- package/dist/zigap/qr.d.ts +2 -1
- package/package.json +8 -7
package/README.md
CHANGED
|
@@ -19,16 +19,18 @@ npm i zigap-utils
|
|
|
19
19
|
> \_ INDEX
|
|
20
20
|
>
|
|
21
21
|
> 1. <b>Login</b>
|
|
22
|
-
> 2. <b>
|
|
23
|
-
>
|
|
22
|
+
> 2. <b>Signature</b>
|
|
23
|
+
> 3. <b>SendTransaction</b>
|
|
24
|
+
> 4. <b>useZigap Hook</b>
|
|
24
25
|
|
|
25
26
|
### 1. Login
|
|
26
27
|
|
|
27
28
|
```ts
|
|
28
29
|
import { LoginQR } from 'zigap-utils';
|
|
30
|
+
import type { LoginResultType } from 'zigap-utils/LoginQR/LoginQR.types'
|
|
29
31
|
|
|
30
32
|
const App = () => {
|
|
31
|
-
|
|
33
|
+
const [result, setResult] = useState<LoginResultType | null>(null);
|
|
32
34
|
...
|
|
33
35
|
|
|
34
36
|
return (
|
|
@@ -36,17 +38,19 @@ const App = () => {
|
|
|
36
38
|
<LoginQR
|
|
37
39
|
dapp='your Dapp Name'
|
|
38
40
|
url='http://sample.yours.com'
|
|
39
|
-
availableNetworks={['
|
|
41
|
+
availableNetworks={['v2xphere, v3xphere']}
|
|
40
42
|
isShowLogo={false}
|
|
41
43
|
logoSize={25}
|
|
42
44
|
validSeconds={600}
|
|
43
45
|
sigMessage="hello world"
|
|
44
46
|
expire={{ type: 'EXTEND', seconds: 3600 }}
|
|
45
47
|
icon="http://sample.icon-url.com"
|
|
46
|
-
onReceive={({ status }) => {
|
|
48
|
+
onReceive={({ status, result }) => {
|
|
47
49
|
if(status === 'SUCCESS') {
|
|
48
50
|
// something to do after login (refresh page...)
|
|
49
51
|
// status type: 'REQUEST' | 'ACCOUNT' | 'SUCCESS' | 'ERROR'
|
|
52
|
+
// you can use result when status is 'SUCCESS'
|
|
53
|
+
setResult(result as LoginResultType);
|
|
50
54
|
}
|
|
51
55
|
}}
|
|
52
56
|
/>
|
|
@@ -57,50 +61,123 @@ const App = () => {
|
|
|
57
61
|
|
|
58
62
|
<br />
|
|
59
63
|
|
|
60
|
-
### 2.
|
|
64
|
+
### 2. SignatureQR
|
|
61
65
|
|
|
62
66
|
```ts
|
|
63
|
-
import {
|
|
67
|
+
import { SignatureQR } from 'zigap-utils';
|
|
68
|
+
import type { SignatureResultType } from 'zigap-utils/SignatureQR/SignatureQR.types'
|
|
64
69
|
|
|
65
70
|
const App = () => {
|
|
66
|
-
const [
|
|
71
|
+
const [result, setResult] = useState<SignatureResultType | null>(null);
|
|
67
72
|
|
|
68
73
|
...
|
|
69
74
|
|
|
70
75
|
return (
|
|
71
76
|
<div>
|
|
72
|
-
<
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
77
|
+
<SignatureQR
|
|
78
|
+
dapp='your Dapp Name'
|
|
79
|
+
url='http://sample.yours.com'
|
|
80
|
+
availableNetworks={['v2xphere, v3xphere']}
|
|
81
|
+
isShowLogo={false}
|
|
82
|
+
logoSize={25}
|
|
83
|
+
validSeconds={600}
|
|
84
|
+
sigMessage="hello world"
|
|
85
|
+
expire={{ type: 'EXTEND', seconds: 3600 }}
|
|
86
|
+
icon="http://sample.icon-url.com"
|
|
87
|
+
onReceive={({ status, result }) => {
|
|
88
|
+
if(status === 'SUCCESS') {
|
|
89
|
+
// it is same with LoginQR. But you can see another type in zigap signature history.
|
|
90
|
+
// status type: 'REQUEST' | 'ACCOUNT' | 'SUCCESS' | 'ERROR'
|
|
91
|
+
// you can use result when status is 'SUCCESS'
|
|
92
|
+
setResult(result as SignatureResultType);
|
|
85
93
|
}
|
|
86
94
|
}}
|
|
87
|
-
size={200}
|
|
88
|
-
processingMark={{
|
|
89
|
-
type: 'NONE',
|
|
90
|
-
}}
|
|
91
95
|
/>
|
|
96
|
+
<div>
|
|
97
|
+
)
|
|
98
|
+
}
|
|
99
|
+
```
|
|
92
100
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
101
|
+
<br />
|
|
102
|
+
|
|
103
|
+
### 3. SendTransactionQR
|
|
104
|
+
|
|
105
|
+
```ts
|
|
106
|
+
import { SendTransactionQR } from 'zigap-utils';
|
|
107
|
+
import type { SendTransactionResultType } from 'zigap-utils/SendTransactionQR/SendTransactionQR.types'
|
|
108
|
+
|
|
109
|
+
const App = () => {
|
|
110
|
+
const [result, setResult] = useState<SendTransactionResultType | null>(null);
|
|
111
|
+
|
|
112
|
+
...
|
|
113
|
+
|
|
114
|
+
return (
|
|
115
|
+
<div>
|
|
116
|
+
<SendTransactionQR
|
|
117
|
+
dapp='your Dapp Name'
|
|
118
|
+
url='http://sample.yours.com'
|
|
119
|
+
availableNetworks={'v2xphere'} // It is string not array
|
|
120
|
+
isShowLogo={false}
|
|
121
|
+
logoSize={25}
|
|
122
|
+
validSeconds={600}
|
|
123
|
+
sigMessage="hello world"
|
|
124
|
+
expire={{ type: 'EXTEND', seconds: 3600 }}
|
|
125
|
+
icon="http://sample.icon-url.com"
|
|
126
|
+
transaction={{
|
|
127
|
+
type: 0,
|
|
128
|
+
to: '0x1234567890123456789012345678901234567890',
|
|
129
|
+
value: '1000000000000000000',
|
|
130
|
+
gasLimit: '21000',
|
|
131
|
+
gasPrice: '1000000000',
|
|
132
|
+
}}
|
|
133
|
+
onReceive={({ status, result }) => {
|
|
134
|
+
if(status === 'SUCCESS') {
|
|
135
|
+
// status type: 'REQUEST' | 'ACCOUNT' | 'SUCCESS' | 'ERROR'
|
|
136
|
+
// you can use result when status is 'SUCCESS'
|
|
137
|
+
setResult(result as SendTransactionResultType);
|
|
138
|
+
}
|
|
139
|
+
}}
|
|
140
|
+
/>
|
|
141
|
+
<div>
|
|
97
142
|
)
|
|
98
143
|
}
|
|
99
144
|
```
|
|
100
145
|
|
|
101
146
|
<br />
|
|
102
147
|
|
|
103
|
-
|
|
148
|
+
### 4. useZigap Hook
|
|
149
|
+
|
|
150
|
+
useZigap is a hook that fetches the information of the logged-in user in the zigap app and provides a logout function.
|
|
151
|
+
|
|
152
|
+
```ts
|
|
153
|
+
import { useZigap } from 'zigap-utils';
|
|
154
|
+
|
|
155
|
+
const Component = () => {
|
|
156
|
+
const { userInfo, logout, isWindowLoaded } = useZigap();
|
|
157
|
+
|
|
158
|
+
const handleLogout = () => {
|
|
159
|
+
if(isWindowLoaded) {
|
|
160
|
+
logout();
|
|
161
|
+
window.location.reload();
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
return (
|
|
166
|
+
<div>
|
|
167
|
+
<p>Address: {userInfo.address}</p>
|
|
168
|
+
<p>Network: {userInfo.network}</p>
|
|
169
|
+
<p>Nickname: {userInfo.nickName}</p>
|
|
170
|
+
<p>Token: {userInfo.token}</p>
|
|
171
|
+
<p>Issued DateTime: {userInfo.issuedDateTime}</p>
|
|
172
|
+
<p>Expire DateTime: {userInfo.expireDateTime}</p>
|
|
173
|
+
|
|
174
|
+
<button onClick={handleLogout}> LOGOUT </button>
|
|
175
|
+
</div>
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
<br />
|
|
104
181
|
|
|
105
182
|
---
|
|
106
183
|
|
|
@@ -112,9 +189,9 @@ const App = () => {
|
|
|
112
189
|
| --- | --- | --- |
|
|
113
190
|
| `dapp` | string | Name of the dapp to use |
|
|
114
191
|
| `url` | string | The url of dapp to connect |
|
|
115
|
-
| `availableNetworks` | string[] |
|
|
192
|
+
| `availableNetworks` | string[] | 'binance' \| 'ethereum' \| 'v2xphere' \| 'v3xphere' |
|
|
116
193
|
| `sigMessage` | string | Messages signed to verify the identity of the user |
|
|
117
|
-
| `validSeconds` | number | QR code valid time(
|
|
194
|
+
| `validSeconds` | number | QR code valid time(seconds) |
|
|
118
195
|
| `onReceive` | (res) => void | Function called after login request |
|
|
119
196
|
| `expire` | {type: "NONE / FIX / EXTEND", seconds: number} | time and type for user login to expire |
|
|
120
197
|
| `icon` | string | Your dapp icon url to be displayed on zigap app |
|
|
@@ -122,66 +199,48 @@ const App = () => {
|
|
|
122
199
|
|
|
123
200
|
<br>
|
|
124
201
|
|
|
125
|
-
### `
|
|
126
|
-
|
|
127
|
-
| prop
|
|
128
|
-
|
|
|
129
|
-
| `dapp`
|
|
130
|
-
| `url`
|
|
131
|
-
| `
|
|
132
|
-
| `
|
|
133
|
-
| `
|
|
134
|
-
| `
|
|
135
|
-
| `
|
|
136
|
-
| `
|
|
137
|
-
| `
|
|
138
|
-
| `isShowLogo` | false | `boolean` | false | Zigap logo in the middle of the QR code |
|
|
139
|
-
| `logoSize` | false | `number` | 30 | logo width & height |
|
|
202
|
+
### `SignatureQR` props
|
|
203
|
+
|
|
204
|
+
| prop | type | description |
|
|
205
|
+
| --- | --- | --- |
|
|
206
|
+
| `dapp` | string | Name of the dapp to use |
|
|
207
|
+
| `url` | string | The url of dapp to connect |
|
|
208
|
+
| `availableNetworks` | string[] | 'binance' \| 'ethereum' \| 'v2xphere' \| 'v3xphere' |
|
|
209
|
+
| `sigMessage` | string | Messages signed to verify the identity of the user |
|
|
210
|
+
| `validSeconds` | number | QR code valid time(seconds) |
|
|
211
|
+
| `onReceive` | (res) => void | Function called after signature request |
|
|
212
|
+
| `expire` | {type: "NONE / FIX / EXTEND", seconds: number} | time and type for signature to expire |
|
|
213
|
+
| `icon` | string | Your dapp icon url to be displayed on zigap app |
|
|
214
|
+
| `processingMark` | {type: "DEFAULT" / "CUSTOM" / "NONE", component: React.ReactNode} | How to show the QR image when it's being processed |
|
|
140
215
|
|
|
141
216
|
<br>
|
|
142
217
|
|
|
143
|
-
### `
|
|
218
|
+
### `SendTransactionQR` props
|
|
144
219
|
|
|
145
|
-
| prop
|
|
146
|
-
|
|
|
147
|
-
| `
|
|
148
|
-
| `
|
|
149
|
-
| `
|
|
150
|
-
| `
|
|
151
|
-
| `
|
|
152
|
-
| `
|
|
220
|
+
| prop | type | description |
|
|
221
|
+
| --- | --- | --- |
|
|
222
|
+
| `dapp` | string | Name of the dapp to use |
|
|
223
|
+
| `url` | string | The url of dapp to connect |
|
|
224
|
+
| `availableNetworks` | string | 'binance' \| 'ethereum' \| 'v2xphere' \| 'v3xphere' |
|
|
225
|
+
| `validSeconds` | number | QR code valid time(seconds) |
|
|
226
|
+
| `onReceive` | (res) => void | Function called after transaction request |
|
|
227
|
+
| `expire` | {type: "NONE / FIX / EXTEND", seconds: number} | time and type for transaction to expire |
|
|
228
|
+
| `icon` | string | Your dapp icon url to be displayed on zigap app |
|
|
229
|
+
| `transaction` | object | Transaction details (type, to, value, gasLimit, gasPrice) |
|
|
230
|
+
| `processingMark` | {type: "DEFAULT" / "CUSTOM" / "NONE", component: React.ReactNode} | How to show the QR image when it's being processed |
|
|
153
231
|
|
|
154
232
|
<br>
|
|
155
233
|
|
|
156
|
-
### `PaymentQR` props
|
|
157
|
-
|
|
158
|
-
| Prop | Required | Type | Description |
|
|
159
|
-
| --- | --- | --- | --- |
|
|
160
|
-
| `network` | true | `string` | The name of the network to use (e.g., "xphere"). |
|
|
161
|
-
| `dapp` | true | `string` | The name of the DApp initiating the payment request. |
|
|
162
|
-
| `address` | true | `string` | The recipient's address for the payment. |
|
|
163
|
-
| `amount` | true | `string` | The amount to be paid. |
|
|
164
|
-
| `description` | false | `string` | A brief description of the payment. |
|
|
165
|
-
| `info` | false | `object` | Additional information related to the payment. |
|
|
166
|
-
| `validSeconds` | true | `number` | The duration (in seconds) for which the QR code is valid. |
|
|
167
|
-
| `isShowLogo` | false | `boolean` | Whether to display your DApp’s logo in the QR code. |
|
|
168
|
-
| `logoSize` | false | `number` | The size of the logo displayed in the QR code (in pixels). |
|
|
169
|
-
| `size` | true | `number` | The size of the generated QR code (in pixels). |
|
|
170
|
-
| `onReceive` | true | `(res : { status: string }) => void` | Callback function that handles payment status updates. |
|
|
171
|
-
| `processingMark` | false | `type: DEFAULT or CUSTOM or NONE` | Configures the appearance of the QR code while processing. |
|
|
172
|
-
|
|
173
|
-
#### Payment Statuses
|
|
174
|
-
|
|
175
234
|
The `onReceive` callback provides the following statuses:
|
|
176
235
|
|
|
177
|
-
- `SUCCESS` :
|
|
178
|
-
- `REQUEST` :
|
|
236
|
+
- `SUCCESS` : process was successful.
|
|
237
|
+
- `REQUEST` : process has been requested and is in progress.
|
|
179
238
|
- `ACCOUNT` : Account selection or preparation is in progress.
|
|
180
239
|
- `ERROR` : An error occurred during payment.
|
|
181
240
|
|
|
182
241
|
#### Processing Mark Options
|
|
183
242
|
|
|
184
|
-
- `DEFAULT` : Displays a default "processing..." message during
|
|
243
|
+
- `DEFAULT` : Displays a default "processing..." message during process.
|
|
185
244
|
- `CUSTOM` : Allows you to pass a custom React component to display during processing.
|
|
186
245
|
- `NONE` : No visual indicator is shown during processing.
|
|
187
246
|
|
|
@@ -190,7 +249,7 @@ The `onReceive` callback provides the following statuses:
|
|
|
190
249
|
To use a custom component:
|
|
191
250
|
|
|
192
251
|
```js
|
|
193
|
-
|
|
252
|
+
<SendTransactionQR
|
|
194
253
|
...
|
|
195
254
|
processingMark={{
|
|
196
255
|
type: 'CUSTOM',
|
|
@@ -201,42 +260,17 @@ To use a custom component:
|
|
|
201
260
|
|
|
202
261
|
<br>
|
|
203
262
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
---
|
|
207
|
-
|
|
208
|
-
<br>
|
|
209
|
-
|
|
210
|
-
### `useZigap`
|
|
211
|
-
|
|
212
|
-
useZigap is a hook that fetches the information of the logged-in user in the zigap app and provides a logout function.
|
|
213
|
-
|
|
214
|
-
```ts
|
|
215
|
-
import { useZigap } from 'zigap-utils';
|
|
216
|
-
|
|
217
|
-
...
|
|
218
|
-
|
|
219
|
-
const Component = () => {
|
|
220
|
-
const { userInfo, logout, isWindowLoaded } = useZigap();
|
|
263
|
+
### `CommonStyle` props (optional)
|
|
221
264
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
265
|
+
| prop | type | default value | description |
|
|
266
|
+
| ------------ | ------------- | ------------- | --------------------------------------- |
|
|
267
|
+
| `size` | number | 128 | canvas width |
|
|
268
|
+
| `bgColor` | string | #fff | background color |
|
|
269
|
+
| `fgColor` | string | #000 | foreground color |
|
|
270
|
+
| `style` | CSSProperties | | custom css style |
|
|
271
|
+
| `isShowLogo` | boolean | false | Zigap logo in the middle of the QR code |
|
|
272
|
+
| `logoSize` | number | 30 | logo width & height |
|
|
228
273
|
|
|
229
|
-
|
|
230
|
-
<div>
|
|
231
|
-
<p>Address: {userInfo.address}</p>
|
|
232
|
-
<p>Network: {userInfo.network}</p>
|
|
233
|
-
<p>Nickname: {userInfo.nickName}</p>
|
|
234
|
-
<p>Token: {userInfo.token}</p>
|
|
235
|
-
<p>Issued DateTime: {userInfo.issuedDateTime}</p>
|
|
236
|
-
<p>Expire DateTime: {userInfo.expireDateTime}</p>
|
|
274
|
+
## License
|
|
237
275
|
|
|
238
|
-
|
|
239
|
-
</div>
|
|
240
|
-
);
|
|
241
|
-
}
|
|
242
|
-
```
|
|
276
|
+
ISC
|
|
@@ -33,6 +33,7 @@ export type LoginResultType = {
|
|
|
33
33
|
token: string;
|
|
34
34
|
issuedDateTime: string;
|
|
35
35
|
expire: LoginExpireType;
|
|
36
|
+
isVerified: boolean;
|
|
36
37
|
};
|
|
37
38
|
export type ProcessingMarkType = {
|
|
38
39
|
type: 'DEFAULT';
|
|
@@ -50,6 +51,7 @@ export type LoginQRProps = {
|
|
|
50
51
|
validSeconds: number;
|
|
51
52
|
onReceive?: (res: {
|
|
52
53
|
status: 'REQUEST' | 'ACCOUNT' | 'SUCCESS' | 'ERROR';
|
|
54
|
+
result?: LoginResultType;
|
|
53
55
|
}) => void;
|
|
54
56
|
expire: LoginExpireType;
|
|
55
57
|
icon?: string;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { SendTransactionQRProps } from './SendTransactionQR.types';
|
|
2
|
+
|
|
3
|
+
declare const SendTransactionQR: ({ availableNetworks, dapp, url, onReceive, validSeconds, isShowLogo, logoSize, size, icon, transaction, processingMark, ...props }: SendTransactionQRProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export default SendTransactionQR;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { CommonStyleType, ProcessingMarkType } from 'src/components/LoginQR/LoginQR.types';
|
|
2
|
+
|
|
3
|
+
/** Type 0: Legacy (pre-EIP-2718) */
|
|
4
|
+
export type TransactionType0 = {
|
|
5
|
+
type: 0 | '0x0';
|
|
6
|
+
to: string;
|
|
7
|
+
data?: string;
|
|
8
|
+
value: string;
|
|
9
|
+
gasLimit: string;
|
|
10
|
+
gasPrice: string;
|
|
11
|
+
chainId?: number;
|
|
12
|
+
};
|
|
13
|
+
/** Type 1: EIP-2930 (access list) */
|
|
14
|
+
export type TransactionType1 = {
|
|
15
|
+
type: 1 | '0x1';
|
|
16
|
+
to: string;
|
|
17
|
+
data?: string;
|
|
18
|
+
value: string;
|
|
19
|
+
gasLimit: string;
|
|
20
|
+
gasPrice: string;
|
|
21
|
+
accessList?: AccessList;
|
|
22
|
+
chainId?: number;
|
|
23
|
+
};
|
|
24
|
+
/** Type 2: EIP-1559 (dynamic fees) */
|
|
25
|
+
export type TransactionType2 = {
|
|
26
|
+
type: 2 | '0x2';
|
|
27
|
+
to: string;
|
|
28
|
+
data?: string;
|
|
29
|
+
value: string;
|
|
30
|
+
gasLimit: string;
|
|
31
|
+
maxFeePerGas: string;
|
|
32
|
+
maxPriorityFeePerGas: string;
|
|
33
|
+
chainId?: number;
|
|
34
|
+
};
|
|
35
|
+
/** AccessList entry type (used in EIP-2930 and EIP-1559) */
|
|
36
|
+
export type AccessList = {
|
|
37
|
+
address: string;
|
|
38
|
+
storageKeys: string[];
|
|
39
|
+
}[];
|
|
40
|
+
export type TransactionType = TransactionType0 | TransactionType1 | TransactionType2;
|
|
41
|
+
export type SendTransactionResultType = {
|
|
42
|
+
txHash: string;
|
|
43
|
+
status: string;
|
|
44
|
+
error: string;
|
|
45
|
+
};
|
|
46
|
+
export type SendTransactionQRProps = {
|
|
47
|
+
availableNetworks: 'binance' | 'ethereum' | 'v2xphere' | 'v3xphere';
|
|
48
|
+
dapp: string;
|
|
49
|
+
url: string;
|
|
50
|
+
validSeconds: number;
|
|
51
|
+
transaction: TransactionType;
|
|
52
|
+
icon?: string;
|
|
53
|
+
onReceive?: (res: {
|
|
54
|
+
status: 'REQUEST' | 'ACCOUNT' | 'SUCCESS' | 'ERROR';
|
|
55
|
+
result?: SendTransactionResultType;
|
|
56
|
+
}) => void;
|
|
57
|
+
processingMark?: ProcessingMarkType;
|
|
58
|
+
} & CommonStyleType;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { SignatureQRProps } from './SignatureQR.types';
|
|
2
|
+
|
|
3
|
+
declare const SignatureQR: ({ availableNetworks, dapp, url, sigMessage, onReceive, validSeconds, isShowLogo, logoSize, expire, icon, size, processingMark, ...props }: SignatureQRProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export default SignatureQR;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
|
|
3
|
+
export type SignatureCommonStyleType = {
|
|
4
|
+
size?: number;
|
|
5
|
+
bgColor?: string;
|
|
6
|
+
fgColor?: string;
|
|
7
|
+
style?: CSSProperties;
|
|
8
|
+
isShowLogo?: boolean;
|
|
9
|
+
logoSize?: number;
|
|
10
|
+
};
|
|
11
|
+
export type SignaturePayloadType = {
|
|
12
|
+
publicKey: string;
|
|
13
|
+
message: string;
|
|
14
|
+
};
|
|
15
|
+
export type SignatureAccountType = {
|
|
16
|
+
address: string;
|
|
17
|
+
network: string;
|
|
18
|
+
nickName: string;
|
|
19
|
+
};
|
|
20
|
+
export type SignatureNoneLoginExpire = {
|
|
21
|
+
type: 'NONE';
|
|
22
|
+
seconds?: never;
|
|
23
|
+
};
|
|
24
|
+
export type SignatureFixedOrExtensionLoginExpire = {
|
|
25
|
+
type: 'FIX' | 'EXTEND';
|
|
26
|
+
seconds: number;
|
|
27
|
+
};
|
|
28
|
+
export type SignatureLoginExpireType = SignatureFixedOrExtensionLoginExpire | SignatureNoneLoginExpire;
|
|
29
|
+
export type SignatureResultType = {
|
|
30
|
+
address: string;
|
|
31
|
+
network: string;
|
|
32
|
+
nickName: string;
|
|
33
|
+
token: string;
|
|
34
|
+
issuedDateTime: string;
|
|
35
|
+
expire: SignatureLoginExpireType;
|
|
36
|
+
isVerified: boolean;
|
|
37
|
+
};
|
|
38
|
+
export type SignatureProcessingMarkType = {
|
|
39
|
+
type: 'DEFAULT';
|
|
40
|
+
} | {
|
|
41
|
+
type: 'CUSTOM';
|
|
42
|
+
component: React.ReactNode;
|
|
43
|
+
} | {
|
|
44
|
+
type: 'NONE';
|
|
45
|
+
};
|
|
46
|
+
export type SignatureQRProps = {
|
|
47
|
+
availableNetworks: string[];
|
|
48
|
+
dapp: string;
|
|
49
|
+
url: string;
|
|
50
|
+
sigMessage: string;
|
|
51
|
+
validSeconds: number;
|
|
52
|
+
onReceive?: (res: {
|
|
53
|
+
status: 'REQUEST' | 'ACCOUNT' | 'SUCCESS' | 'ERROR';
|
|
54
|
+
result?: SignatureResultType;
|
|
55
|
+
}) => void;
|
|
56
|
+
expire: SignatureLoginExpireType;
|
|
57
|
+
icon?: string;
|
|
58
|
+
processingMark?: SignatureProcessingMarkType;
|
|
59
|
+
} & SignatureCommonStyleType;
|