zigap-utils 2.0.3 → 2.0.4
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 +320 -188
- package/dist/components/LoginQR/LoginQR.types.d.ts +1 -1
- package/dist/components/SendTransactionQR/SendTransactionQR.types.d.ts +1 -1
- package/dist/components/SignatureQR/SignatureQR.types.d.ts +1 -1
- package/dist/index.es.js +834 -834
- package/dist/utils/payment.d.ts +10 -4
- package/dist/utils/sendTransaction.d.ts +2 -2
- package/dist/utils/types.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,276 +1,408 @@
|
|
|
1
1
|
# zigap-utils
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<div align="center">
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
<br />
|
|
5
|
+
  
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
**A utility library that helps communicate between dapp and zigap**
|
|
9
8
|
|
|
9
|
+
[📖 Documentation](https://seoul-labs.gitbook.io/zigap-utils) • [🚀 Installation](#installation) • [💡 Usage](#usage)
|
|
10
|
+
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## 📦 Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install zigap-utils
|
|
10
19
|
```
|
|
11
|
-
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
yarn add zigap-utils
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pnpm add zigap-utils
|
|
12
27
|
```
|
|
13
28
|
|
|
14
|
-
|
|
15
|
-
<br />
|
|
29
|
+
---
|
|
16
30
|
|
|
17
|
-
## Usage
|
|
31
|
+
## 🚀 Usage
|
|
18
32
|
|
|
19
|
-
|
|
20
|
-
>
|
|
21
|
-
> 1. <b>Login</b>
|
|
22
|
-
> 2. <b>Signature</b>
|
|
23
|
-
> 3. <b>SendTransaction</b>
|
|
24
|
-
> 4. <b>useZigap Hook</b>
|
|
33
|
+
zigap-utils provides React components for seamless communication between dapp and zigap app.
|
|
25
34
|
|
|
26
|
-
###
|
|
35
|
+
### 📋 Table of Contents
|
|
27
36
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
37
|
+
- [🔐 LoginQR](#-loginqr)
|
|
38
|
+
- [✍️ SignatureQR](#️-signatureqr)
|
|
39
|
+
- [💸 SendTransactionQR](#-sendtransactionqr)
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## 🔐 LoginQR
|
|
44
|
+
|
|
45
|
+
QR code component for user wallet login.
|
|
46
|
+
|
|
47
|
+
### Basic Usage
|
|
48
|
+
|
|
49
|
+
```tsx
|
|
50
|
+
import { LoginQR, LoginResultType } from 'zigap-utils';
|
|
31
51
|
|
|
32
52
|
const App = () => {
|
|
33
53
|
const [result, setResult] = useState<LoginResultType | null>(null);
|
|
34
|
-
...
|
|
35
54
|
|
|
36
55
|
return (
|
|
37
56
|
<div>
|
|
38
57
|
<LoginQR
|
|
39
|
-
dapp='
|
|
40
|
-
url='
|
|
41
|
-
availableNetworks={['v2xphere, v3xphere']}
|
|
42
|
-
|
|
43
|
-
logoSize={25}
|
|
58
|
+
dapp='My Awesome Dapp'
|
|
59
|
+
url='https://myapp.com'
|
|
60
|
+
availableNetworks={['v2xphere', 'v3xphere']}
|
|
61
|
+
sigMessage='Welcome to My Dapp!'
|
|
44
62
|
validSeconds={600}
|
|
45
|
-
sigMessage="hello world"
|
|
46
|
-
expire={{ type: 'EXTEND', seconds: 3600 }}
|
|
47
|
-
icon="http://sample.icon-url.com"
|
|
48
63
|
onReceive={({ status, result }) => {
|
|
49
|
-
if(status === 'SUCCESS') {
|
|
50
|
-
|
|
51
|
-
// status type: 'REQUEST' | 'ACCOUNT' | 'SUCCESS' | 'ERROR'
|
|
52
|
-
// you can use result when status is 'SUCCESS'
|
|
64
|
+
if (status === 'SUCCESS') {
|
|
65
|
+
console.log('Login successful!', result);
|
|
53
66
|
setResult(result as LoginResultType);
|
|
54
67
|
}
|
|
55
68
|
}}
|
|
56
69
|
/>
|
|
57
70
|
</div>
|
|
58
71
|
);
|
|
72
|
+
};
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Props
|
|
76
|
+
|
|
77
|
+
| Prop | Type | Required | Default | Description |
|
|
78
|
+
| --- | --- | --- | --- | --- |
|
|
79
|
+
| `dapp` | `string` | ✅ | - | dapp name |
|
|
80
|
+
| `url` | `string` | ✅ | - | dapp URL |
|
|
81
|
+
| `availableNetworks` | `('binance' \| 'ethereum' \| 'v2xphere' \| 'v3xphere')[]` | ✅ | - | supported networks |
|
|
82
|
+
| `sigMessage` | `string` | ✅ | - | signature message |
|
|
83
|
+
| `validSeconds` | `number` | ✅ | - | QR code valid time |
|
|
84
|
+
| `onReceive` | `(res) => void` | ❌ | - | login result callback |
|
|
85
|
+
| `expire` | `LoginExpireType` | ❌ | `{ type : 'NONE'}` | expiration settings |
|
|
86
|
+
| `icon` | `string` | ❌ | - | dapp icon URL |
|
|
87
|
+
| `processingMark` | `ProcessingMarkType` | ❌ | `{ type: 'DEFAULT' }` | processing display |
|
|
88
|
+
| `qrDomain` | `string` | ❌ | `https://zigap.io` | QR domain |
|
|
89
|
+
|
|
90
|
+
### Supported Networks
|
|
91
|
+
|
|
92
|
+
- `'binance'` (bsc)
|
|
93
|
+
- `'ethereum'` (eth)
|
|
94
|
+
- `'v2xphere'` (xp)
|
|
95
|
+
- `'v3xphere'` (xpt)
|
|
96
|
+
|
|
97
|
+
### Status Values
|
|
98
|
+
|
|
99
|
+
- `'SUCCESS'` - Login successful
|
|
100
|
+
- `'REQUEST'` - Request in progress
|
|
101
|
+
- `'ACCOUNT'` - Account selection in progress
|
|
102
|
+
- `'ERROR'` - Error occurred
|
|
103
|
+
|
|
104
|
+
### LoginResultType
|
|
105
|
+
|
|
106
|
+
```tsx
|
|
107
|
+
interface LoginResultType {
|
|
108
|
+
address: string;
|
|
109
|
+
network: string;
|
|
110
|
+
nickName: string;
|
|
111
|
+
token: string;
|
|
112
|
+
issuedDateTime: string;
|
|
113
|
+
expire: LoginExpireType;
|
|
114
|
+
isVerified: boolean;
|
|
59
115
|
}
|
|
60
116
|
```
|
|
61
117
|
|
|
62
|
-
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## ✍️ SignatureQR
|
|
121
|
+
|
|
122
|
+
QR code component for message signing.
|
|
63
123
|
|
|
64
|
-
###
|
|
124
|
+
### Basic Usage
|
|
65
125
|
|
|
66
|
-
```
|
|
67
|
-
import { SignatureQR } from 'zigap-utils';
|
|
68
|
-
import type { SignatureResultType } from 'zigap-utils/SignatureQR/SignatureQR.types'
|
|
126
|
+
```tsx
|
|
127
|
+
import { SignatureQR, SignatureResultType } from 'zigap-utils';
|
|
69
128
|
|
|
70
129
|
const App = () => {
|
|
71
130
|
const [result, setResult] = useState<SignatureResultType | null>(null);
|
|
72
131
|
|
|
73
|
-
...
|
|
74
|
-
|
|
75
132
|
return (
|
|
76
133
|
<div>
|
|
77
134
|
<SignatureQR
|
|
78
|
-
dapp='
|
|
79
|
-
url='
|
|
80
|
-
availableNetworks={['v2xphere, v3xphere']}
|
|
81
|
-
|
|
82
|
-
logoSize={25}
|
|
135
|
+
dapp='My Awesome Dapp'
|
|
136
|
+
url='https://myapp.com'
|
|
137
|
+
availableNetworks={['v2xphere', 'v3xphere']}
|
|
138
|
+
sigMessage='I agree to the terms and conditions'
|
|
83
139
|
validSeconds={600}
|
|
84
|
-
sigMessage="hello world"
|
|
85
|
-
expire={{ type: 'EXTEND', seconds: 3600 }}
|
|
86
|
-
icon="http://sample.icon-url.com"
|
|
87
140
|
onReceive={({ status, result }) => {
|
|
88
|
-
if(status === 'SUCCESS') {
|
|
89
|
-
|
|
90
|
-
// status type: 'REQUEST' | 'ACCOUNT' | 'SUCCESS' | 'ERROR'
|
|
91
|
-
// you can use result when status is 'SUCCESS'
|
|
141
|
+
if (status === 'SUCCESS') {
|
|
142
|
+
console.log('Signature successful!', result);
|
|
92
143
|
setResult(result as SignatureResultType);
|
|
93
144
|
}
|
|
94
145
|
}}
|
|
95
146
|
/>
|
|
96
|
-
|
|
97
|
-
)
|
|
147
|
+
</div>
|
|
148
|
+
);
|
|
149
|
+
};
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### Props
|
|
153
|
+
|
|
154
|
+
| Prop | Type | Required | Default | Description |
|
|
155
|
+
| --- | --- | --- | --- | --- |
|
|
156
|
+
| `dapp` | `string` | ✅ | - | dapp name |
|
|
157
|
+
| `url` | `string` | ✅ | - | dapp URL |
|
|
158
|
+
| `availableNetworks` | `('binance' \| 'ethereum' \| 'v2xphere' \| 'v3xphere')[]` | ✅ | - | supported networks |
|
|
159
|
+
| `sigMessage` | `string` | ✅ | - | message to sign |
|
|
160
|
+
| `validSeconds` | `number` | ✅ | - | QR code valid time |
|
|
161
|
+
| `onReceive` | `(res) => void` | ❌ | - | signature result callback |
|
|
162
|
+
| `expire` | `SignatureLoginExpireType` | ❌ | `{ type : 'NONE'}` | expiration settings |
|
|
163
|
+
| `icon` | `string` | ❌ | - | dapp icon URL |
|
|
164
|
+
| `processingMark` | `SignatureProcessingMarkType` | ❌ | `{ type: 'DEFAULT' }` | processing display |
|
|
165
|
+
| `qrDomain` | `string` | ❌ | `https://zigap.io` | QR domain |
|
|
166
|
+
|
|
167
|
+
### Supported Networks
|
|
168
|
+
|
|
169
|
+
- `'binance'` (bsc)
|
|
170
|
+
- `'ethereum'` (eth)
|
|
171
|
+
- `'v2xphere'` (xp)
|
|
172
|
+
- `'v3xphere'` (xpt)
|
|
173
|
+
|
|
174
|
+
### Status Values
|
|
175
|
+
|
|
176
|
+
- `'SUCCESS'` - Signature successful
|
|
177
|
+
- `'REQUEST'` - Request in progress
|
|
178
|
+
- `'ACCOUNT'` - Account selection in progress
|
|
179
|
+
- `'ERROR'` - Error occurred
|
|
180
|
+
|
|
181
|
+
### SignatureResultType
|
|
182
|
+
|
|
183
|
+
```tsx
|
|
184
|
+
interface SignatureResultType {
|
|
185
|
+
address: string;
|
|
186
|
+
network: string;
|
|
187
|
+
nickName: string;
|
|
188
|
+
token: string;
|
|
189
|
+
issuedDateTime: string;
|
|
190
|
+
expire: SignatureLoginExpireType;
|
|
191
|
+
isVerified: boolean;
|
|
98
192
|
}
|
|
99
193
|
```
|
|
100
194
|
|
|
101
|
-
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## 💸 SendTransactionQR
|
|
102
198
|
|
|
103
|
-
|
|
199
|
+
QR code component for transaction sending.
|
|
104
200
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
201
|
+
### Basic Usage
|
|
202
|
+
|
|
203
|
+
```tsx
|
|
204
|
+
import { SendTransactionQR, SendTransactionResultType } from 'zigap-utils';
|
|
108
205
|
|
|
109
206
|
const App = () => {
|
|
110
207
|
const [result, setResult] = useState<SendTransactionResultType | null>(null);
|
|
111
208
|
|
|
112
|
-
...
|
|
113
|
-
|
|
114
209
|
return (
|
|
115
210
|
<div>
|
|
116
211
|
<SendTransactionQR
|
|
117
|
-
dapp='
|
|
118
|
-
url='
|
|
119
|
-
availableNetworks=
|
|
120
|
-
isShowLogo={false}
|
|
121
|
-
logoSize={25}
|
|
212
|
+
dapp='My Awesome Dapp'
|
|
213
|
+
url='https://myapp.com'
|
|
214
|
+
availableNetworks='v2xphere'
|
|
122
215
|
validSeconds={600}
|
|
123
|
-
sigMessage="hello world"
|
|
124
|
-
expire={{ type: 'EXTEND', seconds: 3600 }}
|
|
125
|
-
icon="http://sample.icon-url.com"
|
|
126
216
|
transaction={{
|
|
127
217
|
type: 0,
|
|
128
218
|
to: '0x1234567890123456789012345678901234567890',
|
|
129
|
-
value: '1000000000000000000',
|
|
219
|
+
value: '1000000000000000000', // 1 ETH
|
|
130
220
|
gasLimit: '21000',
|
|
131
221
|
gasPrice: '1000000000',
|
|
132
222
|
}}
|
|
133
223
|
onReceive={({ status, result }) => {
|
|
134
|
-
if(status === 'SUCCESS') {
|
|
135
|
-
|
|
136
|
-
// you can use result when status is 'SUCCESS'
|
|
224
|
+
if (status === 'SUCCESS') {
|
|
225
|
+
console.log('Transaction Complete!', result);
|
|
137
226
|
setResult(result as SendTransactionResultType);
|
|
138
227
|
}
|
|
139
228
|
}}
|
|
140
229
|
/>
|
|
141
|
-
|
|
142
|
-
)
|
|
143
|
-
}
|
|
230
|
+
</div>
|
|
231
|
+
);
|
|
232
|
+
};
|
|
144
233
|
```
|
|
145
234
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
235
|
+
### Props
|
|
236
|
+
|
|
237
|
+
| Prop | Type | Required | Default | Description |
|
|
238
|
+
| --- | --- | --- | --- | --- |
|
|
239
|
+
| `dapp` | `string` | ✅ | - | dapp name |
|
|
240
|
+
| `url` | `string` | ✅ | - | dapp URL |
|
|
241
|
+
| `availableNetworks` | `'binance' \| 'ethereum' \| 'v2xphere' \| 'v3xphere'` | ✅ | - | supported network (single value) |
|
|
242
|
+
| `validSeconds` | `number` | ✅ | - | QR code valid time |
|
|
243
|
+
| `transaction` | `TransactionType` | ✅ | - | transaction configuration |
|
|
244
|
+
| `onReceive` | `(res) => void` | ❌ | - | transaction result callback |
|
|
245
|
+
| `icon` | `string` | ❌ | - | dapp icon URL |
|
|
246
|
+
| `processingMark` | `ProcessingMarkType` | ❌ | `{ type: 'DEFAULT' }` | processing display |
|
|
247
|
+
| `qrDomain` | `string` | ❌ | `https://zigap.io` | QR domain |
|
|
248
|
+
|
|
249
|
+
### Supported Networks
|
|
250
|
+
|
|
251
|
+
- `'binance'` (bsc)
|
|
252
|
+
- `'ethereum'` (eth)
|
|
253
|
+
- `'v2xphere'` (xp)
|
|
254
|
+
- `'v3xphere'` (xpt)
|
|
255
|
+
|
|
256
|
+
### TransactionType
|
|
257
|
+
|
|
258
|
+
```tsx
|
|
259
|
+
// Type 0: Legacy (pre-EIP-2718)
|
|
260
|
+
interface TransactionType0 {
|
|
261
|
+
type: 0 | '0x0';
|
|
262
|
+
to: string;
|
|
263
|
+
data?: string;
|
|
264
|
+
value: string;
|
|
265
|
+
gasLimit: string;
|
|
266
|
+
gasPrice: string;
|
|
267
|
+
chainId?: number;
|
|
268
|
+
}
|
|
149
269
|
|
|
150
|
-
|
|
270
|
+
// Type 1: EIP-2930 (access list)
|
|
271
|
+
interface TransactionType1 {
|
|
272
|
+
type: 1 | '0x1';
|
|
273
|
+
to: string;
|
|
274
|
+
data?: string;
|
|
275
|
+
value: string;
|
|
276
|
+
gasLimit: string;
|
|
277
|
+
gasPrice: string;
|
|
278
|
+
accessList?: AccessList;
|
|
279
|
+
chainId?: number;
|
|
280
|
+
}
|
|
151
281
|
|
|
152
|
-
|
|
153
|
-
|
|
282
|
+
// Type 2: EIP-1559 (dynamic fees)
|
|
283
|
+
interface TransactionType2 {
|
|
284
|
+
type: 2 | '0x2';
|
|
285
|
+
to: string;
|
|
286
|
+
data?: string;
|
|
287
|
+
value: string;
|
|
288
|
+
gasLimit: string;
|
|
289
|
+
maxFeePerGas: string;
|
|
290
|
+
maxPriorityFeePerGas: string;
|
|
291
|
+
chainId?: number;
|
|
292
|
+
}
|
|
154
293
|
|
|
155
|
-
|
|
156
|
-
|
|
294
|
+
type TransactionType = TransactionType0 | TransactionType1 | TransactionType2;
|
|
295
|
+
```
|
|
157
296
|
|
|
158
|
-
|
|
159
|
-
if(isWindowLoaded) {
|
|
160
|
-
logout();
|
|
161
|
-
window.location.reload();
|
|
162
|
-
}
|
|
163
|
-
}
|
|
297
|
+
### SendTransactionResultType
|
|
164
298
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
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
|
-
);
|
|
299
|
+
```tsx
|
|
300
|
+
interface SendTransactionResultType {
|
|
301
|
+
txHash: string;
|
|
302
|
+
status: 0 | 1; // 0 : fail , 1 : success
|
|
303
|
+
error: string;
|
|
177
304
|
}
|
|
178
305
|
```
|
|
179
306
|
|
|
180
|
-
|
|
307
|
+
### Status Values
|
|
308
|
+
|
|
309
|
+
- `'SUCCESS'` - Transaction successful
|
|
310
|
+
- `'REQUEST'` - Request in progress
|
|
311
|
+
- `'ERROR'` - Error occurred
|
|
181
312
|
|
|
182
313
|
---
|
|
183
314
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
|
189
|
-
|
|
|
190
|
-
| `
|
|
191
|
-
| `
|
|
192
|
-
| `
|
|
193
|
-
| `
|
|
194
|
-
| `
|
|
195
|
-
| `
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
<
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
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 |
|
|
215
|
-
|
|
216
|
-
<br>
|
|
217
|
-
|
|
218
|
-
### `SendTransactionQR` props
|
|
219
|
-
|
|
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 |
|
|
231
|
-
|
|
232
|
-
<br>
|
|
233
|
-
|
|
234
|
-
The `onReceive` callback provides the following statuses:
|
|
235
|
-
|
|
236
|
-
- `SUCCESS` : process was successful.
|
|
237
|
-
- `REQUEST` : process has been requested and is in progress.
|
|
238
|
-
- `ACCOUNT` : Account selection or preparation is in progress.
|
|
239
|
-
- `ERROR` : An error occurred during payment.
|
|
240
|
-
|
|
241
|
-
#### Processing Mark Options
|
|
242
|
-
|
|
243
|
-
- `DEFAULT` : Displays a default "processing..." message during process.
|
|
244
|
-
- `CUSTOM` : Allows you to pass a custom React component to display during processing.
|
|
245
|
-
- `NONE` : No visual indicator is shown during processing.
|
|
246
|
-
|
|
247
|
-
#### Example Usage of processingMark
|
|
248
|
-
|
|
249
|
-
To use a custom component:
|
|
250
|
-
|
|
251
|
-
```js
|
|
252
|
-
<SendTransactionQR
|
|
253
|
-
...
|
|
254
|
-
processingMark={{
|
|
255
|
-
type: 'CUSTOM',
|
|
256
|
-
component: <div>Loading your payment...</div>,
|
|
257
|
-
}}
|
|
258
|
-
/>
|
|
315
|
+
## 🎨 Common Style Props
|
|
316
|
+
|
|
317
|
+
Common style options available for all QR components.
|
|
318
|
+
|
|
319
|
+
| Prop | Type | Default | Description |
|
|
320
|
+
| ------------ | --------------- | ------- | ---------------------------- |
|
|
321
|
+
| `size` | `number` | `128` | QR code canvas size |
|
|
322
|
+
| `bgColor` | `string` | `#fff` | background color |
|
|
323
|
+
| `fgColor` | `string` | `#000` | foreground color |
|
|
324
|
+
| `style` | `CSSProperties` | - | custom CSS style |
|
|
325
|
+
| `isShowLogo` | `boolean` | `false` | show Zigap logo in QR center |
|
|
326
|
+
| `logoSize` | `number` | `30` | logo size |
|
|
327
|
+
|
|
328
|
+
### Example
|
|
329
|
+
|
|
330
|
+
```tsx
|
|
331
|
+
<LoginQR
|
|
332
|
+
// ... other props
|
|
333
|
+
size={200}
|
|
334
|
+
bgColor='#ffffff'
|
|
335
|
+
fgColor='#000000'
|
|
336
|
+
isShowLogo={true}
|
|
337
|
+
logoSize={40}
|
|
338
|
+
style={{ borderRadius: '8px' }}
|
|
339
|
+
/>
|
|
259
340
|
```
|
|
260
341
|
|
|
261
|
-
|
|
342
|
+
---
|
|
343
|
+
|
|
344
|
+
## ⚙️ Processing Mark Options
|
|
345
|
+
|
|
346
|
+
Configure how to display during processing.
|
|
347
|
+
|
|
348
|
+
### Options
|
|
349
|
+
|
|
350
|
+
- `'DEFAULT'` - Shows default "processing..." message
|
|
351
|
+
- `'CUSTOM'` - Allows custom React component
|
|
352
|
+
- `'NONE'` - No visual indicator
|
|
353
|
+
|
|
354
|
+
### Custom Component Example
|
|
355
|
+
|
|
356
|
+
```tsx
|
|
357
|
+
<SendTransactionQR
|
|
358
|
+
// ... other props
|
|
359
|
+
processingMark={{
|
|
360
|
+
type: 'CUSTOM',
|
|
361
|
+
component: (
|
|
362
|
+
<div
|
|
363
|
+
style={{
|
|
364
|
+
display: 'flex',
|
|
365
|
+
alignItems: 'center',
|
|
366
|
+
gap: '8px',
|
|
367
|
+
}}
|
|
368
|
+
>
|
|
369
|
+
<div className='spinner'></div>
|
|
370
|
+
<span>Processing payment...</span>
|
|
371
|
+
</div>
|
|
372
|
+
),
|
|
373
|
+
}}
|
|
374
|
+
/>
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
---
|
|
378
|
+
|
|
379
|
+
## 📝 Expire Configuration
|
|
380
|
+
|
|
381
|
+
Configure expiration time and type.
|
|
382
|
+
|
|
383
|
+
```tsx
|
|
384
|
+
// No expiration
|
|
385
|
+
expire={{ type: 'NONE' }}
|
|
386
|
+
|
|
387
|
+
// Fixed expiration time
|
|
388
|
+
expire={{ type: 'FIX', seconds: 3600 }}
|
|
389
|
+
|
|
390
|
+
// Extendable expiration time
|
|
391
|
+
expire={{ type: 'EXTEND', seconds: 3600 }}
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
---
|
|
395
|
+
|
|
396
|
+
## 📄 License
|
|
397
|
+
|
|
398
|
+
ISC License
|
|
399
|
+
|
|
400
|
+
---
|
|
262
401
|
|
|
263
|
-
|
|
402
|
+
<div align="center">
|
|
264
403
|
|
|
265
|
-
|
|
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 |
|
|
404
|
+
**Made with by Seoul Labs**
|
|
273
405
|
|
|
274
|
-
|
|
406
|
+
[📖 Documentation](https://seoul-labs.gitbook.io/zigap-utils)
|
|
275
407
|
|
|
276
|
-
|
|
408
|
+
</div>
|
|
@@ -40,7 +40,7 @@ export type AccessList = {
|
|
|
40
40
|
export type TransactionType = TransactionType0 | TransactionType1 | TransactionType2;
|
|
41
41
|
export type SendTransactionResultType = {
|
|
42
42
|
txHash: string;
|
|
43
|
-
status:
|
|
43
|
+
status: 0 | 1;
|
|
44
44
|
error: string;
|
|
45
45
|
};
|
|
46
46
|
export type SendTransactionQRProps = {
|
|
@@ -45,7 +45,7 @@ export type SignatureProcessingMarkType = {
|
|
|
45
45
|
};
|
|
46
46
|
export type SignatureQRProps = {
|
|
47
47
|
qrDomain?: string;
|
|
48
|
-
availableNetworks:
|
|
48
|
+
availableNetworks: ('binance' | 'ethereum' | 'v2xphere' | 'v3xphere')[];
|
|
49
49
|
dapp: string;
|
|
50
50
|
url: string;
|
|
51
51
|
sigMessage: string;
|