@dynamic-labs/multi-wallet 0.17.0-RC.2 → 0.17.0-RC.21
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 +242 -0
- package/package.json +10 -26
- package/src/index.cjs +0 -69
- package/src/index.d.ts +0 -18
- package/src/index.js +1 -23
- package/src/multi-wallet.cjs +38 -182
- package/src/multi-wallet.d.ts +1 -4
- package/src/multi-wallet.js +37 -180
- package/src/types.d.ts +12 -50
- package/src/utils/getApiProviders.cjs +15 -0
- package/src/utils/getApiProviders.d.ts +17 -0
- package/src/utils/getApiProviders.js +11 -0
- package/src/utils/message.cjs +3 -4
- package/src/utils/message.d.ts +2 -2
- package/src/utils/message.js +1 -2
- package/src/errors.cjs +0 -65
- package/src/errors.d.ts +0 -30
- package/src/errors.js +0 -53
- package/src/polyfills.cjs +0 -16
- package/src/polyfills.d.ts +0 -1
- package/src/polyfills.js +0 -14
- package/src/rpcProviders.cjs +0 -76
- package/src/rpcProviders.d.ts +0 -5
- package/src/rpcProviders.js +0 -69
- package/src/utils/CancellablePromise/CancellablePromise.cjs +0 -33
- package/src/utils/CancellablePromise/CancellablePromise.d.ts +0 -9
- package/src/utils/CancellablePromise/CancellablePromise.js +0 -29
- package/src/utils/CancellablePromise/index.d.ts +0 -1
- package/src/utils/assignConfirmationScreenToProvider/assignConfirmationScreenToProvider.cjs +0 -54
- package/src/utils/assignConfirmationScreenToProvider/assignConfirmationScreenToProvider.d.ts +0 -3
- package/src/utils/assignConfirmationScreenToProvider/assignConfirmationScreenToProvider.js +0 -50
- package/src/utils/assignConfirmationScreenToProvider/index.d.ts +0 -1
- package/src/utils/convertors.cjs +0 -43
- package/src/utils/convertors.d.ts +0 -3
- package/src/utils/convertors.js +0 -38
- package/src/utils/encoding.cjs +0 -18
- package/src/utils/encoding.d.ts +0 -4
- package/src/utils/encoding.js +0 -12
- package/src/utils/extractNonce.cjs +0 -13
- package/src/utils/extractNonce.d.ts +0 -1
- package/src/utils/extractNonce.js +0 -9
- package/src/utils/getChainInfo/getChainInfo.cjs +0 -59
- package/src/utils/getChainInfo/getChainInfo.d.ts +0 -2
- package/src/utils/getChainInfo/getChainInfo.js +0 -55
- package/src/utils/getChainInfo/index.d.ts +0 -1
- package/src/utils/getWalletConnectorByName.cjs +0 -19
- package/src/utils/getWalletConnectorByName.d.ts +0 -2
- package/src/utils/getWalletConnectorByName.js +0 -15
- package/src/utils/isEmailOTPWalletConnector/index.d.ts +0 -1
- package/src/utils/isEmailOTPWalletConnector/isEmailOTPWalletConnector.cjs +0 -7
- package/src/utils/isEmailOTPWalletConnector/isEmailOTPWalletConnector.d.ts +0 -2
- package/src/utils/isEmailOTPWalletConnector/isEmailOTPWalletConnector.js +0 -3
- package/src/utils/isEmailWalletConnector/index.d.ts +0 -1
- package/src/utils/isEmailWalletConnector/isEmailWalletConnector.cjs +0 -7
- package/src/utils/isEmailWalletConnector/isEmailWalletConnector.d.ts +0 -2
- package/src/utils/isEmailWalletConnector/isEmailWalletConnector.js +0 -3
- package/src/utils/isFunction/index.d.ts +0 -1
- package/src/utils/isFunction/isFunction.cjs +0 -8
- package/src/utils/isFunction/isFunction.d.ts +0 -1
- package/src/utils/isFunction/isFunction.js +0 -4
- package/src/utils/isMobile.cjs +0 -54
- package/src/utils/isMobile.d.ts +0 -13
- package/src/utils/isMobile.js +0 -46
- package/src/utils/isSameAddress/index.d.ts +0 -1
- package/src/utils/isSameAddress/isSameAddress.cjs +0 -9
- package/src/utils/isSameAddress/isSameAddress.d.ts +0 -1
- package/src/utils/isSameAddress/isSameAddress.js +0 -5
- package/src/utils/isSameAddress/utils/index.d.ts +0 -1
- package/src/utils/isSameAddress/utils/normalizeAddress/index.d.ts +0 -1
- package/src/utils/isSameAddress/utils/normalizeAddress/normalizeAddress.cjs +0 -17
- package/src/utils/isSameAddress/utils/normalizeAddress/normalizeAddress.d.ts +0 -1
- package/src/utils/isSameAddress/utils/normalizeAddress/normalizeAddress.js +0 -13
- package/src/utils/isSocialWalletConnector/index.d.ts +0 -1
- package/src/utils/isSocialWalletConnector/isSocialWalletConnector.cjs +0 -7
- package/src/utils/isSocialWalletConnector/isSocialWalletConnector.d.ts +0 -2
- package/src/utils/isSocialWalletConnector/isSocialWalletConnector.js +0 -3
- package/src/utils/isUnsupportedProviderError/index.d.ts +0 -1
- package/src/utils/isUnsupportedProviderError/isUnsupportedProviderError.cjs +0 -13
- package/src/utils/isUnsupportedProviderError/isUnsupportedProviderError.d.ts +0 -6
- package/src/utils/isUnsupportedProviderError/isUnsupportedProviderError.js +0 -9
- package/src/utils/localStorageAsync.cjs +0 -28
- package/src/utils/localStorageAsync.d.ts +0 -3
- package/src/utils/localStorageAsync.js +0 -22
- package/src/utils/logger.cjs +0 -9
- package/src/utils/logger.d.ts +0 -2
- package/src/utils/logger.js +0 -5
- package/src/utils/normalizeWalletName/index.d.ts +0 -1
- package/src/utils/normalizeWalletName/normalizeWalletName.cjs +0 -7
- package/src/utils/normalizeWalletName/normalizeWalletName.d.ts +0 -1
- package/src/utils/normalizeWalletName/normalizeWalletName.js +0 -3
- package/src/utils/shouldLowercaseAddress.cjs +0 -11
- package/src/utils/shouldLowercaseAddress.d.ts +0 -1
- package/src/utils/shouldLowercaseAddress.js +0 -7
- package/src/utils/walletConnect.cjs +0 -30
- package/src/utils/walletConnect.d.ts +0 -4
- package/src/utils/walletConnect.js +0 -26
- package/src/wallets/ProviderLookup.cjs +0 -18
- package/src/wallets/ProviderLookup.d.ts +0 -4
- package/src/wallets/ProviderLookup.js +0 -14
- package/src/wallets/algorand/MyAlgoWalletConnector.cjs +0 -149
- package/src/wallets/algorand/MyAlgoWalletConnector.d.ts +0 -21
- package/src/wallets/algorand/MyAlgoWalletConnector.js +0 -143
- package/src/wallets/algorand/myalgoSigner.cjs +0 -24
- package/src/wallets/algorand/myalgoSigner.d.ts +0 -21
- package/src/wallets/algorand/myalgoSigner.js +0 -20
- package/src/wallets/clients/coinbase/coinbase.cjs +0 -73
- package/src/wallets/clients/coinbase/coinbase.d.ts +0 -6
- package/src/wallets/clients/coinbase/coinbase.js +0 -66
- package/src/wallets/clients/coinbase/index.d.ts +0 -2
- package/src/wallets/clients/coinbase/types.d.ts +0 -14
- package/src/wallets/clients/walletConnect/index.d.ts +0 -1
- package/src/wallets/clients/walletConnect/types.d.ts +0 -4
- package/src/wallets/clients/walletConnect/walletConnect.cjs +0 -204
- package/src/wallets/clients/walletConnect/walletConnect.d.ts +0 -22
- package/src/wallets/clients/walletConnect/walletConnect.js +0 -187
- package/src/wallets/constants.cjs +0 -16
- package/src/wallets/constants.d.ts +0 -4
- package/src/wallets/constants.js +0 -10
- package/src/wallets/cosmos/KeplrWalletConnect.cjs +0 -196
- package/src/wallets/cosmos/KeplrWalletConnect.d.ts +0 -46
- package/src/wallets/cosmos/KeplrWalletConnect.js +0 -194
- package/src/wallets/cosmos/KeplrWalletConnector.cjs +0 -193
- package/src/wallets/cosmos/KeplrWalletConnector.d.ts +0 -70
- package/src/wallets/cosmos/KeplrWalletConnector.js +0 -189
- package/src/wallets/cosmos/getKeplrConnector.cjs +0 -18
- package/src/wallets/cosmos/getKeplrConnector.d.ts +0 -6
- package/src/wallets/cosmos/getKeplrConnector.js +0 -14
- package/src/wallets/cosmos/index.d.ts +0 -1
- package/src/wallets/cosmos/utils/indexDB.cjs +0 -97
- package/src/wallets/cosmos/utils/indexDB.d.ts +0 -18
- package/src/wallets/cosmos/utils/indexDB.js +0 -93
- package/src/wallets/cosmos/wcClient.cjs +0 -333
- package/src/wallets/cosmos/wcClient.d.ts +0 -104
- package/src/wallets/cosmos/wcClient.js +0 -325
- package/src/wallets/ethereum/BloctoEvm.cjs +0 -111
- package/src/wallets/ethereum/BloctoEvm.d.ts +0 -25
- package/src/wallets/ethereum/BloctoEvm.js +0 -105
- package/src/wallets/ethereum/EthWalletConnector.cjs +0 -191
- package/src/wallets/ethereum/EthWalletConnector.d.ts +0 -35
- package/src/wallets/ethereum/EthWalletConnector.js +0 -187
- package/src/wallets/ethereum/MagicConnector/EmailMagicWalletConnector/EmailMagicWalletConnector.cjs +0 -63
- package/src/wallets/ethereum/MagicConnector/EmailMagicWalletConnector/EmailMagicWalletConnector.d.ts +0 -12
- package/src/wallets/ethereum/MagicConnector/EmailMagicWalletConnector/EmailMagicWalletConnector.js +0 -59
- package/src/wallets/ethereum/MagicConnector/EmailMagicWalletConnector/index.d.ts +0 -1
- package/src/wallets/ethereum/MagicConnector/EmailOTPMagicWalletConnector/EmailOTPMagicWalletConnector.cjs +0 -62
- package/src/wallets/ethereum/MagicConnector/EmailOTPMagicWalletConnector/EmailOTPMagicWalletConnector.d.ts +0 -11
- package/src/wallets/ethereum/MagicConnector/EmailOTPMagicWalletConnector/EmailOTPMagicWalletConnector.js +0 -58
- package/src/wallets/ethereum/MagicConnector/EmailOTPMagicWalletConnector/index.d.ts +0 -1
- package/src/wallets/ethereum/MagicConnector/MagicClientNetworkHandler/MagicClientNetworkHandler.cjs +0 -102
- package/src/wallets/ethereum/MagicConnector/MagicClientNetworkHandler/MagicClientNetworkHandler.d.ts +0 -33
- package/src/wallets/ethereum/MagicConnector/MagicClientNetworkHandler/MagicClientNetworkHandler.js +0 -98
- package/src/wallets/ethereum/MagicConnector/MagicClientNetworkHandler/index.d.ts +0 -2
- package/src/wallets/ethereum/MagicConnector/MagicSocialWalletConnector/MagicSocialWalletConnector.cjs +0 -55
- package/src/wallets/ethereum/MagicConnector/MagicSocialWalletConnector/MagicSocialWalletConnector.d.ts +0 -12
- package/src/wallets/ethereum/MagicConnector/MagicSocialWalletConnector/MagicSocialWalletConnector.js +0 -51
- package/src/wallets/ethereum/MagicConnector/MagicSocialWalletConnector/index.d.ts +0 -1
- package/src/wallets/ethereum/MagicConnector/MagicWalletConnector/MagicWalletConnector.cjs +0 -175
- package/src/wallets/ethereum/MagicConnector/MagicWalletConnector/MagicWalletConnector.d.ts +0 -53
- package/src/wallets/ethereum/MagicConnector/MagicWalletConnector/MagicWalletConnector.js +0 -171
- package/src/wallets/ethereum/MagicConnector/MagicWalletConnector/index.d.ts +0 -2
- package/src/wallets/ethereum/MagicConnector/index.d.ts +0 -5
- package/src/wallets/ethereum/coinbase.cjs +0 -65
- package/src/wallets/ethereum/coinbase.d.ts +0 -26
- package/src/wallets/ethereum/coinbase.js +0 -63
- package/src/wallets/ethereum/ethProviderHelper.cjs +0 -197
- package/src/wallets/ethereum/ethProviderHelper.d.ts +0 -40
- package/src/wallets/ethereum/ethProviderHelper.js +0 -193
- package/src/wallets/ethereum/evm-network.cjs +0 -20
- package/src/wallets/ethereum/evm-network.d.ts +0 -22
- package/src/wallets/ethereum/evm-network.js +0 -16
- package/src/wallets/ethereum/fortmatic.cjs +0 -75
- package/src/wallets/ethereum/fortmatic.d.ts +0 -26
- package/src/wallets/ethereum/fortmatic.js +0 -69
- package/src/wallets/ethereum/injected/BloctoInjected.cjs +0 -13
- package/src/wallets/ethereum/injected/BloctoInjected.d.ts +0 -6
- package/src/wallets/ethereum/injected/BloctoInjected.js +0 -11
- package/src/wallets/ethereum/injected/BraveEvm.cjs +0 -13
- package/src/wallets/ethereum/injected/BraveEvm.d.ts +0 -6
- package/src/wallets/ethereum/injected/BraveEvm.js +0 -11
- package/src/wallets/ethereum/injected/Dawn.cjs +0 -13
- package/src/wallets/ethereum/injected/Dawn.d.ts +0 -6
- package/src/wallets/ethereum/injected/Dawn.js +0 -11
- package/src/wallets/ethereum/injected/ExodusEvm.cjs +0 -13
- package/src/wallets/ethereum/injected/ExodusEvm.d.ts +0 -6
- package/src/wallets/ethereum/injected/ExodusEvm.js +0 -11
- package/src/wallets/ethereum/injected/Frame.cjs +0 -13
- package/src/wallets/ethereum/injected/Frame.d.ts +0 -6
- package/src/wallets/ethereum/injected/Frame.js +0 -11
- package/src/wallets/ethereum/injected/GameStop.cjs +0 -13
- package/src/wallets/ethereum/injected/GameStop.d.ts +0 -6
- package/src/wallets/ethereum/injected/GameStop.js +0 -11
- package/src/wallets/ethereum/injected/Opera.cjs +0 -13
- package/src/wallets/ethereum/injected/Opera.d.ts +0 -6
- package/src/wallets/ethereum/injected/Opera.js +0 -11
- package/src/wallets/ethereum/injected/PhantomEvm.cjs +0 -37
- package/src/wallets/ethereum/injected/PhantomEvm.d.ts +0 -7
- package/src/wallets/ethereum/injected/PhantomEvm.js +0 -35
- package/src/wallets/ethereum/injected/Trust.cjs +0 -13
- package/src/wallets/ethereum/injected/Trust.d.ts +0 -6
- package/src/wallets/ethereum/injected/Trust.js +0 -11
- package/src/wallets/ethereum/injected/UnknownInjectedWallet.cjs +0 -13
- package/src/wallets/ethereum/injected/UnknownInjectedWallet.d.ts +0 -6
- package/src/wallets/ethereum/injected/UnknownInjectedWallet.js +0 -11
- package/src/wallets/ethereum/injected/Zerion.cjs +0 -13
- package/src/wallets/ethereum/injected/Zerion.d.ts +0 -6
- package/src/wallets/ethereum/injected/Zerion.js +0 -11
- package/src/wallets/ethereum/meta-mask.cjs +0 -63
- package/src/wallets/ethereum/meta-mask.d.ts +0 -26
- package/src/wallets/ethereum/meta-mask.js +0 -61
- package/src/wallets/flow/FlowWalletConnector.cjs +0 -163
- package/src/wallets/flow/FlowWalletConnector.d.ts +0 -29
- package/src/wallets/flow/FlowWalletConnector.js +0 -158
- package/src/wallets/flow/blocto.cjs +0 -22
- package/src/wallets/flow/blocto.d.ts +0 -7
- package/src/wallets/flow/blocto.js +0 -20
- package/src/wallets/flow/dapper.cjs +0 -22
- package/src/wallets/flow/dapper.d.ts +0 -7
- package/src/wallets/flow/dapper.js +0 -20
- package/src/wallets/flow/lilico.cjs +0 -42
- package/src/wallets/flow/lilico.d.ts +0 -8
- package/src/wallets/flow/lilico.js +0 -40
- package/src/wallets/getMobileOrInjectedWallet.cjs +0 -26
- package/src/wallets/getMobileOrInjectedWallet.d.ts +0 -8
- package/src/wallets/getMobileOrInjectedWallet.js +0 -22
- package/src/wallets/getWalletConnectConnector.cjs +0 -19
- package/src/wallets/getWalletConnectConnector.d.ts +0 -8
- package/src/wallets/getWalletConnectConnector.js +0 -15
- package/src/wallets/solana/CoinbaseSolana.cjs +0 -54
- package/src/wallets/solana/CoinbaseSolana.d.ts +0 -17
- package/src/wallets/solana/CoinbaseSolana.js +0 -52
- package/src/wallets/solana/glow.cjs +0 -51
- package/src/wallets/solana/glow.d.ts +0 -16
- package/src/wallets/solana/glow.js +0 -49
- package/src/wallets/solana/injected/BraveSol.cjs +0 -18
- package/src/wallets/solana/injected/BraveSol.d.ts +0 -6
- package/src/wallets/solana/injected/BraveSol.js +0 -16
- package/src/wallets/solana/injected/ExodusSol.cjs +0 -12
- package/src/wallets/solana/injected/ExodusSol.d.ts +0 -5
- package/src/wallets/solana/injected/ExodusSol.js +0 -10
- package/src/wallets/solana/phantom-ledger.cjs +0 -71
- package/src/wallets/solana/phantom-ledger.d.ts +0 -16
- package/src/wallets/solana/phantom-ledger.js +0 -65
- package/src/wallets/solana/phantom.cjs +0 -74
- package/src/wallets/solana/phantom.d.ts +0 -17
- package/src/wallets/solana/phantom.js +0 -72
- package/src/wallets/solana/slope.cjs +0 -96
- package/src/wallets/solana/slope.d.ts +0 -27
- package/src/wallets/solana/slope.js +0 -94
- package/src/wallets/solana/solProviderHelper.cjs +0 -164
- package/src/wallets/solana/solProviderHelper.d.ts +0 -29
- package/src/wallets/solana/solProviderHelper.js +0 -160
- package/src/wallets/solana/solWalletConnector.cjs +0 -57
- package/src/wallets/solana/solWalletConnector.d.ts +0 -18
- package/src/wallets/solana/solWalletConnector.js +0 -53
- package/src/wallets/solana/solflare.cjs +0 -65
- package/src/wallets/solana/solflare.d.ts +0 -14
- package/src/wallets/solana/solflare.js +0 -63
- package/src/wallets/starknet/argentx.cjs +0 -20
- package/src/wallets/starknet/argentx.d.ts +0 -7
- package/src/wallets/starknet/argentx.js +0 -18
- package/src/wallets/starknet/braavos.cjs +0 -33
- package/src/wallets/starknet/braavos.d.ts +0 -7
- package/src/wallets/starknet/braavos.js +0 -31
- package/src/wallets/starknet/ethereumContractAbi.cjs +0 -357
- package/src/wallets/starknet/ethereumContractAbi.js +0 -355
- package/src/wallets/starknet/starknetWalletConnector.cjs +0 -171
- package/src/wallets/starknet/starknetWalletConnector.d.ts +0 -34
- package/src/wallets/starknet/starknetWalletConnector.js +0 -169
- package/src/wallets/walletConnect/index.d.ts +0 -2
- package/src/wallets/walletConnect/walletConnect.cjs +0 -130
- package/src/wallets/walletConnect/walletConnect.d.ts +0 -34
- package/src/wallets/walletConnect/walletConnect.js +0 -124
- package/src/wallets/walletConnect/walletConnectV2.cjs +0 -268
- package/src/wallets/walletConnect/walletConnectV2.d.ts +0 -38
- package/src/wallets/walletConnect/walletConnectV2.js +0 -262
- package/src/wallets/walletConnect/zerion.d.ts +0 -8
- package/src/wallets/window.d.ts +0 -95
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { __awaiter } from 'tslib';
|
|
2
|
-
import { SolWalletConnector } from './solWalletConnector.js';
|
|
3
|
-
import { SolProviderHelper } from './solProviderHelper.js';
|
|
4
|
-
|
|
5
|
-
class Glow extends SolWalletConnector {
|
|
6
|
-
constructor() {
|
|
7
|
-
super(...arguments);
|
|
8
|
-
this.name = 'Glow';
|
|
9
|
-
this.solProviderHelper = new SolProviderHelper();
|
|
10
|
-
}
|
|
11
|
-
setupEventListeners(listeners) {
|
|
12
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
13
|
-
return this.solProviderHelper._setupEventListeners(listeners, this.solProviderHelper.findProvider(this.name));
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
teardownEventListeners() {
|
|
17
|
-
this.solProviderHelper._teardownEventListeners(this.name);
|
|
18
|
-
}
|
|
19
|
-
connect() {
|
|
20
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
-
yield this.solProviderHelper.connectWithName(this.name);
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
getSigner() {
|
|
25
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
-
return this.solProviderHelper.connectWithName(this.name);
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
isInstalledOnBrowser() {
|
|
30
|
-
return this.solProviderHelper.isInstalledHelper(this.name);
|
|
31
|
-
}
|
|
32
|
-
fetchPublicAddress() {
|
|
33
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
-
return this.solProviderHelper.fetchPublicAddressWithName(this.name);
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
signMessage(messageToSign) {
|
|
38
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
-
return this.solProviderHelper.signMessageWithName(messageToSign, this.name);
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
getConnectedAccounts() {
|
|
43
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
-
return this.solProviderHelper.getConnectedAccountsWithName(this.name);
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export { Glow as default };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var tslib = require('tslib');
|
|
4
|
-
var phantom = require('../phantom.cjs');
|
|
5
|
-
|
|
6
|
-
class BraveSol extends phantom {
|
|
7
|
-
constructor() {
|
|
8
|
-
super(...arguments);
|
|
9
|
-
this.name = 'BraveSol';
|
|
10
|
-
}
|
|
11
|
-
fetchPublicAddress() {
|
|
12
|
-
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
13
|
-
return this.solProviderHelper.fetchPublicAddressWithName(this.name);
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
module.exports = BraveSol;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { __awaiter } from 'tslib';
|
|
2
|
-
import Phantom from '../phantom.js';
|
|
3
|
-
|
|
4
|
-
class BraveSol extends Phantom {
|
|
5
|
-
constructor() {
|
|
6
|
-
super(...arguments);
|
|
7
|
-
this.name = 'BraveSol';
|
|
8
|
-
}
|
|
9
|
-
fetchPublicAddress() {
|
|
10
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
11
|
-
return this.solProviderHelper.fetchPublicAddressWithName(this.name);
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export { BraveSol as default };
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var tslib = require('tslib');
|
|
6
|
-
var web3_js = require('@solana/web3.js');
|
|
7
|
-
var errors = require('../../errors.cjs');
|
|
8
|
-
var extractNonce = require('../../utils/extractNonce.cjs');
|
|
9
|
-
var phantom = require('./phantom.cjs');
|
|
10
|
-
|
|
11
|
-
const MEMO_PROGRAM_ID = new web3_js.PublicKey('MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr');
|
|
12
|
-
/**
|
|
13
|
-
* I'm exporting the walletName to use it for DYN-1447. As we only need the wallet name,
|
|
14
|
-
* exporting it in this way, we avoid to instantiate the whole PhantomLedger class every time.
|
|
15
|
-
*/
|
|
16
|
-
const walletName = 'Phantom Ledger';
|
|
17
|
-
class PhantomLedger extends phantom {
|
|
18
|
-
constructor() {
|
|
19
|
-
super(...arguments);
|
|
20
|
-
this.name = walletName;
|
|
21
|
-
this.buildAuthTx = (message) => {
|
|
22
|
-
const transaction = new web3_js.Transaction();
|
|
23
|
-
transaction.add(new web3_js.TransactionInstruction({
|
|
24
|
-
data: Buffer.from(message, 'utf8'),
|
|
25
|
-
keys: [],
|
|
26
|
-
programId: MEMO_PROGRAM_ID,
|
|
27
|
-
}));
|
|
28
|
-
return transaction;
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
signMessage() {
|
|
32
|
-
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
33
|
-
throw new errors.NotSupportedError(`Message signing is currently not supported on ${walletName}
|
|
34
|
-
You can use signMessageViaTransaction instead to achieve similar functionality
|
|
35
|
-
by signing a transaction with a memo instruction.
|
|
36
|
-
You can read more about it here https://github.com/solana-labs/solana/issues/21366`);
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
proveOwnership(messageToSign) {
|
|
40
|
-
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
41
|
-
const nonce = extractNonce.extractNonce(messageToSign);
|
|
42
|
-
if (!nonce) {
|
|
43
|
-
throw new errors.DynamicError('Nonce missing');
|
|
44
|
-
}
|
|
45
|
-
return this.signMessageViaTransaction(nonce);
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
signMessageViaTransaction(messageToSign) {
|
|
49
|
-
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
50
|
-
const address = yield this.fetchPublicAddress();
|
|
51
|
-
if (!address) {
|
|
52
|
-
throw new errors.DynamicError('Address missing');
|
|
53
|
-
}
|
|
54
|
-
const transaction = this.buildAuthTx(messageToSign);
|
|
55
|
-
transaction.feePayer = new web3_js.PublicKey(address);
|
|
56
|
-
transaction.recentBlockhash = (yield this.getWeb3Provider().getLatestBlockhash()).blockhash;
|
|
57
|
-
const signer = yield this.getSigner();
|
|
58
|
-
if (!signer) {
|
|
59
|
-
throw new errors.DynamicError('Signer not found');
|
|
60
|
-
}
|
|
61
|
-
const signedTransaction = yield signer.signTransaction(transaction);
|
|
62
|
-
return JSON.stringify({
|
|
63
|
-
signedTransaction: signedTransaction.serialize(),
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
exports.MEMO_PROGRAM_ID = MEMO_PROGRAM_ID;
|
|
70
|
-
exports["default"] = PhantomLedger;
|
|
71
|
-
exports.walletName = walletName;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { PublicKey } from '@solana/web3.js';
|
|
2
|
-
import Phantom from './phantom';
|
|
3
|
-
export declare const MEMO_PROGRAM_ID: PublicKey;
|
|
4
|
-
/**
|
|
5
|
-
* I'm exporting the walletName to use it for DYN-1447. As we only need the wallet name,
|
|
6
|
-
* exporting it in this way, we avoid to instantiate the whole PhantomLedger class every time.
|
|
7
|
-
*/
|
|
8
|
-
export declare const walletName = "Phantom Ledger";
|
|
9
|
-
declare class PhantomLedger extends Phantom {
|
|
10
|
-
name: string;
|
|
11
|
-
signMessage(): Promise<string | undefined>;
|
|
12
|
-
proveOwnership(messageToSign: string): Promise<string | undefined>;
|
|
13
|
-
signMessageViaTransaction(messageToSign: string): Promise<string>;
|
|
14
|
-
private buildAuthTx;
|
|
15
|
-
}
|
|
16
|
-
export default PhantomLedger;
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { __awaiter } from 'tslib';
|
|
2
|
-
import { PublicKey, Transaction, TransactionInstruction } from '@solana/web3.js';
|
|
3
|
-
import { NotSupportedError, DynamicError } from '../../errors.js';
|
|
4
|
-
import { extractNonce } from '../../utils/extractNonce.js';
|
|
5
|
-
import Phantom from './phantom.js';
|
|
6
|
-
|
|
7
|
-
const MEMO_PROGRAM_ID = new PublicKey('MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr');
|
|
8
|
-
/**
|
|
9
|
-
* I'm exporting the walletName to use it for DYN-1447. As we only need the wallet name,
|
|
10
|
-
* exporting it in this way, we avoid to instantiate the whole PhantomLedger class every time.
|
|
11
|
-
*/
|
|
12
|
-
const walletName = 'Phantom Ledger';
|
|
13
|
-
class PhantomLedger extends Phantom {
|
|
14
|
-
constructor() {
|
|
15
|
-
super(...arguments);
|
|
16
|
-
this.name = walletName;
|
|
17
|
-
this.buildAuthTx = (message) => {
|
|
18
|
-
const transaction = new Transaction();
|
|
19
|
-
transaction.add(new TransactionInstruction({
|
|
20
|
-
data: Buffer.from(message, 'utf8'),
|
|
21
|
-
keys: [],
|
|
22
|
-
programId: MEMO_PROGRAM_ID,
|
|
23
|
-
}));
|
|
24
|
-
return transaction;
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
signMessage() {
|
|
28
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
-
throw new NotSupportedError(`Message signing is currently not supported on ${walletName}
|
|
30
|
-
You can use signMessageViaTransaction instead to achieve similar functionality
|
|
31
|
-
by signing a transaction with a memo instruction.
|
|
32
|
-
You can read more about it here https://github.com/solana-labs/solana/issues/21366`);
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
proveOwnership(messageToSign) {
|
|
36
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
-
const nonce = extractNonce(messageToSign);
|
|
38
|
-
if (!nonce) {
|
|
39
|
-
throw new DynamicError('Nonce missing');
|
|
40
|
-
}
|
|
41
|
-
return this.signMessageViaTransaction(nonce);
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
signMessageViaTransaction(messageToSign) {
|
|
45
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
-
const address = yield this.fetchPublicAddress();
|
|
47
|
-
if (!address) {
|
|
48
|
-
throw new DynamicError('Address missing');
|
|
49
|
-
}
|
|
50
|
-
const transaction = this.buildAuthTx(messageToSign);
|
|
51
|
-
transaction.feePayer = new PublicKey(address);
|
|
52
|
-
transaction.recentBlockhash = (yield this.getWeb3Provider().getLatestBlockhash()).blockhash;
|
|
53
|
-
const signer = yield this.getSigner();
|
|
54
|
-
if (!signer) {
|
|
55
|
-
throw new DynamicError('Signer not found');
|
|
56
|
-
}
|
|
57
|
-
const signedTransaction = yield signer.signTransaction(transaction);
|
|
58
|
-
return JSON.stringify({
|
|
59
|
-
signedTransaction: signedTransaction.serialize(),
|
|
60
|
-
});
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export { MEMO_PROGRAM_ID, PhantomLedger as default, walletName };
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var tslib = require('tslib');
|
|
4
|
-
var isMobile = require('../../utils/isMobile.cjs');
|
|
5
|
-
var solWalletConnector = require('./solWalletConnector.cjs');
|
|
6
|
-
var solProviderHelper = require('./solProviderHelper.cjs');
|
|
7
|
-
|
|
8
|
-
class Phantom extends solWalletConnector.SolWalletConnector {
|
|
9
|
-
constructor() {
|
|
10
|
-
super(...arguments);
|
|
11
|
-
this.name = 'Phantom';
|
|
12
|
-
this.solProviderHelper = new solProviderHelper.SolProviderHelper();
|
|
13
|
-
}
|
|
14
|
-
setupEventListeners(listeners) {
|
|
15
|
-
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
16
|
-
return this.solProviderHelper._setupEventListeners(listeners, this.solProviderHelper.findProvider(this.name));
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
teardownEventListeners() {
|
|
20
|
-
this.solProviderHelper._teardownEventListeners(this.name);
|
|
21
|
-
}
|
|
22
|
-
connect() {
|
|
23
|
-
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
24
|
-
yield this.solProviderHelper.connectWithName(this.name);
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
getSigner() {
|
|
28
|
-
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
29
|
-
return this.solProviderHelper.connectWithName(this.name);
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
isInstalledOnBrowser() {
|
|
33
|
-
var _a;
|
|
34
|
-
/**
|
|
35
|
-
* When Glow wallet is installed and Phantom isn't, isPhantom will
|
|
36
|
-
* still be true. This added check is to return false in that scenario.
|
|
37
|
-
* It relies on the fact that if both Glow and Phantom are enabled,
|
|
38
|
-
* solana.isGlow will return false.
|
|
39
|
-
*/
|
|
40
|
-
return (this.solProviderHelper.isInstalledHelper(this.name) &&
|
|
41
|
-
!((_a = window.solana) === null || _a === void 0 ? void 0 : _a.isGlow));
|
|
42
|
-
}
|
|
43
|
-
fetchPublicAddress() {
|
|
44
|
-
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
45
|
-
if (this.isInstalledOnBrowser()) {
|
|
46
|
-
return this.solProviderHelper.fetchPublicAddressWithName(this.name);
|
|
47
|
-
}
|
|
48
|
-
const url = encodeURIComponent(window.location.toString());
|
|
49
|
-
const ref = encodeURIComponent(window.location.origin);
|
|
50
|
-
// samsung browser only supports native links, not universal links
|
|
51
|
-
if (isMobile.isMobile()) {
|
|
52
|
-
if (isMobile.isSamsungBrowser()) {
|
|
53
|
-
window.location.assign(`phantom://browse/${url}?ref=${ref}`);
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
window.location.assign(`https://phantom.app/ul/browse/${url}?ref=${ref}`);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
return;
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
signMessage(messageToSign) {
|
|
63
|
-
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
64
|
-
return this.solProviderHelper.signMessageWithName(messageToSign, this.name);
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
getConnectedAccounts() {
|
|
68
|
-
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
69
|
-
return this.solProviderHelper.getConnectedAccountsWithName(this.name);
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
module.exports = Phantom;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { WalletEventListeners } from '@dynamic-labs/wallet-connector-core';
|
|
2
|
-
import { ISolana } from '../window';
|
|
3
|
-
import { SolWalletConnector } from './solWalletConnector';
|
|
4
|
-
import { SolProviderHelper } from './solProviderHelper';
|
|
5
|
-
declare class Phantom extends SolWalletConnector {
|
|
6
|
-
name: string;
|
|
7
|
-
solProviderHelper: SolProviderHelper;
|
|
8
|
-
setupEventListeners(listeners: WalletEventListeners): Promise<() => void>;
|
|
9
|
-
teardownEventListeners(): void;
|
|
10
|
-
connect(): Promise<void>;
|
|
11
|
-
getSigner(): Promise<ISolana | undefined>;
|
|
12
|
-
isInstalledOnBrowser(): boolean;
|
|
13
|
-
fetchPublicAddress(): Promise<string | undefined>;
|
|
14
|
-
signMessage(messageToSign: string): Promise<string | undefined>;
|
|
15
|
-
getConnectedAccounts(): Promise<string[]>;
|
|
16
|
-
}
|
|
17
|
-
export default Phantom;
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { __awaiter } from 'tslib';
|
|
2
|
-
import { isMobile, isSamsungBrowser } from '../../utils/isMobile.js';
|
|
3
|
-
import { SolWalletConnector } from './solWalletConnector.js';
|
|
4
|
-
import { SolProviderHelper } from './solProviderHelper.js';
|
|
5
|
-
|
|
6
|
-
class Phantom extends SolWalletConnector {
|
|
7
|
-
constructor() {
|
|
8
|
-
super(...arguments);
|
|
9
|
-
this.name = 'Phantom';
|
|
10
|
-
this.solProviderHelper = new SolProviderHelper();
|
|
11
|
-
}
|
|
12
|
-
setupEventListeners(listeners) {
|
|
13
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
14
|
-
return this.solProviderHelper._setupEventListeners(listeners, this.solProviderHelper.findProvider(this.name));
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
teardownEventListeners() {
|
|
18
|
-
this.solProviderHelper._teardownEventListeners(this.name);
|
|
19
|
-
}
|
|
20
|
-
connect() {
|
|
21
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
-
yield this.solProviderHelper.connectWithName(this.name);
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
getSigner() {
|
|
26
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
-
return this.solProviderHelper.connectWithName(this.name);
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
isInstalledOnBrowser() {
|
|
31
|
-
var _a;
|
|
32
|
-
/**
|
|
33
|
-
* When Glow wallet is installed and Phantom isn't, isPhantom will
|
|
34
|
-
* still be true. This added check is to return false in that scenario.
|
|
35
|
-
* It relies on the fact that if both Glow and Phantom are enabled,
|
|
36
|
-
* solana.isGlow will return false.
|
|
37
|
-
*/
|
|
38
|
-
return (this.solProviderHelper.isInstalledHelper(this.name) &&
|
|
39
|
-
!((_a = window.solana) === null || _a === void 0 ? void 0 : _a.isGlow));
|
|
40
|
-
}
|
|
41
|
-
fetchPublicAddress() {
|
|
42
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
-
if (this.isInstalledOnBrowser()) {
|
|
44
|
-
return this.solProviderHelper.fetchPublicAddressWithName(this.name);
|
|
45
|
-
}
|
|
46
|
-
const url = encodeURIComponent(window.location.toString());
|
|
47
|
-
const ref = encodeURIComponent(window.location.origin);
|
|
48
|
-
// samsung browser only supports native links, not universal links
|
|
49
|
-
if (isMobile()) {
|
|
50
|
-
if (isSamsungBrowser()) {
|
|
51
|
-
window.location.assign(`phantom://browse/${url}?ref=${ref}`);
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
window.location.assign(`https://phantom.app/ul/browse/${url}?ref=${ref}`);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
return;
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
signMessage(messageToSign) {
|
|
61
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
-
return this.solProviderHelper.signMessageWithName(messageToSign, this.name);
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
getConnectedAccounts() {
|
|
66
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
67
|
-
return this.solProviderHelper.getConnectedAccountsWithName(this.name);
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export { Phantom as default };
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var tslib = require('tslib');
|
|
4
|
-
var web3_js = require('@solana/web3.js');
|
|
5
|
-
var logger = require('../../utils/logger.cjs');
|
|
6
|
-
var solWalletConnector = require('./solWalletConnector.cjs');
|
|
7
|
-
|
|
8
|
-
class Slope extends solWalletConnector.SolWalletConnector {
|
|
9
|
-
constructor() {
|
|
10
|
-
super(...arguments);
|
|
11
|
-
this.name = 'Slope';
|
|
12
|
-
this.isConnectData = (value) => { var _a; return ((_a = value.data) === null || _a === void 0 ? void 0 : _a.publicKey) !== undefined; };
|
|
13
|
-
this.isSignatureData = (value) => { var _a; return ((_a = value.data) === null || _a === void 0 ? void 0 : _a.signature) !== undefined; };
|
|
14
|
-
}
|
|
15
|
-
get wallet() {
|
|
16
|
-
if (!window.Slope) {
|
|
17
|
-
return undefined;
|
|
18
|
-
}
|
|
19
|
-
if (!Slope._wallet) {
|
|
20
|
-
Slope._wallet = new window.Slope();
|
|
21
|
-
}
|
|
22
|
-
return Slope._wallet;
|
|
23
|
-
}
|
|
24
|
-
connect() {
|
|
25
|
-
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
26
|
-
if (this.wallet === undefined)
|
|
27
|
-
return;
|
|
28
|
-
yield this.wallet.connect();
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
getSigner() {
|
|
32
|
-
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
33
|
-
return undefined;
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
getBalance() {
|
|
37
|
-
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
38
|
-
try {
|
|
39
|
-
if (this.wallet === undefined)
|
|
40
|
-
return undefined;
|
|
41
|
-
const response = yield this.wallet.connect();
|
|
42
|
-
const publicKey = new web3_js.PublicKey(this.isConnectData(response) && response.data.publicKey);
|
|
43
|
-
const balance = this.lamportsToSol(yield this.getWeb3Provider().getBalance(publicKey));
|
|
44
|
-
return balance.toString();
|
|
45
|
-
}
|
|
46
|
-
catch (e) {
|
|
47
|
-
logger.logger.debug(e);
|
|
48
|
-
return undefined;
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
isInstalledOnBrowser() {
|
|
53
|
-
return typeof window.Slope === 'function';
|
|
54
|
-
}
|
|
55
|
-
fetchPublicAddress() {
|
|
56
|
-
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
57
|
-
try {
|
|
58
|
-
if (this.wallet === undefined)
|
|
59
|
-
return undefined;
|
|
60
|
-
const response = yield this.wallet.connect();
|
|
61
|
-
return this.isConnectData(response) ? response.data.publicKey : undefined;
|
|
62
|
-
}
|
|
63
|
-
catch (e) {
|
|
64
|
-
logger.logger.debug(e);
|
|
65
|
-
return undefined;
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
signMessage(messageToSign) {
|
|
70
|
-
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
71
|
-
const encodedMessage = new TextEncoder().encode(messageToSign);
|
|
72
|
-
try {
|
|
73
|
-
if (this.wallet === undefined)
|
|
74
|
-
return undefined;
|
|
75
|
-
const response = yield this.wallet.signMessage(encodedMessage);
|
|
76
|
-
return this.isSignatureData(response)
|
|
77
|
-
? response.data.signature
|
|
78
|
-
: undefined;
|
|
79
|
-
}
|
|
80
|
-
catch (e) {
|
|
81
|
-
logger.logger.debug(e);
|
|
82
|
-
return undefined;
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
getConnectedAccounts() {
|
|
87
|
-
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
88
|
-
if (this.wallet === undefined)
|
|
89
|
-
return [];
|
|
90
|
-
const response = yield this.wallet.connect();
|
|
91
|
-
return this.isConnectData(response) ? [response.data.publicKey] : [];
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
module.exports = Slope;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { ISolana } from '../window';
|
|
2
|
-
import { SolWalletConnector } from './solWalletConnector';
|
|
3
|
-
interface ConnectData {
|
|
4
|
-
data: {
|
|
5
|
-
publicKey: string;
|
|
6
|
-
};
|
|
7
|
-
}
|
|
8
|
-
interface SignatureData {
|
|
9
|
-
data: {
|
|
10
|
-
signature: string;
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
declare class Slope extends SolWalletConnector {
|
|
14
|
-
name: string;
|
|
15
|
-
private static _wallet;
|
|
16
|
-
get wallet(): ISolana | undefined;
|
|
17
|
-
connect(): Promise<void>;
|
|
18
|
-
getSigner(): Promise<undefined>;
|
|
19
|
-
getBalance(): Promise<string | undefined>;
|
|
20
|
-
isInstalledOnBrowser(): boolean;
|
|
21
|
-
isConnectData: (value: unknown) => value is ConnectData;
|
|
22
|
-
isSignatureData: (value: unknown) => value is SignatureData;
|
|
23
|
-
fetchPublicAddress(): Promise<string | undefined>;
|
|
24
|
-
signMessage(messageToSign: string): Promise<string | undefined>;
|
|
25
|
-
getConnectedAccounts(): Promise<string[]>;
|
|
26
|
-
}
|
|
27
|
-
export default Slope;
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import { __awaiter } from 'tslib';
|
|
2
|
-
import { PublicKey } from '@solana/web3.js';
|
|
3
|
-
import { logger } from '../../utils/logger.js';
|
|
4
|
-
import { SolWalletConnector } from './solWalletConnector.js';
|
|
5
|
-
|
|
6
|
-
class Slope extends SolWalletConnector {
|
|
7
|
-
constructor() {
|
|
8
|
-
super(...arguments);
|
|
9
|
-
this.name = 'Slope';
|
|
10
|
-
this.isConnectData = (value) => { var _a; return ((_a = value.data) === null || _a === void 0 ? void 0 : _a.publicKey) !== undefined; };
|
|
11
|
-
this.isSignatureData = (value) => { var _a; return ((_a = value.data) === null || _a === void 0 ? void 0 : _a.signature) !== undefined; };
|
|
12
|
-
}
|
|
13
|
-
get wallet() {
|
|
14
|
-
if (!window.Slope) {
|
|
15
|
-
return undefined;
|
|
16
|
-
}
|
|
17
|
-
if (!Slope._wallet) {
|
|
18
|
-
Slope._wallet = new window.Slope();
|
|
19
|
-
}
|
|
20
|
-
return Slope._wallet;
|
|
21
|
-
}
|
|
22
|
-
connect() {
|
|
23
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
-
if (this.wallet === undefined)
|
|
25
|
-
return;
|
|
26
|
-
yield this.wallet.connect();
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
getSigner() {
|
|
30
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
-
return undefined;
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
getBalance() {
|
|
35
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
-
try {
|
|
37
|
-
if (this.wallet === undefined)
|
|
38
|
-
return undefined;
|
|
39
|
-
const response = yield this.wallet.connect();
|
|
40
|
-
const publicKey = new PublicKey(this.isConnectData(response) && response.data.publicKey);
|
|
41
|
-
const balance = this.lamportsToSol(yield this.getWeb3Provider().getBalance(publicKey));
|
|
42
|
-
return balance.toString();
|
|
43
|
-
}
|
|
44
|
-
catch (e) {
|
|
45
|
-
logger.debug(e);
|
|
46
|
-
return undefined;
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
isInstalledOnBrowser() {
|
|
51
|
-
return typeof window.Slope === 'function';
|
|
52
|
-
}
|
|
53
|
-
fetchPublicAddress() {
|
|
54
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
55
|
-
try {
|
|
56
|
-
if (this.wallet === undefined)
|
|
57
|
-
return undefined;
|
|
58
|
-
const response = yield this.wallet.connect();
|
|
59
|
-
return this.isConnectData(response) ? response.data.publicKey : undefined;
|
|
60
|
-
}
|
|
61
|
-
catch (e) {
|
|
62
|
-
logger.debug(e);
|
|
63
|
-
return undefined;
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
signMessage(messageToSign) {
|
|
68
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
69
|
-
const encodedMessage = new TextEncoder().encode(messageToSign);
|
|
70
|
-
try {
|
|
71
|
-
if (this.wallet === undefined)
|
|
72
|
-
return undefined;
|
|
73
|
-
const response = yield this.wallet.signMessage(encodedMessage);
|
|
74
|
-
return this.isSignatureData(response)
|
|
75
|
-
? response.data.signature
|
|
76
|
-
: undefined;
|
|
77
|
-
}
|
|
78
|
-
catch (e) {
|
|
79
|
-
logger.debug(e);
|
|
80
|
-
return undefined;
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
getConnectedAccounts() {
|
|
85
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
86
|
-
if (this.wallet === undefined)
|
|
87
|
-
return [];
|
|
88
|
-
const response = yield this.wallet.connect();
|
|
89
|
-
return this.isConnectData(response) ? [response.data.publicKey] : [];
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
export { Slope as default };
|