thirdweb 5.43.2 → 5.43.3-nightly-baefa5e9c7d72fd8645b0e33452a83fc0ef229d4-20240804000345

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.
Files changed (132) hide show
  1. package/dist/cjs/extensions/marketplace/direct-listings/utils.js +1 -0
  2. package/dist/cjs/extensions/marketplace/direct-listings/utils.js.map +1 -1
  3. package/dist/cjs/extensions/marketplace/english-auctions/utils.js +1 -0
  4. package/dist/cjs/extensions/marketplace/english-auctions/utils.js.map +1 -1
  5. package/dist/cjs/react/core/hooks/contract/useContractEvents.js +32 -2
  6. package/dist/cjs/react/core/hooks/contract/useContractEvents.js.map +1 -1
  7. package/dist/cjs/react/core/hooks/contract/useReadContract.js.map +1 -1
  8. package/dist/cjs/react/core/hooks/others/useWalletBalance.js +17 -2
  9. package/dist/cjs/react/core/hooks/others/useWalletBalance.js.map +1 -1
  10. package/dist/cjs/react/core/hooks/wallets/useActiveAccount.js +1 -0
  11. package/dist/cjs/react/core/hooks/wallets/useActiveAccount.js.map +1 -1
  12. package/dist/cjs/react/core/utils/wallet.js +19 -1
  13. package/dist/cjs/react/core/utils/wallet.js.map +1 -1
  14. package/dist/cjs/react/web/hooks/transaction/useSendTransaction.js +74 -4
  15. package/dist/cjs/react/web/hooks/transaction/useSendTransaction.js.map +1 -1
  16. package/dist/cjs/react/web/ui/ConnectWallet/ConnectButton.js +17 -2
  17. package/dist/cjs/react/web/ui/ConnectWallet/ConnectButton.js.map +1 -1
  18. package/dist/cjs/react/web/ui/ConnectWallet/Modal/ConnectEmbed.js +15 -0
  19. package/dist/cjs/react/web/ui/ConnectWallet/Modal/ConnectEmbed.js.map +1 -1
  20. package/dist/cjs/react/web/ui/PayEmbed.js +8 -9
  21. package/dist/cjs/react/web/ui/PayEmbed.js.map +1 -1
  22. package/dist/cjs/transaction/actions/send-transaction.js +76 -5
  23. package/dist/cjs/transaction/actions/send-transaction.js.map +1 -1
  24. package/dist/cjs/transaction/prepare-contract-call.js +18 -13
  25. package/dist/cjs/transaction/prepare-contract-call.js.map +1 -1
  26. package/dist/cjs/transaction/read-contract.js +39 -6
  27. package/dist/cjs/transaction/read-contract.js.map +1 -1
  28. package/dist/cjs/utils/fetch.js +12 -1
  29. package/dist/cjs/utils/fetch.js.map +1 -1
  30. package/dist/cjs/version.js +1 -1
  31. package/dist/cjs/version.js.map +1 -1
  32. package/dist/cjs/wallets/in-app/web/in-app.js +4 -1
  33. package/dist/cjs/wallets/in-app/web/in-app.js.map +1 -1
  34. package/dist/cjs/wallets/in-app/web/lib/auth/index.js +1 -0
  35. package/dist/cjs/wallets/in-app/web/lib/auth/index.js.map +1 -1
  36. package/dist/esm/extensions/marketplace/direct-listings/utils.js +1 -0
  37. package/dist/esm/extensions/marketplace/direct-listings/utils.js.map +1 -1
  38. package/dist/esm/extensions/marketplace/english-auctions/utils.js +1 -0
  39. package/dist/esm/extensions/marketplace/english-auctions/utils.js.map +1 -1
  40. package/dist/esm/react/core/hooks/contract/useContractEvents.js +32 -2
  41. package/dist/esm/react/core/hooks/contract/useContractEvents.js.map +1 -1
  42. package/dist/esm/react/core/hooks/contract/useReadContract.js.map +1 -1
  43. package/dist/esm/react/core/hooks/others/useWalletBalance.js +17 -2
  44. package/dist/esm/react/core/hooks/others/useWalletBalance.js.map +1 -1
  45. package/dist/esm/react/core/hooks/wallets/useActiveAccount.js +1 -0
  46. package/dist/esm/react/core/hooks/wallets/useActiveAccount.js.map +1 -1
  47. package/dist/esm/react/core/utils/wallet.js +19 -1
  48. package/dist/esm/react/core/utils/wallet.js.map +1 -1
  49. package/dist/esm/react/web/hooks/transaction/useSendTransaction.js +74 -4
  50. package/dist/esm/react/web/hooks/transaction/useSendTransaction.js.map +1 -1
  51. package/dist/esm/react/web/ui/ConnectWallet/ConnectButton.js +17 -2
  52. package/dist/esm/react/web/ui/ConnectWallet/ConnectButton.js.map +1 -1
  53. package/dist/esm/react/web/ui/ConnectWallet/Modal/ConnectEmbed.js +15 -0
  54. package/dist/esm/react/web/ui/ConnectWallet/Modal/ConnectEmbed.js.map +1 -1
  55. package/dist/esm/react/web/ui/PayEmbed.js +8 -9
  56. package/dist/esm/react/web/ui/PayEmbed.js.map +1 -1
  57. package/dist/esm/transaction/actions/send-transaction.js +76 -5
  58. package/dist/esm/transaction/actions/send-transaction.js.map +1 -1
  59. package/dist/esm/transaction/prepare-contract-call.js +18 -13
  60. package/dist/esm/transaction/prepare-contract-call.js.map +1 -1
  61. package/dist/esm/transaction/read-contract.js +39 -6
  62. package/dist/esm/transaction/read-contract.js.map +1 -1
  63. package/dist/esm/utils/fetch.js +12 -1
  64. package/dist/esm/utils/fetch.js.map +1 -1
  65. package/dist/esm/version.js +1 -1
  66. package/dist/esm/version.js.map +1 -1
  67. package/dist/esm/wallets/in-app/web/in-app.js +4 -1
  68. package/dist/esm/wallets/in-app/web/in-app.js.map +1 -1
  69. package/dist/esm/wallets/in-app/web/lib/auth/index.js +1 -0
  70. package/dist/esm/wallets/in-app/web/lib/auth/index.js.map +1 -1
  71. package/dist/types/extensions/marketplace/direct-listings/types.d.ts +1 -0
  72. package/dist/types/extensions/marketplace/direct-listings/types.d.ts.map +1 -1
  73. package/dist/types/extensions/marketplace/direct-listings/utils.d.ts.map +1 -1
  74. package/dist/types/extensions/marketplace/english-auctions/types.d.ts +1 -0
  75. package/dist/types/extensions/marketplace/english-auctions/types.d.ts.map +1 -1
  76. package/dist/types/extensions/marketplace/english-auctions/utils.d.ts.map +1 -1
  77. package/dist/types/react/core/hooks/contract/useContractEvents.d.ts +32 -2
  78. package/dist/types/react/core/hooks/contract/useContractEvents.d.ts.map +1 -1
  79. package/dist/types/react/core/hooks/contract/useReadContract.d.ts +28 -6
  80. package/dist/types/react/core/hooks/contract/useReadContract.d.ts.map +1 -1
  81. package/dist/types/react/core/hooks/others/useWalletBalance.d.ts +17 -2
  82. package/dist/types/react/core/hooks/others/useWalletBalance.d.ts.map +1 -1
  83. package/dist/types/react/core/hooks/wallets/useActiveAccount.d.ts +1 -0
  84. package/dist/types/react/core/hooks/wallets/useActiveAccount.d.ts.map +1 -1
  85. package/dist/types/react/core/utils/wallet.d.ts +19 -1
  86. package/dist/types/react/core/utils/wallet.d.ts.map +1 -1
  87. package/dist/types/react/web/hooks/transaction/useSendTransaction.d.ts +74 -4
  88. package/dist/types/react/web/hooks/transaction/useSendTransaction.d.ts.map +1 -1
  89. package/dist/types/react/web/ui/ConnectWallet/ConnectButton.d.ts +17 -2
  90. package/dist/types/react/web/ui/ConnectWallet/ConnectButton.d.ts.map +1 -1
  91. package/dist/types/react/web/ui/ConnectWallet/Modal/ConnectEmbed.d.ts +15 -0
  92. package/dist/types/react/web/ui/ConnectWallet/Modal/ConnectEmbed.d.ts.map +1 -1
  93. package/dist/types/react/web/ui/PayEmbed.d.ts +1 -0
  94. package/dist/types/react/web/ui/PayEmbed.d.ts.map +1 -1
  95. package/dist/types/transaction/actions/send-transaction.d.ts +76 -5
  96. package/dist/types/transaction/actions/send-transaction.d.ts.map +1 -1
  97. package/dist/types/transaction/prepare-contract-call.d.ts +18 -13
  98. package/dist/types/transaction/prepare-contract-call.d.ts.map +1 -1
  99. package/dist/types/transaction/read-contract.d.ts +39 -6
  100. package/dist/types/transaction/read-contract.d.ts.map +1 -1
  101. package/dist/types/utils/fetch.d.ts.map +1 -1
  102. package/dist/types/version.d.ts +1 -1
  103. package/dist/types/version.d.ts.map +1 -1
  104. package/dist/types/wallets/in-app/web/in-app.d.ts +4 -1
  105. package/dist/types/wallets/in-app/web/in-app.d.ts.map +1 -1
  106. package/dist/types/wallets/in-app/web/lib/auth/index.d.ts +1 -0
  107. package/dist/types/wallets/in-app/web/lib/auth/index.d.ts.map +1 -1
  108. package/package.json +4 -3
  109. package/src/extensions/marketplace/direct-listings/types.ts +1 -0
  110. package/src/extensions/marketplace/direct-listings/utils.ts +1 -0
  111. package/src/extensions/marketplace/english-auctions/types.ts +1 -0
  112. package/src/extensions/marketplace/english-auctions/utils.ts +1 -0
  113. package/src/react/core/hooks/contract/useContractEvents.ts +32 -2
  114. package/src/react/core/hooks/contract/useReadContract.ts +28 -6
  115. package/src/react/core/hooks/others/useWalletBalance.ts +17 -2
  116. package/src/react/core/hooks/wallets/useActiveAccount.ts +1 -0
  117. package/src/react/core/utils/wallet.ts +19 -1
  118. package/src/react/web/hooks/transaction/useSendTransaction.tsx +74 -4
  119. package/src/react/web/ui/ConnectWallet/ConnectButton.tsx +17 -2
  120. package/src/react/web/ui/ConnectWallet/Modal/ConnectEmbed.tsx +15 -0
  121. package/src/react/web/ui/PayEmbed-disconnected.test.tsx +5 -3
  122. package/src/react/web/ui/PayEmbed.test.tsx +17 -16
  123. package/src/react/web/ui/PayEmbed.tsx +9 -4
  124. package/src/transaction/actions/send-transaction.ts +76 -5
  125. package/src/transaction/prepare-contract-call.ts +18 -13
  126. package/src/transaction/read-contract.ts +39 -6
  127. package/src/utils/encoding/hex.test.ts +11 -0
  128. package/src/utils/fetch.ts +12 -1
  129. package/src/version.ts +1 -1
  130. package/src/wallets/in-app/web/in-app.ts +4 -1
  131. package/src/wallets/in-app/web/lib/auth/index.ts +1 -0
  132. package/src/wallets/smart/smart-wallet-integration.test.ts +6 -0
