Skip to content

Commit 20a3775

Browse files
authored
Merge pull request #12 from lazor-kit/audit-contract
2 parents 05e081e + 35fe11b commit 20a3775

7 files changed

Lines changed: 0 additions & 245 deletions

File tree

‎README.md‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ The core smart wallet program that handles:
3434
- `create_chunk` - Create a deferred execution chunk for complex transactions
3535
- `execute_chunk` - Execute a previously created chunk (no authentication needed)
3636
- `close_chunk` - Close a chunk and refund rent (no authentication needed)
37-
- `delete_smart_wallet` - Delete a smart wallet and reclaim rent (program-level instruction, not exposed in SDK)
3837

3938
#### 2. Default Policy Program (`BiE9vSdz9MidUiyjVYsu3PG4C1fbPZ8CVPADA9jRfXw7`)
4039

‎programs/lazorkit/src/instructions/delete_smart_wallet.rs‎

Lines changed: 0 additions & 55 deletions
This file was deleted.
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
mod create_smart_wallet;
2-
mod delete_smart_wallet;
32
mod execute;
43

54
pub use create_smart_wallet::*;
6-
pub use delete_smart_wallet::*;
75
pub use execute::*;

‎programs/lazorkit/src/lib.rs‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,4 @@ pub mod lazorkit {
4848
pub fn close_chunk(ctx: Context<CloseChunk>) -> Result<()> {
4949
instructions::close_chunk(ctx)
5050
}
51-
52-
pub fn delete_smart_wallet(ctx: Context<DeleteSmartWallet>) -> Result<()> {
53-
instructions::delete_smart_wallet(ctx)
54-
}
5551
}

‎sdk/anchor/idl/lazorkit.json‎

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -349,69 +349,6 @@
349349
}
350350
]
351351
},
352-
{
353-
"name": "delete_smart_wallet",
354-
"discriminator": [
355-
126,
356-
239,
357-
172,
358-
118,
359-
134,
360-
32,
361-
52,
362-
102
363-
],
364-
"accounts": [
365-
{
366-
"name": "payer",
367-
"writable": true,
368-
"signer": true,
369-
"address": "BE8duRBDmh4cF4Ecz4TBCNgNAMCaonrpQiEiQ1xfQmab"
370-
},
371-
{
372-
"name": "smart_wallet",
373-
"writable": true
374-
},
375-
{
376-
"name": "wallet_state",
377-
"writable": true,
378-
"pda": {
379-
"seeds": [
380-
{
381-
"kind": "const",
382-
"value": [
383-
119,
384-
97,
385-
108,
386-
108,
387-
101,
388-
116,
389-
95,
390-
115,
391-
116,
392-
97,
393-
116,
394-
101
395-
]
396-
},
397-
{
398-
"kind": "account",
399-
"path": "smart_wallet"
400-
}
401-
]
402-
}
403-
},
404-
{
405-
"name": "wallet_device",
406-
"writable": true
407-
},
408-
{
409-
"name": "system_program",
410-
"address": "11111111111111111111111111111111"
411-
}
412-
],
413-
"args": []
414-
},
415352
{
416353
"name": "execute",
417354
"discriminator": [

‎sdk/anchor/types/lazorkit.ts‎

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -355,69 +355,6 @@ export type Lazorkit = {
355355
}
356356
]
357357
},
358-
{
359-
"name": "deleteSmartWallet",
360-
"discriminator": [
361-
126,
362-
239,
363-
172,
364-
118,
365-
134,
366-
32,
367-
52,
368-
102
369-
],
370-
"accounts": [
371-
{
372-
"name": "payer",
373-
"writable": true,
374-
"signer": true,
375-
"address": "BE8duRBDmh4cF4Ecz4TBCNgNAMCaonrpQiEiQ1xfQmab"
376-
},
377-
{
378-
"name": "smartWallet",
379-
"writable": true
380-
},
381-
{
382-
"name": "walletState",
383-
"writable": true,
384-
"pda": {
385-
"seeds": [
386-
{
387-
"kind": "const",
388-
"value": [
389-
119,
390-
97,
391-
108,
392-
108,
393-
101,
394-
116,
395-
95,
396-
115,
397-
116,
398-
97,
399-
116,
400-
101
401-
]
402-
},
403-
{
404-
"kind": "account",
405-
"path": "smartWallet"
406-
}
407-
]
408-
}
409-
},
410-
{
411-
"name": "walletDevice",
412-
"writable": true
413-
},
414-
{
415-
"name": "systemProgram",
416-
"address": "11111111111111111111111111111111"
417-
}
418-
],
419-
"args": []
420-
},
421358
{
422359
"name": "execute",
423360
"discriminator": [

‎tests/execute.test.ts‎

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -90,63 +90,6 @@ describe('Test smart wallet with default policy', () => {
9090
console.log('result: ', result);
9191
});
9292

93-
xit('Delete smart wallet successfully', async () => {
94-
// create smart wallet first
95-
const privateKey = ECDSA.generateKey();
96-
const publicKeyBase64 = privateKey.toCompressedPublicKey();
97-
const passkeyPubkey = asPasskeyPublicKey(
98-
Array.from(Buffer.from(publicKeyBase64, 'base64'))
99-
);
100-
const smartWalletId = lazorkitProgram.generateWalletId();
101-
const smartWallet = lazorkitProgram.getSmartWalletPubkey(smartWalletId);
102-
const credentialId = base64.encode(Buffer.from('testing')); // random string
103-
const credentialHash = asCredentialHash(
104-
Array.from(
105-
new Uint8Array(
106-
require('js-sha256').arrayBuffer(Buffer.from(credentialId, 'base64'))
107-
)
108-
)
109-
);
110-
111-
const { transaction: createSmartWalletTxn } =
112-
await lazorkitProgram.createSmartWalletTxn({
113-
payer: payer.publicKey,
114-
passkeyPublicKey: passkeyPubkey,
115-
credentialIdBase64: credentialId,
116-
smartWalletId,
117-
});
118-
119-
const sig = await anchor.web3.sendAndConfirmTransaction(
120-
connection,
121-
createSmartWalletTxn as anchor.web3.Transaction,
122-
[payer]
123-
);
124-
125-
console.log('Create smart wallet: ', sig);
126-
127-
const deleteSmartWalletTxn = await lazorkitProgram.program.methods
128-
.deleteSmartWallet()
129-
.accountsPartial({
130-
payer: payer.publicKey,
131-
smartWallet: smartWallet,
132-
walletState: lazorkitProgram.getWalletStatePubkey(smartWallet),
133-
walletDevice: lazorkitProgram.getWalletDevicePubkey(
134-
smartWallet,
135-
credentialHash
136-
),
137-
systemProgram: anchor.web3.SystemProgram.programId,
138-
})
139-
.transaction();
140-
141-
const deleteSmartWalletSig = await anchor.web3.sendAndConfirmTransaction(
142-
connection,
143-
deleteSmartWalletTxn as anchor.web3.Transaction,
144-
[payer]
145-
);
146-
147-
console.log('Delete smart wallet: ', deleteSmartWalletSig);
148-
});
149-
15093
it('Execute direct transaction with transfer sol from smart wallet', async () => {
15194
const privateKey = ECDSA.generateKey();
15295

0 commit comments

Comments
 (0)