scrypt-ts
Advanced tools
Comparing version 1.3.24 to 1.3.25
@@ -54,6 +54,6 @@ "use strict"; | ||
tx['_inputAmount'] = undefined; | ||
if (tx._getUnspentValue() < estimateFee) { | ||
if (tx.getUnspentValue() < estimateFee) { | ||
throw new Error('invalid fee, fee too low.'); | ||
} | ||
if (tx._getUnspentValue() > estimateFee * 3) { | ||
if (tx.getUnspentValue() > estimateFee * 3) { | ||
throw new Error('invalid fee, fee too high.'); | ||
@@ -60,0 +60,0 @@ } |
@@ -34,11 +34,18 @@ "use strict"; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
// TODO: Mainnet? | ||
const url = `https://test-api.bitails.io/tx/${outpoint.txId}/output/${outpoint.outputIndex}`; | ||
const data = yield superagent_1.default.get(url).then((res) => res.body); | ||
return data.spent | ||
? { | ||
tx: yield provider.getTransaction(data.spentIn.txid), | ||
atInputIndex: data.spentIn.inputIndex, | ||
const network = provider.getNetwork() === bsv_1.bsv.Networks.mainnet ? 'main' : 'test'; | ||
const url = `https://api.whatsonchain.com/v1/bsv/${network}/tx/${outpoint.txId}/${outpoint.outputIndex}/spent`; | ||
return superagent_1.default | ||
.get(url) | ||
.then((r) => __awaiter(this, void 0, void 0, function* () { | ||
return { | ||
tx: yield provider.getTransaction(r.body.txid), | ||
atInputIndex: r.body.vin, | ||
}; | ||
})) | ||
.catch((e) => { | ||
if (e.response.status === 404) { | ||
return undefined; | ||
} | ||
: undefined; | ||
throw new Error(e.message); | ||
}); | ||
}); | ||
@@ -45,0 +52,0 @@ } |
@@ -83,4 +83,4 @@ "use strict"; | ||
function checkTxFee(tx, feePerKb) { | ||
const realFee = tx._getUnspentValue(); | ||
const estimateSize = Object.getPrototypeOf(tx)._estimateSize.apply(tx); | ||
const realFee = tx.getUnspentValue(); | ||
const estimateSize = tx.getEstimateSize(); | ||
const expectedFee = Math.max(1, Math.ceil(estimateSize / 1000 * feePerKb)); | ||
@@ -87,0 +87,0 @@ return realFee >= expectedFee; |
{ | ||
"name": "scrypt-ts", | ||
"version": "1.3.24", | ||
"version": "1.3.25", | ||
"description": "A toolset for building sCrypt smart contract applications on Bitcoin SV network written in typescript.", | ||
@@ -61,3 +61,3 @@ "main": "dist/index.js", | ||
"reflect-metadata": "^0.1.13", | ||
"scryptlib": "^2.1.31", | ||
"scryptlib": "^2.1.38", | ||
"socket.io-client": "^4.6.1", | ||
@@ -64,0 +64,0 @@ "superagent": "^8.0.9" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
687886
12030
Updatedscryptlib@^2.1.38