@myx-trade/sdk 0.1.249 → 0.1.250
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 +37 -9
- package/dist/index.mjs +37 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1851,7 +1851,7 @@ var RotationProvider = class extends import_providers.BaseProvider {
|
|
|
1851
1851
|
// package.json
|
|
1852
1852
|
var package_default = {
|
|
1853
1853
|
name: "@myx-trade/sdk",
|
|
1854
|
-
version: "0.1.
|
|
1854
|
+
version: "0.1.250",
|
|
1855
1855
|
private: false,
|
|
1856
1856
|
publishConfig: {
|
|
1857
1857
|
access: "public"
|
|
@@ -12776,7 +12776,6 @@ var ConfigManager = class {
|
|
|
12776
12776
|
};
|
|
12777
12777
|
}
|
|
12778
12778
|
async startSeamlessMode(open) {
|
|
12779
|
-
console.log("startSeamlessMode-->", open);
|
|
12780
12779
|
this.config = {
|
|
12781
12780
|
...this.config,
|
|
12782
12781
|
seamlessMode: open
|
|
@@ -20885,14 +20884,20 @@ var Seamless = class {
|
|
|
20885
20884
|
}
|
|
20886
20885
|
}
|
|
20887
20886
|
const forwarderContract = await getForwarderContract(chainId, 1 /* Signer */);
|
|
20888
|
-
const
|
|
20887
|
+
const jsonProvider = getJSONProvider(chainId);
|
|
20888
|
+
const getNonceForwarderContract = new import_ethers27.ethers.Contract(
|
|
20889
|
+
getContractAddressByChainId(chainId).FORWARDER,
|
|
20890
|
+
Forwarder_default,
|
|
20891
|
+
jsonProvider
|
|
20892
|
+
);
|
|
20893
|
+
const nonce = await getNonceForwarderContract.nonces(masterAddress);
|
|
20889
20894
|
const functionHash = forwarderContract.interface.encodeFunctionData("permitAndApproveForwarder", [
|
|
20890
20895
|
seamlessAddress,
|
|
20891
20896
|
approve2,
|
|
20892
20897
|
permitParams
|
|
20893
20898
|
]);
|
|
20894
20899
|
const txRs = await this.forwarderTx({
|
|
20895
|
-
from: masterAddress
|
|
20900
|
+
from: masterAddress,
|
|
20896
20901
|
to: forwarderContract?.target,
|
|
20897
20902
|
value: "0",
|
|
20898
20903
|
gas: "800000",
|
|
@@ -20902,14 +20907,37 @@ var Seamless = class {
|
|
|
20902
20907
|
deadline
|
|
20903
20908
|
}, chainId);
|
|
20904
20909
|
if (txRs.data?.txHash) {
|
|
20905
|
-
|
|
20906
|
-
|
|
20907
|
-
|
|
20908
|
-
|
|
20909
|
-
|
|
20910
|
+
const maxAttempts = 5;
|
|
20911
|
+
const pollInterval = 1e3;
|
|
20912
|
+
for (let attempt = 0; attempt < maxAttempts; attempt++) {
|
|
20913
|
+
try {
|
|
20914
|
+
const rs = await this.api.fetchForwarderGetApi({ requestId: txRs.data.requestId });
|
|
20915
|
+
if (rs.data?.status === 9) {
|
|
20916
|
+
return {
|
|
20917
|
+
code: 0,
|
|
20918
|
+
data: {
|
|
20919
|
+
seamlessAccount: seamlessAddress,
|
|
20920
|
+
authorized: approve2
|
|
20921
|
+
}
|
|
20922
|
+
};
|
|
20923
|
+
}
|
|
20924
|
+
if (attempt < maxAttempts - 1) {
|
|
20925
|
+
await new Promise((resolve) => setTimeout(resolve, pollInterval));
|
|
20926
|
+
}
|
|
20927
|
+
} catch (error) {
|
|
20928
|
+
console.error("Poll transaction from chain error:", error);
|
|
20929
|
+
if (attempt < maxAttempts - 1) {
|
|
20930
|
+
await new Promise((resolve) => setTimeout(resolve, pollInterval));
|
|
20931
|
+
}
|
|
20910
20932
|
}
|
|
20933
|
+
}
|
|
20934
|
+
return {
|
|
20935
|
+
code: -1,
|
|
20936
|
+
data: null,
|
|
20937
|
+
message: "Transaction confirmation timeout, please check later"
|
|
20911
20938
|
};
|
|
20912
20939
|
} else {
|
|
20940
|
+
console.log("txRs-->", txRs);
|
|
20913
20941
|
return {
|
|
20914
20942
|
code: -1,
|
|
20915
20943
|
data: null,
|
package/dist/index.mjs
CHANGED
|
@@ -1775,7 +1775,7 @@ var RotationProvider = class extends BaseProvider {
|
|
|
1775
1775
|
// package.json
|
|
1776
1776
|
var package_default = {
|
|
1777
1777
|
name: "@myx-trade/sdk",
|
|
1778
|
-
version: "0.1.
|
|
1778
|
+
version: "0.1.250",
|
|
1779
1779
|
private: false,
|
|
1780
1780
|
publishConfig: {
|
|
1781
1781
|
access: "public"
|
|
@@ -12700,7 +12700,6 @@ var ConfigManager = class {
|
|
|
12700
12700
|
};
|
|
12701
12701
|
}
|
|
12702
12702
|
async startSeamlessMode(open) {
|
|
12703
|
-
console.log("startSeamlessMode-->", open);
|
|
12704
12703
|
this.config = {
|
|
12705
12704
|
...this.config,
|
|
12706
12705
|
seamlessMode: open
|
|
@@ -20809,14 +20808,20 @@ var Seamless = class {
|
|
|
20809
20808
|
}
|
|
20810
20809
|
}
|
|
20811
20810
|
const forwarderContract = await getForwarderContract(chainId, 1 /* Signer */);
|
|
20812
|
-
const
|
|
20811
|
+
const jsonProvider = getJSONProvider(chainId);
|
|
20812
|
+
const getNonceForwarderContract = new ethers9.Contract(
|
|
20813
|
+
getContractAddressByChainId(chainId).FORWARDER,
|
|
20814
|
+
Forwarder_default,
|
|
20815
|
+
jsonProvider
|
|
20816
|
+
);
|
|
20817
|
+
const nonce = await getNonceForwarderContract.nonces(masterAddress);
|
|
20813
20818
|
const functionHash = forwarderContract.interface.encodeFunctionData("permitAndApproveForwarder", [
|
|
20814
20819
|
seamlessAddress,
|
|
20815
20820
|
approve2,
|
|
20816
20821
|
permitParams
|
|
20817
20822
|
]);
|
|
20818
20823
|
const txRs = await this.forwarderTx({
|
|
20819
|
-
from: masterAddress
|
|
20824
|
+
from: masterAddress,
|
|
20820
20825
|
to: forwarderContract?.target,
|
|
20821
20826
|
value: "0",
|
|
20822
20827
|
gas: "800000",
|
|
@@ -20826,14 +20831,37 @@ var Seamless = class {
|
|
|
20826
20831
|
deadline
|
|
20827
20832
|
}, chainId);
|
|
20828
20833
|
if (txRs.data?.txHash) {
|
|
20829
|
-
|
|
20830
|
-
|
|
20831
|
-
|
|
20832
|
-
|
|
20833
|
-
|
|
20834
|
+
const maxAttempts = 5;
|
|
20835
|
+
const pollInterval = 1e3;
|
|
20836
|
+
for (let attempt = 0; attempt < maxAttempts; attempt++) {
|
|
20837
|
+
try {
|
|
20838
|
+
const rs = await this.api.fetchForwarderGetApi({ requestId: txRs.data.requestId });
|
|
20839
|
+
if (rs.data?.status === 9) {
|
|
20840
|
+
return {
|
|
20841
|
+
code: 0,
|
|
20842
|
+
data: {
|
|
20843
|
+
seamlessAccount: seamlessAddress,
|
|
20844
|
+
authorized: approve2
|
|
20845
|
+
}
|
|
20846
|
+
};
|
|
20847
|
+
}
|
|
20848
|
+
if (attempt < maxAttempts - 1) {
|
|
20849
|
+
await new Promise((resolve) => setTimeout(resolve, pollInterval));
|
|
20850
|
+
}
|
|
20851
|
+
} catch (error) {
|
|
20852
|
+
console.error("Poll transaction from chain error:", error);
|
|
20853
|
+
if (attempt < maxAttempts - 1) {
|
|
20854
|
+
await new Promise((resolve) => setTimeout(resolve, pollInterval));
|
|
20855
|
+
}
|
|
20834
20856
|
}
|
|
20857
|
+
}
|
|
20858
|
+
return {
|
|
20859
|
+
code: -1,
|
|
20860
|
+
data: null,
|
|
20861
|
+
message: "Transaction confirmation timeout, please check later"
|
|
20835
20862
|
};
|
|
20836
20863
|
} else {
|
|
20864
|
+
console.log("txRs-->", txRs);
|
|
20837
20865
|
return {
|
|
20838
20866
|
code: -1,
|
|
20839
20867
|
data: null,
|