CirquityAPI

CirquityAPI

new CirquityAPI(optsopt)

Initializes a new CirquityAPI object
Source:
Parameters:
Name Type Attributes Description
opts Object <optional>
Configuration options
Name Type Attributes Default Description
host string <optional>
127.0.0.1 the address of the daemon
port string <optional>
8070 the RPC port number of the daemon
timeout number <optional>
30000 the timeout to use during RPC calls
ssl boolean <optional>
false whether the daemon uses SSL (HTTPS) or not
password string the password for the RPC interface
defaultMixin number <optional>
false the default mixin count to use
defaultFee number <optional>
0.1 the default transaction fee to use
decimalDivisor number <optional>
100 the decimal divisor of atomic amounts
defaultUnlockTime number <optional>
0 the default unlock time for new transactions
userAgent string <optional>
cirquity-rpc/version the user agent string to use with requests
keepAlive boolean <optional>
true whether the underlying HTTP(s) connection should be kept alive and reused

Methods

(async) addresses() → {Promise.<CirquityAPI.Addresses>}

Gets a list of all addresses in the wallet container
Source:
Returns:
Type:
Promise.<CirquityAPI.Addresses>
resolves if success else rejects with error

(async) balance(addressopt) → {Promise.<CirquityAPI.Balance>}

Get the balance for the entire wallet container or the specified address
Source:
Parameters:
Name Type Attributes Default Description
address string <optional>
false the wallet address to check or false for the entire container
Returns:
Type:
Promise.<CirquityAPI.Balance>
resolves if success else rejects with error

(async) balances() → {Promise.<Array.<CirquityAPI.Balance>>}

Get the balance for every address in the container
Source:
Returns:
Type:
Promise.<Array.<CirquityAPI.Balance>>
resolves if success else rejects with error

(async) close() → {Promise}

Closes the wallet container that is currently open
Source:
Returns:
Type:
Promise
resolves if success else rejects with error

(async) create(filename, password, daemonHostopt, daemonPortopt, daemonSSLopt) → {Promise}

Creates a new wallet container
Source:
Parameters:
Name Type Attributes Default Description
filename string the filename for the new wallet container
password string the password for the wallet container
daemonHost string <optional>
127.0.0.1 the node to use for the wallet container
daemonPort number <optional>
11898 the node port to use for the wallet container
daemonSSL boolean <optional>
false if the node uses SSL
Returns:
Type:
Promise
resolves if success else rejects with error

(async) createAddress() → {Promise.<CirquityAPI.Wallet>}

Creates a new, random address in the wallet container
Source:
Returns:
Type:
Promise.<CirquityAPI.Wallet>
resolves if success else rejects with error

(async) createIntegratedAddress(address, paymentId) → {Promise.<string>}

Creates an integrated address from an address and payment ID
Source:
Parameters:
Name Type Description
address string the address to use to generate the integrated address
paymentId string the payment ID to use to generate the integrated address
Returns:
Type:
Promise.<string>
resolves with the integrated address if success else rejects with error

(async) deleteAddress(address) → {Promise}

Deletes the given subwallet from the container
Source:
Parameters:
Name Type Description
address string the address to use to generate the integrated address
Returns:
Type:
Promise
resolves if success else rejects with error

fromAtomicUnits(amount) → {number}

Converts atomic units amounts to human readable amounts
Source:
Parameters:
Name Type Description
amount number the amount in atomic units
Returns:
Type:
number
the amount in human readable form

(async) getNode() → {Promise.<CirquityAPI.NodeInfo>}

Gets the node address, port, fee, and fee address
Source:
Returns:
Type:
Promise.<CirquityAPI.NodeInfo>
resolves if success else rejects with error

(async) importAddress(privateSpendKey, scanHeightopt) → {Promise.<string>}

Imports a subwallet with the given private spend key
Source:
Parameters:
Name Type Attributes Default Description
privateSpendKey string the private spend key of the wallet to import
scanHeight number <optional>
0 the height to start scanning from upon import
Returns:
Type:
Promise.<string>
results with the wallet address if success else rejects with error

