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.
- package/dist/cjs/contract/verification/constructor-params.js +1 -1
- package/dist/cjs/contract/verification/constructor-params.js.map +1 -1
- package/dist/cjs/engine/get-status.js +110 -0
- package/dist/cjs/engine/get-status.js.map +1 -0
- package/dist/cjs/engine/index.js +9 -0
- package/dist/cjs/engine/index.js.map +1 -0
- package/dist/cjs/engine/server-wallet.js +214 -0
- package/dist/cjs/engine/server-wallet.js.map +1 -0
- package/dist/cjs/exports/engine.js +5 -0
- package/dist/cjs/exports/engine.js.map +1 -0
- package/dist/cjs/exports/thirdweb.js +6 -2
- package/dist/cjs/exports/thirdweb.js.map +1 -1
- package/dist/cjs/extensions/prebuilts/get-required-transactions.js +5 -5
- package/dist/cjs/extensions/prebuilts/get-required-transactions.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/prebuilt/NFT/utils.js +1 -0
- package/dist/cjs/react/web/ui/prebuilt/NFT/utils.js.map +1 -1
- package/dist/cjs/react/web/wallets/in-app/InAppWalletConnectUI.js +1 -1
- package/dist/cjs/react/web/wallets/in-app/InAppWalletConnectUI.js.map +1 -1
- package/dist/cjs/storage/upload/mobile.js +1 -1
- package/dist/cjs/storage/upload/mobile.js.map +1 -1
- package/dist/cjs/utils/domains.js +3 -0
- package/dist/cjs/utils/domains.js.map +1 -1
- package/dist/cjs/utils/fetch.js +7 -3
- package/dist/cjs/utils/fetch.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/wallets/engine/index.js +1 -0
- package/dist/cjs/wallets/engine/index.js.map +1 -1
- package/dist/cjs/wallets/smart/lib/calls.js +13 -6
- package/dist/cjs/wallets/smart/lib/calls.js.map +1 -1
- package/dist/cjs/wallets/smart/lib/paymaster.js +2 -2
- package/dist/cjs/wallets/smart/lib/paymaster.js.map +1 -1
- package/dist/esm/contract/verification/constructor-params.js +1 -1
- package/dist/esm/contract/verification/constructor-params.js.map +1 -1
- package/dist/esm/engine/get-status.js +106 -0
- package/dist/esm/engine/get-status.js.map +1 -0
- package/dist/esm/engine/index.js +3 -0
- package/dist/esm/engine/index.js.map +1 -0
- package/dist/esm/engine/server-wallet.js +211 -0
- package/dist/esm/engine/server-wallet.js.map +1 -0
- package/dist/esm/exports/engine.js +2 -0
- package/dist/esm/exports/engine.js.map +1 -0
- package/dist/esm/exports/thirdweb.js +4 -0
- package/dist/esm/exports/thirdweb.js.map +1 -1
- package/dist/esm/extensions/prebuilts/get-required-transactions.js +5 -5
- package/dist/esm/extensions/prebuilts/get-required-transactions.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js.map +1 -1
- package/dist/esm/react/web/ui/prebuilt/NFT/utils.js +1 -0
- package/dist/esm/react/web/ui/prebuilt/NFT/utils.js.map +1 -1
- package/dist/esm/react/web/wallets/in-app/InAppWalletConnectUI.js +1 -1
- package/dist/esm/react/web/wallets/in-app/InAppWalletConnectUI.js.map +1 -1
- package/dist/esm/storage/upload/mobile.js +1 -1
- package/dist/esm/storage/upload/mobile.js.map +1 -1
- package/dist/esm/utils/domains.js +3 -0
- package/dist/esm/utils/domains.js.map +1 -1
- package/dist/esm/utils/fetch.js +7 -3
- package/dist/esm/utils/fetch.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/wallets/engine/index.js +1 -0
- package/dist/esm/wallets/engine/index.js.map +1 -1
- package/dist/esm/wallets/smart/lib/calls.js +13 -6
- package/dist/esm/wallets/smart/lib/calls.js.map +1 -1
- package/dist/esm/wallets/smart/lib/paymaster.js +2 -2
- package/dist/esm/wallets/smart/lib/paymaster.js.map +1 -1
- package/dist/types/engine/get-status.d.ts +81 -0
- package/dist/types/engine/get-status.d.ts.map +1 -0
- package/dist/types/engine/index.d.ts +3 -0
- package/dist/types/engine/index.d.ts.map +1 -0
- package/dist/types/engine/server-wallet.d.ts +95 -0
- package/dist/types/engine/server-wallet.d.ts.map +1 -0
- package/dist/types/exports/engine.d.ts +2 -0
- package/dist/types/exports/engine.d.ts.map +1 -0
- package/dist/types/exports/thirdweb.d.ts +4 -0
- package/dist/types/exports/thirdweb.d.ts.map +1 -1
- package/dist/types/react/native/ui/prebuilt/Account/balance.d.ts +1 -1
- package/dist/types/react/native/ui/prebuilt/Wallet/name.d.ts +1 -1
- package/dist/types/react/web/ui/prebuilt/Account/balance.d.ts +1 -1
- package/dist/types/react/web/ui/prebuilt/Chain/name.d.ts +1 -1
- package/dist/types/react/web/ui/prebuilt/NFT/utils.d.ts.map +1 -1
- package/dist/types/react/web/ui/prebuilt/Token/name.d.ts +1 -1
- package/dist/types/react/web/ui/prebuilt/Token/symbol.d.ts +1 -1
- package/dist/types/react/web/ui/prebuilt/Wallet/name.d.ts +1 -1
- package/dist/types/utils/domains.d.ts +6 -0
- package/dist/types/utils/domains.d.ts.map +1 -1
- package/dist/types/utils/fetch.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/types/wallets/engine/index.d.ts +1 -0
- package/dist/types/wallets/engine/index.d.ts.map +1 -1
- package/dist/types/wallets/smart/lib/calls.d.ts.map +1 -1
- package/package.json +7 -1
- package/src/contract/verification/constructor-params.ts +1 -1
- package/src/engine/get-status.ts +180 -0
- package/src/engine/index.ts +11 -0
- package/src/engine/server-wallet.test.ts +196 -0
- package/src/engine/server-wallet.ts +284 -0
- package/src/exports/engine.ts +1 -0
- package/src/exports/thirdweb.ts +5 -0
- package/src/extensions/erc721/read/getNFT.test.ts +2 -2
- package/src/extensions/prebuilts/get-required-transactions.ts +5 -5
- package/src/react/native/ui/prebuilt/Account/balance.tsx +1 -1
- package/src/react/native/ui/prebuilt/Wallet/name.tsx +1 -1
- package/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx +2 -2
- package/src/react/web/ui/prebuilt/Account/balance.tsx +1 -1
- package/src/react/web/ui/prebuilt/Chain/name.tsx +1 -1
- package/src/react/web/ui/prebuilt/NFT/utils.ts +1 -0
- package/src/react/web/ui/prebuilt/Token/name.tsx +1 -1
- package/src/react/web/ui/prebuilt/Token/symbol.tsx +1 -1
- package/src/react/web/ui/prebuilt/Wallet/name.tsx +1 -1
- package/src/react/web/wallets/in-app/InAppWalletConnectUI.tsx +1 -1
- package/src/storage/upload/mobile.ts +1 -1
- package/src/utils/domain.test.ts +1 -0
- package/src/utils/domains.ts +9 -0
- package/src/utils/fetch.ts +11 -3
- package/src/version.ts +1 -1
- package/src/wallets/engine/index.ts +1 -0
- package/src/wallets/smart/lib/calls.ts +13 -6
- 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
|
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:
|
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:
|
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
|
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:
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
107
|
+
return reject(new Error("Unknown upload error occurred"));
|
108
108
|
});
|
109
109
|
|
110
110
|
xhr.open("POST", `https://${getThirdwebDomains().storage}/ipfs/upload`);
|
package/src/utils/domain.test.ts
CHANGED
package/src/utils/domains.ts
CHANGED
@@ -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
|
|
package/src/utils/fetch.ts
CHANGED
@@ -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
|
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
|
-
}
|
67
|
+
}
|
68
|
+
|
69
|
+
if (secretKey) {
|
64
70
|
headers.set("x-secret-key", secretKey);
|
65
|
-
}
|
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
|
+
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
|
-
|
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.
|
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
|
|