@near-wallet-selector/core
Advanced tools
Comparing version 4.1.1 to 5.0.0
@@ -7,4 +7,4 @@ export type { WalletSelector, WalletSelectorParams, WalletSelectorEvents, WalletSelectorStore, } from "./lib/wallet-selector.types"; | ||
export type { WalletSelectorState, ContractState, ModuleState, AccountState, } from "./lib/store.types"; | ||
export type { WalletModuleFactory, WalletModule, WalletBehaviourFactory, WalletBehaviourOptions, Wallet, WalletType, WalletMetadata, WalletEvents, SignInParams, BrowserWalletMetadata, BrowserWalletBehaviour, BrowserWallet, InjectedWalletMetadata, InjectedWalletBehaviour, InjectedWallet, HardwareWalletMetadata, HardwareWalletSignInParams, HardwareWalletBehaviour, HardwareWallet, BridgeWalletMetadata, BridgeWalletBehaviour, BridgeWallet, Account, Transaction, Action, ActionType, CreateAccountAction, DeployContractAction, FunctionCallAction, TransferAction, StakeAction, AddKeyAction, DeleteKeyAction, DeleteAccountAction, AddKeyPermission, } from "./lib/wallet"; | ||
export type { WalletModuleFactory, WalletModule, WalletBehaviourFactory, WalletBehaviourOptions, Wallet, WalletType, WalletMetadata, WalletEvents, SignInParams, BrowserWalletMetadata, BrowserWalletBehaviour, BrowserWallet, InjectedWalletMetadata, InjectedWalletBehaviour, InjectedWallet, HardwareWalletMetadata, HardwareWalletSignInParams, HardwareWalletBehaviour, HardwareWallet, HardwareWalletAccount, BridgeWalletMetadata, BridgeWalletBehaviour, BridgeWallet, Account, Transaction, Action, ActionType, CreateAccountAction, DeployContractAction, FunctionCallAction, TransferAction, StakeAction, AddKeyAction, DeleteKeyAction, DeleteAccountAction, AddKeyPermission, } from "./lib/wallet"; | ||
export type { FinalExecutionOutcome } from "near-api-js/lib/providers"; | ||
export { waitFor } from "./lib/helpers"; | ||
export { waitFor, getActiveAccount } from "./lib/helpers"; |
export * from "./waitFor"; | ||
export * from "./getActiveAccount"; |
@@ -1,2 +0,2 @@ | ||
export declare type NetworkId = "mainnet" | "testnet" | "betanet"; | ||
export declare type NetworkId = "mainnet" | "testnet"; | ||
export interface Network { | ||
@@ -3,0 +3,0 @@ networkId: string; |
@@ -9,5 +9,6 @@ import type { WalletModulesParams } from "./wallet-modules.service.types"; | ||
private emitter; | ||
private provider; | ||
private modules; | ||
private instances; | ||
constructor({ factories, storage, options, store, emitter, }: WalletModulesParams); | ||
constructor({ factories, storage, options, store, emitter, provider, }: WalletModulesParams); | ||
private validateWallet; | ||
@@ -14,0 +15,0 @@ private resolveStorageState; |
@@ -7,2 +7,3 @@ import type { WalletModuleFactory } from "../../wallet"; | ||
import type { WalletSelectorEvents } from "../../wallet-selector.types"; | ||
import type { ProviderService } from "../provider/provider.service.types"; | ||
export interface WalletModulesParams { | ||
@@ -14,2 +15,3 @@ factories: Array<WalletModuleFactory>; | ||
emitter: EventEmitter<WalletSelectorEvents>; | ||
provider: ProviderService; | ||
} |
@@ -13,3 +13,5 @@ import { BehaviorSubject, Observable } from "rxjs"; | ||
}; | ||
export declare type AccountState = Account; | ||
export declare type AccountState = Account & { | ||
active: boolean; | ||
}; | ||
export interface WalletSelectorState { | ||
@@ -25,3 +27,3 @@ contract: ContractState | null; | ||
modules: Array<ModuleState>; | ||
accounts: Array<AccountState>; | ||
accounts: Array<Account>; | ||
contract: ContractState | null; | ||
@@ -35,3 +37,3 @@ selectedWalletId: string | null; | ||
contract: ContractState; | ||
accounts: Array<AccountState>; | ||
accounts: Array<Account>; | ||
}; | ||
@@ -47,4 +49,9 @@ } | { | ||
walletId: string; | ||
accounts: Array<AccountState>; | ||
accounts: Array<Account>; | ||
}; | ||
} | { | ||
type: "SET_ACTIVE_ACCOUNT"; | ||
payload: { | ||
accountId: string; | ||
}; | ||
}; | ||
@@ -51,0 +58,0 @@ export interface ReadOnlyStore { |
@@ -1,13 +0,11 @@ | ||
import type { WalletModuleFactory, Wallet, WalletEvents } from "./wallet"; | ||
import type { WalletModuleFactory, Wallet } from "./wallet"; | ||
import type { ProviderService, StorageService } from "./services"; | ||
import type { Options } from "./options.types"; | ||
import type { ProviderService, EventEmitterService, LoggerService, JsonStorageService } from "./services"; | ||
import type { Store } from "./store.types"; | ||
export interface MockWalletDependencies { | ||
options?: Options; | ||
store?: Store; | ||
provider?: ProviderService; | ||
emitter?: EventEmitterService<WalletEvents>; | ||
logger?: LoggerService; | ||
storage?: JsonStorageService; | ||
} | ||
export declare const mockWallet: <Variation extends Wallet>(factory: WalletModuleFactory, deps?: MockWalletDependencies) => Promise<Variation | null>; | ||
export declare const mockWallet: <Variation extends Wallet>(factory: WalletModuleFactory, deps?: MockWalletDependencies | undefined) => Promise<{ | ||
wallet: NonNullable<Variation>; | ||
storage: StorageService; | ||
}>; |
@@ -23,4 +23,5 @@ import type { Wallet, WalletModuleFactory } from "./wallet/wallet.types"; | ||
isSignedIn(): boolean; | ||
setActiveAccount(accountId: string): void; | ||
on<EventName extends keyof WalletSelectorEvents>(eventName: EventName, callback: (event: WalletSelectorEvents[EventName]) => void): Subscription; | ||
off<EventName extends keyof WalletSelectorEvents>(eventName: EventName, callback: (event: WalletSelectorEvents[EventName]) => void): void; | ||
} |
import { providers } from "near-api-js"; | ||
import { EventEmitterService, LoggerService, ProviderService, JsonStorageService } from "../services"; | ||
import { Options } from "../options.types"; | ||
import { ReadOnlyStore } from "../store.types"; | ||
import { Transaction, Action } from "./transactions.types"; | ||
import { Modify, Optional } from "../utils.types"; | ||
import type { Options } from "../options.types"; | ||
import type { ReadOnlyStore } from "../store.types"; | ||
import type { Transaction, Action } from "./transactions.types"; | ||
import type { Modify, Optional } from "../utils.types"; | ||
interface BaseWalletMetadata { | ||
@@ -12,2 +12,3 @@ name: string; | ||
deprecated: boolean; | ||
available: boolean; | ||
} | ||
@@ -73,8 +74,15 @@ export interface Account { | ||
export declare type HardwareWalletMetadata = BaseWalletMetadata; | ||
export interface HardwareWalletAccount { | ||
derivationPath: string; | ||
publicKey: string; | ||
accountId: string; | ||
} | ||
export interface HardwareWalletSignInParams extends SignInParams { | ||
derivationPaths: Array<string>; | ||
accounts: Array<HardwareWalletAccount>; | ||
} | ||
export declare type HardwareWalletBehaviour = Modify<BaseWalletBehaviour, { | ||
signIn(params: HardwareWalletSignInParams): Promise<Array<Account>>; | ||
}>; | ||
}> & { | ||
getPublicKey(derivationPath: string): Promise<string>; | ||
}; | ||
export declare type HardwareWallet = BaseWallet<"hardware", HardwareWalletMetadata, HardwareWalletBehaviour>; | ||
@@ -81,0 +89,0 @@ export declare type BridgeWalletMetadata = BaseWalletMetadata; |
{ | ||
"name": "@near-wallet-selector/core", | ||
"version": "4.1.1", | ||
"version": "5.0.0", | ||
"main": "./index.umd.js", | ||
@@ -5,0 +5,0 @@ "module": "./index.esm.js", |
@@ -32,3 +32,3 @@ # @near-wallet-selector/core | ||
- `network` (`NetworkId | Network`): Network ID or object matching that of your dApp configuration . Network ID can be either `mainnet`, `testnet` or `betanet`. | ||
- `network` (`NetworkId | Network`): Network ID or object matching that of your dApp configuration . Network ID can be either `mainnet` or `testnet`. | ||
- `networkId` (`string`): Custom network ID (e.g. `localnet`). | ||
@@ -35,0 +35,0 @@ - `nodeUrl` (`string`): Custom URL for RPC requests. |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
394597
35
10395