Socket
Socket
Sign inDemoInstall

@dynamic-labs/wallet-connector-core

Package Overview
Dependencies
Maintainers
1
Versions
585
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dynamic-labs/wallet-connector-core - npm Package Compare versions

Comparing version 0.0.0-exp20240810.0 to 0.0.0-exp20240827.1

src/utils/isSessionKeyCompatible/index.d.ts

14

package.json
{
"name": "@dynamic-labs/wallet-connector-core",
"version": "0.0.0-exp20240810.0",
"version": "0.0.0-exp20240827.1",
"repository": {

@@ -29,12 +29,12 @@ "type": "git",

"dependencies": {
"@dynamic-labs/sdk-api-core": "0.0.509"
"@dynamic-labs/sdk-api-core": "0.0.519"
},
"peerDependencies": {
"@dynamic-labs/logger": "0.0.0-exp20240810.0",
"@dynamic-labs/rpc-providers": "0.0.0-exp20240810.0",
"@dynamic-labs/types": "0.0.0-exp20240810.0",
"@dynamic-labs/utils": "0.0.0-exp20240810.0",
"@dynamic-labs/wallet-book": "0.0.0-exp20240810.0",
"@dynamic-labs/logger": "0.0.0-exp20240827.1",
"@dynamic-labs/rpc-providers": "0.0.0-exp20240827.1",
"@dynamic-labs/types": "0.0.0-exp20240827.1",
"@dynamic-labs/utils": "0.0.0-exp20240827.1",
"@dynamic-labs/wallet-book": "0.0.0-exp20240827.1",
"eventemitter3": "5.0.1"
}
}

@@ -1,4 +0,4 @@

export * from './lib';
export * from './types';
export * from './utils';
export { Chains, Wallet, WalletConnectorBase, socialProviders, type Attestation, type AuthenticatorRecoveryHandler, type AuthenticatorType, type BitcoinSignPsbtRequest, type BitcoinSignPsbtRequestSignature, type BitcoinSignPsbtResponse, type Chain, type ChainInfo, type ExportHandler, type ExtendedPrivateKey, type GetAddressOpts, type IAccountAbstractionWalletConnector, type IBitcoinWalletConnector, type ICoinbaseMPCWalletConnector, type IEmailOTPWalletConnector, type IEmailWalletConnector, type IHardwareWalletConnector, type InternalWalletConnector, type IPasskeyWalletConnector, type IPhantomRedirectConnector, type IPhantomRedirectConnectorWithEvents, type ISMSWalletConnector, type ISendBalanceWalletConnector, type ISessionKeyCompatibleWalletConnector, type ITurnkeyWalletConnectorStamper, type IWalletConnectConnector, type NameServiceData, type PayloadParams, type RawPrivateKey, type RecoveryEmailParams, type RecoveryWebAuthnAttestation, type SignAllTransactionsListener, type SignAndSendTransactionListener, type SignMessageListener, type SignTransactionListener, type SocialProvider, type WalletConnector, type WalletConnectorConstructor, type WalletConnectorCore, type WalletConnectorEventTypes, type WalletConnectorsMethod, type WalletConstructor, type WalletProps, type WebAuthnAttestation, } from './lib';
export type { WalletConnectorExtension } from './lib/WalletConnectorExtension';
export type { AccountChangeEventHandler, ChainChangeEventHandler, DisconnectEventHandler, } from './types';
export { ProviderLookup, addHexPrefix, bufferToHex, eventListenerHandlers, getChainInfo, getChainInfoWithOverrides, setChainInfoOverrides, getDeepLink, getMobileExperience, getRpcUrlForChain, getWalletConnectorByKey, isAccountAbstractionConnector, isBitcoinConnector, isBloctoConnector, isCoinbaseMpcWalletConnector, isEmailOTPWalletConnector, isEmailWalletConnector, isEmbeddedConnector, isHardwareWalletConnector, isHex, isMagicConnector, isPasskeyWalletConnector, isPhantomRedirectConnector, isSameAddress, isSendBalanceWalletConnector, isSessionKeyCompatibleWallet, isSessionKeyCompatibleWalletConnector, isSocialWalletConnector, isWalletConnectConnector, logger, performPlatformSpecificConnectionMethod, shouldLowercaseAddress, utf8ToHex, type DeepLinkVariant, type ProviderCondition, type ChainDisplayOverrides, } from './utils';

@@ -6,3 +6,3 @@ 'use client'

export { ProviderLookup } from './utils/ProviderLookup/ProviderLookup.js';
export { getChainInfo } from './utils/getChainInfo/getChainInfo.js';
export { getChainInfo, getChainInfoWithOverrides, setChainInfoOverrides } from './utils/getChainInfo/getChainInfo.js';
export { isEmailOTPWalletConnector } from './utils/isEmailOTPWalletConnector/isEmailOTPWalletConnector.js';

@@ -21,3 +21,2 @@ export { isEmailWalletConnector } from './utils/isEmailWalletConnector/isEmailWalletConnector.js';

export { isPasskeyWalletConnector } from './utils/isPasskeyWalletConnector/isPasskeyWalletConnector.js';
export { isSmartWalletConnector } from './utils/isSmartWalletConnector/isSmartWalletConnector.js';
export { isAccountAbstractionConnector } from './utils/isAccountAbstractionConnector/isAccountAbstractionConnector.js';

@@ -33,3 +32,4 @@ export { isBitcoinConnector } from './utils/isBitcoinConnector/isBitcoinConnector.js';

export { isSendBalanceWalletConnector } from './utils/isSendBalanceWalletConnector/isSendBalanceWalletConnector.js';
export { isSessionKeyCompatibleWalletConnector } from './utils/isSessionKeyCompatibleWalletConnector/isSessionKeyCompatibleWalletConnector.js';
export { isSessionKeyCompatibleWallet } from './utils/isSessionKeyCompatible/isSessionKeyCompatibleWallet/isSessionKeyCompatibleWallet.js';
export { isSessionKeyCompatibleWalletConnector } from './utils/isSessionKeyCompatible/isSessionKeyCompatibleWalletConnector/isSessionKeyCompatibleWalletConnector.js';
export { getMobileExperience } from './utils/getMobileExperience/getMobileExperience.js';

@@ -11,4 +11,9 @@ import { IUITransaction } from '@dynamic-labs/types';

getAccountAbstractionProvider(props?: GetAccountAbstractionProviderProps): unknown;
setEoaConnector(connector: WalletConnectorBase): Promise<void>;
/**
* @deprecated You should get the EOA connector by passing the SCW wallet to getEOAConnector,
* from the useSmartWallet hook
*/
getEOAConnector(): WalletConnector | undefined;
}
export {};

