From b5227c9a8fb4b4b4114c79077c2c1ba38fbad55f Mon Sep 17 00:00:00 2001 From: gregfromstl Date: Tue, 19 Nov 2024 23:02:02 +0000 Subject: [PATCH] [SDK] Fix: Adds overrides to createNewPack (#5464) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CNCT-2230 --- ## 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}` --- .changeset/tame-walls-live.md | 5 +++++ .../thirdweb/src/extensions/pack/createNewPack.ts | 11 ++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 .changeset/tame-walls-live.md diff --git a/.changeset/tame-walls-live.md b/.changeset/tame-walls-live.md new file mode 100644 index 00000000000..276d139f477 --- /dev/null +++ b/.changeset/tame-walls-live.md @@ -0,0 +1,5 @@ +--- +"thirdweb": patch +--- + +Adds the ability to override transaction values in createNewPack diff --git a/packages/thirdweb/src/extensions/pack/createNewPack.ts b/packages/thirdweb/src/extensions/pack/createNewPack.ts index ecf7c024034..a9a6512186c 100644 --- a/packages/thirdweb/src/extensions/pack/createNewPack.ts +++ b/packages/thirdweb/src/extensions/pack/createNewPack.ts @@ -1,7 +1,10 @@ import type { ThirdwebClient } from "../../client/client.js"; import { type ThirdwebContract, getContract } from "../../contract/contract.js"; import { upload } from "../../storage/upload.js"; -import type { BaseTransactionOptions } from "../../transaction/types.js"; +import type { + BaseTransactionOptions, + WithOverrides, +} from "../../transaction/types.js"; import type { NFTInput } from "../../utils/nft/parseNft.js"; import { toUnits } from "../../utils/units.js"; import type { AddPackContentsParams } from "./__generated__/IPack/write/addPackContents.js"; @@ -114,7 +117,7 @@ export type CreateNewPackParams = { * ``` */ export function createNewPack( - options: BaseTransactionOptions, + options: WithOverrides>, ) { return createPack({ contract: options.contract, @@ -126,7 +129,7 @@ export function createNewPack( * @internal */ async function getCreatePackParams( - options: BaseTransactionOptions, + options: WithOverrides>, ): Promise { const { contract, @@ -138,6 +141,7 @@ async function getCreatePackParams( erc721Rewards, erc1155Rewards, tokenOwner, + overrides, } = options; const [erc20Content, erc721Content, erc1155Content, packUri] = await Promise.all([ @@ -179,6 +183,7 @@ async function getCreatePackParams( // openStartTimestamp should be in seconds and not millisecond openStartTimestamp: BigInt(Math.ceil(openStartTimestamp.getTime() / 1000)), amountDistributedPerOpen, + overrides, }; }