(async) importDeterministic(walletIndex, scanHeightopt) → {Promise.<string>}

Imports a determinisic subwallet with the given wallet index number
Source:
Parameters:
Name Type Attributes Default Description
walletIndex number the index of the deterministic subwallet
scanHeight number <optional>
0 the height to start scanning from upon import
Returns:
Type:
Promise.<string>
results with the wallet address if success else rejects with error

(async) importKey(filename, password, prviateViewKey, privateSpendKey, scanHeightopt, daemonHostopt, daemonPortopt, daemonSSLopt) → {Promise}

Imports a new wallet container using the specified keys and optional params
Source:
Parameters:
Name Type Attributes Default Description
filename string the filename of the new wallet container
password string the password of the new wallet container
prviateViewKey string the private view key to import
privateSpendKey string the private spend key to import
scanHeight number <optional>
0 the height to import the wallet from
daemonHost string <optional>
127.0.0.1 the host of the node to use
daemonPort number <optional>
11898 the port of the node to use
daemonSSL boolean <optional>
false whether the node uses SSL
Returns:
Type:
Promise
resolves upon success else rejects with error

(async) importSeed(filename, password, mnemonicSeed, scanHeightopt, daemonHostopt, daemonPortopt, daemonSSLopt) → {Promise}

Imports a new wallet container using the specified keys and optional params
Source:
Parameters:
Name Type Attributes Default Description
filename string the filename of the new wallet container
password string the password of the new wallet container
mnemonicSeed string the mnemonic seed of the wallet to import
scanHeight number <optional>
0 the height to import the wallet from
daemonHost string <optional>
127.0.0.1 the host of the node to use
daemonPort number <optional>
11898 the port of the node to use
daemonSSL boolean <optional>
false whether the node uses SSL
Returns:
Type:
Promise
resolves upon success else rejects with error

(async) importViewAddress(publicSpendKey, scanHeightopt) → {Promise.<string>}

Imports a view only subwallet with the given publicSpendKey
Source:
Parameters:
Name Type Attributes Default Description
publicSpendKey string the public spend key of the subwallet to import
scanHeight number <optional>
0 the height to import the wallet from
Returns:
Type:
Promise.<string>
resolves with address upon success else rejects with error

(async) importViewOnly(filename, password, prviateViewKey, address, scanHeightopt, daemonHostopt, daemonPortopt, daemonSSLopt) → {Promise}

Imports a new view-only wallet container using the specified key and optional params
Source:
Parameters:
Name Type Attributes Default Description
filename string the filename of the new wallet container
password string the password of the new wallet container
prviateViewKey string the private view key to import
address string the wallet address
scanHeight number <optional>
0 the height to import the wallet from
daemonHost string <optional>
127.0.0.1 the host of the node to use
daemonPort number <optional>
11898 the port of the node to use
daemonSSL boolean <optional>
false whether the node uses SSL
Returns:
Type:
Promise
resolves upon success else rejects with error

(async) keys(addressopt) → {Promise.<(string|CirquityAPI.Wallet)>}

Gets the wallet containers shared private view key, or if the address is specified, returns the public and private spend keys for the given address
Source:
Parameters:
Name Type Attributes Description
address string <optional>
the wallet address
Returns:
Type:
Promise.<(string|CirquityAPI.Wallet)>
resolves upon success else rejects with error

(async) keysMnemonic(address) → {Promise.<string>}

Gets the mnemonic seed for the given address, if possible
Source:
Parameters:
Name Type Description
address string the wallet address
Returns:
Type:
Promise.<string>
resolves with the mnemonic seed upon success else rejects with error

newDestination(address, amount) → {CirquityAPI.TransferDestination}

Creates a new output destination object
Source:
Parameters:
Name Type Description
address string the address of the recipient
amount number the human readable amount to send to the recipient
Returns:
Type:
CirquityAPI.TransferDestination
a transfer destination object

(async) open(filename, password, daemonHostopt, daemonPortopt, daemonSSLopt) → {Promise}