@@ -9,10 +9,21 @@ type UseContractEventsOptions<abi extends Abi, abiEvents extends PreparedEvent<A
9
9
  watch?: boolean;
10
10
  };
11
11
  /**
12
- * Watches contract events and returns the logs.
13
- * @param options - The {@link UseContractEventsOptions | options} for watching contract events.
12
+ * Watches contract events and returns the parsed logs.
13
+ * @param options - The options for watching contract events.
14
+ * @param options.contract - The contract to watch events for.
15
+ * @param options.events - The events to watch. Shuould be an array of [prepared events](https://portal.thirdweb.com/references/typescript/v5/prepareEvent).
16
+ * @param options.blockRange - The number of blocks to search for events.
17
+ * @param options.enabled - Whether to enable the query.
18
+ * @param options.watch - Whether to watch for new events.
14
19
  * @returns The contract events of the watched contract events.
15
20
  * @example
21
+ *
22
+ * ### Using event extensions
23
+ *
24
+ * The `thirdweb/extesions` export contains event definitions for many popular contracts.
25
+ * You can use these event definitions to watch for specific events with a type-safe API.
26
+ *
16
27
  * ```jsx
17
28
  * import { useContractEvents } from "thirdweb/react";
18
29
  * import { tokensClaimedEvent } from "thirdweb/extensions/erc721";
@@ -23,6 +34,25 @@ type UseContractEventsOptions<abi extends Abi, abiEvents extends PreparedEvent<A
23
34
  * events: [tokensClaimedEvent({ claimer: account?.address })],
24
35
  * });
25
36
  * ```
37
+ *
38
+ * ### Using custom events
39
+ *
40
+ * You can also watch for custom events by passing an array of [prepared events](https://portal.thirdweb.com/references/typescript/v5/prepareEvent).
41
+ *
42
+ * ```jsx
43
+ * import { useContractEvents } from "thirdweb/react";
44
+ * import { prepareEvent } from "thirdweb";
45
+ *
46
+ * const myEvent = prepareEvent({
47
+ * signature: "event MyEvent(uint256 myArg)",
48
+ * });
49
+ *
50
+ * const contractEvents = useContractEvents({
51
+ * contract,
52
+ * events: [myEvent],
53
+ * });
54
+ * ```
55
+ *
26
56
  * @contract
27
57
  */
