@jetthai/cuora 1.1.283 → 1.1.285
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 +4 -0
- package/package.json +1 -1
- package/src/machine/deposit/crypto_way.js +19 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [1.1.285](https://github.com/jetthai/cuora-module/compare/v1.1.283...v1.1.285) (2024-06-24)
|
|
6
|
+
|
|
7
|
+
### [1.1.284](https://github.com/jetthai/cuora-module/compare/v1.1.283...v1.1.284) (2024-06-24)
|
|
8
|
+
|
|
5
9
|
### [1.1.283](https://github.com/jetthai/cuora-module/compare/v1.1.282...v1.1.283) (2024-06-24)
|
|
6
10
|
|
|
7
11
|
### [1.1.282](https://github.com/jetthai/cuora-module/compare/v1.1.281...v1.1.282) (2024-06-24)
|
package/package.json
CHANGED
|
@@ -110,6 +110,10 @@ export default function (request) {
|
|
|
110
110
|
target: '.loaded',
|
|
111
111
|
actions: ['setAmount', 'clearCalculation'],
|
|
112
112
|
},
|
|
113
|
+
INPUT_AMOUNT: {
|
|
114
|
+
target: '.loaded',
|
|
115
|
+
actions: ['inputAmount', 'clearCalculation'],
|
|
116
|
+
},
|
|
113
117
|
CALCULATE: {
|
|
114
118
|
target: '.debouncing',
|
|
115
119
|
actions: 'clearCalculation',
|
|
@@ -151,6 +155,9 @@ export default function (request) {
|
|
|
151
155
|
amount: event.data,
|
|
152
156
|
}
|
|
153
157
|
}),
|
|
158
|
+
inputAmount: assign((context, event) => {
|
|
159
|
+
return { amount: preciseAdd(`${parseFloat(context.amount || 0)}`, `${parseFloat(event.data)}`) }
|
|
160
|
+
}),
|
|
154
161
|
setAddress: assign((context, event) => {
|
|
155
162
|
return {
|
|
156
163
|
sourceAddress: event.data,
|
|
@@ -218,3 +225,15 @@ export default function (request) {
|
|
|
218
225
|
}
|
|
219
226
|
)
|
|
220
227
|
}
|
|
228
|
+
|
|
229
|
+
function preciseAdd(a, b) {
|
|
230
|
+
let aStr = a.toString()
|
|
231
|
+
let bStr = b.toString()
|
|
232
|
+
|
|
233
|
+
let aDecimalPlaces = aStr.split('.')[1] ? aStr.split('.')[1].length : 0
|
|
234
|
+
let bDecimalPlaces = bStr.split('.')[1] ? bStr.split('.')[1].length : 0
|
|
235
|
+
|
|
236
|
+
let factor = Math.pow(10, Math.max(aDecimalPlaces, bDecimalPlaces))
|
|
237
|
+
|
|
238
|
+
return (Math.round(a * factor) + Math.round(b * factor)) / factor
|
|
239
|
+
}
|