@rozoai/intent-common 0.0.31 → 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/src/bridge.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import { parseUnits } from "viem";
2
2
  import {
3
- base,
4
3
  baseUSDC,
5
- bscUSDT,
4
+ getChainById,
6
5
  getKnownToken,
7
- polygonUSDC,
6
+ isChainSupported,
7
+ isTokenSupported,
8
8
  RozoPayHydratedOrderWithOrg,
9
9
  RozoPayIntentStatus,
10
10
  RozoPayOrderMode,
@@ -12,27 +12,24 @@ import {
12
12
  RozoPayOrderStatusSource,
13
13
  RozoPayUserMetadata,
14
14
  rozoSolanaUSDC,
15
- rozoStellar,
16
15
  rozoStellarUSDC,
17
- worldchainUSDC,
16
+ validateAddressForChain,
18
17
  } from ".";
19
18
  import type { PaymentResponseData } from "./api/payment";
20
19
 
21
20
  export interface PaymentBridgeConfig {
22
- toChain?: number;
23
- toToken?: string;
21
+ toChain: number;
22
+ toToken: string;
24
23
  toAddress: string;
25
- toStellarAddress?: string;
26
- toSolanaAddress?: string;
27
24
  toUnits: string;
28
- payInTokenAddress: string;
29
- log?: (msg: string) => void;
25
+ preferredChain: number;
26
+ preferredTokenAddress: string;
30
27
  }
31
28
 
32
29
  export interface PreferredPaymentConfig {
33
30
  preferredChain: string;
34
- preferredToken: "USDC" | "USDT" | "XLM";
35
- preferredTokenAddress?: string;
31
+ preferredToken: string;
32
+ preferredTokenAddress: string;
36
33
  }
37
34
 
38
35
  export interface DestinationConfig {
@@ -43,187 +40,197 @@ export interface DestinationConfig {
43
40
  tokenAddress: string;
44
41
  }
45
42
 
43
+ interface PaymentBridge {
44
+ preferred: PreferredPaymentConfig;
45
+ destination: DestinationConfig;
46
+ isIntentPayment: boolean;
47
+ }
48
+
46
49
  /**
47
50
  * Creates payment bridge configuration for cross-chain payment routing
48
51
  *
49
52
  * Determines the optimal payment routing based on the destination chain/token
50
- * and the wallet payment option selected by the user. This function handles
53
+ * and the preferred payment method selected by the user. This function handles
51
54
  * the complexity of multi-chain payments by:
52
55
  *
53
56
  * 1. **Preferred Payment Method**: Identifies which chain/token the user will pay from
54
- * - Supports Base USDC, Polygon USDC, Solana USDC, Stellar USDC, Worldchain USDC, and BSC USDT
57
+ * - Supports Base USDC, Polygon USDC, Ethereum USDC, Solana USDC, Stellar USDC, Worldchain USDC, and BSC USDT
55
58
  * - Sets appropriate chain ID and token address for the source transaction
56
59
  *
57
60
  * 2. **Destination Configuration**: Determines where funds will be received
58
61
  * - Supports Base, Solana, Stellar, and Worldchain as destination chains
59
- * - Handles special address formats for Solana and Stellar addresses
60
- * - Defaults to Base USDC when no special destination is specified
62
+ * - Automatically handles special address formats for Solana and Stellar addresses
63
+ * - Configures destination token based on chain type (e.g., Stellar/Solana USDC)
61
64
  *
62
- * 3. **Cross-Chain Bridging**: Configures the payment bridge parameters
63
- * - Maps user's selected wallet/token to the appropriate payment method
64
- * - Sets up destination chain and token configuration
65
- * - Handles token address formatting (e.g., Stellar's `USDC:issuerPK` format)
65
+ * 3. **Intent Payment Detection**: Determines if this is a cross-chain intent payment
66
+ * - Returns `isIntentPayment: true` when preferred chain/token differs from destination
67
+ * - Returns `isIntentPayment: false` for same-chain, same-token payments
66
68
  *
67
69
  * @param config - Payment bridge configuration parameters
68
- * @param config.toChain - Destination chain ID (defaults to Base: 8453)
69
- * @param config.toToken - Destination token address (defaults to Base USDC)
70
- * @param config.toAddress - Standard EVM destination address
71
- * @param config.toStellarAddress - Stellar-specific destination address (if paying to Stellar)
72
- * @param config.toSolanaAddress - Solana-specific destination address (if paying to Solana)
73
- * @param config.toUnits - Amount in token units (smallest denomination)
74
- * @param config.payInTokenAddress - Token address user selected to pay with
75
- * @param config.log - Optional logging function for debugging
70
+ * @param config.toChain - Destination chain ID (e.g., 8453 for Base, 900 for Solana, 10001 for Stellar)
71
+ * @param config.toToken - Destination token address (must be a supported token on the destination chain)
72
+ * @param config.toAddress - Destination address (format validated based on chain type: EVM 0x..., Solana Base58, Stellar G...)
73
+ * @param config.toUnits - Amount in human-readable units (e.g., "1" for 1 USDC, "0.5" for half a USDC)
74
+ * @param config.preferredChain - Chain ID where the user will pay from (e.g., 137 for Polygon, 8453 for Base)
75
+ * @param config.preferredTokenAddress - Token address the user selected to pay with (must be a supported token on preferredChain)
76
76
  *
77
- * @returns Payment routing configuration
77
+ * @returns Payment routing configuration object
78
78
  * @returns preferred - Source payment configuration (chain, token user will pay from)
79
+ * @returns preferred.preferredChain - Chain ID as string where payment originates
80
+ * @returns preferred.preferredToken - Token symbol (e.g., "USDC", "USDT")
81
+ * @returns preferred.preferredTokenAddress - Token contract address
79
82
  * @returns destination - Destination payment configuration (chain, token user will receive)
83
+ * @returns destination.destinationAddress - Address where funds will be received
84
+ * @returns destination.chainId - Destination chain ID as string
85
+ * @returns destination.amountUnits - Payment amount in token units
86
+ * @returns destination.tokenSymbol - Destination token symbol
87
+ * @returns destination.tokenAddress - Destination token contract address
88
+ * @returns isIntentPayment - Boolean indicating if this is a cross-chain intent payment
89
+ *
90
+ * @throws {Error} If the destination token is not supported for the destination chain
91
+ * @throws {Error} If the destination address format is invalid for the destination chain
92
+ * @throws {Error} If the preferred token is not supported for the preferred chain
93
+ * @throws {Error} If the destination chain or token is not supported
80
94
  *
81
95
  * @example
82
96
  * ```typescript
83
97
  * // User wants to pay with Polygon USDC to receive on Base
84
- * const { preferred, destination } = createPaymentBridgeConfig({
85
- * toChain: 8453, // Base
98
+ * import { baseUSDC, polygonUSDCe } from '@rozoai/intent-common';
99
+ * import { base, polygon } from '@rozoai/intent-common';
100
+ *
101
+ * const { preferred, destination, isIntentPayment } = createPaymentBridgeConfig({
102
+ * toChain: base.chainId, // 8453
86
103
  * toToken: baseUSDC.token,
87
- * toAddress: '0x123...',
88
- * toUnits: '1000000', // 1 USDC
89
- * payInTokenAddress: polygonUSDC.token,
90
- * log: console.log
104
+ * toAddress: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb',
105
+ * toUnits: '1000000', // 1 USDC (6 decimals)
106
+ * preferredChain: polygon.chainId, // 137
107
+ * preferredToken: polygonUSDCe.token,
91
108
  * });
92
109
  *
93
- * // preferred = { preferredChain: '137', preferredToken: 'USDC', preferredTokenAddress: '0x2791...' }
94
- * // destination = { destinationAddress: '0x123...', chainId: '8453', amountUnits: '1000000', ... }
110
+ * // preferred = { preferredChain: '137', preferredToken: 'USDCe', preferredTokenAddress: '0x2791...' }
111
+ * // destination = { destinationAddress: '0x742d...', chainId: '8453', amountUnits: '1000000', tokenSymbol: 'USDC', tokenAddress: '0x8335...' }
112
+ * // isIntentPayment = true (different chains)
95
113
  * ```
96
114
  *
97
115
  * @example
98
116
  * ```typescript
99
- * // User wants to pay to a Stellar address
100
- * const { preferred, destination } = createPaymentBridgeConfig({
101
- * toStellarAddress: 'GDZS...',
102
- * toUnits: '1000000',
103
- * payInTokenAddress: baseUSDC.token,
117
+ * // User wants to pay to a Stellar address using Base USDC
118
+ * import { baseUSDC, rozoStellarUSDC } from '@rozoai/intent-common';
119
+ * import { base, rozoStellar } from '@rozoai/intent-common';
120
+ *
121
+ * const { preferred, destination, isIntentPayment } = createPaymentBridgeConfig({
122
+ * toChain: rozoStellar.chainId, // 10001
123
+ * toToken: rozoStellarUSDC.token,
124
+ * toAddress: 'GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN',
125
+ * toUnits: '10000000', // 1 USDC (7 decimals for Stellar)
126
+ * preferredChain: base.chainId, // 8453
127
+ * preferredToken: baseUSDC.token,
104
128
  * });
105
129
  *
106
- * // destination will be configured for Stellar chain with USDC:issuerPK format
130
+ * // preferred = { preferredChain: '8453', preferredToken: 'USDC', preferredTokenAddress: '0x8335...' }
131
+ * // destination = { destinationAddress: 'GA5Z...', chainId: '10001', amountUnits: '10000000', tokenSymbol: 'USDC', tokenAddress: 'USDC:GA5Z...' }
132
+ * // isIntentPayment = true (Base to Stellar)
107
133
  * ```
108
134
  *
109
- * @note Currently only supports Base USDC and Stellar USDC as destination chains.
110
- * Support for additional destination chains is planned.
135
+ * @example
136
+ * ```typescript
137
+ * // Same-chain payment (not an intent payment)
138
+ * const { preferred, destination, isIntentPayment } = createPaymentBridgeConfig({
139
+ * toChain: base.chainId, // 8453
140
+ * toToken: baseUSDC.token,
141
+ * toAddress: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb',
142
+ * toUnits: '1000000',
143
+ * preferredChain: base.chainId, // 8453
144
+ * preferredToken: baseUSDC.token,
145
+ * });
146
+ *
147
+ * // isIntentPayment = false (same chain and token)
148
+ * ```
111
149
  *
112
150
  * @see PreferredPaymentConfig
113
151
  * @see DestinationConfig
152
+ * @see PaymentBridgeConfig
114
153
  */
115
154
  export function createPaymentBridgeConfig({
116
- toChain = baseUSDC.chainId,
117
- toToken = baseUSDC.token,
155
+ toChain,
156
+ toToken,
118
157
  toAddress,
119
- toStellarAddress,
120
- toSolanaAddress,
121
158
  toUnits,
122
- payInTokenAddress,
123
- log,
124
- }: PaymentBridgeConfig): {
125
- preferred: PreferredPaymentConfig;
126
- destination: DestinationConfig;
127
- } {
128
- // Default configuration for Base USDC payments
159
+ preferredChain,
160
+ preferredTokenAddress,
161
+ }: PaymentBridgeConfig): PaymentBridge {
162
+ const chain = getChainById(toChain);
163
+ const token = getKnownToken(toChain, toToken);
164
+
165
+ if (!token) {
166
+ throw new Error(
167
+ `Unsupported token ${toToken} for chain ${chain.name} (${toChain})`
168
+ );
169
+ }
170
+
171
+ const addressValid = validateAddressForChain(toChain, toAddress);
172
+ if (!addressValid) {
173
+ throw new Error(
174
+ `Invalid address ${toAddress} for chain ${chain.name} (${toChain})`
175
+ );
176
+ }
177
+
178
+ const tokenConfig = getKnownToken(preferredChain, preferredTokenAddress);
179
+ if (!tokenConfig) {
180
+ throw new Error(
181
+ `Unknown token ${preferredTokenAddress} for chain ${chain.name} (${preferredChain})`
182
+ );
183
+ }
184
+
129
185
  let preferred: PreferredPaymentConfig = {
130
- preferredChain: String(toChain),
131
- preferredToken: "USDC",
186
+ preferredChain: String(preferredChain),
187
+ preferredToken: tokenConfig.symbol,
188
+ preferredTokenAddress: preferredTokenAddress,
132
189
  };
133
190
 
134
191
  let destination: DestinationConfig = {
135
192
  destinationAddress: toAddress,
136
193
  chainId: String(toChain),
137
194
  amountUnits: toUnits,
138
- tokenSymbol: "USDC",
195
+ tokenSymbol: token.symbol,
139
196
  tokenAddress: toToken,
140
197
  };
141
198
 
142
- /**
143
- * IMPORTANT: Because we only support PAY OUT USDC BASE & STELLAR
144
- * So, We force toChain and toToken to Base USDC as default PayParams
145
- *
146
- * @TODO: Adjust this when we support another PAY OUT chain
147
- */
148
- if (toChain === base.chainId && toToken === baseUSDC.token) {
149
- // Determine preferred payment method based on wallet selection
150
- if (payInTokenAddress) {
151
- // Pay In USDC Polygon
152
- if (payInTokenAddress === polygonUSDC.token) {
153
- log?.(`[Payment Bridge] Pay In USDC Polygon`);
154
- preferred = {
155
- preferredChain: String(polygonUSDC.chainId),
156
- preferredToken: "USDC",
157
- preferredTokenAddress: polygonUSDC.token,
158
- };
159
- }
160
- // Pay In USDC Solana
161
- else if (payInTokenAddress === rozoSolanaUSDC.token) {
162
- log?.(`[Payment Bridge] Pay In USDC Solana`);
163
- preferred = {
164
- preferredChain: String(rozoSolanaUSDC.chainId),
165
- preferredToken: "USDC",
166
- preferredTokenAddress: rozoSolanaUSDC.token,
167
- };
168
- }
169
- // Pay In USDC Stellar
170
- else if (
171
- payInTokenAddress === rozoStellarUSDC.token ||
172
- payInTokenAddress === `USDC:${rozoStellarUSDC.token}`
173
- ) {
174
- log?.(`[Payment Bridge] Pay In USDC Stellar`);
175
- preferred = {
176
- preferredChain: String(rozoStellarUSDC.chainId),
177
- preferredToken: "USDC",
178
- preferredTokenAddress: `USDC:${rozoStellarUSDC.token}`,
179
- };
180
- }
181
- // Pay In USDC Worldchain
182
- else if (payInTokenAddress === worldchainUSDC.token) {
183
- log?.(`[Payment Bridge] Pay In USDC Worldchain`);
184
- preferred = {
185
- preferredChain: String(worldchainUSDC.chainId),
186
- preferredToken: "USDC",
187
- preferredTokenAddress: worldchainUSDC.token,
188
- };
189
- }
190
- // Pay In USDT BSC
191
- else if (payInTokenAddress === bscUSDT.token) {
192
- log?.(`[Payment Bridge] Pay In USDT BSC`);
193
- preferred = {
194
- preferredChain: String(bscUSDT.chainId),
195
- preferredToken: "USDT",
196
- preferredTokenAddress: bscUSDT.token,
197
- };
198
- }
199
- }
199
+ if (isChainSupported(toChain) && isTokenSupported(toChain, toToken)) {
200
+ preferred = {
201
+ preferredChain: String(tokenConfig.chainId),
202
+ preferredToken: tokenConfig.symbol,
203
+ preferredTokenAddress: tokenConfig.token,
204
+ };
200
205
 
201
206
  // Determine destination based on special address types
202
- if (toStellarAddress) {
203
- log?.(`[Payment Bridge] Pay Out USDC Stellar`);
207
+ if (isChainSupported(toChain, "stellar")) {
204
208
  destination = {
205
- destinationAddress: toStellarAddress,
206
- chainId: String(rozoStellar.chainId),
207
- amountUnits: toUnits,
208
- tokenSymbol: "USDC",
209
- tokenAddress: `USDC:${rozoStellarUSDC.token}`,
209
+ ...destination,
210
+ tokenSymbol: rozoStellarUSDC.symbol,
211
+ chainId: String(rozoStellarUSDC.chainId),
212
+ tokenAddress: rozoStellarUSDC.token,
210
213
  };
211
- } else if (toSolanaAddress) {
212
- log?.(`[Payment Bridge] Pay Out USDC Solana`);
214
+ } else if (isChainSupported(toChain, "solana")) {
213
215
  destination = {
214
- destinationAddress: toSolanaAddress,
216
+ ...destination,
217
+ tokenSymbol: rozoSolanaUSDC.symbol,
215
218
  chainId: String(rozoSolanaUSDC.chainId),
216
- amountUnits: toUnits,
217
- tokenSymbol: "USDC",
218
219
  tokenAddress: rozoSolanaUSDC.token,
219
220
  };
220
- } else {
221
- log?.(`[Payment Bridge] Pay Out USDC Base`);
222
- // Keep default Base configuration
223
221
  }
222
+ } else {
223
+ throw new Error(
224
+ `Unsupported chain ${chain.name} (${toChain}) or token ${token.symbol} (${toToken})`
225
+ );
224
226
  }
225
227
 
226
- return { preferred, destination };
228
+ // If the preferred chain and token are not the same as the toChain and toToken, then it is an intent payment
229
+ const isIntentPayment =
230
+ preferred.preferredChain !== String(toChain) &&
231
+ preferred.preferredTokenAddress !== toToken;
232
+
233
+ return { preferred, destination, isIntentPayment };
227
234
  }
228
235
 
229
236
  /**
@@ -299,9 +306,9 @@ export function formatResponseToHydratedOrder(
299
306
 
300
307
  const requiredChain = order.metadata.preferredChain || baseUSDC.chainId;
301
308
 
302
- const chain = getKnownToken(
309
+ const token = getKnownToken(
303
310
  Number(requiredChain),
304
- Number(requiredChain) === rozoStellar.chainId
311
+ Number(requiredChain) === rozoStellarUSDC.chainId
305
312
  ? rozoStellarUSDC.token
306
313
  : order.metadata.preferredTokenAddress
307
314
  );
@@ -310,51 +317,48 @@ export function formatResponseToHydratedOrder(
310
317
  id: BigInt(Math.floor(Math.random() * Number.MAX_SAFE_INTEGER)),
311
318
  mode: RozoPayOrderMode.HYDRATED,
312
319
  intentAddr: destAddress,
313
- handoffAddr: destAddress,
314
- escrowContractAddress: destAddress,
315
- bridgerContractAddress: destAddress,
316
320
  // @TODO: use correct destination token
317
- bridgeTokenOutOptions: [
318
- {
319
- token: {
320
- chainId: baseUSDC.chainId,
321
- token: baseUSDC.token,
322
- symbol: baseUSDC.symbol,
323
- usd: 1,
324
- priceFromUsd: 1,
325
- decimals: baseUSDC.decimals,
326
- displayDecimals: 2,
327
- logoSourceURI: baseUSDC.logoSourceURI,
328
- logoURI: baseUSDC.logoURI,
329
- maxAcceptUsd: 100000,
330
- maxSendUsd: 0,
331
- },
332
- amount: parseUnits(
333
- order.destination.amountUnits,
334
- baseUSDC.decimals
335
- ).toString() as `${bigint}`,
336
- usd: Number(order.destination.amountUnits),
337
- },
338
- ],
339
- selectedBridgeTokenOutAddr: null,
340
- selectedBridgeTokenOutAmount: null,
321
+ // bridgeTokenOutOptions: [
322
+ // {
323
+ // token: {
324
+ // chainId: baseUSDC.chainId,
325
+ // token: baseUSDC.token,
326
+ // symbol: baseUSDC.symbol,
327
+ // usd: 1,
328
+ // priceFromUsd: 1,
329
+ // decimals: baseUSDC.decimals,
330
+ // displayDecimals: 2,
331
+ // logoSourceURI: baseUSDC.logoSourceURI,
332
+ // logoURI: baseUSDC.logoURI,
333
+ // maxAcceptUsd: 100000,
334
+ // maxSendUsd: 0,
335
+ // },
336
+ // amount: parseUnits(
337
+ // order.destination.amountUnits,
338
+ // baseUSDC.decimals
339
+ // ).toString() as `${bigint}`,
340
+ // usd: Number(order.destination.amountUnits),
341
+ // },
342
+ // ],
343
+ // selectedBridgeTokenOutAddr: null,
344
+ // selectedBridgeTokenOutAmount: null,
341
345
  destFinalCallTokenAmount: {
342
346
  token: {
343
- chainId: chain ? chain.chainId : baseUSDC.chainId,
344
- token: chain ? chain.token : baseUSDC.token,
345
- symbol: chain ? chain.symbol : baseUSDC.symbol,
347
+ chainId: token ? token.chainId : baseUSDC.chainId,
348
+ token: token ? token.token : baseUSDC.token,
349
+ symbol: token ? token.symbol : baseUSDC.symbol,
346
350
  usd: 1,
347
351
  priceFromUsd: 1,
348
- decimals: chain ? chain.decimals : baseUSDC.decimals,
352
+ decimals: token ? token.decimals : baseUSDC.decimals,
349
353
  displayDecimals: 2,
350
- logoSourceURI: chain ? chain.logoSourceURI : baseUSDC.logoSourceURI,
351
- logoURI: chain ? chain.logoURI : baseUSDC.logoURI,
354
+ logoSourceURI: token ? token.logoSourceURI : baseUSDC.logoSourceURI,
355
+ logoURI: token ? token.logoURI : baseUSDC.logoURI,
352
356
  maxAcceptUsd: 100000,
353
357
  maxSendUsd: 0,
354
358
  },
355
359
  amount: parseUnits(
356
360
  order.destination.amountUnits,
357
- chain ? chain.decimals : baseUSDC.decimals
361
+ token ? token.decimals : baseUSDC.decimals
358
362
  ).toString() as `${bigint}`,
359
363
  usd: Number(order.destination.amountUnits),
360
364
  },
@@ -366,10 +370,10 @@ export function formatResponseToHydratedOrder(
366
370
  },
367
371
  refundAddr: (order.source?.sourceAddress as `0x${string}`) || null,
368
372
  nonce: order.nonce as unknown as bigint,
369
- sourceTokenAmount: null,
370
373
  sourceFulfillerAddr: null,
374
+ sourceTokenAmount: null,
371
375
  sourceInitiateTxHash: null,
372
- sourceStartTxHash: null,
376
+ // sourceStartTxHash: null,
373
377
  sourceStatus: RozoPayOrderStatusSource.WAITING_PAYMENT,
374
378
  destStatus: RozoPayOrderStatusDest.PENDING,
375
379
  intentStatus: RozoPayIntentStatus.UNPAID,
@@ -389,7 +393,7 @@ export function formatResponseToHydratedOrder(
389
393
  expirationTs: BigInt(Math.floor(Date.now() / 1000 + 5 * 60).toString()),
390
394
  org: {
391
395
  orgId: order.orgId as string,
392
- name: "Pay Rozo",
396
+ name: "",
393
397
  },
394
398
  };
395
399
  }
package/src/chain.ts CHANGED
@@ -107,21 +107,44 @@ export const rozoStellar: Chain = {
107
107
  cctpDomain: null,
108
108
  };
109
109
 
110
+ export const gnosis: Chain = {
111
+ type: "evm",
112
+ chainId: 100,
113
+ name: "Gnosis",
114
+ cctpDomain: null,
115
+ };
116
+
117
+ export const avalanche: Chain = {
118
+ type: "evm",
119
+ chainId: 43114,
120
+ name: "Avalanche",
121
+ cctpDomain: null,
122
+ };
123
+
124
+ /**
125
+ * Supported chains for Near Intents cross-chain swaps
126
+ * Based on USDC/USDT support documentation
127
+ */
110
128
  export const supportedChains: Chain[] = [
111
- arbitrum,
112
- base,
113
- bsc,
114
- celo,
115
- ethereum,
116
- linea,
117
- mantle,
118
- optimism,
119
- polygon,
120
- solana,
121
- stellar,
129
+ // Supported for Near Intents (USDC/USDT)
130
+ arbitrum, // USDC & USDT
131
+ avalanche, // USDC & USDT
132
+ base, // USDC only (no USDT)
133
+ bsc, // USDC & USDT
134
+ ethereum, // USDC & USDT
135
+ gnosis, // USDC & USDT
136
+ optimism, // USDC & USDT
137
+ polygon, // USDC & USDT
122
138
  worldchain,
123
- rozoSolana,
124
- rozoStellar,
139
+ rozoSolana, // USDC & USDT (chainId: 900)
140
+ rozoStellar, // USDC only (chainId: 1500, no USDT)
141
+
142
+ // Not supported for Near Intents - kept for other features
143
+ // celo, // Not in Near Intents docs
144
+ // linea, // Not in Near Intents docs
145
+ // mantle, // Not in Near Intents docs
146
+ // solana, // Use rozoSolana (900) instead of solana (501)
147
+ // stellar, // Use rozoStellar (1500) instead of stellar (10001)
125
148
  ];
126
149
 
127
150
  // https://developers.circle.com/stablecoins/supported-domains
@@ -186,6 +209,10 @@ export function getChainExplorerByChainId(chainId: number): string | undefined {
186
209
  return "https://optimistic.etherscan.io";
187
210
  case polygon.chainId:
188
211
  return "https://polygonscan.com";
212
+ case gnosis.chainId:
213
+ return "https://gnosisscan.io";
214
+ case avalanche.chainId:
215
+ return "https://snowtrace.io";
189
216
  case solana.chainId:
190
217
  case rozoSolana.chainId:
191
218
  return "https://solscan.io";
package/src/daimoPay.ts CHANGED
@@ -190,16 +190,16 @@ export type RozoPayDehydratedOrder = {
190
190
  export type RozoPayHydratedOrder = {
191
191
  mode: RozoPayOrderMode.HYDRATED;
192
192
  id: bigint;
193
- intentAddr: Address;
193
+ intentAddr: string;
194
194
  /** Nullable because old intents don't record escrow address. */
195
- escrowContractAddress: Address | null;
195
+ // escrowContractAddress: Address | null;
196
196
  /** Nullable because old intents don't record bridger address. */
197
- bridgerContractAddress: Address | null;
197
+ // bridgerContractAddress: Address | null;
198
198
  /** @deprecated included for backcompat with old versions. Remove soon. */
199
- handoffAddr: Address;
200
- bridgeTokenOutOptions: RozoPayTokenAmount[];
201
- selectedBridgeTokenOutAddr: Address | null;
202
- selectedBridgeTokenOutAmount: bigint | null;
199
+ // handoffAddr: Address;
200
+ // bridgeTokenOutOptions: RozoPayTokenAmount[];
201
+ // selectedBridgeTokenOutAddr: Address | null;
202
+ // selectedBridgeTokenOutAmount: bigint | null;
203
203
  destFinalCallTokenAmount: RozoPayTokenAmount;
204
204
  destFinalCall: OnChainCall;
205
205
  usdValue: number;
@@ -208,7 +208,7 @@ export type RozoPayHydratedOrder = {
208
208
  sourceFulfillerAddr: Address | SolanaPublicKey | StellarPublicKey | null;
209
209
  sourceTokenAmount: RozoPayTokenAmount | null;
210
210
  sourceInitiateTxHash: Hex | null;
211
- sourceStartTxHash: Hex | null;
211
+ // sourceStartTxHash: Hex | null;
212
212
  sourceStatus: RozoPayOrderStatusSource;
213
213
  destStatus: RozoPayOrderStatusDest;
214
214
  destFastFinishTxHash: Hex | null;
@@ -429,6 +429,12 @@ export enum DepositAddressPaymentOptions {
429
429
  STELLAR = "Stellar",
430
430
  WORLD = "Worldchain",
431
431
 
432
+ SOLANA_USDT = "USDT on Solana",
433
+ SOLANA_USDC = "USDC on Solana",
434
+ BASE_USDC = "USDC on Base",
435
+ ETHEREUM_USDT = "USDT on Ethereum",
436
+ ETHEREUM_USDC = "USDC on Ethereum",
437
+
432
438
  /** @deprecated */
433
439
  BITCOIN = "Bitcoin",
434
440
  /** @deprecated */
@@ -449,6 +455,8 @@ export type DepositAddressPaymentOptionMetadata = {
449
455
  id: DepositAddressPaymentOptions;
450
456
  logoURI: string;
451
457
  minimumUsd: number;
458
+ chainId: number;
459
+ token: Token;
452
460
  };
453
461
 
454
462
  export type DepositAddressPaymentOptionData = {
@@ -482,7 +490,7 @@ export interface RozoPayTokenAmount {
482
490
  }
483
491
 
484
492
  export type OnChainCall = {
485
- to: Address;
493
+ to: Address | SolanaPublicKey | StellarPublicKey;
486
494
  data: Hex;
487
495
  value: bigint;
488
496
  };
package/src/index.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from "./api/fee";
2
+ export * from "./api/new-payment";
2
3
  export * from "./api/payment";
3
4
  export * from "./assert";
4
5
  export * from "./bridge";
@@ -10,3 +11,4 @@ export * from "./primitiveTypes";
10
11
  export * from "./retryBackoff";
11
12
  export * from "./token";
12
13
  export * from "./try";
14
+ export * from "./validation";