Skip to content

feat: add ETH support for multisign in external mode#208

Open
pranishnepal wants to merge 1 commit into
masterfrom
WCN-544
Open

feat: add ETH support for multisign in external mode#208
pranishnepal wants to merge 1 commit into
masterfrom
WCN-544

Conversation

@pranishnepal
Copy link
Copy Markdown
Contributor

@pranishnepal pranishnepal commented May 26, 2026

What

This PR adds support for signing multisig transactions for ETH in external mode. It includes validation to ensure that the transaction prebuild contains the necessary fields for ETH transactions,
such as recipients and nextContractSequenceId.

The tests have been updated to reflect these changes and to ensure that
the new functionality works as expected - tested e2e.

Re Recovery Flow: it requires a few methods that are not exposed by COINS team, so that will be a follow-up work.

Ticket: WCN-544

Testing

@linear-code
Copy link
Copy Markdown

linear-code Bot commented May 26, 2026

WCN-544

@pranishnepal pranishnepal marked this pull request as ready for review May 26, 2026 18:53
@pranishnepal pranishnepal requested a review from a team as a code owner May 26, 2026 18:53
@pranishnepal pranishnepal requested a review from bdesoky May 26, 2026 18:53
Comment thread package.json
"zod": "^3.25.48"
},
"overrides": {
"@bitgo-beta/sdk-core": "8.2.1-beta.1775",
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.

add to add these due to conflicts with the beta release of BitGoJs - once stable versions are out, maybe we won't need to resolve it like so

function isEthTransactionPrebuild(txPrebuild: TransactionPrebuild): txPrebuild is EthTxPrebuild {
return (
Array.isArray((txPrebuild as any).recipients) &&
(txPrebuild as any).nextContractSequenceId != null
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.

very nitty, don't love the to any casting. in fact, there's probably a similar method that exists within BGMS where we do a similar check for if something is an ethPrebuildTxn, maybe do a quick claude scan?

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.

No similar type guard found in bitgo-microservices. The reviewer was hoping there was a shared utility, but there isn't one.

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.

I'll think of an alternative to skip the any that irked you 😄

Comment thread src/advancedWalletManager/handlers/multisigSignTransaction.ts Outdated
if (!txPrebuild.txHex) {
throw new Error(`txPrebuild must include txHex for external signing`);
if (isEthLikeCoin(coin)) {
if (!isEthTransactionPrebuild(txPrebuild)) {
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'd argue that we should have this prebuild method actually check for those fields? add more details to those

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.

this should be handled by isEthTransactionPrebuild - did you mean smth else?

Comment thread .eslintrc.js
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
'@typescript-eslint/no-unused-vars': [
'error',
{
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.

what's this for?

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.

not have the compiler complain when variables are named with _

This commit adds support for signing multisig transactions
for ETH in external mode. It includes validation to ensure that the
transaction prebuild contains the necessary fields for ETH transactions,
 such as recipients and nextContractSequenceId.

 The tests have been updated to reflect these changes and to ensure that
the new functionality works as expected - tested e2e.

Re Recovery Flow: it requires a few methods that are not exposed by
COINS team, so that will be a follow-up work.

Ticket: WCN-544
@pranishnepal
Copy link
Copy Markdown
Contributor Author

@margueriteblair -- updated!

*/
interface EthExternalSigningResponse extends Omit<HalfSignedTransaction, 'halfSigned'> {
halfSigned: HalfSignedTransaction['halfSigned'] & {
operationHash: string;
Copy link
Copy Markdown
Contributor Author

@pranishnepal pranishnepal May 27, 2026

Choose a reason for hiding this comment

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

without these, we get errors like:

  "error": "BitGoApiResponseError",
  "details": {
    "error": "missing signature",
    "name": "Invalid",
    "requestId": "d3c7b37cf8435227083b-0002",
    "context": {}
  }
}

so extended SDK type

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants