@Beta public class MultichainService extends Object
Modifier and Type | Method and Description |
---|---|
String |
addMultiSigAddress(int nRequired,
List<String> addresses)
Creates a pay-to-scripthash (P2SH) multiSig address and adds it to the wallet.
|
String |
appendRawTransaction(String txHex,
List<MultichainUTXO> inputs,
Map<String,Integer> outputs,
List<String> data,
String action)
This works like createrawtransaction but adds the given inputs and (regular or metadata) outputs to the raw
transaction specified in tx-hex, rather than creating a new transaction.
|
static MultichainService |
create()
Create a service instance looking for an instance of service type 'multichain'.
|
static MultichainService |
create(MultichainBasicAuthDestination destination)
Create a service instance looking from a MultichainBasicAuthDestination.
|
static MultichainService |
create(MultichainDestination destination)
Create a service instance looking from a MultichainDestination.
|
static MultichainService |
create(String destinationId)
Create a service instance looking from a destinationId .
|
MultichainKeyPair |
createKeyPair()
Generates one public/private key pairs, which are not stored in the wallet or drawn from the node’s key pool,
ready for external key management.
|
List<MultichainKeyPair> |
createKeyPairs(int count)
Generates one or more public/private key pairs, which are not stored in the wallet or drawn from the node’s key
pool, ready for external key management.
|
String |
createRawSendFrom(String fromAddress,
Object assetObject,
List<Map<String,String>> data)
Creates a transaction spending the specified inputs, sending to the given addresses.
|
String |
createRawTransaction(List<MultichainUTXO> inputs,
Map<String,Integer> outputs,
List<String> data,
String action)
Creates a transaction spending the specified inputs, sending to the given addresses.
|
String |
createStream(String streamName,
boolean open)
Creates a new stream on the blockchain called name.
|
String |
createStreamFromAddress(String fromAddress,
String streamName,
boolean open)
This works like create, but with control over the from-address used to create the stream.
|
MultichainTransaction |
decodeRawTransaction(String txHex)
Returns a JSON object describing the serialized transaction in tx-hex.
|
<T> T |
extractMultichainResult(Class<T> contentClass,
org.springframework.http.ResponseEntity<String> response)
Convenience method to extract service responses
|
MultichainAssetTransaction |
getAssetTransaction(String asset,
String txid)
Retrieves a specific transaction txid involving asset, passed as an asset name, ref or issuance txid, to which
the node must be subscribed.
|
MultichainBlock |
getBlock(String heightOrHash)
Returns information about the block with hash (retrievable from getblockhash) or at the given height in the
active chain.
|
MultichainBasicAuthDestination |
getDestination()
The SCP destination information to reach the service instance via basic authentication
|
MultichainInfo |
getInfo()
Retrieves Meta Info from MC Node
|
io.vavr.control.Option<MultichainResult> |
getLatestEntryOnStream(String streamName,
String key)
Get latest entry for key in the stream
|
String |
getNewAddress()
Generates a public/private key pair and adds it to the wallet.
|
MultichainTransaction |
getRawTransaction(String txId)
If verbose is 1, returns a JSON object describing transaction txid.
|
org.springframework.http.client.HttpComponentsClientHttpRequestFactory |
getRequestFactory()
Allows to use a pre-configured HttpClient instance -potentially with authentication, HTTP connection pooling,
etc.
|
MultichainResult |
getStreamItem(String streamName,
String txId,
boolean verbose)
Retrieves a specific item with txid from stream, passed as a stream name, ref or creation txid, to which the node
must be subscribed.
|
String |
grant(Iterable<String> toAddresses,
Collection<MultichainPermission> permissions)
Grants permissions to addresses, a comma-separated list of addresses.
|
String |
grantForAddress(String toAddress,
Collection<MultichainPermission> permissions)
Grants permissions to an address.
|
String |
grantForAddressFrom(String fromAddress,
String toAddress,
Collection<MultichainPermission> permissions)
This works like grantForAddress, but with control over the from-address used to grant the permissions.
|
String |
grantFrom(String fromAddress,
Iterable<String> toAddresses,
Collection<MultichainPermission> permissions)
This works like grant, but with control over the from-address used to grant the permissions.
|
void |
grantWritePermissionsOnStream(String streamName,
Iterable<String> addresses)
Grants global receive and send permission and local write permission on stream
|
void |
importAddress(String address,
String label,
boolean rescan)
Adds the address (or a full public key) to the wallet, without an associated private key.
|
void |
importAddresses(List<String> addresses,
String label,
boolean rescan)
Adds the array of addresses (or of full public keys) to the wallet, without an associated private key.
|
String |
issue(String address,
String assetName,
int qty)
Creates a new asset on the blockchain, sending the initial qty units to address.
|
String |
issue(String address,
String assetName,
int qty,
Map<String,Object> args)
Creates a new asset on the blockchain, sending the initial qty units to address.
|
List<MultichainAddressResult> |
listAddresses(List<String> addresses,
boolean verbose)
Returns information about the passed addresses in the wallet.
|
List<MultichainAddressResult> |
listAllAddresses()
Returns information about all addresses in the wallet.
|
List<MultichainAddressResult> |
listAllAddresses(boolean verbose)
Returns information about all addresses in the wallet.
|
List<MultichainPermissionResult> |
listAllPermissions(Iterable<String> addresses,
boolean verbose)
Returns a list of all permissions which have been explicitly granted to addresses.
|
List<MultichainPermissionResult> |
listAllPermissionsForAddress(String address,
boolean verbose)
Returns a list of all permissions which have been explicitly granted to addresses.
|
List<MultichainResult> |
listAllStreamItems(String streamName)
Lists all items in stream, passed as a stream name, ref or creation txid.
|
List<MultichainResult> |
listAllStreamKeys(String streamName,
boolean verbose,
int count,
int start,
boolean localOrdering)
Provides information about all keys in stream, passed as a stream name, ref or creation txid Hex-data entries are
decoded to ASCII strings.
|
List<MultichainStream> |
listAllStreams()
Returns information about all streams created on the blockchain.
|
List<MultichainAsset> |
listAssets() |
List<MultichainAsset> |
listAssets(Map<String,Object> args)
Pass an asset name, ref or issuance txid in assets to retrieve information about one asset only, an array thereof
for multiple assets, or * for all assets.
|
List<MultichainBlock> |
listBlocks(String blocks,
boolean verbose)
Returns information about the blocks specified, on the active chain only.
|
List<MultichainUTXO> |
listLockUnspent()
Returns a list of locked unspent transaction outputs in the wallet.
|
List<MultichainPermissionResult> |
listPermissions(Collection<MultichainPermission> permissions,
boolean verbose)
Returns a list of all permissions which have been explicitly granted to addresses.
|
List<MultichainPermissionResult> |
listPermissions(Collection<MultichainPermission> permissions,
Iterable<String> addresses,
boolean verbose)
Returns a list of all permissions which have been explicitly granted to addresses.
|
List<MultichainResult> |
listStreamItems(String streamName,
boolean verbose,
int count,
int start,
boolean localOrdering)
Lists items in stream, passed as a stream name, ref or creation txid.
|
List<MultichainResult> |
listStreamKeyItems(String streamName,
String key,
boolean verbose,
int count,
int start,
boolean localOrdering)
This works like listStreamItems, but listing items with the given key only.
|
List<MultichainResult> |
listStreamKeys(String streamName,
List<String> keys,
boolean verbose,
int count,
int start,
boolean localOrdering)
Provides information about keys in stream, passed as a stream name, ref or creation txid Hex-data entries are
decoded to ASCII strings.
|
List<MultichainResult> |
listStreamPublisherItems(String streamName,
String address,
boolean verbose,
int count,
int start,
boolean localOrdering)
This works like liststreamitems, but listing items published by the given address only.
|
List<MultichainPublisher> |
listStreamPublishers(String streamName,
List<String> addresses,
boolean verbose,
int count,
int start,
boolean localOrdering)
Provides information about publishers who have written to stream, passed as a stream name, ref or creation txid
|
List<MultichainStream> |
listStreams(List<String> streams)
Returns information about streams created on the blockchain.
|
List<MultichainUTXO> |
listUnspent(int minconf,
int maxconf,
List<String> addresses)
Returns a list of unspent transaction outputs (UTXO) in the wallet, with between minconf and maxconf
confirmations.
|
void |
lockUnspent(boolean unlock,
List<MultichainUTXO> utxoList)
If unlock is false, locks the specified transaction outputs in the wallet, so they will not be used for automatic
coin selection.
|
String |
publishJson(String streamName,
List<String> keys,
Map<String,Object> value,
String options)
Publishes an item (JSON data structure consisting of Map and Lists objects) in a stream.
|
String |
publishStringAsHex(String streamName,
List<String> keys,
String value,
String options)
Publishes an item (key-value pair) in a stream.
|
String |
publishStringAsHexFrom(String fromAddress,
String streamName,
List<String> keys,
String value,
String options)
This works like publish, but publishes the item from from-address.
|
String |
revoke(Iterable<String> toAddresses,
Collection<MultichainPermission> permissions)
Revokes permissions from addresses, a comma-separated list of addresses.
|
String |
revokeForAddress(String toAddress,
Collection<MultichainPermission> permissions)
Revokes permissions from an address.
|
String |
revokeForAddressFrom(String fromAddress,
String toAddress,
Collection<MultichainPermission> permissions)
This works like revoke, but with control over the from-address used to revoke the permissions.
|
String |
revokeFrom(String fromAddress,
Iterable<String> toAddresses,
Collection<MultichainPermission> permissions)
This works like revoke, but with control over the from-address used to revoke the permissions.
|
void |
revokeWritePermissionsOnStream(String streamName,
Iterable<String> addresses)
Revoke global receive and send permission and local write permission on stream
|
String |
sendAsset(String address,
String asset,
int qty)
Sends qty of asset to address, returning the txid.
|
String |
sendRawTransaction(String signedRawTransaction)
Validates the raw transaction in tx-hex and transmits it to the network, returning the txid.
|
MultichainSignedRawTransaction |
signRawTransaction(String rawTransaction,
List<Object> parentOutputObjects,
Collection<String> privateKeys)
Signs the raw transaction in tx-hex, often provided by a previous call to createrawtransaction or
createrawsendfrom.
|
void |
subscribe(List<String> assetsOrStreamNames,
boolean rescan)
Instructs the node to start tracking one or more asset(s) or stream(s).
|
String |
toString() |
void |
unsubscribe(List<String> assetsOrStreamNames)
Instructs the node to stop tracking one or more asset(s) or stream(s).
|
@Nonnull public static MultichainService create() throws CloudPlatformException
CloudPlatformException
- if no service service is found or the service is insufficiently specified@Nonnull public static MultichainService create(@Nonnull MultichainDestination destination)
destination
- MultichainDestination containing the required endpoint and apiKey information@Nonnull public static MultichainService create(@Nonnull MultichainBasicAuthDestination destination)
destination
- MultichainBasicAuthDestination containing the required endpoint and user, password information@Nonnull public static MultichainService create(@Nonnull String destinationId) throws org.springframework.web.client.HttpClientErrorException
destinationId
- Id from the service service in the destination serviceorg.springframework.web.client.HttpClientErrorException
- HttpClientErrorException@Nonnull public MultichainInfo getInfo() throws MultichainException, MultichainServiceException
MultichainException
- MultichainExceptionMultichainServiceException
- MultichainServiceException@Nonnull public String addMultiSigAddress(int nRequired, @Nonnull List<String> addresses) throws MultichainException, MultichainServiceException
nRequired
- Number of required signatures for valid transactionsaddresses
- List of pubKeys or addresses of stake holders in this addressMultichainException
- MultichainExceptionMultichainServiceException
- MultichainServiceException@Nonnull public String getNewAddress() throws MultichainException, MultichainServiceException
MultichainException
- MultichainExceptionMultichainServiceException
- MultichainServiceExceptionpublic void importAddress(@Nonnull String address, @Nonnull String label, boolean rescan) throws MultichainException, MultichainServiceException
address
- The address to be added to the wallet.label
- labelrescan
- rescanMultichainException
- MultichainExceptionMultichainServiceException
- MultichainServiceExceptionpublic void importAddresses(@Nonnull List<String> addresses, @Nonnull String label, boolean rescan) throws MultichainException, MultichainServiceException
addresses
- A list of addresses to be added to the wallet.label
- Label for the imported addressrescan
- Pass true to rescan the entire chain, false to skip rescanning, and from version 1.0.5, a positive
integer to rescan from that block number or a negative integer to rescan that many recent blocks.MultichainException
- MultichainExceptionMultichainServiceException
- MultichainServiceException@Nonnull public List<MultichainAddressResult> listAllAddresses() throws MultichainException, MultichainServiceException
MultichainException
- MultichainExceptionMultichainServiceException
- MultichainServiceException@Nonnull public List<MultichainAddressResult> listAllAddresses(boolean verbose) throws MultichainException, MultichainServiceException
verbose
- Set verbose to obtain more information about the addressesMultichainException
- MultichainExceptionMultichainServiceException
- MultichainServiceException@Nonnull public List<MultichainAddressResult> listAddresses(List<String> addresses, boolean verbose) throws MultichainException, MultichainServiceException
addresses
- List of service addresses to queryverbose
- Verbosity levelMultichainException
- MultichainExceptionMultichainServiceException
- MultichainServiceException@Nonnull public List<MultichainKeyPair> createKeyPairs(int count) throws MultichainException, MultichainServiceException
For each key pair, the address, pubkey (as embedded in transaction inputs) and privkey (used for signatures) is provided.
count
- The number of key paris to be generatedMultichainException
- MultichainExceptionMultichainServiceException
- MultichainServiceException@Nonnull public MultichainKeyPair createKeyPair() throws MultichainException, MultichainServiceException
For the key pair, the address, pubkey (as embedded in transaction inputs) and privkey (used for signatures) is provided.
MultichainException
- MultichainExceptionMultichainServiceException
- MultichainServiceException@Nonnull public String grant(@Nonnull Iterable<String> toAddresses, @Nonnull Collection<MultichainPermission> permissions) throws MultichainException, MultichainServiceException
For more information, @see permissions management
toAddresses
- List of addresses to grant permission topermissions
- List of permissionsMultichainException
- MultichainExceptionMultichainServiceException
- MultichainServiceException@Nonnull public String grantForAddress(@Nonnull String toAddress, @Nonnull Collection<MultichainPermission> permissions) throws MultichainException, MultichainServiceException
For more information, @see permissions management
toAddress
- Address to grant permission topermissions
- List of permissionsMultichainException
- MultichainExceptionMultichainServiceException
- MultichainServiceException@Nonnull public String grantFrom(@Nonnull String fromAddress, @Nonnull Iterable<String> toAddresses, @Nonnull Collection<MultichainPermission> permissions) throws MultichainException, MultichainServiceException
fromAddress
- Address to grant permission fromtoAddresses
- List of addresses to grant permission topermissions
- List of permissionsMultichainException
- MultichainExceptionMultichainServiceException
- MultichainServiceException@Nonnull public String grantForAddressFrom(@Nonnull String fromAddress, @Nonnull String toAddress, @Nonnull Collection<MultichainPermission> permissions) throws MultichainException, MultichainServiceException
fromAddress
- Address to grant permission fromtoAddress
- Addresses to grant permission topermissions
- List of permissionsMultichainException
- MultichainExceptionMultichainServiceException
- MultichainServiceException@Nonnull public List<MultichainPermissionResult> listPermissions(@Nonnull Collection<MultichainPermission> permissions, @Nonnull Iterable<String> addresses, boolean verbose) throws MultichainException, MultichainServiceException
permissions
- List of permissionsaddresses
- List of addresses to query permission ofverbose
- If verbose is true, the admins output field lists the administrator/s who assigned the corresponding
permission, and the pending field lists permission changes which are waiting to reach consensus.MultichainException
- MultichainExceptionMultichainServiceException
- MultichainServiceException@Nonnull public List<MultichainPermissionResult> listPermissions(@Nonnull Collection<MultichainPermission> permissions, boolean verbose) throws MultichainException, MultichainServiceException
permissions
- List of permissionsverbose
- If verbose is true, the admins output field lists the administrator/s who assigned the corresponding
permission, and the pending field lists permission changes which are waiting to reach consensus.MultichainException
- MultichainExceptionMultichainServiceException
- MultichainServiceException@Nonnull public List<MultichainPermissionResult> listAllPermissions(@Nonnull Iterable<String> addresses, boolean verbose) throws MultichainException, MultichainServiceException
addresses
- List of addresses to query permission ofverbose
- If verbose is true, the admins output field lists the administrator/s who assigned the corresponding
permission, and the pending field lists permission changes which are waiting to reach consensus.MultichainException
- MultichainExceptionMultichainServiceException
- MultichainServiceException@Nonnull public List<MultichainPermissionResult> listAllPermissionsForAddress(@Nonnull String address, boolean verbose) throws MultichainException, MultichainServiceException
address
- Addresses to query permission ofverbose
- If verbose is true, the admins output field lists the administrator/s who assigned the corresponding
permission, and the pending field lists permission changes which are waiting to reach consensus.MultichainException
- MultichainExceptionMultichainServiceException
- MultichainServiceException@Nonnull public String revoke(@Nonnull Iterable<String> toAddresses, @Nonnull Collection<MultichainPermission> permissions) throws MultichainException, MultichainServiceException
For more information, @see permissions management
toAddresses
- List of addresses to revoke permission frompermissions
- List of permission strings in the above-stated formatMultichainException
- MultichainExceptionMultichainServiceException
- MultichainServiceException@Nonnull public String revokeForAddress(@Nonnull String toAddress, @Nonnull Collection<MultichainPermission> permissions) throws MultichainException, MultichainServiceException
For more information, @see permissions management
toAddress
- Address to revoke permission frompermissions
- List of permission strings in the above-stated formatMultichainException
- MultichainExceptionMultichainServiceException
- MultichainServiceException@Nonnull public String revokeFrom(@Nonnull String fromAddress, @Nonnull Iterable<String> toAddresses, @Nonnull Collection<MultichainPermission> permissions) throws MultichainException, MultichainServiceException
fromAddress
- Address to be used for revoking the permissiontoAddresses
- List of address to revoke permission frompermissions
- List of permission strings in the above-stated formatMultichainException
- MultichainExceptionMultichainServiceException
- MultichainServiceException@Nonnull public String revokeForAddressFrom(@Nonnull String fromAddress, @Nonnull String toAddress, @Nonnull Collection<MultichainPermission> permissions) throws MultichainException, MultichainServiceException
fromAddress
- Address to be used for revoking the permissiontoAddress
- Address to revoke permission frompermissions
- List of permission strings in the above-stated formatMultichainException
- MultichainExceptionMultichainServiceException
- MultichainServiceException@Nonnull public String createStream(@Nonnull String streamName, boolean open) throws MultichainException, MultichainServiceException
streamName
- Name for the stream to be createdopen
- If open is true then anyone with global send permissions can publish to the stream, otherwise
publishers must be explicitly granted per-stream write permissions.MultichainException
- MultichainExceptionMultichainServiceException
- MultichainServiceException@Nonnull public String createStreamFromAddress(@Nonnull String fromAddress, @Nonnull String streamName, boolean open) throws MultichainException, MultichainServiceException
fromAddress
- Address to be used for creating the streamstreamName
- Name for the stream to be createdopen
- If open is true then anyone with global send permissions can publish to the stream, otherwise
publishers must be explicitly granted per-stream write permissions.MultichainException
- MultichainExceptionMultichainServiceException
- MultichainServiceException@Nonnull public List<MultichainStream> listAllStreams() throws MultichainException, MultichainServiceException
MultichainException
- MultichainExceptionMultichainServiceException
- MultichainServiceException@Nonnull public List<MultichainStream> listStreams(@Nonnull List<String> streams) throws MultichainException, MultichainServiceException
streams
- Pass a stream name, ref or creation txid in streams to retrieve information about one stream only, an
array thereof for multiple streams.MultichainException
- MultichainExceptionMultichainServiceException
- MultichainServiceException@Nonnull public String publishStringAsHex(@Nonnull String streamName, @Nonnull List<String> keys, @Nonnull String value, @Nullable String options) throws MultichainException, MultichainServiceException, UnsupportedOperationException
streamName
- Pass a stream name, ref or creation txid of a streamkeys
- Key or keys under which the entry should be published. For multichain 1.0, only the first key is used.value
- Data entry as string (non-hexadecimal) to be published on the blockchainoptions
- Additional opptions as e.g. 'offchain', only supported since service 2.0MultichainException
- MultichainExceptionMultichainServiceException
- MultichainServiceExceptionUnsupportedOperationException
- UnsupportedOperationException@Nullable public String publishJson(@Nonnull String streamName, @Nonnull List<String> keys, @Nonnull Map<String,Object> value, @Nullable String options) throws MultichainException, MultichainServiceException, UnsupportedOperationException
streamName
- Pass a stream name, ref or creation txid of a streamkeys
- One or multiple keys under which the entry should be publishedvalue
- JSON data structure to be published on the blockchainoptions
- OptionsMultichainException
- MultichainExceptionMultichainServiceException
- MultichainServiceExceptionUnsupportedOperationException
- UnsupportedOperationException@Nonnull public String publishStringAsHexFrom(@Nonnull String fromAddress, @Nonnull String streamName, @Nonnull List<String> keys, @Nonnull String value, @Nullable String options) throws MultichainException, MultichainServiceException, UnsupportedOperationException
fromAddress
- Address to be used for publishing on the streamstreamName
- A stream name, ref or creation txid of a streamkeys
- Key or keys under which the entry should be published. For multichain 1.0, only the first key is used.value
- Data entry as string (non-hexadecimal) to be published on the blockchainoptions
- Additional opptions as e.g. 'offchain', only supported since service 2.0MultichainException
- MultichainExceptionMultichainServiceException
- MultichainServiceExceptionUnsupportedOperationException
- UnsupportedOperationExceptionpublic void subscribe(@Nonnull List<String> assetsOrStreamNames, boolean rescan)
assetsOrStreamNames
- Single string or list of asset names or stream names to start trackingrescan
- Reindex all items from when the assets and/or streams were createdpublic void unsubscribe(@Nonnull List<String> assetsOrStreamNames)
assetsOrStreamNames
- Single string or list of asset names or stream names to stop tracking@Nonnull public MultichainResult getStreamItem(@Nonnull String streamName, @Nonnull String txId, boolean verbose) throws MultichainException, MultichainServiceException
streamName
- The stream in which the transaction has been madetxId
- The transactionId to queryverbose
- Get additional information about the item’s transaction.MultichainException
- MultichaiqnExceptionMultichainServiceException
- MultichainServiceException@Nonnull public List<MultichainResult> listStreamKeyItems(@Nonnull String streamName, @Nonnull String key, boolean verbose, int count, int start, boolean localOrdering) throws MultichainException, MultichainServiceException
streamName
- A stream name, ref or creation txid of a streamkey
- Key under which the entry has been publishedverbose
- Get additional information about the item’s transaction.count
- Limit the number of results to query.start
- Use negative start values (like the default) indicating the most recent itemslocalOrdering
- Set local-ordering to true to order items by when first seen by this node, rather than their order in
the chainMultichainException
- MultichainExceptionMultichainServiceException
- MultichainServiceException@Nonnull public List<MultichainResult> listStreamKeys(@Nonnull String streamName, @Nonnull List<String> keys, boolean verbose, int count, int start, boolean localOrdering) throws MultichainException, MultichainServiceException
streamName
- A stream name, ref or creation txid of a streamkeys
- Keys under which the entry has been publishedverbose
- Get additional information about the item’s transaction.count
- Limit the number of results to query.start
- Use negative start values (like the default) indicating the most recent itemslocalOrdering
- Set local-ordering to true to order items by when first seen by this node, rather than their order in
the chainMultichainException
- MultichainExceptionMultichainServiceException
- MultichainServiceException@Nonnull public List<MultichainResult> listAllStreamKeys(@Nonnull String streamName, boolean verbose, int count, int start, boolean localOrdering) throws MultichainException, MultichainServiceException
streamName
- A stream name, ref or creation txid of a streamverbose
- Get additional information about the item’s transaction.count
- Limit the number of results to query.start
- Use negative start values (like the default) indicating the most recent itemslocalOrdering
- Set local-ordering to true to order items by when first seen by this node, rather than their order in
the chainMultichainException
- MultichainExceptionMultichainServiceException
- MultichainServiceException@Nonnull public List<MultichainResult> listAllStreamItems(@Nonnull String streamName) throws MultichainException, MultichainServiceException
streamName
- A stream name, ref or creation txid of a streamMultichainException
- MultichainExceptionMultichainServiceException
- MultichainServiceException@Nonnull public List<MultichainResult> listStreamItems(@Nonnull String streamName, boolean verbose, int count, int start, boolean localOrdering) throws MultichainException, MultichainServiceException
streamName
- A stream name, ref or creation txid of a streamverbose
- Get additional information about the item’s transaction.count
- Limit the number of results to query.start
- Use negative start values (like the default) indicating the most recent itemslocalOrdering
- Set local-ordering to true to order items by when first seen by this node, rather than their order in
the chainMultichainException
- MultichainExceptionMultichainServiceException
- MultichainServiceException@Nonnull public List<MultichainResult> listStreamPublisherItems(@Nonnull String streamName, @Nonnull String address, boolean verbose, int count, int start, boolean localOrdering) throws MultichainException, MultichainServiceException
streamName
- A stream name, ref or creation txid of a streamaddress
- Address of the publisherverbose
- Get additional information about the item’s transaction.count
- Limit the number of results to query.start
- Use negative start values (like the default) indicating the most recent itemslocalOrdering
- Set local-ordering to true to order items by when first seen by this node, rather than their order in
the chainMultichainException
- MultichainExceptionMultichainServiceException
- MultichainServiceException@Nonnull public List<MultichainPublisher> listStreamPublishers(@Nonnull String streamName, @Nonnull List<String> addresses, boolean verbose, int count, int start, boolean localOrdering) throws MultichainException, MultichainServiceException
streamName
- A stream name, ref or creation txid of a streamaddresses
- Addresses of the publishersverbose
- Get additional information about the item’s transaction.count
- Limit the number of results to query.start
- Use negative start values (like the default) indicating the most recent itemslocalOrdering
- Set local-ordering to true to order items by when first seen by this node, rather than their order in
the chainMultichainException
- MultichainExceptionMultichainServiceException
- MultichainServiceException@Nonnull public List<MultichainUTXO> listLockUnspent() throws MultichainException, MultichainServiceException
MultichainException
- MultichainExceptionMultichainServiceException
- MultichainServiceException@Nonnull public List<MultichainUTXO> listUnspent(int minconf, int maxconf, @Nonnull List<String> addresses) throws MultichainException, MultichainServiceException
minconf
- Minimum number of confirmations for UTXOsmaxconf
- Maximum number of confirmations for UTXOsaddresses
- Receiving addresses of the UTXOsMultichainException
- MultichainExceptionMultichainServiceException
- MultichainServiceExceptionpublic void lockUnspent(boolean unlock, @Nonnull List<MultichainUTXO> utxoList)
unlock
- defines if tx should be locked or unlockedutxoList
- UTXOs to lock/unlock@Nonnull public String appendRawTransaction(@Nonnull String txHex, @Nonnull List<MultichainUTXO> inputs, @Nonnull Map<String,Integer> outputs, @Nonnull List<String> data, @Nonnull String action) throws MultichainException, MultichainServiceException
txHex
- Raw transaction in hex to append toinputs
- Inputs to appendoutputs
- Outputs to appenddata
- Data to append via OP_RETURN UTXOsaction
- Action to perform after appendingMultichainException
- MultichainExceptionMultichainServiceException
- MultichainServiceException@Nonnull public String createRawTransaction(@Nonnull List<MultichainUTXO> inputs, @Nonnull Map<String,Integer> outputs, @Nonnull List<String> data, @Nonnull String action) throws MultichainException, MultichainServiceException
inputs
- Inputs to consumeoutputs
- Outputs to createdata
- Data to append via OP_RETURN UTXOsaction
- Action to perform after appendingMultichainException
- MultichainExceptionMultichainServiceException
- MultichainServiceException@Nonnull public String createRawSendFrom(@Nonnull String fromAddress, @Nonnull Object assetObject, @Nonnull List<Map<String,String>> data) throws MultichainException, MultichainServiceException
This works like createrawtransaction, except it automatically selects the transaction inputs from those belonging to from-address, to cover the appropriate amounts. One or more change outputs going back to from-address will also be added to the end of the transaction.
fromAddress
- Address to be used for creating this transactionassetObject
- Transaction details maps, e.g. '{}' or '{"to-address":amount,...}data
- The optional data array adds one or more metadata outputs to the transaction, where each element is a
raw hexadecimal string or object, formatted as passed to appendrawdata, e.g.
'[{"for":"stream0","key":"key0","data":"4578"}]'.MultichainException
- MultichainExceptionMultichainServiceException
- MultichainServiceException@Nonnull public MultichainTransaction decodeRawTransaction(@Nonnull String txHex) throws MultichainException, MultichainServiceException
txHex
- The raw transaction hex stringMultichainException
- MultichainExceptionMultichainServiceException
- MultichainServiceException@Nonnull public String sendRawTransaction(@Nonnull String signedRawTransaction) throws MultichainException, MultichainServiceException
signedRawTransaction
- The signedRawTransaction to be sent as hex-stringMultichainException
- MultichainExceptionMultichainServiceException
- MultichainServiceException@Nonnull public MultichainSignedRawTransaction signRawTransaction(@Nonnull String rawTransaction, @Nullable List<Object> parentOutputObjects, @Nullable Collection<String> privateKeys) throws MultichainException, MultichainServiceException
rawTransaction
- The raw transaction in tx-hex to be signedparentOutputObjects
- To create chains of unbroadcast transactions, pass an optional array of {parent-output} objects, each
of which takes the form {"txid":txid,"vout":n,"scriptPubKey":hex}.privateKeys
- To sign using (only) private keys which are not in the node’s wallet, pass an array of "private-key"
strings, formatted as per the output of dumpprivkey. Pass null to sign from wallet keys only.MultichainException
- MultichainExceptionMultichainServiceException
- MultichainServiceException@Nonnull public MultichainBlock getBlock(@Nonnull String heightOrHash) throws MultichainException, MultichainServiceException
heightOrHash
- Block height or block hash to queryMultichainException
- MultichainExceptionMultichainServiceException
- MultichainServiceException@Nonnull public MultichainTransaction getRawTransaction(@Nonnull String txId) throws MultichainException, MultichainServiceException
txId
- Transaction id to queryMultichainException
- MultichainExceptionMultichainServiceException
- MultichainServiceException@Nonnull public List<MultichainBlock> listBlocks(@Nonnull String blocks, boolean verbose) throws MultichainException, MultichainServiceException
blocks
- Query string in the above-stated formverbose
- Verbosity of the block meta dataMultichainException
- MultichainExceptionMultichainServiceException
- MultichainServiceException@Nonnull public io.vavr.control.Option<MultichainResult> getLatestEntryOnStream(@Nonnull String streamName, @Nonnull String key) throws MultichainException, MultichainServiceException
streamName
- Stream to querykey
- Key to queryMultichainException
- MultichainExceptionMultichainServiceException
- MultichainServiceExceptionpublic void grantWritePermissionsOnStream(@Nonnull String streamName, @Nonnull Iterable<String> addresses) throws MultichainException, MultichainServiceException
streamName
- Stream to grant write access toaddresses
- Addresses to grant permission toMultichainException
- MultichainExceptionMultichainServiceException
- MultichainServiceExceptionpublic void revokeWritePermissionsOnStream(@Nonnull String streamName, @Nonnull Iterable<String> addresses) throws MultichainException, MultichainServiceException
streamName
- Stream to revoke write access fromaddresses
- Addresses to revoke permission fromMultichainException
- MultichainExceptionMultichainServiceException
- MultichainServiceException@Nonnull public String sendAsset(@Nonnull String address, @Nonnull String asset, int qty)
address
- Address to send asset toasset
- The asset can be specified using its name, ref or issuance txidqty
- Quantity of assets to send@Nonnull public List<MultichainAsset> listAssets() throws MultichainException, MultichainServiceException
MultichainException
- MultichainExceptionMultichainServiceException
- MultichainServiceException@Nonnull public List<MultichainAsset> listAssets(@Nonnull Map<String,Object> args) throws MultichainException, MultichainServiceException
args
- ptinal arguments for listassetsMultichainException
- MultichainExceptionMultichainServiceException
- MultichainServiceException@Nonnull public String issue(@Nonnull String address, @Nonnull String assetName, int qty)
address
- address the asset is issued to initiallyassetName
- name of the asset that is issuedqty
- number of units that should be send to address initially@Nonnull public String issue(@Nonnull String address, @Nonnull String assetName, int qty, @Nonnull Map<String,Object> args)
address
- address the asset is issued to initiallyassetName
- name of the asset that is issuedqty
- number of units that should be send to address initiallyargs
- HashMap of optional parameters (native-amount & units)@Nonnull public MultichainAssetTransaction getAssetTransaction(@Nonnull String asset, @Nonnull String txid) throws MultichainException, MultichainServiceException
asset
- asset can be specified using its name, ref or issuance txidtxid
- txid of the transactionMultichainException
- MultichainExceptionMultichainServiceException
- MultichainServiceException@Nonnull public <T> T extractMultichainResult(@Nonnull Class<T> contentClass, @Nonnull org.springframework.http.ResponseEntity<String> response) throws MultichainException, MultichainServiceException
T
- TcontentClass
- Class of expected result, e.g. MultichainTransaction.classresponse
- Response body of the MultichainRequestMultichainException
- MultichainExceptionMultichainServiceException
- MultichainServiceExceptionpublic MultichainBasicAuthDestination getDestination()
public org.springframework.http.client.HttpComponentsClientHttpRequestFactory getRequestFactory()
Copyright © 2020 SAP SE. All rights reserved.