@imtbl/sdk 0.17.2 → 0.17.4
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/blockchain_data.js +1 -1
- package/dist/browser/checkout.js +2 -2
- package/dist/checkout_sdk.d.ts +87 -2
- package/dist/checkout_sdk.js +242 -118
- package/dist/checkout_widgets.d.ts +74 -6
- package/dist/checkout_widgets.js +44 -2
- package/dist/immutablex_client.js +1 -1
- package/dist/index.browser.js +6 -6
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +289 -120
- package/dist/index.d.ts +177 -6
- package/dist/index.js +289 -120
- package/dist/passport.js +2 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2724,7 +2724,7 @@ class MultiRollupApiClients {
|
|
|
2724
2724
|
}
|
|
2725
2725
|
|
|
2726
2726
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
2727
|
-
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.17.
|
|
2727
|
+
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.17.4' };
|
|
2728
2728
|
const createConfig = ({ basePath, headers, }) => {
|
|
2729
2729
|
if (!basePath.trim()) {
|
|
2730
2730
|
throw Error('basePath can not be empty');
|
|
@@ -2784,7 +2784,7 @@ class APIError extends Error {
|
|
|
2784
2784
|
|
|
2785
2785
|
/* eslint-disable implicit-arrow-linebreak */
|
|
2786
2786
|
const defaultHeaders = {
|
|
2787
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.17.
|
|
2787
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.17.4',
|
|
2788
2788
|
};
|
|
2789
2789
|
/**
|
|
2790
2790
|
* createAPIConfiguration to create a custom Configuration
|
|
@@ -3070,7 +3070,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
3070
3070
|
chainID,
|
|
3071
3071
|
coreContractAddress,
|
|
3072
3072
|
registrationContractAddress,
|
|
3073
|
-
sdkVersion: 'ts-immutable-sdk-0.17.
|
|
3073
|
+
sdkVersion: 'ts-immutable-sdk-0.17.4',
|
|
3074
3074
|
});
|
|
3075
3075
|
/**
|
|
3076
3076
|
* Sets `sdkVersion` at the time of build
|
|
@@ -27334,6 +27334,7 @@ class Exchange {
|
|
|
27334
27334
|
|
|
27335
27335
|
|
|
27336
27336
|
|
|
27337
|
+
|
|
27337
27338
|
var $aa144554f9ef124b$export$226b052ecb8ca80;
|
|
27338
27339
|
(function(BuyStatusType) {
|
|
27339
27340
|
BuyStatusType["SUCCESS"] = "SUCCESS";
|
|
@@ -27374,6 +27375,10 @@ var $0472f23319457bfb$export$b874c6b1dfe85e02;
|
|
|
27374
27375
|
})($0472f23319457bfb$export$b874c6b1dfe85e02 || ($0472f23319457bfb$export$b874c6b1dfe85e02 = {}));
|
|
27375
27376
|
|
|
27376
27377
|
|
|
27378
|
+
var $bc2bfebf768286d3$export$8cb0af6b2bed4b64;
|
|
27379
|
+
(function(OnRampProvider) {
|
|
27380
|
+
OnRampProvider["TRANSAK"] = "201811419111";
|
|
27381
|
+
})($bc2bfebf768286d3$export$8cb0af6b2bed4b64 || ($bc2bfebf768286d3$export$8cb0af6b2bed4b64 = {}));
|
|
27377
27382
|
|
|
27378
27383
|
|
|
27379
27384
|
|
|
@@ -27405,6 +27410,7 @@ var $08d5ddc39acd6833$export$fd9b17d87f4121d2;
|
|
|
27405
27410
|
TokenFilterTypes["ALL"] = "all";
|
|
27406
27411
|
TokenFilterTypes["SWAP"] = "swap";
|
|
27407
27412
|
TokenFilterTypes["BRIDGE"] = "bridge";
|
|
27413
|
+
TokenFilterTypes["ONRAMP"] = "onramp";
|
|
27408
27414
|
})($08d5ddc39acd6833$export$fd9b17d87f4121d2 || ($08d5ddc39acd6833$export$fd9b17d87f4121d2 = {}));
|
|
27409
27415
|
|
|
27410
27416
|
|
|
@@ -27464,11 +27470,9 @@ const $d85ad1457a3f1a83$export$161d4a74df65fc08 = {
|
|
|
27464
27470
|
const $d85ad1457a3f1a83$export$72176e2233d7d5d = true;
|
|
27465
27471
|
const $d85ad1457a3f1a83$export$566b5975cc83d6b4 = true;
|
|
27466
27472
|
const $d85ad1457a3f1a83$export$261cde2078dba35b = true;
|
|
27467
|
-
const $d85ad1457a3f1a83$export$
|
|
27468
|
-
[($
|
|
27469
|
-
|
|
27470
|
-
nativeToken: $d85ad1457a3f1a83$var$ZKEVM_NATIVE_TOKEN
|
|
27471
|
-
}
|
|
27473
|
+
const $d85ad1457a3f1a83$export$f6043d7fce62d71b = {
|
|
27474
|
+
[(Environment$1).SANDBOX]: "https://global-stg.transak.com",
|
|
27475
|
+
[(Environment$1).PRODUCTION]: "https://global.transak.com/"
|
|
27472
27476
|
};
|
|
27473
27477
|
const $d85ad1457a3f1a83$export$6f24f3cef7d501c4 = new Map([
|
|
27474
27478
|
[
|
|
@@ -27563,6 +27567,16 @@ const $d85ad1457a3f1a83$export$3a9ebede6a150274 = new Map([
|
|
|
27563
27567
|
}
|
|
27564
27568
|
]
|
|
27565
27569
|
]);
|
|
27570
|
+
const $d85ad1457a3f1a83$export$fc55ed5a42b458ba = {
|
|
27571
|
+
[($0472f23319457bfb$export$c06e1e7429de6283).IMTBL_ZKEVM_TESTNET]: {
|
|
27572
|
+
url: "https://explorer.testnet.immutable.com",
|
|
27573
|
+
nativeToken: $d85ad1457a3f1a83$export$3e81fc0987227f10.get(($0472f23319457bfb$export$c06e1e7429de6283).IMTBL_ZKEVM_TESTNET).nativeCurrency
|
|
27574
|
+
},
|
|
27575
|
+
[($0472f23319457bfb$export$c06e1e7429de6283).IMTBL_ZKEVM_MAINNET]: {
|
|
27576
|
+
url: "https://explorer.mainnet.immutable.com",
|
|
27577
|
+
nativeToken: $d85ad1457a3f1a83$export$6f24f3cef7d501c4.get(($0472f23319457bfb$export$c06e1e7429de6283).IMTBL_ZKEVM_MAINNET).nativeCurrency
|
|
27578
|
+
}
|
|
27579
|
+
};
|
|
27566
27580
|
const $d85ad1457a3f1a83$export$db5daa1b5156ccfe = [
|
|
27567
27581
|
{
|
|
27568
27582
|
constant: true,
|
|
@@ -27776,6 +27790,12 @@ var $4b58188d47aafe8d$export$537fa3efd10ed435;
|
|
|
27776
27790
|
})($4b58188d47aafe8d$export$537fa3efd10ed435 || ($4b58188d47aafe8d$export$537fa3efd10ed435 = {}));
|
|
27777
27791
|
|
|
27778
27792
|
|
|
27793
|
+
var $e055e79256bbc1dd$export$80f4da0d409a629d;
|
|
27794
|
+
(function(ExchangeType) {
|
|
27795
|
+
ExchangeType["ONRAMP"] = "onramp";
|
|
27796
|
+
})($e055e79256bbc1dd$export$80f4da0d409a629d || ($e055e79256bbc1dd$export$80f4da0d409a629d = {}));
|
|
27797
|
+
|
|
27798
|
+
|
|
27779
27799
|
|
|
27780
27800
|
|
|
27781
27801
|
/**
|
|
@@ -27987,8 +28007,118 @@ async function $de192de6ef100f9f$export$b827d9418aeb5dbd(config, web3Provider, c
|
|
|
27987
28007
|
|
|
27988
28008
|
|
|
27989
28009
|
|
|
28010
|
+
|
|
28011
|
+
|
|
28012
|
+
|
|
28013
|
+
|
|
28014
|
+
|
|
28015
|
+
class $a492ee374ae7b613$export$d902b56530cd5f87 {
|
|
28016
|
+
isDevelopment;
|
|
28017
|
+
isProduction;
|
|
28018
|
+
configCache;
|
|
28019
|
+
tokensCache;
|
|
28020
|
+
constructor(params){
|
|
28021
|
+
this.isDevelopment = params.isDevelopment;
|
|
28022
|
+
this.isProduction = params.isProduction;
|
|
28023
|
+
}
|
|
28024
|
+
static async makeHttpRequest(url) {
|
|
28025
|
+
let response;
|
|
28026
|
+
try {
|
|
28027
|
+
response = await (0, globalAxios$1).get(url);
|
|
28028
|
+
} catch (error) {
|
|
28029
|
+
throw new Error(`Error fetching from api: ${error.message}`);
|
|
28030
|
+
}
|
|
28031
|
+
if (response.status !== 200) throw new Error(`Error fetching from api: ${response.status} ${response.statusText}`);
|
|
28032
|
+
return response;
|
|
28033
|
+
}
|
|
28034
|
+
getEndpoint = ()=>{
|
|
28035
|
+
if (this.isDevelopment) return ($d85ad1457a3f1a83$export$161d4a74df65fc08)[$d85ad1457a3f1a83$export$7d3a9eeba384fa59];
|
|
28036
|
+
if (this.isProduction) return ($d85ad1457a3f1a83$export$161d4a74df65fc08)[(Environment$1).PRODUCTION];
|
|
28037
|
+
return ($d85ad1457a3f1a83$export$161d4a74df65fc08)[(Environment$1).SANDBOX];
|
|
28038
|
+
};
|
|
28039
|
+
async loadConfig() {
|
|
28040
|
+
if (this.configCache) return this.configCache;
|
|
28041
|
+
const response = await $a492ee374ae7b613$export$d902b56530cd5f87.makeHttpRequest(`${this.getEndpoint()}/v1/config`);
|
|
28042
|
+
this.configCache = response.data;
|
|
28043
|
+
return this.configCache;
|
|
28044
|
+
}
|
|
28045
|
+
async loadConfigTokens() {
|
|
28046
|
+
if (this.tokensCache) return this.tokensCache;
|
|
28047
|
+
const response = await $a492ee374ae7b613$export$d902b56530cd5f87.makeHttpRequest(`${this.getEndpoint()}/v1/config/tokens`);
|
|
28048
|
+
this.tokensCache = response.data;
|
|
28049
|
+
return this.tokensCache;
|
|
28050
|
+
}
|
|
28051
|
+
async getConfig(key) {
|
|
28052
|
+
const config = await this.loadConfig();
|
|
28053
|
+
if (!config) return undefined;
|
|
28054
|
+
if (!key) return config;
|
|
28055
|
+
return config[key];
|
|
28056
|
+
}
|
|
28057
|
+
async getTokensConfig(chainId) {
|
|
28058
|
+
const config = await this.loadConfigTokens();
|
|
28059
|
+
if (!config || !config[chainId]) return {};
|
|
28060
|
+
return config[chainId] ?? [];
|
|
28061
|
+
}
|
|
28062
|
+
}
|
|
28063
|
+
|
|
28064
|
+
|
|
28065
|
+
class $4013c5c91bb535f6$export$6ad73ea7e1b6f37f extends Error {
|
|
28066
|
+
message;
|
|
28067
|
+
constructor(message){
|
|
28068
|
+
super(message);
|
|
28069
|
+
this.message = message;
|
|
28070
|
+
}
|
|
28071
|
+
}
|
|
28072
|
+
const $4013c5c91bb535f6$var$networkMap = (prod, dev)=>{
|
|
28073
|
+
if (dev) return $d85ad1457a3f1a83$export$3a9ebede6a150274;
|
|
28074
|
+
if (prod) return $d85ad1457a3f1a83$export$6f24f3cef7d501c4;
|
|
28075
|
+
return $d85ad1457a3f1a83$export$3e81fc0987227f10;
|
|
28076
|
+
};
|
|
28077
|
+
const $4013c5c91bb535f6$export$9b794d067cdd1af6 = (config)=>{
|
|
28078
|
+
// DevMode and Sandbox will both use Sepolia.
|
|
28079
|
+
if (!config.isProduction) return ($0472f23319457bfb$export$c06e1e7429de6283).SEPOLIA;
|
|
28080
|
+
return ($0472f23319457bfb$export$c06e1e7429de6283).ETHEREUM;
|
|
28081
|
+
};
|
|
28082
|
+
const $4013c5c91bb535f6$export$c9af4e4b001c6476 = (config)=>{
|
|
28083
|
+
if (config.isDevelopment) return ($0472f23319457bfb$export$c06e1e7429de6283).IMTBL_ZKEVM_DEVNET;
|
|
28084
|
+
if (config.isProduction) return ($0472f23319457bfb$export$c06e1e7429de6283).IMTBL_ZKEVM_MAINNET;
|
|
28085
|
+
return ($0472f23319457bfb$export$c06e1e7429de6283).IMTBL_ZKEVM_TESTNET;
|
|
28086
|
+
};
|
|
28087
|
+
class $4013c5c91bb535f6$export$4823433c4a67bbc6 {
|
|
28088
|
+
// This is a hidden feature that is only available
|
|
28089
|
+
// when building the project from source code.
|
|
28090
|
+
// This will be used to get around the lack of
|
|
28091
|
+
// Environment.DEVELOPMENT
|
|
28092
|
+
isDevelopment = false;
|
|
28093
|
+
isProduction;
|
|
28094
|
+
isOnRampEnabled;
|
|
28095
|
+
isSwapEnabled;
|
|
28096
|
+
isBridgeEnabled;
|
|
28097
|
+
remote;
|
|
28098
|
+
environment;
|
|
28099
|
+
networkMap;
|
|
28100
|
+
constructor(config){
|
|
28101
|
+
if (!Object.values((Environment$1)).includes(config.baseConfig.environment)) throw new $4013c5c91bb535f6$export$6ad73ea7e1b6f37f("Invalid checkout configuration of environment");
|
|
28102
|
+
this.environment = config.baseConfig.environment;
|
|
28103
|
+
// Developer mode will super set any environment configuration
|
|
28104
|
+
this.isProduction = !this.isDevelopment && this.environment === (Environment$1).PRODUCTION;
|
|
28105
|
+
this.isOnRampEnabled = config.isOnRampEnabled ?? ($d85ad1457a3f1a83$export$72176e2233d7d5d);
|
|
28106
|
+
this.isSwapEnabled = config.isSwapEnabled ?? ($d85ad1457a3f1a83$export$566b5975cc83d6b4);
|
|
28107
|
+
this.isBridgeEnabled = config.isBridgeEnabled ?? ($d85ad1457a3f1a83$export$261cde2078dba35b);
|
|
28108
|
+
this.networkMap = $4013c5c91bb535f6$var$networkMap(this.isProduction, this.isDevelopment);
|
|
28109
|
+
this.remote = new ($a492ee374ae7b613$export$d902b56530cd5f87)({
|
|
28110
|
+
isDevelopment: this.isDevelopment,
|
|
28111
|
+
isProduction: this.isProduction
|
|
28112
|
+
});
|
|
28113
|
+
}
|
|
28114
|
+
}
|
|
28115
|
+
|
|
28116
|
+
|
|
28117
|
+
|
|
28118
|
+
|
|
27990
28119
|
const $efe60cea83bfc4e8$export$473cec51305fdae8 = async (config, { type: type = ($08d5ddc39acd6833$export$fd9b17d87f4121d2).ALL, chainId: chainId, exclude: exclude })=>{
|
|
27991
28120
|
let tokens = [];
|
|
28121
|
+
let onRampConfig;
|
|
27992
28122
|
switch(type){
|
|
27993
28123
|
case ($08d5ddc39acd6833$export$fd9b17d87f4121d2).SWAP:
|
|
27994
28124
|
// Fetch tokens from dex-tokens config because
|
|
@@ -27996,10 +28126,16 @@ const $efe60cea83bfc4e8$export$473cec51305fdae8 = async (config, { type: type =
|
|
|
27996
28126
|
// legal reasons.
|
|
27997
28127
|
tokens = (await config.remote.getConfig("dex")).tokens || [];
|
|
27998
28128
|
break;
|
|
28129
|
+
case ($08d5ddc39acd6833$export$fd9b17d87f4121d2).ONRAMP:
|
|
28130
|
+
onRampConfig = await config.remote.getConfig("onramp");
|
|
28131
|
+
// Only using Transak as it's the only on-ramp provider at the moment
|
|
28132
|
+
if (!onRampConfig) tokens = [];
|
|
28133
|
+
tokens = onRampConfig[($bc2bfebf768286d3$export$8cb0af6b2bed4b64).TRANSAK]?.tokens || [];
|
|
28134
|
+
break;
|
|
27999
28135
|
case ($08d5ddc39acd6833$export$fd9b17d87f4121d2).BRIDGE:
|
|
28000
28136
|
case ($08d5ddc39acd6833$export$fd9b17d87f4121d2).ALL:
|
|
28001
28137
|
default:
|
|
28002
|
-
tokens = (await config.remote.getTokensConfig(chainId)).allowed;
|
|
28138
|
+
tokens = (await config.remote.getTokensConfig(chainId || ($4013c5c91bb535f6$export$9b794d067cdd1af6)(config))).allowed;
|
|
28003
28139
|
}
|
|
28004
28140
|
if (!exclude || exclude?.length === 0) return {
|
|
28005
28141
|
tokens: tokens
|
|
@@ -28215,7 +28351,14 @@ const $1564e43dde50bb61$export$8c978679845804d4 = async (walletAddress, chainId,
|
|
|
28215
28351
|
items.push(...resp.items);
|
|
28216
28352
|
}while (resp.next_page_params);
|
|
28217
28353
|
} catch (err) {
|
|
28218
|
-
|
|
28354
|
+
// In case of a 404, the wallet is a new wallet that hasn't been indexed by
|
|
28355
|
+
// the Blockscout just yet. This happens when a wallet hasn't had any
|
|
28356
|
+
// activity on the chain. In this case, simply ignore the error and return
|
|
28357
|
+
// no currencies.
|
|
28358
|
+
// In case of a malformed wallet address, Blockscout returns a 422, which
|
|
28359
|
+
// means we are safe to assume that a 404 is a missing wallet due to inactivity
|
|
28360
|
+
// or simply an incorrect wallet address was provided.
|
|
28361
|
+
if (err?.code !== (globalAxios$1.HttpStatusCode).NotFound) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)(err.message || "InternalServerError | getTokensByWalletAddress", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).GET_INDEXER_BALANCE_ERROR, err);
|
|
28219
28362
|
}
|
|
28220
28363
|
try {
|
|
28221
28364
|
const respNative = await $1564e43dde50bb61$var$blockscoutClient.getNativeTokenByWalletAddress({
|
|
@@ -28223,7 +28366,14 @@ const $1564e43dde50bb61$export$8c978679845804d4 = async (walletAddress, chainId,
|
|
|
28223
28366
|
});
|
|
28224
28367
|
items.push(respNative);
|
|
28225
28368
|
} catch (err) {
|
|
28226
|
-
|
|
28369
|
+
// In case of a 404, the wallet is a new wallet that hasn't been indexed by
|
|
28370
|
+
// the Blockscout just yet. This happens when a wallet hasn't had any
|
|
28371
|
+
// activity on the chain. In this case, simply ignore the error and return
|
|
28372
|
+
// no currencies.
|
|
28373
|
+
// In case of a malformed wallet address, Blockscout returns a 422, which
|
|
28374
|
+
// means we are safe to assume that a 404 is a missing wallet due to inactivity
|
|
28375
|
+
// or simply an incorrect wallet address was provided.
|
|
28376
|
+
if (err?.code !== (globalAxios$1.HttpStatusCode).NotFound) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)(err.message || "InternalServerError | getNativeTokenByWalletAddress", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).GET_INDEXER_BALANCE_ERROR, err);
|
|
28227
28377
|
}
|
|
28228
28378
|
return {
|
|
28229
28379
|
balances: items.map((item)=>{
|
|
@@ -28529,114 +28679,6 @@ async function $67fc622a2b913d5f$export$c60ce6c6a92bc2ff(config) {
|
|
|
28529
28679
|
|
|
28530
28680
|
|
|
28531
28681
|
|
|
28532
|
-
|
|
28533
|
-
|
|
28534
|
-
|
|
28535
|
-
|
|
28536
|
-
class $a492ee374ae7b613$export$d902b56530cd5f87 {
|
|
28537
|
-
isDevelopment;
|
|
28538
|
-
isProduction;
|
|
28539
|
-
configCache;
|
|
28540
|
-
tokensCache;
|
|
28541
|
-
constructor(params){
|
|
28542
|
-
this.isDevelopment = params.isDevelopment;
|
|
28543
|
-
this.isProduction = params.isProduction;
|
|
28544
|
-
}
|
|
28545
|
-
static async makeHttpRequest(url) {
|
|
28546
|
-
let response;
|
|
28547
|
-
try {
|
|
28548
|
-
response = await (0, globalAxios$1).get(url);
|
|
28549
|
-
} catch (error) {
|
|
28550
|
-
throw new Error(`Error fetching from api: ${error.message}`);
|
|
28551
|
-
}
|
|
28552
|
-
if (response.status !== 200) throw new Error(`Error fetching from api: ${response.status} ${response.statusText}`);
|
|
28553
|
-
return response;
|
|
28554
|
-
}
|
|
28555
|
-
getEndpoint = ()=>{
|
|
28556
|
-
if (this.isDevelopment) return ($d85ad1457a3f1a83$export$161d4a74df65fc08)[$d85ad1457a3f1a83$export$7d3a9eeba384fa59];
|
|
28557
|
-
if (this.isProduction) return ($d85ad1457a3f1a83$export$161d4a74df65fc08)[(Environment$1).PRODUCTION];
|
|
28558
|
-
return ($d85ad1457a3f1a83$export$161d4a74df65fc08)[(Environment$1).SANDBOX];
|
|
28559
|
-
};
|
|
28560
|
-
async loadConfig() {
|
|
28561
|
-
if (this.configCache) return this.configCache;
|
|
28562
|
-
const response = await $a492ee374ae7b613$export$d902b56530cd5f87.makeHttpRequest(`${this.getEndpoint()}/v1/config`);
|
|
28563
|
-
this.configCache = response.data;
|
|
28564
|
-
return this.configCache;
|
|
28565
|
-
}
|
|
28566
|
-
async loadConfigTokens() {
|
|
28567
|
-
if (this.tokensCache) return this.tokensCache;
|
|
28568
|
-
const response = await $a492ee374ae7b613$export$d902b56530cd5f87.makeHttpRequest(`${this.getEndpoint()}/v1/config/tokens`);
|
|
28569
|
-
this.tokensCache = response.data;
|
|
28570
|
-
return this.tokensCache;
|
|
28571
|
-
}
|
|
28572
|
-
async getConfig(key) {
|
|
28573
|
-
const config = await this.loadConfig();
|
|
28574
|
-
if (!config) return undefined;
|
|
28575
|
-
if (!key) return config;
|
|
28576
|
-
return config[key];
|
|
28577
|
-
}
|
|
28578
|
-
async getTokensConfig(chainId) {
|
|
28579
|
-
const config = await this.loadConfigTokens();
|
|
28580
|
-
if (!config || !config[chainId]) return {};
|
|
28581
|
-
return config[chainId] ?? [];
|
|
28582
|
-
}
|
|
28583
|
-
}
|
|
28584
|
-
|
|
28585
|
-
|
|
28586
|
-
class $4013c5c91bb535f6$export$6ad73ea7e1b6f37f extends Error {
|
|
28587
|
-
message;
|
|
28588
|
-
constructor(message){
|
|
28589
|
-
super(message);
|
|
28590
|
-
this.message = message;
|
|
28591
|
-
}
|
|
28592
|
-
}
|
|
28593
|
-
const $4013c5c91bb535f6$var$networkMap = (prod, dev)=>{
|
|
28594
|
-
if (dev) return $d85ad1457a3f1a83$export$3a9ebede6a150274;
|
|
28595
|
-
if (prod) return $d85ad1457a3f1a83$export$6f24f3cef7d501c4;
|
|
28596
|
-
return $d85ad1457a3f1a83$export$3e81fc0987227f10;
|
|
28597
|
-
};
|
|
28598
|
-
const $4013c5c91bb535f6$export$9b794d067cdd1af6 = (config)=>{
|
|
28599
|
-
// DevMode and Sandbox will both use Sepolia.
|
|
28600
|
-
if (!config.isProduction) return ($0472f23319457bfb$export$c06e1e7429de6283).SEPOLIA;
|
|
28601
|
-
return ($0472f23319457bfb$export$c06e1e7429de6283).ETHEREUM;
|
|
28602
|
-
};
|
|
28603
|
-
const $4013c5c91bb535f6$export$c9af4e4b001c6476 = (config)=>{
|
|
28604
|
-
if (config.isDevelopment) return ($0472f23319457bfb$export$c06e1e7429de6283).IMTBL_ZKEVM_DEVNET;
|
|
28605
|
-
if (config.isProduction) return ($0472f23319457bfb$export$c06e1e7429de6283).IMTBL_ZKEVM_MAINNET;
|
|
28606
|
-
return ($0472f23319457bfb$export$c06e1e7429de6283).IMTBL_ZKEVM_TESTNET;
|
|
28607
|
-
};
|
|
28608
|
-
class $4013c5c91bb535f6$export$4823433c4a67bbc6 {
|
|
28609
|
-
// This is a hidden feature that is only available
|
|
28610
|
-
// when building the project from source code.
|
|
28611
|
-
// This will be used to get around the lack of
|
|
28612
|
-
// Environment.DEVELOPMENT
|
|
28613
|
-
isDevelopment = false;
|
|
28614
|
-
isProduction;
|
|
28615
|
-
isOnRampEnabled;
|
|
28616
|
-
isSwapEnabled;
|
|
28617
|
-
isBridgeEnabled;
|
|
28618
|
-
remote;
|
|
28619
|
-
environment;
|
|
28620
|
-
networkMap;
|
|
28621
|
-
constructor(config){
|
|
28622
|
-
if (!Object.values((Environment$1)).includes(config.baseConfig.environment)) throw new $4013c5c91bb535f6$export$6ad73ea7e1b6f37f("Invalid checkout configuration of environment");
|
|
28623
|
-
this.environment = config.baseConfig.environment;
|
|
28624
|
-
// Developer mode will super set any environment configuration
|
|
28625
|
-
this.isProduction = !this.isDevelopment && this.environment === (Environment$1).PRODUCTION;
|
|
28626
|
-
this.isOnRampEnabled = config.isOnRampEnabled ?? ($d85ad1457a3f1a83$export$72176e2233d7d5d);
|
|
28627
|
-
this.isSwapEnabled = config.isSwapEnabled ?? ($d85ad1457a3f1a83$export$566b5975cc83d6b4);
|
|
28628
|
-
this.isBridgeEnabled = config.isBridgeEnabled ?? ($d85ad1457a3f1a83$export$261cde2078dba35b);
|
|
28629
|
-
this.networkMap = $4013c5c91bb535f6$var$networkMap(this.isProduction, this.isDevelopment);
|
|
28630
|
-
this.remote = new ($a492ee374ae7b613$export$d902b56530cd5f87)({
|
|
28631
|
-
isDevelopment: this.isDevelopment,
|
|
28632
|
-
isProduction: this.isProduction
|
|
28633
|
-
});
|
|
28634
|
-
}
|
|
28635
|
-
}
|
|
28636
|
-
|
|
28637
|
-
|
|
28638
|
-
|
|
28639
|
-
|
|
28640
28682
|
const $2e7bf45a7c9a9570$var$DUMMY_WALLET_ADDRESS = "0x0000000000000000000000000000000000000001";
|
|
28641
28683
|
const $2e7bf45a7c9a9570$var$DEFAULT_TOKEN_DECIMALS = 18;
|
|
28642
28684
|
async function $2e7bf45a7c9a9570$var$getTokenInfoByAddress(config, tokenAddress, chainId, provider) {
|
|
@@ -29974,6 +30016,49 @@ const $9085b221b72ac69e$export$e761f9e0703de895 = async (config, provider, id, c
|
|
|
29974
30016
|
|
|
29975
30017
|
|
|
29976
30018
|
|
|
30019
|
+
|
|
30020
|
+
|
|
30021
|
+
class $a77d203f701a3b72$export$1453e9b801542ef4 {
|
|
30022
|
+
config;
|
|
30023
|
+
/**
|
|
30024
|
+
* Constructs a new instance of the FiatRampService class.
|
|
30025
|
+
* @param {CheckoutConfiguration} config - The config required for the FiatRampService.
|
|
30026
|
+
*/ constructor(config){
|
|
30027
|
+
this.config = config;
|
|
30028
|
+
}
|
|
30029
|
+
async feeEstimate() {
|
|
30030
|
+
const config = await this.config.remote.getConfig("onramp");
|
|
30031
|
+
return config[($bc2bfebf768286d3$export$8cb0af6b2bed4b64).TRANSAK]?.fees;
|
|
30032
|
+
}
|
|
30033
|
+
async createWidgetUrl(params) {
|
|
30034
|
+
return await this.getTransakWidgetUrl(params);
|
|
30035
|
+
}
|
|
30036
|
+
async getTransakWidgetUrl(params) {
|
|
30037
|
+
let widgetUrl = `${($d85ad1457a3f1a83$export$f6043d7fce62d71b)[this.config.environment]}?`;
|
|
30038
|
+
const onRampConfig = await this.config.remote.getConfig("onramp");
|
|
30039
|
+
const apiKey = onRampConfig[($bc2bfebf768286d3$export$8cb0af6b2bed4b64).TRANSAK].publishableApiKey;
|
|
30040
|
+
const transakPublishableKey = `apiKey=${apiKey}`;
|
|
30041
|
+
const zkevmNetwork = "network=immutablezkevm";
|
|
30042
|
+
const defaultPaymentMethod = "defaultPaymentMethod=credit_debit_card";
|
|
30043
|
+
const disableBankTransfer = "disablePaymentMethods=sepa_bank_transfer,gbp_bank_transfer,pm_cash_app,pm_jwire,pm_paymaya,pm_bpi,pm_ubp,pm_grabpay,pm_shopeepay,pm_gcash,pm_pix,pm_astropay,pm_pse,inr_bank_transfer";
|
|
30044
|
+
const productsAvailed = "productsAvailed=buy";
|
|
30045
|
+
const exchangeScreenTitle = "exchangeScreenTitle=Buy";
|
|
30046
|
+
const themeColor = "themeColor=0D0D0D";
|
|
30047
|
+
widgetUrl += `${transakPublishableKey}&` + `${zkevmNetwork}&` + `${defaultPaymentMethod}&` + `${disableBankTransfer}&` + `${productsAvailed}&` + `${exchangeScreenTitle}&` + `${themeColor}`;
|
|
30048
|
+
if (params.isPassport && params.email) {
|
|
30049
|
+
const encodedEmail = encodeURIComponent(params.email);
|
|
30050
|
+
widgetUrl += `&email=${encodedEmail}&isAutoFillUserData=true&disableWalletAddressForm=true`;
|
|
30051
|
+
}
|
|
30052
|
+
if (params.tokenAmount && params.tokenSymbol) widgetUrl += `&defaultCryptoAmount=${params.tokenAmount}&cryptoCurrencyCode=${params.tokenSymbol}`;
|
|
30053
|
+
else widgetUrl += "&defaultCryptoCurrency=IMX";
|
|
30054
|
+
if (params.walletAddress) widgetUrl += `&walletAddress=${params.walletAddress}`;
|
|
30055
|
+
return widgetUrl;
|
|
30056
|
+
}
|
|
30057
|
+
}
|
|
30058
|
+
|
|
30059
|
+
|
|
30060
|
+
|
|
30061
|
+
|
|
29977
30062
|
const $a8cb37a3fc8eb863$var$SANDBOX_CONFIGURATION = {
|
|
29978
30063
|
baseConfig: {
|
|
29979
30064
|
environment: (Environment$1).SANDBOX
|
|
@@ -29981,12 +30066,14 @@ const $a8cb37a3fc8eb863$var$SANDBOX_CONFIGURATION = {
|
|
|
29981
30066
|
};
|
|
29982
30067
|
class $a8cb37a3fc8eb863$export$1f60ba4ec72508a0 {
|
|
29983
30068
|
config;
|
|
30069
|
+
fiatRampService;
|
|
29984
30070
|
readOnlyProviders;
|
|
29985
30071
|
/**
|
|
29986
30072
|
* Constructs a new instance of the CheckoutModule class.
|
|
29987
30073
|
* @param {CheckoutModuleConfiguration} [config=SANDBOX_CONFIGURATION] - The configuration object for the CheckoutModule.
|
|
29988
30074
|
*/ constructor(config = $a8cb37a3fc8eb863$var$SANDBOX_CONFIGURATION){
|
|
29989
30075
|
this.config = new ($4013c5c91bb535f6$export$4823433c4a67bbc6)(config);
|
|
30076
|
+
this.fiatRampService = new ($a77d203f701a3b72$export$1453e9b801542ef4)(this.config);
|
|
29990
30077
|
this.readOnlyProviders = new Map();
|
|
29991
30078
|
}
|
|
29992
30079
|
/**
|
|
@@ -30147,6 +30234,43 @@ class $a8cb37a3fc8eb863$export$1f60ba4ec72508a0 {
|
|
|
30147
30234
|
this.readOnlyProviders = await ($0e0060cb42e136d2$export$339cb2be73677b30)(this.config, this.readOnlyProviders);
|
|
30148
30235
|
return await $2e7bf45a7c9a9570$export$942c8de7174809fc(params, this.readOnlyProviders, this.config);
|
|
30149
30236
|
}
|
|
30237
|
+
/**
|
|
30238
|
+
* Creates and returns a URL for the fiat ramp widget.
|
|
30239
|
+
* @param {FiatRampParams} params - The parameters for creating the url.
|
|
30240
|
+
* @returns {Promise<string>} - A promise that resolves to a string url.
|
|
30241
|
+
*/ async createFiatRampUrl(params) {
|
|
30242
|
+
let tokenAmount;
|
|
30243
|
+
let tokenSymbol = "IMX";
|
|
30244
|
+
let email;
|
|
30245
|
+
const walletAddress = await params.web3Provider.getSigner().getAddress();
|
|
30246
|
+
const isPassport = params.web3Provider.provider?.isPassport || false;
|
|
30247
|
+
if (isPassport && params.passport) {
|
|
30248
|
+
const userInfo = await params.passport.getUserInfo();
|
|
30249
|
+
email = userInfo?.email;
|
|
30250
|
+
}
|
|
30251
|
+
const tokenList = await $efe60cea83bfc4e8$export$473cec51305fdae8(this.config, {
|
|
30252
|
+
type: ($08d5ddc39acd6833$export$fd9b17d87f4121d2).ONRAMP
|
|
30253
|
+
});
|
|
30254
|
+
const token = tokenList.tokens.find((t)=>t.address?.toLowerCase() === params.tokenAddress?.toLowerCase());
|
|
30255
|
+
if (token) {
|
|
30256
|
+
tokenAmount = params.tokenAmount;
|
|
30257
|
+
tokenSymbol = token.symbol;
|
|
30258
|
+
}
|
|
30259
|
+
return await this.fiatRampService.createWidgetUrl({
|
|
30260
|
+
exchangeType: params.exchangeType,
|
|
30261
|
+
isPassport: isPassport,
|
|
30262
|
+
walletAddress: walletAddress,
|
|
30263
|
+
tokenAmount: tokenAmount,
|
|
30264
|
+
tokenSymbol: tokenSymbol,
|
|
30265
|
+
email: email
|
|
30266
|
+
});
|
|
30267
|
+
}
|
|
30268
|
+
/**
|
|
30269
|
+
* Fetches fiat ramp fee estimations.
|
|
30270
|
+
* @returns {Promise<OnRampProviderFees>} - A promise that resolves to OnRampProviderFees.
|
|
30271
|
+
*/ async getExchangeFeeEstimate() {
|
|
30272
|
+
return await this.fiatRampService.feeEstimate();
|
|
30273
|
+
}
|
|
30150
30274
|
}
|
|
30151
30275
|
|
|
30152
30276
|
var checkout_sdk = /*#__PURE__*/Object.freeze({
|
|
@@ -30156,6 +30280,7 @@ var checkout_sdk = /*#__PURE__*/Object.freeze({
|
|
|
30156
30280
|
get ChainName () { return $0472f23319457bfb$export$b874c6b1dfe85e02; },
|
|
30157
30281
|
Checkout: $a8cb37a3fc8eb863$export$1f60ba4ec72508a0,
|
|
30158
30282
|
get CheckoutErrorType () { return $a8bc256d81a5e2c1$export$e3dc0620abde7f5a; },
|
|
30283
|
+
get ExchangeType () { return $e055e79256bbc1dd$export$80f4da0d409a629d; },
|
|
30159
30284
|
get GasEstimateType () { return $de275b98d2b651c3$export$788b1fd17f3dad84; },
|
|
30160
30285
|
get GasTokenType () { return $4b58188d47aafe8d$export$537fa3efd10ed435; },
|
|
30161
30286
|
get ItemType () { return $4b58188d47aafe8d$export$1fc8f52ad1810e52; },
|
|
@@ -30169,7 +30294,7 @@ var checkout_sdk = /*#__PURE__*/Object.freeze({
|
|
|
30169
30294
|
function $parcel$export(e, n, v, s) {
|
|
30170
30295
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
30171
30296
|
}
|
|
30172
|
-
const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.17.
|
|
30297
|
+
const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.17.4";
|
|
30173
30298
|
const $d663162fd5a0853f$export$83bf90b30cdfd29f = ()=>false;
|
|
30174
30299
|
const $d663162fd5a0853f$export$1169f5475725171b = ()=>$d663162fd5a0853f$export$38a083d9fb5551ca;
|
|
30175
30300
|
|
|
@@ -30234,6 +30359,7 @@ var $207ed853f11d19d5$export$5a0ace85cae72d45;
|
|
|
30234
30359
|
IMTBLWidgetEvents["IMTBL_WALLET_WIDGET_EVENT"] = "imtbl-wallet-widget";
|
|
30235
30360
|
IMTBLWidgetEvents["IMTBL_SWAP_WIDGET_EVENT"] = "imtbl-swap-widget";
|
|
30236
30361
|
IMTBLWidgetEvents["IMTBL_BRIDGE_WIDGET_EVENT"] = "imtbl-bridge-widget";
|
|
30362
|
+
IMTBLWidgetEvents["IMTBL_ONRAMP_WIDGET_EVENT"] = "imtbl-onramp-widget";
|
|
30237
30363
|
})($207ed853f11d19d5$export$5a0ace85cae72d45 || ($207ed853f11d19d5$export$5a0ace85cae72d45 = {}));
|
|
30238
30364
|
|
|
30239
30365
|
|
|
@@ -30299,6 +30425,19 @@ $parcel$export($ad06b030b1a3ba34$exports, "OrchestrationEventType", () => $ad06b
|
|
|
30299
30425
|
OrchestrationEventType["REQUEST_BRIDGE"] = "request-bridge";
|
|
30300
30426
|
OrchestrationEventType["REQUEST_ONRAMP"] = "request-onramp";
|
|
30301
30427
|
})($ad06b030b1a3ba34$export$b80d2daf830437b9 || ($ad06b030b1a3ba34$export$b80d2daf830437b9 = {}));
|
|
30428
|
+
|
|
30429
|
+
|
|
30430
|
+
var $d882ddc5600b1284$exports = {};
|
|
30431
|
+
|
|
30432
|
+
$parcel$export($d882ddc5600b1284$exports, "OnRampEventType", () => $d882ddc5600b1284$export$66ec39c0924078d8);
|
|
30433
|
+
/**
|
|
30434
|
+
* Enum of possible OnRamp Widget event types.
|
|
30435
|
+
*/ var $d882ddc5600b1284$export$66ec39c0924078d8;
|
|
30436
|
+
(function(OnRampEventType) {
|
|
30437
|
+
OnRampEventType["CLOSE_WIDGET"] = "close-widget";
|
|
30438
|
+
OnRampEventType["SUCCESS"] = "success";
|
|
30439
|
+
OnRampEventType["FAILURE"] = "failure";
|
|
30440
|
+
})($d882ddc5600b1284$export$66ec39c0924078d8 || ($d882ddc5600b1284$export$66ec39c0924078d8 = {}));
|
|
30302
30441
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
30303
30442
|
|
|
30304
30443
|
var $045213b18e9f1f94$exports = {};
|
|
@@ -30319,6 +30458,7 @@ var $045213b18e9f1f94$export$75be0f6af9650f2c;
|
|
|
30319
30458
|
CheckoutWidgetTagNames["WALLET"] = "imtbl-wallet";
|
|
30320
30459
|
CheckoutWidgetTagNames["SWAP"] = "imtbl-swap";
|
|
30321
30460
|
CheckoutWidgetTagNames["BRIDGE"] = "imtbl-bridge";
|
|
30461
|
+
CheckoutWidgetTagNames["ONRAMP"] = "imtbl-onramp";
|
|
30322
30462
|
})($045213b18e9f1f94$export$75be0f6af9650f2c || ($045213b18e9f1f94$export$75be0f6af9650f2c = {}));
|
|
30323
30463
|
|
|
30324
30464
|
|
|
@@ -30487,6 +30627,33 @@ function $89d55ace0f8f1c07$export$ceaac94f34dba154(props) {
|
|
|
30487
30627
|
});
|
|
30488
30628
|
}
|
|
30489
30629
|
|
|
30630
|
+
|
|
30631
|
+
var $f94f63f2c041a04c$exports = {};
|
|
30632
|
+
|
|
30633
|
+
$parcel$export($f94f63f2c041a04c$exports, "OnRampReact", () => $f94f63f2c041a04c$export$9e363c61ea99bbb4);
|
|
30634
|
+
|
|
30635
|
+
|
|
30636
|
+
|
|
30637
|
+
|
|
30638
|
+
|
|
30639
|
+
function $f94f63f2c041a04c$export$9e363c61ea99bbb4(props) {
|
|
30640
|
+
const { walletProvider: walletProvider, amount: amount, provider: provider, passport: passport, contractAddress: contractAddress } = props;
|
|
30641
|
+
(react.useEffect)(()=>{
|
|
30642
|
+
if (provider) ($77ec335383336bdd$export$931068bc678f0d73)(($045213b18e9f1f94$export$75be0f6af9650f2c).ONRAMP, provider);
|
|
30643
|
+
if (passport) ($b222a8f062090058$export$fae4199086a966a3)(($045213b18e9f1f94$export$75be0f6af9650f2c).ONRAMP, passport);
|
|
30644
|
+
}, [
|
|
30645
|
+
provider,
|
|
30646
|
+
passport
|
|
30647
|
+
]);
|
|
30648
|
+
const config = window.ImtblCheckoutWidgetConfig;
|
|
30649
|
+
return /*#__PURE__*/ (jsxRuntime.jsx)("imtbl-onramp", {
|
|
30650
|
+
widgetConfig: config,
|
|
30651
|
+
walletProvider: walletProvider,
|
|
30652
|
+
amount: amount ?? "",
|
|
30653
|
+
contractAddress: contractAddress ?? ""
|
|
30654
|
+
});
|
|
30655
|
+
}
|
|
30656
|
+
|
|
30490
30657
|
var checkout_widgets = /*#__PURE__*/Object.freeze({
|
|
30491
30658
|
__proto__: null,
|
|
30492
30659
|
get BridgeEventType () { return $15cc9e120aa6f3bf$export$d1bfa21f7c76447a; },
|
|
@@ -30496,6 +30663,8 @@ var checkout_widgets = /*#__PURE__*/Object.freeze({
|
|
|
30496
30663
|
get ConnectEventType () { return $a85ecdbd885c58ad$export$e72e7f9969a47dd3; },
|
|
30497
30664
|
ConnectReact: $f2083cd30e2f5c56$export$49d62957f420a1e2,
|
|
30498
30665
|
get IMTBLWidgetEvents () { return $207ed853f11d19d5$export$5a0ace85cae72d45; },
|
|
30666
|
+
get OnRampEventType () { return $d882ddc5600b1284$export$66ec39c0924078d8; },
|
|
30667
|
+
OnRampReact: $f94f63f2c041a04c$export$9e363c61ea99bbb4,
|
|
30499
30668
|
get OrchestrationEventType () { return $ad06b030b1a3ba34$export$b80d2daf830437b9; },
|
|
30500
30669
|
get SwapEventType () { return $53d219e7f6bf0cd6$export$140a49745ab55563; },
|
|
30501
30670
|
SwapReact: $a4fbb8e3a6aeff58$export$971e031379577f4,
|