thirdweb 5.97.1 → 5.97.3

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 (119) hide show
  1. package/dist/cjs/contract/verification/constructor-params.js +1 -1
  2. package/dist/cjs/contract/verification/constructor-params.js.map +1 -1
  3. package/dist/cjs/engine/get-status.js +110 -0
  4. package/dist/cjs/engine/get-status.js.map +1 -0
  5. package/dist/cjs/engine/index.js +9 -0
  6. package/dist/cjs/engine/index.js.map +1 -0
  7. package/dist/cjs/engine/server-wallet.js +214 -0
  8. package/dist/cjs/engine/server-wallet.js.map +1 -0
  9. package/dist/cjs/exports/engine.js +5 -0
  10. package/dist/cjs/exports/engine.js.map +1 -0
  11. package/dist/cjs/exports/thirdweb.js +6 -2
  12. package/dist/cjs/exports/thirdweb.js.map +1 -1
  13. package/dist/cjs/extensions/prebuilts/get-required-transactions.js +5 -5
  14. package/dist/cjs/extensions/prebuilts/get-required-transactions.js.map +1 -1
  15. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js +1 -1
  16. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js.map +1 -1
  17. package/dist/cjs/react/web/ui/prebuilt/NFT/utils.js +1 -0
  18. package/dist/cjs/react/web/ui/prebuilt/NFT/utils.js.map +1 -1
  19. package/dist/cjs/react/web/wallets/in-app/InAppWalletConnectUI.js +1 -1
  20. package/dist/cjs/react/web/wallets/in-app/InAppWalletConnectUI.js.map +1 -1
  21. package/dist/cjs/storage/upload/mobile.js +1 -1
  22. package/dist/cjs/storage/upload/mobile.js.map +1 -1
  23. package/dist/cjs/utils/domains.js +3 -0
  24. package/dist/cjs/utils/domains.js.map +1 -1
  25. package/dist/cjs/utils/fetch.js +7 -3
  26. package/dist/cjs/utils/fetch.js.map +1 -1
  27. package/dist/cjs/version.js +1 -1
  28. package/dist/cjs/wallets/engine/index.js +1 -0
  29. package/dist/cjs/wallets/engine/index.js.map +1 -1
  30. package/dist/cjs/wallets/smart/lib/calls.js +13 -6
  31. package/dist/cjs/wallets/smart/lib/calls.js.map +1 -1
  32. package/dist/cjs/wallets/smart/lib/paymaster.js +2 -2
  33. package/dist/cjs/wallets/smart/lib/paymaster.js.map +1 -1
  34. package/dist/esm/contract/verification/constructor-params.js +1 -1
  35. package/dist/esm/contract/verification/constructor-params.js.map +1 -1
  36. package/dist/esm/engine/get-status.js +106 -0
  37. package/dist/esm/engine/get-status.js.map +1 -0
  38. package/dist/esm/engine/index.js +3 -0
  39. package/dist/esm/engine/index.js.map +1 -0
  40. package/dist/esm/engine/server-wallet.js +211 -0
  41. package/dist/esm/engine/server-wallet.js.map +1 -0
  42. package/dist/esm/exports/engine.js +2 -0
  43. package/dist/esm/exports/engine.js.map +1 -0
  44. package/dist/esm/exports/thirdweb.js +4 -0
  45. package/dist/esm/exports/thirdweb.js.map +1 -1
  46. package/dist/esm/extensions/prebuilts/get-required-transactions.js +5 -5
  47. package/dist/esm/extensions/prebuilts/get-required-transactions.js.map +1 -1
  48. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js +1 -1
  49. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js.map +1 -1
  50. package/dist/esm/react/web/ui/prebuilt/NFT/utils.js +1 -0
  51. package/dist/esm/react/web/ui/prebuilt/NFT/utils.js.map +1 -1
  52. package/dist/esm/react/web/wallets/in-app/InAppWalletConnectUI.js +1 -1
  53. package/dist/esm/react/web/wallets/in-app/InAppWalletConnectUI.js.map +1 -1
  54. package/dist/esm/storage/upload/mobile.js +1 -1
  55. package/dist/esm/storage/upload/mobile.js.map +1 -1
  56. package/dist/esm/utils/domains.js +3 -0
  57. package/dist/esm/utils/domains.js.map +1 -1
  58. package/dist/esm/utils/fetch.js +7 -3
  59. package/dist/esm/utils/fetch.js.map +1 -1
  60. package/dist/esm/version.js +1 -1
  61. package/dist/esm/wallets/engine/index.js +1 -0
  62. package/dist/esm/wallets/engine/index.js.map +1 -1
  63. package/dist/esm/wallets/smart/lib/calls.js +13 -6
  64. package/dist/esm/wallets/smart/lib/calls.js.map +1 -1
  65. package/dist/esm/wallets/smart/lib/paymaster.js +2 -2
  66. package/dist/esm/wallets/smart/lib/paymaster.js.map +1 -1
  67. package/dist/types/engine/get-status.d.ts +81 -0
  68. package/dist/types/engine/get-status.d.ts.map +1 -0
  69. package/dist/types/engine/index.d.ts +3 -0
  70. package/dist/types/engine/index.d.ts.map +1 -0
  71. package/dist/types/engine/server-wallet.d.ts +95 -0
  72. package/dist/types/engine/server-wallet.d.ts.map +1 -0
  73. package/dist/types/exports/engine.d.ts +2 -0
  74. package/dist/types/exports/engine.d.ts.map +1 -0
  75. package/dist/types/exports/thirdweb.d.ts +4 -0
  76. package/dist/types/exports/thirdweb.d.ts.map +1 -1
  77. package/dist/types/react/native/ui/prebuilt/Account/balance.d.ts +1 -1
  78. package/dist/types/react/native/ui/prebuilt/Wallet/name.d.ts +1 -1
  79. package/dist/types/react/web/ui/prebuilt/Account/balance.d.ts +1 -1
  80. package/dist/types/react/web/ui/prebuilt/Chain/name.d.ts +1 -1
  81. package/dist/types/react/web/ui/prebuilt/NFT/utils.d.ts.map +1 -1
  82. package/dist/types/react/web/ui/prebuilt/Token/name.d.ts +1 -1
  83. package/dist/types/react/web/ui/prebuilt/Token/symbol.d.ts +1 -1
  84. package/dist/types/react/web/ui/prebuilt/Wallet/name.d.ts +1 -1
  85. package/dist/types/utils/domains.d.ts +6 -0
  86. package/dist/types/utils/domains.d.ts.map +1 -1
  87. package/dist/types/utils/fetch.d.ts.map +1 -1
  88. package/dist/types/version.d.ts +1 -1
  89. package/dist/types/wallets/engine/index.d.ts +1 -0
  90. package/dist/types/wallets/engine/index.d.ts.map +1 -1
  91. package/dist/types/wallets/smart/lib/calls.d.ts.map +1 -1
  92. package/package.json +7 -1
  93. package/src/contract/verification/constructor-params.ts +1 -1
  94. package/src/engine/get-status.ts +180 -0
  95. package/src/engine/index.ts +11 -0
  96. package/src/engine/server-wallet.test.ts +196 -0
  97. package/src/engine/server-wallet.ts +284 -0
  98. package/src/exports/engine.ts +1 -0
  99. package/src/exports/thirdweb.ts +5 -0
  100. package/src/extensions/erc721/read/getNFT.test.ts +2 -2
  101. package/src/extensions/prebuilts/get-required-transactions.ts +5 -5
  102. package/src/react/native/ui/prebuilt/Account/balance.tsx +1 -1
  103. package/src/react/native/ui/prebuilt/Wallet/name.tsx +1 -1
  104. package/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx +2 -2
  105. package/src/react/web/ui/prebuilt/Account/balance.tsx +1 -1
  106. package/src/react/web/ui/prebuilt/Chain/name.tsx +1 -1
  107. package/src/react/web/ui/prebuilt/NFT/utils.ts +1 -0
  108. package/src/react/web/ui/prebuilt/Token/name.tsx +1 -1
  109. package/src/react/web/ui/prebuilt/Token/symbol.tsx +1 -1
  110. package/src/react/web/ui/prebuilt/Wallet/name.tsx +1 -1
  111. package/src/react/web/wallets/in-app/InAppWalletConnectUI.tsx +1 -1
  112. package/src/storage/upload/mobile.ts +1 -1
  113. package/src/utils/domain.test.ts +1 -0
  114. package/src/utils/domains.ts +9 -0
  115. package/src/utils/fetch.ts +11 -3
  116. package/src/version.ts +1 -1
  117. package/src/wallets/engine/index.ts +1 -0
  118. package/src/wallets/smart/lib/calls.ts +13 -6
  119. package/src/wallets/smart/lib/paymaster.ts +2 -2
