@myx-trade/sdk 0.1.135 → 0.1.136

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 CHANGED
@@ -1505,8 +1505,8 @@ declare class Seamless {
1505
1505
  private utils;
1506
1506
  private account;
1507
1507
  constructor(configManager: ConfigManager, logger: Logger, utils: Utils, account: Account);
1508
- onCheckRelayer(account: string, relayer: string): Promise<boolean>;
1509
- getUSDPermitParams(deadline: number): Promise<{
1508
+ onCheckRelayer(account: string, relayer: string, chainId: number): Promise<boolean>;
1509
+ getUSDPermitParams(deadline: number, chainId: number): Promise<{
1510
1510
  token: string | ethers$1.Addressable;
1511
1511
  owner: Promise<string> | undefined;
1512
1512
  spender: string;
@@ -1536,10 +1536,11 @@ declare class Seamless {
1536
1536
  authorized: boolean;
1537
1537
  };
1538
1538
  } | undefined>;
1539
- unLockSeamlessWallet({ masterAddress, password, apiKey }: {
1539
+ unLockSeamlessWallet({ masterAddress, password, apiKey, chainId }: {
1540
1540
  masterAddress: string;
1541
1541
  password: string;
1542
1542
  apiKey: string;
1543
+ chainId: number;
1543
1544
  }): Promise<{
1544
1545
  code: number;
1545
1546
  data: {
@@ -1557,9 +1558,10 @@ declare class Seamless {
1557
1558
  privateKey: string;
1558
1559
  };
1559
1560
  }>;
1560
- importSeamlessPrivateKey({ privateKey, password }: {
1561
+ importSeamlessPrivateKey({ privateKey, password, chainId }: {
1561
1562
  privateKey: string;
1562
1563
  password: string;
1564
+ chainId: number;
1563
1565
  }): Promise<{
1564
1566
  code: number;
1565
1567
  data: {
package/dist/index.d.ts CHANGED
@@ -1505,8 +1505,8 @@ declare class Seamless {
1505
1505
  private utils;
1506
1506
  private account;
1507
1507
  constructor(configManager: ConfigManager, logger: Logger, utils: Utils, account: Account);
1508
- onCheckRelayer(account: string, relayer: string): Promise<boolean>;
1509
- getUSDPermitParams(deadline: number): Promise<{
1508
+ onCheckRelayer(account: string, relayer: string, chainId: number): Promise<boolean>;
1509
+ getUSDPermitParams(deadline: number, chainId: number): Promise<{
1510
1510
  token: string | ethers$1.Addressable;
1511
1511
  owner: Promise<string> | undefined;
1512
1512
  spender: string;
@@ -1536,10 +1536,11 @@ declare class Seamless {
1536
1536
  authorized: boolean;
1537
1537
  };
1538
1538
  } | undefined>;
1539
- unLockSeamlessWallet({ masterAddress, password, apiKey }: {
1539
+ unLockSeamlessWallet({ masterAddress, password, apiKey, chainId }: {
1540
1540
  masterAddress: string;
1541
1541
  password: string;
1542
1542
  apiKey: string;
1543
+ chainId: number;
1543
1544
  }): Promise<{
1544
1545
  code: number;
1545
1546
  data: {
@@ -1557,9 +1558,10 @@ declare class Seamless {
1557
1558
  privateKey: string;
1558
1559
  };
1559
1560
  }>;
1560
- importSeamlessPrivateKey({ privateKey, password }: {
1561
+ importSeamlessPrivateKey({ privateKey, password, chainId }: {
1561
1562
  privateKey: string;
1562
1563
  password: string;
1564
+ chainId: number;
1563
1565
  }): Promise<{
1564
1566
  code: number;
1565
1567
  data: {
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.135",
1825
+ version: "0.1.136",
1826
1826
  private: false,
1827
1827
  publishConfig: {
1828
1828
  access: "public"
@@ -14714,13 +14714,13 @@ var Order = class {
14714
14714
  data: rs
14715
14715
  };
14716
14716
  }
14717
+ if (!config.signer) {
14718
+ throw new MyxSDKError("INVALID_SIGNER" /* InvalidSigner */, "Invalid signer");
14719
+ }
14717
14720
  const brokerContract = await getBrokerSingerContract(
14718
14721
  params.chainId,
14719
14722
  this.configManager.getConfig().brokerAddress
14720
14723
  );
14721
- if (!config.signer) {
14722
- throw new MyxSDKError("INVALID_SIGNER" /* InvalidSigner */, "Invalid signer");
14723
- }
14724
14724
  if (needsApproval) {
14725
14725
  const approvalResult = await this.utils.approveAuthorization({
14726
14726
  chainId: params.chainId,
@@ -14731,6 +14731,8 @@ var Order = class {
14731
14731
  throw new Error(approvalResult.message);
14732
14732
  }
14733
14733
  }
14734
+ console.log("depositData-->", depositData);
14735
+ console.log("data-->", data);
14734
14736
  let transaction;
14735
14737
  if (!params.positionId) {
14736
14738
  const positionId = 1;
@@ -21386,18 +21388,17 @@ var Seamless = class {
21386
21388
  this.utils = utils;
21387
21389
  this.account = account;
21388
21390
  }
21389
- async onCheckRelayer(account, relayer) {
21391
+ async onCheckRelayer(account, relayer, chainId) {
21390
21392
  const config = this.configManager.getConfig();
21391
- const forwarderContract = await getForwarderContract(config.chainId);
21393
+ const forwarderContract = await getForwarderContract(chainId);
21392
21394
  const checkRelayerResult = await forwarderContract.isUserRelayerEnabled(account, relayer);
21393
21395
  return checkRelayerResult;
21394
21396
  }
21395
- async getUSDPermitParams(deadline) {
21397
+ async getUSDPermitParams(deadline, chainId) {
21396
21398
  const config = this.configManager.getConfig();
21397
- const chainId = config.chainId;
21398
21399
  const masterAddress = config.signer?.getAddress();
21399
21400
  const brokerAddress = config.brokerAddress;
21400
- const contractAddress = getContractAddressByChainId(config.chainId);
21401
+ const contractAddress = getContractAddressByChainId(chainId);
21401
21402
  const erc20Contract = new import_ethers27.ethers.Contract(
21402
21403
  contractAddress.ERC20,
21403
21404
  ERC20Token_default,
@@ -21463,7 +21464,6 @@ var Seamless = class {
21463
21464
  return txRs;
21464
21465
  }
21465
21466
  async authorizeSeamlessAccount({ approve: approve2, seamlessAddress, chainId }) {
21466
- console.log("authorizeSeamlessAccount-->", approve2, seamlessAddress, chainId);
21467
21467
  const config = this.configManager.getConfig();
21468
21468
  const accessToken = await this.configManager.getAccessToken();
21469
21469
  if (!accessToken) {
@@ -21517,7 +21517,6 @@ var Seamless = class {
21517
21517
  const getRs = await fetchForwarderGetApi({
21518
21518
  requestId: txRs.data?.requestId
21519
21519
  });
21520
- this.logger.info("authorizeSeamlessAccount result-->", getRs);
21521
21520
  if (getRs.data?.status === 9 /* EXECUTED */) {
21522
21521
  if (getRs.data?.txHash) {
21523
21522
  txRs.data.txHash = getRs.data.txHash;
@@ -21548,7 +21547,7 @@ var Seamless = class {
21548
21547
  }
21549
21548
  }
21550
21549
  }
21551
- async unLockSeamlessWallet({ masterAddress, password, apiKey }) {
21550
+ async unLockSeamlessWallet({ masterAddress, password, apiKey, chainId }) {
21552
21551
  const key = import_crypto_js.default.enc.Utf8.parse(charFill(password));
21553
21552
  const iv = getIvMapString();
21554
21553
  const decrypted = import_crypto_js.default.AES.decrypt(apiKey, key, {
@@ -21558,7 +21557,7 @@ var Seamless = class {
21558
21557
  });
21559
21558
  const privateKey = decrypted.toString(import_crypto_js.default.enc.Utf8);
21560
21559
  const wallet = new import_ethers27.ethers.Wallet(privateKey);
21561
- const isAuthorized = await this.onCheckRelayer(masterAddress, wallet.address);
21560
+ const isAuthorized = await this.onCheckRelayer(masterAddress, wallet.address, chainId);
21562
21561
  this.configManager.updateSeamlessWallet({
21563
21562
  masterAddress,
21564
21563
  wallet,
@@ -21593,7 +21592,7 @@ var Seamless = class {
21593
21592
  }
21594
21593
  };
21595
21594
  }
21596
- async importSeamlessPrivateKey({ privateKey, password }) {
21595
+ async importSeamlessPrivateKey({ privateKey, password, chainId }) {
21597
21596
  const config = this.configManager.getConfig();
21598
21597
  if (!import_ethers27.ethers.isHexString(privateKey, 32)) {
21599
21598
  throw new MyxSDKError("INVALID_PRIVATE_KEY" /* InvalidPrivateKey */, "Invalid private key");
@@ -21604,7 +21603,7 @@ var Seamless = class {
21604
21603
  if (masterAddress === import_ethers27.ZeroAddress) {
21605
21604
  throw new MyxSDKError("INVALID_PRIVATE_KEY" /* InvalidPrivateKey */, "The private key is not a senseless account");
21606
21605
  }
21607
- const isAuthorized = await this.onCheckRelayer(masterAddress, wallet.address);
21606
+ const isAuthorized = await this.onCheckRelayer(masterAddress, wallet.address, chainId);
21608
21607
  const key = import_crypto_js.default.enc.Utf8.parse(charFill(password));
21609
21608
  const iv = getIvMapString();
21610
21609
  const encrypted = import_crypto_js.default.AES.encrypt(privateKey, key, {
@@ -21656,14 +21655,14 @@ var Seamless = class {
21656
21655
  padding: import_crypto_js.default.pad.Pkcs7
21657
21656
  });
21658
21657
  const apiKey = encrypted.toString();
21659
- let isAuthorized = await this.onCheckRelayer(account, wallet.address);
21658
+ let isAuthorized = await this.onCheckRelayer(account, wallet.address, chainId);
21660
21659
  this.configManager.updateSeamlessWallet({
21661
21660
  masterAddress: account,
21662
21661
  wallet,
21663
21662
  authorized: isAuthorized
21664
21663
  });
21665
- const forwarderContract = await getForwarderContract(config.chainId);
21666
- const erc20Address = getContractAddressByChainId(config.chainId).ERC20;
21664
+ const forwarderContract = await getForwarderContract(chainId);
21665
+ const erc20Address = getContractAddressByChainId(chainId).ERC20;
21667
21666
  await this.utils.approveAuthorization({
21668
21667
  chainId,
21669
21668
  quoteAddress: erc20Address,
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.135",
1735
+ version: "0.1.136",
1736
1736
  private: false,
1737
1737
  publishConfig: {
1738
1738
  access: "public"
@@ -14624,13 +14624,13 @@ var Order = class {
14624
14624
  data: rs
14625
14625
  };
14626
14626
  }
14627
+ if (!config.signer) {
14628
+ throw new MyxSDKError("INVALID_SIGNER" /* InvalidSigner */, "Invalid signer");
14629
+ }
14627
14630
  const brokerContract = await getBrokerSingerContract(
14628
14631
  params.chainId,
14629
14632
  this.configManager.getConfig().brokerAddress
14630
14633
  );
14631
- if (!config.signer) {
14632
- throw new MyxSDKError("INVALID_SIGNER" /* InvalidSigner */, "Invalid signer");
14633
- }
14634
14634
  if (needsApproval) {
14635
14635
  const approvalResult = await this.utils.approveAuthorization({
14636
14636
  chainId: params.chainId,
@@ -14641,6 +14641,8 @@ var Order = class {
14641
14641
  throw new Error(approvalResult.message);
14642
14642
  }
14643
14643
  }
14644
+ console.log("depositData-->", depositData);
14645
+ console.log("data-->", data);
14644
14646
  let transaction;
14645
14647
  if (!params.positionId) {
14646
14648
  const positionId = 1;
@@ -21296,18 +21298,17 @@ var Seamless = class {
21296
21298
  this.utils = utils;
21297
21299
  this.account = account;
21298
21300
  }
21299
- async onCheckRelayer(account, relayer) {
21301
+ async onCheckRelayer(account, relayer, chainId) {
21300
21302
  const config = this.configManager.getConfig();
21301
- const forwarderContract = await getForwarderContract(config.chainId);
21303
+ const forwarderContract = await getForwarderContract(chainId);
21302
21304
  const checkRelayerResult = await forwarderContract.isUserRelayerEnabled(account, relayer);
21303
21305
  return checkRelayerResult;
21304
21306
  }
21305
- async getUSDPermitParams(deadline) {
21307
+ async getUSDPermitParams(deadline, chainId) {
21306
21308
  const config = this.configManager.getConfig();
21307
- const chainId = config.chainId;
21308
21309
  const masterAddress = config.signer?.getAddress();
21309
21310
  const brokerAddress = config.brokerAddress;
21310
- const contractAddress = getContractAddressByChainId(config.chainId);
21311
+ const contractAddress = getContractAddressByChainId(chainId);
21311
21312
  const erc20Contract = new ethers9.Contract(
21312
21313
  contractAddress.ERC20,
21313
21314
  ERC20Token_default,
@@ -21373,7 +21374,6 @@ var Seamless = class {
21373
21374
  return txRs;
21374
21375
  }
21375
21376
  async authorizeSeamlessAccount({ approve: approve2, seamlessAddress, chainId }) {
21376
- console.log("authorizeSeamlessAccount-->", approve2, seamlessAddress, chainId);
21377
21377
  const config = this.configManager.getConfig();
21378
21378
  const accessToken = await this.configManager.getAccessToken();
21379
21379
  if (!accessToken) {
@@ -21427,7 +21427,6 @@ var Seamless = class {
21427
21427
  const getRs = await fetchForwarderGetApi({
21428
21428
  requestId: txRs.data?.requestId
21429
21429
  });
21430
- this.logger.info("authorizeSeamlessAccount result-->", getRs);
21431
21430
  if (getRs.data?.status === 9 /* EXECUTED */) {
21432
21431
  if (getRs.data?.txHash) {
21433
21432
  txRs.data.txHash = getRs.data.txHash;
@@ -21458,7 +21457,7 @@ var Seamless = class {
21458
21457
  }
21459
21458
  }
21460
21459
  }
21461
- async unLockSeamlessWallet({ masterAddress, password, apiKey }) {
21460
+ async unLockSeamlessWallet({ masterAddress, password, apiKey, chainId }) {
21462
21461
  const key = CryptoJS.enc.Utf8.parse(charFill(password));
21463
21462
  const iv = getIvMapString();
21464
21463
  const decrypted = CryptoJS.AES.decrypt(apiKey, key, {
@@ -21468,7 +21467,7 @@ var Seamless = class {
21468
21467
  });
21469
21468
  const privateKey = decrypted.toString(CryptoJS.enc.Utf8);
21470
21469
  const wallet = new ethers9.Wallet(privateKey);
21471
- const isAuthorized = await this.onCheckRelayer(masterAddress, wallet.address);
21470
+ const isAuthorized = await this.onCheckRelayer(masterAddress, wallet.address, chainId);
21472
21471
  this.configManager.updateSeamlessWallet({
21473
21472
  masterAddress,
21474
21473
  wallet,
@@ -21503,7 +21502,7 @@ var Seamless = class {
21503
21502
  }
21504
21503
  };
21505
21504
  }
21506
- async importSeamlessPrivateKey({ privateKey, password }) {
21505
+ async importSeamlessPrivateKey({ privateKey, password, chainId }) {
21507
21506
  const config = this.configManager.getConfig();
21508
21507
  if (!ethers9.isHexString(privateKey, 32)) {
21509
21508
  throw new MyxSDKError("INVALID_PRIVATE_KEY" /* InvalidPrivateKey */, "Invalid private key");
@@ -21514,7 +21513,7 @@ var Seamless = class {
21514
21513
  if (masterAddress === ZeroAddress2) {
21515
21514
  throw new MyxSDKError("INVALID_PRIVATE_KEY" /* InvalidPrivateKey */, "The private key is not a senseless account");
21516
21515
  }
21517
- const isAuthorized = await this.onCheckRelayer(masterAddress, wallet.address);
21516
+ const isAuthorized = await this.onCheckRelayer(masterAddress, wallet.address, chainId);
21518
21517
  const key = CryptoJS.enc.Utf8.parse(charFill(password));
21519
21518
  const iv = getIvMapString();
21520
21519
  const encrypted = CryptoJS.AES.encrypt(privateKey, key, {
@@ -21566,14 +21565,14 @@ var Seamless = class {
21566
21565
  padding: CryptoJS.pad.Pkcs7
21567
21566
  });
21568
21567
  const apiKey = encrypted.toString();
21569
- let isAuthorized = await this.onCheckRelayer(account, wallet.address);
21568
+ let isAuthorized = await this.onCheckRelayer(account, wallet.address, chainId);
21570
21569
  this.configManager.updateSeamlessWallet({
21571
21570
  masterAddress: account,
21572
21571
  wallet,
21573
21572
  authorized: isAuthorized
21574
21573
  });
21575
- const forwarderContract = await getForwarderContract(config.chainId);
21576
- const erc20Address = getContractAddressByChainId(config.chainId).ERC20;
21574
+ const forwarderContract = await getForwarderContract(chainId);
21575
+ const erc20Address = getContractAddressByChainId(chainId).ERC20;
21577
21576
  await this.utils.approveAuthorization({
21578
21577
  chainId,
21579
21578
  quoteAddress: erc20Address,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myx-trade/sdk",
3
- "version": "0.1.135",
3
+ "version": "0.1.136",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"