Skip to content

Commit

Permalink
fix: fix waypoint connnector
Browse files Browse the repository at this point in the history
  • Loading branch information
HoangNguyen17193 committed Oct 1, 2024
1 parent 28427d2 commit 0dcbfd1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/connect/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sky-mavis/tanto-connect",
"version": "0.0.2",
"version": "0.0.3",
"description": "Tanto Connect",
"main": "dist/cjs/index.js",
"module": "dist/mjs/index.js",
Expand Down
12 changes: 7 additions & 5 deletions packages/connect/src/connectors/waypoint/WaypointConnector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import { WaypointProvider } from '@sky-mavis/waypoint';

import { DEFAULT_CONNECTORS_CONFIG } from '../../common/connectors';
import { LocalStorage, ReconnectStorage, WAYPOINT_ACCESS_TOKEN_STORAGE_KEY } from '../../common/storage';
import { requestWaypointProvider } from '../../providers';
import { IWaypointProviderConfigs } from '../../providers/waypoint-provider';
import { IWaypointProviderConfigs, requestWaypointProvider } from '../../providers';
import { IConnectorConfigs, IConnectResult } from '../../types/connector';
import { ConnectorError, ConnectorErrorType } from '../../types/connector-error';
import { EIP1193Event } from '../../types/eip1193';
Expand Down Expand Up @@ -46,16 +45,19 @@ export class WaypointConnector extends BaseConnector<WaypointProvider> {
});
}

async connect() {
async connect(chainId?: number) {
const provider = await this.getProvider();
const chainId = await this.getChainId();
const accounts = await this.getAccounts();
const currentChainId = await this.getChainId();
if (currentChainId !== chainId) {
this.provider = await this.requestProvider({ chainId });
}
const account = accounts[0];

const connectResult: IConnectResult = {
accessToken: LocalStorage.get(WAYPOINT_ACCESS_TOKEN_STORAGE_KEY),
provider,
chainId,
chainId: chainId || currentChainId,
account,
};

Expand Down
2 changes: 1 addition & 1 deletion packages/wagmi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
},
"homepage": "https://github.com/skymavis/tanto-kit",
"dependencies": {
"@sky-mavis/tanto-connect": "0.0.2",
"@sky-mavis/tanto-connect": "0.0.3",
"@wagmi/core": "2.13.6",
"eslint": "8.30.0",
"jest": "29.7.0",
Expand Down

0 comments on commit 0dcbfd1

Please sign in to comment.