@myx-trade/sdk 0.1.122 → 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 +17 -8
- package/dist/index.mjs +17 -8
- package/package.json +1 -1
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.
|
|
1825
|
+
version: "0.1.124",
|
|
1826
1826
|
private: false,
|
|
1827
1827
|
publishConfig: {
|
|
1828
1828
|
access: "public"
|
|
@@ -14142,17 +14142,13 @@ var Position = class {
|
|
|
14142
14142
|
depositData,
|
|
14143
14143
|
positionId,
|
|
14144
14144
|
adjustAmount
|
|
14145
|
-
// {
|
|
14146
|
-
// value: BigInt(priceData?.value ?? "1"),
|
|
14147
|
-
// gas: 10000000n,
|
|
14148
|
-
// }
|
|
14149
14145
|
]);
|
|
14150
14146
|
const nonce = await forwarderContract.nonces(seamlessWallet.address);
|
|
14151
14147
|
const forwardTxParams = {
|
|
14152
14148
|
from: seamlessWallet.address ?? "",
|
|
14153
14149
|
to: this.configManager.getConfig().brokerAddress,
|
|
14154
|
-
value: "
|
|
14155
|
-
gas: "
|
|
14150
|
+
value: (priceData?.value ?? "1").toString(),
|
|
14151
|
+
gas: "10000000",
|
|
14156
14152
|
deadline: (0, import_dayjs.default)().add(60, "minute").unix(),
|
|
14157
14153
|
data: functionHash,
|
|
14158
14154
|
nonce: nonce.toString()
|
|
@@ -20003,10 +19999,11 @@ var Utils = class {
|
|
|
20003
19999
|
}
|
|
20004
20000
|
const owner = await config.signer.getAddress();
|
|
20005
20001
|
const spender = spenderAddress ?? getContractAddressByChainId(chainId).Account;
|
|
20002
|
+
const provider = await getJSONProvider(chainId);
|
|
20006
20003
|
const tokenContract = new import_ethers25.ethers.Contract(
|
|
20007
20004
|
quoteAddress,
|
|
20008
20005
|
erc20Abi,
|
|
20009
|
-
|
|
20006
|
+
provider
|
|
20010
20007
|
);
|
|
20011
20008
|
const allowance = await tokenContract.allowance(owner, spender);
|
|
20012
20009
|
return {
|
|
@@ -21111,6 +21108,18 @@ var Account = class {
|
|
|
21111
21108
|
const seamlessWallet = this.configManager.getConfig().seamlessAccount?.wallet;
|
|
21112
21109
|
if (config.seamlessMode && authorized && seamlessWallet) {
|
|
21113
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
|
+
}
|
|
21114
21123
|
if (!isEnoughGas) {
|
|
21115
21124
|
throw new MyxSDKError("INSUFFICIENT_BALANCE" /* InsufficientBalance */, "Insufficient relay fee");
|
|
21116
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.
|
|
1735
|
+
version: "0.1.124",
|
|
1736
1736
|
private: false,
|
|
1737
1737
|
publishConfig: {
|
|
1738
1738
|
access: "public"
|
|
@@ -14052,17 +14052,13 @@ var Position = class {
|
|
|
14052
14052
|
depositData,
|
|
14053
14053
|
positionId,
|
|
14054
14054
|
adjustAmount
|
|
14055
|
-
// {
|
|
14056
|
-
// value: BigInt(priceData?.value ?? "1"),
|
|
14057
|
-
// gas: 10000000n,
|
|
14058
|
-
// }
|
|
14059
14055
|
]);
|
|
14060
14056
|
const nonce = await forwarderContract.nonces(seamlessWallet.address);
|
|
14061
14057
|
const forwardTxParams = {
|
|
14062
14058
|
from: seamlessWallet.address ?? "",
|
|
14063
14059
|
to: this.configManager.getConfig().brokerAddress,
|
|
14064
|
-
value: "
|
|
14065
|
-
gas: "
|
|
14060
|
+
value: (priceData?.value ?? "1").toString(),
|
|
14061
|
+
gas: "10000000",
|
|
14066
14062
|
deadline: dayjs().add(60, "minute").unix(),
|
|
14067
14063
|
data: functionHash,
|
|
14068
14064
|
nonce: nonce.toString()
|
|
@@ -19913,10 +19909,11 @@ var Utils = class {
|
|
|
19913
19909
|
}
|
|
19914
19910
|
const owner = await config.signer.getAddress();
|
|
19915
19911
|
const spender = spenderAddress ?? getContractAddressByChainId(chainId).Account;
|
|
19912
|
+
const provider = await getJSONProvider(chainId);
|
|
19916
19913
|
const tokenContract = new ethers7.Contract(
|
|
19917
19914
|
quoteAddress,
|
|
19918
19915
|
erc20Abi,
|
|
19919
|
-
|
|
19916
|
+
provider
|
|
19920
19917
|
);
|
|
19921
19918
|
const allowance = await tokenContract.allowance(owner, spender);
|
|
19922
19919
|
return {
|
|
@@ -21021,6 +21018,18 @@ var Account = class {
|
|
|
21021
21018
|
const seamlessWallet = this.configManager.getConfig().seamlessAccount?.wallet;
|
|
21022
21019
|
if (config.seamlessMode && authorized && seamlessWallet) {
|
|
21023
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
|
+
}
|
|
21024
21033
|
if (!isEnoughGas) {
|
|
21025
21034
|
throw new MyxSDKError("INSUFFICIENT_BALANCE" /* InsufficientBalance */, "Insufficient relay fee");
|
|
21026
21035
|
}
|