blockchain-core frontend bundle¶
Source | AsyncComponent |
---|
The blockchain-core frontend bundle
is similar to the blockchain-core runtime and its build to handle several UI steps including blockchain-core instance without account interactions, blockchain-core instance including account id for profile interactions and blockchain-core instance to interact with business centers. It exposes the following Runtime parameters and several functions to create, handle and overwrite them:
- CoreRuntime:
CoreInstance
- ProfileRuntime:
ProfileInstance
- BCRuntime:
BCInstance
Installation¶
npm i @evan.network/ui-angular-libs
Usage¶
- tsconfig.json
{
"compilerOptions": {
"declaration": true,
"module": "es2015",
"target": "es5",
"baseUrl": "./src",
"stripInternal": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"moduleResolution": "node",
"outDir": "../build",
"rootDir": "./src",
"lib": [
"es2015",
"dom"
],
"skipLibCheck": true,
"types": [],
"paths": {
"bcc": [
"../node_modules/@evan.network/api-blockchain-core/bundlesbcc"
]
}
},
"angularCompilerOptions": {
"annotateForClosureCompiler": true,
"strictMetadataEmit": true,
"skipTemplateCodegen": true,
"flatModuleOutFile": "dashboard.js",
"flatModuleId": "dashboard"
},
"files": [
"./index.ts"
]
}
- module.ts
import * as bcc from 'bcc';
Interface: SolcInterface¶
Used to describe smart contract resolve for bundles, …
Parameters¶
getContracts
-any
: Returns compiled contracts object.
Example¶
solc.getContracts();
// {
// "AbstractDescribed": {
// "interface": "[...]"
// },
// "AbstractENS": {
// "interface": "[...]"
// },
// ...
// }
Interface: CoreBundle¶
Core bundle specification (the full result of the blockchain-core frontend bundle
file).
Parameters¶
createCore
-Function
;createAndSetCore
-Function
;ContractLoader
-ContractLoader
;CryptoProvider
-CryptoProvider
;Description
-Description
;DfsInterface
-DfsInterface
;EventHub
-EventHub
;Executor
-Executor
;Ipfs
-Ipfs
;NameResolver
-NameResolver
;Unencrypted
-Unencrypted
;CoreRuntime
-CoreInstance
;isAccountOnboarded
-Function
;IpfsRemoteConstructor
-IpfsRemoteConstructor
: require(‘ipfs-api’);keystore
-KeyStore
: require(‘eth-lightwallet/lib/keystore’);Mnemonic
-Mnemonic
: require(‘bitcore-mnemonic’);KeyProviderInterface
-KeyProviderInterface
;KeyProvider
-KeyProvider
;
Interface: CoreBundleOptions¶
Used to create a new CoreInstance.
Parameters¶
web3
-Web3
: web3 instance;solc
-SolcInterface
: solc to get contracts;config
-config
: blockchain-core configuration;executor
-Executor
(optional): blockchain-core executor instance;contractLoader
-ContractLoader
(optional): blockchain-core contract loader instance;description
-Description
(optional): blockchain-core description instance;dfs
-DfsInterface
(optional): blockchain-core dfs interface instance;dfsRemoteNode
-IpfsRemoteConstructor
(optional): require(‘ipfs-api’)nameResolver
-NameResolver
(optional): blockchain-core name resolver instance;ipfsCache
-IpfsCache
(optional): ipfs cache specification;
Interface: CoreInstance¶
Initialized core bundle for blockchain interaction without account specification.
Parameters¶
web3
-Web3
: web3 instance;description
-Description
(optional): blockchain-core description instance;nameResolver
-NameResolver
(optional): blockchain-core name resolver instance;dfs
-DfsInterface
(optional): blockchain-core dfs interface instance;contractLoader
-ContractLoader
(optional): blockchain-core contract loader instance;executor
-Executor
(optional): blockchain-core executor instance;solc
-SolcInterface
: solc to get contracts;contracts
-SmartContracts
: precompiled smart-contracts specification;config
-config
: blockchain-core configuration;
Interface: ProfileBundle¶
Options to initialize a new ProfileInstance
.
Parameters¶
create
-source Function
;createAndSet
-Function
;ProfileRuntime
-ProfileInstance
;Aes
-Aes
;Verifications
-Verifications
;Ipld
-Ipld
;KeyExchange
-KeyExchange
;Logger
-Logger
;Mailbox
-Mailbox
;Onboarding
-Onboarding
;Profile
-Profile
;RightsAndRoles
-RightsAndRoles
;Sharing
-Sharing
;SignerExternal
-SignerExternal
;SignerInternal
-SignerInternal
;
Interface: ProfileBundleOptions¶
Options to initialize a new ProfileInstance
.
Parameters¶
CoreBundle
-CoreBundle
;coreOptions
-CoreBundleOptions
;accountId
-string
: account id to initialize the profile instance for;signer
-SignerInternal
orSignerExternal
;keyProvider
-KeyProvider
;
Interface: ProfileInstance¶
Bundled runtime for blockchain-core interaction for a specific account.
Parameters¶
ipldInstance
-Ipld
;keyExchange
-KeyExchange
;mailbox
-Mailbox
;claims
-Verifications
;profile
-Profile
;sharing
-Sharing
;dataContract
-DataContract
;keyProvider
-KeyProvider
;coreInstance
-CoreInstance
;
Interface: BCBundleOptions¶
Bundle Options for the BCInstance.
Parameters¶
ensDomain
-string
: ens domain for the business center that should be initialized;ProfileBundle
-ProfileBundle
;
Interface: BCInstance¶
Bundled runtime for blockchain-core interaction for a specific account and business center.
Parameters¶
ensDomain
-string
: ens domain for the business center that should be initialized;bcAddress
-string
: contract addess of the business center;businessCenter
-source any
: business center contract instance (CoreRuntime.contractLoader.loadContract(‘BusinessCenter’, bcAddress));bcRoles
-RightsAndRoles
;ipld
-Ipld
;bcProfiles
-BusinessCenterProfile
;description
-any
: loaded description from the ens address of the bc;dataContract
-DataContract
;
createCore¶
bcc.createCore(options);
Creates a new CoreInstance
Parameters¶
options
-CoreBundleOptions
: The core options
Returns¶
CoreInstance
: new CoreInstance instance
createAndSetCore¶
bcc.createAndSetCore(options);
Creates a new CoreInstance and update the CoreInstance export.
Parameters¶
options
-CoreBundleOptions
: The core options
Returns¶
CoreInstance
: new CoreInstance instance
Example¶
bcc.createCore(options);
Usage Example: https://github.com/evannetwork/ui-dapp-browser/blob/develop/src/appbcc.ts
setCore¶
bcc.setCore(coreInstance);
Overwrite the current CoreInstance
Parameters¶
coreInstance
-CoreInstance
: core instance to overwrite
Example¶
bcc.setCore(CoreInstance)
Usage Example: https://github.com/evannetwork/ui-dapp-browser/blob/develop/src/appbcc.ts
create¶
bcc.create(options);
Creates a new ProfileInstance
Parameters¶
options
-ProfileBundleOptions
: profile bundle options
Returns¶
ProfileInstance
: the new profile instance
Example¶
bcc.create(options)
Usage Example: https://github.com/evannetwork/ui-angular-core/blob/develop/src/servicesbcc.ts
createAndSet¶
bcc.createAndSet(options);
Create a new ProfileInstance and update the ProfileInstance export.
Parameters¶
options
-ProfileBundleOptions
: profile bundle options
Returns¶
ProfileInstance
: the new profile instance
Example¶
bcc.create(options)
Usage Example: https://github.com/evannetwork/ui-angular-core/blob/develop/src/servicesbcc.ts
createBC¶
bcc.createBC(options);
Create a new BCInstance.
Parameters¶
options
-BCBundleOptions
: options for the business center
Returns¶
BCInstance
: the new bc instance
Example¶
bcc.createBC(options)
Usage Example: https://github.com/evannetwork/ui-angular-core/blob/develop/src/servicesbc.ts
createAndSetBC¶
bcc.createAndSetBC(options);
Creates and set BCInstance.
Parameters¶
options
-BCBundleOptions
: options for the business center
Returns¶
BCInstance
: the new bc instance
Example¶
bcc.createBC(options)
Usage Example: https://github.com/evannetwork/ui-angular-core/blob/develop/src/servicesbc.ts