@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.d.mts CHANGED
@@ -94,6 +94,8 @@ type CreateMoonpayTransferParams = {
94
94
  recipientAddr?: string;
95
95
  userIp: string;
96
96
  redirectURL: string;
97
+ /** If true, funds go directly to recipientAddr without proxy contract or memo tag */
98
+ directTopUp?: boolean;
97
99
  };
98
100
  /**
99
101
  * @param link - MoonPay payment link
@@ -102,6 +104,7 @@ type CreateMoonpayTransferParams = {
102
104
  */
103
105
  type CreateMoonpayTransferResponse = {
104
106
  link: string;
107
+ reference: string;
105
108
  geo?: MoonpayGeoResult;
106
109
  limits: MoonpayAmountLimits;
107
110
  };
@@ -112,7 +115,7 @@ type CreateMoonpayTransferResponse = {
112
115
  * @param options - the options for the transfer (requires API key)
113
116
  * @returns the payment link, geo restrictions, and amount limits
114
117
  */
115
- declare const createMoonpayTransfer: (params: CreateMoonpayTransferParams, options: APIOptions) => Promise<CreateMoonpayTransferResponse>;
118
+ declare const createMoonpayTransfer: (params: CreateMoonpayTransferParams, options?: APIOptions) => Promise<CreateMoonpayTransferResponse>;
116
119
 
117
120
  /**
118
121
  * @param ipAddress - IP address to check for geo restrictions
@@ -317,4 +320,4 @@ declare const TON = "TON";
317
320
  */
318
321
  declare function verifySignature(payload: string | object, signature: string, apiSecret: string): boolean;
319
322
 
320
- export { type APIOptions, type Chain, type CheckMoonpayAvailabilityParams, type CheckMoonpayAvailabilityResponse, type CheckMoonpayGeoParams, type CheckMoonpayGeoResponse, type CheckMoonpayLimitsParams, type CheckMoonpayLimitsResponse, type CompletedTonPayTransferInfo, type CreateMoonpayTransferParams, type CreateMoonpayTransferResponse, type CreateTonPayTransferParams, type CreateTonPayTransferResponse, type GetTonPayTransferByBodyHashParams, type GetTonPayTransferByReferenceParams, type MoonpayAmountLimits, type MoonpayGeoResult, TON, type TransferCompletedWebhookPayload, type TransferRefundedWebhookPayload, USDT, type WebhookEventType, type WebhookPayload, checkMoonpayAvailability, checkMoonpayGeo, checkMoonpayLimits, createMoonpayTransfer, createTonPayTransfer, getTonPayTransferByBodyHash, getTonPayTransferByReference, verifySignature };
323
+ export { type APIOptions, type Chain, type CheckMoonpayGeoParams, type CheckMoonpayGeoResponse, type CheckMoonpayLimitsParams, type CheckMoonpayLimitsResponse, type CompletedTonPayTransferInfo, type CreateMoonpayTransferParams, type CreateMoonpayTransferResponse, type CreateTonPayTransferParams, type CreateTonPayTransferResponse, type GetTonPayTransferByBodyHashParams, type GetTonPayTransferByReferenceParams, type MoonpayAmountLimits, type MoonpayGeoResult, TON, type TransferCompletedWebhookPayload, type TransferRefundedWebhookPayload, USDT, type WebhookEventType, type WebhookPayload, checkMoonpayAvailability, checkMoonpayGeo, checkMoonpayLimits, createMoonpayTransfer, createTonPayTransfer, getTonPayTransferByBodyHash, getTonPayTransferByReference, verifySignature };
package/dist/index.d.ts CHANGED
@@ -94,6 +94,8 @@ type CreateMoonpayTransferParams = {
94
94
  recipientAddr?: string;
95
95
  userIp: string;
96
96
  redirectURL: string;
97
+ /** If true, funds go directly to recipientAddr without proxy contract or memo tag */
98
+ directTopUp?: boolean;
97
99
  };
98
100
  /**
99
101
  * @param link - MoonPay payment link
@@ -102,6 +104,7 @@ type CreateMoonpayTransferParams = {
102
104
  */
103
105
  type CreateMoonpayTransferResponse = {
104
106
  link: string;
107
+ reference: string;
105
108
  geo?: MoonpayGeoResult;
106
109
  limits: MoonpayAmountLimits;
107
110
  };
@@ -112,7 +115,7 @@ type CreateMoonpayTransferResponse = {
112
115
  * @param options - the options for the transfer (requires API key)
113
116
  * @returns the payment link, geo restrictions, and amount limits
114
117
  */
115
- declare const createMoonpayTransfer: (params: CreateMoonpayTransferParams, options: APIOptions) => Promise<CreateMoonpayTransferResponse>;
118
+ declare const createMoonpayTransfer: (params: CreateMoonpayTransferParams, options?: APIOptions) => Promise<CreateMoonpayTransferResponse>;
116
119
 
117
120
  /**
118
121
  * @param ipAddress - IP address to check for geo restrictions
@@ -317,4 +320,4 @@ declare const TON = "TON";
317
320
  */
318
321
  declare function verifySignature(payload: string | object, signature: string, apiSecret: string): boolean;
319
322
 
320
- export { type APIOptions, type Chain, type CheckMoonpayAvailabilityParams, type CheckMoonpayAvailabilityResponse, type CheckMoonpayGeoParams, type CheckMoonpayGeoResponse, type CheckMoonpayLimitsParams, type CheckMoonpayLimitsResponse, type CompletedTonPayTransferInfo, type CreateMoonpayTransferParams, type CreateMoonpayTransferResponse, type CreateTonPayTransferParams, type CreateTonPayTransferResponse, type GetTonPayTransferByBodyHashParams, type GetTonPayTransferByReferenceParams, type MoonpayAmountLimits, type MoonpayGeoResult, TON, type TransferCompletedWebhookPayload, type TransferRefundedWebhookPayload, USDT, type WebhookEventType, type WebhookPayload, checkMoonpayAvailability, checkMoonpayGeo, checkMoonpayLimits, createMoonpayTransfer, createTonPayTransfer, getTonPayTransferByBodyHash, getTonPayTransferByReference, verifySignature };
323
+ export { type APIOptions, type Chain, type CheckMoonpayGeoParams, type CheckMoonpayGeoResponse, type CheckMoonpayLimitsParams, type CheckMoonpayLimitsResponse, type CompletedTonPayTransferInfo, type CreateMoonpayTransferParams, type CreateMoonpayTransferResponse, type CreateTonPayTransferParams, type CreateTonPayTransferResponse, type GetTonPayTransferByBodyHashParams, type GetTonPayTransferByReferenceParams, type MoonpayAmountLimits, type MoonpayGeoResult, TON, type TransferCompletedWebhookPayload, type TransferRefundedWebhookPayload, USDT, type WebhookEventType, type WebhookPayload, checkMoonpayAvailability, checkMoonpayGeo, checkMoonpayLimits, createMoonpayTransfer, createTonPayTransfer, getTonPayTransferByBodyHash, getTonPayTransferByReference, verifySignature };
package/dist/index.js 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 (!_optionalChain([options, 'optionalAccess', _3 => _3.apiKey])) {
6665
- throw new Error("API key is required for MoonPay transfers");
6666
- }
6667
- const baseUrl = getBaseUrl(options.chain);
6664
+ const baseUrl = getBaseUrl(_optionalChain([options, 'optionalAccess', _3 => _3.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 (_optionalChain([options, 'optionalAccess', _4 => _4.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
  {
@@ -6692,10 +6691,9 @@ var createMoonpayTransfer = async (params, options) => {
6692
6691
 
6693
6692
  // src/check-moonpay-geo/check-moonpay-geo.ts
6694
6693
  var checkMoonpayGeo = async (params, options) => {
6695
- const baseUrl = getBaseUrl(_optionalChain([options, 'optionalAccess', _4 => _4.chain]));
6694
+ const baseUrl = getBaseUrl(_optionalChain([options, 'optionalAccess', _5 => _5.chain]));
6696
6695
  const headers = {
6697
- "Content-Type": "application/json",
6698
- ..._optionalChain([options, 'optionalAccess', _5 => _5.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(_optionalChain([options, 'optionalAccess', _6 => _6.chain]));
6719
6717
  const headers = {
6720
- "Content-Type": "application/json",
6721
- ..._optionalChain([options, 'optionalAccess', _7 => _7.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",
@@ -6736,10 +6733,10 @@ var checkMoonpayLimits = async (params, options) => {
6736
6733
 
6737
6734
  // src/check-moonpay-availability/check-moonpay-availability.ts
6738
6735
  var checkMoonpayAvailability = async (params, options) => {
6739
- const baseUrl = getBaseUrl(_optionalChain([options, 'optionalAccess', _8 => _8.chain]));
6736
+ const baseUrl = getBaseUrl(_optionalChain([options, 'optionalAccess', _7 => _7.chain]));
6740
6737
  const headers = {
6741
6738
  "Content-Type": "application/json",
6742
- ..._optionalChain([options, 'optionalAccess', _9 => _9.apiKey]) ? { "x-api-key": options.apiKey } : {}
6739
+ ..._optionalChain([options, 'optionalAccess', _8 => _8.apiKey]) ? { "x-api-key": options.apiKey } : {}
6743
6740
  };
6744
6741
  const response = await fetch(`${baseUrl}/api/external/moonpay/check`, {
6745
6742
  method: "POST",
@@ -6757,7 +6754,7 @@ var checkMoonpayAvailability = async (params, options) => {
6757
6754
 
6758
6755
  // src/get-ton-pay-transfer/get-ton-pay-transfer-by-body-hash.ts
6759
6756
  var getTonPayTransferByBodyHash = async (bodyHash, options) => {
6760
- const baseUrl = getBaseUrl(_optionalChain([options, 'optionalAccess', _10 => _10.chain]));
6757
+ const baseUrl = getBaseUrl(_optionalChain([options, 'optionalAccess', _9 => _9.chain]));
6761
6758
  const response = await fetch(
6762
6759
  `${baseUrl}/api/merchant/v1/transfer?bodyHash=${bodyHash}`,
6763
6760
  {
@@ -6774,11 +6771,15 @@ var getTonPayTransferByBodyHash = async (bodyHash, options) => {
6774
6771
 
6775
6772
  // src/get-ton-pay-transfer/get-ton-pay-transfer-by-reference.ts
6776
6773
  var getTonPayTransferByReference = async (reference, options) => {
6777
- const baseUrl = getBaseUrl(_optionalChain([options, 'optionalAccess', _11 => _11.chain]));
6774
+ const baseUrl = getBaseUrl(_optionalChain([options, 'optionalAccess', _10 => _10.chain]));
6775
+ const headers = {
6776
+ ..._optionalChain([options, 'optionalAccess', _11 => _11.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) {