@rozoai/intent-common 0.0.32-beta.1 → 0.0.32-beta.2
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/README.md +134 -0
- package/dist/api/base.d.ts +1 -1
- package/dist/api/base.js +2 -1
- package/dist/api/base.js.map +1 -1
- package/dist/api/fee.d.ts +2 -1
- package/dist/api/fee.js +5 -1
- package/dist/api/fee.js.map +1 -1
- package/dist/api/new-payment.d.ts +319 -0
- package/dist/api/new-payment.js +140 -0
- package/dist/api/new-payment.js.map +1 -0
- package/dist/api/payment.d.ts +102 -4
- package/dist/api/payment.js +117 -10
- package/dist/api/payment.js.map +1 -1
- package/dist/bridge.d.ts +82 -45
- package/dist/bridge.js +142 -168
- package/dist/bridge.js.map +1 -1
- package/dist/chain.d.ts +6 -0
- package/dist/chain.js +38 -14
- package/dist/chain.js.map +1 -1
- package/dist/daimoPay.d.ts +9 -9
- package/dist/daimoPay.js +5 -0
- package/dist/daimoPay.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/token.d.ts +9 -0
- package/dist/token.js +111 -17
- package/dist/token.js.map +1 -1
- package/dist/validation.d.ts +9 -0
- package/dist/validation.js +47 -0
- package/dist/validation.js.map +1 -0
- package/package.json +4 -2
- package/src/api/base.ts +3 -1
- package/src/api/fee.ts +8 -2
- package/src/api/new-payment.ts +433 -0
- package/src/api/payment.ts +162 -8
- package/src/bridge.ts +176 -200
- package/src/chain.ts +40 -13
- package/src/daimoPay.ts +17 -9
- package/src/index.ts +2 -0
- package/src/token.ts +124 -18
- package/src/validation.ts +54 -0
- package/test/bridge.test.ts +393 -0
- package/dist/chainAddress.d.ts +0 -27
- package/dist/chainAddress.js +0 -87
- package/dist/chainAddress.js.map +0 -1
- package/dist/supportedChain.d.ts +0 -27
- package/dist/supportedChain.js +0 -87
- package/dist/supportedChain.js.map +0 -1
- package/dist/supportedChains.d.ts +0 -27
- package/dist/supportedChains.js +0 -87
- package/dist/supportedChains.js.map +0 -1
package/README.md
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# @rozoai/intent-common
|
|
2
|
+
|
|
3
|
+
Shared types and utilities for RozoAI Intent Pay SDK.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @rozoai/intent-common
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
### Payment API (Recommended)
|
|
14
|
+
|
|
15
|
+
Use the new payment API for all new integrations:
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
import { createNewPayment, getNewPayment } from "@rozoai/intent-common";
|
|
19
|
+
|
|
20
|
+
// Create a payment
|
|
21
|
+
const payment = await createNewPayment({
|
|
22
|
+
appId: "your-app-id",
|
|
23
|
+
toChain: 8453, // Base
|
|
24
|
+
toToken: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", // Base USDC
|
|
25
|
+
toAddress: "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
|
|
26
|
+
preferredChain: 8453,
|
|
27
|
+
preferredTokenAddress: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
|
|
28
|
+
toUnits: "1",
|
|
29
|
+
title: "Payment",
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
// Get payment status
|
|
33
|
+
const status = await getNewPayment(payment.id);
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Prior Payment API (Legacy)
|
|
37
|
+
|
|
38
|
+
The legacy payment API (`createRozoPayment`, `getRozoPayment`) is still available but deprecated. Use the new API above for new integrations.
|
|
39
|
+
|
|
40
|
+
## Core Exports
|
|
41
|
+
|
|
42
|
+
### Payment Bridge
|
|
43
|
+
|
|
44
|
+
Configure cross-chain payment routing:
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
import { createPaymentBridgeConfig } from "@rozoai/intent-common";
|
|
48
|
+
|
|
49
|
+
const { preferred, destination } = createPaymentBridgeConfig({
|
|
50
|
+
toChain: 8453,
|
|
51
|
+
toToken: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
|
|
52
|
+
toAddress: "0x...",
|
|
53
|
+
toUnits: "1000000",
|
|
54
|
+
preferredChain: 137,
|
|
55
|
+
preferredTokenAddress: "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",
|
|
56
|
+
});
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Chains & Tokens
|
|
60
|
+
|
|
61
|
+
```typescript
|
|
62
|
+
import {
|
|
63
|
+
base,
|
|
64
|
+
polygon,
|
|
65
|
+
baseUSDC,
|
|
66
|
+
polygonUSDCe,
|
|
67
|
+
getChainById,
|
|
68
|
+
getKnownToken,
|
|
69
|
+
} from "@rozoai/intent-common";
|
|
70
|
+
|
|
71
|
+
// Chain info
|
|
72
|
+
const chain = getChainById(8453); // Base chain
|
|
73
|
+
|
|
74
|
+
// Token info
|
|
75
|
+
const token = getKnownToken(8453, "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913");
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Supported Chains & Tokens
|
|
79
|
+
|
|
80
|
+
Based on `supportedTokens` Map in the codebase:
|
|
81
|
+
|
|
82
|
+
| Chain | Chain ID | Constant | Type | Supported Tokens |
|
|
83
|
+
| ------------ | -------- | ------------- | ------- | ---------------- |
|
|
84
|
+
| Arbitrum | 42161 | `arbitrum` | EVM | USDC, USDT |
|
|
85
|
+
| Avalanche | 43114 | `avalanche` | EVM | USDC, USDT |
|
|
86
|
+
| Base | 8453 | `base` | EVM | USDC |
|
|
87
|
+
| Ethereum | 1 | `ethereum` | EVM | USDC, USDT |
|
|
88
|
+
| Gnosis | 100 | `gnosis` | EVM | USDC, USDT |
|
|
89
|
+
| Optimism | 10 | `optimism` | EVM | USDC, USDT |
|
|
90
|
+
| Polygon | 137 | `polygon` | EVM | USDC, USDT |
|
|
91
|
+
| Rozo Solana | 900 | `rozoSolana` | Solana | USDC, USDT |
|
|
92
|
+
| Rozo Stellar | 1500 | `rozoStellar` | Stellar | USDC |
|
|
93
|
+
|
|
94
|
+
### Token Constants
|
|
95
|
+
|
|
96
|
+
| Token | Chain | Constant |
|
|
97
|
+
| ----- | ------------ | ----------------- |
|
|
98
|
+
| USDC | Arbitrum | `arbitrumUSDC` |
|
|
99
|
+
| USDT | Arbitrum | `arbitrumUSDT` |
|
|
100
|
+
| USDC | Avalanche | `avalancheUSDC` |
|
|
101
|
+
| USDT | Avalanche | `avalancheUSDT` |
|
|
102
|
+
| USDC | Base | `baseUSDC` |
|
|
103
|
+
| USDC | Ethereum | `ethereumUSDC` |
|
|
104
|
+
| USDT | Ethereum | `ethereumUSDT` |
|
|
105
|
+
| USDC | Gnosis | `gnosisUSDC` |
|
|
106
|
+
| USDT | Gnosis | `gnosisUSDT` |
|
|
107
|
+
| USDC | Optimism | `optimismUSDC` |
|
|
108
|
+
| USDT | Optimism | `optimismUSDT` |
|
|
109
|
+
| USDC | Polygon | `polygonUSDC` |
|
|
110
|
+
| USDT | Polygon | `polygonUSDT` |
|
|
111
|
+
| USDC | Rozo Solana | `rozoSolanaUSDC` |
|
|
112
|
+
| USDT | Rozo Solana | `rozoSolanaUSDT` |
|
|
113
|
+
| USDC | Rozo Stellar | `rozoStellarUSDC` |
|
|
114
|
+
|
|
115
|
+
**Example:**
|
|
116
|
+
|
|
117
|
+
```typescript
|
|
118
|
+
import { base, baseUSDC, polygon, polygonUSDC } from "@rozoai/intent-common";
|
|
119
|
+
|
|
120
|
+
// Use in payment config
|
|
121
|
+
const payment = await createNewPayment({
|
|
122
|
+
toChain: base.chainId, // or 8453
|
|
123
|
+
toToken: baseUSDC.token, // or "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
|
|
124
|
+
// ...
|
|
125
|
+
});
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## TypeScript Support
|
|
129
|
+
|
|
130
|
+
Full TypeScript definitions included. All exports are typed.
|
|
131
|
+
|
|
132
|
+
## License
|
|
133
|
+
|
|
134
|
+
BSD-2-Clause
|
package/dist/api/base.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* RozoAI API Configuration Constants
|
|
3
3
|
*/
|
|
4
|
-
export declare const ROZO_API_URL = "https://
|
|
4
|
+
export declare const ROZO_API_URL = "https://aozudqtlykbhzbuzalzz.supabase.co/functions/v1";
|
|
5
5
|
export declare const ROZO_API_TOKEN = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImZ4Y3Zmb2xobmNtdXZmYXp1cXViIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTI4Mzg2NjYsImV4cCI6MjA2ODQxNDY2Nn0.B4dV5y_-zCMKSNm3_qyCbAvCPJmoOGv_xB783LfAVUA";
|
|
6
6
|
export type HttpMethod = "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
|
|
7
7
|
export interface RequestOptions {
|
package/dist/api/base.js
CHANGED
|
@@ -4,7 +4,8 @@ exports.apiClient = exports.fetchApi = exports.getApiConfig = exports.setApiConf
|
|
|
4
4
|
/**
|
|
5
5
|
* RozoAI API Configuration Constants
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
// export const ROZO_API_URL = "https://intentapiv2.rozo.ai/functions/v1";
|
|
8
|
+
exports.ROZO_API_URL = "https://aozudqtlykbhzbuzalzz.supabase.co/functions/v1";
|
|
8
9
|
exports.ROZO_API_TOKEN = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImZ4Y3Zmb2xobmNtdXZmYXp1cXViIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTI4Mzg2NjYsImV4cCI6MjA2ODQxNDY2Nn0.B4dV5y_-zCMKSNm3_qyCbAvCPJmoOGv_xB783LfAVUA";
|
|
9
10
|
// Default configuration (can be overridden via setApiConfig)
|
|
10
11
|
let apiConfig = {
|
package/dist/api/base.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/api/base.ts"],"names":[],"mappings":";;;AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/api/base.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,0EAA0E;AAC7D,QAAA,YAAY,GACvB,uDAAuD,CAAC;AAC7C,QAAA,cAAc,GACzB,kNAAkN,CAAC;AAoCrN,6DAA6D;AAC7D,IAAI,SAAS,GAAc;IACzB,OAAO,EAAE,oBAAY;IACrB,QAAQ,EAAE,sBAAc;CACzB,CAAC;AAEF;;;GAGG;AACI,MAAM,YAAY,GAAG,CAAC,MAA0B,EAAE,EAAE;IACzD,SAAS,GAAG,EAAE,GAAG,SAAS,EAAE,GAAG,MAAM,EAAE,CAAC;AAC1C,CAAC,CAAC;AAFW,QAAA,YAAY,gBAEvB;AAEF;;;GAGG;AACI,MAAM,YAAY,GAAG,GAAc,EAAE;IAC1C,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAFW,QAAA,YAAY,gBAEvB;AAEF;;;;;GAKG;AACH,MAAM,SAAS,GAAG,CAAC,GAAW,EAAE,MAA+B,EAAU,EAAE;IACzE,MAAM,OAAO,GAAG,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC;QACjC,CAAC,CAAC,GAAG,SAAS,CAAC,OAAO,GAAG,GAAG,EAAE;QAC9B,CAAC,CAAC,GAAG,SAAS,CAAC,OAAO,IAAI,GAAG,EAAE,CAAC;IAElC,IAAI,CAAC,MAAM;QAAE,OAAO,OAAO,CAAC;IAE5B,MAAM,WAAW,GAAG,IAAI,eAAe,EAAE,CAAC;IAC1C,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,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,GAAG,EAAE,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IAE3D;;;;;;OAMG;IACH,GAAG,EAAE,CACH,GAAW,EACX,IAAS,EACT,UAAmD,EAAE,EACrD,EAAE,CAAC,IAAA,gBAAQ,EAAI,GAAG,EAAE,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IAE1D;;;;;;OAMG;IACH,KAAK,EAAE,CACL,GAAW,EACX,IAAS,EACT,UAAmD,EAAE,EACrD,EAAE,CAAC,IAAA,gBAAQ,EAAI,GAAG,EAAE,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAE5D;;;;;OAKG;IACH,MAAM,EAAE,CACN,GAAW,EACX,UAA0C,EAAE,EAC5C,EAAE,CAAC,IAAA,gBAAQ,EAAI,GAAG,EAAE,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;CACxD,CAAC"}
|
package/dist/api/fee.d.ts
CHANGED
package/dist/api/fee.js
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getFee = void 0;
|
|
4
|
+
const chain_1 = require("../chain");
|
|
4
5
|
/**
|
|
5
6
|
* Gets fee calculation for a payment amount
|
|
6
7
|
* @param params - Fee calculation parameters (amount is required)
|
|
7
8
|
* @returns Promise with fee response or error
|
|
8
9
|
*/
|
|
9
10
|
const getFee = async (params) => {
|
|
10
|
-
const { amount, appId
|
|
11
|
+
const { amount, appId, currency = "USDC", toChain } = params;
|
|
11
12
|
try {
|
|
13
|
+
const chain = (0, chain_1.getChainById)(toChain);
|
|
14
|
+
const toChainName = chain.name.toLowerCase();
|
|
12
15
|
const queryParams = new URLSearchParams({
|
|
13
16
|
amount: amount.toString(),
|
|
14
17
|
appId,
|
|
15
18
|
currency,
|
|
19
|
+
tochain: toChainName,
|
|
16
20
|
});
|
|
17
21
|
const response = await fetch(`https://intentapi.rozo.ai/getFee?${queryParams.toString()}`);
|
|
18
22
|
const data = (await response.json());
|
package/dist/api/fee.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fee.js","sourceRoot":"","sources":["../../src/api/fee.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"fee.js","sourceRoot":"","sources":["../../src/api/fee.ts"],"names":[],"mappings":";;;AAAA,oCAAwC;AAoCxC;;;;GAIG;AACI,MAAM,MAAM,GAAG,KAAK,EACzB,MAAoB,EACmB,EAAE;IACzC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,GAAG,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;IAE7D,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,IAAA,oBAAY,EAAC,OAAO,CAAC,CAAC;QACpC,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;QAE7C,MAAM,WAAW,GAAG,IAAI,eAAe,CAAC;YACtC,MAAM,EAAE,MAAM,CAAC,QAAQ,EAAE;YACzB,KAAK;YACL,QAAQ;YACR,OAAO,EAAE,WAAW;SACrB,CAAC,CAAC;QAEH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAC1B,oCAAoC,WAAW,CAAC,QAAQ,EAAE,EAAE,CAC7D,CAAC;QAEF,MAAM,IAAI,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAmC,CAAC;QAEvE,sCAAsC;QACtC,IAAI,CAAC,QAAQ,CAAC,EAAE,IAAI,OAAO,IAAI,IAAI,EAAE,CAAC;YACpC,MAAM,SAAS,GAAG,IAAoB,CAAC;YACvC,OAAO;gBACL,IAAI,EAAE,IAAI;gBACV,KAAK,EAAE,IAAI,KAAK,CAAC,SAAS,CAAC,OAAO,IAAI,SAAS,CAAC,KAAK,CAAC;gBACtD,MAAM,EAAE,QAAQ,CAAC,MAAM;aACxB,CAAC;QACJ,CAAC;QAED,OAAO;YACL,IAAI,EAAE,IAAuB;YAC7B,KAAK,EAAE,IAAI;YACX,MAAM,EAAE,QAAQ,CAAC,MAAM;SACxB,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,IAAI,EAAE,IAAI;YACV,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAChE,MAAM,EAAE,IAAI;SACb,CAAC;IACJ,CAAC;AACH,CAAC,CAAC;AA5CW,QAAA,MAAM,UA4CjB"}
|
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
import { ApiResponse } from "./base";
|
|
2
|
+
/**
|
|
3
|
+
* FeeType, Fee calculation type:
|
|
4
|
+
* - exactIn (default): Fee deducted from input, recipient receives amount - fee
|
|
5
|
+
* - exactOut: Fee added to input, recipient receives exact amount
|
|
6
|
+
*/
|
|
7
|
+
export declare enum FeeType {
|
|
8
|
+
ExactIn = "exactIn",
|
|
9
|
+
ExactOut = "exactOut"
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* PaymentStatus, Payment status
|
|
13
|
+
*/
|
|
14
|
+
export declare enum PaymentStatus {
|
|
15
|
+
PaymentBounced = "payment_bounced",
|
|
16
|
+
PaymentCompleted = "payment_completed",
|
|
17
|
+
PaymentExpired = "payment_expired",
|
|
18
|
+
PaymentPayinCompleted = "payment_payin_completed",
|
|
19
|
+
PaymentPayoutCompleted = "payment_payout_completed",
|
|
20
|
+
PaymentRefunded = "payment_refunded",
|
|
21
|
+
PaymentStarted = "payment_started",
|
|
22
|
+
PaymentUnpaid = "payment_unpaid"
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* PaymentErrorCode, Error code (only present when status is payment_bounced)
|
|
26
|
+
*/
|
|
27
|
+
export declare enum PaymentErrorCode {
|
|
28
|
+
AmountTooHigh = "amountTooHigh",
|
|
29
|
+
AmountTooLow = "amountTooLow",
|
|
30
|
+
ChainUnavailable = "chainUnavailable",
|
|
31
|
+
InsufficientLiquidity = "insufficientLiquidity",
|
|
32
|
+
InvalidRecipient = "invalidRecipient",
|
|
33
|
+
MissingTrustline = "missingTrustline",
|
|
34
|
+
NetworkError = "networkError",
|
|
35
|
+
ProviderError = "providerError",
|
|
36
|
+
ServiceMaintenance = "serviceMaintenance"
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* DestinationRequest
|
|
40
|
+
*/
|
|
41
|
+
export interface DestinationRequest {
|
|
42
|
+
/**
|
|
43
|
+
* Receive amount (required for type=exactOut).
|
|
44
|
+
* For exactIn, this field is omitted in request and calculated in response.
|
|
45
|
+
*/
|
|
46
|
+
amount?: string;
|
|
47
|
+
chainId: number;
|
|
48
|
+
/**
|
|
49
|
+
* Final recipient's wallet address
|
|
50
|
+
*/
|
|
51
|
+
receiverAddress: string;
|
|
52
|
+
/**
|
|
53
|
+
* Memo for Stellar/Solana destinations
|
|
54
|
+
*/
|
|
55
|
+
receiverMemo?: string;
|
|
56
|
+
/**
|
|
57
|
+
* Override default token address
|
|
58
|
+
*/
|
|
59
|
+
tokenAddress?: string;
|
|
60
|
+
tokenSymbol: string;
|
|
61
|
+
[property: string]: any;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* DisplayInfo
|
|
65
|
+
*/
|
|
66
|
+
export interface DisplayInfo {
|
|
67
|
+
/**
|
|
68
|
+
* Display currency
|
|
69
|
+
*/
|
|
70
|
+
currency: string;
|
|
71
|
+
/**
|
|
72
|
+
* Detailed description
|
|
73
|
+
*/
|
|
74
|
+
description?: string;
|
|
75
|
+
/**
|
|
76
|
+
* Short title
|
|
77
|
+
*/
|
|
78
|
+
title: string;
|
|
79
|
+
[property: string]: any;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* SourceRequest
|
|
83
|
+
*/
|
|
84
|
+
export interface SourceRequest {
|
|
85
|
+
/**
|
|
86
|
+
* Pay-in amount (required for type=exactIn).
|
|
87
|
+
* For exactOut, this field is omitted in request and calculated in response.
|
|
88
|
+
*/
|
|
89
|
+
amount?: string;
|
|
90
|
+
chainId: number;
|
|
91
|
+
/**
|
|
92
|
+
* Override default token address
|
|
93
|
+
*/
|
|
94
|
+
tokenAddress?: string;
|
|
95
|
+
tokenSymbol: string;
|
|
96
|
+
[property: string]: any;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* PaymentRequest
|
|
100
|
+
*/
|
|
101
|
+
export interface CreatePaymentRequest {
|
|
102
|
+
/**
|
|
103
|
+
* Your application ID
|
|
104
|
+
*/
|
|
105
|
+
appId: string;
|
|
106
|
+
destination: DestinationRequest;
|
|
107
|
+
display: DisplayInfo;
|
|
108
|
+
/**
|
|
109
|
+
* Custom metadata (max 4 KB recommended)
|
|
110
|
+
*/
|
|
111
|
+
metadata?: {
|
|
112
|
+
[key: string]: any;
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* Your order reference ID (for idempotency)
|
|
116
|
+
*/
|
|
117
|
+
orderId?: string;
|
|
118
|
+
source: SourceRequest;
|
|
119
|
+
type?: FeeType;
|
|
120
|
+
/**
|
|
121
|
+
* Secret for HMAC-SHA256 signature verification.
|
|
122
|
+
* If not provided, a unique secret is auto-generated.
|
|
123
|
+
* The secret is returned in the response for you to store and use for verification.
|
|
124
|
+
*/
|
|
125
|
+
webhookSecret?: string;
|
|
126
|
+
/**
|
|
127
|
+
* URL to receive payment status updates
|
|
128
|
+
*/
|
|
129
|
+
webhookUrl?: string;
|
|
130
|
+
[property: string]: any;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* DestinationResponse
|
|
134
|
+
*/
|
|
135
|
+
export interface DestinationResponse {
|
|
136
|
+
/**
|
|
137
|
+
* Amount to be sent to recipient
|
|
138
|
+
*/
|
|
139
|
+
amount?: string;
|
|
140
|
+
chainId?: number;
|
|
141
|
+
/**
|
|
142
|
+
* Withdrawal confirmation time
|
|
143
|
+
*/
|
|
144
|
+
confirmedAt?: Date;
|
|
145
|
+
/**
|
|
146
|
+
* Final recipient's wallet
|
|
147
|
+
*/
|
|
148
|
+
receiverAddress?: string;
|
|
149
|
+
/**
|
|
150
|
+
* Memo for Stellar/Solana
|
|
151
|
+
*/
|
|
152
|
+
receiverMemo?: string;
|
|
153
|
+
/**
|
|
154
|
+
* Token contract address
|
|
155
|
+
*/
|
|
156
|
+
tokenAddress?: string;
|
|
157
|
+
tokenSymbol?: string;
|
|
158
|
+
/**
|
|
159
|
+
* Withdrawal transaction hash
|
|
160
|
+
*/
|
|
161
|
+
txHash?: string;
|
|
162
|
+
[property: string]: any;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* SourceResponse
|
|
166
|
+
*/
|
|
167
|
+
export interface SourceResponse {
|
|
168
|
+
/**
|
|
169
|
+
* Amount payer must send
|
|
170
|
+
*/
|
|
171
|
+
amount?: string;
|
|
172
|
+
/**
|
|
173
|
+
* Actual amount received
|
|
174
|
+
*/
|
|
175
|
+
amountReceived?: string;
|
|
176
|
+
chainId?: number;
|
|
177
|
+
/**
|
|
178
|
+
* Deposit confirmation time
|
|
179
|
+
*/
|
|
180
|
+
confirmedAt?: Date;
|
|
181
|
+
/**
|
|
182
|
+
* Fee amount
|
|
183
|
+
*/
|
|
184
|
+
fee?: string;
|
|
185
|
+
/**
|
|
186
|
+
* Deposit address (where payer sends funds)
|
|
187
|
+
*/
|
|
188
|
+
receiverAddress?: string;
|
|
189
|
+
/**
|
|
190
|
+
* Memo for Stellar/Solana deposits
|
|
191
|
+
*/
|
|
192
|
+
receiverMemo?: string;
|
|
193
|
+
/**
|
|
194
|
+
* Payer's wallet address (populated after deposit)
|
|
195
|
+
*/
|
|
196
|
+
senderAddress?: string;
|
|
197
|
+
/**
|
|
198
|
+
* Token contract address
|
|
199
|
+
*/
|
|
200
|
+
tokenAddress?: string;
|
|
201
|
+
tokenSymbol?: string;
|
|
202
|
+
/**
|
|
203
|
+
* Deposit transaction hash
|
|
204
|
+
*/
|
|
205
|
+
txHash?: string;
|
|
206
|
+
[property: string]: any;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* PaymentResponse
|
|
210
|
+
*/
|
|
211
|
+
export interface PaymentResponse {
|
|
212
|
+
/**
|
|
213
|
+
* Your application ID
|
|
214
|
+
*/
|
|
215
|
+
appId?: string;
|
|
216
|
+
/**
|
|
217
|
+
* ISO 8601 timestamp
|
|
218
|
+
*/
|
|
219
|
+
createdAt?: Date;
|
|
220
|
+
destination?: DestinationResponse;
|
|
221
|
+
display?: DisplayInfo;
|
|
222
|
+
errorCode?: PaymentErrorCode;
|
|
223
|
+
/**
|
|
224
|
+
* ISO 8601 timestamp (when payment expires)
|
|
225
|
+
*/
|
|
226
|
+
expiresAt?: Date;
|
|
227
|
+
/**
|
|
228
|
+
* Payment ID
|
|
229
|
+
*/
|
|
230
|
+
id?: string;
|
|
231
|
+
metadata?: {
|
|
232
|
+
[key: string]: any;
|
|
233
|
+
};
|
|
234
|
+
/**
|
|
235
|
+
* Your order reference ID
|
|
236
|
+
*/
|
|
237
|
+
orderId?: string;
|
|
238
|
+
source?: SourceResponse;
|
|
239
|
+
status?: PaymentStatus;
|
|
240
|
+
type?: FeeType;
|
|
241
|
+
/**
|
|
242
|
+
* ISO 8601 timestamp
|
|
243
|
+
*/
|
|
244
|
+
updatedAt?: Date;
|
|
245
|
+
/**
|
|
246
|
+
* Secret for webhook signature verification.
|
|
247
|
+
* Only present when webhookUrl was provided in the request.
|
|
248
|
+
* Store this securely to verify incoming webhook signatures.
|
|
249
|
+
*/
|
|
250
|
+
webhookSecret?: string;
|
|
251
|
+
[property: string]: any;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Parameters for creating a new payment using the new backend interface
|
|
255
|
+
*/
|
|
256
|
+
export interface CreateNewPaymentParams {
|
|
257
|
+
/** App ID for authentication */
|
|
258
|
+
appId: string;
|
|
259
|
+
/** Destination chain ID (e.g., 8453 for Base, 900 for Solana, 1500 for Stellar) */
|
|
260
|
+
toChain: number;
|
|
261
|
+
/** Destination token address */
|
|
262
|
+
toToken: string;
|
|
263
|
+
/** Destination address - Can be EVM, Solana, or Stellar address */
|
|
264
|
+
toAddress: string;
|
|
265
|
+
/** Chain ID where user will pay from (e.g., 137 for Polygon, 8453 for Base) */
|
|
266
|
+
preferredChain: number;
|
|
267
|
+
/** Token address user will pay with */
|
|
268
|
+
preferredTokenAddress: string;
|
|
269
|
+
/** Amount in human-readable units (e.g., "1" for 1 USDC, "0.5" for half a USDC) */
|
|
270
|
+
toUnits?: string;
|
|
271
|
+
/** Additional metadata to include */
|
|
272
|
+
metadata?: Record<string, unknown>;
|
|
273
|
+
/** Display title for the payment */
|
|
274
|
+
title?: string;
|
|
275
|
+
/** Display description for the payment */
|
|
276
|
+
description?: string;
|
|
277
|
+
/** Order reference ID (for idempotency) */
|
|
278
|
+
orderId?: string;
|
|
279
|
+
/** Fee calculation type (exactIn or exactOut) */
|
|
280
|
+
type?: FeeType;
|
|
281
|
+
/** Webhook URL to receive payment status updates */
|
|
282
|
+
webhookUrl?: string;
|
|
283
|
+
/** Secret for HMAC-SHA256 signature verification */
|
|
284
|
+
webhookSecret?: string;
|
|
285
|
+
/** Memo for Stellar/Solana destinations */
|
|
286
|
+
receiverMemo?: string;
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Creates a payment using the new backend interface
|
|
290
|
+
*
|
|
291
|
+
* This function creates a payment using the new backend API structure with
|
|
292
|
+
* separate source and destination objects, enum-based chain IDs and token symbols.
|
|
293
|
+
*
|
|
294
|
+
* @param params - Payment creation parameters
|
|
295
|
+
* @returns Promise resolving to the payment response data
|
|
296
|
+
* @throws Error if payment creation fails or required parameters are missing
|
|
297
|
+
*
|
|
298
|
+
* @example
|
|
299
|
+
* ```typescript
|
|
300
|
+
* // Simple same-chain payment
|
|
301
|
+
* const payment = await createNewPayment({
|
|
302
|
+
* toChain: 8453, // Base
|
|
303
|
+
* toToken: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", // Base USDC
|
|
304
|
+
* toAddress: "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
|
|
305
|
+
* preferredChain: 8453, // User pays from Base
|
|
306
|
+
* preferredTokenAddress: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", // Base USDC
|
|
307
|
+
* toUnits: "1", // 1 USDC
|
|
308
|
+
* appId: "my-app-id",
|
|
309
|
+
* title: "Payment",
|
|
310
|
+
* });
|
|
311
|
+
* ```
|
|
312
|
+
*/
|
|
313
|
+
export declare function createNewPayment(params: CreateNewPaymentParams): Promise<PaymentResponse>;
|
|
314
|
+
/**
|
|
315
|
+
* Gets payment details by ID using the new backend API
|
|
316
|
+
* @param paymentId - Payment ID
|
|
317
|
+
* @returns Promise with payment response
|
|
318
|
+
*/
|
|
319
|
+
export declare const getNewPayment: (paymentId: string) => Promise<ApiResponse<PaymentResponse>>;
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getNewPayment = exports.PaymentErrorCode = exports.PaymentStatus = exports.FeeType = void 0;
|
|
4
|
+
exports.createNewPayment = createNewPayment;
|
|
5
|
+
const bridge_1 = require("../bridge");
|
|
6
|
+
const chain_1 = require("../chain");
|
|
7
|
+
const token_1 = require("../token");
|
|
8
|
+
const base_1 = require("./base");
|
|
9
|
+
/**
|
|
10
|
+
* FeeType, Fee calculation type:
|
|
11
|
+
* - exactIn (default): Fee deducted from input, recipient receives amount - fee
|
|
12
|
+
* - exactOut: Fee added to input, recipient receives exact amount
|
|
13
|
+
*/
|
|
14
|
+
var FeeType;
|
|
15
|
+
(function (FeeType) {
|
|
16
|
+
FeeType["ExactIn"] = "exactIn";
|
|
17
|
+
FeeType["ExactOut"] = "exactOut";
|
|
18
|
+
})(FeeType || (exports.FeeType = FeeType = {}));
|
|
19
|
+
/**
|
|
20
|
+
* PaymentStatus, Payment status
|
|
21
|
+
*/
|
|
22
|
+
var PaymentStatus;
|
|
23
|
+
(function (PaymentStatus) {
|
|
24
|
+
PaymentStatus["PaymentBounced"] = "payment_bounced";
|
|
25
|
+
PaymentStatus["PaymentCompleted"] = "payment_completed";
|
|
26
|
+
PaymentStatus["PaymentExpired"] = "payment_expired";
|
|
27
|
+
PaymentStatus["PaymentPayinCompleted"] = "payment_payin_completed";
|
|
28
|
+
PaymentStatus["PaymentPayoutCompleted"] = "payment_payout_completed";
|
|
29
|
+
PaymentStatus["PaymentRefunded"] = "payment_refunded";
|
|
30
|
+
PaymentStatus["PaymentStarted"] = "payment_started";
|
|
31
|
+
PaymentStatus["PaymentUnpaid"] = "payment_unpaid";
|
|
32
|
+
})(PaymentStatus || (exports.PaymentStatus = PaymentStatus = {}));
|
|
33
|
+
/**
|
|
34
|
+
* PaymentErrorCode, Error code (only present when status is payment_bounced)
|
|
35
|
+
*/
|
|
36
|
+
var PaymentErrorCode;
|
|
37
|
+
(function (PaymentErrorCode) {
|
|
38
|
+
PaymentErrorCode["AmountTooHigh"] = "amountTooHigh";
|
|
39
|
+
PaymentErrorCode["AmountTooLow"] = "amountTooLow";
|
|
40
|
+
PaymentErrorCode["ChainUnavailable"] = "chainUnavailable";
|
|
41
|
+
PaymentErrorCode["InsufficientLiquidity"] = "insufficientLiquidity";
|
|
42
|
+
PaymentErrorCode["InvalidRecipient"] = "invalidRecipient";
|
|
43
|
+
PaymentErrorCode["MissingTrustline"] = "missingTrustline";
|
|
44
|
+
PaymentErrorCode["NetworkError"] = "networkError";
|
|
45
|
+
PaymentErrorCode["ProviderError"] = "providerError";
|
|
46
|
+
PaymentErrorCode["ServiceMaintenance"] = "serviceMaintenance";
|
|
47
|
+
})(PaymentErrorCode || (exports.PaymentErrorCode = PaymentErrorCode = {}));
|
|
48
|
+
/**
|
|
49
|
+
* Creates a payment using the new backend interface
|
|
50
|
+
*
|
|
51
|
+
* This function creates a payment using the new backend API structure with
|
|
52
|
+
* separate source and destination objects, enum-based chain IDs and token symbols.
|
|
53
|
+
*
|
|
54
|
+
* @param params - Payment creation parameters
|
|
55
|
+
* @returns Promise resolving to the payment response data
|
|
56
|
+
* @throws Error if payment creation fails or required parameters are missing
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```typescript
|
|
60
|
+
* // Simple same-chain payment
|
|
61
|
+
* const payment = await createNewPayment({
|
|
62
|
+
* toChain: 8453, // Base
|
|
63
|
+
* toToken: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", // Base USDC
|
|
64
|
+
* toAddress: "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
|
|
65
|
+
* preferredChain: 8453, // User pays from Base
|
|
66
|
+
* preferredTokenAddress: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", // Base USDC
|
|
67
|
+
* toUnits: "1", // 1 USDC
|
|
68
|
+
* appId: "my-app-id",
|
|
69
|
+
* title: "Payment",
|
|
70
|
+
* });
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
async function createNewPayment(params) {
|
|
74
|
+
const { toChain, toToken, toAddress, preferredChain, preferredTokenAddress, toUnits, appId, metadata, title, description, orderId, type, webhookUrl, webhookSecret, receiverMemo, } = params;
|
|
75
|
+
// Create payment bridge configuration
|
|
76
|
+
const { preferred, destination } = (0, bridge_1.createPaymentBridgeConfig)({
|
|
77
|
+
toChain,
|
|
78
|
+
toToken,
|
|
79
|
+
toAddress,
|
|
80
|
+
toUnits: toUnits ?? "0",
|
|
81
|
+
// Preferred payment method (what user will pay with)
|
|
82
|
+
preferredChain,
|
|
83
|
+
preferredTokenAddress,
|
|
84
|
+
});
|
|
85
|
+
const sourceChain = (0, chain_1.getChainById)(Number(preferred.preferredChain));
|
|
86
|
+
const sourceToken = (0, token_1.getKnownToken)(Number(preferred.preferredChain), preferred.preferredToken);
|
|
87
|
+
const destinationChain = (0, chain_1.getChainById)(Number(destination.chainId));
|
|
88
|
+
const destinationToken = (0, token_1.getKnownToken)(Number(destination.chainId), destination.tokenSymbol);
|
|
89
|
+
if (!sourceToken || !destinationToken) {
|
|
90
|
+
throw new Error("Source or destination token not found");
|
|
91
|
+
}
|
|
92
|
+
// Build payment request data matching new backend interface
|
|
93
|
+
const paymentData = {
|
|
94
|
+
appId,
|
|
95
|
+
destination: {
|
|
96
|
+
chainId: destinationChain.chainId,
|
|
97
|
+
receiverAddress: destination.destinationAddress ?? toAddress,
|
|
98
|
+
tokenSymbol: destinationToken.symbol,
|
|
99
|
+
amount: destination.amountUnits,
|
|
100
|
+
...(destination.tokenAddress
|
|
101
|
+
? { tokenAddress: destination.tokenAddress }
|
|
102
|
+
: {}),
|
|
103
|
+
...(receiverMemo ? { receiverMemo } : {}),
|
|
104
|
+
},
|
|
105
|
+
source: {
|
|
106
|
+
chainId: sourceChain.chainId,
|
|
107
|
+
tokenSymbol: sourceToken.symbol,
|
|
108
|
+
amount: destination.amountUnits, // Use same amount for source
|
|
109
|
+
...(preferred.preferredTokenAddress
|
|
110
|
+
? { tokenAddress: preferred.preferredTokenAddress }
|
|
111
|
+
: {}),
|
|
112
|
+
},
|
|
113
|
+
display: {
|
|
114
|
+
currency: "USD",
|
|
115
|
+
title: title ?? "Payment",
|
|
116
|
+
...(description ? { description } : {}),
|
|
117
|
+
},
|
|
118
|
+
...(metadata ? { metadata } : {}),
|
|
119
|
+
...(orderId ? { orderId } : {}),
|
|
120
|
+
...(type ? { type } : {}),
|
|
121
|
+
...(webhookUrl ? { webhookUrl } : {}),
|
|
122
|
+
...(webhookSecret ? { webhookSecret } : {}),
|
|
123
|
+
};
|
|
124
|
+
// Create payment via API
|
|
125
|
+
const response = await base_1.apiClient.post("/payment-api", paymentData);
|
|
126
|
+
if (!response?.data?.id) {
|
|
127
|
+
throw new Error(response?.error?.message ?? "Payment creation failed");
|
|
128
|
+
}
|
|
129
|
+
return response.data;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Gets payment details by ID using the new backend API
|
|
133
|
+
* @param paymentId - Payment ID
|
|
134
|
+
* @returns Promise with payment response
|
|
135
|
+
*/
|
|
136
|
+
const getNewPayment = (paymentId) => {
|
|
137
|
+
return base_1.apiClient.get(`/payment-api/${paymentId}`);
|
|
138
|
+
};
|
|
139
|
+
exports.getNewPayment = getNewPayment;
|
|
140
|
+
//# sourceMappingURL=new-payment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"new-payment.js","sourceRoot":"","sources":["../../src/api/new-payment.ts"],"names":[],"mappings":";;;AA0UA,4CA2FC;AAraD,sCAAsD;AACtD,oCAAwC;AACxC,oCAAyC;AACzC,iCAAgD;AAEhD;;;;GAIG;AACH,IAAY,OAGX;AAHD,WAAY,OAAO;IACjB,8BAAmB,CAAA;IACnB,gCAAqB,CAAA;AACvB,CAAC,EAHW,OAAO,uBAAP,OAAO,QAGlB;AAED;;GAEG;AACH,IAAY,aASX;AATD,WAAY,aAAa;IACvB,mDAAkC,CAAA;IAClC,uDAAsC,CAAA;IACtC,mDAAkC,CAAA;IAClC,kEAAiD,CAAA;IACjD,oEAAmD,CAAA;IACnD,qDAAoC,CAAA;IACpC,mDAAkC,CAAA;IAClC,iDAAgC,CAAA;AAClC,CAAC,EATW,aAAa,6BAAb,aAAa,QASxB;AAED;;GAEG;AACH,IAAY,gBAUX;AAVD,WAAY,gBAAgB;IAC1B,mDAA+B,CAAA;IAC/B,iDAA6B,CAAA;IAC7B,yDAAqC,CAAA;IACrC,mEAA+C,CAAA;IAC/C,yDAAqC,CAAA;IACrC,yDAAqC,CAAA;IACrC,iDAA6B,CAAA;IAC7B,mDAA+B,CAAA;IAC/B,6DAAyC,CAAA;AAC3C,CAAC,EAVW,gBAAgB,gCAAhB,gBAAgB,QAU3B;AAuQD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACI,KAAK,UAAU,g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