Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/abstract-lightning/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
]
},
"dependencies": {
"@bitgo/public-types": "5.29.0",
"@bitgo/public-types": "5.31.0",
"@bitgo/sdk-core": "^36.12.0",
"@bitgo/statics": "^58.4.0",
"@bitgo/utxo-lib": "^11.11.0",
Expand Down
4 changes: 3 additions & 1 deletion modules/abstract-lightning/src/wallet/lightning.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ export interface ILightningWallet {
* On chain withdrawal
* @param {LightningOnchainWithdrawParams} params - Withdraw parameters
* @param {LightningOnchainRecipient[]} params.recipients - The recipients to pay
* @param {bigint} params.satsPerVbyte - Value for sats per virtual byte
* @param {bigint} [params.satsPerVbyte] - Optional value for sats per virtual byte. If not present, it will be estimated.
* @param {number} [params.numBlocks] - Target blocks for the transaction to be confirmed
* @param {string} params.passphrase - The wallet passphrase
* @param {string} [params.sequenceId] - Optional sequence ID for the respective withdraw transfer
* @param {string} [params.comment] - Optional comment for the respective withdraw transfer
Expand Down Expand Up @@ -337,6 +338,7 @@ export class LightningWallet implements ILightningWallet {
onchainRequest: {
recipients: params.recipients,
satsPerVbyte: params.satsPerVbyte,
numBlocks: params.numBlocks,
},
intentType: 'payment',
},
Expand Down
2 changes: 1 addition & 1 deletion modules/bitgo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
"superagent": "^9.0.1"
},
"devDependencies": {
"@bitgo/public-types": "5.29.0",
"@bitgo/public-types": "5.31.0",
"@bitgo/sdk-opensslbytes": "^2.1.0",
"@bitgo/sdk-test": "^9.1.4",
"@openpgp/web-stream-tools": "0.0.14",
Expand Down
2 changes: 1 addition & 1 deletion modules/express/encryptedPrivKeys.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"61f039aad587c2000745c687373e0fa9": "{\"iv\":\"W14so0ZwIVOO/5y4cl3H3g==\",\"v\":1,\"iter\":10000,\"ks\":256,\"ts\":64,\"mode\":\"ccm\",\"adata\":\"\",\"cipher\":\"aes\",\"salt\":\"Jeck6aR6egU=\",\"ct\":\"GfqFuIoLp5jOTSTTB1byjWlW4D/8WBTr35P2UDjud0b0nA0WnJVAytbNkTlSIsRemhXQrcwhA74/BwZ14zvU4Frtmt3D3tvqKtb4i1ZVPREpcsIbp9V/RC+E5acNX6+bUCMXVZMEuYEGtkDxNRSIGsRZkAeTFlg=\"}"
"61f039aad587c2000745c687373e0fa9": "{\"iv\":\"/Gnh+Ip1G+IOhy+Cms+umQ==\",\"v\":1,\"iter\":10000,\"ks\":256,\"ts\":64,\"mode\":\"ccm\",\"adata\":\"\",\"cipher\":\"aes\",\"salt\":\"FYnd1xwReTw=\",\"ct\":\"vgnCvdJ1Z9sqeV6urYxNsscwnkB/6eSPsZhzaW4Cuc7RKEY1uWNlleR0Tjtd8nlQuhsA5UXFpOID3lHHHjPDvB+jWtRm08I2F+HNGYuklWG12vIiSrY2KnkYRJkyCghn5Pq3iEimQb9M2kkwj5wf4EtfAiz9jsY=\"}"
}
2 changes: 1 addition & 1 deletion modules/express/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"superagent": "^9.0.1"
},
"devDependencies": {
"@bitgo/public-types": "5.29.0",
"@bitgo/public-types": "5.31.0",
"@bitgo/sdk-lib-mpc": "^10.8.1",
"@bitgo/sdk-test": "^9.1.4",
"@types/argparse": "^1.0.36",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ describe('Lightning Withdraw Routes', () => {
},
],
satsPerVbyte: '15',
numBlocks: 3,
passphrase: 'password123',
};