28
58
  export declare function useContractEvents<const abi extends Abi, const abiEvents extends PreparedEvent<AbiEvent>[]>(options: UseContractEventsOptions<abi, abiEvents>): UseQueryResult<ParseEventLogsResult<abiEvents, true>, Error>;
@@ -1 +1 @@
1
- {"version":3,"file":"useContractEvents.d.ts","sourceRoot":"","sources":["../../../../../../src/react/core/hooks/contract/useContractEvents.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,cAAc,EAGpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAG7C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AACpF,OAAO,EACL,KAAK,0BAA0B,EAEhC,MAAM,2CAA2C,CAAC;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AAIxE,KAAK,wBAAwB,CAC3B,GAAG,SAAS,GAAG,EACf,SAAS,SAAS,aAAa,CAAC,QAAQ,CAAC,EAAE,IACzC,IAAI,CAAC,0BAA0B,CAAC,GAAG,EAAE,SAAS,EAAE,IAAI,CAAC,EAAE,UAAU,CAAC,GAAG;IACvE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,CAAC,GAAG,SAAS,GAAG,EACrB,KAAK,CAAC,SAAS,SAAS,aAAa,CAAC,QAAQ,CAAC,EAAE,EAEjD,OAAO,EAAE,wBAAwB,CAAC,GAAG,EAAE,SAAS,CAAC,GAChD,cAAc,CAAC,oBAAoB,CAAC,SAAS,EAAE,IAAI,CAAC,EAAE,KAAK,CAAC,CAmE9D"}
1
+ {"version":3,"file":"useContractEvents.d.ts","sourceRoot":"","sources":["../../../../../../src/react/core/hooks/contract/useContractEvents.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,cAAc,EAGpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAG7C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AACpF,OAAO,EACL,KAAK,0BAA0B,EAEhC,MAAM,2CAA2C,CAAC;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AAIxE,KAAK,wBAAwB,CAC3B,GAAG,SAAS,GAAG,EACf,SAAS,SAAS,aAAa,CAAC,QAAQ,CAAC,EAAE,IACzC,IAAI,CAAC,0BAA0B,CAAC,GAAG,EAAE,SAAS,EAAE,IAAI,CAAC,EAAE,UAAU,CAAC,GAAG;IACvE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,CAAC,GAAG,SAAS,GAAG,EACrB,KAAK,CAAC,SAAS,SAAS,aAAa,CAAC,QAAQ,CAAC,EAAE,EAEjD,OAAO,EAAE,wBAAwB,CAAC,GAAG,EAAE,SAAS,CAAC,GAChD,cAAc,CAAC,oBAAoB,CAAC,SAAS,EAAE,IAAI,CAAC,EAAE,KAAK,CAAC,CAmE9D"}
@@ -9,13 +9,29 @@ type PickedQueryOptions = Prettify<Pick<UseQueryOptions, "enabled"> & {
9
9
  retry?: number;
10
10
  }>;
11
11
  /**
12
- * A hook to read from a contract.
12
+ * A hook to read state from a contract that automatically updates when the contract changes.
13
+ *
14
+ * You can use raw read calls or read [extensions](https://portal.thirdweb.com/react/v5/extensions) to read from a contract.
15
+ *
13
16
  * @param options - The options for reading from a contract
14
- * @returns a query object.
17
+ * @returns a UseQueryResult object.
15
18
  * @example
16
19
  * ```jsx
20
+ * import { getContract } from "thirdweb";
21
+ * import { sepolia } from "thirdweb/chains";
17
22
  * import { useReadContract } from "thirdweb/react";
18
- * const { data, isLoading } = useReadContract({contract, method: "totalSupply"});
23
+ *
24
+ * const contract = getContract({
25
+ * client,
26
+ * address: "0x...",
27
+ * chain: sepolia,
28
+ * });
29
+ *
30
+ * const { data, isLoading } = useReadContract({
31
+ * contract,
32
+ * method: "function tokenURI(uint256 tokenId) returns (string)"});
33
+ * params: [1n],
34
+ * });
19
35
  * ```
20
36
  * @contract
21
37
  */
@@ -25,14 +41,20 @@ export declare function useReadContract<const abi extends Abi, const method exte
25
41
  queryOptions?: PickedQueryOptions;
26
42
  }): UseQueryResult<ReadContractResult<PreparedMethod<ParseMethod<abi, method>>[2]>>;
