@medialane/sdk 0.33.0 → 0.35.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.cjs +171 -235
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +115 -162
- package/dist/index.d.ts +115 -162
- package/dist/index.js +170 -237
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { cairo, num,
|
|
2
|
+
import { Contract, hash, cairo, num, uint256, RpcProvider, TypedDataRevision, shortString, constants } from 'starknet';
|
|
3
3
|
|
|
4
4
|
// src/config.ts
|
|
5
5
|
|
|
@@ -55,10 +55,10 @@ var SUPPORTED_NETWORKS = ["mainnet"];
|
|
|
55
55
|
var DEFAULT_RPC_URL = "https://rpc.starknet.lava.build";
|
|
56
56
|
var POP_COLLECTION_CLASS_HASH_MAINNET = "0x077c421686f10851872561953ea16898d933364b7f8937a5d7e2b1ba0a36263f";
|
|
57
57
|
var DROP_COLLECTION_CLASS_HASH_MAINNET = "0x00092e72cdb63067521e803aaf7d4101c3e3ce026ae6bc045ec4228027e58282";
|
|
58
|
-
var COLLECTION_1155_CONTRACT_MAINNET = "
|
|
59
|
-
var COLLECTION_1155_FACTORY_CLASS_HASH_MAINNET = "
|
|
60
|
-
var COLLECTION_1155_CLASS_HASH_MAINNET = "
|
|
61
|
-
var COLLECTION_1155_START_BLOCK_MAINNET =
|
|
58
|
+
var COLLECTION_1155_CONTRACT_MAINNET = "0x0083543c3ee15040a419fc539fa6889f5b956e7d071bcfa97842cb0ae42ad6cc";
|
|
59
|
+
var COLLECTION_1155_FACTORY_CLASS_HASH_MAINNET = "0x331a69da8655a882ba1fbcb55188b8fa09116521db901bbbaafc9fead0689f8";
|
|
60
|
+
var COLLECTION_1155_CLASS_HASH_MAINNET = "0x4e110b59af240ae6c7742999964c4eae13fb2ed935c47fe97653ec017ebea34";
|
|
61
|
+
var COLLECTION_1155_START_BLOCK_MAINNET = 10665319;
|
|
62
62
|
var CREATOR_COIN_FACTORY_CONTRACT_MAINNET = "0x50fa807b5274079fb19374673d7bab6d2dc3af7e1032ea43eb6e44bcbde4c3c";
|
|
63
63
|
var CREATOR_COIN_EKUBO_LAUNCHER_MAINNET = "0x4f7fceb5ac10f12f9544a09580592e5bdf1b7f04f48765eecf12286d8ccb7b4";
|
|
64
64
|
var CREATOR_COIN_CLASS_HASH_MAINNET = "0x743e4c8a5b96bb83bbf4af04edbbb482d5ece89eed9b729a79fb7df0cd0b6b6";
|
|
@@ -1700,18 +1700,6 @@ var IPCollection1155FactoryABI = [
|
|
|
1700
1700
|
],
|
|
1701
1701
|
"state_mutability": "view"
|
|
1702
1702
|
},
|
|
1703
|
-
{
|
|
1704
|
-
"type": "function",
|
|
1705
|
-
"name": "update_collection_class_hash",
|
|
1706
|
-
"inputs": [
|
|
1707
|
-
{
|
|
1708
|
-
"name": "new_class_hash",
|
|
1709
|
-
"type": "core::starknet::class_hash::ClassHash"
|
|
1710
|
-
}
|
|
1711
|
-
],
|
|
1712
|
-
"outputs": [],
|
|
1713
|
-
"state_mutability": "external"
|
|
1714
|
-
},
|
|
1715
1703
|
{
|
|
1716
1704
|
"type": "function",
|
|
1717
1705
|
"name": "deploy_collection",
|
|
@@ -1738,131 +1726,16 @@ var IPCollection1155FactoryABI = [
|
|
|
1738
1726
|
}
|
|
1739
1727
|
]
|
|
1740
1728
|
},
|
|
1741
|
-
{
|
|
1742
|
-
"type": "impl",
|
|
1743
|
-
"name": "OwnableMixinImpl",
|
|
1744
|
-
"interface_name": "openzeppelin_access::ownable::interface::OwnableABI"
|
|
1745
|
-
},
|
|
1746
|
-
{
|
|
1747
|
-
"type": "interface",
|
|
1748
|
-
"name": "openzeppelin_access::ownable::interface::OwnableABI",
|
|
1749
|
-
"items": [
|
|
1750
|
-
{
|
|
1751
|
-
"type": "function",
|
|
1752
|
-
"name": "owner",
|
|
1753
|
-
"inputs": [],
|
|
1754
|
-
"outputs": [
|
|
1755
|
-
{
|
|
1756
|
-
"type": "core::starknet::contract_address::ContractAddress"
|
|
1757
|
-
}
|
|
1758
|
-
],
|
|
1759
|
-
"state_mutability": "view"
|
|
1760
|
-
},
|
|
1761
|
-
{
|
|
1762
|
-
"type": "function",
|
|
1763
|
-
"name": "transfer_ownership",
|
|
1764
|
-
"inputs": [
|
|
1765
|
-
{
|
|
1766
|
-
"name": "new_owner",
|
|
1767
|
-
"type": "core::starknet::contract_address::ContractAddress"
|
|
1768
|
-
}
|
|
1769
|
-
],
|
|
1770
|
-
"outputs": [],
|
|
1771
|
-
"state_mutability": "external"
|
|
1772
|
-
},
|
|
1773
|
-
{
|
|
1774
|
-
"type": "function",
|
|
1775
|
-
"name": "renounce_ownership",
|
|
1776
|
-
"inputs": [],
|
|
1777
|
-
"outputs": [],
|
|
1778
|
-
"state_mutability": "external"
|
|
1779
|
-
},
|
|
1780
|
-
{
|
|
1781
|
-
"type": "function",
|
|
1782
|
-
"name": "transferOwnership",
|
|
1783
|
-
"inputs": [
|
|
1784
|
-
{
|
|
1785
|
-
"name": "newOwner",
|
|
1786
|
-
"type": "core::starknet::contract_address::ContractAddress"
|
|
1787
|
-
}
|
|
1788
|
-
],
|
|
1789
|
-
"outputs": [],
|
|
1790
|
-
"state_mutability": "external"
|
|
1791
|
-
},
|
|
1792
|
-
{
|
|
1793
|
-
"type": "function",
|
|
1794
|
-
"name": "renounceOwnership",
|
|
1795
|
-
"inputs": [],
|
|
1796
|
-
"outputs": [],
|
|
1797
|
-
"state_mutability": "external"
|
|
1798
|
-
}
|
|
1799
|
-
]
|
|
1800
|
-
},
|
|
1801
1729
|
{
|
|
1802
1730
|
"type": "constructor",
|
|
1803
1731
|
"name": "constructor",
|
|
1804
1732
|
"inputs": [
|
|
1805
|
-
{
|
|
1806
|
-
"name": "owner",
|
|
1807
|
-
"type": "core::starknet::contract_address::ContractAddress"
|
|
1808
|
-
},
|
|
1809
1733
|
{
|
|
1810
1734
|
"name": "collection_class_hash",
|
|
1811
1735
|
"type": "core::starknet::class_hash::ClassHash"
|
|
1812
1736
|
}
|
|
1813
1737
|
]
|
|
1814
1738
|
},
|
|
1815
|
-
{
|
|
1816
|
-
"type": "event",
|
|
1817
|
-
"name": "openzeppelin_access::ownable::ownable::OwnableComponent::OwnershipTransferred",
|
|
1818
|
-
"kind": "struct",
|
|
1819
|
-
"members": [
|
|
1820
|
-
{
|
|
1821
|
-
"name": "previous_owner",
|
|
1822
|
-
"type": "core::starknet::contract_address::ContractAddress",
|
|
1823
|
-
"kind": "key"
|
|
1824
|
-
},
|
|
1825
|
-
{
|
|
1826
|
-
"name": "new_owner",
|
|
1827
|
-
"type": "core::starknet::contract_address::ContractAddress",
|
|
1828
|
-
"kind": "key"
|
|
1829
|
-
}
|
|
1830
|
-
]
|
|
1831
|
-
},
|
|
1832
|
-
{
|
|
1833
|
-
"type": "event",
|
|
1834
|
-
"name": "openzeppelin_access::ownable::ownable::OwnableComponent::OwnershipTransferStarted",
|
|
1835
|
-
"kind": "struct",
|
|
1836
|
-
"members": [
|
|
1837
|
-
{
|
|
1838
|
-
"name": "previous_owner",
|
|
1839
|
-
"type": "core::starknet::contract_address::ContractAddress",
|
|
1840
|
-
"kind": "key"
|
|
1841
|
-
},
|
|
1842
|
-
{
|
|
1843
|
-
"name": "new_owner",
|
|
1844
|
-
"type": "core::starknet::contract_address::ContractAddress",
|
|
1845
|
-
"kind": "key"
|
|
1846
|
-
}
|
|
1847
|
-
]
|
|
1848
|
-
},
|
|
1849
|
-
{
|
|
1850
|
-
"type": "event",
|
|
1851
|
-
"name": "openzeppelin_access::ownable::ownable::OwnableComponent::Event",
|
|
1852
|
-
"kind": "enum",
|
|
1853
|
-
"variants": [
|
|
1854
|
-
{
|
|
1855
|
-
"name": "OwnershipTransferred",
|
|
1856
|
-
"type": "openzeppelin_access::ownable::ownable::OwnableComponent::OwnershipTransferred",
|
|
1857
|
-
"kind": "nested"
|
|
1858
|
-
},
|
|
1859
|
-
{
|
|
1860
|
-
"name": "OwnershipTransferStarted",
|
|
1861
|
-
"type": "openzeppelin_access::ownable::ownable::OwnableComponent::OwnershipTransferStarted",
|
|
1862
|
-
"kind": "nested"
|
|
1863
|
-
}
|
|
1864
|
-
]
|
|
1865
|
-
},
|
|
1866
1739
|
{
|
|
1867
1740
|
"type": "event",
|
|
1868
1741
|
"name": "ip_programmable_erc1155_collections::IPCollectionFactory::IPCollectionFactory::CollectionDeployed",
|
|
@@ -1895,42 +1768,15 @@ var IPCollection1155FactoryABI = [
|
|
|
1895
1768
|
}
|
|
1896
1769
|
]
|
|
1897
1770
|
},
|
|
1898
|
-
{
|
|
1899
|
-
"type": "event",
|
|
1900
|
-
"name": "ip_programmable_erc1155_collections::IPCollectionFactory::IPCollectionFactory::CollectionClassHashUpdated",
|
|
1901
|
-
"kind": "struct",
|
|
1902
|
-
"members": [
|
|
1903
|
-
{
|
|
1904
|
-
"name": "previous_class_hash",
|
|
1905
|
-
"type": "core::starknet::class_hash::ClassHash",
|
|
1906
|
-
"kind": "data"
|
|
1907
|
-
},
|
|
1908
|
-
{
|
|
1909
|
-
"name": "new_class_hash",
|
|
1910
|
-
"type": "core::starknet::class_hash::ClassHash",
|
|
1911
|
-
"kind": "data"
|
|
1912
|
-
}
|
|
1913
|
-
]
|
|
1914
|
-
},
|
|
1915
1771
|
{
|
|
1916
1772
|
"type": "event",
|
|
1917
1773
|
"name": "ip_programmable_erc1155_collections::IPCollectionFactory::IPCollectionFactory::Event",
|
|
1918
1774
|
"kind": "enum",
|
|
1919
1775
|
"variants": [
|
|
1920
|
-
{
|
|
1921
|
-
"name": "OwnableEvent",
|
|
1922
|
-
"type": "openzeppelin_access::ownable::ownable::OwnableComponent::Event",
|
|
1923
|
-
"kind": "flat"
|
|
1924
|
-
},
|
|
1925
1776
|
{
|
|
1926
1777
|
"name": "CollectionDeployed",
|
|
1927
1778
|
"type": "ip_programmable_erc1155_collections::IPCollectionFactory::IPCollectionFactory::CollectionDeployed",
|
|
1928
1779
|
"kind": "nested"
|
|
1929
|
-
},
|
|
1930
|
-
{
|
|
1931
|
-
"name": "CollectionClassHashUpdated",
|
|
1932
|
-
"type": "ip_programmable_erc1155_collections::IPCollectionFactory::IPCollectionFactory::CollectionClassHashUpdated",
|
|
1933
|
-
"kind": "nested"
|
|
1934
1780
|
}
|
|
1935
1781
|
]
|
|
1936
1782
|
}
|
|
@@ -2034,6 +1880,20 @@ var IPCollection1155ABI = [
|
|
|
2034
1880
|
}
|
|
2035
1881
|
]
|
|
2036
1882
|
},
|
|
1883
|
+
{
|
|
1884
|
+
"type": "enum",
|
|
1885
|
+
"name": "core::bool",
|
|
1886
|
+
"variants": [
|
|
1887
|
+
{
|
|
1888
|
+
"name": "False",
|
|
1889
|
+
"type": "()"
|
|
1890
|
+
},
|
|
1891
|
+
{
|
|
1892
|
+
"name": "True",
|
|
1893
|
+
"type": "()"
|
|
1894
|
+
}
|
|
1895
|
+
]
|
|
1896
|
+
},
|
|
2037
1897
|
{
|
|
2038
1898
|
"type": "interface",
|
|
2039
1899
|
"name": "ip_programmable_erc1155_collections::interfaces::IIPCollection::IIPCollection",
|
|
@@ -2084,16 +1944,12 @@ var IPCollection1155ABI = [
|
|
|
2084
1944
|
},
|
|
2085
1945
|
{
|
|
2086
1946
|
"type": "function",
|
|
2087
|
-
"name": "
|
|
1947
|
+
"name": "mint_edition",
|
|
2088
1948
|
"inputs": [
|
|
2089
1949
|
{
|
|
2090
1950
|
"name": "to",
|
|
2091
1951
|
"type": "core::starknet::contract_address::ContractAddress"
|
|
2092
1952
|
},
|
|
2093
|
-
{
|
|
2094
|
-
"name": "token_id",
|
|
2095
|
-
"type": "core::integer::u256"
|
|
2096
|
-
},
|
|
2097
1953
|
{
|
|
2098
1954
|
"name": "value",
|
|
2099
1955
|
"type": "core::integer::u256"
|
|
@@ -2103,21 +1959,21 @@ var IPCollection1155ABI = [
|
|
|
2103
1959
|
"type": "core::byte_array::ByteArray"
|
|
2104
1960
|
}
|
|
2105
1961
|
],
|
|
2106
|
-
"outputs": [
|
|
1962
|
+
"outputs": [
|
|
1963
|
+
{
|
|
1964
|
+
"type": "core::integer::u256"
|
|
1965
|
+
}
|
|
1966
|
+
],
|
|
2107
1967
|
"state_mutability": "external"
|
|
2108
1968
|
},
|
|
2109
1969
|
{
|
|
2110
1970
|
"type": "function",
|
|
2111
|
-
"name": "
|
|
1971
|
+
"name": "batch_mint_edition",
|
|
2112
1972
|
"inputs": [
|
|
2113
1973
|
{
|
|
2114
1974
|
"name": "to",
|
|
2115
1975
|
"type": "core::starknet::contract_address::ContractAddress"
|
|
2116
1976
|
},
|
|
2117
|
-
{
|
|
2118
|
-
"name": "token_ids",
|
|
2119
|
-
"type": "core::array::Span::<core::integer::u256>"
|
|
2120
|
-
},
|
|
2121
1977
|
{
|
|
2122
1978
|
"name": "values",
|
|
2123
1979
|
"type": "core::array::Span::<core::integer::u256>"
|
|
@@ -2127,6 +1983,30 @@ var IPCollection1155ABI = [
|
|
|
2127
1983
|
"type": "core::array::Array::<core::byte_array::ByteArray>"
|
|
2128
1984
|
}
|
|
2129
1985
|
],
|
|
1986
|
+
"outputs": [
|
|
1987
|
+
{
|
|
1988
|
+
"type": "core::array::Span::<core::integer::u256>"
|
|
1989
|
+
}
|
|
1990
|
+
],
|
|
1991
|
+
"state_mutability": "external"
|
|
1992
|
+
},
|
|
1993
|
+
{
|
|
1994
|
+
"type": "function",
|
|
1995
|
+
"name": "add_supply",
|
|
1996
|
+
"inputs": [
|
|
1997
|
+
{
|
|
1998
|
+
"name": "to",
|
|
1999
|
+
"type": "core::starknet::contract_address::ContractAddress"
|
|
2000
|
+
},
|
|
2001
|
+
{
|
|
2002
|
+
"name": "token_id",
|
|
2003
|
+
"type": "core::integer::u256"
|
|
2004
|
+
},
|
|
2005
|
+
{
|
|
2006
|
+
"name": "value",
|
|
2007
|
+
"type": "core::integer::u256"
|
|
2008
|
+
}
|
|
2009
|
+
],
|
|
2130
2010
|
"outputs": [],
|
|
2131
2011
|
"state_mutability": "external"
|
|
2132
2012
|
},
|
|
@@ -2188,6 +2068,33 @@ var IPCollection1155ABI = [
|
|
|
2188
2068
|
}
|
|
2189
2069
|
],
|
|
2190
2070
|
"state_mutability": "view"
|
|
2071
|
+
},
|
|
2072
|
+
{
|
|
2073
|
+
"type": "function",
|
|
2074
|
+
"name": "total_editions",
|
|
2075
|
+
"inputs": [],
|
|
2076
|
+
"outputs": [
|
|
2077
|
+
{
|
|
2078
|
+
"type": "core::integer::u256"
|
|
2079
|
+
}
|
|
2080
|
+
],
|
|
2081
|
+
"state_mutability": "view"
|
|
2082
|
+
},
|
|
2083
|
+
{
|
|
2084
|
+
"type": "function",
|
|
2085
|
+
"name": "token_exists",
|
|
2086
|
+
"inputs": [
|
|
2087
|
+
{
|
|
2088
|
+
"name": "token_id",
|
|
2089
|
+
"type": "core::integer::u256"
|
|
2090
|
+
}
|
|
2091
|
+
],
|
|
2092
|
+
"outputs": [
|
|
2093
|
+
{
|
|
2094
|
+
"type": "core::bool"
|
|
2095
|
+
}
|
|
2096
|
+
],
|
|
2097
|
+
"state_mutability": "view"
|
|
2191
2098
|
}
|
|
2192
2099
|
]
|
|
2193
2100
|
},
|
|
@@ -2256,20 +2163,6 @@ var IPCollection1155ABI = [
|
|
|
2256
2163
|
"name": "SRC5Impl",
|
|
2257
2164
|
"interface_name": "openzeppelin_introspection::interface::ISRC5"
|
|
2258
2165
|
},
|
|
2259
|
-
{
|
|
2260
|
-
"type": "enum",
|
|
2261
|
-
"name": "core::bool",
|
|
2262
|
-
"variants": [
|
|
2263
|
-
{
|
|
2264
|
-
"name": "False",
|
|
2265
|
-
"type": "()"
|
|
2266
|
-
},
|
|
2267
|
-
{
|
|
2268
|
-
"name": "True",
|
|
2269
|
-
"type": "()"
|
|
2270
|
-
}
|
|
2271
|
-
]
|
|
2272
|
-
},
|
|
2273
2166
|
{
|
|
2274
2167
|
"type": "interface",
|
|
2275
2168
|
"name": "openzeppelin_introspection::interface::ISRC5",
|
|
@@ -5502,12 +5395,12 @@ function normalizeAddress(address) {
|
|
|
5502
5395
|
throw new Error(`Invalid Starknet address: "${address}"`);
|
|
5503
5396
|
}
|
|
5504
5397
|
}
|
|
5505
|
-
function normalizeHash(
|
|
5398
|
+
function normalizeHash(hash2) {
|
|
5506
5399
|
try {
|
|
5507
|
-
const hex = num.toHex(BigInt(
|
|
5400
|
+
const hex = num.toHex(BigInt(hash2));
|
|
5508
5401
|
return "0x" + hex.slice(2).padStart(64, "0").toLowerCase();
|
|
5509
5402
|
} catch {
|
|
5510
|
-
throw new Error(`Invalid Starknet hash: "${
|
|
5403
|
+
throw new Error(`Invalid Starknet hash: "${hash2}"`);
|
|
5511
5404
|
}
|
|
5512
5405
|
}
|
|
5513
5406
|
function shortenAddress(address, chars = 4) {
|
|
@@ -6301,15 +6194,15 @@ var ERC1155CollectionService = class {
|
|
|
6301
6194
|
return { txHash: res.transaction_hash };
|
|
6302
6195
|
}
|
|
6303
6196
|
/**
|
|
6304
|
-
* Mint a
|
|
6305
|
-
* Caller must be the collection owner.
|
|
6306
|
-
*
|
|
6197
|
+
* Mint a new edition into an existing ERC-1155 collection.
|
|
6198
|
+
* Caller must be the collection owner. The token id is assigned on-chain
|
|
6199
|
+
* (sequential from 1) — read it from the `IPMinted` event of the returned tx.
|
|
6200
|
+
* The `tokenUri` is immutable.
|
|
6307
6201
|
*/
|
|
6308
|
-
async
|
|
6202
|
+
async mintEdition(account, params) {
|
|
6309
6203
|
const collection = this._collection(params.collection, account);
|
|
6310
|
-
const call = collection.populate("
|
|
6204
|
+
const call = collection.populate("mint_edition", [
|
|
6311
6205
|
params.to,
|
|
6312
|
-
BigInt(params.tokenId),
|
|
6313
6206
|
BigInt(params.value),
|
|
6314
6207
|
params.tokenUri
|
|
6315
6208
|
]);
|
|
@@ -6317,24 +6210,37 @@ var ERC1155CollectionService = class {
|
|
|
6317
6210
|
return { txHash: res.transaction_hash };
|
|
6318
6211
|
}
|
|
6319
6212
|
/**
|
|
6320
|
-
* Batch-mint multiple
|
|
6321
|
-
* All
|
|
6322
|
-
* Caller must be the collection owner.
|
|
6213
|
+
* Batch-mint multiple new editions into an existing ERC-1155 collection.
|
|
6214
|
+
* All editions go to the same `to` address; ids are assigned sequentially
|
|
6215
|
+
* on-chain. Caller must be the collection owner.
|
|
6323
6216
|
*/
|
|
6324
|
-
async
|
|
6217
|
+
async batchMintEdition(account, params) {
|
|
6325
6218
|
const collection = this._collection(params.collection, account);
|
|
6326
|
-
const tokenIds = params.items.map((i) => BigInt(i.tokenId));
|
|
6327
6219
|
const values = params.items.map((i) => BigInt(i.value));
|
|
6328
6220
|
const tokenUris = params.items.map((i) => i.tokenUri);
|
|
6329
|
-
const call = collection.populate("
|
|
6221
|
+
const call = collection.populate("batch_mint_edition", [
|
|
6330
6222
|
params.to,
|
|
6331
|
-
tokenIds,
|
|
6332
6223
|
values,
|
|
6333
6224
|
tokenUris
|
|
6334
6225
|
]);
|
|
6335
6226
|
const res = await account.execute([call]);
|
|
6336
6227
|
return { txHash: res.transaction_hash };
|
|
6337
6228
|
}
|
|
6229
|
+
/**
|
|
6230
|
+
* Mint additional copies of an EXISTING edition into an ERC-1155 collection.
|
|
6231
|
+
* Reverts on-chain if `tokenId` has never been minted. Provenance/URI unchanged.
|
|
6232
|
+
* Caller must be the collection owner.
|
|
6233
|
+
*/
|
|
6234
|
+
async addSupply(account, params) {
|
|
6235
|
+
const collection = this._collection(params.collection, account);
|
|
6236
|
+
const call = collection.populate("add_supply", [
|
|
6237
|
+
params.to,
|
|
6238
|
+
BigInt(params.tokenId),
|
|
6239
|
+
BigInt(params.value)
|
|
6240
|
+
]);
|
|
6241
|
+
const res = await account.execute([call]);
|
|
6242
|
+
return { txHash: res.transaction_hash };
|
|
6243
|
+
}
|
|
6338
6244
|
/**
|
|
6339
6245
|
* Set the default ERC-2981 royalty for the entire collection.
|
|
6340
6246
|
* `feeNumerator` is out of 10 000 (e.g. 500 = 5%).
|
|
@@ -6411,6 +6317,67 @@ async function getCreatorCoinPrice(coinAddress, provider) {
|
|
|
6411
6317
|
const quotePerCoin = (quoteIsToken0 ? 1 / priceT1perT0 : priceT1perT0) * decAdj;
|
|
6412
6318
|
return { quotePerCoin, quoteToken, quoteSymbol: token?.symbol ?? null, quoteDecimals };
|
|
6413
6319
|
}
|
|
6320
|
+
var factoryContract = new Contract(
|
|
6321
|
+
CreatorCoinFactoryABI,
|
|
6322
|
+
CREATOR_COIN_FACTORY_CONTRACT_MAINNET
|
|
6323
|
+
);
|
|
6324
|
+
function buildCreateCreatorCoinCall(params) {
|
|
6325
|
+
const salt = params.salt ?? BigInt("0x" + Date.now().toString(16));
|
|
6326
|
+
return factoryContract.populate("create_creator_coin", [
|
|
6327
|
+
params.owner,
|
|
6328
|
+
params.name,
|
|
6329
|
+
params.symbol,
|
|
6330
|
+
BigInt(params.initialSupply),
|
|
6331
|
+
BigInt(salt)
|
|
6332
|
+
]);
|
|
6333
|
+
}
|
|
6334
|
+
function buildLaunchOnEkuboCalls(params) {
|
|
6335
|
+
const ek = params.ekubo ?? VALIDATED_EKUBO_PARAMS;
|
|
6336
|
+
const launchParameters = {
|
|
6337
|
+
creator_coin_address: params.creatorCoin,
|
|
6338
|
+
transfer_restriction_delay: params.transferRestrictionDelay ?? 0,
|
|
6339
|
+
max_percentage_buy_launch: params.maxPercentageBuyLaunch ?? 200,
|
|
6340
|
+
quote_address: params.quoteToken,
|
|
6341
|
+
initial_holders: params.initialHolders,
|
|
6342
|
+
initial_holders_amounts: params.initialHoldersAmounts.map((a) => BigInt(a))
|
|
6343
|
+
};
|
|
6344
|
+
const ekuboParameters = {
|
|
6345
|
+
fee: BigInt(ek.fee),
|
|
6346
|
+
tick_spacing: BigInt(ek.tickSpacing),
|
|
6347
|
+
starting_price: { mag: BigInt(ek.startingPrice.mag), sign: ek.startingPrice.sign },
|
|
6348
|
+
bound: BigInt(ek.bound)
|
|
6349
|
+
};
|
|
6350
|
+
const calls = [];
|
|
6351
|
+
if (params.quoteFundAmount !== void 0) {
|
|
6352
|
+
const amt = uint256.bnToUint256(BigInt(params.quoteFundAmount));
|
|
6353
|
+
calls.push({
|
|
6354
|
+
contractAddress: params.quoteToken,
|
|
6355
|
+
entrypoint: "transfer",
|
|
6356
|
+
calldata: [CREATOR_COIN_FACTORY_CONTRACT_MAINNET, amt.low, amt.high]
|
|
6357
|
+
});
|
|
6358
|
+
}
|
|
6359
|
+
calls.push(factoryContract.populate("launch_on_ekubo", [launchParameters, ekuboParameters]));
|
|
6360
|
+
return calls;
|
|
6361
|
+
}
|
|
6362
|
+
var CREATOR_COIN_CREATED_SELECTOR = hash.getSelectorFromName("CreatorCoinCreated");
|
|
6363
|
+
function parseCreatorCoinCreated(receipt) {
|
|
6364
|
+
const factory = normalizeAddress(CREATOR_COIN_FACTORY_CONTRACT_MAINNET);
|
|
6365
|
+
for (const ev of receipt?.events ?? []) {
|
|
6366
|
+
let from;
|
|
6367
|
+
try {
|
|
6368
|
+
from = normalizeAddress(ev.from_address ?? "");
|
|
6369
|
+
} catch {
|
|
6370
|
+
continue;
|
|
6371
|
+
}
|
|
6372
|
+
if (from !== factory) continue;
|
|
6373
|
+
const k0 = ev.keys?.[0];
|
|
6374
|
+
if (!k0 || normalizeAddress(k0) !== normalizeAddress(CREATOR_COIN_CREATED_SELECTOR)) continue;
|
|
6375
|
+
const data = ev.data ?? [];
|
|
6376
|
+
if (data.length < 1) continue;
|
|
6377
|
+
return normalizeAddress(data[data.length - 1]);
|
|
6378
|
+
}
|
|
6379
|
+
throw new Error("Coin deployed but the coin address could not be read from the receipt");
|
|
6380
|
+
}
|
|
6414
6381
|
var CreatorCoinService = class {
|
|
6415
6382
|
constructor(config) {
|
|
6416
6383
|
this.factoryAddress = CREATOR_COIN_FACTORY_CONTRACT_MAINNET;
|
|
@@ -6421,15 +6388,7 @@ var CreatorCoinService = class {
|
|
|
6421
6388
|
}
|
|
6422
6389
|
/** Deploy a fixed-supply CreatorCoin (full supply minted to the Factory). */
|
|
6423
6390
|
async createCreatorCoin(account, params) {
|
|
6424
|
-
const
|
|
6425
|
-
const call = this._factory(account).populate("create_creator_coin", [
|
|
6426
|
-
params.owner,
|
|
6427
|
-
params.name,
|
|
6428
|
-
params.symbol,
|
|
6429
|
-
BigInt(params.initialSupply),
|
|
6430
|
-
BigInt(salt)
|
|
6431
|
-
]);
|
|
6432
|
-
const res = await account.execute([call]);
|
|
6391
|
+
const res = await account.execute([buildCreateCreatorCoinCall(params)]);
|
|
6433
6392
|
return { txHash: res.transaction_hash };
|
|
6434
6393
|
}
|
|
6435
6394
|
/**
|
|
@@ -6438,33 +6397,7 @@ var CreatorCoinService = class {
|
|
|
6438
6397
|
* locked in the EkuboLauncher.
|
|
6439
6398
|
*/
|
|
6440
6399
|
async launchOnEkubo(account, params) {
|
|
6441
|
-
const
|
|
6442
|
-
const factory = this._factory(account);
|
|
6443
|
-
const launchParameters = {
|
|
6444
|
-
creator_coin_address: params.creatorCoin,
|
|
6445
|
-
transfer_restriction_delay: params.transferRestrictionDelay ?? 0,
|
|
6446
|
-
max_percentage_buy_launch: params.maxPercentageBuyLaunch ?? 200,
|
|
6447
|
-
quote_address: params.quoteToken,
|
|
6448
|
-
initial_holders: params.initialHolders,
|
|
6449
|
-
initial_holders_amounts: params.initialHoldersAmounts.map((a) => BigInt(a))
|
|
6450
|
-
};
|
|
6451
|
-
const ekuboParameters = {
|
|
6452
|
-
fee: BigInt(ek.fee),
|
|
6453
|
-
tick_spacing: BigInt(ek.tickSpacing),
|
|
6454
|
-
starting_price: { mag: BigInt(ek.startingPrice.mag), sign: ek.startingPrice.sign },
|
|
6455
|
-
bound: BigInt(ek.bound)
|
|
6456
|
-
};
|
|
6457
|
-
const calls = [];
|
|
6458
|
-
if (params.quoteFundAmount !== void 0) {
|
|
6459
|
-
const amt = uint256.bnToUint256(BigInt(params.quoteFundAmount));
|
|
6460
|
-
calls.push({
|
|
6461
|
-
contractAddress: params.quoteToken,
|
|
6462
|
-
entrypoint: "transfer",
|
|
6463
|
-
calldata: [this.factoryAddress, amt.low, amt.high]
|
|
6464
|
-
});
|
|
6465
|
-
}
|
|
6466
|
-
calls.push(factory.populate("launch_on_ekubo", [launchParameters, ekuboParameters]));
|
|
6467
|
-
const res = await account.execute(calls);
|
|
6400
|
+
const res = await account.execute(buildLaunchOnEkuboCalls(params));
|
|
6468
6401
|
return { txHash: res.transaction_hash };
|
|
6469
6402
|
}
|
|
6470
6403
|
/** View: is this address a Factory-deployed Creator Coin? */
|
|
@@ -6720,6 +6653,6 @@ function getServicesByCapability(cap) {
|
|
|
6720
6653
|
);
|
|
6721
6654
|
}
|
|
6722
6655
|
|
|
6723
|
-
export { ApiClient, COLLECTION_1155_CLASS_HASH_MAINNET, COLLECTION_1155_CONTRACT_MAINNET, COLLECTION_1155_FACTORY_CLASS_HASH_MAINNET, COLLECTION_1155_START_BLOCK_MAINNET, COLLECTION_721_CONTRACT_MAINNET, COLLECTION_721_START_BLOCK_MAINNET, CREATOR_COIN_CLASS_HASH_MAINNET, CREATOR_COIN_EKUBO_LAUNCHER_MAINNET, CREATOR_COIN_FACTORY_CLASS_HASH_MAINNET, CREATOR_COIN_FACTORY_CONTRACT_MAINNET, CREATOR_COIN_START_BLOCK_MAINNET, CollectionRegistryABI, CreatorCoinFactoryABI, CreatorCoinService, DEFAULT_RPC_URL, DROP_COLLECTION_CLASS_HASH_MAINNET, DROP_FACTORY_CONTRACT_MAINNET, DropCollectionABI, DropFactoryABI, DropService, EKUBO_CORE_MAINNET, ERC1155CollectionService, FeeConfigSchema, IPCOLLECTION_CLASS_HASH_MAINNET, IPCollection1155ABI, IPCollection1155FactoryABI, IPCollectionABI, IPMarketplaceABI, IPNFT_CLASS_HASH_MAINNET, IPNftABI, MARKETPLACE_1155_CLASS_HASH_MAINNET, MARKETPLACE_1155_CONTRACT_MAINNET, MARKETPLACE_1155_START_BLOCK_MAINNET, MARKETPLACE_721_CLASS_HASH_MAINNET, MARKETPLACE_721_CONTRACT_MAINNET, MARKETPLACE_721_START_BLOCK_MAINNET, MarketplaceModule, Medialane1155ABI, Medialane1155Module, MedialaneApiError, MedialaneClient, MedialaneError, NFTCOMMENTS_CONTRACT_MAINNET, OPEN_LICENSES, POPCollectionABI, POPFactoryABI, POP_COLLECTION_CLASS_HASH_MAINNET, POP_FACTORY_CONTRACT_MAINNET, PUBLIC_RPC_FALLBACKS, PopService, SUPPORTED_NETWORKS, SUPPORTED_TOKENS, VALIDATED_EKUBO_PARAMS, build1155CancellationTypedData, build1155OrderTypedData, buildCancellationTypedData, buildFeeCall, buildOrderTypedData, createFailoverFetch, encodeByteArray, formatAmount, getCreatorCoinPrice, getListableTokens, getService, getServicesByCapability, getTokenByAddress, getTokenBySymbol, isServiceId, isTransientRpcError, listServices, normalizeAddress, normalizeHash, parseAmount, resolveConfig, resolveFeeConfig, shortenAddress, stringifyBigInts, u256ToBigInt };
|
|
6656
|
+
export { ApiClient, COLLECTION_1155_CLASS_HASH_MAINNET, COLLECTION_1155_CONTRACT_MAINNET, COLLECTION_1155_FACTORY_CLASS_HASH_MAINNET, COLLECTION_1155_START_BLOCK_MAINNET, COLLECTION_721_CONTRACT_MAINNET, COLLECTION_721_START_BLOCK_MAINNET, CREATOR_COIN_CLASS_HASH_MAINNET, CREATOR_COIN_EKUBO_LAUNCHER_MAINNET, CREATOR_COIN_FACTORY_CLASS_HASH_MAINNET, CREATOR_COIN_FACTORY_CONTRACT_MAINNET, CREATOR_COIN_START_BLOCK_MAINNET, CollectionRegistryABI, CreatorCoinFactoryABI, CreatorCoinService, DEFAULT_RPC_URL, DROP_COLLECTION_CLASS_HASH_MAINNET, DROP_FACTORY_CONTRACT_MAINNET, DropCollectionABI, DropFactoryABI, DropService, EKUBO_CORE_MAINNET, ERC1155CollectionService, FeeConfigSchema, IPCOLLECTION_CLASS_HASH_MAINNET, IPCollection1155ABI, IPCollection1155FactoryABI, IPCollectionABI, IPMarketplaceABI, IPNFT_CLASS_HASH_MAINNET, IPNftABI, MARKETPLACE_1155_CLASS_HASH_MAINNET, MARKETPLACE_1155_CONTRACT_MAINNET, MARKETPLACE_1155_START_BLOCK_MAINNET, MARKETPLACE_721_CLASS_HASH_MAINNET, MARKETPLACE_721_CONTRACT_MAINNET, MARKETPLACE_721_START_BLOCK_MAINNET, MarketplaceModule, Medialane1155ABI, Medialane1155Module, MedialaneApiError, MedialaneClient, MedialaneError, NFTCOMMENTS_CONTRACT_MAINNET, OPEN_LICENSES, POPCollectionABI, POPFactoryABI, POP_COLLECTION_CLASS_HASH_MAINNET, POP_FACTORY_CONTRACT_MAINNET, PUBLIC_RPC_FALLBACKS, PopService, SUPPORTED_NETWORKS, SUPPORTED_TOKENS, VALIDATED_EKUBO_PARAMS, build1155CancellationTypedData, build1155OrderTypedData, buildCancellationTypedData, buildCreateCreatorCoinCall, buildFeeCall, buildLaunchOnEkuboCalls, buildOrderTypedData, createFailoverFetch, encodeByteArray, formatAmount, getCreatorCoinPrice, getListableTokens, getService, getServicesByCapability, getTokenByAddress, getTokenBySymbol, isServiceId, isTransientRpcError, listServices, normalizeAddress, normalizeHash, parseAmount, parseCreatorCoinCreated, resolveConfig, resolveFeeConfig, shortenAddress, stringifyBigInts, u256ToBigInt };
|
|
6724
6657
|
//# sourceMappingURL=index.js.map
|
|
6725
6658
|
//# sourceMappingURL=index.js.map
|