@spritz-finance/service-client 0.2.67 → 0.2.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/lib/config.d.ts +1 -0
- package/lib/config.js +4 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/liabilitiesServiceClient.d.ts +13 -0
- package/lib/liabilitiesServiceClient.js +11 -1
- package/lib/web3ServiceClient.d.ts +19 -0
- package/lib/web3ServiceClient.js +18 -0
- package/package.json +1 -1
package/lib/config.d.ts
CHANGED
package/lib/config.js
CHANGED
|
@@ -15,6 +15,7 @@ const envConfigs = {
|
|
|
15
15
|
payableAccountsServiceEndpoint: 'https://api-dev.spritz.finance/payable-accounts',
|
|
16
16
|
growthServiceEndpoint: 'https://api-dev.spritz.finance/growth',
|
|
17
17
|
exchangeRatesServiceEndpoint: 'https://api-dev.spritz.finance/exchange-rates',
|
|
18
|
+
web3ServiceEndpoint: 'https://api-dev.spritz.finance/web3',
|
|
18
19
|
},
|
|
19
20
|
test: {
|
|
20
21
|
env: 'staging',
|
|
@@ -27,6 +28,7 @@ const envConfigs = {
|
|
|
27
28
|
payableAccountsServiceEndpoint: 'https://api-staging.spritz.finance/payable-accounts',
|
|
28
29
|
growthServiceEndpoint: 'https://api-staging.spritz.finance/growth',
|
|
29
30
|
exchangeRatesServiceEndpoint: 'https://api-staging.spritz.finance/exchange-rates',
|
|
31
|
+
web3ServiceEndpoint: 'https://api-staging.spritz.finance/web3',
|
|
30
32
|
},
|
|
31
33
|
staging: {
|
|
32
34
|
authEndpoint: 'https://auth-staging.spritz.finance/oauth2/token',
|
|
@@ -38,6 +40,7 @@ const envConfigs = {
|
|
|
38
40
|
payableAccountsServiceEndpoint: 'https://api-staging.spritz.finance/payable-accounts',
|
|
39
41
|
growthServiceEndpoint: 'https://api-staging.spritz.finance/growth',
|
|
40
42
|
exchangeRatesServiceEndpoint: 'https://api-staging.spritz.finance/exchange-rates',
|
|
43
|
+
web3ServiceEndpoint: 'https://api-staging.spritz.finance/web3',
|
|
41
44
|
},
|
|
42
45
|
production: {
|
|
43
46
|
authEndpoint: 'https://auth.spritz.finance/oauth2/token',
|
|
@@ -49,6 +52,7 @@ const envConfigs = {
|
|
|
49
52
|
payableAccountsServiceEndpoint: 'https://api.spritz.finance/payable-accounts',
|
|
50
53
|
growthServiceEndpoint: 'https://api.spritz.finance/growth',
|
|
51
54
|
exchangeRatesServiceEndpoint: 'https://api.spritz.finance/exchange-rates',
|
|
55
|
+
web3ServiceEndpoint: 'https://api.spritz.finance/web3',
|
|
52
56
|
},
|
|
53
57
|
};
|
|
54
58
|
exports.config = (0, config_1.setupEnvConfig)(envConfigs);
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -24,3 +24,4 @@ __exportStar(require("./growthServiceClient"), exports);
|
|
|
24
24
|
__exportStar(require("./liabilitiesServiceClient"), exports);
|
|
25
25
|
__exportStar(require("./payableAccountsServiceClient"), exports);
|
|
26
26
|
__exportStar(require("./exchangeRatesServiceClient"), exports);
|
|
27
|
+
__exportStar(require("./web3ServiceClient"), exports);
|
|
@@ -189,6 +189,17 @@ export declare enum PaymentSource {
|
|
|
189
189
|
PaymentAddress = "PaymentAddress",
|
|
190
190
|
Subscription = "Subscription"
|
|
191
191
|
}
|
|
192
|
+
type GetUsersTransactionVolumeBody = {
|
|
193
|
+
userIds: string[];
|
|
194
|
+
monthsBack?: number;
|
|
195
|
+
paymentDateThreshold?: string;
|
|
196
|
+
};
|
|
197
|
+
type GetUserRewardFeeAmountBody = {
|
|
198
|
+
userId: string;
|
|
199
|
+
monthsBack?: number;
|
|
200
|
+
excludeDaysSinceUserCreated?: number;
|
|
201
|
+
paymentDateThreshold?: string;
|
|
202
|
+
};
|
|
192
203
|
export interface CreateDirectPaymentArgs extends CreateDirectPaymentInput {
|
|
193
204
|
userId: string;
|
|
194
205
|
noFees?: boolean;
|
|
@@ -210,5 +221,7 @@ export declare class LiabilitiesServiceClient {
|
|
|
210
221
|
createDirectPayment(args: CreateDirectPaymentArgs): Promise<DirectPayment>;
|
|
211
222
|
validateDirectPayment(args: CreateDirectPaymentArgs): Promise<DirectPayment>;
|
|
212
223
|
getValidPaymentsForAccount(accountId: string): Promise<Payment[]>;
|
|
224
|
+
getRewardTransactionVolume(args: GetUsersTransactionVolumeBody): Promise<number>;
|
|
225
|
+
getRewardFeeAmount(args: GetUserRewardFeeAmountBody): Promise<number>;
|
|
213
226
|
}
|
|
214
227
|
export {};
|
|
@@ -97,7 +97,7 @@ class LiabilitiesServiceClient {
|
|
|
97
97
|
}
|
|
98
98
|
async validateDirectPayment(args) {
|
|
99
99
|
return this.client
|
|
100
|
-
.post(
|
|
100
|
+
.post('/direct-payments', {
|
|
101
101
|
...args,
|
|
102
102
|
validateOnly: true,
|
|
103
103
|
})
|
|
@@ -108,5 +108,15 @@ class LiabilitiesServiceClient {
|
|
|
108
108
|
.get(`/payments/valid-payments/account/${accountId}`)
|
|
109
109
|
.then((res) => res.data);
|
|
110
110
|
}
|
|
111
|
+
async getRewardTransactionVolume(args) {
|
|
112
|
+
return this.client
|
|
113
|
+
.post('/payments/rewards/volume', args)
|
|
114
|
+
.then((res) => res.data);
|
|
115
|
+
}
|
|
116
|
+
async getRewardFeeAmount(args) {
|
|
117
|
+
return this.client
|
|
118
|
+
.post('/payments/rewards/fees', args)
|
|
119
|
+
.then((res) => res.data);
|
|
120
|
+
}
|
|
111
121
|
}
|
|
112
122
|
exports.LiabilitiesServiceClient = LiabilitiesServiceClient;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { AxiosInstance } from 'axios';
|
|
2
|
+
type ExactInQuoteInput = {
|
|
3
|
+
token: string;
|
|
4
|
+
inputAmount: string;
|
|
5
|
+
address: string;
|
|
6
|
+
network: string;
|
|
7
|
+
};
|
|
8
|
+
type ExactInQuoteResponse = {
|
|
9
|
+
sourceTokenAmount: string;
|
|
10
|
+
paymentTokenAmountMin: string;
|
|
11
|
+
deadline: number;
|
|
12
|
+
swapData: string;
|
|
13
|
+
};
|
|
14
|
+
export declare class Web3ServiceClient {
|
|
15
|
+
client: AxiosInstance;
|
|
16
|
+
constructor();
|
|
17
|
+
getExactInQuote(input: ExactInQuoteInput): Promise<ExactInQuoteResponse>;
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Web3ServiceClient = void 0;
|
|
4
|
+
const config_1 = require("./config");
|
|
5
|
+
const serviceClient_1 = require("./serviceClient");
|
|
6
|
+
class Web3ServiceClient {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.client = (0, serviceClient_1.createServiceClient)({
|
|
9
|
+
baseURL: config_1.config.web3ServiceEndpoint,
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
async getExactInQuote(input) {
|
|
13
|
+
return this.client
|
|
14
|
+
.post(`/quote/swap/exactIn`, input)
|
|
15
|
+
.then((res) => res.data);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.Web3ServiceClient = Web3ServiceClient;
|