one-ewallet-otc-ui 0.0.7 → 0.0.9
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 +116 -16
- package/dist/index.es.js +7610 -7457
- package/dist/index.umd.js +52 -52
- package/dist/style.css +1 -1
- package/dist/types/components/OTC/OtcModal.d.ts +7 -2
- package/dist/types/components/OTC/OtcModal.d.ts.map +1 -1
- package/dist/types/components/OTC/Withdraw.d.ts +13 -4
- package/dist/types/components/OTC/Withdraw.d.ts.map +1 -1
- package/dist/types/components/OTC/http.d.ts +1 -1
- package/dist/types/components/OTC/http.d.ts.map +1 -1
- package/dist/types/components/OTC/util.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -82,7 +82,7 @@ function MyComponent() {
|
|
|
82
82
|
baseUrl="/api" // API base URL
|
|
83
83
|
authToken="your-auth-token" // User authentication token
|
|
84
84
|
userAddress="user-sui-address" // User Sui address
|
|
85
|
-
lang="EN" // Language: 'ZH' | 'EN', default is 'EN'
|
|
85
|
+
lang="EN" // Language: 'ZH' | 'EN' | 'VI', default is 'EN'
|
|
86
86
|
>
|
|
87
87
|
<button>Open OTC Trading</button>
|
|
88
88
|
</OtcModal>
|
|
@@ -98,7 +98,12 @@ function MyComponent() {
|
|
|
98
98
|
| `baseUrl` | `string` | ✅ | - | API base URL |
|
|
99
99
|
| `authToken` | `string` | ✅ | - | User authentication token |
|
|
100
100
|
| `userAddress` | `string` | ✅ | - | User Sui wallet address |
|
|
101
|
-
| `lang` | `'ZH' \| 'EN'` | ❌ | `'EN'` | Interface language |
|
|
101
|
+
| `lang` | `'ZH' \| 'EN' \| 'VI'` | ❌ | `'EN'` | Interface language |
|
|
102
|
+
| `channel` | `string` | ❌ | `'RWA'` |Interface channel |
|
|
103
|
+
| `currencyListApi` | `string` | ❌ | `'/ext/ewallet/currencyList'` | Currency list API endpoint path |
|
|
104
|
+
| `getAddressApi` | `string` | ❌ | `'/ext/ewallet/getOtcAddress'` | Get OTC address API endpoint path |
|
|
105
|
+
| `listRecordsApi` | `string` | ❌ | `'/ext/ewallet/list'` | List records API endpoint path |
|
|
106
|
+
| `applyDepositApi` | `string` | ❌ | `'/ext/ewallet/applyDeposit'` | Apply deposit API endpoint path |
|
|
102
107
|
|
|
103
108
|
### 4. Using Withdraw Component
|
|
104
109
|
|
|
@@ -111,7 +116,15 @@ import { useSuiClient } from '@onelabs/dapp-kit'
|
|
|
111
116
|
function MyComponent() {
|
|
112
117
|
const suiClient = useSuiClient()
|
|
113
118
|
|
|
114
|
-
const handleWithdraw = (withdrawData:
|
|
119
|
+
const handleWithdraw = (withdrawData: {
|
|
120
|
+
network: string; // Network/chain name
|
|
121
|
+
currency: string; // Payment token
|
|
122
|
+
address: string; // Withdrawal address
|
|
123
|
+
amount: string; // Withdrawal amount
|
|
124
|
+
areaCode: string; // Area code (for HPAY network)
|
|
125
|
+
toCurrency: string; // Token to receive
|
|
126
|
+
minAmount: number; // Minimum withdrawal amount
|
|
127
|
+
}, callback: () => void) => {
|
|
115
128
|
// Handle withdrawal logic
|
|
116
129
|
console.log('Withdrawal data:', withdrawData)
|
|
117
130
|
// Execute withdrawal operation...
|
|
@@ -125,10 +138,14 @@ function MyComponent() {
|
|
|
125
138
|
authToken="your-auth-token"
|
|
126
139
|
userAddress="user-sui-address"
|
|
127
140
|
suiClient={suiClient}
|
|
128
|
-
|
|
129
|
-
|
|
141
|
+
tokenCoinTypeList={[
|
|
142
|
+
{ name: 'USDH', coinType: '0x72eba41c73c4c2ce2bcfc6ec1dc0896ba1b5c17bfe7ae7c6c779943f84912b41::usdh::USDH', decimals: 9 }
|
|
143
|
+
]}
|
|
130
144
|
onSubmit={handleWithdraw}
|
|
131
145
|
lang="EN"
|
|
146
|
+
currencyListApi="/ext/ewallet/currencyList"
|
|
147
|
+
getWithdrawAddressApi="/ext/ewallet/getWithdrawAddress"
|
|
148
|
+
listRecordsApi="/ext/ewallet/list"
|
|
132
149
|
>
|
|
133
150
|
<button>Open Withdrawal</button>
|
|
134
151
|
</Withdraw>
|
|
@@ -145,10 +162,42 @@ function MyComponent() {
|
|
|
145
162
|
| `authToken` | `string` | ✅ | - | User authentication token |
|
|
146
163
|
| `userAddress` | `string` | ✅ | - | User Sui wallet address |
|
|
147
164
|
| `suiClient` | `ReturnType<typeof useSuiClient>` | ✅ | - | SuiClient instance (obtained via `useSuiClient()` hook) |
|
|
148
|
-
| `
|
|
149
|
-
| `
|
|
150
|
-
| `
|
|
151
|
-
| `
|
|
165
|
+
| `tokenCoinTypeList` | `tokenCoinType[]` | ✅ | - | Token coin type list, each item contains `name`, `coinType`, `decimals` |
|
|
166
|
+
| `onSubmit` | `(withdrawData: WithdrawData, callback: () => void) => void` | ✅ | - | Withdrawal submit callback function |
|
|
167
|
+
| `lang` | `'ZH' \| 'EN' \| 'VI'` | ❌ | `'EN'` | Interface language |
|
|
168
|
+
| `channel` | `string` | ❌ | `'RWA'` |Interface channel |
|
|
169
|
+
| `currencyListApi` | `string` | ❌ | `'/ext/ewallet/currencyList'` | Currency list API endpoint path |
|
|
170
|
+
| `getWithdrawAddressApi` | `string` | ❌ | `'/ext/ewallet/getWithdrawAddress'` | Get withdrawal address API endpoint path |
|
|
171
|
+
| `listRecordsApi` | `string` | ❌ | `'/ext/ewallet/list'` | List records API endpoint path |
|
|
172
|
+
|
|
173
|
+
#### Type Definitions
|
|
174
|
+
|
|
175
|
+
**tokenCoinType Interface:**
|
|
176
|
+
|
|
177
|
+
```typescript
|
|
178
|
+
interface tokenCoinType {
|
|
179
|
+
name: string; // Token name (e.g., 'USDH', 'USDT')
|
|
180
|
+
coinType: string; // Sui coin type (e.g., '0x72eba41c73c4c2ce2bcfc6ec1dc0896ba1b5c17bfe7ae7c6c779943f84912b41::usdh::USDH')
|
|
181
|
+
decimals: number; // Token decimal places (e.g., 9)
|
|
182
|
+
}
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
**WithdrawData Interface:**
|
|
186
|
+
|
|
187
|
+
The `withdrawData` parameter passed to `onSubmit` callback has the following structure:
|
|
188
|
+
|
|
189
|
+
```typescript
|
|
190
|
+
interface WithdrawData {
|
|
191
|
+
network: string; // Network/chain name (e.g., 'HPAY', 'BSC', 'ETH', 'TRX')
|
|
192
|
+
currency: string; // Payment token (e.g., 'USDH')
|
|
193
|
+
address: string; // Withdrawal address
|
|
194
|
+
amount: string; // Withdrawal amount
|
|
195
|
+
areaCode: string; // Area code (for HPAY network, e.g., '+855')
|
|
196
|
+
toCurrency: string; // Token to receive (e.g., 'USDT', 'USD')
|
|
197
|
+
minAmount: number; // Minimum withdrawal amount
|
|
198
|
+
}
|
|
199
|
+
```
|
|
200
|
+
|
|
152
201
|
|
|
153
202
|
## 📝 Complete Example
|
|
154
203
|
|
|
@@ -189,6 +238,11 @@ const AppContent = () => {
|
|
|
189
238
|
authToken="your-auth-token"
|
|
190
239
|
userAddress="0x..."
|
|
191
240
|
lang="EN"
|
|
241
|
+
channel="RWA"
|
|
242
|
+
currencyListApi="/ext/ewallet/currencyList"
|
|
243
|
+
getAddressApi="/ext/ewallet/getOtcAddress"
|
|
244
|
+
listRecordsApi="/ext/ewallet/list"
|
|
245
|
+
applyDepositApi="/ext/ewallet/applyDeposit"
|
|
192
246
|
>
|
|
193
247
|
<button>OTC Trading</button>
|
|
194
248
|
</OtcModal>
|
|
@@ -198,10 +252,15 @@ const AppContent = () => {
|
|
|
198
252
|
authToken="your-auth-token"
|
|
199
253
|
userAddress="0x..."
|
|
200
254
|
suiClient={suiClient}
|
|
201
|
-
|
|
202
|
-
|
|
255
|
+
tokenCoinTypeList={[
|
|
256
|
+
{ name: 'USDH', coinType: '0x72eba41c73c4c2ce2bcfc6ec1dc0896ba1b5c17bfe7ae7c6c779943f84912b41::usdh::USDH', decimals: 9 }
|
|
257
|
+
]}
|
|
203
258
|
onSubmit={handleWithdraw}
|
|
204
259
|
lang="EN"
|
|
260
|
+
channel="RWA"
|
|
261
|
+
currencyListApi="/ext/ewallet/currencyList"
|
|
262
|
+
getWithdrawAddressApi="/ext/ewallet/getWithdrawAddress"
|
|
263
|
+
listRecordsApi="/ext/ewallet/list"
|
|
205
264
|
>
|
|
206
265
|
<button>Withdraw</button>
|
|
207
266
|
</Withdraw>
|
|
@@ -238,17 +297,22 @@ The component library includes built-in styles written in SCSS. The styles are a
|
|
|
238
297
|
|
|
239
298
|
## 🔌 API Endpoints
|
|
240
299
|
|
|
241
|
-
The components require the following API endpoints:
|
|
300
|
+
The components require the following API endpoints. You can customize the API paths by passing the corresponding props:
|
|
242
301
|
|
|
243
302
|
### OtcModal Required Endpoints
|
|
244
303
|
|
|
245
|
-
- `POST {baseUrl}
|
|
246
|
-
-
|
|
304
|
+
- `POST {baseUrl}{currencyListApi}` - Get currency list (default: `/ext/ewallet/currencyList`)
|
|
305
|
+
- `POST {baseUrl}{getAddressApi}` - Get OTC address (default: `/ext/ewallet/getOtcAddress`)
|
|
306
|
+
- `POST {baseUrl}{listRecordsApi}` - List transaction records (default: `/ext/ewallet/list`)
|
|
307
|
+
- `POST {baseUrl}{applyDepositApi}` - Apply deposit (default: `/ext/ewallet/applyDeposit`)
|
|
247
308
|
|
|
248
309
|
### Withdraw Required Endpoints
|
|
249
310
|
|
|
250
|
-
- `POST {baseUrl}
|
|
251
|
-
-
|
|
311
|
+
- `POST {baseUrl}{currencyListApi}` - Get currency list (default: `/ext/ewallet/currencyList`)
|
|
312
|
+
- `POST {baseUrl}{getWithdrawAddressApi}` - Get withdrawal address (default: `/ext/ewallet/getWithdrawAddress`)
|
|
313
|
+
- `POST {baseUrl}{listRecordsApi}` - List transaction records (default: `/ext/ewallet/list`)
|
|
314
|
+
|
|
315
|
+
You can customize these endpoints by passing the corresponding API path props to the components.
|
|
252
316
|
|
|
253
317
|
## 🛠️ Development
|
|
254
318
|
|
|
@@ -266,6 +330,42 @@ npm run build
|
|
|
266
330
|
npm run preview
|
|
267
331
|
```
|
|
268
332
|
|
|
333
|
+
## 📝 Changelog
|
|
334
|
+
|
|
335
|
+
### Latest Updates
|
|
336
|
+
|
|
337
|
+
#### 1. 支持越南语 (Vietnamese Language Support)
|
|
338
|
+
- 新增支持 `'VI'` 语言选项
|
|
339
|
+
- `OtcModal` 和 `Withdraw` 组件现在都支持 `lang="VI"` 参数
|
|
340
|
+
- 所有界面文本已翻译为越南语
|
|
341
|
+
|
|
342
|
+
#### 2. 接口路径可配置化 (Configurable API Endpoints)
|
|
343
|
+
- **OtcModal 组件**新增以下可选参数:
|
|
344
|
+
- `currencyListApi`: 币种列表接口路径(默认: `'/ext/ewallet/currencyList'`)
|
|
345
|
+
- `getAddressApi`: 获取OTC地址接口路径(默认: `'/ext/ewallet/getOtcAddress'`)
|
|
346
|
+
- `listRecordsApi`: 交易记录列表接口路径(默认: `'/ext/ewallet/list'`)
|
|
347
|
+
- `applyDepositApi`: 申请充值接口路径(默认: `'/ext/ewallet/applyDeposit'`)
|
|
348
|
+
|
|
349
|
+
- **Withdraw 组件**新增以下可选参数:
|
|
350
|
+
- `currencyListApi`: 币种列表接口路径(默认: `'/ext/ewallet/currencyList'`)
|
|
351
|
+
- `getWithdrawAddressApi`: 获取提现地址接口路径(默认: `'/ext/ewallet/getWithdrawAddress'`)
|
|
352
|
+
- `listRecordsApi`: 交易记录列表接口路径(默认: `'/ext/ewallet/list'`)
|
|
353
|
+
|
|
354
|
+
- **Withdraw 组件参数变更**:
|
|
355
|
+
- `USDH_COIN_TYPE` 和 `USDH_DECIMALS` 已合并为 `tokenCoinTypeList` 参数
|
|
356
|
+
- `tokenCoinTypeList` 类型为 `tokenCoinType[]`,支持多个代币配置
|
|
357
|
+
- 每个 `tokenCoinType` 包含:`name`(代币名称)、`coinType`(代币类型)、`decimals`(小数位数)
|
|
358
|
+
|
|
359
|
+
- **onSubmit 回调参数类型**:
|
|
360
|
+
- `withdrawData` 参数现在有明确的类型定义,包含以下字段:
|
|
361
|
+
- `network`: 网络/链名称
|
|
362
|
+
- `currency`: 支付代币
|
|
363
|
+
- `address`: 提现地址
|
|
364
|
+
- `amount`: 提现金额
|
|
365
|
+
- `areaCode`: 区号(HPAY网络使用)
|
|
366
|
+
- `toCurrency`: 接收代币
|
|
367
|
+
- `minAmount`: 最小提现金额
|
|
368
|
+
|
|
269
369
|
## 📄 License
|
|
270
370
|
|
|
271
371
|
MIT
|