@bsv/wallet-toolbox 1.7.12 → 1.7.13
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 +8 -0
- package/mobile/out/src/storage/methods/createAction.js +1 -1
- package/mobile/out/src/storage/methods/createAction.js.map +1 -1
- package/mobile/out/src/storage/methods/generateChange.d.ts +2 -1
- package/mobile/out/src/storage/methods/generateChange.d.ts.map +1 -1
- package/mobile/out/src/storage/methods/generateChange.js +4 -2
- package/mobile/out/src/storage/methods/generateChange.js.map +1 -1
- package/mobile/package-lock.json +2 -2
- package/mobile/package.json +1 -1
- package/out/src/storage/methods/createAction.js +1 -1
- package/out/src/storage/methods/createAction.js.map +1 -1
- package/out/src/storage/methods/generateChange.d.ts +2 -1
- package/out/src/storage/methods/generateChange.d.ts.map +1 -1
- package/out/src/storage/methods/generateChange.js +4 -2
- package/out/src/storage/methods/generateChange.js.map +1 -1
- package/out/tsconfig.all.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/storage/methods/createAction.ts +1 -1
- package/src/storage/methods/generateChange.ts +7 -3
package/package.json
CHANGED
|
@@ -825,7 +825,7 @@ async function fundNewTransactionSdk(
|
|
|
825
825
|
})
|
|
826
826
|
}
|
|
827
827
|
|
|
828
|
-
const gcr = await generateChangeSdk(params, allocateChangeInput, releaseChangeInput)
|
|
828
|
+
const gcr = await generateChangeSdk(params, allocateChangeInput, releaseChangeInput, vargs.logger)
|
|
829
829
|
|
|
830
830
|
const nextRandomVal = (): number => {
|
|
831
831
|
let val = 0
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { Validation } from '@bsv/sdk'
|
|
1
|
+
import { Validation, WalletLoggerInterface } from '@bsv/sdk'
|
|
2
2
|
import { WalletError } from '../../sdk/WalletError'
|
|
3
3
|
import { StorageFeeModel } from '../../sdk/WalletStorage.interfaces'
|
|
4
4
|
import { WERR_INSUFFICIENT_FUNDS, WERR_INTERNAL, WERR_INVALID_PARAMETER } from '../../sdk/WERR_errors'
|
|
5
5
|
import { validateStorageFeeModel } from '../StorageProvider'
|
|
6
6
|
import { transactionSize } from './utils'
|
|
7
|
+
import { Wallet, WalletLogger } from '../../index.client'
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* An output of this satoshis amount will be adjusted to the largest fundable amount.
|
|
@@ -38,7 +39,8 @@ export async function generateChangeSdk(
|
|
|
38
39
|
targetSatoshis: number,
|
|
39
40
|
exactSatoshis?: number
|
|
40
41
|
) => Promise<GenerateChangeSdkChangeInput | undefined>,
|
|
41
|
-
releaseChangeInput: (outputId: number) => Promise<void
|
|
42
|
+
releaseChangeInput: (outputId: number) => Promise<void>,
|
|
43
|
+
logger?: WalletLoggerInterface
|
|
42
44
|
): Promise<GenerateChangeSdkResult> {
|
|
43
45
|
if (params.noLogging === false) logGenerateChangeSdkParams(params)
|
|
44
46
|
|
|
@@ -275,8 +277,10 @@ export async function generateChangeSdk(
|
|
|
275
277
|
* Trigger an account funding event if we don't have enough to cover this transaction.
|
|
276
278
|
*/
|
|
277
279
|
if (feeExcess() < 0) {
|
|
280
|
+
const werr = new WERR_INSUFFICIENT_FUNDS(spending() + feeTarget(), -feeExcessNow)
|
|
281
|
+
logger?.error(`throwing WERR_INSUFFICIENT_FUNDS moreSatoshisNeeded ${werr.moreSatoshisNeeded}`)
|
|
278
282
|
await releaseAllocatedChangeInputs()
|
|
279
|
-
throw
|
|
283
|
+
throw werr
|
|
280
284
|
}
|
|
281
285
|
|
|
282
286
|
/**
|