@dynamic-labs/starknet 0.19.0-alpha.1 → 0.19.0-alpha.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,7 @@
1
1
  'use strict';
2
2
 
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
3
5
  var _tslib = require('../_virtual/_tslib.cjs');
4
6
  var getStarknetCore = require('get-starknet-core');
5
7
  var starknet = require('starknet');
@@ -9,203 +11,213 @@ var constants = require('./constants.cjs');
9
11
  var ethereumContractAbi = require('./ethereumContractAbi.cjs');
10
12
  var convertors = require('./utils/convertors.cjs');
11
13
 
12
- const ACCOUNT_CHANGED_EVENT_LISTENER = 'accountsChanged';
13
- const NETWORK_CHANGED_EVENT_LISTENER = 'networkChanged';
14
- class StarknetWalletConnector extends walletConnectorCore.WalletConnectorBase {
15
- constructor(name, windowKey, starknetNetworks) {
16
- super();
17
- this.connectedChain = 'STARK';
18
- this.supportedChains = ['STARK'];
19
- this.switchNetworkOnlyFromWallet = true;
20
- this.name = name;
21
- this.windowKey = windowKey;
22
- this.starknetNetworks = starknetNetworks;
23
- }
24
- getRpcProvider() {
25
- var _a, _b;
26
- const nodeUrl = (_b = (_a = this.starknetNetworks) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.rpcUrls[0];
27
- if (!nodeUrl) {
28
- throw new utils.DynamicError('RPC URL has not been found.');
29
- }
30
- return Promise.resolve(new starknet.RpcProvider({ nodeUrl }));
31
- }
32
- /**
33
- * returns stakrnet wallet network id
34
- */
35
- getNetwork() {
36
- var _a;
37
- return _tslib.__awaiter(this, void 0, void 0, function* () {
38
- const wallet = yield this.getWallet();
39
- if (!wallet) {
40
- return Promise.resolve(undefined);
41
- }
42
- if (!wallet.isConnected) {
43
- yield wallet.enable();
44
- }
45
- return Promise.resolve((_a = wallet.provider) === null || _a === void 0 ? void 0 : _a.chainId);
46
- });
47
- }
48
- connect() {
49
- return _tslib.__awaiter(this, void 0, void 0, function* () {
50
- const wallet = yield this.getWallet();
51
- try {
52
- if (wallet && !wallet.isConnected) {
53
- yield wallet.enable();
54
- }
55
- }
56
- catch (err) {
57
- walletConnectorCore.logger.error(err);
58
- }
59
- });
60
- }
61
- fetchPublicAddress() {
62
- return _tslib.__awaiter(this, void 0, void 0, function* () {
63
- const wallet = yield this.getWallet();
64
- /**
65
- * Fetches public address. Uses `isPreauthorized` as a temporary solution to ensure
66
- * the wallets store's data is read. Without it, an empty string may be returned due
67
- * to a possible reliance on its side-effects for data refreshing.
68
- */
69
- yield (wallet === null || wallet === void 0 ? void 0 : wallet.isPreauthorized());
70
- yield this.connect();
71
- return Promise.resolve(wallet === null || wallet === void 0 ? void 0 : wallet.selectedAddress);
72
- });
73
- }
74
- getSigner() {
75
- return _tslib.__awaiter(this, void 0, void 0, function* () {
76
- const wallet = yield this.getWallet();
77
- return wallet === null || wallet === void 0 ? void 0 : wallet.account;
78
- });
79
- }
80
- getWallet() {
81
- return _tslib.__awaiter(this, void 0, void 0, function* () {
82
- if (!this.wallet) {
83
- const providers = yield getStarknetCore.getStarknet().getAvailableWallets();
84
- this.wallet = providers.find((provider) => provider.name === this.name);
85
- }
86
- return this.wallet;
87
- });
88
- }
89
- getWeb3Provider() {
90
- return _tslib.__awaiter(this, void 0, void 0, function* () {
91
- const wallet = yield this.getWallet();
92
- return wallet === null || wallet === void 0 ? void 0 : wallet.provider;
93
- });
94
- }
95
- signMessage(messageToSign) {
96
- return _tslib.__awaiter(this, void 0, void 0, function* () {
97
- const wallet = yield this.getWallet();
98
- const walletAddress = yield this.fetchPublicAddress();
99
- if (!walletAddress || !wallet) {
100
- walletConnectorCore.logger.error('Could not fetch wallet address for signing message');
101
- return undefined;
102
- }
103
- const { provider: { chainId }, } = wallet;
104
- const encodedMessage = convertors.formatTypedDataMessage(messageToSign, chainId);
105
- const signature = yield wallet.account.signMessage(encodedMessage);
106
- return signature === null || signature === void 0 ? void 0 : signature.join(',');
107
- });
108
- }
109
- getBalance() {
110
- return _tslib.__awaiter(this, void 0, void 0, function* () {
111
- const walletAddress = yield this.fetchPublicAddress();
112
- const provider = yield this.getWeb3Provider();
113
- if (!walletAddress || !provider) {
114
- walletConnectorCore.logger.error('Could not fetch wallet address for getting balance');
115
- return undefined;
116
- }
117
- const contract = new starknet.Contract(ethereumContractAbi, constants.ETH_STARKNET_ADDRESS, provider);
118
- try {
119
- const { balance } = yield contract.balanceOf(walletAddress);
120
- const gweiBalance = parseInt(starknet.uint256.uint256ToBN(balance).toString(10));
121
- /**
122
- * Dividing by 1e18 as the returned balance is a Gwei number.
123
- * Read more here: https://www.investopedia.com/terms/g/gwei-ethereum.asp#toc-what-is-gwei
124
- */
125
- return (gweiBalance / 1e18).toFixed(6);
126
- }
127
- catch (error) {
128
- throw new utils.DynamicError('Something went wrong');
129
- }
130
- });
131
- }
132
- endSession() {
133
- return _tslib.__awaiter(this, void 0, void 0, function* () {
134
- getStarknetCore.getStarknet().disconnect({ clearLastWallet: true });
135
- });
136
- }
137
- getStarknetWindowObject() {
138
- const starknetWindowInstance = window[`starknet_${this.windowKey}`] || window['starknet'];
139
- if ((starknetWindowInstance === null || starknetWindowInstance === void 0 ? void 0 : starknetWindowInstance.name) === this.name) {
140
- return starknetWindowInstance;
141
- }
142
- else {
143
- return undefined;
144
- }
145
- }
146
- isInstalledOnBrowser() {
147
- var _a;
148
- const starknetWindowInstance = (_a = window[`starknet_${this.windowKey}`]) !== null && _a !== void 0 ? _a : window['starknet'];
149
- return (starknetWindowInstance === null || starknetWindowInstance === void 0 ? void 0 : starknetWindowInstance.name) === this.name;
150
- }
151
- getConnectedAccounts() {
152
- var _a;
153
- return _tslib.__awaiter(this, void 0, void 0, function* () {
154
- const wallet = yield this.getWallet();
155
- return ((_a = wallet === null || wallet === void 0 ? void 0 : wallet.account) === null || _a === void 0 ? void 0 : _a.address) ? [wallet.account.address] : [];
156
- });
157
- }
158
- setupEventListeners(listeners) {
159
- const wallet = this.getStarknetWindowObject();
160
- if (!wallet) {
161
- return walletConnectorCore.logger.error('Wallet has not been found');
162
- }
163
- this.handleAccountChange = (address) => _tslib.__awaiter(this, void 0, void 0, function* () {
164
- var _a, _b;
165
- if (!address) {
166
- yield ((_a = listeners.onDisconnect) === null || _a === void 0 ? void 0 : _a.call(listeners));
167
- return;
168
- }
169
- if (address.toString()) {
170
- yield ((_b = listeners.onAccountChange) === null || _b === void 0 ? void 0 : _b.call(listeners, [address.toString()]));
171
- }
172
- });
173
- this.handleNetworkChange = (network) => _tslib.__awaiter(this, void 0, void 0, function* () {
174
- var _c, _d;
175
- if (!network) {
176
- yield ((_c = listeners.onDisconnect) === null || _c === void 0 ? void 0 : _c.call(listeners));
177
- return;
178
- }
179
- const chainId = this.mapChainUrlToChainId(network.toString());
180
- if (chainId) {
181
- yield ((_d = listeners.onChainChange) === null || _d === void 0 ? void 0 : _d.call(listeners, chainId));
182
- }
183
- });
184
- wallet === null || wallet === void 0 ? void 0 : wallet.on(ACCOUNT_CHANGED_EVENT_LISTENER, this.handleAccountChange);
185
- wallet === null || wallet === void 0 ? void 0 : wallet.on(NETWORK_CHANGED_EVENT_LISTENER, this.handleNetworkChange);
186
- }
187
- teardownEventListeners() {
188
- return _tslib.__awaiter(this, void 0, void 0, function* () {
189
- const wallet = yield this.getWallet();
190
- if (this.handleAccountChange) {
191
- wallet === null || wallet === void 0 ? void 0 : wallet.off(ACCOUNT_CHANGED_EVENT_LISTENER, this.handleAccountChange);
192
- this.handleAccountChange = undefined;
193
- }
194
- if (this.handleNetworkChange) {
195
- wallet === null || wallet === void 0 ? void 0 : wallet.off(NETWORK_CHANGED_EVENT_LISTENER, this.handleNetworkChange);
196
- this.handleNetworkChange = undefined;
197
- }
198
- });
199
- }
200
- mapChainUrlToChainId(baseUrl) {
201
- if (baseUrl.includes('mainnet')) {
202
- return starknet.constants.StarknetChainId.SN_MAIN;
203
- }
204
- else if (baseUrl.includes('goerli')) {
205
- return starknet.constants.StarknetChainId.SN_GOERLI;
206
- }
207
- return undefined;
208
- }
14
+ const ACCOUNT_CHANGED_EVENT_LISTENER = 'accountsChanged';
15
+ const NETWORK_CHANGED_EVENT_LISTENER = 'networkChanged';
16
+ const STARKNET_VERSION = 'v5';
17
+ class StarknetWalletConnector extends walletConnectorCore.WalletConnectorBase {
18
+ constructor(name, windowKey, opts) {
19
+ super(opts);
20
+ this.connectedChain = 'STARK';
21
+ this.supportedChains = ['STARK'];
22
+ this.switchNetworkOnlyFromWallet = true;
23
+ this.name = name;
24
+ this.windowKey = windowKey;
25
+ this.starknetNetworks = opts.starknetNetworks;
26
+ }
27
+ getRpcProvider() {
28
+ var _a, _b;
29
+ const nodeUrl = (_b = (_a = this.starknetNetworks) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.rpcUrls[0];
30
+ if (!nodeUrl) {
31
+ throw new utils.DynamicError('RPC URL has not been found.');
32
+ }
33
+ return Promise.resolve(new starknet.RpcProvider({ nodeUrl }));
34
+ }
35
+ /**
36
+ * returns stakrnet wallet network id
37
+ */
38
+ getNetwork() {
39
+ var _a;
40
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
41
+ const wallet = yield this.getWallet();
42
+ if (!wallet) {
43
+ return Promise.resolve(undefined);
44
+ }
45
+ if (!wallet.isConnected) {
46
+ yield wallet.enable({ starknetVersion: STARKNET_VERSION });
47
+ }
48
+ return Promise.resolve((_a = wallet.provider) === null || _a === void 0 ? void 0 : _a.getChainId());
49
+ });
50
+ }
51
+ connect() {
52
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
53
+ const wallet = yield this.getWallet();
54
+ try {
55
+ if (wallet && !wallet.isConnected) {
56
+ yield wallet.enable({ starknetVersion: STARKNET_VERSION });
57
+ }
58
+ }
59
+ catch (err) {
60
+ walletConnectorCore.logger.error(err);
61
+ }
62
+ });
63
+ }
64
+ fetchPublicAddress() {
65
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
66
+ const wallet = yield this.getWallet();
67
+ /**
68
+ * Fetches public address. Uses `isPreauthorized` as a temporary solution to ensure
69
+ * the wallets store's data is read. Without it, an empty string may be returned due
70
+ * to a possible reliance on its side-effects for data refreshing.
71
+ */
72
+ yield (wallet === null || wallet === void 0 ? void 0 : wallet.isPreauthorized());
73
+ yield this.connect();
74
+ return Promise.resolve(wallet === null || wallet === void 0 ? void 0 : wallet.selectedAddress);
75
+ });
76
+ }
77
+ getSigner() {
78
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
79
+ const wallet = yield this.getWallet();
80
+ return wallet === null || wallet === void 0 ? void 0 : wallet.account;
81
+ });
82
+ }
83
+ getWallet() {
84
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
85
+ if (!this.wallet) {
86
+ const providers = yield getStarknetCore.getStarknet().getAvailableWallets();
87
+ this.wallet = providers.find((provider) => provider.name === this.name);
88
+ }
89
+ return this.wallet;
90
+ });
91
+ }
92
+ getWeb3Provider() {
93
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
94
+ const wallet = yield this.getWallet();
95
+ return wallet === null || wallet === void 0 ? void 0 : wallet.provider;
96
+ });
97
+ }
98
+ signMessage(messageToSign) {
99
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
100
+ const wallet = yield this.getWallet();
101
+ const walletAddress = yield this.fetchPublicAddress();
102
+ if (!walletAddress || !wallet) {
103
+ walletConnectorCore.logger.error('Could not fetch wallet address for signing message');
104
+ return undefined;
105
+ }
106
+ const encodedMessage = convertors.formatTypedDataMessage(messageToSign, (yield wallet.provider.getChainId()));
107
+ const signature = yield wallet.account.signMessage(encodedMessage);
108
+ return signature === null || signature === void 0 ? void 0 : signature.join(',');
109
+ });
110
+ }
111
+ getBalance() {
112
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
113
+ const walletAddress = yield this.fetchPublicAddress();
114
+ const provider = yield this.getWeb3Provider();
115
+ if (!walletAddress || !provider) {
116
+ walletConnectorCore.logger.error('Could not fetch wallet address for getting balance');
117
+ return undefined;
118
+ }
119
+ const contract = new starknet.Contract(ethereumContractAbi, constants.ETH_STARKNET_ADDRESS, provider);
120
+ try {
121
+ const { balance } = yield contract.balanceOf(walletAddress);
122
+ /**
123
+ * Dividing by 1e18 as the returned balance is a Gwei number.
124
+ * Read more here: https://www.investopedia.com/terms/g/gwei-ethereum.asp#toc-what-is-gwei
125
+ */
126
+ return (Number(starknet.cairo.uint256(balance.low).low) / 1e18).toFixed(6);
127
+ }
128
+ catch (error) {
129
+ throw new utils.DynamicError('Something went wrong');
130
+ }
131
+ });
132
+ }
133
+ endSession() {
134
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
135
+ getStarknetCore.getStarknet().disconnect({ clearLastWallet: true });
136
+ });
137
+ }
138
+ getStarknetWindowObject() {
139
+ const starknetWindowInstance = window[`starknet_${this.windowKey}`] || window['starknet'];
140
+ if ((starknetWindowInstance === null || starknetWindowInstance === void 0 ? void 0 : starknetWindowInstance.name) === this.name) {
141
+ return starknetWindowInstance;
142
+ }
143
+ else {
144
+ return undefined;
145
+ }
146
+ }
147
+ isInstalledOnBrowser() {
148
+ var _a;
149
+ const starknetWindowInstance = (_a = window[`starknet_${this.windowKey}`]) !== null && _a !== void 0 ? _a : window['starknet'];
150
+ return (starknetWindowInstance === null || starknetWindowInstance === void 0 ? void 0 : starknetWindowInstance.name) === this.name;
151
+ }
152
+ getConnectedAccounts() {
153
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
154
+ const wallet = yield this.getWallet();
155
+ if (!wallet) {
156
+ return [];
157
+ }
158
+ const needsReconnection = !wallet.isConnected && (yield wallet.isPreauthorized());
159
+ if (needsReconnection) {
160
+ yield this.connect();
161
+ }
162
+ return wallet.selectedAddress ? [wallet.selectedAddress] : [];
163
+ });
164
+ }
165
+ setupEventListeners() {
166
+ const wallet = this.getStarknetWindowObject();
167
+ if (!wallet) {
168
+ return walletConnectorCore.logger.error('Wallet has not been found');
169
+ }
170
+ this.handleAccountChange = (address) => _tslib.__awaiter(this, void 0, void 0, function* () {
171
+ if (!(yield wallet.isPreauthorized()) && !address) {
172
+ this.emit('disconnect');
173
+ return;
174
+ }
175
+ // this is the case where the wallet emits an empty account change event
176
+ // when the user is simply switching network
177
+ if (!address) {
178
+ return;
179
+ }
180
+ if (address.toString()) {
181
+ this.emit('accountChange', { accounts: [address.toString()] });
182
+ }
183
+ });
184
+ this.handleNetworkChange = (network) => _tslib.__awaiter(this, void 0, void 0, function* () {
185
+ if (!network) {
186
+ this.emit('disconnect');
187
+ return;
188
+ }
189
+ const chain = this.mapChainUrlToChainId(network.toString());
190
+ if (chain) {
191
+ this.emit('chainChange', { chain });
192
+ }
193
+ });
194
+ wallet === null || wallet === void 0 ? void 0 : wallet.on(ACCOUNT_CHANGED_EVENT_LISTENER, this.handleAccountChange);
195
+ wallet === null || wallet === void 0 ? void 0 : wallet.on(NETWORK_CHANGED_EVENT_LISTENER, this.handleNetworkChange);
196
+ }
197
+ teardownEventListeners() {
198
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
199
+ const wallet = yield this.getWallet();
200
+ if (this.handleAccountChange) {
201
+ wallet === null || wallet === void 0 ? void 0 : wallet.off(ACCOUNT_CHANGED_EVENT_LISTENER, this.handleAccountChange);
202
+ this.handleAccountChange = undefined;
203
+ }
204
+ if (this.handleNetworkChange) {
205
+ wallet === null || wallet === void 0 ? void 0 : wallet.off(NETWORK_CHANGED_EVENT_LISTENER, this.handleNetworkChange);
206
+ this.handleNetworkChange = undefined;
207
+ }
208
+ });
209
+ }
210
+ mapChainUrlToChainId(baseUrl) {
211
+ if (baseUrl.includes('mainnet')) {
212
+ return starknet.constants.StarknetChainId.SN_MAIN;
213
+ }
214
+ else if (baseUrl.includes('goerli')) {
215
+ return starknet.constants.StarknetChainId.SN_GOERLI;
216
+ }
217
+ return undefined;
218
+ }
209
219
  }
