@dhedge/backend-flatcoin-core 0.1.11 → 0.1.12
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/dist/index.d.ts +8 -1
- package/dist/index.js +49 -0
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/dist/index.d.ts
CHANGED
|
@@ -21,4 +21,11 @@ declare class FlatcoinPriceOneYear extends FlatcoinPriceParent {
|
|
|
21
21
|
declare class FlatcoinPrice extends FlatcoinPriceParent {
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
declare class Apy {
|
|
25
|
+
id: number;
|
|
26
|
+
monthly: number;
|
|
27
|
+
weekly: number;
|
|
28
|
+
daily: number;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export { Apy, FlatcoinPrice, FlatcoinPriceOneDay, FlatcoinPriceOneMonth, FlatcoinPriceOneWeek, FlatcoinPriceOneYear, FlatcoinPriceParent };
|
package/dist/index.js
CHANGED
|
@@ -79,7 +79,56 @@ var FlatcoinPrice = class extends FlatcoinPriceParent {
|
|
|
79
79
|
FlatcoinPrice = __decorateClass([
|
|
80
80
|
Entity6({ name: "flatcoin_prices" })
|
|
81
81
|
], FlatcoinPrice);
|
|
82
|
+
|
|
83
|
+
// src/entity/apy.ts
|
|
84
|
+
import { Column as Column2, Entity as Entity7, PrimaryGeneratedColumn as PrimaryGeneratedColumn2 } from "typeorm";
|
|
85
|
+
import { Field as Field2, Float, ObjectType as ObjectType2 } from "@nestjs/graphql";
|
|
86
|
+
|
|
87
|
+
// src/utils/column.numeric.transformer.ts
|
|
88
|
+
import { BigNumber } from "ethers";
|
|
89
|
+
var ColumnNumericTransformer = class {
|
|
90
|
+
to(data) {
|
|
91
|
+
return data;
|
|
92
|
+
}
|
|
93
|
+
from(data) {
|
|
94
|
+
return parseFloat(data);
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
var numericTransformer = new ColumnNumericTransformer();
|
|
98
|
+
var ColumnBigNumberTransformer = class {
|
|
99
|
+
to(data) {
|
|
100
|
+
return data == null ? void 0 : data.toBigInt();
|
|
101
|
+
}
|
|
102
|
+
from(data) {
|
|
103
|
+
return data ? BigNumber.from(data) : null;
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
var bigNumberTransformer = new ColumnBigNumberTransformer();
|
|
107
|
+
|
|
108
|
+
// src/entity/apy.ts
|
|
109
|
+
var Apy = class {
|
|
110
|
+
};
|
|
111
|
+
__decorateClass([
|
|
112
|
+
PrimaryGeneratedColumn2({ name: "id" })
|
|
113
|
+
], Apy.prototype, "id", 2);
|
|
114
|
+
__decorateClass([
|
|
115
|
+
Field2(() => Float, { nullable: false }),
|
|
116
|
+
Column2({ name: "monthly", type: "decimal", precision: 30, scale: 2, transformer: numericTransformer })
|
|
117
|
+
], Apy.prototype, "monthly", 2);
|
|
118
|
+
__decorateClass([
|
|
119
|
+
Field2(() => Float, { nullable: false }),
|
|
120
|
+
Column2({ name: "weekly", type: "decimal", precision: 30, scale: 2, transformer: numericTransformer })
|
|
121
|
+
], Apy.prototype, "weekly", 2);
|
|
122
|
+
__decorateClass([
|
|
123
|
+
Field2(() => Float, { nullable: false }),
|
|
124
|
+
Column2({ name: "daily", type: "decimal", precision: 30, scale: 2, transformer: numericTransformer })
|
|
125
|
+
], Apy.prototype, "daily", 2);
|
|
126
|
+
Apy = __decorateClass([
|
|
127
|
+
ObjectType2(),
|
|
128
|
+
Entity7({ name: "apy" })
|
|
129
|
+
], Apy);
|
|
82
130
|
export {
|
|
131
|
+
Apy,
|
|
83
132
|
FlatcoinPrice,
|
|
84
133
|
FlatcoinPriceOneDay,
|
|
85
134
|
FlatcoinPriceOneMonth,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/entity/flatcoin.price.one.day.ts","../src/entity/flatcoin.price.parent.ts","../src/entity/flatcoin.price.one.month.ts","../src/entity/flatcoin.price.one.week.ts","../src/entity/flatcoin.price.one.year.ts","../src/entity/flatcoin.price.ts"],"sourcesContent":["import { Entity } from 'typeorm';\nimport { FlatcoinPriceParent } from './flatcoin.price.parent';\n\n@Entity({ name: 'flatcoin_prices_1d' })\nexport class FlatcoinPriceOneDay extends FlatcoinPriceParent {}\n","import { Entity, PrimaryGeneratedColumn, Column } from 'typeorm';\nimport { Field, ObjectType } from '@nestjs/graphql';\n\n@ObjectType()\n@Entity()\nexport abstract class FlatcoinPriceParent {\n @PrimaryGeneratedColumn({ name: 'id' })\n id: number;\n\n @Field()\n @Column({ name: 'price_usd', type: 'numeric', precision: 30 })\n priceUsd: string;\n\n @Field()\n @Column({ name: 'price_usd_formatted', type: 'decimal', precision: 10, scale: 2 })\n priceUsdFormatted: number;\n\n @Field()\n @Column({ name: 'timestamp', type: 'numeric', precision: 25 })\n timestamp: number;\n\n @Column({ name: 'block_number', type: 'numeric', precision: 25 })\n blockNumber: number;\n}\n","import { Entity } from 'typeorm';\nimport { FlatcoinPriceParent } from './flatcoin.price.parent';\n\n@Entity({ name: 'flatcoin_prices_1m' })\nexport class FlatcoinPriceOneMonth extends FlatcoinPriceParent {}\n","import { Entity } from 'typeorm';\nimport { FlatcoinPriceParent } from './flatcoin.price.parent';\n\n@Entity({ name: 'flatcoin_prices_1w' })\nexport class FlatcoinPriceOneWeek extends FlatcoinPriceParent {}\n","import { Entity } from 'typeorm';\nimport { FlatcoinPriceParent } from './flatcoin.price.parent';\n\n@Entity({ name: 'flatcoin_prices_1y' })\nexport class FlatcoinPriceOneYear extends FlatcoinPriceParent {}\n","import { Entity } from 'typeorm';\nimport { FlatcoinPriceParent } from './flatcoin.price.parent';\n\n@Entity({ name: 'flatcoin_prices' })\nexport class FlatcoinPrice extends FlatcoinPriceParent {}\n"],"mappings":";;;;;;;;;;;;;AAAA,SAAS,UAAAA,eAAc;;;ACAvB,SAAS,QAAQ,wBAAwB,cAAc;AACvD,SAAS,OAAO,kBAAkB;AAI3B,IAAe,sBAAf,MAAm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AAM,kBAAkB,CAAC;AAAA,GACtB;","names":["Entity","Entity","Entity","Entity","Entity","Entity","Entity","Entity","Entity","Entity"]}
|
|
1
|
+
{"version":3,"sources":["../src/entity/flatcoin.price.one.day.ts","../src/entity/flatcoin.price.parent.ts","../src/entity/flatcoin.price.one.month.ts","../src/entity/flatcoin.price.one.week.ts","../src/entity/flatcoin.price.one.year.ts","../src/entity/flatcoin.price.ts","../src/entity/apy.ts","../src/utils/column.numeric.transformer.ts"],"sourcesContent":["import { Entity } from 'typeorm';\nimport { FlatcoinPriceParent } from './flatcoin.price.parent';\n\n@Entity({ name: 'flatcoin_prices_1d' })\nexport class FlatcoinPriceOneDay extends FlatcoinPriceParent {}\n","import { Entity, PrimaryGeneratedColumn, Column } from 'typeorm';\nimport { Field, ObjectType } from '@nestjs/graphql';\n\n@ObjectType()\n@Entity()\nexport abstract class FlatcoinPriceParent {\n @PrimaryGeneratedColumn({ name: 'id' })\n id: number;\n\n @Field()\n @Column({ name: 'price_usd', type: 'numeric', precision: 30 })\n priceUsd: string;\n\n @Field()\n @Column({ name: 'price_usd_formatted', type: 'decimal', precision: 10, scale: 2 })\n priceUsdFormatted: number;\n\n @Field()\n @Column({ name: 'timestamp', type: 'numeric', precision: 25 })\n timestamp: number;\n\n @Column({ name: 'block_number', type: 'numeric', precision: 25 })\n blockNumber: number;\n}\n","import { Entity } from 'typeorm';\nimport { FlatcoinPriceParent } from './flatcoin.price.parent';\n\n@Entity({ name: 'flatcoin_prices_1m' })\nexport class FlatcoinPriceOneMonth extends FlatcoinPriceParent {}\n","import { Entity } from 'typeorm';\nimport { FlatcoinPriceParent } from './flatcoin.price.parent';\n\n@Entity({ name: 'flatcoin_prices_1w' })\nexport class FlatcoinPriceOneWeek extends FlatcoinPriceParent {}\n","import { Entity } from 'typeorm';\nimport { FlatcoinPriceParent } from './flatcoin.price.parent';\n\n@Entity({ name: 'flatcoin_prices_1y' })\nexport class FlatcoinPriceOneYear extends FlatcoinPriceParent {}\n","import { Entity } from 'typeorm';\nimport { FlatcoinPriceParent } from './flatcoin.price.parent';\n\n@Entity({ name: 'flatcoin_prices' })\nexport class FlatcoinPrice extends FlatcoinPriceParent {}\n","import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';\nimport { Field, Float, ObjectType } from '@nestjs/graphql';\nimport { numericTransformer } from '../utils/column.numeric.transformer';\n\n@ObjectType()\n@Entity({ name: 'apy' })\nexport class Apy {\n @PrimaryGeneratedColumn({ name: 'id' })\n id: number;\n\n @Field(() => Float, { nullable: false })\n @Column({ name: 'monthly', type: 'decimal', precision: 30, scale: 2, transformer: numericTransformer })\n monthly: number;\n\n @Field(() => Float, { nullable: false })\n @Column({ name: 'weekly', type: 'decimal', precision: 30, scale: 2, transformer: numericTransformer })\n weekly: number;\n\n @Field(() => Float, { nullable: false })\n @Column({ name: 'daily', type: 'decimal', precision: 30, scale: 2, transformer: numericTransformer })\n daily: number;\n}\n","import { BigNumber } from 'ethers';\n\nclass ColumnNumericTransformer {\n to(data: number): number {\n return data;\n }\n\n from(data: string): number {\n return parseFloat(data);\n }\n}\n\nexport const numericTransformer = new ColumnNumericTransformer();\n\nclass ColumnBigNumberTransformer {\n to(data?: BigNumber): bigint | undefined {\n return data?.toBigInt();\n }\n\n from(data?: bigint): BigNumber | null {\n return data ? BigNumber.from(data) : null;\n }\n}\n\nexport const bigNumberTransformer = new ColumnBigNumberTransformer();\n"],"mappings":";;;;;;;;;;;;;AAAA,SAAS,UAAAA,eAAc;;;ACAvB,SAAS,QAAQ,wBAAwB,cAAc;AACvD,SAAS,OAAO,kBAAkB;AAI3B,IAAe,sBAAf,MAAmC;AAkB1C;AAhBE;AAAA,EADC,uBAAuB,EAAE,MAAM,KAAK,CAAC;AAAA,GADlB,oBAEpB;AAIA;AAAA,EAFC,MAAM;AAAA,EACN,OAAO,EAAE,MAAM,aAAa,MAAM,WAAW,WAAW,GAAG,CAAC;AAAA,GALzC,oBAMpB;AAIA;AAAA,EAFC,MAAM;AAAA,EACN,O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;AAAA,EACT;AAAA,EAEA,KAAK,MAAsB;AACzB,WAAO,WAAW,IAAI;AAAA,EACxB;AACF;AAEO,IAAM,qBAAqB,IAAI,yBAAyB;AAE/D,IAAM,6BAAN,MAAiC;AAAA,EAC/B,GAAG,MAAsC;AACvC,WAAO,6BAAM;AAAA,EACf;AAAA,EAEA,KAAK,MAAiC;AACpC,WAAO,OAAO,UAAU,KAAK,IAAI,IAAI;AAAA,EACvC;AACF;AAEO,IAAM,uBAAuB,IAAI,2BAA2B;;;ADlB5D,IAAM,MAAN,MAAU;AAejB;AAbE;AAAA,EADCC,wBAAuB,EAAE,MAAM,KAAK,CAAC;AAAA,GAD3B,IAEX;AAIA;AAAA,EAFCC,OAAM,MAAM,OAAO,EAAE,UAAU,MAAM,CAAC;AAAA,EACtCC,QAAO,EAAE,MAAM,WAAW,MAAM,WAAW,WAAW,IAAI,OAAO,GAAG,aAAa,mBAAmB,CAAC;AAAA,GAL3F,IAMX;AAIA;AAAA,EAFCD,OAAM,MAAM,OAAO,EAAE,UAAU,MAAM,CAAC;AAAA,EACtCC,QAAO,EAAE,MAAM,UAAU,MAAM,WAAW,WAAW,IAAI,OAAO,GAAG,aAAa,mBAAmB,CAAC;AAAA,GAT1F,IAUX;AAIA;AAAA,EAFCD,OAAM,MAAM,OAAO,EAAE,UAAU,MAAM,CAAC;AAAA,EACtCC,QAAO,EAAE,MAAM,SAAS,MAAM,WAAW,WAAW,IAAI,OAAO,GAAG,aAAa,mBAAmB,CAAC;AAAA,GAbzF,IAcX;AAdW,MAAN;AAAA,EAFNC,YAAW;AAAA,EACXC,QAAO,EAAE,MAAM,MAAM,CAAC;AAAA,GACV;","names":["Entity","Entity","Entity","Entity","Entity","Entity","Entity","Entity","Entity","Entity","Column","Entity","PrimaryGeneratedColumn","Field","ObjectType","PrimaryGeneratedColumn","Field","Column","ObjectType","Entity"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dhedge/backend-flatcoin-core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.12",
|
|
4
4
|
"description": "Backend Flatcoin Core",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
"sideEffects": false,
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@nestjs/graphql": "^12.0.9",
|
|
21
|
-
"typeorm": "^0.3.17"
|
|
21
|
+
"typeorm": "^0.3.17",
|
|
22
|
+
"ethers": "5.7.2"
|
|
22
23
|
},
|
|
23
24
|
"devDependencies": {
|
|
24
25
|
"@swc/core": "^1.3.90",
|