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
12 changes: 1 addition & 11 deletions modules/express/src/clientRoutes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ function handleSendCoins(req: express.Request) {
.wallets()
.get({ id: req.params.id })
.then(function (wallet) {
// signs a tx, needs custom signing function passed in

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we not supporting external signer mode for these functions where the comments are getting removed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I believe that's the idea since they are all v1 wallet functions. Currently if signer mode is enabled, the v1 wallet functions would just operate the same as before.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, right - sounds good then

return wallet.sendCoins(req.body);
})
.catch(function (err) {
Expand All @@ -139,7 +138,6 @@ function handleSendMany(req: express.Request) {
.wallets()
.get({ id: req.params.id })
.then(function (wallet) {
// signs a tx, needs custom signing function passed in
return wallet.sendMany(req.body);
})
.catch(function (err) {
Expand Down Expand Up @@ -180,7 +178,6 @@ function handleSignTransaction(req: express.Request) {
.wallets()
.get({ id: req.params.id })
.then(function (wallet) {
// signs a tx, needs custom signing function passed in
return wallet.signTransaction(req.body);
});
}
Expand Down Expand Up @@ -248,7 +245,6 @@ function handleConsolidateUnspents(req: express.Request) {
.wallets()
.get({ id: req.params.id })
.then(function (wallet) {
// signs a tx, needs custom signing function passed in
return wallet.consolidateUnspents(req.body);
});
}
Expand All @@ -262,7 +258,6 @@ function handleFanOutUnspents(req: express.Request) {
.wallets()
.get({ id: req.params.id })
.then(function (wallet) {
// signs a tx, needs custom signing function passed in
return wallet.fanOutUnspents(req.body);
});
}
Expand Down Expand Up @@ -371,10 +366,6 @@ function handleCanonicalAddress(req: express.Request) {
return (coin as Coin.Bch | Coin.Bsv | Coin.Ltc).canonicalAddress(address, version || fallbackVersion);
}

function handleV1Sign(req: express.Request) {
throw new Error('not yet implemented');
}

export async function handleV2Sign(req: express.Request) {
const walletId = req.body.txPrebuild.walletId;
const path = req.config.signerFileSystemPath;
Expand Down Expand Up @@ -1016,7 +1007,6 @@ export function setupAPIRoutes(app: express.Application, config: Config): void {
}

export function setupSigningRoutes(app: express.Application, config: Config): void {
app.post('/api/v1/sign', parseBody, prepareBitGo(config), promiseWrapper(handleV1Sign));
app.post('/api/v2/:coin/sign', parseBody, prepareBitGo(config), promiseWrapper(handleV2Sign));
}

Expand All @@ -1033,7 +1023,7 @@ export function createCustomSigningFunction(externalSignerUrl: string): CustomSi
.type('json')
.send({ txPrebuild: params.txPrebuild, pubs: params.pubs }),
(err, tryCount) => {
console.error(`attempt number ${tryCount}`);
debug(`failed to connect to external signer (attempt ${tryCount}, error: ${err.message})`);
}
);
return signedTx;
Expand Down
1 change: 0 additions & 1 deletion modules/express/src/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,5 @@ export class IpcError extends Errors.BitGoJsError {
export class ExternalSignerConfigError extends Errors.BitGoJsError {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious why we're getting rid of this error in favor of throwing the top level Error type instead?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah okay I realize now that I misunderstood this original comment. #1944 (comment)

I believe you meant that just Object.setPrototypeOf(this, ExternalSignerConfigError.prototype); was unnecessary. I'll edit this commit.

public constructor(message?: string) {
super(message || 'External signer configuration is invalid');
Object.setPrototypeOf(this, ExternalSignerConfigError.prototype);
}
}
6 changes: 1 addition & 5 deletions modules/express/src/expressApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,7 @@ function checkPreconditions(config: Config) {
}

if (signerFileSystemPath !== undefined) {
try {
checkSignerPrvPath(signerFileSystemPath);
} catch (e) {
throw e;
}
checkSignerPrvPath(signerFileSystemPath);
}
}

Expand Down