Skip to content

Commit

Permalink
Merge branch 'main' into alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
jnsdls authored Jan 11, 2024
2 parents f0535d0 + 43dcc14 commit 9594565
Show file tree
Hide file tree
Showing 37 changed files with 1,206 additions and 46 deletions.
5 changes: 5 additions & 0 deletions .changeset/nervous-guests-sort.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@thirdweb-dev/service-utils": patch
---

fix checkout service name
5 changes: 5 additions & 0 deletions .changeset/rude-candles-stare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@thirdweb-dev/react-native": patch
---

Correctly pass sdkOptions down
5 changes: 5 additions & 0 deletions .changeset/two-geckos-refuse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@thirdweb-dev/react-native": patch
---

Update WalletConnectUI to use new arch
6 changes: 6 additions & 0 deletions .changeset/unlucky-horses-sort.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"eslint-config-thirdweb": patch
"@thirdweb-dev/react": patch
---

Enforce react-hooks/exhaustive-deps lint rule
43 changes: 43 additions & 0 deletions .github/workflows/snippets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# On the Version Packages branch created by github-actions[bot]
# Run `pnpm build`, `pnpm generate-docs` and `pnpm generate-snippets` to generate JSON files in the snippets folder
# Commit the generated JSON files to the Version Packages branch

name: Commit code snippets

on:
push:
branches:
- changeset-release/main

jobs:
typedoc:
if: github.actor == 'github-actions[bot]'
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Install
uses: ./.github/composite-actions/install

- name: build
run: pnpm build

- name: generate-docs
run: pnpm generate-docs

- name: generate-snippets
run: pnpm generate-snippets

- name: Commit changes
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add -A
git commit -m "snippets: update JSON files [skip ci]"
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37 changes: 37 additions & 0 deletions .github/workflows/typedoc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# On the Version Packages branch created by github-actions[bot]
# Run `pnpm typedoc` to generate the JSON files
# Commit the generated JSON files to the Version Packages branch

name: Commit Typedoc JSON files

on:
push:
branches:
- changeset-release/main

jobs:
typedoc:
if: github.actor == 'github-actions[bot]'
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Install
uses: ./.github/composite-actions/install

- name: Typedoc
run: pnpm typedoc

- name: Commit changes
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add -A
git commit -m "typedoc: update JSON files [skip ci]"
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,4 @@ playwright-report/
.env/

# Artifacts
packages/cli/artifacts/

typedoc
packages/cli/artifacts/
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
"e2e": "turbo run e2e",
"build": "turbo run build --filter=./packages/*",
"typedoc": "turbo run typedoc",
"generate-docs": "turbo run generate-docs",
"generate-snippets": "node ./scripts/generate-snippets/index.mjs",
"build:release": "turbo run build --force --filter=./packages/*",
"dev": "turbo run dev --no-cache --parallel --continue",
"fix:repo": "manypkg fix",
Expand Down
3 changes: 3 additions & 0 deletions packages/eslint-config-thirdweb/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,8 @@ module.exports = {
],
},
],

// react
"react-hooks/exhaustive-deps": "error",
},
};
2 changes: 1 addition & 1 deletion packages/react-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"lint": "eslint src/ && bunx publint --strict --level warning",
"fix": "eslint src/ --fix",
"clean": "rm -rf dist/",
"generate-docs": "pnpm generate-docs:evm && pnpm generate-snippets",
"generate-docs": "mkdir -p etc && pnpm generate-docs:evm && pnpm generate-snippets",
"generate-docs:evm": "api-extractor run --local --config ./config/api-extractor-evm.json && api-documenter markdown -i ./temp -o ./docs/evm && rm -rf ./temp-evm && mv ./temp ./temp-evm",
"generate-snippets": "node ./scripts/generate-snippets-evm.mjs && node ./scripts/generate-feature-snippets-evm.mjs",
"build": "tsc && preconstruct build",
Expand Down
1 change: 0 additions & 1 deletion packages/react-core/scripts/typedoc.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@ typedoc({
"**/packages/wallets/**",
"**/packages/chains/**",
],
output: "both", // TODO: change this to 'json' when old portal is fully migrated to new portal
});
1 change: 0 additions & 1 deletion packages/react-native/scripts/typedoc.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@ typedoc({
"**/packages/react-core/**",
"**/packages/chains/**",
],
output: "both", // TODO: change this to 'json' when old portal is fully migrated to new portal
});
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ export function ChooseWallet({
onChooseWallet(emailWallet, data);
}}
walletConfig={emailWallet}
// TEMPORARY BUILD FIX
connect={(options: any) => connect(emailWallet, options)}
connectedWallet={activeWallet}
connectedWalletAddress={address}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ export const ChooseWalletContent = ({
onChooseWallet(item, data);
}}
walletConfig={item}
// TEMPORARY BUILD FIX
connect={(options: any) => connect(item, options)}
connectedWallet={activeWallet}
connectedWalletAddress={address}
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native/src/evm/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export {
type ActionFn,
} from "./components/Web3Button";

