@pax2pay/model-banking 0.1.67 → 0.1.69
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 +2 -3
- package/Treasury/Account/index.ts +1 -1
- package/Treasury/Transaction/Creatable.ts +23 -0
- package/Treasury/Transaction/index.ts +33 -0
- package/Treasury/index.ts +2 -0
- package/dist/Client/Treasury.d.ts +1 -2
- package/dist/Client/Treasury.js.map +1 -1
- package/dist/Treasury/Account/index.d.ts +1 -1
- package/dist/Treasury/Transaction/Creatable.d.ts +11 -0
- package/dist/Treasury/Transaction/Creatable.js +16 -0
- package/dist/Treasury/Transaction/Creatable.js.map +1 -0
- package/dist/Treasury/Transaction/index.d.ts +15 -0
- package/dist/Treasury/Transaction/index.js +27 -0
- package/dist/Treasury/Transaction/index.js.map +1 -0
- package/dist/Treasury/index.d.ts +2 -0
- package/dist/Treasury/index.js.map +1 -1
- package/package.json +1 -1
package/Client/Treasury.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { gracely } from "gracely"
|
|
|
2
2
|
import { isoly } from "isoly"
|
|
3
3
|
import { http } from "cloudly-http"
|
|
4
4
|
import * as rest from "cloudly-rest"
|
|
5
|
-
import { Transaction } from "../Transaction"
|
|
6
5
|
import { Treasury as TreasuryModel } from "../Treasury"
|
|
7
6
|
import { Result } from "../Treasury/Balance"
|
|
8
7
|
|
|
@@ -18,7 +17,7 @@ export class Treasury extends rest.Collection<gracely.Error> {
|
|
|
18
17
|
const path = hour ? `?time=${hour}` : ""
|
|
19
18
|
return this.client.get<TreasuryModel>(`/fiat/treasury${path}`)
|
|
20
19
|
}
|
|
21
|
-
async listTransactions(accountId: string): Promise<Transaction[] | gracely.Error> {
|
|
22
|
-
return this.client.get<Transaction[]>(`/treasury/account/${accountId}/transaction`)
|
|
20
|
+
async listTransactions(accountId: string): Promise<TreasuryModel.Transaction[] | gracely.Error> {
|
|
21
|
+
return this.client.get<TreasuryModel.Transaction[]>(`/treasury/account/${accountId}/transaction`)
|
|
23
22
|
}
|
|
24
23
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as isoly from "isoly"
|
|
2
|
+
import { Rail } from "../../Rail"
|
|
3
|
+
|
|
4
|
+
export interface Creatable {
|
|
5
|
+
creditor: Rail
|
|
6
|
+
currency: isoly.Currency
|
|
7
|
+
amount: number
|
|
8
|
+
description: string
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export namespace Creatable {
|
|
12
|
+
export function is(value: Creatable | any): value is Creatable {
|
|
13
|
+
return (
|
|
14
|
+
value &&
|
|
15
|
+
typeof value == "object" &&
|
|
16
|
+
value.creditor &&
|
|
17
|
+
Rail.is(value.creditor) &&
|
|
18
|
+
isoly.Currency.is(value.currency) &&
|
|
19
|
+
typeof value.amount == "number" &&
|
|
20
|
+
typeof value.description == "string"
|
|
21
|
+
)
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as cryptly from "cryptly"
|
|
2
|
+
import * as isoly from "isoly"
|
|
3
|
+
import { Rail } from "../../Rail"
|
|
4
|
+
import { Creatable as TransactionCreatable } from "./Creatable"
|
|
5
|
+
|
|
6
|
+
export interface Transaction extends TransactionCreatable {
|
|
7
|
+
debtor: Rail
|
|
8
|
+
readonly id: cryptly.Identifier
|
|
9
|
+
readonly created: isoly.DateTime
|
|
10
|
+
}
|
|
11
|
+
export namespace Transaction {
|
|
12
|
+
export function is(value: any | Transaction): value is Transaction {
|
|
13
|
+
return (
|
|
14
|
+
value &&
|
|
15
|
+
typeof value == "object" &&
|
|
16
|
+
Rail.is(value.debtor) &&
|
|
17
|
+
cryptly.Identifier.is(value.id) &&
|
|
18
|
+
isoly.DateTime.is(value.created) &&
|
|
19
|
+
Creatable.is({ ...value })
|
|
20
|
+
)
|
|
21
|
+
}
|
|
22
|
+
export function fromCreatable(transaction: TransactionCreatable, debtor: Rail): Transaction {
|
|
23
|
+
return {
|
|
24
|
+
debtor: debtor,
|
|
25
|
+
id: cryptly.Identifier.generate(8),
|
|
26
|
+
created: isoly.DateTime.now(),
|
|
27
|
+
...transaction,
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export const Creatable = TransactionCreatable
|
|
32
|
+
export type Creatable = TransactionCreatable
|
|
33
|
+
}
|
package/Treasury/index.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { Account as TreasuryAccount } from "./Account"
|
|
2
2
|
import { Balance as TreasuryBalance } from "./Balance"
|
|
3
3
|
import { Fiat as TreasuryFiat } from "./Fiat"
|
|
4
|
+
import { Transaction as TreasuryTransaction } from "./Transaction"
|
|
4
5
|
export { Treasury } from "./Treasury"
|
|
5
6
|
|
|
6
7
|
export namespace Treasury {
|
|
7
8
|
export type Account = TreasuryAccount
|
|
9
|
+
export type Transaction = TreasuryTransaction
|
|
8
10
|
export type Balance = TreasuryBalance
|
|
9
11
|
export type Fiat = TreasuryFiat
|
|
10
12
|
export const Balance = TreasuryBalance
|
|
@@ -2,12 +2,11 @@ import { gracely } from "gracely";
|
|
|
2
2
|
import { isoly } from "isoly";
|
|
3
3
|
import { http } from "cloudly-http";
|
|
4
4
|
import * as rest from "cloudly-rest";
|
|
5
|
-
import { Transaction } from "../Transaction";
|
|
6
5
|
import { Treasury as TreasuryModel } from "../Treasury";
|
|
7
6
|
import { Result } from "../Treasury/Balance";
|
|
8
7
|
export declare class Treasury extends rest.Collection<gracely.Error> {
|
|
9
8
|
constructor(client: http.Client);
|
|
10
9
|
change(currency: isoly.Currency, changes: Result[]): Promise<gracely.Result>;
|
|
11
10
|
fetch(hour?: isoly.DateTime): Promise<TreasuryModel | gracely.Error>;
|
|
12
|
-
listTransactions(accountId: string): Promise<Transaction[] | gracely.Error>;
|
|
11
|
+
listTransactions(accountId: string): Promise<TreasuryModel.Transaction[] | gracely.Error>;
|
|
13
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Treasury.js","sourceRoot":"../","sources":["Client/Treasury.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,IAAI,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"Treasury.js","sourceRoot":"../","sources":["Client/Treasury.ts"],"names":[],"mappings":"AAGA,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,kBAAkB,QAAQ,OAAO,EAAE,OAAO,CAAC,CAAA;IACrE,CAAC;IACD,KAAK,CAAC,KAAK,CAAC,IAAqB;QAChC,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAA;QACxC,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAgB,iBAAiB,IAAI,EAAE,CAAC,CAAA;IAC/D,CAAC;IACD,KAAK,CAAC,gBAAgB,CAAC,SAAiB;QACvC,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAA8B,qBAAqB,SAAS,cAAc,CAAC,CAAA;IAClG,CAAC;CACD"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as isoly from "isoly";
|
|
2
|
+
import { Rail } from "../../Rail";
|
|
3
|
+
export interface Creatable {
|
|
4
|
+
creditor: Rail;
|
|
5
|
+
currency: isoly.Currency;
|
|
6
|
+
amount: number;
|
|
7
|
+
description: string;
|
|
8
|
+
}
|
|
9
|
+
export declare namespace Creatable {
|
|
10
|
+
function is(value: Creatable | any): value is Creatable;
|
|
11
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as isoly from "isoly";
|
|
2
|
+
import { Rail } from "../../Rail";
|
|
3
|
+
export var Creatable;
|
|
4
|
+
(function (Creatable) {
|
|
5
|
+
function is(value) {
|
|
6
|
+
return (value &&
|
|
7
|
+
typeof value == "object" &&
|
|
8
|
+
value.creditor &&
|
|
9
|
+
Rail.is(value.creditor) &&
|
|
10
|
+
isoly.Currency.is(value.currency) &&
|
|
11
|
+
typeof value.amount == "number" &&
|
|
12
|
+
typeof value.description == "string");
|
|
13
|
+
}
|
|
14
|
+
Creatable.is = is;
|
|
15
|
+
})(Creatable || (Creatable = {}));
|
|
16
|
+
//# sourceMappingURL=Creatable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Creatable.js","sourceRoot":"../","sources":["Treasury/Transaction/Creatable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AASjC,MAAM,KAAW,SAAS,CAYzB;AAZD,WAAiB,SAAS;IACzB,SAAgB,EAAE,CAAC,KAAsB;QACxC,OAAO,CACN,KAAK;YACL,OAAO,KAAK,IAAI,QAAQ;YACxB,KAAK,CAAC,QAAQ;YACd,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC;YACvB,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC;YACjC,OAAO,KAAK,CAAC,MAAM,IAAI,QAAQ;YAC/B,OAAO,KAAK,CAAC,WAAW,IAAI,QAAQ,CACpC,CAAA;IACF,CAAC;IAVe,YAAE,KAUjB,CAAA;AACF,CAAC,EAZgB,SAAS,KAAT,SAAS,QAYzB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as cryptly from "cryptly";
|
|
2
|
+
import * as isoly from "isoly";
|
|
3
|
+
import { Rail } from "../../Rail";
|
|
4
|
+
import { Creatable as TransactionCreatable } from "./Creatable";
|
|
5
|
+
export interface Transaction extends TransactionCreatable {
|
|
6
|
+
debtor: Rail;
|
|
7
|
+
readonly id: cryptly.Identifier;
|
|
8
|
+
readonly created: isoly.DateTime;
|
|
9
|
+
}
|
|
10
|
+
export declare namespace Transaction {
|
|
11
|
+
function is(value: any | Transaction): value is Transaction;
|
|
12
|
+
function fromCreatable(transaction: TransactionCreatable, debtor: Rail): Transaction;
|
|
13
|
+
const Creatable: typeof TransactionCreatable;
|
|
14
|
+
type Creatable = TransactionCreatable;
|
|
15
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as cryptly from "cryptly";
|
|
2
|
+
import * as isoly from "isoly";
|
|
3
|
+
import { Rail } from "../../Rail";
|
|
4
|
+
import { Creatable as TransactionCreatable } from "./Creatable";
|
|
5
|
+
export var Transaction;
|
|
6
|
+
(function (Transaction) {
|
|
7
|
+
function is(value) {
|
|
8
|
+
return (value &&
|
|
9
|
+
typeof value == "object" &&
|
|
10
|
+
Rail.is(value.debtor) &&
|
|
11
|
+
cryptly.Identifier.is(value.id) &&
|
|
12
|
+
isoly.DateTime.is(value.created) &&
|
|
13
|
+
Transaction.Creatable.is({ ...value }));
|
|
14
|
+
}
|
|
15
|
+
Transaction.is = is;
|
|
16
|
+
function fromCreatable(transaction, debtor) {
|
|
17
|
+
return {
|
|
18
|
+
debtor: debtor,
|
|
19
|
+
id: cryptly.Identifier.generate(8),
|
|
20
|
+
created: isoly.DateTime.now(),
|
|
21
|
+
...transaction,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
Transaction.fromCreatable = fromCreatable;
|
|
25
|
+
Transaction.Creatable = TransactionCreatable;
|
|
26
|
+
})(Transaction || (Transaction = {}));
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../","sources":["Treasury/Transaction/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAA;AAClC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AACjC,OAAO,EAAE,SAAS,IAAI,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAO/D,MAAM,KAAW,WAAW,CAsB3B;AAtBD,WAAiB,WAAW;IAC3B,SAAgB,EAAE,CAAC,KAAwB;QAC1C,OAAO,CACN,KAAK;YACL,OAAO,KAAK,IAAI,QAAQ;YACxB,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC;YACrB,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC;YAC/B,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC;YAChC,YAAA,SAAS,CAAC,EAAE,CAAC,EAAE,GAAG,KAAK,EAAE,CAAC,CAC1B,CAAA;IACF,CAAC;IATe,cAAE,KASjB,CAAA;IACD,SAAgB,aAAa,CAAC,WAAiC,EAAE,MAAY;QAC5E,OAAO;YACN,MAAM,EAAE,MAAM;YACd,EAAE,EAAE,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC;YAClC,OAAO,EAAE,KAAK,CAAC,QAAQ,CAAC,GAAG,EAAE;YAC7B,GAAG,WAAW;SACd,CAAA;IACF,CAAC;IAPe,yBAAa,gBAO5B,CAAA;IAEY,qBAAS,GAAG,oBAAoB,CAAA;AAE9C,CAAC,EAtBgB,WAAW,KAAX,WAAW,QAsB3B"}
|
package/dist/Treasury/index.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { Account as TreasuryAccount } from "./Account";
|
|
2
2
|
import { Balance as TreasuryBalance } from "./Balance";
|
|
3
3
|
import { Fiat as TreasuryFiat } from "./Fiat";
|
|
4
|
+
import { Transaction as TreasuryTransaction } from "./Transaction";
|
|
4
5
|
export { Treasury } from "./Treasury";
|
|
5
6
|
export declare namespace Treasury {
|
|
6
7
|
type Account = TreasuryAccount;
|
|
8
|
+
type Transaction = TreasuryTransaction;
|
|
7
9
|
type Balance = TreasuryBalance;
|
|
8
10
|
type Fiat = TreasuryFiat;
|
|
9
11
|
const Balance: typeof TreasuryBalance;
|
|
@@ -1 +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;
|
|
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;AAKtD,MAAM,KAAW,QAAQ,CAexB;AAfD,WAAiB,QAAQ;IAKX,gBAAO,GAAG,eAAe,CAAA;IACtC,IAAiB,OAAO,CAQvB;IARD,WAAiB,OAAO;QAEV,iBAAS,GAAG,eAAe,CAAC,SAAS,CAAA;QAErC,gBAAQ,GAAG,eAAe,CAAC,QAAQ,CAAA;QAEnC,iBAAS,GAAG,eAAe,CAAC,SAAS,CAAA;QACrC,UAAE,GAAG,eAAe,CAAC,EAAE,CAAA;IACrC,CAAC,EARgB,OAAO,GAAP,gBAAO,KAAP,gBAAO,QAQvB;AACF,CAAC,EAfgB,QAAQ,KAAR,QAAQ,QAexB"}
|