@0xtorch/csv 0.0.79 → 0.0.81
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/parseRowsToActions/parse.js +6 -2
- package/_cjs/parseRowsToActions/parse.js.map +1 -1
- package/_cjs/schemas/formatterTypes.js +1 -1
- package/_cjs/schemas/formatterTypes.js.map +1 -1
- package/_cjs/schemas/parser.js +1 -1
- package/_cjs/schemas/parser.js.map +1 -1
- package/_esm/parseRowsToActions/parse.js +6 -2
- package/_esm/parseRowsToActions/parse.js.map +1 -1
- package/_esm/schemas/formatterTypes.js +1 -1
- package/_esm/schemas/formatterTypes.js.map +1 -1
- package/_esm/schemas/parser.js +1 -1
- package/_esm/schemas/parser.js.map +1 -1
- package/_types/parseRowsToActions/parse.d.ts.map +1 -1
- package/_types/schemas/format.d.ts +7017 -2580
- package/_types/schemas/format.d.ts.map +1 -1
- package/_types/schemas/parser.d.ts +26871 -19803
- package/_types/schemas/parser.d.ts.map +1 -1
- package/package.json +1 -1
- package/parseRowsToActions/parse.ts +6 -2
- package/schemas/formatterTypes.ts +1 -1
- package/schemas/parser.ts +1 -1
- package/tests/gemini-transaction.csv +3 -0
- package/tests/gemini.ts +72 -0
package/package.json
CHANGED
|
@@ -10,7 +10,6 @@ import type { parserSchema } from '../schemas/parser'
|
|
|
10
10
|
import type { FormattedRow } from '../types'
|
|
11
11
|
import { getAllValue } from './allValue'
|
|
12
12
|
import { getAssetById } from './asset'
|
|
13
|
-
import { getCellValue } from './cellValue'
|
|
14
13
|
import { isMatchPattern } from './pattern'
|
|
15
14
|
import { createTransfers } from './transfer'
|
|
16
15
|
|
|
@@ -54,7 +53,12 @@ export const parseRowsToActionsByParser = ({
|
|
|
54
53
|
const source = stringify(
|
|
55
54
|
getAllValue({ schema: generator.source, rows, service, fileId }),
|
|
56
55
|
)
|
|
57
|
-
const timestampValue =
|
|
56
|
+
const timestampValue = getAllValue({
|
|
57
|
+
schema: generator.timestamp,
|
|
58
|
+
rows,
|
|
59
|
+
service,
|
|
60
|
+
fileId,
|
|
61
|
+
})
|
|
58
62
|
const timestamp =
|
|
59
63
|
typeof timestampValue === 'number'
|
|
60
64
|
? timestampValue
|
|
@@ -183,7 +183,7 @@ export const datetimeTextSchema = z
|
|
|
183
183
|
.string()
|
|
184
184
|
// Dec 31 2024, 12:53 AM EST
|
|
185
185
|
.regex(
|
|
186
|
-
/^[A-Za-z]{3}\s+\d{1,2}
|
|
186
|
+
/^[A-Za-z]{3}\s+\d{1,2},?\s+\d{4},\s+\d{1,2}:\d{2}(?::\d{2})?\s+(?:AM|PM)(?:\s+[A-Z]{2,4})?$/,
|
|
187
187
|
)
|
|
188
188
|
.transform((v) => new Date(v).getTime())
|
|
189
189
|
|
package/schemas/parser.ts
CHANGED
|
@@ -200,7 +200,7 @@ const generatorSchema = z.object({
|
|
|
200
200
|
type: actionTypeUnionSchema,
|
|
201
201
|
source: allValueSchema,
|
|
202
202
|
evidence: actionEvidenceUnionSchema.optional(),
|
|
203
|
-
timestamp:
|
|
203
|
+
timestamp: allValueSchema,
|
|
204
204
|
comment: allValueSchema.optional(),
|
|
205
205
|
app: allValueSchema.optional(),
|
|
206
206
|
crossId: allValueSchema.optional(),
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
Date,Time (UTC),Type,Symbol,Specification,Liquidity Indicator,Trading Fee Rate (bps),USD Amount USD,Fee (USD) USD,USD Balance USD,BTC Amount BTC,Fee (BTC) BTC,BTC Balance BTC,ETH Amount ETH,Fee (ETH) ETH,ETH Balance ETH,GUSD Amount GUSD,Fee (GUSD) GUSD,GUSD Balance GUSD,DAI Amount DAI,Fee (DAI) DAI,DAI Balance DAI,SGD Amount SGD,Fee (SGD) SGD,SGD Balance SGD,USDC Amount USDC,Fee (USDC) USDC,USDC Balance USDC,USDT Amount USDT,Fee (USDT) USDT,USDT Balance USDT,Trade ID,Order ID,Order Date,Order Time,Client Order ID,API Session,Tx Hash,Deposit Destination,Deposit Tx Output,Withdrawal Destination,Withdrawal Tx Output
|
|
2
|
+
2022-03-08,12:37:56.017,Credit,DAI,Deposit (DAI),,,,,$0.00 ,,,0.0 BTC ,,,0.0 ETH ,,,0.0 GUSD ,100.0 DAI ,0.0 DAI ,100.0 DAI ,,,$0.00 ,,,0.0 USDC ,,,0.0 USDT ,,,,,,,3accf72636b0cd58f7896b1abde78b39d018d005f8b36500ffbf576f492e9e65,0x47AE17ed6c75A6793a894A62ea3c5f942E9561aA,0,,
|
|
3
|
+
,,,,,,,,$0.00 ,$0.00 ,,0.0 BTC ,0.0 BTC ,,0.0 ETH ,0.0 ETH ,,0.0 GUSD ,0.0 GUSD ,,0.0 DAI ,0.0 DAI ,,$0.00 ,$0.01 ,,0.0 USDC ,0.0 USDC ,,0.0 USDT ,0.0 USDT ,,,,,,,,,,,
|
package/tests/gemini.ts
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { CsvFormat } from '../types'
|
|
2
|
+
|
|
3
|
+
export const geminiTransactionFormat = {
|
|
4
|
+
id: 'gemini-transaction',
|
|
5
|
+
service: 'gemini',
|
|
6
|
+
ignoreStartColumns: [['', '', '', '']],
|
|
7
|
+
formatter: {
|
|
8
|
+
Date: ['blank', 'string'],
|
|
9
|
+
'Time (UTC)': ['blank', 'string'],
|
|
10
|
+
Type: ['blank', 'string'],
|
|
11
|
+
Symbol: ['blank', 'string'],
|
|
12
|
+
Specification: ['blank', 'string'],
|
|
13
|
+
'USD Amount USD': ['blank', 'string'],
|
|
14
|
+
'Fee (USD) USD': ['blank', 'string'],
|
|
15
|
+
'BTC Amount BTC': ['blank', 'string'],
|
|
16
|
+
'Fee (BTC) BTC': ['blank', 'string'],
|
|
17
|
+
'ETH Amount ETH': ['blank', 'string'],
|
|
18
|
+
'Fee (ETH) ETH': ['blank', 'string'],
|
|
19
|
+
'GUSD Amount GUSD': ['blank', 'string'],
|
|
20
|
+
'Fee (GUSD) GUSD': ['blank', 'string'],
|
|
21
|
+
'DAI Amount DAI': ['blank', 'string'],
|
|
22
|
+
'Fee (DAI) DAI': ['blank', 'string'],
|
|
23
|
+
'SGD Amount SGD': ['blank', 'string'],
|
|
24
|
+
'Fee (SGD) SGD': ['blank', 'string'],
|
|
25
|
+
'USDC Amount USDC': ['blank', 'string'],
|
|
26
|
+
'Fee (USDC) USDC': ['blank', 'string'],
|
|
27
|
+
'USDT Amount USDT': ['blank', 'string'],
|
|
28
|
+
'Fee (USDT) USDT': ['blank', 'string'],
|
|
29
|
+
},
|
|
30
|
+
parser: {
|
|
31
|
+
parsers: [
|
|
32
|
+
{
|
|
33
|
+
conditions: [
|
|
34
|
+
{
|
|
35
|
+
value: {
|
|
36
|
+
type: 'cell',
|
|
37
|
+
column: 'Type',
|
|
38
|
+
row: 0,
|
|
39
|
+
},
|
|
40
|
+
pattern: 'Credit',
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
generators: [
|
|
44
|
+
{
|
|
45
|
+
type: 'ignore',
|
|
46
|
+
source: {
|
|
47
|
+
type: 'join',
|
|
48
|
+
values: [
|
|
49
|
+
{ type: 'service' },
|
|
50
|
+
'_',
|
|
51
|
+
{ type: 'file-id' },
|
|
52
|
+
'_',
|
|
53
|
+
{ type: 'cell', column: 'Date', row: 0 },
|
|
54
|
+
'_',
|
|
55
|
+
{ type: 'cell', column: 'Time (UTC)', row: 0 },
|
|
56
|
+
],
|
|
57
|
+
},
|
|
58
|
+
timestamp: {
|
|
59
|
+
type: 'join',
|
|
60
|
+
values: [
|
|
61
|
+
{ type: 'cell', column: 'Date', row: 0 },
|
|
62
|
+
' ',
|
|
63
|
+
{ type: 'cell', column: 'Time (UTC)', row: 0 },
|
|
64
|
+
],
|
|
65
|
+
},
|
|
66
|
+
transfers: [],
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
},
|
|
72
|
+
} satisfies CsvFormat
|