@atumlabs/payment-gateway-client 2.0.0 → 2.1.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/CHANGELOG.md +24 -0
- package/README.md +127 -51
- package/THIRD-PARTY-NOTICES.txt +45 -0
- package/dist/cli/payment-status.js +58 -39
- package/dist/cli/quote-status.js +58 -39
- package/dist/cli/request-quote.js +59 -40
- package/dist/cli/send-payment.js +60 -39
- package/dist/index.d.ts +64 -12
- package/dist/index.js +49 -15
- package/docs/idempotency.md +62 -0
- package/package.json +14 -4
- /package/{LICENSE.md → LICENSE} +0 -0
package/dist/cli/quote-status.js
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2026 Atum Labs, Inc. All rights reserved.
|
|
4
|
+
* Proprietary and confidential.
|
|
5
|
+
* Access and use are governed by the LICENSE file distributed with this package.
|
|
6
|
+
* Do not remove, alter, or obscure this notice.
|
|
7
|
+
*/
|
|
2
8
|
"use strict";
|
|
3
9
|
var __create = Object.create;
|
|
4
10
|
var __defProp = Object.defineProperty;
|
|
@@ -2445,7 +2451,7 @@ var Interceptors = class {
|
|
|
2445
2451
|
}
|
|
2446
2452
|
};
|
|
2447
2453
|
var OpenAPI = {
|
|
2448
|
-
BASE: "https://
|
|
2454
|
+
BASE: "https://payment-gw.production-mainnet.atum.xyz",
|
|
2449
2455
|
CREDENTIALS: "include",
|
|
2450
2456
|
ENCODE_PATH: void 0,
|
|
2451
2457
|
HEADERS: void 0,
|
|
@@ -2462,8 +2468,8 @@ var OpenAPI = {
|
|
|
2462
2468
|
|
|
2463
2469
|
// src/generated/core/BaseHttpRequest.ts
|
|
2464
2470
|
var BaseHttpRequest = class {
|
|
2465
|
-
constructor(
|
|
2466
|
-
this.config =
|
|
2471
|
+
constructor(config2) {
|
|
2472
|
+
this.config = config2;
|
|
2467
2473
|
}
|
|
2468
2474
|
};
|
|
2469
2475
|
|
|
@@ -2614,15 +2620,15 @@ var getQueryString = (params) => {
|
|
|
2614
2620
|
Object.entries(params).forEach(([key, value]) => encodePair(key, value));
|
|
2615
2621
|
return qs.length ? `?${qs.join("&")}` : "";
|
|
2616
2622
|
};
|
|
2617
|
-
var getUrl = (
|
|
2618
|
-
const encoder =
|
|
2619
|
-
const path = options.url.replace("{api-version}",
|
|
2623
|
+
var getUrl = (config2, options) => {
|
|
2624
|
+
const encoder = config2.ENCODE_PATH || encodeURI;
|
|
2625
|
+
const path = options.url.replace("{api-version}", config2.VERSION).replace(/{(.*?)}/g, (substring, group) => {
|
|
2620
2626
|
if (options.path?.hasOwnProperty(group)) {
|
|
2621
2627
|
return encoder(String(options.path[group]));
|
|
2622
2628
|
}
|
|
2623
2629
|
return substring;
|
|
2624
2630
|
});
|
|
2625
|
-
const url =
|
|
2631
|
+
const url = config2.BASE + path;
|
|
2626
2632
|
return options.query ? url + getQueryString(options.query) : url;
|
|
2627
2633
|
};
|
|
2628
2634
|
var getFormData = (options) => {
|
|
@@ -2652,12 +2658,12 @@ var resolve = async (options, resolver) => {
|
|
|
2652
2658
|
}
|
|
2653
2659
|
return resolver;
|
|
2654
2660
|
};
|
|
2655
|
-
var getHeaders = async (
|
|
2661
|
+
var getHeaders = async (config2, options) => {
|
|
2656
2662
|
const [token, username, password, additionalHeaders] = await Promise.all([
|
|
2657
|
-
resolve(options,
|
|
2658
|
-
resolve(options,
|
|
2659
|
-
resolve(options,
|
|
2660
|
-
resolve(options,
|
|
2663
|
+
resolve(options, config2.TOKEN),
|
|
2664
|
+
resolve(options, config2.USERNAME),
|
|
2665
|
+
resolve(options, config2.PASSWORD),
|
|
2666
|
+
resolve(options, config2.HEADERS)
|
|
2661
2667
|
]);
|
|
2662
2668
|
const headers = Object.entries({
|
|
2663
2669
|
Accept: "application/json",
|
|
@@ -2697,7 +2703,7 @@ var getRequestBody = (options) => {
|
|
|
2697
2703
|
}
|
|
2698
2704
|
return void 0;
|
|
2699
2705
|
};
|
|
2700
|
-
var sendRequest = async (
|
|
2706
|
+
var sendRequest = async (config2, options, url, body, formData, headers, onCancel, axiosClient) => {
|
|
2701
2707
|
const controller = new AbortController();
|
|
2702
2708
|
let requestConfig = {
|
|
2703
2709
|
data: body ?? formData,
|
|
@@ -2705,10 +2711,10 @@ var sendRequest = async (config, options, url, body, formData, headers, onCancel
|
|
|
2705
2711
|
method: options.method,
|
|
2706
2712
|
signal: controller.signal,
|
|
2707
2713
|
url,
|
|
2708
|
-
withCredentials:
|
|
2714
|
+
withCredentials: config2.WITH_CREDENTIALS
|
|
2709
2715
|
};
|
|
2710
2716
|
onCancel(() => controller.abort());
|
|
2711
|
-
for (const fn of
|
|
2717
|
+
for (const fn of config2.interceptors.request._fns) {
|
|
2712
2718
|
requestConfig = await fn(requestConfig);
|
|
2713
2719
|
}
|
|
2714
2720
|
try {
|
|
@@ -2801,16 +2807,16 @@ var catchErrorCodes = (options, result) => {
|
|
|
2801
2807
|
);
|
|
2802
2808
|
}
|
|
2803
2809
|
};
|
|
2804
|
-
var request = (
|
|
2810
|
+
var request = (config2, options, axiosClient = import_axios.default) => {
|
|
2805
2811
|
return new CancelablePromise(async (resolve2, reject, onCancel) => {
|
|
2806
2812
|
try {
|
|
2807
|
-
const url = getUrl(
|
|
2813
|
+
const url = getUrl(config2, options);
|
|
2808
2814
|
const formData = getFormData(options);
|
|
2809
2815
|
const body = getRequestBody(options);
|
|
2810
|
-
const headers = await getHeaders(
|
|
2816
|
+
const headers = await getHeaders(config2, options);
|
|
2811
2817
|
if (!onCancel.isCancelled) {
|
|
2812
|
-
let response = await sendRequest(
|
|
2813
|
-
for (const fn of
|
|
2818
|
+
let response = await sendRequest(config2, options, url, body, formData, headers, onCancel, axiosClient);
|
|
2819
|
+
for (const fn of config2.interceptors.response._fns) {
|
|
2814
2820
|
response = await fn(response);
|
|
2815
2821
|
}
|
|
2816
2822
|
const responseBody = getResponseBody(response);
|
|
@@ -2833,8 +2839,8 @@ var request = (config, options, axiosClient = import_axios.default) => {
|
|
|
2833
2839
|
|
|
2834
2840
|
// src/generated/core/AxiosHttpRequest.ts
|
|
2835
2841
|
var AxiosHttpRequest = class extends BaseHttpRequest {
|
|
2836
|
-
constructor(
|
|
2837
|
-
super(
|
|
2842
|
+
constructor(config2) {
|
|
2843
|
+
super(config2);
|
|
2838
2844
|
}
|
|
2839
2845
|
/**
|
|
2840
2846
|
* Request method
|
|
@@ -3166,20 +3172,20 @@ var HealthService = class {
|
|
|
3166
3172
|
|
|
3167
3173
|
// src/generated/PaymentGatewayClient.ts
|
|
3168
3174
|
var PaymentGatewayClient = class {
|
|
3169
|
-
constructor(
|
|
3175
|
+
constructor(config2, HttpRequest = AxiosHttpRequest) {
|
|
3170
3176
|
this.request = new HttpRequest({
|
|
3171
|
-
BASE:
|
|
3172
|
-
VERSION:
|
|
3173
|
-
WITH_CREDENTIALS:
|
|
3174
|
-
CREDENTIALS:
|
|
3175
|
-
TOKEN:
|
|
3176
|
-
USERNAME:
|
|
3177
|
-
PASSWORD:
|
|
3178
|
-
HEADERS:
|
|
3179
|
-
ENCODE_PATH:
|
|
3177
|
+
BASE: config2?.BASE ?? "https://payment-gw.production-mainnet.atum.xyz",
|
|
3178
|
+
VERSION: config2?.VERSION ?? "1.0.0",
|
|
3179
|
+
WITH_CREDENTIALS: config2?.WITH_CREDENTIALS ?? false,
|
|
3180
|
+
CREDENTIALS: config2?.CREDENTIALS ?? "include",
|
|
3181
|
+
TOKEN: config2?.TOKEN,
|
|
3182
|
+
USERNAME: config2?.USERNAME,
|
|
3183
|
+
PASSWORD: config2?.PASSWORD,
|
|
3184
|
+
HEADERS: config2?.HEADERS,
|
|
3185
|
+
ENCODE_PATH: config2?.ENCODE_PATH,
|
|
3180
3186
|
interceptors: {
|
|
3181
|
-
request:
|
|
3182
|
-
response:
|
|
3187
|
+
request: config2?.interceptors?.request ?? new Interceptors(),
|
|
3188
|
+
response: config2?.interceptors?.response ?? new Interceptors()
|
|
3183
3189
|
}
|
|
3184
3190
|
});
|
|
3185
3191
|
this.authorizations = new AuthorizationsService(this.request);
|
|
@@ -3389,7 +3395,8 @@ var import_payment_request_sender_auth = __toESM(require_dist4());
|
|
|
3389
3395
|
|
|
3390
3396
|
// src/index.ts
|
|
3391
3397
|
var PAYMENT_REQUEST_VERSION = "1.0";
|
|
3392
|
-
var defaultGateway = "https://payment-
|
|
3398
|
+
var defaultGateway = "https://payment-gw.production-testnet.atum.xyz";
|
|
3399
|
+
var OpenAPI2 = { ...OpenAPI, BASE: defaultGateway };
|
|
3393
3400
|
var DEFAULT_QUOTE_DEADLINE_SECONDS = 5;
|
|
3394
3401
|
var DEFAULT_FULFILLMENT_DEADLINE_SECONDS = 3600;
|
|
3395
3402
|
var DEFAULT_PAYMENT_QUOTE_DEADLINE_SECONDS = 10;
|
|
@@ -3477,9 +3484,11 @@ async function assemblePaymentRequest(params) {
|
|
|
3477
3484
|
};
|
|
3478
3485
|
}
|
|
3479
3486
|
var PaymentGatewayClient2 = class extends PaymentGatewayClient {
|
|
3480
|
-
constructor(
|
|
3481
|
-
|
|
3482
|
-
|
|
3487
|
+
constructor(config2, HttpRequest = AxiosHttpRequest) {
|
|
3488
|
+
const envBase = (typeof process !== "undefined" ? process.env.GATEWAY_URL : void 0)?.trim();
|
|
3489
|
+
const base = config2?.BASE ?? (envBase || defaultGateway);
|
|
3490
|
+
super({ ...config2, BASE: base }, HttpRequest);
|
|
3491
|
+
this.baseUrl = base;
|
|
3483
3492
|
}
|
|
3484
3493
|
/**
|
|
3485
3494
|
* Fetches chain defaults from the payment gateway.
|
|
@@ -3694,9 +3703,19 @@ var PaymentGatewayClient2 = class extends PaymentGatewayClient {
|
|
|
3694
3703
|
}
|
|
3695
3704
|
};
|
|
3696
3705
|
|
|
3706
|
+
// src/version.ts
|
|
3707
|
+
var PACKAGE_VERSION = true ? "2.1.0" : "0.0.0-dev";
|
|
3708
|
+
|
|
3709
|
+
// src/cli/load-env.ts
|
|
3710
|
+
var import_dotenv = require("dotenv");
|
|
3711
|
+
function loadCliEnv() {
|
|
3712
|
+
(0, import_dotenv.config)({ override: false, quiet: true });
|
|
3713
|
+
}
|
|
3714
|
+
|
|
3697
3715
|
// src/cli/quote-status.ts
|
|
3716
|
+
loadCliEnv();
|
|
3698
3717
|
var program = new import_commander.Command();
|
|
3699
|
-
program.name("quote-status").description("Fetch the status of a quote-request batch (no signing required)").version(
|
|
3718
|
+
program.name("quote-status").description("Fetch the status of a quote-request batch (no signing required)").version(PACKAGE_VERSION).argument("<quoteRequestId>", "The quote_request_id (qr_...) returned by request-quote").option("--gateway <url>", "Payment gateway URL (overrides GATEWAY_URL env; default: production-testnet)").addHelpText("after", `
|
|
3700
3719
|
Example:
|
|
3701
3720
|
quote-status --gateway http://localhost:8080 qr_019f27b9-420d-7353-8263-0cf310670a77
|
|
3702
3721
|
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2026 Atum Labs, Inc. All rights reserved.
|
|
4
|
+
* Proprietary and confidential.
|
|
5
|
+
* Access and use are governed by the LICENSE file distributed with this package.
|
|
6
|
+
* Do not remove, alter, or obscure this notice.
|
|
7
|
+
*/
|
|
2
8
|
"use strict";
|
|
3
9
|
var __create = Object.create;
|
|
4
10
|
var __defProp = Object.defineProperty;
|
|
@@ -2445,7 +2451,7 @@ var Interceptors = class {
|
|
|
2445
2451
|
}
|
|
2446
2452
|
};
|
|
2447
2453
|
var OpenAPI = {
|
|
2448
|
-
BASE: "https://
|
|
2454
|
+
BASE: "https://payment-gw.production-mainnet.atum.xyz",
|
|
2449
2455
|
CREDENTIALS: "include",
|
|
2450
2456
|
ENCODE_PATH: void 0,
|
|
2451
2457
|
HEADERS: void 0,
|
|
@@ -2462,8 +2468,8 @@ var OpenAPI = {
|
|
|
2462
2468
|
|
|
2463
2469
|
// src/generated/core/BaseHttpRequest.ts
|
|
2464
2470
|
var BaseHttpRequest = class {
|
|
2465
|
-
constructor(
|
|
2466
|
-
this.config =
|
|
2471
|
+
constructor(config2) {
|
|
2472
|
+
this.config = config2;
|
|
2467
2473
|
}
|
|
2468
2474
|
};
|
|
2469
2475
|
|
|
@@ -2614,15 +2620,15 @@ var getQueryString = (params) => {
|
|
|
2614
2620
|
Object.entries(params).forEach(([key, value]) => encodePair(key, value));
|
|
2615
2621
|
return qs.length ? `?${qs.join("&")}` : "";
|
|
2616
2622
|
};
|
|
2617
|
-
var getUrl = (
|
|
2618
|
-
const encoder =
|
|
2619
|
-
const path = options.url.replace("{api-version}",
|
|
2623
|
+
var getUrl = (config2, options) => {
|
|
2624
|
+
const encoder = config2.ENCODE_PATH || encodeURI;
|
|
2625
|
+
const path = options.url.replace("{api-version}", config2.VERSION).replace(/{(.*?)}/g, (substring, group) => {
|
|
2620
2626
|
if (options.path?.hasOwnProperty(group)) {
|
|
2621
2627
|
return encoder(String(options.path[group]));
|
|
2622
2628
|
}
|
|
2623
2629
|
return substring;
|
|
2624
2630
|
});
|
|
2625
|
-
const url =
|
|
2631
|
+
const url = config2.BASE + path;
|
|
2626
2632
|
return options.query ? url + getQueryString(options.query) : url;
|
|
2627
2633
|
};
|
|
2628
2634
|
var getFormData = (options) => {
|
|
@@ -2652,12 +2658,12 @@ var resolve = async (options, resolver) => {
|
|
|
2652
2658
|
}
|
|
2653
2659
|
return resolver;
|
|
2654
2660
|
};
|
|
2655
|
-
var getHeaders = async (
|
|
2661
|
+
var getHeaders = async (config2, options) => {
|
|
2656
2662
|
const [token, username, password, additionalHeaders] = await Promise.all([
|
|
2657
|
-
resolve(options,
|
|
2658
|
-
resolve(options,
|
|
2659
|
-
resolve(options,
|
|
2660
|
-
resolve(options,
|
|
2663
|
+
resolve(options, config2.TOKEN),
|
|
2664
|
+
resolve(options, config2.USERNAME),
|
|
2665
|
+
resolve(options, config2.PASSWORD),
|
|
2666
|
+
resolve(options, config2.HEADERS)
|
|
2661
2667
|
]);
|
|
2662
2668
|
const headers = Object.entries({
|
|
2663
2669
|
Accept: "application/json",
|
|
@@ -2697,7 +2703,7 @@ var getRequestBody = (options) => {
|
|
|
2697
2703
|
}
|
|
2698
2704
|
return void 0;
|
|
2699
2705
|
};
|
|
2700
|
-
var sendRequest = async (
|
|
2706
|
+
var sendRequest = async (config2, options, url, body, formData, headers, onCancel, axiosClient) => {
|
|
2701
2707
|
const controller = new AbortController();
|
|
2702
2708
|
let requestConfig = {
|
|
2703
2709
|
data: body ?? formData,
|
|
@@ -2705,10 +2711,10 @@ var sendRequest = async (config, options, url, body, formData, headers, onCancel
|
|
|
2705
2711
|
method: options.method,
|
|
2706
2712
|
signal: controller.signal,
|
|
2707
2713
|
url,
|
|
2708
|
-
withCredentials:
|
|
2714
|
+
withCredentials: config2.WITH_CREDENTIALS
|
|
2709
2715
|
};
|
|
2710
2716
|
onCancel(() => controller.abort());
|
|
2711
|
-
for (const fn of
|
|
2717
|
+
for (const fn of config2.interceptors.request._fns) {
|
|
2712
2718
|
requestConfig = await fn(requestConfig);
|
|
2713
2719
|
}
|
|
2714
2720
|
try {
|
|
@@ -2801,16 +2807,16 @@ var catchErrorCodes = (options, result) => {
|
|
|
2801
2807
|
);
|
|
2802
2808
|
}
|
|
2803
2809
|
};
|
|
2804
|
-
var request = (
|
|
2810
|
+
var request = (config2, options, axiosClient = import_axios.default) => {
|
|
2805
2811
|
return new CancelablePromise(async (resolve2, reject, onCancel) => {
|
|
2806
2812
|
try {
|
|
2807
|
-
const url = getUrl(
|
|
2813
|
+
const url = getUrl(config2, options);
|
|
2808
2814
|
const formData = getFormData(options);
|
|
2809
2815
|
const body = getRequestBody(options);
|
|
2810
|
-
const headers = await getHeaders(
|
|
2816
|
+
const headers = await getHeaders(config2, options);
|
|
2811
2817
|
if (!onCancel.isCancelled) {
|
|
2812
|
-
let response = await sendRequest(
|
|
2813
|
-
for (const fn of
|
|
2818
|
+
let response = await sendRequest(config2, options, url, body, formData, headers, onCancel, axiosClient);
|
|
2819
|
+
for (const fn of config2.interceptors.response._fns) {
|
|
2814
2820
|
response = await fn(response);
|
|
2815
2821
|
}
|
|
2816
2822
|
const responseBody = getResponseBody(response);
|
|
@@ -2833,8 +2839,8 @@ var request = (config, options, axiosClient = import_axios.default) => {
|
|
|
2833
2839
|
|
|
2834
2840
|
// src/generated/core/AxiosHttpRequest.ts
|
|
2835
2841
|
var AxiosHttpRequest = class extends BaseHttpRequest {
|
|
2836
|
-
constructor(
|
|
2837
|
-
super(
|
|
2842
|
+
constructor(config2) {
|
|
2843
|
+
super(config2);
|
|
2838
2844
|
}
|
|
2839
2845
|
/**
|
|
2840
2846
|
* Request method
|
|
@@ -3166,20 +3172,20 @@ var HealthService = class {
|
|
|
3166
3172
|
|
|
3167
3173
|
// src/generated/PaymentGatewayClient.ts
|
|
3168
3174
|
var PaymentGatewayClient = class {
|
|
3169
|
-
constructor(
|
|
3175
|
+
constructor(config2, HttpRequest = AxiosHttpRequest) {
|
|
3170
3176
|
this.request = new HttpRequest({
|
|
3171
|
-
BASE:
|
|
3172
|
-
VERSION:
|
|
3173
|
-
WITH_CREDENTIALS:
|
|
3174
|
-
CREDENTIALS:
|
|
3175
|
-
TOKEN:
|
|
3176
|
-
USERNAME:
|
|
3177
|
-
PASSWORD:
|
|
3178
|
-
HEADERS:
|
|
3179
|
-
ENCODE_PATH:
|
|
3177
|
+
BASE: config2?.BASE ?? "https://payment-gw.production-mainnet.atum.xyz",
|
|
3178
|
+
VERSION: config2?.VERSION ?? "1.0.0",
|
|
3179
|
+
WITH_CREDENTIALS: config2?.WITH_CREDENTIALS ?? false,
|
|
3180
|
+
CREDENTIALS: config2?.CREDENTIALS ?? "include",
|
|
3181
|
+
TOKEN: config2?.TOKEN,
|
|
3182
|
+
USERNAME: config2?.USERNAME,
|
|
3183
|
+
PASSWORD: config2?.PASSWORD,
|
|
3184
|
+
HEADERS: config2?.HEADERS,
|
|
3185
|
+
ENCODE_PATH: config2?.ENCODE_PATH,
|
|
3180
3186
|
interceptors: {
|
|
3181
|
-
request:
|
|
3182
|
-
response:
|
|
3187
|
+
request: config2?.interceptors?.request ?? new Interceptors(),
|
|
3188
|
+
response: config2?.interceptors?.response ?? new Interceptors()
|
|
3183
3189
|
}
|
|
3184
3190
|
});
|
|
3185
3191
|
this.authorizations = new AuthorizationsService(this.request);
|
|
@@ -3389,7 +3395,8 @@ var import_payment_request_sender_auth = __toESM(require_dist4());
|
|
|
3389
3395
|
|
|
3390
3396
|
// src/index.ts
|
|
3391
3397
|
var PAYMENT_REQUEST_VERSION = "1.0";
|
|
3392
|
-
var defaultGateway = "https://payment-
|
|
3398
|
+
var defaultGateway = "https://payment-gw.production-testnet.atum.xyz";
|
|
3399
|
+
var OpenAPI2 = { ...OpenAPI, BASE: defaultGateway };
|
|
3393
3400
|
var DEFAULT_QUOTE_DEADLINE_SECONDS = 5;
|
|
3394
3401
|
var DEFAULT_FULFILLMENT_DEADLINE_SECONDS = 3600;
|
|
3395
3402
|
var DEFAULT_PAYMENT_QUOTE_DEADLINE_SECONDS = 10;
|
|
@@ -3477,9 +3484,11 @@ async function assemblePaymentRequest(params) {
|
|
|
3477
3484
|
};
|
|
3478
3485
|
}
|
|
3479
3486
|
var PaymentGatewayClient2 = class extends PaymentGatewayClient {
|
|
3480
|
-
constructor(
|
|
3481
|
-
|
|
3482
|
-
|
|
3487
|
+
constructor(config2, HttpRequest = AxiosHttpRequest) {
|
|
3488
|
+
const envBase = (typeof process !== "undefined" ? process.env.GATEWAY_URL : void 0)?.trim();
|
|
3489
|
+
const base = config2?.BASE ?? (envBase || defaultGateway);
|
|
3490
|
+
super({ ...config2, BASE: base }, HttpRequest);
|
|
3491
|
+
this.baseUrl = base;
|
|
3483
3492
|
}
|
|
3484
3493
|
/**
|
|
3485
3494
|
* Fetches chain defaults from the payment gateway.
|
|
@@ -3704,12 +3713,22 @@ function parseSeconds(optionName) {
|
|
|
3704
3713
|
};
|
|
3705
3714
|
}
|
|
3706
3715
|
|
|
3716
|
+
// src/version.ts
|
|
3717
|
+
var PACKAGE_VERSION = true ? "2.1.0" : "0.0.0-dev";
|
|
3718
|
+
|
|
3719
|
+
// src/cli/load-env.ts
|
|
3720
|
+
var import_dotenv = require("dotenv");
|
|
3721
|
+
function loadCliEnv() {
|
|
3722
|
+
(0, import_dotenv.config)({ override: false, quiet: true });
|
|
3723
|
+
}
|
|
3724
|
+
|
|
3707
3725
|
// src/cli/request-quote.ts
|
|
3726
|
+
loadCliEnv();
|
|
3708
3727
|
function collect(value, previous) {
|
|
3709
3728
|
return previous.concat([value]);
|
|
3710
3729
|
}
|
|
3711
3730
|
var program = new import_commander.Command();
|
|
3712
|
-
program.name("request-quote").description("Open a quote-request batch on the Atum Payment Gateway and print the collected quotes (no signing required)").version(
|
|
3731
|
+
program.name("request-quote").description("Open a quote-request batch on the Atum Payment Gateway and print the collected quotes (no signing required)").version(PACKAGE_VERSION).argument("<sender>", "Depositor / originator address (e.g., 0xF0D0...) \u2014 the source account").argument("<amount>", "Fulfillment amount to receive at destination (smallest units, e.g. 100000 for 0.10 USDC)").argument("<sourceAsset>", "Source asset in CAIP-19 format").argument("<receiver>", "Destination account address").argument("<destinationAsset>", "Destination asset in CAIP-19 format").option("--gateway <url>", "Payment gateway URL (overrides GATEWAY_URL env; default: production-testnet)").option("--request-id <id>", "Custom request ID (overrides prefix)").option("--request-id-prefix <prefix>", "Custom request ID prefix (default: quote-gw-cli)").option("--no-wait", "Return immediately (202 + quote_request_id) instead of blocking for collected quotes").option("--max-source-amount <amount>", "Cap on what to spend from source (smallest units); quotes above it are filtered").option("--quote-deadline-seconds <n>", `Collection window length in seconds (default: ${DEFAULT_QUOTE_DEADLINE_SECONDS})`, parseSeconds("--quote-deadline-seconds")).option("--fulfillment-deadline-seconds <n>", `Settlement horizon in seconds (default: ${DEFAULT_FULFILLMENT_DEADLINE_SECONDS})`, parseSeconds("--fulfillment-deadline-seconds")).option("--whitelistSettler <did>", "Settler DID to whitelist (repeatable)", collect, []).addHelpText("after", `
|
|
3713
3732
|
CAIP-19 Examples:
|
|
3714
3733
|
EVM ERC20: eip155:42161/erc20:0xaf88d065e77c8cC2239327C5EDb3A432268e5831
|
|
3715
3734
|
Tron TRC20: tron:shasta/trc20:TG3XXyExBkPp9nzdajDZsozEu4BkaSJozs
|
|
@@ -3728,7 +3747,7 @@ Demo across environments (only --gateway changes):
|
|
|
3728
3747
|
"eip155:42220/erc20:0x08F18B729A1C1cB74A2c904b4E995f605d0d1958"
|
|
3729
3748
|
|
|
3730
3749
|
# 2) deployed testnet (default gateway is testnet)
|
|
3731
|
-
request-quote --gateway https://payment-
|
|
3750
|
+
request-quote --gateway https://payment-gw.production-testnet.atum.xyz \\
|
|
3732
3751
|
<sender> <amount> <sourceAsset> <receiver> <destinationAsset>
|
|
3733
3752
|
|
|
3734
3753
|
Output (mirrors send-payment):
|
package/dist/cli/send-payment.js
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2026 Atum Labs, Inc. All rights reserved.
|
|
4
|
+
* Proprietary and confidential.
|
|
5
|
+
* Access and use are governed by the LICENSE file distributed with this package.
|
|
6
|
+
* Do not remove, alter, or obscure this notice.
|
|
7
|
+
*/
|
|
2
8
|
"use strict";
|
|
3
9
|
var __create = Object.create;
|
|
4
10
|
var __defProp = Object.defineProperty;
|
|
@@ -4646,7 +4652,7 @@ var Interceptors = class {
|
|
|
4646
4652
|
}
|
|
4647
4653
|
};
|
|
4648
4654
|
var OpenAPI = {
|
|
4649
|
-
BASE: "https://
|
|
4655
|
+
BASE: "https://payment-gw.production-mainnet.atum.xyz",
|
|
4650
4656
|
CREDENTIALS: "include",
|
|
4651
4657
|
ENCODE_PATH: void 0,
|
|
4652
4658
|
HEADERS: void 0,
|
|
@@ -4663,8 +4669,8 @@ var OpenAPI = {
|
|
|
4663
4669
|
|
|
4664
4670
|
// src/generated/core/BaseHttpRequest.ts
|
|
4665
4671
|
var BaseHttpRequest = class {
|
|
4666
|
-
constructor(
|
|
4667
|
-
this.config =
|
|
4672
|
+
constructor(config2) {
|
|
4673
|
+
this.config = config2;
|
|
4668
4674
|
}
|
|
4669
4675
|
};
|
|
4670
4676
|
|
|
@@ -4815,15 +4821,15 @@ var getQueryString = (params) => {
|
|
|
4815
4821
|
Object.entries(params).forEach(([key, value]) => encodePair(key, value));
|
|
4816
4822
|
return qs.length ? `?${qs.join("&")}` : "";
|
|
4817
4823
|
};
|
|
4818
|
-
var getUrl = (
|
|
4819
|
-
const encoder =
|
|
4820
|
-
const path = options.url.replace("{api-version}",
|
|
4824
|
+
var getUrl = (config2, options) => {
|
|
4825
|
+
const encoder = config2.ENCODE_PATH || encodeURI;
|
|
4826
|
+
const path = options.url.replace("{api-version}", config2.VERSION).replace(/{(.*?)}/g, (substring, group) => {
|
|
4821
4827
|
if (options.path?.hasOwnProperty(group)) {
|
|
4822
4828
|
return encoder(String(options.path[group]));
|
|
4823
4829
|
}
|
|
4824
4830
|
return substring;
|
|
4825
4831
|
});
|
|
4826
|
-
const url =
|
|
4832
|
+
const url = config2.BASE + path;
|
|
4827
4833
|
return options.query ? url + getQueryString(options.query) : url;
|
|
4828
4834
|
};
|
|
4829
4835
|
var getFormData = (options) => {
|
|
@@ -4853,12 +4859,12 @@ var resolve = async (options, resolver) => {
|
|
|
4853
4859
|
}
|
|
4854
4860
|
return resolver;
|
|
4855
4861
|
};
|
|
4856
|
-
var getHeaders = async (
|
|
4862
|
+
var getHeaders = async (config2, options) => {
|
|
4857
4863
|
const [token, username, password, additionalHeaders] = await Promise.all([
|
|
4858
|
-
resolve(options,
|
|
4859
|
-
resolve(options,
|
|
4860
|
-
resolve(options,
|
|
4861
|
-
resolve(options,
|
|
4864
|
+
resolve(options, config2.TOKEN),
|
|
4865
|
+
resolve(options, config2.USERNAME),
|
|
4866
|
+
resolve(options, config2.PASSWORD),
|
|
4867
|
+
resolve(options, config2.HEADERS)
|
|
4862
4868
|
]);
|
|
4863
4869
|
const headers = Object.entries({
|
|
4864
4870
|
Accept: "application/json",
|
|
@@ -4898,7 +4904,7 @@ var getRequestBody = (options) => {
|
|
|
4898
4904
|
}
|
|
4899
4905
|
return void 0;
|
|
4900
4906
|
};
|
|
4901
|
-
var sendRequest = async (
|
|
4907
|
+
var sendRequest = async (config2, options, url, body, formData, headers, onCancel, axiosClient) => {
|
|
4902
4908
|
const controller = new AbortController();
|
|
4903
4909
|
let requestConfig = {
|
|
4904
4910
|
data: body ?? formData,
|
|
@@ -4906,10 +4912,10 @@ var sendRequest = async (config, options, url, body, formData, headers, onCancel
|
|
|
4906
4912
|
method: options.method,
|
|
4907
4913
|
signal: controller.signal,
|
|
4908
4914
|
url,
|
|
4909
|
-
withCredentials:
|
|
4915
|
+
withCredentials: config2.WITH_CREDENTIALS
|
|
4910
4916
|
};
|
|
4911
4917
|
onCancel(() => controller.abort());
|
|
4912
|
-
for (const fn of
|
|
4918
|
+
for (const fn of config2.interceptors.request._fns) {
|
|
4913
4919
|
requestConfig = await fn(requestConfig);
|
|
4914
4920
|
}
|
|
4915
4921
|
try {
|
|
@@ -5002,16 +5008,16 @@ var catchErrorCodes = (options, result) => {
|
|
|
5002
5008
|
);
|
|
5003
5009
|
}
|
|
5004
5010
|
};
|
|
5005
|
-
var request = (
|
|
5011
|
+
var request = (config2, options, axiosClient = import_axios.default) => {
|
|
5006
5012
|
return new CancelablePromise(async (resolve2, reject, onCancel) => {
|
|
5007
5013
|
try {
|
|
5008
|
-
const url = getUrl(
|
|
5014
|
+
const url = getUrl(config2, options);
|
|
5009
5015
|
const formData = getFormData(options);
|
|
5010
5016
|
const body = getRequestBody(options);
|
|
5011
|
-
const headers = await getHeaders(
|
|
5017
|
+
const headers = await getHeaders(config2, options);
|
|
5012
5018
|
if (!onCancel.isCancelled) {
|
|
5013
|
-
let response = await sendRequest(
|
|
5014
|
-
for (const fn of
|
|
5019
|
+
let response = await sendRequest(config2, options, url, body, formData, headers, onCancel, axiosClient);
|
|
5020
|
+
for (const fn of config2.interceptors.response._fns) {
|
|
5015
5021
|
response = await fn(response);
|
|
5016
5022
|
}
|
|
5017
5023
|
const responseBody = getResponseBody(response);
|
|
@@ -5034,8 +5040,8 @@ var request = (config, options, axiosClient = import_axios.default) => {
|
|
|
5034
5040
|
|
|
5035
5041
|
// src/generated/core/AxiosHttpRequest.ts
|
|
5036
5042
|
var AxiosHttpRequest = class extends BaseHttpRequest {
|
|
5037
|
-
constructor(
|
|
5038
|
-
super(
|
|
5043
|
+
constructor(config2) {
|
|
5044
|
+
super(config2);
|
|
5039
5045
|
}
|
|
5040
5046
|
/**
|
|
5041
5047
|
* Request method
|
|
@@ -5367,20 +5373,20 @@ var HealthService = class {
|
|
|
5367
5373
|
|
|
5368
5374
|
// src/generated/PaymentGatewayClient.ts
|
|
5369
5375
|
var PaymentGatewayClient = class {
|
|
5370
|
-
constructor(
|
|
5376
|
+
constructor(config2, HttpRequest = AxiosHttpRequest) {
|
|
5371
5377
|
this.request = new HttpRequest({
|
|
5372
|
-
BASE:
|
|
5373
|
-
VERSION:
|
|
5374
|
-
WITH_CREDENTIALS:
|
|
5375
|
-
CREDENTIALS:
|
|
5376
|
-
TOKEN:
|
|
5377
|
-
USERNAME:
|
|
5378
|
-
PASSWORD:
|
|
5379
|
-
HEADERS:
|
|
5380
|
-
ENCODE_PATH:
|
|
5378
|
+
BASE: config2?.BASE ?? "https://payment-gw.production-mainnet.atum.xyz",
|
|
5379
|
+
VERSION: config2?.VERSION ?? "1.0.0",
|
|
5380
|
+
WITH_CREDENTIALS: config2?.WITH_CREDENTIALS ?? false,
|
|
5381
|
+
CREDENTIALS: config2?.CREDENTIALS ?? "include",
|
|
5382
|
+
TOKEN: config2?.TOKEN,
|
|
5383
|
+
USERNAME: config2?.USERNAME,
|
|
5384
|
+
PASSWORD: config2?.PASSWORD,
|
|
5385
|
+
HEADERS: config2?.HEADERS,
|
|
5386
|
+
ENCODE_PATH: config2?.ENCODE_PATH,
|
|
5381
5387
|
interceptors: {
|
|
5382
|
-
request:
|
|
5383
|
-
response:
|
|
5388
|
+
request: config2?.interceptors?.request ?? new Interceptors(),
|
|
5389
|
+
response: config2?.interceptors?.response ?? new Interceptors()
|
|
5384
5390
|
}
|
|
5385
5391
|
});
|
|
5386
5392
|
this.authorizations = new AuthorizationsService(this.request);
|
|
@@ -5647,7 +5653,8 @@ function createSenderSigner(sourceChainId, opts) {
|
|
|
5647
5653
|
|
|
5648
5654
|
// src/index.ts
|
|
5649
5655
|
var PAYMENT_REQUEST_VERSION = "1.0";
|
|
5650
|
-
var defaultGateway = "https://payment-
|
|
5656
|
+
var defaultGateway = "https://payment-gw.production-testnet.atum.xyz";
|
|
5657
|
+
var OpenAPI2 = { ...OpenAPI, BASE: defaultGateway };
|
|
5651
5658
|
var DEFAULT_QUOTE_DEADLINE_SECONDS = 5;
|
|
5652
5659
|
var DEFAULT_FULFILLMENT_DEADLINE_SECONDS = 3600;
|
|
5653
5660
|
var DEFAULT_PAYMENT_QUOTE_DEADLINE_SECONDS = 10;
|
|
@@ -5735,9 +5742,11 @@ async function assemblePaymentRequest(params) {
|
|
|
5735
5742
|
};
|
|
5736
5743
|
}
|
|
5737
5744
|
var PaymentGatewayClient2 = class extends PaymentGatewayClient {
|
|
5738
|
-
constructor(
|
|
5739
|
-
|
|
5740
|
-
|
|
5745
|
+
constructor(config2, HttpRequest = AxiosHttpRequest) {
|
|
5746
|
+
const envBase = (typeof process !== "undefined" ? process.env.GATEWAY_URL : void 0)?.trim();
|
|
5747
|
+
const base = config2?.BASE ?? (envBase || defaultGateway);
|
|
5748
|
+
super({ ...config2, BASE: base }, HttpRequest);
|
|
5749
|
+
this.baseUrl = base;
|
|
5741
5750
|
}
|
|
5742
5751
|
/**
|
|
5743
5752
|
* Fetches chain defaults from the payment gateway.
|
|
@@ -5962,8 +5971,20 @@ function parseSeconds(optionName) {
|
|
|
5962
5971
|
};
|
|
5963
5972
|
}
|
|
5964
5973
|
|
|
5974
|
+
// src/version.ts
|
|
5975
|
+
var PACKAGE_VERSION = true ? "2.1.0" : "0.0.0-dev";
|
|
5976
|
+
|
|
5965
5977
|
// src/cli/send-payment.ts
|
|
5966
5978
|
var readline = __toESM(require("readline"));
|
|
5979
|
+
|
|
5980
|
+
// src/cli/load-env.ts
|
|
5981
|
+
var import_dotenv = require("dotenv");
|
|
5982
|
+
function loadCliEnv() {
|
|
5983
|
+
(0, import_dotenv.config)({ override: false, quiet: true });
|
|
5984
|
+
}
|
|
5985
|
+
|
|
5986
|
+
// src/cli/send-payment.ts
|
|
5987
|
+
loadCliEnv();
|
|
5967
5988
|
function collect(value, previous) {
|
|
5968
5989
|
return previous.concat([value]);
|
|
5969
5990
|
}
|
|
@@ -5983,7 +6004,7 @@ function loadTurnkeyConfigFromEnv() {
|
|
|
5983
6004
|
};
|
|
5984
6005
|
}
|
|
5985
6006
|
var program = new import_commander.Command();
|
|
5986
|
-
program.name("send-payment").description("Send a cross-chain payment through Atum Payment Gateway").version(
|
|
6007
|
+
program.name("send-payment").description("Send a cross-chain payment through Atum Payment Gateway").version(PACKAGE_VERSION).argument("<sender>", "Depositor address (e.g., 0xF0D0...)").argument("<amount>", "Amount to send (in smallest units, e.g., 100000 for 0.10 USDC)").argument("<sourceAsset>", "Source asset in CAIP-19 format").argument("<receiver>", "Destination account address").argument("<destinationAsset>", "Destination asset in CAIP-19 format").option("--gateway <url>", "Payment gateway URL (overrides GATEWAY_URL env; default: production-testnet)").option("--request-id <id>", "Idempotency key; seeds the on-chain deposit nonce. Reuse the same id to retry a payment safely. Omit to auto-generate a one-shot id.").option("--request-id-prefix <prefix>", "Custom request ID prefix (default: pmt-gw-cli)").option("--quote-deadline-seconds <n>", `Quote collection window in seconds (default: ${DEFAULT_PAYMENT_QUOTE_DEADLINE_SECONDS})`, parseSeconds("--quote-deadline-seconds")).option("--fulfillment-deadline-seconds <n>", `Settlement horizon in seconds (default: ${DEFAULT_FULFILLMENT_DEADLINE_SECONDS})`, parseSeconds("--fulfillment-deadline-seconds")).option("--whitelistSettler <did>", "Settler DID to whitelist (can be specified multiple times)", collect, []).option("--provider <raw|turnkey>", "Sender signing provider", "raw").option("--solana-rpc-url <url>", "Solana RPC used to read the cluster clock for issued_at (falls back to the SOLANA_RPC_URL env var, then the public endpoint for the cluster)").addHelpText("after", `
|
|
5987
6008
|
CAIP-19 Examples:
|
|
5988
6009
|
EVM ERC20: eip155:42161/erc20:0xaf88d065e77c8cC2239327C5EDb3A432268e5831
|
|
5989
6010
|
Tron TRC20: tron:shasta/trc20:TG3XXyExBkPp9nzdajDZsozEu4BkaSJozs
|