export { WalletConnectUI } from "./wallets/wallets/wallet-connect/WalletConnectUI";
export { WalletConnectUI } from "./wallets/wallets/wallet-connect/wallet-connect";

// utilities
export * from "./utils/uri";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ export const ThirdwebProvider = <TChains extends Chain[] = DefaultChains>(
}
createWalletStorage={createWalletStorage}
clientId={clientId}
{...sdkOptions}
sdkOptions={sdkOptions}
{...restProps}
>
<ThemeProvider theme={theme ? theme : "dark"}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ type WCWallet = {
const DEVICE_WIDTH = Dimensions.get("window").width;
const MODAL_HEIGHT = Dimensions.get("window").height * 0.5;

export function WalletConnectUI({
export function WalletConnectInnerUI({
connected,
projectId,
goBack,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
import { WalletConfig, WalletOptions } from "@thirdweb-dev/react-core";
import {
WalletConfig,
WalletOptions,
useAddress,
useConnect,
useConnectionStatus,
useCreateWalletInstance,
useSetConnectedWallet,
useSetConnectionStatus,
useWallet,
} from "@thirdweb-dev/react-core";
import { WalletConnect } from "./WalletConnect";
import { WalletConnectUI } from "./WalletConnectUI";
import { WalletConnectInnerUI } from "./WalletConnectInnerUI";
import { TW_WC_PROJECT_ID } from "../../../constants/walletConnect";
import { walletIds } from "@thirdweb-dev/wallets";

Expand Down Expand Up @@ -39,8 +49,65 @@ export const walletConnect = (
projectId,
}),
connectUI(props) {
return <WalletConnectUI {...props} projectId={projectId} />;
return <WalletConnectInnerUI {...props} projectId={projectId} />;
},
recommended: config?.recommended,
};
};

export type WalletConnectUIProps = {
/**
* temporarily hide the ConnectModal
* This is useful when you want to open another modal and do not want to show the ConnectModal in the background
*/
hide: () => void;

/**
* when the wallet is connected, call this function to indicate that the wallet is connected and it is safe to close the Modal
*/
connected: () => void;

/**
* go back to the wallet selector screen in connect wallet modal
*/
goBack: () => void;

/**
* `WalletConfig` object of the wallet
*/
walletConfig: WalletConfig<WalletConnect>;

/**
* Array of supported wallets including this wallet.
*/
supportedWallets: WalletConfig[];

projectId: string;

isVisible?: boolean;
};

export const WalletConnectUI = (props: WalletConnectUIProps) => {
const connect = useConnect();
const connectionStatus = useConnectionStatus();
const createWalletInstance = useCreateWalletInstance();
const setConnectionStatus = useSetConnectionStatus();
const setConnectedWallet = useSetConnectedWallet();
const connectedWallet = useWallet();
const address = useAddress();

return (
<WalletConnectInnerUI
{...props}
setConnectionStatus={setConnectionStatus}
setConnectedWallet={setConnectedWallet}
projectId={props.projectId}
isVisible={props.isVisible}
connect={(connectProps) => connect(props.walletConfig, connectProps)}
connectionStatus={connectionStatus}
createWalletInstance={() => createWalletInstance(props.walletConfig)}
connectedWallet={connectedWallet as WalletConnect}
connectedWalletAddress={address}
/>
);
};
2 changes: 1 addition & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"lint": "eslint src/ && bunx publint --strict --level warning",
"fix": "eslint src/ --fix",
"clean": "rm -rf dist/",
"generate-docs": "pnpm generate-docs:evm && pnpm generate-snippets",
"generate-docs": "mkdir -p etc && pnpm generate-docs:evm && pnpm generate-snippets",
"generate-docs:evm": "api-extractor run --local --config ./config/api-extractor-evm.json && api-documenter markdown -i ./temp -o ./docs/evm && rm -rf ./temp-evm && mv ./temp ./temp-evm",
"generate-snippets": "node ./scripts/generate-snippets-evm.mjs && node ./scripts/generate-feature-snippets-evm.mjs",
"build": "tsc && preconstruct build",
Expand Down
1 change: 0 additions & 1 deletion packages/react/scripts/typedoc.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,4 @@ typedoc({
"**/packages/react-core/**",
"**/packages/chains/**",
],
output: "both", // TODO: change this to 'json' when old portal is fully migrated to new portal
});
15 changes: 14 additions & 1 deletion packages/react/src/payments/components/CheckoutWithCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,20 @@ export const CheckoutWithCard = ({
options,
configs,
});
}, [CheckoutWithCardIframeContainerRef.current]);
}, [
appNameToUse,
clientId,
configs,
locale,
onBeforeModalOpen,
onCardDetailLoad,
onError,
onPaymentSuccess,
onPriceUpdate,
onReview,
options,
sdkClientSecret,
]);

