diff --git a/package-lock.json b/package-lock.json index f50c9b8..5aacee7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "xrpio", - "version": "0.0.4", + "version": "0.0.7", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index ef3ba38..74010ea 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xrpio", - "version": "0.0.7", + "version": "0.0.8", "repository": { "type": "git", "url": "https://gitea.nitowa.xyz/npm-packages/xrpio.git" diff --git a/src/xrpIO/ripple-binding.ts b/src/xrpIO/ripple-binding.ts index 082cdf0..ce63498 100644 --- a/src/xrpIO/ripple-binding.ts +++ b/src/xrpIO/ripple-binding.ts @@ -141,15 +141,16 @@ export const writeRaw = async (api: RippleAPI, data: Memo, from: export const readRaw = async (api: RippleAPI, hash: string): Promise => { - 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 => { console.log("READRAW ERR", e) throw e } - }finally{ - await _api.disconnect() } if (!tx || !tx.specification || !tx.specification['memos'] || !tx.specification['memos'][0]) {