gn-provider 1.1.7 → 1.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/gn-provider.js +34 -28
- package/package.json +1 -1
package/dist/gn-provider.js
CHANGED
|
@@ -256,6 +256,40 @@ class GNProvider extends abstract_provider_1.Provider {
|
|
|
256
256
|
throw new Error(`Error fetching transaction: ${error.message}`);
|
|
257
257
|
}
|
|
258
258
|
});
|
|
259
|
+
/*private needIgnoreError(inMsg: string): boolean {
|
|
260
|
+
if (inMsg.includes('Transaction already in the mempool')) return true;
|
|
261
|
+
if (inMsg.includes('txn-already-known')) return true;
|
|
262
|
+
return false;
|
|
263
|
+
}*/
|
|
264
|
+
this.needIgnoreError = (inMsg) => {
|
|
265
|
+
if (inMsg.includes('Transaction already in the mempool'))
|
|
266
|
+
return true;
|
|
267
|
+
if (inMsg.includes('txn-already-known'))
|
|
268
|
+
return true;
|
|
269
|
+
return false;
|
|
270
|
+
};
|
|
271
|
+
//private friendlyBIP22RejectionMsg(inMsg: string): string {
|
|
272
|
+
this.friendlyBIP22RejectionMsg = (inMsg) => {
|
|
273
|
+
const messages = {
|
|
274
|
+
'bad-txns-vin-empty': 'Transaction is missing inputs.',
|
|
275
|
+
'bad-txns-vout-empty': 'Transaction is missing outputs.',
|
|
276
|
+
'bad-txns-oversize': 'Transaction is too large.',
|
|
277
|
+
'bad-txns-vout-negative': 'Transaction output value is negative.',
|
|
278
|
+
'bad-txns-vout-toolarge': 'Transaction output value is too large.',
|
|
279
|
+
'bad-txns-txouttotal-toolarge': 'Transaction total output value is too large.',
|
|
280
|
+
'bad-txns-prevout-null': 'Transaction inputs previous TX reference is null.',
|
|
281
|
+
'bad-txns-inputs-duplicate': 'Transaction contains duplicate inputs.',
|
|
282
|
+
'bad-txns-inputs-too-large': 'Transaction inputs too large.',
|
|
283
|
+
'bad-txns-fee-negative': 'Transaction network fee is negative.',
|
|
284
|
+
'bad-txns-fee-outofrange': 'Transaction network fee is out of range.',
|
|
285
|
+
'mandatory-script-verify-flag-failed': 'Script evaluation failed.'
|
|
286
|
+
};
|
|
287
|
+
for (const [key, msg] of Object.entries(messages)) {
|
|
288
|
+
if (inMsg.includes(key))
|
|
289
|
+
return msg;
|
|
290
|
+
}
|
|
291
|
+
return inMsg;
|
|
292
|
+
};
|
|
259
293
|
// Inicializa propiedades primero
|
|
260
294
|
this._network = network;
|
|
261
295
|
this._apiKey = apiKey;
|
|
@@ -269,33 +303,5 @@ class GNProvider extends abstract_provider_1.Provider {
|
|
|
269
303
|
// Conexión directa
|
|
270
304
|
this.connect().catch(console.error);
|
|
271
305
|
}
|
|
272
|
-
needIgnoreError(inMsg) {
|
|
273
|
-
if (inMsg.includes('Transaction already in the mempool'))
|
|
274
|
-
return true;
|
|
275
|
-
if (inMsg.includes('txn-already-known'))
|
|
276
|
-
return true;
|
|
277
|
-
return false;
|
|
278
|
-
}
|
|
279
|
-
friendlyBIP22RejectionMsg(inMsg) {
|
|
280
|
-
const messages = {
|
|
281
|
-
'bad-txns-vin-empty': 'Transaction is missing inputs.',
|
|
282
|
-
'bad-txns-vout-empty': 'Transaction is missing outputs.',
|
|
283
|
-
'bad-txns-oversize': 'Transaction is too large.',
|
|
284
|
-
'bad-txns-vout-negative': 'Transaction output value is negative.',
|
|
285
|
-
'bad-txns-vout-toolarge': 'Transaction output value is too large.',
|
|
286
|
-
'bad-txns-txouttotal-toolarge': 'Transaction total output value is too large.',
|
|
287
|
-
'bad-txns-prevout-null': 'Transaction inputs previous TX reference is null.',
|
|
288
|
-
'bad-txns-inputs-duplicate': 'Transaction contains duplicate inputs.',
|
|
289
|
-
'bad-txns-inputs-too-large': 'Transaction inputs too large.',
|
|
290
|
-
'bad-txns-fee-negative': 'Transaction network fee is negative.',
|
|
291
|
-
'bad-txns-fee-outofrange': 'Transaction network fee is out of range.',
|
|
292
|
-
'mandatory-script-verify-flag-failed': 'Script evaluation failed.'
|
|
293
|
-
};
|
|
294
|
-
for (const [key, msg] of Object.entries(messages)) {
|
|
295
|
-
if (inMsg.includes(key))
|
|
296
|
-
return msg;
|
|
297
|
-
}
|
|
298
|
-
return inMsg;
|
|
299
|
-
}
|
|
300
306
|
}
|
|
301
307
|
exports.GNProvider = GNProvider;
|