Class: Vortex
Type parameters
T : State
Hierarchy
Vortex
Index
Constructors
Accessors
Methods
- addContract
- addNetwork
- addReducer
- fetchIPFSHash
- loadContract
- loadWeb3
- networksOf
- run
- setCustomState
- subscribeAccount
- subscribeEvent
- factory
- get
Constructors
constructor
⊕ new Vortex(contracts: ContractConfig, loader: Promise
<any
>, config?: GeneratorConfig<T
>): Vortex
Defined in vortex.ts:38
Instantiate a new Vorte instance. Accessing VortexInstance will give access to the last instanciated Vortex.
Parameters:
Param | Type | Default value | Description |
---|---|---|---|
contracts | ContractConfig | - | Truffle or Embark Contracts configuration. |
loader | Promise <any > |
- | Promise that returns a web3 instance ready to be used. |
Default value config |
GeneratorConfig<T > |
undefined | Configuration arguments for the store generator. |
Returns: Vortex
Accessors
Contracts
getContracts(): ContractConfig
Defined in vortex.ts:210
Contracts getter
Returns: ContractConfig Array of loaded artifacts.
Networks
getNetworks(): number
[]
Defined in vortex.ts:230
Network Id Whitelist getter.
Returns: number
[]
List of whitelisted network ids.
Store
getStore(): Store
<T
>
Defined in vortex.ts:219
Store getter
Returns: Store
<T
>
Instance of Store
Methods
addContract
▸ addContract(contract: any
): void
Defined in vortex.ts:87
Add a new contract in contract list.
Parameters:
Param | Type | Description |
---|---|---|
contract | any |
Contract to add. |
Returns: void
addNetwork
▸ addNetwork(network_id: number
): void
Defined in vortex.ts:128
Adds a network id to whitelist.
Parameters:
Param | Type | Description |
---|---|---|
network_id | number |
Network Id to add. |
Returns: void
addReducer
▸ addReducer(field: string
, reducer: Reducer
<any
, any
>): void
Defined in vortex.ts:148
Add a new reducer in the Reducer Map.
Parameters:
Param | Type | Description |
---|---|---|
field | string |
Field Name associated with reducer. |
reducer | Reducer <any , any > |
Reducer |
Returns: void
fetchIPFSHash
▸ fetchIPFSHash(hash: string
): void
Defined in vortex.ts:184
Load the given IPFS hash into the store.
Parameters:
Param | Type | Description |
---|---|---|
hash | string |
The IPFS Hash you want to load |
Returns: void
loadContract
▸ loadContract(contractName: string
, contractAddress: string
): void
Defined in vortex.ts:171
Load a new instance of a Smart Contract. Expect a new Feed element and the contracts section to get updated.
Parameters:
Param | Type | Description |
---|---|---|
contractName | string |
- |
contractAddress | string |
Returns: void
loadWeb3
▸ loadWeb3(): void
Defined in vortex.ts:74
Load Web3 instance from given source.
Returns: void
networksOf
▸ networksOf(contract: ContractArtifact
): void
Defined in vortex.ts:138
Takes a Truffle Contract Artifact and extracts all network ids where Contract has instances, adds them to whitelist If you are using Embark, Network checks will be done depending on your chains.json.
Parameters:
Param | Type | Description |
---|---|---|
contract | ContractArtifact |
A Truffle Contract Artifact |
Returns: void
run
▸ run(): void
Defined in vortex.ts:57
Run the Vortex Redux Store.
Returns: void
setCustomState
▸ setCustomState(customState: DeepPartial
<T
>): void
Defined in vortex.ts:160
Custom Initial State, useful when adding custom properties.
Parameters:
Param | Type | Description |
---|---|---|
customState | DeepPartial <T > |
Returns: void
subscribeAccount
▸ subscribeAccount(address: string
): void
Defined in vortex.ts:197
Add a new contract to fetch pool.
Parameters:
Param | Type | Description |
---|---|---|
address | string |
Address to fetch |
Returns: void
subscribeEvent
▸ subscribeEvent(event_name: string
, contract_name: string
, contract_address: string
, ...args: string
[]): void
Defined in vortex.ts:115
Adds a new Event to subscription pool.
Parameters:
Param | Type | Description |
---|---|---|
event_name | string |
Name of the event you want to subscribe to. |
contract_name | string |
Name of the contract where the event is triggered. |
contract_address | string |
Address of contract instance. |
Rest args |
string [] |
Additional arguments for Events |
Returns: void
<Static>
factory
▸ factoryU(contracts: ContractConfig, loader: Promise
<any
>, config?: GeneratorConfig<U
>): Vortex<U
>
Defined in vortex.ts:32
Type parameters:
U : State
Parameters:
Param | Type | Default value |
---|---|---|
contracts | ContractConfig | - |
loader | Promise <any > |
- |
Default value config |
GeneratorConfig<U > |
undefined |
Returns: Vortex<U
>
<Static>
get
▸ getU(): Vortex<U
>
Defined in vortex.ts:36
Type parameters:
U : State
Returns: Vortex<U
>