public class RadixApplicationAPI
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
RadixApplicationAPI.RadixApplicationAPIBuilder |
static class |
RadixApplicationAPI.Result |
class |
RadixApplicationAPI.Transaction
Represents an atomic transaction to be committed to the ledger
|
Modifier and Type | Method and Description |
---|---|
UnsignedAtom |
buildAtomWithFee(java.util.List<ParticleGroup> particleGroups)
Returns an unsigned atom with the appropriate fees given a list of
particle groups to compose the atom.
|
RadixApplicationAPI.Result |
burnTokens(RRI token,
java.math.BigDecimal amount)
Burns an amount of tokens in the user's account
|
static RadixApplicationAPI |
create(BootstrapConfig bootstrap,
RadixIdentity identity)
Creates an API with the default actions and reducers
|
RadixApplicationAPI.Result |
createFixedSupplyToken(RRI tokenRRI,
java.lang.String name,
java.lang.String description,
java.math.BigDecimal supply)
Creates a fixed-supply token registered into the user's account with
10^-18 granularity
|
RadixApplicationAPI.Result |
createMultiIssuanceToken(RRI tokenRRI,
java.lang.String name)
Creates a multi-issuance token registered into the user's account with
zero initial supply, 10^-18 granularity and no description.
|
RadixApplicationAPI.Result |
createMultiIssuanceToken(RRI tokenRRI,
java.lang.String name,
java.lang.String description)
Creates a multi-issuance token registered into the user's account with
zero initial supply and 10^-18 granularity
|
RadixApplicationAPI.Result |
createToken(RRI tokenRRI,
java.lang.String name,
java.lang.String description,
java.math.BigDecimal initialSupply,
java.math.BigDecimal granularity,
CreateTokenAction.TokenSupplyType tokenSupplyType)
Creates a token registered into the user's account
|
RadixApplicationAPI.Transaction |
createTransaction()
Create a new transaction which is based off of the
current data in the atom store.
|
static RadixApplicationAPI.RadixApplicationAPIBuilder |
defaultBuilder()
Creates a default API builder with the default actions and reducers without an identity
|
void |
discoverNodes()
Dispatches a discovery request, the result of which would
be viewable via getNetworkState()
|
RadixApplicationAPI.Result |
execute(Action action)
Immediately executes a user action onto the ledger.
|
RadixApplicationAPI.Result |
execute(Action action,
RadixNode originNode)
Immediately executes a user action onto the ledger.
|
RadixAddress |
getAddress()
Retrieve the user's address
|
RadixAddress |
getAddress(ECPublicKey publicKey)
Retrieve the address for the current universe given a public key
|
AtomStore |
getAtomStore()
Retrieve the atom store used by the API
|
java.util.Map<RRI,java.math.BigDecimal> |
getBalances()
Retrieve the balances of the current address from the current atom store.
|
RadixIdentity |
getIdentity()
Retrieve the user's key identity
|
RRI |
getNativeTokenRef()
Returns the native Token Reference found in the genesis atom
|
io.reactivex.Observable<RadixNodeAction> |
getNetworkActions()
Low level call to retrieve the actions occurring at the network
level.
|
io.reactivex.Observable<RadixNetworkState> |
getNetworkState()
Get a stream of updated network states as they occur.
|
ECPublicKey |
getPublicKey()
Retrieve the user's public key
|
TokenState |
getTokenDef(RRI tokenRRI)
Retrieve the token state of the given rri
|
RadixApplicationAPI.Result |
mintTokens(RRI token,
java.math.BigDecimal amount)
Mints an amount of new tokens into the user's account
|
<T> io.reactivex.Observable<T> |
observeActions(java.lang.Class<T> actionClass,
RadixAddress address)
Returns a never ending stream of actions performed at a given address with the
given Atom Store.
|
io.reactivex.Observable<java.math.BigDecimal> |
observeBalance(RadixAddress address,
RRI token)
Returns a stream of the latest balance of a given token at a given address
pull() must be called to continually retrieve the latest balance.
|
io.reactivex.Observable<java.math.BigDecimal> |
observeBalance(RRI tokenRRI)
Returns a stream of the latest balances at the current address
pull() must be called to continually retrieve the latest balances.
|
io.reactivex.Observable<java.util.Map<RRI,java.math.BigDecimal>> |
observeBalances(RadixAddress address)
Returns a stream of the latest balances at a given address.
|
io.reactivex.Observable<DecryptedMessage> |
observeMessages()
Returns a never ending stream of messages stored at the current address.
|
io.reactivex.Observable<DecryptedMessage> |
observeMessages(RadixAddress address)
Returns a never ending stream of messages stored at a given address.
|
<T extends ApplicationState> |
observeState(java.lang.Class<T> stateClass,
RadixAddress address)
Returns a never ending stream of a state of a given address with the
given Atom store.
|
io.reactivex.Observable<TokenState> |
observeTokenDef(RRI tokenRRI)
Returns a stream of the latest state of a given token
|
io.reactivex.Observable<TokenDefinitionsState> |
observeTokenDefs()
Returns a stream of the latest state of token definitions at the user's
address
|
io.reactivex.Observable<TokenDefinitionsState> |
observeTokenDefs(RadixAddress address)
Returns a stream of the latest state of token definitions at a given
address
|
io.reactivex.Observable<TokenTransfer> |
observeTokenTransfers()
Returns a never ending stream of token transfers stored at the current address.
|
io.reactivex.Observable<TokenTransfer> |
observeTokenTransfers(RadixAddress address)
Returns a never ending stream of token transfers stored at a given address.
|
io.reactivex.disposables.Disposable |
pull()
Idempotent method which prefetches atoms in user's account
TODO: what to do when no puller available
|
io.reactivex.disposables.Disposable |
pull(RadixAddress address)
Idempotent method which prefetches atoms in an address
TODO: what to do when no puller available
|
io.reactivex.Completable |
pullOnce(RadixAddress address)
Retrieves atoms until the node returns a synced message.
|
RadixApplicationAPI.Result |
sendMessage(byte[] data,
boolean encrypt)
Sends a message to one's self
|
RadixApplicationAPI.Result |
sendMessage(RadixAddress toAddress,
byte[] data,
boolean encrypt)
Sends a message from the current address to another address
|
RadixApplicationAPI.Result |
sendTokens(RRI token,
RadixAddress to,
java.math.BigDecimal amount)
Transfers an amount of a token to an address
|
RadixApplicationAPI.Result |
sendTokens(RRI token,
RadixAddress to,
java.math.BigDecimal amount,
byte[] attachment)
Transfers an amount of tokens with an attachment to an address
|
RadixApplicationAPI.Result |
sendTokens(RRI token,
RadixAddress to,
java.math.BigDecimal amount,
java.lang.String message)
Transfers an amount of a token with a message attachment to an address
|
RadixApplicationAPI.Result |
sendTokens(RRI token,
RadixAddress from,
RadixAddress to,
java.math.BigDecimal amount)
Transfers an amount of tokens to an address
|
RadixApplicationAPI.Result |
sendTokens(RRI token,
RadixAddress from,
RadixAddress to,
java.math.BigDecimal amount,
byte[] attachment)
Transfers an amount of a token with a data attachment to an address with a unique property
meaning that no other transaction can be executed with the same unique bytes
|
RadixApplicationAPI.Result |
submitAtom(Atom atom)
Low level call to submit an atom into the network.
|
RadixApplicationAPI.Result |
submitAtom(Atom atom,
boolean completeOnStoreOnly)
Low level call to submit an atom into the network.
|
RadixApplicationAPI.Result |
submitAtom(Atom atom,
boolean completeOnStoreOnly,
RadixNode originNode)
Low level call to submit an atom into the network.
|
public static RadixApplicationAPI create(BootstrapConfig bootstrap, RadixIdentity identity)
identity
- the identity of user of APIpublic static RadixApplicationAPI.RadixApplicationAPIBuilder defaultBuilder()
public ECPublicKey getPublicKey()
public RadixIdentity getIdentity()
public RadixAddress getAddress()
public RadixAddress getAddress(ECPublicKey publicKey)
public io.reactivex.disposables.Disposable pull()
public io.reactivex.disposables.Disposable pull(RadixAddress address)
address
- the address to pull atoms frompublic io.reactivex.Completable pullOnce(RadixAddress address)
address
- the address to pull atoms forpublic RRI getNativeTokenRef()
public <T> io.reactivex.Observable<T> observeActions(java.lang.Class<T> actionClass, RadixAddress address)
T
- the Action classactionClass
- the Action classaddress
- the address to retrieve the state ofpublic <T extends ApplicationState> io.reactivex.Observable<T> observeState(java.lang.Class<T> stateClass, RadixAddress address)
T
- the ApplicationState classstateClass
- the ApplicationState classaddress
- the address to retrieve the state ofpublic io.reactivex.Observable<TokenDefinitionsState> observeTokenDefs(RadixAddress address)
address
- the address of the account to checkpublic io.reactivex.Observable<TokenDefinitionsState> observeTokenDefs()
public io.reactivex.Observable<TokenState> observeTokenDef(RRI tokenRRI)
public TokenState getTokenDef(RRI tokenRRI)
public io.reactivex.Observable<DecryptedMessage> observeMessages()
public io.reactivex.Observable<DecryptedMessage> observeMessages(RadixAddress address)
address
- the address to retrieve the messages frompublic RadixApplicationAPI.Result sendMessage(byte[] data, boolean encrypt)
data
- the message to sendencrypt
- if true, encrypts the message with a encrypted private keypublic RadixApplicationAPI.Result sendMessage(RadixAddress toAddress, byte[] data, boolean encrypt)
toAddress
- the address to send the message todata
- the message to sendencrypt
- if true, encrypts the message with an encrypted private keypublic io.reactivex.Observable<TokenTransfer> observeTokenTransfers()
public io.reactivex.Observable<TokenTransfer> observeTokenTransfers(RadixAddress address)
address
- the address to retrieve the token transfers frompublic java.util.Map<RRI,java.math.BigDecimal> getBalances()
public io.reactivex.Observable<java.util.Map<RRI,java.math.BigDecimal>> observeBalances(RadixAddress address)
public io.reactivex.Observable<java.math.BigDecimal> observeBalance(RRI tokenRRI)
public io.reactivex.Observable<java.math.BigDecimal> observeBalance(RadixAddress address, RRI token)
public RadixApplicationAPI.Result createMultiIssuanceToken(RRI tokenRRI, java.lang.String name)
tokenRRI
- The symbol of the token to createname
- The name of the token to createpublic RadixApplicationAPI.Result createMultiIssuanceToken(RRI tokenRRI, java.lang.String name, java.lang.String description)
tokenRRI
- The symbol of the token to createname
- The name of the token to createdescription
- A description of the tokenpublic RadixApplicationAPI.Result createFixedSupplyToken(RRI tokenRRI, java.lang.String name, java.lang.String description, java.math.BigDecimal supply)
tokenRRI
- The symbol of the token to createname
- The name of the token to createdescription
- A description of the tokensupply
- The supply of the created tokenpublic RadixApplicationAPI.Result createToken(RRI tokenRRI, java.lang.String name, java.lang.String description, java.math.BigDecimal initialSupply, java.math.BigDecimal granularity, CreateTokenAction.TokenSupplyType tokenSupplyType)
tokenRRI
- The symbol of the token to createname
- The name of the token to createdescription
- A description of the tokeninitialSupply
- The initial amount of supply for this tokengranularity
- The least multiple of subunits per transaction for this tokentokenSupplyType
- The type of supply for this token: Fixed or Mutablepublic RadixApplicationAPI.Result mintTokens(RRI token, java.math.BigDecimal amount)
token
- The symbol of the token to mintamount
- The amount to mintpublic RadixApplicationAPI.Result burnTokens(RRI token, java.math.BigDecimal amount)
token
- The symbol of the token to mintamount
- The amount to mintpublic RadixApplicationAPI.Result sendTokens(RRI token, RadixAddress to, java.math.BigDecimal amount)
to
- the address to transfer tokens toamount
- the amount and token typepublic RadixApplicationAPI.Result sendTokens(RRI token, RadixAddress to, java.math.BigDecimal amount, @Nullable java.lang.String message)
to
- the address to transfer tokens toamount
- the amount and token typemessage
- message to be encrypted and attached to transferpublic RadixApplicationAPI.Result sendTokens(RRI token, RadixAddress to, java.math.BigDecimal amount, @Nullable byte[] attachment)
to
- the address to send tokens toamount
- the amount and token typeattachment
- the data attached to the transactionpublic RadixApplicationAPI.Result sendTokens(RRI token, RadixAddress from, RadixAddress to, java.math.BigDecimal amount)
to
- the address to send tokens toamount
- the amount and token typepublic RadixApplicationAPI.Result sendTokens(RRI token, RadixAddress from, RadixAddress to, java.math.BigDecimal amount, @Nullable byte[] attachment)
to
- the address to send tokens toamount
- the amount and token typeattachment
- the data attached to the transactionpublic RadixApplicationAPI.Result execute(Action action)
action
- action to executepublic RadixApplicationAPI.Result execute(Action action, RadixNode originNode)
action
- action to executeoriginNode
- node to submit action topublic UnsignedAtom buildAtomWithFee(java.util.List<ParticleGroup> particleGroups)
particleGroups
- particle groups to include in atompublic RadixApplicationAPI.Transaction createTransaction()
public RadixApplicationAPI.Result submitAtom(Atom atom, boolean completeOnStoreOnly, RadixNode originNode)
atom
- atom to submitcompleteOnStoreOnly
- if true, result will only complete on a store eventpublic RadixApplicationAPI.Result submitAtom(Atom atom, boolean completeOnStoreOnly)
atom
- atom to submitcompleteOnStoreOnly
- if true, result will only complete on a store eventpublic RadixApplicationAPI.Result submitAtom(Atom atom)
atom
- atom to submitpublic AtomStore getAtomStore()
public void discoverNodes()
public io.reactivex.Observable<RadixNetworkState> getNetworkState()
public io.reactivex.Observable<RadixNodeAction> getNetworkActions()