@dynamic-labs/starknet 0.19.0-alpha.14 → 0.19.0-alpha.16
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.
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,29 @@
|
|
|
1
1
|
|
|
2
|
+
## [0.19.0-alpha.16](https://github.com/dynamic-labs/DynamicAuth/compare/v0.19.0-alpha.15...v0.19.0-alpha.16) (2023-10-17)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### ⚠ BREAKING CHANGES
|
|
6
|
+
|
|
7
|
+
* ethers extension integration and rename provider methods (#3573)
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* add onDisconnect ([#3572](https://github.com/dynamic-labs/DynamicAuth/issues/3572)) ([3e612f7](https://github.com/dynamic-labs/DynamicAuth/commit/3e612f72540781b9246a47ac12a7c979fb6c0d88))
|
|
12
|
+
* user callback on passkey creation complete ([#3591](https://github.com/dynamic-labs/DynamicAuth/issues/3591)) ([92d5f7d](https://github.com/dynamic-labs/DynamicAuth/commit/92d5f7df2ac1cc06338f7e9e75125f7bb71455ab))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* argentX in-browser wallet ([#3588](https://github.com/dynamic-labs/DynamicAuth/issues/3588)) ([7f3b22d](https://github.com/dynamic-labs/DynamicAuth/commit/7f3b22d003182aa0d84406086a313fc4de25e4a8))
|
|
18
|
+
* display a better message when transaction amount decimals are invalid ([#3577](https://github.com/dynamic-labs/DynamicAuth/issues/3577)) ([0238d9b](https://github.com/dynamic-labs/DynamicAuth/commit/0238d9b7712d6a52aec89193c751224dd8fd8b17))
|
|
19
|
+
* remove passkey success view ([#3536](https://github.com/dynamic-labs/DynamicAuth/issues/3536)) ([b559de9](https://github.com/dynamic-labs/DynamicAuth/commit/b559de9c83096ed98e9f073b998ac08f876af24e))
|
|
20
|
+
* **wagmi-connector:** use wallets list to sync wagmi client ([#3563](https://github.com/dynamic-labs/DynamicAuth/issues/3563)) ([1d551b9](https://github.com/dynamic-labs/DynamicAuth/commit/1d551b933aefe0c535285d68c2e6f819cd321e62))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
* ethers extension integration and rename provider methods ([#3573](https://github.com/dynamic-labs/DynamicAuth/issues/3573)) ([efd73c3](https://github.com/dynamic-labs/DynamicAuth/commit/efd73c3b8121df9a7d4ec8c1fb6c4fd76ecce6df))
|
|
24
|
+
|
|
25
|
+
## [0.19.0-alpha.15](https://github.com/dynamic-labs/DynamicAuth/compare/v0.19.0-alpha.14...v0.19.0-alpha.15) (2023-10-11)
|
|
26
|
+
|
|
2
27
|
## [0.19.0-alpha.14](https://github.com/dynamic-labs/DynamicAuth/compare/v0.19.0-alpha.13...v0.19.0-alpha.14) (2023-10-10)
|
|
3
28
|
|
|
4
29
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/starknet",
|
|
3
|
-
"version": "0.19.0-alpha.
|
|
3
|
+
"version": "0.19.0-alpha.16",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/dynamic-labs/DynamicAuth.git",
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
"get-starknet-core": "^3.2.0",
|
|
31
31
|
"text-encoding": "0.7.0",
|
|
32
32
|
"@dynamic-labs/sdk-api": "0.0.281",
|
|
33
|
-
"@dynamic-labs/utils": "0.19.0-alpha.
|
|
34
|
-
"@dynamic-labs/wallet-book": "0.19.0-alpha.
|
|
35
|
-
"@dynamic-labs/wallet-connector-core": "0.19.0-alpha.
|
|
33
|
+
"@dynamic-labs/utils": "0.19.0-alpha.16",
|
|
34
|
+
"@dynamic-labs/wallet-book": "0.19.0-alpha.16",
|
|
35
|
+
"@dynamic-labs/wallet-connector-core": "0.19.0-alpha.16"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {}
|
|
38
38
|
}
|
|
@@ -24,7 +24,7 @@ class StarknetWalletConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
24
24
|
this.windowKey = windowKey;
|
|
25
25
|
this.starknetNetworks = opts.starknetNetworks;
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
getPublicClient() {
|
|
28
28
|
var _a, _b;
|
|
29
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
30
|
if (!nodeUrl) {
|
|
@@ -38,7 +38,7 @@ class StarknetWalletConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
38
38
|
getNetwork() {
|
|
39
39
|
var _a;
|
|
40
40
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
41
|
-
const wallet =
|
|
41
|
+
const wallet = this.getWallet();
|
|
42
42
|
if (!wallet) {
|
|
43
43
|
return Promise.resolve(undefined);
|
|
44
44
|
}
|
|
@@ -50,7 +50,7 @@ class StarknetWalletConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
50
50
|
}
|
|
51
51
|
connect() {
|
|
52
52
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
53
|
-
const wallet =
|
|
53
|
+
const wallet = this.getWallet();
|
|
54
54
|
try {
|
|
55
55
|
if (wallet && !wallet.isConnected) {
|
|
56
56
|
yield wallet.enable({ starknetVersion: STARKNET_VERSION });
|
|
@@ -63,7 +63,7 @@ class StarknetWalletConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
63
63
|
}
|
|
64
64
|
fetchPublicAddress() {
|
|
65
65
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
66
|
-
const wallet =
|
|
66
|
+
const wallet = this.getWallet();
|
|
67
67
|
/**
|
|
68
68
|
* Fetches public address. Uses `isPreauthorized` as a temporary solution to ensure
|
|
69
69
|
* the wallets store's data is read. Without it, an empty string may be returned due
|
|
@@ -76,20 +76,11 @@ class StarknetWalletConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
76
76
|
}
|
|
77
77
|
getSigner() {
|
|
78
78
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
79
|
-
const wallet =
|
|
79
|
+
const wallet = this.getWallet();
|
|
80
80
|
return wallet === null || wallet === void 0 ? void 0 : wallet.account;
|
|
81
81
|
});
|
|
82
82
|
}
|
|
83
|
-
|
|
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() {
|
|
83
|
+
getWalletClient() {
|
|
93
84
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
94
85
|
const wallet = yield this.getWallet();
|
|
95
86
|
return wallet === null || wallet === void 0 ? void 0 : wallet.provider;
|
|
@@ -97,7 +88,7 @@ class StarknetWalletConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
97
88
|
}
|
|
98
89
|
signMessage(messageToSign) {
|
|
99
90
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
100
|
-
const wallet =
|
|
91
|
+
const wallet = this.getWallet();
|
|
101
92
|
const walletAddress = yield this.fetchPublicAddress();
|
|
102
93
|
if (!walletAddress || !wallet) {
|
|
103
94
|
walletConnectorCore.logger.error('Could not fetch wallet address for signing message');
|
|
@@ -111,7 +102,7 @@ class StarknetWalletConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
111
102
|
getBalance() {
|
|
112
103
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
113
104
|
const walletAddress = yield this.fetchPublicAddress();
|
|
114
|
-
const provider = yield this.
|
|
105
|
+
const provider = yield this.getWalletClient();
|
|
115
106
|
if (!walletAddress || !provider) {
|
|
116
107
|
walletConnectorCore.logger.error('Could not fetch wallet address for getting balance');
|
|
117
108
|
return undefined;
|
|
@@ -135,23 +126,25 @@ class StarknetWalletConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
135
126
|
getStarknetCore.getStarknet().disconnect({ clearLastWallet: true });
|
|
136
127
|
});
|
|
137
128
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
if (
|
|
129
|
+
getWallet() {
|
|
130
|
+
let starknetWindowInstance = window[`starknet_${this.windowKey}`];
|
|
131
|
+
if (starknetWindowInstance !== undefined) {
|
|
141
132
|
return starknetWindowInstance;
|
|
142
133
|
}
|
|
143
134
|
else {
|
|
144
|
-
|
|
135
|
+
starknetWindowInstance = window['starknet'];
|
|
136
|
+
if ((starknetWindowInstance === null || starknetWindowInstance === void 0 ? void 0 : starknetWindowInstance.name) === this.name) {
|
|
137
|
+
return starknetWindowInstance;
|
|
138
|
+
}
|
|
145
139
|
}
|
|
140
|
+
return undefined;
|
|
146
141
|
}
|
|
147
142
|
isInstalledOnBrowser() {
|
|
148
|
-
|
|
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;
|
|
143
|
+
return this.getWallet() !== undefined;
|
|
151
144
|
}
|
|
152
145
|
getConnectedAccounts() {
|
|
153
146
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
154
|
-
const wallet =
|
|
147
|
+
const wallet = this.getWallet();
|
|
155
148
|
if (!wallet) {
|
|
156
149
|
return [];
|
|
157
150
|
}
|
|
@@ -163,7 +156,7 @@ class StarknetWalletConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
163
156
|
});
|
|
164
157
|
}
|
|
165
158
|
setupEventListeners() {
|
|
166
|
-
const wallet = this.
|
|
159
|
+
const wallet = this.getWallet();
|
|
167
160
|
if (!wallet) {
|
|
168
161
|
return walletConnectorCore.logger.error('Wallet has not been found');
|
|
169
162
|
}
|
|
@@ -186,7 +179,7 @@ class StarknetWalletConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
186
179
|
this.emit('disconnect');
|
|
187
180
|
return;
|
|
188
181
|
}
|
|
189
|
-
const chain = this.
|
|
182
|
+
const chain = this.mapNetworkNameToChainId(network.toString());
|
|
190
183
|
if (chain) {
|
|
191
184
|
this.emit('chainChange', { chain });
|
|
192
185
|
}
|
|
@@ -196,7 +189,7 @@ class StarknetWalletConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
196
189
|
}
|
|
197
190
|
teardownEventListeners() {
|
|
198
191
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
199
|
-
const wallet =
|
|
192
|
+
const wallet = this.getWallet();
|
|
200
193
|
if (this.handleAccountChange) {
|
|
201
194
|
wallet === null || wallet === void 0 ? void 0 : wallet.off(ACCOUNT_CHANGED_EVENT_LISTENER, this.handleAccountChange);
|
|
202
195
|
this.handleAccountChange = undefined;
|
|
@@ -207,14 +200,19 @@ class StarknetWalletConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
207
200
|
}
|
|
208
201
|
});
|
|
209
202
|
}
|
|
210
|
-
|
|
211
|
-
if (
|
|
203
|
+
mapNetworkNameToChainId(networkName) {
|
|
204
|
+
if (networkName === starknet.constants.NetworkName.SN_MAIN ||
|
|
205
|
+
networkName.includes('mainnet')) {
|
|
212
206
|
return starknet.constants.StarknetChainId.SN_MAIN;
|
|
213
207
|
}
|
|
214
|
-
else if (
|
|
208
|
+
else if (networkName === starknet.constants.NetworkName.SN_GOERLI ||
|
|
209
|
+
networkName.includes('goerli')) {
|
|
215
210
|
return starknet.constants.StarknetChainId.SN_GOERLI;
|
|
216
211
|
}
|
|
217
|
-
|
|
212
|
+
else {
|
|
213
|
+
walletConnectorCore.logger.error('Unknown networkName', networkName);
|
|
214
|
+
return undefined;
|
|
215
|
+
}
|
|
218
216
|
}
|
|
219
217
|
}
|
|
220
218
|
|
|
@@ -26,7 +26,7 @@ declare abstract class StarknetWalletConnector extends WalletConnectorBase {
|
|
|
26
26
|
starknetNetworks: NetworkConfiguration[];
|
|
27
27
|
walletBook: WalletBookSchema;
|
|
28
28
|
});
|
|
29
|
-
|
|
29
|
+
getPublicClient(): Promise<RpcProvider>;
|
|
30
30
|
/**
|
|
31
31
|
* returns stakrnet wallet network id
|
|
32
32
|
*/
|
|
@@ -34,17 +34,16 @@ declare abstract class StarknetWalletConnector extends WalletConnectorBase {
|
|
|
34
34
|
connect(): Promise<void>;
|
|
35
35
|
fetchPublicAddress(): Promise<string | undefined>;
|
|
36
36
|
getSigner(): Promise<AccountInterface | undefined>;
|
|
37
|
-
|
|
38
|
-
getWeb3Provider(): Promise<ProviderInterface | undefined>;
|
|
37
|
+
getWalletClient(): Promise<ProviderInterface | undefined>;
|
|
39
38
|
signMessage(messageToSign: string): Promise<string | undefined>;
|
|
40
39
|
getBalance(): Promise<string | undefined>;
|
|
41
40
|
endSession(): Promise<void>;
|
|
42
|
-
|
|
41
|
+
getWallet(): StarknetWindowObject | undefined;
|
|
43
42
|
isInstalledOnBrowser(): boolean;
|
|
44
43
|
getConnectedAccounts(): Promise<string[]>;
|
|
45
44
|
setupEventListeners(): void;
|
|
46
45
|
teardownEventListeners(): Promise<void>;
|
|
47
|
-
|
|
46
|
+
mapNetworkNameToChainId(networkName: string): constants.StarknetChainId | undefined;
|
|
48
47
|
}
|
|
49
48
|
export type StarknetWalletConnectorType = StarknetWalletConnector;
|
|
50
49
|
export default StarknetWalletConnector;
|
|
@@ -20,7 +20,7 @@ class StarknetWalletConnector extends WalletConnectorBase {
|
|
|
20
20
|
this.windowKey = windowKey;
|
|
21
21
|
this.starknetNetworks = opts.starknetNetworks;
|
|
22
22
|
}
|
|
23
|
-
|
|
23
|
+
getPublicClient() {
|
|
24
24
|
var _a, _b;
|
|
25
25
|
const nodeUrl = (_b = (_a = this.starknetNetworks) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.rpcUrls[0];
|
|
26
26
|
if (!nodeUrl) {
|
|
@@ -34,7 +34,7 @@ class StarknetWalletConnector extends WalletConnectorBase {
|
|
|
34
34
|
getNetwork() {
|
|
35
35
|
var _a;
|
|
36
36
|
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
-
const wallet =
|
|
37
|
+
const wallet = this.getWallet();
|
|
38
38
|
if (!wallet) {
|
|
39
39
|
return Promise.resolve(undefined);
|
|
40
40
|
}
|
|
@@ -46,7 +46,7 @@ class StarknetWalletConnector extends WalletConnectorBase {
|
|
|
46
46
|
}
|
|
47
47
|
connect() {
|
|
48
48
|
return __awaiter(this, void 0, void 0, function* () {
|
|
49
|
-
const wallet =
|
|
49
|
+
const wallet = this.getWallet();
|
|
50
50
|
try {
|
|
51
51
|
if (wallet && !wallet.isConnected) {
|
|
52
52
|
yield wallet.enable({ starknetVersion: STARKNET_VERSION });
|
|
@@ -59,7 +59,7 @@ class StarknetWalletConnector extends WalletConnectorBase {
|
|
|
59
59
|
}
|
|
60
60
|
fetchPublicAddress() {
|
|
61
61
|
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
-
const wallet =
|
|
62
|
+
const wallet = this.getWallet();
|
|
63
63
|
/**
|
|
64
64
|
* Fetches public address. Uses `isPreauthorized` as a temporary solution to ensure
|
|
65
65
|
* the wallets store's data is read. Without it, an empty string may be returned due
|
|
@@ -72,20 +72,11 @@ class StarknetWalletConnector extends WalletConnectorBase {
|
|
|
72
72
|
}
|
|
73
73
|
getSigner() {
|
|
74
74
|
return __awaiter(this, void 0, void 0, function* () {
|
|
75
|
-
const wallet =
|
|
75
|
+
const wallet = this.getWallet();
|
|
76
76
|
return wallet === null || wallet === void 0 ? void 0 : wallet.account;
|
|
77
77
|
});
|
|
78
78
|
}
|
|
79
|
-
|
|
80
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
81
|
-
if (!this.wallet) {
|
|
82
|
-
const providers = yield getStarknet().getAvailableWallets();
|
|
83
|
-
this.wallet = providers.find((provider) => provider.name === this.name);
|
|
84
|
-
}
|
|
85
|
-
return this.wallet;
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
getWeb3Provider() {
|
|
79
|
+
getWalletClient() {
|
|
89
80
|
return __awaiter(this, void 0, void 0, function* () {
|
|
90
81
|
const wallet = yield this.getWallet();
|
|
91
82
|
return wallet === null || wallet === void 0 ? void 0 : wallet.provider;
|
|
@@ -93,7 +84,7 @@ class StarknetWalletConnector extends WalletConnectorBase {
|
|
|
93
84
|
}
|
|
94
85
|
signMessage(messageToSign) {
|
|
95
86
|
return __awaiter(this, void 0, void 0, function* () {
|
|
96
|
-
const wallet =
|
|
87
|
+
const wallet = this.getWallet();
|
|
97
88
|
const walletAddress = yield this.fetchPublicAddress();
|
|
98
89
|
if (!walletAddress || !wallet) {
|
|
99
90
|
logger.error('Could not fetch wallet address for signing message');
|
|
@@ -107,7 +98,7 @@ class StarknetWalletConnector extends WalletConnectorBase {
|
|
|
107
98
|
getBalance() {
|
|
108
99
|
return __awaiter(this, void 0, void 0, function* () {
|
|
109
100
|
const walletAddress = yield this.fetchPublicAddress();
|
|
110
|
-
const provider = yield this.
|
|
101
|
+
const provider = yield this.getWalletClient();
|
|
111
102
|
if (!walletAddress || !provider) {
|
|
112
103
|
logger.error('Could not fetch wallet address for getting balance');
|
|
113
104
|
return undefined;
|
|
@@ -131,23 +122,25 @@ class StarknetWalletConnector extends WalletConnectorBase {
|
|
|
131
122
|
getStarknet().disconnect({ clearLastWallet: true });
|
|
132
123
|
});
|
|
133
124
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
if (
|
|
125
|
+
getWallet() {
|
|
126
|
+
let starknetWindowInstance = window[`starknet_${this.windowKey}`];
|
|
127
|
+
if (starknetWindowInstance !== undefined) {
|
|
137
128
|
return starknetWindowInstance;
|
|
138
129
|
}
|
|
139
130
|
else {
|
|
140
|
-
|
|
131
|
+
starknetWindowInstance = window['starknet'];
|
|
132
|
+
if ((starknetWindowInstance === null || starknetWindowInstance === void 0 ? void 0 : starknetWindowInstance.name) === this.name) {
|
|
133
|
+
return starknetWindowInstance;
|
|
134
|
+
}
|
|
141
135
|
}
|
|
136
|
+
return undefined;
|
|
142
137
|
}
|
|
143
138
|
isInstalledOnBrowser() {
|
|
144
|
-
|
|
145
|
-
const starknetWindowInstance = (_a = window[`starknet_${this.windowKey}`]) !== null && _a !== void 0 ? _a : window['starknet'];
|
|
146
|
-
return (starknetWindowInstance === null || starknetWindowInstance === void 0 ? void 0 : starknetWindowInstance.name) === this.name;
|
|
139
|
+
return this.getWallet() !== undefined;
|
|
147
140
|
}
|
|
148
141
|
getConnectedAccounts() {
|
|
149
142
|
return __awaiter(this, void 0, void 0, function* () {
|
|
150
|
-
const wallet =
|
|
143
|
+
const wallet = this.getWallet();
|
|
151
144
|
if (!wallet) {
|
|
152
145
|
return [];
|
|
153
146
|
}
|
|
@@ -159,7 +152,7 @@ class StarknetWalletConnector extends WalletConnectorBase {
|
|
|
159
152
|
});
|
|
160
153
|
}
|
|
161
154
|
setupEventListeners() {
|
|
162
|
-
const wallet = this.
|
|
155
|
+
const wallet = this.getWallet();
|
|
163
156
|
if (!wallet) {
|
|
164
157
|
return logger.error('Wallet has not been found');
|
|
165
158
|
}
|
|
@@ -182,7 +175,7 @@ class StarknetWalletConnector extends WalletConnectorBase {
|
|
|
182
175
|
this.emit('disconnect');
|
|
183
176
|
return;
|
|
184
177
|
}
|
|
185
|
-
const chain = this.
|
|
178
|
+
const chain = this.mapNetworkNameToChainId(network.toString());
|
|
186
179
|
if (chain) {
|
|
187
180
|
this.emit('chainChange', { chain });
|
|
188
181
|
}
|
|
@@ -192,7 +185,7 @@ class StarknetWalletConnector extends WalletConnectorBase {
|
|
|
192
185
|
}
|
|
193
186
|
teardownEventListeners() {
|
|
194
187
|
return __awaiter(this, void 0, void 0, function* () {
|
|
195
|
-
const wallet =
|
|
188
|
+
const wallet = this.getWallet();
|
|
196
189
|
if (this.handleAccountChange) {
|
|
197
190
|
wallet === null || wallet === void 0 ? void 0 : wallet.off(ACCOUNT_CHANGED_EVENT_LISTENER, this.handleAccountChange);
|
|
198
191
|
this.handleAccountChange = undefined;
|
|
@@ -203,14 +196,19 @@ class StarknetWalletConnector extends WalletConnectorBase {
|
|
|
203
196
|
}
|
|
204
197
|
});
|
|
205
198
|
}
|
|
206
|
-
|
|
207
|
-
if (
|
|
199
|
+
mapNetworkNameToChainId(networkName) {
|
|
200
|
+
if (networkName === constants.NetworkName.SN_MAIN ||
|
|
201
|
+
networkName.includes('mainnet')) {
|
|
208
202
|
return constants.StarknetChainId.SN_MAIN;
|
|
209
203
|
}
|
|
210
|
-
else if (
|
|
204
|
+
else if (networkName === constants.NetworkName.SN_GOERLI ||
|
|
205
|
+
networkName.includes('goerli')) {
|
|
211
206
|
return constants.StarknetChainId.SN_GOERLI;
|
|
212
207
|
}
|
|
213
|
-
|
|
208
|
+
else {
|
|
209
|
+
logger.error('Unknown networkName', networkName);
|
|
210
|
+
return undefined;
|
|
211
|
+
}
|
|
214
212
|
}
|
|
215
213
|
}
|
|
216
214
|
|