Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@wallet-standard/features

Package Overview
Dependencies
Maintainers
2
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wallet-standard/features - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

64

lib/types/connect.d.ts
import type { WalletAccount } from '@wallet-standard/base';
/** TODO: docs */
/**
* `standard:connect` is a {@link "@wallet-standard/base".Wallet.features | feature} that may be implemented by a
* {@link "@wallet-standard/base".Wallet} to allow the app to obtain authorization to use
* {@link "@wallet-standard/base".Wallet.accounts}.
*
* @group Connect
*/
export declare type ConnectFeature = {
/** Namespace for the feature. */
'standard:connect': {
/** Version of the feature API. */
version: ConnectVersion;
/**
* Connect to accounts in the wallet.
*
* @param input Input for connecting.
*
* @return Output of connecting.
*/
connect: ConnectMethod;
/** Name of the feature. */
readonly 'standard:connect': {
/** Version of the feature implemented by the Wallet. */
readonly version: ConnectVersion;
/** Method to call to use the feature. */
readonly connect: ConnectMethod;
};
};
/** TODO: docs */
/**
* Version of the {@link ConnectFeature} implemented by a {@link "@wallet-standard/base".Wallet}.
*
* @group Connect
*/
export declare type ConnectVersion = '1.0.0';
/** TODO: docs */
/**
* Method to call to use the {@link ConnectFeature}.
*
* @group Connect
*/
export declare type ConnectMethod = (input?: ConnectInput) => Promise<ConnectOutput>;
/** Input for connecting. */
/**
* Input for the {@link ConnectMethod}.
*
* @group Connect
*/
export interface ConnectInput {
/**
* Set to true to request the authorized accounts without prompting the user.
* The wallet should return only the accounts that the app is already authorized to connect to.
* By default, using the {@link ConnectFeature} should prompt the user to request authorization to accounts.
* Set the `silent` flag to `true` to request accounts that have already been authorized without prompting.
*
* This flag may or may not be used by the Wallet and the app should not depend on it being used.
* If this flag is used by the Wallet, the Wallet should not prompt the user, and should return only the accounts
* that the app is authorized to use.
*/
silent?: boolean;
readonly silent?: boolean;
}
/** Output of connecting. */
/**
* Output of the {@link ConnectMethod}.
*
* @group Connect
*/
export interface ConnectOutput {
/** List of accounts in the wallet that the app has been authorized to use. */
accounts: ReadonlyArray<WalletAccount>;
/** List of accounts in the {@link "@wallet-standard/base".Wallet} that the app has been authorized to use. */
readonly accounts: readonly WalletAccount[];
}
//# sourceMappingURL=connect.d.ts.map
/**
* The disconnect feature is an optional feature that may be implemented by
* wallets to perform any cleanup-related work.
* This feature may not be invoked by dapps and should not be depended on.
* This feature should not remove any permissions previously granted through ConnectFeature.
* `standard:disconnect` is a {@link "@wallet-standard/base".Wallet.features | feature} that may be implemented by a
* {@link "@wallet-standard/base".Wallet} to allow the app to perform any cleanup work.
*
* This feature may or may not be used by the app and the Wallet should not depend on it being used.
* If this feature is used by the app, the Wallet should perform any cleanup work, but should not revoke authorization
* to use accounts previously granted through the {@link ConnectFeature}.
*
* @group Disconnect
*/
export declare type DisconnectFeature = {
/** Namespace for the feature. */
'standard:disconnect': {
/** Version of the feature API. */
version: DisconnectVersion;
/**
* Disconnect from the wallet.
*/
disconnect: DisconnectMethod;
/** Name of the feature. */
readonly 'standard:disconnect': {
/** Version of the feature implemented by the Wallet. */
readonly version: DisconnectVersion;
/** Method to call to use the feature. */
readonly disconnect: DisconnectMethod;
};
};
/** TODO: docs */
/**
* Version of the {@link DisconnectFeature} implemented by a Wallet.
*
* @group Disconnect
*/
export declare type DisconnectVersion = '1.0.0';
/** TODO: docs */
/**
* Method to call to use the {@link DisconnectFeature}.
*
* @group Disconnect
*/
export declare type DisconnectMethod = () => Promise<void>;
//# sourceMappingURL=disconnect.d.ts.map
import type { Wallet } from '@wallet-standard/base';
/** TODO: docs */
/**
* `standard:events` is a {@link "@wallet-standard/base".Wallet.features | feature} that may be implemented by a
* {@link "@wallet-standard/base".Wallet} to allow the app to add an event listener and subscribe to events emitted by
* the Wallet when properties of the Wallet {@link EventsListeners.change}.
*
* @group Events
*/
export declare type EventsFeature = {
/** Namespace for the feature. */
'standard:events': {
/** Version of the feature API. */
version: EventsVersion;
/** TODO: docs */
on: EventsOnMethod;
/** Name of the feature. */
readonly 'standard:events': {
/** Version of the feature implemented by the {@link "@wallet-standard/base".Wallet}. */
readonly version: EventsVersion;
/** Method to call to use the feature. */
readonly on: EventsOnMethod;
};
};
/** TODO: docs */
/**
* Version of the {@link EventsFeature} implemented by a {@link "@wallet-standard/base".Wallet}.
*
* @group Events
*/
export declare type EventsVersion = '1.0.0';
/**
* Add an event listener to subscribe to events.
* Method to call to use the {@link EventsFeature}.
*
* @param event Event name to listen for.
* @param listener Function that will be called when the event is emitted.
* @param event Event type to listen for. {@link EventsListeners.change | `change`} is the only event type.
* @param listener Function that will be called when an event of the type is emitted.
*
* @return Function to remove the event listener and unsubscribe.
* @return
* `off` function which may be called to remove the event listener and unsubscribe from events.
*
* As with all event listeners, be careful to avoid memory leaks.
*
* @group Events
*/
export declare type EventsOnMethod = <E extends EventsNames>(event: E, listener: EventsListeners[E]) => () => void;
/** Events emitted by wallets. */
/**
* Types of event listeners of the {@link EventsFeature}.
*
* @group Events
*/
export interface EventsListeners {
/**
* Emitted when properties of the wallet have changed.
* Listener that will be called when {@link EventsChangeProperties | properties} of the
* {@link "@wallet-standard/base".Wallet} have changed.
*
* @param properties Properties that changed with their new values.
* @param properties Properties that changed with their **new** values.
*/
change(properties: EventsChangeProperties): void;
}
/** TODO: docs */
/**
* Names of {@link EventsListeners} that can be listened for.
*
* @group Events
*/
export declare type EventsNames = keyof EventsListeners;
/** TODO: docs */
/**
* Properties of a {@link "@wallet-standard/base".Wallet} that {@link EventsListeners.change | changed} with their
* **new** values.
*
* @group Events
*/
export interface EventsChangeProperties {
chains?: Wallet['chains'];
features?: Wallet['features'];
accounts?: Wallet['accounts'];
/**
* {@link "@wallet-standard/base".Wallet.chains | Chains} supported by the Wallet.
*
* The Wallet should only define this field if the value of the property has changed.
*
* The value must be the **new** value of the property.
*/
readonly chains?: Wallet['chains'];
/**
* {@link "@wallet-standard/base".Wallet.features | Features} supported by the Wallet.
*
* The Wallet should only define this field if the value of the property has changed.
*
* The value must be the **new** value of the property.
*/
readonly features?: Wallet['features'];
/**
* {@link "@wallet-standard/base".Wallet.accounts | Accounts} that the app is authorized to use.
*
* The Wallet should only define this field if the value of the property has changed.
*
* The value must be the **new** value of the property.
*/
readonly accounts?: Wallet['accounts'];
}
//# sourceMappingURL=events.d.ts.map

@@ -5,5 +5,14 @@ import type { WalletWithFeatures } from '@wallet-standard/base';

import type { EventsFeature } from './events.js';
/** TODO: docs */
/**
* Type alias for some or all {@link "@wallet-standard/base".Wallet.features} implemented within the reserved `standard`
* namespace.
*
* @group Features
*/
export declare type StandardFeatures = ConnectFeature | DisconnectFeature | EventsFeature;
/** TODO: docs */
/**
* Type alias for a {@link "@wallet-standard/base".Wallet} that implements some or all {@link StandardFeatures}.
*
* @group Features
*/
export declare type WalletWithStandardFeatures = WalletWithFeatures<StandardFeatures>;

@@ -10,0 +19,0 @@ export * from './connect.js';

{
"name": "@wallet-standard/features",
"version": "1.0.0",
"version": "1.0.1",
"author": "Solana Maintainers <maintainers@solana.foundation>",

@@ -29,3 +29,3 @@ "repository": "https://github.com/wallet-standard/wallet-standard",

"dependencies": {
"@wallet-standard/base": "^1.0.0"
"@wallet-standard/base": "^1.0.1"
},

@@ -32,0 +32,0 @@ "devDependencies": {

import type { WalletAccount } from '@wallet-standard/base';
/** TODO: docs */
/**
* `standard:connect` is a {@link "@wallet-standard/base".Wallet.features | feature} that may be implemented by a
* {@link "@wallet-standard/base".Wallet} to allow the app to obtain authorization to use
* {@link "@wallet-standard/base".Wallet.accounts}.
*
* @group Connect
*/
export type ConnectFeature = {
/** Namespace for the feature. */
'standard:connect': {
/** Version of the feature API. */
version: ConnectVersion;
/**
* Connect to accounts in the wallet.
*
* @param input Input for connecting.
*
* @return Output of connecting.
*/
connect: ConnectMethod;
/** Name of the feature. */
readonly 'standard:connect': {
/** Version of the feature implemented by the Wallet. */
readonly version: ConnectVersion;
/** Method to call to use the feature. */
readonly connect: ConnectMethod;
};
};
/** TODO: docs */
/**
* Version of the {@link ConnectFeature} implemented by a {@link "@wallet-standard/base".Wallet}.
*
* @group Connect
*/
export type ConnectVersion = '1.0.0';
/** TODO: docs */
/**
* Method to call to use the {@link ConnectFeature}.
*
* @group Connect
*/
export type ConnectMethod = (input?: ConnectInput) => Promise<ConnectOutput>;
/** Input for connecting. */
/**
* Input for the {@link ConnectMethod}.
*
* @group Connect
*/
export interface ConnectInput {
/**
* Set to true to request the authorized accounts without prompting the user.
* The wallet should return only the accounts that the app is already authorized to connect to.
* By default, using the {@link ConnectFeature} should prompt the user to request authorization to accounts.
* Set the `silent` flag to `true` to request accounts that have already been authorized without prompting.
*
* This flag may or may not be used by the Wallet and the app should not depend on it being used.
* If this flag is used by the Wallet, the Wallet should not prompt the user, and should return only the accounts
* that the app is authorized to use.
*/
silent?: boolean;
readonly silent?: boolean;
}
/** Output of connecting. */
/**
* Output of the {@link ConnectMethod}.
*
* @group Connect
*/
export interface ConnectOutput {
/** List of accounts in the wallet that the app has been authorized to use. */
accounts: ReadonlyArray<WalletAccount>;
/** List of accounts in the {@link "@wallet-standard/base".Wallet} that the app has been authorized to use. */
readonly accounts: readonly WalletAccount[];
}
/**
* The disconnect feature is an optional feature that may be implemented by
* wallets to perform any cleanup-related work.
* This feature may not be invoked by dapps and should not be depended on.
* This feature should not remove any permissions previously granted through ConnectFeature.
* `standard:disconnect` is a {@link "@wallet-standard/base".Wallet.features | feature} that may be implemented by a
* {@link "@wallet-standard/base".Wallet} to allow the app to perform any cleanup work.
*
* This feature may or may not be used by the app and the Wallet should not depend on it being used.
* If this feature is used by the app, the Wallet should perform any cleanup work, but should not revoke authorization
* to use accounts previously granted through the {@link ConnectFeature}.
*
* @group Disconnect
*/
export type DisconnectFeature = {
/** Namespace for the feature. */
'standard:disconnect': {
/** Version of the feature API. */
version: DisconnectVersion;
/**
* Disconnect from the wallet.
*/
disconnect: DisconnectMethod;
/** Name of the feature. */
readonly 'standard:disconnect': {
/** Version of the feature implemented by the Wallet. */
readonly version: DisconnectVersion;
/** Method to call to use the feature. */
readonly disconnect: DisconnectMethod;
};
};
/** TODO: docs */
/**
* Version of the {@link DisconnectFeature} implemented by a Wallet.
*
* @group Disconnect
*/
export type DisconnectVersion = '1.0.0';
/** TODO: docs */
/**
* Method to call to use the {@link DisconnectFeature}.
*
* @group Disconnect
*/
export type DisconnectMethod = () => Promise<void>;
import type { Wallet } from '@wallet-standard/base';
/** TODO: docs */
/**
* `standard:events` is a {@link "@wallet-standard/base".Wallet.features | feature} that may be implemented by a
* {@link "@wallet-standard/base".Wallet} to allow the app to add an event listener and subscribe to events emitted by
* the Wallet when properties of the Wallet {@link EventsListeners.change}.
*
* @group Events
*/
export type EventsFeature = {
/** Namespace for the feature. */
'standard:events': {
/** Version of the feature API. */
version: EventsVersion;
/** TODO: docs */
on: EventsOnMethod;
/** Name of the feature. */
readonly 'standard:events': {
/** Version of the feature implemented by the {@link "@wallet-standard/base".Wallet}. */
readonly version: EventsVersion;
/** Method to call to use the feature. */
readonly on: EventsOnMethod;
};
};
/** TODO: docs */
/**
* Version of the {@link EventsFeature} implemented by a {@link "@wallet-standard/base".Wallet}.
*
* @group Events
*/
export type EventsVersion = '1.0.0';
/**
* Add an event listener to subscribe to events.
* Method to call to use the {@link EventsFeature}.
*
* @param event Event name to listen for.
* @param listener Function that will be called when the event is emitted.
* @param event Event type to listen for. {@link EventsListeners.change | `change`} is the only event type.
* @param listener Function that will be called when an event of the type is emitted.
*
* @return Function to remove the event listener and unsubscribe.
* @return
* `off` function which may be called to remove the event listener and unsubscribe from events.
*
* As with all event listeners, be careful to avoid memory leaks.
*
* @group Events
*/
export type EventsOnMethod = <E extends EventsNames>(event: E, listener: EventsListeners[E]) => () => void;
/** Events emitted by wallets. */
/**
* Types of event listeners of the {@link EventsFeature}.
*
* @group Events
*/
export interface EventsListeners {
/**
* Emitted when properties of the wallet have changed.
* Listener that will be called when {@link EventsChangeProperties | properties} of the
* {@link "@wallet-standard/base".Wallet} have changed.
*
* @param properties Properties that changed with their new values.
* @param properties Properties that changed with their **new** values.
*/

@@ -38,10 +57,40 @@ change(properties: EventsChangeProperties): void;

/** TODO: docs */
/**
* Names of {@link EventsListeners} that can be listened for.
*
* @group Events
*/
export type EventsNames = keyof EventsListeners;
/** TODO: docs */
/**
* Properties of a {@link "@wallet-standard/base".Wallet} that {@link EventsListeners.change | changed} with their
* **new** values.
*
* @group Events
*/
export interface EventsChangeProperties {
chains?: Wallet['chains'];
features?: Wallet['features'];
accounts?: Wallet['accounts'];
/**
* {@link "@wallet-standard/base".Wallet.chains | Chains} supported by the Wallet.
*
* The Wallet should only define this field if the value of the property has changed.
*
* The value must be the **new** value of the property.
*/
readonly chains?: Wallet['chains'];
/**
* {@link "@wallet-standard/base".Wallet.features | Features} supported by the Wallet.
*
* The Wallet should only define this field if the value of the property has changed.
*
* The value must be the **new** value of the property.
*/
readonly features?: Wallet['features'];
/**
* {@link "@wallet-standard/base".Wallet.accounts | Accounts} that the app is authorized to use.
*
* The Wallet should only define this field if the value of the property has changed.
*
* The value must be the **new** value of the property.
*/
readonly accounts?: Wallet['accounts'];
}

@@ -6,6 +6,15 @@ import type { WalletWithFeatures } from '@wallet-standard/base';

/** TODO: docs */
/**
* Type alias for some or all {@link "@wallet-standard/base".Wallet.features} implemented within the reserved `standard`
* namespace.
*
* @group Features
*/
export type StandardFeatures = ConnectFeature | DisconnectFeature | EventsFeature;
/** TODO: docs */
/**
* Type alias for a {@link "@wallet-standard/base".Wallet} that implements some or all {@link StandardFeatures}.
*
* @group Features
*/
export type WalletWithStandardFeatures = WalletWithFeatures<StandardFeatures>;

@@ -12,0 +21,0 @@

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

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