@medialane/sdk 0.7.0 → 0.7.1

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.cjs CHANGED
@@ -49,8 +49,8 @@ var SUPPORTED_NETWORKS = ["mainnet"];
49
49
  var DEFAULT_RPC_URL = "https://rpc.starknet.lava.build";
50
50
  var POP_COLLECTION_CLASS_HASH_MAINNET = "0x077c421686f10851872561953ea16898d933364b7f8937a5d7e2b1ba0a36263f";
51
51
  var DROP_COLLECTION_CLASS_HASH_MAINNET = "0x00092e72cdb63067521e803aaf7d4101c3e3ce026ae6bc045ec4228027e58282";
52
- var ERC1155_FACTORY_CONTRACT_MAINNET = "0x0459a9a3c04be5d884a038744f977dff019897264d4a281f9e0f87af417b3bec";
53
- var ERC1155_COLLECTION_CLASS_HASH_MAINNET = "0x02da5e81be7a1ca493b9441522c450f8ff4c54b14ec16a0c2349f5e6e6fdc5d7";
52
+ var ERC1155_FACTORY_CONTRACT_MAINNET = "0x006b2dc7ca7c4f466bb4575ba043d934310f052074f849caf853a86bcb819fd6";
53
+ var ERC1155_COLLECTION_CLASS_HASH_MAINNET = "0x39a85126c6627db263617e5bce2bb72e49d2bb1f20961efc8b8954665bcfd25";
54
54
 
55
55
  // src/config.ts
