@moonpay/platform-sdk-core 1.4.2 → 1.6.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 CHANGED
@@ -31,6 +31,7 @@ __export(src_exports, {
31
31
  decryptCredentials: () => decryptCredentials,
32
32
  deletePaymentMethod: () => deletePaymentMethod,
33
33
  generateKeyPair: () => generateKeyPair,
34
+ getAssets: () => getAssets,
34
35
  getIdentity: () => getIdentity,
35
36
  getIdentityUploadUrl: () => getIdentityUploadUrl,
36
37
  getPaymentMethods: () => getPaymentMethods,
@@ -107,6 +108,22 @@ async function apiFetch(ctx, path, options) {
107
108
  return (0, import_result.ok)(data);
108
109
  }
109
110
 
111
+ // src/api/get-assets.ts
112
+ async function getAssets(ctx, params = {}) {
113
+ const searchParams = new URLSearchParams();
114
+ if (params.source)
115
+ searchParams.set("source", params.source);
116
+ if (params.code)
117
+ searchParams.set("code", params.code);
118
+ if (params.cursor)
119
+ searchParams.set("cursor", params.cursor);
120
+ if (params.limit != null)
121
+ searchParams.set("limit", String(params.limit));
122
+ const query = searchParams.toString();
123
+ const path = `/platform/v1/assets${query ? `?${query}` : ""}`;
124
+ return apiFetch(ctx, path);
125
+ }
126
+
110
127
  // src/api/get-quote.ts
111
128
  async function getQuote(ctx, params) {
112
129
  return apiFetch(ctx, "/platform/v1/quotes/buy", {
@@ -223,6 +240,7 @@ function createClientCore(options) {
223
240
  },
224
241
  createTransport: options.createTransport,
225
242
  getQuote: (params) => getQuote(ctx, params),
243
+ getAssets: (params) => getAssets(ctx, params),
226
244
  getPaymentMethods: () => getPaymentMethods(ctx),
227
245
  listTransactions: (params) => listTransactions(ctx, params),
228
246
  getTransaction: (id) => getTransaction(ctx, id),