@glamsystems/glam-cli 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/main.js +867 -441
- package/package.json +2 -2
package/main.js
CHANGED
|
@@ -27,8 +27,9 @@ tslib_1.__exportStar(__webpack_require__(11), exports);
|
|
|
27
27
|
tslib_1.__exportStar(__webpack_require__(12), exports);
|
|
28
28
|
tslib_1.__exportStar(__webpack_require__(22), exports);
|
|
29
29
|
tslib_1.__exportStar(__webpack_require__(19), exports);
|
|
30
|
+
tslib_1.__exportStar(__webpack_require__(13), exports);
|
|
30
31
|
tslib_1.__exportStar(__webpack_require__(14), exports);
|
|
31
|
-
tslib_1.__exportStar(__webpack_require__(
|
|
32
|
+
tslib_1.__exportStar(__webpack_require__(34), exports);
|
|
32
33
|
tslib_1.__exportStar(__webpack_require__(10), exports);
|
|
33
34
|
tslib_1.__exportStar(__webpack_require__(16), exports);
|
|
34
35
|
|
|
@@ -79,7 +80,7 @@ module.exports = require("@solana/web3.js");
|
|
|
79
80
|
/* 6 */
|
|
80
81
|
/***/ ((module) => {
|
|
81
82
|
|
|
82
|
-
module.exports = /*#__PURE__*/JSON.parse('{"address":"GLAMbTqav9N9witRjswJ8enwp9vv5G8bsSJ2kPJ4rcyc","metadata":{"name":"glam","version":"0.4.3","spec":"0.1.0","description":"Glam Protocol"},"instructions":[{"name":"add_mint","docs":["Mint","Adds a new mint.","","# Parameters","- `ctx`: The context for the instruction.","- `mint_model`: An instance of `MintModel` containing the metadata for the new mint.","","# Permission required","- Owner only, delegates not allowed"],"discriminator":[171,222,111,37,60,166,208,108],"accounts":[{"name":"glam_state","writable":true},{"name":"new_mint","writable":true},{"name":"signer","writable":true,"signer":true},{"name":"extra_account_meta_list","writable":true,"pda":{"seeds":[{"kind":"const","value":[101,120,116,114,97,45,97,99,99,111,117,110,116,45,109,101,116,97,115]},{"kind":"account","path":"new_mint"}]}},{"name":"openfunds_metadata","writable":true,"optional":true,"pda":{"seeds":[{"kind":"const","value":[109,101,116,97,100,97,116,97]},{"kind":"account","path":"glam_state"}]}},{"name":"system_program","address":"11111111111111111111111111111111"},{"name":"token_2022_program","address":"TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"}],"args":[{"name":"mint_model","type":{"defined":{"name":"MintModel"}}}]},{"name":"burn_tokens","docs":["Burns a specified amount of tokens for the given mint.","","# Parameters","- `ctx`: The context for the instruction.","- `mint_id`: The id of the mint to burn tokens for.","- `amount`: The amount of tokens to burn.","","# Permission required","- Permission::BurnTokens","","# Integration required","- Integration::Mint"],"discriminator":[76,15,51,254,229,215,121,66],"accounts":[{"name":"glam_state"},{"name":"glam_mint","writable":true},{"name":"from_ata","writable":true,"pda":{"seeds":[{"kind":"account","path":"from"},{"kind":"account","path":"token_2022_program"},{"kind":"account","path":"glam_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":"from"},{"name":"signer","writable":true,"signer":true},{"name":"token_2022_program","address":"TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"}],"args":[{"name":"mint_id","type":"u8"},{"name":"amount","type":"u64"}]},{"name":"close_mint","docs":["Closes a mint and releases its resources.","","# Parameters","- `ctx`: The context for the instruction.","- `mint_id`: The id of the mint to be closed.","","# Permission required","- Owner only, delegates not allowed"],"discriminator":[149,251,157,212,65,181,235,129],"accounts":[{"name":"glam_state","writable":true},{"name":"vault","writable":true,"pda":{"seeds":[{"kind":"const","value":[118,97,117,108,116]},{"kind":"account","path":"glam_state"}]}},{"name":"glam_mint","writable":true},{"name":"extra_account_meta_list","writable":true,"pda":{"seeds":[{"kind":"const","value":[101,120,116,114,97,45,97,99,99,111,117,110,116,45,109,101,116,97,115]},{"kind":"account","path":"glam_mint"}]}},{"name":"metadata","writable":true,"pda":{"seeds":[{"kind":"const","value":[109,101,116,97,100,97,116,97]},{"kind":"account","path":"glam_state"}]}},{"name":"signer","writable":true,"signer":true},{"name":"token_2022_program","address":"TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"}],"args":[{"name":"mint_id","type":"u8"}]},{"name":"close_state","docs":["Closes a state account and releases its resources.","","# Parameters","- `ctx`: The context for the instruction.","","# Permission required","- Owner only, delegates not allowed"],"discriminator":[25,1,184,101,200,245,210,246],"accounts":[{"name":"state","writable":true},{"name":"metadata","writable":true,"pda":{"seeds":[{"kind":"const","value":[109,101,116,97,100,97,116,97]},{"kind":"account","path":"state"}]}},{"name":"vault","writable":true,"pda":{"seeds":[{"kind":"const","value":[118,97,117,108,116]},{"kind":"account","path":"state"}]}},{"name":"signer","writable":true,"signer":true},{"name":"system_program","address":"11111111111111111111111111111111"}],"args":[]},{"name":"close_token_accounts","docs":["Closes token accounts owned by the vault.","","# Parameters","- `ctx`: The context for the instruction.","","# Permission required","- Owner only, delegates not allowed"],"discriminator":[199,170,37,55,63,183,235,143],"accounts":[{"name":"state","writable":true},{"name":"vault","writable":true,"pda":{"seeds":[{"kind":"const","value":[118,97,117,108,116]},{"kind":"account","path":"state"}]}},{"name":"signer","writable":true,"signer":true},{"name":"token_program","address":"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"},{"name":"token_2022_program","address":"TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"}],"args":[]},{"name":"deactivate_stake_accounts","docs":["Deactivates stake accounts.","","# Parameters","- `ctx`: The context for the instruction.","","# Permission required","- Permission::Unstake","","# Integration required","- Integration::NativeStaking"],"discriminator":[58,18,6,22,226,216,161,193],"accounts":[{"name":"signer","writable":true,"signer":true},{"name":"state"},{"name":"vault","writable":true,"pda":{"seeds":[{"kind":"const","value":[118,97,117,108,116]},{"kind":"account","path":"state"}]}},{"name":"clock","address":"SysvarC1ock11111111111111111111111111111111"},{"name":"stake_program","address":"Stake11111111111111111111111111111111111111"}],"args":[]},{"name":"drift_cancel_orders","docs":["Cancels drift orders.","","# Parameters","- `ctx`: The context for the instruction.","- `market_type`: The type of market (spot or perp) to cancel orders for.","- `market_index`: The index of the market to cancel orders for.","- `direction`: The direction of orders to cancel (long or short).","","# Permission required","- Permission::DriftCancelOrders","","# Integration required","- Integration::Drift"],"discriminator":[98,107,48,79,97,60,99,58],"accounts":[{"name":"glam_state"},{"name":"glam_vault","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":"dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH"},{"name":"state"},{"name":"user","writable":true}],"args":[{"name":"market_type","type":{"option":{"defined":{"name":"MarketType"}}}},{"name":"market_index","type":{"option":"u16"}},{"name":"direction","type":{"option":{"defined":{"name":"PositionDirection"}}}}]},{"name":"drift_cancel_orders_by_ids","docs":["Cancels drift orders by order IDs.","","# Parameters","- `ctx`: The context for the instruction.","- `order_ids`: A list of order IDs.","","# Permission required","- Permission::DriftCancelOrders","","# Integration required","- Integration::Drift"],"discriminator":[172,99,108,14,81,89,228,183],"accounts":[{"name":"glam_state"},{"name":"glam_vault","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":"dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH"},{"name":"state"},{"name":"user","writable":true}],"args":[{"name":"order_ids","type":{"vec":"u32"}}]},{"name":"drift_delete_user","docs":["Deletes a drift user (sub account).","","# Parameters","- `ctx`: The context for the instruction.","","# Permission required","- Permission::DriftDeleteUser","","# Integration required","- Integration::Drift"],"discriminator":[179,118,20,212,145,146,49,130],"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":"dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH"},{"name":"user","writable":true},{"name":"user_stats","writable":true},{"name":"state","writable":true}],"args":[]},{"name":"drift_deposit","docs":["Deposits to drift.","","# Parameters","- `ctx`: The context for the instruction.","- `market_index`: Index of the drift spot market.","- `amount`: Amount of asset to deposit.","","# Permission required","- Permission::DriftDeposit","","# Integration required","- Integration::Drift"],"discriminator":[252,63,250,201,98,55,130,12],"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":"dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH"},{"name":"state"},{"name":"user","writable":true},{"name":"user_stats","writable":true},{"name":"spot_market_vault","writable":true},{"name":"user_token_account","writable":true},{"name":"token_program"}],"args":[{"name":"market_index","type":"u16"},{"name":"amount","type":"u64"},{"name":"reduce_only","type":"bool"}]},{"name":"drift_initialize_user","discriminator":[107,244,158,15,225,239,98,245],"accounts":[{"name":"glam_state"},{"name":"glam_vault","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":"dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH"},{"name":"user","writable":true},{"name":"user_stats","writable":true},{"name":"state","writable":true},{"name":"payer","writable":true,"signer":true},{"name":"rent","address":"SysvarRent111111111111111111111111111111111"},{"name":"system_program","address":"11111111111111111111111111111111"}],"args":[{"name":"sub_account_id","type":"u16"},{"name":"name","type":{"array":["u8",32]}}]},{"name":"drift_initialize_user_stats","docs":["Drift","Initializes a drift account owned by vault and creates a subaccount.","","# Parameters","- `ctx`: The context for the instruction.","","# Permission required","- Permission::DriftInitialize","","# Integration required","- Integration::Drift"],"discriminator":[133,185,103,162,90,161,78,143],"accounts":[{"name":"glam_state"},{"name":"glam_vault","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":"dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH"},{"name":"user_stats","writable":true},{"name":"state","writable":true},{"name":"payer","writable":true,"signer":true},{"name":"rent","address":"SysvarRent111111111111111111111111111111111"},{"name":"system_program","address":"11111111111111111111111111111111"}],"args":[]},{"name":"drift_modify_order","docs":["Modifies an existing drift order.","","# Parameters","- `ctx`: The context for the instruction.","- `order_id`: The ID of the order to modify.","- `modify_order_params`: The parameters to modify the order with.","","# Permission required","- Permission::DriftModifyOrder","","# Integration required","- Integration::Drift"],"discriminator":[235,245,222,58,245,128,19,202],"accounts":[{"name":"glam_state"},{"name":"glam_vault","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":"dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH"},{"name":"state"},{"name":"user","writable":true}],"args":[{"name":"order_id","type":{"option":"u32"}},{"name":"modify_order_params","type":{"defined":{"name":"ModifyOrderParams"}}}]},{"name":"drift_place_orders","docs":["Places orders on drift.","","# Parameters","- `ctx`: The context for the instruction.","- `params`: A list of orders.","","# Permissions required","- Permission::DriftPlaceOrders","- Additional permission Permission::DriftSpotMarket or Permission::DriftPerpMarket is required depending on market type.","","# Integration required","- Integration::Drift"],"discriminator":[117,18,210,6,238,174,135,167],"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":"dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH"},{"name":"state"},{"name":"user","writable":true}],"args":[{"name":"params","type":{"vec":{"defined":{"name":"OrderParams"}}}}]},{"name":"drift_update_user_custom_margin_ratio","docs":["Updates custom margin ratio.","","# Parameters","- `ctx`: The context for the instruction.","- `sub_account_id`: Sub account.","- `margin_ratio`: Margin ratio.","","# Permission required","- Permission::DriftUpdateUser","","# Integration required","- Integration::Drift"],"discriminator":[4,47,193,177,128,62,228,14],"accounts":[{"name":"glam_state"},{"name":"glam_vault","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":"dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH"},{"name":"user","writable":true}],"args":[{"name":"sub_account_id","type":"u16"},{"name":"margin_ratio","type":"u32"}]},{"name":"drift_update_user_delegate","docs":["Sets a delegate on the specified sub account.","","# Parameters","- `ctx`: The context for the instruction.","- `sub_account_id`: Sub account.","- `delegate`: Delegate\'s wallet address.","","# Permission required","- Permission::DriftUpdateUser","","# Integration required","- Integration::Drift"],"discriminator":[36,181,34,31,22,77,36,154],"accounts":[{"name":"glam_state"},{"name":"glam_vault","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":"dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH"},{"name":"user","writable":true}],"args":[{"name":"sub_account_id","type":"u16"},{"name":"delegate","type":"pubkey"}]},{"name":"drift_update_user_margin_trading_enabled","docs":["Enables/Disables margin trading.","","# Parameters","- `ctx`: The context for the instruction.","- `sub_account_id`: Sub account.","- `margin_trading_enabled`: Whether to enable or disable margin trading.","","# Permission required","- Permission::DriftUpdateUser","","# Integration required","- Integration::Drift"],"discriminator":[157,175,12,19,202,114,17,36],"accounts":[{"name":"glam_state"},{"name":"glam_vault","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":"dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH"},{"name":"user","writable":true}],"args":[{"name":"sub_account_id","type":"u16"},{"name":"margin_trading_enabled","type":"bool"}]},{"name":"drift_withdraw","docs":["Withdraws from drift.","","# Parameters","- `ctx`: The context for the instruction.","- `market_index`: Index of the drift spot market.","- `amount`: Amount to withdraw.","","# Permission required","- Permission::DriftWithdraw","","# Integration required","- Integration::Drift"],"discriminator":[86,59,186,123,183,181,234,137],"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":"dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH"},{"name":"state"},{"name":"user","writable":true},{"name":"user_stats","writable":true},{"name":"spot_market_vault","writable":true},{"name":"drift_signer"},{"name":"user_token_account","writable":true},{"name":"token_program"}],"args":[{"name":"market_index","type":"u16"},{"name":"amount","type":"u64"},{"name":"reduce_only","type":"bool"}]},{"name":"force_transfer_tokens","docs":["Forcefully transfers a specified amount of tokens from one account to another.","","# Parameters","- `ctx`: The context for the instruction.","- `mint_id`: The id of the mint to transfer tokens for.","- `amount`: The amount of tokens to transfer.","","# Permission required","- Permission::ForceTransferTokens","","# Integration required","- Integration::Mint"],"discriminator":[185,34,78,211,192,13,160,37],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_mint","writable":true},{"name":"from_ata","writable":true,"pda":{"seeds":[{"kind":"account","path":"from"},{"kind":"account","path":"token_2022_program"},{"kind":"account","path":"glam_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":"to_ata","writable":true,"pda":{"seeds":[{"kind":"account","path":"to"},{"kind":"account","path":"token_2022_program"},{"kind":"account","path":"glam_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":"from"},{"name":"to"},{"name":"signer","writable":true,"signer":true},{"name":"token_2022_program","address":"TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"}],"args":[{"name":"mint_id","type":"u8"},{"name":"amount","type":"u64"}]},{"name":"initialize_and_delegate_stake","docs":["Initializes a stake account and delegates it to a validator.","","# Parameters","- `ctx`: The context for the instruction.","- `lamports`: The amount of SOL to initialize the stake account with.","","# Permission required","- Permission::Stake","","# Integration required","- Integration::NativeStaking"],"discriminator":[71,101,230,157,50,23,47,1],"accounts":[{"name":"signer","writable":true,"signer":true},{"name":"state","writable":true},{"name":"vault","writable":true,"pda":{"seeds":[{"kind":"const","value":[118,97,117,108,116]},{"kind":"account","path":"state"}]}},{"name":"vault_stake_account","writable":true},{"name":"vote"},{"name":"stake_config"},{"name":"clock","address":"SysvarC1ock11111111111111111111111111111111"},{"name":"rent","address":"SysvarRent111111111111111111111111111111111"},{"name":"stake_history","address":"SysvarStakeHistory1111111111111111111111111"},{"name":"stake_program","address":"Stake11111111111111111111111111111111111111"},{"name":"system_program","address":"11111111111111111111111111111111"}],"args":[{"name":"lamports","type":"u64"}]},{"name":"initialize_state","docs":["State","Initializes a state account from the provided StateModel instance.","","# Parameters","- `ctx`: The context for the instruction.","- `state`: An instance of `StateModel` containing the details of the state to be initialized.","","# Permission required","- Owner only, delegates not allowed"],"discriminator":[190,171,224,219,217,72,199,176],"accounts":[{"name":"state","writable":true,"pda":{"seeds":[{"kind":"const","value":[115,116,97,116,101]},{"kind":"account","path":"signer"},{"kind":"arg","path":"state_model.created"}]}},{"name":"vault","writable":true,"pda":{"seeds":[{"kind":"const","value":[118,97,117,108,116]},{"kind":"account","path":"state"}]}},{"name":"signer","writable":true,"signer":true},{"name":"openfunds_metadata","writable":true,"optional":true,"pda":{"seeds":[{"kind":"const","value":[109,101,116,97,100,97,116,97]},{"kind":"account","path":"state"}]}},{"name":"system_program","address":"11111111111111111111111111111111"}],"args":[{"name":"state","type":{"defined":{"name":"StateModel"}}}]},{"name":"jupiter_gov_new_vote","docs":["Creates a new vote.","","# Parameters","- `ctx`: The context for the instruction.","","# Permission required","- Permission::VoteOnProposal","","# Integration required","- Integration::JupiterVote"],"discriminator":[235,179,170,64,64,57,17,69],"accounts":[{"name":"glam_state"},{"name":"glam_vault","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":"GovaE4iu227srtG2s3tZzB4RmWBzw8sTwrCLZz7kN7rY"},{"name":"proposal"},{"name":"vote","writable":true},{"name":"payer","writable":true,"signer":true},{"name":"system_program","address":"11111111111111111111111111111111"}],"args":[{"name":"voter","type":"pubkey"}]},{"name":"jupiter_set_max_swap_slippage","docs":["Sets the max swap slippage.","","# Parameters","- `ctx`: The context for the instruction.","- `slippage`: The maximum allowed slippage in basis points.","","# Permission required","- Owner only, delegates not allowed"],"discriminator":[110,79,13,71,208,111,56,66],"accounts":[{"name":"state","writable":true},{"name":"signer","writable":true,"signer":true}],"args":[{"name":"slippage","type":"u64"}]},{"name":"jupiter_swap","docs":["Swaps assets using Jupiter.","","# Parameters","- `ctx`: The context for the instruction.","- `amount`: The amount of input asset to swap.","- `data`: The serialized Jupiter route data containing swap instructions and parameters.","","# Permission required","- Any of","- Permission::JupiterSwapAny: no restrictions.","- Permission::JupiterSwapAllowlisted: input and output are in the assets allowlist.","- Permission::JupiterSwapLst: input and output assets are both LST.","","# Integration required","- Integration::JupiterSwap"],"discriminator":[116,207,0,196,252,120,243,18],"accounts":[{"name":"state","writable":true},{"name":"vault","writable":true,"pda":{"seeds":[{"kind":"const","value":[118,97,117,108,116]},{"kind":"account","path":"state"}]}},{"name":"input_vault_ata","writable":true,"pda":{"seeds":[{"kind":"account","path":"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":"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":"signer","writable":true,"signer":true},{"name":"input_stake_pool","optional":true},{"name":"output_stake_pool","optional":true},{"name":"jupiter_program","address":"JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4"},{"name":"associated_token_program","address":"ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"},{"name":"input_token_program"},{"name":"output_token_program"}],"args":[{"name":"amount","type":"u64"},{"name":"data","type":"bytes"}]},{"name":"jupiter_vote_cast_vote","docs":["Casts a vote.","","# Parameters","- `ctx`: The context for the instruction.","- `side`: The side to vote for.","","# Permission required","- Permission::VoteOnProposal","","# Integration required","- Integration::JupiterVote"],"discriminator":[11,197,234,57,164,74,181,239],"accounts":[{"name":"glam_state"},{"name":"glam_vault","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":"voTpe3tHQ7AjQHMapgSue2HJFAh2cGsdokqN3XqmVSj"},{"name":"locker"},{"name":"escrow"},{"name":"proposal","writable":true},{"name":"vote","writable":true},{"name":"governor"},{"name":"govern_program"}],"args":[{"name":"side","type":"u8"}]},{"name":"jupiter_vote_cast_vote_checked","docs":["Casts a vote, only if expected_side is already recorded.","","# Parameters","- `ctx`: The context for the instruction.","- `side`: The side to vote for.","- `expected_side`: The expected side to check in the Vote account.","","# Permission required","- Permission::VoteOnProposal","","# Integration required","- Integration::JupiterVote"],"discriminator":[247,3,146,233,35,189,192,187],"accounts":[{"name":"glam_state"},{"name":"glam_vault","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":"voTpe3tHQ7AjQHMapgSue2HJFAh2cGsdokqN3XqmVSj"},{"name":"locker"},{"name":"escrow"},{"name":"proposal","writable":true},{"name":"vote","writable":true},{"name":"governor"},{"name":"govern_program"}],"args":[{"name":"side","type":"u8"},{"name":"expected_side","type":"u8"}]},{"name":"jupiter_vote_increase_locked_amount","docs":["Increases the locked amount (aka stakes JUP).","","# Parameters","- `ctx`: The context for the instruction.","- `amount`: The amount of JUP to stake.","","# Permission required","- Permission::StakeJup","","# Integration required","- Integration::JupiterVote"],"discriminator":[225,38,201,123,148,23,47,128],"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":"voTpe3tHQ7AjQHMapgSue2HJFAh2cGsdokqN3XqmVSj"},{"name":"locker","writable":true},{"name":"escrow","writable":true},{"name":"escrow_tokens","writable":true},{"name":"source_tokens","writable":true},{"name":"token_program"}],"args":[{"name":"amount","type":"u64"}]},{"name":"jupiter_vote_merge_partial_unstaking","docs":["Merges partial unstaking.","","# Parameters","- `ctx`: The context for the instruction.","","# Permission required","- Permission::UnstakeJup","","# Integration required","- Integration::JupiterVote"],"discriminator":[93,226,122,120,130,35,189,208],"accounts":[{"name":"glam_state"},{"name":"glam_vault","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":"voTpe3tHQ7AjQHMapgSue2HJFAh2cGsdokqN3XqmVSj"},{"name":"locker","writable":true},{"name":"escrow","writable":true},{"name":"partial_unstake","writable":true}],"args":[]},{"name":"jupiter_vote_new_escrow","docs":["Initializes a locked voter escrow.","","# Parameters","- `ctx`: The context for the instruction.","","# Permission required","- Permission::StakeJup","","# Integration required","- Integration::JupiterVote"],"discriminator":[255,87,157,219,61,178,144,159],"accounts":[{"name":"glam_state"},{"name":"glam_vault","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":"voTpe3tHQ7AjQHMapgSue2HJFAh2cGsdokqN3XqmVSj"},{"name":"locker","writable":true},{"name":"escrow","writable":true},{"name":"payer","writable":true,"signer":true},{"name":"system_program","address":"11111111111111111111111111111111"}],"args":[]},{"name":"jupiter_vote_open_partial_unstaking","docs":["Partially unstakes JUP.","","# Parameters","- `ctx`: The context for the instruction.","- `amount`: The amount of JUP to partially unstake.","- `memo`: The memo for the partial unstaking.","","# Permission required","- Permission::UnstakeJup","","# Integration required","- Integration::JupiterVote"],"discriminator":[84,7,113,220,212,63,237,218],"accounts":[{"name":"glam_state"},{"name":"glam_vault","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":"voTpe3tHQ7AjQHMapgSue2HJFAh2cGsdokqN3XqmVSj"},{"name":"locker","writable":true},{"name":"escrow","writable":true},{"name":"partial_unstake","writable":true,"signer":true},{"name":"system_program","address":"11111111111111111111111111111111"}],"args":[{"name":"amount","type":"u64"},{"name":"memo","type":"string"}]},{"name":"jupiter_vote_toggle_max_lock","docs":["Toggles max lock.","","# Parameters","- `ctx`: The context for the instruction.","- `is_max_lock`: true to allow staking, false to initiate full unstaking.","","# Permission required","- Permission::StakeJup (if is_max_lock == true)","- Permission::UnstakeJup (if is_max_lock == false)","","# Integration required","- Integration::JupiterVote"],"discriminator":[204,158,192,21,219,25,154,87],"accounts":[{"name":"glam_state"},{"name":"glam_vault","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":"voTpe3tHQ7AjQHMapgSue2HJFAh2cGsdokqN3XqmVSj"},{"name":"locker"},{"name":"escrow","writable":true}],"args":[{"name":"is_max_lock","type":"bool"}]},{"name":"jupiter_vote_withdraw","docs":["Withdraws all unstaked JUP.","","# Parameters","- `ctx`: The context for the instruction.","","# Permission required","- Permission::UnstakeJup","","# Integration required","- Integration::JupiterVote"],"discriminator":[195,172,184,195,23,178,145,191],"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":"voTpe3tHQ7AjQHMapgSue2HJFAh2cGsdokqN3XqmVSj"},{"name":"locker","writable":true},{"name":"escrow","writable":true},{"name":"escrow_tokens","writable":true},{"name":"destination_tokens","writable":true},{"name":"token_program"}],"args":[]},{"name":"jupiter_vote_withdraw_partial_unstaking","docs":["Withdraws JUP from partial unstaking.","","# Parameters","- `ctx`: The context for the instruction.","","# Permission required","- Permission::UnstakeJup","","# Integration required","- Integration::JupiterVote"],"discriminator":[109,98,65,252,184,0,216,240],"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":"voTpe3tHQ7AjQHMapgSue2HJFAh2cGsdokqN3XqmVSj"},{"name":"locker","writable":true},{"name":"escrow","writable":true},{"name":"partial_unstake","writable":true},{"name":"escrow_tokens","writable":true},{"name":"destination_tokens","writable":true},{"name":"token_program"}],"args":[]},{"name":"kamino_lending_deposit_reserve_liquidity_and_obligation_collateral","discriminator":[31,162,4,146,60,225,15,0],"accounts":[{"name":"glam_state"},{"name":"glam_vault","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":"owner","writable":true},{"name":"obligation","writable":true},{"name":"lending_market"},{"name":"lending_market_authority"},{"name":"reserve","writable":true},{"name":"reserve_liquidity_mint","writable":true},{"name":"reserve_liquidity_supply","writable":true},{"name":"reserve_collateral_mint","writable":true},{"name":"reserve_destination_deposit_collateral","writable":true},{"name":"user_source_liquidity","writable":true},{"name":"placeholder_user_destination_collateral"},{"name":"collateral_token_program"},{"name":"liquidity_token_program"},{"name":"instruction_sysvar_account"}],"args":[{"name":"liquidity_amount","type":"u64"}]},{"name":"kamino_lending_init_obligation","discriminator":[219,210,134,64,155,49,137,174],"accounts":[{"name":"glam_state"},{"name":"glam_vault","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":"obligation_owner"},{"name":"fee_payer","writable":true,"signer":true},{"name":"obligation","writable":true},{"name":"lending_market"},{"name":"seed1_account"},{"name":"seed2_account"},{"name":"owner_user_metadata"},{"name":"rent","address":"SysvarRent111111111111111111111111111111111"},{"name":"system_program","address":"11111111111111111111111111111111"}],"args":[{"name":"args","type":{"defined":{"name":"InitObligationArgs"}}}]},{"name":"kamino_lending_init_obligation_farms_for_reserve","discriminator":[227,61,130,2,117,226,78,1],"accounts":[{"name":"glam_state"},{"name":"glam_vault","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":"payer","writable":true,"signer":true},{"name":"owner"},{"name":"obligation","writable":true},{"name":"lending_market_authority","writable":true},{"name":"reserve","writable":true},{"name":"reserve_farm_state","writable":true},{"name":"obligation_farm","writable":true},{"name":"lending_market"},{"name":"farms_program"},{"name":"rent","address":"SysvarRent111111111111111111111111111111111"},{"name":"system_program","address":"11111111111111111111111111111111"}],"args":[{"name":"mode","type":"u8"}]},{"name":"kamino_lending_init_user_metadata","discriminator":[200,95,140,132,190,65,17,161],"accounts":[{"name":"glam_state"},{"name":"glam_vault","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":"owner"},{"name":"fee_payer","writable":true,"signer":true},{"name":"user_metadata","writable":true},{"name":"referrer_user_metadata"},{"name":"rent","address":"SysvarRent111111111111111111111111111111111"},{"name":"system_program","address":"11111111111111111111111111111111"}],"args":[{"name":"user_lookup_table","type":"pubkey"}]},{"name":"marinade_claim_tickets","docs":["Claims tickets that were unstaked in the previous epoch to get SOL.","","# Parameters","- `ctx`: The context for the instruction.","","# Permission required","- Permission::Unstake","","# Integration required","- Integration::Marinade"],"discriminator":[14,146,182,30,205,47,134,189],"accounts":[{"name":"signer","writable":true,"signer":true},{"name":"state","writable":true},{"name":"vault","writable":true,"pda":{"seeds":[{"kind":"const","value":[118,97,117,108,116]},{"kind":"account","path":"state"}]}},{"name":"marinade_state","writable":true},{"name":"reserve_pda","writable":true},{"name":"rent","address":"SysvarRent111111111111111111111111111111111"},{"name":"clock","address":"SysvarC1ock11111111111111111111111111111111"},{"name":"system_program","address":"11111111111111111111111111111111"},{"name":"token_program","address":"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"},{"name":"marinade_program","address":"MarBmsSgKXdrN1egZf5sqe1TMai9K1rChYNDJgjq7aD"}],"args":[]},{"name":"marinade_delayed_unstake","docs":["Unstakes mSOL to get a ticket that can be claimed at the next epoch.","","# Parameters","- `ctx`: The context for the instruction.","- `msol_amount`: Amount of mSOL to unstake.","","# Permission required","- Permission::Unstake","","# Integration required","- Integration::Marinade"],"discriminator":[117,66,3,222,230,94,129,95],"accounts":[{"name":"signer","writable":true,"signer":true},{"name":"state","writable":true},{"name":"vault","writable":true,"pda":{"seeds":[{"kind":"const","value":[118,97,117,108,116]},{"kind":"account","path":"state"}]}},{"name":"ticket","writable":true},{"name":"msol_mint","writable":true},{"name":"burn_msol_from","writable":true},{"name":"marinade_state","writable":true},{"name":"reserve_pda","writable":true},{"name":"rent","address":"SysvarRent111111111111111111111111111111111"},{"name":"clock","address":"SysvarC1ock11111111111111111111111111111111"},{"name":"system_program","address":"11111111111111111111111111111111"},{"name":"token_program","address":"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"},{"name":"marinade_program","address":"MarBmsSgKXdrN1egZf5sqe1TMai9K1rChYNDJgjq7aD"}],"args":[{"name":"msol_amount","type":"u64"}]},{"name":"marinade_deposit_sol","docs":["Marinade","Deposits SOL to get mSOL.","","# Parameters","- `ctx`: The context for the instruction.","- `lamports`: The amount of SOL to deposit.","","# Permission required","- Permission::Stake","","# Integration required","- Integration::Marinade"],"discriminator":[64,140,200,40,56,218,181,68],"accounts":[{"name":"signer","writable":true,"signer":true},{"name":"state"},{"name":"vault","writable":true,"pda":{"seeds":[{"kind":"const","value":[118,97,117,108,116]},{"kind":"account","path":"state"}]}},{"name":"marinade_state","writable":true},{"name":"reserve_pda","writable":true},{"name":"msol_mint","writable":true},{"name":"msol_mint_authority","writable":true},{"name":"liq_pool_msol_leg","writable":true},{"name":"liq_pool_msol_leg_authority","writable":true},{"name":"liq_pool_sol_leg_pda","writable":true},{"name":"mint_to","writable":true,"pda":{"seeds":[{"kind":"account","path":"vault"},{"kind":"const","value":[6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169]},{"kind":"account","path":"msol_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":"marinade_program","address":"MarBmsSgKXdrN1egZf5sqe1TMai9K1rChYNDJgjq7aD"},{"name":"associated_token_program","address":"ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"},{"name":"system_program","address":"11111111111111111111111111111111"},{"name":"token_program","address":"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"}],"args":[{"name":"lamports","type":"u64"}]},{"name":"marinade_deposit_stake","docs":["Deposits a stake account to get mSOL.","","# Parameters","- `ctx`: The context for the instruction.","- `validator_idx`: Validator index.","","# Permission required","- Permission::Stake","","# Integration required","- Integration::Marinade"],"discriminator":[69,207,194,211,186,55,199,130],"accounts":[{"name":"signer","writable":true,"signer":true},{"name":"state"},{"name":"vault","writable":true,"pda":{"seeds":[{"kind":"const","value":[118,97,117,108,116]},{"kind":"account","path":"state"}]}},{"name":"marinade_state","writable":true},{"name":"validator_list","writable":true},{"name":"stake_list","writable":true},{"name":"vault_stake_account","writable":true},{"name":"duplication_flag","writable":true},{"name":"msol_mint","writable":true},{"name":"msol_mint_authority"},{"name":"mint_to","writable":true,"pda":{"seeds":[{"kind":"account","path":"vault"},{"kind":"const","value":[6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169]},{"kind":"account","path":"msol_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":"clock","address":"SysvarC1ock11111111111111111111111111111111"},{"name":"rent","address":"SysvarRent111111111111111111111111111111111"},{"name":"marinade_program","address":"MarBmsSgKXdrN1egZf5sqe1TMai9K1rChYNDJgjq7aD"},{"name":"associated_token_program","address":"ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"},{"name":"system_program","address":"11111111111111111111111111111111"},{"name":"token_program","address":"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"},{"name":"stake_program","address":"Stake11111111111111111111111111111111111111"}],"args":[{"name":"validator_idx","type":"u32"}]},{"name":"marinade_liquid_unstake","docs":["Unstakes mSOL to get SOL immediately.","","# Parameters","- `ctx`: The context for the instruction.","- `msol_amount`: Amount of mSOL to unstake.","","# Permission required","- Permission::LiquidUnstake","","# Integration required","- Integration::Marinade"],"discriminator":[29,146,34,21,26,68,141,161],"accounts":[{"name":"signer","writable":true,"signer":true},{"name":"state"},{"name":"vault","writable":true,"pda":{"seeds":[{"kind":"const","value":[118,97,117,108,116]},{"kind":"account","path":"state"}]}},{"name":"marinade_state","writable":true},{"name":"msol_mint","writable":true},{"name":"liq_pool_sol_leg_pda","writable":true},{"name":"liq_pool_msol_leg","writable":true},{"name":"treasury_msol_account","writable":true},{"name":"get_msol_from","writable":true},{"name":"get_msol_from_authority","writable":true},{"name":"marinade_program","address":"MarBmsSgKXdrN1egZf5sqe1TMai9K1rChYNDJgjq7aD"},{"name":"token_program","address":"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"},{"name":"system_program","address":"11111111111111111111111111111111"}],"args":[{"name":"msol_amount","type":"u64"}]},{"name":"merge_stake_accounts","docs":["Merges two stake accounts.","","# Parameters","- `ctx`: The context for the instruction.","","# Permission required","- Permission::Stake","","# Integration required","- Integration::NativeStaking"],"discriminator":[173,206,10,246,109,50,244,110],"accounts":[{"name":"signer","writable":true,"signer":true},{"name":"state","writable":true},{"name":"vault","writable":true,"pda":{"seeds":[{"kind":"const","value":[118,97,117,108,116]},{"kind":"account","path":"state"}]}},{"name":"to_stake","writable":true},{"name":"from_stake","writable":true},{"name":"clock","address":"SysvarC1ock11111111111111111111111111111111"},{"name":"stake_history","address":"SysvarStakeHistory1111111111111111111111111"},{"name":"stake_program","address":"Stake11111111111111111111111111111111111111"},{"name":"system_program","address":"11111111111111111111111111111111"}],"args":[]},{"name":"mint_tokens","docs":["Mints a specified amount of tokens for the given mint.","","# Parameters","- `ctx`: The context for the instruction.","- `mint_id`: The id of the mint to mint tokens for.","- `amount`: The amount of tokens to mint.","","# Permission required","- Permission::MintTokens","","# Integration required","- Integration::Mint"],"discriminator":[59,132,24,246,122,39,8,243],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_mint","writable":true},{"name":"signer","writable":true,"signer":true},{"name":"mint_to","writable":true,"pda":{"seeds":[{"kind":"account","path":"recipient"},{"kind":"account","path":"token_2022_program"},{"kind":"account","path":"glam_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":"recipient"},{"name":"token_2022_program","address":"TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"}],"args":[{"name":"mint_id","type":"u8"},{"name":"amount","type":"u64"}]},{"name":"redeem","docs":["Redeems a specified amount of shares.","","# Parameters","- `ctx`: The context for the instruction.","- `amount`: The amount of shares to redeem.","- `in_kind`: Whether to redeem in kind.","- `skip_state`: Should always be true (state check to be implemented)."],"discriminator":[184,12,86,149,70,196,97,225],"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":"signer","writable":true,"signer":true},{"name":"signer_share_ata","writable":true},{"name":"signer_policy","writable":true,"optional":true,"pda":{"seeds":[{"kind":"const","value":[97,99,99,111,117,110,116,45,112,111,108,105,99,121]},{"kind":"account","path":"signer_share_ata"}]}},{"name":"system_program","address":"11111111111111111111111111111111"},{"name":"token_program","address":"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"},{"name":"token_2022_program","address":"TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"}],"args":[{"name":"amount","type":"u64"},{"name":"in_kind","type":"bool"},{"name":"skip_state","type":"bool"}]},{"name":"redelegate_stake","docs":["Redelegates an existing stake account to a new validator (a new stake account will be created).","","# Parameters","- `ctx`: The context for the instruction.","","# Permission required","- Permission::Unstake","","# Integration required","- Integration::NativeStaking"],"discriminator":[240,90,140,104,96,8,134,31],"accounts":[{"name":"signer","writable":true,"signer":true},{"name":"state","writable":true},{"name":"vault","writable":true,"pda":{"seeds":[{"kind":"const","value":[118,97,117,108,116]},{"kind":"account","path":"state"}]}},{"name":"existing_stake","writable":true},{"name":"new_stake","writable":true},{"name":"vote"},{"name":"stake_config"},{"name":"clock","address":"SysvarC1ock11111111111111111111111111111111"},{"name":"stake_program","address":"Stake11111111111111111111111111111111111111"},{"name":"system_program","address":"11111111111111111111111111111111"}],"args":[]},{"name":"set_subscribe_redeem_enabled","docs":["Enables or disables the subscribe and redeem functionality.","","This allows the owner to pause/unpause subscription and redemption of a fund.","","# Parameters","- `ctx`: The context for the instruction.","- `enabled`: A boolean indicating whether to enable or disable the subscribe and redeem functionality.","","# Permission required","- Owner only, delegates not allowed"],"discriminator":[189,56,205,172,201,185,34,92],"accounts":[{"name":"state","writable":true},{"name":"signer","writable":true,"signer":true}],"args":[{"name":"enabled","type":"bool"}]},{"name":"set_token_accounts_states","docs":["Sets the frozen state of the token accounts for the specified mint.","","# Parameters","- `ctx`: The context for the instruction.","- `mint_id`: The id of the mint to set the frozen state for.","- `frozen`: The new frozen state.","","# Permission required","- Permission::SetTokenAccountState","","# Integration required","- Integration::Mint"],"discriminator":[50,133,45,86,117,66,115,195],"accounts":[{"name":"glam_state"},{"name":"glam_mint","writable":true},{"name":"signer","writable":true,"signer":true},{"name":"token_2022_program","address":"TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"}],"args":[{"name":"mint_id","type":"u8"},{"name":"frozen","type":"bool"}]},{"name":"split_stake_account","docs":["Splits from an existing stake account to get a new stake account.","","# Parameters","- `ctx`: The context for the instruction.","- `lamports`: The amount of SOL to split.","","# Permission required","- Permission::Unstake","","# Integration required","- Integration::NativeStaking"],"discriminator":[130,42,33,89,117,77,105,194],"accounts":[{"name":"signer","writable":true,"signer":true},{"name":"state","writable":true},{"name":"vault","writable":true,"pda":{"seeds":[{"kind":"const","value":[118,97,117,108,116]},{"kind":"account","path":"state"}]}},{"name":"existing_stake","writable":true},{"name":"new_stake","writable":true},{"name":"clock","address":"SysvarC1ock11111111111111111111111111111111"},{"name":"stake_program","address":"Stake11111111111111111111111111111111111111"},{"name":"system_program","address":"11111111111111111111111111111111"}],"args":[{"name":"lamports","type":"u64"}]},{"name":"stake_pool_deposit_sol","docs":["Deposits SOL to a stake pool to get pool token.","","# Parameters","- `ctx`: The context for the instruction.","- `lamports`: The amount of SOL to deposit.","","# Permission required","- Permission::Stake","","# Integration required","- Integration::SplStakePool or Integration::SanctumStakePool, depending on the stake pool program used."],"discriminator":[147,187,91,151,158,187,247,79],"accounts":[{"name":"signer","writable":true,"signer":true},{"name":"state"},{"name":"vault","writable":true,"pda":{"seeds":[{"kind":"const","value":[118,97,117,108,116]},{"kind":"account","path":"state"}]}},{"name":"stake_pool","writable":true},{"name":"withdraw_authority"},{"name":"reserve_stake","writable":true},{"name":"pool_mint","writable":true},{"name":"fee_account","writable":true},{"name":"mint_to","writable":true,"pda":{"seeds":[{"kind":"account","path":"vault"},{"kind":"const","value":[6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169]},{"kind":"account","path":"pool_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":"stake_pool_program"},{"name":"associated_token_program","address":"ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"},{"name":"system_program","address":"11111111111111111111111111111111"},{"name":"token_program"}],"args":[{"name":"lamports","type":"u64"}]},{"name":"stake_pool_deposit_stake","docs":["Deposits a stake account to a stake pool to get pool token.","","# Parameters","- `ctx`: The context for the instruction.","","# Permission required","- Permission::Stake","","# Integration required","- Integration::SplStakePool or Integration::SanctumStakePool, depending on the stake pool program used."],"discriminator":[212,158,195,174,179,105,9,97],"accounts":[{"name":"signer","writable":true,"signer":true},{"name":"state","writable":true},{"name":"vault","writable":true,"pda":{"seeds":[{"kind":"const","value":[118,97,117,108,116]},{"kind":"account","path":"state"}]}},{"name":"vault_stake_account","writable":true},{"name":"mint_to","writable":true,"pda":{"seeds":[{"kind":"account","path":"vault"},{"kind":"const","value":[6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169]},{"kind":"account","path":"pool_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":"pool_mint","writable":true},{"name":"fee_account","writable":true},{"name":"stake_pool","writable":true},{"name":"deposit_authority"},{"name":"withdraw_authority"},{"name":"validator_list","writable":true},{"name":"validator_stake_account","writable":true},{"name":"reserve_stake_account","writable":true},{"name":"clock","address":"SysvarC1ock11111111111111111111111111111111"},{"name":"stake_history","address":"SysvarStakeHistory1111111111111111111111111"},{"name":"stake_pool_program"},{"name":"associated_token_program","address":"ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"},{"name":"system_program","address":"11111111111111111111111111111111"},{"name":"token_program"},{"name":"stake_program","address":"Stake11111111111111111111111111111111111111"}],"args":[]},{"name":"stake_pool_withdraw_sol","docs":["Unstakes from pool token to get SOL immediately.","","# Parameters","- `ctx`: The context for the instruction.","- `pool_token_amount`: Amount of pool token to unstake.","","# Permission required","- Permission::LiquidUnstake","","# Integration required","- Integration::SplStakePool or Integration::SanctumStakePool, depending on the stake pool program used."],"discriminator":[179,100,204,0,192,46,233,181],"accounts":[{"name":"signer","writable":true,"signer":true},{"name":"state"},{"name":"vault","writable":true,"pda":{"seeds":[{"kind":"const","value":[118,97,117,108,116]},{"kind":"account","path":"state"}]}},{"name":"stake_pool","writable":true},{"name":"withdraw_authority"},{"name":"reserve_stake","writable":true},{"name":"pool_mint","writable":true},{"name":"fee_account","writable":true},{"name":"pool_token_ata","writable":true},{"name":"clock","address":"SysvarC1ock11111111111111111111111111111111"},{"name":"stake_history","address":"SysvarStakeHistory1111111111111111111111111"},{"name":"stake_pool_program"},{"name":"system_program","address":"11111111111111111111111111111111"},{"name":"token_program"},{"name":"stake_program","address":"Stake11111111111111111111111111111111111111"}],"args":[{"name":"pool_token_amount","type":"u64"}]},{"name":"stake_pool_withdraw_stake","docs":["Unstakes from pool token into a stake account.","","# Parameters","- `ctx`: The context for the instruction.","- `pool_token_amount`: Amount of pool token to unstake.","","# Permission required","- Permission::Unstake","","# Integration required","- Integration::SplStakePool or Integration::SanctumStakePool, depending on the stake pool program used."],"discriminator":[7,70,250,22,49,1,143,1],"accounts":[{"name":"signer","writable":true,"signer":true},{"name":"state","writable":true},{"name":"vault","writable":true,"pda":{"seeds":[{"kind":"const","value":[118,97,117,108,116]},{"kind":"account","path":"state"}]}},{"name":"vault_stake_account","writable":true},{"name":"pool_mint","writable":true},{"name":"fee_account","writable":true},{"name":"stake_pool","writable":true},{"name":"withdraw_authority"},{"name":"validator_list","writable":true},{"name":"validator_stake_account","writable":true},{"name":"pool_token_ata","writable":true},{"name":"clock","address":"SysvarC1ock11111111111111111111111111111111"},{"name":"stake_pool_program"},{"name":"system_program","address":"11111111111111111111111111111111"},{"name":"token_program"},{"name":"stake_program","address":"Stake11111111111111111111111111111111111111"}],"args":[{"name":"pool_token_amount","type":"u64"}]},{"name":"subscribe","docs":["Investor","Subscribes to a specified amount of shares.","","# Parameters","- `ctx`: The context for the instruction.","- `amount`: The amount of shares to subscribe.","- `skip_state`: Should always be true (state check to be implemented)."],"discriminator":[254,28,191,138,156,179,183,53],"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":"signer_share_ata","writable":true,"pda":{"seeds":[{"kind":"account","path":"signer"},{"kind":"account","path":"token_2022_program"},{"kind":"account","path":"glam_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":"asset"},{"name":"vault_ata","writable":true},{"name":"signer_asset_ata","writable":true},{"name":"signer_policy","writable":true,"optional":true,"pda":{"seeds":[{"kind":"const","value":[97,99,99,111,117,110,116,45,112,111,108,105,99,121]},{"kind":"account","path":"signer_share_ata"}]}},{"name":"signer","writable":true,"signer":true},{"name":"system_program","address":"11111111111111111111111111111111"},{"name":"associated_token_program","address":"ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"},{"name":"token_program","address":"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"},{"name":"token_2022_program","address":"TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"}],"args":[{"name":"mint_id","type":"u8"},{"name":"amount","type":"u64"},{"name":"skip_state","type":"bool"}]},{"name":"transfer_hook","discriminator":[105,37,101,197,75,251,102,26],"accounts":[{"name":"src_account"},{"name":"mint"},{"name":"dst_account"},{"name":"owner"},{"name":"extra_account_meta_list","pda":{"seeds":[{"kind":"const","value":[101,120,116,114,97,45,97,99,99,111,117,110,116,45,109,101,116,97,115]},{"kind":"account","path":"mint"}]}},{"name":"state"},{"name":"src_account_policy","pda":{"seeds":[{"kind":"const","value":[97,99,99,111,117,110,116,45,112,111,108,105,99,121]},{"kind":"account","path":"src_account"}]}},{"name":"dst_account_policy","pda":{"seeds":[{"kind":"const","value":[97,99,99,111,117,110,116,45,112,111,108,105,99,121]},{"kind":"account","path":"dst_account"}]}}],"args":[{"name":"amount","type":"u64"}]},{"name":"update_mint","docs":["Updates an existing mint with new metadata.","","# Parameters","- `ctx`: The context for the instruction.","- `mint_id`: The id of the mint to be updated.","- `mint_model`: An instance of `MintModel` containing the updated metadata for the new mint.","","# Permission required","- Owner only, delegates not allowed"],"discriminator":[212,203,57,78,75,245,222,5],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_mint","writable":true},{"name":"signer","writable":true,"signer":true},{"name":"token_2022_program","address":"TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"}],"args":[{"name":"mint_id","type":"u8"},{"name":"mint_model","type":{"defined":{"name":"MintModel"}}}]},{"name":"update_state","docs":["Updates an existing state account with new parameters.","","# Parameters","- `ctx`: The context for the instruction.","- `state`: An instance of `StateModel` containing the updated details of the state.","","# Permission required","- Owner only, delegates not allowed"],"discriminator":[135,112,215,75,247,185,53,176],"accounts":[{"name":"state","writable":true},{"name":"signer","writable":true,"signer":true}],"args":[{"name":"state","type":{"defined":{"name":"StateModel"}}}]},{"name":"withdraw","docs":["Withdraw asset from vault into owner\'s wallet.","","# Parameters","- `ctx`: The context for the instruction.","- `amount`: The amount to withdraw.","","# Permission required","- Owner only, delegates not allowed"],"discriminator":[183,18,70,156,148,109,161,34],"accounts":[{"name":"state","writable":true},{"name":"vault","writable":true,"pda":{"seeds":[{"kind":"const","value":[118,97,117,108,116]},{"kind":"account","path":"state"}]}},{"name":"asset"},{"name":"vault_ata","writable":true,"pda":{"seeds":[{"kind":"account","path":"vault"},{"kind":"account","path":"token_program"},{"kind":"account","path":"asset"}],"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":"signer_ata","writable":true,"pda":{"seeds":[{"kind":"account","path":"signer"},{"kind":"account","path":"token_program"},{"kind":"account","path":"asset"}],"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":"signer","writable":true,"signer":true},{"name":"token_program"}],"args":[{"name":"amount","type":"u64"}]},{"name":"withdraw_from_stake_accounts","docs":["Withdraws SOL from stake accounts.","","# Parameters","- `ctx`: The context for the instruction.","","# Permission required","- Permission::Unstake","","# Integration required","- Integration::NativeStaking"],"discriminator":[93,209,100,231,169,160,192,197],"accounts":[{"name":"signer","writable":true,"signer":true},{"name":"state","writable":true},{"name":"vault","writable":true,"pda":{"seeds":[{"kind":"const","value":[118,97,117,108,116]},{"kind":"account","path":"state"}]}},{"name":"clock","address":"SysvarC1ock11111111111111111111111111111111"},{"name":"stake_history","address":"SysvarStakeHistory1111111111111111111111111"},{"name":"stake_program","address":"Stake11111111111111111111111111111111111111"}],"args":[]},{"name":"wsol_unwrap","docs":["Unwraps all wSOL to get SOL.","","# Parameters","- `ctx`: The context for the instruction.","","# Permission required","- Permission::WSolUnwrap"],"discriminator":[123,189,16,96,233,186,54,215],"accounts":[{"name":"state"},{"name":"vault","writable":true,"pda":{"seeds":[{"kind":"const","value":[118,97,117,108,116]},{"kind":"account","path":"state"}]}},{"name":"vault_wsol_ata","writable":true,"pda":{"seeds":[{"kind":"account","path":"vault"},{"kind":"const","value":[6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169]},{"kind":"account","path":"wsol_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":"wsol_mint","address":"So11111111111111111111111111111111111111112"},{"name":"signer","writable":true,"signer":true},{"name":"token_program","address":"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"}],"args":[]},{"name":"wsol_wrap","docs":["Wraps SOL to get wSOL.","","# Parameters","- `ctx`: The context for the instruction.","- `lamports`: The amount of SOL to wrap.","","# Permission required","- Permission::WSolWrap"],"discriminator":[26,2,139,159,239,195,193,9],"accounts":[{"name":"state"},{"name":"vault","writable":true,"pda":{"seeds":[{"kind":"const","value":[118,97,117,108,116]},{"kind":"account","path":"state"}]}},{"name":"vault_wsol_ata","writable":true,"pda":{"seeds":[{"kind":"account","path":"vault"},{"kind":"const","value":[6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169]},{"kind":"account","path":"wsol_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":"wsol_mint","address":"So11111111111111111111111111111111111111112"},{"name":"signer","writable":true,"signer":true},{"name":"system_program","address":"11111111111111111111111111111111"},{"name":"token_program","address":"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"},{"name":"associated_token_program","address":"ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"}],"args":[{"name":"lamports","type":"u64"}]}],"accounts":[{"name":"OpenfundsMetadataAccount","discriminator":[5,89,20,76,255,158,209,219]},{"name":"PolicyAccount","discriminator":[218,201,183,164,156,127,81,175]},{"name":"StateAccount","discriminator":[142,247,54,95,85,133,249,103]}],"errors":[{"code":48000,"name":"NotAuthorized","msg":"Signer is not authorized"},{"code":48001,"name":"IntegrationDisabled","msg":"Integration is disabled"},{"code":48002,"name":"StateAccountDisabled","msg":"State account is disabled"},{"code":48003,"name":"InvalidSignerAccount","msg":"Invalid signer ata"},{"code":49000,"name":"InvalidAccountType","msg":"Invalid account type"},{"code":49001,"name":"InvalidName","msg":"Name too long: max 64 chars"},{"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":"CloseNotEmptyError","msg":"Error closing state account: not empty"},{"code":49006,"name":"NoShareClass","msg":"No share class found"},{"code":49007,"name":"ShareClassesNotClosed","msg":"Glam state account can\'t be closed. Close share classes first"},{"code":49008,"name":"InvalidShareClass","msg":"Share class not allowed to subscribe"},{"code":49009,"name":"InvalidAssetSubscribe","msg":"Asset not allowed to subscribe"},{"code":49010,"name":"InvalidPricingOracle","msg":"Invalid oracle for asset price"},{"code":49011,"name":"InvalidRemainingAccounts","msg":"Invalid accounts: the transaction is malformed"},{"code":49012,"name":"InvalidVaultTokenAccount","msg":"Invalid vault ata"},{"code":49013,"name":"ShareClassNotEmpty","msg":"Share class mint supply not zero"},{"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":"InvalidSwap","msg":"Swap failed"},{"code":50003,"name":"InvalidTokenAccount","msg":"Invalid token account"},{"code":50004,"name":"InvalidVoteSide","msg":"Invalid vote side"},{"code":51000,"name":"InvalidAssetPrice","msg":"Invalid asset price"},{"code":51001,"name":"InvalidStableCoinPriceForSubscribe","msg":"Subscription not allowed: invalid stable coin price"},{"code":51002,"name":"SubscribeRedeemDisable","msg":"Fund is disabled for subscription and redemption"},{"code":51003,"name":"InvalidPolicyAccount","msg":"Policy account is mandatory"},{"code":51004,"name":"PriceTooOld","msg":"Price is too old"},{"code":52000,"name":"TransfersDisabled","msg":"Policy violation: transfers disabled"},{"code":52001,"name":"AmountTooBig","msg":"Policy violation: amount too big"},{"code":52002,"name":"LockUp","msg":"Policy violation: lock-up period"}],"types":[{"name":"AccountType","type":{"kind":"enum","variants":[{"name":"Vault"},{"name":"Mint"},{"name":"Fund"}]}},{"name":"CompanyField","type":{"kind":"struct","fields":[{"name":"name","type":{"defined":{"name":"CompanyFieldName"}}},{"name":"value","type":"string"}]}},{"name":"CompanyFieldName","type":{"kind":"enum","variants":[{"name":"FundGroupName"},{"name":"ManCo"},{"name":"DomicileOfManCo"},{"name":"BICOfCustodian"},{"name":"CollateralManagerName"},{"name":"CustodianBankName"},{"name":"DomicileOfCustodianBank"},{"name":"FundAdministratorName"},{"name":"FundAdvisorName"},{"name":"FundPromoterName"},{"name":"IsSelfManagedInvestmentCompany"},{"name":"LEIOfCustodianBank"},{"name":"LEIOfManCo"},{"name":"PortfolioManagingCompanyName"},{"name":"SecuritiesLendingCounterpartyName"},{"name":"SwapCounterpartyName"},{"name":"AddressofManCo"},{"name":"AuditorName"},{"name":"CityofManCo"},{"name":"EmailAddressOfManCo"},{"name":"FundWebsiteOfManCo"},{"name":"IsUNPRISignatory"},{"name":"PhoneCountryCodeofManCo"},{"name":"PhoneNumberofManCo"},{"name":"SubInvestmentAdvisorName"},{"name":"ZIPCodeofManCo"},{"name":"DomicileOfUmbrella"},{"name":"HasUmbrella"},{"name":"LEIOfUmbrella"},{"name":"Umbrella"},{"name":"GlobalIntermediaryIdentificationNumberOfUmbrella"}]}},{"name":"CompanyModel","type":{"kind":"struct","fields":[{"name":"fund_group_name","type":{"option":"string"}},{"name":"man_co","type":{"option":"string"}},{"name":"domicile_of_man_co","type":{"option":"string"}},{"name":"email_address_of_man_co","type":{"option":"string"}},{"name":"fund_website_of_man_co","type":{"option":"string"}}]}},{"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":"permissions","type":{"vec":{"defined":{"name":"Permission"}}}},{"name":"expires_at","type":"i64"}]}},{"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":"Allowlist"},{"name":"Blocklist"},{"name":"ExternalVaultAccounts"},{"name":"LockUp"},{"name":"DriftMarketIndexesPerp"},{"name":"DriftMarketIndexesSpot"},{"name":"DriftOrderTypes"},{"name":"MaxSwapSlippageBps"}]}},{"name":"EngineFieldValue","type":{"kind":"enum","variants":[{"name":"Boolean","fields":[{"name":"val","type":"bool"}]},{"name":"Date","fields":[{"name":"val","type":"string"}]},{"name":"Double","fields":[{"name":"val","type":"i64"}]},{"name":"Integer","fields":[{"name":"val","type":"i32"}]},{"name":"String","fields":[{"name":"val","type":"string"}]},{"name":"Time","fields":[{"name":"val","type":"string"}]},{"name":"U8","fields":[{"name":"val","type":"u8"}]},{"name":"U64","fields":[{"name":"val","type":"u64"}]},{"name":"Pubkey","fields":[{"name":"val","type":"pubkey"}]},{"name":"Percentage","fields":[{"name":"val","type":"u32"}]},{"name":"URI","fields":[{"name":"val","type":"string"}]},{"name":"Timestamp","fields":[{"name":"val","type":"i64"}]},{"name":"VecPubkey","fields":[{"name":"val","type":{"vec":"pubkey"}}]},{"name":"VecU32","fields":[{"name":"val","type":{"vec":"u32"}}]}]}},{"name":"FundField","type":{"kind":"struct","fields":[{"name":"name","type":{"defined":{"name":"FundFieldName"}}},{"name":"value","type":"string"}]}},{"name":"FundFieldName","type":{"kind":"enum","variants":[{"name":"FundDomicileAlpha2"},{"name":"FundDomicileAlpha3"},{"name":"LegalFundNameIncludingUmbrella"},{"name":"FiscalYearEnd"},{"name":"FundCurrency"},{"name":"FundLaunchDate"},{"name":"InvestmentObjective"},{"name":"IsETC"},{"name":"IsEUDirectiveRelevant"},{"name":"IsFundOfFunds"},{"name":"IsPassiveFund"},{"name":"IsREIT"},{"name":"LegalForm"},{"name":"LegalFundNameOnly"},{"name":"OpenEndedOrClosedEndedFundStructure"},{"name":"TypeOfEUDirective"},{"name":"UCITSVersion"},{"name":"CurrencyHedgePortfolio"},{"name":"DepositoryName"},{"name":"FundValuationPoint"},{"name":"FundValuationPointTimeZone"},{"name":"FundValuationPointTimeZoneUsingTZDatabase"},{"name":"HasCollateralManager"},{"name":"HasEmbeddedDerivatives"},{"name":"HasSecuritiesLending"},{"name":"HasSwap"},{"name":"IsLeveraged"},{"name":"IsShariaCompliant"},{"name":"IsShort"},{"name":"LEIofDepositoryBank"},{"name":"LEIOfFund"},{"name":"LocationOfBearerShare"},{"name":"LocationOfShareRegister"},{"name":"MaximumLeverageInFund"},{"name":"MiFIDSecuritiesClassification"},{"name":"MoneyMarketTypeOfFund"},{"name":"TrusteeName"},{"name":"AuMFund"},{"name":"AuMFundDate"},{"name":"NoSFund"},{"name":"NoSFundDate"}]}},{"name":"FundManagerField","type":{"kind":"struct","fields":[{"name":"name","type":{"defined":{"name":"FundManagerFieldName"}}},{"name":"value","type":"string"}]}},{"name":"FundManagerFieldName","type":{"kind":"enum","variants":[{"name":"PortfolioManagerForename"},{"name":"PortfolioManagerName"},{"name":"PortfolioManagerYearOfBirth"},{"name":"PortfolioManagerYearOfExperienceStart"},{"name":"PortfolioManagerBriefBiography"},{"name":"PortfolioManagerType"},{"name":"PortfolioManagerRoleStartingDate"},{"name":"PortfolioManagerRoleEndDate"}]}},{"name":"FundOpenfundsModel","type":{"kind":"struct","fields":[{"name":"fund_domicile_alpha_2","type":{"option":"string"}},{"name":"legal_fund_name_including_umbrella","type":{"option":"string"}},{"name":"fiscal_year_end","type":{"option":"string"}},{"name":"fund_currency","type":{"option":"string"}},{"name":"fund_launch_date","type":{"option":"string"}},{"name":"investment_objective","type":{"option":"string"}},{"name":"is_etc","type":{"option":"bool"}},{"name":"is_eu_directive_relevant","type":{"option":"bool"}},{"name":"is_fund_of_funds","type":{"option":"bool"}},{"name":"is_passive_fund","type":{"option":"bool"}},{"name":"is_reit","type":{"option":"bool"}},{"name":"legal_form","type":{"option":"string"}},{"name":"legal_fund_name_only","type":{"option":"string"}},{"name":"open_ended_or_closed_ended_fund_structure","type":{"option":"string"}},{"name":"type_of_eu_directive","type":{"option":"string"}},{"name":"ucits_version","type":{"option":"string"}}]}},{"name":"InitObligationArgs","type":{"kind":"struct","fields":[{"name":"tag","type":"u8"},{"name":"id","type":"u8"}]}},{"name":"Integration","type":{"kind":"enum","variants":[{"name":"Drift"},{"name":"SplStakePool"},{"name":"SanctumStakePool"},{"name":"NativeStaking"},{"name":"Marinade"},{"name":"JupiterSwap"},{"name":"JupiterVote"},{"name":"KaminoLending"}]}},{"name":"ManagerKind","type":{"kind":"enum","variants":[{"name":"Wallet"},{"name":"Squads"}]}},{"name":"ManagerModel","type":{"kind":"struct","fields":[{"name":"portfolio_manager_name","type":{"option":"string"}},{"name":"pubkey","type":{"option":"pubkey"}},{"name":"kind","type":{"option":{"defined":{"name":"ManagerKind"}}}}]}},{"name":"MarketType","type":{"kind":"enum","variants":[{"name":"Spot"},{"name":"Perp"}]}},{"name":"Metadata","type":{"kind":"struct","fields":[{"name":"template","type":{"defined":{"name":"MetadataTemplate"}}},{"name":"pubkey","type":"pubkey"},{"name":"uri","type":"string"}]}},{"name":"MetadataTemplate","type":{"kind":"enum","variants":[{"name":"Openfunds"}]}},{"name":"MintModel","type":{"kind":"struct","fields":[{"name":"symbol","type":{"option":"string"}},{"name":"name","type":{"option":"string"}},{"name":"uri","type":{"option":"string"}},{"name":"state_pubkey","type":{"option":"pubkey"}},{"name":"asset","type":{"option":"pubkey"}},{"name":"image_uri","type":{"option":"string"}},{"name":"allowlist","type":{"option":{"vec":"pubkey"}}},{"name":"blocklist","type":{"option":{"vec":"pubkey"}}},{"name":"lock_up_period_in_seconds","type":{"option":"i32"}},{"name":"permanent_delegate","type":{"option":"pubkey"}},{"name":"default_account_state_frozen","type":{"option":"bool"}},{"name":"is_raw_openfunds","type":{"option":"bool"}},{"name":"raw_openfunds","type":{"option":{"defined":{"name":"MintOpenfundsModel"}}}}]}},{"name":"MintOpenfundsModel","type":{"kind":"struct","fields":[{"name":"isin","type":{"option":"string"}},{"name":"share_class_currency","type":{"option":"string"}},{"name":"currency_of_minimal_subscription","type":{"option":"string"}},{"name":"full_share_class_name","type":{"option":"string"}},{"name":"investment_status","type":{"option":"string"}},{"name":"minimal_initial_subscription_category","type":{"option":"string"}},{"name":"minimal_initial_subscription_in_amount","type":{"option":"string"}},{"name":"minimal_initial_subscription_in_shares","type":{"option":"string"}},{"name":"share_class_distribution_policy","type":{"option":"string"}},{"name":"share_class_extension","type":{"option":"string"}},{"name":"share_class_launch_date","type":{"option":"string"}},{"name":"share_class_lifecycle","type":{"option":"string"}},{"name":"launch_price","type":{"option":"string"}},{"name":"launch_price_currency","type":{"option":"string"}},{"name":"launch_price_date","type":{"option":"string"}},{"name":"currency_of_minimal_or_maximum_redemption","type":{"option":"string"}},{"name":"has_lock_up_for_redemption","type":{"option":"bool"}},{"name":"is_valid_isin","type":{"option":"bool"}},{"name":"lock_up_comment","type":{"option":"string"}},{"name":"lock_up_period_in_days","type":{"option":"string"}},{"name":"maximum_initial_redemption_in_amount","type":{"option":"string"}},{"name":"maximum_initial_redemption_in_shares","type":{"option":"string"}},{"name":"minimal_initial_redemption_in_amount","type":{"option":"string"}},{"name":"minimal_initial_redemption_in_shares","type":{"option":"string"}},{"name":"minimal_redemption_category","type":{"option":"string"}},{"name":"share_class_dividend_type","type":{"option":"string"}},{"name":"cusip","type":{"option":"string"}},{"name":"valor","type":{"option":"string"}}]}},{"name":"ModifyOrderParams","type":{"kind":"struct","fields":[{"name":"direction","type":{"option":{"defined":{"name":"PositionDirection"}}}},{"name":"base_asset_amount","type":{"option":"u64"}},{"name":"price","type":{"option":"u64"}},{"name":"reduce_only","type":{"option":"bool"}},{"name":"post_only","type":{"option":{"defined":{"name":"PostOnlyParam"}}}},{"name":"immediate_or_cancel","type":{"option":"bool"}},{"name":"max_ts","type":{"option":"i64"}},{"name":"trigger_price","type":{"option":"u64"}},{"name":"trigger_condition","type":{"option":{"defined":{"name":"OrderTriggerCondition"}}}},{"name":"oracle_price_offset","type":{"option":"i32"}},{"name":"auction_duration","type":{"option":"u8"}},{"name":"auction_start_price","type":{"option":"i64"}},{"name":"auction_end_price","type":{"option":"i64"}},{"name":"policy","type":{"option":"u8"}}]}},{"name":"OpenfundsMetadataAccount","type":{"kind":"struct","fields":[{"name":"fund_id","type":"pubkey"},{"name":"company","type":{"vec":{"defined":{"name":"CompanyField"}}}},{"name":"fund","type":{"vec":{"defined":{"name":"FundField"}}}},{"name":"share_classes","type":{"vec":{"vec":{"defined":{"name":"ShareClassField"}}}}},{"name":"fund_managers","type":{"vec":{"vec":{"defined":{"name":"FundManagerField"}}}}}]}},{"name":"OrderParams","type":{"kind":"struct","fields":[{"name":"order_type","type":{"defined":{"name":"OrderType"}}},{"name":"market_type","type":{"defined":{"name":"MarketType"}}},{"name":"direction","type":{"defined":{"name":"PositionDirection"}}},{"name":"user_order_id","type":"u8"},{"name":"base_asset_amount","type":"u64"},{"name":"price","type":"u64"},{"name":"market_index","type":"u16"},{"name":"reduce_only","type":"bool"},{"name":"post_only","type":{"defined":{"name":"PostOnlyParam"}}},{"name":"immediate_or_cancel","type":"bool"},{"name":"max_ts","type":{"option":"i64"}},{"name":"trigger_price","type":{"option":"u64"}},{"name":"trigger_condition","type":{"defined":{"name":"OrderTriggerCondition"}}},{"name":"oracle_price_offset","type":{"option":"i32"}},{"name":"auction_duration","type":{"option":"u8"}},{"name":"auction_start_price","type":{"option":"i64"}},{"name":"auction_end_price","type":{"option":"i64"}}]}},{"name":"OrderTriggerCondition","type":{"kind":"enum","variants":[{"name":"Above"},{"name":"Below"},{"name":"TriggeredAbove"},{"name":"TriggeredBelow"}]}},{"name":"OrderType","type":{"kind":"enum","variants":[{"name":"Market"},{"name":"Limit"},{"name":"TriggerMarket"},{"name":"TriggerLimit"},{"name":"Oracle"}]}},{"name":"Permission","docs":["* Delegate ACL"],"type":{"kind":"enum","variants":[{"name":"DriftInitialize"},{"name":"DriftUpdateUser"},{"name":"DriftDeleteUser"},{"name":"DriftDeposit"},{"name":"DriftWithdraw"},{"name":"DriftPlaceOrders"},{"name":"DriftCancelOrders"},{"name":"DriftPerpMarket"},{"name":"DriftSpotMarket"},{"name":"Stake"},{"name":"Unstake"},{"name":"LiquidUnstake"},{"name":"JupiterSwapAllowlisted"},{"name":"JupiterSwapAny"},{"name":"WSolWrap"},{"name":"WSolUnwrap"},{"name":"MintTokens"},{"name":"BurnTokens"},{"name":"ForceTransferTokens"},{"name":"SetTokenAccountState"},{"name":"StakeJup"},{"name":"VoteOnProposal"},{"name":"UnstakeJup"},{"name":"JupiterSwapLst"},{"name":"KaminoInit"},{"name":"KaminoDeposit"},{"name":"DriftModifyOrders"}]}},{"name":"PolicyAccount","type":{"kind":"struct","fields":[{"name":"locked_until_ts","type":"i64"}]}},{"name":"PositionDirection","type":{"kind":"enum","variants":[{"name":"Long"},{"name":"Short"}]}},{"name":"PostOnlyParam","type":{"kind":"enum","variants":[{"name":"None"},{"name":"MustPostOnly"},{"name":"TryPostOnly"},{"name":"Slide"}]}},{"name":"ShareClassField","type":{"kind":"struct","fields":[{"name":"name","type":{"defined":{"name":"ShareClassFieldName"}}},{"name":"value","type":"string"}]}},{"name":"ShareClassFieldName","type":{"kind":"enum","variants":[{"name":"ISIN"},{"name":"ShareClassCurrency"},{"name":"AppliedSubscriptionFeeInFavourOfDistributor"},{"name":"AppliedSubscriptionFeeInFavourOfDistributorReferenceDate"},{"name":"CurrencyOfMinimalSubscription"},{"name":"FullShareClassName"},{"name":"HasPerformanceFee"},{"name":"HasSubscriptionFeeInFavourOfDistributor"},{"name":"InvestmentStatus"},{"name":"ManagementFeeApplied"},{"name":"ManagementFeeAppliedReferenceDate"},{"name":"ManagementFeeMaximum"},{"name":"MaximumSubscriptionFeeInFavourOfDistributor"},{"name":"MinimalInitialSubscriptionCategory"},{"name":"MinimalInitialSubscriptionInAmount"},{"name":"MinimalInitialSubscriptionInShares"},{"name":"MinimalSubsequentSubscriptionCategory"},{"name":"MinimalSubsequentSubscriptionInAmount"},{"name":"MinimalSubsequentSubscriptionInShares"},{"name":"MinimumSubscriptionFeeInFavourOfDistributor"},{"name":"ShareClassDistributionPolicy"},{"name":"ShareClassExtension"},{"name":"ShareClassLaunchDate"},{"name":"ShareClassLifecycle"},{"name":"SRRI"},{"name":"LaunchPrice"},{"name":"LaunchPriceCurrency"},{"name":"LaunchPriceDate"},{"name":"HasAppliedSubscriptionFeeInFavourOfFund"},{"name":"AppliedSubscriptionFeeInFavourOfFund"},{"name":"AppliedSubscriptionFeeInFavourOfFundReferenceDate"},{"name":"MaximumSubscriptionFeeInFavourOfFund"},{"name":"HasAppliedRedemptionFeeInFavourOfFund"},{"name":"AppliedRedemptionFeeInFavourOfFund"},{"name":"AppliedRedemptionFeeInFavourOfFundReferenceDate"},{"name":"MaximumRedemptionFeeInFavourOfFund"},{"name":"AppliedRedemptionFeeInFavourOfDistributor"},{"name":"AppliedRedemptionFeeInFavourOfDistributorReferenceDate"},{"name":"CurrencyOfMinimalOrMaximumRedemption"},{"name":"CutOffDateOffsetForRedemption"},{"name":"CutOffDateOffsetForSubscription"},{"name":"CutOffTimeForRedemption"},{"name":"CutOffTimeForSubscription"},{"name":"HasLockUpForRedemption"},{"name":"HasRedemptionFeeInFavourOfDistributor"},{"name":"IsValidISIN"},{"name":"LockUpComment"},{"name":"LockUpPeriodInDays"},{"name":"ManagementFeeMinimum"},{"name":"MaximalNumberOfPossibleDecimalsAmount"},{"name":"MaximalNumberOfPossibleDecimalsNAV"},{"name":"MaximalNumberOfPossibleDecimalsShares"},{"name":"MaximumInitialRedemptionInAmount"},{"name":"MaximumInitialRedemptionInShares"},{"name":"MaximumRedemptionFeeInFavourOfDistributor"},{"name":"MaximumSubsequentRedemptionInAmount"},{"name":"MaximumSubsequentRedemptionInShares"},{"name":"MinimalInitialRedemptionInAmount"},{"name":"MinimalInitialRedemptionInShares"},{"name":"MinimalRedemptionCategory"},{"name":"MinimalSubsequentRedemptionInAmount"},{"name":"MinimalSubsequentRedemptionInShares"},{"name":"MinimumRedemptionFeeInFavourOfDistributor"},{"name":"MinimumRedemptionFeeInFavourOfFund"},{"name":"MinimumSubscriptionFeeInFavourOfFund"},{"name":"PerformanceFeeMinimum"},{"name":"RoundingMethodForPrices"},{"name":"RoundingMethodForRedemptionInAmount"},{"name":"RoundingMethodForRedemptionInShares"},{"name":"RoundingMethodForSubscriptionInAmount"},{"name":"RoundingMethodForSubscriptionInShares"},{"name":"ShareClassDividendType"},{"name":"CUSIP"},{"name":"Valor"},{"name":"FundId"},{"name":"ImageUri"}]}},{"name":"StateAccount","type":{"kind":"struct","fields":[{"name":"account_type","type":{"defined":{"name":"AccountType"}}},{"name":"owner","type":"pubkey"},{"name":"vault","type":"pubkey"},{"name":"enabled","type":"bool"},{"name":"created","type":{"defined":{"name":"CreatedModel"}}},{"name":"engine","type":"pubkey"},{"name":"mints","type":{"vec":"pubkey"}},{"name":"metadata","type":{"option":{"defined":{"name":"Metadata"}}}},{"name":"name","type":"string"},{"name":"uri","type":"string"},{"name":"assets","type":{"vec":"pubkey"}},{"name":"delegate_acls","type":{"vec":{"defined":{"name":"DelegateAcl"}}}},{"name":"integrations","type":{"vec":{"defined":{"name":"Integration"}}}},{"name":"params","type":{"vec":{"vec":{"defined":{"name":"EngineField"}}}}}]}},{"name":"StateModel","type":{"kind":"struct","fields":[{"name":"id","type":{"option":"pubkey"}},{"name":"account_type","type":{"option":{"defined":{"name":"AccountType"}}}},{"name":"name","type":{"option":"string"}},{"name":"uri","type":{"option":"string"}},{"name":"enabled","type":{"option":"bool"}},{"name":"assets","type":{"option":{"vec":"pubkey"}}},{"name":"external_vault_accounts","type":{"option":{"vec":"pubkey"}}},{"name":"mints","type":{"option":{"vec":{"defined":{"name":"MintModel"}}}}},{"name":"company","type":{"option":{"defined":{"name":"CompanyModel"}}}},{"name":"owner","type":{"option":{"defined":{"name":"ManagerModel"}}}},{"name":"created","type":{"option":{"defined":{"name":"CreatedModel"}}}},{"name":"delegate_acls","type":{"option":{"vec":{"defined":{"name":"DelegateAcl"}}}}},{"name":"integrations","type":{"option":{"vec":{"defined":{"name":"Integration"}}}}},{"name":"drift_market_indexes_perp","type":{"option":{"vec":"u32"}}},{"name":"drift_market_indexes_spot","type":{"option":{"vec":"u32"}}},{"name":"drift_order_types","type":{"option":{"vec":"u32"}}},{"name":"metadata","type":{"option":{"defined":{"name":"Metadata"}}}},{"name":"raw_openfunds","type":{"option":{"defined":{"name":"FundOpenfundsModel"}}}}]}}],"constants":[{"name":"SEED_METADATA","type":"string","value":"\\"metadata\\""},{"name":"SEED_MINT","type":"string","value":"\\"mint\\""},{"name":"SEED_STATE","type":"string","value":"\\"state\\""},{"name":"SEED_VAULT","type":"string","value":"\\"vault\\""}]}');
|
|
83
|
+
module.exports = /*#__PURE__*/JSON.parse('{"address":"GLAMbTqav9N9witRjswJ8enwp9vv5G8bsSJ2kPJ4rcyc","metadata":{"name":"glam","version":"0.4.6","spec":"0.1.0","description":"Glam Protocol"},"instructions":[{"name":"add_mint","docs":["Adds a new mint.","","# Parameters","- `ctx`: The context for the instruction.","- `mint_model`: An instance of `MintModel` containing the metadata for the new mint.","","# Permission required","- Owner only, delegates not allowed"],"discriminator":[171,222,111,37,60,166,208,108],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_signer","writable":true,"signer":true},{"name":"new_mint","writable":true},{"name":"extra_account_meta_list","writable":true,"pda":{"seeds":[{"kind":"const","value":[101,120,116,114,97,45,97,99,99,111,117,110,116,45,109,101,116,97,115]},{"kind":"account","path":"new_mint"}]}},{"name":"openfunds_metadata","writable":true,"optional":true,"pda":{"seeds":[{"kind":"const","value":[109,101,116,97,100,97,116,97]},{"kind":"account","path":"glam_state"}]}},{"name":"system_program","address":"11111111111111111111111111111111"},{"name":"token_2022_program","address":"TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"}],"args":[{"name":"mint_model","type":{"defined":{"name":"MintModel"}}}]},{"name":"burn_tokens","docs":["Burns a specified amount of tokens for the given mint.","","# Parameters","- `ctx`: The context for the instruction.","- `mint_id`: The id of the mint to burn tokens for.","- `amount`: The amount of tokens to burn.","","# Permission required","- Permission::BurnTokens","","# Integration required","- Integration::Mint"],"discriminator":[76,15,51,254,229,215,121,66],"accounts":[{"name":"glam_state"},{"name":"glam_signer","writable":true,"signer":true},{"name":"glam_mint","writable":true},{"name":"from_ata","writable":true,"pda":{"seeds":[{"kind":"account","path":"from"},{"kind":"account","path":"token_2022_program"},{"kind":"account","path":"glam_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":"from"},{"name":"token_2022_program","address":"TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"}],"args":[{"name":"mint_id","type":"u8"},{"name":"amount","type":"u64"}]},{"name":"close_mint","docs":["Closes a mint and releases its resources.","","# Parameters","- `ctx`: The context for the instruction.","- `mint_id`: The id of the mint to be closed.","","# Permission required","- Owner only, delegates not allowed"],"discriminator":[149,251,157,212,65,181,235,129],"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":"glam_mint","writable":true},{"name":"extra_account_meta_list","writable":true,"pda":{"seeds":[{"kind":"const","value":[101,120,116,114,97,45,97,99,99,111,117,110,116,45,109,101,116,97,115]},{"kind":"account","path":"glam_mint"}]}},{"name":"metadata","writable":true,"pda":{"seeds":[{"kind":"const","value":[109,101,116,97,100,97,116,97]},{"kind":"account","path":"glam_state"}]}},{"name":"token_2022_program","address":"TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"}],"args":[{"name":"mint_id","type":"u8"}]},{"name":"close_state","docs":["Closes a state account and releases its resources.","","# Parameters","- `ctx`: The context for the instruction.","","# Permission required","- Owner only, delegates not allowed"],"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":"metadata","writable":true,"pda":{"seeds":[{"kind":"const","value":[109,101,116,97,100,97,116,97]},{"kind":"account","path":"glam_state"}]}},{"name":"system_program","address":"11111111111111111111111111111111"}],"args":[]},{"name":"close_token_accounts","docs":["Closes token accounts owned by the vault.","","# Parameters","- `ctx`: The context for the instruction.","","# Permission required","- Owner only, delegates not allowed"],"discriminator":[199,170,37,55,63,183,235,143],"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":"token_program","address":"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"},{"name":"token_2022_program","address":"TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"}],"args":[]},{"name":"deactivate_stake_accounts","docs":["Deactivates stake accounts.","","# Parameters","- `ctx`: The context for the instruction.","","# Permission required","- Permission::Unstake","","# Integration required","- Integration::NativeStaking"],"discriminator":[58,18,6,22,226,216,161,193],"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":"clock","address":"SysvarC1ock11111111111111111111111111111111"},{"name":"stake_program","address":"Stake11111111111111111111111111111111111111"}],"args":[]},{"name":"drift_cancel_orders","docs":["Cancels drift orders.","","# Parameters","- `ctx`: The context for the instruction.","- `market_type`: The type of market (spot or perp) to cancel orders for.","- `market_index`: The index of the market to cancel orders for.","- `direction`: The direction of orders to cancel (long or short).","","# Permission required","- Permission::DriftCancelOrders","","# Integration required","- Integration::Drift"],"discriminator":[98,107,48,79,97,60,99,58],"accounts":[{"name":"glam_state"},{"name":"glam_vault","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":"dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH"},{"name":"state"},{"name":"user","writable":true}],"args":[{"name":"market_type","type":{"option":{"defined":{"name":"MarketType"}}}},{"name":"market_index","type":{"option":"u16"}},{"name":"direction","type":{"option":{"defined":{"name":"PositionDirection"}}}}]},{"name":"drift_cancel_orders_by_ids","docs":["Cancels drift orders by order IDs.","","# Parameters","- `ctx`: The context for the instruction.","- `order_ids`: A list of order IDs.","","# Permission required","- Permission::DriftCancelOrders","","# Integration required","- Integration::Drift"],"discriminator":[172,99,108,14,81,89,228,183],"accounts":[{"name":"glam_state"},{"name":"glam_vault","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":"dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH"},{"name":"state"},{"name":"user","writable":true}],"args":[{"name":"order_ids","type":{"vec":"u32"}}]},{"name":"drift_delete_user","docs":["Deletes a drift user (sub account).","","# Parameters","- `ctx`: The context for the instruction.","","# Permission required","- Permission::DriftDeleteUser","","# Integration required","- Integration::Drift"],"discriminator":[179,118,20,212,145,146,49,130],"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":"dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH"},{"name":"user","writable":true},{"name":"user_stats","writable":true},{"name":"state","writable":true}],"args":[]},{"name":"drift_deposit","docs":["Deposits to drift.","","# Parameters","- `ctx`: The context for the instruction.","- `market_index`: Index of the drift spot market.","- `amount`: Amount of asset to deposit.","","# Permission required","- Permission::DriftDeposit","","# Integration required","- Integration::Drift"],"discriminator":[252,63,250,201,98,55,130,12],"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":"dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH"},{"name":"state"},{"name":"user","writable":true},{"name":"user_stats","writable":true},{"name":"spot_market_vault","writable":true},{"name":"user_token_account","writable":true},{"name":"token_program"}],"args":[{"name":"market_index","type":"u16"},{"name":"amount","type":"u64"},{"name":"reduce_only","type":"bool"}]},{"name":"drift_initialize_user","discriminator":[107,244,158,15,225,239,98,245],"accounts":[{"name":"glam_state"},{"name":"glam_vault","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":"dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH"},{"name":"user","writable":true},{"name":"user_stats","writable":true},{"name":"state","writable":true},{"name":"payer","writable":true,"signer":true},{"name":"rent","address":"SysvarRent111111111111111111111111111111111"},{"name":"system_program","address":"11111111111111111111111111111111"}],"args":[{"name":"sub_account_id","type":"u16"},{"name":"name","type":{"array":["u8",32]}}]},{"name":"drift_initialize_user_stats","docs":["Initializes a drift account owned by vault and creates a subaccount.","","# Parameters","- `ctx`: The context for the instruction.","","# Permission required","- Permission::DriftInitialize","","# Integration required","- Integration::Drift"],"discriminator":[133,185,103,162,90,161,78,143],"accounts":[{"name":"glam_state"},{"name":"glam_vault","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":"dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH"},{"name":"user_stats","writable":true},{"name":"state","writable":true},{"name":"payer","writable":true,"signer":true},{"name":"rent","address":"SysvarRent111111111111111111111111111111111"},{"name":"system_program","address":"11111111111111111111111111111111"}],"args":[]},{"name":"drift_modify_order","docs":["Modifies an existing drift order.","","# Parameters","- `ctx`: The context for the instruction.","- `order_id`: The ID of the order to modify.","- `modify_order_params`: The parameters to modify the order with.","","# Permission required","- Permission::DriftModifyOrder","","# Integration required","- Integration::Drift"],"discriminator":[235,245,222,58,245,128,19,202],"accounts":[{"name":"glam_state"},{"name":"glam_vault","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":"dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH"},{"name":"state"},{"name":"user","writable":true}],"args":[{"name":"order_id","type":{"option":"u32"}},{"name":"modify_order_params","type":{"defined":{"name":"ModifyOrderParams"}}}]},{"name":"drift_place_orders","docs":["Places orders on drift.","","# Parameters","- `ctx`: The context for the instruction.","- `params`: A list of orders.","","# Permissions required","- Permission::DriftPlaceOrders","- Additional permission Permission::DriftSpotMarket or Permission::DriftPerpMarket is required depending on market type.","","# Integration required","- Integration::Drift"],"discriminator":[117,18,210,6,238,174,135,167],"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":"dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH"},{"name":"state"},{"name":"user","writable":true}],"args":[{"name":"params","type":{"vec":{"defined":{"name":"OrderParams"}}}}]},{"name":"drift_update_user_custom_margin_ratio","docs":["Updates custom margin ratio.","","# Parameters","- `ctx`: The context for the instruction.","- `sub_account_id`: Sub account.","- `margin_ratio`: Margin ratio.","","# Permission required","- Permission::DriftUpdateUser","","# Integration required","- Integration::Drift"],"discriminator":[4,47,193,177,128,62,228,14],"accounts":[{"name":"glam_state"},{"name":"glam_vault","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":"dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH"},{"name":"user","writable":true}],"args":[{"name":"sub_account_id","type":"u16"},{"name":"margin_ratio","type":"u32"}]},{"name":"drift_update_user_delegate","docs":["Sets a delegate on the specified sub account.","","# Parameters","- `ctx`: The context for the instruction.","- `sub_account_id`: Sub account.","- `delegate`: Delegate\'s wallet address.","","# Permission required","- Permission::DriftUpdateUser","","# Integration required","- Integration::Drift"],"discriminator":[36,181,34,31,22,77,36,154],"accounts":[{"name":"glam_state"},{"name":"glam_vault","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":"dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH"},{"name":"user","writable":true}],"args":[{"name":"sub_account_id","type":"u16"},{"name":"delegate","type":"pubkey"}]},{"name":"drift_update_user_margin_trading_enabled","docs":["Enables/Disables margin trading.","","# Parameters","- `ctx`: The context for the instruction.","- `sub_account_id`: Sub account.","- `margin_trading_enabled`: Whether to enable or disable margin trading.","","# Permission required","- Permission::DriftUpdateUser","","# Integration required","- Integration::Drift"],"discriminator":[157,175,12,19,202,114,17,36],"accounts":[{"name":"glam_state"},{"name":"glam_vault","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":"dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH"},{"name":"user","writable":true}],"args":[{"name":"sub_account_id","type":"u16"},{"name":"margin_trading_enabled","type":"bool"}]},{"name":"drift_withdraw","docs":["Withdraws from drift.","","# Parameters","- `ctx`: The context for the instruction.","- `market_index`: Index of the drift spot market.","- `amount`: Amount to withdraw.","","# Permission required","- Permission::DriftWithdraw","","# Integration required","- Integration::Drift"],"discriminator":[86,59,186,123,183,181,234,137],"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":"dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH"},{"name":"state"},{"name":"user","writable":true},{"name":"user_stats","writable":true},{"name":"spot_market_vault","writable":true},{"name":"drift_signer"},{"name":"user_token_account","writable":true},{"name":"token_program"}],"args":[{"name":"market_index","type":"u16"},{"name":"amount","type":"u64"},{"name":"reduce_only","type":"bool"}]},{"name":"force_transfer_tokens","docs":["Forcefully transfers a specified amount of tokens from one account to another.","","# Parameters","- `ctx`: The context for the instruction.","- `mint_id`: The id of the mint to transfer tokens for.","- `amount`: The amount of tokens to transfer.","","# Permission required","- Permission::ForceTransferTokens","","# Integration required","- Integration::Mint"],"discriminator":[185,34,78,211,192,13,160,37],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_signer","writable":true,"signer":true},{"name":"glam_mint","writable":true},{"name":"from_ata","writable":true,"pda":{"seeds":[{"kind":"account","path":"from"},{"kind":"account","path":"token_2022_program"},{"kind":"account","path":"glam_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":"to_ata","writable":true,"pda":{"seeds":[{"kind":"account","path":"to"},{"kind":"account","path":"token_2022_program"},{"kind":"account","path":"glam_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":"from"},{"name":"to"},{"name":"token_2022_program","address":"TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"}],"args":[{"name":"mint_id","type":"u8"},{"name":"amount","type":"u64"}]},{"name":"initialize_and_delegate_stake","docs":["Initializes a stake account and delegates it to a validator.","","# Parameters","- `ctx`: The context for the instruction.","- `lamports`: The amount of SOL to initialize the stake account with.","","# Permission required","- Permission::Stake","","# Integration required","- Integration::NativeStaking"],"discriminator":[71,101,230,157,50,23,47,1],"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":"vault_stake_account","writable":true},{"name":"vote"},{"name":"stake_config"},{"name":"clock","address":"SysvarC1ock11111111111111111111111111111111"},{"name":"rent","address":"SysvarRent111111111111111111111111111111111"},{"name":"stake_history","address":"SysvarStakeHistory1111111111111111111111111"},{"name":"stake_program","address":"Stake11111111111111111111111111111111111111"},{"name":"system_program","address":"11111111111111111111111111111111"}],"args":[{"name":"lamports","type":"u64"}]},{"name":"initialize_state","docs":["Initializes a state account from the provided StateModel instance.","","# Parameters","- `ctx`: The context for the instruction.","- `state`: An instance of `StateModel` containing the details of the state to be initialized.","","# Permission required","- Owner only, delegates not allowed"],"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_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":"openfunds_metadata","writable":true,"optional":true,"pda":{"seeds":[{"kind":"const","value":[109,101,116,97,100,97,116,97]},{"kind":"account","path":"glam_state"}]}},{"name":"system_program","address":"11111111111111111111111111111111"}],"args":[{"name":"state","type":{"defined":{"name":"StateModel"}}}]},{"name":"jupiter_gov_new_vote","docs":["Creates a new vote.","","# Parameters","- `ctx`: The context for the instruction.","","# Permission required","- Permission::VoteOnProposal","","# Integration required","- Integration::JupiterVote"],"discriminator":[235,179,170,64,64,57,17,69],"accounts":[{"name":"glam_state"},{"name":"glam_vault","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":"GovaE4iu227srtG2s3tZzB4RmWBzw8sTwrCLZz7kN7rY"},{"name":"proposal"},{"name":"vote","writable":true},{"name":"payer","writable":true,"signer":true},{"name":"system_program","address":"11111111111111111111111111111111"}],"args":[{"name":"voter","type":"pubkey"}]},{"name":"jupiter_set_max_swap_slippage","docs":["Sets the max swap slippage.","","# Parameters","- `ctx`: The context for the instruction.","- `slippage`: The maximum allowed slippage in basis points.","","# Permission required","- Owner only, delegates not allowed"],"discriminator":[110,79,13,71,208,111,56,66],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_signer","writable":true,"signer":true}],"args":[{"name":"slippage","type":"u64"}]},{"name":"jupiter_swap","docs":["Swaps assets using Jupiter.","","# Parameters","- `ctx`: The context for the instruction.","- `amount`: The amount of input asset to swap.","- `data`: The serialized Jupiter route data containing swap instructions and parameters.","","# Permission required","- Any of","- Permission::JupiterSwapAny: no restrictions.","- Permission::JupiterSwapAllowlisted: input and output are in the assets allowlist.","- Permission::JupiterSwapLst: input and output assets are both LST.","","# Integration required","- Integration::JupiterSwap"],"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":"amount","type":"u64"},{"name":"data","type":"bytes"}]},{"name":"jupiter_vote_cast_vote","docs":["Casts a vote.","","# Parameters","- `ctx`: The context for the instruction.","- `side`: The side to vote for.","","# Permission required","- Permission::VoteOnProposal","","# Integration required","- Integration::JupiterVote"],"discriminator":[11,197,234,57,164,74,181,239],"accounts":[{"name":"glam_state"},{"name":"glam_vault","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":"voTpe3tHQ7AjQHMapgSue2HJFAh2cGsdokqN3XqmVSj"},{"name":"locker"},{"name":"escrow"},{"name":"proposal","writable":true},{"name":"vote","writable":true},{"name":"governor"},{"name":"govern_program"}],"args":[{"name":"side","type":"u8"}]},{"name":"jupiter_vote_cast_vote_checked","docs":["Casts a vote, only if expected_side is already recorded.","","# Parameters","- `ctx`: The context for the instruction.","- `side`: The side to vote for.","- `expected_side`: The expected side to check in the Vote account.","","# Permission required","- Permission::VoteOnProposal","","# Integration required","- Integration::JupiterVote"],"discriminator":[247,3,146,233,35,189,192,187],"accounts":[{"name":"glam_state"},{"name":"glam_vault","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":"voTpe3tHQ7AjQHMapgSue2HJFAh2cGsdokqN3XqmVSj"},{"name":"locker"},{"name":"escrow"},{"name":"proposal","writable":true},{"name":"vote","writable":true},{"name":"governor"},{"name":"govern_program"}],"args":[{"name":"side","type":"u8"},{"name":"expected_side","type":"u8"}]},{"name":"jupiter_vote_increase_locked_amount","docs":["Increases the locked amount (aka stakes JUP).","","# Parameters","- `ctx`: The context for the instruction.","- `amount`: The amount of JUP to stake.","","# Permission required","- Permission::StakeJup","","# Integration required","- Integration::JupiterVote"],"discriminator":[225,38,201,123,148,23,47,128],"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":"voTpe3tHQ7AjQHMapgSue2HJFAh2cGsdokqN3XqmVSj"},{"name":"locker","writable":true},{"name":"escrow","writable":true},{"name":"escrow_tokens","writable":true},{"name":"source_tokens","writable":true},{"name":"token_program"}],"args":[{"name":"amount","type":"u64"}]},{"name":"jupiter_vote_merge_partial_unstaking","docs":["Merges partial unstaking.","","# Parameters","- `ctx`: The context for the instruction.","","# Permission required","- Permission::UnstakeJup","","# Integration required","- Integration::JupiterVote"],"discriminator":[93,226,122,120,130,35,189,208],"accounts":[{"name":"glam_state"},{"name":"glam_vault","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":"voTpe3tHQ7AjQHMapgSue2HJFAh2cGsdokqN3XqmVSj"},{"name":"locker","writable":true},{"name":"escrow","writable":true},{"name":"partial_unstake","writable":true}],"args":[]},{"name":"jupiter_vote_new_escrow","docs":["Initializes a locked voter escrow.","","# Parameters","- `ctx`: The context for the instruction.","","# Permission required","- Permission::StakeJup","","# Integration required","- Integration::JupiterVote"],"discriminator":[255,87,157,219,61,178,144,159],"accounts":[{"name":"glam_state"},{"name":"glam_vault","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":"voTpe3tHQ7AjQHMapgSue2HJFAh2cGsdokqN3XqmVSj"},{"name":"locker","writable":true},{"name":"escrow","writable":true},{"name":"payer","writable":true,"signer":true},{"name":"system_program","address":"11111111111111111111111111111111"}],"args":[]},{"name":"jupiter_vote_open_partial_unstaking","docs":["Partially unstakes JUP.","","# Parameters","- `ctx`: The context for the instruction.","- `amount`: The amount of JUP to partially unstake.","- `memo`: The memo for the partial unstaking.","","# Permission required","- Permission::UnstakeJup","","# Integration required","- Integration::JupiterVote"],"discriminator":[84,7,113,220,212,63,237,218],"accounts":[{"name":"glam_state"},{"name":"glam_vault","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":"voTpe3tHQ7AjQHMapgSue2HJFAh2cGsdokqN3XqmVSj"},{"name":"locker","writable":true},{"name":"escrow","writable":true},{"name":"partial_unstake","writable":true,"signer":true},{"name":"system_program","address":"11111111111111111111111111111111"}],"args":[{"name":"amount","type":"u64"},{"name":"memo","type":"string"}]},{"name":"jupiter_vote_toggle_max_lock","docs":["Toggles max lock.","","# Parameters","- `ctx`: The context for the instruction.","- `is_max_lock`: true to allow staking, false to initiate full unstaking.","","# Permission required","- Permission::StakeJup (if is_max_lock == true)","- Permission::UnstakeJup (if is_max_lock == false)","","# Integration required","- Integration::JupiterVote"],"discriminator":[204,158,192,21,219,25,154,87],"accounts":[{"name":"glam_state"},{"name":"glam_vault","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":"voTpe3tHQ7AjQHMapgSue2HJFAh2cGsdokqN3XqmVSj"},{"name":"locker"},{"name":"escrow","writable":true}],"args":[{"name":"is_max_lock","type":"bool"}]},{"name":"jupiter_vote_withdraw","docs":["Withdraws all unstaked JUP.","","# Parameters","- `ctx`: The context for the instruction.","","# Permission required","- Permission::UnstakeJup","","# Integration required","- Integration::JupiterVote"],"discriminator":[195,172,184,195,23,178,145,191],"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":"voTpe3tHQ7AjQHMapgSue2HJFAh2cGsdokqN3XqmVSj"},{"name":"locker","writable":true},{"name":"escrow","writable":true},{"name":"escrow_tokens","writable":true},{"name":"destination_tokens","writable":true},{"name":"token_program"}],"args":[]},{"name":"jupiter_vote_withdraw_partial_unstaking","docs":["Withdraws JUP from partial unstaking.","","# Parameters","- `ctx`: The context for the instruction.","","# Permission required","- Permission::UnstakeJup","","# Integration required","- Integration::JupiterVote"],"discriminator":[109,98,65,252,184,0,216,240],"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":"voTpe3tHQ7AjQHMapgSue2HJFAh2cGsdokqN3XqmVSj"},{"name":"locker","writable":true},{"name":"escrow","writable":true},{"name":"partial_unstake","writable":true},{"name":"escrow_tokens","writable":true},{"name":"destination_tokens","writable":true},{"name":"token_program"}],"args":[]},{"name":"kamino_lending_deposit_reserve_liquidity_and_obligation_collateral","discriminator":[31,162,4,146,60,225,15,0],"accounts":[{"name":"glam_state"},{"name":"glam_vault","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":"owner","writable":true},{"name":"obligation","writable":true},{"name":"lending_market"},{"name":"lending_market_authority"},{"name":"reserve","writable":true},{"name":"reserve_liquidity_mint","writable":true},{"name":"reserve_liquidity_supply","writable":true},{"name":"reserve_collateral_mint","writable":true},{"name":"reserve_destination_deposit_collateral","writable":true},{"name":"user_source_liquidity","writable":true},{"name":"placeholder_user_destination_collateral"},{"name":"collateral_token_program"},{"name":"liquidity_token_program"},{"name":"instruction_sysvar_account"}],"args":[{"name":"liquidity_amount","type":"u64"}]},{"name":"kamino_lending_init_obligation","discriminator":[219,210,134,64,155,49,137,174],"accounts":[{"name":"glam_state"},{"name":"glam_vault","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":"obligation_owner"},{"name":"fee_payer","writable":true,"signer":true},{"name":"obligation","writable":true},{"name":"lending_market"},{"name":"seed1_account"},{"name":"seed2_account"},{"name":"owner_user_metadata"},{"name":"rent","address":"SysvarRent111111111111111111111111111111111"},{"name":"system_program","address":"11111111111111111111111111111111"}],"args":[{"name":"args","type":{"defined":{"name":"InitObligationArgs"}}}]},{"name":"kamino_lending_init_obligation_farms_for_reserve","discriminator":[227,61,130,2,117,226,78,1],"accounts":[{"name":"glam_state"},{"name":"glam_vault","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":"payer","writable":true,"signer":true},{"name":"owner"},{"name":"obligation","writable":true},{"name":"lending_market_authority","writable":true},{"name":"reserve","writable":true},{"name":"reserve_farm_state","writable":true},{"name":"obligation_farm","writable":true},{"name":"lending_market"},{"name":"farms_program"},{"name":"rent","address":"SysvarRent111111111111111111111111111111111"},{"name":"system_program","address":"11111111111111111111111111111111"}],"args":[{"name":"mode","type":"u8"}]},{"name":"kamino_lending_init_user_metadata","discriminator":[200,95,140,132,190,65,17,161],"accounts":[{"name":"glam_state"},{"name":"glam_vault","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":"owner"},{"name":"fee_payer","writable":true,"signer":true},{"name":"user_metadata","writable":true},{"name":"referrer_user_metadata"},{"name":"rent","address":"SysvarRent111111111111111111111111111111111"},{"name":"system_program","address":"11111111111111111111111111111111"}],"args":[{"name":"user_lookup_table","type":"pubkey"}]},{"name":"marinade_claim","docs":["Claims tickets that were unstaked in the previous epoch to get SOL.","","# Parameters","- `ctx`: The context containing the required accounts.","","# Permission required","- Permission::Unstake","","# Integration required","- Integration::Marinade"],"discriminator":[54,44,48,204,218,141,36,5],"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":"MarBmsSgKXdrN1egZf5sqe1TMai9K1rChYNDJgjq7aD"},{"name":"state","writable":true},{"name":"reserve_pda","writable":true},{"name":"ticket_account","writable":true},{"name":"clock"},{"name":"system_program","address":"11111111111111111111111111111111"}],"args":[]},{"name":"marinade_deposit","docs":["Deposits SOL to get mSOL.","","# Parameters","- `ctx`: The context containing the required accounts.","- `lamports`: The amount of SOL (in lamports) to deposit.","","# Permission required","- Permission::Stake","","# Integration required","- Integration::Marinade"],"discriminator":[62,236,248,28,222,232,182,73],"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":"MarBmsSgKXdrN1egZf5sqe1TMai9K1rChYNDJgjq7aD"},{"name":"state","writable":true},{"name":"msol_mint","writable":true},{"name":"liq_pool_sol_leg_pda","writable":true},{"name":"liq_pool_msol_leg","writable":true},{"name":"liq_pool_msol_leg_authority"},{"name":"reserve_pda","writable":true},{"name":"mint_to","writable":true},{"name":"msol_mint_authority"},{"name":"system_program","address":"11111111111111111111111111111111"},{"name":"token_program"}],"args":[{"name":"lamports","type":"u64"}]},{"name":"marinade_deposit_stake_account","docs":["Deposits a stake account to get mSOL.","","# Parameters","- `ctx`: The context containing the required accounts.","- `validator_idx`: Validator index in Marinade\'s validator list.","","# Permission required","- Permission::Stake","","# Integration required","- Integration::Marinade"],"discriminator":[141,230,58,103,56,205,159,138],"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":"MarBmsSgKXdrN1egZf5sqe1TMai9K1rChYNDJgjq7aD"},{"name":"state","writable":true},{"name":"validator_list","writable":true},{"name":"stake_list","writable":true},{"name":"stake_account","writable":true},{"name":"duplication_flag","writable":true},{"name":"msol_mint","writable":true},{"name":"mint_to","writable":true},{"name":"msol_mint_authority"},{"name":"clock"},{"name":"rent","address":"SysvarRent111111111111111111111111111111111"},{"name":"system_program","address":"11111111111111111111111111111111"},{"name":"token_program"},{"name":"stake_program"}],"args":[{"name":"validator_idx","type":"u32"}]},{"name":"marinade_liquid_unstake","docs":["Unstakes mSOL to get SOL immediately with a small fee.","","# Parameters","- `ctx`: The context containing the required accounts.","- `msol_amount`: Amount of mSOL to unstake.","","# Permission required","- Permission::Unstake","","# Integration required","- Integration::Marinade"],"discriminator":[29,146,34,21,26,68,141,161],"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":"MarBmsSgKXdrN1egZf5sqe1TMai9K1rChYNDJgjq7aD"},{"name":"state","writable":true},{"name":"msol_mint","writable":true},{"name":"liq_pool_sol_leg_pda","writable":true},{"name":"liq_pool_msol_leg","writable":true},{"name":"treasury_msol_account","writable":true},{"name":"get_msol_from","writable":true},{"name":"system_program","address":"11111111111111111111111111111111"},{"name":"token_program"}],"args":[{"name":"msol_amount","type":"u64"}]},{"name":"marinade_order_unstake","docs":["Unstakes mSOL to get a ticket that can be claimed at the next epoch.","","# Parameters","- `ctx`: The context containing the required accounts.","- `msol_amount`: Amount of mSOL to unstake.","","# Permission required","- Permission::Unstake","","# Integration required","- Integration::Marinade"],"discriminator":[202,3,33,27,183,156,57,231],"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":"MarBmsSgKXdrN1egZf5sqe1TMai9K1rChYNDJgjq7aD"},{"name":"state","writable":true},{"name":"msol_mint","writable":true},{"name":"burn_msol_from","writable":true},{"name":"new_ticket_account","writable":true},{"name":"clock"},{"name":"rent","address":"SysvarRent111111111111111111111111111111111"},{"name":"token_program"}],"args":[{"name":"msol_amount","type":"u64"}]},{"name":"merge_stake_accounts","docs":["Merges two stake accounts.","","# Parameters","- `ctx`: The context for the instruction.","","# Permission required","- Permission::Stake","","# Integration required","- Integration::NativeStaking"],"discriminator":[173,206,10,246,109,50,244,110],"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":"to_stake","writable":true},{"name":"from_stake","writable":true},{"name":"clock","address":"SysvarC1ock11111111111111111111111111111111"},{"name":"stake_history","address":"SysvarStakeHistory1111111111111111111111111"},{"name":"stake_program","address":"Stake11111111111111111111111111111111111111"},{"name":"system_program","address":"11111111111111111111111111111111"}],"args":[]},{"name":"meteora_dlmm_add_liquidity_by_strategy","discriminator":[81,139,59,146,176,196,240,216],"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":"LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"},{"name":"position","writable":true},{"name":"lb_pair","writable":true},{"name":"bin_array_bitmap_extension","writable":true},{"name":"user_token_x","writable":true},{"name":"user_token_y","writable":true},{"name":"reserve_x","writable":true},{"name":"reserve_y","writable":true},{"name":"token_x_mint"},{"name":"token_y_mint"},{"name":"bin_array_lower","writable":true},{"name":"bin_array_upper","writable":true},{"name":"token_x_program"},{"name":"token_y_program"},{"name":"event_authority"},{"name":"program"}],"args":[{"name":"params","type":{"defined":{"name":"LiquidityParameterByStrategy"}}}]},{"name":"meteora_dlmm_claim_fee","discriminator":[78,116,98,78,50,82,72,37],"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":"LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"},{"name":"lb_pair","writable":true},{"name":"position","writable":true},{"name":"bin_array_lower","writable":true},{"name":"bin_array_upper","writable":true},{"name":"reserve_x","writable":true},{"name":"reserve_y","writable":true},{"name":"user_token_x","writable":true},{"name":"user_token_y","writable":true},{"name":"token_x_mint"},{"name":"token_y_mint"},{"name":"token_program"},{"name":"event_authority"},{"name":"program"}],"args":[]},{"name":"meteora_dlmm_close_position","discriminator":[186,117,42,24,221,194,34,143],"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":"LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"},{"name":"position","writable":true},{"name":"lb_pair","writable":true},{"name":"bin_array_lower","writable":true},{"name":"bin_array_upper","writable":true},{"name":"event_authority"},{"name":"program"}],"args":[]},{"name":"meteora_dlmm_initialize_position","discriminator":[223,94,215,96,175,181,195,204],"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":"LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"},{"name":"payer","writable":true,"signer":true},{"name":"position","writable":true,"signer":true},{"name":"lb_pair"},{"name":"system_program","address":"11111111111111111111111111111111"},{"name":"rent","address":"SysvarRent111111111111111111111111111111111"},{"name":"event_authority"},{"name":"program"}],"args":[{"name":"lower_bin_id","type":"i32"},{"name":"width","type":"i32"}]},{"name":"meteora_dlmm_remove_liquidity_by_range","discriminator":[223,12,177,181,96,109,60,124],"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":"LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"},{"name":"position","writable":true},{"name":"lb_pair","writable":true},{"name":"bin_array_bitmap_extension","writable":true},{"name":"user_token_x","writable":true},{"name":"user_token_y","writable":true},{"name":"reserve_x","writable":true},{"name":"reserve_y","writable":true},{"name":"token_x_mint"},{"name":"token_y_mint"},{"name":"bin_array_lower","writable":true},{"name":"bin_array_upper","writable":true},{"name":"token_x_program"},{"name":"token_y_program"},{"name":"event_authority"},{"name":"program"}],"args":[{"name":"from_bin_id","type":"i32"},{"name":"to_bin_id","type":"i32"},{"name":"bps_to_remove","type":"u16"}]},{"name":"meteora_dlmm_swap","discriminator":[127,64,37,138,173,243,207,84],"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":"LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"},{"name":"lb_pair","writable":true},{"name":"bin_array_bitmap_extension"},{"name":"reserve_x","writable":true},{"name":"reserve_y","writable":true},{"name":"user_token_in","writable":true},{"name":"user_token_out","writable":true},{"name":"token_x_mint"},{"name":"token_y_mint"},{"name":"oracle","writable":true},{"name":"host_fee_in","writable":true},{"name":"token_x_program"},{"name":"token_y_program"},{"name":"event_authority"},{"name":"program"}],"args":[{"name":"amount_in","type":"u64"},{"name":"min_amount_out","type":"u64"}]},{"name":"mint_tokens","docs":["Mints a specified amount of tokens for the given mint.","","# Parameters","- `ctx`: The context for the instruction.","- `mint_id`: The id of the mint to mint tokens for.","- `amount`: The amount of tokens to mint.","","# Permission required","- Permission::MintTokens","","# Integration required","- Integration::Mint"],"discriminator":[59,132,24,246,122,39,8,243],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_signer","writable":true,"signer":true},{"name":"glam_mint","writable":true},{"name":"mint_to","writable":true,"pda":{"seeds":[{"kind":"account","path":"recipient"},{"kind":"account","path":"token_2022_program"},{"kind":"account","path":"glam_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":"recipient"},{"name":"token_2022_program","address":"TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"}],"args":[{"name":"mint_id","type":"u8"},{"name":"amount","type":"u64"}]},{"name":"redeem","docs":["Redeems a specified amount of shares.","","# Parameters","- `ctx`: The context for the instruction.","- `amount`: The amount of shares to redeem.","- `in_kind`: Whether to redeem in kind.","- `skip_state`: Should always be true (state check to be implemented)."],"discriminator":[184,12,86,149,70,196,97,225],"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":"signer","writable":true,"signer":true},{"name":"signer_share_ata","writable":true},{"name":"signer_policy","writable":true,"optional":true,"pda":{"seeds":[{"kind":"const","value":[97,99,99,111,117,110,116,45,112,111,108,105,99,121]},{"kind":"account","path":"signer_share_ata"}]}},{"name":"system_program","address":"11111111111111111111111111111111"},{"name":"token_program","address":"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"},{"name":"token_2022_program","address":"TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"}],"args":[{"name":"amount","type":"u64"},{"name":"in_kind","type":"bool"},{"name":"skip_state","type":"bool"}]},{"name":"redelegate_stake","docs":["Redelegates an existing stake account to a new validator (a new stake account will be created).","","# Parameters","- `ctx`: The context for the instruction.","","# Permission required","- Permission::Unstake","","# Integration required","- Integration::NativeStaking"],"discriminator":[240,90,140,104,96,8,134,31],"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":"existing_stake","writable":true},{"name":"new_stake","writable":true},{"name":"vote"},{"name":"stake_config"},{"name":"clock","address":"SysvarC1ock11111111111111111111111111111111"},{"name":"stake_program","address":"Stake11111111111111111111111111111111111111"},{"name":"system_program","address":"11111111111111111111111111111111"}],"args":[]},{"name":"set_subscribe_redeem_enabled","docs":["Enables or disables the subscribe and redeem functionality.","","This allows the owner to pause/unpause subscription and redemption of a fund.","","# Parameters","- `ctx`: The context for the instruction.","- `enabled`: A boolean indicating whether to enable or disable the subscribe and redeem functionality.","","# Permission required","- Owner only, delegates not allowed"],"discriminator":[189,56,205,172,201,185,34,92],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_signer","writable":true,"signer":true}],"args":[{"name":"enabled","type":"bool"}]},{"name":"set_token_accounts_states","docs":["Sets the frozen state of the token accounts for the specified mint.","","# Parameters","- `ctx`: The context for the instruction.","- `mint_id`: The id of the mint to set the frozen state for.","- `frozen`: The new frozen state.","","# Permission required","- Permission::SetTokenAccountState","","# Integration required","- Integration::Mint"],"discriminator":[50,133,45,86,117,66,115,195],"accounts":[{"name":"glam_state"},{"name":"glam_signer","writable":true,"signer":true},{"name":"glam_mint","writable":true},{"name":"token_2022_program","address":"TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"}],"args":[{"name":"mint_id","type":"u8"},{"name":"frozen","type":"bool"}]},{"name":"split_stake_account","docs":["Splits from an existing stake account to get a new stake account.","","# Parameters","- `ctx`: The context for the instruction.","- `lamports`: The amount of SOL to split.","","# Permission required","- Permission::Unstake","","# Integration required","- Integration::NativeStaking"],"discriminator":[130,42,33,89,117,77,105,194],"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":"existing_stake","writable":true},{"name":"new_stake","writable":true},{"name":"clock","address":"SysvarC1ock11111111111111111111111111111111"},{"name":"stake_program","address":"Stake11111111111111111111111111111111111111"},{"name":"system_program","address":"11111111111111111111111111111111"}],"args":[{"name":"lamports","type":"u64"}]},{"name":"stake_pool_deposit_sol","docs":["Deposits SOL to a stake pool to get pool token.","","# Parameters","- `ctx`: The context for the instruction.","- `lamports`: The amount of SOL to deposit.","","# Permission required","- Permission::Stake","","# Integration required","- Integration::SplStakePool or Integration::SanctumStakePool, depending on the stake pool program used."],"discriminator":[147,187,91,151,158,187,247,79],"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":"stake_pool","writable":true},{"name":"withdraw_authority"},{"name":"reserve_stake","writable":true},{"name":"pool_mint","writable":true},{"name":"fee_account","writable":true},{"name":"mint_to","writable":true,"pda":{"seeds":[{"kind":"account","path":"glam_vault"},{"kind":"const","value":[6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169]},{"kind":"account","path":"pool_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":"stake_pool_program"},{"name":"associated_token_program","address":"ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"},{"name":"system_program","address":"11111111111111111111111111111111"},{"name":"token_program"}],"args":[{"name":"lamports","type":"u64"}]},{"name":"stake_pool_deposit_stake","docs":["Deposits a stake account to a stake pool to get pool token.","","# Parameters","- `ctx`: The context for the instruction.","","# Permission required","- Permission::Stake","","# Integration required","- Integration::SplStakePool or Integration::SanctumStakePool, depending on the stake pool program used."],"discriminator":[212,158,195,174,179,105,9,97],"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":"vault_stake_account","writable":true},{"name":"mint_to","writable":true,"pda":{"seeds":[{"kind":"account","path":"glam_vault"},{"kind":"const","value":[6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169]},{"kind":"account","path":"pool_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":"pool_mint","writable":true},{"name":"fee_account","writable":true},{"name":"stake_pool","writable":true},{"name":"deposit_authority"},{"name":"withdraw_authority"},{"name":"validator_list","writable":true},{"name":"validator_stake_account","writable":true},{"name":"reserve_stake_account","writable":true},{"name":"clock","address":"SysvarC1ock11111111111111111111111111111111"},{"name":"stake_history","address":"SysvarStakeHistory1111111111111111111111111"},{"name":"stake_pool_program"},{"name":"associated_token_program","address":"ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"},{"name":"system_program","address":"11111111111111111111111111111111"},{"name":"token_program"},{"name":"stake_program","address":"Stake11111111111111111111111111111111111111"}],"args":[]},{"name":"stake_pool_withdraw_sol","docs":["Unstakes from pool token to get SOL immediately.","","# Parameters","- `ctx`: The context for the instruction.","- `pool_token_amount`: Amount of pool token to unstake.","","# Permission required","- Permission::LiquidUnstake","","# Integration required","- Integration::SplStakePool or Integration::SanctumStakePool, depending on the stake pool program used."],"discriminator":[179,100,204,0,192,46,233,181],"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":"stake_pool","writable":true},{"name":"withdraw_authority"},{"name":"reserve_stake","writable":true},{"name":"pool_mint","writable":true},{"name":"fee_account","writable":true},{"name":"pool_token_ata","writable":true},{"name":"clock","address":"SysvarC1ock11111111111111111111111111111111"},{"name":"stake_history","address":"SysvarStakeHistory1111111111111111111111111"},{"name":"stake_pool_program"},{"name":"system_program","address":"11111111111111111111111111111111"},{"name":"token_program"},{"name":"stake_program","address":"Stake11111111111111111111111111111111111111"}],"args":[{"name":"pool_token_amount","type":"u64"}]},{"name":"stake_pool_withdraw_stake","docs":["Unstakes from pool token into a stake account.","","# Parameters","- `ctx`: The context for the instruction.","- `pool_token_amount`: Amount of pool token to unstake.","","# Permission required","- Permission::Unstake","","# Integration required","- Integration::SplStakePool or Integration::SanctumStakePool, depending on the stake pool program used."],"discriminator":[7,70,250,22,49,1,143,1],"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":"vault_stake_account","writable":true},{"name":"pool_mint","writable":true},{"name":"fee_account","writable":true},{"name":"stake_pool","writable":true},{"name":"withdraw_authority"},{"name":"validator_list","writable":true},{"name":"validator_stake_account","writable":true},{"name":"pool_token_ata","writable":true},{"name":"clock","address":"SysvarC1ock11111111111111111111111111111111"},{"name":"stake_pool_program"},{"name":"system_program","address":"11111111111111111111111111111111"},{"name":"token_program"},{"name":"stake_program","address":"Stake11111111111111111111111111111111111111"}],"args":[{"name":"pool_token_amount","type":"u64"}]},{"name":"subscribe","docs":["Subscribes to a specified amount of shares.","","# Parameters","- `ctx`: The context for the instruction.","- `amount`: The amount of shares to subscribe.","- `skip_state`: Should always be true (state check to be implemented)."],"discriminator":[254,28,191,138,156,179,183,53],"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":"signer_share_ata","writable":true,"pda":{"seeds":[{"kind":"account","path":"signer"},{"kind":"account","path":"token_2022_program"},{"kind":"account","path":"glam_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":"asset"},{"name":"vault_ata","writable":true},{"name":"signer_asset_ata","writable":true},{"name":"signer_policy","writable":true,"optional":true,"pda":{"seeds":[{"kind":"const","value":[97,99,99,111,117,110,116,45,112,111,108,105,99,121]},{"kind":"account","path":"signer_share_ata"}]}},{"name":"signer","writable":true,"signer":true},{"name":"system_program","address":"11111111111111111111111111111111"},{"name":"associated_token_program","address":"ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"},{"name":"token_program","address":"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"},{"name":"token_2022_program","address":"TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"}],"args":[{"name":"mint_id","type":"u8"},{"name":"amount","type":"u64"},{"name":"skip_state","type":"bool"}]},{"name":"transfer_hook","discriminator":[105,37,101,197,75,251,102,26],"accounts":[{"name":"src_account"},{"name":"mint"},{"name":"dst_account"},{"name":"owner"},{"name":"extra_account_meta_list","pda":{"seeds":[{"kind":"const","value":[101,120,116,114,97,45,97,99,99,111,117,110,116,45,109,101,116,97,115]},{"kind":"account","path":"mint"}]}},{"name":"state"},{"name":"src_account_policy","pda":{"seeds":[{"kind":"const","value":[97,99,99,111,117,110,116,45,112,111,108,105,99,121]},{"kind":"account","path":"src_account"}]}},{"name":"dst_account_policy","pda":{"seeds":[{"kind":"const","value":[97,99,99,111,117,110,116,45,112,111,108,105,99,121]},{"kind":"account","path":"dst_account"}]}}],"args":[{"name":"amount","type":"u64"}]},{"name":"transfer_sol_to_wsol","docs":["Transfer vault SOL to wSOL token account.","","# Parameters","- `ctx`: The context for the instruction.","- `lamports`: The amount of SOL to transfer.","","# Permission required","- Permission::WSolWrap"],"discriminator":[42,189,85,229,150,198,3,195],"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":"to","writable":true,"pda":{"seeds":[{"kind":"account","path":"glam_vault"},{"kind":"const","value":[6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169]},{"kind":"const","value":[6,155,136,87,254,171,129,132,251,104,127,99,70,24,192,53,218,196,57,220,26,235,59,85,152,160,240,0,0,0,0,1]}],"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":"system_program","address":"11111111111111111111111111111111"},{"name":"token_program","address":"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"},{"name":"associated_token_program","address":"ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"}],"args":[{"name":"lamports","type":"u64"}]},{"name":"update_mint","docs":["Updates an existing mint with new metadata.","","# Parameters","- `ctx`: The context for the instruction.","- `mint_id`: The id of the mint to be updated.","- `mint_model`: An instance of `MintModel` containing the updated metadata for the new mint.","","# Permission required","- Owner only, delegates not allowed"],"discriminator":[212,203,57,78,75,245,222,5],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_signer","writable":true,"signer":true},{"name":"glam_mint","writable":true},{"name":"token_2022_program","address":"TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"}],"args":[{"name":"mint_id","type":"u8"},{"name":"mint_model","type":{"defined":{"name":"MintModel"}}}]},{"name":"update_state","docs":["Updates an existing state account with new parameters.","","# Parameters","- `ctx`: The context for the instruction.","- `state`: An instance of `StateModel` containing the updated details of the state.","","# Permission required","- Owner only, delegates not allowed"],"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":"withdraw","docs":["Withdraw asset from vault into owner\'s wallet.","","# Parameters","- `ctx`: The context for the instruction.","- `amount`: The amount to withdraw.","","# Permission required","- Owner only, delegates not allowed"],"discriminator":[183,18,70,156,148,109,161,34],"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":"asset"},{"name":"vault_ata","writable":true,"pda":{"seeds":[{"kind":"account","path":"glam_vault"},{"kind":"account","path":"token_program"},{"kind":"account","path":"asset"}],"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":"signer_ata","writable":true,"pda":{"seeds":[{"kind":"account","path":"glam_signer"},{"kind":"account","path":"token_program"},{"kind":"account","path":"asset"}],"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":"token_program"}],"args":[{"name":"amount","type":"u64"}]},{"name":"withdraw_from_stake_accounts","docs":["Withdraws SOL from stake accounts.","","# Parameters","- `ctx`: The context for the instruction.","","# Permission required","- Permission::Unstake","","# Integration required","- Integration::NativeStaking"],"discriminator":[93,209,100,231,169,160,192,197],"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":"clock","address":"SysvarC1ock11111111111111111111111111111111"},{"name":"stake_history","address":"SysvarStakeHistory1111111111111111111111111"},{"name":"stake_program","address":"Stake11111111111111111111111111111111111111"}],"args":[]},{"name":"wsol_unwrap","docs":["Unwraps all wSOL to get SOL.","","# Parameters","- `ctx`: The context for the instruction.","","# Permission required","- Permission::WSolUnwrap"],"discriminator":[123,189,16,96,233,186,54,215],"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":"vault_wsol_ata","writable":true,"pda":{"seeds":[{"kind":"account","path":"glam_vault"},{"kind":"const","value":[6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169]},{"kind":"const","value":[6,155,136,87,254,171,129,132,251,104,127,99,70,24,192,53,218,196,57,220,26,235,59,85,152,160,240,0,0,0,0,1]}],"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":"token_program","address":"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"}],"args":[]},{"name":"wsol_wrap","docs":["Wraps SOL to get wSOL.","","# Parameters","- `ctx`: The context for the instruction.","- `lamports`: The amount of SOL to wrap.","","# Permission required","- Permission::WSolWrap"],"discriminator":[26,2,139,159,239,195,193,9],"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":"vault_wsol_ata","writable":true,"pda":{"seeds":[{"kind":"account","path":"glam_vault"},{"kind":"const","value":[6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169]},{"kind":"account","path":"wsol_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":"wsol_mint"},{"name":"system_program","address":"11111111111111111111111111111111"},{"name":"token_program","address":"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"},{"name":"associated_token_program","address":"ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"}],"args":[{"name":"lamports","type":"u64"}]}],"accounts":[{"name":"OpenfundsMetadataAccount","discriminator":[5,89,20,76,255,158,209,219]},{"name":"PolicyAccount","discriminator":[218,201,183,164,156,127,81,175]},{"name":"StateAccount","discriminator":[142,247,54,95,85,133,249,103]}],"errors":[{"code":48000,"name":"NotAuthorized","msg":"Signer is not authorized"},{"code":48001,"name":"IntegrationDisabled","msg":"Integration is disabled"},{"code":48002,"name":"StateAccountDisabled","msg":"State account is disabled"},{"code":48003,"name":"InvalidSignerAccount","msg":"Invalid signer ata"},{"code":49000,"name":"InvalidAccountType","msg":"Invalid account type"},{"code":49001,"name":"InvalidName","msg":"Name too long: max 64 chars"},{"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":"CloseNotEmptyError","msg":"Error closing state account: not empty"},{"code":49006,"name":"NoShareClass","msg":"No share class found"},{"code":49007,"name":"ShareClassesNotClosed","msg":"Glam state account can\'t be closed. Close share classes first"},{"code":49008,"name":"InvalidShareClass","msg":"Share class not allowed to subscribe"},{"code":49009,"name":"InvalidAssetSubscribe","msg":"Asset not allowed to subscribe"},{"code":49010,"name":"InvalidPricingOracle","msg":"Invalid oracle for asset price"},{"code":49011,"name":"InvalidRemainingAccounts","msg":"Invalid accounts: the transaction is malformed"},{"code":49012,"name":"InvalidVaultTokenAccount","msg":"Invalid vault ata"},{"code":49013,"name":"ShareClassNotEmpty","msg":"Share class mint supply not zero"},{"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":"InvalidSwap","msg":"Swap failed"},{"code":50003,"name":"InvalidTokenAccount","msg":"Invalid token account"},{"code":50004,"name":"InvalidVoteSide","msg":"Invalid vote side"},{"code":51000,"name":"InvalidAssetPrice","msg":"Invalid asset price"},{"code":51001,"name":"InvalidStableCoinPriceForSubscribe","msg":"Subscription not allowed: invalid stable coin price"},{"code":51002,"name":"SubscribeRedeemDisable","msg":"Subscription and redemption disabled"},{"code":51003,"name":"InvalidPolicyAccount","msg":"Policy account is mandatory"},{"code":51004,"name":"PriceTooOld","msg":"Price is too old"},{"code":52000,"name":"TransfersDisabled","msg":"Policy violation: transfers disabled"},{"code":52001,"name":"AmountTooBig","msg":"Policy violation: amount too big"},{"code":52002,"name":"LockUp","msg":"Policy violation: lock-up period"}],"types":[{"name":"AccountType","type":{"kind":"enum","variants":[{"name":"Vault"},{"name":"Mint"},{"name":"Fund"}]}},{"name":"CompanyField","type":{"kind":"struct","fields":[{"name":"name","type":{"defined":{"name":"CompanyFieldName"}}},{"name":"value","type":"string"}]}},{"name":"CompanyFieldName","type":{"kind":"enum","variants":[{"name":"FundGroupName"},{"name":"ManCo"},{"name":"DomicileOfManCo"},{"name":"BICOfCustodian"},{"name":"CollateralManagerName"},{"name":"CustodianBankName"},{"name":"DomicileOfCustodianBank"},{"name":"FundAdministratorName"},{"name":"FundAdvisorName"},{"name":"FundPromoterName"},{"name":"IsSelfManagedInvestmentCompany"},{"name":"LEIOfCustodianBank"},{"name":"LEIOfManCo"},{"name":"PortfolioManagingCompanyName"},{"name":"SecuritiesLendingCounterpartyName"},{"name":"SwapCounterpartyName"},{"name":"AddressofManCo"},{"name":"AuditorName"},{"name":"CityofManCo"},{"name":"EmailAddressOfManCo"},{"name":"FundWebsiteOfManCo"},{"name":"IsUNPRISignatory"},{"name":"PhoneCountryCodeofManCo"},{"name":"PhoneNumberofManCo"},{"name":"SubInvestmentAdvisorName"},{"name":"ZIPCodeofManCo"},{"name":"DomicileOfUmbrella"},{"name":"HasUmbrella"},{"name":"LEIOfUmbrella"},{"name":"Umbrella"},{"name":"GlobalIntermediaryIdentificationNumberOfUmbrella"}]}},{"name":"CompanyModel","type":{"kind":"struct","fields":[{"name":"fund_group_name","type":{"option":"string"}},{"name":"man_co","type":{"option":"string"}},{"name":"domicile_of_man_co","type":{"option":"string"}},{"name":"email_address_of_man_co","type":{"option":"string"}},{"name":"fund_website_of_man_co","type":{"option":"string"}}]}},{"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":"permissions","type":{"vec":{"defined":{"name":"Permission"}}}},{"name":"expires_at","type":"i64"}]}},{"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":"Allowlist"},{"name":"Blocklist"},{"name":"ExternalVaultAccounts"},{"name":"LockUp"},{"name":"DriftMarketIndexesPerp"},{"name":"DriftMarketIndexesSpot"},{"name":"DriftOrderTypes"},{"name":"MaxSwapSlippageBps"}]}},{"name":"EngineFieldValue","type":{"kind":"enum","variants":[{"name":"Boolean","fields":[{"name":"val","type":"bool"}]},{"name":"Date","fields":[{"name":"val","type":"string"}]},{"name":"Double","fields":[{"name":"val","type":"i64"}]},{"name":"Integer","fields":[{"name":"val","type":"i32"}]},{"name":"String","fields":[{"name":"val","type":"string"}]},{"name":"Time","fields":[{"name":"val","type":"string"}]},{"name":"U8","fields":[{"name":"val","type":"u8"}]},{"name":"U64","fields":[{"name":"val","type":"u64"}]},{"name":"Pubkey","fields":[{"name":"val","type":"pubkey"}]},{"name":"Percentage","fields":[{"name":"val","type":"u32"}]},{"name":"URI","fields":[{"name":"val","type":"string"}]},{"name":"Timestamp","fields":[{"name":"val","type":"i64"}]},{"name":"VecPubkey","fields":[{"name":"val","type":{"vec":"pubkey"}}]},{"name":"VecU32","fields":[{"name":"val","type":{"vec":"u32"}}]}]}},{"name":"FundField","type":{"kind":"struct","fields":[{"name":"name","type":{"defined":{"name":"FundFieldName"}}},{"name":"value","type":"string"}]}},{"name":"FundFieldName","type":{"kind":"enum","variants":[{"name":"FundDomicileAlpha2"},{"name":"FundDomicileAlpha3"},{"name":"LegalFundNameIncludingUmbrella"},{"name":"FiscalYearEnd"},{"name":"FundCurrency"},{"name":"FundLaunchDate"},{"name":"InvestmentObjective"},{"name":"IsETC"},{"name":"IsEUDirectiveRelevant"},{"name":"IsFundOfFunds"},{"name":"IsPassiveFund"},{"name":"IsREIT"},{"name":"LegalForm"},{"name":"LegalFundNameOnly"},{"name":"OpenEndedOrClosedEndedFundStructure"},{"name":"TypeOfEUDirective"},{"name":"UCITSVersion"},{"name":"CurrencyHedgePortfolio"},{"name":"DepositoryName"},{"name":"FundValuationPoint"},{"name":"FundValuationPointTimeZone"},{"name":"FundValuationPointTimeZoneUsingTZDatabase"},{"name":"HasCollateralManager"},{"name":"HasEmbeddedDerivatives"},{"name":"HasSecuritiesLending"},{"name":"HasSwap"},{"name":"IsLeveraged"},{"name":"IsShariaCompliant"},{"name":"IsShort"},{"name":"LEIofDepositoryBank"},{"name":"LEIOfFund"},{"name":"LocationOfBearerShare"},{"name":"LocationOfShareRegister"},{"name":"MaximumLeverageInFund"},{"name":"MiFIDSecuritiesClassification"},{"name":"MoneyMarketTypeOfFund"},{"name":"TrusteeName"},{"name":"AuMFund"},{"name":"AuMFundDate"},{"name":"NoSFund"},{"name":"NoSFundDate"}]}},{"name":"FundManagerField","type":{"kind":"struct","fields":[{"name":"name","type":{"defined":{"name":"FundManagerFieldName"}}},{"name":"value","type":"string"}]}},{"name":"FundManagerFieldName","type":{"kind":"enum","variants":[{"name":"PortfolioManagerForename"},{"name":"PortfolioManagerName"},{"name":"PortfolioManagerYearOfBirth"},{"name":"PortfolioManagerYearOfExperienceStart"},{"name":"PortfolioManagerBriefBiography"},{"name":"PortfolioManagerType"},{"name":"PortfolioManagerRoleStartingDate"},{"name":"PortfolioManagerRoleEndDate"}]}},{"name":"FundOpenfundsModel","type":{"kind":"struct","fields":[{"name":"fund_domicile_alpha_2","type":{"option":"string"}},{"name":"legal_fund_name_including_umbrella","type":{"option":"string"}},{"name":"fiscal_year_end","type":{"option":"string"}},{"name":"fund_currency","type":{"option":"string"}},{"name":"fund_launch_date","type":{"option":"string"}},{"name":"investment_objective","type":{"option":"string"}},{"name":"is_etc","type":{"option":"bool"}},{"name":"is_eu_directive_relevant","type":{"option":"bool"}},{"name":"is_fund_of_funds","type":{"option":"bool"}},{"name":"is_passive_fund","type":{"option":"bool"}},{"name":"is_reit","type":{"option":"bool"}},{"name":"legal_form","type":{"option":"string"}},{"name":"legal_fund_name_only","type":{"option":"string"}},{"name":"open_ended_or_closed_ended_fund_structure","type":{"option":"string"}},{"name":"type_of_eu_directive","type":{"option":"string"}},{"name":"ucits_version","type":{"option":"string"}}]}},{"name":"InitObligationArgs","type":{"kind":"struct","fields":[{"name":"tag","type":"u8"},{"name":"id","type":"u8"}]}},{"name":"Integration","type":{"kind":"enum","variants":[{"name":"Drift"},{"name":"SplStakePool"},{"name":"SanctumStakePool"},{"name":"NativeStaking"},{"name":"Marinade"},{"name":"JupiterSwap"},{"name":"JupiterVote"},{"name":"KaminoLending"},{"name":"MeteoraDlmm"}]}},{"name":"LiquidityParameterByStrategy","type":{"kind":"struct","fields":[{"name":"amount_x","type":"u64"},{"name":"amount_y","type":"u64"},{"name":"active_id","type":"i32"},{"name":"max_active_bin_slippage","type":"i32"},{"name":"strategy_parameters","type":{"defined":{"name":"StrategyParameters"}}}]}},{"name":"ManagerKind","type":{"kind":"enum","variants":[{"name":"Wallet"},{"name":"Squads"}]}},{"name":"ManagerModel","type":{"kind":"struct","fields":[{"name":"portfolio_manager_name","type":{"option":"string"}},{"name":"pubkey","type":{"option":"pubkey"}},{"name":"kind","type":{"option":{"defined":{"name":"ManagerKind"}}}}]}},{"name":"MarketType","type":{"kind":"enum","variants":[{"name":"Spot"},{"name":"Perp"}]}},{"name":"Metadata","type":{"kind":"struct","fields":[{"name":"template","type":{"defined":{"name":"MetadataTemplate"}}},{"name":"pubkey","type":"pubkey"},{"name":"uri","type":"string"}]}},{"name":"MetadataTemplate","type":{"kind":"enum","variants":[{"name":"Openfunds"}]}},{"name":"MintModel","type":{"kind":"struct","fields":[{"name":"symbol","type":{"option":"string"}},{"name":"name","type":{"option":"string"}},{"name":"uri","type":{"option":"string"}},{"name":"state_pubkey","type":{"option":"pubkey"}},{"name":"asset","type":{"option":"pubkey"}},{"name":"image_uri","type":{"option":"string"}},{"name":"allowlist","type":{"option":{"vec":"pubkey"}}},{"name":"blocklist","type":{"option":{"vec":"pubkey"}}},{"name":"lock_up_period_in_seconds","type":{"option":"i32"}},{"name":"permanent_delegate","type":{"option":"pubkey"}},{"name":"default_account_state_frozen","type":{"option":"bool"}},{"name":"is_raw_openfunds","type":{"option":"bool"}},{"name":"raw_openfunds","type":{"option":{"defined":{"name":"MintOpenfundsModel"}}}}]}},{"name":"MintOpenfundsModel","type":{"kind":"struct","fields":[{"name":"isin","type":{"option":"string"}},{"name":"share_class_currency","type":{"option":"string"}},{"name":"currency_of_minimal_subscription","type":{"option":"string"}},{"name":"full_share_class_name","type":{"option":"string"}},{"name":"investment_status","type":{"option":"string"}},{"name":"minimal_initial_subscription_category","type":{"option":"string"}},{"name":"minimal_initial_subscription_in_amount","type":{"option":"string"}},{"name":"minimal_initial_subscription_in_shares","type":{"option":"string"}},{"name":"share_class_distribution_policy","type":{"option":"string"}},{"name":"share_class_extension","type":{"option":"string"}},{"name":"share_class_launch_date","type":{"option":"string"}},{"name":"share_class_lifecycle","type":{"option":"string"}},{"name":"launch_price","type":{"option":"string"}},{"name":"launch_price_currency","type":{"option":"string"}},{"name":"launch_price_date","type":{"option":"string"}},{"name":"currency_of_minimal_or_maximum_redemption","type":{"option":"string"}},{"name":"has_lock_up_for_redemption","type":{"option":"bool"}},{"name":"is_valid_isin","type":{"option":"bool"}},{"name":"lock_up_comment","type":{"option":"string"}},{"name":"lock_up_period_in_days","type":{"option":"string"}},{"name":"maximum_initial_redemption_in_amount","type":{"option":"string"}},{"name":"maximum_initial_redemption_in_shares","type":{"option":"string"}},{"name":"minimal_initial_redemption_in_amount","type":{"option":"string"}},{"name":"minimal_initial_redemption_in_shares","type":{"option":"string"}},{"name":"minimal_redemption_category","type":{"option":"string"}},{"name":"share_class_dividend_type","type":{"option":"string"}},{"name":"cusip","type":{"option":"string"}},{"name":"valor","type":{"option":"string"}}]}},{"name":"ModifyOrderParams","type":{"kind":"struct","fields":[{"name":"direction","type":{"option":{"defined":{"name":"PositionDirection"}}}},{"name":"base_asset_amount","type":{"option":"u64"}},{"name":"price","type":{"option":"u64"}},{"name":"reduce_only","type":{"option":"bool"}},{"name":"post_only","type":{"option":{"defined":{"name":"PostOnlyParam"}}}},{"name":"immediate_or_cancel","type":{"option":"bool"}},{"name":"max_ts","type":{"option":"i64"}},{"name":"trigger_price","type":{"option":"u64"}},{"name":"trigger_condition","type":{"option":{"defined":{"name":"OrderTriggerCondition"}}}},{"name":"oracle_price_offset","type":{"option":"i32"}},{"name":"auction_duration","type":{"option":"u8"}},{"name":"auction_start_price","type":{"option":"i64"}},{"name":"auction_end_price","type":{"option":"i64"}},{"name":"policy","type":{"option":"u8"}}]}},{"name":"OpenfundsMetadataAccount","type":{"kind":"struct","fields":[{"name":"fund_id","type":"pubkey"},{"name":"company","type":{"vec":{"defined":{"name":"CompanyField"}}}},{"name":"fund","type":{"vec":{"defined":{"name":"FundField"}}}},{"name":"share_classes","type":{"vec":{"vec":{"defined":{"name":"ShareClassField"}}}}},{"name":"fund_managers","type":{"vec":{"vec":{"defined":{"name":"FundManagerField"}}}}}]}},{"name":"OrderParams","type":{"kind":"struct","fields":[{"name":"order_type","type":{"defined":{"name":"OrderType"}}},{"name":"market_type","type":{"defined":{"name":"MarketType"}}},{"name":"direction","type":{"defined":{"name":"PositionDirection"}}},{"name":"user_order_id","type":"u8"},{"name":"base_asset_amount","type":"u64"},{"name":"price","type":"u64"},{"name":"market_index","type":"u16"},{"name":"reduce_only","type":"bool"},{"name":"post_only","type":{"defined":{"name":"PostOnlyParam"}}},{"name":"immediate_or_cancel","type":"bool"},{"name":"max_ts","type":{"option":"i64"}},{"name":"trigger_price","type":{"option":"u64"}},{"name":"trigger_condition","type":{"defined":{"name":"OrderTriggerCondition"}}},{"name":"oracle_price_offset","type":{"option":"i32"}},{"name":"auction_duration","type":{"option":"u8"}},{"name":"auction_start_price","type":{"option":"i64"}},{"name":"auction_end_price","type":{"option":"i64"}}]}},{"name":"OrderTriggerCondition","type":{"kind":"enum","variants":[{"name":"Above"},{"name":"Below"},{"name":"TriggeredAbove"},{"name":"TriggeredBelow"}]}},{"name":"OrderType","type":{"kind":"enum","variants":[{"name":"Market"},{"name":"Limit"},{"name":"TriggerMarket"},{"name":"TriggerLimit"},{"name":"Oracle"}]}},{"name":"Permission","docs":["* Delegate ACL"],"type":{"kind":"enum","variants":[{"name":"DriftInitialize"},{"name":"DriftUpdateUser"},{"name":"DriftDeleteUser"},{"name":"DriftDeposit"},{"name":"DriftWithdraw"},{"name":"DriftPlaceOrders"},{"name":"DriftCancelOrders"},{"name":"DriftPerpMarket"},{"name":"DriftSpotMarket"},{"name":"Stake"},{"name":"Unstake"},{"name":"LiquidUnstake"},{"name":"JupiterSwapAllowlisted"},{"name":"JupiterSwapAny"},{"name":"WSolWrap"},{"name":"WSolUnwrap"},{"name":"MintTokens"},{"name":"BurnTokens"},{"name":"ForceTransferTokens"},{"name":"SetTokenAccountState"},{"name":"StakeJup"},{"name":"VoteOnProposal"},{"name":"UnstakeJup"},{"name":"JupiterSwapLst"},{"name":"KaminoInit"},{"name":"KaminoDeposit"},{"name":"DriftModifyOrders"},{"name":"MeteoraDlmmInitPosition"},{"name":"MeteoraDlmmClosePosition"},{"name":"MeteoraDlmmLiquidity"},{"name":"MeteoraDlmmSwap"}]}},{"name":"PolicyAccount","type":{"kind":"struct","fields":[{"name":"locked_until_ts","type":"i64"}]}},{"name":"PositionDirection","type":{"kind":"enum","variants":[{"name":"Long"},{"name":"Short"}]}},{"name":"PostOnlyParam","type":{"kind":"enum","variants":[{"name":"None"},{"name":"MustPostOnly"},{"name":"TryPostOnly"},{"name":"Slide"}]}},{"name":"ShareClassField","type":{"kind":"struct","fields":[{"name":"name","type":{"defined":{"name":"ShareClassFieldName"}}},{"name":"value","type":"string"}]}},{"name":"ShareClassFieldName","type":{"kind":"enum","variants":[{"name":"ISIN"},{"name":"ShareClassCurrency"},{"name":"AppliedSubscriptionFeeInFavourOfDistributor"},{"name":"AppliedSubscriptionFeeInFavourOfDistributorReferenceDate"},{"name":"CurrencyOfMinimalSubscription"},{"name":"FullShareClassName"},{"name":"HasPerformanceFee"},{"name":"HasSubscriptionFeeInFavourOfDistributor"},{"name":"InvestmentStatus"},{"name":"ManagementFeeApplied"},{"name":"ManagementFeeAppliedReferenceDate"},{"name":"ManagementFeeMaximum"},{"name":"MaximumSubscriptionFeeInFavourOfDistributor"},{"name":"MinimalInitialSubscriptionCategory"},{"name":"MinimalInitialSubscriptionInAmount"},{"name":"MinimalInitialSubscriptionInShares"},{"name":"MinimalSubsequentSubscriptionCategory"},{"name":"MinimalSubsequentSubscriptionInAmount"},{"name":"MinimalSubsequentSubscriptionInShares"},{"name":"MinimumSubscriptionFeeInFavourOfDistributor"},{"name":"ShareClassDistributionPolicy"},{"name":"ShareClassExtension"},{"name":"ShareClassLaunchDate"},{"name":"ShareClassLifecycle"},{"name":"SRRI"},{"name":"LaunchPrice"},{"name":"LaunchPriceCurrency"},{"name":"LaunchPriceDate"},{"name":"HasAppliedSubscriptionFeeInFavourOfFund"},{"name":"AppliedSubscriptionFeeInFavourOfFund"},{"name":"AppliedSubscriptionFeeInFavourOfFundReferenceDate"},{"name":"MaximumSubscriptionFeeInFavourOfFund"},{"name":"HasAppliedRedemptionFeeInFavourOfFund"},{"name":"AppliedRedemptionFeeInFavourOfFund"},{"name":"AppliedRedemptionFeeInFavourOfFundReferenceDate"},{"name":"MaximumRedemptionFeeInFavourOfFund"},{"name":"AppliedRedemptionFeeInFavourOfDistributor"},{"name":"AppliedRedemptionFeeInFavourOfDistributorReferenceDate"},{"name":"CurrencyOfMinimalOrMaximumRedemption"},{"name":"CutOffDateOffsetForRedemption"},{"name":"CutOffDateOffsetForSubscription"},{"name":"CutOffTimeForRedemption"},{"name":"CutOffTimeForSubscription"},{"name":"HasLockUpForRedemption"},{"name":"HasRedemptionFeeInFavourOfDistributor"},{"name":"IsValidISIN"},{"name":"LockUpComment"},{"name":"LockUpPeriodInDays"},{"name":"ManagementFeeMinimum"},{"name":"MaximalNumberOfPossibleDecimalsAmount"},{"name":"MaximalNumberOfPossibleDecimalsNAV"},{"name":"MaximalNumberOfPossibleDecimalsShares"},{"name":"MaximumInitialRedemptionInAmount"},{"name":"MaximumInitialRedemptionInShares"},{"name":"MaximumRedemptionFeeInFavourOfDistributor"},{"name":"MaximumSubsequentRedemptionInAmount"},{"name":"MaximumSubsequentRedemptionInShares"},{"name":"MinimalInitialRedemptionInAmount"},{"name":"MinimalInitialRedemptionInShares"},{"name":"MinimalRedemptionCategory"},{"name":"MinimalSubsequentRedemptionInAmount"},{"name":"MinimalSubsequentRedemptionInShares"},{"name":"MinimumRedemptionFeeInFavourOfDistributor"},{"name":"MinimumRedemptionFeeInFavourOfFund"},{"name":"MinimumSubscriptionFeeInFavourOfFund"},{"name":"PerformanceFeeMinimum"},{"name":"RoundingMethodForPrices"},{"name":"RoundingMethodForRedemptionInAmount"},{"name":"RoundingMethodForRedemptionInShares"},{"name":"RoundingMethodForSubscriptionInAmount"},{"name":"RoundingMethodForSubscriptionInShares"},{"name":"ShareClassDividendType"},{"name":"CUSIP"},{"name":"Valor"},{"name":"FundId"},{"name":"ImageUri"}]}},{"name":"StateAccount","type":{"kind":"struct","fields":[{"name":"account_type","type":{"defined":{"name":"AccountType"}}},{"name":"owner","type":"pubkey"},{"name":"vault","type":"pubkey"},{"name":"enabled","type":"bool"},{"name":"created","type":{"defined":{"name":"CreatedModel"}}},{"name":"engine","type":"pubkey"},{"name":"mints","type":{"vec":"pubkey"}},{"name":"metadata","type":{"option":{"defined":{"name":"Metadata"}}}},{"name":"name","type":"string"},{"name":"uri","type":"string"},{"name":"assets","type":{"vec":"pubkey"}},{"name":"delegate_acls","type":{"vec":{"defined":{"name":"DelegateAcl"}}}},{"name":"integrations","type":{"vec":{"defined":{"name":"Integration"}}}},{"name":"params","type":{"vec":{"vec":{"defined":{"name":"EngineField"}}}}}]}},{"name":"StateModel","type":{"kind":"struct","fields":[{"name":"id","type":{"option":"pubkey"}},{"name":"account_type","type":{"option":{"defined":{"name":"AccountType"}}}},{"name":"name","type":{"option":"string"}},{"name":"uri","type":{"option":"string"}},{"name":"enabled","type":{"option":"bool"}},{"name":"assets","type":{"option":{"vec":"pubkey"}}},{"name":"external_vault_accounts","type":{"option":{"vec":"pubkey"}}},{"name":"mints","type":{"option":{"vec":{"defined":{"name":"MintModel"}}}}},{"name":"company","type":{"option":{"defined":{"name":"CompanyModel"}}}},{"name":"owner","type":{"option":{"defined":{"name":"ManagerModel"}}}},{"name":"created","type":{"option":{"defined":{"name":"CreatedModel"}}}},{"name":"delegate_acls","type":{"option":{"vec":{"defined":{"name":"DelegateAcl"}}}}},{"name":"integrations","type":{"option":{"vec":{"defined":{"name":"Integration"}}}}},{"name":"drift_market_indexes_perp","type":{"option":{"vec":"u32"}}},{"name":"drift_market_indexes_spot","type":{"option":{"vec":"u32"}}},{"name":"drift_order_types","type":{"option":{"vec":"u32"}}},{"name":"metadata","type":{"option":{"defined":{"name":"Metadata"}}}},{"name":"raw_openfunds","type":{"option":{"defined":{"name":"FundOpenfundsModel"}}}}]}},{"name":"StrategyParameters","type":{"kind":"struct","fields":[{"name":"min_bin_id","type":"i32"},{"name":"max_bin_id","type":"i32"},{"name":"strategy_type","type":{"defined":{"name":"StrategyType"}}},{"name":"parameteres","type":{"array":["u8",64]}}]}},{"name":"StrategyType","type":{"kind":"enum","variants":[{"name":"SpotOneSide"},{"name":"CurveOneSide"},{"name":"BidAskOneSide"},{"name":"SpotBalanced"},{"name":"CurveBalanced"},{"name":"BidAskBalanced"},{"name":"SpotImBalanced"},{"name":"CurveImBalanced"},{"name":"BidAskImBalanced"}]}}],"constants":[{"name":"SEED_METADATA","type":"string","value":"\\"metadata\\""},{"name":"SEED_MINT","type":"string","value":"\\"mint\\""},{"name":"SEED_STATE","type":"string","value":"\\"state\\""},{"name":"SEED_VAULT","type":"string","value":"\\"vault\\""}]}');
|
|
83
84
|
|
|
84
85
|
/***/ }),
|
|
85
86
|
/* 7 */
|
|
@@ -87,7 +88,7 @@ module.exports = /*#__PURE__*/JSON.parse('{"address":"GLAMbTqav9N9witRjswJ8enwp9
|
|
|
87
88
|
|
|
88
89
|
|
|
89
90
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
90
|
-
exports.DelegateAcl = exports.CreatedModel = exports.ManagerModel = exports.Metadata = exports.CompanyModel = exports.
|
|
91
|
+
exports.DelegateAcl = exports.CreatedModel = exports.ManagerModel = exports.Metadata = exports.CompanyModel = exports.MintOpenfundsModel = exports.MintModel = exports.MintIdlModel = exports.FundOpenfundsModel = exports.StateModel = exports.StateIdlModel = exports.GlamPermissions = exports.GlamIntegrations = void 0;
|
|
91
92
|
const glamExports_1 = __webpack_require__(4);
|
|
92
93
|
const web3_js_1 = __webpack_require__(5);
|
|
93
94
|
const spl_token_1 = __webpack_require__(8);
|
|
@@ -236,7 +237,7 @@ class StateModel extends StateIdlModel {
|
|
|
236
237
|
// @ts-ignore
|
|
237
238
|
mintOpenfundsFields[name] = value;
|
|
238
239
|
});
|
|
239
|
-
mintIdlModel["rawOpenfunds"] = new
|
|
240
|
+
mintIdlModel["rawOpenfunds"] = new MintOpenfundsModel(mintOpenfundsFields);
|
|
240
241
|
}
|
|
241
242
|
if (glamMint) {
|
|
242
243
|
const extMetadata = (0, spl_token_1.getExtensionData)(spl_token_1.ExtensionType.TokenMetadata, glamMint.tlvData);
|
|
@@ -319,7 +320,7 @@ class MintModel extends MintIdlModel {
|
|
|
319
320
|
}
|
|
320
321
|
}
|
|
321
322
|
exports.MintModel = MintModel;
|
|
322
|
-
class
|
|
323
|
+
class MintOpenfundsModel {
|
|
323
324
|
constructor(obj) {
|
|
324
325
|
this.isin = obj.isin ?? null;
|
|
325
326
|
this.shareClassCurrency = obj.shareClassCurrency ?? null;
|
|
@@ -361,7 +362,7 @@ class MintClassOpenfundsModel {
|
|
|
361
362
|
this.valor = obj.valor ?? null;
|
|
362
363
|
}
|
|
363
364
|
}
|
|
364
|
-
exports.
|
|
365
|
+
exports.MintOpenfundsModel = MintOpenfundsModel;
|
|
365
366
|
class CompanyModel {
|
|
366
367
|
constructor(data) {
|
|
367
368
|
this.fundGroupName = data.fundGroupName ?? null;
|
|
@@ -497,6 +498,7 @@ const staking_1 = __webpack_require__(26);
|
|
|
497
498
|
const state_1 = __webpack_require__(28);
|
|
498
499
|
const mint_1 = __webpack_require__(29);
|
|
499
500
|
const kamino_1 = __webpack_require__(30);
|
|
501
|
+
const meteora_1 = __webpack_require__(32);
|
|
500
502
|
var base_2 = __webpack_require__(13);
|
|
501
503
|
Object.defineProperty(exports, "JUPITER_API_DEFAULT", ({ enumerable: true, get: function () { return base_2.JUPITER_API_DEFAULT; } }));
|
|
502
504
|
/**
|
|
@@ -568,6 +570,12 @@ class GlamClient extends base_1.BaseClient {
|
|
|
568
570
|
}
|
|
569
571
|
return this._kaminoLending;
|
|
570
572
|
}
|
|
573
|
+
get meteoraDlmm() {
|
|
574
|
+
if (!this._meteoraDlmm) {
|
|
575
|
+
this._meteoraDlmm = new meteora_1.MeteoraDlmmClient(this);
|
|
576
|
+
}
|
|
577
|
+
return this._meteoraDlmm;
|
|
578
|
+
}
|
|
571
579
|
}
|
|
572
580
|
exports.GlamClient = GlamClient;
|
|
573
581
|
|
|
@@ -709,8 +717,13 @@ class BaseClient {
|
|
|
709
717
|
// - when we run tests with failure cases, this RPC call fails with an incorrect error message so we should ignore it by default
|
|
710
718
|
// - gui: wallet apps usually do the simulation themselves, we should ignore the simulation error here by default
|
|
711
719
|
// - cli: we should set simulate=true
|
|
712
|
-
if (simulate)
|
|
720
|
+
if (simulate) {
|
|
721
|
+
tx.recentBlockhash = recentBlockhash;
|
|
722
|
+
tx.feePayer = signer;
|
|
723
|
+
console.log("Tx payload:", tx.serialize({ verifySignatures: false }).toString("base64"));
|
|
724
|
+
console.error("Simulation failed.");
|
|
713
725
|
throw e;
|
|
726
|
+
}
|
|
714
727
|
}
|
|
715
728
|
if (computeUnitLimit) {
|
|
716
729
|
const vTx = new web3_js_1.VersionedTransaction(new web3_js_1.TransactionMessage({
|
|
@@ -727,7 +740,7 @@ class BaseClient {
|
|
|
727
740
|
instructions,
|
|
728
741
|
}).compileToV0Message(lookupTables));
|
|
729
742
|
}
|
|
730
|
-
async sendAndConfirm(tx,
|
|
743
|
+
async sendAndConfirm(tx, additionalSigners = []) {
|
|
731
744
|
const connection = this.provider.connection;
|
|
732
745
|
// Mainnet only: use dedicated connection for sending transactions if available
|
|
733
746
|
const txConnection = this.cluster === clientConfig_1.ClusterNetwork.Mainnet
|
|
@@ -741,21 +754,19 @@ class BaseClient {
|
|
|
741
754
|
// txs, for example transfer SOL, create ATA, etc.
|
|
742
755
|
if (tx instanceof web3_js_1.Transaction) {
|
|
743
756
|
return await (0, web3_js_1.sendAndConfirmTransaction)(txConnection, tx, [
|
|
744
|
-
|
|
757
|
+
this.getWallet().payer,
|
|
758
|
+
...additionalSigners,
|
|
745
759
|
]);
|
|
746
760
|
}
|
|
747
761
|
let serializedTx;
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
// https://github.com/coral-xyz/anchor/blob/v0.30.0/ts/packages/anchor/src/provider.ts#L159
|
|
755
|
-
const wallet = this.getWallet();
|
|
756
|
-
const signedTx = await wallet.signTransaction(tx);
|
|
757
|
-
serializedTx = signedTx.serialize();
|
|
762
|
+
// Anchor provider.sendAndConfirm forces a signature with the wallet, which we don't want
|
|
763
|
+
// https://github.com/coral-xyz/anchor/blob/v0.30.0/ts/packages/anchor/src/provider.ts#L159
|
|
764
|
+
const wallet = this.getWallet();
|
|
765
|
+
const signedTx = await wallet.signTransaction(tx);
|
|
766
|
+
if (additionalSigners && additionalSigners.length > 0) {
|
|
767
|
+
signedTx.sign(additionalSigners);
|
|
758
768
|
}
|
|
769
|
+
serializedTx = signedTx.serialize();
|
|
759
770
|
const txSig = await txConnection.sendRawTransaction(serializedTx, {
|
|
760
771
|
// skip simulation since we just did it to compute CUs
|
|
761
772
|
// however this means that we need to reconstruct the error, if
|
|
@@ -828,8 +839,8 @@ class BaseClient {
|
|
|
828
839
|
const [pda, _bump] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from(constants_1.SEED_VAULT), statePda.toBuffer()], this.program.programId);
|
|
829
840
|
return pda;
|
|
830
841
|
}
|
|
831
|
-
getVaultAta(
|
|
832
|
-
return this.getAta(mint, this.getVaultPda(
|
|
842
|
+
getVaultAta(glamState, mint, programId) {
|
|
843
|
+
return this.getAta(mint, this.getVaultPda(glamState), programId);
|
|
833
844
|
}
|
|
834
845
|
/**
|
|
835
846
|
* Fetch all the token accounts (including token program and token 2022 program) owned by a public key.
|
|
@@ -868,8 +879,8 @@ class BaseClient {
|
|
|
868
879
|
const lamports = await this.provider.connection.getBalance(vault);
|
|
869
880
|
return lamports / web3_js_1.LAMPORTS_PER_SOL;
|
|
870
881
|
}
|
|
871
|
-
async getVaultTokenBalance(
|
|
872
|
-
const ata = this.getVaultAta(
|
|
882
|
+
async getVaultTokenBalance(glamState, mint, programId) {
|
|
883
|
+
const ata = this.getVaultAta(glamState, mint);
|
|
873
884
|
const _mint = await (0, spl_token_1.getMint)(this.provider.connection, mint);
|
|
874
885
|
try {
|
|
875
886
|
const account = await (0, spl_token_1.getAccount)(this.provider.connection, ata);
|
|
@@ -933,15 +944,15 @@ class BaseClient {
|
|
|
933
944
|
* @param lamports Desired amount of wSOL
|
|
934
945
|
* @returns
|
|
935
946
|
*/
|
|
936
|
-
async maybeWrapSol(
|
|
937
|
-
const
|
|
938
|
-
const vaultWsolAta = this.getVaultAta(
|
|
947
|
+
async maybeWrapSol(glamState, amount, signer) {
|
|
948
|
+
const glamVault = this.getVaultPda(glamState);
|
|
949
|
+
const vaultWsolAta = this.getVaultAta(glamState, constants_1.WSOL);
|
|
939
950
|
let wsolBalance = new anchor.BN(0);
|
|
940
951
|
try {
|
|
941
952
|
wsolBalance = new anchor.BN((await this.provider.connection.getTokenAccountBalance(vaultWsolAta)).value.amount);
|
|
942
953
|
}
|
|
943
954
|
catch (err) { }
|
|
944
|
-
const solBalance = new anchor.BN(await this.provider.connection.getBalance(
|
|
955
|
+
const solBalance = new anchor.BN(await this.provider.connection.getBalance(glamVault));
|
|
945
956
|
const delta = new anchor.BN(amount).sub(wsolBalance); // wSOL amount needed
|
|
946
957
|
if (solBalance.lt(delta)) {
|
|
947
958
|
throw new Error("Insufficient funds in vault to complete the transaction");
|
|
@@ -950,11 +961,11 @@ class BaseClient {
|
|
|
950
961
|
return await this.program.methods
|
|
951
962
|
.wsolWrap(delta)
|
|
952
963
|
.accountsPartial({
|
|
953
|
-
|
|
954
|
-
|
|
964
|
+
glamState,
|
|
965
|
+
glamVault,
|
|
966
|
+
glamSigner: signer || this.getSigner(),
|
|
955
967
|
vaultWsolAta,
|
|
956
968
|
wsolMint: constants_1.WSOL,
|
|
957
|
-
signer: signer || this.getSigner(),
|
|
958
969
|
})
|
|
959
970
|
.instruction();
|
|
960
971
|
}
|
|
@@ -995,9 +1006,26 @@ class BaseClient {
|
|
|
995
1006
|
}
|
|
996
1007
|
return models_1.StateModel.fromOnchainAccounts(statePda, stateAccount, openfundsMetadataAccount, undefined, this.program.programId);
|
|
997
1008
|
}
|
|
998
|
-
|
|
1009
|
+
/**
|
|
1010
|
+
* Fetch all glam states if no filter options provided
|
|
1011
|
+
*
|
|
1012
|
+
* @param filterOptions
|
|
1013
|
+
* @returns
|
|
1014
|
+
*/
|
|
1015
|
+
async fetchGlamStates(filterOptions) {
|
|
1016
|
+
const { owner, delegate, type } = filterOptions || {};
|
|
999
1017
|
const stateAccounts = await this.program.account.stateAccount.all();
|
|
1000
1018
|
const openfundsMetadataAccounts = await this.program.account.openfundsMetadataAccount.all();
|
|
1019
|
+
const filteredStateAccounts = stateAccounts
|
|
1020
|
+
.filter((s) => !type || Object.keys(s.account.accountType)[0] === type)
|
|
1021
|
+
.filter((s) =>
|
|
1022
|
+
// if neither owner nor delegate is set, return all
|
|
1023
|
+
// if owner is set, return states owned by the owner
|
|
1024
|
+
// if delegate is set, return states with the delegate
|
|
1025
|
+
(!owner && !delegate) ||
|
|
1026
|
+
(owner && s.account.owner.equals(owner)) ||
|
|
1027
|
+
(delegate &&
|
|
1028
|
+
s.account.delegateAcls.some((acl) => acl.pubkey.equals(delegate))));
|
|
1001
1029
|
let openfundsCache = new Map();
|
|
1002
1030
|
openfundsMetadataAccounts.forEach((of) => {
|
|
1003
1031
|
openfundsCache.set(of.publicKey.toBase58(), of.account);
|
|
@@ -1005,7 +1033,7 @@ class BaseClient {
|
|
|
1005
1033
|
/* fetch first mint */
|
|
1006
1034
|
let mintCache = new Map();
|
|
1007
1035
|
const connection = this.provider.connection;
|
|
1008
|
-
const mintAddresses =
|
|
1036
|
+
const mintAddresses = filteredStateAccounts
|
|
1009
1037
|
.map((s) => s.account.mints[0])
|
|
1010
1038
|
.filter((addr) => !!addr);
|
|
1011
1039
|
const mintAccounts = await connection.getMultipleAccountsInfo(mintAddresses);
|
|
@@ -1013,7 +1041,7 @@ class BaseClient {
|
|
|
1013
1041
|
const mintInfo = (0, spl_token_1.unpackMint)(mintAddresses[j], info, spl_token_1.TOKEN_2022_PROGRAM_ID);
|
|
1014
1042
|
mintCache.set(mintAddresses[j].toBase58(), mintInfo);
|
|
1015
1043
|
});
|
|
1016
|
-
return
|
|
1044
|
+
return filteredStateAccounts.map((s) => models_1.StateModel.fromOnchainAccounts(s.publicKey, s.account, openfundsCache.get(s.account.metadata?.pubkey.toBase58() || ""), mintCache.get(s.account.mints[0]?.toBase58() || ""), this.program.programId));
|
|
1017
1045
|
}
|
|
1018
1046
|
}
|
|
1019
1047
|
exports.BaseClient = BaseClient;
|
|
@@ -1254,10 +1282,10 @@ exports.ASSETS_MAINNET = new Map([
|
|
|
1254
1282
|
},
|
|
1255
1283
|
],
|
|
1256
1284
|
[
|
|
1257
|
-
//
|
|
1258
|
-
"
|
|
1285
|
+
// BNSOL - Binance Staked SOL
|
|
1286
|
+
"BNso1VUJnh4zcfpZa6986Ea66P6TCp59hvtNJ8b1X85",
|
|
1259
1287
|
{
|
|
1260
|
-
stateAccount: new web3_js_1.PublicKey("
|
|
1288
|
+
stateAccount: new web3_js_1.PublicKey("Hr9pzexrBge3vgmBNRR8u42CNQgBXdHm4UkUN2DH4a7r"),
|
|
1261
1289
|
},
|
|
1262
1290
|
],
|
|
1263
1291
|
[
|
|
@@ -1755,8 +1783,8 @@ class DriftClient {
|
|
|
1755
1783
|
const tx = await this.updateUserCustomMarginRatioTx(statePda, maxLeverage, subAccountId);
|
|
1756
1784
|
return await this.base.sendAndConfirm(tx);
|
|
1757
1785
|
}
|
|
1758
|
-
async updateUserMarginTradingEnabled(statePda, marginTradingEnabled, subAccountId = 0) {
|
|
1759
|
-
const tx = await this.updateUserMarginTradingEnabledTx(statePda, marginTradingEnabled, subAccountId);
|
|
1786
|
+
async updateUserMarginTradingEnabled(statePda, marginTradingEnabled, subAccountId = 0, txOptions = {}) {
|
|
1787
|
+
const tx = await this.updateUserMarginTradingEnabledTx(statePda, marginTradingEnabled, subAccountId, txOptions);
|
|
1760
1788
|
return await this.base.sendAndConfirm(tx);
|
|
1761
1789
|
}
|
|
1762
1790
|
async updateUserDelegate(statePda, delegate, subAccountId = 0) {
|
|
@@ -1875,7 +1903,10 @@ class DriftClient {
|
|
|
1875
1903
|
const glamVault = this.base.getVaultPda(glamState);
|
|
1876
1904
|
const [user, userStats] = this.getUser(glamState);
|
|
1877
1905
|
const state = await (0, sdk_1.getDriftStateAccountPublicKey)(this.DRIFT_PROGRAM);
|
|
1878
|
-
const GLAM_NAME = "GLAM *.+"
|
|
1906
|
+
const GLAM_NAME = "GLAM *.+"
|
|
1907
|
+
.split("")
|
|
1908
|
+
.map((char) => char.charCodeAt(0))
|
|
1909
|
+
.concat(Array(24).fill(0));
|
|
1879
1910
|
const initializeUserIx = await this.base.program.methods
|
|
1880
1911
|
//@ts-ignore
|
|
1881
1912
|
.driftInitializeUser(0, GLAM_NAME)
|
|
@@ -1899,47 +1930,56 @@ class DriftClient {
|
|
|
1899
1930
|
.transaction();
|
|
1900
1931
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
1901
1932
|
}
|
|
1902
|
-
async
|
|
1933
|
+
async updateUserCustomMarginRatioIx(glamState, maxLeverage, // 1=1x, 2=2x ... 50=50x leverage
|
|
1903
1934
|
subAccountId = 0, txOptions = {}) {
|
|
1904
1935
|
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
1905
|
-
const glamVault = this.base.getVaultPda(glamState);
|
|
1906
1936
|
const [user] = this.getUser(glamState, subAccountId);
|
|
1907
1937
|
// https://github.com/drift-labs/protocol-v2/blob/babed162b08b1fe34e49a81c5aa3e4ec0a88ecdf/programs/drift/src/math/constants.rs#L183-L184
|
|
1908
1938
|
const marginRatio = DRIFT_MARGIN_PRECISION / maxLeverage;
|
|
1909
|
-
|
|
1939
|
+
return await this.base.program.methods
|
|
1910
1940
|
.driftUpdateUserCustomMarginRatio(subAccountId, marginRatio)
|
|
1911
1941
|
.accounts({
|
|
1912
1942
|
glamState,
|
|
1913
1943
|
glamSigner,
|
|
1914
1944
|
user,
|
|
1915
1945
|
})
|
|
1916
|
-
.
|
|
1946
|
+
.instruction();
|
|
1947
|
+
}
|
|
1948
|
+
async updateUserCustomMarginRatioTx(glamState, maxLeverage, // 1=1x, 2=2x ... 50=50x leverage
|
|
1949
|
+
subAccountId = 0, txOptions = {}) {
|
|
1950
|
+
const tx = new web3_js_1.Transaction().add(await this.updateUserCustomMarginRatioIx(glamState, maxLeverage, subAccountId, txOptions));
|
|
1917
1951
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
1918
1952
|
}
|
|
1919
|
-
async
|
|
1953
|
+
async updateUserMarginTradingEnabledIx(glamState, marginTradingEnabled, subAccountId = 0, txOptions = {}) {
|
|
1920
1954
|
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
1921
1955
|
const [user] = this.getUser(glamState, subAccountId);
|
|
1922
|
-
|
|
1956
|
+
return await this.base.program.methods
|
|
1923
1957
|
.driftUpdateUserMarginTradingEnabled(subAccountId, marginTradingEnabled)
|
|
1924
1958
|
.accounts({
|
|
1925
1959
|
glamState,
|
|
1926
1960
|
glamSigner,
|
|
1927
1961
|
user,
|
|
1928
1962
|
})
|
|
1929
|
-
.
|
|
1963
|
+
.instruction();
|
|
1964
|
+
}
|
|
1965
|
+
async updateUserMarginTradingEnabledTx(glamState, marginTradingEnabled, subAccountId = 0, txOptions = {}) {
|
|
1966
|
+
const tx = new web3_js_1.Transaction().add(...(txOptions.preInstructions || []), await this.updateUserMarginTradingEnabledIx(glamState, marginTradingEnabled, subAccountId, txOptions));
|
|
1930
1967
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
1931
1968
|
}
|
|
1932
|
-
async
|
|
1969
|
+
async updateUserDelegateIx(glamState, delegate, subAccountId = 0, txOptions = {}) {
|
|
1933
1970
|
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
1934
1971
|
const [user] = this.getUser(glamState, subAccountId);
|
|
1935
|
-
|
|
1936
|
-
.driftUpdateUserDelegate(subAccountId, delegate)
|
|
1972
|
+
return await this.base.program.methods
|
|
1973
|
+
.driftUpdateUserDelegate(subAccountId, new web3_js_1.PublicKey(delegate))
|
|
1937
1974
|
.accounts({
|
|
1938
1975
|
glamState,
|
|
1939
1976
|
glamSigner,
|
|
1940
1977
|
user,
|
|
1941
1978
|
})
|
|
1942
|
-
.
|
|
1979
|
+
.instruction();
|
|
1980
|
+
}
|
|
1981
|
+
async updateUserDelegateTx(glamState, delegate, subAccountId = 0, txOptions = {}) {
|
|
1982
|
+
const tx = new web3_js_1.Transaction().add(await this.updateUserDelegateIx(glamState, delegate, subAccountId, txOptions));
|
|
1943
1983
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
1944
1984
|
}
|
|
1945
1985
|
async deleteUserTx(glamState, subAccountId = 0, txOptions = {}) {
|
|
@@ -1958,14 +1998,44 @@ class DriftClient {
|
|
|
1958
1998
|
.transaction();
|
|
1959
1999
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
1960
2000
|
}
|
|
1961
|
-
async depositTx(
|
|
2001
|
+
async depositTx(glamState, amount, marketIndex = 1, subAccountId = 0, marketConfigs, txOptions = {}) {
|
|
1962
2002
|
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
1963
|
-
const [user, userStats] = this.getUser(
|
|
2003
|
+
const [user, userStats] = this.getUser(glamState, subAccountId);
|
|
1964
2004
|
const state = await (0, sdk_1.getDriftStateAccountPublicKey)(this.DRIFT_PROGRAM);
|
|
1965
2005
|
const { mint, oracle, marketPDA, vaultPDA } = marketConfigs.spot[marketIndex];
|
|
1966
2006
|
const preInstructions = [];
|
|
2007
|
+
// If drift user doesn't exist, create it first
|
|
2008
|
+
const vault = this.base.getVaultPda(glamState);
|
|
2009
|
+
const response = await fetch(`https://api.glam.systems/v0/drift/user?authority=${vault.toBase58()}&accountId=${subAccountId}`);
|
|
2010
|
+
const data = await response.json();
|
|
2011
|
+
if (!data) {
|
|
2012
|
+
const initializeUserStatsIx = await this.base.program.methods
|
|
2013
|
+
.driftInitializeUserStats()
|
|
2014
|
+
.accounts({
|
|
2015
|
+
glamState,
|
|
2016
|
+
state,
|
|
2017
|
+
userStats,
|
|
2018
|
+
glamSigner,
|
|
2019
|
+
})
|
|
2020
|
+
.instruction();
|
|
2021
|
+
const GLAM_NAME = "GLAM *.+"
|
|
2022
|
+
.split("")
|
|
2023
|
+
.map((char) => char.charCodeAt(0))
|
|
2024
|
+
.concat(Array(24).fill(0));
|
|
2025
|
+
const initializeUserIx = await this.base.program.methods
|
|
2026
|
+
.driftInitializeUser(0, GLAM_NAME)
|
|
2027
|
+
.accounts({
|
|
2028
|
+
glamState,
|
|
2029
|
+
user,
|
|
2030
|
+
userStats,
|
|
2031
|
+
state,
|
|
2032
|
+
glamSigner,
|
|
2033
|
+
})
|
|
2034
|
+
.instruction();
|
|
2035
|
+
preInstructions.push(initializeUserStatsIx, initializeUserIx); // init user stats first
|
|
2036
|
+
}
|
|
1967
2037
|
if (mint === constants_1.WSOL.toBase58()) {
|
|
1968
|
-
const wrapSolIx = await this.base.maybeWrapSol(
|
|
2038
|
+
const wrapSolIx = await this.base.maybeWrapSol(glamState, amount, glamSigner);
|
|
1969
2039
|
if (wrapSolIx) {
|
|
1970
2040
|
preInstructions.push(wrapSolIx);
|
|
1971
2041
|
}
|
|
@@ -1973,12 +2043,12 @@ class DriftClient {
|
|
|
1973
2043
|
const tx = await this.base.program.methods
|
|
1974
2044
|
.driftDeposit(marketIndex, amount, false)
|
|
1975
2045
|
.accounts({
|
|
1976
|
-
glamState:
|
|
2046
|
+
glamState: glamState,
|
|
1977
2047
|
state,
|
|
1978
2048
|
user,
|
|
1979
2049
|
userStats,
|
|
1980
2050
|
spotMarketVault: new web3_js_1.PublicKey(vaultPDA),
|
|
1981
|
-
userTokenAccount: this.base.getVaultAta(
|
|
2051
|
+
userTokenAccount: this.base.getVaultAta(glamState, new web3_js_1.PublicKey(mint)),
|
|
1982
2052
|
glamSigner,
|
|
1983
2053
|
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
1984
2054
|
})
|
|
@@ -2344,8 +2414,8 @@ class JupiterSwapClient {
|
|
|
2344
2414
|
/*
|
|
2345
2415
|
* Client methods
|
|
2346
2416
|
*/
|
|
2347
|
-
async swap(
|
|
2348
|
-
const tx = await this.swapTx(
|
|
2417
|
+
async swap(glamState, quoteParams, quoteResponse, swapInstructions, txOptions = {}) {
|
|
2418
|
+
const tx = await this.swapTx(glamState, quoteParams, quoteResponse, swapInstructions, txOptions);
|
|
2349
2419
|
return await this.base.sendAndConfirm(tx);
|
|
2350
2420
|
}
|
|
2351
2421
|
async setMaxSwapSlippage(statePda, slippageBps, txOptions = {}) {
|
|
@@ -2355,9 +2425,9 @@ class JupiterSwapClient {
|
|
|
2355
2425
|
/*
|
|
2356
2426
|
* API methods
|
|
2357
2427
|
*/
|
|
2358
|
-
async swapTx(
|
|
2359
|
-
const
|
|
2360
|
-
const
|
|
2428
|
+
async swapTx(glamState, quoteParams, quoteResponse, swapInstructions, txOptions = {}) {
|
|
2429
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
2430
|
+
const glamVault = this.base.getVaultPda(glamState);
|
|
2361
2431
|
let swapInstruction;
|
|
2362
2432
|
let addressLookupTableAddresses;
|
|
2363
2433
|
const inputMint = new web3_js_1.PublicKey(quoteParams?.inputMint || quoteResponse.inputMint);
|
|
@@ -2371,7 +2441,7 @@ class JupiterSwapClient {
|
|
|
2371
2441
|
}
|
|
2372
2442
|
quoteResponse = await this.getQuoteResponse(quoteParams);
|
|
2373
2443
|
}
|
|
2374
|
-
const ins = await this.getSwapInstructions(quoteResponse,
|
|
2444
|
+
const ins = await this.getSwapInstructions(quoteResponse, glamVault);
|
|
2375
2445
|
swapInstruction = ins.swapInstruction;
|
|
2376
2446
|
addressLookupTableAddresses = ins.addressLookupTableAddresses;
|
|
2377
2447
|
}
|
|
@@ -2381,19 +2451,19 @@ class JupiterSwapClient {
|
|
|
2381
2451
|
swapInstructions.addressLookupTableAddresses;
|
|
2382
2452
|
}
|
|
2383
2453
|
const lookupTables = await this.base.getAdressLookupTableAccounts(addressLookupTableAddresses);
|
|
2384
|
-
const swapIx = this.toTransactionInstruction(swapInstruction,
|
|
2454
|
+
const swapIx = this.toTransactionInstruction(swapInstruction, glamVault.toBase58());
|
|
2385
2455
|
const [inputTokenProgram, outputTokenProgram] = await Promise.all([
|
|
2386
2456
|
this.getTokenProgram(inputMint),
|
|
2387
2457
|
this.getTokenProgram(outputMint),
|
|
2388
2458
|
]);
|
|
2389
2459
|
const inputStakePool = assets_1.ASSETS_MAINNET.get(inputMint.toBase58())?.stateAccount || null;
|
|
2390
2460
|
const outputStakePool = assets_1.ASSETS_MAINNET.get(outputMint.toBase58())?.stateAccount || null;
|
|
2391
|
-
const preInstructions = await this.getPreInstructions(
|
|
2461
|
+
const preInstructions = await this.getPreInstructions(glamState, glamSigner, inputMint, outputMint, amount, inputTokenProgram, outputTokenProgram);
|
|
2392
2462
|
const tx = await this.base.program.methods
|
|
2393
2463
|
.jupiterSwap(amount, swapIx.data)
|
|
2394
2464
|
.accounts({
|
|
2395
|
-
|
|
2396
|
-
|
|
2465
|
+
glamState,
|
|
2466
|
+
glamSigner,
|
|
2397
2467
|
inputMint,
|
|
2398
2468
|
outputMint,
|
|
2399
2469
|
inputTokenProgram,
|
|
@@ -2404,19 +2474,32 @@ class JupiterSwapClient {
|
|
|
2404
2474
|
.remainingAccounts(swapIx.keys)
|
|
2405
2475
|
.preInstructions(preInstructions)
|
|
2406
2476
|
.transaction();
|
|
2407
|
-
return this.base.intoVersionedTransaction(tx, {
|
|
2477
|
+
return this.base.intoVersionedTransaction(tx, {
|
|
2478
|
+
lookupTables,
|
|
2479
|
+
...txOptions,
|
|
2480
|
+
});
|
|
2408
2481
|
}
|
|
2409
|
-
async setMaxSwapSlippageTx(
|
|
2410
|
-
const
|
|
2482
|
+
async setMaxSwapSlippageTx(glamState, slippageBps, txOptions = {}) {
|
|
2483
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
2411
2484
|
const tx = await this.base.program.methods
|
|
2412
2485
|
.jupiterSetMaxSwapSlippage(new anchor_1.BN(slippageBps))
|
|
2413
2486
|
.accounts({
|
|
2414
|
-
|
|
2415
|
-
|
|
2487
|
+
glamState,
|
|
2488
|
+
glamSigner,
|
|
2416
2489
|
})
|
|
2417
2490
|
.transaction();
|
|
2418
2491
|
return this.base.intoVersionedTransaction(tx, { ...txOptions });
|
|
2419
2492
|
}
|
|
2493
|
+
async setMaxSwapSlippageIx(glamState, slippageBps, txOptions = {}) {
|
|
2494
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
2495
|
+
return await this.base.program.methods
|
|
2496
|
+
.jupiterSetMaxSwapSlippage(new anchor_1.BN(slippageBps))
|
|
2497
|
+
.accounts({
|
|
2498
|
+
glamState,
|
|
2499
|
+
glamSigner,
|
|
2500
|
+
})
|
|
2501
|
+
.instruction();
|
|
2502
|
+
}
|
|
2420
2503
|
async getQuoteResponse(quoteParams) {
|
|
2421
2504
|
const res = await fetch(`${this.base.jupiterApi}/quote?` +
|
|
2422
2505
|
new URLSearchParams(Object.entries(quoteParams).map(([key, val]) => [key, String(val)])));
|
|
@@ -2569,8 +2652,8 @@ class JupiterVoteClient {
|
|
|
2569
2652
|
*/
|
|
2570
2653
|
async voteOnProposal(glamState, proposal, side, txOptions = {}) {
|
|
2571
2654
|
const glamVault = this.base.getVaultPda(glamState);
|
|
2572
|
-
const
|
|
2573
|
-
const
|
|
2655
|
+
const vote = this.getVotePda(proposal, glamVault);
|
|
2656
|
+
const governor = this.getGovernorPda();
|
|
2574
2657
|
const voteAccountInfo = await this.base.provider.connection.getAccountInfo(vote);
|
|
2575
2658
|
const voteCreated = voteAccountInfo ? true : false;
|
|
2576
2659
|
const preInstructions = [];
|
|
@@ -2597,6 +2680,7 @@ class JupiterVoteClient {
|
|
|
2597
2680
|
governor,
|
|
2598
2681
|
governProgram: constants_1.GOVERNANCE_PROGRAM_ID,
|
|
2599
2682
|
})
|
|
2683
|
+
.preInstructions(preInstructions)
|
|
2600
2684
|
.transaction();
|
|
2601
2685
|
const vTx = await this.base.intoVersionedTransaction(tx, { ...txOptions });
|
|
2602
2686
|
return await this.base.sendAndConfirm(vTx);
|
|
@@ -2604,6 +2688,24 @@ class JupiterVoteClient {
|
|
|
2604
2688
|
/*
|
|
2605
2689
|
* Utils
|
|
2606
2690
|
*/
|
|
2691
|
+
async fetchVotes(glamState, proposals) {
|
|
2692
|
+
const glamVault = this.base.getVaultPda(glamState);
|
|
2693
|
+
const votes = proposals.map((proposal) => this.getVotePda(new web3_js_1.PublicKey(proposal), glamVault));
|
|
2694
|
+
const votesAccountInfo = await this.base.provider.connection.getMultipleAccountsInfo(votes);
|
|
2695
|
+
return votesAccountInfo
|
|
2696
|
+
.filter((accountInfo) => accountInfo !== null)
|
|
2697
|
+
.map((accountInfo) => ({
|
|
2698
|
+
// offsets:
|
|
2699
|
+
// 8 (discriminator)
|
|
2700
|
+
// 32 (proposal)
|
|
2701
|
+
// 32 (voter)
|
|
2702
|
+
// 1 (bump)
|
|
2703
|
+
// 1 (side)
|
|
2704
|
+
proposal: new web3_js_1.PublicKey(accountInfo.data.subarray(8, 40)),
|
|
2705
|
+
voter: new web3_js_1.PublicKey(accountInfo.data.subarray(40, 72)),
|
|
2706
|
+
side: accountInfo.data.readUInt8(73),
|
|
2707
|
+
}));
|
|
2708
|
+
}
|
|
2607
2709
|
get stakeLocker() {
|
|
2608
2710
|
const [locker] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("Locker"), BASE.toBuffer()], constants_1.JUP_VOTE_PROGRAM);
|
|
2609
2711
|
return locker;
|
|
@@ -2612,6 +2714,14 @@ class JupiterVoteClient {
|
|
|
2612
2714
|
const [escrow] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("Escrow"), this.stakeLocker.toBuffer(), owner.toBuffer()], constants_1.JUP_VOTE_PROGRAM);
|
|
2613
2715
|
return escrow;
|
|
2614
2716
|
}
|
|
2717
|
+
getVotePda(proposal, voter) {
|
|
2718
|
+
const [vote] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("Vote"), proposal.toBuffer(), voter.toBuffer()], constants_1.GOVERNANCE_PROGRAM_ID);
|
|
2719
|
+
return vote;
|
|
2720
|
+
}
|
|
2721
|
+
getGovernorPda() {
|
|
2722
|
+
const [governor] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("Governor"), BASE.toBuffer()], constants_1.GOVERNANCE_PROGRAM_ID);
|
|
2723
|
+
return governor;
|
|
2724
|
+
}
|
|
2615
2725
|
}
|
|
2616
2726
|
exports.JupiterVoteClient = JupiterVoteClient;
|
|
2617
2727
|
|
|
@@ -2631,78 +2741,63 @@ const TICKET_SIZE = 88;
|
|
|
2631
2741
|
class MarinadeClient {
|
|
2632
2742
|
constructor(base) {
|
|
2633
2743
|
this.base = base;
|
|
2744
|
+
/*
|
|
2745
|
+
* Utils
|
|
2746
|
+
*/
|
|
2747
|
+
this._getTicketsAccounts = async (state) => await this.base.provider.connection.getParsedProgramAccounts(constants_1.MARINADE_PROGRAM_ID, {
|
|
2748
|
+
filters: [
|
|
2749
|
+
{
|
|
2750
|
+
dataSize: TICKET_SIZE,
|
|
2751
|
+
},
|
|
2752
|
+
{
|
|
2753
|
+
memcmp: {
|
|
2754
|
+
offset: 40,
|
|
2755
|
+
bytes: this.base.getVaultPda(state).toBase58(),
|
|
2756
|
+
},
|
|
2757
|
+
},
|
|
2758
|
+
],
|
|
2759
|
+
});
|
|
2634
2760
|
}
|
|
2635
2761
|
/*
|
|
2636
2762
|
* Client methods
|
|
2637
2763
|
*/
|
|
2638
|
-
async
|
|
2639
|
-
const tx = await this.
|
|
2764
|
+
async deposit(statePda, amount) {
|
|
2765
|
+
const tx = await this.depositTx(statePda, amount, {});
|
|
2640
2766
|
return await this.base.sendAndConfirm(tx);
|
|
2641
2767
|
}
|
|
2642
|
-
async
|
|
2643
|
-
const tx = await this.
|
|
2768
|
+
async depositStakeAccount(statePda, stakeAccount) {
|
|
2769
|
+
const tx = await this.depositStakeAccountTx(statePda, stakeAccount, {});
|
|
2644
2770
|
return await this.base.sendAndConfirm(tx);
|
|
2645
2771
|
}
|
|
2646
2772
|
async liquidUnstake(statePda, amount) {
|
|
2647
2773
|
const tx = await this.liquidUnstakeTx(statePda, amount, {});
|
|
2648
2774
|
return await this.base.sendAndConfirm(tx);
|
|
2649
2775
|
}
|
|
2650
|
-
async
|
|
2651
|
-
const tx = await this.
|
|
2776
|
+
async orderUnstake(statePda, amount, txOptions = {}) {
|
|
2777
|
+
const tx = await this.orderUnstakeTx(statePda, amount, txOptions);
|
|
2652
2778
|
return await this.base.sendAndConfirm(tx);
|
|
2653
2779
|
}
|
|
2654
|
-
async
|
|
2655
|
-
const tx = await this.
|
|
2780
|
+
async claim(statePda, tickets, txOptions = {}) {
|
|
2781
|
+
const tx = await this.claimTx(statePda, tickets, txOptions);
|
|
2656
2782
|
return await this.base.sendAndConfirm(tx);
|
|
2657
2783
|
}
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
*/
|
|
2661
|
-
async getExistingTickets(state) {
|
|
2662
|
-
const accounts = await this.base.provider.connection.getParsedProgramAccounts(constants_1.MARINADE_PROGRAM_ID, {
|
|
2663
|
-
filters: [
|
|
2664
|
-
{
|
|
2665
|
-
dataSize: 88,
|
|
2666
|
-
},
|
|
2667
|
-
{
|
|
2668
|
-
memcmp: {
|
|
2669
|
-
offset: 40,
|
|
2670
|
-
bytes: this.base.getVaultPda(state).toBase58(),
|
|
2671
|
-
},
|
|
2672
|
-
},
|
|
2673
|
-
],
|
|
2674
|
-
});
|
|
2784
|
+
async getTickets(state) {
|
|
2785
|
+
const accounts = await this._getTicketsAccounts(state);
|
|
2675
2786
|
return accounts.map((a) => a.pubkey);
|
|
2676
2787
|
}
|
|
2677
|
-
async
|
|
2678
|
-
|
|
2679
|
-
// stateAddress: web3.PublicKey; // offset 8
|
|
2680
|
-
// beneficiary: web3.PublicKey; // offset 40
|
|
2681
|
-
// lamportsAmount: BN; // offset 72
|
|
2682
|
-
// createdEpoch: BN;
|
|
2683
|
-
// }
|
|
2684
|
-
const accounts = await this.base.provider.connection.getParsedProgramAccounts(constants_1.MARINADE_PROGRAM_ID, {
|
|
2685
|
-
filters: [
|
|
2686
|
-
{
|
|
2687
|
-
dataSize: TICKET_SIZE,
|
|
2688
|
-
},
|
|
2689
|
-
{
|
|
2690
|
-
memcmp: {
|
|
2691
|
-
offset: 40,
|
|
2692
|
-
bytes: this.base.getVaultPda(state).toBase58(),
|
|
2693
|
-
},
|
|
2694
|
-
},
|
|
2695
|
-
],
|
|
2696
|
-
});
|
|
2788
|
+
async getParsedTickets(state) {
|
|
2789
|
+
const accounts = await this._getTicketsAccounts(state);
|
|
2697
2790
|
const currentEpoch = await this.base.provider.connection.getEpochInfo();
|
|
2698
2791
|
return accounts.map((a) => {
|
|
2699
2792
|
const lamports = Number(a.account.data.readBigInt64LE(72));
|
|
2700
2793
|
const createdEpoch = Number(a.account.data.readBigInt64LE(80));
|
|
2794
|
+
const isDue = currentEpoch.epoch > createdEpoch;
|
|
2701
2795
|
return {
|
|
2702
2796
|
address: a.pubkey,
|
|
2703
2797
|
lamports,
|
|
2704
2798
|
createdEpoch,
|
|
2705
|
-
isDue
|
|
2799
|
+
isDue,
|
|
2800
|
+
isClaimable: isDue && currentEpoch.slotIndex > 5000, // 5000 slots ~= 33.3 minutes
|
|
2706
2801
|
};
|
|
2707
2802
|
});
|
|
2708
2803
|
}
|
|
@@ -2744,33 +2839,33 @@ class MarinadeClient {
|
|
|
2744
2839
|
/*
|
|
2745
2840
|
* API methods
|
|
2746
2841
|
*/
|
|
2747
|
-
async
|
|
2748
|
-
const
|
|
2749
|
-
const vault = this.base.getVaultPda(
|
|
2842
|
+
async depositTx(glamState, amount, txOptions) {
|
|
2843
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
2844
|
+
const vault = this.base.getVaultPda(glamState);
|
|
2750
2845
|
const marinadeState = this.getMarinadeState();
|
|
2751
2846
|
const vaultMsolAta = this.base.getAta(marinadeState.msolMintAddress, vault);
|
|
2847
|
+
const createMsolAtaIx = (0, spl_token_1.createAssociatedTokenAccountIdempotentInstruction)(glamSigner, vaultMsolAta, vault, marinadeState.msolMintAddress);
|
|
2752
2848
|
const tx = await this.base.program.methods
|
|
2753
|
-
.
|
|
2754
|
-
.
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
signer,
|
|
2849
|
+
.marinadeDeposit(amount)
|
|
2850
|
+
.accounts({
|
|
2851
|
+
glamState,
|
|
2852
|
+
glamSigner,
|
|
2758
2853
|
reservePda: marinadeState.reserveAddress,
|
|
2759
|
-
|
|
2854
|
+
state: marinadeState.marinadeStateAddress,
|
|
2760
2855
|
msolMint: marinadeState.msolMintAddress,
|
|
2761
2856
|
msolMintAuthority: marinadeState.mSolMintAuthority,
|
|
2762
2857
|
liqPoolMsolLeg: marinadeState.msolLeg,
|
|
2763
2858
|
liqPoolMsolLegAuthority: marinadeState.msolLegAuthority,
|
|
2764
2859
|
liqPoolSolLegPda: marinadeState.solLeg,
|
|
2765
2860
|
mintTo: vaultMsolAta,
|
|
2766
|
-
|
|
2861
|
+
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
2767
2862
|
})
|
|
2863
|
+
.preInstructions([createMsolAtaIx])
|
|
2768
2864
|
.transaction();
|
|
2769
2865
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
2770
2866
|
}
|
|
2771
|
-
async
|
|
2772
|
-
const
|
|
2773
|
-
const vault = this.base.getVaultPda(statePda);
|
|
2867
|
+
async depositStakeAccountTx(glamState, stakeAccount, txOptions) {
|
|
2868
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
2774
2869
|
const stakeAccountInfo = await this.getParsedStakeAccountInfo(stakeAccount);
|
|
2775
2870
|
console.log("Stake account info", stakeAccountInfo);
|
|
2776
2871
|
const marinadeState = await new marinade_ts_sdk_1.Marinade().getMarinadeState();
|
|
@@ -2781,99 +2876,96 @@ class MarinadeClient {
|
|
|
2781
2876
|
: validatorLookupIndex;
|
|
2782
2877
|
const duplicationFlag = await marinadeState.validatorDuplicationFlag(stakeAccountInfo.voter);
|
|
2783
2878
|
const tx = await this.base.program.methods
|
|
2784
|
-
.
|
|
2785
|
-
.
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
marinadeState: marinadeState.marinadeStateAddress,
|
|
2879
|
+
.marinadeDepositStakeAccount(validatorIndex)
|
|
2880
|
+
.accounts({
|
|
2881
|
+
glamState,
|
|
2882
|
+
glamSigner,
|
|
2883
|
+
state: marinadeState.marinadeStateAddress,
|
|
2790
2884
|
validatorList: marinadeState.state.validatorSystem.validatorList.account,
|
|
2791
2885
|
stakeList: marinadeState.state.stakeSystem.stakeList.account,
|
|
2792
|
-
|
|
2886
|
+
stakeAccount,
|
|
2793
2887
|
duplicationFlag,
|
|
2794
2888
|
msolMint: constants_1.MSOL,
|
|
2795
2889
|
msolMintAuthority: await marinadeState.mSolMintAuthority(),
|
|
2796
|
-
mintTo: this.base.getVaultAta(
|
|
2797
|
-
marinadeProgram: constants_1.MARINADE_PROGRAM_ID,
|
|
2890
|
+
mintTo: this.base.getVaultAta(glamState, constants_1.MSOL),
|
|
2798
2891
|
clock: web3_js_1.SYSVAR_CLOCK_PUBKEY,
|
|
2799
|
-
rent: web3_js_1.SYSVAR_RENT_PUBKEY,
|
|
2800
2892
|
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
2801
2893
|
stakeProgram: web3_js_1.StakeProgram.programId,
|
|
2802
2894
|
})
|
|
2803
2895
|
.transaction();
|
|
2804
2896
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
2805
2897
|
}
|
|
2806
|
-
async
|
|
2807
|
-
const
|
|
2808
|
-
const vault = this.base.getVaultPda(state);
|
|
2898
|
+
async orderUnstakeTx(glamState, amount, txOptions) {
|
|
2899
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
2809
2900
|
const marinadeState = this.getMarinadeState();
|
|
2810
|
-
const vaultMsolAta = this.base.getVaultAta(
|
|
2901
|
+
const vaultMsolAta = this.base.getVaultAta(glamState, marinadeState.msolMintAddress);
|
|
2811
2902
|
const ticketSeed = Date.now().toString();
|
|
2812
|
-
const ticket = await web3_js_1.PublicKey.createWithSeed(
|
|
2903
|
+
const ticket = await web3_js_1.PublicKey.createWithSeed(glamSigner, ticketSeed, constants_1.MARINADE_PROGRAM_ID);
|
|
2813
2904
|
const lamports = await this.base.provider.connection.getMinimumBalanceForRentExemption(TICKET_SIZE);
|
|
2814
2905
|
const createTicketIx = web3_js_1.SystemProgram.createAccountWithSeed({
|
|
2815
|
-
fromPubkey:
|
|
2906
|
+
fromPubkey: glamSigner,
|
|
2816
2907
|
newAccountPubkey: ticket,
|
|
2817
|
-
basePubkey:
|
|
2908
|
+
basePubkey: glamSigner,
|
|
2818
2909
|
seed: ticketSeed,
|
|
2819
2910
|
lamports,
|
|
2820
2911
|
space: TICKET_SIZE,
|
|
2821
2912
|
programId: constants_1.MARINADE_PROGRAM_ID,
|
|
2822
2913
|
});
|
|
2823
2914
|
const tx = await this.base.program.methods
|
|
2824
|
-
.
|
|
2825
|
-
.
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
ticket,
|
|
2915
|
+
.marinadeOrderUnstake(amount)
|
|
2916
|
+
.accounts({
|
|
2917
|
+
glamState,
|
|
2918
|
+
glamSigner,
|
|
2919
|
+
newTicketAccount: ticket,
|
|
2830
2920
|
msolMint: marinadeState.msolMintAddress,
|
|
2831
2921
|
burnMsolFrom: vaultMsolAta,
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2922
|
+
state: marinadeState.marinadeStateAddress,
|
|
2923
|
+
clock: web3_js_1.SYSVAR_CLOCK_PUBKEY,
|
|
2924
|
+
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
2835
2925
|
})
|
|
2836
2926
|
.preInstructions([createTicketIx])
|
|
2837
2927
|
.transaction();
|
|
2838
2928
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
2839
2929
|
}
|
|
2840
|
-
async
|
|
2841
|
-
|
|
2842
|
-
|
|
2930
|
+
async claimTx(glamState, tickets, txOptions) {
|
|
2931
|
+
if (tickets.length < 1) {
|
|
2932
|
+
throw new Error("At least one ticket is required");
|
|
2933
|
+
}
|
|
2934
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
2843
2935
|
const marinadeState = this.getMarinadeState();
|
|
2844
2936
|
const tx = await this.base.program.methods
|
|
2845
|
-
.
|
|
2846
|
-
.
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2937
|
+
.marinadeClaim()
|
|
2938
|
+
.accounts({
|
|
2939
|
+
glamState,
|
|
2940
|
+
glamSigner,
|
|
2941
|
+
ticketAccount: tickets[0],
|
|
2942
|
+
state: marinadeState.marinadeStateAddress,
|
|
2851
2943
|
reservePda: marinadeState.reserveAddress,
|
|
2852
|
-
|
|
2944
|
+
clock: web3_js_1.SYSVAR_CLOCK_PUBKEY,
|
|
2853
2945
|
})
|
|
2854
|
-
.remainingAccounts(tickets
|
|
2946
|
+
.remainingAccounts(tickets
|
|
2947
|
+
.slice(1)
|
|
2948
|
+
.map((t) => ({ pubkey: t, isSigner: false, isWritable: true })))
|
|
2855
2949
|
.transaction();
|
|
2856
2950
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
2857
2951
|
}
|
|
2858
|
-
async liquidUnstakeTx(
|
|
2859
|
-
const
|
|
2860
|
-
const vault = this.base.getVaultPda(
|
|
2952
|
+
async liquidUnstakeTx(glamState, amount, txOptions) {
|
|
2953
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
2954
|
+
const vault = this.base.getVaultPda(glamState);
|
|
2861
2955
|
const marinadeState = this.getMarinadeState();
|
|
2862
2956
|
const vaultMsolAta = this.base.getAta(marinadeState.msolMintAddress, vault);
|
|
2863
2957
|
const tx = await this.base.program.methods
|
|
2864
2958
|
.marinadeLiquidUnstake(amount)
|
|
2865
|
-
.
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
marinadeState: marinadeState.marinadeStateAddress,
|
|
2959
|
+
.accounts({
|
|
2960
|
+
glamState,
|
|
2961
|
+
glamSigner,
|
|
2962
|
+
state: marinadeState.marinadeStateAddress,
|
|
2870
2963
|
msolMint: marinadeState.msolMintAddress,
|
|
2871
2964
|
liqPoolSolLegPda: marinadeState.solLeg,
|
|
2872
2965
|
liqPoolMsolLeg: marinadeState.msolLeg,
|
|
2873
2966
|
getMsolFrom: vaultMsolAta,
|
|
2874
|
-
getMsolFromAuthority: vault,
|
|
2875
2967
|
treasuryMsolAccount: marinadeState.treasuryMsolAccount,
|
|
2876
|
-
|
|
2968
|
+
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
2877
2969
|
})
|
|
2878
2970
|
.transaction();
|
|
2879
2971
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
@@ -2903,47 +2995,31 @@ class WSolClient {
|
|
|
2903
2995
|
/*
|
|
2904
2996
|
* Client methods
|
|
2905
2997
|
*/
|
|
2906
|
-
async wrap(
|
|
2907
|
-
const tx = await this.wrapTx(
|
|
2998
|
+
async wrap(glamState, amount, txOptions = {}) {
|
|
2999
|
+
const tx = await this.wrapTx(glamState, amount, txOptions);
|
|
2908
3000
|
return await this.base.sendAndConfirm(tx);
|
|
2909
3001
|
}
|
|
2910
|
-
async unwrap(
|
|
2911
|
-
const tx = await this.unwrapTx(
|
|
3002
|
+
async unwrap(glamState, txOptions = {}) {
|
|
3003
|
+
const tx = await this.unwrapTx(glamState, txOptions);
|
|
2912
3004
|
return await this.base.sendAndConfirm(tx);
|
|
2913
3005
|
}
|
|
2914
3006
|
/*
|
|
2915
3007
|
* API methods
|
|
2916
3008
|
*/
|
|
2917
|
-
async wrapTx(
|
|
2918
|
-
const
|
|
2919
|
-
const
|
|
2920
|
-
const vaultWsolAta = this.base.getVaultAta(statePda, constants_1.WSOL);
|
|
2921
|
-
// @ts-ignore
|
|
3009
|
+
async wrapTx(glamState, amount, txOptions) {
|
|
3010
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
3011
|
+
const vaultWsolAta = this.base.getVaultAta(glamState, constants_1.WSOL);
|
|
2922
3012
|
const tx = await this.base.program.methods
|
|
2923
3013
|
.wsolWrap(amount)
|
|
2924
|
-
.accountsPartial({
|
|
2925
|
-
state: statePda,
|
|
2926
|
-
vault,
|
|
2927
|
-
vaultWsolAta,
|
|
2928
|
-
wsolMint: constants_1.WSOL,
|
|
2929
|
-
signer,
|
|
2930
|
-
})
|
|
3014
|
+
.accountsPartial({ glamState, glamSigner, vaultWsolAta, wsolMint: constants_1.WSOL })
|
|
2931
3015
|
.transaction();
|
|
2932
3016
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
2933
3017
|
}
|
|
2934
|
-
async unwrapTx(
|
|
2935
|
-
const
|
|
2936
|
-
const vault = this.base.getVaultPda(statePda);
|
|
2937
|
-
const vaultWsolAta = this.base.getVaultAta(statePda, constants_1.WSOL);
|
|
3018
|
+
async unwrapTx(glamState, txOptions) {
|
|
3019
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
2938
3020
|
const tx = await this.base.program.methods
|
|
2939
3021
|
.wsolUnwrap()
|
|
2940
|
-
.
|
|
2941
|
-
state: statePda,
|
|
2942
|
-
vault,
|
|
2943
|
-
vaultWsolAta,
|
|
2944
|
-
wsolMint: constants_1.WSOL,
|
|
2945
|
-
signer,
|
|
2946
|
-
})
|
|
3022
|
+
.accounts({ glamState, glamSigner })
|
|
2947
3023
|
.transaction();
|
|
2948
3024
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
2949
3025
|
}
|
|
@@ -2971,12 +3047,12 @@ class StakingClient {
|
|
|
2971
3047
|
/*
|
|
2972
3048
|
* High-level API methods
|
|
2973
3049
|
*/
|
|
2974
|
-
async unstake(
|
|
3050
|
+
async unstake(glamState, asset, amount, txOptions = {}) {
|
|
2975
3051
|
const assetStr = asset.toBase58();
|
|
2976
3052
|
let tx;
|
|
2977
3053
|
if (assetStr === constants_1.MSOL.toBase58()) {
|
|
2978
3054
|
// Marinade
|
|
2979
|
-
tx = await this.marinade.
|
|
3055
|
+
tx = await this.marinade.orderUnstakeTx(glamState, new anchor_1.BN(amount), txOptions);
|
|
2980
3056
|
}
|
|
2981
3057
|
else {
|
|
2982
3058
|
// Other LSTs
|
|
@@ -2984,48 +3060,48 @@ class StakingClient {
|
|
|
2984
3060
|
if (!assetMeta || !assetMeta.stateAccount) {
|
|
2985
3061
|
throw new Error("Invalid LST: " + asset);
|
|
2986
3062
|
}
|
|
2987
|
-
tx = await this.stakePoolWithdrawStakeTx(
|
|
3063
|
+
tx = await this.stakePoolWithdrawStakeTx(glamState, assetMeta.stateAccount, new anchor_1.BN(amount), true, txOptions);
|
|
2988
3064
|
}
|
|
2989
3065
|
return await this.base.sendAndConfirm(tx);
|
|
2990
3066
|
}
|
|
2991
3067
|
/*
|
|
2992
3068
|
* Client methods
|
|
2993
3069
|
*/
|
|
2994
|
-
async stakePoolDepositSol(
|
|
2995
|
-
const tx = await this.stakePoolDepositSolTx(
|
|
3070
|
+
async stakePoolDepositSol(glamState, stakePool, amount, txOptions = {}) {
|
|
3071
|
+
const tx = await this.stakePoolDepositSolTx(glamState, stakePool, amount);
|
|
2996
3072
|
return await this.base.sendAndConfirm(tx);
|
|
2997
3073
|
}
|
|
2998
|
-
async stakePoolDepositStake(
|
|
2999
|
-
const tx = await this.stakePoolDepositStakeTx(
|
|
3074
|
+
async stakePoolDepositStake(glamState, stakePool, stakeAccount) {
|
|
3075
|
+
const tx = await this.stakePoolDepositStakeTx(glamState, stakePool, stakeAccount);
|
|
3000
3076
|
return await this.base.sendAndConfirm(tx);
|
|
3001
3077
|
}
|
|
3002
|
-
async stakePoolWithdrawStake(
|
|
3003
|
-
const tx = await this.stakePoolWithdrawStakeTx(
|
|
3078
|
+
async stakePoolWithdrawStake(glamState, stakePool, amount) {
|
|
3079
|
+
const tx = await this.stakePoolWithdrawStakeTx(glamState, stakePool, amount);
|
|
3004
3080
|
return await this.base.sendAndConfirm(tx);
|
|
3005
3081
|
}
|
|
3006
|
-
async initializeAndDelegateStake(
|
|
3007
|
-
const tx = await this.initializeAndDelegateStakeTx(
|
|
3082
|
+
async initializeAndDelegateStake(glamState, vote, amount) {
|
|
3083
|
+
const tx = await this.initializeAndDelegateStakeTx(glamState, vote, amount);
|
|
3008
3084
|
return await this.base.sendAndConfirm(tx);
|
|
3009
3085
|
}
|
|
3010
|
-
async deactivateStakeAccounts(
|
|
3011
|
-
const tx = await this.deactivateStakeAccountsTx(
|
|
3086
|
+
async deactivateStakeAccounts(glamState, stakeAccounts) {
|
|
3087
|
+
const tx = await this.deactivateStakeAccountsTx(glamState, stakeAccounts);
|
|
3012
3088
|
return await this.base.sendAndConfirm(tx);
|
|
3013
3089
|
}
|
|
3014
|
-
async withdrawFromStakeAccounts(
|
|
3015
|
-
const tx = await this.withdrawFromStakeAccountsTx(
|
|
3090
|
+
async withdrawFromStakeAccounts(glamState, stakeAccounts) {
|
|
3091
|
+
const tx = await this.withdrawFromStakeAccountsTx(glamState, stakeAccounts);
|
|
3016
3092
|
return await this.base.sendAndConfirm(tx);
|
|
3017
3093
|
}
|
|
3018
|
-
async mergeStakeAccounts(
|
|
3019
|
-
const tx = await this.mergeStakeAccountsTx(
|
|
3094
|
+
async mergeStakeAccounts(glamState, toStake, fromStake) {
|
|
3095
|
+
const tx = await this.mergeStakeAccountsTx(glamState, toStake, fromStake);
|
|
3020
3096
|
return await this.base.sendAndConfirm(tx);
|
|
3021
3097
|
}
|
|
3022
|
-
async splitStakeAccount(
|
|
3023
|
-
const { tx, newStake } = await this.splitStakeAccountTx(
|
|
3098
|
+
async splitStakeAccount(glamState, existingStake, lamports) {
|
|
3099
|
+
const { tx, newStake } = await this.splitStakeAccountTx(glamState, existingStake, lamports);
|
|
3024
3100
|
const txSig = await this.base.sendAndConfirm(tx);
|
|
3025
3101
|
return { newStake, txSig };
|
|
3026
3102
|
}
|
|
3027
|
-
async redelegateStake(
|
|
3028
|
-
const { newStake, tx } = await this.redelegateStakeTx(
|
|
3103
|
+
async redelegateStake(glamState, existingStake, vote) {
|
|
3104
|
+
const { newStake, tx } = await this.redelegateStakeTx(glamState, existingStake, vote);
|
|
3029
3105
|
const txSig = await this.base.sendAndConfirm(tx);
|
|
3030
3106
|
return { newStake, txSig };
|
|
3031
3107
|
}
|
|
@@ -3164,18 +3240,18 @@ class StakingClient {
|
|
|
3164
3240
|
/*
|
|
3165
3241
|
* API methods
|
|
3166
3242
|
*/
|
|
3167
|
-
async stakePoolDepositSolTx(
|
|
3168
|
-
const
|
|
3169
|
-
const
|
|
3243
|
+
async stakePoolDepositSolTx(glamState, stakePool, amount, txOptions = {}) {
|
|
3244
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
3245
|
+
const glamVault = this.base.getVaultPda(glamState);
|
|
3170
3246
|
const { programId: stakePoolProgram, poolMint, withdrawAuthority, feeAccount, tokenProgramId: tokenProgram, reserveStake, } = await this.getStakePoolAccountData(stakePool);
|
|
3171
3247
|
console.log(`stakePool ${stakePool}, programId: ${stakePoolProgram}`);
|
|
3172
3248
|
const tx = await this.base.program.methods
|
|
3173
3249
|
.stakePoolDepositSol(amount)
|
|
3174
3250
|
.accountsPartial({
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
mintTo: this.base.getVaultAta(
|
|
3251
|
+
glamSigner,
|
|
3252
|
+
glamState,
|
|
3253
|
+
glamVault,
|
|
3254
|
+
mintTo: this.base.getVaultAta(glamState, poolMint),
|
|
3179
3255
|
stakePoolProgram,
|
|
3180
3256
|
stakePool,
|
|
3181
3257
|
poolMint: poolMint,
|
|
@@ -3187,9 +3263,9 @@ class StakingClient {
|
|
|
3187
3263
|
.transaction();
|
|
3188
3264
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
3189
3265
|
}
|
|
3190
|
-
async stakePoolDepositStakeTx(
|
|
3191
|
-
const
|
|
3192
|
-
const
|
|
3266
|
+
async stakePoolDepositStakeTx(glamState, stakePool, stakeAccount, txOptions = {}) {
|
|
3267
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
3268
|
+
const glamVault = this.base.getVaultPda(glamState);
|
|
3193
3269
|
const { programId: stakePoolProgram, poolMint, depositAuthority, withdrawAuthority, feeAccount, validatorList, tokenProgramId: tokenProgram, reserveStake, } = await this.getStakePoolAccountData(stakePool);
|
|
3194
3270
|
// All stake accounts owned by the stake pool withdraw authority
|
|
3195
3271
|
const validatorStakeCandidates = await this.getStakeAccountsWithStates(withdrawAuthority);
|
|
@@ -3206,11 +3282,11 @@ class StakingClient {
|
|
|
3206
3282
|
const tx = await this.base.program.methods
|
|
3207
3283
|
.stakePoolDepositStake()
|
|
3208
3284
|
.accountsPartial({
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3285
|
+
glamSigner,
|
|
3286
|
+
glamState,
|
|
3287
|
+
glamVault,
|
|
3212
3288
|
vaultStakeAccount: stakeAccount,
|
|
3213
|
-
mintTo: this.base.getVaultAta(
|
|
3289
|
+
mintTo: this.base.getVaultAta(glamState, poolMint),
|
|
3214
3290
|
poolMint,
|
|
3215
3291
|
feeAccount,
|
|
3216
3292
|
stakePool,
|
|
@@ -3228,9 +3304,9 @@ class StakingClient {
|
|
|
3228
3304
|
.transaction();
|
|
3229
3305
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
3230
3306
|
}
|
|
3231
|
-
async stakePoolWithdrawStakeTx(
|
|
3232
|
-
const
|
|
3233
|
-
const
|
|
3307
|
+
async stakePoolWithdrawStakeTx(glamState, stakePool, amount, deactivate = false, txOptions = {}) {
|
|
3308
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
3309
|
+
const glamVault = this.base.getVaultPda(glamState);
|
|
3234
3310
|
const { programId: stakePoolProgram, poolMint, withdrawAuthority, feeAccount, tokenProgramId: tokenProgram, validatorList, reserveStake, } = await this.getStakePoolAccountData(stakePool);
|
|
3235
3311
|
// The reserve stake account should NOT be used for withdrawals unless we have no other options.
|
|
3236
3312
|
const validatorStakeCandidates = (await this.getStakeAccountsWithStates(withdrawAuthority)).filter((s) => !s.address.equals(reserveStake));
|
|
@@ -3238,15 +3314,15 @@ class StakingClient {
|
|
|
3238
3314
|
const validatorStakeAccount = validatorStakeCandidates.length === 0
|
|
3239
3315
|
? reserveStake
|
|
3240
3316
|
: validatorStakeCandidates[0].address;
|
|
3241
|
-
const [stakeAccount, createStakeAccountIx] = await this.createStakeAccount(
|
|
3317
|
+
const [stakeAccount, createStakeAccountIx] = await this.createStakeAccount(glamSigner);
|
|
3242
3318
|
const postInstructions = deactivate
|
|
3243
3319
|
? [
|
|
3244
3320
|
await this.base.program.methods
|
|
3245
3321
|
.deactivateStakeAccounts()
|
|
3246
3322
|
.accountsPartial({
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3323
|
+
glamSigner,
|
|
3324
|
+
glamState,
|
|
3325
|
+
glamVault,
|
|
3250
3326
|
clock: web3_js_1.SYSVAR_CLOCK_PUBKEY,
|
|
3251
3327
|
stakeProgram: web3_js_1.StakeProgram.programId,
|
|
3252
3328
|
})
|
|
@@ -3263,14 +3339,14 @@ class StakingClient {
|
|
|
3263
3339
|
const tx = await this.base.program.methods
|
|
3264
3340
|
.stakePoolWithdrawStake(amount)
|
|
3265
3341
|
.accountsPartial({
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3342
|
+
glamSigner,
|
|
3343
|
+
glamState,
|
|
3344
|
+
glamVault,
|
|
3269
3345
|
vaultStakeAccount: stakeAccount,
|
|
3270
3346
|
stakePoolProgram,
|
|
3271
3347
|
stakePool,
|
|
3272
3348
|
poolMint,
|
|
3273
|
-
poolTokenAta: this.base.getVaultAta(
|
|
3349
|
+
poolTokenAta: this.base.getVaultAta(glamState, poolMint),
|
|
3274
3350
|
validatorList,
|
|
3275
3351
|
validatorStakeAccount,
|
|
3276
3352
|
withdrawAuthority,
|
|
@@ -3284,16 +3360,16 @@ class StakingClient {
|
|
|
3284
3360
|
.transaction();
|
|
3285
3361
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
3286
3362
|
}
|
|
3287
|
-
async initializeAndDelegateStakeTx(
|
|
3288
|
-
const
|
|
3289
|
-
const
|
|
3290
|
-
const [stakeAccount, createStakeAccountIx] = await this.createStakeAccount(
|
|
3363
|
+
async initializeAndDelegateStakeTx(glamState, vote, amount, txOptions = {}) {
|
|
3364
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
3365
|
+
const glamVault = this.base.getVaultPda(glamState);
|
|
3366
|
+
const [stakeAccount, createStakeAccountIx] = await this.createStakeAccount(glamSigner);
|
|
3291
3367
|
const tx = await this.base.program.methods
|
|
3292
3368
|
.initializeAndDelegateStake(amount)
|
|
3293
3369
|
.accountsPartial({
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3370
|
+
glamState,
|
|
3371
|
+
glamSigner,
|
|
3372
|
+
glamVault,
|
|
3297
3373
|
vaultStakeAccount: stakeAccount,
|
|
3298
3374
|
vote,
|
|
3299
3375
|
stakeConfig: web3_js_1.STAKE_CONFIG_ID,
|
|
@@ -3304,15 +3380,15 @@ class StakingClient {
|
|
|
3304
3380
|
.transaction();
|
|
3305
3381
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
3306
3382
|
}
|
|
3307
|
-
async deactivateStakeAccountsTx(
|
|
3308
|
-
const
|
|
3309
|
-
const
|
|
3383
|
+
async deactivateStakeAccountsTx(glamState, stakeAccounts, txOptions = {}) {
|
|
3384
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
3385
|
+
const glamVault = this.base.getVaultPda(glamState);
|
|
3310
3386
|
const tx = await this.base.program.methods
|
|
3311
3387
|
.deactivateStakeAccounts()
|
|
3312
3388
|
.accountsPartial({
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3389
|
+
glamState,
|
|
3390
|
+
glamSigner,
|
|
3391
|
+
glamVault,
|
|
3316
3392
|
clock: web3_js_1.SYSVAR_CLOCK_PUBKEY,
|
|
3317
3393
|
stakeProgram: web3_js_1.StakeProgram.programId,
|
|
3318
3394
|
})
|
|
@@ -3324,15 +3400,15 @@ class StakingClient {
|
|
|
3324
3400
|
.transaction();
|
|
3325
3401
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
3326
3402
|
}
|
|
3327
|
-
async withdrawFromStakeAccountsTx(
|
|
3328
|
-
const
|
|
3329
|
-
const
|
|
3403
|
+
async withdrawFromStakeAccountsTx(glamState, stakeAccounts, txOptions = {}) {
|
|
3404
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
3405
|
+
const glamVault = this.base.getVaultPda(glamState);
|
|
3330
3406
|
const tx = await this.base.program.methods
|
|
3331
3407
|
.withdrawFromStakeAccounts()
|
|
3332
3408
|
.accountsPartial({
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3409
|
+
glamSigner,
|
|
3410
|
+
glamState,
|
|
3411
|
+
glamVault,
|
|
3336
3412
|
clock: web3_js_1.SYSVAR_CLOCK_PUBKEY,
|
|
3337
3413
|
stakeHistory: web3_js_1.SYSVAR_STAKE_HISTORY_PUBKEY,
|
|
3338
3414
|
stakeProgram: web3_js_1.StakeProgram.programId,
|
|
@@ -3345,15 +3421,15 @@ class StakingClient {
|
|
|
3345
3421
|
.transaction();
|
|
3346
3422
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
3347
3423
|
}
|
|
3348
|
-
async mergeStakeAccountsTx(
|
|
3349
|
-
const
|
|
3350
|
-
const
|
|
3424
|
+
async mergeStakeAccountsTx(glamState, toStake, fromStake, txOptions = {}) {
|
|
3425
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
3426
|
+
const glamVault = this.base.getVaultPda(glamState);
|
|
3351
3427
|
const tx = await this.base.program.methods
|
|
3352
3428
|
.mergeStakeAccounts()
|
|
3353
3429
|
.accountsPartial({
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3430
|
+
glamSigner,
|
|
3431
|
+
glamState,
|
|
3432
|
+
glamVault,
|
|
3357
3433
|
toStake,
|
|
3358
3434
|
fromStake,
|
|
3359
3435
|
stakeProgram: web3_js_1.StakeProgram.programId,
|
|
@@ -3362,16 +3438,16 @@ class StakingClient {
|
|
|
3362
3438
|
.transaction();
|
|
3363
3439
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
3364
3440
|
}
|
|
3365
|
-
async splitStakeAccountTx(
|
|
3366
|
-
const
|
|
3367
|
-
const
|
|
3368
|
-
const [newStake, createStakeAccountIx] = await this.createStakeAccount(
|
|
3441
|
+
async splitStakeAccountTx(glamState, existingStake, lamports, txOptions = {}) {
|
|
3442
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
3443
|
+
const glamVault = this.base.getVaultPda(glamState);
|
|
3444
|
+
const [newStake, createStakeAccountIx] = await this.createStakeAccount(glamSigner);
|
|
3369
3445
|
const tx = await this.base.program.methods
|
|
3370
3446
|
.splitStakeAccount(lamports)
|
|
3371
3447
|
.accountsPartial({
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3448
|
+
glamSigner,
|
|
3449
|
+
glamState,
|
|
3450
|
+
glamVault,
|
|
3375
3451
|
existingStake,
|
|
3376
3452
|
newStake,
|
|
3377
3453
|
stakeProgram: web3_js_1.StakeProgram.programId,
|
|
@@ -3381,16 +3457,16 @@ class StakingClient {
|
|
|
3381
3457
|
const vTx = await this.base.intoVersionedTransaction(tx, txOptions);
|
|
3382
3458
|
return { tx: vTx, newStake };
|
|
3383
3459
|
}
|
|
3384
|
-
async redelegateStakeTx(
|
|
3385
|
-
const
|
|
3386
|
-
const
|
|
3387
|
-
const [newStake, createStakeAccountIx] = await this.createStakeAccount(
|
|
3460
|
+
async redelegateStakeTx(glamState, existingStake, vote, txOptions = {}) {
|
|
3461
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
3462
|
+
const glamVault = this.base.getVaultPda(glamState);
|
|
3463
|
+
const [newStake, createStakeAccountIx] = await this.createStakeAccount(glamSigner);
|
|
3388
3464
|
const tx = await this.base.program.methods
|
|
3389
3465
|
.redelegateStake()
|
|
3390
3466
|
.accountsPartial({
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3467
|
+
glamSigner,
|
|
3468
|
+
glamState,
|
|
3469
|
+
glamVault,
|
|
3394
3470
|
vote,
|
|
3395
3471
|
existingStake,
|
|
3396
3472
|
newStake,
|
|
@@ -3434,10 +3510,11 @@ class StateClient {
|
|
|
3434
3510
|
this.base = base;
|
|
3435
3511
|
}
|
|
3436
3512
|
async createState(partialStateModel, singleTx = false, txOptions = {}) {
|
|
3513
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
3437
3514
|
let stateModel = this.enrichStateModel(partialStateModel);
|
|
3438
|
-
const
|
|
3439
|
-
const
|
|
3440
|
-
const openfunds = this.base.getOpenfundsPda(
|
|
3515
|
+
const glamState = this.base.getStatePda(stateModel);
|
|
3516
|
+
const glamVault = this.base.getVaultPda(glamState);
|
|
3517
|
+
const openfunds = this.base.getOpenfundsPda(glamState);
|
|
3441
3518
|
const mints = stateModel.mints;
|
|
3442
3519
|
stateModel.mints = [];
|
|
3443
3520
|
if (mints && mints.length > 1) {
|
|
@@ -3447,55 +3524,50 @@ class StateClient {
|
|
|
3447
3524
|
if (mints && mints.length === 0) {
|
|
3448
3525
|
const txSig = await this.base.program.methods
|
|
3449
3526
|
.initializeState(stateModel)
|
|
3450
|
-
.accountsPartial({
|
|
3451
|
-
state: statePda,
|
|
3452
|
-
vault,
|
|
3453
|
-
openfundsMetadata: openfunds,
|
|
3454
|
-
})
|
|
3527
|
+
.accountsPartial({ glamState, glamSigner, glamVault })
|
|
3455
3528
|
.rpc();
|
|
3456
|
-
return [txSig,
|
|
3529
|
+
return [txSig, glamState];
|
|
3457
3530
|
}
|
|
3458
3531
|
if (mints && mints.length > 0 && singleTx) {
|
|
3459
3532
|
const initStateIx = await this.base.program.methods
|
|
3460
3533
|
.initializeState(stateModel)
|
|
3461
|
-
.accountsPartial({
|
|
3462
|
-
state: statePda,
|
|
3463
|
-
vault,
|
|
3464
|
-
openfundsMetadata: openfunds,
|
|
3465
|
-
})
|
|
3534
|
+
.accountsPartial({ glamState, glamSigner, glamVault })
|
|
3466
3535
|
.instruction();
|
|
3467
3536
|
// FIXME: setting rawOpenfunds to null is a workarond for
|
|
3468
3537
|
// Access violation in stack frame 5 at address 0x200005ff8 of size 8
|
|
3469
3538
|
mints[0].rawOpenfunds = null;
|
|
3470
|
-
const
|
|
3539
|
+
const newMint = this.base.getMintPda(glamState, 0);
|
|
3471
3540
|
const txSig = await this.base.program.methods
|
|
3472
3541
|
.addMint(mints[0])
|
|
3473
3542
|
.accounts({
|
|
3474
|
-
glamState
|
|
3475
|
-
|
|
3543
|
+
glamState,
|
|
3544
|
+
glamSigner,
|
|
3545
|
+
newMint,
|
|
3476
3546
|
})
|
|
3477
3547
|
.preInstructions([initStateIx])
|
|
3478
3548
|
.rpc();
|
|
3479
|
-
return [txSig,
|
|
3549
|
+
return [txSig, glamState];
|
|
3480
3550
|
}
|
|
3481
3551
|
const txSig = await this.base.program.methods
|
|
3482
3552
|
.initializeState(stateModel)
|
|
3483
3553
|
.accountsPartial({
|
|
3484
|
-
|
|
3485
|
-
|
|
3554
|
+
glamState,
|
|
3555
|
+
glamVault,
|
|
3556
|
+
glamSigner,
|
|
3486
3557
|
openfundsMetadata: openfunds,
|
|
3487
3558
|
})
|
|
3488
3559
|
.rpc();
|
|
3489
3560
|
const addMintTxs = await Promise.all((mints || []).map(async (mint, j) => {
|
|
3490
|
-
const
|
|
3561
|
+
const newMint = this.base.getMintPda(glamState, j);
|
|
3491
3562
|
// FIXME: setting rawOpenfunds to null is a workarond for
|
|
3492
3563
|
// Access violation in stack frame 5 at address 0x200005ff8 of size 8
|
|
3493
3564
|
mint.rawOpenfunds = null;
|
|
3494
3565
|
return await this.base.program.methods
|
|
3495
3566
|
.addMint(mint)
|
|
3496
3567
|
.accounts({
|
|
3497
|
-
glamState
|
|
3498
|
-
|
|
3568
|
+
glamState,
|
|
3569
|
+
glamSigner,
|
|
3570
|
+
newMint,
|
|
3499
3571
|
})
|
|
3500
3572
|
.preInstructions([
|
|
3501
3573
|
// FIXME: estimate compute units
|
|
@@ -3504,28 +3576,32 @@ class StateClient {
|
|
|
3504
3576
|
.rpc();
|
|
3505
3577
|
}));
|
|
3506
3578
|
console.log("addMintTxs", addMintTxs);
|
|
3507
|
-
return [txSig,
|
|
3579
|
+
return [txSig, glamState];
|
|
3508
3580
|
}
|
|
3509
|
-
async updateState(
|
|
3510
|
-
console.log(`await glam.state.updateState("${
|
|
3511
|
-
const tx = await this.updateStateTx(getPublicKey(
|
|
3581
|
+
async updateState(glamState, updated, txOptions = {}) {
|
|
3582
|
+
console.log(`await glam.state.updateState("${glamState.toString()}", ${JSON.stringify(updated)}, ${JSON.stringify(txOptions)});`);
|
|
3583
|
+
const tx = await this.updateStateTx(getPublicKey(glamState), updated, txOptions);
|
|
3512
3584
|
return await this.base.sendAndConfirm(tx);
|
|
3513
3585
|
}
|
|
3514
|
-
async updateStateTx(
|
|
3586
|
+
async updateStateTx(glamState, updated, txOptions) {
|
|
3587
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
3515
3588
|
const tx = await this.base.program.methods
|
|
3516
3589
|
.updateState(new models_1.StateModel(updated))
|
|
3517
3590
|
.accounts({
|
|
3518
|
-
|
|
3591
|
+
glamState,
|
|
3592
|
+
glamSigner,
|
|
3519
3593
|
})
|
|
3594
|
+
.preInstructions(txOptions.preInstructions || [])
|
|
3520
3595
|
.transaction();
|
|
3521
3596
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
3522
3597
|
}
|
|
3523
|
-
async closeState(
|
|
3524
|
-
const
|
|
3598
|
+
async closeState(glamState, txOptions = {}) {
|
|
3599
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
3525
3600
|
const tx = await this.base.program.methods
|
|
3526
3601
|
.closeState()
|
|
3527
3602
|
.accounts({
|
|
3528
|
-
|
|
3603
|
+
glamState,
|
|
3604
|
+
glamSigner,
|
|
3529
3605
|
})
|
|
3530
3606
|
.preInstructions(txOptions.preInstructions || [])
|
|
3531
3607
|
.transaction();
|
|
@@ -3585,7 +3661,7 @@ class StateClient {
|
|
|
3585
3661
|
mint.rawOpenfunds.shareClassLaunchDate =
|
|
3586
3662
|
mint.rawOpenfunds.shareClassLaunchDate || defaultDate;
|
|
3587
3663
|
}
|
|
3588
|
-
mint.rawOpenfunds = new models_1.
|
|
3664
|
+
mint.rawOpenfunds = new models_1.MintOpenfundsModel(mint.rawOpenfunds);
|
|
3589
3665
|
mint.isRawOpenfunds = true;
|
|
3590
3666
|
}
|
|
3591
3667
|
else {
|
|
@@ -3617,34 +3693,36 @@ class StateClient {
|
|
|
3617
3693
|
});
|
|
3618
3694
|
return await this.updateState(statePda, updated, txOptions);
|
|
3619
3695
|
}
|
|
3620
|
-
async upsertDelegateAcls(
|
|
3621
|
-
return await this.updateState(
|
|
3696
|
+
async upsertDelegateAcls(glamState, delegateAcls, txOptions = {}) {
|
|
3697
|
+
return await this.updateState(glamState, { delegateAcls }, txOptions);
|
|
3622
3698
|
}
|
|
3623
|
-
async setSubscribeRedeemEnabled(
|
|
3699
|
+
async setSubscribeRedeemEnabled(glamState, enabled, txOptions = {}) {
|
|
3700
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
3624
3701
|
return await this.base.program.methods
|
|
3625
3702
|
.setSubscribeRedeemEnabled(enabled)
|
|
3626
3703
|
.accounts({
|
|
3627
|
-
|
|
3704
|
+
glamState,
|
|
3705
|
+
glamSigner,
|
|
3628
3706
|
})
|
|
3629
3707
|
.rpc();
|
|
3630
3708
|
}
|
|
3631
|
-
async closeTokenAccounts(
|
|
3632
|
-
const tx = await this.closeTokenAccountsTx(
|
|
3709
|
+
async closeTokenAccounts(glamState, tokenAccounts, txOptions = {}) {
|
|
3710
|
+
const tx = await this.closeTokenAccountsTx(glamState, tokenAccounts, txOptions);
|
|
3633
3711
|
return await this.base.sendAndConfirm(tx);
|
|
3634
3712
|
}
|
|
3635
3713
|
/**
|
|
3636
3714
|
* Close fund treasury's token accounts
|
|
3637
3715
|
*
|
|
3638
|
-
* @param
|
|
3716
|
+
* @param glamState
|
|
3639
3717
|
* @param tokenAccounts
|
|
3640
3718
|
* @param txOptions
|
|
3641
3719
|
* @returns
|
|
3642
3720
|
*/
|
|
3643
|
-
async closeTokenAccountsIx(
|
|
3721
|
+
async closeTokenAccountsIx(glamState, tokenAccounts) {
|
|
3644
3722
|
return await this.base.program.methods
|
|
3645
3723
|
.closeTokenAccounts()
|
|
3646
3724
|
.accounts({
|
|
3647
|
-
|
|
3725
|
+
glamState,
|
|
3648
3726
|
})
|
|
3649
3727
|
.remainingAccounts(tokenAccounts.map((account) => ({
|
|
3650
3728
|
pubkey: account,
|
|
@@ -3653,11 +3731,13 @@ class StateClient {
|
|
|
3653
3731
|
})))
|
|
3654
3732
|
.instruction();
|
|
3655
3733
|
}
|
|
3656
|
-
async closeTokenAccountsTx(
|
|
3734
|
+
async closeTokenAccountsTx(glamState, tokenAccounts, txOptions) {
|
|
3735
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
3657
3736
|
const tx = await this.base.program.methods
|
|
3658
3737
|
.closeTokenAccounts()
|
|
3659
3738
|
.accounts({
|
|
3660
|
-
|
|
3739
|
+
glamState,
|
|
3740
|
+
glamSigner,
|
|
3661
3741
|
})
|
|
3662
3742
|
.remainingAccounts(tokenAccounts.map((account) => ({
|
|
3663
3743
|
pubkey: account,
|
|
@@ -3668,12 +3748,36 @@ class StateClient {
|
|
|
3668
3748
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
3669
3749
|
}
|
|
3670
3750
|
/* Deposit & Withdraw */
|
|
3671
|
-
async deposit(
|
|
3672
|
-
const tx = await this.depositTx(
|
|
3751
|
+
async deposit(glamState, asset, amount, txOptions = {}) {
|
|
3752
|
+
const tx = await this.depositTx(new web3_js_1.PublicKey(glamState), new web3_js_1.PublicKey(asset), amount, txOptions);
|
|
3673
3753
|
return await this.base.sendAndConfirm(tx);
|
|
3674
3754
|
}
|
|
3675
|
-
async
|
|
3676
|
-
const tx = await this.
|
|
3755
|
+
async depositSol(glamState, lamports, wrap = true, txOptions = {}) {
|
|
3756
|
+
const tx = await this.depositSolTx(glamState, lamports, wrap, txOptions);
|
|
3757
|
+
return await this.base.sendAndConfirm(tx);
|
|
3758
|
+
}
|
|
3759
|
+
async depositSolTx(glamState, lamports, wrap = true, txOptions = {}) {
|
|
3760
|
+
const signer = txOptions.signer || this.base.getSigner();
|
|
3761
|
+
const vault = this.base.getVaultPda(glamState);
|
|
3762
|
+
const _lamports = lamports instanceof anchor_1.BN ? BigInt(lamports.toString()) : lamports;
|
|
3763
|
+
if (!wrap) {
|
|
3764
|
+
const tx = new web3_js_1.Transaction().add(web3_js_1.SystemProgram.transfer({
|
|
3765
|
+
fromPubkey: signer,
|
|
3766
|
+
toPubkey: vault,
|
|
3767
|
+
lamports: _lamports,
|
|
3768
|
+
}));
|
|
3769
|
+
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
3770
|
+
}
|
|
3771
|
+
const vaultAta = this.base.getAta(constants_1.WSOL, vault);
|
|
3772
|
+
const tx = new web3_js_1.Transaction().add((0, spl_token_1.createAssociatedTokenAccountIdempotentInstruction)(signer, vaultAta, vault, constants_1.WSOL), web3_js_1.SystemProgram.transfer({
|
|
3773
|
+
fromPubkey: signer,
|
|
3774
|
+
toPubkey: vaultAta,
|
|
3775
|
+
lamports: _lamports,
|
|
3776
|
+
}), (0, spl_token_1.createSyncNativeInstruction)(vaultAta));
|
|
3777
|
+
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
3778
|
+
}
|
|
3779
|
+
async withdraw(glamState, asset, amount, txOptions = {}) {
|
|
3780
|
+
const tx = await this.withdrawTx(glamState, new web3_js_1.PublicKey(asset), amount, txOptions);
|
|
3677
3781
|
return await this.base.sendAndConfirm(tx);
|
|
3678
3782
|
}
|
|
3679
3783
|
async depositTx(statePda, asset, amount, txOptions) {
|
|
@@ -3685,45 +3789,47 @@ class StateClient {
|
|
|
3685
3789
|
const tx = new web3_js_1.Transaction().add((0, spl_token_1.createAssociatedTokenAccountIdempotentInstruction)(signer, vaultAta, vault, asset, tokenProgram), (0, spl_token_1.createTransferCheckedInstruction)(signerAta, asset, vaultAta, signer, new anchor_1.BN(amount).toNumber(), mint.decimals, [], tokenProgram));
|
|
3686
3790
|
return await this.base.intoVersionedTransaction(tx, txOptions);
|
|
3687
3791
|
}
|
|
3688
|
-
async withdrawIxs(
|
|
3689
|
-
const
|
|
3792
|
+
async withdrawIxs(glamState, asset, amount, txOptions) {
|
|
3793
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
3690
3794
|
const { tokenProgram } = await this.base.fetchMintWithOwner(asset);
|
|
3691
|
-
const signerAta = this.base.getAta(asset,
|
|
3795
|
+
const signerAta = this.base.getAta(asset, glamSigner, tokenProgram);
|
|
3692
3796
|
return [
|
|
3693
|
-
(0, spl_token_1.createAssociatedTokenAccountIdempotentInstruction)(
|
|
3797
|
+
(0, spl_token_1.createAssociatedTokenAccountIdempotentInstruction)(glamSigner, signerAta, glamSigner, asset, tokenProgram),
|
|
3694
3798
|
await this.base.program.methods
|
|
3695
3799
|
.withdraw(new anchor_1.BN(amount))
|
|
3696
3800
|
.accounts({
|
|
3697
|
-
|
|
3801
|
+
glamState,
|
|
3802
|
+
glamSigner,
|
|
3698
3803
|
asset,
|
|
3699
3804
|
tokenProgram,
|
|
3700
3805
|
})
|
|
3701
3806
|
.instruction(),
|
|
3702
3807
|
];
|
|
3703
3808
|
}
|
|
3704
|
-
async withdrawTx(
|
|
3705
|
-
const
|
|
3809
|
+
async withdrawTx(glamState, asset, amount, txOptions) {
|
|
3810
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
3706
3811
|
const { tokenProgram } = await this.base.fetchMintWithOwner(asset);
|
|
3707
|
-
const signerAta = this.base.getAta(asset,
|
|
3812
|
+
const signerAta = this.base.getAta(asset, glamSigner, tokenProgram);
|
|
3708
3813
|
const preInstructions = [
|
|
3709
|
-
(0, spl_token_1.createAssociatedTokenAccountIdempotentInstruction)(
|
|
3814
|
+
(0, spl_token_1.createAssociatedTokenAccountIdempotentInstruction)(glamSigner, signerAta, glamSigner, asset, tokenProgram),
|
|
3710
3815
|
];
|
|
3711
3816
|
const postInstructions = [];
|
|
3712
3817
|
if (asset.equals(constants_1.WSOL)) {
|
|
3713
|
-
const wrapSolIx = await this.base.maybeWrapSol(
|
|
3818
|
+
const wrapSolIx = await this.base.maybeWrapSol(glamState, amount, glamSigner);
|
|
3714
3819
|
if (wrapSolIx) {
|
|
3715
3820
|
preInstructions.push(wrapSolIx);
|
|
3716
3821
|
// If we need to wrap SOL, it means the wSOL balance will be drained,
|
|
3717
3822
|
// and we close the wSOL token account for convenience
|
|
3718
|
-
postInstructions.push(await this.closeTokenAccountsIx(
|
|
3719
|
-
this.base.getVaultAta(
|
|
3823
|
+
postInstructions.push(await this.closeTokenAccountsIx(glamState, [
|
|
3824
|
+
this.base.getVaultAta(glamState, constants_1.WSOL),
|
|
3720
3825
|
]));
|
|
3721
3826
|
}
|
|
3722
3827
|
}
|
|
3723
3828
|
const tx = await this.base.program.methods
|
|
3724
3829
|
.withdraw(new anchor_1.BN(amount))
|
|
3725
3830
|
.accounts({
|
|
3726
|
-
|
|
3831
|
+
glamState,
|
|
3832
|
+
glamSigner,
|
|
3727
3833
|
asset,
|
|
3728
3834
|
tokenProgram,
|
|
3729
3835
|
})
|
|
@@ -3751,8 +3857,14 @@ class MintClient {
|
|
|
3751
3857
|
async getHolders(state, mintId = 0) {
|
|
3752
3858
|
const mintPda = this.base.getMintPda(state, mintId);
|
|
3753
3859
|
const connection = this.base.provider.connection;
|
|
3754
|
-
|
|
3755
|
-
|
|
3860
|
+
let mint;
|
|
3861
|
+
try {
|
|
3862
|
+
mint = await (0, spl_token_1.getMint)(connection, mintPda, connection.commitment, spl_token_1.TOKEN_2022_PROGRAM_ID);
|
|
3863
|
+
}
|
|
3864
|
+
catch (e) {
|
|
3865
|
+
return [];
|
|
3866
|
+
}
|
|
3867
|
+
// Size of a glam mint with perment delegate extension enabled
|
|
3756
3868
|
const dataSize = 175;
|
|
3757
3869
|
const accounts = await connection.getProgramAccounts(spl_token_1.TOKEN_2022_PROGRAM_ID, {
|
|
3758
3870
|
filters: [
|
|
@@ -3775,42 +3887,45 @@ class MintClient {
|
|
|
3775
3887
|
};
|
|
3776
3888
|
});
|
|
3777
3889
|
}
|
|
3778
|
-
async closeMintIx(
|
|
3779
|
-
const
|
|
3780
|
-
const mintPda = this.base.getMintPda(state, mintId);
|
|
3890
|
+
async closeMintIx(glamState, mintId = 0) {
|
|
3891
|
+
const glamMint = this.base.getMintPda(glamState, mintId);
|
|
3781
3892
|
return await this.base.program.methods
|
|
3782
3893
|
.closeMint(mintId)
|
|
3783
3894
|
.accounts({
|
|
3784
|
-
glamState
|
|
3785
|
-
glamMint
|
|
3895
|
+
glamState,
|
|
3896
|
+
glamMint,
|
|
3786
3897
|
})
|
|
3787
3898
|
.instruction();
|
|
3788
3899
|
}
|
|
3789
|
-
async closeMint(
|
|
3790
|
-
const
|
|
3791
|
-
const
|
|
3792
|
-
|
|
3900
|
+
async closeMint(glamState, mintId = 0, txOptions = {}) {
|
|
3901
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
3902
|
+
const glamMint = this.base.getMintPda(glamState, mintId);
|
|
3903
|
+
const tx = await this.base.program.methods
|
|
3793
3904
|
.closeMint(mintId)
|
|
3794
3905
|
.accounts({
|
|
3795
|
-
glamState
|
|
3796
|
-
|
|
3906
|
+
glamState,
|
|
3907
|
+
glamSigner,
|
|
3908
|
+
glamMint,
|
|
3797
3909
|
})
|
|
3798
|
-
.
|
|
3910
|
+
.transaction();
|
|
3911
|
+
const vTx = await this.base.intoVersionedTransaction(tx, txOptions);
|
|
3912
|
+
return await this.base.sendAndConfirm(vTx);
|
|
3799
3913
|
}
|
|
3800
3914
|
/**
|
|
3801
3915
|
* Create a share class token account for a specific user
|
|
3802
3916
|
*
|
|
3803
|
-
* @param
|
|
3917
|
+
* @param glamState
|
|
3804
3918
|
* @param owner
|
|
3805
3919
|
* @param mintId
|
|
3806
3920
|
* @param txOptions
|
|
3807
3921
|
* @returns
|
|
3808
3922
|
*/
|
|
3809
|
-
async createTokenAccount(
|
|
3810
|
-
const
|
|
3811
|
-
const
|
|
3812
|
-
const
|
|
3813
|
-
|
|
3923
|
+
async createTokenAccount(glamState, owner, mintId = 0, setFrozen = true, txOptions = {}) {
|
|
3924
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
3925
|
+
const glamMint = this.base.getMintPda(glamState, mintId);
|
|
3926
|
+
const ata = this.base.getMintAta(owner, glamMint);
|
|
3927
|
+
const ixCreateAta = (0, spl_token_1.createAssociatedTokenAccountIdempotentInstruction)(glamSigner, ata, owner, glamMint, spl_token_1.TOKEN_2022_PROGRAM_ID);
|
|
3928
|
+
return await this.setTokenAccountsStates(glamState, mintId, [ata], setFrozen, {
|
|
3814
3929
|
preInstructions: [ixCreateAta],
|
|
3815
3930
|
...txOptions,
|
|
3816
3931
|
});
|
|
@@ -3818,19 +3933,21 @@ class MintClient {
|
|
|
3818
3933
|
/**
|
|
3819
3934
|
* Freeze or thaw token accounts of a share class
|
|
3820
3935
|
*
|
|
3821
|
-
* @param
|
|
3936
|
+
* @param glamState
|
|
3822
3937
|
* @param mintId
|
|
3823
3938
|
* @param frozen
|
|
3824
3939
|
* @param txOptions
|
|
3825
3940
|
* @returns
|
|
3826
3941
|
*/
|
|
3827
|
-
async setTokenAccountsStates(
|
|
3828
|
-
const
|
|
3829
|
-
|
|
3942
|
+
async setTokenAccountsStates(glamState, mintId, tokenAccounts, frozen, txOptions = {}) {
|
|
3943
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
3944
|
+
const glamMint = this.base.getMintPda(glamState, mintId);
|
|
3945
|
+
const tx = await this.base.program.methods
|
|
3830
3946
|
.setTokenAccountsStates(mintId, frozen)
|
|
3831
3947
|
.accounts({
|
|
3832
|
-
glamState
|
|
3833
|
-
|
|
3948
|
+
glamState,
|
|
3949
|
+
glamSigner,
|
|
3950
|
+
glamMint,
|
|
3834
3951
|
})
|
|
3835
3952
|
.remainingAccounts(tokenAccounts.map((account) => ({
|
|
3836
3953
|
pubkey: account,
|
|
@@ -3838,12 +3955,14 @@ class MintClient {
|
|
|
3838
3955
|
isWritable: true,
|
|
3839
3956
|
})))
|
|
3840
3957
|
.preInstructions(txOptions.preInstructions || [])
|
|
3841
|
-
.
|
|
3958
|
+
.transaction();
|
|
3959
|
+
const vTx = await this.base.intoVersionedTransaction(tx, txOptions);
|
|
3960
|
+
return await this.base.sendAndConfirm(vTx);
|
|
3842
3961
|
}
|
|
3843
3962
|
/**
|
|
3844
3963
|
* Mint share to recipient
|
|
3845
3964
|
*
|
|
3846
|
-
* @param
|
|
3965
|
+
* @param glamState
|
|
3847
3966
|
* @param mintId
|
|
3848
3967
|
* @param recipient Recipient's wallet address
|
|
3849
3968
|
* @param amount Amount of shares to mint
|
|
@@ -3851,71 +3970,83 @@ class MintClient {
|
|
|
3851
3970
|
* @param txOptions
|
|
3852
3971
|
* @returns Transaction signature
|
|
3853
3972
|
*/
|
|
3854
|
-
async mint(
|
|
3855
|
-
const
|
|
3856
|
-
const
|
|
3973
|
+
async mint(glamState, mintId, recipient, amount, forceThaw = false, txOptions = {}) {
|
|
3974
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
3975
|
+
const glamMint = this.base.getMintPda(glamState, mintId);
|
|
3976
|
+
const mintTo = this.base.getMintAta(recipient, glamMint);
|
|
3857
3977
|
const preInstructions = [];
|
|
3858
|
-
preInstructions.push((0, spl_token_1.createAssociatedTokenAccountIdempotentInstruction)(
|
|
3978
|
+
preInstructions.push((0, spl_token_1.createAssociatedTokenAccountIdempotentInstruction)(glamSigner, mintTo, recipient, glamMint, spl_token_1.TOKEN_2022_PROGRAM_ID));
|
|
3859
3979
|
if (forceThaw) {
|
|
3860
3980
|
preInstructions.push(await this.base.program.methods
|
|
3861
3981
|
.setTokenAccountsStates(mintId, false)
|
|
3862
3982
|
.accounts({
|
|
3863
|
-
glamState
|
|
3864
|
-
|
|
3983
|
+
glamState,
|
|
3984
|
+
glamSigner,
|
|
3985
|
+
glamMint,
|
|
3865
3986
|
})
|
|
3866
3987
|
.remainingAccounts([
|
|
3867
3988
|
{ pubkey: mintTo, isSigner: false, isWritable: true },
|
|
3868
3989
|
])
|
|
3869
3990
|
.instruction());
|
|
3870
3991
|
}
|
|
3871
|
-
|
|
3992
|
+
const tx = await this.base.program.methods
|
|
3872
3993
|
.mintTokens(0, amount)
|
|
3873
3994
|
.accounts({
|
|
3995
|
+
glamState,
|
|
3996
|
+
glamSigner,
|
|
3997
|
+
glamMint,
|
|
3874
3998
|
recipient,
|
|
3875
|
-
glamState: state,
|
|
3876
|
-
glamMint: mintPda,
|
|
3877
3999
|
})
|
|
3878
4000
|
.preInstructions(preInstructions)
|
|
3879
|
-
.
|
|
4001
|
+
.transaction();
|
|
4002
|
+
const vTx = await this.base.intoVersionedTransaction(tx, txOptions);
|
|
4003
|
+
return await this.base.sendAndConfirm(vTx);
|
|
3880
4004
|
}
|
|
3881
|
-
async burn(
|
|
3882
|
-
const
|
|
3883
|
-
const
|
|
4005
|
+
async burn(glamState, mintId, amount, from, forceThaw = false, txOptions = {}) {
|
|
4006
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
4007
|
+
const glamMint = this.base.getMintPda(glamState, mintId);
|
|
4008
|
+
const ata = this.base.getMintAta(from, glamMint);
|
|
3884
4009
|
const preInstructions = [];
|
|
3885
4010
|
if (forceThaw) {
|
|
3886
4011
|
preInstructions.push(await this.base.program.methods
|
|
3887
4012
|
.setTokenAccountsStates(mintId, false)
|
|
3888
4013
|
.accounts({
|
|
3889
|
-
glamState
|
|
3890
|
-
|
|
4014
|
+
glamState,
|
|
4015
|
+
glamSigner,
|
|
4016
|
+
glamMint,
|
|
3891
4017
|
})
|
|
3892
4018
|
.remainingAccounts([
|
|
3893
4019
|
{ pubkey: ata, isSigner: false, isWritable: true },
|
|
3894
4020
|
])
|
|
3895
4021
|
.instruction());
|
|
3896
4022
|
}
|
|
3897
|
-
|
|
4023
|
+
const tx = await this.base.program.methods
|
|
3898
4024
|
.burnTokens(mintId, amount)
|
|
3899
4025
|
.accounts({
|
|
3900
|
-
glamState
|
|
3901
|
-
|
|
4026
|
+
glamState,
|
|
4027
|
+
glamSigner,
|
|
4028
|
+
glamMint,
|
|
3902
4029
|
from,
|
|
3903
4030
|
})
|
|
3904
4031
|
.preInstructions(preInstructions)
|
|
3905
|
-
.
|
|
4032
|
+
.transaction();
|
|
4033
|
+
const vTx = await this.base.intoVersionedTransaction(tx, txOptions);
|
|
4034
|
+
return await this.base.sendAndConfirm(vTx);
|
|
3906
4035
|
}
|
|
3907
|
-
async forceTransfer(
|
|
3908
|
-
const
|
|
3909
|
-
const
|
|
3910
|
-
const
|
|
4036
|
+
async forceTransfer(glamState, mintId, amount, from, to, forceThaw = false, txOptions = {}) {
|
|
4037
|
+
const glamSigner = txOptions.signer || this.base.getSigner();
|
|
4038
|
+
const glamMint = this.base.getMintPda(glamState, mintId);
|
|
4039
|
+
const fromAta = this.base.getMintAta(from, glamMint);
|
|
4040
|
+
const toAta = this.base.getMintAta(to, glamMint);
|
|
3911
4041
|
const preInstructions = [];
|
|
3912
|
-
preInstructions.push((0, spl_token_1.createAssociatedTokenAccountIdempotentInstruction)(this.base.getSigner(), toAta, to,
|
|
4042
|
+
preInstructions.push((0, spl_token_1.createAssociatedTokenAccountIdempotentInstruction)(this.base.getSigner(), toAta, to, glamMint, spl_token_1.TOKEN_2022_PROGRAM_ID));
|
|
3913
4043
|
if (forceThaw) {
|
|
3914
4044
|
preInstructions.push(await this.base.program.methods
|
|
3915
4045
|
.setTokenAccountsStates(mintId, false)
|
|
3916
4046
|
.accounts({
|
|
3917
|
-
glamState
|
|
3918
|
-
|
|
4047
|
+
glamState,
|
|
4048
|
+
glamSigner,
|
|
4049
|
+
glamMint,
|
|
3919
4050
|
})
|
|
3920
4051
|
.remainingAccounts([
|
|
3921
4052
|
// fromAta is already unfrozen, still add it to test the ix is idempotent
|
|
@@ -3924,16 +4055,19 @@ class MintClient {
|
|
|
3924
4055
|
])
|
|
3925
4056
|
.instruction());
|
|
3926
4057
|
}
|
|
3927
|
-
|
|
4058
|
+
const tx = await this.base.program.methods
|
|
3928
4059
|
.forceTransferTokens(mintId, amount)
|
|
3929
4060
|
.accounts({
|
|
3930
|
-
glamState
|
|
3931
|
-
|
|
4061
|
+
glamState,
|
|
4062
|
+
glamSigner,
|
|
4063
|
+
glamMint,
|
|
3932
4064
|
from,
|
|
3933
4065
|
to,
|
|
3934
4066
|
})
|
|
3935
4067
|
.preInstructions(preInstructions)
|
|
3936
|
-
.
|
|
4068
|
+
.transaction();
|
|
4069
|
+
const vTx = await this.base.intoVersionedTransaction(tx, txOptions);
|
|
4070
|
+
return await this.base.sendAndConfirm(vTx);
|
|
3937
4071
|
}
|
|
3938
4072
|
}
|
|
3939
4073
|
exports.MintClient = MintClient;
|
|
@@ -4236,6 +4370,218 @@ module.exports = require("@coral-xyz/borsh");
|
|
|
4236
4370
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
4237
4371
|
|
|
4238
4372
|
|
|
4373
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
4374
|
+
exports.MeteoraDlmmClient = void 0;
|
|
4375
|
+
const tslib_1 = __webpack_require__(1);
|
|
4376
|
+
const anchor_1 = __webpack_require__(2);
|
|
4377
|
+
const web3_js_1 = __webpack_require__(5);
|
|
4378
|
+
const dlmm_1 = tslib_1.__importStar(__webpack_require__(33));
|
|
4379
|
+
const spl_token_1 = __webpack_require__(8);
|
|
4380
|
+
const METEORA_DLMM = new web3_js_1.PublicKey("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo");
|
|
4381
|
+
const SOL_USDC_MARKET = new web3_js_1.PublicKey("5rCf1DM8LjKTw4YqhnoLcngyZYeNnQqztScTogYHAS6");
|
|
4382
|
+
const EVENT_AUTHORITY = new web3_js_1.PublicKey("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6");
|
|
4383
|
+
const DEFAULT_RANGE_INTERVAL = 34; // 34 bins on each side of the active bin, 69 bins in total
|
|
4384
|
+
class MeteoraDlmmClient {
|
|
4385
|
+
constructor(base) {
|
|
4386
|
+
this.base = base;
|
|
4387
|
+
this._dlmmPool = new Map();
|
|
4388
|
+
}
|
|
4389
|
+
async getDlmmPool(pool) {
|
|
4390
|
+
const key = typeof pool === "string" ? pool : pool.toString();
|
|
4391
|
+
if (!this._dlmmPool.get(key)) {
|
|
4392
|
+
this._dlmmPool.set(key, await dlmm_1.default.create(this.base.provider.connection, new web3_js_1.PublicKey(pool)));
|
|
4393
|
+
}
|
|
4394
|
+
const dlmmPool = this._dlmmPool.get(key);
|
|
4395
|
+
if (!dlmmPool) {
|
|
4396
|
+
throw new Error(`DLMM pool ${key} not found`);
|
|
4397
|
+
}
|
|
4398
|
+
return dlmmPool;
|
|
4399
|
+
}
|
|
4400
|
+
async initializePosition(statePda, pool, txOptions = {}) {
|
|
4401
|
+
const glamState = new web3_js_1.PublicKey(statePda);
|
|
4402
|
+
const dlmmPool = await this.getDlmmPool(pool);
|
|
4403
|
+
const activeBin = await dlmmPool.getActiveBin();
|
|
4404
|
+
const minBinId = activeBin.binId - DEFAULT_RANGE_INTERVAL;
|
|
4405
|
+
const maxBinId = activeBin.binId + DEFAULT_RANGE_INTERVAL;
|
|
4406
|
+
const position = web3_js_1.Keypair.generate();
|
|
4407
|
+
const tx = await this.base.program.methods
|
|
4408
|
+
.meteoraDlmmInitializePosition(minBinId, maxBinId - minBinId + 1)
|
|
4409
|
+
.accounts({
|
|
4410
|
+
glamState,
|
|
4411
|
+
lbPair: new web3_js_1.PublicKey(pool),
|
|
4412
|
+
position: position.publicKey,
|
|
4413
|
+
eventAuthority: EVENT_AUTHORITY,
|
|
4414
|
+
program: METEORA_DLMM,
|
|
4415
|
+
})
|
|
4416
|
+
.transaction();
|
|
4417
|
+
const vTx = await this.base.intoVersionedTransaction(tx, txOptions);
|
|
4418
|
+
return await this.base.sendAndConfirm(vTx, [position]);
|
|
4419
|
+
}
|
|
4420
|
+
async addLiquidity(statePda, position, amountX, strategyType, txOptions = {}) {
|
|
4421
|
+
const { lbPair, lowerBinId, upperBinId, binArrayLower, binArrayUpper } = await this.parsePosition(new web3_js_1.PublicKey(position));
|
|
4422
|
+
const dlmmPool = await this.getDlmmPool(lbPair);
|
|
4423
|
+
const { amountY, activeBinId } = await this.getAmounts(dlmmPool, new anchor_1.BN(amountX));
|
|
4424
|
+
const glamState = new web3_js_1.PublicKey(statePda);
|
|
4425
|
+
const vaultTokenXAta = this.base.getVaultAta(glamState, dlmmPool.tokenX.publicKey);
|
|
4426
|
+
const vaultTokenYAta = this.base.getVaultAta(glamState, dlmmPool.tokenY.publicKey);
|
|
4427
|
+
const strategy = {
|
|
4428
|
+
amountX: new anchor_1.BN(amountX),
|
|
4429
|
+
amountY,
|
|
4430
|
+
activeId: activeBinId,
|
|
4431
|
+
maxActiveBinSlippage: 20,
|
|
4432
|
+
strategyParameters: {
|
|
4433
|
+
minBinId: lowerBinId,
|
|
4434
|
+
maxBinId: upperBinId,
|
|
4435
|
+
strategyType: dlmm_1.Strategy[strategyType],
|
|
4436
|
+
parameteres: Array(64).fill(0),
|
|
4437
|
+
},
|
|
4438
|
+
};
|
|
4439
|
+
const tx = await this.base.program.methods
|
|
4440
|
+
.meteoraDlmmAddLiquidityByStrategy(strategy)
|
|
4441
|
+
.accounts({
|
|
4442
|
+
glamState,
|
|
4443
|
+
position: new web3_js_1.PublicKey(position),
|
|
4444
|
+
lbPair,
|
|
4445
|
+
binArrayBitmapExtension: dlmmPool.binArrayBitmapExtension
|
|
4446
|
+
? dlmmPool.binArrayBitmapExtension.publicKey
|
|
4447
|
+
: METEORA_DLMM,
|
|
4448
|
+
userTokenX: vaultTokenXAta,
|
|
4449
|
+
userTokenY: vaultTokenYAta,
|
|
4450
|
+
reserveX: dlmmPool.tokenX.reserve,
|
|
4451
|
+
reserveY: dlmmPool.tokenY.reserve,
|
|
4452
|
+
tokenXMint: dlmmPool.tokenX.publicKey,
|
|
4453
|
+
tokenYMint: dlmmPool.tokenY.publicKey,
|
|
4454
|
+
binArrayLower,
|
|
4455
|
+
binArrayUpper,
|
|
4456
|
+
tokenXProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
4457
|
+
tokenYProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
4458
|
+
eventAuthority: EVENT_AUTHORITY,
|
|
4459
|
+
program: METEORA_DLMM,
|
|
4460
|
+
})
|
|
4461
|
+
.transaction();
|
|
4462
|
+
const vTx = await this.base.intoVersionedTransaction(tx, txOptions);
|
|
4463
|
+
return this.base.sendAndConfirm(vTx);
|
|
4464
|
+
}
|
|
4465
|
+
async removeLiquidity(statePda, position, bpsToRemove, txOptions = {}) {
|
|
4466
|
+
const { lbPair, lowerBinId, upperBinId, binArrayLower, binArrayUpper } = await this.parsePosition(new web3_js_1.PublicKey(position));
|
|
4467
|
+
const dlmmPool = await this.getDlmmPool(lbPair);
|
|
4468
|
+
const glamState = new web3_js_1.PublicKey(statePda);
|
|
4469
|
+
const vaultTokenXAta = this.base.getVaultAta(glamState, dlmmPool.tokenX.publicKey);
|
|
4470
|
+
const vaultTokenYAta = this.base.getVaultAta(glamState, dlmmPool.tokenY.publicKey);
|
|
4471
|
+
const tx = await this.base.program.methods
|
|
4472
|
+
.meteoraDlmmRemoveLiquidityByRange(lowerBinId, upperBinId, bpsToRemove)
|
|
4473
|
+
.accounts({
|
|
4474
|
+
glamState,
|
|
4475
|
+
position: new web3_js_1.PublicKey(position),
|
|
4476
|
+
lbPair,
|
|
4477
|
+
binArrayBitmapExtension: dlmmPool.binArrayBitmapExtension
|
|
4478
|
+
? dlmmPool.binArrayBitmapExtension.publicKey
|
|
4479
|
+
: METEORA_DLMM,
|
|
4480
|
+
userTokenX: vaultTokenXAta,
|
|
4481
|
+
userTokenY: vaultTokenYAta,
|
|
4482
|
+
reserveX: dlmmPool.tokenX.reserve,
|
|
4483
|
+
reserveY: dlmmPool.tokenY.reserve,
|
|
4484
|
+
tokenXMint: dlmmPool.tokenX.publicKey,
|
|
4485
|
+
tokenYMint: dlmmPool.tokenY.publicKey,
|
|
4486
|
+
binArrayLower,
|
|
4487
|
+
binArrayUpper,
|
|
4488
|
+
tokenXProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
4489
|
+
tokenYProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
4490
|
+
eventAuthority: EVENT_AUTHORITY,
|
|
4491
|
+
program: METEORA_DLMM,
|
|
4492
|
+
})
|
|
4493
|
+
.transaction();
|
|
4494
|
+
const vTx = await this.base.intoVersionedTransaction(tx, txOptions);
|
|
4495
|
+
return this.base.sendAndConfirm(vTx);
|
|
4496
|
+
}
|
|
4497
|
+
async claimFee(statePda, position, txOptions = {}) {
|
|
4498
|
+
const { lbPair, binArrayLower, binArrayUpper } = await this.parsePosition(new web3_js_1.PublicKey(position));
|
|
4499
|
+
const dlmmPool = await this.getDlmmPool(lbPair);
|
|
4500
|
+
const glamState = new web3_js_1.PublicKey(statePda);
|
|
4501
|
+
const vaultTokenXAta = this.base.getVaultAta(glamState, dlmmPool.tokenX.publicKey);
|
|
4502
|
+
const vaultTokenYAta = this.base.getVaultAta(glamState, dlmmPool.tokenY.publicKey);
|
|
4503
|
+
const tx = await this.base.program.methods
|
|
4504
|
+
.meteoraDlmmClaimFee()
|
|
4505
|
+
.accounts({
|
|
4506
|
+
glamState,
|
|
4507
|
+
position: new web3_js_1.PublicKey(position),
|
|
4508
|
+
lbPair,
|
|
4509
|
+
binArrayLower,
|
|
4510
|
+
binArrayUpper,
|
|
4511
|
+
reserveX: dlmmPool.tokenX.reserve,
|
|
4512
|
+
reserveY: dlmmPool.tokenY.reserve,
|
|
4513
|
+
userTokenX: vaultTokenXAta,
|
|
4514
|
+
userTokenY: vaultTokenYAta,
|
|
4515
|
+
tokenXMint: dlmmPool.tokenX.publicKey,
|
|
4516
|
+
tokenYMint: dlmmPool.tokenY.publicKey,
|
|
4517
|
+
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
4518
|
+
eventAuthority: EVENT_AUTHORITY,
|
|
4519
|
+
program: METEORA_DLMM,
|
|
4520
|
+
})
|
|
4521
|
+
.transaction();
|
|
4522
|
+
const vTx = await this.base.intoVersionedTransaction(tx, txOptions);
|
|
4523
|
+
return await this.base.sendAndConfirm(vTx);
|
|
4524
|
+
}
|
|
4525
|
+
async closePosition(statePda, position, txOptions = {}) {
|
|
4526
|
+
const { lbPair, binArrayLower, binArrayUpper } = await this.parsePosition(new web3_js_1.PublicKey(position));
|
|
4527
|
+
const glamState = new web3_js_1.PublicKey(statePda);
|
|
4528
|
+
const tx = await this.base.program.methods
|
|
4529
|
+
.meteoraDlmmClosePosition()
|
|
4530
|
+
.accounts({
|
|
4531
|
+
glamState,
|
|
4532
|
+
position: new web3_js_1.PublicKey(position),
|
|
4533
|
+
lbPair,
|
|
4534
|
+
binArrayLower,
|
|
4535
|
+
binArrayUpper,
|
|
4536
|
+
eventAuthority: EVENT_AUTHORITY,
|
|
4537
|
+
program: METEORA_DLMM,
|
|
4538
|
+
})
|
|
4539
|
+
.transaction();
|
|
4540
|
+
const vTx = await this.base.intoVersionedTransaction(tx, txOptions);
|
|
4541
|
+
return await this.base.sendAndConfirm(vTx);
|
|
4542
|
+
}
|
|
4543
|
+
async parsePosition(position) {
|
|
4544
|
+
const positionAccountInfo = await this.base.provider.connection.getAccountInfo(position);
|
|
4545
|
+
if (!positionAccountInfo) {
|
|
4546
|
+
throw new Error("Position not found");
|
|
4547
|
+
}
|
|
4548
|
+
const positionData = positionAccountInfo.data;
|
|
4549
|
+
const lbPair = new web3_js_1.PublicKey(positionData.subarray(8, 40));
|
|
4550
|
+
const lowerBinId = positionData.subarray(7912, 7916).readInt32LE();
|
|
4551
|
+
const upperBinId = positionData.subarray(7916, 7920).readInt32LE();
|
|
4552
|
+
const lowerBinArrayIndex = (0, dlmm_1.binIdToBinArrayIndex)(new anchor_1.BN(lowerBinId));
|
|
4553
|
+
const [binArrayLower] = (0, dlmm_1.deriveBinArray)(lbPair, lowerBinArrayIndex, METEORA_DLMM);
|
|
4554
|
+
const upperBinArrayIndex = anchor_1.BN.max(lowerBinArrayIndex.add(new anchor_1.BN(1)), (0, dlmm_1.binIdToBinArrayIndex)(new anchor_1.BN(upperBinId)));
|
|
4555
|
+
const [binArrayUpper] = (0, dlmm_1.deriveBinArray)(lbPair, upperBinArrayIndex, METEORA_DLMM);
|
|
4556
|
+
return {
|
|
4557
|
+
lowerBinId,
|
|
4558
|
+
upperBinId,
|
|
4559
|
+
binArrayLower,
|
|
4560
|
+
binArrayUpper,
|
|
4561
|
+
lbPair,
|
|
4562
|
+
};
|
|
4563
|
+
}
|
|
4564
|
+
async getAmounts(dlmmPool, amountX) {
|
|
4565
|
+
const activeBin = await dlmmPool.getActiveBin();
|
|
4566
|
+
const activeBinPricePerToken = dlmmPool.fromPricePerLamport(Number(activeBin.price));
|
|
4567
|
+
const amountY = amountX.mul(new anchor_1.BN(Number(activeBinPricePerToken)));
|
|
4568
|
+
return { amountX, amountY, activeBinId: activeBin.binId };
|
|
4569
|
+
}
|
|
4570
|
+
}
|
|
4571
|
+
exports.MeteoraDlmmClient = MeteoraDlmmClient;
|
|
4572
|
+
|
|
4573
|
+
|
|
4574
|
+
/***/ }),
|
|
4575
|
+
/* 33 */
|
|
4576
|
+
/***/ ((module) => {
|
|
4577
|
+
|
|
4578
|
+
module.exports = require("@meteora-ag/dlmm");
|
|
4579
|
+
|
|
4580
|
+
/***/ }),
|
|
4581
|
+
/* 34 */
|
|
4582
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
4583
|
+
|
|
4584
|
+
|
|
4239
4585
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
4240
4586
|
exports.getPriorityFeeEstimate = void 0;
|
|
4241
4587
|
const bytes_1 = __webpack_require__(17);
|
|
@@ -4270,25 +4616,25 @@ exports.getPriorityFeeEstimate = getPriorityFeeEstimate;
|
|
|
4270
4616
|
|
|
4271
4617
|
|
|
4272
4618
|
/***/ }),
|
|
4273
|
-
/*
|
|
4619
|
+
/* 35 */
|
|
4274
4620
|
/***/ ((module) => {
|
|
4275
4621
|
|
|
4276
4622
|
module.exports = require("commander");
|
|
4277
4623
|
|
|
4278
4624
|
/***/ }),
|
|
4279
|
-
/*
|
|
4625
|
+
/* 36 */
|
|
4280
4626
|
/***/ ((module) => {
|
|
4281
4627
|
|
|
4282
4628
|
module.exports = require("fs");
|
|
4283
4629
|
|
|
4284
4630
|
/***/ }),
|
|
4285
|
-
/*
|
|
4631
|
+
/* 37 */
|
|
4286
4632
|
/***/ ((module) => {
|
|
4287
4633
|
|
|
4288
4634
|
module.exports = require("inquirer");
|
|
4289
4635
|
|
|
4290
4636
|
/***/ }),
|
|
4291
|
-
/*
|
|
4637
|
+
/* 38 */
|
|
4292
4638
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
4293
4639
|
|
|
4294
4640
|
|
|
@@ -4297,9 +4643,9 @@ exports.parseTxError = exports.setStateToConfig = exports.loadingConfig = void 0
|
|
|
4297
4643
|
const tslib_1 = __webpack_require__(1);
|
|
4298
4644
|
const anchor_1 = __webpack_require__(2);
|
|
4299
4645
|
const web3_js_1 = __webpack_require__(5);
|
|
4300
|
-
const fs_1 = tslib_1.__importDefault(__webpack_require__(
|
|
4301
|
-
const os_1 = tslib_1.__importDefault(__webpack_require__(
|
|
4302
|
-
const path_1 = tslib_1.__importDefault(__webpack_require__(
|
|
4646
|
+
const fs_1 = tslib_1.__importDefault(__webpack_require__(36));
|
|
4647
|
+
const os_1 = tslib_1.__importDefault(__webpack_require__(39));
|
|
4648
|
+
const path_1 = tslib_1.__importDefault(__webpack_require__(40));
|
|
4303
4649
|
const getConfigPath = () => {
|
|
4304
4650
|
// By default config.json is under ~/.config/glam/
|
|
4305
4651
|
// If running in docker, config.json is expected to be at /workspace/config.json
|
|
@@ -4354,13 +4700,13 @@ exports.parseTxError = parseTxError;
|
|
|
4354
4700
|
|
|
4355
4701
|
|
|
4356
4702
|
/***/ }),
|
|
4357
|
-
/*
|
|
4703
|
+
/* 39 */
|
|
4358
4704
|
/***/ ((module) => {
|
|
4359
4705
|
|
|
4360
4706
|
module.exports = require("os");
|
|
4361
4707
|
|
|
4362
4708
|
/***/ }),
|
|
4363
|
-
/*
|
|
4709
|
+
/* 40 */
|
|
4364
4710
|
/***/ ((module) => {
|
|
4365
4711
|
|
|
4366
4712
|
module.exports = require("path");
|
|
@@ -4403,10 +4749,10 @@ const tslib_1 = __webpack_require__(1);
|
|
|
4403
4749
|
const anchor = tslib_1.__importStar(__webpack_require__(2));
|
|
4404
4750
|
const glam_sdk_1 = __webpack_require__(3);
|
|
4405
4751
|
const web3_js_1 = __webpack_require__(5);
|
|
4406
|
-
const commander_1 = __webpack_require__(
|
|
4407
|
-
const fs_1 = tslib_1.__importDefault(__webpack_require__(
|
|
4408
|
-
const inquirer_1 = tslib_1.__importDefault(__webpack_require__(
|
|
4409
|
-
const utils_1 = __webpack_require__(
|
|
4752
|
+
const commander_1 = __webpack_require__(35);
|
|
4753
|
+
const fs_1 = tslib_1.__importDefault(__webpack_require__(36));
|
|
4754
|
+
const inquirer_1 = tslib_1.__importDefault(__webpack_require__(37));
|
|
4755
|
+
const utils_1 = __webpack_require__(38);
|
|
4410
4756
|
const cliConfig = (0, utils_1.loadingConfig)();
|
|
4411
4757
|
const txOptions = {
|
|
4412
4758
|
getPriorityFeeMicroLamports: async (tx) => {
|
|
@@ -4454,27 +4800,21 @@ program
|
|
|
4454
4800
|
.description("List glam products the wallet has access to (either as owner or delegate)")
|
|
4455
4801
|
.option("-o, --owner-only", "Only list products the wallet owns")
|
|
4456
4802
|
.option("-a, --all", "All GLAM products")
|
|
4803
|
+
.option("-t, --type <type>", "Filter by account type: vault, mint, or fund")
|
|
4457
4804
|
.action(async (options) => {
|
|
4458
|
-
const { ownerOnly, all } = options;
|
|
4805
|
+
const { ownerOnly, all, type } = options;
|
|
4459
4806
|
if (ownerOnly && all) {
|
|
4460
4807
|
console.error("Options '--owner-only' and '--all' cannot be used together.");
|
|
4461
4808
|
process.exit(1);
|
|
4462
4809
|
}
|
|
4463
|
-
const states = await glamClient.fetchAllGlamStates();
|
|
4464
4810
|
const signer = glamClient.getSigner();
|
|
4465
|
-
const
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
|
|
4469
|
-
|
|
4470
|
-
|
|
4471
|
-
|
|
4472
|
-
else {
|
|
4473
|
-
return (state.owner.pubkey.equals(signer) ||
|
|
4474
|
-
state.delegateAcls.some((acl) => acl.pubkey.equals(signer)));
|
|
4475
|
-
}
|
|
4476
|
-
});
|
|
4477
|
-
filteredStates
|
|
4811
|
+
const filterOptions = all
|
|
4812
|
+
? { type }
|
|
4813
|
+
: ownerOnly
|
|
4814
|
+
? { owner: signer, type }
|
|
4815
|
+
: { owner: signer, delegate: signer, type };
|
|
4816
|
+
const states = await glamClient.fetchGlamStates(filterOptions);
|
|
4817
|
+
states
|
|
4478
4818
|
.sort((a, b) => a.rawOpenfunds.fundLaunchDate > b.rawOpenfunds.fundLaunchDate ? -1 : 1)
|
|
4479
4819
|
.forEach((state) => {
|
|
4480
4820
|
console.log(state.productType, "\t", state.idStr, "\t", state.launchDate, "\t", state.name);
|
|
@@ -4623,7 +4963,7 @@ program
|
|
|
4623
4963
|
const builder = await glamClient.program.methods
|
|
4624
4964
|
.closeState()
|
|
4625
4965
|
.accounts({
|
|
4626
|
-
|
|
4966
|
+
glamState: statePda,
|
|
4627
4967
|
})
|
|
4628
4968
|
.preInstructions(preInstructions);
|
|
4629
4969
|
const txSig = await builder.rpc();
|
|
@@ -4809,7 +5149,7 @@ integration
|
|
|
4809
5149
|
try {
|
|
4810
5150
|
const txSig = await glamClient.program.methods
|
|
4811
5151
|
.updateState(updated)
|
|
4812
|
-
.accounts({
|
|
5152
|
+
.accounts({ glamState: statePda })
|
|
4813
5153
|
.rpc();
|
|
4814
5154
|
console.log("txSig:", txSig);
|
|
4815
5155
|
console.log(`${integration} enabled on ${stateModel} (${statePda.toBase58()})`);
|
|
@@ -4838,7 +5178,7 @@ integration
|
|
|
4838
5178
|
try {
|
|
4839
5179
|
const txSig = await glamClient.program.methods
|
|
4840
5180
|
.updateState(updated)
|
|
4841
|
-
.accounts({
|
|
5181
|
+
.accounts({ glamState: statePda })
|
|
4842
5182
|
.rpc();
|
|
4843
5183
|
console.log("txSig:", txSig);
|
|
4844
5184
|
console.log(`${integration} disabled on ${stateModel.name} (${statePda.toBase58()})`);
|
|
@@ -5256,7 +5596,7 @@ lst
|
|
|
5256
5596
|
process.exit(1);
|
|
5257
5597
|
}
|
|
5258
5598
|
try {
|
|
5259
|
-
const txSig = await glamClient.marinade.
|
|
5599
|
+
const txSig = await glamClient.marinade.claim(statePda, tickets.map((addr) => new web3_js_1.PublicKey(addr)));
|
|
5260
5600
|
console.log(`Claimed ${tickets}:`, txSig);
|
|
5261
5601
|
}
|
|
5262
5602
|
catch (e) {
|
|
@@ -5264,6 +5604,92 @@ lst
|
|
|
5264
5604
|
process.exit(1);
|
|
5265
5605
|
}
|
|
5266
5606
|
});
|
|
5607
|
+
const meteora = program.command("meteora").description("Meteora DLMM");
|
|
5608
|
+
meteora
|
|
5609
|
+
.command("init <pool>")
|
|
5610
|
+
.description("Initialize Meteora DLMM position")
|
|
5611
|
+
.action(async (pool) => {
|
|
5612
|
+
if (!cliConfig.glam_state) {
|
|
5613
|
+
console.error("GLAM state not found in config file");
|
|
5614
|
+
process.exit(1);
|
|
5615
|
+
}
|
|
5616
|
+
try {
|
|
5617
|
+
const txSig = await glamClient.meteoraDlmm.initializePosition(cliConfig.glam_state, pool);
|
|
5618
|
+
console.log(`Initialized Meteora DLMM position: ${txSig}`);
|
|
5619
|
+
}
|
|
5620
|
+
catch (e) {
|
|
5621
|
+
console.error((0, utils_1.parseTxError)(e));
|
|
5622
|
+
process.exit(1);
|
|
5623
|
+
}
|
|
5624
|
+
});
|
|
5625
|
+
meteora
|
|
5626
|
+
.command("add <position> <amount> <strategy>")
|
|
5627
|
+
.description("Add liquidity to position")
|
|
5628
|
+
.action(async (position, amount, strategy) => {
|
|
5629
|
+
if (!cliConfig.glam_state) {
|
|
5630
|
+
console.error("GLAM state not found in config file");
|
|
5631
|
+
process.exit(1);
|
|
5632
|
+
}
|
|
5633
|
+
try {
|
|
5634
|
+
const txSig = await glamClient.meteoraDlmm.addLiquidity(cliConfig.glam_state, position, new anchor.BN(amount), strategy.toString());
|
|
5635
|
+
console.log(`Added liquidity to ${position}:`, txSig);
|
|
5636
|
+
}
|
|
5637
|
+
catch (e) {
|
|
5638
|
+
console.error((0, utils_1.parseTxError)(e));
|
|
5639
|
+
process.exit(1);
|
|
5640
|
+
}
|
|
5641
|
+
});
|
|
5642
|
+
meteora
|
|
5643
|
+
.command("remove <position> <bps>")
|
|
5644
|
+
.description("Remove liquidity from position")
|
|
5645
|
+
.action(async (position, bps) => {
|
|
5646
|
+
if (!cliConfig.glam_state) {
|
|
5647
|
+
console.error("GLAM state not found in config file");
|
|
5648
|
+
process.exit(1);
|
|
5649
|
+
}
|
|
5650
|
+
try {
|
|
5651
|
+
const txSig = await glamClient.meteoraDlmm.removeLiquidity(cliConfig.glam_state, position, bps);
|
|
5652
|
+
console.log(`Removed liquidity from ${position}:`, txSig);
|
|
5653
|
+
}
|
|
5654
|
+
catch (e) {
|
|
5655
|
+
console.error((0, utils_1.parseTxError)(e));
|
|
5656
|
+
process.exit(1);
|
|
5657
|
+
}
|
|
5658
|
+
});
|
|
5659
|
+
meteora
|
|
5660
|
+
.command("claim <position>")
|
|
5661
|
+
.description("Claim fee")
|
|
5662
|
+
.action(async (position) => {
|
|
5663
|
+
if (!cliConfig.glam_state) {
|
|
5664
|
+
console.error("GLAM state not found in config file");
|
|
5665
|
+
process.exit(1);
|
|
5666
|
+
}
|
|
5667
|
+
try {
|
|
5668
|
+
const txSig = await glamClient.meteoraDlmm.claimFee(cliConfig.glam_state, position);
|
|
5669
|
+
console.log(`Claimed fee from ${position}:`, txSig);
|
|
5670
|
+
}
|
|
5671
|
+
catch (e) {
|
|
5672
|
+
console.error((0, utils_1.parseTxError)(e));
|
|
5673
|
+
process.exit(1);
|
|
5674
|
+
}
|
|
5675
|
+
});
|
|
5676
|
+
meteora
|
|
5677
|
+
.command("close <position>")
|
|
5678
|
+
.description("Close a Meteora DLMM position")
|
|
5679
|
+
.action(async (position) => {
|
|
5680
|
+
if (!cliConfig.glam_state) {
|
|
5681
|
+
console.error("GLAM state not found in config file");
|
|
5682
|
+
process.exit(1);
|
|
5683
|
+
}
|
|
5684
|
+
try {
|
|
5685
|
+
const txSig = await glamClient.meteoraDlmm.closePosition(cliConfig.glam_state, position);
|
|
5686
|
+
console.log(`Closed Meteora DLMM position: ${txSig}`);
|
|
5687
|
+
}
|
|
5688
|
+
catch (e) {
|
|
5689
|
+
console.error((0, utils_1.parseTxError)(e));
|
|
5690
|
+
process.exit(1);
|
|
5691
|
+
}
|
|
5692
|
+
});
|
|
5267
5693
|
//
|
|
5268
5694
|
// Run the CLI in development mode as follows:
|
|
5269
5695
|
// npx nx run cli:dev -- --args="view <pubkey>"
|