@bsv/wallet-toolbox 1.6.21 → 1.6.22
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/CHANGELOG.md +4 -0
- package/mobile/out/src/signer/methods/buildSignableTransaction.d.ts.map +1 -1
- package/mobile/out/src/signer/methods/buildSignableTransaction.js +2 -1
- package/mobile/out/src/signer/methods/buildSignableTransaction.js.map +1 -1
- package/mobile/out/src/storage/methods/createAction.d.ts.map +1 -1
- package/mobile/out/src/storage/methods/createAction.js +4 -3
- package/mobile/out/src/storage/methods/createAction.js.map +1 -1
- package/out/src/signer/methods/buildSignableTransaction.d.ts.map +1 -1
- package/out/src/signer/methods/buildSignableTransaction.js +2 -1
- package/out/src/signer/methods/buildSignableTransaction.js.map +1 -1
- package/out/src/storage/methods/createAction.d.ts.map +1 -1
- package/out/src/storage/methods/createAction.js +4 -3
- package/out/src/storage/methods/createAction.js.map +1 -1
- package/out/tsconfig.all.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/signer/methods/buildSignableTransaction.ts +2 -2
- package/src/storage/methods/createAction.ts +4 -4
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
StorageCreateTransactionSdkInput,
|
|
6
6
|
StorageCreateTransactionSdkOutput
|
|
7
7
|
} from '../../sdk/WalletStorage.interfaces'
|
|
8
|
-
import { ValidCreateActionArgs, ValidCreateActionInput } from '../../sdk/validationHelpers'
|
|
8
|
+
import { validateSatoshis, ValidCreateActionArgs, ValidCreateActionInput } from '../../sdk/validationHelpers'
|
|
9
9
|
import { WERR_INVALID_PARAMETER } from '../../sdk/WERR_errors'
|
|
10
10
|
import { asBsvSdkScript, verifyTruthy } from '../../utility/utilityHelpers'
|
|
11
11
|
import { KeyPair } from '../../sdk/types'
|
|
@@ -143,7 +143,7 @@ export function buildSignableTransaction(
|
|
|
143
143
|
sequence: 0xffffffff
|
|
144
144
|
}
|
|
145
145
|
tx.addInput(inputToAdd)
|
|
146
|
-
totalChangeInputs +=
|
|
146
|
+
totalChangeInputs += validateSatoshis(storageInput.sourceSatoshis, 'storageInput.sourceSatoshis')
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
149
|
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
StorageGetBeefOptions,
|
|
28
28
|
StorageProvidedBy
|
|
29
29
|
} from '../../sdk/WalletStorage.interfaces'
|
|
30
|
-
import { ValidCreateActionArgs, ValidCreateActionInput, ValidCreateActionOutput } from '../../sdk/validationHelpers'
|
|
30
|
+
import { ValidCreateActionArgs, ValidCreateActionInput, ValidCreateActionOutput, validateSatoshis } from '../../sdk/validationHelpers'
|
|
31
31
|
import { WERR_INTERNAL, WERR_INVALID_PARAMETER } from '../../sdk/WERR_errors'
|
|
32
32
|
import {
|
|
33
33
|
randomBytesBase64,
|
|
@@ -417,7 +417,7 @@ async function createNewOutputs(
|
|
|
417
417
|
|
|
418
418
|
const ro: StorageCreateTransactionSdkOutput = {
|
|
419
419
|
vout: verifyInteger(o.vout),
|
|
420
|
-
satoshis:
|
|
420
|
+
satoshis: validateSatoshis(o.satoshis, 'o.satoshis'),
|
|
421
421
|
lockingScript: !o.lockingScript ? '' : asString(o.lockingScript),
|
|
422
422
|
providedBy: verifyTruthy(o.providedBy) as StorageProvidedBy,
|
|
423
423
|
purpose: o.purpose || undefined,
|
|
@@ -630,7 +630,7 @@ async function validateRequiredInputs(
|
|
|
630
630
|
if (!disableDoubleSpendCheckForTest && !output.spendable && !vargs.isNoSend)
|
|
631
631
|
throw new WERR_INVALID_PARAMETER(`${txid}.${vout}`, 'spendable output unless noSend is true')
|
|
632
632
|
// input is spending an existing user output which has an lockingScript
|
|
633
|
-
input.satoshis =
|
|
633
|
+
input.satoshis = validateSatoshis(output.satoshis, 'output.satoshis')
|
|
634
634
|
input.lockingScript = Script.fromBinary(asArray(output.lockingScript!))
|
|
635
635
|
} else {
|
|
636
636
|
let btx = beef.findTxid(txid)!
|
|
@@ -644,7 +644,7 @@ async function validateRequiredInputs(
|
|
|
644
644
|
// btx is valid has parsed transaction data.
|
|
645
645
|
if (vout >= btx.tx!.outputs.length) throw new WERR_INVALID_PARAMETER(`${txid}.${vout}`, 'valid outpoint')
|
|
646
646
|
const so = btx.tx!.outputs[vout]
|
|
647
|
-
input.satoshis =
|
|
647
|
+
input.satoshis = validateSatoshis(so.satoshis, 'so.satoshis')
|
|
648
648
|
input.lockingScript = so.lockingScript
|
|
649
649
|
}
|
|
650
650
|
}
|