@glamsystems/glam-cli 0.2.0-alpha.2 → 0.2.0-alpha.3

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 (4) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +3 -1
  3. package/main.js +289 -43
  4. package/package.json +2 -2
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md CHANGED
@@ -2,7 +2,9 @@
2
2
 
3
3
  ![NPM Version](https://img.shields.io/npm/v/%40glamsystems%2Fglam-cli)
4
4
 
5
- A convenient way of interacting with the GLAM program.
5
+ A powerful command-line interface for managing GLAM vaults.
6
+
7
+ **Note:** This repository is automatically synced from GLAM's private monorepo. Pull requests cannot be accepted here, but we welcome bug reports and feature requests through GitHub Issues.
6
8
 
7
9
  ## Installation
8
10
 
package/main.js CHANGED
@@ -114,7 +114,7 @@ module.exports = require("@coral-xyz/anchor");
114
114
  /* 5 */
115
115
  /***/ ((module) => {
116
116
 
117
- module.exports = /*#__PURE__*/JSON.parse('{"address":"GLAMpaME8wdTEzxtiYEAa5yD8fZbxZiz2hNtV58RZiEz","metadata":{"name":"glam_protocol","version":"0.4.36","spec":"0.1.0","description":"Glam Protocol"},"instructions":[{"name":"close_state","discriminator":[25,1,184,101,200,245,210,246],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_vault","writable":true,"pda":{"seeds":[{"kind":"const","value":[118,97,117,108,116]},{"kind":"account","path":"glam_state"}]}},{"name":"glam_signer","writable":true,"signer":true},{"name":"system_program","address":"11111111111111111111111111111111"}],"args":[]},{"name":"cpi_proxy","docs":["Only accessible by integration programs"],"discriminator":[65,134,48,2,7,232,199,46],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_vault","writable":true,"pda":{"seeds":[{"kind":"const","value":[118,97,117,108,116]},{"kind":"account","path":"glam_state"}]}},{"name":"glam_signer","writable":true,"signer":true},{"name":"cpi_program"},{"name":"integration_authority","signer":true},{"name":"system_program","address":"11111111111111111111111111111111"}],"args":[{"name":"data","type":"bytes"},{"name":"extra_params","type":{"vec":{"defined":{"name":"ExtraParams"}}}}]},{"name":"emergency_access_update","docs":["Bypasses the timelock for emergency updates on access control rules. Allowed operations:","- removing an integration program","- removing a delegate","- enabling/disabling glam state"],"discriminator":[207,247,157,14,87,132,230,0],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_signer","writable":true,"signer":true}],"args":[{"name":"args","type":{"defined":{"name":"EmergencyAccessUpdateArgs"}}}]},{"name":"enable_disable_protocols","discriminator":[222,198,164,163,194,161,11,171],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_signer","writable":true,"signer":true}],"args":[{"name":"integration_program","type":"pubkey"},{"name":"protocols_bitmask","type":"u16"},{"name":"set_enabled","type":"bool"}]},{"name":"extend_state","discriminator":[34,147,151,206,134,128,82,228],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_signer","writable":true,"signer":true},{"name":"system_program","address":"11111111111111111111111111111111"}],"args":[{"name":"bytes","type":"u32"}]},{"name":"grant_revoke_delegate_permissions","discriminator":[162,21,218,157,218,86,114,171],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_signer","writable":true,"signer":true}],"args":[{"name":"delegate","type":"pubkey"},{"name":"integration_program","type":"pubkey"},{"name":"protocol_bitflag","type":"u16"},{"name":"permissions_bitmask","type":"u64"},{"name":"set_granted","type":"bool"}]},{"name":"initialize_state","discriminator":[190,171,224,219,217,72,199,176],"accounts":[{"name":"glam_state","writable":true,"pda":{"seeds":[{"kind":"const","value":[115,116,97,116,101]},{"kind":"account","path":"glam_signer"},{"kind":"arg","path":"state_model.created"}]}},{"name":"glam_signer","writable":true,"signer":true},{"name":"system_program","address":"11111111111111111111111111111111"},{"name":"base_asset_mint"}],"args":[{"name":"state","type":{"defined":{"name":"StateModel"}}}]},{"name":"jupiter_swap","discriminator":[116,207,0,196,252,120,243,18],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_vault","writable":true,"pda":{"seeds":[{"kind":"const","value":[118,97,117,108,116]},{"kind":"account","path":"glam_state"}]}},{"name":"glam_signer","writable":true,"signer":true},{"name":"cpi_program","address":"JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4"},{"name":"input_vault_ata","writable":true,"pda":{"seeds":[{"kind":"account","path":"glam_vault"},{"kind":"account","path":"input_token_program"},{"kind":"account","path":"input_mint"}],"program":{"kind":"const","value":[140,151,37,143,78,36,137,241,187,61,16,41,20,142,13,131,11,90,19,153,218,255,16,132,4,142,123,216,219,233,248,89]}}},{"name":"output_vault_ata","writable":true,"pda":{"seeds":[{"kind":"account","path":"glam_vault"},{"kind":"account","path":"output_token_program"},{"kind":"account","path":"output_mint"}],"program":{"kind":"const","value":[140,151,37,143,78,36,137,241,187,61,16,41,20,142,13,131,11,90,19,153,218,255,16,132,4,142,123,216,219,233,248,89]}}},{"name":"input_mint"},{"name":"output_mint"},{"name":"input_stake_pool","optional":true},{"name":"output_stake_pool","optional":true},{"name":"associated_token_program","address":"ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"},{"name":"input_token_program"},{"name":"output_token_program"}],"args":[{"name":"data","type":"bytes"}]},{"name":"link_unlink_mint_by_mint_authority","docs":["For glam mint program\'s use only"],"discriminator":[85,67,58,245,175,14,122,6],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_mint"},{"name":"glam_mint_authority","signer":true}],"args":[{"name":"link","type":"bool"}]},{"name":"reset_priced_protocols","docs":["Resets glam_state.priced_protocols to an empty vector"],"discriminator":[60,176,141,208,132,51,54,9],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_signer","signer":true}],"args":[]},{"name":"set_jupiter_swap_policy","discriminator":[189,182,227,165,127,148,246,189],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_signer","writable":true,"signer":true}],"args":[{"name":"policy","type":{"defined":{"name":"JupiterSwapPolicy"}}}]},{"name":"set_protocol_policy","discriminator":[37,99,61,122,227,102,182,180],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_signer","writable":true,"signer":true}],"args":[{"name":"integration_program","type":"pubkey"},{"name":"protocol_bitflag","type":"u16"},{"name":"data","type":"bytes"}]},{"name":"set_system_transfer_policy","discriminator":[102,21,157,101,19,4,100,213],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_signer","writable":true,"signer":true}],"args":[{"name":"policy","type":{"defined":{"name":"TransferPolicy"}}}]},{"name":"stake_authorize","docs":["Out-of-scope for audit"],"discriminator":[127,247,88,164,201,0,79,7],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_vault","writable":true,"pda":{"seeds":[{"kind":"const","value":[118,97,117,108,116]},{"kind":"account","path":"glam_state"}]}},{"name":"glam_signer","writable":true,"signer":true},{"name":"cpi_program","address":"Stake11111111111111111111111111111111111111"},{"name":"stake","writable":true},{"name":"clock","address":"SysvarC1ock11111111111111111111111111111111"}],"args":[{"name":"new_authority","type":"pubkey"},{"name":"staker_or_withdrawer","type":"u32"}]},{"name":"stake_deactivate","docs":["Out-of-scope for audit"],"discriminator":[224,10,93,175,175,145,237,169],"accounts":[{"name":"glam_state"},{"name":"glam_vault","writable":true,"pda":{"seeds":[{"kind":"const","value":[118,97,117,108,116]},{"kind":"account","path":"glam_state"}]}},{"name":"glam_signer","writable":true,"signer":true},{"name":"cpi_program","address":"Stake11111111111111111111111111111111111111"},{"name":"stake","writable":true},{"name":"clock","address":"SysvarC1ock11111111111111111111111111111111"}],"args":[]},{"name":"stake_delegate_stake","docs":["Out-of-scope for audit"],"discriminator":[202,40,152,239,175,251,66,228],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_vault","writable":true,"pda":{"seeds":[{"kind":"const","value":[118,97,117,108,116]},{"kind":"account","path":"glam_state"}]}},{"name":"glam_signer","writable":true,"signer":true},{"name":"cpi_program","address":"Stake11111111111111111111111111111111111111"},{"name":"stake","writable":true},{"name":"vote"},{"name":"clock","address":"SysvarC1ock11111111111111111111111111111111"},{"name":"stake_history","address":"SysvarStakeHistory1111111111111111111111111"},{"name":"stake_config"}],"args":[]},{"name":"stake_initialize","docs":["Out-of-scope for audit"],"discriminator":[68,66,118,79,15,144,190,190],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_vault","writable":true,"pda":{"seeds":[{"kind":"const","value":[118,97,117,108,116]},{"kind":"account","path":"glam_state"}]}},{"name":"glam_signer","writable":true,"signer":true},{"name":"cpi_program","address":"Stake11111111111111111111111111111111111111"},{"name":"stake","writable":true},{"name":"rent","address":"SysvarRent111111111111111111111111111111111"},{"name":"system_program","address":"11111111111111111111111111111111"}],"args":[]},{"name":"stake_merge","docs":["Out-of-scope for audit"],"discriminator":[46,181,125,12,51,179,134,176],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_vault","writable":true,"pda":{"seeds":[{"kind":"const","value":[118,97,117,108,116]},{"kind":"account","path":"glam_state"}]}},{"name":"glam_signer","writable":true,"signer":true},{"name":"cpi_program","address":"Stake11111111111111111111111111111111111111"},{"name":"destination_stake","writable":true},{"name":"source_stake","writable":true},{"name":"clock","address":"SysvarC1ock11111111111111111111111111111111"},{"name":"stake_history","address":"SysvarStakeHistory1111111111111111111111111"}],"args":[]},{"name":"stake_redelegate","docs":["Out-of-scope for audit"],"discriminator":[134,227,164,247,120,0,225,174],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_vault","writable":true,"pda":{"seeds":[{"kind":"const","value":[118,97,117,108,116]},{"kind":"account","path":"glam_state"}]}},{"name":"glam_signer","writable":true,"signer":true},{"name":"cpi_program","address":"Stake11111111111111111111111111111111111111"},{"name":"stake","writable":true},{"name":"new_stake","writable":true},{"name":"vote"},{"name":"stake_config"}],"args":[]},{"name":"stake_split","docs":["Out-of-scope for audit"],"discriminator":[63,128,169,206,158,60,135,48],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_vault","writable":true,"pda":{"seeds":[{"kind":"const","value":[118,97,117,108,116]},{"kind":"account","path":"glam_state"}]}},{"name":"glam_signer","writable":true,"signer":true},{"name":"cpi_program","address":"Stake11111111111111111111111111111111111111"},{"name":"stake","writable":true},{"name":"split_stake","writable":true}],"args":[{"name":"lamports","type":"u64"}]},{"name":"stake_withdraw","docs":["Out-of-scope for audit"],"discriminator":[199,13,168,20,92,151,29,56],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_vault","writable":true,"pda":{"seeds":[{"kind":"const","value":[118,97,117,108,116]},{"kind":"account","path":"glam_state"}]}},{"name":"glam_signer","writable":true,"signer":true},{"name":"cpi_program","address":"Stake11111111111111111111111111111111111111"},{"name":"stake","writable":true},{"name":"clock","address":"SysvarC1ock11111111111111111111111111111111"},{"name":"stake_history","address":"SysvarStakeHistory1111111111111111111111111"},{"name":"system_program","address":"11111111111111111111111111111111"}],"args":[{"name":"lamports","type":"u64"}]},{"name":"system_transfer","discriminator":[167,164,195,155,219,152,191,230],"accounts":[{"name":"glam_state"},{"name":"glam_vault","writable":true,"pda":{"seeds":[{"kind":"const","value":[118,97,117,108,116]},{"kind":"account","path":"glam_state"}]}},{"name":"glam_signer","writable":true,"signer":true},{"name":"cpi_program","address":"11111111111111111111111111111111"},{"name":"to","writable":true}],"args":[{"name":"lamports","type":"u64"}]},{"name":"token_transfer_checked_by_mint_authority","docs":["For glam mint program\'s use only"],"discriminator":[37,131,188,85,45,183,8,81],"accounts":[{"name":"glam_state"},{"name":"glam_vault","writable":true,"pda":{"seeds":[{"kind":"const","value":[118,97,117,108,116]},{"kind":"account","path":"glam_state"}]}},{"name":"glam_mint","writable":true},{"name":"glam_mint_authority","writable":true,"signer":true},{"name":"from","writable":true},{"name":"to","writable":true},{"name":"mint"},{"name":"token_program"}],"args":[{"name":"amount","type":"u64"},{"name":"decimals","type":"u8"}]},{"name":"update_mint_params","discriminator":[45,42,115,25,179,27,57,191],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_signer","writable":true,"signer":true}],"args":[{"name":"params","type":{"vec":{"defined":{"name":"EngineField"}}}}]},{"name":"update_mint_params_by_mint_authority","docs":["For glam mint program\'s use only, timelock is not enforced"],"discriminator":[94,160,55,53,175,225,62,118],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_mint"},{"name":"glam_mint_authority","signer":true}],"args":[{"name":"params","type":{"vec":{"defined":{"name":"EngineField"}}}}]},{"name":"update_priced_protocol","docs":["Only accessible by integration programs"],"discriminator":[10,106,94,171,118,217,62,98],"accounts":[{"name":"glam_state","writable":true},{"name":"integration_authority","signer":true}],"args":[{"name":"priced_protocol","type":{"defined":{"name":"PricedProtocol"}}}]},{"name":"update_state","discriminator":[135,112,215,75,247,185,53,176],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_signer","writable":true,"signer":true}],"args":[{"name":"state","type":{"defined":{"name":"StateModel"}}}]},{"name":"update_state_apply_timelock","discriminator":[66,12,138,80,133,85,46,220],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_signer","writable":true,"signer":true}],"args":[]}],"accounts":[{"name":"StateAccount","discriminator":[142,247,54,95,85,133,249,103]}],"errors":[{"code":48000,"name":"UnauthorizedSigner","msg":"Signer is not authorized"},{"code":48001,"name":"UnauthorizedIntegrationProgram","msg":"Integration program is not authorized"},{"code":48002,"name":"IntegrationNotEnabled","msg":"Integration is not enabled"},{"code":48003,"name":"ProtocolNotEnabled","msg":"Protocol is not enabled"},{"code":48004,"name":"GlamStateDisabled","msg":"GLAM state is disabled"},{"code":48005,"name":"ProtocolPolicyViolation","msg":"Protocol policy violation"},{"code":48006,"name":"EmergencyUpdateDenied","msg":"Emergency update denied"},{"code":48007,"name":"TimelockStillActive","msg":"Timelock still active"},{"code":48008,"name":"CannotApplyChanges","msg":"Pending changes cannot be applied due to unfulfilled requests"},{"code":48009,"name":"AssetNotBorrowable","msg":"Asset is not allowed to borrow"},{"code":48010,"name":"UnexpectedProgramOwner","msg":"Account is owned by an unexpected program"},{"code":48011,"name":"InvalidAuthority","msg":"Invalid authority"},{"code":49000,"name":"InvalidAccountType","msg":"Invalid account type"},{"code":49001,"name":"InvalidName","msg":"Invalid name"},{"code":49002,"name":"InvalidSymbol","msg":"Symbol too long: max 32 chars"},{"code":49003,"name":"InvalidUri","msg":"Uri too long: max 128 chars"},{"code":49004,"name":"InvalidAssetsLen","msg":"Too many assets: max 100"},{"code":49005,"name":"InvalidIxArgs","msg":"Glam mint not found"},{"code":49006,"name":"CannotCloseState","msg":"Glam state cannot be closed, all mints must be closed first"},{"code":49007,"name":"InvalidMintParams","msg":"Invalid mint params"},{"code":49008,"name":"InvalidRemainingAccounts","msg":"Invalid accounts: the transaction is malformed"},{"code":49009,"name":"InvalidVaultTokenAccount","msg":"Invalid vault ata"},{"code":49010,"name":"NonZeroSupply","msg":"Glam mint supply not zero"},{"code":49011,"name":"MissingAccount","msg":"An account required by the instruction is missing"},{"code":49012,"name":"InvalidTimestamp","msg":"Invalid timestamp"},{"code":49013,"name":"EngineFieldNotFound","msg":"Engine field not found"},{"code":49014,"name":"InvalidBaseAsset","msg":"Invalid base asset"},{"code":49015,"name":"InvalidProtocolBitflag","msg":"Invalid protocol bitflag"},{"code":50000,"name":"WithdrawDenied","msg":"Withdraw denied. Only vaults allow withdraws (funds and mints don\'t)"},{"code":50001,"name":"InvalidAssetForSwap","msg":"Asset cannot be swapped"},{"code":50002,"name":"UnsupportedSwapIx","msg":"Unsupported swap instruction"},{"code":50003,"name":"SlippageLimitExceeded","msg":"Max slippage exceeded"},{"code":50004,"name":"InvalidPlatformFeeForSwap","msg":"Invalid platform fee"},{"code":50005,"name":"InvalidTokenAccount","msg":"Invalid token account"},{"code":50006,"name":"InvalidVoteSide","msg":"Invalid vote side"},{"code":50007,"name":"MultipleStakeAccountsDisallowed","msg":"Multiple stake accounts disallowed"},{"code":51000,"name":"InvalidAssetPrice","msg":"Invalid asset price"},{"code":51001,"name":"InvalidStableCoinPriceForSubscribe","msg":"Subscription not allowed: invalid stable coin price"},{"code":51100,"name":"InvalidPricingOracle","msg":"Invalid oracle for asset price"},{"code":51101,"name":"PricingError","msg":"Pricing error"},{"code":51102,"name":"PriceTooOld","msg":"Price is too old"},{"code":51103,"name":"ExternalPositionsNotPriced","msg":"Not all external vault accounts are priced"},{"code":51104,"name":"VaultTokensNotPriced","msg":"Not all vault tokens are priced"},{"code":51105,"name":"PriceDivergenceTooLarge","msg":"No priced assets found"},{"code":51106,"name":"PositiveAumRequired","msg":"AUM must be positive"},{"code":51107,"name":"MathError","msg":"Math error"},{"code":51108,"name":"TypeCastingError","msg":"Type casting error"},{"code":51109,"name":"BaseAssetNotSupported","msg":"Base asset must have 6 decimals."},{"code":51110,"name":"InvalidQuoteSpotMarket","msg":"Unsupported spot market for perp quotes"},{"code":51111,"name":"UnknownExternalVaultAsset","msg":"Unknown external vault account"},{"code":51112,"name":"InvalidPriceDenom","msg":"Invalid price denom"},{"code":51113,"name":"UnexpectedDiscriminator","msg":"Invalid account: discriminator mismatch"},{"code":52000,"name":"TransfersDisabled","msg":"Policy violation: transfers disabled"},{"code":52001,"name":"InvalidPolicyAccount","msg":"Policy account is mandatory"},{"code":52002,"name":"AmountTooBig","msg":"Policy violation: amount too big"},{"code":52003,"name":"LockUp","msg":"Policy violation: lock-up has not expired"}],"types":[{"name":"AccountType","type":{"kind":"enum","variants":[{"name":"Vault"},{"name":"TokenizedVault"},{"name":"Mint"}]}},{"name":"AccruedFees","type":{"kind":"struct","fields":[{"name":"vault_subscription_fee","type":"u128"},{"name":"vault_redemption_fee","type":"u128"},{"name":"manager_subscription_fee","type":"u128"},{"name":"manager_redemption_fee","type":"u128"},{"name":"management_fee","type":"u128"},{"name":"performance_fee","type":"u128"},{"name":"protocol_base_fee","type":"u128"},{"name":"protocol_flow_fee","type":"u128"}]}},{"name":"ActionType","type":{"kind":"enum","variants":[{"name":"AddExternalAccount"},{"name":"DeleteExternalAccount"},{"name":"DeleteExternalAccountIfZeroLamports"},{"name":"DeleteExternalAccountIfZeroBalance"},{"name":"AddAsset"},{"name":"DeleteAsset"}]}},{"name":"CreatedModel","type":{"kind":"struct","fields":[{"name":"key","type":{"array":["u8",8]}},{"name":"created_by","type":"pubkey"},{"name":"created_at","type":"i64"}]}},{"name":"DelegateAcl","type":{"kind":"struct","fields":[{"name":"pubkey","type":"pubkey"},{"name":"integration_permissions","type":{"vec":{"defined":{"name":"IntegrationPermissions"}}}},{"name":"expires_at","type":"i64"}]}},{"name":"EmergencyAccessUpdateArgs","type":{"kind":"struct","fields":[{"name":"disabled_integrations","type":{"vec":"pubkey"}},{"name":"disabled_delegates","type":{"vec":"pubkey"}},{"name":"state_enabled","type":{"option":"bool"}}]}},{"name":"EngineField","type":{"kind":"struct","fields":[{"name":"name","type":{"defined":{"name":"EngineFieldName"}}},{"name":"value","type":{"defined":{"name":"EngineFieldValue"}}}]}},{"name":"EngineFieldName","type":{"kind":"enum","variants":[{"name":"Owner"},{"name":"PortfolioManagerName"},{"name":"Name"},{"name":"Uri"},{"name":"Assets"},{"name":"DelegateAcls"},{"name":"IntegrationAcls"},{"name":"TimelockDuration"},{"name":"Borrowable"},{"name":"DefaultAccountStateFrozen"},{"name":"PermanentDelegate"},{"name":"NotifyAndSettle"},{"name":"FeeStructure"},{"name":"FeeParams"},{"name":"ClaimableFees"},{"name":"ClaimedFees"},{"name":"OracleConfigs"}]}},{"name":"EngineFieldValue","type":{"kind":"enum","variants":[{"name":"Boolean","fields":[{"name":"val","type":"bool"}]},{"name":"U8","fields":[{"name":"val","type":"u8"}]},{"name":"U32","fields":[{"name":"val","type":"u32"}]},{"name":"U64","fields":[{"name":"val","type":"u64"}]},{"name":"String","fields":[{"name":"val","type":"string"}]},{"name":"Pubkey","fields":[{"name":"val","type":"pubkey"}]},{"name":"VecPubkey","fields":[{"name":"val","type":{"vec":"pubkey"}}]},{"name":"VecU8","fields":[{"name":"val","type":"bytes"}]},{"name":"VecU32","fields":[{"name":"val","type":{"vec":"u32"}}]},{"name":"VecDelegateAcl","fields":[{"name":"val","type":{"vec":{"defined":{"name":"DelegateAcl"}}}}]},{"name":"VecIntegrationAcl","fields":[{"name":"val","type":{"vec":{"defined":{"name":"IntegrationAcl"}}}}]},{"name":"FeeStructure","fields":[{"name":"val","type":{"defined":{"name":"FeeStructure"}}}]},{"name":"FeeParams","fields":[{"name":"val","type":{"defined":{"name":"FeeParams"}}}]},{"name":"AccruedFees","fields":[{"name":"val","type":{"defined":{"name":"AccruedFees"}}}]},{"name":"NotifyAndSettle","fields":[{"name":"val","type":{"defined":{"name":"NotifyAndSettle"}}}]},{"name":"OracleConfigs","fields":[{"name":"val","type":{"defined":{"name":"OracleConfigs"}}}]}]}},{"name":"EntryExitFees","type":{"kind":"struct","fields":[{"name":"subscription_fee_bps","type":"u16"},{"name":"redemption_fee_bps","type":"u16"}]}},{"name":"ExtraParams","type":{"kind":"struct","fields":[{"name":"action_type","type":{"defined":{"name":"ActionType"}}},{"name":"pubkey","type":"pubkey"},{"name":"amount","type":{"option":"u64"}}]}},{"name":"FeeParams","type":{"kind":"struct","fields":[{"name":"year_in_seconds","type":"u32"},{"name":"pa_high_water_mark","type":"i128"},{"name":"pa_last_nav","type":"i128"},{"name":"last_aum","type":"i128"},{"name":"last_performance_fee_crystallized","type":"i64"},{"name":"last_management_fee_crystallized","type":"i64"},{"name":"last_protocol_fee_crystallized","type":"i64"}]}},{"name":"FeeStructure","type":{"kind":"struct","fields":[{"name":"vault","type":{"defined":{"name":"EntryExitFees"}}},{"name":"manager","type":{"defined":{"name":"EntryExitFees"}}},{"name":"management","type":{"defined":{"name":"ManagementFee"}}},{"name":"performance","type":{"defined":{"name":"PerformanceFee"}}},{"name":"protocol","type":{"defined":{"name":"ProtocolFees"}}}]}},{"name":"HurdleType","type":{"kind":"enum","variants":[{"name":"Hard"},{"name":"Soft"}]}},{"name":"IntegrationAcl","docs":["An integration program can have multiple protocols supported.","Enabled protocols are stored in a bitmask, and each protocol can have its own policy."],"type":{"kind":"struct","fields":[{"name":"integration_program","type":"pubkey"},{"name":"protocols_bitmask","type":"u16"},{"name":"protocol_policies","type":{"vec":{"defined":{"name":"ProtocolPolicy"}}}}]}},{"name":"IntegrationPermissions","docs":["Stores delegate permissions for an integration program."],"type":{"kind":"struct","fields":[{"name":"integration_program","type":"pubkey"},{"name":"protocol_permissions","type":{"vec":{"defined":{"name":"ProtocolPermissions"}}}}]}},{"name":"JupiterSwapPolicy","type":{"kind":"struct","fields":[{"name":"max_slippage_bps","type":"u16"},{"name":"swap_allowlist","type":{"option":{"vec":"pubkey"}}}]}},{"name":"ManagementFee","type":{"kind":"struct","fields":[{"name":"fee_bps","type":"u16"}]}},{"name":"NoticePeriodType","type":{"kind":"enum","variants":[{"name":"Hard"},{"name":"Soft"}]}},{"name":"NotifyAndSettle","type":{"kind":"struct","fields":[{"name":"model","type":{"defined":{"name":"ValuationModel"}}},{"name":"permissionless_fulfillment","type":"bool"},{"name":"subscribe_notice_period_type","type":{"defined":{"name":"NoticePeriodType"}}},{"name":"subscribe_notice_period","type":"u64"},{"name":"subscribe_settlement_period","type":"u64"},{"name":"subscribe_cancellation_window","type":"u64"},{"name":"redeem_notice_period_type","type":{"defined":{"name":"NoticePeriodType"}}},{"name":"redeem_notice_period","type":"u64"},{"name":"redeem_settlement_period","type":"u64"},{"name":"redeem_cancellation_window","type":"u64"},{"name":"time_unit","type":{"defined":{"name":"TimeUnit"}}},{"name":"_padding","type":{"array":["u8",3]}}]}},{"name":"OracleConfigs","docs":["Vault-specific oracle configs. If available, these configs are preferred over the global config."],"type":{"kind":"struct","fields":[{"name":"max_ages_seconds","type":{"vec":{"array":["u16",2]}}},{"name":"padding","type":{"array":["u8",12]}}]}},{"name":"PerformanceFee","type":{"kind":"struct","fields":[{"name":"fee_bps","type":"u16"},{"name":"hurdle_rate_bps","type":"u16"},{"name":"hurdle_type","type":{"defined":{"name":"HurdleType"}}}]}},{"name":"PricedProtocol","type":{"kind":"struct","fields":[{"name":"rent","type":"u64"},{"name":"amount","type":"i128"},{"name":"decimals","type":"u8"},{"name":"last_updated_slot","type":"u64"},{"name":"integration_program","type":"pubkey"},{"name":"protocol_bitflag","type":"u16"},{"name":"positions","type":{"vec":"pubkey"}}]}},{"name":"ProtocolFees","type":{"kind":"struct","fields":[{"name":"base_fee_bps","type":"u16"},{"name":"flow_fee_bps","type":"u16"}]}},{"name":"ProtocolPermissions","docs":["Represents a delegate\'s permissions for a specific protocol"],"type":{"kind":"struct","fields":[{"name":"protocol_bitflag","type":"u16"},{"name":"permissions_bitmask","type":"u64"}]}},{"name":"ProtocolPolicy","docs":["Stores policy data for an integrated protocol.","Integration programs serialize/deserialize this data."],"type":{"kind":"struct","fields":[{"name":"protocol_bitflag","type":"u16"},{"name":"data","type":"bytes"}]}},{"name":"StateAccount","type":{"kind":"struct","fields":[{"name":"account_type","type":{"defined":{"name":"AccountType"}}},{"name":"enabled","type":"bool"},{"name":"vault","type":"pubkey"},{"name":"owner","type":"pubkey"},{"name":"portfolio_manager_name","type":{"array":["u8",32]}},{"name":"created","type":{"defined":{"name":"CreatedModel"}}},{"name":"base_asset_mint","type":"pubkey"},{"name":"base_asset_decimals","type":"u8"},{"name":"base_asset_token_program","type":"u8"},{"name":"name","type":{"array":["u8",32]}},{"name":"timelock_duration","type":"u32"},{"name":"timelock_expires_at","type":"u64"},{"name":"mint","type":"pubkey"},{"name":"assets","type":{"vec":"pubkey"}},{"name":"integration_acls","type":{"vec":{"defined":{"name":"IntegrationAcl"}}}},{"name":"delegate_acls","type":{"vec":{"defined":{"name":"DelegateAcl"}}}},{"name":"external_positions","type":{"vec":"pubkey"}},{"name":"priced_protocols","type":{"vec":{"defined":{"name":"PricedProtocol"}}}},{"name":"params","type":{"vec":{"vec":{"defined":{"name":"EngineField"}}}}}]}},{"name":"StateModel","type":{"kind":"struct","fields":[{"name":"account_type","type":{"option":{"defined":{"name":"AccountType"}}}},{"name":"name","type":{"option":{"array":["u8",32]}}},{"name":"uri","type":{"option":"string"}},{"name":"enabled","type":{"option":"bool"}},{"name":"assets","type":{"option":{"vec":"pubkey"}}},{"name":"created","type":{"option":{"defined":{"name":"CreatedModel"}}}},{"name":"owner","type":{"option":"pubkey"}},{"name":"portfolio_manager_name","type":{"option":{"array":["u8",32]}}},{"name":"borrowable","type":{"option":{"vec":"pubkey"}}},{"name":"timelock_duration","type":{"option":"u32"}},{"name":"integration_acls","type":{"option":{"vec":{"defined":{"name":"IntegrationAcl"}}}}},{"name":"delegate_acls","type":{"option":{"vec":{"defined":{"name":"DelegateAcl"}}}}}]}},{"name":"TimeUnit","type":{"kind":"enum","variants":[{"name":"Second"},{"name":"Slot"}]}},{"name":"TransferPolicy","type":{"kind":"struct","fields":[{"name":"allowlist","type":{"vec":"pubkey"}}]}},{"name":"ValuationModel","type":{"kind":"enum","variants":[{"name":"Continuous"},{"name":"Periodic"}]}}],"constants":[{"name":"PROTO_JUPITER_SWAP","type":"u16","value":"4"},{"name":"PROTO_JUPITER_SWAP_PERM_SWAP_ALLOWLISTED","type":"u64","value":"4"},{"name":"PROTO_JUPITER_SWAP_PERM_SWAP_ANY","type":"u64","value":"1"},{"name":"PROTO_JUPITER_SWAP_PERM_SWAP_LST","type":"u64","value":"2"},{"name":"PROTO_STAKE","type":"u16","value":"2"},{"name":"PROTO_STAKE_PERM_STAKE","type":"u64","value":"1"},{"name":"PROTO_STAKE_PERM_UNSTAKE","type":"u64","value":"2"},{"name":"PROTO_SYSTEM","type":"u16","value":"1"},{"name":"PROTO_SYSTEM_PERM_TRANSFER","type":"u64","value":"2"},{"name":"PROTO_SYSTEM_PERM_WSOL","type":"u64","value":"1"}]}');
117
+ module.exports = /*#__PURE__*/JSON.parse('{"address":"GLAMpaME8wdTEzxtiYEAa5yD8fZbxZiz2hNtV58RZiEz","metadata":{"name":"glam_protocol","version":"0.4.36","spec":"0.1.0","description":"Glam Protocol"},"instructions":[{"name":"close_state","discriminator":[25,1,184,101,200,245,210,246],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_vault","writable":true,"pda":{"seeds":[{"kind":"const","value":[118,97,117,108,116]},{"kind":"account","path":"glam_state"}]}},{"name":"glam_signer","writable":true,"signer":true},{"name":"system_program","address":"11111111111111111111111111111111"}],"args":[]},{"name":"cpi_proxy","docs":["Only accessible by integration programs"],"discriminator":[65,134,48,2,7,232,199,46],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_vault","writable":true,"pda":{"seeds":[{"kind":"const","value":[118,97,117,108,116]},{"kind":"account","path":"glam_state"}]}},{"name":"glam_signer","writable":true,"signer":true},{"name":"cpi_program"},{"name":"integration_authority","signer":true},{"name":"system_program","address":"11111111111111111111111111111111"}],"args":[{"name":"data","type":"bytes"},{"name":"extra_params","type":{"vec":{"defined":{"name":"ExtraParams"}}}}]},{"name":"emergency_access_update","docs":["Bypasses the timelock for emergency updates on access control rules. Allowed operations:","- removing an integration program","- removing a delegate","- enabling/disabling glam state"],"discriminator":[207,247,157,14,87,132,230,0],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_signer","writable":true,"signer":true}],"args":[{"name":"args","type":{"defined":{"name":"EmergencyAccessUpdateArgs"}}}]},{"name":"enable_disable_protocols","discriminator":[222,198,164,163,194,161,11,171],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_signer","writable":true,"signer":true}],"args":[{"name":"integration_program","type":"pubkey"},{"name":"protocols_bitmask","type":"u16"},{"name":"set_enabled","type":"bool"}]},{"name":"extend_state","discriminator":[34,147,151,206,134,128,82,228],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_signer","writable":true,"signer":true},{"name":"system_program","address":"11111111111111111111111111111111"}],"args":[{"name":"bytes","type":"u32"}]},{"name":"grant_revoke_delegate_permissions","discriminator":[162,21,218,157,218,86,114,171],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_signer","writable":true,"signer":true}],"args":[{"name":"delegate","type":"pubkey"},{"name":"integration_program","type":"pubkey"},{"name":"protocol_bitflag","type":"u16"},{"name":"permissions_bitmask","type":"u64"},{"name":"set_granted","type":"bool"}]},{"name":"initialize_state","discriminator":[190,171,224,219,217,72,199,176],"accounts":[{"name":"glam_state","writable":true,"pda":{"seeds":[{"kind":"const","value":[115,116,97,116,101]},{"kind":"account","path":"glam_signer"},{"kind":"arg","path":"state_model.created"}]}},{"name":"glam_signer","writable":true,"signer":true},{"name":"system_program","address":"11111111111111111111111111111111"},{"name":"base_asset_mint"}],"args":[{"name":"state","type":{"defined":{"name":"StateModel"}}}]},{"name":"jupiter_swap","discriminator":[116,207,0,196,252,120,243,18],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_vault","writable":true,"pda":{"seeds":[{"kind":"const","value":[118,97,117,108,116]},{"kind":"account","path":"glam_state"}]}},{"name":"glam_signer","writable":true,"signer":true},{"name":"cpi_program","address":"JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4"},{"name":"input_vault_ata","writable":true,"pda":{"seeds":[{"kind":"account","path":"glam_vault"},{"kind":"account","path":"input_token_program"},{"kind":"account","path":"input_mint"}],"program":{"kind":"const","value":[140,151,37,143,78,36,137,241,187,61,16,41,20,142,13,131,11,90,19,153,218,255,16,132,4,142,123,216,219,233,248,89]}}},{"name":"output_vault_ata","writable":true,"pda":{"seeds":[{"kind":"account","path":"glam_vault"},{"kind":"account","path":"output_token_program"},{"kind":"account","path":"output_mint"}],"program":{"kind":"const","value":[140,151,37,143,78,36,137,241,187,61,16,41,20,142,13,131,11,90,19,153,218,255,16,132,4,142,123,216,219,233,248,89]}}},{"name":"input_mint"},{"name":"output_mint"},{"name":"input_stake_pool","optional":true},{"name":"output_stake_pool","optional":true},{"name":"associated_token_program","address":"ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"},{"name":"input_token_program"},{"name":"output_token_program"}],"args":[{"name":"data","type":"bytes"}]},{"name":"link_unlink_mint_by_mint_authority","docs":["For glam mint program\'s use only"],"discriminator":[85,67,58,245,175,14,122,6],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_mint"},{"name":"glam_mint_authority","signer":true}],"args":[{"name":"link","type":"bool"}]},{"name":"reset_priced_protocols","docs":["Resets glam_state.priced_protocols to an empty vector"],"discriminator":[60,176,141,208,132,51,54,9],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_signer","signer":true}],"args":[]},{"name":"set_jupiter_swap_policy","discriminator":[189,182,227,165,127,148,246,189],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_signer","writable":true,"signer":true}],"args":[{"name":"policy","type":{"defined":{"name":"JupiterSwapPolicy"}}}]},{"name":"set_protocol_policy","discriminator":[37,99,61,122,227,102,182,180],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_signer","writable":true,"signer":true}],"args":[{"name":"integration_program","type":"pubkey"},{"name":"protocol_bitflag","type":"u16"},{"name":"data","type":"bytes"}]},{"name":"set_system_transfer_policy","discriminator":[102,21,157,101,19,4,100,213],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_signer","writable":true,"signer":true}],"args":[{"name":"policy","type":{"defined":{"name":"TransferPolicy"}}}]},{"name":"stake_authorize","docs":["Out-of-scope for audit"],"discriminator":[127,247,88,164,201,0,79,7],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_vault","writable":true,"pda":{"seeds":[{"kind":"const","value":[118,97,117,108,116]},{"kind":"account","path":"glam_state"}]}},{"name":"glam_signer","writable":true,"signer":true},{"name":"cpi_program","address":"Stake11111111111111111111111111111111111111"},{"name":"stake","writable":true},{"name":"clock","address":"SysvarC1ock11111111111111111111111111111111"}],"args":[{"name":"new_authority","type":"pubkey"},{"name":"staker_or_withdrawer","type":"u32"}]},{"name":"stake_deactivate","docs":["Out-of-scope for audit"],"discriminator":[224,10,93,175,175,145,237,169],"accounts":[{"name":"glam_state"},{"name":"glam_vault","writable":true,"pda":{"seeds":[{"kind":"const","value":[118,97,117,108,116]},{"kind":"account","path":"glam_state"}]}},{"name":"glam_signer","writable":true,"signer":true},{"name":"cpi_program","address":"Stake11111111111111111111111111111111111111"},{"name":"stake","writable":true},{"name":"clock","address":"SysvarC1ock11111111111111111111111111111111"}],"args":[]},{"name":"stake_delegate_stake","docs":["Out-of-scope for audit"],"discriminator":[202,40,152,239,175,251,66,228],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_vault","writable":true,"pda":{"seeds":[{"kind":"const","value":[118,97,117,108,116]},{"kind":"account","path":"glam_state"}]}},{"name":"glam_signer","writable":true,"signer":true},{"name":"cpi_program","address":"Stake11111111111111111111111111111111111111"},{"name":"stake","writable":true},{"name":"vote"},{"name":"clock","address":"SysvarC1ock11111111111111111111111111111111"},{"name":"stake_history","address":"SysvarStakeHistory1111111111111111111111111"},{"name":"stake_config"}],"args":[]},{"name":"stake_initialize","docs":["Out-of-scope for audit"],"discriminator":[68,66,118,79,15,144,190,190],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_vault","writable":true,"pda":{"seeds":[{"kind":"const","value":[118,97,117,108,116]},{"kind":"account","path":"glam_state"}]}},{"name":"glam_signer","writable":true,"signer":true},{"name":"cpi_program","address":"Stake11111111111111111111111111111111111111"},{"name":"stake","writable":true},{"name":"rent","address":"SysvarRent111111111111111111111111111111111"},{"name":"system_program","address":"11111111111111111111111111111111"}],"args":[]},{"name":"stake_merge","docs":["Out-of-scope for audit"],"discriminator":[46,181,125,12,51,179,134,176],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_vault","writable":true,"pda":{"seeds":[{"kind":"const","value":[118,97,117,108,116]},{"kind":"account","path":"glam_state"}]}},{"name":"glam_signer","writable":true,"signer":true},{"name":"cpi_program","address":"Stake11111111111111111111111111111111111111"},{"name":"destination_stake","writable":true},{"name":"source_stake","writable":true},{"name":"clock","address":"SysvarC1ock11111111111111111111111111111111"},{"name":"stake_history","address":"SysvarStakeHistory1111111111111111111111111"}],"args":[]},{"name":"stake_redelegate","docs":["Out-of-scope for audit"],"discriminator":[134,227,164,247,120,0,225,174],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_vault","writable":true,"pda":{"seeds":[{"kind":"const","value":[118,97,117,108,116]},{"kind":"account","path":"glam_state"}]}},{"name":"glam_signer","writable":true,"signer":true},{"name":"cpi_program","address":"Stake11111111111111111111111111111111111111"},{"name":"stake","writable":true},{"name":"new_stake","writable":true},{"name":"vote"},{"name":"stake_config"}],"args":[]},{"name":"stake_split","docs":["Out-of-scope for audit"],"discriminator":[63,128,169,206,158,60,135,48],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_vault","writable":true,"pda":{"seeds":[{"kind":"const","value":[118,97,117,108,116]},{"kind":"account","path":"glam_state"}]}},{"name":"glam_signer","writable":true,"signer":true},{"name":"cpi_program","address":"Stake11111111111111111111111111111111111111"},{"name":"stake","writable":true},{"name":"split_stake","writable":true}],"args":[{"name":"lamports","type":"u64"}]},{"name":"stake_withdraw","docs":["Out-of-scope for audit"],"discriminator":[199,13,168,20,92,151,29,56],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_vault","writable":true,"pda":{"seeds":[{"kind":"const","value":[118,97,117,108,116]},{"kind":"account","path":"glam_state"}]}},{"name":"glam_signer","writable":true,"signer":true},{"name":"cpi_program","address":"Stake11111111111111111111111111111111111111"},{"name":"stake","writable":true},{"name":"clock","address":"SysvarC1ock11111111111111111111111111111111"},{"name":"stake_history","address":"SysvarStakeHistory1111111111111111111111111"},{"name":"system_program","address":"11111111111111111111111111111111"}],"args":[{"name":"lamports","type":"u64"}]},{"name":"system_transfer","discriminator":[167,164,195,155,219,152,191,230],"accounts":[{"name":"glam_state"},{"name":"glam_vault","writable":true,"pda":{"seeds":[{"kind":"const","value":[118,97,117,108,116]},{"kind":"account","path":"glam_state"}]}},{"name":"glam_signer","writable":true,"signer":true},{"name":"cpi_program","address":"11111111111111111111111111111111"},{"name":"to","writable":true}],"args":[{"name":"lamports","type":"u64"}]},{"name":"token_transfer_checked_by_mint_authority","docs":["For glam mint program\'s use only"],"discriminator":[37,131,188,85,45,183,8,81],"accounts":[{"name":"glam_state"},{"name":"glam_vault","writable":true,"pda":{"seeds":[{"kind":"const","value":[118,97,117,108,116]},{"kind":"account","path":"glam_state"}]}},{"name":"glam_mint","writable":true},{"name":"glam_mint_authority","writable":true,"signer":true},{"name":"from","writable":true},{"name":"to","writable":true},{"name":"mint"},{"name":"token_program"}],"args":[{"name":"amount","type":"u64"},{"name":"decimals","type":"u8"}]},{"name":"update_mint_params","discriminator":[45,42,115,25,179,27,57,191],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_signer","writable":true,"signer":true}],"args":[{"name":"params","type":{"vec":{"defined":{"name":"EngineField"}}}}]},{"name":"update_mint_params_by_mint_authority","docs":["For glam mint program\'s use only, timelock is not enforced"],"discriminator":[94,160,55,53,175,225,62,118],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_mint"},{"name":"glam_mint_authority","signer":true}],"args":[{"name":"params","type":{"vec":{"defined":{"name":"EngineField"}}}}]},{"name":"update_priced_protocol","docs":["Only accessible by integration programs"],"discriminator":[10,106,94,171,118,217,62,98],"accounts":[{"name":"glam_state","writable":true},{"name":"integration_authority","signer":true}],"args":[{"name":"priced_protocol","type":{"defined":{"name":"PricedProtocol"}}}]},{"name":"update_state","discriminator":[135,112,215,75,247,185,53,176],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_signer","writable":true,"signer":true}],"args":[{"name":"state","type":{"defined":{"name":"StateModel"}}}]},{"name":"update_state_apply_timelock","discriminator":[66,12,138,80,133,85,46,220],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_signer","writable":true,"signer":true}],"args":[]}],"accounts":[{"name":"StateAccount","discriminator":[142,247,54,95,85,133,249,103]}],"errors":[{"code":48000,"name":"UnauthorizedSigner","msg":"Signer is not authorized"},{"code":48001,"name":"UnauthorizedIntegrationProgram","msg":"Integration program is not authorized"},{"code":48002,"name":"IntegrationNotEnabled","msg":"Integration is not enabled"},{"code":48003,"name":"ProtocolNotEnabled","msg":"Protocol is not enabled"},{"code":48004,"name":"GlamStateDisabled","msg":"GLAM state is disabled"},{"code":48005,"name":"ProtocolPolicyViolation","msg":"Protocol policy violation"},{"code":48006,"name":"EmergencyUpdateDenied","msg":"Emergency update denied"},{"code":48007,"name":"TimelockStillActive","msg":"Timelock still active"},{"code":48008,"name":"CannotApplyChanges","msg":"Pending changes cannot be applied due to unfulfilled requests"},{"code":48009,"name":"AssetNotBorrowable","msg":"Asset is not allowed to borrow"},{"code":48010,"name":"UnexpectedProgramOwner","msg":"Account is owned by an unexpected program"},{"code":48011,"name":"InvalidAuthority","msg":"Invalid authority"},{"code":49000,"name":"InvalidAccountType","msg":"Invalid account type"},{"code":49001,"name":"InvalidName","msg":"Invalid name"},{"code":49002,"name":"InvalidSymbol","msg":"Symbol too long: max 32 chars"},{"code":49003,"name":"InvalidUri","msg":"Uri too long: max 128 chars"},{"code":49004,"name":"InvalidAssetsLen","msg":"Too many assets: max 100"},{"code":49005,"name":"InvalidIxArgs","msg":"Invalid instruction arguments"},{"code":49006,"name":"CannotCloseState","msg":"Glam state cannot be closed: mint must be closed and state must be disabled"},{"code":49007,"name":"InvalidMintParams","msg":"Invalid mint params"},{"code":49008,"name":"InvalidRemainingAccounts","msg":"Invalid accounts: the transaction is malformed"},{"code":49009,"name":"InvalidVaultTokenAccount","msg":"Invalid vault ata"},{"code":49010,"name":"NonZeroSupply","msg":"Glam mint supply not zero"},{"code":49011,"name":"MissingAccount","msg":"An account required by the instruction is missing"},{"code":49012,"name":"InvalidTimestamp","msg":"Invalid timestamp"},{"code":49013,"name":"EngineFieldNotFound","msg":"Engine field not found"},{"code":49014,"name":"InvalidBaseAsset","msg":"Invalid base asset"},{"code":49015,"name":"InvalidProtocolBitflag","msg":"Invalid protocol bitflag"},{"code":50000,"name":"WithdrawDenied","msg":"Withdraw denied. Only vaults allow withdraws (funds and mints don\'t)"},{"code":50001,"name":"InvalidAssetForSwap","msg":"Asset cannot be swapped"},{"code":50002,"name":"UnsupportedSwapIx","msg":"Unsupported swap instruction"},{"code":50003,"name":"SlippageLimitExceeded","msg":"Max slippage exceeded"},{"code":50004,"name":"InvalidPlatformFeeForSwap","msg":"Invalid platform fee"},{"code":50005,"name":"InvalidTokenAccount","msg":"Invalid token account"},{"code":50006,"name":"InvalidVoteSide","msg":"Invalid vote side"},{"code":50007,"name":"MultipleStakeAccountsDisallowed","msg":"Multiple stake accounts disallowed"},{"code":51000,"name":"InvalidAssetPrice","msg":"Invalid asset price"},{"code":51001,"name":"InvalidStableCoinPriceForSubscribe","msg":"Subscription not allowed: invalid stable coin price"},{"code":51100,"name":"InvalidPricingOracle","msg":"Invalid oracle for asset price"},{"code":51101,"name":"PricingError","msg":"Pricing error"},{"code":51102,"name":"PriceTooOld","msg":"Price is too old"},{"code":51103,"name":"ExternalPositionsNotPriced","msg":"Not all external vault accounts are priced"},{"code":51104,"name":"VaultTokensNotPriced","msg":"Not all vault tokens are priced"},{"code":51105,"name":"PriceDivergenceTooLarge","msg":"No priced assets found"},{"code":51106,"name":"PositiveAumRequired","msg":"AUM must be positive"},{"code":51107,"name":"MathError","msg":"Math error"},{"code":51108,"name":"TypeCastingError","msg":"Type casting error"},{"code":51109,"name":"BaseAssetNotSupported","msg":"Base asset must have 6 decimals."},{"code":51110,"name":"InvalidQuoteSpotMarket","msg":"Unsupported spot market for perp quotes"},{"code":51111,"name":"UnknownExternalVaultAsset","msg":"Unknown external vault account"},{"code":51112,"name":"InvalidPriceDenom","msg":"Invalid price denom"},{"code":51113,"name":"UnexpectedDiscriminator","msg":"Invalid account: discriminator mismatch"},{"code":52000,"name":"TransfersDisabled","msg":"Policy violation: transfers disabled"},{"code":52001,"name":"InvalidPolicyAccount","msg":"Policy account is mandatory"},{"code":52002,"name":"AmountTooBig","msg":"Policy violation: amount too big"},{"code":52003,"name":"LockUp","msg":"Policy violation: lock-up has not expired"}],"types":[{"name":"AccountType","type":{"kind":"enum","variants":[{"name":"Vault"},{"name":"TokenizedVault"},{"name":"Mint"}]}},{"name":"AccruedFees","type":{"kind":"struct","fields":[{"name":"vault_subscription_fee","type":"u128"},{"name":"vault_redemption_fee","type":"u128"},{"name":"manager_subscription_fee","type":"u128"},{"name":"manager_redemption_fee","type":"u128"},{"name":"management_fee","type":"u128"},{"name":"performance_fee","type":"u128"},{"name":"protocol_base_fee","type":"u128"},{"name":"protocol_flow_fee","type":"u128"}]}},{"name":"ActionType","type":{"kind":"enum","variants":[{"name":"AddExternalAccount"},{"name":"DeleteExternalAccount"},{"name":"DeleteExternalAccountIfZeroLamports"},{"name":"DeleteExternalAccountIfZeroBalance"},{"name":"AddAsset"},{"name":"DeleteAsset"}]}},{"name":"CreatedModel","type":{"kind":"struct","fields":[{"name":"key","type":{"array":["u8",8]}},{"name":"created_by","type":"pubkey"},{"name":"created_at","type":"i64"}]}},{"name":"DelegateAcl","type":{"kind":"struct","fields":[{"name":"pubkey","type":"pubkey"},{"name":"integration_permissions","type":{"vec":{"defined":{"name":"IntegrationPermissions"}}}},{"name":"expires_at","type":"i64"}]}},{"name":"EmergencyAccessUpdateArgs","type":{"kind":"struct","fields":[{"name":"disabled_integrations","type":{"vec":"pubkey"}},{"name":"disabled_delegates","type":{"vec":"pubkey"}},{"name":"state_enabled","type":{"option":"bool"}}]}},{"name":"EngineField","type":{"kind":"struct","fields":[{"name":"name","type":{"defined":{"name":"EngineFieldName"}}},{"name":"value","type":{"defined":{"name":"EngineFieldValue"}}}]}},{"name":"EngineFieldName","type":{"kind":"enum","variants":[{"name":"Owner"},{"name":"PortfolioManagerName"},{"name":"Name"},{"name":"Uri"},{"name":"Assets"},{"name":"DelegateAcls"},{"name":"IntegrationAcls"},{"name":"TimelockDuration"},{"name":"Borrowable"},{"name":"DefaultAccountStateFrozen"},{"name":"PermanentDelegate"},{"name":"NotifyAndSettle"},{"name":"FeeStructure"},{"name":"FeeParams"},{"name":"ClaimableFees"},{"name":"ClaimedFees"},{"name":"OracleConfigs"}]}},{"name":"EngineFieldValue","type":{"kind":"enum","variants":[{"name":"Boolean","fields":[{"name":"val","type":"bool"}]},{"name":"U8","fields":[{"name":"val","type":"u8"}]},{"name":"U32","fields":[{"name":"val","type":"u32"}]},{"name":"U64","fields":[{"name":"val","type":"u64"}]},{"name":"String","fields":[{"name":"val","type":"string"}]},{"name":"Pubkey","fields":[{"name":"val","type":"pubkey"}]},{"name":"VecPubkey","fields":[{"name":"val","type":{"vec":"pubkey"}}]},{"name":"VecU8","fields":[{"name":"val","type":"bytes"}]},{"name":"VecU32","fields":[{"name":"val","type":{"vec":"u32"}}]},{"name":"VecDelegateAcl","fields":[{"name":"val","type":{"vec":{"defined":{"name":"DelegateAcl"}}}}]},{"name":"VecIntegrationAcl","fields":[{"name":"val","type":{"vec":{"defined":{"name":"IntegrationAcl"}}}}]},{"name":"FeeStructure","fields":[{"name":"val","type":{"defined":{"name":"FeeStructure"}}}]},{"name":"FeeParams","fields":[{"name":"val","type":{"defined":{"name":"FeeParams"}}}]},{"name":"AccruedFees","fields":[{"name":"val","type":{"defined":{"name":"AccruedFees"}}}]},{"name":"NotifyAndSettle","fields":[{"name":"val","type":{"defined":{"name":"NotifyAndSettle"}}}]},{"name":"OracleConfigs","fields":[{"name":"val","type":{"defined":{"name":"OracleConfigs"}}}]}]}},{"name":"EntryExitFees","type":{"kind":"struct","fields":[{"name":"subscription_fee_bps","type":"u16"},{"name":"redemption_fee_bps","type":"u16"}]}},{"name":"ExtraParams","type":{"kind":"struct","fields":[{"name":"action_type","type":{"defined":{"name":"ActionType"}}},{"name":"pubkey","type":"pubkey"},{"name":"amount","type":{"option":"u64"}}]}},{"name":"FeeParams","type":{"kind":"struct","fields":[{"name":"year_in_seconds","type":"u32"},{"name":"pa_high_water_mark","type":"i128"},{"name":"pa_last_nav","type":"i128"},{"name":"last_aum","type":"i128"},{"name":"last_performance_fee_crystallized","type":"i64"},{"name":"last_management_fee_crystallized","type":"i64"},{"name":"last_protocol_fee_crystallized","type":"i64"}]}},{"name":"FeeStructure","type":{"kind":"struct","fields":[{"name":"vault","type":{"defined":{"name":"EntryExitFees"}}},{"name":"manager","type":{"defined":{"name":"EntryExitFees"}}},{"name":"management","type":{"defined":{"name":"ManagementFee"}}},{"name":"performance","type":{"defined":{"name":"PerformanceFee"}}},{"name":"protocol","type":{"defined":{"name":"ProtocolFees"}}}]}},{"name":"HurdleType","type":{"kind":"enum","variants":[{"name":"Hard"},{"name":"Soft"}]}},{"name":"IntegrationAcl","docs":["An integration program can have multiple protocols supported.","Enabled protocols are stored in a bitmask, and each protocol can have its own policy."],"type":{"kind":"struct","fields":[{"name":"integration_program","type":"pubkey"},{"name":"protocols_bitmask","type":"u16"},{"name":"protocol_policies","type":{"vec":{"defined":{"name":"ProtocolPolicy"}}}}]}},{"name":"IntegrationPermissions","docs":["Stores delegate permissions for an integration program."],"type":{"kind":"struct","fields":[{"name":"integration_program","type":"pubkey"},{"name":"protocol_permissions","type":{"vec":{"defined":{"name":"ProtocolPermissions"}}}}]}},{"name":"JupiterSwapPolicy","type":{"kind":"struct","fields":[{"name":"max_slippage_bps","type":"u16"},{"name":"swap_allowlist","type":{"option":{"vec":"pubkey"}}}]}},{"name":"ManagementFee","type":{"kind":"struct","fields":[{"name":"fee_bps","type":"u16"}]}},{"name":"NoticePeriodType","type":{"kind":"enum","variants":[{"name":"Hard"},{"name":"Soft"}]}},{"name":"NotifyAndSettle","type":{"kind":"struct","fields":[{"name":"model","type":{"defined":{"name":"ValuationModel"}}},{"name":"permissionless_fulfillment","type":"bool"},{"name":"subscribe_notice_period_type","type":{"defined":{"name":"NoticePeriodType"}}},{"name":"subscribe_notice_period","type":"u64"},{"name":"subscribe_settlement_period","type":"u64"},{"name":"subscribe_cancellation_window","type":"u64"},{"name":"redeem_notice_period_type","type":{"defined":{"name":"NoticePeriodType"}}},{"name":"redeem_notice_period","type":"u64"},{"name":"redeem_settlement_period","type":"u64"},{"name":"redeem_cancellation_window","type":"u64"},{"name":"time_unit","type":{"defined":{"name":"TimeUnit"}}},{"name":"_padding","type":{"array":["u8",3]}}]}},{"name":"OracleConfigs","docs":["Vault-specific oracle configs. If available, these configs are preferred over the global config."],"type":{"kind":"struct","fields":[{"name":"max_ages_seconds","type":{"vec":{"array":["u16",2]}}},{"name":"padding","type":{"array":["u8",12]}}]}},{"name":"PerformanceFee","type":{"kind":"struct","fields":[{"name":"fee_bps","type":"u16"},{"name":"hurdle_rate_bps","type":"u16"},{"name":"hurdle_type","type":{"defined":{"name":"HurdleType"}}}]}},{"name":"PricedProtocol","type":{"kind":"struct","fields":[{"name":"rent","type":"u64"},{"name":"amount","type":"i128"},{"name":"decimals","type":"u8"},{"name":"last_updated_slot","type":"u64"},{"name":"integration_program","type":"pubkey"},{"name":"protocol_bitflag","type":"u16"},{"name":"positions","type":{"vec":"pubkey"}}]}},{"name":"ProtocolFees","type":{"kind":"struct","fields":[{"name":"base_fee_bps","type":"u16"},{"name":"flow_fee_bps","type":"u16"}]}},{"name":"ProtocolPermissions","docs":["Represents a delegate\'s permissions for a specific protocol"],"type":{"kind":"struct","fields":[{"name":"protocol_bitflag","type":"u16"},{"name":"permissions_bitmask","type":"u64"}]}},{"name":"ProtocolPolicy","docs":["Stores policy data for an integrated protocol.","Integration programs serialize/deserialize this data."],"type":{"kind":"struct","fields":[{"name":"protocol_bitflag","type":"u16"},{"name":"data","type":"bytes"}]}},{"name":"StateAccount","type":{"kind":"struct","fields":[{"name":"account_type","type":{"defined":{"name":"AccountType"}}},{"name":"enabled","type":"bool"},{"name":"vault","type":"pubkey"},{"name":"owner","type":"pubkey"},{"name":"portfolio_manager_name","type":{"array":["u8",32]}},{"name":"created","type":{"defined":{"name":"CreatedModel"}}},{"name":"base_asset_mint","type":"pubkey"},{"name":"base_asset_decimals","type":"u8"},{"name":"base_asset_token_program","type":"u8"},{"name":"name","type":{"array":["u8",32]}},{"name":"timelock_duration","type":"u32"},{"name":"timelock_expires_at","type":"u64"},{"name":"mint","type":"pubkey"},{"name":"assets","type":{"vec":"pubkey"}},{"name":"integration_acls","type":{"vec":{"defined":{"name":"IntegrationAcl"}}}},{"name":"delegate_acls","type":{"vec":{"defined":{"name":"DelegateAcl"}}}},{"name":"external_positions","type":{"vec":"pubkey"}},{"name":"priced_protocols","type":{"vec":{"defined":{"name":"PricedProtocol"}}}},{"name":"params","type":{"vec":{"vec":{"defined":{"name":"EngineField"}}}}}]}},{"name":"StateModel","type":{"kind":"struct","fields":[{"name":"account_type","type":{"option":{"defined":{"name":"AccountType"}}}},{"name":"name","type":{"option":{"array":["u8",32]}}},{"name":"uri","type":{"option":"string"}},{"name":"enabled","type":{"option":"bool"}},{"name":"assets","type":{"option":{"vec":"pubkey"}}},{"name":"created","type":{"option":{"defined":{"name":"CreatedModel"}}}},{"name":"owner","type":{"option":"pubkey"}},{"name":"portfolio_manager_name","type":{"option":{"array":["u8",32]}}},{"name":"borrowable","type":{"option":{"vec":"pubkey"}}},{"name":"timelock_duration","type":{"option":"u32"}},{"name":"integration_acls","type":{"option":{"vec":{"defined":{"name":"IntegrationAcl"}}}}},{"name":"delegate_acls","type":{"option":{"vec":{"defined":{"name":"DelegateAcl"}}}}}]}},{"name":"TimeUnit","type":{"kind":"enum","variants":[{"name":"Second"},{"name":"Slot"}]}},{"name":"TransferPolicy","type":{"kind":"struct","fields":[{"name":"allowlist","type":{"vec":"pubkey"}}]}},{"name":"ValuationModel","type":{"kind":"enum","variants":[{"name":"Continuous"},{"name":"Periodic"}]}}],"constants":[{"name":"PROTO_JUPITER_SWAP","type":"u16","value":"4"},{"name":"PROTO_JUPITER_SWAP_PERM_SWAP_ALLOWLISTED","type":"u64","value":"4"},{"name":"PROTO_JUPITER_SWAP_PERM_SWAP_ANY","type":"u64","value":"1"},{"name":"PROTO_JUPITER_SWAP_PERM_SWAP_LST","type":"u64","value":"2"},{"name":"PROTO_STAKE","type":"u16","value":"2"},{"name":"PROTO_STAKE_PERM_STAKE","type":"u64","value":"1"},{"name":"PROTO_STAKE_PERM_UNSTAKE","type":"u64","value":"2"},{"name":"PROTO_SYSTEM","type":"u16","value":"1"},{"name":"PROTO_SYSTEM_PERM_TRANSFER","type":"u64","value":"2"},{"name":"PROTO_SYSTEM_PERM_WSOL","type":"u64","value":"1"}]}');
118
118
 
119
119
  /***/ }),
120
120
  /* 6 */
@@ -553,7 +553,7 @@ module.exports = require("@solana/spl-token-metadata");
553
553
 
554
554
 
555
555
  Object.defineProperty(exports, "__esModule", ({ value: true }));
556
- exports.PERMISSION_MAPPINGS = exports.DRIFT_POOL_MAPPING = exports.CCTP_DOMAIN_MAPPING = exports.INTEGRATION_MAPPING = exports.GLAM_REFERRER = exports.JUPSOL_STAKE_POOL = exports.JITO_STAKE_POOL = exports.MESSAGE_TRANSMITTER_V2 = exports.TOKEN_MESSENGER_MINTER_V2 = exports.ALT_PROGRAM_ID = exports.MEMO_PROGRAM = exports.KAMINO_FARM_PROGRAM = exports.KAMINO_VAULTS_PROGRAM = exports.KAMINO_LENDING_PROGRAM = exports.METEORA_DLMM_PROGRAM = exports.TRANSFER_HOOK_PROGRAM = exports.MERKLE_DISTRIBUTOR_PROGRAM = exports.JUP_VOTE_PROGRAM = exports.GOVERNANCE_PROGRAM_ID = exports.SANCTUM_STAKE_POOL_PROGRAM_ID = exports.JUPITER_PROGRAM_ID = exports.DRIFT_DISTRIBUTOR_PROGRAM = exports.DRIFT_VAULTS_PROGRAM_ID = exports.DRIFT_PROGRAM_ID = exports.MARINADE_PROGRAM_ID = exports.JUP = exports.USDC_DEVNET = exports.USDC = exports.MSOL = exports.WSOL = exports.MARINADE_NATIVE_STAKE_AUTHORITY = exports.KAMINO_SCOPE_PRICES = exports.JITO_TIP_DEFAULT = exports.JUPITER_API_DEFAULT = exports.DRIFT_VAULT_DEPOSITOR_SIZE = exports.KAMINO_OBTRIGATION_SIZE = exports.METEORA_POSITION_SIZE = exports.STAKE_ACCOUNT_SIZE = exports.SEED_INTEGRATION_AUTHORITY = exports.SEED_GLOBAL_CONFIG = exports.SEED_EXTRA_ACCOUNT_METAS = exports.SEED_ACCOUNT_POLICY = exports.SEED_REQUEST_QUEUE = exports.SEED_ESCROW = exports.SEED_MINT = exports.SEED_METADATA = exports.SEED_VAULT = exports.SEED_STATE = void 0;
556
+ exports.PROTOCOLS_AND_PERMISSIONS = exports.PERMISSION_MAPPINGS = exports.DRIFT_POOL_MAPPING = exports.CCTP_DOMAIN_MAPPING = exports.INTEGRATION_MAPPING = exports.GLAM_REFERRER = exports.JUPSOL_STAKE_POOL = exports.JITO_STAKE_POOL = exports.MESSAGE_TRANSMITTER_V2 = exports.TOKEN_MESSENGER_MINTER_V2 = exports.ALT_PROGRAM_ID = exports.MEMO_PROGRAM = exports.KAMINO_FARM_PROGRAM = exports.KAMINO_VAULTS_PROGRAM = exports.KAMINO_LENDING_PROGRAM = exports.METEORA_DLMM_PROGRAM = exports.TRANSFER_HOOK_PROGRAM = exports.MERKLE_DISTRIBUTOR_PROGRAM = exports.JUP_VOTE_PROGRAM = exports.GOVERNANCE_PROGRAM_ID = exports.SANCTUM_STAKE_POOL_PROGRAM_ID = exports.JUPITER_PROGRAM_ID = exports.DRIFT_DISTRIBUTOR_PROGRAM = exports.DRIFT_VAULTS_PROGRAM_ID = exports.DRIFT_PROGRAM_ID = exports.MARINADE_PROGRAM_ID = exports.JUP = exports.USDC_DEVNET = exports.USDC = exports.MSOL = exports.WSOL = exports.MARINADE_NATIVE_STAKE_AUTHORITY = exports.KAMINO_SCOPE_PRICES = exports.JITO_TIP_DEFAULT = exports.JUPITER_API_DEFAULT = exports.DRIFT_VAULT_DEPOSITOR_SIZE = exports.KAMINO_OBTRIGATION_SIZE = exports.METEORA_POSITION_SIZE = exports.STAKE_ACCOUNT_SIZE = exports.SEED_INTEGRATION_AUTHORITY = exports.SEED_GLOBAL_CONFIG = exports.SEED_EXTRA_ACCOUNT_METAS = exports.SEED_ACCOUNT_POLICY = exports.SEED_REQUEST_QUEUE = exports.SEED_ESCROW = exports.SEED_MINT = exports.SEED_METADATA = exports.SEED_VAULT = exports.SEED_STATE = void 0;
557
557
  const web3_js_1 = __webpack_require__(15);
558
558
  exports.SEED_STATE = "state"; // protocol program
559
559
  exports.SEED_VAULT = "vault"; // protocol program
@@ -730,6 +730,114 @@ exports.PERMISSION_MAPPINGS = {
730
730
  },
731
731
  },
