UNPKG

jcc-ripple-utils

Version:

Toolkit of crossing chain from Ripple to SWTC chain

114 lines (113 loc) 3.12 kB
import { RippleAPI } from "ripple-lib"; import IMemo from "./model/memo"; import IPayment from "./model/payment"; import IPrepared from "./model/prepared"; import ISignature from "./model/signature"; import IWallet from "./model/wallet"; /** * ripple fingate * * @export * @class RippleFingate */ export default class RippleFingate { private _remote; constructor(node: string); /** * create ripple wallet * * @static * @returns {IWallet} * @memberof RippleFingate */ static createWallet(): IWallet; /** * check ripple address is valid or not * * @static * @param {string} address * @returns {boolean} return true if valid * @memberof RippleFingate */ static isValidAddress(address: string): boolean; /** * check ripple secret is valid or not * * @static * @param {string} secret * @returns {boolean} return true if valid * @memberof RippleFingate */ static isValidSecret(secret: string): boolean; /** * retrive address with secret * * @static * @param {string} secret * @returns {(string | null)} return address if valid, otherwise return null * @memberof RippleFingate */ static getAddress(secret: string): string | null; readonly remote: RippleAPI; /** * connect to ripple node server * * @returns * @memberof RippleFingate */ connect(): Promise<unknown>; /** * check if connected to ripple node server * * @returns {boolean} * @memberof RippleFingate return true if connected */ isConnected(): boolean; /** * disconnect from ripple node server * * @memberof RippleFingate */ disconnect(): void; /** * get xrp balance * * @param {string} address * @returns {Promise<string>} * @memberof RippleFingate */ getXrpBalance(address: string): Promise<string>; /** * sign payment data * * @param {string} txJSON * @param {string} secret * @returns {ISignature} * @memberof RippleFingate */ sign(txJSON: string, secret: string): ISignature; preparePayment(address: string, payment: IPayment): Promise<IPrepared>; submit(signedTransaction: string): Promise<unknown>; /** * format payment data * * @param {string} from ripple address * @param {string} destination ripple address * @param {string} amount amount * @param {string} memo memo * @returns {IPayment} * @memberof RippleFingate */ formatPayment(from: string, destination: string, amount: string, memo: string): IPayment; /** * transfer XRP * * @param {string} secret ripple secret * @param {string} destination ripple destination address * @param {string} amount transfer amount * @param {IMemo} memo transfer memo * @returns {Promise<string>} return hash if success * @memberof RippleFingate */ transfer(secret: string, destination: string, amount: string, memo: IMemo): Promise<string>; }