Skip to content

Conversation

@joe-p
Copy link
Contributor

@joe-p joe-p commented Dec 19, 2025

This PR is a refactor of how lsig delegation works. There are three main changes

  • A new LogicSig class that does NOT contain any signature (just program/args)
  • LogicSigAccount is now tied to only one delegator. This ensures that the same LogicSigAccount always has the same address (which is now the delegator)
  • The lsigSigner function now returns the Address it is signing for and either the sig or lmsig

The driver for this change is to simplify the flow for delegation and properly separate different delegations for the same program.


for (const prop in addrWithSigners) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
;(acct as any)[prop] = (addrWithSigners as any)[prop]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is pretty gross but it's needed for backwards compatibility. Tbh I don't think we should have ever injected properties into an existing class, so maybe this could be a candidate for a breaking change.

@joe-p joe-p force-pushed the decoupling-feat/lsig_lmsig branch from 3cf1fdb to a350ce4 Compare December 19, 2025 19:53
@joe-p joe-p force-pushed the decoupling-feat/lsig_lmsig branch from f8e8016 to 2448b22 Compare December 19, 2025 19:57
@joe-p joe-p force-pushed the decoupling-feat/lsig_lmsig branch from 2448b22 to 272e3b9 Compare December 19, 2025 21:59
import { MultisigAccount } from './multisig'
import { TransactionSigner } from './signer'
import { AddressWithDelegatedLsigSigner, TransactionSigner } from './signer'
import { LogicSignature, MultisigSignature, SignedTransaction, encodeSignedTransaction } from './transactions/signed-transaction'
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if we should rename LogicSignature to LogicSigSignature to differentiate between LogicSig?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I think that would make sense. Alternatively we could call this LogicSig LogicSigProgram but that would be more of a breaking change from algosdk

Copy link
Contributor

Choose a reason for hiding this comment

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

I think either works. LogicSigSignature would match nicely with MultisigSignature.

accountGetter?: (algorand: AlgorandClient) => Promise<
Address &
AddressWithTransactionSigner & {
account: {
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if we should extract a type?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this is the only place this type is used and I have no idea what to call it lol, but not opposed. Since this is a test function maybe we could also make a breaking change to simplify the return type?

Copy link
Contributor

Choose a reason for hiding this comment

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

haha yeah, I don't have an good suggestions on naming.
Not opposed to making a breaking change. I think the accountGetter feature is probably not extensively utilised anyways.

Co-authored-by: Neil Campbell <neil.campbell@makerx.com.au>
@joe-p joe-p force-pushed the decoupling-feat/lsig_lmsig branch from a2a2846 to f1354ef Compare December 20, 2025 13:42
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.

3 participants