Expand Down Expand Up @@ -85,10 +86,11 @@ describe('Lightning Withdraw Routes', () => {
// we decode the amountMsat string to bigint, it should be in bigint format when passed to payInvoice
should(firstArg).have.property('recipients', decodedRecipients);
should(firstArg).have.property('satsPerVbyte', BigInt(inputParams.satsPerVbyte));
should(firstArg).have.property('numBlocks', inputParams.numBlocks);
should(firstArg).have.property('passphrase', inputParams.passphrase);
});

it('should throw an error if the satsPerVbyte is missing in the request params', async () => {
it('should not throw an error if the satsPerVbyte and/or numBlocks is missing in the request params', async () => {
const inputParams = {
recipients: [
{
Expand All @@ -99,15 +101,43 @@ describe('Lightning Withdraw Routes', () => {
passphrase: 'password123',
};

const expectedResponse: LightningOnchainWithdrawResponse = {
txRequestState: 'delivered',
txRequestId: '123',
withdrawStatus: {
status: 'delivered',
txid: 'tx123',
},
};

const onchainWithdrawStub = sinon.stub().resolves(expectedResponse);
const mockLightningWallet = {
withdrawOnchain: onchainWithdrawStub,
};

// Mock the module import
const proxyquire = require('proxyquire');
const lightningWithdrawRoutes = proxyquire('../../../src/lightning/lightningWithdrawRoutes', {
'@bitgo/abstract-lightning': {
getLightningWallet: () => mockLightningWallet,
},
});

const walletStub = {};
const coinStub = {
wallets: () => ({ get: sinon.stub().resolves(walletStub) }),
};
const stubBitgo = sinon.createStubInstance(BitGo as any, { coin: coinStub });

const req = mockRequestObject({
params: { id: 'testWalletId', coin },
body: inputParams,
bitgo: stubBitgo,
});
req.bitgo = bitgo;

await should(handleLightningWithdraw(req)).be.rejectedWith(
'Invalid request body for withdrawing on chain lightning balance'
);
const result = await lightningWithdrawRoutes.handleLightningWithdraw(req);

should(result).deepEqual(expectedResponse);
});

it('should throw an error if the recipients is missing in the request params', async () => {
Expand Down
2 changes: 1 addition & 1 deletion modules/sdk-coin-sol/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
]
},
"dependencies": {
"@bitgo/public-types": "5.29.0",
"@bitgo/public-types": "5.31.0",
"@bitgo/sdk-core": "^36.12.0",
"@bitgo/sdk-lib-mpc": "^10.8.1",
"@bitgo/statics": "^58.4.0",
Expand Down
2 changes: 1 addition & 1 deletion modules/sdk-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
]
},
"dependencies": {
"@bitgo/public-types": "5.29.0",
"@bitgo/public-types": "5.31.0",
"@bitgo/sdk-lib-mpc": "^10.8.1",
"@bitgo/secp256k1": "^1.5.0",
"@bitgo/sjcl": "^1.0.1",
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -934,10 +934,10 @@
"@scure/base" "1.1.5"
micro-eth-signer "0.7.2"

"@bitgo/public-types@5.29.0":
version "5.29.0"
resolved "https://registry.npmjs.org/@bitgo/public-types/-/public-types-5.29.0.tgz#4ceae8cf837359b0cb8808f417aef64ae2f52839"
integrity sha512-E1zKNPwDmMKoJq/WC0Igg4ftdGX5DUMu49hi1vqjkdMebFliHRrPiVTSiGwDkFj7kwZbaNORNMqS/Qv4WugV0g==
"@bitgo/public-types@5.31.0":
version "5.31.0"
resolved "https://registry.npmjs.org/@bitgo/public-types/-/public-types-5.31.0.tgz#1af37545bdaaf6bb65de6a9c47cb38817d16472c"
integrity sha512-4uiFZHcwVPwfDKLG/lNPy8zIfp8esVxAjXLWrx5LUHZBKguphWWgmx6RzP2LwFr6H4GZ7pxDO3xr7AF0RRL3Ug==
dependencies:
fp-ts "^2.0.0"
io-ts "npm:@bitgo-forks/io-ts@2.1.4"
Expand Down