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