@myx-trade/sdk 0.1.139 → 0.1.141
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 +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +10 -7
- package/dist/index.mjs +10 -7
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1508,7 +1508,7 @@ declare class Seamless {
|
|
|
1508
1508
|
onCheckRelayer(account: string, relayer: string, chainId: number): Promise<boolean>;
|
|
1509
1509
|
getUSDPermitParams(deadline: number, chainId: number): Promise<{
|
|
1510
1510
|
token: string | ethers$1.Addressable;
|
|
1511
|
-
owner:
|
|
1511
|
+
owner: string;
|
|
1512
1512
|
spender: string;
|
|
1513
1513
|
value: bigint;
|
|
1514
1514
|
deadline: number;
|
package/dist/index.d.ts
CHANGED
|
@@ -1508,7 +1508,7 @@ declare class Seamless {
|
|
|
1508
1508
|
onCheckRelayer(account: string, relayer: string, chainId: number): Promise<boolean>;
|
|
1509
1509
|
getUSDPermitParams(deadline: number, chainId: number): Promise<{
|
|
1510
1510
|
token: string | ethers$1.Addressable;
|
|
1511
|
-
owner:
|
|
1511
|
+
owner: string;
|
|
1512
1512
|
spender: string;
|
|
1513
1513
|
value: bigint;
|
|
1514
1514
|
deadline: number;
|
package/dist/index.js
CHANGED
|
@@ -1821,7 +1821,7 @@ var RotationProvider = class extends import_providers.BaseProvider {
|
|
|
1821
1821
|
// package.json
|
|
1822
1822
|
var package_default = {
|
|
1823
1823
|
name: "@myx-trade/sdk",
|
|
1824
|
-
version: "0.1.
|
|
1824
|
+
version: "0.1.141",
|
|
1825
1825
|
private: false,
|
|
1826
1826
|
publishConfig: {
|
|
1827
1827
|
access: "public"
|
|
@@ -21395,7 +21395,10 @@ var Seamless = class {
|
|
|
21395
21395
|
}
|
|
21396
21396
|
async getUSDPermitParams(deadline, chainId) {
|
|
21397
21397
|
const config = this.configManager.getConfig();
|
|
21398
|
-
|
|
21398
|
+
if (!config.signer) {
|
|
21399
|
+
throw new MyxSDKError("INVALID_SIGNER" /* InvalidSigner */, "Signer is required for permit");
|
|
21400
|
+
}
|
|
21401
|
+
const masterAddress = await config.signer.getAddress();
|
|
21399
21402
|
const brokerAddress = config.brokerAddress;
|
|
21400
21403
|
const contractAddress = getContractAddressByChainId(chainId);
|
|
21401
21404
|
const erc20Contract = new import_ethers27.ethers.Contract(
|
|
@@ -21403,17 +21406,16 @@ var Seamless = class {
|
|
|
21403
21406
|
ERC20Token_default,
|
|
21404
21407
|
config.signer
|
|
21405
21408
|
);
|
|
21406
|
-
const walletProvider = await getWalletProvider(chainId);
|
|
21407
21409
|
try {
|
|
21408
21410
|
const nonces = await erc20Contract.nonces(masterAddress);
|
|
21409
21411
|
const brokerSignPermit = await signPermit(
|
|
21410
|
-
|
|
21411
|
-
|
|
21412
|
+
config.signer,
|
|
21413
|
+
// 使用 signer 而不是 provider
|
|
21412
21414
|
erc20Contract,
|
|
21413
21415
|
masterAddress,
|
|
21414
21416
|
brokerAddress,
|
|
21415
|
-
import_ethers27.ethers.MaxUint256,
|
|
21416
|
-
nonces,
|
|
21417
|
+
import_ethers27.ethers.MaxUint256.toString(),
|
|
21418
|
+
nonces.toString(),
|
|
21417
21419
|
deadline.toString(),
|
|
21418
21420
|
chainId
|
|
21419
21421
|
);
|
|
@@ -21430,6 +21432,7 @@ var Seamless = class {
|
|
|
21430
21432
|
console.log("brokerSeamlessUSDPermitParams-->", brokerSeamlessUSDPermitParams);
|
|
21431
21433
|
return [brokerSeamlessUSDPermitParams];
|
|
21432
21434
|
} catch (error) {
|
|
21435
|
+
this.logger.error("getUSDPermitParams error-->", error);
|
|
21433
21436
|
throw new MyxSDKError("INVALID_PRIVATE_KEY" /* InvalidPrivateKey */, "Invalid private key generated");
|
|
21434
21437
|
}
|
|
21435
21438
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1731,7 +1731,7 @@ var RotationProvider = class extends BaseProvider {
|
|
|
1731
1731
|
// package.json
|
|
1732
1732
|
var package_default = {
|
|
1733
1733
|
name: "@myx-trade/sdk",
|
|
1734
|
-
version: "0.1.
|
|
1734
|
+
version: "0.1.141",
|
|
1735
1735
|
private: false,
|
|
1736
1736
|
publishConfig: {
|
|
1737
1737
|
access: "public"
|
|
@@ -21305,7 +21305,10 @@ var Seamless = class {
|
|
|
21305
21305
|
}
|
|
21306
21306
|
async getUSDPermitParams(deadline, chainId) {
|
|
21307
21307
|
const config = this.configManager.getConfig();
|
|
21308
|
-
|
|
21308
|
+
if (!config.signer) {
|
|
21309
|
+
throw new MyxSDKError("INVALID_SIGNER" /* InvalidSigner */, "Signer is required for permit");
|
|
21310
|
+
}
|
|
21311
|
+
const masterAddress = await config.signer.getAddress();
|
|
21309
21312
|
const brokerAddress = config.brokerAddress;
|
|
21310
21313
|
const contractAddress = getContractAddressByChainId(chainId);
|
|
21311
21314
|
const erc20Contract = new ethers9.Contract(
|
|
@@ -21313,17 +21316,16 @@ var Seamless = class {
|
|
|
21313
21316
|
ERC20Token_default,
|
|
21314
21317
|
config.signer
|
|
21315
21318
|
);
|
|
21316
|
-
const walletProvider = await getWalletProvider(chainId);
|
|
21317
21319
|
try {
|
|
21318
21320
|
const nonces = await erc20Contract.nonces(masterAddress);
|
|
21319
21321
|
const brokerSignPermit = await signPermit(
|
|
21320
|
-
|
|
21321
|
-
|
|
21322
|
+
config.signer,
|
|
21323
|
+
// 使用 signer 而不是 provider
|
|
21322
21324
|
erc20Contract,
|
|
21323
21325
|
masterAddress,
|
|
21324
21326
|
brokerAddress,
|
|
21325
|
-
ethers9.MaxUint256,
|
|
21326
|
-
nonces,
|
|
21327
|
+
ethers9.MaxUint256.toString(),
|
|
21328
|
+
nonces.toString(),
|
|
21327
21329
|
deadline.toString(),
|
|
21328
21330
|
chainId
|
|
21329
21331
|
);
|
|
@@ -21340,6 +21342,7 @@ var Seamless = class {
|
|
|
21340
21342
|
console.log("brokerSeamlessUSDPermitParams-->", brokerSeamlessUSDPermitParams);
|
|
21341
21343
|
return [brokerSeamlessUSDPermitParams];
|
|
21342
21344
|
} catch (error) {
|
|
21345
|
+
this.logger.error("getUSDPermitParams error-->", error);
|
|
21343
21346
|
throw new MyxSDKError("INVALID_PRIVATE_KEY" /* InvalidPrivateKey */, "Invalid private key generated");
|
|
21344
21347
|
}
|
|
21345
21348
|
}
|