@zoralabs/protocol-sdk 0.11.9 → 0.11.11-DEV.0
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/.env +3 -0
- package/.turbo/turbo-build.log +18 -18
- package/CHANGELOG.md +15 -0
- package/dist/anvil.d.ts +1 -12
- package/dist/anvil.d.ts.map +1 -1
- package/dist/index.cjs +7 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +7 -7
- package/dist/index.js.map +1 -1
- package/dist/premint/premint-client.d.ts +27 -27
- package/dist/sparks/sparks-contracts.d.ts +1 -1
- package/dist/test-utils.d.ts +12 -2
- package/dist/test-utils.d.ts.map +1 -1
- package/dist/waitForSuccess.d.ts +4 -0
- package/dist/waitForSuccess.d.ts.map +1 -0
- package/package.json +2 -2
- package/src/comments/comments.test.ts +4 -2
- package/src/create/1155-create-helper.test.ts +7 -4
- package/src/create/minter-defaults.ts +7 -7
- package/src/fixtures/contract-setup.ts +1 -1
- package/src/fixtures/secondary.ts +1 -1
- package/src/mint/mint-client.test.ts +2 -1
- package/src/rewards/rewards-client.test.ts +2 -5
- package/src/secondary/secondary-client.test.ts +2 -5
- package/src/sparks/sparks-contracts-test.ts +1 -4
- package/src/sparks/sparks-contracts.ts +1 -1
- package/src/test-utils.ts +56 -12
- package/src/waitForSuccess.ts +13 -0
- package/yarn-error.log +8602 -0
|
@@ -125,27 +125,26 @@ export declare class PremintClient {
|
|
|
125
125
|
* @returns receipt, log, zoraURL
|
|
126
126
|
*/
|
|
127
127
|
makeMintParameters({ minterAccount, tokenContract, uid, mintArguments, firstMinter, }: MakeMintParametersArguments): Promise<SimulateContractParameters<readonly [{
|
|
128
|
-
readonly stateMutability: "nonpayable";
|
|
129
128
|
readonly type: "constructor";
|
|
130
129
|
readonly inputs: readonly [{
|
|
131
130
|
readonly name: "_factory";
|
|
132
131
|
readonly internalType: "contract IZoraCreator1155Factory";
|
|
133
132
|
readonly type: "address";
|
|
134
133
|
}];
|
|
135
|
-
}, {
|
|
136
134
|
readonly stateMutability: "nonpayable";
|
|
135
|
+
}, {
|
|
137
136
|
readonly type: "function";
|
|
138
137
|
readonly inputs: readonly [];
|
|
139
138
|
readonly name: "acceptOwnership";
|
|
140
139
|
readonly outputs: readonly [];
|
|
141
|
-
}, {
|
|
142
140
|
readonly stateMutability: "nonpayable";
|
|
141
|
+
}, {
|
|
143
142
|
readonly type: "function";
|
|
144
143
|
readonly inputs: readonly [];
|
|
145
144
|
readonly name: "cancelOwnershipTransfer";
|
|
146
145
|
readonly outputs: readonly [];
|
|
146
|
+
readonly stateMutability: "nonpayable";
|
|
147
147
|
}, {
|
|
148
|
-
readonly stateMutability: "pure";
|
|
149
148
|
readonly type: "function";
|
|
150
149
|
readonly inputs: readonly [];
|
|
151
150
|
readonly name: "contractName";
|
|
@@ -154,8 +153,8 @@ export declare class PremintClient {
|
|
|
154
153
|
readonly internalType: "string";
|
|
155
154
|
readonly type: "string";
|
|
156
155
|
}];
|
|
157
|
-
}, {
|
|
158
156
|
readonly stateMutability: "pure";
|
|
157
|
+
}, {
|
|
159
158
|
readonly type: "function";
|
|
160
159
|
readonly inputs: readonly [];
|
|
161
160
|
readonly name: "contractVersion";
|
|
@@ -164,8 +163,8 @@ export declare class PremintClient {
|
|
|
164
163
|
readonly internalType: "string";
|
|
165
164
|
readonly type: "string";
|
|
166
165
|
}];
|
|
166
|
+
readonly stateMutability: "pure";
|
|
167
167
|
}, {
|
|
168
|
-
readonly stateMutability: "view";
|
|
169
168
|
readonly type: "function";
|
|
170
169
|
readonly inputs: readonly [{
|
|
171
170
|
readonly name: "contractConfig";
|
|
@@ -191,8 +190,8 @@ export declare class PremintClient {
|
|
|
191
190
|
readonly internalType: "address";
|
|
192
191
|
readonly type: "address";
|
|
193
192
|
}];
|
|
194
|
-
}, {
|
|
195
193
|
readonly stateMutability: "view";
|
|
194
|
+
}, {
|
|
196
195
|
readonly type: "function";
|
|
197
196
|
readonly inputs: readonly [{
|
|
198
197
|
readonly name: "contractConfig";
|
|
@@ -222,8 +221,8 @@ export declare class PremintClient {
|
|
|
222
221
|
readonly internalType: "address";
|
|
223
222
|
readonly type: "address";
|
|
224
223
|
}];
|
|
225
|
-
}, {
|
|
226
224
|
readonly stateMutability: "view";
|
|
225
|
+
}, {
|
|
227
226
|
readonly type: "function";
|
|
228
227
|
readonly inputs: readonly [];
|
|
229
228
|
readonly name: "implementation";
|
|
@@ -232,8 +231,8 @@ export declare class PremintClient {
|
|
|
232
231
|
readonly internalType: "address";
|
|
233
232
|
readonly type: "address";
|
|
234
233
|
}];
|
|
234
|
+
readonly stateMutability: "view";
|
|
235
235
|
}, {
|
|
236
|
-
readonly stateMutability: "nonpayable";
|
|
237
236
|
readonly type: "function";
|
|
238
237
|
readonly inputs: readonly [{
|
|
239
238
|
readonly name: "_initialOwner";
|
|
@@ -242,8 +241,8 @@ export declare class PremintClient {
|
|
|
242
241
|
}];
|
|
243
242
|
readonly name: "initialize";
|
|
244
243
|
readonly outputs: readonly [];
|
|
244
|
+
readonly stateMutability: "nonpayable";
|
|
245
245
|
}, {
|
|
246
|
-
readonly stateMutability: "view";
|
|
247
246
|
readonly type: "function";
|
|
248
247
|
readonly inputs: readonly [{
|
|
249
248
|
readonly name: "signer";
|
|
@@ -264,8 +263,8 @@ export declare class PremintClient {
|
|
|
264
263
|
readonly internalType: "bool";
|
|
265
264
|
readonly type: "bool";
|
|
266
265
|
}];
|
|
267
|
-
}, {
|
|
268
266
|
readonly stateMutability: "view";
|
|
267
|
+
}, {
|
|
269
268
|
readonly type: "function";
|
|
270
269
|
readonly inputs: readonly [{
|
|
271
270
|
readonly name: "signer";
|
|
@@ -290,8 +289,8 @@ export declare class PremintClient {
|
|
|
290
289
|
readonly internalType: "bool";
|
|
291
290
|
readonly type: "bool";
|
|
292
291
|
}];
|
|
293
|
-
}, {
|
|
294
292
|
readonly stateMutability: "view";
|
|
293
|
+
}, {
|
|
295
294
|
readonly type: "function";
|
|
296
295
|
readonly inputs: readonly [{
|
|
297
296
|
readonly name: "contractConfig";
|
|
@@ -391,8 +390,8 @@ export declare class PremintClient {
|
|
|
391
390
|
readonly internalType: "address";
|
|
392
391
|
readonly type: "address";
|
|
393
392
|
}];
|
|
394
|
-
}, {
|
|
395
393
|
readonly stateMutability: "view";
|
|
394
|
+
}, {
|
|
396
395
|
readonly type: "function";
|
|
397
396
|
readonly inputs: readonly [{
|
|
398
397
|
readonly name: "collectionAddress";
|
|
@@ -405,8 +404,8 @@ export declare class PremintClient {
|
|
|
405
404
|
readonly internalType: "uint256";
|
|
406
405
|
readonly type: "uint256";
|
|
407
406
|
}];
|
|
408
|
-
}, {
|
|
409
407
|
readonly stateMutability: "view";
|
|
408
|
+
}, {
|
|
410
409
|
readonly type: "function";
|
|
411
410
|
readonly inputs: readonly [];
|
|
412
411
|
readonly name: "owner";
|
|
@@ -415,8 +414,8 @@ export declare class PremintClient {
|
|
|
415
414
|
readonly internalType: "address";
|
|
416
415
|
readonly type: "address";
|
|
417
416
|
}];
|
|
418
|
-
}, {
|
|
419
417
|
readonly stateMutability: "view";
|
|
418
|
+
}, {
|
|
420
419
|
readonly type: "function";
|
|
421
420
|
readonly inputs: readonly [];
|
|
422
421
|
readonly name: "pendingOwner";
|
|
@@ -425,8 +424,8 @@ export declare class PremintClient {
|
|
|
425
424
|
readonly internalType: "address";
|
|
426
425
|
readonly type: "address";
|
|
427
426
|
}];
|
|
427
|
+
readonly stateMutability: "view";
|
|
428
428
|
}, {
|
|
429
|
-
readonly stateMutability: "payable";
|
|
430
429
|
readonly type: "function";
|
|
431
430
|
readonly inputs: readonly [{
|
|
432
431
|
readonly name: "contractConfig";
|
|
@@ -531,8 +530,8 @@ export declare class PremintClient {
|
|
|
531
530
|
readonly type: "bool";
|
|
532
531
|
}];
|
|
533
532
|
}];
|
|
533
|
+
readonly stateMutability: "payable";
|
|
534
534
|
}, {
|
|
535
|
-
readonly stateMutability: "view";
|
|
536
535
|
readonly type: "function";
|
|
537
536
|
readonly inputs: readonly [{
|
|
538
537
|
readonly name: "contractAddress";
|
|
@@ -553,8 +552,8 @@ export declare class PremintClient {
|
|
|
553
552
|
readonly internalType: "uint256";
|
|
554
553
|
readonly type: "uint256";
|
|
555
554
|
}];
|
|
555
|
+
readonly stateMutability: "view";
|
|
556
556
|
}, {
|
|
557
|
-
readonly stateMutability: "payable";
|
|
558
557
|
readonly type: "function";
|
|
559
558
|
readonly inputs: readonly [{
|
|
560
559
|
readonly name: "contractConfig";
|
|
@@ -680,8 +679,8 @@ export declare class PremintClient {
|
|
|
680
679
|
readonly type: "bool";
|
|
681
680
|
}];
|
|
682
681
|
}];
|
|
683
|
-
}, {
|
|
684
682
|
readonly stateMutability: "payable";
|
|
683
|
+
}, {
|
|
685
684
|
readonly type: "function";
|
|
686
685
|
readonly inputs: readonly [{
|
|
687
686
|
readonly name: "contractConfig";
|
|
@@ -807,8 +806,8 @@ export declare class PremintClient {
|
|
|
807
806
|
readonly type: "bool";
|
|
808
807
|
}];
|
|
809
808
|
}];
|
|
809
|
+
readonly stateMutability: "payable";
|
|
810
810
|
}, {
|
|
811
|
-
readonly stateMutability: "view";
|
|
812
811
|
readonly type: "function";
|
|
813
812
|
readonly inputs: readonly [];
|
|
814
813
|
readonly name: "proxiableUUID";
|
|
@@ -817,14 +816,14 @@ export declare class PremintClient {
|
|
|
817
816
|
readonly internalType: "bytes32";
|
|
818
817
|
readonly type: "bytes32";
|
|
819
818
|
}];
|
|
819
|
+
readonly stateMutability: "view";
|
|
820
820
|
}, {
|
|
821
|
-
readonly stateMutability: "nonpayable";
|
|
822
821
|
readonly type: "function";
|
|
823
822
|
readonly inputs: readonly [];
|
|
824
823
|
readonly name: "resignOwnership";
|
|
825
824
|
readonly outputs: readonly [];
|
|
826
|
-
}, {
|
|
827
825
|
readonly stateMutability: "nonpayable";
|
|
826
|
+
}, {
|
|
828
827
|
readonly type: "function";
|
|
829
828
|
readonly inputs: readonly [{
|
|
830
829
|
readonly name: "_newOwner";
|
|
@@ -833,8 +832,8 @@ export declare class PremintClient {
|
|
|
833
832
|
}];
|
|
834
833
|
readonly name: "safeTransferOwnership";
|
|
835
834
|
readonly outputs: readonly [];
|
|
835
|
+
readonly stateMutability: "nonpayable";
|
|
836
836
|
}, {
|
|
837
|
-
readonly stateMutability: "view";
|
|
838
837
|
readonly type: "function";
|
|
839
838
|
readonly inputs: readonly [{
|
|
840
839
|
readonly name: "contractAddress";
|
|
@@ -847,8 +846,8 @@ export declare class PremintClient {
|
|
|
847
846
|
readonly internalType: "string[]";
|
|
848
847
|
readonly type: "string[]";
|
|
849
848
|
}];
|
|
849
|
+
readonly stateMutability: "view";
|
|
850
850
|
}, {
|
|
851
|
-
readonly stateMutability: "nonpayable";
|
|
852
851
|
readonly type: "function";
|
|
853
852
|
readonly inputs: readonly [{
|
|
854
853
|
readonly name: "_newOwner";
|
|
@@ -857,8 +856,8 @@ export declare class PremintClient {
|
|
|
857
856
|
}];
|
|
858
857
|
readonly name: "transferOwnership";
|
|
859
858
|
readonly outputs: readonly [];
|
|
860
|
-
}, {
|
|
861
859
|
readonly stateMutability: "nonpayable";
|
|
860
|
+
}, {
|
|
862
861
|
readonly type: "function";
|
|
863
862
|
readonly inputs: readonly [{
|
|
864
863
|
readonly name: "newImplementation";
|
|
@@ -867,8 +866,8 @@ export declare class PremintClient {
|
|
|
867
866
|
}];
|
|
868
867
|
readonly name: "upgradeTo";
|
|
869
868
|
readonly outputs: readonly [];
|
|
869
|
+
readonly stateMutability: "nonpayable";
|
|
870
870
|
}, {
|
|
871
|
-
readonly stateMutability: "payable";
|
|
872
871
|
readonly type: "function";
|
|
873
872
|
readonly inputs: readonly [{
|
|
874
873
|
readonly name: "newImplementation";
|
|
@@ -881,8 +880,8 @@ export declare class PremintClient {
|
|
|
881
880
|
}];
|
|
882
881
|
readonly name: "upgradeToAndCall";
|
|
883
882
|
readonly outputs: readonly [];
|
|
883
|
+
readonly stateMutability: "payable";
|
|
884
884
|
}, {
|
|
885
|
-
readonly stateMutability: "view";
|
|
886
885
|
readonly type: "function";
|
|
887
886
|
readonly inputs: readonly [];
|
|
888
887
|
readonly name: "zora1155Factory";
|
|
@@ -891,6 +890,7 @@ export declare class PremintClient {
|
|
|
891
890
|
readonly internalType: "contract IZoraCreator1155Factory";
|
|
892
891
|
readonly type: "address";
|
|
893
892
|
}];
|
|
893
|
+
readonly stateMutability: "view";
|
|
894
894
|
}, {
|
|
895
895
|
readonly type: "event";
|
|
896
896
|
readonly anonymous: false;
|
|
@@ -149,7 +149,7 @@ declare const encodePremintOnManager: ({ contractCreationConfig, premintConfig,
|
|
|
149
149
|
* @param chainId - The ID of the chain where the MINTs are to be used
|
|
150
150
|
* @param deadline - The deadline of the permit.
|
|
151
151
|
* @param nonce - Random nonce of the permit.
|
|
152
|
-
* @param tokenIds - The mint token ids to
|
|
152
|
+
* @param tokenIds - The mint token ids to use
|
|
153
153
|
* @param quantities - The quantities of each token to use to collect the Zora Creator 1155 token with. The sum of these quantities will be the total quantity of the Zora Creator 1155 token collected.
|
|
154
154
|
* @param premint - If this is for a premint, the configuration of the premint to collect
|
|
155
155
|
* @param collect - If this is for a non-premint, the configuration of the non-premint to collect
|
package/dist/test-utils.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { zoraCreator1155FactoryImplAddress } from "@zoralabs/protocol-deployments";
|
|
2
|
-
import { Address,
|
|
2
|
+
import { Address, PublicClient, Chain, WalletClient, SimulateContractReturnType, Account } from "viem";
|
|
3
3
|
import { NewContractParams } from "./create/types";
|
|
4
|
-
|
|
4
|
+
import { SimulateContractParametersWithAccount } from "./types";
|
|
5
5
|
export declare const getFixedPricedMinter: ({ publicClient, chainId, }: {
|
|
6
6
|
publicClient: PublicClient;
|
|
7
7
|
chainId: keyof typeof zoraCreator1155FactoryImplAddress;
|
|
@@ -12,4 +12,14 @@ export declare const fixedPriceMinterMinterArguments: ({ mintRecipient, }: {
|
|
|
12
12
|
export declare function randomNewContract(): NewContractParams;
|
|
13
13
|
export declare const randomNonce: () => `0x${string}`;
|
|
14
14
|
export declare const thirtySecondsFromNow: () => bigint;
|
|
15
|
+
export declare function simulateAndWriteContractWithRetries({ parameters, walletClient, publicClient, }: {
|
|
16
|
+
parameters: SimulateContractParametersWithAccount;
|
|
17
|
+
walletClient: WalletClient;
|
|
18
|
+
publicClient: PublicClient;
|
|
19
|
+
}): Promise<import("viem").TransactionReceipt>;
|
|
20
|
+
export declare function writeContractWithRetries({ request, walletClient, publicClient, }: {
|
|
21
|
+
request: SimulateContractReturnType<any, any, any, Chain, Account>["request"];
|
|
22
|
+
walletClient: WalletClient;
|
|
23
|
+
publicClient: PublicClient;
|
|
24
|
+
}): Promise<import("viem").TransactionReceipt>;
|
|
15
25
|
//# sourceMappingURL=test-utils.d.ts.map
|
package/dist/test-utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-utils.d.ts","sourceRoot":"","sources":["../src/test-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,iCAAiC,EAClC,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,OAAO,EACP,
|
|
1
|
+
{"version":3,"file":"test-utils.d.ts","sourceRoot":"","sources":["../src/test-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,iCAAiC,EAClC,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,OAAO,EACP,YAAY,EAKZ,KAAK,EACL,YAAY,EACZ,0BAA0B,EAC1B,OAAO,EACR,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,OAAO,EAAE,qCAAqC,EAAE,MAAM,SAAS,CAAC;AAEhE,eAAO,MAAM,oBAAoB,+BAG9B;IACD,YAAY,EAAE,YAAY,CAAC;IAC3B,OAAO,EAAE,MAAM,OAAO,iCAAiC,CAAC;CACzD,2BAKG,CAAC;AAEL,eAAO,MAAM,+BAA+B,uBAEzC;IACD,aAAa,EAAE,OAAO,CAAC;CACxB,kBAAwE,CAAC;AAI1E,wBAAgB,iBAAiB,IAAI,iBAAiB,CAKrD;AAED,eAAO,MAAM,WAAW,qBAC8B,CAAC;AACvD,eAAO,MAAM,oBAAoB,cACsB,CAAC;AAExD,wBAAsB,mCAAmC,CAAC,EACxD,UAAU,EACV,YAAY,EACZ,YAAY,GACb,EAAE;IACD,UAAU,EAAE,qCAAqC,CAAC;IAClD,YAAY,EAAE,YAAY,CAAC;IAC3B,YAAY,EAAE,YAAY,CAAC;CAC5B,8CAOA;AAED,wBAAsB,wBAAwB,CAAC,EAC7C,OAAO,EACP,YAAY,EACZ,YAAY,GACb,EAAE;IACD,OAAO,EAAE,0BAA0B,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC;IAC9E,YAAY,EAAE,YAAY,CAAC;IAC3B,YAAY,EAAE,YAAY,CAAC;CAC5B,8CAuBA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"waitForSuccess.d.ts","sourceRoot":"","sources":["../src/waitForSuccess.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,wBAAwB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AAEpC,eAAO,MAAM,cAAc,SAAgB,GAAG,gBAAgB,YAAY,+CAQzE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zoralabs/protocol-sdk",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.11-DEV.0",
|
|
4
4
|
"repository": "https://github.com/ourzora/zora-protocol",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@zoralabs/protocol-deployments": "^0.3.
|
|
19
|
+
"@zoralabs/protocol-deployments": "^0.3.11-DEV.4"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
22
|
"viem": "^2.21.21",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { describe, expect } from "vitest";
|
|
2
|
-
import { forkUrls, makeAnvilTest
|
|
2
|
+
import { forkUrls, makeAnvilTest } from "src/anvil";
|
|
3
|
+
import { writeContractWithRetries } from "src/test-utils";
|
|
3
4
|
import { base, zora } from "viem/chains";
|
|
4
5
|
import {
|
|
5
6
|
commentsABI,
|
|
@@ -25,7 +26,8 @@ import {
|
|
|
25
26
|
hashTypedData,
|
|
26
27
|
} from "viem";
|
|
27
28
|
import { createCreatorClient } from "src/sdk";
|
|
28
|
-
import { randomNewContract
|
|
29
|
+
import { randomNewContract } from "src/test-utils";
|
|
30
|
+
import { waitForSuccess } from "src/waitForSuccess";
|
|
29
31
|
import { permitCommentTypedDataDefinition } from "@zoralabs/protocol-deployments";
|
|
30
32
|
import { demoTokenMetadataURI } from "src/fixtures/contract-setup";
|
|
31
33
|
import { randomNonce, thirtySecondsFromNow } from "src/test-utils";
|
|
@@ -9,15 +9,14 @@ import {
|
|
|
9
9
|
zoraTimedSaleStrategyABI,
|
|
10
10
|
zoraTimedSaleStrategyAddress,
|
|
11
11
|
} from "@zoralabs/protocol-deployments";
|
|
12
|
-
import { waitForSuccess } from "src/
|
|
12
|
+
import { waitForSuccess } from "src/waitForSuccess";
|
|
13
13
|
import { Address, erc20Abi, parseEther, PublicClient } from "viem";
|
|
14
14
|
import { makePrepareMint1155TokenParams } from "src/mint/mint-transactions";
|
|
15
|
+
import { forkUrls, makeAnvilTest } from "src/anvil";
|
|
15
16
|
import {
|
|
16
|
-
forkUrls,
|
|
17
|
-
makeAnvilTest,
|
|
18
17
|
simulateAndWriteContractWithRetries,
|
|
19
18
|
writeContractWithRetries,
|
|
20
|
-
} from "src/
|
|
19
|
+
} from "src/test-utils";
|
|
21
20
|
import { zora } from "viem/chains";
|
|
22
21
|
import { AllowList } from "src/allow-list/types";
|
|
23
22
|
import { createAllowList } from "src/allow-list/allow-list-client";
|
|
@@ -451,6 +450,8 @@ describe("create-helper", () => {
|
|
|
451
450
|
|
|
452
451
|
const pricePerToken = parseEther("0.01");
|
|
453
452
|
|
|
453
|
+
const blockTime = (await publicClient.getBlock()).timestamp;
|
|
454
|
+
|
|
454
455
|
const {
|
|
455
456
|
parameters: request,
|
|
456
457
|
contractAddress: collectionAddress,
|
|
@@ -463,6 +464,7 @@ describe("create-helper", () => {
|
|
|
463
464
|
tokenMetadataURI: demoTokenMetadataURI,
|
|
464
465
|
salesConfig: {
|
|
465
466
|
pricePerToken,
|
|
467
|
+
saleStart: blockTime,
|
|
466
468
|
},
|
|
467
469
|
},
|
|
468
470
|
account: creatorAddress,
|
|
@@ -507,6 +509,7 @@ describe("create-helper", () => {
|
|
|
507
509
|
},
|
|
508
510
|
},
|
|
509
511
|
quantityToMint,
|
|
512
|
+
chainId: chain.id,
|
|
510
513
|
});
|
|
511
514
|
|
|
512
515
|
const { request: collectSimulation } =
|
|
@@ -18,12 +18,12 @@ export const DEFAULT_MARKET_COUNTDOWN = BigInt(24 * 60 * 60);
|
|
|
18
18
|
// Sales end forever amount (uint64 max)
|
|
19
19
|
export const SALE_END_FOREVER = 18446744073709551615n;
|
|
20
20
|
|
|
21
|
-
const DEFAULT_SALE_START_AND_END: Concrete<SaleStartAndEnd>
|
|
22
|
-
// Sale start time –
|
|
23
|
-
saleStart:
|
|
21
|
+
const DEFAULT_SALE_START_AND_END = (): Concrete<SaleStartAndEnd> => ({
|
|
22
|
+
// Sale start time – defaults to current time in seconds
|
|
23
|
+
saleStart: BigInt(Math.floor(new Date().getTime() / 1000)),
|
|
24
24
|
// This is the end of uint64, plenty of time
|
|
25
25
|
saleEnd: SALE_END_FOREVER,
|
|
26
|
-
};
|
|
26
|
+
});
|
|
27
27
|
|
|
28
28
|
const DEFAULT_MAX_TOKENS_PER_ADDRESS: Concrete<MaxTokensPerAddress> = {
|
|
29
29
|
maxTokensPerAddress: 0n,
|
|
@@ -32,7 +32,7 @@ const DEFAULT_MAX_TOKENS_PER_ADDRESS: Concrete<MaxTokensPerAddress> = {
|
|
|
32
32
|
const erc20SaleSettingsWithDefaults = (
|
|
33
33
|
params: Erc20ParamsType,
|
|
34
34
|
): Concrete<Erc20ParamsType> => ({
|
|
35
|
-
...DEFAULT_SALE_START_AND_END,
|
|
35
|
+
...DEFAULT_SALE_START_AND_END(),
|
|
36
36
|
...DEFAULT_MAX_TOKENS_PER_ADDRESS,
|
|
37
37
|
...params,
|
|
38
38
|
});
|
|
@@ -41,7 +41,7 @@ const allowListWithDefaults = (
|
|
|
41
41
|
allowlist: AllowListParamType,
|
|
42
42
|
): Concrete<AllowListParamType> => {
|
|
43
43
|
return {
|
|
44
|
-
...DEFAULT_SALE_START_AND_END,
|
|
44
|
+
...DEFAULT_SALE_START_AND_END(),
|
|
45
45
|
...allowlist,
|
|
46
46
|
};
|
|
47
47
|
};
|
|
@@ -49,7 +49,7 @@ const allowListWithDefaults = (
|
|
|
49
49
|
const fixedPriceSettingsWithDefaults = (
|
|
50
50
|
params: FixedPriceParamsType,
|
|
51
51
|
): Concrete<FixedPriceParamsType> => ({
|
|
52
|
-
...DEFAULT_SALE_START_AND_END,
|
|
52
|
+
...DEFAULT_SALE_START_AND_END(),
|
|
53
53
|
...DEFAULT_MAX_TOKENS_PER_ADDRESS,
|
|
54
54
|
type: "fixedPrice",
|
|
55
55
|
...params,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Address, Chain, PublicClient, WalletClient } from "viem";
|
|
2
|
-
import { simulateAndWriteContractWithRetries } from "src/
|
|
2
|
+
import { simulateAndWriteContractWithRetries } from "src/test-utils";
|
|
3
3
|
import { createCreatorClient } from "src/sdk";
|
|
4
4
|
import { SubgraphMintGetter } from "src/mint/subgraph-mint-getter";
|
|
5
5
|
import { SubgraphRewardsGetter } from "../rewards/subgraph-rewards-getter";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Address, Account, PublicClient, TestClient, WalletClient } from "viem";
|
|
2
2
|
import { CollectorClient } from "../sdk";
|
|
3
|
-
import { simulateAndWriteContractWithRetries } from "
|
|
3
|
+
import { simulateAndWriteContractWithRetries } from "src/test-utils";
|
|
4
4
|
import { makeContractParameters } from "../utils";
|
|
5
5
|
import {
|
|
6
6
|
zoraTimedSaleStrategyABI,
|
|
@@ -14,7 +14,8 @@ import {
|
|
|
14
14
|
commentsABI,
|
|
15
15
|
callerAndCommenterABI,
|
|
16
16
|
} from "@zoralabs/protocol-deployments";
|
|
17
|
-
import { forkUrls, makeAnvilTest
|
|
17
|
+
import { forkUrls, makeAnvilTest } from "src/anvil";
|
|
18
|
+
import { writeContractWithRetries } from "src/test-utils";
|
|
18
19
|
import { createCollectorClient, createCreatorClient } from "src/sdk";
|
|
19
20
|
import { getAllowListEntry } from "src/allow-list/allow-list-client";
|
|
20
21
|
import { SubgraphMintGetter } from "./subgraph-mint-getter";
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { describe, expect, vi } from "vitest";
|
|
2
2
|
import { encodeAbiParameters, erc20Abi, parseEther } from "viem";
|
|
3
3
|
import { zoraSepolia, base } from "viem/chains";
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
makeAnvilTest,
|
|
7
|
-
simulateAndWriteContractWithRetries,
|
|
8
|
-
} from "src/anvil";
|
|
4
|
+
import { forkUrls, makeAnvilTest } from "src/anvil";
|
|
5
|
+
import { simulateAndWriteContractWithRetries } from "src/test-utils";
|
|
9
6
|
import { createCollectorClient, createCreatorClient } from "src/sdk";
|
|
10
7
|
import { new1155ContractVersion } from "src/create/contract-setup";
|
|
11
8
|
import { ISubgraphQuerier } from "src/apis/subgraph-querier";
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { describe, expect, vi } from "vitest";
|
|
2
2
|
import { parseEther, Address, parseEventLogs } from "viem";
|
|
3
3
|
import { zoraSepolia } from "viem/chains";
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
makeAnvilTest,
|
|
7
|
-
simulateAndWriteContractWithRetries,
|
|
8
|
-
} from "src/anvil";
|
|
4
|
+
import { forkUrls, makeAnvilTest } from "src/anvil";
|
|
5
|
+
import { simulateAndWriteContractWithRetries } from "src/test-utils";
|
|
9
6
|
import { createCollectorClient } from "src/sdk";
|
|
10
7
|
import {
|
|
11
8
|
zoraCreator1155ImplABI,
|
|
@@ -9,13 +9,11 @@ import {
|
|
|
9
9
|
zoraCreator1155ImplABI,
|
|
10
10
|
zoraMints1155ABI,
|
|
11
11
|
zoraMints1155Address,
|
|
12
|
-
zoraMintsManagerImplABI,
|
|
13
12
|
zoraMintsManagerImplAddress,
|
|
14
13
|
PremintMintArguments,
|
|
15
14
|
premintTypedDataDefinition,
|
|
16
15
|
zoraSparks1155Address,
|
|
17
16
|
zoraSparks1155ABI,
|
|
18
|
-
zoraSparksManagerImplABI,
|
|
19
17
|
} from "@zoralabs/protocol-deployments";
|
|
20
18
|
import {
|
|
21
19
|
Address,
|
|
@@ -39,10 +37,9 @@ import { zora } from "viem/chains";
|
|
|
39
37
|
import {
|
|
40
38
|
fixedPriceMinterMinterArguments,
|
|
41
39
|
getFixedPricedMinter,
|
|
42
|
-
waitForSuccess,
|
|
43
40
|
} from "src/test-utils";
|
|
44
41
|
import { PublicClient } from "src/utils";
|
|
45
|
-
|
|
42
|
+
import { waitForSuccess } from "src/waitForSuccess";
|
|
46
43
|
const sparksMainnetDeployedBlock = 17655716;
|
|
47
44
|
|
|
48
45
|
const anvilTest = makeAnvilTest({
|
|
@@ -338,7 +338,7 @@ const encodePremintOnManager = ({
|
|
|
338
338
|
* @param chainId - The ID of the chain where the MINTs are to be used
|
|
339
339
|
* @param deadline - The deadline of the permit.
|
|
340
340
|
* @param nonce - Random nonce of the permit.
|
|
341
|
-
* @param tokenIds - The mint token ids to
|
|
341
|
+
* @param tokenIds - The mint token ids to use
|
|
342
342
|
* @param quantities - The quantities of each token to use to collect the Zora Creator 1155 token with. The sum of these quantities will be the total quantity of the Zora Creator 1155 token collected.
|
|
343
343
|
* @param premint - If this is for a premint, the configuration of the premint to collect
|
|
344
344
|
* @param collect - If this is for a non-premint, the configuration of the non-premint to collect
|
package/src/test-utils.ts
CHANGED
|
@@ -4,25 +4,19 @@ import {
|
|
|
4
4
|
} from "@zoralabs/protocol-deployments";
|
|
5
5
|
import {
|
|
6
6
|
Address,
|
|
7
|
-
Hex,
|
|
8
7
|
PublicClient,
|
|
9
8
|
encodeAbiParameters,
|
|
10
9
|
keccak256,
|
|
11
10
|
toBytes,
|
|
12
11
|
parseAbiParameters,
|
|
12
|
+
Chain,
|
|
13
|
+
WalletClient,
|
|
14
|
+
SimulateContractReturnType,
|
|
15
|
+
Account,
|
|
13
16
|
} from "viem";
|
|
14
17
|
import { NewContractParams } from "./create/types";
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
export const waitForSuccess = async (hash: Hex, publicClient: PublicClient) => {
|
|
18
|
-
const receipt = await publicClient.waitForTransactionReceipt({
|
|
19
|
-
hash,
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
expect(receipt.status).toBe("success");
|
|
23
|
-
|
|
24
|
-
return receipt;
|
|
25
|
-
};
|
|
18
|
+
import { retries } from "./apis/http-api-base";
|
|
19
|
+
import { SimulateContractParametersWithAccount } from "./types";
|
|
26
20
|
|
|
27
21
|
export const getFixedPricedMinter = async ({
|
|
28
22
|
publicClient,
|
|
@@ -56,3 +50,53 @@ export const randomNonce = () =>
|
|
|
56
50
|
keccak256(toBytes(Math.round(Math.random() * 1000)));
|
|
57
51
|
export const thirtySecondsFromNow = () =>
|
|
58
52
|
BigInt(Math.round(new Date().getTime() / 1000)) + 30n;
|
|
53
|
+
|
|
54
|
+
export async function simulateAndWriteContractWithRetries({
|
|
55
|
+
parameters,
|
|
56
|
+
walletClient,
|
|
57
|
+
publicClient,
|
|
58
|
+
}: {
|
|
59
|
+
parameters: SimulateContractParametersWithAccount;
|
|
60
|
+
walletClient: WalletClient;
|
|
61
|
+
publicClient: PublicClient;
|
|
62
|
+
}) {
|
|
63
|
+
const { request } = await publicClient.simulateContract(parameters);
|
|
64
|
+
return await writeContractWithRetries({
|
|
65
|
+
request,
|
|
66
|
+
walletClient,
|
|
67
|
+
publicClient,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export async function writeContractWithRetries({
|
|
72
|
+
request,
|
|
73
|
+
walletClient,
|
|
74
|
+
publicClient,
|
|
75
|
+
}: {
|
|
76
|
+
request: SimulateContractReturnType<any, any, any, Chain, Account>["request"];
|
|
77
|
+
walletClient: WalletClient;
|
|
78
|
+
publicClient: PublicClient;
|
|
79
|
+
}) {
|
|
80
|
+
let tryCount = 1;
|
|
81
|
+
const tryFn = async () => {
|
|
82
|
+
if (tryCount > 1) {
|
|
83
|
+
console.log("retrying try #", tryCount);
|
|
84
|
+
}
|
|
85
|
+
const hash = await walletClient.writeContract(request);
|
|
86
|
+
const receipt = await publicClient.waitForTransactionReceipt({ hash });
|
|
87
|
+
|
|
88
|
+
if (receipt.status !== "success") {
|
|
89
|
+
console.log("failed try #", tryCount);
|
|
90
|
+
tryCount++;
|
|
91
|
+
throw new Error("transaction failed");
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return receipt;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
const shouldRetry = () => {
|
|
98
|
+
return true;
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
return await retries(tryFn, 3, 1000, shouldRetry);
|
|
102
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { expect } from "vitest";
|
|
2
|
+
import { Hex } from "viem/_types/types/misc";
|
|
3
|
+
import { PublicClient } from "viem";
|
|
4
|
+
|
|
5
|
+
export const waitForSuccess = async (hash: Hex, publicClient: PublicClient) => {
|
|
6
|
+
const receipt = await publicClient.waitForTransactionReceipt({
|
|
7
|
+
hash,
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
expect(receipt.status).toBe("success");
|
|
11
|
+
|
|
12
|
+
return receipt;
|
|
13
|
+
};
|