@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.
package/dist/index.js CHANGED
@@ -11634,6 +11634,14 @@ function toSignatureArray(sig) {
11634
11634
  const s = sig;
11635
11635
  return [s.r.toString(), s.s.toString()];
11636
11636
  }
11637
+ function newContract(abi, address, providerOrAccount) {
11638
+ const C = Contract;
11639
+ return C.length === 1 ? new Contract({ abi, address, providerOrAccount }) : new Contract(
11640
+ abi,
11641
+ address,
11642
+ providerOrAccount
11643
+ );
11644
+ }
11637
11645
  function getChainId(config) {
11638
11646
  if (config.chain !== "STARKNET") {
11639
11647
  throw new Error(`SNIP-12 signing is Starknet-only; got chain "${config.chain}"`);
@@ -11660,7 +11668,7 @@ function getProvider(config) {
11660
11668
 
11661
11669
  // src/starknet/marketplace/build.ts
11662
11670
  function contractFor(cfg) {
11663
- return new Contract(IPMarketplaceABI, cfg.marketplaceContract, getProvider(cfg));
11671
+ return newContract(IPMarketplaceABI, cfg.marketplaceContract, getProvider(cfg));
11664
11672
  }
11665
11673
  function buildListingOrder(i, cfg) {
11666
11674
  const orderParams = {
@@ -11752,11 +11760,7 @@ function makeContract(config) {
11752
11760
  const cached = _contractCache.get(config);
11753
11761
  const provider = getProvider(config);
11754
11762
  if (cached) return { ...cached, provider };
11755
- const contract = new Contract(
11756
- IPMarketplaceABI,
11757
- config.marketplaceContract,
11758
- provider
11759
- );
11763
+ const contract = newContract(IPMarketplaceABI, config.marketplaceContract, provider);
11760
11764
  _contractCache.set(config, { contract });
11761
11765
  return { contract, provider };
11762
11766
  }
@@ -12033,7 +12037,7 @@ var MarketplaceModule = class {
12033
12037
  }
12034
12038
  };
12035
12039
  function contractFor2(cfg) {
12036
- return new Contract(Medialane1155ABI, cfg.marketplace1155Contract, getProvider(cfg));
12040
+ return newContract(Medialane1155ABI, cfg.marketplace1155Contract, getProvider(cfg));
12037
12041
  }
12038
12042
  function buildListing1155Order(i, cfg) {
12039
12043
  const orderParams = {
@@ -12131,11 +12135,7 @@ function getContract(config) {
12131
12135
  let c = _contractCache2.get(config);
12132
12136
  if (!c) {
12133
12137
  const provider = getProvider(config);
12134
- c = new Contract(
12135
- Medialane1155ABI,
12136
- config.marketplace1155Contract,
12137
- provider
12138
- );
12138
+ c = newContract(Medialane1155ABI, config.marketplace1155Contract, provider);
12139
12139
  _contractCache2.set(config, c);
12140
12140
  }
12141
12141
  return c;