RpcClient
Api Code Documentation / Exports / service/RpcClient / RpcClient
service/RpcClient.RpcClient
Table of contents
Constructors
Properties
Methods
- convertToReadableItems
- encryptItem
- generateRequest
- getOrDecryptItemData
- handleError
- invoke
- invokePublish
- retrieveItems
Constructors
constructor
• new RpcClient(settings
)
Parameters
Name | Type |
---|---|
settings | ConnectionSettings |
Defined in
Properties
instance
• Private
instance: AxiosInstance
Defined in
timeStamp
• Private
timeStamp: any
Defined in
tracer
• Private
tracer: any
Defined in
Methods
convertToReadableItems
▸ Private
convertToReadableItems(items
): Promise
<Type
<StreamItem
>[]>
Parameters
Name | Type |
---|---|
items | StreamItem [] |
Returns
Promise
<Type
<StreamItem
>[]>
Defined in
encryptItem
▸ Private
encryptItem(item
): EncryptedItemToPublish
Parameters
Name | Type |
---|---|
item | ItemToPublish |
Returns
Defined in
generateRequest
▸ Private
generateRequest(stream
, keys
, streamitem
, address?
, offchain?
): any
Parameters
Name | Type |
---|---|
stream | String |
keys | String | String [] |
streamitem | ItemToPublish |
address? | String |
offchain? | Boolean |
Returns
any
Defined in
getOrDecryptItemData
▸ Private
getOrDecryptItemData(item
): Type
<StreamItem
>
Parameters
Name | Type |
---|---|
item | StreamItem |
Returns
Defined in
handleError
▸ Private
handleError(error
, method
, params
): undefined
| default
Parameters
Name | Type |
---|---|
error | any |
method | any |
params | any |
Returns
undefined
| default
Defined in
invoke
▸ invoke(method
, ...params
): any
Used to invoke MultiChain RPC-Commands. For publishing an event to the chain the invokePublish function should be used
Parameters
Name | Type | Description |
---|---|---|
method | string | the RPC-command to be invoked |
...params | any [] | the parameters, depend on the specific method, can be stream name, keys, or others |
Returns
any
return value also depends on the speicific method, can be listitems, permissions, or others
Defined in
invokePublish
▸ invokePublish(stream
, keys
, item
, address?
, offchain?
): any
Used to publish a stream item on the chain
Parameters
Name | Type | Description |
---|---|---|
stream | String | name of the stream where the item should be published |
keys | String | String [] | keys of the stremitem |
item | any | the item itself |
address? | String | the address to publish the event from. is optional and is only used if the env var SIGNING_METHOD is used |
offchain? | Boolean | a boolean indicating whether the item should be saved offchain or not |
Returns
any
Defined in
retrieveItems
▸ retrieveItems(streamName
, start
, count
): Promise
<Item
[]>
Parameters
Name | Type |
---|---|
streamName | string |
start | number |
count | number |
Returns
Promise
<Item
[]>