@dynamic-labs/solana 0.19.0-alpha.5 → 0.19.0-alpha.7
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 +39 -0
- package/package.json +7 -6
- package/src/CoinbaseSolana.cjs +2 -2
- package/src/CoinbaseSolana.d.ts +1 -2
- package/src/CoinbaseSolana.js +2 -2
- package/src/Glow.cjs +2 -2
- package/src/Glow.d.ts +1 -2
- package/src/Glow.js +2 -2
- package/src/Solflare.cjs +2 -2
- package/src/Solflare.d.ts +1 -2
- package/src/Solflare.js +2 -2
- package/src/injected/BackpackSol.cjs +3 -3
- package/src/injected/BackpackSol.d.ts +1 -2
- package/src/injected/BackpackSol.js +3 -3
- package/src/injected/InjectedWalletBase.cjs +2 -2
- package/src/injected/InjectedWalletBase.d.ts +1 -2
- package/src/injected/InjectedWalletBase.js +2 -2
- package/src/solProviderHelper.cjs +9 -11
- package/src/solProviderHelper.d.ts +3 -4
- package/src/solProviderHelper.js +9 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,43 @@
|
|
|
1
1
|
|
|
2
|
+
## [0.19.0-alpha.7](https://github.com/dynamic-labs/DynamicAuth/compare/v0.19.0-alpha.6...v0.19.0-alpha.7) (2023-08-31)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* include deepLinkPreference option for wallet connect deep linking mode ([#3174](https://github.com/dynamic-labs/DynamicAuth/issues/3174)) ([f715948](https://github.com/dynamic-labs/DynamicAuth/commit/f715948050ddab52373ab742ea47cfc0879842ae))
|
|
8
|
+
* add option to disable the locked wallet view ([#3184](https://github.com/dynamic-labs/DynamicAuth/issues/3184)) ([d9a1290](https://github.com/dynamic-labs/DynamicAuth/commit/d9a1290214b7f86337abb544acd96f65ffe37759))
|
|
9
|
+
* migrate starknet version to v5 ([#3153](https://github.com/dynamic-labs/DynamicAuth/issues/3153)) ([b674011](https://github.com/dynamic-labs/DynamicAuth/commit/b67401133bf75d416118b51be11e3f099d2e2cda))
|
|
10
|
+
* add editable text with react i18next ([#3170](https://github.com/dynamic-labs/DynamicAuth/issues/3170)) ([a46b2ca](https://github.com/dynamic-labs/DynamicAuth/commit/a46b2ca880a4e14356024d2936920f72c8bc447e))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* allow to select L2 wallet after changing L1 network ([#3158](https://github.com/dynamic-labs/DynamicAuth/issues/3158)) ([cf68472](https://github.com/dynamic-labs/DynamicAuth/commit/cf6847270181f7fd33537ac1ff2a03e70b67daf2))
|
|
16
|
+
* allow user to cancel magic login to choose another email ([#3123](https://github.com/dynamic-labs/DynamicAuth/issues/3123)) ([cd73d6d](https://github.com/dynamic-labs/DynamicAuth/commit/cd73d6d0500c313dda01bca6245c52d2d8fca93a))
|
|
17
|
+
* verify email OTP when email is updated ([#3168](https://github.com/dynamic-labs/DynamicAuth/issues/3168)) ([641eeb6](https://github.com/dynamic-labs/DynamicAuth/commit/641eeb685b0c9d77cc72912f29b137c699c192f0))
|
|
18
|
+
* end connector session when unlinking in bridge ([#3120](https://github.com/dynamic-labs/DynamicAuth/issues/3120)) ([4c15da2](https://github.com/dynamic-labs/DynamicAuth/commit/4c15da27646c7bd176f6080dee6d76833e30f8a1))
|
|
19
|
+
* improves loading the sdk setting once per session ([#3189](https://github.com/dynamic-labs/DynamicAuth/issues/3189)) ([c9b0241](https://github.com/dynamic-labs/DynamicAuth/commit/c9b0241da28d2a73c90fd7643280c8632772c90b))
|
|
20
|
+
* update wallet address when switching network on bridge ([#3171](https://github.com/dynamic-labs/DynamicAuth/issues/3171)) ([f35f35e](https://github.com/dynamic-labs/DynamicAuth/commit/f35f35e632bcf88794884b66e0466cdf2e924812))
|
|
21
|
+
* updates the user email when updateUserWithModal method is used ([#3186](https://github.com/dynamic-labs/DynamicAuth/issues/3186)) ([8c71863](https://github.com/dynamic-labs/DynamicAuth/commit/8c718632cef0165328b929c27b6eef313641458d))
|
|
22
|
+
* sign message for embedded wallet when auth mode is connect only ([#3185](https://github.com/dynamic-labs/DynamicAuth/issues/3185)) ([0e3859c](https://github.com/dynamic-labs/DynamicAuth/commit/0e3859cfc738d3ecf8f19976e5cdaebc0c4f01c9))
|
|
23
|
+
* sync wagmi with wallet connector ([#3149](https://github.com/dynamic-labs/DynamicAuth/issues/3149)) ([3216e15](https://github.com/dynamic-labs/DynamicAuth/commit/3216e1570ac12ded6b3ce50b7efb762fe6814815))
|
|
24
|
+
|
|
25
|
+
## [0.19.0-alpha.6](https://github.com/dynamic-labs/DynamicAuth/compare/v0.19.0-alpha.5...v0.19.0-alpha.6) (2023-08-25)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Features
|
|
29
|
+
|
|
30
|
+
* optionally split up email and social and change their display order in login view ([#3125](https://github.com/dynamic-labs/DynamicAuth/issues/3125)) ([ee82d26](https://github.com/dynamic-labs/DynamicAuth/commit/ee82d264eb3cb7f4ca7eb33369ef5409fe6860e4))
|
|
31
|
+
* post a connection request for second wallet ([#3113](https://github.com/dynamic-labs/DynamicAuth/issues/3113)) ([630aefa](https://github.com/dynamic-labs/DynamicAuth/commit/630aefa5ce83278082db1e3cd419c03e4fd081c7))
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### Bug Fixes
|
|
35
|
+
|
|
36
|
+
* fix bug where user was not able to confirm last wallet transfer ([#3102](https://github.com/dynamic-labs/DynamicAuth/issues/3102)) ([453b4c2](https://github.com/dynamic-labs/DynamicAuth/commit/453b4c20ea8f09d92dda11cdf92ddab562096d6f))
|
|
37
|
+
* fix github social linking icon on dark mode ([#3126](https://github.com/dynamic-labs/DynamicAuth/issues/3126)) ([6a8f3e3](https://github.com/dynamic-labs/DynamicAuth/commit/6a8f3e3d6e43d76b428e169fd5ead9ee0e2ec43d))
|
|
38
|
+
* fix issue with detecting oauth window closed before finishing linking ([#3124](https://github.com/dynamic-labs/DynamicAuth/issues/3124)) ([6a80ee9](https://github.com/dynamic-labs/DynamicAuth/commit/6a80ee97deb54e5b62bf2285d71b03c36802c5d2))
|
|
39
|
+
* stop calling handleLogOut prematurely ([#3135](https://github.com/dynamic-labs/DynamicAuth/issues/3135)) ([e7c81ad](https://github.com/dynamic-labs/DynamicAuth/commit/e7c81ad7e9e9cff03e5d2ca1e0fb7cfea083d06e))
|
|
40
|
+
|
|
2
41
|
## [0.19.0-alpha.5](https://github.com/dynamic-labs/DynamicAuth/compare/v0.19.0-alpha.4...v0.19.0-alpha.5) (2023-08-24)
|
|
3
42
|
|
|
4
43
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/solana",
|
|
3
|
-
"version": "0.19.0-alpha.
|
|
3
|
+
"version": "0.19.0-alpha.7",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/dynamic-labs/DynamicAuth.git",
|
|
@@ -27,11 +27,12 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@solana/web3.js": "1.70.1",
|
|
30
|
-
"@dynamic-labs/rpc-providers": "0.19.0-alpha.
|
|
31
|
-
"@dynamic-labs/types": "0.19.0-alpha.
|
|
32
|
-
"@dynamic-labs/utils": "0.19.0-alpha.
|
|
33
|
-
"@dynamic-labs/wallet-book": "0.19.0-alpha.
|
|
34
|
-
"@dynamic-labs/wallet-connector-core": "0.19.0-alpha.
|
|
30
|
+
"@dynamic-labs/rpc-providers": "0.19.0-alpha.7",
|
|
31
|
+
"@dynamic-labs/types": "0.19.0-alpha.7",
|
|
32
|
+
"@dynamic-labs/utils": "0.19.0-alpha.7",
|
|
33
|
+
"@dynamic-labs/wallet-book": "0.19.0-alpha.7",
|
|
34
|
+
"@dynamic-labs/wallet-connector-core": "0.19.0-alpha.7",
|
|
35
|
+
"eventemitter3": "5.0.1"
|
|
35
36
|
},
|
|
36
37
|
"peerDependencies": {}
|
|
37
38
|
}
|
package/src/CoinbaseSolana.cjs
CHANGED
|
@@ -11,8 +11,8 @@ class CoinbaseSolana extends solWalletConnector.SolWalletConnector {
|
|
|
11
11
|
super(...arguments);
|
|
12
12
|
this.name = 'CoinbaseSolana';
|
|
13
13
|
}
|
|
14
|
-
setupEventListeners(
|
|
15
|
-
solProviderHelper.SolProviderHelper._setupEventListeners(
|
|
14
|
+
setupEventListeners() {
|
|
15
|
+
solProviderHelper.SolProviderHelper._setupEventListeners(this, solProviderHelper.SolProviderHelper.findProvider(this.name));
|
|
16
16
|
}
|
|
17
17
|
teardownEventListeners() {
|
|
18
18
|
solProviderHelper.SolProviderHelper._teardownEventListeners(this.name);
|
package/src/CoinbaseSolana.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { WalletEventListeners } from '@dynamic-labs/wallet-connector-core';
|
|
2
1
|
import { SolWalletConnector } from './solWalletConnector';
|
|
3
2
|
import { ISolana } from './types';
|
|
4
3
|
export declare class CoinbaseSolana extends SolWalletConnector {
|
|
5
4
|
name: string;
|
|
6
|
-
setupEventListeners(
|
|
5
|
+
setupEventListeners(): void;
|
|
7
6
|
teardownEventListeners(): void;
|
|
8
7
|
connect(): Promise<void>;
|
|
9
8
|
getSigner(): Promise<ISolana | undefined>;
|
package/src/CoinbaseSolana.js
CHANGED
|
@@ -7,8 +7,8 @@ class CoinbaseSolana extends SolWalletConnector {
|
|
|
7
7
|
super(...arguments);
|
|
8
8
|
this.name = 'CoinbaseSolana';
|
|
9
9
|
}
|
|
10
|
-
setupEventListeners(
|
|
11
|
-
SolProviderHelper._setupEventListeners(
|
|
10
|
+
setupEventListeners() {
|
|
11
|
+
SolProviderHelper._setupEventListeners(this, SolProviderHelper.findProvider(this.name));
|
|
12
12
|
}
|
|
13
13
|
teardownEventListeners() {
|
|
14
14
|
SolProviderHelper._teardownEventListeners(this.name);
|
package/src/Glow.cjs
CHANGED
|
@@ -11,8 +11,8 @@ class Glow extends solWalletConnector.SolWalletConnector {
|
|
|
11
11
|
super(...arguments);
|
|
12
12
|
this.name = 'Glow';
|
|
13
13
|
}
|
|
14
|
-
setupEventListeners(
|
|
15
|
-
solProviderHelper.SolProviderHelper._setupEventListeners(
|
|
14
|
+
setupEventListeners() {
|
|
15
|
+
solProviderHelper.SolProviderHelper._setupEventListeners(this, solProviderHelper.SolProviderHelper.findProvider(this.name));
|
|
16
16
|
}
|
|
17
17
|
teardownEventListeners() {
|
|
18
18
|
solProviderHelper.SolProviderHelper._teardownEventListeners(this.name);
|
package/src/Glow.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { WalletEventListeners } from '@dynamic-labs/wallet-connector-core';
|
|
2
1
|
import { SolWalletConnector } from './solWalletConnector';
|
|
3
2
|
export declare class Glow extends SolWalletConnector {
|
|
4
3
|
name: string;
|
|
5
|
-
setupEventListeners(
|
|
4
|
+
setupEventListeners(): void;
|
|
6
5
|
teardownEventListeners(): void;
|
|
7
6
|
connect(): Promise<void>;
|
|
8
7
|
getSigner(): Promise<import("./types").ISolana | undefined>;
|
package/src/Glow.js
CHANGED
|
@@ -7,8 +7,8 @@ class Glow extends SolWalletConnector {
|
|
|
7
7
|
super(...arguments);
|
|
8
8
|
this.name = 'Glow';
|
|
9
9
|
}
|
|
10
|
-
setupEventListeners(
|
|
11
|
-
SolProviderHelper._setupEventListeners(
|
|
10
|
+
setupEventListeners() {
|
|
11
|
+
SolProviderHelper._setupEventListeners(this, SolProviderHelper.findProvider(this.name));
|
|
12
12
|
}
|
|
13
13
|
teardownEventListeners() {
|
|
14
14
|
SolProviderHelper._teardownEventListeners(this.name);
|
package/src/Solflare.cjs
CHANGED
|
@@ -61,8 +61,8 @@ class Solflare extends solWalletConnector.SolWalletConnector {
|
|
|
61
61
|
return solProviderHelper.SolProviderHelper.getConnectedAccountsWithName(this.name);
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
|
-
setupEventListeners(
|
|
65
|
-
solProviderHelper.SolProviderHelper._setupEventListeners(
|
|
64
|
+
setupEventListeners() {
|
|
65
|
+
solProviderHelper.SolProviderHelper._setupEventListeners(this, solProviderHelper.SolProviderHelper.findProvider(this.name));
|
|
66
66
|
}
|
|
67
67
|
teardownEventListeners() {
|
|
68
68
|
solProviderHelper.SolProviderHelper._teardownEventListeners(this.name);
|
package/src/Solflare.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { WalletEventListeners } from '@dynamic-labs/wallet-connector-core';
|
|
2
1
|
import { SolWalletConnector } from './solWalletConnector';
|
|
3
2
|
import { ISolana } from './types';
|
|
4
3
|
export declare class Solflare extends SolWalletConnector {
|
|
@@ -9,6 +8,6 @@ export declare class Solflare extends SolWalletConnector {
|
|
|
9
8
|
getSigner(): Promise<ISolana | undefined>;
|
|
10
9
|
signMessage(messageToSign: string): Promise<string | undefined>;
|
|
11
10
|
getConnectedAccounts(): Promise<string[]>;
|
|
12
|
-
setupEventListeners(
|
|
11
|
+
setupEventListeners(): void;
|
|
13
12
|
teardownEventListeners(): void;
|
|
14
13
|
}
|
package/src/Solflare.js
CHANGED
|
@@ -57,8 +57,8 @@ class Solflare extends SolWalletConnector {
|
|
|
57
57
|
return SolProviderHelper.getConnectedAccountsWithName(this.name);
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
|
-
setupEventListeners(
|
|
61
|
-
SolProviderHelper._setupEventListeners(
|
|
60
|
+
setupEventListeners() {
|
|
61
|
+
SolProviderHelper._setupEventListeners(this, SolProviderHelper.findProvider(this.name));
|
|
62
62
|
}
|
|
63
63
|
teardownEventListeners() {
|
|
64
64
|
SolProviderHelper._teardownEventListeners(this.name);
|
|
@@ -12,12 +12,12 @@ class BackpackSol extends InjectedWalletBase.InjectedWalletBase {
|
|
|
12
12
|
super(...arguments);
|
|
13
13
|
this.name = 'BackpackSol';
|
|
14
14
|
}
|
|
15
|
-
setupEventListeners(
|
|
15
|
+
setupEventListeners() {
|
|
16
16
|
const web3Provider = solProviderHelper.SolProviderHelper.findProvider(this.name);
|
|
17
17
|
if (!web3Provider)
|
|
18
18
|
return;
|
|
19
|
-
web3Provider === null || web3Provider === void 0 ? void 0 : web3Provider.on('activeWalletDidChange', (publicKey) => solProviderHelper.SolProviderHelper.handleAccountChange(
|
|
20
|
-
solProviderHelper.SolProviderHelper._setupEventListeners(
|
|
19
|
+
web3Provider === null || web3Provider === void 0 ? void 0 : web3Provider.on('activeWalletDidChange', (publicKey) => solProviderHelper.SolProviderHelper.handleAccountChange(this, web3Provider, publicKey));
|
|
20
|
+
solProviderHelper.SolProviderHelper._setupEventListeners(this, web3Provider);
|
|
21
21
|
}
|
|
22
22
|
fetchPublicAddress() {
|
|
23
23
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { WalletEventListeners } from '@dynamic-labs/wallet-connector-core';
|
|
2
1
|
import { ISolana } from '../types';
|
|
3
2
|
import { InjectedWalletBase } from './InjectedWalletBase';
|
|
4
3
|
export declare class BackpackSol extends InjectedWalletBase {
|
|
5
4
|
name: string;
|
|
6
|
-
setupEventListeners(
|
|
5
|
+
setupEventListeners(): void;
|
|
7
6
|
fetchPublicAddress(): Promise<string | undefined>;
|
|
8
7
|
getSigner(): Promise<ISolana | undefined>;
|
|
9
8
|
signMessage(messageToSign: string): Promise<string | undefined>;
|
|
@@ -8,12 +8,12 @@ class BackpackSol extends InjectedWalletBase {
|
|
|
8
8
|
super(...arguments);
|
|
9
9
|
this.name = 'BackpackSol';
|
|
10
10
|
}
|
|
11
|
-
setupEventListeners(
|
|
11
|
+
setupEventListeners() {
|
|
12
12
|
const web3Provider = SolProviderHelper.findProvider(this.name);
|
|
13
13
|
if (!web3Provider)
|
|
14
14
|
return;
|
|
15
|
-
web3Provider === null || web3Provider === void 0 ? void 0 : web3Provider.on('activeWalletDidChange', (publicKey) => SolProviderHelper.handleAccountChange(
|
|
16
|
-
SolProviderHelper._setupEventListeners(
|
|
15
|
+
web3Provider === null || web3Provider === void 0 ? void 0 : web3Provider.on('activeWalletDidChange', (publicKey) => SolProviderHelper.handleAccountChange(this, web3Provider, publicKey));
|
|
16
|
+
SolProviderHelper._setupEventListeners(this, web3Provider);
|
|
17
17
|
}
|
|
18
18
|
fetchPublicAddress() {
|
|
19
19
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -8,8 +8,8 @@ var solWalletConnector = require('../solWalletConnector.cjs');
|
|
|
8
8
|
var solProviderHelper = require('../solProviderHelper.cjs');
|
|
9
9
|
|
|
10
10
|
class InjectedWalletBase extends solWalletConnector.SolWalletConnector {
|
|
11
|
-
setupEventListeners(
|
|
12
|
-
solProviderHelper.SolProviderHelper._setupEventListeners(
|
|
11
|
+
setupEventListeners() {
|
|
12
|
+
solProviderHelper.SolProviderHelper._setupEventListeners(this, solProviderHelper.SolProviderHelper.findProvider(this.name));
|
|
13
13
|
}
|
|
14
14
|
teardownEventListeners() {
|
|
15
15
|
solProviderHelper.SolProviderHelper._teardownEventListeners(this.name);
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { WalletEventListeners } from '@dynamic-labs/wallet-connector-core';
|
|
2
1
|
import { SolWalletConnector } from '../solWalletConnector';
|
|
3
2
|
import { IBackpackSolana, ISolana } from '../types';
|
|
4
3
|
export declare abstract class InjectedWalletBase extends SolWalletConnector {
|
|
5
|
-
setupEventListeners(
|
|
4
|
+
setupEventListeners(): void;
|
|
6
5
|
teardownEventListeners(): void;
|
|
7
6
|
connect(): Promise<void>;
|
|
8
7
|
getSigner(): Promise<ISolana | IBackpackSolana | undefined>;
|
|
@@ -4,8 +4,8 @@ import { SolWalletConnector } from '../solWalletConnector.js';
|
|
|
4
4
|
import { SolProviderHelper } from '../solProviderHelper.js';
|
|
5
5
|
|
|
6
6
|
class InjectedWalletBase extends SolWalletConnector {
|
|
7
|
-
setupEventListeners(
|
|
8
|
-
SolProviderHelper._setupEventListeners(
|
|
7
|
+
setupEventListeners() {
|
|
8
|
+
SolProviderHelper._setupEventListeners(this, SolProviderHelper.findProvider(this.name));
|
|
9
9
|
}
|
|
10
10
|
teardownEventListeners() {
|
|
11
11
|
SolProviderHelper._teardownEventListeners(this.name);
|
|
@@ -81,9 +81,9 @@ class SolProviderHelper {
|
|
|
81
81
|
.signature);
|
|
82
82
|
});
|
|
83
83
|
}
|
|
84
|
-
static _setupEventListeners(
|
|
85
|
-
web3Provider === null || web3Provider === void 0 ? void 0 : web3Provider.on('accountChanged', (publicKey) => this.handleAccountChange(
|
|
86
|
-
web3Provider === null || web3Provider === void 0 ? void 0 : web3Provider.on('disconnect', () =>
|
|
84
|
+
static _setupEventListeners(walletConnector, web3Provider) {
|
|
85
|
+
web3Provider === null || web3Provider === void 0 ? void 0 : web3Provider.on('accountChanged', (publicKey) => this.handleAccountChange(walletConnector, web3Provider, publicKey));
|
|
86
|
+
web3Provider === null || web3Provider === void 0 ? void 0 : web3Provider.on('disconnect', () => walletConnector.emit('disconnect'));
|
|
87
87
|
}
|
|
88
88
|
static _teardownEventListeners(name) {
|
|
89
89
|
const web3Provider = this.findProvider(name);
|
|
@@ -153,22 +153,20 @@ SolProviderHelper.providers = {
|
|
|
153
153
|
phantomledger: _a.PhantomProvider,
|
|
154
154
|
solflare: _a.SolflareProvider,
|
|
155
155
|
};
|
|
156
|
-
SolProviderHelper.handleAccountChange = (
|
|
157
|
-
var _b
|
|
156
|
+
SolProviderHelper.handleAccountChange = (walletConnector, web3Provider, address) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
157
|
+
var _b;
|
|
158
158
|
if (!address) {
|
|
159
159
|
yield (web3Provider === null || web3Provider === void 0 ? void 0 : web3Provider.connect());
|
|
160
160
|
if ((_b = web3Provider === null || web3Provider === void 0 ? void 0 : web3Provider.publicKey) === null || _b === void 0 ? void 0 : _b.toString()) {
|
|
161
|
-
|
|
161
|
+
walletConnector.emit('accountChange', {
|
|
162
|
+
accounts: [web3Provider.publicKey.toString()],
|
|
163
|
+
});
|
|
162
164
|
}
|
|
163
165
|
return;
|
|
164
166
|
}
|
|
165
167
|
if (address.toString()) {
|
|
166
|
-
|
|
168
|
+
walletConnector.emit('accountChange', { accounts: [address.toString()] });
|
|
167
169
|
}
|
|
168
|
-
});
|
|
169
|
-
SolProviderHelper.handleDisconnect = (listeners) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
170
|
-
var _e;
|
|
171
|
-
yield ((_e = listeners.onDisconnect) === null || _e === void 0 ? void 0 : _e.call(listeners));
|
|
172
170
|
});
|
|
173
171
|
|
|
174
172
|
exports.SolProviderHelper = SolProviderHelper;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ProviderCondition,
|
|
1
|
+
import { ProviderCondition, WalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
2
2
|
import { ISolana, ProviderFlag } from './types';
|
|
3
3
|
export interface SignedMessage {
|
|
4
4
|
signature: Uint8Array;
|
|
@@ -27,9 +27,8 @@ export declare class SolProviderHelper {
|
|
|
27
27
|
static fetchPublicAddressWithName(name: string): Promise<string | undefined>;
|
|
28
28
|
static connectWithName(name: string): Promise<ISolana | undefined>;
|
|
29
29
|
static signMessageWithName(messageToSign: string, name: string): Promise<string | undefined>;
|
|
30
|
-
static handleAccountChange: (
|
|
31
|
-
static
|
|
32
|
-
static _setupEventListeners(listeners: WalletEventListeners, web3Provider?: ISolana): void;
|
|
30
|
+
static handleAccountChange: (walletConnector: WalletConnector, web3Provider: ISolana, address: string) => Promise<void>;
|
|
31
|
+
static _setupEventListeners(walletConnector: WalletConnector, web3Provider?: ISolana): void;
|
|
33
32
|
static _teardownEventListeners(name: string): void;
|
|
34
33
|
static getConnectedAccountsWithName(name: string): Promise<string[]>;
|
|
35
34
|
}
|
package/src/solProviderHelper.js
CHANGED
|
@@ -77,9 +77,9 @@ class SolProviderHelper {
|
|
|
77
77
|
.signature);
|
|
78
78
|
});
|
|
79
79
|
}
|
|
80
|
-
static _setupEventListeners(
|
|
81
|
-
web3Provider === null || web3Provider === void 0 ? void 0 : web3Provider.on('accountChanged', (publicKey) => this.handleAccountChange(
|
|
82
|
-
web3Provider === null || web3Provider === void 0 ? void 0 : web3Provider.on('disconnect', () =>
|
|
80
|
+
static _setupEventListeners(walletConnector, web3Provider) {
|
|
81
|
+
web3Provider === null || web3Provider === void 0 ? void 0 : web3Provider.on('accountChanged', (publicKey) => this.handleAccountChange(walletConnector, web3Provider, publicKey));
|
|
82
|
+
web3Provider === null || web3Provider === void 0 ? void 0 : web3Provider.on('disconnect', () => walletConnector.emit('disconnect'));
|
|
83
83
|
}
|
|
84
84
|
static _teardownEventListeners(name) {
|
|
85
85
|
const web3Provider = this.findProvider(name);
|
|
@@ -149,22 +149,20 @@ SolProviderHelper.providers = {
|
|
|
149
149
|
phantomledger: _a.PhantomProvider,
|
|
150
150
|
solflare: _a.SolflareProvider,
|
|
151
151
|
};
|
|
152
|
-
SolProviderHelper.handleAccountChange = (
|
|
153
|
-
var _b
|
|
152
|
+
SolProviderHelper.handleAccountChange = (walletConnector, web3Provider, address) => __awaiter(void 0, void 0, void 0, function* () {
|
|
153
|
+
var _b;
|
|
154
154
|
if (!address) {
|
|
155
155
|
yield (web3Provider === null || web3Provider === void 0 ? void 0 : web3Provider.connect());
|
|
156
156
|
if ((_b = web3Provider === null || web3Provider === void 0 ? void 0 : web3Provider.publicKey) === null || _b === void 0 ? void 0 : _b.toString()) {
|
|
157
|
-
|
|
157
|
+
walletConnector.emit('accountChange', {
|
|
158
|
+
accounts: [web3Provider.publicKey.toString()],
|
|
159
|
+
});
|
|
158
160
|
}
|
|
159
161
|
return;
|
|
160
162
|
}
|
|
161
163
|
if (address.toString()) {
|
|
162
|
-
|
|
164
|
+
walletConnector.emit('accountChange', { accounts: [address.toString()] });
|
|
163
165
|
}
|
|
164
|
-
});
|
|
165
|
-
SolProviderHelper.handleDisconnect = (listeners) => __awaiter(void 0, void 0, void 0, function* () {
|
|
166
|
-
var _e;
|
|
167
|
-
yield ((_e = listeners.onDisconnect) === null || _e === void 0 ? void 0 : _e.call(listeners));
|
|
168
166
|
});
|
|
169
167
|
|
|
170
168
|
export { SolProviderHelper };
|