@imtbl/sdk 0.0.1-alpha.2 → 0.0.1-alpha.3
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/base.d.ts +14 -119
- package/dist/base.js +8 -20
- package/dist/browser/checkout.js +2 -2
- package/dist/checkout_sdk.d.ts +53 -2
- package/dist/checkout_sdk.js +178 -93
- package/dist/checkout_widgets.d.ts +10 -5
- package/dist/checkout_widgets.js +29 -11
- package/dist/index.cjs +384 -248
- package/dist/index.d.ts +2089 -822
- package/dist/index.js +384 -248
- package/dist/passport.d.ts +40 -14
- package/dist/passport.js +96 -92
- package/dist/provider.d.ts +36 -20
- package/dist/provider.js +66 -55
- package/dist/starkex.d.ts +2015 -824
- package/dist/starkex.js +52 -4
- package/package.json +22 -4
package/dist/index.cjs
CHANGED
|
@@ -33,31 +33,63 @@ var encUtils__namespace = /*#__PURE__*/_interopNamespaceDefault(encUtils);
|
|
|
33
33
|
|
|
34
34
|
exports.Environment = void 0;
|
|
35
35
|
(function (Environment) {
|
|
36
|
-
Environment["DEVELOPMENT"] = "development";
|
|
37
|
-
Environment["SANDBOX"] = "sandbox";
|
|
38
36
|
Environment["PRODUCTION"] = "production";
|
|
37
|
+
Environment["SANDBOX"] = "sandbox";
|
|
39
38
|
})(exports.Environment || (exports.Environment = {}));
|
|
40
|
-
class
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
39
|
+
class ImmutableConfiguration {
|
|
40
|
+
environment;
|
|
41
|
+
apiKey;
|
|
42
|
+
constructor(options) {
|
|
43
|
+
this.environment = options.environment;
|
|
44
|
+
this.apiKey = options.apiKey;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Set `sdkVersion` on config
|
|
49
|
+
const PRODUCTION = () => {
|
|
50
|
+
return coreSdk.Config.createConfig({
|
|
51
|
+
basePath: 'https://api.x.immutable.com',
|
|
52
|
+
chainID: 1,
|
|
53
|
+
coreContractAddress: '0x5FDCCA53617f4d2b9134B29090C87D01058e27e9',
|
|
54
|
+
registrationContractAddress: '0x72a06bf2a1CE5e39cBA06c0CAb824960B587d64c',
|
|
55
|
+
sdkVersion: 'ts-immutable-sdk-__SDK_VERSION__',
|
|
56
|
+
});
|
|
52
57
|
};
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
58
|
+
// Set `sdkVersion` on config
|
|
59
|
+
const SANDBOX = () => {
|
|
60
|
+
return coreSdk.Config.createConfig({
|
|
61
|
+
basePath: 'https://api.sandbox.x.immutable.com',
|
|
62
|
+
chainID: 5,
|
|
63
|
+
coreContractAddress: '0x7917eDb51ecD6CdB3F9854c3cc593F33de10c623',
|
|
64
|
+
registrationContractAddress: '0x1C97Ada273C9A52253f463042f29117090Cd7D83',
|
|
65
|
+
sdkVersion: 'ts-immutable-sdk-__SDK_VERSION__',
|
|
66
|
+
});
|
|
56
67
|
};
|
|
68
|
+
class StarkExConfiguration {
|
|
69
|
+
immutableXConfig;
|
|
70
|
+
baseConfig;
|
|
71
|
+
constructor({ baseConfig, overrides }) {
|
|
72
|
+
this.baseConfig = baseConfig;
|
|
73
|
+
if (overrides) {
|
|
74
|
+
this.immutableXConfig = overrides.immutableXConfig;
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
switch (baseConfig.environment) {
|
|
78
|
+
case exports.Environment.SANDBOX: {
|
|
79
|
+
this.immutableXConfig = SANDBOX();
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
case exports.Environment.PRODUCTION: {
|
|
83
|
+
this.immutableXConfig = PRODUCTION();
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
57
90
|
|
|
58
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
59
91
|
const StarkExAPIFactory = (config) => {
|
|
60
|
-
const imtblClient = new coreSdk.ImmutableX(config.
|
|
92
|
+
const imtblClient = new coreSdk.ImmutableX(config.immutableXConfig);
|
|
61
93
|
const { deposit, registerOffchain, isRegisteredOnchain, prepareWithdrawal, completeWithdrawal, createOrder, cancelOrder, createTrade, transfer, batchNftTransfer, ...StarkEx } = imtblClient;
|
|
62
94
|
return { ...StarkEx };
|
|
63
95
|
};
|
|
@@ -142,9 +174,9 @@ async function validateChain(signer, config) {
|
|
|
142
174
|
}
|
|
143
175
|
|
|
144
176
|
async function transfer$1({ signers: { ethSigner, starkExSigner }, request, config, }) {
|
|
145
|
-
await validateChain(ethSigner, config.
|
|
177
|
+
await validateChain(ethSigner, config.immutableXConfig);
|
|
146
178
|
const ethAddress = await ethSigner.getAddress();
|
|
147
|
-
const transfersApi = new coreSdk.TransfersApi(config.
|
|
179
|
+
const transfersApi = new coreSdk.TransfersApi(config.immutableXConfig.apiConfiguration);
|
|
148
180
|
const transferAmount = request.type === 'ERC721' ? '1' : request.amount;
|
|
149
181
|
const signableResult = await transfersApi.getSignableTransferV1({
|
|
150
182
|
getSignableTransferRequest: {
|
|
@@ -182,9 +214,9 @@ async function transfer$1({ signers: { ethSigner, starkExSigner }, request, conf
|
|
|
182
214
|
};
|
|
183
215
|
}
|
|
184
216
|
async function batchTransfer({ signers: { ethSigner, starkExSigner }, request, config, }) {
|
|
185
|
-
await validateChain(ethSigner, config.
|
|
217
|
+
await validateChain(ethSigner, config.immutableXConfig);
|
|
186
218
|
const ethAddress = await ethSigner.getAddress();
|
|
187
|
-
const transfersApi = new coreSdk.TransfersApi(config.
|
|
219
|
+
const transfersApi = new coreSdk.TransfersApi(config.immutableXConfig.apiConfiguration);
|
|
188
220
|
const signableRequests = request.map((nftTransfer) => {
|
|
189
221
|
return {
|
|
190
222
|
amount: '1',
|
|
@@ -238,9 +270,9 @@ async function batchTransfer({ signers: { ethSigner, starkExSigner }, request, c
|
|
|
238
270
|
}
|
|
239
271
|
|
|
240
272
|
async function createOrder$1({ signers, request, config, }) {
|
|
241
|
-
await validateChain(signers.ethSigner, config.
|
|
273
|
+
await validateChain(signers.ethSigner, config.immutableXConfig);
|
|
242
274
|
const ethAddress = await signers.ethSigner.getAddress();
|
|
243
|
-
const ordersApi = new coreSdk.OrdersApi(config.
|
|
275
|
+
const ordersApi = new coreSdk.OrdersApi(config.immutableXConfig.apiConfiguration);
|
|
244
276
|
const amountSell = request.sell.type === 'ERC721' ? '1' : request.sell.amount;
|
|
245
277
|
const amountBuy = request.buy.type === 'ERC721' ? '1' : request.buy.amount;
|
|
246
278
|
const getSignableOrderRequest = {
|
|
@@ -283,7 +315,7 @@ async function createOrder$1({ signers, request, config, }) {
|
|
|
283
315
|
};
|
|
284
316
|
}
|
|
285
317
|
async function cancelOrder$1({ signers, request, config, }) {
|
|
286
|
-
const ordersApi = new coreSdk.OrdersApi(config.
|
|
318
|
+
const ordersApi = new coreSdk.OrdersApi(config.immutableXConfig.apiConfiguration);
|
|
287
319
|
const getSignableCancelOrderResponse = await ordersApi.getSignableCancelOrder({
|
|
288
320
|
getSignableCancelOrderRequest: {
|
|
289
321
|
order_id: request.order_id,
|
|
@@ -309,8 +341,8 @@ async function cancelOrder$1({ signers, request, config, }) {
|
|
|
309
341
|
}
|
|
310
342
|
|
|
311
343
|
async function registerOffchain(signers, config) {
|
|
312
|
-
await validateChain(signers.ethSigner, config.
|
|
313
|
-
const usersApi = new coreSdk.UsersApi(config.
|
|
344
|
+
await validateChain(signers.ethSigner, config.immutableXConfig);
|
|
345
|
+
const usersApi = new coreSdk.UsersApi(config.immutableXConfig.apiConfiguration);
|
|
314
346
|
const userAddress = await signers.ethSigner.getAddress();
|
|
315
347
|
const starkPublicKey = await signers.starkExSigner.getAddress();
|
|
316
348
|
const signableResult = await usersApi.getSignableRegistrationOffchain({
|
|
@@ -333,8 +365,8 @@ async function registerOffchain(signers, config) {
|
|
|
333
365
|
return registeredUser.data;
|
|
334
366
|
}
|
|
335
367
|
async function isRegisteredOnChain(starkPublicKey, ethSigner, config) {
|
|
336
|
-
await validateChain(ethSigner, config.
|
|
337
|
-
const registrationContract = coreSdk.Contracts.Registration.connect(config.
|
|
368
|
+
await validateChain(ethSigner, config.immutableXConfig);
|
|
369
|
+
const registrationContract = coreSdk.Contracts.Registration.connect(config.immutableXConfig.ethConfiguration.registrationContractAddress, ethSigner);
|
|
338
370
|
try {
|
|
339
371
|
return await registrationContract.isRegistered(starkPublicKey);
|
|
340
372
|
}
|
|
@@ -409,10 +441,10 @@ async function getEncodeAssetInfo(assetType, tokenType, config, tokenData) {
|
|
|
409
441
|
|
|
410
442
|
async function executeRegisterAndWithdrawERC20({ ethSigner, assetType, starkPublicKey, config, }) {
|
|
411
443
|
const etherKey = await ethSigner.getAddress();
|
|
412
|
-
const starkExConfig = config.
|
|
444
|
+
const starkExConfig = config.immutableXConfig;
|
|
413
445
|
const usersApi = new coreSdk.UsersApi(starkExConfig.apiConfiguration);
|
|
414
446
|
const signableResult = await getSignableRegistrationOnchain(etherKey, starkPublicKey, usersApi);
|
|
415
|
-
const contract = coreSdk.Contracts.Registration.connect(config.
|
|
447
|
+
const contract = coreSdk.Contracts.Registration.connect(config.immutableXConfig.ethConfiguration.registrationContractAddress, ethSigner);
|
|
416
448
|
const populatedTransaction = await contract.populateTransaction.registerAndWithdraw(etherKey, starkPublicKey, signableResult.operator_signature, assetType);
|
|
417
449
|
return ethSigner.sendTransaction(populatedTransaction);
|
|
418
450
|
}
|
|
@@ -422,8 +454,8 @@ async function executeWithdrawERC20(ethSigner, assetType, starkPublicKey, config
|
|
|
422
454
|
return ethSigner.sendTransaction(populatedTransaction);
|
|
423
455
|
}
|
|
424
456
|
async function completeERC20WithdrawalAction({ ethSigner, starkPublicKey, token, config, }) {
|
|
425
|
-
await validateChain(ethSigner, config.
|
|
426
|
-
const starkExConfig = config.
|
|
457
|
+
await validateChain(ethSigner, config.immutableXConfig);
|
|
458
|
+
const starkExConfig = config.immutableXConfig;
|
|
427
459
|
const assetType = await getEncodeAssetInfo('asset', 'ERC20', starkExConfig, {
|
|
428
460
|
token_address: token.tokenAddress,
|
|
429
461
|
});
|
|
@@ -460,7 +492,7 @@ function getMintingBlob(token) {
|
|
|
460
492
|
return encUtils__namespace.sanitizeHex(encUtils__namespace.utf8ToHex(`{${id}}:{${blueprint}}`));
|
|
461
493
|
}
|
|
462
494
|
async function completeMintableERC721Withdrawal(ethSigner, starkPublicKey, token, config) {
|
|
463
|
-
const starkExConfig = config.
|
|
495
|
+
const starkExConfig = config.immutableXConfig;
|
|
464
496
|
const assetType = await getEncodeAssetInfo('mintable-asset', 'ERC721', starkExConfig, {
|
|
465
497
|
id: token.data.id,
|
|
466
498
|
token_address: token.data.tokenAddress,
|
|
@@ -489,7 +521,7 @@ async function executeWithdrawERC721(ethSigner, assetType, starkPublicKey, token
|
|
|
489
521
|
return ethSigner.sendTransaction(populatedTransaction);
|
|
490
522
|
}
|
|
491
523
|
async function completeERC721Withdrawal(ethSigner, starkPublicKey, token, config) {
|
|
492
|
-
const starkExConfig = config.
|
|
524
|
+
const starkExConfig = config.immutableXConfig;
|
|
493
525
|
const assetType = await getEncodeAssetInfo('asset', 'ERC721', starkExConfig, {
|
|
494
526
|
token_id: token.tokenId,
|
|
495
527
|
token_address: token.tokenAddress,
|
|
@@ -503,10 +535,10 @@ async function completeERC721Withdrawal(ethSigner, starkPublicKey, token, config
|
|
|
503
535
|
}
|
|
504
536
|
}
|
|
505
537
|
async function completeERC721WithdrawalAction({ ethSigner, starkPublicKey, token, config, }) {
|
|
506
|
-
await validateChain(ethSigner, config.
|
|
538
|
+
await validateChain(ethSigner, config.immutableXConfig);
|
|
507
539
|
const tokenAddress = token.tokenAddress;
|
|
508
540
|
const tokenId = token.tokenId;
|
|
509
|
-
const starkExConfig = config.
|
|
541
|
+
const starkExConfig = config.immutableXConfig;
|
|
510
542
|
const mintsApi = new coreSdk.MintsApi(starkExConfig.apiConfiguration);
|
|
511
543
|
return await mintsApi
|
|
512
544
|
.getMintableTokenDetailsByClientTokenId({
|
|
@@ -544,8 +576,8 @@ async function executeWithdrawEth(ethSigner, assetType, starkPublicKey, config)
|
|
|
544
576
|
return ethSigner.sendTransaction(populatedTransaction);
|
|
545
577
|
}
|
|
546
578
|
async function completeEthWithdrawalAction({ ethSigner, starkPublicKey, config, }) {
|
|
547
|
-
await validateChain(ethSigner, config.
|
|
548
|
-
const starkExConfig = config.
|
|
579
|
+
await validateChain(ethSigner, config.immutableXConfig);
|
|
580
|
+
const starkExConfig = config.immutableXConfig;
|
|
549
581
|
const assetType = await getEncodeAssetInfo('asset', 'ETH', starkExConfig);
|
|
550
582
|
const isRegistered = await isRegisteredOnChain(starkPublicKey, ethSigner, config);
|
|
551
583
|
if (!isRegistered) {
|
|
@@ -557,10 +589,9 @@ async function completeEthWithdrawalAction({ ethSigner, starkPublicKey, config,
|
|
|
557
589
|
}
|
|
558
590
|
|
|
559
591
|
async function prepareWithdrawal({ signers, withdrawal, config, }) {
|
|
560
|
-
const starkExConfig = config.getStarkExConfig();
|
|
561
592
|
return prepareWithdrawalAction({
|
|
562
593
|
signers,
|
|
563
|
-
config:
|
|
594
|
+
config: config.immutableXConfig,
|
|
564
595
|
...withdrawal,
|
|
565
596
|
});
|
|
566
597
|
}
|
|
@@ -586,9 +617,9 @@ async function completeWithdrawal({ signers: { ethSigner }, starkPublicKey, toke
|
|
|
586
617
|
}
|
|
587
618
|
|
|
588
619
|
async function createTrade$1({ signers: { ethSigner, starkExSigner }, request, config, }) {
|
|
589
|
-
await validateChain(ethSigner, config.
|
|
620
|
+
await validateChain(ethSigner, config.immutableXConfig);
|
|
590
621
|
const ethAddress = await ethSigner.getAddress();
|
|
591
|
-
const tradesApi = new coreSdk.TradesApi(config.
|
|
622
|
+
const tradesApi = new coreSdk.TradesApi(config.immutableXConfig.apiConfiguration);
|
|
592
623
|
const signableResult = await tradesApi.getSignableTrade({
|
|
593
624
|
getSignableTradeRequest: {
|
|
594
625
|
user: ethAddress,
|
|
@@ -623,13 +654,13 @@ async function createTrade$1({ signers: { ethSigner, starkExSigner }, request, c
|
|
|
623
654
|
}
|
|
624
655
|
|
|
625
656
|
async function depositEth({ signers: { ethSigner }, deposit, config, }) {
|
|
626
|
-
await validateChain(ethSigner, config.
|
|
657
|
+
await validateChain(ethSigner, config.immutableXConfig);
|
|
627
658
|
const user = await ethSigner.getAddress();
|
|
628
659
|
const data = {
|
|
629
660
|
decimals: 18,
|
|
630
661
|
};
|
|
631
662
|
const amount = units.parseUnits(deposit.amount, 'wei');
|
|
632
|
-
const starkExConfig = config.
|
|
663
|
+
const starkExConfig = config.immutableXConfig;
|
|
633
664
|
const depositsApi = new coreSdk.DepositsApi(starkExConfig.apiConfiguration);
|
|
634
665
|
const encodingApi = new coreSdk.EncodingApi(starkExConfig.apiConfiguration);
|
|
635
666
|
const usersApi = new coreSdk.UsersApi(starkExConfig.apiConfiguration);
|
|
@@ -677,8 +708,8 @@ async function executeDepositEth(ethSigner, amount, assetType, starkPublicKey, v
|
|
|
677
708
|
}
|
|
678
709
|
|
|
679
710
|
async function depositERC20({ signers: { ethSigner }, deposit, config, }) {
|
|
680
|
-
await validateChain(ethSigner, config.
|
|
681
|
-
const { apiConfiguration, ethConfiguration } = config.
|
|
711
|
+
await validateChain(ethSigner, config.immutableXConfig);
|
|
712
|
+
const { apiConfiguration, ethConfiguration } = config.immutableXConfig;
|
|
682
713
|
const user = await ethSigner.getAddress();
|
|
683
714
|
const tokensApi = new coreSdk.TokensApi(apiConfiguration);
|
|
684
715
|
const depositsApi = new coreSdk.DepositsApi(apiConfiguration);
|
|
@@ -745,12 +776,12 @@ async function executeRegisterAndDepositERC20(ethSigner, quantizedAmount, assetT
|
|
|
745
776
|
}
|
|
746
777
|
|
|
747
778
|
async function depositERC721({ signers: { ethSigner }, deposit, config, }) {
|
|
748
|
-
await validateChain(ethSigner, config.
|
|
779
|
+
await validateChain(ethSigner, config.immutableXConfig);
|
|
749
780
|
const user = await ethSigner.getAddress();
|
|
750
|
-
const
|
|
751
|
-
const depositsApi = new coreSdk.DepositsApi(
|
|
752
|
-
const encodingApi = new coreSdk.EncodingApi(
|
|
753
|
-
const usersApi = new coreSdk.UsersApi(
|
|
781
|
+
const { immutableXConfig } = config;
|
|
782
|
+
const depositsApi = new coreSdk.DepositsApi(immutableXConfig.apiConfiguration);
|
|
783
|
+
const encodingApi = new coreSdk.EncodingApi(immutableXConfig.apiConfiguration);
|
|
784
|
+
const usersApi = new coreSdk.UsersApi(immutableXConfig.apiConfiguration);
|
|
754
785
|
const data = {
|
|
755
786
|
token_address: deposit.tokenAddress,
|
|
756
787
|
token_id: deposit.tokenId,
|
|
@@ -786,18 +817,18 @@ async function depositERC721({ signers: { ethSigner }, deposit, config, }) {
|
|
|
786
817
|
const isRegistered = await isRegisteredOnChain(starkPublicKey, ethSigner, config);
|
|
787
818
|
// Approve whether an amount of token from an account can be spent by a third-party account
|
|
788
819
|
const tokenContract = coreSdk.Contracts.IERC721.connect(deposit.tokenAddress, ethSigner);
|
|
789
|
-
const operator =
|
|
820
|
+
const operator = immutableXConfig.ethConfiguration.coreContractAddress;
|
|
790
821
|
const isApprovedForAll = await tokenContract.isApprovedForAll(user, operator);
|
|
791
822
|
if (!isApprovedForAll) {
|
|
792
823
|
await tokenContract.setApprovalForAll(operator, true);
|
|
793
824
|
}
|
|
794
825
|
if (!isRegistered) {
|
|
795
826
|
const signableResult = await getSignableRegistrationOnchain(user, starkPublicKey, usersApi);
|
|
796
|
-
const coreContract = coreSdk.Contracts.Core.connect(
|
|
827
|
+
const coreContract = coreSdk.Contracts.Core.connect(immutableXConfig.ethConfiguration.coreContractAddress, ethSigner);
|
|
797
828
|
// Note: proxy registration contract registerAndDepositNft method is not used as it currently fails erc721 transfer ownership check
|
|
798
829
|
await coreContract.registerUser(user, starkPublicKey, signableResult.operator_signature);
|
|
799
830
|
}
|
|
800
|
-
return executeDepositERC721(ethSigner, deposit.tokenId, assetType, starkPublicKey, vaultId,
|
|
831
|
+
return executeDepositERC721(ethSigner, deposit.tokenId, assetType, starkPublicKey, vaultId, immutableXConfig);
|
|
801
832
|
}
|
|
802
833
|
async function executeDepositERC721(ethSigner, tokenId, assetType, starkPublicKey, vaultId, config) {
|
|
803
834
|
const coreContract = coreSdk.Contracts.Core.connect(config.ethConfiguration.coreContractAddress, ethSigner);
|
|
@@ -817,8 +848,8 @@ async function deposit({ signers, deposit, config }) {
|
|
|
817
848
|
}
|
|
818
849
|
|
|
819
850
|
async function exchangeTransfer$1({ signers, request, config, }) {
|
|
820
|
-
await validateChain(signers.ethSigner, config.
|
|
821
|
-
const exchangeApi = new coreSdk.ExchangesApi(config.
|
|
851
|
+
await validateChain(signers.ethSigner, config.immutableXConfig);
|
|
852
|
+
const exchangeApi = new coreSdk.ExchangesApi(config.immutableXConfig.apiConfiguration);
|
|
822
853
|
const ethAddress = await signers.ethSigner.getAddress();
|
|
823
854
|
const transferAmount = request.amount;
|
|
824
855
|
const signableResult = await exchangeApi.getExchangeSignableTransfer({
|
|
@@ -1041,7 +1072,6 @@ class ImxSigner {
|
|
|
1041
1072
|
|
|
1042
1073
|
const IMX_WALLET_IFRAME_ID = 'imx-wallet-app';
|
|
1043
1074
|
const IMX_WALLET_IFRAME_HOSTS = {
|
|
1044
|
-
[exports.Environment.DEVELOPMENT]: 'http://localhost:8080',
|
|
1045
1075
|
[exports.Environment.SANDBOX]: 'https://wallets.sandbox.immutable.com',
|
|
1046
1076
|
[exports.Environment.PRODUCTION]: 'https://wallets.immutable.com',
|
|
1047
1077
|
};
|
|
@@ -1139,12 +1169,11 @@ class MetaMaskIMXProvider extends GenericIMXProvider {
|
|
|
1139
1169
|
super(config, ethSigner, starkExSigner);
|
|
1140
1170
|
}
|
|
1141
1171
|
static async connect(config) {
|
|
1142
|
-
const starkExConfig = config.getStarkExConfig();
|
|
1143
1172
|
return await withProviderError(async () => {
|
|
1144
1173
|
const metaMaskProvider = await connect$1({
|
|
1145
|
-
chainID:
|
|
1174
|
+
chainID: config.immutableXConfig.ethConfiguration.chainID,
|
|
1146
1175
|
});
|
|
1147
|
-
this.imxSigner = await connect(metaMaskProvider,
|
|
1176
|
+
this.imxSigner = await connect(metaMaskProvider, config.baseConfig.environment);
|
|
1148
1177
|
return new MetaMaskIMXProvider(config, metaMaskProvider.getSigner(), this.imxSigner);
|
|
1149
1178
|
}, { type: ProviderErrorType.WALLET_CONNECTION_ERROR });
|
|
1150
1179
|
}
|
|
@@ -1166,6 +1195,29 @@ class MetaMaskIMXProvider extends GenericIMXProvider {
|
|
|
1166
1195
|
}
|
|
1167
1196
|
}
|
|
1168
1197
|
|
|
1198
|
+
class ProviderConfiguration {
|
|
1199
|
+
immutableXConfig;
|
|
1200
|
+
baseConfig;
|
|
1201
|
+
constructor({ baseConfig, overrides }) {
|
|
1202
|
+
this.baseConfig = baseConfig;
|
|
1203
|
+
if (overrides) {
|
|
1204
|
+
this.immutableXConfig = overrides.immutableXConfig;
|
|
1205
|
+
}
|
|
1206
|
+
else {
|
|
1207
|
+
switch (baseConfig.environment) {
|
|
1208
|
+
case exports.Environment.SANDBOX: {
|
|
1209
|
+
this.immutableXConfig = coreSdk.Config.SANDBOX;
|
|
1210
|
+
break;
|
|
1211
|
+
}
|
|
1212
|
+
case exports.Environment.PRODUCTION: {
|
|
1213
|
+
this.immutableXConfig = coreSdk.Config.PRODUCTION;
|
|
1214
|
+
break;
|
|
1215
|
+
}
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1169
1221
|
var PassportErrorType;
|
|
1170
1222
|
(function (PassportErrorType) {
|
|
1171
1223
|
PassportErrorType["AUTHENTICATION_ERROR"] = "AUTHENTICATION_ERROR";
|
|
@@ -1218,17 +1270,17 @@ const retryWithDelay = async (fn, options) => {
|
|
|
1218
1270
|
}
|
|
1219
1271
|
};
|
|
1220
1272
|
|
|
1221
|
-
const getAuthConfiguration = ({ oidcConfiguration, }) => {
|
|
1273
|
+
const getAuthConfiguration = ({ oidcConfiguration, authenticationDomain, }) => {
|
|
1222
1274
|
const baseConfiguration = {
|
|
1223
|
-
authority:
|
|
1275
|
+
authority: authenticationDomain,
|
|
1224
1276
|
redirect_uri: oidcConfiguration.redirectUri,
|
|
1225
1277
|
popup_redirect_uri: oidcConfiguration.redirectUri,
|
|
1226
1278
|
client_id: oidcConfiguration.clientId,
|
|
1227
1279
|
metadata: {
|
|
1228
|
-
authorization_endpoint: `${
|
|
1229
|
-
token_endpoint: `${
|
|
1230
|
-
userinfo_endpoint: `${
|
|
1231
|
-
end_session_endpoint: `${
|
|
1280
|
+
authorization_endpoint: `${authenticationDomain}/authorize`,
|
|
1281
|
+
token_endpoint: `${authenticationDomain}/oauth/token`,
|
|
1282
|
+
userinfo_endpoint: `${authenticationDomain}/userinfo`,
|
|
1283
|
+
end_session_endpoint: `${authenticationDomain}/v2/logout` +
|
|
1232
1284
|
`?returnTo=${encodeURIComponent(oidcConfiguration.logoutRedirectUri)}` +
|
|
1233
1285
|
`&client_id=${oidcConfiguration.clientId}`,
|
|
1234
1286
|
},
|
|
@@ -1266,7 +1318,10 @@ class AuthManager {
|
|
|
1266
1318
|
};
|
|
1267
1319
|
async login() {
|
|
1268
1320
|
return withPassportError(async () => {
|
|
1269
|
-
const
|
|
1321
|
+
const popupWindowFeatures = { width: 400, height: 420 };
|
|
1322
|
+
const oidcUser = await this.userManager.signinPopup({
|
|
1323
|
+
popupWindowFeatures,
|
|
1324
|
+
});
|
|
1270
1325
|
return this.mapOidcUserToDomainModel(oidcUser);
|
|
1271
1326
|
}, PassportErrorType.AUTHENTICATION_ERROR);
|
|
1272
1327
|
}
|
|
@@ -1349,26 +1404,12 @@ var TransactionTypes;
|
|
|
1349
1404
|
const PassportEventType = 'imx_passport_confirmation';
|
|
1350
1405
|
|
|
1351
1406
|
const openPopupCenter = ({ url, title, width, height, }) => {
|
|
1352
|
-
|
|
1353
|
-
const
|
|
1354
|
-
const dualScreenTop = window.screenTop !== undefined ? window.screenTop : window.screenY;
|
|
1355
|
-
const windowWidth = window.innerWidth
|
|
1356
|
-
? window.innerWidth
|
|
1357
|
-
: document.documentElement.clientWidth
|
|
1358
|
-
? document.documentElement.clientWidth
|
|
1359
|
-
: screen.width;
|
|
1360
|
-
const windowHeight = window.innerHeight
|
|
1361
|
-
? window.innerHeight
|
|
1362
|
-
: document.documentElement.clientHeight
|
|
1363
|
-
? document.documentElement.clientHeight
|
|
1364
|
-
: screen.height;
|
|
1365
|
-
const systemZoom = windowWidth / window.screen.availWidth;
|
|
1366
|
-
const left = (windowWidth - width) / 2 / systemZoom + dualScreenLeft;
|
|
1367
|
-
const top = (windowHeight - height) / 2 / systemZoom + dualScreenTop;
|
|
1407
|
+
const left = Math.max(0, Math.round(window.screenX + (window.outerWidth - width) / 2));
|
|
1408
|
+
const top = Math.max(0, Math.round(window.screenY + (window.outerHeight - height) / 2));
|
|
1368
1409
|
const newWindow = window.open(url, title, `
|
|
1369
1410
|
scrollbars=yes,
|
|
1370
|
-
width=${width
|
|
1371
|
-
height=${height
|
|
1411
|
+
width=${width},
|
|
1412
|
+
height=${height},
|
|
1372
1413
|
top=${top},
|
|
1373
1414
|
left=${left}
|
|
1374
1415
|
`);
|
|
@@ -1380,8 +1421,8 @@ const openPopupCenter = ({ url, title, width, height, }) => {
|
|
|
1380
1421
|
};
|
|
1381
1422
|
|
|
1382
1423
|
const ConfirmationWindowTitle = 'Confirm this transaction';
|
|
1383
|
-
const ConfirmationWindowHeight =
|
|
1384
|
-
const ConfirmationWindowWidth =
|
|
1424
|
+
const ConfirmationWindowHeight = 380;
|
|
1425
|
+
const ConfirmationWindowWidth = 480;
|
|
1385
1426
|
const ConfirmationWindowClosedPollingDuration = 1000;
|
|
1386
1427
|
class ConfirmationScreen {
|
|
1387
1428
|
config;
|
|
@@ -1395,7 +1436,7 @@ class ConfirmationScreen {
|
|
|
1395
1436
|
...message,
|
|
1396
1437
|
}, this.config.passportDomain);
|
|
1397
1438
|
}
|
|
1398
|
-
startTransaction(accessToken, transaction) {
|
|
1439
|
+
startTransaction(accessToken, transaction, popupOptions) {
|
|
1399
1440
|
return new Promise((resolve, reject) => {
|
|
1400
1441
|
const messageHandler = ({ data, origin }) => {
|
|
1401
1442
|
if (origin != this.config.passportDomain ||
|
|
@@ -1426,8 +1467,8 @@ class ConfirmationScreen {
|
|
|
1426
1467
|
const confirmationWindow = openPopupCenter({
|
|
1427
1468
|
url: `${this.config.passportDomain}/transaction-confirmation`,
|
|
1428
1469
|
title: ConfirmationWindowTitle,
|
|
1429
|
-
width: ConfirmationWindowWidth,
|
|
1430
|
-
height: ConfirmationWindowHeight,
|
|
1470
|
+
width: popupOptions?.width || ConfirmationWindowWidth,
|
|
1471
|
+
height: popupOptions?.height || ConfirmationWindowHeight,
|
|
1431
1472
|
});
|
|
1432
1473
|
// https://stackoverflow.com/questions/9388380/capture-the-close-event-of-popup-window-in-javascript/48240128#48240128
|
|
1433
1474
|
const timer = setInterval(function () {
|
|
@@ -1514,10 +1555,11 @@ async function batchNftTransfer({ user, starkSigner, request, transfersApi, pass
|
|
|
1514
1555
|
getSignableTransferRequestV2,
|
|
1515
1556
|
});
|
|
1516
1557
|
const confirmationScreen = new ConfirmationScreen(passportConfig);
|
|
1558
|
+
const popupWindowSize = { width: 480, height: 784 };
|
|
1517
1559
|
const confirmationResult = await confirmationScreen.startTransaction(user.accessToken, {
|
|
1518
1560
|
transactionType: TransactionTypes.CreateBatchTransfer,
|
|
1519
1561
|
transactionData: getSignableTransferRequestV2,
|
|
1520
|
-
});
|
|
1562
|
+
}, popupWindowSize);
|
|
1521
1563
|
if (!confirmationResult.confirmed) {
|
|
1522
1564
|
throw new Error('Transaction rejected by user');
|
|
1523
1565
|
}
|
|
@@ -1726,7 +1768,7 @@ async function createTrade({ request, tradesApi, user, starkSigner, passportConf
|
|
|
1726
1768
|
},
|
|
1727
1769
|
};
|
|
1728
1770
|
const headers = { Authorization: 'Bearer ' + user.accessToken };
|
|
1729
|
-
const { data: createTradeResponse } = await tradesApi.
|
|
1771
|
+
const { data: createTradeResponse } = await tradesApi.createTradeV3(tradeParams, {
|
|
1730
1772
|
headers,
|
|
1731
1773
|
});
|
|
1732
1774
|
return createTradeResponse;
|
|
@@ -1746,7 +1788,7 @@ class PassportImxProvider {
|
|
|
1746
1788
|
this.starkSigner = starkSigner;
|
|
1747
1789
|
this.passportConfig = passportConfig;
|
|
1748
1790
|
const apiConfig = new coreSdk.Configuration({
|
|
1749
|
-
basePath: passportConfig.
|
|
1791
|
+
basePath: passportConfig.imxApiBasePath,
|
|
1750
1792
|
});
|
|
1751
1793
|
this.transfersApi = new coreSdk.TransfersApi(apiConfig);
|
|
1752
1794
|
this.ordersApi = new coreSdk.OrdersApi(apiConfig);
|
|
@@ -1838,67 +1880,75 @@ var Networks;
|
|
|
1838
1880
|
Networks["SANDBOX"] = "goerli";
|
|
1839
1881
|
})(Networks || (Networks = {}));
|
|
1840
1882
|
|
|
1841
|
-
const
|
|
1842
|
-
PRODUCTION: {
|
|
1843
|
-
network: Networks.PRODUCTION,
|
|
1844
|
-
authenticationDomain: 'https://auth.immutable.com',
|
|
1845
|
-
magicPublishableApiKey: 'pk_live_10F423798A540ED7',
|
|
1846
|
-
magicProviderId: 'fSMzaRQ4O7p4fttl7pCyGVtJS_G70P8SNsLXtPPGHo0=',
|
|
1847
|
-
baseIMXApiPath: 'https://api.x.immutable.com',
|
|
1848
|
-
passportDomain: 'https://passport.immutable.com',
|
|
1849
|
-
},
|
|
1850
|
-
SANDBOX: {
|
|
1851
|
-
network: Networks.SANDBOX,
|
|
1852
|
-
authenticationDomain: 'https://auth.immutable.com',
|
|
1853
|
-
magicPublishableApiKey: 'pk_live_10F423798A540ED7',
|
|
1854
|
-
magicProviderId: 'fSMzaRQ4O7p4fttl7pCyGVtJS_G70P8SNsLXtPPGHo0=',
|
|
1855
|
-
baseIMXApiPath: 'https://api.sandbox.x.immutable.com',
|
|
1856
|
-
passportDomain: 'https://passport.sandbox.immutable.com',
|
|
1857
|
-
},
|
|
1858
|
-
};
|
|
1859
|
-
const validateConfiguration = (configurationName, configuration, requiredKeys) => {
|
|
1860
|
-
if (!configuration) {
|
|
1861
|
-
throw new PassportError(`${configurationName} cannot be null`, PassportErrorType.INVALID_CONFIGURATION);
|
|
1862
|
-
}
|
|
1883
|
+
const validateConfiguration = (configuration, requiredKeys, prefix) => {
|
|
1863
1884
|
const missingKeys = requiredKeys
|
|
1864
1885
|
.map((key) => !configuration[key] && key)
|
|
1865
1886
|
.filter((n) => n)
|
|
1866
1887
|
.join(', ');
|
|
1867
1888
|
if (missingKeys !== '') {
|
|
1868
|
-
|
|
1889
|
+
const errorMessage = prefix
|
|
1890
|
+
? `${prefix} - ${missingKeys} cannot be null`
|
|
1891
|
+
: `${missingKeys} cannot be null`;
|
|
1892
|
+
throw new PassportError(errorMessage, PassportErrorType.INVALID_CONFIGURATION);
|
|
1869
1893
|
}
|
|
1870
1894
|
};
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
oidcConfiguration
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1895
|
+
class PassportConfiguration {
|
|
1896
|
+
network;
|
|
1897
|
+
authenticationDomain;
|
|
1898
|
+
passportDomain;
|
|
1899
|
+
magicPublishableApiKey;
|
|
1900
|
+
magicProviderId;
|
|
1901
|
+
imxApiBasePath;
|
|
1902
|
+
oidcConfiguration;
|
|
1903
|
+
baseConfig;
|
|
1904
|
+
constructor({ baseConfig, overrides, ...oidcConfiguration }) {
|
|
1905
|
+
validateConfiguration(oidcConfiguration, [
|
|
1906
|
+
'clientId',
|
|
1907
|
+
'logoutRedirectUri',
|
|
1908
|
+
'redirectUri',
|
|
1909
|
+
]);
|
|
1910
|
+
this.oidcConfiguration = oidcConfiguration;
|
|
1911
|
+
this.baseConfig = baseConfig;
|
|
1912
|
+
if (overrides) {
|
|
1913
|
+
validateConfiguration(overrides, [
|
|
1914
|
+
'network',
|
|
1915
|
+
'authenticationDomain',
|
|
1916
|
+
'magicPublishableApiKey',
|
|
1917
|
+
'magicProviderId',
|
|
1918
|
+
'passportDomain',
|
|
1919
|
+
'imxApiBasePath',
|
|
1920
|
+
], 'overrides');
|
|
1921
|
+
this.network = overrides.network;
|
|
1922
|
+
this.authenticationDomain = overrides.authenticationDomain;
|
|
1923
|
+
this.passportDomain = overrides.passportDomain;
|
|
1924
|
+
this.magicPublishableApiKey = overrides.magicPublishableApiKey;
|
|
1925
|
+
this.magicProviderId = overrides.magicProviderId;
|
|
1926
|
+
this.imxApiBasePath = overrides.imxApiBasePath;
|
|
1927
|
+
}
|
|
1928
|
+
else {
|
|
1929
|
+
switch (baseConfig.environment) {
|
|
1930
|
+
case exports.Environment.SANDBOX: {
|
|
1931
|
+
this.network = Networks.SANDBOX;
|
|
1932
|
+
this.authenticationDomain = 'https://auth.immutable.com';
|
|
1933
|
+
this.magicPublishableApiKey = 'pk_live_10F423798A540ED7';
|
|
1934
|
+
this.magicProviderId = 'fSMzaRQ4O7p4fttl7pCyGVtJS_G70P8SNsLXtPPGHo0=';
|
|
1935
|
+
this.passportDomain = 'https://passport.sandbox.immutable.com';
|
|
1936
|
+
this.imxApiBasePath = 'https://api.sandbox.x.immutable.com';
|
|
1937
|
+
break;
|
|
1938
|
+
}
|
|
1939
|
+
case exports.Environment.PRODUCTION: {
|
|
1940
|
+
this.network = Networks.PRODUCTION;
|
|
1941
|
+
this.authenticationDomain = 'https://auth.immutable.com';
|
|
1942
|
+
this.magicPublishableApiKey = 'pk_live_10F423798A540ED7';
|
|
1943
|
+
this.magicProviderId = 'fSMzaRQ4O7p4fttl7pCyGVtJS_G70P8SNsLXtPPGHo0=';
|
|
1944
|
+
this.passportDomain = 'https://passport.immutable.com';
|
|
1945
|
+
this.imxApiBasePath = 'https://api.x.immutable.com';
|
|
1946
|
+
break;
|
|
1947
|
+
}
|
|
1948
|
+
}
|
|
1949
|
+
}
|
|
1950
|
+
}
|
|
1951
|
+
}
|
|
1902
1952
|
|
|
1903
1953
|
const getStarkSigner = async (signer) => {
|
|
1904
1954
|
return withPassportError(async () => {
|
|
@@ -1937,8 +1987,8 @@ class Passport {
|
|
|
1937
1987
|
authManager;
|
|
1938
1988
|
magicAdapter;
|
|
1939
1989
|
config;
|
|
1940
|
-
constructor(
|
|
1941
|
-
const passportConfiguration =
|
|
1990
|
+
constructor(passportModuleConfiguration) {
|
|
1991
|
+
const passportConfiguration = new PassportConfiguration(passportModuleConfiguration);
|
|
1942
1992
|
this.config = passportConfiguration;
|
|
1943
1993
|
this.authManager = new AuthManager(this.config);
|
|
1944
1994
|
this.magicAdapter = new MagicAdapter(this.config);
|
|
@@ -1986,7 +2036,7 @@ class Passport {
|
|
|
1986
2036
|
}
|
|
1987
2037
|
async registerUser(userAdminKeySigner, starkSigner, jwt) {
|
|
1988
2038
|
const configuration = new coreSdk.Configuration({
|
|
1989
|
-
basePath: this.config.
|
|
2039
|
+
basePath: this.config.imxApiBasePath,
|
|
1990
2040
|
});
|
|
1991
2041
|
const usersApi = new coreSdk.UsersApi(configuration);
|
|
1992
2042
|
await registerPassport({
|
|
@@ -2002,6 +2052,10 @@ class Passport {
|
|
|
2002
2052
|
}
|
|
2003
2053
|
}
|
|
2004
2054
|
|
|
2055
|
+
function $parcel$interopDefault(a) {
|
|
2056
|
+
return a && a.__esModule ? a.default : a;
|
|
2057
|
+
}
|
|
2058
|
+
|
|
2005
2059
|
const $762782b6c862d954$export$db5daa1b5156ccfe = [
|
|
2006
2060
|
{
|
|
2007
2061
|
constant: true,
|
|
@@ -2122,8 +2176,18 @@ const $a47e48dd2c04791b$export$f61f4aaec62f6be9 = {
|
|
|
2122
2176
|
]
|
|
2123
2177
|
}
|
|
2124
2178
|
};
|
|
2179
|
+
exports.NetworkFilterTypes = void 0;
|
|
2180
|
+
(function(NetworkFilterTypes) {
|
|
2181
|
+
NetworkFilterTypes["ALL"] = "all";
|
|
2182
|
+
})(exports.NetworkFilterTypes || (exports.NetworkFilterTypes = {}));
|
|
2125
2183
|
|
|
2126
2184
|
|
|
2185
|
+
exports.TokenFilterTypes = void 0;
|
|
2186
|
+
(function(TokenFilterTypes) {
|
|
2187
|
+
TokenFilterTypes["SWAP"] = "swap";
|
|
2188
|
+
TokenFilterTypes["BRIDGE"] = "bridge";
|
|
2189
|
+
TokenFilterTypes["ALL"] = "all";
|
|
2190
|
+
})(exports.TokenFilterTypes || (exports.TokenFilterTypes = {}));
|
|
2127
2191
|
|
|
2128
2192
|
|
|
2129
2193
|
|
|
@@ -2134,24 +2198,45 @@ const $4f91c5f280efe242$export$a130407f3423b97d = {
|
|
|
2134
2198
|
ADD_NETWORK: "wallet_addEthereumChain",
|
|
2135
2199
|
SWITCH_NETWORK: "wallet_switchEthereumChain"
|
|
2136
2200
|
};
|
|
2201
|
+
exports.WalletFilterTypes = void 0;
|
|
2202
|
+
(function(WalletFilterTypes) {
|
|
2203
|
+
WalletFilterTypes["ALL"] = "all";
|
|
2204
|
+
WalletFilterTypes["DESKTOP"] = "desktop";
|
|
2205
|
+
WalletFilterTypes["MOBILE"] = "mobile";
|
|
2206
|
+
})(exports.WalletFilterTypes || (exports.WalletFilterTypes = {}));
|
|
2137
2207
|
|
|
2138
2208
|
|
|
2139
2209
|
|
|
2140
2210
|
|
|
2141
2211
|
let $a8bc256d81a5e2c1$export$e3dc0620abde7f5a;
|
|
2142
2212
|
(function(CheckoutErrorType) {
|
|
2213
|
+
CheckoutErrorType["PROVIDER_PREFERENCE_ERROR"] = "PROVIDER_PREFERENCE_ERROR";
|
|
2143
2214
|
CheckoutErrorType["CONNECT_PROVIDER_ERROR"] = "CONNECT_PROVIDER_ERROR";
|
|
2144
2215
|
CheckoutErrorType["GET_BALANCE_ERROR"] = "GET_BALANCE_ERROR";
|
|
2145
2216
|
CheckoutErrorType["GET_ERC20_BALANCE_ERROR"] = "GET_ERC20_BALANCE_ERROR";
|
|
2217
|
+
CheckoutErrorType["GET_NETWORK_INFO_ERROR"] = "GET_NETWORK_INFO_ERROR";
|
|
2146
2218
|
CheckoutErrorType["METAMASK_PROVIDER_ERROR"] = "METAMASK_PROVIDER_ERROR";
|
|
2147
2219
|
CheckoutErrorType["CHAIN_NOT_SUPPORTED_ERROR"] = "CHAIN_NOT_SUPPORTED_ERROR";
|
|
2148
2220
|
CheckoutErrorType["PROVIDER_REQUEST_MISSING_ERROR"] = "PROVIDER_REQUEST_MISSING_ERROR";
|
|
2221
|
+
CheckoutErrorType["PROVIDER_REQUEST_FAILED_ERROR"] = "PROVIDER_REQUEST_FAILED_ERROR";
|
|
2149
2222
|
CheckoutErrorType["USER_REJECTED_REQUEST_ERROR"] = "USER_REJECTED_REQUEST_ERROR";
|
|
2150
2223
|
CheckoutErrorType["TRANSACTION_ERROR"] = "TRANSACTION_ERROR";
|
|
2151
2224
|
})($a8bc256d81a5e2c1$export$e3dc0620abde7f5a || ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a = {}));
|
|
2152
2225
|
class $a8bc256d81a5e2c1$export$b722478a3cbfa3bc extends Error {
|
|
2153
|
-
constructor(message, type){
|
|
2226
|
+
constructor(message, type, data){
|
|
2154
2227
|
super(message);
|
|
2228
|
+
this.message = message;
|
|
2229
|
+
this.type = type;
|
|
2230
|
+
this.data = data;
|
|
2231
|
+
}
|
|
2232
|
+
}
|
|
2233
|
+
let $a8bc256d81a5e2c1$export$a22d4e0719ee6def;
|
|
2234
|
+
(function(CheckoutInternalErrorType) {
|
|
2235
|
+
CheckoutInternalErrorType["REJECTED_SWITCH_AFTER_ADDING_NETWORK"] = "REJECTED_SWITCH_AFTER_ADDING_NETWORK";
|
|
2236
|
+
})($a8bc256d81a5e2c1$export$a22d4e0719ee6def || ($a8bc256d81a5e2c1$export$a22d4e0719ee6def = {}));
|
|
2237
|
+
class $a8bc256d81a5e2c1$export$620a0d5f1b58ea1d extends Error {
|
|
2238
|
+
constructor(type){
|
|
2239
|
+
super("Checkout internal error");
|
|
2155
2240
|
this.type = type;
|
|
2156
2241
|
}
|
|
2157
2242
|
}
|
|
@@ -2159,44 +2244,67 @@ const $a8bc256d81a5e2c1$export$bacc563de539c6c3 = async (fn, customError)=>{
|
|
|
2159
2244
|
try {
|
|
2160
2245
|
return await fn();
|
|
2161
2246
|
} catch (error) {
|
|
2162
|
-
const
|
|
2163
|
-
|
|
2247
|
+
const cause = `${error.message}` || "UnknownError";
|
|
2248
|
+
const errorMessage = customError.message ? `[${customError.type}]:${customError.message}. Cause:${cause}` : `[${customError.type}] Cause:${cause}`;
|
|
2249
|
+
if (error instanceof $a8bc256d81a5e2c1$export$b722478a3cbfa3bc) throw new $a8bc256d81a5e2c1$export$b722478a3cbfa3bc(errorMessage, customError.type, {
|
|
2250
|
+
...customError.data,
|
|
2251
|
+
innerErrorType: error.type,
|
|
2252
|
+
...error.data
|
|
2253
|
+
});
|
|
2254
|
+
throw new $a8bc256d81a5e2c1$export$b722478a3cbfa3bc(errorMessage, customError.type, {
|
|
2255
|
+
...customError.data
|
|
2256
|
+
});
|
|
2164
2257
|
}
|
|
2165
2258
|
};
|
|
2166
2259
|
|
|
2167
2260
|
|
|
2168
2261
|
|
|
2169
2262
|
|
|
2263
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2170
2264
|
|
|
2265
|
+
var $497c134ecbc8a50f$exports = {};
|
|
2266
|
+
$497c134ecbc8a50f$exports = JSON.parse('[{"chainId":1},{"chainId":5},{"chainId":137}]');
|
|
2171
2267
|
|
|
2172
2268
|
|
|
2269
|
+
const $de192de6ef100f9f$var$UNRECOGNISED_CHAIN_ERROR_CODE = 4902; // error code (MetaMask)
|
|
2173
2270
|
async function $de192de6ef100f9f$export$79f13b4cfaaf0d09(provider) {
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2271
|
+
return ($a8bc256d81a5e2c1$export$bacc563de539c6c3)(async ()=>{
|
|
2272
|
+
const network = await provider.getNetwork();
|
|
2273
|
+
if (!Object.values((exports.ChainId)).includes(network.chainId)) // return empty details
|
|
2274
|
+
return {
|
|
2275
|
+
chainId: network.chainId,
|
|
2276
|
+
name: network.name,
|
|
2277
|
+
isSupported: false
|
|
2278
|
+
};
|
|
2279
|
+
const chainIdNetworkInfo = ($a47e48dd2c04791b$export$f61f4aaec62f6be9)[network.chainId];
|
|
2280
|
+
return {
|
|
2281
|
+
name: chainIdNetworkInfo.chainName,
|
|
2282
|
+
chainId: parseInt(chainIdNetworkInfo.chainIdHex, 16),
|
|
2283
|
+
nativeCurrency: chainIdNetworkInfo.nativeCurrency,
|
|
2284
|
+
isSupported: true
|
|
2285
|
+
};
|
|
2286
|
+
}, {
|
|
2287
|
+
type: ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).GET_NETWORK_INFO_ERROR
|
|
2288
|
+
});
|
|
2184
2289
|
}
|
|
2185
2290
|
async function $de192de6ef100f9f$export$b827d9418aeb5dbd(provider, chainId) {
|
|
2186
|
-
if (!Object.values((exports.ChainId)).includes(chainId)) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)(
|
|
2187
|
-
if (!provider.provider?.request) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("provider
|
|
2291
|
+
if (!Object.values((exports.ChainId)).includes(chainId)) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)(`Chain:${chainId} is not a supported chain`, ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).CHAIN_NOT_SUPPORTED_ERROR);
|
|
2292
|
+
if (!provider || !provider.provider?.request) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("Incompatible provider", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).PROVIDER_REQUEST_MISSING_ERROR, {
|
|
2293
|
+
details: `Unsupported provider`
|
|
2294
|
+
});
|
|
2188
2295
|
// WT-1146 - Refer to the README in this folder for explantion on the switch network flow
|
|
2189
2296
|
try {
|
|
2190
2297
|
await $de192de6ef100f9f$var$switchNetworkInWallet(provider, chainId);
|
|
2191
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2192
2298
|
} catch (err) {
|
|
2193
|
-
if (err.
|
|
2299
|
+
if (err.code === $de192de6ef100f9f$var$UNRECOGNISED_CHAIN_ERROR_CODE) try {
|
|
2194
2300
|
await $de192de6ef100f9f$var$addNetworkToWallet(provider, chainId);
|
|
2195
|
-
|
|
2301
|
+
if ((await provider.getNetwork()).chainId !== chainId) // user didn't actually switch
|
|
2302
|
+
throw new (0, $a8bc256d81a5e2c1$export$620a0d5f1b58ea1d)((0, $a8bc256d81a5e2c1$export$a22d4e0719ee6def).REJECTED_SWITCH_AFTER_ADDING_NETWORK);
|
|
2196
2303
|
} catch (err) {
|
|
2197
|
-
throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("
|
|
2304
|
+
if (err?.type === ($a8bc256d81a5e2c1$export$a22d4e0719ee6def).REJECTED_SWITCH_AFTER_ADDING_NETWORK) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("User cancelled switch network request", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).USER_REJECTED_REQUEST_ERROR);
|
|
2305
|
+
throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("User cancelled add network request", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).USER_REJECTED_REQUEST_ERROR);
|
|
2198
2306
|
}
|
|
2199
|
-
else throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("
|
|
2307
|
+
else throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("User cancelled switch network request", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).USER_REJECTED_REQUEST_ERROR);
|
|
2200
2308
|
}
|
|
2201
2309
|
// we can assume that if the above succeeds then user has successfully
|
|
2202
2310
|
// switched to the network specified
|
|
@@ -2209,6 +2317,26 @@ async function $de192de6ef100f9f$export$b827d9418aeb5dbd(provider, chainId) {
|
|
|
2209
2317
|
}
|
|
2210
2318
|
};
|
|
2211
2319
|
}
|
|
2320
|
+
async function $de192de6ef100f9f$export$3043f6442a9ef563({ type: type = (exports.NetworkFilterTypes).ALL , exclude: exclude }) {
|
|
2321
|
+
const list = ((/*@__PURE__*/$parcel$interopDefault($497c134ecbc8a50f$exports))).filter((network)=>{
|
|
2322
|
+
const allowAllTokens = type === (exports.NetworkFilterTypes).ALL;
|
|
2323
|
+
const networkNotExcluded = !(exclude || []).map((exc)=>exc.chainId).includes(network.chainId);
|
|
2324
|
+
return allowAllTokens && networkNotExcluded;
|
|
2325
|
+
});
|
|
2326
|
+
const allowedNetworks = [];
|
|
2327
|
+
list.forEach((element)=>{
|
|
2328
|
+
const newNetwork = ($a47e48dd2c04791b$export$f61f4aaec62f6be9)[element.chainId];
|
|
2329
|
+
allowedNetworks.push({
|
|
2330
|
+
name: newNetwork.chainName,
|
|
2331
|
+
chainId: parseInt(newNetwork.chainIdHex, 16),
|
|
2332
|
+
nativeCurrency: newNetwork.nativeCurrency,
|
|
2333
|
+
isSupported: true
|
|
2334
|
+
});
|
|
2335
|
+
});
|
|
2336
|
+
return {
|
|
2337
|
+
networks: allowedNetworks
|
|
2338
|
+
};
|
|
2339
|
+
}
|
|
2212
2340
|
// these functions should not be exported. These functions should be used as part of an exported function e.g switchWalletNetwork() above.
|
|
2213
2341
|
// make sure to check if(provider.provider?.request) in the exported function and throw an error
|
|
2214
2342
|
async function $de192de6ef100f9f$var$switchNetworkInWallet(provider, chainId) {
|
|
@@ -2243,67 +2371,24 @@ async function $de192de6ef100f9f$var$addNetworkToWallet(provider, chainId) {
|
|
|
2243
2371
|
|
|
2244
2372
|
|
|
2245
2373
|
|
|
2246
|
-
|
|
2247
|
-
(
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
const $
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
}
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
address: "0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0",
|
|
2263
|
-
decimals: 18,
|
|
2264
|
-
icon: "data:image/svg+xml,%3C%3Fxml version='1.0' encoding='utf-8'%3F%3E%3Csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 38.4 33.5' style='enable-background:new 0 0 38.4 33.5;' xml:space='preserve'%3E%3Cstyle type='text/css'%3E .st0%7Bfill:%238247E5;%7D%0A%3C/style%3E%3Cg%3E%3Cpath class='st0' d='M29,10.2c-0.7-0.4-1.6-0.4-2.4,0L21,13.5l-3.8,2.1l-5.5,3.3c-0.7,0.4-1.6,0.4-2.4,0L5,16.3 c-0.7-0.4-1.2-1.2-1.2-2.1v-5c0-0.8,0.4-1.6,1.2-2.1l4.3-2.5c0.7-0.4,1.6-0.4,2.4,0L16,7.2c0.7,0.4,1.2,1.2,1.2,2.1v3.3l3.8-2.2V7 c0-0.8-0.4-1.6-1.2-2.1l-8-4.7c-0.7-0.4-1.6-0.4-2.4,0L1.2,5C0.4,5.4,0,6.2,0,7v9.4c0,0.8,0.4,1.6,1.2,2.1l8.1,4.7 c0.7,0.4,1.6,0.4,2.4,0l5.5-3.2l3.8-2.2l5.5-3.2c0.7-0.4,1.6-0.4,2.4,0l4.3,2.5c0.7,0.4,1.2,1.2,1.2,2.1v5c0,0.8-0.4,1.6-1.2,2.1 L29,28.8c-0.7,0.4-1.6,0.4-2.4,0l-4.3-2.5c-0.7-0.4-1.2-1.2-1.2-2.1V21l-3.8,2.2v3.3c0,0.8,0.4,1.6,1.2,2.1l8.1,4.7 c0.7,0.4,1.6,0.4,2.4,0l8.1-4.7c0.7-0.4,1.2-1.2,1.2-2.1V17c0-0.8-0.4-1.6-1.2-2.1L29,10.2z'/%3E%3C/g%3E%3C/svg%3E%0A"
|
|
2265
|
-
},
|
|
2266
|
-
{
|
|
2267
|
-
name: "Immutable X",
|
|
2268
|
-
symbol: "IMX",
|
|
2269
|
-
address: "0xF57e7e7C23978C3cAEC3C3548E3D615c346e79fF",
|
|
2270
|
-
decimals: 18,
|
|
2271
|
-
icon: "data:image/svg+xml,%3C%3Fxml version='1.0' encoding='utf-8'%3F%3E%3Csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 139 113' style='enable-background:new 0 0 139 113;' xml:space='preserve'%3E%3Cstyle type='text/css'%3E .st0%7Bclip-path:url(%23SVGID_00000053504646934646330740000009134454895836103350_);%7D .st1%7Bfill:%2317B5CB;%7D%0A%3C/style%3E%3Cg%3E%3Cdefs%3E%3Crect id='SVGID_1_' width='139' height='113'/%3E%3C/defs%3E%3CclipPath id='SVGID_00000035518931339590433170000002358037249938198420_'%3E%3Cuse xlink:href='%23SVGID_1_' style='overflow:visible;'/%3E%3C/clipPath%3E%3Cg style='clip-path:url(%23SVGID_00000035518931339590433170000002358037249938198420_);'%3E%3Cpath class='st1' d='M124.1,0h14.6L79.5,67.6c-1.5,1.7-1.6,4.3-0.1,6.1l34.1,39.7H98.3L66.8,76.6l-1.6-2c-1.5-1.7-1.4-4.4,0.1-6.1 L124.1,0z'/%3E%3Cpath class='st1' d='M91.2,73.7c-1-1.1-1.3-2.7-1-4.1c0.3-0.8,0.8-1.6,1.4-2.2l3.9-4.3l43.5,50.3h-13.8 C125.2,113.4,99.7,83.6,91.2,73.7z'/%3E%3Cpath class='st1' d='M15.2,113.4H0l46.6-53.9c1.5-1.7,1.5-4.3,0-6L0.4,0H15l46.5,53.9c1.2,1.6,1.4,3.9,0.1,5.4 C49.4,73.4,15.2,113.4,15.2,113.4z'/%3E%3Cpath class='st1' d='M40.6,0h-14l43.1,49.9c0,0,0.1-0.1,4.9-5.8c1.3-1.5,1.6-3.4,0.1-4.9C65.7,30,40.6,0,40.6,0z'/%3E%3Cpath class='st1' d='M82.6,34.8L112.5,0H98.3L82.7,18.2l-4.5,5.3c-1.5,1.7-1.6,4.3-0.1,6.1C79.2,30.9,82.6,34.8,82.6,34.8z'/%3E%3Cpath class='st1' d='M56.6,78.6l-29.9,34.8h14.1l15.6-18.2l4.5-5.3c1.5-1.7,1.6-4.3,0.1-6.1C59.9,82.5,56.6,78.6,56.6,78.6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E%0A"
|
|
2272
|
-
}
|
|
2273
|
-
];
|
|
2274
|
-
const $efe60cea83bfc4e8$var$goerliTokensList = [
|
|
2275
|
-
{
|
|
2276
|
-
name: "Ethereum",
|
|
2277
|
-
symbol: "ETH",
|
|
2278
|
-
decimals: 18,
|
|
2279
|
-
icon: "data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3C!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3E%3Csvg xmlns='http://www.w3.org/2000/svg' xml:space='preserve' width='100%25' height='100%25' version='1.1' shape-rendering='geometricPrecision' text-rendering='geometricPrecision' image-rendering='optimizeQuality' fill-rule='evenodd' clip-rule='evenodd'%0AviewBox='0 0 784.37 1277.39' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns:xodm='http://www.corel.com/coreldraw/odm/2003'%3E%3Cg id='Layer_x0020_1'%3E%3Cmetadata id='CorelCorpID_0Corel-Layer'/%3E%3Cg id='_1421394342400'%3E%3Cg%3E%3Cpolygon fill='%23343434' fill-rule='nonzero' points='392.07,0 383.5,29.11 383.5,873.74 392.07,882.29 784.13,650.54 '/%3E%3Cpolygon fill='%238C8C8C' fill-rule='nonzero' points='392.07,0 -0,650.54 392.07,882.29 392.07,472.33 '/%3E%3Cpolygon fill='%233C3C3B' fill-rule='nonzero' points='392.07,956.52 387.24,962.41 387.24,1263.28 392.07,1277.38 784.37,724.89 '/%3E%3Cpolygon fill='%238C8C8C' fill-rule='nonzero' points='392.07,1277.38 392.07,956.52 -0,724.89 '/%3E%3Cpolygon fill='%23141414' fill-rule='nonzero' points='392.07,882.29 784.13,650.54 392.07,472.33 '/%3E%3Cpolygon fill='%23393939' fill-rule='nonzero' points='0,650.54 392.07,882.29 392.07,472.33 '/%3E%3C/g%3E%3C/g%3E%3C/g%3E%3C/svg%3E%0A"
|
|
2280
|
-
},
|
|
2281
|
-
{
|
|
2282
|
-
name: "Immutable X",
|
|
2283
|
-
symbol: "IMX",
|
|
2284
|
-
address: "0x1facdd0165489f373255a90304650e15481b2c85",
|
|
2285
|
-
decimals: 18,
|
|
2286
|
-
icon: "data:image/svg+xml,%3C%3Fxml version='1.0' encoding='utf-8'%3F%3E%3Csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 139 113' style='enable-background:new 0 0 139 113;' xml:space='preserve'%3E%3Cstyle type='text/css'%3E .st0%7Bclip-path:url(%23SVGID_00000053504646934646330740000009134454895836103350_);%7D .st1%7Bfill:%2317B5CB;%7D%0A%3C/style%3E%3Cg%3E%3Cdefs%3E%3Crect id='SVGID_1_' width='139' height='113'/%3E%3C/defs%3E%3CclipPath id='SVGID_00000035518931339590433170000002358037249938198420_'%3E%3Cuse xlink:href='%23SVGID_1_' style='overflow:visible;'/%3E%3C/clipPath%3E%3Cg style='clip-path:url(%23SVGID_00000035518931339590433170000002358037249938198420_);'%3E%3Cpath class='st1' d='M124.1,0h14.6L79.5,67.6c-1.5,1.7-1.6,4.3-0.1,6.1l34.1,39.7H98.3L66.8,76.6l-1.6-2c-1.5-1.7-1.4-4.4,0.1-6.1 L124.1,0z'/%3E%3Cpath class='st1' d='M91.2,73.7c-1-1.1-1.3-2.7-1-4.1c0.3-0.8,0.8-1.6,1.4-2.2l3.9-4.3l43.5,50.3h-13.8 C125.2,113.4,99.7,83.6,91.2,73.7z'/%3E%3Cpath class='st1' d='M15.2,113.4H0l46.6-53.9c1.5-1.7,1.5-4.3,0-6L0.4,0H15l46.5,53.9c1.2,1.6,1.4,3.9,0.1,5.4 C49.4,73.4,15.2,113.4,15.2,113.4z'/%3E%3Cpath class='st1' d='M40.6,0h-14l43.1,49.9c0,0,0.1-0.1,4.9-5.8c1.3-1.5,1.6-3.4,0.1-4.9C65.7,30,40.6,0,40.6,0z'/%3E%3Cpath class='st1' d='M82.6,34.8L112.5,0H98.3L82.7,18.2l-4.5,5.3c-1.5,1.7-1.6,4.3-0.1,6.1C79.2,30.9,82.6,34.8,82.6,34.8z'/%3E%3Cpath class='st1' d='M56.6,78.6l-29.9,34.8h14.1l15.6-18.2l4.5-5.3c1.5-1.7,1.6-4.3,0.1-6.1C59.9,82.5,56.6,78.6,56.6,78.6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E%0A"
|
|
2287
|
-
}
|
|
2288
|
-
];
|
|
2289
|
-
const $efe60cea83bfc4e8$var$polygonTokensList = [];
|
|
2290
|
-
const $efe60cea83bfc4e8$export$473cec51305fdae8 = (chainId)=>{
|
|
2291
|
-
let tokenList = [];
|
|
2292
|
-
switch(chainId){
|
|
2293
|
-
case (exports.ChainId).ETHEREUM:
|
|
2294
|
-
tokenList = $efe60cea83bfc4e8$export$3dbcce43073f40c7;
|
|
2295
|
-
break;
|
|
2296
|
-
case (exports.ChainId).GOERLI:
|
|
2297
|
-
tokenList = $efe60cea83bfc4e8$var$goerliTokensList;
|
|
2298
|
-
break;
|
|
2299
|
-
case (exports.ChainId).POLYGON:
|
|
2300
|
-
tokenList = $efe60cea83bfc4e8$var$polygonTokensList;
|
|
2301
|
-
break;
|
|
2302
|
-
default:
|
|
2303
|
-
tokenList = $efe60cea83bfc4e8$export$3dbcce43073f40c7;
|
|
2304
|
-
}
|
|
2374
|
+
var $cda6003506e4182e$exports = {};
|
|
2375
|
+
$cda6003506e4182e$exports = JSON.parse("[{\"address\":\"0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0\",\"chainId\":137,\"name\":\"Matic\",\"symbol\":\"MATIC\",\"decimals\":18,\"icon\":\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='utf-8'%3F%3E%3Csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 38.4 33.5' style='enable-background:new 0 0 38.4 33.5;' xml:space='preserve'%3E%3Cstyle type='text/css'%3E .st0%7Bfill:%238247E5;%7D%0A%3C/style%3E%3Cg%3E%3Cpath class='st0' d='M29,10.2c-0.7-0.4-1.6-0.4-2.4,0L21,13.5l-3.8,2.1l-5.5,3.3c-0.7,0.4-1.6,0.4-2.4,0L5,16.3 c-0.7-0.4-1.2-1.2-1.2-2.1v-5c0-0.8,0.4-1.6,1.2-2.1l4.3-2.5c0.7-0.4,1.6-0.4,2.4,0L16,7.2c0.7,0.4,1.2,1.2,1.2,2.1v3.3l3.8-2.2V7 c0-0.8-0.4-1.6-1.2-2.1l-8-4.7c-0.7-0.4-1.6-0.4-2.4,0L1.2,5C0.4,5.4,0,6.2,0,7v9.4c0,0.8,0.4,1.6,1.2,2.1l8.1,4.7 c0.7,0.4,1.6,0.4,2.4,0l5.5-3.2l3.8-2.2l5.5-3.2c0.7-0.4,1.6-0.4,2.4,0l4.3,2.5c0.7,0.4,1.2,1.2,1.2,2.1v5c0,0.8-0.4,1.6-1.2,2.1 L29,28.8c-0.7,0.4-1.6,0.4-2.4,0l-4.3-2.5c-0.7-0.4-1.2-1.2-1.2-2.1V21l-3.8,2.2v3.3c0,0.8,0.4,1.6,1.2,2.1l8.1,4.7 c0.7,0.4,1.6,0.4,2.4,0l8.1-4.7c0.7-0.4,1.2-1.2,1.2-2.1V17c0-0.8-0.4-1.6-1.2-2.1L29,10.2z'/%3E%3C/g%3E%3C/svg%3E%0A\",\"tokenFeatures\":[\"swap\",\"bridge\"]},{\"name\":\"Ethereum\",\"symbol\":\"ETH\",\"decimals\":18,\"icon\":\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3C!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3E%3Csvg xmlns='http://www.w3.org/2000/svg' xml:space='preserve' width='100%25' height='100%25' version='1.1' shape-rendering='geometricPrecision' text-rendering='geometricPrecision' image-rendering='optimizeQuality' fill-rule='evenodd' clip-rule='evenodd'%0AviewBox='0 0 784.37 1277.39' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns:xodm='http://www.corel.com/coreldraw/odm/2003'%3E%3Cg id='Layer_x0020_1'%3E%3Cmetadata id='CorelCorpID_0Corel-Layer'/%3E%3Cg id='_1421394342400'%3E%3Cg%3E%3Cpolygon fill='%23343434' fill-rule='nonzero' points='392.07,0 383.5,29.11 383.5,873.74 392.07,882.29 784.13,650.54 '/%3E%3Cpolygon fill='%238C8C8C' fill-rule='nonzero' points='392.07,0 -0,650.54 392.07,882.29 392.07,472.33 '/%3E%3Cpolygon fill='%233C3C3B' fill-rule='nonzero' points='392.07,956.52 387.24,962.41 387.24,1263.28 392.07,1277.38 784.37,724.89 '/%3E%3Cpolygon fill='%238C8C8C' fill-rule='nonzero' points='392.07,1277.38 392.07,956.52 -0,724.89 '/%3E%3Cpolygon fill='%23141414' fill-rule='nonzero' points='392.07,882.29 784.13,650.54 392.07,472.33 '/%3E%3Cpolygon fill='%23393939' fill-rule='nonzero' points='0,650.54 392.07,882.29 392.07,472.33 '/%3E%3C/g%3E%3C/g%3E%3C/g%3E%3C/svg%3E%0A\",\"chainId\":1,\"tokenFeatures\":[\"swap\",\"bridge\"]},{\"address\":\"0xF57e7e7C23978C3cAEC3C3548E3D615c346e79fF\",\"chainId\":1,\"name\":\"Immutable X\",\"symbol\":\"IMX\",\"decimals\":18,\"icon\":\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='utf-8'%3F%3E%3Csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 139 113' style='enable-background:new 0 0 139 113;' xml:space='preserve'%3E%3Cstyle type='text/css'%3E .st0%7Bclip-path:url(%23SVGID_00000053504646934646330740000009134454895836103350_);%7D .st1%7Bfill:%2317B5CB;%7D%0A%3C/style%3E%3Cg%3E%3Cdefs%3E%3Crect id='SVGID_1_' width='139' height='113'/%3E%3C/defs%3E%3CclipPath id='SVGID_00000035518931339590433170000002358037249938198420_'%3E%3Cuse xlink:href='%23SVGID_1_' style='overflow:visible;'/%3E%3C/clipPath%3E%3Cg style='clip-path:url(%23SVGID_00000035518931339590433170000002358037249938198420_);'%3E%3Cpath class='st1' d='M124.1,0h14.6L79.5,67.6c-1.5,1.7-1.6,4.3-0.1,6.1l34.1,39.7H98.3L66.8,76.6l-1.6-2c-1.5-1.7-1.4-4.4,0.1-6.1 L124.1,0z'/%3E%3Cpath class='st1' d='M91.2,73.7c-1-1.1-1.3-2.7-1-4.1c0.3-0.8,0.8-1.6,1.4-2.2l3.9-4.3l43.5,50.3h-13.8 C125.2,113.4,99.7,83.6,91.2,73.7z'/%3E%3Cpath class='st1' d='M15.2,113.4H0l46.6-53.9c1.5-1.7,1.5-4.3,0-6L0.4,0H15l46.5,53.9c1.2,1.6,1.4,3.9,0.1,5.4 C49.4,73.4,15.2,113.4,15.2,113.4z'/%3E%3Cpath class='st1' d='M40.6,0h-14l43.1,49.9c0,0,0.1-0.1,4.9-5.8c1.3-1.5,1.6-3.4,0.1-4.9C65.7,30,40.6,0,40.6,0z'/%3E%3Cpath class='st1' d='M82.6,34.8L112.5,0H98.3L82.7,18.2l-4.5,5.3c-1.5,1.7-1.6,4.3-0.1,6.1C79.2,30.9,82.6,34.8,82.6,34.8z'/%3E%3Cpath class='st1' d='M56.6,78.6l-29.9,34.8h14.1l15.6-18.2l4.5-5.3c1.5-1.7,1.6-4.3,0.1-6.1C59.9,82.5,56.6,78.6,56.6,78.6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E%0A\",\"tokenFeatures\":[\"swap\",\"bridge\"]},{\"address\":\"0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0\",\"chainId\":1,\"name\":\"Matic\",\"symbol\":\"MATIC\",\"decimals\":18,\"icon\":\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='utf-8'%3F%3E%3Csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 38.4 33.5' style='enable-background:new 0 0 38.4 33.5;' xml:space='preserve'%3E%3Cstyle type='text/css'%3E .st0%7Bfill:%238247E5;%7D%0A%3C/style%3E%3Cg%3E%3Cpath class='st0' d='M29,10.2c-0.7-0.4-1.6-0.4-2.4,0L21,13.5l-3.8,2.1l-5.5,3.3c-0.7,0.4-1.6,0.4-2.4,0L5,16.3 c-0.7-0.4-1.2-1.2-1.2-2.1v-5c0-0.8,0.4-1.6,1.2-2.1l4.3-2.5c0.7-0.4,1.6-0.4,2.4,0L16,7.2c0.7,0.4,1.2,1.2,1.2,2.1v3.3l3.8-2.2V7 c0-0.8-0.4-1.6-1.2-2.1l-8-4.7c-0.7-0.4-1.6-0.4-2.4,0L1.2,5C0.4,5.4,0,6.2,0,7v9.4c0,0.8,0.4,1.6,1.2,2.1l8.1,4.7 c0.7,0.4,1.6,0.4,2.4,0l5.5-3.2l3.8-2.2l5.5-3.2c0.7-0.4,1.6-0.4,2.4,0l4.3,2.5c0.7,0.4,1.2,1.2,1.2,2.1v5c0,0.8-0.4,1.6-1.2,2.1 L29,28.8c-0.7,0.4-1.6,0.4-2.4,0l-4.3-2.5c-0.7-0.4-1.2-1.2-1.2-2.1V21l-3.8,2.2v3.3c0,0.8,0.4,1.6,1.2,2.1l8.1,4.7 c0.7,0.4,1.6,0.4,2.4,0l8.1-4.7c0.7-0.4,1.2-1.2,1.2-2.1V17c0-0.8-0.4-1.6-1.2-2.1L29,10.2z'/%3E%3C/g%3E%3C/svg%3E%0A\",\"tokenFeatures\":[\"swap\",\"bridge\"]},{\"name\":\"Ethereum\",\"symbol\":\"ETH\",\"decimals\":18,\"icon\":\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3C!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3E%3Csvg xmlns='http://www.w3.org/2000/svg' xml:space='preserve' width='100%25' height='100%25' version='1.1' shape-rendering='geometricPrecision' text-rendering='geometricPrecision' image-rendering='optimizeQuality' fill-rule='evenodd' clip-rule='evenodd'%0AviewBox='0 0 784.37 1277.39' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns:xodm='http://www.corel.com/coreldraw/odm/2003'%3E%3Cg id='Layer_x0020_1'%3E%3Cmetadata id='CorelCorpID_0Corel-Layer'/%3E%3Cg id='_1421394342400'%3E%3Cg%3E%3Cpolygon fill='%23343434' fill-rule='nonzero' points='392.07,0 383.5,29.11 383.5,873.74 392.07,882.29 784.13,650.54 '/%3E%3Cpolygon fill='%238C8C8C' fill-rule='nonzero' points='392.07,0 -0,650.54 392.07,882.29 392.07,472.33 '/%3E%3Cpolygon fill='%233C3C3B' fill-rule='nonzero' points='392.07,956.52 387.24,962.41 387.24,1263.28 392.07,1277.38 784.37,724.89 '/%3E%3Cpolygon fill='%238C8C8C' fill-rule='nonzero' points='392.07,1277.38 392.07,956.52 -0,724.89 '/%3E%3Cpolygon fill='%23141414' fill-rule='nonzero' points='392.07,882.29 784.13,650.54 392.07,472.33 '/%3E%3Cpolygon fill='%23393939' fill-rule='nonzero' points='0,650.54 392.07,882.29 392.07,472.33 '/%3E%3C/g%3E%3C/g%3E%3C/g%3E%3C/svg%3E%0A\",\"chainId\":5,\"tokenFeatures\":[\"swap\",\"bridge\"]},{\"address\":\"0x1facdd0165489f373255a90304650e15481b2c85\",\"chainId\":5,\"name\":\"Immutable X\",\"symbol\":\"IMX\",\"decimals\":18,\"icon\":\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='utf-8'%3F%3E%3Csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 139 113' style='enable-background:new 0 0 139 113;' xml:space='preserve'%3E%3Cstyle type='text/css'%3E .st0%7Bclip-path:url(%23SVGID_00000053504646934646330740000009134454895836103350_);%7D .st1%7Bfill:%2317B5CB;%7D%0A%3C/style%3E%3Cg%3E%3Cdefs%3E%3Crect id='SVGID_1_' width='139' height='113'/%3E%3C/defs%3E%3CclipPath id='SVGID_00000035518931339590433170000002358037249938198420_'%3E%3Cuse xlink:href='%23SVGID_1_' style='overflow:visible;'/%3E%3C/clipPath%3E%3Cg style='clip-path:url(%23SVGID_00000035518931339590433170000002358037249938198420_);'%3E%3Cpath class='st1' d='M124.1,0h14.6L79.5,67.6c-1.5,1.7-1.6,4.3-0.1,6.1l34.1,39.7H98.3L66.8,76.6l-1.6-2c-1.5-1.7-1.4-4.4,0.1-6.1 L124.1,0z'/%3E%3Cpath class='st1' d='M91.2,73.7c-1-1.1-1.3-2.7-1-4.1c0.3-0.8,0.8-1.6,1.4-2.2l3.9-4.3l43.5,50.3h-13.8 C125.2,113.4,99.7,83.6,91.2,73.7z'/%3E%3Cpath class='st1' d='M15.2,113.4H0l46.6-53.9c1.5-1.7,1.5-4.3,0-6L0.4,0H15l46.5,53.9c1.2,1.6,1.4,3.9,0.1,5.4 C49.4,73.4,15.2,113.4,15.2,113.4z'/%3E%3Cpath class='st1' d='M40.6,0h-14l43.1,49.9c0,0,0.1-0.1,4.9-5.8c1.3-1.5,1.6-3.4,0.1-4.9C65.7,30,40.6,0,40.6,0z'/%3E%3Cpath class='st1' d='M82.6,34.8L112.5,0H98.3L82.7,18.2l-4.5,5.3c-1.5,1.7-1.6,4.3-0.1,6.1C79.2,30.9,82.6,34.8,82.6,34.8z'/%3E%3Cpath class='st1' d='M56.6,78.6l-29.9,34.8h14.1l15.6-18.2l4.5-5.3c1.5-1.7,1.6-4.3,0.1-6.1C59.9,82.5,56.6,78.6,56.6,78.6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E%0A\",\"tokenFeatures\":[\"swap\",\"bridge\"]},{\"address\":\"0x123456789\",\"chainId\":5,\"name\":\"Swap Coin\",\"symbol\":\"SWC\",\"decimals\":18,\"tokenFeatures\":[\"swap\",\"fakeFeature\"]},{\"address\":\"0x123456789\",\"chainId\":5,\"name\":\"Bridge Coin\",\"symbol\":\"BDC\",\"decimals\":18,\"tokenFeatures\":[\"bridge\",\"fakeFeature\"]}]");
|
|
2376
|
+
|
|
2377
|
+
|
|
2378
|
+
const $efe60cea83bfc4e8$export$473cec51305fdae8 = async function({ type: type = (exports.TokenFilterTypes).ALL , chainId: chainId , exclude: exclude }) {
|
|
2379
|
+
// todo:For API call, use the CheckoutError with errorType:API_CALL_ERROR?? or any other
|
|
2380
|
+
const filteredTokenList = ((/*@__PURE__*/$parcel$interopDefault($cda6003506e4182e$exports))).filter((token)=>{
|
|
2381
|
+
const chainIdMatches = token.chainId == chainId;
|
|
2382
|
+
const tokenNotExcluded = !exclude?.map((excludeToken)=>excludeToken.address).includes(token.address || "");
|
|
2383
|
+
const allowAllTokens = type === (exports.TokenFilterTypes).ALL;
|
|
2384
|
+
const tokenAllowedForType = token.tokenFeatures.includes(type);
|
|
2385
|
+
return chainIdMatches && tokenNotExcluded && (allowAllTokens || tokenAllowedForType);
|
|
2386
|
+
}).map((token)=>{
|
|
2387
|
+
const { chainId: chainId , tokenFeatures: tokenFeatures , ...tokenInfo } = token;
|
|
2388
|
+
return tokenInfo;
|
|
2389
|
+
});
|
|
2305
2390
|
return {
|
|
2306
|
-
tokens:
|
|
2391
|
+
tokens: filteredTokenList
|
|
2307
2392
|
};
|
|
2308
2393
|
};
|
|
2309
2394
|
|
|
@@ -2313,6 +2398,9 @@ const $efe60cea83bfc4e8$export$473cec51305fdae8 = (chainId)=>{
|
|
|
2313
2398
|
const $1564e43dde50bb61$export$df96cd8d56be0ab1 = async (provider, walletAddress)=>{
|
|
2314
2399
|
return await ($a8bc256d81a5e2c1$export$bacc563de539c6c3)(async ()=>{
|
|
2315
2400
|
const networkInfo = await ($de192de6ef100f9f$export$79f13b4cfaaf0d09)(provider);
|
|
2401
|
+
if (!networkInfo.isSupported) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)(`Chain:${networkInfo.chainId} is not a supported chain`, ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).CHAIN_NOT_SUPPORTED_ERROR, {
|
|
2402
|
+
chainName: networkInfo.name
|
|
2403
|
+
});
|
|
2316
2404
|
const balance = await provider.getBalance(walletAddress);
|
|
2317
2405
|
return {
|
|
2318
2406
|
balance: balance,
|
|
@@ -2348,7 +2436,10 @@ async function $1564e43dde50bb61$export$60e0fe116a0e6ed0(provider, walletAddress
|
|
|
2348
2436
|
const $1564e43dde50bb61$export$fee49741664a4d7e = async (provider, walletAddress, chainId)=>{
|
|
2349
2437
|
if (!Object.values((exports.ChainId)).includes(chainId)) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)(`ChainId ${chainId} is not supported`, ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).CHAIN_NOT_SUPPORTED_ERROR);
|
|
2350
2438
|
if (!provider.provider?.request) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("provider object is missing request function", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).PROVIDER_REQUEST_MISSING_ERROR);
|
|
2351
|
-
const tokenList = ($efe60cea83bfc4e8$export$473cec51305fdae8)(
|
|
2439
|
+
const tokenList = await ($efe60cea83bfc4e8$export$473cec51305fdae8)({
|
|
2440
|
+
type: (exports.TokenFilterTypes).ALL,
|
|
2441
|
+
chainId: chainId
|
|
2442
|
+
});
|
|
2352
2443
|
const allBalancePromises = [];
|
|
2353
2444
|
allBalancePromises.push($1564e43dde50bb61$export$df96cd8d56be0ab1(provider, walletAddress));
|
|
2354
2445
|
tokenList.tokens.filter((token)=>token.address).forEach((token)=>allBalancePromises.push($1564e43dde50bb61$export$60e0fe116a0e6ed0(provider, walletAddress, token.address ?? "")));
|
|
@@ -2369,11 +2460,20 @@ const $1564e43dde50bb61$export$fee49741664a4d7e = async (provider, walletAddress
|
|
|
2369
2460
|
|
|
2370
2461
|
async function $c99672cf2294e839$export$2d040992269b4717(providerPreference) {
|
|
2371
2462
|
const provider = await $c99672cf2294e839$var$getWalletProviderForPreference(providerPreference);
|
|
2372
|
-
if (!provider.provider?.request) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("Incompatible provider", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).PROVIDER_REQUEST_MISSING_ERROR
|
|
2373
|
-
|
|
2374
|
-
method: ($4f91c5f280efe242$export$a130407f3423b97d).CHECK_CONNECTION,
|
|
2375
|
-
params: []
|
|
2463
|
+
if (!provider.provider?.request) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("Incompatible provider", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).PROVIDER_REQUEST_MISSING_ERROR, {
|
|
2464
|
+
details: `Unsupported provider for ${providerPreference}`
|
|
2376
2465
|
});
|
|
2466
|
+
let accounts = [];
|
|
2467
|
+
try {
|
|
2468
|
+
accounts = await provider.provider.request({
|
|
2469
|
+
method: (0, $4f91c5f280efe242$export$a130407f3423b97d).CHECK_CONNECTION,
|
|
2470
|
+
params: []
|
|
2471
|
+
});
|
|
2472
|
+
} catch (err) {
|
|
2473
|
+
throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)(`Check wallet connection request failed`, ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).PROVIDER_REQUEST_FAILED_ERROR, {
|
|
2474
|
+
rpcMethod: ($4f91c5f280efe242$export$a130407f3423b97d).CHECK_CONNECTION
|
|
2475
|
+
});
|
|
2476
|
+
}
|
|
2377
2477
|
// accounts[0] will have the active account if connected.
|
|
2378
2478
|
return {
|
|
2379
2479
|
isConnected: accounts && accounts.length > 0,
|
|
@@ -2383,7 +2483,9 @@ async function $c99672cf2294e839$export$2d040992269b4717(providerPreference) {
|
|
|
2383
2483
|
async function $c99672cf2294e839$export$fba2f6c3656e07c1(params) {
|
|
2384
2484
|
const web3Provider = await $c99672cf2294e839$var$getWalletProviderForPreference(params.providerPreference);
|
|
2385
2485
|
await ($a8bc256d81a5e2c1$export$bacc563de539c6c3)(async ()=>{
|
|
2386
|
-
if (!web3Provider || !web3Provider?.provider?.request) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("
|
|
2486
|
+
if (!web3Provider || !web3Provider?.provider?.request) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("Incompatible provider", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).PROVIDER_REQUEST_MISSING_ERROR, {
|
|
2487
|
+
details: `Unsupported provider for ${params.providerPreference}`
|
|
2488
|
+
});
|
|
2387
2489
|
// this makes the request to the wallet to connect i.e request eth accounts ('eth_requestAccounts')
|
|
2388
2490
|
await web3Provider.provider.request({
|
|
2389
2491
|
method: ($4f91c5f280efe242$export$a130407f3423b97d).CONNECT,
|
|
@@ -2401,7 +2503,7 @@ async function $c99672cf2294e839$var$getWalletProviderForPreference(providerPref
|
|
|
2401
2503
|
web3Provider = await $c99672cf2294e839$var$getMetaMaskProvider();
|
|
2402
2504
|
break;
|
|
2403
2505
|
default:
|
|
2404
|
-
throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("Provider preference
|
|
2506
|
+
throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("Provider preference is not supported", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).PROVIDER_PREFERENCE_ERROR);
|
|
2405
2507
|
}
|
|
2406
2508
|
return web3Provider;
|
|
2407
2509
|
}
|
|
@@ -2419,6 +2521,30 @@ async function $c99672cf2294e839$var$getMetaMaskProvider() {
|
|
|
2419
2521
|
|
|
2420
2522
|
|
|
2421
2523
|
|
|
2524
|
+
var $6f3c55a615003cbf$exports = {};
|
|
2525
|
+
$6f3c55a615003cbf$exports = JSON.parse('[{"connectionProvider":"metamask","icon":"some-icon-url","name":"MetaMask","description":"complete web3 wallet solution","platform":["mobile","desktop"]},{"connectionProvider":"passport","icon":"pp-icon","name":"Passport","description":"Web3 with your email!","platform":["mobile"]},{"connectionProvider":"gamestop","icon":"gme-icon","name":"GameStop","description":"Never stopping the game!","platform":["desktop"]}]');
|
|
2526
|
+
|
|
2527
|
+
|
|
2528
|
+
async function $5cdde2ffe6360fec$export$a822caa90d7eef09({ type: type = (exports.WalletFilterTypes).ALL , exclude: exclude }) {
|
|
2529
|
+
// todo:For async API call, use the CheckoutError with errorType:API_CALL_ERROR?? or any other
|
|
2530
|
+
const filteredWalletsList = ((/*@__PURE__*/$parcel$interopDefault($6f3c55a615003cbf$exports))).filter((wallet)=>{
|
|
2531
|
+
const walletNotExcluded = !exclude?.map((excludeWallet)=>excludeWallet.connectionProvider).includes(wallet.connectionProvider);
|
|
2532
|
+
const allowAllWallets = type === (exports.WalletFilterTypes).ALL;
|
|
2533
|
+
const walletsAllowedForType = wallet.platform.includes(type);
|
|
2534
|
+
return walletNotExcluded && (allowAllWallets || walletsAllowedForType);
|
|
2535
|
+
}).map((wallet)=>{
|
|
2536
|
+
const { platform: platform , ...walletInfo } = wallet;
|
|
2537
|
+
return walletInfo;
|
|
2538
|
+
});
|
|
2539
|
+
return {
|
|
2540
|
+
wallets: filteredWalletsList
|
|
2541
|
+
};
|
|
2542
|
+
}
|
|
2543
|
+
|
|
2544
|
+
|
|
2545
|
+
|
|
2546
|
+
|
|
2547
|
+
|
|
2422
2548
|
|
|
2423
2549
|
const $dbe95599a4661140$export$8e0e7ffc78696d30 = async (params)=>{
|
|
2424
2550
|
const { provider: provider , transaction: transaction } = params;
|
|
@@ -2441,14 +2567,14 @@ class $a8cb37a3fc8eb863$export$1f60ba4ec72508a0 {
|
|
|
2441
2567
|
}
|
|
2442
2568
|
async connect(params) {
|
|
2443
2569
|
const provider = await $c99672cf2294e839$export$fba2f6c3656e07c1(params);
|
|
2444
|
-
const
|
|
2570
|
+
const networkInfo = await $de192de6ef100f9f$export$79f13b4cfaaf0d09(provider);
|
|
2445
2571
|
return {
|
|
2446
2572
|
provider: provider,
|
|
2447
|
-
network:
|
|
2573
|
+
network: networkInfo
|
|
2448
2574
|
};
|
|
2449
2575
|
}
|
|
2450
2576
|
async switchNetwork(params) {
|
|
2451
|
-
return await
|
|
2577
|
+
return await $de192de6ef100f9f$export$b827d9418aeb5dbd(params.provider, params.chainId);
|
|
2452
2578
|
}
|
|
2453
2579
|
async getBalance(params) {
|
|
2454
2580
|
if (!params.contractAddress || params.contractAddress === "") return await $1564e43dde50bb61$export$df96cd8d56be0ab1(params.provider, params.walletAddress);
|
|
@@ -2457,12 +2583,21 @@ class $a8cb37a3fc8eb863$export$1f60ba4ec72508a0 {
|
|
|
2457
2583
|
async getAllBalances(params) {
|
|
2458
2584
|
return $1564e43dde50bb61$export$fee49741664a4d7e(params.provider, params.walletAddress, params.chainId);
|
|
2459
2585
|
}
|
|
2460
|
-
|
|
2461
|
-
return $
|
|
2586
|
+
async getNetworkAllowList(params) {
|
|
2587
|
+
return await $de192de6ef100f9f$export$3043f6442a9ef563(params);
|
|
2588
|
+
}
|
|
2589
|
+
async getTokenAllowList(params) {
|
|
2590
|
+
return await $efe60cea83bfc4e8$export$473cec51305fdae8(params);
|
|
2591
|
+
}
|
|
2592
|
+
async getWalletsAllowList(params) {
|
|
2593
|
+
return await $5cdde2ffe6360fec$export$a822caa90d7eef09(params);
|
|
2462
2594
|
}
|
|
2463
2595
|
async sendTransaction(params) {
|
|
2464
2596
|
return await $dbe95599a4661140$export$8e0e7ffc78696d30(params);
|
|
2465
2597
|
}
|
|
2598
|
+
async getNetworkInfo(params) {
|
|
2599
|
+
return await $de192de6ef100f9f$export$79f13b4cfaaf0d09(params.provider);
|
|
2600
|
+
}
|
|
2466
2601
|
}
|
|
2467
2602
|
|
|
2468
2603
|
function $parcel$export(e, n, v, s) {
|
|
@@ -2488,6 +2623,7 @@ exports.ConnectEventType = void 0;
|
|
|
2488
2623
|
(function(ConnectEventType) {
|
|
2489
2624
|
ConnectEventType["SUCCESS"] = "success";
|
|
2490
2625
|
ConnectEventType["FAILURE"] = "failure";
|
|
2626
|
+
ConnectEventType["CLOSE_WIDGET"] = "close-widget";
|
|
2491
2627
|
})(exports.ConnectEventType || (exports.ConnectEventType = {}));
|
|
2492
2628
|
|
|
2493
2629
|
|
|
@@ -2555,12 +2691,12 @@ exports.WidgetTheme = void 0;
|
|
|
2555
2691
|
})(exports.WidgetTheme || (exports.WidgetTheme = {}));
|
|
2556
2692
|
|
|
2557
2693
|
exports.Checkout = $a8cb37a3fc8eb863$export$1f60ba4ec72508a0;
|
|
2558
|
-
exports.Config = Config;
|
|
2559
|
-
exports.Configuration = Configuration;
|
|
2560
2694
|
exports.GenericIMXProvider = GenericIMXProvider;
|
|
2695
|
+
exports.ImmutableConfiguration = ImmutableConfiguration;
|
|
2561
2696
|
exports.MetaMaskIMXProvider = MetaMaskIMXProvider;
|
|
2562
|
-
exports.PRODUCTION = PRODUCTION;
|
|
2563
2697
|
exports.Passport = Passport;
|
|
2698
|
+
exports.PassportConfiguration = PassportConfiguration;
|
|
2564
2699
|
exports.PassportError = PassportError;
|
|
2565
|
-
exports.
|
|
2700
|
+
exports.ProviderConfiguration = ProviderConfiguration;
|
|
2566
2701
|
exports.StarkExAPIFactory = StarkExAPIFactory;
|
|
2702
|
+
exports.StarkExConfiguration = StarkExConfiguration;
|