@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 +15 -0
- package/dist/index.cjs +31 -38
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +22 -14
- package/dist/index.d.ts +22 -14
- package/dist/index.js +31 -38
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -939,9 +939,30 @@ interface CreatePopCollectionParams {
|
|
|
939
939
|
claimEndTime: number;
|
|
940
940
|
eventType: PopEventType;
|
|
941
941
|
}
|
|
942
|
+
interface ClaimConditions {
|
|
943
|
+
/** Unix timestamp when minting opens. 0 = open immediately. */
|
|
944
|
+
startTime: number;
|
|
945
|
+
/** Unix timestamp when minting closes. 0 = never closes. */
|
|
946
|
+
endTime: number;
|
|
947
|
+
/** Price per token in payment_token units. 0 = free mint. */
|
|
948
|
+
price: bigint | string;
|
|
949
|
+
/** ERC-20 token address for payment. Must be non-zero if price > 0. */
|
|
950
|
+
paymentToken: string;
|
|
951
|
+
/** Max tokens a single wallet may mint across all phases. 0 = unlimited. */
|
|
952
|
+
maxQuantityPerWallet: bigint | string;
|
|
953
|
+
}
|
|
954
|
+
interface CreateDropParams {
|
|
955
|
+
name: string;
|
|
956
|
+
symbol: string;
|
|
957
|
+
baseUri: string;
|
|
958
|
+
maxSupply: bigint | string;
|
|
959
|
+
initialConditions: ClaimConditions;
|
|
960
|
+
}
|
|
961
|
+
|
|
942
962
|
declare class PopService {
|
|
943
963
|
private readonly factoryAddress;
|
|
944
964
|
constructor(_config: ResolvedConfig);
|
|
965
|
+
private _collection;
|
|
945
966
|
claim(account: AccountInterface, collectionAddress: string): Promise<TxResult>;
|
|
946
967
|
adminMint(account: AccountInterface, params: {
|
|
947
968
|
collection: string;
|
|
@@ -972,23 +993,10 @@ declare class PopService {
|
|
|
972
993
|
createCollection(account: AccountInterface, params: CreatePopCollectionParams): Promise<TxResult>;
|
|
973
994
|
}
|
|
974
995
|
|
|
975
|
-
interface ClaimConditions {
|
|
976
|
-
startTime: number;
|
|
977
|
-
endTime: number;
|
|
978
|
-
price: bigint | string;
|
|
979
|
-
paymentToken: string;
|
|
980
|
-
maxQuantityPerWallet: bigint | string;
|
|
981
|
-
}
|
|
982
|
-
interface CreateDropParams {
|
|
983
|
-
name: string;
|
|
984
|
-
symbol: string;
|
|
985
|
-
baseUri: string;
|
|
986
|
-
maxSupply: bigint | string;
|
|
987
|
-
initialConditions: ClaimConditions;
|
|
988
|
-
}
|
|
989
996
|
declare class DropService {
|
|
990
997
|
private readonly factoryAddress;
|
|
991
998
|
constructor(_config: ResolvedConfig);
|
|
999
|
+
private _collection;
|
|
992
1000
|
claim(account: AccountInterface, collectionAddress: string, quantity?: bigint | string | number): Promise<TxResult>;
|
|
993
1001
|
adminMint(account: AccountInterface, params: {
|
|
994
1002
|
collection: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -939,9 +939,30 @@ interface CreatePopCollectionParams {
|
|
|
939
939
|
claimEndTime: number;
|
|
940
940
|
eventType: PopEventType;
|
|
941
941
|
}
|
|
942
|
+
interface ClaimConditions {
|
|
943
|
+
/** Unix timestamp when minting opens. 0 = open immediately. */
|
|
944
|
+
startTime: number;
|
|
945
|
+
/** Unix timestamp when minting closes. 0 = never closes. */
|
|
946
|
+
endTime: number;
|
|
947
|
+
/** Price per token in payment_token units. 0 = free mint. */
|
|
948
|
+
price: bigint | string;
|
|
949
|
+
/** ERC-20 token address for payment. Must be non-zero if price > 0. */
|
|
950
|
+
paymentToken: string;
|
|
951
|
+
/** Max tokens a single wallet may mint across all phases. 0 = unlimited. */
|
|
952
|
+
maxQuantityPerWallet: bigint | string;
|
|
953
|
+
}
|
|
954
|
+
interface CreateDropParams {
|
|
955
|
+
name: string;
|
|
956
|
+
symbol: string;
|
|
957
|
+
baseUri: string;
|
|
958
|
+
maxSupply: bigint | string;
|
|
959
|
+
initialConditions: ClaimConditions;
|
|
960
|
+
}
|
|
961
|
+
|
|
942
962
|
declare class PopService {
|
|
943
963
|
private readonly factoryAddress;
|
|
944
964
|
constructor(_config: ResolvedConfig);
|
|
965
|
+
private _collection;
|
|
945
966
|
claim(account: AccountInterface, collectionAddress: string): Promise<TxResult>;
|
|
946
967
|
adminMint(account: AccountInterface, params: {
|
|
947
968
|
collection: string;
|
|
@@ -972,23 +993,10 @@ declare class PopService {
|
|
|
972
993
|
createCollection(account: AccountInterface, params: CreatePopCollectionParams): Promise<TxResult>;
|
|
973
994
|
}
|
|
974
995
|
|
|
975
|
-
interface ClaimConditions {
|
|
976
|
-
startTime: number;
|
|
977
|
-
endTime: number;
|
|
978
|
-
price: bigint | string;
|
|
979
|
-
paymentToken: string;
|
|
980
|
-
maxQuantityPerWallet: bigint | string;
|
|
981
|
-
}
|
|
982
|
-
interface CreateDropParams {
|
|
983
|
-
name: string;
|
|
984
|
-
symbol: string;
|
|
985
|
-
baseUri: string;
|
|
986
|
-
maxSupply: bigint | string;
|
|
987
|
-
initialConditions: ClaimConditions;
|
|
988
|
-
}
|
|
989
996
|
declare class DropService {
|
|
990
997
|
private readonly factoryAddress;
|
|
991
998
|
constructor(_config: ResolvedConfig);
|
|
999
|
+
private _collection;
|
|
992
1000
|
claim(account: AccountInterface, collectionAddress: string, quantity?: bigint | string | number): Promise<TxResult>;
|
|
993
1001
|
adminMint(account: AccountInterface, params: {
|
|
994
1002
|
collection: string;
|
package/dist/index.js
CHANGED
|
@@ -1877,20 +1877,20 @@ var ApiClient = class {
|
|
|
1877
1877
|
return res.data;
|
|
1878
1878
|
}
|
|
1879
1879
|
};
|
|
1880
|
-
var POP_FACTORY_MAINNET = "0x00b32c34b427d8f346b5843ada6a37bd3368d879fc752cd52b68a87287f60111";
|
|
1881
1880
|
var PopService = class {
|
|
1882
1881
|
constructor(_config) {
|
|
1883
|
-
this.factoryAddress =
|
|
1882
|
+
this.factoryAddress = POP_FACTORY_CONTRACT_MAINNET;
|
|
1883
|
+
}
|
|
1884
|
+
_collection(address, account) {
|
|
1885
|
+
return new Contract(POPCollectionABI, normalizeAddress(address), account);
|
|
1884
1886
|
}
|
|
1885
1887
|
async claim(account, collectionAddress) {
|
|
1886
|
-
const
|
|
1887
|
-
const call = collection.populate("claim", []);
|
|
1888
|
+
const call = this._collection(collectionAddress, account).populate("claim", []);
|
|
1888
1889
|
const res = await account.execute([call]);
|
|
1889
1890
|
return { txHash: res.transaction_hash };
|
|
1890
1891
|
}
|
|
1891
1892
|
async adminMint(account, params) {
|
|
1892
|
-
const
|
|
1893
|
-
const call = collection.populate("admin_mint", [
|
|
1893
|
+
const call = this._collection(params.collection, account).populate("admin_mint", [
|
|
1894
1894
|
params.recipient,
|
|
1895
1895
|
params.customUri ?? ""
|
|
1896
1896
|
]);
|
|
@@ -1898,55 +1898,51 @@ var PopService = class {
|
|
|
1898
1898
|
return { txHash: res.transaction_hash };
|
|
1899
1899
|
}
|
|
1900
1900
|
async addToAllowlist(account, params) {
|
|
1901
|
-
const
|
|
1902
|
-
const call = collection.populate("add_to_allowlist", [params.address]);
|
|
1901
|
+
const call = this._collection(params.collection, account).populate("add_to_allowlist", [params.address]);
|
|
1903
1902
|
const res = await account.execute([call]);
|
|
1904
1903
|
return { txHash: res.transaction_hash };
|
|
1905
1904
|
}
|
|
1906
1905
|
async batchAddToAllowlist(account, params) {
|
|
1907
|
-
const collection =
|
|
1906
|
+
const collection = this._collection(params.collection, account);
|
|
1908
1907
|
const CHUNK = 200;
|
|
1909
1908
|
const calls = [];
|
|
1910
1909
|
for (let i = 0; i < params.addresses.length; i += CHUNK) {
|
|
1911
|
-
|
|
1912
|
-
calls.push(collection.populate("batch_add_to_allowlist", [chunk]));
|
|
1910
|
+
calls.push(collection.populate("batch_add_to_allowlist", [params.addresses.slice(i, i + CHUNK)]));
|
|
1913
1911
|
}
|
|
1914
1912
|
const res = await account.execute(calls);
|
|
1915
1913
|
return { txHash: res.transaction_hash };
|
|
1916
1914
|
}
|
|
1917
1915
|
async removeFromAllowlist(account, params) {
|
|
1918
|
-
const
|
|
1919
|
-
const call = collection.populate("remove_from_allowlist", [params.address]);
|
|
1916
|
+
const call = this._collection(params.collection, account).populate("remove_from_allowlist", [params.address]);
|
|
1920
1917
|
const res = await account.execute([call]);
|
|
1921
1918
|
return { txHash: res.transaction_hash };
|
|
1922
1919
|
}
|
|
1923
1920
|
async setTokenUri(account, params) {
|
|
1924
|
-
const
|
|
1925
|
-
|
|
1921
|
+
const call = this._collection(params.collection, account).populate("set_token_uri", [
|
|
1922
|
+
BigInt(params.tokenId),
|
|
1923
|
+
params.uri
|
|
1924
|
+
]);
|
|
1926
1925
|
const res = await account.execute([call]);
|
|
1927
1926
|
return { txHash: res.transaction_hash };
|
|
1928
1927
|
}
|
|
1929
1928
|
async setPaused(account, params) {
|
|
1930
|
-
const
|
|
1931
|
-
const call = collection.populate("set_paused", [params.paused]);
|
|
1929
|
+
const call = this._collection(params.collection, account).populate("set_paused", [params.paused]);
|
|
1932
1930
|
const res = await account.execute([call]);
|
|
1933
1931
|
return { txHash: res.transaction_hash };
|
|
1934
1932
|
}
|
|
1935
1933
|
async createCollection(account, params) {
|
|
1936
1934
|
const factory = new Contract(POPFactoryABI, this.factoryAddress, account);
|
|
1937
|
-
const eventTypeVariant = { [params.eventType]: {} };
|
|
1938
1935
|
const call = factory.populate("create_collection", [
|
|
1939
1936
|
params.name,
|
|
1940
1937
|
params.symbol,
|
|
1941
1938
|
params.baseUri,
|
|
1942
1939
|
params.claimEndTime,
|
|
1943
|
-
|
|
1940
|
+
{ [params.eventType]: {} }
|
|
1944
1941
|
]);
|
|
1945
1942
|
const res = await account.execute([call]);
|
|
1946
1943
|
return { txHash: res.transaction_hash };
|
|
1947
1944
|
}
|
|
1948
1945
|
};
|
|
1949
|
-
var DROP_FACTORY_MAINNET = "0x03587f42e29daee1b193f6cf83bf8627908ed6632d0d83fcb26225c50547d800";
|
|
1950
1946
|
function toContractConditions(c) {
|
|
1951
1947
|
return {
|
|
1952
1948
|
start_time: c.startTime,
|
|
@@ -1958,17 +1954,18 @@ function toContractConditions(c) {
|
|
|
1958
1954
|
}
|
|
1959
1955
|
var DropService = class {
|
|
1960
1956
|
constructor(_config) {
|
|
1961
|
-
this.factoryAddress =
|
|
1957
|
+
this.factoryAddress = DROP_FACTORY_CONTRACT_MAINNET;
|
|
1958
|
+
}
|
|
1959
|
+
_collection(address, account) {
|
|
1960
|
+
return new Contract(DropCollectionABI, normalizeAddress(address), account);
|
|
1962
1961
|
}
|
|
1963
1962
|
async claim(account, collectionAddress, quantity = 1) {
|
|
1964
|
-
const
|
|
1965
|
-
const call = collection.populate("claim", [BigInt(quantity)]);
|
|
1963
|
+
const call = this._collection(collectionAddress, account).populate("claim", [BigInt(quantity)]);
|
|
1966
1964
|
const res = await account.execute([call]);
|
|
1967
1965
|
return { txHash: res.transaction_hash };
|
|
1968
1966
|
}
|
|
1969
1967
|
async adminMint(account, params) {
|
|
1970
|
-
const
|
|
1971
|
-
const call = collection.populate("admin_mint", [
|
|
1968
|
+
const call = this._collection(params.collection, account).populate("admin_mint", [
|
|
1972
1969
|
params.recipient,
|
|
1973
1970
|
BigInt(params.quantity ?? 1),
|
|
1974
1971
|
params.customUri ?? ""
|
|
@@ -1977,43 +1974,39 @@ var DropService = class {
|
|
|
1977
1974
|
return { txHash: res.transaction_hash };
|
|
1978
1975
|
}
|
|
1979
1976
|
async setClaimConditions(account, params) {
|
|
1980
|
-
const
|
|
1981
|
-
|
|
1977
|
+
const call = this._collection(params.collection, account).populate("set_claim_conditions", [
|
|
1978
|
+
toContractConditions(params.conditions)
|
|
1979
|
+
]);
|
|
1982
1980
|
const res = await account.execute([call]);
|
|
1983
1981
|
return { txHash: res.transaction_hash };
|
|
1984
1982
|
}
|
|
1985
1983
|
async setAllowlistEnabled(account, params) {
|
|
1986
|
-
const
|
|
1987
|
-
const call = collection.populate("set_allowlist_enabled", [params.enabled]);
|
|
1984
|
+
const call = this._collection(params.collection, account).populate("set_allowlist_enabled", [params.enabled]);
|
|
1988
1985
|
const res = await account.execute([call]);
|
|
1989
1986
|
return { txHash: res.transaction_hash };
|
|
1990
1987
|
}
|
|
1991
1988
|
async addToAllowlist(account, params) {
|
|
1992
|
-
const
|
|
1993
|
-
const call = collection.populate("add_to_allowlist", [params.address]);
|
|
1989
|
+
const call = this._collection(params.collection, account).populate("add_to_allowlist", [params.address]);
|
|
1994
1990
|
const res = await account.execute([call]);
|
|
1995
1991
|
return { txHash: res.transaction_hash };
|
|
1996
1992
|
}
|
|
1997
1993
|
async batchAddToAllowlist(account, params) {
|
|
1998
|
-
const collection =
|
|
1994
|
+
const collection = this._collection(params.collection, account);
|
|
1999
1995
|
const CHUNK = 200;
|
|
2000
1996
|
const calls = [];
|
|
2001
1997
|
for (let i = 0; i < params.addresses.length; i += CHUNK) {
|
|
2002
|
-
|
|
2003
|
-
calls.push(collection.populate("batch_add_to_allowlist", [chunk]));
|
|
1998
|
+
calls.push(collection.populate("batch_add_to_allowlist", [params.addresses.slice(i, i + CHUNK)]));
|
|
2004
1999
|
}
|
|
2005
2000
|
const res = await account.execute(calls);
|
|
2006
2001
|
return { txHash: res.transaction_hash };
|
|
2007
2002
|
}
|
|
2008
2003
|
async setPaused(account, params) {
|
|
2009
|
-
const
|
|
2010
|
-
const call = collection.populate("set_paused", [params.paused]);
|
|
2004
|
+
const call = this._collection(params.collection, account).populate("set_paused", [params.paused]);
|
|
2011
2005
|
const res = await account.execute([call]);
|
|
2012
2006
|
return { txHash: res.transaction_hash };
|
|
2013
2007
|
}
|
|
2014
2008
|
async withdrawPayments(account, params) {
|
|
2015
|
-
const
|
|
2016
|
-
const call = collection.populate("withdraw_payments", []);
|
|
2009
|
+
const call = this._collection(params.collection, account).populate("withdraw_payments", []);
|
|
2017
2010
|
const res = await account.execute([call]);
|
|
2018
2011
|
return { txHash: res.transaction_hash };
|
|
2019
2012
|
}
|