fix readRaw disconnection issue
This commit is contained in:
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xrpio",
|
||||
"version": "0.0.4",
|
||||
"version": "0.0.7",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
||||
+1
-1
@@ -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"
|
||||
|
||||
@@ -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