@myx-trade/sdk 0.1.22 → 0.1.24
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.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +23 -6
- package/dist/index.mjs +23 -6
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1533,9 +1533,10 @@ declare class Account {
|
|
|
1533
1533
|
message: string;
|
|
1534
1534
|
data?: undefined;
|
|
1535
1535
|
}>;
|
|
1536
|
-
deposit({ poolId, amount }: {
|
|
1536
|
+
deposit({ poolId, amount, tokenAddress }: {
|
|
1537
1537
|
poolId: string;
|
|
1538
1538
|
amount: string;
|
|
1539
|
+
tokenAddress: string;
|
|
1539
1540
|
}): Promise<{
|
|
1540
1541
|
code: number;
|
|
1541
1542
|
data: any;
|
package/dist/index.d.ts
CHANGED
|
@@ -1533,9 +1533,10 @@ declare class Account {
|
|
|
1533
1533
|
message: string;
|
|
1534
1534
|
data?: undefined;
|
|
1535
1535
|
}>;
|
|
1536
|
-
deposit({ poolId, amount }: {
|
|
1536
|
+
deposit({ poolId, amount, tokenAddress }: {
|
|
1537
1537
|
poolId: string;
|
|
1538
1538
|
amount: string;
|
|
1539
|
+
tokenAddress: string;
|
|
1539
1540
|
}): Promise<{
|
|
1540
1541
|
code: number;
|
|
1541
1542
|
data: any;
|
package/dist/index.js
CHANGED
|
@@ -1827,7 +1827,7 @@ var RotationProvider = class extends import_providers.BaseProvider {
|
|
|
1827
1827
|
// package.json
|
|
1828
1828
|
var package_default = {
|
|
1829
1829
|
name: "@myx-trade/sdk",
|
|
1830
|
-
version: "0.1.
|
|
1830
|
+
version: "0.1.24",
|
|
1831
1831
|
private: false,
|
|
1832
1832
|
publishConfig: {
|
|
1833
1833
|
access: "public"
|
|
@@ -18169,8 +18169,9 @@ var Account = class {
|
|
|
18169
18169
|
config.signer
|
|
18170
18170
|
);
|
|
18171
18171
|
try {
|
|
18172
|
-
|
|
18173
|
-
|
|
18172
|
+
const account = await config.signer?.getAddress() ?? "";
|
|
18173
|
+
console.log("withdraw", account, amount, poolId);
|
|
18174
|
+
const rs = await accountContract.withdraw(poolId, account, amount);
|
|
18174
18175
|
const receipt = await rs?.wait(1);
|
|
18175
18176
|
return {
|
|
18176
18177
|
code: 0,
|
|
@@ -18183,7 +18184,7 @@ var Account = class {
|
|
|
18183
18184
|
};
|
|
18184
18185
|
}
|
|
18185
18186
|
}
|
|
18186
|
-
async deposit({ poolId, amount }) {
|
|
18187
|
+
async deposit({ poolId, amount, tokenAddress }) {
|
|
18187
18188
|
const config = this.configManager.getConfig();
|
|
18188
18189
|
const contractAddress = getContractAddressByChainId(config.chainId);
|
|
18189
18190
|
const accountContract = new import_ethers27.ethers.Contract(
|
|
@@ -18192,8 +18193,24 @@ var Account = class {
|
|
|
18192
18193
|
config.signer
|
|
18193
18194
|
);
|
|
18194
18195
|
try {
|
|
18195
|
-
|
|
18196
|
-
|
|
18196
|
+
const needApproval = await this.utils.needsApproval(
|
|
18197
|
+
tokenAddress,
|
|
18198
|
+
amount,
|
|
18199
|
+
contractAddress.Account
|
|
18200
|
+
);
|
|
18201
|
+
if (needApproval) {
|
|
18202
|
+
const approvalResult = await this.utils.approveAuthorization({
|
|
18203
|
+
quoteAddress: tokenAddress,
|
|
18204
|
+
amount,
|
|
18205
|
+
spenderAddress: contractAddress.Account
|
|
18206
|
+
});
|
|
18207
|
+
if (approvalResult.code !== 0) {
|
|
18208
|
+
throw new Error(approvalResult.message);
|
|
18209
|
+
}
|
|
18210
|
+
}
|
|
18211
|
+
const account = await config.signer?.getAddress() ?? "";
|
|
18212
|
+
console.log("deposit", account, poolId, amount);
|
|
18213
|
+
const rs = await accountContract.deposit(account, poolId, amount);
|
|
18197
18214
|
const receipt = await rs?.wait(1);
|
|
18198
18215
|
return {
|
|
18199
18216
|
code: 0,
|
package/dist/index.mjs
CHANGED
|
@@ -1742,7 +1742,7 @@ var RotationProvider = class extends BaseProvider {
|
|
|
1742
1742
|
// package.json
|
|
1743
1743
|
var package_default = {
|
|
1744
1744
|
name: "@myx-trade/sdk",
|
|
1745
|
-
version: "0.1.
|
|
1745
|
+
version: "0.1.24",
|
|
1746
1746
|
private: false,
|
|
1747
1747
|
publishConfig: {
|
|
1748
1748
|
access: "public"
|
|
@@ -18084,8 +18084,9 @@ var Account = class {
|
|
|
18084
18084
|
config.signer
|
|
18085
18085
|
);
|
|
18086
18086
|
try {
|
|
18087
|
-
|
|
18088
|
-
|
|
18087
|
+
const account = await config.signer?.getAddress() ?? "";
|
|
18088
|
+
console.log("withdraw", account, amount, poolId);
|
|
18089
|
+
const rs = await accountContract.withdraw(poolId, account, amount);
|
|
18089
18090
|
const receipt = await rs?.wait(1);
|
|
18090
18091
|
return {
|
|
18091
18092
|
code: 0,
|
|
@@ -18098,7 +18099,7 @@ var Account = class {
|
|
|
18098
18099
|
};
|
|
18099
18100
|
}
|
|
18100
18101
|
}
|
|
18101
|
-
async deposit({ poolId, amount }) {
|
|
18102
|
+
async deposit({ poolId, amount, tokenAddress }) {
|
|
18102
18103
|
const config = this.configManager.getConfig();
|
|
18103
18104
|
const contractAddress = getContractAddressByChainId(config.chainId);
|
|
18104
18105
|
const accountContract = new ethers8.Contract(
|
|
@@ -18107,8 +18108,24 @@ var Account = class {
|
|
|
18107
18108
|
config.signer
|
|
18108
18109
|
);
|
|
18109
18110
|
try {
|
|
18110
|
-
|
|
18111
|
-
|
|
18111
|
+
const needApproval = await this.utils.needsApproval(
|
|
18112
|
+
tokenAddress,
|
|
18113
|
+
amount,
|
|
18114
|
+
contractAddress.Account
|
|
18115
|
+
);
|
|
18116
|
+
if (needApproval) {
|
|
18117
|
+
const approvalResult = await this.utils.approveAuthorization({
|
|
18118
|
+
quoteAddress: tokenAddress,
|
|
18119
|
+
amount,
|
|
18120
|
+
spenderAddress: contractAddress.Account
|
|
18121
|
+
});
|
|
18122
|
+
if (approvalResult.code !== 0) {
|
|
18123
|
+
throw new Error(approvalResult.message);
|
|
18124
|
+
}
|
|
18125
|
+
}
|
|
18126
|
+
const account = await config.signer?.getAddress() ?? "";
|
|
18127
|
+
console.log("deposit", account, poolId, amount);
|
|
18128
|
+
const rs = await accountContract.deposit(account, poolId, amount);
|
|
18112
18129
|
const receipt = await rs?.wait(1);
|
|
18113
18130
|
return {
|
|
18114
18131
|
code: 0,
|