@@ -23,2 +23,3 @@ import { WalletConnectorBase } from '.';

signPsbt(request: BitcoinSignPsbtRequest): Promise<BitcoinSignPsbtResponse | undefined>;
signPsbts(requests: BitcoinSignPsbtRequest[]): Promise<string[] | undefined>;
isHardwareWalletEnabled: boolean;

@@ -25,0 +26,0 @@ isLedgerAddress(address: string): boolean;

@@ -1,4 +0,5 @@

export interface IHardwareWalletConnector {
import { WalletConnectorBase } from '../';
export interface IHardwareWalletConnector extends WalletConnectorBase {
canConnectWithHardwareWallet(): boolean;
isHardwareWalletEnabled: boolean;
}

@@ -7,3 +7,2 @@ export * from './IEmailOTPWalletConnector';

export * from './ITurnkeyWalletConnectorStamper';
export * from './SmartWalletConnector';
export * from './IAccountAbstractionWalletConnector';

@@ -10,0 +9,0 @@ export * from './IBitcoinWalletConnector';

@@ -1,5 +0,6 @@

import { IUITransaction } from '@dynamic-labs/types';
import { TransactionReceipt, IUITransaction } from '@dynamic-labs/types';
import { WalletConnectorBase } from './WalletConnector';
export interface ISendBalanceWalletConnector extends WalletConnectorBase {
createUiTransaction(from: string): Promise<IUITransaction>;
confirmTransactionStatus?(txHash: string): Promise<TransactionReceipt>;
}

@@ -37,5 +37,6 @@ import EventEmitter from 'eventemitter3';

}
export type WalletConnector = WalletConnectorCore.WalletConnector;
export type InternalWalletConnector = WalletConnectorCore.WalletConnector;
export type WalletConnector = Pick<InternalWalletConnector, 'canConnectViaCustodialService' | 'canConnectViaQrCode' | 'canConnectViaSocial' | 'chainRpcProviders' | 'connect' | 'connectedChain' | 'createWallet' | 'constructorProps' | 'endSession' | 'getAddress' | 'getAdditionalAddresses' | 'getConnectedAccounts' | 'getNetwork' | 'initEventListener' | 'isAvailable' | 'isEmbeddedWallet' | 'isInitialized' | 'isInstalledOnBrowser' | 'isTestnet' | 'isWalletConnect' | 'key' | 'name' | 'parseAddress' | 'proveOwnership' | 'providerResources' | 'supportedChains' | 'supportsNetworkSwitching' | 'switchNetwork' | 'switchNetworkOnlyFromWallet' | 'teardownEventListeners'> & EventEmitter<WalletConnectorEventTypes>;
export interface WalletConnectorConstructor {
new (props?: any): WalletConnector;
new (props?: any): InternalWalletConnector;
}

