@solana/connector 0.1.1 → 0.1.3

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.
@@ -1086,24 +1086,26 @@ var logger4 = createLogger("AutoConnector"), MIN_ADDRESS_LENGTH = 30, AutoConnec
1086
1086
  if (this.debug && (logger4.debug("Direct wallet connect result", { result }), logger4.debug("Direct wallet publicKey property", { publicKey: directWallet.publicKey })), result && typeof result == "object" && "accounts" in result && Array.isArray(result.accounts))
1087
1087
  return result;
1088
1088
  let legacyResult = result;
1089
- if (legacyResult?.publicKey && typeof legacyResult.publicKey.toString == "function")
1089
+ if (legacyResult?.publicKey && typeof legacyResult.publicKey.toString == "function") {
1090
+ let address = legacyResult.publicKey.toString(), publicKeyBytes = legacyResult.publicKey.toBytes ? legacyResult.publicKey.toBytes() : new Uint8Array();
1090
1091
  return {
1091
1092
  accounts: [
1092
1093
  {
1093
- address: legacyResult.publicKey.toString(),
1094
- publicKey: legacyResult.publicKey.toBytes ? legacyResult.publicKey.toBytes() : new Uint8Array(),
1094
+ address,
1095
+ publicKey: publicKeyBytes,
1095
1096
  chains: ["solana:mainnet", "solana:devnet", "solana:testnet"],
1096
1097
  features: []
1097
1098
  }
1098
1099
  ]
1099
1100
  };
1101
+ }
1100
1102
  if (directWallet.publicKey && typeof directWallet.publicKey.toString == "function") {
1101
- let address = directWallet.publicKey.toString();
1103
+ let address = directWallet.publicKey.toString(), publicKeyBytes = directWallet.publicKey.toBytes ? directWallet.publicKey.toBytes() : new Uint8Array();
1102
1104
  return this.debug && logger4.debug("Using legacy wallet pattern - publicKey from wallet object"), {
1103
1105
  accounts: [
1104
1106
  {
1105
1107
  address,
1106
- publicKey: directWallet.publicKey.toBytes ? directWallet.publicKey.toBytes() : new Uint8Array(),
1108
+ publicKey: publicKeyBytes,
1107
1109
  chains: ["solana:mainnet", "solana:devnet", "solana:testnet"],
1108
1110
  features: []
1109
1111
  }
@@ -1111,16 +1113,20 @@ var logger4 = createLogger("AutoConnector"), MIN_ADDRESS_LENGTH = 30, AutoConnec
1111
1113
  };
1112
1114
  }
1113
1115
  let publicKeyResult = result;
1114
- return publicKeyResult && typeof publicKeyResult.toString == "function" && publicKeyResult.toString().length > MIN_ADDRESS_LENGTH ? {
1115
- accounts: [
1116
- {
1117
- address: publicKeyResult.toString(),
1118
- publicKey: publicKeyResult.toBytes ? publicKeyResult.toBytes() : new Uint8Array(),
1119
- chains: ["solana:mainnet", "solana:devnet", "solana:testnet"],
1120
- features: []
1121
- }
1122
- ]
1123
- } : (this.debug && logger4.error("Legacy wallet: No valid publicKey found in any expected location"), { accounts: [] });
1116
+ if (publicKeyResult && typeof publicKeyResult.toString == "function" && publicKeyResult.toString().length > MIN_ADDRESS_LENGTH) {
1117
+ let address = publicKeyResult.toString(), publicKeyBytes = publicKeyResult.toBytes ? publicKeyResult.toBytes() : new Uint8Array();
1118
+ return {
1119
+ accounts: [
1120
+ {
1121
+ address,
1122
+ publicKey: publicKeyBytes,
1123
+ chains: ["solana:mainnet", "solana:devnet", "solana:testnet"],
1124
+ features: []
1125
+ }
1126
+ ]
1127
+ };
1128
+ }
1129
+ return this.debug && logger4.error("Legacy wallet: No valid publicKey found in any expected location"), { accounts: [] };
1124
1130
  }
1125
1131
  }), directWallet.disconnect) {
1126
1132
  let disconnectFn = directWallet.disconnect;
@@ -1130,13 +1136,13 @@ var logger4 = createLogger("AutoConnector"), MIN_ADDRESS_LENGTH = 30, AutoConnec
1130
1136
  }
