1.0.0-beta.5 • Published 3 years ago

@quantnetwork/overledger-dlt-ripple v1.0.0-beta.5

Weekly downloads
8
License
Apache-2.0
Repository
github
Last release
3 years ago

@quantnetwork/overledger-dlt-ripple

Overledger SDK module for interaction with the Ripple distributed ledger technology.

Installation

Install using npm:

npm install @quantnetwork/overledger-dlt-ripple

Or, if you prefer using yarn:

yarn add @quantnetwork/overledger-dlt-ripple

API Reference

Modules

Typedefs

overledger-dlt-ripple

overledger-dlt-ripple.default

Development package for Ripple (XRP Ledger).

overledger-dlt-ripple~Ripple

new Ripple(sdk)

ParamType
sdkany

ripple.name

Name of the DLT

ripple.symbol

Symbol of the DLT

ripple.createAccount()

Create an XRP account

Returns: Account - (privateKey, address)

ripple.setAccount(accountInfo)

ParamTypeDescription
accountInfoAccountThe standardised account information

Set an account for signing for a specific DLT

ripple.buildTransaction(thisTransaction)

ParamTypeDescription
thisTransactionTransactionXRPRequestdetails on the information to include in this transaction for the XRP distributed ledger

Takes the Overledger definition of a transaction and converts it into a specific XRP transaction

Returns: Transaction - the XRP transaction

ripple._transactionValidation(thisTransaction)

ParamDescription
thisTransactionThe transaction request

validates an OVL transactionRequest according to XRP specific rules

ripple._sign(thisTransaction)

ParamTypeDescription
thisTransactionTransactionRequestan instantiated overledger definition of an XRP transaction

Takes in an overledger definition of a transaction for XRP, converts it into a form that the XRP distributed ledger will understand, and then signs the transaction

ripple._buildSmartContractQuery(dltAddress, contractQueryDetails)

ParamTypeDescription
dltAddressstringthe user's XRP address
contractQueryDetailsObjectthe definition of the smart contract function the user wants to interact with, including information on what parameters to use in the function call.

Allows a user to build a smart contract query for the XRP distributed ledger (currently not supported for XRP)

Returns: Object - success indicates if this query building was correct, if yes then it will be in the response field of the object

ripple._smartContractQueryValidation(contractQueryDetails)

ParamDescription
contractQueryDetailsthe query details

validates an OVL smart contract query according to XRP specific rules

Returns: Object - success indicates if this query building was correct, if yes then it will be in the response field of the object

ripple.computeFeePrice(initialFee, transactionType, fulfillment)

ParamDescription
initialFee
transactionTypewhat type of transaction is this
fulfillmentis there an escrow fulfillment to be added to the transaction

ripple.computeEscrowConditionFulfillment(hashAlgorithmInput)

Param
hashAlgorithmInput

Takes a string hash algorith input and generates both the bytecode version of the condition to be placed on the ledger and also the bytecode version of its pre-image fulfillment

ripple.isValidISODateFormat(dateTime)

ParamDescription
dateTimethe date to check

Checking the given parameter passes the ISODate format

ripple.isValidDate(dateTimeCreate, dateTimeCancel)

ParamDescription
dateTimeCreatethe escrow creation time
dateTimeCancelthe escrow cancelation time

Checking the given parameter passes the ISODate format

ripple.isValidRippleAddress(address)

ParamDescription
addressthe address to check

AtomicSwapXRPParams

Properties

NameTypeDescription
allowCancelAfterObjectfrom when can the escrow be executed? In ISOString format
allowExecuteAfterObjectfrom when can the escrow be cancelled? In ISOString format
hashAlgorithmInputStringObjectthis is the sha256 hash algorithm input as a string. It will NOT be placed on the ledger when creating a transaction.
hashAlgorithmConditionObjectthis is if there has been a hash string placed onto another chain and now we want to add it to this chain.
escrowSequencestringThe sequence number of the escrow you are executing or cancelling
hashAlgorithmFulfillmentstringThis is the value to unlock the escrow (the input to the sha256 hash algorithm)
ownerstringThe address that funded the escrow

An object used to describe the atomic swap params required for XRP

TrustlineXRPRequest

Properties

NameTypeDescription
subTypeObjecta redefinition of the TransactionRequest object, to add more XRP specific information
feePricestringthe fee to pay for this transaction to enter the XRP ledger. It is denoted in drops where the current minimum allowed is 12.
maxLedgerVersionstringThe maximum ledger version the transaction can be included in

A generic object used to describe an Overledger transaction request for the XRP Ledger. Note that this object inherits many parameters from TransactionAccountsRequest.