UserAccountProvider

Interface
UserAccountProviders power Client instances. Multiple UserAccountProviders may be provided, and the Client abstracts over them to provide a common layer of functionality independent of the underlying UserAccountProviders.
export interface UserAccountProvider { 
  readonly currentUserAccount$: Observable<UserAccount | undefined>; 
  readonly userAccounts$: Observable<readonly UserAccount[]>; 
  readonly networks$: Observable<readonly NetworkType[]>; 
  readonly getCurrentUserAccount: () => UserAccount | undefined; 
  readonly getUserAccounts: () => readonly UserAccount[]; 
  readonly getNetworks: () => readonly NetworkType[]; 
  readonly selectUserAccount: (id?: UserAccountID) => Promise<void>; 
  readonly deleteUserAccount?: (id: UserAccountID) => Promise<void>; 
  readonly updateUserAccountName?: (options: UpdateAccountNameOptions) => Promise<void>; 
  readonly getBlockCount: (network: NetworkType) => Promise<number>; 
  readonly getAccount: (network: NetworkType, address: AddressString) => Promise<Account>; 
  readonly iterBlocks: (network: NetworkType, options?: IterOptions) => AsyncIterable<Block>; 
  readonly iterActionsRaw?: (network: NetworkType, options?: IterOptions) => AsyncIterable<RawAction>; 
  readonly transfer: (transfers: readonly Transfer[], options?: TransactionOptions) => Promise<TransactionResult>; 
  readonly claim: (options?: TransactionOptions) => Promise<TransactionResult>; 
  readonly vote: (publicKey: PublicKeyString, options?: TransactionOptions) => Promise<TransactionResult>; 
  readonly invoke: ( 
    contract: AddressString, 
    method: string, 
    params: ReadonlyArray<ScriptBuilderParam | undefined>, 
    paramsZipped: ReadonlyArray<readonly [string, Param | undefined]>, 
    verify: boolean, 
    options?: TransactionOptions, 
    sourceMaps?: SourceMaps, 
  ) => Promise<TransactionResult<RawInvokeReceipt>>; 
  readonly call: ( 
    network: NetworkType, 
    contract: AddressString, 
    method: string, 
    params: ReadonlyArray<ScriptBuilderParam | undefined>, 
  ) => Promise<RawCallReceipt>; 
} 

Properties

currentUserAccount$
Observable<UserAccount | undefined>
An Observable that emits the currently selected UserAccount
userAccounts$
Observable<readonly UserAccount[]>
An Observable that emits the available UserAccounts
networks$
Observable<readonly NetworkType[]>
An Observable that emits the available networks this UserAccountProvider knows how to function with.

Methods

getCurrentUserAccount

() => UserAccount | undefined 

getUserAccounts

() => readonly UserAccount[] 

getNetworks

() => readonly NetworkType[] 

selectUserAccount

Set the given UserAccountID as the selected UserAccount. If the UserAccountProvider does not support programatically selecting a UserAccountID, it should only ever expose one available UserAccount and manage selecting other UserAccounts outside of the application.
(id?: UserAccountID) => Promise<void> 

deleteUserAccount

Optional support for deleting a UserAccount
(id: UserAccountID) => Promise<void> 

updateUserAccountName

Optional support for updating the name of a UserAccount
(options: UpdateAccountNameOptions) => Promise<void> 

getBlockCount

(network: NetworkType) => Promise<number> 

getAccount

(network: NetworkType, address: AddressString) => Promise<Account> 

iterBlocks

(network: NetworkType, options?: IterOptions) => AsyncIterable<Block> 

iterActionsRaw

While this method could be implemented simply as a function of iterBlocks, iterActionsRaw is provided in case the UserAccountProvider has a more efficient way of iterating over actions.
(network: NetworkType, options?: IterOptions) => AsyncIterable<RawAction> 

transfer

Transfers native assets.
(transfers: readonly Transfer[], options?: TransactionOptions) => Promise<TransactionResult> 

claim

Claim all claimable GAS.
(options?: TransactionOptions) => Promise<TransactionResult> 

vote

Vote for a specified public key for governance.
(publicKey: PublicKeyString, options?: TransactionOptions) => Promise<TransactionResult> 

invoke

Invoke the specified method with the given params on contract. `paramsZipped` contains the original parameters before processing with the ABI and are typically suitable for displaying to a user. `verify` will be true if the transaction should trigger verification for the contract `options` may specify additional native asset transfers to include with the transaction (either to or from the contract address).
(contract: AddressString, method: string, params: ReadonlyArray<ScriptBuilderParam | undefined>, paramsZipped: ReadonlyArray<readonly [string, Param | undefined]>, verify: boolean, options?: TransactionOptions, sourceMaps?: SourceMaps) => Promise<TransactionResult<RawInvokeReceipt>> 

call

Invokes the constant method on contract with params on network.
(network: NetworkType, contract: AddressString, method: string, params: ReadonlyArray<ScriptBuilderParam | undefined>) => Promise<RawCallReceipt> 
  • @neo-one/client
  • @neo-one/smart-contract
DOCS
InstallationMain ConceptsAdvanced GuidesAPI ReferenceContributing
CHANNELS
GitHubStack OverflowDiscord ChatTwitterYouTube
COPYRIGHT © 2021 NEO•ONE