27
43
  /**
28
- * A hook to read from a contract.
44
+ * A hook to read state from a contract that automatically updates when the contract changes.
45
+ * You can use raw read calls or read [extensions](https://portal.thirdweb.com/react/v5/extensions) to read from a contract.
46
+ *
29
47
  * @param extension - An extension to call.
30
48
  * @param options - The read extension params.
31
- * @returns a query object.
49
+ * @returns a UseQueryResult object.
32
50
  * @example
51
+ *
52
+ * Read a contract extension let you do complex contract queries with less code.
53
+ *
33
54
  * ```jsx
34
55
  * import { useReadContract } from "thirdweb/react";
35
- * import { getOwnedNFTs } form "thirdweb/extensions/erc721"
56
+ * import { getOwnedNFTs } form "thirdweb/extensions/erc721";
57
+ *
36
58
  * const { data, isLoading } = useReadContract(getOwnedNFTs, { contract, owner: address });
37
59
  * ```
38
60
  */
@@ -1 +1 @@
1
- {"version":3,"file":"useReadContract.d.ts","sourceRoot":"","sources":["../../../../../../src/react/core/hooks/contract/useReadContract.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,cAAc,EAGpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,GAAG,EAAE,WAAW,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAEzE,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EAExB,MAAM,0CAA0C,CAAC;AAClD,OAAO,KAAK,EACV,sBAAsB,EACtB,WAAW,EACZ,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAG9E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAEhE,KAAK,kBAAkB,GAAG,QAAQ,CAChC,IAAI,CAAC,eAAe,EAAE,SAAS,CAAC,GAAG;IACjC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CACF,CAAC;AAEF;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAC7B,KAAK,CAAC,GAAG,SAAS,GAAG,EACrB,KAAK,CAAC,MAAM,SAAS,GAAG,SAAS;IAAE,MAAM,EAAE,CAAC,CAAA;CAAE,GAC1C,WAAW,GAAG,MAAM,GACpB,uBAAuB,CAAC,GAAG,CAAC,EAEhC,OAAO,EAAE,mBAAmB,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG;IAC1C,YAAY,CAAC,EAAE,kBAAkB,CAAC;CACnC,GACA,cAAc,CACf,kBAAkB,CAAC,cAAc,CAAC,WAAW,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAChE,CAAC;AACF;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAC7B,KAAK,CAAC,GAAG,SAAS,GAAG,EACrB,KAAK,CAAC,MAAM,SAAS,MAAM,EAC3B,MAAM,EAEN,SAAS,EAAE,CAAC,OAAO,EAAE,sBAAsB,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,OAAO,CAAC,MAAM,CAAC,EAC5E,OAAO,EAAE,sBAAsB,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG;IAC7C,YAAY,CAAC,EAAE,kBAAkB,CAAC;CACnC,GACA,cAAc,CAAC,MAAM,CAAC,CAAC"}
1
+ {"version":3,"file":"useReadContract.d.ts","sourceRoot":"","sources":["../../../../../../src/react/core/hooks/contract/useReadContract.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,cAAc,EAGpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,GAAG,EAAE,WAAW,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAEzE,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EAExB,MAAM,0CAA0C,CAAC;AAClD,OAAO,KAAK,EACV,sBAAsB,EACtB,WAAW,EACZ,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAG9E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAEhE,KAAK,kBAAkB,GAAG,QAAQ,CAChC,IAAI,CAAC,eAAe,EAAE,SAAS,CAAC,GAAG;IACjC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CACF,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,eAAe,CAC7B,KAAK,CAAC,GAAG,SAAS,GAAG,EACrB,KAAK,CAAC,MAAM,SAAS,GAAG,SAAS;IAAE,MAAM,EAAE,CAAC,CAAA;CAAE,GAC1C,WAAW,GAAG,MAAM,GACpB,uBAAuB,CAAC,GAAG,CAAC,EAEhC,OAAO,EAAE,mBAAmB,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG;IAC1C,YAAY,CAAC,EAAE,kBAAkB,CAAC;CACnC,GACA,cAAc,CACf,kBAAkB,CAAC,cAAc,CAAC,WAAW,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAChE,CAAC;AACF;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,eAAe,CAC7B,KAAK,CAAC,GAAG,SAAS,GAAG,EACrB,KAAK,CAAC,MAAM,SAAS,MAAM,EAC3B,MAAM,EAEN,SAAS,EAAE,CAAC,OAAO,EAAE,sBAAsB,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,OAAO,CAAC,MAAM,CAAC,EAC5E,OAAO,EAAE,sBAAsB,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG;IAC7C,YAAY,CAAC,EAAE,kBAAkB,CAAC;CACnC,GACA,cAAc,CAAC,MAAM,CAAC,CAAC"}
@@ -8,8 +8,8 @@ export type UseWalletBalanceOptions = Prettify<Omit<GetWalletBalanceOptions, "ad
8
8
  }>;
9
9
  export type UseWalletBalanceQueryOptions = Omit<UseQueryOptions<GetWalletBalanceResult>, "queryFn" | "queryKey" | "enabled">;
10
10
  /**
11
- * Fetch the balance of a wallet for a specific token.
12
- * @note Leave `tokenAddress` undefined to fetch the native token balance.
11
+ * Fetch the balance of a wallet in native currency or for a specific token.
12
+ * Leave `tokenAddress` undefined to fetch the native token balance.
13
13
  * @param options {@link GetWalletBalanceOptions} - The options for fetching the wallet balance.
14
14
  * @param options.chain - The chain to fetch the wallet balance from.
15
15
  * @param options.address - The address of the wallet to fetch the balance from.
@@ -18,10 +18,25 @@ export type UseWalletBalanceQueryOptions = Omit<UseQueryOptions<GetWalletBalance
18
18
  * @returns {@link GetWalletBalanceResult} The result of the query.
19
19
  *
20
20
  * @example
21
+ *
22
+ * ### Fetching the native token balance
23
+ *
21
24
  * ```ts
22
25
  * import { useWalletBalance } from "thirdweb/react";
23
26
  *
27
+ * const { data, isLoading, isError } = useWalletBalance({ chain, address, client });
28
+ * console.log("balance", data?.displayValue, data?.symbol);
29
+ * ```
30
+ *
31
+ * ### Fetching a specific token balance
32
+ *
33
+ * ```ts
34
+ * import { useWalletBalance } from "thirdweb/react";
35
+ *
36
+ * const tokenAddress = "0x..."; // the ERC20 token address
37
+ *
24
38
  * const { data, isLoading, isError } = useWalletBalance({ chain, address, client, tokenAddress });
39
+ * console.log("balance", data?.displayValue, data?.symbol);
25
40
  * ```
26
41
  * @wallet
27
42
  */
@@ -1 +1 @@
1
- {"version":3,"file":"useWalletBalance.d.ts","sourceRoot":"","sources":["../../../../../../src/react/core/hooks/others/useWalletBalance.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,cAAc,EAEpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAE5B,MAAM,+CAA+C,CAAC;AAEvD,MAAM,MAAM,uBAAuB,GAAG,QAAQ,CAC5C,IAAI,CAAC,uBAAuB,EAAE,SAAS,GAAG,OAAO,CAAC,GAAG;IACnD,OAAO,EAAE,MAAM,GAAG,SAAS,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 @@
6
6
  * import { useActiveAccount } from "thirdweb/react";
7
7
  *
8
8
  * const activeAccount = useActiveAccount();
9
+ * console.log("address", activeAccount?.address);
9
10
  * ```
10
11
  * @walletConnection
11
12
  */
@@ -1 +1 @@
1
- {"version":3,"file":"useActiveAccount.d.ts","sourceRoot":"","sources":["../../../../../../src/react/core/hooks/wallets/useActiveAccount.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,iEAI/B"}
1
+ {"version":3,"file":"useActiveAccount.d.ts","sourceRoot":"","sources":["../../../../../../src/react/core/hooks/wallets/useActiveAccount.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,iEAI/B"}
@@ -53,11 +53,29 @@ export declare function useConnectedWalletDetails(client: ThirdwebClient, wallet
53
53
  };
54
54
  /**
55
55
  * Returns the wallet info for the provided wallet id.
56
+ *
57
+ * @example
58
+ * ```tsx
59
+ * import { useWalletInfo } from "thirdweb/react";
60
+ *
61
+ * const { data: walletInfo } = useWalletInfo("io.metamask");
62
+ * console.log("Walelt name", walletInfo?.name);
63
+ * ```
56
64
  * @wallet
57
65
  */
58
66
  export declare function useWalletInfo(id: WalletId | undefined): import("@tanstack/react-query").UseQueryResult<WalletInfo, Error>;
59
67
  /**
60
- * Returns the wallet image for the provided wallet id.
68
+ * Returns the wallet icon for the provided wallet id.
69
+ *
70
+ * @example
71
+ * ```tsx
72
+ * import { useWalletImage } from "thirdweb/react";
73
+ *
74
+ * const { data: walletImage } = useWalletImage("io.metamask");
75
+ *
76
+ * return <img src={walletImage} alt="MetaMask logo" />;
77
+ * ```
78
+ *
61
79
  * @wallet
62
80
  */
63
81
  export declare function useWalletImage(id: WalletId | undefined): import("@tanstack/react-query").UseQueryResult<string, Error>;
@@ -1 +1 @@
1
- {"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../../../../../src/react/core/utils/wallet.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE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hE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAIjE;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE;IAClC,MAAM,EAAE,cAAc,CAAC;IACvB,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;CAC7B,wEAYA;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE;IACpC,MAAM,EAAE,cAAc,CAAC;IACvB,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;CACpC,wEAWA;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,cAAc,EACtB,WAAW,EAAE,KAAK,GAAG,SAAS,EAC9B,aAAa,EAAE,OAAO,GAAG,SAAS,EAClC,mBAAmB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;;;;;;EAqC7C;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,EAAE,EAAE,QAAQ,GAAG,SAAS,qEAcrD;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,QAAQ,GAAG,SAAS,iEActD;AAED;;GAEG;AACH,wBAAgB,+BAA+B,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,WA2BzE"}
@@ -1,16 +1,86 @@
1
1
  import { type SendTransactionConfig } from "../../../core/hooks/transaction/useSendTransaction.js";
2
2
  /**
3
- * A hook to send a transaction.
4
- * @returns A mutation object to send a transaction.
3
+ * A hook to send a transaction with from the user's connected wallet.
4
+ *
5
+ * You can send a transaction with a [prepared contract call](https://portal.thirdweb.com/references/typescript/v5/prepareContractCall), a [prepared transaction](https://portal.thirdweb.com/references/typescript/v5/prepareTransaction), or using a write [Extension](https://portal.thirdweb.com/react/v5/extensions).
6
+ *
7
+ * @returns A UseMutationResult object to send a transaction.
5
8
  * @param config Configuration for the `useSendTransaction` hook.
6
9
  * Refer to [`SendTransactionConfig`](https://portal.thirdweb.com/references/typescript/v5/SendTransactionConfig) for more details.
7
10
  * @example
11
+ *
12
+ * ### Using a prepared contract call
13
+ *
8
14
  * ```tsx
9
15
  * import { useSendTransaction } from "thirdweb/react";
16
+ * import { getContract, prepareContractCall } from "thirdweb";
17
+ * import { sepolia } from "thirdweb/chains";
18
+ *
19
+ * const contract = getContract({
20
+ * address: "0x...",
21
+ * chain: sepolia,
22
+ * client,
23
+ * });
24
+ *
25
+ * const { mutate: sendTx, data: transactionResult } = useSendTransaction();
26
+ *
27
+ * const onClick = () => {
28
+ * const transaction = prepareContractCall({
29
+ * contract,
30
+ * method: "function transfer(address to, uint256 value)",
31
+ * params: [to, value],
32
+ * }),
33
+ * });
34
+ * sendTx(transaction);
35
+ * };
36
+ * ```
37
+ *
38
+ * ### Using a write extension
39
+ *
40
+ * ```tsx
41
+ * import { useSendTransaction } from "thirdweb/react";
42
+ * import { mintTo } from "thirdweb/extensions/erc721";
43
+ *
44
+ * const { mutate: sendTx, data: transactionResult } = useSendTransaction();
45
+ *
46
+ * const onClick = () => {
47
+ * const transaction = mintTo({
48
+ * contract,
49
+ * to: "0x...",
50
+ * nft: {
51
+ * name: "NFT Name",
52
+ * description: "NFT Description",
53
+ * image: "https://example.com/image.png",
54
+ * },
55
+ * });
56
+ * sendTx(transaction);
57
+ * };
58
+ * ```
59
+ *
60
+ * ### Sending a prepared transaction
61
+ *
62
+ * ```tsx
63
+ * import { useSendTransaction } from "thirdweb/react";
64
+ * import { getContract, prepareTransaction } from "thirdweb";
65
+ * import { sepolia } from "thirdweb/chains";
66
+ *
67
+ * const contract = getContract({
68
+ * address: "0x...",
69
+ * chain: sepolia,
70
+ * client,
71
+ * });
72
+ *
10
73
  * const { mutate: sendTx, data: transactionResult } = useSendTransaction();
11
74
  *
12
- * // later
13
- * sendTx(tx);
75
+ * const onClick = () => {
76
+ * const transaction = prepareTransaction({
77
+ * contract,
78
+ * to: "0x...",
79
+ * value: toWei("0.1"),
80
+ * }),
81
+ * });
82
+ * sendTx(transaction);
83
+ * };
14
84
  * ```
15
85
  *
16
86
  * @transaction
@@ -1 +1 @@
1
- {"version":3,"file":"useSendTransaction.d.ts","sourceRoot":"","sources":["../../../../../../src/react/web/hooks/transaction/useSendTransaction.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,qBAAqB,EAG3B,MAAM,uDAAuD,CAAC;AAM/D;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,GAAE,qBAA0B;;;;;wFAiDpE"}
1
+ {"version":3,"file":"useSendTransaction.d.ts","sourceRoot":"","sources":["../../../../../../src/react/web/hooks/transaction/useSendTransaction.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,qBAAqB,EAG3B,MAAM,uDAAuD,CAAC;AAM/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqFG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,GAAE,qBAA0B;;;;;wFAiDpE"}
@@ -54,14 +54,29 @@ import type { ConnectButtonProps } from "../../../core/hooks/connection/ConnectB
54
54
  * ### Customizing the default chain to connect to
55
55
  *
56
56
  * ```tsx
