@1llet.xyz/erc4337-gasless-sdk 0.4.71 → 0.4.73

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.js CHANGED
@@ -6,6 +6,7 @@ var axios = require('axios');
6
6
  var viem = require('viem');
7
7
  var accounts = require('viem/accounts');
8
8
  var oneClickSdkTypescript = require('@defuse-protocol/one-click-sdk-typescript');
9
+ var c32check = require('c32check');
9
10
 
10
11
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
11
12
 
@@ -48,11 +49,11 @@ var init_bundler = __esm({
48
49
  BUNDLER_URL = process.env.NEXT_PUBLIC_BUNDLER_URL || process.env.BUNDLER_URL || DEFAULT_BUNDLER_URL;
49
50
  }
50
51
  });
51
- var BASE;
52
+ exports.BASE = void 0;
52
53
  var init_Base = __esm({
53
54
  "src/chains/Evm/Base.ts"() {
54
55
  init_bundler();
55
- BASE = {
56
+ exports.BASE = {
56
57
  assets: [
57
58
  {
58
59
  name: "USDC",
@@ -72,7 +73,7 @@ var init_Base = __esm({
72
73
  chain: chains.base,
73
74
  rpcUrl: "https://base-mainnet.g.alchemy.com/v2/49fUGmuW05ynCui0VEvDN",
74
75
  supports7702: true,
75
- erc4337: false,
76
+ erc4337: true,
76
77
  bundlerUrl: `${BUNDLER_URL}/rpc?chain=base`,
77
78
  entryPointAddress: "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789",
78
79
  factoryAddress: "0xe2584152891E4769025807DEa0cD611F135aDC68",
@@ -110,113 +111,84 @@ var init_Base = __esm({
110
111
  };
111
112
  }
112
113
  });
113
- var GNOSIS;
114
- var init_Gnosis = __esm({
115
- "src/chains/Evm/Gnosis.ts"() {
114
+ exports.AVALANCHE = void 0;
115
+ var init_Avalanche = __esm({
116
+ "src/chains/Evm/Avalanche.ts"() {
116
117
  init_bundler();
117
- GNOSIS = {
118
+ exports.AVALANCHE = {
118
119
  assets: [
119
120
  {
120
121
  name: "USDC",
121
122
  decimals: 6,
122
- address: "0x2a22f9c3b484c3629090FeED35F17Ff8F88f76F0",
123
- coingeckoId: "usd-coin"
124
- },
125
- {
126
- name: "USDT",
127
- decimals: 6,
128
- address: "0x4ECaBa5870353805a9F068101A40E0f32ed605C6",
129
- coingeckoId: "tether"
130
- },
131
- {
132
- name: "EURe",
133
- decimals: 18,
134
- address: "0x420CA0f9B9b604cE0fd9C18EF134C705e5Fa3430",
135
- coingeckoId: "monerium-eur-money"
136
- },
137
- {
138
- name: "GNO",
139
- decimals: 18,
140
- address: "0x9C58BAcC331c9aa871AFD802DB6379a98e80CEdb",
141
- coingeckoId: "gnosis"
123
+ address: "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",
124
+ coingeckoId: "usd-coin",
125
+ supportsStargate: true
142
126
  },
143
127
  {
144
- name: "WETH",
128
+ name: "AVAX",
145
129
  decimals: 18,
146
- address: "0x6A023CCd1ff6F2045C3309768eAd9E68F978f6e1",
147
- coingeckoId: "ethereum"
130
+ address: "0x0000000000000000000000000000000000000000",
131
+ coingeckoId: "avalanche-2"
148
132
  },
149
133
  {
150
- name: "XDAI",
151
- decimals: 18,
152
- address: "0x0000000000000000000000000000000000000000",
153
- coingeckoId: "xdai"
134
+ name: "USDT",
135
+ decimals: 6,
136
+ address: "0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7",
137
+ coingeckoId: "tether"
154
138
  }
155
139
  ],
156
140
  evm: {
157
- chain: chains.gnosis,
158
- rpcUrl: chains.gnosis.rpcUrls.default.http[0],
159
- supports7702: true,
160
- erc4337: true,
161
- bundlerUrl: `${BUNDLER_URL}/rpc?chain=gnosis`,
141
+ chain: chains.avalanche,
142
+ rpcUrl: chains.avalanche.rpcUrls.default.http[0],
143
+ supports7702: false,
144
+ bundlerUrl: `${BUNDLER_URL}/rpc?chain=avalanche`,
145
+ erc4337: false,
162
146
  entryPointAddress: "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789",
163
- factoryAddress: "0xC8a2Fb1f2E686417A131E09be3320cb5431CcD90",
164
- paymasterAddress: "0x4C36C70d68a7c26326711e8268bb163E3784fA96"
147
+ factoryAddress: "0x5D1D71FE2De5D1C52c7c11311332eC7f0CBf88aF",
148
+ paymasterAddress: "0x6c0de464F2203FE089FF719Acf425dFfE6ac1EE5"
165
149
  },
166
150
  crossChainInformation: {
167
151
  circleInformation: {
168
- supportCirclePaymaster: false,
169
- aproxFromFee: 0,
152
+ supportCirclePaymaster: true,
170
153
  cCTPInformation: {
171
- supportCCTP: false,
172
- domain: 0
173
- }
154
+ supportCCTP: true,
155
+ domain: 1
156
+ },
157
+ aproxFromFee: 0
174
158
  },
175
159
  nearIntentInformation: {
176
160
  support: true,
177
161
  assetsId: [
178
162
  {
179
- assetId: "nep141:gnosis-0x2a22f9c3b484c3629090feed35f17ff8f88f76f0.omft.near",
163
+ assetId: "nep245:v2_1.omni.hot.tg:43114_3atVJH3r5c4GqiSYmg9fECvjc47o",
180
164
  name: "USDC",
181
165
  decimals: 6
182
166
  },
183
167
  {
184
- assetId: "nep141:gnosis-0x4ecaba5870353805a9f068101a40e0f32ed605c6.omft.near",
185
- name: "USDT",
186
- decimals: 6
187
- },
188
- {
189
- assetId: "nep141:gnosis-0x420ca0f9b9b604ce0fd9c18ef134c705e5fa3430.omft.near",
190
- name: "EURe",
191
- decimals: 18
192
- },
193
- {
194
- assetId: "nep141:gnosis-0x9c58bacc331c9aa871afd802db6379a98e80cedb.omft.near",
195
- name: "GNO",
196
- decimals: 18
197
- },
198
- {
199
- assetId: "nep141:gnosis-0x6a023ccd1ff6f2045c3309768ead9e68f978f6e1.omft.near",
200
- name: "WETH",
168
+ assetId: "nep245:v2_1.omni.hot.tg:43114_11111111111111111111",
169
+ name: "AVAX",
201
170
  decimals: 18
202
171
  },
203
172
  {
204
- assetId: "nep141:gnosis.omft.near",
205
- name: "XDAI",
206
- decimals: 18
173
+ assetId: "nep245:v2_1.omni.hot.tg:43114_372BeH7ENZieCaabwkbWkBiTTgXp",
174
+ name: "USDT",
175
+ decimals: 6
207
176
  }
208
177
  ],
209
178
  needMemo: false
179
+ },
180
+ stargateInformation: {
181
+ support: true
210
182
  }
211
183
  }
212
184
  };
213
185
  }
214
186
  });
215
- var OPTIMISM;
187
+ exports.OPTIMISM = void 0;
216
188
  var init_Optimism = __esm({
217
189
  "src/chains/Evm/Optimism.ts"() {
218
190
  init_bundler();
219
- OPTIMISM = {
191
+ exports.OPTIMISM = {
220
192
  assets: [
221
193
  {
222
194
  name: "USDC",
@@ -245,7 +217,7 @@ var init_Optimism = __esm({
245
217
  ],
246
218
  evm: {
247
219
  chain: chains.optimism,
248
- rpcUrl: "https://opt-mainnet.g.alchemy.com/v2/49fUGmuW05ynCui0VEvDN",
220
+ rpcUrl: "https://mainnet.optimism.io",
249
221
  supports7702: false,
250
222
  erc4337: false,
251
223
  bundlerUrl: `${BUNDLER_URL}/rpc?chain=optimism`,
@@ -292,74 +264,140 @@ var init_Optimism = __esm({
292
264
  };
293
265
  }
294
266
  });
295
- var AVALANCHE;
296
- var init_Avalanche = __esm({
297
- "src/chains/Evm/Avalanche.ts"() {
267
+ exports.UNICHAIN = void 0;
268
+ var init_Unichain = __esm({
269
+ "src/chains/Evm/Unichain.ts"() {
298
270
  init_bundler();
299
- AVALANCHE = {
271
+ exports.UNICHAIN = {
300
272
  assets: [
301
273
  {
302
274
  name: "USDC",
303
275
  decimals: 6,
304
- address: "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",
305
- coingeckoId: "usd-coin",
306
- supportsStargate: true
276
+ address: "0x078D782b760474a361dDA0AF3839290b0EF57AD6",
277
+ coingeckoId: "usd-coin"
278
+ }
279
+ ],
280
+ evm: {
281
+ chain: chains.unichain,
282
+ rpcUrl: "https://unichain-mainnet.g.alchemy.com/v2/49fUGmuW05ynCui0VEvDN",
283
+ bundlerUrl: `${BUNDLER_URL}/rpc?chain=unichain`,
284
+ supports7702: true,
285
+ erc4337: false,
286
+ entryPointAddress: "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789",
287
+ factoryAddress: "0xB2E45aCbB68f3e98C87B6df16625f22e11728556",
288
+ paymasterAddress: "0x7A92b3Fee017E3E181a51D9045AACE30eC2B387D"
289
+ },
290
+ crossChainInformation: {
291
+ circleInformation: {
292
+ supportCirclePaymaster: true,
293
+ cCTPInformation: {
294
+ supportCCTP: true,
295
+ domain: 10
296
+ },
297
+ aproxFromFee: 0
307
298
  },
299
+ nearIntentInformation: null
300
+ }
301
+ };
302
+ }
303
+ });
304
+ var GNOSIS;
305
+ var init_Gnosis = __esm({
306
+ "src/chains/Evm/Gnosis.ts"() {
307
+ init_bundler();
308
+ GNOSIS = {
309
+ assets: [
308
310
  {
309
- name: "AVAX",
310
- decimals: 18,
311
- address: "0x0000000000000000000000000000000000000000",
312
- coingeckoId: "avalanche-2"
311
+ name: "USDC",
312
+ decimals: 6,
313
+ address: "0x2a22f9c3b484c3629090FeED35F17Ff8F88f76F0",
314
+ coingeckoId: "usd-coin"
313
315
  },
314
316
  {
315
317
  name: "USDT",
316
318
  decimals: 6,
317
- address: "0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7",
319
+ address: "0x4ECaBa5870353805a9F068101A40E0f32ed605C6",
318
320
  coingeckoId: "tether"
321
+ },
322
+ {
323
+ name: "EURe",
324
+ decimals: 18,
325
+ address: "0x420CA0f9B9b604cE0fd9C18EF134C705e5Fa3430",
326
+ coingeckoId: "monerium-eur-money"
327
+ },
328
+ {
329
+ name: "GNO",
330
+ decimals: 18,
331
+ address: "0x9C58BAcC331c9aa871AFD802DB6379a98e80CEdb",
332
+ coingeckoId: "gnosis"
333
+ },
334
+ {
335
+ name: "WETH",
336
+ decimals: 18,
337
+ address: "0x6A023CCd1ff6F2045C3309768eAd9E68F978f6e1",
338
+ coingeckoId: "ethereum"
339
+ },
340
+ {
341
+ name: "XDAI",
342
+ decimals: 18,
343
+ address: "0x0000000000000000000000000000000000000000",
344
+ coingeckoId: "xdai"
319
345
  }
320
346
  ],
321
347
  evm: {
322
- chain: chains.avalanche,
323
- rpcUrl: chains.avalanche.rpcUrls.default.http[0],
324
- supports7702: false,
325
- bundlerUrl: `${BUNDLER_URL}/rpc?chain=avalanche`,
326
- erc4337: false,
348
+ chain: chains.gnosis,
349
+ rpcUrl: chains.gnosis.rpcUrls.default.http[0],
350
+ supports7702: true,
351
+ erc4337: true,
352
+ bundlerUrl: `${BUNDLER_URL}/rpc?chain=gnosis`,
327
353
  entryPointAddress: "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789",
328
- factoryAddress: "0x5D1D71FE2De5D1C52c7c11311332eC7f0CBf88aF",
329
- paymasterAddress: "0x6c0de464F2203FE089FF719Acf425dFfE6ac1EE5"
354
+ factoryAddress: "0xC8a2Fb1f2E686417A131E09be3320cb5431CcD90",
355
+ paymasterAddress: "0x4C36C70d68a7c26326711e8268bb163E3784fA96"
330
356
  },
331
357
  crossChainInformation: {
332
358
  circleInformation: {
333
- supportCirclePaymaster: true,
359
+ supportCirclePaymaster: false,
360
+ aproxFromFee: 0,
334
361
  cCTPInformation: {
335
- supportCCTP: true,
336
- domain: 1
337
- },
338
- aproxFromFee: 0
362
+ supportCCTP: false,
363
+ domain: 0
364
+ }
339
365
  },
340
366
  nearIntentInformation: {
341
367
  support: true,
342
368
  assetsId: [
343
369
  {
344
- assetId: "nep245:v2_1.omni.hot.tg:43114_3atVJH3r5c4GqiSYmg9fECvjc47o",
370
+ assetId: "nep141:gnosis-0x2a22f9c3b484c3629090feed35f17ff8f88f76f0.omft.near",
345
371
  name: "USDC",
346
372
  decimals: 6
347
373
  },
348
374
  {
349
- assetId: "nep245:v2_1.omni.hot.tg:43114_11111111111111111111",
350
- name: "AVAX",
375
+ assetId: "nep141:gnosis-0x4ecaba5870353805a9f068101a40e0f32ed605c6.omft.near",
376
+ name: "USDT",
377
+ decimals: 6
378
+ },
379
+ {
380
+ assetId: "nep141:gnosis-0x420ca0f9b9b604ce0fd9c18ef134c705e5fa3430.omft.near",
381
+ name: "EURe",
351
382
  decimals: 18
352
383
  },
353
384
  {
354
- assetId: "nep245:v2_1.omni.hot.tg:43114_372BeH7ENZieCaabwkbWkBiTTgXp",
355
- name: "USDT",
356
- decimals: 6
385
+ assetId: "nep141:gnosis-0x9c58bacc331c9aa871afd802db6379a98e80cedb.omft.near",
386
+ name: "GNO",
387
+ decimals: 18
388
+ },
389
+ {
390
+ assetId: "nep141:gnosis-0x6a023ccd1ff6f2045c3309768ead9e68f978f6e1.omft.near",
391
+ name: "WETH",
392
+ decimals: 18
393
+ },
394
+ {
395
+ assetId: "nep141:gnosis.omft.near",
396
+ name: "XDAI",
397
+ decimals: 18
357
398
  }
358
399
  ],
359
400
  needMemo: false
360
- },
361
- stargateInformation: {
362
- support: true
363
401
  }
364
402
  }
365
403
  };
@@ -586,43 +624,6 @@ var init_Arbitrum = __esm({
586
624
  };
587
625
  }
588
626
  });
589
- var UNICHAIN;
590
- var init_Unichain = __esm({
591
- "src/chains/Evm/Unichain.ts"() {
592
- init_bundler();
593
- UNICHAIN = {
594
- assets: [
595
- {
596
- name: "USDC",
597
- decimals: 6,
598
- address: "0x078D782b760474a361dDA0AF3839290b0EF57AD6",
599
- coingeckoId: "usd-coin"
600
- }
601
- ],
602
- evm: {
603
- chain: chains.unichain,
604
- rpcUrl: "https://unichain-mainnet.g.alchemy.com/v2/49fUGmuW05ynCui0VEvDN",
605
- bundlerUrl: `${BUNDLER_URL}/rpc?chain=unichain`,
606
- supports7702: true,
607
- erc4337: false,
608
- entryPointAddress: "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789",
609
- factoryAddress: "0xB2E45aCbB68f3e98C87B6df16625f22e11728556",
610
- paymasterAddress: "0x7A92b3Fee017E3E181a51D9045AACE30eC2B387D"
611
- },
612
- crossChainInformation: {
613
- circleInformation: {
614
- supportCirclePaymaster: true,
615
- cCTPInformation: {
616
- supportCCTP: true,
617
- domain: 10
618
- },
619
- aproxFromFee: 0
620
- },
621
- nearIntentInformation: null
622
- }
623
- };
624
- }
625
- });
626
627
  var Monad;
627
628
  var init_Monad = __esm({
628
629
  "src/chains/Evm/Monad.ts"() {
@@ -740,6 +741,34 @@ var init_Stellar = __esm({
740
741
  }
741
742
  });
742
743
 
744
+ // src/chains/NoEvm/Stacks.ts
745
+ var STACKS;
746
+ var init_Stacks = __esm({
747
+ "src/chains/NoEvm/Stacks.ts"() {
748
+ STACKS = {
749
+ assets: [
750
+ {
751
+ name: "USDC",
752
+ decimals: 6,
753
+ address: "SP2ZNGJ15SD91GWW54B2Q1V31749666c2Q01",
754
+ // Placeholder or real Stacks token ID
755
+ coingeckoId: "usd-coin"
756
+ }
757
+ ],
758
+ nonEvm: {
759
+ serverURL: "https://api.mainnet.hiro.so"
760
+ },
761
+ crossChainInformation: {
762
+ circleInformation: {
763
+ supportCirclePaymaster: false,
764
+ aproxFromFee: 0
765
+ },
766
+ nearIntentInformation: null
767
+ }
768
+ };
769
+ }
770
+ });
771
+
743
772
  // src/services/StellarService.ts
744
773
  var StellarService_exports = {};
745
774
  __export(StellarService_exports, {
@@ -859,6 +888,17 @@ var init_facilitator = __esm({
859
888
  return isDev ? PlatformFees.DEV : PlatformFees.DEFAULT;
860
889
  };
861
890
  FACILITATOR_NETWORKS = {
891
+ Ethereum: {
892
+ chainId: chains.mainnet.id,
893
+ chain: chains.mainnet,
894
+ usdc: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
895
+ usdcName: "USD Coin",
896
+ usdcVersion: "2",
897
+ domain: 0,
898
+ tokenMessenger: "0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d",
899
+ messageTransmitter: "0x81D40F21F12A8F0E3252Bccb954D722d4c464B64",
900
+ rpcUrl: chains.mainnet.rpcUrls.default.http[0]
901
+ },
862
902
  Base: {
863
903
  chainId: 8453,
864
904
  chain: chains.base,
@@ -1127,6 +1167,68 @@ var init_WorldChain = __esm({
1127
1167
  };
1128
1168
  }
1129
1169
  });
1170
+ var ETHEREUM;
1171
+ var init_Ethereum = __esm({
1172
+ "src/chains/Evm/Ethereum.ts"() {
1173
+ init_bundler();
1174
+ ETHEREUM = {
1175
+ assets: [
1176
+ {
1177
+ name: "USDC",
1178
+ decimals: 6,
1179
+ address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
1180
+ coingeckoId: "usd-coin",
1181
+ supportsStargate: true
1182
+ },
1183
+ {
1184
+ name: "ETH",
1185
+ decimals: 18,
1186
+ address: "0x0000000000000000000000000000000000000000",
1187
+ coingeckoId: "ethereum"
1188
+ }
1189
+ ],
1190
+ evm: {
1191
+ chain: chains.mainnet,
1192
+ rpcUrl: chains.mainnet.rpcUrls.default.http[0],
1193
+ supports7702: true,
1194
+ erc4337: true,
1195
+ bundlerUrl: `${BUNDLER_URL}/rpc?chain=ethereum`,
1196
+ entryPointAddress: "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789",
1197
+ factoryAddress: "0xe2584152891E4769025807DEa0cD611F135aDC68",
1198
+ paymasterAddress: "0x1e13Eb16C565E3f3FDe49A011755e50410bb1F95"
1199
+ },
1200
+ crossChainInformation: {
1201
+ circleInformation: {
1202
+ supportCirclePaymaster: true,
1203
+ cCTPInformation: {
1204
+ supportCCTP: true,
1205
+ domain: 0
1206
+ },
1207
+ aproxFromFee: 0
1208
+ },
1209
+ nearIntentInformation: {
1210
+ support: true,
1211
+ assetsId: [
1212
+ {
1213
+ assetId: "nep141:eth-0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48.omft.near",
1214
+ name: "USDC",
1215
+ decimals: 6
1216
+ },
1217
+ {
1218
+ assetId: "nep141:eth.omft.near",
1219
+ name: "ETH",
1220
+ decimals: 18
1221
+ }
1222
+ ],
1223
+ needMemo: false
1224
+ },
1225
+ stargateInformation: {
1226
+ support: false
1227
+ }
1228
+ }
1229
+ };
1230
+ }
1231
+ });
1130
1232
 
1131
1233
  // src/chains/index.ts
1132
1234
  var init_chains = __esm({
@@ -1142,6 +1244,8 @@ var init_chains = __esm({
1142
1244
  init_Monad();
1143
1245
  init_Binance();
1144
1246
  init_Gnosis();
1247
+ init_Ethereum();
1248
+ init_Stacks();
1145
1249
  }
1146
1250
  });
1147
1251
 
@@ -1151,17 +1255,18 @@ var init_chainsInformation = __esm({
1151
1255
  "src/constants/chainsInformation.ts"() {
1152
1256
  init_chains();
1153
1257
  NETWORKS = {
1154
- Optimism: OPTIMISM,
1258
+ Optimism: exports.OPTIMISM,
1155
1259
  Arbitrum: ARBITRUM,
1156
- Base: BASE,
1157
- Unichain: UNICHAIN,
1260
+ Base: exports.BASE,
1261
+ Unichain: exports.UNICHAIN,
1158
1262
  Polygon: POLYGON,
1159
- Avalanche: AVALANCHE,
1263
+ Avalanche: exports.AVALANCHE,
1160
1264
  WorldChain: WORLD_CHAIN,
1161
1265
  Stellar: exports.STELLAR,
1162
1266
  Monad,
1163
1267
  BNB,
1164
- Gnosis: GNOSIS
1268
+ Gnosis: GNOSIS,
1269
+ Ethereum: ETHEREUM
1165
1270
  };
1166
1271
  }
1167
1272
  });
@@ -1408,7 +1513,7 @@ async function executeCCTPBridge(sourceChain, amount, crossChainConfig, facilita
1408
1513
  mintTransactionHash: mintHash,
1409
1514
  payer: payerAddress,
1410
1515
  fee: fee.toString(),
1411
- netAmount: amountBigInt.toString(),
1516
+ netAmount: (amountBigInt - fee).toString(),
1412
1517
  attestation: {
1413
1518
  message: attestationResponse.message,
1414
1519
  attestation: attestationResponse.attestation
@@ -1674,15 +1779,15 @@ var init_near = __esm({
1674
1779
  return { success: false, errorReason: `Stellar Verification Failed: ${e.message}` };
1675
1780
  }
1676
1781
  }
1677
- const { createPublicClient: createPublicClient4, http: http4 } = await import('viem');
1782
+ const { createPublicClient: createPublicClient5, http: http5 } = await import('viem');
1678
1783
  const { FACILITATOR_NETWORKS: FACILITATOR_NETWORKS2 } = await Promise.resolve().then(() => (init_facilitator(), facilitator_exports));
1679
1784
  const networkConfig = FACILITATOR_NETWORKS2[sourceChain];
1680
1785
  if (!networkConfig) {
1681
1786
  return { success: false, errorReason: `Unsupported source chain for verification: ${sourceChain}` };
1682
1787
  }
1683
- const publicClient = createPublicClient4({
1788
+ const publicClient = createPublicClient5({
1684
1789
  chain: networkConfig.chain,
1685
- transport: http4(networkConfig.rpcUrl)
1790
+ transport: http5(networkConfig.rpcUrl)
1686
1791
  });
1687
1792
  try {
1688
1793
  console.log(`[NearStrategy] Waiting for receipt...`);
@@ -1883,6 +1988,7 @@ var init_stargate = __esm({
1883
1988
  success: true,
1884
1989
  transactionHash: "PENDING_USER_SIGNATURE",
1885
1990
  netAmount: amount,
1991
+ estimatedReceived: selectedQuote.dstAmount,
1886
1992
  data: {
1887
1993
  strategy: "Stargate",
1888
1994
  quote: selectedQuote,
@@ -1906,6 +2012,221 @@ var init_stargate = __esm({
1906
2012
  };
1907
2013
  }
1908
2014
  });
2015
+ var STACKS_BRIDGE_ADDRESS_ETH, stacksBridgeAbi, StacksStrategy;
2016
+ var init_stacks = __esm({
2017
+ "src/services/stacks.ts"() {
2018
+ init_chainsInformation();
2019
+ STACKS_BRIDGE_ADDRESS_ETH = "0x8888888199b2Df864bf678259607d6D5EBb4e3Ce";
2020
+ stacksBridgeAbi = [
2021
+ {
2022
+ "inputs": [
2023
+ { "internalType": "uint256", "name": "value", "type": "uint256" },
2024
+ { "internalType": "uint32", "name": "remoteDomain", "type": "uint32" },
2025
+ { "internalType": "bytes32", "name": "remoteRecipient", "type": "bytes32" },
2026
+ { "internalType": "address", "name": "localToken", "type": "address" },
2027
+ { "internalType": "uint256", "name": "maxFee", "type": "uint256" },
2028
+ { "internalType": "bytes", "name": "hookData", "type": "bytes" }
2029
+ ],
2030
+ "name": "depositToRemote",
2031
+ "outputs": [],
2032
+ "stateMutability": "nonpayable",
2033
+ "type": "function"
2034
+ }
2035
+ ];
2036
+ StacksStrategy = class {
2037
+ constructor() {
2038
+ this.name = "Stacks";
2039
+ }
2040
+ canHandle(context) {
2041
+ return context.sourceChain === "Ethereum" && context.destChain === "Stacks";
2042
+ }
2043
+ async execute(context) {
2044
+ const { amount, recipient, facilitatorPrivateKey, sourceChain } = context;
2045
+ if (sourceChain !== "Ethereum") {
2046
+ return { success: false, errorReason: "Stacks Strategy only supports financing from Ethereum" };
2047
+ }
2048
+ if (!facilitatorPrivateKey) {
2049
+ return { success: false, errorReason: "Private Key required for Stacks Bridge execution" };
2050
+ }
2051
+ const networkConfig = NETWORKS[sourceChain];
2052
+ if (!networkConfig || !networkConfig.evm) {
2053
+ return { success: false, errorReason: `Unsupported chain or missing EVM config: ${sourceChain}` };
2054
+ }
2055
+ try {
2056
+ const account = accounts.privateKeyToAccount(facilitatorPrivateKey);
2057
+ const client = viem.createWalletClient({
2058
+ account,
2059
+ chain: networkConfig.evm.chain,
2060
+ transport: viem.http(networkConfig.evm.rpcUrl)
2061
+ });
2062
+ const publicClient = viem.createPublicClient({
2063
+ chain: networkConfig.evm.chain,
2064
+ transport: viem.http(networkConfig.evm.rpcUrl)
2065
+ });
2066
+ const ethAssets = NETWORKS["Ethereum"].assets;
2067
+ const usdcToken = ethAssets.find((a) => a.name === "USDC");
2068
+ if (!usdcToken || !usdcToken.address) throw new Error("USDC config/address not found for Ethereum");
2069
+ const usdcAddress = viem.getAddress(usdcToken.address);
2070
+ const amountBigInt = viem.parseUnits(amount, 6);
2071
+ const balance = await publicClient.readContract({
2072
+ address: usdcAddress,
2073
+ abi: viem.erc20Abi,
2074
+ functionName: "balanceOf",
2075
+ args: [account.address]
2076
+ });
2077
+ if (balance < amountBigInt) {
2078
+ throw new Error(`Insufficient USDC balance on Ethereum (Facilitator). Has: ${balance}, Needed: ${amountBigInt}`);
2079
+ }
2080
+ const allowance = await publicClient.readContract({
2081
+ address: usdcAddress,
2082
+ abi: viem.erc20Abi,
2083
+ functionName: "allowance",
2084
+ args: [account.address, STACKS_BRIDGE_ADDRESS_ETH]
2085
+ });
2086
+ if (allowance < amountBigInt) {
2087
+ console.log("[Stacks] Approving bridge...");
2088
+ const approveHash = await client.writeContract({
2089
+ address: usdcAddress,
2090
+ abi: viem.erc20Abi,
2091
+ functionName: "approve",
2092
+ args: [STACKS_BRIDGE_ADDRESS_ETH, amountBigInt],
2093
+ chain: networkConfig.evm.chain
2094
+ });
2095
+ await publicClient.waitForTransactionReceipt({ hash: approveHash });
2096
+ console.log("[Stacks] Approved.");
2097
+ }
2098
+ const REMOTE_DOMAIN_STACKS = 10003;
2099
+ let recipientBytes32;
2100
+ if (recipient.startsWith("0x")) {
2101
+ recipientBytes32 = viem.padHex(recipient, { size: 32 });
2102
+ } else {
2103
+ try {
2104
+ const [version, hash2] = c32check.c32addressDecode(recipient);
2105
+ recipientBytes32 = viem.padHex(`0x${hash2}`, { size: 32 });
2106
+ } catch (e) {
2107
+ throw new Error(`Invalid Stacks Recipient: ${e.message}`);
2108
+ }
2109
+ }
2110
+ console.log(`[Stacks] Depositing ${amount} USDC to ${recipient} (Domain ${REMOTE_DOMAIN_STACKS})...`);
2111
+ const hash = await client.writeContract({
2112
+ address: STACKS_BRIDGE_ADDRESS_ETH,
2113
+ abi: stacksBridgeAbi,
2114
+ functionName: "depositToRemote",
2115
+ args: [
2116
+ amountBigInt,
2117
+ REMOTE_DOMAIN_STACKS,
2118
+ recipientBytes32,
2119
+ usdcAddress,
2120
+ 0n,
2121
+ // maxFee
2122
+ "0x"
2123
+ // hookData
2124
+ ],
2125
+ chain: networkConfig.evm.chain
2126
+ });
2127
+ console.log(`[Stacks] Deposit Tx: ${hash}`);
2128
+ const receipt = await publicClient.waitForTransactionReceipt({ hash });
2129
+ if (receipt.status === "success") {
2130
+ return {
2131
+ success: true,
2132
+ transactionHash: hash,
2133
+ netAmount: amountBigInt.toString()
2134
+ };
2135
+ } else {
2136
+ return {
2137
+ success: false,
2138
+ transactionHash: hash,
2139
+ errorReason: "Stacks Deposit Transaction Reverted"
2140
+ };
2141
+ }
2142
+ } catch (error) {
2143
+ return {
2144
+ success: false,
2145
+ errorReason: error instanceof Error ? error.message : "Using Stacks Bridge failed"
2146
+ };
2147
+ }
2148
+ }
2149
+ };
2150
+ }
2151
+ });
2152
+
2153
+ // src/services/Router.ts
2154
+ exports.RouterService = void 0;
2155
+ var init_Router = __esm({
2156
+ "src/services/Router.ts"() {
2157
+ exports.RouterService = class {
2158
+ /**
2159
+ * Orchestrates a Multi-Hop transfer by signing ALL UserOps upfront (Reverse Order),
2160
+ * and then executing them sequentially (Forward Order) with polling support.
2161
+ *
2162
+ * @param steps Array of MultiHopStep ordered by execution (Source -> Intermediate -> Dest)
2163
+ * @param onLog Optional callback for logging progress
2164
+ */
2165
+ async executeMultiHop(steps, onLog = console.log) {
2166
+ onLog("[Router] Orchestrating Multi-Hop Sequence...");
2167
+ const signedOps = [];
2168
+ onLog("[Router] Phase 1: Preparation & Upfront Signing (Reverse Order)...");
2169
+ for (let i = steps.length - 1; i >= 0; i--) {
2170
+ const step = steps[i];
2171
+ onLog(`[Router] Preparing Step ${i + 1}: ${step.description}...`);
2172
+ try {
2173
+ const userOp = await step.buildUserOp();
2174
+ onLog(`[Router] Please sign Step ${i + 1} (${step.description})...`);
2175
+ const signedOp = await step.aa.signUserOperation(userOp);
2176
+ signedOps.unshift({ stepIndex: i, signedOp });
2177
+ onLog(`[Router] Step ${i + 1} Signed Successfully.`);
2178
+ } catch (err) {
2179
+ onLog(`[Router] Error preparing Step ${i + 1}: ${err.message}`);
2180
+ throw err;
2181
+ }
2182
+ }
2183
+ onLog("[Router] Phase 2: Sequential Execution (Forward Order)...");
2184
+ for (let i = 0; i < steps.length; i++) {
2185
+ const step = steps[i];
2186
+ const signedOp = signedOps[i].signedOp;
2187
+ if (step.waitCondition) {
2188
+ onLog(`[Router] Step ${i + 1} requires waiting (e.g. for funds)...`);
2189
+ const success = await this.pollCondition(step.waitCondition, onLog);
2190
+ if (!success) throw new Error(`Timeout waiting for condition at Step ${i + 1}`);
2191
+ }
2192
+ onLog(`[Router] Executing Step ${i + 1}...`);
2193
+ try {
2194
+ const hash = await step.aa.sendUserOperation(signedOp);
2195
+ onLog(`[Router] Step ${i + 1} Sent! Hash: ${hash}`);
2196
+ onLog(`[Router] Waiting for Step ${i + 1} confirmation...`);
2197
+ const receipt = await step.aa.waitForUserOperation(hash);
2198
+ if (!receipt.success) {
2199
+ throw new Error(`Step ${i + 1} Failed on-chain!`);
2200
+ }
2201
+ onLog(`[Router] Step ${i + 1} Confirmed.`);
2202
+ } catch (err) {
2203
+ onLog(`[Router] Execution Failed at Step ${i + 1}: ${err.message}`);
2204
+ throw err;
2205
+ }
2206
+ }
2207
+ onLog("[Router] Multi-Hop Sequence Completed Successfully! \u{1F680}");
2208
+ return true;
2209
+ }
2210
+ async pollCondition(condition, onLog) {
2211
+ const timeout = 6e4 * 10;
2212
+ const interval = 5e3;
2213
+ let elapsed = 0;
2214
+ while (elapsed < timeout) {
2215
+ try {
2216
+ const passed = await condition();
2217
+ if (passed) return true;
2218
+ } catch (e) {
2219
+ onLog(`[Router] Polling check failed (retrying): ${e.message}`);
2220
+ }
2221
+ await new Promise((r) => setTimeout(r, interval));
2222
+ elapsed += interval;
2223
+ if (elapsed % 2e4 === 0) onLog(`[Router] Still waiting... (${Math.floor(elapsed / 1e3)}s)`);
2224
+ }
2225
+ return false;
2226
+ }
2227
+ };
2228
+ }
2229
+ });
1909
2230
 
1910
2231
  // src/services/TransferManager.ts
1911
2232
  var TransferManager_exports = {};
@@ -1918,17 +2239,24 @@ var init_TransferManager = __esm({
1918
2239
  init_cctp2();
1919
2240
  init_near();
1920
2241
  init_stargate();
2242
+ init_stacks();
2243
+ init_Router();
2244
+ init_chainsInformation();
1921
2245
  exports.TransferManager = class {
1922
2246
  constructor() {
1923
2247
  this.strategies = [
1924
2248
  new exports.CCTPStrategy(),
1925
2249
  new exports.StargateStrategy(),
1926
- new exports.NearStrategy()
2250
+ new exports.StargateStrategy(),
2251
+ new exports.NearStrategy(),
2252
+ new StacksStrategy()
1927
2253
  ];
2254
+ this.router = new exports.RouterService();
1928
2255
  }
1929
- async execute(context) {
2256
+ async execute(context, logCallback) {
2257
+ const log = logCallback || console.log;
1930
2258
  if (context.sourceChain === context.destChain && context.sourceToken === context.destToken) {
1931
- console.log(`[TransferManager] Same Chain detected. Signal Direct Transfer.`);
2259
+ log(`[TransferManager] Same Chain detected. Signal Direct Transfer.`);
1932
2260
  return {
1933
2261
  success: true,
1934
2262
  transactionHash: "DIRECT_TRANSFER_REQUIRED",
@@ -1940,20 +2268,38 @@ var init_TransferManager = __esm({
1940
2268
  }
1941
2269
  };
1942
2270
  }
2271
+ if (context.destChain === "Stacks" && context.sourceChain !== "Ethereum") {
2272
+ const networkConfig = NETWORKS[context.sourceChain];
2273
+ if (networkConfig?.crossChainInformation?.circleInformation?.cCTPInformation?.supportCCTP) {
2274
+ log(`[TransferManager] Auto-Routing to Stacks via CCTP (${context.sourceChain} -> Ethereum -> Stacks)`);
2275
+ if (!context.sourceAA || !context.facilitatorPrivateKey) {
2276
+ return {
2277
+ success: false,
2278
+ errorReason: "Source AA and Facilitator Private Key required for Stacks Multi-Hop"
2279
+ };
2280
+ }
2281
+ return this.executeEVMToStacks(
2282
+ context,
2283
+ context.sourceAA,
2284
+ context.facilitatorPrivateKey,
2285
+ logCallback
2286
+ );
2287
+ }
2288
+ }
1943
2289
  const strategies = this.strategies;
1944
2290
  const stargateStrategy = strategies.find((s) => s instanceof exports.StargateStrategy);
1945
2291
  if (stargateStrategy && stargateStrategy.canHandle(context)) {
1946
- console.log(`[TransferManager] Routing to: ${stargateStrategy.name} (Stargate)`);
2292
+ log(`[TransferManager] Routing to: ${stargateStrategy.name} (Stargate)`);
1947
2293
  return stargateStrategy.execute(context);
1948
2294
  }
1949
2295
  const cctpStrategy = strategies.find((s) => s instanceof exports.CCTPStrategy);
1950
2296
  if (cctpStrategy && cctpStrategy.canHandle(context)) {
1951
- console.log(`[TransferManager] Routing to: ${cctpStrategy.name} (CCTP)`);
2297
+ log(`[TransferManager] Routing to: ${cctpStrategy.name} (CCTP)`);
1952
2298
  return cctpStrategy.execute(context);
1953
2299
  }
1954
2300
  const nearStrategy = strategies.find((s) => s instanceof exports.NearStrategy);
1955
2301
  if (nearStrategy && nearStrategy.canHandle(context)) {
1956
- console.log(`[TransferManager] Routing to: ${nearStrategy.name} (Near)`);
2302
+ log(`[TransferManager] Routing to: ${nearStrategy.name} (Near)`);
1957
2303
  return nearStrategy.execute(context);
1958
2304
  }
1959
2305
  return {
@@ -1961,6 +2307,115 @@ var init_TransferManager = __esm({
1961
2307
  errorReason: `No suitable transfer strategy found for ${context.sourceChain} -> ${context.destChain}`
1962
2308
  };
1963
2309
  }
2310
+ /**
2311
+ * Specialized method for Base/Unichain -> Stacks flow.
2312
+ * 1. EVM (Base/Unichain) -> Ethereum (CCTP)
2313
+ * 2. Ethereum -> Stacks (Stacks Bridge)
2314
+ */
2315
+ async executeEVMToStacks(context, sourceAA, ethPrivateKey, logCallback) {
2316
+ const log = logCallback || console.log;
2317
+ log(`[TransferManager] Starting ${context.sourceChain} -> Stacks Flow...`);
2318
+ const cctpStrategy = this.strategies.find((s) => s instanceof exports.CCTPStrategy);
2319
+ const stacksStrategy = this.strategies.find((s) => s instanceof StacksStrategy);
2320
+ if (context.sourceChain === "Ethereum") {
2321
+ log("[TransferManager] Source is Ethereum. Executing Stacks Bridge Step...");
2322
+ return stacksStrategy.execute({
2323
+ ...context,
2324
+ facilitatorPrivateKey: ethPrivateKey
2325
+ });
2326
+ }
2327
+ const sourceConfig = NETWORKS[context.sourceChain];
2328
+ const supportsCCTP = sourceConfig?.crossChainInformation?.circleInformation?.cCTPInformation?.supportCCTP;
2329
+ if (supportsCCTP) {
2330
+ log(`[TransferManager] Step 1: ${context.sourceChain} -> Ethereum (via CCTP)`);
2331
+ const ethAccount = accounts.privateKeyToAccount(ethPrivateKey);
2332
+ const ethAddress = ethAccount.address;
2333
+ log(`[TransferManager] Funding Facilitator (${ethAddress})...`);
2334
+ try {
2335
+ const amountBigInt = viem.parseUnits(context.amount, 6);
2336
+ const executeFunding = async () => {
2337
+ try {
2338
+ return await sourceAA.smartTransfer(
2339
+ "USDC",
2340
+ ethAddress,
2341
+ amountBigInt
2342
+ );
2343
+ } catch (e) {
2344
+ const msg = e.message || String(e);
2345
+ if (msg.includes("Approval required")) {
2346
+ log("[TransferManager] Approval Required. Approving USDC...");
2347
+ const saAddress = await sourceAA.getSmartAccount();
2348
+ if (!saAddress) throw new Error("SA Address missing for approval");
2349
+ await sourceAA.approveToken(sourceAA.getTokenAddress("USDC"), saAddress, amountBigInt);
2350
+ log("[TransferManager] Approved. Retrying Transfer...");
2351
+ return await sourceAA.smartTransfer(
2352
+ "USDC",
2353
+ ethAddress,
2354
+ amountBigInt
2355
+ );
2356
+ }
2357
+ throw e;
2358
+ }
2359
+ };
2360
+ const transferResult = await executeFunding();
2361
+ if ("success" in transferResult && !transferResult.success) {
2362
+ throw new Error("Funding Transfer Failed");
2363
+ }
2364
+ const fundingHash = transferResult.receipt.transactionHash;
2365
+ log(`[TransferManager] Funds Sent. Hash: ${fundingHash}`);
2366
+ const cctpResult = await cctpStrategy.execute({
2367
+ ...context,
2368
+ destChain: "Ethereum",
2369
+ destToken: "USDC",
2370
+ recipient: ethAddress,
2371
+ facilitatorPrivateKey: ethPrivateKey,
2372
+ depositTxHash: fundingHash
2373
+ });
2374
+ if (!cctpResult.success) {
2375
+ return cctpResult;
2376
+ }
2377
+ log("[TransferManager] CCTP Step Initiated.");
2378
+ if (cctpResult.mintTransactionHash) {
2379
+ log("[TransferManager] CCTP Complete (Funds on Ethereum). Proceeding to Stacks Step...");
2380
+ const stacksResult = await stacksStrategy.execute({
2381
+ ...context,
2382
+ sourceChain: "Ethereum",
2383
+ amount: cctpResult.netAmount ? viem.formatUnits(BigInt(cctpResult.netAmount), 6) : context.amount,
2384
+ facilitatorPrivateKey: ethPrivateKey
2385
+ });
2386
+ return {
2387
+ success: stacksResult.success,
2388
+ transactionHash: stacksResult.transactionHash,
2389
+ data: {
2390
+ fundingStep: { transactionHash: fundingHash },
2391
+ cctpStep: cctpResult,
2392
+ stacksStep: stacksResult
2393
+ },
2394
+ netAmount: stacksResult.netAmount,
2395
+ errorReason: stacksResult.errorReason
2396
+ };
2397
+ } else {
2398
+ log("[TransferManager] CCTP Pending. Please resume later.");
2399
+ return {
2400
+ ...cctpResult,
2401
+ attestation: {
2402
+ message: "CCTP Initiated but not finalized.",
2403
+ attestation: cctpResult.attestation?.attestation || ""
2404
+ }
2405
+ };
2406
+ }
2407
+ } catch (err) {
2408
+ return {
2409
+ success: false,
2410
+ errorReason: `Funding/CCTP Failed: ${err instanceof Error ? err.message : String(err)}`
2411
+ };
2412
+ }
2413
+ }
2414
+ return {
2415
+ success: false,
2416
+ errorReason: `Unsupported Route for ${context.sourceChain}->Stacks Helper`
2417
+ };
2418
+ }
1964
2419
  };
1965
2420
  }
1966
2421
  });
@@ -2174,6 +2629,24 @@ var BundlerClient = class {
2174
2629
  amount.toString()
2175
2630
  ]);
2176
2631
  }
2632
+ async scheduleUserOp(userOp, condition) {
2633
+ return await this.call("bundler_scheduleUserOp", [
2634
+ {
2635
+ sender: userOp.sender,
2636
+ nonce: "0x" + userOp.nonce.toString(16),
2637
+ initCode: userOp.initCode,
2638
+ callData: userOp.callData,
2639
+ callGasLimit: "0x" + userOp.callGasLimit.toString(16),
2640
+ verificationGasLimit: "0x" + userOp.verificationGasLimit.toString(16),
2641
+ preVerificationGas: "0x" + userOp.preVerificationGas.toString(16),
2642
+ maxFeePerGas: "0x" + userOp.maxFeePerGas.toString(16),
2643
+ maxPriorityFeePerGas: "0x" + userOp.maxPriorityFeePerGas.toString(16),
2644
+ paymasterAndData: userOp.paymasterAndData,
2645
+ signature: userOp.signature
2646
+ },
2647
+ condition
2648
+ ]);
2649
+ }
2177
2650
  };
2178
2651
  var TokenService = class {
2179
2652
  constructor(chainConfig, publicClient) {
@@ -2396,6 +2869,23 @@ var AccountAbstraction = class {
2396
2869
  this.tokenService = new TokenService(chainConfig, this.publicClient);
2397
2870
  this.userOpBuilder = new UserOpBuilder(chainConfig, this.bundlerClient, this.publicClient);
2398
2871
  }
2872
+ getBundlerClient() {
2873
+ return this.bundlerClient;
2874
+ }
2875
+ getChainId() {
2876
+ return this.chainConfig.chain.id;
2877
+ }
2878
+ getPublicClient() {
2879
+ return this.publicClient;
2880
+ }
2881
+ async buildUserOperation(transaction) {
2882
+ if (!this.owner || !this.smartAccountAddress) throw new Error("Not connected");
2883
+ return this.userOpBuilder.buildUserOperationBatch(this.owner, this.smartAccountAddress, [transaction]);
2884
+ }
2885
+ async buildBatchUserOperation(transactions) {
2886
+ if (!this.owner || !this.smartAccountAddress) throw new Error("Not connected");
2887
+ return this.userOpBuilder.buildUserOperationBatch(this.owner, this.smartAccountAddress, transactions);
2888
+ }
2399
2889
  async connect(signer) {
2400
2890
  if (typeof signer === "string") {
2401
2891
  const account = accounts.privateKeyToAccount(signer);
@@ -2474,13 +2964,29 @@ var AccountAbstraction = class {
2474
2964
  * Get the Smart Account address for an owner
2475
2965
  */
2476
2966
  async getSmartAccountAddress(owner) {
2477
- const address = await this.publicClient.readContract({
2478
- address: this.factoryAddress,
2479
- abi: factoryAbi,
2480
- functionName: "getAccountAddress",
2481
- args: [owner, 0n]
2482
- });
2483
- return address;
2967
+ try {
2968
+ const address = await this.publicClient.readContract({
2969
+ address: this.factoryAddress,
2970
+ abi: factoryAbi,
2971
+ functionName: "getAccountAddress",
2972
+ args: [owner, 0n]
2973
+ });
2974
+ return address;
2975
+ } catch (e) {
2976
+ try {
2977
+ const { result } = await this.publicClient.simulateContract({
2978
+ address: this.factoryAddress,
2979
+ abi: factoryAbi,
2980
+ functionName: "createAccount",
2981
+ args: [owner, 0n],
2982
+ account: "0x0000000000000000000000000000000000000000"
2983
+ // Zero address or random for simulation
2984
+ });
2985
+ return result;
2986
+ } catch (inner) {
2987
+ throw e;
2988
+ }
2989
+ }
2484
2990
  }
2485
2991
  // --- Token Methods (Delegated) ---
2486
2992
  getTokenAddress(token) {
@@ -2737,6 +3243,12 @@ var AccountAbstraction = class {
2737
3243
  }
2738
3244
  };
2739
3245
 
3246
+ // src/index.ts
3247
+ init_Base();
3248
+ init_Avalanche();
3249
+ init_Optimism();
3250
+ init_Unichain();
3251
+
2740
3252
  // src/chains.ts
2741
3253
  init_Base();
2742
3254
  init_Gnosis();
@@ -2778,11 +3290,14 @@ init_Arbitrum();
2778
3290
  init_Unichain();
2779
3291
  init_Monad();
2780
3292
  init_Stellar();
3293
+ init_Stacks();
2781
3294
  function mapToSDKConfig(data) {
2782
3295
  if (data.nonEvm) {
3296
+ const isStacks = data.assets[0].address?.toString().startsWith("SP") || data.nonEvm.serverURL?.includes("hiro");
3297
+ const chainId = isStacks ? 5e3 : 9e3;
3298
+ const chainName = isStacks ? "Stacks" : "Stellar";
2783
3299
  return {
2784
- chain: { id: 9e3, name: "Stellar" },
2785
- // Custom ID for Stellar
3300
+ chain: { id: chainId, name: chainName },
2786
3301
  tokens: data.assets.map((a) => ({
2787
3302
  symbol: a.name,
2788
3303
  decimals: a.decimals,
@@ -2805,17 +3320,18 @@ function mapToSDKConfig(data) {
2805
3320
  }))
2806
3321
  };
2807
3322
  }
2808
- var BASE_MAINNET = mapToSDKConfig(BASE);
2809
- var OPTIMISM_MAINNET = mapToSDKConfig(OPTIMISM);
3323
+ var BASE_MAINNET = mapToSDKConfig(exports.BASE);
3324
+ var OPTIMISM_MAINNET = mapToSDKConfig(exports.OPTIMISM);
2810
3325
  var GNOSIS_MAINNET = mapToSDKConfig(GNOSIS);
2811
3326
  var BASE_SEPOLIA2 = mapToSDKConfig(BASE_SEPOLIA);
2812
- var AVALANCHE_MAINNET = mapToSDKConfig(AVALANCHE);
3327
+ var AVALANCHE_MAINNET = mapToSDKConfig(exports.AVALANCHE);
2813
3328
  var BSC_MAINNET = mapToSDKConfig(BNB);
2814
3329
  var POLYGON_MAINNET = mapToSDKConfig(POLYGON);
2815
3330
  var ARBITRUM_MAINNET = mapToSDKConfig(ARBITRUM);
2816
- var UNICHAIN_MAINNET = mapToSDKConfig(UNICHAIN);
3331
+ var UNICHAIN_MAINNET = mapToSDKConfig(exports.UNICHAIN);
2817
3332
  var MONAD_MAINNET = mapToSDKConfig(Monad);
2818
3333
  var STELLAR_MAINNET = mapToSDKConfig(exports.STELLAR);
3334
+ var STACKS_MAINNET = mapToSDKConfig(STACKS);
2819
3335
  var CHAIN_CONFIGS = {
2820
3336
  [chains.base.id]: BASE_MAINNET,
2821
3337
  [chains.baseSepolia.id]: BASE_SEPOLIA2,
@@ -2827,9 +3343,11 @@ var CHAIN_CONFIGS = {
2827
3343
  [chains.arbitrum.id]: ARBITRUM_MAINNET,
2828
3344
  [chains.unichain.id]: UNICHAIN_MAINNET,
2829
3345
  [chains.monad.id]: MONAD_MAINNET,
2830
- 9e3: STELLAR_MAINNET
3346
+ 9e3: STELLAR_MAINNET,
3347
+ 5e3: STACKS_MAINNET
2831
3348
  };
2832
3349
  var CHAIN_ID_TO_KEY = {
3350
+ [chains.mainnet.id]: "Ethereum",
2833
3351
  [chains.base.id]: "Base",
2834
3352
  [chains.baseSepolia.id]: "Base",
2835
3353
  [chains.gnosis.id]: "Gnosis",
@@ -2841,7 +3359,8 @@ var CHAIN_ID_TO_KEY = {
2841
3359
  [chains.avalanche.id]: "Avalanche",
2842
3360
  [chains.unichain.id]: "Unichain",
2843
3361
  [chains.monad.id]: "Monad",
2844
- "9000": "Stellar"
3362
+ "9000": "Stellar",
3363
+ "5000": "Stacks"
2845
3364
  };
2846
3365
 
2847
3366
  // src/index.ts
@@ -2936,18 +3455,29 @@ var UniswapService = class {
2936
3455
  };
2937
3456
  var uniswapService = new UniswapService();
2938
3457
 
3458
+ // src/index.ts
3459
+ init_Router();
3460
+
3461
+ exports.ARBITRUM_MAINNET = ARBITRUM_MAINNET;
3462
+ exports.AVALANCHE_MAINNET = AVALANCHE_MAINNET;
2939
3463
  exports.AccountAbstraction = AccountAbstraction;
2940
3464
  exports.BASE_MAINNET = BASE_MAINNET;
2941
3465
  exports.BASE_SEPOLIA = BASE_SEPOLIA2;
3466
+ exports.BSC_MAINNET = BSC_MAINNET;
2942
3467
  exports.BundlerClient = BundlerClient;
2943
3468
  exports.CHAIN_CONFIGS = CHAIN_CONFIGS;
2944
3469
  exports.CHAIN_ID_TO_KEY = CHAIN_ID_TO_KEY;
2945
3470
  exports.GNOSIS_MAINNET = GNOSIS_MAINNET;
3471
+ exports.MONAD_MAINNET = MONAD_MAINNET;
2946
3472
  exports.OPTIMISM_MAINNET = OPTIMISM_MAINNET;
3473
+ exports.POLYGON_MAINNET = POLYGON_MAINNET;
3474
+ exports.STACKS_MAINNET = STACKS_MAINNET;
2947
3475
  exports.STELLAR_MAINNET = STELLAR_MAINNET;
3476
+ exports.UNICHAIN_MAINNET = UNICHAIN_MAINNET;
2948
3477
  exports.UniswapService = UniswapService;
2949
3478
  exports.entryPointAbi = entryPointAbi;
2950
3479
  exports.erc20Abi = erc20Abi;
3480
+ exports.getNearQuote = getNearQuote;
2951
3481
  exports.getNearSimulation = getNearSimulation;
2952
3482
  exports.getStargateSimulation = getStargateSimulation;
2953
3483
  exports.smartAccountAbi = smartAccountAbi;