Skip to content

Commit 3b60b11

Browse files
committed
chore: ensure lsig lmsig signing is handled in our abstractions
1 parent 7f78528 commit 3b60b11

File tree

3 files changed

+49
-9
lines changed

3 files changed

+49
-9
lines changed

docs/code/classes/types_algo_http_client_with_retry.AlgoHttpClientWithRetry.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ URLTokenBaseHTTPClient.constructor
5757

5858
#### Defined in
5959

60-
node_modules/algosdk/dist/types/client/urlTokenBaseHTTPClient.d.ts:27
60+
node_modules/algosdk/types/client/urlTokenBaseHTTPClient.d.ts:27
6161

6262
## Properties
6363

docs/code/classes/types_app_arc56.Arc56Method.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ algosdk.ABIMethod.description
8686

8787
#### Defined in
8888

89-
node_modules/algosdk/dist/types/abi/method.d.ts:28
89+
node_modules/algosdk/types/abi/method.d.ts:28
9090

9191
___
9292

@@ -100,7 +100,7 @@ algosdk.ABIMethod.events
100100

101101
#### Defined in
102102

103-
node_modules/algosdk/dist/types/abi/method.d.ts:38
103+
node_modules/algosdk/types/abi/method.d.ts:38
104104

105105
___
106106

@@ -124,7 +124,7 @@ algosdk.ABIMethod.name
124124

125125
#### Defined in
126126

127-
node_modules/algosdk/dist/types/abi/method.d.ts:27
127+
node_modules/algosdk/types/abi/method.d.ts:27
128128

129129
___
130130

@@ -138,7 +138,7 @@ algosdk.ABIMethod.readonly
138138

139139
#### Defined in
140140

141-
node_modules/algosdk/dist/types/abi/method.d.ts:39
141+
node_modules/algosdk/types/abi/method.d.ts:39
142142

143143
___
144144

@@ -178,7 +178,7 @@ algosdk.ABIMethod.getSelector
178178

179179
#### Defined in
180180

181-
node_modules/algosdk/dist/types/abi/method.d.ts:42
181+
node_modules/algosdk/types/abi/method.d.ts:42
182182

183183
___
184184

@@ -196,7 +196,7 @@ algosdk.ABIMethod.getSignature
196196

197197
#### Defined in
198198

199-
node_modules/algosdk/dist/types/abi/method.d.ts:41
199+
node_modules/algosdk/types/abi/method.d.ts:41
200200

201201
___
202202

@@ -232,7 +232,7 @@ algosdk.ABIMethod.txnCount
232232

233233
#### Defined in
234234

235-
node_modules/algosdk/dist/types/abi/method.d.ts:43
235+
node_modules/algosdk/types/abi/method.d.ts:43
236236

237237
___
238238

@@ -256,4 +256,4 @@ algosdk.ABIMethod.fromSignature
256256

257257
#### Defined in
258258

259-
node_modules/algosdk/dist/types/abi/method.d.ts:45
259+
node_modules/algosdk/types/abi/method.d.ts:45

src/types/account-manager.spec.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,44 @@ describe('AccountManager', () => {
5656
expect(accountInfo.address.toString()).toBe(rekeyed.addr.toString())
5757
expect(accountInfo.authAddr!.toString()).toBe(rekeyTo.addr.toString())
5858
}, 10e6)
59+
60+
test('Logicsig account lmsig signing is supported', async () => {
61+
const { algorand, generateAccount, testAccount } = localnet.context
62+
const account1 = await generateAccount({ initialFunds: algo(1) })
63+
const account2 = await generateAccount({ initialFunds: algo(1) })
64+
const account3 = await generateAccount({ initialFunds: algo(1) })
65+
66+
// Setup the multisig delegated logicsig
67+
const lsigAccount = new algosdk.LogicSigAccount(
68+
Uint8Array.from([1, 32, 1, 1, 34]), // int 1
69+
[Uint8Array.from([1]), Uint8Array.from([2, 3])],
70+
)
71+
lsigAccount.signMultisig(
72+
{
73+
version: 1,
74+
threshold: 2,
75+
addrs: [account1.addr, account2.addr, account3.addr],
76+
} satisfies algosdk.MultisigMetadata,
77+
account1.sk,
78+
) // Make a 2 of 3 multisig delegated logicsig and sign with the first account
79+
lsigAccount.appendToMultisig(account2.sk) // sign with the second account
80+
await localnet.algorand.account.ensureFunded(lsigAccount.address(), testAccount, algo(1)) // Fund the lsig account
81+
82+
algorand.setSignerFromAccount(lsigAccount)
83+
84+
const result = await algorand.send.payment({
85+
sender: lsigAccount.address(),
86+
receiver: testAccount.addr,
87+
amount: algo(0.1),
88+
})
89+
90+
expect(result.confirmation.txn.lsig?.msig).toBeUndefined()
91+
expect(result.confirmation.txn.lsig?.lmsig).toBeDefined()
92+
expect(result.confirmation.txn.lsig?.lmsig?.thr).toBe(2)
93+
expect(result.confirmation.txn.lsig?.lmsig?.v).toBe(1)
94+
expect(result.confirmation.txn.lsig?.lmsig?.subsig.length).toBe(3)
95+
expect(result.confirmation.txn.lsig?.lmsig?.subsig[0].s).toBeDefined()
96+
expect(result.confirmation.txn.lsig?.lmsig?.subsig[1].s).toBeDefined()
97+
expect(result.confirmation.txn.lsig?.lmsig?.subsig[2].s).toBeUndefined()
98+
})
5999
})

0 commit comments

Comments
 (0)