1131
1137
  if (directWallet.signTransaction) {
1132
1138
  let signTransactionFn = directWallet.signTransaction;
1133
- features["standard:signTransaction"] = {
1139
+ features["solana:signTransaction"] = {
1134
1140
  signTransaction: (tx) => signTransactionFn.call(directWallet, tx)
1135
1141
  };
1136
1142
  }
1137
1143
  if (directWallet.signMessage) {
1138
1144
  let signMessageFn = directWallet.signMessage;
1139
- features["standard:signMessage"] = {
1145
+ features["solana:signMessage"] = {
1140
1146
  signMessage: (...args) => {
1141
1147
  let msg = args[0];
1142
1148
  return signMessageFn.call(directWallet, msg);
@@ -1156,7 +1162,7 @@ var logger4 = createLogger("AutoConnector"), MIN_ADDRESS_LENGTH = 30, AutoConnec
1156
1162
  features,
1157
1163
  accounts: []
1158
1164
  };
1159
- return this.stateManager.updateState(
1165
+ this.stateManager.updateState(
1160
1166
  {
1161
1167
  wallets: [
1162
1168
  {
@@ -1167,8 +1173,13 @@ var logger4 = createLogger("AutoConnector"), MIN_ADDRESS_LENGTH = 30, AutoConnec
1167
1173
  ]
1168
1174
  },
1169
1175
  true
1170
- ), this.debug && logger4.info("Attempting to connect via instant auto-connect", { walletName: storedWalletName }), await this.connectionManager.connect(wallet, storedWalletName), this.debug && logger4.info("Instant auto-connect successful", { walletName: storedWalletName }), setTimeout(() => {
1171
- let ws = getWalletsRegistry().get();
1176
+ );
1177
+ let walletsApi = getWalletsRegistry(), registryWallet = walletsApi.get().find((w) => w.name === storedWalletName), walletToUse = registryWallet || wallet;
1178
+ return this.debug && logger4.info("Attempting to connect via instant auto-connect", {
1179
+ walletName: storedWalletName,
1180
+ usingRegistry: !!registryWallet
1181
+ }), await this.connectionManager.connect(walletToUse, storedWalletName), this.debug && logger4.info("Instant auto-connect successful", { walletName: storedWalletName }), setTimeout(() => {
1182
+ let ws = walletsApi.get();
1172
1183
  this.debug && logger4.debug("Checking for wallet standard update", {
1173
1184
  wsLength: ws.length,
1174
1185
  currentWalletsLength: this.stateManager.getSnapshot().wallets.length,
@@ -2415,5 +2426,5 @@ function createGillTransactionSigner(connectorSigner) {
2415
2426
  }
2416
2427
 
2417
2428
  export { ClipboardErrorType, ConfigurationError, ConnectionError, ConnectorClient, ConnectorError, ConnectorErrorBoundary, DEFAULT_MAX_RETRIES, Errors, NetworkError, PUBLIC_RPC_ENDPOINTS, TransactionError, TransactionSignerError, ValidationError, WalletErrorType, copyAddressToClipboard, copySignatureToClipboard, copyToClipboard, createGillTransactionSigner, createTransactionSigner, formatAddress, formatNumber, formatSOL, formatTokenAmount, getAddressUrl, getBlockUrl, getChainIdForWalletStandard, getClusterChainId, getClusterExplorerUrl, getClusterName, getClusterRpcUrl, getClusterType, getDefaultRpcUrl, getNetworkDisplayName, getPolyfillStatus, getTokenUrl, getTransactionUrl, getUserFriendlyMessage, getWalletsRegistry, installPolyfills, isClipboardAvailable, isConfigurationError, isConnectionError, isConnectorError, isCryptoAvailable, isDevnet, isDevnetCluster, isLocalCluster, isLocalnet, isMainnet, isMainnetCluster, isNetworkError, isPolyfillInstalled, isTestnet, isTestnetCluster, isTransactionError, isTransactionSignerError, isValidationError, normalizeNetwork, toClusterId, toConnectorError, truncate, withErrorBoundary };
2418
- //# sourceMappingURL=chunk-TAAXHAV2.mjs.map
2419
- //# sourceMappingURL=chunk-TAAXHAV2.mjs.map
2429
+ //# sourceMappingURL=chunk-TKJSKXSA.mjs.map
2430
+ //# sourceMappingURL=chunk-TKJSKXSA.mjs.map