@kamino-finance/squads-kamino-cli 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +82 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +185 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/api.d.ts +270 -0
- package/dist/lib/api.js +612 -0
- package/dist/lib/api.js.map +1 -0
- package/dist/lib/constants.d.ts +3 -0
- package/dist/lib/constants.js +7 -0
- package/dist/lib/constants.js.map +1 -0
- package/dist/lib/index.d.ts +7 -0
- package/dist/lib/index.js +11 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/menu.d.ts +24 -0
- package/dist/lib/menu.js +259 -0
- package/dist/lib/menu.js.map +1 -0
- package/dist/lib/program.d.ts +8 -0
- package/dist/lib/program.js +53 -0
- package/dist/lib/program.js.map +1 -0
- package/dist/lib/sendTransactionUtils.d.ts +40 -0
- package/dist/lib/sendTransactionUtils.js +159 -0
- package/dist/lib/sendTransactionUtils.js.map +1 -0
- package/dist/lib/utils.d.ts +8 -0
- package/dist/lib/utils.js +60 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/lib/wallet.d.ts +7 -0
- package/dist/lib/wallet.js +25 -0
- package/dist/lib/wallet.js.map +1 -0
- package/dist/squads_mpl.json +767 -0
- package/package.json +54 -0
package/README.md
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
```
|
|
2
|
+
_____ ____ __ __ ___ ____ _____ __ __ ___ __ ___ ____ _ __ ____
|
|
3
|
+
/ ___/ / __ \ / / / / / | / __ \ / ___/ / //_/ / | / |/ / / _/ / | / / / __ \
|
|
4
|
+
\__ \ / / / / / / / / / /| | / / / / \__ \ ______ / ,< / /| | / /|_/ / / / / |/ / / / / /
|
|
5
|
+
___/ / / /_/ / / /_/ / / ___ | / /_/ / ___/ / /_____/ / /| | / ___ | / / / / _/ / / /| / / /_/ /
|
|
6
|
+
/____/ \___\_\ \____/ /_/ |_| /_____/ /____/ /_/ |_| /_/ |_| /_/ /_/ /___/ /_/ |_/ \____/
|
|
7
|
+
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Squads CLI
|
|
11
|
+
|
|
12
|
+
Interact with the Squads Multisig Program through a simple CLI.
|
|
13
|
+
|
|
14
|
+
### Requirements
|
|
15
|
+
|
|
16
|
+
Nodejs version >= 16
|
|
17
|
+
|
|
18
|
+
### !! Make sure your ledger is connected and unlocked when you run the cli. !!
|
|
19
|
+
|
|
20
|
+
### Installing & Updating the CLI tool
|
|
21
|
+
|
|
22
|
+
- install
|
|
23
|
+
`npm install -g @kamino-finance/squads-kamino-cli`
|
|
24
|
+
- set path
|
|
25
|
+
to find path: `which squads-kamino-cli`
|
|
26
|
+
to set path: `echo -n 'export PATH=<WHICH_PATH>:$PATH'` >> ~/.zshrc | (on MAC) where <WHICH_PATH> is the output from above
|
|
27
|
+
|
|
28
|
+
- update
|
|
29
|
+
`npm update --g @kamino-finance/squads-kamino-cli`
|
|
30
|
+
|
|
31
|
+
### Running the tool
|
|
32
|
+
|
|
33
|
+
Running the simple command will start the tool and ask a few setup questions for the wallet and the network cluster.\
|
|
34
|
+
`squads-kamino-cli`
|
|
35
|
+
|
|
36
|
+
### CLI help
|
|
37
|
+
|
|
38
|
+
`squads-kamino-cli --help` should display all available commands and arguments
|
|
39
|
+
|
|
40
|
+
### .env file
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
CLUSTER=
|
|
44
|
+
LEDGER_ADDRESS_KEY=
|
|
45
|
+
IRONFORGE_CLUSTER=
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
#### Input file should only contain base58 transaction/instructions separated by newlines
|
|
49
|
+
|
|
50
|
+
### Examples
|
|
51
|
+
|
|
52
|
+
- Get multisigs
|
|
53
|
+
`npx ts-node src/index.ts create-transaction-from-instructions-file --cluster https://rpc.url --ledger-address-key 0 --multisig BxdLNhoRXVs45wTVAZBrYQUkxbex5zXFCaJtsuRpoqMj --file-path ./ixns.in`
|
|
54
|
+
- Transactions from file - print
|
|
55
|
+
`npx ts-node src/index.ts create-transaction-from-instructions-file --cluster https://rpc.url --ledger-address-key 0 --multisig E35i5qn7872eEmBt15e5VGhziUBzCTm43XCSWvDoQNNv --file-path ./ixns.in --title 'Squads cli test add token' --mode print`
|
|
56
|
+
- Transactions from file - print, using .env for cluster and ledger-pubkey, using squad name instead of multisig pubkey
|
|
57
|
+
`npx ts-node src/index.ts create-transaction-from-instructions-file --squad kamino --file-path ./ixns.in --title 'Squads cli test add token' --mode print`
|
|
58
|
+
- With .env file from file
|
|
59
|
+
`npx ts-node src/index.ts create-transaction-from-instructions-file --multisig 7Pd2qaTnHmbfwcdVnf812xz2mdWz8G6sQxEjc3t7NChz --file-path ./ixns.in --title 'Squads cli test add token' --mode propose`
|
|
60
|
+
- Program upgrade proposal (THIS WILL ONLY CREATE A PROGRAM UPGRADE BUT IT WILL NOT INITIATE IT)
|
|
61
|
+
`npx ts-node src/index.ts create-program-upgrade --multisig BxdLNhoRXVs45wTVAZBrYQUkxbex5zXFCaJtsuRpoqMj --program-id SLendK7ySfcEzyaFqy93gDnD3RtrpXJcnRwb6zFHJSh --buffer EnYZG1528vJQpGmEFSCR4KLVy8aoShzSUt6zBECyP7mg --refund-address sadmBTQm5HJsyzWHEjV4YwG9CiahZKVDVqAyS4Wx1zH --title 'Squads cli test program upgrade' --mode propose`
|
|
62
|
+
|
|
63
|
+
## Squads Cli to approve and execute
|
|
64
|
+
|
|
65
|
+
https://github.com/Squads-Protocol/squads-cli
|
|
66
|
+
|
|
67
|
+
`npm install -g @sqds/cli` - to install
|
|
68
|
+
|
|
69
|
+
`squads-cli --cluster <RPC>` - to run
|
|
70
|
+
This will prompt you with `Enter the path of your wallet file or ledger` -> ``usb://ledger` - works for some ledgers, or `usb://ledger?key=0` - you know it worked when you see the right `Connected wallet:`.
|
|
71
|
+
!! Make sure your ledger is connected and unlocked when you run the cli.
|
|
72
|
+
|
|
73
|
+
When you press `Choose multisig` it will let you select from all the multisig your wallet is part of.
|
|
74
|
+
For reference:
|
|
75
|
+
`BbM3mbcLsa3QcYEVx8iovwfKaA1iZ6DK5fEbbtHwS3N8` - KFarms
|
|
76
|
+
`A9rQoX1sictAQkyXxaZA8nz674xutHwoqpK2mwLyexCZ` - KLend
|
|
77
|
+
`E35i5qn7872eEmBt15e5VGhziUBzCTm43XCSWvDoQNNv` - Kamino MS
|
|
78
|
+
`BxdLNhoRXVs45wTVAZBrYQUkxbex5zXFCaJtsuRpoqMj` - KLend Staging
|
|
79
|
+
|
|
80
|
+
After choosing the multisig, you can interact with squads. The most useful interaction is to approve and execute transactions, especially when the v3 UI is not responsive. To do so select `Transactions` and then select a tranmsaction. (The latest transactions are always at the end of the list -> scroll all the way down or just go up past the `<- Go back` option and you should see the latest ones, or the non-executed ones if there are any)
|
|
81
|
+
|
|
82
|
+
You can also create or asamble transactions using this CLI but it's a lot slower than just using squads-kamino-cli
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.idl = void 0;
|
|
5
|
+
const tslib_1 = require("tslib");
|
|
6
|
+
const commander_1 = require("commander");
|
|
7
|
+
const squads_mpl_json_1 = tslib_1.__importDefault(require("./squads_mpl.json"));
|
|
8
|
+
exports.idl = squads_mpl_json_1.default;
|
|
9
|
+
const menu_1 = tslib_1.__importDefault(require("./lib/menu"));
|
|
10
|
+
const wallet_1 = tslib_1.__importStar(require("./lib/wallet"));
|
|
11
|
+
const dotenv_1 = tslib_1.__importDefault(require("dotenv"));
|
|
12
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
13
|
+
const lib_1 = require("./lib");
|
|
14
|
+
tslib_1.__exportStar(require("./lib"), exports);
|
|
15
|
+
function main() {
|
|
16
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
17
|
+
const program = new commander_1.Command();
|
|
18
|
+
program.name("klend-cli").description("CLI to interact with squads program");
|
|
19
|
+
program
|
|
20
|
+
.command("print-multisig-list")
|
|
21
|
+
.option(`--cluster <string>`, "The cluster or rpc")
|
|
22
|
+
.option(`--ironforge-cluster <string>`, "ironforge-cluster for transaction landing")
|
|
23
|
+
.option(`--ledger-address-key <string>`, "The ledger address for you ledger. usb://ledger\\?key=0 by default. Check with solana-keygen pubkey usb://ledger or solana-keygen pubkey usb://ledger\\?key=0. 'default' for usb://ledger or <key_number> for usb://ledger\\?key=<key_number>")
|
|
24
|
+
.action(({ cluster, ironforgeCluster, ledgerAddressKey }) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
const addressKey = fromEnv(ledgerAddressKey, "LEDGER_ADDRESS_KEY");
|
|
26
|
+
const clusterVal = fromEnv(cluster, "CLUSTER");
|
|
27
|
+
const ironforgeClusterVal = fromEnv(ironforgeCluster, "IRONFORGE_CLUSTER");
|
|
28
|
+
const chain = {
|
|
29
|
+
name: "mainnet-beta",
|
|
30
|
+
endpoint: clusterVal,
|
|
31
|
+
wsEndpoint: (clusterVal === null || clusterVal === void 0 ? void 0 : clusterVal.replace("https:", "wss:")) + "/whirligig",
|
|
32
|
+
chainID: 101,
|
|
33
|
+
displayName: "Mainnet Beta (Triton)",
|
|
34
|
+
};
|
|
35
|
+
const web3Client = new lib_1.Web3Client(chain, ironforgeClusterVal);
|
|
36
|
+
const cli = yield load(web3Client, addressKey, "print");
|
|
37
|
+
yield cli.printMultisigList();
|
|
38
|
+
}));
|
|
39
|
+
program
|
|
40
|
+
.command("create-transaction-from-instruction")
|
|
41
|
+
.option(`--cluster <string>`, "The cluster or rpc")
|
|
42
|
+
.option(`--ledger-address-key <string>`, "The ledger address for you ledger. usb://ledger\\?key=0 by default. Check with solana-keygen pubkey usb://ledger or solana-keygen pubkey usb://ledger\\?key=0. 'default' for usb://ledger or <key_number> for usb://ledger\\?key=<key_number>")
|
|
43
|
+
.option(`--multisig <string>`, "The multisig pubkey")
|
|
44
|
+
.option(`--squad <string>`, "The squad you want to interact with: klend|kamino|farms|klend-staging")
|
|
45
|
+
.option(`--ironforge-cluster <string>`, "ironforge-cluster for transaction landing")
|
|
46
|
+
.requiredOption(`--ixn <string>`, "The ixn base58")
|
|
47
|
+
.requiredOption(`--mode <string>`, "Specify the run mode: print/simulate/propose")
|
|
48
|
+
.requiredOption(`--title <string>`, "The title of the squads transaction")
|
|
49
|
+
.action(({ cluster, ledgerAddressKey, multisig, squad, ironforgeCluster, ixn, mode, title, }) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
const addressKey = fromEnv(ledgerAddressKey, "LEDGER_ADDRESS_KEY");
|
|
51
|
+
const clusterVal = fromEnv(cluster, "CLUSTER");
|
|
52
|
+
const ironforgeClusterVal = fromEnv(ironforgeCluster, "IRONFORGE_CLUSTER");
|
|
53
|
+
const multisigVal = multisig ? multisig : getMultisigPk(squad);
|
|
54
|
+
const chain = {
|
|
55
|
+
name: "mainnet-beta",
|
|
56
|
+
endpoint: clusterVal,
|
|
57
|
+
wsEndpoint: (clusterVal === null || clusterVal === void 0 ? void 0 : clusterVal.replace("https:", "wss:")) + "/whirligig",
|
|
58
|
+
chainID: 101,
|
|
59
|
+
displayName: "Mainnet Beta (Triton)",
|
|
60
|
+
};
|
|
61
|
+
const web3Client = new lib_1.Web3Client(chain, ironforgeClusterVal);
|
|
62
|
+
const cli = yield load(web3Client, addressKey, mode);
|
|
63
|
+
yield cli.createTransactionFromIxn(multisigVal, ixn, title);
|
|
64
|
+
}));
|
|
65
|
+
program
|
|
66
|
+
.command("create-transaction-from-instructions-file")
|
|
67
|
+
.option(`--cluster <string>`, "The cluster or rpc")
|
|
68
|
+
.option(`--ledger-address-key <string>`, "The ledger address for you ledger. usb://ledger\\?key=0 by default. Check with solana-keygen pubkey usb://ledger or solana-keygen pubkey usb://ledger\\?key=0. 'default' for usb://ledger or <key_number> for usb://ledger\\?key=<key_number>")
|
|
69
|
+
.option(`--multisig <string>`, "The multisig pubkey")
|
|
70
|
+
.option(`--squad <string>`, "The squad you want to interact with: klend|kamino|farms|klend-staging")
|
|
71
|
+
.option(`--ironforge-cluster <string>`, "ironforge-cluster for transaction landing")
|
|
72
|
+
.requiredOption(`--file-path <string>`, "The file path")
|
|
73
|
+
.option(`--multiply-fee <string>`, "standard is 1 lamport - multiplier")
|
|
74
|
+
.requiredOption(`--mode <string>`, "Specify the run mode: print/simulate/propose")
|
|
75
|
+
.requiredOption(`--title <string>`, "The title of the squads transaction")
|
|
76
|
+
.action(({ cluster, ledgerAddressKey, multisig, squad, ironforgeCluster, filePath, multiplyFee, mode, title, }) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
77
|
+
const addressKey = fromEnv(ledgerAddressKey, "LEDGER_ADDRESS_KEY");
|
|
78
|
+
const clusterVal = fromEnv(cluster, "CLUSTER");
|
|
79
|
+
const ironforgeClusterVal = fromEnv(ironforgeCluster, "IRONFORGE_CLUSTER");
|
|
80
|
+
const multisigVal = new web3_js_1.PublicKey(multisig ? multisig : getMultisigPk(squad));
|
|
81
|
+
const chain = {
|
|
82
|
+
name: "mainnet-beta",
|
|
83
|
+
endpoint: clusterVal,
|
|
84
|
+
wsEndpoint: (clusterVal === null || clusterVal === void 0 ? void 0 : clusterVal.replace("https:", "wss:")) + "/whirligig",
|
|
85
|
+
chainID: 101,
|
|
86
|
+
displayName: "Mainnet Beta (Triton)",
|
|
87
|
+
};
|
|
88
|
+
const web3Client = new lib_1.Web3Client(chain, ironforgeClusterVal);
|
|
89
|
+
const cli = yield load(web3Client, addressKey, mode);
|
|
90
|
+
yield cli.createTransactionsFromIxnsFile(multisigVal, filePath, title, multiplyFee);
|
|
91
|
+
}));
|
|
92
|
+
program
|
|
93
|
+
.command("create-program-upgrade")
|
|
94
|
+
.option(`--cluster <string>`, "The cluster or rpc")
|
|
95
|
+
.option(`--ledger-address-key <string>`, "The ledger address for you ledger. usb://ledger\\?key=0 by default. Check with solana-keygen pubkey usb://ledger or solana-keygen pubkey usb://ledger\\?key=0. 'default' for usb://ledger or <key_number> for usb://ledger\\?key=<key_number>")
|
|
96
|
+
.option(`--multisig <string>`, "The multisig pubkey")
|
|
97
|
+
.option(`--squad <string>`, "The squad you want to interact with: klend|kamino|farms|klend-staging")
|
|
98
|
+
.option(`--ironforge-cluster <string>`, "ironforge-cluster for transaction landing")
|
|
99
|
+
.requiredOption(`--program-id <string>`, "The program ID")
|
|
100
|
+
.requiredOption(`--buffer <string>`, "The buffer to send")
|
|
101
|
+
.requiredOption(`--refund-address <string>`, "The refund address to send SOL refund to")
|
|
102
|
+
.option(`--multiply-fee <string>`, "standard is 1 lamport - multiplier")
|
|
103
|
+
.requiredOption(`--mode <string>`, "Specify the run mode: print/simulate/propose")
|
|
104
|
+
.requiredOption(`--title <string>`, "The title of the squads transaction")
|
|
105
|
+
.action(({ cluster, ledgerAddressKey, multisig, squad, ironforgeCluster, programId, buffer, refundAddress, multiplyFee, mode, title, }) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
106
|
+
const addressKey = fromEnv(ledgerAddressKey, "LEDGER_ADDRESS_KEY");
|
|
107
|
+
const clusterVal = fromEnv(cluster, "CLUSTER");
|
|
108
|
+
const ironforgeClusterVal = fromEnv(ironforgeCluster, "IRONFORGE_CLUSTER");
|
|
109
|
+
const multisigVal = new web3_js_1.PublicKey(multisig ? multisig : getMultisigPk(squad));
|
|
110
|
+
const chain = {
|
|
111
|
+
name: "mainnet-beta",
|
|
112
|
+
endpoint: clusterVal,
|
|
113
|
+
wsEndpoint: (clusterVal === null || clusterVal === void 0 ? void 0 : clusterVal.replace("https:", "wss:")) + "/whirligig",
|
|
114
|
+
chainID: 101,
|
|
115
|
+
displayName: "Mainnet Beta (Triton)",
|
|
116
|
+
};
|
|
117
|
+
const web3Client = new lib_1.Web3Client(chain, ironforgeClusterVal);
|
|
118
|
+
const cli = yield load(web3Client, addressKey, mode);
|
|
119
|
+
yield cli.createProgramUpgrade(multisigVal, programId, buffer, refundAddress, title, multiplyFee);
|
|
120
|
+
}));
|
|
121
|
+
yield program.parseAsync();
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
const load = (web3Client, addressKey, mode) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
125
|
+
const ledgerWallet = yield (0, wallet_1.findLedgerAddress)(addressKey);
|
|
126
|
+
const cliWallet = new wallet_1.default(ledgerWallet);
|
|
127
|
+
// init the cli
|
|
128
|
+
const cli = new menu_1.default(cliWallet.wallet, web3Client, mode);
|
|
129
|
+
return cli;
|
|
130
|
+
});
|
|
131
|
+
dotenv_1.default.config();
|
|
132
|
+
function fromEnv(argValue, envVariable) {
|
|
133
|
+
if (argValue) {
|
|
134
|
+
return argValue;
|
|
135
|
+
}
|
|
136
|
+
if (envVariable === "CLUSTER") {
|
|
137
|
+
if (process.env.CLUSTER === undefined) {
|
|
138
|
+
throw new Error("CLUSTER must be specified in .env or as a command line argument");
|
|
139
|
+
}
|
|
140
|
+
return process.env.CLUSTER;
|
|
141
|
+
}
|
|
142
|
+
else if (envVariable === "LEDGER_ADDRESS_KEY") {
|
|
143
|
+
if (process.env.LEDGER_ADDRESS_KEY === undefined) {
|
|
144
|
+
return "default";
|
|
145
|
+
}
|
|
146
|
+
return process.env.LEDGER_ADDRESS_KEY;
|
|
147
|
+
}
|
|
148
|
+
else if (envVariable === "IRONFORGE_CLUSTER") {
|
|
149
|
+
if (process.env.IRONFORGE_CLUSTER === undefined) {
|
|
150
|
+
return "default";
|
|
151
|
+
}
|
|
152
|
+
return process.env.IRONFORGE_CLUSTER;
|
|
153
|
+
}
|
|
154
|
+
return "";
|
|
155
|
+
}
|
|
156
|
+
function getMultisigPk(squad) {
|
|
157
|
+
if (squad === "kamino") {
|
|
158
|
+
return "E35i5qn7872eEmBt15e5VGhziUBzCTm43XCSWvDoQNNv";
|
|
159
|
+
}
|
|
160
|
+
else if (squad === "scope") {
|
|
161
|
+
return "E35i5qn7872eEmBt15e5VGhziUBzCTm43XCSWvDoQNNv";
|
|
162
|
+
}
|
|
163
|
+
else if (squad === "farms") {
|
|
164
|
+
return "BbM3mbcLsa3QcYEVx8iovwfKaA1iZ6DK5fEbbtHwS3N8";
|
|
165
|
+
}
|
|
166
|
+
else if (squad === "klend") {
|
|
167
|
+
return "A9rQoX1sictAQkyXxaZA8nz674xutHwoqpK2mwLyexCZ";
|
|
168
|
+
}
|
|
169
|
+
else if (squad === "klend-staging") {
|
|
170
|
+
return "BxdLNhoRXVs45wTVAZBrYQUkxbex5zXFCaJtsuRpoqMj";
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
throw Error("Invalid squad");
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
main()
|
|
177
|
+
.then(() => {
|
|
178
|
+
console.log("\n\nSuccess");
|
|
179
|
+
process.exit();
|
|
180
|
+
})
|
|
181
|
+
.catch((e) => {
|
|
182
|
+
console.error("\n\nSquads Kamino CLI exited with error:\n\n", e);
|
|
183
|
+
process.exit(1);
|
|
184
|
+
});
|
|
185
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;AACA,yCAAoC;AACpC,gFAAoC;AAM3B,cANF,yBAAG,CAME;AALZ,8DAA8B;AAC9B,+DAA4D;AAC5D,4DAA4B;AAC5B,6CAA4C;AAC5C,+BAA0C;AAE1C,gDAAsB;AAEtB,SAAe,IAAI;;QACjB,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;QAE9B,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,WAAW,CAAC,qCAAqC,CAAC,CAAC;QAE7E,OAAO;aACJ,OAAO,CAAC,qBAAqB,CAAC;aAC9B,MAAM,CAAC,oBAAoB,EAAE,oBAAoB,CAAC;aAClD,MAAM,CACL,8BAA8B,EAC9B,2CAA2C,CAC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CAAC,kBAAkB,KAAK,SAAS,EAAE;YAChD,OAAO,SAAS,CAAC;SAClB;QACD,OAAO,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC;KACvC;SAAM,IAAI,WAAW,KAAK,mBAAmB,EAAE;QAC9C,IAAI,OAAO,CAAC,GAAG,CAAC,iBAAiB,KAAK,SAAS,EAAE;YAC/C,OAAO,SAAS,CAAC;SAClB;QACD,OAAO,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC;KACtC;IAED,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,SAAS,aAAa,CAAC,KAAa;IAClC,IAAI,KAAK,KAAK,QAAQ,EAAE;QACtB,OAAO,8CAA8C,CAAC;KACvD;SAAM,IAAI,KAAK,KAAK,OAAO,EAAE;QAC5B,OAAO,8CAA8C,CAAC;KACvD;SAAM,IAAI,KAAK,KAAK,OAAO,EAAE;QAC5B,OAAO,8CAA8C,CAAC;KACvD;SAAM,IAAI,KAAK,KAAK,OAAO,EAAE;QAC5B,OAAO,8CAA8C,CAAC;KACvD;SAAM,IAAI,KAAK,KAAK,eAAe,EAAE;QACpC,OAAO,8CAA8C,CAAC;KACvD;SAAM;QACL,MAAM,KAAK,CAAC,eAAe,CAAC,CAAC;KAC9B;AACH,CAAC;AAED,IAAI,EAAE;KACH,IAAI,CAAC,GAAG,EAAE;IACT,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;IAC3B,OAAO,CAAC,IAAI,EAAE,CAAC;AACjB,CAAC,CAAC;KACD,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;IACX,OAAO,CAAC,KAAK,CAAC,8CAA8C,EAAE,CAAC,CAAC,CAAC;IACjE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC","sourcesContent":["#!/usr/bin/env node\nimport { Command } from \"commander\";\nimport idl from \"./squads_mpl.json\";\nimport Menu from \"./lib/menu\";\nimport CliWallet, { findLedgerAddress } from \"./lib/wallet\";\nimport dotenv from \"dotenv\";\nimport { PublicKey } from \"@solana/web3.js\";\nimport { Chain, Web3Client } from \"./lib\";\nexport { idl };\nexport * from \"./lib\";\n\nasync function main() {\n const program = new Command();\n\n program.name(\"klend-cli\").description(\"CLI to interact with squads program\");\n\n program\n .command(\"print-multisig-list\")\n .option(`--cluster <string>`, \"The cluster or rpc\")\n .option(\n `--ironforge-cluster <string>`,\n \"ironforge-cluster for transaction landing\"\n )\n .option(\n `--ledger-address-key <string>`,\n \"The ledger address for you ledger. usb://ledger\\\\?key=0 by default. Check with solana-keygen pubkey usb://ledger or solana-keygen pubkey usb://ledger\\\\?key=0. 'default' for usb://ledger or <key_number> for usb://ledger\\\\?key=<key_number>\"\n )\n .action(async ({ cluster, ironforgeCluster, ledgerAddressKey }) => {\n const addressKey = fromEnv(ledgerAddressKey, \"LEDGER_ADDRESS_KEY\");\n const clusterVal = fromEnv(cluster, \"CLUSTER\");\n const ironforgeClusterVal = fromEnv(\n ironforgeCluster,\n \"IRONFORGE_CLUSTER\"\n );\n const chain: Chain = {\n name: \"mainnet-beta\",\n endpoint: clusterVal,\n wsEndpoint: clusterVal?.replace(\"https:\", \"wss:\") + \"/whirligig\",\n chainID: 101,\n displayName: \"Mainnet Beta (Triton)\",\n };\n\n const web3Client = new Web3Client(chain, ironforgeClusterVal);\n const cli = await load(web3Client, addressKey, \"print\");\n\n await cli.printMultisigList();\n });\n\n program\n .command(\"create-transaction-from-instruction\")\n .option(`--cluster <string>`, \"The cluster or rpc\")\n .option(\n `--ledger-address-key <string>`,\n \"The ledger address for you ledger. usb://ledger\\\\?key=0 by default. Check with solana-keygen pubkey usb://ledger or solana-keygen pubkey usb://ledger\\\\?key=0. 'default' for usb://ledger or <key_number> for usb://ledger\\\\?key=<key_number>\"\n )\n .option(`--multisig <string>`, \"The multisig pubkey\")\n .option(\n `--squad <string>`,\n \"The squad you want to interact with: klend|kamino|farms|klend-staging\"\n )\n .option(\n `--ironforge-cluster <string>`,\n \"ironforge-cluster for transaction landing\"\n )\n .requiredOption(`--ixn <string>`, \"The ixn base58\")\n .requiredOption(\n `--mode <string>`,\n \"Specify the run mode: print/simulate/propose\"\n )\n .requiredOption(`--title <string>`, \"The title of the squads transaction\")\n .action(\n async ({\n cluster,\n ledgerAddressKey,\n multisig,\n squad,\n ironforgeCluster,\n ixn,\n mode,\n title,\n }) => {\n const addressKey = fromEnv(ledgerAddressKey, \"LEDGER_ADDRESS_KEY\");\n const clusterVal = fromEnv(cluster, \"CLUSTER\");\n const ironforgeClusterVal = fromEnv(\n ironforgeCluster,\n \"IRONFORGE_CLUSTER\"\n );\n const multisigVal = multisig ? multisig : getMultisigPk(squad);\n const chain: Chain = {\n name: \"mainnet-beta\",\n endpoint: clusterVal,\n wsEndpoint: clusterVal?.replace(\"https:\", \"wss:\") + \"/whirligig\",\n chainID: 101,\n displayName: \"Mainnet Beta (Triton)\",\n };\n\n const web3Client = new Web3Client(chain, ironforgeClusterVal);\n const cli = await load(web3Client, addressKey, mode);\n\n await cli.createTransactionFromIxn(multisigVal, ixn, title);\n }\n );\n\n program\n .command(\"create-transaction-from-instructions-file\")\n .option(`--cluster <string>`, \"The cluster or rpc\")\n .option(\n `--ledger-address-key <string>`,\n \"The ledger address for you ledger. usb://ledger\\\\?key=0 by default. Check with solana-keygen pubkey usb://ledger or solana-keygen pubkey usb://ledger\\\\?key=0. 'default' for usb://ledger or <key_number> for usb://ledger\\\\?key=<key_number>\"\n )\n .option(`--multisig <string>`, \"The multisig pubkey\")\n .option(\n `--squad <string>`,\n \"The squad you want to interact with: klend|kamino|farms|klend-staging\"\n )\n .option(\n `--ironforge-cluster <string>`,\n \"ironforge-cluster for transaction landing\"\n )\n .requiredOption(`--file-path <string>`, \"The file path\")\n .option(`--multiply-fee <string>`, \"standard is 1 lamport - multiplier\")\n .requiredOption(\n `--mode <string>`,\n \"Specify the run mode: print/simulate/propose\"\n )\n .requiredOption(`--title <string>`, \"The title of the squads transaction\")\n .action(\n async ({\n cluster,\n ledgerAddressKey,\n multisig,\n squad,\n ironforgeCluster,\n filePath,\n multiplyFee,\n mode,\n title,\n }) => {\n const addressKey = fromEnv(ledgerAddressKey, \"LEDGER_ADDRESS_KEY\");\n const clusterVal = fromEnv(cluster, \"CLUSTER\");\n const ironforgeClusterVal = fromEnv(\n ironforgeCluster,\n \"IRONFORGE_CLUSTER\"\n );\n const multisigVal = new PublicKey(\n multisig ? multisig : getMultisigPk(squad)\n );\n const chain: Chain = {\n name: \"mainnet-beta\",\n endpoint: clusterVal,\n wsEndpoint: clusterVal?.replace(\"https:\", \"wss:\") + \"/whirligig\",\n chainID: 101,\n displayName: \"Mainnet Beta (Triton)\",\n };\n\n const web3Client = new Web3Client(chain, ironforgeClusterVal);\n const cli = await load(web3Client, addressKey, mode);\n\n await cli.createTransactionsFromIxnsFile(\n multisigVal,\n filePath,\n title,\n multiplyFee\n );\n }\n );\n\n program\n .command(\"create-program-upgrade\")\n .option(`--cluster <string>`, \"The cluster or rpc\")\n .option(\n `--ledger-address-key <string>`,\n \"The ledger address for you ledger. usb://ledger\\\\?key=0 by default. Check with solana-keygen pubkey usb://ledger or solana-keygen pubkey usb://ledger\\\\?key=0. 'default' for usb://ledger or <key_number> for usb://ledger\\\\?key=<key_number>\"\n )\n .option(`--multisig <string>`, \"The multisig pubkey\")\n .option(\n `--squad <string>`,\n \"The squad you want to interact with: klend|kamino|farms|klend-staging\"\n )\n .option(\n `--ironforge-cluster <string>`,\n \"ironforge-cluster for transaction landing\"\n )\n .requiredOption(`--program-id <string>`, \"The program ID\")\n .requiredOption(`--buffer <string>`, \"The buffer to send\")\n .requiredOption(\n `--refund-address <string>`,\n \"The refund address to send SOL refund to\"\n )\n .option(`--multiply-fee <string>`, \"standard is 1 lamport - multiplier\")\n .requiredOption(\n `--mode <string>`,\n \"Specify the run mode: print/simulate/propose\"\n )\n .requiredOption(`--title <string>`, \"The title of the squads transaction\")\n .action(\n async ({\n cluster,\n ledgerAddressKey,\n multisig,\n squad,\n ironforgeCluster,\n programId,\n buffer,\n refundAddress,\n multiplyFee,\n mode,\n title,\n }) => {\n const addressKey = fromEnv(ledgerAddressKey, \"LEDGER_ADDRESS_KEY\");\n const clusterVal = fromEnv(cluster, \"CLUSTER\");\n const ironforgeClusterVal = fromEnv(\n ironforgeCluster,\n \"IRONFORGE_CLUSTER\"\n );\n const multisigVal = new PublicKey(\n multisig ? multisig : getMultisigPk(squad)\n );\n\n const chain: Chain = {\n name: \"mainnet-beta\",\n endpoint: clusterVal,\n wsEndpoint: clusterVal?.replace(\"https:\", \"wss:\") + \"/whirligig\",\n chainID: 101,\n displayName: \"Mainnet Beta (Triton)\",\n };\n\n const web3Client = new Web3Client(chain, ironforgeClusterVal);\n\n const cli = await load(web3Client, addressKey, mode);\n\n await cli.createProgramUpgrade(\n multisigVal,\n programId,\n buffer,\n refundAddress,\n title,\n multiplyFee\n );\n }\n );\n\n await program.parseAsync();\n}\n\nconst load = async (\n web3Client: Web3Client,\n addressKey: string,\n mode: string\n): Promise<Menu> => {\n const ledgerWallet = await findLedgerAddress(addressKey);\n const cliWallet = new CliWallet(ledgerWallet);\n\n // init the cli\n const cli = new Menu(cliWallet.wallet, web3Client, mode);\n\n return cli;\n};\n\ndotenv.config();\n\nfunction fromEnv(argValue: string, envVariable: string): string {\n if (argValue) {\n return argValue;\n }\n\n if (envVariable === \"CLUSTER\") {\n if (process.env.CLUSTER === undefined) {\n throw new Error(\n \"CLUSTER must be specified in .env or as a command line argument\"\n );\n }\n return process.env.CLUSTER;\n } else if (envVariable === \"LEDGER_ADDRESS_KEY\") {\n if (process.env.LEDGER_ADDRESS_KEY === undefined) {\n return \"default\";\n }\n return process.env.LEDGER_ADDRESS_KEY;\n } else if (envVariable === \"IRONFORGE_CLUSTER\") {\n if (process.env.IRONFORGE_CLUSTER === undefined) {\n return \"default\";\n }\n return process.env.IRONFORGE_CLUSTER;\n }\n\n return \"\";\n}\n\nfunction getMultisigPk(squad: string): string {\n if (squad === \"kamino\") {\n return \"E35i5qn7872eEmBt15e5VGhziUBzCTm43XCSWvDoQNNv\";\n } else if (squad === \"scope\") {\n return \"E35i5qn7872eEmBt15e5VGhziUBzCTm43XCSWvDoQNNv\";\n } else if (squad === \"farms\") {\n return \"BbM3mbcLsa3QcYEVx8iovwfKaA1iZ6DK5fEbbtHwS3N8\";\n } else if (squad === \"klend\") {\n return \"A9rQoX1sictAQkyXxaZA8nz674xutHwoqpK2mwLyexCZ\";\n } else if (squad === \"klend-staging\") {\n return \"BxdLNhoRXVs45wTVAZBrYQUkxbex5zXFCaJtsuRpoqMj\";\n } else {\n throw Error(\"Invalid squad\");\n }\n}\n\nmain()\n .then(() => {\n console.log(\"\\n\\nSuccess\");\n process.exit();\n })\n .catch((e) => {\n console.error(\"\\n\\nSquads Kamino CLI exited with error:\\n\\n\", e);\n process.exit(1);\n });\n"]}
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import Squads, { ProgramUpgradeAccount } from "@sqds/sdk";
|
|
3
|
+
import * as anchor from "@coral-xyz/anchor";
|
|
4
|
+
import { Web3Client } from "../index";
|
|
5
|
+
import { Wallet } from "@coral-xyz/anchor";
|
|
6
|
+
import { PublicKey, TransactionInstruction } from "@solana/web3.js";
|
|
7
|
+
declare class API {
|
|
8
|
+
squads: Squads;
|
|
9
|
+
wallet: anchor.Wallet;
|
|
10
|
+
web3Client: Web3Client;
|
|
11
|
+
cluster: string;
|
|
12
|
+
programId: PublicKey;
|
|
13
|
+
program: anchor.Program<anchor.Idl>;
|
|
14
|
+
provider: anchor.AnchorProvider;
|
|
15
|
+
programManagerId: PublicKey;
|
|
16
|
+
constructor(wallet: Wallet, web3Client: Web3Client, programId: PublicKey, programManagerId: PublicKey);
|
|
17
|
+
getSquadExtended: (ms: PublicKey) => Promise<{
|
|
18
|
+
threshold: number;
|
|
19
|
+
authorityIndex: number;
|
|
20
|
+
transactionIndex: number;
|
|
21
|
+
msChangeIndex: number;
|
|
22
|
+
bump: number;
|
|
23
|
+
createKey: anchor.web3.PublicKey;
|
|
24
|
+
allowExternalExecute: boolean;
|
|
25
|
+
keys: anchor.web3.PublicKey[];
|
|
26
|
+
} & {
|
|
27
|
+
publicKey: anchor.web3.PublicKey;
|
|
28
|
+
}>;
|
|
29
|
+
getSquads: () => Promise<({
|
|
30
|
+
threshold: number;
|
|
31
|
+
authorityIndex: number;
|
|
32
|
+
transactionIndex: number;
|
|
33
|
+
msChangeIndex: number;
|
|
34
|
+
bump: number;
|
|
35
|
+
createKey: anchor.web3.PublicKey;
|
|
36
|
+
allowExternalExecute: boolean;
|
|
37
|
+
keys: anchor.web3.PublicKey[];
|
|
38
|
+
} & {
|
|
39
|
+
publicKey: anchor.web3.PublicKey;
|
|
40
|
+
})[]>;
|
|
41
|
+
getTransactions: (ms: any) => Promise<({
|
|
42
|
+
creator: anchor.web3.PublicKey;
|
|
43
|
+
ms: anchor.web3.PublicKey;
|
|
44
|
+
transactionIndex: number;
|
|
45
|
+
authorityIndex: number;
|
|
46
|
+
authorityBump: number;
|
|
47
|
+
status: {
|
|
48
|
+
draft?: Record<string, never> | undefined;
|
|
49
|
+
active?: Record<string, never> | undefined;
|
|
50
|
+
executeReady?: Record<string, never> | undefined;
|
|
51
|
+
executed?: Record<string, never> | undefined;
|
|
52
|
+
rejected?: Record<string, never> | undefined;
|
|
53
|
+
cancelled?: Record<string, never> | undefined;
|
|
54
|
+
};
|
|
55
|
+
instructionIndex: number;
|
|
56
|
+
bump: number;
|
|
57
|
+
approved: anchor.web3.PublicKey[];
|
|
58
|
+
rejected: anchor.web3.PublicKey[];
|
|
59
|
+
cancelled: anchor.web3.PublicKey[];
|
|
60
|
+
executedIndex: number;
|
|
61
|
+
} & {
|
|
62
|
+
publicKey: anchor.web3.PublicKey;
|
|
63
|
+
})[]>;
|
|
64
|
+
createMultisig: (threshold: number, createKey: PublicKey, members: PublicKey[]) => Promise<{
|
|
65
|
+
threshold: number;
|
|
66
|
+
authorityIndex: number;
|
|
67
|
+
transactionIndex: number;
|
|
68
|
+
msChangeIndex: number;
|
|
69
|
+
bump: number;
|
|
70
|
+
createKey: anchor.web3.PublicKey;
|
|
71
|
+
allowExternalExecute: boolean;
|
|
72
|
+
keys: anchor.web3.PublicKey[];
|
|
73
|
+
} & {
|
|
74
|
+
publicKey: anchor.web3.PublicKey;
|
|
75
|
+
}>;
|
|
76
|
+
getProgramDataAuthority: (programId: PublicKey) => Promise<any>;
|
|
77
|
+
getParsed: (account: anchor.web3.RpcResponseAndContext<anchor.web3.AccountInfo<Buffer | anchor.web3.ParsedAccountData> | null>) => any;
|
|
78
|
+
getValidatorWithdrawAuth: (validatorAddress: anchor.web3.PublicKey) => Promise<any>;
|
|
79
|
+
createTransferWithdrawAuthTx: (msPDA: PublicKey, validatorId: PublicKey, currentAuthority: PublicKey, newAuthorizedPubkey: PublicKey) => Promise<anchor.web3.PublicKey>;
|
|
80
|
+
createActivateAndApproveTxWithIxns: (msPDA: PublicKey, ixns: TransactionInstruction[], txTitle: string, multiplyFee?: number) => Promise<any>;
|
|
81
|
+
sendAndConfirmRawTx: (tx: anchor.web3.Transaction) => Promise<any>;
|
|
82
|
+
signSendAndConfirmRawTx: (tx: anchor.web3.Transaction) => Promise<any>;
|
|
83
|
+
createSafeAuthorityTx: (msPDA: PublicKey, programId: PublicKey, currentAuthority: PublicKey, newAuthority: PublicKey) => Promise<anchor.web3.PublicKey>;
|
|
84
|
+
executeTransaction: (tx: PublicKey) => Promise<{
|
|
85
|
+
creator: anchor.web3.PublicKey;
|
|
86
|
+
ms: anchor.web3.PublicKey;
|
|
87
|
+
transactionIndex: number;
|
|
88
|
+
authorityIndex: number;
|
|
89
|
+
authorityBump: number;
|
|
90
|
+
status: {
|
|
91
|
+
draft?: Record<string, never> | undefined;
|
|
92
|
+
active?: Record<string, never> | undefined;
|
|
93
|
+
executeReady?: Record<string, never> | undefined;
|
|
94
|
+
executed?: Record<string, never> | undefined;
|
|
95
|
+
rejected?: Record<string, never> | undefined;
|
|
96
|
+
cancelled?: Record<string, never> | undefined;
|
|
97
|
+
};
|
|
98
|
+
instructionIndex: number;
|
|
99
|
+
bump: number;
|
|
100
|
+
approved: anchor.web3.PublicKey[];
|
|
101
|
+
rejected: anchor.web3.PublicKey[];
|
|
102
|
+
cancelled: anchor.web3.PublicKey[];
|
|
103
|
+
executedIndex: number;
|
|
104
|
+
} & {
|
|
105
|
+
publicKey: anchor.web3.PublicKey;
|
|
106
|
+
}>;
|
|
107
|
+
executeInstruction: (tx: PublicKey, ix: PublicKey) => Promise<{
|
|
108
|
+
programId: anchor.web3.PublicKey;
|
|
109
|
+
keys: {
|
|
110
|
+
pubkey: anchor.web3.PublicKey;
|
|
111
|
+
isSigner: boolean;
|
|
112
|
+
isWritable: boolean;
|
|
113
|
+
}[];
|
|
114
|
+
data: Buffer;
|
|
115
|
+
instructionIndex: number;
|
|
116
|
+
bump: number;
|
|
117
|
+
executed: boolean;
|
|
118
|
+
} & {
|
|
119
|
+
publicKey: anchor.web3.PublicKey;
|
|
120
|
+
}>;
|
|
121
|
+
executeTransactionBuilder: (tx: PublicKey) => Promise<anchor.web3.TransactionInstruction>;
|
|
122
|
+
executeInstructionBuilder: (tx: PublicKey, ix: PublicKey) => Promise<anchor.web3.TransactionInstruction>;
|
|
123
|
+
approveTransaction: (tx: PublicKey) => Promise<any>;
|
|
124
|
+
rejectTransaction: (tx: PublicKey) => Promise<{
|
|
125
|
+
creator: anchor.web3.PublicKey;
|
|
126
|
+
ms: anchor.web3.PublicKey;
|
|
127
|
+
transactionIndex: number;
|
|
128
|
+
authorityIndex: number;
|
|
129
|
+
authorityBump: number;
|
|
130
|
+
status: {
|
|
131
|
+
draft?: Record<string, never> | undefined;
|
|
132
|
+
active?: Record<string, never> | undefined;
|
|
133
|
+
executeReady?: Record<string, never> | undefined;
|
|
134
|
+
executed?: Record<string, never> | undefined;
|
|
135
|
+
rejected?: Record<string, never> | undefined;
|
|
136
|
+
cancelled?: Record<string, never> | undefined;
|
|
137
|
+
};
|
|
138
|
+
instructionIndex: number;
|
|
139
|
+
bump: number;
|
|
140
|
+
approved: anchor.web3.PublicKey[];
|
|
141
|
+
rejected: anchor.web3.PublicKey[];
|
|
142
|
+
cancelled: anchor.web3.PublicKey[];
|
|
143
|
+
executedIndex: number;
|
|
144
|
+
} & {
|
|
145
|
+
publicKey: anchor.web3.PublicKey;
|
|
146
|
+
}>;
|
|
147
|
+
cancelTransaction: (tx: PublicKey) => Promise<{
|
|
148
|
+
creator: anchor.web3.PublicKey;
|
|
149
|
+
ms: anchor.web3.PublicKey;
|
|
150
|
+
transactionIndex: number;
|
|
151
|
+
authorityIndex: number;
|
|
152
|
+
authorityBump: number;
|
|
153
|
+
status: {
|
|
154
|
+
draft?: Record<string, never> | undefined;
|
|
155
|
+
active?: Record<string, never> | undefined;
|
|
156
|
+
executeReady?: Record<string, never> | undefined;
|
|
157
|
+
executed?: Record<string, never> | undefined;
|
|
158
|
+
rejected?: Record<string, never> | undefined;
|
|
159
|
+
cancelled?: Record<string, never> | undefined;
|
|
160
|
+
};
|
|
161
|
+
instructionIndex: number;
|
|
162
|
+
bump: number;
|
|
163
|
+
approved: anchor.web3.PublicKey[];
|
|
164
|
+
rejected: anchor.web3.PublicKey[];
|
|
165
|
+
cancelled: anchor.web3.PublicKey[];
|
|
166
|
+
executedIndex: number;
|
|
167
|
+
} & {
|
|
168
|
+
publicKey: anchor.web3.PublicKey;
|
|
169
|
+
}>;
|
|
170
|
+
addKeyTransaction: (msPDA: PublicKey, key: PublicKey) => Promise<{
|
|
171
|
+
creator: anchor.web3.PublicKey;
|
|
172
|
+
ms: anchor.web3.PublicKey;
|
|
173
|
+
transactionIndex: number;
|
|
174
|
+
authorityIndex: number;
|
|
175
|
+
authorityBump: number;
|
|
176
|
+
status: {
|
|
177
|
+
draft?: Record<string, never> | undefined;
|
|
178
|
+
active?: Record<string, never> | undefined;
|
|
179
|
+
executeReady?: Record<string, never> | undefined;
|
|
180
|
+
executed?: Record<string, never> | undefined;
|
|
181
|
+
rejected?: Record<string, never> | undefined;
|
|
182
|
+
cancelled?: Record<string, never> | undefined;
|
|
183
|
+
};
|
|
184
|
+
instructionIndex: number;
|
|
185
|
+
bump: number;
|
|
186
|
+
approved: anchor.web3.PublicKey[];
|
|
187
|
+
rejected: anchor.web3.PublicKey[];
|
|
188
|
+
cancelled: anchor.web3.PublicKey[];
|
|
189
|
+
executedIndex: number;
|
|
190
|
+
} & {
|
|
191
|
+
publicKey: anchor.web3.PublicKey;
|
|
192
|
+
}>;
|
|
193
|
+
removeKeyTransaction: (msPDA: PublicKey, key: PublicKey) => Promise<{
|
|
194
|
+
creator: anchor.web3.PublicKey;
|
|
195
|
+
ms: anchor.web3.PublicKey;
|
|
196
|
+
transactionIndex: number;
|
|
197
|
+
authorityIndex: number;
|
|
198
|
+
authorityBump: number;
|
|
199
|
+
status: {
|
|
200
|
+
draft?: Record<string, never> | undefined;
|
|
201
|
+
active?: Record<string, never> | undefined;
|
|
202
|
+
executeReady?: Record<string, never> | undefined;
|
|
203
|
+
executed?: Record<string, never> | undefined;
|
|
204
|
+
rejected?: Record<string, never> | undefined;
|
|
205
|
+
cancelled?: Record<string, never> | undefined;
|
|
206
|
+
};
|
|
207
|
+
instructionIndex: number;
|
|
208
|
+
bump: number;
|
|
209
|
+
approved: anchor.web3.PublicKey[];
|
|
210
|
+
rejected: anchor.web3.PublicKey[];
|
|
211
|
+
cancelled: anchor.web3.PublicKey[];
|
|
212
|
+
executedIndex: number;
|
|
213
|
+
} & {
|
|
214
|
+
publicKey: anchor.web3.PublicKey;
|
|
215
|
+
}>;
|
|
216
|
+
changeThresholdTransaction: (msPDA: PublicKey, threshold: number) => Promise<{
|
|
217
|
+
creator: anchor.web3.PublicKey;
|
|
218
|
+
ms: anchor.web3.PublicKey;
|
|
219
|
+
transactionIndex: number;
|
|
220
|
+
authorityIndex: number;
|
|
221
|
+
authorityBump: number;
|
|
222
|
+
status: {
|
|
223
|
+
draft?: Record<string, never> | undefined;
|
|
224
|
+
active?: Record<string, never> | undefined;
|
|
225
|
+
executeReady?: Record<string, never> | undefined;
|
|
226
|
+
executed?: Record<string, never> | undefined;
|
|
227
|
+
rejected?: Record<string, never> | undefined;
|
|
228
|
+
cancelled?: Record<string, never> | undefined;
|
|
229
|
+
};
|
|
230
|
+
instructionIndex: number;
|
|
231
|
+
bump: number;
|
|
232
|
+
approved: anchor.web3.PublicKey[];
|
|
233
|
+
rejected: anchor.web3.PublicKey[];
|
|
234
|
+
cancelled: anchor.web3.PublicKey[];
|
|
235
|
+
executedIndex: number;
|
|
236
|
+
} & {
|
|
237
|
+
publicKey: anchor.web3.PublicKey;
|
|
238
|
+
}>;
|
|
239
|
+
createTransaction(msPDA: PublicKey, authorityIndex: number): Promise<any>;
|
|
240
|
+
addInstruction(txPDA: PublicKey, ix: anchor.web3.TransactionInstruction): Promise<any>;
|
|
241
|
+
activate(txPDA: PublicKey): Promise<any>;
|
|
242
|
+
getWalletBalance(cb?: (balance: number) => void): Promise<number>;
|
|
243
|
+
createATA(mint: PublicKey, owner: PublicKey): Promise<anchor.web3.PublicKey>;
|
|
244
|
+
txTitleUpdateIx(msPDA: PublicKey, txPDA: PublicKey, member: PublicKey, title: string): TransactionInstruction;
|
|
245
|
+
createProgramUpgrade(multisigAuthority: PublicKey, msPDA: PublicKey, programId: PublicKey, buffer: PublicKey, refundAccount: PublicKey, title: string): Promise<{
|
|
246
|
+
managedProgramAddress: anchor.web3.PublicKey;
|
|
247
|
+
upgradeIndex: number;
|
|
248
|
+
createdOn: anchor.BN;
|
|
249
|
+
upgradedOn: anchor.BN;
|
|
250
|
+
executed: boolean;
|
|
251
|
+
bump: number;
|
|
252
|
+
upgradeIx: {
|
|
253
|
+
programId: anchor.web3.PublicKey;
|
|
254
|
+
accounts: {
|
|
255
|
+
pubkey: anchor.web3.PublicKey;
|
|
256
|
+
isSigner: boolean;
|
|
257
|
+
isWritable: boolean;
|
|
258
|
+
}[];
|
|
259
|
+
upgradeInstructionData: Buffer;
|
|
260
|
+
};
|
|
261
|
+
name: string;
|
|
262
|
+
} & {
|
|
263
|
+
publicKey: anchor.web3.PublicKey;
|
|
264
|
+
}>;
|
|
265
|
+
initializeProgramUpgrade(programUpgradeAccount: ProgramUpgradeAccount, msPDA: PublicKey, txTitle: string, multiplyFee: number): Promise<any[]>;
|
|
266
|
+
}
|
|
267
|
+
export declare function retryAsync(fn: () => Promise<any>, retriesLeft?: number, interval?: number): Promise<any>;
|
|
268
|
+
export declare function retryAsyncFirstSigned(fnSigned: () => Promise<any>, fn: () => Promise<any>, retriesLeft?: number, interval?: number): Promise<any>;
|
|
269
|
+
export declare function noopProfiledFunctionExecution(promise: Promise<any>): Promise<any>;
|
|
270
|
+
export default API;
|