Skip to content

Commit b5227c9

Browse files
committed
[SDK] Fix: Adds overrides to createNewPack (#5464)
CNCT-2230 <!-- start pr-codex --> --- ## PR-Codex overview This PR introduces the ability to override transaction values in the `createNewPack` function within the `thirdweb` package. ### Detailed summary - Added `WithOverrides` type to the `options` parameter in `createNewPack` and `getCreatePackParams` functions. - Updated the function signatures to accept overrides for transaction options. - Included `overrides` in the parameters for creating pack details. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex -->
1 parent 0998fc7 commit b5227c9

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

.changeset/tame-walls-live.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"thirdweb": patch
3+
---
4+
5+
Adds the ability to override transaction values in createNewPack

packages/thirdweb/src/extensions/pack/createNewPack.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
import type { ThirdwebClient } from "../../client/client.js";
22
import { type ThirdwebContract, getContract } from "../../contract/contract.js";
33
import { upload } from "../../storage/upload.js";
4-
import type { BaseTransactionOptions } from "../../transaction/types.js";
4+
import type {
5+
BaseTransactionOptions,
6+
WithOverrides,
7+
} from "../../transaction/types.js";
58
import type { NFTInput } from "../../utils/nft/parseNft.js";
69
import { toUnits } from "../../utils/units.js";
710
import type { AddPackContentsParams } from "./__generated__/IPack/write/addPackContents.js";
@@ -114,7 +117,7 @@ export type CreateNewPackParams = {
114117
* ```
115118
*/
116119
export function createNewPack(
117-
options: BaseTransactionOptions<CreateNewPackParams>,
120+
options: WithOverrides<BaseTransactionOptions<CreateNewPackParams>>,
118121
) {
119122
return createPack({
120123
contract: options.contract,
@@ -126,7 +129,7 @@ export function createNewPack(
126129
* @internal
127130
*/
128131
async function getCreatePackParams(
129-
options: BaseTransactionOptions<CreateNewPackParams>,
132+
options: WithOverrides<BaseTransactionOptions<CreateNewPackParams>>,
130133
): Promise<CreatePackParams> {
131134
const {
132135
contract,
@@ -138,6 +141,7 @@ async function getCreatePackParams(
138141
erc721Rewards,
139142
erc1155Rewards,
140143
tokenOwner,
144+
overrides,
141145
} = options;
142146
const [erc20Content, erc721Content, erc1155Content, packUri] =
143147
await Promise.all([
@@ -179,6 +183,7 @@ async function getCreatePackParams(
179183
// openStartTimestamp should be in seconds and not millisecond
180184
openStartTimestamp: BigInt(Math.ceil(openStartTimestamp.getTime() / 1000)),
181185
amountDistributedPerOpen,
186+
overrides,
182187
};
183188
}
184189

0 commit comments

Comments
 (0)