@jetthai/cuora 2.0.0-beta.1 → 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.
Files changed (201) hide show
  1. package/.claude/commands/sync-ai-prompts.md +93 -0
  2. package/.claude/settings.local.json +23 -0
  3. package/.github/copilot-instructions.md +405 -0
  4. package/.husky/post-checkout +32 -0
  5. package/.husky/pre-commit +1 -3
  6. package/.husky/pre-push +36 -0
  7. package/AGENTS.md +405 -0
  8. package/AI_PROMPT_SOURCE.md +403 -0
  9. package/CHANGELOG.md +274 -3
  10. package/CLAUDE.md +405 -0
  11. package/GEMINI.md +405 -0
  12. package/README.md +299 -15
  13. package/docs/kibana/crypto-way-deposit-amount-bug-analysis.md +1003 -0
  14. package/docs/kibana/play-providerId-error.md +202 -0
  15. package/docs/kibana/play-selectedWalletType.md +1 -0
  16. package/docs/kibana/play-selectedWalletType_2.md +1 -0
  17. package/docs/kibana/play-selectedWalletType_analysis.md +565 -0
  18. package/package.json +3 -3
  19. package/scripts/auto-version.js +68 -0
  20. package/scripts/auto-version.sh +33 -0
  21. package/scripts/branch-auto-npm-publish.js +29 -0
  22. package/scripts/check-version.sh +36 -0
  23. package/scripts/clean-tags.sh +84 -0
  24. package/src/api/account.js +0 -1
  25. package/src/api/activity.js +22 -37
  26. package/src/api/auth.js +5 -36
  27. package/src/api/common.js +5 -3
  28. package/src/api/game.js +0 -10
  29. package/src/api/payment.js +17 -55
  30. package/src/api/user.js +10 -16
  31. package/src/index.js +2 -2
  32. package/src/machine/activity/activity_cash.js +84 -36
  33. package/src/machine/activity/cash_rain_activity.js +0 -1
  34. package/src/machine/activity/continue_deposit_activity.js +0 -1
  35. package/src/machine/activity/deposit_activity.js +0 -1
  36. package/src/machine/activity/diamond_shop_activity_cash.js +0 -8
  37. package/src/machine/activity/fafafa_activity.js +0 -11
  38. package/src/machine/activity/friend_invite_friends_activity.js +8 -7
  39. package/src/machine/activity/index.js +0 -12
  40. package/src/machine/activity/instant_rebate_activity.js +0 -1
  41. package/src/machine/activity/jackpot.js +0 -1
  42. package/src/machine/activity/otp_verified_activity.js +0 -1
  43. package/src/machine/activity/ranking_activity.js +0 -1
  44. package/src/machine/activity/roulette_activity_v2.js +0 -1
  45. package/src/machine/activity/sign_in_activity.js +0 -1
  46. package/src/machine/activity/sign_in_monthly_activity.js +1 -2
  47. package/src/machine/activity/specify_bets_activity.js +0 -1
  48. package/src/machine/activity/specify_turnover_activity.js +0 -1
  49. package/src/machine/activity/time_bomb_activity.js +0 -1
  50. package/src/machine/activity/vip_card_activity.js +0 -1
  51. package/src/machine/auth.js +112 -113
  52. package/src/machine/auth_otp_v3.js +11 -8
  53. package/src/machine/bank_binding.js +2 -3
  54. package/src/machine/common.js +14 -112
  55. package/src/machine/deposit/crypto_bank_cash.js +20 -35
  56. package/src/machine/deposit/crypto_qrcode_cash.js +26 -64
  57. package/src/machine/deposit/crypto_way_cash.js +48 -37
  58. package/src/machine/deposit/direct_cash.js +8 -10
  59. package/src/machine/deposit/index.js +0 -28
  60. package/src/machine/deposit/loadcard_cash.js +14 -32
  61. package/src/machine/deposit/manual_cash.js +18 -28
  62. package/src/machine/deposit/qrcode_cash.js +15 -32
  63. package/src/machine/deposit/usdt_cash.js +1 -15
  64. package/src/machine/deposit/virtual_bank_cash.js +13 -12
  65. package/src/machine/error.js +7 -1
  66. package/src/machine/game_betslip.js +0 -1
  67. package/src/machine/game_favorite_v2.js +0 -1
  68. package/src/machine/game_info.js +1 -13
  69. package/src/machine/game_search_cash.js +2 -13
  70. package/src/machine/game_v2_1.js +42 -166
  71. package/src/machine/honor_board_cash.js +8 -11
  72. package/src/machine/inbox.js +43 -105
  73. package/src/machine/index.js +0 -32
  74. package/src/machine/leaderboard.js +8 -12
  75. package/src/machine/navbar.js +1 -3
  76. package/src/machine/ranking.js +45 -30
  77. package/src/machine/reward_cash.js +0 -40
  78. package/src/machine/roulette_v2.js +14 -11
  79. package/src/machine/setting.js +0 -1
  80. package/src/machine/side_cash.js +3 -3
  81. package/src/machine/user_info.js +0 -1
  82. package/src/machine/user_photo.js +0 -1
  83. package/src/machine/user_reset_password.js +0 -14
  84. package/src/machine/user_sign_up.js +46 -61
  85. package/src/machine/websocket.js +18 -62
  86. package/src/machine/withdraw/index.js +0 -6
  87. package/src/machine/withdraw/withdraw_manual_cash.js +59 -39
  88. package/src/request/config.js +2 -0
  89. package/src/request/request.js +49 -60
  90. package/src/util/amount.js +8 -0
  91. package/src/util/constant.js +0 -1
  92. package/src/util/err998SentryExtra.js +26 -0
  93. package/src/util/index.js +2 -4
  94. package/src/util/paramStore.js +139 -0
  95. package/src/util/storage.js +3 -4
  96. package/BREAKING_CHANGES.md +0 -9
  97. package/resetGitBranch.sh +0 -101
  98. package/src/lib/fingerprint_v3_11_12.js +0 -11433
  99. package/src/machine/activity/activity.js +0 -213
  100. package/src/machine/activity/diamond_shop_activity_fc.js +0 -197
  101. package/src/machine/activity/diamond_shop_activity_vn.js +0 -179
  102. package/src/machine/activity/invite_friends_activity.js +0 -115
  103. package/src/machine/activity/mini_game_activity.js +0 -69
  104. package/src/machine/activity/return_bonus_activity.js +0 -155
  105. package/src/machine/auth_otp_v2.js +0 -178
  106. package/src/machine/bank_binding_amb.js +0 -146
  107. package/src/machine/bonus.js +0 -76
  108. package/src/machine/deposit/amb.js +0 -93
  109. package/src/machine/deposit/crypto_bank.js +0 -340
  110. package/src/machine/deposit/crypto_qrcode.js +0 -158
  111. package/src/machine/deposit/crypto_way.js +0 -253
  112. package/src/machine/deposit/deposit_fc.js +0 -272
  113. package/src/machine/deposit/direct.js +0 -311
  114. package/src/machine/deposit/float.js +0 -375
  115. package/src/machine/deposit/krway.js +0 -152
  116. package/src/machine/deposit/loadcard_vn.js +0 -352
  117. package/src/machine/deposit/manual_vn.js +0 -463
  118. package/src/machine/deposit/qrcode_v2.js +0 -339
  119. package/src/machine/deposit/usdt.js +0 -163
  120. package/src/machine/deposit/virtual_bank_vn.js +0 -270
  121. package/src/machine/deposit/vpay.js +0 -374
  122. package/src/machine/game_hot_new.js +0 -91
  123. package/src/machine/game_replay.js +0 -47
  124. package/src/machine/game_search_v2.js +0 -402
  125. package/src/machine/honor_board.js +0 -144
  126. package/src/machine/merge.js +0 -58
  127. package/src/machine/payment_data.js +0 -87
  128. package/src/machine/promotions.js +0 -163
  129. package/src/machine/reward.js +0 -256
  130. package/src/machine/reward_fc.js +0 -99
  131. package/src/machine/side.js +0 -160
  132. package/src/machine/side_v2.js +0 -223
  133. package/src/machine/vip_table.js +0 -58
  134. package/src/machine/welcome.js +0 -111
  135. package/src/machine/withdraw/withdraw_crypto_cash.js +0 -328
  136. package/src/machine/withdraw/withdraw_krway.js +0 -223
  137. package/src/machine/withdraw/withdraw_manual.js +0 -541
  138. package/src/util/deviceToken.js +0 -60
  139. package/src/util/math.js +0 -4
  140. package/test/api.behavior.test.js +0 -69
  141. package/test/api.contract.test.js +0 -18
  142. package/test/config.test.js +0 -27
  143. package/test/deviceToken.test.js +0 -139
  144. package/test/helpers.coverage.test.js +0 -11
  145. package/test/helpers.js +0 -91
  146. package/test/index.exports.test.js +0 -14
  147. package/test/machine.activity.core.coverage.test.js +0 -337
  148. package/test/machine.activity.gap.coverage.test.js +0 -252
  149. package/test/machine.activity.more.coverage.test.js +0 -180
  150. package/test/machine.activity_plus_and_binding_amb.coverage.test.js +0 -201
  151. package/test/machine.activity_timer_bonus.coverage.test.js +0 -136
  152. package/test/machine.activity_welcome.low.coverage.test.js +0 -211
  153. package/test/machine.amb_rewardfc_websocket.more.coverage.test.js +0 -201
  154. package/test/machine.auth.coverage.test.js +0 -215
  155. package/test/machine.bank_binding.test.js +0 -143
  156. package/test/machine.binding_otp_krway.coverage.test.js +0 -223
  157. package/test/machine.contract.test.js +0 -50
  158. package/test/machine.crypto_bank.coverage.test.js +0 -270
  159. package/test/machine.crypto_way.coverage.test.js +0 -108
  160. package/test/machine.crypto_way_cash.coverage.test.js +0 -114
  161. package/test/machine.definition.test.js +0 -137
  162. package/test/machine.deposit.manual.coverage.test.js +0 -365
  163. package/test/machine.deposit_fc.coverage.test.js +0 -126
  164. package/test/machine.direct.coverage.test.js +0 -96
  165. package/test/machine.direct_cash.coverage.test.js +0 -108
  166. package/test/machine.error.coverage.test.js +0 -37
  167. package/test/machine.events.test.js +0 -126
  168. package/test/machine.favorite_jackpot.coverage.test.js +0 -82
  169. package/test/machine.float.coverage.test.js +0 -136
  170. package/test/machine.flow.test.js +0 -226
  171. package/test/machine.game_hot_new_vip_table.coverage.test.js +0 -105
  172. package/test/machine.game_search_cash.coverage.test.js +0 -195
  173. package/test/machine.game_search_v2.test.js +0 -199
  174. package/test/machine.game_user_profile.coverage.test.js +0 -100
  175. package/test/machine.honor_board.test.js +0 -148
  176. package/test/machine.inbox.common.coverage.test.js +0 -304
  177. package/test/machine.loadcard_cash.coverage.test.js +0 -101
  178. package/test/machine.loadcard_vn.coverage.test.js +0 -122
  179. package/test/machine.misc.coverage.test.js +0 -361
  180. package/test/machine.more2.coverage.test.js +0 -261
  181. package/test/machine.options.execution.test.js +0 -272
  182. package/test/machine.priority.coverage.test.js +0 -629
  183. package/test/machine.qrcode_cash.coverage.test.js +0 -107
  184. package/test/machine.qrcode_v2.coverage.test.js +0 -121
  185. package/test/machine.regression.test.js +0 -82
  186. package/test/machine.roulette_v2.test.js +0 -142
  187. package/test/machine.side_reward_reset.coverage.test.js +0 -220
  188. package/test/machine.targeted.coverage.test.js +0 -313
  189. package/test/machine.usdt.coverage.test.js +0 -95
  190. package/test/machine.usdt_cash.coverage.test.js +0 -73
  191. package/test/machine.vip_card_activity.test.js +0 -114
  192. package/test/machine.virtual_bank_cash.coverage.test.js +0 -105
  193. package/test/machine.virtual_bank_vn.coverage.test.js +0 -105
  194. package/test/machine.vpay.coverage.test.js +0 -142
  195. package/test/machine.withdraw_crypto_cash.coverage.test.js +0 -166
  196. package/test/machine.withdraw_krway.coverage.test.js +0 -123
  197. package/test/machine.withdraw_manual.coverage.test.js +0 -185
  198. package/test/machine.withdraw_manual_cash.coverage.test.js +0 -123
  199. package/test/request.test.js +0 -325
  200. package/test/util.storage.errors.test.js +0 -47
  201. package/test/util.test.js +0 -41
