# XRPL

## **getXrpSignedTransaction**

**This function for :**

* `.XRP` - xrpl (XRP)
* `.XRP_TA` - xrp ta
* `.XRP_TESTNET` - xrpl testnet (XRPt)
* `.XRP_TA_TESTNET` - xrp ta testnet

### **Parameters**

* coinType: xrp networks coin type
* xrpTransaction: ([XrpTransation](#class-xrptransaction))xrp transaction parameter

#### **class XrpTransaction**

<table><thead><tr><th width="210.33333333333331">Name</th><th width="129">Type</th><th>Description</th></tr></thead><tbody><tr><td>addressPath</td><td><code>String</code></td><td>sign key path for xrp transaction</td></tr><tr><td>sourceAddress</td><td><code>String</code></td><td>Source address of xrp transaction</td></tr><tr><td>destinationAddress</td><td><code>String</code></td><td>Destination addresse of xrp transaction</td></tr><tr><td>amount</td><td><code>UInt64</code></td><td>Amount to be send ( Drops unit value)</td></tr><tr><td>fee</td><td><code>UInt64</code></td><td>Fee of this transaction ( Drops unit value)</td></tr><tr><td>sequence</td><td><code>UInt32</code></td><td>The sequence number, relative to the initiating account, of xrp transaction</td></tr><tr><td>destinationTag</td><td><code>UInt64</code></td><td>Destination tag of xrp transaction</td></tr></tbody></table>

### **Returns**

* result: (Bool) `true` if successful, `false` if error occurred
* txData: signed transaction

**Example**

```swift
let xrpTransaction : XrpTransaction = XrpTransaction(addressPath: "", sourceAddress: "", destinationAddress: "", amount: 0, fee: 0, sequence: 0, destinationTag: 0 )
  
// test data
xrpTransaction.addressPath = "m/44'/144'/0'/0/0"
xrpTransaction.sourceAddress = "rsHXBk5vnswg5SZxUQCEPYVnmrd4PaZ7Ah"
xrpTransaction.destinationAddress = "rsHXBk5vnswg5SZxUQCEPYVnmrd4PaZ7Ah"
xrpTransaction.amount = 2
xrpTransaction.fee = 10
xrpTransaction.sequence = 11
xrpTransaction.destinationTag = 0
  
DcentMgr.getXrpSignedTransaction(coinType:.XRP, xrpTransaction:xrpTransaction){ (result, txData) in
    print("XRP Transaction closure")
    if result == false {
        print("FAIL !!!")
    }else{
        print(txData)
    }
}
```

## **getXrpSignedTransactionWithUnsignedTx**

**This fuction for :**

* `.XRP` - xrpl (XRP)
* `.XRP_TA` - xrp ta
* `.XRP_TESTNET` - xrpl testnet (XRPt)
* `.XRP_TA_TESTNET` - xrp ta testnet

### **Parameters**

* coinType: xrp networks coin type
* xrpTransaction: (XrpTransationWithUnsigedTx)xrp transaction with unsiged tx parameter

#### class XrpTransationWithUnsigedTx

| Name        | Type     | Description                       |
| ----------- | -------- | --------------------------------- |
| addressPath | `String` | sign key path for xrp transaction |
| unsigned    | `String` | unsigned xrp transaction data     |

**Returns**

* result: (Bool) `true` if successful, `false` if error occurred
* coinType: xrp networks coin type
* sign: signed transaction
* pubkey: public key used to signed transaction
* accountId: xrp transaction accountId

**Example**

```swift
let xrpTransaction : XrpTransactionWithUnsigedTx = XrpTransactionWithUnsigedTx(addressPath: "m/44'/144'/0'/0/0", unsigned: "1200002280000000240238634E2E00000000201B023863E161400000000098968068400000000000000A8114FD970F4612987680F4008BA53ED6FD87BE0DAAF983141DEE2154B117FB47FCF4F19CD983D9FCBB894FF7")
  
DcentMgr.getXrpSignedTransactionWithUnsignedTx(coinType: .XRP, xrpTransaction: xrpTransaction)  { (result, coinType, sign, pubkey, accoutId)  in
    print("XRP Transaction with unsigned Tx closure")
    if result == false {
        print("FAIL !!!")
    }else{
        print(coinType)
	print(sign)
	print(pubkey)
	print(accountId)
    }
}
```
