@zoralabs/protocol-sdk 0.9.0 → 0.9.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 +7 -7
- package/CHANGELOG.md +6 -0
- package/dist/create/1155-create-helper.d.ts.map +1 -1
- package/dist/create/mint-from-create.d.ts +12 -0
- package/dist/create/mint-from-create.d.ts.map +1 -0
- package/dist/create/types.d.ts +2 -0
- package/dist/create/types.d.ts.map +1 -1
- package/dist/index.cjs +154 -40
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +127 -13
- package/dist/index.js.map +1 -1
- package/dist/mint/mint-queries.d.ts +3 -1
- package/dist/mint/mint-queries.d.ts.map +1 -1
- package/dist/mint/types.d.ts +1 -0
- package/dist/mint/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/create/1155-create-helper.test.ts +36 -58
- package/src/create/1155-create-helper.ts +21 -0
- package/src/create/mint-from-create.ts +119 -0
- package/src/create/types.ts +2 -0
- package/src/mint/mint-queries.ts +8 -8
- package/src/mint/types.ts +3 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @zoralabs/protocol-sdk@0.9.
|
|
2
|
+
> @zoralabs/protocol-sdk@0.9.1 build /home/runner/work/zora-protocol-private/zora-protocol-private/packages/protocol-sdk
|
|
3
3
|
> pnpm tsup
|
|
4
4
|
|
|
5
5
|
CLI Building entry: src/index.ts
|
|
@@ -10,9 +10,9 @@ CLI Target: es2021
|
|
|
10
10
|
CLI Cleaning output folder
|
|
11
11
|
CJS Build start
|
|
12
12
|
ESM Build start
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
CJS dist/index.cjs 198.74 KB
|
|
14
|
+
CJS dist/index.cjs.map 398.05 KB
|
|
15
|
+
CJS ⚡️ Build success in 375ms
|
|
16
|
+
ESM dist/index.js 192.81 KB
|
|
17
|
+
ESM dist/index.js.map 396.06 KB
|
|
18
|
+
ESM ⚡️ Build success in 403ms
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @zoralabs/protocol-sdk
|
|
2
2
|
|
|
3
|
+
## 0.9.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- f40c4a8f: `create1155` and `create1155OnExistingContract` return an async `prepareMint` function, enabling to mint right after creating without needing to rely on the subgraph.
|
|
8
|
+
|
|
3
9
|
## 0.9.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"1155-create-helper.d.ts","sourceRoot":"","sources":["../../src/create/1155-create-helper.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,OAAO,EACP,OAAO,EACP,GAAG,EACH,YAAY,EACZ,kBAAkB,EACnB,MAAM,MAAM,CAAC;AAQd,OAAO,EACL,mCAAmC,EACnC,2BAA2B,EAE3B,wBAAwB,EACxB,wBAAwB,EACxB,iBAAiB,EAClB,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"1155-create-helper.d.ts","sourceRoot":"","sources":["../../src/create/1155-create-helper.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,OAAO,EACP,OAAO,EACP,GAAG,EACH,YAAY,EACZ,kBAAkB,EACnB,MAAM,MAAM,CAAC;AAQd,OAAO,EACL,mCAAmC,EACnC,2BAA2B,EAE3B,wBAAwB,EACxB,wBAAwB,EACxB,iBAAiB,EAClB,MAAM,SAAS,CAAC;AAOjB,eAAO,MAAM,2BAA2B,YAC7B,kBAAkB,KAC1B,MAiBF,CAAC;AAEF,eAAO,MAAM,6BAA6B,YAC/B,kBAAkB,KAC1B,OAiBF,CAAC;AAEF,KAAK,0BAA0B,GAAG;IAChC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC;IAE3B,iBAAiB,EAAE,GAAG,EAAE,CAAC;CAC1B,CAAC;AAEF,wBAAgB,8BAA8B,CAAC,EAC7C,OAAO,EACP,QAAQ,EACR,UAAU,EACV,cAAc,EACd,iBAAiB,EACjB,OAAO,GACR,EAAE;IACD,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,GAAG,0BAA0B,4DAwB7B;AAkBD,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAqC;gBAEtD,EACV,OAAO,EACP,YAAY,GACb,EAAE;QACD,OAAO,EAAE,MAAM,CAAC;QAChB,YAAY,EAAE,IAAI,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC;KAClD;IAKK,aAAa,CACjB,KAAK,EAAE,2BAA2B,GACjC,OAAO,CAAC,mCAAmC,CAAC;IAQzC,+BAA+B,CAAC,EACpC,eAAe,EAAE,QAAQ,EACzB,OAAO,EACP,KAAK,EACL,yBAAyB,GAC1B,EAAE,wBAAwB,GAAG,OAAO,CAAC,wBAAwB,CAAC;CAUhE"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Address, PublicClient } from "viem";
|
|
2
|
+
import { ConcreteSalesConfig } from "./types";
|
|
3
|
+
import { AsyncPrepareMint } from "src/mint/types";
|
|
4
|
+
export declare function makeOnchainPrepareMintFromCreate({ contractAddress, tokenId, result, minter, publicClient, contractVersion, }: {
|
|
5
|
+
contractAddress: Address;
|
|
6
|
+
tokenId: bigint;
|
|
7
|
+
result: ConcreteSalesConfig;
|
|
8
|
+
minter: Address;
|
|
9
|
+
publicClient: Pick<PublicClient, "readContract">;
|
|
10
|
+
contractVersion: string;
|
|
11
|
+
}): AsyncPrepareMint;
|
|
12
|
+
//# sourceMappingURL=mint-from-create.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mint-from-create.d.ts","sourceRoot":"","sources":["../../src/create/mint-from-create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAc,YAAY,EAAe,MAAM,MAAM,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,EACL,gBAAgB,EAIjB,MAAM,gBAAgB,CAAC;AAuExB,wBAAgB,gCAAgC,CAAC,EAC/C,eAAe,EACf,OAAO,EACP,MAAM,EACN,MAAM,EACN,YAAY,EACZ,eAAe,GAChB,EAAE;IACD,eAAe,EAAE,OAAO,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,mBAAmB,CAAC;IAC5B,MAAM,EAAE,OAAO,CAAC;IAChB,YAAY,EAAE,IAAI,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC;IACjD,eAAe,EAAE,MAAM,CAAC;CACzB,GAAG,gBAAgB,CA0BnB"}
|
package/dist/create/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AsyncPrepareMint } from "src/mint/types";
|
|
1
2
|
import { Concrete } from "src/utils";
|
|
2
3
|
import { Account, Address, Hex, SimulateContractParameters } from "viem";
|
|
3
4
|
export type NewContractParams = {
|
|
@@ -78,6 +79,7 @@ export type CreateNew1155TokenReturn = {
|
|
|
78
79
|
newToken: New1155Token;
|
|
79
80
|
minter: Address;
|
|
80
81
|
contractVersion: string;
|
|
82
|
+
prepareMint: AsyncPrepareMint;
|
|
81
83
|
};
|
|
82
84
|
export type CreateNew1155ContractAndTokenReturn = {
|
|
83
85
|
contractAddress: Address;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/create/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAA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C5B,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,MAAM,mBAAmB,GAC3B,QAAQ,CAAC,oBAAoB,CAAC,GAC9B,QAAQ,CAAC,eAAe,CAAC,GACzB,QAAQ,CAAC,kBAAkB,CAAC,GAC5B,QAAQ,CAAC,mBAAmB,CAAC,CAAC;AAElC,MAAM,MAAM,YAAY,GAAG;IACzB,eAAe,EAAE,OAAO,CAAC;IACzB,cAAc,EAAE,OAAO,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,mBAAmB,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,UAAU,EAAE,0BAA0B,CACpC,GAAG,EACH,GAAG,EACH,GAAG,EACH,GAAG,EACH,GAAG,EACH,OAAO,GAAG,OAAO,CAClB,CAAC;IACF,iBAAiB,EAAE,GAAG,EAAE,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,YAAY,CAAC;IACvB,MAAM,EAAE,OAAO,CAAC;IAChB,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,gBAAgB,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,mCAAmC,GAAG;IAChD,eAAe,EAAE,OAAO,CAAC;CAC1B,GAAG,wBAAwB,CAAC"}
|
package/dist/index.cjs
CHANGED
|
@@ -4105,7 +4105,7 @@ var makeOnchainPrepareMint = (result) => (params) => {
|
|
|
4105
4105
|
token: result,
|
|
4106
4106
|
mintParams: params
|
|
4107
4107
|
}),
|
|
4108
|
-
erc20Approval: getRequiredErc20Approvals(params, result),
|
|
4108
|
+
erc20Approval: getRequiredErc20Approvals(params, result.salesConfig),
|
|
4109
4109
|
costs: parseMintCosts({
|
|
4110
4110
|
salesConfig: result.salesConfig,
|
|
4111
4111
|
quantityToMint: BigInt(params.quantityToMint),
|
|
@@ -4138,13 +4138,13 @@ function toPremintMintReturn({
|
|
|
4138
4138
|
prepareMint: makePremintPrepareMint(mintable, mintFee, premint)
|
|
4139
4139
|
};
|
|
4140
4140
|
}
|
|
4141
|
-
function getRequiredErc20Approvals(params,
|
|
4142
|
-
if (
|
|
4141
|
+
function getRequiredErc20Approvals(params, salesConfig) {
|
|
4142
|
+
if (salesConfig?.saleType !== "erc20")
|
|
4143
4143
|
return void 0;
|
|
4144
4144
|
return {
|
|
4145
|
-
quantity:
|
|
4146
|
-
approveTo:
|
|
4147
|
-
erc20:
|
|
4145
|
+
quantity: salesConfig.pricePerToken * BigInt(params.quantityToMint),
|
|
4146
|
+
approveTo: salesConfig.address,
|
|
4147
|
+
erc20: salesConfig.currency
|
|
4148
4148
|
};
|
|
4149
4149
|
}
|
|
4150
4150
|
|
|
@@ -4247,8 +4247,8 @@ async function mint({
|
|
|
4247
4247
|
}
|
|
4248
4248
|
|
|
4249
4249
|
// src/create/1155-create-helper.ts
|
|
4250
|
-
var
|
|
4251
|
-
var
|
|
4250
|
+
var import_protocol_deployments11 = require("@zoralabs/protocol-deployments");
|
|
4251
|
+
var import_viem10 = require("viem");
|
|
4252
4252
|
|
|
4253
4253
|
// src/create/contract-setup.ts
|
|
4254
4254
|
var import_protocol_deployments7 = require("@zoralabs/protocol-deployments");
|
|
@@ -5833,13 +5833,109 @@ var contractSupportsMintRewards = (contractVersion, contractStandard) => {
|
|
|
5833
5833
|
}
|
|
5834
5834
|
};
|
|
5835
5835
|
|
|
5836
|
+
// src/create/mint-from-create.ts
|
|
5837
|
+
var import_viem9 = require("viem");
|
|
5838
|
+
var import_protocol_deployments10 = require("@zoralabs/protocol-deployments");
|
|
5839
|
+
async function toSalesStrategyFromSubgraph({
|
|
5840
|
+
minter,
|
|
5841
|
+
salesConfig,
|
|
5842
|
+
publicClient,
|
|
5843
|
+
contractAddress
|
|
5844
|
+
}) {
|
|
5845
|
+
if (salesConfig.type === "timed") {
|
|
5846
|
+
return {
|
|
5847
|
+
saleType: "timed",
|
|
5848
|
+
address: minter,
|
|
5849
|
+
// for now we hardcode this
|
|
5850
|
+
mintFeePerQuantity: (0, import_viem9.parseEther)("0.000111"),
|
|
5851
|
+
saleStart: salesConfig.saleStart.toString(),
|
|
5852
|
+
saleEnd: salesConfig.saleEnd.toString(),
|
|
5853
|
+
// the following are not needed for now but we wanna satisfy concrete
|
|
5854
|
+
erc20Z: import_viem9.zeroAddress,
|
|
5855
|
+
mintFee: 0n,
|
|
5856
|
+
pool: import_viem9.zeroAddress,
|
|
5857
|
+
secondaryActivated: false
|
|
5858
|
+
};
|
|
5859
|
+
}
|
|
5860
|
+
if (salesConfig.type === "erc20Mint") {
|
|
5861
|
+
return {
|
|
5862
|
+
saleType: "erc20",
|
|
5863
|
+
address: minter,
|
|
5864
|
+
mintFeePerQuantity: 0n,
|
|
5865
|
+
saleStart: salesConfig.saleStart.toString(),
|
|
5866
|
+
saleEnd: salesConfig.saleEnd.toString(),
|
|
5867
|
+
currency: salesConfig.currency,
|
|
5868
|
+
pricePerToken: salesConfig.pricePerToken,
|
|
5869
|
+
maxTokensPerAddress: salesConfig.maxTokensPerAddress
|
|
5870
|
+
};
|
|
5871
|
+
}
|
|
5872
|
+
const contractMintFee = await publicClient.readContract({
|
|
5873
|
+
abi: import_protocol_deployments10.zoraCreator1155ImplABI,
|
|
5874
|
+
address: contractAddress,
|
|
5875
|
+
functionName: "mintFee"
|
|
5876
|
+
});
|
|
5877
|
+
if (salesConfig.type === "fixedPrice") {
|
|
5878
|
+
return {
|
|
5879
|
+
saleType: "fixedPrice",
|
|
5880
|
+
address: minter,
|
|
5881
|
+
maxTokensPerAddress: salesConfig.maxTokensPerAddress,
|
|
5882
|
+
mintFeePerQuantity: contractMintFee,
|
|
5883
|
+
pricePerToken: salesConfig.pricePerToken,
|
|
5884
|
+
saleStart: salesConfig.saleStart.toString(),
|
|
5885
|
+
saleEnd: salesConfig.saleEnd.toString()
|
|
5886
|
+
};
|
|
5887
|
+
}
|
|
5888
|
+
return {
|
|
5889
|
+
saleType: "allowlist",
|
|
5890
|
+
address: minter,
|
|
5891
|
+
saleStart: salesConfig.saleStart.toString(),
|
|
5892
|
+
saleEnd: salesConfig.saleEnd.toString(),
|
|
5893
|
+
merkleRoot: salesConfig.presaleMerkleRoot,
|
|
5894
|
+
mintFeePerQuantity: contractMintFee
|
|
5895
|
+
};
|
|
5896
|
+
}
|
|
5897
|
+
function makeOnchainPrepareMintFromCreate({
|
|
5898
|
+
contractAddress,
|
|
5899
|
+
tokenId,
|
|
5900
|
+
result,
|
|
5901
|
+
minter,
|
|
5902
|
+
publicClient,
|
|
5903
|
+
contractVersion
|
|
5904
|
+
}) {
|
|
5905
|
+
return async (params) => {
|
|
5906
|
+
const subgraphSalesConfig = await toSalesStrategyFromSubgraph({
|
|
5907
|
+
minter,
|
|
5908
|
+
contractAddress,
|
|
5909
|
+
publicClient,
|
|
5910
|
+
salesConfig: result
|
|
5911
|
+
});
|
|
5912
|
+
return {
|
|
5913
|
+
parameters: makePrepareMint1155TokenParams({
|
|
5914
|
+
salesConfigAndTokenInfo: {
|
|
5915
|
+
salesConfig: subgraphSalesConfig,
|
|
5916
|
+
contractVersion
|
|
5917
|
+
},
|
|
5918
|
+
...params,
|
|
5919
|
+
tokenContract: contractAddress,
|
|
5920
|
+
tokenId
|
|
5921
|
+
}),
|
|
5922
|
+
costs: parseMintCosts({
|
|
5923
|
+
allowListEntry: params.allowListEntry,
|
|
5924
|
+
quantityToMint: BigInt(params.quantityToMint),
|
|
5925
|
+
salesConfig: subgraphSalesConfig
|
|
5926
|
+
}),
|
|
5927
|
+
erc20Approval: getRequiredErc20Approvals(params, subgraphSalesConfig)
|
|
5928
|
+
};
|
|
5929
|
+
};
|
|
5930
|
+
}
|
|
5931
|
+
|
|
5836
5932
|
// src/create/1155-create-helper.ts
|
|
5837
5933
|
var ROYALTY_BPS_DEFAULT = 1e3;
|
|
5838
5934
|
var getTokenIdFromCreateReceipt = (receipt) => {
|
|
5839
5935
|
for (const data of receipt.logs) {
|
|
5840
5936
|
try {
|
|
5841
|
-
const decodedLog = (0,
|
|
5842
|
-
abi:
|
|
5937
|
+
const decodedLog = (0, import_viem10.decodeEventLog)({
|
|
5938
|
+
abi: import_protocol_deployments11.zoraCreator1155ImplABI,
|
|
5843
5939
|
eventName: "SetupNewToken",
|
|
5844
5940
|
...data
|
|
5845
5941
|
});
|
|
@@ -5856,8 +5952,8 @@ var getTokenIdFromCreateReceipt = (receipt) => {
|
|
|
5856
5952
|
var getContractAddressFromReceipt = (receipt) => {
|
|
5857
5953
|
for (const data of receipt.logs) {
|
|
5858
5954
|
try {
|
|
5859
|
-
const decodedLog = (0,
|
|
5860
|
-
abi:
|
|
5955
|
+
const decodedLog = (0, import_viem10.decodeEventLog)({
|
|
5956
|
+
abi: import_protocol_deployments11.zoraCreator1155FactoryImplABI,
|
|
5861
5957
|
eventName: "SetupNewContract",
|
|
5862
5958
|
...data
|
|
5863
5959
|
});
|
|
@@ -5881,10 +5977,10 @@ function makeCreateContractAndTokenCall({
|
|
|
5881
5977
|
}) {
|
|
5882
5978
|
const accountAddress = typeof account === "string" ? account : account.address;
|
|
5883
5979
|
return makeContractParameters({
|
|
5884
|
-
abi:
|
|
5980
|
+
abi: import_protocol_deployments11.zoraCreator1155FactoryImplABI,
|
|
5885
5981
|
functionName: "createContractDeterministic",
|
|
5886
5982
|
account,
|
|
5887
|
-
address:
|
|
5983
|
+
address: import_protocol_deployments11.zoraCreator1155FactoryImplAddress[chainId],
|
|
5888
5984
|
args: [
|
|
5889
5985
|
contract.uri,
|
|
5890
5986
|
contract.name,
|
|
@@ -5905,7 +6001,7 @@ function makeCreateTokenCall({
|
|
|
5905
6001
|
tokenSetupActions
|
|
5906
6002
|
}) {
|
|
5907
6003
|
return makeContractParameters({
|
|
5908
|
-
abi:
|
|
6004
|
+
abi: import_protocol_deployments11.zoraCreator1155ImplABI,
|
|
5909
6005
|
functionName: "multicall",
|
|
5910
6006
|
account,
|
|
5911
6007
|
address: contractAddress,
|
|
@@ -5980,6 +6076,14 @@ async function createNew1155ContractAndToken({
|
|
|
5980
6076
|
chainId,
|
|
5981
6077
|
contract
|
|
5982
6078
|
});
|
|
6079
|
+
const prepareMint = makeOnchainPrepareMintFromCreate({
|
|
6080
|
+
contractAddress,
|
|
6081
|
+
contractVersion,
|
|
6082
|
+
minter,
|
|
6083
|
+
publicClient,
|
|
6084
|
+
result: newToken.salesConfig,
|
|
6085
|
+
tokenId: nextTokenId
|
|
6086
|
+
});
|
|
5983
6087
|
return {
|
|
5984
6088
|
parameters: request,
|
|
5985
6089
|
tokenSetupActions,
|
|
@@ -5987,7 +6091,8 @@ async function createNew1155ContractAndToken({
|
|
|
5987
6091
|
newToken,
|
|
5988
6092
|
contractAddress,
|
|
5989
6093
|
contractVersion,
|
|
5990
|
-
minter
|
|
6094
|
+
minter,
|
|
6095
|
+
prepareMint
|
|
5991
6096
|
};
|
|
5992
6097
|
}
|
|
5993
6098
|
async function createNew1155Token({
|
|
@@ -6019,13 +6124,22 @@ async function createNew1155Token({
|
|
|
6019
6124
|
account,
|
|
6020
6125
|
tokenSetupActions
|
|
6021
6126
|
});
|
|
6127
|
+
const prepareMint = makeOnchainPrepareMintFromCreate({
|
|
6128
|
+
contractAddress,
|
|
6129
|
+
contractVersion,
|
|
6130
|
+
minter,
|
|
6131
|
+
publicClient,
|
|
6132
|
+
result: newToken.salesConfig,
|
|
6133
|
+
tokenId: nextTokenId
|
|
6134
|
+
});
|
|
6022
6135
|
return {
|
|
6023
6136
|
parameters: request,
|
|
6024
6137
|
tokenSetupActions,
|
|
6025
6138
|
newTokenId: nextTokenId,
|
|
6026
6139
|
newToken,
|
|
6027
6140
|
contractVersion,
|
|
6028
|
-
minter
|
|
6141
|
+
minter,
|
|
6142
|
+
prepareMint
|
|
6029
6143
|
};
|
|
6030
6144
|
}
|
|
6031
6145
|
async function prepareSetupActions({
|
|
@@ -6113,8 +6227,8 @@ var sumBalances = (mintAccountBalances) => {
|
|
|
6113
6227
|
};
|
|
6114
6228
|
|
|
6115
6229
|
// src/sparks/sparks-contracts.ts
|
|
6116
|
-
var
|
|
6117
|
-
var
|
|
6230
|
+
var import_protocol_deployments12 = require("@zoralabs/protocol-deployments");
|
|
6231
|
+
var import_viem11 = require("viem");
|
|
6118
6232
|
var addressOrAccountAddress = (address) => typeof address === "string" ? address : address.address;
|
|
6119
6233
|
var mintWithEthParams = ({
|
|
6120
6234
|
tokenId,
|
|
@@ -6124,8 +6238,8 @@ var mintWithEthParams = ({
|
|
|
6124
6238
|
pricePerMint,
|
|
6125
6239
|
account
|
|
6126
6240
|
}) => makeContractParameters({
|
|
6127
|
-
abi:
|
|
6128
|
-
address:
|
|
6241
|
+
abi: import_protocol_deployments12.zoraSparksManagerImplABI,
|
|
6242
|
+
address: import_protocol_deployments12.zoraSparksManagerImplAddress[chainId],
|
|
6129
6243
|
functionName: "mintWithEth",
|
|
6130
6244
|
args: [tokenId, quantity, recipient || addressOrAccountAddress(account)],
|
|
6131
6245
|
value: pricePerMint * quantity,
|
|
@@ -6140,8 +6254,8 @@ var mintsBalanceOfAccountParams = ({
|
|
|
6140
6254
|
account,
|
|
6141
6255
|
chainId
|
|
6142
6256
|
}) => ({
|
|
6143
|
-
abi:
|
|
6144
|
-
address:
|
|
6257
|
+
abi: import_protocol_deployments12.zoraMints1155Config.abi,
|
|
6258
|
+
address: import_protocol_deployments12.zoraMints1155Config.address[chainId],
|
|
6145
6259
|
functionName: "balanceOfAccount",
|
|
6146
6260
|
args: [account]
|
|
6147
6261
|
});
|
|
@@ -6150,8 +6264,8 @@ var encodeCollectOnManager = ({
|
|
|
6150
6264
|
minter,
|
|
6151
6265
|
zoraCreator1155TokenId,
|
|
6152
6266
|
mintArguments
|
|
6153
|
-
}) => (0,
|
|
6154
|
-
abi:
|
|
6267
|
+
}) => (0, import_viem11.encodeFunctionData)({
|
|
6268
|
+
abi: import_protocol_deployments12.zoraMintsManagerImplConfig.abi,
|
|
6155
6269
|
functionName: "collect",
|
|
6156
6270
|
args: [
|
|
6157
6271
|
zoraCreator1155Contract,
|
|
@@ -6180,8 +6294,8 @@ function collectWithMintsParams({
|
|
|
6180
6294
|
mintArguments
|
|
6181
6295
|
});
|
|
6182
6296
|
return makeContractParameters({
|
|
6183
|
-
abi:
|
|
6184
|
-
address:
|
|
6297
|
+
abi: import_protocol_deployments12.zoraMints1155Config.abi,
|
|
6298
|
+
address: import_protocol_deployments12.zoraMints1155Config.address[chainId],
|
|
6185
6299
|
functionName: "transferBatchToManagerAndCall",
|
|
6186
6300
|
args: [tokenIds, quantities, call],
|
|
6187
6301
|
// if it is a paid mint, the aadditional value will be sent to the manager contract and forwarded to the creator 1155 contract
|
|
@@ -6194,12 +6308,12 @@ function getMintsEthPrice({
|
|
|
6194
6308
|
publicClient
|
|
6195
6309
|
}) {
|
|
6196
6310
|
const chainId = publicClient.chain?.id;
|
|
6197
|
-
if (!chainId || !
|
|
6311
|
+
if (!chainId || !import_protocol_deployments12.zoraMintsManagerImplAddress[chainId]) {
|
|
6198
6312
|
throw new Error(`Chain id ${chainId} not supported`);
|
|
6199
6313
|
}
|
|
6200
6314
|
return publicClient.readContract({
|
|
6201
|
-
abi:
|
|
6202
|
-
address:
|
|
6315
|
+
abi: import_protocol_deployments12.zoraMintsManagerImplABI,
|
|
6316
|
+
address: import_protocol_deployments12.zoraMintsManagerImplAddress[chainId],
|
|
6203
6317
|
functionName: "getEthPrice"
|
|
6204
6318
|
});
|
|
6205
6319
|
}
|
|
@@ -6223,7 +6337,7 @@ function makePermitTransferBatchAndTypeData({
|
|
|
6223
6337
|
safeTransferData
|
|
6224
6338
|
};
|
|
6225
6339
|
const typedData = {
|
|
6226
|
-
...(0,
|
|
6340
|
+
...(0, import_protocol_deployments12.mintsSafeTransferBatchTypedDataDefinition)({
|
|
6227
6341
|
chainId,
|
|
6228
6342
|
message: permit
|
|
6229
6343
|
}),
|
|
@@ -6254,7 +6368,7 @@ function makePermitTransferTypeData({
|
|
|
6254
6368
|
safeTransferData
|
|
6255
6369
|
};
|
|
6256
6370
|
const typedData = {
|
|
6257
|
-
...(0,
|
|
6371
|
+
...(0, import_protocol_deployments12.mintsSafeTransferTypedDataDefinition)({
|
|
6258
6372
|
chainId,
|
|
6259
6373
|
message: permit
|
|
6260
6374
|
}),
|
|
@@ -6270,9 +6384,9 @@ var encodePremintOnManager = ({
|
|
|
6270
6384
|
premintConfig,
|
|
6271
6385
|
premintSignature,
|
|
6272
6386
|
mintArguments,
|
|
6273
|
-
signerContract =
|
|
6274
|
-
}) => (0,
|
|
6275
|
-
abi:
|
|
6387
|
+
signerContract = import_viem11.zeroAddress
|
|
6388
|
+
}) => (0, import_viem11.encodeFunctionData)({
|
|
6389
|
+
abi: import_protocol_deployments12.zoraMintsManagerImplConfig.abi,
|
|
6276
6390
|
functionName: "collectPremintV2",
|
|
6277
6391
|
args: [
|
|
6278
6392
|
contractCreationConfig,
|
|
@@ -6311,7 +6425,7 @@ var makePermitToCollectPremintOrNonPremint = ({
|
|
|
6311
6425
|
nonce,
|
|
6312
6426
|
deadline,
|
|
6313
6427
|
safeTransferData,
|
|
6314
|
-
to:
|
|
6428
|
+
to: import_protocol_deployments12.zoraMintsManagerImplConfig.address[chainId]
|
|
6315
6429
|
});
|
|
6316
6430
|
};
|
|
6317
6431
|
function collectPremintV2WithMintsParams({
|
|
@@ -6326,8 +6440,8 @@ function collectPremintV2WithMintsParams({
|
|
|
6326
6440
|
...rest
|
|
6327
6441
|
});
|
|
6328
6442
|
return makeContractParameters({
|
|
6329
|
-
abi:
|
|
6330
|
-
address:
|
|
6443
|
+
abi: import_protocol_deployments12.zoraMints1155Config.abi,
|
|
6444
|
+
address: import_protocol_deployments12.zoraMints1155Config.address[chainId],
|
|
6331
6445
|
functionName: "transferBatchToManagerAndCall",
|
|
6332
6446
|
args: [tokenIds, quantities, call],
|
|
6333
6447
|
value: getPaidMintValue(quantities, paidMintPricePerToken),
|
|
@@ -6338,8 +6452,8 @@ function decodeCallFailedError(error) {
|
|
|
6338
6452
|
if (error.data?.errorName !== "CallFailed")
|
|
6339
6453
|
throw new Error("Not a CallFailed error");
|
|
6340
6454
|
const internalErrorData = error.data?.args?.[0];
|
|
6341
|
-
return (0,
|
|
6342
|
-
abi:
|
|
6455
|
+
return (0, import_viem11.decodeErrorResult)({
|
|
6456
|
+
abi: import_protocol_deployments12.zoraMintsManagerImplABI,
|
|
6343
6457
|
data: internalErrorData
|
|
6344
6458
|
});
|
|
6345
6459
|
}
|