@pax2pay/model-banking 0.1.528 → 0.1.529
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/Client/Treasury.ts +4 -3
- package/Supplier/index.ts +6 -0
- package/Treasury/Snapshot/Emoney.ts +2 -0
- package/Treasury/Snapshot/index.ts +65 -5
- package/dist/cjs/Client/Treasury.d.ts +1 -1
- package/dist/cjs/Client/Treasury.js +1 -2
- package/dist/cjs/Client/Treasury.js.map +1 -1
- package/dist/cjs/Supplier/index.d.ts +2 -0
- package/dist/cjs/Supplier/index.js +5 -0
- package/dist/cjs/Supplier/index.js.map +1 -1
- package/dist/cjs/Treasury/Snapshot/Emoney.d.ts +2 -0
- package/dist/cjs/Treasury/Snapshot/index.d.ts +35 -183
- package/dist/cjs/Treasury/Snapshot/index.js +44 -3
- package/dist/cjs/Treasury/Snapshot/index.js.map +1 -1
- package/dist/mjs/Client/Treasury.d.ts +1 -1
- package/dist/mjs/Client/Treasury.js +1 -2
- package/dist/mjs/Client/Treasury.js.map +1 -1
- package/dist/mjs/Supplier/index.d.ts +2 -0
- package/dist/mjs/Supplier/index.js +5 -0
- package/dist/mjs/Supplier/index.js.map +1 -1
- package/dist/mjs/Treasury/Snapshot/Emoney.d.ts +2 -0
- package/dist/mjs/Treasury/Snapshot/index.d.ts +35 -183
- package/dist/mjs/Treasury/Snapshot/index.js +44 -3
- package/dist/mjs/Treasury/Snapshot/index.js.map +1 -1
- package/package.json +1 -1
- package/Treasury/Snapshot/Fragment.ts +0 -115
- package/dist/cjs/Treasury/Snapshot/Fragment.d.ts +0 -53
- package/dist/cjs/Treasury/Snapshot/Fragment.js +0 -93
- package/dist/cjs/Treasury/Snapshot/Fragment.js.map +0 -1
- package/dist/mjs/Treasury/Snapshot/Fragment.d.ts +0 -53
- package/dist/mjs/Treasury/Snapshot/Fragment.js +0 -90
- package/dist/mjs/Treasury/Snapshot/Fragment.js.map +0 -1
package/Client/Treasury.ts
CHANGED
|
@@ -5,9 +5,10 @@ import { Treasury as TreasuryModel } from "../Treasury"
|
|
|
5
5
|
|
|
6
6
|
export class Treasury {
|
|
7
7
|
constructor(private readonly client: http.Client) {}
|
|
8
|
-
async fetch(hour?: isoly.DateTime): Promise<TreasuryModel.Snapshot | gracely.Error> {
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
async fetch(hour?: isoly.DateTime): Promise<TreasuryModel.Snapshot[] | gracely.Error> {
|
|
9
|
+
return this.client.get<TreasuryModel.Snapshot[]>(
|
|
10
|
+
`/treasury/v2/snapshot${hour ? `/${isoly.DateTime.truncate(hour, "hours")}` : ""}`
|
|
11
|
+
)
|
|
11
12
|
}
|
|
12
13
|
async listTransactions(accountId: string): Promise<TreasuryModel.Transaction[] | gracely.Error> {
|
|
13
14
|
return this.client.get<TreasuryModel.Transaction[]>(`/treasury/account/${accountId}/transaction`)
|
package/Supplier/index.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { isoly } from "isoly"
|
|
2
2
|
import { isly } from "isly"
|
|
3
|
+
import { Realm } from "../Realm"
|
|
3
4
|
|
|
4
5
|
export type Supplier = typeof Supplier.names[number]
|
|
5
6
|
export namespace Supplier {
|
|
@@ -11,4 +12,9 @@ export namespace Supplier {
|
|
|
11
12
|
paxgiro: ["GBP", "SEK", "USD", "EUR"],
|
|
12
13
|
paxgiroCredit: ["GBP", "SEK", "USD", "EUR"],
|
|
13
14
|
}
|
|
15
|
+
export const realm: Record<Realm, Supplier[]> = {
|
|
16
|
+
eea: [],
|
|
17
|
+
test: ["paxgiro", "paxgiroCredit"],
|
|
18
|
+
uk: ["bankingcircle", "clearbank"],
|
|
19
|
+
}
|
|
14
20
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { isoly } from "isoly"
|
|
2
2
|
import { Balances } from "../../Balances"
|
|
3
3
|
import { Counterbalances } from "../../Counterbalances"
|
|
4
|
+
import { Supplier } from "../../Supplier"
|
|
4
5
|
|
|
5
6
|
export interface Emoney {
|
|
6
7
|
organization: string
|
|
7
8
|
account: string
|
|
9
|
+
supplier?: Supplier
|
|
8
10
|
timestamp: isoly.DateTime
|
|
9
11
|
balances: Balances
|
|
10
12
|
counterbalances: Counterbalances
|
|
@@ -1,16 +1,76 @@
|
|
|
1
1
|
import { isoly } from "isoly"
|
|
2
2
|
import { isly } from "isly"
|
|
3
|
+
import { Balance } from "../../Balance"
|
|
4
|
+
import { Supplier } from "../../Supplier"
|
|
5
|
+
import { Warning } from "../../Warning"
|
|
6
|
+
import { Account } from "../Account"
|
|
3
7
|
import { Emoney as SnapshotEmoney } from "./Emoney"
|
|
4
8
|
import { Fiat as SnapshotFiat } from "./Fiat"
|
|
5
|
-
import { Fragment as SnapshotFragment } from "./Fragment"
|
|
6
9
|
import { funding as snapshotFunding } from "./funding"
|
|
7
10
|
|
|
8
|
-
export
|
|
9
|
-
|
|
11
|
+
export interface Snapshot {
|
|
12
|
+
warnings: Warning.Snapshot[]
|
|
13
|
+
emoney: Balance.Extended & { total?: number }
|
|
14
|
+
currency: isoly.Currency
|
|
15
|
+
supplier: Supplier
|
|
16
|
+
counterbalance: Snapshot.Counterbalance
|
|
17
|
+
fiat: {
|
|
18
|
+
safe: number
|
|
19
|
+
unsafe: number
|
|
20
|
+
total: number // emoney issuable total amount
|
|
21
|
+
other: number
|
|
22
|
+
buffer: number
|
|
23
|
+
accounts: Account[]
|
|
24
|
+
}
|
|
25
|
+
}
|
|
10
26
|
export namespace Snapshot {
|
|
11
|
-
export import Fragment = SnapshotFragment
|
|
12
27
|
export import funding = snapshotFunding
|
|
13
28
|
export type Emoney = SnapshotEmoney
|
|
14
29
|
export type Fiat = SnapshotFiat
|
|
15
|
-
export
|
|
30
|
+
export type Counterbalance = Record<string, { total: number; account: Record<string, { amount: number }> }>
|
|
31
|
+
export namespace Counterbalance {
|
|
32
|
+
export const type = isly.record<Counterbalance>(
|
|
33
|
+
isly.string(),
|
|
34
|
+
isly.object<Counterbalance[string]>({
|
|
35
|
+
total: isly.number(),
|
|
36
|
+
account: isly.record<Counterbalance[string]["account"]>(
|
|
37
|
+
isly.string(),
|
|
38
|
+
isly.object<Counterbalance[string]["account"][string]>({ amount: isly.number() })
|
|
39
|
+
),
|
|
40
|
+
})
|
|
41
|
+
)
|
|
42
|
+
export function sum(currency: isoly.Currency, accounts: Record<string, { amount: number }>): number {
|
|
43
|
+
return Object.values(accounts).reduce(
|
|
44
|
+
(result, account) => isoly.Currency.add(currency, result, account.amount),
|
|
45
|
+
0
|
|
46
|
+
)
|
|
47
|
+
}
|
|
48
|
+
export function validate(currency: isoly.Currency, counterbalances: Counterbalance): boolean {
|
|
49
|
+
for (const counterbalance of Object.values(counterbalances))
|
|
50
|
+
if (isoly.Currency.subtract(currency, counterbalance.total, sum(currency, counterbalance.account)))
|
|
51
|
+
return false
|
|
52
|
+
return true
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
export function validate(snapshot: Snapshot): boolean {
|
|
56
|
+
const validCounterbalance = Counterbalance.validate(snapshot.currency, snapshot.counterbalance)
|
|
57
|
+
const issuable = snapshot.fiat.total
|
|
58
|
+
const actual = snapshot.emoney.actual ?? 0
|
|
59
|
+
return validCounterbalance && issuable == actual
|
|
60
|
+
}
|
|
61
|
+
export const type = isly.object<Snapshot>({
|
|
62
|
+
warnings: Warning.Snapshot.type.array(),
|
|
63
|
+
emoney: Balance.Extended,
|
|
64
|
+
counterbalance: Counterbalance.type,
|
|
65
|
+
currency: isly.fromIs("currency", isoly.Currency.is),
|
|
66
|
+
supplier: Supplier.type,
|
|
67
|
+
fiat: isly.object({
|
|
68
|
+
safe: isly.number(),
|
|
69
|
+
unsafe: isly.number(),
|
|
70
|
+
total: isly.number(),
|
|
71
|
+
other: isly.number(),
|
|
72
|
+
buffer: isly.number(),
|
|
73
|
+
accounts: Account.type.array(),
|
|
74
|
+
}),
|
|
75
|
+
})
|
|
16
76
|
}
|
|
@@ -5,7 +5,7 @@ import { Treasury as TreasuryModel } from "../Treasury";
|
|
|
5
5
|
export declare class Treasury {
|
|
6
6
|
private readonly client;
|
|
7
7
|
constructor(client: http.Client);
|
|
8
|
-
fetch(hour?: isoly.DateTime): Promise<TreasuryModel.Snapshot | gracely.Error>;
|
|
8
|
+
fetch(hour?: isoly.DateTime): Promise<TreasuryModel.Snapshot[] | gracely.Error>;
|
|
9
9
|
listTransactions(accountId: string): Promise<TreasuryModel.Transaction[] | gracely.Error>;
|
|
10
10
|
listAccounts(): Promise<TreasuryModel.Account.Listable[] | gracely.Error>;
|
|
11
11
|
}
|
|
@@ -8,8 +8,7 @@ class Treasury {
|
|
|
8
8
|
this.client = client;
|
|
9
9
|
}
|
|
10
10
|
async fetch(hour) {
|
|
11
|
-
|
|
12
|
-
return this.client.get(`/treasury/v2/snapshot${path}`);
|
|
11
|
+
return this.client.get(`/treasury/v2/snapshot${hour ? `/${isoly_1.isoly.DateTime.truncate(hour, "hours")}` : ""}`);
|
|
13
12
|
}
|
|
14
13
|
async listTransactions(accountId) {
|
|
15
14
|
return this.client.get(`/treasury/account/${accountId}/transaction`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Treasury.js","sourceRoot":"","sources":["../../../Client/Treasury.ts"],"names":[],"mappings":";;;AACA,iCAA6B;AAI7B,MAAa,QAAQ;IACS;IAA7B,YAA6B,MAAmB;QAAnB,WAAM,GAAN,MAAM,CAAa;IAAG,CAAC;IACpD,KAAK,CAAC,KAAK,CAAC,IAAqB;QAChC,
|
|
1
|
+
{"version":3,"file":"Treasury.js","sourceRoot":"","sources":["../../../Client/Treasury.ts"],"names":[],"mappings":";;;AACA,iCAA6B;AAI7B,MAAa,QAAQ;IACS;IAA7B,YAA6B,MAAmB;QAAnB,WAAM,GAAN,MAAM,CAAa;IAAG,CAAC;IACpD,KAAK,CAAC,KAAK,CAAC,IAAqB;QAChC,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CACrB,wBAAwB,IAAI,CAAC,CAAC,CAAC,IAAI,aAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAClF,CAAA;IACF,CAAC;IACD,KAAK,CAAC,gBAAgB,CAAC,SAAiB;QACvC,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAA8B,qBAAqB,SAAS,cAAc,CAAC,CAAA;IAClG,CAAC;IACD,KAAK,CAAC,YAAY;QACjB,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAmC,mBAAmB,CAAC,CAAA;IAC9E,CAAC;CACD;AAbD,4BAaC"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { isoly } from "isoly";
|
|
2
2
|
import { isly } from "isly";
|
|
3
|
+
import { Realm } from "../Realm";
|
|
3
4
|
export type Supplier = typeof Supplier.names[number];
|
|
4
5
|
export declare namespace Supplier {
|
|
5
6
|
const names: readonly ["paxgiro", "clearbank", "bankingcircle", "paxgiroCredit"];
|
|
6
7
|
const type: isly.Type<"paxgiro" | "clearbank" | "bankingcircle" | "paxgiroCredit">;
|
|
7
8
|
const currencies: Record<Supplier, isoly.Currency[]>;
|
|
9
|
+
const realm: Record<Realm, Supplier[]>;
|
|
8
10
|
}
|
|
@@ -12,5 +12,10 @@ var Supplier;
|
|
|
12
12
|
paxgiro: ["GBP", "SEK", "USD", "EUR"],
|
|
13
13
|
paxgiroCredit: ["GBP", "SEK", "USD", "EUR"],
|
|
14
14
|
};
|
|
15
|
+
Supplier.realm = {
|
|
16
|
+
eea: [],
|
|
17
|
+
test: ["paxgiro", "paxgiroCredit"],
|
|
18
|
+
uk: ["bankingcircle", "clearbank"],
|
|
19
|
+
};
|
|
15
20
|
})(Supplier || (exports.Supplier = Supplier = {}));
|
|
16
21
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../Supplier/index.ts"],"names":[],"mappings":";;;AACA,+BAA2B;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../Supplier/index.ts"],"names":[],"mappings":";;;AACA,+BAA2B;AAI3B,IAAiB,QAAQ,CAcxB;AAdD,WAAiB,QAAQ;IACX,cAAK,GAAG,CAAC,SAAS,EAAE,WAAW,EAAE,eAAe,EAAE,eAAe,CAAU,CAAA;IAC3E,aAAI,GAAG,WAAI,CAAC,MAAM,CAAW,SAAA,KAAK,CAAC,CAAA;IACnC,mBAAU,GAAuC;QAC7D,SAAS,EAAE,CAAC,KAAK,CAAC;QAClB,aAAa,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC;QACvE,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC;QACrC,aAAa,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC;KAC3C,CAAA;IACY,cAAK,GAA8B;QAC/C,GAAG,EAAE,EAAE;QACP,IAAI,EAAE,CAAC,SAAS,EAAE,eAAe,CAAC;QAClC,EAAE,EAAE,CAAC,eAAe,EAAE,WAAW,CAAC;KAClC,CAAA;AACF,CAAC,EAdgB,QAAQ,wBAAR,QAAQ,QAcxB"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { isoly } from "isoly";
|
|
2
2
|
import { Balances } from "../../Balances";
|
|
3
3
|
import { Counterbalances } from "../../Counterbalances";
|
|
4
|
+
import { Supplier } from "../../Supplier";
|
|
4
5
|
export interface Emoney {
|
|
5
6
|
organization: string;
|
|
6
7
|
account: string;
|
|
8
|
+
supplier?: Supplier;
|
|
7
9
|
timestamp: isoly.DateTime;
|
|
8
10
|
balances: Balances;
|
|
9
11
|
counterbalances: Counterbalances;
|
|
@@ -1,194 +1,46 @@
|
|
|
1
1
|
import { isoly } from "isoly";
|
|
2
2
|
import { isly } from "isly";
|
|
3
|
+
import { Balance } from "../../Balance";
|
|
4
|
+
import { Supplier } from "../../Supplier";
|
|
5
|
+
import { Warning } from "../../Warning";
|
|
6
|
+
import { Account } from "../Account";
|
|
3
7
|
import { Emoney as SnapshotEmoney } from "./Emoney";
|
|
4
8
|
import { Fiat as SnapshotFiat } from "./Fiat";
|
|
5
|
-
import { Fragment as SnapshotFragment } from "./Fragment";
|
|
6
9
|
import { funding as snapshotFunding } from "./funding";
|
|
7
|
-
export
|
|
10
|
+
export interface Snapshot {
|
|
11
|
+
warnings: Warning.Snapshot[];
|
|
12
|
+
emoney: Balance.Extended & {
|
|
13
|
+
total?: number;
|
|
14
|
+
};
|
|
15
|
+
currency: isoly.Currency;
|
|
16
|
+
supplier: Supplier;
|
|
17
|
+
counterbalance: Snapshot.Counterbalance;
|
|
18
|
+
fiat: {
|
|
19
|
+
safe: number;
|
|
20
|
+
unsafe: number;
|
|
21
|
+
total: number;
|
|
22
|
+
other: number;
|
|
23
|
+
buffer: number;
|
|
24
|
+
accounts: Account[];
|
|
25
|
+
};
|
|
26
|
+
}
|
|
8
27
|
export declare namespace Snapshot {
|
|
9
|
-
export import Fragment = SnapshotFragment;
|
|
10
28
|
export import funding = snapshotFunding;
|
|
11
29
|
type Emoney = SnapshotEmoney;
|
|
12
30
|
type Fiat = SnapshotFiat;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
ANG: any;
|
|
19
|
-
AOA: any;
|
|
20
|
-
ARS: any;
|
|
21
|
-
AUD: any;
|
|
22
|
-
AWG: any;
|
|
23
|
-
AZN: any;
|
|
24
|
-
BAM: any;
|
|
25
|
-
BBD: any;
|
|
26
|
-
BDT: any;
|
|
27
|
-
BGN: any;
|
|
28
|
-
BHD: any;
|
|
29
|
-
BIF: any;
|
|
30
|
-
BMD: any;
|
|
31
|
-
BND: any;
|
|
32
|
-
BOB: any;
|
|
33
|
-
BOV: any;
|
|
34
|
-
BRL: any;
|
|
35
|
-
BSD: any;
|
|
36
|
-
BTN: any;
|
|
37
|
-
BWP: any;
|
|
38
|
-
BYN: any;
|
|
39
|
-
BZD: any;
|
|
40
|
-
CAD: any;
|
|
41
|
-
CDF: any;
|
|
42
|
-
CHE: any;
|
|
43
|
-
CHF: any;
|
|
44
|
-
CHW: any;
|
|
45
|
-
CLF: any;
|
|
46
|
-
CLP: any;
|
|
47
|
-
CNY: any;
|
|
48
|
-
COP: any;
|
|
49
|
-
COU: any;
|
|
50
|
-
CRC: any;
|
|
51
|
-
CUC: any;
|
|
52
|
-
CUP: any;
|
|
53
|
-
CVE: any;
|
|
54
|
-
CZK: any;
|
|
55
|
-
DJF: any;
|
|
56
|
-
DKK: any;
|
|
57
|
-
DOP: any;
|
|
58
|
-
DZD: any;
|
|
59
|
-
EGP: any;
|
|
60
|
-
ERN: any;
|
|
61
|
-
ETB: any;
|
|
62
|
-
EUR: any;
|
|
63
|
-
FJD: any;
|
|
64
|
-
FKP: any;
|
|
65
|
-
GBP: any;
|
|
66
|
-
GEL: any;
|
|
67
|
-
GHS: any;
|
|
68
|
-
GIP: any;
|
|
69
|
-
GMD: any;
|
|
70
|
-
GNF: any;
|
|
71
|
-
GTQ: any;
|
|
72
|
-
GYD: any;
|
|
73
|
-
HKD: any;
|
|
74
|
-
HNL: any;
|
|
75
|
-
HRK: any;
|
|
76
|
-
HTG: any;
|
|
77
|
-
HUF: any;
|
|
78
|
-
IDR: any;
|
|
79
|
-
ILS: any;
|
|
80
|
-
INR: any;
|
|
81
|
-
IQD: any;
|
|
82
|
-
IRR: any;
|
|
83
|
-
ISK: any;
|
|
84
|
-
JMD: any;
|
|
85
|
-
JOD: any;
|
|
86
|
-
JPY: any;
|
|
87
|
-
KES: any;
|
|
88
|
-
KGS: any;
|
|
89
|
-
KHR: any;
|
|
90
|
-
KMF: any;
|
|
91
|
-
KPW: any;
|
|
92
|
-
KRW: any;
|
|
93
|
-
KWD: any;
|
|
94
|
-
KYD: any;
|
|
95
|
-
KZT: any;
|
|
96
|
-
LAK: any;
|
|
97
|
-
LBP: any;
|
|
98
|
-
LKR: any;
|
|
99
|
-
LRD: any;
|
|
100
|
-
LSL: any;
|
|
101
|
-
LYD: any;
|
|
102
|
-
MAD: any;
|
|
103
|
-
MDL: any;
|
|
104
|
-
MGA: any;
|
|
105
|
-
MKD: any;
|
|
106
|
-
MMK: any;
|
|
107
|
-
MNT: any;
|
|
108
|
-
MOP: any;
|
|
109
|
-
MRU: any;
|
|
110
|
-
MUR: any;
|
|
111
|
-
MVR: any;
|
|
112
|
-
MWK: any;
|
|
113
|
-
MXN: any;
|
|
114
|
-
MXV: any;
|
|
115
|
-
MYR: any;
|
|
116
|
-
MZN: any;
|
|
117
|
-
NAD: any;
|
|
118
|
-
NGN: any;
|
|
119
|
-
NIO: any;
|
|
120
|
-
NOK: any;
|
|
121
|
-
NPR: any;
|
|
122
|
-
NZD: any;
|
|
123
|
-
OMR: any;
|
|
124
|
-
PAB: any;
|
|
125
|
-
PEN: any;
|
|
126
|
-
PGK: any;
|
|
127
|
-
PHP: any;
|
|
128
|
-
PKR: any;
|
|
129
|
-
PLN: any;
|
|
130
|
-
PYG: any;
|
|
131
|
-
QAR: any;
|
|
132
|
-
RON: any;
|
|
133
|
-
RSD: any;
|
|
134
|
-
RUB: any;
|
|
135
|
-
RWF: any;
|
|
136
|
-
SAR: any;
|
|
137
|
-
SBD: any;
|
|
138
|
-
SCR: any;
|
|
139
|
-
SDG: any;
|
|
140
|
-
SEK: any;
|
|
141
|
-
SGD: any;
|
|
142
|
-
SHP: any;
|
|
143
|
-
SLL: any;
|
|
144
|
-
SOS: any;
|
|
145
|
-
SRD: any;
|
|
146
|
-
SSP: any;
|
|
147
|
-
STN: any;
|
|
148
|
-
SVC: any;
|
|
149
|
-
SYP: any;
|
|
150
|
-
SZL: any;
|
|
151
|
-
THB: any;
|
|
152
|
-
TJS: any;
|
|
153
|
-
TMT: any;
|
|
154
|
-
TND: any;
|
|
155
|
-
TOP: any;
|
|
156
|
-
TRY: any;
|
|
157
|
-
TTD: any;
|
|
158
|
-
TWD: any;
|
|
159
|
-
TZS: any;
|
|
160
|
-
UAH: any;
|
|
161
|
-
UGX: any;
|
|
162
|
-
USD: any;
|
|
163
|
-
USN: any;
|
|
164
|
-
UYI: any;
|
|
165
|
-
UYU: any;
|
|
166
|
-
UYW: any;
|
|
167
|
-
UZS: any;
|
|
168
|
-
VES: any;
|
|
169
|
-
VND: any;
|
|
170
|
-
VUV: any;
|
|
171
|
-
WST: any;
|
|
172
|
-
XAF: any;
|
|
173
|
-
XAG: any;
|
|
174
|
-
XAU: any;
|
|
175
|
-
XBA: any;
|
|
176
|
-
XBB: any;
|
|
177
|
-
XBC: any;
|
|
178
|
-
XBD: any;
|
|
179
|
-
XCD: any;
|
|
180
|
-
XDR: any;
|
|
181
|
-
XOF: any;
|
|
182
|
-
XPD: any;
|
|
183
|
-
XPF: any;
|
|
184
|
-
XPT: any;
|
|
185
|
-
XSU: any;
|
|
186
|
-
XTS: any;
|
|
187
|
-
XUA: any;
|
|
188
|
-
XXX: any;
|
|
189
|
-
YER: any;
|
|
190
|
-
ZAR: any;
|
|
191
|
-
ZMW: any;
|
|
192
|
-
ZWL: any;
|
|
31
|
+
type Counterbalance = Record<string, {
|
|
32
|
+
total: number;
|
|
33
|
+
account: Record<string, {
|
|
34
|
+
amount: number;
|
|
35
|
+
}>;
|
|
193
36
|
}>;
|
|
37
|
+
namespace Counterbalance {
|
|
38
|
+
const type: isly.Type<Counterbalance>;
|
|
39
|
+
function sum(currency: isoly.Currency, accounts: Record<string, {
|
|
40
|
+
amount: number;
|
|
41
|
+
}>): number;
|
|
42
|
+
function validate(currency: isoly.Currency, counterbalances: Counterbalance): boolean;
|
|
43
|
+
}
|
|
44
|
+
function validate(snapshot: Snapshot): boolean;
|
|
45
|
+
const type: import("isly/dist/cjs/object").IslyObject<Snapshot, object>;
|
|
194
46
|
}
|
|
@@ -3,12 +3,53 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Snapshot = void 0;
|
|
4
4
|
const isoly_1 = require("isoly");
|
|
5
5
|
const isly_1 = require("isly");
|
|
6
|
-
const
|
|
6
|
+
const Balance_1 = require("../../Balance");
|
|
7
|
+
const Supplier_1 = require("../../Supplier");
|
|
8
|
+
const Warning_1 = require("../../Warning");
|
|
9
|
+
const Account_1 = require("../Account");
|
|
7
10
|
const funding_1 = require("./funding");
|
|
8
11
|
var Snapshot;
|
|
9
12
|
(function (Snapshot) {
|
|
10
|
-
Snapshot.Fragment = Fragment_1.Fragment;
|
|
11
13
|
Snapshot.funding = funding_1.funding;
|
|
12
|
-
|
|
14
|
+
let Counterbalance;
|
|
15
|
+
(function (Counterbalance) {
|
|
16
|
+
Counterbalance.type = isly_1.isly.record(isly_1.isly.string(), isly_1.isly.object({
|
|
17
|
+
total: isly_1.isly.number(),
|
|
18
|
+
account: isly_1.isly.record(isly_1.isly.string(), isly_1.isly.object({ amount: isly_1.isly.number() })),
|
|
19
|
+
}));
|
|
20
|
+
function sum(currency, accounts) {
|
|
21
|
+
return Object.values(accounts).reduce((result, account) => isoly_1.isoly.Currency.add(currency, result, account.amount), 0);
|
|
22
|
+
}
|
|
23
|
+
Counterbalance.sum = sum;
|
|
24
|
+
function validate(currency, counterbalances) {
|
|
25
|
+
for (const counterbalance of Object.values(counterbalances))
|
|
26
|
+
if (isoly_1.isoly.Currency.subtract(currency, counterbalance.total, sum(currency, counterbalance.account)))
|
|
27
|
+
return false;
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
Counterbalance.validate = validate;
|
|
31
|
+
})(Counterbalance = Snapshot.Counterbalance || (Snapshot.Counterbalance = {}));
|
|
32
|
+
function validate(snapshot) {
|
|
33
|
+
const validCounterbalance = Counterbalance.validate(snapshot.currency, snapshot.counterbalance);
|
|
34
|
+
const issuable = snapshot.fiat.total;
|
|
35
|
+
const actual = snapshot.emoney.actual ?? 0;
|
|
36
|
+
return validCounterbalance && issuable == actual;
|
|
37
|
+
}
|
|
38
|
+
Snapshot.validate = validate;
|
|
39
|
+
Snapshot.type = isly_1.isly.object({
|
|
40
|
+
warnings: Warning_1.Warning.Snapshot.type.array(),
|
|
41
|
+
emoney: Balance_1.Balance.Extended,
|
|
42
|
+
counterbalance: Counterbalance.type,
|
|
43
|
+
currency: isly_1.isly.fromIs("currency", isoly_1.isoly.Currency.is),
|
|
44
|
+
supplier: Supplier_1.Supplier.type,
|
|
45
|
+
fiat: isly_1.isly.object({
|
|
46
|
+
safe: isly_1.isly.number(),
|
|
47
|
+
unsafe: isly_1.isly.number(),
|
|
48
|
+
total: isly_1.isly.number(),
|
|
49
|
+
other: isly_1.isly.number(),
|
|
50
|
+
buffer: isly_1.isly.number(),
|
|
51
|
+
accounts: Account_1.Account.type.array(),
|
|
52
|
+
}),
|
|
53
|
+
});
|
|
13
54
|
})(Snapshot || (exports.Snapshot = Snapshot = {}));
|
|
14
55
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../Treasury/Snapshot/index.ts"],"names":[],"mappings":";;;AAAA,iCAA6B;AAC7B,+BAA2B;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../Treasury/Snapshot/index.ts"],"names":[],"mappings":";;;AAAA,iCAA6B;AAC7B,+BAA2B;AAC3B,2CAAuC;AACvC,6CAAyC;AACzC,2CAAuC;AACvC,wCAAoC;AAGpC,uCAAsD;AAiBtD,IAAiB,QAAQ,CAkDxB;AAlDD,WAAiB,QAAQ;IACV,gBAAO,GAAG,iBAAe,CAAA;IAIvC,IAAiB,cAAc,CAuB9B;IAvBD,WAAiB,cAAc;QACjB,mBAAI,GAAG,WAAI,CAAC,MAAM,CAC9B,WAAI,CAAC,MAAM,EAAE,EACb,WAAI,CAAC,MAAM,CAAyB;YACnC,KAAK,EAAE,WAAI,CAAC,MAAM,EAAE;YACpB,OAAO,EAAE,WAAI,CAAC,MAAM,CACnB,W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,CAAC,MAAM,CAAW;QACzC,QAAQ,EAAE,iBAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE;QACvC,MAAM,EAAE,iBAAO,CAAC,QAAQ;QACxB,cAAc,EAAE,cAAc,CAAC,IAAI;QACnC,QAAQ,EAAE,WAAI,CAAC,MAAM,CAAC,UAAU,EAAE,aAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;QACpD,QAAQ,EAAE,mBAAQ,CAAC,IAAI;QACvB,IAAI,EAAE,WAAI,CAAC,MAAM,CAAC;YACjB,IAAI,EAAE,WAAI,CAAC,MAAM,EAAE;YACnB,MAAM,EAAE,WAAI,CAAC,MAAM,EAAE;YACrB,KAAK,EAAE,WAAI,CAAC,MAAM,EAAE;YACpB,KAAK,EAAE,WAAI,CAAC,MAAM,EAAE;YACpB,MAAM,EAAE,WAAI,CAAC,MAAM,EAAE;YACrB,QAAQ,EAAE,iBAAO,CAAC,IAAI,CAAC,KAAK,EAAE;SAC9B,CAAC;KACF,CAAC,CAAA;AACH,CAAC,EAlDgB,QAAQ,wBAAR,QAAQ,QAkDxB"}
|
|
@@ -5,7 +5,7 @@ import { Treasury as TreasuryModel } from "../Treasury";
|
|
|
5
5
|
export declare class Treasury {
|
|
6
6
|
private readonly client;
|
|
7
7
|
constructor(client: http.Client);
|
|
8
|
-
fetch(hour?: isoly.DateTime): Promise<TreasuryModel.Snapshot | gracely.Error>;
|
|
8
|
+
fetch(hour?: isoly.DateTime): Promise<TreasuryModel.Snapshot[] | gracely.Error>;
|
|
9
9
|
listTransactions(accountId: string): Promise<TreasuryModel.Transaction[] | gracely.Error>;
|
|
10
10
|
listAccounts(): Promise<TreasuryModel.Account.Listable[] | gracely.Error>;
|
|
11
11
|
}
|
|
@@ -5,8 +5,7 @@ export class Treasury {
|
|
|
5
5
|
this.client = client;
|
|
6
6
|
}
|
|
7
7
|
async fetch(hour) {
|
|
8
|
-
|
|
9
|
-
return this.client.get(`/treasury/v2/snapshot${path}`);
|
|
8
|
+
return this.client.get(`/treasury/v2/snapshot${hour ? `/${isoly.DateTime.truncate(hour, "hours")}` : ""}`);
|
|
10
9
|
}
|
|
11
10
|
async listTransactions(accountId) {
|
|
12
11
|
return this.client.get(`/treasury/account/${accountId}/transaction`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Treasury.js","sourceRoot":"","sources":["../../../Client/Treasury.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAI7B,MAAM,OAAO,QAAQ;IACS;IAA7B,YAA6B,MAAmB;QAAnB,WAAM,GAAN,MAAM,CAAa;IAAG,CAAC;IACpD,KAAK,CAAC,KAAK,CAAC,IAAqB;QAChC,
|
|
1
|
+
{"version":3,"file":"Treasury.js","sourceRoot":"","sources":["../../../Client/Treasury.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAI7B,MAAM,OAAO,QAAQ;IACS;IAA7B,YAA6B,MAAmB;QAAnB,WAAM,GAAN,MAAM,CAAa;IAAG,CAAC;IACpD,KAAK,CAAC,KAAK,CAAC,IAAqB;QAChC,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CACrB,wBAAwB,IAAI,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAClF,CAAA;IACF,CAAC;IACD,KAAK,CAAC,gBAAgB,CAAC,SAAiB;QACvC,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAA8B,qBAAqB,SAAS,cAAc,CAAC,CAAA;IAClG,CAAC;IACD,KAAK,CAAC,YAAY;QACjB,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAmC,mBAAmB,CAAC,CAAA;IAC9E,CAAC;CACD"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { isoly } from "isoly";
|
|
2
2
|
import { isly } from "isly";
|
|
3
|
+
import { Realm } from "../Realm";
|
|
3
4
|
export type Supplier = typeof Supplier.names[number];
|
|
4
5
|
export declare namespace Supplier {
|
|
5
6
|
const names: readonly ["paxgiro", "clearbank", "bankingcircle", "paxgiroCredit"];
|
|
6
7
|
const type: isly.Type<"paxgiro" | "clearbank" | "bankingcircle" | "paxgiroCredit">;
|
|
7
8
|
const currencies: Record<Supplier, isoly.Currency[]>;
|
|
9
|
+
const realm: Record<Realm, Supplier[]>;
|
|
8
10
|
}
|
|
@@ -9,5 +9,10 @@ export var Supplier;
|
|
|
9
9
|
paxgiro: ["GBP", "SEK", "USD", "EUR"],
|
|
10
10
|
paxgiroCredit: ["GBP", "SEK", "USD", "EUR"],
|
|
11
11
|
};
|
|
12
|
+
Supplier.realm = {
|
|
13
|
+
eea: [],
|
|
14
|
+
test: ["paxgiro", "paxgiroCredit"],
|
|
15
|
+
uk: ["bankingcircle", "clearbank"],
|
|
16
|
+
};
|
|
12
17
|
})(Supplier || (Supplier = {}));
|
|
13
18
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../Supplier/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../Supplier/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAI3B,MAAM,KAAW,QAAQ,CAcxB;AAdD,WAAiB,QAAQ;IACX,cAAK,GAAG,CAAC,SAAS,EAAE,WAAW,EAAE,eAAe,EAAE,eAAe,CAAU,CAAA;IAC3E,aAAI,GAAG,IAAI,CAAC,MAAM,CAAW,SAAA,KAAK,CAAC,CAAA;IACnC,mBAAU,GAAuC;QAC7D,SAAS,EAAE,CAAC,KAAK,CAAC;QAClB,aAAa,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC;QACvE,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC;QACrC,aAAa,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC;KAC3C,CAAA;IACY,cAAK,GAA8B;QAC/C,GAAG,EAAE,EAAE;QACP,IAAI,EAAE,CAAC,SAAS,EAAE,eAAe,CAAC;QAClC,EAAE,EAAE,CAAC,eAAe,EAAE,WAAW,CAAC;KAClC,CAAA;AACF,CAAC,EAdgB,QAAQ,KAAR,QAAQ,QAcxB"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { isoly } from "isoly";
|
|
2
2
|
import { Balances } from "../../Balances";
|
|
3
3
|
import { Counterbalances } from "../../Counterbalances";
|
|
4
|
+
import { Supplier } from "../../Supplier";
|
|
4
5
|
export interface Emoney {
|
|
5
6
|
organization: string;
|
|
6
7
|
account: string;
|
|
8
|
+
supplier?: Supplier;
|
|
7
9
|
timestamp: isoly.DateTime;
|
|
8
10
|
balances: Balances;
|
|
9
11
|
counterbalances: Counterbalances;
|
|
@@ -1,194 +1,46 @@
|
|
|
1
1
|
import { isoly } from "isoly";
|
|
2
2
|
import { isly } from "isly";
|
|
3
|
+
import { Balance } from "../../Balance";
|
|
4
|
+
import { Supplier } from "../../Supplier";
|
|
5
|
+
import { Warning } from "../../Warning";
|
|
6
|
+
import { Account } from "../Account";
|
|
3
7
|
import { Emoney as SnapshotEmoney } from "./Emoney";
|
|
4
8
|
import { Fiat as SnapshotFiat } from "./Fiat";
|
|
5
|
-
import { Fragment as SnapshotFragment } from "./Fragment";
|
|
6
9
|
import { funding as snapshotFunding } from "./funding";
|
|
7
|
-
export
|
|
10
|
+
export interface Snapshot {
|
|
11
|
+
warnings: Warning.Snapshot[];
|
|
12
|
+
emoney: Balance.Extended & {
|
|
13
|
+
total?: number;
|
|
14
|
+
};
|
|
15
|
+
currency: isoly.Currency;
|
|
16
|
+
supplier: Supplier;
|
|
17
|
+
counterbalance: Snapshot.Counterbalance;
|
|
18
|
+
fiat: {
|
|
19
|
+
safe: number;
|
|
20
|
+
unsafe: number;
|
|
21
|
+
total: number;
|
|
22
|
+
other: number;
|
|
23
|
+
buffer: number;
|
|
24
|
+
accounts: Account[];
|
|
25
|
+
};
|
|
26
|
+
}
|
|
8
27
|
export declare namespace Snapshot {
|
|
9
|
-
export import Fragment = SnapshotFragment;
|
|
10
28
|
export import funding = snapshotFunding;
|
|
11
29
|
type Emoney = SnapshotEmoney;
|
|
12
30
|
type Fiat = SnapshotFiat;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
ANG: any;
|
|
19
|
-
AOA: any;
|
|
20
|
-
ARS: any;
|
|
21
|
-
AUD: any;
|
|
22
|
-
AWG: any;
|
|
23
|
-
AZN: any;
|
|
24
|
-
BAM: any;
|
|
25
|
-
BBD: any;
|
|
26
|
-
BDT: any;
|
|
27
|
-
BGN: any;
|
|
28
|
-
BHD: any;
|
|
29
|
-
BIF: any;
|
|
30
|
-
BMD: any;
|
|
31
|
-
BND: any;
|
|
32
|
-
BOB: any;
|
|
33
|
-
BOV: any;
|
|
34
|
-
BRL: any;
|
|
35
|
-
BSD: any;
|
|
36
|
-
BTN: any;
|
|
37
|
-
BWP: any;
|
|
38
|
-
BYN: any;
|
|
39
|
-
BZD: any;
|
|
40
|
-
CAD: any;
|
|
41
|
-
CDF: any;
|
|
42
|
-
CHE: any;
|
|
43
|
-
CHF: any;
|
|
44
|
-
CHW: any;
|
|
45
|
-
CLF: any;
|
|
46
|
-
CLP: any;
|
|
47
|
-
CNY: any;
|
|
48
|
-
COP: any;
|
|
49
|
-
COU: any;
|
|
50
|
-
CRC: any;
|
|
51
|
-
CUC: any;
|
|
52
|
-
CUP: any;
|
|
53
|
-
CVE: any;
|
|
54
|
-
CZK: any;
|
|
55
|
-
DJF: any;
|
|
56
|
-
DKK: any;
|
|
57
|
-
DOP: any;
|
|
58
|
-
DZD: any;
|
|
59
|
-
EGP: any;
|
|
60
|
-
ERN: any;
|
|
61
|
-
ETB: any;
|
|
62
|
-
EUR: any;
|
|
63
|
-
FJD: any;
|
|
64
|
-
FKP: any;
|
|
65
|
-
GBP: any;
|
|
66
|
-
GEL: any;
|
|
67
|
-
GHS: any;
|
|
68
|
-
GIP: any;
|
|
69
|
-
GMD: any;
|
|
70
|
-
GNF: any;
|
|
71
|
-
GTQ: any;
|
|
72
|
-
GYD: any;
|
|
73
|
-
HKD: any;
|
|
74
|
-
HNL: any;
|
|
75
|
-
HRK: any;
|
|
76
|
-
HTG: any;
|
|
77
|
-
HUF: any;
|
|
78
|
-
IDR: any;
|
|
79
|
-
ILS: any;
|
|
80
|
-
INR: any;
|
|
81
|
-
IQD: any;
|
|
82
|
-
IRR: any;
|
|
83
|
-
ISK: any;
|
|
84
|
-
JMD: any;
|
|
85
|
-
JOD: any;
|
|
86
|
-
JPY: any;
|
|
87
|
-
KES: any;
|
|
88
|
-
KGS: any;
|
|
89
|
-
KHR: any;
|
|
90
|
-
KMF: any;
|
|
91
|
-
KPW: any;
|
|
92
|
-
KRW: any;
|
|
93
|
-
KWD: any;
|
|
94
|
-
KYD: any;
|
|
95
|
-
KZT: any;
|
|
96
|
-
LAK: any;
|
|
97
|
-
LBP: any;
|
|
98
|
-
LKR: any;
|
|
99
|
-
LRD: any;
|
|
100
|
-
LSL: any;
|
|
101
|
-
LYD: any;
|
|
102
|
-
MAD: any;
|
|
103
|
-
MDL: any;
|
|
104
|
-
MGA: any;
|
|
105
|
-
MKD: any;
|
|
106
|
-
MMK: any;
|
|
107
|
-
MNT: any;
|
|
108
|
-
MOP: any;
|
|
109
|
-
MRU: any;
|
|
110
|
-
MUR: any;
|
|
111
|
-
MVR: any;
|
|
112
|
-
MWK: any;
|
|
113
|
-
MXN: any;
|
|
114
|
-
MXV: any;
|
|
115
|
-
MYR: any;
|
|
116
|
-
MZN: any;
|
|
117
|
-
NAD: any;
|
|
118
|
-
NGN: any;
|
|
119
|
-
NIO: any;
|
|
120
|
-
NOK: any;
|
|
121
|
-
NPR: any;
|
|
122
|
-
NZD: any;
|
|
123
|
-
OMR: any;
|
|
124
|
-
PAB: any;
|
|
125
|
-
PEN: any;
|
|
126
|
-
PGK: any;
|
|
127
|
-
PHP: any;
|
|
128
|
-
PKR: any;
|
|
129
|
-
PLN: any;
|
|
130
|
-
PYG: any;
|
|
131
|
-
QAR: any;
|
|
132
|
-
RON: any;
|
|
133
|
-
RSD: any;
|
|
134
|
-
RUB: any;
|
|
135
|
-
RWF: any;
|
|
136
|
-
SAR: any;
|
|
137
|
-
SBD: any;
|
|
138
|
-
SCR: any;
|
|
139
|
-
SDG: any;
|
|
140
|
-
SEK: any;
|
|
141
|
-
SGD: any;
|
|
142
|
-
SHP: any;
|
|
143
|
-
SLL: any;
|
|
144
|
-
SOS: any;
|
|
145
|
-
SRD: any;
|
|
146
|
-
SSP: any;
|
|
147
|
-
STN: any;
|
|
148
|
-
SVC: any;
|
|
149
|
-
SYP: any;
|
|
150
|
-
SZL: any;
|
|
151
|
-
THB: any;
|
|
152
|
-
TJS: any;
|
|
153
|
-
TMT: any;
|
|
154
|
-
TND: any;
|
|
155
|
-
TOP: any;
|
|
156
|
-
TRY: any;
|
|
157
|
-
TTD: any;
|
|
158
|
-
TWD: any;
|
|
159
|
-
TZS: any;
|
|
160
|
-
UAH: any;
|
|
161
|
-
UGX: any;
|
|
162
|
-
USD: any;
|
|
163
|
-
USN: any;
|
|
164
|
-
UYI: any;
|
|
165
|
-
UYU: any;
|
|
166
|
-
UYW: any;
|
|
167
|
-
UZS: any;
|
|
168
|
-
VES: any;
|
|
169
|
-
VND: any;
|
|
170
|
-
VUV: any;
|
|
171
|
-
WST: any;
|
|
172
|
-
XAF: any;
|
|
173
|
-
XAG: any;
|
|
174
|
-
XAU: any;
|
|
175
|
-
XBA: any;
|
|
176
|
-
XBB: any;
|
|
177
|
-
XBC: any;
|
|
178
|
-
XBD: any;
|
|
179
|
-
XCD: any;
|
|
180
|
-
XDR: any;
|
|
181
|
-
XOF: any;
|
|
182
|
-
XPD: any;
|
|
183
|
-
XPF: any;
|
|
184
|
-
XPT: any;
|
|
185
|
-
XSU: any;
|
|
186
|
-
XTS: any;
|
|
187
|
-
XUA: any;
|
|
188
|
-
XXX: any;
|
|
189
|
-
YER: any;
|
|
190
|
-
ZAR: any;
|
|
191
|
-
ZMW: any;
|
|
192
|
-
ZWL: any;
|
|
31
|
+
type Counterbalance = Record<string, {
|
|
32
|
+
total: number;
|
|
33
|
+
account: Record<string, {
|
|
34
|
+
amount: number;
|
|
35
|
+
}>;
|
|
193
36
|
}>;
|
|
37
|
+
namespace Counterbalance {
|
|
38
|
+
const type: isly.Type<Counterbalance>;
|
|
39
|
+
function sum(currency: isoly.Currency, accounts: Record<string, {
|
|
40
|
+
amount: number;
|
|
41
|
+
}>): number;
|
|
42
|
+
function validate(currency: isoly.Currency, counterbalances: Counterbalance): boolean;
|
|
43
|
+
}
|
|
44
|
+
function validate(snapshot: Snapshot): boolean;
|
|
45
|
+
const type: import("isly/dist/cjs/object").IslyObject<Snapshot, object>;
|
|
194
46
|
}
|
|
@@ -1,11 +1,52 @@
|
|
|
1
1
|
import { isoly } from "isoly";
|
|
2
2
|
import { isly } from "isly";
|
|
3
|
-
import {
|
|
3
|
+
import { Balance } from "../../Balance";
|
|
4
|
+
import { Supplier } from "../../Supplier";
|
|
5
|
+
import { Warning } from "../../Warning";
|
|
6
|
+
import { Account } from "../Account";
|
|
4
7
|
import { funding as snapshotFunding } from "./funding";
|
|
5
8
|
export var Snapshot;
|
|
6
9
|
(function (Snapshot) {
|
|
7
|
-
Snapshot.Fragment = SnapshotFragment;
|
|
8
10
|
Snapshot.funding = snapshotFunding;
|
|
9
|
-
|
|
11
|
+
let Counterbalance;
|
|
12
|
+
(function (Counterbalance) {
|
|
13
|
+
Counterbalance.type = isly.record(isly.string(), isly.object({
|
|
14
|
+
total: isly.number(),
|
|
15
|
+
account: isly.record(isly.string(), isly.object({ amount: isly.number() })),
|
|
16
|
+
}));
|
|
17
|
+
function sum(currency, accounts) {
|
|
18
|
+
return Object.values(accounts).reduce((result, account) => isoly.Currency.add(currency, result, account.amount), 0);
|
|
19
|
+
}
|
|
20
|
+
Counterbalance.sum = sum;
|
|
21
|
+
function validate(currency, counterbalances) {
|
|
22
|
+
for (const counterbalance of Object.values(counterbalances))
|
|
23
|
+
if (isoly.Currency.subtract(currency, counterbalance.total, sum(currency, counterbalance.account)))
|
|
24
|
+
return false;
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
Counterbalance.validate = validate;
|
|
28
|
+
})(Counterbalance = Snapshot.Counterbalance || (Snapshot.Counterbalance = {}));
|
|
29
|
+
function validate(snapshot) {
|
|
30
|
+
const validCounterbalance = Counterbalance.validate(snapshot.currency, snapshot.counterbalance);
|
|
31
|
+
const issuable = snapshot.fiat.total;
|
|
32
|
+
const actual = snapshot.emoney.actual ?? 0;
|
|
33
|
+
return validCounterbalance && issuable == actual;
|
|
34
|
+
}
|
|
35
|
+
Snapshot.validate = validate;
|
|
36
|
+
Snapshot.type = isly.object({
|
|
37
|
+
warnings: Warning.Snapshot.type.array(),
|
|
38
|
+
emoney: Balance.Extended,
|
|
39
|
+
counterbalance: Counterbalance.type,
|
|
40
|
+
currency: isly.fromIs("currency", isoly.Currency.is),
|
|
41
|
+
supplier: Supplier.type,
|
|
42
|
+
fiat: isly.object({
|
|
43
|
+
safe: isly.number(),
|
|
44
|
+
unsafe: isly.number(),
|
|
45
|
+
total: isly.number(),
|
|
46
|
+
other: isly.number(),
|
|
47
|
+
buffer: isly.number(),
|
|
48
|
+
accounts: Account.type.array(),
|
|
49
|
+
}),
|
|
50
|
+
});
|
|
10
51
|
})(Snapshot || (Snapshot = {}));
|
|
11
52
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../Treasury/Snapshot/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../Treasury/Snapshot/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAGpC,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,WAAW,CAAA;AAiBtD,MAAM,KAAW,QAAQ,CAkDxB;AAlDD,WAAiB,QAAQ;IACV,gBAAO,GAAG,eAAe,CAAA;IAIvC,IAAiB,cAAc,CAuB9B;IAvBD,WAAiB,cAAc;QACjB,mBAAI,GAAG,IAAI,CAAC,MAAM,CAC9B,IAAI,CAAC,MAAM,EAAE,EACb,IAAI,CAAC,MAAM,CAAyB;YACnC,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE;YACpB,OAAO,EAAE,IAAI,CAAC,MAAM,CACnB,IAAI,CAAC,MAAM,EAAE,EACb,IAAI,CAAC,MAAM,CAA4C,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC,CACjF;SACD,CAAC,CACF,CAAA;QACD,SAAgB,GAAG,CAAC,QAAwB,EAAE,QAA4C;YACzF,OAAO,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,MAAM,CACpC,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE,CAAC,KAA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QACvB,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC;YACjB,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE;YACnB,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE;YACrB,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE;YACpB,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE;YACpB,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE;YACrB,QAAQ,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE;SAC9B,CAAC;KACF,CAAC,CAAA;AACH,CAAC,EAlDgB,QAAQ,KAAR,QAAQ,QAkDxB"}
|
package/package.json
CHANGED
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import { isoly } from "isoly"
|
|
2
|
-
import { isly } from "isly"
|
|
3
|
-
import { Balance } from "../../Balance"
|
|
4
|
-
import { Warning } from "../../Warning"
|
|
5
|
-
import { Account } from "../Account"
|
|
6
|
-
|
|
7
|
-
export interface Fragment {
|
|
8
|
-
warnings: Warning.Snapshot[]
|
|
9
|
-
emoney: Balance.Extended & { total?: number }
|
|
10
|
-
counterbalance: Fragment.Counterbalance
|
|
11
|
-
fiat: {
|
|
12
|
-
safe: number
|
|
13
|
-
unsafe: number
|
|
14
|
-
total: number // emoney issuable total amount
|
|
15
|
-
other: number
|
|
16
|
-
buffer: number
|
|
17
|
-
accounts: Account[]
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
export namespace Fragment {
|
|
21
|
-
export type Counterbalance = Record<string, { total: number; account: Record<string, { amount: number }> }>
|
|
22
|
-
export namespace Counterbalance {
|
|
23
|
-
export const type = isly.record<Counterbalance>(
|
|
24
|
-
isly.string(),
|
|
25
|
-
isly.object<Counterbalance[string]>({
|
|
26
|
-
total: isly.number(),
|
|
27
|
-
account: isly.record<Counterbalance[string]["account"]>(
|
|
28
|
-
isly.string(),
|
|
29
|
-
isly.object<Counterbalance[string]["account"][string]>({ amount: isly.number() })
|
|
30
|
-
),
|
|
31
|
-
})
|
|
32
|
-
)
|
|
33
|
-
export function sum(currency: isoly.Currency, accounts: Record<string, { amount: number }>): number {
|
|
34
|
-
return Object.values(accounts).reduce(
|
|
35
|
-
(result, account) => isoly.Currency.add(currency, result, account.amount),
|
|
36
|
-
0
|
|
37
|
-
)
|
|
38
|
-
}
|
|
39
|
-
export function validate(currency: isoly.Currency, counterbalances: Counterbalance): boolean {
|
|
40
|
-
for (const counterbalance of Object.values(counterbalances))
|
|
41
|
-
if (isoly.Currency.subtract(currency, counterbalance.total, sum(currency, counterbalance.account)))
|
|
42
|
-
return false
|
|
43
|
-
return true
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
export function validate(currency: isoly.Currency, fragment: Fragment): boolean {
|
|
47
|
-
const validCounterbalance = Counterbalance.validate(currency, fragment.counterbalance)
|
|
48
|
-
const issuable = fragment.fiat.total
|
|
49
|
-
const actual = fragment.emoney.actual ?? 0
|
|
50
|
-
return validCounterbalance && issuable == actual
|
|
51
|
-
}
|
|
52
|
-
export const type = isly.object<Fragment>({
|
|
53
|
-
warnings: Warning.Snapshot.type.array(),
|
|
54
|
-
emoney: Balance.Extended,
|
|
55
|
-
counterbalance: Counterbalance.type,
|
|
56
|
-
fiat: isly.object({
|
|
57
|
-
safe: isly.number(),
|
|
58
|
-
unsafe: isly.number(),
|
|
59
|
-
total: isly.number(),
|
|
60
|
-
other: isly.number(),
|
|
61
|
-
buffer: isly.number(),
|
|
62
|
-
accounts: Account.type.array(),
|
|
63
|
-
}),
|
|
64
|
-
})
|
|
65
|
-
export type Legacy = Omit<Fragment, "counterbalance"> & { minted: Legacy.Coinage; burned: Legacy.Coinage }
|
|
66
|
-
export namespace Legacy {
|
|
67
|
-
export type LedgerAccount = string
|
|
68
|
-
export type Change = { account: Record<LedgerAccount, number>; amount: number }
|
|
69
|
-
export const change = isly.object<Change>({
|
|
70
|
-
account: isly.record(isly.string(), isly.number()),
|
|
71
|
-
amount: isly.number(),
|
|
72
|
-
})
|
|
73
|
-
export type Coinage = Record<string, Change>
|
|
74
|
-
export const type = isly.record<Coinage>(isly.string(), change)
|
|
75
|
-
function mergeAccounts(
|
|
76
|
-
currency: isoly.Currency,
|
|
77
|
-
burned: Record<string, { amount: number }>,
|
|
78
|
-
minted?: Record<string, { amount: number }>
|
|
79
|
-
): Record<string, { amount: number }> {
|
|
80
|
-
const result: Record<string, { amount: number }> = { ...(minted ?? {}) }
|
|
81
|
-
for (const [id, account] of Object.entries(burned))
|
|
82
|
-
result[id] = { amount: isoly.Currency.subtract(currency, result[id]?.amount ?? 0, account.amount) }
|
|
83
|
-
return result
|
|
84
|
-
}
|
|
85
|
-
function accountToNew(account: Record<LedgerAccount, number>): Record<string, { amount: number }> {
|
|
86
|
-
return Object.fromEntries(
|
|
87
|
-
Object.entries(account).map<[string, { amount: number }]>(([id, amount]) => [id, { amount }])
|
|
88
|
-
)
|
|
89
|
-
}
|
|
90
|
-
export function toCounterbalance(currency: isoly.Currency, minted: Coinage, burned: Coinage): Counterbalance {
|
|
91
|
-
const result: Counterbalance = {}
|
|
92
|
-
for (const [code, change] of Object.entries(minted))
|
|
93
|
-
result[code] = { total: change.amount, account: accountToNew(change.account) }
|
|
94
|
-
for (const [code, change] of Object.entries(burned))
|
|
95
|
-
result[code] = {
|
|
96
|
-
total: isoly.Currency.subtract(currency, result[code]?.total ?? 0, change.amount),
|
|
97
|
-
account: mergeAccounts(currency, accountToNew(change.account), result[code]?.account),
|
|
98
|
-
}
|
|
99
|
-
return result
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
export function fromLegacy(currency: isoly.Currency, fragment: Fragment | Legacy): Fragment {
|
|
103
|
-
let result: Fragment
|
|
104
|
-
if ("counterbalance" in fragment)
|
|
105
|
-
result = fragment
|
|
106
|
-
else {
|
|
107
|
-
const counterbalance = Legacy.toCounterbalance(currency, fragment.minted, fragment.burned)
|
|
108
|
-
const result: Fragment = { ...fragment, counterbalance }
|
|
109
|
-
"burned" in result && delete result.burned
|
|
110
|
-
"minted" in result && delete result.minted
|
|
111
|
-
return result
|
|
112
|
-
}
|
|
113
|
-
return result
|
|
114
|
-
}
|
|
115
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { isoly } from "isoly";
|
|
2
|
-
import { isly } from "isly";
|
|
3
|
-
import { Balance } from "../../Balance";
|
|
4
|
-
import { Warning } from "../../Warning";
|
|
5
|
-
import { Account } from "../Account";
|
|
6
|
-
export interface Fragment {
|
|
7
|
-
warnings: Warning.Snapshot[];
|
|
8
|
-
emoney: Balance.Extended & {
|
|
9
|
-
total?: number;
|
|
10
|
-
};
|
|
11
|
-
counterbalance: Fragment.Counterbalance;
|
|
12
|
-
fiat: {
|
|
13
|
-
safe: number;
|
|
14
|
-
unsafe: number;
|
|
15
|
-
total: number;
|
|
16
|
-
other: number;
|
|
17
|
-
buffer: number;
|
|
18
|
-
accounts: Account[];
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
export declare namespace Fragment {
|
|
22
|
-
type Counterbalance = Record<string, {
|
|
23
|
-
total: number;
|
|
24
|
-
account: Record<string, {
|
|
25
|
-
amount: number;
|
|
26
|
-
}>;
|
|
27
|
-
}>;
|
|
28
|
-
namespace Counterbalance {
|
|
29
|
-
const type: isly.Type<Counterbalance>;
|
|
30
|
-
function sum(currency: isoly.Currency, accounts: Record<string, {
|
|
31
|
-
amount: number;
|
|
32
|
-
}>): number;
|
|
33
|
-
function validate(currency: isoly.Currency, counterbalances: Counterbalance): boolean;
|
|
34
|
-
}
|
|
35
|
-
function validate(currency: isoly.Currency, fragment: Fragment): boolean;
|
|
36
|
-
const type: import("isly/dist/cjs/object").IslyObject<Fragment, object>;
|
|
37
|
-
type Legacy = Omit<Fragment, "counterbalance"> & {
|
|
38
|
-
minted: Legacy.Coinage;
|
|
39
|
-
burned: Legacy.Coinage;
|
|
40
|
-
};
|
|
41
|
-
namespace Legacy {
|
|
42
|
-
type LedgerAccount = string;
|
|
43
|
-
type Change = {
|
|
44
|
-
account: Record<LedgerAccount, number>;
|
|
45
|
-
amount: number;
|
|
46
|
-
};
|
|
47
|
-
const change: import("isly/dist/cjs/object").IslyObject<Change, object>;
|
|
48
|
-
type Coinage = Record<string, Change>;
|
|
49
|
-
const type: isly.Type<Coinage>;
|
|
50
|
-
function toCounterbalance(currency: isoly.Currency, minted: Coinage, burned: Coinage): Counterbalance;
|
|
51
|
-
}
|
|
52
|
-
function fromLegacy(currency: isoly.Currency, fragment: Fragment | Legacy): Fragment;
|
|
53
|
-
}
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Fragment = void 0;
|
|
4
|
-
const isoly_1 = require("isoly");
|
|
5
|
-
const isly_1 = require("isly");
|
|
6
|
-
const Balance_1 = require("../../Balance");
|
|
7
|
-
const Warning_1 = require("../../Warning");
|
|
8
|
-
const Account_1 = require("../Account");
|
|
9
|
-
var Fragment;
|
|
10
|
-
(function (Fragment) {
|
|
11
|
-
let Counterbalance;
|
|
12
|
-
(function (Counterbalance) {
|
|
13
|
-
Counterbalance.type = isly_1.isly.record(isly_1.isly.string(), isly_1.isly.object({
|
|
14
|
-
total: isly_1.isly.number(),
|
|
15
|
-
account: isly_1.isly.record(isly_1.isly.string(), isly_1.isly.object({ amount: isly_1.isly.number() })),
|
|
16
|
-
}));
|
|
17
|
-
function sum(currency, accounts) {
|
|
18
|
-
return Object.values(accounts).reduce((result, account) => isoly_1.isoly.Currency.add(currency, result, account.amount), 0);
|
|
19
|
-
}
|
|
20
|
-
Counterbalance.sum = sum;
|
|
21
|
-
function validate(currency, counterbalances) {
|
|
22
|
-
for (const counterbalance of Object.values(counterbalances))
|
|
23
|
-
if (isoly_1.isoly.Currency.subtract(currency, counterbalance.total, sum(currency, counterbalance.account)))
|
|
24
|
-
return false;
|
|
25
|
-
return true;
|
|
26
|
-
}
|
|
27
|
-
Counterbalance.validate = validate;
|
|
28
|
-
})(Counterbalance = Fragment.Counterbalance || (Fragment.Counterbalance = {}));
|
|
29
|
-
function validate(currency, fragment) {
|
|
30
|
-
const validCounterbalance = Counterbalance.validate(currency, fragment.counterbalance);
|
|
31
|
-
const issuable = fragment.fiat.total;
|
|
32
|
-
const actual = fragment.emoney.actual ?? 0;
|
|
33
|
-
return validCounterbalance && issuable == actual;
|
|
34
|
-
}
|
|
35
|
-
Fragment.validate = validate;
|
|
36
|
-
Fragment.type = isly_1.isly.object({
|
|
37
|
-
warnings: Warning_1.Warning.Snapshot.type.array(),
|
|
38
|
-
emoney: Balance_1.Balance.Extended,
|
|
39
|
-
counterbalance: Counterbalance.type,
|
|
40
|
-
fiat: isly_1.isly.object({
|
|
41
|
-
safe: isly_1.isly.number(),
|
|
42
|
-
unsafe: isly_1.isly.number(),
|
|
43
|
-
total: isly_1.isly.number(),
|
|
44
|
-
other: isly_1.isly.number(),
|
|
45
|
-
buffer: isly_1.isly.number(),
|
|
46
|
-
accounts: Account_1.Account.type.array(),
|
|
47
|
-
}),
|
|
48
|
-
});
|
|
49
|
-
let Legacy;
|
|
50
|
-
(function (Legacy) {
|
|
51
|
-
Legacy.change = isly_1.isly.object({
|
|
52
|
-
account: isly_1.isly.record(isly_1.isly.string(), isly_1.isly.number()),
|
|
53
|
-
amount: isly_1.isly.number(),
|
|
54
|
-
});
|
|
55
|
-
Legacy.type = isly_1.isly.record(isly_1.isly.string(), Legacy.change);
|
|
56
|
-
function mergeAccounts(currency, burned, minted) {
|
|
57
|
-
const result = { ...(minted ?? {}) };
|
|
58
|
-
for (const [id, account] of Object.entries(burned))
|
|
59
|
-
result[id] = { amount: isoly_1.isoly.Currency.subtract(currency, result[id]?.amount ?? 0, account.amount) };
|
|
60
|
-
return result;
|
|
61
|
-
}
|
|
62
|
-
function accountToNew(account) {
|
|
63
|
-
return Object.fromEntries(Object.entries(account).map(([id, amount]) => [id, { amount }]));
|
|
64
|
-
}
|
|
65
|
-
function toCounterbalance(currency, minted, burned) {
|
|
66
|
-
const result = {};
|
|
67
|
-
for (const [code, change] of Object.entries(minted))
|
|
68
|
-
result[code] = { total: change.amount, account: accountToNew(change.account) };
|
|
69
|
-
for (const [code, change] of Object.entries(burned))
|
|
70
|
-
result[code] = {
|
|
71
|
-
total: isoly_1.isoly.Currency.subtract(currency, result[code]?.total ?? 0, change.amount),
|
|
72
|
-
account: mergeAccounts(currency, accountToNew(change.account), result[code]?.account),
|
|
73
|
-
};
|
|
74
|
-
return result;
|
|
75
|
-
}
|
|
76
|
-
Legacy.toCounterbalance = toCounterbalance;
|
|
77
|
-
})(Legacy = Fragment.Legacy || (Fragment.Legacy = {}));
|
|
78
|
-
function fromLegacy(currency, fragment) {
|
|
79
|
-
let result;
|
|
80
|
-
if ("counterbalance" in fragment)
|
|
81
|
-
result = fragment;
|
|
82
|
-
else {
|
|
83
|
-
const counterbalance = Legacy.toCounterbalance(currency, fragment.minted, fragment.burned);
|
|
84
|
-
const result = { ...fragment, counterbalance };
|
|
85
|
-
"burned" in result && delete result.burned;
|
|
86
|
-
"minted" in result && delete result.minted;
|
|
87
|
-
return result;
|
|
88
|
-
}
|
|
89
|
-
return result;
|
|
90
|
-
}
|
|
91
|
-
Fragment.fromLegacy = fromLegacy;
|
|
92
|
-
})(Fragment || (exports.Fragment = Fragment = {}));
|
|
93
|
-
//# sourceMappingURL=Fragment.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Fragment.js","sourceRoot":"","sources":["../../../../Treasury/Snapshot/Fragment.ts"],"names":[],"mappings":";;;AAAA,iCAA6B;AAC7B,+BAA2B;AAC3B,2CAAuC;AACvC,2CAAuC;AACvC,wCAAoC;AAepC,IAAiB,QAAQ,CA+FxB;AA/FD,WAAiB,QAAQ;IAExB,IAAiB,cAAc,CAuB9B;IAvBD,WAAiB,cAAc;QACjB,mBAAI,GAAG,WAAI,CAAC,MAAM,CAC9B,WAAI,CAAC,MAAM,EAAE,EACb,WAAI,CAAC,MAAM,CAAyB;YACnC,KAAK,EAA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GAAN,eAAM,KAAN,eAAM,QAmCtB;IACD,SAAgB,UAAU,CAAC,QAAwB,EAAE,QAA2B;QAC/E,IAAI,MAAgB,CAAA;QACpB,IAAI,gBAAgB,IAAI,QAAQ;YAC/B,MAAM,GAAG,QAAQ,CAAA;aACb,CAAC;YACL,MAAM,cAAc,GAAG,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAA;YAC1F,MAAM,MAAM,GAAa,EAAE,GAAG,QAAQ,EAAE,cAAc,EAAE,CAAA;YACxD,QAAQ,IAAI,MAAM,IAAI,OAAO,MAAM,CAAC,MAAM,CAAA;YAC1C,QAAQ,IAAI,MAAM,IAAI,OAAO,MAAM,CAAC,MAAM,CAAA;YAC1C,OAAO,MAAM,CAAA;QACd,CAAC;QACD,OAAO,MAAM,CAAA;IACd,CAAC;IAZe,mBAAU,aAYzB,CAAA;AACF,CAAC,EA/FgB,QAAQ,wBAAR,QAAQ,QA+FxB"}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { isoly } from "isoly";
|
|
2
|
-
import { isly } from "isly";
|
|
3
|
-
import { Balance } from "../../Balance";
|
|
4
|
-
import { Warning } from "../../Warning";
|
|
5
|
-
import { Account } from "../Account";
|
|
6
|
-
export interface Fragment {
|
|
7
|
-
warnings: Warning.Snapshot[];
|
|
8
|
-
emoney: Balance.Extended & {
|
|
9
|
-
total?: number;
|
|
10
|
-
};
|
|
11
|
-
counterbalance: Fragment.Counterbalance;
|
|
12
|
-
fiat: {
|
|
13
|
-
safe: number;
|
|
14
|
-
unsafe: number;
|
|
15
|
-
total: number;
|
|
16
|
-
other: number;
|
|
17
|
-
buffer: number;
|
|
18
|
-
accounts: Account[];
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
export declare namespace Fragment {
|
|
22
|
-
type Counterbalance = Record<string, {
|
|
23
|
-
total: number;
|
|
24
|
-
account: Record<string, {
|
|
25
|
-
amount: number;
|
|
26
|
-
}>;
|
|
27
|
-
}>;
|
|
28
|
-
namespace Counterbalance {
|
|
29
|
-
const type: isly.Type<Counterbalance>;
|
|
30
|
-
function sum(currency: isoly.Currency, accounts: Record<string, {
|
|
31
|
-
amount: number;
|
|
32
|
-
}>): number;
|
|
33
|
-
function validate(currency: isoly.Currency, counterbalances: Counterbalance): boolean;
|
|
34
|
-
}
|
|
35
|
-
function validate(currency: isoly.Currency, fragment: Fragment): boolean;
|
|
36
|
-
const type: import("isly/dist/cjs/object").IslyObject<Fragment, object>;
|
|
37
|
-
type Legacy = Omit<Fragment, "counterbalance"> & {
|
|
38
|
-
minted: Legacy.Coinage;
|
|
39
|
-
burned: Legacy.Coinage;
|
|
40
|
-
};
|
|
41
|
-
namespace Legacy {
|
|
42
|
-
type LedgerAccount = string;
|
|
43
|
-
type Change = {
|
|
44
|
-
account: Record<LedgerAccount, number>;
|
|
45
|
-
amount: number;
|
|
46
|
-
};
|
|
47
|
-
const change: import("isly/dist/cjs/object").IslyObject<Change, object>;
|
|
48
|
-
type Coinage = Record<string, Change>;
|
|
49
|
-
const type: isly.Type<Coinage>;
|
|
50
|
-
function toCounterbalance(currency: isoly.Currency, minted: Coinage, burned: Coinage): Counterbalance;
|
|
51
|
-
}
|
|
52
|
-
function fromLegacy(currency: isoly.Currency, fragment: Fragment | Legacy): Fragment;
|
|
53
|
-
}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { isoly } from "isoly";
|
|
2
|
-
import { isly } from "isly";
|
|
3
|
-
import { Balance } from "../../Balance";
|
|
4
|
-
import { Warning } from "../../Warning";
|
|
5
|
-
import { Account } from "../Account";
|
|
6
|
-
export var Fragment;
|
|
7
|
-
(function (Fragment) {
|
|
8
|
-
let Counterbalance;
|
|
9
|
-
(function (Counterbalance) {
|
|
10
|
-
Counterbalance.type = isly.record(isly.string(), isly.object({
|
|
11
|
-
total: isly.number(),
|
|
12
|
-
account: isly.record(isly.string(), isly.object({ amount: isly.number() })),
|
|
13
|
-
}));
|
|
14
|
-
function sum(currency, accounts) {
|
|
15
|
-
return Object.values(accounts).reduce((result, account) => isoly.Currency.add(currency, result, account.amount), 0);
|
|
16
|
-
}
|
|
17
|
-
Counterbalance.sum = sum;
|
|
18
|
-
function validate(currency, counterbalances) {
|
|
19
|
-
for (const counterbalance of Object.values(counterbalances))
|
|
20
|
-
if (isoly.Currency.subtract(currency, counterbalance.total, sum(currency, counterbalance.account)))
|
|
21
|
-
return false;
|
|
22
|
-
return true;
|
|
23
|
-
}
|
|
24
|
-
Counterbalance.validate = validate;
|
|
25
|
-
})(Counterbalance = Fragment.Counterbalance || (Fragment.Counterbalance = {}));
|
|
26
|
-
function validate(currency, fragment) {
|
|
27
|
-
const validCounterbalance = Counterbalance.validate(currency, fragment.counterbalance);
|
|
28
|
-
const issuable = fragment.fiat.total;
|
|
29
|
-
const actual = fragment.emoney.actual ?? 0;
|
|
30
|
-
return validCounterbalance && issuable == actual;
|
|
31
|
-
}
|
|
32
|
-
Fragment.validate = validate;
|
|
33
|
-
Fragment.type = isly.object({
|
|
34
|
-
warnings: Warning.Snapshot.type.array(),
|
|
35
|
-
emoney: Balance.Extended,
|
|
36
|
-
counterbalance: Counterbalance.type,
|
|
37
|
-
fiat: isly.object({
|
|
38
|
-
safe: isly.number(),
|
|
39
|
-
unsafe: isly.number(),
|
|
40
|
-
total: isly.number(),
|
|
41
|
-
other: isly.number(),
|
|
42
|
-
buffer: isly.number(),
|
|
43
|
-
accounts: Account.type.array(),
|
|
44
|
-
}),
|
|
45
|
-
});
|
|
46
|
-
let Legacy;
|
|
47
|
-
(function (Legacy) {
|
|
48
|
-
Legacy.change = isly.object({
|
|
49
|
-
account: isly.record(isly.string(), isly.number()),
|
|
50
|
-
amount: isly.number(),
|
|
51
|
-
});
|
|
52
|
-
Legacy.type = isly.record(isly.string(), Legacy.change);
|
|
53
|
-
function mergeAccounts(currency, burned, minted) {
|
|
54
|
-
const result = { ...(minted ?? {}) };
|
|
55
|
-
for (const [id, account] of Object.entries(burned))
|
|
56
|
-
result[id] = { amount: isoly.Currency.subtract(currency, result[id]?.amount ?? 0, account.amount) };
|
|
57
|
-
return result;
|
|
58
|
-
}
|
|
59
|
-
function accountToNew(account) {
|
|
60
|
-
return Object.fromEntries(Object.entries(account).map(([id, amount]) => [id, { amount }]));
|
|
61
|
-
}
|
|
62
|
-
function toCounterbalance(currency, minted, burned) {
|
|
63
|
-
const result = {};
|
|
64
|
-
for (const [code, change] of Object.entries(minted))
|
|
65
|
-
result[code] = { total: change.amount, account: accountToNew(change.account) };
|
|
66
|
-
for (const [code, change] of Object.entries(burned))
|
|
67
|
-
result[code] = {
|
|
68
|
-
total: isoly.Currency.subtract(currency, result[code]?.total ?? 0, change.amount),
|
|
69
|
-
account: mergeAccounts(currency, accountToNew(change.account), result[code]?.account),
|
|
70
|
-
};
|
|
71
|
-
return result;
|
|
72
|
-
}
|
|
73
|
-
Legacy.toCounterbalance = toCounterbalance;
|
|
74
|
-
})(Legacy = Fragment.Legacy || (Fragment.Legacy = {}));
|
|
75
|
-
function fromLegacy(currency, fragment) {
|
|
76
|
-
let result;
|
|
77
|
-
if ("counterbalance" in fragment)
|
|
78
|
-
result = fragment;
|
|
79
|
-
else {
|
|
80
|
-
const counterbalance = Legacy.toCounterbalance(currency, fragment.minted, fragment.burned);
|
|
81
|
-
const result = { ...fragment, counterbalance };
|
|
82
|
-
"burned" in result && delete result.burned;
|
|
83
|
-
"minted" in result && delete result.minted;
|
|
84
|
-
return result;
|
|
85
|
-
}
|
|
86
|
-
return result;
|
|
87
|
-
}
|
|
88
|
-
Fragment.fromLegacy = fromLegacy;
|
|
89
|
-
})(Fragment || (Fragment = {}));
|
|
90
|
-
//# sourceMappingURL=Fragment.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Fragment.js","sourceRoot":"","sources":["../../../../Treasury/Snapshot/Fragment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,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