fix readRaw disconnection issue

This commit is contained in:
nitowa
2022-02-12 22:18:55 +01:00
parent 37948df6f7
commit 5d2305b4e6
3 changed files with 9 additions and 10 deletions
+7 -8
View File
@@ -141,15 +141,16 @@ export const writeRaw = async (api: RippleAPI, data: Memo, from:
export const readRaw = async (api: RippleAPI, hash: string): Promise<Memo> => {
let _api
if(!api.isConnected()){
_api = await cloneApi(api)
}else{
_api = api
while(!api.isConnected()){
try{
await api.connect()
}catch(e){
//retry
}
}
let tx
try{
tx = await _api.getTransaction(hash, {
tx = await api.getTransaction(hash, {
minLedgerVersion: 25235454
})
}catch(e){
@@ -157,8 +158,6 @@ export const readRaw = async (api: RippleAPI, hash: string): Promise<Memo> => {
console.log("READRAW ERR", e)
throw e
}
}finally{
await _api.disconnect()
}
if (!tx || !tx.specification || !tx.specification['memos'] || !tx.specification['memos'][0]) {