-
Notifications
You must be signed in to change notification settings - Fork 3
API Methods
-
API Methods
- connect
- disconnect
- isConnected
- getServerInfo
- getFee
- getLedgerVersion
- getTransaction
- getTransactions
- getTrustlines
- getBalances
- getBalanceSheet
- getPaths
- getOrders
- getOrderbook
- getSettings
- getAccountInfo
- getAccountByName
- getAccountIssues
- getAccountInvoices
- getPaymentChannel
- getLedger
- prepareIssueSet
- preparePayment
- prepareTrustline
- prepareOrder
- prepareOrderCancellation
- prepareSettings
- prepareEscrowCreation
- prepareEscrowCancellation
- prepareEscrowExecution
- preparePaymentChannelCreate
- preparePaymentChannelClaim
- preparePaymentChannelFund
- prepareCheckCreate
- prepareCheckCancel
- prepareCheckCash
- sign
- combine
- submit
- generateAddress
- signPaymentChannelClaim
- verifyPaymentChannelClaim
- computeLedgerHash
connect(): Promise<void>
Tells the CallAPI instance to connect to its calld server.
This method has no parameters.
This method returns a promise that resolves with a void value when a connection is established.
See Boilerplate for code sample.
disconnect(): Promise<void>
Tells the CallAPI instance to disconnect from its calld server.
This method has no parameters.
This method returns a promise that resolves with a void value when a connection is destroyed.
See Boilerplate for code sample
isConnected(): boolean
Checks if the CallAPI instance is connected to its calld server.
This method has no parameters.
This method returns true
if connected and false
if not connected.
return api.isConnected();
true
getServerInfo(): Promise<object>
Get status information about the server that the CallAPI instance is connected to.
This method has no parameters.
This method returns a promise that resolves with an object with the following structure:
Name | Type | Description |
---|---|---|
buildVersion | string | The version number of the running call version. |
completeLedgers | string | Range expression indicating the sequence numbers of the ledger versions the local calld has in its database. It is possible to be a disjoint sequence, e.g. “2500-5000,32570-7695432”. |
hostID | string | On an admin request, returns the hostname of the server running the calld instance; otherwise, returns a unique four letter word. |
ioLatencyMs | number | Amount of time spent waiting for I/O operations to be performed, in milliseconds. If this number is not very, very low, then the calld server is probably having serious load issues. |
lastClose | object | Information about the last time the server closed a ledger. |
lastClose. convergeTimeS | number | The time it took to reach a consensus for the last ledger closing, in seconds. |
lastClose. proposers | integer | Number of trusted validators participating in the ledger closing. |
loadFactor | number | The load factor the server is currently enforcing, as a multiplier on the base transaction fee. The load factor is determined by the highest of the individual server’s load factor, cluster’s load factor, and the overall network’s load factor. |
peers | integer | How many other calld servers the node is currently connected to. |
pubkeyNode | string | Public key used to verify this node for internal communications; this key is automatically generated by the server the first time it starts up. (If deleted, the node can just create a new pair of keys.) |
serverState | string | A string indicating to what extent the server is participating in the network. See Possible Server States for more details. |
validatedLedger | object | Information about the fully-validated ledger with the highest sequence number (the most recent). |
validatedLedger. age | integer | The time since the ledger was closed, in seconds. |
validatedLedger. baseFeeCALL | value | Base fee, in CALL. This may be represented in scientific notation such as 1e-05 for 0.00005. |
validatedLedger. hash | string | Unique hash for the ledger, as an uppercase hexadecimal string. |
validatedLedger. reserveBaseCALL | value | Minimum amount of CALL necessary for every account to keep in reserve. |
validatedLedger. reserveIncrementCALL | value | Amount of CALL added to the account reserve for each object an account is responsible for in the ledger. |
validatedLedger. ledgerVersion | integer | Identifying sequence number of this ledger version. |
validationQuorum | number | Minimum number of trusted validations required in order to validate a ledger version. Some circumstances may cause the server to require more validations. |
load | object | Optional (Admin only) Detailed information about the current load state of the server. |
load. jobTypes | array<object> | (Admin only) Information about the rate of different types of jobs being performed by the server and how much time it spends on each. |
load. threads | number | (Admin only) The number of threads in the server’s main job pool, performing various Call Network operations. |
pubkeyValidator | string | Optional (Admin only) Public key used by this node to sign ledger validations. |
return api.getServerInfo().then(info => {/* ... */});
{
"buildVersion": "0.24.0-rc1",
"completeLedgers": "32570-6595042",
"hostID": "ARTS",
"ioLatencyMs": 1,
"lastClose": {
"convergeTimeS": 2.007,
"proposers": 4
},
"loadFactor": 1,
"peers": 53,
"pubkeyNode": "n94wWvFUmaKGYrKUGgpv1DyYgDeXRGdACkNQaSe7zJiy5Znio7UC",
"serverState": "full",
"validatedLedger": {
"age": 5,
"baseFeeCALL": "0.00001",
"hash": "4482DEE5362332F54A4036ED57EE1767C9F33CF7CE5A6670355C16CECE381D46",
"reserveBaseCALL": "1",
"reserveIncrementCALL": "1",
"ledgerVersion": 6595042
},
"validationQuorum": 3
}
getFee(): Promise<string>
Returns the estimated transaction fee for the calld server the CallAPI instance is connected to.
This method has no parameters.
This method returns a promise that resolves with a string encoded floating point value representing the estimated fee to submit a transaction, expressed in CALL.
return api.getFee().then(fee => {/* ... */});
"0.012"
getLedgerVersion(): Promise<number>
Returns the most recent validated ledger version number known to the connected server.
This method has no parameters.
This method returns a promise that resolves with a positive integer representing the most recent validated ledger version number known to the connected server.
return api.getLedgerVersion().then(ledgerVersion => {
/* ... */
});
16869039
getTransaction(id: string, options: Object): Promise<Object>
Retrieves a transaction by its Transaction ID.
Name | Type | Description |
---|---|---|
id | id | A hash of a transaction used to identify the transaction, represented in hexadecimal. |
options | object | Optional Options to limit the ledger versions to search. |
options. maxLedgerVersion | integer | Optional The highest ledger version to search |
options. minLedgerVersion | integer | Optional The lowest ledger version to search. |
This method returns a promise that resolves with a transaction object containing the following fields.
Name | Type | Description |
---|---|---|
id | id | A hash of the transaction that can be used to identify it. |
address | address | The address of the account that initiated the transaction. |
sequence | sequence | The account sequence number of the transaction for the account that initiated it. |
type | transactionType | The type of the transaction. |
specification | object | A specification that would produce the same outcome as this transaction. The structure of the specification depends on the value of the type field (see Transaction Types for details). Note: This is not necessarily the same as the original specification. |
outcome | object | The outcome of the transaction (what effects it had). |
outcome. result | string | Result code returned by calld. See Transaction Results for a complete list. |
outcome. fee | value | The CALL fee that was charged for the transaction. |
outcome.balanceChanges. * | array<balance> | Key is the call address; value is an array of signed amounts representing changes of balances for that address. |
outcome.orderbookChanges. * | array | Key is the maker's calld address; value is an array of changes |
outcome.orderbookChanges. *[] | object | A change to an order. |
outcome.orderbookChanges.*[]. direction | string | Equal to "buy" for buy orders and "sell" for sell orders. |
outcome.orderbookChanges.*[]. quantity | amount | The amount to be bought or sold by the maker. |
outcome.orderbookChanges.*[]. totalPrice | amount | The total amount to be paid or received by the taker. |
outcome.orderbookChanges.*[]. sequence | sequence | The order sequence number, used to identify the order for cancellation |
outcome.orderbookChanges.*[]. status | string | The status of the order. One of "created", "filled", "partially-filled", "cancelled". |
outcome.orderbookChanges.*[]. expirationTime | date-time string | Optional The time after which the order expires, if any. |
outcome.orderbookChanges.*[]. makerExchangeRate | value |
Optional The exchange rate between the quantity currency and the totalPrice currency from the point of view of the maker. |
outcome. ledgerVersion | integer | The ledger version that the transaction was validated in. |
outcome. indexInLedger | integer | The ordering index of the transaction in the ledger. |
outcome. deliveredAmount | amount | Optional For payment transactions, it is impossible to reliably compute the actual delivered amount from the balanceChanges due to fixed precision. If the payment is not a partial payment and the transaction succeeded, the deliveredAmount should always be considered to be the amount specified in the transaction. |
outcome. timestamp | date-time string | Optional The timestamp when the transaction was validated. (May be missing when requesting transactions in binary mode.) |
const id = '01CDEAA89BF99D97DFD47F79A0477E1DCC0989D39F70E8AACBFE68CC83BD1E94';
return api.getTransaction(id).then(transaction => {
/* ... */
});
{
"type": "payment",
"address": "cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M",
"sequence": 4,
"id": "F4AB442A6D4CBB935D66E1DA7309A5FC71C7143ED4049053EC14E3875B0CF9BF",
"specification": {
"source": {
"address": "cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M",
"maxAmount": {
"currency": "CALL",
"value": "1.112209"
}
},
"destination": {
"address": "cKYg3DSSRtdP7fZtgzGHZxh8qpyMgjtBdu",
"amount": {
"currency": "USD",
"value": "0.001"
}
},
"paths": "[[{\"currency\":\"USD\",\"issuer\":\"cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR\",\"type\":48,\"type_hex\":\"0000000000000030\"},{\"account\":\"cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR\",\"currency\":\"USD\",\"issuer\":\"cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR\",\"type\":49,\"type_hex\":\"0000000000000031\"}]]"
},
"outcome": {
"result": "tesSUCCESS",
"timestamp": "2013-03-12T23:56:50.000Z",
"fee": "0.00001",
"deliveredAmount": {
"currency": "USD",
"value": "0.001",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
},
"balanceChanges": {
"c3tR2FaCo3h3xyeVQtFsqfxy1AkAgx3A1i": [
{
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR",
"currency": "USD",
"value": "-0.001"
},
{
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR",
"currency": "USD",
"value": "0.001002"
}
],
"cwpBQrarDfgQ1BQz7yYSSX1G4SU9L1JEND": [
{
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR",
"currency": "USD",
"value": "0.001"
}
],
"cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M": [
{
"currency": "CALL",
"value": "-1.101208"
}
],
"cKYg3DSSRtdP7fZtgzGHZxh8qpyMgjtBdu": [
{
"currency": "CALL",
"value": "1.101198"
},
{
"counterparty": "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo",
"currency": "USD",
"value": "-0.001002"
}
]
},
"orderbookChanges": {
"cLuq1oba75hpLvr6mD7E7qbh3eRMR2wn71": [
{
"direction": "buy",
"quantity": {
"currency": "CALL",
"value": "1.101198"
},
"totalPrice": {
"currency": "USD",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR",
"value": "0.001002"
},
"makerExchangeRate": "1099",
"sequence": 58,
"status": "partially-filled"
}
]
},
"ledgerVersion": 348860,
"indexInLedger": 0
}
}
getTransactions(address: string, options: Object): Promise<Array<Object>>
Retrieves historical transactions of an account.
Name | Type | Description |
---|---|---|
address | address | The address of the account to get transactions for. |
options | object | Optional Options to filter the resulting transactions. |
options. binary | boolean | Optional If true, the transactions will be sent from the server in a condensed binary format rather than JSON. |
options. counterparty | address | Optional If provided, only return transactions with this account as a counterparty to the transaction. |
options. earliestFirst | boolean | Optional If true, sort transactions so that the earliest ones come first. By default, the newest transactions will come first. |
options. excludeFailures | boolean | Optional If true, the result will omit transactions that did not succeed. |
options. initiated | boolean |
Optional If true, return only transactions initiated by the account specified by address . If false, return only transactions not initiated by the account specified by address . |
options. limit | integer | Optional If specified, return at most this many transactions. |
options. maxLedgerVersion | integer | Optional Return only transactions in this ledger version or lower. |
options. minLedgerVersion | integer | Optional Return only transactions in this ledger verion or higher. |
options. start | string |
Optional If specified, this transaction will be the first transaction in the result. You cannot use start with minLedgerVersion or maxLedgerVersion . When start is specified, these ledger versions will be determined internally. |
options. types | array<TransactionType> | Optional Only return transactions of the specified Transaction Types. |
This method returns a promise that resolves with an array of transaction object in the same format as getTransaction.
const address = 'cKYg3DSSRtdP7fZtgzGHZxh8qpyMgjtBdu';
return api.getTransactions(address).then(transaction => {
/* ... */
});
[
{
"type": "payment",
"address": "cKYg3DSSRtdP7fZtgzGHZxh8qpyMgjtBdu",
"sequence": 4,
"id": "99404A34E8170319521223A6C604AF48B9F1E3000C377E6141F9A1BF60B0B865",
"specification": {
"memos": [
{
"type": "client",
"format": "rt1.5.2"
}
],
"source": {
"address": "cKYg3DSSRtdP7fZtgzGHZxh8qpyMgjtBdu",
"maxAmount": {
"currency": "CALL",
"value": "1.112209"
}
},
"destination": {
"address": "cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M",
"amount": {
"currency": "USD",
"value": "0.001"
}
},
"paths": "[[{\"issuer\":\"cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M\",\"currency\":\"USD\"},{\"account\":\"c3tR2FaCo3h3xyeVQtFsqfxy1AkAgx3A1i\",\"issuer\":\"cLuq1oba75hpLvr6mD7E7qbh3eRMR2wn71\",\"currency\":\"USD\"}]]"
},
"outcome": {
"result": "tesSUCCESS",
"fee": "0.00001",
"deliveredAmount": {
"currency": "USD",
"value": "0.001",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
},
"balanceChanges": {
"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo": [
{
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR",
"currency": "USD",
"value": "-0.001"
},
{
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR",
"currency": "USD",
"value": "0.001002"
}
],
"cnEuakn4SJtN5b2GBBAggAwLr7gxUpFKqk": [
{
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR",
"currency": "USD",
"value": "0.001"
}
],
"cHteR2P9NPoAk6PmZC4GP4CfKKTZw4XQS4": [
{
"currency": "CALL",
"value": "-1.101208"
}
],
"c3tR2FaCo3h3xyeVQtFsqfxy1AkAgx3A1i": [
{
"currency": "CALL",
"value": "1.101198"
},
{
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR",
"currency": "USD",
"value": "-0.001002"
}
]
},
"orderbookChanges": {
"cwdRbifxFTeB1dsBXgC124aFEVgrCzfeMa": [
{
"direction": "buy",
"quantity": {
"currency": "CALL",
"value": "1.101198"
},
"totalPrice": {
"currency": "USD",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR",
"value": "0.001002"
},
"makerExchangeRate": "1099",
"sequence": 58,
"status": "partially-filled"
}
]
},
"ledgerVersion": 348859,
"indexInLedger": 0
}
},
{
"type": "payment",
"address": "cnEuakn4SJtN5b2GBBAggAwLr7gxUpFKqk",
"id": "99404A34E8170319521223A6C604AF48B9F1E3000C377E6141F9A1BF60B0B865",
"sequence": 4,
"specification": {
"memos": [
{
"type": "client",
"format": "rt1.5.2"
}
],
"source": {
"address": "cHteR2P9NPoAk6PmZC4GP4CfKKTZw4XQS4",
"maxAmount": {
"currency": "CALL",
"value": "1.112209"
}
},
"destination": {
"address": "cwdRbifxFTeB1dsBXgC124aFEVgrCzfeMa",
"amount": {
"currency": "USD",
"value": "0.001"
}
},
"paths": "[[{\"issuer\":\"cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR\",\"currency\":\"USD\"},{\"account\":\"cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR\",\"issuer\":\"cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR\",\"currency\":\"USD\"}]]"
},
"outcome": {
"result": "tesSUCCESS",
"fee": "0.00001",
"deliveredAmount": {
"currency": "USD",
"value": "0.001",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
},
"balanceChanges": {
"cKYg3DSSRtdP7fZtgzGHZxh8qpyMgjtBdu": [
{
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR",
"currency": "USD",
"value": "-0.001"
},
{
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR",
"currency": "USD",
"value": "0.001002"
}
],
"cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M": [
{
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR",
"currency": "USD",
"value": "0.001"
}
],
"c4ur9JxmkbMpqAwGQfnAP3WDvA35rZPNKc": [
{
"currency": "CALL",
"value": "-1.101208"
}
],
"cP87PfWeQfnaGJytdgruybN6keB9oyGBrx": [
{
"currency": "CALL",
"value": "1.101198"
},
{
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR",
"currency": "USD",
"value": "-0.001002"
}
]
},
"orderbookChanges": {
"cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M": [
{
"direction": "buy",
"quantity": {
"currency": "CALL",
"value": "1.101198"
},
"totalPrice": {
"currency": "USD",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR",
"value": "0.001002"
},
"makerExchangeRate": "1099",
"sequence": 58,
"status": "partially-filled"
}
]
},
"ledgerVersion": 348858,
"indexInLedger": 0
}
}
]
getTrustlines(address: string, options: Object): Promise<Array<Object>>
Returns trustlines for a specified account.
Name | Type | Description |
---|---|---|
address | address | The address of the account to get trustlines for. |
options | object | Optional Options to filter and determine which trustlines to return. |
options. counterparty | address | Optional Only return trustlines with this counterparty. |
options. currency | currency | Optional Only return trustlines for this currency. |
options. ledgerVersion | integer | Optional Return trustlines as they were in this historical ledger version. |
options. limit | integer | Optional Return at most this many trustlines. |
This method returns a promise that resolves with an array of objects with the following structure.
Name | Type | Description |
---|---|---|
specification | trustline | A trustline specification that would produce this trustline in its current state. |
counterparty | object | Properties of the trustline from the perspective of the counterparty. |
counterparty. limit | value | The maximum amount that the counterparty can be owed through the trustline. |
counterparty. authorized | boolean | Optional If true, the counterparty authorizes this party to hold issuances from the counterparty. |
counterparty. frozen | boolean | Optional If true, the trustline is frozen, which means that funds can only be sent to the counterparty. |
counterparty. callingDisabled | boolean | Optional If true, payments cannot calld through this trustline. |
state | object | Properties of the trustline regarding it's current state that are not part of the specification. |
state. balance | signedValue | The balance on the trustline, representing which party owes the other and by how much. |
const address = 'r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59';
return api.getTrustlines(address).then(trustlines =>
{/* ... */});
[
{
"specification": {
"limit": "5",
"currency": "USD",
"counterparty": "cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M",
"callingDisabled": true,
"frozen": true
},
"counterparty": {
"limit": "0"
},
"state": {
"balance": "2.497605752725159"
}
},
{
"specification": {
"limit": "5000",
"currency": "USD",
"counterparty": "cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M"
},
"counterparty": {
"limit": "0"
},
"state": {
"balance": "0"
}
},
{
"specification": {
"limit": "1",
"currency": "USD",
"counterparty": "cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M"
},
"counterparty": {
"limit": "0"
},
"state": {
"balance": "1"
}
},
{
"specification": {
"limit": "1",
"currency": "USD",
"counterparty": "cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M",
"callingDisabled": true
},
"counterparty": {
"limit": "0"
},
"state": {
"balance": "0"
}
},
{
"specification": {
"limit": "500",
"currency": "USD",
"counterparty": "cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M",
"callingDisabled": true
},
"counterparty": {
"limit": "0"
},
"state": {
"balance": "35"
}
},
{
"specification": {
"limit": "0",
"currency": "USD",
"counterparty": "cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M"
},
"counterparty": {
"limit": "100",
"callingDisabled": true
},
"state": {
"balance": "0"
}
},
{
"specification": {
"limit": "0",
"currency": "USD",
"counterparty": "cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M",
"frozen": true
},
"counterparty": {
"limit": "1"
},
"state": {
"balance": "0"
}
}
]
getBalances(address: string, options: Object): Promise<Array<Object>>
Returns balances for a specified account.
Name | Type | Description |
---|---|---|
address | address | The address of the account to get balances for. |
options | object | Optional Options to filter and determine which balances to return. |
options. counterparty | address | Optional Only return balances with this counterparty. |
options. currency | currency | Optional Only return balances for this currency. |
options. ledgerVersion | integer | Optional Return balances as they were in this historical ledger version. |
options. limit | integer | Optional Return at most this many balances. |
This method returns a promise that resolves with an array of objects with the following structure:
Name | Type | Description |
---|---|---|
currency | currency | The three-character code or hexadecimal string used to denote currencies |
value | signedValue | The balance on the trustline |
counterparty | [address]https://github.com/callchain/call-lib/wiki/basic-types(#address) | Optional The Call address of the account that owes or is owed the funds. |
const address = 'cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M';
return api.getBalances(address).then(balances =>
{/* ... */});
[
{
"value": "922.913243",
"currency": "CALL"
},
{
"value": "0",
"currency": "ASP",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
},
{
"value": "0",
"currency": "XAU",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
},
{
"value": "2.497605752725159",
"currency": "USD",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
},
{
"value": "481.992867407479",
"currency": "MXN",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
},
{
"value": "0.793598266778297",
"currency": "EUR",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
},
{
"value": "0",
"currency": "CNY",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
},
{
"value": "1.294889190631542",
"currency": "DYM",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
},
{
"value": "0.3488146605801446",
"currency": "CHF",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
},
{
"value": "2.114103174931847",
"currency": "BTC",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
},
{
"value": "0",
"currency": "USD",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
},
{
"value": "-0.00111",
"currency": "BTC",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
},
{
"value": "-0.1010780000080207",
"currency": "BTC",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
},
{
"value": "1",
"currency": "USD",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
},
{
"value": "8.07619790068559",
"currency": "CNY",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
},
{
"value": "7.292695098901099",
"currency": "JPY",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
},
{
"value": "0",
"currency": "AUX",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
},
{
"value": "0",
"currency": "USD",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
},
{
"value": "12.41688780720394",
"currency": "EUR",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
},
{
"value": "35",
"currency": "USD",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
},
{
"value": "-5",
"currency": "JOE",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
},
{
"value": "0",
"currency": "USD",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
},
{
"value": "0",
"currency": "JOE",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
},
{
"value": "0",
"currency": "015841551A748AD2C1F76FF6ECB0CCCD00000000",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
},
{
"value": "0",
"currency": "USD",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
}
]
getBalanceSheet(address: string, options: Object): Promise<Object>
Returns aggregate balances by currency plus a breakdown of assets and obligations for a specified account.
Name | Type | Description |
---|---|---|
address | address | The Call address of the account to get the balance sheet of. |
options | object | Optional Options to determine how the balances will be calculated. |
options. excludeAddresses | array<address> | Optional Addresses to exclude from the balance totals. |
options. ledgerVersion | integer | Optional Get the balance sheet as of this historical ledger version. |
This method returns a promise that resolves with an object with the following structure:
Name | Type | Description |
---|---|---|
assets | array<amount> | Optional Total amounts held that are issued by others. For the recommended gateway configuration, there should be none. |
balances | array<amount> | Optional Amounts issued to the hotwallet accounts from the request. The keys are hot wallet addresses and the values are arrays of currency amounts they hold. The issuer (omitted from the currency amounts) is the account from the request. |
obligations | array | Optional Total amounts issued to accounts that are not hot wallets, as a map of currencies to the total value issued. |
obligations[] | object | An amount that is owed. |
obligations[]. currency | currency | The three-character code or hexadecimal string used to denote currencies |
obligations[]. value | value | A string representation of a non-negative floating point number |
const address = 'cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M';
return api.getBalanceSheet(address).then(balanceSheet =>
{/* ... */});
{
"balances": [
{
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR",
"currency": "EUR",
"value": "29826.1965999999"
},
{
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR",
"currency": "USD",
"value": "10.0"
},
{
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR",
"currency": "USD",
"value": "13857.70416"
}
],
"assets": [
{
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR",
"currency": "BTC",
"value": "5444166510000000e-26"
},
{
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR",
"currency": "USD",
"value": "100.0"
},
{
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR",
"currency": "BTC",
"value": "8700000000000000e-30"
}
],
"obligations": [
{
"currency": "BTC",
"value": "5908.324927635318"
},
{
"currency": "EUR",
"value": "992471.7419793958"
},
{
"currency": "GBP",
"value": "4991.38706013193"
},
{
"currency": "USD",
"value": "1997134.20229482"
}
]
}
getPaths(pathfind: Object): Promise<Array<Object>>
Finds paths to send a payment. Paths are options for how to route a payment.
Name | Type | Description |
---|---|---|
pathfind | object | Specification of a pathfind request. |
pathfind. source | object | Properties of the source of funds. |
pathfind.source. address | address | The Call address of the account where funds will come from. |
pathfind.source. amount | laxAmount | Optional The amount of funds to send. |
pathfind.source. currencies | array | Optional An array of currencies (with optional counterparty) that may be used in the payment paths. |
pathfind.source. currencies[] | object | A currency with optional counterparty. |
pathfind.source.currencies[]. currency | currency | The three-character code or hexadecimal string used to denote currencies |
pathfind.source.currencies[]. counterparty | address | Optional The counterparty for the currency; if omitted any counterparty may be used. |
pathfind. destination | object | Properties of the destination of funds. |
pathfind.destination. address | address | The address to send to. |
pathfind.destination. amount | laxLaxAmount | The amount to be received by the receiver (value may be ommitted if a source amount is specified). |
This method returns a promise that resolves with an array of objects with the following structure:
Name | Type | Description |
---|---|---|
source | object | Properties of the source of the payment. |
source. address | address | The address to send from. |
source. amount | laxAmount | An exact amount to send. If the counterparty is not specified, amounts with any counterparty may be used. (This field is exclusive with source.maxAmount) |
source. tag | integer | Optional An arbitrary unsigned 32-bit integer that identifies a reason for payment or a non-Call account. |
source. maxAmount | laxAmount | The maximum amount to send. (This field is exclusive with source.amount) |
destination | object | Properties of the destination of the payment. |
destination. address | address | The address to receive at. |
destination. amount | laxAmount | An exact amount to deliver to the recipient. If the counterparty is not specified, amounts with any counterparty may be used. (This field is exclusive with destination.minAmount). |
destination. tag | integer | Optional An arbitrary unsigned 32-bit integer that identifies a reason for payment or a non-Call account. |
destination. address | address | The address to send to. |
destination. minAmount | laxAmount | The minimum amount to be delivered. (This field is exclusive with destination.amount) |
paths | string | The paths of trustlines and orders to use in executing the payment. |
const pathfind = {
"source": {
"address": "cKYg3DSSRtdP7fZtgzGHZxh8qpyMgjtBdu"
},
"destination": {
"address": "cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M",
"amount": {
"currency": "USD",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR",
"value": "100"
}
}
};
return api.getPaths(pathfind)
.then(paths => {/* ... */});
[
{
"source": {
"address": "cKYg3DSSRtdP7fZtgzGHZxh8qpyMgjtBdu",
"maxAmount": {
"currency": "JPY",
"value": "0.1117218827811721"
}
},
"destination": {
"address": "cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M",
"amount": {
"currency": "USD",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR",
"value": "100"
}
},
"paths": "[[{\"account\":\"rMAz5ZnK73nyNUL4foAvaxdreczCkG3vA6\"},{\"currency\":\"USD\",\"issuer\":\"rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM\"},{\"account\":\"rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM\"}],[{\"account\":\"rMAz5ZnK73nyNUL4foAvaxdreczCkG3vA6\"},{\"currency\":\"CALL\"},{\"currency\":\"USD\",\"issuer\":\"rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM\"},{\"account\":\"rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM\"}],[{\"account\":\"rMAz5ZnK73nyNUL4foAvaxdreczCkG3vA6\"},{\"currency\":\"CALL\"},{\"currency\":\"USD\",\"issuer\":\"rpHgehzdpfWRXKvSv6duKvVuo1aZVimdaT\"},{\"account\":\"rpHgehzdpfWRXKvSv6duKvVuo1aZVimdaT\"},{\"account\":\"rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM\"}],[{\"account\":\"rMAz5ZnK73nyNUL4foAvaxdreczCkG3vA6\"},{\"currency\":\"CALL\"},{\"currency\":\"USD\",\"issuer\":\"rHHa9t2kLQyXRbdLkSzEgkzwf9unmFgZs9\"},{\"account\":\"rHHa9t2kLQyXRbdLkSzEgkzwf9unmFgZs9\"},{\"account\":\"rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM\"}]]"
},
{
"source": {
"address": "cKYg3DSSRtdP7fZtgzGHZxh8qpyMgjtBdu",
"maxAmount": {
"currency": "USD",
"value": "0.001002"
}
},
"destination": {
"address": "cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M",
"amount": {
"currency": "USD",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR",
"value": "100"
}
},
"paths": "[[{\"account\":\"cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR\"}],[{\"account\":\"cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR\"},{\"currency\":\"USD\",\"issuer\":\"cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR\"},{\"account\":\"cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR\"}],[{\"account\":\"cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR\"},{\"currency\":\"CALL\"},{\"currency\":\"USD\",\"issuer\":\"cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR\"},{\"account\":\"cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR\"}],[{\"account\":\"cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR\"},{\"currency\":\"CALL\"},{\"currency\":\"USD\",\"issuer\":\"cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR\"},{\"account\":\"cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR\"},{\"account\":\"cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR\"}]]"
},
{
"source": {
"address": "cKYg3DSSRtdP7fZtgzGHZxh8qpyMgjtBdu",
"maxAmount": {
"currency": "CALL",
"value": "0.207669"
}
},
"destination": {
"address": "cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M",
"amount": {
"currency": "USD",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR",
"value": "100"
}
},
"paths": "[[{\"currency\":\"USD\",\"issuer\":\"cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR\"},{\"account\":\"cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR\"}],[{\"currency\":\"USD\",\"issuer\":\"cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR\"},{\"account\":\"cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR\"},{\"account\":\"cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR\"},{\"account\":\"cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR\"}],[{\"currency\":\"USD\",\"issuer\":\"cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR\"},{\"account\":\"cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR\"},{\"account\":\"cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR\"},{\"account\":\"cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR\"}],[{\"currency\":\"USD\",\"issuer\":\"cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR\"},{\"account\":\"cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR\"},{\"account\":\"cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR\"}]]"
}
]
getOrders(address: string, options: Object): Promise<Array<Object>>
Returns open orders for the specified account. Open orders are orders that have not yet been fully executed and are still in the order book.
Name | Type | Description |
---|---|---|
address | address | The Call address of the account to get open orders for. |
options | object | Optional Options that determine what orders will be returned. |
options. ledgerVersion | integer | Optional Return orders as of this historical ledger version. |
options. limit | integer | Optional At most this many orders will be returned. |
This method returns a promise that resolves with an array of objects with the following structure:
Name | Type | Description |
---|---|---|
specification | order | An order specification that would create an order equivalent to the current state of this order. |
properties | object | Properties of the order not in the specification. |
properties. maker | address | The address of the account that submitted the order. |
properties. sequence | [sequence]https://github.com/callchain/call-lib/wiki/basic-types#account-sequence-number) | The account sequence number of the transaction that created this order. |
properties. makerExchangeRate | value | The exchange rate from the point of view of the account that submitted the order (also known as "quality"). |
const address = 'cKYg3DSSRtdP7fZtgzGHZxh8qpyMgjtBdu';
return api.getOrders(address).then(orders =>
{/* ... */});
[
{
"specification": {
"direction": "sell",
"quantity": {
"currency": "EUR",
"value": "17.70155237781915",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
},
"totalPrice": {
"currency": "USD",
"value": "1122.990930900328",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
}
},
"properties": {
"maker": "cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M",
"sequence": 719930,
"makerExchangeRate": "63.44025128030504"
}
},
{
"specification": {
"direction": "buy",
"quantity": {
"currency": "EUR",
"value": "750",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
},
"totalPrice": {
"currency": "USD",
"value": "19.11697137482289",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
}
},
"properties": {
"maker": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR",
"sequence": 756999,
"makerExchangeRate": "39.23215583132338"
}
},
{
"specification": {
"direction": "buy",
"quantity": {
"currency": "USD",
"value": "19.50899530491766",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
},
"totalPrice": {
"currency": "USD",
"value": "18.46856867857617",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
}
},
"properties": {
"maker": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR",
"sequence": 757002,
"makerExchangeRate": "1.056334989703257"
}
},
{
"specification": {
"direction": "buy",
"quantity": {
"currency": "USD",
"value": "1445.796633544794",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
},
"totalPrice": {
"currency": "USD",
"value": "14.40727807030772",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
}
},
"properties": {
"maker": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR",
"sequence": 757003,
"makerExchangeRate": "100.3518240218094"
}
},
{
"specification": {
"direction": "buy",
"quantity": {
"currency": "USD",
"value": "750",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
},
"totalPrice": {
"currency": "NZD",
"value": "9.178557969538755",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
}
},
"properties": {
"maker": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR",
"sequence": 782148,
"makerExchangeRate": "81.7121820757743"
}
},
{
"specification": {
"direction": "buy",
"quantity": {
"currency": "USD",
"value": "500",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
},
"totalPrice": {
"currency": "USD",
"value": "9.94768291869523",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
}
},
"properties": {
"maker": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR",
"sequence": 787368,
"makerExchangeRate": "50.26296114247091"
}
},
{
"specification": {
"direction": "buy",
"quantity": {
"currency": "USD",
"value": "10000",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
},
"totalPrice": {
"currency": "USD",
"value": "9.994805759894176",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
}
},
"properties": {
"maker": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR",
"sequence": 787408,
"makerExchangeRate": "1000.519693952099"
}
},
{
"specification": {
"direction": "buy",
"quantity": {
"currency": "MXN",
"value": "15834.53653918684",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
},
"totalPrice": {
"currency": "USD",
"value": "11.67691646304319",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
}
},
"properties": {
"maker": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR",
"sequence": 803438,
"makerExchangeRate": "1356.054621894598"
}
},
{
"specification": {
"direction": "buy",
"quantity": {
"currency": "USD",
"value": "3968.240250979598",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
},
"totalPrice": {
"currency": "XAU",
"value": "0.03206299605333101",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
}
},
"properties": {
"maker": "cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M",
"sequence": 807858,
"makerExchangeRate": "123763.8630020459"
}
},
{
"specification": {
"direction": "buy",
"quantity": {
"currency": "USD",
"value": "4139.022125516302",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
},
"totalPrice": {
"currency": "XAU",
"value": "0.03347459066593226",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
}
},
"properties": {
"maker": "cKYg3DSSRtdP7fZtgzGHZxh8qpyMgjtBdu",
"sequence": 807896,
"makerExchangeRate": "123646.6837435794"
}
},
{
"specification": {
"direction": "buy",
"quantity": {
"currency": "CALL",
"value": "115760.19"
},
"totalPrice": {
"currency": "NZD",
"value": "6.840555705",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
}
},
"properties": {
"maker": "cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M",
"sequence": 814018,
"makerExchangeRate": "16922.62953364839"
}
},
{
"specification": {
"direction": "buy",
"quantity": {
"currency": "USD",
"value": "902.4050961259154",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
},
"totalPrice": {
"currency": "EUR",
"value": "14.40843766044656",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
}
},
"properties": {
"maker": "cKYg3DSSRtdP7fZtgzGHZxh8qpyMgjtBdu",
"sequence": 827522,
"makerExchangeRate": "62.63032241192674"
}
},
{
"specification": {
"direction": "buy",
"quantity": {
"currency": "USD",
"value": "181.4887131319798",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
},
"totalPrice": {
"currency": "XAG",
"value": "1.128432823485989",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
}
},
"properties": {
"maker": "cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M",
"sequence": 833591,
"makerExchangeRate": "160.8325363767064"
}
},
{
"specification": {
"direction": "buy",
"quantity": {
"currency": "USD",
"value": "1814.887131319799",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
},
"totalPrice": {
"currency": "XAG",
"value": "1.128432823485991",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
}
},
"properties": {
"maker": "cKYg3DSSRtdP7fZtgzGHZxh8qpyMgjtBdu",
"sequence": 833592,
"makerExchangeRate": "1608.325363767062"
}
},
{
"specification": {
"direction": "buy",
"quantity": {
"currency": "USD",
"value": "118.6872603846736",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
},
"totalPrice": {
"currency": "XAG",
"value": "0.7283371225235964",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
}
},
"properties": {
"maker": "cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M",
"sequence": 838954,
"makerExchangeRate": "162.9564891233845"
}
},
{
"specification": {
"direction": "buy",
"quantity": {
"currency": "XAU",
"value": "1",
"counterparty": "cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M"
},
"totalPrice": {
"currency": "CALL",
"value": "2229.229447"
}
},
"properties": {
"maker": "c4ur9JxmkbMpqAwGQfnAP3WDvA35rZPNKc",
"sequence": 843730,
"makerExchangeRate": "0.0004485854972648762"
}
},
{
"specification": {
"direction": "buy",
"quantity": {
"currency": "EUR",
"value": "750",
"counterparty": "cP87PfWeQfnaGJytdgruybN6keB9oyGBrx"
},
"totalPrice": {
"currency": "USD",
"value": "17.77537376072202",
"counterparty": "cP87PfWeQfnaGJytdgruybN6keB9oyGBrx"
}
},
"properties": {
"maker": "cP87PfWeQfnaGJytdgruybN6keB9oyGBrx",
"sequence": 844068,
"makerExchangeRate": "42.19320561670911"
}
}
]
getOrderbook(address: string, orderbook: Object, options: Object): Promise<Object>
Returns open orders for the specified account. Open orders are orders that have not yet been fully executed and are still in the order book.
Name | Type | Description |
---|---|---|
address | address | Address of an account to use as point-of-view. (This affects which unfunded offers are returned.) |
orderbook | object | The order book to get. |
orderbook. base | object | A currency-counterparty pair, or just currency if it's CALL |
orderbook. counter | object | A currency-counterparty pair, or just currency if it's CALL |
options | object | Optional Options to determine what to return. |
options. ledgerVersion | integer | Optional Return the order book as of this historical ledger version. |
options. limit | integer | Optional Return at most this many orders from the order book. |
This method returns a promise that resolves with an object with the following structure (Note: the structures of bids
and asks
are identical):
Name | Type | Description |
---|---|---|
bids | array | The buy orders in the order book. |
bids[] | object | An order in the order book. |
bids[]. specification | order | An order specification that would create an order equivalent to the current state of this order. |
bids[]. properties | object | Properties of the order not in the specification. |
bids[].properties. maker | [address]https://github.com/callchain/call-lib/wiki/basic-types#address) | The address of the account that submitted the order. |
bids[].properties. sequence | sequence | The account sequence number of the transaction that created this order. |
bids[].properties. makerExchangeRate | value | The exchange rate from the point of view of the account that submitted the order (also known as "quality"). |
bids[]. state | object | Optional The state of the order. |
bids[].state. fundedAmount | amount | How much of the amount the maker would have to pay that the maker currently holds. |
bids[].state. priceOfFundedAmount | amount | How much the fundedAmount would convert to through the exchange rate of this order. |
asks | array | The sell orders in the order book. |
asks[] | object | An order in the order book. |
asks[]. specification | order | An order specification that would create an order equivalent to the current state of this order. |
asks[]. properties | object | Properties of the order not in the specification. |
asks[].properties. maker | address | The address of the account that submitted the order. |
asks[].properties. sequence | sequence | The account sequence number of the transaction that created this order. |
asks[].properties. makerExchangeRate | value | The exchange rate from the point of view of the account that submitted the order (also known as "quality"). |
asks[]. state | object | Optional The state of the order. |
asks[].state. fundedAmount | amount | How much of the amount the maker would have to pay that the maker currently holds. |
asks[].state. priceOfFundedAmount | amount | How much the fundedAmount would convert to through the exchange rate of this order. |
const address = 'cKYg3DSSRtdP7fZtgzGHZxh8qpyMgjtBdu';
const orderbook = {
"base": {
"currency": "USD",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
},
"counter": {
"currency": "BTC",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
}
};
return api.getOrderbook(address, orderbook)
.then(orderbook => {/* ... */});
{
"bids": [
{
"specification": {
"direction": "buy",
"quantity": {
"currency": "USD",
"value": "93.030522464522",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
},
"totalPrice": {
"currency": "BTC",
"value": "0.2849323720855092",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
}
},
"properties": {
"maker": "cKYg3DSSRtdP7fZtgzGHZxh8qpyMgjtBdu",
"sequence": 386940,
"makerExchangeRate": "326.5003614141928"
}
},
{
"specification": {
"direction": "buy",
"quantity": {
"currency": "USD",
"value": "1",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
},
"totalPrice": {
"currency": "BTC",
"value": "0.00302447007930511",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
}
},
"properties": {
"maker": "cKYg3DSSRtdP7fZtgzGHZxh8qpyMgjtBdu",
"sequence": 207855,
"makerExchangeRate": "330.6364334177034"
}
},
{
"specification": {
"direction": "buy",
"quantity": {
"currency": "USD",
"value": "99.34014894048333",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
},
"totalPrice": {
"currency": "BTC",
"value": "0.3",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
},
"expirationTime": "2014-12-25T01:14:43.000Z"
},
"properties": {
"maker": "cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M",
"sequence": 110103,
"makerExchangeRate": "331.1338298016111"
}
},
{
"specification": {
"direction": "buy",
"quantity": {
"currency": "USD",
"value": "268.754",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
},
"totalPrice": {
"currency": "BTC",
"value": "0.8095",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
}
},
"properties": {
"maker": "cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M",
"sequence": 392,
"makerExchangeRate": "332"
},
"state": {
"fundedAmount": {
"currency": "BTC",
"value": "0.8078974385735969",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
},
"priceOfFundedAmount": {
"currency": "USD",
"value": "268.2219496064341",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
}
}
},
{
"specification": {
"direction": "buy",
"quantity": {
"currency": "USD",
"value": "152.0098333185607",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
},
"totalPrice": {
"currency": "BTC",
"value": "0.4499999999999999",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
},
"expirationTime": "2014-12-25T01:14:44.000Z"
},
"properties": {
"maker": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR",
"sequence": 110105,
"makerExchangeRate": "337.7996295968016"
}
},
{
"specification": {
"direction": "buy",
"quantity": {
"currency": "USD",
"value": "1.308365894430151",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
},
"totalPrice": {
"currency": "BTC",
"value": "0.003768001830745216",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
}
},
"properties": {
"maker": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR",
"sequence": 110061,
"makerExchangeRate": "347.2306949944844"
}
},
{
"specification": {
"direction": "buy",
"quantity": {
"currency": "USD",
"value": "176.3546101589987",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
},
"totalPrice": {
"currency": "BTC",
"value": "0.5",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
},
"expirationTime": "2014-12-25T00:41:38.000Z"
},
"properties": {
"maker": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR",
"sequence": 35788,
"makerExchangeRate": "352.7092203179974"
}
},
{
"specification": {
"direction": "buy",
"quantity": {
"currency": "USD",
"value": "179.48",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
},
"totalPrice": {
"currency": "BTC",
"value": "0.5",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
}
},
"properties": {
"maker": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR",
"sequence": 491,
"makerExchangeRate": "358.96"
},
"state": {
"fundedAmount": {
"currency": "BTC",
"value": "0.499001996007984",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
},
"priceOfFundedAmount": {
"currency": "USD",
"value": "179.1217564870259",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
}
}
},
{
"specification": {
"direction": "buy",
"quantity": {
"currency": "USD",
"value": "288.7710263794967",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
},
"totalPrice": {
"currency": "BTC",
"value": "0.8",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
},
"expirationTime": "2014-12-25T00:41:39.000Z"
},
"properties": {
"maker": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR",
"sequence": 35789,
"makerExchangeRate": "360.9637829743709"
}
},
{
"specification": {
"direction": "buy",
"quantity": {
"currency": "USD",
"value": "182.9814890090516",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
},
"totalPrice": {
"currency": "BTC",
"value": "0.5",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
}
},
"properties": {
"maker": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR",
"sequence": 5255,
"makerExchangeRate": "365.9629780181032"
},
"state": {
"fundedAmount": {
"currency": "BTC",
"value": "0.2254411038203033",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
},
"priceOfFundedAmount": {
"currency": "USD",
"value": "82.50309772176658",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
}
}
}
],
"asks": [
{
"specification": {
"direction": "sell",
"quantity": {
"currency": "USD",
"value": "3205.1",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
},
"totalPrice": {
"currency": "BTC",
"value": "10",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
}
},
"properties": {
"maker": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR",
"sequence": 434,
"makerExchangeRate": "0.003120027456241615"
}
},
{
"specification": {
"direction": "sell",
"quantity": {
"currency": "USD",
"value": "1599.063669386278",
"counterparty": "cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M"
},
"totalPrice": {
"currency": "BTC",
"value": "4.99707396683212",
"counterparty": "cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M"
}
},
"properties": {
"maker": "cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M",
"sequence": 233,
"makerExchangeRate": "0.003125"
}
},
{
"specification": {
"direction": "sell",
"quantity": {
"currency": "USD",
"value": "143.1050962074379",
"counterparty": "cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M"
},
"totalPrice": {
"currency": "BTC",
"value": "0.4499999999999999",
"counterparty": "cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M"
},
"expirationTime": "2014-12-25T01:14:44.000Z"
},
"properties": {
"maker": "cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M",
"sequence": 110104,
"makerExchangeRate": "0.003144542101755081"
},
"state": {
"fundedAmount": {
"currency": "USD",
"value": "0",
"counterparty": "cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M"
},
"priceOfFundedAmount": {
"currency": "BTC",
"value": "0",
"counterparty": "cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M"
}
}
},
{
"specification": {
"direction": "sell",
"quantity": {
"currency": "USD",
"value": "254.329207354604",
"counterparty": "cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M"
},
"totalPrice": {
"currency": "BTC",
"value": "0.8",
"counterparty": "cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M"
},
"expirationTime": "2014-12-24T21:44:11.000Z"
},
"properties": {
"maker": "cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M",
"sequence": 35625,
"makerExchangeRate": "0.003145529403882357"
},
"state": {
"fundedAmount": {
"currency": "USD",
"value": "0",
"counterparty": "cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M"
},
"priceOfFundedAmount": {
"currency": "BTC",
"value": "0",
"counterparty": "cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M"
}
}
},
{
"specification": {
"direction": "sell",
"quantity": {
"currency": "USD",
"value": "390.4979",
"counterparty": "cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M"
},
"totalPrice": {
"currency": "BTC",
"value": "1.23231134568807",
"counterparty": "cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M"
}
},
"properties": {
"maker": "cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M",
"sequence": 387756,
"makerExchangeRate": "0.003155743848271834"
}
},
{
"specification": {
"direction": "sell",
"quantity": {
"currency": "USD",
"value": "1",
"counterparty": "cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M"
},
"totalPrice": {
"currency": "BTC",
"value": "0.003160328237957649",
"counterparty": "cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M"
}
},
"properties": {
"maker": "cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M",
"sequence": 208927,
"makerExchangeRate": "0.003160328237957649"
}
},
{
"specification": {
"direction": "sell",
"quantity": {
"currency": "USD",
"value": "4725",
"counterparty": "cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M"
},
"totalPrice": {
"currency": "BTC",
"value": "15",
"counterparty": "cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M"
}
},
"properties": {
"maker": "cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M",
"sequence": 429,
"makerExchangeRate": "0.003174603174603175"
}
},
{
"specification": {
"direction": "sell",
"quantity": {
"currency": "USD",
"value": "1.24252537879871",
"counterparty": "cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M"
},
"totalPrice": {
"currency": "BTC",
"value": "0.003967400879423823",
"counterparty": "cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M"
}
},
"properties": {
"maker": "cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M",
"sequence": 110099,
"makerExchangeRate": "0.003193013959408667"
}
},
{
"specification": {
"direction": "sell",
"quantity": {
"currency": "USD",
"value": "496.5429474010489",
"counterparty": "cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M"
},
"totalPrice": {
"currency": "BTC",
"value": "1.6",
"counterparty": "cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M"
},
"expirationTime": "2014-12-24T21:44:12.000Z"
},
"properties": {
"maker": "cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M",
"sequence": 35627,
"makerExchangeRate": "0.003222279177208227"
},
"state": {
"fundedAmount": {
"currency": "USD",
"value": "0",
"counterparty": "cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M"
},
"priceOfFundedAmount": {
"currency": "BTC",
"value": "0",
"counterparty": "cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M"
}
}
},
{
"specification": {
"direction": "sell",
"quantity": {
"currency": "USD",
"value": "3103",
"counterparty": "cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M"
},
"totalPrice": {
"currency": "BTC",
"value": "10",
"counterparty": "cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M"
}
},
"properties": {
"maker": "cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M",
"sequence": 431,
"makerExchangeRate": "0.003222687721559781"
}
}
]
}
getSettings(address: string, options: Object): Promise<Object>
Returns settings for the specified account. Note: For account data that is not modifiable by the user, see getAccountInfo.
Name | Type | Description |
---|---|---|
address | address | The address of the account to get the settings of. |
options | object | Optional Options that affect what to return. |
options. ledgerVersion | integer | Optional Get the settings as of this historical ledger version. |
This method returns a promise that resolves with an array of objects with the following structure (Note: all fields are optional as they will not be shown if they are set to their default value):
Name | Type | Description |
---|---|---|
defaultCall | boolean | Optional Enable calling on this account’s trust lines by default. (New in calld 0.27.3) |
depositAuth | boolean | Optional Enable Deposit Authorization on this account. If set, transactions cannot send value of any kind to this account unless the sender of those transactions is the account itself. (Requires the DepositAuth amendment) |
disableMasterKey | boolean | Optional Disallows use of the master key to sign transactions for this account. |
disallowIncomingCALL | boolean | Optional Indicates that client applications should not send CALL to this account. Not enforced by calld. |
domain | string | Optional The domain that owns this account, as a hexadecimal string representing the ASCII for the domain in lowercase. |
emailHash | string,null |
Optional Hash of an email address to be used for generating an avatar image. Conventionally, clients use Gravatar to display this image. Use null to clear. |
enableTransactionIDTracking | boolean | Optional Track the ID of this account’s most recent transaction. |
globalFreeze | boolean | Optional Freeze all assets issued by this account. |
memos | memos | Optional Array of memos to attach to the transaction. |
messageKey | string | Optional Public key for sending encrypted messages to this account. Conventionally, it should be a secp256k1 key, the same encryption that is used by the rest of Call. |
noFreeze | boolean | Optional Permanently give up the ability to freeze individual trust lines. This flag can never be disabled after being enabled. |
passwordSpent | boolean | Optional Indicates that the account has used its free SetRegularKey transaction. |
regularKey | address,null |
Optional The public key of a new keypair, to use as the regular key to this account, as a base-58-encoded string in the same format as an account address. Use null to remove the regular key. |
requireAuthorization | boolean | Optional If set, this account must individually approve other users in order for those users to hold this account’s issuances. |
requireDestinationTag | boolean | Optional Requires incoming payments to specify a destination tag. |
signers | object | Optional Settings that determine what sets of accounts can be used to sign a transaction on behalf of this account using multisigning. |
signers. threshold | integer |
Optional A target number for the signer weights. A multi-signature from this list is valid only if the sum weights of the signatures provided is equal or greater than this value. To delete the signers setting, use the value 0 . |
signers. weights | array | Optional Weights of signatures for each signer. |
signers. weights[] | object | An association of an address and a weight. |
signers.weights[]. address | address | A Call account address |
signers.weights[]. weight | integer | The weight that the signature of this account counts as towards the threshold. |
transferRate | number,null |
Optional The fee to charge when users transfer this account’s issuances, as the decimal amount that must be sent to deliver 1 unit. Has precision up to 9 digits beyond the decimal point. Use null to set no fee. |
const address = 'c4ur9JxmkbMpqAwGQfnAP3WDvA35rZPNKc';
return api.getSettings(address).then(settings =>
{/* ... */});
{
"requireDestinationTag": true,
"disallowIncomingCALL": true,
"emailHash": "23463B99B62A72F26ED677CC556C44E8",
"domain": "example.com",
"transferRate": 1.002,
"signers": {
"threshold": 3,
"weights": [
{
"address": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR",
"weight": 1
}, {
"address": "cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M",
"weight": 1
}, {
"address": "cKYg3DSSRtdP7fZtgzGHZxh8qpyMgjtBdu",
"weight": 1
}
]
}
}
getAccountInfo(address: string, options: Object): Promise<Object>
Returns information for the specified account. Note: For account data that is modifiable by the user, see getSettings.
Name | Type | Description |
---|---|---|
address | [address]https://github.com/callchain/call-lib/wiki/basic-types#address) | The address of the account to get the account info of. |
options | object | Optional Options that affect what to return. |
options. ledgerVersion | integer | Optional Get the account info as of this historical ledger version. |
This method returns a promise that resolves with an object with the following structure:
Name | Type | Description |
---|---|---|
sequence | sequence | The next (smallest unused) sequence number for this account. |
CALLBalance | value | The CALL balance owned by the account. |
ownerCount | integer | Number of other ledger entries (specifically, trust lines and offers) attributed to this account. This is used to calculate the total reserve required to use the account. |
previousAffectingTransactionID | string | Hash value representing the most recent transaction that affected this account node directly. Note: This does not include changes to the account’s trust lines and offers. |
previousAffectingTransactionLedgerVersion | integer | The ledger version that the transaction identified by the previousAffectingTransactionID was validated in. |
previousInitiatedTransactionID | string | Optional Hash value representing the most recent transaction that was initiated by this account. |
const address = 'cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M';
return api.getAccountInfo(address).then(info =>
{/* ... */});
{
"sequence": 23,
"CALLBalance": "922.913243",
"ownerCount": 1,
"previousAffectingTransactionID": "19899273706A9E040FDB5885EE991A1DC2BAD878A0D6E7DBCFB714E63BF737F7",
"previousAffectingTransactionLedgerVersion": 6614625
}
getAccountByName(name: string): Promise<Object>
Get account information by user's nickname. Nickname is unique, so one nickname one account.
Name | Type | Description |
---|---|---|
name | string | nickname of account |
This method returns a promise that resolves with an object with the following structure:
Name | Type | Description |
---|---|---|
sequence | sequence | The next (smallest unused) sequence number for this account. |
CALLBalance | value | The CALL balance owned by the account. |
ownerCount | integer | Number of other ledger entries (specifically, trust lines and offers) attributed to this account. This is used to calculate the total reserve required to use the account. |
previousAffectingTransactionID | string | Hash value representing the most recent transaction that affected this account node directly. Note: This does not include changes to the account’s trust lines and offers. |
previousAffectingTransactionLedgerVersion | integer | The ledger version that the transaction identified by the previousAffectingTransactionID was validated in. |
previousInitiatedTransactionID | string | Optional Hash value representing the most recent transaction that was initiated by this account. |
const nickname = 'lando';
return api.getAccountByName(nickname).then(info =>
{/* ... */});
{
"sequence": 23,
"CALLBalance": "922.913243",
"ownerCount": 1,
"previousAffectingTransactionID": "19899273706A9E040FDB5885EE991A1DC2BAD878A0D6E7DBCFB714E63BF737F7",
"previousAffectingTransactionLedgerVersion": 6614625
}
getAccountIssues(address: string): Promise<Object>
Get account issued asset list.
Name | Type | Description |
---|---|---|
address | string | account address |
This method returns a promise that resolves with an object with the following structure:
Name | Type | Description |
---|---|---|
NickName | string | nickname of account |
account | address | Address that created the payment channel. |
ledger_current_index | integer | ledger version of currency account issue state |
lines | array<asset> | Assets issued by account |
validated | boolean | validation of account issuing |
const address = 'cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M';
return api.getAccountIssues(address).then(issues =>
{/* ... */});
{
"NickName":"0030003000360031",
"account":"cBofE1BMB78yX4oHXLKc5oXV1BgJNGjh96",
"ledger_current_index":6993709,
"lines":[
{
"Fans":"8",
"Freeze":{
"currency":"BBB",
"issuer":"cBofE1BMB78yX4oHXLKc5oXV1BgJNGjh96",
"value":"0"
},
"Issued":{
"currency":"BBB",
"issuer":"cBofE1BMB78yX4oHXLKc5oXV1BgJNGjh96",
"value":"10000"
},
"Total":{
"currency":"BBB",
"issuer":"cBofE1BMB78yX4oHXLKc5oXV1BgJNGjh96",
"value":"100000000"
},
"Info":""
},
{
"Fans":"8",
"Freeze":{
"currency":"ATa",
"issuer":"cBofE1BMB78yX4oHXLKc5oXV1BgJNGjh96",
"value":"0"
},
"Issued":{
"currency":"ATa",
"issuer":"cBofE1BMB78yX4oHXLKc5oXV1BgJNGjh96",
"value":"1"
},
"Total":{
"currency":"ATa",
"issuer":"cBofE1BMB78yX4oHXLKc5oXV1BgJNGjh96",
"value":"100000"
},
"Info":""
},
{
"Fans":"21",
"Freeze":{
"currency":"AND",
"issuer":"cBofE1BMB78yX4oHXLKc5oXV1BgJNGjh96",
"value":"0"
},
"Issued":{
"currency":"AND",
"issuer":"cBofE1BMB78yX4oHXLKc5oXV1BgJNGjh96",
"value":"6111110"
},
"Total":{
"currency":"AND",
"issuer":"cBofE1BMB78yX4oHXLKc5oXV1BgJNGjh96",
"value":"100000000"
},
"Info":""
},
{
"Fans":"8",
"Freeze":{
"currency":"aaa",
"issuer":"cBofE1BMB78yX4oHXLKc5oXV1BgJNGjh96",
"value":"0"
},
"Issued":{
"currency":"aaa",
"issuer":"cBofE1BMB78yX4oHXLKc5oXV1BgJNGjh96",
"value":"189"
},
"Total":{
"currency":"aaa",
"issuer":"cBofE1BMB78yX4oHXLKc5oXV1BgJNGjh96",
"value":"1000"
},
"Info":""
},
{
"Fans":"1",
"Freeze":{
"currency":"CCC",
"issuer":"cBofE1BMB78yX4oHXLKc5oXV1BgJNGjh96",
"value":"0"
},
"Issued":{
"currency":"CCC",
"issuer":"cBofE1BMB78yX4oHXLKc5oXV1BgJNGjh96",
"value":"0"
},
"Total":{
"currency":"CCC",
"issuer":"cBofE1BMB78yX4oHXLKc5oXV1BgJNGjh96",
"value":"100"
},
"Info":""
}
],
"validated":false
}
getAccountInvoices(address: string): Promise<Object>
Get account owner non-fungible asset list.
Name | Type | Description |
---|---|---|
address | string | account address |
This method returns a promise that resolves with an object with the following structure:
Name | Type | Description |
---|---|---|
account | address | Address that created the payment channel. |
ledger_current_index | integer | ledger version of currency account issue state |
lines | array<asset> | Assets issued by account |
validated | boolean | validation of account issuing |
const address = 'c9rvpcEEeihCcAVpTPE8gAtmzLsysxrtD9';
return api.getAccountInvoices(address).then(issues =>
{/* ... */});
{
"NickName":"0030003000360031",
"account":"cBofE1BMB78yX4oHXLKc5oXV1BgJNGjh96",
"ledger_current_index":6993709,
"lines":[
{
"Amount" : {
"currency" : "ABC",
"issuer" : "c9rvpcEEeihCcAVpTPE8gAtmzLsysxrtD9",
"value" : "1"
},
"Invoice" : "1234567890",
"InvoiceID" : "0000000000000000000000000000000000000000000000000000000000000010"
},
{
"Amount" : {
"currency" : "ABC",
"issuer" : "c9rvpcEEeihCcAVpTPE8gAtmzLsysxrtD9",
"value" : "1"
},
"Invoice" : "1234567890",
"InvoiceID" : "0000000000000000000000000000000000000000000000000000000000000011"
},
{
"Amount" : {
"currency" : "ABC",
"issuer" : "c9rvpcEEeihCcAVpTPE8gAtmzLsysxrtD9",
"value" : "1"
},
"Invoice" : "1234567890",
"InvoiceID" : "0000000000000000000000000000000000000000000000000000000000000012"
},
{
"Amount" : {
"currency" : "KITTY",
"issuer" : "c9rvpcEEeihCcAVpTPE8gAtmzLsysxrtD9",
"value" : "1"
},
"Invoice" : "01234567890ABC",
"InvoiceID" : "0000000000000000000000000000000000000000000000000000000000000012"
}
],
"validated":false
}
getPaymentChannel(id: string): Promise<Object>
Returns specified payment channel.
Name | Type | Description |
---|---|---|
id | string | 256-bit hexadecimal channel identifier. |
This method returns a promise that resolves with an object with the following structure:
Name | Type | Description |
---|---|---|
account | address | Address that created the payment channel. |
destination | address | Address to receive CALL claims against this channel. |
amount | value | The total amount of CALL funded in this channel. |
balance | value | The total amount of CALL delivered by this channel. |
settleDelay | number | Amount of seconds the source address must wait before closing the channel if it has unclaimed CALL. |
previousAffectingTransactionID | string | Hash value representing the most recent transaction that affected this payment channel. |
previousAffectingTransactionLedgerVersion | integer | The ledger version that the transaction identified by the previousAffectingTransactionID was validated in. |
cancelAfter | date-time string | Optional Time when this channel expires as specified at creation. |
destinationTag | integer | Optional Destination tag. |
expiration | date-time string | Optional Time when this channel expires. |
publicKey | string | Optional Public key of the key pair the source will use to sign claims against this channel. |
sourceTag | integer | Optional Source tag. |
const channelId =
'E30E709CF009A1F26E0E5C48F7AA1BFB79393764F15FB108BDC6E06D3CBD8415';
return api.getPaymentChannel(channelId).then(channel =>
{/* ... */});
{
"account": "cKYg3DSSRtdP7fZtgzGHZxh8qpyMgjtBdu",
"amount": "10",
"balance": "0",
"destination": "cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M",
"publicKey": "02A05282CB6197E34490BACCD9405E81D9DFBE123B0969F9F40EC3F9987AD9A97D",
"settleDelay": 10000,
"previousAffectingTransactionID": "F939A0BEF139465403C56CCDC49F59A77C868C78C5AEC184E29D15E9CD1FF675",
"previousAffectingTransactionLedgerVersion": 151322
}
getLedger(options: Object): Promise<Object>
Returns header information for the specified ledger (or the most recent validated ledger if no ledger is specified). Optionally, all the transactions that were validated in the ledger or the account state information can be returned with the ledger header.
Name | Type | Description |
---|---|---|
options | object | Optional Options affecting what ledger and how much data to return. |
options. includeAllData | boolean |
Optional Include full transactions and/or state information if includeTransactions and/or includeState is set. |
options. includeState | boolean |
Optional Return an array of hashes for all state data or an array of all state data in this ledger version, depending on whether includeAllData is set. |
options. includeTransactions | boolean |
Optional Return an array of hashes for each transaction or an array of all transactions that were validated in this ledger version, depending on whether includeAllData is set. |
options. ledgerVersion | integer | Optional Get ledger data for this historical ledger version. |
This method returns a promise that resolves with an object with the following structure:
Name | Type | Description |
---|---|---|
stateHash | string | Hash of all state information in this ledger. |
closeTime | date-time string | The time at which this ledger was closed. |
closeTimeResolution | integer | Approximate number of seconds between closing one ledger version and closing the next one. |
closeFlags | integer | A bit-map of flags relating to the closing of this ledger. Currently, the ledger has only one flag defined for closeFlags : sLCF_NoConsensusTime (value 1). If this flag is enabled, it means that validators were in conflict regarding the correct close time for the ledger, but built otherwise the same ledger, so they declared consensus while "agreeing to disagree" on the close time. In this case, the consensus ledger contains a closeTime value that is 1 second after that of the previous ledger. (In this case, there is no official close time, but the actual real-world close time is probably 3-6 seconds later than the specified closeTime .) |
ledgerHash | string | Unique identifying hash of the entire ledger. |
ledgerVersion | integer | The ledger version of this ledger. |
parentLedgerHash | string | Unique identifying hash of the ledger that came immediately before this one. |
parentCloseTime | date-time string | The time at which the previous ledger was closed. |
totalDrops | [value](https://github.com/callchain/call-lib/wiki/basic-types | |
#value) | Total number of drops (1/1,000,000th of an CALL) in the network, as a quoted integer. (This decreases as transaction fees cause CALL to be destroyed.) | |
transactionHash | string | Hash of the transaction information included in this ledger. |
rawState | string | Optional A JSON string containing all state data for this ledger in calld JSON format. |
rawTransactions | string | Optional A JSON string containing calld format transaction JSON for all transactions that were validated in this ledger. |
stateHashes | array<string> | Optional An array of hashes of all state data in this ledger. |
transactionHashes | array<id> | Optional An array of hashes of all transactions that were validated in this ledger. |
transactions | array<getTransaction> | Optional Array of all transactions that were validated in this ledger. Transactions are represented in the same format as the return value of getTransaction. |
return api.getLedger()
.then(ledger => {/* ... */});
{
"stateHash": "EC028EC32896D537ECCA18D18BEBE6AE99709FEFF9EF72DBD3A7819E918D8B96",
"closeTime": "2014-09-24T21:21:50.000Z",
"closeTimeResolution": 10,
"closeFlags": 0,
"ledgerHash": "0F7ED9F40742D8A513AE86029462B7A6768325583DF8EE21B7EC663019DD6A0F",
"ledgerVersion": 9038214,
"parentLedgerHash": "4BB9CBE44C39DC67A1BE849C7467FE1A6D1F73949EA163C38A0121A15E04FFDE",
"parentCloseTime": "2014-09-24T21:21:40.000Z",
"totalDrops": "99999973964317514",
"transactionHash": "ECB730839EB55B1B114D5D1AD2CD9A932C35BA9AB6D3A8C2F08935EAC2BAC239"
}
prepareIssueSet(address: string, issueset: Object, instructions: Object): Promise<Object>
Prepare a issue set transaction. The prepared transaction must subsequently be signed and submitted.
Name | Type | Description |
---|---|---|
address | address | The address of the account that is creating the transaction. |
issueset | issueset | The specification of the issueset to prepare. |
instructions | instructions | Optional Instructions for executing the transaction |
This method returns a promise that resolves with an object with the following structure:
All "prepare*" methods have the same return type.Name | Type | Description |
---|---|---|
txJSON | string | The prepared transaction in calld JSON format. |
instructions | object | The instructions for how to execute the transaction after adding automatic defaults. |
instructions. fee | value | An exact fee to pay for the transaction. See Transaction Fees for more information. |
instructions. sequence | sequence | The initiating account's sequence number for this transaction. |
instructions. maxLedgerVersion | integer,null | The highest ledger version that the transaction can be included in. Set to null if there is no maximum. |
const address = 'cKYg3DSSRtdP7fZtgzGHZxh8qpyMgjtBdu';
const issueset = {
"total": {
"value": "0.01",
"currency": "USD",
"issuer": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
},
"editable": true,
"nonFungible": false,
"transferRate": 1.002
};
return api.prepareIssueSet(address, issueset).then(prepared =>
{/* ... */});
{
"txJSON":{
"Flags": 0,
"TransactionType":"IssueSet",
"Account":"cP87PfWeQfnaGJytdgruybN6keB9oyGBrx",
"Total":{
"value":"0.01",
"currency":"USD",
"issuer":"cHteR2P9NPoAk6PmZC4GP4CfKKTZw4XQS4"
},
"TransferRate": 1200000
"LastLedgerSequence":8820051,
"Fee":"12",
"Sequence":23
},
"instructions":{
"fee":"0.000012",
"sequence":23,
"maxLedgerVersion":8820051
}
}
preparePayment(address: string, payment: Object, instructions: Object): Promise<Object>
Prepare a payment transaction. The prepared transaction must subsequently be signed and submitted.
Name | Type | Description |
---|---|---|
address | address | The address of the account that is creating the transaction. |
payment | payment | The specification of the payment to prepare. |
instructions | instructions | Optional Instructions for executing the transaction |
This method returns a promise that resolves with an object with the following structure:
All "prepare*" methods have the same return type.Name | Type | Description |
---|---|---|
txJSON | string | The prepared transaction in calld JSON format. |
instructions | object | The instructions for how to execute the transaction after adding automatic defaults. |
instructions. fee | value | An exact fee to pay for the transaction. See Transaction Fees for more information. |
instructions. sequence | sequence | The initiating account's sequence number for this transaction. |
instructions. maxLedgerVersion | integer,null | The highest ledger version that the transaction can be included in. Set to null if there is no maximum. |
const address = 'cKYg3DSSRtdP7fZtgzGHZxh8qpyMgjtBdu';
const payment = {
"source": {
"address": "cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M",
"maxAmount": {
"value": "0.01",
"currency": "USD",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
}
},
"destination": {
"address": "c4ur9JxmkbMpqAwGQfnAP3WDvA35rZPNKc",
"amount": {
"value": "0.01",
"currency": "USD",
"counterparty": "cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR"
}
}
};
return api.preparePayment(address, payment).then(prepared =>
{/* ... */});
{
"txJSON": "{\"Flags\":0,\"TransactionType\":\"IssueSet\",\"Account\":\"cP87PfWeQfnaGJytdgruybN6keB9oyGBrx\",\"Total\":{\"value\":\"0.01\",\"currency\":\"USD\",\"issuer\":\"cHteR2P9NPoAk6PmZC4GP4CfKKTZw4XQS4\"},\"TransferRate\": 1.02,\"LastLedgerSequence\":8820051,\"Fee\":\"12\",\"Sequence\":23}",
"instructions": {
"fee": "0.000012",
"sequence": 23,
"maxLedgerVersion": 8820051
}
}
prepareTrustline(address: string, trustline: Object, instructions: Object): Promise<Object>
Prepare a trustline transaction. The prepared transaction must subsequently be signed and submitted.
Name | Type | Description |
---|---|---|
address | address | The address of the account that is creating the transaction. |
trustline | trustline | The specification of the trustline to prepare. |
instructions | instructions | Optional Instructions for executing the transaction |
This method returns a promise that resolves with an object with the following structure:
All "prepare*" methods have the same return type.Name | Type | Description |
---|---|---|
txJSON | string | The prepared transaction in calld JSON format. |
instructions | object | The instructions for how to execute the transaction after adding automatic defaults. |
instructions. fee | value | An exact fee to pay for the transaction. See Transaction Fees for more information. |
instructions. sequence | sequence | The initiating account's sequence number for this transaction. |
instructions. maxLedgerVersion | integer,null | The highest ledger version that the transaction can be included in. Set to null if there is no maximum. |
const address = 'cKYg3DSSRtdP7fZtgzGHZxh8qpyMgjtBdu';
const trustline = {
"currency": "USD",
"counterparty": "cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M",
"limit": "10000",
"qualityIn": 0.91,
"qualityOut": 0.87,
"callingDisabled": true,
"frozen": false,
"memos": [
{
"type": "test",
"format": "plain/text",
"data": "texted data"
}
]
};
return api.prepareTrustline(address, trustline).then(prepared =>
{/* ... */});
{
"txJSON": "{\"TransactionType\":\"TrustSet\",\"Account\":\"cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR\",\"LimitAmount\":{\"currency\":\"USD\",\"issuer\":\"c4ur9JxmkbMpqAwGQfnAP3WDvA35rZPNKc\",\"value\":\"10000\"},\"Flags\":2149711872,\"QualityIn\":910000000,\"QualityOut\":870000000,\"Memos\":[{\"Memo\":{\"MemoData\":\"7465787465642064617461\",\"MemoType\":\"74657374\",\"MemoFormat\":\"706C61696E2F74657874\"}}],\"LastLedgerSequence\":8820051,\"Fee\":\"12\",\"Sequence\":23}",
"instructions": {
"fee": "0.000012",
"sequence": 23,
"maxLedgerVersion": 8820051
}
}
prepareOrder(address: string, order: Object, instructions: Object): Promise<Object>
Prepare an order transaction. The prepared transaction must subsequently be signed and submitted.
Name | Type | Description |
---|---|---|
address | address | The address of the account that is creating the transaction. |
order | order | The specification of the order to prepare. |
instructions | instructions | Optional Instructions for executing the transaction |
This method returns a promise that resolves with an object with the following structure:
All "prepare*" methods have the same return type.Name | Type | Description |
---|---|---|
txJSON | string | The prepared transaction in calld JSON format. |
instructions | object | The instructions for how to execute the transaction after adding automatic defaults. |
instructions. fee | value | An exact fee to pay for the transaction. See Transaction Fees for more information. |
instructions. sequence | sequence | The initiating account's sequence number for this transaction. |
instructions. maxLedgerVersion | integer,null | The highest ledger version that the transaction can be included in. Set to null if there is no maximum. |
const address = 'cwdRbifxFTeB1dsBXgC124aFEVgrCzfeMa';
const order = {
"direction": "buy",
"quantity": {
"currency": "USD",
"counterparty": "cHteR2P9NPoAk6PmZC4GP4CfKKTZw4XQS4",
"value": "10.1"
},
"totalPrice": {
"currency": "CALL",
"value": "2"
},
"passive": true,
"fillOrKill": true
};
return api.prepareOrder(address, order)
.then(prepared => {/* ... */});
{
"txJSON": "{\"Flags\":2147811328,\"TransactionType\":\"OfferCreate\",\"Account\":\"cnEuakn4SJtN5b2GBBAggAwLr7gxUpFKqk\",\"TakerGets\":\"2000000\",\"TakerPays\":{\"value\":\"10.1\",\"currency\":\"USD\",\"issuer\":\"rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM\"},\"LastLedgerSequence\":8819954,\"Fee\":\"12\",\"Sequence\":23}",
"instructions": {
"fee": "0.000012",
"sequence": 23,
"maxLedgerVersion": 8819954
}
}
prepareOrderCancellation(address: string, orderCancellation: Object, instructions: Object): Promise<Object>
Prepare an order cancellation transaction. The prepared transaction must subsequently be signed and submitted.
Name | Type | Description |
---|---|---|
address | address | The address of the account that is creating the transaction. |
orderCancellation | orderCancellation | The specification of the order cancellation to prepare. |
instructions | instructions | Optional Instructions for executing the transaction |
This method returns a promise that resolves with an object with the following structure:
All "prepare*" methods have the same return type.Name | Type | Description |
---|---|---|
txJSON | string | The prepared transaction in calld JSON format. |
instructions | object | The instructions for how to execute the transaction after adding automatic defaults. |
instructions. fee | value | An exact fee to pay for the transaction. See Transaction Fees for more information. |
instructions. sequence | sequence | The initiating account's sequence number for this transaction. |
instructions. maxLedgerVersion | integer,null | The highest ledger version that the transaction can be included in. Set to null if there is no maximum. |
const address = 'cKYg3DSSRtdP7fZtgzGHZxh8qpyMgjtBdu';
const orderCancellation = {orderSequence: 123};
return api.prepareOrderCancellation(address, orderCancellation)
.then(prepared => {/* ... */});
{
"txJSON": "{\"Flags\":2147483648,\"TransactionType\":\"OfferCancel\",\"Account\":\"cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M\",\"OfferSequence\":23,\"LastLedgerSequence\":8820051,\"Fee\":\"12\",\"Sequence\":23}",
"instructions": {
"fee": "0.000012",
"sequence": 23,
"maxLedgerVersion": 8820051
}
}
prepareSettings(address: string, settings: Object, instructions: Object): Promise<Object>
Prepare a settings transaction. The prepared transaction must subsequently be signed and submitted.
Name | Type | Description |
---|---|---|
address | address | The address of the account that is creating the transaction. |
settings | settings | The specification of the settings to prepare. |
instructions | instructions | Optional Instructions for executing the transaction |
This method returns a promise that resolves with an object with the following structure:
All "prepare*" methods have the same return type.Name | Type | Description |
---|---|---|
txJSON | string | The prepared transaction in calld JSON format. |
instructions | object | The instructions for how to execute the transaction after adding automatic defaults. |
instructions. fee | value | An exact fee to pay for the transaction. See Transaction Fees for more information. |
instructions. sequence | sequence | The initiating account's sequence number for this transaction. |
instructions. maxLedgerVersion | integer,null | The highest ledger version that the transaction can be included in. Set to null if there is no maximum. |
const address = 'cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR';
const settings = {
"domain": "call.com",
"memos": [
{
"type": "test",
"format": "plain/text",
"data": "texted data"
}
]
};
return api.prepareSettings(address, settings)
.then(prepared => {/* ... */});
{
"domain": "callchain.live",
"memos": [
{
"type": "test",
"format": "plain/text",
"data": "texted data"
}
]
}
prepareEscrowCreation(address: string, escrowCreation: Object, instructions: Object): Promise<Object>
Prepare an escrow creation transaction. The prepared transaction must subsequently be signed and submitted.
Name | Type | Description |
---|---|---|
address | address | The address of the account that is creating the transaction. |
escrowCreation | escrowCreation | The specification of the escrow creation to prepare. |
instructions | instructions | Optional Instructions for executing the transaction |
This method returns a promise that resolves with an object with the following structure:
All "prepare*" methods have the same return type.Name | Type | Description |
---|---|---|
txJSON | string | The prepared transaction in calld JSON format. |
instructions | object | The instructions for how to execute the transaction after adding automatic defaults. |
instructions. fee | value | An exact fee to pay for the transaction. See Transaction Fees for more information. |
instructions. sequence | sequence | The initiating account's sequence number for this transaction. |
instructions. maxLedgerVersion | integer,null | The highest ledger version that the transaction can be included in. Set to null if there is no maximum. |
const address = 'c4ur9JxmkbMpqAwGQfnAP3WDvA35rZPNKc';
const escrowCreation = {
"destination": "cP87PfWeQfnaGJytdgruybN6keB9oyGBrx",
"amount": "0.01",
"allowExecuteAfter": "2014-09-24T21:21:50.000Z",
"allowCancelAfter": "2017-01-01T00:00:00.000Z"
};
return api.prepareEscrowCreation(address, escrowCreation).then(prepared =>
{/* ... */});
{
"txJSON": "{\"Flags\":2147483648,\"TransactionType\":\"EscrowCreate\",\"Account\":\"cwdRbifxFTeB1dsBXgC124aFEVgrCzfeMa\",\"Destination\":\"cHteR2P9NPoAk6PmZC4GP4CfKKTZw4XQS4\",\"Amount\":\"10000\",\"CancelAfter\":536544000,\"FinishAfter\":464908910,\"LastLedgerSequence\":8820051,\"Fee\":\"12\",\"Sequence\":23}",
"instructions": {
"fee": "0.000012",
"sequence": 23,
"maxLedgerVersion": 8820051
}
}
prepareEscrowCancellation(address: string, escrowCancellation: Object, instructions: Object): Promise<Object>
Prepare an escrow cancellation transaction. The prepared transaction must subsequently be signed and submitted.
Name | Type | Description |
---|---|---|
address | address | The address of the account that is creating the transaction. |
escrowCancellation | escrowCancellation | The specification of the escrow cancellation to prepare. |
instructions | instructions | Optional Instructions for executing the transaction |
This method returns a promise that resolves with an object with the following structure:
All "prepare*" methods have the same return type.Name | Type | Description |
---|---|---|
txJSON | string | The prepared transaction in calld JSON format. |
instructions | object | The instructions for how to execute the transaction after adding automatic defaults. |
instructions. fee | value | An exact fee to pay for the transaction. See Transaction Fees for more information. |
instructions. sequence | sequence | The initiating account's sequence number for this transaction. |
instructions. maxLedgerVersion | integer,null | The highest ledger version that the transaction can be included in. Set to null if there is no maximum. |
const address = 'cLuq1oba75hpLvr6mD7E7qbh3eRMR2wn71';
const escrowCancellation = {
"owner": "cnEuakn4SJtN5b2GBBAggAwLr7gxUpFKqk",
"escrowSequence": 1234
};
return api.prepareEscrowCancellation(address, escrowCancellation).then(prepared =>
{/* ... */});
{
"txJSON": "{\"Flags\":2147483648,\"TransactionType\":\"EscrowCancel\",\"Account\":\"cHteR2P9NPoAk6PmZC4GP4CfKKTZw4XQS4\",\"Owner\":\"cwdRbifxFTeB1dsBXgC124aFEVgrCzfeMa\",\"OfferSequence\":1234,\"LastLedgerSequence\":8820051,\"Fee\":\"12\",\"Sequence\":23}",
"instructions": {
"fee": "0.000012",
"sequence": 23,
"maxLedgerVersion": 8820051
}
}
prepareEscrowExecution(address: string, escrowExecution: Object, instructions: Object): Promise<Object>
Prepare an escrow execution transaction. The prepared transaction must subsequently be signed and submitted.
Name | Type | Description |
---|---|---|
address | address | The address of the account that is creating the transaction. |
escrowExecution | escrowExecution | The specification of the escrow execution to prepare. |
instructions | instructions | Optional Instructions for executing the transaction |
This method returns a promise that resolves with an object with the following structure:
All "prepare*" methods have the same return type.Name | Type | Description |
---|---|---|
txJSON | string | The prepared transaction in calld JSON format. |
instructions | object | The instructions for how to execute the transaction after adding automatic defaults. |
instructions. fee | value | An exact fee to pay for the transaction. See Transaction Fees for more information. |
instructions. sequence | sequence | The initiating account's sequence number for this transaction. |
instructions. maxLedgerVersion | integer,null | The highest ledger version that the transaction can be included in. Set to null if there is no maximum. |
const address = 'cP87PfWeQfnaGJytdgruybN6keB9oyGBrx';
const escrowExecution = {
"owner": "c4ur9JxmkbMpqAwGQfnAP3WDvA35rZPNKc",
"escrowSequence": 1234,
"condition": "A0258020E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855810100",
"fulfillment": "A0028000"
};
return api.prepareEscrowExecution(address, escrowExecution).then(prepared =>
{/* ... */});
{
"txJSON": "{\"Flags\":2147483648,\"TransactionType\":\"EscrowFinish\",\"Account\":\"cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR\",\"Owner\":\"cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M\",\"OfferSequence\":1234,\"Condition\":\"A0258020E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855810100\",\"Fulfillment\":\"A0028000\",\"LastLedgerSequence\":8820051,\"Fee\":\"396\",\"Sequence\":23}",
"instructions": {
"fee": "0.000396",
"sequence": 23,
"maxLedgerVersion": 8820051
}
}
preparePaymentChannelCreate(address: string, paymentChannelCreate: Object, instructions: Object): Promise<Object>
Prepare a payment channel creation transaction. The prepared transaction must subsequently be signed and submitted.
Name | Type | Description |
---|---|---|
address | address | The address of the account that is creating the transaction. |
paymentChannelCreate | paymentChannelCreate | The specification of the payment channel to create. |
instructions | instructions | Optional Instructions for executing the transaction |
This method returns a promise that resolves with an object with the following structure:
All "prepare*" methods have the same return type.Name | Type | Description |
---|---|---|
txJSON | string | The prepared transaction in calld JSON format. |
instructions | object | The instructions for how to execute the transaction after adding automatic defaults. |
instructions. fee | value | An exact fee to pay for the transaction. See Transaction Fees for more information. |
instructions. sequence | sequence | The initiating account's sequence number for this transaction. |
instructions. maxLedgerVersion | integer,null | The highest ledger version that the transaction can be included in. Set to null if there is no maximum. |
const address = 'cLuq1oba75hpLvr6mD7E7qbh3eRMR2wn71';
const paymentChannelCreate = {
"amount": "1",
"destination": "cnEuakn4SJtN5b2GBBAggAwLr7gxUpFKqk",
"settleDelay": 86400,
"publicKey": "32D2471DB72B27E3310F355BB33E339BF26F8392D5A93D3BC0FC3B566612DA0F0A"
};
return api.preparePaymentChannelCreate(address, paymentChannelCreate).then(prepared =>
{/* ... */});
{
"txJSON":"{\"Account\":\"cHteR2P9NPoAk6PmZC4GP4CfKKTZw4XQS4\",\"TransactionType\":\"PaymentChannelCreate\",\"Amount\":\"1000000\",\"Destination\":\"cwdRbifxFTeB1dsBXgC124aFEVgrCzfeMa\",\"SettleDelay\":86400,\"PublicKey\":\"32D2471DB72B27E3310F355BB33E339BF26F8392D5A93D3BC0FC3B566612DA0F0A\",\"Flags\":2147483648,\"LastLedgerSequence\":8820051,\"Fee\":\"12\",\"Sequence\":23}",
"instructions": {
"fee": "0.000012",
"sequence": 23,
"maxLedgerVersion": 8820051
}
}
preparePaymentChannelClaim(address: string, paymentChannelClaim: Object, instructions: Object): Promise<Object>
Prepare a payment channel claim transaction. The prepared transaction must subsequently be signed and submitted.
Name | Type | Description |
---|---|---|
address | address | The address of the account that is creating the transaction. |
paymentChannelClaim | paymentChannelClaim | Details of the channel and claim. |
instructions | instructions | Optional Instructions for executing the transaction |
This method returns a promise that resolves with an object with the following structure:
All "prepare*" methods have the same return type.Name | Type | Description |
---|---|---|
txJSON | string | The prepared transaction in calld JSON format. |
instructions | object | The instructions for how to execute the transaction after adding automatic defaults. |
instructions. fee | value | An exact fee to pay for the transaction. See Transaction Fees for more information. |
instructions. sequence | sequence | The initiating account's sequence number for this transaction. |
instructions. maxLedgerVersion | integer,null | The highest ledger version that the transaction can be included in. Set to null if there is no maximum. |
const address = 'cHteR2P9NPoAk6PmZC4GP4CfKKTZw4XQS4';
const paymentChannelClaim = {
"channel": "C1AE6DDDEEC05CF2978C0BAD6FE302948E9533691DC749DCDD3B9E5992CA6198"
};
return api.preparePaymentChannelClaim(address, paymentChannelClaim).then(prepared =>
{/* ... */});
{
"txJSON": "{\"Account\":\"cnEuakn4SJtN5b2GBBAggAwLr7gxUpFKqk\",\"TransactionType\":\"PaymentChannelClaim\",\"Channel\":\"C1AE6DDDEEC05CF2978C0BAD6FE302948E9533691DC749DCDD3B9E5992CA6198\",\"Flags\":2147483648,\"LastLedgerSequence\":8820051,\"Fee\":\"12\",\"Sequence\":23}",
"instructions": {
"fee": "0.000012",
"sequence": 23,
"maxLedgerVersion": 8820051
}
}
preparePaymentChannelFund(address: string, paymentChannelFund: Object, instructions: Object): Promise<Object>
Prepare a payment channel fund transaction. The prepared transaction must subsequently be signed and submitted.
Name | Type | Description |
---|---|---|
address | address | The address of the account that is creating the transaction. |
paymentChannelFund | paymentChannelFund | The channel to fund, and the details of how to fund it. |
instructions | instructions | Optional Instructions for executing the transaction |
This method returns a promise that resolves with an object with the following structure:
All "prepare*" methods have the same return type.Name | Type | Description |
---|---|---|
txJSON | string | The prepared transaction in calld JSON format. |
instructions | object | The instructions for how to execute the transaction after adding automatic defaults. |
instructions. fee | value | An exact fee to pay for the transaction. See Transaction Fees for more information. |
instructions. sequence | sequence | The initiating account's sequence number for this transaction. |
instructions. maxLedgerVersion | integer,null | The highest ledger version that the transaction can be included in. Set to null if there is no maximum. |
const address = 'cKYg3DSSRtdP7fZtgzGHZxh8qpyMgjtBdu';
const paymentChannelFund = {
"channel": "C1AE6DDDEEC05CF2978C0BAD6FE302948E9533691DC749DCDD3B9E5992CA6198",
"amount": "1"
};
return api.preparePaymentChannelFund(address, paymentChannelFund).then(prepared =>
{/* ... */});
{
"txJSON":"{\"Account\":\"cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M\",\"TransactionType\":\"PaymentChannelFund\",\"Channel\":\"C1AE6DDDEEC05CF2978C0BAD6FE302948E9533691DC749DCDD3B9E5992CA6198\",\"Amount\":\"1000000\",\"Flags\":2147483648,\"LastLedgerSequence\":8820051,\"Fee\":\"12\",\"Sequence\":23}",
"instructions": {
"fee": "0.000012",
"sequence": 23,
"maxLedgerVersion": 8820051
}
}
prepareCheckCreate(address: string, checkCreate: Object, instructions: Object): Promise<Object>
Prepare a Check creation transaction. The prepared transaction must subsequently be signed and submitted.
Name | Type | Description |
---|---|---|
address | address | The address of the account that is creating the transaction. |
checkCreate | checkCreate | The specification of the Check create creation to prepare. |
instructions | instructions | Optional Instructions for executing the transaction |
This method returns a promise that resolves with an object with the following structure:
All "prepare*" methods have the same return type.Name | Type | Description |
---|---|---|
txJSON | string | The prepared transaction in calld JSON format. |
instructions | object | The instructions for how to execute the transaction after adding automatic defaults. |
instructions. fee | value | An exact fee to pay for the transaction. See Transaction Fees for more information. |
instructions. sequence | sequence | The initiating account's sequence number for this transaction. |
instructions. maxLedgerVersion | integer,null | The highest ledger version that the transaction can be included in. Set to null if there is no maximum. |
const address = 'cKYg3DSSRtdP7fZtgzGHZxh8qpyMgjtBdu';
const checkCreate = {
"destination": "cLuq1oba75hpLvr6mD7E7qbh3eRMR2wn71",
"sendMax": {
"currency": "CALL",
"value": "1"
}
};
return api.prepareCheckCreate(address, checkCreate).then(prepared =>
{/* ... */});
{
"txJSON": "{\"Account\":\"cnEuakn4SJtN5b2GBBAggAwLr7gxUpFKqk\",\"TransactionType\":\"CheckCreate\",\"Destination\":\"cHteR2P9NPoAk6PmZC4GP4CfKKTZw4XQS4\",\"SendMax\":\"1000000\",\"Flags\":2147483648,\"LastLedgerSequence\":8820051,\"Sequence\":23,\"Fee\":\"12\"}",
"instructions": {
"fee": "0.000012",
"sequence": 23,
"maxLedgerVersion": 8820051
}
}
prepareCheckCancel(address: string, checkCancel: Object, instructions: Object): Promise<Object>
Prepare a Check cancellation transaction. This cancels an unredeemed Check, removing it from the ledger without sending any money. The prepared transaction must subsequently be signed and submitted.
Name | Type | Description |
---|---|---|
address | address | The address of the account that is creating the transaction. |
checkCancel | checkCancel | The specification of the Check cancellation to prepare. |
instructions | instructions | Optional Instructions for executing the transaction |
This method returns a promise that resolves with an object with the following structure:
All "prepare*" methods have the same return type.Name | Type | Description |
---|---|---|
txJSON | string | The prepared transaction in calld JSON format. |
instructions | object | The instructions for how to execute the transaction after adding automatic defaults. |
instructions. fee | value | An exact fee to pay for the transaction. See Transaction Fees for more information. |
instructions. sequence | sequence | The initiating account's sequence number for this transaction. |
instructions. maxLedgerVersion | integer,null | The highest ledger version that the transaction can be included in. Set to null if there is no maximum. |
const address = 'cwdRbifxFTeB1dsBXgC124aFEVgrCzfeMa';
const checkCancel = {
"checkID": "49647F0D748DC3FE26BDACBC57F251AADEFFF391403EC9BF87C97F67E9977FB0"
};
return api.prepareCheckCancel(address, checkCancel).then(prepared =>
{/* ... */});
{
"txJSON": "{\"Account\":\"cP87PfWeQfnaGJytdgruybN6keB9oyGBrx\",\"TransactionType\":\"CheckCancel\",\"CheckID\":\"49647F0D748DC3FE26BDACBC57F251AADEFFF391403EC9BF87C97F67E9977FB0\",\"Flags\":2147483648,\"LastLedgerSequence\":8819954,\"Fee\":\"12\",\"Sequence\":23}",
"instructions": {
"fee": "0.000012",
"sequence": 23,
"maxLedgerVersion": 8819954
}
}
prepareCheckCash(address: string, checkCash: Object, instructions: Object): Promise<Object>
Prepare a Check cashing transaction. This redeems a Check to receive up to the amount authorized by the corresponding CheckCreate transaction. The prepared transaction must subsequently be signed and submitted.
Name | Type | Description |
---|---|---|
address | address | The address of the account that is creating the transaction. |
checkCash | checkCash | The specification of the Check cash to prepare. |
instructions | instructions | Optional Instructions for executing the transaction |
This method returns a promise that resolves with an object with the following structure:
All "prepare*" methods have the same return type.Name | Type | Description |
---|---|---|
txJSON | string | The prepared transaction in calld JSON format. |
instructions | object | The instructions for how to execute the transaction after adding automatic defaults. |
instructions. fee | value | An exact fee to pay for the transaction. See Transaction Fees for more information. |
instructions. sequence | sequence | The initiating account's sequence number for this transaction. |
instructions. maxLedgerVersion | integer,null | The highest ledger version that the transaction can be included in. Set to null if there is no maximum. |
const address = 'cDtARCCeAYkXjZDaubC8EX5jHRvg4U3jKR';
const checkCash = {
"amount": {
"currency": "CALL",
"value": "1"
},
"checkID": "838766BA2B995C00744175F69A1B11E32C3DBC40E64801A4056FCBD657F57334"
};
return api.prepareCheckCash(address, checkCash).then(prepared =>
{/* ... */});
{
"txJSON": "{\"Account\":\"cemMB2rr6tT5DHJ5NiCYXLWhFjm11ni8M\",\"TransactionType\":\"CheckCash\",\"CheckID\":\"838766BA2B995C00744175F69A1B11E32C3DBC40E64801A4056FCBD657F57334\",\"Amount\":\"1000000\",\"Flags\":2147483648,\"LastLedgerSequence\":8819954,\"Sequence\":23,\"Fee\":\"12\"}",
"instructions": {
"fee": "0.000012",
"sequence": 23,
"maxLedgerVersion": 8819954
}
}
sign(txJSON: string, secret: string, options: Object): {signedTransaction: string, id: string}
Sign a prepared transaction. The signed transaction must subsequently be submitted.
Name | Type | Description |
---|---|---|
txJSON | string | Transaction represented as a JSON string in calld format. |
secret | secret string | The secret of the account that is initiating the transaction. |
options | object | Optional Options that control the type of signature that will be generated. |
options. signAs | address | Optional The account that the signature should count for in multisigning. |
This method returns an object with the following structure:
Name | Type | Description |
---|---|---|
signedTransaction | string | The signed transaction represented as an uppercase hexadecimal string. |
id | id | The Transaction ID of the signed transaction. |
const txJSON = '{"Flags":2147483648,"TransactionType":"AccountSet","Account":"cKYg3DSSRtdP7fZtgzGHZxh8qpyMgjtBdu","Domain":"726970706C652E636F6D","LastLedgerSequence":8820051,"Fee":"12","Sequence":23}';
const secret = 'shsWGZcmZz6YsWWmcnpfr6fLTdtFV';
return api.sign(txJSON, secret);
{
"signedTransaction": "12000322800000002400000017201B0086955368400000000000000C732102F89EAEC7667B30F33D0687BBA86C3FE2A08CCA40A9186C5BDE2DAA6FA97A37D874473045022100BDE09A1F6670403F341C21A77CF35BA47E45CDE974096E1AA5FC39811D8269E702203D60291B9A27F1DCABA9CF5DED307B4F23223E0B6F156991DB601DFB9C41CE1C770A726970706C652E636F6D81145E7B112523F68D2F5E879DB4EAC51C6698A69304",
"id": "02ACE87F1996E3A23690A5BB7F1774BF71CCBA68F79805831B42ABAD5913D6F4"
}
combine(signedTransactions: Array<string>): {signedTransaction: string, id: string}
Combines signed transactions from multiple accounts for a multisignature transaction. The signed transaction must subsequently be submitted.
Name | Type | Description |
---|---|---|
signedTransactions | array<string> | An array of signed transactions (from the output of sign) to combine. |
This method returns an object with the following structure:
Name | Type | Description |
---|---|---|
signedTransaction | string | The signed transaction represented as an uppercase hexadecimal string. |
id | id | The Transaction ID of the signed transaction. |
const signedTransactions = [ "12000322800000002400000004201B000000116840000000000F42407300770B6578616D706C652E636F6D811407C532442A675C881BA1235354D4AB9D023243A6F3E0107321026C784C1987F83BACBF02CD3E484AFC84ADE5CA6B36ED4DCA06D5BA233B9D382774473045022100E484F54FF909469FA2033E22EFF3DF8EDFE62217062680BB2F3EDF2F185074FE0220350DB29001C710F0450DAF466C5D819DC6D6A3340602DE9B6CB7DA8E17C90F798114FE9337B0574213FA5BCC0A319DBB4A7AC0CCA894E1F1",
"12000322800000002400000004201B000000116840000000000F42407300770B6578616D706C652E636F6D811407C532442A675C881BA1235354D4AB9D023243A6F3E01073210287AAAB8FBE8C4C4A47F6F1228C6E5123A7ED844BFE88A9B22C2F7CC34279EEAA74473045022100B09DDF23144595B5A9523B20E605E138DC6549F5CA7B5984D7C32B0E3469DF6B022018845CA6C203D4B6288C87DDA439134C83E7ADF8358BD41A8A9141A9B631419F8114517D9B9609229E0CDFE2428B586738C5B2E84D45E1F1" ];
return api.combine(signedTransactions);
{
"signedTransaction": "12000322800000002400000004201B000000116840000000000F42407300770B6578616D706C652E636F6D811407C532442A675C881BA1235354D4AB9D023243A6F3E01073210287AAAB8FBE8C4C4A47F6F1228C6E5123A7ED844BFE88A9B22C2F7CC34279EEAA74473045022100B09DDF23144595B5A9523B20E605E138DC6549F5CA7B5984D7C32B0E3469DF6B022018845CA6C203D4B6288C87DDA439134C83E7ADF8358BD41A8A9141A9B631419F8114517D9B9609229E0CDFE2428B586738C5B2E84D45E1E0107321026C784C1987F83BACBF02CD3E484AFC84ADE5CA6B36ED4DCA06D5BA233B9D382774473045022100E484F54FF909469FA2033E22EFF3DF8EDFE62217062680BB2F3EDF2F185074FE0220350DB29001C710F0450DAF466C5D819DC6D6A3340602DE9B6CB7DA8E17C90F798114FE9337B0574213FA5BCC0A319DBB4A7AC0CCA894E1F1",
"id": "8A3BFD2214B4C8271ED62648FCE9ADE4EE82EF01827CF7D1F7ED497549A368CC"
}
submit(signedTransaction: string): Promise<Object>
Submits a signed transaction. The transaction is not guaranteed to succeed; it must be verified with getTransaction.
Name | Type | Description |
---|---|---|
signedTransaction | string | A signed transaction as returned by sign. |
This method returns an object with the following structure:
Name | Type | Description |
---|---|---|
resultCode | string | The result code returned by calld. List of transaction responses |
resultMessage | string | Human-readable explanation of the status of the transaction. |
const signedTransaction = '12000322800000002400000017201B0086955368400000000000000C732102F89EAEC7667B30F33D0687BBA86C3FE2A08CCA40A9186C5BDE2DAA6FA97A37D874473045022100BDE09A1F6670403F341C21A77CF35BA47E45CDE974096E1AA5FC39811D8269E702203D60291B9A27F1DCABA9CF5DED307B4F23223E0B6F156991DB601DFB9C41CE1C770A726970706C652E636F6D81145E7B112523F68D2F5E879DB4EAC51C6698A69304';
return api.submit(signedTransaction)
.then(result => {/* ... */});
{
"resultCode": "tesSUCCESS",
"resultMessage": "The transaction was applied. Only final in a validated ledger."
}
generateAddress(): {address: string, secret: string}
Generate a new CALL Ledger address and corresponding secret.
Name | Type | Description |
---|---|---|
options | object | Optional Options to control how the address and secret are generated. |
options. algorithm | string |
Optional The digital signature algorithm to generate an address for. Can be ecdsa-secp256k1 (default) or ed25519 . |
options. entropy | array<integer> | Optional The entropy to use to generate the seed. |
This method returns an object with the following structure:
Name | Type | Description |
---|---|---|
address | address | A randomly generated Call account address. |
secret | secret string | The secret corresponding to the address . |
return api.generateAddress();
{
"address": "cnEuakn4SJtN5b2GBBAggAwLr7gxUpFKqk",
"secret": "sp6JS7f14BuwFY8Mw6bTtLKWauoUs"
}
signPaymentChannelClaim(channel: string, amount: string, privateKey: string): string
Sign a payment channel claim. The signature can be submitted in a subsequent PaymentChannelClaim transaction.
Name | Type | Description |
---|---|---|
channel | string | 256-bit hexadecimal channel identifier. |
amount | value | Amount of CALL authorized by the claim. |
privateKey | string | The private key to sign the payment channel claim. |
This method returns a signature string:
Name | Type | Description |
---|---|---|
string | The hexadecimal representation of a signature. |
const channel =
'3E18C05AD40319B809520F1A136370C4075321B285217323396D6FD9EE1E9037';
const amount = '.00001';
const privateKey =
'ACCD3309DB14D1A4FC9B1DAE608031F4408C85C73EE05E035B7DC8B25840107A';
return api.signPaymentChannelClaim(channel, amount, privateKey);
"3045022100B5C54654221F154347679B97AE7791CBEF5E6772A3F894F9C781B8F1B400F89F022021E466D29DC5AEB5DFAFC76E8A88D2E388EBD25A84143B6AC3B647F479CB89B7"
verifyPaymentChannelClaim(channel: string, amount: string, signature: string, publicKey: string): boolean
Verify a payment channel claim signature.
Name | Type | Description |
---|---|---|
channel | string | 256-bit hexadecimal channel identifier. |
amount | value | Amount of CALL authorized by the claim. |
signature | string | Signature of this claim. |
publicKey | string | Public key of the channel's sender |
This method returns true
if the claim signature is valid.
Name | Type | Description |
---|---|---|
boolean |
const channel =
'3E18C05AD40319B809520F1A136370C4075321B285217323396D6FD9EE1E9037';
const amount = '.00001';
const signature = "3045022100B5C54654221F154347679B97AE7791CBEF5E6772A3F894F9C781B8F1B400F89F022021E466D29DC5AEB5DFAFC76E8A88D2E388EBD25A84143B6AC3B647F479CB89B7";
const publicKey =
'02F89EAEC7667B30F33D0687BBA86C3FE2A08CCA40A9186C5BDE2DAA6FA97A37D8';
return api.verifyPaymentChannelClaim(channel, amount, signature, publicKey);
true
computeLedgerHash(ledger: Object): string
Compute the hash of a ledger.
The parameter to this method has the same structure as the return value of getLedger.Name | Type | Description |
---|---|---|
ledger | object | The ledger header to hash. |
ledger. stateHash | string | Hash of all state information in this ledger. |
ledger. closeTime | date-time string | The time at which this ledger was closed. |
ledger. closeTimeResolution | integer | Approximate number of seconds between closing one ledger version and closing the next one. |
ledger. closeFlags | integer | A bit-map of flags relating to the closing of this ledger. Currently, the ledger has only one flag defined for closeFlags : sLCF_NoConsensusTime (value 1). If this flag is enabled, it means that validators were in conflict regarding the correct close time for the ledger, but built otherwise the same ledger, so they declared consensus while "agreeing to disagree" on the close time. In this case, the consensus ledger contains a closeTime value that is 1 second after that of the previous ledger. (In this case, there is no official close time, but the actual real-world close time is probably 3-6 seconds later than the specified closeTime .) |
ledger. ledgerHash | string | Unique identifying hash of the entire ledger. |
ledger. ledgerVersion | integer | The ledger version of this ledger. |
ledger. parentLedgerHash | string | Unique identifying hash of the ledger that came immediately before this one. |
ledger. parentCloseTime | date-time string | The time at which the previous ledger was closed. |
ledger. totalDrops | value | Total number of drops (1/1,000,000th of an CALL) in the network, as a quoted integer. (This decreases as transaction fees cause CALL to be destroyed.) |
ledger. transactionHash | string | Hash of the transaction information included in this ledger. |
ledger. rawState | string | Optional A JSON string containing all state data for this ledger in calld JSON format. |
ledger. rawTransactions | string | Optional A JSON string containing calld format transaction JSON for all transactions that were validated in this ledger. |
ledger. stateHashes | array<string> | Optional An array of hashes of all state data in this ledger. |
ledger. transactionHashes | array<id> | Optional An array of hashes of all transactions that were validated in this ledger. |
ledger. transactions | array<getTransaction> | Optional Array of all transactions that were validated in this ledger. Transactions are represented in the same format as the return value of getTransaction. |
This method returns an uppercase hexadecimal string representing the hash of the ledger.
const ledger = {
"stateHash": "D9ABF622DA26EEEE48203085D4BC23B0F77DC6F8724AC33D975DA3CA492D2E44",
"closeTime": "2015-08-12T01:01:10.000Z",
"parentCloseTime": "2015-08-12T01:01:00.000Z",
"closeFlags": 0,
"closeTimeResolution": 10,
"ledgerVersion": 15202439,
"parentLedgerHash": "12724A65B030C15A1573AA28B1BBB5DF3DA4589AA3623675A31CAE69B23B1C4E",
"totalDrops": "99998831688050493",
"transactionHash": "325EACC5271322539EEEC2D6A5292471EF1B3E72AE7180533EFC3B8F0AD435C8"
};
return api.computeLedgerHash(ledger);
"F4D865D83EB88C1A1911B9E90641919A1314F36E1B099F8E95FE3B7C77BE3349"