@imtbl/sdk 0.17.1 → 0.17.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/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 +217 -112
- 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 +265 -115
- package/dist/index.d.ts +177 -6
- package/dist/index.js +265 -115
- 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.3' };
|
|
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.3',
|
|
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.3',
|
|
3074
3074
|
});
|
|
3075
3075
|
/**
|
|
3076
3076
|
* Sets `sdkVersion` at the time of build
|
|
@@ -27374,6 +27374,10 @@ var $0472f23319457bfb$export$b874c6b1dfe85e02;
|
|
|
27374
27374
|
})($0472f23319457bfb$export$b874c6b1dfe85e02 || ($0472f23319457bfb$export$b874c6b1dfe85e02 = {}));
|
|
27375
27375
|
|
|
27376
27376
|
|
|
27377
|
+
var $bc2bfebf768286d3$export$8cb0af6b2bed4b64;
|
|
27378
|
+
(function(OnRampProvider) {
|
|
27379
|
+
OnRampProvider["TRANSAK"] = "201811419111";
|
|
27380
|
+
})($bc2bfebf768286d3$export$8cb0af6b2bed4b64 || ($bc2bfebf768286d3$export$8cb0af6b2bed4b64 = {}));
|
|
27377
27381
|
|
|
27378
27382
|
|
|
27379
27383
|
|
|
@@ -27405,6 +27409,7 @@ var $08d5ddc39acd6833$export$fd9b17d87f4121d2;
|
|
|
27405
27409
|
TokenFilterTypes["ALL"] = "all";
|
|
27406
27410
|
TokenFilterTypes["SWAP"] = "swap";
|
|
27407
27411
|
TokenFilterTypes["BRIDGE"] = "bridge";
|
|
27412
|
+
TokenFilterTypes["ONRAMP"] = "onramp";
|
|
27408
27413
|
})($08d5ddc39acd6833$export$fd9b17d87f4121d2 || ($08d5ddc39acd6833$export$fd9b17d87f4121d2 = {}));
|
|
27409
27414
|
|
|
27410
27415
|
|
|
@@ -27470,6 +27475,10 @@ const $d85ad1457a3f1a83$export$fc55ed5a42b458ba = {
|
|
|
27470
27475
|
nativeToken: $d85ad1457a3f1a83$var$ZKEVM_NATIVE_TOKEN
|
|
27471
27476
|
}
|
|
27472
27477
|
};
|
|
27478
|
+
const $d85ad1457a3f1a83$export$f6043d7fce62d71b = {
|
|
27479
|
+
[(Environment$1).SANDBOX]: "https://global-stg.transak.com",
|
|
27480
|
+
[(Environment$1).PRODUCTION]: "https://global.transak.com/"
|
|
27481
|
+
};
|
|
27473
27482
|
const $d85ad1457a3f1a83$export$6f24f3cef7d501c4 = new Map([
|
|
27474
27483
|
[
|
|
27475
27484
|
($0472f23319457bfb$export$c06e1e7429de6283).ETHEREUM,
|
|
@@ -27776,6 +27785,12 @@ var $4b58188d47aafe8d$export$537fa3efd10ed435;
|
|
|
27776
27785
|
})($4b58188d47aafe8d$export$537fa3efd10ed435 || ($4b58188d47aafe8d$export$537fa3efd10ed435 = {}));
|
|
27777
27786
|
|
|
27778
27787
|
|
|
27788
|
+
var $e055e79256bbc1dd$export$80f4da0d409a629d;
|
|
27789
|
+
(function(ExchangeType) {
|
|
27790
|
+
ExchangeType["ONRAMP"] = "onramp";
|
|
27791
|
+
})($e055e79256bbc1dd$export$80f4da0d409a629d || ($e055e79256bbc1dd$export$80f4da0d409a629d = {}));
|
|
27792
|
+
|
|
27793
|
+
|
|
27779
27794
|
|
|
27780
27795
|
|
|
27781
27796
|
/**
|
|
@@ -27987,8 +28002,118 @@ async function $de192de6ef100f9f$export$b827d9418aeb5dbd(config, web3Provider, c
|
|
|
27987
28002
|
|
|
27988
28003
|
|
|
27989
28004
|
|
|
28005
|
+
|
|
28006
|
+
|
|
28007
|
+
|
|
28008
|
+
|
|
28009
|
+
|
|
28010
|
+
class $a492ee374ae7b613$export$d902b56530cd5f87 {
|
|
28011
|
+
isDevelopment;
|
|
28012
|
+
isProduction;
|
|
28013
|
+
configCache;
|
|
28014
|
+
tokensCache;
|
|
28015
|
+
constructor(params){
|
|
28016
|
+
this.isDevelopment = params.isDevelopment;
|
|
28017
|
+
this.isProduction = params.isProduction;
|
|
28018
|
+
}
|
|
28019
|
+
static async makeHttpRequest(url) {
|
|
28020
|
+
let response;
|
|
28021
|
+
try {
|
|
28022
|
+
response = await (0, globalAxios$1).get(url);
|
|
28023
|
+
} catch (error) {
|
|
28024
|
+
throw new Error(`Error fetching from api: ${error.message}`);
|
|
28025
|
+
}
|
|
28026
|
+
if (response.status !== 200) throw new Error(`Error fetching from api: ${response.status} ${response.statusText}`);
|
|
28027
|
+
return response;
|
|
28028
|
+
}
|
|
28029
|
+
getEndpoint = ()=>{
|
|
28030
|
+
if (this.isDevelopment) return ($d85ad1457a3f1a83$export$161d4a74df65fc08)[$d85ad1457a3f1a83$export$7d3a9eeba384fa59];
|
|
28031
|
+
if (this.isProduction) return ($d85ad1457a3f1a83$export$161d4a74df65fc08)[(Environment$1).PRODUCTION];
|
|
28032
|
+
return ($d85ad1457a3f1a83$export$161d4a74df65fc08)[(Environment$1).SANDBOX];
|
|
28033
|
+
};
|
|
28034
|
+
async loadConfig() {
|
|
28035
|
+
if (this.configCache) return this.configCache;
|
|
28036
|
+
const response = await $a492ee374ae7b613$export$d902b56530cd5f87.makeHttpRequest(`${this.getEndpoint()}/v1/config`);
|
|
28037
|
+
this.configCache = response.data;
|
|
28038
|
+
return this.configCache;
|
|
28039
|
+
}
|
|
28040
|
+
async loadConfigTokens() {
|
|
28041
|
+
if (this.tokensCache) return this.tokensCache;
|
|
28042
|
+
const response = await $a492ee374ae7b613$export$d902b56530cd5f87.makeHttpRequest(`${this.getEndpoint()}/v1/config/tokens`);
|
|
28043
|
+
this.tokensCache = response.data;
|
|
28044
|
+
return this.tokensCache;
|
|
28045
|
+
}
|
|
28046
|
+
async getConfig(key) {
|
|
28047
|
+
const config = await this.loadConfig();
|
|
28048
|
+
if (!config) return undefined;
|
|
28049
|
+
if (!key) return config;
|
|
28050
|
+
return config[key];
|
|
28051
|
+
}
|
|
28052
|
+
async getTokensConfig(chainId) {
|
|
28053
|
+
const config = await this.loadConfigTokens();
|
|
28054
|
+
if (!config || !config[chainId]) return {};
|
|
28055
|
+
return config[chainId] ?? [];
|
|
28056
|
+
}
|
|
28057
|
+
}
|
|
28058
|
+
|
|
28059
|
+
|
|
28060
|
+
class $4013c5c91bb535f6$export$6ad73ea7e1b6f37f extends Error {
|
|
28061
|
+
message;
|
|
28062
|
+
constructor(message){
|
|
28063
|
+
super(message);
|
|
28064
|
+
this.message = message;
|
|
28065
|
+
}
|
|
28066
|
+
}
|
|
28067
|
+
const $4013c5c91bb535f6$var$networkMap = (prod, dev)=>{
|
|
28068
|
+
if (dev) return $d85ad1457a3f1a83$export$3a9ebede6a150274;
|
|
28069
|
+
if (prod) return $d85ad1457a3f1a83$export$6f24f3cef7d501c4;
|
|
28070
|
+
return $d85ad1457a3f1a83$export$3e81fc0987227f10;
|
|
28071
|
+
};
|
|
28072
|
+
const $4013c5c91bb535f6$export$9b794d067cdd1af6 = (config)=>{
|
|
28073
|
+
// DevMode and Sandbox will both use Sepolia.
|
|
28074
|
+
if (!config.isProduction) return ($0472f23319457bfb$export$c06e1e7429de6283).SEPOLIA;
|
|
28075
|
+
return ($0472f23319457bfb$export$c06e1e7429de6283).ETHEREUM;
|
|
28076
|
+
};
|
|
28077
|
+
const $4013c5c91bb535f6$export$c9af4e4b001c6476 = (config)=>{
|
|
28078
|
+
if (config.isDevelopment) return ($0472f23319457bfb$export$c06e1e7429de6283).IMTBL_ZKEVM_DEVNET;
|
|
28079
|
+
if (config.isProduction) return ($0472f23319457bfb$export$c06e1e7429de6283).IMTBL_ZKEVM_MAINNET;
|
|
28080
|
+
return ($0472f23319457bfb$export$c06e1e7429de6283).IMTBL_ZKEVM_TESTNET;
|
|
28081
|
+
};
|
|
28082
|
+
class $4013c5c91bb535f6$export$4823433c4a67bbc6 {
|
|
28083
|
+
// This is a hidden feature that is only available
|
|
28084
|
+
// when building the project from source code.
|
|
28085
|
+
// This will be used to get around the lack of
|
|
28086
|
+
// Environment.DEVELOPMENT
|
|
28087
|
+
isDevelopment = false;
|
|
28088
|
+
isProduction;
|
|
28089
|
+
isOnRampEnabled;
|
|
28090
|
+
isSwapEnabled;
|
|
28091
|
+
isBridgeEnabled;
|
|
28092
|
+
remote;
|
|
28093
|
+
environment;
|
|
28094
|
+
networkMap;
|
|
28095
|
+
constructor(config){
|
|
28096
|
+
if (!Object.values((Environment$1)).includes(config.baseConfig.environment)) throw new $4013c5c91bb535f6$export$6ad73ea7e1b6f37f("Invalid checkout configuration of environment");
|
|
28097
|
+
this.environment = config.baseConfig.environment;
|
|
28098
|
+
// Developer mode will super set any environment configuration
|
|
28099
|
+
this.isProduction = !this.isDevelopment && this.environment === (Environment$1).PRODUCTION;
|
|
28100
|
+
this.isOnRampEnabled = config.isOnRampEnabled ?? ($d85ad1457a3f1a83$export$72176e2233d7d5d);
|
|
28101
|
+
this.isSwapEnabled = config.isSwapEnabled ?? ($d85ad1457a3f1a83$export$566b5975cc83d6b4);
|
|
28102
|
+
this.isBridgeEnabled = config.isBridgeEnabled ?? ($d85ad1457a3f1a83$export$261cde2078dba35b);
|
|
28103
|
+
this.networkMap = $4013c5c91bb535f6$var$networkMap(this.isProduction, this.isDevelopment);
|
|
28104
|
+
this.remote = new ($a492ee374ae7b613$export$d902b56530cd5f87)({
|
|
28105
|
+
isDevelopment: this.isDevelopment,
|
|
28106
|
+
isProduction: this.isProduction
|
|
28107
|
+
});
|
|
28108
|
+
}
|
|
28109
|
+
}
|
|
28110
|
+
|
|
28111
|
+
|
|
28112
|
+
|
|
28113
|
+
|
|
27990
28114
|
const $efe60cea83bfc4e8$export$473cec51305fdae8 = async (config, { type: type = ($08d5ddc39acd6833$export$fd9b17d87f4121d2).ALL, chainId: chainId, exclude: exclude })=>{
|
|
27991
28115
|
let tokens = [];
|
|
28116
|
+
let onRampConfig;
|
|
27992
28117
|
switch(type){
|
|
27993
28118
|
case ($08d5ddc39acd6833$export$fd9b17d87f4121d2).SWAP:
|
|
27994
28119
|
// Fetch tokens from dex-tokens config because
|
|
@@ -27996,10 +28121,16 @@ const $efe60cea83bfc4e8$export$473cec51305fdae8 = async (config, { type: type =
|
|
|
27996
28121
|
// legal reasons.
|
|
27997
28122
|
tokens = (await config.remote.getConfig("dex")).tokens || [];
|
|
27998
28123
|
break;
|
|
28124
|
+
case ($08d5ddc39acd6833$export$fd9b17d87f4121d2).ONRAMP:
|
|
28125
|
+
onRampConfig = await config.remote.getConfig("onramp");
|
|
28126
|
+
// Only using Transak as it's the only on-ramp provider at the moment
|
|
28127
|
+
if (!onRampConfig) tokens = [];
|
|
28128
|
+
tokens = onRampConfig[($bc2bfebf768286d3$export$8cb0af6b2bed4b64).TRANSAK]?.tokens || [];
|
|
28129
|
+
break;
|
|
27999
28130
|
case ($08d5ddc39acd6833$export$fd9b17d87f4121d2).BRIDGE:
|
|
28000
28131
|
case ($08d5ddc39acd6833$export$fd9b17d87f4121d2).ALL:
|
|
28001
28132
|
default:
|
|
28002
|
-
tokens = (await config.remote.getTokensConfig(chainId)).allowed;
|
|
28133
|
+
tokens = (await config.remote.getTokensConfig(chainId || ($4013c5c91bb535f6$export$9b794d067cdd1af6)(config))).allowed;
|
|
28003
28134
|
}
|
|
28004
28135
|
if (!exclude || exclude?.length === 0) return {
|
|
28005
28136
|
tokens: tokens
|
|
@@ -28072,7 +28203,7 @@ class $fd8a8472dcc3ec2b$export$ef140a6b05dfc786 {
|
|
|
28072
28203
|
if (params.nextPage) url += `&${new URLSearchParams(params.nextPage)}`;
|
|
28073
28204
|
// Cache response data to prevent unnecessary requests
|
|
28074
28205
|
const cached = this.getCache(url);
|
|
28075
|
-
if (cached
|
|
28206
|
+
if (cached) return Promise.resolve(cached);
|
|
28076
28207
|
const response = await $fd8a8472dcc3ec2b$export$ef140a6b05dfc786.makeHttpRequest(url);
|
|
28077
28208
|
if (response.status >= 400) return Promise.reject({
|
|
28078
28209
|
code: response.status,
|
|
@@ -28111,7 +28242,7 @@ class $fd8a8472dcc3ec2b$export$ef140a6b05dfc786 {
|
|
|
28111
28242
|
const url = `${this.url}/api/v2/addresses/${params.walletAddress}`;
|
|
28112
28243
|
// Cache response data to prevent unnecessary requests
|
|
28113
28244
|
const cached = this.getCache(url);
|
|
28114
|
-
if (cached
|
|
28245
|
+
if (cached) return Promise.resolve(cached);
|
|
28115
28246
|
const response = await $fd8a8472dcc3ec2b$export$ef140a6b05dfc786.makeHttpRequest(url);
|
|
28116
28247
|
if (response.status >= 400) return Promise.reject({
|
|
28117
28248
|
code: response.status,
|
|
@@ -28529,114 +28660,6 @@ async function $67fc622a2b913d5f$export$c60ce6c6a92bc2ff(config) {
|
|
|
28529
28660
|
|
|
28530
28661
|
|
|
28531
28662
|
|
|
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
28663
|
const $2e7bf45a7c9a9570$var$DUMMY_WALLET_ADDRESS = "0x0000000000000000000000000000000000000001";
|
|
28641
28664
|
const $2e7bf45a7c9a9570$var$DEFAULT_TOKEN_DECIMALS = 18;
|
|
28642
28665
|
async function $2e7bf45a7c9a9570$var$getTokenInfoByAddress(config, tokenAddress, chainId, provider) {
|
|
@@ -29974,6 +29997,49 @@ const $9085b221b72ac69e$export$e761f9e0703de895 = async (config, provider, id, c
|
|
|
29974
29997
|
|
|
29975
29998
|
|
|
29976
29999
|
|
|
30000
|
+
|
|
30001
|
+
|
|
30002
|
+
class $a77d203f701a3b72$export$1453e9b801542ef4 {
|
|
30003
|
+
config;
|
|
30004
|
+
/**
|
|
30005
|
+
* Constructs a new instance of the FiatRampService class.
|
|
30006
|
+
* @param {CheckoutConfiguration} config - The config required for the FiatRampService.
|
|
30007
|
+
*/ constructor(config){
|
|
30008
|
+
this.config = config;
|
|
30009
|
+
}
|
|
30010
|
+
async feeEstimate() {
|
|
30011
|
+
const config = await this.config.remote.getConfig("onramp");
|
|
30012
|
+
return config[($bc2bfebf768286d3$export$8cb0af6b2bed4b64).TRANSAK]?.fees;
|
|
30013
|
+
}
|
|
30014
|
+
async createWidgetUrl(params) {
|
|
30015
|
+
return await this.getTransakWidgetUrl(params);
|
|
30016
|
+
}
|
|
30017
|
+
async getTransakWidgetUrl(params) {
|
|
30018
|
+
let widgetUrl = `${($d85ad1457a3f1a83$export$f6043d7fce62d71b)[this.config.environment]}?`;
|
|
30019
|
+
const onRampConfig = await this.config.remote.getConfig("onramp");
|
|
30020
|
+
const apiKey = onRampConfig[($bc2bfebf768286d3$export$8cb0af6b2bed4b64).TRANSAK].publishableApiKey;
|
|
30021
|
+
const transakPublishableKey = `apiKey=${apiKey}`;
|
|
30022
|
+
const zkevmNetwork = "network=immutablezkevm";
|
|
30023
|
+
const defaultPaymentMethod = "defaultPaymentMethod=credit_debit_card";
|
|
30024
|
+
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";
|
|
30025
|
+
const productsAvailed = "productsAvailed=buy";
|
|
30026
|
+
const exchangeScreenTitle = "exchangeScreenTitle=Buy";
|
|
30027
|
+
const themeColor = "themeColor=0D0D0D";
|
|
30028
|
+
widgetUrl += `${transakPublishableKey}&` + `${zkevmNetwork}&` + `${defaultPaymentMethod}&` + `${disableBankTransfer}&` + `${productsAvailed}&` + `${exchangeScreenTitle}&` + `${themeColor}`;
|
|
30029
|
+
if (params.isPassport && params.email) {
|
|
30030
|
+
const encodedEmail = encodeURIComponent(params.email);
|
|
30031
|
+
widgetUrl += `&email=${encodedEmail}&isAutoFillUserData=true&disableWalletAddressForm=true`;
|
|
30032
|
+
}
|
|
30033
|
+
if (params.tokenAmount && params.tokenSymbol) widgetUrl += `&defaultCryptoAmount=${params.tokenAmount}&cryptoCurrencyCode=${params.tokenSymbol}`;
|
|
30034
|
+
else widgetUrl += "&defaultCryptoCurrency=IMX";
|
|
30035
|
+
if (params.walletAddress) widgetUrl += `&walletAddress=${params.walletAddress}`;
|
|
30036
|
+
return widgetUrl;
|
|
30037
|
+
}
|
|
30038
|
+
}
|
|
30039
|
+
|
|
30040
|
+
|
|
30041
|
+
|
|
30042
|
+
|
|
29977
30043
|
const $a8cb37a3fc8eb863$var$SANDBOX_CONFIGURATION = {
|
|
29978
30044
|
baseConfig: {
|
|
29979
30045
|
environment: (Environment$1).SANDBOX
|
|
@@ -29981,12 +30047,14 @@ const $a8cb37a3fc8eb863$var$SANDBOX_CONFIGURATION = {
|
|
|
29981
30047
|
};
|
|
29982
30048
|
class $a8cb37a3fc8eb863$export$1f60ba4ec72508a0 {
|
|
29983
30049
|
config;
|
|
30050
|
+
fiatRampService;
|
|
29984
30051
|
readOnlyProviders;
|
|
29985
30052
|
/**
|
|
29986
30053
|
* Constructs a new instance of the CheckoutModule class.
|
|
29987
30054
|
* @param {CheckoutModuleConfiguration} [config=SANDBOX_CONFIGURATION] - The configuration object for the CheckoutModule.
|
|
29988
30055
|
*/ constructor(config = $a8cb37a3fc8eb863$var$SANDBOX_CONFIGURATION){
|
|
29989
30056
|
this.config = new ($4013c5c91bb535f6$export$4823433c4a67bbc6)(config);
|
|
30057
|
+
this.fiatRampService = new ($a77d203f701a3b72$export$1453e9b801542ef4)(this.config);
|
|
29990
30058
|
this.readOnlyProviders = new Map();
|
|
29991
30059
|
}
|
|
29992
30060
|
/**
|
|
@@ -30147,6 +30215,43 @@ class $a8cb37a3fc8eb863$export$1f60ba4ec72508a0 {
|
|
|
30147
30215
|
this.readOnlyProviders = await ($0e0060cb42e136d2$export$339cb2be73677b30)(this.config, this.readOnlyProviders);
|
|
30148
30216
|
return await $2e7bf45a7c9a9570$export$942c8de7174809fc(params, this.readOnlyProviders, this.config);
|
|
30149
30217
|
}
|
|
30218
|
+
/**
|
|
30219
|
+
* Creates and returns a URL for the fiat ramp widget.
|
|
30220
|
+
* @param {FiatRampParams} params - The parameters for creating the url.
|
|
30221
|
+
* @returns {Promise<string>} - A promise that resolves to a string url.
|
|
30222
|
+
*/ async createFiatRampUrl(params) {
|
|
30223
|
+
let tokenAmount;
|
|
30224
|
+
let tokenSymbol = "IMX";
|
|
30225
|
+
let email;
|
|
30226
|
+
const walletAddress = await params.web3Provider.getSigner().getAddress();
|
|
30227
|
+
const isPassport = params.web3Provider.provider?.isPassport || false;
|
|
30228
|
+
if (isPassport && params.passport) {
|
|
30229
|
+
const userInfo = await params.passport.getUserInfo();
|
|
30230
|
+
email = userInfo?.email;
|
|
30231
|
+
}
|
|
30232
|
+
const tokenList = await $efe60cea83bfc4e8$export$473cec51305fdae8(this.config, {
|
|
30233
|
+
type: ($08d5ddc39acd6833$export$fd9b17d87f4121d2).ONRAMP
|
|
30234
|
+
});
|
|
30235
|
+
const token = tokenList.tokens.find((t)=>t.address?.toLowerCase() === params.tokenAddress?.toLowerCase());
|
|
30236
|
+
if (token) {
|
|
30237
|
+
tokenAmount = params.tokenAmount;
|
|
30238
|
+
tokenSymbol = token.symbol;
|
|
30239
|
+
}
|
|
30240
|
+
return await this.fiatRampService.createWidgetUrl({
|
|
30241
|
+
exchangeType: params.exchangeType,
|
|
30242
|
+
isPassport: isPassport,
|
|
30243
|
+
walletAddress: walletAddress,
|
|
30244
|
+
tokenAmount: tokenAmount,
|
|
30245
|
+
tokenSymbol: tokenSymbol,
|
|
30246
|
+
email: email
|
|
30247
|
+
});
|
|
30248
|
+
}
|
|
30249
|
+
/**
|
|
30250
|
+
* Fetches fiat ramp fee estimations.
|
|
30251
|
+
* @returns {Promise<OnRampProviderFees>} - A promise that resolves to OnRampProviderFees.
|
|
30252
|
+
*/ async getExchangeFeeEstimate() {
|
|
30253
|
+
return await this.fiatRampService.feeEstimate();
|
|
30254
|
+
}
|
|
30150
30255
|
}
|
|
30151
30256
|
|
|
30152
30257
|
var checkout_sdk = /*#__PURE__*/Object.freeze({
|
|
@@ -30156,6 +30261,7 @@ var checkout_sdk = /*#__PURE__*/Object.freeze({
|
|
|
30156
30261
|
get ChainName () { return $0472f23319457bfb$export$b874c6b1dfe85e02; },
|
|
30157
30262
|
Checkout: $a8cb37a3fc8eb863$export$1f60ba4ec72508a0,
|
|
30158
30263
|
get CheckoutErrorType () { return $a8bc256d81a5e2c1$export$e3dc0620abde7f5a; },
|
|
30264
|
+
get ExchangeType () { return $e055e79256bbc1dd$export$80f4da0d409a629d; },
|
|
30159
30265
|
get GasEstimateType () { return $de275b98d2b651c3$export$788b1fd17f3dad84; },
|
|
30160
30266
|
get GasTokenType () { return $4b58188d47aafe8d$export$537fa3efd10ed435; },
|
|
30161
30267
|
get ItemType () { return $4b58188d47aafe8d$export$1fc8f52ad1810e52; },
|
|
@@ -30169,7 +30275,7 @@ var checkout_sdk = /*#__PURE__*/Object.freeze({
|
|
|
30169
30275
|
function $parcel$export(e, n, v, s) {
|
|
30170
30276
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
30171
30277
|
}
|
|
30172
|
-
const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.17.
|
|
30278
|
+
const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.17.3";
|
|
30173
30279
|
const $d663162fd5a0853f$export$83bf90b30cdfd29f = ()=>false;
|
|
30174
30280
|
const $d663162fd5a0853f$export$1169f5475725171b = ()=>$d663162fd5a0853f$export$38a083d9fb5551ca;
|
|
30175
30281
|
|
|
@@ -30234,6 +30340,7 @@ var $207ed853f11d19d5$export$5a0ace85cae72d45;
|
|
|
30234
30340
|
IMTBLWidgetEvents["IMTBL_WALLET_WIDGET_EVENT"] = "imtbl-wallet-widget";
|
|
30235
30341
|
IMTBLWidgetEvents["IMTBL_SWAP_WIDGET_EVENT"] = "imtbl-swap-widget";
|
|
30236
30342
|
IMTBLWidgetEvents["IMTBL_BRIDGE_WIDGET_EVENT"] = "imtbl-bridge-widget";
|
|
30343
|
+
IMTBLWidgetEvents["IMTBL_ONRAMP_WIDGET_EVENT"] = "imtbl-onramp-widget";
|
|
30237
30344
|
})($207ed853f11d19d5$export$5a0ace85cae72d45 || ($207ed853f11d19d5$export$5a0ace85cae72d45 = {}));
|
|
30238
30345
|
|
|
30239
30346
|
|
|
@@ -30299,6 +30406,19 @@ $parcel$export($ad06b030b1a3ba34$exports, "OrchestrationEventType", () => $ad06b
|
|
|
30299
30406
|
OrchestrationEventType["REQUEST_BRIDGE"] = "request-bridge";
|
|
30300
30407
|
OrchestrationEventType["REQUEST_ONRAMP"] = "request-onramp";
|
|
30301
30408
|
})($ad06b030b1a3ba34$export$b80d2daf830437b9 || ($ad06b030b1a3ba34$export$b80d2daf830437b9 = {}));
|
|
30409
|
+
|
|
30410
|
+
|
|
30411
|
+
var $d882ddc5600b1284$exports = {};
|
|
30412
|
+
|
|
30413
|
+
$parcel$export($d882ddc5600b1284$exports, "OnRampEventType", () => $d882ddc5600b1284$export$66ec39c0924078d8);
|
|
30414
|
+
/**
|
|
30415
|
+
* Enum of possible OnRamp Widget event types.
|
|
30416
|
+
*/ var $d882ddc5600b1284$export$66ec39c0924078d8;
|
|
30417
|
+
(function(OnRampEventType) {
|
|
30418
|
+
OnRampEventType["CLOSE_WIDGET"] = "close-widget";
|
|
30419
|
+
OnRampEventType["SUCCESS"] = "success";
|
|
30420
|
+
OnRampEventType["FAILURE"] = "failure";
|
|
30421
|
+
})($d882ddc5600b1284$export$66ec39c0924078d8 || ($d882ddc5600b1284$export$66ec39c0924078d8 = {}));
|
|
30302
30422
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
30303
30423
|
|
|
30304
30424
|
var $045213b18e9f1f94$exports = {};
|
|
@@ -30319,6 +30439,7 @@ var $045213b18e9f1f94$export$75be0f6af9650f2c;
|
|
|
30319
30439
|
CheckoutWidgetTagNames["WALLET"] = "imtbl-wallet";
|
|
30320
30440
|
CheckoutWidgetTagNames["SWAP"] = "imtbl-swap";
|
|
30321
30441
|
CheckoutWidgetTagNames["BRIDGE"] = "imtbl-bridge";
|
|
30442
|
+
CheckoutWidgetTagNames["ONRAMP"] = "imtbl-onramp";
|
|
30322
30443
|
})($045213b18e9f1f94$export$75be0f6af9650f2c || ($045213b18e9f1f94$export$75be0f6af9650f2c = {}));
|
|
30323
30444
|
|
|
30324
30445
|
|
|
@@ -30487,6 +30608,33 @@ function $89d55ace0f8f1c07$export$ceaac94f34dba154(props) {
|
|
|
30487
30608
|
});
|
|
30488
30609
|
}
|
|
30489
30610
|
|
|
30611
|
+
|
|
30612
|
+
var $f94f63f2c041a04c$exports = {};
|
|
30613
|
+
|
|
30614
|
+
$parcel$export($f94f63f2c041a04c$exports, "OnRampReact", () => $f94f63f2c041a04c$export$9e363c61ea99bbb4);
|
|
30615
|
+
|
|
30616
|
+
|
|
30617
|
+
|
|
30618
|
+
|
|
30619
|
+
|
|
30620
|
+
function $f94f63f2c041a04c$export$9e363c61ea99bbb4(props) {
|
|
30621
|
+
const { walletProvider: walletProvider, amount: amount, provider: provider, passport: passport, contractAddress: contractAddress } = props;
|
|
30622
|
+
(react.useEffect)(()=>{
|
|
30623
|
+
if (provider) ($77ec335383336bdd$export$931068bc678f0d73)(($045213b18e9f1f94$export$75be0f6af9650f2c).ONRAMP, provider);
|
|
30624
|
+
if (passport) ($b222a8f062090058$export$fae4199086a966a3)(($045213b18e9f1f94$export$75be0f6af9650f2c).ONRAMP, passport);
|
|
30625
|
+
}, [
|
|
30626
|
+
provider,
|
|
30627
|
+
passport
|
|
30628
|
+
]);
|
|
30629
|
+
const config = window.ImtblCheckoutWidgetConfig;
|
|
30630
|
+
return /*#__PURE__*/ (jsxRuntime.jsx)("imtbl-onramp", {
|
|
30631
|
+
widgetConfig: config,
|
|
30632
|
+
walletProvider: walletProvider,
|
|
30633
|
+
amount: amount ?? "",
|
|
30634
|
+
contractAddress: contractAddress ?? ""
|
|
30635
|
+
});
|
|
30636
|
+
}
|
|
30637
|
+
|
|
30490
30638
|
var checkout_widgets = /*#__PURE__*/Object.freeze({
|
|
30491
30639
|
__proto__: null,
|
|
30492
30640
|
get BridgeEventType () { return $15cc9e120aa6f3bf$export$d1bfa21f7c76447a; },
|
|
@@ -30496,6 +30644,8 @@ var checkout_widgets = /*#__PURE__*/Object.freeze({
|
|
|
30496
30644
|
get ConnectEventType () { return $a85ecdbd885c58ad$export$e72e7f9969a47dd3; },
|
|
30497
30645
|
ConnectReact: $f2083cd30e2f5c56$export$49d62957f420a1e2,
|
|
30498
30646
|
get IMTBLWidgetEvents () { return $207ed853f11d19d5$export$5a0ace85cae72d45; },
|
|
30647
|
+
get OnRampEventType () { return $d882ddc5600b1284$export$66ec39c0924078d8; },
|
|
30648
|
+
OnRampReact: $f94f63f2c041a04c$export$9e363c61ea99bbb4,
|
|
30499
30649
|
get OrchestrationEventType () { return $ad06b030b1a3ba34$export$b80d2daf830437b9; },
|
|
30500
30650
|
get SwapEventType () { return $53d219e7f6bf0cd6$export$140a49745ab55563; },
|
|
30501
30651
|
SwapReact: $a4fbb8e3a6aeff58$export$971e031379577f4,
|