feat: handle salt for deterministic deploys (#4528)
## Problem solved
Short description of the bug fixed or feature added
<!-- start pr-codex -->
---
## PR-Codex overview
This PR focuses on adding support for deterministic contract deployment using a salt parameter.
### Detailed summary
- Added support for passing a `salt` parameter for deterministic contract deployment
- Updated functions to handle the `salt` parameter for deterministic deploys
- Modified tests to include deterministic deployment scenarios
> The following files were skipped due to too many changes: `packages/thirdweb/src/extensions/prebuilts/deploy-published.ts`, `packages/thirdweb/src/contract/deployment/deploy-with-abi.ts`, `packages/thirdweb/test/src/abis/proxy.ts`
> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}`
<!-- end pr-codex -->
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
---
|
||||
"thirdweb": minor
|
||||
---
|
||||
|
||||
Handle salt parameter for deterministic deploys of published contracts
|
||||
|
||||
You can now pass a salt parameter to the `deployPublishedContract` function to deploy a contract deterministically.
|
||||
|
||||
```ts
|
||||
const address = await deployPublishedContract({
|
||||
client,
|
||||
chain,
|
||||
account,
|
||||
contractId: "Airdrop",
|
||||
contractParams: {
|
||||
defaultAdmin: "0x...",
|
||||
contractURI: "ipfs://...",
|
||||
},
|
||||
salt: "test", // <--- deterministic deploy
|
||||
});
|
||||
```
|
||||
|
||||
This also works for unpublished contracts, via the `deployContract` function.
|
||||
|
||||
```ts
|
||||
const address = await deployContract({
|
||||
client,
|
||||
chain,
|
||||
account,
|
||||
bytecode: "0x...",
|
||||
abi: contractAbi,
|
||||
constructorParams: {
|
||||
param1: "value1",
|
||||
param2: 123,
|
||||
},
|
||||
salt: "test", // <--- deterministic deploy
|
||||
});
|
||||
```
|
||||
Reference in New Issue
Block a user