@@ -178,7 +178,7 @@ async function getTransactionsForMaketplaceV3(options: {
178
178
  client: ThirdwebClient;
179
179
  }): Promise<DeployTransactionResult[]> {
180
180
  const { chain, client } = options;
181
- const WETHAdress = await computePublishedContractAddress({
181
+ const WETHAddress = await computePublishedContractAddress({
182
182
  chain,
183
183
  client,
184
184
  contractId: "WETH9",
@@ -195,7 +195,7 @@ async function getTransactionsForMaketplaceV3(options: {
195
195
  chain,
196
196
  client,
197
197
  contractId: "DirectListingsLogic",
198
- constructorParams: { _nativeTokenWrapper: WETHAdress },
198
+ constructorParams: { _nativeTokenWrapper: WETHAddress },
199
199
  }).then((c) =>
200
200
  c
201
201
  ? null
@@ -205,7 +205,7 @@ async function getTransactionsForMaketplaceV3(options: {
205
205
  chain,
206
206
  client,
207
207
  contractId: "EnglishAuctionsLogic",
208
- constructorParams: { _nativeTokenWrapper: WETHAdress },
208
+ constructorParams: { _nativeTokenWrapper: WETHAddress },
209
209
  }).then((c) =>
210
210
  c
211
211
  ? null
@@ -233,7 +233,7 @@ async function getTransactionsForDynamicContract(options: {
233
233
  deployMetadata: FetchDeployMetadataResult;
234
234
  }): Promise<DeployTransactionResult[]> {
235
235
  const { chain, client } = options;
236
- const WETHAdress = await computePublishedContractAddress({
236
+ const WETHAddress = await computePublishedContractAddress({
237
237
  chain,
238
238
  client,
239
239
  contractId: "WETH9",
@@ -255,7 +255,7 @@ async function getTransactionsForDynamicContract(options: {
255
255
  contractId: e.extensionName,
256
256
  publisher: e.publisherAddress,
257
257
  version: e.extensionVersion || "latest",
258
- constructorParams: { _nativeTokenWrapper: WETHAdress },
258
+ constructorParams: { _nativeTokenWrapper: WETHAddress },
259
259
  }).then((c) =>
260
260
  c
261
261
  ? null
@@ -55,7 +55,7 @@ export interface AccountBalanceProps extends Omit<TextProps, "children"> {
55
55
  * If not passed, the component will return `null`.
56
56
  *
57
57
  * You can/should pass a descriptive text/component to this prop, indicating that the
58
- * balance was not fetched succesfully
58
+ * balance was not fetched successfully
59
59
  * @example
60
60
  * ```tsx
61
61
  * <AccountBalance
@@ -25,7 +25,7 @@ export interface WalletNameProps extends Omit<TextProps, "children"> {
25
25
  * If not passed, the component will return `null`.
26
26
  *
27
27
  * You can/should pass a descriptive text/component to this prop, indicating that the
28
- * name was not fetched succesfully
28
+ * name was not fetched successfully
29
29
  * @example
30
30
  * ```tsx
31
31
  * <WalletName fallbackComponent={<span>Failed to load</span>}
@@ -271,8 +271,8 @@ function BuyScreenContent(props: BuyScreenContentProps) {
271
271
  <WalletSwitcherConnectionScreen
272
272
  accountAbstraction={props.connectOptions?.accountAbstraction}
273
273
  appMetadata={props.connectOptions?.appMetadata}
274
- chain={props.connectOptions?.chain}
275
- chains={props.connectOptions?.chains}
274
+ chain={toChain || props.connectOptions?.chain}
275
+ chains={[toChain, ...(props.connectOptions?.chains || [])]}
276
276
  client={props.client}
277
277
  connectLocale={props.connectLocale}
278
278
  isEmbed={props.isEmbed}
@@ -57,7 +57,7 @@ export interface AccountBalanceProps
57
57
  * If not passed, the component will return `null`.
58
58
  *
59
59
  * You can/should pass a descriptive text/component to this prop, indicating that the
60
- * balance was not fetched succesfully
60
+ * balance was not fetched successfully
61
61
  * @example
62
62
  * ```tsx
63
63
  * <AccountBalance
@@ -45,7 +45,7 @@ export interface ChainNameProps
45
45
  * If not passed, the component will return `null`.
46
46
  *
47
47
  * You can/should pass a descriptive text/component to this prop, indicating that the
48
- * name was not fetched succesfully
48
+ * name was not fetched successfully
49
49
  * @example
50
50
  * ```tsx
51
51
  * <ChainName fallbackComponent={<span>Failed to load</span>}
@@ -17,6 +17,7 @@ export async function getNFTInfo(options: NFTProviderProps): Promise<NFT> {
17
17
  }),
18
18
  getNFT1155({
19
19
  ...options,
20
+ useIndexer: false, // TODO (insight): switch this call to only call insight once
20
21
  }),
21
22
  ]).then(([possibleNFT721, possibleNFT1155]) => {
22
23
  // getNFT extension always return an NFT object
@@ -50,7 +50,7 @@ export interface TokenNameProps
50
50
  * If not passed, the component will return `null`.
51
51
  *
52
52
  * You can/should pass a descriptive text/component to this prop, indicating that the
53
- * name was not fetched succesfully
53
+ * name was not fetched successfully
54
54
  * @example
55
55
  * ```tsx
56
56
  * <TokenName fallbackComponent={"Failed to load"}
@@ -50,7 +50,7 @@ export interface TokenSymbolProps
50
50
  * If not passed, the component will return `null`.
51
51
  *
52
52
  * You can/should pass a descriptive text/component to this prop, indicating that the
53
- * symbol was not fetched succesfully
53
+ * symbol was not fetched successfully
54
54
  * @example
55
55
  * ```tsx
56
56
  * <TokenSymbol fallbackComponent={"Failed to load"}
@@ -27,7 +27,7 @@ export interface WalletNameProps
27
27
  * If not passed, the component will return `null`.
28
28
  *
29
29
  * You can/should pass a descriptive text/component to this prop, indicating that the
30
- * name was not fetched succesfully
30
+ * name was not fetched successfully
31
31
  * @example
32
32
  * ```tsx
33
33
  * <WalletName fallbackComponent={<span>Failed to load</span>}
@@ -51,7 +51,7 @@ function InAppWalletConnectUI(props: {
51
51
  return <LoadingScreen />;
52
52
  }
53
53
 
54
- // if the the modal starts out with the wallet's connect ui instead of wallet selector - going back to main screen requires staying on the same component and clearing the selection data
54
+ // if the modal starts out with the wallet's connect ui instead of wallet selector - going back to main screen requires staying on the same component and clearing the selection data
55
55
  // otherwise, we go back to the wallet selector by calling props.goBack
56
56
  const goBackToMain = () => {
57
57
  if (initialScreen === props.wallet) {
@@ -104,7 +104,7 @@ export async function uploadBatchMobile(
104
104
  );
105
105
  }
106
106
 
107
- return reject(new Error("Unknown upload error occured"));
107
+ return reject(new Error("Unknown upload error occurred"));
108
108
  });
109
109
 
110
110
  xhr.open("POST", `https://${getThirdwebDomains().storage}/ipfs/upload`);
@@ -16,6 +16,7 @@ describe("Thirdweb Domains", () => {
16
16
  bundler: "bundler.thirdweb.com",
17
17
  analytics: "c.thirdweb.com",
18
18
  insight: "insight.thirdweb.com",
19
+ engineCloud: "engine.thirdweb.com",
19
20
  };
20
21
 
21
22
  beforeEach(() => {
@@ -39,6 +39,11 @@ type DomainOverrides = {
39
39
  * @default "insight.thirdweb.com"
40
40
  */
41
41
  insight?: string;
42
+ /**
43
+ * The base URL for the engine cloud server.
44
+ * @default "engine.thirdweb.com"
45
+ */
46
+ engineCloud?: string;
42
47
  };
43
48
 
44
49
  export const DEFAULT_RPC_URL = "rpc.thirdweb.com";
@@ -49,6 +54,8 @@ const DEFAULT_STORAGE_URL = "storage.thirdweb.com";
49
54
  const DEFAULT_BUNDLER_URL = "bundler.thirdweb.com";
50
55
  const DEFAULT_ANALYTICS_URL = "c.thirdweb.com";
51
56
  const DEFAULT_INSIGHT_URL = "insight.thirdweb.com";
57
+ const DEFAULT_ENGINE_CLOUD_URL = "engine.thirdweb.com";
58
+
52
59
  let domains: { [k in keyof DomainOverrides]-?: string } = {
53
60
  rpc: DEFAULT_RPC_URL,
54
61
  inAppWallet: DEFAULT_IN_APP_WALLET_URL,
@@ -58,6 +65,7 @@ let domains: { [k in keyof DomainOverrides]-?: string } = {
58
65
  bundler: DEFAULT_BUNDLER_URL,
59
66
  analytics: DEFAULT_ANALYTICS_URL,
60
67
  insight: DEFAULT_INSIGHT_URL,
68
+ engineCloud: DEFAULT_ENGINE_CLOUD_URL,
61
69
  };
62
70
 
63
71
  export const setThirdwebDomains = (DomainOverrides: DomainOverrides) => {
@@ -70,6 +78,7 @@ export const setThirdwebDomains = (DomainOverrides: DomainOverrides) => {
70
78
  bundler: DomainOverrides.bundler ?? DEFAULT_BUNDLER_URL,
71
79
  analytics: DomainOverrides.analytics ?? DEFAULT_ANALYTICS_URL,
72
80
  insight: DomainOverrides.insight ?? DEFAULT_INSIGHT_URL,
81
+ engineCloud: DomainOverrides.engineCloud ?? DEFAULT_ENGINE_CLOUD_URL,
73
82
  };
74
83
  };
75
84
 
@@ -27,7 +27,11 @@ export function getClientFetch(client: ThirdwebClient, ecosystem?: Ecosystem) {
27
27
  const { requestTimeoutMs = DEFAULT_REQUEST_TIMEOUT, ...restInit } =
28
28
  init || {};
29
29
 
30
- let headers = restInit.headers ? new Headers(restInit.headers) : undefined;
30
+ let headers = restInit.headers
31
+ ? new Headers(restInit.headers)
32
+ : typeof url === "object"
33
+ ? url.headers
34
+ : undefined;
31
35
  const urlString = typeof url === "string" ? url : url.url;
32
36
 
33
37
  // check if we are making a request to a thirdweb service (we don't want to send any headers to non-thirdweb services)
@@ -60,9 +64,13 @@ export function getClientFetch(client: ThirdwebClient, ecosystem?: Ecosystem) {
60
64
  if (client.teamId) {
61
65
  headers.set("x-team-id", client.teamId);
62
66
  }
63
- } else if (secretKey) {
67
+ }
68
+
69
+ if (secretKey) {
64
70
  headers.set("x-secret-key", secretKey);
65
- } else if (clientId) {
71
+ }
72
+
73
+ if (clientId) {
66
74
  headers.set("x-client-id", clientId);
67
75
  }
68
76
 
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = "5.97.1";
1
+ export const version = "5.97.3";
@@ -42,6 +42,7 @@ export type EngineAccountOptions = {
42
42
 
43
43
  /**
44
44
  * Creates an account that uses your engine backend wallet for sending transactions and signing messages.
45
+ * @deprecated This for v2 dedicated engine instances, for v3 and engine cloud use Engine.serverWallet()
45
46
  *
46
47
  * @param options - The options for the engine account.
47
48
  * @returns An account that uses your engine backend wallet.
@@ -181,14 +181,15 @@ export function prepareExecute(args: {
181
181
  if (execute) {
182
182
  return execute(accountContract, transaction);
183
183
  }
184
+ let value = transaction.value || 0n;
185
+ // special handling of hedera chains, decimals for native value is 8 instead of 18 when passed as contract params
186
+ if (transaction.chainId === 295 || transaction.chainId === 296) {
187
+ value = BigInt(value) / BigInt(10 ** 10);
188
+ }
184
189
  return prepareContractCall({
185
190
  contract: accountContract,
186
191
  method: "function execute(address, uint256, bytes)",
187
- params: [
188
- transaction.to || "",
189
- transaction.value || 0n,
190
- transaction.data || "0x",
191
- ],
192
+ params: [transaction.to || "", value, transaction.data || "0x"],
192
193
  // if gas is specified for the inner tx, use that and add 21k for the execute call on the account contract
193
194
  // this avoids another estimateGas call when bundling the userOp
194
195
  // and also allows for passing custom gas limits for the inner tx
@@ -215,12 +216,18 @@ export function prepareBatchExecute(args: {
215
216
  if (executeBatch) {
216
217
  return executeBatch(accountContract, transactions);
217
218
  }
219
+ let values = transactions.map((tx) => tx.value || 0n);
220
+ const chainId = transactions[0]?.chainId;
221
+ // special handling of hedera chains, decimals for native value is 8 instead of 18 when passed as contract params
222
+ if (chainId === 295 || chainId === 296) {
223
+ values = values.map((value) => BigInt(value) / BigInt(10 ** 10));
224
+ }
218
225
  return prepareContractCall({
219
226
  contract: accountContract,
220
227
  method: "function executeBatch(address[], uint256[], bytes[])",
221
228
  params: [
222
229
  transactions.map((tx) => tx.to || ""),
223
- transactions.map((tx) => tx.value || 0n),
230
+ values,
224
231
  transactions.map((tx) => tx.data || "0x"),
225
232
  ],
226
233
  });
@@ -82,9 +82,9 @@ export async function getPaymasterAndData(args: {
82
82
  };
83
83
  }
84
84
  // check for policy errors
85
- if (res.result.policyId && res.result.reason) {
85
+ if (res.result.reason) {
86
86
  console.warn(
87
- `Paymaster policy rejected this transaction with reason: ${res.result.reason} (policyId: ${res.result.policyId})`,
87
+ `Paymaster policy rejected this transaction with reason: ${res.result.reason} ${res.result.policyId ? `(policyId: ${res.result.policyId})` : ""}`,
88
88
  );
89
89
  }
90
90