57
- * import { base } from "thirdweb/chains";
57
+ * import { sepolia } from "thirdweb/chains";
58
58
  *
59
59
  * <ConnectButton
60
60
  * client={client}
61
- * chain={base}
61
+ * chain={sepolia}
62
62
  * />
63
63
  * ```
64
64
  *
65
+ * ### Enabling Account Abstraction
66
+ *
67
+ * By passing the `accountAbstraction` prop, ALL connected wallets will be converted to smart accounts.
68
+ * And by setting `sponsorGas` to `true`, all transactions done with those smart accounts will be sponsored.
69
+ *
70
+ * ```tsx
71
+ * <ConnectButton
72
+ * client={client}
73
+ * accountAbstraction={{
74
+ * chain: sepolia,
75
+ * sponsorGas: true,
76
+ * }}
77
+ * />;
78
+ * ```
79
+ *
65
80
  * ### Enabling sign in with ethereum (Auth)
66
81
  *
67
82
  * ```tsx
@@ -1 +1 @@
1
- {"version":3,"file":"ConnectButton.d.ts","sourceRoot":"","sources":["../../../../../../src/react/web/ui/ConnectWallet/ConnectButton.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sDAAsD,CAAC;AA2B/F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgNG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,8CAkGtD"}
1
+ {"version":3,"file":"ConnectButton.d.ts","sourceRoot":"","sources":["../../../../../../src/react/web/ui/ConnectWallet/ConnectButton.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sDAAsD,CAAC;AA2B/F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+NG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,8CAkGtD"}
@@ -56,6 +56,21 @@ import type { ConnectEmbedProps } from "../../../../core/hooks/connection/Connec
56
56
  * />
57
57
  * ```
58
58
  *
59
+ * ### Enabling Account Abstraction
60
+ *
61
+ * By passing the `accountAbstraction` prop, ALL connected wallets will be converted to smart accounts.
62
+ * And by setting `sponsorGas` to `true`, all transactions done with those smart accounts will be sponsored.
63
+ *
64
+ * ```tsx
65
+ * <ConnectEmbed
66
+ * client={client}
67
+ * accountAbstraction={{
68
+ * chain: sepolia,
69
+ * sponsorGas: true,
70
+ * }}
71
+ * />;
72
+ * ```
73
+ *
59
74
  * ### Enabling sign in with ethereum (Auth)
60
75
  *
61
76
  * ```tsx
@@ -1 +1 @@
1
- {"version":3,"file":"ConnectEmbed.d.ts","sourceRoot":"","sources":["../../../../../../../src/react/web/ui/ConnectWallet/Modal/ConnectEmbed.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wDAAwD,CAAC;AAyBhG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2HG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,8CA+GpD;AAuHD,eAAO,MAAM,cAAc;;SAhYG,MAAO,WAAW;;eAiYnC,SAAS,GAAG,MAAM;yGAwB7B,CAAC"}
1
+ {"version":3,"file":"ConnectEmbed.d.ts","sourceRoot":"","sources":["../../../../../../../src/react/web/ui/ConnectWallet/Modal/ConnectEmbed.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wDAAwD,CAAC;AAyBhG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0IG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,8CA+GpD;AAuHD,eAAO,MAAM,cAAc;;SA/YG,MAAO,WAAW;;eAgZnC,SAAS,GAAG,MAAM;yGAwB7B,CAAC"}
@@ -108,6 +108,7 @@ export type PayEmbedProps = {
108
108
  */
109
109
  connectOptions?: PayEmbedConnectOptions;
110
110
  style?: React.CSSProperties;
111
+ className?: string;
111
112
  };
112
113
  /**
113
114
  * Embed thirdweb Pay UI for Buy tokens using Crypto or Credit Card.
@@ -1 +1 @@
1
- {"version":3,"file":"PayEmbed.d.ts","sourceRoot":"","sources":["../../../../../src/react/web/ui/PayEmbed.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAEtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uCAAuC,CAAC;AACpE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAE7D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AAC/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,KAAK,EACV,iCAAiC,EACjC,YAAY,EACb,MAAM,mDAAmD,CAAC;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAOzE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAoCG;IACH,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC;;;;;;;;;;;;;;OAcG;IACH,MAAM,EAAE,cAAc,CAAC;IACvB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,QAAQ,CAAC;IAClB;;OAEG;IACH,UAAU,CAA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ACnC;;;OAGG;IACH,YAAY,CAAC,EAAE,iCAAiC,CAAC;IAEjD;;;;;;;OAOG;IACH,aAAa,CAAC,EAAE;QACd,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;IAEF;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;IAExC;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB;;;;;;;;;OASG;IACH,WAAW,CAAC,EACR;QACE,OAAO,EAAE,MAAM,CAAC;KACjB,GACD,OAAO,CAAC;IAEZ;;OAEG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;IAE1B;;;;;;;;;;;;;OAaG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;IAEd;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC;IAEjB;;OAEG;IACH,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAE9B;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,eAAe,CAAC;CACxB,CAAC"}
@@ -8,18 +8,89 @@ export type SendTransactionOptions = {
8
8
  gasless?: GaslessOptions;
9
9
  };
10
10
  /**
11
- * Sends a transaction using the provided wallet.
11
+ * Sends a transaction using the provided account.
12
+ *
13
+ * You can send a transaction with a [prepared contract call](https://portal.thirdweb.com/references/typescript/v5/prepareContractCall), a [prepared transaction](https://portal.thirdweb.com/references/typescript/v5/prepareTransaction), or using a write [Extension](https://portal.thirdweb.com/typescript/v5/extensions/use).
12
14
  * @param options - The options for sending the transaction.
13
- * @returns A promise that resolves to the transaction hash.
14
- * @throws An error if the wallet is not connected.
15
+ * @returns A promise that resolves to the transaction result.
16
+ * @throws An error if the transaction reverts.
15
17
  * @transaction
16
18
  * @example
19
+ *
20
+ * ### Using a prepared contract call
21
+ *
22
+ * ```ts
23
+ * import { sendTransaction, getContract, prepareContractCall } from "thirdweb";
24
+ * import { sepolia } from "thirdweb/chains";
25
+ *
26
+ * const contract = getContract({
27
+ * address: "0x...",
28
+ * chain: sepolia,
29
+ * client,
30
+ * });
31
+ *
32
+ * const transaction = prepareContractCall({
33
+ * contract,
34
+ * method: "function transfer(address to, uint256 value)",
35
+ * params: [to, value],
36
+ * });
37
+ *
38
+ * const { transactionHash } = await sendTransaction({
39
+ * account,
40
+ * transaction,
41
+ * });
42
+ * ```
43
+ *
44
+ * ### Using a write extension
45
+ *
17
46
  * ```ts
18
- * import { sendTransaction } from "thirdweb";
47
+ * import { sendTransaction, getContract } from "thirdweb";
48
+ * import { sepolia } from "thirdweb/chains";
49
+ * import { mintTo } from "thirdweb/extensions/erc721";
50
+ *
51
+ * const contract = getContract({
52
+ * address: "0x...",
53
+ * chain: sepolia,
54
+ * client,
55
+ * });
56
+ *
57
+ * const transaction = mintTo({
58
+ * contract,
59
+ * to: "0x...",
60
+ * nft: {
61
+ * name: "NFT Name",
62
+ * description: "NFT Description",
63
+ * image: "https://example.com/image.png",
64
+ * },
65
+ * });
66
+ *
67
+ * const { transactionHash } = await sendTransaction({
68
+ * account,
69
+ * transaction,
70
+ * });
71
+ * ```
72
+ *
73
+ * ### Using a prepared transaction
74
+ *
75
+ * ```ts
76
+ * import { sendTransaction, getContract, prepareTransaction } from "thirdweb";
77
+ * import { sepolia } from "thirdweb/chains";
78
+ *
79
+ * const contract = getContract({
80
+ * address: "0x...",
81
+ * chain: sepolia,
82
+ * client,
83
+ * });
84
+ *
85
+ * const transaction = prepareTransaction({
86
+ * contract,
87
+ * to: "0x...",
88
+ * value: toWei("0.1"),
89
+ * });
19
90
  *
20
91
  * const { transactionHash } = await sendTransaction({
21
92
  * account,
22
- * transaction
93
+ * transaction,
23
94
  * });
24
95
  * ```
25
96
  */
@@ -1 +1 @@
1
- {"version":3,"file":"send-transaction.d.ts","sourceRoot":"","sources":["../../../../src/transaction/actions/send-transaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAErE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAEtE,MAAM,MAAM,sBAAsB,GAAG;IACnC,OAAO,EAAE,OAAO,CAAC;IAGjB,WAAW,EAAE,mBAAmB,CAAC,GAAG,CAAC,CAAC;IACtC,OAAO,CAAC,EAAE,cAAc,CAAC;CAC1B,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC,qBAAqB,CAAC,CAkChC"}
1
+ {"version":3,"file":"send-transaction.d.ts","sourceRoot":"","sources":["../../../../src/transaction/actions/send-transaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAErE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAEtE,MAAM,MAAM,sBAAsB,GAAG;IACnC,OAAO,EAAE,OAAO,CAAC;IAGjB,WAAW,EAAE,mBAAmB,CAAC,GAAG,CAAC,CAAC;IACtC,OAAO,CAAC,EAAE,cAAc,CAAC;CAC1B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsFG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC,qBAAqB,CAAC,CAkChC"}
@@ -16,36 +16,41 @@ export type PrepareContractCallOptions<TAbi extends Abi = [], TMethod extends Ab
16
16
  * @returns A promise that resolves to the prepared transaction.
17
17
  * @transaction
18
18
  * @example
19
- * Usage with a human-readable method signature:
19
+ *
20
+ * ### Usage with a human-readable method signature:
21
+ *
20
22
  * ```ts
21
23
  * import { prepareContractCall } from "thirdweb";
22
24
  *
23
- * const transaction = await prepareContractCall({
25
+ * const transaction = prepareContractCall({
24
26
  * contract,
25
27
  * method: "function transfer(address to, uint256 value)",
26
28
  * params: [to, value],
27
29
  * });
28
30
  * ```
29
- * @example
30
- * Usage with explicit gas price and/or value:
31
+ *
32
+ * ### Usage with explicit gas price and/or value:
33
+ *
31
34
  * ```ts
32
35
  * import { prepareContractCall } from "thirdweb";
36
+ * import { toWei } from "thirdweb/utils";
33
37
  *
34
- * const transaction = await prepareContractCall({
38
+ * const transaction = prepareContractCall({
35
39
  * contract,
36
40
  * method: "function transfer(address to, uint256 value)",
37
41
  * params: [to, value],
38
42
  * maxFeePerGas: 30n,
39
43
  * maxPriorityFeePerGas: 1n,
40
- * value: 100000n,
44
+ * value: toWei("0.01"),
41
45
  * });
42
46
  * ```
43
- * @example
44
- * Usage with a JSON ABI function object:
47
+ *
48
+ * ### Usage with a JSON ABI function object:
49
+ *
45
50
  * ```ts
46
51
  * import { prepareContractCall } from "thirdweb";
47
52
  *
48
- * const transaction = await prepareContractCall({
53
+ * const transaction = prepareContractCall({
49
54
  * contract,
50
55
  * method: {
51
56
  * name: "transfer",
@@ -60,8 +65,9 @@ export type PrepareContractCallOptions<TAbi extends Abi = [], TMethod extends Ab
60
65
  * params: [to, value],
61
66
  * });
62
67
  * ```
63
- * @example
64
- * Usage with a the ABI defined on the contract:
68
+ *
69
+ * ### Usage with a the ABI defined on the contract:
70
+ *
65
71
  * ```ts
66
72
  * import { getContract, prepareContractCall } from "thirdweb";
67
73
  * const contract = getContract({
@@ -75,8 +81,7 @@ export type PrepareContractCallOptions<TAbi extends Abi = [], TMethod extends Ab
75
81
  * });
76
82
  * ```
77
83
  *
78
- * @example
79
- * Passing extra call data to the transaction
84
+ * ### Passing extra call data to the transaction
80
85
  * ```ts
81
86
  * import { getContract, prepareContractCall } from "thirdweb";
82
87
  * const contract = getContract({
@@ -1 +1 @@
1
- {"version":3,"file":"prepare-contract-call.d.ts","sourceRoot":"","sources":["../../../src/transaction/prepare-contract-call.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,GAAG,EACR,KAAK,WAAW,EAChB,KAAK,uBAAuB,EAE7B,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,MAAM,CAAC;AAC/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,OAAO,EACL,KAAK,cAAc,EAEpB,MAAM,gCAAgC,CAAC;AAExC,OAAO,EACL,KAAK,yBAAyB,EAE/B,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EACV,sBAAsB,EACtB,YAAY,EACZ,WAAW,EACZ,MAAM,YAAY,CAAC;AAGpB,MAAM,MAAM,0BAA0B,CACpC,IAAI,SAAS,GAAG,GAAG,EAAE,EACrB,OAAO,SACH,WAAW,GACX,MAAM,GACN,CAAC,CACC,QAAQ,EAAE,gBAAgB,CAAC,IAAI,CAAC,KAC7B,OAAO,CAAC,WAAW,CAAC,CAAC,GAAG,IAAI,SAAS;IAAE,MAAM,EAAE,CAAC,CAAA;CAAE,GACvD,WAAW,GAAG,MAAM,GACpB,uBAAuB,CAAC,IAAI,CAAC,EACjC,eAAe,SAAS,cAAc,CACpC,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAC3B,GAAG,cAAc,CAAC,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,IAC5C,sBAAsB,CACxB,IAAI,CACF,kBAAkB,EAChB,MAAM,GACN,IAAI,GACJ,MAAM,GACN,OAAO,GACP,YAAY,GACZ,KAAK,GACL,UAAU,GACV,cAAc,GACd,sBAAsB,GACtB,OAAO,CACV,GAAG;IACF,QAAQ,EAAE,g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AEO,WAAW,GACX,YAAY,MAAM,EAAE,GACpB,CAAC,CAAC,QAAQ,EAAE,gBAAgB,CAAC,IAAI,CAAC,KAAK,OAAO,CAAC,WAAW,CAAC,CAAC,GAChE,uBAAuB,CAAC,IAAI,CAAC,EACjC,KAAK,CAAC,eAAe,SAAS,cAAc,CAC1C,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAC3B,GAAG,cAAc,CAAC,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,EAC9C,OAAO,EAAE,0BAA0B,CAAC,IAAI,EAAE,OAAO,EAAE,eAAe,CAAC,uHA8EpE"}
@@ -16,16 +16,49 @@ export type ReadContractOptions<TAbi extends Abi = [], TMethod extends AbiFuncti
16
16
  from?: string;
17
17
  } & ParamsOption<TPreparedMethod[1]> & Omit<PrepareTransactionOptions, "to" | "data" | "chain" | "client">, TAbi>;
18
18
  /**
19
- * Reads data from a smart contract.
19
+ * Reads state from a deployed smart contract.
20
+ *
21
+ * You can use raw read calls or read [extensions](https://portal.thirdweb.com/typescript/v5/extensions/use) to read from a contract.
22
+ *
20
23
  * @param options - The transaction options.
21
- * @returns A promise that resolves with the result of the read transaction.
24
+ * @returns A promise that resolves with the result of the read call.
22
25
  * @transaction
23
26
  * @example
27
+ *
28
+ * ### Using a contract read extension
29
+ *
24
30
  * ```ts
25
- * import { readContract } from "thirdweb";
26
- * const result = await readContract({
27
- * contract,
28
- * method: "function totalSupply() view returns (uint256)",
31
+ * import { getContract } from "thirdweb";
32
+ * import { sepolia } from "thirdweb/chains";
33
+ * import { useReadContract } from "thirdweb/react";
34
+ * import { getOwnedNFTs } form "thirdweb/extensions/erc721";
35
+ *
36
+ * const contract = getContract({
37
+ * client,
38
+ * address: "0x...",
39
+ * chain: sepolia,
40
+ * });
41
+ *
42
+ * const { data, isLoading } = useReadContract(getOwnedNFTs, { contract, owner: address });
43
+ * ```
44
+ *
45
+ * ### Using a raw contract call
46
+ *
47
+ * ```ts
48
+ * import { getContract } from "thirdweb";
49
+ * import { sepolia } from "thirdweb/chains";
50
+ * import { useReadContract } from "thirdweb/react";
51
+ *
52
+ * const contract = getContract({
53
+ * client,
54
+ * address: "0x...",
55
+ * chain: sepolia,
56
+ * });
57
+ *
58
+ * const { data, isLoading } = useReadContract({
59
+ * contract,
60
+ * method: "function tokenURI(uint256 tokenId) returns (string)"});
61
+ * params: [1n],
29
62
  * });
30
63
  * ```
31
64
  */