@jetthai/cuora 1.0.307-dev-2 → 1.1.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/CHANGELOG.md +3 -854
- package/README.md +0 -6
- package/dist/bundle.mjs +18461 -0
- package/package.json +9 -6
- package/rollup.config.js +16 -0
- package/src/api/activity.js +2 -43
- package/src/api/auth.js +7 -22
- package/src/api/common.js +1 -3
- package/src/api/game.js +7 -20
- package/src/api/mailbox.js +5 -9
- package/src/api/payment.js +19 -167
- package/src/api/user.js +0 -7
- package/src/machine/activity/activity.js +26 -111
- package/src/machine/activity/{friend_invite_friends_activity.js → affiliate_invite_friends_activity.js} +41 -70
- package/src/machine/activity/continue_deposit_activity.js +2 -11
- package/src/machine/activity/deposit_activity.js +4 -13
- package/src/machine/activity/diamond_shop_activity_vn.js +89 -54
- package/src/machine/activity/fafafa_activity.js +19 -34
- package/src/machine/activity/index.js +4 -22
- package/src/machine/activity/invite_friends_activity.js +14 -14
- package/src/machine/activity/ranking_activity.js +2 -11
- package/src/machine/activity/sign_in_activity.js +14 -21
- package/src/machine/activity/specify_bets_activity.js +3 -25
- package/src/machine/activity/specify_turnover_activity.js +3 -25
- package/src/machine/activity/time_bomb_activity.js +2 -11
- package/src/machine/auth.js +21 -146
- package/src/machine/auth_otp.js +201 -0
- package/src/machine/auth_otp_v2.js +4 -10
- package/src/machine/auth_otp_v3.js +3 -11
- package/src/machine/bank_binding.js +12 -112
- package/src/machine/common.js +25 -113
- package/src/machine/deposit/crypto.js +29 -50
- package/src/machine/deposit/crypto_button.js +39 -174
- package/src/machine/deposit/deposit_fc.js +5 -8
- package/src/machine/deposit/direct.js +16 -111
- package/src/machine/deposit/index.js +2 -43
- package/src/machine/deposit/loadcard_vn.js +43 -191
- package/src/machine/deposit/manual_vn.js +60 -182
- package/src/machine/deposit/qrcode_v2.js +52 -285
- package/src/machine/deposit/qrcode_vn.js +206 -0
- package/src/machine/game.js +285 -0
- package/src/machine/game_favorite.js +123 -0
- package/src/machine/game_favorite_v2.js +28 -74
- package/src/machine/game_search.js +244 -0
- package/src/machine/game_search_v2.js +24 -64
- package/src/machine/game_v2.js +356 -0
- package/src/machine/inbox.js +34 -259
- package/src/machine/index.js +17 -26
- package/src/machine/leaderboard.js +8 -31
- package/src/machine/reward.js +7 -74
- package/src/machine/setting.js +2 -5
- package/src/machine/side_v2.js +28 -33
- package/src/machine/user_sign_up.js +17 -117
- package/src/machine/{withdraw/withdraw_crypto.js → withdraw_crypto.js} +69 -220
- package/src/machine/{withdraw/withdraw_fc.js → withdraw_fc.js} +2 -2
- package/src/machine/{withdraw/withdraw_amb.js → withdraw_vn.js} +78 -146
- package/src/request/request.js +5 -10
- package/src/util/constant.js +1 -19
- package/src/util/deviceToken.js +8 -18
- package/src/util/index.js +1 -2
- package/src/util/storage.js +22 -22
- package/.husky/pre-commit +0 -4
- package/.prettierignore +0 -1
- package/src/lib/fingerprint.js +0 -9779
- package/src/machine/activity/activity_cash.js +0 -159
- package/src/machine/activity/cash_rain_activity.js +0 -153
- package/src/machine/activity/diamond_shop_activity_cash.js +0 -179
- package/src/machine/activity/instant_rebate_activity.js +0 -195
- package/src/machine/activity/jackpot.js +0 -74
- package/src/machine/activity/otp_verified_activity.js +0 -74
- package/src/machine/activity/roulette_activity_v2.js +0 -90
- package/src/machine/activity/sign_in_monthly_activity.js +0 -65
- package/src/machine/activity/vip_card_activity.js +0 -140
- package/src/machine/bank_binding_amb.js +0 -145
- package/src/machine/deposit/amb.js +0 -92
- package/src/machine/deposit/crypto_bank.js +0 -317
- package/src/machine/deposit/crypto_bank_cash.js +0 -287
- package/src/machine/deposit/crypto_cash.js +0 -255
- package/src/machine/deposit/crypto_qrcode.js +0 -148
- package/src/machine/deposit/crypto_qrcode_cash.js +0 -131
- package/src/machine/deposit/crypto_way.js +0 -239
- package/src/machine/deposit/crypto_way_cash.js +0 -256
- package/src/machine/deposit/direct_cash.js +0 -217
- package/src/machine/deposit/float.js +0 -366
- package/src/machine/deposit/krway.js +0 -151
- package/src/machine/deposit/loadcard_cash.js +0 -207
- package/src/machine/deposit/manual_cash.js +0 -356
- package/src/machine/deposit/qrcode_cash.js +0 -217
- package/src/machine/deposit/usdt.js +0 -144
- package/src/machine/deposit/usdt_cash.js +0 -138
- package/src/machine/deposit/vpay.js +0 -359
- package/src/machine/game_info.js +0 -57
- package/src/machine/game_search_cash.js +0 -390
- package/src/machine/game_v2_1.js +0 -662
- package/src/machine/honor_board.js +0 -118
- package/src/machine/honor_board_cash.js +0 -89
- package/src/machine/navbar.js +0 -57
- package/src/machine/promotions.js +0 -171
- package/src/machine/reward_cash.js +0 -219
- package/src/machine/roulette_v2.js +0 -276
- package/src/machine/side_cash.js +0 -110
- package/src/machine/user_photo.js +0 -65
- package/src/machine/withdraw/index.js +0 -23
- package/src/machine/withdraw/withdraw_crypto2.js +0 -540
- package/src/machine/withdraw/withdraw_crypto_cash.js +0 -319
- package/src/machine/withdraw/withdraw_krway.js +0 -220
- package/src/machine/withdraw/withdraw_manual.js +0 -610
- package/src/machine/withdraw/withdraw_manual_cash.js +0 -303
- package/src/machine/withdraw/withdraw_vn.js +0 -546
- package/src/machine/withdraw/withdraw_vn2.js +0 -561
- package/src/util/math.js +0 -4
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { assign, createMachine } from 'xstate'
|
|
2
2
|
import findLastIndex from 'lodash/findLastIndex.js'
|
|
3
|
-
import payment from '
|
|
4
|
-
import common from '
|
|
5
|
-
import user from '
|
|
6
|
-
import api from '
|
|
3
|
+
import payment from '../api/payment.js'
|
|
4
|
+
import common from '../api/common.js'
|
|
5
|
+
import user from '../api/user.js'
|
|
6
|
+
import api from '../api/payment.js'
|
|
7
|
+
|
|
8
|
+
// const findLastIndex = require('lodash/findLastIndex')
|
|
7
9
|
|
|
8
10
|
export default function (request) {
|
|
9
11
|
const { appSecret } = request.config
|
|
@@ -23,10 +25,7 @@ export default function (request) {
|
|
|
23
25
|
targetWithdrawLimit: null,
|
|
24
26
|
|
|
25
27
|
maxWithdrawAmount: null,
|
|
26
|
-
|
|
27
|
-
withdrawRules: [],
|
|
28
|
-
|
|
29
|
-
attachmentType: null, // null | 'withdraw' | 'pool'
|
|
28
|
+
availableWithdrawAmount: null,
|
|
30
29
|
|
|
31
30
|
networks: [],
|
|
32
31
|
selectedNetwork: null,
|
|
@@ -35,12 +34,6 @@ export default function (request) {
|
|
|
35
34
|
|
|
36
35
|
charge: null,
|
|
37
36
|
realAmount: null,
|
|
38
|
-
|
|
39
|
-
// otp
|
|
40
|
-
requestId: null,
|
|
41
|
-
status: null,
|
|
42
|
-
target: null,
|
|
43
|
-
ttl: null,
|
|
44
37
|
},
|
|
45
38
|
states: {
|
|
46
39
|
loading: {
|
|
@@ -48,7 +41,7 @@ export default function (request) {
|
|
|
48
41
|
src: 'fetchInitData',
|
|
49
42
|
onDone: {
|
|
50
43
|
target: 'mode',
|
|
51
|
-
actions: ['setInitData', 'preset'
|
|
44
|
+
actions: ['setInitData', 'preset'],
|
|
52
45
|
},
|
|
53
46
|
onError: {
|
|
54
47
|
target: 'fail',
|
|
@@ -59,59 +52,43 @@ export default function (request) {
|
|
|
59
52
|
always: [{ target: 'free', cond: 'isFree' }, { target: 'cash' }],
|
|
60
53
|
},
|
|
61
54
|
free: {
|
|
62
|
-
initial: '
|
|
55
|
+
initial: 'loading',
|
|
63
56
|
states: {
|
|
64
|
-
|
|
65
|
-
always: [{ target: 'convertible', cond: 'isConvertible' }, { target: 'notConvertible' }],
|
|
66
|
-
},
|
|
67
|
-
notConvertible: {
|
|
68
|
-
on: {
|
|
69
|
-
GIVE_UP: {
|
|
70
|
-
target: 'givingUp',
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
},
|
|
74
|
-
givingUp: {
|
|
57
|
+
loading: {
|
|
75
58
|
invoke: {
|
|
76
|
-
src: '
|
|
59
|
+
src: 'fetchWithdrawRules',
|
|
77
60
|
onDone: {
|
|
78
|
-
target: '
|
|
61
|
+
target: 'checking',
|
|
62
|
+
actions: 'updateWithdrawCondition',
|
|
79
63
|
},
|
|
80
64
|
onError: {
|
|
81
|
-
target: '
|
|
65
|
+
target: 'notConvertible',
|
|
82
66
|
},
|
|
83
67
|
},
|
|
84
68
|
},
|
|
85
|
-
|
|
69
|
+
checking: {
|
|
70
|
+
always: [{ target: 'convertible', cond: 'isConvertible' }, { target: 'notConvertible' }],
|
|
71
|
+
},
|
|
72
|
+
notConvertible: {},
|
|
86
73
|
convertible: {
|
|
87
74
|
on: {
|
|
88
75
|
SUBMIT: {
|
|
89
76
|
target: 'converting',
|
|
90
|
-
actions: 'setAttachmentType',
|
|
91
77
|
},
|
|
92
78
|
},
|
|
93
79
|
},
|
|
94
80
|
converting: {
|
|
95
81
|
invoke: {
|
|
96
|
-
src: '
|
|
97
|
-
onDone:
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
actions: 'setOtp',
|
|
101
|
-
cond: 'isOtpRequired',
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
target: 'converted',
|
|
105
|
-
},
|
|
106
|
-
],
|
|
82
|
+
src: 'submitWithdrawFree',
|
|
83
|
+
onDone: {
|
|
84
|
+
target: 'converted',
|
|
85
|
+
},
|
|
107
86
|
onError: {
|
|
108
87
|
target: 'convertible',
|
|
109
88
|
},
|
|
110
89
|
},
|
|
111
90
|
},
|
|
112
|
-
converted: {
|
|
113
|
-
always: [{ target: '#withdraw_crypto.cash.withdrawable', cond: 'hasAttachmentType' }],
|
|
114
|
-
},
|
|
91
|
+
converted: {},
|
|
115
92
|
},
|
|
116
93
|
},
|
|
117
94
|
cash: {
|
|
@@ -145,17 +122,6 @@ export default function (request) {
|
|
|
145
122
|
target: 'submittable',
|
|
146
123
|
cond: 'isSubmittable',
|
|
147
124
|
},
|
|
148
|
-
SET_ATTACHMENT_TYPE: {
|
|
149
|
-
actions: 'setAttachmentType',
|
|
150
|
-
cond: 'isNewWalletMode',
|
|
151
|
-
},
|
|
152
|
-
POOL: {
|
|
153
|
-
target: 'pooling',
|
|
154
|
-
cond: (context, event) => {
|
|
155
|
-
const { amount, attachmentType } = context
|
|
156
|
-
return attachmentType === 'pool' && amount > 0
|
|
157
|
-
},
|
|
158
|
-
},
|
|
159
125
|
},
|
|
160
126
|
},
|
|
161
127
|
calculating: {
|
|
@@ -173,18 +139,9 @@ export default function (request) {
|
|
|
173
139
|
},
|
|
174
140
|
submittable: {
|
|
175
141
|
on: {
|
|
176
|
-
SUBMIT:
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
cond: (context, event) => {
|
|
180
|
-
const { amount, attachmentType } = context
|
|
181
|
-
return attachmentType === 'pool' && amount > 0
|
|
182
|
-
},
|
|
183
|
-
},
|
|
184
|
-
{
|
|
185
|
-
target: 'submitting',
|
|
186
|
-
},
|
|
187
|
-
],
|
|
142
|
+
SUBMIT: {
|
|
143
|
+
target: 'submitting',
|
|
144
|
+
},
|
|
188
145
|
BACK: {
|
|
189
146
|
target: 'withdrawable',
|
|
190
147
|
},
|
|
@@ -193,97 +150,16 @@ export default function (request) {
|
|
|
193
150
|
submitting: {
|
|
194
151
|
invoke: {
|
|
195
152
|
src: 'submitWithdraw',
|
|
196
|
-
onDone:
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
actions: 'setOtp',
|
|
200
|
-
cond: 'isOtpRequired',
|
|
201
|
-
},
|
|
202
|
-
{
|
|
203
|
-
target: 'submitted',
|
|
204
|
-
},
|
|
205
|
-
],
|
|
206
|
-
onError: {
|
|
207
|
-
target: 'withdrawable',
|
|
153
|
+
onDone: {
|
|
154
|
+
target: 'submitted',
|
|
155
|
+
actions: 'setResult',
|
|
208
156
|
},
|
|
209
|
-
},
|
|
210
|
-
},
|
|
211
|
-
submitted: {},
|
|
212
|
-
pooling: {
|
|
213
|
-
invoke: {
|
|
214
|
-
src: 'pool',
|
|
215
|
-
onDone: { target: 'pooled' },
|
|
216
157
|
onError: {
|
|
217
158
|
target: 'withdrawable',
|
|
218
159
|
},
|
|
219
160
|
},
|
|
220
161
|
},
|
|
221
|
-
|
|
222
|
-
},
|
|
223
|
-
},
|
|
224
|
-
otp: {
|
|
225
|
-
type: 'parallel',
|
|
226
|
-
states: {
|
|
227
|
-
countdown: {
|
|
228
|
-
after: {
|
|
229
|
-
1000: {
|
|
230
|
-
target: 'countdown',
|
|
231
|
-
actions: 'decreaseTtl',
|
|
232
|
-
cond: (context) => context.ttl > 0,
|
|
233
|
-
},
|
|
234
|
-
},
|
|
235
|
-
},
|
|
236
|
-
verification: {
|
|
237
|
-
initial: 'idle',
|
|
238
|
-
states: {
|
|
239
|
-
idle: {
|
|
240
|
-
on: {
|
|
241
|
-
ACKNOWLEDGE: {
|
|
242
|
-
target: 'acknowledging',
|
|
243
|
-
},
|
|
244
|
-
RESET_OTP: {
|
|
245
|
-
target: 'reset',
|
|
246
|
-
},
|
|
247
|
-
BACK: [
|
|
248
|
-
{
|
|
249
|
-
target: '#withdraw_crypto.free.convertible',
|
|
250
|
-
cond: 'isFree',
|
|
251
|
-
},
|
|
252
|
-
{
|
|
253
|
-
target: '#withdraw_crypto.cash.submittable',
|
|
254
|
-
},
|
|
255
|
-
],
|
|
256
|
-
},
|
|
257
|
-
},
|
|
258
|
-
acknowledging: {
|
|
259
|
-
invoke: {
|
|
260
|
-
src: 'acknowledge',
|
|
261
|
-
onDone: [
|
|
262
|
-
{
|
|
263
|
-
target: '#withdraw_crypto.free.converted',
|
|
264
|
-
cond: 'isFree',
|
|
265
|
-
},
|
|
266
|
-
{
|
|
267
|
-
target: '#withdraw_crypto.cash.submitted',
|
|
268
|
-
},
|
|
269
|
-
],
|
|
270
|
-
onError: {
|
|
271
|
-
target: 'idle',
|
|
272
|
-
},
|
|
273
|
-
},
|
|
274
|
-
},
|
|
275
|
-
reset: {
|
|
276
|
-
invoke: {
|
|
277
|
-
src: 'resetOtp',
|
|
278
|
-
onDone: {
|
|
279
|
-
target: 'idle',
|
|
280
|
-
actions: 'setVerificationData',
|
|
281
|
-
},
|
|
282
|
-
onError: { target: 'idle' },
|
|
283
|
-
},
|
|
284
|
-
},
|
|
285
|
-
},
|
|
286
|
-
},
|
|
162
|
+
submitted: {},
|
|
287
163
|
},
|
|
288
164
|
},
|
|
289
165
|
fail: {},
|
|
@@ -311,6 +187,11 @@ export default function (request) {
|
|
|
311
187
|
}) || [],
|
|
312
188
|
}
|
|
313
189
|
}),
|
|
190
|
+
setPaymentData: assign((context, event) => {
|
|
191
|
+
return {
|
|
192
|
+
paymentDetail: event.data.paymentDetail,
|
|
193
|
+
}
|
|
194
|
+
}),
|
|
314
195
|
preset: assign((context, event) => {
|
|
315
196
|
const { userInfo, siteConfig } = event.data
|
|
316
197
|
const { withdraw_limit, target_withdraw_limit } = userInfo || {}
|
|
@@ -323,21 +204,24 @@ export default function (request) {
|
|
|
323
204
|
balance,
|
|
324
205
|
siteConfig,
|
|
325
206
|
userInfo,
|
|
326
|
-
attachmentType: siteConfig.walletMode > 0 ? 'withdraw' : null,
|
|
327
207
|
}
|
|
328
208
|
}),
|
|
329
209
|
updateWithdrawCondition: assign((context, event) => {
|
|
330
|
-
const
|
|
331
|
-
|
|
332
|
-
const
|
|
333
|
-
const { balance } = context
|
|
210
|
+
const rules = event.data.rules.filter((rule) => rule.maxWithdrawAmount > 0)
|
|
211
|
+
|
|
212
|
+
const { balance, withdrawLimit } = context
|
|
334
213
|
const lastMatchedIndex = findLastIndex(rules, (rule) => balance >= rule.greaterEqualThen)
|
|
335
214
|
|
|
336
|
-
let maxWithdrawAmount = 0
|
|
215
|
+
let maxWithdrawAmount = 0,
|
|
216
|
+
availableWithdrawAmount = 0
|
|
337
217
|
|
|
338
218
|
if (lastMatchedIndex > -1) {
|
|
339
219
|
rules[lastMatchedIndex].match = true
|
|
340
220
|
maxWithdrawAmount = rules[lastMatchedIndex].maxWithdrawAmount
|
|
221
|
+
|
|
222
|
+
if (withdrawLimit === 0) {
|
|
223
|
+
availableWithdrawAmount = Math.min(balance, maxWithdrawAmount)
|
|
224
|
+
}
|
|
341
225
|
} else if (rules.length > 0) {
|
|
342
226
|
maxWithdrawAmount = rules[0].maxWithdrawAmount
|
|
343
227
|
} else {
|
|
@@ -346,9 +230,7 @@ export default function (request) {
|
|
|
346
230
|
|
|
347
231
|
return {
|
|
348
232
|
maxWithdrawAmount,
|
|
349
|
-
|
|
350
|
-
enableWithdraw,
|
|
351
|
-
withdrawRules,
|
|
233
|
+
availableWithdrawAmount,
|
|
352
234
|
}
|
|
353
235
|
}),
|
|
354
236
|
setNetwork: assign((context, event) => {
|
|
@@ -376,32 +258,10 @@ export default function (request) {
|
|
|
376
258
|
charge: null,
|
|
377
259
|
}
|
|
378
260
|
}),
|
|
379
|
-
|
|
380
|
-
const {
|
|
381
|
-
return {
|
|
382
|
-
requestId,
|
|
383
|
-
status,
|
|
384
|
-
target,
|
|
385
|
-
ttl,
|
|
386
|
-
}
|
|
387
|
-
}),
|
|
388
|
-
decreaseTtl: assign((context, evnet) => {
|
|
389
|
-
const second = context.ttl
|
|
261
|
+
setTransaction: assign((context, event) => {
|
|
262
|
+
const { realAmount } = event.data
|
|
390
263
|
return {
|
|
391
|
-
|
|
392
|
-
}
|
|
393
|
-
}),
|
|
394
|
-
setVerificationData: assign((context, event) => {
|
|
395
|
-
const { requestId, ttl, target } = event.data
|
|
396
|
-
return {
|
|
397
|
-
requestId,
|
|
398
|
-
ttl,
|
|
399
|
-
target,
|
|
400
|
-
}
|
|
401
|
-
}),
|
|
402
|
-
setAttachmentType: assign((context, event) => {
|
|
403
|
-
return {
|
|
404
|
-
attachmentType: event.data,
|
|
264
|
+
realAmount,
|
|
405
265
|
}
|
|
406
266
|
}),
|
|
407
267
|
},
|
|
@@ -409,48 +269,53 @@ export default function (request) {
|
|
|
409
269
|
isFree: (context, event) => {
|
|
410
270
|
return context.userInfo?.withdraw_rule !== 'DEFAULT'
|
|
411
271
|
},
|
|
412
|
-
hasAttachmentType: (context, event) => {
|
|
413
|
-
return ['withdraw', 'pool'].includes(context.attachmentType)
|
|
414
|
-
},
|
|
415
272
|
haveProcessing: (context, event) => {
|
|
416
273
|
return (context.paymentDetail?.[0]?.processing || []).length > 0
|
|
417
274
|
},
|
|
275
|
+
isWithdrawDisable: (context, event) => {
|
|
276
|
+
const { siteConfig } = context
|
|
277
|
+
const methods = siteConfig?.paymentMethods?.withdraw || []
|
|
278
|
+
return methods.length === 0
|
|
279
|
+
},
|
|
418
280
|
isSubmittable: (context, event) => {
|
|
419
281
|
const { selectedNetwork, address, amount, charge } = context
|
|
420
282
|
return selectedNetwork && address && amount && charge
|
|
421
283
|
},
|
|
422
284
|
isConvertible: (context, event) => {
|
|
423
|
-
const {
|
|
424
|
-
return
|
|
285
|
+
const { balance, withdrawLimit } = context
|
|
286
|
+
return balance > 0 && withdrawLimit === 0
|
|
425
287
|
},
|
|
426
288
|
isNotWithdrawable: (context, event) => {
|
|
427
|
-
const {
|
|
428
|
-
|
|
289
|
+
const { balance, withdrawLimit, paymentDetail } = context
|
|
290
|
+
const minWithdrawAmount = paymentDetail[0]?.minimum || 0
|
|
291
|
+
return withdrawLimit !== 0 || balance < minWithdrawAmount
|
|
429
292
|
},
|
|
430
293
|
isCalculable: (context, event) => {
|
|
431
294
|
const { selectedNetwork, amount } = context
|
|
432
295
|
return selectedNetwork && amount
|
|
433
296
|
},
|
|
434
|
-
isOtpRequired: (context, event) => {
|
|
435
|
-
return event.data?.status === 'otp-verifying'
|
|
436
|
-
},
|
|
437
|
-
isNewWalletMode: (context, event) => context.siteConfig.walletMode > 0,
|
|
438
297
|
},
|
|
439
298
|
services: {
|
|
440
299
|
fetchInitData: async (context, event) => {
|
|
441
|
-
const [{ config }, userInfo, paymentDetail = []
|
|
300
|
+
const [{ config }, userInfo, paymentDetail = []] = await Promise.all([
|
|
442
301
|
request.send(common.getConfig({ appSecret })),
|
|
443
302
|
request.send(user.getUserInfo()),
|
|
444
303
|
request.send(payment.getPaymentDetail({ transferType: 'WITHDRAW' })),
|
|
445
|
-
request.send(payment.getCurrentWithdrawRule()),
|
|
446
304
|
])
|
|
447
305
|
const siteConfig = JSON.parse(window.atob(config))
|
|
448
|
-
return { siteConfig, userInfo, paymentDetail
|
|
306
|
+
return { siteConfig, userInfo, paymentDetail }
|
|
307
|
+
},
|
|
308
|
+
fetchPaymentData: async (context, event) => {
|
|
309
|
+
const paymentDetail = await request.send(payment.getPaymentDetail({ transferType: 'WITHDRAW' }))
|
|
310
|
+
return { paymentDetail }
|
|
311
|
+
},
|
|
312
|
+
fetchWithdrawRules: async (context, event) => {
|
|
313
|
+
return await request.send(payment.getCurrentWithdrawRule())
|
|
449
314
|
},
|
|
450
315
|
submitWithdraw: async (context, event) => {
|
|
451
316
|
const { crypto, selectedNetwork, address, amount } = context
|
|
452
317
|
return await request.send(
|
|
453
|
-
api.
|
|
318
|
+
api.submitWithdrawTransaction({
|
|
454
319
|
method: crypto.method,
|
|
455
320
|
amount,
|
|
456
321
|
cryptoCurrency: crypto.channel,
|
|
@@ -459,7 +324,7 @@ export default function (request) {
|
|
|
459
324
|
})
|
|
460
325
|
)
|
|
461
326
|
},
|
|
462
|
-
|
|
327
|
+
submitWithdrawFree: async (context, event) => {
|
|
463
328
|
return await request.send(payment.convertFreeCredit({ exchangeType: 1 }))
|
|
464
329
|
},
|
|
465
330
|
fetchCalculation: async (context, event) => {
|
|
@@ -473,22 +338,6 @@ export default function (request) {
|
|
|
473
338
|
})
|
|
474
339
|
)
|
|
475
340
|
},
|
|
476
|
-
resetOtp: async (context, event) => {
|
|
477
|
-
const { requestId, target } = context
|
|
478
|
-
return await request.send(user.otpReset({ requestId, target }))
|
|
479
|
-
},
|
|
480
|
-
acknowledge: async (context, event) => {
|
|
481
|
-
const { requestId, target } = context
|
|
482
|
-
const code = event.data
|
|
483
|
-
return await request.send(user.otpAcknowledge({ requestId, target, code }))
|
|
484
|
-
},
|
|
485
|
-
pool: async (context, event) => {
|
|
486
|
-
const { amount } = context
|
|
487
|
-
return await request.send(payment.restore({ amount }))
|
|
488
|
-
},
|
|
489
|
-
giveUp: async (context, event) => {
|
|
490
|
-
return await request.send(payment.giveUp())
|
|
491
|
-
},
|
|
492
341
|
},
|
|
493
342
|
}
|
|
494
343
|
)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { assign, createMachine } from 'xstate'
|
|
2
|
-
import api from '
|
|
2
|
+
import api from '../api/payment.js'
|
|
3
3
|
|
|
4
4
|
export default function (request) {
|
|
5
5
|
return createMachine(
|
|
@@ -215,7 +215,7 @@ export default function (request) {
|
|
|
215
215
|
const { crypto, currentNetwork, currentAddress, withdrawAmount } = context
|
|
216
216
|
const method = crypto.method
|
|
217
217
|
return await request.send(
|
|
218
|
-
api.
|
|
218
|
+
api.submitWithdrawTransaction({
|
|
219
219
|
method,
|
|
220
220
|
amount: withdrawAmount,
|
|
221
221
|
cryptoCurrency: crypto.channel,
|