Skip to content

Commit

Permalink
Merge pull request #4189 from BitGo/BTC-650
Browse files Browse the repository at this point in the history
feat: whitelist rbf build params
  • Loading branch information
lcovar authored Jan 10, 2024
2 parents 1796ec3 + 208bc83 commit 70e8531
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
3 changes: 3 additions & 0 deletions modules/sdk-core/src/bitgo/wallet/BuildParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ export const BuildParamsUTXO = t.partial({
/* legacy or psbt */
txFormat: t.unknown,
maxChangeOutputs: t.unknown,
/* rbf */
rbfTxIds: t.array(t.string),
isReplaceableByFee: t.boolean,
});

export const BuildParamsStacks = t.partial({
Expand Down
40 changes: 40 additions & 0 deletions modules/sdk-core/test/unit/bitgo/wallet/BuildParams.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import * as assert from 'assert';
import { BuildParams } from '../../../../src/bitgo/wallet/BuildParams';

describe('BuildParams', function () {
it('enforces codec', function () {
assert.deepStrictEqual(
BuildParams.encode({
addressType: 'p2sh',
txFormat: 'psbt',
isReplaceableByFee: true,
recipients: [
{
amount: '10000',
address: '2N9Ego9KidiZR8tMP82g6RaggQtcbR9zNzH',
},
],
} as any),
{
addressType: 'p2sh',
txFormat: 'psbt',
isReplaceableByFee: true,
recipients: [
{
amount: '10000',
address: '2N9Ego9KidiZR8tMP82g6RaggQtcbR9zNzH',
},
],
}
);

assert.deepStrictEqual(
BuildParams.encode({
rbfTxIds: ['tx1'],
} as any),
{
rbfTxIds: ['tx1'],
}
);
});
});

0 comments on commit 70e8531

Please sign in to comment.