Skip to content

Commit

Permalink
import HEAD
Browse files Browse the repository at this point in the history
  • Loading branch information
bangtoven committed Sep 17, 2024
1 parent 35ee03e commit d45b0a8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/playground/src/components/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export function Layout({ children }: LayoutProps) {
))}
</MenuList>
</Menu>
{sdkVersion === '4.0.4' && (
{(sdkVersion === 'HEAD' || sdkVersion === '4.0.4') && (
<>
<Menu>
<MenuButton as={Button} rightIcon={<ChevronDownIcon />}>
Expand Down
10 changes: 6 additions & 4 deletions packages/playground/src/context/CBWSDKReactContextProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { CoinbaseWalletSDK as CoinbaseWalletSDKHEAD } from '@coinbase/wallet-sdk';
import { CoinbaseWalletSDK as CoinbaseWalletSDK372 } from '@coinbase/wallet-sdk-3.7.2';
import { CoinbaseWalletSDK as CoinbaseWalletSDK393 } from '@coinbase/wallet-sdk-3.9.3';
import { CoinbaseWalletSDK as CoinbaseWalletSDK404 } from '@coinbase/wallet-sdk-4.0.4';
Expand All @@ -10,7 +11,7 @@ type CBWSDKProviderProps = {
const CBWSDKReactContext = React.createContext(null);

const SELECTED_SDK_KEY = 'selected_sdk_version';
export const sdkVersions = ['4.0.4', '3.9.3', '3.7.2'] as const;
export const sdkVersions = ['HEAD', '4.0.4', '3.9.3', '3.7.2'] as const;
export type SDKVersionType = (typeof sdkVersions)[number];

const SELECTED_SCW_URL_KEY = 'scw_url';
Expand Down Expand Up @@ -73,8 +74,9 @@ export function CBWSDKReactContextProvider({ children }: CBWSDKProviderProps) {
useEffect(() => {
let cbwsdk;
let preference;
if (version === '4.0.4') {
cbwsdk = new CoinbaseWalletSDK404({
if (version === 'HEAD' || version === '4.0.4') {
const SDK = version === 'HEAD' ? CoinbaseWalletSDKHEAD : CoinbaseWalletSDK404;
cbwsdk = new SDK({
appName: 'SDK Playground',
appChainIds: [84532, 8452],
});
Expand All @@ -99,7 +101,7 @@ export function CBWSDKReactContextProvider({ children }: CBWSDKProviderProps) {
}, [version, option]);

useEffect(() => {
if (version === '4.0.4') {
if (version === 'HEAD' || version === '4.0.4') {
if (scwUrl) window.setPopupUrl?.(scwUrl);
}
}, [version, scwUrl, sdk]);
Expand Down

0 comments on commit d45b0a8

Please sign in to comment.