@@ -1,340 +0,0 @@
1
- import { assign, createMachine } from 'xstate'
2
- import padStart from 'lodash/padStart.js'
3
- import payment from '../../api/payment.js'
4
-
5
- export default function (request) {
6
- const { appSecret } = request.config
7
- return createMachine(
8
- {
9
- id: 'crypto_bank',
10
- predictableActionArguments: true,
11
- initial: 'loading',
12
- context: {
13
- paymentDetails: [],
14
-
15
- cryptos: [],
16
- addresses: [],
17
- cryptoBank: null,
18
-
19
- amount: null,
20
- selectedCrypto: null,
21
- selectedAddress: null,
22
- selectedBank: null,
23
-
24
- currentCategory: 'cryptoBank',
25
- currentPayment: null,
26
-
27
- calculation: null,
28
- processing: null,
29
- result: null,
30
-
31
- depositTime: null,
32
- receipt: null,
33
- proofOptional: false,
34
-
35
- // use for wallet mode 4
36
- promotion: null,
37
- },
38
- states: {
39
- loading: {
40
- initial: 'init1',
41
- states: {
42
- init1: {
43
- invoke: {
44
- src: 'fetchPayments',
45
- onDone: {
46
- target: 'init2',
47
- actions: 'setPayment',
48
- },
49
- onError: {
50
- target: '#crypto_bank.fail',
51
- },
52
- },
53
- },
54
- init2: {
55
- always: [
56
- {
57
- target: '#crypto_bank.processing',
58
- cond: 'isProcessing',
59
- },
60
- { target: '#crypto_bank.loaded' },
61
- ],
62
- },
63
- },
64
- },
65
- loaded: {
66
- always: [{ target: 'debouncing', cond: 'isCalculable' }],
67
- },
68
- debouncing: {
69
- after: {
70
- 1000: {
71
- target: 'calculating',
72
- },
73
- },
74
- },
75
- calculating: {
76
- invoke: {
77
- src: 'fetchCalculation',
78
- onDone: {
79
- target: 'calculated',
80
- actions: 'setCalculation',
81
- },
82
- onError: {
83
- target: 'loaded',
84
- },
85
- },
86
- },
87
- calculated: {
88
- on: {
89
- SUBMIT: [
90
- {
91
- target: 'submitting',
92
- cond: 'isSubmittable',
93
- },
94
- {
95
- target: 'pending',
96
- },
97
- ],
98
- },
99
- },
100
- pending: {
101
- on: {
102
- SUBMIT: {
103
- target: 'submitting',
104
- cond: 'isSubmittable',
105
- },
106
- },
107
- },
108
- submitting: {
109
- invoke: {
110
- src: 'submitDeposit',
111
- onDone: {
112
- target: 'submitted',
113
- actions: 'setResult',
114
- },
115
- onError: {
116
- target: 'submitFail',
117
- },
118
- },
119
- },
120
- submitFail: {
121
- after: {
122
- 0: { target: 'loaded' },
123
- },
124
- },
125
- processing: {},
126
- submitted: {},
127
- fail: {},
128
- },
129
- on: {
130
- SET_CRYPTO: {
131
- target: '.loaded',
132
- actions: 'setCrypto',
133
- },
134
- SET_ADDRESS: {
135
- target: '.loaded',
136
- actions: 'setAddress',
137
- },
138
- SET_AMOUNT: {
139
- target: '.loaded',
140
- actions: ['setAmount', 'clearCalculation'],
141
- },
142
- SET_PROOF_OPTIONAL: {
143
- actions: 'setProofOptional',
144
- },
145
- CALCULATE: {
146
- target: '.debouncing',
147
- actions: 'clearCalculation',
148
- },
149
- SET_DEPOSIT_TIME: {
150
- actions: 'setDepositTime',
151
- },
152
- SET_RECEIPT: {
153
- actions: 'setReceipt',
154
- },
155
- SET_PROMOTION: {
156
- actions: 'setPromotion',
157
- },
158
- },
159
- },
160
- {
161
- actions: {
162
- setPayment: assign((context, event) => {
163
- const cryptoBank = event.data.find((element) => element.category === context.currentCategory)
164
- cryptoBank.banks = (cryptoBank.banks || []).map((crypto) => ({
165
- ...crypto,
166
- label: crypto.cryptoName,
167
- value: cryptoBank.method,
168
- icon: crypto.symbol,
169
- }))
170
- const defaultCrypto = []
171
- cryptoBank.banks?.forEach((bank) => {
172
- var existingCryptoName = defaultCrypto.find((item) => {
173
- return item.cryptoName === bank.cryptoName
174
- })
175
-
176
- if (!existingCryptoName) {
177
- defaultCrypto.push(bank)
178
- }
179
- })
180
- const currentPayment = {
181
- label: defaultCrypto[0]?.network,
182
- value: defaultCrypto[0]?.network,
183
- icon: defaultCrypto[0]?.network,
184
- }
185
- const defaultAddresses = (cryptoBank.banks || [])
186
- .filter((element) => element.cryptoName === defaultCrypto[0].cryptoName)
187
- .map((value, i) => {
188
- return {
189
- label: value.address,
190
- value: value.address,
191
- icon: null,
192
- }
193
- })
194
-
195
- return {
196
- cryptos: defaultCrypto,
197
- addresses: defaultAddresses,
198
- cryptoBank,
199
- selectedCrypto: defaultCrypto[0],
200
- selectedAddress: defaultAddresses[0],
201
- options: defaultCrypto[0]?.optional,
202
- currentPayment,
203
- processing: cryptoBank.processing?.[0],
204
- }
205
- }),
206
- setCrypto: assign((context, event) => {
207
- const { cryptoBank } = context
208
- if (!cryptoBank?.banks?.length) {
209
- return {}
210
- }
211
- const selectedCrypto = cryptoBank.banks.find((bank) => bank.label === event.data.label)
212
- if (!selectedCrypto) {
213
- return {}
214
- }
215
- const addresses = cryptoBank.banks
216
- .filter((element) => element.cryptoName === selectedCrypto.cryptoName)
217
- .map((value, i) => {
218
- return {
219
- label: value.address,
220
- value: value.address,
221
- icon: null,
222
- }
223
- })
224
- return {
225
- addresses,
226
- selectedCrypto: selectedCrypto,
227
- selectedAddress: addresses[0],
228
- selectedAmount: null,
229
- calculation: null,
230
- options: cryptoBank.optional,
231
- }
232
- }),
233
- setAddress: assign((context, event) => {
234
- const { cryptoBank, selectedCrypto } = context
235
- if (!cryptoBank?.banks?.length || !selectedCrypto) {
236
- return {}
237
- }
238
- const selectedCryptoByAddress = cryptoBank.banks.find((bank) => bank.label === selectedCrypto.label && bank.address === event.data.value)
239
- return {
240
- selectedCrypto: selectedCryptoByAddress,
241
- selectedAddress: event.data,
242
- }
243
- }),
244
- setAmount: assign((context, event) => {
245
- return {
246
- amount: event.data,
247
- }
248
- }),
249
- setCalculation: assign((context, event) => {
250
- // V2接口轉換中回傳的資料結構不同
251
- const { data } = event.data
252
- if (data) {
253
- return {
254
- calculation: data,
255
- }
256
- } else {
257
- return {
258
- calculation: event.data,
259
- }
260
- }
261
- }),
262
- clearCalculation: assign((context, event) => {
263
- return {
264
- calculation: null,
265
- }
266
- }),
267
- setResult: assign((context, event) => {
268
- return {
269
- result: event.data,
270
- }
271
- }),
272
- setProofOptional: assign((context, event) => {
273
- return {
274
- proofOptional: event.data,
275
- }
276
- }),
277
- setDepositTime: assign((context, event) => {
278
- return {
279
- depositTime: event.data,
280
- }
281
- }),
282
- setReceipt: assign((context, event) => {
283
- return {
284
- receipt: event.data,
285
- }
286
- }),
287
- setPromotion: assign((context, event) => {
288
- const promotion = event.data
289
- return {
290
- promotion,
291
- }
292
- }),
293
- },
294
- guards: {
295
- isCalculable: (context, event) => {
296
- const { selectedCrypto, selectedAddress, cryptoBank, amount } = context
297
- return selectedCrypto && selectedAddress && amount && cryptoBank.minimum <= +amount && +amount <= cryptoBank.maximum
298
- },
299
- isSubmittable: (context, event) => {
300
- const { selectedCrypto, selectedAddress, amount, depositTime, receipt, proofOptional } = context
301
- return selectedCrypto && selectedAddress && amount && depositTime && (receipt || proofOptional)
302
- },
303
- isProcessing: (context, event) => {
304
- return context.processing
305
- },
306
- },
307
- services: {
308
- fetchPayments: async (context, event) => {
309
- return await request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' }))
310
- },
311
- fetchCalculation: async (context, event) => {
312
- const { selectedCrypto, amount, promotion } = context
313
- return await request.send(
314
- payment.getCryptoDepositExpectedResult({
315
- method: selectedCrypto.value,
316
- amount,
317
- cryptoCurrency: selectedCrypto.symbol,
318
- promotionsNo: promotion?.activityNo,
319
- })
320
- )
321
- },
322
- submitDeposit: async (context, event) => {
323
- const { selectedCrypto, depositTime, receipt, amount, promotion } = context
324
- return await request.send(
325
- payment.submitDepositTransactionCryptoBank({
326
- method: selectedCrypto.value,
327
- amount: amount,
328
- cryptoCurrency: selectedCrypto.symbol,
329
- cryptoNetwork: selectedCrypto.network,
330
- sourceAddress: selectedCrypto.address,
331
- promotionsNo: promotion?.activityNo,
332
- depositTime,
333
- receipt,
334
- })
335
- )
336
- },
337
- },
338
- }
339
- )
340
- }
@@ -1,158 +0,0 @@
1
- import { assign, createMachine } from 'xstate'
2
- import payment from '../../api/payment.js'
3
-
4
- export default function (request) {
5
- return createMachine(
6
- {
7
- id: 'crypto_qrcode',
8
- predictableActionArguments: true,
9
- initial: 'loading',
10
- context: {
11
- paymentDetails: [],
12
- currentCategory: 'cryptoQrcode',
13
- currentPayment: null,
14
- cryptos: [],
15
- selectedCrypto: null,
16
-
17
- resultMap: {},
18
- result: {
19
- action: '',
20
- cdtime: null,
21
- accountNumber: '', // crypto address
22
- currency: '',
23
- network: '',
24
- name: '',
25
- qrcode: '',
26
- },
27
- },
28
- states: {
29
- loading: {
30
- invoke: {
31
- src: 'fetchPaymentDetail',
32
- onDone: {
33
- target: 'fetching',
34
- actions: 'setInitData',
35
- },
36
- onError: {
37
- target: 'fail',
38
- },
39
- },
40
- },
41
- finding: {
42
- always: [
43
- {
44
- target: 'idle',
45
- actions: 'setResultFromLocal',
46
- cond: 'isFound',
47
- },
48
- {
49
- target: 'fetching',
50
- },
51
- ],
52
- },
53
- fetching: {
54
- invoke: {
55
- src: 'submitDeposit',
56
- onDone: {
57
- target: 'idle',
58
- actions: 'setResult',
59
- },
60
- onError: {
61
- target: 'idle',
62
- },
63
- },
64
- },
65
- idle: {},
66
- fail: {},
67
- },
68
- on: {
69
- SET_CRYPTO: {
70
- target: '.finding',
71
- actions: 'setCrypto',
72
- },
73
- },
74
- },
75
- {
76
- actions: {
77
- setInitData: assign((context, event) => {
78
- const paymentDetail = event.data || []
79
- const payments = paymentDetail.filter((item) => item.transferType === 'deposit' && item.category === context.currentCategory)
80
- const cryptos = payments?.map((value, i) => {
81
- return {
82
- ...value,
83
- label: value?.cryptoOptional[0],
84
- network: value?.networkName[0],
85
- icon: value?.channel,
86
- }
87
- })
88
- return {
89
- cryptos,
90
- selectedCrypto: cryptos[0],
91
- currentPayment: cryptos[0],
92
- }
93
- }),
94
- setCrypto: assign((context, event) => {
95
- const { cryptos } = context
96
- const selectedCrypto = cryptos.find((crypto) => crypto.label === event.data.label)
97
- if (!selectedCrypto) {
98
- return {}
99
- }
100
- return { selectedCrypto }
101
- }),
102
- setResultFromLocal: assign((context, event) => {
103
- const { resultMap, selectedCrypto } = context
104
- if (!selectedCrypto) {
105
- return {}
106
- }
107
- return { result: resultMap[selectedCrypto.network] }
108
- }),
109
- setResult: assign((context, event) => {
110
- const { resultMap, selectedCrypto } = context
111
- const { action, cdtime, accountNumber, currency, network, name, qrcode, redirect } = event.data
112
- const result = {
113
- action,
114
- cdtime,
115
- accountNumber,
116
- currency,
117
- network,
118
- name,
119
- qrcode,
120
- redirect,
121
- }
122
-
123
- return {
124
- result,
125
- resultMap: {
126
- ...resultMap,
127
- [selectedCrypto.network]: result,
128
- },
129
- }
130
- }),
131
- },
132
- guards: {
133
- isFound: (context, event) => {
134
- const { resultMap, selectedCrypto } = context
135
- if (!selectedCrypto) {
136
- return false
137
- }
138
- return resultMap[selectedCrypto.network]
139
- },
140
- },
141
- services: {
142
- fetchPaymentDetail: async (context, event) => {
143
- return await request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' }))
144
- },
145
- submitDeposit: async (context, event) => {
146
- const { currentPayment, selectedCrypto } = context
147
- return await request.send(
148
- payment.submitDepositTransactionCrypto({
149
- method: currentPayment.method,
150
- cryptoCurrency: currentPayment.channel,
151
- cryptoNetwork: selectedCrypto.network,
152
- })
153
- )
154
- },
155
- },
156
- }
157
- )
158
- }