732
732
  };
733
+ // Permission mappings for each protocol - maps bit positions to permission names
734
+ exports.PROTOCOLS_AND_PERMISSIONS = {
735
+ // Self integration
736
+ GLAMpaME8wdTEzxtiYEAa5yD8fZbxZiz2hNtV58RZiEz: {
737
+ "0000000000000001": {
738
+ name: "System Program",
739
+ permissions: {
740
+ [1 << 0]: "WSOL",
741
+ [1 << 1]: "Transfer",
742
+ },
743
+ },
744
+ "0000000000000010": {
745
+ name: "Stake Program",
746
+ permissions: {
747
+ [1 << 0]: "Stake",
748
+ [1 << 1]: "Unstake",
749
+ },
750
+ },
751
+ "0000000000000100": {
752
+ name: "Jupiter Swap",
753
+ permissions: {
754
+ [1 << 0]: "SwapAny",
755
+ [1 << 1]: "SwapLST",
756
+ [1 << 2]: "SwapAllowlisted",
757
+ },
758
+ },
759
+ },
760
+ // GLAM mint
761
+ GM1NtvvnSXUptTrMCqbogAdZJydZSNv98DoU5AZVLmGh: {
762
+ "0000000000000001": {
763
+ name: "GLAM Mint",
764
+ permissions: {
765
+ [1 << 0]: "Mint",
766
+ },
767
+ },
768
+ },
769
+ // Kamino integration program
770
+ G1NTkDEUR3pkEqGCKZtmtmVzCUEdYa86pezHkwYbLyde: {
771
+ "0000000000000001": {
772
+ name: "Kamino Lending",
773
+ permissions: {
774
+ [1 << 0]: "Init",
775
+ [1 << 1]: "Deposit",
776
+ [1 << 2]: "Withdraw",
777
+ [1 << 3]: "Borrow",
778
+ [1 << 4]: "Repay",
779
+ },
780
+ },
781
+ "0000000000000010": {
782
+ name: "Kamino Vaults",
783
+ permissions: {
784
+ [1 << 0]: "Deposit",
785
+ [1 << 1]: "Withdraw",
786
+ },
787
+ },
788
+ "0000000000000100": {
789
+ name: "Kamino Farms",
790
+ permissions: {
791
+ [1 << 0]: "Stake",
792
+ [1 << 1]: "Unstake",
793
+ [1 << 2]: "HarvestReward",
794
+ },
795
+ },
796
+ },
797
+ // Drift integration program
798
+ G1NTdrBmBpW43msRQmsf7qXSw3MFBNaqJcAkGiRmRq2F: {
799
+ "0000000000000001": {
800
+ name: "Drift Protocol",
801
+ permissions: {
802
+ [1 << 0]: "InitUser",
803
+ [1 << 1]: "UpdateUser",
804
+ [1 << 2]: "DeleteUser",
805
+ [1 << 3]: "Deposit",
806
+ [1 << 4]: "Withdraw",
807
+ [1 << 5]: "Borrow",
808
+ [1 << 6]: "CreateModifyOrders",
809
+ [1 << 7]: "CancelOrders",
810
+ [1 << 8]: "PerpMarkets",
811
+ [1 << 9]: "SpotMarkets",
812
+ },
813
+ },
814
+ "0000000000000010": {
815
+ name: "Drift Vaults",
816
+ permissions: {
817
+ [1 << 0]: "Deposit",
818
+ [1 << 1]: "Withdraw",
819
+ },
820
+ },
821
+ },
822
+ // Token integration program
823
+ G1NTsQ36mjPe89HtPYqxKsjY5HmYsDR6CbD2gd2U2pta: {
824
+ "0000000000000001": {
825
+ name: "Token",
826
+ permissions: {
827
+ [1 << 0]: "Transfer",
828
+ },
829
+ },
830
+ },
831
+ // CCTP integration program
832
+ G1NTcMDYgNLpDwgnrpSZvoSKQuR9NXG7S3DmtNQCDmrK: {
833
+ "0000000000000001": {
834
+ name: "CCTP",
835
+ permissions: {
836
+ [1 << 0]: "Transfer",
837
+ },
838
+ },
839
+ },
840
+ };
733
841
 
