@ton-pay/api 0.2.1 → 0.3.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.mjs CHANGED
@@ -6661,14 +6661,13 @@ var createTonPayTransfer = async (params, options) => {
6661
6661
 
6662
6662
  // src/create-moonpay-transfer/create-moonpay-transfer.ts
6663
6663
  var createMoonpayTransfer = async (params, options) => {
6664
- if (!options?.apiKey) {
6665
- throw new Error("API key is required for MoonPay transfers");
6666
- }
6667
- const baseUrl = getBaseUrl(options.chain);
6664
+ const baseUrl = getBaseUrl(options?.chain);
6668
6665
  const headers = {
6669
- "Content-Type": "application/json",
6670
- "x-api-key": options.apiKey
6666
+ "Content-Type": "application/json"
6671
6667
  };
6668
+ if (options?.apiKey) {
6669
+ headers["x-api-key"] = options.apiKey;
6670
+ }
6672
6671
  const response = await fetch(
6673
6672
  `${baseUrl}/api/merchant/v1/create-moonpay-transfer`,
6674
6673
  {
@@ -6694,8 +6693,7 @@ var createMoonpayTransfer = async (params, options) => {
6694
6693
  var checkMoonpayGeo = async (params, options) => {
6695
6694
  const baseUrl = getBaseUrl(options?.chain);
6696
6695
  const headers = {
6697
- "Content-Type": "application/json",
6698
- ...options?.apiKey ? { "x-api-key": options.apiKey } : {}
6696
+ "Content-Type": "application/json"
6699
6697
  };
6700
6698
  const response = await fetch(
6701
6699
  `${baseUrl}/api/external/moonpay/check-geo?ipAddress=${encodeURIComponent(params.ipAddress)}`,
@@ -6717,8 +6715,7 @@ var checkMoonpayGeo = async (params, options) => {
6717
6715
  var checkMoonpayLimits = async (params, options) => {
6718
6716
  const baseUrl = getBaseUrl(options?.chain);
6719
6717
  const headers = {
6720
- "Content-Type": "application/json",
6721
- ...options?.apiKey ? { "x-api-key": options.apiKey } : {}
6718
+ "Content-Type": "application/json"
6722
6719
  };
6723
6720
  const response = await fetch(`${baseUrl}/api/external/moonpay/limits`, {
6724
6721
  method: "POST",
@@ -6775,10 +6772,14 @@ var getTonPayTransferByBodyHash = async (bodyHash, options) => {
6775
6772
  // src/get-ton-pay-transfer/get-ton-pay-transfer-by-reference.ts
6776
6773
  var getTonPayTransferByReference = async (reference, options) => {
6777
6774
  const baseUrl = getBaseUrl(options?.chain);
6775
+ const headers = {
6776
+ ...options?.apiKey ? { "x-api-key": options.apiKey } : {}
6777
+ };
6778
6778
  const response = await fetch(
6779
6779
  `${baseUrl}/api/merchant/v1/transfer?reference=${reference}`,
6780
6780
  {
6781
- method: "GET"
6781
+ method: "GET",
6782
+ headers
6782
6783
  }
6783
6784
  );
6784
6785
  if (!response.ok) {