@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.js
CHANGED
|
@@ -2702,7 +2702,7 @@ class MultiRollupApiClients {
|
|
|
2702
2702
|
}
|
|
2703
2703
|
|
|
2704
2704
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
2705
|
-
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.17.
|
|
2705
|
+
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.17.4' };
|
|
2706
2706
|
const createConfig = ({ basePath, headers, }) => {
|
|
2707
2707
|
if (!basePath.trim()) {
|
|
2708
2708
|
throw Error('basePath can not be empty');
|
|
@@ -2762,7 +2762,7 @@ class APIError extends Error {
|
|
|
2762
2762
|
|
|
2763
2763
|
/* eslint-disable implicit-arrow-linebreak */
|
|
2764
2764
|
const defaultHeaders = {
|
|
2765
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.17.
|
|
2765
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.17.4',
|
|
2766
2766
|
};
|
|
2767
2767
|
/**
|
|
2768
2768
|
* createAPIConfiguration to create a custom Configuration
|
|
@@ -3048,7 +3048,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
3048
3048
|
chainID,
|
|
3049
3049
|
coreContractAddress,
|
|
3050
3050
|
registrationContractAddress,
|
|
3051
|
-
sdkVersion: 'ts-immutable-sdk-0.17.
|
|
3051
|
+
sdkVersion: 'ts-immutable-sdk-0.17.4',
|
|
3052
3052
|
});
|
|
3053
3053
|
/**
|
|
3054
3054
|
* Sets `sdkVersion` at the time of build
|
|
@@ -27312,6 +27312,7 @@ class Exchange {
|
|
|
27312
27312
|
|
|
27313
27313
|
|
|
27314
27314
|
|
|
27315
|
+
|
|
27315
27316
|
var $aa144554f9ef124b$export$226b052ecb8ca80;
|
|
27316
27317
|
(function(BuyStatusType) {
|
|
27317
27318
|
BuyStatusType["SUCCESS"] = "SUCCESS";
|
|
@@ -27352,6 +27353,10 @@ var $0472f23319457bfb$export$b874c6b1dfe85e02;
|
|
|
27352
27353
|
})($0472f23319457bfb$export$b874c6b1dfe85e02 || ($0472f23319457bfb$export$b874c6b1dfe85e02 = {}));
|
|
27353
27354
|
|
|
27354
27355
|
|
|
27356
|
+
var $bc2bfebf768286d3$export$8cb0af6b2bed4b64;
|
|
27357
|
+
(function(OnRampProvider) {
|
|
27358
|
+
OnRampProvider["TRANSAK"] = "201811419111";
|
|
27359
|
+
})($bc2bfebf768286d3$export$8cb0af6b2bed4b64 || ($bc2bfebf768286d3$export$8cb0af6b2bed4b64 = {}));
|
|
27355
27360
|
|
|
27356
27361
|
|
|
27357
27362
|
|
|
@@ -27383,6 +27388,7 @@ var $08d5ddc39acd6833$export$fd9b17d87f4121d2;
|
|
|
27383
27388
|
TokenFilterTypes["ALL"] = "all";
|
|
27384
27389
|
TokenFilterTypes["SWAP"] = "swap";
|
|
27385
27390
|
TokenFilterTypes["BRIDGE"] = "bridge";
|
|
27391
|
+
TokenFilterTypes["ONRAMP"] = "onramp";
|
|
27386
27392
|
})($08d5ddc39acd6833$export$fd9b17d87f4121d2 || ($08d5ddc39acd6833$export$fd9b17d87f4121d2 = {}));
|
|
27387
27393
|
|
|
27388
27394
|
|
|
@@ -27442,11 +27448,9 @@ const $d85ad1457a3f1a83$export$161d4a74df65fc08 = {
|
|
|
27442
27448
|
const $d85ad1457a3f1a83$export$72176e2233d7d5d = true;
|
|
27443
27449
|
const $d85ad1457a3f1a83$export$566b5975cc83d6b4 = true;
|
|
27444
27450
|
const $d85ad1457a3f1a83$export$261cde2078dba35b = true;
|
|
27445
|
-
const $d85ad1457a3f1a83$export$
|
|
27446
|
-
[($
|
|
27447
|
-
|
|
27448
|
-
nativeToken: $d85ad1457a3f1a83$var$ZKEVM_NATIVE_TOKEN
|
|
27449
|
-
}
|
|
27451
|
+
const $d85ad1457a3f1a83$export$f6043d7fce62d71b = {
|
|
27452
|
+
[(Environment$1).SANDBOX]: "https://global-stg.transak.com",
|
|
27453
|
+
[(Environment$1).PRODUCTION]: "https://global.transak.com/"
|
|
27450
27454
|
};
|
|
27451
27455
|
const $d85ad1457a3f1a83$export$6f24f3cef7d501c4 = new Map([
|
|
27452
27456
|
[
|
|
@@ -27541,6 +27545,16 @@ const $d85ad1457a3f1a83$export$3a9ebede6a150274 = new Map([
|
|
|
27541
27545
|
}
|
|
27542
27546
|
]
|
|
27543
27547
|
]);
|
|
27548
|
+
const $d85ad1457a3f1a83$export$fc55ed5a42b458ba = {
|
|
27549
|
+
[($0472f23319457bfb$export$c06e1e7429de6283).IMTBL_ZKEVM_TESTNET]: {
|
|
27550
|
+
url: "https://explorer.testnet.immutable.com",
|
|
27551
|
+
nativeToken: $d85ad1457a3f1a83$export$3e81fc0987227f10.get(($0472f23319457bfb$export$c06e1e7429de6283).IMTBL_ZKEVM_TESTNET).nativeCurrency
|
|
27552
|
+
},
|
|
27553
|
+
[($0472f23319457bfb$export$c06e1e7429de6283).IMTBL_ZKEVM_MAINNET]: {
|
|
27554
|
+
url: "https://explorer.mainnet.immutable.com",
|
|
27555
|
+
nativeToken: $d85ad1457a3f1a83$export$6f24f3cef7d501c4.get(($0472f23319457bfb$export$c06e1e7429de6283).IMTBL_ZKEVM_MAINNET).nativeCurrency
|
|
27556
|
+
}
|
|
27557
|
+
};
|
|
27544
27558
|
const $d85ad1457a3f1a83$export$db5daa1b5156ccfe = [
|
|
27545
27559
|
{
|
|
27546
27560
|
constant: true,
|
|
@@ -27754,6 +27768,12 @@ var $4b58188d47aafe8d$export$537fa3efd10ed435;
|
|
|
27754
27768
|
})($4b58188d47aafe8d$export$537fa3efd10ed435 || ($4b58188d47aafe8d$export$537fa3efd10ed435 = {}));
|
|
27755
27769
|
|
|
27756
27770
|
|
|
27771
|
+
var $e055e79256bbc1dd$export$80f4da0d409a629d;
|
|
27772
|
+
(function(ExchangeType) {
|
|
27773
|
+
ExchangeType["ONRAMP"] = "onramp";
|
|
27774
|
+
})($e055e79256bbc1dd$export$80f4da0d409a629d || ($e055e79256bbc1dd$export$80f4da0d409a629d = {}));
|
|
27775
|
+
|
|
27776
|
+
|
|
27757
27777
|
|
|
27758
27778
|
|
|
27759
27779
|
/**
|
|
@@ -27965,8 +27985,118 @@ async function $de192de6ef100f9f$export$b827d9418aeb5dbd(config, web3Provider, c
|
|
|
27965
27985
|
|
|
27966
27986
|
|
|
27967
27987
|
|
|
27988
|
+
|
|
27989
|
+
|
|
27990
|
+
|
|
27991
|
+
|
|
27992
|
+
|
|
27993
|
+
class $a492ee374ae7b613$export$d902b56530cd5f87 {
|
|
27994
|
+
isDevelopment;
|
|
27995
|
+
isProduction;
|
|
27996
|
+
configCache;
|
|
27997
|
+
tokensCache;
|
|
27998
|
+
constructor(params){
|
|
27999
|
+
this.isDevelopment = params.isDevelopment;
|
|
28000
|
+
this.isProduction = params.isProduction;
|
|
28001
|
+
}
|
|
28002
|
+
static async makeHttpRequest(url) {
|
|
28003
|
+
let response;
|
|
28004
|
+
try {
|
|
28005
|
+
response = await (0, globalAxios$1).get(url);
|
|
28006
|
+
} catch (error) {
|
|
28007
|
+
throw new Error(`Error fetching from api: ${error.message}`);
|
|
28008
|
+
}
|
|
28009
|
+
if (response.status !== 200) throw new Error(`Error fetching from api: ${response.status} ${response.statusText}`);
|
|
28010
|
+
return response;
|
|
28011
|
+
}
|
|
28012
|
+
getEndpoint = ()=>{
|
|
28013
|
+
if (this.isDevelopment) return ($d85ad1457a3f1a83$export$161d4a74df65fc08)[$d85ad1457a3f1a83$export$7d3a9eeba384fa59];
|
|
28014
|
+
if (this.isProduction) return ($d85ad1457a3f1a83$export$161d4a74df65fc08)[(Environment$1).PRODUCTION];
|
|
28015
|
+
return ($d85ad1457a3f1a83$export$161d4a74df65fc08)[(Environment$1).SANDBOX];
|
|
28016
|
+
};
|
|
28017
|
+
async loadConfig() {
|
|
28018
|
+
if (this.configCache) return this.configCache;
|
|
28019
|
+
const response = await $a492ee374ae7b613$export$d902b56530cd5f87.makeHttpRequest(`${this.getEndpoint()}/v1/config`);
|
|
28020
|
+
this.configCache = response.data;
|
|
28021
|
+
return this.configCache;
|
|
28022
|
+
}
|
|
28023
|
+
async loadConfigTokens() {
|
|
28024
|
+
if (this.tokensCache) return this.tokensCache;
|
|
28025
|
+
const response = await $a492ee374ae7b613$export$d902b56530cd5f87.makeHttpRequest(`${this.getEndpoint()}/v1/config/tokens`);
|
|
28026
|
+
this.tokensCache = response.data;
|
|
28027
|
+
return this.tokensCache;
|
|
28028
|
+
}
|
|
28029
|
+
async getConfig(key) {
|
|
28030
|
+
const config = await this.loadConfig();
|
|
28031
|
+
if (!config) return undefined;
|
|
28032
|
+
if (!key) return config;
|
|
28033
|
+
return config[key];
|
|
28034
|
+
}
|
|
28035
|
+
async getTokensConfig(chainId) {
|
|
28036
|
+
const config = await this.loadConfigTokens();
|
|
28037
|
+
if (!config || !config[chainId]) return {};
|
|
28038
|
+
return config[chainId] ?? [];
|
|
28039
|
+
}
|
|
28040
|
+
}
|
|
28041
|
+
|
|
28042
|
+
|
|
28043
|
+
class $4013c5c91bb535f6$export$6ad73ea7e1b6f37f extends Error {
|
|
28044
|
+
message;
|
|
28045
|
+
constructor(message){
|
|
28046
|
+
super(message);
|
|
28047
|
+
this.message = message;
|
|
28048
|
+
}
|
|
28049
|
+
}
|
|
28050
|
+
const $4013c5c91bb535f6$var$networkMap = (prod, dev)=>{
|
|
28051
|
+
if (dev) return $d85ad1457a3f1a83$export$3a9ebede6a150274;
|
|
28052
|
+
if (prod) return $d85ad1457a3f1a83$export$6f24f3cef7d501c4;
|
|
28053
|
+
return $d85ad1457a3f1a83$export$3e81fc0987227f10;
|
|
28054
|
+
};
|
|
28055
|
+
const $4013c5c91bb535f6$export$9b794d067cdd1af6 = (config)=>{
|
|
28056
|
+
// DevMode and Sandbox will both use Sepolia.
|
|
28057
|
+
if (!config.isProduction) return ($0472f23319457bfb$export$c06e1e7429de6283).SEPOLIA;
|
|
28058
|
+
return ($0472f23319457bfb$export$c06e1e7429de6283).ETHEREUM;
|
|
28059
|
+
};
|
|
28060
|
+
const $4013c5c91bb535f6$export$c9af4e4b001c6476 = (config)=>{
|
|
28061
|
+
if (config.isDevelopment) return ($0472f23319457bfb$export$c06e1e7429de6283).IMTBL_ZKEVM_DEVNET;
|
|
28062
|
+
if (config.isProduction) return ($0472f23319457bfb$export$c06e1e7429de6283).IMTBL_ZKEVM_MAINNET;
|
|
28063
|
+
return ($0472f23319457bfb$export$c06e1e7429de6283).IMTBL_ZKEVM_TESTNET;
|
|
28064
|
+
};
|
|
28065
|
+
class $4013c5c91bb535f6$export$4823433c4a67bbc6 {
|
|
28066
|
+
// This is a hidden feature that is only available
|
|
28067
|
+
// when building the project from source code.
|
|
28068
|
+
// This will be used to get around the lack of
|
|
28069
|
+
// Environment.DEVELOPMENT
|
|
28070
|
+
isDevelopment = false;
|
|
28071
|
+
isProduction;
|
|
28072
|
+
isOnRampEnabled;
|
|
28073
|
+
isSwapEnabled;
|
|
28074
|
+
isBridgeEnabled;
|
|
28075
|
+
remote;
|
|
28076
|
+
environment;
|
|
28077
|
+
networkMap;
|
|
28078
|
+
constructor(config){
|
|
28079
|
+
if (!Object.values((Environment$1)).includes(config.baseConfig.environment)) throw new $4013c5c91bb535f6$export$6ad73ea7e1b6f37f("Invalid checkout configuration of environment");
|
|
28080
|
+
this.environment = config.baseConfig.environment;
|
|
28081
|
+
// Developer mode will super set any environment configuration
|
|
28082
|
+
this.isProduction = !this.isDevelopment && this.environment === (Environment$1).PRODUCTION;
|
|
28083
|
+
this.isOnRampEnabled = config.isOnRampEnabled ?? ($d85ad1457a3f1a83$export$72176e2233d7d5d);
|
|
28084
|
+
this.isSwapEnabled = config.isSwapEnabled ?? ($d85ad1457a3f1a83$export$566b5975cc83d6b4);
|
|
28085
|
+
this.isBridgeEnabled = config.isBridgeEnabled ?? ($d85ad1457a3f1a83$export$261cde2078dba35b);
|
|
28086
|
+
this.networkMap = $4013c5c91bb535f6$var$networkMap(this.isProduction, this.isDevelopment);
|
|
28087
|
+
this.remote = new ($a492ee374ae7b613$export$d902b56530cd5f87)({
|
|
28088
|
+
isDevelopment: this.isDevelopment,
|
|
28089
|
+
isProduction: this.isProduction
|
|
28090
|
+
});
|
|
28091
|
+
}
|
|
28092
|
+
}
|
|
28093
|
+
|
|
28094
|
+
|
|
28095
|
+
|
|
28096
|
+
|
|
27968
28097
|
const $efe60cea83bfc4e8$export$473cec51305fdae8 = async (config, { type: type = ($08d5ddc39acd6833$export$fd9b17d87f4121d2).ALL, chainId: chainId, exclude: exclude })=>{
|
|
27969
28098
|
let tokens = [];
|
|
28099
|
+
let onRampConfig;
|
|
27970
28100
|
switch(type){
|
|
27971
28101
|
case ($08d5ddc39acd6833$export$fd9b17d87f4121d2).SWAP:
|
|
27972
28102
|
// Fetch tokens from dex-tokens config because
|
|
@@ -27974,10 +28104,16 @@ const $efe60cea83bfc4e8$export$473cec51305fdae8 = async (config, { type: type =
|
|
|
27974
28104
|
// legal reasons.
|
|
27975
28105
|
tokens = (await config.remote.getConfig("dex")).tokens || [];
|
|
27976
28106
|
break;
|
|
28107
|
+
case ($08d5ddc39acd6833$export$fd9b17d87f4121d2).ONRAMP:
|
|
28108
|
+
onRampConfig = await config.remote.getConfig("onramp");
|
|
28109
|
+
// Only using Transak as it's the only on-ramp provider at the moment
|
|
28110
|
+
if (!onRampConfig) tokens = [];
|
|
28111
|
+
tokens = onRampConfig[($bc2bfebf768286d3$export$8cb0af6b2bed4b64).TRANSAK]?.tokens || [];
|
|
28112
|
+
break;
|
|
27977
28113
|
case ($08d5ddc39acd6833$export$fd9b17d87f4121d2).BRIDGE:
|
|
27978
28114
|
case ($08d5ddc39acd6833$export$fd9b17d87f4121d2).ALL:
|
|
27979
28115
|
default:
|
|
27980
|
-
tokens = (await config.remote.getTokensConfig(chainId)).allowed;
|
|
28116
|
+
tokens = (await config.remote.getTokensConfig(chainId || ($4013c5c91bb535f6$export$9b794d067cdd1af6)(config))).allowed;
|
|
27981
28117
|
}
|
|
27982
28118
|
if (!exclude || exclude?.length === 0) return {
|
|
27983
28119
|
tokens: tokens
|
|
@@ -28193,7 +28329,14 @@ const $1564e43dde50bb61$export$8c978679845804d4 = async (walletAddress, chainId,
|
|
|
28193
28329
|
items.push(...resp.items);
|
|
28194
28330
|
}while (resp.next_page_params);
|
|
28195
28331
|
} catch (err) {
|
|
28196
|
-
|
|
28332
|
+
// In case of a 404, the wallet is a new wallet that hasn't been indexed by
|
|
28333
|
+
// the Blockscout just yet. This happens when a wallet hasn't had any
|
|
28334
|
+
// activity on the chain. In this case, simply ignore the error and return
|
|
28335
|
+
// no currencies.
|
|
28336
|
+
// In case of a malformed wallet address, Blockscout returns a 422, which
|
|
28337
|
+
// means we are safe to assume that a 404 is a missing wallet due to inactivity
|
|
28338
|
+
// or simply an incorrect wallet address was provided.
|
|
28339
|
+
if (err?.code !== (HttpStatusCode$2).NotFound) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)(err.message || "InternalServerError | getTokensByWalletAddress", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).GET_INDEXER_BALANCE_ERROR, err);
|
|
28197
28340
|
}
|
|
28198
28341
|
try {
|
|
28199
28342
|
const respNative = await $1564e43dde50bb61$var$blockscoutClient.getNativeTokenByWalletAddress({
|
|
@@ -28201,7 +28344,14 @@ const $1564e43dde50bb61$export$8c978679845804d4 = async (walletAddress, chainId,
|
|
|
28201
28344
|
});
|
|
28202
28345
|
items.push(respNative);
|
|
28203
28346
|
} catch (err) {
|
|
28204
|
-
|
|
28347
|
+
// In case of a 404, the wallet is a new wallet that hasn't been indexed by
|
|
28348
|
+
// the Blockscout just yet. This happens when a wallet hasn't had any
|
|
28349
|
+
// activity on the chain. In this case, simply ignore the error and return
|
|
28350
|
+
// no currencies.
|
|
28351
|
+
// In case of a malformed wallet address, Blockscout returns a 422, which
|
|
28352
|
+
// means we are safe to assume that a 404 is a missing wallet due to inactivity
|
|
28353
|
+
// or simply an incorrect wallet address was provided.
|
|
28354
|
+
if (err?.code !== (HttpStatusCode$2).NotFound) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)(err.message || "InternalServerError | getNativeTokenByWalletAddress", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).GET_INDEXER_BALANCE_ERROR, err);
|
|
28205
28355
|
}
|
|
28206
28356
|
return {
|
|
28207
28357
|
balances: items.map((item)=>{
|
|
@@ -28507,114 +28657,6 @@ async function $67fc622a2b913d5f$export$c60ce6c6a92bc2ff(config) {
|
|
|
28507
28657
|
|
|
28508
28658
|
|
|
28509
28659
|
|
|
28510
|
-
|
|
28511
|
-
|
|
28512
|
-
|
|
28513
|
-
|
|
28514
|
-
class $a492ee374ae7b613$export$d902b56530cd5f87 {
|
|
28515
|
-
isDevelopment;
|
|
28516
|
-
isProduction;
|
|
28517
|
-
configCache;
|
|
28518
|
-
tokensCache;
|
|
28519
|
-
constructor(params){
|
|
28520
|
-
this.isDevelopment = params.isDevelopment;
|
|
28521
|
-
this.isProduction = params.isProduction;
|
|
28522
|
-
}
|
|
28523
|
-
static async makeHttpRequest(url) {
|
|
28524
|
-
let response;
|
|
28525
|
-
try {
|
|
28526
|
-
response = await (0, globalAxios$1).get(url);
|
|
28527
|
-
} catch (error) {
|
|
28528
|
-
throw new Error(`Error fetching from api: ${error.message}`);
|
|
28529
|
-
}
|
|
28530
|
-
if (response.status !== 200) throw new Error(`Error fetching from api: ${response.status} ${response.statusText}`);
|
|
28531
|
-
return response;
|
|
28532
|
-
}
|
|
28533
|
-
getEndpoint = ()=>{
|
|
28534
|
-
if (this.isDevelopment) return ($d85ad1457a3f1a83$export$161d4a74df65fc08)[$d85ad1457a3f1a83$export$7d3a9eeba384fa59];
|
|
28535
|
-
if (this.isProduction) return ($d85ad1457a3f1a83$export$161d4a74df65fc08)[(Environment$1).PRODUCTION];
|
|
28536
|
-
return ($d85ad1457a3f1a83$export$161d4a74df65fc08)[(Environment$1).SANDBOX];
|
|
28537
|
-
};
|
|
28538
|
-
async loadConfig() {
|
|
28539
|
-
if (this.configCache) return this.configCache;
|
|
28540
|
-
const response = await $a492ee374ae7b613$export$d902b56530cd5f87.makeHttpRequest(`${this.getEndpoint()}/v1/config`);
|
|
28541
|
-
this.configCache = response.data;
|
|
28542
|
-
return this.configCache;
|
|
28543
|
-
}
|
|
28544
|
-
async loadConfigTokens() {
|
|
28545
|
-
if (this.tokensCache) return this.tokensCache;
|
|
28546
|
-
const response = await $a492ee374ae7b613$export$d902b56530cd5f87.makeHttpRequest(`${this.getEndpoint()}/v1/config/tokens`);
|
|
28547
|
-
this.tokensCache = response.data;
|
|
28548
|
-
return this.tokensCache;
|
|
28549
|
-
}
|
|
28550
|
-
async getConfig(key) {
|
|
28551
|
-
const config = await this.loadConfig();
|
|
28552
|
-
if (!config) return undefined;
|
|
28553
|
-
if (!key) return config;
|
|
28554
|
-
return config[key];
|
|
28555
|
-
}
|
|
28556
|
-
async getTokensConfig(chainId) {
|
|
28557
|
-
const config = await this.loadConfigTokens();
|
|
28558
|
-
if (!config || !config[chainId]) return {};
|
|
28559
|
-
return config[chainId] ?? [];
|
|
28560
|
-
}
|
|
28561
|
-
}
|
|
28562
|
-
|
|
28563
|
-
|
|
28564
|
-
class $4013c5c91bb535f6$export$6ad73ea7e1b6f37f extends Error {
|
|
28565
|
-
message;
|
|
28566
|
-
constructor(message){
|
|
28567
|
-
super(message);
|
|
28568
|
-
this.message = message;
|
|
28569
|
-
}
|
|
28570
|
-
}
|
|
28571
|
-
const $4013c5c91bb535f6$var$networkMap = (prod, dev)=>{
|
|
28572
|
-
if (dev) return $d85ad1457a3f1a83$export$3a9ebede6a150274;
|
|
28573
|
-
if (prod) return $d85ad1457a3f1a83$export$6f24f3cef7d501c4;
|
|
28574
|
-
return $d85ad1457a3f1a83$export$3e81fc0987227f10;
|
|
28575
|
-
};
|
|
28576
|
-
const $4013c5c91bb535f6$export$9b794d067cdd1af6 = (config)=>{
|
|
28577
|
-
// DevMode and Sandbox will both use Sepolia.
|
|
28578
|
-
if (!config.isProduction) return ($0472f23319457bfb$export$c06e1e7429de6283).SEPOLIA;
|
|
28579
|
-
return ($0472f23319457bfb$export$c06e1e7429de6283).ETHEREUM;
|
|
28580
|
-
};
|
|
28581
|
-
const $4013c5c91bb535f6$export$c9af4e4b001c6476 = (config)=>{
|
|
28582
|
-
if (config.isDevelopment) return ($0472f23319457bfb$export$c06e1e7429de6283).IMTBL_ZKEVM_DEVNET;
|
|
28583
|
-
if (config.isProduction) return ($0472f23319457bfb$export$c06e1e7429de6283).IMTBL_ZKEVM_MAINNET;
|
|
28584
|
-
return ($0472f23319457bfb$export$c06e1e7429de6283).IMTBL_ZKEVM_TESTNET;
|
|
28585
|
-
};
|
|
28586
|
-
class $4013c5c91bb535f6$export$4823433c4a67bbc6 {
|
|
28587
|
-
// This is a hidden feature that is only available
|
|
28588
|
-
// when building the project from source code.
|
|
28589
|
-
// This will be used to get around the lack of
|
|
28590
|
-
// Environment.DEVELOPMENT
|
|
28591
|
-
isDevelopment = false;
|
|
28592
|
-
isProduction;
|
|
28593
|
-
isOnRampEnabled;
|
|
28594
|
-
isSwapEnabled;
|
|
28595
|
-
isBridgeEnabled;
|
|
28596
|
-
remote;
|
|
28597
|
-
environment;
|
|
28598
|
-
networkMap;
|
|
28599
|
-
constructor(config){
|
|
28600
|
-
if (!Object.values((Environment$1)).includes(config.baseConfig.environment)) throw new $4013c5c91bb535f6$export$6ad73ea7e1b6f37f("Invalid checkout configuration of environment");
|
|
28601
|
-
this.environment = config.baseConfig.environment;
|
|
28602
|
-
// Developer mode will super set any environment configuration
|
|
28603
|
-
this.isProduction = !this.isDevelopment && this.environment === (Environment$1).PRODUCTION;
|
|
28604
|
-
this.isOnRampEnabled = config.isOnRampEnabled ?? ($d85ad1457a3f1a83$export$72176e2233d7d5d);
|
|
28605
|
-
this.isSwapEnabled = config.isSwapEnabled ?? ($d85ad1457a3f1a83$export$566b5975cc83d6b4);
|
|
28606
|
-
this.isBridgeEnabled = config.isBridgeEnabled ?? ($d85ad1457a3f1a83$export$261cde2078dba35b);
|
|
28607
|
-
this.networkMap = $4013c5c91bb535f6$var$networkMap(this.isProduction, this.isDevelopment);
|
|
28608
|
-
this.remote = new ($a492ee374ae7b613$export$d902b56530cd5f87)({
|
|
28609
|
-
isDevelopment: this.isDevelopment,
|
|
28610
|
-
isProduction: this.isProduction
|
|
28611
|
-
});
|
|
28612
|
-
}
|
|
28613
|
-
}
|
|
28614
|
-
|
|
28615
|
-
|
|
28616
|
-
|
|
28617
|
-
|
|
28618
28660
|
const $2e7bf45a7c9a9570$var$DUMMY_WALLET_ADDRESS = "0x0000000000000000000000000000000000000001";
|
|
28619
28661
|
const $2e7bf45a7c9a9570$var$DEFAULT_TOKEN_DECIMALS = 18;
|
|
28620
28662
|
async function $2e7bf45a7c9a9570$var$getTokenInfoByAddress(config, tokenAddress, chainId, provider) {
|
|
@@ -29952,6 +29994,49 @@ const $9085b221b72ac69e$export$e761f9e0703de895 = async (config, provider, id, c
|
|
|
29952
29994
|
|
|
29953
29995
|
|
|
29954
29996
|
|
|
29997
|
+
|
|
29998
|
+
|
|
29999
|
+
class $a77d203f701a3b72$export$1453e9b801542ef4 {
|
|
30000
|
+
config;
|
|
30001
|
+
/**
|
|
30002
|
+
* Constructs a new instance of the FiatRampService class.
|
|
30003
|
+
* @param {CheckoutConfiguration} config - The config required for the FiatRampService.
|
|
30004
|
+
*/ constructor(config){
|
|
30005
|
+
this.config = config;
|
|
30006
|
+
}
|
|
30007
|
+
async feeEstimate() {
|
|
30008
|
+
const config = await this.config.remote.getConfig("onramp");
|
|
30009
|
+
return config[($bc2bfebf768286d3$export$8cb0af6b2bed4b64).TRANSAK]?.fees;
|
|
30010
|
+
}
|
|
30011
|
+
async createWidgetUrl(params) {
|
|
30012
|
+
return await this.getTransakWidgetUrl(params);
|
|
30013
|
+
}
|
|
30014
|
+
async getTransakWidgetUrl(params) {
|
|
30015
|
+
let widgetUrl = `${($d85ad1457a3f1a83$export$f6043d7fce62d71b)[this.config.environment]}?`;
|
|
30016
|
+
const onRampConfig = await this.config.remote.getConfig("onramp");
|
|
30017
|
+
const apiKey = onRampConfig[($bc2bfebf768286d3$export$8cb0af6b2bed4b64).TRANSAK].publishableApiKey;
|
|
30018
|
+
const transakPublishableKey = `apiKey=${apiKey}`;
|
|
30019
|
+
const zkevmNetwork = "network=immutablezkevm";
|
|
30020
|
+
const defaultPaymentMethod = "defaultPaymentMethod=credit_debit_card";
|
|
30021
|
+
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";
|
|
30022
|
+
const productsAvailed = "productsAvailed=buy";
|
|
30023
|
+
const exchangeScreenTitle = "exchangeScreenTitle=Buy";
|
|
30024
|
+
const themeColor = "themeColor=0D0D0D";
|
|
30025
|
+
widgetUrl += `${transakPublishableKey}&` + `${zkevmNetwork}&` + `${defaultPaymentMethod}&` + `${disableBankTransfer}&` + `${productsAvailed}&` + `${exchangeScreenTitle}&` + `${themeColor}`;
|
|
30026
|
+
if (params.isPassport && params.email) {
|
|
30027
|
+
const encodedEmail = encodeURIComponent(params.email);
|
|
30028
|
+
widgetUrl += `&email=${encodedEmail}&isAutoFillUserData=true&disableWalletAddressForm=true`;
|
|
30029
|
+
}
|
|
30030
|
+
if (params.tokenAmount && params.tokenSymbol) widgetUrl += `&defaultCryptoAmount=${params.tokenAmount}&cryptoCurrencyCode=${params.tokenSymbol}`;
|
|
30031
|
+
else widgetUrl += "&defaultCryptoCurrency=IMX";
|
|
30032
|
+
if (params.walletAddress) widgetUrl += `&walletAddress=${params.walletAddress}`;
|
|
30033
|
+
return widgetUrl;
|
|
30034
|
+
}
|
|
30035
|
+
}
|
|
30036
|
+
|
|
30037
|
+
|
|
30038
|
+
|
|
30039
|
+
|
|
29955
30040
|
const $a8cb37a3fc8eb863$var$SANDBOX_CONFIGURATION = {
|
|
29956
30041
|
baseConfig: {
|
|
29957
30042
|
environment: (Environment$1).SANDBOX
|
|
@@ -29959,12 +30044,14 @@ const $a8cb37a3fc8eb863$var$SANDBOX_CONFIGURATION = {
|
|
|
29959
30044
|
};
|
|
29960
30045
|
class $a8cb37a3fc8eb863$export$1f60ba4ec72508a0 {
|
|
29961
30046
|
config;
|
|
30047
|
+
fiatRampService;
|
|
29962
30048
|
readOnlyProviders;
|
|
29963
30049
|
/**
|
|
29964
30050
|
* Constructs a new instance of the CheckoutModule class.
|
|
29965
30051
|
* @param {CheckoutModuleConfiguration} [config=SANDBOX_CONFIGURATION] - The configuration object for the CheckoutModule.
|
|
29966
30052
|
*/ constructor(config = $a8cb37a3fc8eb863$var$SANDBOX_CONFIGURATION){
|
|
29967
30053
|
this.config = new ($4013c5c91bb535f6$export$4823433c4a67bbc6)(config);
|
|
30054
|
+
this.fiatRampService = new ($a77d203f701a3b72$export$1453e9b801542ef4)(this.config);
|
|
29968
30055
|
this.readOnlyProviders = new Map();
|
|
29969
30056
|
}
|
|
29970
30057
|
/**
|
|
@@ -30125,6 +30212,43 @@ class $a8cb37a3fc8eb863$export$1f60ba4ec72508a0 {
|
|
|
30125
30212
|
this.readOnlyProviders = await ($0e0060cb42e136d2$export$339cb2be73677b30)(this.config, this.readOnlyProviders);
|
|
30126
30213
|
return await $2e7bf45a7c9a9570$export$942c8de7174809fc(params, this.readOnlyProviders, this.config);
|
|
30127
30214
|
}
|
|
30215
|
+
/**
|
|
30216
|
+
* Creates and returns a URL for the fiat ramp widget.
|
|
30217
|
+
* @param {FiatRampParams} params - The parameters for creating the url.
|
|
30218
|
+
* @returns {Promise<string>} - A promise that resolves to a string url.
|
|
30219
|
+
*/ async createFiatRampUrl(params) {
|
|
30220
|
+
let tokenAmount;
|
|
30221
|
+
let tokenSymbol = "IMX";
|
|
30222
|
+
let email;
|
|
30223
|
+
const walletAddress = await params.web3Provider.getSigner().getAddress();
|
|
30224
|
+
const isPassport = params.web3Provider.provider?.isPassport || false;
|
|
30225
|
+
if (isPassport && params.passport) {
|
|
30226
|
+
const userInfo = await params.passport.getUserInfo();
|
|
30227
|
+
email = userInfo?.email;
|
|
30228
|
+
}
|
|
30229
|
+
const tokenList = await $efe60cea83bfc4e8$export$473cec51305fdae8(this.config, {
|
|
30230
|
+
type: ($08d5ddc39acd6833$export$fd9b17d87f4121d2).ONRAMP
|
|
30231
|
+
});
|
|
30232
|
+
const token = tokenList.tokens.find((t)=>t.address?.toLowerCase() === params.tokenAddress?.toLowerCase());
|
|
30233
|
+
if (token) {
|
|
30234
|
+
tokenAmount = params.tokenAmount;
|
|
30235
|
+
tokenSymbol = token.symbol;
|
|
30236
|
+
}
|
|
30237
|
+
return await this.fiatRampService.createWidgetUrl({
|
|
30238
|
+
exchangeType: params.exchangeType,
|
|
30239
|
+
isPassport: isPassport,
|
|
30240
|
+
walletAddress: walletAddress,
|
|
30241
|
+
tokenAmount: tokenAmount,
|
|
30242
|
+
tokenSymbol: tokenSymbol,
|
|
30243
|
+
email: email
|
|
30244
|
+
});
|
|
30245
|
+
}
|
|
30246
|
+
/**
|
|
30247
|
+
* Fetches fiat ramp fee estimations.
|
|
30248
|
+
* @returns {Promise<OnRampProviderFees>} - A promise that resolves to OnRampProviderFees.
|
|
30249
|
+
*/ async getExchangeFeeEstimate() {
|
|
30250
|
+
return await this.fiatRampService.feeEstimate();
|
|
30251
|
+
}
|
|
30128
30252
|
}
|
|
30129
30253
|
|
|
30130
30254
|
var checkout_sdk = /*#__PURE__*/Object.freeze({
|
|
@@ -30134,6 +30258,7 @@ var checkout_sdk = /*#__PURE__*/Object.freeze({
|
|
|
30134
30258
|
get ChainName () { return $0472f23319457bfb$export$b874c6b1dfe85e02; },
|
|
30135
30259
|
Checkout: $a8cb37a3fc8eb863$export$1f60ba4ec72508a0,
|
|
30136
30260
|
get CheckoutErrorType () { return $a8bc256d81a5e2c1$export$e3dc0620abde7f5a; },
|
|
30261
|
+
get ExchangeType () { return $e055e79256bbc1dd$export$80f4da0d409a629d; },
|
|
30137
30262
|
get GasEstimateType () { return $de275b98d2b651c3$export$788b1fd17f3dad84; },
|
|
30138
30263
|
get GasTokenType () { return $4b58188d47aafe8d$export$537fa3efd10ed435; },
|
|
30139
30264
|
get ItemType () { return $4b58188d47aafe8d$export$1fc8f52ad1810e52; },
|
|
@@ -30147,7 +30272,7 @@ var checkout_sdk = /*#__PURE__*/Object.freeze({
|
|
|
30147
30272
|
function $parcel$export(e, n, v, s) {
|
|
30148
30273
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
30149
30274
|
}
|
|
30150
|
-
const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.17.
|
|
30275
|
+
const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.17.4";
|
|
30151
30276
|
const $d663162fd5a0853f$export$83bf90b30cdfd29f = ()=>false;
|
|
30152
30277
|
const $d663162fd5a0853f$export$1169f5475725171b = ()=>$d663162fd5a0853f$export$38a083d9fb5551ca;
|
|
30153
30278
|
|
|
@@ -30212,6 +30337,7 @@ var $207ed853f11d19d5$export$5a0ace85cae72d45;
|
|
|
30212
30337
|
IMTBLWidgetEvents["IMTBL_WALLET_WIDGET_EVENT"] = "imtbl-wallet-widget";
|
|
30213
30338
|
IMTBLWidgetEvents["IMTBL_SWAP_WIDGET_EVENT"] = "imtbl-swap-widget";
|
|
30214
30339
|
IMTBLWidgetEvents["IMTBL_BRIDGE_WIDGET_EVENT"] = "imtbl-bridge-widget";
|
|
30340
|
+
IMTBLWidgetEvents["IMTBL_ONRAMP_WIDGET_EVENT"] = "imtbl-onramp-widget";
|
|
30215
30341
|
})($207ed853f11d19d5$export$5a0ace85cae72d45 || ($207ed853f11d19d5$export$5a0ace85cae72d45 = {}));
|
|
30216
30342
|
|
|
30217
30343
|
|
|
@@ -30277,6 +30403,19 @@ $parcel$export($ad06b030b1a3ba34$exports, "OrchestrationEventType", () => $ad06b
|
|
|
30277
30403
|
OrchestrationEventType["REQUEST_BRIDGE"] = "request-bridge";
|
|
30278
30404
|
OrchestrationEventType["REQUEST_ONRAMP"] = "request-onramp";
|
|
30279
30405
|
})($ad06b030b1a3ba34$export$b80d2daf830437b9 || ($ad06b030b1a3ba34$export$b80d2daf830437b9 = {}));
|
|
30406
|
+
|
|
30407
|
+
|
|
30408
|
+
var $d882ddc5600b1284$exports = {};
|
|
30409
|
+
|
|
30410
|
+
$parcel$export($d882ddc5600b1284$exports, "OnRampEventType", () => $d882ddc5600b1284$export$66ec39c0924078d8);
|
|
30411
|
+
/**
|
|
30412
|
+
* Enum of possible OnRamp Widget event types.
|
|
30413
|
+
*/ var $d882ddc5600b1284$export$66ec39c0924078d8;
|
|
30414
|
+
(function(OnRampEventType) {
|
|
30415
|
+
OnRampEventType["CLOSE_WIDGET"] = "close-widget";
|
|
30416
|
+
OnRampEventType["SUCCESS"] = "success";
|
|
30417
|
+
OnRampEventType["FAILURE"] = "failure";
|
|
30418
|
+
})($d882ddc5600b1284$export$66ec39c0924078d8 || ($d882ddc5600b1284$export$66ec39c0924078d8 = {}));
|
|
30280
30419
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
30281
30420
|
|
|
30282
30421
|
var $045213b18e9f1f94$exports = {};
|
|
@@ -30297,6 +30436,7 @@ var $045213b18e9f1f94$export$75be0f6af9650f2c;
|
|
|
30297
30436
|
CheckoutWidgetTagNames["WALLET"] = "imtbl-wallet";
|
|
30298
30437
|
CheckoutWidgetTagNames["SWAP"] = "imtbl-swap";
|
|
30299
30438
|
CheckoutWidgetTagNames["BRIDGE"] = "imtbl-bridge";
|
|
30439
|
+
CheckoutWidgetTagNames["ONRAMP"] = "imtbl-onramp";
|
|
30300
30440
|
})($045213b18e9f1f94$export$75be0f6af9650f2c || ($045213b18e9f1f94$export$75be0f6af9650f2c = {}));
|
|
30301
30441
|
|
|
30302
30442
|
|
|
@@ -30465,6 +30605,33 @@ function $89d55ace0f8f1c07$export$ceaac94f34dba154(props) {
|
|
|
30465
30605
|
});
|
|
30466
30606
|
}
|
|
30467
30607
|
|
|
30608
|
+
|
|
30609
|
+
var $f94f63f2c041a04c$exports = {};
|
|
30610
|
+
|
|
30611
|
+
$parcel$export($f94f63f2c041a04c$exports, "OnRampReact", () => $f94f63f2c041a04c$export$9e363c61ea99bbb4);
|
|
30612
|
+
|
|
30613
|
+
|
|
30614
|
+
|
|
30615
|
+
|
|
30616
|
+
|
|
30617
|
+
function $f94f63f2c041a04c$export$9e363c61ea99bbb4(props) {
|
|
30618
|
+
const { walletProvider: walletProvider, amount: amount, provider: provider, passport: passport, contractAddress: contractAddress } = props;
|
|
30619
|
+
(useEffect)(()=>{
|
|
30620
|
+
if (provider) ($77ec335383336bdd$export$931068bc678f0d73)(($045213b18e9f1f94$export$75be0f6af9650f2c).ONRAMP, provider);
|
|
30621
|
+
if (passport) ($b222a8f062090058$export$fae4199086a966a3)(($045213b18e9f1f94$export$75be0f6af9650f2c).ONRAMP, passport);
|
|
30622
|
+
}, [
|
|
30623
|
+
provider,
|
|
30624
|
+
passport
|
|
30625
|
+
]);
|
|
30626
|
+
const config = window.ImtblCheckoutWidgetConfig;
|
|
30627
|
+
return /*#__PURE__*/ (jsx)("imtbl-onramp", {
|
|
30628
|
+
widgetConfig: config,
|
|
30629
|
+
walletProvider: walletProvider,
|
|
30630
|
+
amount: amount ?? "",
|
|
30631
|
+
contractAddress: contractAddress ?? ""
|
|
30632
|
+
});
|
|
30633
|
+
}
|
|
30634
|
+
|
|
30468
30635
|
var checkout_widgets = /*#__PURE__*/Object.freeze({
|
|
30469
30636
|
__proto__: null,
|
|
30470
30637
|
get BridgeEventType () { return $15cc9e120aa6f3bf$export$d1bfa21f7c76447a; },
|
|
@@ -30474,6 +30641,8 @@ var checkout_widgets = /*#__PURE__*/Object.freeze({
|
|
|
30474
30641
|
get ConnectEventType () { return $a85ecdbd885c58ad$export$e72e7f9969a47dd3; },
|
|
30475
30642
|
ConnectReact: $f2083cd30e2f5c56$export$49d62957f420a1e2,
|
|
30476
30643
|
get IMTBLWidgetEvents () { return $207ed853f11d19d5$export$5a0ace85cae72d45; },
|
|
30644
|
+
get OnRampEventType () { return $d882ddc5600b1284$export$66ec39c0924078d8; },
|
|
30645
|
+
OnRampReact: $f94f63f2c041a04c$export$9e363c61ea99bbb4,
|
|
30477
30646
|
get OrchestrationEventType () { return $ad06b030b1a3ba34$export$b80d2daf830437b9; },
|
|
30478
30647
|
get SwapEventType () { return $53d219e7f6bf0cd6$export$140a49745ab55563; },
|
|
30479
30648
|
SwapReact: $a4fbb8e3a6aeff58$export$971e031379577f4,
|
package/dist/passport.js
CHANGED
|
@@ -1709,7 +1709,7 @@ class MultiRollupApiClients {
|
|
|
1709
1709
|
}
|
|
1710
1710
|
|
|
1711
1711
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
1712
|
-
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-0.17.
|
|
1712
|
+
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-0.17.4' };
|
|
1713
1713
|
const createConfig = ({ basePath, headers, }) => {
|
|
1714
1714
|
if (!basePath.trim()) {
|
|
1715
1715
|
throw Error('basePath can not be empty');
|
|
@@ -1765,7 +1765,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
1765
1765
|
chainID,
|
|
1766
1766
|
coreContractAddress,
|
|
1767
1767
|
registrationContractAddress,
|
|
1768
|
-
sdkVersion: 'ts-immutable-sdk-0.17.
|
|
1768
|
+
sdkVersion: 'ts-immutable-sdk-0.17.4',
|
|
1769
1769
|
});
|
|
1770
1770
|
/**
|
|
1771
1771
|
* Sets `sdkVersion` at the time of build
|
package/package.json
CHANGED