@dynamic-labs/solana 1.1.0-alpha.5 → 1.1.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 +25 -0
- package/package.json +6 -6
- package/src/CoinbaseSolana.cjs +19 -1
- package/src/CoinbaseSolana.d.ts +2 -2
- package/src/CoinbaseSolana.js +19 -1
- package/src/index.d.ts +1 -1
- package/src/types.d.ts +5 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,29 @@
|
|
|
1
1
|
|
|
2
|
+
## [1.1.0-alpha.7](https://github.com/dynamic-labs/DynamicAuth/compare/v1.1.0-alpha.6...v1.1.0-alpha.7) (2023-12-28)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* better coinbase deeplinking ux ([#4164](https://github.com/dynamic-labs/DynamicAuth/issues/4164)) ([5252608](https://github.com/dynamic-labs/DynamicAuth/commit/525260851900a33a52f129def338963400344205))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* don't prompt for connect when selecting bitcoin wallet if already connected ([#4265](https://github.com/dynamic-labs/DynamicAuth/issues/4265)) ([adef402](https://github.com/dynamic-labs/DynamicAuth/commit/adef402ef94270a17fab896a8585a7f2eacd3681))
|
|
13
|
+
|
|
14
|
+
## [1.1.0-alpha.6](https://github.com/dynamic-labs/DynamicAuth/compare/v1.1.0-alpha.5...v1.1.0-alpha.6) (2023-12-27)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* add multi-wallet-prompts-widget ([#4166](https://github.com/dynamic-labs/DynamicAuth/issues/4166)) ([151e3d2](https://github.com/dynamic-labs/DynamicAuth/commit/151e3d2e7bebbf18448e4af8eecbf660f713cd3d))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
|
|
24
|
+
* coinbase solana signMessage ([#4254](https://github.com/dynamic-labs/DynamicAuth/issues/4254)) ([f0300a9](https://github.com/dynamic-labs/DynamicAuth/commit/f0300a93ed6c9ba9dfab613820d8cedbe72abb87))
|
|
25
|
+
* make useConnectWithEmailOtp work cross views ([#4252](https://github.com/dynamic-labs/DynamicAuth/issues/4252)) ([a097119](https://github.com/dynamic-labs/DynamicAuth/commit/a097119556c38a22f338a783f79d512b99203cf5))
|
|
26
|
+
|
|
2
27
|
## [1.1.0-alpha.5](https://github.com/dynamic-labs/DynamicAuth/compare/v1.1.0-alpha.4...v1.1.0-alpha.5) (2023-12-21)
|
|
3
28
|
|
|
4
29
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/solana",
|
|
3
|
-
"version": "1.1.0-alpha.
|
|
3
|
+
"version": "1.1.0-alpha.7",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/dynamic-labs/DynamicAuth.git",
|
|
@@ -27,11 +27,11 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@solana/web3.js": "1.70.1",
|
|
30
|
-
"@dynamic-labs/rpc-providers": "1.1.0-alpha.
|
|
31
|
-
"@dynamic-labs/types": "1.1.0-alpha.
|
|
32
|
-
"@dynamic-labs/utils": "1.1.0-alpha.
|
|
33
|
-
"@dynamic-labs/wallet-book": "1.1.0-alpha.
|
|
34
|
-
"@dynamic-labs/wallet-connector-core": "1.1.0-alpha.
|
|
30
|
+
"@dynamic-labs/rpc-providers": "1.1.0-alpha.7",
|
|
31
|
+
"@dynamic-labs/types": "1.1.0-alpha.7",
|
|
32
|
+
"@dynamic-labs/utils": "1.1.0-alpha.7",
|
|
33
|
+
"@dynamic-labs/wallet-book": "1.1.0-alpha.7",
|
|
34
|
+
"@dynamic-labs/wallet-connector-core": "1.1.0-alpha.7",
|
|
35
35
|
"eventemitter3": "5.0.1"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {}
|
package/src/CoinbaseSolana.cjs
CHANGED
|
@@ -3,8 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var _tslib = require('../_virtual/_tslib.cjs');
|
|
6
|
+
var utils = require('@dynamic-labs/utils');
|
|
6
7
|
var solWalletConnector = require('./solWalletConnector.cjs');
|
|
7
8
|
var solProviderHelper = require('./solProviderHelper.cjs');
|
|
9
|
+
require('@solana/web3.js');
|
|
10
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
11
|
+
require('./injected/PhantomLedger.cjs');
|
|
12
|
+
var isSignedMessage = require('./utils/isSignedMessage.cjs');
|
|
8
13
|
|
|
9
14
|
class CoinbaseSolana extends solWalletConnector.SolWalletConnector {
|
|
10
15
|
constructor() {
|
|
@@ -40,7 +45,20 @@ class CoinbaseSolana extends solWalletConnector.SolWalletConnector {
|
|
|
40
45
|
}
|
|
41
46
|
signMessage(messageToSign) {
|
|
42
47
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
43
|
-
|
|
48
|
+
const walletAddress = yield this.fetchPublicAddress();
|
|
49
|
+
if (!walletAddress) {
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
const provider = yield this.getSigner();
|
|
53
|
+
if (!provider) {
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
56
|
+
const encodedMessage = new TextEncoder().encode(messageToSign);
|
|
57
|
+
const signedMessage = yield provider.signMessage(encodedMessage, walletAddress);
|
|
58
|
+
if (!signedMessage) {
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
return utils.bufferToBase64(isSignedMessage.isSignedMessage(signedMessage) ? signedMessage.signature : signedMessage);
|
|
44
62
|
});
|
|
45
63
|
}
|
|
46
64
|
getConnectedAccounts() {
|
package/src/CoinbaseSolana.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { SolWalletConnector } from './solWalletConnector';
|
|
2
|
-
import {
|
|
2
|
+
import { ICoinbaseSolanaSigner } from './types';
|
|
3
3
|
export declare class CoinbaseSolana extends SolWalletConnector {
|
|
4
4
|
name: string;
|
|
5
5
|
setupEventListeners(): void;
|
|
6
6
|
teardownEventListeners(): void;
|
|
7
7
|
connect(): Promise<void>;
|
|
8
|
-
getSigner(): Promise<
|
|
8
|
+
getSigner(): Promise<ICoinbaseSolanaSigner | undefined>;
|
|
9
9
|
isInstalledOnBrowser(): boolean;
|
|
10
10
|
fetchPublicAddress(): Promise<string | undefined>;
|
|
11
11
|
signMessage(messageToSign: string): Promise<string | undefined>;
|
package/src/CoinbaseSolana.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { __awaiter } from '../_virtual/_tslib.js';
|
|
2
|
+
import { bufferToBase64 } from '@dynamic-labs/utils';
|
|
2
3
|
import { SolWalletConnector } from './solWalletConnector.js';
|
|
3
4
|
import { SolProviderHelper } from './solProviderHelper.js';
|
|
5
|
+
import '@solana/web3.js';
|
|
6
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
7
|
+
import './injected/PhantomLedger.js';
|
|
8
|
+
import { isSignedMessage } from './utils/isSignedMessage.js';
|
|
4
9
|
|
|
5
10
|
class CoinbaseSolana extends SolWalletConnector {
|
|
6
11
|
constructor() {
|
|
@@ -36,7 +41,20 @@ class CoinbaseSolana extends SolWalletConnector {
|
|
|
36
41
|
}
|
|
37
42
|
signMessage(messageToSign) {
|
|
38
43
|
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
-
|
|
44
|
+
const walletAddress = yield this.fetchPublicAddress();
|
|
45
|
+
if (!walletAddress) {
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
const provider = yield this.getSigner();
|
|
49
|
+
if (!provider) {
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
const encodedMessage = new TextEncoder().encode(messageToSign);
|
|
53
|
+
const signedMessage = yield provider.signMessage(encodedMessage, walletAddress);
|
|
54
|
+
if (!signedMessage) {
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
return bufferToBase64(isSignedMessage(signedMessage) ? signedMessage.signature : signedMessage);
|
|
40
58
|
});
|
|
41
59
|
}
|
|
42
60
|
getConnectedAccounts() {
|
package/src/index.d.ts
CHANGED
|
@@ -4,4 +4,4 @@ export * from './Solflare';
|
|
|
4
4
|
export declare const SolanaWalletConnectors: (props: any) => typeof import("./injected/BraveSol").BraveSol[];
|
|
5
5
|
export { isSignedMessage } from './utils/isSignedMessage';
|
|
6
6
|
export { isBackpackSolanaSigner } from './utils/isBackpackSolanaSigner';
|
|
7
|
-
export type { ISolana, IBackpackSolanaSigner, SignedMessage, ISolanaSigner, } from './types';
|
|
7
|
+
export type { ISolana, IBackpackSolanaSigner, ICoinbaseSolanaSigner, SignedMessage, ISolanaSigner, } from './types';
|
package/src/types.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ declare global {
|
|
|
9
9
|
Slope?: {
|
|
10
10
|
new (): ISolana;
|
|
11
11
|
};
|
|
12
|
-
coinbaseSolana?:
|
|
12
|
+
coinbaseSolana?: ICoinbaseSolanaSigner;
|
|
13
13
|
glowSolana?: ISolana;
|
|
14
14
|
phantom?: IWindowPhantom;
|
|
15
15
|
solana?: ISolana;
|
|
@@ -59,7 +59,10 @@ export type IBackpackSolanaSigner = Omit<ISolanaSigner, 'signMessage'> & {
|
|
|
59
59
|
signMessage: (message: Uint8Array, encoding?: string) => Promise<void | Uint8Array>;
|
|
60
60
|
send: (transaction: Transaction, signers?: Signer[], options?: SendOptions, connection?: Connection, publicKey?: PublicKey) => Promise<TransactionSignature>;
|
|
61
61
|
};
|
|
62
|
-
export type
|
|
62
|
+
export type ICoinbaseSolanaSigner = Omit<ISolanaSigner, 'signMessage'> & {
|
|
63
|
+
signMessage: (message: Uint8Array, publicKey?: string) => Promise<void | Uint8Array>;
|
|
64
|
+
};
|
|
65
|
+
export type ISolana = ISolanaSigner | IBackpackSolanaSigner | ICoinbaseSolanaSigner;
|
|
63
66
|
export type ProviderFlag = 'isBraveWallet' | 'isGlow' | 'isPhantom' | 'isSolflare' | 'isExodus' | 'isBackpack' | 'isMagicEden';
|
|
64
67
|
export type EthProviderCondition = ProviderCondition<ProviderFlag>;
|
|
65
68
|
export {};
|