@0xtorch/csv 0.0.14 → 0.0.16

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 (212) hide show
  1. package/_cjs/index.js +7 -3
  2. package/_cjs/index.js.map +1 -1
  3. package/_cjs/{parseCsvFileToAccountActions.js → parseCsvFileToActions.js} +11 -11
  4. package/_cjs/parseCsvFileToActions.js.map +1 -0
  5. package/_cjs/parseRowsToActions/allValue.js +54 -0
  6. package/_cjs/parseRowsToActions/allValue.js.map +1 -0
  7. package/_cjs/parseRowsToActions/asset.js +95 -0
  8. package/_cjs/parseRowsToActions/asset.js.map +1 -0
  9. package/_cjs/parseRowsToActions/cellValue.js +8 -0
  10. package/_cjs/parseRowsToActions/cellValue.js.map +1 -0
  11. package/_cjs/parseRowsToActions/index.js +74 -0
  12. package/_cjs/parseRowsToActions/index.js.map +1 -0
  13. package/_cjs/parseRowsToActions/joinValue.js +52 -0
  14. package/_cjs/parseRowsToActions/joinValue.js.map +1 -0
  15. package/_cjs/parseRowsToActions/key.js +8 -0
  16. package/_cjs/parseRowsToActions/key.js.map +1 -0
  17. package/_cjs/parseRowsToActions/mathValue.js +123 -0
  18. package/_cjs/parseRowsToActions/mathValue.js.map +1 -0
  19. package/_cjs/parseRowsToActions/parse.js +72 -0
  20. package/_cjs/parseRowsToActions/parse.js.map +1 -0
  21. package/_cjs/parseRowsToActions/pattern.js +27 -0
  22. package/_cjs/parseRowsToActions/pattern.js.map +1 -0
  23. package/_cjs/parseRowsToActions/simpleValue.js +22 -0
  24. package/_cjs/parseRowsToActions/simpleValue.js.map +1 -0
  25. package/_cjs/parseRowsToActions/sliceValue.js +35 -0
  26. package/_cjs/parseRowsToActions/sliceValue.js.map +1 -0
  27. package/_cjs/parseRowsToActions/splitValue.js +11 -0
  28. package/_cjs/parseRowsToActions/splitValue.js.map +1 -0
  29. package/_cjs/parseRowsToActions/transfer.js +110 -0
  30. package/_cjs/parseRowsToActions/transfer.js.map +1 -0
  31. package/_cjs/schemas/{schemas.js → format.js} +2 -2
  32. package/_cjs/schemas/format.js.map +1 -0
  33. package/_cjs/schemas/index.js +2 -2
  34. package/_cjs/schemas/index.js.map +1 -1
  35. package/_cjs/schemas/parser.js +117 -72
  36. package/_cjs/schemas/parser.js.map +1 -1
  37. package/_esm/index.js +3 -1
  38. package/_esm/index.js.map +1 -1
  39. package/_esm/{parseCsvFileToAccountActions.js → parseCsvFileToActions.js} +9 -9
  40. package/_esm/parseCsvFileToActions.js.map +1 -0
  41. package/_esm/parseRowsToActions/allValue.js +50 -0
  42. package/_esm/parseRowsToActions/allValue.js.map +1 -0
  43. package/_esm/parseRowsToActions/asset.js +89 -0
  44. package/_esm/parseRowsToActions/asset.js.map +1 -0
  45. package/_esm/parseRowsToActions/cellValue.js +4 -0
  46. package/_esm/parseRowsToActions/cellValue.js.map +1 -0
  47. package/_esm/parseRowsToActions/index.js +72 -0
  48. package/_esm/parseRowsToActions/index.js.map +1 -0
  49. package/_esm/parseRowsToActions/joinValue.js +48 -0
  50. package/_esm/parseRowsToActions/joinValue.js.map +1 -0
  51. package/_esm/parseRowsToActions/key.js +4 -0
  52. package/_esm/parseRowsToActions/key.js.map +1 -0
  53. package/_esm/parseRowsToActions/mathValue.js +119 -0
  54. package/_esm/parseRowsToActions/mathValue.js.map +1 -0
  55. package/_esm/parseRowsToActions/parse.js +70 -0
  56. package/_esm/parseRowsToActions/parse.js.map +1 -0
  57. package/_esm/parseRowsToActions/pattern.js +23 -0
  58. package/_esm/parseRowsToActions/pattern.js.map +1 -0
  59. package/_esm/parseRowsToActions/simpleValue.js +18 -0
  60. package/_esm/parseRowsToActions/simpleValue.js.map +1 -0
  61. package/_esm/parseRowsToActions/sliceValue.js +31 -0
  62. package/_esm/parseRowsToActions/sliceValue.js.map +1 -0
  63. package/_esm/parseRowsToActions/splitValue.js +7 -0
  64. package/_esm/parseRowsToActions/splitValue.js.map +1 -0
  65. package/_esm/parseRowsToActions/transfer.js +106 -0
  66. package/_esm/parseRowsToActions/transfer.js.map +1 -0
  67. package/_esm/schemas/{schemas.js → format.js} +3 -3
  68. package/_esm/schemas/format.js.map +1 -0
  69. package/_esm/schemas/index.js +1 -1
  70. package/_esm/schemas/index.js.map +1 -1
  71. package/_esm/schemas/parser.js +126 -93
  72. package/_esm/schemas/parser.js.map +1 -1
  73. package/_types/index.d.ts +3 -1
  74. package/_types/index.d.ts.map +1 -1
  75. package/_types/parseCsvFileToActions.d.ts +14 -0
  76. package/_types/parseCsvFileToActions.d.ts.map +1 -0
  77. package/_types/parseRowsToActions/allValue.d.ts +9 -0
  78. package/_types/parseRowsToActions/allValue.d.ts.map +1 -0
  79. package/_types/parseRowsToActions/asset.d.ts +30 -0
  80. package/_types/parseRowsToActions/asset.d.ts.map +1 -0
  81. package/_types/parseRowsToActions/cellValue.d.ts +8 -0
  82. package/_types/parseRowsToActions/cellValue.d.ts.map +1 -0
  83. package/_types/parseRowsToActions/index.d.ts +18 -0
  84. package/_types/parseRowsToActions/index.d.ts.map +1 -0
  85. package/_types/parseRowsToActions/joinValue.d.ts +9 -0
  86. package/_types/parseRowsToActions/joinValue.d.ts.map +1 -0
  87. package/_types/parseRowsToActions/key.d.ts +8 -0
  88. package/_types/parseRowsToActions/key.d.ts.map +1 -0
  89. package/_types/parseRowsToActions/mathValue.d.ts +10 -0
  90. package/_types/parseRowsToActions/mathValue.d.ts.map +1 -0
  91. package/_types/parseRowsToActions/parse.d.ts +17 -0
  92. package/_types/parseRowsToActions/parse.d.ts.map +1 -0
  93. package/_types/parseRowsToActions/pattern.d.ts +7 -0
  94. package/_types/parseRowsToActions/pattern.d.ts.map +1 -0
  95. package/_types/parseRowsToActions/simpleValue.d.ts +9 -0
  96. package/_types/parseRowsToActions/simpleValue.d.ts.map +1 -0
  97. package/_types/parseRowsToActions/sliceValue.d.ts +9 -0
  98. package/_types/parseRowsToActions/sliceValue.d.ts.map +1 -0
  99. package/_types/parseRowsToActions/splitValue.d.ts +9 -0
  100. package/_types/parseRowsToActions/splitValue.d.ts.map +1 -0
  101. package/_types/parseRowsToActions/transfer.d.ts +15 -0
  102. package/_types/parseRowsToActions/transfer.d.ts.map +1 -0
  103. package/_types/schemas/format.d.ts +35204 -0
  104. package/_types/schemas/format.d.ts.map +1 -0
  105. package/_types/schemas/index.d.ts +1 -1
  106. package/_types/schemas/index.d.ts.map +1 -1
  107. package/_types/schemas/parser.d.ts +78521 -916
  108. package/_types/schemas/parser.d.ts.map +1 -1
  109. package/_types/types.d.ts +2 -2
  110. package/_types/types.d.ts.map +1 -1
  111. package/index.ts +3 -1
  112. package/package.json +1 -1
  113. package/parseCsvFileToActions.ts +52 -0
  114. package/parseRowsToActions/allValue.ts +61 -0
  115. package/parseRowsToActions/asset.ts +152 -0
  116. package/parseRowsToActions/cellValue.ts +13 -0
  117. package/parseRowsToActions/index.ts +115 -0
  118. package/parseRowsToActions/joinValue.ts +68 -0
  119. package/parseRowsToActions/key.ts +13 -0
  120. package/parseRowsToActions/mathValue.ts +160 -0
  121. package/parseRowsToActions/parse.ts +108 -0
  122. package/parseRowsToActions/pattern.ts +35 -0
  123. package/parseRowsToActions/simpleValue.ts +29 -0
  124. package/parseRowsToActions/sliceValue.ts +51 -0
  125. package/parseRowsToActions/splitValue.ts +18 -0
  126. package/parseRowsToActions/transfer.ts +167 -0
  127. package/schemas/{schemas.ts → format.ts} +2 -2
  128. package/schemas/index.ts +1 -1
  129. package/schemas/parser.ts +143 -93
  130. package/tests/assets.ts +2 -1
  131. package/tests/coincheck-standard.csv +0 -10
  132. package/tests/coincheck.ts +196 -106
  133. package/types.ts +2 -2
  134. package/_cjs/parseCsvFileToAccountActions.js.map +0 -1
  135. package/_cjs/parseCsvRowToAction/amount.js +0 -48
  136. package/_cjs/parseCsvRowToAction/amount.js.map +0 -1
  137. package/_cjs/parseCsvRowToAction/asset.js +0 -63
  138. package/_cjs/parseCsvRowToAction/asset.js.map +0 -1
  139. package/_cjs/parseCsvRowToAction/condition.js +0 -32
  140. package/_cjs/parseCsvRowToAction/condition.js.map +0 -1
  141. package/_cjs/parseCsvRowToAction/index.js +0 -6
  142. package/_cjs/parseCsvRowToAction/index.js.map +0 -1
  143. package/_cjs/parseCsvRowToAction/nft.js +0 -16
  144. package/_cjs/parseCsvRowToAction/nft.js.map +0 -1
  145. package/_cjs/parseCsvRowToAction/parseCsvRowToAction.js +0 -79
  146. package/_cjs/parseCsvRowToAction/parseCsvRowToAction.js.map +0 -1
  147. package/_cjs/parseCsvRowToAction/text.js +0 -29
  148. package/_cjs/parseCsvRowToAction/text.js.map +0 -1
  149. package/_cjs/parseCsvRowToAction/timestamp.js +0 -12
  150. package/_cjs/parseCsvRowToAction/timestamp.js.map +0 -1
  151. package/_cjs/parseCsvRowToAction/transfer.js +0 -25
  152. package/_cjs/parseCsvRowToAction/transfer.js.map +0 -1
  153. package/_cjs/parseCsvRowsToActions.js +0 -34
  154. package/_cjs/parseCsvRowsToActions.js.map +0 -1
  155. package/_cjs/schemas/schemas.js.map +0 -1
  156. package/_esm/parseCsvFileToAccountActions.js.map +0 -1
  157. package/_esm/parseCsvRowToAction/amount.js +0 -44
  158. package/_esm/parseCsvRowToAction/amount.js.map +0 -1
  159. package/_esm/parseCsvRowToAction/asset.js +0 -59
  160. package/_esm/parseCsvRowToAction/asset.js.map +0 -1
  161. package/_esm/parseCsvRowToAction/condition.js +0 -28
  162. package/_esm/parseCsvRowToAction/condition.js.map +0 -1
  163. package/_esm/parseCsvRowToAction/index.js +0 -2
  164. package/_esm/parseCsvRowToAction/index.js.map +0 -1
  165. package/_esm/parseCsvRowToAction/nft.js +0 -12
  166. package/_esm/parseCsvRowToAction/nft.js.map +0 -1
  167. package/_esm/parseCsvRowToAction/parseCsvRowToAction.js +0 -77
  168. package/_esm/parseCsvRowToAction/parseCsvRowToAction.js.map +0 -1
  169. package/_esm/parseCsvRowToAction/text.js +0 -25
  170. package/_esm/parseCsvRowToAction/text.js.map +0 -1
  171. package/_esm/parseCsvRowToAction/timestamp.js +0 -8
  172. package/_esm/parseCsvRowToAction/timestamp.js.map +0 -1
  173. package/_esm/parseCsvRowToAction/transfer.js +0 -21
  174. package/_esm/parseCsvRowToAction/transfer.js.map +0 -1
  175. package/_esm/parseCsvRowsToActions.js +0 -32
  176. package/_esm/parseCsvRowsToActions.js.map +0 -1
  177. package/_esm/schemas/schemas.js.map +0 -1
  178. package/_types/parseCsvFileToAccountActions.d.ts +0 -14
  179. package/_types/parseCsvFileToAccountActions.d.ts.map +0 -1
  180. package/_types/parseCsvRowToAction/amount.d.ts +0 -11
  181. package/_types/parseCsvRowToAction/amount.d.ts.map +0 -1
  182. package/_types/parseCsvRowToAction/asset.d.ts +0 -17
  183. package/_types/parseCsvRowToAction/asset.d.ts.map +0 -1
  184. package/_types/parseCsvRowToAction/condition.d.ts +0 -10
  185. package/_types/parseCsvRowToAction/condition.d.ts.map +0 -1
  186. package/_types/parseCsvRowToAction/index.d.ts +0 -2
  187. package/_types/parseCsvRowToAction/index.d.ts.map +0 -1
  188. package/_types/parseCsvRowToAction/nft.d.ts +0 -12
  189. package/_types/parseCsvRowToAction/nft.d.ts.map +0 -1
  190. package/_types/parseCsvRowToAction/parseCsvRowToAction.d.ts +0 -16
  191. package/_types/parseCsvRowToAction/parseCsvRowToAction.d.ts.map +0 -1
  192. package/_types/parseCsvRowToAction/text.d.ts +0 -11
  193. package/_types/parseCsvRowToAction/text.d.ts.map +0 -1
  194. package/_types/parseCsvRowToAction/timestamp.d.ts +0 -8
  195. package/_types/parseCsvRowToAction/timestamp.d.ts.map +0 -1
  196. package/_types/parseCsvRowToAction/transfer.d.ts +0 -18
  197. package/_types/parseCsvRowToAction/transfer.d.ts.map +0 -1
  198. package/_types/parseCsvRowsToActions.d.ts +0 -16
  199. package/_types/parseCsvRowsToActions.d.ts.map +0 -1
  200. package/_types/schemas/schemas.d.ts +0 -593
  201. package/_types/schemas/schemas.d.ts.map +0 -1
  202. package/parseCsvFileToAccountActions.ts +0 -52
  203. package/parseCsvRowToAction/amount.ts +0 -66
  204. package/parseCsvRowToAction/asset.ts +0 -93
  205. package/parseCsvRowToAction/condition.ts +0 -39
  206. package/parseCsvRowToAction/index.ts +0 -1
  207. package/parseCsvRowToAction/nft.ts +0 -28
  208. package/parseCsvRowToAction/parseCsvRowToAction.ts +0 -128
  209. package/parseCsvRowToAction/text.ts +0 -38
  210. package/parseCsvRowToAction/timestamp.ts +0 -19
  211. package/parseCsvRowToAction/transfer.ts +0 -48
  212. package/parseCsvRowsToActions.ts +0 -54
