@zoralabs/protocol-sdk 0.2.0 → 0.3.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/.turbo/turbo-build.log +6 -6
- package/CHANGELOG.md +19 -1
- package/README.md +42 -11
- package/dist/create/1155-create-helper.d.ts +24 -25
- package/dist/create/1155-create-helper.d.ts.map +1 -1
- package/dist/index.cjs +296 -130
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +287 -115
- package/dist/index.js.map +1 -1
- package/dist/mint/mint-client.d.ts +5 -1
- package/dist/mint/mint-client.d.ts.map +1 -1
- package/dist/premint/premint-client.d.ts +51 -12
- package/dist/premint/premint-client.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/create/1155-create-helper.test.ts +40 -26
- package/src/create/1155-create-helper.ts +120 -103
- package/src/index.ts +2 -0
- package/src/mint/mint-client.test.ts +3 -3
- package/src/mint/mint-client.ts +12 -2
- package/src/premint/premint-client.test.ts +22 -9
- package/src/premint/premint-client.ts +29 -31
- package/dist/preminter.d.ts +0 -25
- package/dist/preminter.d.ts.map +0 -1
- package/dist/preminter.test.d.ts +0 -451
- package/dist/preminter.test.d.ts.map +0 -1
- package/src/preminter.test.ts +0 -510
- package/src/preminter.ts +0 -72
package/dist/index.js
CHANGED
|
@@ -355,6 +355,16 @@ var PremintClient = class extends ClientBase {
|
|
|
355
355
|
getFixedPriceMinterAddress() {
|
|
356
356
|
return zoraCreatorFixedPriceSaleStrategyAddress[999];
|
|
357
357
|
}
|
|
358
|
+
getDataFromPremintReceipt(receipt) {
|
|
359
|
+
const premintedLog = getPremintedLogFromReceipt(receipt);
|
|
360
|
+
return {
|
|
361
|
+
premintedLog,
|
|
362
|
+
urls: this.makeUrls({
|
|
363
|
+
address: premintedLog?.contractAddress,
|
|
364
|
+
tokenId: premintedLog?.tokenId
|
|
365
|
+
})
|
|
366
|
+
};
|
|
367
|
+
}
|
|
358
368
|
/**
|
|
359
369
|
* Update existing premint given collection address and UID of existing premint.
|
|
360
370
|
*
|
|
@@ -643,14 +653,11 @@ var PremintClient = class extends ClientBase {
|
|
|
643
653
|
* @param settings.publicClient Optional public client for preflight checks.
|
|
644
654
|
* @returns receipt, log, zoraURL
|
|
645
655
|
*/
|
|
646
|
-
async
|
|
656
|
+
async executePremint({
|
|
647
657
|
data,
|
|
648
658
|
account,
|
|
649
|
-
|
|
650
|
-
mintArguments,
|
|
651
|
-
publicClient
|
|
659
|
+
mintArguments
|
|
652
660
|
}) {
|
|
653
|
-
publicClient = this.getPublicClient(publicClient);
|
|
654
661
|
if (mintArguments && mintArguments?.quantityToMint < 1) {
|
|
655
662
|
throw new Error("Quantity to mint cannot be below 1");
|
|
656
663
|
}
|
|
@@ -663,34 +670,29 @@ var PremintClient = class extends ClientBase {
|
|
|
663
670
|
numberToMint,
|
|
664
671
|
mintArguments?.mintComment || ""
|
|
665
672
|
];
|
|
666
|
-
if (!account) {
|
|
667
|
-
account = walletClient.account;
|
|
668
|
-
}
|
|
669
673
|
if (!account) {
|
|
670
674
|
throw new Error("Wallet not passed in");
|
|
671
675
|
}
|
|
672
676
|
const value = numberToMint * REWARD_PER_TOKEN;
|
|
673
|
-
const
|
|
677
|
+
const request = {
|
|
674
678
|
account,
|
|
675
679
|
abi: zoraCreator1155PremintExecutorImplABI,
|
|
676
680
|
functionName: "premint",
|
|
677
681
|
value,
|
|
678
682
|
address: targetAddress,
|
|
679
683
|
args
|
|
680
|
-
}
|
|
681
|
-
const hash = await walletClient.writeContract(request);
|
|
682
|
-
const receipt = await publicClient.waitForTransactionReceipt({ hash });
|
|
683
|
-
const premintedLog = getPremintedLogFromReceipt(receipt);
|
|
684
|
+
};
|
|
684
685
|
return {
|
|
685
|
-
|
|
686
|
-
premintedLog,
|
|
687
|
-
urls: this.makeUrls({
|
|
688
|
-
address: premintedLog?.contractAddress,
|
|
689
|
-
tokenId: premintedLog?.tokenId
|
|
690
|
-
})
|
|
686
|
+
request
|
|
691
687
|
};
|
|
692
688
|
}
|
|
693
689
|
};
|
|
690
|
+
function createPremintClient({
|
|
691
|
+
chain,
|
|
692
|
+
premintAPIClient
|
|
693
|
+
}) {
|
|
694
|
+
return new PremintClient(chain, premintAPIClient);
|
|
695
|
+
}
|
|
694
696
|
|
|
695
697
|
// src/mint/mint-api-client.ts
|
|
696
698
|
function encodeQueryParameters(params) {
|
|
@@ -717,18 +719,182 @@ var MintAPIClient = {
|
|
|
717
719
|
getSalesConfigFixedPrice
|
|
718
720
|
};
|
|
719
721
|
|
|
722
|
+
// src/mint/mint-client.ts
|
|
723
|
+
import {
|
|
724
|
+
encodeAbiParameters,
|
|
725
|
+
parseAbi,
|
|
726
|
+
parseAbiParameters,
|
|
727
|
+
zeroAddress
|
|
728
|
+
} from "viem";
|
|
729
|
+
import {
|
|
730
|
+
zoraCreator1155ImplABI,
|
|
731
|
+
zoraCreatorFixedPriceSaleStrategyAddress as zoraCreatorFixedPriceSaleStrategyAddress2
|
|
732
|
+
} from "@zoralabs/protocol-deployments";
|
|
733
|
+
var MintError = class extends Error {
|
|
734
|
+
};
|
|
735
|
+
var MintInactiveError = class extends Error {
|
|
736
|
+
};
|
|
737
|
+
var Errors = {
|
|
738
|
+
MintError,
|
|
739
|
+
MintInactiveError
|
|
740
|
+
};
|
|
741
|
+
var zora721Abi = parseAbi([
|
|
742
|
+
"function mintWithRewards(address recipient, uint256 quantity, string calldata comment, address mintReferral) external payable",
|
|
743
|
+
"function zoraFeeForAmount(uint256 amount) public view returns (address, uint256)"
|
|
744
|
+
]);
|
|
745
|
+
var MintClient = class extends ClientBase {
|
|
746
|
+
constructor(chain, apiClient) {
|
|
747
|
+
super(chain);
|
|
748
|
+
if (!apiClient) {
|
|
749
|
+
apiClient = MintAPIClient;
|
|
750
|
+
}
|
|
751
|
+
this.apiClient = apiClient;
|
|
752
|
+
}
|
|
753
|
+
async getMintable({
|
|
754
|
+
tokenContract,
|
|
755
|
+
tokenId
|
|
756
|
+
}) {
|
|
757
|
+
return this.apiClient.getMintable(
|
|
758
|
+
{
|
|
759
|
+
chain_name: this.network.zoraBackendChainName,
|
|
760
|
+
collection_address: tokenContract
|
|
761
|
+
},
|
|
762
|
+
{ token_id: tokenId?.toString() }
|
|
763
|
+
);
|
|
764
|
+
}
|
|
765
|
+
async makePrepareMintTokenParams({
|
|
766
|
+
publicClient,
|
|
767
|
+
minterAccount,
|
|
768
|
+
mintable,
|
|
769
|
+
mintArguments
|
|
770
|
+
}) {
|
|
771
|
+
if (!mintable) {
|
|
772
|
+
throw new MintError("No mintable found");
|
|
773
|
+
}
|
|
774
|
+
if (!mintable.is_active) {
|
|
775
|
+
throw new MintInactiveError("Minting token is inactive");
|
|
776
|
+
}
|
|
777
|
+
if (!mintable.mint_context) {
|
|
778
|
+
throw new MintError("No minting context data from zora API");
|
|
779
|
+
}
|
|
780
|
+
if (!["zora_create", "zora_create_1155"].includes(
|
|
781
|
+
mintable.mint_context?.mint_context_type
|
|
782
|
+
)) {
|
|
783
|
+
throw new MintError(
|
|
784
|
+
`Mintable type ${mintable.mint_context.mint_context_type} is currently unsupported.`
|
|
785
|
+
);
|
|
786
|
+
}
|
|
787
|
+
const thisPublicClient = this.getPublicClient(publicClient);
|
|
788
|
+
if (mintable.mint_context.mint_context_type === "zora_create_1155") {
|
|
789
|
+
return {
|
|
790
|
+
simulateContractParameters: await this.prepareMintZora1155({
|
|
791
|
+
publicClient: thisPublicClient,
|
|
792
|
+
mintArguments,
|
|
793
|
+
sender: minterAccount,
|
|
794
|
+
mintable
|
|
795
|
+
})
|
|
796
|
+
};
|
|
797
|
+
}
|
|
798
|
+
if (mintable.mint_context.mint_context_type === "zora_create") {
|
|
799
|
+
return {
|
|
800
|
+
simulateContractParameters: await this.prepareMintZora721({
|
|
801
|
+
publicClient: thisPublicClient,
|
|
802
|
+
mintArguments,
|
|
803
|
+
sender: minterAccount,
|
|
804
|
+
mintable
|
|
805
|
+
})
|
|
806
|
+
};
|
|
807
|
+
}
|
|
808
|
+
throw new Error("Mintable type not found or recognized.");
|
|
809
|
+
}
|
|
810
|
+
async prepareMintZora1155({
|
|
811
|
+
mintable,
|
|
812
|
+
sender,
|
|
813
|
+
publicClient,
|
|
814
|
+
mintArguments
|
|
815
|
+
}) {
|
|
816
|
+
const mintQuantity = BigInt(mintArguments.quantityToMint);
|
|
817
|
+
const address = mintable.collection.address;
|
|
818
|
+
const mintFee = await publicClient.readContract({
|
|
819
|
+
abi: zoraCreator1155ImplABI,
|
|
820
|
+
functionName: "mintFee",
|
|
821
|
+
address
|
|
822
|
+
});
|
|
823
|
+
const tokenFixedPriceMinter = await this.apiClient.getSalesConfigFixedPrice(
|
|
824
|
+
{
|
|
825
|
+
contractAddress: mintable.contract_address,
|
|
826
|
+
tokenId: mintable.token_id,
|
|
827
|
+
subgraphUrl: this.network.subgraphUrl
|
|
828
|
+
}
|
|
829
|
+
);
|
|
830
|
+
const result = {
|
|
831
|
+
abi: zoraCreator1155ImplABI,
|
|
832
|
+
functionName: "mintWithRewards",
|
|
833
|
+
account: sender,
|
|
834
|
+
value: (mintFee + BigInt(mintable.cost.native_price.raw)) * mintQuantity,
|
|
835
|
+
address,
|
|
836
|
+
/* args: minter, tokenId, quantity, minterArguments, mintReferral */
|
|
837
|
+
args: [
|
|
838
|
+
tokenFixedPriceMinter || zoraCreatorFixedPriceSaleStrategyAddress2[999],
|
|
839
|
+
BigInt(mintable.token_id),
|
|
840
|
+
mintQuantity,
|
|
841
|
+
encodeAbiParameters(parseAbiParameters("address, string"), [
|
|
842
|
+
mintArguments.mintToAddress,
|
|
843
|
+
mintArguments.mintComment || ""
|
|
844
|
+
]),
|
|
845
|
+
mintArguments.mintReferral || zeroAddress
|
|
846
|
+
]
|
|
847
|
+
};
|
|
848
|
+
return result;
|
|
849
|
+
}
|
|
850
|
+
async prepareMintZora721({
|
|
851
|
+
mintable,
|
|
852
|
+
publicClient,
|
|
853
|
+
sender,
|
|
854
|
+
mintArguments
|
|
855
|
+
}) {
|
|
856
|
+
const [_, mintFee] = await publicClient.readContract({
|
|
857
|
+
abi: zora721Abi,
|
|
858
|
+
address: mintable.contract_address,
|
|
859
|
+
functionName: "zoraFeeForAmount",
|
|
860
|
+
args: [BigInt(mintArguments.quantityToMint)]
|
|
861
|
+
});
|
|
862
|
+
const result = {
|
|
863
|
+
abi: zora721Abi,
|
|
864
|
+
address: mintable.contract_address,
|
|
865
|
+
account: sender,
|
|
866
|
+
functionName: "mintWithRewards",
|
|
867
|
+
value: mintFee + BigInt(mintable.cost.native_price.raw) * BigInt(mintArguments.quantityToMint),
|
|
868
|
+
/* args: mint recipient, quantity to mint, mint comment, mintReferral */
|
|
869
|
+
args: [
|
|
870
|
+
mintArguments.mintToAddress,
|
|
871
|
+
BigInt(mintArguments.quantityToMint),
|
|
872
|
+
mintArguments.mintComment || "",
|
|
873
|
+
mintArguments.mintReferral || zeroAddress
|
|
874
|
+
]
|
|
875
|
+
};
|
|
876
|
+
return result;
|
|
877
|
+
}
|
|
878
|
+
};
|
|
879
|
+
function createMintClient({
|
|
880
|
+
chain,
|
|
881
|
+
mintAPIClient
|
|
882
|
+
}) {
|
|
883
|
+
return new MintClient(chain, mintAPIClient);
|
|
884
|
+
}
|
|
885
|
+
|
|
720
886
|
// src/create/1155-create-helper.ts
|
|
721
887
|
import {
|
|
722
888
|
zoraCreator1155FactoryImplABI,
|
|
723
889
|
zoraCreator1155FactoryImplAddress,
|
|
724
|
-
zoraCreator1155ImplABI,
|
|
890
|
+
zoraCreator1155ImplABI as zoraCreator1155ImplABI2,
|
|
725
891
|
zoraCreatorFixedPriceSaleStrategyABI
|
|
726
892
|
} from "@zoralabs/protocol-deployments";
|
|
727
|
-
import { decodeEventLog as decodeEventLog2, encodeFunctionData, zeroAddress } from "viem";
|
|
893
|
+
import { decodeEventLog as decodeEventLog2, encodeFunctionData, zeroAddress as zeroAddress2 } from "viem";
|
|
728
894
|
var SALE_END_FOREVER = 18446744073709551615n;
|
|
729
895
|
var ROYALTY_BPS_DEFAULT = 1e3;
|
|
730
896
|
var DEFAULT_SALE_SETTINGS = {
|
|
731
|
-
fundsRecipient:
|
|
897
|
+
fundsRecipient: zeroAddress2,
|
|
732
898
|
// Free Mint
|
|
733
899
|
pricePerToken: 0n,
|
|
734
900
|
// Sale start time – defaults to beginning of unix time
|
|
@@ -768,26 +934,26 @@ function create1155TokenSetupArgs({
|
|
|
768
934
|
};
|
|
769
935
|
const setupActions = [
|
|
770
936
|
encodeFunctionData({
|
|
771
|
-
abi:
|
|
772
|
-
functionName: "addPermission",
|
|
773
|
-
args: [0n, fixedPriceMinterAddress, PERMISSION_BIT_MINTER]
|
|
774
|
-
}),
|
|
775
|
-
encodeFunctionData({
|
|
776
|
-
abi: zoraCreator1155ImplABI,
|
|
937
|
+
abi: zoraCreator1155ImplABI2,
|
|
777
938
|
functionName: "assumeLastTokenIdMatches",
|
|
778
939
|
args: [nextTokenId - 1n]
|
|
779
940
|
}),
|
|
780
941
|
createReferral ? encodeFunctionData({
|
|
781
|
-
abi:
|
|
942
|
+
abi: zoraCreator1155ImplABI2,
|
|
782
943
|
functionName: "setupNewTokenWithCreateReferral",
|
|
783
944
|
args: [tokenMetadataURI, maxSupply, createReferral]
|
|
784
945
|
}) : encodeFunctionData({
|
|
785
|
-
abi:
|
|
946
|
+
abi: zoraCreator1155ImplABI2,
|
|
786
947
|
functionName: "setupNewToken",
|
|
787
948
|
args: [tokenMetadataURI, maxSupply]
|
|
788
949
|
}),
|
|
789
950
|
encodeFunctionData({
|
|
790
|
-
abi:
|
|
951
|
+
abi: zoraCreator1155ImplABI2,
|
|
952
|
+
functionName: "addPermission",
|
|
953
|
+
args: [0n, fixedPriceMinterAddress, PERMISSION_BIT_MINTER]
|
|
954
|
+
}),
|
|
955
|
+
encodeFunctionData({
|
|
956
|
+
abi: zoraCreator1155ImplABI2,
|
|
791
957
|
functionName: "callSale",
|
|
792
958
|
args: [
|
|
793
959
|
nextTokenId,
|
|
@@ -803,7 +969,7 @@ function create1155TokenSetupArgs({
|
|
|
803
969
|
if (mintToCreatorCount) {
|
|
804
970
|
setupActions.push(
|
|
805
971
|
encodeFunctionData({
|
|
806
|
-
abi:
|
|
972
|
+
abi: zoraCreator1155ImplABI2,
|
|
807
973
|
functionName: "adminMint",
|
|
808
974
|
args: [account, nextTokenId, mintToCreatorCount, "0x"]
|
|
809
975
|
})
|
|
@@ -812,7 +978,7 @@ function create1155TokenSetupArgs({
|
|
|
812
978
|
if (royaltySettings) {
|
|
813
979
|
setupActions.push(
|
|
814
980
|
encodeFunctionData({
|
|
815
|
-
abi:
|
|
981
|
+
abi: zoraCreator1155ImplABI2,
|
|
816
982
|
functionName: "updateRoyaltiesForToken",
|
|
817
983
|
args: [
|
|
818
984
|
nextTokenId,
|
|
@@ -831,7 +997,7 @@ var getTokenIdFromCreateReceipt = (receipt) => {
|
|
|
831
997
|
for (const data of receipt.logs) {
|
|
832
998
|
try {
|
|
833
999
|
const decodedLog = decodeEventLog2({
|
|
834
|
-
abi:
|
|
1000
|
+
abi: zoraCreator1155ImplABI2,
|
|
835
1001
|
eventName: "SetupNewToken",
|
|
836
1002
|
...data
|
|
837
1003
|
});
|
|
@@ -860,7 +1026,7 @@ async function getContractExists(publicClient, contract, account) {
|
|
|
860
1026
|
});
|
|
861
1027
|
try {
|
|
862
1028
|
await publicClient.readContract({
|
|
863
|
-
abi:
|
|
1029
|
+
abi: zoraCreator1155ImplABI2,
|
|
864
1030
|
address: contractAddress,
|
|
865
1031
|
functionName: "contractVersion"
|
|
866
1032
|
});
|
|
@@ -874,107 +1040,113 @@ async function getContractExists(publicClient, contract, account) {
|
|
|
874
1040
|
contractAddress: contract
|
|
875
1041
|
};
|
|
876
1042
|
}
|
|
877
|
-
|
|
878
|
-
publicClient
|
|
879
|
-
contract,
|
|
880
|
-
tokenMetadataURI,
|
|
881
|
-
mintToCreatorCount = 1,
|
|
882
|
-
salesConfig = {},
|
|
883
|
-
maxSupply,
|
|
884
|
-
account,
|
|
885
|
-
royaltySettings,
|
|
886
|
-
getAdditionalSetupActions
|
|
1043
|
+
function create1155CreatorClient({
|
|
1044
|
+
publicClient
|
|
887
1045
|
}) {
|
|
888
|
-
|
|
889
|
-
publicClient,
|
|
1046
|
+
async function createNew1155Token({
|
|
890
1047
|
contract,
|
|
891
|
-
account
|
|
892
|
-
);
|
|
893
|
-
let nextTokenId = 1n;
|
|
894
|
-
if (contractExists) {
|
|
895
|
-
nextTokenId = await publicClient.readContract({
|
|
896
|
-
abi: zoraCreator1155ImplABI,
|
|
897
|
-
functionName: "nextTokenId",
|
|
898
|
-
address: contractAddress
|
|
899
|
-
});
|
|
900
|
-
}
|
|
901
|
-
const fixedPriceMinterAddress = await publicClient.readContract({
|
|
902
|
-
abi: zoraCreator1155FactoryImplABI,
|
|
903
|
-
address: zoraCreator1155FactoryImplAddress[999],
|
|
904
|
-
functionName: "fixedPriceMinter"
|
|
905
|
-
});
|
|
906
|
-
let tokenSetupActions = create1155TokenSetupArgs({
|
|
907
1048
|
tokenMetadataURI,
|
|
908
|
-
|
|
909
|
-
salesConfig,
|
|
1049
|
+
mintToCreatorCount = 1,
|
|
1050
|
+
salesConfig = {},
|
|
910
1051
|
maxSupply,
|
|
911
|
-
fixedPriceMinterAddress,
|
|
912
1052
|
account,
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
})
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
1053
|
+
royaltySettings,
|
|
1054
|
+
getAdditionalSetupActions
|
|
1055
|
+
}) {
|
|
1056
|
+
const { contractExists, contractAddress } = await getContractExists(
|
|
1057
|
+
publicClient,
|
|
1058
|
+
contract,
|
|
1059
|
+
account
|
|
1060
|
+
);
|
|
1061
|
+
let nextTokenId = 1n;
|
|
1062
|
+
if (contractExists) {
|
|
1063
|
+
nextTokenId = await publicClient.readContract({
|
|
1064
|
+
abi: zoraCreator1155ImplABI2,
|
|
1065
|
+
functionName: "nextTokenId",
|
|
1066
|
+
address: contractAddress
|
|
1067
|
+
});
|
|
1068
|
+
}
|
|
1069
|
+
const fixedPriceMinterAddress = await publicClient.readContract({
|
|
927
1070
|
abi: zoraCreator1155FactoryImplABI,
|
|
928
|
-
functionName: "createContractDeterministic",
|
|
929
|
-
account,
|
|
930
1071
|
address: zoraCreator1155FactoryImplAddress[999],
|
|
931
|
-
|
|
932
|
-
contract.uri,
|
|
933
|
-
contract.name,
|
|
934
|
-
{
|
|
935
|
-
// deprecated
|
|
936
|
-
royaltyMintSchedule: 0,
|
|
937
|
-
royaltyBPS: royaltySettings?.royaltyBPS || ROYALTY_BPS_DEFAULT,
|
|
938
|
-
royaltyRecipient: royaltySettings?.royaltyRecipient || account
|
|
939
|
-
},
|
|
940
|
-
contract.defaultAdmin || account,
|
|
941
|
-
tokenSetupActions
|
|
942
|
-
]
|
|
1072
|
+
functionName: "fixedPriceMinter"
|
|
943
1073
|
});
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
} else if (contractExists) {
|
|
951
|
-
const { request } = await publicClient.simulateContract({
|
|
952
|
-
abi: zoraCreator1155ImplABI,
|
|
953
|
-
functionName: "multicall",
|
|
1074
|
+
let tokenSetupActions = create1155TokenSetupArgs({
|
|
1075
|
+
tokenMetadataURI,
|
|
1076
|
+
nextTokenId,
|
|
1077
|
+
salesConfig,
|
|
1078
|
+
maxSupply,
|
|
1079
|
+
fixedPriceMinterAddress,
|
|
954
1080
|
account,
|
|
955
|
-
|
|
956
|
-
|
|
1081
|
+
mintToCreatorCount,
|
|
1082
|
+
royaltySettings
|
|
957
1083
|
});
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
}
|
|
1084
|
+
if (getAdditionalSetupActions) {
|
|
1085
|
+
tokenSetupActions = [
|
|
1086
|
+
...getAdditionalSetupActions({ tokenId: nextTokenId, contractAddress }),
|
|
1087
|
+
...tokenSetupActions
|
|
1088
|
+
];
|
|
1089
|
+
}
|
|
1090
|
+
if (!contractAddress && typeof contract === "string") {
|
|
1091
|
+
throw new Error("Invariant: contract cannot be missing and an address");
|
|
1092
|
+
}
|
|
1093
|
+
if (!contractExists && typeof contract !== "string") {
|
|
1094
|
+
const request = {
|
|
1095
|
+
abi: zoraCreator1155FactoryImplABI,
|
|
1096
|
+
functionName: "createContractDeterministic",
|
|
1097
|
+
account,
|
|
1098
|
+
address: zoraCreator1155FactoryImplAddress[999],
|
|
1099
|
+
args: [
|
|
1100
|
+
contract.uri,
|
|
1101
|
+
contract.name,
|
|
1102
|
+
{
|
|
1103
|
+
// deprecated
|
|
1104
|
+
royaltyMintSchedule: 0,
|
|
1105
|
+
royaltyBPS: royaltySettings?.royaltyBPS || ROYALTY_BPS_DEFAULT,
|
|
1106
|
+
royaltyRecipient: royaltySettings?.royaltyRecipient || account
|
|
1107
|
+
},
|
|
1108
|
+
contract.defaultAdmin || account,
|
|
1109
|
+
tokenSetupActions
|
|
1110
|
+
]
|
|
1111
|
+
};
|
|
1112
|
+
return {
|
|
1113
|
+
request,
|
|
1114
|
+
tokenSetupActions,
|
|
1115
|
+
contractAddress,
|
|
1116
|
+
contractExists
|
|
1117
|
+
};
|
|
1118
|
+
} else if (contractExists) {
|
|
1119
|
+
const request = {
|
|
1120
|
+
abi: zoraCreator1155ImplABI2,
|
|
1121
|
+
functionName: "multicall",
|
|
1122
|
+
account,
|
|
1123
|
+
address: contractAddress,
|
|
1124
|
+
args: [tokenSetupActions]
|
|
1125
|
+
};
|
|
1126
|
+
return {
|
|
1127
|
+
request,
|
|
1128
|
+
tokenSetupActions,
|
|
1129
|
+
contractAddress,
|
|
1130
|
+
contractExists
|
|
1131
|
+
};
|
|
1132
|
+
}
|
|
1133
|
+
throw new Error("Unsupported contract argument type");
|
|
964
1134
|
}
|
|
965
|
-
|
|
1135
|
+
return { createNew1155Token };
|
|
966
1136
|
}
|
|
967
1137
|
export {
|
|
968
1138
|
DEFAULT_SALE_SETTINGS,
|
|
969
1139
|
DefaultMintArguments,
|
|
1140
|
+
Errors,
|
|
970
1141
|
MintAPIClient,
|
|
971
1142
|
PremintAPIClient,
|
|
972
|
-
PremintClient,
|
|
973
1143
|
ZORA_API_BASE,
|
|
974
1144
|
convertCollection,
|
|
975
1145
|
convertPremint,
|
|
1146
|
+
create1155CreatorClient,
|
|
976
1147
|
create1155TokenSetupArgs,
|
|
977
|
-
|
|
1148
|
+
createMintClient,
|
|
1149
|
+
createPremintClient,
|
|
978
1150
|
encodePremintForAPI,
|
|
979
1151
|
getPremintedLogFromReceipt,
|
|
980
1152
|
getSalesConfigFixedPrice,
|