56
56
  var MedialaneConfigSchema = zod.z.object({
@@ -1735,11 +1735,19 @@ var IPCollection1155FactoryABI = [
1735
1735
  name: "deploy_collection",
1736
1736
  inputs: [
1737
1737
  { name: "name", type: "core::byte_array::ByteArray" },
1738
- { name: "symbol", type: "core::byte_array::ByteArray" }
1738
+ { name: "symbol", type: "core::byte_array::ByteArray" },
1739
+ { name: "base_uri", type: "core::byte_array::ByteArray" }
1739
1740
  ],
1740
1741
  outputs: [{ type: "core::starknet::contract_address::ContractAddress" }],
1741
1742
  state_mutability: "external"
1742
1743
  },
1744
+ {
1745
+ type: "function",
1746
+ name: "update_collection_class_hash",
1747
+ inputs: [{ name: "new_class_hash", type: "core::starknet::class_hash::ClassHash" }],
1748
+ outputs: [],
1749
+ state_mutability: "external"
1750
+ },
1743
1751
  {
1744
1752
  type: "function",
1745
1753
  name: "owner",
@@ -1749,6 +1757,36 @@ var IPCollection1155FactoryABI = [
1749
1757
  }
1750
1758
  ];
1751
1759
  var IPCollection1155ABI = [
1760
+ // ── Metadata views ──────────────────────────────────────────────────────────
1761
+ {
1762
+ type: "function",
1763
+ name: "name",
1764
+ inputs: [],
1765
+ outputs: [{ type: "core::byte_array::ByteArray" }],
1766
+ state_mutability: "view"
1767
+ },
1768
+ {
1769
+ type: "function",
1770
+ name: "symbol",
1771
+ inputs: [],
1772
+ outputs: [{ type: "core::byte_array::ByteArray" }],
1773
+ state_mutability: "view"
1774
+ },
1775
+ {
1776
+ type: "function",
1777
+ name: "base_uri",
1778
+ inputs: [],
1779
+ outputs: [{ type: "core::byte_array::ByteArray" }],
1780
+ state_mutability: "view"
1781
+ },
1782
+ {
1783
+ type: "function",
1784
+ name: "uri",
1785
+ inputs: [{ name: "token_id", type: "core::integer::u256" }],
1786
+ outputs: [{ type: "core::byte_array::ByteArray" }],
1787
+ state_mutability: "view"
1788
+ },
1789
+ // ── Minting ─────────────────────────────────────────────────────────────────
1752
1790
  {
1753
1791
  type: "function",
1754
1792
  name: "mint_item",
@@ -1773,13 +1811,7 @@ var IPCollection1155ABI = [
1773
1811
  outputs: [],
1774
1812
  state_mutability: "external"
1775
1813
  },
1776
- {
1777
- type: "function",
1778
- name: "uri",
1779
- inputs: [{ name: "token_id", type: "core::integer::u256" }],
1780
- outputs: [{ type: "core::byte_array::ByteArray" }],
1781
- state_mutability: "view"
1782
- },
1814
+ // ── Provenance queries ───────────────────────────────────────────────────────
1783
1815
  {
1784
1816
  type: "function",
1785
1817
  name: "get_collection_creator",
@@ -1794,6 +1826,14 @@ var IPCollection1155ABI = [
1794
1826
  outputs: [{ type: "core::starknet::contract_address::ContractAddress" }],
1795
1827
  state_mutability: "view"
1796
1828
  },
1829
+ {
1830
+ type: "function",
1831
+ name: "get_token_registered_at",
1832
+ inputs: [{ name: "token_id", type: "core::integer::u256" }],
1833
+ outputs: [{ type: "core::integer::u64" }],
1834
+ state_mutability: "view"
1835
+ },
1836
+ // ── Ownership ────────────────────────────────────────────────────────────────
1797
1837
  {
1798
1838
  type: "function",
1799
1839
  name: "owner",
@@ -1801,6 +1841,7 @@ var IPCollection1155ABI = [
1801
1841
  outputs: [{ type: "core::starknet::contract_address::ContractAddress" }],
1802
1842
  state_mutability: "view"
1803
1843
  },
1844
+ // ── ERC-1155 standard ────────────────────────────────────────────────────────
1804
1845
  {
1805
1846
  type: "function",
1806
1847
  name: "balance_of",
@@ -1831,15 +1872,54 @@ var IPCollection1155ABI = [
1831
1872
  outputs: [{ type: "core::bool" }],
1832
1873
  state_mutability: "view"
1833
1874
  },
1875
+ // ── ERC-2981 royalties ───────────────────────────────────────────────────────
1834
1876
  {
1835
1877
  type: "function",
1836
- name: "set_royalty",
1878
+ name: "royalty_info",
1879
+ inputs: [
1880
+ { name: "token_id", type: "core::integer::u256" },
1881
+ { name: "sale_price", type: "core::integer::u256" }
1882
+ ],
1883
+ outputs: [
1884
+ { type: "core::starknet::contract_address::ContractAddress" },
1885
+ { type: "core::integer::u256" }
1886
+ ],
1887
+ state_mutability: "view"
1888
+ },
1889
+ {
1890
+ type: "function",
1891
+ name: "set_default_royalty",
1837
1892
  inputs: [
1838
1893
  { name: "receiver", type: "core::starknet::contract_address::ContractAddress" },
1839
1894
  { name: "fee_numerator", type: "core::integer::u128" }
1840
1895
  ],
1841
1896
  outputs: [],
1842
1897
  state_mutability: "external"
1898
+ },
1899
+ {
1900
+ type: "function",
1901
+ name: "set_token_royalty",
1902
+ inputs: [
1903
+ { name: "token_id", type: "core::integer::u256" },
1904
+ { name: "receiver", type: "core::starknet::contract_address::ContractAddress" },
1905
+ { name: "fee_numerator", type: "core::integer::u128" }
1906
+ ],
1907
+ outputs: [],
1908
+ state_mutability: "external"
1909
+ },
1910
+ {
1911
+ type: "function",
1912
+ name: "delete_default_royalty",
1913
+ inputs: [],
1914
+ outputs: [],
1915
+ state_mutability: "external"
1916
+ },
1917
+ {
1918
+ type: "function",
1919
+ name: "reset_token_royalty",
1920
+ inputs: [{ name: "token_id", type: "core::integer::u256" }],
1921
+ outputs: [],
1922
+ state_mutability: "external"
1843
1923
  }
1844
1924
  ];
1845
1925
 
@@ -3317,7 +3397,7 @@ var ERC1155CollectionService = class {
3317
3397
  */
3318
3398
  async deployCollection(account, params) {
3319
3399
  const factory = this._factory(account);
3320
- const call = factory.populate("deploy_collection", [params.name, params.symbol]);
3400
+ const call = factory.populate("deploy_collection", [params.name, params.symbol, params.baseUri]);
3321
3401
  const res = await account.execute([call]);
3322
3402
  return { txHash: res.transaction_hash };
3323
3403
  }
@@ -3357,13 +3437,27 @@ var ERC1155CollectionService = class {
3357
3437
  return { txHash: res.transaction_hash };
3358
3438
  }
3359
3439
  /**
3360
- * Set ERC-2981 royalties for the collection.
3440
+ * Set the default ERC-2981 royalty for the entire collection.
3361
3441
  * `feeNumerator` is out of 10 000 (e.g. 500 = 5%).
3362
3442
  * Caller must be the collection owner.
3363
3443
  */
3364
- async setRoyalty(account, params) {
3444
+ async setDefaultRoyalty(account, params) {
3365
3445
  const collection = this._collection(params.collection, account);
3366
- const call = collection.populate("set_royalty", [
3446
+ const call = collection.populate("set_default_royalty", [
3447
+ params.receiver,
3448
+ BigInt(params.feeNumerator)
3449
+ ]);
3450
+ const res = await account.execute([call]);
3451
+ return { txHash: res.transaction_hash };
3452
+ }
3453
+ /**
3454
+ * Set a per-token ERC-2981 royalty override.
3455
+ * `feeNumerator` is out of 10 000. Caller must be the collection owner.
3456
+ */
3457
+ async setTokenRoyalty(account, params) {
3458
+ const collection = this._collection(params.collection, account);
3459
+ const call = collection.populate("set_token_royalty", [
3460
+ BigInt(params.tokenId),
3367
3461
  params.receiver,
3368
3462
  BigInt(params.feeNumerator)
3369
3463
  ]);