fix readRaw disconnection issue
This commit is contained in:
@@ -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]) {
|
||||
|
||||
Reference in New Issue
Block a user