Skip to content

Commit

Permalink
Prepare beta 3 release
Browse files Browse the repository at this point in the history
- update workflow release version
- rename version parameter to walletConnectVersion
- update connect-kit-loader's tsconfig outDir
  • Loading branch information
hlopes-ledger committed Jun 21, 2023
1 parent 90f0bec commit 2595543
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 18 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release_connect-kit-loader.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ jobs:
if: startsWith(github.event.inputs.release-type, 'pre')
run: |
cd ${{ env.PKG_DIR }}
echo "NEW_VERSION=$(npm --no-git-tag-version --preid=${{ env.DIST_TAG_PRERELEASE }} version $RELEASE_TYPE)" >> $GITHUB_ENV
#echo "NEW_VERSION=v1.1.0-beta.1" >> $GITHUB_ENV
#echo "NEW_VERSION=$(npm --no-git-tag-version --preid=${{ env.DIST_TAG_PRERELEASE }} version $RELEASE_TYPE)" >> $GITHUB_ENV
echo "NEW_VERSION=v1.1.0-beta.2" >> $GITHUB_ENV
echo "RELEASE_TAG=${{ env.DIST_TAG_PRERELEASE }}" >> $GITHUB_ENV
env:
RELEASE_TYPE: ${{ github.event.inputs.release-type }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release_connect-kit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
run: |
cd ${{ env.PKG_DIR }}
#echo "NEW_VERSION=$(npm --no-git-tag-version --preid=${{ env.DIST_TAG_PRERELEASE }} version $RELEASE_TYPE)" >> $GITHUB_ENV
echo "NEW_VERSION=v1.1.0-beta.2" >> $GITHUB_ENV
echo "NEW_VERSION=v1.1.0-beta.3" >> $GITHUB_ENV
echo "RELEASE_TAG=${{ env.DIST_TAG_PRERELEASE }}" >> $GITHUB_ENV
env:
RELEASE_TYPE: ${{ github.event.inputs.release-type }}
Expand Down
2 changes: 1 addition & 1 deletion examples/direct-integration/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default function Home() {
connectKit.enableDebugLogs();
const checkSupportResult = connectKit.checkSupport({
providerType: SupportedProviders.Ethereum,
version: 2,
walletConnectVersion: 2,
projectId: testProjectId,
chains: [137],
rpcMap: {
Expand Down
2 changes: 1 addition & 1 deletion examples/vite-web3-onboard/src/web3-onboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const testProjectId = '85a25426af6e359da0d3508466a95a1d';

const ledger = ledgerModule({
enableDebugLogs: true,
version: 2,
walletConnectVersion: 2,
projectId: testProjectId,
requiredChains: [1],
})
Expand Down
11 changes: 6 additions & 5 deletions packages/connect-kit-loader/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ disable them.
```ts
type CheckSupportOptions = {
providerType: SupportedProviders;
version?: number;
walletConnectVersion?: number;
// WalletConnect v2 init parameters
projectId?: string; // REQUIRED WC v2 project id
Expand All @@ -96,11 +96,11 @@ type CheckSupportOptions = {
To enable WalletConnect v2 you should update to version 1.1.0 of Connect Kit
Loader.

The simplest use case is to just specify the `providerType`, `version` and
The simplest use case is to just specify the `providerType`, `walletConnectVersion` and
`projectId` parameters.

- `providerType: SupportedProviders.Ethereum`
- `version: 2` - use WallertConnect v2, default is 1
- `walletConnectVersion: 2` - use WallertConnect v2, default is 1
- `projectId` - required for WalletConnect v2 projects, create one at
[WalletConnect Cloud](https://cloud.walletconnect.com/)

Expand Down Expand Up @@ -180,7 +180,7 @@ To migrate from WaletConnect version 1 to version 2:

- Get a project id from the WalletConnect Cloud, it's free
- Update Connect Kit loader to the latest version
- Add `version: 2` and `projectId: 'id from step 1'` and rename `rpc` to `rpcMap` on your `checkSupport` parameters
- Add `walletConnectVersion: 2` and `projectId: 'id from step 1'` and rename `rpc` to `rpcMap` on your `checkSupport` parameters

Have a look at the example velow and the full list of WalletConnect v2 options above.

Expand All @@ -203,7 +203,7 @@ const connectWallet = async () => {
connectKit.enableDebugLogs();
const checkSupportResult = connectKit.checkSupport({
providerType: SupportedProviders.Ethereum,
version: 2,
walletConnectVersion: 2,
projectId: 'YOUR_PROJECT_ID',
chains: [1, 137],
optionalChains: [5],
Expand Down Expand Up @@ -252,6 +252,7 @@ const connectWallet = async () => {
connectKit.enableDebugLogs();
const checkSupportResult = connectKit.checkSupport({
providerType: SupportedProviders.Ethereum,
walletConnectVersion: 1,
chainId: 1,
rpc: {
1: `https://cloudflare-eth.com`, // Mainnet
Expand Down
2 changes: 1 addition & 1 deletion packages/connect-kit-loader/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export type EnableDebugLogsFunction = () => void;
// support

export type CheckSupportOptions = {
version?: number;
walletConnectVersion?: number;
providerType: SupportedProviders;

// WalletConnect v2 init parameters
Expand Down
2 changes: 1 addition & 1 deletion packages/connect-kit-loader/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"emitDeclarationOnly": true,
"allowJs": false,

"outDir": "dist",
"outDir": "",
"baseUrl": "src"
}
}
2 changes: 1 addition & 1 deletion packages/connect-kit/src/lib/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export async function getProvider (): Promise<ProviderResult> {

if (
!localStorage?.getItem('connectKit_forceWcV2') &&
(supportOptions.version === 1 || localStorage?.getItem('connectKit_forceWcV1'))
(supportOptions.walletConnectVersion === 1 || localStorage?.getItem('connectKit_forceWcV1'))
) {
return await getWalletConnectLegacyProvider();
}
Expand Down
10 changes: 5 additions & 5 deletions packages/connect-kit/src/lib/supportOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const log = getDebugLogger('supportOptions');
let moduleSupportOptions: ValidatedSupportOptions;

type CheckSupportCommonOptions = {
version?: number; // OPTIONAL, has default
walletConnectVersion?: number; // OPTIONAL, has default
providerType: SupportedProviders; // REQUIRED
}

Expand Down Expand Up @@ -53,7 +53,7 @@ export type ValidatedSupportOptions = CheckSupportOptions &
export const setSupportOptions = (options: CheckSupportOptions): void => {
log('setSupportOptions', options);

const version = options.version || DEFAULT_WALLETCONNECT_VERSION;
const walletConnectVersion = options.walletConnectVersion || DEFAULT_WALLETCONNECT_VERSION;

let chains: number[];
let chainId: number;
Expand All @@ -62,7 +62,7 @@ export const setSupportOptions = (options: CheckSupportOptions): void => {
// set default chains and chainId
// for WalletConnect v1 we only care about chainId
// for WalletConnect v2 we only care about chains
if (version === 1) {
if (walletConnectVersion === 1) {
chainId = options.chainId || DEFAULT_CHAIN_ID;
chains = [chainId];
} else {
Expand All @@ -82,14 +82,14 @@ export const setSupportOptions = (options: CheckSupportOptions): void => {

const validatedOptions: ValidatedSupportOptions = {
...options,
version,
walletConnectVersion,
chains,
chainId,
optionalChains,
projectId: options.projectId || '',
};

if (version === 2 && (!options.projectId || options.projectId === '')) {
if (walletConnectVersion === 2 && (!options.projectId || options.projectId === '')) {
throw new Error(
'WalletConnect requires a projectId. Please visit https://cloud.walletconnect.com to get one.'
)
Expand Down

0 comments on commit 2595543

Please sign in to comment.