@medialane/sdk 0.6.1 → 0.6.2

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/README.md CHANGED
@@ -415,6 +415,21 @@ Built with:
415
415
 
416
416
  ## Changelog
417
417
 
418
+ ### v0.6.1
419
+ - **Collection Drop** — new `DropService` (`client.services.drop`) with full on-chain drop management: `claim`, `adminMint`, `setClaimConditions`, `setAllowlistEnabled`, `addToAllowlist`, `batchAddToAllowlist`, `setPaused`, `withdrawPayments`, `createDrop`
420
+ - **`client.api.getDropCollections(opts?)`** — list all `COLLECTION_DROP` collections
421
+ - **`client.api.getDropMintStatus(collection, wallet)`** — returns `{ mintedByWallet, totalMinted }`
422
+ - **`DropMintStatus`**, **`ClaimConditions`**, **`CreateDropParams`** types exported
423
+ - **`DropCollectionABI`** and **`DropFactoryABI`** exported from `@medialane/sdk`
424
+ - **`DROP_FACTORY_CONTRACT_MAINNET`** and **`DROP_COLLECTION_CLASS_HASH_MAINNET`** constants exported
425
+ - **`CollectionSource`** union extended with `"COLLECTION_DROP"`
426
+
427
+ ### v0.6.0
428
+ - **POP Protocol** — `PopService` (`client.services.pop`): `claim`, `adminMint`, `addToAllowlist`, `batchAddToAllowlist`, `removeFromAllowlist`, `setTokenUri`, `setPaused`, `createCollection`
429
+ - **`client.api.getPopCollections(opts?)`** and **`client.api.getPopEligibility(collection, wallet)`**
430
+ - **`POPCollectionABI`** and **`POPFactoryABI`** exported
431
+ - **`POP_FACTORY_CONTRACT_MAINNET`** and **`POP_COLLECTION_CLASS_HASH_MAINNET`** constants exported
432
+
418
433
  ### v0.5.7
419
434
  - **`ApiCollectionProfile.hasGatedContent: boolean`** — whether the collection has token-gated content configured
420
435
  - **`ApiCollectionProfile.gatedContentTitle: string | null`** — public title of gated content (shown to all users; URL is accessible to holders only via the backend gated-content endpoint)
package/dist/index.cjs CHANGED
@@ -1879,20 +1879,20 @@ var ApiClient = class {
1879
1879
  return res.data;
1880
1880
  }
1881
1881
  };
