thirdweb 5.59.2 → 5.60.0-nightly-6c26012a71d884f99dd5d8c914b3879037b36d56-20240929000339
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/dist/cjs/exports/deploys.js +3 -1
- package/dist/cjs/exports/deploys.js.map +1 -1
- package/dist/cjs/exports/extensions/pack.js +24 -0
- package/dist/cjs/exports/extensions/pack.js.map +1 -0
- package/dist/cjs/extensions/pack/__generated__/IPack/events/PackCreated.js +31 -0
- package/dist/cjs/extensions/pack/__generated__/IPack/events/PackCreated.js.map +1 -0
- package/dist/cjs/extensions/pack/__generated__/IPack/events/PackOpened.js +32 -0
- package/dist/cjs/extensions/pack/__generated__/IPack/events/PackOpened.js.map +1 -0
- package/dist/cjs/extensions/pack/__generated__/IPack/events/PackUpdated.js +31 -0
- package/dist/cjs/extensions/pack/__generated__/IPack/events/PackUpdated.js.map +1 -0
- package/dist/cjs/extensions/pack/__generated__/IPack/read/canUpdatePack.js +114 -0
- package/dist/cjs/extensions/pack/__generated__/IPack/read/canUpdatePack.js.map +1 -0
- package/dist/cjs/extensions/pack/__generated__/IPack/read/getPackContents.js +137 -0
- package/dist/cjs/extensions/pack/__generated__/IPack/read/getPackContents.js.map +1 -0
- package/dist/cjs/extensions/pack/__generated__/IPack/read/getTokenCountOfBundle.js +114 -0
- package/dist/cjs/extensions/pack/__generated__/IPack/read/getTokenCountOfBundle.js.map +1 -0
- package/dist/cjs/extensions/pack/__generated__/IPack/read/getTokenOfBundle.js +139 -0
- package/dist/cjs/extensions/pack/__generated__/IPack/read/getTokenOfBundle.js.map +1 -0
- package/dist/cjs/extensions/pack/__generated__/IPack/read/getUriOfBundle.js +114 -0
- package/dist/cjs/extensions/pack/__generated__/IPack/read/getUriOfBundle.js.map +1 -0
- package/dist/cjs/extensions/pack/__generated__/IPack/write/addPackContents.js +175 -0
- package/dist/cjs/extensions/pack/__generated__/IPack/write/addPackContents.js.map +1 -0
- package/dist/cjs/extensions/pack/__generated__/IPack/write/createPack.js +193 -0
- package/dist/cjs/extensions/pack/__generated__/IPack/write/createPack.js.map +1 -0
- package/dist/cjs/extensions/pack/__generated__/IPack/write/openPack.js +146 -0
- package/dist/cjs/extensions/pack/__generated__/IPack/write/openPack.js.map +1 -0
- package/dist/cjs/extensions/pack/__generated__/IPackVRFDirect/events/PackOpenRequested.js +32 -0
- package/dist/cjs/extensions/pack/__generated__/IPackVRFDirect/events/PackOpenRequested.js.map +1 -0
- package/dist/cjs/extensions/pack/__generated__/IPackVRFDirect/events/PackRandomnessFulfilled.js +32 -0
- package/dist/cjs/extensions/pack/__generated__/IPackVRFDirect/events/PackRandomnessFulfilled.js.map +1 -0
- package/dist/cjs/extensions/pack/__generated__/IPackVRFDirect/read/canClaimRewards.js +114 -0
- package/dist/cjs/extensions/pack/__generated__/IPackVRFDirect/read/canClaimRewards.js.map +1 -0
- package/dist/cjs/extensions/pack/__generated__/IPackVRFDirect/write/claimRewards.js +74 -0
- package/dist/cjs/extensions/pack/__generated__/IPackVRFDirect/write/claimRewards.js.map +1 -0
- package/dist/cjs/extensions/pack/__generated__/IPackVRFDirect/write/openPackAndClaimRewards.js +143 -0
- package/dist/cjs/extensions/pack/__generated__/IPackVRFDirect/write/openPackAndClaimRewards.js.map +1 -0
- package/dist/cjs/extensions/pack/createNewPack.js +285 -0
- package/dist/cjs/extensions/pack/createNewPack.js.map +1 -0
- package/dist/cjs/extensions/prebuilts/__generated__/Pack/write/initialize.js +175 -0
- package/dist/cjs/extensions/prebuilts/__generated__/Pack/write/initialize.js.map +1 -0
- package/dist/cjs/extensions/prebuilts/deploy-pack.js +115 -0
- package/dist/cjs/extensions/prebuilts/deploy-pack.js.map +1 -0
- package/dist/cjs/rpc/watchBlockNumber.js +2 -8
- package/dist/cjs/rpc/watchBlockNumber.js.map +1 -1
- package/dist/cjs/utils/sleep.js +12 -0
- package/dist/cjs/utils/sleep.js.map +1 -0
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/version.js.map +1 -1
- package/dist/cjs/wallets/in-app/web/utils/iFrameCommunication/IframeCommunicator.js +4 -8
- package/dist/cjs/wallets/in-app/web/utils/iFrameCommunication/IframeCommunicator.js.map +1 -1
- package/dist/esm/exports/deploys.js +1 -0
- package/dist/esm/exports/deploys.js.map +1 -1
- package/dist/esm/exports/extensions/pack.js +12 -0
- package/dist/esm/exports/extensions/pack.js.map +1 -0
- package/dist/esm/extensions/pack/__generated__/IPack/events/PackCreated.js +28 -0
- package/dist/esm/extensions/pack/__generated__/IPack/events/PackCreated.js.map +1 -0
- package/dist/esm/extensions/pack/__generated__/IPack/events/PackOpened.js +29 -0
- package/dist/esm/extensions/pack/__generated__/IPack/events/PackOpened.js.map +1 -0
- package/dist/esm/extensions/pack/__generated__/IPack/events/PackUpdated.js +28 -0
- package/dist/esm/extensions/pack/__generated__/IPack/events/PackUpdated.js.map +1 -0
- package/dist/esm/extensions/pack/__generated__/IPack/read/canUpdatePack.js +106 -0
- package/dist/esm/extensions/pack/__generated__/IPack/read/canUpdatePack.js.map +1 -0
- package/dist/esm/extensions/pack/__generated__/IPack/read/getPackContents.js +129 -0
- package/dist/esm/extensions/pack/__generated__/IPack/read/getPackContents.js.map +1 -0
- package/dist/esm/extensions/pack/__generated__/IPack/read/getTokenCountOfBundle.js +106 -0
- package/dist/esm/extensions/pack/__generated__/IPack/read/getTokenCountOfBundle.js.map +1 -0
- package/dist/esm/extensions/pack/__generated__/IPack/read/getTokenOfBundle.js +131 -0
- package/dist/esm/extensions/pack/__generated__/IPack/read/getTokenOfBundle.js.map +1 -0
- package/dist/esm/extensions/pack/__generated__/IPack/read/getUriOfBundle.js +106 -0
- package/dist/esm/extensions/pack/__generated__/IPack/read/getUriOfBundle.js.map +1 -0
- package/dist/esm/extensions/pack/__generated__/IPack/write/addPackContents.js +168 -0
- package/dist/esm/extensions/pack/__generated__/IPack/write/addPackContents.js.map +1 -0
- package/dist/esm/extensions/pack/__generated__/IPack/write/createPack.js +186 -0
- package/dist/esm/extensions/pack/__generated__/IPack/write/createPack.js.map +1 -0
- package/dist/esm/extensions/pack/__generated__/IPack/write/openPack.js +139 -0
- package/dist/esm/extensions/pack/__generated__/IPack/write/openPack.js.map +1 -0
- package/dist/esm/extensions/pack/__generated__/IPackVRFDirect/events/PackOpenRequested.js +29 -0
- package/dist/esm/extensions/pack/__generated__/IPackVRFDirect/events/PackOpenRequested.js.map +1 -0
- package/dist/esm/extensions/pack/__generated__/IPackVRFDirect/events/PackRandomnessFulfilled.js +29 -0
- package/dist/esm/extensions/pack/__generated__/IPackVRFDirect/events/PackRandomnessFulfilled.js.map +1 -0
- package/dist/esm/extensions/pack/__generated__/IPackVRFDirect/read/canClaimRewards.js +106 -0
- package/dist/esm/extensions/pack/__generated__/IPackVRFDirect/read/canClaimRewards.js.map +1 -0
- package/dist/esm/extensions/pack/__generated__/IPackVRFDirect/write/claimRewards.js +69 -0
- package/dist/esm/extensions/pack/__generated__/IPackVRFDirect/write/claimRewards.js.map +1 -0
- package/dist/esm/extensions/pack/__generated__/IPackVRFDirect/write/openPackAndClaimRewards.js +136 -0
- package/dist/esm/extensions/pack/__generated__/IPackVRFDirect/write/openPackAndClaimRewards.js.map +1 -0
- package/dist/esm/extensions/pack/createNewPack.js +281 -0
- package/dist/esm/extensions/pack/createNewPack.js.map +1 -0
- package/dist/esm/extensions/prebuilts/__generated__/Pack/write/initialize.js +168 -0
- package/dist/esm/extensions/prebuilts/__generated__/Pack/write/initialize.js.map +1 -0
- package/dist/esm/extensions/prebuilts/deploy-pack.js +112 -0
- package/dist/esm/extensions/prebuilts/deploy-pack.js.map +1 -0
- package/dist/esm/rpc/watchBlockNumber.js +1 -7
- package/dist/esm/rpc/watchBlockNumber.js.map +1 -1
- package/dist/esm/utils/sleep.js +9 -0
- package/dist/esm/utils/sleep.js.map +1 -0
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/esm/wallets/in-app/web/utils/iFrameCommunication/IframeCommunicator.js +4 -8
- package/dist/esm/wallets/in-app/web/utils/iFrameCommunication/IframeCommunicator.js.map +1 -1
- package/dist/types/exports/deploys.d.ts +1 -0
- package/dist/types/exports/deploys.d.ts.map +1 -1
- package/dist/types/exports/extensions/pack.d.ts +9 -0
- package/dist/types/exports/extensions/pack.d.ts.map +1 -0
- package/dist/types/extensions/pack/__generated__/IPack/events/PackCreated.d.ts +47 -0
- package/dist/types/extensions/pack/__generated__/IPack/events/PackCreated.d.ts.map +1 -0
- package/dist/types/extensions/pack/__generated__/IPack/events/PackOpened.d.ts +70 -0
- package/dist/types/extensions/pack/__generated__/IPack/events/PackOpened.d.ts.map +1 -0
- package/dist/types/extensions/pack/__generated__/IPack/events/PackUpdated.d.ts +47 -0
- package/dist/types/extensions/pack/__generated__/IPack/events/PackUpdated.d.ts.map +1 -0
- package/dist/types/extensions/pack/__generated__/IPack/read/canUpdatePack.d.ts +83 -0
- package/dist/types/extensions/pack/__generated__/IPack/read/canUpdatePack.d.ts.map +1 -0
- package/dist/types/extensions/pack/__generated__/IPack/read/getPackContents.d.ts +93 -0
- package/dist/types/extensions/pack/__generated__/IPack/read/getPackContents.d.ts.map +1 -0
- package/dist/types/extensions/pack/__generated__/IPack/read/getTokenCountOfBundle.d.ts +83 -0
- package/dist/types/extensions/pack/__generated__/IPack/read/getTokenCountOfBundle.d.ts.map +1 -0
- package/dist/types/extensions/pack/__generated__/IPack/read/getTokenOfBundle.d.ts +100 -0
- package/dist/types/extensions/pack/__generated__/IPack/read/getTokenOfBundle.d.ts.map +1 -0
- package/dist/types/extensions/pack/__generated__/IPack/read/getUriOfBundle.d.ts +83 -0
- package/dist/types/extensions/pack/__generated__/IPack/read/getUriOfBundle.d.ts.map +1 -0
- package/dist/types/extensions/pack/__generated__/IPack/write/addPackContents.d.ts +118 -0
- package/dist/types/extensions/pack/__generated__/IPack/write/addPackContents.d.ts.map +1 -0
- package/dist/types/extensions/pack/__generated__/IPack/write/createPack.d.ts +132 -0
- package/dist/types/extensions/pack/__generated__/IPack/write/createPack.d.ts.map +1 -0
- package/dist/types/extensions/pack/__generated__/IPack/write/openPack.d.ts +86 -0
- package/dist/types/extensions/pack/__generated__/IPack/write/openPack.d.ts.map +1 -0
- package/dist/types/extensions/pack/__generated__/IPackVRFDirect/events/PackOpenRequested.d.ts +57 -0
- package/dist/types/extensions/pack/__generated__/IPackVRFDirect/events/PackOpenRequested.d.ts.map +1 -0
- package/dist/types/extensions/pack/__generated__/IPackVRFDirect/events/PackRandomnessFulfilled.d.ts +51 -0
- package/dist/types/extensions/pack/__generated__/IPackVRFDirect/events/PackRandomnessFulfilled.d.ts.map +1 -0
- package/dist/types/extensions/pack/__generated__/IPackVRFDirect/read/canClaimRewards.d.ts +83 -0
- package/dist/types/extensions/pack/__generated__/IPackVRFDirect/read/canClaimRewards.d.ts.map +1 -0
- package/dist/types/extensions/pack/__generated__/IPackVRFDirect/write/claimRewards.d.ts +33 -0
- package/dist/types/extensions/pack/__generated__/IPackVRFDirect/write/claimRewards.d.ts.map +1 -0
- package/dist/types/extensions/pack/__generated__/IPackVRFDirect/write/openPackAndClaimRewards.d.ts +93 -0
- package/dist/types/extensions/pack/__generated__/IPackVRFDirect/write/openPackAndClaimRewards.d.ts.map +1 -0
- package/dist/types/extensions/pack/createNewPack.d.ts +104 -0
- package/dist/types/extensions/pack/createNewPack.d.ts.map +1 -0
- package/dist/types/extensions/prebuilts/__generated__/Pack/write/initialize.d.ts +121 -0
- package/dist/types/extensions/prebuilts/__generated__/Pack/write/initialize.d.ts.map +1 -0
- package/dist/types/extensions/prebuilts/deploy-pack.d.ts +62 -0
- package/dist/types/extensions/prebuilts/deploy-pack.d.ts.map +1 -0
- package/dist/types/rpc/watchBlockNumber.d.ts.map +1 -1
- package/dist/types/utils/sleep.d.ts +7 -0
- package/dist/types/utils/sleep.d.ts.map +1 -0
- package/dist/types/version.d.ts +1 -1
- package/dist/types/version.d.ts.map +1 -1
- package/dist/types/wallets/in-app/web/utils/iFrameCommunication/IframeCommunicator.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/exports/deploys.ts +6 -0
- package/src/exports/extensions/pack.ts +42 -0
- package/src/extensions/erc1155/drops/read/getActiveClaimCondition.test.ts +6 -4
- package/src/extensions/erc721/drops/write/updateMetadata.test.ts +2 -2
- package/src/extensions/erc721/read/getTotalClaimedSupply.test.ts +2 -2
- package/src/extensions/erc721/read/getTotalUnclaimedSupply.test.ts +2 -2
- package/src/extensions/erc721/write/updateTokenURI.test.ts +2 -2
- package/src/extensions/pack/__generated__/IPack/events/PackCreated.ts +41 -0
- package/src/extensions/pack/__generated__/IPack/events/PackOpened.ts +47 -0
- package/src/extensions/pack/__generated__/IPack/events/PackUpdated.ts +41 -0
- package/src/extensions/pack/__generated__/IPack/read/canUpdatePack.ts +125 -0
- package/src/extensions/pack/__generated__/IPack/read/getPackContents.ts +148 -0
- package/src/extensions/pack/__generated__/IPack/read/getTokenCountOfBundle.ts +129 -0
- package/src/extensions/pack/__generated__/IPack/read/getTokenOfBundle.ts +151 -0
- package/src/extensions/pack/__generated__/IPack/read/getUriOfBundle.ts +125 -0
- package/src/extensions/pack/__generated__/IPack/write/addPackContents.ts +213 -0
- package/src/extensions/pack/__generated__/IPack/write/createPack.ts +239 -0
- package/src/extensions/pack/__generated__/IPack/write/openPack.ts +168 -0
- package/src/extensions/pack/__generated__/IPackVRFDirect/events/PackOpenRequested.ts +49 -0
- package/src/extensions/pack/__generated__/IPackVRFDirect/events/PackRandomnessFulfilled.ts +49 -0
- package/src/extensions/pack/__generated__/IPackVRFDirect/read/canClaimRewards.ts +125 -0
- package/src/extensions/pack/__generated__/IPackVRFDirect/write/claimRewards.ts +73 -0
- package/src/extensions/pack/__generated__/IPackVRFDirect/write/openPackAndClaimRewards.ts +177 -0
- package/src/extensions/pack/createNewPack.test.ts +207 -0
- package/src/extensions/pack/createNewPack.ts +433 -0
- package/src/extensions/prebuilts/__generated__/Pack/write/initialize.ts +216 -0
- package/src/extensions/prebuilts/deploy-erc20.test.ts +5 -3
- package/src/extensions/prebuilts/deploy-erc721.test.ts +6 -4
- package/src/extensions/prebuilts/deploy-pack.test.ts +23 -0
- package/src/extensions/prebuilts/deploy-pack.ts +173 -0
- package/src/extensions/prebuilts/deploy-split.test.ts +2 -2
- package/src/extensions/prebuilts/deploy-vote.test.ts +7 -5
- package/src/extensions/split/read/getAllRecipientsAddresses.test.ts +2 -2
- package/src/extensions/split/read/getAllRecipientsPercentages.test.ts +2 -2
- package/src/extensions/split/read/getRecipientSplitPercentage.test.ts +4 -2
- package/src/extensions/vote/read/proposalExists.test.ts +6 -6
- package/src/rpc/watchBlockNumber.ts +1 -8
- package/src/utils/sleep.ts +8 -0
- package/src/version.ts +1 -1
- package/src/wallets/in-app/web/utils/iFrameCommunication/IframeCommunicator.ts +5 -9
- package/src/wallets/smart/smart-wallet-integration-v07.test.ts +11 -8
- package/src/wallets/utils/getTokenBalance.test.ts +8 -6
@@ -0,0 +1,216 @@
|
|
1
|
+
import type { AbiParameterToPrimitiveType } from "abitype";
|
2
|
+
import type {
|
3
|
+
BaseTransactionOptions,
|
4
|
+
WithOverrides,
|
5
|
+
} from "../../../../../transaction/types.js";
|
6
|
+
import { prepareContractCall } from "../../../../../transaction/prepare-contract-call.js";
|
7
|
+
import { encodeAbiParameters } from "../../../../../utils/abi/encodeAbiParameters.js";
|
8
|
+
import { once } from "../../../../../utils/promise/once.js";
|
9
|
+
import { detectMethod } from "../../../../../utils/bytecode/detectExtension.js";
|
10
|
+
|
11
|
+
/**
|
12
|
+
* Represents the parameters for the "initialize" function.
|
13
|
+
*/
|
14
|
+
export type InitializeParams = WithOverrides<{
|
15
|
+
defaultAdmin: AbiParameterToPrimitiveType<{
|
16
|
+
type: "address";
|
17
|
+
name: "_defaultAdmin";
|
18
|
+
}>;
|
19
|
+
name: AbiParameterToPrimitiveType<{ type: "string"; name: "_name" }>;
|
20
|
+
symbol: AbiParameterToPrimitiveType<{ type: "string"; name: "_symbol" }>;
|
21
|
+
contractURI: AbiParameterToPrimitiveType<{
|
22
|
+
type: "string";
|
23
|
+
name: "_contractURI";
|
24
|
+
}>;
|
25
|
+
trustedForwarders: AbiParameterToPrimitiveType<{
|
26
|
+
type: "address[]";
|
27
|
+
name: "_trustedForwarders";
|
28
|
+
}>;
|
29
|
+
royaltyRecipient: AbiParameterToPrimitiveType<{
|
30
|
+
type: "address";
|
31
|
+
name: "_royaltyRecipient";
|
32
|
+
}>;
|
33
|
+
royaltyBps: AbiParameterToPrimitiveType<{
|
34
|
+
type: "uint256";
|
35
|
+
name: "_royaltyBps";
|
36
|
+
}>;
|
37
|
+
}>;
|
38
|
+
|
39
|
+
export const FN_SELECTOR = "0x754b8fe7" as const;
|
40
|
+
const FN_INPUTS = [
|
41
|
+
{
|
42
|
+
type: "address",
|
43
|
+
name: "_defaultAdmin",
|
44
|
+
},
|
45
|
+
{
|
46
|
+
type: "string",
|
47
|
+
name: "_name",
|
48
|
+
},
|
49
|
+
{
|
50
|
+
type: "string",
|
51
|
+
name: "_symbol",
|
52
|
+
},
|
53
|
+
{
|
54
|
+
type: "string",
|
55
|
+
name: "_contractURI",
|
56
|
+
},
|
57
|
+
{
|
58
|
+
type: "address[]",
|
59
|
+
name: "_trustedForwarders",
|
60
|
+
},
|
61
|
+
{
|
62
|
+
type: "address",
|
63
|
+
name: "_royaltyRecipient",
|
64
|
+
},
|
65
|
+
{
|
66
|
+
type: "uint256",
|
67
|
+
name: "_royaltyBps",
|
68
|
+
},
|
69
|
+
] as const;
|
70
|
+
const FN_OUTPUTS = [] as const;
|
71
|
+
|
72
|
+
/**
|
73
|
+
* Checks if the `initialize` method is supported by the given contract.
|
74
|
+
* @param availableSelectors An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors.
|
75
|
+
* @returns A boolean indicating if the `initialize` method is supported.
|
76
|
+
* @extension PREBUILTS
|
77
|
+
* @example
|
78
|
+
* ```ts
|
79
|
+
* import { isInitializeSupported } from "thirdweb/extensions/prebuilts";
|
80
|
+
*
|
81
|
+
* const supported = isInitializeSupported(["0x..."]);
|
82
|
+
* ```
|
83
|
+
*/
|
84
|
+
export function isInitializeSupported(availableSelectors: string[]) {
|
85
|
+
return detectMethod({
|
86
|
+
availableSelectors,
|
87
|
+
method: [FN_SELECTOR, FN_INPUTS, FN_OUTPUTS] as const,
|
88
|
+
});
|
89
|
+
}
|
90
|
+
|
91
|
+
/**
|
92
|
+
* Encodes the parameters for the "initialize" function.
|
93
|
+
* @param options - The options for the initialize function.
|
94
|
+
* @returns The encoded ABI parameters.
|
95
|
+
* @extension PREBUILTS
|
96
|
+
* @example
|
97
|
+
* ```ts
|
98
|
+
* import { encodeInitializeParams } from "thirdweb/extensions/prebuilts";
|
99
|
+
* const result = encodeInitializeParams({
|
100
|
+
* defaultAdmin: ...,
|
101
|
+
* name: ...,
|
102
|
+
* symbol: ...,
|
103
|
+
* contractURI: ...,
|
104
|
+
* trustedForwarders: ...,
|
105
|
+
* royaltyRecipient: ...,
|
106
|
+
* royaltyBps: ...,
|
107
|
+
* });
|
108
|
+
* ```
|
109
|
+
*/
|
110
|
+
export function encodeInitializeParams(options: InitializeParams) {
|
111
|
+
return encodeAbiParameters(FN_INPUTS, [
|
112
|
+
options.defaultAdmin,
|
113
|
+
options.name,
|
114
|
+
options.symbol,
|
115
|
+
options.contractURI,
|
116
|
+
options.trustedForwarders,
|
117
|
+
options.royaltyRecipient,
|
118
|
+
options.royaltyBps,
|
119
|
+
]);
|
120
|
+
}
|
121
|
+
|
122
|
+
/**
|
123
|
+
* Encodes the "initialize" function into a Hex string with its parameters.
|
124
|
+
* @param options - The options for the initialize function.
|
125
|
+
* @returns The encoded hexadecimal string.
|
126
|
+
* @extension PREBUILTS
|
127
|
+
* @example
|
128
|
+
* ```ts
|
129
|
+
* import { encodeInitialize } from "thirdweb/extensions/prebuilts";
|
130
|
+
* const result = encodeInitialize({
|
131
|
+
* defaultAdmin: ...,
|
132
|
+
* name: ...,
|
133
|
+
* symbol: ...,
|
134
|
+
* contractURI: ...,
|
135
|
+
* trustedForwarders: ...,
|
136
|
+
* royaltyRecipient: ...,
|
137
|
+
* royaltyBps: ...,
|
138
|
+
* });
|
139
|
+
* ```
|
140
|
+
*/
|
141
|
+
export function encodeInitialize(options: InitializeParams) {
|
142
|
+
// we do a "manual" concat here to avoid the overhead of the "concatHex" function
|
143
|
+
// we can do this because we know the specific formats of the values
|
144
|
+
return (FN_SELECTOR +
|
145
|
+
encodeInitializeParams(options).slice(
|
146
|
+
2,
|
147
|
+
)) as `${typeof FN_SELECTOR}${string}`;
|
148
|
+
}
|
149
|
+
|
150
|
+
/**
|
151
|
+
* Prepares a transaction to call the "initialize" function on the contract.
|
152
|
+
* @param options - The options for the "initialize" function.
|
153
|
+
* @returns A prepared transaction object.
|
154
|
+
* @extension PREBUILTS
|
155
|
+
* @example
|
156
|
+
* ```ts
|
157
|
+
* import { sendTransaction } from "thirdweb";
|
158
|
+
* import { initialize } from "thirdweb/extensions/prebuilts";
|
159
|
+
*
|
160
|
+
* const transaction = initialize({
|
161
|
+
* contract,
|
162
|
+
* defaultAdmin: ...,
|
163
|
+
* name: ...,
|
164
|
+
* symbol: ...,
|
165
|
+
* contractURI: ...,
|
166
|
+
* trustedForwarders: ...,
|
167
|
+
* royaltyRecipient: ...,
|
168
|
+
* royaltyBps: ...,
|
169
|
+
* overrides: {
|
170
|
+
* ...
|
171
|
+
* }
|
172
|
+
* });
|
173
|
+
*
|
174
|
+
* // Send the transaction
|
175
|
+
* await sendTransaction({ transaction, account });
|
176
|
+
* ```
|
177
|
+
*/
|
178
|
+
export function initialize(
|
179
|
+
options: BaseTransactionOptions<
|
180
|
+
| InitializeParams
|
181
|
+
| {
|
182
|
+
asyncParams: () => Promise<InitializeParams>;
|
183
|
+
}
|
184
|
+
>,
|
185
|
+
) {
|
186
|
+
const asyncOptions = once(async () => {
|
187
|
+
return "asyncParams" in options ? await options.asyncParams() : options;
|
188
|
+
});
|
189
|
+
|
190
|
+
return prepareContractCall({
|
191
|
+
contract: options.contract,
|
192
|
+
method: [FN_SELECTOR, FN_INPUTS, FN_OUTPUTS] as const,
|
193
|
+
params: async () => {
|
194
|
+
const resolvedOptions = await asyncOptions();
|
195
|
+
return [
|
196
|
+
resolvedOptions.defaultAdmin,
|
197
|
+
resolvedOptions.name,
|
198
|
+
resolvedOptions.symbol,
|
199
|
+
resolvedOptions.contractURI,
|
200
|
+
resolvedOptions.trustedForwarders,
|
201
|
+
resolvedOptions.royaltyRecipient,
|
202
|
+
resolvedOptions.royaltyBps,
|
203
|
+
] as const;
|
204
|
+
},
|
205
|
+
value: async () => (await asyncOptions()).overrides?.value,
|
206
|
+
accessList: async () => (await asyncOptions()).overrides?.accessList,
|
207
|
+
gas: async () => (await asyncOptions()).overrides?.gas,
|
208
|
+
gasPrice: async () => (await asyncOptions()).overrides?.gasPrice,
|
209
|
+
maxFeePerGas: async () => (await asyncOptions()).overrides?.maxFeePerGas,
|
210
|
+
maxPriorityFeePerGas: async () =>
|
211
|
+
(await asyncOptions()).overrides?.maxPriorityFeePerGas,
|
212
|
+
nonce: async () => (await asyncOptions()).overrides?.nonce,
|
213
|
+
extraGas: async () => (await asyncOptions()).overrides?.extraGas,
|
214
|
+
erc20Value: async () => (await asyncOptions()).overrides?.erc20Value,
|
215
|
+
});
|
216
|
+
}
|
@@ -1,11 +1,13 @@
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
2
2
|
import { ANVIL_CHAIN } from "../../../test/src/chains.js";
|
3
3
|
import { TEST_CLIENT } from "../../../test/src/test-clients.js";
|
4
|
-
import {
|
4
|
+
import { TEST_ACCOUNT_D } from "../../../test/src/test-wallets.js";
|
5
5
|
import { getContract } from "../../contract/contract.js";
|
6
6
|
import { name } from "../common/read/name.js";
|
7
7
|
import { deployERC20Contract } from "./deploy-erc20.js";
|
8
8
|
|
9
|
+
const account = TEST_ACCOUNT_D;
|
10
|
+
|
9
11
|
// skip this test suite if there is no secret key available to test with
|
10
12
|
// TODO: remove reliance on secret key during unit tests entirely
|
11
13
|
describe.runIf(process.env.TW_SECRET_KEY)("deployERC20", () => {
|
@@ -13,7 +15,7 @@ describe.runIf(process.env.TW_SECRET_KEY)("deployERC20", () => {
|
|
13
15
|
const address = await deployERC20Contract({
|
14
16
|
client: TEST_CLIENT,
|
15
17
|
chain: ANVIL_CHAIN,
|
16
|
-
account
|
18
|
+
account,
|
17
19
|
type: "DropERC20",
|
18
20
|
params: {
|
19
21
|
name: "TokenDrop",
|
@@ -35,7 +37,7 @@ describe.runIf(process.env.TW_SECRET_KEY)("deployERC20", () => {
|
|
35
37
|
const address = await deployERC20Contract({
|
36
38
|
client: TEST_CLIENT,
|
37
39
|
chain: ANVIL_CHAIN,
|
38
|
-
account
|
40
|
+
account,
|
39
41
|
type: "TokenERC20",
|
40
42
|
params: {
|
41
43
|
name: "Token",
|
@@ -1,11 +1,13 @@
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
2
2
|
import { ANVIL_CHAIN } from "../../../test/src/chains.js";
|
3
3
|
import { TEST_CLIENT } from "../../../test/src/test-clients.js";
|
4
|
-
import {
|
4
|
+
import { TEST_ACCOUNT_B } from "../../../test/src/test-wallets.js";
|
5
5
|
import { getContract } from "../../contract/contract.js";
|
6
6
|
import { name } from "../common/read/name.js";
|
7
7
|
import { deployERC721Contract } from "./deploy-erc721.js";
|
8
8
|
|
9
|
+
const account = TEST_ACCOUNT_B;
|
10
|
+
|
9
11
|
// skip this test suite if there is no secret key available to test with
|
10
12
|
// TODO: remove reliance on secret key during unit tests entirely
|
11
13
|
describe.runIf(process.env.TW_SECRET_KEY)("deployERC721", () => {
|
@@ -13,7 +15,7 @@ describe.runIf(process.env.TW_SECRET_KEY)("deployERC721", () => {
|
|
13
15
|
const address = await deployERC721Contract({
|
14
16
|
client: TEST_CLIENT,
|
15
17
|
chain: ANVIL_CHAIN,
|
16
|
-
account
|
18
|
+
account,
|
17
19
|
type: "DropERC721",
|
18
20
|
params: {
|
19
21
|
name: "NFTDrop",
|
@@ -34,7 +36,7 @@ describe.runIf(process.env.TW_SECRET_KEY)("deployERC721", () => {
|
|
34
36
|
const address = await deployERC721Contract({
|
35
37
|
client: TEST_CLIENT,
|
36
38
|
chain: ANVIL_CHAIN,
|
37
|
-
account
|
39
|
+
account,
|
38
40
|
type: "TokenERC721",
|
39
41
|
params: {
|
40
42
|
name: "NFTCollection",
|
@@ -55,7 +57,7 @@ describe.runIf(process.env.TW_SECRET_KEY)("deployERC721", () => {
|
|
55
57
|
const address = await deployERC721Contract({
|
56
58
|
client: TEST_CLIENT,
|
57
59
|
chain: ANVIL_CHAIN,
|
58
|
-
account
|
60
|
+
account,
|
59
61
|
type: "OpenEditionERC721",
|
60
62
|
params: {
|
61
63
|
name: "OE",
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
2
|
+
import { ANVIL_CHAIN } from "~test/chains.js";
|
3
|
+
import { TEST_CLIENT } from "~test/test-clients.js";
|
4
|
+
import { TEST_ACCOUNT_A } from "~test/test-wallets.js";
|
5
|
+
import { isAddress } from "../../utils/address.js";
|
6
|
+
import { deployPackContract } from "./deploy-pack.js";
|
7
|
+
|
8
|
+
describe.runIf(process.env.TW_SECRET_KEY)("deploy-pack contract", () => {
|
9
|
+
it("should deploy Pack contract", async () => {
|
10
|
+
const address = await deployPackContract({
|
11
|
+
account: TEST_ACCOUNT_A,
|
12
|
+
client: TEST_CLIENT,
|
13
|
+
chain: ANVIL_CHAIN,
|
14
|
+
params: {
|
15
|
+
name: "pack-contract",
|
16
|
+
},
|
17
|
+
});
|
18
|
+
expect(address).toBeDefined();
|
19
|
+
expect(isAddress(address)).toBe(true);
|
20
|
+
// Further tests to verify the functionality of this contract
|
21
|
+
// are done in other Pack tests
|
22
|
+
});
|
23
|
+
});
|
@@ -0,0 +1,173 @@
|
|
1
|
+
import type { Chain } from "../../chains/types.js";
|
2
|
+
import type { ThirdwebClient } from "../../client/client.js";
|
3
|
+
import type { ThirdwebContract } from "../../contract/contract.js";
|
4
|
+
import { deployViaAutoFactory } from "../../contract/deployment/deploy-via-autofactory.js";
|
5
|
+
import {
|
6
|
+
getOrDeployInfraContract,
|
7
|
+
getOrDeployInfraForPublishedContract,
|
8
|
+
} from "../../contract/deployment/utils/bootstrap.js";
|
9
|
+
import { upload } from "../../storage/upload.js";
|
10
|
+
import type { FileOrBufferOrString } from "../../storage/upload/types.js";
|
11
|
+
import type { Prettify } from "../../utils/type-utils.js";
|
12
|
+
import type { ClientAndChainAndAccount } from "../../utils/types.js";
|
13
|
+
import { initialize } from "./__generated__/Pack/write/initialize.js";
|
14
|
+
|
15
|
+
/**
|
16
|
+
* @extension DEPLOY
|
17
|
+
*/
|
18
|
+
export type PackContractParams = {
|
19
|
+
/**
|
20
|
+
* Name of the Pack contract
|
21
|
+
*/
|
22
|
+
name: string;
|
23
|
+
/**
|
24
|
+
* Defaults to the deployer's address
|
25
|
+
*/
|
26
|
+
royaltyRecipient?: string;
|
27
|
+
/**
|
28
|
+
* Defaults to 0 (zero)
|
29
|
+
*/
|
30
|
+
royaltyBps?: number | string;
|
31
|
+
|
32
|
+
description?: string;
|
33
|
+
image?: FileOrBufferOrString;
|
34
|
+
external_link?: string;
|
35
|
+
social_urls?: Record<string, string>;
|
36
|
+
/**
|
37
|
+
* Defaults to an empty string ("")
|
38
|
+
*/
|
39
|
+
symbol?: string;
|
40
|
+
contractURI?: string;
|
41
|
+
/**
|
42
|
+
* Defaults to the deployer's address
|
43
|
+
*/
|
44
|
+
defaultAdmin?: string;
|
45
|
+
trustedForwarders?: string[];
|
46
|
+
};
|
47
|
+
|
48
|
+
/**
|
49
|
+
* @extension DEPLOY
|
50
|
+
*/
|
51
|
+
export type DeployPackContractOptions = Prettify<
|
52
|
+
ClientAndChainAndAccount & {
|
53
|
+
params: PackContractParams;
|
54
|
+
}
|
55
|
+
>;
|
56
|
+
|
57
|
+
/**
|
58
|
+
* Deploy a thirdweb Pack contract
|
59
|
+
* @param options params for deploying [`Pack contract`](https://thirdweb.com/thirdweb.eth/Pack)
|
60
|
+
* @returns
|
61
|
+
*
|
62
|
+
* @example
|
63
|
+
* ```ts
|
64
|
+
* import { deployPackContract } from "thirdweb/extensions/deploy";
|
65
|
+
*
|
66
|
+
* const packAddress = await deployPackContract({
|
67
|
+
* account,
|
68
|
+
* client,
|
69
|
+
* chain,
|
70
|
+
* params: {
|
71
|
+
* name: "Pack contract name",
|
72
|
+
* symbol: "PACK1155",
|
73
|
+
* },
|
74
|
+
* });
|
75
|
+
* ```
|
76
|
+
*/
|
77
|
+
export async function deployPackContract(options: DeployPackContractOptions) {
|
78
|
+
const { chain, client, account, params } = options;
|
79
|
+
const [WETH, forwarder] = await Promise.all([
|
80
|
+
getOrDeployInfraContract({
|
81
|
+
chain,
|
82
|
+
client,
|
83
|
+
account,
|
84
|
+
contractId: "WETH9",
|
85
|
+
}),
|
86
|
+
getOrDeployInfraContract({
|
87
|
+
chain,
|
88
|
+
client,
|
89
|
+
account,
|
90
|
+
contractId: "Forwarder",
|
91
|
+
}),
|
92
|
+
]);
|
93
|
+
const { cloneFactoryContract, implementationContract } =
|
94
|
+
await getOrDeployInfraForPublishedContract({
|
95
|
+
chain,
|
96
|
+
client,
|
97
|
+
account,
|
98
|
+
contractId: "Pack",
|
99
|
+
constructorParams: {
|
100
|
+
nativeTokenWrapper: WETH.address,
|
101
|
+
trustedForwarder: forwarder.address,
|
102
|
+
},
|
103
|
+
});
|
104
|
+
const initializeTransaction = await getInitializeTransaction({
|
105
|
+
client,
|
106
|
+
implementationContract,
|
107
|
+
params,
|
108
|
+
accountAddress: account.address,
|
109
|
+
chain,
|
110
|
+
});
|
111
|
+
|
112
|
+
return deployViaAutoFactory({
|
113
|
+
client,
|
114
|
+
chain,
|
115
|
+
account,
|
116
|
+
cloneFactoryContract,
|
117
|
+
initializeTransaction,
|
118
|
+
});
|
119
|
+
}
|
120
|
+
|
121
|
+
/**
|
122
|
+
* @internal
|
123
|
+
*/
|
124
|
+
async function getInitializeTransaction(options: {
|
125
|
+
client: ThirdwebClient;
|
126
|
+
implementationContract: ThirdwebContract;
|
127
|
+
params: PackContractParams;
|
128
|
+
accountAddress: string;
|
129
|
+
chain: Chain;
|
130
|
+
}) {
|
131
|
+
const { params, implementationContract, accountAddress, client } = options;
|
132
|
+
const contractURI =
|
133
|
+
params.contractURI ||
|
134
|
+
(await upload({
|
135
|
+
client,
|
136
|
+
files: [
|
137
|
+
{
|
138
|
+
name: params.name,
|
139
|
+
description: params.description,
|
140
|
+
symbol: params.symbol || "",
|
141
|
+
image: params.image,
|
142
|
+
external_link: params.external_link,
|
143
|
+
social_urls: params.social_urls,
|
144
|
+
},
|
145
|
+
],
|
146
|
+
})) ||
|
147
|
+
"";
|
148
|
+
let royaltyBps = 0n;
|
149
|
+
if (params.royaltyBps) {
|
150
|
+
const numberVal = Number(params.royaltyBps);
|
151
|
+
if (Number.isNaN(numberVal)) {
|
152
|
+
throw new Error("royaltyBps: Invalid royaltyBps value");
|
153
|
+
}
|
154
|
+
if (numberVal < 0 || numberVal > 100) {
|
155
|
+
throw new Error("royaltyBps: should be between 0 and 100");
|
156
|
+
}
|
157
|
+
// If is a float, make sure it only has 2 digit after the decimal point
|
158
|
+
if (numberVal % 1 !== 0 && !/^\d+(\.\d{1,2})?$/.test(String(numberVal))) {
|
159
|
+
throw new Error("royaltyBps: Maximum 2 decimal places allowed.");
|
160
|
+
}
|
161
|
+
royaltyBps = BigInt(numberVal * 100); // 21.12 -> 2112n
|
162
|
+
}
|
163
|
+
return initialize({
|
164
|
+
contract: implementationContract,
|
165
|
+
name: params.name,
|
166
|
+
symbol: params.symbol || "",
|
167
|
+
defaultAdmin: params.defaultAdmin || accountAddress,
|
168
|
+
royaltyRecipient: params.royaltyRecipient || accountAddress,
|
169
|
+
contractURI,
|
170
|
+
trustedForwarders: params.trustedForwarders || [],
|
171
|
+
royaltyBps,
|
172
|
+
});
|
173
|
+
}
|
@@ -1,14 +1,14 @@
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
2
2
|
import { ANVIL_CHAIN } from "~test/chains.js";
|
3
3
|
import { TEST_CLIENT } from "~test/test-clients.js";
|
4
|
-
import {
|
4
|
+
import { TEST_ACCOUNT_D } from "~test/test-wallets.js";
|
5
5
|
import { isAddress } from "../../utils/address.js";
|
6
6
|
import { deploySplitContract } from "./deploy-split.js";
|
7
7
|
|
8
8
|
describe.runIf(process.env.TW_SECRET_KEY)("deploy-split contract", () => {
|
9
9
|
it("should deploy Split contract", async () => {
|
10
10
|
const address = await deploySplitContract({
|
11
|
-
account:
|
11
|
+
account: TEST_ACCOUNT_D,
|
12
12
|
client: TEST_CLIENT,
|
13
13
|
chain: ANVIL_CHAIN,
|
14
14
|
params: {
|
@@ -2,17 +2,19 @@ import { describe, expect, it } from "vitest";
|
|
2
2
|
import { ANVIL_CHAIN } from "~test/chains.js";
|
3
3
|
import { TEST_CONTRACT_URI } from "~test/ipfs-uris.js";
|
4
4
|
import { TEST_CLIENT } from "~test/test-clients.js";
|
5
|
-
import {
|
5
|
+
import { TEST_ACCOUNT_B } from "~test/test-wallets.js";
|
6
6
|
import { isAddress } from "../../utils/address.js";
|
7
7
|
import { deployERC20Contract } from "./deploy-erc20.js";
|
8
8
|
import { deployVoteContract } from "./deploy-vote.js";
|
9
9
|
|
10
|
+
const account = TEST_ACCOUNT_B;
|
11
|
+
|
10
12
|
describe.runIf(process.env.TW_SECRET_KEY)("deploy-voteERC20 contract", () => {
|
11
13
|
it("should deploy Vote contract", async () => {
|
12
14
|
const tokenAddress = await deployERC20Contract({
|
13
15
|
client: TEST_CLIENT,
|
14
16
|
chain: ANVIL_CHAIN,
|
15
|
-
account
|
17
|
+
account,
|
16
18
|
type: "TokenERC20",
|
17
19
|
params: {
|
18
20
|
name: "Token",
|
@@ -20,7 +22,7 @@ describe.runIf(process.env.TW_SECRET_KEY)("deploy-voteERC20 contract", () => {
|
|
20
22
|
},
|
21
23
|
});
|
22
24
|
const address = await deployVoteContract({
|
23
|
-
account
|
25
|
+
account,
|
24
26
|
client: TEST_CLIENT,
|
25
27
|
chain: ANVIL_CHAIN,
|
26
28
|
params: {
|
@@ -45,7 +47,7 @@ describe.runIf(process.env.TW_SECRET_KEY)("deploy-voteERC20 contract", () => {
|
|
45
47
|
const tokenAddress = await deployERC20Contract({
|
46
48
|
client: TEST_CLIENT,
|
47
49
|
chain: ANVIL_CHAIN,
|
48
|
-
account
|
50
|
+
account,
|
49
51
|
type: "TokenERC20",
|
50
52
|
params: {
|
51
53
|
name: "Token",
|
@@ -54,7 +56,7 @@ describe.runIf(process.env.TW_SECRET_KEY)("deploy-voteERC20 contract", () => {
|
|
54
56
|
});
|
55
57
|
await expect(() =>
|
56
58
|
deployVoteContract({
|
57
|
-
account
|
59
|
+
account,
|
58
60
|
client: TEST_CLIENT,
|
59
61
|
chain: ANVIL_CHAIN,
|
60
62
|
params: {
|
@@ -2,7 +2,7 @@ import { describe, expect, it } from "vitest";
|
|
2
2
|
import { ANVIL_CHAIN } from "~test/chains.js";
|
3
3
|
import { TEST_CONTRACT_URI } from "~test/ipfs-uris.js";
|
4
4
|
import { TEST_CLIENT } from "~test/test-clients.js";
|
5
|
-
import {
|
5
|
+
import { TEST_ACCOUNT_C } from "~test/test-wallets.js";
|
6
6
|
import { getContract } from "../../../contract/contract.js";
|
7
7
|
import { deploySplitContract } from "../../../extensions/prebuilts/deploy-split.js";
|
8
8
|
import { getAllRecipientsAddresses } from "./getAllRecipientsAddresses.js";
|
@@ -17,7 +17,7 @@ describe.runIf(process.env.TW_SECRET_KEY)("getAllRecipientsAddresses", () => {
|
|
17
17
|
"0xA6f11e47dE28B3dB934e945daeb6F538E9019694",
|
18
18
|
];
|
19
19
|
const address = await deploySplitContract({
|
20
|
-
account:
|
20
|
+
account: TEST_ACCOUNT_C,
|
21
21
|
client: TEST_CLIENT,
|
22
22
|
chain: ANVIL_CHAIN,
|
23
23
|
params: {
|
@@ -2,7 +2,7 @@ import { describe, expect, it } from "vitest";
|
|
2
2
|
import { ANVIL_CHAIN } from "~test/chains.js";
|
3
3
|
import { TEST_CONTRACT_URI } from "~test/ipfs-uris.js";
|
4
4
|
import { TEST_CLIENT } from "~test/test-clients.js";
|
5
|
-
import {
|
5
|
+
import { TEST_ACCOUNT_C } from "~test/test-wallets.js";
|
6
6
|
import { getContract } from "../../../contract/contract.js";
|
7
7
|
import { deploySplitContract } from "../../../extensions/prebuilts/deploy-split.js";
|
8
8
|
import { getAllRecipientsPercentages } from "./getAllRecipientsPercentages.js";
|
@@ -17,7 +17,7 @@ describe.runIf(process.env.TW_SECRET_KEY)("getAllRecipientsPercentages", () => {
|
|
17
17
|
"0xA6f11e47dE28B3dB934e945daeb6F538E9019694",
|
18
18
|
];
|
19
19
|
const address = await deploySplitContract({
|
20
|
-
account:
|
20
|
+
account: TEST_ACCOUNT_C,
|
21
21
|
client: TEST_CLIENT,
|
22
22
|
chain: ANVIL_CHAIN,
|
23
23
|
params: {
|
@@ -2,12 +2,14 @@ import { describe, expect, it } from "vitest";
|
|
2
2
|
import { ANVIL_CHAIN } from "~test/chains.js";
|
3
3
|
import { TEST_CONTRACT_URI } from "~test/ipfs-uris.js";
|
4
4
|
import { TEST_CLIENT } from "~test/test-clients.js";
|
5
|
-
import {
|
5
|
+
import { TEST_ACCOUNT_C } from "~test/test-wallets.js";
|
6
6
|
import { getContract } from "../../../contract/contract.js";
|
7
7
|
import { deploySplitContract } from "../../../extensions/prebuilts/deploy-split.js";
|
8
8
|
import { getRecipientSplitPercentage } from "./getRecipientSplitPercentage.js";
|
9
|
+
|
9
10
|
const chain = ANVIL_CHAIN;
|
10
11
|
const client = TEST_CLIENT;
|
12
|
+
const account = TEST_ACCOUNT_C;
|
11
13
|
|
12
14
|
describe.runIf(process.env.TW_SECRET_KEY)("getRecipientSplitPercentage", () => {
|
13
15
|
it("should work", async () => {
|
@@ -16,7 +18,7 @@ describe.runIf(process.env.TW_SECRET_KEY)("getRecipientSplitPercentage", () => {
|
|
16
18
|
"0xA6f11e47dE28B3dB934e945daeb6F538E9019694",
|
17
19
|
];
|
18
20
|
const address = await deploySplitContract({
|
19
|
-
account
|
21
|
+
account,
|
20
22
|
client: TEST_CLIENT,
|
21
23
|
chain: ANVIL_CHAIN,
|
22
24
|
params: {
|
@@ -2,7 +2,7 @@ import { describe, expect, it } from "vitest";
|
|
2
2
|
import { ANVIL_CHAIN } from "~test/chains.js";
|
3
3
|
import { TEST_CONTRACT_URI } from "~test/ipfs-uris.js";
|
4
4
|
import { TEST_CLIENT } from "~test/test-clients.js";
|
5
|
-
import {
|
5
|
+
import { TEST_ACCOUNT_C } from "~test/test-wallets.js";
|
6
6
|
import { getContract } from "../../../contract/contract.js";
|
7
7
|
import { delegate } from "../../../extensions/erc20/__generated__/IVotes/write/delegate.js";
|
8
8
|
import { mintTo } from "../../../extensions/erc20/write/mintTo.js";
|
@@ -13,7 +13,7 @@ import { propose } from "../__generated__/Vote/write/propose.js";
|
|
13
13
|
import { getAll } from "./getAll.js";
|
14
14
|
import { proposalExists } from "./proposalExists.js";
|
15
15
|
|
16
|
-
const account =
|
16
|
+
const account = TEST_ACCOUNT_C;
|
17
17
|
const client = TEST_CLIENT;
|
18
18
|
const chain = ANVIL_CHAIN;
|
19
19
|
|
@@ -22,7 +22,7 @@ describe.runIf(process.env.TW_SECRET_KEY)("proposal exists", () => {
|
|
22
22
|
const tokenAddress = await deployERC20Contract({
|
23
23
|
client: TEST_CLIENT,
|
24
24
|
chain: ANVIL_CHAIN,
|
25
|
-
account
|
25
|
+
account,
|
26
26
|
type: "TokenERC20",
|
27
27
|
params: {
|
28
28
|
name: "Token",
|
@@ -30,7 +30,7 @@ describe.runIf(process.env.TW_SECRET_KEY)("proposal exists", () => {
|
|
30
30
|
},
|
31
31
|
});
|
32
32
|
const address = await deployVoteContract({
|
33
|
-
account
|
33
|
+
account,
|
34
34
|
client: TEST_CLIENT,
|
35
35
|
chain: ANVIL_CHAIN,
|
36
36
|
params: {
|
@@ -57,7 +57,7 @@ describe.runIf(process.env.TW_SECRET_KEY)("proposal exists", () => {
|
|
57
57
|
const tokenAddress = await deployERC20Contract({
|
58
58
|
client: TEST_CLIENT,
|
59
59
|
chain: ANVIL_CHAIN,
|
60
|
-
account
|
60
|
+
account,
|
61
61
|
type: "TokenERC20",
|
62
62
|
params: {
|
63
63
|
name: "Token",
|
@@ -65,7 +65,7 @@ describe.runIf(process.env.TW_SECRET_KEY)("proposal exists", () => {
|
|
65
65
|
},
|
66
66
|
});
|
67
67
|
const address = await deployVoteContract({
|
68
|
-
account
|
68
|
+
account,
|
69
69
|
client: TEST_CLIENT,
|
70
70
|
chain: ANVIL_CHAIN,
|
71
71
|
params: {
|