@glamsystems/glam-cli 0.1.15 → 0.1.16
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 +16 -43
- package/main.js +9 -8
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -29,11 +29,13 @@ The CLI expects a configuration file at `~/.config/glam/config.json`. The file s
|
|
|
29
29
|
}
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
+
_At minimum, you need to provide `cluster`, `json_rpc_url`, and `keypair_path`._
|
|
33
|
+
|
|
32
34
|
Here's a quick explanation of each field:
|
|
33
35
|
|
|
34
36
|
- `cluster`: Value must be one of `mainnet-beta`, `devnet`, or `localnet`.
|
|
35
37
|
- `json_rpc_url`: The URL of your preferred Solana JSON RPC endpoint.
|
|
36
|
-
- `tx_rpc_url`: Optional. If not set it
|
|
38
|
+
- `tx_rpc_url`: Optional. If not set it defaults to `json_rpc_url`. Use this to specify a separate RPC endpoint you want to use for landing transactions.
|
|
37
39
|
- `keypair_path`: Path to your keypair JSON file.
|
|
38
40
|
- `priority_fee`:
|
|
39
41
|
- `micro_lamports`: Optional (defaults to 0). If provided, `level` and `helius_api_key` will be ignored.
|
|
@@ -71,6 +73,19 @@ Run `glam-cli --help` to see all available commands. Here are the main command c
|
|
|
71
73
|
- `glam-cli delegate set <pubkey> <permissions...>` - Set delegate permissions
|
|
72
74
|
- `glam-cli delegate delete <pubkey>` - Revoke all delegate permissions for a pubkey
|
|
73
75
|
|
|
76
|
+
### Mint Management
|
|
77
|
+
|
|
78
|
+
- `glam-cli mint holders` - List all token holders
|
|
79
|
+
- `glam-cli mint update <state> <options...>` - Update mint policies
|
|
80
|
+
- `-l, --lockup <seconds>` - Set lockup period in seconds
|
|
81
|
+
- `-f, --frozen <boolean>` - Set default account state frozen
|
|
82
|
+
- `glam-cli mint create-account <owner>` - Idempotent create a token account for a user
|
|
83
|
+
- `glam-cli mint freeze <accounts...>` - Freeze token accounts (space-separated pubkeys)
|
|
84
|
+
- `glam-cli mint unfreeze <accounts...>` - Unfreeze token accounts (space-separated pubkeys)
|
|
85
|
+
- `glam-cli mint issue <recipient> <amount>` - Mint tokens to a recipient
|
|
86
|
+
- `glam-cli mint burn <from> <amount>` - Burn tokens from a user
|
|
87
|
+
- `glam-cli mint transfer <from> <to> <amount>` - Force transfer tokens between accounts
|
|
88
|
+
|
|
74
89
|
### Integration Management
|
|
75
90
|
|
|
76
91
|
- `glam-cli integration list` - List all enabled integrations
|
|
@@ -118,45 +133,3 @@ pnpm install && pnpm run cli-build
|
|
|
118
133
|
```bash
|
|
119
134
|
npx nx run cli:dev -- --args="command [options]"
|
|
120
135
|
```
|
|
121
|
-
|
|
122
|
-
## Docker Support
|
|
123
|
-
|
|
124
|
-
### Build Docker Image
|
|
125
|
-
|
|
126
|
-
From the root of the repo:
|
|
127
|
-
|
|
128
|
-
```bash
|
|
129
|
-
docker build -f ./cli/Dockerfile -t glam-cli .
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
We have a pre-built docker image available at https://github.com/glamsystems/glam/pkgs/container/glam-cli. To pull the latest image:
|
|
133
|
-
|
|
134
|
-
```bash
|
|
135
|
-
docker pull ghcr.io/glamsystems/glam-cli
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
### Run in Docker Container
|
|
139
|
-
|
|
140
|
-
Mount your configuration directory to the container's `/workspace`:
|
|
141
|
-
|
|
142
|
-
```bash
|
|
143
|
-
docker run -v $HOME/.glam-cli-docker:/workspace glam-cli [command] [options]
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
The mounted directory should contain:
|
|
147
|
-
|
|
148
|
-
- `config.json` - CLI configuration file
|
|
149
|
-
- `keypair.json` - Your Solana keypair file
|
|
150
|
-
|
|
151
|
-
Example config for Docker:
|
|
152
|
-
|
|
153
|
-
```json
|
|
154
|
-
{
|
|
155
|
-
"cluster": "mainnet-beta",
|
|
156
|
-
"json_rpc_url": "[your-rpc-url]",
|
|
157
|
-
"keypair_path": "/workspace/keypair.json",
|
|
158
|
-
"priority_fee": {
|
|
159
|
-
"micro_lamports": 0
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
```
|
package/main.js
CHANGED
|
@@ -759,7 +759,7 @@ class BaseClient {
|
|
|
759
759
|
tx.recentBlockhash = recentBlockhash;
|
|
760
760
|
tx.feePayer = signer;
|
|
761
761
|
console.log("Tx (base64):", tx.serialize({ verifySignatures: false }).toString("base64"));
|
|
762
|
-
console.error("Simulation failed.");
|
|
762
|
+
console.error("Simulation failed. If error message is too obscure, inspect the tx in explorer (https://explorer.solana.com/tx/inspector)");
|
|
763
763
|
throw e;
|
|
764
764
|
}
|
|
765
765
|
}
|
|
@@ -3579,11 +3579,12 @@ class StateClient {
|
|
|
3579
3579
|
const vTx = await this.base.intoVersionedTransaction(tx, txOptions);
|
|
3580
3580
|
return await this.base.sendAndConfirm(vTx);
|
|
3581
3581
|
}));
|
|
3582
|
-
console.log("addMintTxs", addMintTxs);
|
|
3583
3582
|
return [txSig, glamState];
|
|
3584
3583
|
}
|
|
3585
3584
|
async updateState(glamState, updated, txOptions = {}) {
|
|
3586
|
-
|
|
3585
|
+
if (process.env.NODE_ENV === "development") {
|
|
3586
|
+
console.log(`await glam.state.updateState("${glamState.toString()}", ${JSON.stringify(updated)}, ${JSON.stringify(txOptions)});`);
|
|
3587
|
+
}
|
|
3587
3588
|
const tx = await this.updateStateTx(getPublicKey(glamState), updated, txOptions);
|
|
3588
3589
|
return await this.base.sendAndConfirm(tx);
|
|
3589
3590
|
}
|
|
@@ -3863,8 +3864,8 @@ class MintClient {
|
|
|
3863
3864
|
}
|
|
3864
3865
|
// `getTokenAccounts` is a helius only RPC endpoint, we have to hardcode the URL here
|
|
3865
3866
|
// We cannot use NEXT_PUBLIC_SOLANA_RPC because users may choose to use a non-helius RPC
|
|
3866
|
-
async fetchTokenHolders(state) {
|
|
3867
|
-
const mint = this.base.getMintPda(state,
|
|
3867
|
+
async fetchTokenHolders(state, mintId = 0) {
|
|
3868
|
+
const mint = this.base.getMintPda(state, mintId);
|
|
3868
3869
|
const response = await fetch(`https://${this.base.cluster}.helius-rpc.com/?api-key=${process.env.NEXT_PUBLIC_HELIUS_API_KEY}`, {
|
|
3869
3870
|
method: "POST",
|
|
3870
3871
|
headers: { "Content-Type": "application/json" },
|
|
@@ -5327,7 +5328,7 @@ let globalOpts = { skipSimulation: false };
|
|
|
5327
5328
|
program
|
|
5328
5329
|
.name("glam-cli")
|
|
5329
5330
|
.description("CLI for interacting with the GLAM Protocol")
|
|
5330
|
-
.version("0.1.
|
|
5331
|
+
.version("0.1.16")
|
|
5331
5332
|
.option("-S, --skip-simulation", "Skip transaction simulation");
|
|
5332
5333
|
program
|
|
5333
5334
|
.command("env")
|
|
@@ -6279,7 +6280,7 @@ mint
|
|
|
6279
6280
|
});
|
|
6280
6281
|
mint
|
|
6281
6282
|
.command("update")
|
|
6282
|
-
.description("Update mint
|
|
6283
|
+
.description("Update mint policies")
|
|
6283
6284
|
.option("-l, --lockup <seconds>", "Set lockup period in seconds")
|
|
6284
6285
|
.option("-f, --frozen <boolean>", "Set default account state frozen")
|
|
6285
6286
|
.action(async (options) => {
|
|
@@ -6303,7 +6304,7 @@ mint
|
|
|
6303
6304
|
}
|
|
6304
6305
|
try {
|
|
6305
6306
|
const txSig = await glamClient.mint.update(statePda, 0, mintModel);
|
|
6306
|
-
console.log(`Updated mint
|
|
6307
|
+
console.log(`Updated mint policies:`, txSig);
|
|
6307
6308
|
}
|
|
6308
6309
|
catch (e) {
|
|
6309
6310
|
console.error((0, utils_1.parseTxError)(e));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@glamsystems/glam-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.16",
|
|
4
4
|
"description": "CLI for interacting with the GLAM Protocol",
|
|
5
5
|
"main": "./main.js",
|
|
6
6
|
"bin": {
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"node": ">=20.18.0"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@glamsystems/glam-sdk": "0.1.
|
|
24
|
+
"@glamsystems/glam-sdk": "0.1.16",
|
|
25
25
|
"commander": "^11.1.0",
|
|
26
26
|
"inquirer": "^8.2.6",
|
|
27
27
|
"@switchboard-xyz/common": "^3.0.0"
|