@glamsystems/glam-cli 1.0.12-alpha.0 → 1.0.12-alpha.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 +452 -180
- package/package.json +2 -2
package/main.js
CHANGED
|
@@ -11,18 +11,18 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
11
11
|
const tslib_1 = __webpack_require__(2);
|
|
12
12
|
tslib_1.__exportStar(__webpack_require__(3), exports);
|
|
13
13
|
tslib_1.__exportStar(__webpack_require__(24), exports);
|
|
14
|
-
tslib_1.__exportStar(__webpack_require__(58), exports);
|
|
15
14
|
tslib_1.__exportStar(__webpack_require__(59), exports);
|
|
15
|
+
tslib_1.__exportStar(__webpack_require__(60), exports);
|
|
16
16
|
tslib_1.__exportStar(__webpack_require__(67), exports);
|
|
17
17
|
tslib_1.__exportStar(__webpack_require__(62), exports);
|
|
18
18
|
tslib_1.__exportStar(__webpack_require__(86), exports);
|
|
19
19
|
tslib_1.__exportStar(__webpack_require__(90), exports);
|
|
20
20
|
tslib_1.__exportStar(__webpack_require__(81), exports);
|
|
21
21
|
tslib_1.__exportStar(__webpack_require__(29), exports);
|
|
22
|
-
tslib_1.__exportStar(__webpack_require__(
|
|
22
|
+
tslib_1.__exportStar(__webpack_require__(61), exports);
|
|
23
23
|
tslib_1.__exportStar(__webpack_require__(68), exports);
|
|
24
24
|
tslib_1.__exportStar(__webpack_require__(34), exports);
|
|
25
|
-
tslib_1.__exportStar(__webpack_require__(
|
|
25
|
+
tslib_1.__exportStar(__webpack_require__(48), exports);
|
|
26
26
|
tslib_1.__exportStar(__webpack_require__(32), exports);
|
|
27
27
|
|
|
28
28
|
|
|
@@ -304,7 +304,7 @@ module.exports = /*#__PURE__*/JSON.parse('{"address":"gstgdpMFXKobURsFtStdaMLRSu
|
|
|
304
304
|
/***/ ((module) => {
|
|
305
305
|
|
|
306
306
|
"use strict";
|
|
307
|
-
module.exports = /*#__PURE__*/JSON.parse('{"address":"gstgKa2Gq9wf5hM3DFWx1TvUrGYzDYszyFGq3XBY9Uq","metadata":{"name":"ext_kamino","version":"1.0.0","spec":"0.1.0","description":"Kamino integration for GLAM Protocol"},"instructions":[{"name":"farms_harvest_reward","discriminator":[244,248,124,210,194,52,75,152],"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"}],"program":{"kind":"account","path":"glam_protocol_program"}}},{"name":"glam_signer","writable":true,"signer":true},{"name":"integration_authority","pda":{"seeds":[{"kind":"const","value":[105,110,116,101,103,114,97,116,105,111,110,45,97,117,116,104,111,114,105,116,121]}]}},{"name":"cpi_program","address":"FarmsPZpWu9i7Kky8tPN37rs2TpmMrAZrC7S7vJa91Hr"},{"name":"glam_protocol_program","address":"gstgptmbgJVi5f8ZmSRVZjZkDQwqKa3xWuUtD5WmJHz"},{"name":"system_program","address":"11111111111111111111111111111111"},{"name":"user_state","writable":true},{"name":"farm_state","writable":true},{"name":"global_config"},{"name":"reward_mint"},{"name":"user_reward_ata","writable":true},{"name":"rewards_vault","writable":true},{"name":"rewards_treasury_vault","writable":true},{"name":"farm_vaults_authority"},{"name":"scope_prices","optional":true},{"name":"token_program"}],"args":[{"name":"reward_index","type":"u64"}]},{"name":"farms_initialize_user","discriminator":[188,148,82,37,44,46,162,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"}],"program":{"kind":"account","path":"glam_protocol_program"}}},{"name":"glam_signer","writable":true,"signer":true},{"name":"integration_authority","pda":{"seeds":[{"kind":"const","value":[105,110,116,101,103,114,97,116,105,111,110,45,97,117,116,104,111,114,105,116,121]}]}},{"name":"cpi_program","address":"FarmsPZpWu9i7Kky8tPN37rs2TpmMrAZrC7S7vJa91Hr"},{"name":"glam_protocol_program","address":"gstgptmbgJVi5f8ZmSRVZjZkDQwqKa3xWuUtD5WmJHz"},{"name":"system_program","address":"11111111111111111111111111111111"},{"name":"user_state","writable":true},{"name":"farm_state","writable":true},{"name":"rent","address":"SysvarRent111111111111111111111111111111111"}],"args":[]},{"name":"farms_stake","discriminator":[224,105,208,179,98,200,213,238],"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"}],"program":{"kind":"account","path":"glam_protocol_program"}}},{"name":"glam_signer","writable":true,"signer":true},{"name":"integration_authority","pda":{"seeds":[{"kind":"const","value":[105,110,116,101,103,114,97,116,105,111,110,45,97,117,116,104,111,114,105,116,121]}]}},{"name":"cpi_program","address":"FarmsPZpWu9i7Kky8tPN37rs2TpmMrAZrC7S7vJa91Hr"},{"name":"glam_protocol_program","address":"gstgptmbgJVi5f8ZmSRVZjZkDQwqKa3xWuUtD5WmJHz"},{"name":"system_program","address":"11111111111111111111111111111111"},{"name":"user_state","writable":true},{"name":"farm_state","writable":true},{"name":"farm_vault","writable":true},{"name":"user_ata","writable":true},{"name":"token_mint"},{"name":"scope_prices","optional":true},{"name":"token_program"}],"args":[{"name":"amount","type":"u64"}]},{"name":"farms_unstake","discriminator":[180,131,50,144,26,242,175,242],"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"}],"program":{"kind":"account","path":"glam_protocol_program"}}},{"name":"glam_signer","writable":true,"signer":true},{"name":"integration_authority","pda":{"seeds":[{"kind":"const","value":[105,110,116,101,103,114,97,116,105,111,110,45,97,117,116,104,111,114,105,116,121]}]}},{"name":"cpi_program","address":"FarmsPZpWu9i7Kky8tPN37rs2TpmMrAZrC7S7vJa91Hr"},{"name":"glam_protocol_program","address":"gstgptmbgJVi5f8ZmSRVZjZkDQwqKa3xWuUtD5WmJHz"},{"name":"system_program","address":"11111111111111111111111111111111"},{"name":"user_state","writable":true},{"name":"farm_state","writable":true},{"name":"scope_prices","optional":true}],"args":[{"name":"amount","type":"u128"}]},{"name":"farms_withdraw_unstaked_deposits","discriminator":[107,97,50,15,211,245,52,96],"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"}],"program":{"kind":"account","path":"glam_protocol_program"}}},{"name":"glam_signer","writable":true,"signer":true},{"name":"integration_authority","pda":{"seeds":[{"kind":"const","value":[105,110,116,101,103,114,97,116,105,111,110,45,97,117,116,104,111,114,105,116,121]}]}},{"name":"cpi_program","address":"FarmsPZpWu9i7Kky8tPN37rs2TpmMrAZrC7S7vJa91Hr"},{"name":"glam_protocol_program","address":"gstgptmbgJVi5f8ZmSRVZjZkDQwqKa3xWuUtD5WmJHz"},{"name":"system_program","address":"11111111111111111111111111111111"},{"name":"user_state","writable":true},{"name":"farm_state","writable":true},{"name":"user_ata","writable":true},{"name":"farm_vault","writable":true},{"name":"farm_vaults_authority"},{"name":"token_program"}],"args":[]},{"name":"lending_borrow_obligation_liquidity_v2","discriminator":[149,226,84,157,124,178,35,122],"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"}],"program":{"kind":"account","path":"glam_protocol_program"}}},{"name":"glam_signer","writable":true,"signer":true},{"name":"integration_authority","pda":{"seeds":[{"kind":"const","value":[105,110,116,101,103,114,97,116,105,111,110,45,97,117,116,104,111,114,105,116,121]}]}},{"name":"cpi_program","address":"KLend2g3cP87fffoy8q1mQqGKjrxjC8boSyAYavgmjD"},{"name":"glam_protocol_program","address":"gstgptmbgJVi5f8ZmSRVZjZkDQwqKa3xWuUtD5WmJHz"},{"name":"system_program","address":"11111111111111111111111111111111"},{"name":"obligation","writable":true},{"name":"lending_market"},{"name":"lending_market_authority"},{"name":"borrow_reserve","writable":true},{"name":"borrow_reserve_liquidity_mint"},{"name":"reserve_source_liquidity","writable":true},{"name":"borrow_reserve_liquidity_fee_receiver","writable":true},{"name":"user_destination_liquidity","writable":true},{"name":"referrer_token_state","writable":true,"optional":true},{"name":"token_program"},{"name":"instruction_sysvar_account"},{"name":"obligation_farm_user_state","writable":true,"optional":true},{"name":"reserve_farm_state","writable":true,"optional":true},{"name":"farms_program"}],"args":[{"name":"liquidity_amount","type":"u64"}]},{"name":"lending_deposit_reserve_liquidity_and_obligation_collateral_v2","discriminator":[33,146,50,121,127,94,92,192],"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"}],"program":{"kind":"account","path":"glam_protocol_program"}}},{"name":"glam_signer","writable":true,"signer":true},{"name":"integration_authority","pda":{"seeds":[{"kind":"const","value":[105,110,116,101,103,114,97,116,105,111,110,45,97,117,116,104,111,114,105,116,121]}]}},{"name":"cpi_program","address":"KLend2g3cP87fffoy8q1mQqGKjrxjC8boSyAYavgmjD"},{"name":"glam_protocol_program","address":"gstgptmbgJVi5f8ZmSRVZjZkDQwqKa3xWuUtD5WmJHz"},{"name":"system_program","address":"11111111111111111111111111111111"},{"name":"obligation","writable":true},{"name":"lending_market"},{"name":"lending_market_authority"},{"name":"reserve","writable":true},{"name":"reserve_liquidity_mint"},{"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","optional":true},{"name":"collateral_token_program"},{"name":"liquidity_token_program"},{"name":"instruction_sysvar_account"},{"name":"obligation_farm_user_state","writable":true,"optional":true},{"name":"reserve_farm_state","writable":true,"optional":true},{"name":"farms_program"}],"args":[{"name":"liquidity_amount","type":"u64"}]},{"name":"lending_init_obligation","discriminator":[188,161,62,142,106,232,77,135],"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"}],"program":{"kind":"account","path":"glam_protocol_program"}}},{"name":"glam_signer","writable":true,"signer":true},{"name":"integration_authority","pda":{"seeds":[{"kind":"const","value":[105,110,116,101,103,114,97,116,105,111,110,45,97,117,116,104,111,114,105,116,121]}]}},{"name":"cpi_program","address":"KLend2g3cP87fffoy8q1mQqGKjrxjC8boSyAYavgmjD"},{"name":"glam_protocol_program","address":"gstgptmbgJVi5f8ZmSRVZjZkDQwqKa3xWuUtD5WmJHz"},{"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":"lending_init_obligation_farms_for_reserve","discriminator":[3,234,110,39,12,147,175,185],"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"}],"program":{"kind":"account","path":"glam_protocol_program"}}},{"name":"glam_signer","writable":true,"signer":true},{"name":"integration_authority","pda":{"seeds":[{"kind":"const","value":[105,110,116,101,103,114,97,116,105,111,110,45,97,117,116,104,111,114,105,116,121]}]}},{"name":"cpi_program","address":"KLend2g3cP87fffoy8q1mQqGKjrxjC8boSyAYavgmjD"},{"name":"glam_protocol_program","address":"gstgptmbgJVi5f8ZmSRVZjZkDQwqKa3xWuUtD5WmJHz"},{"name":"payer","writable":true,"signer":true},{"name":"obligation","writable":true},{"name":"lending_market_authority"},{"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":"lending_init_user_metadata","discriminator":[68,236,138,146,124,228,247,241],"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"}],"program":{"kind":"account","path":"glam_protocol_program"}}},{"name":"glam_signer","writable":true,"signer":true},{"name":"integration_authority","pda":{"seeds":[{"kind":"const","value":[105,110,116,101,103,114,97,116,105,111,110,45,97,117,116,104,111,114,105,116,121]}]}},{"name":"cpi_program","address":"KLend2g3cP87fffoy8q1mQqGKjrxjC8boSyAYavgmjD"},{"name":"glam_protocol_program","address":"gstgptmbgJVi5f8ZmSRVZjZkDQwqKa3xWuUtD5WmJHz"},{"name":"fee_payer","writable":true,"signer":true},{"name":"user_metadata","writable":true},{"name":"referrer_user_metadata","optional":true},{"name":"rent","address":"SysvarRent111111111111111111111111111111111"},{"name":"system_program","address":"11111111111111111111111111111111"}],"args":[{"name":"user_lookup_table","type":"pubkey"}]},{"name":"lending_repay_obligation_liquidity_v2","discriminator":[79,34,126,170,174,156,174,29],"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"}],"program":{"kind":"account","path":"glam_protocol_program"}}},{"name":"glam_signer","writable":true,"signer":true},{"name":"integration_authority","pda":{"seeds":[{"kind":"const","value":[105,110,116,101,103,114,97,116,105,111,110,45,97,117,116,104,111,114,105,116,121]}]}},{"name":"cpi_program","address":"KLend2g3cP87fffoy8q1mQqGKjrxjC8boSyAYavgmjD"},{"name":"glam_protocol_program","address":"gstgptmbgJVi5f8ZmSRVZjZkDQwqKa3xWuUtD5WmJHz"},{"name":"system_program","address":"11111111111111111111111111111111"},{"name":"obligation","writable":true},{"name":"lending_market"},{"name":"repay_reserve","writable":true},{"name":"reserve_liquidity_mint"},{"name":"reserve_destination_liquidity","writable":true},{"name":"user_source_liquidity","writable":true},{"name":"token_program"},{"name":"instruction_sysvar_account"},{"name":"obligation_farm_user_state","writable":true,"optional":true},{"name":"reserve_farm_state","writable":true,"optional":true},{"name":"lending_market_authority"},{"name":"farms_program"}],"args":[{"name":"liquidity_amount","type":"u64"}]},{"name":"lending_withdraw_obligation_collateral_and_redeem_reserve_collateral_v2","discriminator":[217,223,173,35,64,225,161,222],"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"}],"program":{"kind":"account","path":"glam_protocol_program"}}},{"name":"glam_signer","writable":true,"signer":true},{"name":"integration_authority","pda":{"seeds":[{"kind":"const","value":[105,110,116,101,103,114,97,116,105,111,110,45,97,117,116,104,111,114,105,116,121]}]}},{"name":"cpi_program","address":"KLend2g3cP87fffoy8q1mQqGKjrxjC8boSyAYavgmjD"},{"name":"glam_protocol_program","address":"gstgptmbgJVi5f8ZmSRVZjZkDQwqKa3xWuUtD5WmJHz"},{"name":"system_program","address":"11111111111111111111111111111111"},{"name":"obligation","writable":true},{"name":"lending_market"},{"name":"lending_market_authority"},{"name":"withdraw_reserve","writable":true},{"name":"reserve_liquidity_mint"},{"name":"reserve_source_collateral","writable":true},{"name":"reserve_collateral_mint","writable":true},{"name":"reserve_liquidity_supply","writable":true},{"name":"user_destination_liquidity","writable":true},{"name":"placeholder_user_destination_collateral","optional":true},{"name":"collateral_token_program"},{"name":"liquidity_token_program"},{"name":"instruction_sysvar_account"},{"name":"obligation_farm_user_state","writable":true,"optional":true},{"name":"reserve_farm_state","writable":true,"optional":true},{"name":"farms_program"}],"args":[{"name":"collateral_amount","type":"u64"}]},{"name":"set_lending_policy","discriminator":[226,185,23,3,113,88,118,176],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_signer","writable":true,"signer":true},{"name":"glam_protocol_program","address":"gstgptmbgJVi5f8ZmSRVZjZkDQwqKa3xWuUtD5WmJHz"}],"args":[{"name":"policy","type":{"defined":{"name":"LendingPolicy"}}}]},{"name":"set_vaults_policy","discriminator":[211,177,22,152,235,59,192,62],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_signer","writable":true,"signer":true},{"name":"glam_protocol_program","address":"gstgptmbgJVi5f8ZmSRVZjZkDQwqKa3xWuUtD5WmJHz"}],"args":[{"name":"policy","type":{"defined":{"name":"VaultsPolicy"}}}]},{"name":"vaults_deposit","discriminator":[124,173,191,223,48,26,84,84],"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"}],"program":{"kind":"account","path":"glam_protocol_program"}}},{"name":"glam_signer","writable":true,"signer":true},{"name":"integration_authority","pda":{"seeds":[{"kind":"const","value":[105,110,116,101,103,114,97,116,105,111,110,45,97,117,116,104,111,114,105,116,121]}]}},{"name":"cpi_program","address":"KvauGMspG5k6rtzrqqn7WNn3oZdyKqLKwK2XWQ8FLjd"},{"name":"glam_protocol_program","address":"gstgptmbgJVi5f8ZmSRVZjZkDQwqKa3xWuUtD5WmJHz"},{"name":"system_program","address":"11111111111111111111111111111111"},{"name":"vault_state","writable":true},{"name":"token_vault","writable":true},{"name":"token_mint"},{"name":"base_vault_authority"},{"name":"shares_mint","writable":true},{"name":"user_token_ata","writable":true},{"name":"user_shares_ata","writable":true},{"name":"klend_program"},{"name":"token_program"},{"name":"shares_token_program"},{"name":"event_authority"},{"name":"program"}],"args":[{"name":"max_amount","type":"u64"}]},{"name":"vaults_withdraw","discriminator":[12,8,236,92,134,144,196,87],"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"}],"program":{"kind":"account","path":"glam_protocol_program"}}},{"name":"glam_signer","writable":true,"signer":true},{"name":"integration_authority","pda":{"seeds":[{"kind":"const","value":[105,110,116,101,103,114,97,116,105,111,110,45,97,117,116,104,111,114,105,116,121]}]}},{"name":"cpi_program","address":"KvauGMspG5k6rtzrqqn7WNn3oZdyKqLKwK2XWQ8FLjd"},{"name":"glam_protocol_program","address":"gstgptmbgJVi5f8ZmSRVZjZkDQwqKa3xWuUtD5WmJHz"},{"name":"system_program","address":"11111111111111111111111111111111"},{"name":"withdraw_from_available_vault_state","writable":true},{"name":"withdraw_from_available_global_config"},{"name":"withdraw_from_available_token_vault","writable":true},{"name":"withdraw_from_available_base_vault_authority"},{"name":"withdraw_from_available_user_token_ata","writable":true},{"name":"withdraw_from_available_token_mint","writable":true},{"name":"withdraw_from_available_user_shares_ata","writable":true},{"name":"withdraw_from_available_shares_mint","writable":true},{"name":"withdraw_from_available_token_program"},{"name":"withdraw_from_available_shares_token_program"},{"name":"withdraw_from_available_klend_program"},{"name":"withdraw_from_available_event_authority"},{"name":"withdraw_from_available_program"},{"name":"withdraw_from_reserve_vault_state","writable":true},{"name":"withdraw_from_reserve_reserve","writable":true},{"name":"withdraw_from_reserve_ctoken_vault","writable":true},{"name":"withdraw_from_reserve_lending_market"},{"name":"withdraw_from_reserve_lending_market_authority"},{"name":"withdraw_from_reserve_reserve_liquidity_supply","writable":true},{"name":"withdraw_from_reserve_reserve_collateral_mint","writable":true},{"name":"withdraw_from_reserve_reserve_collateral_token_program"},{"name":"withdraw_from_reserve_instruction_sysvar_account"},{"name":"event_authority"},{"name":"program"}],"args":[{"name":"shares_amount","type":"u64"}]}],"accounts":[{"name":"StateAccount","discriminator":[142,247,54,95,85,133,249,103]}],"types":[{"name":"AccountType","type":{"kind":"enum","variants":[{"name":"Vault"},{"name":"TokenizedVault"},{"name":"Mint"},{"name":"SingleAssetVault"}]}},{"name":"AccruedFees","type":{"kind":"struct","fields":[{"name":"vault_subscription_fee","type":"u128"},{"name":"vault_redemption_fee","type":"u128"},{"name":"manager_subscription_fee","type":"u128"},{"name":"manager_redemption_fee","type":"u128"},{"name":"management_fee","type":"u128"},{"name":"performance_fee","type":"u128"},{"name":"protocol_base_fee","type":"u128"},{"name":"protocol_flow_fee","type":"u128"}]}},{"name":"CreatedModel","type":{"kind":"struct","fields":[{"name":"key","type":{"array":["u8",8]}},{"name":"created_by","type":"pubkey"},{"name":"created_at","type":"i64"}]}},{"name":"DelegateAcl","type":{"kind":"struct","fields":[{"name":"pubkey","type":"pubkey"},{"name":"integration_permissions","type":{"vec":{"defined":{"name":"IntegrationPermissions"}}}},{"name":"expires_at","type":"i64"}]}},{"name":"EngineField","type":{"kind":"struct","fields":[{"name":"name","type":{"defined":{"name":"EngineFieldName"}}},{"name":"value","type":{"defined":{"name":"EngineFieldValue"}}}]}},{"name":"EngineFieldName","type":{"kind":"enum","variants":[{"name":"Owner"},{"name":"PortfolioManagerName"},{"name":"Name"},{"name":"Uri"},{"name":"Assets"},{"name":"DelegateAcls"},{"name":"IntegrationAcls"},{"name":"TimelockDuration"},{"name":"Borrowable"},{"name":"DefaultAccountStateFrozen"},{"name":"PermanentDelegate"},{"name":"NotifyAndSettle"},{"name":"FeeStructure"},{"name":"FeeParams"},{"name":"ClaimableFees"},{"name":"ClaimedFees"},{"name":"OracleConfigs"},{"name":"ReduceOnly"},{"name":"AnyLst"}]}},{"name":"EngineFieldValue","type":{"kind":"enum","variants":[{"name":"Boolean","fields":[{"name":"val","type":"bool"}]},{"name":"U8","fields":[{"name":"val","type":"u8"}]},{"name":"U32","fields":[{"name":"val","type":"u32"}]},{"name":"U64","fields":[{"name":"val","type":"u64"}]},{"name":"String","fields":[{"name":"val","type":"string"}]},{"name":"Pubkey","fields":[{"name":"val","type":"pubkey"}]},{"name":"VecPubkey","fields":[{"name":"val","type":{"vec":"pubkey"}}]},{"name":"VecU8","fields":[{"name":"val","type":"bytes"}]},{"name":"VecU32","fields":[{"name":"val","type":{"vec":"u32"}}]},{"name":"VecDelegateAcl","fields":[{"name":"val","type":{"vec":{"defined":{"name":"DelegateAcl"}}}}]},{"name":"VecIntegrationAcl","fields":[{"name":"val","type":{"vec":{"defined":{"name":"IntegrationAcl"}}}}]},{"name":"FeeStructure","fields":[{"name":"val","type":{"defined":{"name":"FeeStructure"}}}]},{"name":"FeeParams","fields":[{"name":"val","type":{"defined":{"name":"FeeParams"}}}]},{"name":"AccruedFees","fields":[{"name":"val","type":{"defined":{"name":"AccruedFees"}}}]},{"name":"NotifyAndSettle","fields":[{"name":"val","type":{"defined":{"name":"NotifyAndSettle"}}}]},{"name":"OracleConfigs","fields":[{"name":"val","type":{"defined":{"name":"OracleConfigs"}}}]}]}},{"name":"EntryExitFees","type":{"kind":"struct","fields":[{"name":"subscription_fee_bps","type":"u16"},{"name":"redemption_fee_bps","type":"u16"}]}},{"name":"FeeParams","type":{"kind":"struct","fields":[{"name":"year_in_seconds","type":"u32"},{"name":"pa_high_water_mark","type":"i128"},{"name":"pa_last_nav","type":"i128"},{"name":"last_aum","type":"i128"},{"name":"last_performance_fee_crystallized","type":"i64"},{"name":"last_management_fee_crystallized","type":"i64"},{"name":"last_protocol_fee_crystallized","type":"i64"}]}},{"name":"FeeStructure","type":{"kind":"struct","fields":[{"name":"vault","type":{"defined":{"name":"EntryExitFees"}}},{"name":"manager","type":{"defined":{"name":"EntryExitFees"}}},{"name":"management","type":{"defined":{"name":"ManagementFee"}}},{"name":"performance","type":{"defined":{"name":"PerformanceFee"}}},{"name":"protocol","type":{"defined":{"name":"ProtocolFees"}}}]}},{"name":"HurdleType","type":{"kind":"enum","variants":[{"name":"Hard"},{"name":"Soft"}]}},{"name":"InitObligationArgs","type":{"kind":"struct","fields":[{"name":"tag","type":"u8"},{"name":"id","type":"u8"}]}},{"name":"IntegrationAcl","docs":["An integration program can have multiple protocols supported.","Enabled protocols are stored in a bitmask, and each protocol can have its own policy."],"type":{"kind":"struct","fields":[{"name":"integration_program","type":"pubkey"},{"name":"protocols_bitmask","type":"u16"},{"name":"protocol_policies","type":{"vec":{"defined":{"name":"ProtocolPolicy"}}}}]}},{"name":"IntegrationPermissions","docs":["Stores delegate permissions for an integration program."],"type":{"kind":"struct","fields":[{"name":"integration_program","type":"pubkey"},{"name":"protocol_permissions","type":{"vec":{"defined":{"name":"ProtocolPermissions"}}}}]}},{"name":"LendingPolicy","type":{"kind":"struct","fields":[{"name":"markets_allowlist","type":{"vec":"pubkey"}},{"name":"borrow_allowlist","type":{"vec":"pubkey"}}]}},{"name":"ManagementFee","type":{"kind":"struct","fields":[{"name":"fee_bps","type":"u16"}]}},{"name":"NoticePeriodType","type":{"kind":"enum","variants":[{"name":"Hard"},{"name":"Soft"}]}},{"name":"NotifyAndSettle","type":{"kind":"struct","fields":[{"name":"model","type":{"defined":{"name":"ValuationModel"}}},{"name":"permissionless_fulfillment","type":"bool"},{"name":"subscribe_notice_period_type","type":{"defined":{"name":"NoticePeriodType"}}},{"name":"subscribe_notice_period","type":"u64"},{"name":"subscribe_settlement_period","type":"u64"},{"name":"subscribe_cancellation_window","type":"u64"},{"name":"redeem_notice_period_type","type":{"defined":{"name":"NoticePeriodType"}}},{"name":"redeem_notice_period","type":"u64"},{"name":"redeem_settlement_period","type":"u64"},{"name":"redeem_cancellation_window","type":"u64"},{"name":"time_unit","type":{"defined":{"name":"TimeUnit"}}},{"name":"_padding","type":{"array":["u8",3]}}]}},{"name":"OracleConfigs","docs":["Vault-specific oracle configs. If available, these configs are preferred over the global config."],"type":{"kind":"struct","fields":[{"name":"max_ages_seconds","type":{"vec":{"array":["u16",2]}}},{"name":"padding","type":{"array":["u8",12]}}]}},{"name":"PerformanceFee","type":{"kind":"struct","fields":[{"name":"fee_bps","type":"u16"},{"name":"hurdle_rate_bps","type":"u16"},{"name":"hurdle_type","type":{"defined":{"name":"HurdleType"}}}]}},{"name":"PricedProtocol","type":{"kind":"struct","fields":[{"name":"rent","type":"u64"},{"name":"amount","type":"i128"},{"name":"decimals","type":"u8"},{"name":"last_updated_slot","type":"u64"},{"name":"integration_program","type":"pubkey"},{"name":"protocol_bitflag","type":"u16"},{"name":"positions","type":{"vec":"pubkey"}}]}},{"name":"ProtocolFees","type":{"kind":"struct","fields":[{"name":"base_fee_bps","type":"u16"},{"name":"flow_fee_bps","type":"u16"}]}},{"name":"ProtocolPermissions","docs":["Represents a delegate\'s permissions for a specific protocol"],"type":{"kind":"struct","fields":[{"name":"protocol_bitflag","type":"u16"},{"name":"permissions_bitmask","type":"u64"}]}},{"name":"ProtocolPolicy","docs":["Stores policy data for an integrated protocol.","Integration programs serialize/deserialize this data."],"type":{"kind":"struct","fields":[{"name":"protocol_bitflag","type":"u16"},{"name":"data","type":"bytes"}]}},{"name":"StateAccount","type":{"kind":"struct","fields":[{"name":"account_type","type":{"defined":{"name":"AccountType"}}},{"name":"enabled","type":"bool"},{"name":"vault","type":"pubkey"},{"name":"owner","type":"pubkey"},{"name":"portfolio_manager_name","type":{"array":["u8",32]}},{"name":"created","type":{"defined":{"name":"CreatedModel"}}},{"name":"base_asset_mint","type":"pubkey"},{"name":"base_asset_decimals","type":"u8"},{"name":"base_asset_token_program","type":"u8"},{"name":"name","type":{"array":["u8",32]}},{"name":"timelock_duration","type":"u32"},{"name":"timelock_expires_at","type":"u64"},{"name":"mint","type":"pubkey"},{"name":"assets","type":{"vec":"pubkey"}},{"name":"integration_acls","type":{"vec":{"defined":{"name":"IntegrationAcl"}}}},{"name":"delegate_acls","type":{"vec":{"defined":{"name":"DelegateAcl"}}}},{"name":"external_positions","type":{"vec":"pubkey"}},{"name":"priced_protocols","type":{"vec":{"defined":{"name":"PricedProtocol"}}}},{"name":"params","type":{"vec":{"vec":{"defined":{"name":"EngineField"}}}}}]}},{"name":"TimeUnit","type":{"kind":"enum","variants":[{"name":"Second"},{"name":"Slot"}]}},{"name":"ValuationModel","type":{"kind":"enum","variants":[{"name":"Continuous"},{"name":"Periodic"}]}},{"name":"VaultsPolicy","type":{"kind":"struct","fields":[{"name":"vaults_allowlist","type":{"vec":"pubkey"}}]}}],"constants":[{"name":"PROTO_KAMINO_FARMS","type":"u16","value":"4"},{"name":"PROTO_KAMINO_FARMS_PERM_HARVEST_REWARD","type":"u64","value":"4"},{"name":"PROTO_KAMINO_FARMS_PERM_STAKE","type":"u64","value":"1"},{"name":"PROTO_KAMINO_FARMS_PERM_UNSTAKE","type":"u64","value":"2"},{"name":"PROTO_KAMINO_LENDING","type":"u16","value":"1"},{"name":"PROTO_KAMINO_LENDING_PERM_BORROW","type":"u64","value":"8"},{"name":"PROTO_KAMINO_LENDING_PERM_DEPOSIT","type":"u64","value":"2"},{"name":"PROTO_KAMINO_LENDING_PERM_INIT","type":"u64","value":"1"},{"name":"PROTO_KAMINO_LENDING_PERM_REPAY","type":"u64","value":"16"},{"name":"PROTO_KAMINO_LENDING_PERM_WITHDRAW","type":"u64","value":"4"},{"name":"PROTO_KAMINO_VAULTS","type":"u16","value":"2"},{"name":"PROTO_KAMINO_VAULTS_PERM_DEPOSIT","type":"u64","value":"1"},{"name":"PROTO_KAMINO_VAULTS_PERM_WITHDRAW","type":"u64","value":"2"}]}');
|
|
307
|
+
module.exports = /*#__PURE__*/JSON.parse('{"address":"gstgKa2Gq9wf5hM3DFWx1TvUrGYzDYszyFGq3XBY9Uq","metadata":{"name":"ext_kamino","version":"1.0.0","spec":"0.1.0","description":"Kamino integration for GLAM Protocol"},"instructions":[{"name":"farms_harvest_reward","discriminator":[244,248,124,210,194,52,75,152],"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"}],"program":{"kind":"account","path":"glam_protocol_program"}}},{"name":"glam_signer","writable":true,"signer":true},{"name":"integration_authority","pda":{"seeds":[{"kind":"const","value":[105,110,116,101,103,114,97,116,105,111,110,45,97,117,116,104,111,114,105,116,121]}]}},{"name":"cpi_program","address":"FarmsPZpWu9i7Kky8tPN37rs2TpmMrAZrC7S7vJa91Hr"},{"name":"glam_protocol_program","address":"gstgptmbgJVi5f8ZmSRVZjZkDQwqKa3xWuUtD5WmJHz"},{"name":"system_program","address":"11111111111111111111111111111111"},{"name":"user_state","writable":true},{"name":"farm_state","writable":true},{"name":"global_config"},{"name":"reward_mint"},{"name":"user_reward_ata","writable":true},{"name":"rewards_vault","writable":true},{"name":"rewards_treasury_vault","writable":true},{"name":"farm_vaults_authority"},{"name":"scope_prices","optional":true},{"name":"token_program"}],"args":[{"name":"reward_index","type":"u64"}]},{"name":"farms_initialize_user","discriminator":[188,148,82,37,44,46,162,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"}],"program":{"kind":"account","path":"glam_protocol_program"}}},{"name":"glam_signer","writable":true,"signer":true},{"name":"integration_authority","pda":{"seeds":[{"kind":"const","value":[105,110,116,101,103,114,97,116,105,111,110,45,97,117,116,104,111,114,105,116,121]}]}},{"name":"cpi_program","address":"FarmsPZpWu9i7Kky8tPN37rs2TpmMrAZrC7S7vJa91Hr"},{"name":"glam_protocol_program","address":"gstgptmbgJVi5f8ZmSRVZjZkDQwqKa3xWuUtD5WmJHz"},{"name":"system_program","address":"11111111111111111111111111111111"},{"name":"user_state","writable":true},{"name":"farm_state","writable":true},{"name":"rent","address":"SysvarRent111111111111111111111111111111111"}],"args":[]},{"name":"farms_stake","discriminator":[224,105,208,179,98,200,213,238],"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"}],"program":{"kind":"account","path":"glam_protocol_program"}}},{"name":"glam_signer","writable":true,"signer":true},{"name":"integration_authority","pda":{"seeds":[{"kind":"const","value":[105,110,116,101,103,114,97,116,105,111,110,45,97,117,116,104,111,114,105,116,121]}]}},{"name":"cpi_program","address":"FarmsPZpWu9i7Kky8tPN37rs2TpmMrAZrC7S7vJa91Hr"},{"name":"glam_protocol_program","address":"gstgptmbgJVi5f8ZmSRVZjZkDQwqKa3xWuUtD5WmJHz"},{"name":"system_program","address":"11111111111111111111111111111111"},{"name":"user_state","writable":true},{"name":"farm_state","writable":true},{"name":"farm_vault","writable":true},{"name":"user_ata","writable":true},{"name":"token_mint"},{"name":"scope_prices","optional":true},{"name":"token_program"}],"args":[{"name":"amount","type":"u64"}]},{"name":"farms_unstake","discriminator":[180,131,50,144,26,242,175,242],"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"}],"program":{"kind":"account","path":"glam_protocol_program"}}},{"name":"glam_signer","writable":true,"signer":true},{"name":"integration_authority","pda":{"seeds":[{"kind":"const","value":[105,110,116,101,103,114,97,116,105,111,110,45,97,117,116,104,111,114,105,116,121]}]}},{"name":"cpi_program","address":"FarmsPZpWu9i7Kky8tPN37rs2TpmMrAZrC7S7vJa91Hr"},{"name":"glam_protocol_program","address":"gstgptmbgJVi5f8ZmSRVZjZkDQwqKa3xWuUtD5WmJHz"},{"name":"system_program","address":"11111111111111111111111111111111"},{"name":"user_state","writable":true},{"name":"farm_state","writable":true},{"name":"scope_prices","optional":true}],"args":[{"name":"amount","type":"u128"}]},{"name":"farms_withdraw_unstaked_deposits","discriminator":[107,97,50,15,211,245,52,96],"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"}],"program":{"kind":"account","path":"glam_protocol_program"}}},{"name":"glam_signer","writable":true,"signer":true},{"name":"integration_authority","pda":{"seeds":[{"kind":"const","value":[105,110,116,101,103,114,97,116,105,111,110,45,97,117,116,104,111,114,105,116,121]}]}},{"name":"cpi_program","address":"FarmsPZpWu9i7Kky8tPN37rs2TpmMrAZrC7S7vJa91Hr"},{"name":"glam_protocol_program","address":"gstgptmbgJVi5f8ZmSRVZjZkDQwqKa3xWuUtD5WmJHz"},{"name":"system_program","address":"11111111111111111111111111111111"},{"name":"user_state","writable":true},{"name":"farm_state","writable":true},{"name":"user_ata","writable":true},{"name":"farm_vault","writable":true},{"name":"farm_vaults_authority"},{"name":"token_program"}],"args":[]},{"name":"lending_borrow_obligation_liquidity_v2","discriminator":[149,226,84,157,124,178,35,122],"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"}],"program":{"kind":"account","path":"glam_protocol_program"}}},{"name":"glam_signer","writable":true,"signer":true},{"name":"integration_authority","pda":{"seeds":[{"kind":"const","value":[105,110,116,101,103,114,97,116,105,111,110,45,97,117,116,104,111,114,105,116,121]}]}},{"name":"cpi_program","address":"KLend2g3cP87fffoy8q1mQqGKjrxjC8boSyAYavgmjD"},{"name":"glam_protocol_program","address":"gstgptmbgJVi5f8ZmSRVZjZkDQwqKa3xWuUtD5WmJHz"},{"name":"system_program","address":"11111111111111111111111111111111"},{"name":"obligation","writable":true},{"name":"lending_market"},{"name":"lending_market_authority"},{"name":"borrow_reserve","writable":true},{"name":"borrow_reserve_liquidity_mint"},{"name":"reserve_source_liquidity","writable":true},{"name":"borrow_reserve_liquidity_fee_receiver","writable":true},{"name":"user_destination_liquidity","writable":true},{"name":"referrer_token_state","writable":true,"optional":true},{"name":"token_program"},{"name":"instruction_sysvar_account"},{"name":"obligation_farm_user_state","writable":true,"optional":true},{"name":"reserve_farm_state","writable":true,"optional":true},{"name":"farms_program"}],"args":[{"name":"liquidity_amount","type":"u64"}]},{"name":"lending_deposit_reserve_liquidity_and_obligation_collateral_v2","discriminator":[33,146,50,121,127,94,92,192],"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"}],"program":{"kind":"account","path":"glam_protocol_program"}}},{"name":"glam_signer","writable":true,"signer":true},{"name":"integration_authority","pda":{"seeds":[{"kind":"const","value":[105,110,116,101,103,114,97,116,105,111,110,45,97,117,116,104,111,114,105,116,121]}]}},{"name":"cpi_program","address":"KLend2g3cP87fffoy8q1mQqGKjrxjC8boSyAYavgmjD"},{"name":"glam_protocol_program","address":"gstgptmbgJVi5f8ZmSRVZjZkDQwqKa3xWuUtD5WmJHz"},{"name":"system_program","address":"11111111111111111111111111111111"},{"name":"obligation","writable":true},{"name":"lending_market"},{"name":"lending_market_authority"},{"name":"reserve","writable":true},{"name":"reserve_liquidity_mint"},{"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","optional":true},{"name":"collateral_token_program"},{"name":"liquidity_token_program"},{"name":"instruction_sysvar_account"},{"name":"obligation_farm_user_state","writable":true,"optional":true},{"name":"reserve_farm_state","writable":true,"optional":true},{"name":"farms_program"}],"args":[{"name":"liquidity_amount","type":"u64"}]},{"name":"lending_init_obligation","discriminator":[188,161,62,142,106,232,77,135],"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"}],"program":{"kind":"account","path":"glam_protocol_program"}}},{"name":"glam_signer","writable":true,"signer":true},{"name":"integration_authority","pda":{"seeds":[{"kind":"const","value":[105,110,116,101,103,114,97,116,105,111,110,45,97,117,116,104,111,114,105,116,121]}]}},{"name":"cpi_program","address":"KLend2g3cP87fffoy8q1mQqGKjrxjC8boSyAYavgmjD"},{"name":"glam_protocol_program","address":"gstgptmbgJVi5f8ZmSRVZjZkDQwqKa3xWuUtD5WmJHz"},{"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":"lending_init_obligation_farms_for_reserve","discriminator":[3,234,110,39,12,147,175,185],"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"}],"program":{"kind":"account","path":"glam_protocol_program"}}},{"name":"glam_signer","writable":true,"signer":true},{"name":"integration_authority","pda":{"seeds":[{"kind":"const","value":[105,110,116,101,103,114,97,116,105,111,110,45,97,117,116,104,111,114,105,116,121]}]}},{"name":"cpi_program","address":"KLend2g3cP87fffoy8q1mQqGKjrxjC8boSyAYavgmjD"},{"name":"glam_protocol_program","address":"gstgptmbgJVi5f8ZmSRVZjZkDQwqKa3xWuUtD5WmJHz"},{"name":"payer","writable":true,"signer":true},{"name":"obligation","writable":true},{"name":"lending_market_authority"},{"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":"lending_init_user_metadata","discriminator":[68,236,138,146,124,228,247,241],"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"}],"program":{"kind":"account","path":"glam_protocol_program"}}},{"name":"glam_signer","writable":true,"signer":true},{"name":"integration_authority","pda":{"seeds":[{"kind":"const","value":[105,110,116,101,103,114,97,116,105,111,110,45,97,117,116,104,111,114,105,116,121]}]}},{"name":"cpi_program","address":"KLend2g3cP87fffoy8q1mQqGKjrxjC8boSyAYavgmjD"},{"name":"glam_protocol_program","address":"gstgptmbgJVi5f8ZmSRVZjZkDQwqKa3xWuUtD5WmJHz"},{"name":"fee_payer","writable":true,"signer":true},{"name":"user_metadata","writable":true},{"name":"referrer_user_metadata","optional":true},{"name":"rent","address":"SysvarRent111111111111111111111111111111111"},{"name":"system_program","address":"11111111111111111111111111111111"}],"args":[{"name":"user_lookup_table","type":"pubkey"}]},{"name":"lending_repay_obligation_liquidity_v2","discriminator":[79,34,126,170,174,156,174,29],"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"}],"program":{"kind":"account","path":"glam_protocol_program"}}},{"name":"glam_signer","writable":true,"signer":true},{"name":"integration_authority","pda":{"seeds":[{"kind":"const","value":[105,110,116,101,103,114,97,116,105,111,110,45,97,117,116,104,111,114,105,116,121]}]}},{"name":"cpi_program","address":"KLend2g3cP87fffoy8q1mQqGKjrxjC8boSyAYavgmjD"},{"name":"glam_protocol_program","address":"gstgptmbgJVi5f8ZmSRVZjZkDQwqKa3xWuUtD5WmJHz"},{"name":"system_program","address":"11111111111111111111111111111111"},{"name":"obligation","writable":true},{"name":"lending_market"},{"name":"repay_reserve","writable":true},{"name":"reserve_liquidity_mint"},{"name":"reserve_destination_liquidity","writable":true},{"name":"user_source_liquidity","writable":true},{"name":"token_program"},{"name":"instruction_sysvar_account"},{"name":"obligation_farm_user_state","writable":true,"optional":true},{"name":"reserve_farm_state","writable":true,"optional":true},{"name":"lending_market_authority"},{"name":"farms_program"}],"args":[{"name":"liquidity_amount","type":"u64"}]},{"name":"lending_request_elevation_group","discriminator":[162,119,197,54,246,84,55,153],"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"}],"program":{"kind":"account","path":"glam_protocol_program"}}},{"name":"glam_signer","writable":true,"signer":true},{"name":"integration_authority","pda":{"seeds":[{"kind":"const","value":[105,110,116,101,103,114,97,116,105,111,110,45,97,117,116,104,111,114,105,116,121]}]}},{"name":"cpi_program","address":"KLend2g3cP87fffoy8q1mQqGKjrxjC8boSyAYavgmjD"},{"name":"glam_protocol_program","address":"gstgptmbgJVi5f8ZmSRVZjZkDQwqKa3xWuUtD5WmJHz"},{"name":"system_program","address":"11111111111111111111111111111111"},{"name":"obligation","writable":true},{"name":"lending_market"}],"args":[{"name":"elevation_group","type":"u8"}]},{"name":"lending_withdraw_obligation_collateral_and_redeem_reserve_collateral_v2","discriminator":[217,223,173,35,64,225,161,222],"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"}],"program":{"kind":"account","path":"glam_protocol_program"}}},{"name":"glam_signer","writable":true,"signer":true},{"name":"integration_authority","pda":{"seeds":[{"kind":"const","value":[105,110,116,101,103,114,97,116,105,111,110,45,97,117,116,104,111,114,105,116,121]}]}},{"name":"cpi_program","address":"KLend2g3cP87fffoy8q1mQqGKjrxjC8boSyAYavgmjD"},{"name":"glam_protocol_program","address":"gstgptmbgJVi5f8ZmSRVZjZkDQwqKa3xWuUtD5WmJHz"},{"name":"system_program","address":"11111111111111111111111111111111"},{"name":"obligation","writable":true},{"name":"lending_market"},{"name":"lending_market_authority"},{"name":"withdraw_reserve","writable":true},{"name":"reserve_liquidity_mint"},{"name":"reserve_source_collateral","writable":true},{"name":"reserve_collateral_mint","writable":true},{"name":"reserve_liquidity_supply","writable":true},{"name":"user_destination_liquidity","writable":true},{"name":"placeholder_user_destination_collateral","optional":true},{"name":"collateral_token_program"},{"name":"liquidity_token_program"},{"name":"instruction_sysvar_account"},{"name":"obligation_farm_user_state","writable":true,"optional":true},{"name":"reserve_farm_state","writable":true,"optional":true},{"name":"farms_program"}],"args":[{"name":"collateral_amount","type":"u64"}]},{"name":"set_lending_policy","discriminator":[226,185,23,3,113,88,118,176],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_signer","writable":true,"signer":true},{"name":"glam_protocol_program","address":"gstgptmbgJVi5f8ZmSRVZjZkDQwqKa3xWuUtD5WmJHz"}],"args":[{"name":"policy","type":{"defined":{"name":"LendingPolicy"}}}]},{"name":"set_vaults_policy","discriminator":[211,177,22,152,235,59,192,62],"accounts":[{"name":"glam_state","writable":true},{"name":"glam_signer","writable":true,"signer":true},{"name":"glam_protocol_program","address":"gstgptmbgJVi5f8ZmSRVZjZkDQwqKa3xWuUtD5WmJHz"}],"args":[{"name":"policy","type":{"defined":{"name":"VaultsPolicy"}}}]},{"name":"vaults_deposit","discriminator":[124,173,191,223,48,26,84,84],"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"}],"program":{"kind":"account","path":"glam_protocol_program"}}},{"name":"glam_signer","writable":true,"signer":true},{"name":"integration_authority","pda":{"seeds":[{"kind":"const","value":[105,110,116,101,103,114,97,116,105,111,110,45,97,117,116,104,111,114,105,116,121]}]}},{"name":"cpi_program","address":"KvauGMspG5k6rtzrqqn7WNn3oZdyKqLKwK2XWQ8FLjd"},{"name":"glam_protocol_program","address":"gstgptmbgJVi5f8ZmSRVZjZkDQwqKa3xWuUtD5WmJHz"},{"name":"system_program","address":"11111111111111111111111111111111"},{"name":"vault_state","writable":true},{"name":"token_vault","writable":true},{"name":"token_mint"},{"name":"base_vault_authority"},{"name":"shares_mint","writable":true},{"name":"user_token_ata","writable":true},{"name":"user_shares_ata","writable":true},{"name":"klend_program"},{"name":"token_program"},{"name":"shares_token_program"},{"name":"event_authority"},{"name":"program"}],"args":[{"name":"max_amount","type":"u64"}]},{"name":"vaults_withdraw","discriminator":[12,8,236,92,134,144,196,87],"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"}],"program":{"kind":"account","path":"glam_protocol_program"}}},{"name":"glam_signer","writable":true,"signer":true},{"name":"integration_authority","pda":{"seeds":[{"kind":"const","value":[105,110,116,101,103,114,97,116,105,111,110,45,97,117,116,104,111,114,105,116,121]}]}},{"name":"cpi_program","address":"KvauGMspG5k6rtzrqqn7WNn3oZdyKqLKwK2XWQ8FLjd"},{"name":"glam_protocol_program","address":"gstgptmbgJVi5f8ZmSRVZjZkDQwqKa3xWuUtD5WmJHz"},{"name":"system_program","address":"11111111111111111111111111111111"},{"name":"withdraw_from_available_vault_state","writable":true},{"name":"withdraw_from_available_global_config"},{"name":"withdraw_from_available_token_vault","writable":true},{"name":"withdraw_from_available_base_vault_authority"},{"name":"withdraw_from_available_user_token_ata","writable":true},{"name":"withdraw_from_available_token_mint","writable":true},{"name":"withdraw_from_available_user_shares_ata","writable":true},{"name":"withdraw_from_available_shares_mint","writable":true},{"name":"withdraw_from_available_token_program"},{"name":"withdraw_from_available_shares_token_program"},{"name":"withdraw_from_available_klend_program"},{"name":"withdraw_from_available_event_authority"},{"name":"withdraw_from_available_program"},{"name":"withdraw_from_reserve_vault_state","writable":true},{"name":"withdraw_from_reserve_reserve","writable":true},{"name":"withdraw_from_reserve_ctoken_vault","writable":true},{"name":"withdraw_from_reserve_lending_market"},{"name":"withdraw_from_reserve_lending_market_authority"},{"name":"withdraw_from_reserve_reserve_liquidity_supply","writable":true},{"name":"withdraw_from_reserve_reserve_collateral_mint","writable":true},{"name":"withdraw_from_reserve_reserve_collateral_token_program"},{"name":"withdraw_from_reserve_instruction_sysvar_account"},{"name":"event_authority"},{"name":"program"}],"args":[{"name":"shares_amount","type":"u64"}]}],"accounts":[{"name":"StateAccount","discriminator":[142,247,54,95,85,133,249,103]}],"types":[{"name":"AccountType","type":{"kind":"enum","variants":[{"name":"Vault"},{"name":"TokenizedVault"},{"name":"Mint"},{"name":"SingleAssetVault"}]}},{"name":"AccruedFees","type":{"kind":"struct","fields":[{"name":"vault_subscription_fee","type":"u128"},{"name":"vault_redemption_fee","type":"u128"},{"name":"manager_subscription_fee","type":"u128"},{"name":"manager_redemption_fee","type":"u128"},{"name":"management_fee","type":"u128"},{"name":"performance_fee","type":"u128"},{"name":"protocol_base_fee","type":"u128"},{"name":"protocol_flow_fee","type":"u128"}]}},{"name":"CreatedModel","type":{"kind":"struct","fields":[{"name":"key","type":{"array":["u8",8]}},{"name":"created_by","type":"pubkey"},{"name":"created_at","type":"i64"}]}},{"name":"DelegateAcl","type":{"kind":"struct","fields":[{"name":"pubkey","type":"pubkey"},{"name":"integration_permissions","type":{"vec":{"defined":{"name":"IntegrationPermissions"}}}},{"name":"expires_at","type":"i64"}]}},{"name":"EngineField","type":{"kind":"struct","fields":[{"name":"name","type":{"defined":{"name":"EngineFieldName"}}},{"name":"value","type":{"defined":{"name":"EngineFieldValue"}}}]}},{"name":"EngineFieldName","type":{"kind":"enum","variants":[{"name":"Owner"},{"name":"PortfolioManagerName"},{"name":"Name"},{"name":"Uri"},{"name":"Assets"},{"name":"DelegateAcls"},{"name":"IntegrationAcls"},{"name":"TimelockDuration"},{"name":"Borrowable"},{"name":"DefaultAccountStateFrozen"},{"name":"PermanentDelegate"},{"name":"NotifyAndSettle"},{"name":"FeeStructure"},{"name":"FeeParams"},{"name":"ClaimableFees"},{"name":"ClaimedFees"},{"name":"OracleConfigs"},{"name":"ReduceOnly"},{"name":"AnyLst"}]}},{"name":"EngineFieldValue","type":{"kind":"enum","variants":[{"name":"Boolean","fields":[{"name":"val","type":"bool"}]},{"name":"U8","fields":[{"name":"val","type":"u8"}]},{"name":"U32","fields":[{"name":"val","type":"u32"}]},{"name":"U64","fields":[{"name":"val","type":"u64"}]},{"name":"String","fields":[{"name":"val","type":"string"}]},{"name":"Pubkey","fields":[{"name":"val","type":"pubkey"}]},{"name":"VecPubkey","fields":[{"name":"val","type":{"vec":"pubkey"}}]},{"name":"VecU8","fields":[{"name":"val","type":"bytes"}]},{"name":"VecU32","fields":[{"name":"val","type":{"vec":"u32"}}]},{"name":"VecDelegateAcl","fields":[{"name":"val","type":{"vec":{"defined":{"name":"DelegateAcl"}}}}]},{"name":"VecIntegrationAcl","fields":[{"name":"val","type":{"vec":{"defined":{"name":"IntegrationAcl"}}}}]},{"name":"FeeStructure","fields":[{"name":"val","type":{"defined":{"name":"FeeStructure"}}}]},{"name":"FeeParams","fields":[{"name":"val","type":{"defined":{"name":"FeeParams"}}}]},{"name":"AccruedFees","fields":[{"name":"val","type":{"defined":{"name":"AccruedFees"}}}]},{"name":"NotifyAndSettle","fields":[{"name":"val","type":{"defined":{"name":"NotifyAndSettle"}}}]},{"name":"OracleConfigs","fields":[{"name":"val","type":{"defined":{"name":"OracleConfigs"}}}]}]}},{"name":"EntryExitFees","type":{"kind":"struct","fields":[{"name":"subscription_fee_bps","type":"u16"},{"name":"redemption_fee_bps","type":"u16"}]}},{"name":"FeeParams","type":{"kind":"struct","fields":[{"name":"year_in_seconds","type":"u32"},{"name":"pa_high_water_mark","type":"i128"},{"name":"pa_last_nav","type":"i128"},{"name":"last_aum","type":"i128"},{"name":"last_performance_fee_crystallized","type":"i64"},{"name":"last_management_fee_crystallized","type":"i64"},{"name":"last_protocol_fee_crystallized","type":"i64"}]}},{"name":"FeeStructure","type":{"kind":"struct","fields":[{"name":"vault","type":{"defined":{"name":"EntryExitFees"}}},{"name":"manager","type":{"defined":{"name":"EntryExitFees"}}},{"name":"management","type":{"defined":{"name":"ManagementFee"}}},{"name":"performance","type":{"defined":{"name":"PerformanceFee"}}},{"name":"protocol","type":{"defined":{"name":"ProtocolFees"}}}]}},{"name":"HurdleType","type":{"kind":"enum","variants":[{"name":"Hard"},{"name":"Soft"}]}},{"name":"InitObligationArgs","type":{"kind":"struct","fields":[{"name":"tag","type":"u8"},{"name":"id","type":"u8"}]}},{"name":"IntegrationAcl","docs":["An integration program can have multiple protocols supported.","Enabled protocols are stored in a bitmask, and each protocol can have its own policy."],"type":{"kind":"struct","fields":[{"name":"integration_program","type":"pubkey"},{"name":"protocols_bitmask","type":"u16"},{"name":"protocol_policies","type":{"vec":{"defined":{"name":"ProtocolPolicy"}}}}]}},{"name":"IntegrationPermissions","docs":["Stores delegate permissions for an integration program."],"type":{"kind":"struct","fields":[{"name":"integration_program","type":"pubkey"},{"name":"protocol_permissions","type":{"vec":{"defined":{"name":"ProtocolPermissions"}}}}]}},{"name":"LendingPolicy","type":{"kind":"struct","fields":[{"name":"markets_allowlist","type":{"vec":"pubkey"}},{"name":"borrow_allowlist","type":{"vec":"pubkey"}}]}},{"name":"ManagementFee","type":{"kind":"struct","fields":[{"name":"fee_bps","type":"u16"}]}},{"name":"NoticePeriodType","type":{"kind":"enum","variants":[{"name":"Hard"},{"name":"Soft"}]}},{"name":"NotifyAndSettle","type":{"kind":"struct","fields":[{"name":"model","type":{"defined":{"name":"ValuationModel"}}},{"name":"permissionless_fulfillment","type":"bool"},{"name":"subscribe_notice_period_type","type":{"defined":{"name":"NoticePeriodType"}}},{"name":"subscribe_notice_period","type":"u64"},{"name":"subscribe_settlement_period","type":"u64"},{"name":"subscribe_cancellation_window","type":"u64"},{"name":"redeem_notice_period_type","type":{"defined":{"name":"NoticePeriodType"}}},{"name":"redeem_notice_period","type":"u64"},{"name":"redeem_settlement_period","type":"u64"},{"name":"redeem_cancellation_window","type":"u64"},{"name":"time_unit","type":{"defined":{"name":"TimeUnit"}}},{"name":"_padding","type":{"array":["u8",3]}}]}},{"name":"OracleConfigs","docs":["Vault-specific oracle configs. If available, these configs are preferred over the global config."],"type":{"kind":"struct","fields":[{"name":"max_ages_seconds","type":{"vec":{"array":["u16",2]}}},{"name":"padding","type":{"array":["u8",12]}}]}},{"name":"PerformanceFee","type":{"kind":"struct","fields":[{"name":"fee_bps","type":"u16"},{"name":"hurdle_rate_bps","type":"u16"},{"name":"hurdle_type","type":{"defined":{"name":"HurdleType"}}}]}},{"name":"PricedProtocol","type":{"kind":"struct","fields":[{"name":"rent","type":"u64"},{"name":"amount","type":"i128"},{"name":"decimals","type":"u8"},{"name":"last_updated_slot","type":"u64"},{"name":"integration_program","type":"pubkey"},{"name":"protocol_bitflag","type":"u16"},{"name":"positions","type":{"vec":"pubkey"}}]}},{"name":"ProtocolFees","type":{"kind":"struct","fields":[{"name":"base_fee_bps","type":"u16"},{"name":"flow_fee_bps","type":"u16"}]}},{"name":"ProtocolPermissions","docs":["Represents a delegate\'s permissions for a specific protocol"],"type":{"kind":"struct","fields":[{"name":"protocol_bitflag","type":"u16"},{"name":"permissions_bitmask","type":"u64"}]}},{"name":"ProtocolPolicy","docs":["Stores policy data for an integrated protocol.","Integration programs serialize/deserialize this data."],"type":{"kind":"struct","fields":[{"name":"protocol_bitflag","type":"u16"},{"name":"data","type":"bytes"}]}},{"name":"StateAccount","type":{"kind":"struct","fields":[{"name":"account_type","type":{"defined":{"name":"AccountType"}}},{"name":"enabled","type":"bool"},{"name":"vault","type":"pubkey"},{"name":"owner","type":"pubkey"},{"name":"portfolio_manager_name","type":{"array":["u8",32]}},{"name":"created","type":{"defined":{"name":"CreatedModel"}}},{"name":"base_asset_mint","type":"pubkey"},{"name":"base_asset_decimals","type":"u8"},{"name":"base_asset_token_program","type":"u8"},{"name":"name","type":{"array":["u8",32]}},{"name":"timelock_duration","type":"u32"},{"name":"timelock_expires_at","type":"u64"},{"name":"mint","type":"pubkey"},{"name":"assets","type":{"vec":"pubkey"}},{"name":"integration_acls","type":{"vec":{"defined":{"name":"IntegrationAcl"}}}},{"name":"delegate_acls","type":{"vec":{"defined":{"name":"DelegateAcl"}}}},{"name":"external_positions","type":{"vec":"pubkey"}},{"name":"priced_protocols","type":{"vec":{"defined":{"name":"PricedProtocol"}}}},{"name":"params","type":{"vec":{"vec":{"defined":{"name":"EngineField"}}}}}]}},{"name":"TimeUnit","type":{"kind":"enum","variants":[{"name":"Second"},{"name":"Slot"}]}},{"name":"ValuationModel","type":{"kind":"enum","variants":[{"name":"Continuous"},{"name":"Periodic"}]}},{"name":"VaultsPolicy","type":{"kind":"struct","fields":[{"name":"vaults_allowlist","type":{"vec":"pubkey"}}]}}],"constants":[{"name":"PROTO_KAMINO_FARMS","type":"u16","value":"4"},{"name":"PROTO_KAMINO_FARMS_PERM_HARVEST_REWARD","type":"u64","value":"4"},{"name":"PROTO_KAMINO_FARMS_PERM_STAKE","type":"u64","value":"1"},{"name":"PROTO_KAMINO_FARMS_PERM_UNSTAKE","type":"u64","value":"2"},{"name":"PROTO_KAMINO_LENDING","type":"u16","value":"1"},{"name":"PROTO_KAMINO_LENDING_PERM_BORROW","type":"u64","value":"8"},{"name":"PROTO_KAMINO_LENDING_PERM_DEPOSIT","type":"u64","value":"2"},{"name":"PROTO_KAMINO_LENDING_PERM_INIT","type":"u64","value":"1"},{"name":"PROTO_KAMINO_LENDING_PERM_REPAY","type":"u64","value":"16"},{"name":"PROTO_KAMINO_LENDING_PERM_WITHDRAW","type":"u64","value":"4"},{"name":"PROTO_KAMINO_VAULTS","type":"u16","value":"2"},{"name":"PROTO_KAMINO_VAULTS_PERM_DEPOSIT","type":"u64","value":"1"},{"name":"PROTO_KAMINO_VAULTS_PERM_WITHDRAW","type":"u64","value":"2"}]}');
|
|
308
308
|
|
|
309
309
|
/***/ }),
|
|
310
310
|
/* 21 */
|
|
@@ -348,7 +348,7 @@ Object.defineProperty(exports, "MintModel", ({ enumerable: true, get: function (
|
|
|
348
348
|
Object.defineProperty(exports, "EmergencyUpdateMintArgs", ({ enumerable: true, get: function () { return mint_1.EmergencyUpdateMintArgs; } }));
|
|
349
349
|
Object.defineProperty(exports, "RequestType", ({ enumerable: true, get: function () { return mint_1.RequestType; } }));
|
|
350
350
|
// ACL-related exports
|
|
351
|
-
var acl_1 = __webpack_require__(
|
|
351
|
+
var acl_1 = __webpack_require__(57);
|
|
352
352
|
Object.defineProperty(exports, "IntegrationPermissions", ({ enumerable: true, get: function () { return acl_1.IntegrationPermissions; } }));
|
|
353
353
|
Object.defineProperty(exports, "ProtocolPermissions", ({ enumerable: true, get: function () { return acl_1.ProtocolPermissions; } }));
|
|
354
354
|
Object.defineProperty(exports, "ProtocolPolicy", ({ enumerable: true, get: function () { return acl_1.ProtocolPolicy; } }));
|
|
@@ -356,7 +356,7 @@ Object.defineProperty(exports, "IntegrationAcl", ({ enumerable: true, get: funct
|
|
|
356
356
|
Object.defineProperty(exports, "DelegateAcl", ({ enumerable: true, get: function () { return acl_1.DelegateAcl; } }));
|
|
357
357
|
Object.defineProperty(exports, "EmergencyAccessUpdateArgs", ({ enumerable: true, get: function () { return acl_1.EmergencyAccessUpdateArgs; } }));
|
|
358
358
|
// Type exports
|
|
359
|
-
var types_1 = __webpack_require__(
|
|
359
|
+
var types_1 = __webpack_require__(58);
|
|
360
360
|
Object.defineProperty(exports, "PriceDenom", ({ enumerable: true, get: function () { return types_1.PriceDenom; } }));
|
|
361
361
|
Object.defineProperty(exports, "TimeUnit", ({ enumerable: true, get: function () { return types_1.TimeUnit; } }));
|
|
362
362
|
Object.defineProperty(exports, "VoteAuthorize", ({ enumerable: true, get: function () { return types_1.VoteAuthorize; } }));
|
|
@@ -821,28 +821,31 @@ class DriftProtocolPolicy {
|
|
|
821
821
|
this.borrowAllowlist = borrowAllowlist;
|
|
822
822
|
this.orderPriceToleranceBps = orderPriceToleranceBps;
|
|
823
823
|
}
|
|
824
|
-
static decode(buffer) {
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
824
|
+
static decode(buffer, staging = false) {
|
|
825
|
+
if (staging) {
|
|
826
|
+
try {
|
|
827
|
+
const data = DriftProtocolPolicy._stagingLayout.decode(buffer);
|
|
828
|
+
return new DriftProtocolPolicy(data.spotMarketsAllowlist, data.perpMarketsAllowlist, data.borrowAllowlist, data.orderPriceToleranceBps ?? 0);
|
|
829
|
+
}
|
|
830
|
+
catch {
|
|
831
|
+
// Backward compat: old staging data without orderPriceToleranceBps
|
|
832
|
+
// falls through to the base layout decoding
|
|
833
|
+
}
|
|
833
834
|
}
|
|
835
|
+
const data = DriftProtocolPolicy._layout.decode(buffer);
|
|
836
|
+
return new DriftProtocolPolicy(data.spotMarketsAllowlist, data.perpMarketsAllowlist, data.borrowAllowlist, 0);
|
|
834
837
|
}
|
|
835
|
-
encode() {
|
|
836
|
-
// Calculate buffer size needed
|
|
837
|
-
// 4 bytes for spot markets length + 2 bytes per spot market
|
|
838
|
-
// 4 bytes for perp markets length + 2 bytes per perp market
|
|
839
|
-
// 4 bytes for borrow allowlist length + 32 bytes per pubkey
|
|
840
|
-
// 2 bytes for orderPriceToleranceBps
|
|
838
|
+
encode(staging = false) {
|
|
841
839
|
const spotMarketsSize = 4 + this.spotMarketsAllowlist.length * 2;
|
|
842
840
|
const perpMarketsSize = 4 + this.perpMarketsAllowlist.length * 2;
|
|
843
841
|
const borrowAllowlistSize = 4 + this.borrowAllowlist.length * 32;
|
|
844
|
-
const
|
|
845
|
-
|
|
842
|
+
const baseSize = spotMarketsSize + perpMarketsSize + borrowAllowlistSize;
|
|
843
|
+
if (staging) {
|
|
844
|
+
const buffer = Buffer.alloc(baseSize + 2); // +2 for orderPriceToleranceBps
|
|
845
|
+
DriftProtocolPolicy._stagingLayout.encode(this, buffer);
|
|
846
|
+
return buffer;
|
|
847
|
+
}
|
|
848
|
+
const buffer = Buffer.alloc(baseSize);
|
|
846
849
|
DriftProtocolPolicy._layout.encode(this, buffer);
|
|
847
850
|
return buffer;
|
|
848
851
|
}
|
|
@@ -852,12 +855,12 @@ DriftProtocolPolicy._layout = (0, borsh_1.struct)([
|
|
|
852
855
|
(0, borsh_1.vec)((0, borsh_1.u16)(), "spotMarketsAllowlist"),
|
|
853
856
|
(0, borsh_1.vec)((0, borsh_1.u16)(), "perpMarketsAllowlist"),
|
|
854
857
|
(0, borsh_1.vec)((0, borsh_1.publicKey)(), "borrowAllowlist"),
|
|
855
|
-
(0, borsh_1.u16)("orderPriceToleranceBps"),
|
|
856
858
|
]);
|
|
857
|
-
DriftProtocolPolicy.
|
|
859
|
+
DriftProtocolPolicy._stagingLayout = (0, borsh_1.struct)([
|
|
858
860
|
(0, borsh_1.vec)((0, borsh_1.u16)(), "spotMarketsAllowlist"),
|
|
859
861
|
(0, borsh_1.vec)((0, borsh_1.u16)(), "perpMarketsAllowlist"),
|
|
860
862
|
(0, borsh_1.vec)((0, borsh_1.publicKey)(), "borrowAllowlist"),
|
|
863
|
+
(0, borsh_1.u16)("orderPriceToleranceBps"),
|
|
861
864
|
]);
|
|
862
865
|
class KaminoLendingPolicy {
|
|
863
866
|
constructor(marketsAllowlist, borrowAllowlist) {
|
|
@@ -1080,12 +1083,12 @@ tslib_1.__exportStar(__webpack_require__(44), exports);
|
|
|
1080
1083
|
tslib_1.__exportStar(__webpack_require__(37), exports);
|
|
1081
1084
|
tslib_1.__exportStar(__webpack_require__(46), exports);
|
|
1082
1085
|
tslib_1.__exportStar(__webpack_require__(47), exports);
|
|
1083
|
-
tslib_1.__exportStar(__webpack_require__(
|
|
1086
|
+
tslib_1.__exportStar(__webpack_require__(49), exports);
|
|
1084
1087
|
tslib_1.__exportStar(__webpack_require__(35), exports);
|
|
1085
1088
|
tslib_1.__exportStar(__webpack_require__(45), exports);
|
|
1086
|
-
tslib_1.__exportStar(__webpack_require__(
|
|
1087
|
-
tslib_1.__exportStar(__webpack_require__(
|
|
1088
|
-
tslib_1.__exportStar(__webpack_require__(
|
|
1089
|
+
tslib_1.__exportStar(__webpack_require__(52), exports);
|
|
1090
|
+
tslib_1.__exportStar(__webpack_require__(54), exports);
|
|
1091
|
+
tslib_1.__exportStar(__webpack_require__(56), exports);
|
|
1089
1092
|
|
|
1090
1093
|
|
|
1091
1094
|
/***/ }),
|
|
@@ -1823,9 +1826,14 @@ function getHeliusApiKey() {
|
|
|
1823
1826
|
* Otherwise falls back to standard getProgramAccounts with retry logic.
|
|
1824
1827
|
*/
|
|
1825
1828
|
async function getProgramAccounts(connection, programId, config) {
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
+
// 2026-03-02: Helius getProgramAccountsV2 cannot find ALTs, disable it for now
|
|
1830
|
+
// if (isHeliusRpc(connection.rpcEndpoint)) {
|
|
1831
|
+
// return await getProgramAccountsV2Helius(
|
|
1832
|
+
// connection.rpcEndpoint,
|
|
1833
|
+
// programId,
|
|
1834
|
+
// config,
|
|
1835
|
+
// );
|
|
1836
|
+
// }
|
|
1829
1837
|
return await getProgramAccountsWithRetry(connection, programId, config);
|
|
1830
1838
|
}
|
|
1831
1839
|
async function rpcRequest(rpcUrl, method, params) {
|
|
@@ -1880,7 +1888,7 @@ async function getProgramAccountsV2Helius(rpcUrl, programId, config) {
|
|
|
1880
1888
|
},
|
|
1881
1889
|
});
|
|
1882
1890
|
}
|
|
1883
|
-
paginationKey = result.paginationKey;
|
|
1891
|
+
paginationKey = result.accounts.length > 0 ? result.paginationKey : null;
|
|
1884
1892
|
} while (paginationKey);
|
|
1885
1893
|
return allAccounts;
|
|
1886
1894
|
}
|
|
@@ -2835,42 +2843,36 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
2835
2843
|
exports.getSimulationResult = void 0;
|
|
2836
2844
|
exports.parseProgramLogs = parseProgramLogs;
|
|
2837
2845
|
const web3_js_1 = __webpack_require__(5);
|
|
2838
|
-
const
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
// "Error Message:" indicates an anchor program error
|
|
2851
|
-
// Other messages are manually sourced & handled
|
|
2852
|
-
const errorMsgLog = (logs || []).find((log) => log.includes("Error Message:") ||
|
|
2853
|
-
log.includes("Error: insufficient funds") ||
|
|
2854
|
-
log.includes("Transfer: insufficient lamports"));
|
|
2846
|
+
const error_1 = __webpack_require__(48);
|
|
2847
|
+
/**
|
|
2848
|
+
* Parses program logs to extract error message.
|
|
2849
|
+
* Checks in order: Anchor "Error Message:", insufficient funds/lamports,
|
|
2850
|
+
* and custom program error codes (resolved via IDL when possible).
|
|
2851
|
+
* Returns "Unknown error" if no recognizable error pattern is found.
|
|
2852
|
+
*/
|
|
2853
|
+
function parseProgramLogs(logs, staging) {
|
|
2854
|
+
if (logs.length === 0)
|
|
2855
|
+
return "Invalid program logs";
|
|
2856
|
+
// Anchor "Error Message:" from program logs
|
|
2857
|
+
const errorMsgLog = logs.find((log) => log.includes("Error Message:"));
|
|
2855
2858
|
if (errorMsgLog) {
|
|
2856
|
-
|
|
2857
|
-
return errorMsgLog.split("Error Message:")[1].trim();
|
|
2858
|
-
}
|
|
2859
|
-
return errorMsgLog;
|
|
2859
|
+
return errorMsgLog.split("Error Message:")[1].trim();
|
|
2860
2860
|
}
|
|
2861
|
-
//
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2861
|
+
// "insufficient funds" / "insufficient lamports" from logs
|
|
2862
|
+
const fundsLog = logs.find((log) => log.includes("Error: insufficient funds") ||
|
|
2863
|
+
log.includes("Transfer: insufficient lamports"));
|
|
2864
|
+
if (fundsLog)
|
|
2865
|
+
return fundsLog;
|
|
2866
|
+
// Custom program error code in logs (covers GLAM, Jupiter, etc.)
|
|
2867
|
+
const customErrorLog = logs.find((log) => log.includes("custom program error:"));
|
|
2868
|
+
if (customErrorLog) {
|
|
2869
|
+
const match = customErrorLog.match(/custom program error: (0x[0-9a-fA-F]+)/);
|
|
2867
2870
|
if (match) {
|
|
2868
|
-
const
|
|
2869
|
-
const
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
}
|
|
2871
|
+
const failedProgramId = (0, error_1.extractFailedProgramId)(logs);
|
|
2872
|
+
const resolved = (0, error_1.resolveErrorCode)(match[1], staging, failedProgramId);
|
|
2873
|
+
if (resolved)
|
|
2874
|
+
return resolved;
|
|
2875
|
+
return `Program error: ${match[1]}`;
|
|
2874
2876
|
}
|
|
2875
2877
|
}
|
|
2876
2878
|
return "Unknown error";
|
|
@@ -2908,35 +2910,30 @@ const getSimulationResult = async (connection, instructions, payer, lookupTables
|
|
|
2908
2910
|
};
|
|
2909
2911
|
exports.getSimulationResult = getSimulationResult;
|
|
2910
2912
|
const getErrorFromRpcResponse = (rpcResponse, staging) => {
|
|
2911
|
-
// Note: `confirmTransaction` does not throw an error if the confirmation does not succeed,
|
|
2912
|
-
// but rather a `TransactionError` object. so we handle that here
|
|
2913
2913
|
const error = rpcResponse.value.err;
|
|
2914
|
-
if (error)
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
if (errorKeys
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
const
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
if (glamError?.msg) {
|
|
2931
|
-
throw new Error(glamError.msg);
|
|
2932
|
-
}
|
|
2933
|
-
// Unrecognized error code, try to parse program logs to get error message
|
|
2934
|
-
const errMsg = parseProgramLogs(rpcResponse.value.logs);
|
|
2935
|
-
throw new Error(errMsg);
|
|
2914
|
+
if (!error)
|
|
2915
|
+
return;
|
|
2916
|
+
if (typeof error === "object") {
|
|
2917
|
+
const errorKeys = Object.keys(error);
|
|
2918
|
+
if (errorKeys.length === 1) {
|
|
2919
|
+
if (errorKeys[0] !== "InstructionError") {
|
|
2920
|
+
throw new Error(`Unknown RPC error: ${JSON.stringify(error)}`);
|
|
2921
|
+
}
|
|
2922
|
+
// @ts-ignore due to missing typing information
|
|
2923
|
+
const instructionError = error["InstructionError"];
|
|
2924
|
+
const customErrorCode = instructionError?.[1]?.["Custom"];
|
|
2925
|
+
if (customErrorCode !== undefined) {
|
|
2926
|
+
const failedProgramId = (0, error_1.extractFailedProgramId)(rpcResponse.value.logs);
|
|
2927
|
+
const msg = (0, error_1.resolveErrorCode)(customErrorCode, staging, failedProgramId);
|
|
2928
|
+
if (msg)
|
|
2929
|
+
throw new Error(msg);
|
|
2936
2930
|
}
|
|
2931
|
+
// Fallback to log-based parsing
|
|
2932
|
+
throw new Error(parseProgramLogs(rpcResponse.value.logs || [], staging));
|
|
2937
2933
|
}
|
|
2938
|
-
throw Error(
|
|
2934
|
+
throw new Error(`Unknown RPC error: ${JSON.stringify(error)}`);
|
|
2939
2935
|
}
|
|
2936
|
+
throw new Error(typeof error === "string" ? error : "Unknown error");
|
|
2940
2937
|
};
|
|
2941
2938
|
|
|
2942
2939
|
|
|
@@ -2946,14 +2943,148 @@ const getErrorFromRpcResponse = (rpcResponse, staging) => {
|
|
|
2946
2943
|
|
|
2947
2944
|
"use strict";
|
|
2948
2945
|
|
|
2946
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2947
|
+
exports.GlamError = void 0;
|
|
2948
|
+
exports.extractFailedProgramId = extractFailedProgramId;
|
|
2949
|
+
exports.resolveErrorCode = resolveErrorCode;
|
|
2950
|
+
exports.parseTxError = parseTxError;
|
|
2951
|
+
const glamExports_1 = __webpack_require__(3);
|
|
2952
|
+
class GlamError extends Error {
|
|
2953
|
+
constructor(message, rawError, programLogs) {
|
|
2954
|
+
super(message);
|
|
2955
|
+
this.message = message;
|
|
2956
|
+
this.rawError = rawError;
|
|
2957
|
+
this.programLogs = programLogs;
|
|
2958
|
+
}
|
|
2959
|
+
}
|
|
2960
|
+
exports.GlamError = GlamError;
|
|
2961
|
+
const JUPITER_SWAP_ERRORS = {
|
|
2962
|
+
6001: "Jupiter swap failed: Slippage tolerance exceeded",
|
|
2963
|
+
6008: "Jupiter swap failed: Not enough account keys",
|
|
2964
|
+
6014: "Jupiter swap failed: Incorrect token program ID",
|
|
2965
|
+
6024: "Jupiter swap failed: Insufficient funds",
|
|
2966
|
+
6025: "Jupiter swap failed: Invalid token account",
|
|
2967
|
+
};
|
|
2968
|
+
/**
|
|
2969
|
+
* Extract the program ID that failed from transaction logs.
|
|
2970
|
+
* Looks for "Program <ID> failed:" log lines.
|
|
2971
|
+
*/
|
|
2972
|
+
function extractFailedProgramId(logs) {
|
|
2973
|
+
if (!logs)
|
|
2974
|
+
return undefined;
|
|
2975
|
+
for (let i = logs.length - 1; i >= 0; i--) {
|
|
2976
|
+
const match = logs[i].match(/^Program (\w+) failed/);
|
|
2977
|
+
if (match)
|
|
2978
|
+
return match[1];
|
|
2979
|
+
}
|
|
2980
|
+
return undefined;
|
|
2981
|
+
}
|
|
2982
|
+
/**
|
|
2983
|
+
* Resolve a custom program error code to a human-readable message.
|
|
2984
|
+
* When programId is provided, matches against the specific program's IDL
|
|
2985
|
+
* to avoid collisions between programs using the same error code range.
|
|
2986
|
+
* Accepts either a decimal number or a hex string (e.g. "0xBB80").
|
|
2987
|
+
*/
|
|
2988
|
+
function resolveErrorCode(code, staging, programId) {
|
|
2989
|
+
const decimal = typeof code === "string"
|
|
2990
|
+
? (() => {
|
|
2991
|
+
const normalized = code.trim().toLowerCase();
|
|
2992
|
+
return normalized.startsWith("0x")
|
|
2993
|
+
? parseInt(normalized, 16)
|
|
2994
|
+
: parseInt(normalized, 10);
|
|
2995
|
+
})()
|
|
2996
|
+
: code;
|
|
2997
|
+
if (isNaN(decimal))
|
|
2998
|
+
return undefined;
|
|
2999
|
+
const s = (0, glamExports_1.resolveStaging)(staging);
|
|
3000
|
+
const glamProtocolId = (0, glamExports_1.getGlamProtocolProgramId)(s).toBase58();
|
|
3001
|
+
const glamMintId = (0, glamExports_1.getGlamMintProgramId)(s).toBase58();
|
|
3002
|
+
if (programId) {
|
|
3003
|
+
// Match against the specific program that failed
|
|
3004
|
+
if (programId === glamProtocolId) {
|
|
3005
|
+
const err = (0, glamExports_1.getGlamProtocolIdl)(s).errors.find((e) => e.code === decimal);
|
|
3006
|
+
return err?.msg;
|
|
3007
|
+
}
|
|
3008
|
+
if (programId === glamMintId) {
|
|
3009
|
+
const err = (0, glamExports_1.getGlamMintIdl)(s).errors.find((e) => e.code === decimal);
|
|
3010
|
+
return err?.msg;
|
|
3011
|
+
}
|
|
3012
|
+
// Not a GLAM program — check third-party errors
|
|
3013
|
+
const jupiterMsg = JUPITER_SWAP_ERRORS[decimal];
|
|
3014
|
+
if (jupiterMsg)
|
|
3015
|
+
return jupiterMsg;
|
|
3016
|
+
return undefined;
|
|
3017
|
+
}
|
|
3018
|
+
// Fallback: no programId provided, check all (legacy behavior)
|
|
3019
|
+
const protocolError = (0, glamExports_1.getGlamProtocolIdl)(s).errors.find((e) => e.code === decimal);
|
|
3020
|
+
if (protocolError?.msg)
|
|
3021
|
+
return protocolError.msg;
|
|
3022
|
+
const mintError = (0, glamExports_1.getGlamMintIdl)(s).errors.find((e) => e.code === decimal);
|
|
3023
|
+
if (mintError?.msg)
|
|
3024
|
+
return mintError.msg;
|
|
3025
|
+
const jupiterMsg = JUPITER_SWAP_ERRORS[decimal];
|
|
3026
|
+
if (jupiterMsg)
|
|
3027
|
+
return jupiterMsg;
|
|
3028
|
+
return undefined;
|
|
3029
|
+
}
|
|
3030
|
+
/**
|
|
3031
|
+
* Parse the error message from a transaction error.
|
|
3032
|
+
* Environment-agnostic: handles Anchor errors, program error codes,
|
|
3033
|
+
* simulation failures, and common RPC/network errors.
|
|
3034
|
+
*
|
|
3035
|
+
* Callers (GUI, CLI) can handle environment-specific error types
|
|
3036
|
+
* (e.g. WalletSignTransactionError) before delegating to this function.
|
|
3037
|
+
*/
|
|
3038
|
+
function parseTxError(error) {
|
|
3039
|
+
const raw = error?.message || error?.toString?.() || "";
|
|
3040
|
+
const msg = raw === "[object Object]" ? "" : raw;
|
|
3041
|
+
// Transaction expired
|
|
3042
|
+
if (msg.includes("block height exceeded")) {
|
|
3043
|
+
return "Transaction expired";
|
|
3044
|
+
}
|
|
3045
|
+
// Transaction too large
|
|
3046
|
+
if (msg.includes("encoding overruns") ||
|
|
3047
|
+
msg.includes("exceeded maximum size")) {
|
|
3048
|
+
return "Transaction too large: the transaction exceeds the maximum size limit.";
|
|
3049
|
+
}
|
|
3050
|
+
// RPC rate limiting
|
|
3051
|
+
if (msg.includes("429") ||
|
|
3052
|
+
msg.includes("Too Many Requests") ||
|
|
3053
|
+
msg.includes("rate limit")) {
|
|
3054
|
+
return "RPC rate limited: please wait a moment and try again";
|
|
3055
|
+
}
|
|
3056
|
+
// RPC unavailable
|
|
3057
|
+
if (msg.includes("503") || msg.includes("Service Unavailable")) {
|
|
3058
|
+
return "RPC service unavailable: try again shortly";
|
|
3059
|
+
}
|
|
3060
|
+
// Connection errors
|
|
3061
|
+
if (msg.includes("ECONNREFUSED") || msg.includes("ENOTFOUND")) {
|
|
3062
|
+
return "Cannot connect to RPC: check your network or endpoint";
|
|
3063
|
+
}
|
|
3064
|
+
// Timeout
|
|
3065
|
+
if (msg.includes("timeout") ||
|
|
3066
|
+
msg.includes("ETIMEDOUT") ||
|
|
3067
|
+
msg.includes("TimeoutError")) {
|
|
3068
|
+
return "Request timed out: try again";
|
|
3069
|
+
}
|
|
3070
|
+
return msg || "Unknown error";
|
|
3071
|
+
}
|
|
3072
|
+
|
|
3073
|
+
|
|
3074
|
+
/***/ }),
|
|
3075
|
+
/* 49 */
|
|
3076
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
3077
|
+
|
|
3078
|
+
"use strict";
|
|
3079
|
+
|
|
2949
3080
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2950
3081
|
const tslib_1 = __webpack_require__(2);
|
|
2951
|
-
tslib_1.__exportStar(__webpack_require__(49), exports);
|
|
2952
3082
|
tslib_1.__exportStar(__webpack_require__(50), exports);
|
|
3083
|
+
tslib_1.__exportStar(__webpack_require__(51), exports);
|
|
2953
3084
|
|
|
2954
3085
|
|
|
2955
3086
|
/***/ }),
|
|
2956
|
-
/*
|
|
3087
|
+
/* 50 */
|
|
2957
3088
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
2958
3089
|
|
|
2959
3090
|
"use strict";
|
|
@@ -3308,7 +3439,7 @@ exports.DefaultOrderParams = {
|
|
|
3308
3439
|
|
|
3309
3440
|
|
|
3310
3441
|
/***/ }),
|
|
3311
|
-
/*
|
|
3442
|
+
/* 51 */
|
|
3312
3443
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
3313
3444
|
|
|
3314
3445
|
"use strict";
|
|
@@ -3319,7 +3450,7 @@ exports.getTriggerMarketOrderParams = getTriggerMarketOrderParams;
|
|
|
3319
3450
|
exports.getTriggerLimitOrderParams = getTriggerLimitOrderParams;
|
|
3320
3451
|
exports.getMarketOrderParams = getMarketOrderParams;
|
|
3321
3452
|
exports.getOrderParams = getOrderParams;
|
|
3322
|
-
const types_1 = __webpack_require__(
|
|
3453
|
+
const types_1 = __webpack_require__(50);
|
|
3323
3454
|
function getLimitOrderParams(params) {
|
|
3324
3455
|
return getOrderParams(Object.assign({}, params, {
|
|
3325
3456
|
orderType: types_1.OrderType.LIMIT,
|
|
@@ -3358,7 +3489,7 @@ function getOrderParams(optionalOrderParams, overridingParams = {}) {
|
|
|
3358
3489
|
|
|
3359
3490
|
|
|
3360
3491
|
/***/ }),
|
|
3361
|
-
/*
|
|
3492
|
+
/* 52 */
|
|
3362
3493
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
3363
3494
|
|
|
3364
3495
|
"use strict";
|
|
@@ -3368,7 +3499,7 @@ exports.Fraction = void 0;
|
|
|
3368
3499
|
exports.bfToDecimal = bfToDecimal;
|
|
3369
3500
|
const tslib_1 = __webpack_require__(2);
|
|
3370
3501
|
const anchor_1 = __webpack_require__(4);
|
|
3371
|
-
const decimal_js_1 = tslib_1.__importDefault(__webpack_require__(
|
|
3502
|
+
const decimal_js_1 = tslib_1.__importDefault(__webpack_require__(53));
|
|
3372
3503
|
const FractionDecimal = decimal_js_1.default.clone({ precision: 40 });
|
|
3373
3504
|
/**
|
|
3374
3505
|
* Replicates the Fraction class from the klend-sdk:
|
|
@@ -3419,21 +3550,21 @@ function bfToDecimal(x) {
|
|
|
3419
3550
|
|
|
3420
3551
|
|
|
3421
3552
|
/***/ }),
|
|
3422
|
-
/*
|
|
3553
|
+
/* 53 */
|
|
3423
3554
|
/***/ ((module) => {
|
|
3424
3555
|
|
|
3425
3556
|
"use strict";
|
|
3426
3557
|
module.exports = require("decimal.js");
|
|
3427
3558
|
|
|
3428
3559
|
/***/ }),
|
|
3429
|
-
/*
|
|
3560
|
+
/* 54 */
|
|
3430
3561
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
3431
3562
|
|
|
3432
3563
|
"use strict";
|
|
3433
3564
|
|
|
3434
3565
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3435
3566
|
exports.JupiterApiClient = exports.JUPITER_API_DEFAULT = exports.JupTokenList = void 0;
|
|
3436
|
-
const zod_1 = __webpack_require__(
|
|
3567
|
+
const zod_1 = __webpack_require__(55);
|
|
3437
3568
|
class JupTokenList {
|
|
3438
3569
|
constructor(tokens) {
|
|
3439
3570
|
this.tokens = tokens;
|
|
@@ -3554,7 +3685,7 @@ class JupiterApiClient {
|
|
|
3554
3685
|
}
|
|
3555
3686
|
return await response.json();
|
|
3556
3687
|
}
|
|
3557
|
-
async getSwapInstructions(quoteResponse, from) {
|
|
3688
|
+
async getSwapInstructions(quoteResponse, from, trackingAccount) {
|
|
3558
3689
|
if (!this.isCustomSwapApi && !this.apiKey) {
|
|
3559
3690
|
throw new Error("Jupiter API key must be set");
|
|
3560
3691
|
}
|
|
@@ -3569,6 +3700,9 @@ class JupiterApiClient {
|
|
|
3569
3700
|
body: JSON.stringify({
|
|
3570
3701
|
quoteResponse,
|
|
3571
3702
|
userPublicKey: from.toBase58(),
|
|
3703
|
+
...(trackingAccount && {
|
|
3704
|
+
trackingAccount: trackingAccount.toBase58(),
|
|
3705
|
+
}),
|
|
3572
3706
|
}),
|
|
3573
3707
|
});
|
|
3574
3708
|
if (!response.ok) {
|
|
@@ -3582,14 +3716,14 @@ exports.JupiterApiClient = JupiterApiClient;
|
|
|
3582
3716
|
|
|
3583
3717
|
|
|
3584
3718
|
/***/ }),
|
|
3585
|
-
/*
|
|
3719
|
+
/* 55 */
|
|
3586
3720
|
/***/ ((module) => {
|
|
3587
3721
|
|
|
3588
3722
|
"use strict";
|
|
3589
3723
|
module.exports = require("zod");
|
|
3590
3724
|
|
|
3591
3725
|
/***/ }),
|
|
3592
|
-
/*
|
|
3726
|
+
/* 56 */
|
|
3593
3727
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
3594
3728
|
|
|
3595
3729
|
"use strict";
|
|
@@ -3720,7 +3854,7 @@ exports.PositionCategorizer = PositionCategorizer;
|
|
|
3720
3854
|
|
|
3721
3855
|
|
|
3722
3856
|
/***/ }),
|
|
3723
|
-
/*
|
|
3857
|
+
/* 57 */
|
|
3724
3858
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
3725
3859
|
|
|
3726
3860
|
"use strict";
|
|
@@ -3776,7 +3910,7 @@ exports.EmergencyAccessUpdateArgs = EmergencyAccessUpdateArgs;
|
|
|
3776
3910
|
|
|
3777
3911
|
|
|
3778
3912
|
/***/ }),
|
|
3779
|
-
/*
|
|
3913
|
+
/* 58 */
|
|
3780
3914
|
/***/ ((__unused_webpack_module, exports) => {
|
|
3781
3915
|
|
|
3782
3916
|
"use strict";
|
|
@@ -3802,7 +3936,7 @@ VoteAuthorize.Withdrawer = { withdrawer: {} };
|
|
|
3802
3936
|
|
|
3803
3937
|
|
|
3804
3938
|
/***/ }),
|
|
3805
|
-
/*
|
|
3939
|
+
/* 59 */
|
|
3806
3940
|
/***/ ((__unused_webpack_module, exports) => {
|
|
3807
3941
|
|
|
3808
3942
|
"use strict";
|
|
@@ -3857,14 +3991,14 @@ var ClusterNetwork;
|
|
|
3857
3991
|
|
|
3858
3992
|
|
|
3859
3993
|
/***/ }),
|
|
3860
|
-
/*
|
|
3994
|
+
/* 60 */
|
|
3861
3995
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
3862
3996
|
|
|
3863
3997
|
"use strict";
|
|
3864
3998
|
|
|
3865
3999
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3866
4000
|
exports.GlamClient = void 0;
|
|
3867
|
-
const base_1 = __webpack_require__(
|
|
4001
|
+
const base_1 = __webpack_require__(61);
|
|
3868
4002
|
const drift_1 = __webpack_require__(62);
|
|
3869
4003
|
const jupiter_1 = __webpack_require__(67);
|
|
3870
4004
|
const marinade_1 = __webpack_require__(70);
|
|
@@ -4002,7 +4136,7 @@ exports.GlamClient = GlamClient;
|
|
|
4002
4136
|
|
|
4003
4137
|
|
|
4004
4138
|
/***/ }),
|
|
4005
|
-
/*
|
|
4139
|
+
/* 61 */
|
|
4006
4140
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
4007
4141
|
|
|
4008
4142
|
"use strict";
|
|
@@ -4019,9 +4153,9 @@ const lookupTables_1 = __webpack_require__(44);
|
|
|
4019
4153
|
const accounts_1 = __webpack_require__(33);
|
|
4020
4154
|
const spl_token_1 = __webpack_require__(26);
|
|
4021
4155
|
const glamExports_1 = __webpack_require__(3);
|
|
4022
|
-
const clientConfig_1 = __webpack_require__(
|
|
4156
|
+
const clientConfig_1 = __webpack_require__(59);
|
|
4023
4157
|
const models_1 = __webpack_require__(24);
|
|
4024
|
-
const error_1 = __webpack_require__(
|
|
4158
|
+
const error_1 = __webpack_require__(48);
|
|
4025
4159
|
const blockhash_1 = __webpack_require__(40);
|
|
4026
4160
|
const glamPDAs_1 = __webpack_require__(43);
|
|
4027
4161
|
const spl_token_metadata_1 = __webpack_require__(27);
|
|
@@ -4228,7 +4362,8 @@ class BaseClient {
|
|
|
4228
4362
|
const errTx = await this.connection.getTransaction(txSig, {
|
|
4229
4363
|
maxSupportedTransactionVersion: 0,
|
|
4230
4364
|
});
|
|
4231
|
-
|
|
4365
|
+
const logs = errTx?.meta?.logMessages || [];
|
|
4366
|
+
throw new error_1.GlamError((0, transaction_1.parseProgramLogs)(logs, this.staging), errTx?.meta?.err, logs);
|
|
4232
4367
|
}
|
|
4233
4368
|
return txSig;
|
|
4234
4369
|
}
|
|
@@ -4475,7 +4610,7 @@ class BaseClient {
|
|
|
4475
4610
|
const integrationPolicy = stateAccount.integrationAcls?.find((acl) => acl.integrationProgram.equals(integProgramId));
|
|
4476
4611
|
const policyData = integrationPolicy?.protocolPolicies?.find((policy) => policy.protocolBitflag === protocolBitflag)?.data;
|
|
4477
4612
|
if (policyData) {
|
|
4478
|
-
return policyClass.decode(policyData);
|
|
4613
|
+
return policyClass.decode(policyData, this.staging);
|
|
4479
4614
|
}
|
|
4480
4615
|
return null;
|
|
4481
4616
|
}
|
|
@@ -4506,25 +4641,6 @@ class BaseTxBuilder {
|
|
|
4506
4641
|
exports.BaseTxBuilder = BaseTxBuilder;
|
|
4507
4642
|
|
|
4508
4643
|
|
|
4509
|
-
/***/ }),
|
|
4510
|
-
/* 61 */
|
|
4511
|
-
/***/ ((__unused_webpack_module, exports) => {
|
|
4512
|
-
|
|
4513
|
-
"use strict";
|
|
4514
|
-
|
|
4515
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
4516
|
-
exports.GlamError = void 0;
|
|
4517
|
-
class GlamError extends Error {
|
|
4518
|
-
constructor(message, rawError, programLogs) {
|
|
4519
|
-
super(message);
|
|
4520
|
-
this.message = message;
|
|
4521
|
-
this.rawError = rawError;
|
|
4522
|
-
this.programLogs = programLogs;
|
|
4523
|
-
}
|
|
4524
|
-
}
|
|
4525
|
-
exports.GlamError = GlamError;
|
|
4526
|
-
|
|
4527
|
-
|
|
4528
4644
|
/***/ }),
|
|
4529
4645
|
/* 62 */
|
|
4530
4646
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
@@ -4546,9 +4662,9 @@ tslib_1.__exportStar(__webpack_require__(66), exports);
|
|
|
4546
4662
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
4547
4663
|
exports.DriftProtocolClient = exports.DriftMarketConfigs = exports.DRIFT_MARGIN_PRECISION = exports.DRIFT_SIGNER = void 0;
|
|
4548
4664
|
const web3_js_1 = __webpack_require__(5);
|
|
4549
|
-
const types_1 = __webpack_require__(
|
|
4665
|
+
const types_1 = __webpack_require__(50);
|
|
4550
4666
|
const driftLayouts_1 = __webpack_require__(64);
|
|
4551
|
-
const base_1 = __webpack_require__(
|
|
4667
|
+
const base_1 = __webpack_require__(61);
|
|
4552
4668
|
const constants_1 = __webpack_require__(34);
|
|
4553
4669
|
const spl_token_1 = __webpack_require__(26);
|
|
4554
4670
|
const anchor_1 = __webpack_require__(4);
|
|
@@ -5186,7 +5302,7 @@ const common_1 = __webpack_require__(28);
|
|
|
5186
5302
|
const base_1 = __webpack_require__(65);
|
|
5187
5303
|
const utils_1 = __webpack_require__(32);
|
|
5188
5304
|
const spl_token_1 = __webpack_require__(26);
|
|
5189
|
-
const types_1 = __webpack_require__(
|
|
5305
|
+
const types_1 = __webpack_require__(50);
|
|
5190
5306
|
const constants_1 = __webpack_require__(34);
|
|
5191
5307
|
class SpotPosition {
|
|
5192
5308
|
constructor(data) {
|
|
@@ -5295,6 +5411,20 @@ class DriftVaultDepositor extends base_1.Decodable {
|
|
|
5295
5411
|
get netShares() {
|
|
5296
5412
|
return this.vaultShares.sub(this.lastWithdrawRequest.shares);
|
|
5297
5413
|
}
|
|
5414
|
+
/** Rebase shares to match the vault's current shares base. */
|
|
5415
|
+
rebaseShares(shares, vaultSharesBase) {
|
|
5416
|
+
if (this.vaultSharesBase === vaultSharesBase)
|
|
5417
|
+
return shares;
|
|
5418
|
+
const expoDiff = vaultSharesBase - this.vaultSharesBase;
|
|
5419
|
+
const divisor = new anchor_1.BN(10).pow(new anchor_1.BN(expoDiff));
|
|
5420
|
+
return shares.div(divisor);
|
|
5421
|
+
}
|
|
5422
|
+
/** Net shares rebased to the vault's current shares base. */
|
|
5423
|
+
netSharesRebased(vaultSharesBase) {
|
|
5424
|
+
const rebased = this.rebaseShares(this.vaultShares, vaultSharesBase);
|
|
5425
|
+
const pendingRebased = this.rebaseShares(this.lastWithdrawRequest.shares, vaultSharesBase);
|
|
5426
|
+
return rebased.sub(pendingRebased);
|
|
5427
|
+
}
|
|
5298
5428
|
}
|
|
5299
5429
|
exports.DriftVaultDepositor = DriftVaultDepositor;
|
|
5300
5430
|
DriftVaultDepositor._layout = (0, borsh_1.struct)([
|
|
@@ -5351,7 +5481,7 @@ class DriftVault extends base_1.Decodable {
|
|
|
5351
5481
|
const baseAssetAmount = aumScaledUsd
|
|
5352
5482
|
.mul(new anchor_1.BN(10 ** spotMarket.decimals))
|
|
5353
5483
|
.div(spotMarket.lastOraclePrice);
|
|
5354
|
-
return baseAssetAmount.
|
|
5484
|
+
return baseAssetAmount.add(this.managerBorrowedValue);
|
|
5355
5485
|
}
|
|
5356
5486
|
}
|
|
5357
5487
|
exports.DriftVault = DriftVault;
|
|
@@ -5865,7 +5995,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
5865
5995
|
exports.DriftVaultsClient = void 0;
|
|
5866
5996
|
const web3_js_1 = __webpack_require__(5);
|
|
5867
5997
|
const driftLayouts_1 = __webpack_require__(64);
|
|
5868
|
-
const base_1 = __webpack_require__(
|
|
5998
|
+
const base_1 = __webpack_require__(61);
|
|
5869
5999
|
const constants_1 = __webpack_require__(34);
|
|
5870
6000
|
const anchor_1 = __webpack_require__(4);
|
|
5871
6001
|
const protocol_v2_1 = __webpack_require__(63);
|
|
@@ -6132,12 +6262,12 @@ exports.JupiterSwapClient = void 0;
|
|
|
6132
6262
|
const anchor_1 = __webpack_require__(4);
|
|
6133
6263
|
const web3_js_1 = __webpack_require__(5);
|
|
6134
6264
|
const spl_token_1 = __webpack_require__(26);
|
|
6135
|
-
const base_1 = __webpack_require__(
|
|
6265
|
+
const base_1 = __webpack_require__(61);
|
|
6136
6266
|
const constants_1 = __webpack_require__(34);
|
|
6137
6267
|
const assets_1 = __webpack_require__(68);
|
|
6138
6268
|
const accounts_1 = __webpack_require__(33);
|
|
6139
6269
|
const glamPDAs_1 = __webpack_require__(43);
|
|
6140
|
-
const jupiterApi_1 = __webpack_require__(
|
|
6270
|
+
const jupiterApi_1 = __webpack_require__(54);
|
|
6141
6271
|
class TxBuilder extends base_1.BaseTxBuilder {
|
|
6142
6272
|
constructor() {
|
|
6143
6273
|
super(...arguments);
|
|
@@ -6189,7 +6319,7 @@ class TxBuilder extends base_1.BaseTxBuilder {
|
|
|
6189
6319
|
inputMint = new web3_js_1.PublicKey(quoteParams?.inputMint || resolvedQuoteResponse.inputMint);
|
|
6190
6320
|
outputMint = new web3_js_1.PublicKey(quoteParams?.outputMint || resolvedQuoteResponse.outputMint);
|
|
6191
6321
|
amount = new anchor_1.BN(quoteParams?.amount || resolvedQuoteResponse.inAmount);
|
|
6192
|
-
swapInstructions = await this.client.jupApi.getSwapInstructions(resolvedQuoteResponse, glamVault);
|
|
6322
|
+
swapInstructions = await this.client.jupApi.getSwapInstructions(resolvedQuoteResponse, glamVault, options.trackingAccount);
|
|
6193
6323
|
}
|
|
6194
6324
|
else {
|
|
6195
6325
|
// If swapInstructions is provided, we need to extract mints and amount from quoteParams or quoteResponse
|
|
@@ -6270,7 +6400,7 @@ exports.getAssetMeta = getAssetMeta;
|
|
|
6270
6400
|
const spl_token_1 = __webpack_require__(26);
|
|
6271
6401
|
const web3_js_1 = __webpack_require__(5);
|
|
6272
6402
|
const sanctum_lst_list_1 = __webpack_require__(69);
|
|
6273
|
-
const clientConfig_1 = __webpack_require__(
|
|
6403
|
+
const clientConfig_1 = __webpack_require__(59);
|
|
6274
6404
|
exports.STAKE_POOLS = sanctum_lst_list_1.LstList.filter((lst) => lst.pool.program === "Spl" ||
|
|
6275
6405
|
lst.pool.program === "Marinade" ||
|
|
6276
6406
|
lst.pool.program === "SanctumSpl" ||
|
|
@@ -6753,10 +6883,10 @@ const anchor_1 = __webpack_require__(4);
|
|
|
6753
6883
|
const web3_js_1 = __webpack_require__(5);
|
|
6754
6884
|
const spl_token_1 = __webpack_require__(26);
|
|
6755
6885
|
const marinade_ts_sdk_1 = __webpack_require__(71);
|
|
6756
|
-
const base_1 = __webpack_require__(
|
|
6886
|
+
const base_1 = __webpack_require__(61);
|
|
6757
6887
|
const constants_1 = __webpack_require__(34);
|
|
6758
6888
|
const accounts_1 = __webpack_require__(33);
|
|
6759
|
-
const clientConfig_1 = __webpack_require__(
|
|
6889
|
+
const clientConfig_1 = __webpack_require__(59);
|
|
6760
6890
|
class TxBuilder extends base_1.BaseTxBuilder {
|
|
6761
6891
|
async depositIxs(amount, glamSigner) {
|
|
6762
6892
|
const marinadeState = await this.client.fetchMarinadeState();
|
|
@@ -7016,7 +7146,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
7016
7146
|
exports.VaultClient = void 0;
|
|
7017
7147
|
const anchor_1 = __webpack_require__(4);
|
|
7018
7148
|
const web3_js_1 = __webpack_require__(5);
|
|
7019
|
-
const base_1 = __webpack_require__(
|
|
7149
|
+
const base_1 = __webpack_require__(61);
|
|
7020
7150
|
const accounts_1 = __webpack_require__(33);
|
|
7021
7151
|
const constants_1 = __webpack_require__(34);
|
|
7022
7152
|
const spl_token_1 = __webpack_require__(26);
|
|
@@ -7304,7 +7434,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
7304
7434
|
exports.StateClient = void 0;
|
|
7305
7435
|
const tslib_1 = __webpack_require__(2);
|
|
7306
7436
|
const anchor = tslib_1.__importStar(__webpack_require__(4));
|
|
7307
|
-
const base_1 = __webpack_require__(
|
|
7437
|
+
const base_1 = __webpack_require__(61);
|
|
7308
7438
|
const models_1 = __webpack_require__(24);
|
|
7309
7439
|
const glamPDAs_1 = __webpack_require__(43);
|
|
7310
7440
|
const common_1 = __webpack_require__(28);
|
|
@@ -7466,7 +7596,7 @@ exports.KaminoLendingClient = void 0;
|
|
|
7466
7596
|
const tslib_1 = __webpack_require__(2);
|
|
7467
7597
|
const anchor_1 = __webpack_require__(4);
|
|
7468
7598
|
const web3_js_1 = __webpack_require__(5);
|
|
7469
|
-
const base_1 = __webpack_require__(
|
|
7599
|
+
const base_1 = __webpack_require__(61);
|
|
7470
7600
|
const borsh = tslib_1.__importStar(__webpack_require__(30));
|
|
7471
7601
|
const accounts_1 = __webpack_require__(33);
|
|
7472
7602
|
const spl_token_1 = __webpack_require__(26);
|
|
@@ -7941,6 +8071,49 @@ class TxBuilder extends base_1.BaseTxBuilder {
|
|
|
7941
8071
|
const tx = this.build(ixs, txOptions);
|
|
7942
8072
|
return await this.client.base.intoVersionedTransaction(tx, txOptions);
|
|
7943
8073
|
}
|
|
8074
|
+
async requestElevationGroupIxs(lendingMarket, elevationGroup, glamSigner) {
|
|
8075
|
+
const vault = this.client.base.vaultPda;
|
|
8076
|
+
const obligation = this.client.getObligationPda(vault, lendingMarket);
|
|
8077
|
+
// Find all reserve keys
|
|
8078
|
+
const { activeDeposits, activeBorrows } = await this.client.fetchAndParseObligation(obligation);
|
|
8079
|
+
const reserveKeys = [
|
|
8080
|
+
...activeDeposits.map(({ depositReserve }) => depositReserve),
|
|
8081
|
+
...activeBorrows.map(({ borrowReserve }) => borrowReserve),
|
|
8082
|
+
];
|
|
8083
|
+
// Build refresh ixs
|
|
8084
|
+
const reserves = await this.client.fetchAndParseReserves(reserveKeys);
|
|
8085
|
+
const refreshReservesIx = this.refreshReservesBatchIx(reserves, false);
|
|
8086
|
+
const refreshObligationIx = this.refreshObligationIx({
|
|
8087
|
+
lendingMarket,
|
|
8088
|
+
obligation,
|
|
8089
|
+
reserves: reserveKeys,
|
|
8090
|
+
});
|
|
8091
|
+
const ix = await this.client.base.extKaminoProgram.methods
|
|
8092
|
+
// @ts-expect-error staging only
|
|
8093
|
+
.lendingRequestElevationGroup(elevationGroup)
|
|
8094
|
+
.accounts({
|
|
8095
|
+
glamState: this.client.base.statePda,
|
|
8096
|
+
glamSigner,
|
|
8097
|
+
obligation,
|
|
8098
|
+
lendingMarket,
|
|
8099
|
+
})
|
|
8100
|
+
.remainingAccounts(reserveKeys.map((pubkey) => ({
|
|
8101
|
+
pubkey,
|
|
8102
|
+
isSigner: false,
|
|
8103
|
+
isWritable: false,
|
|
8104
|
+
})))
|
|
8105
|
+
.instruction();
|
|
8106
|
+
return [refreshReservesIx, refreshObligationIx, ix];
|
|
8107
|
+
}
|
|
8108
|
+
async requestElevationGroupTx(lendingMarket, elevationGroup, txOptions = {}) {
|
|
8109
|
+
if (!this.client.base.staging) {
|
|
8110
|
+
throw new Error("requestElevationGroupTx is only available in staging mode");
|
|
8111
|
+
}
|
|
8112
|
+
const glamSigner = txOptions.signer || this.client.base.signer;
|
|
8113
|
+
const ixs = await this.requestElevationGroupIxs(lendingMarket, elevationGroup, glamSigner);
|
|
8114
|
+
const tx = this.build(ixs, txOptions);
|
|
8115
|
+
return await this.client.base.intoVersionedTransaction(tx, txOptions);
|
|
8116
|
+
}
|
|
7944
8117
|
async repayIxs(market, asset, amount, glamSigner) {
|
|
7945
8118
|
const vault = this.client.base.vaultPda;
|
|
7946
8119
|
const obligation = this.client.getObligationPda(vault, market);
|
|
@@ -8018,6 +8191,16 @@ class KaminoLendingClient {
|
|
|
8018
8191
|
const tx = await this.txBuilder.borrowTx(new web3_js_1.PublicKey(market), new web3_js_1.PublicKey(asset), new anchor_1.BN(amount), txOptions);
|
|
8019
8192
|
return await this.base.sendAndConfirm(tx);
|
|
8020
8193
|
}
|
|
8194
|
+
/**
|
|
8195
|
+
* Requests an elevation group for an obligation.
|
|
8196
|
+
*/
|
|
8197
|
+
async requestElevationGroup(market, elevationGroup, txOptions = {}) {
|
|
8198
|
+
if (!this.base.staging) {
|
|
8199
|
+
throw new Error("requestElevationGroup is only available in staging mode");
|
|
8200
|
+
}
|
|
8201
|
+
const tx = await this.txBuilder.requestElevationGroupTx(new web3_js_1.PublicKey(market), elevationGroup, txOptions);
|
|
8202
|
+
return await this.base.sendAndConfirm(tx);
|
|
8203
|
+
}
|
|
8021
8204
|
/**
|
|
8022
8205
|
* Repays asset to the lending market.
|
|
8023
8206
|
*/
|
|
@@ -8131,7 +8314,7 @@ const borsh_1 = __webpack_require__(30);
|
|
|
8131
8314
|
const web3_js_1 = __webpack_require__(5);
|
|
8132
8315
|
const utils_1 = __webpack_require__(32);
|
|
8133
8316
|
const base_1 = __webpack_require__(65);
|
|
8134
|
-
const decimal_js_1 = tslib_1.__importDefault(__webpack_require__(
|
|
8317
|
+
const decimal_js_1 = tslib_1.__importDefault(__webpack_require__(53));
|
|
8135
8318
|
const constants_1 = __webpack_require__(34);
|
|
8136
8319
|
const MAX_RESERVES = 25;
|
|
8137
8320
|
class KVaultState extends base_1.Decodable {
|
|
@@ -8436,7 +8619,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
8436
8619
|
exports.KaminoFarmClient = void 0;
|
|
8437
8620
|
const anchor_1 = __webpack_require__(4);
|
|
8438
8621
|
const web3_js_1 = __webpack_require__(5);
|
|
8439
|
-
const base_1 = __webpack_require__(
|
|
8622
|
+
const base_1 = __webpack_require__(61);
|
|
8440
8623
|
const spl_token_1 = __webpack_require__(26);
|
|
8441
8624
|
const constants_1 = __webpack_require__(34);
|
|
8442
8625
|
const rpc_1 = __webpack_require__(37);
|
|
@@ -8698,7 +8881,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
8698
8881
|
exports.KaminoVaultsClient = void 0;
|
|
8699
8882
|
const anchor_1 = __webpack_require__(4);
|
|
8700
8883
|
const web3_js_1 = __webpack_require__(5);
|
|
8701
|
-
const base_1 = __webpack_require__(
|
|
8884
|
+
const base_1 = __webpack_require__(61);
|
|
8702
8885
|
const utils_1 = __webpack_require__(32);
|
|
8703
8886
|
const spl_token_1 = __webpack_require__(26);
|
|
8704
8887
|
const constants_1 = __webpack_require__(34);
|
|
@@ -8893,7 +9076,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
8893
9076
|
exports.InvestClient = void 0;
|
|
8894
9077
|
const web3_js_1 = __webpack_require__(5);
|
|
8895
9078
|
const spl_token_1 = __webpack_require__(26);
|
|
8896
|
-
const base_1 = __webpack_require__(
|
|
9079
|
+
const base_1 = __webpack_require__(61);
|
|
8897
9080
|
const constants_1 = __webpack_require__(34);
|
|
8898
9081
|
const glamPDAs_1 = __webpack_require__(43);
|
|
8899
9082
|
const accounts_1 = __webpack_require__(33);
|
|
@@ -9222,7 +9405,7 @@ const anchor_1 = __webpack_require__(4);
|
|
|
9222
9405
|
const assets_1 = __webpack_require__(68);
|
|
9223
9406
|
const models_1 = __webpack_require__(24);
|
|
9224
9407
|
const utils_1 = __webpack_require__(32);
|
|
9225
|
-
const decimal_js_1 = tslib_1.__importDefault(__webpack_require__(
|
|
9408
|
+
const decimal_js_1 = tslib_1.__importDefault(__webpack_require__(53));
|
|
9226
9409
|
const spl_token_1 = __webpack_require__(26);
|
|
9227
9410
|
const constants_1 = __webpack_require__(34);
|
|
9228
9411
|
const deser_1 = __webpack_require__(82);
|
|
@@ -9691,11 +9874,16 @@ class PriceClient {
|
|
|
9691
9874
|
const { marketIndex, marketPda } = perpPosition;
|
|
9692
9875
|
const { lastOraclePrice, cumulativeFundingRateLong, cumulativeFundingRateShort, } = perpMarketsMap.get(marketPda);
|
|
9693
9876
|
const amount = perpPosition.getUsdValueScaled(lastOraclePrice, cumulativeFundingRateLong, cumulativeFundingRateShort);
|
|
9877
|
+
const baseAssetAmountUi = (0, utils_1.toUiAmount)(perpPosition.baseAssetAmount, 9);
|
|
9694
9878
|
const { usdPrice, slot } = await this.getTokenPrice(constants_1.USDC, tokenPricesMap);
|
|
9695
9879
|
const holding = new Holding(constants_1.USDC, 6, amount, usdPrice, { slot, source: priceSource }, "DriftProtocol", {
|
|
9696
9880
|
user: userPda,
|
|
9697
9881
|
marketIndex,
|
|
9698
9882
|
marketType: "perp",
|
|
9883
|
+
// Preserve both USD value and signed base size for downstream UIs.
|
|
9884
|
+
usdValueUi: (0, utils_1.toUiAmount)(amount, 6),
|
|
9885
|
+
baseAssetAmount: perpPosition.baseAssetAmount.toString(),
|
|
9886
|
+
baseAssetAmountUi,
|
|
9699
9887
|
});
|
|
9700
9888
|
holdings.push(holding);
|
|
9701
9889
|
}
|
|
@@ -9709,15 +9897,54 @@ class PriceClient {
|
|
|
9709
9897
|
const dvaultUserData = accountsDataMap.get(dvault.user);
|
|
9710
9898
|
const { spotPositions, perpPositions } = deser_1.DriftUser.decode(dvault.user, dvaultUserData);
|
|
9711
9899
|
const aum = dvault.aumInBaseAsset(spotPositions, perpPositions, spotMarketsMap, perpMarketsMap);
|
|
9712
|
-
|
|
9713
|
-
|
|
9714
|
-
|
|
9715
|
-
|
|
9900
|
+
// Deduct accrued management fee from AUM (matches Rust logic)
|
|
9901
|
+
const clockData = accountsDataMap.get(web3_js_1.SYSVAR_CLOCK_PUBKEY);
|
|
9902
|
+
const nowTs = new anchor_1.BN(clockData ? clockData.readUInt32LE(32) : 0);
|
|
9903
|
+
let aumPostMgmt = aum;
|
|
9904
|
+
if (dvault.managementFee.gtn(0) && aum.gtn(0)) {
|
|
9905
|
+
const sinceLast = nowTs.sub(dvault.lastFeeUpdateTs);
|
|
9906
|
+
const depositorsAum = aum
|
|
9907
|
+
.mul(dvault.userShares)
|
|
9908
|
+
.div(dvault.totalShares);
|
|
9909
|
+
const mgmtFee = depositorsAum
|
|
9910
|
+
.mul(dvault.managementFee)
|
|
9911
|
+
.div(new anchor_1.BN(1000000))
|
|
9912
|
+
.mul(sinceLast)
|
|
9913
|
+
.div(new anchor_1.BN(31536000));
|
|
9914
|
+
aumPostMgmt = aum.sub(mgmtFee);
|
|
9915
|
+
}
|
|
9916
|
+
// Compute depositor position WITHOUT pending withdrawal (matches Rust logic)
|
|
9917
|
+
const depositorNetShares = depositor.netSharesRebased(dvault.sharesBase);
|
|
9918
|
+
const sharesPosition = depositorNetShares
|
|
9919
|
+
.mul(aumPostMgmt)
|
|
9920
|
+
.div(dvault.totalShares);
|
|
9921
|
+
const pendingWithdrawalValue = depositor.lastWithdrawRequest.value;
|
|
9922
|
+
// PnL & fee breakdown (perf fee is computed on shares position only)
|
|
9923
|
+
const costBasis = depositor.netDeposits.add(depositor.cumulativeProfitShareAmount);
|
|
9924
|
+
const pnlBeforeFees = sharesPosition.sub(costBasis);
|
|
9925
|
+
let pendingPerfFee = new anchor_1.BN(0);
|
|
9926
|
+
if (dvault.profitShare > 0) {
|
|
9927
|
+
const hurdleBaseline = costBasis
|
|
9928
|
+
.mul(new anchor_1.BN(dvault.hurdleRate))
|
|
9929
|
+
.div(new anchor_1.BN(1000000));
|
|
9930
|
+
if (pnlBeforeFees.gt(hurdleBaseline)) {
|
|
9931
|
+
pendingPerfFee = pnlBeforeFees
|
|
9932
|
+
.mul(new anchor_1.BN(dvault.profitShare))
|
|
9933
|
+
.div(new anchor_1.BN(1000000));
|
|
9934
|
+
}
|
|
9935
|
+
}
|
|
9936
|
+
// final = shares_position - perf_fee + pending_withdrawal
|
|
9937
|
+
const amount = sharesPosition
|
|
9938
|
+
.sub(pendingPerfFee)
|
|
9939
|
+
.add(pendingWithdrawalValue);
|
|
9716
9940
|
const { mint, decimals } = dvault.getBaseAsset(spotMarketsMap);
|
|
9717
9941
|
const { usdPrice, slot } = await this.getTokenPrice(mint, tokenPricesMap);
|
|
9718
9942
|
const holding = new Holding(mint, decimals, amount, usdPrice, { slot, source: priceSource }, "DriftVaults", {
|
|
9719
9943
|
vault: dvault.getAddress(),
|
|
9720
9944
|
depositor: depositor.getAddress(),
|
|
9945
|
+
pnlBeforeFees,
|
|
9946
|
+
pendingPerfFee,
|
|
9947
|
+
profitSharePct: dvault.profitShare / 10000,
|
|
9721
9948
|
});
|
|
9722
9949
|
holdings.push(holding);
|
|
9723
9950
|
}
|
|
@@ -9768,10 +9995,14 @@ class PriceClient {
|
|
|
9768
9995
|
}
|
|
9769
9996
|
async getKaminoVaultsHoldings(kvaultAtasAndStates, reservesMap, accountsDataMap, tokenPricesMap, priceSource) {
|
|
9770
9997
|
const holdings = [];
|
|
9998
|
+
const FRACTION_SCALE = new decimal_js_1.default(2).pow(60); // U68F60 fixed-point scale
|
|
9999
|
+
const SECONDS_PER_YEAR_KAMINO = 31556926;
|
|
10000
|
+
const clockData = accountsDataMap.get(web3_js_1.SYSVAR_CLOCK_PUBKEY);
|
|
10001
|
+
const nowTs = clockData ? clockData.readUInt32LE(32) : 0;
|
|
9771
10002
|
for (const [ata, kvaultState] of kvaultAtasAndStates.pkEntries()) {
|
|
9772
10003
|
const ataData = accountsDataMap.get(ata);
|
|
9773
10004
|
const tokenAccount = spl_token_1.AccountLayout.decode(ataData);
|
|
9774
|
-
let
|
|
10005
|
+
let aumAndFees = new decimal_js_1.default(kvaultState.tokenAvailable.toString());
|
|
9775
10006
|
kvaultState.validAllocations.map((allocation) => {
|
|
9776
10007
|
const reserve = reservesMap.get(allocation.reserve);
|
|
9777
10008
|
const { collateralExchangeRate } = reserve;
|
|
@@ -9779,17 +10010,46 @@ class PriceClient {
|
|
|
9779
10010
|
const liqAmount = new decimal_js_1.default(allocation.ctokenAllocation.toString())
|
|
9780
10011
|
.div(collateralExchangeRate)
|
|
9781
10012
|
.floor();
|
|
9782
|
-
|
|
10013
|
+
aumAndFees = aumAndFees.add(liqAmount);
|
|
9783
10014
|
});
|
|
9784
|
-
//
|
|
10015
|
+
// Deduct pending fees from AUM (matches Rust: aum = available + allocated - pending_fees)
|
|
10016
|
+
const pendingFees = new decimal_js_1.default(kvaultState.pendingFeesSf.toString()).div(FRACTION_SCALE);
|
|
10017
|
+
let vaultAum = aumAndFees.sub(pendingFees);
|
|
10018
|
+
const sharesIssued = new decimal_js_1.default(kvaultState.sharesIssued.toString());
|
|
10019
|
+
if (vaultAum.lte(0) || sharesIssued.lte(0)) {
|
|
10020
|
+
continue; // early return like Rust: if vault_aum == 0 || shares_issued == 0
|
|
10021
|
+
}
|
|
10022
|
+
// Management fee: prev_aum * from_bps(mgmt_fee_bps) * since_last / SECONDS_PER_YEAR
|
|
10023
|
+
const prevAum = new decimal_js_1.default(kvaultState.prevAumSf.toString()).div(FRACTION_SCALE);
|
|
10024
|
+
const sinceLast = Math.max(0, nowTs - kvaultState.lastFeeChargeTimestamp.toNumber());
|
|
10025
|
+
let mgmtCharge = new decimal_js_1.default(0);
|
|
10026
|
+
if (sinceLast > 0) {
|
|
10027
|
+
const mgmtFeeRate = new decimal_js_1.default(kvaultState.managementFeeBps.toString()).div(10000);
|
|
10028
|
+
mgmtCharge = prevAum
|
|
10029
|
+
.mul(mgmtFeeRate)
|
|
10030
|
+
.mul(sinceLast)
|
|
10031
|
+
.div(SECONDS_PER_YEAR_KAMINO);
|
|
10032
|
+
}
|
|
10033
|
+
// Performance fee: from_bps(perf_fee_bps) * max(0, vault_aum - prev_aum)
|
|
10034
|
+
const earnedInterest = decimal_js_1.default.max(0, vaultAum.sub(prevAum));
|
|
10035
|
+
const perfCharge = new decimal_js_1.default(kvaultState.performanceFeeBps.toString())
|
|
10036
|
+
.div(10000)
|
|
10037
|
+
.mul(earnedInterest);
|
|
10038
|
+
// Deduct fees from AUM (matches Rust: vault_aum = vault_aum - mgmt_charge - perf_charge)
|
|
10039
|
+
vaultAum = vaultAum.sub(mgmtCharge).sub(perfCharge);
|
|
10040
|
+
// calculate liquidity token amount: shares * vault_aum.floor() / shares_issued
|
|
9785
10041
|
const amount = new decimal_js_1.default(tokenAccount.amount.toString())
|
|
9786
|
-
.
|
|
9787
|
-
.
|
|
10042
|
+
.mul(vaultAum.floor())
|
|
10043
|
+
.div(sharesIssued)
|
|
9788
10044
|
.floor();
|
|
9789
10045
|
const { usdPrice, slot } = await this.getTokenPrice(kvaultState.tokenMint, tokenPricesMap);
|
|
9790
10046
|
const holding = new Holding(kvaultState.tokenMint, kvaultState.tokenMintDecimals.toNumber(), new anchor_1.BN(amount.toString()), usdPrice, { slot, source: priceSource }, "KaminoVaults", {
|
|
9791
10047
|
kaminoVault: kvaultState._address,
|
|
9792
10048
|
kaminoVaultAta: ata,
|
|
10049
|
+
pendingMgmtFee: mgmtCharge.toFixed(0),
|
|
10050
|
+
pendingPerfFee: perfCharge.toFixed(0),
|
|
10051
|
+
managementFeeBps: kvaultState.managementFeeBps.toNumber(),
|
|
10052
|
+
performanceFeeBps: kvaultState.performanceFeeBps.toNumber(),
|
|
9793
10053
|
});
|
|
9794
10054
|
holdings.push(holding);
|
|
9795
10055
|
}
|
|
@@ -10224,7 +10484,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
10224
10484
|
exports.FeesClient = void 0;
|
|
10225
10485
|
const web3_js_1 = __webpack_require__(5);
|
|
10226
10486
|
const spl_token_1 = __webpack_require__(26);
|
|
10227
|
-
const base_1 = __webpack_require__(
|
|
10487
|
+
const base_1 = __webpack_require__(61);
|
|
10228
10488
|
const accounts_1 = __webpack_require__(33);
|
|
10229
10489
|
class TxBuilder extends base_1.BaseTxBuilder {
|
|
10230
10490
|
async crystallizeFeesIxs(glamSigner) {
|
|
@@ -10400,13 +10660,13 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
10400
10660
|
exports.MintClient = void 0;
|
|
10401
10661
|
const anchor_1 = __webpack_require__(4);
|
|
10402
10662
|
const web3_js_1 = __webpack_require__(5);
|
|
10403
|
-
const base_1 = __webpack_require__(
|
|
10663
|
+
const base_1 = __webpack_require__(61);
|
|
10404
10664
|
const spl_token_1 = __webpack_require__(26);
|
|
10405
10665
|
const models_1 = __webpack_require__(24);
|
|
10406
10666
|
const constants_1 = __webpack_require__(34);
|
|
10407
10667
|
const utils_1 = __webpack_require__(32);
|
|
10408
10668
|
const glamPDAs_1 = __webpack_require__(43);
|
|
10409
|
-
const clientConfig_1 = __webpack_require__(
|
|
10669
|
+
const clientConfig_1 = __webpack_require__(59);
|
|
10410
10670
|
const common_1 = __webpack_require__(28);
|
|
10411
10671
|
class TxBuilder extends base_1.BaseTxBuilder {
|
|
10412
10672
|
async setTokenAccountsStatesIx(tokenAccounts, frozen, glamSigner) {
|
|
@@ -10846,7 +11106,7 @@ exports.MintClient = MintClient;
|
|
|
10846
11106
|
|
|
10847
11107
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
10848
11108
|
exports.AccessClient = void 0;
|
|
10849
|
-
const base_1 = __webpack_require__(
|
|
11109
|
+
const base_1 = __webpack_require__(61);
|
|
10850
11110
|
const models_1 = __webpack_require__(24);
|
|
10851
11111
|
class TxBuilder extends base_1.BaseTxBuilder {
|
|
10852
11112
|
async emergencyAccessUpdateIx(args, signer) {
|
|
@@ -10971,7 +11231,7 @@ exports.AccessClient = AccessClient;
|
|
|
10971
11231
|
|
|
10972
11232
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
10973
11233
|
exports.TimelockClient = void 0;
|
|
10974
|
-
const base_1 = __webpack_require__(
|
|
11234
|
+
const base_1 = __webpack_require__(61);
|
|
10975
11235
|
const models_1 = __webpack_require__(24);
|
|
10976
11236
|
class TxBuilder extends base_1.BaseTxBuilder {
|
|
10977
11237
|
async applyStateTimelockIx(glamSigner) {
|
|
@@ -11075,7 +11335,7 @@ exports.StakeClient = void 0;
|
|
|
11075
11335
|
const anchor_1 = __webpack_require__(4);
|
|
11076
11336
|
const web3_js_1 = __webpack_require__(5);
|
|
11077
11337
|
const constants_1 = __webpack_require__(34);
|
|
11078
|
-
const base_1 = __webpack_require__(
|
|
11338
|
+
const base_1 = __webpack_require__(61);
|
|
11079
11339
|
class TxBuilder extends base_1.BaseTxBuilder {
|
|
11080
11340
|
async initializeAndDelegateStakeIxs(vote, amount, glamSigner) {
|
|
11081
11341
|
const [stakeAccount, createStakeAccountIx] = await this.client.createStakeAccount(glamSigner);
|
|
@@ -11299,7 +11559,7 @@ exports.StakePoolClient = void 0;
|
|
|
11299
11559
|
const anchor_1 = __webpack_require__(4);
|
|
11300
11560
|
const web3_js_1 = __webpack_require__(5);
|
|
11301
11561
|
const constants_1 = __webpack_require__(34);
|
|
11302
|
-
const base_1 = __webpack_require__(
|
|
11562
|
+
const base_1 = __webpack_require__(61);
|
|
11303
11563
|
const spl_stake_pool_1 = __webpack_require__(89);
|
|
11304
11564
|
const spl_token_1 = __webpack_require__(26);
|
|
11305
11565
|
const accounts_1 = __webpack_require__(33);
|
|
@@ -11520,7 +11780,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
11520
11780
|
exports.CctpClient = exports.CctpBridgeEvent = void 0;
|
|
11521
11781
|
const anchor_1 = __webpack_require__(4);
|
|
11522
11782
|
const web3_js_1 = __webpack_require__(5);
|
|
11523
|
-
const base_1 = __webpack_require__(
|
|
11783
|
+
const base_1 = __webpack_require__(61);
|
|
11524
11784
|
const constants_1 = __webpack_require__(34);
|
|
11525
11785
|
const utils_1 = __webpack_require__(32);
|
|
11526
11786
|
const bytes_1 = __webpack_require__(36);
|
|
@@ -15502,17 +15762,10 @@ const defaultConfigPath = () => {
|
|
|
15502
15762
|
return configPath;
|
|
15503
15763
|
};
|
|
15504
15764
|
const parseTxError = (error) => {
|
|
15505
|
-
if (error instanceof web3_js_1.TransactionExpiredBlockheightExceededError) {
|
|
15506
|
-
return "Transaction expired";
|
|
15507
|
-
}
|
|
15508
15765
|
if (error instanceof anchor_1.AnchorError) {
|
|
15509
15766
|
return error.error.errorMessage;
|
|
15510
15767
|
}
|
|
15511
|
-
|
|
15512
|
-
if (message.includes("encoding overruns Uint8Array")) {
|
|
15513
|
-
return "Transaction too large: the transaction exceeds the maximum size limit. Try using an address lookup table (glam alt create) to reduce transaction size.";
|
|
15514
|
-
}
|
|
15515
|
-
return message;
|
|
15768
|
+
return (0, glam_sdk_1.parseTxError)(error);
|
|
15516
15769
|
};
|
|
15517
15770
|
exports.parseTxError = parseTxError;
|
|
15518
15771
|
async function confirmOperation(message) {
|
|
@@ -48047,7 +48300,7 @@ exports.installKaminoLendCommands = installKaminoLendCommands;
|
|
|
48047
48300
|
const glam_sdk_1 = __webpack_require__(1);
|
|
48048
48301
|
const utils_1 = __webpack_require__(103);
|
|
48049
48302
|
const web3_js_1 = __webpack_require__(5);
|
|
48050
|
-
const decimal_js_1 = __webpack_require__(
|
|
48303
|
+
const decimal_js_1 = __webpack_require__(53);
|
|
48051
48304
|
function installKaminoLendCommands(klend, context) {
|
|
48052
48305
|
klend
|
|
48053
48306
|
.command("view-policy")
|
|
@@ -48250,6 +48503,18 @@ function installKaminoLendCommands(klend, context) {
|
|
|
48250
48503
|
message: `Confirm repaying ${amount} ${asset}`,
|
|
48251
48504
|
}, (txSig) => `Repaid ${amount} ${asset}: ${txSig}`);
|
|
48252
48505
|
});
|
|
48506
|
+
klend
|
|
48507
|
+
.command("request-elevation-group")
|
|
48508
|
+
.argument("<market>", "Kamino lending market public key", utils_1.validatePublicKey)
|
|
48509
|
+
.argument("<elevation-group>", "Elevation group number", parseInt)
|
|
48510
|
+
.option("-y, --yes", "Skip confirmation prompt", false)
|
|
48511
|
+
.description("Request elevation group for an obligation (staging only)")
|
|
48512
|
+
.action(async (market, elevationGroup, options) => {
|
|
48513
|
+
await (0, utils_1.executeTxWithErrorHandling)(() => context.glamClient.kaminoLending.requestElevationGroup(market, elevationGroup, context.txOptions), {
|
|
48514
|
+
skip: options?.yes,
|
|
48515
|
+
message: `Confirm requesting elevation group ${elevationGroup} for market ${market}`,
|
|
48516
|
+
}, (txSig) => `Requested elevation group ${elevationGroup} for market ${market}: ${txSig}`);
|
|
48517
|
+
});
|
|
48253
48518
|
}
|
|
48254
48519
|
|
|
48255
48520
|
|
|
@@ -48645,6 +48910,7 @@ function installDelegateCommands(delegate, context) {
|
|
|
48645
48910
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
48646
48911
|
exports.installJupiterCommands = installJupiterCommands;
|
|
48647
48912
|
const glam_sdk_1 = __webpack_require__(1);
|
|
48913
|
+
const web3_js_1 = __webpack_require__(5);
|
|
48648
48914
|
const utils_1 = __webpack_require__(103);
|
|
48649
48915
|
async function findToken(jupApi, value) {
|
|
48650
48916
|
const tokenList = await jupApi.fetchTokensList();
|
|
@@ -48758,12 +49024,13 @@ function installJupiterCommands(program, context) {
|
|
|
48758
49024
|
.option("-s, --slippage-bps <bps>", "Slippage bps, defaults to 5 (0.05%)", "5")
|
|
48759
49025
|
.option("--use-v1", "Use v1 instruction (default: v2)", false)
|
|
48760
49026
|
.option("-d, --only-direct-routes", "Direct routes only")
|
|
49027
|
+
.option("-t, --tracking-account <pubkey>", "Tracking account public key")
|
|
48761
49028
|
.option("-y, --yes", "Skip confirmation", false)
|
|
48762
49029
|
.action(async (from, to, amount, options) => {
|
|
48763
49030
|
const jupApi = context.glamClient.jupiterSwap.jupApi;
|
|
48764
49031
|
const tokenFrom = await findToken(jupApi, from);
|
|
48765
49032
|
const tokenTo = await findToken(jupApi, to);
|
|
48766
|
-
const { maxAccounts, slippageBps, onlyDirectRoutes, useV1 } = options;
|
|
49033
|
+
const { maxAccounts, slippageBps, onlyDirectRoutes, useV1, trackingAccount, } = options;
|
|
48767
49034
|
const quoteParams = {
|
|
48768
49035
|
inputMint: tokenFrom.address,
|
|
48769
49036
|
outputMint: tokenTo.address,
|
|
@@ -48776,7 +49043,12 @@ function installJupiterCommands(program, context) {
|
|
|
48776
49043
|
...(onlyDirectRoutes ? { onlyDirectRoutes } : {}),
|
|
48777
49044
|
instructionVersion: useV1 ? "V1" : "V2",
|
|
48778
49045
|
};
|
|
48779
|
-
await (0, utils_1.executeTxWithErrorHandling)(() => context.glamClient.jupiterSwap.swap({
|
|
49046
|
+
await (0, utils_1.executeTxWithErrorHandling)(() => context.glamClient.jupiterSwap.swap({
|
|
49047
|
+
quoteParams,
|
|
49048
|
+
trackingAccount: trackingAccount
|
|
49049
|
+
? new web3_js_1.PublicKey(trackingAccount)
|
|
49050
|
+
: undefined,
|
|
49051
|
+
}, context.txOptions), {
|
|
48780
49052
|
skip: options?.yes,
|
|
48781
49053
|
message: `Confirm swapping ${amount} ${tokenFrom.symbol} to ${tokenTo.symbol} with quote params: ${JSON.stringify(quoteParams, null, 2)}`,
|
|
48782
49054
|
}, (txSig) => `Swapped ${amount} ${tokenFrom.symbol} to ${tokenTo.symbol}: ${txSig}`);
|
|
@@ -50316,7 +50588,7 @@ program
|
|
|
50316
50588
|
initialize(config, skipSimulation);
|
|
50317
50589
|
await (0, idl_1.idlCheck)(context.glamClient);
|
|
50318
50590
|
})
|
|
50319
|
-
.version("1.0.12-alpha.
|
|
50591
|
+
.version("1.0.12-alpha.2");
|
|
50320
50592
|
program
|
|
50321
50593
|
.command("env")
|
|
50322
50594
|
.description("Display current environment setup")
|