+ {isNftLoading ? (
+
Loading...
+ ) : (
+ <>
+
+
+
+ {nft ? (
+
+ ) : null}
+ {activeEOA ? (
+
+
+ You own {ownedNfts?.[0]?.quantityOwned.toString() || "0"}{" "}
+ {nft?.metadata?.name}
+
+
+
+ ) : null}
+ {txIds.length > 0 && (
+
+
+
+
+
+ Tx ID
+ Status
+ TX Hash
+
+
+
+ {txIds.map((txId) => (
+
+ ))}
+
+
+
+
+ )}
+ >
+ )}
+
+ );
+}
diff --git a/packages/thirdweb/src/wallets/in-app/web/lib/in-app-gateway.test.ts b/packages/thirdweb/src/wallets/in-app/web/lib/in-app-gateway.test.ts
index e48111df520..3152530d770 100644
--- a/packages/thirdweb/src/wallets/in-app/web/lib/in-app-gateway.test.ts
+++ b/packages/thirdweb/src/wallets/in-app/web/lib/in-app-gateway.test.ts
@@ -1,126 +1,110 @@
-import { sendTransaction, signMessage } from "@thirdweb-dev/engine";
+import {
+ configure,
+ isSuccessResponse,
+ sendTransaction,
+ signMessage,
+} from "@thirdweb-dev/engine";
import { beforeAll, describe, expect, it } from "vitest";
import { TEST_CLIENT } from "~test/test-clients.js";
import { sepolia } from "../../../../chains/chain-definitions/sepolia.js";
-import { createThirdwebClient } from "../../../../client/client.js";
import { waitForTransactionHash } from "../../../../engine/wait-for-tx-hash.js";
-import {
- getThirdwebBaseUrl,
- setThirdwebDomains,
-} from "../../../../utils/domains.js";
-import { getClientFetch } from "../../../../utils/fetch.js";
import { stringify } from "../../../../utils/json.js";
import type { Account } from "../../../interfaces/wallet.js";
import { inAppWallet } from "../in-app.js";
-// TODO: productionize this test
-describe
- .runIf(process.env.TW_SECRET_KEY)
- .skip("InAppWallet Gateway Tests", () => {
- let account: Account;
- let authToken: string | null | undefined;
- const clientIdFetch = getClientFetch(
- createThirdwebClient({
- clientId: TEST_CLIENT.clientId,
- }),
- );
+describe.runIf(process.env.TW_SECRET_KEY)("InAppWallet Gateway Tests", () => {
+ let account: Account;
+ let authToken: string | null | undefined;
- beforeAll(async () => {
- setThirdwebDomains({
- bundler: "bundler.thirdweb-dev.com",
- engineCloud: "engine.thirdweb-dev.com",
- inAppWallet: "embedded-wallet.thirdweb-dev.com",
- rpc: "rpc.thirdweb-dev.com",
- });
- const wallet = inAppWallet();
- account = await wallet.connect({
- client: TEST_CLIENT,
- strategy: "backend",
- walletSecret: "test-secret",
- });
- authToken = wallet.getAuthToken?.();
- expect(authToken).toBeDefined();
+ beforeAll(async () => {
+ configure({
+ clientId: TEST_CLIENT.clientId,
+ secretKey: TEST_CLIENT.secretKey,
});
+ const wallet = inAppWallet();
+ account = await wallet.connect({
+ client: TEST_CLIENT,
+ strategy: "backend",
+ walletSecret: "test-secret",
+ });
+ authToken = wallet.getAuthToken?.();
+ expect(authToken).toBeDefined();
+ });
- it("should sign a message with backend strategy", async () => {
- const rawSignature = await account.signMessage({
- message: "Hello, world!",
- });
-
- // sign via api
- const signResult = await signMessage({
- baseUrl: getThirdwebBaseUrl("engineCloud"),
- body: {
- params: [
- {
- format: "text",
- message: "Hello, world!",
- },
- ],
- signingOptions: {
- from: account.address,
- type: "eoa",
- },
- },
- bodySerializer: stringify,
- fetch: clientIdFetch,
- headers: {
- "x-wallet-access-token": authToken,
- },
- });
-
- const signatureResult = signResult.data?.result?.results[0];
- if (signatureResult && "result" in signatureResult) {
- expect(signatureResult.result.signature).toEqual(rawSignature);
- } else {
- throw new Error(
- `Failed to sign message: ${stringify(signatureResult?.error) || "Unknown error"}`,
- );
- }
+ it("should sign a message with backend strategy", async () => {
+ const rawSignature = await account.signMessage({
+ message: "Hello, world!",
});
- it("should queue a 4337 transaction", async () => {
- const body = {
- executionOptions: {
- chainId: sepolia.id,
- from: account.address,
- type: "auto" as const,
- },
+ // sign via api
+ const signResult = await signMessage({
+ body: {
params: [
{
- data: "0x",
- to: account.address,
- value: "0",
+ format: "text",
+ message: "Hello, world!",
},
],
- };
- const result = await sendTransaction({
- baseUrl: getThirdwebBaseUrl("engineCloud"),
- body,
- bodySerializer: stringify,
- fetch: clientIdFetch,
- headers: {
- "x-wallet-access-token": authToken,
+ signingOptions: {
+ from: account.address,
+ type: "eoa",
},
- });
- if (result.error) {
- throw new Error(
- `Error sending transaction: ${stringify(result.error)}`,
- );
- }
+ },
+ headers: {
+ "x-wallet-access-token": authToken,
+ },
+ });
- const txId = result.data?.result.transactions[0]?.id;
- console.log(txId);
- if (!txId) {
- throw new Error("No transaction ID found");
- }
+ if (signResult.error) {
+ throw new Error(`Error signing message: ${stringify(signResult.error)}`);
+ }
- const tx = await waitForTransactionHash({
- client: TEST_CLIENT,
- transactionId: txId,
- });
+ const signatureResult = signResult.data?.result?.[0];
+ if (signatureResult && isSuccessResponse(signatureResult)) {
+ expect(signatureResult.result.signature).toEqual(rawSignature);
+ } else {
+ throw new Error(
+ `Failed to sign message: ${stringify(signatureResult?.error) || "Unknown error"}`,
+ );
+ }
+ });
- console.log(tx);
- expect(tx.transactionHash).toBeDefined();
+ it("should queue a 4337 transaction", async () => {
+ const body = {
+ executionOptions: {
+ chainId: sepolia.id,
+ from: account.address,
+ type: "auto" as const,
+ },
+ params: [
+ {
+ data: "0x",
+ to: account.address,
+ value: "0",
+ },
+ ],
+ };
+ const result = await sendTransaction({
+ body,
+ headers: {
+ "x-wallet-access-token": authToken,
+ },
});
+ if (result.error) {
+ throw new Error(`Error sending transaction: ${stringify(result.error)}`);
+ }
+
+ const txId = result.data?.result.transactions[0]?.id;
+ if (!txId) {
+ throw new Error("No transaction ID found");
+ }
+
+ const tx = await waitForTransactionHash({
+ client: TEST_CLIENT,
+ transactionId: txId,
+ });
+
+ console.log(tx.transactionHash);
+ expect(tx.transactionHash).toBeDefined();
});
+});
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 655afe3b603..51bfe29a2b3 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -639,6 +639,9 @@ importers:
'@tanstack/react-query':
specifier: 5.81.5
version: 5.81.5(react@19.1.0)
+ '@thirdweb-dev/engine':
+ specifier: workspace:*
+ version: link:../../packages/engine
class-variance-authority:
specifier: ^0.7.1
version: 0.7.1
@@ -7416,7 +7419,6 @@ packages:
'@walletconnect/modal@2.7.0':
resolution: {integrity: sha512-RQVt58oJ+rwqnPcIvRFeMGKuXb9qkgSmwz4noF8JZGUym3gUAzVs+uW2NQ1Owm9XOJAV+sANrtJ+VoVq1ftElw==}
- deprecated: Please follow the migration guide on https://docs.reown.com/appkit/upgrade/wcm
'@walletconnect/react-native-compat@2.17.3':
resolution: {integrity: sha512-lHKwXKoB0rdDH1ukxUx7o86xosWbttWIHYMZ8tgAQC1k9VH3CZZCoBcHOAAX8iBzyb0n0UP3/9zRrOcJE5nz7Q==}
@@ -28994,8 +28996,8 @@ snapshots:
'@typescript-eslint/parser': 7.14.1(eslint@8.57.0)(typescript@5.8.3)
eslint: 8.57.0
eslint-import-resolver-node: 0.3.9
- eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import@2.32.0)(eslint@8.57.0)
- eslint-plugin-import: 2.32.0(@typescript-eslint/parser@7.14.1(eslint@8.57.0)(typescript@5.8.3))(eslint-import-resolver-typescript@3.10.1)(eslint@8.57.0)
+ eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@7.14.1(eslint@8.57.0)(typescript@5.8.3))(eslint@8.57.0))(eslint@8.57.0)
+ eslint-plugin-import: 2.32.0(@typescript-eslint/parser@7.14.1(eslint@8.57.0)(typescript@5.8.3))(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@7.14.1(eslint@8.57.0)(typescript@5.8.3))(eslint@8.57.0))(eslint@8.57.0))(eslint@8.57.0)
eslint-plugin-jsx-a11y: 6.10.2(eslint@8.57.0)
eslint-plugin-react: 7.37.5(eslint@8.57.0)
eslint-plugin-react-hooks: 5.2.0(eslint@8.57.0)
@@ -29014,7 +29016,7 @@ snapshots:
transitivePeerDependencies:
- supports-color
- eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0)(eslint@8.57.0):
+ eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@7.14.1(eslint@8.57.0)(typescript@5.8.3))(eslint@8.57.0))(eslint@8.57.0):
dependencies:
'@nolyfill/is-core-module': 1.0.39
debug: 4.4.1(supports-color@8.1.1)
@@ -29025,7 +29027,7 @@ snapshots:
tinyglobby: 0.2.14
unrs-resolver: 1.10.1
optionalDependencies:
- eslint-plugin-import: 2.32.0(@typescript-eslint/parser@7.14.1(eslint@8.57.0)(typescript@5.8.3))(eslint-import-resolver-typescript@3.10.1)(eslint@8.57.0)
+ eslint-plugin-import: 2.32.0(@typescript-eslint/parser@7.14.1(eslint@8.57.0)(typescript@5.8.3))(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@7.14.1(eslint@8.57.0)(typescript@5.8.3))(eslint@8.57.0))(eslint@8.57.0))(eslint@8.57.0)
transitivePeerDependencies:
- supports-color
@@ -29050,18 +29052,18 @@ snapshots:
- bluebird
- supports-color
- eslint-module-utils@2.12.1(@typescript-eslint/parser@7.14.1(eslint@8.57.0)(typescript@5.8.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0)(eslint@8.57.0))(eslint@8.57.0):
+ eslint-module-utils@2.12.1(@typescript-eslint/parser@7.14.1(eslint@8.57.0)(typescript@5.8.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@7.14.1(eslint@8.57.0)(typescript@5.8.3))(eslint@8.57.0))(eslint@8.57.0))(eslint@8.57.0):
dependencies:
debug: 3.2.7
optionalDependencies:
'@typescript-eslint/parser': 7.14.1(eslint@8.57.0)(typescript@5.8.3)
eslint: 8.57.0
eslint-import-resolver-node: 0.3.9
- eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import@2.32.0)(eslint@8.57.0)
+ eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@7.14.1(eslint@8.57.0)(typescript@5.8.3))(eslint@8.57.0))(eslint@8.57.0)
transitivePeerDependencies:
- supports-color
- eslint-plugin-import@2.32.0(@typescript-eslint/parser@7.14.1(eslint@8.57.0)(typescript@5.8.3))(eslint-import-resolver-typescript@3.10.1)(eslint@8.57.0):
+ eslint-plugin-import@2.32.0(@typescript-eslint/parser@7.14.1(eslint@8.57.0)(typescript@5.8.3))(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@7.14.1(eslint@8.57.0)(typescript@5.8.3))(eslint@8.57.0))(eslint@8.57.0))(eslint@8.57.0):
dependencies:
'@rtsao/scc': 1.1.0
array-includes: 3.1.9
@@ -29072,7 +29074,7 @@ snapshots:
doctrine: 2.1.0
eslint: 8.57.0
eslint-import-resolver-node: 0.3.9
- eslint-module-utils: 2.12.1(@typescript-eslint/parser@7.14.1(eslint@8.57.0)(typescript@5.8.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0)(eslint@8.57.0))(eslint@8.57.0)
+ eslint-module-utils: 2.12.1(@typescript-eslint/parser@7.14.1(eslint@8.57.0)(typescript@5.8.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@7.14.1(eslint@8.57.0)(typescript@5.8.3))(eslint@8.57.0))(eslint@8.57.0))(eslint@8.57.0)
hasown: 2.0.2
is-core-module: 2.16.1
is-glob: 4.0.3