@zoralabs/protocol-sdk 0.5.10 → 0.5.12
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 +3 -3
- package/CHANGELOG.md +15 -0
- package/README.md +10 -0
- package/dist/create/1155-create-helper.d.ts +2 -2
- package/dist/create/1155-create-helper.d.ts.map +1 -1
- package/dist/index.cjs +136 -212
- 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 +135 -209
- package/dist/index.js.map +1 -1
- package/dist/mint/mint-client.d.ts +3 -4
- package/dist/mint/mint-client.d.ts.map +1 -1
- package/dist/mints/mints-contracts.d.ts +2868 -2027
- package/dist/mints/mints-contracts.d.ts.map +1 -1
- package/dist/mints/mints-eth-unwrapper-and-caller.d.ts +78 -0
- package/dist/mints/mints-eth-unwrapper-and-caller.d.ts.map +1 -0
- package/dist/mints/mints-relay-example.d.ts +60 -0
- package/dist/mints/mints-relay-example.d.ts.map +1 -0
- package/dist/premint/premint-client.d.ts +1 -1
- package/dist/premint/premint-client.d.ts.map +1 -1
- package/dist/preminter.d.ts +23 -11
- package/dist/preminter.d.ts.map +1 -1
- package/dist/test-utils.d.ts +11 -0
- package/dist/test-utils.d.ts.map +1 -0
- package/dist/utils.d.ts +3 -0
- package/dist/utils.d.ts.map +1 -0
- package/package.json +6 -4
- package/src/create/1155-create-helper.ts +14 -11
- package/src/index.ts +2 -0
- package/src/mint/mint-client.ts +16 -19
- package/src/mints/mints-contracts.test.ts +32 -225
- package/src/mints/mints-contracts.ts +200 -281
- package/src/mints/mints-eth-unwrapper-and-caller.test.ts +467 -0
- package/src/mints/mints-eth-unwrapper-and-caller.ts +83 -0
- package/src/mints/mints-relay-example.ts +313 -0
- package/src/premint/premint-client.ts +15 -11
- package/src/test-utils.ts +39 -0
- package/src/utils.ts +30 -0
package/dist/index.cjs
CHANGED
|
@@ -6795,9 +6795,7 @@ __export(src_exports, {
|
|
|
6795
6795
|
ZORA_API_BASE: () => ZORA_API_BASE,
|
|
6796
6796
|
applyUpdateToPremint: () => applyUpdateToPremint,
|
|
6797
6797
|
collectPremintV2WithMintsParams: () => collectPremintV2WithMintsParams,
|
|
6798
|
-
collectPremintWithMintsTypedDataDefinition: () => collectPremintWithMintsTypedDataDefinition,
|
|
6799
6798
|
collectWithMintsParams: () => collectWithMintsParams,
|
|
6800
|
-
collectWithMintsTypedDataDefinition: () => collectWithMintsTypedDataDefinition,
|
|
6801
6799
|
convertCollectionFromApi: () => convertCollectionFromApi,
|
|
6802
6800
|
convertGetPremintApiResponse: () => convertGetPremintApiResponse,
|
|
6803
6801
|
convertPremintFromApi: () => convertPremintFromApi,
|
|
@@ -6811,12 +6809,11 @@ __export(src_exports, {
|
|
|
6811
6809
|
encodeCollectOnManager: () => encodeCollectOnManager,
|
|
6812
6810
|
encodePostSignatureInput: () => encodePostSignatureInput,
|
|
6813
6811
|
encodePremintForAPI: () => encodePremintForAPI,
|
|
6814
|
-
encodePremintOnManager: () => encodePremintOnManager,
|
|
6815
|
-
fixedPriceMinterMinterArguments: () => fixedPriceMinterMinterArguments,
|
|
6816
6812
|
getApiNetworkConfigForChain: () => getApiNetworkConfigForChain,
|
|
6817
6813
|
getDefaultFixedPriceMinterAddress: () => getDefaultFixedPriceMinterAddress,
|
|
6818
6814
|
getMintCosts: () => getMintCosts,
|
|
6819
6815
|
getMintsAccountBalanceWithPriceQuery: () => getMintsAccountBalanceWithPriceQuery,
|
|
6816
|
+
getMintsEthPrice: () => getMintsEthPrice,
|
|
6820
6817
|
getPremintCollectionAddress: () => getPremintCollectionAddress,
|
|
6821
6818
|
getPremintExecutorAddress: () => getPremintExecutorAddress,
|
|
6822
6819
|
getPremintMintCosts: () => getPremintMintCosts,
|
|
@@ -6825,26 +6822,27 @@ __export(src_exports, {
|
|
|
6825
6822
|
getTokenIdFromCreateReceipt: () => getTokenIdFromCreateReceipt,
|
|
6826
6823
|
isAuthorizedToCreatePremint: () => isAuthorizedToCreatePremint,
|
|
6827
6824
|
isValidSignature: () => isValidSignature,
|
|
6825
|
+
makeCallWithEthSafeTransferData: () => makeCallWithEthSafeTransferData,
|
|
6828
6826
|
makeMintRewardsRecipient: () => makeMintRewardsRecipient,
|
|
6829
6827
|
makeNewPremint: () => makeNewPremint,
|
|
6828
|
+
makePermitToCollectPremintOrNonPremint: () => makePermitToCollectPremintOrNonPremint,
|
|
6829
|
+
makePermitTransferBatchAndTypeData: () => makePermitTransferBatchAndTypeData,
|
|
6830
|
+
makePermitTransferTypeData: () => makePermitTransferTypeData,
|
|
6830
6831
|
markPremintDeleted: () => markPremintDeleted,
|
|
6831
6832
|
migratePremintConfigToV2: () => migratePremintConfigToV2,
|
|
6832
6833
|
mintWithEthParams: () => mintWithEthParams,
|
|
6833
6834
|
mintsBalanceOfAccountParams: () => mintsBalanceOfAccountParams,
|
|
6834
6835
|
permitBatchTypedDataDefinition: () => permitBatchTypedDataDefinition,
|
|
6835
|
-
permitTransferBatchToManagerAndCallParams: () => permitTransferBatchToManagerAndCallParams,
|
|
6836
6836
|
permitTransferTypedDataDefinition: () => permitTransferTypedDataDefinition,
|
|
6837
6837
|
premintTypedDataDefinition: () => premintTypedDataDefinition,
|
|
6838
6838
|
recoverCreatorFromCreatorAttribution: () => recoverCreatorFromCreatorAttribution,
|
|
6839
6839
|
recoverPremintSigner: () => recoverPremintSigner,
|
|
6840
|
-
safeTransferAndUnwrapEthParams: () => safeTransferAndUnwrapEthParams,
|
|
6841
|
-
safeTransferAndUnwrapTypedDataDefinition: () => safeTransferAndUnwrapTypedDataDefinition,
|
|
6842
|
-
safeTransferBatchAndUnwrapTypedDataDefinition: () => safeTransferBatchAndUnwrapTypedDataDefinition,
|
|
6843
6840
|
selectMintsToCollectWithFromQueryResult: () => selectMintsToCollectWithFromQueryResult,
|
|
6844
6841
|
sumBalances: () => sumBalances,
|
|
6845
6842
|
supportedPremintVersions: () => supportedPremintVersions,
|
|
6846
6843
|
supportsPremintVersion: () => supportsPremintVersion,
|
|
6847
6844
|
tryRecoverPremintSigner: () => tryRecoverPremintSigner,
|
|
6845
|
+
unwrapAndForwardEthPermitAndTypedDataDefinition: () => unwrapAndForwardEthPermitAndTypedDataDefinition,
|
|
6848
6846
|
v1Types: () => v1Types,
|
|
6849
6847
|
v2Types: () => v2Types
|
|
6850
6848
|
});
|
|
@@ -7570,6 +7568,9 @@ var PremintAPIClient = class {
|
|
|
7570
7568
|
}
|
|
7571
7569
|
};
|
|
7572
7570
|
|
|
7571
|
+
// src/utils.ts
|
|
7572
|
+
var makeSimulateContractParamaters = (args) => args;
|
|
7573
|
+
|
|
7573
7574
|
// src/premint/premint-client.ts
|
|
7574
7575
|
var defaultTokenConfigV1MintArguments = () => ({
|
|
7575
7576
|
maxSupply: OPEN_EDITION_MINT_SIZE,
|
|
@@ -7932,7 +7933,7 @@ var PremintClient = class {
|
|
|
7932
7933
|
})
|
|
7933
7934
|
};
|
|
7934
7935
|
if (premintConfigVersion === "1" /* V1 */) {
|
|
7935
|
-
return {
|
|
7936
|
+
return makeSimulateContractParamaters({
|
|
7936
7937
|
account: minterAccount,
|
|
7937
7938
|
abi: import_protocol_deployments2.zoraCreator1155PremintExecutorImplABI,
|
|
7938
7939
|
functionName: "premintV1",
|
|
@@ -7945,9 +7946,9 @@ var PremintClient = class {
|
|
|
7945
7946
|
numberToMint,
|
|
7946
7947
|
mintArgumentsContract
|
|
7947
7948
|
]
|
|
7948
|
-
};
|
|
7949
|
+
});
|
|
7949
7950
|
} else if (premintConfigVersion === "2" /* V2 */) {
|
|
7950
|
-
return {
|
|
7951
|
+
return makeSimulateContractParamaters({
|
|
7951
7952
|
account: minterAccount,
|
|
7952
7953
|
abi: import_protocol_deployments2.zoraCreator1155PremintExecutorImplABI,
|
|
7953
7954
|
functionName: "premintV2",
|
|
@@ -7960,7 +7961,7 @@ var PremintClient = class {
|
|
|
7960
7961
|
numberToMint,
|
|
7961
7962
|
mintArgumentsContract
|
|
7962
7963
|
]
|
|
7963
|
-
};
|
|
7964
|
+
});
|
|
7964
7965
|
}
|
|
7965
7966
|
throw new Error(`Invalid premint config version ${premintConfigVersion}`);
|
|
7966
7967
|
}
|
|
@@ -8111,7 +8112,7 @@ async function makePrepareMint721TokenParams({
|
|
|
8111
8112
|
salesConfigAndTokenInfo,
|
|
8112
8113
|
quantityToMint: BigInt(mintArguments.quantityToMint)
|
|
8113
8114
|
}).totalCost;
|
|
8114
|
-
|
|
8115
|
+
return makeSimulateContractParamaters({
|
|
8115
8116
|
abi: zora721Abi,
|
|
8116
8117
|
address: tokenAddress,
|
|
8117
8118
|
account: minterAccount,
|
|
@@ -8123,8 +8124,7 @@ async function makePrepareMint721TokenParams({
|
|
|
8123
8124
|
mintArguments.mintComment || "",
|
|
8124
8125
|
mintArguments.mintReferral || import_viem5.zeroAddress
|
|
8125
8126
|
]
|
|
8126
|
-
};
|
|
8127
|
-
return result;
|
|
8127
|
+
});
|
|
8128
8128
|
}
|
|
8129
8129
|
function getMintCosts({
|
|
8130
8130
|
salesConfigAndTokenInfo,
|
|
@@ -8150,7 +8150,7 @@ async function makePrepareMint1155TokenParams({
|
|
|
8150
8150
|
salesConfigAndTokenInfo,
|
|
8151
8151
|
quantityToMint: mintQuantity
|
|
8152
8152
|
}).totalCost;
|
|
8153
|
-
|
|
8153
|
+
return makeSimulateContractParamaters({
|
|
8154
8154
|
abi: import_protocol_deployments3.zoraCreator1155ImplABI,
|
|
8155
8155
|
functionName: "mintWithRewards",
|
|
8156
8156
|
account: minterAccount,
|
|
@@ -8167,8 +8167,7 @@ async function makePrepareMint1155TokenParams({
|
|
|
8167
8167
|
]),
|
|
8168
8168
|
mintArguments.mintReferral || import_viem5.zeroAddress
|
|
8169
8169
|
]
|
|
8170
|
-
};
|
|
8171
|
-
return result;
|
|
8170
|
+
});
|
|
8172
8171
|
}
|
|
8173
8172
|
|
|
8174
8173
|
// src/create/1155-create-helper.ts
|
|
@@ -8376,7 +8375,7 @@ function create1155CreatorClient({
|
|
|
8376
8375
|
throw new Error("Invariant: contract cannot be missing and an address");
|
|
8377
8376
|
}
|
|
8378
8377
|
if (!contractExists && typeof contract !== "string") {
|
|
8379
|
-
const request = {
|
|
8378
|
+
const request = makeSimulateContractParamaters({
|
|
8380
8379
|
abi: import_protocol_deployments4.zoraCreator1155FactoryImplABI,
|
|
8381
8380
|
functionName: "createContractDeterministic",
|
|
8382
8381
|
account,
|
|
@@ -8393,7 +8392,7 @@ function create1155CreatorClient({
|
|
|
8393
8392
|
contract.defaultAdmin || account,
|
|
8394
8393
|
tokenSetupActions
|
|
8395
8394
|
]
|
|
8396
|
-
};
|
|
8395
|
+
});
|
|
8397
8396
|
return {
|
|
8398
8397
|
request,
|
|
8399
8398
|
tokenSetupActions,
|
|
@@ -8401,13 +8400,13 @@ function create1155CreatorClient({
|
|
|
8401
8400
|
contractExists
|
|
8402
8401
|
};
|
|
8403
8402
|
} else if (contractExists) {
|
|
8404
|
-
const request = {
|
|
8403
|
+
const request = makeSimulateContractParamaters({
|
|
8405
8404
|
abi: import_protocol_deployments4.zoraCreator1155ImplABI,
|
|
8406
8405
|
functionName: "multicall",
|
|
8407
8406
|
account,
|
|
8408
8407
|
address: contractAddress,
|
|
8409
8408
|
args: [tokenSetupActions]
|
|
8410
|
-
};
|
|
8409
|
+
});
|
|
8411
8410
|
return {
|
|
8412
8411
|
request,
|
|
8413
8412
|
tokenSetupActions,
|
|
@@ -11743,30 +11742,26 @@ var sumBalances = (mintAccountBalances) => {
|
|
|
11743
11742
|
// src/mints/mints-contracts.ts
|
|
11744
11743
|
var import_protocol_deployments5 = require("@zoralabs/protocol-deployments");
|
|
11745
11744
|
var import_viem7 = require("viem");
|
|
11746
|
-
|
|
11745
|
+
var addressOrAccountAddress = (address) => typeof address === "string" ? address : address.address;
|
|
11746
|
+
var mintWithEthParams = ({
|
|
11747
11747
|
quantity,
|
|
11748
11748
|
recipient,
|
|
11749
11749
|
chainId,
|
|
11750
11750
|
pricePerMint,
|
|
11751
11751
|
account
|
|
11752
|
-
}) {
|
|
11753
|
-
|
|
11754
|
-
|
|
11755
|
-
|
|
11756
|
-
|
|
11757
|
-
|
|
11758
|
-
|
|
11759
|
-
|
|
11760
|
-
};
|
|
11761
|
-
}
|
|
11752
|
+
}) => makeSimulateContractParamaters({
|
|
11753
|
+
abi: import_protocol_deployments5.zoraMintsManagerImplConfig.abi,
|
|
11754
|
+
address: import_protocol_deployments5.zoraMintsManagerImplConfig.address[chainId],
|
|
11755
|
+
functionName: "mintWithEth",
|
|
11756
|
+
args: [quantity, recipient || addressOrAccountAddress(account)],
|
|
11757
|
+
value: pricePerMint * quantity,
|
|
11758
|
+
account
|
|
11759
|
+
});
|
|
11762
11760
|
var getPaidMintValue = (quantities, pricePerMint) => {
|
|
11763
11761
|
if (!pricePerMint || pricePerMint === 0n)
|
|
11764
11762
|
return;
|
|
11765
11763
|
return quantities.reduce((a, b) => a + b, 0n) * pricePerMint;
|
|
11766
11764
|
};
|
|
11767
|
-
var fixedPriceMinterMinterArguments = ({
|
|
11768
|
-
mintRecipient
|
|
11769
|
-
}) => (0, import_viem7.encodeAbiParameters)((0, import_viem7.parseAbiParameters)("address"), [mintRecipient]);
|
|
11770
11765
|
var mintsBalanceOfAccountParams = ({
|
|
11771
11766
|
account,
|
|
11772
11767
|
chainId
|
|
@@ -11795,88 +11790,57 @@ function collectWithMintsParams({
|
|
|
11795
11790
|
tokenIds,
|
|
11796
11791
|
quantities,
|
|
11797
11792
|
chainId,
|
|
11798
|
-
|
|
11793
|
+
paidMintPricePerToken,
|
|
11799
11794
|
account,
|
|
11800
|
-
|
|
11795
|
+
mintArguments,
|
|
11796
|
+
minter,
|
|
11797
|
+
zoraCreator1155Contract,
|
|
11798
|
+
zoraCreator1155TokenId
|
|
11801
11799
|
}) {
|
|
11802
11800
|
const call = encodeCollectOnManager({
|
|
11803
11801
|
tokenIds,
|
|
11804
11802
|
quantities,
|
|
11805
|
-
|
|
11803
|
+
zoraCreator1155Contract,
|
|
11804
|
+
zoraCreator1155TokenId,
|
|
11805
|
+
minter,
|
|
11806
|
+
mintArguments
|
|
11806
11807
|
});
|
|
11807
|
-
return {
|
|
11808
|
+
return makeSimulateContractParamaters({
|
|
11808
11809
|
abi: import_protocol_deployments5.zoraMints1155Config.abi,
|
|
11809
11810
|
address: import_protocol_deployments5.zoraMints1155Config.address[chainId],
|
|
11810
11811
|
functionName: "transferBatchToManagerAndCall",
|
|
11811
11812
|
args: [tokenIds, quantities, call],
|
|
11812
|
-
|
|
11813
|
+
// if it is a paid mint, the aadditional value will be sent to the manager contract and forwarded to the creator 1155 contract
|
|
11814
|
+
// for the paid mint cost.
|
|
11815
|
+
value: getPaidMintValue(quantities, paidMintPricePerToken),
|
|
11813
11816
|
account
|
|
11814
|
-
};
|
|
11815
|
-
}
|
|
11816
|
-
var collectWithMintsTypedDataDefinition = ({
|
|
11817
|
-
tokenIds,
|
|
11818
|
-
quantities,
|
|
11819
|
-
chainId,
|
|
11820
|
-
account,
|
|
11821
|
-
nonce,
|
|
11822
|
-
deadline,
|
|
11823
|
-
...rest
|
|
11824
|
-
}) => {
|
|
11825
|
-
const safeTransferData = encodeCollectOnManager({
|
|
11826
|
-
tokenIds,
|
|
11827
|
-
quantities,
|
|
11828
|
-
...rest
|
|
11829
|
-
});
|
|
11830
|
-
return makePermitTransferBatchAndTypeData({
|
|
11831
|
-
tokenIds,
|
|
11832
|
-
quantities,
|
|
11833
|
-
chainId,
|
|
11834
|
-
account,
|
|
11835
|
-
nonce,
|
|
11836
|
-
deadline,
|
|
11837
|
-
safeTransferData,
|
|
11838
|
-
// will safe transfer to manager contract before doing the
|
|
11839
|
-
// collect operation
|
|
11840
|
-
to: import_protocol_deployments5.zoraMintsManagerImplConfig.address[chainId]
|
|
11841
|
-
});
|
|
11842
|
-
};
|
|
11843
|
-
var collectPremintWithMintsTypedDataDefinition = ({
|
|
11844
|
-
tokenIds,
|
|
11845
|
-
quantities,
|
|
11846
|
-
chainId,
|
|
11847
|
-
account,
|
|
11848
|
-
nonce,
|
|
11849
|
-
deadline,
|
|
11850
|
-
...rest
|
|
11851
|
-
}) => {
|
|
11852
|
-
const safeTransferData = encodePremintOnManager({
|
|
11853
|
-
...rest
|
|
11854
11817
|
});
|
|
11855
|
-
|
|
11856
|
-
|
|
11857
|
-
|
|
11858
|
-
|
|
11859
|
-
|
|
11860
|
-
|
|
11861
|
-
|
|
11862
|
-
|
|
11863
|
-
|
|
11864
|
-
|
|
11865
|
-
|
|
11818
|
+
}
|
|
11819
|
+
function getMintsEthPrice({
|
|
11820
|
+
publicClient
|
|
11821
|
+
}) {
|
|
11822
|
+
const chainId = publicClient.chain?.id;
|
|
11823
|
+
if (!chainId || !import_protocol_deployments5.zoraMintsManagerImplAddress[chainId]) {
|
|
11824
|
+
throw new Error(`Chain id ${chainId} not supported`);
|
|
11825
|
+
}
|
|
11826
|
+
return publicClient.readContract({
|
|
11827
|
+
abi: import_protocol_deployments5.zoraMintsManagerImplABI,
|
|
11828
|
+
address: import_protocol_deployments5.zoraMintsManagerImplAddress[chainId],
|
|
11829
|
+
functionName: "getEthPrice"
|
|
11866
11830
|
});
|
|
11867
|
-
}
|
|
11831
|
+
}
|
|
11868
11832
|
function makePermitTransferBatchAndTypeData({
|
|
11869
11833
|
tokenIds,
|
|
11870
11834
|
quantities,
|
|
11871
11835
|
chainId,
|
|
11872
|
-
|
|
11836
|
+
mintsOwner,
|
|
11873
11837
|
to,
|
|
11874
11838
|
nonce,
|
|
11875
11839
|
deadline,
|
|
11876
11840
|
safeTransferData
|
|
11877
11841
|
}) {
|
|
11878
11842
|
const permit = {
|
|
11879
|
-
owner: typeof
|
|
11843
|
+
owner: typeof mintsOwner === "string" ? mintsOwner : mintsOwner.address,
|
|
11880
11844
|
to,
|
|
11881
11845
|
tokenIds,
|
|
11882
11846
|
quantities,
|
|
@@ -11887,7 +11851,7 @@ function makePermitTransferBatchAndTypeData({
|
|
|
11887
11851
|
const typedData = permitBatchTypedDataDefinition({
|
|
11888
11852
|
chainId,
|
|
11889
11853
|
permit,
|
|
11890
|
-
account
|
|
11854
|
+
account: mintsOwner
|
|
11891
11855
|
});
|
|
11892
11856
|
return {
|
|
11893
11857
|
permit,
|
|
@@ -11898,14 +11862,14 @@ function makePermitTransferTypeData({
|
|
|
11898
11862
|
tokenId,
|
|
11899
11863
|
quantity,
|
|
11900
11864
|
chainId,
|
|
11901
|
-
|
|
11865
|
+
mintsOwner,
|
|
11902
11866
|
to,
|
|
11903
11867
|
nonce,
|
|
11904
11868
|
deadline,
|
|
11905
11869
|
safeTransferData
|
|
11906
11870
|
}) {
|
|
11907
11871
|
const permit = {
|
|
11908
|
-
owner: typeof
|
|
11872
|
+
owner: typeof mintsOwner === "string" ? mintsOwner : mintsOwner.address,
|
|
11909
11873
|
to,
|
|
11910
11874
|
tokenId,
|
|
11911
11875
|
quantity,
|
|
@@ -11916,7 +11880,7 @@ function makePermitTransferTypeData({
|
|
|
11916
11880
|
const typedData = permitTransferTypedDataDefinition({
|
|
11917
11881
|
chainId,
|
|
11918
11882
|
permit,
|
|
11919
|
-
account
|
|
11883
|
+
account: mintsOwner
|
|
11920
11884
|
});
|
|
11921
11885
|
return {
|
|
11922
11886
|
permit,
|
|
@@ -11940,10 +11904,42 @@ var encodePremintOnManager = ({
|
|
|
11940
11904
|
signerContract
|
|
11941
11905
|
]
|
|
11942
11906
|
});
|
|
11907
|
+
var makePermitToCollectPremintOrNonPremint = ({
|
|
11908
|
+
mintsOwner,
|
|
11909
|
+
chainId,
|
|
11910
|
+
deadline,
|
|
11911
|
+
tokenIds,
|
|
11912
|
+
// this quantity of MINTs will be used to collect premint
|
|
11913
|
+
// and will be burned. This same quantity is the quantity of
|
|
11914
|
+
// premint to collect.
|
|
11915
|
+
quantities,
|
|
11916
|
+
nonce,
|
|
11917
|
+
premint,
|
|
11918
|
+
collect
|
|
11919
|
+
}) => {
|
|
11920
|
+
let safeTransferData;
|
|
11921
|
+
if (premint) {
|
|
11922
|
+
safeTransferData = encodePremintOnManager(premint);
|
|
11923
|
+
} else if (collect) {
|
|
11924
|
+
safeTransferData = encodeCollectOnManager(collect);
|
|
11925
|
+
} else {
|
|
11926
|
+
throw new Error("Invalid operation");
|
|
11927
|
+
}
|
|
11928
|
+
return makePermitTransferBatchAndTypeData({
|
|
11929
|
+
tokenIds,
|
|
11930
|
+
quantities,
|
|
11931
|
+
chainId,
|
|
11932
|
+
mintsOwner,
|
|
11933
|
+
nonce,
|
|
11934
|
+
deadline,
|
|
11935
|
+
safeTransferData,
|
|
11936
|
+
to: import_protocol_deployments5.zoraMintsManagerImplConfig.address[chainId]
|
|
11937
|
+
});
|
|
11938
|
+
};
|
|
11943
11939
|
function collectPremintV2WithMintsParams({
|
|
11944
11940
|
tokenIds,
|
|
11945
11941
|
quantities,
|
|
11946
|
-
|
|
11942
|
+
paidMintPricePerToken,
|
|
11947
11943
|
account,
|
|
11948
11944
|
chainId,
|
|
11949
11945
|
...rest
|
|
@@ -11951,14 +11947,14 @@ function collectPremintV2WithMintsParams({
|
|
|
11951
11947
|
const call = encodePremintOnManager({
|
|
11952
11948
|
...rest
|
|
11953
11949
|
});
|
|
11954
|
-
return {
|
|
11950
|
+
return makeSimulateContractParamaters({
|
|
11955
11951
|
abi: import_protocol_deployments5.zoraMints1155Config.abi,
|
|
11956
11952
|
address: import_protocol_deployments5.zoraMints1155Config.address[chainId],
|
|
11957
11953
|
functionName: "transferBatchToManagerAndCall",
|
|
11958
11954
|
args: [tokenIds, quantities, call],
|
|
11959
|
-
value: getPaidMintValue(quantities,
|
|
11955
|
+
value: getPaidMintValue(quantities, paidMintPricePerToken),
|
|
11960
11956
|
account
|
|
11961
|
-
};
|
|
11957
|
+
});
|
|
11962
11958
|
}
|
|
11963
11959
|
function makeTypeData(args) {
|
|
11964
11960
|
return args;
|
|
@@ -12063,117 +12059,47 @@ function permitTransferTypedDataDefinition({
|
|
|
12063
12059
|
account
|
|
12064
12060
|
});
|
|
12065
12061
|
}
|
|
12066
|
-
|
|
12067
|
-
|
|
12068
|
-
|
|
12069
|
-
|
|
12070
|
-
|
|
12071
|
-
|
|
12072
|
-
|
|
12073
|
-
address: import_protocol_deployments5.zoraMints1155Config.address[chainId],
|
|
12074
|
-
functionName: "permitSafeTransferBatch",
|
|
12075
|
-
args: [permit, signature]
|
|
12076
|
-
};
|
|
12077
|
-
return result;
|
|
12078
|
-
};
|
|
12079
|
-
var safeTransferAndUnwrapTypedDataDefinition = ({
|
|
12080
|
-
chainId,
|
|
12081
|
-
tokenId,
|
|
12082
|
-
quantity,
|
|
12083
|
-
from,
|
|
12084
|
-
addressToCall,
|
|
12085
|
-
functionToCall,
|
|
12086
|
-
valueToSend,
|
|
12087
|
-
deadline,
|
|
12088
|
-
nonce
|
|
12089
|
-
}) => {
|
|
12090
|
-
const callArgument = (0, import_viem7.encodeFunctionData)({
|
|
12091
|
-
abi: import_protocol_deployments5.iUnwrapAndForwardActionABI,
|
|
12092
|
-
functionName: "callWithEth",
|
|
12093
|
-
args: [addressToCall, functionToCall, valueToSend]
|
|
12094
|
-
});
|
|
12095
|
-
return makePermitTransferTypeData({
|
|
12096
|
-
account: from,
|
|
12097
|
-
chainId,
|
|
12098
|
-
deadline,
|
|
12099
|
-
tokenId,
|
|
12100
|
-
quantity,
|
|
12101
|
-
safeTransferData: callArgument,
|
|
12102
|
-
to: import_protocol_deployments5.mintsEthUnwrapperAndCallerConfig.address[chainId],
|
|
12103
|
-
nonce
|
|
12062
|
+
function decodeCallFailedError(error) {
|
|
12063
|
+
if (error.data?.errorName !== "CallFailed")
|
|
12064
|
+
throw new Error("Not a CallFailed error");
|
|
12065
|
+
const internalErrorData = error.data?.args?.[0];
|
|
12066
|
+
return (0, import_viem7.decodeErrorResult)({
|
|
12067
|
+
abi: import_protocol_deployments5.zoraMintsManagerImplABI,
|
|
12068
|
+
data: internalErrorData
|
|
12104
12069
|
});
|
|
12105
|
-
}
|
|
12106
|
-
|
|
12070
|
+
}
|
|
12071
|
+
|
|
12072
|
+
// src/mints/mints-eth-unwrapper-and-caller.ts
|
|
12073
|
+
var import_protocol_deployments6 = require("@zoralabs/protocol-deployments");
|
|
12074
|
+
var import_viem8 = require("viem");
|
|
12075
|
+
var makeCallWithEthSafeTransferData = ({
|
|
12076
|
+
address: addressToCall,
|
|
12077
|
+
call: functionToCall,
|
|
12078
|
+
value: valueToSend
|
|
12079
|
+
}) => (0, import_viem8.encodeFunctionData)({
|
|
12080
|
+
abi: import_protocol_deployments6.iUnwrapAndForwardActionABI,
|
|
12081
|
+
functionName: "callWithEth",
|
|
12082
|
+
args: [addressToCall, functionToCall, valueToSend]
|
|
12083
|
+
});
|
|
12084
|
+
var unwrapAndForwardEthPermitAndTypedDataDefinition = ({
|
|
12107
12085
|
chainId,
|
|
12108
12086
|
tokenIds,
|
|
12109
12087
|
quantities,
|
|
12110
12088
|
from,
|
|
12111
|
-
|
|
12112
|
-
|
|
12113
|
-
valueToSend,
|
|
12089
|
+
callWithEth,
|
|
12090
|
+
safeTransferData,
|
|
12114
12091
|
deadline,
|
|
12115
12092
|
nonce
|
|
12116
|
-
}) => {
|
|
12117
|
-
|
|
12118
|
-
abi: import_protocol_deployments5.iUnwrapAndForwardActionABI,
|
|
12119
|
-
functionName: "callWithEth",
|
|
12120
|
-
args: [addressToCall, functionToCall, valueToSend]
|
|
12121
|
-
});
|
|
12122
|
-
return makePermitTransferBatchAndTypeData({
|
|
12123
|
-
account: from,
|
|
12124
|
-
chainId,
|
|
12125
|
-
deadline,
|
|
12126
|
-
tokenIds,
|
|
12127
|
-
quantities,
|
|
12128
|
-
safeTransferData: callArgument,
|
|
12129
|
-
to: import_protocol_deployments5.mintsEthUnwrapperAndCallerConfig.address[chainId],
|
|
12130
|
-
nonce
|
|
12131
|
-
});
|
|
12132
|
-
};
|
|
12133
|
-
var safeTransferAndUnwrapEthParams = ({
|
|
12093
|
+
}) => makePermitTransferBatchAndTypeData({
|
|
12094
|
+
mintsOwner: from,
|
|
12134
12095
|
chainId,
|
|
12096
|
+
deadline,
|
|
12135
12097
|
tokenIds,
|
|
12136
12098
|
quantities,
|
|
12137
|
-
|
|
12138
|
-
|
|
12139
|
-
|
|
12140
|
-
|
|
12141
|
-
}) => {
|
|
12142
|
-
const callArgument = (0, import_viem7.encodeFunctionData)({
|
|
12143
|
-
abi: import_protocol_deployments5.iUnwrapAndForwardActionABI,
|
|
12144
|
-
functionName: "callWithEth",
|
|
12145
|
-
args: [addressToCall, functionToCall, valueToSend]
|
|
12146
|
-
});
|
|
12147
|
-
const result = {
|
|
12148
|
-
abi: import_protocol_deployments5.zoraMints1155Config.abi,
|
|
12149
|
-
functionName: "safeBatchTransferFrom",
|
|
12150
|
-
address: import_protocol_deployments5.zoraMints1155Config.address[chainId],
|
|
12151
|
-
args: [
|
|
12152
|
-
typeof from === "string" ? from : from.address,
|
|
12153
|
-
// the mints will be transferred to this address, which
|
|
12154
|
-
// will burn/redeem their eth value
|
|
12155
|
-
import_protocol_deployments5.mintsEthUnwrapperAndCallerConfig.address[chainId],
|
|
12156
|
-
// token ids to transfer/burn/unwrap - must be eth based tokens
|
|
12157
|
-
tokenIds,
|
|
12158
|
-
// quantities to transfer/burn/unwrap
|
|
12159
|
-
quantities,
|
|
12160
|
-
// this is the safeTransferData - which gets forwarded to the eth transferrer
|
|
12161
|
-
callArgument
|
|
12162
|
-
],
|
|
12163
|
-
// the account whos mints will be transferred from
|
|
12164
|
-
account: from
|
|
12165
|
-
};
|
|
12166
|
-
return result;
|
|
12167
|
-
};
|
|
12168
|
-
function decodeCallFailedError(error) {
|
|
12169
|
-
if (error.data?.errorName !== "CallFailed")
|
|
12170
|
-
throw new Error("Not a CallFailed error");
|
|
12171
|
-
const internalErrorData = error.data?.args?.[0];
|
|
12172
|
-
return (0, import_viem7.decodeErrorResult)({
|
|
12173
|
-
abi: import_protocol_deployments5.zoraMintsManagerImplABI,
|
|
12174
|
-
data: internalErrorData
|
|
12175
|
-
});
|
|
12176
|
-
}
|
|
12099
|
+
safeTransferData: safeTransferData || makeCallWithEthSafeTransferData(callWithEth),
|
|
12100
|
+
to: import_protocol_deployments6.mintsEthUnwrapperAndCallerAddress[chainId],
|
|
12101
|
+
nonce
|
|
12102
|
+
});
|
|
12177
12103
|
// Annotate the CommonJS export names for ESM import in node:
|
|
12178
12104
|
0 && (module.exports = {
|
|
12179
12105
|
DEFAULT_SALE_SETTINGS,
|
|
@@ -12185,9 +12111,7 @@ function decodeCallFailedError(error) {
|
|
|
12185
12111
|
ZORA_API_BASE,
|
|
12186
12112
|
applyUpdateToPremint,
|
|
12187
12113
|
collectPremintV2WithMintsParams,
|
|
12188
|
-
collectPremintWithMintsTypedDataDefinition,
|
|
12189
12114
|
collectWithMintsParams,
|
|
12190
|
-
collectWithMintsTypedDataDefinition,
|
|
12191
12115
|
convertCollectionFromApi,
|
|
12192
12116
|
convertGetPremintApiResponse,
|
|
12193
12117
|
convertPremintFromApi,
|
|
@@ -12201,12 +12125,11 @@ function decodeCallFailedError(error) {
|
|
|
12201
12125
|
encodeCollectOnManager,
|
|
12202
12126
|
encodePostSignatureInput,
|
|
12203
12127
|
encodePremintForAPI,
|
|
12204
|
-
encodePremintOnManager,
|
|
12205
|
-
fixedPriceMinterMinterArguments,
|
|
12206
12128
|
getApiNetworkConfigForChain,
|
|
12207
12129
|
getDefaultFixedPriceMinterAddress,
|
|
12208
12130
|
getMintCosts,
|
|
12209
12131
|
getMintsAccountBalanceWithPriceQuery,
|
|
12132
|
+
getMintsEthPrice,
|
|
12210
12133
|
getPremintCollectionAddress,
|
|
12211
12134
|
getPremintExecutorAddress,
|
|
12212
12135
|
getPremintMintCosts,
|
|
@@ -12215,26 +12138,27 @@ function decodeCallFailedError(error) {
|
|
|
12215
12138
|
getTokenIdFromCreateReceipt,
|
|
12216
12139
|
isAuthorizedToCreatePremint,
|
|
12217
12140
|
isValidSignature,
|
|
12141
|
+
makeCallWithEthSafeTransferData,
|
|
12218
12142
|
makeMintRewardsRecipient,
|
|
12219
12143
|
makeNewPremint,
|
|
12144
|
+
makePermitToCollectPremintOrNonPremint,
|
|
12145
|
+
makePermitTransferBatchAndTypeData,
|
|
12146
|
+
makePermitTransferTypeData,
|
|
12220
12147
|
markPremintDeleted,
|
|
12221
12148
|
migratePremintConfigToV2,
|
|
12222
12149
|
mintWithEthParams,
|
|
12223
12150
|
mintsBalanceOfAccountParams,
|
|
12224
12151
|
permitBatchTypedDataDefinition,
|
|
12225
|
-
permitTransferBatchToManagerAndCallParams,
|
|
12226
12152
|
permitTransferTypedDataDefinition,
|
|
12227
12153
|
premintTypedDataDefinition,
|
|
12228
12154
|
recoverCreatorFromCreatorAttribution,
|
|
12229
12155
|
recoverPremintSigner,
|
|
12230
|
-
safeTransferAndUnwrapEthParams,
|
|
12231
|
-
safeTransferAndUnwrapTypedDataDefinition,
|
|
12232
|
-
safeTransferBatchAndUnwrapTypedDataDefinition,
|
|
12233
12156
|
selectMintsToCollectWithFromQueryResult,
|
|
12234
12157
|
sumBalances,
|
|
12235
12158
|
supportedPremintVersions,
|
|
12236
12159
|
supportsPremintVersion,
|
|
12237
12160
|
tryRecoverPremintSigner,
|
|
12161
|
+
unwrapAndForwardEthPermitAndTypedDataDefinition,
|
|
12238
12162
|
v1Types,
|
|
12239
12163
|
v2Types
|
|
12240
12164
|
});
|