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 7ecdea9 commit 380bbd2
Show file tree
Hide file tree
Showing 6 changed files with 7,949 additions and 11 deletions.
9 changes: 3 additions & 6 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,22 @@ concurrency:
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./packages/playground
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: "18"
cache-dependency-path: 'yarn.lock'
cache: yarn
- name: Setup Pages
uses: actions/configure-pages@v3
with:
static_site_generator: next
- name: Install dependencies
run: yarn install --immutable
run: yarn install
- name: Build and export with Next.js
run: yarn export
run: yarn deploy
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
Expand Down
28 changes: 28 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "coinbase-wallet-sdk",
"version": "0.0.1",
"repository": "https://github.com/coinbase/coinbase-wallet-sdk",
"author": "Coinbase, Inc.",
"license": "MIT",
"private": true,
"workspaces": [
"packages/*"
],
"scripts": {
"lint": "yarn workspaces run lint",
"typecheck": "yarn workspaces run typecheck",
"dev": "yarn workspaces run dev",
"deploy": "yarn workspace @coinbase/wallet-sdk build && yarn workspace sdk-playground export"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^6.2.0",
"@typescript-eslint/parser": "^6.2.0",
"eslint": "^8.45.0",
"eslint-config-preact": "^1.3.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-simple-import-sort": "^10.0.0",
"eslint-plugin-unused-imports": "^3.0.0",
"prettier": "^3.0.0"
}
}
4 changes: 3 additions & 1 deletion packages/playground/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "@coinbase/wallet-sdk-testapp",
"name": "sdk-playground",
"version": "0.0.1",
"scripts": {
"lint": "eslint . --ext .ts,.tsx --fix",
"typecheck": "tsc --noEmit",
Expand All @@ -11,6 +12,7 @@
"dependencies": {
"@chakra-ui/icons": "^2.1.1",
"@chakra-ui/react": "^2.8.0",
"@coinbase/wallet-sdk": "workspace:*",
"@coinbase/wallet-sdk-3.7.2": "npm:@coinbase/[email protected]",
"@coinbase/wallet-sdk-3.9.3": "npm:@coinbase/[email protected]",
"@coinbase/wallet-sdk-4.0.4": "npm:@coinbase/[email protected]",
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
8 changes: 8 additions & 0 deletions packages/playground/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1065,6 +1065,14 @@
preact "^10.16.0"
sha.js "^2.4.11"

"@coinbase/wallet-sdk-HEAD@file:../wallet-sdk":
version "4.0.4"
dependencies:
"@noble/hashes" "^1.4.0"
clsx "^1.2.1"
eventemitter3 "^5.0.1"
preact "^10.16.0"

"@emotion/babel-plugin@^11.12.0":
version "11.12.0"
resolved "https://registry.yarnpkg.com/@emotion/babel-plugin/-/babel-plugin-11.12.0.tgz#7b43debb250c313101b3f885eba634f1d723fcc2"
Expand Down
Loading

0 comments on commit 380bbd2

Please sign in to comment.