@medialane/sdk 0.60.0 → 0.61.0

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.
@@ -10619,6 +10619,14 @@ function toSignatureArray(sig) {
10619
10619
  const s = sig;
10620
10620
  return [s.r.toString(), s.s.toString()];
10621
10621
  }
10622
+ function newContract(abi, address, providerOrAccount) {
10623
+ const C = Contract;
10624
+ return C.length === 1 ? new Contract({ abi, address, providerOrAccount }) : new Contract(
10625
+ abi,
10626
+ address,
10627
+ providerOrAccount
10628
+ );
10629
+ }
10622
10630
  function getChainId(config) {
10623
10631
  if (config.chain !== "STARKNET") {
10624
10632
  throw new Error(`SNIP-12 signing is Starknet-only; got chain "${config.chain}"`);
@@ -10645,7 +10653,7 @@ function getProvider(config) {
10645
10653
 
10646
10654
  // src/starknet/marketplace/build.ts
10647
10655
  function contractFor(cfg) {
10648
- return new Contract(IPMarketplaceABI, cfg.marketplaceContract, getProvider(cfg));
10656
+ return newContract(IPMarketplaceABI, cfg.marketplaceContract, getProvider(cfg));
10649
10657
  }
10650
10658
  function buildListingOrder(i, cfg) {
10651
10659
  const orderParams = {
@@ -10737,11 +10745,7 @@ function makeContract(config) {
10737
10745
  const cached = _contractCache.get(config);
10738
10746
  const provider = getProvider(config);
10739
10747
  if (cached) return { ...cached, provider };
10740
- const contract = new Contract(
10741
- IPMarketplaceABI,
10742
- config.marketplaceContract,
10743
- provider
10744
- );
10748
+ const contract = newContract(IPMarketplaceABI, config.marketplaceContract, provider);
10745
10749
  _contractCache.set(config, { contract });
10746
10750
  return { contract, provider };
10747
10751
  }
@@ -11018,7 +11022,7 @@ var MarketplaceModule = class {
11018
11022
  }
11019
11023
  };
11020
11024
  function contractFor2(cfg) {
11021
- return new Contract(Medialane1155ABI, cfg.marketplace1155Contract, getProvider(cfg));
11025
+ return newContract(Medialane1155ABI, cfg.marketplace1155Contract, getProvider(cfg));
11022
11026
  }
11023
11027
  function buildListing1155Order(i, cfg) {
11024
11028
  const orderParams = {
@@ -11116,11 +11120,7 @@ function getContract(config) {
11116
11120
  let c = _contractCache2.get(config);
11117
11121
  if (!c) {
11118
11122
  const provider = getProvider(config);
11119
- c = new Contract(
11120
- Medialane1155ABI,
11121
- config.marketplace1155Contract,
11122
- provider
11123
- );
11123
+ c = newContract(Medialane1155ABI, config.marketplace1155Contract, provider);
11124
11124
  _contractCache2.set(config, c);
11125
11125
  }
11126
11126
  return c;