@pax2pay/model-banking 0.0.44 → 0.0.45
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/Realm/index.ts +16 -0
- package/Supplier/index.ts +8 -0
- package/Treasury/Account/Creatable.ts +27 -0
- package/Treasury/Account/index.ts +38 -0
- package/Treasury/Balance/index.ts +20 -0
- package/Treasury/Client/Treasury.ts +20 -0
- package/Treasury/Client/index.ts +21 -0
- package/Treasury/Fiat/index.ts +8 -0
- package/Treasury/Treasury.ts +5 -0
- package/Treasury/index.ts +16 -0
- package/dist/Realm/index.d.ts +6 -0
- package/dist/Realm/index.js +17 -0
- package/dist/Realm/index.js.map +1 -0
- package/dist/Supplier/index.d.ts +5 -0
- package/dist/Supplier/index.js +9 -0
- package/dist/Supplier/index.js.map +1 -0
- package/dist/Treasury/Account/Creatable.d.ts +17 -0
- package/dist/Treasury/Account/Creatable.js +18 -0
- package/dist/Treasury/Account/Creatable.js.map +1 -0
- package/dist/Treasury/Account/index.d.ts +18 -0
- package/dist/Treasury/Account/index.js +27 -0
- package/dist/Treasury/Account/index.js.map +1 -0
- package/dist/Treasury/Balance/index.d.ts +12 -0
- package/dist/Treasury/Balance/index.js +18 -0
- package/dist/Treasury/Balance/index.js.map +1 -0
- package/dist/Treasury/Client/Treasury.d.ts +11 -0
- package/dist/Treasury/Client/Treasury.js +15 -0
- package/dist/Treasury/Client/Treasury.js.map +1 -0
- package/dist/Treasury/Client/index.d.ts +9 -0
- package/dist/Treasury/Client/index.js +19 -0
- package/dist/Treasury/Client/index.js.map +1 -0
- package/dist/Treasury/Fiat/index.d.ts +7 -0
- package/dist/Treasury/Fiat/index.js +2 -0
- package/dist/Treasury/Fiat/index.js.map +1 -0
- package/dist/Treasury/Treasury.d.ts +7 -0
- package/dist/Treasury/Treasury.js +2 -0
- package/dist/Treasury/Treasury.js.map +1 -0
- package/dist/Treasury/index.d.ts +15 -0
- package/dist/Treasury/index.js +10 -0
- package/dist/Treasury/index.js.map +1 -0
- package/dist/pax2pay.d.ts +1 -0
- package/dist/pax2pay.js +1 -0
- package/dist/pax2pay.js.map +1 -1
- package/package.json +1 -1
- package/pax2pay.ts +1 -0
package/Realm/index.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const Realms = ["test", "uk", "eu"] as const
|
|
2
|
+
export type Realm = typeof Realms[number]
|
|
3
|
+
|
|
4
|
+
export namespace Realm {
|
|
5
|
+
export function is(value: any | Realm): value is Realm {
|
|
6
|
+
return value && (value == "test" || value == "uk" || value == "eu")
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function toString(): string {
|
|
10
|
+
let result = ""
|
|
11
|
+
for (const v of Realms) {
|
|
12
|
+
result = result + v + ", "
|
|
13
|
+
}
|
|
14
|
+
return result
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as isoly from "isoly"
|
|
2
|
+
import { Realm } from "../../Realm"
|
|
3
|
+
import { Supplier } from "../../Supplier"
|
|
4
|
+
|
|
5
|
+
export interface Creatable {
|
|
6
|
+
meta?: { realm: Realm; supplier: Supplier }
|
|
7
|
+
name: string
|
|
8
|
+
realm: Realm
|
|
9
|
+
currencies: isoly.Currency[]
|
|
10
|
+
supplier: Supplier
|
|
11
|
+
type: "safeguarded" | "other"
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export namespace Creatable {
|
|
15
|
+
export function is(value: Creatable | any): value is Creatable {
|
|
16
|
+
return (
|
|
17
|
+
value &&
|
|
18
|
+
typeof value == "object" &&
|
|
19
|
+
typeof value.name == "string" &&
|
|
20
|
+
Realm.is(value.realm) &&
|
|
21
|
+
Array.isArray(value.currencies) &&
|
|
22
|
+
value.currencies.every(isoly.Currency.is) &&
|
|
23
|
+
Supplier.is(value.supplier) &&
|
|
24
|
+
(value.type == "safeguarded" || value.type == "other")
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as cryptly from "cryptly"
|
|
2
|
+
import * as isoly from "isoly"
|
|
3
|
+
import { Rail } from "../../Rail"
|
|
4
|
+
import { Realm } from "../../Realm"
|
|
5
|
+
import { Supplier } from "../../Supplier"
|
|
6
|
+
import { Balance } from "../Balance"
|
|
7
|
+
import { Creatable as AccountCreatable } from "./Creatable"
|
|
8
|
+
|
|
9
|
+
export interface Account extends Account.Creatable {
|
|
10
|
+
readonly id: cryptly.Identifier
|
|
11
|
+
readonly created: isoly.DateTime
|
|
12
|
+
readonly reference: string
|
|
13
|
+
rail: Rail
|
|
14
|
+
balance: Balance
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export namespace Account {
|
|
18
|
+
export function is(value: Account | any): value is Account {
|
|
19
|
+
return (
|
|
20
|
+
value &&
|
|
21
|
+
typeof value == "object" &&
|
|
22
|
+
cryptly.Identifier.is(value.id, 8) &&
|
|
23
|
+
isoly.DateTime.is(value.created) &&
|
|
24
|
+
typeof value.reference == "string" &&
|
|
25
|
+
typeof value.name == "string" &&
|
|
26
|
+
Realm.is(value.realm) &&
|
|
27
|
+
isoly.Currency.is(value.currency) &&
|
|
28
|
+
Supplier.is(value.supplier) &&
|
|
29
|
+
(value.type == "clientFundAccount" || value.type == "other")
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
export function isIdentifier(value: cryptly.Identifier | any): value is cryptly.Identifier {
|
|
33
|
+
return cryptly.Identifier.is(value, 8)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export type Creatable = AccountCreatable
|
|
37
|
+
export const Creatable = AccountCreatable
|
|
38
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as isoly from "isoly"
|
|
2
|
+
|
|
3
|
+
export type Balance = Partial<Record<isoly.Currency, number>>
|
|
4
|
+
|
|
5
|
+
export type Result = { account: string; balances: Balance }
|
|
6
|
+
|
|
7
|
+
export namespace Balance {
|
|
8
|
+
export function is(value: Balance | any): value is Balance {
|
|
9
|
+
return (
|
|
10
|
+
value &&
|
|
11
|
+
typeof value == "object" &&
|
|
12
|
+
Object.entries(value).every(([k, v]) => isoly.Currency.is(k) && typeof v == "number")
|
|
13
|
+
)
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export namespace Result {
|
|
17
|
+
export function is(value: Balance | any): value is Result {
|
|
18
|
+
return value && typeof value == "object" && typeof value.account == "string" && Balance.is(value.balances)
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as gracely from "gracely"
|
|
2
|
+
import * as isoly from "isoly"
|
|
3
|
+
import * as http from "cloudly-http"
|
|
4
|
+
import * as rest from "cloudly-rest"
|
|
5
|
+
import { Result } from "../Balance"
|
|
6
|
+
import { Treasury as TreasuryModel } from "../Treasury"
|
|
7
|
+
|
|
8
|
+
export class Treasury extends rest.Collection<gracely.Error> {
|
|
9
|
+
constructor(client: http.Client) {
|
|
10
|
+
super(client)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
async change(currency: isoly.Currency, changes: Result[]): Promise<gracely.Result> {
|
|
14
|
+
return this.client.patch(`/treasury/${currency}/fiat`, changes)
|
|
15
|
+
}
|
|
16
|
+
async fetch(hour?: isoly.DateTime): Promise<TreasuryModel | gracely.Error> {
|
|
17
|
+
const path = hour ? `?hour=${isoly.DateTime.truncate(hour, "hours")}` : undefined
|
|
18
|
+
return this.client.get<TreasuryModel>(`/treasury${path}`)
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as gracely from "gracely"
|
|
2
|
+
import * as http from "cloudly-http"
|
|
3
|
+
import * as rest from "cloudly-rest"
|
|
4
|
+
import { Treasury } from "./Treasury"
|
|
5
|
+
|
|
6
|
+
export class Client extends rest.Client<gracely.Error> {
|
|
7
|
+
realm?: string
|
|
8
|
+
treasury = new Treasury(this.client)
|
|
9
|
+
|
|
10
|
+
static create<T = Record<string, any>>(server: string, key: string, load?: (client: http.Client) => T): Client & T {
|
|
11
|
+
let httpClient: http.Client<gracely.Error>
|
|
12
|
+
const result: Client = new Client(
|
|
13
|
+
(httpClient = new http.Client<gracely.Error>(server, key, {
|
|
14
|
+
appendHeader: request => ({ realm: result.realm }),
|
|
15
|
+
}))
|
|
16
|
+
)
|
|
17
|
+
if (load)
|
|
18
|
+
Object.assign(result, load(httpClient))
|
|
19
|
+
return result as Client & T
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Account as TreasuryAccount } from "./Account"
|
|
2
|
+
import { Balance as TreasuryBalance } from "./Balance"
|
|
3
|
+
import { Client as TreasuryClient } from "./Client"
|
|
4
|
+
import { Fiat as TreasuryFiat } from "./Fiat"
|
|
5
|
+
import { Treasury as TreasuryType } from "./Treasury"
|
|
6
|
+
|
|
7
|
+
export namespace Treasury {
|
|
8
|
+
export type Account = TreasuryAccount
|
|
9
|
+
export type Balance = TreasuryBalance
|
|
10
|
+
export type Fiat = TreasuryFiat
|
|
11
|
+
export type Treasury = TreasuryType
|
|
12
|
+
export type Client = TreasuryClient
|
|
13
|
+
export const Account = TreasuryAccount
|
|
14
|
+
export const Balance = TreasuryBalance
|
|
15
|
+
export const Client = TreasuryClient
|
|
16
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const Realms = ["test", "uk", "eu"];
|
|
2
|
+
export var Realm;
|
|
3
|
+
(function (Realm) {
|
|
4
|
+
function is(value) {
|
|
5
|
+
return value && (value == "test" || value == "uk" || value == "eu");
|
|
6
|
+
}
|
|
7
|
+
Realm.is = is;
|
|
8
|
+
function toString() {
|
|
9
|
+
let result = "";
|
|
10
|
+
for (const v of Realms) {
|
|
11
|
+
result = result + v + ", ";
|
|
12
|
+
}
|
|
13
|
+
return result;
|
|
14
|
+
}
|
|
15
|
+
Realm.toString = toString;
|
|
16
|
+
})(Realm || (Realm = {}));
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../","sources":["Realm/index.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAU,CAAA;AAGnD,MAAM,KAAW,KAAK,CAYrB;AAZD,WAAiB,KAAK;IACrB,SAAgB,EAAE,CAAC,KAAkB;QACpC,OAAO,KAAK,IAAI,CAAC,KAAK,IAAI,MAAM,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,IAAI,IAAI,CAAC,CAAA;IACpE,CAAC;IAFe,QAAE,KAEjB,CAAA;IAED,SAAgB,QAAQ;QACvB,IAAI,MAAM,GAAG,EAAE,CAAA;QACf,KAAK,MAAM,CAAC,IAAI,MAAM,EAAE;YACvB,MAAM,GAAG,MAAM,GAAG,CAAC,GAAG,IAAI,CAAA;SAC1B;QACD,OAAO,MAAM,CAAA;IACd,CAAC;IANe,cAAQ,WAMvB,CAAA;AACF,CAAC,EAZgB,KAAK,KAAL,KAAK,QAYrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../","sources":["Supplier/index.ts"],"names":[],"mappings":"AAEA,MAAM,KAAW,QAAQ,CAKxB;AALD,WAAiB,QAAQ;IACxB,SAAgB,EAAE,CAAC,KAAqB;QACvC,OAAO,KAAK,IAAI,SAAA,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;IACtC,CAAC;IAFe,WAAE,KAEjB,CAAA;IACY,cAAK,GAAG,CAAC,SAAS,EAAE,WAAW,CAAU,CAAA;AACvD,CAAC,EALgB,QAAQ,KAAR,QAAQ,QAKxB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as isoly from "isoly";
|
|
2
|
+
import { Realm } from "../../Realm";
|
|
3
|
+
import { Supplier } from "../../Supplier";
|
|
4
|
+
export interface Creatable {
|
|
5
|
+
meta?: {
|
|
6
|
+
realm: Realm;
|
|
7
|
+
supplier: Supplier;
|
|
8
|
+
};
|
|
9
|
+
name: string;
|
|
10
|
+
realm: Realm;
|
|
11
|
+
currencies: isoly.Currency[];
|
|
12
|
+
supplier: Supplier;
|
|
13
|
+
type: "safeguarded" | "other";
|
|
14
|
+
}
|
|
15
|
+
export declare namespace Creatable {
|
|
16
|
+
function is(value: Creatable | any): value is Creatable;
|
|
17
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as isoly from "isoly";
|
|
2
|
+
import { Realm } from "../../Realm";
|
|
3
|
+
import { Supplier } from "../../Supplier";
|
|
4
|
+
export var Creatable;
|
|
5
|
+
(function (Creatable) {
|
|
6
|
+
function is(value) {
|
|
7
|
+
return (value &&
|
|
8
|
+
typeof value == "object" &&
|
|
9
|
+
typeof value.name == "string" &&
|
|
10
|
+
Realm.is(value.realm) &&
|
|
11
|
+
Array.isArray(value.currencies) &&
|
|
12
|
+
value.currencies.every(isoly.Currency.is) &&
|
|
13
|
+
Supplier.is(value.supplier) &&
|
|
14
|
+
(value.type == "safeguarded" || value.type == "other"));
|
|
15
|
+
}
|
|
16
|
+
Creatable.is = is;
|
|
17
|
+
})(Creatable || (Creatable = {}));
|
|
18
|
+
//# sourceMappingURL=Creatable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Creatable.js","sourceRoot":"../","sources":["Treasury/Account/Creatable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAWzC,MAAM,KAAW,SAAS,CAazB;AAbD,WAAiB,SAAS;IACzB,SAAgB,EAAE,CAAC,KAAsB;QACxC,OAAO,CACN,KAAK;YACL,OAAO,KAAK,IAAI,QAAQ;YACxB,OAAO,KAAK,CAAC,IAAI,IAAI,QAAQ;YAC7B,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC;YACrB,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC;YAC/B,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;YACzC,QAAQ,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC;YAC3B,CAAC,KAAK,CAAC,IAAI,IAAI,aAAa,IAAI,KAAK,CAAC,IAAI,IAAI,OAAO,CAAC,CACtD,CAAA;IACF,CAAC;IAXe,YAAE,KAWjB,CAAA;AACF,CAAC,EAbgB,SAAS,KAAT,SAAS,QAazB"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as cryptly from "cryptly";
|
|
2
|
+
import * as isoly from "isoly";
|
|
3
|
+
import { Rail } from "../../Rail";
|
|
4
|
+
import { Balance } from "../Balance";
|
|
5
|
+
import { Creatable as AccountCreatable } from "./Creatable";
|
|
6
|
+
export interface Account extends Account.Creatable {
|
|
7
|
+
readonly id: cryptly.Identifier;
|
|
8
|
+
readonly created: isoly.DateTime;
|
|
9
|
+
readonly reference: string;
|
|
10
|
+
rail: Rail;
|
|
11
|
+
balance: Balance;
|
|
12
|
+
}
|
|
13
|
+
export declare namespace Account {
|
|
14
|
+
function is(value: Account | any): value is Account;
|
|
15
|
+
function isIdentifier(value: cryptly.Identifier | any): value is cryptly.Identifier;
|
|
16
|
+
type Creatable = AccountCreatable;
|
|
17
|
+
const Creatable: typeof AccountCreatable;
|
|
18
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as cryptly from "cryptly";
|
|
2
|
+
import * as isoly from "isoly";
|
|
3
|
+
import { Realm } from "../../Realm";
|
|
4
|
+
import { Supplier } from "../../Supplier";
|
|
5
|
+
import { Creatable as AccountCreatable } from "./Creatable";
|
|
6
|
+
export var Account;
|
|
7
|
+
(function (Account) {
|
|
8
|
+
function is(value) {
|
|
9
|
+
return (value &&
|
|
10
|
+
typeof value == "object" &&
|
|
11
|
+
cryptly.Identifier.is(value.id, 8) &&
|
|
12
|
+
isoly.DateTime.is(value.created) &&
|
|
13
|
+
typeof value.reference == "string" &&
|
|
14
|
+
typeof value.name == "string" &&
|
|
15
|
+
Realm.is(value.realm) &&
|
|
16
|
+
isoly.Currency.is(value.currency) &&
|
|
17
|
+
Supplier.is(value.supplier) &&
|
|
18
|
+
(value.type == "clientFundAccount" || value.type == "other"));
|
|
19
|
+
}
|
|
20
|
+
Account.is = is;
|
|
21
|
+
function isIdentifier(value) {
|
|
22
|
+
return cryptly.Identifier.is(value, 8);
|
|
23
|
+
}
|
|
24
|
+
Account.isIdentifier = isIdentifier;
|
|
25
|
+
Account.Creatable = AccountCreatable;
|
|
26
|
+
})(Account || (Account = {}));
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../","sources":["Treasury/Account/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAA;AAClC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAEzC,OAAO,EAAE,SAAS,IAAI,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAU3D,MAAM,KAAW,OAAO,CAqBvB;AArBD,WAAiB,OAAO;IACvB,SAAgB,EAAE,CAAC,KAAoB;QACtC,OAAO,CACN,KAAK;YACL,OAAO,KAAK,IAAI,QAAQ;YACxB,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;YAClC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC;YAChC,OAAO,KAAK,CAAC,SAAS,IAAI,QAAQ;YAClC,OAAO,KAAK,CAAC,IAAI,IAAI,QAAQ;YAC7B,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC;YACrB,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC;YACjC,QAAQ,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC;YAC3B,CAAC,KAAK,CAAC,IAAI,IAAI,mBAAmB,IAAI,KAAK,CAAC,IAAI,IAAI,OAAO,CAAC,CAC5D,CAAA;IACF,CAAC;IAbe,UAAE,KAajB,CAAA;IACD,SAAgB,YAAY,CAAC,KAA+B;QAC3D,OAAO,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC,CAAA;IACvC,CAAC;IAFe,oBAAY,eAE3B,CAAA;IAGY,iBAAS,GAAG,gBAAgB,CAAA;AAC1C,CAAC,EArBgB,OAAO,KAAP,OAAO,QAqBvB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as isoly from "isoly";
|
|
2
|
+
export type Balance = Partial<Record<isoly.Currency, number>>;
|
|
3
|
+
export type Result = {
|
|
4
|
+
account: string;
|
|
5
|
+
balances: Balance;
|
|
6
|
+
};
|
|
7
|
+
export declare namespace Balance {
|
|
8
|
+
function is(value: Balance | any): value is Balance;
|
|
9
|
+
}
|
|
10
|
+
export declare namespace Result {
|
|
11
|
+
function is(value: Balance | any): value is Result;
|
|
12
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as isoly from "isoly";
|
|
2
|
+
export var Balance;
|
|
3
|
+
(function (Balance) {
|
|
4
|
+
function is(value) {
|
|
5
|
+
return (value &&
|
|
6
|
+
typeof value == "object" &&
|
|
7
|
+
Object.entries(value).every(([k, v]) => isoly.Currency.is(k) && typeof v == "number"));
|
|
8
|
+
}
|
|
9
|
+
Balance.is = is;
|
|
10
|
+
})(Balance || (Balance = {}));
|
|
11
|
+
export var Result;
|
|
12
|
+
(function (Result) {
|
|
13
|
+
function is(value) {
|
|
14
|
+
return value && typeof value == "object" && typeof value.account == "string" && Balance.is(value.balances);
|
|
15
|
+
}
|
|
16
|
+
Result.is = is;
|
|
17
|
+
})(Result || (Result = {}));
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../","sources":["Treasury/Balance/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAM9B,MAAM,KAAW,OAAO,CAQvB;AARD,WAAiB,OAAO;IACvB,SAAgB,EAAE,CAAC,KAAoB;QACtC,OAAO,CACN,KAAK;YACL,OAAO,KAAK,IAAI,QAAQ;YACxB,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,IAAI,QAAQ,CAAC,CACrF,CAAA;IACF,CAAC;IANe,UAAE,KAMjB,CAAA;AACF,CAAC,EARgB,OAAO,KAAP,OAAO,QAQvB;AACD,MAAM,KAAW,MAAM,CAItB;AAJD,WAAiB,MAAM;IACtB,SAAgB,EAAE,CAAC,KAAoB;QACtC,OAAO,KAAK,IAAI,OAAO,KAAK,IAAI,QAAQ,IAAI,OAAO,KAAK,CAAC,OAAO,IAAI,QAAQ,IAAI,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;IAC3G,CAAC;IAFe,SAAE,KAEjB,CAAA;AACF,CAAC,EAJgB,MAAM,KAAN,MAAM,QAItB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as gracely from "gracely";
|
|
2
|
+
import * as isoly from "isoly";
|
|
3
|
+
import * as http from "cloudly-http";
|
|
4
|
+
import * as rest from "cloudly-rest";
|
|
5
|
+
import { Result } from "../Balance";
|
|
6
|
+
import { Treasury as TreasuryModel } from "../Treasury";
|
|
7
|
+
export declare class Treasury extends rest.Collection<gracely.Error> {
|
|
8
|
+
constructor(client: http.Client);
|
|
9
|
+
change(currency: isoly.Currency, changes: Result[]): Promise<gracely.Result>;
|
|
10
|
+
fetch(hour?: isoly.DateTime): Promise<TreasuryModel | gracely.Error>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as isoly from "isoly";
|
|
2
|
+
import * as rest from "cloudly-rest";
|
|
3
|
+
export class Treasury extends rest.Collection {
|
|
4
|
+
constructor(client) {
|
|
5
|
+
super(client);
|
|
6
|
+
}
|
|
7
|
+
async change(currency, changes) {
|
|
8
|
+
return this.client.patch(`/treasury/${currency}/fiat`, changes);
|
|
9
|
+
}
|
|
10
|
+
async fetch(hour) {
|
|
11
|
+
const path = hour ? `?hour=${isoly.DateTime.truncate(hour, "hours")}` : undefined;
|
|
12
|
+
return this.client.get(`/treasury${path}`);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=Treasury.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Treasury.js","sourceRoot":"../","sources":["Treasury/Client/Treasury.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,IAAI,MAAM,cAAc,CAAA;AAIpC,MAAM,OAAO,QAAS,SAAQ,IAAI,CAAC,UAAyB;IAC3D,YAAY,MAAmB;QAC9B,KAAK,CAAC,MAAM,CAAC,CAAA;IACd,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,QAAwB,EAAE,OAAiB;QACvD,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,QAAQ,OAAO,EAAE,OAAO,CAAC,CAAA;IAChE,CAAC;IACD,KAAK,CAAC,KAAK,CAAC,IAAqB;QAChC,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,SAAS,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAA;QACjF,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAgB,YAAY,IAAI,EAAE,CAAC,CAAA;IAC1D,CAAC;CACD"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as gracely from "gracely";
|
|
2
|
+
import * as http from "cloudly-http";
|
|
3
|
+
import * as rest from "cloudly-rest";
|
|
4
|
+
import { Treasury } from "./Treasury";
|
|
5
|
+
export declare class Client extends rest.Client<gracely.Error> {
|
|
6
|
+
realm?: string;
|
|
7
|
+
treasury: Treasury;
|
|
8
|
+
static create<T = Record<string, any>>(server: string, key: string, load?: (client: http.Client) => T): Client & T;
|
|
9
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as http from "cloudly-http";
|
|
2
|
+
import * as rest from "cloudly-rest";
|
|
3
|
+
import { Treasury } from "./Treasury";
|
|
4
|
+
export class Client extends rest.Client {
|
|
5
|
+
constructor() {
|
|
6
|
+
super(...arguments);
|
|
7
|
+
this.treasury = new Treasury(this.client);
|
|
8
|
+
}
|
|
9
|
+
static create(server, key, load) {
|
|
10
|
+
let httpClient;
|
|
11
|
+
const result = new Client((httpClient = new http.Client(server, key, {
|
|
12
|
+
appendHeader: request => ({ realm: result.realm }),
|
|
13
|
+
})));
|
|
14
|
+
if (load)
|
|
15
|
+
Object.assign(result, load(httpClient));
|
|
16
|
+
return result;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../","sources":["Treasury/Client/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,IAAI,MAAM,cAAc,CAAA;AACpC,OAAO,KAAK,IAAI,MAAM,cAAc,CAAA;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAErC,MAAM,OAAO,MAAO,SAAQ,IAAI,CAAC,MAAqB;IAAtD;;QAEC,aAAQ,GAAG,IAAI,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAarC,CAAC;IAXA,MAAM,CAAC,MAAM,CAA0B,MAAc,EAAE,GAAW,EAAE,IAAiC;QACpG,IAAI,UAAsC,CAAA;QAC1C,MAAM,MAAM,GAAW,IAAI,MAAM,CAChC,CAAC,UAAU,GAAG,IAAI,IAAI,CAAC,MAAM,CAAgB,MAAM,EAAE,GAAG,EAAE;YACzD,YAAY,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC;SAClD,CAAC,CAAC,CACH,CAAA;QACD,IAAI,IAAI;YACP,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAA;QACxC,OAAO,MAAoB,CAAA;IAC5B,CAAC;CACD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../","sources":["Treasury/Fiat/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Treasury.js","sourceRoot":"../","sources":["Treasury/Treasury.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Account as TreasuryAccount } from "./Account";
|
|
2
|
+
import { Balance as TreasuryBalance } from "./Balance";
|
|
3
|
+
import { Client as TreasuryClient } from "./Client";
|
|
4
|
+
import { Fiat as TreasuryFiat } from "./Fiat";
|
|
5
|
+
import { Treasury as TreasuryType } from "./Treasury";
|
|
6
|
+
export declare namespace Treasury {
|
|
7
|
+
type Account = TreasuryAccount;
|
|
8
|
+
type Balance = TreasuryBalance;
|
|
9
|
+
type Fiat = TreasuryFiat;
|
|
10
|
+
type Treasury = TreasuryType;
|
|
11
|
+
type Client = TreasuryClient;
|
|
12
|
+
const Account: typeof TreasuryAccount;
|
|
13
|
+
const Balance: typeof TreasuryBalance;
|
|
14
|
+
const Client: typeof TreasuryClient;
|
|
15
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Account as TreasuryAccount } from "./Account";
|
|
2
|
+
import { Balance as TreasuryBalance } from "./Balance";
|
|
3
|
+
import { Client as TreasuryClient } from "./Client";
|
|
4
|
+
export var Treasury;
|
|
5
|
+
(function (Treasury) {
|
|
6
|
+
Treasury.Account = TreasuryAccount;
|
|
7
|
+
Treasury.Balance = TreasuryBalance;
|
|
8
|
+
Treasury.Client = TreasuryClient;
|
|
9
|
+
})(Treasury || (Treasury = {}));
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../","sources":["Treasury/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,WAAW,CAAA;AACtD,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,WAAW,CAAA;AACtD,OAAO,EAAE,MAAM,IAAI,cAAc,EAAE,MAAM,UAAU,CAAA;AAInD,MAAM,KAAW,QAAQ,CASxB;AATD,WAAiB,QAAQ;IAMX,gBAAO,GAAG,eAAe,CAAA;IACzB,gBAAO,GAAG,eAAe,CAAA;IACzB,eAAM,GAAG,cAAc,CAAA;AACrC,CAAC,EATgB,QAAQ,KAAR,QAAQ,QASxB"}
|
package/dist/pax2pay.d.ts
CHANGED
package/dist/pax2pay.js
CHANGED
package/dist/pax2pay.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pax2pay.js","sourceRoot":"../","sources":["pax2pay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA"}
|
|
1
|
+
{"version":3,"file":"pax2pay.js","sourceRoot":"../","sources":["pax2pay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA"}
|
package/package.json
CHANGED
package/pax2pay.ts
CHANGED