@@ -55,3 +56,3 @@ export type WalletConnectorsMethod = (props?: any) => WalletConnectorConstructor[];

abstract ChainWallet: C;
createWallet(props: WalletProps<WalletConnector>): Wallet<any>;
createWallet(props: WalletProps<InternalWalletConnector>): Wallet<any>;
chainRpcProviders: IChainRpcProviders | undefined;

@@ -61,2 +62,3 @@ constructorProps: any;

walletFallback: WalletSchema | undefined;
isGlobalTransaction: boolean;
/**

@@ -264,3 +266,3 @@ * We store the constructor props so that we can use them later on

*/
getMobileOrInstalledWallet(): WalletConnector;
getMobileOrInstalledWallet(): InternalWalletConnector;
/**

@@ -271,3 +273,3 @@ * In most cases this is an alias for `signMessage`

*/
proveOwnership(messageToSign: string): Promise<string | undefined>;
proveOwnership(address: string, messageToSign: string): Promise<string | undefined>;
/**

@@ -274,0 +276,0 @@ * Additional resources to add to the message to be signed

@@ -55,2 +55,3 @@ 'use client'

this.chainRpcProviders = undefined;
this.isGlobalTransaction = false;
_WalletConnectorBase_registeredExtensions.set(this, []);

@@ -309,4 +310,7 @@ this.didSetup = false;

*/
proveOwnership(messageToSign) {
return this.signMessage(messageToSign);
proveOwnership(address, messageToSign) {
return __awaiter(this, void 0, void 0, function* () {
yield this.validateActiveWallet(address);
return this.signMessage(messageToSign);
});
}

@@ -313,0 +317,0 @@ /**

@@ -1,5 +0,5 @@

import { WalletConnector } from '.';
import { InternalWalletConnector } from '.';
export interface WalletConnectorExtension {
extend(connector: WalletConnector): void;
extend(connector: InternalWalletConnector): void;
name: string;
}
import type { BaseWalletProps } from '@dynamic-labs/types';
import { BaseWallet } from '@dynamic-labs/types';
import { NameServiceData, WalletConnector } from '../../';
export type WalletProps<T extends WalletConnector = WalletConnector> = BaseWalletProps & {
import { WalletConnector, NameServiceData, InternalWalletConnector } from '../../';
export type WalletProps<T extends InternalWalletConnector = InternalWalletConnector> = BaseWalletProps & {
connector: T;
};
export declare class Wallet<T extends WalletConnector = WalletConnector> extends BaseWallet {
export declare class Wallet<T extends InternalWalletConnector = InternalWalletConnector> extends BaseWallet {
protected _connector: T;

@@ -13,3 +13,3 @@ constructor({ connector, ...props }: WalletProps<T>);

*/
get connector(): T;
get connector(): WalletConnector;
/**

@@ -28,24 +28,2 @@ * Retrieves the balance of the wallet.

/**
* Retrieves the rpc provider for the wallet.
* @returns A promise that resolves to the provider,
* or undefined if the provider cannot be retrieved.
*/
getPublicClient(): Promise<unknown>;
getPublicClient<T>(): Promise<T>;
/**
* Retrieves the signer for the wallet.
* @returns A promise that resolves to the signer,
* or undefined if the signer cannot be retrieved.
*/
getSigner(): Promise<unknown>;
getSigner<T>(): Promise<T>;
/**
* Retrieves the wallet client.
* @param chainId - (optional) Chain id to be used by the wallet client.
* @returns A promise that resolves to the wallet client,
* or undefined if the wallet client cannot be retrieved.
*/
getWalletClient(chainId?: string): Promise<unknown>;
getWalletClient<T>(chainId?: string): Promise<T>;
/**
* If the wallet is connected.

@@ -81,4 +59,4 @@ * @returns A promise that resolves to true the wallet is connected or false if it's not connected.

}
export interface WalletConstructor<T extends WalletConnector> {
export interface WalletConstructor<T extends InternalWalletConnector> {
new (props: WalletProps<T>): Wallet<T>;
}

@@ -5,2 +5,3 @@ 'use client'

import { logger } from '../../../utils/logger.js';
import { normalizeAddress } from '../../../utils/isSameAddress/utils/normalizeAddress/normalizeAddress.js';
import '@dynamic-labs/utils';

@@ -41,17 +42,2 @@ import '@dynamic-labs/wallet-book';

}
getPublicClient() {
return this._connector.getPublicClient();
}
getSigner() {
return __awaiter(this, void 0, void 0, function* () {
yield this.sync();
return this._connector.getSigner();
});
}
getWalletClient(chainId) {
return __awaiter(this, void 0, void 0, function* () {
yield this.sync();
return this._connector.getWalletClient(chainId);
});
}
/**

@@ -65,3 +51,5 @@ * If the wallet is connected.

const connectedAccounts = yield this._connector.getConnectedAccounts();
return connectedAccounts.includes(this.address);
return connectedAccounts
.map((address) => normalizeAddress(address, this.chain))
.includes(normalizeAddress(this.address, this.chain));
}

@@ -82,4 +70,3 @@ catch (error) {

return __awaiter(this, void 0, void 0, function* () {
yield this.sync();
return this._connector.proveOwnership(messageToSign);
return this._connector.proveOwnership(this.address, messageToSign);
});

@@ -86,0 +73,0 @@ }

import { ChainInfo } from '../../lib';
export type ChainName = 'algorand' | 'bitcoin' | 'evm' | 'flow' | 'solana' | 'starknet' | 'cosmos';
export type ChainDisplayOverrides = Partial<Record<ChainName, {
displayName?: string;
}>>;
export declare const setChainInfoOverrides: (overrides?: ChainDisplayOverrides) => void;
export declare const getChainInfo: (chain: string) => ChainInfo | undefined;
export declare const getChainInfoWithOverrides: (chain: string) => ChainInfo | undefined;

@@ -53,6 +53,14 @@ 'use client'

const chainOverrides = {
algo: 'algorand',
bip122: 'bitcoin',
btc: 'bitcoin',
eip155: 'evm',
eth: 'evm',
sol: 'solana',
stark: 'starknet',
};
let chainInfoOverrides;
const setChainInfoOverrides = (overrides) => {
chainInfoOverrides = overrides;
};
const getChainInfo = (chain) => {

@@ -69,3 +77,18 @@ var _a;

};
const getChainInfoWithOverrides = (chain) => {
var _a, _b;
const chainInfo = getChainInfo(chain);
if (!chainInfo) {
return;
}
const overrides = chainInfoOverrides === null || chainInfoOverrides === void 0 ? void 0 : chainInfoOverrides[chainInfo.name];
const chainInfoClone = Object.assign({}, chainInfo);
if (overrides) {
chainInfoClone.blockchainName =
(_a = overrides.displayName) !== null && _a !== void 0 ? _a : chainInfo.blockchainName;
chainInfoClone.displayName = (_b = overrides.displayName) !== null && _b !== void 0 ? _b : chainInfo.displayName;
}
return chainInfoClone;
};
export { getChainInfo };
export { getChainInfo, getChainInfoWithOverrides, setChainInfoOverrides };

@@ -1,1 +0,1 @@

export { getChainInfo } from './getChainInfo';
export { getChainInfo, setChainInfoOverrides, getChainInfoWithOverrides, type ChainDisplayOverrides, } from './getChainInfo';

@@ -1,2 +0,2 @@

import { WalletConnector } from '../lib';
export declare const getWalletConnectorByKey: (wallets: WalletConnector[], key: string) => WalletConnector | null;
import { InternalWalletConnector } from '../lib';
export declare const getWalletConnectorByKey: (wallets: InternalWalletConnector[], key: string) => InternalWalletConnector | null;

@@ -16,3 +16,2 @@ export * from './logger';

export * from './isPasskeyWalletConnector';
export * from './isSmartWalletConnector';
export * from './isAccountAbstractionConnector';

@@ -28,3 +27,3 @@ export * from './isBitcoinConnector';

export * from './isSendBalanceWalletConnector';
export * from './isSessionKeyCompatibleWalletConnector';
export * from './isSessionKeyCompatible';
export * from './getMobileExperience';

@@ -1,1 +0,1 @@

export { isAccountAbstractionConnector } from './isAccountAbstractionConnector';
export * from './isAccountAbstractionConnector';
import { IHardwareWalletConnector, WalletConnector } from '../../lib';
export declare const isHardwareWalletConnector: (connector: WalletConnector | IHardwareWalletConnector) => connector is IHardwareWalletConnector & import("../../lib").WalletConnectorCore.WalletConnector;
export declare const isHardwareWalletConnector: (connector: WalletConnector | IHardwareWalletConnector) => connector is IHardwareWalletConnector;

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc