@dynamic-labs/solana 2.0.0-alpha.9 → 2.0.1
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 +328 -0
- package/package.json +10 -10
- package/src/CoinbaseSolana.cjs +2 -4
- package/src/CoinbaseSolana.js +2 -4
- package/src/Solflare.cjs +74 -0
- package/src/Solflare.d.ts +2 -1
- package/src/Solflare.js +70 -0
- package/src/index.cjs +1 -2
- package/src/index.js +2 -3
- package/src/injected/BackpackSol.cjs +2 -2
- package/src/injected/BackpackSol.js +2 -2
- package/src/injected/InjectedWalletBase.cjs +12 -8
- package/src/injected/InjectedWalletBase.d.ts +2 -1
- package/src/injected/InjectedWalletBase.js +12 -8
- package/src/injected/PhantomInjected.cjs +3 -3
- package/src/injected/PhantomInjected.d.ts +1 -1
- package/src/injected/PhantomInjected.js +3 -3
- package/src/injected/fetchInjectedWalletConnectors.cjs +3 -3
- package/src/injected/fetchInjectedWalletConnectors.js +3 -3
- package/src/phantomRedirect/PhantomRedirect.cjs +183 -10
- package/src/phantomRedirect/PhantomRedirect.d.ts +7 -1
- package/src/phantomRedirect/PhantomRedirect.js +185 -12
- package/src/phantomRedirect/storage.cjs +15 -0
- package/src/phantomRedirect/storage.d.ts +7 -0
- package/src/phantomRedirect/storage.js +15 -1
- package/src/phantomRedirect/types.d.ts +1 -0
- package/src/solProviderHelper.cjs +5 -5
- package/src/solProviderHelper.d.ts +1 -1
- package/src/solProviderHelper.js +5 -5
- package/src/solWalletConnector.cjs +2 -2
- package/src/solWalletConnector.d.ts +1 -1
- package/src/solWalletConnector.js +2 -2
- package/src/types.d.ts +0 -3
- package/src/Slope.cjs +0 -99
- package/src/Slope.d.ts +0 -28
- package/src/Slope.js +0 -95
package/src/Slope.js
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { __awaiter } from '../_virtual/_tslib.js';
|
|
2
|
-
import { PublicKey } from '@solana/web3.js';
|
|
3
|
-
import { logger } from '@dynamic-labs/wallet-connector-core';
|
|
4
|
-
import { SolWalletConnector } from './solWalletConnector.js';
|
|
5
|
-
|
|
6
|
-
class Slope extends SolWalletConnector {
|
|
7
|
-
constructor() {
|
|
8
|
-
super(...arguments);
|
|
9
|
-
this.name = 'Slope';
|
|
10
|
-
this.overrideKey = 'slope';
|
|
11
|
-
this.isConnectData = (value) => { var _a; return ((_a = value.data) === null || _a === void 0 ? void 0 : _a.publicKey) !== undefined; };
|
|
12
|
-
this.isSignatureData = (value) => { var _a; return ((_a = value.data) === null || _a === void 0 ? void 0 : _a.signature) !== undefined; };
|
|
13
|
-
}
|
|
14
|
-
get wallet() {
|
|
15
|
-
if (!window.Slope) {
|
|
16
|
-
return undefined;
|
|
17
|
-
}
|
|
18
|
-
if (!Slope._wallet) {
|
|
19
|
-
Slope._wallet = new window.Slope();
|
|
20
|
-
}
|
|
21
|
-
return Slope._wallet;
|
|
22
|
-
}
|
|
23
|
-
connect() {
|
|
24
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
-
if (this.wallet === undefined)
|
|
26
|
-
return;
|
|
27
|
-
yield this.wallet.connect();
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
getSigner() {
|
|
31
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
-
return undefined;
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
getBalance() {
|
|
36
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
-
try {
|
|
38
|
-
if (this.wallet === undefined)
|
|
39
|
-
return undefined;
|
|
40
|
-
const response = yield this.wallet.connect();
|
|
41
|
-
const publicKey = new PublicKey(this.isConnectData(response) && response.data.publicKey);
|
|
42
|
-
const balance = this.lamportsToSol(yield this.getWalletClient().getBalance(publicKey));
|
|
43
|
-
return balance.toString();
|
|
44
|
-
}
|
|
45
|
-
catch (e) {
|
|
46
|
-
logger.debug(e);
|
|
47
|
-
return undefined;
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
isInstalledOnBrowser() {
|
|
52
|
-
return typeof window.Slope === 'function';
|
|
53
|
-
}
|
|
54
|
-
fetchPublicAddress() {
|
|
55
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
-
try {
|
|
57
|
-
if (this.wallet === undefined)
|
|
58
|
-
return undefined;
|
|
59
|
-
const response = yield this.wallet.connect();
|
|
60
|
-
return this.isConnectData(response) ? response.data.publicKey : undefined;
|
|
61
|
-
}
|
|
62
|
-
catch (e) {
|
|
63
|
-
logger.debug(e);
|
|
64
|
-
return undefined;
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
signMessage(messageToSign) {
|
|
69
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
70
|
-
const encodedMessage = new TextEncoder().encode(messageToSign);
|
|
71
|
-
try {
|
|
72
|
-
if (this.wallet === undefined)
|
|
73
|
-
return undefined;
|
|
74
|
-
const response = yield this.wallet.signMessage(encodedMessage);
|
|
75
|
-
return this.isSignatureData(response)
|
|
76
|
-
? response.data.signature
|
|
77
|
-
: undefined;
|
|
78
|
-
}
|
|
79
|
-
catch (e) {
|
|
80
|
-
logger.debug(e);
|
|
81
|
-
return undefined;
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
getConnectedAccounts() {
|
|
86
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
87
|
-
if (this.wallet === undefined)
|
|
88
|
-
return [];
|
|
89
|
-
const response = yield this.wallet.connect();
|
|
90
|
-
return this.isConnectData(response) ? [response.data.publicKey] : [];
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
export { Slope };
|