@myx-trade/sdk 0.1.264 → 0.1.267-beta.0

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
@@ -1773,7 +1773,7 @@ var RotationProvider = class extends import_providers.BaseProvider {
1773
1773
  // package.json
1774
1774
  var package_default = {
1775
1775
  name: "@myx-trade/sdk",
1776
- version: "0.1.264",
1776
+ version: "0.1.267-beta.0",
1777
1777
  private: false,
1778
1778
  publishConfig: {
1779
1779
  access: "public"
@@ -14923,7 +14923,26 @@ var ConfigManager = class {
14923
14923
  accessToken: "",
14924
14924
  expireAt: 0
14925
14925
  };
14926
- return response.accessToken;
14926
+ if (response && response.accessToken) {
14927
+ let expiryInSeconds = 3600;
14928
+ if (response.expireAt) {
14929
+ const currentTime = Math.floor(Date.now() / 1e3);
14930
+ expiryInSeconds = response.expireAt - currentTime;
14931
+ if (expiryInSeconds <= 0) {
14932
+ console.warn("Received expired token, using default expiry");
14933
+ expiryInSeconds = 3600;
14934
+ }
14935
+ }
14936
+ this.setAccessToken(response.accessToken, expiryInSeconds);
14937
+ console.log("\u2705 AccessToken fetched and stored successfully", {
14938
+ expiryInSeconds,
14939
+ expireAt: response.expireAt
14940
+ });
14941
+ return response.accessToken;
14942
+ } else {
14943
+ console.warn("\u274C Received empty accessToken");
14944
+ return null;
14945
+ }
14927
14946
  } catch (error) {
14928
14947
  console.error("\u274C Failed to fetch accessToken:", error);
14929
14948
  return null;
@@ -23038,13 +23057,14 @@ var Seamless = class {
23038
23057
  const config = this.configManager.getConfig();
23039
23058
  const masterAddress = await config.signer?.getAddress() ?? "";
23040
23059
  const provider = await getSignerProvider(chainId);
23060
+ const jsonProvider = getJSONProvider(chainId);
23041
23061
  if (approve2) {
23042
23062
  const balanceRes = await this.account.getWalletQuoteTokenBalance(chainId, masterAddress);
23043
23063
  const balance = balanceRes.data;
23044
23064
  const marketManagerContract = new import_ethers27.ethers.Contract(
23045
23065
  getContractAddressByChainId(chainId).MARKET_MANAGER,
23046
23066
  MarketManager_default,
23047
- provider
23067
+ jsonProvider
23048
23068
  );
23049
23069
  const forwardFeeToken = executeAddressByChainId(chainId);
23050
23070
  this.logger.info("forwardFeeToken-->", forwardFeeToken, chainId);
@@ -23068,7 +23088,6 @@ var Seamless = class {
23068
23088
  }
23069
23089
  }
23070
23090
  const forwarderContract = await getForwarderContract(chainId, 1 /* Signer */);
23071
- const jsonProvider = getJSONProvider(chainId);
23072
23091
  const getNonceForwarderContract = new import_ethers27.ethers.Contract(
23073
23092
  getContractAddressByChainId(chainId).FORWARDER,
23074
23093
  Forwarder_default,
package/dist/index.mjs CHANGED
@@ -1687,7 +1687,7 @@ var RotationProvider = class extends BaseProvider {
1687
1687
  // package.json
1688
1688
  var package_default = {
1689
1689
  name: "@myx-trade/sdk",
1690
- version: "0.1.264",
1690
+ version: "0.1.267-beta.0",
1691
1691
  private: false,
1692
1692
  publishConfig: {
1693
1693
  access: "public"
@@ -14837,7 +14837,26 @@ var ConfigManager = class {
14837
14837
  accessToken: "",
14838
14838
  expireAt: 0
14839
14839
  };
14840
- return response.accessToken;
14840
+ if (response && response.accessToken) {
14841
+ let expiryInSeconds = 3600;
14842
+ if (response.expireAt) {
14843
+ const currentTime = Math.floor(Date.now() / 1e3);
14844
+ expiryInSeconds = response.expireAt - currentTime;
14845
+ if (expiryInSeconds <= 0) {
14846
+ console.warn("Received expired token, using default expiry");
14847
+ expiryInSeconds = 3600;
14848
+ }
14849
+ }
14850
+ this.setAccessToken(response.accessToken, expiryInSeconds);
14851
+ console.log("\u2705 AccessToken fetched and stored successfully", {
14852
+ expiryInSeconds,
14853
+ expireAt: response.expireAt
14854
+ });
14855
+ return response.accessToken;
14856
+ } else {
14857
+ console.warn("\u274C Received empty accessToken");
14858
+ return null;
14859
+ }
14841
14860
  } catch (error) {
14842
14861
  console.error("\u274C Failed to fetch accessToken:", error);
14843
14862
  return null;
@@ -22952,13 +22971,14 @@ var Seamless = class {
22952
22971
  const config = this.configManager.getConfig();
22953
22972
  const masterAddress = await config.signer?.getAddress() ?? "";
22954
22973
  const provider = await getSignerProvider(chainId);
22974
+ const jsonProvider = getJSONProvider(chainId);
22955
22975
  if (approve2) {
22956
22976
  const balanceRes = await this.account.getWalletQuoteTokenBalance(chainId, masterAddress);
22957
22977
  const balance = balanceRes.data;
22958
22978
  const marketManagerContract = new ethers9.Contract(
22959
22979
  getContractAddressByChainId(chainId).MARKET_MANAGER,
22960
22980
  MarketManager_default,
22961
- provider
22981
+ jsonProvider
22962
22982
  );
22963
22983
  const forwardFeeToken = executeAddressByChainId(chainId);
22964
22984
  this.logger.info("forwardFeeToken-->", forwardFeeToken, chainId);
@@ -22982,7 +23002,6 @@ var Seamless = class {
22982
23002
  }
22983
23003
  }
22984
23004
  const forwarderContract = await getForwarderContract(chainId, 1 /* Signer */);
22985
- const jsonProvider = getJSONProvider(chainId);
22986
23005
  const getNonceForwarderContract = new ethers9.Contract(
22987
23006
  getContractAddressByChainId(chainId).FORWARDER,
22988
23007
  Forwarder_default,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myx-trade/sdk",
3
- "version": "0.1.264",
3
+ "version": "0.1.267-beta.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"