EvanBCCService¶
| Source | bcc |
|---|
Core blockchain-core angular-core wrapper. Initializes and extends new runtimes from dapp-browser, when user unlocked successfully its account, to handle correct user encryption keys and object instances
passwordModalPromise-any: wait for password dialog to be resolved;updateBCCPromise-any: wait for bcc is updated to be resolved;
BCCCore or BCCProfile exported runtime values. Mapped from e.g BCC.coreInstance.executor => this.executor
config-config;rightsAndRoles-RightsAndRoles;web3-Web3;contractLoader-ContractLoader;executor-Executor;keyProvider-KeyProvider;description-Description;nameResolver-NameResolver;ipldInstance-Ipld;dfs-DfsInterface;mailbox-Mailbox;keyExchange-KeyExchange;profile-Profile;sharing-Sharing;cryptoProvider-CryptoProvider;CoreBundle-CoreBundle;ProfileBundle-ProfileBundle;dataContract-DataContract;
initialize¶
bccService.initialize(passwordFunction);
Initialize the bcc service using a password unlocking function.
Parameters¶
passwordFunction-Function: function that is used to unlock current lightwallet vault
Returns¶
Promise returns void: resolved when bcc was updated for the current profile
Example¶
await this.bcc.initialize((accountId) => this.bcc.globalPasswordDialog(accountId));
copyCoreToInstance¶
bccService.copyCoreToInstance();
Copy BCC core object instances into the service this scope.
copyCoreToInstance¶
bccService.copyProfileToInstance();
Copy BCC profile object instances into the service this scope.
getSigner¶
bccService.getSigner(provider);
Returns the existing executor or creates a new one, for the active current provider.
Parameters¶
provider-string(default =this.core.getCurrentProvider()): The provider
Returns¶
Promise returns SignerInternal: The signer.
getRightsAndRolesObj¶
bccService.getRightsAndRolesObj();
Returns a new rights and roles object instance.
Parameters¶
options-object: The options used for callingfrom-string(optional): The address the call “transaction” should be made from
callback-Function(optional): This callback will be fired..somethingElse-string(optional): this can be set if required, defaults to"latest"
Returns¶
RightsAndRoles: The rights and roles object
updateBCC¶
bccService.updateBCC(activeAccount, provider, disableKeys);
Setup / update initial blockchain-core structure for current account id and signer.
Parameters¶
activeAccount-string: current active accountprovider-string: internal / externaldisableKeys-boolean(optional): disable keyProvider.setKeys / this.setExchangeKeys, used for disabling key setting, only early ui states
Returns¶
Promise returns void: solved when bcc is updated
updateTermsOfUse¶
bccService.updateTermsOfUse(activeAccount);
Check the terms of use has changed and if the current user accepted it.
Parameters¶
activeAccount-string: current active account
Returns¶
Promise returns void: resolved when done
getProfileForAccount¶
bccService.getProfileForAccount(accountId);
Returns an new blockchain-core profile instance. !Attention : It’s only builded for load values to check for public and private keys (e.g. used by onboarding or global-password) Executor is the normal one from the global core!!!
Parameters¶
accountId-string: account id to create a new profile instance for
setExchangeKeys¶
bccService.setExchangeKeys(accountId);
run keyExchange.setPublicKey
Parameters¶
accountId-string: Account id to set the exchange keys for
Returns¶
Promise returns void: resolved when done
getMetamaskWeb3¶
bccService.getMetamaskWeb3();
Returns a new web3 instances. If a web3 currentProvider is provided, it will be used.
Example¶
getWeb3(provider = this.core.getCurrentProvider()) {
if (provider === 'metamask') {
return this.getMetamaskWeb3();
} else {
return this.web3;
}
}
getWeb3¶
bccService.getWeb3(provider);
Get the existing web3 or metamask web3.
Parameters¶
provider-string(default =this.core.getCurrentProvider()): The provider
Returns¶
Promise returns void: resolved when done
Example¶
this.getWeb3();
getDomainName¶
dapp.getDomainName(...subLabels);
builds a full domain name for the current bcc config
Parameters¶
Array<string>-subLabels: used to enhance nameResolver config
Returns¶
The domain name : The domain name.
globalPasswordDialog¶
initializedModule.globalPasswordDialog(accountId);
angular-core default password dialog function that is used for lightwallet unlocking.
Parameters¶
accountId-string: account id to load password for
Returns¶
Promise returns string: the password
Example¶
await this.bccService.initialize((accountId) => this.bccService.globalPasswordDialog(accountId));