Structures#
All structures in Ride are built-in — you cannot create your own structures. All structures have constructors.
Let’s see an example of a code that creates an instance of the IntegerEntry structure and reads its key and value:
let data = IntegerEntry("Age", 33)
let key = data.key
let val = data.value
Script Actions#
Script actions are executed, that is, they make changes on the blockchain only if they are included in the resulting expression of the callable function. See more details in the callable function article.
Action |
Description |
---|---|
Add or modify a binary entry of the account data storage. |
|
Add or modify a boolean entry. |
|
Burn a token. |
|
Delete an entry. |
|
Add or modify an integer entry. |
|
Issue a token. |
|
Lease. |
|
Cancel lease. |
|
Reissue a token. |
|
Transfer a token. |
|
Set up a sponsorship. |
|
Add or modify a string entry. |
Available script actions depend on the standard library version used.
BinaryEntry#
BinaryEntry is a structure that sets key and value of binary entry account data storage. Adding or changing an entry is performed only if the structure is included in the callable function result>`.
Constructor
BinaryEntry(key: String, value: ByteVector)
Fields
# |
Name |
Data type |
Description |
---|---|---|---|
\(1\) |
key |
Entry key. The maximum size is \(400\) bytes. |
|
\(2\) |
value |
Entry value. The maximum size is \(5\) Kbytes. |
BooleanEntry#
BooleanEntry is a structure that sets the key and value of the account data storage boolean entry. Adding or changing an entry is performed only if the structure is included in the callable function result>`.
Constructor
BooleanEntry(key: String, value: Boolean)
Fields
# |
Name |
Data type |
Description |
---|---|---|---|
\(1\) |
key |
Entry key. The maximum size is \(400\) bytes. |
|
\(2\) |
value |
Entry value. |
Burn#
Burn is a structure that sets the parameters of the token burning. The token burning is performed only if the structure is included in the callable function result>`. If the token is a smart asset, the asset script verifies the Burn action as if it were BurnTransaction with the fee of \(0\) and the version of \(0\). If the asset script denies the action, then the transaction that invoked the dApp script is either denied or saved on the blockchain as failed, see the transaction validation.
Constructor
Burn(assetId: ByteVector, quantity: Int)
Fields
# |
Name |
Data type |
Description |
---|---|---|---|
\(1\) |
assetId |
ID of the token to burn. |
|
\(2\) |
quantity |
Amount of the token. |
DeleteEntry#
DeleteEntry is a structure that sets the parameters of deletion of entry from the account data storage. Deleting an entry is performed only if the structure is included in the callable function result>`.
Constructor
DeleteEntry(key: String)
Fields
# |
Name |
Data type |
Description |
---|---|---|---|
\(1\) |
key |
Entry key. The maximum size is \(400\) bytes. |
Example
{-# STDLIB_VERSION 5 #-}
{-# SCRIPT_TYPE ACCOUNT #-}
@Callable(inv)
func default() = {
(
[
DeleteEntry(inv.caller.toString())
],
unit
)
}
IntegerEntry#
IntegerEntry is a structure that sets the key and value of account data storage integer entry. Adding or changing an entry is performed only if the structure is included in the callable function result>`.
Constructor
IntegerEntry(key: String, value: Int)
Fields
# |
Name |
Data type |
Description |
---|---|---|---|
\(1\) |
key |
Entry key. The maximum size is \(400\) bytes. |
|
\(2\) |
value |
Entry value. |
Issue#
Issue is a structure that sets the parameters of the token issue. The token issue is performed only if the structure is included in the callable function result>`. The minimum fee for an invoke script transaction is increased by \(1\) DecentralCoin for each issued asset that is not NFT. You can get the ID of the issued token using the calculateAssetId function.
Constructor
Issue(name: String, description: String, quantity: Int, decimals: Int, isReissuable: Boolean, compiledScript: Script|Unit, nonce: Int)
or
Issue(name: String, description: String, quantity: Int, decimals: Int, isReissuable: Boolean)
In the second case, compiledScript = unit and nonce = 0 values are inserted automatically.
Fields
# |
Name |
Data type |
Description |
---|---|---|---|
\(1\) |
name |
Token name. |
|
\(2\) |
description |
Token description. |
|
\(3\) |
quantity |
Amount of the token. Set to \(1\) for NFT. |
|
\(4\) |
decimals |
Number of digits in decimal part. Set to \(0\) for NFT. |
|
\(5\) |
isReissuable |
Reissue ability flag. Set to \(0\) for NFT. |
|
\(6\) |
compiledScript |
Set it to unit. Smart asset issue is currently unavailable. |
|
\(7\) |
nonce |
Nonce that is used for token ID generation. If the callable function issues several tokens with the same parameters, you should use different nonce. |
Example
Regular Token Issue
Issue("RegularToken", "This is an ordinary token", 10000, 2, true)
The structure sets the following parameters of token:
Name: RegularToken
Description: This is an ordinary token
Amount of tokens to issue: \(100\) (value of \(10 000\) is specified in the minimum fraction — “cents”)
Amount of decimals: \(2\)
Reissue ability: yes
Multiple Token Issue
(
[
Issue("RegularToken", "This is an ordinary token", 10000, 2, true, unit, 0),
Issue("RegularToken", "This is an ordinary token", 10000, 2, true, unit, 1)
],
unit
)
NFT Issue
Issue("UberToken", "The ultimate token.", 1, 0, false)
The structure sets the following parameters of token:
Name: UberToken
Description: The ultimate token.
Amount of tokens to issue: \(1\)
Amount of decimals: \(0\)
Reissue ability: no
Lease#
Lease is a structure that sets the lease parameters. The lease is performed only if the structure is included in the callable function result>`. More about lease. You can get the lease ID using the calculateLeaseId function.
Constructor
Lease(recipient: Address|Alias, amount: Int, nonce: Int)
or
Lease(recipient: Address|Alias, amount: Int)
In the second case, nonce = \(0\) is inserted automatically.
Fields
# |
Name |
Data type |
Description |
---|---|---|---|
\(1\) |
recipient |
||
\(2\) |
amount |
Amount of DecentralCoins to lease (that is, amount of Decentralites multiplied by \(10^{8}\)). |
|
\(7\) |
nonce |
Nonce that is used for lease ID generation. If the callable function creates several leases with the same parameters, you should use different nonces. |
Example
{-# STDLIB_VERSION 5 #-}
{-# CONTENT_TYPE DAPP #-}
{-# SCRIPT_TYPE ACCOUNT #-}
@Callable(i)
func foo() = {
let lease = Lease(Alias("merry"),100000000)
let id = calculateLeaseId(lease)
(
[
lease,
BinaryEntry("lease", id)
],
unit
)
}
LeaseCancel#
LeaseCancel is a structure that sets the lease cancellation parameters. The lease cancellation is performed only if the structure is included in the callable function result>`.
Constructor
LeaseCancel(leaseId: ByteVector)
Fields
# |
Name |
Data type |
Description |
---|---|---|---|
\(1\) |
leaseId |
Lease ID |
Reissue#
Reissue is a structure that sets the parameters of the token reissue. The token reissue is performed only if the structure is included in the callable function result>`. The token reissue is only available for an asset that is issued by a dApp account. If the token is a smart asset, the asset script verifies the Reissue action as if it were ReissueTransaction with the fee of 0 and the version of 0. If the asset script denies the action, then the transaction that invoked the dApp script is either denied or saved on the blockchain as failed, see the transaction validation.
Constructor
Reissue(assetId: ByteVector, quantity: Int, isReissuable: Boolean)
Fields
# |
Name |
Data type |
Description |
---|---|---|---|
\(1\) |
assetId |
ID of the token to reissue. |
|
\(2\) |
quantity |
Amount of the token. |
|
\(3\) |
isReissuable |
Reissue ability flag. |
ScriptTransfer#
ScriptTransfer is a structure that sets the parameters of the token transfer. The token transfer is performed only if the structure is included in the callable function result>`. If the token is a smart asset, the asset script verifies the ScriptTransfer action as if it were TransferTransaction with the fee of \(0\) and the version of \(0\). If the asset script denies the action, then the transaction that invoked the dApp script is either denied or saved on the blockchain as failed, see the transaction validation.
Constructor
ScriptTransfer(recipient: Address|Alias, amount: Int, asset: ByteVector|Unit)
Fields
# |
Name |
Data type |
Description |
---|---|---|---|
\(1\) |
recipient |
||
\(2\) |
amount |
Number of tokens. |
|
\(3\) |
asset |
SponsorFee#
SponsorFee is a structure that sets up sponsorship. For information about sponsorship, see the sponsored fee article. The sponsorship setup is performed only if the structure is included in the resulting expression of the callable function. See details in the callable function article. The sponsorship setup is only available if the asset is issued by a dApp account (by the same script invocation as well) and is not a smart asset.
Constructor
SponsorFee(assetId: ByteVector, minSponsoredAssetFee: Int|Unit)
Fields
# |
Name |
Data type |
Description |
---|---|---|---|
\(1\) |
assetId |
Asset ID |
|
\(2\) |
minSponsoredAssetFee |
Amount of sponsored asset that is equivalent to 0.001 DecentralCoins, specified in the minimum fraction (“cent”) of the sponsored asset. unit — disable the sponsorship. |
Example
{-# STDLIB_VERSION 5 #-}
{-# CONTENT_TYPE DAPP #-}
{-# SCRIPT_TYPE ACCOUNT #-}
@Callable(i)
func issueAndSponsor() = {
let issue = Issue("Spring", "", 100000, 2, true, unit, 0)
let id = calculateAssetId(issue)
(
[
issue,
SponsorFee(id, 300)
],
unit
)
}
The issueAndSponsor callable function issues an asset and enables sponsorship. The minimum fee in sponsored assets is \(3\) Spring.
StringEntry#
StringEntry is a structure that sets key and value of account data storage string entry. Adding or changing an entry is performed only if the structure is included in the callable function result>`.
Constructor
BinaryEntry(key: String, value: String)
Fields
# |
Name |
Data type |
Description |
---|---|---|---|
\(1\) |
key |
Entry key. The maximum size is \(400\) bytes. |
|
\(2\) |
value |
Entry value. The maximum size is \(5\) Kbytes. |
Common Structures#
Name |
Description |
---|---|
Token info. |
|
Pair of tokens of an order within the order structure. |
|
Payment attached to the script invocation and available to the callable function. |
|
Account balance in DecentralCoins. |
|
Block header. |
|
Script invocation fields that the callable function can use. |
|
Order |
|
Transfer within the MassTransferTransaction structure. |
Address#
Structure of an address.
Constructor
Address(bytes: ByteVector)
Fields
# |
Name |
Data type |
Description |
---|---|---|---|
\(1\) |
bytes |
Array of bytes of the address. |
Example
Get all types of balance in DecentralCoins for the current account (in a dApp script or an account script):
decentralchainBalance(this)
For any account:
let address=base58'3N4iKL6ikwxiL7yNvWQmw7rg3wGna8uL6LU'
decentralchainBalance(Address(address))
Get an entry value by key from the account data storage:
let address2=base58'3N6dFJ6XBQsWz1VV1i5aW4CyYpVKc39MUGZ'
getBoolean(Address(address2),"allow_orders")
Convert the address that invoked the function to a base58 string:
{-# STDLIB_VERSION 5 #-}
{-# CONTENT_TYPE DAPP #-}
{-# SCRIPT_TYPE ACCOUNT #-}
@Callable(i)
func foo(question: String) = {
let callerAddress = toBase58String(i.caller.bytes)
...
}
Check the recipient’s address in the transfer transaction:
{-# STDLIB_VERSION 5 #-}
{-# CONTENT_TYPE EXPRESSION #-}
{-# SCRIPT_TYPE ACCOUNT #-}
# Bank dApp address
let BANK = base58'3MpFRn3X9ZqcLimFoqNeZwPBnwP7Br5Fmgs'
match (tx) {
case t: TransferTransaction => addressFromRecipient(t.recipient).bytes == BANK
case _ => false
}
Alias#
Structure of an alias.
Constructor
Alias(alias: String)
Fields
# |
Name |
Data type |
Description |
---|---|---|---|
\(1\) |
alias |
Example
let alias = Alias("merry")
addressFromRecipient(alias)
Asset#
Structure of a token. The structure is returned by the assetInfo built-in function.
Constructor
Asset(id: ByteVector, quantity: Int, decimals: Int, issuer: Address, issuerPublicKey: ByteVector, reissuable: Boolean, scripted: Boolean, minSponsoredFee: Int|Unit, name: String, description: String)
Fields
# |
Name |
Data type |
Description |
---|---|---|---|
\(1\) |
id |
||
\(2\) |
quantity |
Amount of issued token, multiplied by \(10^{decimals}\). Up to \(9 223 372 036 854 775 806\). |
|
\(3\) |
decimals |
Number of decimal places, \(0\) to \(8\). |
|
\(4\) |
issuer |
||
\(5\) |
issuerPublicKey |
Public key of the account that issued a token. |
|
\(6\) |
reissuable |
true — token can be reissued, false — cannot be reissued. |
|
\(7\) |
scripted |
true — smart asset, false — regular token. |
|
\(8\) |
minSponsoredFee |
Amount of asset that is equivalent to \(0.001\) DecentralCoins (\(100,000\) Decentralites), specified in the minimum fraction (“cents”) of asset. See the Sponsored fee article. unit: sponsorship is disabled. |
|
\(9\) |
name |
Token name, up to \(16\) characters. |
|
\(10\) |
description |
Token description, up to \(1000\) characters. |
Example
Get the account balance in a given asset:
let address=base58'3Mw48B85LvkBUhhDDmUvLhF9koAzfsPekDb'
let assetId=base58'GpxmxorKXLz1V7xootrvGyFgqP2tTTBib5HEm8QGZTHX'
assetBalance(Address(address), assetId)
AssetPair#
Structure of a pair of tokens of an order within the Order structure.
Constructor
AssetPair(amountAsset: ByteVector|Unit, priceAsset: ByteVector|Unit)
Fields
# |
Name |
Data type |
Description |
---|---|---|---|
\(1\) |
amountAsset |
The first token of a pair. |
|
\(2\) |
priceAsset |
The second token of a pair. |
Example
Get the account balance in a given asset:
let address=base58'3Mw48B85LvkBUhhDDmUvLhF9koAzfsPekDb'
let assetId=base58'GpxmxorKXLz1V7xootrvGyFgqP2tTTBib5HEm8QGZTHX'
assetBalance(Address(address), assetId)
AttachedPayment#
Structure of a payment attached to the script invocation and available to the callable function. The structure is used in:
Invocation structure.
InvokeScriptTransaction structure.
Invoke and reentrantInvoke functions.
Constructor
AttachedPayment(assetId: ByteVector|Unit, amount: Int)
Fields
# |
Name |
Data type |
Description |
---|---|---|---|
\(1\) |
assetId |
ID of a token. |
|
\(2\) |
amount |
Payment amount. |
BalanceDetails#
Structure that contains DecentralCoins balances of account. The structure is returned by the decentralchainBalance built-in function. For description of balance types, see the account balance article.
Constructor
BalanceDetails(available: Int, regular: Int, generating: Int, effective: Int)
Fields
# |
Name |
Data type |
Description |
---|---|---|---|
\(1\) |
available |
Available balance. |
|
\(2\) |
regular |
Regular balance. |
|
\(3\) |
generating |
Generating balance. |
|
\(4\) |
effective |
Effective balance. |
All balances are given in Decentralites.
BlockInfo#
Structure containing block headers. The structure is returned by the blockInfoByHeight built-in function.
Constructor
BlockInfo(timestamp: Int, height: Int, baseTarget: Int, generationSignature: ByteVector, generator: Address, generatorPublicKey: ByteVector, vrf: ByteVector|Unit)
Fields
# |
Name |
Data type |
Description |
---|---|---|---|
\(1\) |
timestamp |
||
\(2\) |
height |
||
\(3\) |
baseTarget |
||
\(4\) |
generationSignature |
||
\(5\) |
generator |
||
\(6\) |
generatorPublicKey |
Public key of the account that created a block. |
|
\(7\) |
vrf |
VRF for block version 5, unit otherwise. |
Invocation#
Structure that contains the fields of the script invocation that the callable function can use.
Constructor
Invocation(caller: Address, callerPublicKey: ByteVector, originCaller: Address, originCallerPublicKey: ByteVector, payments: List[AttachedPayment], transactionId: ByteVector, fee: Int, feeAssetId: ByteVector|Unit)
Fields
The field values depend on how the callable function is invoked. If the callable function is invoked by an invoke script transaction:
# |
Name |
Data type |
Description |
---|---|---|---|
\(1\) |
caller |
address of the account that sent the invoke script transaction. |
|
\(2\) |
callerPublicKey |
Public key of the account that sent the invoke script transaction. |
|
\(3\) |
originCaller |
Address |
Duplicates the caller field. |
\(4\) |
originCallerPublicKey |
Duplicates the callerPublicKey field. |
|
\(5\) |
payments |
Payments indicated in the invoke script transaction. |
|
\(6\) |
transactionId |
ID of the invoke script transaction. |
|
\(7\) |
fee |
||
\(8\) |
feeAssetId |
ID of the fee token. |
If the callable function is invoked by the invoke or reentrantInvoke function (see the dApp-to-dApp invocation article):
# |
Name |
Data type |
Description |
---|---|---|---|
\(1\) |
caller |
address of the dApp that invokes the callable function. |
|
\(2\) |
callerPublicKey |
Public key of the dApp that invokes the callable function. |
|
\(3\) |
originCaller |
Address |
Address of the account that sent the Invoke Script transaction. |
\(4\) |
originCallerPublicKey |
Public key of the account that sent the Invoke Script transaction. |
|
\(5\) |
payments |
Payments indicated in the invoke or reentrantInvoke function. |
|
\(6\) |
transactionId |
ID of the Invoke Script transaction. |
|
\(7\) |
fee |
||
\(8\) |
feeAssetId |
ID of the fee token. |
The originCaller, originCallerPublicKey, transactionId, fee, and feeAssetId values are the same for all dApp-to-dApp invocations within a single Invoke Script transaction.
Example
The following function checks that the first payment in the Invoke Script transaction is at least 1 DecentralCoin or 5 in the specified asset.
{-# STDLIB_VERSION 5 #-}
{-# CONTENT_TYPE DAPP #-}
{-# SCRIPT_TYPE ACCOUNT #-}
func isPaymentOk(i: Invocation) = {
let acceptableAssetId = base58'3JmaWyFqWo8YSA8x3DXCBUW7veesxacvKx19dMv7wTMg'
if (size(i.payments) == 0) then {
throw("Payment not attached")
} else {
let p = i.payments[0]
match p.assetId {
case assetId: ByteVector => assetId == acceptableAssetId && p.amount >= 500000000
case _ => p.amount >= 100000000
}
}
}
@Callable(i)
func foo() = {
if isPaymentOk(i) then ([],unit) else throw("Wrong payment amount or asset")
}
Order#
Structure of an order dApp-to-dApp invocation. The structure is used:
When checking an outgoing order by the account script or the verifier function of the dApp script.
In the InvokeScriptTransaction structure.
Constructor
Order(id: ByteVector, matcherPublicKey: ByteVector, assetPair: AssetPair, orderType: Buy|Sell, price: Int, amount: Int, timestamp: Int, expiration: Int, matcherFee: Int, matcherFeeAssetId: ByteVector|Unit, sender: Address, senderPublicKey: ByteVector, bodyBytes: ByteVector, proofs: List[ByteVector])
Fields
# |
Name |
Data type |
Description |
---|---|---|---|
\(1\) |
id |
ID of an order. |
|
\(2\) |
matcherPublicKey |
Public key of a matcher. |
|
\(3\) |
assetPair |
Pair of tokens. |
|
\(4\) |
orderType |
Buy|Sell |
Type of an order — selling or buying. |
\(5\) |
price |
Price of a token to exchange. |
|
\(6\) |
amount |
Number of tokens to exchange. |
|
\(7\) |
timestamp |
Unix time of the validation of an order by a matcher. |
|
\(8\) |
expiration |
Unix time when an uncompleted order will be cancelled. |
|
\(9\) |
matcherFee |
||
\(10\) |
matcherFeeAssetId |
Token of a transaction fee. It can only be DecentralCoins. |
|
\(11\) |
sender |
address of the sender of an order. |
|
\(12\) |
senderPublicKey |
Public key of the sender of an order. |
|
\(13\) |
bodyBytes |
Array of bytes of an order. |
|
\(14\) |
proofs |
Array of proofs. |
Example
The script below enables buying from a sender’s account:
Only the specified asset.
Only at a given price.
Only for DecentralCoins.
{-# STDLIB_VERSION 5 #-}
{-# CONTENT_TYPE EXPRESSION #-}
{-# SCRIPT_TYPE ACCOUNT #-}
let myAssetId = base58'8LLpj6yQLUu37KUt3rVo1S69j2gWMbgbM6qqgt2ac1Vb'
match tx {
case o: Order =>
let isDecentralChainPriceAsset = !isDefined(o.assetPair.priceAsset)
let rightPair = (o.assetPair.amountAsset == myAssetId) && isDecentralChainPriceAsset
sigVerify(o.bodyBytes, o.proofs[0], o.senderPublicKey)
&& rightPair
&& o.price == 500000
&& o.orderType == Buy
case _ => false
}
Transfer#
Structure of a single transfer within the MassTransferTransaction structure.
Constructor
Transfer(recipient: Address|Alias, amount: Int)
Fields
# |
Name |
Data type |
Description |
---|---|---|---|
\(1\) |
recipient |
address of a recipient of tokens. |
|
\(2\) |
amount |
Number of tokens. |
Transaction Structures#
Tokenization#
Transaction type ID |
Name |
Description |
---|---|---|
\(3\) |
Structure of issue transaction. |
|
\(5\) |
Structure of reissue transaction. |
|
\(6\) |
Structure of burn transaction. |
|
\(15\) |
Structure of set asset script transaction. |
|
\(17\) |
Structure of update asset info transaction. |
IssueTransaction#
Structure of an issue transaction.
Constructor
IssueTransaction(quantity: Int, name: String, description: String, reissuable: Boolean, decimals: Int, script: ByteVector|Unit, id: ByteVector, fee: Int, timestamp: Int, version: Int, sender: Address, senderPublicKey: ByteVector, bodyBytes: ByteVector, proofs: List[ByteVector])
Fields
# |
Name |
Data type |
Description |
---|---|---|---|
\(1\) |
quantity |
Amount of the token. |
|
\(2\) |
name |
Token name. |
|
\(3\) |
description |
Token description. |
|
\(4\) |
reissuable |
Reissue ability flag. |
|
\(5\) |
decimals |
Number of digits in decimal part. |
|
\(6\) |
script |
Script that must be set for the generated token. |
|
\(7\) |
id |
Transaction ID. |
|
\(8\) |
fee |
||
\(9\) |
timestamp |
Transaction timestamp. |
|
\(10\) |
version |
Transaction version. |
|
\(11\) |
sender |
address of the transaction sender. |
|
\(12\) |
senderPublicKey |
Account public key of the transaction sender. |
|
\(13\) |
bodyBytes |
Transaction body bytes. |
|
\(14\) |
proofs |
Array of proofs. |
ReissueTransaction#
Structure of a reissue transaction.
Constructor
ReissueTransaction(quantity: Int, assetId: ByteVector, reissuable: Boolean, id: ByteVector, fee: Int, timestamp: Int, version: Int, sender: Address, senderPublicKey: ByteVector, bodyBytes: ByteVector, proofs: List[ByteVector])
Fields
# |
Name |
Data type |
Description |
---|---|---|---|
\(1\) |
quantity |
Amount of the token. |
|
\(2\) |
assetId |
||
\(3\) |
reissuable |
Reissue flag. |
|
\(4\) |
id |
Transaction ID. |
|
\(5\) |
fee |
||
\(6\) |
timestamp |
Transaction timestamp. |
|
\(7\) |
version |
Transaction version. |
|
\(8\) |
sender |
address of the transaction sender. |
|
\(9\) |
senderPublicKey |
Public key of the transaction sender. |
|
\(10\) |
bodyBytes |
Transaction body bytes. |
|
\(11\) |
proofs |
Proofs. |
BurnTransaction#
Structure of an burn transaction.
Constructor
BurnTransaction(quantity: Int, assetId: ByteVector, id: ByteVector, fee: Int, timestamp: Int, version: Int, sender: Address, senderPublicKey: ByteVector, bodyBytes: ByteVector, proofs: List[ByteVector])
Fields
# |
Name |
Data type |
Description |
---|---|---|---|
\(1\) |
quantity |
Amount of the token to burn. |
|
\(2\) |
assetId |
ID of the token to burn. |
|
\(3\) |
id |
Transaction ID. |
|
\(4\) |
fee |
||
\(5\) |
timestamp |
Transaction timestamp. |
|
\(6\) |
version |
Transaction version. |
|
\(7\) |
sender |
address of the transaction sender. |
|
\(8\) |
senderPublicKey |
Public key of the transaction sender. |
|
\(9\) |
bodyBytes |
Transaction body bytes. |
|
\(10\) |
proofs |
Array of proofs. |
SetAssetScriptTransaction#
Structure of an set asset script transaction.
Constructor
SetAssetScriptTransaction(script: ByteVector|Unit, assetId: ByteVector, id: ByteVector, fee: Int, timestamp: Int, version: Int, sender: Address, senderPublicKey: ByteVector, bodyBytes: ByteVector, proofs: List[ByteVector])
Fields
# |
Name |
Data type |
Description |
---|---|---|---|
\(1\) |
script |
||
\(2\) |
assetId |
||
\(3\) |
id |
Transaction ID. |
|
\(4\) |
fee |
||
\(5\) |
timestamp |
Transaction timestamp. |
|
\(6\) |
version |
Transaction version. |
|
\(7\) |
sender |
address of the transaction sender. |
|
\(8\) |
senderPublicKey |
Public key of the transaction sender. |
|
\(9\) |
bodyBytes |
Transaction body bytes. |
|
\(10\) |
proofs |
Proofs. |
UpdateAssetInfoTransaction#
Structure of an update asset info transaction.
Constructor
UpdateAssetInfoTransaction(name: String, assetId: ByteVector, description: String, id: ByteVector, fee: Int, timestamp: Int, version: Int, sender: Address, senderPublicKey: ByteVector, bodyBytes: ByteVector, proofs: List[ByteVector])
Fields
# |
Name |
Data type |
Description |
---|---|---|---|
\(1\) |
name |
Name of the token. |
|
\(2\) |
assetId |
||
\(3\) |
description |
Description of the token. |
|
\(4\) |
id |
Transaction ID. |
|
\(5\) |
fee |
||
\(6\) |
timestamp |
Transaction timestamp. |
|
\(7\) |
version |
Transaction version. |
|
\(8\) |
sender |
Address |
Address of a transaction sender. |
\(9\) |
senderPublicKey |
Account public key of a sender. |
|
\(10\) |
bodyBytes |
Transaction body bytes. |
|
\(11\) |
proofs |
Array of proofs. |
Usage#
Transaction type ID |
Name |
Description |
---|---|---|
\(4\) |
Structure of transfer transaction. |
|
\(7\) |
Structure of exchange transaction. |
|
\(10\) |
Structure of create alias transaction. |
|
\(11\) |
Structure of mass transfer transaction. |
|
\(12\) |
Structure of data transaction. |
|
\(13\) |
Structure of set script transaction. |
|
\(16\) |
Structure of invoke script transaction. |
TransferTransaction#
Structure of an transfer transaction.
Constructor
TransferTransaction(feeAssetId: ByteVector|Unit, amount: Int, assetId: ByteVector|Unit, recipient: Address|Alias, attachment: ByteVector, id: ByteVector, fee: Int, timestamp: Int, version: Int, sender: Address, senderPublicKey: ByteVector, bodyBytes: ByteVector, proofs: List[ByteVector])
Fields
# |
Name |
Data type |
Description |
---|---|---|---|
\(1\) |
feeAssetId |
Token to pay the commission. |
|
\(2\) |
amount |
Amount of tokens to transfer. |
|
\(3\) |
assetId |
ID of a token. |
|
\(4\) |
recipient |
Address or alias of the recipient. |
|
\(5\) |
attachment |
Arbitrary data attached to transfer. The maximum data size is \(140\) bytes. |
|
\(6\) |
id |
Transaction ID. |
|
\(7\) |
fee |
||
\(8\) |
timestamp |
Transaction timestamp. |
|
\(9\) |
version |
Transaction version. |
|
\(10\) |
sender |
address of a transaction sender. |
|
\(11\) |
senderPublicKey |
Account public key of a sender. |
|
\(12\) |
bodyBytes |
Transaction body bytes. |
|
\(13\) |
proofs |
Array of proofs. |
ExchangeTransaction#
Structure of an exchange transaction.
Constructor
ExchangeTransaction(buyOrder: Order, sellOrder: Order, price: Int, amount: Int, buyMatcherFee: Int, sellMatcherFee: Int, id: ByteVector, fee: Int, timestamp: Int, version: Int, sender: Address, senderPublicKey: ByteVector, bodyBytes: ByteVector, proofs: List[ByteVector])
Fields
# |
Name |
Data type |
Description |
---|---|---|---|
\(1\) |
buyOrder |
Order |
Token purchase order. |
\(2\) |
sellOrder |
Order |
Token sell order. |
\(3\) |
price |
Price of exchanging token. |
|
\(4\) |
amount |
Amount of exchanging tokens. |
|
\(5\) |
buyMatcherFee |
Matcher’s purchase fee. |
|
\(6\) |
sellMatcherFee |
Matcher’s sell fee. |
|
\(7\) |
id |
Transaction ID. |
|
\(8\) |
fee |
||
\(9\) |
timestamp |
Transaction timestamp. |
|
\(10\) |
version |
Transaction version. |
|
\(11\) |
sender |
address of a transaction sender. |
|
\(12\) |
senderPublicKey |
Account public key of a sender. |
|
\(13\) |
bodyBytes |
Transaction body bytes. |
|
\(14\) |
proofs |
Array of proofs. |
CreateAliasTransaction#
Structure of a create alias transaction.
Constructor
CreateAliasTransaction(alias: String, id: ByteVector, fee: Int, timestamp: Int, version: Int, sender: Address, senderPublicKey: ByteVector, bodyBytes: ByteVector, proofs: List[ByteVector])
Fields
# |
Name |
Data type |
Description |
---|---|---|---|
\(1\) |
alias |
||
\(3\) |
id |
Transaction ID. |
|
\(4\) |
fee |
||
\(5\) |
timestamp |
Transaction timestamp. |
|
\(6\) |
version |
Transaction version. |
|
\(7\) |
sender |
address of the transaction sender. |
|
\(8\) |
senderPublicKey |
Public key of the transaction sender. |
|
\(9\) |
bodyBytes |
Transaction body bytes. |
|
\(10\) |
proofs |
Array of proofs. |
MassTransferTransaction#
Structure of a mass transfer transaction.
Constructor
MassTransferTransaction(assetId: ByteVector|Unit, totalAmount: Int, transfers: List[Transfer], transferCount: Int, attachment: ByteVector, id: ByteVector, fee: Int, timestamp: Int, version: Int, sender: Address, senderPublicKey: ByteVector, bodyBytes: ByteVector, proofs: List[ByteVector])
Fields
# |
Name |
Data type |
Description |
---|---|---|---|
\(1\) |
assetId |
||
\(2\) |
totalAmount |
Amount of the token to be transferred. |
|
\(3\) |
transfers |
Transfers. |
|
\(4\) |
transferCount |
Number of transfers. |
|
\(5\) |
attachment |
Optional data attached to the transaction. This field is often used to attach a comment to the transaction. The maximum data size is \(140\) bytes. |
|
\(6\) |
id |
Transaction ID. |
|
\(7\) |
fee |
||
\(8\) |
timestamp |
Transaction timestamp. |
|
\(9\) |
version |
Transaction version. |
|
\(10\) |
sender |
address of the transaction sender. |
|
\(11\) |
senderPublicKey |
Public key of the transaction sender. |
|
\(12\) |
bodyBytes |
Transaction body bytes. |
|
\(13\) |
proofs |
Proofs. |
DataTransaction#
Structure of a data transaction.
Constructor
DataTransaction(data: List[BinaryEntry|BooleanEntry|DeleteEntry|IntegerEntry|StringEntry], id: ByteVector, fee: Int, timestamp: Int, version: Int, sender: Address, senderPublicKey: ByteVector, bodyBytes: ByteVector, proofs: List[ByteVector])
Fields
# |
Name |
Data type |
Description |
---|---|---|---|
\(1\) |
data |
List [BinaryEntry | BooleanEntry | DeleteEntry | IntegerEntry | StringEntry] |
Transaction’s data array. |
\(2\) |
id |
Transaction ID. |
|
\(3\) |
fee |
||
\(4\) |
timestamp |
Transaction timestamp. |
|
\(5\) |
version |
Transaction version. |
|
\(6\) |
sender |
address of a transaction sender. |
|
\(7\) |
senderPublicKey |
Account public key of a sender. |
|
\(8\) |
bodyBytes |
Transaction body bytes. |
|
\(9\) |
proofs |
Array of proofs. |
SetScriptTransaction#
Structure of a set script transaction.
Constructor
SetScriptTransaction(script: ByteVector|Unit, id: ByteVector, fee: Int, timestamp: Int, version: Int, sender: Address, senderPublicKey: ByteVector, bodyBytes: ByteVector, proofs: List[ByteVector])
Fields
# |
Name |
Data type |
Description |
---|---|---|---|
\(1\) |
script |
||
\(2\) |
id |
Transaction ID. |
|
\(3\) |
fee |
||
\(4\) |
timestamp |
Transaction timestamp. |
|
\(5\) |
version |
Transaction version. |
|
\(6\) |
sender |
address of the transaction sender. |
|
\(7\) |
senderPublicKey |
Public key of the transaction sender. |
|
\(8\) |
bodyBytes |
Transaction body bytes. |
|
\(9\) |
proofs |
Proofs. |
InvokeScriptTransaction#
Structure of an invoke script transaction.
Constructor
InvokeScriptTransaction(dApp: Address|Alias, payments: List[AttachedPayments], feeAssetId: ByteVector|Unit, function: String, args: List[Boolean|ByteVector|Int|String|List[Boolean|ByteVector|Int|String]], id: ByteVector, fee: Int, timestamp: Int, version: Int, sender: Address, senderPublicKey: ByteVector, bodyBytes: ByteVector, proofs: List[ByteVector])
Fields
# |
Name |
Data type |
Description |
---|---|---|---|
\(1\) |
dApp |
address or alias of the account which is calling a function. |
|
\(2\) |
payments |
Payments attached to the transaction. |
|
\(3\) |
feeAssetId |
token to pay the commission. |
|
\(4\) |
function |
Name of the callable function. |
|
\(5\) |
args |
List [Boolean | ByteVector | Int | String | List [Boolean | ByteVector | Int | String]] |
Parameters of the callable function. |
\(6\) |
id |
Transaction ID. |
|
\(7\) |
fee |
||
\(8\) |
timestamp |
Transaction timestamp. |
|
\(9\) |
version |
Transaction version. |
|
\(10\) |
sender |
address of the transaction sender. |
|
\(11\) |
senderPublicKey |
Account public key of the transaction sender. |
|
\(12\) |
bodyBytes |
Transaction body bytes. |
|
\(13\) |
proofs |
Array of proofs. |
Network#
Transaction type ID |
Name |
Description |
---|---|---|
\(8\) |
Structure of lease transaction. |
|
\(9\) |
Structure of lease cancel transaction. |
|
\(14\) |
Structure of sponsor fee transaction. |
LeaseTransaction#
Structure of a lease transaction.
Constructor
LeaseTransaction(amount: Int, recipient: Address|Alias, id: ByteVector, fee: Int, timestamp: Int, version: Int, sender: Address, senderPublicKey: ByteVector, bodyBytes: ByteVector, proofs: List[ByteVector])
Fields
# |
Name |
Data type |
Description |
---|---|---|---|
\(1\) |
amount |
Amount of the token to lease. |
|
\(2\) |
recipient |
||
\(3\) |
id |
Transaction ID. |
|
\(4\) |
fee |
||
\(5\) |
timestamp |
Transaction timestamp. |
|
\(6\) |
version |
Transaction version. |
|
\(7\) |
sender |
address of a transaction sender. |
|
\(8\) |
senderPublicKey |
Account public key of a sender. |
|
\(9\) |
bodyBytes |
Transaction body bytes. |
|
\(10\) |
proofs |
Array of proofs. |
LeaseCancelTransaction#
Structure of a lease cancel transaction.
Constructor
LeaseCancelTransaction(leaseId: ByteVector, id: ByteVector, fee: Int, timestamp: Int, version: Int, sender: Address, senderPublicKey: ByteVector, bodyBytes: ByteVector, proofs: List[ByteVector])
Fields
# |
Name |
Data type |
Description |
---|---|---|---|
\(1\) |
leaseId |
Leasing ID. |
|
\(2\) |
id |
Transaction ID. |
|
\(3\) |
fee |
||
\(4\) |
timestamp |
Transaction timestamp. |
|
\(5\) |
version |
Transaction version. |
|
\(6\) |
sender |
address of the transaction sender. |
|
\(7\) |
senderPublicKey |
Public key of the transaction sender. |
|
\(8\) |
bodyBytes |
Transaction body bytes. |
|
\(9\) |
proofs |
Proofs. |
SponsorFeeTransaction#
Structure of a sponsor fee transaction.
Constructor
SponsorFeeTransaction(assetId: ByteVector, minSponsoredAssetFee: Int|Unit, id: ByteVector, fee: Int, timestamp: Int, version: Int, sender: Address, senderPublicKey: ByteVector, bodyBytes: ByteVector, proofs: List[ByteVector])
Fields
# |
Name |
Data type |
Description |
---|---|---|---|
\(1\) |
assetId |
||
\(2\) |
minSponsoredAssetFee |
Amount of asset that is equivalent to 0.001 DecentralCoins (100,000 Decentralites): an integer value specified in atomic units. unit – disable sponsorship. |
|
\(3\) |
id |
Transaction ID. |
|
\(4\) |
fee |
||
\(5\) |
timestamp |
Transaction timestamp. |
|
\(6\) |
version |
Transaction version. |
|
\(7\) |
sender |
address of the transaction sender. |
|
\(8\) |
senderPublicKey |
Public key of the transaction sender. |
|
\(9\) |
bodyBytes |
Transaction body bytes. |
|
\(10\) |
proofs |
Proofs. |
Genesis#
Transaction type ID |
Name |
Description |
---|---|---|
\(1\) |
Structure of genesis transaction. |
GenesisTransaction#
Structure of a genesis transaction.
Constructor
GenesisTransaction(amount: Int, recipient: Address|Alias, id: ByteVector, fee: Int, timestamp: Int, version: Int)
Fields
# |
Name |
Data type |
Description |
---|---|---|---|
\(1\) |
amount |
Amount of the token. |
|
\(2\) |
recipient |
||
\(3\) |
id |
Transaction ID. |
|
\(4\) |
fee |
||
\(5\) |
timestamp |
Transaction timestamp. |
|
\(6\) |
version |
Transaction version. |