@spritz-finance/service-client 0.36.0 → 0.38.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/README.md +2 -3
- package/lib/graphTypes.d.ts +1 -0
- package/lib/liabilities/liabilitiesServiceClient.d.ts +14 -1
- package/lib/liabilities/liabilitiesServiceClient.js +37 -0
- package/lib/liabilities/types.d.ts +122 -0
- package/lib/payableAccounts/types.d.ts +3 -1
- package/lib/payableAccounts/types.js +3 -0
- package/lib/paymentAddress/paymentAddressServiceClient.js +4 -2
- package/lib/payouts/payoutsServiceClient.js +1 -1
- package/lib/rain/rainServiceClient.js +9 -7
- package/lib/transactions/transactionsServiceClient.js +22 -12
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -19,9 +19,8 @@ Each namespace opts in independently, including namespaces that share a backend.
|
|
|
19
19
|
`/v2/<svc>/api` gateway prefix are signed and sent to the IAM twin (the prefix
|
|
20
20
|
is stripped to `/api/...`). Calls to legacy v1 REST routes in the same
|
|
21
21
|
namespace stay on the gateway with the `service_` token — so mixed modules
|
|
22
|
-
migrate route by route, and v1-only namespaces (
|
|
23
|
-
|
|
24
|
-
`/api` equivalents.
|
|
22
|
+
migrate route by route, and v1-only namespaces (unblock, verification's v1
|
|
23
|
+
paths, ...) are unaffected until their callers move to the `/api` equivalents.
|
|
25
24
|
Set these variables to the corresponding service's IAM Function URL:
|
|
26
25
|
|
|
27
26
|
| Client | Environment variable |
|
package/lib/graphTypes.d.ts
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
export * as LiabilitiesClient from "./liabilitiesServiceClient";
|
|
2
2
|
import { CheckbookUser } from "../lib/graphClient/generated";
|
|
3
3
|
import { ExternalBillInput } from "../payableAccounts/types";
|
|
4
|
-
import {
|
|
4
|
+
import { ApiResponse } from "../types";
|
|
5
|
+
import { CheckbookCardResponse, CheckbookDebitCardResponse, CheckbookDigitalAccountResponse, CheckbookUpdateCardResponse, CreateCheckbookUserParams, CreateDebitCardInput, CreateDigitalAccountInput, CreateEntityParams, CreateTokenizedDebitCardInput, DirectPaymentResponse, IssueRefundCreditInput, IssueRefundCreditResult, MethodFiEntity, RewardTransaction, TokenizedDebitCardResponse, CreditsBalance, PaymentDetails, DirectPaymentDetails, PaymentHistoryOptions, PaymentHistoryPage } from "./types";
|
|
6
|
+
/** Returns the envelope, including INVALID_INPUT and upstream service errors. */
|
|
7
|
+
export declare function getCreditsBalance(userId: string): Promise<ApiResponse<CreditsBalance>>;
|
|
8
|
+
/** Missing payments succeed with null; DATABASE_ERROR/SERVICE_CLIENT_ERROR remain failures. */
|
|
9
|
+
export declare function getPaymentDetails(paymentId: string): Promise<ApiResponse<PaymentDetails | null>>;
|
|
10
|
+
/** Looks up Payment.externalPaymentId, which may differ from externalPayment.id. */
|
|
11
|
+
export declare function getPaymentDetailsByExternalId(externalPaymentId: string): Promise<ApiResponse<PaymentDetails | null>>;
|
|
12
|
+
export declare function getDirectPaymentDetails(directPaymentId: string): Promise<ApiResponse<DirectPaymentDetails | null>>;
|
|
13
|
+
/**
|
|
14
|
+
* All statuses and sources. Keep sort unchanged while following nextCursor;
|
|
15
|
+
* no nextCursor means the final page. The server defaults to 20 rows, descending.
|
|
16
|
+
*/
|
|
17
|
+
export declare function getUserPaymentHistory(userId: string, options?: PaymentHistoryOptions): Promise<ApiResponse<PaymentHistoryPage>>;
|
|
5
18
|
/**
|
|
6
19
|
* The bare transaction, as the legacy `/reward-transactions/:id` route returned
|
|
7
20
|
* it. That route answered a missing transaction with a 404, so throw on a
|
|
@@ -34,6 +34,11 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.LiabilitiesClient = void 0;
|
|
37
|
+
exports.getCreditsBalance = getCreditsBalance;
|
|
38
|
+
exports.getPaymentDetails = getPaymentDetails;
|
|
39
|
+
exports.getPaymentDetailsByExternalId = getPaymentDetailsByExternalId;
|
|
40
|
+
exports.getDirectPaymentDetails = getDirectPaymentDetails;
|
|
41
|
+
exports.getUserPaymentHistory = getUserPaymentHistory;
|
|
37
42
|
exports.getRewardTransaction = getRewardTransaction;
|
|
38
43
|
exports.createMethodFiEntity = createMethodFiEntity;
|
|
39
44
|
exports.getMethodFiEntity = getMethodFiEntity;
|
|
@@ -58,6 +63,38 @@ const restClient_1 = require("../restClient");
|
|
|
58
63
|
const baseClient = (0, restClient_1.getRestClient)(process.env.LIABILITIES_SERVICE_API_IAM_URL, "/v2/liabilities/api");
|
|
59
64
|
const LIABILITIES_ENDPOINT = "/liabilities";
|
|
60
65
|
const LIABILITIES_V2_ENDPOINT = "/v2/liabilities/api";
|
|
66
|
+
/** Returns the envelope, including INVALID_INPUT and upstream service errors. */
|
|
67
|
+
async function getCreditsBalance(userId) {
|
|
68
|
+
return baseClient
|
|
69
|
+
.get(`${LIABILITIES_V2_ENDPOINT}/rewards/users/${encodeURIComponent(userId)}/credits/balance`)
|
|
70
|
+
.then((res) => res.data);
|
|
71
|
+
}
|
|
72
|
+
/** Missing payments succeed with null; DATABASE_ERROR/SERVICE_CLIENT_ERROR remain failures. */
|
|
73
|
+
async function getPaymentDetails(paymentId) {
|
|
74
|
+
return baseClient
|
|
75
|
+
.get(`${LIABILITIES_V2_ENDPOINT}/payments/${encodeURIComponent(paymentId)}/details`)
|
|
76
|
+
.then((res) => res.data);
|
|
77
|
+
}
|
|
78
|
+
/** Looks up Payment.externalPaymentId, which may differ from externalPayment.id. */
|
|
79
|
+
async function getPaymentDetailsByExternalId(externalPaymentId) {
|
|
80
|
+
return baseClient
|
|
81
|
+
.get(`${LIABILITIES_V2_ENDPOINT}/payments/external/${encodeURIComponent(externalPaymentId)}/details`)
|
|
82
|
+
.then((res) => res.data);
|
|
83
|
+
}
|
|
84
|
+
async function getDirectPaymentDetails(directPaymentId) {
|
|
85
|
+
return baseClient
|
|
86
|
+
.get(`${LIABILITIES_V2_ENDPOINT}/direct-payment/${encodeURIComponent(directPaymentId)}/details`)
|
|
87
|
+
.then((res) => res.data);
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* All statuses and sources. Keep sort unchanged while following nextCursor;
|
|
91
|
+
* no nextCursor means the final page. The server defaults to 20 rows, descending.
|
|
92
|
+
*/
|
|
93
|
+
async function getUserPaymentHistory(userId, options = {}) {
|
|
94
|
+
return baseClient
|
|
95
|
+
.get(`${LIABILITIES_V2_ENDPOINT}/payments/users/${encodeURIComponent(userId)}/history`, { params: options })
|
|
96
|
+
.then((res) => res.data);
|
|
97
|
+
}
|
|
61
98
|
/**
|
|
62
99
|
* The bare transaction, as the legacy `/reward-transactions/:id` route returned
|
|
63
100
|
* it. That route answered a missing transaction with a 404, so throw on a
|
|
@@ -1,4 +1,126 @@
|
|
|
1
1
|
import { DigitalAccountType } from "../lib/graphClient/generated";
|
|
2
|
+
import type { PayableAccountType, PaymentDeliveryMethod, PaymentStatus } from "../graphTypes";
|
|
3
|
+
import type { PaymentAsset } from "../payments/types";
|
|
4
|
+
/** JSON contracts for liabilities' enriched reads; dates are ISO 8601 UTC strings. */
|
|
5
|
+
export type CreditsBalance = {
|
|
6
|
+
balance: number;
|
|
7
|
+
};
|
|
8
|
+
export type PaymentHistoryOptions = {
|
|
9
|
+
/** Integer from 1 to 100; defaults to 20. */
|
|
10
|
+
limit?: number;
|
|
11
|
+
/** Opaque cursor returned by the previous page. */
|
|
12
|
+
cursor?: string;
|
|
13
|
+
/** Defaults to desc. Keep the direction unchanged between pages. */
|
|
14
|
+
sort?: "asc" | "desc";
|
|
15
|
+
};
|
|
16
|
+
export type PaymentHistoryPage = {
|
|
17
|
+
data: PaymentSummary[];
|
|
18
|
+
nextCursor?: string;
|
|
19
|
+
};
|
|
20
|
+
export type PaymentSummary = {
|
|
21
|
+
id: string;
|
|
22
|
+
userId: string;
|
|
23
|
+
accountId: string;
|
|
24
|
+
directPaymentId: string | null;
|
|
25
|
+
status: `${PaymentStatus}`;
|
|
26
|
+
deliveryDate: string | null;
|
|
27
|
+
/** USD, as are rewardsAmount and feeAmount. */
|
|
28
|
+
amount: number | null;
|
|
29
|
+
rewardsAmount: number | null;
|
|
30
|
+
feeAmount: number | null;
|
|
31
|
+
createdAt: string;
|
|
32
|
+
subscriptionId: string | null;
|
|
33
|
+
targetCurrency: string;
|
|
34
|
+
targetCurrencyAmount: number;
|
|
35
|
+
targetCurrencyRate: number;
|
|
36
|
+
deliveryMethod: `${PaymentDeliveryMethod}`;
|
|
37
|
+
};
|
|
38
|
+
export type PaymentUserDetails = {
|
|
39
|
+
id: string;
|
|
40
|
+
firstName: string | null;
|
|
41
|
+
lastName: string | null;
|
|
42
|
+
email: string | null;
|
|
43
|
+
timezone: string | null;
|
|
44
|
+
membership: string | null;
|
|
45
|
+
attributionSource: string | null;
|
|
46
|
+
};
|
|
47
|
+
export type PaymentAccountDetails = {
|
|
48
|
+
id: string;
|
|
49
|
+
__typename: `${PayableAccountType}`;
|
|
50
|
+
type: `${PayableAccountType}`;
|
|
51
|
+
name: string;
|
|
52
|
+
mask: string | null;
|
|
53
|
+
externalId: string | null;
|
|
54
|
+
country: string;
|
|
55
|
+
currency: string;
|
|
56
|
+
provider: string;
|
|
57
|
+
institution: {
|
|
58
|
+
name: string;
|
|
59
|
+
} | null;
|
|
60
|
+
billType: string | null;
|
|
61
|
+
bankAccountType: string | null;
|
|
62
|
+
bankAccountSubType: string | null;
|
|
63
|
+
ownedByUser: boolean | null;
|
|
64
|
+
balance: number | null;
|
|
65
|
+
};
|
|
66
|
+
export type PaymentTransactionDetails = {
|
|
67
|
+
link: string;
|
|
68
|
+
network: string;
|
|
69
|
+
to: string | null;
|
|
70
|
+
/** Display units, not raw token units. */
|
|
71
|
+
sourceToken: {
|
|
72
|
+
symbol: string;
|
|
73
|
+
amount: number;
|
|
74
|
+
} | null;
|
|
75
|
+
};
|
|
76
|
+
export type PaymentInvoiceDetails = {
|
|
77
|
+
network: string;
|
|
78
|
+
address: string;
|
|
79
|
+
amountFiat: number | null;
|
|
80
|
+
amountFiatAdjusted: number | null;
|
|
81
|
+
amount: number | null;
|
|
82
|
+
transaction: {
|
|
83
|
+
amount: number;
|
|
84
|
+
transactionId: string;
|
|
85
|
+
} | null;
|
|
86
|
+
};
|
|
87
|
+
export type DirectPaymentLink = {
|
|
88
|
+
id: string;
|
|
89
|
+
transaction: PaymentTransactionDetails | null;
|
|
90
|
+
invoice: PaymentInvoiceDetails | null;
|
|
91
|
+
};
|
|
92
|
+
export type DirectPaymentDetails = DirectPaymentLink & {
|
|
93
|
+
user: PaymentUserDetails | null;
|
|
94
|
+
payableAccount: PaymentAccountDetails | null;
|
|
95
|
+
};
|
|
96
|
+
export type LiabilitiesPaymentProvider = "METHOD_FI" | "CHECKBOOK" | "MODERN_TREASURY" | "UNBLOCK" | "BRIDGE" | "RAIN" | "TABAPAY";
|
|
97
|
+
export type LiabilitiesPaymentSource = "Web" | "Mobile" | "MobileIOS" | "MobileAndroid" | "ExodusDappBrowser" | "SuiWalletDappBrowser" | "Integrator" | "Widget" | "PaymentAddress" | "Subscription" | "External" | "Admin" | "Refund";
|
|
98
|
+
export type PaymentDetails = PaymentSummary & {
|
|
99
|
+
externalPaymentId: string | null;
|
|
100
|
+
feeSubsidyAmount: number | null;
|
|
101
|
+
partnerFee: number;
|
|
102
|
+
paymentProvider: LiabilitiesPaymentProvider;
|
|
103
|
+
source: LiabilitiesPaymentSource;
|
|
104
|
+
paymentAsset: PaymentAsset | null;
|
|
105
|
+
outputAsset: PaymentAsset | null;
|
|
106
|
+
user: PaymentUserDetails | null;
|
|
107
|
+
payableAccount: PaymentAccountDetails | null;
|
|
108
|
+
externalPayment: {
|
|
109
|
+
id: string;
|
|
110
|
+
amount: number;
|
|
111
|
+
estimatedCompletionDate: string | null;
|
|
112
|
+
completionDate: string | null;
|
|
113
|
+
paymentProvider: LiabilitiesPaymentProvider;
|
|
114
|
+
createdAt: string;
|
|
115
|
+
} | null;
|
|
116
|
+
transaction: PaymentTransactionDetails | null;
|
|
117
|
+
directPayment: DirectPaymentLink | null;
|
|
118
|
+
refund: {
|
|
119
|
+
hash: string | null;
|
|
120
|
+
amount: number | null;
|
|
121
|
+
to: string | null;
|
|
122
|
+
} | null;
|
|
123
|
+
};
|
|
2
124
|
export declare enum RewardProvider {
|
|
3
125
|
INTERNAL = "INTERNAL",
|
|
4
126
|
REFERRAL_ROCK = "REFERRAL_ROCK",
|
|
@@ -149,7 +149,9 @@ export type PayableAccountInstitution = GraphInstitution & {
|
|
|
149
149
|
};
|
|
150
150
|
export declare enum VirtualCardType {
|
|
151
151
|
USVirtualDebitCard = "USVirtualDebitCard",
|
|
152
|
-
USPhysicalDebitCard = "USPhysicalDebitCard"
|
|
152
|
+
USPhysicalDebitCard = "USPhysicalDebitCard",
|
|
153
|
+
UsVirtualDebitCard = "USVirtualDebitCard",
|
|
154
|
+
UsPhysicalDebitCard = "USPhysicalDebitCard"
|
|
153
155
|
}
|
|
154
156
|
export declare enum VirtualCardStatus {
|
|
155
157
|
Active = "Active",
|
|
@@ -20,6 +20,9 @@ var VirtualCardType;
|
|
|
20
20
|
(function (VirtualCardType) {
|
|
21
21
|
VirtualCardType["USVirtualDebitCard"] = "USVirtualDebitCard";
|
|
22
22
|
VirtualCardType["USPhysicalDebitCard"] = "USPhysicalDebitCard";
|
|
23
|
+
// Preserve generated GraphQL member names for consumers moving to top-level imports.
|
|
24
|
+
VirtualCardType["UsVirtualDebitCard"] = "USVirtualDebitCard";
|
|
25
|
+
VirtualCardType["UsPhysicalDebitCard"] = "USPhysicalDebitCard";
|
|
23
26
|
})(VirtualCardType || (exports.VirtualCardType = VirtualCardType = {}));
|
|
24
27
|
var VirtualCardStatus;
|
|
25
28
|
(function (VirtualCardStatus) {
|
|
@@ -38,9 +38,11 @@ exports.initializePaymentAddresses = initializePaymentAddresses;
|
|
|
38
38
|
exports.PaymentAddressClient = __importStar(require("./paymentAddressServiceClient"));
|
|
39
39
|
const restClient_1 = require("../restClient");
|
|
40
40
|
const baseClient = (0, restClient_1.getRestClient)(process.env.PAYMENT_ADDRESS_SERVICE_API_IAM_URL, "/payment-addresses-v2/api");
|
|
41
|
-
|
|
41
|
+
// Payment-addresses' Hono ServiceApi, reached through the gateway's
|
|
42
|
+
// /payment-addresses-v2 base path.
|
|
43
|
+
const PAYMENT_ADDRESSES_API_ENDPOINT = "/payment-addresses-v2/api";
|
|
42
44
|
async function initializePaymentAddresses(body) {
|
|
43
45
|
return baseClient
|
|
44
|
-
.post(`${
|
|
46
|
+
.post(`${PAYMENT_ADDRESSES_API_ENDPOINT}/payment-addresses/initialize`, body)
|
|
45
47
|
.then((res) => res.data);
|
|
46
48
|
}
|
|
@@ -65,7 +65,7 @@ async function requestCryptoPayout({ userId, type, network, amountFiat, referenc
|
|
|
65
65
|
}
|
|
66
66
|
async function getPayoutFromHash({ userId, transactionHash, }) {
|
|
67
67
|
return baseClient
|
|
68
|
-
.post(`${
|
|
68
|
+
.post(`${PAYOUTS_API_ENDPOINT}/payouts/hash`, {
|
|
69
69
|
userId,
|
|
70
70
|
transactionHash,
|
|
71
71
|
})
|
|
@@ -57,9 +57,11 @@ const RAIN_ENDPOINT = "/rain-v2";
|
|
|
57
57
|
// user saw an error for an application that succeeded. Stay under the 30s
|
|
58
58
|
// Lambda timeout on both sides.
|
|
59
59
|
exports.CREATE_CARD_APPLICATION_TIMEOUT_MS = 28000;
|
|
60
|
+
// `/api/applications` takes the userId in the body, where the legacy
|
|
61
|
+
// `/application?userId=` route read it from the query; the argument still wins.
|
|
60
62
|
async function createCardApplication(userId, input) {
|
|
61
63
|
return baseClient
|
|
62
|
-
.post(`${RAIN_ENDPOINT}/
|
|
64
|
+
.post(`${RAIN_ENDPOINT}/api/applications`, { ...input, userId }, {
|
|
63
65
|
timeout: exports.CREATE_CARD_APPLICATION_TIMEOUT_MS,
|
|
64
66
|
// Opt out of the shared 502 retry: a 502 can arrive after Rain already
|
|
65
67
|
// created the application, a repeat create fails, and a second 28s
|
|
@@ -75,12 +77,12 @@ async function getUserDepositAddress({ userId, network, }) {
|
|
|
75
77
|
}
|
|
76
78
|
async function validateContractAddress(input) {
|
|
77
79
|
return baseClient
|
|
78
|
-
.post(`${RAIN_ENDPOINT}/
|
|
80
|
+
.post(`${RAIN_ENDPOINT}/api/contracts/validations`, input)
|
|
79
81
|
.then((res) => res.data);
|
|
80
82
|
}
|
|
81
83
|
async function createRainCard({ userId, nickname, type, shipping, }) {
|
|
82
84
|
return baseClient
|
|
83
|
-
.post(`${RAIN_ENDPOINT}/
|
|
85
|
+
.post(`${RAIN_ENDPOINT}/api/cards`, {
|
|
84
86
|
userId,
|
|
85
87
|
nickname,
|
|
86
88
|
type,
|
|
@@ -98,10 +100,10 @@ async function updateCardStatus({ userId, status, cardExternalId, }) {
|
|
|
98
100
|
.then((res) => res.data);
|
|
99
101
|
}
|
|
100
102
|
async function activatePhysicalCard({ userId, accountId, expirationMonth, expirationYear, }) {
|
|
103
|
+
// The card's accountId moves from the legacy `/card/activate` body into the path.
|
|
101
104
|
return baseClient
|
|
102
|
-
.post(`${RAIN_ENDPOINT}/
|
|
105
|
+
.post(`${RAIN_ENDPOINT}/api/cards/${accountId}/activations`, {
|
|
103
106
|
userId,
|
|
104
|
-
accountId,
|
|
105
107
|
expirationMonth,
|
|
106
108
|
expirationYear,
|
|
107
109
|
})
|
|
@@ -130,12 +132,12 @@ async function requestWithdrawalSignature({ userId, network, amount, }) {
|
|
|
130
132
|
}
|
|
131
133
|
async function adminGetUserInfo({ userId }) {
|
|
132
134
|
return baseClient
|
|
133
|
-
.get(`${RAIN_ENDPOINT}/admin/
|
|
135
|
+
.get(`${RAIN_ENDPOINT}/api/admin/users/${userId}`)
|
|
134
136
|
.then((res) => res.data);
|
|
135
137
|
}
|
|
136
138
|
async function orderPhysicalCard(input) {
|
|
137
139
|
return baseClient
|
|
138
|
-
.post(`${RAIN_ENDPOINT}/
|
|
140
|
+
.post(`${RAIN_ENDPOINT}/api/cards/orders`, input)
|
|
139
141
|
.then((res) => res.data);
|
|
140
142
|
}
|
|
141
143
|
async function getPendingCardOrder(userId) {
|
|
@@ -42,11 +42,27 @@ exports.getOutstandingUserTransactions = getOutstandingUserTransactions;
|
|
|
42
42
|
exports.updateUserTransactionStatus = updateUserTransactionStatus;
|
|
43
43
|
exports.TransactionsClient = __importStar(require("./transactionsServiceClient"));
|
|
44
44
|
const restClient_1 = require("../restClient");
|
|
45
|
-
const baseClient = (0, restClient_1.getRestClient)(process.env.TRANSACTIONS_SERVICE_API_IAM_URL);
|
|
45
|
+
const baseClient = (0, restClient_1.getRestClient)(process.env.TRANSACTIONS_SERVICE_API_IAM_URL, "/v2/transactions/api");
|
|
46
46
|
const TRANSACTIONS_ENDPOINT = "/transactions";
|
|
47
|
+
// Transactions' Hono ServiceApi, reached through the gateway's /v2/transactions
|
|
48
|
+
// base path (the bare /transactions base path maps to the legacy REST routes).
|
|
49
|
+
const TRANSACTIONS_API_ENDPOINT = "/v2/transactions/api";
|
|
50
|
+
/**
|
|
51
|
+
* Awaits an `/api` request and returns the bare body its legacy route answered
|
|
52
|
+
* with. The `/api` routes answer every failure as a 200 failure envelope;
|
|
53
|
+
* throw on it, as the legacy route's non-2xx did.
|
|
54
|
+
*/
|
|
55
|
+
async function legacyBareBody(request, failureMessage) {
|
|
56
|
+
var _a, _b;
|
|
57
|
+
const body = (await request).data;
|
|
58
|
+
if (body.status === "failure") {
|
|
59
|
+
throw new Error((_b = (_a = body.error) === null || _a === void 0 ? void 0 : _a.message) !== null && _b !== void 0 ? _b : failureMessage);
|
|
60
|
+
}
|
|
61
|
+
return body.data;
|
|
62
|
+
}
|
|
47
63
|
async function createPaymentInvoice(network, amount, paymentReference, tokenAddress, userId) {
|
|
48
64
|
return baseClient
|
|
49
|
-
.post(`${
|
|
65
|
+
.post(`${TRANSACTIONS_API_ENDPOINT}/invoices`, {
|
|
50
66
|
network,
|
|
51
67
|
amount,
|
|
52
68
|
paymentReference,
|
|
@@ -57,7 +73,7 @@ async function createPaymentInvoice(network, amount, paymentReference, tokenAddr
|
|
|
57
73
|
}
|
|
58
74
|
async function getAssetPriceBySymbol(symbol) {
|
|
59
75
|
return baseClient
|
|
60
|
-
.get(`${
|
|
76
|
+
.get(`${TRANSACTIONS_API_ENDPOINT}/asset-price/${symbol}`)
|
|
61
77
|
.then((res) => res.data);
|
|
62
78
|
}
|
|
63
79
|
async function reserveAddress(network, accountId) {
|
|
@@ -69,17 +85,11 @@ async function reserveAddress(network, accountId) {
|
|
|
69
85
|
.then((res) => res.data);
|
|
70
86
|
}
|
|
71
87
|
async function getWalletMembership(address) {
|
|
72
|
-
return baseClient
|
|
73
|
-
.get(`${TRANSACTIONS_ENDPOINT}/addresses/${address}/membership`)
|
|
74
|
-
.then((res) => res.data);
|
|
88
|
+
return legacyBareBody(baseClient.get(`${TRANSACTIONS_API_ENDPOINT}/addresses/${address}/membership`), "Failed to get wallet membership");
|
|
75
89
|
}
|
|
76
90
|
async function getOutstandingUserTransactions(userId, accountId) {
|
|
77
|
-
return baseClient
|
|
78
|
-
.get(`${TRANSACTIONS_ENDPOINT}/wallet-transactions/outstanding/${userId}/account/${accountId}`)
|
|
79
|
-
.then((res) => res.data);
|
|
91
|
+
return legacyBareBody(baseClient.get(`${TRANSACTIONS_API_ENDPOINT}/wallet-transactions/outstanding/${userId}/account/${accountId}`), "Failed to get outstanding user transactions");
|
|
80
92
|
}
|
|
81
93
|
async function updateUserTransactionStatus(input) {
|
|
82
|
-
return baseClient
|
|
83
|
-
.post(`${TRANSACTIONS_ENDPOINT}/wallet-transactions/user`, input)
|
|
84
|
-
.then((res) => res.data);
|
|
94
|
+
return legacyBareBody(baseClient.post(`${TRANSACTIONS_API_ENDPOINT}/wallet-transactions/user`, input), "Failed to update user transaction status");
|
|
85
95
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spritz-finance/service-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.38.0",
|
|
4
4
|
"gitHead": "06f8e96b7b38c34df26a38da329331940675e4f8",
|
|
5
5
|
"description": "Service client",
|
|
6
6
|
"license": "ISC",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"scripts": {
|
|
14
14
|
"prebuild": "rm -rf lib",
|
|
15
15
|
"test": "vitest run",
|
|
16
|
+
"typecheck": "tsc --project tsconfig.test.json",
|
|
16
17
|
"test:watch": "vitest",
|
|
17
18
|
"test:coverage": "vitest run --coverage",
|
|
18
19
|
"build": "tsc",
|