net.sergeych.biserializer.BiSerializable
public class Parcel
extends java.lang.Object
implements net.sergeych.biserializer.BiSerializable
Modifier and Type | Class | Description |
---|---|---|
static class |
Parcel.BadPayloadException |
|
static class |
Parcel.BadPaymentException |
|
static class |
Parcel.InsufficientFundsException |
|
static class |
Parcel.OwnerNotResolvedException |
Modifier and Type | Field | Description |
---|---|---|
static java.lang.String |
COMPOUND_MAIN_TAG |
|
static java.lang.String |
COMPOUND_PAYMENT_TAG |
|
static java.lang.String |
TP_PAYING_FOR_TAG_PREFIX |
Constructor | Description |
---|---|
Parcel() |
Terms.
|
Parcel(TransactionPack payload,
TransactionPack payment) |
Terms.
|
Parcel(net.sergeych.tools.Binder data) |
Terms.
|
Modifier and Type | Method | Description |
---|---|---|
void |
addPayingAmount(int payingAmount,
java.util.Collection<com.icodici.crypto.PrivateKey> uKeys,
java.util.Collection<com.icodici.crypto.PrivateKey> keysToSignPayloadWith) |
Adds an additional paying amount to the main contract of the parcel.
|
void |
addPayingAmountV2(int payingAmount,
java.util.Collection<com.icodici.crypto.PrivateKey> uKeys) |
Adds an additional paying amount to the main contract of the parcel.
|
static Contract |
createPayment(Contract uContract,
java.util.Collection<com.icodici.crypto.PrivateKey> uKeys,
int amount,
boolean withTestPayment) |
|
void |
deserialize(net.sergeych.tools.Binder data,
net.sergeych.biserializer.BiDeserializer ds) |
|
static Contract |
findPaymentContract(Contract contract,
TransactionPack transactionPack,
java.util.Set<com.icodici.crypto.KeyAddress> uIssuerKeys,
java.lang.String uIssuerName) |
|
HashId |
getId() |
|
TransactionPack |
getPayload() |
|
Contract |
getPayloadContract() |
|
TransactionPack |
getPayment() |
|
Contract |
getPaymentContract() |
|
int |
getQuantasLimit() |
|
Contract |
getRemainingU() |
Gets the latest revision of payment contract used by this Parcel.
|
Contract |
getRemainingU(boolean payloadApproved) |
Gets the latest revision of payment contract used by this Parcel.
|
static Parcel |
of(Contract payload,
Contract uContract,
java.util.Collection<com.icodici.crypto.PrivateKey> uKeys) |
Create parcel used for paid contract registration on the network and
adds an additional paying amount to the main contract of the parcel.
|
static Parcel |
of(Contract payload,
Contract uContract,
java.util.Collection<com.icodici.crypto.PrivateKey> uKeys,
boolean withTestPayment) |
Create parcel used for paid contract registration on the network.
|
static Parcel |
of(Contract payload,
Contract uContract,
java.util.Collection<com.icodici.crypto.PrivateKey> uKeys,
int payingAmount) |
Create parcel used for paid contract registration on the network.
|
static Parcel |
of(Contract payload,
Contract uContract,
java.util.Collection<com.icodici.crypto.PrivateKey> uKeys,
int payingAmount,
java.util.Collection<com.icodici.crypto.PrivateKey> keysToSignPayloadWith) |
Create parcel used for paid contract registration on the network.
|
byte[] |
pack() |
Shortcut to
Boss.pack(Object) for this. |
protected void |
prepareForNode() |
Method check parcel's specific behavior and prepare Parcel for the node.
|
net.sergeych.tools.Binder |
serialize(net.sergeych.biserializer.BiSerializer s) |
|
static Parcel |
unpack(byte[] packOrContractBytes) |
Unpack parcel.
|
public static final java.lang.String TP_PAYING_FOR_TAG_PREFIX
public static final java.lang.String COMPOUND_MAIN_TAG
public static final java.lang.String COMPOUND_PAYMENT_TAG
public Parcel()
pack()
byte array. When the node get byte array it
unpack it via unpack(byte[])
, while unpacking payment and payload is unpacking as TransactionPack
,
then prepareForNode()
is called and unpacked contracts is preparing for the
node (set need flags and quanta's limits).public Parcel(TransactionPack payload, TransactionPack payment)
pack()
byte array. When the node get byte array it
unpack it via unpack(byte[])
, while unpacking payment and payload is unpacking as TransactionPack
,
then prepareForNode()
is called and unpacked contracts is preparing for the
node (set need flags and quanta's limits).public Parcel(net.sergeych.tools.Binder data) throws java.io.IOException
pack()
byte array. When the node get byte array it
unpack it via unpack(byte[])
, while unpacking payment and payload is unpacking as TransactionPack
,
then prepareForNode()
is called and unpacked contracts is preparing for the
node (set need flags and quanta's limits).java.io.IOException
public static Contract findPaymentContract(Contract contract, TransactionPack transactionPack, java.util.Set<com.icodici.crypto.KeyAddress> uIssuerKeys, java.lang.String uIssuerName)
public int getQuantasLimit()
public static Contract createPayment(Contract uContract, java.util.Collection<com.icodici.crypto.PrivateKey> uKeys, int amount, boolean withTestPayment) throws Parcel.InsufficientFundsException, Parcel.OwnerNotResolvedException
public static Parcel of(Contract payload, Contract uContract, java.util.Collection<com.icodici.crypto.PrivateKey> uKeys) throws Parcel.BadPayloadException, Parcel.InsufficientFundsException, Parcel.OwnerNotResolvedException
payload
- contract to be registered on the networkuContract
- contract containing units used for paymentuKeys
- keys to resolve owner of payment contractParcel.BadPayloadException
Parcel.InsufficientFundsException
Parcel.OwnerNotResolvedException
public static Parcel of(Contract payload, Contract uContract, java.util.Collection<com.icodici.crypto.PrivateKey> uKeys, int payingAmount, java.util.Collection<com.icodici.crypto.PrivateKey> keysToSignPayloadWith) throws Parcel.BadPayloadException, Parcel.InsufficientFundsException, Parcel.OwnerNotResolvedException
NSmartContract
payload
- contract to be registered on the networkuContract
- contract containing units used for paymentuKeys
- keys to resolve owner of payment contractParcel.BadPayloadException
Parcel.InsufficientFundsException
Parcel.OwnerNotResolvedException
public static Parcel of(Contract payload, Contract uContract, java.util.Collection<com.icodici.crypto.PrivateKey> uKeys, int payingAmount) throws Parcel.BadPayloadException, Parcel.InsufficientFundsException, Parcel.OwnerNotResolvedException
NSmartContract
Note: this method uses new way of providing additional payments to NSmartContract
currently it is only supported by UnsContract
payload
- contract to be registered on the networkuContract
- contract containing units used for paymentuKeys
- keys to resolve owner of payment contractParcel.BadPayloadException
Parcel.InsufficientFundsException
Parcel.OwnerNotResolvedException
public static Parcel of(Contract payload, Contract uContract, java.util.Collection<com.icodici.crypto.PrivateKey> uKeys, boolean withTestPayment) throws Parcel.BadPayloadException, Parcel.InsufficientFundsException, Parcel.OwnerNotResolvedException
payload
- contract to be registered on the networkuContract
- contract containing units used for paymentuKeys
- keys to resolve owner of payment contractwithTestPayment
- flag indicates if test units should be used and contract should be registered on the TestNet rather than MainNetParcel.BadPayloadException
Parcel.InsufficientFundsException
Parcel.OwnerNotResolvedException
public void addPayingAmount(int payingAmount, java.util.Collection<com.icodici.crypto.PrivateKey> uKeys, java.util.Collection<com.icodici.crypto.PrivateKey> keysToSignPayloadWith)
NSmartContract
Note: adding an additional payment to a parcel drops payload contract signatures so these must be added again.payingAmount
- an amount paid additionally.uKeys
- keys to resolve owner of parcel main payment contractkeysToSignPayloadWith
- keys sign payload contract with.public void addPayingAmountV2(int payingAmount, java.util.Collection<com.icodici.crypto.PrivateKey> uKeys)
NSmartContract
Note: this method uses new way of providing additional payments to NSmartContract
currently it is only supported by UnsContract
payingAmount
- an amount paid additionally.uKeys
- keys to resolve owner of parcel main payment contractpublic Contract getRemainingU()
public Contract getRemainingU(boolean payloadApproved)
APPROVED
status
and must be kept and used for future transactionspublic TransactionPack getPayload()
public TransactionPack getPayment()
protected void prepareForNode()
public Contract getPayloadContract()
public Contract getPaymentContract()
public HashId getId()
public net.sergeych.tools.Binder serialize(net.sergeych.biserializer.BiSerializer s)
serialize
in interface net.sergeych.biserializer.BiSerializable
public void deserialize(net.sergeych.tools.Binder data, net.sergeych.biserializer.BiDeserializer ds) throws java.io.IOException
deserialize
in interface net.sergeych.biserializer.BiSerializable
java.io.IOException
public static Parcel unpack(byte[] packOrContractBytes) throws java.io.IOException
public byte[] pack()
Boss.pack(Object)
for this.