btc-wallet 0.4.5-beta → 0.4.7-beta

Sign up to get free protection for your applications and to get access to all the features.
package/esm/index.js CHANGED
@@ -2627,35 +2627,107 @@ function createFloatingButtonWithIframe({
2627
2627
  }) {
2628
2628
  const button = document.createElement("img");
2629
2629
  button.id = "satoshi-wallet-button";
2630
- button.src = openImageUrl;
2630
+ const isIframeVisible = localStorage.getItem("btc-wallet-iframe-visible") === "true";
2631
+ button.src = isIframeVisible ? closeImageUrl : openImageUrl;
2632
+ iframe.style.display = isIframeVisible ? "block" : "none";
2633
+ const windowWidth = window.innerWidth;
2634
+ const windowHeight = window.innerHeight;
2635
+ const savedPosition = JSON.parse(
2636
+ localStorage.getItem("btc-wallet-button-position") || '{"right": "20px", "bottom": "20px"}'
2637
+ );
2638
+ const right = Math.min(Math.max(20, parseInt(savedPosition.right)), windowWidth - 80);
2639
+ const bottom = Math.min(Math.max(20, parseInt(savedPosition.bottom)), windowHeight - 80);
2631
2640
  Object.assign(button.style, {
2632
2641
  position: "fixed",
2633
- bottom: "20px",
2634
- right: "20px",
2642
+ bottom: `${bottom}px`,
2643
+ right: `${right}px`,
2635
2644
  zIndex: "100000",
2636
2645
  width: "60px",
2637
2646
  height: "60px",
2638
2647
  borderRadius: "50%",
2639
- cursor: "pointer",
2640
- transition: "transform 0.15s ease"
2648
+ cursor: "grab",
2649
+ transition: "transform 0.15s ease",
2650
+ userSelect: "none"
2641
2651
  });
2642
2652
  document.body.appendChild(button);
2643
- const iframeVisible = localStorage.getItem("iframeVisible") === "true" || localStorage.getItem("iframeVisible") === null;
2644
- button.src = iframeVisible ? closeImageUrl : openImageUrl;
2645
- iframe.style.display = iframeVisible ? "block" : "none";
2646
- button.onclick = function() {
2653
+ let isDragging = false;
2654
+ let startX = 0;
2655
+ let startY = 0;
2656
+ let initialRight = 0;
2657
+ let initialBottom = 0;
2658
+ let dragStartTime = 0;
2659
+ button.addEventListener("mousedown", (e) => {
2660
+ isDragging = true;
2661
+ startX = e.clientX;
2662
+ startY = e.clientY;
2663
+ initialRight = parseInt(button.style.right);
2664
+ initialBottom = parseInt(button.style.bottom);
2665
+ dragStartTime = Date.now();
2666
+ button.style.cursor = "grabbing";
2667
+ button.style.transition = "none";
2668
+ e.preventDefault();
2669
+ });
2670
+ document.addEventListener("mousemove", (e) => {
2671
+ if (!isDragging)
2672
+ return;
2673
+ const deltaX = startX - e.clientX;
2674
+ const deltaY = startY - e.clientY;
2675
+ let newRight = initialRight + deltaX;
2676
+ let newBottom = initialBottom + deltaY;
2677
+ newRight = Math.min(Math.max(20, newRight), windowWidth - 80);
2678
+ newBottom = Math.min(Math.max(20, newBottom), windowHeight - 80);
2679
+ const snapThreshold = 20;
2680
+ const buttonLeft = windowWidth - newRight - 60;
2681
+ if (buttonLeft < snapThreshold) {
2682
+ newRight = windowWidth - 80;
2683
+ } else if (buttonLeft > windowWidth - snapThreshold - 60) {
2684
+ newRight = 20;
2685
+ }
2686
+ if (newBottom < snapThreshold) {
2687
+ newBottom = 20;
2688
+ } else if (newBottom > windowHeight - snapThreshold - 60) {
2689
+ newBottom = windowHeight - 80;
2690
+ }
2691
+ button.style.right = `${newRight}px`;
2692
+ button.style.bottom = `${newBottom}px`;
2693
+ updateIframePosition(iframe, newRight, newBottom, windowWidth, windowHeight);
2694
+ });
2695
+ document.addEventListener("mouseup", () => {
2696
+ if (!isDragging)
2697
+ return;
2698
+ const dragEndTime = Date.now();
2699
+ const isDragEvent = dragEndTime - dragStartTime > 200;
2700
+ isDragging = false;
2701
+ button.style.cursor = "grab";
2702
+ button.style.transition = "transform 0.15s ease";
2703
+ localStorage.setItem(
2704
+ "btc-wallet-button-position",
2705
+ JSON.stringify({
2706
+ right: button.style.right,
2707
+ bottom: button.style.bottom
2708
+ })
2709
+ );
2710
+ if (!isDragEvent) {
2711
+ handleButtonClick();
2712
+ }
2713
+ });
2714
+ const handleButtonClick = () => {
2647
2715
  const isCurrentlyVisible = iframe.style.display === "block";
2648
2716
  button.style.transform = "scale(0.8)";
2649
2717
  setTimeout(() => {
2650
2718
  button.style.transform = "scale(1)";
2651
2719
  }, 150);
2652
- iframe.style.display = isCurrentlyVisible ? "none" : "block";
2653
- button.src = isCurrentlyVisible ? openImageUrl : closeImageUrl;
2654
- localStorage.setItem("iframeVisible", String(!isCurrentlyVisible));
2720
+ const newVisibleState = !isCurrentlyVisible;
2721
+ iframe.style.display = newVisibleState ? "block" : "none";
2722
+ button.src = newVisibleState ? closeImageUrl : openImageUrl;
2723
+ localStorage.setItem("btc-wallet-iframe-visible", String(newVisibleState));
2655
2724
  setTimeout(() => {
2656
- iframe.focus();
2725
+ if (newVisibleState) {
2726
+ iframe.focus();
2727
+ }
2657
2728
  }, 0);
2658
2729
  };
2730
+ button.onclick = null;
2659
2731
  return button;
2660
2732
  }
2661
2733
  function createIframe({
@@ -2666,6 +2738,7 @@ function createIframe({
2666
2738
  iframe.id = "satoshi-wallet-iframe";
2667
2739
  iframe.allow = "clipboard-read; clipboard-write";
2668
2740
  iframe.src = iframeUrl;
2741
+ const isVisible = localStorage.getItem("btc-wallet-iframe-visible") === "true";
2669
2742
  Object.assign(iframe.style, __spreadValues({
2670
2743
  position: "fixed",
2671
2744
  bottom: "90px",
@@ -2673,7 +2746,7 @@ function createIframe({
2673
2746
  zIndex: "100000",
2674
2747
  boxShadow: "0 0 10px rgba(0, 0, 0, 0.1)",
2675
2748
  borderRadius: "10px",
2676
- display: "block",
2749
+ display: isVisible ? "block" : "none",
2677
2750
  border: "none"
2678
2751
  }, iframeStyle));
2679
2752
  document.body.appendChild(iframe);
@@ -2731,6 +2804,20 @@ function removeWalletButton() {
2731
2804
  const iframe = document.getElementById("satoshi-wallet-iframe");
2732
2805
  iframe == null ? void 0 : iframe.remove();
2733
2806
  }
2807
+ function updateIframePosition(iframe, buttonRight, buttonBottom, windowWidth, windowHeight) {
2808
+ const iframeWidth = parseInt(iframe.style.width);
2809
+ const iframeHeight = parseInt(iframe.style.height);
2810
+ let iframeRight = buttonRight;
2811
+ let iframeBottom = buttonBottom + 70;
2812
+ if (iframeRight + iframeWidth > windowWidth - 20) {
2813
+ iframeRight = Math.max(20, windowWidth - iframeWidth - 20);
2814
+ }
2815
+ if (iframeBottom + iframeHeight > windowHeight - 20) {
2816
+ iframeBottom = Math.max(20, buttonBottom - iframeHeight - 10);
2817
+ }
2818
+ iframe.style.right = `${iframeRight}px`;
2819
+ iframe.style.bottom = `${iframeBottom}px`;
2820
+ }
2734
2821
 
2735
2822
  // src/utils/nearUtils.ts
2736
2823
  import { providers } from "near-api-js";
@@ -3199,6 +3286,7 @@ import coinselect from "coinselect";
3199
3286
  var NEAR_STORAGE_DEPOSIT_AMOUNT = "1250000000000000000000";
3200
3287
  var NBTC_STORAGE_DEPOSIT_AMOUNT = "3000";
3201
3288
  var GAS_LIMIT = "50000000000000";
3289
+ var NEW_ACCOUNT_MIN_DEPOSIT_AMOUNT = "1000";
3202
3290
  function getBtcProvider() {
3203
3291
  if (typeof window === "undefined" || !window.btcContext) {
3204
3292
  throw new Error("BTC Provider is not initialized.");
@@ -3368,12 +3456,14 @@ function getDepositAmount(amount, option) {
3368
3456
  } = yield nearCall(config.bridgeContractId, "get_config", {});
3369
3457
  const depositAmount = Math.max(Number(min_deposit_amount), Number(amount));
3370
3458
  const protocolFee = Math.max(Number(fee_min), Number(depositAmount) * fee_rate);
3371
- const totalDepositAmount = new Big(depositAmount).plus(protocolFee).plus(repayAmount).round(0, Big.roundDown).toNumber();
3459
+ const newAccountMinDepositAmount = !(accountInfo == null ? void 0 : accountInfo.nonce) ? NEW_ACCOUNT_MIN_DEPOSIT_AMOUNT : 0;
3460
+ const totalDepositAmount = new Big(depositAmount).plus(protocolFee).plus(repayAmount).plus(newAccountMinDepositAmount).round(0, Big.roundDown).toNumber();
3372
3461
  return {
3373
3462
  depositAmount,
3374
3463
  totalDepositAmount,
3375
3464
  protocolFee,
3376
- repayAmount
3465
+ repayAmount,
3466
+ newAccountMinDepositAmount
3377
3467
  };
3378
3468
  });
3379
3469
  }
@@ -3500,6 +3590,14 @@ function checkSatoshiWhitelist(btcAccountId, env = "mainnet") {
3500
3590
  return __async(this, null, function* () {
3501
3591
  if (env !== "private_mainnet")
3502
3592
  return;
3593
+ const hasShownNotice = localStorage.getItem("btc-wallet-private-mainnet-notice");
3594
+ if (!hasShownNotice) {
3595
+ Dialog.alert({
3596
+ title: "Notice",
3597
+ message: "You are currently using Satoshi Private Mainnet. This is a private version for testing. Please try a small amount of assets in Ramp"
3598
+ });
3599
+ localStorage.setItem("btc-wallet-private-mainnet-notice", "true");
3600
+ }
3503
3601
  if (!btcAccountId)
3504
3602
  return;
3505
3603
  const config = yield getConfig(env);
@@ -3529,13 +3627,12 @@ function getWithdrawTransaction(_0) {
3529
3627
  const btcAddress = yield provider.account;
3530
3628
  const config = yield getConfig(env);
3531
3629
  const brgConfig = yield nearCall(config.bridgeContractId, "get_config", {});
3532
- const _amount = Number(new Big(amount).mul(__pow(10, 8)).toFixed(0));
3533
3630
  if (brgConfig.min_withdraw_amount) {
3534
- if (_amount < Number(brgConfig.min_withdraw_amount)) {
3631
+ if (Number(amount) < Number(brgConfig.min_withdraw_amount)) {
3535
3632
  throw new Error("Mini withdraw amount is " + brgConfig.min_withdraw_amount);
3536
3633
  }
3537
3634
  }
3538
- const feePercent = Number(brgConfig.withdraw_bridge_fee.fee_rate) * _amount;
3635
+ const feePercent = Number(brgConfig.withdraw_bridge_fee.fee_rate) * Number(amount);
3539
3636
  const withdrawFee = feePercent > Number(brgConfig.withdraw_bridge_fee.fee_min) ? feePercent : Number(brgConfig.withdraw_bridge_fee.fee_min);
3540
3637
  const allUTXO = yield nearCall(config.bridgeContractId, "get_utxos_paged", {});
3541
3638
  if (!allUTXO || Object.keys(allUTXO).length === 0) {
@@ -3553,7 +3650,7 @@ function getWithdrawTransaction(_0) {
3553
3650
  const _feeRate = feeRate || (yield getBtcGasPrice());
3554
3651
  const { inputs, outputs, fee } = coinselect(
3555
3652
  utxos,
3556
- [{ address: btcAddress, value: _amount }],
3653
+ [{ address: btcAddress, value: Number(amount) }],
3557
3654
  Math.ceil(_feeRate)
3558
3655
  );
3559
3656
  if (!outputs || !inputs) {
@@ -3568,7 +3665,7 @@ function getWithdrawTransaction(_0) {
3568
3665
  let userOutput, noUserOutput;
3569
3666
  for (let i = 0; i < outputs.length; i++) {
3570
3667
  const output = outputs[i];
3571
- if (output.value.toString() === _amount.toString()) {
3668
+ if (output.value.toString() === amount.toString()) {
3572
3669
  userOutput = output;
3573
3670
  } else {
3574
3671
  noUserOutput = output;
@@ -3647,7 +3744,7 @@ function getWithdrawTransaction(_0) {
3647
3744
  methodName: "ft_transfer_call",
3648
3745
  args: {
3649
3746
  receiver_id: config.bridgeContractId,
3650
- amount: _amount.toString(),
3747
+ amount: amount.toString(),
3651
3748
  msg: JSON.stringify(msg)
3652
3749
  },
3653
3750
  gas: "300000000000000",
@@ -3665,24 +3762,41 @@ function uint8ArrayToHex(uint8Array) {
3665
3762
 
3666
3763
  // src/core/setupBTCWallet.ts
3667
3764
  var { transfer, functionCall } = actionCreators;
3765
+ var STORAGE_KEYS = {
3766
+ ACCOUNT: "btc-wallet-account",
3767
+ PUBLIC_KEY: "btc-wallet-publickey",
3768
+ BTC_PUBLIC_KEY: "btc-wallet-btc-publickey"
3769
+ };
3668
3770
  var state = {
3669
3771
  saveAccount(account) {
3670
- window.localStorage.setItem("btc-wallet-account", account);
3772
+ if (!account) {
3773
+ this.removeAccount();
3774
+ return;
3775
+ }
3776
+ window.localStorage.setItem(STORAGE_KEYS.ACCOUNT, account);
3671
3777
  },
3672
3778
  removeAccount() {
3673
- window.localStorage.removeItem("btc-wallet-account");
3779
+ window.localStorage.removeItem(STORAGE_KEYS.ACCOUNT);
3674
3780
  },
3675
3781
  savePublicKey(publicKey) {
3676
- window.localStorage.setItem("btc-wallet-publickey", publicKey);
3782
+ if (!publicKey) {
3783
+ this.removePublicKey();
3784
+ return;
3785
+ }
3786
+ window.localStorage.setItem(STORAGE_KEYS.PUBLIC_KEY, publicKey);
3677
3787
  },
3678
3788
  removePublicKey() {
3679
- window.localStorage.removeItem("btc-wallet-publickey");
3789
+ window.localStorage.removeItem(STORAGE_KEYS.PUBLIC_KEY);
3680
3790
  },
3681
3791
  saveBtcPublicKey(publicKey) {
3682
- window.localStorage.setItem("btc-wallet-btc-publickey", publicKey);
3792
+ if (!publicKey) {
3793
+ this.removeBtcPublicKey();
3794
+ return;
3795
+ }
3796
+ window.localStorage.setItem(STORAGE_KEYS.BTC_PUBLIC_KEY, publicKey);
3683
3797
  },
3684
3798
  removeBtcPublicKey() {
3685
- window.localStorage.removeItem("btc-wallet-btc-publickey");
3799
+ window.localStorage.removeItem(STORAGE_KEYS.BTC_PUBLIC_KEY);
3686
3800
  },
3687
3801
  clear() {
3688
3802
  this.removeAccount();
@@ -3690,17 +3804,39 @@ var state = {
3690
3804
  this.removeBtcPublicKey();
3691
3805
  },
3692
3806
  save(account, publicKey) {
3807
+ if (!account || !publicKey) {
3808
+ this.clear();
3809
+ return;
3810
+ }
3693
3811
  this.saveAccount(account);
3694
3812
  this.savePublicKey(publicKey);
3695
3813
  },
3696
3814
  getAccount() {
3697
- return window.localStorage.getItem("btc-wallet-account");
3815
+ return window.localStorage.getItem(STORAGE_KEYS.ACCOUNT);
3698
3816
  },
3699
3817
  getPublicKey() {
3700
- return window.localStorage.getItem("btc-wallet-publickey");
3818
+ return window.localStorage.getItem(STORAGE_KEYS.PUBLIC_KEY);
3701
3819
  },
3702
3820
  getBtcPublicKey() {
3703
- return window.localStorage.getItem("btc-wallet-btc-publickey");
3821
+ return window.localStorage.getItem(STORAGE_KEYS.BTC_PUBLIC_KEY);
3822
+ },
3823
+ isValid() {
3824
+ const account = this.getAccount();
3825
+ const publicKey = this.getPublicKey();
3826
+ const btcPublicKey = this.getBtcPublicKey();
3827
+ const allEmpty = !account && !publicKey && !btcPublicKey;
3828
+ const allExist = account && publicKey && btcPublicKey;
3829
+ return allEmpty || allExist;
3830
+ },
3831
+ syncSave(account, publicKey, btcPublicKey) {
3832
+ if (!account || !publicKey || !btcPublicKey) {
3833
+ this.clear();
3834
+ return;
3835
+ }
3836
+ this.clear();
3837
+ this.savePublicKey(publicKey);
3838
+ this.saveBtcPublicKey(btcPublicKey);
3839
+ this.saveAccount(account);
3704
3840
  }
3705
3841
  };
3706
3842
  var BTCWallet = (_0) => __async(void 0, [_0], function* ({
@@ -3727,16 +3863,33 @@ var BTCWallet = (_0) => __async(void 0, [_0], function* ({
3727
3863
  const currentConfig = walletConfig[env];
3728
3864
  const walletNetwork = ["mainnet", "private_mainnet"].includes(env) ? "mainnet" : "testnet";
3729
3865
  yield initBtcContext();
3866
+ function validateWalletState() {
3867
+ const accountId = state.getAccount();
3868
+ const publicKey = state.getPublicKey();
3869
+ const btcPublicKey = state.getBtcPublicKey();
3870
+ if (!accountId && publicKey || accountId && !publicKey || !publicKey && btcPublicKey) {
3871
+ state.clear();
3872
+ return false;
3873
+ }
3874
+ return true;
3875
+ }
3730
3876
  function setupBtcContextListeners() {
3731
3877
  return __async(this, null, function* () {
3732
3878
  const handleConnectionUpdate = () => __async(this, null, function* () {
3733
3879
  yield checkBtcNetwork(walletNetwork);
3734
- const accountId = state.getAccount();
3880
+ if (!state.isValid()) {
3881
+ state.clear();
3882
+ }
3883
+ validateWalletState();
3735
3884
  const btcContext = window.btcContext;
3736
- if (accountId && btcContext.account) {
3737
- yield checkSatoshiWhitelist(btcContext.account, env);
3738
- removeWalletButton();
3739
- setupWalletButton(env, wallet, btcContext);
3885
+ if (btcContext.account) {
3886
+ const btcPublicKey = yield btcContext.getPublicKey();
3887
+ if (btcPublicKey) {
3888
+ const { nearAddress, nearPublicKey } = yield getNearAccountByBtcPublicKey(btcPublicKey);
3889
+ yield checkSatoshiWhitelist(btcContext.account, env);
3890
+ removeWalletButton();
3891
+ setupWalletButton(env, wallet, btcContext);
3892
+ }
3740
3893
  } else {
3741
3894
  removeWalletButton();
3742
3895
  setTimeout(() => {
@@ -3747,19 +3900,31 @@ var BTCWallet = (_0) => __async(void 0, [_0], function* ({
3747
3900
  const context = window.btcContext.getContext();
3748
3901
  context.on("updatePublicKey", (btcPublicKey) => __async(this, null, function* () {
3749
3902
  console.log("updatePublicKey");
3750
- const { nearAddress } = yield getNearAccountByBtcPublicKey(btcPublicKey);
3751
- emitter.emit("accountsChanged", {
3752
- accounts: [{ accountId: nearAddress }]
3753
- });
3754
- yield handleConnectionUpdate();
3903
+ state.clear();
3904
+ try {
3905
+ const { nearAddress, nearPublicKey } = yield getNearAccountByBtcPublicKey(btcPublicKey);
3906
+ if (!nearAddress || !nearPublicKey) {
3907
+ throw new Error("Failed to get near account info");
3908
+ }
3909
+ emitter.emit("accountsChanged", {
3910
+ accounts: [{ accountId: nearAddress }]
3911
+ });
3912
+ yield handleConnectionUpdate();
3913
+ } catch (error) {
3914
+ console.error("Error updating public key:", error);
3915
+ state.clear();
3916
+ emitter.emit("accountsChanged", { accounts: [] });
3917
+ }
3755
3918
  }));
3756
3919
  context.on("btcLoginError", () => __async(this, null, function* () {
3757
3920
  console.log("btcLoginError");
3921
+ state.clear();
3758
3922
  emitter.emit("accountsChanged", { accounts: [] });
3759
3923
  yield handleConnectionUpdate();
3760
3924
  }));
3761
3925
  context.on("btcLogOut", () => __async(this, null, function* () {
3762
3926
  console.log("btcLogOut");
3927
+ state.clear();
3763
3928
  emitter.emit("accountsChanged", { accounts: [] });
3764
3929
  yield handleConnectionUpdate();
3765
3930
  }));
@@ -3803,9 +3968,7 @@ var BTCWallet = (_0) => __async(void 0, [_0], function* ({
3803
3968
  "get_chain_signature_near_account_public_key",
3804
3969
  { btc_public_key: btcPublicKey }
3805
3970
  );
3806
- state.saveAccount(csna);
3807
- state.savePublicKey(nearPublicKey);
3808
- state.saveBtcPublicKey(btcPublicKey);
3971
+ state.syncSave(csna, nearPublicKey, btcPublicKey);
3809
3972
  return {
3810
3973
  nearAddress: csna,
3811
3974
  nearPublicKey
@@ -3815,10 +3978,8 @@ var BTCWallet = (_0) => __async(void 0, [_0], function* ({
3815
3978
  function signIn(_02) {
3816
3979
  return __async(this, arguments, function* ({ contractId, methodNames }) {
3817
3980
  const btcContext = window.btcContext;
3818
- const accountId = state.getAccount();
3819
- const publicKey = state.getPublicKey();
3820
- console.log("isLogin:", accountId && publicKey);
3821
- if (!accountId || !publicKey) {
3981
+ state.clear();
3982
+ if (!state.getAccount() || !state.getPublicKey()) {
3822
3983
  yield btcContext.login();
3823
3984
  }
3824
3985
  const btcPublicKey = yield btcContext.getPublicKey();
@@ -3884,6 +4045,9 @@ var BTCWallet = (_0) => __async(void 0, [_0], function* ({
3884
4045
  }
3885
4046
  function signAndSendTransactions(params) {
3886
4047
  return __async(this, null, function* () {
4048
+ if (!validateWalletState()) {
4049
+ throw new Error("Wallet state is invalid, please reconnect your wallet.");
4050
+ }
3887
4051
  const btcContext = window.btcContext;
3888
4052
  const accountId = state.getAccount();
3889
4053
  const accountInfo = yield getAccountInfo(accountId, currentConfig.accountContractId);
@@ -4090,18 +4254,6 @@ function setupBTCWallet({
4090
4254
  env = "mainnet"
4091
4255
  } = {}) {
4092
4256
  console.log("\u26A1\uFE0F BTC Wallet Version:", getVersion(), "env:", env);
4093
- if (env === "private_mainnet" && typeof window !== "undefined") {
4094
- setTimeout(() => {
4095
- const hasShownNotice = localStorage.getItem("satoshi_private_mainnet_notice");
4096
- if (!hasShownNotice) {
4097
- Dialog.alert({
4098
- title: "Notice",
4099
- message: "You are currently using Satoshi Private Mainnet. This is a private version for testing. Please try a small amount of assets in Ramp"
4100
- });
4101
- localStorage.setItem("satoshi_private_mainnet_notice", "true");
4102
- }
4103
- }, 1e3);
4104
- }
4105
4257
  const btcWallet = () => __async(this, null, function* () {
4106
4258
  return {
4107
4259
  id: "btc-wallet",
@@ -4125,7 +4277,7 @@ function setupBTCWallet({
4125
4277
 
4126
4278
  // src/index.ts
4127
4279
  var getVersion = () => {
4128
- return "0.4.5-beta";
4280
+ return "0.4.7-beta";
4129
4281
  };
4130
4282
  if (typeof window !== "undefined") {
4131
4283
  window.__BTC_WALLET_VERSION = getVersion();