210
220
 
211
- module.exports = StarknetWalletConnector;
221
+ exports.ACCOUNT_CHANGED_EVENT_LISTENER = ACCOUNT_CHANGED_EVENT_LISTENER;
222
+ exports.NETWORK_CHANGED_EVENT_LISTENER = NETWORK_CHANGED_EVENT_LISTENER;
223
+ exports["default"] = StarknetWalletConnector;
@@ -1,44 +1,50 @@
1
- import { StarknetWindowObject } from 'get-starknet-core';
2
- import { ProviderInterface, constants, AccountInterface, RpcProvider } from 'starknet';
3
- import { Chain, WalletConnectorBase, WalletEventListeners } from '@dynamic-labs/wallet-connector-core';
4
- import { NetworkConfiguration } from '@dynamic-labs/sdk-api';
5
- import { StarknetWalletKey } from './types';
6
- type AccountChangeEventHandler = (address: {
7
- toString(): string;
8
- }) => Promise<void>;
9
- type NetworkChangeEventHandler = (network: {
10
- toString(): string;
11
- }) => Promise<void>;
12
- declare abstract class StarknetWalletConnector extends WalletConnectorBase {
13
- name: string;
14
- windowKey: StarknetWalletKey;
15
- connectedChain: Chain;
16
- supportedChains: Chain[];
17
- wallet: StarknetWindowObject | undefined;
18
- handleAccountChange: AccountChangeEventHandler | undefined;
19
- handleNetworkChange: NetworkChangeEventHandler | undefined;
20
- switchNetworkOnlyFromWallet: boolean;
21
- starknetNetworks: NetworkConfiguration[];
22
- constructor(name: string, windowKey: StarknetWalletKey, starknetNetworks: NetworkConfiguration[]);
23
- getRpcProvider(): Promise<RpcProvider>;
24
- /**
25
- * returns stakrnet wallet network id
26
- */
27
- getNetwork(): Promise<any>;
28
- connect(): Promise<void>;
29
- fetchPublicAddress(): Promise<string | undefined>;
30
- getSigner(): Promise<AccountInterface | undefined>;
31
- getWallet(): Promise<StarknetWindowObject | undefined>;
32
- getWeb3Provider(): Promise<ProviderInterface | undefined>;
33
- signMessage(messageToSign: string): Promise<string | undefined>;
34
- getBalance(): Promise<string | undefined>;
35
- endSession(): Promise<void>;
36
- getStarknetWindowObject(): StarknetWindowObject | undefined;
37
- isInstalledOnBrowser(): boolean;
38
- getConnectedAccounts(): Promise<string[]>;
39
- setupEventListeners(listeners: WalletEventListeners): void;
40
- teardownEventListeners(): Promise<void>;
41
- mapChainUrlToChainId(baseUrl: string): constants.StarknetChainId | undefined;
42
- }
43
- export type StarknetWalletConnectorType = StarknetWalletConnector;
44
- export default StarknetWalletConnector;
1
+ import { StarknetWindowObject } from 'get-starknet-core';
2
+ import { ProviderInterface, constants, AccountInterface, RpcProvider } from 'starknet';
3
+ import { Chain, WalletConnectorBase } from '@dynamic-labs/wallet-connector-core';
4
+ import { NetworkConfiguration } from '@dynamic-labs/sdk-api';
5
+ import { WalletBookSchema } from '@dynamic-labs/wallet-book';
6
+ import { StarknetWalletKey } from './types';
7
+ type AccountChangeEventHandler = (address: {
8
+ toString(): string;
9
+ }) => Promise<void>;
10
+ type NetworkChangeEventHandler = (network: {
11
+ toString(): string;
12
+ }) => Promise<void>;
13
+ export declare const ACCOUNT_CHANGED_EVENT_LISTENER = "accountsChanged";
14
+ export declare const NETWORK_CHANGED_EVENT_LISTENER = "networkChanged";
15
+ declare abstract class StarknetWalletConnector extends WalletConnectorBase {
16
+ name: string;
17
+ windowKey: StarknetWalletKey;
18
+ connectedChain: Chain;
19
+ supportedChains: Chain[];
20
+ wallet: StarknetWindowObject | undefined;
21
+ handleAccountChange: AccountChangeEventHandler | undefined;
22
+ handleNetworkChange: NetworkChangeEventHandler | undefined;
23
+ switchNetworkOnlyFromWallet: boolean;
24
+ starknetNetworks: NetworkConfiguration[];
25
+ constructor(name: string, windowKey: StarknetWalletKey, opts: {
26
+ starknetNetworks: NetworkConfiguration[];
27
+ walletBook: WalletBookSchema;
28
+ });
29
+ getRpcProvider(): Promise<RpcProvider>;
30
+ /**
31
+ * returns stakrnet wallet network id
32
+ */
33
+ getNetwork(): Promise<any>;
34
+ connect(): Promise<void>;
35
+ fetchPublicAddress(): Promise<string | undefined>;
36
+ getSigner(): Promise<AccountInterface | undefined>;
37
+ getWallet(): Promise<StarknetWindowObject | undefined>;
38
+ getWeb3Provider(): Promise<ProviderInterface | undefined>;
39
+ signMessage(messageToSign: string): Promise<string | undefined>;
40
+ getBalance(): Promise<string | undefined>;
41
+ endSession(): Promise<void>;
42
+ getStarknetWindowObject(): StarknetWindowObject | undefined;
43
+ isInstalledOnBrowser(): boolean;
44
+ getConnectedAccounts(): Promise<string[]>;
45
+ setupEventListeners(): void;
46
+ teardownEventListeners(): Promise<void>;
47
+ mapChainUrlToChainId(baseUrl: string): constants.StarknetChainId | undefined;
48
+ }
49
+ export type StarknetWalletConnectorType = StarknetWalletConnector;
50
+ export default StarknetWalletConnector;