import { coin as COIN } from "@coolwallet/core" ; import * as xrpSign from "./sign" ; import * as txUtil from "./utils/tracsactionUtil" ; import * as types from "./config/types" ; import * as params from "./config/params" ; export default class XRP extends COIN . ECDSACoin implements COIN . Coin { constructor ( ) { super ( params . COIN_TYPE ) ; } /**
     * Get XRP address by index
     */ async getAddress ( transport , appPrivateKey , appId , addressIndex ) { const publicKey = await this . getPublicKey ( transport , appPrivateKey , appId , addressIndex ) ; return txUtil . pubKeyToAddress ( publicKey ) ; } async getAddressByAccountKey ( accPublicKey , accChainCode , addressIndex ) { const publicKey = await this . getAddressPublicKey ( accPublicKey , accChainCode , addressIndex ) ; return txUtil . pubKeyToAddress ( publicKey ) ; } description async signTransaction ( signTxData ) { const payment = signTxData . payment ; payment . TransactionType = "Payment" ; payment . Flags = 2147483648 ; if ( ! payment . SigningPubKey ) { payment . SigningPubKey = await this . getPublicKey ( signTxData . transport , signTxData . appPrivateKey , signTxData . appId , signTxData . addressIndex ) ; payment . SigningPubKey = payment . SigningPubKey . toUpperCase ( ) ; } if ( ! payment . Account ) { payment . Account = txUtil . pubKeyToAddress ( payment . SigningPubKey ) ; } return xrpSign . signPayment ( signTxData , payment ) ; } }