1882
- var POP_FACTORY_MAINNET = "0x00b32c34b427d8f346b5843ada6a37bd3368d879fc752cd52b68a87287f60111";
1883
1882
  var PopService = class {
1884
1883
  constructor(_config) {
1885
- this.factoryAddress = POP_FACTORY_MAINNET;
1884
+ this.factoryAddress = POP_FACTORY_CONTRACT_MAINNET;
1885
+ }
1886
+ _collection(address, account) {
1887
+ return new starknet.Contract(POPCollectionABI, normalizeAddress(address), account);
1886
1888
  }
1887
1889
  async claim(account, collectionAddress) {
1888
- const collection = new starknet.Contract(POPCollectionABI, normalizeAddress(collectionAddress), account);
1889
- const call = collection.populate("claim", []);
1890
+ const call = this._collection(collectionAddress, account).populate("claim", []);
1890
1891
  const res = await account.execute([call]);
1891
1892
  return { txHash: res.transaction_hash };
1892
1893
  }
1893
1894
  async adminMint(account, params) {
1894
- const collection = new starknet.Contract(POPCollectionABI, normalizeAddress(params.collection), account);
1895
- const call = collection.populate("admin_mint", [
1895
+ const call = this._collection(params.collection, account).populate("admin_mint", [
1896
1896
  params.recipient,
1897
1897
  params.customUri ?? ""
1898
1898
  ]);
@@ -1900,55 +1900,51 @@ var PopService = class {
1900
1900
  return { txHash: res.transaction_hash };
1901
1901
  }
1902
1902
  async addToAllowlist(account, params) {
1903
- const collection = new starknet.Contract(POPCollectionABI, normalizeAddress(params.collection), account);
1904
- const call = collection.populate("add_to_allowlist", [params.address]);
1903
+ const call = this._collection(params.collection, account).populate("add_to_allowlist", [params.address]);
1905
1904
  const res = await account.execute([call]);
1906
1905
  return { txHash: res.transaction_hash };
1907
1906
  }
1908
1907
  async batchAddToAllowlist(account, params) {
1909
- const collection = new starknet.Contract(POPCollectionABI, normalizeAddress(params.collection), account);
1908
+ const collection = this._collection(params.collection, account);
1910
1909
  const CHUNK = 200;
1911
1910
  const calls = [];
1912
1911
  for (let i = 0; i < params.addresses.length; i += CHUNK) {
1913
- const chunk = params.addresses.slice(i, i + CHUNK);
1914
- calls.push(collection.populate("batch_add_to_allowlist", [chunk]));
1912
+ calls.push(collection.populate("batch_add_to_allowlist", [params.addresses.slice(i, i + CHUNK)]));
1915
1913
  }
1916
1914
  const res = await account.execute(calls);
1917
1915
  return { txHash: res.transaction_hash };
1918
1916
  }
1919
1917
  async removeFromAllowlist(account, params) {
1920
- const collection = new starknet.Contract(POPCollectionABI, normalizeAddress(params.collection), account);
1921
- const call = collection.populate("remove_from_allowlist", [params.address]);
1918
+ const call = this._collection(params.collection, account).populate("remove_from_allowlist", [params.address]);
1922
1919
  const res = await account.execute([call]);
1923
1920
  return { txHash: res.transaction_hash };
1924
1921
  }
1925
1922
  async setTokenUri(account, params) {
1926
- const collection = new starknet.Contract(POPCollectionABI, normalizeAddress(params.collection), account);
1927
- const call = collection.populate("set_token_uri", [BigInt(params.tokenId), params.uri]);
1923
+ const call = this._collection(params.collection, account).populate("set_token_uri", [
1924
+ BigInt(params.tokenId),
1925
+ params.uri
1926
+ ]);
1928
1927
  const res = await account.execute([call]);
1929
1928
  return { txHash: res.transaction_hash };
1930
1929
  }
1931
1930
  async setPaused(account, params) {
1932
- const collection = new starknet.Contract(POPCollectionABI, normalizeAddress(params.collection), account);
1933
- const call = collection.populate("set_paused", [params.paused]);
1931
+ const call = this._collection(params.collection, account).populate("set_paused", [params.paused]);
1934
1932
  const res = await account.execute([call]);
1935
1933
  return { txHash: res.transaction_hash };
1936
1934
  }
1937
1935
  async createCollection(account, params) {
1938
1936
  const factory = new starknet.Contract(POPFactoryABI, this.factoryAddress, account);
1939
- const eventTypeVariant = { [params.eventType]: {} };
1940
1937
  const call = factory.populate("create_collection", [
1941
1938
  params.name,
1942
1939
  params.symbol,
1943
1940
  params.baseUri,
1944
1941
  params.claimEndTime,
1945
- eventTypeVariant
1942
+ { [params.eventType]: {} }
1946
1943
  ]);
1947
1944
  const res = await account.execute([call]);
1948
1945
  return { txHash: res.transaction_hash };
1949
1946
  }
1950
1947
  };
1951
- var DROP_FACTORY_MAINNET = "0x03587f42e29daee1b193f6cf83bf8627908ed6632d0d83fcb26225c50547d800";
1952
1948
  function toContractConditions(c) {
1953
1949
  return {
1954
1950
  start_time: c.startTime,
@@ -1960,17 +1956,18 @@ function toContractConditions(c) {
1960
1956
  }
1961
1957
  var DropService = class {
1962
1958
  constructor(_config) {
1963
- this.factoryAddress = DROP_FACTORY_MAINNET;
1959
+ this.factoryAddress = DROP_FACTORY_CONTRACT_MAINNET;
1960
+ }
1961
+ _collection(address, account) {
1962
+ return new starknet.Contract(DropCollectionABI, normalizeAddress(address), account);
1964
1963
  }
1965
1964
  async claim(account, collectionAddress, quantity = 1) {
1966
- const collection = new starknet.Contract(DropCollectionABI, normalizeAddress(collectionAddress), account);
1967
- const call = collection.populate("claim", [BigInt(quantity)]);
1965
+ const call = this._collection(collectionAddress, account).populate("claim", [BigInt(quantity)]);
1968
1966
  const res = await account.execute([call]);
1969
1967
  return { txHash: res.transaction_hash };
1970
1968
  }
1971
1969
  async adminMint(account, params) {
1972
- const collection = new starknet.Contract(DropCollectionABI, normalizeAddress(params.collection), account);
1973
- const call = collection.populate("admin_mint", [
1970
+ const call = this._collection(params.collection, account).populate("admin_mint", [
1974
1971
  params.recipient,
1975
1972
  BigInt(params.quantity ?? 1),
1976
1973
  params.customUri ?? ""
@@ -1979,43 +1976,39 @@ var DropService = class {
1979
1976
  return { txHash: res.transaction_hash };
1980
1977
  }
1981
1978
  async setClaimConditions(account, params) {
1982
- const collection = new starknet.Contract(DropCollectionABI, normalizeAddress(params.collection), account);
1983
- const call = collection.populate("set_claim_conditions", [toContractConditions(params.conditions)]);
1979
+ const call = this._collection(params.collection, account).populate("set_claim_conditions", [
1980
+ toContractConditions(params.conditions)
1981
+ ]);
1984
1982
  const res = await account.execute([call]);
1985
1983
  return { txHash: res.transaction_hash };
1986
1984
  }
1987
1985
  async setAllowlistEnabled(account, params) {
1988
- const collection = new starknet.Contract(DropCollectionABI, normalizeAddress(params.collection), account);
1989
- const call = collection.populate("set_allowlist_enabled", [params.enabled]);
1986
+ const call = this._collection(params.collection, account).populate("set_allowlist_enabled", [params.enabled]);
1990
1987
  const res = await account.execute([call]);
1991
1988
  return { txHash: res.transaction_hash };
1992
1989
  }
1993
1990
  async addToAllowlist(account, params) {
1994
- const collection = new starknet.Contract(DropCollectionABI, normalizeAddress(params.collection), account);
1995
- const call = collection.populate("add_to_allowlist", [params.address]);
1991
+ const call = this._collection(params.collection, account).populate("add_to_allowlist", [params.address]);
1996
1992
  const res = await account.execute([call]);
1997
1993
  return { txHash: res.transaction_hash };
1998
1994
  }
1999
1995
  async batchAddToAllowlist(account, params) {
2000
- const collection = new starknet.Contract(DropCollectionABI, normalizeAddress(params.collection), account);
1996
+ const collection = this._collection(params.collection, account);
2001
1997
  const CHUNK = 200;
2002
1998
  const calls = [];
2003
1999
  for (let i = 0; i < params.addresses.length; i += CHUNK) {
2004
- const chunk = params.addresses.slice(i, i + CHUNK);
2005
- calls.push(collection.populate("batch_add_to_allowlist", [chunk]));
2000
+ calls.push(collection.populate("batch_add_to_allowlist", [params.addresses.slice(i, i + CHUNK)]));
2006
2001
  }
2007
2002
  const res = await account.execute(calls);
2008
2003
  return { txHash: res.transaction_hash };
2009
2004
  }
2010
2005
  async setPaused(account, params) {
2011
- const collection = new starknet.Contract(DropCollectionABI, normalizeAddress(params.collection), account);
2012
- const call = collection.populate("set_paused", [params.paused]);
2006
+ const call = this._collection(params.collection, account).populate("set_paused", [params.paused]);
2013
2007
  const res = await account.execute([call]);
2014
2008
  return { txHash: res.transaction_hash };
2015
2009
  }
2016
2010
  async withdrawPayments(account, params) {
2017
- const collection = new starknet.Contract(DropCollectionABI, normalizeAddress(params.collection), account);
2018
- const call = collection.populate("withdraw_payments", []);
2011
+ const call = this._collection(params.collection, account).populate("withdraw_payments", []);
2019
2012
  const res = await account.execute([call]);
2020
2013
  return { txHash: res.transaction_hash };
2021
2014
  }