@spritz-finance/service-client 0.1.9 → 0.2.0

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/lib/config.d.ts CHANGED
@@ -3,6 +3,7 @@ interface GraphClientConfig {
3
3
  authEndpoint: string;
4
4
  graphEndpoint: string;
5
5
  verificationServiceEndpoint: string;
6
+ transactionsServiceEndpoint: string;
6
7
  }
7
8
  export declare const config: GraphClientConfig;
8
9
  export {};
package/lib/config.js CHANGED
@@ -9,22 +9,26 @@ const envConfigs = {
9
9
  authEndpoint: 'https://auth-dev.spritz.finance/oauth2/token',
10
10
  graphEndpoint: 'https://api-dev.spritz.finance/graphql',
11
11
  verificationServiceEndpoint: 'https://api-dev.spritz.finance/verification',
12
+ transactionsServiceEndpoint: 'https://api-dev.spritz.finance/transactions',
12
13
  },
13
14
  test: {
14
15
  env: 'staging',
15
16
  authEndpoint: 'https://auth-staging.spritz.finance/oauth2/token',
16
17
  graphEndpoint: 'https://api-staging.spritz.finance/graphql',
17
18
  verificationServiceEndpoint: 'https://api-staging.spritz.finance/verification',
19
+ transactionsServiceEndpoint: 'https://api-staging.spritz.finance/transactions',
18
20
  },
19
21
  staging: {
20
22
  authEndpoint: 'https://auth-staging.spritz.finance/oauth2/token',
21
23
  graphEndpoint: 'https://api-staging.spritz.finance/graphql',
22
24
  verificationServiceEndpoint: 'https://api-staging.spritz.finance/verification',
25
+ transactionsServiceEndpoint: 'https://api-staging.spritz.finance/transactions',
23
26
  },
24
27
  production: {
25
28
  authEndpoint: 'https://auth.spritz.finance/oauth2/token',
26
29
  graphEndpoint: 'https://api.spritz.finance/graphql',
27
30
  verificationServiceEndpoint: 'https://api.spritz.finance/verification',
31
+ transactionsServiceEndpoint: 'https://api.spritz.finance/transactions',
28
32
  },
29
33
  };
30
34
  exports.config = (0, config_1.setupEnvConfig)(envConfigs);
package/lib/index.d.ts CHANGED
@@ -2,3 +2,4 @@ export * from './graphClient';
2
2
  export * from './credentials';
3
3
  export * from './serviceClient';
4
4
  export * from './verificationServiceClient';
5
+ export * from './transactionsServiceClient';
package/lib/index.js CHANGED
@@ -14,3 +14,4 @@ __exportStar(require("./graphClient"), exports);
14
14
  __exportStar(require("./credentials"), exports);
15
15
  __exportStar(require("./serviceClient"), exports);
16
16
  __exportStar(require("./verificationServiceClient"), exports);
17
+ __exportStar(require("./transactionsServiceClient"), exports);
@@ -0,0 +1,15 @@
1
+ import { AxiosInstance } from 'axios';
2
+ interface UtxoInvoice {
3
+ network: string;
4
+ address: string;
5
+ expiry: string;
6
+ expired: boolean;
7
+ amountFiat: number;
8
+ amount: number;
9
+ }
10
+ export declare class TransactionsServiceClient {
11
+ client: AxiosInstance;
12
+ constructor();
13
+ createPaymentInvoice(network: string, amount: number): Promise<UtxoInvoice>;
14
+ }
15
+ export {};
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TransactionsServiceClient = void 0;
4
+ const config_1 = require("./config");
5
+ const serviceClient_1 = require("./serviceClient");
6
+ class TransactionsServiceClient {
7
+ constructor() {
8
+ this.client = (0, serviceClient_1.createServiceClient)({
9
+ baseURL: config_1.config.transactionsServiceEndpoint,
10
+ });
11
+ }
12
+ async createPaymentInvoice(network, amount) {
13
+ return this.client
14
+ .post(`/invoices`, {
15
+ network,
16
+ amount,
17
+ })
18
+ .then((res) => res.data);
19
+ }
20
+ }
21
+ exports.TransactionsServiceClient = TransactionsServiceClient;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const transactionsServiceClient_1 = require("./transactionsServiceClient");
4
+ describe('TransactionsServiceClient', () => {
5
+ const client = new transactionsServiceClient_1.TransactionsServiceClient();
6
+ it('should work', async () => {
7
+ const data = await client.createPaymentInvoice('bitcoin-testnet', 100);
8
+ console.log(data);
9
+ });
10
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spritz-finance/service-client",
3
- "version": "0.1.9",
3
+ "version": "0.2.0",
4
4
  "description": "Service client",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",