@reown/appkit-cdn 1.6.6-basic-test.3.0 → 1.6.6-basic-test.4.0
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/{appkit-QKuZmMgA.js → appkit-hZyGLfr5.js} +570 -1054
- package/dist/{appkit-QKuZmMgA.js.map → appkit-hZyGLfr5.js.map} +1 -1
- package/dist/appkit.js +8 -8
- package/dist/{ccip-DTQod-hH.js → ccip-B6Wvu04X.js} +2 -2
- package/dist/{ccip-DTQod-hH.js.map → ccip-B6Wvu04X.js.map} +1 -1
- package/dist/{email-BHtY-2Dy.js → email-7OXbz6hc.js} +8 -8
- package/dist/{email-BHtY-2Dy.js.map → email-7OXbz6hc.js.map} +1 -1
- package/dist/{embedded-wallet-BSIVNePZ.js → embedded-wallet-CWsQPgCa.js} +10 -10
- package/dist/{embedded-wallet-BSIVNePZ.js.map → embedded-wallet-CWsQPgCa.js.map} +1 -1
- package/dist/{hooks.module-B_SL4e3C.js → hooks.module-4F6xH2-y.js} +2 -2
- package/dist/{hooks.module-B_SL4e3C.js.map → hooks.module-4F6xH2-y.js.map} +1 -1
- package/dist/{if-defined-rsGAB-1O.js → if-defined-dGSnGaje.js} +2 -2
- package/dist/{if-defined-rsGAB-1O.js.map → if-defined-dGSnGaje.js.map} +1 -1
- package/dist/{index-PPxE_aJ2.js → index-B7JVTsPu.js} +4 -4
- package/dist/{index-PPxE_aJ2.js.map → index-B7JVTsPu.js.map} +1 -1
- package/dist/{index-Bzbkp9J1.js → index-BL61_ej1.js} +3 -3
- package/dist/{index-Bzbkp9J1.js.map → index-BL61_ej1.js.map} +1 -1
- package/dist/{index-UxGgQkhj.js → index-BTN5XFWn.js} +2 -2
- package/dist/{index-UxGgQkhj.js.map → index-BTN5XFWn.js.map} +1 -1
- package/dist/{index-TJGavkJc.js → index-BYhbfdIT.js} +4 -4
- package/dist/{index-TJGavkJc.js.map → index-BYhbfdIT.js.map} +1 -1
- package/dist/{index-oHFxrT0W.js → index-BbYzNK-e.js} +3 -3
- package/dist/{index-oHFxrT0W.js.map → index-BbYzNK-e.js.map} +1 -1
- package/dist/{index-BKPGhBuk.js → index-BduA1I0K.js} +23 -23
- package/dist/{index-BKPGhBuk.js.map → index-BduA1I0K.js.map} +1 -1
- package/dist/{index-2BB7m0jA.js → index-BgPMLnwu.js} +3 -3
- package/dist/{index-2BB7m0jA.js.map → index-BgPMLnwu.js.map} +1 -1
- package/dist/{index-BaVc-y5K.js → index-Brwaxkkt.js} +3 -3
- package/dist/{index-BaVc-y5K.js.map → index-Brwaxkkt.js.map} +1 -1
- package/dist/{index-DgDB5NSF.js → index-C3KSKBRd.js} +4 -4
- package/dist/{index-DgDB5NSF.js.map → index-C3KSKBRd.js.map} +1 -1
- package/dist/{index-DwxWldFG.js → index-C49v39-_.js} +3 -3
- package/dist/{index-DwxWldFG.js.map → index-C49v39-_.js.map} +1 -1
- package/dist/{index-CDO9KQE4.js → index-C4H1nkXm.js} +3 -3
- package/dist/{index-CDO9KQE4.js.map → index-C4H1nkXm.js.map} +1 -1
- package/dist/{index-B6ggk5Ql.js → index-C7DuE4bF.js} +4 -4
- package/dist/{index-B6ggk5Ql.js.map → index-C7DuE4bF.js.map} +1 -1
- package/dist/{index-C-cKNSdx.js → index-CB1JDQ6y.js} +4 -3
- package/dist/{index-C-cKNSdx.js.map → index-CB1JDQ6y.js.map} +1 -1
- package/dist/{index-Mg_DgNXz.js → index-CIFWL_Te.js} +4 -4
- package/dist/{index-Mg_DgNXz.js.map → index-CIFWL_Te.js.map} +1 -1
- package/dist/{index-Dcg9z57Z.js → index-CewBInzg.js} +4 -3
- package/dist/{index-Dcg9z57Z.js.map → index-CewBInzg.js.map} +1 -1
- package/dist/{index-BCtXT0Yi.js → index-Ch4lVZT8.js} +6 -6
- package/dist/{index-BCtXT0Yi.js.map → index-Ch4lVZT8.js.map} +1 -1
- package/dist/{index-BIjhOWIU.js → index-ClYdxQHq.js} +4 -4
- package/dist/{index-BIjhOWIU.js.map → index-ClYdxQHq.js.map} +1 -1
- package/dist/{index-DCLENwVM.js → index-CvV6W9De.js} +42 -3
- package/dist/index-CvV6W9De.js.map +1 -0
- package/dist/index-CwuY13YQ.js +608 -0
- package/dist/index-CwuY13YQ.js.map +1 -0
- package/dist/{index-BpZcJPob.js → index-DAEKpLXx.js} +7 -7
- package/dist/{index-BpZcJPob.js.map → index-DAEKpLXx.js.map} +1 -1
- package/dist/{index-T0OtVHIR.js → index-DFatup-x.js} +3 -3
- package/dist/{index-T0OtVHIR.js.map → index-DFatup-x.js.map} +1 -1
- package/dist/{index-CPZ4ZWAB.js → index-DQp_pmaP.js} +4 -4
- package/dist/{index-CPZ4ZWAB.js.map → index-DQp_pmaP.js.map} +1 -1
- package/dist/{index-BTYkf8kt.js → index-DYWDcSOu.js} +3 -3
- package/dist/{index-BTYkf8kt.js.map → index-DYWDcSOu.js.map} +1 -1
- package/dist/{index-CZizR5X9.js → index-Df5vKTIW.js} +3 -3
- package/dist/{index-CZizR5X9.js.map → index-Df5vKTIW.js.map} +1 -1
- package/dist/{index-Dl4DYGOg.js → index-DiAf99cR.js} +4 -4
- package/dist/{index-Dl4DYGOg.js.map → index-DiAf99cR.js.map} +1 -1
- package/dist/{index-CrF1ZhwC.js → index-DmwSb988.js} +5 -5
- package/dist/{index-CrF1ZhwC.js.map → index-DmwSb988.js.map} +1 -1
- package/dist/{index-DQdtZuhJ.js → index-PNpm0-bd.js} +3 -3
- package/dist/{index-DQdtZuhJ.js.map → index-PNpm0-bd.js.map} +1 -1
- package/dist/{index-CXzStwuk.js → index-TZpNKUEf.js} +2 -2
- package/dist/{index-CXzStwuk.js.map → index-TZpNKUEf.js.map} +1 -1
- package/dist/{index-C1wSwK-1.js → index-WNHJ5PXY.js} +3 -3
- package/dist/{index-C1wSwK-1.js.map → index-WNHJ5PXY.js.map} +1 -1
- package/dist/{index.es-DkCXPJcj.js → index.es-DxdP-k4H.js} +3 -3
- package/dist/{index.es-DkCXPJcj.js.map → index.es-DxdP-k4H.js.map} +1 -1
- package/dist/{metamask-sdk-6d2bxFIh.js → metamask-sdk-3_VOmd7d.js} +2 -2
- package/dist/{metamask-sdk-6d2bxFIh.js.map → metamask-sdk-3_VOmd7d.js.map} +1 -1
- package/dist/{native-BqeoGFed.js → native-Ds9cEPoS.js} +2 -2
- package/dist/{native-BqeoGFed.js.map → native-Ds9cEPoS.js.map} +1 -1
- package/dist/{onramp-D2c5W23B.js → onramp-DAOC8iXd.js} +135 -14
- package/dist/onramp-DAOC8iXd.js.map +1 -0
- package/dist/{receive-YeWVCtLB.js → receive-C_E76vQZ.js} +6 -6
- package/dist/{receive-YeWVCtLB.js.map → receive-C_E76vQZ.js.map} +1 -1
- package/dist/{send-DqyIyy1Y.js → send-C92cSKIt.js} +10 -10
- package/dist/{send-DqyIyy1Y.js.map → send-C92cSKIt.js.map} +1 -1
- package/dist/{socials-vKZheKVM.js → socials-BlllTdW5.js} +10 -10
- package/dist/{socials-vKZheKVM.js.map → socials-BlllTdW5.js.map} +1 -1
- package/dist/{swaps-D-IM1hIY.js → swaps-BodIZ5Dv.js} +10 -10
- package/dist/{swaps-D-IM1hIY.js.map → swaps-BodIZ5Dv.js.map} +1 -1
- package/dist/{transactions-B5Ub0omb.js → transactions-DSiHT2Zb.js} +4 -4
- package/dist/{transactions-B5Ub0omb.js.map → transactions-DSiHT2Zb.js.map} +1 -1
- package/dist/{w3m-modal-CaeqjcO9.js → w3m-modal-Cuv0zBPp.js} +9 -9
- package/dist/{w3m-modal-CaeqjcO9.js.map → w3m-modal-Cuv0zBPp.js.map} +1 -1
- package/package.json +7 -7
- package/dist/index-DCLENwVM.js.map +0 -1
- package/dist/index-U2j2cfz9.js +0 -276
- package/dist/index-U2j2cfz9.js.map +0 -1
- package/dist/onramp-D2c5W23B.js.map +0 -1
|
@@ -2275,109 +2275,6 @@ const NumberUtil = {
|
|
|
2275
2275
|
return parseFloat(value.replace(/,/gu, ""));
|
|
2276
2276
|
}
|
|
2277
2277
|
};
|
|
2278
|
-
const erc20ABI = [
|
|
2279
|
-
{
|
|
2280
|
-
type: "function",
|
|
2281
|
-
name: "transfer",
|
|
2282
|
-
stateMutability: "nonpayable",
|
|
2283
|
-
inputs: [
|
|
2284
|
-
{
|
|
2285
|
-
name: "_to",
|
|
2286
|
-
type: "address"
|
|
2287
|
-
},
|
|
2288
|
-
{
|
|
2289
|
-
name: "_value",
|
|
2290
|
-
type: "uint256"
|
|
2291
|
-
}
|
|
2292
|
-
],
|
|
2293
|
-
outputs: [
|
|
2294
|
-
{
|
|
2295
|
-
name: "",
|
|
2296
|
-
type: "bool"
|
|
2297
|
-
}
|
|
2298
|
-
]
|
|
2299
|
-
},
|
|
2300
|
-
{
|
|
2301
|
-
type: "function",
|
|
2302
|
-
name: "transferFrom",
|
|
2303
|
-
stateMutability: "nonpayable",
|
|
2304
|
-
inputs: [
|
|
2305
|
-
{
|
|
2306
|
-
name: "_from",
|
|
2307
|
-
type: "address"
|
|
2308
|
-
},
|
|
2309
|
-
{
|
|
2310
|
-
name: "_to",
|
|
2311
|
-
type: "address"
|
|
2312
|
-
},
|
|
2313
|
-
{
|
|
2314
|
-
name: "_value",
|
|
2315
|
-
type: "uint256"
|
|
2316
|
-
}
|
|
2317
|
-
],
|
|
2318
|
-
outputs: [
|
|
2319
|
-
{
|
|
2320
|
-
name: "",
|
|
2321
|
-
type: "bool"
|
|
2322
|
-
}
|
|
2323
|
-
]
|
|
2324
|
-
}
|
|
2325
|
-
];
|
|
2326
|
-
const swapABI = [
|
|
2327
|
-
{
|
|
2328
|
-
type: "function",
|
|
2329
|
-
name: "approve",
|
|
2330
|
-
stateMutability: "nonpayable",
|
|
2331
|
-
inputs: [
|
|
2332
|
-
{ name: "spender", type: "address" },
|
|
2333
|
-
{ name: "amount", type: "uint256" }
|
|
2334
|
-
],
|
|
2335
|
-
outputs: [{ type: "bool" }]
|
|
2336
|
-
}
|
|
2337
|
-
];
|
|
2338
|
-
const usdtABI = [
|
|
2339
|
-
{
|
|
2340
|
-
type: "function",
|
|
2341
|
-
name: "transfer",
|
|
2342
|
-
stateMutability: "nonpayable",
|
|
2343
|
-
inputs: [
|
|
2344
|
-
{
|
|
2345
|
-
name: "recipient",
|
|
2346
|
-
type: "address"
|
|
2347
|
-
},
|
|
2348
|
-
{
|
|
2349
|
-
name: "amount",
|
|
2350
|
-
type: "uint256"
|
|
2351
|
-
}
|
|
2352
|
-
],
|
|
2353
|
-
outputs: []
|
|
2354
|
-
},
|
|
2355
|
-
{
|
|
2356
|
-
type: "function",
|
|
2357
|
-
name: "transferFrom",
|
|
2358
|
-
stateMutability: "nonpayable",
|
|
2359
|
-
inputs: [
|
|
2360
|
-
{
|
|
2361
|
-
name: "sender",
|
|
2362
|
-
type: "address"
|
|
2363
|
-
},
|
|
2364
|
-
{
|
|
2365
|
-
name: "recipient",
|
|
2366
|
-
type: "address"
|
|
2367
|
-
},
|
|
2368
|
-
{
|
|
2369
|
-
name: "amount",
|
|
2370
|
-
type: "uint256"
|
|
2371
|
-
}
|
|
2372
|
-
],
|
|
2373
|
-
outputs: [
|
|
2374
|
-
{
|
|
2375
|
-
name: "",
|
|
2376
|
-
type: "bool"
|
|
2377
|
-
}
|
|
2378
|
-
]
|
|
2379
|
-
}
|
|
2380
|
-
];
|
|
2381
2278
|
const ConstantsUtil$3 = {
|
|
2382
2279
|
WC_NAME_SUFFIX: ".reown.id",
|
|
2383
2280
|
WC_NAME_SUFFIX_LEGACY: ".wcn.id",
|
|
@@ -2429,15 +2326,6 @@ const ConstantsUtil$3 = {
|
|
|
2429
2326
|
},
|
|
2430
2327
|
UNSUPPORTED_NETWORK_NAME: "Unknown Network"
|
|
2431
2328
|
};
|
|
2432
|
-
const ContractUtil = {
|
|
2433
|
-
getERC20Abi: (tokenAddress) => {
|
|
2434
|
-
if (ConstantsUtil$3.USDT_CONTRACT_ADDRESSES.includes(tokenAddress)) {
|
|
2435
|
-
return usdtABI;
|
|
2436
|
-
}
|
|
2437
|
-
return erc20ABI;
|
|
2438
|
-
},
|
|
2439
|
-
getSwapAbi: () => swapABI
|
|
2440
|
-
};
|
|
2441
2329
|
const ParseUtil = {
|
|
2442
2330
|
validateCaipAddress(address) {
|
|
2443
2331
|
var _a3;
|
|
@@ -3348,7 +3236,7 @@ const StorageUtil = {
|
|
|
3348
3236
|
}
|
|
3349
3237
|
}
|
|
3350
3238
|
};
|
|
3351
|
-
const state$
|
|
3239
|
+
const state$l = proxy({
|
|
3352
3240
|
walletImages: {},
|
|
3353
3241
|
networkImages: {},
|
|
3354
3242
|
chainImages: {},
|
|
@@ -3357,36 +3245,36 @@ const state$o = proxy({
|
|
|
3357
3245
|
currencyImages: {}
|
|
3358
3246
|
});
|
|
3359
3247
|
const AssetController = {
|
|
3360
|
-
state: state$
|
|
3248
|
+
state: state$l,
|
|
3361
3249
|
subscribeNetworkImages(callback) {
|
|
3362
|
-
return subscribe(state$
|
|
3250
|
+
return subscribe(state$l.networkImages, () => callback(state$l.networkImages));
|
|
3363
3251
|
},
|
|
3364
3252
|
subscribeKey(key2, callback) {
|
|
3365
|
-
return subscribeKey(state$
|
|
3253
|
+
return subscribeKey(state$l, key2, callback);
|
|
3366
3254
|
},
|
|
3367
3255
|
subscribe(callback) {
|
|
3368
|
-
return subscribe(state$
|
|
3256
|
+
return subscribe(state$l, () => callback(state$l));
|
|
3369
3257
|
},
|
|
3370
3258
|
setWalletImage(key2, value) {
|
|
3371
|
-
state$
|
|
3259
|
+
state$l.walletImages[key2] = value;
|
|
3372
3260
|
},
|
|
3373
3261
|
setNetworkImage(key2, value) {
|
|
3374
|
-
state$
|
|
3262
|
+
state$l.networkImages[key2] = value;
|
|
3375
3263
|
},
|
|
3376
3264
|
setChainImage(key2, value) {
|
|
3377
|
-
state$
|
|
3265
|
+
state$l.chainImages[key2] = value;
|
|
3378
3266
|
},
|
|
3379
3267
|
setConnectorImage(key2, value) {
|
|
3380
|
-
state$
|
|
3268
|
+
state$l.connectorImages = { ...state$l.connectorImages, [key2]: value };
|
|
3381
3269
|
},
|
|
3382
3270
|
setTokenImage(key2, value) {
|
|
3383
|
-
state$
|
|
3271
|
+
state$l.tokenImages[key2] = value;
|
|
3384
3272
|
},
|
|
3385
3273
|
setCurrencyImage(key2, value) {
|
|
3386
|
-
state$
|
|
3274
|
+
state$l.currencyImages[key2] = value;
|
|
3387
3275
|
}
|
|
3388
3276
|
};
|
|
3389
|
-
const state$
|
|
3277
|
+
const state$k = proxy({
|
|
3390
3278
|
features: ConstantsUtil$2.DEFAULT_FEATURES,
|
|
3391
3279
|
projectId: "",
|
|
3392
3280
|
sdkType: "appkit",
|
|
@@ -3394,132 +3282,132 @@ const state$n = proxy({
|
|
|
3394
3282
|
defaultAccountTypes: ConstantsUtil$2.DEFAULT_ACCOUNT_TYPES
|
|
3395
3283
|
});
|
|
3396
3284
|
const OptionsController = {
|
|
3397
|
-
state: state$
|
|
3285
|
+
state: state$k,
|
|
3398
3286
|
subscribeKey(key2, callback) {
|
|
3399
|
-
return subscribeKey(state$
|
|
3287
|
+
return subscribeKey(state$k, key2, callback);
|
|
3400
3288
|
},
|
|
3401
3289
|
setOptions(options) {
|
|
3402
|
-
Object.assign(state$
|
|
3290
|
+
Object.assign(state$k, options);
|
|
3403
3291
|
},
|
|
3404
3292
|
setFeatures(features) {
|
|
3405
3293
|
if (!features) {
|
|
3406
3294
|
return;
|
|
3407
3295
|
}
|
|
3408
|
-
if (!state$
|
|
3409
|
-
state$
|
|
3296
|
+
if (!state$k.features) {
|
|
3297
|
+
state$k.features = ConstantsUtil$2.DEFAULT_FEATURES;
|
|
3410
3298
|
return;
|
|
3411
3299
|
}
|
|
3412
|
-
const newFeatures = { ...state$
|
|
3413
|
-
state$
|
|
3300
|
+
const newFeatures = { ...state$k.features, ...features };
|
|
3301
|
+
state$k.features = newFeatures;
|
|
3414
3302
|
},
|
|
3415
3303
|
setProjectId(projectId) {
|
|
3416
|
-
state$
|
|
3304
|
+
state$k.projectId = projectId;
|
|
3417
3305
|
},
|
|
3418
3306
|
setAllWallets(allWallets) {
|
|
3419
|
-
state$
|
|
3307
|
+
state$k.allWallets = allWallets;
|
|
3420
3308
|
},
|
|
3421
3309
|
setIncludeWalletIds(includeWalletIds) {
|
|
3422
|
-
state$
|
|
3310
|
+
state$k.includeWalletIds = includeWalletIds;
|
|
3423
3311
|
},
|
|
3424
3312
|
setExcludeWalletIds(excludeWalletIds) {
|
|
3425
|
-
state$
|
|
3313
|
+
state$k.excludeWalletIds = excludeWalletIds;
|
|
3426
3314
|
},
|
|
3427
3315
|
setFeaturedWalletIds(featuredWalletIds) {
|
|
3428
|
-
state$
|
|
3316
|
+
state$k.featuredWalletIds = featuredWalletIds;
|
|
3429
3317
|
},
|
|
3430
3318
|
setTokens(tokens) {
|
|
3431
|
-
state$
|
|
3319
|
+
state$k.tokens = tokens;
|
|
3432
3320
|
},
|
|
3433
3321
|
setTermsConditionsUrl(termsConditionsUrl) {
|
|
3434
|
-
state$
|
|
3322
|
+
state$k.termsConditionsUrl = termsConditionsUrl;
|
|
3435
3323
|
},
|
|
3436
3324
|
setPrivacyPolicyUrl(privacyPolicyUrl) {
|
|
3437
|
-
state$
|
|
3325
|
+
state$k.privacyPolicyUrl = privacyPolicyUrl;
|
|
3438
3326
|
},
|
|
3439
3327
|
setCustomWallets(customWallets) {
|
|
3440
|
-
state$
|
|
3328
|
+
state$k.customWallets = customWallets;
|
|
3441
3329
|
},
|
|
3442
3330
|
setIsSiweEnabled(isSiweEnabled) {
|
|
3443
|
-
state$
|
|
3331
|
+
state$k.isSiweEnabled = isSiweEnabled;
|
|
3444
3332
|
},
|
|
3445
3333
|
setIsUniversalProvider(isUniversalProvider) {
|
|
3446
|
-
state$
|
|
3334
|
+
state$k.isUniversalProvider = isUniversalProvider;
|
|
3447
3335
|
},
|
|
3448
3336
|
setSdkVersion(sdkVersion) {
|
|
3449
|
-
state$
|
|
3337
|
+
state$k.sdkVersion = sdkVersion;
|
|
3450
3338
|
},
|
|
3451
3339
|
setMetadata(metadata) {
|
|
3452
|
-
state$
|
|
3340
|
+
state$k.metadata = metadata;
|
|
3453
3341
|
},
|
|
3454
3342
|
setDisableAppend(disableAppend) {
|
|
3455
|
-
state$
|
|
3343
|
+
state$k.disableAppend = disableAppend;
|
|
3456
3344
|
},
|
|
3457
3345
|
setEIP6963Enabled(enableEIP6963) {
|
|
3458
|
-
state$
|
|
3346
|
+
state$k.enableEIP6963 = enableEIP6963;
|
|
3459
3347
|
},
|
|
3460
3348
|
setDebug(debug) {
|
|
3461
|
-
state$
|
|
3349
|
+
state$k.debug = debug;
|
|
3462
3350
|
},
|
|
3463
3351
|
setEnableWalletConnect(enableWalletConnect) {
|
|
3464
|
-
state$
|
|
3352
|
+
state$k.enableWalletConnect = enableWalletConnect;
|
|
3465
3353
|
},
|
|
3466
3354
|
setEnableWalletGuide(enableWalletGuide) {
|
|
3467
|
-
state$
|
|
3355
|
+
state$k.enableWalletGuide = enableWalletGuide;
|
|
3468
3356
|
},
|
|
3469
3357
|
setEnableAuthLogger(enableAuthLogger) {
|
|
3470
|
-
state$
|
|
3358
|
+
state$k.enableAuthLogger = enableAuthLogger;
|
|
3471
3359
|
},
|
|
3472
3360
|
setEnableWallets(enableWallets) {
|
|
3473
|
-
state$
|
|
3361
|
+
state$k.enableWallets = enableWallets;
|
|
3474
3362
|
},
|
|
3475
3363
|
setHasMultipleAddresses(hasMultipleAddresses) {
|
|
3476
|
-
state$
|
|
3364
|
+
state$k.hasMultipleAddresses = hasMultipleAddresses;
|
|
3477
3365
|
},
|
|
3478
3366
|
setSIWX(siwx) {
|
|
3479
|
-
state$
|
|
3367
|
+
state$k.siwx = siwx;
|
|
3480
3368
|
},
|
|
3481
3369
|
setConnectMethodsOrder(connectMethodsOrder) {
|
|
3482
|
-
state$
|
|
3483
|
-
...state$
|
|
3370
|
+
state$k.features = {
|
|
3371
|
+
...state$k.features,
|
|
3484
3372
|
connectMethodsOrder
|
|
3485
3373
|
};
|
|
3486
3374
|
},
|
|
3487
3375
|
setWalletFeaturesOrder(walletFeaturesOrder) {
|
|
3488
|
-
state$
|
|
3489
|
-
...state$
|
|
3376
|
+
state$k.features = {
|
|
3377
|
+
...state$k.features,
|
|
3490
3378
|
walletFeaturesOrder
|
|
3491
3379
|
};
|
|
3492
3380
|
},
|
|
3493
3381
|
setSocialsOrder(socialsOrder) {
|
|
3494
|
-
state$
|
|
3495
|
-
...state$
|
|
3382
|
+
state$k.features = {
|
|
3383
|
+
...state$k.features,
|
|
3496
3384
|
socials: socialsOrder
|
|
3497
3385
|
};
|
|
3498
3386
|
},
|
|
3499
3387
|
setCollapseWallets(collapseWallets) {
|
|
3500
|
-
state$
|
|
3501
|
-
...state$
|
|
3388
|
+
state$k.features = {
|
|
3389
|
+
...state$k.features,
|
|
3502
3390
|
collapseWallets
|
|
3503
3391
|
};
|
|
3504
3392
|
},
|
|
3505
3393
|
setEnableEmbedded(enableEmbedded) {
|
|
3506
|
-
state$
|
|
3394
|
+
state$k.enableEmbedded = enableEmbedded;
|
|
3507
3395
|
},
|
|
3508
3396
|
setAllowUnsupportedChain(allowUnsupportedChain) {
|
|
3509
|
-
state$
|
|
3397
|
+
state$k.allowUnsupportedChain = allowUnsupportedChain;
|
|
3510
3398
|
},
|
|
3511
3399
|
setUsingInjectedUniversalProvider(useInjectedUniversalProvider) {
|
|
3512
|
-
state$
|
|
3400
|
+
state$k.useInjectedUniversalProvider = useInjectedUniversalProvider;
|
|
3513
3401
|
},
|
|
3514
3402
|
setDefaultAccountTypes(defaultAccountType = {}) {
|
|
3515
3403
|
Object.entries(defaultAccountType).forEach(([namespace, accountType]) => {
|
|
3516
3404
|
if (accountType) {
|
|
3517
|
-
state$
|
|
3405
|
+
state$k.defaultAccountTypes[namespace] = accountType;
|
|
3518
3406
|
}
|
|
3519
3407
|
});
|
|
3520
3408
|
},
|
|
3521
3409
|
getSnapshot() {
|
|
3522
|
-
return snapshot$1(state$
|
|
3410
|
+
return snapshot$1(state$k);
|
|
3523
3411
|
}
|
|
3524
3412
|
};
|
|
3525
3413
|
const DEFAULT_OPTIONS = {
|
|
@@ -3597,19 +3485,19 @@ const DEFAULT_OPTIONS = {
|
|
|
3597
3485
|
]
|
|
3598
3486
|
};
|
|
3599
3487
|
const baseUrl$2 = CoreHelperUtil.getBlockchainApiUrl();
|
|
3600
|
-
const state$
|
|
3488
|
+
const state$j = proxy({
|
|
3601
3489
|
clientId: null,
|
|
3602
3490
|
api: new FetchUtil({ baseUrl: baseUrl$2, clientId: null }),
|
|
3603
3491
|
supportedChains: { http: [], ws: [] }
|
|
3604
3492
|
});
|
|
3605
3493
|
const BlockchainApiController = {
|
|
3606
|
-
state: state$
|
|
3494
|
+
state: state$j,
|
|
3607
3495
|
async isNetworkSupported(network) {
|
|
3608
3496
|
if (!network) {
|
|
3609
3497
|
return false;
|
|
3610
3498
|
}
|
|
3611
3499
|
try {
|
|
3612
|
-
if (!state$
|
|
3500
|
+
if (!state$j.supportedChains.http.length) {
|
|
3613
3501
|
await BlockchainApiController.getSupportedNetworks({
|
|
3614
3502
|
projectId: OptionsController.state.projectId
|
|
3615
3503
|
});
|
|
@@ -3617,16 +3505,16 @@ const BlockchainApiController = {
|
|
|
3617
3505
|
} catch (e3) {
|
|
3618
3506
|
return false;
|
|
3619
3507
|
}
|
|
3620
|
-
return state$
|
|
3508
|
+
return state$j.supportedChains.http.includes(network);
|
|
3621
3509
|
},
|
|
3622
3510
|
async getSupportedNetworks({ projectId }) {
|
|
3623
|
-
const supportedChains = await state$
|
|
3511
|
+
const supportedChains = await state$j.api.get({
|
|
3624
3512
|
path: "v1/supported-chains",
|
|
3625
3513
|
params: {
|
|
3626
3514
|
projectId
|
|
3627
3515
|
}
|
|
3628
3516
|
});
|
|
3629
|
-
state$
|
|
3517
|
+
state$j.supportedChains = supportedChains;
|
|
3630
3518
|
return supportedChains;
|
|
3631
3519
|
},
|
|
3632
3520
|
async fetchIdentity({ address }) {
|
|
@@ -3635,7 +3523,7 @@ const BlockchainApiController = {
|
|
|
3635
3523
|
if (!isSupported) {
|
|
3636
3524
|
return { avatar: "", name: "" };
|
|
3637
3525
|
}
|
|
3638
|
-
return state$
|
|
3526
|
+
return state$j.api.get({
|
|
3639
3527
|
path: `/v1/identity/${address}`,
|
|
3640
3528
|
params: {
|
|
3641
3529
|
projectId: OptionsController.state.projectId,
|
|
@@ -3649,7 +3537,7 @@ const BlockchainApiController = {
|
|
|
3649
3537
|
if (!isSupported) {
|
|
3650
3538
|
return { data: [], next: void 0 };
|
|
3651
3539
|
}
|
|
3652
|
-
return state$
|
|
3540
|
+
return state$j.api.get({
|
|
3653
3541
|
path: `/v1/account/${account}/history`,
|
|
3654
3542
|
params: {
|
|
3655
3543
|
projectId,
|
|
@@ -3667,7 +3555,7 @@ const BlockchainApiController = {
|
|
|
3667
3555
|
if (!isSupported) {
|
|
3668
3556
|
return { quotes: [] };
|
|
3669
3557
|
}
|
|
3670
|
-
return state$
|
|
3558
|
+
return state$j.api.get({
|
|
3671
3559
|
path: `/v1/convert/quotes`,
|
|
3672
3560
|
headers: {
|
|
3673
3561
|
"Content-Type": "application/json"
|
|
@@ -3688,7 +3576,7 @@ const BlockchainApiController = {
|
|
|
3688
3576
|
if (!isSupported) {
|
|
3689
3577
|
return { tokens: [] };
|
|
3690
3578
|
}
|
|
3691
|
-
return state$
|
|
3579
|
+
return state$j.api.get({
|
|
3692
3580
|
path: `/v1/convert/tokens`,
|
|
3693
3581
|
params: {
|
|
3694
3582
|
projectId,
|
|
@@ -3702,7 +3590,7 @@ const BlockchainApiController = {
|
|
|
3702
3590
|
if (!isSupported) {
|
|
3703
3591
|
return { fungibles: [] };
|
|
3704
3592
|
}
|
|
3705
|
-
return state$
|
|
3593
|
+
return state$j.api.post({
|
|
3706
3594
|
path: "/v1/fungible/price",
|
|
3707
3595
|
body: {
|
|
3708
3596
|
projectId,
|
|
@@ -3721,7 +3609,7 @@ const BlockchainApiController = {
|
|
|
3721
3609
|
if (!isSupported) {
|
|
3722
3610
|
return { allowance: "0" };
|
|
3723
3611
|
}
|
|
3724
|
-
return state$
|
|
3612
|
+
return state$j.api.get({
|
|
3725
3613
|
path: `/v1/convert/allowance`,
|
|
3726
3614
|
params: {
|
|
3727
3615
|
projectId,
|
|
@@ -3742,7 +3630,7 @@ const BlockchainApiController = {
|
|
|
3742
3630
|
if (!isSupported) {
|
|
3743
3631
|
throw new Error("Network not supported for Gas Price");
|
|
3744
3632
|
}
|
|
3745
|
-
return state$
|
|
3633
|
+
return state$j.api.get({
|
|
3746
3634
|
path: `/v1/convert/gas-price`,
|
|
3747
3635
|
headers: {
|
|
3748
3636
|
"Content-Type": "application/json",
|
|
@@ -3761,7 +3649,7 @@ const BlockchainApiController = {
|
|
|
3761
3649
|
if (!isSupported) {
|
|
3762
3650
|
throw new Error("Network not supported for Swaps");
|
|
3763
3651
|
}
|
|
3764
|
-
return state$
|
|
3652
|
+
return state$j.api.post({
|
|
3765
3653
|
path: "/v1/convert/build-transaction",
|
|
3766
3654
|
headers: {
|
|
3767
3655
|
"Content-Type": "application/json"
|
|
@@ -3785,7 +3673,7 @@ const BlockchainApiController = {
|
|
|
3785
3673
|
if (!isSupported) {
|
|
3786
3674
|
throw new Error("Network not supported for Swaps");
|
|
3787
3675
|
}
|
|
3788
|
-
return state$
|
|
3676
|
+
return state$j.api.get({
|
|
3789
3677
|
path: `/v1/convert/build-approve`,
|
|
3790
3678
|
headers: {
|
|
3791
3679
|
"Content-Type": "application/json",
|
|
@@ -3807,7 +3695,7 @@ const BlockchainApiController = {
|
|
|
3807
3695
|
if (!isSupported) {
|
|
3808
3696
|
return { balances: [] };
|
|
3809
3697
|
}
|
|
3810
|
-
return state$
|
|
3698
|
+
return state$j.api.get({
|
|
3811
3699
|
path: `/v1/account/${address}/balance`,
|
|
3812
3700
|
headers: {
|
|
3813
3701
|
"x-sdk-type": sdkType,
|
|
@@ -3827,7 +3715,7 @@ const BlockchainApiController = {
|
|
|
3827
3715
|
if (!isSupported) {
|
|
3828
3716
|
return { addresses: {}, attributes: [] };
|
|
3829
3717
|
}
|
|
3830
|
-
return state$
|
|
3718
|
+
return state$j.api.get({
|
|
3831
3719
|
path: `/v1/profile/account/${name2}`,
|
|
3832
3720
|
params: {
|
|
3833
3721
|
projectId: OptionsController.state.projectId,
|
|
@@ -3841,7 +3729,7 @@ const BlockchainApiController = {
|
|
|
3841
3729
|
if (!isSupported) {
|
|
3842
3730
|
return [];
|
|
3843
3731
|
}
|
|
3844
|
-
return state$
|
|
3732
|
+
return state$j.api.get({
|
|
3845
3733
|
path: `/v1/profile/reverse/${address}`,
|
|
3846
3734
|
params: {
|
|
3847
3735
|
sender: AccountController.state.address,
|
|
@@ -3856,7 +3744,7 @@ const BlockchainApiController = {
|
|
|
3856
3744
|
if (!isSupported) {
|
|
3857
3745
|
return { suggestions: [] };
|
|
3858
3746
|
}
|
|
3859
|
-
return state$
|
|
3747
|
+
return state$j.api.get({
|
|
3860
3748
|
path: `/v1/profile/suggestions/${name2}`,
|
|
3861
3749
|
params: {
|
|
3862
3750
|
projectId: OptionsController.state.projectId,
|
|
@@ -3870,7 +3758,7 @@ const BlockchainApiController = {
|
|
|
3870
3758
|
if (!isSupported) {
|
|
3871
3759
|
return { success: false };
|
|
3872
3760
|
}
|
|
3873
|
-
return state$
|
|
3761
|
+
return state$j.api.post({
|
|
3874
3762
|
path: `/v1/profile/account`,
|
|
3875
3763
|
body: { coin_type: coinType, address, message, signature: signature2 },
|
|
3876
3764
|
headers: {
|
|
@@ -3884,7 +3772,7 @@ const BlockchainApiController = {
|
|
|
3884
3772
|
if (!isSupported) {
|
|
3885
3773
|
return "";
|
|
3886
3774
|
}
|
|
3887
|
-
const response = await state$
|
|
3775
|
+
const response = await state$j.api.post({
|
|
3888
3776
|
path: `/v1/generators/onrampurl`,
|
|
3889
3777
|
params: {
|
|
3890
3778
|
projectId: OptionsController.state.projectId
|
|
@@ -3907,7 +3795,7 @@ const BlockchainApiController = {
|
|
|
3907
3795
|
return { paymentCurrencies: [], purchaseCurrencies: [] };
|
|
3908
3796
|
}
|
|
3909
3797
|
try {
|
|
3910
|
-
const response = await state$
|
|
3798
|
+
const response = await state$j.api.get({
|
|
3911
3799
|
path: `/v1/onramp/options`,
|
|
3912
3800
|
params: {
|
|
3913
3801
|
projectId: OptionsController.state.projectId
|
|
@@ -3925,7 +3813,7 @@ const BlockchainApiController = {
|
|
|
3925
3813
|
if (!isSupported) {
|
|
3926
3814
|
return null;
|
|
3927
3815
|
}
|
|
3928
|
-
const response = await state$
|
|
3816
|
+
const response = await state$j.api.post({
|
|
3929
3817
|
path: `/v1/onramp/quote`,
|
|
3930
3818
|
params: {
|
|
3931
3819
|
projectId: OptionsController.state.projectId
|
|
@@ -3955,7 +3843,7 @@ const BlockchainApiController = {
|
|
|
3955
3843
|
if (!isSupported) {
|
|
3956
3844
|
return [];
|
|
3957
3845
|
}
|
|
3958
|
-
return state$
|
|
3846
|
+
return state$j.api.get({
|
|
3959
3847
|
path: `/v1/sessions/${caipAddress}`,
|
|
3960
3848
|
params: {
|
|
3961
3849
|
projectId: OptionsController.state.projectId
|
|
@@ -3968,7 +3856,7 @@ const BlockchainApiController = {
|
|
|
3968
3856
|
if (!isSupported) {
|
|
3969
3857
|
return { success: false };
|
|
3970
3858
|
}
|
|
3971
|
-
return state$
|
|
3859
|
+
return state$j.api.post({
|
|
3972
3860
|
path: `/v1/sessions/${address}/revoke`,
|
|
3973
3861
|
params: {
|
|
3974
3862
|
projectId: OptionsController.state.projectId
|
|
@@ -3980,8 +3868,8 @@ const BlockchainApiController = {
|
|
|
3980
3868
|
});
|
|
3981
3869
|
},
|
|
3982
3870
|
setClientId(clientId) {
|
|
3983
|
-
state$
|
|
3984
|
-
state$
|
|
3871
|
+
state$j.clientId = clientId;
|
|
3872
|
+
state$j.api = new FetchUtil({ baseUrl: baseUrl$2, clientId });
|
|
3985
3873
|
}
|
|
3986
3874
|
};
|
|
3987
3875
|
const global$1 = globalThis || void 0 || self;
|
|
@@ -23815,7 +23703,7 @@ function getHighWaterMark(state2, options, duplexKey, isDuplex) {
|
|
|
23815
23703
|
}
|
|
23816
23704
|
return state2.objectMode ? 16 : 16 * 1024;
|
|
23817
23705
|
}
|
|
23818
|
-
var state$
|
|
23706
|
+
var state$i = {
|
|
23819
23707
|
getHighWaterMark
|
|
23820
23708
|
};
|
|
23821
23709
|
var browser$c = deprecate;
|
|
@@ -23882,7 +23770,7 @@ function require_stream_writable$1() {
|
|
|
23882
23770
|
return Buffer2.isBuffer(obj) || obj instanceof OurUint8Array;
|
|
23883
23771
|
}
|
|
23884
23772
|
var destroyImpl = destroy_1$1;
|
|
23885
|
-
var _require = state$
|
|
23773
|
+
var _require = state$i, getHighWaterMark2 = _require.getHighWaterMark;
|
|
23886
23774
|
var _require$codes2 = errorsBrowser.codes, ERR_INVALID_ARG_TYPE = _require$codes2.ERR_INVALID_ARG_TYPE, ERR_METHOD_NOT_IMPLEMENTED2 = _require$codes2.ERR_METHOD_NOT_IMPLEMENTED, ERR_MULTIPLE_CALLBACK2 = _require$codes2.ERR_MULTIPLE_CALLBACK, ERR_STREAM_CANNOT_PIPE = _require$codes2.ERR_STREAM_CANNOT_PIPE, ERR_STREAM_DESTROYED2 = _require$codes2.ERR_STREAM_DESTROYED, ERR_STREAM_NULL_VALUES = _require$codes2.ERR_STREAM_NULL_VALUES, ERR_STREAM_WRITE_AFTER_END = _require$codes2.ERR_STREAM_WRITE_AFTER_END, ERR_UNKNOWN_ENCODING = _require$codes2.ERR_UNKNOWN_ENCODING;
|
|
23887
23775
|
var errorOrDestroy2 = destroyImpl.errorOrDestroy;
|
|
23888
23776
|
inherits_browserExports(Writable, Stream2);
|
|
@@ -25025,7 +24913,7 @@ function require_stream_readable$1() {
|
|
|
25025
24913
|
}
|
|
25026
24914
|
var BufferList2 = requireBuffer_list();
|
|
25027
24915
|
var destroyImpl = destroy_1$1;
|
|
25028
|
-
var _require = state$
|
|
24916
|
+
var _require = state$i, getHighWaterMark2 = _require.getHighWaterMark;
|
|
25029
24917
|
var _require$codes2 = errorsBrowser.codes, ERR_INVALID_ARG_TYPE = _require$codes2.ERR_INVALID_ARG_TYPE, ERR_STREAM_PUSH_AFTER_EOF = _require$codes2.ERR_STREAM_PUSH_AFTER_EOF, ERR_METHOD_NOT_IMPLEMENTED2 = _require$codes2.ERR_METHOD_NOT_IMPLEMENTED, ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes2.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;
|
|
25030
24918
|
var StringDecoder;
|
|
25031
24919
|
var createReadableStreamAsyncIterator;
|
|
@@ -47254,38 +47142,38 @@ const W3mFrameRpcConstants = {
|
|
|
47254
47142
|
SMART_ACCOUNT: "smartAccount"
|
|
47255
47143
|
}
|
|
47256
47144
|
};
|
|
47257
|
-
const state$
|
|
47145
|
+
const state$h = proxy({
|
|
47258
47146
|
message: "",
|
|
47259
47147
|
variant: "info",
|
|
47260
47148
|
open: false
|
|
47261
47149
|
});
|
|
47262
47150
|
const AlertController = {
|
|
47263
|
-
state: state$
|
|
47151
|
+
state: state$h,
|
|
47264
47152
|
subscribeKey(key2, callback) {
|
|
47265
|
-
return subscribeKey(state$
|
|
47153
|
+
return subscribeKey(state$h, key2, callback);
|
|
47266
47154
|
},
|
|
47267
47155
|
open(message, variant) {
|
|
47268
47156
|
const { debug } = OptionsController.state;
|
|
47269
47157
|
const { shortMessage, longMessage } = message;
|
|
47270
47158
|
if (debug) {
|
|
47271
|
-
state$
|
|
47272
|
-
state$
|
|
47273
|
-
state$
|
|
47159
|
+
state$h.message = shortMessage;
|
|
47160
|
+
state$h.variant = variant;
|
|
47161
|
+
state$h.open = true;
|
|
47274
47162
|
}
|
|
47275
47163
|
if (longMessage) {
|
|
47276
47164
|
console.error(typeof longMessage === "function" ? longMessage() : longMessage);
|
|
47277
47165
|
}
|
|
47278
47166
|
},
|
|
47279
47167
|
close() {
|
|
47280
|
-
state$
|
|
47281
|
-
state$
|
|
47282
|
-
state$
|
|
47168
|
+
state$h.open = false;
|
|
47169
|
+
state$h.message = "";
|
|
47170
|
+
state$h.variant = "info";
|
|
47283
47171
|
}
|
|
47284
47172
|
};
|
|
47285
47173
|
const baseUrl$1 = CoreHelperUtil.getAnalyticsUrl();
|
|
47286
47174
|
const api$1 = new FetchUtil({ baseUrl: baseUrl$1, clientId: null });
|
|
47287
47175
|
const excluded = ["MODAL_CREATED"];
|
|
47288
|
-
const state$
|
|
47176
|
+
const state$g = proxy({
|
|
47289
47177
|
timestamp: Date.now(),
|
|
47290
47178
|
reportedErrors: {},
|
|
47291
47179
|
data: {
|
|
@@ -47294,9 +47182,9 @@ const state$j = proxy({
|
|
|
47294
47182
|
}
|
|
47295
47183
|
});
|
|
47296
47184
|
const EventsController = {
|
|
47297
|
-
state: state$
|
|
47185
|
+
state: state$g,
|
|
47298
47186
|
subscribe(callback) {
|
|
47299
|
-
return subscribe(state$
|
|
47187
|
+
return subscribe(state$g, () => callback(state$g));
|
|
47300
47188
|
},
|
|
47301
47189
|
_getApiHeaders() {
|
|
47302
47190
|
const { projectId, sdkType, sdkVersion } = OptionsController.state;
|
|
@@ -47323,39 +47211,39 @@ const EventsController = {
|
|
|
47323
47211
|
props: { ...payload.data, address }
|
|
47324
47212
|
}
|
|
47325
47213
|
});
|
|
47326
|
-
state$
|
|
47214
|
+
state$g.reportedErrors["FORBIDDEN"] = false;
|
|
47327
47215
|
} catch (err) {
|
|
47328
|
-
const isForbiddenError = err instanceof Error && err.cause instanceof Response && err.cause.status === ConstantsUtil$3.HTTP_STATUS_CODES.FORBIDDEN && !state$
|
|
47216
|
+
const isForbiddenError = err instanceof Error && err.cause instanceof Response && err.cause.status === ConstantsUtil$3.HTTP_STATUS_CODES.FORBIDDEN && !state$g.reportedErrors["FORBIDDEN"];
|
|
47329
47217
|
if (isForbiddenError) {
|
|
47330
47218
|
AlertController.open({
|
|
47331
47219
|
shortMessage: "Invalid App Configuration",
|
|
47332
47220
|
longMessage: `Origin ${isSafe$1() ? window.origin : "uknown"} not found on Allowlist - update configuration on cloud.reown.com`
|
|
47333
47221
|
}, "error");
|
|
47334
|
-
state$
|
|
47222
|
+
state$g.reportedErrors["FORBIDDEN"] = true;
|
|
47335
47223
|
}
|
|
47336
47224
|
}
|
|
47337
47225
|
},
|
|
47338
47226
|
sendEvent(data) {
|
|
47339
47227
|
var _a3;
|
|
47340
|
-
state$
|
|
47341
|
-
state$
|
|
47228
|
+
state$g.timestamp = Date.now();
|
|
47229
|
+
state$g.data = data;
|
|
47342
47230
|
if ((_a3 = OptionsController.state.features) == null ? void 0 : _a3.analytics) {
|
|
47343
|
-
EventsController._sendAnalyticsEvent(state$
|
|
47231
|
+
EventsController._sendAnalyticsEvent(state$g);
|
|
47344
47232
|
}
|
|
47345
47233
|
}
|
|
47346
47234
|
};
|
|
47347
|
-
const state$
|
|
47235
|
+
const state$f = proxy({
|
|
47348
47236
|
themeMode: "dark",
|
|
47349
47237
|
themeVariables: {},
|
|
47350
47238
|
w3mThemeVariables: void 0
|
|
47351
47239
|
});
|
|
47352
47240
|
const ThemeController = {
|
|
47353
|
-
state: state$
|
|
47241
|
+
state: state$f,
|
|
47354
47242
|
subscribe(callback) {
|
|
47355
|
-
return subscribe(state$
|
|
47243
|
+
return subscribe(state$f, () => callback(state$f));
|
|
47356
47244
|
},
|
|
47357
47245
|
setThemeMode(themeMode) {
|
|
47358
|
-
state$
|
|
47246
|
+
state$f.themeMode = themeMode;
|
|
47359
47247
|
try {
|
|
47360
47248
|
const authConnector2 = ConnectorController.getAuthConnector();
|
|
47361
47249
|
if (authConnector2) {
|
|
@@ -47371,14 +47259,14 @@ const ThemeController = {
|
|
|
47371
47259
|
}
|
|
47372
47260
|
},
|
|
47373
47261
|
setThemeVariables(themeVariables) {
|
|
47374
|
-
state$
|
|
47262
|
+
state$f.themeVariables = { ...state$f.themeVariables, ...themeVariables };
|
|
47375
47263
|
try {
|
|
47376
47264
|
const authConnector2 = ConnectorController.getAuthConnector();
|
|
47377
47265
|
if (authConnector2) {
|
|
47378
47266
|
const themeVariablesSnapshot = ThemeController.getSnapshot().themeVariables;
|
|
47379
47267
|
authConnector2.provider.syncTheme({
|
|
47380
47268
|
themeVariables: themeVariablesSnapshot,
|
|
47381
|
-
w3mThemeVariables: getW3mThemeVariables(state$
|
|
47269
|
+
w3mThemeVariables: getW3mThemeVariables(state$f.themeVariables, state$f.themeMode)
|
|
47382
47270
|
});
|
|
47383
47271
|
}
|
|
47384
47272
|
} catch {
|
|
@@ -47386,41 +47274,41 @@ const ThemeController = {
|
|
|
47386
47274
|
}
|
|
47387
47275
|
},
|
|
47388
47276
|
getSnapshot() {
|
|
47389
|
-
return snapshot$1(state$
|
|
47277
|
+
return snapshot$1(state$f);
|
|
47390
47278
|
}
|
|
47391
47279
|
};
|
|
47392
|
-
const state$
|
|
47280
|
+
const state$e = proxy({
|
|
47393
47281
|
allConnectors: [],
|
|
47394
47282
|
connectors: [],
|
|
47395
47283
|
activeConnector: void 0
|
|
47396
47284
|
});
|
|
47397
47285
|
const ConnectorController = {
|
|
47398
|
-
state: state$
|
|
47286
|
+
state: state$e,
|
|
47399
47287
|
subscribe(callback) {
|
|
47400
|
-
return subscribe(state$
|
|
47401
|
-
callback(state$
|
|
47288
|
+
return subscribe(state$e, () => {
|
|
47289
|
+
callback(state$e);
|
|
47402
47290
|
});
|
|
47403
47291
|
},
|
|
47404
47292
|
subscribeKey(key2, callback) {
|
|
47405
|
-
return subscribeKey(state$
|
|
47293
|
+
return subscribeKey(state$e, key2, callback);
|
|
47406
47294
|
},
|
|
47407
47295
|
setActiveConnector(connector) {
|
|
47408
47296
|
if (connector) {
|
|
47409
|
-
state$
|
|
47297
|
+
state$e.activeConnector = ref$1(connector);
|
|
47410
47298
|
}
|
|
47411
47299
|
},
|
|
47412
47300
|
setConnectors(connectors) {
|
|
47413
|
-
const newConnectors = connectors.filter((newConnector) => !state$
|
|
47301
|
+
const newConnectors = connectors.filter((newConnector) => !state$e.allConnectors.some((existingConnector) => existingConnector.id === newConnector.id && this.getConnectorName(existingConnector.name) === this.getConnectorName(newConnector.name) && existingConnector.chain === newConnector.chain));
|
|
47414
47302
|
newConnectors.forEach((connector) => {
|
|
47415
47303
|
if (connector.type !== "MULTI_CHAIN") {
|
|
47416
|
-
state$
|
|
47304
|
+
state$e.allConnectors.push(ref$1(connector));
|
|
47417
47305
|
}
|
|
47418
47306
|
});
|
|
47419
|
-
state$
|
|
47307
|
+
state$e.connectors = this.mergeMultiChainConnectors(state$e.allConnectors);
|
|
47420
47308
|
},
|
|
47421
47309
|
removeAdapter(namespace) {
|
|
47422
|
-
state$
|
|
47423
|
-
state$
|
|
47310
|
+
state$e.allConnectors = state$e.allConnectors.filter((connector) => connector.chain !== namespace);
|
|
47311
|
+
state$e.connectors = this.mergeMultiChainConnectors(state$e.allConnectors);
|
|
47424
47312
|
},
|
|
47425
47313
|
mergeMultiChainConnectors(connectors) {
|
|
47426
47314
|
const connectorsByNameMap = this.generateConnectorMapByName(connectors);
|
|
@@ -47506,7 +47394,7 @@ const ConnectorController = {
|
|
|
47506
47394
|
getAuthConnector() {
|
|
47507
47395
|
var _a3;
|
|
47508
47396
|
const activeNamespace = ChainController.state.activeChain;
|
|
47509
|
-
const authConnector2 = state$
|
|
47397
|
+
const authConnector2 = state$e.connectors.find((c2) => c2.id === ConstantsUtil$3.CONNECTOR_ID.AUTH);
|
|
47510
47398
|
if (!authConnector2) {
|
|
47511
47399
|
return void 0;
|
|
47512
47400
|
}
|
|
@@ -47517,16 +47405,16 @@ const ConnectorController = {
|
|
|
47517
47405
|
return authConnector2;
|
|
47518
47406
|
},
|
|
47519
47407
|
getAnnouncedConnectorRdns() {
|
|
47520
|
-
return state$
|
|
47408
|
+
return state$e.connectors.filter((c2) => c2.type === "ANNOUNCED").map((c2) => {
|
|
47521
47409
|
var _a3;
|
|
47522
47410
|
return (_a3 = c2.info) == null ? void 0 : _a3.rdns;
|
|
47523
47411
|
});
|
|
47524
47412
|
},
|
|
47525
47413
|
getConnectors() {
|
|
47526
|
-
return state$
|
|
47414
|
+
return state$e.connectors;
|
|
47527
47415
|
},
|
|
47528
47416
|
getConnector(id, rdns) {
|
|
47529
|
-
return state$
|
|
47417
|
+
return state$e.connectors.find((c2) => {
|
|
47530
47418
|
var _a3;
|
|
47531
47419
|
return c2.explorerId === id || ((_a3 = c2.info) == null ? void 0 : _a3.rdns) === rdns;
|
|
47532
47420
|
});
|
|
@@ -47553,22 +47441,22 @@ const ConnectorController = {
|
|
|
47553
47441
|
});
|
|
47554
47442
|
}
|
|
47555
47443
|
};
|
|
47556
|
-
const state$
|
|
47444
|
+
const state$d = proxy({
|
|
47557
47445
|
view: "Connect",
|
|
47558
47446
|
history: ["Connect"],
|
|
47559
47447
|
transactionStack: []
|
|
47560
47448
|
});
|
|
47561
47449
|
const RouterController = {
|
|
47562
|
-
state: state$
|
|
47450
|
+
state: state$d,
|
|
47563
47451
|
subscribeKey(key2, callback) {
|
|
47564
|
-
return subscribeKey(state$
|
|
47452
|
+
return subscribeKey(state$d, key2, callback);
|
|
47565
47453
|
},
|
|
47566
47454
|
pushTransactionStack(action) {
|
|
47567
|
-
state$
|
|
47455
|
+
state$d.transactionStack.push(action);
|
|
47568
47456
|
},
|
|
47569
47457
|
popTransactionStack(cancel) {
|
|
47570
47458
|
var _a3, _b2;
|
|
47571
|
-
const action = state$
|
|
47459
|
+
const action = state$d.transactionStack.pop();
|
|
47572
47460
|
if (!action) {
|
|
47573
47461
|
return;
|
|
47574
47462
|
}
|
|
@@ -47579,13 +47467,13 @@ const RouterController = {
|
|
|
47579
47467
|
if (action.goBack) {
|
|
47580
47468
|
this.goBack();
|
|
47581
47469
|
} else if (action.replace) {
|
|
47582
|
-
const history = state$
|
|
47470
|
+
const history = state$d.history;
|
|
47583
47471
|
const connectingSiweIndex = history.indexOf("ConnectingSiwe");
|
|
47584
47472
|
if (connectingSiweIndex > 0) {
|
|
47585
47473
|
this.goBackToIndex(connectingSiweIndex - 1);
|
|
47586
47474
|
} else {
|
|
47587
47475
|
ModalController.close();
|
|
47588
|
-
state$
|
|
47476
|
+
state$d.history = [];
|
|
47589
47477
|
}
|
|
47590
47478
|
} else if (action.view) {
|
|
47591
47479
|
this.reset(action.view);
|
|
@@ -47594,33 +47482,33 @@ const RouterController = {
|
|
|
47594
47482
|
}
|
|
47595
47483
|
},
|
|
47596
47484
|
push(view, data) {
|
|
47597
|
-
if (view !== state$
|
|
47598
|
-
state$
|
|
47599
|
-
state$
|
|
47600
|
-
state$
|
|
47485
|
+
if (view !== state$d.view) {
|
|
47486
|
+
state$d.view = view;
|
|
47487
|
+
state$d.history.push(view);
|
|
47488
|
+
state$d.data = data;
|
|
47601
47489
|
}
|
|
47602
47490
|
},
|
|
47603
47491
|
reset(view, data) {
|
|
47604
|
-
state$
|
|
47605
|
-
state$
|
|
47606
|
-
state$
|
|
47492
|
+
state$d.view = view;
|
|
47493
|
+
state$d.history = [view];
|
|
47494
|
+
state$d.data = data;
|
|
47607
47495
|
},
|
|
47608
47496
|
replace(view, data) {
|
|
47609
|
-
const lastView = state$
|
|
47497
|
+
const lastView = state$d.history.at(-1);
|
|
47610
47498
|
const isSameView = lastView === view;
|
|
47611
47499
|
if (!isSameView) {
|
|
47612
|
-
state$
|
|
47613
|
-
state$
|
|
47614
|
-
state$
|
|
47500
|
+
state$d.view = view;
|
|
47501
|
+
state$d.history[state$d.history.length - 1] = view;
|
|
47502
|
+
state$d.data = data;
|
|
47615
47503
|
}
|
|
47616
47504
|
},
|
|
47617
47505
|
goBack() {
|
|
47618
47506
|
const shouldReload = !ChainController.state.activeCaipAddress && this.state.view === "ConnectingFarcaster";
|
|
47619
|
-
if (state$
|
|
47620
|
-
state$
|
|
47621
|
-
const [last] = state$
|
|
47507
|
+
if (state$d.history.length > 1 && !state$d.history.includes("UnsupportedChain")) {
|
|
47508
|
+
state$d.history.pop();
|
|
47509
|
+
const [last] = state$d.history.slice(-1);
|
|
47622
47510
|
if (last) {
|
|
47623
|
-
state$
|
|
47511
|
+
state$d.view = last;
|
|
47624
47512
|
}
|
|
47625
47513
|
} else {
|
|
47626
47514
|
ModalController.close();
|
|
@@ -47642,11 +47530,11 @@ const RouterController = {
|
|
|
47642
47530
|
}, 100);
|
|
47643
47531
|
},
|
|
47644
47532
|
goBackToIndex(historyIndex) {
|
|
47645
|
-
if (state$
|
|
47646
|
-
state$
|
|
47647
|
-
const [last] = state$
|
|
47533
|
+
if (state$d.history.length > 1) {
|
|
47534
|
+
state$d.history = state$d.history.slice(0, historyIndex + 1);
|
|
47535
|
+
const [last] = state$d.history.slice(-1);
|
|
47648
47536
|
if (last) {
|
|
47649
|
-
state$
|
|
47537
|
+
state$d.view = last;
|
|
47650
47538
|
}
|
|
47651
47539
|
}
|
|
47652
47540
|
}
|
|
@@ -47658,13 +47546,13 @@ const DEFAULT_STATE = Object.freeze({
|
|
|
47658
47546
|
open: false,
|
|
47659
47547
|
autoClose: true
|
|
47660
47548
|
});
|
|
47661
|
-
const state$
|
|
47549
|
+
const state$c = proxy({
|
|
47662
47550
|
...DEFAULT_STATE
|
|
47663
47551
|
});
|
|
47664
47552
|
const SnackController = {
|
|
47665
|
-
state: state$
|
|
47553
|
+
state: state$c,
|
|
47666
47554
|
subscribeKey(key2, callback) {
|
|
47667
|
-
return subscribeKey(state$
|
|
47555
|
+
return subscribeKey(state$c, key2, callback);
|
|
47668
47556
|
},
|
|
47669
47557
|
showLoading(message, options = {}) {
|
|
47670
47558
|
this._showMessage({ message, variant: "loading", ...options });
|
|
@@ -47680,28 +47568,28 @@ const SnackController = {
|
|
|
47680
47568
|
this._showMessage({ message: errorMessage, variant: "error" });
|
|
47681
47569
|
},
|
|
47682
47570
|
hide() {
|
|
47683
|
-
state$
|
|
47684
|
-
state$
|
|
47685
|
-
state$
|
|
47686
|
-
state$
|
|
47687
|
-
state$
|
|
47571
|
+
state$c.message = DEFAULT_STATE.message;
|
|
47572
|
+
state$c.variant = DEFAULT_STATE.variant;
|
|
47573
|
+
state$c.svg = DEFAULT_STATE.svg;
|
|
47574
|
+
state$c.open = DEFAULT_STATE.open;
|
|
47575
|
+
state$c.autoClose = DEFAULT_STATE.autoClose;
|
|
47688
47576
|
},
|
|
47689
47577
|
_showMessage({ message, svg, variant = "success", autoClose = DEFAULT_STATE.autoClose }) {
|
|
47690
|
-
if (state$
|
|
47691
|
-
state$
|
|
47578
|
+
if (state$c.open) {
|
|
47579
|
+
state$c.open = false;
|
|
47692
47580
|
setTimeout(() => {
|
|
47693
|
-
state$
|
|
47694
|
-
state$
|
|
47695
|
-
state$
|
|
47696
|
-
state$
|
|
47697
|
-
state$
|
|
47581
|
+
state$c.message = message;
|
|
47582
|
+
state$c.variant = variant;
|
|
47583
|
+
state$c.svg = svg;
|
|
47584
|
+
state$c.open = true;
|
|
47585
|
+
state$c.autoClose = autoClose;
|
|
47698
47586
|
}, 150);
|
|
47699
47587
|
} else {
|
|
47700
|
-
state$
|
|
47701
|
-
state$
|
|
47702
|
-
state$
|
|
47703
|
-
state$
|
|
47704
|
-
state$
|
|
47588
|
+
state$c.message = message;
|
|
47589
|
+
state$c.variant = variant;
|
|
47590
|
+
state$c.svg = svg;
|
|
47591
|
+
state$c.open = true;
|
|
47592
|
+
state$c.autoClose = autoClose;
|
|
47705
47593
|
}
|
|
47706
47594
|
}
|
|
47707
47595
|
};
|
|
@@ -47935,7 +47823,7 @@ const SIWXUtil = {
|
|
|
47935
47823
|
}
|
|
47936
47824
|
}
|
|
47937
47825
|
};
|
|
47938
|
-
const state$
|
|
47826
|
+
const state$b = proxy({
|
|
47939
47827
|
transactions: [],
|
|
47940
47828
|
coinbaseTransactions: {},
|
|
47941
47829
|
transactionsByYear: {},
|
|
@@ -47945,12 +47833,12 @@ const state$e = proxy({
|
|
|
47945
47833
|
next: void 0
|
|
47946
47834
|
});
|
|
47947
47835
|
const TransactionsController = {
|
|
47948
|
-
state: state$
|
|
47836
|
+
state: state$b,
|
|
47949
47837
|
subscribe(callback) {
|
|
47950
|
-
return subscribe(state$
|
|
47838
|
+
return subscribe(state$b, () => callback(state$b));
|
|
47951
47839
|
},
|
|
47952
47840
|
setLastNetworkInView(lastNetworkInView) {
|
|
47953
|
-
state$
|
|
47841
|
+
state$b.lastNetworkInView = lastNetworkInView;
|
|
47954
47842
|
},
|
|
47955
47843
|
async fetchTransactions(accountAddress, onramp) {
|
|
47956
47844
|
var _a3;
|
|
@@ -47958,12 +47846,12 @@ const TransactionsController = {
|
|
|
47958
47846
|
if (!projectId || !accountAddress) {
|
|
47959
47847
|
throw new Error("Transactions can't be fetched without a projectId and an accountAddress");
|
|
47960
47848
|
}
|
|
47961
|
-
state$
|
|
47849
|
+
state$b.loading = true;
|
|
47962
47850
|
try {
|
|
47963
47851
|
const response = await BlockchainApiController.fetchTransactions({
|
|
47964
47852
|
account: accountAddress,
|
|
47965
47853
|
projectId,
|
|
47966
|
-
cursor: state$
|
|
47854
|
+
cursor: state$b.next,
|
|
47967
47855
|
onramp,
|
|
47968
47856
|
// Coinbase transaction history state updates require the latest data
|
|
47969
47857
|
cache: onramp === "coinbase" ? "no-cache" : void 0,
|
|
@@ -47971,16 +47859,16 @@ const TransactionsController = {
|
|
|
47971
47859
|
});
|
|
47972
47860
|
const nonSpamTransactions = this.filterSpamTransactions(response.data);
|
|
47973
47861
|
const sameChainTransactions = this.filterByConnectedChain(nonSpamTransactions);
|
|
47974
|
-
const filteredTransactions = [...state$
|
|
47975
|
-
state$
|
|
47862
|
+
const filteredTransactions = [...state$b.transactions, ...sameChainTransactions];
|
|
47863
|
+
state$b.loading = false;
|
|
47976
47864
|
if (onramp === "coinbase") {
|
|
47977
|
-
state$
|
|
47865
|
+
state$b.coinbaseTransactions = this.groupTransactionsByYearAndMonth(state$b.coinbaseTransactions, response.data);
|
|
47978
47866
|
} else {
|
|
47979
|
-
state$
|
|
47980
|
-
state$
|
|
47867
|
+
state$b.transactions = filteredTransactions;
|
|
47868
|
+
state$b.transactionsByYear = this.groupTransactionsByYearAndMonth(state$b.transactionsByYear, sameChainTransactions);
|
|
47981
47869
|
}
|
|
47982
|
-
state$
|
|
47983
|
-
state$
|
|
47870
|
+
state$b.empty = filteredTransactions.length === 0;
|
|
47871
|
+
state$b.next = response.next ? response.next : void 0;
|
|
47984
47872
|
} catch (error) {
|
|
47985
47873
|
EventsController.sendEvent({
|
|
47986
47874
|
type: "track",
|
|
@@ -47988,14 +47876,14 @@ const TransactionsController = {
|
|
|
47988
47876
|
properties: {
|
|
47989
47877
|
address: accountAddress,
|
|
47990
47878
|
projectId,
|
|
47991
|
-
cursor: state$
|
|
47879
|
+
cursor: state$b.next,
|
|
47992
47880
|
isSmartAccount: AccountController.state.preferredAccountType === W3mFrameRpcConstants.ACCOUNT_TYPES.SMART_ACCOUNT
|
|
47993
47881
|
}
|
|
47994
47882
|
});
|
|
47995
47883
|
SnackController.showError("Failed to fetch transactions");
|
|
47996
|
-
state$
|
|
47997
|
-
state$
|
|
47998
|
-
state$
|
|
47884
|
+
state$b.loading = false;
|
|
47885
|
+
state$b.empty = true;
|
|
47886
|
+
state$b.next = void 0;
|
|
47999
47887
|
}
|
|
48000
47888
|
},
|
|
48001
47889
|
groupTransactionsByYearAndMonth(transactionsMap = {}, transactions = []) {
|
|
@@ -48029,33 +47917,33 @@ const TransactionsController = {
|
|
|
48029
47917
|
return filteredTransactions;
|
|
48030
47918
|
},
|
|
48031
47919
|
clearCursor() {
|
|
48032
|
-
state$
|
|
47920
|
+
state$b.next = void 0;
|
|
48033
47921
|
},
|
|
48034
47922
|
resetTransactions() {
|
|
48035
|
-
state$
|
|
48036
|
-
state$
|
|
48037
|
-
state$
|
|
48038
|
-
state$
|
|
48039
|
-
state$
|
|
48040
|
-
state$
|
|
47923
|
+
state$b.transactions = [];
|
|
47924
|
+
state$b.transactionsByYear = {};
|
|
47925
|
+
state$b.lastNetworkInView = void 0;
|
|
47926
|
+
state$b.loading = false;
|
|
47927
|
+
state$b.empty = false;
|
|
47928
|
+
state$b.next = void 0;
|
|
48041
47929
|
}
|
|
48042
47930
|
};
|
|
48043
|
-
const state$
|
|
47931
|
+
const state$a = proxy({
|
|
48044
47932
|
wcError: false,
|
|
48045
47933
|
buffering: false,
|
|
48046
47934
|
status: "disconnected"
|
|
48047
47935
|
});
|
|
48048
47936
|
let wcConnectionPromise;
|
|
48049
47937
|
const ConnectionController = {
|
|
48050
|
-
state: state$
|
|
47938
|
+
state: state$a,
|
|
48051
47939
|
subscribeKey(key2, callback) {
|
|
48052
|
-
return subscribeKey(state$
|
|
47940
|
+
return subscribeKey(state$a, key2, callback);
|
|
48053
47941
|
},
|
|
48054
47942
|
_getClient() {
|
|
48055
|
-
return state$
|
|
47943
|
+
return state$a._client;
|
|
48056
47944
|
},
|
|
48057
47945
|
setClient(client) {
|
|
48058
|
-
state$
|
|
47946
|
+
state$a._client = ref$1(client);
|
|
48059
47947
|
},
|
|
48060
47948
|
async connectWalletConnect() {
|
|
48061
47949
|
var _a3, _b2, _c2, _d;
|
|
@@ -48069,16 +47957,16 @@ const ConnectionController = {
|
|
|
48069
47957
|
wcConnectionPromise = void 0;
|
|
48070
47958
|
return;
|
|
48071
47959
|
}
|
|
48072
|
-
if (!CoreHelperUtil.isPairingExpired(state$
|
|
48073
|
-
const link = state$
|
|
48074
|
-
state$
|
|
47960
|
+
if (!CoreHelperUtil.isPairingExpired(state$a == null ? void 0 : state$a.wcPairingExpiry)) {
|
|
47961
|
+
const link = state$a.wcUri;
|
|
47962
|
+
state$a.wcUri = link;
|
|
48075
47963
|
return;
|
|
48076
47964
|
}
|
|
48077
47965
|
wcConnectionPromise = (_b2 = (_a3 = this._getClient()) == null ? void 0 : _a3.connectWalletConnect) == null ? void 0 : _b2.call(_a3).catch(() => void 0);
|
|
48078
47966
|
this.state.status = "connecting";
|
|
48079
47967
|
await wcConnectionPromise;
|
|
48080
47968
|
wcConnectionPromise = void 0;
|
|
48081
|
-
state$
|
|
47969
|
+
state$a.wcPairingExpiry = void 0;
|
|
48082
47970
|
this.state.status = "connected";
|
|
48083
47971
|
} else {
|
|
48084
47972
|
await ((_d = (_c2 = this._getClient()) == null ? void 0 : _c2.connectWalletConnect) == null ? void 0 : _d.call(_c2));
|
|
@@ -48163,33 +48051,33 @@ const ConnectionController = {
|
|
|
48163
48051
|
return ((_b2 = (_a3 = this._getClient()) == null ? void 0 : _a3.checkInstalled) == null ? void 0 : _b2.call(_a3, ids)) || false;
|
|
48164
48052
|
},
|
|
48165
48053
|
resetWcConnection() {
|
|
48166
|
-
state$
|
|
48167
|
-
state$
|
|
48168
|
-
state$
|
|
48169
|
-
state$
|
|
48170
|
-
state$
|
|
48054
|
+
state$a.wcUri = void 0;
|
|
48055
|
+
state$a.wcPairingExpiry = void 0;
|
|
48056
|
+
state$a.wcLinking = void 0;
|
|
48057
|
+
state$a.recentWallet = void 0;
|
|
48058
|
+
state$a.status = "disconnected";
|
|
48171
48059
|
TransactionsController.resetTransactions();
|
|
48172
48060
|
StorageUtil.deleteWalletConnectDeepLink();
|
|
48173
48061
|
},
|
|
48174
48062
|
setUri(uri2) {
|
|
48175
|
-
state$
|
|
48176
|
-
state$
|
|
48063
|
+
state$a.wcUri = uri2;
|
|
48064
|
+
state$a.wcPairingExpiry = CoreHelperUtil.getPairingExpiry();
|
|
48177
48065
|
},
|
|
48178
48066
|
setWcLinking(wcLinking) {
|
|
48179
|
-
state$
|
|
48067
|
+
state$a.wcLinking = wcLinking;
|
|
48180
48068
|
},
|
|
48181
48069
|
setWcError(wcError) {
|
|
48182
|
-
state$
|
|
48183
|
-
state$
|
|
48070
|
+
state$a.wcError = wcError;
|
|
48071
|
+
state$a.buffering = false;
|
|
48184
48072
|
},
|
|
48185
48073
|
setRecentWallet(wallet) {
|
|
48186
|
-
state$
|
|
48074
|
+
state$a.recentWallet = wallet;
|
|
48187
48075
|
},
|
|
48188
48076
|
setBuffering(buffering) {
|
|
48189
|
-
state$
|
|
48077
|
+
state$a.buffering = buffering;
|
|
48190
48078
|
},
|
|
48191
48079
|
setStatus(status) {
|
|
48192
|
-
state$
|
|
48080
|
+
state$a.status = status;
|
|
48193
48081
|
},
|
|
48194
48082
|
async disconnect() {
|
|
48195
48083
|
try {
|
|
@@ -48393,14 +48281,14 @@ const initialState = {
|
|
|
48393
48281
|
maxSlippage: void 0,
|
|
48394
48282
|
providerFee: void 0
|
|
48395
48283
|
};
|
|
48396
|
-
const state$
|
|
48284
|
+
const state$9 = proxy(initialState);
|
|
48397
48285
|
const SwapController = {
|
|
48398
|
-
state: state$
|
|
48286
|
+
state: state$9,
|
|
48399
48287
|
subscribe(callback) {
|
|
48400
|
-
return subscribe(state$
|
|
48288
|
+
return subscribe(state$9, () => callback(state$9));
|
|
48401
48289
|
},
|
|
48402
48290
|
subscribeKey(key2, callback) {
|
|
48403
|
-
return subscribeKey(state$
|
|
48291
|
+
return subscribeKey(state$9, key2, callback);
|
|
48404
48292
|
},
|
|
48405
48293
|
getParams() {
|
|
48406
48294
|
var _a3, _b2, _c2, _d, _e3, _f, _g, _h;
|
|
@@ -48412,19 +48300,19 @@ const SwapController = {
|
|
|
48412
48300
|
if (!address) {
|
|
48413
48301
|
throw new Error("No address found to swap the tokens from.");
|
|
48414
48302
|
}
|
|
48415
|
-
const invalidToToken = !((_a3 = state$
|
|
48416
|
-
const invalidSourceToken = !((_c2 = state$
|
|
48417
|
-
const invalidSourceTokenAmount = !state$
|
|
48303
|
+
const invalidToToken = !((_a3 = state$9.toToken) == null ? void 0 : _a3.address) || !((_b2 = state$9.toToken) == null ? void 0 : _b2.decimals);
|
|
48304
|
+
const invalidSourceToken = !((_c2 = state$9.sourceToken) == null ? void 0 : _c2.address) || !((_d = state$9.sourceToken) == null ? void 0 : _d.decimals) || !NumberUtil.bigNumber(state$9.sourceTokenAmount).isGreaterThan(0);
|
|
48305
|
+
const invalidSourceTokenAmount = !state$9.sourceTokenAmount;
|
|
48418
48306
|
return {
|
|
48419
48307
|
networkAddress,
|
|
48420
48308
|
fromAddress: address,
|
|
48421
48309
|
fromCaipAddress: caipAddress,
|
|
48422
|
-
sourceTokenAddress: (_e3 = state$
|
|
48423
|
-
toTokenAddress: (_f = state$
|
|
48424
|
-
toTokenAmount: state$
|
|
48425
|
-
toTokenDecimals: (_g = state$
|
|
48426
|
-
sourceTokenAmount: state$
|
|
48427
|
-
sourceTokenDecimals: (_h = state$
|
|
48310
|
+
sourceTokenAddress: (_e3 = state$9.sourceToken) == null ? void 0 : _e3.address,
|
|
48311
|
+
toTokenAddress: (_f = state$9.toToken) == null ? void 0 : _f.address,
|
|
48312
|
+
toTokenAmount: state$9.toTokenAmount,
|
|
48313
|
+
toTokenDecimals: (_g = state$9.toToken) == null ? void 0 : _g.decimals,
|
|
48314
|
+
sourceTokenAmount: state$9.sourceTokenAmount,
|
|
48315
|
+
sourceTokenDecimals: (_h = state$9.sourceToken) == null ? void 0 : _h.decimals,
|
|
48428
48316
|
invalidToToken,
|
|
48429
48317
|
invalidSourceToken,
|
|
48430
48318
|
invalidSourceTokenAmount,
|
|
@@ -48434,55 +48322,55 @@ const SwapController = {
|
|
|
48434
48322
|
},
|
|
48435
48323
|
setSourceToken(sourceToken) {
|
|
48436
48324
|
if (!sourceToken) {
|
|
48437
|
-
state$
|
|
48438
|
-
state$
|
|
48439
|
-
state$
|
|
48325
|
+
state$9.sourceToken = sourceToken;
|
|
48326
|
+
state$9.sourceTokenAmount = "";
|
|
48327
|
+
state$9.sourceTokenPriceInUSD = 0;
|
|
48440
48328
|
return;
|
|
48441
48329
|
}
|
|
48442
|
-
state$
|
|
48330
|
+
state$9.sourceToken = sourceToken;
|
|
48443
48331
|
this.setTokenPrice(sourceToken.address, "sourceToken");
|
|
48444
48332
|
},
|
|
48445
48333
|
setSourceTokenAmount(amount) {
|
|
48446
|
-
state$
|
|
48334
|
+
state$9.sourceTokenAmount = amount;
|
|
48447
48335
|
},
|
|
48448
48336
|
setToToken(toToken) {
|
|
48449
48337
|
if (!toToken) {
|
|
48450
|
-
state$
|
|
48451
|
-
state$
|
|
48452
|
-
state$
|
|
48338
|
+
state$9.toToken = toToken;
|
|
48339
|
+
state$9.toTokenAmount = "";
|
|
48340
|
+
state$9.toTokenPriceInUSD = 0;
|
|
48453
48341
|
return;
|
|
48454
48342
|
}
|
|
48455
|
-
state$
|
|
48343
|
+
state$9.toToken = toToken;
|
|
48456
48344
|
this.setTokenPrice(toToken.address, "toToken");
|
|
48457
48345
|
},
|
|
48458
48346
|
setToTokenAmount(amount) {
|
|
48459
|
-
state$
|
|
48347
|
+
state$9.toTokenAmount = amount ? NumberUtil.formatNumberToLocalString(amount, TO_AMOUNT_DECIMALS) : "";
|
|
48460
48348
|
},
|
|
48461
48349
|
async setTokenPrice(address, target) {
|
|
48462
|
-
let price = state$
|
|
48350
|
+
let price = state$9.tokensPriceMap[address] || 0;
|
|
48463
48351
|
if (!price) {
|
|
48464
|
-
state$
|
|
48352
|
+
state$9.loadingPrices = true;
|
|
48465
48353
|
price = await this.getAddressPrice(address);
|
|
48466
48354
|
}
|
|
48467
48355
|
if (target === "sourceToken") {
|
|
48468
|
-
state$
|
|
48356
|
+
state$9.sourceTokenPriceInUSD = price;
|
|
48469
48357
|
} else if (target === "toToken") {
|
|
48470
|
-
state$
|
|
48358
|
+
state$9.toTokenPriceInUSD = price;
|
|
48471
48359
|
}
|
|
48472
|
-
if (state$
|
|
48473
|
-
state$
|
|
48360
|
+
if (state$9.loadingPrices) {
|
|
48361
|
+
state$9.loadingPrices = false;
|
|
48474
48362
|
}
|
|
48475
48363
|
if (this.getParams().availableToSwap) {
|
|
48476
48364
|
this.swapTokens();
|
|
48477
48365
|
}
|
|
48478
48366
|
},
|
|
48479
48367
|
switchTokens() {
|
|
48480
|
-
if (state$
|
|
48368
|
+
if (state$9.initializing || !state$9.initialized) {
|
|
48481
48369
|
return;
|
|
48482
48370
|
}
|
|
48483
|
-
const newSourceToken = state$
|
|
48484
|
-
const newToToken = state$
|
|
48485
|
-
const newSourceTokenAmount = newSourceToken && state$
|
|
48371
|
+
const newSourceToken = state$9.toToken ? { ...state$9.toToken } : void 0;
|
|
48372
|
+
const newToToken = state$9.sourceToken ? { ...state$9.sourceToken } : void 0;
|
|
48373
|
+
const newSourceTokenAmount = newSourceToken && state$9.toTokenAmount === "" ? "1" : state$9.toTokenAmount;
|
|
48486
48374
|
this.setSourceToken(newSourceToken);
|
|
48487
48375
|
this.setToToken(newToToken);
|
|
48488
48376
|
this.setSourceTokenAmount(newSourceTokenAmount);
|
|
@@ -48490,49 +48378,49 @@ const SwapController = {
|
|
|
48490
48378
|
this.swapTokens();
|
|
48491
48379
|
},
|
|
48492
48380
|
resetState() {
|
|
48493
|
-
state$
|
|
48494
|
-
state$
|
|
48495
|
-
state$
|
|
48496
|
-
state$
|
|
48497
|
-
state$
|
|
48498
|
-
state$
|
|
48499
|
-
state$
|
|
48500
|
-
state$
|
|
48501
|
-
state$
|
|
48502
|
-
state$
|
|
48503
|
-
state$
|
|
48504
|
-
state$
|
|
48505
|
-
state$
|
|
48381
|
+
state$9.myTokensWithBalance = initialState.myTokensWithBalance;
|
|
48382
|
+
state$9.tokensPriceMap = initialState.tokensPriceMap;
|
|
48383
|
+
state$9.initialized = initialState.initialized;
|
|
48384
|
+
state$9.sourceToken = initialState.sourceToken;
|
|
48385
|
+
state$9.sourceTokenAmount = initialState.sourceTokenAmount;
|
|
48386
|
+
state$9.sourceTokenPriceInUSD = initialState.sourceTokenPriceInUSD;
|
|
48387
|
+
state$9.toToken = initialState.toToken;
|
|
48388
|
+
state$9.toTokenAmount = initialState.toTokenAmount;
|
|
48389
|
+
state$9.toTokenPriceInUSD = initialState.toTokenPriceInUSD;
|
|
48390
|
+
state$9.networkPrice = initialState.networkPrice;
|
|
48391
|
+
state$9.networkTokenSymbol = initialState.networkTokenSymbol;
|
|
48392
|
+
state$9.networkBalanceInUSD = initialState.networkBalanceInUSD;
|
|
48393
|
+
state$9.inputError = initialState.inputError;
|
|
48506
48394
|
},
|
|
48507
48395
|
resetValues() {
|
|
48508
48396
|
var _a3;
|
|
48509
48397
|
const { networkAddress } = this.getParams();
|
|
48510
|
-
const networkToken = (_a3 = state$
|
|
48398
|
+
const networkToken = (_a3 = state$9.tokens) == null ? void 0 : _a3.find((token) => token.address === networkAddress);
|
|
48511
48399
|
this.setSourceToken(networkToken);
|
|
48512
48400
|
this.setToToken(void 0);
|
|
48513
48401
|
},
|
|
48514
48402
|
getApprovalLoadingState() {
|
|
48515
|
-
return state$
|
|
48403
|
+
return state$9.loadingApprovalTransaction;
|
|
48516
48404
|
},
|
|
48517
48405
|
clearError() {
|
|
48518
|
-
state$
|
|
48406
|
+
state$9.transactionError = void 0;
|
|
48519
48407
|
},
|
|
48520
48408
|
async initializeState() {
|
|
48521
|
-
if (state$
|
|
48409
|
+
if (state$9.initializing) {
|
|
48522
48410
|
return;
|
|
48523
48411
|
}
|
|
48524
|
-
state$
|
|
48525
|
-
if (!state$
|
|
48412
|
+
state$9.initializing = true;
|
|
48413
|
+
if (!state$9.initialized) {
|
|
48526
48414
|
try {
|
|
48527
48415
|
await this.fetchTokens();
|
|
48528
|
-
state$
|
|
48416
|
+
state$9.initialized = true;
|
|
48529
48417
|
} catch (error) {
|
|
48530
|
-
state$
|
|
48418
|
+
state$9.initialized = false;
|
|
48531
48419
|
SnackController.showError("Failed to initialize swap");
|
|
48532
48420
|
RouterController.goBack();
|
|
48533
48421
|
}
|
|
48534
48422
|
}
|
|
48535
|
-
state$
|
|
48423
|
+
state$9.initializing = false;
|
|
48536
48424
|
},
|
|
48537
48425
|
async fetchTokens() {
|
|
48538
48426
|
var _a3;
|
|
@@ -48540,17 +48428,17 @@ const SwapController = {
|
|
|
48540
48428
|
await this.getTokenList();
|
|
48541
48429
|
await this.getNetworkTokenPrice();
|
|
48542
48430
|
await this.getMyTokensWithBalance();
|
|
48543
|
-
const networkToken = (_a3 = state$
|
|
48431
|
+
const networkToken = (_a3 = state$9.tokens) == null ? void 0 : _a3.find((token) => token.address === networkAddress);
|
|
48544
48432
|
if (networkToken) {
|
|
48545
|
-
state$
|
|
48433
|
+
state$9.networkTokenSymbol = networkToken.symbol;
|
|
48546
48434
|
this.setSourceToken(networkToken);
|
|
48547
48435
|
this.setSourceTokenAmount("1");
|
|
48548
48436
|
}
|
|
48549
48437
|
},
|
|
48550
48438
|
async getTokenList() {
|
|
48551
48439
|
const tokens = await SwapApiUtil.getTokenList();
|
|
48552
|
-
state$
|
|
48553
|
-
state$
|
|
48440
|
+
state$9.tokens = tokens;
|
|
48441
|
+
state$9.popularTokens = tokens.sort((aTokenInfo, bTokenInfo) => {
|
|
48554
48442
|
if (aTokenInfo.symbol < bTokenInfo.symbol) {
|
|
48555
48443
|
return -1;
|
|
48556
48444
|
}
|
|
@@ -48559,7 +48447,7 @@ const SwapController = {
|
|
|
48559
48447
|
}
|
|
48560
48448
|
return 0;
|
|
48561
48449
|
});
|
|
48562
|
-
state$
|
|
48450
|
+
state$9.suggestedTokens = tokens.filter((token) => {
|
|
48563
48451
|
if (ConstantsUtil$2.SWAP_SUGGESTED_TOKENS.includes(token.symbol)) {
|
|
48564
48452
|
return true;
|
|
48565
48453
|
}
|
|
@@ -48568,7 +48456,7 @@ const SwapController = {
|
|
|
48568
48456
|
},
|
|
48569
48457
|
async getAddressPrice(address) {
|
|
48570
48458
|
var _a3, _b2;
|
|
48571
|
-
const existPrice = state$
|
|
48459
|
+
const existPrice = state$9.tokensPriceMap[address];
|
|
48572
48460
|
if (existPrice) {
|
|
48573
48461
|
return existPrice;
|
|
48574
48462
|
}
|
|
@@ -48577,11 +48465,11 @@ const SwapController = {
|
|
|
48577
48465
|
addresses: [address]
|
|
48578
48466
|
});
|
|
48579
48467
|
const fungibles = (response == null ? void 0 : response.fungibles) || [];
|
|
48580
|
-
const allTokens = [...state$
|
|
48468
|
+
const allTokens = [...state$9.tokens || [], ...state$9.myTokensWithBalance || []];
|
|
48581
48469
|
const symbol = (_a3 = allTokens == null ? void 0 : allTokens.find((token) => token.address === address)) == null ? void 0 : _a3.symbol;
|
|
48582
48470
|
const price = ((_b2 = fungibles.find((p3) => p3.symbol.toLowerCase() === (symbol == null ? void 0 : symbol.toLowerCase()))) == null ? void 0 : _b2.price) || 0;
|
|
48583
48471
|
const priceAsFloat = parseFloat(price.toString());
|
|
48584
|
-
state$
|
|
48472
|
+
state$9.tokensPriceMap[address] = priceAsFloat;
|
|
48585
48473
|
return priceAsFloat;
|
|
48586
48474
|
},
|
|
48587
48475
|
async getNetworkTokenPrice() {
|
|
@@ -48596,9 +48484,9 @@ const SwapController = {
|
|
|
48596
48484
|
});
|
|
48597
48485
|
const token = (_a3 = response.fungibles) == null ? void 0 : _a3[0];
|
|
48598
48486
|
const price = (token == null ? void 0 : token.price.toString()) || "0";
|
|
48599
|
-
state$
|
|
48600
|
-
state$
|
|
48601
|
-
state$
|
|
48487
|
+
state$9.tokensPriceMap[networkAddress] = parseFloat(price);
|
|
48488
|
+
state$9.networkTokenSymbol = (token == null ? void 0 : token.symbol) || "";
|
|
48489
|
+
state$9.networkPrice = price;
|
|
48602
48490
|
},
|
|
48603
48491
|
async getMyTokensWithBalance(forceUpdate) {
|
|
48604
48492
|
const balances = await SwapApiUtil.getMyTokensWithBalance(forceUpdate);
|
|
@@ -48616,10 +48504,10 @@ const SwapController = {
|
|
|
48616
48504
|
}
|
|
48617
48505
|
const networkToken = balances.find((token) => token.address === networkAddress);
|
|
48618
48506
|
balances.forEach((token) => {
|
|
48619
|
-
state$
|
|
48507
|
+
state$9.tokensPriceMap[token.address] = token.price || 0;
|
|
48620
48508
|
});
|
|
48621
|
-
state$
|
|
48622
|
-
state$
|
|
48509
|
+
state$9.myTokensWithBalance = balances.filter((token) => token.address.startsWith(caipNetwork.caipNetworkId));
|
|
48510
|
+
state$9.networkBalanceInUSD = networkToken ? NumberUtil.multiply(networkToken.quantity.numeric, networkToken.price).toString() : "0";
|
|
48623
48511
|
},
|
|
48624
48512
|
async getInitialGasPrice() {
|
|
48625
48513
|
var _a3, _b2;
|
|
@@ -48629,20 +48517,20 @@ const SwapController = {
|
|
|
48629
48517
|
}
|
|
48630
48518
|
switch ((_b2 = (_a3 = ChainController.state) == null ? void 0 : _a3.activeCaipNetwork) == null ? void 0 : _b2.chainNamespace) {
|
|
48631
48519
|
case "solana":
|
|
48632
|
-
state$
|
|
48633
|
-
state$
|
|
48520
|
+
state$9.gasFee = res.standard ?? "0";
|
|
48521
|
+
state$9.gasPriceInUSD = NumberUtil.multiply(res.standard, state$9.networkPrice).dividedBy(1e9).toNumber();
|
|
48634
48522
|
return {
|
|
48635
|
-
gasPrice: BigInt(state$
|
|
48636
|
-
gasPriceInUSD: Number(state$
|
|
48523
|
+
gasPrice: BigInt(state$9.gasFee),
|
|
48524
|
+
gasPriceInUSD: Number(state$9.gasPriceInUSD)
|
|
48637
48525
|
};
|
|
48638
48526
|
case "eip155":
|
|
48639
48527
|
default:
|
|
48640
48528
|
const value = res.standard ?? "0";
|
|
48641
48529
|
const gasFee = BigInt(value);
|
|
48642
48530
|
const gasLimit = BigInt(INITIAL_GAS_LIMIT);
|
|
48643
|
-
const gasPrice = SwapCalculationUtil.getGasPriceInUSD(state$
|
|
48644
|
-
state$
|
|
48645
|
-
state$
|
|
48531
|
+
const gasPrice = SwapCalculationUtil.getGasPriceInUSD(state$9.networkPrice, gasLimit, gasFee);
|
|
48532
|
+
state$9.gasFee = value;
|
|
48533
|
+
state$9.gasPriceInUSD = gasPrice;
|
|
48646
48534
|
return { gasPrice: gasFee, gasPriceInUSD: gasPrice };
|
|
48647
48535
|
}
|
|
48648
48536
|
},
|
|
@@ -48650,24 +48538,24 @@ const SwapController = {
|
|
|
48650
48538
|
async swapTokens() {
|
|
48651
48539
|
var _a3, _b2;
|
|
48652
48540
|
const address = AccountController.state.address;
|
|
48653
|
-
const sourceToken = state$
|
|
48654
|
-
const toToken = state$
|
|
48655
|
-
const haveSourceTokenAmount = NumberUtil.bigNumber(state$
|
|
48656
|
-
if (!toToken || !sourceToken || state$
|
|
48541
|
+
const sourceToken = state$9.sourceToken;
|
|
48542
|
+
const toToken = state$9.toToken;
|
|
48543
|
+
const haveSourceTokenAmount = NumberUtil.bigNumber(state$9.sourceTokenAmount).isGreaterThan(0);
|
|
48544
|
+
if (!toToken || !sourceToken || state$9.loadingPrices || !haveSourceTokenAmount) {
|
|
48657
48545
|
return;
|
|
48658
48546
|
}
|
|
48659
|
-
state$
|
|
48660
|
-
const amountDecimal = NumberUtil.bigNumber(state$
|
|
48547
|
+
state$9.loadingQuote = true;
|
|
48548
|
+
const amountDecimal = NumberUtil.bigNumber(state$9.sourceTokenAmount).multipliedBy(10 ** sourceToken.decimals).integerValue();
|
|
48661
48549
|
try {
|
|
48662
48550
|
const quoteResponse = await BlockchainApiController.fetchSwapQuote({
|
|
48663
48551
|
userAddress: address,
|
|
48664
48552
|
projectId: OptionsController.state.projectId,
|
|
48665
48553
|
from: sourceToken.address,
|
|
48666
48554
|
to: toToken.address,
|
|
48667
|
-
gasPrice: state$
|
|
48555
|
+
gasPrice: state$9.gasFee,
|
|
48668
48556
|
amount: amountDecimal.toString()
|
|
48669
48557
|
});
|
|
48670
|
-
state$
|
|
48558
|
+
state$9.loadingQuote = false;
|
|
48671
48559
|
const quoteToAmount = (_b2 = (_a3 = quoteResponse == null ? void 0 : quoteResponse.quotes) == null ? void 0 : _a3[0]) == null ? void 0 : _b2.toAmount;
|
|
48672
48560
|
if (!quoteToAmount) {
|
|
48673
48561
|
AlertController.open({
|
|
@@ -48678,32 +48566,32 @@ const SwapController = {
|
|
|
48678
48566
|
}
|
|
48679
48567
|
const toTokenAmount = NumberUtil.bigNumber(quoteToAmount).dividedBy(10 ** toToken.decimals).toString();
|
|
48680
48568
|
this.setToTokenAmount(toTokenAmount);
|
|
48681
|
-
const isInsufficientToken = this.hasInsufficientToken(state$
|
|
48569
|
+
const isInsufficientToken = this.hasInsufficientToken(state$9.sourceTokenAmount, sourceToken.address);
|
|
48682
48570
|
if (isInsufficientToken) {
|
|
48683
|
-
state$
|
|
48571
|
+
state$9.inputError = "Insufficient balance";
|
|
48684
48572
|
} else {
|
|
48685
|
-
state$
|
|
48573
|
+
state$9.inputError = void 0;
|
|
48686
48574
|
this.setTransactionDetails();
|
|
48687
48575
|
}
|
|
48688
48576
|
} catch (error) {
|
|
48689
|
-
state$
|
|
48690
|
-
state$
|
|
48577
|
+
state$9.loadingQuote = false;
|
|
48578
|
+
state$9.inputError = "Insufficient balance";
|
|
48691
48579
|
}
|
|
48692
48580
|
},
|
|
48693
48581
|
// -- Create Transactions -------------------------------------- //
|
|
48694
48582
|
async getTransaction() {
|
|
48695
48583
|
const { fromCaipAddress, availableToSwap } = this.getParams();
|
|
48696
|
-
const sourceToken = state$
|
|
48697
|
-
const toToken = state$
|
|
48698
|
-
if (!fromCaipAddress || !availableToSwap || !sourceToken || !toToken || state$
|
|
48584
|
+
const sourceToken = state$9.sourceToken;
|
|
48585
|
+
const toToken = state$9.toToken;
|
|
48586
|
+
if (!fromCaipAddress || !availableToSwap || !sourceToken || !toToken || state$9.loadingQuote) {
|
|
48699
48587
|
return void 0;
|
|
48700
48588
|
}
|
|
48701
48589
|
try {
|
|
48702
|
-
state$
|
|
48590
|
+
state$9.loadingBuildTransaction = true;
|
|
48703
48591
|
const hasAllowance = await SwapApiUtil.fetchSwapAllowance({
|
|
48704
48592
|
userAddress: fromCaipAddress,
|
|
48705
48593
|
tokenAddress: sourceToken.address,
|
|
48706
|
-
sourceTokenAmount: state$
|
|
48594
|
+
sourceTokenAmount: state$9.sourceTokenAmount,
|
|
48707
48595
|
sourceTokenDecimals: sourceToken.decimals
|
|
48708
48596
|
});
|
|
48709
48597
|
let transaction = void 0;
|
|
@@ -48712,16 +48600,16 @@ const SwapController = {
|
|
|
48712
48600
|
} else {
|
|
48713
48601
|
transaction = await this.createAllowanceTransaction();
|
|
48714
48602
|
}
|
|
48715
|
-
state$
|
|
48716
|
-
state$
|
|
48603
|
+
state$9.loadingBuildTransaction = false;
|
|
48604
|
+
state$9.fetchError = false;
|
|
48717
48605
|
return transaction;
|
|
48718
48606
|
} catch (error) {
|
|
48719
48607
|
RouterController.goBack();
|
|
48720
48608
|
SnackController.showError("Failed to check allowance");
|
|
48721
|
-
state$
|
|
48722
|
-
state$
|
|
48723
|
-
state$
|
|
48724
|
-
state$
|
|
48609
|
+
state$9.loadingBuildTransaction = false;
|
|
48610
|
+
state$9.approvalTransaction = void 0;
|
|
48611
|
+
state$9.swapTransaction = void 0;
|
|
48612
|
+
state$9.fetchError = true;
|
|
48725
48613
|
return void 0;
|
|
48726
48614
|
}
|
|
48727
48615
|
},
|
|
@@ -48751,10 +48639,10 @@ const SwapController = {
|
|
|
48751
48639
|
gas: gasLimit,
|
|
48752
48640
|
gasPrice: BigInt(response.tx.eip155.gasPrice),
|
|
48753
48641
|
value: BigInt(response.tx.value),
|
|
48754
|
-
toAmount: state$
|
|
48642
|
+
toAmount: state$9.toTokenAmount
|
|
48755
48643
|
};
|
|
48756
|
-
state$
|
|
48757
|
-
state$
|
|
48644
|
+
state$9.swapTransaction = void 0;
|
|
48645
|
+
state$9.approvalTransaction = {
|
|
48758
48646
|
data: transaction.data,
|
|
48759
48647
|
to: transaction.to,
|
|
48760
48648
|
gas: transaction.gas ?? BigInt(0),
|
|
@@ -48773,17 +48661,17 @@ const SwapController = {
|
|
|
48773
48661
|
} catch (error) {
|
|
48774
48662
|
RouterController.goBack();
|
|
48775
48663
|
SnackController.showError("Failed to create approval transaction");
|
|
48776
|
-
state$
|
|
48777
|
-
state$
|
|
48778
|
-
state$
|
|
48664
|
+
state$9.approvalTransaction = void 0;
|
|
48665
|
+
state$9.swapTransaction = void 0;
|
|
48666
|
+
state$9.fetchError = true;
|
|
48779
48667
|
return void 0;
|
|
48780
48668
|
}
|
|
48781
48669
|
},
|
|
48782
48670
|
async createSwapTransaction() {
|
|
48783
48671
|
var _a3;
|
|
48784
48672
|
const { networkAddress, fromCaipAddress, sourceTokenAmount } = this.getParams();
|
|
48785
|
-
const sourceToken = state$
|
|
48786
|
-
const toToken = state$
|
|
48673
|
+
const sourceToken = state$9.sourceToken;
|
|
48674
|
+
const toToken = state$9.toToken;
|
|
48787
48675
|
if (!fromCaipAddress || !sourceTokenAmount || !sourceToken || !toToken) {
|
|
48788
48676
|
return void 0;
|
|
48789
48677
|
}
|
|
@@ -48805,18 +48693,18 @@ const SwapController = {
|
|
|
48805
48693
|
gas,
|
|
48806
48694
|
gasPrice,
|
|
48807
48695
|
value: isSourceTokenIsNetworkToken ? BigInt(amount ?? "0") : BigInt("0"),
|
|
48808
|
-
toAmount: state$
|
|
48696
|
+
toAmount: state$9.toTokenAmount
|
|
48809
48697
|
};
|
|
48810
|
-
state$
|
|
48811
|
-
state$
|
|
48812
|
-
state$
|
|
48698
|
+
state$9.gasPriceInUSD = SwapCalculationUtil.getGasPriceInUSD(state$9.networkPrice, gas, gasPrice);
|
|
48699
|
+
state$9.approvalTransaction = void 0;
|
|
48700
|
+
state$9.swapTransaction = transaction;
|
|
48813
48701
|
return transaction;
|
|
48814
48702
|
} catch (error) {
|
|
48815
48703
|
RouterController.goBack();
|
|
48816
48704
|
SnackController.showError("Failed to create transaction");
|
|
48817
|
-
state$
|
|
48818
|
-
state$
|
|
48819
|
-
state$
|
|
48705
|
+
state$9.approvalTransaction = void 0;
|
|
48706
|
+
state$9.swapTransaction = void 0;
|
|
48707
|
+
state$9.fetchError = true;
|
|
48820
48708
|
return void 0;
|
|
48821
48709
|
}
|
|
48822
48710
|
},
|
|
@@ -48824,7 +48712,7 @@ const SwapController = {
|
|
|
48824
48712
|
async sendTransactionForApproval(data) {
|
|
48825
48713
|
var _a3, _b2, _c2;
|
|
48826
48714
|
const { fromAddress, isAuthConnector } = this.getParams();
|
|
48827
|
-
state$
|
|
48715
|
+
state$9.loadingApprovalTransaction = true;
|
|
48828
48716
|
const approveLimitMessage = `Approve limit increase in your wallet`;
|
|
48829
48717
|
if (isAuthConnector) {
|
|
48830
48718
|
RouterController.pushTransactionStack({
|
|
@@ -48849,12 +48737,12 @@ const SwapController = {
|
|
|
48849
48737
|
});
|
|
48850
48738
|
await this.swapTokens();
|
|
48851
48739
|
await this.getTransaction();
|
|
48852
|
-
state$
|
|
48853
|
-
state$
|
|
48740
|
+
state$9.approvalTransaction = void 0;
|
|
48741
|
+
state$9.loadingApprovalTransaction = false;
|
|
48854
48742
|
} catch (err) {
|
|
48855
48743
|
const error = err;
|
|
48856
|
-
state$
|
|
48857
|
-
state$
|
|
48744
|
+
state$9.transactionError = error == null ? void 0 : error.shortMessage;
|
|
48745
|
+
state$9.loadingApprovalTransaction = false;
|
|
48858
48746
|
SnackController.showError((error == null ? void 0 : error.shortMessage) || "Transaction error");
|
|
48859
48747
|
EventsController.sendEvent({
|
|
48860
48748
|
type: "track",
|
|
@@ -48877,9 +48765,9 @@ const SwapController = {
|
|
|
48877
48765
|
return void 0;
|
|
48878
48766
|
}
|
|
48879
48767
|
const { fromAddress, toTokenAmount, isAuthConnector } = this.getParams();
|
|
48880
|
-
state$
|
|
48881
|
-
const snackbarPendingMessage = `Swapping ${(_a3 = state$
|
|
48882
|
-
const snackbarSuccessMessage = `Swapped ${(_c2 = state$
|
|
48768
|
+
state$9.loadingTransaction = true;
|
|
48769
|
+
const snackbarPendingMessage = `Swapping ${(_a3 = state$9.sourceToken) == null ? void 0 : _a3.symbol} to ${NumberUtil.formatNumberToLocalString(toTokenAmount, 3)} ${(_b2 = state$9.toToken) == null ? void 0 : _b2.symbol}`;
|
|
48770
|
+
const snackbarSuccessMessage = `Swapped ${(_c2 = state$9.sourceToken) == null ? void 0 : _c2.symbol} to ${NumberUtil.formatNumberToLocalString(toTokenAmount, 3)} ${(_d = state$9.toToken) == null ? void 0 : _d.symbol}`;
|
|
48883
48771
|
if (isAuthConnector) {
|
|
48884
48772
|
RouterController.pushTransactionStack({
|
|
48885
48773
|
view: "Account",
|
|
@@ -48893,7 +48781,7 @@ const SwapController = {
|
|
|
48893
48781
|
SnackController.showLoading("Confirm transaction in your wallet");
|
|
48894
48782
|
}
|
|
48895
48783
|
try {
|
|
48896
|
-
const forceUpdateAddresses = [(_e3 = state$
|
|
48784
|
+
const forceUpdateAddresses = [(_e3 = state$9.sourceToken) == null ? void 0 : _e3.address, (_f = state$9.toToken) == null ? void 0 : _f.address].join(",");
|
|
48897
48785
|
const transactionHash = await ConnectionController.sendTransaction({
|
|
48898
48786
|
address: fromAddress,
|
|
48899
48787
|
to: data.to,
|
|
@@ -48903,7 +48791,7 @@ const SwapController = {
|
|
|
48903
48791
|
value: data.value,
|
|
48904
48792
|
chainNamespace: "eip155"
|
|
48905
48793
|
});
|
|
48906
|
-
state$
|
|
48794
|
+
state$9.loadingTransaction = false;
|
|
48907
48795
|
SnackController.showSuccess(snackbarSuccessMessage);
|
|
48908
48796
|
EventsController.sendEvent({
|
|
48909
48797
|
type: "track",
|
|
@@ -48925,8 +48813,8 @@ const SwapController = {
|
|
|
48925
48813
|
return transactionHash;
|
|
48926
48814
|
} catch (err) {
|
|
48927
48815
|
const error = err;
|
|
48928
|
-
state$
|
|
48929
|
-
state$
|
|
48816
|
+
state$9.transactionError = error == null ? void 0 : error.shortMessage;
|
|
48817
|
+
state$9.loadingTransaction = false;
|
|
48930
48818
|
SnackController.showError((error == null ? void 0 : error.shortMessage) || "Transaction error");
|
|
48931
48819
|
EventsController.sendEvent({
|
|
48932
48820
|
type: "track",
|
|
@@ -48946,12 +48834,12 @@ const SwapController = {
|
|
|
48946
48834
|
},
|
|
48947
48835
|
// -- Checks -------------------------------------------- //
|
|
48948
48836
|
hasInsufficientToken(sourceTokenAmount, sourceTokenAddress) {
|
|
48949
|
-
const isInsufficientSourceTokenForSwap = SwapCalculationUtil.isInsufficientSourceTokenForSwap(sourceTokenAmount, sourceTokenAddress, state$
|
|
48837
|
+
const isInsufficientSourceTokenForSwap = SwapCalculationUtil.isInsufficientSourceTokenForSwap(sourceTokenAmount, sourceTokenAddress, state$9.myTokensWithBalance);
|
|
48950
48838
|
let insufficientNetworkTokenForGas = true;
|
|
48951
48839
|
if (AccountController.state.preferredAccountType === W3mFrameRpcConstants.ACCOUNT_TYPES.SMART_ACCOUNT) {
|
|
48952
48840
|
insufficientNetworkTokenForGas = false;
|
|
48953
48841
|
} else {
|
|
48954
|
-
insufficientNetworkTokenForGas = SwapCalculationUtil.isInsufficientNetworkTokenForGas(state$
|
|
48842
|
+
insufficientNetworkTokenForGas = SwapCalculationUtil.isInsufficientNetworkTokenForGas(state$9.networkBalanceInUSD, state$9.gasPriceInUSD);
|
|
48955
48843
|
}
|
|
48956
48844
|
return insufficientNetworkTokenForGas || isInsufficientSourceTokenForSwap;
|
|
48957
48845
|
},
|
|
@@ -48961,18 +48849,18 @@ const SwapController = {
|
|
|
48961
48849
|
if (!toTokenAddress || !toTokenDecimals) {
|
|
48962
48850
|
return;
|
|
48963
48851
|
}
|
|
48964
|
-
state$
|
|
48965
|
-
state$
|
|
48966
|
-
sourceTokenAmount: state$
|
|
48967
|
-
sourceTokenPriceInUSD: state$
|
|
48968
|
-
toTokenPriceInUSD: state$
|
|
48969
|
-
toTokenAmount: state$
|
|
48852
|
+
state$9.gasPriceInUSD = SwapCalculationUtil.getGasPriceInUSD(state$9.networkPrice, BigInt(state$9.gasFee), BigInt(INITIAL_GAS_LIMIT));
|
|
48853
|
+
state$9.priceImpact = SwapCalculationUtil.getPriceImpact({
|
|
48854
|
+
sourceTokenAmount: state$9.sourceTokenAmount,
|
|
48855
|
+
sourceTokenPriceInUSD: state$9.sourceTokenPriceInUSD,
|
|
48856
|
+
toTokenPriceInUSD: state$9.toTokenPriceInUSD,
|
|
48857
|
+
toTokenAmount: state$9.toTokenAmount
|
|
48970
48858
|
});
|
|
48971
|
-
state$
|
|
48972
|
-
state$
|
|
48859
|
+
state$9.maxSlippage = SwapCalculationUtil.getMaxSlippage(state$9.slippage, state$9.toTokenAmount);
|
|
48860
|
+
state$9.providerFee = SwapCalculationUtil.getProviderFee(state$9.sourceTokenAmount);
|
|
48973
48861
|
}
|
|
48974
48862
|
};
|
|
48975
|
-
const state$
|
|
48863
|
+
const state$8 = proxy({
|
|
48976
48864
|
currentTab: 0,
|
|
48977
48865
|
tokenBalance: [],
|
|
48978
48866
|
smartAccountDeployed: false,
|
|
@@ -48980,12 +48868,12 @@ const state$b = proxy({
|
|
|
48980
48868
|
allAccounts: []
|
|
48981
48869
|
});
|
|
48982
48870
|
const AccountController = {
|
|
48983
|
-
state: state$
|
|
48871
|
+
state: state$8,
|
|
48984
48872
|
replaceState(newState) {
|
|
48985
48873
|
if (!newState) {
|
|
48986
48874
|
return;
|
|
48987
48875
|
}
|
|
48988
|
-
Object.assign(state$
|
|
48876
|
+
Object.assign(state$8, ref$1(newState));
|
|
48989
48877
|
},
|
|
48990
48878
|
subscribe(callback) {
|
|
48991
48879
|
return ChainController.subscribeChainProp("accountState", (accountState2) => {
|
|
@@ -49032,7 +48920,7 @@ const AccountController = {
|
|
|
49032
48920
|
ChainController.setAccountProp("profileImage", profileImage, chain);
|
|
49033
48921
|
},
|
|
49034
48922
|
setUser(user) {
|
|
49035
|
-
state$
|
|
48923
|
+
state$8.user = user;
|
|
49036
48924
|
},
|
|
49037
48925
|
setAddressExplorerUrl(explorerUrl, chain) {
|
|
49038
48926
|
ChainController.setAccountProp("addressExplorerUrl", explorerUrl, chain);
|
|
@@ -49087,7 +48975,7 @@ const AccountController = {
|
|
|
49087
48975
|
const chain = (_b2 = ChainController.state.activeCaipNetwork) == null ? void 0 : _b2.chainNamespace;
|
|
49088
48976
|
const caipAddress = ChainController.state.activeCaipAddress;
|
|
49089
48977
|
const address = caipAddress ? CoreHelperUtil.getPlainAddress(caipAddress) : void 0;
|
|
49090
|
-
if (state$
|
|
48978
|
+
if (state$8.lastRetry && !CoreHelperUtil.isAllowedRetry(state$8.lastRetry, 30 * ConstantsUtil$2.ONE_SEC_MS)) {
|
|
49091
48979
|
return [];
|
|
49092
48980
|
}
|
|
49093
48981
|
try {
|
|
@@ -49096,11 +48984,11 @@ const AccountController = {
|
|
|
49096
48984
|
const filteredBalances = response.balances.filter((balance) => balance.quantity.decimals !== "0");
|
|
49097
48985
|
this.setTokenBalance(filteredBalances, chain);
|
|
49098
48986
|
SwapController.setBalances(SwapApiUtil.mapBalancesToSwapTokens(response.balances));
|
|
49099
|
-
state$
|
|
48987
|
+
state$8.lastRetry = void 0;
|
|
49100
48988
|
return filteredBalances;
|
|
49101
48989
|
}
|
|
49102
48990
|
} catch (error) {
|
|
49103
|
-
state$
|
|
48991
|
+
state$8.lastRetry = Date.now();
|
|
49104
48992
|
onError == null ? void 0 : onError(error);
|
|
49105
48993
|
SnackController.showError("Token Balance Unavailable");
|
|
49106
48994
|
}
|
|
@@ -49110,7 +48998,7 @@ const AccountController = {
|
|
|
49110
48998
|
ChainController.resetAccount(chain);
|
|
49111
48999
|
}
|
|
49112
49000
|
};
|
|
49113
|
-
const state$
|
|
49001
|
+
const state$7 = proxy({
|
|
49114
49002
|
loading: false,
|
|
49115
49003
|
open: false,
|
|
49116
49004
|
selectedNetworkId: void 0,
|
|
@@ -49118,12 +49006,12 @@ const state$a = proxy({
|
|
|
49118
49006
|
initialized: false
|
|
49119
49007
|
});
|
|
49120
49008
|
const PublicStateController = {
|
|
49121
|
-
state: state$
|
|
49009
|
+
state: state$7,
|
|
49122
49010
|
subscribe(callback) {
|
|
49123
|
-
return subscribe(state$
|
|
49011
|
+
return subscribe(state$7, () => callback(state$7));
|
|
49124
49012
|
},
|
|
49125
49013
|
set(newState) {
|
|
49126
|
-
Object.assign(state$
|
|
49014
|
+
Object.assign(state$7, { ...state$7, ...newState });
|
|
49127
49015
|
}
|
|
49128
49016
|
};
|
|
49129
49017
|
const accountState = {
|
|
@@ -49137,7 +49025,7 @@ const networkState = {
|
|
|
49137
49025
|
supportsAllNetworks: true,
|
|
49138
49026
|
smartAccountEnabledNetworks: []
|
|
49139
49027
|
};
|
|
49140
|
-
const state$
|
|
49028
|
+
const state$6 = proxy({
|
|
49141
49029
|
chains: proxyMap(),
|
|
49142
49030
|
activeCaipAddress: void 0,
|
|
49143
49031
|
activeChain: void 0,
|
|
@@ -49150,22 +49038,22 @@ const state$9 = proxy({
|
|
|
49150
49038
|
isSwitchingNamespace: false
|
|
49151
49039
|
});
|
|
49152
49040
|
const ChainController = {
|
|
49153
|
-
state: state$
|
|
49041
|
+
state: state$6,
|
|
49154
49042
|
subscribe(callback) {
|
|
49155
|
-
return subscribe(state$
|
|
49156
|
-
callback(state$
|
|
49043
|
+
return subscribe(state$6, () => {
|
|
49044
|
+
callback(state$6);
|
|
49157
49045
|
});
|
|
49158
49046
|
},
|
|
49159
49047
|
subscribeKey(key2, callback) {
|
|
49160
|
-
return subscribeKey(state$
|
|
49048
|
+
return subscribeKey(state$6, key2, callback);
|
|
49161
49049
|
},
|
|
49162
49050
|
subscribeChainProp(property, callback, chain) {
|
|
49163
49051
|
let prev = void 0;
|
|
49164
|
-
return subscribe(state$
|
|
49052
|
+
return subscribe(state$6.chains, () => {
|
|
49165
49053
|
var _a3;
|
|
49166
|
-
const activeChain = chain || state$
|
|
49054
|
+
const activeChain = chain || state$6.activeChain;
|
|
49167
49055
|
if (activeChain) {
|
|
49168
|
-
const nextValue = (_a3 = state$
|
|
49056
|
+
const nextValue = (_a3 = state$6.chains.get(activeChain)) == null ? void 0 : _a3[property];
|
|
49169
49057
|
if (prev !== nextValue) {
|
|
49170
49058
|
prev = nextValue;
|
|
49171
49059
|
callback(nextValue);
|
|
@@ -49180,12 +49068,12 @@ const ChainController = {
|
|
|
49180
49068
|
const adapterToActivate = defaultAdapter || (adapters == null ? void 0 : adapters[0]);
|
|
49181
49069
|
const namespaces = /* @__PURE__ */ new Set([...(caipNetworks == null ? void 0 : caipNetworks.map((network) => network.chainNamespace)) ?? []]);
|
|
49182
49070
|
if ((adapters == null ? void 0 : adapters.length) === 0 || !adapterToActivate) {
|
|
49183
|
-
state$
|
|
49071
|
+
state$6.noAdapters = true;
|
|
49184
49072
|
}
|
|
49185
|
-
if (!state$
|
|
49186
|
-
state$
|
|
49187
|
-
state$
|
|
49188
|
-
if (state$
|
|
49073
|
+
if (!state$6.noAdapters) {
|
|
49074
|
+
state$6.activeChain = adapterToActivate == null ? void 0 : adapterToActivate.namespace;
|
|
49075
|
+
state$6.activeCaipNetwork = activeCaipNetwork;
|
|
49076
|
+
if (state$6.activeChain) {
|
|
49189
49077
|
PublicStateController.set({ activeChain: adapterToActivate == null ? void 0 : adapterToActivate.namespace });
|
|
49190
49078
|
}
|
|
49191
49079
|
}
|
|
@@ -49202,8 +49090,8 @@ const ChainController = {
|
|
|
49202
49090
|
},
|
|
49203
49091
|
removeAdapter(namespace) {
|
|
49204
49092
|
var _a3, _b2;
|
|
49205
|
-
if (state$
|
|
49206
|
-
const nextAdapter = Array.from(state$
|
|
49093
|
+
if (state$6.activeChain === namespace) {
|
|
49094
|
+
const nextAdapter = Array.from(state$6.chains.entries()).find(([chainNamespace]) => chainNamespace !== namespace);
|
|
49207
49095
|
if (nextAdapter) {
|
|
49208
49096
|
const caipNetwork = (_b2 = (_a3 = nextAdapter[1]) == null ? void 0 : _a3.caipNetworks) == null ? void 0 : _b2[0];
|
|
49209
49097
|
if (caipNetwork) {
|
|
@@ -49211,10 +49099,10 @@ const ChainController = {
|
|
|
49211
49099
|
}
|
|
49212
49100
|
}
|
|
49213
49101
|
}
|
|
49214
|
-
state$
|
|
49102
|
+
state$6.chains.delete(namespace);
|
|
49215
49103
|
},
|
|
49216
49104
|
addAdapter(adapter, { networkControllerClient, connectionControllerClient }, caipNetworks) {
|
|
49217
|
-
state$
|
|
49105
|
+
state$6.chains.set(adapter.namespace, {
|
|
49218
49106
|
namespace: adapter.namespace,
|
|
49219
49107
|
networkState,
|
|
49220
49108
|
accountState,
|
|
@@ -49225,29 +49113,29 @@ const ChainController = {
|
|
|
49225
49113
|
this.setRequestedCaipNetworks((caipNetworks == null ? void 0 : caipNetworks.filter((caipNetwork) => caipNetwork.chainNamespace === adapter.namespace)) ?? [], adapter.namespace);
|
|
49226
49114
|
},
|
|
49227
49115
|
setAdapterNetworkState(chain, props) {
|
|
49228
|
-
const chainAdapter = state$
|
|
49116
|
+
const chainAdapter = state$6.chains.get(chain);
|
|
49229
49117
|
if (chainAdapter) {
|
|
49230
49118
|
chainAdapter.networkState = ref$1({
|
|
49231
49119
|
...chainAdapter.networkState || networkState,
|
|
49232
49120
|
...props
|
|
49233
49121
|
});
|
|
49234
|
-
state$
|
|
49122
|
+
state$6.chains.set(chain, ref$1(chainAdapter));
|
|
49235
49123
|
}
|
|
49236
49124
|
},
|
|
49237
49125
|
setChainAccountData(chain, accountProps, _unknown = true) {
|
|
49238
49126
|
if (!chain) {
|
|
49239
49127
|
throw new Error("Chain is required to update chain account data");
|
|
49240
49128
|
}
|
|
49241
|
-
const chainAdapter = state$
|
|
49129
|
+
const chainAdapter = state$6.chains.get(chain);
|
|
49242
49130
|
if (chainAdapter) {
|
|
49243
49131
|
chainAdapter.accountState = ref$1({
|
|
49244
49132
|
...chainAdapter.accountState || accountState,
|
|
49245
49133
|
...accountProps
|
|
49246
49134
|
});
|
|
49247
|
-
state$
|
|
49248
|
-
if (state$
|
|
49135
|
+
state$6.chains.set(chain, chainAdapter);
|
|
49136
|
+
if (state$6.chains.size === 1 || state$6.activeChain === chain) {
|
|
49249
49137
|
if (accountProps.caipAddress) {
|
|
49250
|
-
state$
|
|
49138
|
+
state$6.activeCaipAddress = accountProps.caipAddress;
|
|
49251
49139
|
}
|
|
49252
49140
|
AccountController.replaceState(chainAdapter.accountState);
|
|
49253
49141
|
}
|
|
@@ -49261,12 +49149,12 @@ const ChainController = {
|
|
|
49261
49149
|
},
|
|
49262
49150
|
setActiveNamespace(chain) {
|
|
49263
49151
|
var _a3, _b2;
|
|
49264
|
-
state$
|
|
49265
|
-
const newAdapter = chain ? state$
|
|
49152
|
+
state$6.activeChain = chain;
|
|
49153
|
+
const newAdapter = chain ? state$6.chains.get(chain) : void 0;
|
|
49266
49154
|
const caipNetwork = (_a3 = newAdapter == null ? void 0 : newAdapter.networkState) == null ? void 0 : _a3.caipNetwork;
|
|
49267
49155
|
if ((caipNetwork == null ? void 0 : caipNetwork.id) && chain) {
|
|
49268
|
-
state$
|
|
49269
|
-
state$
|
|
49156
|
+
state$6.activeCaipAddress = (_b2 = newAdapter == null ? void 0 : newAdapter.accountState) == null ? void 0 : _b2.caipAddress;
|
|
49157
|
+
state$6.activeCaipNetwork = caipNetwork;
|
|
49270
49158
|
StorageUtil.setActiveCaipNetworkId(caipNetwork == null ? void 0 : caipNetwork.caipNetworkId);
|
|
49271
49159
|
PublicStateController.set({
|
|
49272
49160
|
activeChain: chain,
|
|
@@ -49279,23 +49167,23 @@ const ChainController = {
|
|
|
49279
49167
|
if (!caipNetwork) {
|
|
49280
49168
|
return;
|
|
49281
49169
|
}
|
|
49282
|
-
if (state$
|
|
49170
|
+
if (state$6.activeChain !== caipNetwork.chainNamespace) {
|
|
49283
49171
|
this.setIsSwitchingNamespace(true);
|
|
49284
49172
|
}
|
|
49285
|
-
const newAdapter = state$
|
|
49286
|
-
state$
|
|
49287
|
-
state$
|
|
49173
|
+
const newAdapter = state$6.chains.get(caipNetwork.chainNamespace);
|
|
49174
|
+
state$6.activeChain = caipNetwork.chainNamespace;
|
|
49175
|
+
state$6.activeCaipNetwork = caipNetwork;
|
|
49288
49176
|
if ((_a3 = newAdapter == null ? void 0 : newAdapter.accountState) == null ? void 0 : _a3.address) {
|
|
49289
|
-
state$
|
|
49177
|
+
state$6.activeCaipAddress = `${caipNetwork.chainNamespace}:${caipNetwork.id}:${(_b2 = newAdapter == null ? void 0 : newAdapter.accountState) == null ? void 0 : _b2.address}`;
|
|
49290
49178
|
} else {
|
|
49291
|
-
state$
|
|
49179
|
+
state$6.activeCaipAddress = void 0;
|
|
49292
49180
|
}
|
|
49293
49181
|
if (newAdapter) {
|
|
49294
49182
|
AccountController.replaceState(newAdapter.accountState);
|
|
49295
49183
|
}
|
|
49296
49184
|
PublicStateController.set({
|
|
49297
|
-
activeChain: state$
|
|
49298
|
-
selectedNetworkId: (_c2 = state$
|
|
49185
|
+
activeChain: state$6.activeChain,
|
|
49186
|
+
selectedNetworkId: (_c2 = state$6.activeCaipNetwork) == null ? void 0 : _c2.caipNetworkId
|
|
49299
49187
|
});
|
|
49300
49188
|
StorageUtil.setActiveCaipNetworkId(caipNetwork.caipNetworkId);
|
|
49301
49189
|
const isSupported = this.checkIfSupportedNetwork(caipNetwork.chainNamespace);
|
|
@@ -49308,7 +49196,7 @@ const ChainController = {
|
|
|
49308
49196
|
if (!caipNetwork) {
|
|
49309
49197
|
return;
|
|
49310
49198
|
}
|
|
49311
|
-
const chain = state$
|
|
49199
|
+
const chain = state$6.chains.get(caipNetwork.chainNamespace);
|
|
49312
49200
|
if (chain) {
|
|
49313
49201
|
(_a3 = chain == null ? void 0 : chain.caipNetworks) == null ? void 0 : _a3.push(caipNetwork);
|
|
49314
49202
|
}
|
|
@@ -49318,7 +49206,7 @@ const ChainController = {
|
|
|
49318
49206
|
const activeAdapter = ChainController.state.chains.get(ChainController.state.activeChain);
|
|
49319
49207
|
const unsupportedNetwork = !((_a3 = activeAdapter == null ? void 0 : activeAdapter.caipNetworks) == null ? void 0 : _a3.some((caipNetwork) => {
|
|
49320
49208
|
var _a4;
|
|
49321
|
-
return caipNetwork.id === ((_a4 = state$
|
|
49209
|
+
return caipNetwork.id === ((_a4 = state$6.activeCaipNetwork) == null ? void 0 : _a4.id);
|
|
49322
49210
|
}));
|
|
49323
49211
|
if (unsupportedNetwork) {
|
|
49324
49212
|
RouterController.goBack();
|
|
@@ -49334,8 +49222,8 @@ const ChainController = {
|
|
|
49334
49222
|
}
|
|
49335
49223
|
},
|
|
49336
49224
|
getNetworkControllerClient(chainNamespace) {
|
|
49337
|
-
const chain = chainNamespace || state$
|
|
49338
|
-
const chainAdapter = state$
|
|
49225
|
+
const chain = chainNamespace || state$6.activeChain;
|
|
49226
|
+
const chainAdapter = state$6.chains.get(chain);
|
|
49339
49227
|
if (!chainAdapter) {
|
|
49340
49228
|
throw new Error("Chain adapter not found");
|
|
49341
49229
|
}
|
|
@@ -49345,11 +49233,11 @@ const ChainController = {
|
|
|
49345
49233
|
return chainAdapter.networkControllerClient;
|
|
49346
49234
|
},
|
|
49347
49235
|
getConnectionControllerClient(_chain) {
|
|
49348
|
-
const chain = _chain || state$
|
|
49236
|
+
const chain = _chain || state$6.activeChain;
|
|
49349
49237
|
if (!chain) {
|
|
49350
49238
|
throw new Error("Chain is required to get connection controller client");
|
|
49351
49239
|
}
|
|
49352
|
-
const chainAdapter = state$
|
|
49240
|
+
const chainAdapter = state$6.chains.get(chain);
|
|
49353
49241
|
if (!(chainAdapter == null ? void 0 : chainAdapter.connectionControllerClient)) {
|
|
49354
49242
|
throw new Error("ConnectionController client not set");
|
|
49355
49243
|
}
|
|
@@ -49357,14 +49245,14 @@ const ChainController = {
|
|
|
49357
49245
|
},
|
|
49358
49246
|
getAccountProp(key2, _chain) {
|
|
49359
49247
|
var _a3;
|
|
49360
|
-
let chain = state$
|
|
49248
|
+
let chain = state$6.activeChain;
|
|
49361
49249
|
if (_chain) {
|
|
49362
49250
|
chain = _chain;
|
|
49363
49251
|
}
|
|
49364
49252
|
if (!chain) {
|
|
49365
49253
|
return void 0;
|
|
49366
49254
|
}
|
|
49367
|
-
const chainAccountState = (_a3 = state$
|
|
49255
|
+
const chainAccountState = (_a3 = state$6.chains.get(chain)) == null ? void 0 : _a3.accountState;
|
|
49368
49256
|
if (!chainAccountState) {
|
|
49369
49257
|
return void 0;
|
|
49370
49258
|
}
|
|
@@ -49372,21 +49260,21 @@ const ChainController = {
|
|
|
49372
49260
|
},
|
|
49373
49261
|
getNetworkProp(key2, namespace) {
|
|
49374
49262
|
var _a3;
|
|
49375
|
-
const chainNetworkState = (_a3 = state$
|
|
49263
|
+
const chainNetworkState = (_a3 = state$6.chains.get(namespace)) == null ? void 0 : _a3.networkState;
|
|
49376
49264
|
if (!chainNetworkState) {
|
|
49377
49265
|
return void 0;
|
|
49378
49266
|
}
|
|
49379
49267
|
return chainNetworkState[key2];
|
|
49380
49268
|
},
|
|
49381
49269
|
getRequestedCaipNetworks(chainToFilter) {
|
|
49382
|
-
const adapter = state$
|
|
49270
|
+
const adapter = state$6.chains.get(chainToFilter);
|
|
49383
49271
|
const { approvedCaipNetworkIds = [], requestedCaipNetworks = [] } = (adapter == null ? void 0 : adapter.networkState) || {};
|
|
49384
49272
|
const sortedNetworks = CoreHelperUtil.sortRequestedNetworks(approvedCaipNetworkIds, requestedCaipNetworks);
|
|
49385
49273
|
return sortedNetworks;
|
|
49386
49274
|
},
|
|
49387
49275
|
getAllRequestedCaipNetworks() {
|
|
49388
49276
|
const requestedCaipNetworks = [];
|
|
49389
|
-
state$
|
|
49277
|
+
state$6.chains.forEach((chainAdapter) => {
|
|
49390
49278
|
const caipNetworks = this.getRequestedCaipNetworks(chainAdapter.namespace);
|
|
49391
49279
|
requestedCaipNetworks.push(...caipNetworks);
|
|
49392
49280
|
});
|
|
@@ -49397,21 +49285,21 @@ const ChainController = {
|
|
|
49397
49285
|
},
|
|
49398
49286
|
getAllApprovedCaipNetworkIds() {
|
|
49399
49287
|
const approvedCaipNetworkIds = [];
|
|
49400
|
-
state$
|
|
49288
|
+
state$6.chains.forEach((chainAdapter) => {
|
|
49401
49289
|
const approvedIds = this.getApprovedCaipNetworkIds(chainAdapter.namespace);
|
|
49402
49290
|
approvedCaipNetworkIds.push(...approvedIds);
|
|
49403
49291
|
});
|
|
49404
49292
|
return approvedCaipNetworkIds;
|
|
49405
49293
|
},
|
|
49406
49294
|
getActiveCaipNetwork() {
|
|
49407
|
-
return state$
|
|
49295
|
+
return state$6.activeCaipNetwork;
|
|
49408
49296
|
},
|
|
49409
49297
|
getActiveCaipAddress() {
|
|
49410
|
-
return state$
|
|
49298
|
+
return state$6.activeCaipAddress;
|
|
49411
49299
|
},
|
|
49412
49300
|
getApprovedCaipNetworkIds(namespace) {
|
|
49413
49301
|
var _a3;
|
|
49414
|
-
const adapter = state$
|
|
49302
|
+
const adapter = state$6.chains.get(namespace);
|
|
49415
49303
|
const approvedCaipNetworkIds = ((_a3 = adapter == null ? void 0 : adapter.networkState) == null ? void 0 : _a3.approvedCaipNetworkIds) || [];
|
|
49416
49304
|
return approvedCaipNetworkIds;
|
|
49417
49305
|
},
|
|
@@ -49444,7 +49332,7 @@ const ChainController = {
|
|
|
49444
49332
|
},
|
|
49445
49333
|
checkIfSmartAccountEnabled() {
|
|
49446
49334
|
var _a3;
|
|
49447
|
-
const networkId = NetworkUtil.caipNetworkIdToNumber((_a3 = state$
|
|
49335
|
+
const networkId = NetworkUtil.caipNetworkIdToNumber((_a3 = state$6.activeCaipNetwork) == null ? void 0 : _a3.caipNetworkId);
|
|
49448
49336
|
const activeChain = this.state.activeChain;
|
|
49449
49337
|
if (!activeChain || !networkId) {
|
|
49450
49338
|
return false;
|
|
@@ -49463,7 +49351,7 @@ const ChainController = {
|
|
|
49463
49351
|
ModalController.open({ view: "UnsupportedChain" });
|
|
49464
49352
|
},
|
|
49465
49353
|
checkIfNamesSupported() {
|
|
49466
|
-
const activeCaipNetwork = state$
|
|
49354
|
+
const activeCaipNetwork = state$6.activeCaipNetwork;
|
|
49467
49355
|
return Boolean((activeCaipNetwork == null ? void 0 : activeCaipNetwork.chainNamespace) && ConstantsUtil$2.NAMES_SUPPORTED_CHAIN_NAMESPACES.includes(activeCaipNetwork.chainNamespace));
|
|
49468
49356
|
},
|
|
49469
49357
|
resetNetwork(namespace) {
|
|
@@ -49501,7 +49389,7 @@ const ChainController = {
|
|
|
49501
49389
|
},
|
|
49502
49390
|
async disconnect() {
|
|
49503
49391
|
try {
|
|
49504
|
-
const disconnectResults = await Promise.allSettled(Array.from(state$
|
|
49392
|
+
const disconnectResults = await Promise.allSettled(Array.from(state$6.chains.entries()).map(async ([namespace, adapter]) => {
|
|
49505
49393
|
var _a3;
|
|
49506
49394
|
try {
|
|
49507
49395
|
if ((_a3 = adapter.connectionControllerClient) == null ? void 0 : _a3.disconnect) {
|
|
@@ -49537,13 +49425,13 @@ const ChainController = {
|
|
|
49537
49425
|
}
|
|
49538
49426
|
},
|
|
49539
49427
|
setIsSwitchingNamespace(isSwitchingNamespace) {
|
|
49540
|
-
state$
|
|
49428
|
+
state$6.isSwitchingNamespace = isSwitchingNamespace;
|
|
49541
49429
|
},
|
|
49542
49430
|
getFirstCaipNetworkSupportsAuthConnector() {
|
|
49543
49431
|
var _a3, _b2;
|
|
49544
49432
|
const availableChains = [];
|
|
49545
49433
|
let firstCaipNetwork = void 0;
|
|
49546
|
-
state$
|
|
49434
|
+
state$6.chains.forEach((chain) => {
|
|
49547
49435
|
if (ConstantsUtil$3.AUTH_CONNECTOR_SUPPORTED_CHAINS.find((ns2) => ns2 === chain.namespace)) {
|
|
49548
49436
|
if (chain.namespace) {
|
|
49549
49437
|
availableChains.push(chain.namespace);
|
|
@@ -49552,7 +49440,7 @@ const ChainController = {
|
|
|
49552
49440
|
});
|
|
49553
49441
|
if (availableChains.length > 0) {
|
|
49554
49442
|
const firstAvailableChain = availableChains[0];
|
|
49555
|
-
firstCaipNetwork = firstAvailableChain ? (_b2 = (_a3 = state$
|
|
49443
|
+
firstCaipNetwork = firstAvailableChain ? (_b2 = (_a3 = state$6.chains.get(firstAvailableChain)) == null ? void 0 : _a3.caipNetworks) == null ? void 0 : _b2[0] : void 0;
|
|
49556
49444
|
return firstCaipNetwork;
|
|
49557
49445
|
}
|
|
49558
49446
|
return void 0;
|
|
@@ -49563,7 +49451,7 @@ const api = new FetchUtil({ baseUrl, clientId: null });
|
|
|
49563
49451
|
const entries = "40";
|
|
49564
49452
|
const recommendedEntries = "4";
|
|
49565
49453
|
const imageCountToFetch = 20;
|
|
49566
|
-
const state$
|
|
49454
|
+
const state$5 = proxy({
|
|
49567
49455
|
page: 1,
|
|
49568
49456
|
count: 0,
|
|
49569
49457
|
featured: [],
|
|
@@ -49574,9 +49462,9 @@ const state$8 = proxy({
|
|
|
49574
49462
|
excludedRDNS: []
|
|
49575
49463
|
});
|
|
49576
49464
|
const ApiController = {
|
|
49577
|
-
state: state$
|
|
49465
|
+
state: state$5,
|
|
49578
49466
|
subscribeKey(key2, callback) {
|
|
49579
|
-
return subscribeKey(state$
|
|
49467
|
+
return subscribeKey(state$5, key2, callback);
|
|
49580
49468
|
},
|
|
49581
49469
|
_getSdkProperties() {
|
|
49582
49470
|
const { projectId, sdkType, sdkVersion } = OptionsController.state;
|
|
@@ -49650,7 +49538,7 @@ const ApiController = {
|
|
|
49650
49538
|
data.sort((a3, b4) => featuredWalletIds.indexOf(a3.id) - featuredWalletIds.indexOf(b4.id));
|
|
49651
49539
|
const images = data.map((d4) => d4.image_id).filter(Boolean);
|
|
49652
49540
|
await Promise.allSettled(images.map((id) => ApiController._fetchWalletImage(id)));
|
|
49653
|
-
state$
|
|
49541
|
+
state$5.featured = data;
|
|
49654
49542
|
}
|
|
49655
49543
|
},
|
|
49656
49544
|
async fetchRecommendedWallets() {
|
|
@@ -49673,8 +49561,8 @@ const ApiController = {
|
|
|
49673
49561
|
const recommendedImages = data.map((d4) => d4.image_id).filter(Boolean);
|
|
49674
49562
|
const recentImages = recent.map((r3) => r3.image_id).filter(Boolean);
|
|
49675
49563
|
await Promise.allSettled([...recommendedImages, ...recentImages].map((id) => ApiController._fetchWalletImage(id)));
|
|
49676
|
-
state$
|
|
49677
|
-
state$
|
|
49564
|
+
state$5.recommended = data;
|
|
49565
|
+
state$5.count = count ?? 0;
|
|
49678
49566
|
} catch {
|
|
49679
49567
|
}
|
|
49680
49568
|
},
|
|
@@ -49682,7 +49570,7 @@ const ApiController = {
|
|
|
49682
49570
|
var _a3;
|
|
49683
49571
|
const { includeWalletIds, excludeWalletIds, featuredWalletIds } = OptionsController.state;
|
|
49684
49572
|
const exclude = [
|
|
49685
|
-
...state$
|
|
49573
|
+
...state$5.recommended.map(({ id }) => id),
|
|
49686
49574
|
...excludeWalletIds ?? [],
|
|
49687
49575
|
...featuredWalletIds ?? []
|
|
49688
49576
|
].filter(Boolean);
|
|
@@ -49699,9 +49587,9 @@ const ApiController = {
|
|
|
49699
49587
|
});
|
|
49700
49588
|
const images = data.slice(0, imageCountToFetch).map((w2) => w2.image_id).filter(Boolean);
|
|
49701
49589
|
await Promise.allSettled(images.map((id) => ApiController._fetchWalletImage(id)));
|
|
49702
|
-
state$
|
|
49703
|
-
state$
|
|
49704
|
-
state$
|
|
49590
|
+
state$5.wallets = CoreHelperUtil.uniqueBy([...state$5.wallets, ...ApiController._filterOutExtensions(data)], "id");
|
|
49591
|
+
state$5.count = count > state$5.count ? count : state$5.count;
|
|
49592
|
+
state$5.page = page;
|
|
49705
49593
|
},
|
|
49706
49594
|
async initializeExcludedWalletRdns({ ids }) {
|
|
49707
49595
|
var _a3;
|
|
@@ -49718,7 +49606,7 @@ const ApiController = {
|
|
|
49718
49606
|
if (data) {
|
|
49719
49607
|
data.forEach((wallet) => {
|
|
49720
49608
|
if (wallet == null ? void 0 : wallet.rdns) {
|
|
49721
|
-
state$
|
|
49609
|
+
state$5.excludedRDNS.push(wallet.rdns);
|
|
49722
49610
|
}
|
|
49723
49611
|
});
|
|
49724
49612
|
}
|
|
@@ -49726,7 +49614,7 @@ const ApiController = {
|
|
|
49726
49614
|
async searchWallet({ search, badge }) {
|
|
49727
49615
|
var _a3;
|
|
49728
49616
|
const { includeWalletIds, excludeWalletIds } = OptionsController.state;
|
|
49729
|
-
state$
|
|
49617
|
+
state$5.search = [];
|
|
49730
49618
|
const { data } = await api.get({
|
|
49731
49619
|
path: "/getWallets",
|
|
49732
49620
|
params: {
|
|
@@ -49750,11 +49638,11 @@ const ApiController = {
|
|
|
49750
49638
|
...images.map((id) => ApiController._fetchWalletImage(id)),
|
|
49751
49639
|
CoreHelperUtil.wait(300)
|
|
49752
49640
|
]);
|
|
49753
|
-
state$
|
|
49641
|
+
state$5.search = ApiController._filterOutExtensions(data);
|
|
49754
49642
|
},
|
|
49755
49643
|
async reFetchWallets() {
|
|
49756
|
-
state$
|
|
49757
|
-
state$
|
|
49644
|
+
state$5.page = 1;
|
|
49645
|
+
state$5.wallets = [];
|
|
49758
49646
|
await ApiController.fetchFeaturedWallets();
|
|
49759
49647
|
await ApiController.fetchRecommendedWallets();
|
|
49760
49648
|
},
|
|
@@ -49769,7 +49657,7 @@ const ApiController = {
|
|
|
49769
49657
|
if ((_a3 = OptionsController.state.features) == null ? void 0 : _a3.analytics) {
|
|
49770
49658
|
promises.push(ApiController.fetchAnalyticsConfig());
|
|
49771
49659
|
}
|
|
49772
|
-
state$
|
|
49660
|
+
state$5.prefetchPromise = Promise.race([Promise.allSettled(promises)]);
|
|
49773
49661
|
},
|
|
49774
49662
|
async fetchAnalyticsConfig() {
|
|
49775
49663
|
const { isAnalyticsEnabled } = await api.get({
|
|
@@ -49779,18 +49667,18 @@ const ApiController = {
|
|
|
49779
49667
|
OptionsController.setFeatures({ analytics: isAnalyticsEnabled });
|
|
49780
49668
|
}
|
|
49781
49669
|
};
|
|
49782
|
-
const state$
|
|
49670
|
+
const state$4 = proxy({
|
|
49783
49671
|
loading: false,
|
|
49784
49672
|
open: false,
|
|
49785
49673
|
shake: false
|
|
49786
49674
|
});
|
|
49787
49675
|
const ModalController = {
|
|
49788
|
-
state: state$
|
|
49676
|
+
state: state$4,
|
|
49789
49677
|
subscribe(callback) {
|
|
49790
|
-
return subscribe(state$
|
|
49678
|
+
return subscribe(state$4, () => callback(state$4));
|
|
49791
49679
|
},
|
|
49792
49680
|
subscribeKey(key2, callback) {
|
|
49793
|
-
return subscribeKey(state$
|
|
49681
|
+
return subscribeKey(state$4, key2, callback);
|
|
49794
49682
|
},
|
|
49795
49683
|
async open(options) {
|
|
49796
49684
|
await ApiController.state.prefetchPromise;
|
|
@@ -49805,7 +49693,7 @@ const ModalController = {
|
|
|
49805
49693
|
} else {
|
|
49806
49694
|
RouterController.reset("Connect");
|
|
49807
49695
|
}
|
|
49808
|
-
state$
|
|
49696
|
+
state$4.open = true;
|
|
49809
49697
|
PublicStateController.set({ open: true });
|
|
49810
49698
|
EventsController.sendEvent({
|
|
49811
49699
|
type: "track",
|
|
@@ -49816,7 +49704,7 @@ const ModalController = {
|
|
|
49816
49704
|
close() {
|
|
49817
49705
|
const isEmbeddedEnabled = OptionsController.state.enableEmbedded;
|
|
49818
49706
|
const connected = Boolean(ChainController.state.activeCaipAddress);
|
|
49819
|
-
state$
|
|
49707
|
+
state$4.open = false;
|
|
49820
49708
|
if (isEmbeddedEnabled) {
|
|
49821
49709
|
if (connected) {
|
|
49822
49710
|
RouterController.replace("Account");
|
|
@@ -49833,393 +49721,19 @@ const ModalController = {
|
|
|
49833
49721
|
});
|
|
49834
49722
|
},
|
|
49835
49723
|
setLoading(loading) {
|
|
49836
|
-
state$
|
|
49724
|
+
state$4.loading = loading;
|
|
49837
49725
|
PublicStateController.set({ loading });
|
|
49838
49726
|
},
|
|
49839
49727
|
shake() {
|
|
49840
|
-
if (state$
|
|
49728
|
+
if (state$4.shake) {
|
|
49841
49729
|
return;
|
|
49842
49730
|
}
|
|
49843
|
-
state$
|
|
49731
|
+
state$4.shake = true;
|
|
49844
49732
|
setTimeout(() => {
|
|
49845
|
-
state$
|
|
49733
|
+
state$4.shake = false;
|
|
49846
49734
|
}, 500);
|
|
49847
49735
|
}
|
|
49848
49736
|
};
|
|
49849
|
-
const USDC_CURRENCY_DEFAULT = {
|
|
49850
|
-
id: "2b92315d-eab7-5bef-84fa-089a131333f5",
|
|
49851
|
-
name: "USD Coin",
|
|
49852
|
-
symbol: "USDC",
|
|
49853
|
-
networks: [
|
|
49854
|
-
{
|
|
49855
|
-
name: "ethereum-mainnet",
|
|
49856
|
-
display_name: "Ethereum",
|
|
49857
|
-
chain_id: "1",
|
|
49858
|
-
contract_address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
|
|
49859
|
-
},
|
|
49860
|
-
{
|
|
49861
|
-
name: "polygon-mainnet",
|
|
49862
|
-
display_name: "Polygon",
|
|
49863
|
-
chain_id: "137",
|
|
49864
|
-
contract_address: "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"
|
|
49865
|
-
}
|
|
49866
|
-
]
|
|
49867
|
-
};
|
|
49868
|
-
const USD_CURRENCY_DEFAULT = {
|
|
49869
|
-
id: "USD",
|
|
49870
|
-
payment_method_limits: [
|
|
49871
|
-
{
|
|
49872
|
-
id: "card",
|
|
49873
|
-
min: "10.00",
|
|
49874
|
-
max: "7500.00"
|
|
49875
|
-
},
|
|
49876
|
-
{
|
|
49877
|
-
id: "ach_bank_account",
|
|
49878
|
-
min: "10.00",
|
|
49879
|
-
max: "25000.00"
|
|
49880
|
-
}
|
|
49881
|
-
]
|
|
49882
|
-
};
|
|
49883
|
-
const defaultState = {
|
|
49884
|
-
providers: ONRAMP_PROVIDERS,
|
|
49885
|
-
selectedProvider: null,
|
|
49886
|
-
error: null,
|
|
49887
|
-
purchaseCurrency: USDC_CURRENCY_DEFAULT,
|
|
49888
|
-
paymentCurrency: USD_CURRENCY_DEFAULT,
|
|
49889
|
-
purchaseCurrencies: [USDC_CURRENCY_DEFAULT],
|
|
49890
|
-
paymentCurrencies: [],
|
|
49891
|
-
quotesLoading: false
|
|
49892
|
-
};
|
|
49893
|
-
const state$6 = proxy(defaultState);
|
|
49894
|
-
const OnRampController = {
|
|
49895
|
-
state: state$6,
|
|
49896
|
-
subscribe(callback) {
|
|
49897
|
-
return subscribe(state$6, () => callback(state$6));
|
|
49898
|
-
},
|
|
49899
|
-
subscribeKey(key2, callback) {
|
|
49900
|
-
return subscribeKey(state$6, key2, callback);
|
|
49901
|
-
},
|
|
49902
|
-
setSelectedProvider(provider) {
|
|
49903
|
-
if (provider && provider.name === "meld") {
|
|
49904
|
-
const pubKey = MELD_PROD_PUBLIC_KEY;
|
|
49905
|
-
const currency = ChainController.state.activeChain === ConstantsUtil$3.CHAIN.SOLANA ? "SOL" : "USDC";
|
|
49906
|
-
const address = AccountController.state.address ?? "";
|
|
49907
|
-
const url = new URL(provider.url);
|
|
49908
|
-
url.searchParams.append("publicKey", pubKey);
|
|
49909
|
-
url.searchParams.append("destinationCurrencyCode", currency);
|
|
49910
|
-
url.searchParams.append("walletAddress", address);
|
|
49911
|
-
provider.url = url.toString();
|
|
49912
|
-
}
|
|
49913
|
-
state$6.selectedProvider = provider;
|
|
49914
|
-
},
|
|
49915
|
-
setPurchaseCurrency(currency) {
|
|
49916
|
-
state$6.purchaseCurrency = currency;
|
|
49917
|
-
},
|
|
49918
|
-
setPaymentCurrency(currency) {
|
|
49919
|
-
state$6.paymentCurrency = currency;
|
|
49920
|
-
},
|
|
49921
|
-
setPurchaseAmount(amount) {
|
|
49922
|
-
this.state.purchaseAmount = amount;
|
|
49923
|
-
},
|
|
49924
|
-
setPaymentAmount(amount) {
|
|
49925
|
-
this.state.paymentAmount = amount;
|
|
49926
|
-
},
|
|
49927
|
-
async getAvailableCurrencies() {
|
|
49928
|
-
const options = await BlockchainApiController.getOnrampOptions();
|
|
49929
|
-
state$6.purchaseCurrencies = options.purchaseCurrencies;
|
|
49930
|
-
state$6.paymentCurrencies = options.paymentCurrencies;
|
|
49931
|
-
state$6.paymentCurrency = options.paymentCurrencies[0] || USD_CURRENCY_DEFAULT;
|
|
49932
|
-
state$6.purchaseCurrency = options.purchaseCurrencies[0] || USDC_CURRENCY_DEFAULT;
|
|
49933
|
-
await ApiController.fetchCurrencyImages(options.paymentCurrencies.map((currency) => currency.id));
|
|
49934
|
-
await ApiController.fetchTokenImages(options.purchaseCurrencies.map((currency) => currency.symbol));
|
|
49935
|
-
},
|
|
49936
|
-
async getQuote() {
|
|
49937
|
-
var _a3, _b2;
|
|
49938
|
-
state$6.quotesLoading = true;
|
|
49939
|
-
try {
|
|
49940
|
-
const quote = await BlockchainApiController.getOnrampQuote({
|
|
49941
|
-
purchaseCurrency: state$6.purchaseCurrency,
|
|
49942
|
-
paymentCurrency: state$6.paymentCurrency,
|
|
49943
|
-
amount: ((_a3 = state$6.paymentAmount) == null ? void 0 : _a3.toString()) || "0",
|
|
49944
|
-
network: (_b2 = state$6.purchaseCurrency) == null ? void 0 : _b2.symbol
|
|
49945
|
-
});
|
|
49946
|
-
state$6.quotesLoading = false;
|
|
49947
|
-
state$6.purchaseAmount = Number(quote == null ? void 0 : quote.purchaseAmount.amount);
|
|
49948
|
-
return quote;
|
|
49949
|
-
} catch (error) {
|
|
49950
|
-
state$6.error = error.message;
|
|
49951
|
-
state$6.quotesLoading = false;
|
|
49952
|
-
return null;
|
|
49953
|
-
} finally {
|
|
49954
|
-
state$6.quotesLoading = false;
|
|
49955
|
-
}
|
|
49956
|
-
},
|
|
49957
|
-
resetState() {
|
|
49958
|
-
state$6.providers = ONRAMP_PROVIDERS;
|
|
49959
|
-
state$6.selectedProvider = null;
|
|
49960
|
-
state$6.error = null;
|
|
49961
|
-
state$6.purchaseCurrency = USDC_CURRENCY_DEFAULT;
|
|
49962
|
-
state$6.paymentCurrency = USD_CURRENCY_DEFAULT;
|
|
49963
|
-
state$6.purchaseCurrencies = [USDC_CURRENCY_DEFAULT];
|
|
49964
|
-
state$6.paymentCurrencies = [];
|
|
49965
|
-
state$6.paymentAmount = void 0;
|
|
49966
|
-
state$6.purchaseAmount = void 0;
|
|
49967
|
-
state$6.quotesLoading = false;
|
|
49968
|
-
}
|
|
49969
|
-
};
|
|
49970
|
-
const state$5 = proxy({
|
|
49971
|
-
loading: false
|
|
49972
|
-
});
|
|
49973
|
-
const SendController = {
|
|
49974
|
-
state: state$5,
|
|
49975
|
-
subscribe(callback) {
|
|
49976
|
-
return subscribe(state$5, () => callback(state$5));
|
|
49977
|
-
},
|
|
49978
|
-
subscribeKey(key2, callback) {
|
|
49979
|
-
return subscribeKey(state$5, key2, callback);
|
|
49980
|
-
},
|
|
49981
|
-
setToken(token) {
|
|
49982
|
-
if (token) {
|
|
49983
|
-
state$5.token = ref$1(token);
|
|
49984
|
-
}
|
|
49985
|
-
},
|
|
49986
|
-
setTokenAmount(sendTokenAmount) {
|
|
49987
|
-
state$5.sendTokenAmount = sendTokenAmount;
|
|
49988
|
-
},
|
|
49989
|
-
setReceiverAddress(receiverAddress) {
|
|
49990
|
-
state$5.receiverAddress = receiverAddress;
|
|
49991
|
-
},
|
|
49992
|
-
setReceiverProfileImageUrl(receiverProfileImageUrl) {
|
|
49993
|
-
state$5.receiverProfileImageUrl = receiverProfileImageUrl;
|
|
49994
|
-
},
|
|
49995
|
-
setReceiverProfileName(receiverProfileName) {
|
|
49996
|
-
state$5.receiverProfileName = receiverProfileName;
|
|
49997
|
-
},
|
|
49998
|
-
setGasPrice(gasPrice) {
|
|
49999
|
-
state$5.gasPrice = gasPrice;
|
|
50000
|
-
},
|
|
50001
|
-
setGasPriceInUsd(gasPriceInUSD) {
|
|
50002
|
-
state$5.gasPriceInUSD = gasPriceInUSD;
|
|
50003
|
-
},
|
|
50004
|
-
setNetworkBalanceInUsd(networkBalanceInUSD) {
|
|
50005
|
-
state$5.networkBalanceInUSD = networkBalanceInUSD;
|
|
50006
|
-
},
|
|
50007
|
-
setLoading(loading) {
|
|
50008
|
-
state$5.loading = loading;
|
|
50009
|
-
},
|
|
50010
|
-
sendToken() {
|
|
50011
|
-
var _a3;
|
|
50012
|
-
switch ((_a3 = ChainController.state.activeCaipNetwork) == null ? void 0 : _a3.chainNamespace) {
|
|
50013
|
-
case "eip155":
|
|
50014
|
-
this.sendEvmToken();
|
|
50015
|
-
return;
|
|
50016
|
-
case "solana":
|
|
50017
|
-
this.sendSolanaToken();
|
|
50018
|
-
return;
|
|
50019
|
-
default:
|
|
50020
|
-
throw new Error("Unsupported chain");
|
|
50021
|
-
}
|
|
50022
|
-
},
|
|
50023
|
-
sendEvmToken() {
|
|
50024
|
-
var _a3, _b2, _c2, _d, _e3;
|
|
50025
|
-
if (((_a3 = this.state.token) == null ? void 0 : _a3.address) && this.state.sendTokenAmount && this.state.receiverAddress) {
|
|
50026
|
-
EventsController.sendEvent({
|
|
50027
|
-
type: "track",
|
|
50028
|
-
event: "SEND_INITIATED",
|
|
50029
|
-
properties: {
|
|
50030
|
-
isSmartAccount: AccountController.state.preferredAccountType === W3mFrameRpcConstants.ACCOUNT_TYPES.SMART_ACCOUNT,
|
|
50031
|
-
token: this.state.token.address,
|
|
50032
|
-
amount: this.state.sendTokenAmount,
|
|
50033
|
-
network: ((_b2 = ChainController.state.activeCaipNetwork) == null ? void 0 : _b2.caipNetworkId) || ""
|
|
50034
|
-
}
|
|
50035
|
-
});
|
|
50036
|
-
this.sendERC20Token({
|
|
50037
|
-
receiverAddress: this.state.receiverAddress,
|
|
50038
|
-
tokenAddress: this.state.token.address,
|
|
50039
|
-
sendTokenAmount: this.state.sendTokenAmount,
|
|
50040
|
-
decimals: this.state.token.quantity.decimals
|
|
50041
|
-
});
|
|
50042
|
-
} else if (this.state.receiverAddress && this.state.sendTokenAmount && this.state.gasPrice && ((_c2 = this.state.token) == null ? void 0 : _c2.quantity.decimals)) {
|
|
50043
|
-
EventsController.sendEvent({
|
|
50044
|
-
type: "track",
|
|
50045
|
-
event: "SEND_INITIATED",
|
|
50046
|
-
properties: {
|
|
50047
|
-
isSmartAccount: AccountController.state.preferredAccountType === W3mFrameRpcConstants.ACCOUNT_TYPES.SMART_ACCOUNT,
|
|
50048
|
-
token: (_d = this.state.token) == null ? void 0 : _d.symbol,
|
|
50049
|
-
amount: this.state.sendTokenAmount,
|
|
50050
|
-
network: ((_e3 = ChainController.state.activeCaipNetwork) == null ? void 0 : _e3.caipNetworkId) || ""
|
|
50051
|
-
}
|
|
50052
|
-
});
|
|
50053
|
-
this.sendNativeToken({
|
|
50054
|
-
receiverAddress: this.state.receiverAddress,
|
|
50055
|
-
sendTokenAmount: this.state.sendTokenAmount,
|
|
50056
|
-
gasPrice: this.state.gasPrice,
|
|
50057
|
-
decimals: this.state.token.quantity.decimals
|
|
50058
|
-
});
|
|
50059
|
-
}
|
|
50060
|
-
},
|
|
50061
|
-
async fetchNetworkBalance() {
|
|
50062
|
-
const balances = await SwapApiUtil.getMyTokensWithBalance();
|
|
50063
|
-
if (!balances) {
|
|
50064
|
-
return;
|
|
50065
|
-
}
|
|
50066
|
-
const networkToken = balances.find((token) => token.address === ChainController.getActiveNetworkTokenAddress());
|
|
50067
|
-
if (!networkToken) {
|
|
50068
|
-
return;
|
|
50069
|
-
}
|
|
50070
|
-
state$5.networkBalanceInUSD = networkToken ? NumberUtil.multiply(networkToken.quantity.numeric, networkToken.price).toString() : "0";
|
|
50071
|
-
},
|
|
50072
|
-
isInsufficientNetworkTokenForGas(networkBalanceInUSD, gasPriceInUSD) {
|
|
50073
|
-
const gasPrice = gasPriceInUSD || "0";
|
|
50074
|
-
if (NumberUtil.bigNumber(networkBalanceInUSD).isZero()) {
|
|
50075
|
-
return true;
|
|
50076
|
-
}
|
|
50077
|
-
return NumberUtil.bigNumber(NumberUtil.bigNumber(gasPrice)).isGreaterThan(networkBalanceInUSD);
|
|
50078
|
-
},
|
|
50079
|
-
hasInsufficientGasFunds() {
|
|
50080
|
-
let insufficientNetworkTokenForGas = true;
|
|
50081
|
-
if (AccountController.state.preferredAccountType === W3mFrameRpcConstants.ACCOUNT_TYPES.SMART_ACCOUNT) {
|
|
50082
|
-
insufficientNetworkTokenForGas = false;
|
|
50083
|
-
} else if (state$5.networkBalanceInUSD) {
|
|
50084
|
-
insufficientNetworkTokenForGas = this.isInsufficientNetworkTokenForGas(state$5.networkBalanceInUSD, state$5.gasPriceInUSD);
|
|
50085
|
-
}
|
|
50086
|
-
return insufficientNetworkTokenForGas;
|
|
50087
|
-
},
|
|
50088
|
-
async sendNativeToken(params) {
|
|
50089
|
-
var _a3, _b2, _c2, _d;
|
|
50090
|
-
RouterController.pushTransactionStack({
|
|
50091
|
-
view: "Account",
|
|
50092
|
-
goBack: false
|
|
50093
|
-
});
|
|
50094
|
-
const to2 = params.receiverAddress;
|
|
50095
|
-
const address = AccountController.state.address;
|
|
50096
|
-
const value = ConnectionController.parseUnits(params.sendTokenAmount.toString(), Number(params.decimals));
|
|
50097
|
-
const data = "0x";
|
|
50098
|
-
try {
|
|
50099
|
-
await ConnectionController.sendTransaction({
|
|
50100
|
-
chainNamespace: "eip155",
|
|
50101
|
-
to: to2,
|
|
50102
|
-
address,
|
|
50103
|
-
data,
|
|
50104
|
-
value: value ?? BigInt(0),
|
|
50105
|
-
gasPrice: params.gasPrice
|
|
50106
|
-
});
|
|
50107
|
-
SnackController.showSuccess("Transaction started");
|
|
50108
|
-
EventsController.sendEvent({
|
|
50109
|
-
type: "track",
|
|
50110
|
-
event: "SEND_SUCCESS",
|
|
50111
|
-
properties: {
|
|
50112
|
-
isSmartAccount: AccountController.state.preferredAccountType === W3mFrameRpcConstants.ACCOUNT_TYPES.SMART_ACCOUNT,
|
|
50113
|
-
token: ((_a3 = this.state.token) == null ? void 0 : _a3.symbol) || "",
|
|
50114
|
-
amount: params.sendTokenAmount,
|
|
50115
|
-
network: ((_b2 = ChainController.state.activeCaipNetwork) == null ? void 0 : _b2.caipNetworkId) || ""
|
|
50116
|
-
}
|
|
50117
|
-
});
|
|
50118
|
-
this.resetSend();
|
|
50119
|
-
} catch (error) {
|
|
50120
|
-
EventsController.sendEvent({
|
|
50121
|
-
type: "track",
|
|
50122
|
-
event: "SEND_ERROR",
|
|
50123
|
-
properties: {
|
|
50124
|
-
isSmartAccount: AccountController.state.preferredAccountType === W3mFrameRpcConstants.ACCOUNT_TYPES.SMART_ACCOUNT,
|
|
50125
|
-
token: ((_c2 = this.state.token) == null ? void 0 : _c2.symbol) || "",
|
|
50126
|
-
amount: params.sendTokenAmount,
|
|
50127
|
-
network: ((_d = ChainController.state.activeCaipNetwork) == null ? void 0 : _d.caipNetworkId) || ""
|
|
50128
|
-
}
|
|
50129
|
-
});
|
|
50130
|
-
SnackController.showError("Something went wrong");
|
|
50131
|
-
}
|
|
50132
|
-
},
|
|
50133
|
-
async sendERC20Token(params) {
|
|
50134
|
-
RouterController.pushTransactionStack({
|
|
50135
|
-
view: "Account",
|
|
50136
|
-
goBack: false
|
|
50137
|
-
});
|
|
50138
|
-
const amount = ConnectionController.parseUnits(params.sendTokenAmount.toString(), Number(params.decimals));
|
|
50139
|
-
try {
|
|
50140
|
-
if (AccountController.state.address && params.sendTokenAmount && params.receiverAddress && params.tokenAddress) {
|
|
50141
|
-
const tokenAddress = CoreHelperUtil.getPlainAddress(params.tokenAddress);
|
|
50142
|
-
await ConnectionController.writeContract({
|
|
50143
|
-
fromAddress: AccountController.state.address,
|
|
50144
|
-
tokenAddress,
|
|
50145
|
-
args: [params.receiverAddress, amount ?? BigInt(0)],
|
|
50146
|
-
method: "transfer",
|
|
50147
|
-
abi: ContractUtil.getERC20Abi(tokenAddress),
|
|
50148
|
-
chainNamespace: "eip155"
|
|
50149
|
-
});
|
|
50150
|
-
SnackController.showSuccess("Transaction started");
|
|
50151
|
-
this.resetSend();
|
|
50152
|
-
}
|
|
50153
|
-
} catch (error) {
|
|
50154
|
-
SnackController.showError("Something went wrong");
|
|
50155
|
-
}
|
|
50156
|
-
},
|
|
50157
|
-
sendSolanaToken() {
|
|
50158
|
-
if (!this.state.sendTokenAmount || !this.state.receiverAddress) {
|
|
50159
|
-
SnackController.showError("Please enter a valid amount and receiver address");
|
|
50160
|
-
return;
|
|
50161
|
-
}
|
|
50162
|
-
RouterController.pushTransactionStack({
|
|
50163
|
-
view: "Account",
|
|
50164
|
-
goBack: false
|
|
50165
|
-
});
|
|
50166
|
-
ConnectionController.sendTransaction({
|
|
50167
|
-
chainNamespace: "solana",
|
|
50168
|
-
to: this.state.receiverAddress,
|
|
50169
|
-
value: this.state.sendTokenAmount
|
|
50170
|
-
}).then(() => {
|
|
50171
|
-
this.resetSend();
|
|
50172
|
-
AccountController.fetchTokenBalance();
|
|
50173
|
-
}).catch((error) => {
|
|
50174
|
-
SnackController.showError("Failed to send transaction. Please try again.");
|
|
50175
|
-
console.error("SendController:sendToken - failed to send solana transaction", error);
|
|
50176
|
-
});
|
|
50177
|
-
},
|
|
50178
|
-
resetSend() {
|
|
50179
|
-
state$5.token = void 0;
|
|
50180
|
-
state$5.sendTokenAmount = void 0;
|
|
50181
|
-
state$5.receiverAddress = void 0;
|
|
50182
|
-
state$5.receiverProfileImageUrl = void 0;
|
|
50183
|
-
state$5.receiverProfileName = void 0;
|
|
50184
|
-
state$5.loading = false;
|
|
50185
|
-
}
|
|
50186
|
-
};
|
|
50187
|
-
const state$4 = proxy({
|
|
50188
|
-
message: "",
|
|
50189
|
-
open: false,
|
|
50190
|
-
triggerRect: {
|
|
50191
|
-
width: 0,
|
|
50192
|
-
height: 0,
|
|
50193
|
-
top: 0,
|
|
50194
|
-
left: 0
|
|
50195
|
-
},
|
|
50196
|
-
variant: "shade"
|
|
50197
|
-
});
|
|
50198
|
-
const TooltipController = {
|
|
50199
|
-
state: state$4,
|
|
50200
|
-
subscribe(callback) {
|
|
50201
|
-
return subscribe(state$4, () => callback(state$4));
|
|
50202
|
-
},
|
|
50203
|
-
subscribeKey(key2, callback) {
|
|
50204
|
-
return subscribeKey(state$4, key2, callback);
|
|
50205
|
-
},
|
|
50206
|
-
showTooltip({ message, triggerRect, variant }) {
|
|
50207
|
-
state$4.open = true;
|
|
50208
|
-
state$4.message = message;
|
|
50209
|
-
state$4.triggerRect = triggerRect;
|
|
50210
|
-
state$4.variant = variant;
|
|
50211
|
-
},
|
|
50212
|
-
hide() {
|
|
50213
|
-
state$4.open = false;
|
|
50214
|
-
state$4.message = "";
|
|
50215
|
-
state$4.triggerRect = {
|
|
50216
|
-
width: 0,
|
|
50217
|
-
height: 0,
|
|
50218
|
-
top: 0,
|
|
50219
|
-
left: 0
|
|
50220
|
-
};
|
|
50221
|
-
}
|
|
50222
|
-
};
|
|
50223
49737
|
const SLIP44_MSB = 2147483648;
|
|
50224
49738
|
const EnsUtil = {
|
|
50225
49739
|
convertEVMChainIdToCoinType(chainId) {
|
|
@@ -56170,7 +55684,7 @@ async function call$2(client, args) {
|
|
|
56170
55684
|
return { data: response };
|
|
56171
55685
|
} catch (err) {
|
|
56172
55686
|
const data2 = getRevertErrorData$1(err);
|
|
56173
|
-
const { offchainLookup: offchainLookup2, offchainLookupSignature: offchainLookupSignature2 } = await import("./ccip-
|
|
55687
|
+
const { offchainLookup: offchainLookup2, offchainLookupSignature: offchainLookupSignature2 } = await import("./ccip-B6Wvu04X.js");
|
|
56174
55688
|
if (client.ccipRead !== false && (data2 == null ? void 0 : data2.slice(0, 10)) === offchainLookupSignature2 && to2)
|
|
56175
55689
|
return { data: await offchainLookup2(client, { data: data2, to: to2 }) };
|
|
56176
55690
|
if (deploylessCall && (data2 == null ? void 0 : data2.slice(0, 10)) === "0x101bb98d")
|
|
@@ -79605,34 +79119,34 @@ class AppKit extends AppKitCore {
|
|
|
79605
79119
|
{
|
|
79606
79120
|
const usingEmbeddedWallet = features.email || features.socials && features.socials.length;
|
|
79607
79121
|
if (usingEmbeddedWallet) {
|
|
79608
|
-
featureImportPromises.push(import("./embedded-wallet-
|
|
79122
|
+
featureImportPromises.push(import("./embedded-wallet-CWsQPgCa.js"));
|
|
79609
79123
|
}
|
|
79610
79124
|
if (features.email) {
|
|
79611
|
-
featureImportPromises.push(import("./email-
|
|
79125
|
+
featureImportPromises.push(import("./email-7OXbz6hc.js"));
|
|
79612
79126
|
}
|
|
79613
79127
|
if (features.socials) {
|
|
79614
|
-
featureImportPromises.push(import("./socials-
|
|
79128
|
+
featureImportPromises.push(import("./socials-BlllTdW5.js"));
|
|
79615
79129
|
}
|
|
79616
79130
|
if (features.swaps) {
|
|
79617
|
-
featureImportPromises.push(import("./swaps-
|
|
79131
|
+
featureImportPromises.push(import("./swaps-BodIZ5Dv.js"));
|
|
79618
79132
|
}
|
|
79619
79133
|
if (features.send) {
|
|
79620
|
-
featureImportPromises.push(import("./send-
|
|
79134
|
+
featureImportPromises.push(import("./send-C92cSKIt.js"));
|
|
79621
79135
|
}
|
|
79622
79136
|
if (features.receive) {
|
|
79623
|
-
featureImportPromises.push(import("./receive-
|
|
79137
|
+
featureImportPromises.push(import("./receive-C_E76vQZ.js"));
|
|
79624
79138
|
}
|
|
79625
79139
|
if (features.onramp) {
|
|
79626
|
-
featureImportPromises.push(import("./onramp-
|
|
79140
|
+
featureImportPromises.push(import("./onramp-DAOC8iXd.js"));
|
|
79627
79141
|
}
|
|
79628
79142
|
if (features.history) {
|
|
79629
|
-
featureImportPromises.push(import("./transactions-
|
|
79143
|
+
featureImportPromises.push(import("./transactions-DSiHT2Zb.js"));
|
|
79630
79144
|
}
|
|
79631
79145
|
}
|
|
79632
79146
|
await Promise.all([
|
|
79633
79147
|
...featureImportPromises,
|
|
79634
|
-
import("./index-
|
|
79635
|
-
import("./w3m-modal-
|
|
79148
|
+
import("./index-BduA1I0K.js"),
|
|
79149
|
+
import("./w3m-modal-Cuv0zBPp.js")
|
|
79636
79150
|
]);
|
|
79637
79151
|
const modal = document.createElement("w3m-modal");
|
|
79638
79152
|
if (!OptionsController.state.disableAppend && !OptionsController.state.enableEmbedded) {
|
|
@@ -79642,7 +79156,7 @@ class AppKit extends AppKitCore {
|
|
|
79642
79156
|
}
|
|
79643
79157
|
}
|
|
79644
79158
|
}
|
|
79645
|
-
const PACKAGE_VERSION = "1.6.6-basic-test.
|
|
79159
|
+
const PACKAGE_VERSION = "1.6.6-basic-test.4.0";
|
|
79646
79160
|
function createAppKit(options) {
|
|
79647
79161
|
return new AppKit({
|
|
79648
79162
|
...options,
|
|
@@ -96197,7 +95711,7 @@ function version4$1(parameters) {
|
|
|
96197
95711
|
async getProvider() {
|
|
96198
95712
|
if (!walletProvider) {
|
|
96199
95713
|
const CoinbaseWalletSDK = await (async () => {
|
|
96200
|
-
const { default: SDK } = await import("./index-
|
|
95714
|
+
const { default: SDK } = await import("./index-Df5vKTIW.js").then((n6) => n6.i);
|
|
96201
95715
|
if (typeof SDK !== "function" && typeof SDK.default === "function")
|
|
96202
95716
|
return SDK.default;
|
|
96203
95717
|
return SDK;
|
|
@@ -96376,7 +95890,7 @@ function version3$1(parameters) {
|
|
|
96376
95890
|
var _a3;
|
|
96377
95891
|
if (!walletProvider) {
|
|
96378
95892
|
const CoinbaseWalletSDK = await (async () => {
|
|
96379
|
-
const { default: SDK } = await import("./index-
|
|
95893
|
+
const { default: SDK } = await import("./index-BL61_ej1.js").then((n6) => n6.i);
|
|
96380
95894
|
if (typeof SDK !== "function" && typeof SDK.default === "function")
|
|
96381
95895
|
return SDK.default;
|
|
96382
95896
|
return SDK;
|
|
@@ -106449,7 +105963,7 @@ async function getWebSocketRpcClient(url, options = {}) {
|
|
|
106449
105963
|
const { keepAlive, reconnect: reconnect2 } = options;
|
|
106450
105964
|
return getSocketRpcClient({
|
|
106451
105965
|
async getSocket({ onClose, onError, onOpen, onResponse }) {
|
|
106452
|
-
const WebSocket2 = await import("./native-
|
|
105966
|
+
const WebSocket2 = await import("./native-Ds9cEPoS.js").then((module) => module.WebSocket);
|
|
106453
105967
|
const socket = new WebSocket2(url);
|
|
106454
105968
|
function onClose_() {
|
|
106455
105969
|
onClose();
|
|
@@ -112585,7 +112099,7 @@ function version4(parameters) {
|
|
|
112585
112099
|
async getProvider() {
|
|
112586
112100
|
if (!walletProvider) {
|
|
112587
112101
|
const CoinbaseWalletSDK = await (async () => {
|
|
112588
|
-
const { default: SDK } = await import("./index-
|
|
112102
|
+
const { default: SDK } = await import("./index-Df5vKTIW.js").then((n6) => n6.i);
|
|
112589
112103
|
if (typeof SDK !== "function" && typeof SDK.default === "function")
|
|
112590
112104
|
return SDK.default;
|
|
112591
112105
|
return SDK;
|
|
@@ -112764,7 +112278,7 @@ function version3(parameters) {
|
|
|
112764
112278
|
var _a3;
|
|
112765
112279
|
if (!walletProvider) {
|
|
112766
112280
|
const CoinbaseWalletSDK = await (async () => {
|
|
112767
|
-
const { default: SDK } = await import("./index-
|
|
112281
|
+
const { default: SDK } = await import("./index-BL61_ej1.js").then((n6) => n6.i);
|
|
112768
112282
|
if (typeof SDK !== "function" && typeof SDK.default === "function")
|
|
112769
112283
|
return SDK.default;
|
|
112770
112284
|
return SDK;
|
|
@@ -112970,7 +112484,7 @@ function metaMask(parameters = {}) {
|
|
|
112970
112484
|
async getProvider() {
|
|
112971
112485
|
async function initProvider() {
|
|
112972
112486
|
const MetaMaskSDK = await (async () => {
|
|
112973
|
-
const { default: SDK } = await import("./metamask-sdk-
|
|
112487
|
+
const { default: SDK } = await import("./metamask-sdk-3_VOmd7d.js").then((n6) => n6.m);
|
|
112974
112488
|
if (typeof SDK !== "function" && typeof SDK.default === "function")
|
|
112975
112489
|
return SDK.default;
|
|
112976
112490
|
return SDK;
|
|
@@ -113201,14 +112715,14 @@ function safe(parameters = {}) {
|
|
|
113201
112715
|
if (!isIframe)
|
|
113202
112716
|
return;
|
|
113203
112717
|
if (!provider_) {
|
|
113204
|
-
const { default: SDK } = await import("./index-
|
|
112718
|
+
const { default: SDK } = await import("./index-TZpNKUEf.js");
|
|
113205
112719
|
const sdk = new SDK(parameters);
|
|
113206
112720
|
const safe2 = await withTimeout(() => sdk.safe.getInfo(), {
|
|
113207
112721
|
timeout: parameters.unstable_getInfoTimeout ?? 10
|
|
113208
112722
|
});
|
|
113209
112723
|
if (!safe2)
|
|
113210
112724
|
throw new Error("Could not load Safe information");
|
|
113211
|
-
const { SafeAppProvider } = await import("./index-
|
|
112725
|
+
const { SafeAppProvider } = await import("./index-BTN5XFWn.js").then((n6) => n6.i);
|
|
113212
112726
|
provider_ = new SafeAppProvider(safe2, sdk);
|
|
113213
112727
|
}
|
|
113214
112728
|
return provider_;
|
|
@@ -113377,7 +112891,7 @@ function walletConnect(parameters) {
|
|
|
113377
112891
|
const optionalChains = config2.chains.map((x3) => x3.id);
|
|
113378
112892
|
if (!optionalChains.length)
|
|
113379
112893
|
return;
|
|
113380
|
-
const { EthereumProvider } = await import("./index.es-
|
|
112894
|
+
const { EthereumProvider } = await import("./index.es-DxdP-k4H.js");
|
|
113381
112895
|
return await EthereumProvider.init({
|
|
113382
112896
|
...parameters,
|
|
113383
112897
|
disableProviderPing: true,
|
|
@@ -113598,111 +113112,113 @@ if (typeof window !== "undefined") {
|
|
|
113598
113112
|
};
|
|
113599
113113
|
}
|
|
113600
113114
|
export {
|
|
113601
|
-
|
|
113115
|
+
sha_jsExports as $,
|
|
113602
113116
|
AccountController as A,
|
|
113603
113117
|
BlockchainApiController as B,
|
|
113604
113118
|
ConnectorController as C,
|
|
113605
113119
|
DateUtil as D,
|
|
113606
113120
|
EnsController as E,
|
|
113607
|
-
|
|
113608
|
-
|
|
113609
|
-
|
|
113610
|
-
|
|
113611
|
-
|
|
113612
|
-
|
|
113613
|
-
|
|
113121
|
+
colorStyles as F,
|
|
113122
|
+
b as G,
|
|
113123
|
+
WalletUtil as H,
|
|
113124
|
+
ConnectorUtil as I,
|
|
113125
|
+
ConstantsUtil$1 as J,
|
|
113126
|
+
SIWXUtil as K,
|
|
113127
|
+
ref$1 as L,
|
|
113614
113128
|
ModalController as M,
|
|
113615
113129
|
NumberUtil as N,
|
|
113616
113130
|
OptionsController as O,
|
|
113617
|
-
|
|
113618
|
-
|
|
113131
|
+
SwapApiUtil as P,
|
|
113132
|
+
E as Q,
|
|
113619
113133
|
RouterController as R,
|
|
113620
113134
|
SnackController as S,
|
|
113621
113135
|
ThemeController as T,
|
|
113622
|
-
|
|
113623
|
-
|
|
113136
|
+
AlertController as U,
|
|
113137
|
+
initializeTheming as V,
|
|
113624
113138
|
W3mFrameRpcConstants as W,
|
|
113625
|
-
|
|
113626
|
-
|
|
113627
|
-
|
|
113628
|
-
|
|
113139
|
+
u$1 as X,
|
|
113140
|
+
f$2 as Y,
|
|
113141
|
+
T as Z,
|
|
113142
|
+
Buffer$7 as _,
|
|
113629
113143
|
ConstantsUtil$2 as a,
|
|
113630
|
-
|
|
113631
|
-
|
|
113632
|
-
|
|
113633
|
-
|
|
113634
|
-
|
|
113635
|
-
|
|
113636
|
-
|
|
113637
|
-
|
|
113638
|
-
|
|
113639
|
-
|
|
113640
|
-
|
|
113641
|
-
|
|
113642
|
-
|
|
113643
|
-
|
|
113644
|
-
|
|
113645
|
-
|
|
113646
|
-
|
|
113647
|
-
|
|
113648
|
-
|
|
113649
|
-
|
|
113650
|
-
|
|
113651
|
-
|
|
113652
|
-
|
|
113653
|
-
|
|
113654
|
-
|
|
113655
|
-
|
|
113656
|
-
|
|
113657
|
-
|
|
113658
|
-
|
|
113659
|
-
|
|
113660
|
-
|
|
113661
|
-
|
|
113662
|
-
|
|
113663
|
-
|
|
113664
|
-
|
|
113665
|
-
|
|
113666
|
-
|
|
113667
|
-
|
|
113668
|
-
|
|
113669
|
-
|
|
113670
|
-
|
|
113671
|
-
|
|
113672
|
-
|
|
113673
|
-
|
|
113674
|
-
|
|
113675
|
-
|
|
113676
|
-
|
|
113677
|
-
|
|
113678
|
-
|
|
113679
|
-
|
|
113680
|
-
|
|
113681
|
-
|
|
113682
|
-
|
|
113683
|
-
|
|
113684
|
-
|
|
113685
|
-
|
|
113686
|
-
|
|
113687
|
-
|
|
113688
|
-
|
|
113689
|
-
|
|
113690
|
-
|
|
113691
|
-
|
|
113692
|
-
|
|
113693
|
-
|
|
113144
|
+
stringify$2 as a$,
|
|
113145
|
+
commonjsGlobal as a0,
|
|
113146
|
+
eventemitter3Exports as a1,
|
|
113147
|
+
getDefaultExportFromCjs$2 as a2,
|
|
113148
|
+
bnExports$1 as a3,
|
|
113149
|
+
events as a4,
|
|
113150
|
+
getAugmentedNamespace as a5,
|
|
113151
|
+
process$1 as a6,
|
|
113152
|
+
readableBrowserExports as a7,
|
|
113153
|
+
BaseError$3 as a8,
|
|
113154
|
+
keccak256$1 as a9,
|
|
113155
|
+
IEvents as aA,
|
|
113156
|
+
isWsUrl as aB,
|
|
113157
|
+
cjs as aC,
|
|
113158
|
+
isLocalhostUrl as aD,
|
|
113159
|
+
formatJsonRpcError as aE,
|
|
113160
|
+
parseConnectionError as aF,
|
|
113161
|
+
bs$1 as aG,
|
|
113162
|
+
E$3 as aH,
|
|
113163
|
+
y$4 as aI,
|
|
113164
|
+
k$3 as aJ,
|
|
113165
|
+
A$2 as aK,
|
|
113166
|
+
i$7 as aL,
|
|
113167
|
+
h$5 as aM,
|
|
113168
|
+
getBigIntRpcId as aN,
|
|
113169
|
+
Mg as aO,
|
|
113170
|
+
o$4 as aP,
|
|
113171
|
+
isJsonRpcRequest as aQ,
|
|
113172
|
+
isJsonRpcResponse as aR,
|
|
113173
|
+
formatJsonRpcResult as aS,
|
|
113174
|
+
Jg as aT,
|
|
113175
|
+
isJsonRpcResult as aU,
|
|
113176
|
+
isJsonRpcError as aV,
|
|
113177
|
+
formatJsonRpcRequest as aW,
|
|
113178
|
+
r$6 as aX,
|
|
113179
|
+
payloadId as aY,
|
|
113180
|
+
f$5 as aZ,
|
|
113181
|
+
getUrl$1 as a_,
|
|
113182
|
+
concat$1 as aa,
|
|
113183
|
+
encodeAbiParameters$1 as ab,
|
|
113184
|
+
toHex$1 as ac,
|
|
113185
|
+
numberToHex$1 as ad,
|
|
113186
|
+
isAddress$1 as ae,
|
|
113187
|
+
InvalidAddressError$1 as af,
|
|
113188
|
+
size$5 as ag,
|
|
113189
|
+
BytesSizeMismatchError$1 as ah,
|
|
113190
|
+
stringToHex$1 as ai,
|
|
113191
|
+
bytesToHex$3 as aj,
|
|
113192
|
+
encodeFunctionData$1 as ak,
|
|
113193
|
+
requireCryptoBrowserify as al,
|
|
113194
|
+
fromString as am,
|
|
113195
|
+
toString as an,
|
|
113196
|
+
concat$2 as ao,
|
|
113197
|
+
safeJsonParse as ap,
|
|
113198
|
+
safeJsonStringify as aq,
|
|
113199
|
+
cjs$3 as ar,
|
|
113200
|
+
global$1 as as,
|
|
113201
|
+
getWindowMetadata_1 as at,
|
|
113202
|
+
getDocument_1 as au,
|
|
113203
|
+
getNavigator_1 as av,
|
|
113204
|
+
detect as aw,
|
|
113205
|
+
getLocation_1 as ax,
|
|
113206
|
+
ellipticExports as ay,
|
|
113207
|
+
C$3 as az,
|
|
113694
113208
|
resetStyles as b,
|
|
113695
|
-
|
|
113696
|
-
|
|
113697
|
-
|
|
113698
|
-
|
|
113699
|
-
|
|
113700
|
-
|
|
113701
|
-
|
|
113702
|
-
|
|
113703
|
-
|
|
113704
|
-
|
|
113705
|
-
index$
|
|
113209
|
+
decodeErrorResult$1 as b0,
|
|
113210
|
+
isAddressEqual$1 as b1,
|
|
113211
|
+
call$2 as b2,
|
|
113212
|
+
HttpRequestError$1 as b3,
|
|
113213
|
+
isHex$1 as b4,
|
|
113214
|
+
snapshot$1 as b5,
|
|
113215
|
+
createAppKit as b6,
|
|
113216
|
+
networks as b7,
|
|
113217
|
+
WagmiAdapter as b8,
|
|
113218
|
+
SolanaAdapter as b9,
|
|
113219
|
+
index$3 as ba,
|
|
113220
|
+
index as bb,
|
|
113221
|
+
index$1 as bc,
|
|
113706
113222
|
ConstantsUtil$3 as c,
|
|
113707
113223
|
CoreHelperUtil as d,
|
|
113708
113224
|
EventsController as e,
|
|
@@ -113716,16 +113232,16 @@ export {
|
|
|
113716
113232
|
ConstantsUtil as m,
|
|
113717
113233
|
StorageUtil as n,
|
|
113718
113234
|
SwapController as o,
|
|
113719
|
-
|
|
113720
|
-
|
|
113235
|
+
AssetUtil as p,
|
|
113236
|
+
proxy as q,
|
|
113721
113237
|
r,
|
|
113722
|
-
|
|
113723
|
-
|
|
113724
|
-
|
|
113725
|
-
|
|
113726
|
-
|
|
113238
|
+
subscribe as s,
|
|
113239
|
+
subscribeKey as t,
|
|
113240
|
+
ApiController as u,
|
|
113241
|
+
ONRAMP_PROVIDERS as v,
|
|
113242
|
+
MELD_PROD_PUBLIC_KEY as w,
|
|
113727
113243
|
x,
|
|
113728
|
-
|
|
113729
|
-
|
|
113244
|
+
TransactionsController as y,
|
|
113245
|
+
AssetController as z
|
|
113730
113246
|
};
|
|
113731
|
-
//# sourceMappingURL=appkit-
|
|
113247
|
+
//# sourceMappingURL=appkit-hZyGLfr5.js.map
|