@atumlabs/payment-gateway-client 1.0.1
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/LICENSE.md +83 -0
- package/README.md +247 -0
- package/dist/cli/payment-status.d.ts +1 -0
- package/dist/cli/payment-status.js +3125 -0
- package/dist/cli/quote-status.d.ts +1 -0
- package/dist/cli/quote-status.js +3125 -0
- package/dist/cli/request-quote.d.ts +1 -0
- package/dist/cli/request-quote.js +3177 -0
- package/dist/cli/send-payment.d.ts +1 -0
- package/dist/cli/send-payment.js +5472 -0
- package/dist/index.d.ts +3645 -0
- package/dist/index.js +7031 -0
- package/package.json +80 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# ATUM LABS, INC. – PAYMENT GATEWAY CLIENT PRIVATE REPOSITORY LICENSE AGREEMENT
|
|
2
|
+
**Last Updated: January 28, 2026**
|
|
3
|
+
|
|
4
|
+
This Private Repository License Agreement (“Agreement”) governs your (“Licensee”) access to the Atum Labs, Inc. (“Atum”) private GitHub repository containing Atum’s proprietary source code, SDK components, documentation, and implementation examples relating to the Atum Payment Gateway Client (“Payment Gateway Client Code”).
|
|
5
|
+
By accessing or using the Repository, Licensee agrees to be bound by this Agreement.
|
|
6
|
+
## 1. Purpose of Access
|
|
7
|
+
Atum is granting limited access to the Payment Gateway Client Code solely for the following permitted purpose (the “Authorized Purpose”):
|
|
8
|
+
- Integrating, installing, operating, and testing the Payment Gateway Client in connection with Licensee's use of the Atum settlement network, Goji-facing transaction flows, and any other Atum-authorized payment operations.
|
|
9
|
+
- Conducting internal audits, security review, and compliance assessments necessary to support the above operations.
|
|
10
|
+
|
|
11
|
+
No other use is permitted.
|
|
12
|
+
## 2. License Grant
|
|
13
|
+
Subject to Licensee’s full compliance with this Agreement, Atum grants Licensee a limited, revocable, non-exclusive, non-transferable, non-sublicensable license to:
|
|
14
|
+
1. Access the private GitHub repository containing the Payment Gateway Client Code (“Repository”);
|
|
15
|
+
2. Download and internally use the Payment Gateway Client Code solely for the Authorized Purpose;
|
|
16
|
+
3. Deploy and run compiled or interpreted versions of the Payment Gateway Client Code only within Licensee’s secure infrastructure and only for the Authorized Purpose;
|
|
17
|
+
4. Create internal configuration changes or implementation wrappers necessary for integration, provided that all such modifications remain Atum Confidential Information and are disclosed to Atum upon request.
|
|
18
|
+
|
|
19
|
+
No other rights are granted.
|
|
20
|
+
## 3. Restrictions
|
|
21
|
+
Licensee must not, and must not permit any third party to:
|
|
22
|
+
1. Use the Payment Gateway Client Code for any purpose outside the Authorized Purpose;
|
|
23
|
+
2. Make the Repository or any portion of the Payment Gateway Client Code available to any third party, including affiliates, without Atum’s written consent;
|
|
24
|
+
3. Publicly disclose, publish, or commit any portion of the Payment Gateway Client Code to any public forum or repository;
|
|
25
|
+
4. Use the Payment Gateway Client Code to build or support any competing products or networks;
|
|
26
|
+
5. Reverse engineer, decompile, or otherwise attempt to derive the underlying trade secrets in the Payment Gateway Client Code (except to the limited extent permitted by applicable law);
|
|
27
|
+
6. Remove or alter any proprietary notices;
|
|
28
|
+
7. Use Atum’s code, data, or architecture to train or fine-tune any AI, LLM, or ML models;
|
|
29
|
+
8. Use the Payment Gateway Client Code in violation of applicable law or Atum instructions.
|
|
30
|
+
## 4. Ownership
|
|
31
|
+
Atum retains all rights, title, and interest in and to:
|
|
32
|
+
- the Payment Gateway Client Code,
|
|
33
|
+
- the Repository contents,
|
|
34
|
+
- the underlying architecture, algorithms, settlement workflows, and SDK components, and
|
|
35
|
+
- all modifications, derivative works, feedback, or improvements.
|
|
36
|
+
No ownership rights are transferred to Licensee.
|
|
37
|
+
## 5. Confidentiality
|
|
38
|
+
The Payment Gateway Client Code and all related documentation constitute Atum Confidential Information. Licensee must:
|
|
39
|
+
1. Protect the code using industry-standard security practices;
|
|
40
|
+
2. Disclose it only to employees or contractors with a legitimate need to know and who are bound by written confidentiality obligations at least as protective as this Agreement;
|
|
41
|
+
3. Use it only for the Authorized Purpose;
|
|
42
|
+
4. Not disclose it to any third party without Atum’s written consent;
|
|
43
|
+
5. Upon termination, immediately cease use, destroy all copies (including cached or compiled forms), and certify destruction to Atum.
|
|
44
|
+
|
|
45
|
+
## 6. Compliance and Security Requirements
|
|
46
|
+
Licensee must comply with:
|
|
47
|
+
- Atum’s security and technical standards for Payment Gateway integrations,
|
|
48
|
+
- Atum’s operational procedures for network participants,
|
|
49
|
+
- Key rotation, signing authority, and release-only settlement authority rules, and
|
|
50
|
+
- Any written security or technical notices issued by Atum.
|
|
51
|
+
|
|
52
|
+
Atum may audit Licensee’s technical implementation upon reasonable notice.
|
|
53
|
+
## 7. No Warranty
|
|
54
|
+
The Payment Gateway Client Code is provided “AS IS”, without any express or implied warranties. Atum does not warrant that the code will be error-free or suitable for any particular purpose.
|
|
55
|
+
## 8. Limitation of Liability
|
|
56
|
+
To the fullest extent permitted by law:
|
|
57
|
+
- Atum will not be liable for any indirect, incidental, special, or consequential damages;
|
|
58
|
+
- Atum’s total cumulative liability under this Agreement will not exceed $100.
|
|
59
|
+
## 9. Term and Termination
|
|
60
|
+
This Agreement is effective upon Licensee’s first access to the Repository and continues until:
|
|
61
|
+
1. Terminated by either party with 10 days’ written notice;
|
|
62
|
+
2. Automatically terminated if Licensee ceases to be an authorized Credit Coop participant on Atum’s network; or
|
|
63
|
+
3. Automatically terminated upon any breach of Sections 2–6.
|
|
64
|
+
Upon termination:
|
|
65
|
+
- All rights granted hereunder immediately cease;
|
|
66
|
+
- Licensee must stop using the Payment Gateway Client Code;
|
|
67
|
+
- Licensee must destroy all copies and derivatives and certify destruction upon request.
|
|
68
|
+
The following provisions survive termination:
|
|
69
|
+
- Confidentiality (Section 5)
|
|
70
|
+
- Security & Compliance Obligations (Section 6)
|
|
71
|
+
- Ownership (Section 4)
|
|
72
|
+
- Restrictions (Section 3)
|
|
73
|
+
- No Warranty (Section 7)
|
|
74
|
+
- Limitation of Liability (Section 8)
|
|
75
|
+
- Governing Law (Section 10)
|
|
76
|
+
- Any provisions intended by their nature to survive
|
|
77
|
+
## 10. Governing Law
|
|
78
|
+
Delaware law governs this Agreement.
|
|
79
|
+
## 11. Entire Agreement
|
|
80
|
+
This Agreement constitutes the entire agreement between the parties relating to the Payment Gateway Client Code and supersedes all prior or contemporaneous agreements specific to such access.
|
|
81
|
+
|
|
82
|
+
ATUM LABS, INC.
|
|
83
|
+
All rights reserved.
|
package/README.md
ADDED
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
# Payment Gateway Client
|
|
2
|
+
|
|
3
|
+
TypeScript client for Atum Payment Gateway API with CLI support.
|
|
4
|
+
|
|
5
|
+
> NOTE: Payments from EVM chains require prior ERC-20 approval on the source token for the Permit2 contract (0x000000000022D473030F116dDEE9F6B43aC78BA3 on virtually all EVM chains).
|
|
6
|
+
>
|
|
7
|
+
> (And the same applies for Tron/TRC-20, with a Permit2 address of TJhMXTHQHeQyMD7TcKQFqAePNgG4b31H9m on mainnet or TPUqJPASUn1zLvbLBgRZ5pBYrx7WSe5ahp on Shasta)`)
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
The package can be published to npm or to GitHub Packages (same artifact). Install
|
|
12
|
+
from whichever registry it was published to.
|
|
13
|
+
|
|
14
|
+
### From npm (public)
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install @atum-labs/payment-gateway-client
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### From GitHub Packages (private)
|
|
21
|
+
|
|
22
|
+
Point the `@atum-labs` scope at GitHub's npm registry and authenticate with a
|
|
23
|
+
classic personal access token that has the `read:packages` scope. Add an `.npmrc`
|
|
24
|
+
in your project (or `~/.npmrc`):
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
@atum-labs:registry=https://npm.pkg.github.com
|
|
28
|
+
//npm.pkg.github.com/:_authToken=YOUR_GITHUB_TOKEN
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Then `npm install @atum-labs/payment-gateway-client`. Your GitHub account must
|
|
32
|
+
have been granted read access to the package.
|
|
33
|
+
|
|
34
|
+
Either way this also installs the `send-payment`, `request-quote`,
|
|
35
|
+
`quote-status`, and `payment-status` CLI commands.
|
|
36
|
+
|
|
37
|
+
### From source (monorepo)
|
|
38
|
+
|
|
39
|
+
payment-gateway-client lives inside the protocol monorepo. To work on it from source:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
git clone https://github.com/Atum-Labs/protocol.git
|
|
43
|
+
cd protocol
|
|
44
|
+
|
|
45
|
+
# Install the workspace with pnpm. This builds payment-gateway-client and its
|
|
46
|
+
# in-repo deps (km-core, turnkey-signer, solana-escrow-encoding) via the workspace:
|
|
47
|
+
pnpm install
|
|
48
|
+
|
|
49
|
+
# (Optional) expose the CLI globally:
|
|
50
|
+
cd payment-gateway-client && pnpm link --global
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## CLI Usage
|
|
54
|
+
|
|
55
|
+
After linking, the `send-payment` command is available globally:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
send-payment [options] <sender> <amount> <sourceAsset> <receiver> <destinationAsset>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Arguments
|
|
62
|
+
|
|
63
|
+
- `sender` - Depositor address (e.g., `0xF0D0...`)
|
|
64
|
+
- `amount` - Amount to send in smallest units (e.g., `100000` for 0.10 USDC)
|
|
65
|
+
- `sourceAsset` - Source asset in CAIP-19 format
|
|
66
|
+
- `receiver` - Destination account address
|
|
67
|
+
- `destinationAsset` - Destination asset in CAIP-19 format
|
|
68
|
+
|
|
69
|
+
### Options
|
|
70
|
+
|
|
71
|
+
- `-V, --version` - Output the version number
|
|
72
|
+
- `--gateway <url>` - Payment gateway URL (default: testnet)
|
|
73
|
+
- `--request-id <id>` - Custom request ID (overrides prefix)
|
|
74
|
+
- `--request-id-prefix <prefix>` - Custom request ID prefix (default: `pmt-gw-cli`)
|
|
75
|
+
- `-h, --help` - Display help
|
|
76
|
+
|
|
77
|
+
### CAIP-19 Asset Format Examples
|
|
78
|
+
|
|
79
|
+
- **EVM ERC20**: `eip155:42161/erc20:0xaf88d065e77c8cC2239327C5EDb3A432268e5831`
|
|
80
|
+
- **Tron TRC20**: `tron:shasta/trc20:TG3XXyExBkPp9nzdajDZsozEu4BkaSJozs`
|
|
81
|
+
|
|
82
|
+
### Signing provider
|
|
83
|
+
|
|
84
|
+
Choose how the sender authorization is signed with `--provider` (default: `raw`).
|
|
85
|
+
|
|
86
|
+
#### Private key (`--provider raw`, default)
|
|
87
|
+
|
|
88
|
+
Provide your private key via environment variable:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
PRIVATE_KEY=0x... send-payment <args...>
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
If not provided, you will be prompted securely.
|
|
95
|
+
|
|
96
|
+
#### Turnkey (`--provider turnkey`)
|
|
97
|
+
|
|
98
|
+
Sign via a Turnkey-managed wallet instead of a local private key. Set the
|
|
99
|
+
Turnkey credentials in the environment; the `<sender>` argument is verified
|
|
100
|
+
against the wallet's address for the source chain (a mismatch fails fast):
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
export TURNKEY_ORGANIZATION_ID=...
|
|
104
|
+
export TURNKEY_WALLET_ID=...
|
|
105
|
+
export TURNKEY_API_PUBLIC_KEY=...
|
|
106
|
+
export TURNKEY_API_PRIVATE_KEY=...
|
|
107
|
+
send-payment --provider turnkey <args...>
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Turnkey signing uses the shared `@atum-labs/turnkey-signer` (and `@atum-labs/km-core`),
|
|
111
|
+
which live in this monorepo under `key-management/` and are consumed as pnpm workspace
|
|
112
|
+
packages (`workspace:*`), built locally by the `build:deps` step. `@solana/web3.js` and
|
|
113
|
+
the other Turnkey deps are already declared, so no extra setup is required.
|
|
114
|
+
|
|
115
|
+
Notes:
|
|
116
|
+
- The shared packages are workspace members, so a root `pnpm install` links them, and
|
|
117
|
+
`pnpm run build` and `pnpm test` build them first (`build:deps`).
|
|
118
|
+
- The Turnkey code is loaded lazily (`import('./turnkey-impl')`), so the private-key
|
|
119
|
+
path never pulls in Turnkey or `@solana/web3.js`.
|
|
120
|
+
- For publishing, the build (tsup) bundles the shared `@atum-labs/*` packages directly
|
|
121
|
+
into `dist`, so the published package is self-contained with no `@atum-labs/*` runtime
|
|
122
|
+
dependencies. The siblings stay `workspace:*` devDependencies used only at build time.
|
|
123
|
+
|
|
124
|
+
### Output
|
|
125
|
+
|
|
126
|
+
- **PaymentRequest JSON** → `stderr` (for debugging/logging)
|
|
127
|
+
- **PaymentResponse JSON** → `stdout` (for parsing/automation)
|
|
128
|
+
|
|
129
|
+
### Example
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
PRIVATE_KEY=0xabc... send-payment \
|
|
133
|
+
0xF0D0... \
|
|
134
|
+
100000 \
|
|
135
|
+
eip155:42161/erc20:0xaf88d065e77c8cC2239327C5EDb3A432268e5831 \
|
|
136
|
+
TRX123... \
|
|
137
|
+
tron:shasta/trc20:TG3XXyExBkPp9nzdajDZsozEu4BkaSJozs
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Unlinking
|
|
141
|
+
|
|
142
|
+
To remove the global CLI command:
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
npm unlink -g @atum-labs/payment-gateway-client
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## SDK Usage
|
|
149
|
+
|
|
150
|
+
### Basic Setup
|
|
151
|
+
|
|
152
|
+
```typescript
|
|
153
|
+
import {
|
|
154
|
+
PaymentGatewayClient,
|
|
155
|
+
type PaymentResponse,
|
|
156
|
+
ApiError
|
|
157
|
+
} from '@atum-labs/payment-gateway-client';
|
|
158
|
+
import { ethers } from 'ethers';
|
|
159
|
+
|
|
160
|
+
const client = new PaymentGatewayClient({
|
|
161
|
+
BASE: 'https://payment-gateway.atumlabs.xyz' // or your gateway URL
|
|
162
|
+
});
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### Example: Tron to Celo Sepolia Payment
|
|
166
|
+
|
|
167
|
+
```typescript
|
|
168
|
+
async function sendPayment() {
|
|
169
|
+
// Private key from environment variable
|
|
170
|
+
const privateKey = process.env.PRIVATE_KEY;
|
|
171
|
+
if (!privateKey) {
|
|
172
|
+
throw new Error('PRIVATE_KEY environment variable required');
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// Tron sender address (base58 format)
|
|
176
|
+
const tronSender = 'TYourTronAddressHere';
|
|
177
|
+
|
|
178
|
+
// Prepare the payment request
|
|
179
|
+
const paymentRequest = await client.preparePaymentRequest({
|
|
180
|
+
depositor: tronSender,
|
|
181
|
+
fulfillmentAmount: '100000', // 0.10 USDT (6 decimals)
|
|
182
|
+
sourceAsset: 'tron:shasta/trc20:TG3XXyExBkPp9nzdajDZsozEu4BkaSJozs', // USDT on Tron Shasta
|
|
183
|
+
destinationAccount: '0xYourEthereumAddressHere',
|
|
184
|
+
destinationAsset: 'eip155:11142220/erc20:0x456a3D042C0DbD3db53D5489e98dFb038553B0d0' // USDC on Celo Sepolia
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
// Sign the message (Tron uses the same signing as Ethereum, but without the 0x private key prefix)
|
|
188
|
+
const wallet = new ethers.Wallet(privateKey.replace(/^0x/, ''));
|
|
189
|
+
paymentRequest.sender_auth.signed_messages[0].signature =
|
|
190
|
+
wallet.signingKey.sign(
|
|
191
|
+
paymentRequest.sender_auth.signed_messages[0].message
|
|
192
|
+
).serialized;
|
|
193
|
+
|
|
194
|
+
try {
|
|
195
|
+
// Submit the payment
|
|
196
|
+
const response = await client.payments.submitPayment({
|
|
197
|
+
requestBody: paymentRequest
|
|
198
|
+
}) as PaymentResponse;
|
|
199
|
+
|
|
200
|
+
console.log('Payment successful!');
|
|
201
|
+
console.log('Payment ID:', response.payment_id);
|
|
202
|
+
console.log('Source TX:', response.fulfillment_confirmation?.source_tx_hash);
|
|
203
|
+
console.log('Destination TX:', response.fulfillment_confirmation?.destination_tx_hash);
|
|
204
|
+
|
|
205
|
+
return response;
|
|
206
|
+
} catch (error) {
|
|
207
|
+
if (error instanceof ApiError) {
|
|
208
|
+
console.error('API Error:', error.status, error.statusText);
|
|
209
|
+
console.error('Response:', error.body);
|
|
210
|
+
}
|
|
211
|
+
throw error;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### Error Handling
|
|
217
|
+
|
|
218
|
+
The SDK provides detailed error information through the `ApiError` type:
|
|
219
|
+
|
|
220
|
+
```typescript
|
|
221
|
+
catch (error) {
|
|
222
|
+
if (error instanceof ApiError) {
|
|
223
|
+
console.error('Status:', error.status);
|
|
224
|
+
console.error('Status Text:', error.statusText);
|
|
225
|
+
console.error('URL:', error.url);
|
|
226
|
+
console.error('Response Body:', error.body);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### Asset Identifiers
|
|
232
|
+
|
|
233
|
+
Assets are identified using the [CAIP-19](https://chainagnostic.org/CAIPs/caip-19) format:
|
|
234
|
+
- Format: `{chain_id}/{asset_namespace}:{asset_reference}`
|
|
235
|
+
- Tron example: `tron:shasta/trc20:TG3XXyExBkPp9nzdajDZsozEu4BkaSJozs`
|
|
236
|
+
- EVM example: `eip155:11142220/erc20:0x456a3D042C0DbD3db53D5489e98dFb038553B0d0`
|
|
237
|
+
|
|
238
|
+
## Package Structure
|
|
239
|
+
|
|
240
|
+
- `src/` - Source TypeScript files
|
|
241
|
+
- `generated/` - Auto-generated API client from OpenAPI spec
|
|
242
|
+
- `cli/` - CLI implementation
|
|
243
|
+
- `dist/` - Pre-compiled JavaScript (ready to use)
|
|
244
|
+
|
|
245
|
+
---
|
|
246
|
+
|
|
247
|
+
This repository contains proprietary Atum Labs code. Access is restricted and governed by the Private Repository License included in this repo.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|