@zubari/sdk 0.4.1 → 0.4.3

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 CHANGED
@@ -436,7 +436,7 @@ function deriveEthereumAddress(seed) {
436
436
  const hdNode = ethers.HDNodeWallet.fromPhrase(seed, void 0, DERIVATION_PATHS2.ethereum);
437
437
  return hdNode.address;
438
438
  }
439
- function deriveBitcoinAddress(seed, network = "testnet") {
439
+ function deriveBitcoinAddress(seed, network = "mainnet") {
440
440
  try {
441
441
  const seedBytes = bip39.mnemonicToSeedSync(seed);
442
442
  const hdKey = bip32.HDKey.fromMasterSeed(seedBytes);
@@ -530,7 +530,7 @@ function deriveTronAddress(seed) {
530
530
  throw error;
531
531
  }
532
532
  }
533
- function deriveSparkAddress(seed, network = "testnet") {
533
+ function deriveSparkAddress(seed, network = "mainnet") {
534
534
  try {
535
535
  const seedBytes = bip39.mnemonicToSeedSync(seed);
536
536
  const hdKey = bip32.HDKey.fromMasterSeed(seedBytes);
@@ -550,7 +550,7 @@ function deriveSparkAddress(seed, network = "testnet") {
550
550
  throw error;
551
551
  }
552
552
  }
553
- async function deriveAllAddresses(seed, network = "testnet") {
553
+ async function deriveAllAddresses(seed, network = "mainnet") {
554
554
  const addresses = {
555
555
  ethereum: null,
556
556
  bitcoin: null,
@@ -778,7 +778,7 @@ var ZubariWdkService = class {
778
778
  }
779
779
  return null;
780
780
  };
781
- return {
781
+ const addresses = {
782
782
  ethereum: extractAddress(response.addresses.ethereum),
783
783
  bitcoin: extractAddress(response.addresses.bitcoin),
784
784
  ton: extractAddress(response.addresses.ton),
@@ -786,6 +786,14 @@ var ZubariWdkService = class {
786
786
  solana: extractAddress(response.addresses.solana),
787
787
  spark: extractAddress(response.addresses.spark)
788
788
  };
789
+ if (!addresses.spark) {
790
+ try {
791
+ addresses.spark = deriveSparkAddress(seed, this.config.network);
792
+ } catch (e) {
793
+ console.warn("Browser Spark derivation fallback failed:", e);
794
+ }
795
+ }
796
+ return addresses;
789
797
  }
790
798
  } catch (error) {
791
799
  console.warn("API address derivation failed:", error);
@@ -3381,7 +3389,7 @@ var ZubariNFTProtocol = class {
3381
3389
  network;
3382
3390
  apiClient;
3383
3391
  nonceCounter = 0;
3384
- constructor(contractAddress, marketplaceAddress, chainId, network = "testnet", apiUrl) {
3392
+ constructor(contractAddress, marketplaceAddress, chainId, network = "mainnet", apiUrl) {
3385
3393
  this.contractAddress = contractAddress;
3386
3394
  this._marketplaceAddress = marketplaceAddress;
3387
3395
  this.chainId = chainId;