Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from coinbase:master #1

Open
wants to merge 28 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
5ff999c
fix noble hash keccak256 usage (#1406)
cb-jake Sep 24, 2024
9c75ba7
v4.1.0 (#1407)
github-actions[bot] Sep 24, 2024
dd37c07
Update testapp to use sdk latest (#1408)
cb-jake Sep 25, 2024
019fb4b
add support for any config parameter (#1402)
cb-jake Sep 26, 2024
2342396
create new SDK utils (#1405)
cb-jake Sep 27, 2024
27acaf7
Add testapp page for testing new config values (#1404)
cb-jake Sep 27, 2024
ea73b46
Pass preferences with popuploaded event (#1412)
cb-jake Sep 27, 2024
107bc87
Fix chainChanged event emitting for walletlink connection (#1411)
nateReiners Sep 27, 2024
e121d51
Nate/trivial/playground workaround for v3.9.3 walletlink eventing bug…
nateReiners Sep 27, 2024
b982ea8
guess favicon based on convention, frontend handles malformed urls ju…
nateReiners Sep 28, 2024
02a8a64
Add coop warning (#1417)
cb-jake Oct 1, 2024
fc3c040
Disable next config headers (#1418)
cb-jake Oct 1, 2024
960e67e
remove next config (#1419)
cb-jake Oct 1, 2024
3da9ef6
Update the attribution property (#1420)
cb-jake Oct 7, 2024
aa5aad3
fix playground (#1422)
cb-jake Oct 8, 2024
34d90e8
Update test matrix (remove node 16 and 18) (#1424)
cb-jake Oct 9, 2024
df81d47
merge sdk config demo into main page (#1425)
cb-jake Oct 10, 2024
1bd8d67
[Trivial] use es6 namespaced Number.parseInt (#1416)
nateReiners Oct 10, 2024
d06584e
trivial - add linting to playground (#1426)
nateReiners Oct 11, 2024
8386209
Web SDK sending info via searchParams (#1427)
fan-zhang-sv Oct 16, 2024
bb531e3
fix: project module resolution (#1428)
cb-jake Oct 17, 2024
d5a9d18
make params expand when needed (#1430)
spencerstock Oct 22, 2024
92f19b5
add copy button to message examples (#1432)
spencerstock Oct 22, 2024
ee59560
fix lint in playground (#1433)
cb-jake Oct 22, 2024
7021d22
Add grant permissions example message (#1434)
spencerstock Oct 22, 2024
bae2bea
remove enable call from playground (#1437)
cb-jake Oct 24, 2024
62b243c
Passing SDK config params to injected provider (#1436)
fan-zhang-sv Oct 25, 2024
5c8dc64
Signer `request` should be generic for consumers (#1438)
cb-jake Oct 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 32 additions & 9 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Checkout node action
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache-dependency-path: 'yarn.lock'
Expand All @@ -38,10 +38,10 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Checkout node action
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache-dependency-path: '**/yarn.lock'
Expand All @@ -50,7 +50,7 @@ jobs:
run: yarn install --immutable

- name: Runs compile asset script
run: node ./compile-assets.js
run: node ./compile-assets.cjs

- name: Check Types
run: yarn typecheck
Expand All @@ -64,14 +64,14 @@ jobs:

strategy:
matrix:
node-version: [16.x, 18.x, 20.x]
node-version: [20.x, 22.x]

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache-dependency-path: '**/yarn.lock'
Expand All @@ -80,7 +80,30 @@ jobs:
run: yarn install --immutable

- name: Runs compile asset script
run: node ./compile-assets.js
run: node ./compile-assets.cjs

- name: Run Unit Tests
run: yarn test

lint-testapp:
name: Lint Testapp
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./examples/testapp

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Checkout node action
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache-dependency-path: 'yarn.lock'

- name: Install NPM dependencies
run: yarn install --immutable

- name: eslint
run: yarn lint
4 changes: 2 additions & 2 deletions .github/workflows/versioning.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ jobs:

- name: Install NPM dependencies
run: yarn install --immutable
- name: Update version.ts file

- name: Update sdk-info.ts file
run: yarn prebuild

- name: Commit and branch updated version
Expand Down
87 changes: 87 additions & 0 deletions examples/testapp/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
module.exports = {
extends: [
'preact',
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
],
settings: {
react: {
pragma: 'h',
},
},
env: {
browser: true,
es2021: true,
node: true,
commonjs: true,
},
plugins: ['@typescript-eslint', 'simple-import-sort', 'unused-imports', 'prettier'],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
},
rules: {
'@typescript-eslint/no-unused-vars': 'off',
'simple-import-sort/imports': [
'error',
{
groups: [['^\\u0000'], ['^@?\\w'], ['^src(/.*|$)']],
},
],
'simple-import-sort/exports': 'error',
'no-unused-vars': 'off',
'unused-imports/no-unused-imports': 'error',
'unused-imports/no-unused-vars': [
'error',
{
vars: 'all',
varsIgnorePattern: '^_',
args: 'after-used',
argsIgnorePattern: '^_',
},
],
'no-console': [
'error',
{
allow: ['warn', 'error', 'info'],
},
],
'prettier/prettier': [
'error',
{
arrowParens: 'always',
bracketSpacing: true,
endOfLine: 'lf',
htmlWhitespaceSensitivity: 'css',
printWidth: 100,
quoteProps: 'as-needed',
semi: true,
singleQuote: true,
tabWidth: 2,
trailingComma: 'es5',
useTabs: false,
},
],
// TODO: change this back to error
'@typescript-eslint/no-explicit-any': 'warn',
'no-useless-constructor': 'off',
'jest/no-deprecated-functions': 'off',
'no-restricted-globals': [
'error',
{
name: 'parseInt',
message: 'Use Number.parseInt instead of parseInt.',
},
],
},
overrides: [
{
files: ['**/*.test.*'],
rules: {
'@typescript-eslint/no-explicit-any': 'off',
},
},
],
};
17 changes: 17 additions & 0 deletions examples/testapp/config/headers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
function getCrossOriginOpenerPolicyHeaders() {
return {
source: "/",
headers: [
{
key: "Cross-Origin-Opener-Policy",
value: "same-origin",
},
]
}
}

// To test these headers in your local environment,
// create a next.config and add the following rules to the next.config.js headers property.
module.exports = {
getCrossOriginOpenerPolicyHeaders
}
2 changes: 1 addition & 1 deletion examples/testapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@coinbase/wallet-sdk": "workspace:*",
"@coinbase/wallet-sdk-3.7.2": "npm:@coinbase/wallet-sdk@3.7.2",
"@coinbase/wallet-sdk-3.9.3": "npm:@coinbase/wallet-sdk@3.9.3",
"@coinbase/wallet-sdk-4.0.4": "npm:@coinbase/wallet-sdk@latest",
"@coinbase/wallet-sdk-latest": "npm:@coinbase/wallet-sdk@latest",
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@metamask/eth-sig-util": "^7.0.0",
Expand Down
3 changes: 2 additions & 1 deletion examples/testapp/src/components/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
useBreakpointValue,
useDisclosure,
} from '@chakra-ui/react';
import latestPkgJson from '@coinbase/wallet-sdk/package.json';
import { useMemo } from 'react';

import { options, scwUrls, sdkVersions, useCBWSDK } from '../context/CBWSDKReactContextProvider';
Expand Down Expand Up @@ -65,7 +66,7 @@ export function Layout({ children }: LayoutProps) {
))}
</MenuList>
</Menu>
{(sdkVersion === 'HEAD' || sdkVersion === '4.0.4') && (
{(sdkVersion === 'HEAD' || sdkVersion === latestPkgJson.version) && (
<>
<Menu>
<MenuButton as={Button} rightIcon={<ChevronDownIcon />}>
Expand Down
42 changes: 42 additions & 0 deletions examples/testapp/src/components/MethodsSection/MethodsSection.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { Box, Grid, GridItem, Heading } from '@chakra-ui/react';
import React from 'react';

import { RpcRequestInput } from '../RpcMethods/method/RpcRequestInput';
import { RpcMethodCard } from '../RpcMethods/RpcMethodCard';
import { ShortcutType } from '../RpcMethods/shortcut/ShortcutType';

export function MethodsSection({
title,
methods,
shortcutsMap,
}: {
title: string;
methods: RpcRequestInput[];
shortcutsMap?: Record<string, ShortcutType[]>;
}) {
return (
<Box mt={4}>
<Heading size="md">{title}</Heading>
<Grid
mt={2}
templateColumns={{
base: '100%',
md: 'repeat(2, 50%)',
xl: 'repeat(3, 33%)',
}}
gap={2}
>
{methods.map((rpc) => (
<GridItem w="100%" key={rpc.method}>
<RpcMethodCard
method={rpc.method}
params={rpc.params}
format={rpc.format}
shortcuts={shortcutsMap?.[rpc.method]}
/>
</GridItem>
))}
</Grid>
</Box>
);
}
Loading