@@ -1,593 +0,0 @@
1
- import { z } from 'zod';
2
- export declare const csvFormatSchema: z.ZodObject<{
3
- id: z.ZodString;
4
- service: z.ZodString;
5
- formatter: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodUnion<[z.ZodLiteral<"blank">, z.ZodLiteral<"string">, z.ZodLiteral<"big-decimal">, z.ZodLiteral<"big-decimal-positive">, z.ZodLiteral<"big-decimal-negative">, z.ZodLiteral<"iso8601">, z.ZodLiteral<"iso8601-jp">, z.ZodLiteral<"datetime-jp">]>, "many">>;
6
- parsers: z.ZodArray<z.ZodObject<{
7
- conditions: z.ZodArray<z.ZodObject<{
8
- column: z.ZodString;
9
- pattern: z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodObject<{
10
- type: z.ZodLiteral<"defined">;
11
- }, "strip", z.ZodTypeAny, {
12
- type: "defined";
13
- }, {
14
- type: "defined";
15
- }>, z.ZodObject<{
16
- type: z.ZodLiteral<"undefined">;
17
- }, "strip", z.ZodTypeAny, {
18
- type: "undefined";
19
- }, {
20
- type: "undefined";
21
- }>, z.ZodObject<{
22
- type: z.ZodLiteral<"in">;
23
- values: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "many">;
24
- }, "strip", z.ZodTypeAny, {
25
- values: (string | number)[];
26
- type: "in";
27
- }, {
28
- values: (string | number)[];
29
- type: "in";
30
- }>, z.ZodObject<{
31
- type: z.ZodLiteral<"not-in">;
32
- values: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "many">;
33
- }, "strip", z.ZodTypeAny, {
34
- values: (string | number)[];
35
- type: "not-in";
36
- }, {
37
- values: (string | number)[];
38
- type: "not-in";
39
- }>]>;
40
- }, "strip", z.ZodTypeAny, {
41
- column: string;
42
- pattern: string | number | {
43
- type: "defined";
44
- } | {
45
- type: "undefined";
46
- } | {
47
- values: (string | number)[];
48
- type: "in";
49
- } | {
50
- values: (string | number)[];
51
- type: "not-in";
52
- };
53
- }, {
54
- column: string;
55
- pattern: string | number | {
56
- type: "defined";
57
- } | {
58
- type: "undefined";
59
- } | {
60
- values: (string | number)[];
61
- type: "in";
62
- } | {
63
- values: (string | number)[];
64
- type: "not-in";
65
- };
66
- }>, "many">;
67
- action: z.ZodUnion<[z.ZodLiteral<"borrow">, z.ZodLiteral<"bridge-from">, z.ZodLiteral<"bridge-to">, z.ZodLiteral<"cross-replace">, z.ZodLiteral<"cross-trade">, z.ZodLiteral<"add-liquidity">, z.ZodLiteral<"deposit">, z.ZodLiteral<"deposit-with-bond">, z.ZodLiteral<"stake">, z.ZodLiteral<"burn">, z.ZodLiteral<"derivative-fee">, z.ZodLiteral<"fee">, z.ZodLiteral<"interest-fee">, z.ZodLiteral<"pay">, z.ZodLiteral<"realize-loss">, z.ZodLiteral<"stolen">, z.ZodLiteral<"transaction-fee">, z.ZodLiteral<"approve">, z.ZodLiteral<"fail-tx">, z.ZodLiteral<"ignore">, z.ZodLiteral<"move">, z.ZodLiteral<"receive-from-cex">, z.ZodLiteral<"revoke">, z.ZodLiteral<"send-to-cex">, z.ZodLiteral<"spam">, z.ZodLiteral<"airdrop">, z.ZodLiteral<"cash-back">, z.ZodLiteral<"derivative-profit">, z.ZodLiteral<"free-mint">, z.ZodLiteral<"game-reward">, z.ZodLiteral<"gift">, z.ZodLiteral<"hardfork">, z.ZodLiteral<"income">, z.ZodLiteral<"interest">, z.ZodLiteral<"mining">, z.ZodLiteral<"nft-royalty">, z.ZodLiteral<"realize-profit">, z.ZodLiteral<"staking-reward">, z.ZodLiteral<"liquidation">, z.ZodLiteral<"repayment">, z.ZodLiteral<"replace">, z.ZodLiteral<"swap-nft">, z.ZodLiteral<"unwrap">, z.ZodLiteral<"wrap">, z.ZodLiteral<"atomic-arbitrage">, z.ZodLiteral<"buy-crypto">, z.ZodLiteral<"buy-nft">, z.ZodLiteral<"mint-nft">, z.ZodLiteral<"sell-crypto">, z.ZodLiteral<"sell-nft">, z.ZodLiteral<"trade">, z.ZodLiteral<"transfer">, z.ZodLiteral<"value-down">, z.ZodLiteral<"value-up">, z.ZodLiteral<"remove-liquidity">, z.ZodLiteral<"unstake">, z.ZodLiteral<"withdraw">, z.ZodLiteral<"withdraw-with-bond">]>;
68
- source: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
69
- type: z.ZodLiteral<"service">;
70
- }, "strip", z.ZodTypeAny, {
71
- type: "service";
72
- }, {
73
- type: "service";
74
- }>, z.ZodObject<{
75
- type: z.ZodLiteral<"column">;
76
- column: z.ZodString;
77
- }, "strip", z.ZodTypeAny, {
78
- type: "column";
79
- column: string;
80
- }, {
81
- type: "column";
82
- column: string;
83
- }>]>, "many">;
84
- timestamp: z.ZodString;
85
- comment: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
86
- type: z.ZodLiteral<"service">;
87
- }, "strip", z.ZodTypeAny, {
88
- type: "service";
89
- }, {
90
- type: "service";
91
- }>, z.ZodObject<{
92
- type: z.ZodLiteral<"column">;
93
- column: z.ZodString;
94
- }, "strip", z.ZodTypeAny, {
95
- type: "column";
96
- column: string;
97
- }, {
98
- type: "column";
99
- column: string;
100
- }>]>, "many">>;
101
- transfers: z.ZodArray<z.ZodObject<{
102
- direction: z.ZodUnion<[z.ZodLiteral<"in">, z.ZodLiteral<"out">]>;
103
- amount: z.ZodUnion<[z.ZodString, z.ZodObject<{
104
- type: z.ZodUnion<[z.ZodLiteral<"plus">, z.ZodLiteral<"minus">, z.ZodLiteral<"times">, z.ZodLiteral<"divide">]>;
105
- columns: z.ZodArray<z.ZodString, "many">;
106
- }, "strip", z.ZodTypeAny, {
107
- type: "plus" | "minus" | "times" | "divide";
108
- columns: string[];
109
- }, {
110
- type: "plus" | "minus" | "times" | "divide";
111
- columns: string[];
112
- }>]>;
113
- asset: z.ZodUnion<[z.ZodObject<{
114
- type: z.ZodLiteral<"custom">;
115
- assetType: z.ZodUnion<[z.ZodLiteral<"CryptoCurrency">, z.ZodLiteral<"FiatCurrency">, z.ZodLiteral<"Nft">]>;
116
- assetId: z.ZodString;
117
- }, "strip", z.ZodTypeAny, {
118
- type: "custom";
119
- assetType: "CryptoCurrency" | "FiatCurrency" | "Nft";
120
- assetId: string;
121
- }, {
122
- type: "custom";
123
- assetType: "CryptoCurrency" | "FiatCurrency" | "Nft";
124
- assetId: string;
125
- }>, z.ZodObject<{
126
- type: z.ZodLiteral<"column">;
127
- column: z.ZodString;
128
- }, "strip", z.ZodTypeAny, {
129
- type: "column";
130
- column: string;
131
- }, {
132
- type: "column";
133
- column: string;
134
- }>, z.ZodObject<{
135
- type: z.ZodLiteral<"nft">;
136
- id: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
137
- type: z.ZodLiteral<"service">;
138
- }, "strip", z.ZodTypeAny, {
139
- type: "service";
140
- }, {
141
- type: "service";
142
- }>, z.ZodObject<{
143
- type: z.ZodLiteral<"column">;
144
- column: z.ZodString;
145
- }, "strip", z.ZodTypeAny, {
146
- type: "column";
147
- column: string;
148
- }, {
149
- type: "column";
150
- column: string;
151
- }>]>, "many">;
152
- }, "strip", z.ZodTypeAny, {
153
- type: "nft";
154
- id: (string | {
155
- type: "column";
156
- column: string;
157
- } | {
158
- type: "service";
159
- })[];
160
- }, {
161
- type: "nft";
162
- id: (string | {
163
- type: "column";
164
- column: string;
165
- } | {
166
- type: "service";
167
- })[];
168
- }>]>;
169
- }, "strip", z.ZodTypeAny, {
170
- direction: "in" | "out";
171
- amount: string | {
172
- type: "plus" | "minus" | "times" | "divide";
173
- columns: string[];
174
- };
175
- asset: {
176
- type: "column";
177
- column: string;
178
- } | {
179
- type: "nft";
180
- id: (string | {
181
- type: "column";
182
- column: string;
183
- } | {
184
- type: "service";
185
- })[];
186
- } | {
187
- type: "custom";
188
- assetType: "CryptoCurrency" | "FiatCurrency" | "Nft";
189
- assetId: string;
190
- };
191
- }, {
192
- direction: "in" | "out";
193
- amount: string | {
194
- type: "plus" | "minus" | "times" | "divide";
195
- columns: string[];
196
- };
197
- asset: {
198
- type: "column";
199
- column: string;
200
- } | {
201
- type: "nft";
202
- id: (string | {
203
- type: "column";
204
- column: string;
205
- } | {
206
- type: "service";
207
- })[];
208
- } | {
209
- type: "custom";
210
- assetType: "CryptoCurrency" | "FiatCurrency" | "Nft";
211
- assetId: string;
212
- };
213
- }>, "many">;
214
- crossId: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
215
- type: z.ZodLiteral<"service">;
216
- }, "strip", z.ZodTypeAny, {
217
- type: "service";
218
- }, {
219
- type: "service";
220
- }>, z.ZodObject<{
221
- type: z.ZodLiteral<"column">;
222
- column: z.ZodString;
223
- }, "strip", z.ZodTypeAny, {
224
- type: "column";
225
- column: string;
226
- }, {
227
- type: "column";
228
- column: string;
229
- }>]>, "many">>;
230
- crossType: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"start">, z.ZodLiteral<"middle">, z.ZodLiteral<"end">]>>;
231
- loanId: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
232
- type: z.ZodLiteral<"service">;
233
- }, "strip", z.ZodTypeAny, {
234
- type: "service";
235
- }, {
236
- type: "service";
237
- }>, z.ZodObject<{
238
- type: z.ZodLiteral<"column">;
239
- column: z.ZodString;
240
- }, "strip", z.ZodTypeAny, {
241
- type: "column";
242
- column: string;
243
- }, {
244
- type: "column";
245
- column: string;
246
- }>]>, "many">>;
247
- target: z.ZodOptional<z.ZodObject<{
248
- type: z.ZodLiteral<"nft">;
249
- id: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
250
- type: z.ZodLiteral<"service">;
251
- }, "strip", z.ZodTypeAny, {
252
- type: "service";
253
- }, {
254
- type: "service";
255
- }>, z.ZodObject<{
256
- type: z.ZodLiteral<"column">;
257
- column: z.ZodString;
258
- }, "strip", z.ZodTypeAny, {
259
- type: "column";
260
- column: string;
261
- }, {
262
- type: "column";
263
- column: string;
264
- }>]>, "many">;
265
- }, "strip", z.ZodTypeAny, {
266
- type: "nft";
267
- id: (string | {
268
- type: "column";
269
- column: string;
270
- } | {
271
- type: "service";
272
- })[];
273
- }, {
274
- type: "nft";
275
- id: (string | {
276
- type: "column";
277
- column: string;
278
- } | {
279
- type: "service";
280
- })[];
281
- }>>;
282
- }, "strip", z.ZodTypeAny, {
283
- conditions: {
284
- column: string;
285
- pattern: string | number | {
286
- type: "defined";
287
- } | {
288
- type: "undefined";
289
- } | {
290
- values: (string | number)[];
291
- type: "in";
292
- } | {
293
- values: (string | number)[];
294
- type: "not-in";
295
- };
296
- }[];
297
- action: "borrow" | "bridge-from" | "bridge-to" | "cross-replace" | "cross-trade" | "add-liquidity" | "deposit" | "deposit-with-bond" | "stake" | "burn" | "derivative-fee" | "fee" | "interest-fee" | "pay" | "realize-loss" | "stolen" | "transaction-fee" | "approve" | "fail-tx" | "ignore" | "move" | "receive-from-cex" | "revoke" | "send-to-cex" | "spam" | "airdrop" | "cash-back" | "derivative-profit" | "free-mint" | "game-reward" | "gift" | "hardfork" | "income" | "interest" | "mining" | "nft-royalty" | "realize-profit" | "staking-reward" | "liquidation" | "repayment" | "replace" | "swap-nft" | "unwrap" | "wrap" | "atomic-arbitrage" | "buy-crypto" | "buy-nft" | "mint-nft" | "sell-crypto" | "sell-nft" | "trade" | "transfer" | "value-down" | "value-up" | "remove-liquidity" | "unstake" | "withdraw" | "withdraw-with-bond";
298
- source: (string | {
299
- type: "column";
300
- column: string;
301
- } | {
302
- type: "service";
303
- })[];
304
- timestamp: string;
305
- transfers: {
306
- direction: "in" | "out";
307
- amount: string | {
308
- type: "plus" | "minus" | "times" | "divide";
309
- columns: string[];
310
- };
311
- asset: {
312
- type: "column";
313
- column: string;
314
- } | {
315
- type: "nft";
316
- id: (string | {
317
- type: "column";
318
- column: string;
319
- } | {
320
- type: "service";
321
- })[];
322
- } | {
323
- type: "custom";
324
- assetType: "CryptoCurrency" | "FiatCurrency" | "Nft";
325
- assetId: string;
326
- };
327
- }[];
328
- comment?: (string | {
329
- type: "column";
330
- column: string;
331
- } | {
332
- type: "service";
333
- })[] | undefined;
334
- crossId?: (string | {
335
- type: "column";
336
- column: string;
337
- } | {
338
- type: "service";
339
- })[] | undefined;
340
- crossType?: "start" | "middle" | "end" | undefined;
341
- loanId?: (string | {
342
- type: "column";
343
- column: string;
344
- } | {
345
- type: "service";
346
- })[] | undefined;
347
- target?: {
348
- type: "nft";
349
- id: (string | {
350
- type: "column";
351
- column: string;
352
- } | {
353
- type: "service";
354
- })[];
355
- } | undefined;
356
- }, {
357
- conditions: {
358
- column: string;
359
- pattern: string | number | {
360
- type: "defined";
361
- } | {
362
- type: "undefined";
363
- } | {
364
- values: (string | number)[];
365
- type: "in";
366
- } | {
367
- values: (string | number)[];
368
- type: "not-in";
369
- };
370
- }[];
371
- action: "borrow" | "bridge-from" | "bridge-to" | "cross-replace" | "cross-trade" | "add-liquidity" | "deposit" | "deposit-with-bond" | "stake" | "burn" | "derivative-fee" | "fee" | "interest-fee" | "pay" | "realize-loss" | "stolen" | "transaction-fee" | "approve" | "fail-tx" | "ignore" | "move" | "receive-from-cex" | "revoke" | "send-to-cex" | "spam" | "airdrop" | "cash-back" | "derivative-profit" | "free-mint" | "game-reward" | "gift" | "hardfork" | "income" | "interest" | "mining" | "nft-royalty" | "realize-profit" | "staking-reward" | "liquidation" | "repayment" | "replace" | "swap-nft" | "unwrap" | "wrap" | "atomic-arbitrage" | "buy-crypto" | "buy-nft" | "mint-nft" | "sell-crypto" | "sell-nft" | "trade" | "transfer" | "value-down" | "value-up" | "remove-liquidity" | "unstake" | "withdraw" | "withdraw-with-bond";
372
- source: (string | {
373
- type: "column";
374
- column: string;
375
- } | {
376
- type: "service";
377
- })[];
378
- timestamp: string;
379
- transfers: {
380
- direction: "in" | "out";
381
- amount: string | {
382
- type: "plus" | "minus" | "times" | "divide";
383
- columns: string[];
384
- };
385
- asset: {
386
- type: "column";
387
- column: string;
388
- } | {
389
- type: "nft";
390
- id: (string | {
391
- type: "column";
392
- column: string;
393
- } | {
394
- type: "service";
395
- })[];
396
- } | {
397
- type: "custom";
398
- assetType: "CryptoCurrency" | "FiatCurrency" | "Nft";
399
- assetId: string;
400
- };
401
- }[];
402
- comment?: (string | {
403
- type: "column";
404
- column: string;
405
- } | {
406
- type: "service";
407
- })[] | undefined;
408
- crossId?: (string | {
409
- type: "column";
410
- column: string;
411
- } | {
412
- type: "service";
413
- })[] | undefined;
414
- crossType?: "start" | "middle" | "end" | undefined;
415
- loanId?: (string | {
416
- type: "column";
417
- column: string;
418
- } | {
419
- type: "service";
420
- })[] | undefined;
421
- target?: {
422
- type: "nft";
423
- id: (string | {
424
- type: "column";
425
- column: string;
426
- } | {
427
- type: "service";
428
- })[];
429
- } | undefined;
430
- }>, "many">;
431
- symbolAssetMap: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
432
- }, "strip", z.ZodTypeAny, {
433
- service: string;
434
- id: string;
435
- formatter: Record<string, ("string" | "blank" | "big-decimal" | "big-decimal-positive" | "big-decimal-negative" | "iso8601" | "iso8601-jp" | "datetime-jp")[]>;
436
- parsers: {
437
- conditions: {
438
- column: string;
439
- pattern: string | number | {
440
- type: "defined";
441
- } | {
442
- type: "undefined";
443
- } | {
444
- values: (string | number)[];
445
- type: "in";
446
- } | {
447
- values: (string | number)[];
448
- type: "not-in";
449
- };
450
- }[];
451
- action: "borrow" | "bridge-from" | "bridge-to" | "cross-replace" | "cross-trade" | "add-liquidity" | "deposit" | "deposit-with-bond" | "stake" | "burn" | "derivative-fee" | "fee" | "interest-fee" | "pay" | "realize-loss" | "stolen" | "transaction-fee" | "approve" | "fail-tx" | "ignore" | "move" | "receive-from-cex" | "revoke" | "send-to-cex" | "spam" | "airdrop" | "cash-back" | "derivative-profit" | "free-mint" | "game-reward" | "gift" | "hardfork" | "income" | "interest" | "mining" | "nft-royalty" | "realize-profit" | "staking-reward" | "liquidation" | "repayment" | "replace" | "swap-nft" | "unwrap" | "wrap" | "atomic-arbitrage" | "buy-crypto" | "buy-nft" | "mint-nft" | "sell-crypto" | "sell-nft" | "trade" | "transfer" | "value-down" | "value-up" | "remove-liquidity" | "unstake" | "withdraw" | "withdraw-with-bond";
452
- source: (string | {
453
- type: "column";
454
- column: string;
455
- } | {
456
- type: "service";
457
- })[];
458
- timestamp: string;
459
- transfers: {
460
- direction: "in" | "out";
461
- amount: string | {
462
- type: "plus" | "minus" | "times" | "divide";
463
- columns: string[];
464
- };
465
- asset: {
466
- type: "column";
467
- column: string;
468
- } | {
469
- type: "nft";
470
- id: (string | {
471
- type: "column";
472
- column: string;
473
- } | {
474
- type: "service";
475
- })[];
476
- } | {
477
- type: "custom";
478
- assetType: "CryptoCurrency" | "FiatCurrency" | "Nft";
479
- assetId: string;
480
- };
481
- }[];
482
- comment?: (string | {
483
- type: "column";
484
- column: string;
485
- } | {
486
- type: "service";
487
- })[] | undefined;
488
- crossId?: (string | {
489
- type: "column";
490
- column: string;
491
- } | {
492
- type: "service";
493
- })[] | undefined;
494
- crossType?: "start" | "middle" | "end" | undefined;
495
- loanId?: (string | {
496
- type: "column";
497
- column: string;
498
- } | {
499
- type: "service";
500
- })[] | undefined;
501
- target?: {
502
- type: "nft";
503
- id: (string | {
504
- type: "column";
505
- column: string;
506
- } | {
507
- type: "service";
508
- })[];
509
- } | undefined;
510
- }[];
511
- symbolAssetMap?: Record<string, string> | undefined;
512
- }, {
513
- service: string;
514
- id: string;
515
- formatter: Record<string, ("string" | "blank" | "big-decimal" | "big-decimal-positive" | "big-decimal-negative" | "iso8601" | "iso8601-jp" | "datetime-jp")[]>;
516
- parsers: {
517
- conditions: {
518
- column: string;
519
- pattern: string | number | {
520
- type: "defined";
521
- } | {
522
- type: "undefined";
523
- } | {
524
- values: (string | number)[];
525
- type: "in";
526
- } | {
527
- values: (string | number)[];
528
- type: "not-in";
529
- };
530
- }[];
531
- action: "borrow" | "bridge-from" | "bridge-to" | "cross-replace" | "cross-trade" | "add-liquidity" | "deposit" | "deposit-with-bond" | "stake" | "burn" | "derivative-fee" | "fee" | "interest-fee" | "pay" | "realize-loss" | "stolen" | "transaction-fee" | "approve" | "fail-tx" | "ignore" | "move" | "receive-from-cex" | "revoke" | "send-to-cex" | "spam" | "airdrop" | "cash-back" | "derivative-profit" | "free-mint" | "game-reward" | "gift" | "hardfork" | "income" | "interest" | "mining" | "nft-royalty" | "realize-profit" | "staking-reward" | "liquidation" | "repayment" | "replace" | "swap-nft" | "unwrap" | "wrap" | "atomic-arbitrage" | "buy-crypto" | "buy-nft" | "mint-nft" | "sell-crypto" | "sell-nft" | "trade" | "transfer" | "value-down" | "value-up" | "remove-liquidity" | "unstake" | "withdraw" | "withdraw-with-bond";
532
- source: (string | {
533
- type: "column";
534
- column: string;
535
- } | {
536
- type: "service";
537
- })[];
538
- timestamp: string;
539
- transfers: {
540
- direction: "in" | "out";
541
- amount: string | {
542
- type: "plus" | "minus" | "times" | "divide";
543
- columns: string[];
544
- };
545
- asset: {
546
- type: "column";
547
- column: string;
548
- } | {
549
- type: "nft";
550
- id: (string | {
551
- type: "column";
552
- column: string;
553
- } | {
554
- type: "service";
555
- })[];
556
- } | {
557
- type: "custom";
558
- assetType: "CryptoCurrency" | "FiatCurrency" | "Nft";
559
- assetId: string;
560
- };
561
- }[];
562
- comment?: (string | {
563
- type: "column";
564
- column: string;
565
- } | {
566
- type: "service";
567
- })[] | undefined;
568
- crossId?: (string | {
569
- type: "column";
570
- column: string;
571
- } | {
572
- type: "service";
573
- })[] | undefined;
574
- crossType?: "start" | "middle" | "end" | undefined;
575
- loanId?: (string | {
576
- type: "column";
577
- column: string;
578
- } | {
579
- type: "service";
580
- })[] | undefined;
581
- target?: {
582
- type: "nft";
583
- id: (string | {
584
- type: "column";
585
- column: string;
586
- } | {
587
- type: "service";
588
- })[];
589
- } | undefined;
590
- }[];
591
- symbolAssetMap?: Record<string, string> | undefined;
592
- }>;
593
- //# sourceMappingURL=schemas.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../schemas/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAM1B,CAAA"}
@@ -1,52 +0,0 @@
1
- import {
2
- type Action,
3
- type CryptoCurrency,
4
- type CryptoCurrencyDataSource,
5
- type FiatCurrency,
6
- setActionPrices,
7
- } from '@0xtorch/core'
8
- import { formatCsvRows } from './formatCsvRows'
9
- import { parseCsvFileToText } from './parseCsvFileToText'
10
- import { parseCsvRowsToActions } from './parseCsvRowsToActions'
11
- import { parseCsvText } from './parseCsvText'
12
- import type { CsvFormat } from './types'
13
-
14
- type ParseCsvFileToAccountActionsParameters = {
15
- readonly file: File
16
- readonly format: CsvFormat
17
- readonly accountId: string
18
- readonly cryptoCurrencies: readonly CryptoCurrency[]
19
- readonly fiatCurrencies: readonly FiatCurrency[]
20
- readonly fiat: FiatCurrency
21
- readonly cryptoCurrencyDataSource: CryptoCurrencyDataSource
22
- }
23
-
24
- export const parseCsvFileToAccountActions = async ({
25
- file,
26
- format: { service, formatter, parsers, symbolAssetMap },
27
- accountId,
28
- cryptoCurrencies,
29
- fiatCurrencies,
30
- fiat,
31
- cryptoCurrencyDataSource,
32
- }: ParseCsvFileToAccountActionsParameters): Promise<readonly Action[]> => {
33
- const text = await parseCsvFileToText(file)
34
- const rows = formatCsvRows({
35
- rows: parseCsvText(text),
36
- formatter,
37
- })
38
- const actions = parseCsvRowsToActions({
39
- rows,
40
- service,
41
- parsers,
42
- symbolAssetMap,
43
- accountId,
44
- cryptoCurrencies,
45
- fiatCurrencies,
46
- })
47
- return await setActionPrices({
48
- dataSource: cryptoCurrencyDataSource,
49
- actions,
50
- fiat,
51
- })
52
- }