Open an already existing wallet
Source:
Parameters:
Name Type Attributes Default Description
filename string the filename of the wallet container
password string the password of the wallet container
daemonHost string <optional>
127.0.0.1 the host of the node to use
daemonPort number <optional>
11898 the port of the node to use
daemonSSL boolean <optional>
false whether the node uses SSL
Returns:
Type:
Promise
resolves upon success else rejects with error

(async) primaryAddress() → {Promise.<string>}

Gets the primary address of the wallet container
Source:
Returns:
Type:
Promise.<string>
resolves with the wallet address or rejects with error

(async) reset(scanHeightopt) → {Promise}

Resets and saves the wallet, beginning scanning from the height given, if any
Source:
Parameters:
Name Type Attributes Default Description
scanHeight number <optional>
0 the scan height at which to beging scanning
Returns:
Type:
Promise
resolves upon success else rejects with error

(async) save() → {Promise}

Saves the wallet container currently open to disk
Source:
Returns:
Type:
Promise
resolves upon success else rejects with error

(async) sendAdvanced(destinations, mixinopt, feeopt, sourceAddressesopt, paymentIdopt, changeAddressopt, unlockTimeopt) → {Promise.<string>}

Sends a transaction
Source:
Parameters:
Name Type Attributes Description
destinations CirquityAPI.TransferDestination the destinations of the transaction
mixin number <optional>
the number of mixins to use
fee number <optional>
the transaction fee to payload
sourceAddresses Array.<string> <optional>
the source addresses, if any, of the funds for the transaction
paymentId string <optional>
the payment ID to include with the transaction
changeAddress string <optional>
the address to send transaction change to
unlockTime number <optional>
the unlock time of the new transaction
Returns:
Type:
Promise.<string>
resolves with the transaction hash else rejects with error. This method resolving does not guarantee the completion of the transaction on the network.

(async) sendBasic(address, amount, paymentIdopt) → {Promise.<string>}

Sends a transaction
Source:
Parameters:
Name Type Attributes Description
address string the address to send funds to
amount number the amount to send in the transaction
paymentId string <optional>
the payment ID to include with the transaction
Returns:
Type:
Promise.<string>
resolves with the transaction hash else rejects with error. This method resolving does not guarantee the completion of the transaction on the network.

(async) sendFusionAdvanced(address, mixinopt, sourceAddressesopt) → {Promise.<string>}

Sends a fusion ransaction
Source:
Parameters:
Name Type Attributes Description
address string the address to send funds to
mixin number <optional>
the number of mixins to use in the fusion transaction
sourceAddresses Array.<string> <optional>
the source addresses, if any, of the funds for the fusion transaction
Returns:
Type:
Promise.<string>
resolves with the transaction hash else rejects with error. This method resolving does not guarantee the completion of the transaction on the network.

(async) sendFusionBasic() → {Promise.<string>}

Sends a fusion ransaction
Source:
Returns:
Type:
Promise.<string>
resolves with the transaction hash else rejects with error. This method resolving does not guarantee the completion of the transaction on the network.

(async) setNode(daemonHost, daemonPort, daemonSSLopt) → {Promise}

Sets the node to connect use in syncing operations
Source:
Parameters:
Name Type Attributes Description
daemonHost string the host of the node to use
daemonPort number the port of the node to use
daemonSSL boolean <optional>
whether the node uses SSL
Returns:
Type:
Promise
resolves upon success else rejects with error

(async) status() → {Promise.<CirquityAPI.StatusInfo>}

Get the wallet sync status, peer count, and hashrate
Source:
Returns:
Type:
Promise.<CirquityAPI.StatusInfo>
resolves upon success else rejects with error

toAtomicUnits(amount) → {number}

Converts human readable units to atomic units
Source:
Parameters:
Name Type Description
amount number the amount in human readable units
Returns:
Type:
number
the amount in atomic units form

(async) transactionByHash(hash) → {Promise.<CirquityAPI.TransactionInfo>}

Gets details on the given transaction, if found
Source:
Parameters:
Name Type Description
hash string the transaction hash
Returns:
Type:
Promise.<CirquityAPI.TransactionInfo>
resolves with transaction info else rejects with error