return (
<>
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/payments/components/PaperCheckout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export const PaperCheckout = <T extends ContractType>({
return () => {
window.removeEventListener("message", handleMessage);
};
}, []);
}, [onCloseCheckout, onPaymentSuccess, onTransferSuccess]);

// Build iframe URL with query params.
const checkoutUrl = new URL(`/checkout/${checkoutId}`, PAPER_APP_URL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export const VerifyOwnershipWithPaper: React.FC<
return () => {
window.removeEventListener("message", handleMessage);
};
}, []);
}, [onError, onSuccess, onWindowClose]);

const url = new URL("/sdk/v1/login-with-paper", PAPER_APP_URL);
url.searchParams.append("chainName", chainNameToUse);
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/payments/components/common/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const Modal: React.FC<{
return () => {
document.removeEventListener("keydown", keyDownHandler);
};
}, []);
}, [escapeToClose, onClose]);

const additionalDialogClasses = isFullScreen ? "" : dialogContainedClasses;
const dialogPanelBg = isFullScreen ? "transparent" : bgColor;
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"lint": "eslint src/",
"fix": "eslint src/ --fix",
"clean": "rm -rf dist/",
"generate-docs": "pnpm generate-docs:evm && pnpm generate-snippets",
"generate-docs": "mkdir -p etc && pnpm generate-docs:evm && pnpm generate-snippets",
"generate-docs:evm": "api-extractor run --local --config ./config/api-extractor-evm.json && api-documenter markdown -i ./temp -o ./docs/evm && rm -rf ./temp-evm && mv ./temp ./temp-evm",
"generate-snippets": "node ./scripts/generate-snippets.mjs && node ./scripts/generate-feature-snippets-evm.mjs",
"build": "tsc && preconstruct build",
Expand Down
1 change: 0 additions & 1 deletion packages/sdk/scripts/typedoc.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ import { typedoc } from "typedoc-gen";
typedoc({
entryPoints: ["src/index.ts"],
exclude: ["**/packages/storage/**", "**/packages/chains/**"],
output: "both", // TODO: change this to 'json' when old portal is fully migrated to new portal
});
2 changes: 1 addition & 1 deletion packages/service-utils/src/core/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const SERVICE_DEFINITIONS = {
// all actions allowed
actions: [],
},
payments: {
checkout: {
name: "checkout",
title: "Checkouts",
description: "Payments for easy web3 onboarding",
Expand Down
1 change: 0 additions & 1 deletion packages/storage/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"format": "prettier --write 'src/**/*'",
"lint": "eslint src/ && bunx publint --strict --level warning",
"fix": "eslint src/ --fix",
"generate-docs": "api-extractor run --local && api-documenter markdown -i ./temp -o ./docs",
"clean": "rm -rf dist/",
"build": "tsc && preconstruct build",
"test:all": "NODE_ENV=test SWC_NODE_PROJECT=./tsconfig.test.json mocha --timeout 30000 --parallel './test/**/*.test.ts'",
Expand Down
1 change: 0 additions & 1 deletion packages/storage/scripts/typedoc.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ import { typedoc } from "typedoc-gen";
typedoc({
entryPoints: ["src/index.ts"],
exclude: [],
output: "both", // TODO: change this to 'json' when old portal is fully migrated to new portal
});
Loading

0 comments on commit 9594565

Please sign in to comment.