734
842
 
735
843
  /***/ }),
@@ -747,6 +855,8 @@ exports.parseProgramLogs = parseProgramLogs;
747
855
  exports.charsToName = charsToName;
748
856
  exports.nameToChars = nameToChars;
749
857
  exports.formatBits = formatBits;
858
+ exports.parseProtocolsBitmask = parseProtocolsBitmask;
859
+ exports.parseProtocolPermissionsBitmask = parseProtocolPermissionsBitmask;
750
860
  const web3_js_1 = __webpack_require__(15);
751
861
  const constants_1 = __webpack_require__(18);
752
862
  const dlmm_1 = __webpack_require__(20);
@@ -839,7 +949,7 @@ async function getProgramAccountsWithRetry(connection, programId, filters) {
839
949
  break;
840
950
  }
841
951
  // Increase delay for each retry
842
- console.warn(`Attempt ${attempt} failed, retrying in ${delayMs * attempt}ms:`, error.message);
952
+ console.warn(`getProgramAccounts attempt ${attempt} failed, retrying in ${delayMs * attempt}ms:`, error.message);
843
953
  await new Promise((resolve) => setTimeout(resolve, delayMs * attempt));
844
954
  }
845
955
  }
@@ -1128,9 +1238,109 @@ function charsToName(chars) {
1128
1238
  function nameToChars(name) {
1129
1239
  return Array.from(Buffer.from(name).subarray(0, 32));
1130
1240
  }
1241
+ /**
1242
+ * Formats a bitmask as a binary string.
1243
+ *
1244
+ * @param bitmask - The bitmask to format, either a number or a BN.
1245
+ * @param padding - The number of bits to pad the bitmask with.
1246
+ * @returns e.g. '0000000000001100' if bitmask is 12 and padding is 16.
1247
+ */
1131
1248
  function formatBits(bitmask, padding = 16) {
1132
1249
  return bitmask.toString(2).padStart(padding, "0");
1133
1250
  }
1251
+ /**
1252
+ * Parses a bitmask into a binary string and a list of protocol names.
1253
+ *
1254
+ * @param integrationProgram - The integration program ID.
1255
+ * @param protocolsBitmask - The bitmask to parse.
1256
+ * @returns An object containing the bitmask string and a list of protocol names.
1257
+ */
1258
+ function parseProtocolsBitmask(integrationProgram, protocolsBitmask) {
1259
+ const integration = constants_1.PROTOCOLS_AND_PERMISSIONS[integrationProgram.toBase58()];
1260
+ if (!integration) {
1261
+ return {
1262
+ protocols: [],
1263
+ };
1264
+ }
1265
+ const protocols = [];
1266
+ // Check each protocol in the integration
1267
+ Object.entries(integration).forEach(([protocolBitflagStr, { name }]) => {
1268
+ if (anchor_1.BN.isBN(protocolsBitmask)) {
1269
+ const protocolBitflag = new anchor_1.BN(protocolBitflagStr, 2);
1270
+ if (protocolsBitmask.and(protocolBitflag).eq(protocolBitflag)) {
1271
+ protocols.push({ bitflag: protocolBitflag, name });
1272
+ }
1273
+ }
1274
+ else {
1275
+ const protocolBitflag = parseInt(protocolBitflagStr, 2);
1276
+ if (protocolsBitmask & protocolBitflag) {
1277
+ protocols.push({ bitflag: protocolBitflag, name });
1278
+ }
1279
+ }
1280
+ });
1281
+ return {
1282
+ protocols,
1283
+ };
1284
+ }
1285
+ /**
1286
+ * Helper function to check if a number is a power of two.
1287
+ * A number is a power of two if it has exactly one bit set.
1288
+ */
1289
+ function isPowerOfTwo(n) {
1290
+ if (anchor_1.BN.isBN(n)) {
1291
+ return n.isPowerOfTwo();
1292
+ }
1293
+ return n > 0 && (n & (n - 1)) === 0;
1294
+ }
1295
+ /**
1296
+ * Parses a permissions bitmask for a specific protocol to get permission names.
1297
+ *
1298
+ * @param integrationProgram - The integration program ID.
1299
+ * @param protocolBitflag - The protocol bitflag to identify which protocol.
1300
+ * @param permissionsBitmask - The permissions bitmask to parse.
1301
+ * @returns An object containing the bitmask string and a list of permission names.
1302
+ */
1303
+ function parseProtocolPermissionsBitmask(integrationProgram, protocolBitflag, permissionsBitmask) {
1304
+ if (!isPowerOfTwo(protocolBitflag)) {
1305
+ throw new Error("Protocol bitflag must have exactly 1 bit set");
1306
+ }
1307
+ const integration = constants_1.PROTOCOLS_AND_PERMISSIONS[integrationProgram.toBase58()];
1308
+ if (!integration) {
1309
+ return {
1310
+ protocol: formatBits(protocolBitflag), // Unknown protocol bitflag
1311
+ permissions: [],
1312
+ };
1313
+ }
1314
+ const protocol = integration[formatBits(protocolBitflag)];
1315
+ if (!protocol) {
1316
+ return {
1317
+ protocol: formatBits(protocolBitflag),
1318
+ permissions: [],
1319
+ };
1320
+ }
1321
+ const permissions = [];
1322
+ // Check each permission in the protocol
1323
+ Object.entries(protocol.permissions).forEach(([bitflagStr, name]) => {
1324
+ if (anchor_1.BN.isBN(permissionsBitmask)) {
1325
+ const permissionBitflag = new anchor_1.BN(bitflagStr);
1326
+ if (permissionsBitmask
1327
+ .and(new anchor_1.BN(permissionBitflag))
1328
+ .eq(new anchor_1.BN(permissionBitflag))) {
1329
+ permissions.push({ bitflag: permissionBitflag, name });
1330
+ }
1331
+ }
1332
+ else {
1333
+ const permissionBitflag = parseInt(bitflagStr);
1334
+ if (permissionsBitmask & permissionBitflag) {
1335
+ permissions.push({ bitflag: permissionBitflag, name });
1336
+ }
1337
+ }
1338
+ });
1339
+ return {
1340
+ protocol: protocol.name,
1341
+ permissions,
1342
+ };
1343
+ }
1134
1344
 
1135
1345
 
1136
1346
  /***/ }),
