Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
18 changes: 18 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Setup
runs:
using: composite
steps:
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
registry-url: https://registry.npmjs.org
cache: yarn

# For provenance https://docs.npmjs.com/generating-provenance-statements#prerequisites
- name: Install npm 9.5
run: npm install -g npm@^9.5.0
shell: bash

- name: Install node modules
run: yarn install --frozen-lockfile
shell: bash
42 changes: 42 additions & 0 deletions .github/workflows/release-canary.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Release (Canary)
on:
workflow_dispatch:

jobs:
canary:
name: Release canary
runs-on: ubuntu-latest
environment: release
permissions:
contents: write
pull-requests: write
id-token: write
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive

- name: 'Setup'
uses: ./.github/actions/setup

- name: Set version
run: npm --no-git-tag-version version $(node -p "require('./packages/wallet-sdk/package.json').version")-canary.$(date +'%Y%m%d') -w packages/wallet-sdk

# Build the package
- name: Prebuild
run: yarn workspace @coinbase/wallet-sdk prebuild

- name: Build Packages
shell: bash
run: yarn build:packages

- name: Set deployment token
run: npm config set '//registry.npmjs.org/:_authToken' "${{ secrets.NPM_TOKEN }}"

- name: Publish to npm
run: cd packages/wallet-sdk && npm publish --tag canary
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

69 changes: 69 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Release

on:
workflow_dispatch:
inputs:
packageVersion:
description: "The version to publish in MAJOR.MINOR.PATCH format"
required: true
default: ""

jobs:
authorize:
name: Authorize
runs-on: ubuntu-latest
steps:
- name: ${{ github.actor }} permission check to update release version
uses: "lannonbr/[email protected]"
with:
permission: "write"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

release:
Comment on lines +13 to +23

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}

Copilot Autofix

AI 8 months ago

To fix the issue, we need to add a permissions block to the authorize job. Since the job only checks permissions and does not perform any write operations, it should be granted the minimal contents: read permission. This ensures that the job has only the permissions it needs to function correctly.

The changes will be made in the .github/workflows/release.yml file. Specifically, a permissions block will be added to the authorize job.


Suggested changeset 1
.github/workflows/release.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -14,2 +14,4 @@
     runs-on: ubuntu-latest
+    permissions:
+      contents: read
     steps:
EOF
@@ -14,2 +14,4 @@
runs-on: ubuntu-latest
permissions:
contents: read
steps:
Copilot is powered by AI and may make mistakes. Always verify output.
name: Release
runs-on: ubuntu-latest
environment: release
permissions:
contents: write
pull-requests: write
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive

- name: 'Setup'
uses: ./.github/actions/setup

- name: Set version
run: npm version ${{ env.PACKAGE_VERSION }} -w packages/wallet-sdk

# Build the package
- name: Prebuild
run: yarn workspace @coinbase/wallet-sdk prebuild

- name: Build SDK
shell: bash
run: yarn workspace @coinbase/wallet-sdk build

# Create a pull request to update the version
- name: Create pull request
uses: peter-evans/create-pull-request@v4
with:
title: "[Version update] v${{ env.PACKAGE_VERSION }}"
body: "Automated workflow: version update"
branch: release-v${{ env.PACKAGE_VERSION }}
delete-branch: true
commit-message: "v${{ env.PACKAGE_VERSION }}"
labels: version-update

# Publish to npm
- name: Set deployment token
run: npm config set '//registry.npmjs.org/:_authToken' "${{ secrets.NPM_TOKEN }}"

- name: Publish to npm
run: cd packages/wallet-sdk && npm publish --tag latest
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
5 changes: 4 additions & 1 deletion packages/wallet-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@coinbase/wallet-sdk",
"version": "4.3.0",
"version": "4.3.3",
"description": "Coinbase Wallet JavaScript SDK",
"keywords": [
"coinbase",
Expand Down Expand Up @@ -42,12 +42,15 @@
"@types/node": "^14.18.54",
"@typescript-eslint/eslint-plugin": "^6.2.0",
"@typescript-eslint/parser": "^6.2.0",
"@vitest/coverage-v8": "2.1.2",
"@vitest/web-worker": "3.2.1",
"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",
"fake-indexeddb": "^6.0.0",
"glob": "^11.0.0",
"jest-websocket-mock": "^2.4.0",
"jsdom": "^25.0.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/wallet-sdk/src/core/communicator/Communicator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export class Communicator {
return this.popup;
}

this.popup = openPopup(this.url);
this.popup = await openPopup(this.url);

this.onMessage<ConfigMessage>(({ event }) => event === 'PopupUnload')
.then(this.disconnect)
Expand Down
2 changes: 1 addition & 1 deletion packages/wallet-sdk/src/core/constants.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const CB_KEYS_URL = 'https://keys.coinbase.com/connect';
export const CB_WALLET_RPC_URL = 'http://rpc.wallet.coinbase.com';
export const CB_WALLET_RPC_URL = 'https://rpc.wallet.coinbase.com';
export const WALLETLINK_URL = 'https://www.walletlink.org';
export const CBW_MOBILE_DEEPLINK_URL = 'https://go.cb-w.com/walletlink';
Loading