@0xtorch/core 0.0.17 → 0.0.19
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/_cjs/actions/index.js +3 -6
- package/_cjs/actions/index.js.map +1 -1
- package/_cjs/actions/parsers/action.js +0 -8
- package/_cjs/actions/parsers/action.js.map +1 -1
- package/_cjs/actions/parsers/borrow/index.js +1 -3
- package/_cjs/actions/parsers/borrow/index.js.map +1 -1
- package/_cjs/actions/parsers/index.js +1 -2
- package/_cjs/actions/parsers/index.js.map +1 -1
- package/_cjs/actions/schemas/action.js +0 -3
- package/_cjs/actions/schemas/action.js.map +1 -1
- package/_cjs/actions/schemas/borrow/index.js +1 -4
- package/_cjs/actions/schemas/borrow/index.js.map +1 -1
- package/_cjs/actions/schemas/default/unions.js +0 -2
- package/_cjs/actions/schemas/default/unions.js.map +1 -1
- package/_cjs/actions/schemas/index.js +3 -5
- package/_cjs/actions/schemas/index.js.map +1 -1
- package/_cjs/actions/utils.js +0 -38
- package/_cjs/actions/utils.js.map +1 -1
- package/_cjs/index.js +5 -5
- package/_cjs/index.js.map +1 -1
- package/_cjs/setAccountActionPrices.js +73 -0
- package/_cjs/setAccountActionPrices.js.map +1 -0
- package/_esm/actions/index.js +2 -2
- package/_esm/actions/index.js.map +1 -1
- package/_esm/actions/parsers/action.js +1 -9
- package/_esm/actions/parsers/action.js.map +1 -1
- package/_esm/actions/parsers/borrow/index.js +0 -1
- package/_esm/actions/parsers/borrow/index.js.map +1 -1
- package/_esm/actions/parsers/index.js +1 -1
- package/_esm/actions/parsers/index.js.map +1 -1
- package/_esm/actions/schemas/action.js +1 -4
- package/_esm/actions/schemas/action.js.map +1 -1
- package/_esm/actions/schemas/borrow/index.js +0 -1
- package/_esm/actions/schemas/borrow/index.js.map +1 -1
- package/_esm/actions/schemas/default/unions.js +0 -2
- package/_esm/actions/schemas/default/unions.js.map +1 -1
- package/_esm/actions/schemas/index.js +1 -1
- package/_esm/actions/schemas/index.js.map +1 -1
- package/_esm/actions/utils.js +0 -42
- package/_esm/actions/utils.js.map +1 -1
- package/_esm/index.js +2 -1
- package/_esm/index.js.map +1 -1
- package/_esm/setAccountActionPrices.js +72 -0
- package/_esm/setAccountActionPrices.js.map +1 -0
- package/_types/actions/index.d.ts +3 -3
- package/_types/actions/index.d.ts.map +1 -1
- package/_types/actions/parsers/action.d.ts.map +1 -1
- package/_types/actions/parsers/borrow/index.d.ts +0 -1
- package/_types/actions/parsers/borrow/index.d.ts.map +1 -1
- package/_types/actions/parsers/index.d.ts +1 -1
- package/_types/actions/parsers/index.d.ts.map +1 -1
- package/_types/actions/schemas/action.d.ts +8818 -11544
- package/_types/actions/schemas/action.d.ts.map +1 -1
- package/_types/actions/schemas/borrow/index.d.ts +0 -1
- package/_types/actions/schemas/borrow/index.d.ts.map +1 -1
- package/_types/actions/schemas/default/accountAction.d.ts +9 -9
- package/_types/actions/schemas/default/normalAction.d.ts +9 -9
- package/_types/actions/schemas/default/unions.d.ts +2 -2
- package/_types/actions/schemas/default/unions.d.ts.map +1 -1
- package/_types/actions/schemas/index.d.ts +1 -1
- package/_types/actions/schemas/index.d.ts.map +1 -1
- package/_types/actions/types/index.d.ts +0 -1
- package/_types/actions/types/index.d.ts.map +1 -1
- package/_types/actions/utils.d.ts.map +1 -1
- package/_types/index.d.ts +3 -2
- package/_types/index.d.ts.map +1 -1
- package/_types/{actions/schemas/borrow/borrowWithDebt.d.ts → setAccountActionPrices.d.ts} +2271 -1370
- package/_types/{actions/schemas/borrow/borrowWithDebt.d.ts.map → setAccountActionPrices.d.ts.map} +1 -1
- package/actions/index.ts +0 -5
- package/actions/parsers/action.ts +1 -12
- package/actions/parsers/borrow/index.ts +0 -1
- package/actions/parsers/index.ts +1 -4
- package/actions/schemas/action.ts +1 -9
- package/actions/schemas/borrow/index.ts +0 -4
- package/actions/schemas/default/unions.ts +0 -2
- package/actions/schemas/index.ts +1 -6
- package/actions/types/index.ts +0 -4
- package/actions/utils.ts +0 -62
- package/index.ts +1 -4
- package/package.json +1 -1
- package/setAccountActionPrices.ts +123 -0
- package/_cjs/actions/parsers/borrow/borrowWithDebt.js +0 -23
- package/_cjs/actions/parsers/borrow/borrowWithDebt.js.map +0 -1
- package/_cjs/actions/schemas/borrow/borrowWithDebt.js +0 -36
- package/_cjs/actions/schemas/borrow/borrowWithDebt.js.map +0 -1
- package/_cjs/actions/types/borrowWithDebt.js +0 -3
- package/_cjs/actions/types/borrowWithDebt.js.map +0 -1
- package/_esm/actions/parsers/borrow/borrowWithDebt.js +0 -19
- package/_esm/actions/parsers/borrow/borrowWithDebt.js.map +0 -1
- package/_esm/actions/schemas/borrow/borrowWithDebt.js +0 -33
- package/_esm/actions/schemas/borrow/borrowWithDebt.js.map +0 -1
- package/_esm/actions/types/borrowWithDebt.js +0 -2
- package/_esm/actions/types/borrowWithDebt.js.map +0 -1
- package/_types/actions/parsers/borrow/borrowWithDebt.d.ts +0 -4
- package/_types/actions/parsers/borrow/borrowWithDebt.d.ts.map +0 -1
- package/_types/actions/types/borrowWithDebt.d.ts +0 -5
- package/_types/actions/types/borrowWithDebt.d.ts.map +0 -1
- package/actions/parsers/borrow/borrowWithDebt.ts +0 -47
- package/actions/schemas/borrow/borrowWithDebt.ts +0 -45
- package/actions/types/borrowWithDebt.ts +0 -13
package/_types/{actions/schemas/borrow/borrowWithDebt.d.ts.map → setAccountActionPrices.d.ts.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"
|
|
1
|
+
{"version":3,"file":"setAccountActionPrices.d.ts","sourceRoot":"","sources":["../setAccountActionPrices.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAC9C,OAAO,KAAK,EAEV,wBAAwB,EAExB,YAAY,EACb,MAAM,UAAU,CAAA;AAEjB,KAAK,gCAAgC,GAAG;IACtC,QAAQ,CAAC,OAAO,EAAE,SAAS,aAAa,EAAE,CAAA;IAC1C,QAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAqBlC,CAAA"}
|
package/actions/index.ts
CHANGED
|
@@ -3,7 +3,6 @@ export {
|
|
|
3
3
|
parseNormalActionApproveToAccountActions,
|
|
4
4
|
parseNormalActionAtomicArbitrageToAccountActions,
|
|
5
5
|
parseNormalActionBorrowToAccountActions,
|
|
6
|
-
parseNormalActionBorrowWithDebtToAccountActions,
|
|
7
6
|
parseNormalActionBridgeFromToAccountActions,
|
|
8
7
|
parseNormalActionBridgeToToAccountActions,
|
|
9
8
|
parseNormalActionBuyCryptoToAccountActions,
|
|
@@ -46,7 +45,6 @@ export {
|
|
|
46
45
|
accountActionApproveSchema,
|
|
47
46
|
accountActionAtomicArbitrageSchema,
|
|
48
47
|
accountActionBorrowSchema,
|
|
49
|
-
accountActionBorrowWithDebtSchema,
|
|
50
48
|
accountActionBridgeFromSchema,
|
|
51
49
|
accountActionBridgeToSchema,
|
|
52
50
|
accountActionBuyCryptoSchema,
|
|
@@ -96,7 +94,6 @@ export {
|
|
|
96
94
|
normalActionApproveSchema,
|
|
97
95
|
normalActionAtomicArbitrageSchema,
|
|
98
96
|
normalActionBorrowSchema,
|
|
99
|
-
normalActionBorrowWithDebtSchema,
|
|
100
97
|
normalActionBridgeFromSchema,
|
|
101
98
|
normalActionBridgeToSchema,
|
|
102
99
|
normalActionBuyCryptoSchema,
|
|
@@ -140,7 +137,6 @@ export type {
|
|
|
140
137
|
AccountActionApprove,
|
|
141
138
|
AccountActionAtomicArbitrage,
|
|
142
139
|
AccountActionBorrow,
|
|
143
|
-
AccountActionBorrowWithDebt,
|
|
144
140
|
AccountActionBridgeFrom,
|
|
145
141
|
AccountActionBridgeTo,
|
|
146
142
|
AccountActionBuyCrypto,
|
|
@@ -193,7 +189,6 @@ export type {
|
|
|
193
189
|
NormalActionApprove,
|
|
194
190
|
NormalActionAtomicArbitrage,
|
|
195
191
|
NormalActionBorrow,
|
|
196
|
-
NormalActionBorrowWithDebt,
|
|
197
192
|
NormalActionBridgeFrom,
|
|
198
193
|
NormalActionBridgeTo,
|
|
199
194
|
NormalActionBuyCrypto,
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import type { AccountAction, NormalAction } from '../types'
|
|
2
|
-
import {
|
|
3
|
-
parseNormalActionBorrowToAccountActions,
|
|
4
|
-
parseNormalActionBorrowWithDebtToAccountActions,
|
|
5
|
-
} from './borrow'
|
|
2
|
+
import { parseNormalActionBorrowToAccountActions } from './borrow'
|
|
6
3
|
import {
|
|
7
4
|
parseNormalActionBridgeFromToAccountActions,
|
|
8
5
|
parseNormalActionBridgeToToAccountActions,
|
|
@@ -260,14 +257,6 @@ export const parseNormalActionToAccountActions = ({
|
|
|
260
257
|
cexAccountIds,
|
|
261
258
|
})
|
|
262
259
|
}
|
|
263
|
-
case 'borrow-with-debt': {
|
|
264
|
-
return parseNormalActionBorrowWithDebtToAccountActions({
|
|
265
|
-
action,
|
|
266
|
-
accountIds,
|
|
267
|
-
source,
|
|
268
|
-
cexAccountIds,
|
|
269
|
-
})
|
|
270
|
-
}
|
|
271
260
|
case 'swap-nft': {
|
|
272
261
|
return parseNormalActionSwapNftToAccountActions({
|
|
273
262
|
action,
|
package/actions/parsers/index.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
export { parseNormalActionToAccountActions } from './action'
|
|
2
|
-
export {
|
|
3
|
-
parseNormalActionBorrowToAccountActions,
|
|
4
|
-
parseNormalActionBorrowWithDebtToAccountActions,
|
|
5
|
-
} from './borrow'
|
|
2
|
+
export { parseNormalActionBorrowToAccountActions } from './borrow'
|
|
6
3
|
export {
|
|
7
4
|
parseNormalActionBridgeFromToAccountActions,
|
|
8
5
|
parseNormalActionBridgeToToAccountActions,
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod'
|
|
2
|
-
import {
|
|
3
|
-
accountActionBorrowSchema,
|
|
4
|
-
accountActionBorrowWithDebtSchema,
|
|
5
|
-
normalActionBorrowSchema,
|
|
6
|
-
normalActionBorrowWithDebtSchema,
|
|
7
|
-
} from './borrow'
|
|
2
|
+
import { accountActionBorrowSchema, normalActionBorrowSchema } from './borrow'
|
|
8
3
|
import {
|
|
9
4
|
accountActionBridgeFromSchema,
|
|
10
5
|
accountActionBridgeToSchema,
|
|
@@ -117,7 +112,6 @@ import {
|
|
|
117
112
|
export const normalActionSchema = z.union([
|
|
118
113
|
// borrow
|
|
119
114
|
normalActionBorrowSchema,
|
|
120
|
-
normalActionBorrowWithDebtSchema,
|
|
121
115
|
// cross replace
|
|
122
116
|
normalActionBridgeFromSchema,
|
|
123
117
|
normalActionBridgeToSchema,
|
|
@@ -173,7 +167,6 @@ export const normalActionSchema = z.union([
|
|
|
173
167
|
|
|
174
168
|
export const normalActionActionSchema = z.union([
|
|
175
169
|
z.literal('borrow'),
|
|
176
|
-
z.literal('borrow-with-debt'),
|
|
177
170
|
z.literal('bridge-from'),
|
|
178
171
|
z.literal('bridge-to'),
|
|
179
172
|
z.literal('cross-replace'),
|
|
@@ -217,7 +210,6 @@ export const normalActionActionSchema = z.union([
|
|
|
217
210
|
export const accountActionSchema = z.union([
|
|
218
211
|
// borrow
|
|
219
212
|
accountActionBorrowSchema,
|
|
220
|
-
accountActionBorrowWithDebtSchema,
|
|
221
213
|
// cross replace
|
|
222
214
|
accountActionBridgeFromSchema,
|
|
223
215
|
accountActionBridgeToSchema,
|
|
@@ -5,7 +5,6 @@ const normalActions = [
|
|
|
5
5
|
'approve',
|
|
6
6
|
'atomic-arbitrage',
|
|
7
7
|
'borrow',
|
|
8
|
-
'borrow-with-debt',
|
|
9
8
|
'bridge-from',
|
|
10
9
|
'bridge-to',
|
|
11
10
|
'buy-nft',
|
|
@@ -44,7 +43,6 @@ const accountActions = [
|
|
|
44
43
|
'approve',
|
|
45
44
|
'atomic-arbitrage',
|
|
46
45
|
'borrow',
|
|
47
|
-
'borrow-with-debt',
|
|
48
46
|
'bridge-from',
|
|
49
47
|
'bridge-to',
|
|
50
48
|
'buy-nft',
|
package/actions/schemas/index.ts
CHANGED
|
@@ -3,12 +3,7 @@ export {
|
|
|
3
3
|
normalActionActionSchema,
|
|
4
4
|
normalActionSchema,
|
|
5
5
|
} from './action'
|
|
6
|
-
export {
|
|
7
|
-
accountActionBorrowSchema,
|
|
8
|
-
accountActionBorrowWithDebtSchema,
|
|
9
|
-
normalActionBorrowSchema,
|
|
10
|
-
normalActionBorrowWithDebtSchema,
|
|
11
|
-
} from './borrow'
|
|
6
|
+
export { accountActionBorrowSchema, normalActionBorrowSchema } from './borrow'
|
|
12
7
|
export { crossActionBundleSchema } from './crossActionBundle'
|
|
13
8
|
export {
|
|
14
9
|
accountActionBridgeFromSchema,
|
package/actions/types/index.ts
CHANGED
|
@@ -17,10 +17,6 @@ export type {
|
|
|
17
17
|
NormalActionAtomicArbitrage,
|
|
18
18
|
} from './atomicArbitrage'
|
|
19
19
|
export type { AccountActionBorrow, NormalActionBorrow } from './borrow'
|
|
20
|
-
export type {
|
|
21
|
-
AccountActionBorrowWithDebt,
|
|
22
|
-
NormalActionBorrowWithDebt,
|
|
23
|
-
} from './borrowWithDebt'
|
|
24
20
|
export type {
|
|
25
21
|
AccountActionBridgeFrom,
|
|
26
22
|
NormalActionBridgeFrom,
|
package/actions/utils.ts
CHANGED
|
@@ -3,7 +3,6 @@ import type {
|
|
|
3
3
|
AccountActionApprove,
|
|
4
4
|
AccountActionAtomicArbitrage,
|
|
5
5
|
AccountActionBorrow,
|
|
6
|
-
AccountActionBorrowWithDebt,
|
|
7
6
|
AccountActionBridgeFrom,
|
|
8
7
|
AccountActionBridgeTo,
|
|
9
8
|
AccountActionBuyCrypto,
|
|
@@ -49,7 +48,6 @@ import type {
|
|
|
49
48
|
NormalActionApprove,
|
|
50
49
|
NormalActionAtomicArbitrage,
|
|
51
50
|
NormalActionBorrow,
|
|
52
|
-
NormalActionBorrowWithDebt,
|
|
53
51
|
NormalActionBridgeFrom,
|
|
54
52
|
NormalActionBridgeTo,
|
|
55
53
|
NormalActionBuyCrypto,
|
|
@@ -228,34 +226,6 @@ export const parseBaseNormalActionToNormalAction = (
|
|
|
228
226
|
transfers,
|
|
229
227
|
} satisfies NormalActionBorrow
|
|
230
228
|
}
|
|
231
|
-
case 'borrow-with-debt': {
|
|
232
|
-
const transfers = action.transfers.filter(
|
|
233
|
-
(
|
|
234
|
-
transfer,
|
|
235
|
-
): transfer is
|
|
236
|
-
| TransferCryptoCurrencyIn
|
|
237
|
-
| TransferNftIn
|
|
238
|
-
| TransferCryptoCurrencyOut
|
|
239
|
-
| TransferNftOut =>
|
|
240
|
-
isTransferCryptoCurrencyIn(transfer) ||
|
|
241
|
-
isTransferNftIn(transfer) ||
|
|
242
|
-
isTransferCryptoCurrencyOut(transfer) ||
|
|
243
|
-
isTransferNftOut(transfer),
|
|
244
|
-
)
|
|
245
|
-
if (transfers.length !== action.transfers.length) {
|
|
246
|
-
throw new Error('Invalid action.transfers for borrow-with-debt')
|
|
247
|
-
}
|
|
248
|
-
if (action.loanId === undefined) {
|
|
249
|
-
throw new Error('action.loandId is required for borrow-with-debt')
|
|
250
|
-
}
|
|
251
|
-
return {
|
|
252
|
-
...action,
|
|
253
|
-
type: 'LoanNormalAction',
|
|
254
|
-
action: 'borrow-with-debt',
|
|
255
|
-
loanId: action.loanId,
|
|
256
|
-
transfers,
|
|
257
|
-
} satisfies NormalActionBorrowWithDebt
|
|
258
|
-
}
|
|
259
229
|
case 'bridge-from': {
|
|
260
230
|
const transfers = action.transfers.filter(
|
|
261
231
|
(transfer): transfer is TransferCryptoCurrencyOut | TransferNftOut =>
|
|
@@ -1081,38 +1051,6 @@ export const parseBaseAccountActionToAccountAction = (
|
|
|
1081
1051
|
transfers,
|
|
1082
1052
|
} satisfies AccountActionBorrow
|
|
1083
1053
|
}
|
|
1084
|
-
case 'borrow-with-debt': {
|
|
1085
|
-
// transferCryptoCurrencyInSchema,
|
|
1086
|
-
// transferNftInSchema,
|
|
1087
|
-
// transferCryptoCurrencyOutSchema,
|
|
1088
|
-
// transferNftOutSchema,
|
|
1089
|
-
const transfers = action.transfers.filter(
|
|
1090
|
-
(
|
|
1091
|
-
transfer,
|
|
1092
|
-
): transfer is
|
|
1093
|
-
| TransferCryptoCurrencyIn
|
|
1094
|
-
| TransferNftIn
|
|
1095
|
-
| TransferCryptoCurrencyOut
|
|
1096
|
-
| TransferNftOut =>
|
|
1097
|
-
isTransferCryptoCurrencyIn(transfer) ||
|
|
1098
|
-
isTransferNftIn(transfer) ||
|
|
1099
|
-
isTransferCryptoCurrencyOut(transfer) ||
|
|
1100
|
-
isTransferNftOut(transfer),
|
|
1101
|
-
)
|
|
1102
|
-
if (transfers.length !== action.transfers.length) {
|
|
1103
|
-
throw new Error('Invalid action.transfers for borrow-with-debt')
|
|
1104
|
-
}
|
|
1105
|
-
if (action.loanId === undefined) {
|
|
1106
|
-
throw new Error('action.loandId is required for borrow-with-debt')
|
|
1107
|
-
}
|
|
1108
|
-
return {
|
|
1109
|
-
...action,
|
|
1110
|
-
type: 'LoanAccountAction',
|
|
1111
|
-
action: 'borrow-with-debt',
|
|
1112
|
-
loanId: action.loanId,
|
|
1113
|
-
transfers,
|
|
1114
|
-
} satisfies AccountActionBorrowWithDebt
|
|
1115
|
-
}
|
|
1116
1054
|
case 'bridge-from': {
|
|
1117
1055
|
// transferCryptoCurrencyOutSchema, transferNftOutSchema
|
|
1118
1056
|
const transfers = action.transfers.filter(
|
package/index.ts
CHANGED
|
@@ -4,7 +4,6 @@ export {
|
|
|
4
4
|
accountActionApproveSchema,
|
|
5
5
|
accountActionAtomicArbitrageSchema,
|
|
6
6
|
accountActionBorrowSchema,
|
|
7
|
-
accountActionBorrowWithDebtSchema,
|
|
8
7
|
accountActionBridgeFromSchema,
|
|
9
8
|
accountActionBridgeToSchema,
|
|
10
9
|
accountActionBuyCryptoSchema,
|
|
@@ -63,7 +62,6 @@ export {
|
|
|
63
62
|
normalActionApproveSchema,
|
|
64
63
|
normalActionAtomicArbitrageSchema,
|
|
65
64
|
normalActionBorrowSchema,
|
|
66
|
-
normalActionBorrowWithDebtSchema,
|
|
67
65
|
normalActionBridgeFromSchema,
|
|
68
66
|
normalActionBridgeToSchema,
|
|
69
67
|
normalActionBuyCryptoSchema,
|
|
@@ -110,7 +108,6 @@ export type {
|
|
|
110
108
|
AccountActionApprove,
|
|
111
109
|
AccountActionAtomicArbitrage,
|
|
112
110
|
AccountActionBorrow,
|
|
113
|
-
AccountActionBorrowWithDebt,
|
|
114
111
|
AccountActionBridgeFrom,
|
|
115
112
|
AccountActionBridgeTo,
|
|
116
113
|
AccountActionBuyCrypto,
|
|
@@ -163,7 +160,6 @@ export type {
|
|
|
163
160
|
NormalActionApprove,
|
|
164
161
|
NormalActionAtomicArbitrage,
|
|
165
162
|
NormalActionBorrow,
|
|
166
|
-
NormalActionBorrowWithDebt,
|
|
167
163
|
NormalActionBridgeFrom,
|
|
168
164
|
NormalActionBridgeTo,
|
|
169
165
|
NormalActionBuyCrypto,
|
|
@@ -248,6 +244,7 @@ export type {
|
|
|
248
244
|
} from './assets'
|
|
249
245
|
export { createPortfolio } from './portfolios'
|
|
250
246
|
export type { Portfolio } from './portfolios'
|
|
247
|
+
export { setAccountActionPrices } from './setAccountActionPrices'
|
|
251
248
|
export type { Config, Logger } from './types'
|
|
252
249
|
export { rest, stringify } from './utils'
|
|
253
250
|
export type { Schema } from './utils'
|
package/package.json
CHANGED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import type { AccountAction } from './actions'
|
|
2
|
+
import type {
|
|
3
|
+
CryptoCurrency,
|
|
4
|
+
CryptoCurrencyDataSource,
|
|
5
|
+
CryptoCurrencyPrice,
|
|
6
|
+
FiatCurrency,
|
|
7
|
+
} from './assets'
|
|
8
|
+
|
|
9
|
+
type SetAccountActionPricesParameters = {
|
|
10
|
+
readonly actions: readonly AccountAction[]
|
|
11
|
+
readonly fiat: FiatCurrency
|
|
12
|
+
readonly cryptoCurrencyDataSource: CryptoCurrencyDataSource
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const setAccountActionPrices = async ({
|
|
16
|
+
actions,
|
|
17
|
+
fiat,
|
|
18
|
+
cryptoCurrencyDataSource,
|
|
19
|
+
}: SetAccountActionPricesParameters) => {
|
|
20
|
+
// crypto currency 毎の取得期間を作成
|
|
21
|
+
const targets = getCryptoCurrencyTargets(actions)
|
|
22
|
+
|
|
23
|
+
// 取得期間をもとに価格を取得
|
|
24
|
+
const cryptoCurrencyPricesOfTarget = await Promise.all(
|
|
25
|
+
targets.map(({ currency, from, to }) =>
|
|
26
|
+
cryptoCurrencyDataSource.getHistoricalPrices({
|
|
27
|
+
targetCurrencies: [currency],
|
|
28
|
+
vsCurrency: fiat,
|
|
29
|
+
from: from - 1000 * 60 * 60,
|
|
30
|
+
to: to + 1000 * 60 * 60,
|
|
31
|
+
}),
|
|
32
|
+
),
|
|
33
|
+
)
|
|
34
|
+
const prices = cryptoCurrencyPricesOfTarget
|
|
35
|
+
.flat()
|
|
36
|
+
.toSorted((a, b) => a.timestamp - b.timestamp)
|
|
37
|
+
|
|
38
|
+
// 価格を設定して返す
|
|
39
|
+
return actions.map((action) => setPrices(action, prices))
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
type CryptoCurrencyTarget = {
|
|
43
|
+
readonly currency: CryptoCurrency
|
|
44
|
+
readonly from: number
|
|
45
|
+
readonly to: number
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const getCryptoCurrencyTargets = (
|
|
49
|
+
actions: readonly AccountAction[],
|
|
50
|
+
): readonly CryptoCurrencyTarget[] => {
|
|
51
|
+
const mut_targets: CryptoCurrencyTarget[] = []
|
|
52
|
+
for (const action of actions) {
|
|
53
|
+
for (const transfer of action.transfers) {
|
|
54
|
+
if (transfer.asset.type !== 'CryptoCurrency') {
|
|
55
|
+
continue
|
|
56
|
+
}
|
|
57
|
+
const targetIndex = mut_targets.findIndex(
|
|
58
|
+
(target) => target.currency.id === transfer.asset.id,
|
|
59
|
+
)
|
|
60
|
+
if (targetIndex === -1) {
|
|
61
|
+
mut_targets.push({
|
|
62
|
+
currency: transfer.asset,
|
|
63
|
+
from: action.timestamp,
|
|
64
|
+
to: action.timestamp,
|
|
65
|
+
})
|
|
66
|
+
} else {
|
|
67
|
+
const target = mut_targets[targetIndex]
|
|
68
|
+
mut_targets[targetIndex] = {
|
|
69
|
+
currency: target.currency,
|
|
70
|
+
from: Math.min(target.from, action.timestamp),
|
|
71
|
+
to: Math.max(target.to, action.timestamp),
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return mut_targets
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const setPrices = (
|
|
80
|
+
action: AccountAction,
|
|
81
|
+
prices: readonly CryptoCurrencyPrice[],
|
|
82
|
+
): AccountAction =>
|
|
83
|
+
({
|
|
84
|
+
...action,
|
|
85
|
+
transfers: action.transfers.map((transfer) => {
|
|
86
|
+
switch (transfer.asset.type) {
|
|
87
|
+
case 'CryptoCurrency': {
|
|
88
|
+
return {
|
|
89
|
+
...transfer,
|
|
90
|
+
price: getPrice(prices, action.timestamp, transfer.asset.id),
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
case 'FiatCurrency': {
|
|
94
|
+
return transfer
|
|
95
|
+
}
|
|
96
|
+
case 'Nft': {
|
|
97
|
+
return transfer
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}),
|
|
101
|
+
}) as AccountAction
|
|
102
|
+
|
|
103
|
+
const getPrice = (
|
|
104
|
+
prices: readonly CryptoCurrencyPrice[],
|
|
105
|
+
timestamp: number,
|
|
106
|
+
id: string | undefined,
|
|
107
|
+
): CryptoCurrencyPrice | undefined =>
|
|
108
|
+
prices
|
|
109
|
+
.filter(
|
|
110
|
+
({ cryptoCurrencyId, timestamp: priceTimestamp }) =>
|
|
111
|
+
cryptoCurrencyId === id &&
|
|
112
|
+
priceTimestamp >= timestamp - 1000 * 60 * 60 &&
|
|
113
|
+
priceTimestamp <= timestamp + 1000 * 60 * 60,
|
|
114
|
+
)
|
|
115
|
+
.reduce(
|
|
116
|
+
(closestPrice: CryptoCurrencyPrice | undefined, price) =>
|
|
117
|
+
closestPrice === undefined ||
|
|
118
|
+
Math.abs(price.timestamp - timestamp) <
|
|
119
|
+
Math.abs(closestPrice.timestamp - timestamp)
|
|
120
|
+
? price
|
|
121
|
+
: closestPrice,
|
|
122
|
+
undefined,
|
|
123
|
+
)
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseNormalActionBorrowWithDebtToAccountActions = void 0;
|
|
4
|
-
const default_1 = require("../default");
|
|
5
|
-
const parseNormalActionBorrowWithDebtToAccountActions = ({ action, accountIds, source, cexAccountIds, }) => (0, default_1.allTransfersIsAccountRelated)(action.transfers, accountIds)
|
|
6
|
-
? [
|
|
7
|
-
{
|
|
8
|
-
...(0, default_1.createAccountActionCommon)(action, source),
|
|
9
|
-
type: 'LoanAccountAction',
|
|
10
|
-
action: 'borrow-with-debt',
|
|
11
|
-
evidence: action.evidence,
|
|
12
|
-
loanId: action.loanId,
|
|
13
|
-
transfers: action.transfers,
|
|
14
|
-
},
|
|
15
|
-
]
|
|
16
|
-
: (0, default_1.parseNormalActionToAccountActions)({
|
|
17
|
-
action,
|
|
18
|
-
accountIds,
|
|
19
|
-
source,
|
|
20
|
-
cexAccountIds,
|
|
21
|
-
});
|
|
22
|
-
exports.parseNormalActionBorrowWithDebtToAccountActions = parseNormalActionBorrowWithDebtToAccountActions;
|
|
23
|
-
//# sourceMappingURL=borrowWithDebt.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"borrowWithDebt.js","sourceRoot":"","sources":["../../../../actions/parsers/borrow/borrowWithDebt.ts"],"names":[],"mappings":";;;AASA,wCAImB;AAGZ,MAAM,+CAA+C,GAAG,CAAC,EAC9D,MAAM,EACN,UAAU,EACV,MAAM,EACN,aAAa,GAC2D,EAQlE,EAAE,CACR,IAAA,sCAA4B,EAAC,MAAM,CAAC,SAAS,EAAE,UAAU,CAAC;IACxD,CAAC,CAAC;QACE;YACE,GAAG,IAAA,mCAAyB,EAAC,MAAM,EAAE,MAAM,CAAC;YAC5C,IAAI,EAAE,mBAAmB;YACzB,MAAM,EAAE,kBAAkB;YAC1B,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,SAAS,EAAE,MAAM,CAAC,SAAS;SAC5B;KACF;IACH,CAAC,CAAC,IAAA,2CAAiC,EAAC;QAChC,MAAM;QACN,UAAU;QACV,MAAM;QACN,aAAa;KACd,CAAC,CAAA;AA9BK,QAAA,+CAA+C,mDA8BpD"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.accountActionBorrowWithDebtSchema = exports.normalActionBorrowWithDebtSchema = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
const default_1 = require("../default");
|
|
6
|
-
exports.normalActionBorrowWithDebtSchema = default_1.loanNormalActionDefaultSchema
|
|
7
|
-
.extend({
|
|
8
|
-
action: zod_1.z.literal('borrow-with-debt'),
|
|
9
|
-
transfers: zod_1.z.array(zod_1.z.union([
|
|
10
|
-
default_1.transferCryptoCurrencyInSchema,
|
|
11
|
-
default_1.transferNftInSchema,
|
|
12
|
-
default_1.transferCryptoCurrencyOutSchema,
|
|
13
|
-
default_1.transferNftOutSchema,
|
|
14
|
-
])),
|
|
15
|
-
})
|
|
16
|
-
.transform((v) => ({
|
|
17
|
-
...v,
|
|
18
|
-
comment: v.comment,
|
|
19
|
-
app: v.app,
|
|
20
|
-
}));
|
|
21
|
-
exports.accountActionBorrowWithDebtSchema = default_1.loanAccountActionDefaultSchema
|
|
22
|
-
.extend({
|
|
23
|
-
action: zod_1.z.literal('borrow-with-debt'),
|
|
24
|
-
transfers: zod_1.z.array(zod_1.z.union([
|
|
25
|
-
default_1.transferCryptoCurrencyInSchema,
|
|
26
|
-
default_1.transferNftInSchema,
|
|
27
|
-
default_1.transferCryptoCurrencyOutSchema,
|
|
28
|
-
default_1.transferNftOutSchema,
|
|
29
|
-
])),
|
|
30
|
-
})
|
|
31
|
-
.transform((v) => ({
|
|
32
|
-
...v,
|
|
33
|
-
comment: v.comment,
|
|
34
|
-
app: v.app,
|
|
35
|
-
}));
|
|
36
|
-
//# sourceMappingURL=borrowWithDebt.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"borrowWithDebt.js","sourceRoot":"","sources":["../../../../actions/schemas/borrow/borrowWithDebt.ts"],"names":[],"mappings":";;;AAAA,6BAAuB;AACvB,wCAOmB;AAEN,QAAA,gCAAgC,GAAG,uCAA6B;KAC1E,MAAM,CAAC;IACN,MAAM,EAAE,OAAC,CAAC,OAAO,CAAC,kBAAkB,CAAC;IACrC,SAAS,EAAE,OAAC,CAAC,KAAK,CAChB,OAAC,CAAC,KAAK,CAAC;QACN,wCAA8B;QAC9B,6BAAmB;QACnB,yCAA+B;QAC/B,8BAAoB;KACrB,CAAC,CACH;CACF,CAAC;KACD,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACjB,GAAG,CAAC;IACJ,OAAO,EAAE,CAAC,CAAC,OAAO;IAClB,GAAG,EAAE,CAAC,CAAC,GAAG;CACX,CAAC,CAAC,CAAA;AAEQ,QAAA,iCAAiC,GAAG,wCAA8B;KAC5E,MAAM,CAAC;IACN,MAAM,EAAE,OAAC,CAAC,OAAO,CAAC,kBAAkB,CAAC;IACrC,SAAS,EAAE,OAAC,CAAC,KAAK,CAChB,OAAC,CAAC,KAAK,CAAC;QACN,wCAA8B;QAC9B,6BAAmB;QACnB,yCAA+B;QAC/B,8BAAoB;KACrB,CAAC,CACH;CACF,CAAC;KACD,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACjB,GAAG,CAAC;IACJ,OAAO,EAAE,CAAC,CAAC,OAAO;IAClB,GAAG,EAAE,CAAC,CAAC,GAAG;CACX,CAAC,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"borrowWithDebt.js","sourceRoot":"","sources":["../../../actions/types/borrowWithDebt.ts"],"names":[],"mappings":""}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { allTransfersIsAccountRelated, createAccountActionCommon, parseNormalActionToAccountActions, } from '../default';
|
|
2
|
-
export const parseNormalActionBorrowWithDebtToAccountActions = ({ action, accountIds, source, cexAccountIds, }) => allTransfersIsAccountRelated(action.transfers, accountIds)
|
|
3
|
-
? [
|
|
4
|
-
{
|
|
5
|
-
...createAccountActionCommon(action, source),
|
|
6
|
-
type: 'LoanAccountAction',
|
|
7
|
-
action: 'borrow-with-debt',
|
|
8
|
-
evidence: action.evidence,
|
|
9
|
-
loanId: action.loanId,
|
|
10
|
-
transfers: action.transfers,
|
|
11
|
-
},
|
|
12
|
-
]
|
|
13
|
-
: parseNormalActionToAccountActions({
|
|
14
|
-
action,
|
|
15
|
-
accountIds,
|
|
16
|
-
source,
|
|
17
|
-
cexAccountIds,
|
|
18
|
-
});
|
|
19
|
-
//# sourceMappingURL=borrowWithDebt.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"borrowWithDebt.js","sourceRoot":"","sources":["../../../../actions/parsers/borrow/borrowWithDebt.ts"],"names":[],"mappings":"AASA,OAAO,EACL,4BAA4B,EAC5B,yBAAyB,EACzB,iCAAiC,GAClC,MAAM,YAAY,CAAA;AAGnB,MAAM,CAAC,MAAM,+CAA+C,GAAG,CAAC,EAC9D,MAAM,EACN,UAAU,EACV,MAAM,EACN,aAAa,GAC2D,EAQlE,EAAE,CACR,4BAA4B,CAAC,MAAM,CAAC,SAAS,EAAE,UAAU,CAAC;IACxD,CAAC,CAAC;QACE;YACE,GAAG,yBAAyB,CAAC,MAAM,EAAE,MAAM,CAAC;YAC5C,IAAI,EAAE,mBAAmB;YACzB,MAAM,EAAE,kBAAkB;YAC1B,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,SAAS,EAAE,MAAM,CAAC,SAAS;SAC5B;KACF;IACH,CAAC,CAAC,iCAAiC,CAAC;QAChC,MAAM;QACN,UAAU;QACV,MAAM;QACN,aAAa;KACd,CAAC,CAAA"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { loanAccountActionDefaultSchema, loanNormalActionDefaultSchema, transferCryptoCurrencyInSchema, transferCryptoCurrencyOutSchema, transferNftInSchema, transferNftOutSchema, } from '../default';
|
|
3
|
-
export const normalActionBorrowWithDebtSchema = loanNormalActionDefaultSchema
|
|
4
|
-
.extend({
|
|
5
|
-
action: z.literal('borrow-with-debt'),
|
|
6
|
-
transfers: z.array(z.union([
|
|
7
|
-
transferCryptoCurrencyInSchema,
|
|
8
|
-
transferNftInSchema,
|
|
9
|
-
transferCryptoCurrencyOutSchema,
|
|
10
|
-
transferNftOutSchema,
|
|
11
|
-
])),
|
|
12
|
-
})
|
|
13
|
-
.transform((v) => ({
|
|
14
|
-
...v,
|
|
15
|
-
comment: v.comment,
|
|
16
|
-
app: v.app,
|
|
17
|
-
}));
|
|
18
|
-
export const accountActionBorrowWithDebtSchema = loanAccountActionDefaultSchema
|
|
19
|
-
.extend({
|
|
20
|
-
action: z.literal('borrow-with-debt'),
|
|
21
|
-
transfers: z.array(z.union([
|
|
22
|
-
transferCryptoCurrencyInSchema,
|
|
23
|
-
transferNftInSchema,
|
|
24
|
-
transferCryptoCurrencyOutSchema,
|
|
25
|
-
transferNftOutSchema,
|
|
26
|
-
])),
|
|
27
|
-
})
|
|
28
|
-
.transform((v) => ({
|
|
29
|
-
...v,
|
|
30
|
-
comment: v.comment,
|
|
31
|
-
app: v.app,
|
|
32
|
-
}));
|
|
33
|
-
//# sourceMappingURL=borrowWithDebt.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"borrowWithDebt.js","sourceRoot":"","sources":["../../../../actions/schemas/borrow/borrowWithDebt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EACL,8BAA8B,EAC9B,6BAA6B,EAC7B,8BAA8B,EAC9B,+BAA+B,EAC/B,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,YAAY,CAAA;AAEnB,MAAM,CAAC,MAAM,gCAAgC,GAAG,6BAA6B;KAC1E,MAAM,CAAC;IACN,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,kBAAkB,CAAC;IACrC,SAAS,EAAE,CAAC,CAAC,KAAK,CAChB,CAAC,CAAC,KAAK,CAAC;QACN,8BAA8B;QAC9B,mBAAmB;QACnB,+BAA+B;QAC/B,oBAAoB;KACrB,CAAC,CACH;CACF,CAAC;KACD,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACjB,GAAG,CAAC;IACJ,OAAO,EAAE,CAAC,CAAC,OAAO;IAClB,GAAG,EAAE,CAAC,CAAC,GAAG;CACX,CAAC,CAAC,CAAA;AAEL,MAAM,CAAC,MAAM,iCAAiC,GAAG,8BAA8B;KAC5E,MAAM,CAAC;IACN,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,kBAAkB,CAAC;IACrC,SAAS,EAAE,CAAC,CAAC,KAAK,CAChB,CAAC,CAAC,KAAK,CAAC;QACN,8BAA8B;QAC9B,mBAAmB;QACnB,+BAA+B;QAC/B,oBAAoB;KACrB,CAAC,CACH;CACF,CAAC;KACD,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACjB,GAAG,CAAC;IACJ,OAAO,EAAE,CAAC,CAAC,OAAO;IAClB,GAAG,EAAE,CAAC,CAAC,GAAG;CACX,CAAC,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"borrowWithDebt.js","sourceRoot":"","sources":["../../../actions/types/borrowWithDebt.ts"],"names":[],"mappings":""}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { AccountActionBorrowWithDebt, AccountActionIncome, AccountActionMove, AccountActionReceiveFromCex, AccountActionSendToCex, AccountActionTransfer, NormalActionBorrowWithDebt } from '../../types';
|
|
2
|
-
import type { ParseNormalActionToAccountActionsParameters } from '../types';
|
|
3
|
-
export declare const parseNormalActionBorrowWithDebtToAccountActions: ({ action, accountIds, source, cexAccountIds, }: ParseNormalActionToAccountActionsParameters<NormalActionBorrowWithDebt>) => [AccountActionBorrowWithDebt] | readonly (AccountActionIncome | AccountActionTransfer | AccountActionMove | AccountActionReceiveFromCex | AccountActionSendToCex)[];
|
|
4
|
-
//# sourceMappingURL=borrowWithDebt.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"borrowWithDebt.d.ts","sourceRoot":"","sources":["../../../../actions/parsers/borrow/borrowWithDebt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,2BAA2B,EAC3B,mBAAmB,EACnB,iBAAiB,EACjB,2BAA2B,EAC3B,sBAAsB,EACtB,qBAAqB,EACrB,0BAA0B,EAC3B,MAAM,aAAa,CAAA;AAMpB,OAAO,KAAK,EAAE,2CAA2C,EAAE,MAAM,UAAU,CAAA;AAE3E,eAAO,MAAM,+CAA+C,mDAKzD,4CAA4C,0BAA0B,CAAC,KACtE,CAAC,2BAA2B,CAAC,GAC7B,SAAS,CACL,mBAAmB,GACnB,qBAAqB,GACrB,iBAAiB,GACjB,2BAA2B,GAC3B,sBAAsB,CACzB,EAiBG,CAAA"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { z } from 'zod';
|
|
2
|
-
import type { accountActionBorrowWithDebtSchema, normalActionBorrowWithDebtSchema } from '../schemas';
|
|
3
|
-
export type NormalActionBorrowWithDebt = z.infer<typeof normalActionBorrowWithDebtSchema>;
|
|
4
|
-
export type AccountActionBorrowWithDebt = z.infer<typeof accountActionBorrowWithDebtSchema>;
|
|
5
|
-
//# sourceMappingURL=borrowWithDebt.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"borrowWithDebt.d.ts","sourceRoot":"","sources":["../../../actions/types/borrowWithDebt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAC5B,OAAO,KAAK,EACV,iCAAiC,EACjC,gCAAgC,EACjC,MAAM,YAAY,CAAA;AAEnB,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAC9C,OAAO,gCAAgC,CACxC,CAAA;AAED,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAC/C,OAAO,iCAAiC,CACzC,CAAA"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
AccountActionBorrowWithDebt,
|
|
3
|
-
AccountActionIncome,
|
|
4
|
-
AccountActionMove,
|
|
5
|
-
AccountActionReceiveFromCex,
|
|
6
|
-
AccountActionSendToCex,
|
|
7
|
-
AccountActionTransfer,
|
|
8
|
-
NormalActionBorrowWithDebt,
|
|
9
|
-
} from '../../types'
|
|
10
|
-
import {
|
|
11
|
-
allTransfersIsAccountRelated,
|
|
12
|
-
createAccountActionCommon,
|
|
13
|
-
parseNormalActionToAccountActions,
|
|
14
|
-
} from '../default'
|
|
15
|
-
import type { ParseNormalActionToAccountActionsParameters } from '../types'
|
|
16
|
-
|
|
17
|
-
export const parseNormalActionBorrowWithDebtToAccountActions = ({
|
|
18
|
-
action,
|
|
19
|
-
accountIds,
|
|
20
|
-
source,
|
|
21
|
-
cexAccountIds,
|
|
22
|
-
}: ParseNormalActionToAccountActionsParameters<NormalActionBorrowWithDebt>):
|
|
23
|
-
| [AccountActionBorrowWithDebt]
|
|
24
|
-
| readonly (
|
|
25
|
-
| AccountActionIncome
|
|
26
|
-
| AccountActionTransfer
|
|
27
|
-
| AccountActionMove
|
|
28
|
-
| AccountActionReceiveFromCex
|
|
29
|
-
| AccountActionSendToCex
|
|
30
|
-
)[] =>
|
|
31
|
-
allTransfersIsAccountRelated(action.transfers, accountIds)
|
|
32
|
-
? [
|
|
33
|
-
{
|
|
34
|
-
...createAccountActionCommon(action, source),
|
|
35
|
-
type: 'LoanAccountAction',
|
|
36
|
-
action: 'borrow-with-debt',
|
|
37
|
-
evidence: action.evidence,
|
|
38
|
-
loanId: action.loanId,
|
|
39
|
-
transfers: action.transfers,
|
|
40
|
-
},
|
|
41
|
-
]
|
|
42
|
-
: parseNormalActionToAccountActions({
|
|
43
|
-
action,
|
|
44
|
-
accountIds,
|
|
45
|
-
source,
|
|
46
|
-
cexAccountIds,
|
|
47
|
-
})
|