fix readRaw disconnection issue
This commit is contained in:
Generated
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xrpio",
|
"name": "xrpio",
|
||||||
"version": "0.0.4",
|
"version": "0.0.7",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xrpio",
|
"name": "xrpio",
|
||||||
"version": "0.0.7",
|
"version": "0.0.8",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://gitea.nitowa.xyz/npm-packages/xrpio.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> => {
|
export const readRaw = async (api: RippleAPI, hash: string): Promise<Memo> => {
|
||||||
let _api
|
while(!api.isConnected()){
|
||||||
if(!api.isConnected()){
|
try{
|
||||||
_api = await cloneApi(api)
|
await api.connect()
|
||||||
}else{
|
}catch(e){
|
||||||
_api = api
|
//retry
|
||||||
|
}
|
||||||
}
|
}
|
||||||
let tx
|
let tx
|
||||||
try{
|
try{
|
||||||
tx = await _api.getTransaction(hash, {
|
tx = await api.getTransaction(hash, {
|
||||||
minLedgerVersion: 25235454
|
minLedgerVersion: 25235454
|
||||||
})
|
})
|
||||||
}catch(e){
|
}catch(e){
|
||||||
@@ -157,8 +158,6 @@ export const readRaw = async (api: RippleAPI, hash: string): Promise<Memo> => {
|
|||||||
console.log("READRAW ERR", e)
|
console.log("READRAW ERR", e)
|
||||||
throw e
|
throw e
|
||||||
}
|
}
|
||||||
}finally{
|
|
||||||
await _api.disconnect()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!tx || !tx.specification || !tx.specification['memos'] || !tx.specification['memos'][0]) {
|
if (!tx || !tx.specification || !tx.specification['memos'] || !tx.specification['memos'][0]) {
|
||||||
|
|||||||
Reference in New Issue
Block a user