Skip to content

Commit 82d90d3

Browse files
committed
update: added implementation to retrieve the contract-address
1 parent 7e16370 commit 82d90d3

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/worker/tasks/sendTransactionWorker.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import { Job, Processor, Worker } from "bullmq";
2+
import { BigNumber } from "ethers";
3+
import { getContractAddress } from "ethers/lib/utils";
24
import superjson from "superjson";
35
import { toSerializableTransaction } from "thirdweb";
46
import { stringify } from "thirdweb/utils";
@@ -131,6 +133,18 @@ const _handleQueuedTransaction = async (
131133
populatedTransaction,
132134
);
133135

136+
// Get the contract deployed Address when using deploy-published extension.
137+
let deployedContractAddress: string | undefined;
138+
if (
139+
queuedTransaction.extension === "deploy-published" &&
140+
queuedTransaction.functionName === "deploy"
141+
) {
142+
deployedContractAddress = getContractAddress({
143+
from: queuedTransaction.from,
144+
nonce: BigNumber.from(populatedTransaction.nonce!),
145+
});
146+
}
147+
134148
return {
135149
...queuedTransaction,
136150
status: "sent",
@@ -144,6 +158,7 @@ const _handleQueuedTransaction = async (
144158
gasPrice: populatedTransaction.gasPrice,
145159
maxFeePerGas: populatedTransaction.maxFeePerGas,
146160
maxPriorityFeePerGas: populatedTransaction.maxPriorityFeePerGas,
161+
deployedContractAddress,
147162
};
148163
};
149164

0 commit comments

Comments
 (0)