Skip to content

Commit 3c947f3

Browse files
committed
first draft
1 parent 1352198 commit 3c947f3

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
////////////////////////////////////////////////////////////////////////////////////////////
2+
// Instructions:
3+
// - Setup `.env` file with all 3 variables.
4+
// For instance for goerli network you can use this:
5+
// RPC_URL=https://api.hydrogen.argent47.net/v1/starknet/goerli/rpc/v0.6
6+
// - Run the command: `yarn tsc && node --loader ts-node/esm scripts/multisig-change-threshold.ts`
7+
////////////////////////////////////////////////////////////////////////////////////////////
8+
import "dotenv/config";
9+
import { RPC } from "starknet";
10+
import { ArgentAccount, LegacyMultisigKeyPair, LegacyMultisigSigner, ensureSuccess, manager } from "../lib";
11+
12+
const privateKey2 = "";
13+
14+
// You shouldn't modify anything below this line
15+
const contractAddress = process.env.ADDRESS;
16+
const privateKey1 = process.env.PRIVATE_KEY;
17+
const newThreshold = 1;
18+
19+
if (!contractAddress || !privateKey1 || !privateKey2) {
20+
console.error("Please set the ADDRESS, PRIVATE_KEY environment variables, and fill in the privateKey2 variable");
21+
process.exit(1);
22+
}
23+
24+
const signer1 = new LegacyMultisigKeyPair(privateKey1);
25+
const signer2 = new LegacyMultisigKeyPair(privateKey2);
26+
27+
const signer = new LegacyMultisigSigner([signer1, signer2]);
28+
const account = new ArgentAccount(manager, contractAddress, signer, "1", RPC.ETransactionVersion.V3);
29+
const accountContract = await manager.loadContract(contractAddress);
30+
31+
// This script only works with this classHash
32+
if (accountContract.classHash !== "0x6e150953b26271a740bf2b6e9bca17cc52c68d765f761295de51ceb8526ee72") {
33+
console.error("Invalid class hash");
34+
process.exit(1);
35+
}
36+
37+
accountContract.connect(account);
38+
const { transaction_hash: txHash } = await ensureSuccess(await accountContract.change_threshold(newThreshold));
39+
console.log(`Threshold successfully updated to ${newThreshold}, transaction hash: ${txHash}`);

0 commit comments

Comments
 (0)