@@ -5645,7 +5855,8 @@ class StakingClient {
5645
5855
  const { programId: stakePoolProgram, poolMint, withdrawAuthority, feeAccount, tokenProgramId: tokenProgram, validatorList, reserveStake, } = await this.getStakePoolAccountData(stakePool);
5646
5856
  const poolTokensFrom = this.base.getVaultAta(poolMint, tokenProgram);
5647
5857
  // The reserve stake account should NOT be used for withdrawals unless we have no other options.
5648
- const validatorStakeCandidates = (await (0, helpers_1.getStakeAccountsWithStates)(this.base.provider.connection, withdrawAuthority)).filter((s) => !s.address.equals(reserveStake));
5858
+ // And only active validator stake accounts should be used.
5859
+ const validatorStakeCandidates = (await (0, helpers_1.getStakeAccountsWithStates)(this.base.provider.connection, withdrawAuthority)).filter((s) => !s.address.equals(reserveStake) && s.state === "active");
5649
5860
  const validatorStakeAccount = validatorStakeCandidates.length === 0
5650
5861
  ? reserveStake
5651
5862
  : validatorStakeCandidates[0].address;
@@ -10000,6 +10211,15 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
10000
10211
  exports.installIntegrationCommands = installIntegrationCommands;
10001
10212
  const glam_sdk_1 = __webpack_require__(1);
10002
10213
  const utils_1 = __webpack_require__(55);
10214
+ const web3_js_1 = __webpack_require__(15);
10215
+ const validateIntegrationProgram = (input) => {
10216
+ const pubkey = (0, utils_1.validatePublicKey)(input);
10217
+ if (pubkey.equals(new web3_js_1.PublicKey(glam_sdk_1.GlamMintIdl.address))) {
10218
+ console.error("Mint integration is not allowed");
10219
+ process.exit(1);
10220
+ }
10221
+ return pubkey;
10222
+ };
10003
10223
  function installIntegrationCommands(integration, context) {
10004
10224
  integration
10005
10225
  .command("list")
@@ -10007,20 +10227,26 @@ function installIntegrationCommands(integration, context) {
10007
10227
  .action(async () => {
10008
10228
  const stateModel = await context.glamClient.fetchStateModel();
10009
10229
  const cnt = stateModel.integrationAcls.length;
10010
- console.log(`${stateModel.nameStr} (${context.glamClient.statePda}) has ${cnt} integration program${cnt > 1 ? "s" : ""} enabled`);
10011
- for (let [i, integ] of stateModel.integrationAcls.entries()) {
10012
- console.log(`[${i}] ${integ.integrationProgram} protocolsBitmask: ${(0, glam_sdk_1.formatBits)(integ.protocolsBitmask)}`);
10230
+ console.log(`${stateModel.nameStr} (${context.glamClient.statePda}) has ${cnt} integration program${cnt > 1 ? "s" : ""} enabled:`);
10231
+ for (let [i, { integrationProgram, protocolsBitmask },] of stateModel.integrationAcls.entries()) {
10232
+ const { protocols } = (0, glam_sdk_1.parseProtocolsBitmask)(integrationProgram, protocolsBitmask);
10233
+ console.log(`[${i}] ${integrationProgram}, protocols (${(0, glam_sdk_1.formatBits)(protocolsBitmask)}): ${protocols.map((p) => p.name).join(", ")}`);
10013
10234
  }
10014
10235
  });
10015
10236
  integration
10016
10237
  .command("enable")
10017
- .description("Enable protocols for an integration program")
10018
- .argument("<integration_program>", "Integration program ID", utils_1.validatePublicKey)
10238
+ .description("Enable protocols for an integration")
10239
+ .argument("<integration_program>", "Integration program ID", validateIntegrationProgram)
10019
10240
  .argument("<protocols_bitmask>", "Protocols to eanble", parseInt)
10020
- .action(async (integrationProgram, protocolsBitmask) => {
10241
+ .option("-y, --yes", "Skip confirmation")
10242
+ .action(async (integrationProgram, protocolsBitmask, { yes }) => {
10243
+ const { protocols } = (0, glam_sdk_1.parseProtocolsBitmask)(integrationProgram, protocolsBitmask);
10244
+ const protocolNames = protocols.map((p) => p.name).join(", ");
10245
+ !yes &&
10246
+ (await (0, utils_1.confirmOperation)(`Enable integration ${integrationProgram} and protocol(s): ${protocolNames}?`));
10021
10247
  try {
10022
10248
  const txSig = await context.glamClient.access.enableProtocols(integrationProgram, protocolsBitmask, context.txOptions);
10023
- console.log(`Enabled ${(0, glam_sdk_1.formatBits)(protocolsBitmask)} for ${integrationProgram}: ${txSig}`);
10249
+ console.log(`Enabled ${protocolNames} from ${integrationProgram}: ${txSig}`);
10024
10250
  }
10025
10251
  catch (e) {
10026
10252
  console.error((0, utils_1.parseTxError)(e));
@@ -10029,17 +10255,18 @@ function installIntegrationCommands(integration, context) {
10029
10255
  });
10030
10256
  integration
10031
10257
  .command("disable")
10032
- .description("Disable an integration")
10033
- .argument("<integration_program>", "Integration program ID", utils_1.validatePublicKey)
10258
+ .description("Disable protocols for an integration")
10259
+ .argument("<integration_program>", "Integration program ID", validateIntegrationProgram)
10034
10260
  .argument("<protocols_bitmask>", "Protocols to disable", parseInt)
10035
- .action(async (integrationProgram, protocolsBitmask) => {
10036
- if (integrationProgram.equals(context.glamClient.mintProgram.programId)) {
10037
- console.error("Disabling protocols for the mint integration is not allowed");
10038
- process.exit(1);
10039
- }
10261
+ .option("-y, --yes", "Skip confirmation")
10262
+ .action(async (integrationProgram, protocolsBitmask, { yes }) => {
10263
+ const { protocols } = (0, glam_sdk_1.parseProtocolsBitmask)(integrationProgram, protocolsBitmask);
10264
+ const protocolNames = protocols.map((p) => p.name).join(", ");
10265
+ !yes &&
10266
+ (await (0, utils_1.confirmOperation)(`Disable integration ${integrationProgram} and protocol(s): ${protocolNames}?`));
10040
10267
  try {
10041
10268
  const txSig = await context.glamClient.access.disableProtocols(integrationProgram, protocolsBitmask, context.txOptions);
10042
- console.log(`Disabled ${(0, glam_sdk_1.formatBits)(protocolsBitmask)} for ${integrationProgram}: ${txSig}`);
10269
+ console.log(`Disabled ${protocolNames} from ${integrationProgram}: ${txSig}`);
10043
10270
  }
10044
10271
  catch (e) {
10045
10272
  console.error((0, utils_1.parseTxError)(e));
@@ -10047,17 +10274,16 @@ function installIntegrationCommands(integration, context) {
10047
10274
  }
10048
10275
  });
10049
10276
  integration
10050
- .command("delete")
10051
- .argument("<integration_program>", "Integration program ID", utils_1.validatePublicKey)
10052
- .description("Delete an integration program")
10053
- .action(async (integrationProgram) => {
10054
- if (integrationProgram.equals(context.glamClient.mintProgram.programId)) {
10055
- console.error("Deleting the mint integration is not allowed");
10056
- process.exit(1);
10057
- }
10277
+ .command("disable-all")
10278
+ .argument("<integration_program>", "Integration program ID", validateIntegrationProgram)
10279
+ .option("-y, --yes", "Skip confirmation")
10280
+ .description("Disable all protocols for an integration")
10281
+ .action(async (integrationProgram, { yes }) => {
10282
+ !yes &&
10283
+ (await (0, utils_1.confirmOperation)(`Disable all protocols for integration ${integrationProgram}?`));
10058
10284
  try {
10059
10285
  const txSig = await context.glamClient.access.emergencyAccessUpdate({ disabledIntegrations: [integrationProgram] }, context.txOptions);
10060
- console.log(`Deleted ${integrationProgram} access: ${txSig}`);
10286
+ console.log(`Disabled all protocols for ${integrationProgram}: ${txSig}`);
10061
10287
  }
10062
10288
  catch (e) {
10063
10289
  console.error((0, utils_1.parseTxError)(e));
@@ -10084,13 +10310,16 @@ function installDelegateCommands(delegate, context) {
10084
10310
  .action(async () => {
10085
10311
  const stateModel = await context.glamClient.fetchStateModel();
10086
10312
  const cnt = stateModel.delegateAcls.length;
10087
- console.log(`${stateModel.nameStr} (${context.glamClient.statePda}) has ${cnt} delegate${cnt > 1 ? "s" : ""}`);
10313
+ console.log(`${stateModel.nameStr} (${context.glamClient.statePda}) has ${cnt} delegate${cnt > 1 ? "s" : ""}:`);
10088
10314
  for (let [i, acl] of stateModel.delegateAcls.entries()) {
10089
10315
  console.log(`[${i}] ${acl.pubkey}`);
10090
- acl.integrationPermissions.forEach((p) => {
10091
- console.log(` ${p.integrationProgram}`);
10092
- p.protocolPermissions.forEach((pp) => {
10093
- console.log(` Protocol: ${(0, glam_sdk_1.formatBits)(pp.protocolBitflag)}, Permissions: ${(0, glam_sdk_1.formatBits)(pp.permissionsBitmask)}`);
10316
+ acl.integrationPermissions.forEach(({ integrationProgram, protocolPermissions }) => {
10317
+ console.log(` Integration: ${integrationProgram}`);
10318
+ protocolPermissions.forEach(({ protocolBitflag, permissionsBitmask }) => {
10319
+ const { protocol, permissions } = (0, glam_sdk_1.parseProtocolPermissionsBitmask)(integrationProgram, protocolBitflag, permissionsBitmask);
10320
+ const permissionNames = permissions.map((perm) => perm.name).join(", ") ||
10321
+ (0, glam_sdk_1.formatBits)(permissionsBitmask);
10322
+ console.log(` ${protocol}: ${permissionNames}`);
10094
10323
  });
10095
10324
  });
10096
10325
  }
@@ -10101,11 +10330,17 @@ function installDelegateCommands(delegate, context) {
10101
10330
  .argument("<integration_program>", "Integration programs to grant permissions to", utils_1.validatePublicKey)
10102
10331
  .argument("<protocol_bitflag>", "Protocol bitflag", parseInt)
10103
10332
  .argument("<permissions_bitmask>", "Permissions bitmask", parseInt)
10333
+ .option("-y, --yes", "Skip confirmation prompt")
10104
10334
  .description("Grant delegate permissions to integration programs")
10105
- .action(async (delegate, integrationProgram, protocolBitflag, permissionsBitmask) => {
10335
+ .action(async (delegate, integrationProgram, protocolBitflag, permissionsBitmask, { yes }) => {
10336
+ const { protocol, permissions } = (0, glam_sdk_1.parseProtocolPermissionsBitmask)(integrationProgram, protocolBitflag, permissionsBitmask);
10337
+ const permissionNames = permissions.map((perm) => perm.name).join(", ") ||
10338
+ (0, glam_sdk_1.formatBits)(permissionsBitmask);
10339
+ yes ||
10340
+ (await (0, utils_1.confirmOperation)(`Confirm granting ${delegate} "${permissionNames}" permissions for protocol "${protocol}"?`));
10106
10341
  try {
10107
10342
  const txSig = await context.glamClient.access.grantDelegatePermissions(delegate, integrationProgram, protocolBitflag, new anchor_1.BN(permissionsBitmask), context.txOptions);
10108
- console.log(`Granted ${delegate} permissions ${(0, glam_sdk_1.formatBits)(permissionsBitmask)} to ${integrationProgram} for protocol ${(0, glam_sdk_1.formatBits)(protocolBitflag)}: ${txSig}`);
10343
+ console.log(`Granted ${delegate} "${permissionNames}" permissions to ${integrationProgram} for protocol "${protocol}": ${txSig}`);
10109
10344
  }
10110
10345
  catch (e) {
10111
10346
  console.error((0, utils_1.parseTxError)(e));
@@ -10118,11 +10353,17 @@ function installDelegateCommands(delegate, context) {
10118
10353
  .argument("<integration_program>", "Integration programs to grant permissions to", utils_1.validatePublicKey)
10119
10354
  .argument("<protocol_bitflag>", "Protocol bitflag", parseInt)
10120
10355
  .argument("<permissions_bitmask>", "Permissions bitmask", parseInt)
10356
+ .option("-y, --yes", "Skip confirmation prompt")
10121
10357
  .description("Revoke delegate permissions to specified integration programs")
10122
- .action(async (delegate, integrationProgram, protocolBitflag, permissionsBitmask) => {
10358
+ .action(async (delegate, integrationProgram, protocolBitflag, permissionsBitmask, { yes }) => {
10359
+ const { protocol, permissions } = (0, glam_sdk_1.parseProtocolPermissionsBitmask)(integrationProgram, protocolBitflag, permissionsBitmask);
10360
+ const permissionNames = permissions.map((perm) => perm.name).join(", ") ||
10361
+ (0, glam_sdk_1.formatBits)(permissionsBitmask);
10362
+ yes ||
10363
+ (await (0, utils_1.confirmOperation)(`Confirm revoking ${delegate} "${permissionNames}" permissions for protocol "${protocol}"?`));
10123
10364
  try {
10124
10365
  const txSig = await context.glamClient.access.revokeDelegatePermissions(delegate, integrationProgram, protocolBitflag, new anchor_1.BN(permissionsBitmask), context.txOptions);
10125
- console.log(`Revoked ${delegate} permissions ${(0, glam_sdk_1.formatBits)(permissionsBitmask)} to ${integrationProgram} for protocol ${(0, glam_sdk_1.formatBits)(protocolBitflag)}: ${txSig}`);
10366
+ console.log(`Revoked ${delegate} "${permissionNames}" permissions from ${integrationProgram} for protocol "${protocol}": ${txSig}`);
10126
10367
  }
10127
10368
  catch (e) {
10128
10369
  console.error((0, utils_1.parseTxError)(e));
@@ -10130,10 +10371,13 @@ function installDelegateCommands(delegate, context) {
10130
10371
  }
10131
10372
  });
10132
10373
  delegate
10133
- .command("delete")
10374
+ .command("revoke-all")
10134
10375
  .argument("<pubkey>", "Delegate pubkey", utils_1.validatePublicKey)
10376
+ .option("-y, --yes", "Skip confirmation prompt")
10135
10377
  .description("Revoke delegate access entirely")
10136
- .action(async (delegate) => {
10378
+ .action(async (delegate, { yes }) => {
10379
+ yes ||
10380
+ (await (0, utils_1.confirmOperation)(`Confirm revoking ${delegate} access to the vault?`));
10137
10381
  try {
10138
10382
  const txSig = await context.glamClient.access.emergencyAccessUpdate({ disabledDelegates: [delegate] }, context.txOptions);
10139
10383
  console.log(`Revoked ${delegate} access: ${txSig}`);
@@ -10530,12 +10774,14 @@ function installVaultCommands(program, context) {
10530
10774
  .description("Set the active GLAM vault for subsequent CLI operations")
10531
10775
  .action(async (state) => {
10532
10776
  try {
10533
- const stateModel = await context.glamClient.fetchStateModel(state);
10777
+ context.glamClient.statePda = state;
10778
+ const stateModel = await context.glamClient.fetchStateModel();
10534
10779
  context.cliConfig.glamState = state;
10535
10780
  console.log(`Active GLAM state: ${stateModel.idStr}`);
10536
10781
  console.log(`Vault: ${stateModel.vault}`);
10537
10782
  }
10538
10783
  catch (e) {
10784
+ context.glamClient.statePda = null;
10539
10785
  console.error("Invalid GLAM state public key.");
10540
10786
  process.exit(1);
10541
10787
  }
@@ -10718,8 +10964,8 @@ function installVaultCommands(program, context) {
10718
10964
  });
10719
10965
  program
10720
10966
  .command("close")
10721
- .argument("[state]", "GLAM state public key", utils_1.validatePublicKey)
10722
- .description("Close a GLAM product by its state pubkey")
10967
+ .argument("[state]", "Vault state public key", utils_1.validatePublicKey)
10968
+ .description("Close a GLAM vault by its state pubkey")
10723
10969
  .option("-y, --yes", "Skip confirmation prompt")
10724
10970
  .action(async (state, options) => {
10725
10971
  const statePda = state || context.cliConfig.glamState;
@@ -11332,7 +11578,7 @@ program
11332
11578
  }
11333
11579
  await (0, idl_1.idlCheck)(context.glamClient);
11334
11580
  })
11335
- .version("0.2.0-alpha.2");
11581
+ .version("0.2.0-alpha.3");
11336
11582
  program
11337
11583
  .command("env")
11338
11584
  .description("Display current environment setup")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glamsystems/glam-cli",
3
- "version": "0.2.0-alpha.2",
3
+ "version": "0.2.0-alpha.3",
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.2.0-alpha.2",
24
+ "@glamsystems/glam-sdk": "0.2.0-alpha.3",
25
25
  "commander": "^11.1.0",
26
26
  "inquirer": "^8.2.6",
27
27
  "@switchboard-xyz/common": "^3.0.0"