@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.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AAEzC,cAAc,qBAAqB,CAAC;AAEpC,cAAc,0BAA0B,CAAC;AAEzC,cAAc,8BAA8B,CAAC;AAE7C,cAAc,uBAAuB,CAAC;AAEtC,cAAc,wBAAwB,CAAC;AAEvC,cAAc,oBAAoB,CAAC;AAEnC,cAAc,6BAA6B,CAAC;AAE5C,cAAc,uBAAuB,CAAC;AAEtC,cAAc,yBAAyB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AAEzC,cAAc,qBAAqB,CAAC;AAEpC,cAAc,0BAA0B,CAAC;AAEzC,cAAc,8BAA8B,CAAC;AAE7C,cAAc,uBAAuB,CAAC;AAEtC,cAAc,wBAAwB,CAAC;AAEvC,cAAc,oBAAoB,CAAC;AAEnC,cAAc,6BAA6B,CAAC;AAE5C,cAAc,uBAAuB,CAAC;AAEtC,cAAc,yBAAyB,CAAC;AAExC,cAAc,wCAAwC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -7531,6 +7531,9 @@ var PremintAPIClient = class {
|
|
|
7531
7531
|
}
|
|
7532
7532
|
};
|
|
7533
7533
|
|
|
7534
|
+
// src/utils.ts
|
|
7535
|
+
var makeSimulateContractParamaters = (args) => args;
|
|
7536
|
+
|
|
7534
7537
|
// src/premint/premint-client.ts
|
|
7535
7538
|
var defaultTokenConfigV1MintArguments = () => ({
|
|
7536
7539
|
maxSupply: OPEN_EDITION_MINT_SIZE,
|
|
@@ -7893,7 +7896,7 @@ var PremintClient = class {
|
|
|
7893
7896
|
})
|
|
7894
7897
|
};
|
|
7895
7898
|
if (premintConfigVersion === "1" /* V1 */) {
|
|
7896
|
-
return {
|
|
7899
|
+
return makeSimulateContractParamaters({
|
|
7897
7900
|
account: minterAccount,
|
|
7898
7901
|
abi: zoraCreator1155PremintExecutorImplABI2,
|
|
7899
7902
|
functionName: "premintV1",
|
|
@@ -7906,9 +7909,9 @@ var PremintClient = class {
|
|
|
7906
7909
|
numberToMint,
|
|
7907
7910
|
mintArgumentsContract
|
|
7908
7911
|
]
|
|
7909
|
-
};
|
|
7912
|
+
});
|
|
7910
7913
|
} else if (premintConfigVersion === "2" /* V2 */) {
|
|
7911
|
-
return {
|
|
7914
|
+
return makeSimulateContractParamaters({
|
|
7912
7915
|
account: minterAccount,
|
|
7913
7916
|
abi: zoraCreator1155PremintExecutorImplABI2,
|
|
7914
7917
|
functionName: "premintV2",
|
|
@@ -7921,7 +7924,7 @@ var PremintClient = class {
|
|
|
7921
7924
|
numberToMint,
|
|
7922
7925
|
mintArgumentsContract
|
|
7923
7926
|
]
|
|
7924
|
-
};
|
|
7927
|
+
});
|
|
7925
7928
|
}
|
|
7926
7929
|
throw new Error(`Invalid premint config version ${premintConfigVersion}`);
|
|
7927
7930
|
}
|
|
@@ -8081,7 +8084,7 @@ async function makePrepareMint721TokenParams({
|
|
|
8081
8084
|
salesConfigAndTokenInfo,
|
|
8082
8085
|
quantityToMint: BigInt(mintArguments.quantityToMint)
|
|
8083
8086
|
}).totalCost;
|
|
8084
|
-
|
|
8087
|
+
return makeSimulateContractParamaters({
|
|
8085
8088
|
abi: zora721Abi,
|
|
8086
8089
|
address: tokenAddress,
|
|
8087
8090
|
account: minterAccount,
|
|
@@ -8093,8 +8096,7 @@ async function makePrepareMint721TokenParams({
|
|
|
8093
8096
|
mintArguments.mintComment || "",
|
|
8094
8097
|
mintArguments.mintReferral || zeroAddress3
|
|
8095
8098
|
]
|
|
8096
|
-
};
|
|
8097
|
-
return result;
|
|
8099
|
+
});
|
|
8098
8100
|
}
|
|
8099
8101
|
function getMintCosts({
|
|
8100
8102
|
salesConfigAndTokenInfo,
|
|
@@ -8120,7 +8122,7 @@ async function makePrepareMint1155TokenParams({
|
|
|
8120
8122
|
salesConfigAndTokenInfo,
|
|
8121
8123
|
quantityToMint: mintQuantity
|
|
8122
8124
|
}).totalCost;
|
|
8123
|
-
|
|
8125
|
+
return makeSimulateContractParamaters({
|
|
8124
8126
|
abi: zoraCreator1155ImplABI2,
|
|
8125
8127
|
functionName: "mintWithRewards",
|
|
8126
8128
|
account: minterAccount,
|
|
@@ -8137,8 +8139,7 @@ async function makePrepareMint1155TokenParams({
|
|
|
8137
8139
|
]),
|
|
8138
8140
|
mintArguments.mintReferral || zeroAddress3
|
|
8139
8141
|
]
|
|
8140
|
-
};
|
|
8141
|
-
return result;
|
|
8142
|
+
});
|
|
8142
8143
|
}
|
|
8143
8144
|
|
|
8144
8145
|
// src/create/1155-create-helper.ts
|
|
@@ -8351,7 +8352,7 @@ function create1155CreatorClient({
|
|
|
8351
8352
|
throw new Error("Invariant: contract cannot be missing and an address");
|
|
8352
8353
|
}
|
|
8353
8354
|
if (!contractExists && typeof contract !== "string") {
|
|
8354
|
-
const request = {
|
|
8355
|
+
const request = makeSimulateContractParamaters({
|
|
8355
8356
|
abi: zoraCreator1155FactoryImplABI,
|
|
8356
8357
|
functionName: "createContractDeterministic",
|
|
8357
8358
|
account,
|
|
@@ -8368,7 +8369,7 @@ function create1155CreatorClient({
|
|
|
8368
8369
|
contract.defaultAdmin || account,
|
|
8369
8370
|
tokenSetupActions
|
|
8370
8371
|
]
|
|
8371
|
-
};
|
|
8372
|
+
});
|
|
8372
8373
|
return {
|
|
8373
8374
|
request,
|
|
8374
8375
|
tokenSetupActions,
|
|
@@ -8376,13 +8377,13 @@ function create1155CreatorClient({
|
|
|
8376
8377
|
contractExists
|
|
8377
8378
|
};
|
|
8378
8379
|
} else if (contractExists) {
|
|
8379
|
-
const request = {
|
|
8380
|
+
const request = makeSimulateContractParamaters({
|
|
8380
8381
|
abi: zoraCreator1155ImplABI3,
|
|
8381
8382
|
functionName: "multicall",
|
|
8382
8383
|
account,
|
|
8383
8384
|
address: contractAddress,
|
|
8384
8385
|
args: [tokenSetupActions]
|
|
8385
|
-
};
|
|
8386
|
+
});
|
|
8386
8387
|
return {
|
|
8387
8388
|
request,
|
|
8388
8389
|
tokenSetupActions,
|
|
@@ -11719,41 +11720,34 @@ var sumBalances = (mintAccountBalances) => {
|
|
|
11719
11720
|
import {
|
|
11720
11721
|
zoraMints1155Config,
|
|
11721
11722
|
zoraMintsManagerImplABI,
|
|
11722
|
-
|
|
11723
|
-
|
|
11724
|
-
iUnwrapAndForwardActionABI
|
|
11723
|
+
zoraMintsManagerImplAddress,
|
|
11724
|
+
zoraMintsManagerImplConfig
|
|
11725
11725
|
} from "@zoralabs/protocol-deployments";
|
|
11726
11726
|
import {
|
|
11727
11727
|
decodeErrorResult,
|
|
11728
|
-
encodeAbiParameters as encodeAbiParameters2,
|
|
11729
11728
|
encodeFunctionData as encodeFunctionData2,
|
|
11730
|
-
parseAbiParameters as parseAbiParameters2,
|
|
11731
11729
|
zeroAddress as zeroAddress5
|
|
11732
11730
|
} from "viem";
|
|
11733
|
-
|
|
11731
|
+
var addressOrAccountAddress = (address) => typeof address === "string" ? address : address.address;
|
|
11732
|
+
var mintWithEthParams = ({
|
|
11734
11733
|
quantity,
|
|
11735
11734
|
recipient,
|
|
11736
11735
|
chainId,
|
|
11737
11736
|
pricePerMint,
|
|
11738
11737
|
account
|
|
11739
|
-
}) {
|
|
11740
|
-
|
|
11741
|
-
|
|
11742
|
-
|
|
11743
|
-
|
|
11744
|
-
|
|
11745
|
-
|
|
11746
|
-
|
|
11747
|
-
};
|
|
11748
|
-
}
|
|
11738
|
+
}) => makeSimulateContractParamaters({
|
|
11739
|
+
abi: zoraMintsManagerImplConfig.abi,
|
|
11740
|
+
address: zoraMintsManagerImplConfig.address[chainId],
|
|
11741
|
+
functionName: "mintWithEth",
|
|
11742
|
+
args: [quantity, recipient || addressOrAccountAddress(account)],
|
|
11743
|
+
value: pricePerMint * quantity,
|
|
11744
|
+
account
|
|
11745
|
+
});
|
|
11749
11746
|
var getPaidMintValue = (quantities, pricePerMint) => {
|
|
11750
11747
|
if (!pricePerMint || pricePerMint === 0n)
|
|
11751
11748
|
return;
|
|
11752
11749
|
return quantities.reduce((a, b) => a + b, 0n) * pricePerMint;
|
|
11753
11750
|
};
|
|
11754
|
-
var fixedPriceMinterMinterArguments = ({
|
|
11755
|
-
mintRecipient
|
|
11756
|
-
}) => encodeAbiParameters2(parseAbiParameters2("address"), [mintRecipient]);
|
|
11757
11751
|
var mintsBalanceOfAccountParams = ({
|
|
11758
11752
|
account,
|
|
11759
11753
|
chainId
|
|
@@ -11782,88 +11776,57 @@ function collectWithMintsParams({
|
|
|
11782
11776
|
tokenIds,
|
|
11783
11777
|
quantities,
|
|
11784
11778
|
chainId,
|
|
11785
|
-
|
|
11779
|
+
paidMintPricePerToken,
|
|
11786
11780
|
account,
|
|
11787
|
-
|
|
11781
|
+
mintArguments,
|
|
11782
|
+
minter,
|
|
11783
|
+
zoraCreator1155Contract,
|
|
11784
|
+
zoraCreator1155TokenId
|
|
11788
11785
|
}) {
|
|
11789
11786
|
const call = encodeCollectOnManager({
|
|
11790
11787
|
tokenIds,
|
|
11791
11788
|
quantities,
|
|
11792
|
-
|
|
11789
|
+
zoraCreator1155Contract,
|
|
11790
|
+
zoraCreator1155TokenId,
|
|
11791
|
+
minter,
|
|
11792
|
+
mintArguments
|
|
11793
11793
|
});
|
|
11794
|
-
return {
|
|
11794
|
+
return makeSimulateContractParamaters({
|
|
11795
11795
|
abi: zoraMints1155Config.abi,
|
|
11796
11796
|
address: zoraMints1155Config.address[chainId],
|
|
11797
11797
|
functionName: "transferBatchToManagerAndCall",
|
|
11798
11798
|
args: [tokenIds, quantities, call],
|
|
11799
|
-
|
|
11799
|
+
// if it is a paid mint, the aadditional value will be sent to the manager contract and forwarded to the creator 1155 contract
|
|
11800
|
+
// for the paid mint cost.
|
|
11801
|
+
value: getPaidMintValue(quantities, paidMintPricePerToken),
|
|
11800
11802
|
account
|
|
11801
|
-
};
|
|
11802
|
-
}
|
|
11803
|
-
var collectWithMintsTypedDataDefinition = ({
|
|
11804
|
-
tokenIds,
|
|
11805
|
-
quantities,
|
|
11806
|
-
chainId,
|
|
11807
|
-
account,
|
|
11808
|
-
nonce,
|
|
11809
|
-
deadline,
|
|
11810
|
-
...rest
|
|
11811
|
-
}) => {
|
|
11812
|
-
const safeTransferData = encodeCollectOnManager({
|
|
11813
|
-
tokenIds,
|
|
11814
|
-
quantities,
|
|
11815
|
-
...rest
|
|
11816
|
-
});
|
|
11817
|
-
return makePermitTransferBatchAndTypeData({
|
|
11818
|
-
tokenIds,
|
|
11819
|
-
quantities,
|
|
11820
|
-
chainId,
|
|
11821
|
-
account,
|
|
11822
|
-
nonce,
|
|
11823
|
-
deadline,
|
|
11824
|
-
safeTransferData,
|
|
11825
|
-
// will safe transfer to manager contract before doing the
|
|
11826
|
-
// collect operation
|
|
11827
|
-
to: zoraMintsManagerImplConfig.address[chainId]
|
|
11828
|
-
});
|
|
11829
|
-
};
|
|
11830
|
-
var collectPremintWithMintsTypedDataDefinition = ({
|
|
11831
|
-
tokenIds,
|
|
11832
|
-
quantities,
|
|
11833
|
-
chainId,
|
|
11834
|
-
account,
|
|
11835
|
-
nonce,
|
|
11836
|
-
deadline,
|
|
11837
|
-
...rest
|
|
11838
|
-
}) => {
|
|
11839
|
-
const safeTransferData = encodePremintOnManager({
|
|
11840
|
-
...rest
|
|
11841
11803
|
});
|
|
11842
|
-
|
|
11843
|
-
|
|
11844
|
-
|
|
11845
|
-
|
|
11846
|
-
|
|
11847
|
-
|
|
11848
|
-
|
|
11849
|
-
|
|
11850
|
-
|
|
11851
|
-
|
|
11852
|
-
|
|
11804
|
+
}
|
|
11805
|
+
function getMintsEthPrice({
|
|
11806
|
+
publicClient
|
|
11807
|
+
}) {
|
|
11808
|
+
const chainId = publicClient.chain?.id;
|
|
11809
|
+
if (!chainId || !zoraMintsManagerImplAddress[chainId]) {
|
|
11810
|
+
throw new Error(`Chain id ${chainId} not supported`);
|
|
11811
|
+
}
|
|
11812
|
+
return publicClient.readContract({
|
|
11813
|
+
abi: zoraMintsManagerImplABI,
|
|
11814
|
+
address: zoraMintsManagerImplAddress[chainId],
|
|
11815
|
+
functionName: "getEthPrice"
|
|
11853
11816
|
});
|
|
11854
|
-
}
|
|
11817
|
+
}
|
|
11855
11818
|
function makePermitTransferBatchAndTypeData({
|
|
11856
11819
|
tokenIds,
|
|
11857
11820
|
quantities,
|
|
11858
11821
|
chainId,
|
|
11859
|
-
|
|
11822
|
+
mintsOwner,
|
|
11860
11823
|
to,
|
|
11861
11824
|
nonce,
|
|
11862
11825
|
deadline,
|
|
11863
11826
|
safeTransferData
|
|
11864
11827
|
}) {
|
|
11865
11828
|
const permit = {
|
|
11866
|
-
owner: typeof
|
|
11829
|
+
owner: typeof mintsOwner === "string" ? mintsOwner : mintsOwner.address,
|
|
11867
11830
|
to,
|
|
11868
11831
|
tokenIds,
|
|
11869
11832
|
quantities,
|
|
@@ -11874,7 +11837,7 @@ function makePermitTransferBatchAndTypeData({
|
|
|
11874
11837
|
const typedData = permitBatchTypedDataDefinition({
|
|
11875
11838
|
chainId,
|
|
11876
11839
|
permit,
|
|
11877
|
-
account
|
|
11840
|
+
account: mintsOwner
|
|
11878
11841
|
});
|
|
11879
11842
|
return {
|
|
11880
11843
|
permit,
|
|
@@ -11885,14 +11848,14 @@ function makePermitTransferTypeData({
|
|
|
11885
11848
|
tokenId,
|
|
11886
11849
|
quantity,
|
|
11887
11850
|
chainId,
|
|
11888
|
-
|
|
11851
|
+
mintsOwner,
|
|
11889
11852
|
to,
|
|
11890
11853
|
nonce,
|
|
11891
11854
|
deadline,
|
|
11892
11855
|
safeTransferData
|
|
11893
11856
|
}) {
|
|
11894
11857
|
const permit = {
|
|
11895
|
-
owner: typeof
|
|
11858
|
+
owner: typeof mintsOwner === "string" ? mintsOwner : mintsOwner.address,
|
|
11896
11859
|
to,
|
|
11897
11860
|
tokenId,
|
|
11898
11861
|
quantity,
|
|
@@ -11903,7 +11866,7 @@ function makePermitTransferTypeData({
|
|
|
11903
11866
|
const typedData = permitTransferTypedDataDefinition({
|
|
11904
11867
|
chainId,
|
|
11905
11868
|
permit,
|
|
11906
|
-
account
|
|
11869
|
+
account: mintsOwner
|
|
11907
11870
|
});
|
|
11908
11871
|
return {
|
|
11909
11872
|
permit,
|
|
@@ -11927,10 +11890,42 @@ var encodePremintOnManager = ({
|
|
|
11927
11890
|
signerContract
|
|
11928
11891
|
]
|
|
11929
11892
|
});
|
|
11893
|
+
var makePermitToCollectPremintOrNonPremint = ({
|
|
11894
|
+
mintsOwner,
|
|
11895
|
+
chainId,
|
|
11896
|
+
deadline,
|
|
11897
|
+
tokenIds,
|
|
11898
|
+
// this quantity of MINTs will be used to collect premint
|
|
11899
|
+
// and will be burned. This same quantity is the quantity of
|
|
11900
|
+
// premint to collect.
|
|
11901
|
+
quantities,
|
|
11902
|
+
nonce,
|
|
11903
|
+
premint,
|
|
11904
|
+
collect
|
|
11905
|
+
}) => {
|
|
11906
|
+
let safeTransferData;
|
|
11907
|
+
if (premint) {
|
|
11908
|
+
safeTransferData = encodePremintOnManager(premint);
|
|
11909
|
+
} else if (collect) {
|
|
11910
|
+
safeTransferData = encodeCollectOnManager(collect);
|
|
11911
|
+
} else {
|
|
11912
|
+
throw new Error("Invalid operation");
|
|
11913
|
+
}
|
|
11914
|
+
return makePermitTransferBatchAndTypeData({
|
|
11915
|
+
tokenIds,
|
|
11916
|
+
quantities,
|
|
11917
|
+
chainId,
|
|
11918
|
+
mintsOwner,
|
|
11919
|
+
nonce,
|
|
11920
|
+
deadline,
|
|
11921
|
+
safeTransferData,
|
|
11922
|
+
to: zoraMintsManagerImplConfig.address[chainId]
|
|
11923
|
+
});
|
|
11924
|
+
};
|
|
11930
11925
|
function collectPremintV2WithMintsParams({
|
|
11931
11926
|
tokenIds,
|
|
11932
11927
|
quantities,
|
|
11933
|
-
|
|
11928
|
+
paidMintPricePerToken,
|
|
11934
11929
|
account,
|
|
11935
11930
|
chainId,
|
|
11936
11931
|
...rest
|
|
@@ -11938,14 +11933,14 @@ function collectPremintV2WithMintsParams({
|
|
|
11938
11933
|
const call = encodePremintOnManager({
|
|
11939
11934
|
...rest
|
|
11940
11935
|
});
|
|
11941
|
-
return {
|
|
11936
|
+
return makeSimulateContractParamaters({
|
|
11942
11937
|
abi: zoraMints1155Config.abi,
|
|
11943
11938
|
address: zoraMints1155Config.address[chainId],
|
|
11944
11939
|
functionName: "transferBatchToManagerAndCall",
|
|
11945
11940
|
args: [tokenIds, quantities, call],
|
|
11946
|
-
value: getPaidMintValue(quantities,
|
|
11941
|
+
value: getPaidMintValue(quantities, paidMintPricePerToken),
|
|
11947
11942
|
account
|
|
11948
|
-
};
|
|
11943
|
+
});
|
|
11949
11944
|
}
|
|
11950
11945
|
function makeTypeData(args) {
|
|
11951
11946
|
return args;
|
|
@@ -12050,117 +12045,50 @@ function permitTransferTypedDataDefinition({
|
|
|
12050
12045
|
account
|
|
12051
12046
|
});
|
|
12052
12047
|
}
|
|
12053
|
-
|
|
12054
|
-
|
|
12055
|
-
|
|
12056
|
-
|
|
12057
|
-
|
|
12058
|
-
|
|
12059
|
-
|
|
12060
|
-
address: zoraMints1155Config.address[chainId],
|
|
12061
|
-
functionName: "permitSafeTransferBatch",
|
|
12062
|
-
args: [permit, signature]
|
|
12063
|
-
};
|
|
12064
|
-
return result;
|
|
12065
|
-
};
|
|
12066
|
-
var safeTransferAndUnwrapTypedDataDefinition = ({
|
|
12067
|
-
chainId,
|
|
12068
|
-
tokenId,
|
|
12069
|
-
quantity,
|
|
12070
|
-
from,
|
|
12071
|
-
addressToCall,
|
|
12072
|
-
functionToCall,
|
|
12073
|
-
valueToSend,
|
|
12074
|
-
deadline,
|
|
12075
|
-
nonce
|
|
12076
|
-
}) => {
|
|
12077
|
-
const callArgument = encodeFunctionData2({
|
|
12078
|
-
abi: iUnwrapAndForwardActionABI,
|
|
12079
|
-
functionName: "callWithEth",
|
|
12080
|
-
args: [addressToCall, functionToCall, valueToSend]
|
|
12081
|
-
});
|
|
12082
|
-
return makePermitTransferTypeData({
|
|
12083
|
-
account: from,
|
|
12084
|
-
chainId,
|
|
12085
|
-
deadline,
|
|
12086
|
-
tokenId,
|
|
12087
|
-
quantity,
|
|
12088
|
-
safeTransferData: callArgument,
|
|
12089
|
-
to: mintsEthUnwrapperAndCallerConfig.address[chainId],
|
|
12090
|
-
nonce
|
|
12048
|
+
function decodeCallFailedError(error) {
|
|
12049
|
+
if (error.data?.errorName !== "CallFailed")
|
|
12050
|
+
throw new Error("Not a CallFailed error");
|
|
12051
|
+
const internalErrorData = error.data?.args?.[0];
|
|
12052
|
+
return decodeErrorResult({
|
|
12053
|
+
abi: zoraMintsManagerImplABI,
|
|
12054
|
+
data: internalErrorData
|
|
12091
12055
|
});
|
|
12092
|
-
}
|
|
12093
|
-
|
|
12056
|
+
}
|
|
12057
|
+
|
|
12058
|
+
// src/mints/mints-eth-unwrapper-and-caller.ts
|
|
12059
|
+
import {
|
|
12060
|
+
iUnwrapAndForwardActionABI,
|
|
12061
|
+
mintsEthUnwrapperAndCallerAddress
|
|
12062
|
+
} from "@zoralabs/protocol-deployments";
|
|
12063
|
+
import { encodeFunctionData as encodeFunctionData3 } from "viem";
|
|
12064
|
+
var makeCallWithEthSafeTransferData = ({
|
|
12065
|
+
address: addressToCall,
|
|
12066
|
+
call: functionToCall,
|
|
12067
|
+
value: valueToSend
|
|
12068
|
+
}) => encodeFunctionData3({
|
|
12069
|
+
abi: iUnwrapAndForwardActionABI,
|
|
12070
|
+
functionName: "callWithEth",
|
|
12071
|
+
args: [addressToCall, functionToCall, valueToSend]
|
|
12072
|
+
});
|
|
12073
|
+
var unwrapAndForwardEthPermitAndTypedDataDefinition = ({
|
|
12094
12074
|
chainId,
|
|
12095
12075
|
tokenIds,
|
|
12096
12076
|
quantities,
|
|
12097
12077
|
from,
|
|
12098
|
-
|
|
12099
|
-
|
|
12100
|
-
valueToSend,
|
|
12078
|
+
callWithEth,
|
|
12079
|
+
safeTransferData,
|
|
12101
12080
|
deadline,
|
|
12102
12081
|
nonce
|
|
12103
|
-
}) => {
|
|
12104
|
-
|
|
12105
|
-
abi: iUnwrapAndForwardActionABI,
|
|
12106
|
-
functionName: "callWithEth",
|
|
12107
|
-
args: [addressToCall, functionToCall, valueToSend]
|
|
12108
|
-
});
|
|
12109
|
-
return makePermitTransferBatchAndTypeData({
|
|
12110
|
-
account: from,
|
|
12111
|
-
chainId,
|
|
12112
|
-
deadline,
|
|
12113
|
-
tokenIds,
|
|
12114
|
-
quantities,
|
|
12115
|
-
safeTransferData: callArgument,
|
|
12116
|
-
to: mintsEthUnwrapperAndCallerConfig.address[chainId],
|
|
12117
|
-
nonce
|
|
12118
|
-
});
|
|
12119
|
-
};
|
|
12120
|
-
var safeTransferAndUnwrapEthParams = ({
|
|
12082
|
+
}) => makePermitTransferBatchAndTypeData({
|
|
12083
|
+
mintsOwner: from,
|
|
12121
12084
|
chainId,
|
|
12085
|
+
deadline,
|
|
12122
12086
|
tokenIds,
|
|
12123
12087
|
quantities,
|
|
12124
|
-
|
|
12125
|
-
|
|
12126
|
-
|
|
12127
|
-
|
|
12128
|
-
}) => {
|
|
12129
|
-
const callArgument = encodeFunctionData2({
|
|
12130
|
-
abi: iUnwrapAndForwardActionABI,
|
|
12131
|
-
functionName: "callWithEth",
|
|
12132
|
-
args: [addressToCall, functionToCall, valueToSend]
|
|
12133
|
-
});
|
|
12134
|
-
const result = {
|
|
12135
|
-
abi: zoraMints1155Config.abi,
|
|
12136
|
-
functionName: "safeBatchTransferFrom",
|
|
12137
|
-
address: zoraMints1155Config.address[chainId],
|
|
12138
|
-
args: [
|
|
12139
|
-
typeof from === "string" ? from : from.address,
|
|
12140
|
-
// the mints will be transferred to this address, which
|
|
12141
|
-
// will burn/redeem their eth value
|
|
12142
|
-
mintsEthUnwrapperAndCallerConfig.address[chainId],
|
|
12143
|
-
// token ids to transfer/burn/unwrap - must be eth based tokens
|
|
12144
|
-
tokenIds,
|
|
12145
|
-
// quantities to transfer/burn/unwrap
|
|
12146
|
-
quantities,
|
|
12147
|
-
// this is the safeTransferData - which gets forwarded to the eth transferrer
|
|
12148
|
-
callArgument
|
|
12149
|
-
],
|
|
12150
|
-
// the account whos mints will be transferred from
|
|
12151
|
-
account: from
|
|
12152
|
-
};
|
|
12153
|
-
return result;
|
|
12154
|
-
};
|
|
12155
|
-
function decodeCallFailedError(error) {
|
|
12156
|
-
if (error.data?.errorName !== "CallFailed")
|
|
12157
|
-
throw new Error("Not a CallFailed error");
|
|
12158
|
-
const internalErrorData = error.data?.args?.[0];
|
|
12159
|
-
return decodeErrorResult({
|
|
12160
|
-
abi: zoraMintsManagerImplABI,
|
|
12161
|
-
data: internalErrorData
|
|
12162
|
-
});
|
|
12163
|
-
}
|
|
12088
|
+
safeTransferData: safeTransferData || makeCallWithEthSafeTransferData(callWithEth),
|
|
12089
|
+
to: mintsEthUnwrapperAndCallerAddress[chainId],
|
|
12090
|
+
nonce
|
|
12091
|
+
});
|
|
12164
12092
|
export {
|
|
12165
12093
|
DEFAULT_SALE_SETTINGS,
|
|
12166
12094
|
Errors,
|
|
@@ -12171,9 +12099,7 @@ export {
|
|
|
12171
12099
|
ZORA_API_BASE,
|
|
12172
12100
|
applyUpdateToPremint,
|
|
12173
12101
|
collectPremintV2WithMintsParams,
|
|
12174
|
-
collectPremintWithMintsTypedDataDefinition,
|
|
12175
12102
|
collectWithMintsParams,
|
|
12176
|
-
collectWithMintsTypedDataDefinition,
|
|
12177
12103
|
convertCollectionFromApi,
|
|
12178
12104
|
convertGetPremintApiResponse,
|
|
12179
12105
|
convertPremintFromApi,
|
|
@@ -12187,12 +12113,11 @@ export {
|
|
|
12187
12113
|
encodeCollectOnManager,
|
|
12188
12114
|
encodePostSignatureInput,
|
|
12189
12115
|
encodePremintForAPI,
|
|
12190
|
-
encodePremintOnManager,
|
|
12191
|
-
fixedPriceMinterMinterArguments,
|
|
12192
12116
|
getApiNetworkConfigForChain,
|
|
12193
12117
|
getDefaultFixedPriceMinterAddress,
|
|
12194
12118
|
getMintCosts,
|
|
12195
12119
|
getMintsAccountBalanceWithPriceQuery,
|
|
12120
|
+
getMintsEthPrice,
|
|
12196
12121
|
getPremintCollectionAddress,
|
|
12197
12122
|
getPremintExecutorAddress,
|
|
12198
12123
|
getPremintMintCosts,
|
|
@@ -12201,26 +12126,27 @@ export {
|
|
|
12201
12126
|
getTokenIdFromCreateReceipt,
|
|
12202
12127
|
isAuthorizedToCreatePremint,
|
|
12203
12128
|
isValidSignature,
|
|
12129
|
+
makeCallWithEthSafeTransferData,
|
|
12204
12130
|
makeMintRewardsRecipient,
|
|
12205
12131
|
makeNewPremint,
|
|
12132
|
+
makePermitToCollectPremintOrNonPremint,
|
|
12133
|
+
makePermitTransferBatchAndTypeData,
|
|
12134
|
+
makePermitTransferTypeData,
|
|
12206
12135
|
markPremintDeleted,
|
|
12207
12136
|
migratePremintConfigToV2,
|
|
12208
12137
|
mintWithEthParams,
|
|
12209
12138
|
mintsBalanceOfAccountParams,
|
|
12210
12139
|
permitBatchTypedDataDefinition,
|
|
12211
|
-
permitTransferBatchToManagerAndCallParams,
|
|
12212
12140
|
permitTransferTypedDataDefinition,
|
|
12213
12141
|
premintTypedDataDefinition,
|
|
12214
12142
|
recoverCreatorFromCreatorAttribution,
|
|
12215
12143
|
recoverPremintSigner,
|
|
12216
|
-
safeTransferAndUnwrapEthParams,
|
|
12217
|
-
safeTransferAndUnwrapTypedDataDefinition,
|
|
12218
|
-
safeTransferBatchAndUnwrapTypedDataDefinition,
|
|
12219
12144
|
selectMintsToCollectWithFromQueryResult,
|
|
12220
12145
|
sumBalances,
|
|
12221
12146
|
supportedPremintVersions,
|
|
12222
12147
|
supportsPremintVersion,
|
|
12223
12148
|
tryRecoverPremintSigner,
|
|
12149
|
+
unwrapAndForwardEthPermitAndTypedDataDefinition,
|
|
12224
12150
|
v1Types,
|
|
12225
12151
|
v2Types
|
|
12226
12152
|
};
|