@myx-trade/sdk 0.1.123 → 0.1.124

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
@@ -1822,7 +1822,7 @@ var RotationProvider = class extends import_providers.BaseProvider {
1822
1822
  // package.json
1823
1823
  var package_default = {
1824
1824
  name: "@myx-trade/sdk",
1825
- version: "0.1.123",
1825
+ version: "0.1.124",
1826
1826
  private: false,
1827
1827
  publishConfig: {
1828
1828
  access: "public"
@@ -19999,10 +19999,11 @@ var Utils = class {
19999
19999
  }
20000
20000
  const owner = await config.signer.getAddress();
20001
20001
  const spender = spenderAddress ?? getContractAddressByChainId(chainId).Account;
20002
+ const provider = await getJSONProvider(chainId);
20002
20003
  const tokenContract = new import_ethers25.ethers.Contract(
20003
20004
  quoteAddress,
20004
20005
  erc20Abi,
20005
- config.signer
20006
+ provider
20006
20007
  );
20007
20008
  const allowance = await tokenContract.allowance(owner, spender);
20008
20009
  return {
@@ -21107,6 +21108,18 @@ var Account = class {
21107
21108
  const seamlessWallet = this.configManager.getConfig().seamlessAccount?.wallet;
21108
21109
  if (config.seamlessMode && authorized && seamlessWallet) {
21109
21110
  const isEnoughGas = await this.utils.checkSeamlessGas(account);
21111
+ if (needApproval) {
21112
+ const approvalResult = await this.utils.approveAuthorization({
21113
+ chainId,
21114
+ quoteAddress: tokenAddress,
21115
+ amount: import_ethers26.ethers.MaxUint256.toString(),
21116
+ spenderAddress: contractAddress.Account,
21117
+ signer: seamlessWallet
21118
+ });
21119
+ if (approvalResult.code !== 0) {
21120
+ throw new Error(approvalResult.message);
21121
+ }
21122
+ }
21110
21123
  if (!isEnoughGas) {
21111
21124
  throw new MyxSDKError("INSUFFICIENT_BALANCE" /* InsufficientBalance */, "Insufficient relay fee");
21112
21125
  }
package/dist/index.mjs CHANGED
@@ -1732,7 +1732,7 @@ var RotationProvider = class extends BaseProvider {
1732
1732
  // package.json
1733
1733
  var package_default = {
1734
1734
  name: "@myx-trade/sdk",
1735
- version: "0.1.123",
1735
+ version: "0.1.124",
1736
1736
  private: false,
1737
1737
  publishConfig: {
1738
1738
  access: "public"
@@ -19909,10 +19909,11 @@ var Utils = class {
19909
19909
  }
19910
19910
  const owner = await config.signer.getAddress();
19911
19911
  const spender = spenderAddress ?? getContractAddressByChainId(chainId).Account;
19912
+ const provider = await getJSONProvider(chainId);
19912
19913
  const tokenContract = new ethers7.Contract(
19913
19914
  quoteAddress,
19914
19915
  erc20Abi,
19915
- config.signer
19916
+ provider
19916
19917
  );
19917
19918
  const allowance = await tokenContract.allowance(owner, spender);
19918
19919
  return {
@@ -21017,6 +21018,18 @@ var Account = class {
21017
21018
  const seamlessWallet = this.configManager.getConfig().seamlessAccount?.wallet;
21018
21019
  if (config.seamlessMode && authorized && seamlessWallet) {
21019
21020
  const isEnoughGas = await this.utils.checkSeamlessGas(account);
21021
+ if (needApproval) {
21022
+ const approvalResult = await this.utils.approveAuthorization({
21023
+ chainId,
21024
+ quoteAddress: tokenAddress,
21025
+ amount: ethers8.MaxUint256.toString(),
21026
+ spenderAddress: contractAddress.Account,
21027
+ signer: seamlessWallet
21028
+ });
21029
+ if (approvalResult.code !== 0) {
21030
+ throw new Error(approvalResult.message);
21031
+ }
21032
+ }
21020
21033
  if (!isEnoughGas) {
21021
21034
  throw new MyxSDKError("INSUFFICIENT_BALANCE" /* InsufficientBalance */, "Insufficient relay fee");
21022
21035
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myx-trade/sdk",
3
- "version": "0.1.123",
3
+ "version": "0.1.124",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"