Skip to content

feat(account): implement configureMultisig()#87

Open
Andreschuks101 wants to merge 4 commits intoamina69:developfrom
Andreschuks101:feat/configure-multisig
Open

feat(account): implement configureMultisig()#87
Andreschuks101 wants to merge 4 commits intoamina69:developfrom
Andreschuks101:feat/configure-multisig

Conversation

@Andreschuks101
Copy link
Copy Markdown

Summary

Resolves #57 - implements the configureMultisig() function that configures multi-signature security on a Stellar account using the Stellar SDK.

What was added

src/multisig/validation.ts

  • Defines MultisigConfig, SignerConfig, and Thresholds interfaces
  • Exports a custom ValidationError class (extends Error, restores prototype chain)
  • validateMultisigConfig(config) runs three checks before any network call:
    1. masterKey is a valid Ed25519 public key (StrKey.isValidEd25519PublicKey)
    2. Every signer.publicKey is a valid Ed25519 public key
    3. Sum of all signer weights is strictly greater than thresholds.high

src/multisig/builder.ts

  • configureMultisig(config, server, networkPassphrase):
    1. Runs validateMultisigConfig (throws before touching the network on bad input)
    2. Calls server.loadAccount(accountId) to get current sequence number
    3. Builds one TransactionBuilder with SetOptions operations for thresholds and signers
    4. Signs with Keypair.fromSecret(masterKey)
    5. Submits via server.submitTransaction(transaction)
    6. Returns { accountId, transactionHash }

src/multisig/index.ts

  • Barrel re-export for clean imports

Test coverage (src/multisig/tests/configureMultisig.test.ts)

Scenario What is asserted
Invalid signer publicKey ValidationError thrown, message contains the bad key
Invalid masterKey ValidationError thrown
Total weight <= high threshold ValidationError thrown
Total weight > high threshold No error
Happy path (mocked server) Returns { accountId, transactionHash }
loadAccount called correctly Mock assertion
submitTransaction called once Mock assertion
loadAccount rejection propagates Error re-thrown

All server calls are mocked with jest.fn() so tests run fully offline.

How to run tests

npm test

@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 26, 2026

@Andreschuks101 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@amina69
Copy link
Copy Markdown
Owner

amina69 commented Mar 26, 2026

@Andreschuks101 kindly make your pr to the develop branch, see the contributing.md for directions

@amina69
Copy link
Copy Markdown
Owner

amina69 commented Mar 27, 2026

@Andreschuks101 read the contributing.md, make your pr to develop branch

@Andreschuks101 Andreschuks101 changed the base branch from main to develop March 28, 2026 08:15
@amina69
Copy link
Copy Markdown
Owner

amina69 commented Mar 28, 2026

@Andreschuks101 kindly fix this audit error, pipeline not fully passing
image

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.

[SDK · Account management] Implement configureMultisig()

2 participants