@1llet.xyz/erc4337-gasless-sdk 0.4.34 → 0.4.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,4 +1,6 @@
1
1
  import { Chain, Address, Hash, Hex } from 'viem';
2
+ import * as StellarSdk from 'stellar-sdk';
3
+ import { Address as Address$1 } from 'abitype';
2
4
  import z from 'zod';
3
5
 
4
6
  interface Token {
@@ -6,7 +8,7 @@ interface Token {
6
8
  decimals: number;
7
9
  address: Address;
8
10
  }
9
- interface ChainConfig {
11
+ interface ChainConfig$1 {
10
12
  chain: Chain;
11
13
  rpcUrl?: string;
12
14
  bundlerUrl: string;
@@ -66,7 +68,7 @@ declare class AccountAbstraction {
66
68
  private userOpBuilder;
67
69
  private entryPointAddress;
68
70
  private factoryAddress;
69
- constructor(chainConfig: ChainConfig);
71
+ constructor(chainConfig: ChainConfig$1);
70
72
  /**
71
73
  * Connect to MetaMask OR use Private Key
72
74
  * @param privateKey (Optional) Hex string of private key. If provided, uses local signing.
@@ -149,7 +151,7 @@ declare global {
149
151
  declare class BundlerClient {
150
152
  private bundlerUrl;
151
153
  private entryPointAddress;
152
- constructor(config: ChainConfig, entryPointAddress: Address);
154
+ constructor(config: ChainConfig$1, entryPointAddress: Address);
153
155
  private call;
154
156
  estimateGas(userOp: Partial<UserOperation>): Promise<GasEstimate>;
155
157
  sendUserOperation(userOp: UserOperation): Promise<Hash>;
@@ -157,11 +159,11 @@ declare class BundlerClient {
157
159
  requestApprovalSupport(token: Address, owner: Address, spender: Address, amount: bigint): Promise<ApprovalSupportResult>;
158
160
  }
159
161
 
160
- declare const BASE_MAINNET: ChainConfig;
161
- declare const OPTIMISM_MAINNET: ChainConfig;
162
- declare const GNOSIS_MAINNET: ChainConfig;
163
- declare const BASE_SEPOLIA: ChainConfig;
164
- declare const CHAIN_CONFIGS: Record<number, ChainConfig>;
162
+ declare const BASE_MAINNET: ChainConfig$1;
163
+ declare const OPTIMISM_MAINNET: ChainConfig$1;
164
+ declare const GNOSIS_MAINNET: ChainConfig$1;
165
+ declare const BASE_SEPOLIA: ChainConfig$1;
166
+ declare const CHAIN_CONFIGS: Record<number, ChainConfig$1>;
165
167
 
166
168
  declare const entryPointAbi: readonly [{
167
169
  readonly inputs: readonly [{
@@ -298,6 +300,27 @@ declare const erc20Abi: readonly [{
298
300
 
299
301
  declare const CHAIN_ID_TO_KEY: Record<string, string>;
300
302
 
303
+ declare class StellarService {
304
+ server: StellarSdk.Horizon.Server;
305
+ network: string;
306
+ constructor();
307
+ /**
308
+ * Get balance for a specific token (or all if not specified)
309
+ * Returns string representation
310
+ */
311
+ getBalance(address: string, tokenName?: string): Promise<string>;
312
+ /**
313
+ * Build and Sign a Transfer Transaction
314
+ */
315
+ buildTransferXdr(senderPk: string, recipient: string, amount: string, tokenName?: string, memo?: string): Promise<string>;
316
+ /**
317
+ * Submit Signed XDR
318
+ */
319
+ submitXdr(xdr: string): Promise<StellarSdk.Horizon.HorizonApi.SubmitTransactionResponse>;
320
+ getAsset(tokenName: string): StellarSdk.Asset;
321
+ getKeypair(pk: string): StellarSdk.Keypair;
322
+ }
323
+
301
324
  declare const ChainKeyEnum: z.ZodEnum<{
302
325
  Optimism: "Optimism";
303
326
  Arbitrum: "Arbitrum";
@@ -312,6 +335,57 @@ declare const ChainKeyEnum: z.ZodEnum<{
312
335
  GNOSIS: "GNOSIS";
313
336
  }>;
314
337
  type ChainKey = z.infer<typeof ChainKeyEnum>;
338
+ interface NearIntentAsset {
339
+ assetId: string;
340
+ name: string;
341
+ decimals: number;
342
+ }
343
+ interface NearIntentInformation {
344
+ support: boolean;
345
+ assetsId: NearIntentAsset[];
346
+ needMemo: boolean;
347
+ }
348
+ interface CCTPInformation {
349
+ supportCCTP: boolean;
350
+ domain: number;
351
+ }
352
+ interface CircleInformation {
353
+ supportCirclePaymaster: boolean;
354
+ cCTPInformation?: CCTPInformation;
355
+ aproxFromFee: number;
356
+ }
357
+ interface CrossChainInformation {
358
+ circleInformation?: CircleInformation;
359
+ nearIntentInformation: NearIntentInformation | null;
360
+ }
361
+ interface EvmInformation {
362
+ chain: any;
363
+ rpcUrl: string | null;
364
+ supports7702: boolean;
365
+ erc4337: boolean;
366
+ bundlerUrl?: string;
367
+ entryPointAddress?: Address$1;
368
+ factoryAddress?: Address$1;
369
+ paymasterAddress?: Address$1;
370
+ }
371
+ interface NonEvmInformation {
372
+ networkPassphrase?: string;
373
+ serverURL?: string;
374
+ }
375
+ interface Asset {
376
+ name: string;
377
+ decimals: number;
378
+ address?: Address$1 | string;
379
+ coingeckoId?: string;
380
+ }
381
+ interface ChainConfig {
382
+ assets: Asset[];
383
+ evm?: EvmInformation;
384
+ nonEvm?: NonEvmInformation;
385
+ crossChainInformation: CrossChainInformation;
386
+ }
387
+
388
+ declare const STELLAR: ChainConfig;
315
389
 
316
390
  interface FacilitatorPaymentPayload {
317
391
  authorization: {
@@ -377,4 +451,4 @@ declare class CCTPStrategy implements BridgeStrategy {
377
451
  execute(context: BridgeContext): Promise<SettleResponse>;
378
452
  }
379
453
 
380
- export { AccountAbstraction, type ApprovalSupportResult, BASE_MAINNET, BASE_SEPOLIA, BundlerClient, CCTPStrategy, CHAIN_CONFIGS, CHAIN_ID_TO_KEY, type ChainConfig, GNOSIS_MAINNET, type GasEstimate, NearStrategy, OPTIMISM_MAINNET, type Token, TransferManager, type UserOpReceipt, type UserOperation, entryPointAbi, erc20Abi, smartAccountAbi };
454
+ export { AccountAbstraction, type ApprovalSupportResult, BASE_MAINNET, BASE_SEPOLIA, BundlerClient, CCTPStrategy, CHAIN_CONFIGS, CHAIN_ID_TO_KEY, type ChainConfig$1 as ChainConfig, GNOSIS_MAINNET, type GasEstimate, NearStrategy, OPTIMISM_MAINNET, STELLAR, StellarService, type Token, TransferManager, type UserOpReceipt, type UserOperation, entryPointAbi, erc20Abi, smartAccountAbi };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  import { Chain, Address, Hash, Hex } from 'viem';
2
+ import * as StellarSdk from 'stellar-sdk';
3
+ import { Address as Address$1 } from 'abitype';
2
4
  import z from 'zod';
3
5
 
4
6
  interface Token {
@@ -6,7 +8,7 @@ interface Token {
6
8
  decimals: number;
7
9
  address: Address;
8
10
  }
9
- interface ChainConfig {
11
+ interface ChainConfig$1 {
10
12
  chain: Chain;
11
13
  rpcUrl?: string;
12
14
  bundlerUrl: string;
@@ -66,7 +68,7 @@ declare class AccountAbstraction {
66
68
  private userOpBuilder;
67
69
  private entryPointAddress;
68
70
  private factoryAddress;
69
- constructor(chainConfig: ChainConfig);
71
+ constructor(chainConfig: ChainConfig$1);
70
72
  /**
71
73
  * Connect to MetaMask OR use Private Key
72
74
  * @param privateKey (Optional) Hex string of private key. If provided, uses local signing.
@@ -149,7 +151,7 @@ declare global {
149
151
  declare class BundlerClient {
150
152
  private bundlerUrl;
151
153
  private entryPointAddress;
152
- constructor(config: ChainConfig, entryPointAddress: Address);
154
+ constructor(config: ChainConfig$1, entryPointAddress: Address);
153
155
  private call;
154
156
  estimateGas(userOp: Partial<UserOperation>): Promise<GasEstimate>;
155
157
  sendUserOperation(userOp: UserOperation): Promise<Hash>;
@@ -157,11 +159,11 @@ declare class BundlerClient {
157
159
  requestApprovalSupport(token: Address, owner: Address, spender: Address, amount: bigint): Promise<ApprovalSupportResult>;
158
160
  }
159
161
 
160
- declare const BASE_MAINNET: ChainConfig;
161
- declare const OPTIMISM_MAINNET: ChainConfig;
162
- declare const GNOSIS_MAINNET: ChainConfig;
163
- declare const BASE_SEPOLIA: ChainConfig;
164
- declare const CHAIN_CONFIGS: Record<number, ChainConfig>;
162
+ declare const BASE_MAINNET: ChainConfig$1;
163
+ declare const OPTIMISM_MAINNET: ChainConfig$1;
164
+ declare const GNOSIS_MAINNET: ChainConfig$1;
165
+ declare const BASE_SEPOLIA: ChainConfig$1;
166
+ declare const CHAIN_CONFIGS: Record<number, ChainConfig$1>;
165
167
 
166
168
  declare const entryPointAbi: readonly [{
167
169
  readonly inputs: readonly [{
@@ -298,6 +300,27 @@ declare const erc20Abi: readonly [{
298
300
 
299
301
  declare const CHAIN_ID_TO_KEY: Record<string, string>;
300
302
 
303
+ declare class StellarService {
304
+ server: StellarSdk.Horizon.Server;
305
+ network: string;
306
+ constructor();
307
+ /**
308
+ * Get balance for a specific token (or all if not specified)
309
+ * Returns string representation
310
+ */
311
+ getBalance(address: string, tokenName?: string): Promise<string>;
312
+ /**
313
+ * Build and Sign a Transfer Transaction
314
+ */
315
+ buildTransferXdr(senderPk: string, recipient: string, amount: string, tokenName?: string, memo?: string): Promise<string>;
316
+ /**
317
+ * Submit Signed XDR
318
+ */
319
+ submitXdr(xdr: string): Promise<StellarSdk.Horizon.HorizonApi.SubmitTransactionResponse>;
320
+ getAsset(tokenName: string): StellarSdk.Asset;
321
+ getKeypair(pk: string): StellarSdk.Keypair;
322
+ }
323
+
301
324
  declare const ChainKeyEnum: z.ZodEnum<{
302
325
  Optimism: "Optimism";
303
326
  Arbitrum: "Arbitrum";
@@ -312,6 +335,57 @@ declare const ChainKeyEnum: z.ZodEnum<{
312
335
  GNOSIS: "GNOSIS";
313
336
  }>;
314
337
  type ChainKey = z.infer<typeof ChainKeyEnum>;
338
+ interface NearIntentAsset {
339
+ assetId: string;
340
+ name: string;
341
+ decimals: number;
342
+ }
343
+ interface NearIntentInformation {
344
+ support: boolean;
345
+ assetsId: NearIntentAsset[];
346
+ needMemo: boolean;
347
+ }
348
+ interface CCTPInformation {
349
+ supportCCTP: boolean;
350
+ domain: number;
351
+ }
352
+ interface CircleInformation {
353
+ supportCirclePaymaster: boolean;
354
+ cCTPInformation?: CCTPInformation;
355
+ aproxFromFee: number;
356
+ }
357
+ interface CrossChainInformation {
358
+ circleInformation?: CircleInformation;
359
+ nearIntentInformation: NearIntentInformation | null;
360
+ }
361
+ interface EvmInformation {
362
+ chain: any;
363
+ rpcUrl: string | null;
364
+ supports7702: boolean;
365
+ erc4337: boolean;
366
+ bundlerUrl?: string;
367
+ entryPointAddress?: Address$1;
368
+ factoryAddress?: Address$1;
369
+ paymasterAddress?: Address$1;
370
+ }
371
+ interface NonEvmInformation {
372
+ networkPassphrase?: string;
373
+ serverURL?: string;
374
+ }
375
+ interface Asset {
376
+ name: string;
377
+ decimals: number;
378
+ address?: Address$1 | string;
379
+ coingeckoId?: string;
380
+ }
381
+ interface ChainConfig {
382
+ assets: Asset[];
383
+ evm?: EvmInformation;
384
+ nonEvm?: NonEvmInformation;
385
+ crossChainInformation: CrossChainInformation;
386
+ }
387
+
388
+ declare const STELLAR: ChainConfig;
315
389
 
316
390
  interface FacilitatorPaymentPayload {
317
391
  authorization: {
@@ -377,4 +451,4 @@ declare class CCTPStrategy implements BridgeStrategy {
377
451
  execute(context: BridgeContext): Promise<SettleResponse>;
378
452
  }
379
453
 
380
- export { AccountAbstraction, type ApprovalSupportResult, BASE_MAINNET, BASE_SEPOLIA, BundlerClient, CCTPStrategy, CHAIN_CONFIGS, CHAIN_ID_TO_KEY, type ChainConfig, GNOSIS_MAINNET, type GasEstimate, NearStrategy, OPTIMISM_MAINNET, type Token, TransferManager, type UserOpReceipt, type UserOperation, entryPointAbi, erc20Abi, smartAccountAbi };
454
+ export { AccountAbstraction, type ApprovalSupportResult, BASE_MAINNET, BASE_SEPOLIA, BundlerClient, CCTPStrategy, CHAIN_CONFIGS, CHAIN_ID_TO_KEY, type ChainConfig$1 as ChainConfig, GNOSIS_MAINNET, type GasEstimate, NearStrategy, OPTIMISM_MAINNET, STELLAR, StellarService, type Token, TransferManager, type UserOpReceipt, type UserOperation, entryPointAbi, erc20Abi, smartAccountAbi };
package/dist/index.js CHANGED
@@ -1,14 +1,33 @@
1
1
  'use strict';
2
2
 
3
+ var StellarSdk = require('stellar-sdk');
3
4
  var chains = require('viem/chains');
4
5
  var viem = require('viem');
5
6
  var accounts = require('viem/accounts');
6
7
  var axios = require('axios');
7
- var stellarSdk = require('stellar-sdk');
8
8
  var oneClickSdkTypescript = require('@defuse-protocol/one-click-sdk-typescript');
9
9
 
10
10
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
11
11
 
12
+ function _interopNamespace(e) {
13
+ if (e && e.__esModule) return e;
14
+ var n = Object.create(null);
15
+ if (e) {
16
+ Object.keys(e).forEach(function (k) {
17
+ if (k !== 'default') {
18
+ var d = Object.getOwnPropertyDescriptor(e, k);
19
+ Object.defineProperty(n, k, d.get ? d : {
20
+ enumerable: true,
21
+ get: function () { return e[k]; }
22
+ });
23
+ }
24
+ });
25
+ }
26
+ n.default = e;
27
+ return Object.freeze(n);
28
+ }
29
+
30
+ var StellarSdk__namespace = /*#__PURE__*/_interopNamespace(StellarSdk);
12
31
  var axios__default = /*#__PURE__*/_interopDefault(axios);
13
32
 
14
33
  var __defProp = Object.defineProperty;
@@ -20,6 +39,149 @@ var __export = (target, all) => {
20
39
  for (var name in all)
21
40
  __defProp(target, name, { get: all[name], enumerable: true });
22
41
  };
42
+ exports.STELLAR = void 0;
43
+ var init_Stellar = __esm({
44
+ "src/chains/NoEvm/Stellar.ts"() {
45
+ exports.STELLAR = {
46
+ assets: [
47
+ {
48
+ name: "USDC",
49
+ decimals: 7,
50
+ address: "GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN",
51
+ coingeckoId: "usd-coin"
52
+ },
53
+ {
54
+ name: "XLM",
55
+ decimals: 7,
56
+ address: "native",
57
+ coingeckoId: "stellar"
58
+ }
59
+ ],
60
+ nonEvm: {
61
+ networkPassphrase: StellarSdk.Networks.PUBLIC,
62
+ serverURL: "https://horizon.stellar.org"
63
+ },
64
+ crossChainInformation: {
65
+ circleInformation: {
66
+ supportCirclePaymaster: false,
67
+ aproxFromFee: 0
68
+ },
69
+ nearIntentInformation: {
70
+ support: true,
71
+ assetsId: [
72
+ {
73
+ assetId: "nep245:v2_1.omni.hot.tg:1100_111bzQBB65GxAPAVoxqmMcgYo5oS3txhqs1Uh1cgahKQUeTUq1TJu",
74
+ name: "USDC",
75
+ decimals: 7
76
+ },
77
+ {
78
+ assetId: "nep245:v2_1.omni.hot.tg:1100_111bzQBB5v7AhLyPMDwS8uJgQV24KaAPXtwyVWu2KXbbfQU6NXRCz",
79
+ name: "XLM",
80
+ decimals: 6
81
+ }
82
+ ],
83
+ needMemo: true
84
+ }
85
+ }
86
+ };
87
+ }
88
+ });
89
+
90
+ // src/services/StellarService.ts
91
+ var StellarService_exports = {};
92
+ __export(StellarService_exports, {
93
+ StellarService: () => exports.StellarService
94
+ });
95
+ exports.StellarService = void 0;
96
+ var init_StellarService = __esm({
97
+ "src/services/StellarService.ts"() {
98
+ init_Stellar();
99
+ exports.StellarService = class {
100
+ constructor() {
101
+ if (!exports.STELLAR.nonEvm?.serverURL || !exports.STELLAR.nonEvm?.networkPassphrase) {
102
+ throw new Error("Stellar Non-EVM config missing or incomplete");
103
+ }
104
+ this.server = new StellarSdk__namespace.Horizon.Server(exports.STELLAR.nonEvm.serverURL);
105
+ this.network = exports.STELLAR.nonEvm.networkPassphrase;
106
+ }
107
+ /**
108
+ * Get balance for a specific token (or all if not specified)
109
+ * Returns string representation
110
+ */
111
+ async getBalance(address, tokenName = "XLM") {
112
+ try {
113
+ const account = await this.server.loadAccount(address);
114
+ const assetDef = exports.STELLAR.assets.find((a) => a.name === tokenName);
115
+ if (!assetDef) throw new Error(`Asset ${tokenName} not configured`);
116
+ const isNative = assetDef.address === "native";
117
+ const balanceLine = account.balances.find((b) => {
118
+ if (isNative) {
119
+ return b.asset_type === "native";
120
+ }
121
+ return b.asset_code === tokenName && b.asset_issuer === assetDef.address;
122
+ });
123
+ return balanceLine ? balanceLine.balance : "0";
124
+ } catch (e) {
125
+ if (e.response && e.response.status === 404) {
126
+ return "0";
127
+ }
128
+ throw e;
129
+ }
130
+ }
131
+ /**
132
+ * Build and Sign a Transfer Transaction
133
+ */
134
+ async buildTransferXdr(senderPk, recipient, amount, tokenName = "XLM", memo) {
135
+ const keypair = StellarSdk__namespace.Keypair.fromSecret(senderPk);
136
+ const sourceAddress = keypair.publicKey();
137
+ let account;
138
+ try {
139
+ account = await this.server.loadAccount(sourceAddress);
140
+ } catch (e) {
141
+ throw new Error(`Stellar Account ${sourceAddress} not valid or not active.`);
142
+ }
143
+ const asset = this.getAsset(tokenName);
144
+ const txBuilder = new StellarSdk__namespace.TransactionBuilder(account, {
145
+ fee: StellarSdk__namespace.BASE_FEE,
146
+ networkPassphrase: this.network
147
+ });
148
+ txBuilder.addOperation(StellarSdk__namespace.Operation.payment({
149
+ destination: recipient,
150
+ asset,
151
+ amount
152
+ }));
153
+ if (memo) {
154
+ txBuilder.addMemo(StellarSdk__namespace.Memo.text(memo));
155
+ }
156
+ txBuilder.setTimeout(30);
157
+ const builtTx = txBuilder.build();
158
+ builtTx.sign(keypair);
159
+ return builtTx.toXDR();
160
+ }
161
+ /**
162
+ * Submit Signed XDR
163
+ */
164
+ async submitXdr(xdr) {
165
+ const tx = StellarSdk__namespace.TransactionBuilder.fromXDR(xdr, this.network);
166
+ return this.server.submitTransaction(tx);
167
+ }
168
+ getAsset(tokenName) {
169
+ const assetDef = exports.STELLAR.assets.find((a) => a.name === tokenName);
170
+ if (!assetDef) {
171
+ if (tokenName === "XLM") return StellarSdk__namespace.Asset.native();
172
+ throw new Error(`Asset ${tokenName} not found in configuration`);
173
+ }
174
+ if (assetDef.address === "native") {
175
+ return StellarSdk__namespace.Asset.native();
176
+ }
177
+ return new StellarSdk__namespace.Asset(assetDef.name, assetDef.address);
178
+ }
179
+ getKeypair(pk) {
180
+ return StellarSdk__namespace.Keypair.fromSecret(pk);
181
+ }
182
+ };
183
+ }
184
+ });
23
185
 
24
186
  // src/constants/facilitator.ts
25
187
  var facilitator_exports = {};
@@ -1150,6 +1312,10 @@ var CHAIN_ID_TO_KEY = {
1150
1312
  "42161": "Arbitrum"
1151
1313
  };
1152
1314
 
1315
+ // src/index.ts
1316
+ init_StellarService();
1317
+ init_Stellar();
1318
+
1153
1319
  // src/services/cctp.ts
1154
1320
  init_facilitator();
1155
1321
  init_facilitator();
@@ -1518,48 +1684,9 @@ var WORLD_CHAIN = {
1518
1684
  nearIntentInformation: null
1519
1685
  }
1520
1686
  };
1521
- var STELLAR = {
1522
- assets: [
1523
- {
1524
- name: "USDC",
1525
- decimals: 7,
1526
- address: "GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN",
1527
- coingeckoId: "usd-coin"
1528
- },
1529
- {
1530
- name: "XLM",
1531
- decimals: 7,
1532
- address: "native",
1533
- coingeckoId: "stellar"
1534
- }
1535
- ],
1536
- nonEvm: {
1537
- networkPassphrase: stellarSdk.Networks.PUBLIC,
1538
- serverURL: "https://horizon.stellar.org"
1539
- },
1540
- crossChainInformation: {
1541
- circleInformation: {
1542
- supportCirclePaymaster: false,
1543
- aproxFromFee: 0
1544
- },
1545
- nearIntentInformation: {
1546
- support: true,
1547
- assetsId: [
1548
- {
1549
- assetId: "nep245:v2_1.omni.hot.tg:1100_111bzQBB65GxAPAVoxqmMcgYo5oS3txhqs1Uh1cgahKQUeTUq1TJu",
1550
- name: "USDC",
1551
- decimals: 7
1552
- },
1553
- {
1554
- assetId: "nep245:v2_1.omni.hot.tg:1100_111bzQBB5v7AhLyPMDwS8uJgQV24KaAPXtwyVWu2KXbbfQU6NXRCz",
1555
- name: "XLM",
1556
- decimals: 6
1557
- }
1558
- ],
1559
- needMemo: true
1560
- }
1561
- }
1562
- };
1687
+
1688
+ // src/chains/index.ts
1689
+ init_Stellar();
1563
1690
  var Monad = {
1564
1691
  assets: [
1565
1692
  {
@@ -1691,7 +1818,7 @@ var NETWORKS = {
1691
1818
  Polygon: POLYGON,
1692
1819
  Avalanche: AVALANCHE,
1693
1820
  WorldChain: WORLD_CHAIN,
1694
- Stellar: STELLAR,
1821
+ Stellar: exports.STELLAR,
1695
1822
  Monad,
1696
1823
  BNB,
1697
1824
  Gnosis: GNOSIS
@@ -1992,6 +2119,7 @@ async function executeCCTPBridge(sourceChain, amount, crossChainConfig, facilita
1992
2119
  }
1993
2120
  };
1994
2121
  }
2122
+ init_StellarService();
1995
2123
  oneClickSdkTypescript.OpenAPI.BASE = "https://1click.chaindefuser.com";
1996
2124
  var NearStrategy = class {
1997
2125
  constructor() {
@@ -2007,9 +2135,50 @@ var NearStrategy = class {
2007
2135
  return !!(sourceNear && destNear);
2008
2136
  }
2009
2137
  async execute(context) {
2010
- const { sourceChain, destChain, amount, recipient, destToken, sourceToken, senderAddress, depositTxHash } = context;
2138
+ const { sourceChain, destChain, amount, recipient, destToken, sourceToken, senderAddress, depositTxHash, paymentPayload } = context;
2139
+ if (sourceChain === "Stellar" && paymentPayload?.signedXDR) {
2140
+ const signedXDR = paymentPayload.signedXDR;
2141
+ console.log("[NearStrategy] Submitting Stellar User -> Facilitator TX...");
2142
+ try {
2143
+ const stellarService = new exports.StellarService();
2144
+ const result = await stellarService.submitXdr(signedXDR);
2145
+ const pullHash = result.hash;
2146
+ console.log("[NearStrategy] Pull Success (Stellar):", pullHash);
2147
+ return {
2148
+ success: true,
2149
+ transactionHash: pullHash,
2150
+ data: {
2151
+ completed: true,
2152
+ message: "Stellar Transaction Submitted. Bridge in progress."
2153
+ }
2154
+ };
2155
+ } catch (e) {
2156
+ console.error("Stellar Submit Error", e);
2157
+ return { success: false, errorReason: "Stellar Submit Failed: " + (e.message || "Unknown") };
2158
+ }
2159
+ }
2011
2160
  if (depositTxHash) {
2012
2161
  console.log(`[NearStrategy] Verifying deposit hash: ${depositTxHash}`);
2162
+ if (sourceChain === "Stellar") {
2163
+ try {
2164
+ const { StellarService: StellarService2 } = await Promise.resolve().then(() => (init_StellarService(), StellarService_exports));
2165
+ const stellarService = new StellarService2();
2166
+ const tx = await stellarService.server.transactions().transaction(depositTxHash).call();
2167
+ if (tx.successful) {
2168
+ return {
2169
+ success: true,
2170
+ transactionHash: depositTxHash,
2171
+ netAmount: amount,
2172
+ data: { completed: true }
2173
+ };
2174
+ } else {
2175
+ return { success: false, errorReason: "Stellar Transaction Failed" };
2176
+ }
2177
+ } catch (e) {
2178
+ console.error("Stellar Verification Error", e);
2179
+ return { success: false, errorReason: `Stellar Verification Failed: ${e.message}` };
2180
+ }
2181
+ }
2013
2182
  const { createPublicClient: createPublicClient3, http: http3 } = await import('viem');
2014
2183
  const { FACILITATOR_NETWORKS: FACILITATOR_NETWORKS2 } = await Promise.resolve().then(() => (init_facilitator(), facilitator_exports));
2015
2184
  const networkConfig = FACILITATOR_NETWORKS2[sourceChain];