(async) transactionPrivateKey(hash) → {Promise.<string>}

Gets the transaction private key of the given transaction. This can be used to audit a transaction.
Source:
Parameters:
Name Type Description
hash string the transaction hash
Returns:
Type:
Promise.<string>
resolves with the transaction private key else rejects with error

(async) transactions(startHeightopt, endHeightopt) → {Promise.<Array.<CirquityAPI.TransactionInfo>>}

Gets a list of all transactions in the wallet container and/or within the supplied constraints
Source:
Parameters:
Name Type Attributes Description
startHeight number <optional>
the height to return transactions from
endHeight number <optional>
the height to return transactions until
Returns:
Type:
Promise.<Array.<CirquityAPI.TransactionInfo>>
resolves with array of transaction info or rejects with error

(async) transactionsByAddress(address, startHeightopt, endHeightopt) → {Promise.<Array.<CirquityAPI.TransactionInfo>>}

Gets a list of transactions in the wallet container by address and/or within the supplied constraints
Source:
Parameters:
Name Type Attributes Description
address string the wallet address
startHeight number <optional>
the height to return transactions from
endHeight number <optional>
the height to return transactions until
Returns:
Type:
Promise.<Array.<CirquityAPI.TransactionInfo>>
resolves with array of transaction info or rejects with error

(async) unconfirmedTransactions(addressopt) → {Promise.<Array.<CirquityAPI.TransactionInfo>>}

Gets a list of all unconfirmed, outgoing transactions in the wallet container
Source:
Parameters:
Name Type Attributes Description
address string <optional>
the wallet address
Returns:
Type:
Promise.<Array.<CirquityAPI.TransactionInfo>>
resolves with array of transaction info or rejects with error

(async) validateAddress(address) → {Promise.<Array.<CirquityAPI.ValidationInfo>>}

Validates a given address
Source:
Parameters:
Name Type Description
address string the wallet address
Returns:
Type:
Promise.<Array.<CirquityAPI.ValidationInfo>>
resolves with validation information or rejects with error

Type Definitions

Addresses

Properties:
Type Description
Array.<string> a list of wallet addresses
Source:

Balance

Properties:
Name Type Attributes Description
address string <optional>
the wallet address
locked number the locked balance amount
unlocked number the unlocked balance amount
Source:

NodeInfo

Properties:
Name Type Description
daemonHost string the host of the connected node
daemonPort number the port of the connected node
daemonSSL boolean if the connected node uses SSL
nodeAddress string the node fee address
nodeFee number the node fee amount
Source:

StatusInfo

Properties:
Name Type Description
walletBlockCount number how many blocks the wallet has synced
localDaemonBlockCount number how many blocks the node has synced
networkBlockCount number how many blocks the network has synced
peerCount number the number of peers the node is connected to
hashrate number the current estimated network hashrate
isViewWallet boolean whether the current wallet container is a view-only wallet
subWalletCount number how many subwallets exist in the wallet container
Source:

TransactionInfo

Properties:
Name Type Attributes Description
blockHeight number <optional>
the block height of the block containing the transaction
fee number the network fee of the transaction
hash string the transaction hash
isCoinbaseTransaction boolean whether the transaction is a coinbase transaction
paymentID string the payment ID of the transaction if any
timestamp number <optional>
the timestamp of the transaction
unlockTime number the unlock time (or block height) of the transaction
transfers CirquityAPI.TransferDestination a transfer destination object descripting where the funds went
Source:

TransferDestination

Properties:
Name Type Description
address string the address of the recipient
amount number the atomic amount to send to the recipient
Source:

ValidationInfo

Properties:
Name Type Description
isIntegrated boolean whether the address is an integrated address
paymentID string the payment ID if the address is an integrated address
actualAddress string the wallet address supplied
publicSpendKey string the public spend key of the address
publicViewKey string the public view key of the address
Source:

Wallet

Properties:
Name Type Attributes Description
address string <optional>
the wallet address
privateSpendKey string the wallet private spend key
publicSpendKey string the wallet public spend key
walletIndex number the deterministic wallet index
Source: