thirdweb 5.105.39 → 5.105.40-nightly-89eeac1f8a20596ab93b92cf2bbcc76175ceec09-20250831000413
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/react.js +4 -4
- package/dist/cjs/exports/react.js.map +1 -1
- package/dist/cjs/exports/react.native.js +1 -1
- package/dist/cjs/exports/react.native.js.map +1 -1
- package/dist/cjs/exports/tokens.js +2 -2
- package/dist/cjs/exports/tokens.js.map +1 -1
- package/dist/cjs/react/core/hooks/transaction/useSendAndConfirmTransaction.js +2 -2
- package/dist/cjs/react/core/hooks/transaction/useSendAndConfirmTransaction.js.map +1 -1
- package/dist/cjs/react/web/hooks/transaction/useSendAndConfirmTransaction.js +81 -0
- package/dist/cjs/react/web/hooks/transaction/useSendAndConfirmTransaction.js.map +1 -0
- package/dist/cjs/react/web/hooks/transaction/useSendTransaction.js +26 -0
- package/dist/cjs/react/web/hooks/transaction/useSendTransaction.js.map +1 -1
- package/dist/cjs/react/web/ui/prebuilt/thirdweb/BuyDirectListingButton/index.js +9 -2
- package/dist/cjs/react/web/ui/prebuilt/thirdweb/BuyDirectListingButton/index.js.map +1 -1
- package/dist/cjs/react/web/ui/prebuilt/thirdweb/ClaimButton/index.js +9 -2
- package/dist/cjs/react/web/ui/prebuilt/thirdweb/ClaimButton/index.js.map +1 -1
- package/dist/cjs/react/web/ui/prebuilt/thirdweb/CreateDirectListingButton/index.js +9 -2
- package/dist/cjs/react/web/ui/prebuilt/thirdweb/CreateDirectListingButton/index.js.map +1 -1
- package/dist/cjs/tokens/create-token.js +2 -30
- package/dist/cjs/tokens/create-token.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/version.js.map +1 -1
- package/dist/esm/exports/react.js +1 -1
- package/dist/esm/exports/react.js.map +1 -1
- package/dist/esm/exports/react.native.js +1 -1
- package/dist/esm/exports/react.native.js.map +1 -1
- package/dist/esm/exports/tokens.js +1 -1
- package/dist/esm/exports/tokens.js.map +1 -1
- package/dist/esm/react/core/hooks/transaction/useSendAndConfirmTransaction.js +1 -1
- package/dist/esm/react/core/hooks/transaction/useSendAndConfirmTransaction.js.map +1 -1
- package/dist/esm/react/web/hooks/transaction/useSendAndConfirmTransaction.js +78 -0
- package/dist/esm/react/web/hooks/transaction/useSendAndConfirmTransaction.js.map +1 -0
- package/dist/esm/react/web/hooks/transaction/useSendTransaction.js +26 -0
- package/dist/esm/react/web/hooks/transaction/useSendTransaction.js.map +1 -1
- package/dist/esm/react/web/ui/prebuilt/thirdweb/BuyDirectListingButton/index.js +9 -2
- package/dist/esm/react/web/ui/prebuilt/thirdweb/BuyDirectListingButton/index.js.map +1 -1
- package/dist/esm/react/web/ui/prebuilt/thirdweb/ClaimButton/index.js +9 -2
- package/dist/esm/react/web/ui/prebuilt/thirdweb/ClaimButton/index.js.map +1 -1
- package/dist/esm/react/web/ui/prebuilt/thirdweb/CreateDirectListingButton/index.js +9 -2
- package/dist/esm/react/web/ui/prebuilt/thirdweb/CreateDirectListingButton/index.js.map +1 -1
- package/dist/esm/tokens/create-token.js +1 -29
- package/dist/esm/tokens/create-token.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/types/exports/react.d.ts +1 -1
- package/dist/types/exports/react.d.ts.map +1 -1
- package/dist/types/exports/react.native.d.ts +1 -1
- package/dist/types/exports/react.native.d.ts.map +1 -1
- package/dist/types/exports/tokens.d.ts +1 -1
- package/dist/types/exports/tokens.d.ts.map +1 -1
- package/dist/types/react/core/hooks/transaction/useSendAndConfirmTransaction.d.ts +1 -1
- package/dist/types/react/core/hooks/transaction/useSendAndConfirmTransaction.d.ts.map +1 -1
- package/dist/types/react/web/hooks/transaction/useSendAndConfirmTransaction.d.ts +86 -0
- package/dist/types/react/web/hooks/transaction/useSendAndConfirmTransaction.d.ts.map +1 -0
- package/dist/types/react/web/hooks/transaction/useSendTransaction.d.ts +26 -0
- package/dist/types/react/web/hooks/transaction/useSendTransaction.d.ts.map +1 -1
- package/dist/types/react/web/ui/prebuilt/thirdweb/BuyDirectListingButton/index.d.ts.map +1 -1
- package/dist/types/react/web/ui/prebuilt/thirdweb/ClaimButton/index.d.ts.map +1 -1
- package/dist/types/react/web/ui/prebuilt/thirdweb/CreateDirectListingButton/index.d.ts.map +1 -1
- package/dist/types/tokens/create-token.d.ts +2 -1
- package/dist/types/tokens/create-token.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/types/version.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/exports/react.native.ts +1 -1
- package/src/exports/react.ts +1 -2
- package/src/exports/tokens.ts +4 -1
- package/src/react/core/hooks/transaction/useSendAndConfirmTransaction.ts +1 -1
- package/src/react/web/hooks/transaction/useSendAndConfirmTransaction.tsx +104 -0
- package/src/react/web/hooks/transaction/useSendTransaction.tsx +26 -0
- package/src/react/web/ui/prebuilt/thirdweb/BuyDirectListingButton/index.tsx +10 -2
- package/src/react/web/ui/prebuilt/thirdweb/ClaimButton/index.tsx +10 -2
- package/src/react/web/ui/prebuilt/thirdweb/CreateDirectListingButton/index.tsx +10 -2
- package/src/tokens/create-token.ts +2 -35
- package/src/version.ts +1 -1
@@ -1,4 +1,5 @@
|
|
1
|
+
import type { TransactionReceipt } from "../transaction/types.js";
|
1
2
|
import type { CreateTokenOptions } from "./types.js";
|
2
|
-
export declare function
|
3
|
+
export declare function getTokenAddressFromReceipt(receipt: TransactionReceipt): Promise<string>;
|
3
4
|
export declare function prepareCreateToken(options: CreateTokenOptions): Promise<import("../transaction/prepare-transaction.js").PreparedTransaction<any, import("viem").AbiFunction, import("../transaction/prepare-transaction.js").PrepareTransactionOptions>>;
|
4
5
|
//# sourceMappingURL=create-token.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"create-token.d.ts","sourceRoot":"","sources":["../../../src/tokens/create-token.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"create-token.d.ts","sourceRoot":"","sources":["../../../src/tokens/create-token.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AASlE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErD,wBAAsB,0BAA0B,CAAC,OAAO,EAAE,kBAAkB,mBAc3E;AAED,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,kBAAkB,4LAkCnE"}
|
package/dist/types/version.d.ts
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
export declare const version = "5.105.
|
1
|
+
export declare const version = "5.105.40-nightly-89eeac1f8a20596ab93b92cf2bbcc76175ceec09-20250831000413";
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,6EAA6E,CAAC"}
|
package/package.json
CHANGED
@@ -39,8 +39,8 @@
|
|
39
39
|
"uqr": "0.1.2",
|
40
40
|
"viem": "2.33.2",
|
41
41
|
"zod": "3.25.75",
|
42
|
-
"@thirdweb-dev/
|
43
|
-
"@thirdweb-dev/
|
42
|
+
"@thirdweb-dev/insight": "1.1.1",
|
43
|
+
"@thirdweb-dev/engine": "3.2.1"
|
44
44
|
},
|
45
45
|
"devDependencies": {
|
46
46
|
"@aws-sdk/client-kms": "3.592.0",
|
@@ -388,7 +388,7 @@
|
|
388
388
|
}
|
389
389
|
},
|
390
390
|
"typings": "./dist/types/exports/thirdweb.d.ts",
|
391
|
-
"version": "5.105.
|
391
|
+
"version": "5.105.40-nightly-89eeac1f8a20596ab93b92cf2bbcc76175ceec09-20250831000413",
|
392
392
|
"scripts": {
|
393
393
|
"bench": "vitest -c ./test/vitest.config.ts bench",
|
394
394
|
"bench:compare": "bun run ./benchmarks/run.ts",
|
@@ -59,7 +59,7 @@ export {
|
|
59
59
|
export type { TransactionButtonProps } from "../react/core/hooks/transaction/transaction-button-utils.js";
|
60
60
|
export { useEstimateGas } from "../react/core/hooks/transaction/useEstimateGas.js";
|
61
61
|
export { useEstimateGasCost } from "../react/core/hooks/transaction/useEstimateGasCost.js";
|
62
|
-
export { useSendAndConfirmTransaction } from "../react/core/hooks/transaction/useSendAndConfirmTransaction.js";
|
62
|
+
export { useSendAndConfirmTransactionCore as useSendAndConfirmTransaction } from "../react/core/hooks/transaction/useSendAndConfirmTransaction.js";
|
63
63
|
export { useSendBatchTransaction } from "../react/core/hooks/transaction/useSendBatchTransaction.js";
|
64
64
|
// transaction
|
65
65
|
export type {
|
package/src/exports/react.ts
CHANGED
@@ -66,7 +66,6 @@ export {
|
|
66
66
|
export type { TransactionButtonProps } from "../react/core/hooks/transaction/transaction-button-utils.js";
|
67
67
|
export { useEstimateGas } from "../react/core/hooks/transaction/useEstimateGas.js";
|
68
68
|
export { useEstimateGasCost } from "../react/core/hooks/transaction/useEstimateGasCost.js";
|
69
|
-
export { useSendAndConfirmTransaction } from "../react/core/hooks/transaction/useSendAndConfirmTransaction.js";
|
70
69
|
export { useSendBatchTransaction } from "../react/core/hooks/transaction/useSendBatchTransaction.js";
|
71
70
|
// transaction
|
72
71
|
export type {
|
@@ -101,7 +100,6 @@ export { useConnectionManager } from "../react/core/providers/connection-manager
|
|
101
100
|
// Social
|
102
101
|
export { useSocialProfiles } from "../react/core/social/useSocialProfiles.js";
|
103
102
|
export type { AccountBalanceInfo } from "../react/core/utils/account.js";
|
104
|
-
|
105
103
|
// utils
|
106
104
|
export { createContractQuery } from "../react/core/utils/createQuery.js";
|
107
105
|
// tokens
|
@@ -126,6 +124,7 @@ export {
|
|
126
124
|
WalletProvider,
|
127
125
|
type WalletProviderProps,
|
128
126
|
} from "../react/core/wallet/provider.js";
|
127
|
+
export { useSendAndConfirmTransaction } from "../react/web/hooks/transaction/useSendAndConfirmTransaction.js";
|
129
128
|
export { useSendTransaction } from "../react/web/hooks/transaction/useSendTransaction.js";
|
130
129
|
export { useAutoConnect } from "../react/web/hooks/wallets/useAutoConnect.js";
|
131
130
|
export { useLinkProfile } from "../react/web/hooks/wallets/useLinkProfile.js";
|
package/src/exports/tokens.ts
CHANGED
@@ -6,7 +6,10 @@ export {
|
|
6
6
|
DEFAULT_DEVELOPER_ADDRESS,
|
7
7
|
DEFAULT_DEVELOPER_REWARD_BPS,
|
8
8
|
} from "../tokens/constants.js";
|
9
|
-
export {
|
9
|
+
export {
|
10
|
+
getTokenAddressFromReceipt,
|
11
|
+
prepareCreateToken,
|
12
|
+
} from "../tokens/create-token.js";
|
10
13
|
export { distributeToken } from "../tokens/distribute-token.js";
|
11
14
|
export {
|
12
15
|
getDeployedContractFactory,
|
@@ -54,7 +54,7 @@ type SendAndConfirmTransactionConfig = {
|
|
54
54
|
* ```
|
55
55
|
* @transaction
|
56
56
|
*/
|
57
|
-
export function
|
57
|
+
export function useSendAndConfirmTransactionCore(
|
58
58
|
config: SendAndConfirmTransactionConfig = {},
|
59
59
|
): UseMutationResult<
|
60
60
|
TransactionReceipt,
|
@@ -0,0 +1,104 @@
|
|
1
|
+
import { type UseMutationResult, useMutation } from "@tanstack/react-query";
|
2
|
+
import type { GaslessOptions } from "../../../../transaction/actions/gasless/types.js";
|
3
|
+
import type { SendTransactionOptions } from "../../../../transaction/actions/send-transaction.js";
|
4
|
+
import { waitForReceipt } from "../../../../transaction/actions/wait-for-tx-receipt.js";
|
5
|
+
import type { TransactionReceipt } from "../../../../transaction/types.js";
|
6
|
+
import type { SendTransactionPayModalConfig } from "../../../core/hooks/transaction/useSendTransaction.js";
|
7
|
+
import { useSendTransaction } from "./useSendTransaction.js";
|
8
|
+
|
9
|
+
/**
|
10
|
+
* Configuration for the `useSendAndConfirmTransaction` hook.
|
11
|
+
*/
|
12
|
+
type SendAndConfirmTransactionConfig = {
|
13
|
+
/**
|
14
|
+
* Refer to [`SendTransactionPayModalConfig`](https://portal.thirdweb.com/references/typescript/v5/SendTransactionPayModalConfig) for more details.
|
15
|
+
*/
|
16
|
+
payModal?: SendTransactionPayModalConfig;
|
17
|
+
|
18
|
+
/**
|
19
|
+
* Configuration for gasless transactions.
|
20
|
+
* Refer to [`GaslessOptions`](https://portal.thirdweb.com/references/typescript/v5/GaslessOptions) for more details.
|
21
|
+
*/
|
22
|
+
gasless?: GaslessOptions;
|
23
|
+
};
|
24
|
+
|
25
|
+
/**
|
26
|
+
* A hook to send a transaction and confirm the transaction with users's connected wallet
|
27
|
+
* @returns A mutation object to send a transaction.
|
28
|
+
* @example
|
29
|
+
* ```jsx
|
30
|
+
* import { useSendAndConfirmTransaction } from "thirdweb/react";
|
31
|
+
* const { mutate: sendAndConfirmTx, data: transactionReceipt } = useSendAndConfirmTransaction();
|
32
|
+
*
|
33
|
+
* // later
|
34
|
+
* sendAndConfirmTx(tx);
|
35
|
+
* ```
|
36
|
+
*
|
37
|
+
*
|
38
|
+
* ### Gasless usage with [thirdweb Engine](https://portal.thirdweb.com/engine)
|
39
|
+
* ```tsx
|
40
|
+
* import { useSendAndConfirmTransaction } from "thirdweb/react";
|
41
|
+
* const mutation = useSendAndConfirmTransaction({
|
42
|
+
* gasless: {
|
43
|
+
* provider: "engine",
|
44
|
+
* relayerUrl: "https://thirdweb.engine-***.thirdweb.com/relayer/***",
|
45
|
+
* relayerForwarderAddress: "0x...",
|
46
|
+
* }
|
47
|
+
* });
|
48
|
+
* ```
|
49
|
+
*
|
50
|
+
* ### Gasless usage with OpenZeppelin
|
51
|
+
* ```tsx
|
52
|
+
* import { useSendAndConfirmTransaction } from "thirdweb/react";
|
53
|
+
* const mutation = useSendAndConfirmTransaction({
|
54
|
+
* gasless: {
|
55
|
+
* provider: "openzeppelin",
|
56
|
+
* relayerUrl: "https://...",
|
57
|
+
* relayerForwarderAddress: "0x...",
|
58
|
+
* }
|
59
|
+
* });
|
60
|
+
* ```
|
61
|
+
*
|
62
|
+
* ### Configuring the Pay Modal
|
63
|
+
*
|
64
|
+
* When the wallet does not have enough funds to send the transaction, a modal is shown to the user to buy the required funds and then continue with the transaction.
|
65
|
+
*
|
66
|
+
* You can configure the pay modal by passing a [`SendTransactionPayModalConfig`](https://portal.thirdweb.com/references/typescript/v5/SendTransactionPayModalConfig) object to the `payModal` config.
|
67
|
+
*
|
68
|
+
* ```tsx
|
69
|
+
* import { useSendAndConfirmTransaction } from "thirdweb/react";
|
70
|
+
*
|
71
|
+
* const sendAndConfirmTx = useSendAndConfirmTransaction({
|
72
|
+
* payModal: {
|
73
|
+
* theme: "light",
|
74
|
+
* },
|
75
|
+
* });
|
76
|
+
* ```
|
77
|
+
*
|
78
|
+
* By default, the pay modal is enabled. You can disable it by passing `payModal: false` to the config.
|
79
|
+
*
|
80
|
+
* ```tsx
|
81
|
+
* import { useSendAndConfirmTransaction } from "thirdweb/react";
|
82
|
+
*
|
83
|
+
* const sendAndConfirmTx = useSendAndConfirmTransaction({
|
84
|
+
* payModal: false,
|
85
|
+
* });
|
86
|
+
* ```
|
87
|
+
* @transaction
|
88
|
+
*/
|
89
|
+
export function useSendAndConfirmTransaction(
|
90
|
+
config: SendAndConfirmTransactionConfig = {},
|
91
|
+
): UseMutationResult<
|
92
|
+
TransactionReceipt,
|
93
|
+
Error,
|
94
|
+
SendTransactionOptions["transaction"]
|
95
|
+
> {
|
96
|
+
const sendTx = useSendTransaction(config);
|
97
|
+
return useMutation({
|
98
|
+
mutationFn: async (transaction) => {
|
99
|
+
const receipt = await sendTx.mutateAsync(transaction);
|
100
|
+
const confirmedReceipt = await waitForReceipt(receipt);
|
101
|
+
return confirmedReceipt;
|
102
|
+
},
|
103
|
+
});
|
104
|
+
}
|
@@ -93,6 +93,32 @@ import { TransactionModal } from "../../ui/TransactionButton/TransactionModal.js
|
|
93
93
|
* };
|
94
94
|
* ```
|
95
95
|
*
|
96
|
+
* ### Configuring the Pay Modal
|
97
|
+
*
|
98
|
+
* When the wallet does not have enough funds to send the transaction, a modal is shown to the user to buy the required funds and then continue with the transaction.
|
99
|
+
*
|
100
|
+
* You can configure the pay modal by passing a [`SendTransactionPayModalConfig`](https://portal.thirdweb.com/references/typescript/v5/SendTransactionPayModalConfig) object to the `payModal` config.
|
101
|
+
*
|
102
|
+
* ```tsx
|
103
|
+
* import { useSendTransaction } from "thirdweb/react";
|
104
|
+
*
|
105
|
+
* const sendTx = useSendTransaction({
|
106
|
+
* payModal: {
|
107
|
+
* theme: "light",
|
108
|
+
* },
|
109
|
+
* });
|
110
|
+
* ```
|
111
|
+
*
|
112
|
+
* By default, the pay modal is enabled. You can disable it by passing `payModal: false` to the config.
|
113
|
+
*
|
114
|
+
* ```tsx
|
115
|
+
* import { useSendTransaction } from "thirdweb/react";
|
116
|
+
*
|
117
|
+
* const sendTx = useSendTransaction({
|
118
|
+
* payModal: false,
|
119
|
+
* });
|
120
|
+
* ```
|
121
|
+
*
|
96
122
|
* @transaction
|
97
123
|
*/
|
98
124
|
export function useSendTransaction(config: SendTransactionConfig = {}) {
|
@@ -8,8 +8,8 @@ import { getListing } from "../../../../../../extensions/marketplace/direct-list
|
|
8
8
|
import type { BaseTransactionOptions } from "../../../../../../transaction/types.js";
|
9
9
|
import { useReadContract } from "../../../../../core/hooks/contract/useReadContract.js";
|
10
10
|
import type { TransactionButtonProps } from "../../../../../core/hooks/transaction/transaction-button-utils.js";
|
11
|
-
import { useSendAndConfirmTransaction } from "../../../../../core/hooks/transaction/useSendAndConfirmTransaction.js";
|
12
11
|
import { useActiveAccount } from "../../../../../core/hooks/wallets/useActiveAccount.js";
|
12
|
+
import { useSendAndConfirmTransaction } from "../../../../hooks/transaction/useSendAndConfirmTransaction.js";
|
13
13
|
import { TransactionButton } from "../../../TransactionButton/index.js";
|
14
14
|
|
15
15
|
export type BuyDirectListingButtonProps = Omit<
|
@@ -104,7 +104,15 @@ export function BuyDirectListingButton(props: BuyDirectListingButtonProps) {
|
|
104
104
|
},
|
105
105
|
});
|
106
106
|
|
107
|
-
const { mutateAsync } = useSendAndConfirmTransaction(
|
107
|
+
const { mutateAsync } = useSendAndConfirmTransaction({
|
108
|
+
payModal:
|
109
|
+
typeof payModal === "object"
|
110
|
+
? {
|
111
|
+
...payModal,
|
112
|
+
metadata: payModal.metadata || payMetadata,
|
113
|
+
}
|
114
|
+
: payModal,
|
115
|
+
});
|
108
116
|
|
109
117
|
const prepareBuyTransaction = useCallback(async () => {
|
110
118
|
if (!account) {
|
@@ -10,8 +10,8 @@ import type { PreparedTransaction } from "../../../../../../transaction/prepare-
|
|
10
10
|
import type { BaseTransactionOptions } from "../../../../../../transaction/types.js";
|
11
11
|
import type { Account } from "../../../../../../wallets/interfaces/wallet.js";
|
12
12
|
import { useReadContract } from "../../../../../core/hooks/contract/useReadContract.js";
|
13
|
-
import { useSendAndConfirmTransaction } from "../../../../../core/hooks/transaction/useSendAndConfirmTransaction.js";
|
14
13
|
import { useActiveAccount } from "../../../../../core/hooks/wallets/useActiveAccount.js";
|
14
|
+
import { useSendAndConfirmTransaction } from "../../../../hooks/transaction/useSendAndConfirmTransaction.js";
|
15
15
|
import { TransactionButton } from "../../../TransactionButton/index.js";
|
16
16
|
import type {
|
17
17
|
ClaimButtonProps,
|
@@ -126,7 +126,15 @@ export function ClaimButton(props: ClaimButtonProps) {
|
|
126
126
|
tokenId: claimParams.type === "ERC1155" ? claimParams.tokenId : undefined,
|
127
127
|
});
|
128
128
|
const account = useActiveAccount();
|
129
|
-
const { mutateAsync } = useSendAndConfirmTransaction(
|
129
|
+
const { mutateAsync } = useSendAndConfirmTransaction({
|
130
|
+
payModal:
|
131
|
+
typeof payModal === "object"
|
132
|
+
? {
|
133
|
+
...payModal,
|
134
|
+
metadata: payModal.metadata || payMetadata,
|
135
|
+
}
|
136
|
+
: payModal,
|
137
|
+
});
|
130
138
|
return (
|
131
139
|
<TransactionButton
|
132
140
|
payModal={{
|
@@ -13,8 +13,8 @@ import {
|
|
13
13
|
import type { BaseTransactionOptions } from "../../../../../../transaction/types.js";
|
14
14
|
import { useReadContract } from "../../../../../core/hooks/contract/useReadContract.js";
|
15
15
|
import type { TransactionButtonProps } from "../../../../../core/hooks/transaction/transaction-button-utils.js";
|
16
|
-
import { useSendAndConfirmTransaction } from "../../../../../core/hooks/transaction/useSendAndConfirmTransaction.js";
|
17
16
|
import { useActiveAccount } from "../../../../../core/hooks/wallets/useActiveAccount.js";
|
17
|
+
import { useSendAndConfirmTransaction } from "../../../../hooks/transaction/useSendAndConfirmTransaction.js";
|
18
18
|
import { TransactionButton } from "../../../TransactionButton/index.js";
|
19
19
|
|
20
20
|
export type CreateDirectListingButtonProps = Omit<
|
@@ -88,7 +88,15 @@ export function CreateDirectListingButton(
|
|
88
88
|
},
|
89
89
|
tokenId,
|
90
90
|
});
|
91
|
-
const { mutateAsync } = useSendAndConfirmTransaction(
|
91
|
+
const { mutateAsync } = useSendAndConfirmTransaction({
|
92
|
+
payModal:
|
93
|
+
typeof payModal === "object"
|
94
|
+
? {
|
95
|
+
...payModal,
|
96
|
+
metadata: payModal.metadata || payMetadata,
|
97
|
+
}
|
98
|
+
: payModal,
|
99
|
+
});
|
92
100
|
|
93
101
|
const prepareTransaction = useCallback(async () => {
|
94
102
|
if (!account) {
|
@@ -3,7 +3,7 @@ import type { Hex } from "viem";
|
|
3
3
|
import { parseEventLogs } from "../event/actions/parse-logs.js";
|
4
4
|
import { createdEvent } from "../extensions/tokens/__generated__/ERC20Entrypoint/events/Created.js";
|
5
5
|
import { createById } from "../extensions/tokens/__generated__/ERC20Entrypoint/write/createById.js";
|
6
|
-
import {
|
6
|
+
import type { TransactionReceipt } from "../transaction/types.js";
|
7
7
|
import { padHex, toHex } from "../utils/encoding/hex.js";
|
8
8
|
import { DEFAULT_DEVELOPER_ADDRESS } from "./constants.js";
|
9
9
|
import { getDeployedEntrypointERC20 } from "./get-entrypoint-erc20.js";
|
@@ -14,40 +14,7 @@ import {
|
|
14
14
|
} from "./token-utils.js";
|
15
15
|
import type { CreateTokenOptions } from "./types.js";
|
16
16
|
|
17
|
-
export async function
|
18
|
-
const { client, account, params, launchConfig } = options;
|
19
|
-
|
20
|
-
const creator = params.owner || account.address;
|
21
|
-
const encodedInitData = await encodeInitParams({
|
22
|
-
client,
|
23
|
-
creator,
|
24
|
-
params,
|
25
|
-
});
|
26
|
-
|
27
|
-
const salt: Hex = generateSalt(options.salt || bytesToHex(randomBytes(31)));
|
28
|
-
|
29
|
-
const entrypoint = await getDeployedEntrypointERC20(options);
|
30
|
-
|
31
|
-
let hookData: Hex = "0x";
|
32
|
-
let contractId = padHex(toHex("ERC20Asset"), { size: 32 });
|
33
|
-
if (launchConfig?.kind === "pool") {
|
34
|
-
hookData = encodePoolConfig(launchConfig.config);
|
35
|
-
contractId = padHex(toHex("ERC20Asset_Pool"), { size: 32 });
|
36
|
-
}
|
37
|
-
|
38
|
-
const transaction = createById({
|
39
|
-
contract: entrypoint,
|
40
|
-
contractId,
|
41
|
-
params: {
|
42
|
-
data: encodedInitData,
|
43
|
-
hookData,
|
44
|
-
developer: options.developerAddress || DEFAULT_DEVELOPER_ADDRESS,
|
45
|
-
salt,
|
46
|
-
},
|
47
|
-
creator,
|
48
|
-
});
|
49
|
-
|
50
|
-
const receipt = await sendAndConfirmTransaction({ account, transaction });
|
17
|
+
export async function getTokenAddressFromReceipt(receipt: TransactionReceipt) {
|
51
18
|
const assetEvent = createdEvent();
|
52
19
|
const decodedEvent = parseEventLogs({
|
53
20
|
events: [assetEvent],
|
package/src/version.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export const version = "5.105.
|
1
|
+
export const version = "5.105.40-nightly-89eeac1f8a20596ab93b92cf2bbcc76175ceec09-20250831000413";
|