@moonpay/platform-sdk-core 1.4.2 → 1.5.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/dist/index.cjs +18 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -3
- package/dist/index.d.ts +14 -3
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { DevPlatformApiError, GetQuoteError, GetTransactionsError, CreateIdentityError, GetIdentityError, GetIdentityUploadUrlError, SubmitIdentityFilesError, UpdateIdentityError, VerifyIdentityError, GetPaymentMethodsError } from '@moonpay/platform-protocol/api/errors';
|
|
1
|
+
import { DevPlatformApiError, GetAssetsError, GetQuoteError, GetTransactionsError, CreateIdentityError, GetIdentityError, GetIdentityUploadUrlError, SubmitIdentityFilesError, UpdateIdentityError, VerifyIdentityError, GetPaymentMethodsError } from '@moonpay/platform-protocol/api/errors';
|
|
2
2
|
import { Result } from '@moonpay/platform-protocol/result';
|
|
3
|
-
import { GetQuoteParams, Quote, TransactionWithStages, Transaction, PaginationInfo, ListPaymentMethodsResponse } from '@moonpay/platform-protocol/api';
|
|
3
|
+
import { ListAssetsResponse, GetQuoteParams, Quote, TransactionWithStages, Transaction, PaginationInfo, ListPaymentMethodsResponse } from '@moonpay/platform-protocol/api';
|
|
4
4
|
import { CreateIdentityRequestBody, Identity, IdentityFileUploadUrlRequestBody, IdentityFileUploadUrl, SubmitIdentityFilesRequestBody, UpdateIdentityRequestBody, IdentityVerificationResponse } from '@moonpay/platform-protocol/api/identity';
|
|
5
5
|
import { ProtocolMessage } from '@moonpay/platform-protocol/protocol';
|
|
6
6
|
import { DecryptedCredentials } from '@moonpay/platform-protocol/models/connection';
|
|
@@ -22,6 +22,16 @@ declare function createClientContext(options?: ClientContextOptions): ClientCont
|
|
|
22
22
|
/** Typed fetch that wraps responses in Result<T, E>. */
|
|
23
23
|
declare function apiFetch<T>(ctx: ClientContext, path: string, options?: RequestInit): Promise<Result<T, DevPlatformApiError>>;
|
|
24
24
|
|
|
25
|
+
interface ListAssetsParams {
|
|
26
|
+
/** Filter by verification status. Omit to return both verified and unverified assets. */
|
|
27
|
+
verified?: boolean;
|
|
28
|
+
/** Filter by exact (case-insensitive) asset code. */
|
|
29
|
+
code?: string;
|
|
30
|
+
cursor?: string;
|
|
31
|
+
limit?: number;
|
|
32
|
+
}
|
|
33
|
+
declare function getAssets(ctx: ClientContext, params?: ListAssetsParams): Promise<Result<ListAssetsResponse, GetAssetsError>>;
|
|
34
|
+
|
|
25
35
|
/** The API wraps the quote in a `{ data: ... }` envelope. */
|
|
26
36
|
interface GetQuoteApiResponse {
|
|
27
37
|
data: Quote;
|
|
@@ -155,6 +165,7 @@ interface CoreClient {
|
|
|
155
165
|
getQuote(params: GetQuoteParams): Promise<Result<{
|
|
156
166
|
data: Quote;
|
|
157
167
|
}, GetQuoteError>>;
|
|
168
|
+
getAssets(params?: ListAssetsParams): Promise<Result<ListAssetsResponse, GetAssetsError>>;
|
|
158
169
|
getPaymentMethods(): Promise<Result<{
|
|
159
170
|
data: ListPaymentMethodsResponse;
|
|
160
171
|
}, GetPaymentMethodsError>>;
|
|
@@ -235,4 +246,4 @@ interface FrameHandle {
|
|
|
235
246
|
*/
|
|
236
247
|
declare function createFrameOrchestrator(options: FrameOrchestratorOptions): Promise<FrameHandle>;
|
|
237
248
|
|
|
238
|
-
export { type ClientContext, type ClientContextOptions, type CoreClient, type CoreClientOptions, FRAME_PATHS, type FrameHandle, type FrameOptions, type FrameOrchestratorOptions, type FrameTransport, type KeyPair, type ListTransactionsParams, type ThemeOptions, type UrlBuilderOptions, apiFetch, applyThemeParam, buildFrameUrl, createClientContext, createClientCore, createFrameOrchestrator, createIdentity, decryptCredentials, deletePaymentMethod, generateKeyPair, getIdentity, getIdentityUploadUrl, getPaymentMethods, getQuote, getTransaction, listTransactions, submitIdentityFiles, themeParams, updateIdentity, verifyIdentity };
|
|
249
|
+
export { type ClientContext, type ClientContextOptions, type CoreClient, type CoreClientOptions, FRAME_PATHS, type FrameHandle, type FrameOptions, type FrameOrchestratorOptions, type FrameTransport, type KeyPair, type ListAssetsParams, type ListTransactionsParams, type ThemeOptions, type UrlBuilderOptions, apiFetch, applyThemeParam, buildFrameUrl, createClientContext, createClientCore, createFrameOrchestrator, createIdentity, decryptCredentials, deletePaymentMethod, generateKeyPair, getAssets, getIdentity, getIdentityUploadUrl, getPaymentMethods, getQuote, getTransaction, listTransactions, submitIdentityFiles, themeParams, updateIdentity, verifyIdentity };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { DevPlatformApiError, GetQuoteError, GetTransactionsError, CreateIdentityError, GetIdentityError, GetIdentityUploadUrlError, SubmitIdentityFilesError, UpdateIdentityError, VerifyIdentityError, GetPaymentMethodsError } from '@moonpay/platform-protocol/api/errors';
|
|
1
|
+
import { DevPlatformApiError, GetAssetsError, GetQuoteError, GetTransactionsError, CreateIdentityError, GetIdentityError, GetIdentityUploadUrlError, SubmitIdentityFilesError, UpdateIdentityError, VerifyIdentityError, GetPaymentMethodsError } from '@moonpay/platform-protocol/api/errors';
|
|
2
2
|
import { Result } from '@moonpay/platform-protocol/result';
|
|
3
|
-
import { GetQuoteParams, Quote, TransactionWithStages, Transaction, PaginationInfo, ListPaymentMethodsResponse } from '@moonpay/platform-protocol/api';
|
|
3
|
+
import { ListAssetsResponse, GetQuoteParams, Quote, TransactionWithStages, Transaction, PaginationInfo, ListPaymentMethodsResponse } from '@moonpay/platform-protocol/api';
|
|
4
4
|
import { CreateIdentityRequestBody, Identity, IdentityFileUploadUrlRequestBody, IdentityFileUploadUrl, SubmitIdentityFilesRequestBody, UpdateIdentityRequestBody, IdentityVerificationResponse } from '@moonpay/platform-protocol/api/identity';
|
|
5
5
|
import { ProtocolMessage } from '@moonpay/platform-protocol/protocol';
|
|
6
6
|
import { DecryptedCredentials } from '@moonpay/platform-protocol/models/connection';
|
|
@@ -22,6 +22,16 @@ declare function createClientContext(options?: ClientContextOptions): ClientCont
|
|
|
22
22
|
/** Typed fetch that wraps responses in Result<T, E>. */
|
|
23
23
|
declare function apiFetch<T>(ctx: ClientContext, path: string, options?: RequestInit): Promise<Result<T, DevPlatformApiError>>;
|
|
24
24
|
|
|
25
|
+
interface ListAssetsParams {
|
|
26
|
+
/** Filter by verification status. Omit to return both verified and unverified assets. */
|
|
27
|
+
verified?: boolean;
|
|
28
|
+
/** Filter by exact (case-insensitive) asset code. */
|
|
29
|
+
code?: string;
|
|
30
|
+
cursor?: string;
|
|
31
|
+
limit?: number;
|
|
32
|
+
}
|
|
33
|
+
declare function getAssets(ctx: ClientContext, params?: ListAssetsParams): Promise<Result<ListAssetsResponse, GetAssetsError>>;
|
|
34
|
+
|
|
25
35
|
/** The API wraps the quote in a `{ data: ... }` envelope. */
|
|
26
36
|
interface GetQuoteApiResponse {
|
|
27
37
|
data: Quote;
|
|
@@ -155,6 +165,7 @@ interface CoreClient {
|
|
|
155
165
|
getQuote(params: GetQuoteParams): Promise<Result<{
|
|
156
166
|
data: Quote;
|
|
157
167
|
}, GetQuoteError>>;
|
|
168
|
+
getAssets(params?: ListAssetsParams): Promise<Result<ListAssetsResponse, GetAssetsError>>;
|
|
158
169
|
getPaymentMethods(): Promise<Result<{
|
|
159
170
|
data: ListPaymentMethodsResponse;
|
|
160
171
|
}, GetPaymentMethodsError>>;
|
|
@@ -235,4 +246,4 @@ interface FrameHandle {
|
|
|
235
246
|
*/
|
|
236
247
|
declare function createFrameOrchestrator(options: FrameOrchestratorOptions): Promise<FrameHandle>;
|
|
237
248
|
|
|
238
|
-
export { type ClientContext, type ClientContextOptions, type CoreClient, type CoreClientOptions, FRAME_PATHS, type FrameHandle, type FrameOptions, type FrameOrchestratorOptions, type FrameTransport, type KeyPair, type ListTransactionsParams, type ThemeOptions, type UrlBuilderOptions, apiFetch, applyThemeParam, buildFrameUrl, createClientContext, createClientCore, createFrameOrchestrator, createIdentity, decryptCredentials, deletePaymentMethod, generateKeyPair, getIdentity, getIdentityUploadUrl, getPaymentMethods, getQuote, getTransaction, listTransactions, submitIdentityFiles, themeParams, updateIdentity, verifyIdentity };
|
|
249
|
+
export { type ClientContext, type ClientContextOptions, type CoreClient, type CoreClientOptions, FRAME_PATHS, type FrameHandle, type FrameOptions, type FrameOrchestratorOptions, type FrameTransport, type KeyPair, type ListAssetsParams, type ListTransactionsParams, type ThemeOptions, type UrlBuilderOptions, apiFetch, applyThemeParam, buildFrameUrl, createClientContext, createClientCore, createFrameOrchestrator, createIdentity, decryptCredentials, deletePaymentMethod, generateKeyPair, getAssets, getIdentity, getIdentityUploadUrl, getPaymentMethods, getQuote, getTransaction, listTransactions, submitIdentityFiles, themeParams, updateIdentity, verifyIdentity };
|
package/dist/index.js
CHANGED
|
@@ -61,6 +61,22 @@ async function apiFetch(ctx, path, options) {
|
|
|
61
61
|
return ok(data);
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
+
// src/api/get-assets.ts
|
|
65
|
+
async function getAssets(ctx, params = {}) {
|
|
66
|
+
const searchParams = new URLSearchParams();
|
|
67
|
+
if (params.verified != null)
|
|
68
|
+
searchParams.set("verified", String(params.verified));
|
|
69
|
+
if (params.code)
|
|
70
|
+
searchParams.set("code", params.code);
|
|
71
|
+
if (params.cursor)
|
|
72
|
+
searchParams.set("cursor", params.cursor);
|
|
73
|
+
if (params.limit != null)
|
|
74
|
+
searchParams.set("limit", String(params.limit));
|
|
75
|
+
const query = searchParams.toString();
|
|
76
|
+
const path = `/platform/v1/assets${query ? `?${query}` : ""}`;
|
|
77
|
+
return apiFetch(ctx, path);
|
|
78
|
+
}
|
|
79
|
+
|
|
64
80
|
// src/api/get-quote.ts
|
|
65
81
|
async function getQuote(ctx, params) {
|
|
66
82
|
return apiFetch(ctx, "/platform/v1/quotes/buy", {
|
|
@@ -177,6 +193,7 @@ function createClientCore(options) {
|
|
|
177
193
|
},
|
|
178
194
|
createTransport: options.createTransport,
|
|
179
195
|
getQuote: (params) => getQuote(ctx, params),
|
|
196
|
+
getAssets: (params) => getAssets(ctx, params),
|
|
180
197
|
getPaymentMethods: () => getPaymentMethods(ctx),
|
|
181
198
|
listTransactions: (params) => listTransactions(ctx, params),
|
|
182
199
|
getTransaction: (id) => getTransaction(ctx, id),
|
|
@@ -1624,6 +1641,7 @@ export {
|
|
|
1624
1641
|
decryptCredentials,
|
|
1625
1642
|
deletePaymentMethod,
|
|
1626
1643
|
generateKeyPair,
|
|
1644
|
+
getAssets,
|
|
1627
1645
|
getIdentity,
|
|
1628
1646
|
getIdentityUploadUrl,
|
|
1629
1647
|
getPaymentMethods,
|