-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8849dc1
commit 2b7db79
Showing
29 changed files
with
1,823 additions
and
1,916 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
import { AfterLoad, ViewColumn, ViewEntity } from "typeorm"; | ||
import { AccountID, AssetCode, AssetID } from "../../model"; | ||
import { AccountFlagsFactory } from "../../model/factories"; | ||
|
||
@ViewEntity({ | ||
name: "assets", | ||
expression: ` | ||
( SELECT (((t.assetcode)::text || '-'::text) || (t.issuer)::text) AS id, | ||
t.assetcode AS code, | ||
t.issuer, | ||
t.flags, | ||
sum(t.balance) AS "totalSupply", | ||
sum(t.balance) FILTER (WHERE (t.flags = 1)) AS "circulatingSupply", | ||
count(t.accountid) AS "holdersCount", | ||
count(t.accountid) FILTER (WHERE (t.flags = 0)) AS "unauthorizedHoldersCount", | ||
max(t.lastmodified) AS "lastActivity" | ||
FROM trustlines t | ||
GROUP BY t.issuer, t.assetcode | ||
ORDER BY (count(t.accountid)) DESC) | ||
UNION | ||
SELECT 'native'::text AS id, | ||
'XLM'::character varying AS code, | ||
4 AS flags, | ||
NULL::character varying AS issuer, | ||
sum(accounts.balance) AS "totalSupply", | ||
sum(accounts.balance) AS "circulatingSupply", | ||
count(*) AS "holdersCount", | ||
0 AS "unauthorizedHoldersCount", | ||
max(accounts.lastmodified) AS "lastActivity" | ||
FROM accounts | ||
` | ||
}) | ||
/* tslint:disable */ | ||
export class Asset { | ||
@ViewColumn() | ||
id: AssetID; | ||
|
||
@ViewColumn() | ||
code: AssetCode; | ||
|
||
@ViewColumn() | ||
issuer: AccountID; | ||
|
||
@ViewColumn() | ||
totalSupply: string; | ||
|
||
@ViewColumn() | ||
circulatingSupply: string; | ||
|
||
@ViewColumn() | ||
holdersCount: number; | ||
|
||
@ViewColumn() | ||
unauthorizedHoldersCount: number; | ||
|
||
@ViewColumn() | ||
lastActivity: number; | ||
|
||
@ViewColumn() | ||
flags: number; | ||
|
||
public get paging_token() { | ||
return this.id; | ||
} | ||
|
||
public get authRequired() { | ||
return this._authRequired; | ||
} | ||
|
||
public get authRevocable() { | ||
return this._authRevocable; | ||
} | ||
|
||
public get authImmutable() { | ||
return this._authImmutable; | ||
} | ||
|
||
private _authRequired: boolean; | ||
private _authRevocable: boolean; | ||
private _authImmutable: boolean; | ||
|
||
@AfterLoad() | ||
parseFlags() { | ||
const parsedFlags = AccountFlagsFactory.fromValue(this.flags); | ||
this._authRequired = parsedFlags.authRequired; | ||
this._authRevocable = parsedFlags.authRevocable; | ||
this._authImmutable = parsedFlags.authImmutable; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
export * from "./account"; | ||
export * from "./account_data"; | ||
export * from "./asset"; | ||
export * from "./ledgerheader"; | ||
export * from "./offer"; | ||
export * from "./trustline"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { Column, Entity, PrimaryColumn } from "typeorm"; | ||
|
||
@Entity("ledgerheaders") | ||
/* tslint:disable */ | ||
export class LedgerHeader { | ||
@PrimaryColumn({ name: "ledgerhash" }) | ||
ledgerHash: string; | ||
|
||
@Column({ name: "prevhash" }) | ||
prevHash: string; | ||
|
||
@Column({ name: "bucketlisthash" }) | ||
bucketListHash: string; | ||
|
||
@Column({ name: "ledgerseq" }) | ||
seq: number; | ||
|
||
@Column({ name: "closetime" }) | ||
closeTime: Date; | ||
|
||
@Column() | ||
data: string; | ||
} |
Oops, something went wrong.