@glamsystems/glam-cli 0.1.18 → 0.1.19

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.
Files changed (3) hide show
  1. package/README.md +2 -122
  2. package/main.js +10 -22
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -10,126 +10,6 @@ npm install -g @glamsystems/glam-cli
10
10
 
11
11
  After installation, you can use the CLI with the `glam-cli` command.
12
12
 
13
- ## Configure
13
+ ## Documentation
14
14
 
15
- The CLI expects a configuration file at `~/.config/glam/config.json`. The file should contain the following content:
16
-
17
- ```json
18
- {
19
- "cluster": "",
20
- "json_rpc_url": "",
21
- "tx_rpc_url": "",
22
- "keypair_path": "",
23
- "priority_fee": {
24
- "micro_lamports": 0,
25
- "level": "",
26
- "helius_api_key": ""
27
- },
28
- "glam_state": ""
29
- }
30
- ```
31
-
32
- _At minimum, you need to provide `cluster`, `json_rpc_url`, and `keypair_path`._
33
-
34
- Here's a quick explanation of each field:
35
-
36
- - `cluster`: Value must be one of `mainnet-beta`, `devnet`, or `localnet`.
37
- - `json_rpc_url`: The URL of your preferred Solana JSON RPC endpoint.
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.
39
- - `keypair_path`: Path to your keypair JSON file.
40
- - `priority_fee`:
41
- - `micro_lamports`: Optional (defaults to 0). If provided, `level` and `helius_api_key` will be ignored.
42
- - `level`: Optional (defaults to `Min`). Only applied if cluster is `mainnet-beta`. Other options are `Min`, `Medium`, `High`, `VeryHigh`, `UnsafeMax`, `Default` (more info can be found [here](https://docs.helius.dev/solana-apis/priority-fee-api)).
43
- - `helius_api_key`: Optional. Only applied if cluster is `mainnet-beta`. If not provided `level` will be ignored. The API key is needed to fetch the priority fee estimate from Helius.
44
- - `glam_state`: Optional. If you want to set a default active GLAM state, you can do so here. Alternatively, you can use the `set` command to set the active GLAM state later on.
45
-
46
- ## Commands
47
-
48
- Run `glam-cli --help` to see all available commands. Here are the main command categories:
49
-
50
- ### General Commands
51
-
52
- - `glam-cli env` - Show environment setup
53
- - `glam-cli list` - List GLAM products the wallet has access to
54
- - `-o, --owner-only` - Only list products the wallet owns
55
- - `-a, --all` - List all GLAM products
56
-
57
- ### Product Management
58
-
59
- - `glam-cli view [state]` - View a GLAM product by its state pubkey
60
- - `-c, --compact` - Compact output
61
- - `glam-cli set <state>` - Set active GLAM product
62
- - `glam-cli create <path>` - Create a new GLAM product from a JSON file
63
- - `glam-cli close [state]` - Close a GLAM product
64
- - `-y, --yes` - Skip confirmation prompt
65
- - `glam-cli update-owner <new-owner-pubkey>` - Update the owner of a GLAM product (**dangerous! may lead to loss of assets if you don't control the new owner wallet**)
66
- - `-y, --yes` - Skip confirmation prompt
67
- - `glam-cli withdraw <asset> <amount>` - Withdraw asset (mint address) from the vault
68
- - `-y, --yes` - Skip confirmation prompt
69
-
70
- ### Delegate Management
71
-
72
- - `glam-cli delegate list` - List delegates and permissions
73
- - `glam-cli delegate set <pubkey> <permissions...>` - Set delegate permissions
74
- - `glam-cli delegate delete <pubkey>` - Revoke all delegate permissions for a pubkey
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
-
89
- ### Integration Management
90
-
91
- - `glam-cli integration list` - List all enabled integrations
92
- - `glam-cli integration enable <name>` - Enable an integration
93
- - `glam-cli integration disable <name>` - Disable an integration
94
-
95
- ### Token Operations
96
-
97
- - `glam-cli swap <from> <to> <amount>` - Swap assets held in the vault
98
- - `-m, --max-accounts <num>` - Specify max accounts allowed
99
- - `-s, --slippage-bps <bps>` - Specify slippage bps
100
- - `-d, --only-direct-routes` - Direct routes only
101
-
102
- ### Liquid Staking
103
-
104
- - `glam-cli lst stake <stakepool> <amount>` - Stake `<amount>` SOL into `<stakepool>`
105
- - `glam-cli lst unstake <asset> <amount>` - Unstake `<amount>` worth of `<asset>` (mint address)
106
- - `glam-cli lst list` - List all stake accounts
107
- - `glam-cli lst withdraw <accounts...>` - Withdraw staking accounts (space-separated pubkeys)
108
- - `glam-cli lst marinade-list` - List all Marinade tickets
109
- - `glam-cli lst marinade-claim <tickets...>` - Claim Marinade tickets (space-separated)
110
-
111
- ### Jupiter (JUP) Staking
112
-
113
- - `glam-cli jup stake <amount>` - Stake JUP tokens
114
- - `glam-cli jup unstake` - Unstake all JUP tokens
115
- - `glam-cli jup withdraw` - Withdraw all unstaked JUP
116
-
117
- ### Governance
118
-
119
- - `glam-cli vote <proposal> <side>` - Vote on a proposal
120
-
121
- ## Development
122
-
123
- ### Build from Source
124
-
125
- Clone https://github.com/glamsystems/glam/, enter the repo and run:
126
-
127
- ```bash
128
- pnpm install && pnpm run cli-build
129
- ```
130
-
131
- ### Run in Development Mode
132
-
133
- ```bash
134
- npx nx run cli:dev -- --args="command [options]"
135
- ```
15
+ Please visit [GLAM CLI Documentation](https://docs.glam.systems/cli/) for more information.
package/main.js CHANGED
@@ -4221,9 +4221,9 @@ class KaminoLendingClient {
4221
4221
  const parsed = {
4222
4222
  address: reserves[i],
4223
4223
  farmCollateral: farmCollateral.equals(web3_js_1.PublicKey.default)
4224
- ? undefined
4224
+ ? null
4225
4225
  : farmCollateral,
4226
- farmDebt: farmDebt.equals(web3_js_1.PublicKey.default) ? undefined : farmDebt,
4226
+ farmDebt: farmDebt.equals(web3_js_1.PublicKey.default) ? null : farmDebt,
4227
4227
  liquidityMint,
4228
4228
  ...this.reservePdas(market, liquidityMint),
4229
4229
  };
@@ -4259,9 +4259,9 @@ class KaminoLendingClient {
4259
4259
  const parsed = {
4260
4260
  address: account.pubkey,
4261
4261
  farmCollateral: farmCollateral.equals(web3_js_1.PublicKey.default)
4262
- ? undefined
4262
+ ? null
4263
4263
  : farmCollateral,
4264
- farmDebt: farmDebt.equals(web3_js_1.PublicKey.default) ? undefined : farmDebt,
4264
+ farmDebt: farmDebt.equals(web3_js_1.PublicKey.default) ? null : farmDebt,
4265
4265
  liquidityMint: asset,
4266
4266
  ...this.reservePdas(market, asset),
4267
4267
  };
@@ -4373,7 +4373,6 @@ class KaminoLendingClient {
4373
4373
  liquidityTokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
4374
4374
  instructionSysvarAccount: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
4375
4375
  obligationFarmUserState: obligationFarm,
4376
- // @ts-ignore
4377
4376
  reserveFarmState: depositReserve.farmCollateral,
4378
4377
  farmsProgram: constants_1.KAMINO_FARM_PROGRAM,
4379
4378
  })
@@ -4460,7 +4459,6 @@ class KaminoLendingClient {
4460
4459
  liquidityTokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
4461
4460
  instructionSysvarAccount: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
4462
4461
  obligationFarmUserState: obligationFarm,
4463
- // @ts-ignore
4464
4462
  reserveFarmState: withdrawReserve.farmCollateral,
4465
4463
  farmsProgram: constants_1.KAMINO_FARM_PROGRAM,
4466
4464
  })
@@ -4554,7 +4552,6 @@ class KaminoLendingClient {
4554
4552
  instructionSysvarAccount: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
4555
4553
  tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
4556
4554
  obligationFarmUserState: obligationFarm,
4557
- // @ts-ignore
4558
4555
  reserveFarmState: borrowReserve.farmDebt,
4559
4556
  farmsProgram: constants_1.KAMINO_FARM_PROGRAM,
4560
4557
  })
@@ -4629,7 +4626,6 @@ class KaminoLendingClient {
4629
4626
  instructionSysvarAccount: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
4630
4627
  tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
4631
4628
  obligationFarmUserState: obligationFarm,
4632
- // @ts-ignore
4633
4629
  reserveFarmState: repayReserve.farmDebt,
4634
4630
  farmsProgram: constants_1.KAMINO_FARM_PROGRAM,
4635
4631
  })
@@ -6196,7 +6192,7 @@ function installKlendCommands(klend, glamClient, cliConfig, txOptions = {}) {
6196
6192
  }
6197
6193
  try {
6198
6194
  const txSig = await glamClient.kaminoLending.withdraw(statePda, market, asset, parseFloat(amount) * 10 ** decimals, txOptions);
6199
- console.log(`Repaid ${amount} ${asset} to Kamino:`, txSig);
6195
+ console.log(`Withdraw ${amount} ${asset} from Kamino:`, txSig);
6200
6196
  }
6201
6197
  catch (e) {
6202
6198
  console.error((0, utils_1.parseTxError)(e));
@@ -6419,12 +6415,8 @@ function installIntegrationCommands(integration, glamClient, cliConfig, txOption
6419
6415
  integrations: [...stateModel.integrations, { [integration]: {} }],
6420
6416
  });
6421
6417
  try {
6422
- const txSig = await glamClient.program.methods
6423
- .updateState(updated)
6424
- .accounts({ glamState: statePda })
6425
- .rpc();
6426
- console.log("txSig:", txSig);
6427
- console.log(`${integration} enabled on ${stateModel} (${statePda.toBase58()})`);
6418
+ const txSig = await glamClient.state.updateState(statePda, updated);
6419
+ console.log(`${integration} enabled: ${txSig}`);
6428
6420
  }
6429
6421
  catch (e) {
6430
6422
  console.error((0, utils_1.parseTxError)(e));
@@ -6448,12 +6440,8 @@ function installIntegrationCommands(integration, glamClient, cliConfig, txOption
6448
6440
  integrations: stateModel.integrations.filter((integ) => Object.keys(integ)[0] !== integration),
6449
6441
  });
6450
6442
  try {
6451
- const txSig = await glamClient.program.methods
6452
- .updateState(updated)
6453
- .accounts({ glamState: statePda })
6454
- .rpc();
6455
- console.log("txSig:", txSig);
6456
- console.log(`${integration} disabled on ${stateModel.name} (${statePda.toBase58()})`);
6443
+ const txSig = await glamClient.state.updateState(statePda, updated);
6444
+ console.log(`${integration} disabled: ${txSig}`);
6457
6445
  }
6458
6446
  catch (e) {
6459
6447
  console.error((0, utils_1.parseTxError)(e));
@@ -6613,7 +6601,7 @@ let globalOpts = { skipSimulation: false };
6613
6601
  program
6614
6602
  .name("glam-cli")
6615
6603
  .description("CLI for interacting with the GLAM Protocol")
6616
- .version("0.1.18")
6604
+ .version("0.1.19")
6617
6605
  .option("-S, --skip-simulation", "Skip transaction simulation");
6618
6606
  program
6619
6607
  .command("env")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glamsystems/glam-cli",
3
- "version": "0.1.18",
3
+ "version": "0.1.19",
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.18",
24
+ "@glamsystems/glam-sdk": "0.1.19",
25
25
  "commander": "^11.1.0",
26
26
  "inquirer": "^8.2.6",
27
27
  "@switchboard-xyz/common": "^3.0.0"