@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/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.1' };
2705
+ const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.17.3' };
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.1',
2765
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.17.3',
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.1',
3051
+ sdkVersion: 'ts-immutable-sdk-0.17.3',
3052
3052
  });
3053
3053
  /**
3054
3054
  * Sets `sdkVersion` at the time of build
@@ -27352,6 +27352,10 @@ var $0472f23319457bfb$export$b874c6b1dfe85e02;
27352
27352
  })($0472f23319457bfb$export$b874c6b1dfe85e02 || ($0472f23319457bfb$export$b874c6b1dfe85e02 = {}));
27353
27353
 
27354
27354
 
27355
+ var $bc2bfebf768286d3$export$8cb0af6b2bed4b64;
27356
+ (function(OnRampProvider) {
27357
+ OnRampProvider["TRANSAK"] = "201811419111";
27358
+ })($bc2bfebf768286d3$export$8cb0af6b2bed4b64 || ($bc2bfebf768286d3$export$8cb0af6b2bed4b64 = {}));
27355
27359
 
27356
27360
 
27357
27361
 
@@ -27383,6 +27387,7 @@ var $08d5ddc39acd6833$export$fd9b17d87f4121d2;
27383
27387
  TokenFilterTypes["ALL"] = "all";
27384
27388
  TokenFilterTypes["SWAP"] = "swap";
27385
27389
  TokenFilterTypes["BRIDGE"] = "bridge";
27390
+ TokenFilterTypes["ONRAMP"] = "onramp";
27386
27391
  })($08d5ddc39acd6833$export$fd9b17d87f4121d2 || ($08d5ddc39acd6833$export$fd9b17d87f4121d2 = {}));
27387
27392
 
27388
27393
 
@@ -27448,6 +27453,10 @@ const $d85ad1457a3f1a83$export$fc55ed5a42b458ba = {
27448
27453
  nativeToken: $d85ad1457a3f1a83$var$ZKEVM_NATIVE_TOKEN
27449
27454
  }
27450
27455
  };
27456
+ const $d85ad1457a3f1a83$export$f6043d7fce62d71b = {
27457
+ [(Environment$1).SANDBOX]: "https://global-stg.transak.com",
27458
+ [(Environment$1).PRODUCTION]: "https://global.transak.com/"
27459
+ };
27451
27460
  const $d85ad1457a3f1a83$export$6f24f3cef7d501c4 = new Map([
27452
27461
  [
27453
27462
  ($0472f23319457bfb$export$c06e1e7429de6283).ETHEREUM,
@@ -27754,6 +27763,12 @@ var $4b58188d47aafe8d$export$537fa3efd10ed435;
27754
27763
  })($4b58188d47aafe8d$export$537fa3efd10ed435 || ($4b58188d47aafe8d$export$537fa3efd10ed435 = {}));
27755
27764
 
27756
27765
 
27766
+ var $e055e79256bbc1dd$export$80f4da0d409a629d;
27767
+ (function(ExchangeType) {
27768
+ ExchangeType["ONRAMP"] = "onramp";
27769
+ })($e055e79256bbc1dd$export$80f4da0d409a629d || ($e055e79256bbc1dd$export$80f4da0d409a629d = {}));
27770
+
27771
+
27757
27772
 
27758
27773
 
27759
27774
  /**
@@ -27965,8 +27980,118 @@ async function $de192de6ef100f9f$export$b827d9418aeb5dbd(config, web3Provider, c
27965
27980
 
27966
27981
 
27967
27982
 
27983
+
27984
+
27985
+
27986
+
27987
+
27988
+ class $a492ee374ae7b613$export$d902b56530cd5f87 {
27989
+ isDevelopment;
27990
+ isProduction;
27991
+ configCache;
27992
+ tokensCache;
27993
+ constructor(params){
27994
+ this.isDevelopment = params.isDevelopment;
27995
+ this.isProduction = params.isProduction;
27996
+ }
27997
+ static async makeHttpRequest(url) {
27998
+ let response;
27999
+ try {
28000
+ response = await (0, globalAxios$1).get(url);
28001
+ } catch (error) {
28002
+ throw new Error(`Error fetching from api: ${error.message}`);
28003
+ }
28004
+ if (response.status !== 200) throw new Error(`Error fetching from api: ${response.status} ${response.statusText}`);
28005
+ return response;
28006
+ }
28007
+ getEndpoint = ()=>{
28008
+ if (this.isDevelopment) return ($d85ad1457a3f1a83$export$161d4a74df65fc08)[$d85ad1457a3f1a83$export$7d3a9eeba384fa59];
28009
+ if (this.isProduction) return ($d85ad1457a3f1a83$export$161d4a74df65fc08)[(Environment$1).PRODUCTION];
28010
+ return ($d85ad1457a3f1a83$export$161d4a74df65fc08)[(Environment$1).SANDBOX];
28011
+ };
28012
+ async loadConfig() {
28013
+ if (this.configCache) return this.configCache;
28014
+ const response = await $a492ee374ae7b613$export$d902b56530cd5f87.makeHttpRequest(`${this.getEndpoint()}/v1/config`);
28015
+ this.configCache = response.data;
28016
+ return this.configCache;
28017
+ }
28018
+ async loadConfigTokens() {
28019
+ if (this.tokensCache) return this.tokensCache;
28020
+ const response = await $a492ee374ae7b613$export$d902b56530cd5f87.makeHttpRequest(`${this.getEndpoint()}/v1/config/tokens`);
28021
+ this.tokensCache = response.data;
28022
+ return this.tokensCache;
28023
+ }
28024
+ async getConfig(key) {
28025
+ const config = await this.loadConfig();
28026
+ if (!config) return undefined;
28027
+ if (!key) return config;
28028
+ return config[key];
28029
+ }
28030
+ async getTokensConfig(chainId) {
28031
+ const config = await this.loadConfigTokens();
28032
+ if (!config || !config[chainId]) return {};
28033
+ return config[chainId] ?? [];
28034
+ }
28035
+ }
28036
+
28037
+
28038
+ class $4013c5c91bb535f6$export$6ad73ea7e1b6f37f extends Error {
28039
+ message;
28040
+ constructor(message){
28041
+ super(message);
28042
+ this.message = message;
28043
+ }
28044
+ }
28045
+ const $4013c5c91bb535f6$var$networkMap = (prod, dev)=>{
28046
+ if (dev) return $d85ad1457a3f1a83$export$3a9ebede6a150274;
28047
+ if (prod) return $d85ad1457a3f1a83$export$6f24f3cef7d501c4;
28048
+ return $d85ad1457a3f1a83$export$3e81fc0987227f10;
28049
+ };
28050
+ const $4013c5c91bb535f6$export$9b794d067cdd1af6 = (config)=>{
28051
+ // DevMode and Sandbox will both use Sepolia.
28052
+ if (!config.isProduction) return ($0472f23319457bfb$export$c06e1e7429de6283).SEPOLIA;
28053
+ return ($0472f23319457bfb$export$c06e1e7429de6283).ETHEREUM;
28054
+ };
28055
+ const $4013c5c91bb535f6$export$c9af4e4b001c6476 = (config)=>{
28056
+ if (config.isDevelopment) return ($0472f23319457bfb$export$c06e1e7429de6283).IMTBL_ZKEVM_DEVNET;
28057
+ if (config.isProduction) return ($0472f23319457bfb$export$c06e1e7429de6283).IMTBL_ZKEVM_MAINNET;
28058
+ return ($0472f23319457bfb$export$c06e1e7429de6283).IMTBL_ZKEVM_TESTNET;
28059
+ };
28060
+ class $4013c5c91bb535f6$export$4823433c4a67bbc6 {
28061
+ // This is a hidden feature that is only available
28062
+ // when building the project from source code.
28063
+ // This will be used to get around the lack of
28064
+ // Environment.DEVELOPMENT
28065
+ isDevelopment = false;
28066
+ isProduction;
28067
+ isOnRampEnabled;
28068
+ isSwapEnabled;
28069
+ isBridgeEnabled;
28070
+ remote;
28071
+ environment;
28072
+ networkMap;
28073
+ constructor(config){
28074
+ if (!Object.values((Environment$1)).includes(config.baseConfig.environment)) throw new $4013c5c91bb535f6$export$6ad73ea7e1b6f37f("Invalid checkout configuration of environment");
28075
+ this.environment = config.baseConfig.environment;
28076
+ // Developer mode will super set any environment configuration
28077
+ this.isProduction = !this.isDevelopment && this.environment === (Environment$1).PRODUCTION;
28078
+ this.isOnRampEnabled = config.isOnRampEnabled ?? ($d85ad1457a3f1a83$export$72176e2233d7d5d);
28079
+ this.isSwapEnabled = config.isSwapEnabled ?? ($d85ad1457a3f1a83$export$566b5975cc83d6b4);
28080
+ this.isBridgeEnabled = config.isBridgeEnabled ?? ($d85ad1457a3f1a83$export$261cde2078dba35b);
28081
+ this.networkMap = $4013c5c91bb535f6$var$networkMap(this.isProduction, this.isDevelopment);
28082
+ this.remote = new ($a492ee374ae7b613$export$d902b56530cd5f87)({
28083
+ isDevelopment: this.isDevelopment,
28084
+ isProduction: this.isProduction
28085
+ });
28086
+ }
28087
+ }
28088
+
28089
+
28090
+
28091
+
27968
28092
  const $efe60cea83bfc4e8$export$473cec51305fdae8 = async (config, { type: type = ($08d5ddc39acd6833$export$fd9b17d87f4121d2).ALL, chainId: chainId, exclude: exclude })=>{
27969
28093
  let tokens = [];
28094
+ let onRampConfig;
27970
28095
  switch(type){
27971
28096
  case ($08d5ddc39acd6833$export$fd9b17d87f4121d2).SWAP:
27972
28097
  // Fetch tokens from dex-tokens config because
@@ -27974,10 +28099,16 @@ const $efe60cea83bfc4e8$export$473cec51305fdae8 = async (config, { type: type =
27974
28099
  // legal reasons.
27975
28100
  tokens = (await config.remote.getConfig("dex")).tokens || [];
27976
28101
  break;
28102
+ case ($08d5ddc39acd6833$export$fd9b17d87f4121d2).ONRAMP:
28103
+ onRampConfig = await config.remote.getConfig("onramp");
28104
+ // Only using Transak as it's the only on-ramp provider at the moment
28105
+ if (!onRampConfig) tokens = [];
28106
+ tokens = onRampConfig[($bc2bfebf768286d3$export$8cb0af6b2bed4b64).TRANSAK]?.tokens || [];
28107
+ break;
27977
28108
  case ($08d5ddc39acd6833$export$fd9b17d87f4121d2).BRIDGE:
27978
28109
  case ($08d5ddc39acd6833$export$fd9b17d87f4121d2).ALL:
27979
28110
  default:
27980
- tokens = (await config.remote.getTokensConfig(chainId)).allowed;
28111
+ tokens = (await config.remote.getTokensConfig(chainId || ($4013c5c91bb535f6$export$9b794d067cdd1af6)(config))).allowed;
27981
28112
  }
27982
28113
  if (!exclude || exclude?.length === 0) return {
27983
28114
  tokens: tokens
@@ -28050,7 +28181,7 @@ class $fd8a8472dcc3ec2b$export$ef140a6b05dfc786 {
28050
28181
  if (params.nextPage) url += `&${new URLSearchParams(params.nextPage)}`;
28051
28182
  // Cache response data to prevent unnecessary requests
28052
28183
  const cached = this.getCache(url);
28053
- if (cached && cached.status < 400) return Promise.resolve(cached.data);
28184
+ if (cached) return Promise.resolve(cached);
28054
28185
  const response = await $fd8a8472dcc3ec2b$export$ef140a6b05dfc786.makeHttpRequest(url);
28055
28186
  if (response.status >= 400) return Promise.reject({
28056
28187
  code: response.status,
@@ -28089,7 +28220,7 @@ class $fd8a8472dcc3ec2b$export$ef140a6b05dfc786 {
28089
28220
  const url = `${this.url}/api/v2/addresses/${params.walletAddress}`;
28090
28221
  // Cache response data to prevent unnecessary requests
28091
28222
  const cached = this.getCache(url);
28092
- if (cached && cached.status < 400) return Promise.resolve(cached.data);
28223
+ if (cached) return Promise.resolve(cached);
28093
28224
  const response = await $fd8a8472dcc3ec2b$export$ef140a6b05dfc786.makeHttpRequest(url);
28094
28225
  if (response.status >= 400) return Promise.reject({
28095
28226
  code: response.status,
@@ -28507,114 +28638,6 @@ async function $67fc622a2b913d5f$export$c60ce6c6a92bc2ff(config) {
28507
28638
 
28508
28639
 
28509
28640
 
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
28641
  const $2e7bf45a7c9a9570$var$DUMMY_WALLET_ADDRESS = "0x0000000000000000000000000000000000000001";
28619
28642
  const $2e7bf45a7c9a9570$var$DEFAULT_TOKEN_DECIMALS = 18;
28620
28643
  async function $2e7bf45a7c9a9570$var$getTokenInfoByAddress(config, tokenAddress, chainId, provider) {
@@ -29952,6 +29975,49 @@ const $9085b221b72ac69e$export$e761f9e0703de895 = async (config, provider, id, c
29952
29975
 
29953
29976
 
29954
29977
 
29978
+
29979
+
29980
+ class $a77d203f701a3b72$export$1453e9b801542ef4 {
29981
+ config;
29982
+ /**
29983
+ * Constructs a new instance of the FiatRampService class.
29984
+ * @param {CheckoutConfiguration} config - The config required for the FiatRampService.
29985
+ */ constructor(config){
29986
+ this.config = config;
29987
+ }
29988
+ async feeEstimate() {
29989
+ const config = await this.config.remote.getConfig("onramp");
29990
+ return config[($bc2bfebf768286d3$export$8cb0af6b2bed4b64).TRANSAK]?.fees;
29991
+ }
29992
+ async createWidgetUrl(params) {
29993
+ return await this.getTransakWidgetUrl(params);
29994
+ }
29995
+ async getTransakWidgetUrl(params) {
29996
+ let widgetUrl = `${($d85ad1457a3f1a83$export$f6043d7fce62d71b)[this.config.environment]}?`;
29997
+ const onRampConfig = await this.config.remote.getConfig("onramp");
29998
+ const apiKey = onRampConfig[($bc2bfebf768286d3$export$8cb0af6b2bed4b64).TRANSAK].publishableApiKey;
29999
+ const transakPublishableKey = `apiKey=${apiKey}`;
30000
+ const zkevmNetwork = "network=immutablezkevm";
30001
+ const defaultPaymentMethod = "defaultPaymentMethod=credit_debit_card";
30002
+ 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";
30003
+ const productsAvailed = "productsAvailed=buy";
30004
+ const exchangeScreenTitle = "exchangeScreenTitle=Buy";
30005
+ const themeColor = "themeColor=0D0D0D";
30006
+ widgetUrl += `${transakPublishableKey}&` + `${zkevmNetwork}&` + `${defaultPaymentMethod}&` + `${disableBankTransfer}&` + `${productsAvailed}&` + `${exchangeScreenTitle}&` + `${themeColor}`;
30007
+ if (params.isPassport && params.email) {
30008
+ const encodedEmail = encodeURIComponent(params.email);
30009
+ widgetUrl += `&email=${encodedEmail}&isAutoFillUserData=true&disableWalletAddressForm=true`;
30010
+ }
30011
+ if (params.tokenAmount && params.tokenSymbol) widgetUrl += `&defaultCryptoAmount=${params.tokenAmount}&cryptoCurrencyCode=${params.tokenSymbol}`;
30012
+ else widgetUrl += "&defaultCryptoCurrency=IMX";
30013
+ if (params.walletAddress) widgetUrl += `&walletAddress=${params.walletAddress}`;
30014
+ return widgetUrl;
30015
+ }
30016
+ }
30017
+
30018
+
30019
+
30020
+
29955
30021
  const $a8cb37a3fc8eb863$var$SANDBOX_CONFIGURATION = {
29956
30022
  baseConfig: {
29957
30023
  environment: (Environment$1).SANDBOX
@@ -29959,12 +30025,14 @@ const $a8cb37a3fc8eb863$var$SANDBOX_CONFIGURATION = {
29959
30025
  };
29960
30026
  class $a8cb37a3fc8eb863$export$1f60ba4ec72508a0 {
29961
30027
  config;
30028
+ fiatRampService;
29962
30029
  readOnlyProviders;
29963
30030
  /**
29964
30031
  * Constructs a new instance of the CheckoutModule class.
29965
30032
  * @param {CheckoutModuleConfiguration} [config=SANDBOX_CONFIGURATION] - The configuration object for the CheckoutModule.
29966
30033
  */ constructor(config = $a8cb37a3fc8eb863$var$SANDBOX_CONFIGURATION){
29967
30034
  this.config = new ($4013c5c91bb535f6$export$4823433c4a67bbc6)(config);
30035
+ this.fiatRampService = new ($a77d203f701a3b72$export$1453e9b801542ef4)(this.config);
29968
30036
  this.readOnlyProviders = new Map();
29969
30037
  }
29970
30038
  /**
@@ -30125,6 +30193,43 @@ class $a8cb37a3fc8eb863$export$1f60ba4ec72508a0 {
30125
30193
  this.readOnlyProviders = await ($0e0060cb42e136d2$export$339cb2be73677b30)(this.config, this.readOnlyProviders);
30126
30194
  return await $2e7bf45a7c9a9570$export$942c8de7174809fc(params, this.readOnlyProviders, this.config);
30127
30195
  }
30196
+ /**
30197
+ * Creates and returns a URL for the fiat ramp widget.
30198
+ * @param {FiatRampParams} params - The parameters for creating the url.
30199
+ * @returns {Promise<string>} - A promise that resolves to a string url.
30200
+ */ async createFiatRampUrl(params) {
30201
+ let tokenAmount;
30202
+ let tokenSymbol = "IMX";
30203
+ let email;
30204
+ const walletAddress = await params.web3Provider.getSigner().getAddress();
30205
+ const isPassport = params.web3Provider.provider?.isPassport || false;
30206
+ if (isPassport && params.passport) {
30207
+ const userInfo = await params.passport.getUserInfo();
30208
+ email = userInfo?.email;
30209
+ }
30210
+ const tokenList = await $efe60cea83bfc4e8$export$473cec51305fdae8(this.config, {
30211
+ type: ($08d5ddc39acd6833$export$fd9b17d87f4121d2).ONRAMP
30212
+ });
30213
+ const token = tokenList.tokens.find((t)=>t.address?.toLowerCase() === params.tokenAddress?.toLowerCase());
30214
+ if (token) {
30215
+ tokenAmount = params.tokenAmount;
30216
+ tokenSymbol = token.symbol;
30217
+ }
30218
+ return await this.fiatRampService.createWidgetUrl({
30219
+ exchangeType: params.exchangeType,
30220
+ isPassport: isPassport,
30221
+ walletAddress: walletAddress,
30222
+ tokenAmount: tokenAmount,
30223
+ tokenSymbol: tokenSymbol,
30224
+ email: email
30225
+ });
30226
+ }
30227
+ /**
30228
+ * Fetches fiat ramp fee estimations.
30229
+ * @returns {Promise<OnRampProviderFees>} - A promise that resolves to OnRampProviderFees.
30230
+ */ async getExchangeFeeEstimate() {
30231
+ return await this.fiatRampService.feeEstimate();
30232
+ }
30128
30233
  }
30129
30234
 
30130
30235
  var checkout_sdk = /*#__PURE__*/Object.freeze({
@@ -30134,6 +30239,7 @@ var checkout_sdk = /*#__PURE__*/Object.freeze({
30134
30239
  get ChainName () { return $0472f23319457bfb$export$b874c6b1dfe85e02; },
30135
30240
  Checkout: $a8cb37a3fc8eb863$export$1f60ba4ec72508a0,
30136
30241
  get CheckoutErrorType () { return $a8bc256d81a5e2c1$export$e3dc0620abde7f5a; },
30242
+ get ExchangeType () { return $e055e79256bbc1dd$export$80f4da0d409a629d; },
30137
30243
  get GasEstimateType () { return $de275b98d2b651c3$export$788b1fd17f3dad84; },
30138
30244
  get GasTokenType () { return $4b58188d47aafe8d$export$537fa3efd10ed435; },
30139
30245
  get ItemType () { return $4b58188d47aafe8d$export$1fc8f52ad1810e52; },
@@ -30147,7 +30253,7 @@ var checkout_sdk = /*#__PURE__*/Object.freeze({
30147
30253
  function $parcel$export(e, n, v, s) {
30148
30254
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
30149
30255
  }
30150
- const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.17.1";
30256
+ const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.17.3";
30151
30257
  const $d663162fd5a0853f$export$83bf90b30cdfd29f = ()=>false;
30152
30258
  const $d663162fd5a0853f$export$1169f5475725171b = ()=>$d663162fd5a0853f$export$38a083d9fb5551ca;
30153
30259
 
@@ -30212,6 +30318,7 @@ var $207ed853f11d19d5$export$5a0ace85cae72d45;
30212
30318
  IMTBLWidgetEvents["IMTBL_WALLET_WIDGET_EVENT"] = "imtbl-wallet-widget";
30213
30319
  IMTBLWidgetEvents["IMTBL_SWAP_WIDGET_EVENT"] = "imtbl-swap-widget";
30214
30320
  IMTBLWidgetEvents["IMTBL_BRIDGE_WIDGET_EVENT"] = "imtbl-bridge-widget";
30321
+ IMTBLWidgetEvents["IMTBL_ONRAMP_WIDGET_EVENT"] = "imtbl-onramp-widget";
30215
30322
  })($207ed853f11d19d5$export$5a0ace85cae72d45 || ($207ed853f11d19d5$export$5a0ace85cae72d45 = {}));
30216
30323
 
30217
30324
 
@@ -30277,6 +30384,19 @@ $parcel$export($ad06b030b1a3ba34$exports, "OrchestrationEventType", () => $ad06b
30277
30384
  OrchestrationEventType["REQUEST_BRIDGE"] = "request-bridge";
30278
30385
  OrchestrationEventType["REQUEST_ONRAMP"] = "request-onramp";
30279
30386
  })($ad06b030b1a3ba34$export$b80d2daf830437b9 || ($ad06b030b1a3ba34$export$b80d2daf830437b9 = {}));
30387
+
30388
+
30389
+ var $d882ddc5600b1284$exports = {};
30390
+
30391
+ $parcel$export($d882ddc5600b1284$exports, "OnRampEventType", () => $d882ddc5600b1284$export$66ec39c0924078d8);
30392
+ /**
30393
+ * Enum of possible OnRamp Widget event types.
30394
+ */ var $d882ddc5600b1284$export$66ec39c0924078d8;
30395
+ (function(OnRampEventType) {
30396
+ OnRampEventType["CLOSE_WIDGET"] = "close-widget";
30397
+ OnRampEventType["SUCCESS"] = "success";
30398
+ OnRampEventType["FAILURE"] = "failure";
30399
+ })($d882ddc5600b1284$export$66ec39c0924078d8 || ($d882ddc5600b1284$export$66ec39c0924078d8 = {}));
30280
30400
  /* eslint-disable @typescript-eslint/naming-convention */
30281
30401
 
30282
30402
  var $045213b18e9f1f94$exports = {};
@@ -30297,6 +30417,7 @@ var $045213b18e9f1f94$export$75be0f6af9650f2c;
30297
30417
  CheckoutWidgetTagNames["WALLET"] = "imtbl-wallet";
30298
30418
  CheckoutWidgetTagNames["SWAP"] = "imtbl-swap";
30299
30419
  CheckoutWidgetTagNames["BRIDGE"] = "imtbl-bridge";
30420
+ CheckoutWidgetTagNames["ONRAMP"] = "imtbl-onramp";
30300
30421
  })($045213b18e9f1f94$export$75be0f6af9650f2c || ($045213b18e9f1f94$export$75be0f6af9650f2c = {}));
30301
30422
 
30302
30423
 
@@ -30465,6 +30586,33 @@ function $89d55ace0f8f1c07$export$ceaac94f34dba154(props) {
30465
30586
  });
30466
30587
  }
30467
30588
 
30589
+
30590
+ var $f94f63f2c041a04c$exports = {};
30591
+
30592
+ $parcel$export($f94f63f2c041a04c$exports, "OnRampReact", () => $f94f63f2c041a04c$export$9e363c61ea99bbb4);
30593
+
30594
+
30595
+
30596
+
30597
+
30598
+ function $f94f63f2c041a04c$export$9e363c61ea99bbb4(props) {
30599
+ const { walletProvider: walletProvider, amount: amount, provider: provider, passport: passport, contractAddress: contractAddress } = props;
30600
+ (useEffect)(()=>{
30601
+ if (provider) ($77ec335383336bdd$export$931068bc678f0d73)(($045213b18e9f1f94$export$75be0f6af9650f2c).ONRAMP, provider);
30602
+ if (passport) ($b222a8f062090058$export$fae4199086a966a3)(($045213b18e9f1f94$export$75be0f6af9650f2c).ONRAMP, passport);
30603
+ }, [
30604
+ provider,
30605
+ passport
30606
+ ]);
30607
+ const config = window.ImtblCheckoutWidgetConfig;
30608
+ return /*#__PURE__*/ (jsx)("imtbl-onramp", {
30609
+ widgetConfig: config,
30610
+ walletProvider: walletProvider,
30611
+ amount: amount ?? "",
30612
+ contractAddress: contractAddress ?? ""
30613
+ });
30614
+ }
30615
+
30468
30616
  var checkout_widgets = /*#__PURE__*/Object.freeze({
30469
30617
  __proto__: null,
30470
30618
  get BridgeEventType () { return $15cc9e120aa6f3bf$export$d1bfa21f7c76447a; },
@@ -30474,6 +30622,8 @@ var checkout_widgets = /*#__PURE__*/Object.freeze({
30474
30622
  get ConnectEventType () { return $a85ecdbd885c58ad$export$e72e7f9969a47dd3; },
30475
30623
  ConnectReact: $f2083cd30e2f5c56$export$49d62957f420a1e2,
30476
30624
  get IMTBLWidgetEvents () { return $207ed853f11d19d5$export$5a0ace85cae72d45; },
30625
+ get OnRampEventType () { return $d882ddc5600b1284$export$66ec39c0924078d8; },
30626
+ OnRampReact: $f94f63f2c041a04c$export$9e363c61ea99bbb4,
30477
30627
  get OrchestrationEventType () { return $ad06b030b1a3ba34$export$b80d2daf830437b9; },
30478
30628
  get SwapEventType () { return $53d219e7f6bf0cd6$export$140a49745ab55563; },
30479
30629
  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.1' };
1712
+ const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-0.17.3' };
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.1',
1768
+ sdkVersion: 'ts-immutable-sdk-0.17.3',
1769
1769
  });
1770
1770
  /**
1771
1771
  * Sets `sdkVersion` at the time of build
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@imtbl/sdk",
3
3
  "description": "Immutable Unified SDK",
4
- "version": "0.17.1",
4
+ "version": "0.17.3",
5
5
  "author": "Immutable",
6
6
  "browser": "./dist/index.browser.js",
7
7
  "bugs": "https://github.com/immutable/ts-immutable-sdk/issues",